Looping over input lines

Hi everyone,
I’ve been searching the list for a solution to my problem looping over input lines, but everyone seems to be looping over a file to do independent simulations, so the solutions aren’t working for me. I want to run a simulation where I apply a constant velocity to a set of atoms for a certain number of steps, then stop the atoms and allow the system to relax for a certain number of steps, then I move them again and so on. So I tried using the “variable” and “loop” keywords to accomplish this. My input section looks as follows:

variable i loop 10
velocity trig set 0 0 -0.5 units box
run 50
velocity trig set 0 0 0 units box
run 2500
next i

But the simulation just runs through the 50 steps, then the 2500 steps, and then finishes instead of looping. The key thing is that I want to start the loop again from the same configuration that I left off at after the “run 2500” line. So I don’t want to clear any of my parameters or have it read in the original coordinate file again. Is there anyway to do this in LAMMPS without copying and pasting those four lines over and over again (I would like it to loop much more than 10 times, which is why I’m trying to avoid the copy and paste technique).

Any help is much appreciated! Thanks!
~Kate

You are missing the jump and label commands in order to create a loop go to lammps manual and see how they work.

variable -> http://lammps.sandia.gov/doc/variable.html
next -> http://lammps.sandia.gov/doc/next.html
jump -> http://lammps.sandia.gov/doc/jump.html
label -> http://lammps.sandia.gov/doc/label.html

Matias