Only use const ref for mtop and inputrec in domdec
authorJoe Jordan <ejjordan12@gmail.com>
Fri, 26 Feb 2021 14:02:54 +0000 (14:02 +0000)
committerArtem Zhmurov <zhmurov@gmail.com>
Fri, 26 Feb 2021 14:02:54 +0000 (14:02 +0000)
All const pointers of mtop and inputrec in domdec module are
converted to const refs. Additionally, since inputrec lines need
to change anyway, renaming from ir to inputrec is performed.

20 files changed:
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec.h
src/gromacs/domdec/domdec_constraints.cpp
src/gromacs/domdec/domdec_constraints.h
src/gromacs/domdec/domdec_topology.cpp
src/gromacs/domdec/dump.cpp
src/gromacs/domdec/dump.h
src/gromacs/domdec/mdsetup.cpp
src/gromacs/domdec/mdsetup.h
src/gromacs/domdec/partition.cpp
src/gromacs/domdec/partition.h
src/gromacs/mdlib/update_vv.cpp
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/modularsimulator/computeglobalselement.cpp
src/gromacs/modularsimulator/domdechelper.cpp
src/gromacs/modularsimulator/topologyholder.cpp

index 5345c92a3016ef7110df80e9bd4e724260e062f7..ad43086893638e91e4da52a6643150be753bb8d0 100644 (file)
@@ -1706,7 +1706,7 @@ static real* get_slb_frac(const gmx::MDLogger& mdlog, const char* dir, int nc, c
     return slb_frac;
 }
 
-static int multi_body_bondeds_count(const gmx_mtop_t* mtop)
+static int multi_body_bondeds_count(const gmx_mtop_t& mtop)
 {
     int                  n     = 0;
     gmx_mtop_ilistloop_t iloop = gmx_mtop_ilistloop_init(mtop);
@@ -1741,22 +1741,22 @@ static int dd_getenv(const gmx::MDLogger& mdlog, const char* env_var, int def)
     return nst;
 }
 
