[lammps-users] How to stop a simulation with a conditional statement

Hi,
  I have a polymer chain in a simulation box. If uninterrupted the simulation should run for 100000 steps but I want the simulation to stop if the center of mass of the chain crosses certain boundary. Can I implement the if statement? If yes then how? if no then are there any other options?

Regards

Hi,
I have a polymer chain in a simulation box. If uninterrupted the
simulation should run for 100000 steps but I want the simulation to
stop if the center of mass of the chain crosses certain boundary. Can
I implement the if statement? If yes then how? if no then are there
any other options?

there might be more sophisticated means, but you could just do
a loop around running small chunks of N steps with

run N pre no post no

and then test for your condition between those chunks.

if you got too far and want to narrow it down further, you
could then reverse the velocities and go to smaller chunks
and so on. usually, your efficiency may go down, if you
run very small chunks at the beginning, but if you don't
care, then you can do that as well.

cheers,
   axel.