About the variable accuracy in the if-run case:

Hello everyone:

I performed a run with the maximal kinetic energy of atoms in the system as the termination condition. When the maximum was lower than 1.0, the nve simulation was terminated and the next nvt simulation started. So I wrote the input script as following:

fix 3 all nve

run 1000

label loop

compute m all reduce max c_4

variable k equal c_m

run 200

if “$k <1.0” then “jump inp break”

print “max ke/atom: $k”

jump inp loop

label break

variable k delete

unfix 3

fix 4 all nvt temp 300 300 0.01 drag 0.2

However, the simulation stopped in the “if-then” statement with the error message: Compute used in variable between runs is not current. I read a lot about the variable accuracy part in the variable doc but I still cannot find a solution to this problem. Could you please help me? Thank you very much.


The problem is likely that the compute is not evauluated
during your run. LAMMPS will not invoke computes outside
of a run, since lots of things can go wrong if it does that.

The solution is to force the compute to be evaluted
at the end of your run 200. E.g. include c_m in your thermo