LAMMPS from scratch · 15 min

From run 250 to the loop

Typing run 250 does much more than 250 steps: LAMMPS initialises every member, wraps and shares the atoms, builds the first neighbour list and computes the forces once before step 1, and prints a summary after the last. You follow the six stops in the code, then predict for two runs in a row which steps get a thermo line and how many neighbour builds the log reports, including the surprises of pre no and upto, and check them against LAMMPS.

1 · Understand: six stops from run to the loop

Three consequences you can see in every log:

  • The thermo line at the starting step is printed by setup, not by the loop. A run of N steps computes the forces N + 1 times.
  • The neighbour list built in setup is not counted: "Neighbor list builds" counts only the loop's builds.
  • After the loop, thermo always prints the last step, whatever the thermo interval (src/output.cpp:215).

2 · Predict: two runs in a row

in.melt with your settings, then a second run. The rules from the code: thermo prints the first step, every multiple of the interval, and the last step; the list is rebuilt when the steps since the last build reach a multiple of every (src/neighbor.cpp:2373: ago++; if (ago % every == 0)).


    

3 · Observe: what upto and pre no change

Your turn

1. thermo 100, run 250. Which steps are printed?

2. neigh_modify every 20 check no, run 250, then run 30 pre no. What does the second run's log say for "Neighbor list builds"?

3. How many times are forces computed by run 0?