int count, nconverged = 0;
real timestep = 0;
double tcount = 0;
- gmx_bool bConverged = TRUE, bOK, bSumEkinhOld, bExchanged, bNeedRepartition;
+ gmx_bool bConverged = TRUE, bOK, bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
gmx_bool bAppend;
gmx_bool bResetCountersHalfMaxH = FALSE;
gmx_bool bVV, bIterativeCase, bFirstIterate, bTemp, bPres, bTrotter;
set_constraints(constr, top, ir, mdatoms, cr);
}
- if (repl_ex_nst > 0)
- {
- /* We need to be sure replica exchange can only occur
- * when the energies are current */
- check_nst_param(fplog, cr, "nstcalcenergy", ir->nstcalcenergy,
- "repl_ex_nst", &repl_ex_nst);
- /* This check needs to happen before inter-simulation
- * signals are initialized, too */
- }
if (repl_ex_nst > 0 && MASTER(cr))
{
repl_ex = init_replica_exchange(fplog, cr->ms, state_global, ir,
bStartingFromCpt = (Flags & MD_STARTFROMCPT) && bInitStep;
bLastStep = FALSE;
bSumEkinhOld = FALSE;
+ bDoReplEx = FALSE;
bExchanged = FALSE;
bNeedRepartition = FALSE;
&& (ir->bExpanded) && (step > 0) && (!bStartingFromCpt));
}
+ bDoReplEx = ((repl_ex_nst > 0) && (step > 0) && !bLastStep &&
+ do_per_step(step, repl_ex_nst));
+
if (bSimAnn)
{
update_annealing_target_temp(&(ir->opts), t);
do_ene = (do_per_step(step, ir->nstenergy) || bLastStep);
- if (do_ene || do_log)
+ if (do_ene || do_log || bDoReplEx)
{
bCalcVir = TRUE;
bCalcEner = TRUE;
/* Replica exchange */
bExchanged = FALSE;
- if ((repl_ex_nst > 0) && (step > 0) && !bLastStep &&
- do_per_step(step, repl_ex_nst))
+ if (bDoReplEx)
{
bExchanged = replica_exchange(fplog, cr, repl_ex,
state_global, enerd,