[lammps-users] Dumping an observable after energy N "run + minimization" cycles

Dear all,

I would like to do something like

run N steps of nvt simulation obtaining configuration A
minimize energy starting from A and thus get minimal configuration A*
get all pair forces in configuration A*

restart from A
run N nvt steps obtaining B
minimize energy and thus get configuration B*
get all pair forces in configuration B* and append them on the same file I used for the forces of A*.
restart from B

...and repeating this for a lot of configurations A, B, C, ... of my atomic system

Any hints on how to do this with a single LAMMPS input script?
This would already be doable my (limited) knowledge of LAMMPS + my scripting language of choice, but it would be nice to keep things the least cumbersome as possible (but I'm far from mastering LAMMPS execution flow control and dumping capabilities).

Thanks for your attention and have a nice day.


I'm not sure what you mean by "get all the pair forces". Do you
mean get the force on each atom, which can be dumped via
dump custom? Or do you mean a list of pairwise interaction forces,
which would be many per atom. This can be done with compute
pair/local and dump local.

You can run NVT, followed by minimization by just using the
run command followed by the minimize command. You can save
a restart file after the run (A) via the write_restart command.

To restart from point A in the same script, you would need to "clear"
then read_restart for file A. After the clear, it is just as if you
are starting a new script. In fact you could "jump" to a new script
and literally start a 2nd script.

You can append output to an existing dump file via dump_modify append yes.


dear davide,

it would be much easier, if you changed your workflow a little bit.

first you would run one continuous trajectory and dump the
configurations at points A, B, C, etc into a dump file.

then you can write a small script (i would use the topotools plugin
in VMD, but just replacing the coordinates in a data file template
with perl, python or some other script language would) to generate
a data file for each configuration that you want to minimize
and then follow steve's advice on dumping the forces.

BTW: if you have questions like this, it is often much easier
to provide a good suggestion, if you would explain what you need
those forces for.