ask a question about if command

Remember to always reply to the mailinglist as well since others may find the discussion useful.

I understand your confusion since you seem to think the if statement is performed every timestep. This is not the case. It is only performed once, but can be repeated if the if statement is inside a loop (there is an example in the documentation). Something like this would work:

label loop
  variable a loop 1000
  run 1000
  if "${steps} > 1000" then quit
  next a
jump SELF loop

But it makes no sense to do this since you already know that you want to do something after N timesteps. Instead you can just first run the N timesteps, then perform what you want to do (start a dump, quit simulation or something else).

From the example in the documentation I see that this may be confusing, but once you accept that it will just evaluate the if statement at the time of the command, it should be clear that it is not automatically being checked every timestep.

Anders

I will add that the example in my previous email will quit LAMMPS after 2000 timesteps, not 1001 (it will complete two full run 1000 commands before the if-test evaluates to true).

Anders