I am trying to understand the MPI version of lammps code.
then you should study the LAMMPS paper and the developer guide pdf
from the LAMMPS homepage first.
if i understand correctly, the only line that code runs is from the line,
((( lammps->input->file(); )))
using namespace LAMMPS_NS;
int main(int argc, char **argv)
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
which means the function "file();" from input class runs the whole code,
"runs the whole code" is probably not the right way to describe it.
the file() method of the Input class (instance) processes the provided
input (either from a file or from stdin) in a line by line fashion and
executes it until there is no more input left or LAMMPS terminates for
some other reason.
please note that you also run the LAMMPS constructor (new LAMMPS),
which builds and initializes the basic class hierarchy (the LAMMPS
class is a composite with instances to various sub-classes that take
care of different "duties" inside of LAMMPS).
so "the whole code" are actually three(3!) steps:
- create an instance of the LAMMPS class
- process the input line-by-line until there is nothing left
- tear down the LAMMPS class (and its members).
when you run the standalone LAMMPS executable, you have nothing else
but a very thin wrapper around the LAMMPS library.
correct me if i am wrong.
if file(); function runs the whole code, how come integrate, vert::run() and
all other main functions activates and produce results???
these are all triggered by individual commands. each command in the
input is executed *immediately*. but there are two kinds of commands.
those that create or delete instances of classes (e.g. fix/unfix,
compute/uncompute, pair_style, bond_style) and those that cause
changes to the simulated system or its settings.