Move pull work struct out of inputrec
authorMark Abraham <mark.j.abraham@gmail.com>
Sun, 14 Apr 2019 19:45:53 +0000 (21:45 +0200)
committerBerk Hess <hess@kth.se>
Thu, 18 Apr 2019 09:23:09 +0000 (11:23 +0200)
Its lifetime is now managed by runner. This will make high-level
organization more comprehensible, and permit more meaningful
const-correctness of t_inputrec.

Change-Id: I66bf765ad7235d84184227325eb52afd58146b72

24 files changed:
src/gromacs/domdec/partition.cpp
src/gromacs/domdec/partition.h
src/gromacs/mdlib/constr.cpp
src/gromacs/mdlib/constr.h
src/gromacs/mdlib/energyoutput.cpp
src/gromacs/mdlib/energyoutput.h
src/gromacs/mdlib/force.h
src/gromacs/mdlib/makeconstraints.h
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdlib/tests/energyoutput.cpp
src/gromacs/mdrun/integrator.h
src/gromacs/mdrun/md.cpp
src/gromacs/mdrun/mimic.cpp
src/gromacs/mdrun/minimize.cpp
src/gromacs/mdrun/rerun.cpp
src/gromacs/mdrun/runner.cpp
src/gromacs/mdrun/shellfc.cpp
src/gromacs/mdrun/shellfc.h
src/gromacs/mdrun/tpi.cpp
src/gromacs/mdtypes/inputrec.h
src/gromacs/pulling/pull.cpp
src/gromacs/pulling/pull.h
src/gromacs/pulling/pull_internal.h
src/gromacs/pulling/pullutil.cpp

