"WARNING: Restart file version does not match LAMMPS version" not always an appropriate warning

I use shell scripts to symbolically link restart files to sub directories after a run completes. Recently, due to an embarrassingly simple typo, the symbolic link did not point to a restart file (it actually pointed to a directory). When LAMMPS was executed the following error occurred:

WARNING: Restart file version does not match LAMMPS version

restart file = , LAMMPS = 17 Feb 2012

Which was odd, because I’ve used the 17Feb12 version of LAMMPS for a few months now. I’m posting this error for two reasons:

1.) Googling this error doesn’t bring up very many results. Hopefully this post will remind others to double-check that the restart file is actually a restart file.
2.) To suggest the addition of a separate warning condition, something along the lines of “WARNING: Specified restart file is not a LAMMPS restart file.” Not sure how difficult this would be, but as you can see from the posted error, the version information is completely absent from the left side of the comma (restart file = ,). Perhaps if version information is completely absent from the specified file a separate warning could be generated.


What LAMMPS does is simple. It opens the file you
specify ("," in this case, I guess). If it can’t open it

(doesn’t exist, can’t be opened as a file, etc) then
it gives an error. If it opens it (apparently it did),
then it reads a byte which is a flag for the info that follows.
If the byte = 0 (apparently it was), it assumes the next info is a string, which
is the version info. If that doesn’t match the current

version then it prints that warning. Then in continues the
loop: read a byte, read what comes after.

If the file is not actually a LAMMPS restart file, then it will certainly
crash. I presume that’s what happened to you.

Since both of the error messages state the name of the
file it’s having problems with, I don’t see that it is
difficult to figure out what went wrong.