Loop through input files

Hi
I have a input file which have definations of polymer -wall system (2D system) where the mid of polymer is fixed in between the pore of the wall (created through moltemplate), the system is minimized and after then the polymer is released to see which side of the wall (cis /trans) it is traversing.My input file is working for the plan for one time.Sir, I want to repeat this same process say 500 times and count the no. of times the polymer traversed either side.Is it possible through the input file
traj1_npt.lammpstrj
, and if yes kindly guide me in this.
Thankyou
Andri

run.in.npt (1.81 KB)

Yes, but to get different results each time, you will have to either change the initial conformation of the polymer, or use a different random seed, or both.

You could use a LAMMPS loop to run 500 different trajectories using different random seeds, but the starting position will always be the same.

https://lammps.sandia.gov/doc/variable.html
https://lammps.sandia.gov/doc/jump.html
https://lammps.sandia.gov/doc/next.html

For a more flexible approach, I myself write a script which creates N different copies of a directory containing LAMMPS input files (and moltemplate files in my case, since I use moltemplate). This script generates a different data file in every directory (by invoking a script I wrote which generates random data files) as an initial starting conformation. For each directory, the script also creates a different “run.in” input script file. These “run.in” files are identical except for the random seed used with the integrator (for example the random seed used with “fix npt”). This can be tricky, and it takes me a while to write these scripts.

---- moltemplate-specific comments —

In moltemplate, the ability to add random perturbations to the positions of each molecule instance seems like a trivial feature to add, but it turned out to be tricky, so I abandoned work on it. If your polymer is immersed in some kind of solvent or small molecule bath, then it might be easier to randomize the position of these molecules instead. If you want to randomize the initial state of your polymer, you have to generate a random curve using some other software. It’s up to you to decide how you want to generate this random curve. Then you can use the “genpoly_lt.py” script to create a moltemplate file containing a list of commands which move the position of each monomer at equidistant spaces along the (randomized) curve which you created earlier.

Documentation for this script is located here:

http://moltemplate.org/images/misc/polymers_follow_a_curve.png
https://github.com/jewettaij/moltemplate/blob/master/doc/utils/docs_genpoly_lt.txt

One of the programs I use to generate random curves is here:

https://github.com/jewettaij/ndmansfield

That’s all I have time for now.
I hope this helps!

Andrew

Thankyou Sir for your informative reply and time.
Andri

I am trying to run loop in lammps input file through the command

------------------------------- Initialization Section --------------------

#—loop for 100 run–
variable i loop 100
label loop

include system.in.init

------------------------------- Atom Definition Section -------------------

read_data system.data

------------------------------- Settings Section --------------------------

include system.in.settings

------------------------------- Run Section -------------------------------

Only the groupB atoms are immobile.

group mobile subtract all groupB

print “--------- beginning minimization (using fix langevin) ---------”

timestep 0.1
group one id 73
fix 2 one setforce 0.0 0.0 0.0
fix 6 mobile setforce NULL NULL 0.0
velocity mobile set NULL NULL 0.0
#fix 5 all enforce2d
fix fxlan mobile langevin 1.0 1.0 100.0 48279
#fix fxlan mobile langevin 1.0 1.0 100.0 4928459
fix fxnve mobile nve
thermo 100
run 5000

unfix fxlan
unfix fxnve
unfix 6
unfix 2

– simulation protocol –

print “--------- beginning simulation (using fix npt) ---------”

dump 1 all custom 1000 traj_npt$i.lammpstrj id mol type x y z ix iy iz

thermo_style custom step temp pe etotal press vol epair ebond eangle edihed
thermo 200 # time interval for printing out “thermo” data

------------------------- NPT ---------------------------

fix Ffreezestuff groupB rigid single force * off off off torque * off off off
fix 4 mobile setforce NULL NULL 0.0
#velocity mobile create 300.0 4928459 dist gaussian
velocity mobile set NULL NULL 0.0
#fix 5 mobile momentum 1 linear 1 1 0

fix fxMoveStuff mobile npt temp 273 273 100 iso 100 100 400.0 dilate mobile drag 0.0

----------------------------------------

compute tempMobile mobile temp
compute pressMobile all pressure tempMobile

thermo_style custom step c_tempMobile c_pressMobile temp press vol

fix_modify fxMoveStuff temp tempMobile

timestep 0.01

run 2000000

#timestep 0.06

#run 500000
write_data system_after_npt_$i.data
undump 1
unfix fxMoveStuff
unfix 4
unfix Ffreezestuff

next i
jump SELF loop
label break

but there is this error:

ERROR: Units command after simulation box is defined (…/input.cpp:2007)
Last command: units real

Can anyone suggest anything in this.
Thanyou
Andri

run.in.npt (2.03 KB)

https://lammps.sandia.gov/doc/clear.html

Thankyou Axel for the reply
Andri

command ‘‘clear’’…working well, loop is now running without error.

Hello everyone
Suppose we have a polymer of size say 100 monomers each monomer have its initial x,y,z co-ordinates.Is it possible to check the condition on only the x-coordinate (whether its >=0 or <0)of first monomer (no mater what y and z coordinates are) and simultaneously count its location ,i.e. how many times it is positive and negative for multiple runs ,through lammps input file?
Thankyou
Andri

Hello everyone
Suppose we have a polymer of size say 100 monomers each monomer have its initial x,y,z co-ordinates.Is it possible to check the condition on only the x-coordinate (whether its >=0 or <0)of first monomer (no mater what y and z coordinates are) and simultaneously count its location ,i.e. how many times it is positive and negative for multiple runs ,through lammps input file?

it may be possible, but that is likely to be awfully complex and complicated to do.
this is probably much easier to do in post-processing.

axel.

yeah even after processing , say if i re-run the dynamics for 500 times i will be having 500 dump trajectory files and from these many dump files we need to pick and check x-cordinate and then part it!