From: Mark Abraham Date: Wed, 15 Feb 2017 02:46:23 +0000 (+0100) Subject: Merge branch release-5-1 into release-2016 X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=b17aad24bff056334296a54d7606b33cff275bae;p=alexxy%2Fgromacs.git Merge branch release-5-1 into release-2016 There's an awkward clash with a bug fix from release-5-1 from subsequent cleanup in release-2016 while it was still master. Fortunately, the code path for bExchanged only happens when !bTrotter, and all the other code paths require bTrotter (which has several sub cases), so those two groups of code commute. (And the implementation of checking what the inputrec requires has changed between branches only in name.) Change-Id: I2382dad5c484452d023524884c025e77c2a624c4 --- b17aad24bff056334296a54d7606b33cff275bae diff --cc src/programs/mdrun/md.cpp index 4c4d069ef4,340d692c2a..8cf1386361 --- a/src/programs/mdrun/md.cpp +++ b/src/programs/mdrun/md.cpp @@@ -1192,28 -1195,40 +1192,35 @@@ double gmx::do_md(FILE *fplog, t_commre { m_add(force_vir, shake_vir, total_vir); /* we need the un-dispersion corrected total vir here */ trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ, trotter_seq, ettTSEQ2); - } - else - { - if (bExchanged) + - copy_mat(shake_vir, state->svir_prev); - copy_mat(force_vir, state->fvir_prev); ++ /* TODO This is only needed when we're about to write ++ * a checkpoint, because we use it after the restart ++ * (in a kludge?). But what should we be doing if ++ * startingFromCheckpoint or bInitStep are true? */ ++ if (inputrecNptTrotter(ir) || inputrecNphTrotter(ir)) + { - wallcycle_stop(wcycle, ewcUPDATE); - /* We need the kinetic energy at minus the half step for determining - * the full step kinetic energy and possibly for T-coupling.*/ - /* This may not be quite working correctly yet . . . . */ - compute_globals(fplog, gstat, cr, ir, fr, ekind, state, state_global, mdatoms, nrnb, vcm, - wcycle, enerd, NULL, NULL, NULL, NULL, mu_tot, - constr, NULL, FALSE, state->box, - top_global, &bSumEkinhOld, - CGLO_RERUNMD | CGLO_GSTAT | CGLO_TEMPERATURE); - wallcycle_start(wcycle, ewcUPDATE); ++ copy_mat(shake_vir, state->svir_prev); ++ copy_mat(force_vir, state->fvir_prev); ++ } + if (inputrecNvtTrotter(ir) && ir->eI == eiVV) + { + /* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */ + enerd->term[F_TEMP] = sum_ekin(&(ir->opts), ekind, NULL, (ir->eI == eiVV), FALSE); + enerd->term[F_EKIN] = trace(ekind->ekin); } } - } - if (bTrotter && !bInitStep) - { - /* TODO This is only needed when we're about to write - * a checkpoint, because we use it after the restart - * (in a kludge?). But what should we be doing if - * startingFromCheckpoint or bInitStep are true? */ - if (IR_NPT_TROTTER(ir) || IR_NPH_TROTTER(ir)) - { - copy_mat(shake_vir, state->svir_prev); - copy_mat(force_vir, state->fvir_prev); - } - if (IR_NVT_TROTTER(ir) && ir->eI == eiVV) + else if (bExchanged) { - /* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */ - enerd->term[F_TEMP] = sum_ekin(&(ir->opts), ekind, NULL, (ir->eI == eiVV), FALSE); - enerd->term[F_EKIN] = trace(ekind->ekin); + wallcycle_stop(wcycle, ewcUPDATE); + /* We need the kinetic energy at minus the half step for determining + * the full step kinetic energy and possibly for T-coupling.*/ + /* This may not be quite working correctly yet . . . . */ + compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm, + wcycle, enerd, NULL, NULL, NULL, NULL, mu_tot, + constr, &nullSignaller, state->box, + NULL, &bSumEkinhOld, + CGLO_GSTAT | CGLO_TEMPERATURE); + wallcycle_start(wcycle, ewcUPDATE); } } /* if it's the initial step, we performed this first step just to get the constraint virial */ @@@ -1272,7 -1287,7 +1279,7 @@@ bIMDstep = do_IMD(ir->bIMD, step, cr, bNS, state->box, state->x, ir, t, wcycle); /* kludge -- virial is lost with restart for MTTK NPT control. Must reload (saved earlier). */ - if (startingFromCheckpoint && bTrotter) - if (bStartingFromCpt && (IR_NPT_TROTTER(ir) || IR_NPH_TROTTER(ir))) ++ if (startingFromCheckpoint && (inputrecNptTrotter(ir) || inputrecNphTrotter(ir))) { copy_mat(state->svir_prev, shake_vir); copy_mat(state->fvir_prev, force_vir);