Dear all,
I am using LAMMPS version 2 June 2022 on widows.
I wish to run a 5 years old LAMMPS script which read in a loop a dump file with read_dump. It succefully worked at this time.
I wish to inject every 40000 timestep 10 atoms with x y z vx vy vz.
the called inputdata.lammpstrj file with read_dump is read but when reading timestep it causes the error message below. I add also the calling script and and the read_dump file.
I do not understand what I have to do for solving the issue.
Thanks for the help
Pascal
read_dump inputdata.lammpstrj $x x y z vx vy vz box yes replace no add yes
run 40000
ITEM: TIMESTEP
This is likely (another) ripple from the refactoring of the handling of dump output some time ago.
I have to look at the relevant code to see if there is a proper solution, but the obvious workaround can be inferred from the error message. Undump your current dump instance before the read_dump command and continue it afterwards.
I checked the read_dump documentation and what happens is actually what should happen. We just didn’t have a test for it before.
The problem is that read_dump will reset the timestep number and that conflicts with several LAMMPS features like active dumps or time averaging fixes.
Thus a clean solution will be to add an option to the read_dump command to tell it to not reset the time step number.
Thanks a lot Axel.
I will try for a workaround as you suggest;
The current dump is outside the loop. So if I undump it in the loop the dump file will not be filled, I guess ?
Or may be I shall include the dump command in the loop before the read_dump and I hope the new data will be appended to the desired output file.
Kind regards
Pascal
That way, if you tell it to append to the file, you should get a continuous trajectory. But note that every read_dump command will reset the timestep number, so you need to save and restore that, too if you want a consistent trajectory and timestep numbers in your output.
FWIW, I have just submitted a pull request (Add option to read_dump that prevents resetting the timestep by akohlmey · Pull Request #3344 · lammps/lammps · GitHub) that adds a “timestep” keyword to the read_dump
command. After the change is merged you can use “timestep no” as argument to read_dump
to prevent it from resetting the timestep and also the need to stop and restart any open dump stream will no longer apply.
Thanks a lot Axel
This will be very helpful.
Since I am not familar at all with github, What I should do for including the solution. Should I install a last windows version ? And for linux version on my workstation ?
Sorry again for such basics questions
Kind regards
Pascal
Right now you would need to download a sourcecode snapshot of my branch (https://github.com/akohlmey/lammps/archive/refs/heads/read_dump_no_timestep.tar.gz)
since I only today submitted it and it has not been reviewed or merged to the development branch.
For that you will have to wait until a new release is made. Or learn how to build LAMMPS from source on Windows (using Microsoft Visual Studio 2022), or use WSL and run Linux on Windows.
You will have to build from the snapshot source code. But since this is based on development code you run a higher risk of having a version of LAMMPS with known (or unknown) bugs.
Thanks a lot Axel
Best
Pascal
Dear Axel
Thanks a lot again
I will install the last LAMMPS version 3Aug2022 and use the timestep no new keyword.
Best regards
Pascal
It seems the patch don’t backport to the stable version, whose link is https://download.lammps.org/tars/lammps-stable.tar.gz ? or does there a more new stable version
This is a new feature and not a bugfix and thus it is not backported to the stable release. The stable LAMMPS version does behave as documented. It just happens that the documented behavior is not always convenient.
You have to use a more recent feature release (the most recent was on 28 March 2023) to have this feature included.
Thansk for your quick reply!
- In addition, is there a simple way to workround in the input file when we occur the following issue.
- I test it base on the above stable version https://download.lammps.org/tars/lammps-stable.tar.gz
ERROR: Cannot reset timestep with active dump - must undump first (../output.cpp:637)
Last command: reset_timestep 0
- these is the snippets of the input file around the reset_timestep 0, I tried it works fine if I deleted the description begin with the reset_timestep 0.
dump 1 all atom 100000 initial.lammpstrj
dump_modify 1 format line "%7d %3d %8.5f %8.5f %8.5f" scale yes
# Equilibrium
fix 1 carbon nve
fix 2 salt nve/limit 0.1
fix 3 salt temp/rescale 10 298 298 0.05 1.0
fix 4 carbon setforce 0.0 0.0 0.0
fix 5 salt wall/reflect zlo -0.98 zhi 159
velocity carbon set 0.0 0.0 0.0 units box
run 300
reset_timestep 0
unfix 2
unfix 3
fix 2 water shake 0.0001 20 0 b 1 a 1
fix 3 salt nvt temp 298 298 0.1 drag 0.5
run 2000
All commands that have timestep selections (e.g. dump, fix ave/*) must be closed (undump, unfix) before using reset_timestep.
Thanks again, it works after I add undump 1 before reset_timestep 0.