remove NULL option for reset_timestep

This commit is contained in:
Axel Kohlmeyer
2022-05-04 16:21:06 -04:00
parent 81bb4bfc23
commit ba3aa8fab5
3 changed files with 4 additions and 14 deletions

View File

@ -10,7 +10,7 @@ Syntax
reset_timestep N keyword values ... reset_timestep N keyword values ...
* N = timestep number (may be NULL) * N = timestep number
* zero or more keyword/value pairs may be appended * zero or more keyword/value pairs may be appended
* keyword = *time* * keyword = *time*
@ -27,7 +27,6 @@ Examples
reset_timestep 0 reset_timestep 0
reset_timestep 4000000 reset_timestep 4000000
reset_timestep 1000 time 100.0 reset_timestep 1000 time 100.0
reset_timestep NULL time 200.0
Description Description
""""""""""" """""""""""
@ -40,8 +39,7 @@ simulation run or minimization advanced the timestep.
The optional *time* keyword allows to also set the accumulated The optional *time* keyword allows to also set the accumulated
simulation time. This is usually the number of timesteps times simulation time. This is usually the number of timesteps times
the size of the timestep, but when using variable size timesteps the size of the timestep, but when using variable size timesteps
with :doc:`fix dt/reset <fix_dt_reset>` it can differ. With with :doc:`fix dt/reset <fix_dt_reset>` it can differ.
NULL as the timestep number, only the accumulated time is reset.
The :doc:`read_data <read_data>` and :doc:`create_box <create_box>` The :doc:`read_data <read_data>` and :doc:`create_box <create_box>`
commands set the timestep to 0; the :doc:`read_restart <read_restart>` commands set the timestep to 0; the :doc:`read_restart <read_restart>`

View File

@ -459,11 +459,10 @@ void Update::reset_timestep(int narg, char **arg)
{ {
if (narg < 1) utils::missing_cmd_args(FLERR, "reset_timestep", error); if (narg < 1) utils::missing_cmd_args(FLERR, "reset_timestep", error);
if (!utils::strmatch(arg[0], "^NULL$"))
reset_timestep(utils::bnumeric(FLERR, arg[0], false, lmp), true); reset_timestep(utils::bnumeric(FLERR, arg[0], false, lmp), true);
if (narg > 1) { if (narg > 1) {
if (utils::strmatch(arg[1], "^time$")) { if (strcmp(arg[1], "time") == 0) {
if (narg < 3) utils::missing_cmd_args(FLERR, "reset_timestep time", error); if (narg < 3) utils::missing_cmd_args(FLERR, "reset_timestep time", error);
atimestep = ntimestep; atimestep = ntimestep;
atime = utils::numeric(FLERR, arg[2], false, lmp); atime = utils::numeric(FLERR, arg[2], false, lmp);

View File

@ -241,13 +241,6 @@ TEST_F(SimpleCommandsTest, ResetTimestep)
ASSERT_EQ(lmp->update->atimestep, 0); ASSERT_EQ(lmp->update->atimestep, 0);
ASSERT_DOUBLE_EQ(lmp->update->atime, 0.0); ASSERT_DOUBLE_EQ(lmp->update->atime, 0.0);
BEGIN_HIDE_OUTPUT();
command("reset_timestep NULL time 10.0");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->ntimestep, 0);
ASSERT_EQ(lmp->update->atimestep, 0);
ASSERT_DOUBLE_EQ(lmp->update->atime, 10.0);
BEGIN_HIDE_OUTPUT(); BEGIN_HIDE_OUTPUT();
command("reset_timestep 10 time 100.0"); command("reset_timestep 10 time 100.0");
END_HIDE_OUTPUT(); END_HIDE_OUTPUT();