[lammps-users] Using "Variable/ Next/ Jump" for running multiple simulations: NooB Question


I want to loop over my lammps input script file to run multiple independent simulations for a polymer chain with different random number sequences, but the same initial coordinates/ input file. I looked up the documentation, taking a cue from the manual I inserted the variable, next and jump commands in my file, so that the same script is executed multiple times. I have defined a variable "a" of type loop which represents the number of times the script is to be executed. The following script, "in.polymer" reads input data from the file "data.polymer.10", which contains the initial coordinates of the polymer chain.

You need to use the clear command at the top. so that
when it loops it will wipe stuff out and start over.



Thanks for the quick reply. Actually, I did try the clear command, but I always end up with a segmentation fault. The first run works fine but the second run doesn’t start although the corresponding log and output files are created. Maybe I am missing out on some minor detail. Here is the screen output,

Scanning data file …
1 = max bonds/atom
Reading data file …
orthogonal box = (-100 -100 -100) to (100 100 100)
1 by 1 by 1 processor grid
10 atoms
9 bonds
Finding 1-2 1-3 1-4 neighbors …
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
6 = max # of special neighbors
Setting up run …
Segmentation fault

I would really appreciate all help.


Steve Plimpton wrote:

Please post your input/data files, as small
a version as possible, that reproduces the problem.



Here are the input and data files. With this version of the input file, I can get the program running for loop variable, a =2, but get a seg fault for larger values of "a". I am using the lmp_g++ to run lammps.

I ran the appended input script with your data file for loop = 10.

I ran on 1,2,4,8 procs with no problems. Valgrind gives no memory
errors on 1 proc. This is with the most current (fully patched) version
of LAMMPS. The only change I had to make for P > 1, was to extend
the neighbor skin, since with no pair potential defined, you need to
communicate far enough to get the next FENE bonded atom, else
you can get an error. But not a seg fault in any case I ran.


# slightly modified input script


atom_style bond
variable a loop 10

log tmp.log.$a
read_data data.bug
bond_style fene
bond_coeff 1 30.0 1.5 1.0 1.0
neighbor 1.0 bin
neigh_modify delay 1
timestep 0.001
run_style verlet
velocity all create 1.00 2349852
reset_timestep 0
fix 1 all nve
fix 2 all langevin 1.0 1.0 1.0 $a
fix 3 all gyration 100 tmp.polymer.out.10.$a
thermo 100
dump 1 all atom 100 tmp.dump.bug.10.$a
dump_modify 1 scale no
run 1000

next a
jump in.bug

Thanks for your help Steve. I upgraded to the most recent lammps version and was able to run my simulation.

Steve Plimpton wrote: