minimize then dump in loops

Hello LAMMPS users,

I am trying to periodically perform minimizations on snapshots of a
long run, and dump the minimized coordinates. The long run is not
interrupted by the minimizations. I found other people had asked
similar things in previous posts, and the job can be done by
periodically writing restart files. While I want to search the
possibility of doing it in a loop, as the atoms' coordinates in a dump
file is easier for me in later works than that in a binary file
(although restart2data program can work this around).

For example I want to do minimize-then-dump every 100 steps in a
1000-steps run. I suppose a loop like below. But I met some problems.

Two things about your code snippet are confusing.

a) you can't specify the dump inside the loop, as it
the dump command will be invoked 10 times which will
give an error the 2nd time.

b) A minimization also advances the timestep counter,
so you are not running for 1000 steps, but some larger

What you might want to do is

dump ...
dump_modify append yes
run 100
undump ...

inside your loop to open/close the dump file and not
have it operate during the minimization.

You may also want to reset your timestep after the minimizations
to start your runs on steps you specify.


Hi Steve,

Thank you very much for the corrections. It would take long time for
me. I modified the loop like below, and got the desired dump files.

So, to use dump inside a loop, one must use dump together with undump
to open and close the file within one loop circle, that's the only way

Thanks again.

Long Zhang

yes, there's nothing magic about a loop

You could duplicate the same code by just writing
the same lines, repeated 10 times. If you
run that you will see that when you re-specify
the same dump command you will get an
error that the dump already exists.