\(\renewcommand{\AA}{\text{Å}}\)
4.13.3. LAMMPS Input Base Class
-
class 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.
Public Functions
-
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 itscommand()
member function executed, and finally the class instance is deleted.- Parameters:
lmp – pointer to the base LAMMPS class
argc – number of entries in argv
argv – argument vector
-
void file()
Process all input from the
FILE *
pointer infileThis will read lines from infile, parse and execute them until the end of the file is reached. The infile pointer will usually point to
stdin
or the input file given with the-in
command 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.- Parameters:
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
nullptr
.- Parameters:
single – string with LAMMPS command
- Returns:
string with name of the parsed command w/o arguments
-
Input(class LAMMPS*, int, char**)