[lammps-users] problem with read_restart / read_data


I am having some trouble with the read_restart and read_data commands.

I have an input file whose last line is [ write_restart restart.100 ].
If I run a new input script with the line [ read_restart restart.100 ] the simulation runs fine.
If I run [ restart2data restart.100 restart.100.txt ] and then run an input script using
[ read_data restart.100.txt ] the simulation doesn't conserve energy and the kinetic energy increases without bound.

My system consists of 256 molecules, where each molecule is a 3-atom rigid body. I've seen the above problem before: when a rigid body is lying across a boundary, then the rigid body integrator fails. This problem can be by-passed by either keeping the nx ny nz flags in the read_data file so that the
molecules are unwrapped properly, or by changing the positions of the atoms so that no unwrapping needs to take place.

I've done both tests.
1. The restart.1000.txt file contains the nx ny nz flags which tells LAMMPS how to unwrap the rigid bodies. But for some reason this system blows up (although the binary version of this file

2. I've changed the positions of those rigid bodies that lie across boundaries so that they do not need to be unwrapped. This also results in a system that blows up in the same was as #1. The molecules whose positions have been corrected are 56, 136, 189, 196, 242. The values can be compared in restart.100.txt and corrected_restart.100.txt.

Attached is are my files in a .tar.gz file. I'd appreciate any input into this problem.

much thanks,

test.tar.gz (92.7 KB)

Finally figured out the issue with this. It's not that LAMMPS
is losing track of rigid bodies when they cross or straddle
periodic boundaries. Rather, it's that your little rigid bodies (3-mers)
are odd in a couple ways that cause numerical difficulties.

First, they are co-linear. LAMMPS checks for this by setting
one of the moments of inertia to 0. Else you can high spinning
velocities of the body around it's nearly 0 axis. When the binary
restart file is read, the bodies are still co-linear. But when
converted to a text data file, precision was lost, and a few of
them were no-longer exactly co-linear, hence the spinning,
and hence the energy non-conservation. The problem is
compounded b/c the LAMMPS test for co-linear depends on another
moment of inertia being large, but your 3-mers are tiny (0.1 in length)
so the test was failing.

I fixed it by changing the restart2data tool to write out coords
at a higher precision, which is a probably a good idea anyway.
See the 15Aug07 patch. If you still have problems at some
point, then change the EPSILON value at the top of fix_rigid.cpp
to a bigger value (e.g. 1.0e-5 instead of 1.0e-7) which relaxes
the criterion for co-linear. That also worked. Or just stick
with binary restarts.