Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93688474
restart.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 30, 17:50
Size
7 KB
Mime Type
text/html
Expires
Mon, Dec 2, 17:50 (2 d)
Engine
blob
Format
Raw Data
Handle
22683540
Attached To
rLAMMPS lammps
restart.html
View Options
<HTML>
<CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A>
</CENTER>
<HR>
<H3>restart command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>restart 0
restart N root keyword value ...
restart N file1 file2 keyword value ...
</PRE>
<UL><LI>N = write a restart file every this many timesteps
<LI>N can be a variable (see below)
<LI>root = filename to which timestep # is appended
<LI>file1,file2 = two full filenames, toggle between them when writing file
<LI>zero or more keyword/value pairs may be appended
<LI>keyword = <I>fileper</I> or <I>nfile</I>
<PRE> <I>fileper</I> arg = Np
Np = write one file for every this many processors
<I>nfile</I> arg = Nf
Nf = write this many files, one from each of Nf processors
</PRE>
</UL>
<P><B>Examples:</B>
</P>
<PRE>restart 0
restart 1000 poly.restart
restart 1000 poly.restart.mpiio
restart 1000 restart.*.equil
restart 10000 poly.%.1 poly.%.2 nfile 10
restart v_mystep poly.restart
</PRE>
<P><B>Description:</B>
</P>
<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 <A HREF = "dump.html">dump</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 <I>fileper</I> and <I>nfile</I> 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>
<PRE>make yes-mpiio # installs the MPIIO package
make g++ # build LAMMPS for your platform
</PRE>
<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
<A HREF = "write_restart.html">write_restart</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 <A HREF = "variable.html">equal-style
variable</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 <A HREF = "variable.html">equal-style
variables</A>, as examples of useful functions to use in
this context. Other similar math functions could easily be added as
options for <A HREF = "variable.html">equal-style variables</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>
<PRE>variable s equal stride(1100,1200,1)
restart v_s tmp.restart
</PRE>
<HR>
<P>See the <A HREF = "read_restart.html">read_restart</A> command for information about
what is stored in a restart file.
</P>
<P>Restart files can be read by a <A HREF = "read_restart.html">read_restart</A>
command to restart a simulation from a particular state. Because the
file is binary (to enable exact restarts), it may not be readable on
another machine. In this case, you can use the <A HREF = "Section_start.html#start_7">-r command-line
switch</A> to convert a restart file to a data
file.
</P>
<P>IMPORTANT NOTE: Although the purpose of restart files is to enable
restarting a simulation from where it left off, not all information
about a simulation is stored in the file. For example, the list of
fixes that were specified during the initial run is not stored, which
means the new input script must specify any fixes you want to use.
Even when restart information is stored in the file, as it is for some
fixes, commands may need to be re-specified in the new input script,
in order to re-use that information. See the
<A HREF = "read_restart.html">read_restart</A> command for information about what is
stored in a restart file.
</P>
<HR>
<P>The optional <I>nfile</I> or <I>fileper</I> keywords can be used in conjunction
with the "%" wildcard character in the specified restart file name(s).
As explained above, the "%" character causes the restart file to be
written in pieces, one piece for each of P processors. By default P =
the number of processors the simulation is running on. The <I>nfile</I> or
<I>fileper</I> keyword can be used to set P to a smaller value, which can
be more efficient when running on a large number of processors.
</P>
<P>The <I>nfile</I> keyword sets P to the specified Nf value. For example, if
Nf = 4, and the simulation is running on 100 processors, 4 files will
be written, by processors 0,25,50,75. Each will collect information
from itself and the next 24 processors and write it to a restart file.
</P>
<P>For the <I>fileper</I> keyword, the specified value of Np means write one
file for every Np processors. For example, if Np = 4, every 4th
processor (0,4,8,12,etc) will collect information from itself and the
next 3 processors and write it to a restart file.
</P>
<HR>
<P><B>Restrictions:</B>
</P>
<P>To write and read restart files in parallel with MPI-IO, the MPIIO
package must be installed.
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "write_restart.html">write_restart</A>, <A HREF = "read_restart.html">read_restart</A>
</P>
<P><B>Default:</B>
</P>
<PRE>restart 0
</PRE>
</HTML>
Event Timeline
Log In to Comment