Commit d93c56e9 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

When dumping a restart file at the end of a run, only drift the particles if...

When dumping a restart file at the end of a run, only drift the particles if no other form of i/o has taken place this step to avoid a drift towards the past.
parent 261196c3
......@@ -1275,8 +1275,17 @@ int main(int argc, char *argv[]) {
/* Also if using nsteps to exit, will not have saved any restarts on exit,
* make sure we do that (useful in testing only). */
if (force_stop || (e.restart_onexit && e.step - 1 == nsteps))
engine_dump_restarts(&e, 0, 1);
if (force_stop || (e.restart_onexit && e.step - 1 == nsteps)) {
/* Check whether we dumped snapshots/stats/groups and hence do not
need to drift (as we might drift to the past) */
int drifted_all = 0;
drifted_all |= (e.step_props & engine_step_prop_snapshot);
drifted_all |= (e.step_props & engine_step_prop_statistics);
drifted_all |= (e.step_props & engine_step_prop_stf);
engine_dump_restarts(&e, drifted_all, /*force=*/1);
}
/* Dump the task data using the given frequency. */
if (dump_tasks && (dump_tasks == 1 || j % dump_tasks == 1)) {
......
......@@ -2352,7 +2352,8 @@ void engine_step(struct engine *e) {
/********************************************************/
/* Create a restart file if needed. */
engine_dump_restarts(e, 0, e->restart_onexit && engine_is_done(e));
engine_dump_restarts(e, /*drifted_all=*/0,
e->restart_onexit && engine_is_done(e));
engine_check_for_dumps(e);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment