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

@ -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