Make .rtp/.tdb bond types into enum class
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / gen_ad.cpp
index 36d11e229608380c714affd3b9331ad804e98e30..643963f73d1748a73fae6ada581b396731f2528e 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2017 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.
@@ -349,7 +349,7 @@ static std::vector<InteractionOfType> get_impropers(t_atoms*
     {
         for (int i = 0; (i < atoms->nres); i++)
         {
-            BondedInteractionList* impropers = &globalPatches[i].rb[ebtsIDIHS];
+            BondedInteractionList* impropers = &globalPatches[i].rb[BondedTypes::ImproperDihedrals];
             for (const auto& bondeds : impropers->b)
             {
                 bool             bStop = false;
@@ -453,7 +453,7 @@ static void gen_excls(t_atoms*                             atoms,
         int r = atoms->atom[a].resind;
         if (a == atoms->nr - 1 || atoms->atom[a + 1].resind != r)
         {
-            BondedInteractionList* hbexcl = &globalPatches[r].rb[ebtsEXCLS];
+            BondedInteractionList* hbexcl = &globalPatches[r].rb[BondedTypes::Exclusions];
 
             for (const auto& bondeds : hbexcl->b)
             {
@@ -607,9 +607,9 @@ void gen_pad(t_atoms*                               atoms,
         /* mark all entries as not matched yet */
         for (int i = 0; i < atoms->nres; i++)
         {
-            for (int j = 0; j < ebtsNR; j++)
+            for (auto bondedsList : globalPatches[i].rb)
             {
-                for (auto& bondeds : globalPatches[i].rb[j].b)
+                for (auto& bondeds : bondedsList.b)
                 {
                     bondeds.match = false;
                 }
@@ -651,7 +651,7 @@ void gen_pad(t_atoms*                               atoms,
                             {
                                 res += maxres - minres;
                                 get_atomnames_min(3, anm, res, atoms, atomNumbers);
-                                BondedInteractionList* hbang = &globalPatches[res].rb[ebtsANGLES];
+                                BondedInteractionList* hbang = &globalPatches[res].rb[BondedTypes::Angles];
                                 for (auto& bondeds : hbang->b)
                                 {
                                     if (anm[1] == bondeds.aj())
@@ -702,7 +702,8 @@ void gen_pad(t_atoms*                               atoms,
                                     {
                                         res += maxres - minres;
                                         get_atomnames_min(4, anm, res, atoms, atomNumbers);
-                                        BondedInteractionList* hbdih = &globalPatches[res].rb[ebtsPDIHS];
+                                        BondedInteractionList* hbdih =
+                                                &globalPatches[res].rb[BondedTypes::ProperDihedrals];
                                         for (auto& bondeds : hbdih->b)
                                         {
                                             bool bFound = false;
@@ -775,7 +776,7 @@ void gen_pad(t_atoms*                               atoms,
         for (int i = 0; i < atoms->nres; i++)
         {
             /* Add remaining angles from hackblock */
-            BondedInteractionList* hbang = &globalPatches[i].rb[ebtsANGLES];
+            BondedInteractionList* hbang = &globalPatches[i].rb[BondedTypes::Angles];
             for (auto& bondeds : hbang->b)
             {
                 if (bondeds.match)
@@ -826,7 +827,7 @@ void gen_pad(t_atoms*                               atoms,
             }
 
             /* Add remaining dihedrals from hackblock */
-            BondedInteractionList* hbdih = &globalPatches[i].rb[ebtsPDIHS];
+            BondedInteractionList* hbdih = &globalPatches[i].rb[BondedTypes::ProperDihedrals];
             for (auto& bondeds : hbdih->b)
             {
                 if (bondeds.match)