<li>file = name of binary restart file to read in</li>
<li>flag = remap (optional)</li>
</ul>
</div>
<divclass="section"id="examples">
<h2>Examples</h2>
<preclass="literal-block">
read_restart save.10000
read_restart save.10000 remap
read_restart restart.*
read_restart restart.*.mpiio
read_restart poly.*.% remap
</pre>
</div>
<divclass="section"id="description">
<h2>Description</h2>
<p>Read in a previously saved system configuration from a restart file.
This allows continuation of a previous run. Details about what
information is stored (and not stored) in a restart file is given
below. Basically this operation will re-create the simulation box
with all its atoms and their attributes as well as some related global
settings, at the point in time it was written to the restart file by a
previous simluation. The simulation box will be partitioned into a
regular 3d grid of rectangular bricks, one per processor, based on the
number of processors in the current simulation and the settings of the
<aclass="reference internal"href="processors.html"><spanclass="doc">processors</span></a> command. The partitioning can later be
changed by the <aclass="reference internal"href="balance.html"><spanclass="doc">balance</span></a> or <aclass="reference internal"href="fix_balance.html"><spanclass="doc">fix balance</span></a> commands.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">Normally, restart files are written by the
<aclass="reference internal"href="restart.html"><spanclass="doc">restart</span></a> or <aclass="reference internal"href="write_restart.html"><spanclass="doc">write_restart</span></a> commands
so that all atoms in the restart file are inside the simulation box.
If this is not the case, the read_restart command will print an error
that atoms were “lost” when the file is read. This error should be
reported to the LAMMPS developers so the invalid writing of the
restart file can be fixed. If you still wish to use the restart file,
the optional <em>remap</em> flag can be appended to the read_restart command.
This should avoid the error, by explicitly remapping each atom back
into the simulation box, updating image flags for the atom
appropriately.</p>
</div>
<p>Restart files are saved in binary format to enable exact restarts,
meaning that the trajectories of a restarted run will precisely match
those produced by the original run had it continued on.</p>
<p>Several things can prevent exact restarts due to round-off effects, in
which case the trajectories in the 2 runs will slowly diverge. These
include running on a different number of processors or changing
certain settings such as those set by the <aclass="reference internal"href="newton.html"><spanclass="doc">newton</span></a> or
<aclass="reference internal"href="processors.html"><spanclass="doc">processors</span></a> commands. LAMMPS will issue a warning in
these cases.</p>
<p>Certain fixes will not restart exactly, though they should provide
statistically similar results. These include <aclass="reference internal"href="fix_shake.html"><spanclass="doc">fix shake</span></a> and <aclass="reference internal"href="fix_langevin.html"><spanclass="doc">fix langevin</span></a>.</p>
<p>Certain pair styles will not restart exactly, though they should
provide statistically similar results. This is because the forces
they compute depend on atom velocities, which are used at half-step
values every timestep when forces are computed. When a run restarts,
forces are initially evaluated with a full-step velocity, which is
different than if the run had continued. These pair styles include
<aclass="reference internal"href="pair_gran.html"><spanclass="doc">granular pair styles</span></a>, <aclass="reference internal"href="pair_dpd.html"><spanclass="doc">pair dpd</span></a>, and
<p>If a restarted run is immediately different than the run which
produced the restart file, it could be a LAMMPS bug, so consider
<aclass="reference internal"href="Section_errors.html#err-2"><spanclass="std std-ref">reporting it</span></a> if you think the behavior is
wrong.</p>
<p>Because restart files are binary, they may not be portable to other
machines. In this case, you can use the <aclass="reference internal"href="Section_start.html#start-7"><spanclass="std std-ref">-restart command-line switch</span></a> to convert a restart file to a data
file.</p>
<p>Similar to how restart files are written (see the
<aclass="reference internal"href="write_restart.html"><spanclass="doc">write_restart</span></a> and <aclass="reference internal"href="restart.html"><spanclass="doc">restart</span></a>
commands), the restart filename can contain two wild-card characters.
If a “*” appears in the filename, the directory is searched for all
filenames that match the pattern where “*” is replaced with a timestep
value. The file with the largest timestep value is read in. Thus,
this effectively means, read the latest restart file. It’s useful if
you want your script to continue a run from where it left off. See
the <aclass="reference internal"href="run.html"><spanclass="doc">run</span></a> command and its “upto” option for how to specify
the run command so it doesn’t need to be changed either.</p>
<p>If a “%” character appears in the restart filename, LAMMPS expects a
set of multiple files to exist. The <aclass="reference internal"href="restart.html"><spanclass="doc">restart</span></a> and
<aclass="reference internal"href="write_restart.html"><spanclass="doc">write_restart</span></a> commands explain how such sets are
created. Read_restart will first read a filename where “%” is
replaced by “base”. This file tells LAMMPS how many processors
created the set and how many files are in it. Read_restart then reads
the additional files. For example, if the restart file was specified
as save.% when it was written, then read_restart reads the files
save.base, save.0, save.1, ... save.P-1, where P is the number of
processors that created the restart file.</p>
<p>Note that P could be the total number of processors in the previous
simulation, or some subset of those processors, if the <em>fileper</em> or
<em>nfile</em> options were used when the restart file was written; see the
<aclass="reference internal"href="restart.html"><spanclass="doc">restart</span></a> and <aclass="reference internal"href="write_restart.html"><spanclass="doc">write_restart</span></a> commands
for details. The processors in the current LAMMPS simulation share
the work of reading these files; each reads a roughly equal subset of
the files. The number of processors which created the set can be
different the number of processors in the current LAMMPS simulation.
This can be a fast mode of input on parallel machines that support
parallel I/O.</p>
<p>A restart file can also be read in parallel as one large binary file
via the MPI-IO library, assuming it was also written with MPI-IO.
MPI-IO is part of the MPI standard for versions 2.0 and above. Using
MPI-IO requires two steps. First, build LAMMPS with its MPIIO package
installed, e.g.</p>
<divclass="highlight-default"><divclass="highlight"><pre><span></span><spanclass="n">make</span><spanclass="n">yes</span><spanclass="o">-</span><spanclass="n">mpiio</span><spanclass="c1"># installs the MPIIO package</span>
<spanclass="n">make</span><spanclass="n">g</span><spanclass="o">++</span><spanclass="c1"># build LAMMPS for your platform</span>
</pre></div>
</div>
<p>Second, use a restart filename which contains ”.mpiio”. Note that it
does not have to end in ”.mpiio”, just contain those characters.
Unlike MPI-IO dump files, a particular restart file must be both
written and read using MPI-IO.</p>
<hrclass="docutils"/>
<p>Here is the list of information included in a restart file, which
means these quantities do not need to be re-specified in the input
script that reads the restart file, though you can redefine many of
these settings after the restart file is read.</p>
<li>per-type atom settings such as <aclass="reference external"href="mass.thml">mass</a></li>
<li>per-atom attributes including their group assignments and molecular topology attributes (bonds, angles, etc)</li>
<li>force field styles (<aclass="reference internal"href="pair_style.html"><spanclass="doc">pair</span></a>, <aclass="reference internal"href="bond_style.html"><spanclass="doc">bond</span></a>, <aclass="reference internal"href="angle_style.html"><spanclass="doc">angle</span></a>, etc)</li>
<li>force field coefficients (<aclass="reference internal"href="pair_coeff.html"><spanclass="doc">pair</span></a>, <aclass="reference internal"href="bond_coeff.html"><spanclass="doc">bond</span></a>, <aclass="reference internal"href="angle_coeff.html"><spanclass="doc">angle</span></a>, etc) in some cases (see below)</li>
<li><aclass="reference internal"href="pair_modify.html"><spanclass="doc">pair_modify</span></a> settings, except the compute option</li>
<li><aclass="reference internal"href="neighbor.html"><spanclass="doc">neighbor list</span></a> criteria including <aclass="reference internal"href="neigh_modify.html"><spanclass="doc">neigh_modify</span></a> settings</li>
<li><aclass="reference internal"href="kspace_style.html"><spanclass="doc">kspace_style</span></a> and <aclass="reference internal"href="kspace_modify.html"><spanclass="doc">kspace_modify</span></a> settings</li>
<li>info for <aclass="reference internal"href="thermo_style.html"><spanclass="doc">thermodynamic</span></a>, <aclass="reference internal"href="dump.html"><spanclass="doc">dump</span></a>, or <aclass="reference internal"href="restart.html"><spanclass="doc">restart</span></a> output</li>
</ul>
<p>The <aclass="reference internal"href="newton.html"><spanclass="doc">newton</span></a> command has two settings, one for pairwise
interactions, the other for bonded. Both settings are stored in the
restart file. For the bond setting, the value in the file will
overwrite the current value (at the time the read_restart command is
issued) and warn if the two values are not the same and the current
value is not the default. For the pair setting, the value in the file
will not overwrite the current value (so that you can override the
previous run’s value), but a warning is issued if the two values are
not the same and the current value is not the default.</p>
<p>Note that some force field styles (pair, bond, angle, etc) do not
store their coefficient info in restart files. Typically these are
many-body or tabulated potentials which read their parameters from
separate files. In these cases you will need to re-specify the “pair
<p>As indicated in the above list, the <aclass="reference internal"href="fix.html"><spanclass="doc">fixes</span></a> used for a
simulation are not stored in the restart file. This means the new
input script should specify all fixes it will use. However, note that
some fixes store an internal “state” which is written to the restart
file. This allows the fix to continue on with its calculations in a
restarted simulation. To re-enable such a fix, the fix command in the
new input script must use the same fix-ID and group-ID as was used in
the input script that wrote the restart file. If a match is found,
LAMMPS prints a message indicating that the fix is being re-enabled.
If no match is found before the first run or minimization is performed
by the new script, the “state” information for the saved fix is
discarded. See the doc pages for individual fixes for info on which
ones can be restarted in this manner.</p>
<p>Likewise, the <aclass="reference internal"href="fix.html"><spanclass="doc">computes</span></a> used for a simulation are not stored
in the restart file. This means the new input script should specify
all computes it will use. However, some computes create a fix
internally to store “state” information that persists from timestep to
timestep. An example is the <aclass="reference internal"href="compute_msd.html"><spanclass="doc">compute msd</span></a> command
which uses a fix to store a reference coordinate for each atom, so
that a displacement can be calculated at any later time. If the
compute command in the new input script uses the same compute-ID and
group-ID as was used in the input script that wrote the restart file,
then it will create the same fix in the restarted run. This means the
re-created fix will be re-enabled with the stored state information as
described in the previous paragraph, so that the compute can continue
its calculations in a consistent manner.</p>
<p>Some pair styles, like the <aclass="reference internal"href="pair_gran.html"><spanclass="doc">granular pair styles</span></a>, also
use a fix to store “state” information that persists from timestep to
timestep. In the case of granular potentials, it is contact
information between pairs of touching particles. This info will also
be re-enabled in the restart script, assuming you re-use the same
granular pair style.</p>
<p>LAMMPS allows bond interactions (angle, etc) to be turned off or
deleted in various ways, which can affect how their info is stored in
a restart file.</p>
<p>If bonds (angles, etc) have been turned off by the <aclass="reference internal"href="fix_shake.html"><spanclass="doc">fix shake</span></a> or <aclass="reference internal"href="delete_bonds.html"><spanclass="doc">delete_bonds</span></a> command,
their info will be written to a restart file as if they are turned on.
This means they will need to be turned off again in a new run after
the restart file is read.</p>
<p>Bonds that are broken (e.g. by a bond-breaking potential) are written
to the restart file as broken bonds with a type of 0. Thus these
bonds will still be broken when the restart file is read.</p>
<p>Bonds that have been broken by the <aclass="reference internal"href="fix_bond_break.html"><spanclass="doc">fix bond/break</span></a> command have disappeared from the
system. No information about these bonds is written to the restart
file.</p>
</div>
<hrclass="docutils"/>
<divclass="section"id="restrictions">
<h2>Restrictions</h2>
<p>To write and read restart files in parallel with MPI-IO, the MPIIO
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.