diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 71d302c4f1..f3ca55f94f 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); + update->reset_timestep(nstep, true); // counters diff --git a/src/rerun.cpp b/src/rerun.cpp index 78b1a28cb6..83971f6adc 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -159,7 +159,7 @@ void Rerun::command(int narg, char **arg) while (true) { ndump++; rd->header(firstflag); - update->reset_timestep(ntimestep); + update->reset_timestep(ntimestep, false); rd->atoms(); modify->init(); diff --git a/src/update.cpp b/src/update.cpp index c82a1ddc18..3870f6d38e 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -460,7 +460,7 @@ void Update::reset_timestep(int narg, char **arg) { if (narg != 1) error->all(FLERR, "Illegal reset_timestep command"); bigint newstep = utils::bnumeric(FLERR, arg[0], false, lmp); - reset_timestep(newstep); + reset_timestep(newstep, true); } /* ---------------------------------------------------------------------- @@ -468,7 +468,7 @@ void Update::reset_timestep(int narg, char **arg) called from input script (indirectly) or rerun command ------------------------------------------------------------------------- */ -void Update::reset_timestep(bigint newstep) +void Update::reset_timestep(bigint newstep, bool do_check) { if (newstep < 0) error->all(FLERR, "Timestep must be >= 0"); @@ -490,11 +490,14 @@ void Update::reset_timestep(bigint newstep) output->reset_timestep(ntimestep); - // do not allow timestep-dependent fixes to be defined + // rerun will not be meaningful with this check active. + if (do_check) { + // do not allow timestep-dependent fixes to be defined - for (const auto &ifix : modify->get_fix_list()) - if (ifix->time_depend) - error->all(FLERR, "Cannot reset timestep with time-dependent fix {} defined", ifix->style); + for (const auto &ifix : modify->get_fix_list()) + if (ifix->time_depend) + error->all(FLERR, "Cannot reset timestep with time-dependent fix {} defined", ifix->style); + } // reset eflag/vflag global so no commands will think eng/virial are current diff --git a/src/update.h b/src/update.h index f763dfa559..afcafb87cb 100644 --- a/src/update.h +++ b/src/update.h @@ -66,7 +66,7 @@ class Update : protected Pointers { void create_integrate(int, char **, int); void create_minimize(int, char **, int); void reset_timestep(int, char **); - void reset_timestep(bigint); + void reset_timestep(bigint, bool); void update_time(); double memory_usage();