Merge branch release-2020 into master
[alexxy/gromacs.git] / src / gromacs / modularsimulator / modularsimulator.cpp
index 8036261e0e1149c7c1c22dc1b2e551ae34220051..dfedd40457b5635dda9c5837a46fd9cf3221d359 100644 (file)
@@ -47,6 +47,7 @@
 #include "gromacs/domdec/domdec.h"
 #include "gromacs/ewald/pme.h"
 #include "gromacs/ewald/pme_load_balancing.h"
+#include "gromacs/ewald/pme_pp.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/vec.h"
@@ -64,7 +65,9 @@
 #include "gromacs/mdrunutility/printtime.h"
 #include "gromacs/mdtypes/commrec.h"
 #include "gromacs/mdtypes/fcdata.h"
+#include "gromacs/mdtypes/forcerec.h"
 #include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
 #include "gromacs/mdtypes/mdrunoptions.h"
 #include "gromacs/mdtypes/observableshistory.h"
 #include "gromacs/mdtypes/state.h"
@@ -663,30 +666,18 @@ std::unique_ptr<ISimulatorElement> ModularSimulator::buildIntegrator(
     }
     else if (inputrec->eI == eiVV)
     {
-        auto computeGlobalsElementAtFullTimeStep =
-                std::make_unique<ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerletAtFullTimeStep>>(
-                        statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElementPtr,
-                        &signals_, nstglobalcomm_, fplog, mdlog, cr, inputrec, mdAtoms, nrnb,
-                        wcycle, fr, &topologyHolder_->globalTopology(), constr, hasReadEkinState);
-        topologyHolder_->registerClient(computeGlobalsElementAtFullTimeStep.get());
-        energySignallerBuilder->registerSignallerClient(
-                compat::make_not_null(computeGlobalsElementAtFullTimeStep.get()));
-        trajectoryElementBuilder->registerSignallerClient(
-                compat::make_not_null(computeGlobalsElementAtFullTimeStep.get()));
-
-        auto computeGlobalsElementAfterCoordinateUpdate =
-                std::make_unique<ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerletAfterCoordinateUpdate>>(
+        auto computeGlobalsElement =
+                std::make_unique<ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerlet>>(
                         statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElementPtr,
                         &signals_, nstglobalcomm_, fplog, mdlog, cr, inputrec, mdAtoms, nrnb,
                         wcycle, fr, &topologyHolder_->globalTopology(), constr, hasReadEkinState);
-        topologyHolder_->registerClient(computeGlobalsElementAfterCoordinateUpdate.get());
-        energySignallerBuilder->registerSignallerClient(
-                compat::make_not_null(computeGlobalsElementAfterCoordinateUpdate.get()));
+        topologyHolder_->registerClient(computeGlobalsElement.get());
+        energySignallerBuilder->registerSignallerClient(compat::make_not_null(computeGlobalsElement.get()));
         trajectoryElementBuilder->registerSignallerClient(
-                compat::make_not_null(computeGlobalsElementAfterCoordinateUpdate.get()));
+                compat::make_not_null(computeGlobalsElement.get()));
 
         *checkBondedInteractionsCallback =
-                computeGlobalsElementAfterCoordinateUpdate->getCheckNumberOfBondedInteractionsCallback();
+                computeGlobalsElement->getCheckNumberOfBondedInteractionsCallback();
 
         auto propagatorVelocities = std::make_unique<Propagator<IntegrationStep::VelocitiesOnly>>(
                 inputrec->delta_t * 0.5, statePropagatorDataPtr, mdAtoms, wcycle);
@@ -723,8 +714,7 @@ std::unique_ptr<ISimulatorElement> ModularSimulator::buildIntegrator(
 
             addToCallListAndMove(std::move(constraintElement), elementCallList, elementsOwnershipList);
         }
-        addToCallListAndMove(std::move(computeGlobalsElementAtFullTimeStep), elementCallList,
-                             elementsOwnershipList);
+        addToCallList(compat::make_not_null(computeGlobalsElement.get()), elementCallList);
         addToCallList(statePropagatorDataPtr, elementCallList); // we have a full microstate at time t here!
         if (inputrec->etc == etcVRESCALE)
         {
@@ -757,8 +747,7 @@ std::unique_ptr<ISimulatorElement> ModularSimulator::buildIntegrator(
 
             addToCallListAndMove(std::move(constraintElement), elementCallList, elementsOwnershipList);
         }
-        addToCallListAndMove(std::move(computeGlobalsElementAfterCoordinateUpdate), elementCallList,
-                             elementsOwnershipList);
+        addToCallListAndMove(std::move(computeGlobalsElement), elementCallList, elementsOwnershipList);
         addToCallList(energyElementPtr, elementCallList); // we have the energies at time t here!
         if (prBarostat)
         {