I have a problem with the restart functionality using LAMMPS (12 Oct 2011 release).
I have a quasi-2D simulation where I break up an initial configuration with high temperature, and then run a "production" simulation at room temperature to collect some information. When I include both stages in the same control file for LAMMPS, I have no issues. If I try to split the run into two sections, the initial high temperature stage (which reads an initial configuration and writes a restart file at the end) and the production stage (which reads the restart file and runs a further simulation) then I begin to get the dreaded "nan" in the output.
I'm using the following functionality / fixes:
1. fix all rigid/nvt molecule
2. fix wall/harmonicplanarjohn
The latter is a fix I created based on the standard Lennard-Jones wall fix, as I wanted a specific functionality. I don't save or read any additional data to the restart file from this new fix. In both initial and production stages, I define identical information regarding the force field and fixes etc - both the fixes and the force field are completely defined in the control file, I do not rely on the restart file to provide any information in those respects.
The force field includes some very strong repulsive potentials at close range, and hence I tested the system using a smaller timestep in the production run ( 2 fs vs 5 fs ) to attempt to alleviate integration problems which may cause bad contacts which result in the energy spiralling out of control, and this appears to work in the sense that the "nan" problem goes away, but this does not explain why the same simulation works correctly provided I do not separate it up into two runs via the restart file functionality. This likely suggests that the restart file is not preserving the "actual" system data in some sense.
I therefore looked at the restart file using the restart2data program, and there appear to be no "bad" entries in either the coordinates or velocities (in the sense of obviously bad numbers). Everything is as might be expected, but one slightly odd aspect is that I define the atom style as "molecular", which the LAMMPS documentation says should have 6 entries in the "Atoms" section ("atom−ID molecule−ID atom−type x y z", see the "read_data" documentation in the LAMMPS manual), and the output from restart2data contains 9 entries per line - with the extra 3 entries being integers which are only nonzero for a very small number of atoms (and the values these nonzero integers take are 1 or -1). I suppose this is related to the rigid body functionality in some sense.
I've attached an example input file; the simulation behaviour is controlled by replacing the "__RESTART_TAG_VALUE__" string to be zero (initial breakup stage, then short run and save restart file) or 1 (load the previous restart file, then another short run using the restart information). For the former case, it works fine; for the latter case, I get "nan" output appearing after the first integration step in the new run (the starting information printed before any integration is performed is the same as the final output before the restart file was written).
Does anyone have any suggestions as to what problem I should be looking for?
template.in (6.01 KB)