Convert Restart file to data

Dear LAMMPS Users,

I had used LAMMPS version 2Feb13 to run a simulation last year and I have a restart file from that simulation. I am trying to convert it into a data file and I keep getting the following error:

LAMMPS (2 Feb 2013)
Reading restart file …
WARNING: Restart file version does not match LAMMPS version (read_restart.cpp:470)
restart file = , LAMMPS = 2 Feb 2013
WARNING: Restart file version does not match LAMMPS version (read_restart.cpp:470)
restart file = , LAMMPS = 2 Feb 2013
ERROR: Invalid flag in header section of restart file (read_restart.cpp:701)

I do not understand why this error comes up when I am using the same version of LAMMPS to read the restart file. I would really appreciate any suggestions.

Best regards,

Abhi

I have had serious problems with restart files occasionally. I
usually save my coordinates periodically in some other format as well
in case restart files fail (using the dump or write_data commands, for
example). (See below)

Like most software under active development with many contributors,
LAMMPS has bugs. A non-trivial number of them. You will have to get
comfortable with that. It's entirely possible you found a bug in
LAMMPS. But Feb 2013 is so long ago that I suspect your error has
been fixed already. If you can reproduce the same error (writing and
reading) with the current version of LAMMPS, people will be interested
to help you. Otherwise, have you tried loading the restart file with
a newer version of LAMMPS? Do you have the code for
lammps-2Feb2013.tar.gz? You can compile LAMMPS with the -g flag, step
through the code with a debugger, and try to figure out what's going
on, but I suspect it won't be easy.

Probably it is easier to try and reconstruct a new data file using
coordinates from a dump file (see below):

----- creating a new DATA file from dump files or raw coordinates ----

If you have created a dump file, AND the number of particles and bonds
has not changed, then you can extract coordinates and create a new
data file using your own script. You can also try using
"dump2data.py" (attached)

dump2data.py -atomstyle "full" -last OLD.DATA \
               < DUMP.lammpstrj > NEW.DATA

The "-last" argument extracts the data from the last frame. (If you
want to pick a different timestep, use something like "-t 50000"
instead)

If you don't use plain-text dump files, but you can obtain the
coordinates as a simple 3-column numeric text file (eg "COORDS.raw"),
then you can use "raw2data.py" (attached)

raw2data.py -atomstyle "full" OLD.data < COORDS.raw > NEW.data

(Bugs in "dump2data.py" and "raw2data.py" are occasionally found and
patched. Download the newest version at moltemplate.org.)

Of coarse, this won't restore any coeff (parameters) or bond topology
which may have changed during your simulation (for example using "fix
bond/create" or "fix gcmc"). The number of atoms, bonds, angles,
dihedrals, and impropers in the data file must be consistent with your
old data file (or coords file).

You can also do all of this with pizza.py, or topotools, if you don't
mind learning a little python or tcl. (If you use exotic atom_styles,
then you might try "pizza.py". My code has not kept up with all the
newest atom_styles.)

Cheers
Andrew

docs_dump2data.txt (6.25 KB)

dump2data.py (59.3 KB)

raw2data.py (3.07 KB)

docs_raw2data.txt (2.34 KB)

If 2Feb13 is old enough that your distribution

has a tools/restart2data.cpp file, you can also

try this:

build that tool
run it on your restart file and see if it produces

a data file successfully

As Andrew said, it could be that that version had
a new bug in restart file format, that was fixed
soon thereafter. No easy way to diagnose it
at this point.

Steve

Sorry. To clarify: I personally claim the honour of adding at
least two bugs to LAMMPS! (..in dihedral_table.cpp. I'm looking
into one of those issues now. I fixed the other one. And that wasn't
due to restart files.)

Anyway, it happens all the time.
Sorry. I did not mean to sound so critical.

Andrew

    In fact I don't even remember if I tested if write/read_restart()
in dihedral_table.cpp. (Actually, I think I did, but I'll wait until
someone complains.)

   I guess that's why restart files are so fragile.
If you use any contributed pair,bond,angle,dihedral_styles (etc) that
implements its own version of write_restart() and read_restart() in a
sloppy way. Later when read_restart() reads the wrong number of bytes
it can move the file pointer and effectively corrupt your restart file
even if the rest of the LAMMPS code has no bugs. Really a pain to
debug later. Definitely don't rely only on restart files if you are
using USER-MISC code or other contributed code. The safest and most
robust thing to do is write coordinates and load them into your data
file later.
   (End of rant.)

Thank you Andrew and Steve for your comments. I would also like to point out that when I had done these simulations earlier, they were run on a different machine. In fact, I had also used the restart file to run some RNEMD simulations and it had worked (which would mean that the file is readable right?).

I am now trying to use the same restart file to run simulations on my local cluster and it is not being loaded by the same version or a newer one. Could it be a problem with moving restart files from one machine to another?

Otherwise, have you tried loading the restart file with
a newer version of LAMMPS? Do you have the code for
lammps-2Feb2013.tar.gz?

I have tried other, newer versions of LAMMPS and I get the same error. I have the code for lammps-2Feb13.tar.gz with me.

Steve - I did try to use the restart2data tool and it did not work either.

Finally, I have a dump file with the coordinates but not the velocities. I was just trying to do an "exact restart" without having to generate velocities again. I guess I would have to randomly generate velocities now.

Abhi

Thank you Andrew and Steve for your comments. I would also like to point out that when I had done these simulations earlier, they were run on a different machine.
I am now trying to use the same restart file to run simulations on my local cluster and it is not being loaded by the same version or a newer one. Could it be a problem with moving restart files from one machine to another?

Yes. (It's a binary file.)

(Longer reply sent privately and omitted here.)