diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 4417e186ec..843d2e4883 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -783,6 +783,11 @@ To write gzipped dump files, you must either compile LAMMPS with the -DLAMMPS_GZIP option or use the styles from the COMPRESS package. See the :doc:`Build settings ` page for details. +While a dump command is active (i.e. has not been stopped by using +the undump command), no commands may be used that will change the +timestep (e.g. :doc:`reset_timestep `). LAMMPS +will terminate with an error otherwise. + The *atom/gz*, *cfg/gz*, *custom/gz*, and *xyz/gz* styles are part of the COMPRESS package. They are only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for diff --git a/doc/src/read_dump.rst b/doc/src/read_dump.rst index 3a771b9c2d..c98347914b 100644 --- a/doc/src/read_dump.rst +++ b/doc/src/read_dump.rst @@ -24,12 +24,13 @@ Syntax *fx*,\ *fy*,\ *fz* = force components * zero or more keyword/value pairs may be appended -* keyword = *nfile* or *box* or *replace* or *purge* or *trim* or *add* or *label* or *scaled* or *wrapped* or *format* +* keyword = *nfile* or *box* or *timestep* or *replace* or *purge* or *trim* or *add* or *label* or *scaled* or *wrapped* or *format* .. parsed-literal:: *nfile* value = Nfiles = how many parallel dump files exist *box* value = *yes* or *no* = replace simulation box with dump box + *timestep* value = *yes* or *no* = reset simulation timestep with dump timestep *replace* value = *yes* or *no* = overwrite atoms with dump atoms *purge* value = *yes* or *no* = delete all atoms before adding dump atoms *trim* value = *yes* or *no* = trim atoms not in dump snapshot @@ -60,6 +61,7 @@ Examples read_dump dump.dcd 0 x y z box yes format molfile dcd read_dump dump.file 1000 x y z vx vy vz box yes format molfile lammpstrj /usr/local/lib/vmd/plugins/LINUXAMD64/plugins/molfile read_dump dump.file 5000 x y vx vy trim yes + read_dump dump.file 5000 x y vx vy add yes box no timestep no read_dump ../run7/dump.file.gz 10000 x y z box yes read_dump dump.xyz 10 x y z box no format molfile xyz ../plugins read_dump dump.dcd 0 x y z format molfile dcd @@ -71,9 +73,9 @@ Description """"""""""" Read atom information from a dump file to overwrite the current atom -coordinates, and optionally the atom velocities and image flags and -the simulation box dimensions. This is useful for restarting a run -from a particular snapshot in a dump file. See the +coordinates, and optionally the atom velocities and image flags, the +simulation timestep, and the simulation box dimensions. This is useful +for restarting a run from a particular snapshot in a dump file. See the :doc:`read_restart ` and :doc:`read_data ` commands for alternative methods to do this. Also see the :doc:`rerun ` command for a means of reading multiple snapshots @@ -89,9 +91,9 @@ Also note that reading per-atom information from a dump snapshot is limited to the atom coordinates, velocities and image flags, as explained below. Other atom properties, which may be necessary to run a valid simulation, such as atom charge, or bond topology information -for a molecular system, are not read from (or even contained in) dump -files. Thus this auxiliary information should be defined in the usual -way, e.g. in a data file read in by a :doc:`read_data ` +for a molecular system, are not read from (or may not even be contained +in) dump files. Thus this auxiliary information should be defined in +the usual way, e.g. in a data file read in by a :doc:`read_data ` command, before using the read_dump command, or by the :doc:`set ` command, after the dump snapshot is read. @@ -165,11 +167,10 @@ variable *ntimestep*: uint64_t ntimestep 5*scalar (0) 0 50 100 150 200 -Note that the *xyz* -and *molfile* formats do not store the timestep. For these formats, -timesteps are numbered logically, in a sequential manner, starting -from 0. Thus to access the 10th snapshot in an *xyz* or *mofile* -formatted dump file, use *Nstep* = 9. +Note that the *xyz* and *molfile* formats do not store the timestep. +For these formats, timesteps are numbered logically, in a sequential +manner, starting from 0. Thus to access the 10th snapshot in an *xyz* +or *mofile* formatted dump file, use *Nstep* = 9. The dimensions of the simulation box for the selected snapshot are also read; see the *box* keyword discussion below. For the *native* @@ -266,8 +267,10 @@ for how this is done, determined by the specified fields and optional keywords. The timestep of the snapshot becomes the current timestep for the -simulation. See the :doc:`reset_timestep ` command if -you wish to change this after the dump snapshot is read. +simulation unless the *timestep* keyword is specified with a *no* value +(default setting is *yes*). See the :doc:`reset_timestep ` +command if you wish to change this to a different value after the dump +snapshot is read. If the *box* keyword is specified with a *yes* value, then the current simulation box dimensions are replaced by the dump snapshot box @@ -391,7 +394,7 @@ Related commands Default """"""" -The option defaults are box = yes, replace = yes, purge = no, trim = -no, add = no, scaled = no, wrapped = yes, and format = native. +The option defaults are box = yes, timestep = yes, replace = yes, purge = no, +trim = no, add = no, scaled = no, wrapped = yes, and format = native. .. _vmd: http://www.ks.uiuc.edu/Research/vmd diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 8af19ee601..aa9ec0bbf0 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -121,7 +121,7 @@ void ReadDump::command(int narg, char **arg) // reset timestep to nstep - update->reset_timestep(nstep, true); + if (timestepflag) update->reset_timestep(nstep, true); // counters @@ -1202,6 +1202,7 @@ int ReadDump::fields_and_keywords(int narg, char **arg) multiproc_nfile = 0; boxflag = 1; + timestepflag = 1; replaceflag = 1; purgeflag = 0; trimflag = 0; @@ -1219,6 +1220,10 @@ int ReadDump::fields_and_keywords(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command"); boxflag = utils::logical(FLERR,arg[iarg+1],false,lmp); iarg += 2; + } else if (strcmp(arg[iarg],"timestep") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command"); + timestepflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + iarg += 2; } else if (strcmp(arg[iarg],"replace") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command"); replaceflag = utils::logical(FLERR,arg[iarg+1],false,lmp); diff --git a/src/read_dump.h b/src/read_dump.h index 1a94cd1cd3..506cd197c1 100644 --- a/src/read_dump.h +++ b/src/read_dump.h @@ -63,7 +63,8 @@ class ReadDump : public Command { int dimension; // same as in Domain int triclinic; - int boxflag; // overwrite simulation with dump file box params + int boxflag; // overwrite simulation box with dump file box params + int timestepflag; // overwrite simulation timestep with dump file timestep int replaceflag, addflag; // flags for processing dump snapshot atoms int trimflag, purgeflag; int scaleflag; // user 0/1 if dump file coords are unscaled/scaled