4.9.3. LAMMPS Input Base Class¶
class LAMMPS_NS::Input : protected Pointers¶
Class for processing commands and input files.
The Input class contains methods for reading, pre-processing and parsing LAMMPS commands and input files and will dispatch commands to the respective class instances or contains the code to execute the commands directly. It also contains the instance of the Variable class which performs computations and text substitutions.
Input(class LAMMPS*, int, char**)¶
Input class constructor
This sets up the input processing, processes the -var and -echo command line flags, holds the factory of commands and creates and initializes an instance of the Variable class.
To execute a command, a specific class instance, derived from
Command, is created, then its
command()member function executed, and finally the class instance is deleted.
lmp – pointer to the base LAMMPS class
argc – number of entries in argv
argv – argument vector
Process all input from the
FILE *pointer infile
This will read lines from infile, parse and execute them until the end of the file is reached. The infile pointer will usually point to
stdinor the input file given with the
-incommand line flag.
void file(const char*)¶
Process all input from the file filename
This function opens the file at the path filename, put the current file pointer stored in infile on a stack and instead assign infile with the newly opened file pointer. Then it will call the
Input::file()function to read, parse and execute the contents of that file. When the end of the file is reached, it is closed and the previous file pointer from the infile file pointer stack restored to infile.
filename – name of file with LAMMPS commands
char *one(const std::string&)¶
Process a single command from a string in single
This function takes the text in single, makes a copy, parses that, executes the command and returns the name of the command (without the arguments). If there was no command in single it will return
single – string with LAMMPS command
string with name of the parsed command w/o arguments
- Input(class LAMMPS*, int, char**)¶