Reading the dump file for minimizing the potential energy of each configuration

I write my dump file using the following keywords:
compute Pea all pe/atom
dump 1 all custom 1000 coords-vel-pe.xyz id type x y z vx vy vz c_Pea

Now Let’s say I created 100 configurations in the coords-vel-pe.xyz file, which I now want to minimize and find a new set of 100 configurations with minimum potential energy using the following lines:

variable nconf equal 100
label runloop
variable conf loop 0 dollar{nconf} pad
read_dump …/…/coords-vel-pe.xyz dollar{conf} x y z vx vy vz replace yes box no wrapped yes
minimize 1.0e-10 0 10000 10000
write_dump all xyz coords-IS-dollar{conf}.xyz
next conf
jump in.lammps runloop

I get the following error:

Scanning dump file …
ERROR: Dump file does not contain requested snapshot (…/read_dump.cpp:119)
Last command: read_dump …/…/coords-vel-pe.xyz ${conf} x y z vx vy vz replace yes box no wrapped yes

I am not sure how I should organize my read_dump keywords to successfully read all the snapshots.

First of all, you should begin by reading the guidelines for posting decent questions.

If I understand your script correctly, the problem is in the loop variable. Try this:

variable nconf equal 100
variable conf loop 0 ${nconf}
label runloop
read_dump ../../coords-vel-pe.xyz $(v_conf*1000) x y z vx vy vz replace yes box no wrapped yes
minimize 1.0e-10 0 10000 10000 # why such a tight threshold?
write_dump all xyz coords-IS-$(v_conf:%03.0f).xyz # padding the variable conf to 3 digits.
next conf
jump SELF runloop

Execute with lmp -in in.lammps -l out.log

Edit: Following @akohlmey comment, I changed the variable ${conf} to $(v_conf*1000).

1 Like

What you are seeing is documented behavior. So the main problem is that you didn’t read it with sufficient attention to detail.

You are writing snapshots to your dump file for timesteps 0, 1000, 2000, 3000, and so on, but then you are asking to read snapshots for timesteps 0, 1, 2, 3, and so on. Thus, you should get the error message ERROR: Dump file does not contain requested snapshot.