[lammps-users] Dump only contains one snapshot


I read the docs but it says dump can only invoke every N timesteps… I would like to capture a snapshot only at a particular timestep once. I checked write_data but the thing is there is a custom written attribute (by a colleague) which was written into dump but not to write_data. I was wondering if there is a way to achieve what I am asking.


The most general and versatile way to do what you are asking is probably to use a for-loop. At the end if each iteration use the if command to test for the condition (eg. if “step == 1941000”), and then use the “write_data” or “write_dump” commands to create a file with only one snapshot of the trajectory.


you can use write_dump instead of write_data and use the “upto” keyword to run to have it stop at the timestep you want.
or you can use dump_modify with the every keyword and a variable as argument. then the value of the variable would be the next timestep to write a dump. if that is a constant, you will just get one dump at the given timestep.

for more info please look up the commands in the LAMMPS manual.


Thank you all! Wasn’t aware of write_dump feature.