/* Update mdebin with energy history if appending to output files */
if (continuationOptions.appendFiles)
{
- restore_energyhistory_from_state(mdebin, observablesHistory->energyHistory.get());
- }
- else
- {
- if (observablesHistory->energyHistory != nullptr)
+ /* If no history is available (because a checkpoint is from before
+ * it was written) make a new one later, otherwise restore it.
+ */
+ if (observablesHistory->energyHistory)
{
- /* We might have read an energy history from checkpoint.
- * As we are not appending, we want to restart the statistics.
- * Free the allocated memory and reset the counts.
- */
- observablesHistory->energyHistory = {};
+ restore_energyhistory_from_state(mdebin, observablesHistory->energyHistory.get());
}
+ }
+ else if (observablesHistory->energyHistory)
+ {
+ /* We might have read an energy history from checkpoint.
+ * As we are not appending, we want to restart the statistics.
+ * Free the allocated memory and reset the counts.
+ */
+ observablesHistory->energyHistory = {};
/* We might have read a pull history from checkpoint.
* We will still want to keep the statistics, so that the files
* can be joined and still be meaningful.
* should not be reset.
*/
}
- if (ir->pull && ir->pull->bSetPbcRefToPrevStepCOM)
- {
- /* Copy the pull group COM of the previous step from the checkpoint state to the pull state */
- setPrevStepPullComFromState(ir->pull_work, state);
- }
}
- else if (ir->pull && ir->pull->bSetPbcRefToPrevStepCOM)
- {
- allocStatePrevStepPullCom(state, ir->pull_work);
- t_pbc pbc;
- set_pbc(&pbc, ir->ePBC, state->box);
- initPullComFromPrevStep(cr, ir->pull_work, mdatoms, &pbc, as_rvec_array(state->x.data()));
- updatePrevStepCom(ir->pull_work);
- setStatePrevStepPullCom(ir->pull_work, state);
- }
- if (observablesHistory->energyHistory == nullptr)
+ if (!observablesHistory->energyHistory)
{
observablesHistory->energyHistory = compat::make_unique<energyhistory_t>();
}
- if (observablesHistory->pullHistory == nullptr)
+ if (!observablesHistory->pullHistory)
{
observablesHistory->pullHistory = compat::make_unique<PullHistory>();
}
update_energyhistory(observablesHistory->energyHistory.get(), mdebin);
}
+ preparePrevStepPullCom(ir, mdatoms, state, state_global, cr, startingFromCheckpoint);
+
// TODO: Remove this by converting AWH into a ForceProvider
auto awh = prepareAwhModule(fplog, *ir, state_global, cr, ms, startingFromCheckpoint,
shellfc != nullptr,
constr, enerd, fcd,
state, f.arrayRefWithPadding(), force_vir, mdatoms,
nrnb, wcycle, graph, groups,
- shellfc, fr, t, mu_tot,
+ shellfc, fr, ppForceWorkload, t, mu_tot,
vsite,
ddOpenBalanceRegion, ddCloseBalanceRegion);
}
state->box, state->x.arrayRefWithPadding(), &state->hist,
f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
state->lambda, graph,
- fr, vsite, mu_tot, t, ed ? ed->getLegacyED() : nullptr,
+ fr, ppForceWorkload, vsite, mu_tot, t, ed ? ed->getLegacyED() : nullptr,
(bNS ? GMX_FORCE_NS : 0) | force_flags,
ddOpenBalanceRegion, ddCloseBalanceRegion);
}
state, graph,
nrnb, wcycle, upd, constr);
- if (MASTER(cr) && ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
+ if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
{
- updatePrevStepCom(ir->pull_work);
- setStatePrevStepPullCom(ir->pull_work, state);
+ updatePrevStepPullCom(ir->pull_work, state);
}
if (ir->eI == eiVVAK)