[lammps-users] how to get the initial length of the simulation box when it changes?


As discussed in the LAMMPS documentation you have to do some clever things in order to save a specific value for later. See the section "Immediate Evaluation of Variables" on this page:

What I did to save a current length was to do the following:

variable length equal lz # current length
variable l0 equal ${length} # start-length (evaluated at the point this occurs in the input script)

Hope this helps to solve your problem.


Christer H. Ersland,
PhD candidate, Norwegian University of Science and Technology,
Trondheim, Norway