[lammps-users] Output "Total wall time: ..." in the middle of a simulation


I’m creating a very big simulation that has a high number of runs in between each other, and would like to be able to track how much time has been spent on each “portion” of said simulation. So just, print the value of the timer from LAMMPS, restarting from 0 after each print of the value.

Normally I would work by splitting the simulation in multiple smaller ones using write_restart/read_restart and using each simulation’s timer, however, due to the file system limitations of the cluster I’m working on, doing as such often causes errors as it either isn’t able to give LAMMPS it’s restart file, or fails to start a new simulation due to node errors.

I have not found any such way to get this information in the documentation. Is the printed “loop-time” from a run possible to be called upon as a variable, and if so, how must the variable be declared?

Thanks a lot for your time and help

I don’t see a direct access to that either, but that is trivial to add. we have a “cpu” keyword and we/you could easily add a “wall” keyword that reports the elapsed wall time.

You might be able to work around this by using the timer command to set a long timeout and then subtract timeremain from that value.

Also, in many circumstances the value to the cpu thermo property should be close to the walltime (it should be near 99% unless you use multi-threading then it would be over).

Of course you could also define a python function/variable to be hooked to at python invoke command that reads and parses the log file and reports the last elapsed time from the logfile.

Thank you for your suggestion, I’ll be doing this through the “cpu” keyword! Thanks!