-static void check_dd_restrictions(const gmx_domdec_t* dd, const t_inputrec* ir, const gmx::MDLogger& mdlog)
+static void check_dd_restrictions(const gmx_domdec_t* dd, const t_inputrec& inputrec, const gmx::MDLogger& mdlog)
 {
-    if (ir->pbcType == PbcType::Screw
+    if (inputrec.pbcType == PbcType::Screw
         && (dd->numCells[XX] == 1 || dd->numCells[YY] > 1 || dd->numCells[ZZ] > 1))
     {
         gmx_fatal(FARGS,
                   "With pbc=%s can only do domain decomposition in the x-direction",
-                  c_pbcTypeNames[ir->pbcType].c_str());
+                  c_pbcTypeNames[inputrec.pbcType].c_str());
     }
 
-    if (ir->nstlist == 0)
+    if (inputrec.nstlist == 0)
     {
         gmx_fatal(FARGS, "Domain decomposition does not work with nstlist=0");
     }
 
-    if (ir->comm_mode == ComRemovalAlgorithm::Angular && ir->pbcType != PbcType::No)
+    if (inputrec.comm_mode == ComRemovalAlgorithm::Angular && inputrec.pbcType != PbcType::No)
     {
         GMX_LOG(mdlog.warning)
                 .appendText(
@@ -1811,14 +1811,14 @@ static DlbState forceDlbOffOrBail(DlbState             cmdlineDlbState,
  * \param [in] dlbOption   Enum value for the DLB option.
  * \param [in] bRecordLoad True if the load balancer is recording load information.
  * \param [in] mdrunOptions  Options for mdrun.
- * \param [in] ir          Pointer mdrun to input parameters.
+ * \param [in] inputrec    Pointer mdrun to input parameters.
  * \returns                DLB initial/startup state.
  */
 static DlbState determineInitialDlbState(const gmx::MDLogger&     mdlog,
                                          DlbOption                dlbOption,
                                          gmx_bool                 bRecordLoad,
                                          const gmx::MdrunOptions& mdrunOptions,
-                                         const t_inputrec*        ir)
+                                         const t_inputrec&        inputrec)
 {
     DlbState dlbState = DlbState::offCanTurnOn;
 
@@ -1838,11 +1838,11 @@ static DlbState determineInitialDlbState(const gmx::MDLogger&     mdlog,
     }
 
     /* Unsupported integrators */
-    if (!EI_DYNAMICS(ir->eI))
+    if (!EI_DYNAMICS(inputrec.eI))
     {
         auto reasonStr =
                 gmx::formatString("it is only supported with dynamics, not with integrator '%s'.",
-                                  enumValueToString(ir->eI));
+                                  enumValueToString(inputrec.eI));
         return forceDlbOffOrBail(dlbState, reasonStr, mdlog);
     }
 
@@ -2051,7 +2051,7 @@ static DDSystemInfo getSystemInfo(const gmx::MDLogger&           mdlog,
     systemInfo.haveInterDomainBondeds =
             (!systemInfo.moleculesAreAlwaysWhole || mtop.bIntermolecularInteractions);
     systemInfo.haveInterDomainMultiBodyBondeds =
-            (systemInfo.haveInterDomainBondeds && multi_body_bondeds_count(&mtop) > 0);
+            (systemInfo.haveInterDomainBondeds && multi_body_bondeds_count(mtop) > 0);
 
     if (systemInfo.useUpdateGroups)
     {
@@ -2145,7 +2145,7 @@ static DDSystemInfo getSystemInfo(const gmx::MDLogger&           mdlog,
                                                                   ? DDBondedChecking::All
                                                                   : DDBondedChecking::ExcludeZeroLimit;
 
-                dd_bonded_cg_distance(mdlog, &mtop, &ir, xGlobal, box, ddBondedChecking, &r_2b, &r_mb);
+                dd_bonded_cg_distance(mdlog, mtop, ir, xGlobal, box, ddBondedChecking, &r_2b, &r_mb);
             }
             gmx_bcast(sizeof(r_2b), &r_2b, communicator);
             gmx_bcast(sizeof(r_mb), &r_mb, communicator);
@@ -2391,8 +2391,8 @@ static void set_dd_limits(const gmx::MDLogger& mdlog,
                           const DDSystemInfo&  systemInfo,
                           const DDGridSetup&   ddGridSetup,
                           const int            numPPRanks,
-                          const gmx_mtop_t*    mtop,
-                          const t_inputrec*    ir,
+                          const gmx_mtop_t&    mtop,
+                          const t_inputrec&    ir,
                           const gmx_ddbox_t&   ddbox)
 {
     gmx_domdec_comm_t* comm = dd->comm;
@@ -2421,9 +2421,9 @@ static void set_dd_limits(const gmx::MDLogger& mdlog,
          *       but that is not yet available here. But this anyhow only
          *       affect performance up to the second dd_partition_system call.
          */
-        const int homeAtomCountEstimate = mtop->natoms / numPPRanks;
+        const int homeAtomCountEstimate = mtop.natoms / numPPRanks;
         comm->updateGroupsCog           = std::make_unique<gmx::UpdateGroupsCog>(
-                *mtop, systemInfo.updateGroupingPerMoleculetype, maxReferenceTemperature(*ir), homeAtomCountEstimate);
+                mtop, systemInfo.updateGroupingPerMoleculetype, maxReferenceTemperature(ir), homeAtomCountEstimate);
     }
 
     /* Set the DD setup given by ddGridSetup */
@@ -2503,11 +2503,11 @@ void dd_init_bondeds(FILE*                           fplog,
                      gmx_domdec_t*                   dd,
                      const gmx_mtop_t&               mtop,
                      const gmx::VirtualSitesHandler* vsite,
-                     const t_inputrec*               ir,
+                     const t_inputrec&               inputrec,
                      const DDBondedChecking          ddBondedChecking,
                      gmx::ArrayRef<cginfo_mb_t>      cginfo_mb)
 {
-    dd_make_reverse_top(fplog, dd, &mtop, vsite, ir, ddBondedChecking);
+    dd_make_reverse_top(fplog, dd, mtop, vsite, inputrec, ddBondedChecking);
 
     gmx_domdec_comm_t* comm = dd->comm;
 
@@ -2525,8 +2525,8 @@ void dd_init_bondeds(FILE*                           fplog,
 
 static void writeSettings(gmx::TextWriter*   log,
                           gmx_domdec_t*      dd,
-                          const gmx_mtop_t*  mtop,
-                          const t_inputrec*  ir,
+                          const gmx_mtop_t&  mtop,
+                          const t_inputrec&  ir,
                           gmx_bool           bDynLoadBal,
                           real               dlb_scale,
                           const gmx_ddbox_t* ddbox)
@@ -2582,7 +2582,7 @@ static void writeSettings(gmx::TextWriter*   log,
     }
 
     const bool haveInterDomainVsites =
-            (countInterUpdategroupVsites(*mtop, comm->systemInfo.updateGroupingPerMoleculetype) != 0);
+            (countInterUpdategroupVsites(mtop, comm->systemInfo.updateGroupingPerMoleculetype) != 0);
 
     if (comm->systemInfo.haveInterDomainBondeds || haveInterDomainVsites
         || comm->systemInfo.haveSplitConstraints || comm->systemInfo.haveSplitSettles)
@@ -2642,7 +2642,7 @@ static void writeSettings(gmx::TextWriter*   log,
         if (comm->systemInfo.haveSplitConstraints || comm->systemInfo.haveSplitSettles)
         {
             std::string separation =
-                    gmx::formatString("atoms separated by up to %d constraints", 1 + ir->nProjOrder);
+                    gmx::formatString("atoms separated by up to %d constraints", 1 + ir.nProjOrder);
             log->writeLineFormatted("%40s  %-7s %6.3f nm\n", separation.c_str(), "(-rcon)", limit);
         }
         log->ensureLineBreak();
@@ -2651,8 +2651,8 @@ static void writeSettings(gmx::TextWriter*   log,
 
 static void logSettings(const gmx::MDLogger& mdlog,
                         gmx_domdec_t*        dd,
-                        const gmx_mtop_t*    mtop,
-                        const t_inputrec*    ir,
+                        const gmx_mtop_t&    mtop,
+                        const t_inputrec&    ir,
                         real                 dlb_scale,
                         const gmx_ddbox_t*   ddbox)
 {
@@ -2674,7 +2674,7 @@ static void logSettings(const gmx::MDLogger& mdlog,
 static void set_cell_limits_dlb(const gmx::MDLogger& mdlog,
                                 gmx_domdec_t*        dd,
                                 real                 dlb_scale,
-                                const t_inputrec*    ir,
+                                const t_inputrec&    inputrec,
                                 const gmx_ddbox_t*   ddbox)
 {
     int npulse       = 0;
@@ -2683,7 +2683,7 @@ static void set_cell_limits_dlb(const gmx::MDLogger& mdlog,
 
     gmx_domdec_comm_t* comm = dd->comm;
 
-    bool bNoCutOff = (ir->rvdw == 0 || ir->rcoulomb == 0);
+    bool bNoCutOff = (inputrec.rvdw == 0 || inputrec.rcoulomb == 0);
 
     /* Determine the maximum number of comm. pulses in one dimension */
 
@@ -2735,7 +2735,7 @@ static void set_cell_limits_dlb(const gmx::MDLogger& mdlog,
     }
 
     comm->maxpulse       = 1;
-    comm->bVacDLBNoLimit = (ir->pbcType == PbcType::No);
+    comm->bVacDLBNoLimit = (inputrec.pbcType == PbcType::No);
     for (int d = 0; d < dd->ndim; d++)
     {
         comm->cd[d].np_dlb = std::min(npulse, dd->numCells[dd->dim[d]] - 1);
@@ -2794,14 +2794,14 @@ gmx_bool dd_bonded_molpbc(const gmx_domdec_t* dd, PbcType pbcType)
 static void set_ddgrid_parameters(const gmx::MDLogger& mdlog,
                                   gmx_domdec_t*        dd,
                                   real                 dlb_scale,
-                                  const gmx_mtop_t*    mtop,
-                                  const t_inputrec*    ir,
+                                  const gmx_mtop_t&    mtop,
+                                  const t_inputrec&    inputrec,
                                   const gmx_ddbox_t*   ddbox)
 {
     gmx_domdec_comm_t* comm        = dd->comm;
     DDRankSetup&       ddRankSetup = comm->ddRankSetup;
 
-    if (EEL_PME(ir->coulombtype) || EVDW_PME(ir->vdwtype))
+    if (EEL_PME(inputrec.coulombtype) || EVDW_PME(inputrec.vdwtype))
     {
         init_ddpme(dd, &ddRankSetup.ddpme[0], 0);
         if (ddRankSetup.npmedecompdim >= 2)
@@ -2827,12 +2827,12 @@ static void set_ddgrid_parameters(const gmx::MDLogger& mdlog,
     }
     if (!isDlbDisabled(comm))
     {
-        set_cell_limits_dlb(mdlog, dd, dlb_scale, ir, ddbox);
+        set_cell_limits_dlb(mdlog, dd, dlb_scale, inputrec, ddbox);
     }
 
-    logSettings(mdlog, dd, mtop, ir, dlb_scale, ddbox);
+    logSettings(mdlog, dd, mtop, inputrec, dlb_scale, ddbox);
 
-    const real vol_frac = (ir->pbcType == PbcType::No)
+    const real vol_frac = (inputrec.pbcType == PbcType::No)
                                   ? (1 - 1 / static_cast<double>(dd->nnodes))
                                   : ((1 + comm_box_frac(dd->numCells, comm->systemInfo.cutoff, *ddbox))
                                      / static_cast<double>(dd->nnodes));
@@ -2840,7 +2840,7 @@ static void set_ddgrid_parameters(const gmx::MDLogger& mdlog,
     {
         fprintf(debug, "Volume fraction for all DD zones: %f\n", vol_frac);
     }
-    int natoms_tot = mtop->natoms;
+    int natoms_tot = mtop.natoms;
 
     dd->ga2la = new gmx_ga2la_t(natoms_tot, static_cast<int>(vol_frac * natoms_tot));
 }
@@ -2882,8 +2882,8 @@ static DDSettings getDDSettings(const gmx::MDLogger&     mdlog,
         ddSettings.recordLoad = (wallcycle_have_counter() && recload > 0);
     }
 
-    ddSettings.initialDlbState = determineInitialDlbState(
-            mdlog, options.dlbOption, ddSettings.recordLoad, mdrunOptions, &ir);
+    ddSettings.initialDlbState =
+            determineInitialDlbState(mdlog, options.dlbOption, ddSettings.recordLoad, mdrunOptions, ir);
     GMX_LOG(mdlog.info)
             .appendTextFormatted("Dynamic load balancing: %s",
                                  edlbs_names[static_cast<int>(ddSettings.initialDlbState)]);
@@ -3050,15 +3050,15 @@ gmx_domdec_t* DomainDecompositionBuilder::Impl::build(LocalAtomSetManager* atomS
                   systemInfo_,
                   ddGridSetup_,
                   ddRankSetup_.numPPRanks,
-                  &mtop_,
-                  &ir_,
+                  mtop_,
+                  ir_,
                   ddbox_);
 
     setupGroupCommunication(mdlog_, ddSettings_, pmeRanks_, cr_, mtop_.natoms, dd);
 
     if (thisRankHasDuty(cr_, DUTY_PP))
     {
-        set_ddgrid_parameters(mdlog_, dd, options_.dlbScaling, &mtop_, &ir_, &ddbox_);
+        set_ddgrid_parameters(mdlog_, dd, options_.dlbScaling, mtop_, ir_, &ddbox_);
 
         setup_neighbor_relations(dd);
     }
index 9c1e1cea7ac039725e50523c663eb84c1befc829..bc00e86fdd1a3fed9c35b633e7630b9c4bbf178d 100644 (file)
@@ -168,7 +168,7 @@ void dd_init_bondeds(FILE*                           fplog,
                      gmx_domdec_t*                   dd,
                      const gmx_mtop_t&               mtop,
                      const gmx::VirtualSitesHandler* vsite,
-                     const t_inputrec*               ir,
+                     const t_inputrec&               inputrec,
                      DDBondedChecking                ddBondedChecking,
                      gmx::ArrayRef<cginfo_mb_t>      cginfo_mb);
 
@@ -268,7 +268,7 @@ gmx::ArrayRef<const int> dd_constraints_nlocalatoms(const gmx_domdec_t* dd);
 [[noreturn]] void dd_print_missing_interactions(const gmx::MDLogger&           mdlog,
                                                 t_commrec*                     cr,
                                                 int                            local_count,
-                                                const gmx_mtop_t*              top_global,
+                                                const gmx_mtop_t&              top_global,
                                                 const gmx_localtop_t*          top_local,
                                                 gmx::ArrayRef<const gmx::RVec> x,
                                                 const matrix                   box);
@@ -276,9 +276,9 @@ gmx::ArrayRef<const int> dd_constraints_nlocalatoms(const gmx_domdec_t* dd);
 /*! \brief Generate and store the reverse topology */
 void dd_make_reverse_top(FILE*                           fplog,
                          gmx_domdec_t*                   dd,
-                         const gmx_mtop_t*               mtop,
+                         const gmx_mtop_t&               mtop,
                          const gmx::VirtualSitesHandler* vsite,
-                         const t_inputrec*               ir,
+                         const t_inputrec&               inputrec,
                          DDBondedChecking                ddBondedChecking);
 
 /*! \brief Generate the local topology and virtual site data */
@@ -307,8 +307,8 @@ t_blocka* makeBondedLinks(const gmx_mtop_t& mtop, gmx::ArrayRef<cginfo_mb_t> cgi
 
 /*! \brief Calculate the maximum distance involved in 2-body and multi-body bonded interactions */
 void dd_bonded_cg_distance(const gmx::MDLogger&           mdlog,
-                           const gmx_mtop_t*              mtop,
-                           const t_inputrec*              ir,
+                           const gmx_mtop_t&              mtop,
+                           const t_inputrec&              ir,
                            gmx::ArrayRef<const gmx::RVec> x,
                            const matrix                   box,
                            DDBondedChecking               ddBondedChecking,
index 234a2c858ce3418d832584c7527322cefe0d7339..d456b933cfed8ab9db661098613046e3456b6cc6 100644 (file)
@@ -222,7 +222,7 @@ static void walk_out(int                       con,
 
 /*! \brief Looks up SETTLE constraints for a range of charge-groups */
 static void atoms_to_settles(gmx_domdec_t*                         dd,
-                             const gmx_mtop_t*                     mtop,
+                             const gmx_mtop_t&                     mtop,
                              const int*                            cginfo,
                              gmx::ArrayRef<const std::vector<int>> at2settle_mt,
                              int                                   cg_start,
@@ -240,16 +240,16 @@ static void atoms_to_settles(gmx_domdec_t*                         dd,
         {
             int a_gl  = dd->globalAtomIndices[a];
             int a_mol = 0;
-            mtopGetMolblockIndex(mtop, a_gl, &mb, nullptr, &a_mol);
+            mtopGetMolblockIndex(&mtop, a_gl, &mb, nullptr, &a_mol);
 
-            const gmx_molblock_t* molb   = &mtop->molblock[mb];
+            const gmx_molblock_t* molb   = &mtop.molblock[mb];
             int                   settle = at2settle_mt[molb->type][a_mol];
 
             if (settle >= 0)
             {
                 int offset = a_gl - a_mol;
 
-                const int* ia1 = mtop->moltype[molb->type].ilist[F_SETTLE].iatoms.data();
+                const int* ia1 = mtop.moltype[molb->type].ilist[F_SETTLE].iatoms.data();
 
                 int      a_gls[3];
                 gmx_bool bAssign = FALSE;
@@ -297,7 +297,7 @@ static void atoms_to_settles(gmx_domdec_t*                         dd,
 
 /*! \brief Looks up constraint for the local atoms */
 static void atoms_to_constraints(gmx_domdec_t*                         dd,
-                                 const gmx_mtop_t*                     mtop,
+                                 const gmx_mtop_t&                     mtop,
                                  const int*                            cginfo,
                                  gmx::ArrayRef<const ListOfLists<int>> at2con_mt,
                                  int                                   nrec,
@@ -321,12 +321,12 @@ static void atoms_to_constraints(gmx_domdec_t*                         dd,
             int a_gl  = dd->globalAtomIndices[a];
             int molnr = 0;
             int a_mol = 0;
-            mtopGetMolblockIndex(mtop, a_gl, &mb, &molnr, &a_mol);
+            mtopGetMolblockIndex(&mtop, a_gl, &mb, &molnr, &a_mol);
 
-            const gmx_molblock_t& molb = mtop->molblock[mb];
+            const gmx_molblock_t& molb = mtop.molblock[mb];
 
-            gmx::ArrayRef<const int> ia1 = mtop->moltype[molb.type].ilist[F_CONSTR].iatoms;
-            gmx::ArrayRef<const int> ia2 = mtop->moltype[molb.type].ilist[F_CONSTRNC].iatoms;
+            gmx::ArrayRef<const int> ia1 = mtop.moltype[molb.type].ilist[F_CONSTR].iatoms;
+            gmx::ArrayRef<const int> ia2 = mtop.moltype[molb.type].ilist[F_CONSTRNC].iatoms;
 
             /* Calculate the global constraint number offset for the molecule.
              * This is only required for the global index to make sure
@@ -398,7 +398,7 @@ static void atoms_to_constraints(gmx_domdec_t*                         dd,
 
 int dd_make_local_constraints(gmx_domdec_t*                  dd,
                               int                            at_start,
-                              const struct gmx_mtop_t*       mtop,
+                              const struct gmx_mtop_t&       mtop,
                               const int*                     cginfo,
                               gmx::Constraints*              constr,
                               int                            nrec,
@@ -563,7 +563,7 @@ int dd_make_local_constraints(gmx_domdec_t*                  dd,
     return at_end;
 }
 
-void init_domdec_constraints(gmx_domdec_t* dd, const gmx_mtop_t* mtop)
+void init_domdec_constraints(gmx_domdec_t* dd, const gmx_mtop_t& mtop)
 {
     if (debug)
     {
@@ -573,16 +573,16 @@ void init_domdec_constraints(gmx_domdec_t* dd, const gmx_mtop_t* mtop)
     dd->constraints              = new gmx_domdec_constraints_t;
     gmx_domdec_constraints_t* dc = dd->constraints;
 
-    dc->molb_con_offset.resize(mtop->molblock.size());
-    dc->molb_ncon_mol.resize(mtop->molblock.size());
+    dc->molb_con_offset.resize(mtop.molblock.size());
+    dc->molb_ncon_mol.resize(mtop.molblock.size());
 
     int ncon = 0;
-    for (size_t mb = 0; mb < mtop->molblock.size(); mb++)
+    for (size_t mb = 0; mb < mtop.molblock.size(); mb++)
     {
-        const gmx_molblock_t* molb = &mtop->molblock[mb];
+        const gmx_molblock_t* molb = &mtop.molblock[mb];
         dc->molb_con_offset[mb]    = ncon;
-        dc->molb_ncon_mol[mb]      = mtop->moltype[molb->type].ilist[F_CONSTR].size() / 3
-                                + mtop->moltype[molb->type].ilist[F_CONSTRNC].size() / 3;
+        dc->molb_ncon_mol[mb]      = mtop.moltype[molb->type].ilist[F_CONSTR].size() / 3
+                                + mtop.moltype[molb->type].ilist[F_CONSTRNC].size() / 3;
         ncon += molb->nmol * dc->molb_ncon_mol[mb];
     }
 
@@ -594,7 +594,7 @@ void init_domdec_constraints(gmx_domdec_t* dd, const gmx_mtop_t* mtop)
     /* Use a hash table for the global to local index.
      * The number of keys is a rough estimate, it will be optimized later.
      */
-    int numKeysEstimate = std::min(mtop->natoms / 20, mtop->natoms / (2 * dd->nnodes));
+    int numKeysEstimate = std::min(mtop.natoms / 20, mtop.natoms / (2 * dd->nnodes));
     dc->ga2la           = std::make_unique<gmx::HashedMap<int>>(numKeysEstimate);
 
     dc->nthread = gmx_omp_nthreads_get(emntDomdec);
index de25e404a02433974fedda35e998023310ebac2e..e2a5772b180954ab96c26c5d11c2c45f3fba8367 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2005,2006,2007,2008,2009 by the GROMACS development team.
  * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
@@ -63,13 +63,13 @@ void dd_clear_local_constraint_indices(gmx_domdec_t* dd);
 /*! \brief Sets up communication and atom indices for all local+connected constraints */
 int dd_make_local_constraints(struct gmx_domdec_t*           dd,
                               int                            at_start,
-                              const struct gmx_mtop_t*       mtop,
+                              const struct gmx_mtop_t&       mtop,
                               const int*                     cginfo,
                               gmx::Constraints*              constr,
                               int                            nrec,
                               gmx::ArrayRef<InteractionList> il_local);
 
 /*! \brief Initializes the data structures for constraint communication */
-void init_domdec_constraints(gmx_domdec_t* dd, const gmx_mtop_t* mtop);
+void init_domdec_constraints(gmx_domdec_t* dd, const gmx_mtop_t& mtop);
 
 #endif
index 5b4b2feacd3eb89b17bb492606d70422e1d0537f..3c51f193db8b6e4b1ef589ceb0e6502d89371fd8 100644 (file)
@@ -389,7 +389,7 @@ static void printMissingInteractionsAtoms(const gmx::MDLogger&          mdlog,
 void dd_print_missing_interactions(const gmx::MDLogger&           mdlog,
                                    t_commrec*                     cr,
                                    int                            local_count,
-                                   const gmx_mtop_t*              top_global,
+                                   const gmx_mtop_t&              top_global,
                                    const gmx_localtop_t*          top_local,
                                    gmx::ArrayRef<const gmx::RVec> x,
                                    const matrix                   box)
@@ -451,7 +451,7 @@ void dd_print_missing_interactions(const gmx::MDLogger&           mdlog,
         }
     }
 
-    printMissingInteractionsAtoms(mdlog, cr, *top_global, top_local->idef);
+    printMissingInteractionsAtoms(mdlog, cr, top_global, top_local->idef);
     write_dd_pdb("dd_dump_err", 0, "dump", top_global, cr, -1, as_rvec_array(x.data()), box);
 
     std::string errorMessage;
@@ -747,9 +747,9 @@ gmx_reverse_top_t::Impl::Impl(const gmx_mtop_t&        mtop,
 
 void dd_make_reverse_top(FILE*                           fplog,
                          gmx_domdec_t*                   dd,
-                         const gmx_mtop_t*               mtop,
+                         const gmx_mtop_t&               mtop,
                          const gmx::VirtualSitesHandler* vsite,
-                         const t_inputrec*               ir,
+                         const t_inputrec&               inputrec,
                          const DDBondedChecking          ddBondedChecking)
 {
     if (fplog)
@@ -767,14 +767,14 @@ void dd_make_reverse_top(FILE*                           fplog,
                                       !dd->comm->systemInfo.haveSplitSettles);
 
     dd->reverse_top = std::make_unique<gmx_reverse_top_t>(
-            *mtop, ir->efep != FreeEnergyPerturbationType::No, rtOptions);
+            mtop, inputrec.efep != FreeEnergyPerturbationType::No, rtOptions);
 
     dd->nbonded_global = dd->reverse_top->impl_->numInteractionsToCheck;
 
     dd->haveExclusions = false;
-    for (const gmx_molblock_t& molb : mtop->molblock)
+    for (const gmx_molblock_t& molb : mtop.molblock)
     {
-        const int maxNumExclusionsPerAtom = getMaxNumExclusionsPerAtom(mtop->moltype[molb.type].excls);
+        const int maxNumExclusionsPerAtom = getMaxNumExclusionsPerAtom(mtop.moltype[molb.type].excls);
         // We checked above that max 1 exclusion means only self exclusions
         if (maxNumExclusionsPerAtom > 1)
         {
@@ -1440,7 +1440,7 @@ static void make_exclusions_zone(ArrayRef<const int>               globalAtomInd
 /*! \brief Generate and store all required local bonded interactions in \p idef and local exclusions in \p lexcls */
 static int make_local_bondeds_excls(gmx_domdec_t*           dd,
                                     gmx_domdec_zones_t*     zones,
-                                    const gmx_mtop_t*       mtop,
+                                    const gmx_mtop_t&       mtop,
                                     const int*              cginfo,
                                     gmx_bool                bRCheckMB,
                                     ivec                    rcheck,
@@ -1510,7 +1510,7 @@ static int make_local_bondeds_excls(gmx_domdec_t*           dd,
                                                                        dd->globalAtomIndices,
                                                                        *dd->ga2la,
                                                                        zones,
-                                                                       mtop->molblock,
+                                                                       mtop.molblock,
                                                                        bRCheckMB,
                                                                        rcheck,
                                                                        bRCheck2B,
@@ -1542,13 +1542,13 @@ static int make_local_bondeds_excls(gmx_domdec_t*           dd,
                                          *dd->ga2la,
                                          zones,
                                          rt->impl_->mbi,
-                                         mtop->moltype,
+                                         mtop.moltype,
                                          cginfo,
                                          excl_t,
                                          izone,
                                          cg0t,
                                          cg1t,
-                                         mtop->intermolecularExclusionGroup);
+                                         mtop.intermolecularExclusionGroup);
                 }
             }
             GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
@@ -1665,7 +1665,7 @@ void dd_make_local_top(gmx_domdec_t*       dd,
 
     dd->nbonded_local = make_local_bondeds_excls(dd,
                                                  zones,
-                                                 &mtop,
+                                                 mtop,
                                                  fr->cginfo.data(),
                                                  bRCheckMB,
                                                  rcheck,
@@ -2074,8 +2074,8 @@ static void getWholeMoleculeCoordinates(const gmx_moltype_t*  molt,
 }
 
 void dd_bonded_cg_distance(const gmx::MDLogger&   mdlog,
-                           const gmx_mtop_t*      mtop,
-                           const t_inputrec*      ir,
+                           const gmx_mtop_t&      mtop,
+                           const t_inputrec&      inputrec,
                            ArrayRef<const RVec>   x,
                            const matrix           box,
                            const DDBondedChecking ddBondedChecking,
@@ -2085,14 +2085,14 @@ void dd_bonded_cg_distance(const gmx::MDLogger&   mdlog,
     bonded_distance_t bd_2b = { 0, -1, -1, -1 };
     bonded_distance_t bd_mb = { 0, -1, -1, -1 };
 
-    bool bExclRequired = inputrecExclForces(ir);
+    bool bExclRequired = inputrecExclForces(&inputrec);
 
     *r_2b         = 0;
     *r_mb         = 0;
     int at_offset = 0;
-    for (const gmx_molblock_t& molb : mtop->molblock)
+    for (const gmx_molblock_t& molb : mtop.molblock)
     {
-        const gmx_moltype_t& molt = mtop->moltype[molb.type];
+        const gmx_moltype_t& molt = mtop.moltype[molb.type];
         if (molt.atoms.nr == 1 || molb.nmol == 0)
         {
             at_offset += molb.nmol * molt.atoms.nr;
@@ -2100,7 +2100,7 @@ void dd_bonded_cg_distance(const gmx::MDLogger&   mdlog,
         else
         {
             t_graph graph;
-            if (ir->pbcType != PbcType::No)
+            if (inputrec.pbcType != PbcType::No)
             {
                 graph = mk_graph_moltype(molt);
             }
@@ -2109,8 +2109,8 @@ void dd_bonded_cg_distance(const gmx::MDLogger&   mdlog,
             for (int mol = 0; mol < molb.nmol; mol++)
             {
                 getWholeMoleculeCoordinates(&molt,
-                                            &mtop->ffparams,
-                                            ir->pbcType,
+                                            &mtop.ffparams,
+                                            inputrec.pbcType,
                                             &graph,
                                             box,
                                             x.subArray(at_offset, molt.atoms.nr),
@@ -2138,13 +2138,13 @@ void dd_bonded_cg_distance(const gmx::MDLogger&   mdlog,
         }
     }
 
-    if (mtop->bIntermolecularInteractions)
+    if (mtop.bIntermolecularInteractions)
     {
-        GMX_RELEASE_ASSERT(mtop->intermolecular_ilist,
+        GMX_RELEASE_ASSERT(mtop.intermolecular_ilist,
                            "We should have an ilist when intermolecular interactions are on");
 
         bonded_distance_intermol(
-                *mtop->intermolecular_ilist, ddBondedChecking, x, ir->pbcType, box, &bd_2b, &bd_mb);
+                *mtop.intermolecular_ilist, ddBondedChecking, x, inputrec.pbcType, box, &bd_2b, &bd_mb);
     }
 
     *r_2b = sqrt(bd_2b.r2);
index 274a998789f1b37026a264066d6ff50bab068bc5..be9f0c77db34b8a949622960938ec26a1694af12 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
@@ -159,7 +159,7 @@ void write_dd_grid_pdb(const char* fn, int64_t step, gmx_domdec_t* dd, matrix bo
 void write_dd_pdb(const char*       fn,
                   int64_t           step,
                   const char*       title,
-                  const gmx_mtop_t* mtop,
+                  const gmx_mtop_t& mtop,
                   const t_commrec*  cr,
                   int               natoms,
                   const rvec        x[],
index fabc6a588732af6fd03fc264a0973d10dc02db3d..01c004a4203a04ac02b05f43e57d2c227a96bb56 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2021, 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.
@@ -63,7 +63,7 @@ void write_dd_grid_pdb(const char* fn, int64_t step, gmx_domdec_t* dd, matrix bo
 void write_dd_pdb(const char*       fn,
                   int64_t           step,
                   const char*       title,
-                  const gmx_mtop_t* mtop,
+                  const gmx_mtop_t& mtop,
                   const t_commrec*  cr,
                   int               natoms,
                   const rvec        x[],
index 6c76374521295cd75026894b3a1ed93f55a02163..9db54f0c3395f5825a722994bc2752ab6f43c0bf 100644 (file)
@@ -64,7 +64,7 @@ namespace gmx
  * for initialization and atom-data setup.
  */
 void mdAlgorithmsSetupAtomData(const t_commrec*     cr,
-                               const t_inputrec*    ir,
+                               const t_inputrec&    inputrec,
                                const gmx_mtop_t&    top_global,
                                gmx_localtop_t*      top,
                                t_forcerec*          fr,
@@ -99,7 +99,7 @@ void mdAlgorithmsSetupAtomData(const t_commrec*     cr,
     }
 
     atoms2md(&top_global,
-             ir,
+             &inputrec,
              numAtomIndex,
              usingDomDec ? cr->dd->globalAtomIndices : std::vector<int>(),
              numHomeAtoms,
@@ -112,7 +112,7 @@ void mdAlgorithmsSetupAtomData(const t_commrec*     cr,
     }
     else
     {
-        gmx_mtop_generate_local_top(top_global, top, ir->efep != FreeEnergyPerturbationType::No);
+        gmx_mtop_generate_local_top(top_global, top, inputrec.efep != FreeEnergyPerturbationType::No);
     }
 
     if (vsite)
index ab0da8fcf16f398beeace4c119e42ea610c462a9..007c410660f8d73b1d67684cdc377375b4e0f321 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020,2021, 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.
@@ -77,7 +77,7 @@ void make_local_shells(const t_commrec* cr, const t_mdatoms* md, gmx_shellfc_t*
  * This is called at the start of serial runs and during domain decomposition.
  *
  * \param[in]     cr         Communication record
- * \param[in]     ir         Input parameter record
+ * \param[in]     inputrec   Input parameter record
  * \param[in]     top_global The global topology
  * \param[in,out] top        The local topology
  * \param[in,out] fr         The force calculation parameter/data record
@@ -88,7 +88,7 @@ void make_local_shells(const t_commrec* cr, const t_mdatoms* md, gmx_shellfc_t*
  * \param[in,out] shellfc    The shell/flexible-constraint data, can be NULL
  */
 void mdAlgorithmsSetupAtomData(const t_commrec*     cr,
-                               const t_inputrec*    ir,
+                               const t_inputrec&    inputrec,
                                const gmx_mtop_t&    top_global,
                                gmx_localtop_t*      top,
                                t_forcerec*          fr,
index bf73b3b25fb25333ed07fa2b9c98625fa78f29e6..789dc73522f509487a8bf40d2c3bd80b97c4867b 100644 (file)
@@ -2672,7 +2672,7 @@ void reset_dd_statistics_counters(gmx_domdec_t* dd)
     comm->load_pme = 0;
 }
 
-void print_dd_statistics(const t_commrec* cr, const t_inputrec* ir, FILE* fplog)
+void print_dd_statistics(const t_commrec* cr, const t_inputrec& inputrec, FILE* fplog)
 {
     gmx_domdec_comm_t* comm = cr->dd->comm;
 
@@ -2700,7 +2700,8 @@ void print_dd_statistics(const t_commrec* cr, const t_inputrec* ir, FILE* fplog)
                 {
                     fprintf(fplog,
                             " av. #atoms communicated per step for vsites: %d x %.1f\n",
-                            (EEL_PME(ir->coulombtype) || ir->coulombtype == CoulombInteractionType::Ewald)
+                            (EEL_PME(inputrec.coulombtype)
+                             || inputrec.coulombtype == CoulombInteractionType::Ewald)
                                     ? 3
                                     : 2,
                             av);
@@ -2711,7 +2712,7 @@ void print_dd_statistics(const t_commrec* cr, const t_inputrec* ir, FILE* fplog)
                 {
                     fprintf(fplog,
                             " av. #atoms communicated per step for LINCS:  %d x %.1f\n",
-                            1 + ir->nLincsIter,
+                            1 + inputrec.nLincsIter,
                             av);
                 }
                 break;
@@ -2720,7 +2721,7 @@ void print_dd_statistics(const t_commrec* cr, const t_inputrec* ir, FILE* fplog)
     }
     fprintf(fplog, "\n");
 
-    if (comm->ddSettings.recordLoad && EI_DYNAMICS(ir->eI))
+    if (comm->ddSettings.recordLoad && EI_DYNAMICS(inputrec.eI))
     {
         print_dd_load_av(fplog, cr->dd);
     }
@@ -2735,7 +2736,7 @@ void dd_partition_system(FILE*                     fplog,
                          int                       nstglobalcomm,
                          t_state*                  state_global,
                          const gmx_mtop_t&         top_global,
-                         const t_inputrec*         ir,
+                         const t_inputrec&         inputrec,
                          gmx::ImdSession*          imdSession,
                          pull_t*                   pull_work,
                          t_state*                  state_local,
@@ -2768,8 +2769,8 @@ void dd_partition_system(FILE*                     fplog,
 
     // TODO if the update code becomes accessible here, use
     // upd->deform for this logic.
-    bBoxChanged = (bMasterState || inputrecDeform(ir));
-    if (ir->epc != PressureCoupling::No)
+    bBoxChanged = (bMasterState || inputrecDeform(&inputrec));
+    if (inputrec.epc != PressureCoupling::No)
     {
         /* With nstpcouple > 1 pressure coupling happens.
          * one step after calculating the pressure.
@@ -2780,7 +2781,7 @@ void dd_partition_system(FILE*                     fplog,
          * We need to determine the last step in which p-coupling occurred.
          * MRS -- need to validate this for vv?
          */
-        int n = ir->nstpcouple;
+        int n = inputrec.nstpcouple;
         if (n == 1)
         {
             step_pcoupl = step - 1;
@@ -2807,7 +2808,7 @@ void dd_partition_system(FILE*                     fplog,
          * Since it requires (possibly expensive) global communication,
          * we might want to do DLB less frequently.
          */
-        if (bBoxChanged || ir->epc != PressureCoupling::No)
+        if (bBoxChanged || inputrec.epc != PressureCoupling::No)
         {
             bDoDLB = bBoxChanged;
         }
@@ -2823,14 +2824,15 @@ void dd_partition_system(FILE*                     fplog,
         bCheckWhetherToTurnDlbOn = dd_dlb_get_should_check_whether_to_turn_dlb_on(dd);
 
         /* Print load every nstlog, first and last step to the log file */
-        bLogLoad = ((ir->nstlog > 0 && step % ir->nstlog == 0) || comm->n_load_collect == 0
-                    || (ir->nsteps >= 0 && (step + ir->nstlist > ir->init_step + ir->nsteps)));
+        bLogLoad = ((inputrec.nstlog > 0 && step % inputrec.nstlog == 0) || comm->n_load_collect == 0
+                    || (inputrec.nsteps >= 0
+                        && (step + inputrec.nstlist > inputrec.init_step + inputrec.nsteps)));
 
         /* Avoid extra communication due to verbose screen output
          * when nstglobalcomm is set.
          */
         if (bDoDLB || bLogLoad || bCheckWhetherToTurnDlbOn
-            || (bVerbose && (ir->nstlist == 0 || nstglobalcomm <= ir->nstlist)))
+            || (bVerbose && (inputrec.nstlist == 0 || nstglobalcomm <= inputrec.nstlist)))
         {
             get_load_distribution(dd, wcycle);
             if (DDMASTER(dd))
@@ -3143,7 +3145,7 @@ void dd_partition_system(FILE*                     fplog,
         /* With the group scheme the sorting array is part of the DD state,
          * but it just got out of sync, so mark as invalid by emptying it.
          */
-        if (ir->cutoff_scheme == CutoffScheme::Group)
+        if (inputrec.cutoff_scheme == CutoffScheme::Group)
         {
             comm->sort->sorted.clear();
         }
@@ -3225,10 +3227,10 @@ void dd_partition_system(FILE*                     fplog,
                     /* Only for inter-cg constraints we need special code */
                     n = dd_make_local_constraints(dd,
                                                   n,
-                                                  &top_global,
+                                                  top_global,
                                                   fr->cginfo.data(),
                                                   constr,
-                                                  ir->nProjOrder,
+                                                  inputrec.nProjOrder,
                                                   top_local->idef.il);
                 }
                 break;
@@ -3254,7 +3256,7 @@ void dd_partition_system(FILE*                     fplog,
     }
     else
     {
-        if (EEL_FULL(ir->coulombtype) && dd->haveExclusions)
+        if (EEL_FULL(inputrec.coulombtype) && dd->haveExclusions)
         {
             nat_f_novirsum = comm->atomRanges.end(DDAtomRanges::Type::Zones);
         }
@@ -3276,7 +3278,7 @@ void dd_partition_system(FILE*                     fplog,
                         nat_f_novirsum);
 
     /* Update atom data for mdatoms and several algorithms */
-    mdAlgorithmsSetupAtomData(cr, ir, top_global, top_local, fr, f, mdAtoms, constr, vsite, nullptr);
+    mdAlgorithmsSetupAtomData(cr, inputrec, top_global, top_local, fr, f, mdAtoms, constr, vsite, nullptr);
 
     auto mdatoms = mdAtoms->mdatoms();
     if (!thisRankHasDuty(cr, DUTY_PME))
@@ -3303,7 +3305,7 @@ void dd_partition_system(FILE*                     fplog,
     }
 
     // The pull group construction can need the atom sets updated above
-    if (ir->bPull)
+    if (inputrec.bPull)
     {
         /* Update the local pull groups */
         dd_make_local_pull_groups(cr, pull_work);
@@ -3331,7 +3333,7 @@ void dd_partition_system(FILE*                     fplog,
         write_dd_pdb("dd_dump",
                      step,
                      "dump",
-                     &top_global,
+                     top_global,
                      cr,
                      -1,
                      state_local->x.rvec_array(),
@@ -3366,7 +3368,7 @@ void dd_partition_system(FILE*                     fplog,
 void checkNumberOfBondedInteractions(const gmx::MDLogger&           mdlog,
                                      t_commrec*                     cr,
                                      int                            totalNumberOfBondedInteractions,
-                                     const gmx_mtop_t*              top_global,
+                                     const gmx_mtop_t&              top_global,
                                      const gmx_localtop_t*          top_local,
                                      gmx::ArrayRef<const gmx::RVec> x,
                                      const matrix                   box,
index de05c4a73847b7cebcb1f9cd78892d2074085e0d..da3c066737a86ade3a8ce1c8866d5a4abd9c9891 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
@@ -79,7 +79,7 @@ class VirtualSitesHandler;
 bool check_grid_jump(int64_t step, const gmx_domdec_t* dd, real cutoff, const gmx_ddbox_t* ddbox, gmx_bool bFatal);
 
 /*! \brief Print statistics for domain decomposition communication */
-void print_dd_statistics(const t_commrec* cr, const t_inputrec* ir, FILE* fplog);
+void print_dd_statistics(const t_commrec* cr, const t_inputrec& inputrec, FILE* fplog);
 
 /*! \brief Partition the system over the nodes.
  *
@@ -96,7 +96,7 @@ void print_dd_statistics(const t_commrec* cr, const t_inputrec* ir, FILE* fplog)
  * \param[in] nstglobalcomm Will globals be computed on this step
  * \param[in] state_global  Global state
  * \param[in] top_global    Global topology
- * \param[in] ir            Input record
+ * \param[in] inputrec      Input record
  * \param[in] imdSession    IMD handle
  * \param[in] pull_work     Pulling data
  * \param[in] state_local   Local state
@@ -118,7 +118,7 @@ void dd_partition_system(FILE*                     fplog,
                          int                       nstglobalcomm,
                          t_state*                  state_global,
                          const gmx_mtop_t&         top_global,
-                         const t_inputrec*         ir,
+                         const t_inputrec&         inputrec,
                          gmx::ImdSession*          imdSession,
                          pull_t*                   pull_work,
                          t_state*                  state_local,
@@ -146,7 +146,7 @@ void dd_partition_system(FILE*                     fplog,
 void checkNumberOfBondedInteractions(const gmx::MDLogger&           mdlog,
                                      t_commrec*                     cr,
                                      int                            totalNumberOfBondedInteractions,
-                                     const gmx_mtop_t*              top_global,
+                                     const gmx_mtop_t&              top_global,
                                      const gmx_localtop_t*          top_local,
                                      gmx::ArrayRef<const gmx::RVec> x,
                                      const matrix                   box,
index 2b92b3fd970ccfe1ea7d4e2fc004d4509bf0e697..b1d3b76c69c15417d6b21559b379aed919e195f3 100644 (file)
@@ -204,7 +204,7 @@ void integrateVVFirstStep(int64_t                   step,
             checkNumberOfBondedInteractions(mdlog,
                                             cr,
                                             totalNumberOfBondedInteractions,
-                                            top_global,
+                                            *top_global,
                                             &top,
                                             makeConstArrayRef(state->x),
                                             state->box,
index fe3b1423ff8a1a7a59efd78fadc02f0cec680d3a..de642b84de9ceafad7beddb478051e32c11be9b3 100644 (file)
@@ -384,7 +384,7 @@ void gmx::LegacySimulator::do_md()
                             1,
                             state_global,
                             *top_global,
-                            ir,
+                            *ir,
                             imdSession,
                             pull_work,
                             state,
@@ -407,7 +407,7 @@ void gmx::LegacySimulator::do_md()
         state = state_global;
 
         /* Generate and initialize new topology */
-        mdAlgorithmsSetupAtomData(cr, ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
+        mdAlgorithmsSetupAtomData(cr, *ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
 
         upd.setNumAtoms(state->natoms);
     }
@@ -691,7 +691,7 @@ void gmx::LegacySimulator::do_md()
     checkNumberOfBondedInteractions(mdlog,
                                     cr,
                                     totalNumberOfBondedInteractions,
-                                    top_global,
+                                    *top_global,
                                     &top,
                                     makeConstArrayRef(state->x),
                                     state->box,
@@ -1002,7 +1002,7 @@ void gmx::LegacySimulator::do_md()
                                     nstglobalcomm,
                                     state_global,
                                     *top_global,
-                                    ir,
+                                    *ir,
                                     imdSession,
                                     pull_work,
                                     state,
@@ -1071,7 +1071,7 @@ void gmx::LegacySimulator::do_md()
             checkNumberOfBondedInteractions(mdlog,
                                             cr,
                                             totalNumberOfBondedInteractions,
-                                            top_global,
+                                            *top_global,
                                             &top,
                                             makeConstArrayRef(state->x),
                                             state->box,
@@ -1647,7 +1647,7 @@ void gmx::LegacySimulator::do_md()
                 checkNumberOfBondedInteractions(mdlog,
                                                 cr,
                                                 totalNumberOfBondedInteractions,
-                                                top_global,
+                                                *top_global,
                                                 &top,
                                                 makeConstArrayRef(state->x),
                                                 state->box,
@@ -1891,7 +1891,7 @@ void gmx::LegacySimulator::do_md()
                                 1,
                                 state_global,
                                 *top_global,
-                                ir,
+                                *ir,
                                 imdSession,
                                 pull_work,
                                 state,
index e258a8a2c5d6f76deff0eec9d2d85be416b3e41f..a06cca33b12ff8c26c5a5744c3c10bd7dc29e880 100644 (file)
@@ -303,7 +303,7 @@ void gmx::LegacySimulator::do_mimic()
                             1,
                             state_global,
                             *top_global,
-                            ir,
+                            *ir,
                             imdSession,
                             pull_work,
                             state,
@@ -324,7 +324,7 @@ void gmx::LegacySimulator::do_mimic()
         /* Copy the pointer to the global state */
         state = state_global;
 
-        mdAlgorithmsSetupAtomData(cr, ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
+        mdAlgorithmsSetupAtomData(cr, *ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
     }
 
     auto mdatoms = mdAtoms->mdatoms();
@@ -374,7 +374,7 @@ void gmx::LegacySimulator::do_mimic()
     checkNumberOfBondedInteractions(mdlog,
                                     cr,
                                     totalNumberOfBondedInteractions,
-                                    top_global,
+                                    *top_global,
                                     &top,
                                     makeConstArrayRef(state->x),
                                     state->box,
@@ -489,7 +489,7 @@ void gmx::LegacySimulator::do_mimic()
                                 nstglobalcomm,
                                 state_global,
                                 *top_global,
-                                ir,
+                                *ir,
                                 imdSession,
                                 pull_work,
                                 state,
@@ -662,7 +662,7 @@ void gmx::LegacySimulator::do_mimic()
             checkNumberOfBondedInteractions(mdlog,
                                             cr,
                                             totalNumberOfBondedInteractions,
-                                            top_global,
+                                            *top_global,
                                             &top,
                                             makeConstArrayRef(state->x),
                                             state->box,
index 102b4393c7d5c2525eae153632a993f7345d2f56..9563ac5c94ee87aa1dd99682e4372d75f68c2def 100644 (file)
@@ -435,7 +435,7 @@ static void init_em(FILE*                fplog,
                             1,
                             state_global,
                             *top_global,
-                            ir,
+                            *ir,
                             imdSession,
                             pull_work,
                             &ems->s,
@@ -458,7 +458,7 @@ static void init_em(FILE*                fplog,
         state_change_natoms(&ems->s, ems->s.natoms);
 
         mdAlgorithmsSetupAtomData(
-                cr, ir, *top_global, top, fr, &ems->f, mdAtoms, constr, vsite, shellfc ? *shellfc : nullptr);
+                cr, *ir, *top_global, top, fr, &ems->f, mdAtoms, constr, vsite, shellfc ? *shellfc : nullptr);
     }
 
     update_mdatoms(mdAtoms->mdatoms(), ems->s.lambda[FreeEnergyPerturbationCouplingType::Mass]);
@@ -803,7 +803,7 @@ static void em_dd_partition_system(FILE*                fplog,
                         1,
                         nullptr,
                         *top_global,
-                        ir,
+                        *ir,
                         imdSession,
                         pull_work,
                         &ems->s,
index 69bf4d661af0a539569be3eb1cd85d0c3c50e67e..c9700481d15027cd3b9d98d0df358888ddceddee 100644 (file)
@@ -347,7 +347,7 @@ void gmx::LegacySimulator::do_rerun()
                             1,
                             state_global,
                             *top_global,
-                            ir,
+                            *ir,
                             imdSession,
                             pull_work,
                             state,
@@ -368,7 +368,7 @@ void gmx::LegacySimulator::do_rerun()
         /* Copy the pointer to the global state */
         state = state_global;
 
-        mdAlgorithmsSetupAtomData(cr, ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
+        mdAlgorithmsSetupAtomData(cr, *ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
     }
 
     auto mdatoms = mdAtoms->mdatoms();
@@ -418,7 +418,7 @@ void gmx::LegacySimulator::do_rerun()
     checkNumberOfBondedInteractions(mdlog,
                                     cr,
                                     totalNumberOfBondedInteractions,
-                                    top_global,
+                                    *top_global,
                                     &top,
                                     makeConstArrayRef(state->x),
                                     state->box,
@@ -599,7 +599,7 @@ void gmx::LegacySimulator::do_rerun()
                                 nstglobalcomm,
                                 state_global,
                                 *top_global,
-                                ir,
+                                *ir,
                                 imdSession,
                                 pull_work,
                                 state,
@@ -772,7 +772,7 @@ void gmx::LegacySimulator::do_rerun()
             checkNumberOfBondedInteractions(mdlog,
                                             cr,
                                             totalNumberOfBondedInteractions,
-                                            top_global,
+                                            *top_global,
                                             &top,
                                             makeConstArrayRef(state->x),
                                             state->box,
index 350ace3f2f7b8fc59c3b98b97f4334c40626628c..5d3738967031ce4f5aa2c6c8d32dd76b17c9e383 100644 (file)
@@ -597,7 +597,7 @@ static TaskTarget findTaskTarget(const char* optionString)
 static void finish_run(FILE*                     fplog,
                        const gmx::MDLogger&      mdlog,
                        const t_commrec*          cr,
-                       const t_inputrec*         inputrec,
+                       const t_inputrec&         inputrec,
                        t_nrnb                    nrnb[],
                        gmx_wallcycle_t           wcycle,
                        gmx_walltime_accounting_t walltime_accounting,
@@ -622,7 +622,7 @@ static void finish_run(FILE*                     fplog,
        Further, we only report performance for dynamical integrators,
        because those are the only ones for which we plan to
        consider doing any optimizations. */
-    bool printReport = EI_DYNAMICS(inputrec->eI) && SIMMASTER(cr);
+    bool printReport = EI_DYNAMICS(inputrec.eI) && SIMMASTER(cr);
 
     if (printReport && !walltime_accounting_get_valid_finish(walltime_accounting))
     {
@@ -714,9 +714,9 @@ static void finish_run(FILE*                     fplog,
                         nbnxn_gpu_timings,
                         &pme_gpu_timings);
 
-        if (EI_DYNAMICS(inputrec->eI))
+        if (EI_DYNAMICS(inputrec.eI))
         {
-            delta_t = inputrec->delta_t;
+            delta_t = inputrec.delta_t;
         }
 
         if (fplog)
@@ -1893,7 +1893,7 @@ int Mdrunner::mdrunner()
                             cr->dd,
                             mtop,
                             vsite.get(),
-                            inputrec.get(),
+                            *inputrec,
                             domdecOptions.checkBondedInteractions ? DDBondedChecking::All
                                                                   : DDBondedChecking::ExcludeZeroLimit,
                             fr->cginfo_mb);
@@ -1992,7 +1992,7 @@ int Mdrunner::mdrunner()
     finish_run(fplog,
                mdlog,
                cr,
-               inputrec.get(),
+               *inputrec,
                &nrnb,
                wcycle,
                walltime_accounting,
index 1d59ae9063065f5f03e88b3a02709e4e9044296c..f5f4e674704be0e06de2c6b698cd6e9e6de52bea 100644 (file)
@@ -309,7 +309,7 @@ void ComputeGlobalsElement<algorithm>::compute(gmx::Step            step,
             energyData_->needToSumEkinhOld(),
             flags | (shouldCheckNumberOfBondedInteractions_ ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0));
     checkNumberOfBondedInteractions(
-            mdlog_, cr_, totalNumberOfBondedInteractions_, top_global_, localTopology_, x, box, &shouldCheckNumberOfBondedInteractions_);
+            mdlog_, cr_, totalNumberOfBondedInteractions_, *top_global_, localTopology_, x, box, &shouldCheckNumberOfBondedInteractions_);
     if (flags & CGLO_STOPCM && !isInit)
     {
         process_and_stopcm_grp(fplog_, &vcm_, *mdAtoms_->mdatoms(), x, v);
index 204a031ddccc25c5e78c9c42d92b0d397325d3a3..a55426cf09e082d28a80abbb5271b391a8fcdb44 100644 (file)
@@ -166,7 +166,7 @@ void DomDecHelper::partitionSystem(bool                     verbose,
                         nstglobalcomm,
                         globalState,
                         topologyHolder_->globalTopology(),
-                        inputrec_,
+                        *inputrec_,
                         imdSession_,
                         pull_work_,
                         localState.get(),
index 87e647bd54daab7d8c8dacff7022cefccfec46be..bbef75bad29a492de2550ede9f0b69fce9f4fe7c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, 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.
@@ -71,7 +71,7 @@ TopologyHolder::TopologyHolder(std::vector<ITopologyHolderClient*> clients,
         //       TopologyHolder has no access to the forces, so we are passing a nullptr
         //       TODO: Find a unique approach to resizing the forces in modular simulator (#3461)
         mdAlgorithmsSetupAtomData(
-                cr, inputrec, globalTopology, localTopology_.get(), fr, nullptr, mdAtoms, constr, vsite, nullptr);
+                cr, *inputrec, globalTopology, localTopology_.get(), fr, nullptr, mdAtoms, constr, vsite, nullptr);
     }
     // Send copy of initial topology to clients
     updateLocalTopology();