<p>Write out a binary restart file with the current state of the
simulation every so many timesteps, in either or both of two modes, as
a run proceeds. A value of 0 means do not write out any restart
files. The two modes are as follows. If one filename is specified, a
series of filenames will be created which include the timestep in the
filename. If two filenames are specified, only 2 restart files will
be created, with those names. LAMMPS will toggle between the 2 names
as it writes successive restart files.</p>
<p>Note that you can specify the restart command twice, once with a
single filename and once with two filenames. This would allow you,
for example, to write out archival restart files every 100000 steps
using a single filenname, and more frequent temporary restart files
every 1000 steps, using two filenames. Using restart 0 will turn off
both modes of output.</p>
<p>Similar to <aclass="reference internal"href="dump.html"><spanclass="doc">dump</span></a> files, the restart filename(s) can contain
two wild-card characters.</p>
<p>If a “*” appears in the single filename, it is replaced with the
current timestep value. This is only recognized when a single
filename is used (not when toggling back and forth). Thus, the 3rd
example above creates restart files as follows: restart.1000.equil,
restart.2000.equil, etc. If a single filename is used with no “*”,
then the timestep value is appended. E.g. the 2nd example above
creates restart files as follows: poly.restart.1000,
poly.restart.2000, etc.</p>
<p>If a “%” character appears in the restart filename(s), then one file
is written for each processor and the “%” character is replaced with
the processor ID from 0 to P-1. An additional file with the “%”
replaced by “base” is also written, which contains global information.
For example, the files written on step 1000 for filename restart.%
would be restart.base.1000, restart.0.1000, restart.1.1000, ...,
restart.P-1.1000. This creates smaller files and can be a fast mode
of output and subsequent input on parallel machines that support
parallel I/O. The optional <em>fileper</em> and <em>nfile</em> keywords discussed
below can alter the number of files written.</p>
<p>The restart file can also be written in parallel as one large binary
file via the MPI-IO library, which 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>
<p>Restart files are written on timesteps that are a multiple of N but
not on the first timestep of a run or minimization. You can use the
<aclass="reference internal"href="write_restart.html"><spanclass="doc">write_restart</span></a> command to write a restart file
before a run begins. A restart file is not written on the last
timestep of a run unless it is a multiple of N. A restart file is
written on the last timestep of a minimization if N > 0 and the
minimization converges.</p>
<p>Instead of a numeric value, N can be specifed as an <aclass="reference internal"href="variable.html"><spanclass="doc">equal-style variable</span></a>, which should be specified as v_name, where
name is the variable name. In this case, the variable is evaluated at
the beginning of a run to determine the next timestep at which a
restart file will be written out. On that timestep, the variable will
be evaluated again to determine the next timestep, etc. Thus the
variable should return timestep values. See the stagger() and
logfreq() and stride() math functions for <aclass="reference internal"href="variable.html"><spanclass="doc">equal-style variables</span></a>, as examples of useful functions to use in
this context. Other similar math functions could easily be added as
options for <aclass="reference internal"href="variable.html"><spanclass="doc">equal-style variables</span></a>.</p>
<p>For example, the following commands will write restart files
every step from 1100 to 1200, and could be useful for debugging
a simulation where something goes wrong at step 1163:</p>
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>.