Merge branch release-5-1
authorMark Abraham <mark.j.abraham@gmail.com>
Sun, 24 Jan 2016 13:07:30 +0000 (14:07 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Mon, 25 Jan 2016 06:08:04 +0000 (07:08 +0100)
Several minor clashes in md.cpp from refactoring in master branch;
specifically the removal of CGLO_RERUN (adjacent to changes in
release-5-1), rename of bStateFromCP to startingFromCheckpoint, change
IR_NVT_TROTTER(ir) to inputrecNvtTrotter(ir), removal of bCompact.

Change-Id: I42740bb6c67684f81bc305703240df4d5977bdab

1  2 
docs/install-guide/index.rst
src/programs/mdrun/md.cpp

Simple merge
index 5944f106c27d0e7bebe234966c03b6b01d83bc3e,ce25ac7e90d312d3671b4f1ccd495775caeee445..61d886fee11a933637e901b88755aa029dfeab1a
@@@ -223,10 -174,10 +223,10 @@@ double gmx::do_md(FILE *fplog, t_commre
      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);