Change Update::reset_timestep() API so that rerun can bypass the time depended fix check

This commit is contained in:
Axel Kohlmeyer
2022-02-27 11:26:33 -05:00
parent 750e0435a8
commit 7824e43339
4 changed files with 12 additions and 9 deletions

View File

@ -121,7 +121,7 @@ void ReadDump::command(int narg, char **arg)
// reset timestep to nstep // reset timestep to nstep
update->reset_timestep(nstep); update->reset_timestep(nstep, true);
// counters // counters

View File

@ -159,7 +159,7 @@ void Rerun::command(int narg, char **arg)
while (true) { while (true) {
ndump++; ndump++;
rd->header(firstflag); rd->header(firstflag);
update->reset_timestep(ntimestep); update->reset_timestep(ntimestep, false);
rd->atoms(); rd->atoms();
modify->init(); modify->init();

View File

@ -460,7 +460,7 @@ void Update::reset_timestep(int narg, char **arg)
{ {
if (narg != 1) error->all(FLERR, "Illegal reset_timestep command"); if (narg != 1) error->all(FLERR, "Illegal reset_timestep command");
bigint newstep = utils::bnumeric(FLERR, arg[0], false, lmp); 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 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"); if (newstep < 0) error->all(FLERR, "Timestep must be >= 0");
@ -490,11 +490,14 @@ void Update::reset_timestep(bigint newstep)
output->reset_timestep(ntimestep); 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()) for (const auto &ifix : modify->get_fix_list())
if (ifix->time_depend) if (ifix->time_depend)
error->all(FLERR, "Cannot reset timestep with time-dependent fix {} defined", ifix->style); 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 // reset eflag/vflag global so no commands will think eng/virial are current

View File

@ -66,7 +66,7 @@ class Update : protected Pointers {
void create_integrate(int, char **, int); void create_integrate(int, char **, int);
void create_minimize(int, char **, int); void create_minimize(int, char **, int);
void reset_timestep(int, char **); void reset_timestep(int, char **);
void reset_timestep(bigint); void reset_timestep(bigint, bool);
void update_time(); void update_time();
double memory_usage(); double memory_usage();