"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)

:line

write_data command :h3

[Syntax:]

write_data file keyword value ... :pre

file = name of data file to write out :ulb,l
zero or more keyword/value pairs may be appended :l
keyword = {pair} :l
  {pair} value = {ii} or {ij}
    {ii} = write one line of pair coefficient info per atom type
    {ij} = write one line of pair coefficient info per IJ atom type pair :pre
:ule

[Examples:]

write_data data.polymer
write_data data.* :pre

[Description:]

Write a data file in text format of the current state of the
simulation.  Data files can be read by the "read data"_read_data.html
command to begin a simulation.  The "read_data"_read_data.html command
also describes their format.

Similar to "dump"_dump.html files, the data filename can contain a "*"
wild-card character.  The "*" is replaced with the current timestep
value.

IMPORTANT NOTE: The write-data command is not yet fully implemented in
two respects.  First, most pair styles do not yet write their
coefficient information into the data file.  This means you will need
to specify that information in your input script that reads the data
file, via the "pair_coeff"_pair_coeff.html command.  Second, a few of
the "atom styles"_atom_style.html (body, ellipsoid, line, tri) that
store auxiliary "bonus" information about aspherical particles, do not
yet write the bonus info into the data file.  Both these
functionalities will be added to the write_data command later.

Because a data file is in text format, if you use a data file written
out by this command to restart a simulation, the initial state of the
new run will be slightly different than the final state of the old run
(when the file was written) which was represented internally by LAMMPS
in binary format.  A new simulation which reads the data file will
thus typically diverge from a simulation that continued in the
original input script.

If you want to do more exact restarts, using binary files, see the
"restart"_restart.html, "write_restart"_write_restart.html, and
"read_restart"_read_restart.html commands.  You can also convert
binary restart files to text data files, after a simulation has run,
using the "restart2data"_Section_tools.html#restart2data tool in the
tools directory.  When the write_data command is fully implemented
(see NOTE above), the restart2data command will be obsolete and will
be removed from the LAMMPS distribution.

IMPORTANT NOTE: Only limited information about a simulation is stored
in a data file.  For example, no information about atom
"groups"_group.html and "fixes"_fix.html are stored.  "Binary restart
files"_read_restart.html store more information.

Bond interactions (angle, etc) that have been turned off by the "fix
shake"_fix_shake.html or "delete_bonds"_delete_bonds.html command will
be written to a data file as if they are turned on.  This means they
will need to be turned off again in a new run after the data file is
read.

Bonds that are broken (e.g. by a bond-breaking potential) are not
written to the data file.  Thus these bonds will not exist when the
data file is read.

:line

The {pair} keyword lets you specify in what format the pair
coefficient information is written into the data file.  If the value
is specified as {ii}, then one line per atom type is written, to
specify the coefficients for each of the I=J interactions.  This means
that no cross-interactions for I != J will be specified in the data
file and the pair style will apply its mixing rule, as documented on
individual "pair_style"_pair_style.html doc pages.  Of course this
behavior can be overridden in the input script after reading the data
file, by specifying additional "pair_coeff"_pair_coeff.html commands
for any desired I,J pairs.

If the value is specified as {ij}, then one line of coefficients is
written for all I,J pairs where I <= J.  These coefficients will
include any specific settings made in the input script up to that
point.  The presence of these I != J coefficients in the data file
will effectively turn off the default mixing rule for the pair style.
Again, the coefficient values in the data file can can be overridden
in the input script after reading the data file, by specifying
additional "pair_coeff"_pair_coeff.html commands for any desired I,J
pairs.

:line

[Restrictions:]

This command requires inter-processor communication to migrate atoms
before the data file is written.  This means that your system must be
ready to perform a simulation before using this command (force fields
setup, atom masses initialized, etc).

[Related commands:]

"read_data"_read_data.html, "write_restart"_write_restart.html

[Default:]

The option defaults are pair = ii.

