read_data x y z and nx ny nz

Hi Folks,

LAMMPS does the right thing, but the documentation of read_data
could be more concise on how wrapped and unwrapped coordinates
are handled wrt. x y z / nx ny nz.

http://lammps.sandia.gov/doc/read_data.html writes:

If nx,ny,nz values are not set in the data file, LAMMPS initializes them
to 0.

True in the case of wrapped coordinates, but domain->remap initialize
the image flags in the case where unwrapped coordinates are read.

If image information is needed for later analysis and they are not
all initially 0, it's important to set them correctly in the data file.

i.e. by using wrapped coordinates and image information or by using
unwrapped coordinates.

I propose to replace

Atom lines (all lines or none of them) can optionally list 3 trailing
integer values: nx,ny,nz. For periodic dimensions, they specify which
image of the simulation box the atom is considered to be in. An image
of 0 means it is inside the box as defined. A value of 2 means add 2
box lengths to get the true value. A value of -1 means subtract 1 box
length to get the true value. LAMMPS updates these flags as atoms
cross periodic boundaries during the simulation. The flags can be
output with atom snapshots via the dump command.

If nx,ny,nz values are not set in the data file, LAMMPS initializes them
to 0. If image information is needed for later analysis and they are not
all initially 0, it's important to set them correctly in the data file. Also,
if you plan to use the replicate command to generate a larger system,
these flags must be listed correctly for bonded atoms when the bond
crosses a periodic boundary. I.e. the values of the image flags should
be different by 1 (in the appropriate dimension) for the two atoms in
such a bond.

by

Atom lines specify a x y z coordinate of the atom. For simulations with
periodic boundaries, the coordinates can either be wrapped into the
simulation box or unwrapped. For instance, a molecule that crosses
the boundary of the simulation box will appear continuous in unwrapped
coordinates and discontinuous in wrapped coordinates. This distinction
makes no difference to the dynamics since forces are calculated using
the minimum image convention. However, certain commands requires
unwrapped coordinates. For instance, the centre of mass of a molecule and
its mean-square displacement are calculated with unwrapped coordinates.

Atom lines (all lines or none of them) can optionally list 3 trailing integer
values: nx,ny,nz. For periodic dimensions, they specify which image of the
simulation box the atom is considered to be in when x y z denote wrapped
coordinates. The nx,ny,nz values are automatically derived when
unwrapped coordinates are read and projected into the simulation box.

An image of 0 means that the atom is inside the box as defined. A value of
2 means add 2 box lengths to the wrapped coordinate get the true unwrapped
coordinate. A value of -1 means subtract 1 box length from the wrapped
coordinate to get the true unwrapped coordinate. LAMMPS updates
these image flags as atoms cross periodic boundaries during the simulation. The
flags can be output with atom snapshots via the dump command.

When a simulation replies on unwrapped coordinates, the input file must use
unwrapped coordinates or wrapped coordinates with additional image
information. For instance, if you plan to use the replicate command to
generate a larger system, these flags must be listed correctly for bonded atoms
when the bond crosses a periodic boundary. I.e. the values of the image flags
should be different by 1 (in the appropriate dimension) for the two atoms in
such a bond.

Thanks for the feedback. I changed the section in doc/read_data.html to what
is below. Let me know if it is still not clear enough.

Steve