Merge "Merge branch 'release-2019' into master"
authorPaul Bauer <paul.bauer.q@gmail.com>
Tue, 29 Oct 2019 13:40:41 +0000 (14:40 +0100)
committerPaul Bauer <paul.bauer.q@gmail.com>
Tue, 29 Oct 2019 13:40:41 +0000 (14:40 +0100)
1  2 
src/gromacs/mdrun/md.cpp

index 9e1d12484992f649f978ec8d4bb317fa0695e2d9,fef7f4850a6af7824b983b2e0cbd804e4e6dbdc6..1002a58373489853039304a4ebd25adc0474d582
@@@ -1414,16 -1415,17 +1419,23 @@@ void gmx::LegacySimulator::do_md(
          {
              // Organize to do inter-simulation signalling on steps if
              // and when algorithms require it.
-             bool doInterSimSignal = (simulationsShareState && do_per_step(step, nstSignalComm));
+             const bool doInterSimSignal = (simulationsShareState && do_per_step(step, nstSignalComm));
+             // With leap-frog we also need to compute the half-step
+             // kinetic energy at the step before we need to write
+             // the full-step kinetic energy
+             const bool needEkinAtNextStep =
+                 (!EI_VV(ir->eI) && (do_per_step(step + 1, nstglobalcomm) ||
+                                     step_rel + 1 == ir->nsteps));
  
-             if (bGStat || needHalfStepKineticEnergy || doInterSimSignal)
+             if (bGStat || needEkinAtNextStep || doInterSimSignal)
              {
 +                // Copy coordinates when needed to stop the CM motion.
 +                if (useGpuForUpdate && !EI_VV(ir->eI) && bStopCM)
 +                {
 +                    stateGpu->copyCoordinatesFromGpu(state->x, AtomLocality::Local);
 +                    stateGpu->waitCoordinatesReadyOnHost(AtomLocality::Local);
 +                }
                  // Since we're already communicating at this step, we
                  // can propagate intra-simulation signals. Note that
                  // check_nstglobalcomm has the responsibility for