[lammps-users] When is verlet::run invoked?

Hello,

I’m looking through the source code (29 Oct 2020), and trying to get my bearings. I’ve read through the beginning of chapter 15, and found that quite helpful, especially when comparing to the verlet.cpp file. However, I’m having a hard understanding…

  1. Is the bulk of LAMMPS run when you hit the line LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);?

  2. Where is the verlet::run() command called exactly? I’m having a hard time following through the code to identify where it is actually run, or sequence of commands that result in it running, and keep getting caught in the weeds. The manual seemed to say it was called from the fix commands, but I’m having a difficult time seeing the sequence of commands from point A to point B.

I don’t mind getting in the weeds, but some orientation of going from point A (main.cpp) to point B (verlet::run()) would be quite helpful! Just a high-level but usable roadmap, if possible. I’m aware there are probably many contingencies and variations, but even for just a basic run, like for something like the micelle example.

Best,
Christian

Hello,

I’m looking through the source code (29 Oct 2020), and trying to get my bearings. I’ve read through the beginning of chapter 15, and found that quite helpful, especially when comparing to the verlet.cpp file. However, I’m having a hard understanding…

  1. Is the bulk of LAMMPS run when you hit the line LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);?

no. that is done in the next line: lammps->input->file();
the LAMMPS constructor will have either opened the file pointed to by the -in argument or it will have connected stdin to the input FILE pointer.
the Input::file() function will read from the open file until it reaches EOF.
for what happens there, please see https://docs.lammps.org/Run_basics.html

  1. Where is the verlet::run() command called exactly? I’m having a hard time following through the code to identify where it is actually run, or sequence of commands that result in it running, and keep getting caught in the weeds. The manual seemed to say it was called from the fix commands, but I’m having a difficult time seeing the sequence of commands from point A to point B.

when the parser encounters the “run” command in the input.
that will create an instance of the Run class (from run.cpp)
and then run its command() function with the arguments on the input file line.

that will then do a variety of things, mostly perusing the class instances in the main LAMMPS class or inside them. https://docs.lammps.org/Developer_org.html#class-topology

the actual line calling Verlet::run() is update->integrate->run(nsteps);

Please keep in mind that LAMMPS uses polymorphism and composites as indicated with the shapes and colors in the class topology.

I don’t mind getting in the weeds, but some orientation of going from point A (main.cpp) to point B (verlet::run()) would be quite helpful! Just a high-level but usable roadmap, if possible. I’m aware there are probably many contingencies and variations, but even for just a basic run, like for something like the micelle example.

the best way to learn about the inner workings is to study the (still horribly incomplete) Programmer’s Guide, especially check out the examples in https://docs.lammps.org/Cplusplus.html

HTH,
Axel.

Hello,

Thank you for the guidance! I see it better now :slight_smile:

Best,
Christian