Merge commit d30f2cb6 from release-2020 into master
[alexxy/gromacs.git] / src / gromacs / modularsimulator / modularsimulator.cpp
index 72c6dfa76b8cf546f2ab6e7ad99e8f9c12d8dd78..b116f29b2cfc8029a035dd396ea493017ec4fa03 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -355,6 +355,9 @@ void ModularSimulator::constructElementsAndSignallers()
     /*
      * Build data structures
      */
+    topologyHolder_ =
+            std::make_unique<TopologyHolder>(*top_global, cr, inputrec, fr, mdAtoms, constr, vsite);
+
     std::unique_ptr<FreeEnergyPerturbationElement> freeEnergyPerturbationElement    = nullptr;
     FreeEnergyPerturbationElement*                 freeEnergyPerturbationElementPtr = nullptr;
     if (inputrec->efep != efepNO)
@@ -367,7 +370,8 @@ void ModularSimulator::constructElementsAndSignallers()
     auto statePropagatorData = std::make_unique<StatePropagatorData>(
             top_global->natoms, fplog, cr, state_global, inputrec->nstxout, inputrec->nstvout,
             inputrec->nstfout, inputrec->nstxout_compressed, fr->nbv->useGpu(),
-            freeEnergyPerturbationElementPtr, inputrec, mdAtoms->mdatoms());
+            freeEnergyPerturbationElementPtr, topologyHolder_.get(), fr->bMolPBC,
+            mdrunOptions.writeConfout, opt2fn("-c", nfile, fnm), inputrec, mdAtoms->mdatoms());
     auto statePropagatorDataPtr = compat::make_not_null(statePropagatorData.get());
 
     auto energyElement = std::make_unique<EnergyElement>(
@@ -376,9 +380,6 @@ void ModularSimulator::constructElementsAndSignallers()
             startingBehavior);
     auto energyElementPtr = compat::make_not_null(energyElement.get());
 
-    topologyHolder_ =
-            std::make_unique<TopologyHolder>(*top_global, cr, inputrec, fr, mdAtoms, constr, vsite);
-
     /*
      * Build stop handler
      */
@@ -403,6 +404,7 @@ void ModularSimulator::constructElementsAndSignallers()
      */
     trajectoryElementBuilder.registerWriterClient(statePropagatorDataPtr);
     trajectoryElementBuilder.registerSignallerClient(statePropagatorDataPtr);
+    lastStepSignallerBuilder.registerSignallerClient(statePropagatorDataPtr);
 
     trajectoryElementBuilder.registerWriterClient(energyElementPtr);
     trajectoryElementBuilder.registerSignallerClient(energyElementPtr);