I am not sure why but I think my if statement isn’t executing. Here is the structure of my script:
molecule nitrogen nitrogen.dat
fix ensemble all nve
fix 4 n2 deposit 1 1 1 122354 mol nitrogen region addatoms near 3 attempt 500 vx -0.00261 -0.00261 vz -0.0148 -0.0148 units box
various computes
compute prop4 n2 property/atom z
compute Zcoord n2 reduce ave c_prop4
thermo 200
thermo_style custom step c_nitrogentemp etotal c_Zcoord spcpu
thermo_modify lost warn
label loopstart
run 500
if “c_Zcoord > 20.0” then quit
next i
jump SELF loopstart
I want to run the simulation for a maximum of 36000 time steps.
I saw this post [http://lammps.sandia.gov/threads/msg35144.html] and chose to check every 500 time steps if the z coordinate of the molecule being deposited is above 20 Å in which case I want the simulation to stop.
I wrote the if loop with a label to run this 72 times in order to get 36000 time steps in total, as mentioned the linked post.
However, I can see from my ‘thermo’ output that the z coordinate exceeds 20 but the script continues till it finishes 36000 time steps. I hope someone would be able to explain this to me.
Thanks