# 8.2.3. Run multiple simulations from one input script

This can be done in several ways. See the documentation for individual commands for more details on how these examples work.

If “multiple simulations” means continue a previous simulation for more timesteps, then you simply use the run command multiple times. For example, this script

units lj
atom_style atomic
run 10000
run 10000
run 10000
run 10000
run 10000


would run 5 successive simulations of the same system for a total of 50,000 timesteps.

If you wish to run totally different simulations, one after the other, the clear command can be used in between them to re-initialize LAMMPS. For example, this script

units lj
atom_style atomic
run 10000
clear
units lj
atom_style atomic
run 10000


would run 2 independent simulations, one after the other.

For large numbers of independent simulations, you can use variables and the next and jump commands to loop over the same input script multiple times with different settings. For example, this script, named in.polymer

variable d index run1 run2 run3 run4 run5 run6 run7 run8
shell cd $d read_data data.polymer run 10000 shell cd .. clear next d jump in.polymer  would run 8 simulations in different directories, using a data.polymer file in each directory. The same concept could be used to run the same system at 8 different temperatures, using a temperature variable and storing the output in different log and dump files, for example variable a loop 8 variable t index 0.8 0.85 0.9 0.95 1.0 1.05 1.1 1.15 log log.$a
velocity all create $t 352839 fix 1 all nvt$t $t 100.0 dump 1 all atom 1000 dump.$a