gmx_int64_t step, step_rel;
double elapsed_time;
double t, t0, lam0[efptNR];
- gmx_bool bGStatEveryStep, bGStat, bCalcVir, bCalcEner;
+ gmx_bool bGStatEveryStep, bGStat, bCalcVir, bCalcEnerStep, bCalcEner;
gmx_bool bNS, bNStList, bSimAnn, bStopCM, bRerunMD, bNotLastFrame = FALSE,
- bFirstStep, bStateFromCP, bStateFromTPX, bInitStep, bLastStep,
- bBornRadii, bStartingFromCpt;
+ bFirstStep, startingFromCheckpoint, bInitStep, bLastStep,
+ bBornRadii;
gmx_bool bDoDHDL = FALSE, bDoFEP = FALSE, bDoExpanded = FALSE;
gmx_bool do_ene, do_log, do_verbose, bRerunWarnNoV = TRUE,
bForceUpdate = FALSE, bCPT;
bBornRadii = TRUE;
}
- do_log = do_per_step(step, ir->nstlog) || bFirstStep || bLastStep;
+ /* do_log triggers energy and virial calculation. Because this leads
+ * to different code paths, forces can be different. Thus for exact
+ * continuation we should avoid extra log output.
+ * Note that the || bLastStep can result in non-exact continuation
+ * beyond the last step. But we don't consider that to be an issue.
+ */
- do_log = do_per_step(step, ir->nstlog) || (bFirstStep && !bStateFromCP) || bLastStep;
++ do_log = do_per_step(step, ir->nstlog) || (bFirstStep && !startingFromCheckpoint) || bLastStep;
do_verbose = bVerbose &&
(step % stepout == 0 || bFirstStep || bLastStep);
{
bCalcVir = TRUE;
bCalcEner = TRUE;
- bGStat = TRUE;
}
- (bVV && IR_NVT_TROTTER(ir) && do_per_step(step-1, nstglobalcomm)));
-
- /* these CGLO_ options remain the same throughout the iteration */
- cglo_flags = ((bRerunMD ? CGLO_RERUNMD : 0) |
- (bGStat ? CGLO_GSTAT : 0)
- );
+ /* Do we need global communication ? */
+ bGStat = (bCalcVir || bCalcEner || bStopCM ||
+ do_per_step(step, nstglobalcomm) ||
++ (EI_VV(ir->eI) && inputrecNvtTrotter(ir) && do_per_step(step-1, nstglobalcomm)));
+
force_flags = (GMX_FORCE_STATECHANGED |
- ((DYNAMIC_BOX(*ir) || bRerunMD) ? GMX_FORCE_DYNAMICBOX : 0) |
+ ((inputrecDynamicBox(ir) || bRerunMD) ? GMX_FORCE_DYNAMICBOX : 0) |
GMX_FORCE_ALLFORCES |
- GMX_FORCE_SEPLRF |
(bCalcVir ? GMX_FORCE_VIRIAL : 0) |
(bCalcEner ? GMX_FORCE_ENERGY : 0) |
(bDoFEP ? GMX_FORCE_DHDL : 0)
PrintFreeEnergyInfoToFile(fplog, ir->fepvals, ir->expandedvals, ir->bSimTemp ? ir->simtempvals : NULL,
&state_global->dfhist, state->fep_state, ir->nstlog, step);
}
- if (!(startingFromCheckpoint && (EI_VV(ir->eI))))
+ if (bCalcEner)
{
- if (bCalcEner)
- {
- upd_mdebin(mdebin, bDoDHDL, TRUE,
- t, mdatoms->tmass, enerd, state,
- ir->fepvals, ir->expandedvals, lastbox,
- shake_vir, force_vir, total_vir, pres,
- ekind, mu_tot, constr);
- }
- else
- {
- upd_mdebin_step(mdebin);
- }
+ upd_mdebin(mdebin, bDoDHDL, bCalcEnerStep,
+ t, mdatoms->tmass, enerd, state,
+ ir->fepvals, ir->expandedvals, lastbox,
+ shake_vir, force_vir, total_vir, pres,
+ ekind, mu_tot, constr);
+ }
+ else
+ {
+ upd_mdebin_step(mdebin);
+ }
- do_dr = do_per_step(step, ir->nstdisreout);
- do_or = do_per_step(step, ir->nstorireout);
+ gmx_bool do_dr = do_per_step(step, ir->nstdisreout);
+ gmx_bool do_or = do_per_step(step, ir->nstorireout);
+
+ print_ebin(mdoutf_get_fp_ene(outf), do_ene, do_dr, do_or, do_log ? fplog : NULL,
+ step, t,
- eprNORMAL, bCompact, mdebin, fcd, groups, &(ir->opts));
++ eprNORMAL, mdebin, fcd, groups, &(ir->opts));
- print_ebin(mdoutf_get_fp_ene(outf), do_ene, do_dr, do_or, do_log ? fplog : NULL,
- step, t,
- eprNORMAL, mdebin, fcd, groups, &(ir->opts));
- }
if (ir->bPull)
{
pull_print_output(ir->pull_work, step, t);