[lammps-users] restart: binary versus text files


I am getting some strange behavior when using restart files.


in.ED is the initial input file, and uses read_data data.ED. This simulation works fine. At the end of it, I use write_restart restart.ED to generate a binary restart file.

I change in.ED to use read_restart restart.ED instead of the read_data command. This restarted simulation works successfully.

However, if I do
  - restart2data restart.ED restart.ED.txt
  - then run lammps using read_data restart.ED.txt
I get errors. I have gotten either the kinetic energy blowing up, or "Bad principle moments."

I have tried this repeatedly and get pretty consistent results. I find this very bizarre. Is there any reason why this would happen?

I ultimately need to be able to restart my simulations every N timesteps but cannot simply use the binary restart file since I need to rescale the velocities in a particular way that is not easy to do with the velocity command in the lammps input script. Besides altering the restart.ED.txt file, I cannot think of away of doing this. (Incidentally, I get the same behavior when using dump files and importing that information into data.ED files, although the values of the Atoms, Velocities sections in both dump.ED and restart.ED.txt are the same, except for the trailing 3 integers in the atoms section of the restart.ED.txt file.)

Thanks for any help!

I took a look at Joyce's input files, and there seems to be something strange
going on with the indices (nx,ny,nz) which contain the information about how
many times an atom crossed the periodic boundaries. This might be a problem
with the restart2data tool.

If I run the attached input script test.in, and convert the resulting file
test.restart to text format, I obtain the file test.restartdata. Note that
the indices are (212, -105, 37), even though I believe they should be

This is related to Joyce's problem, since when I reset the indices to (0,0,0)
and then manually correct them for those molecules that straddle the
boundaries, the reported problems are no longer there.


test.data (653 Bytes)

test.in (202 Bytes)

test.restartdata (673 Bytes)

Try replacing these 3 lines in restart2data.cpp

      ix = image[i]%1000 - 500;
      iy = (image[i]/1000)%1000 - 500;
      iz = image[i]/1000000 - 500;

with these:

      ix = (image[i] & 1023) - 512;
      iy = (image[i] >> 10 & 1023) - 512;
      iz = (image[i] >> 20) - 512;

and see if the problem goes away. This change
in how image info is stored in LAMMPS was made
a couple months ago, but looks like we forgot to
change the restart2data tool.


This fixes the problem.