Use consistent naming for update groups
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 21 Apr 2021 08:02:09 +0000 (10:02 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 21 Apr 2021 08:14:41 +0000 (10:14 +0200)
Prepares to introduce an UpdateGroups class that contains the groupings

Refs #4004

src/gromacs/domdec/distribute.cpp
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec.h
src/gromacs/domdec/domdec_internal.h
src/gromacs/mdlib/updategroupscog.cpp
src/gromacs/mdlib/updategroupscog.h
src/gromacs/mdlib/vsite.cpp
src/gromacs/mdlib/vsite.h

index 9adb561d415741a49d1ff1bb93507fb5334624bc..9cff8a7376d189814a2af0066dd77e6854be14c4 100644 (file)
@@ -406,7 +406,7 @@ static std::vector<std::vector<int>> getAtomGroupDistribution(const gmx::MDLogge
         for (const gmx_molblock_t& molblock : mtop.molblock)
         {
             const auto& updateGrouping =
-                    dd->comm->systemInfo.updateGroupingPerMoleculetype[molblock.type];
+                    dd->comm->systemInfo.updateGroupingsPerMoleculeType[molblock.type];
 
             for (int mol = 0; mol < molblock.nmol; mol++)
             {
index be76b4852db58fdd571c70b2c5c118542b6de58b..c9480b794726a5d4e886661995e57375aa2adb82 100644 (file)
@@ -206,10 +206,10 @@ int ddglatnr(const gmx_domdec_t* dd, int i)
     return atnr;
 }
 
-gmx::ArrayRef<const gmx::RangePartitioning> getUpdateGroupingPerMoleculetype(const gmx_domdec_t& dd)
+gmx::ArrayRef<const gmx::RangePartitioning> getUpdateGroupingsPerMoleculeType(const gmx_domdec_t& dd)
 {
     GMX_RELEASE_ASSERT(dd.comm, "Need a valid dd.comm");
-    return dd.comm->systemInfo.updateGroupingPerMoleculetype;
+    return dd.comm->systemInfo.updateGroupingsPerMoleculeType;
 }
 
 void dd_store_state(const gmx_domdec_t& dd, t_state* state)
@@ -1939,8 +1939,8 @@ static void setupUpdateGroups(const gmx::MDLogger& mdlog,
         return;
     }
 
-    systemInfo->updateGroupingPerMoleculetype = gmx::makeUpdateGroups(mtop);
-    systemInfo->useUpdateGroups               = (!systemInfo->updateGroupingPerMoleculetype.empty()
+    systemInfo->updateGroupingsPerMoleculeType = gmx::makeUpdateGroups(mtop);
+    systemInfo->useUpdateGroups = (!systemInfo->updateGroupingsPerMoleculeType.empty()
                                    && getenv("GMX_NO_UPDATEGROUPS") == nullptr);
 
     if (systemInfo->useUpdateGroups)
@@ -1949,11 +1949,11 @@ static void setupUpdateGroups(const gmx::MDLogger& mdlog,
         for (const auto& molblock : mtop.molblock)
         {
             numUpdateGroups += molblock.nmol
-                               * systemInfo->updateGroupingPerMoleculetype[molblock.type].numBlocks();
+                               * systemInfo->updateGroupingsPerMoleculeType[molblock.type].numBlocks();
         }
 
         systemInfo->maxUpdateGroupRadius = computeMaxUpdateGroupRadius(
-                mtop, systemInfo->updateGroupingPerMoleculetype, maxReferenceTemperature(inputrec));
+                mtop, systemInfo->updateGroupingsPerMoleculeType, maxReferenceTemperature(inputrec));
 
         /* To use update groups, the large domain-to-domain cutoff distance
          * should be compatible with the box size.
@@ -1976,7 +1976,7 @@ static void setupUpdateGroups(const gmx::MDLogger& mdlog,
                     .appendTextFormatted(
                             "The combination of rlist and box size prohibits the use of update "
                             "groups\n");
-            systemInfo->updateGroupingPerMoleculetype.clear();
+            systemInfo->updateGroupingsPerMoleculeType.clear();
         }
     }
 }
@@ -1992,15 +1992,15 @@ UnitCellInfo::UnitCellInfo(const t_inputrec& ir) :
 /* Returns whether molecules are always whole, i.e. not broken by PBC */
 static bool moleculesAreAlwaysWhole(const gmx_mtop_t&                           mtop,
                                     const bool                                  useUpdateGroups,
-                                    gmx::ArrayRef<const gmx::RangePartitioning> updateGroupingPerMoleculetype)
+                                    gmx::ArrayRef<const gmx::RangePartitioning> updateGroupingsPerMoleculeType)
 {
     if (useUpdateGroups)
     {
-        GMX_RELEASE_ASSERT(updateGroupingPerMoleculetype.size() == mtop.moltype.size(),
+        GMX_RELEASE_ASSERT(updateGroupingsPerMoleculeType.size() == mtop.moltype.size(),
                            "Need one grouping per moltype");
         for (size_t mol = 0; mol < mtop.moltype.size(); mol++)
         {
-            if (updateGroupingPerMoleculetype[mol].numBlocks() > 1)
+            if (updateGroupingsPerMoleculeType[mol].numBlocks() > 1)
             {
                 return false;
             }
@@ -2043,7 +2043,7 @@ static DDSystemInfo getSystemInfo(const gmx::MDLogger&           mdlog,
     }
 
     systemInfo.moleculesAreAlwaysWhole = moleculesAreAlwaysWhole(
-            mtop, systemInfo.useUpdateGroups, systemInfo.updateGroupingPerMoleculetype);
+            mtop, systemInfo.useUpdateGroups, systemInfo.updateGroupingsPerMoleculeType);
     systemInfo.haveInterDomainBondeds =
             (!systemInfo.moleculesAreAlwaysWhole || mtop.bIntermolecularInteractions);
     systemInfo.haveInterDomainMultiBodyBondeds =
@@ -2088,7 +2088,7 @@ static DDSystemInfo getSystemInfo(const gmx::MDLogger&           mdlog,
      */
     constexpr real c_chanceThatAtomMovesBeyondDomain = 1e-12;
     const real     limitForAtomDisplacement          = minCellSizeForAtomDisplacement(
-            mtop, ir, systemInfo.updateGroupingPerMoleculetype, c_chanceThatAtomMovesBeyondDomain);
+            mtop, ir, systemInfo.updateGroupingsPerMoleculeType, c_chanceThatAtomMovesBeyondDomain);
     GMX_LOG(mdlog.info).appendTextFormatted("Minimum cell size due to atom displacement: %.3f nm", limitForAtomDisplacement);
 
     systemInfo.cellsizeLimit = std::max(systemInfo.cellsizeLimit, limitForAtomDisplacement);
@@ -2419,7 +2419,7 @@ static void set_dd_limits(const gmx::MDLogger& mdlog,
          */
         const int homeAtomCountEstimate = mtop.natoms / numPPRanks;
         comm->updateGroupsCog           = std::make_unique<gmx::UpdateGroupsCog>(
-                mtop, systemInfo.updateGroupingPerMoleculetype, maxReferenceTemperature(ir), homeAtomCountEstimate);
+                mtop, systemInfo.updateGroupingsPerMoleculeType, maxReferenceTemperature(ir), homeAtomCountEstimate);
     }
 
     /* Set the DD setup given by ddGridSetup */
@@ -2578,7 +2578,7 @@ static void writeSettings(gmx::TextWriter*   log,
     }
 
     const bool haveInterDomainVsites =
-            (countInterUpdategroupVsites(mtop, comm->systemInfo.updateGroupingPerMoleculetype) != 0);
+            (countInterUpdategroupVsites(mtop, comm->systemInfo.updateGroupingsPerMoleculeType) != 0);
 
     if (comm->systemInfo.haveInterDomainBondeds || haveInterDomainVsites
         || comm->systemInfo.haveSplitConstraints || comm->systemInfo.haveSplitSettles)
index 44094f0dc5f5e811e7b24f20fc5b7f6545c44abb..9b3d8c0e068c5493d0df916f4d4f15a001477365 100644 (file)
@@ -105,7 +105,7 @@ class ArrayRef;
 int ddglatnr(const gmx_domdec_t* dd, int i);
 
 /*! \brief Returns a list of update group partitioning for each molecule type or empty when update groups are not used */
-gmx::ArrayRef<const gmx::RangePartitioning> getUpdateGroupingPerMoleculetype(const gmx_domdec_t& dd);
+gmx::ArrayRef<const gmx::RangePartitioning> getUpdateGroupingsPerMoleculeType(const gmx_domdec_t& dd);
 
 /*! \brief Store the global cg indices of the home cgs in state,
  *
index c0fe8f1bb17c7c083953b2f27a002f02dea4f848..019fb362073da25b9e7eda427d3cfad1343bcd97 100644 (file)
@@ -423,7 +423,7 @@ struct DDSystemInfo
     //! True when update groups are used
     bool useUpdateGroups = false;
     //! Update atom grouping for each molecule type
-    std::vector<gmx::RangePartitioning> updateGroupingPerMoleculetype;
+    std::vector<gmx::RangePartitioning> updateGroupingsPerMoleculeType;
     //! The maximum radius over all update groups
     real maxUpdateGroupRadius;
 
index 58cfb7d8ae89a1b88f6127ced7ae2e4d5b22aebf..57755e79d25ed40b2e922a7d45b89e2ee28d9fac 100644 (file)
@@ -53,7 +53,7 @@ namespace gmx
 {
 
 UpdateGroupsCog::UpdateGroupsCog(const gmx_mtop_t&                           mtop,
-                                 gmx::ArrayRef<const gmx::RangePartitioning> updateGroupsPerMoleculetype,
+                                 gmx::ArrayRef<const gmx::RangePartitioning> updateGroupingsPerMoleculeType,
                                  real                                        temperature,
                                  int                                         numHomeAtoms) :
     globalToLocalMap_(numHomeAtoms),
@@ -62,7 +62,7 @@ UpdateGroupsCog::UpdateGroupsCog(const gmx_mtop_t&                           mto
     int firstUpdateGroupInMolecule = 0;
     for (const auto& molblock : mtop.molblock)
     {
-        const auto& updateGroups = updateGroupsPerMoleculetype[molblock.type];
+        const auto& updateGroups = updateGroupingsPerMoleculeType[molblock.type];
         indicesPerMoleculeblock_.push_back({ firstUpdateGroupInMolecule, updateGroups.numBlocks(), {} });
         auto& groupIndex = indicesPerMoleculeblock_.back().groupIndex_;
 
@@ -74,7 +74,7 @@ UpdateGroupsCog::UpdateGroupsCog(const gmx_mtop_t&                           mto
         firstUpdateGroupInMolecule += molblock.nmol * updateGroups.numBlocks();
     }
 
-    maxUpdateGroupRadius_ = computeMaxUpdateGroupRadius(mtop, updateGroupsPerMoleculetype, temperature);
+    maxUpdateGroupRadius_ = computeMaxUpdateGroupRadius(mtop, updateGroupingsPerMoleculeType, temperature);
 }
 
 void UpdateGroupsCog::addCogs(gmx::ArrayRef<const int>       globalAtomIndices,
index 65c6ac978d763184f3785c97df079fb3bffdfdb7..ca05d95814e911e8c96ef9dcf1aac0b636d490eb 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.
@@ -69,13 +69,13 @@ public:
      * \note \p numHomeAtoms only affects the performance up till the first
      *       call to clear().
      *
-     * \param[in] mtop                         The global topology
-     * \param[in] updateGroupsPerMoleculetype  List of update groups for each molecule type in \p mtop
-     * \param[in] temperature                  The maximum reference temperature, pass -1 when unknown or not applicable
-     * \param[in] numHomeAtoms                 Estimate of the number of home atoms per DD cell
+     * \param[in] mtop                            The global topology
+     * \param[in] updateGroupingsPerMoleculeType  List of update groups for each molecule type in \p mtop
+     * \param[in] temperature                     The maximum reference temperature, pass -1 when unknown or not applicable
+     * \param[in] numHomeAtoms                    Estimate of the number of home atoms per DD cell
      */
     UpdateGroupsCog(const gmx_mtop_t&                           mtop,
-                    gmx::ArrayRef<const gmx::RangePartitioning> updateGroupsPerMoleculetype,
+                    gmx::ArrayRef<const gmx::RangePartitioning> updateGroupingsPerMoleculeType,
                     real                                        temperature,
                     int                                         numHomeAtoms);
 
index 1133c538c86d183df3de707100ea96a5abf91a13..8621154d7f7d60b154ce52f9d20549516b251a16 100644 (file)
@@ -2530,7 +2530,7 @@ void VirtualSitesHandler::spreadForces(ArrayRef<const RVec> x,
 }
 
 int countInterUpdategroupVsites(const gmx_mtop_t&                           mtop,
-                                gmx::ArrayRef<const gmx::RangePartitioning> updateGroupingPerMoleculetype)
+                                gmx::ArrayRef<const gmx::RangePartitioning> updateGroupingsPerMoleculeType)
 {
     int n_intercg_vsite = 0;
     for (const gmx_molblock_t& molb : mtop.molblock)
@@ -2538,9 +2538,9 @@ int countInterUpdategroupVsites(const gmx_mtop_t&                           mtop
         const gmx_moltype_t& molt = mtop.moltype[molb.type];
 
         std::vector<int> atomToGroup;
-        if (!updateGroupingPerMoleculetype.empty())
+        if (!updateGroupingsPerMoleculeType.empty())
         {
-            atomToGroup = makeAtomToGroupMapping(updateGroupingPerMoleculetype[molb.type]);
+            atomToGroup = makeAtomToGroupMapping(updateGroupingsPerMoleculeType[molb.type]);
         }
         for (int ftype = c_ftypeVsiteStart; ftype < c_ftypeVsiteEnd; ftype++)
         {
@@ -2635,13 +2635,13 @@ ThreadingInfo::ThreadingInfo() : numThreads_(gmx_omp_nthreads_get(ModuleMultiThr
 //! Returns the number of inter update-group vsites
 static int getNumInterUpdategroupVsites(const gmx_mtop_t& mtop, const gmx_domdec_t* domdec)
 {
-    gmx::ArrayRef<const gmx::RangePartitioning> updateGroupingPerMoleculetype;
+    gmx::ArrayRef<const gmx::RangePartitioning> updateGroupingsPerMoleculeType;
     if (domdec)
     {
-        updateGroupingPerMoleculetype = getUpdateGroupingPerMoleculetype(*domdec);
+        updateGroupingsPerMoleculeType = getUpdateGroupingsPerMoleculeType(*domdec);
     }
 
-    return countInterUpdategroupVsites(mtop, updateGroupingPerMoleculetype);
+    return countInterUpdategroupVsites(mtop, updateGroupingsPerMoleculeType);
 }
 
 VirtualSitesHandler::Impl::Impl(const gmx_mtop_t& mtop, gmx_domdec_t* domdec, const PbcType pbcType) :
index 32e851c8cc9106fe7729b47e27fc28e8b0f2dd07..f6a4807b7fc2412b14a108f424c691ab82d384d2 100644 (file)
@@ -180,10 +180,10 @@ int countNonlinearVsites(const gmx_mtop_t& mtop);
 /*! \brief Return the number of virtual sites that cross update groups
  *
  * \param[in] mtop                           The global topology
- * \param[in] updateGroupingPerMoleculetype  Update grouping per molecule type, pass empty when not using update groups
+ * \param[in] updateGroupingsPerMoleculeType  Update grouping per molecule type, pass empty when not using update groups
  */
 int countInterUpdategroupVsites(const gmx_mtop_t&                 mtop,
-                                ArrayRef<const RangePartitioning> updateGroupingPerMoleculetype);
+                                ArrayRef<const RangePartitioning> updateGroupingsPerMoleculeType);
 
 /*! \brief Create the virtual site handler
  *