Hi, I’m simulating granular material and I want to use ‘fix halt’ for atom ID 9, in a way that when the velocity of atoms in group 9 becomes less than 0.1, the simulation should stop. I have attached my code below; any help or suggestions will be helpful.
variable vel atom sqrt(vx*vx+vy*vy+vz*vz)
compute vmax 9 reduce max v_vel
variable vmaxx equal c_vmax
fix stop 9 halt 10 ${vmaxx} < 0.1
Error: RROR: Variable vmaxx: Compute used in variable between runs is not current (…/variable.cpp:1375)
Last command: fix stop 9 halt 10 ${vmaxx} < 0.1
Lammps version: 29Sep2021
This is incorrect use. Please see the documentation.
A ${name}
variable expansion will be done immediately by the LAMMPS input file processor.
This the line, if there was not error, would look like fix stop 9 halt 10 0.0 < 0.1
for example when it would be executed before the velocities are initialized.
The error message stems from the fact that computes need a “consumer” that sets a flag on which timestep the compute is evaluated next. The fix halt command is such a consumer and will do this during a run, but it cannot happen before, hence the error triggered by the premature execution of the compute due to the incorrect variable expansion.
This is a rather old version, you should consider upgrading.