index 6c38a422361874f32e808d4c83cb31023a6e4dc6..27ffb535ab9c8d6c5252acaa60ee679e955e1160 100644 (file)
@@ -2856,6 +2856,7 @@ void dd_partition_system(FILE                    *fplog,
                          const gmx_mtop_t        &top_global,
                          const t_inputrec        *ir,
                          gmx::ImdSession         *imdSession,
+                         pull_t                  *pull_work,
                          t_state                 *state_local,
                          PaddedVector<gmx::RVec> *f,
                          gmx::MDAtoms            *mdAtoms,
@@ -3431,7 +3432,7 @@ void dd_partition_system(FILE                    *fplog,
     if (ir->bPull)
     {
         /* Update the local pull groups */
-        dd_make_local_pull_groups(cr, ir->pull_work);
+        dd_make_local_pull_groups(cr, pull_work);
     }
 
     if (dd->atomSets != nullptr)
index cb006f1d12cb72bb1c6dc63269c1d0d5f9b55ba6..9f271cbcf04f5499b5506c95fb031416d5d79c6a 100644 (file)
@@ -56,6 +56,7 @@ struct gmx_localtop_t;
 struct gmx_mtop_t;
 struct gmx_vsite_t;
 struct gmx_wallcycle;
+struct pull_t;
 struct t_commrec;
 struct t_forcerec;
 struct t_inputrec;
@@ -97,6 +98,7 @@ void dd_partition_system(FILE                    *fplog,
                          const gmx_mtop_t        &top_global,
                          const t_inputrec        *ir,
                          gmx::ImdSession         *imdSession,
+                         pull_t                  *pull_work,
                          t_state                 *state_local,
                          PaddedVector<gmx::RVec> *f,
                          gmx::MDAtoms            *mdatoms,
index a56a3ff6de8979fee002799e384ffd9aa9267cca..496a4c827e4048b1faea3d36f3c5fe7a7b677311 100644 (file)
@@ -101,6 +101,7 @@ class Constraints::Impl
     public:
         Impl(const gmx_mtop_t     &mtop_p,
              const t_inputrec     &ir_p,
+             pull_t               *pull_work,
              FILE                 *log_p,
              const t_mdatoms      &md_p,
              const t_commrec      *cr_p,
@@ -172,6 +173,8 @@ class Constraints::Impl
         const t_commrec      *cr = nullptr;
         //! Multi-sim support.
         const gmx_multisim_t *ms = nullptr;
+        //! Pulling code object, if any.
+        pull_t               *pull_work = nullptr;
         /*!\brief Input options.
          *
          * \todo Replace with IMdpOptions */
@@ -675,7 +678,7 @@ Constraints::Impl::apply(bool                  bLog,
 
     if (econq == ConstraintVariable::Positions)
     {
-        if (ir.bPull && pull_have_constraint(ir.pull_work))
+        if (ir.bPull && pull_have_constraint(pull_work))
         {
             if (EI_DYNAMICS(ir.eI))
             {
@@ -686,7 +689,7 @@ Constraints::Impl::apply(bool                  bLog,
                 t = ir.init_t;
             }
             set_pbc(&pbc, ir.ePBC, box);
-            pull_constraint(ir.pull_work, &md, &pbc, cr, ir.delta_t, t, x, xprime, v, *vir);
+            pull_constraint(pull_work, &md, &pbc, cr, ir.delta_t, t, x, xprime, v, *vir);
         }
         if (ed && delta_step > 0)
         {
@@ -972,6 +975,7 @@ makeAtomToConstraintMappings(const gmx_mtop_t            &mtop,
 
 Constraints::Constraints(const gmx_mtop_t     &mtop,
                          const t_inputrec     &ir,
+                         pull_t               *pull_work,
                          FILE                 *log,
                          const t_mdatoms      &md,
                          const t_commrec      *cr,
@@ -983,6 +987,7 @@ Constraints::Constraints(const gmx_mtop_t     &mtop,
                          int                   numSettles)
     : impl_(new Impl(mtop,
                      ir,
+                     pull_work,
                      log,
                      md,
                      cr,
@@ -997,6 +1002,7 @@ Constraints::Constraints(const gmx_mtop_t     &mtop,
 
 Constraints::Impl::Impl(const gmx_mtop_t     &mtop_p,
                         const t_inputrec     &ir_p,
+                        pull_t               *pull_work,
                         FILE                 *log_p,
                         const t_mdatoms      &md_p,
                         const t_commrec      *cr_p,
@@ -1013,6 +1019,7 @@ Constraints::Impl::Impl(const gmx_mtop_t     &mtop_p,
       log(log_p),
       cr(cr_p),
       ms(ms_p),
+      pull_work(pull_work),
       ir(ir_p),
       nrnb(nrnb_p),
       wcycle(wcycle_p)
index e0104e73b56b6ba5adc527d2db3671cb8fbbe9cb..dac41fe3a564d8f0520c692375f41b17ddb69089 100644 (file)
@@ -62,6 +62,7 @@ struct gmx_moltype_t;
 struct gmx_mtop_t;
 struct gmx_multisim_t;
 struct gmx_wallcycle;
+struct pull_t;
 struct t_blocka;
 struct t_commrec;
 struct t_ilist;
@@ -100,6 +101,7 @@ class Constraints
          * function. */
         Constraints(const gmx_mtop_t     &mtop,
                     const t_inputrec     &ir,
+                    pull_t               *pull_work,
                     FILE                 *log,
                     const t_mdatoms      &md,
                     const t_commrec      *cr,
index bee8e0cfba5511c67d7f6b770ac9bfb196f645ad..c350c8b9c9019dce2cd6a755cd2f05184d483f35 100644 (file)
@@ -161,6 +161,7 @@ namespace
 t_mdebin *init_mdebin(ener_file_t       fp_ene,
                       const gmx_mtop_t *mtop,
                       const t_inputrec *ir,
+                      const pull_t     *pull_work,
                       FILE             *fp_dhdl,
                       bool              isRerun)
 {
@@ -334,7 +335,7 @@ t_mdebin *init_mdebin(ener_file_t       fp_ene,
         }
         else if (i == F_COM_PULL)
         {
-            md->bEner[i] = ((ir->bPull && pull_have_potential(ir->pull_work)) ||
+            md->bEner[i] = ((ir->bPull && pull_have_potential(pull_work)) ||
                             ir->bRot);
         }
         else if (i == F_ECONSERVED)
@@ -1669,10 +1670,11 @@ EnergyOutput::EnergyOutput()
 void EnergyOutput::prepare(ener_file        *fp_ene,
                            const gmx_mtop_t *mtop,
                            const t_inputrec *ir,
+                           const pull_t     *pull_work,
                            FILE             *fp_dhdl,
                            bool              isRerun)
 {
-    mdebin = init_mdebin(fp_ene, mtop, ir, fp_dhdl, isRerun);
+    mdebin = init_mdebin(fp_ene, mtop, ir, pull_work, fp_dhdl, isRerun);
 }
 
 EnergyOutput::~EnergyOutput()
index 98f743bedee84d3e76599100fddb9929b698a93b..4698aaa81bd08e36b3ed3f783cd46cc0883dbcfd 100644 (file)
@@ -46,6 +46,7 @@ struct gmx_enerdata_t;
 struct SimulationGroups;
 struct gmx_mtop_t;
 struct gmx_output_env_t;
+struct pull_t;
 struct t_ebin;
 struct t_expanded;
 struct t_fcdata;
@@ -104,6 +105,7 @@ class EnergyOutput
         void prepare(ener_file        *fp_ene,
                      const gmx_mtop_t *mtop,
                      const t_inputrec *ir,
+                     const pull_t     *pull_work,
                      FILE             *fp_dhdl,
                      bool              isRerun = false);
         ~EnergyOutput();
index f60b5b4f4eda72d22e4438ab47f0cf7d201a91dd..f4fb9c5c0d8b6bdb2ac8189917ca43d1e6492b59 100644 (file)
@@ -51,6 +51,7 @@ struct gmx_multisim_t;
 struct gmx_vsite_t;
 struct gmx_wallcycle;
 class history_t;
+struct pull_t;
 struct t_blocka;
 struct t_commrec;
 struct t_fcdata;
@@ -78,6 +79,7 @@ void do_force(FILE                                     *log,
               gmx::Awh                                 *awh,
               gmx_enfrot                               *enforcedRotation,
               gmx::ImdSession                          *imdSession,
+              pull_t                                   *pull_work,
               int64_t                                   step,
               t_nrnb                                   *nrnb,
               gmx_wallcycle                            *wcycle,
index 91fd83b57a96d8f01e21194641362e6276a294d5..baf42420cb27078d14417d3573bf6651e6b34365 100644 (file)
@@ -96,15 +96,16 @@ struct Constraints::CreationHelper : public Constraints
 template<typename ... Args>
 std::unique_ptr<Constraints> makeConstraints(const gmx_mtop_t &mtop,
                                              const t_inputrec &ir,
+                                             pull_t           *pull_work,
                                              bool              doEssentialDynamics,
                                              Args && ...       args)
 {
     int numConstraints = (gmx_mtop_ftype_count(mtop, F_CONSTR) +
                           gmx_mtop_ftype_count(mtop, F_CONSTRNC));
     int numSettles = gmx_mtop_ftype_count(mtop, F_SETTLE);
-    GMX_RELEASE_ASSERT(!ir.bPull || ir.pull_work != nullptr,
+    GMX_RELEASE_ASSERT(!ir.bPull || pull_work != nullptr,
                        "When COM pulling is active, it must be initialized before constraints are initialized");
-    bool doPullingWithConstraints = ir.bPull && pull_have_constraint(ir.pull_work);
+    bool doPullingWithConstraints = ir.bPull && pull_have_constraint(pull_work);
     if (numConstraints + numSettles == 0 &&
         !doPullingWithConstraints && !doEssentialDynamics)
     {
@@ -112,7 +113,7 @@ std::unique_ptr<Constraints> makeConstraints(const gmx_mtop_t &mtop,
         return nullptr;
     }
     return std::make_unique<Constraints::CreationHelper>
-               (mtop, ir, std::forward<Args>(args) ..., numConstraints, numSettles);
+               (mtop, ir, pull_work, std::forward<Args>(args) ..., numConstraints, numSettles);
 }
 
 }  // namespace gmx
index e10719e51b6f6158d9bb214b8215974e849560b2..3a827652d996af9d2b8d45fd207a8ecbbebba5c2 100644 (file)
@@ -159,6 +159,7 @@ static void pull_potential_wrapper(const t_commrec *cr,
                                    gmx::ForceWithVirial *force,
                                    const t_mdatoms *mdatoms,
                                    gmx_enerdata_t *enerd,
+                                   pull_t *pull_work,
                                    const real *lambda,
                                    double t,
                                    gmx_wallcycle_t wcycle)
@@ -173,7 +174,7 @@ static void pull_potential_wrapper(const t_commrec *cr,
     set_pbc(&pbc, ir->ePBC, box);
     dvdl                     = 0;
     enerd->term[F_COM_PULL] +=
-        pull_potential(ir->pull_work, mdatoms, &pbc,
+        pull_potential(pull_work, mdatoms, &pbc,
                        cr, t, lambda[efptRESTRAINT], as_rvec_array(x.data()), force, &dvdl);
     enerd->dvdl_lin[efptRESTRAINT] += dvdl;
     wallcycle_stop(wcycle, ewcPULLPOT);
@@ -468,6 +469,7 @@ static void checkPotentialEnergyValidity(int64_t               step,
 static bool
 haveSpecialForces(const t_inputrec              *inputrec,
                   ForceProviders                *forceProviders,
+                  const pull_t                  *pull_work,
                   int                            forceFlags,
                   const gmx_edsam               *ed)
 {
@@ -475,7 +477,7 @@ haveSpecialForces(const t_inputrec              *inputrec,
 
     return
         ((computeForces && forceProviders->hasForceProvider()) ||         // forceProviders
-         (inputrec->bPull && pull_have_potential(inputrec->pull_work)) || // pull
+         (inputrec->bPull && pull_have_potential(pull_work)) ||           // pull
          inputrec->bRot ||                                                // enforced rotation
          (ed != nullptr) ||                                               // flooding
          (inputrec->bIMD && computeForces));                              // IMD
@@ -497,6 +499,7 @@ haveSpecialForces(const t_inputrec              *inputrec,
  * \param[in]     awh              The Awh module (nullptr if none in use).
  * \param[in]     enforcedRotation Enforced rotation module.
  * \param[in]     imdSession       The IMD session
+ * \param[in]     pull_work        The pull work structure.
  * \param[in]     step             The current MD step
  * \param[in]     t                The current time
  * \param[in,out] wcycle           Wallcycle accounting struct
@@ -521,6 +524,7 @@ computeSpecialForces(FILE                          *fplog,
                      gmx::Awh                      *awh,
                      gmx_enfrot                    *enforcedRotation,
                      gmx::ImdSession               *imdSession,
+                     pull_t                        *pull_work,
                      int64_t                        step,
                      double                         t,
                      gmx_wallcycle_t                wcycle,
@@ -549,11 +553,11 @@ computeSpecialForces(FILE                          *fplog,
         forceProviders->calculateForces(forceProviderInput, &forceProviderOutput);
     }
 
-    if (inputrec->bPull && pull_have_potential(inputrec->pull_work))
+    if (inputrec->bPull && pull_have_potential(pull_work))
     {
         pull_potential_wrapper(cr, inputrec, box, x,
                                forceWithVirial,
-                               mdatoms, enerd, lambda, t,
+                               mdatoms, enerd, pull_work, lambda, t,
                                wcycle);
 
         if (awh)
@@ -715,6 +719,7 @@ struct ForceOutputs
 /*! \brief Set up the different force buffers; also does clearing.
  *
  * \param[in] fr        force record pointer
+ * \param[in] pull_work The pull work object.
  * \param[in] inputrec  input record
  * \param[in] force     force array
  * \param[in] bDoForces True if force are computed this step
@@ -725,6 +730,7 @@ struct ForceOutputs
  */
 static ForceOutputs
 setupForceOutputs(const t_forcerec                    *fr,
+                  pull_t                              *pull_work,
                   const t_inputrec                    &inputrec,
                   gmx::ArrayRefWithPadding<gmx::RVec>  force,
                   const bool                           bDoForces,
@@ -764,9 +770,9 @@ setupForceOutputs(const t_forcerec                    *fr,
         clear_rvecs_omp(forceWithVirial.force_.size(), as_rvec_array(forceWithVirial.force_.data()));
     }
 
-    if (inputrec.bPull && pull_have_constraint(inputrec.pull_work))
+    if (inputrec.bPull && pull_have_constraint(pull_work))
     {
-        clear_pull_forces(inputrec.pull_work);
+        clear_pull_forces(pull_work);
     }
 
     wallcycle_sub_stop(wcycle, ewcsCLEAR_FORCE_BUFFER);
@@ -787,13 +793,14 @@ static void
 setupForceWorkload(gmx::PpForceWorkload *forceWork,
                    const t_inputrec     *inputrec,
                    const t_forcerec     *fr,
+                   const pull_t         *pull_work,
                    const gmx_edsam      *ed,
                    const t_idef         &idef,
                    const t_fcdata       *fcd,
                    const int             forceFlags
                    )
 {
-    forceWork->haveSpecialForces      = haveSpecialForces(inputrec, fr->forceProviders, forceFlags, ed);
+    forceWork->haveSpecialForces      = haveSpecialForces(inputrec, fr->forceProviders, pull_work, forceFlags, ed);
     forceWork->haveCpuBondedWork      = haveCpuBondeds(*fr);
     forceWork->haveGpuBondedWork      = ((fr->gpuBonded != nullptr) && fr->gpuBonded->haveInteractions());
     forceWork->haveRestraintsWork     = havePositionRestraints(idef, *fcd);
@@ -807,6 +814,7 @@ void do_force(FILE                                     *fplog,
               gmx::Awh                                 *awh,
               gmx_enfrot                               *enforcedRotation,
               gmx::ImdSession                          *imdSession,
+              pull_t                                   *pull_work,
               int64_t                                   step,
               t_nrnb                                   *nrnb,
               gmx_wallcycle_t                           wcycle,
@@ -1009,6 +1017,7 @@ void do_force(FILE                                     *fplog,
         setupForceWorkload(ppForceWorkload,
                            inputrec,
                            fr,
+                           pull_work,
                            ed,
                            top->idef,
                            fcd,
@@ -1199,7 +1208,8 @@ void do_force(FILE                                     *fplog,
     wallcycle_start(wcycle, ewcFORCE);
 
     // set up and clear force outputs
-    struct ForceOutputs forceOut = setupForceOutputs(fr, *inputrec, force, bDoForces, ((flags & GMX_FORCE_VIRIAL) != 0), wcycle);
+    struct ForceOutputs forceOut = setupForceOutputs(fr, pull_work, *inputrec, force, bDoForces,
+                                                     ((flags & GMX_FORCE_VIRIAL) != 0), wcycle);
 
     /* We calculate the non-bonded forces, when done on the CPU, here.
      * We do this before calling do_force_lowlevel, because in that
@@ -1281,7 +1291,7 @@ void do_force(FILE                                     *fplog,
     wallcycle_stop(wcycle, ewcFORCE);
 
     computeSpecialForces(fplog, cr, inputrec, awh, enforcedRotation,
-                         imdSession, step, t, wcycle,
+                         imdSession, pull_work, step, t, wcycle,
                          fr->forceProviders, box, x.unpaddedArrayRef(), mdatoms, lambda.data(),
                          flags, &forceOut.forceWithVirial, enerd,
                          ed, bNS);
index 3ccf7ea9eb40e45bc4ee4cef8bbab59790217048..e28730e385975a00acd54f8913e2d0339e58e4d9 100644 (file)
@@ -98,8 +98,8 @@ class EnergyOutputTest : public ::testing::Test
             log_(std::fopen(logFilename_.c_str(), "w")), logFileGuard_(log_),
             checker_(refData_.rootChecker())
         {
-            energyOutput_.prepare(nullptr, &mtop_, &inputrec_, nullptr, false);
-            constraints_ = makeConstraints(mtop_, inputrec_, false, log_, mdatoms_, nullptr,
+            energyOutput_.prepare(nullptr, &mtop_, &inputrec_, nullptr, nullptr, false);
+            constraints_ = makeConstraints(mtop_, inputrec_, nullptr, false, log_, mdatoms_, nullptr,
                                            nullptr, nullptr, nullptr, false);
         }
         //! Helper function to generate synthetic data to output
index 46b24636f5f5c031b50f68379f559c6199c66b37..5a85e9efa4fbff6d2d902447e9d3f41305fcef1d 100644 (file)
@@ -60,6 +60,7 @@ struct gmx_vsite_t;
 struct gmx_wallcycle;
 struct gmx_walltime_accounting;
 struct ObservablesHistory;
+struct pull_t;
 struct ReplicaExchangeParameters;
 struct t_commrec;
 struct t_fcdata;
@@ -143,6 +144,8 @@ struct Integrator
     t_inputrec                         *inputrec;
     //! The Interactive Molecular Dynamics session.
     ImdSession                         *imdSession;
+    //! The pull work object.
+    pull_t                             *pull_work;
     //! The coordinate-swapping session.
     t_swap                             *swap;
     //! Full system topology.
index 3684a9cdddfe3188d8d32049bfd6a82cfe939cc3..884129a30fa824dde40cfea1fa575767437720d1 100644 (file)
@@ -252,7 +252,7 @@ void gmx::Integrator::do_md()
     init_nrnb(nrnb);
     gmx_mdoutf       *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, ir, top_global, oenv, wcycle);
     gmx::EnergyOutput energyOutput;
-    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, mdoutf_get_fp_dhdl(outf));
+    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, pull_work, mdoutf_get_fp_dhdl(outf));
 
     /* Kinetic energy data */
     std::unique_ptr<gmx_ekindata_t> eKinData = std::make_unique<gmx_ekindata_t>();
@@ -293,6 +293,7 @@ void gmx::Integrator::do_md()
         /* Distribute the charge groups over the nodes from the master node */
         dd_partition_system(fplog, mdlog, ir->init_step, cr, TRUE, 1,
                             state_global, *top_global, ir, imdSession,
+                            pull_work,
                             state, &f, mdAtoms, &top, fr,
                             vsite, constr,
                             nrnb, nullptr, FALSE);
@@ -377,12 +378,12 @@ void gmx::Integrator::do_md()
         energyOutput.fillEnergyHistory(observablesHistory->energyHistory.get());
     }
 
-    preparePrevStepPullCom(ir, mdatoms, state, state_global, cr, startingFromCheckpoint);
+    preparePrevStepPullCom(ir, pull_work, mdatoms, state, state_global, cr, startingFromCheckpoint);
 
     // TODO: Remove this by converting AWH into a ForceProvider
     auto awh = prepareAwhModule(fplog, *ir, state_global, cr, ms, startingFromCheckpoint,
                                 shellfc != nullptr,
-                                opt2fn("-awh", nfile, fnm), ir->pull_work);
+                                opt2fn("-awh", nfile, fnm), pull_work);
 
     const bool useReplicaExchange = (replExParams.exchangeInterval > 0);
     if (useReplicaExchange && MASTER(cr))
@@ -754,6 +755,7 @@ void gmx::Integrator::do_md()
                 dd_partition_system(fplog, mdlog, step, cr,
                                     bMasterState, nstglobalcomm,
                                     state_global, *top_global, ir, imdSession,
+                                    pull_work,
                                     state, &f, mdAtoms, &top, fr,
                                     vsite, constr,
                                     nrnb, wcycle,
@@ -835,7 +837,7 @@ void gmx::Integrator::do_md()
             /* Now is the time to relax the shells */
             relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose,
                                 enforcedRotation, step,
-                                ir, imdSession, bNS, force_flags, &top,
+                                ir, imdSession, pull_work, bNS, force_flags, &top,
                                 constr, enerd, fcd,
                                 state, f.arrayRefWithPadding(), force_vir, mdatoms,
                                 nrnb, wcycle, graph,
@@ -864,6 +866,7 @@ void gmx::Integrator::do_md()
              * Check comments in sim_util.c
              */
             do_force(fplog, cr, ms, ir, awh.get(), enforcedRotation, imdSession,
+                     pull_work,
                      step, nrnb, wcycle, &top,
                      state->box, state->x.arrayRefWithPadding(), &state->hist,
                      f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
@@ -1156,7 +1159,7 @@ void gmx::Integrator::do_md()
 
         if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
         {
-            updatePrevStepPullCom(ir->pull_work, state);
+            updatePrevStepPullCom(pull_work, state);
         }
 
         if (ir->eI == eiVVAK)
@@ -1357,7 +1360,7 @@ void gmx::Integrator::do_md()
 
             if (ir->bPull)
             {
-                pull_print_output(ir->pull_work, step, t);
+                pull_print_output(pull_work, step, t);
             }
 
             if (do_per_step(step, ir->nstlog))
@@ -1418,6 +1421,7 @@ void gmx::Integrator::do_md()
         {
             dd_partition_system(fplog, mdlog, step, cr, TRUE, 1,
                                 state_global, *top_global, ir, imdSession,
+                                pull_work,
                                 state, &f, mdAtoms, &top, fr,
                                 vsite, constr,
                                 nrnb, wcycle, FALSE);
index 1bd9576dc8ebe383fb3bd5606ab236015d2659dd..050fe9177734736b1321c600580c07305022e468 100644 (file)
@@ -227,7 +227,7 @@ void gmx::Integrator::do_mimic()
 
     gmx_mdoutf       *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, ir, top_global, oenv, wcycle);
     gmx::EnergyOutput energyOutput;
-    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, mdoutf_get_fp_dhdl(outf), true);
+    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, pull_work, mdoutf_get_fp_dhdl(outf), true);
 
     /* Kinetic energy data */
     std::unique_ptr<gmx_ekindata_t> eKinData = std::make_unique<gmx_ekindata_t>();
@@ -268,6 +268,7 @@ void gmx::Integrator::do_mimic()
         /* Distribute the charge groups over the nodes from the master node */
         dd_partition_system(fplog, mdlog, ir->init_step, cr, TRUE, 1,
                             state_global, *top_global, ir, imdSession,
+                            pull_work,
                             state, &f, mdAtoms, &top, fr,
                             vsite, constr,
                             nrnb, nullptr, FALSE);
@@ -399,6 +400,7 @@ void gmx::Integrator::do_mimic()
             dd_partition_system(fplog, mdlog, step, cr,
                                 bMasterState, nstglobalcomm,
                                 state_global, *top_global, ir, imdSession,
+                                pull_work,
                                 state, &f, mdAtoms, &top, fr,
                                 vsite, constr,
                                 nrnb, wcycle,
@@ -428,7 +430,7 @@ void gmx::Integrator::do_mimic()
             /* Now is the time to relax the shells */
             relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose,
                                 enforcedRotation, step,
-                                ir, imdSession, bNS, force_flags, &top,
+                                ir, imdSession, pull_work, bNS, force_flags, &top,
                                 constr, enerd, fcd,
                                 state, f.arrayRefWithPadding(), force_vir, mdatoms,
                                 nrnb, wcycle, graph,
@@ -446,6 +448,7 @@ void gmx::Integrator::do_mimic()
             Awh       *awh = nullptr;
             gmx_edsam *ed  = nullptr;
             do_force(fplog, cr, ms, ir, awh, enforcedRotation, imdSession,
+                     pull_work,
                      step, nrnb, wcycle, &top,
                      state->box, state->x.arrayRefWithPadding(), &state->hist,
                      f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
index f6b276db0d8ebb30581e0c1a2809011e066e89ec..d80e5cba93cc972e39ea297e40e1f51f17a57543 100644 (file)
@@ -354,6 +354,7 @@ static void init_em(FILE *fplog,
                     const t_commrec *cr,
                     t_inputrec *ir,
                     gmx::ImdSession *imdSession,
+                    pull_t *pull_work,
                     t_state *state_global, gmx_mtop_t *top_global,
                     em_state_t *ems, gmx_localtop_t *top,
                     t_nrnb *nrnb,
@@ -409,7 +410,7 @@ static void init_em(FILE *fplog,
 
         /* Distribute the charge groups over the nodes from the master node */
         dd_partition_system(fplog, mdlog, ir->init_step, cr, TRUE, 1,
-                            state_global, *top_global, ir, imdSession,
+                            state_global, *top_global, ir, imdSession, pull_work,
                             &ems->s, &ems->f, mdAtoms, top,
                             fr, vsite, constr,
                             nrnb, nullptr, FALSE);
@@ -709,6 +710,7 @@ static void em_dd_partition_system(FILE *fplog,
                                    int step, const t_commrec *cr,
                                    gmx_mtop_t *top_global, t_inputrec *ir,
                                    gmx::ImdSession *imdSession,
+                                   pull_t *pull_work,
                                    em_state_t *ems, gmx_localtop_t *top,
                                    gmx::MDAtoms *mdAtoms, t_forcerec *fr,
                                    gmx_vsite_t *vsite, gmx::Constraints *constr,
@@ -716,7 +718,7 @@ static void em_dd_partition_system(FILE *fplog,
 {
     /* Repartition the domain decomposition */
     dd_partition_system(fplog, mdlog, step, cr, FALSE, 1,
-                        nullptr, *top_global, ir, imdSession,
+                        nullptr, *top_global, ir, imdSession, pull_work,
                         &ems->s, &ems->f,
                         mdAtoms, top, fr, vsite, constr,
                         nrnb, wcycle, FALSE);
@@ -771,6 +773,8 @@ class EnergyEvaluator
         t_inputrec           *inputrec;
         //! The Interactive Molecular Dynamics session.
         gmx::ImdSession      *imdSession;
+        //! The pull work object.
+        pull_t               *pull_work;
         //! Manages flop accounting.
         t_nrnb               *nrnb;
         //! Manages wall cycle accounting.
@@ -835,6 +839,7 @@ EnergyEvaluator::run(em_state_t *ems, rvec mu_tot,
     {
         /* Repartition the domain decomposition */
         em_dd_partition_system(fplog, mdlog, count, cr, top_global, inputrec, imdSession,
+                               pull_work,
                                ems, top, mdAtoms, fr, vsite, constr,
                                nrnb, wcycle);
     }
@@ -844,6 +849,7 @@ EnergyEvaluator::run(em_state_t *ems, rvec mu_tot,
      * We do not unshift, so molecules are always whole in congrad.c
      */
     do_force(fplog, cr, ms, inputrec, nullptr, nullptr, imdSession,
+             pull_work,
              count, nrnb, wcycle, top,
              ems->s.box, ems->s.x.arrayRefWithPadding(), &ems->s.hist,
              ems->f.arrayRefWithPadding(), force_vir, mdAtoms->mdatoms(), enerd, fcd,
@@ -1099,12 +1105,13 @@ Integrator::do_cg()
 
     /* Init em and store the local state in s_min */
     init_em(fplog, mdlog, CG, cr, inputrec, imdSession,
+            pull_work,
             state_global, top_global, s_min, &top,
             nrnb, fr, &graph, mdAtoms, &gstat,
             vsite, constr, nullptr);
     gmx_mdoutf       *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, inputrec, top_global, nullptr, wcycle);
     gmx::EnergyOutput energyOutput;
-    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, nullptr);
+    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, pull_work, nullptr);
 
     /* Print to log file */
     print_em_start(fplog, cr, walltime_accounting, wcycle, CG);
@@ -1124,7 +1131,7 @@ Integrator::do_cg()
     EnergyEvaluator energyEvaluator {
         fplog, mdlog, cr, ms,
         top_global, &top,
-        inputrec, imdSession, nrnb, wcycle, gstat,
+        inputrec, imdSession, pull_work, nrnb, wcycle, gstat,
         vsite, constr, fcd, graph,
         mdAtoms, fr, ppForceWorkload, enerd
     };
@@ -1297,6 +1304,7 @@ Integrator::do_cg()
         if (DOMAINDECOMP(cr) && s_min->s.ddp_count < cr->dd->ddp_count)
         {
             em_dd_partition_system(fplog, mdlog, step, cr, top_global, inputrec, imdSession,
+                                   pull_work,
                                    s_min, &top, mdAtoms, fr, vsite, constr,
                                    nrnb, wcycle);
         }
@@ -1402,6 +1410,7 @@ Integrator::do_cg()
                 {
                     /* Reload the old state */
                     em_dd_partition_system(fplog, mdlog, -1, cr, top_global, inputrec, imdSession,
+                                           pull_work,
                                            s_min, &top, mdAtoms, fr, vsite, constr,
                                            nrnb, wcycle);
                 }
@@ -1735,12 +1744,13 @@ Integrator::do_lbfgs()
 
     /* Init em */
     init_em(fplog, mdlog, LBFGS, cr, inputrec, imdSession,
+            pull_work,
             state_global, top_global, &ems, &top,
             nrnb, fr, &graph, mdAtoms, &gstat,
             vsite, constr, nullptr);
     gmx_mdoutf       *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, inputrec, top_global, nullptr, wcycle);
     gmx::EnergyOutput energyOutput;
-    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, nullptr);
+    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, pull_work, nullptr);
 
     start = 0;
     end   = mdatoms->homenr;
@@ -1801,7 +1811,7 @@ Integrator::do_lbfgs()
     EnergyEvaluator energyEvaluator {
         fplog, mdlog, cr, ms,
         top_global, &top,
-        inputrec, imdSession, nrnb, wcycle, gstat,
+        inputrec, imdSession, pull_work, nrnb, wcycle, gstat,
         vsite, constr, fcd, graph,
         mdAtoms, fr, ppForceWorkload, enerd
     };
@@ -2428,12 +2438,13 @@ Integrator::do_steep()
 
     /* Init em and store the local state in s_try */
     init_em(fplog, mdlog, SD, cr, inputrec, imdSession,
+            pull_work,
             state_global, top_global, s_try, &top,
             nrnb, fr, &graph, mdAtoms, &gstat,
             vsite, constr, nullptr);
     gmx_mdoutf       *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, inputrec, top_global, nullptr, wcycle);
     gmx::EnergyOutput energyOutput;
-    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, nullptr);
+    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, pull_work, nullptr);
 
     /* Print to log file  */
     print_em_start(fplog, cr, walltime_accounting, wcycle, SD);
@@ -2459,7 +2470,7 @@ Integrator::do_steep()
     EnergyEvaluator energyEvaluator {
         fplog, mdlog, cr, ms,
         top_global, &top,
-        inputrec, imdSession, nrnb, wcycle, gstat,
+        inputrec, imdSession, pull_work, nrnb, wcycle, gstat,
         vsite, constr, fcd, graph,
         mdAtoms, fr, ppForceWorkload, enerd
     };
@@ -2576,6 +2587,7 @@ Integrator::do_steep()
             {
                 /* Reload the old state */
                 em_dd_partition_system(fplog, mdlog, count, cr, top_global, inputrec, imdSession,
+                                       pull_work,
                                        s_min, &top, mdAtoms, fr, vsite, constr,
                                        nrnb, wcycle);
             }
@@ -2678,6 +2690,7 @@ Integrator::do_nm()
 
     /* Init em and store the local state in state_minimum */
     init_em(fplog, mdlog, NM, cr, inputrec, imdSession,
+            pull_work,
             state_global, top_global, &state_work, &top,
             nrnb, fr, &graph, mdAtoms, &gstat,
             vsite, constr, &shellfc);
@@ -2758,7 +2771,7 @@ Integrator::do_nm()
     EnergyEvaluator energyEvaluator {
         fplog, mdlog, cr, ms,
         top_global, &top,
-        inputrec, imdSession, nrnb, wcycle, gstat,
+        inputrec, imdSession, pull_work, nrnb, wcycle, gstat,
         vsite, constr, fcd, graph,
         mdAtoms, fr, ppForceWorkload, enerd
     };
@@ -2826,6 +2839,7 @@ Integrator::do_nm()
                                         step,
                                         inputrec,
                                         imdSession,
+                                        pull_work,
                                         bNS,
                                         force_flags,
                                         &top,
index 4c2a59a8efbda0ee7b142f5fab1510b9ab40bd17..f04e70228b0fc7928926de6cf80440f496046ef3 100644 (file)
@@ -299,7 +299,7 @@ void gmx::Integrator::do_rerun()
     init_nrnb(nrnb);
     gmx_mdoutf       *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, ir, top_global, oenv, wcycle);
     gmx::EnergyOutput energyOutput;
-    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, mdoutf_get_fp_dhdl(outf), true);
+    energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, pull_work, mdoutf_get_fp_dhdl(outf), true);
 
     /* Kinetic energy data */
     std::unique_ptr<gmx_ekindata_t> eKinData = std::make_unique<gmx_ekindata_t>();
@@ -340,6 +340,7 @@ void gmx::Integrator::do_rerun()
         /* Distribute the charge groups over the nodes from the master node */
         dd_partition_system(fplog, mdlog, ir->init_step, cr, TRUE, 1,
                             state_global, *top_global, ir, imdSession,
+                            pull_work,
                             state, &f, mdAtoms, &top, fr,
                             vsite, constr,
                             nrnb, nullptr, FALSE);
@@ -521,6 +522,7 @@ void gmx::Integrator::do_rerun()
             dd_partition_system(fplog, mdlog, step, cr,
                                 bMasterState, nstglobalcomm,
                                 state_global, *top_global, ir, imdSession,
+                                pull_work,
                                 state, &f, mdAtoms, &top, fr,
                                 vsite, constr,
                                 nrnb, wcycle,
@@ -550,7 +552,7 @@ void gmx::Integrator::do_rerun()
             /* Now is the time to relax the shells */
             relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose,
                                 enforcedRotation, step,
-                                ir, imdSession, bNS, force_flags, &top,
+                                ir, imdSession, pull_work, bNS, force_flags, &top,
                                 constr, enerd, fcd,
                                 state, f.arrayRefWithPadding(), force_vir, mdatoms,
                                 nrnb, wcycle, graph,
@@ -568,6 +570,7 @@ void gmx::Integrator::do_rerun()
             Awh       *awh = nullptr;
             gmx_edsam *ed  = nullptr;
             do_force(fplog, cr, ms, ir, awh, enforcedRotation, imdSession,
+                     pull_work,
                      step, nrnb, wcycle, &top,
                      state->box, state->x.arrayRefWithPadding(), &state->hist,
                      f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
index f2aa5f1f06fa7fa41477c1fb57b7125a533d11e4..37fb314721f7a65f8bc82fe9ed370ca6e381766a 100644 (file)
@@ -1439,6 +1439,7 @@ int Mdrunner::mdrunner()
         signal_handler_install();
     }
 
+    pull_t *pull_work = nullptr;
     if (thisRankHasDuty(cr, DUTY_PP))
     {
         /* Assumes uniform use of the number of OpenMP threads */
@@ -1447,16 +1448,16 @@ int Mdrunner::mdrunner()
         if (inputrec->bPull)
         {
             /* Initialize pull code */
-            inputrec->pull_work =
+            pull_work =
                 init_pull(fplog, inputrec->pull, inputrec,
                           &mtop, cr, &atomSets, inputrec->fepvals->init_lambda);
             if (inputrec->pull->bXOutAverage || inputrec->pull->bFOutAverage)
             {
-                initPullHistory(inputrec->pull_work, &observablesHistory);
+                initPullHistory(pull_work, &observablesHistory);
             }
             if (EI_DYNAMICS(inputrec->eI) && MASTER(cr))
             {
-                init_pull_output_files(inputrec->pull_work,
+                init_pull_output_files(pull_work,
                                        filenames.size(), filenames.data(), oenv,
                                        continuationOptions);
             }
@@ -1493,7 +1494,7 @@ int Mdrunner::mdrunner()
          */
         bool doEssentialDynamics = (opt2fn_null("-ei", filenames.size(), filenames.data()) != nullptr
                                     || observablesHistory.edsamHistory);
-        auto constr              = makeConstraints(mtop, *inputrec, doEssentialDynamics,
+        auto constr              = makeConstraints(mtop, *inputrec, pull_work, doEssentialDynamics,
                                                    fplog, *mdAtoms->mdatoms(),
                                                    cr, ms, nrnb, wcycle, fr->bMolPBC);
 
@@ -1535,7 +1536,7 @@ int Mdrunner::mdrunner()
             enforcedRotation ? enforcedRotation->getLegacyEnfrot() : nullptr,
             deform.get(),
             mdModules_->outputProvider(),
-            inputrec, imdSession.get(), swap, &mtop,
+            inputrec, imdSession.get(), pull_work, swap, &mtop,
             fcd,
             globalState.get(),
             &observablesHistory,
@@ -1551,7 +1552,7 @@ int Mdrunner::mdrunner()
 
         if (inputrec->bPull)
         {
-            finish_pull(inputrec->pull_work);
+            finish_pull(pull_work);
         }
         destroy_enerdata(enerd);
         sfree(enerd);
index 1e08fda683a744d0e724584c262d0e2c0a8c56a9..657e28ca3236c4c1d514ab99a88f2982a6a4e222 100644 (file)
@@ -974,6 +974,7 @@ void relax_shell_flexcon(FILE                                     *fplog,
                          int64_t                                   mdstep,
                          const t_inputrec                         *inputrec,
                          gmx::ImdSession                          *imdSession,
+                         pull_t                                   *pull_work,
                          gmx_bool                                  bDoNS,
                          int                                       force_flags,
                          gmx_localtop_t                           *top,
@@ -1127,6 +1128,7 @@ void relax_shell_flexcon(FILE                                     *fplog,
     }
     int shellfc_flags = force_flags | (bVerbose ? GMX_FORCE_ENERGY : 0);
     do_force(fplog, cr, ms, inputrec, nullptr, enforcedRotation, imdSession,
+             pull_work,
              mdstep, nrnb, wcycle, top,
              state->box, state->x.arrayRefWithPadding(), &state->hist,
              forceWithPadding[Min], force_vir, md, enerd, fcd,
@@ -1237,6 +1239,7 @@ void relax_shell_flexcon(FILE                                     *fplog,
         }
         /* Try the new positions */
         do_force(fplog, cr, ms, inputrec, nullptr, enforcedRotation, imdSession,
+                 pull_work,
                  1, nrnb, wcycle,
                  top, state->box, posWithPadding[Try], &state->hist,
                  forceWithPadding[Try], force_vir,
index 3d847b04ad4c2181d37a806a276e36504a0a44d2..ec8b2242f794ffb975ec230281900884bc5116f4 100644 (file)
@@ -49,6 +49,7 @@ struct gmx_enfrot;
 struct gmx_multisim_t;
 struct gmx_shellfc_t;
 struct gmx_mtop_t;
+struct pull_t;
 struct t_forcerec;
 struct t_fcdata;
 struct t_graph;
@@ -78,6 +79,7 @@ void relax_shell_flexcon(FILE                                     *log,
                          int64_t                                   mdstep,
                          const t_inputrec                         *inputrec,
                          gmx::ImdSession                          *imdSession,
+                         pull_t                                   *pull_work,
                          gmx_bool                                  bDoNS,
                          int                                       force_flags,
                          gmx_localtop_t                           *top,
index 309d645226025e6062634bc702db840ed06fb82a..424692afe961c6537a3065f552b412cd5af32c1c 100644 (file)
@@ -642,6 +642,7 @@ Integrator::do_tpi()
             std::fenv_t floatingPointEnvironment;
             std::feholdexcept(&floatingPointEnvironment);
             do_force(fplog, cr, ms, inputrec, nullptr, nullptr, imdSession,
+                     pull_work,
                      step, nrnb, wcycle, &top,
                      state_global->box, state_global->x.arrayRefWithPadding(), &state_global->hist,
                      f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
index 6001326756762c9491e777f35bd293f1ae1403eb..48b3fda5de83f35bb1b08d5f42e774d974dfe1a2 100644 (file)
@@ -52,7 +52,6 @@
 struct gmx_enfrot;
 struct gmx_enfrotgrp;
 struct pull_params_t;
-struct pull_t;
 
 namespace gmx
 {
@@ -531,9 +530,6 @@ struct t_inputrec // NOLINT (clang-analyzer-optin.performance.Padding)
     gmx_bool       bPull;
     //! The data for center of mass pulling
     pull_params_t *pull;
-    // TODO: Remove this by converting pull into a ForceProvider
-    //! The COM pull force calculation data structure
-    pull_t *pull_work;
 
     /* AWH bias data */
     //! Whether to use AWH biasing for PMF calculations
index e0ec906652589c266e496494f9eb069dd5c5e8d0..35a917ef8b29b31d5ba720bcb5620ba7746f2733 100644 (file)
@@ -2265,13 +2265,15 @@ static void destroy_pull(struct pull_t *pull)
     delete pull;
 }
 
-void preparePrevStepPullCom(const t_inputrec *ir, const t_mdatoms *md, t_state *state, const t_state *state_global, const t_commrec *cr, bool startingFromCheckpoint)
+void preparePrevStepPullCom(const t_inputrec *ir, pull_t *pull_work,
+                            const t_mdatoms *md, t_state *state, const t_state *state_global,
+                            const t_commrec *cr, bool startingFromCheckpoint)
 {
     if (!ir->pull || !ir->pull->bSetPbcRefToPrevStepCOM)
     {
         return;
     }
-    allocStatePrevStepPullCom(state, ir->pull_work);
+    allocStatePrevStepPullCom(state, pull_work);
     if (startingFromCheckpoint)
     {
         if (MASTER(cr))
@@ -2283,14 +2285,14 @@ void preparePrevStepPullCom(const t_inputrec *ir, const t_mdatoms *md, t_state *
             /* Only the master rank has the checkpointed COM from the previous step */
             gmx_bcast(sizeof(double) * state->pull_com_prev_step.size(), &state->pull_com_prev_step[0], cr);
         }
-        setPrevStepPullComFromState(ir->pull_work, state);
+        setPrevStepPullComFromState(pull_work, state);
     }
     else
     {
         t_pbc pbc;
         set_pbc(&pbc, ir->ePBC, state->box);
-        initPullComFromPrevStep(cr, ir->pull_work, md, &pbc, state->x.rvec_array());
-        updatePrevStepPullCom(ir->pull_work, state);
+        initPullComFromPrevStep(cr, pull_work, md, &pbc, state->x.rvec_array());
+        updatePrevStepPullCom(pull_work, state);
     }
 }
 
index 46e47767d19f4f9cd5a94d6c91d7eedb896c98be..2b19d5028cb6c0c163d1670c98b497763f511bcd 100644 (file)
@@ -62,6 +62,7 @@ struct gmx_mtop_t;
 struct gmx_output_env_t;
 struct pull_coord_work_t;
 struct pull_params_t;
+struct pull_t;
 struct t_commrec;
 struct t_filenm;
 struct t_inputrec;
@@ -357,13 +358,16 @@ void updatePrevStepPullCom(struct pull_t *pull, t_state *state);
  * If ir->pull->bSetPbcRefToPrevStepCOM is not true nothing is done.
  *
  * \param[in] ir                     The input options/settings of the simulation.
+ * \param[in] pull_work              The COM pull force calculation data structure
  * \param[in] md                     All atoms.
  * \param[in] state                  The local (to this rank) state.
  * \param[in] state_global           The global state.
  * \param[in] cr                     Struct for communication info.
  * \param[in] startingFromCheckpoint Is the simulation starting from a checkpoint?
  */
-void preparePrevStepPullCom(const t_inputrec *ir, const t_mdatoms *md, t_state *state, const t_state *state_global, const t_commrec *cr, bool startingFromCheckpoint);
+void preparePrevStepPullCom(const t_inputrec *ir, pull_t *pull_work, const t_mdatoms *md,
+                            t_state *state, const t_state *state_global, const t_commrec *cr,
+                            bool startingFromCheckpoint);
 
 /*! \brief Initializes the COM of the previous step (set to initial COM)
  *
index b6351a9d52779f48ad7cfdd4177e3cb35c7cbd67..9c34e0bc81c58b2afd778fb0b09298422066242f 100644 (file)
@@ -213,6 +213,8 @@ struct pull_comm_t
     std::vector<double>                   cylinderBuffer; /* cylinder ref. groups calculation buffer */
 };
 
+// The COM pull force calculation data structure
+// TODO Convert this into a ForceProvider
 struct pull_t
 {
     /* Global parameters */
@@ -271,7 +273,7 @@ void setPrevStepPullComFromState(struct pull_t *pull, const t_state *state);
  * \param[in]   state The global state container
  * \param[in]   pull  The COM pull force calculation data structure
  */
-void allocStatePrevStepPullCom(t_state *state, pull_t *pull);
+void allocStatePrevStepPullCom(t_state *state, const pull_t *pull);
 
 
 #endif
index 3f39df0ccefb200fc51e456e46b7406c71194aad..af6b2ed5d0e9ea388b89f9fd2db415bc1bd8c3c1 100644 (file)
@@ -1016,7 +1016,7 @@ void updatePrevStepPullCom(struct pull_t *pull, t_state *state)
     }
 }
 
-void allocStatePrevStepPullCom(t_state *state, pull_t *pull)
+void allocStatePrevStepPullCom(t_state *state, const pull_t *pull)
 {
     if (!pull)
     {