Running a loop for a specific work

Dear LAMMPS users,

I want to pour powder particles into a box in a fashion like 100 particles at a time then stop the system. Then after some time simply pour another 100 particles and continue in this fashion.

For this, my input is something like this:

region          slab block 140 180 90 95 -0.5 0.5 units box

fix		ins all pour 10000 1 300719 vol 0.2 50 region slab

variable myatom equal atoms 
label loop
variable a loop 1
if "${myatom}==100" then "jump SELF break"
next a 
jump SELF loop
label break
print "ALL DONE"

fix     3 all enforce2d

compute		1 all erotate/sphere       #erotate/sphere comutes the rotational kinetic energy
compute         Tsphere all temp/sphere

thermo_style	custom step atoms ke c_1 vol     #c_1 is coumpted with compute id 
thermo		100

thermo_modify	lost ignore norm no temp Tsphere    #ignore value does not check for lost atoms, norm value normalized the thermodyanmic paprameters
compute_modify	thermo_temp dynamic/dof yes
compute_modify	Tsphere dynamic/dof yes

dump		id all atom 100 dump.pour
dump		1 all custom 100 positions.lammpstrj id x y z vx vy vz diameter

dump		3 all image 20000 image.*.jpg type type &

run		100000

But the system is not working in the way I want. May I know where is the specific problem occurring? Thank you.

Yeasir Mohammad Akib

Please look at 5.1. LAMMPS input scripts — LAMMPS documentation and Control flow - Wikipedia
for some general background about how LAMMPS processes input and how loops work, and then at the documentation of the next command — LAMMPS documentation
and the jump command — LAMMPS documentation
for some specific examples and detailed documentation.

What you have done is that you have inserted some looping construct into your input script but it has no “body”, so it is pretty much useless. Also fix pour operates during a “run”, but then the input script is not processed. So what you have to do is to break down your one run into multiple runs, and then have a run command where fix pour inserts a chunk of particles, then unfix fix pour, so it does not insert anything and run some more and then jump back to the previous section of the code where you create fix pour and do another segment with fix pour active and so on.

Bascially, what you have done is to insert bits and pieces of what you want to do somewhere in the input and expect LAMMPS to figure out what your intentions are, but that cannot work. LAMMPS is a computer program and thus you have to spell everything out (do this, then this, then this and then that)
as it is reading and processing the input line by line.

1 Like