Unverified Commit ce3e4b50 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

implement and document noaccel flag for read_restart

parent 56e86724
Loading
Loading
Loading
Loading
+27 −6
Original line number Diff line number Diff line
@@ -9,10 +9,16 @@ Syntax

.. parsed-literal::

   read_restart file flag
   read_restart file flags

* file = name of binary restart file to read in
* flag = remap (optional)
* optional flags may be appended

.. parsed-literal::

   flag = *remap* or *noaccel*
     *remap* = enforce remapping of atoms into the simulation box
     *noaccel* = remove known accelerator suffixes from styles

Examples
""""""""
@@ -55,12 +61,27 @@ changed by the :doc:`balance <balance>` or :doc:`fix balance <fix_balance>` comm
   into the simulation box, updating image flags for the atom
   appropriately.

.. note::

   By default, read_restart will recreate atom, pair and other styles
   exactly as they were stored in the restart file. In a run using the
   :doc:`suffix command <suffix>` or
   :doc:`suffix command line flag <Run_options>`, that will include the
   appended (accelerator) suffix.  When restarting with a LAMMPS executable
   that does not include those styles, the restart will fail.  With the
   optional *noaccel* flag, this behavior is changed.  With that flag
   any known suffix of an :doc:`accelerated style <Speed_packages>` will
   be removed.  In case the suffix flag or command line option
   is used during reading the restart this suffix will be tried, regardless
   of whether the *noaccel* flag is used.

Restart files are saved in binary format to enable exact restarts,
meaning that the trajectories of a restarted run will precisely match
meaning that the trajectories of a restarted run will closely match
those produced by the original run had it continued on.

Several things can prevent exact restarts due to round-off effects, in
which case the trajectories in the 2 runs will slowly diverge.  These
Several things can prevent exact restarts due to propagation of round-off
effects, in which case the trajectories in the 2 runs will at some point
start diverging exponentially.  These
include running on a different number of processors or changing
certain settings such as those set by the :doc:`newton <newton>` or
:doc:`processors <processors>` commands.  LAMMPS will issue a warning in
@@ -83,7 +104,7 @@ produced the restart file, it could be a LAMMPS bug, so consider
:doc:`reporting it <Errors_bugs>` if you think the behavior is a bug.

Because restart files are binary, they may not be portable to other
machines.  In this case, you can use the :doc:`-restart command-line switch <Run_options>` to convert a restart file to a data file.
machines.  In this case, you can use the :doc:`-r2data command-line switch <Run_options>` to convert a restart file to a data file.

Similar to how restart files are written (see the
:doc:`write_restart <write_restart>` and :doc:`restart <restart>`
+20 −10
Original line number Diff line number Diff line
@@ -69,7 +69,9 @@ enum{VERSION,SMALLINT,TAGINT,BIGINT,

/* ---------------------------------------------------------------------- */

ReadRestart::ReadRestart(LAMMPS *lmp) : Pointers(lmp) {}
ReadRestart::ReadRestart(LAMMPS *lmp) : Pointers(lmp) {
  noaccelflag = 0;
}

/* ---------------------------------------------------------------------- */

@@ -89,8 +91,9 @@ void ReadRestart::command(int narg, char **arg)
  // check for remap option

  int remapflag = 0;
  if (narg == 2) {
    if (strcmp(arg[1],"remap") == 0) remapflag = 1;
  for (int iarg=1; iarg < narg; ++iarg) {
    if (strcmp(arg[iarg],"remap") == 0) remapflag = 1;
    else if (strcmp(arg[iarg],"noaccel") == 0) noaccelflag = 1;
    else error->all(FLERR,"Illegal read_restart command");
  }

@@ -856,7 +859,8 @@ void ReadRestart::header(int incompatible)
    // create new AtomVec class using any stored args

    } else if (flag == ATOM_STYLE) {
      char *style = utils::stripsuffix(read_string());
      char *style = read_string();
      if (noaccelflag) style = utils::stripsuffix(style);
      int nargcopy = read_int();
      char **argcopy = new char*[nargcopy];
      for (int i = 0; i < nargcopy; i++)
@@ -996,7 +1000,8 @@ void ReadRestart::force_fields()
  while (flag >= 0) {

    if (flag == PAIR) {
      style = utils::stripsuffix(read_string());
      style = read_string();
      if (noaccelflag) style = utils::stripsuffix(style);
      force->create_pair(style,1);
      delete [] style;
      if (comm->me ==0) {
@@ -1008,7 +1013,8 @@ void ReadRestart::force_fields()
      force->pair->read_restart(fp);

    } else if (flag == NO_PAIR) {
      style = utils::stripsuffix(read_string());
      style = read_string();
      if (noaccelflag) style = utils::stripsuffix(style);
      if (comm->me ==0) {
        if (screen) fprintf(screen,"  pair style %s stores no "
                            "restart info\n", style);
@@ -1019,7 +1025,8 @@ void ReadRestart::force_fields()
      force->pair_restart = style;

    } else if (flag == BOND) {
      style = utils::stripsuffix(read_string());
      style = read_string();
      if (noaccelflag) style = utils::stripsuffix(style);
      force->create_bond(style,1);
      delete [] style;
      if (comm->me ==0) {
@@ -1031,7 +1038,8 @@ void ReadRestart::force_fields()
      force->bond->read_restart(fp);

    } else if (flag == ANGLE) {
      style = utils::stripsuffix(read_string());
      style = read_string();
      if (noaccelflag) style = utils::stripsuffix(style);
      force->create_angle(style,1);
      delete [] style;
      if (comm->me ==0) {
@@ -1043,7 +1051,8 @@ void ReadRestart::force_fields()
      force->angle->read_restart(fp);

    } else if (flag == DIHEDRAL) {
      style = utils::stripsuffix(read_string());
      style = read_string();
      if (noaccelflag) style = utils::stripsuffix(style);
      force->create_dihedral(style,1);
      delete [] style;
      if (comm->me ==0) {
@@ -1055,7 +1064,8 @@ void ReadRestart::force_fields()
      force->dihedral->read_restart(fp);

    } else if (flag == IMPROPER) {
      style = utils::stripsuffix(read_string());
      style = read_string();
      if (noaccelflag) style = utils::stripsuffix(style);
      force->create_improper(style,1);
      delete [] style;
      if (comm->me ==0) {
+3 −1
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ class ReadRestart : protected Pointers {
                             // 1 = restart file is parallel (multiple files)
  int multiproc_file;        // # of parallel files in restart
  int nprocs_file;           // total # of procs that wrote restart file
  int noaccelflag;           // 1 if stripping accelerator suffixes from styles
                             // 0 if leaving style names unchanged
  
  // MPI-IO values