Skip to content
Snippets Groups Projects
input.h 10.8 KiB
Newer Older
sjplimp's avatar
 
sjplimp committed
/* -*- c++ -*- ----------------------------------------------------------
sjplimp's avatar
sjplimp committed
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
sjplimp's avatar
 
sjplimp committed
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov
sjplimp's avatar
sjplimp committed

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
sjplimp's avatar
 
sjplimp committed
   certain rights in this software.  This software is distributed under
sjplimp's avatar
sjplimp committed
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

sjplimp's avatar
 
sjplimp committed
#ifndef LMP_INPUT_H
#define LMP_INPUT_H
sjplimp's avatar
sjplimp committed

sjplimp's avatar
 
sjplimp committed
#include "pointers.h"
sjplimp's avatar
 
sjplimp committed
#include <map>
#include <string>
sjplimp's avatar
sjplimp committed

sjplimp's avatar
 
sjplimp committed
namespace LAMMPS_NS {
sjplimp's avatar
sjplimp committed

sjplimp's avatar
 
sjplimp committed
class Input : protected Pointers {
sjplimp's avatar
 
sjplimp committed
  friend class Info;
sjplimp's avatar
sjplimp committed
 public:
  int narg;                    // # of command args
  char **arg;                  // parsed args for command
sjplimp's avatar
 
sjplimp committed
  class Variable *variable;    // defined variables
sjplimp's avatar
sjplimp committed

sjplimp's avatar
 
sjplimp committed
  Input(class LAMMPS *, int, char **);
sjplimp's avatar
sjplimp committed
  ~Input();
  void file();                   // process all input
sjplimp's avatar
 
sjplimp committed
  void file(const char *);       // process an input script
  char *one(const char *);       // process a single command
sjplimp's avatar
 
sjplimp committed
  void substitute(char *&, char *&, int &, int &, int);
sjplimp's avatar
 
sjplimp committed
                                 // substitute for variables in a string
sjplimp's avatar
 
sjplimp committed
  int expand_args(int, char **, int, char **&);  // expand args due to wildcard
sjplimp's avatar
sjplimp committed

 protected:
  char *command;               // ptr to current command

sjplimp's avatar
sjplimp committed
 private:
  int me;                      // proc ID
  int maxarg;                  // max # of args in arg
sjplimp's avatar
 
sjplimp committed
  char *line,*copy,*work;      // input line & copy and work string
  int maxline,maxcopy,maxwork; // max lengths of char strings
sjplimp's avatar
sjplimp committed
  int echo_screen;             // 0 = no, 1 = yes
  int echo_log;                // 0 = no, 1 = yes
  int nfile,maxfile;           // current # and max # of open input files
  int label_active;            // 0 = no label, 1 = looking for label
  char *labelstr;              // label string being looked for
  int jump_skip;               // 1 if skipping next jump, 0 otherwise
sjplimp's avatar
 
sjplimp committed
  int ifthenelse_flag;         // 1 if executing commands inside an if-then-else
sjplimp's avatar
sjplimp committed

  FILE **infiles;              // list of open input files

sjplimp's avatar
sjplimp committed
 public:
sjplimp's avatar
 
sjplimp committed
  typedef void (*CommandCreator)(LAMMPS *, int, char **);
sjplimp's avatar
sjplimp committed
  typedef std::map<std::string,CommandCreator> CommandCreatorMap;
  CommandCreatorMap *command_map;
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
sjplimp committed
 protected:
sjplimp's avatar
 
sjplimp committed
  template <typename T> static void command_creator(LAMMPS *, int, char **);

sjplimp's avatar
 
sjplimp committed
 private:
sjplimp's avatar
 
sjplimp committed
  void parse();                          // parse an input text line
  char *nextword(char *, char **);       // find next word in string with quotes
sjplimp's avatar
 
sjplimp committed
  int numtriple(char *);                 // count number of triple quotes
sjplimp's avatar
 
sjplimp committed
  void reallocate(char *&, int &, int);  // reallocate a char string
  int execute_command();                 // execute a single command
sjplimp's avatar
sjplimp committed

sjplimp's avatar
 
sjplimp committed
  void clear();                 // input script commands
sjplimp's avatar
 
sjplimp committed
  void echo();
sjplimp's avatar
 
sjplimp committed
  void ifthenelse();
sjplimp's avatar
 
sjplimp committed
  void include();
  void jump();
  void label();
  void log();
  void next_command();
sjplimp's avatar
 
sjplimp committed
  void partition();
sjplimp's avatar
 
sjplimp committed
  void print();
sjplimp's avatar
 
sjplimp committed
  void python();
sjplimp's avatar
 
sjplimp committed
  void quit();
sjplimp's avatar
 
sjplimp committed
  void shell();
sjplimp's avatar
 
sjplimp committed
  void variable_command();

sjplimp's avatar
 
sjplimp committed
  void angle_coeff();           // LAMMPS commands
sjplimp's avatar
sjplimp committed
  void angle_style();
  void atom_modify();
  void atom_style();
  void bond_coeff();
  void bond_style();
sjplimp's avatar
 
sjplimp committed
  void bond_write();
sjplimp's avatar
sjplimp committed
  void boundary();
sjplimp's avatar
 
sjplimp committed
  void box();
sjplimp's avatar
 
sjplimp committed
  void comm_modify();
  void comm_style();
sjplimp's avatar
 
sjplimp committed
  void compute();
  void compute_modify();
sjplimp's avatar
sjplimp committed
  void dielectric();
  void dihedral_coeff();
  void dihedral_style();
  void dimension();
  void dump();
  void dump_modify();
  void fix();
  void fix_modify();
  void group_command();
  void improper_coeff();
  void improper_style();
  void kspace_modify();
  void kspace_style();
  void lattice();
  void mass();
  void min_modify();
  void min_style();
sjplimp's avatar
 
sjplimp committed
  void molecule();
sjplimp's avatar
sjplimp committed
  void neigh_modify();
  void neighbor_command();
  void newton();
sjplimp's avatar
 
sjplimp committed
  void package();
sjplimp's avatar
sjplimp committed
  void pair_coeff();
  void pair_modify();
  void pair_style();
  void pair_write();
  void processors();
  void region();
  void reset_timestep();
  void restart();
  void run_style();
  void special_bonds();
sjplimp's avatar
 
sjplimp committed
  void suffix();
sjplimp's avatar
sjplimp committed
  void thermo();
  void thermo_modify();
  void thermo_style();
  void timestep();
sjplimp's avatar
 
sjplimp committed
  void timer_command();
sjplimp's avatar
 
sjplimp committed
  void uncompute();
sjplimp's avatar
sjplimp committed
  void undump();
  void unfix();
  void units();
};

sjplimp's avatar
 
sjplimp committed
}

sjplimp's avatar
sjplimp committed
#endif
sjplimp's avatar
 
sjplimp committed

/* ERROR/WARNING messages:

E: Label wasn't found in input script

Self-explanatory.

E: Unknown command: %s

The command is not known to LAMMPS.  Check the input script.

sjplimp's avatar
 
sjplimp committed
E: Invalid use of library file() function
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
This function is called thru the library interface.  This
error should not occur.  Contact the developers if it does.
sjplimp's avatar
 
sjplimp committed

E: Cannot open input script %s

Self-explanatory.

E: Unbalanced quotes in input line

No matching end double quote was found following a leading double
quote.

sjplimp's avatar
 
sjplimp committed
E: Input line quote not followed by whitespace

An end quote must be followed by whitespace.

sjplimp's avatar
 
sjplimp committed
E: Invalid variable name

Variable name used in an input script line is invalid.

sjplimp's avatar
 
sjplimp committed
E: Invalid immediate variable

Syntax of immediate value is incorrect.

E: Substitution for illegal variable %s
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed

E: Illegal ... command

Self-explanatory.  Check the input script syntax and compare to the
documentation for the command.  You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.

sjplimp's avatar
 
sjplimp committed
E: Cannot use include command within an if command

sjplimp's avatar
 
sjplimp committed
Self-explanatory.
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
E: Cannot open logfile %s

The LAMMPS log file specified in the input script cannot be opened.
Check that the path and name are correct.

sjplimp's avatar
 
sjplimp committed
E: Cannot open print file %s

sjplimp's avatar
 
sjplimp committed
Self-explanatory.
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
W: Shell command '%s' failed with error '%s'
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
Self-explanatory.
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
W: Shell command returned with non-zero status
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
This may indicate the shell command did not operate as expected.
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
E: Angle_coeff command before simulation box is defined

The angle_coeff command cannot be used before a read_data,
read_restart, or create_box command.

E: Angle_coeff command before angle_style is defined

Coefficients cannot be set in the data file or via the angle_coeff
command until an angle_style has been assigned.

E: Angle_coeff command when no angles allowed

The chosen atom style does not allow for angles to be defined.

E: Angle_style command when no angles allowed

The chosen atom style does not allow for angles to be defined.

E: Atom_style command after simulation box is defined

The atom_style command cannot be used after a read_data,
read_restart, or create_box command.

E: Bond_coeff command before simulation box is defined

The bond_coeff command cannot be used before a read_data,
read_restart, or create_box command.

E: Bond_coeff command before bond_style is defined

Coefficients cannot be set in the data file or via the bond_coeff
command until an bond_style has been assigned.

E: Bond_coeff command when no bonds allowed

The chosen atom style does not allow for bonds to be defined.

E: Bond_style command when no bonds allowed

The chosen atom style does not allow for bonds to be defined.

E: Bond_write command when no bonds allowed

UNDOCUMENTED

E: Bond_write command before bond_style is defined

UNDOCUMENTED

sjplimp's avatar
 
sjplimp committed
E: Boundary command after simulation box is defined

The boundary command cannot be used after a read_data, read_restart,
or create_box command.

sjplimp's avatar
 
sjplimp committed
E: Box command after simulation box is defined

sjplimp's avatar
 
sjplimp committed
The box command cannot be used after a read_data, read_restart, or
create_box command.
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
E: Dihedral_coeff command before simulation box is defined

The dihedral_coeff command cannot be used before a read_data,
read_restart, or create_box command.

E: Dihedral_coeff command before dihedral_style is defined

Coefficients cannot be set in the data file or via the dihedral_coeff
command until an dihedral_style has been assigned.

E: Dihedral_coeff command when no dihedrals allowed

The chosen atom style does not allow for dihedrals to be defined.

E: Dihedral_style command when no dihedrals allowed

The chosen atom style does not allow for dihedrals to be defined.

E: Dimension command after simulation box is defined

The dimension command cannot be used after a read_data,
read_restart, or create_box command.

E: Improper_coeff command before simulation box is defined

The improper_coeff command cannot be used before a read_data,
read_restart, or create_box command.

E: Improper_coeff command before improper_style is defined

Coefficients cannot be set in the data file or via the improper_coeff
command until an improper_style has been assigned.

E: Improper_coeff command when no impropers allowed

The chosen atom style does not allow for impropers to be defined.

E: Improper_style command when no impropers allowed

The chosen atom style does not allow for impropers to be defined.

E: KSpace style has not yet been set

Cannot use kspace_modify command until a kspace style is set.

E: Mass command before simulation box is defined

The mass command cannot be used before a read_data, read_restart, or
create_box command.

E: Min_style command before simulation box is defined

The min_style command cannot be used before a read_data, read_restart,
or create_box command.

E: Newton bond change after simulation box is defined

The newton command cannot be used to change the newton bond value
after a read_data, read_restart, or create_box command.

E: Package command after simulation box is defined

sjplimp's avatar
 
sjplimp committed
The package command cannot be used afer a read_data, read_restart, or
create_box command.
sjplimp's avatar
 
sjplimp committed

sjplimp's avatar
 
sjplimp committed
E: Package gpu command without GPU package installed

sjplimp's avatar
 
sjplimp committed
The GPU package must be installed via "make yes-gpu" before LAMMPS is
built.
sjplimp's avatar
 
sjplimp committed

E: Package kokkos command without KOKKOS package enabled

sjplimp's avatar
 
sjplimp committed
The KOKKOS package must be installed via "make yes-kokkos" before
LAMMPS is built, and the "-k on" must be used to enable the package.
sjplimp's avatar
 
sjplimp committed

E: Package omp command without USER-OMP package installed

sjplimp's avatar
 
sjplimp committed
The USER-OMP package must be installed via "make yes-user-omp" before
LAMMPS is built.
sjplimp's avatar
 
sjplimp committed

E: Package intel command without USER-INTEL package installed

sjplimp's avatar
 
sjplimp committed
The USER-INTEL package must be installed via "make yes-user-intel"
before LAMMPS is built.
sjplimp's avatar
 
sjplimp committed

E: Pair_coeff command before simulation box is defined

The pair_coeff command cannot be used before a read_data,
read_restart, or create_box command.

E: Pair_coeff command before pair_style is defined

Self-explanatory.

E: Pair_modify command before pair_style is defined

Self-explanatory.

E: Pair_write command before pair_style is defined

Self-explanatory.

E: Processors command after simulation box is defined

The processors command cannot be used after a read_data, read_restart,
or create_box command.

E: Run_style command before simulation box is defined

The run_style command cannot be used before a read_data,
read_restart, or create_box command.

E: Units command after simulation box is defined

The units command cannot be used after a read_data, read_restart, or
create_box command.

U: Substitution for illegal variable

Input script line contained a variable that could not be substituted
for.

sjplimp's avatar
 
sjplimp committed
*/