Refactor t_pindex
authorPaul Bauer <paul.bauer.q@gmail.com>
Tue, 12 Mar 2019 11:17:11 +0000 (12:17 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 16 Apr 2019 12:52:10 +0000 (14:52 +0200)
Also change naming of containers for interaction types to better reflect
what is actually stored in the container.

Refs #2833

Change-Id: I581fb2a436528c00770b98ba6e5d45af7c7d9a0c

32 files changed:
src/gromacs/gmxpreprocess/add_par.cpp
src/gromacs/gmxpreprocess/add_par.h
src/gromacs/gmxpreprocess/convparm.cpp
src/gromacs/gmxpreprocess/convparm.h
src/gromacs/gmxpreprocess/gen_ad.cpp
src/gromacs/gmxpreprocess/gen_ad.h
src/gromacs/gmxpreprocess/gen_vsite.cpp
src/gromacs/gmxpreprocess/gen_vsite.h
src/gromacs/gmxpreprocess/gpp_atomtype.cpp
src/gromacs/gmxpreprocess/gpp_atomtype.h
src/gromacs/gmxpreprocess/gpp_nextnb.cpp
src/gromacs/gmxpreprocess/gpp_nextnb.h
src/gromacs/gmxpreprocess/grompp.cpp
src/gromacs/gmxpreprocess/grompp_impl.h
src/gromacs/gmxpreprocess/nm2type.cpp
src/gromacs/gmxpreprocess/nm2type.h
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/gmxpreprocess/pdb2top.h
src/gromacs/gmxpreprocess/resall.cpp
src/gromacs/gmxpreprocess/tests/gpp_atomtype.cpp
src/gromacs/gmxpreprocess/tomorse.cpp
src/gromacs/gmxpreprocess/topio.cpp
src/gromacs/gmxpreprocess/topio.h
src/gromacs/gmxpreprocess/toppush.cpp
src/gromacs/gmxpreprocess/toppush.h
src/gromacs/gmxpreprocess/topshake.cpp
src/gromacs/gmxpreprocess/topshake.h
src/gromacs/gmxpreprocess/toputil.cpp
src/gromacs/gmxpreprocess/toputil.h
src/gromacs/gmxpreprocess/vsite_parm.cpp
src/gromacs/gmxpreprocess/vsite_parm.h
src/gromacs/gmxpreprocess/x2top.cpp

index 046eecceb57405d748b9fa72dde087360d6ed150..7d220c170764afe41f2a13afd07749b7f49bff08 100644 (file)
@@ -52,7 +52,7 @@
 
 #include "hackblock.h"
 
-void add_param(InteractionTypeParameters *ps,
+void add_param(InteractionsOfType        *ps,
                int                        ai,
                int                        aj,
                gmx::ArrayRef<const real>  c,
@@ -65,56 +65,56 @@ void add_param(InteractionTypeParameters *ps,
     std::vector<int>  atoms = {ai, aj};
     std::vector<real> forceParm(c.begin(), c.end());
 
-    ps->interactionTypes.emplace_back(InteractionType(atoms, forceParm, s ? s : ""));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, forceParm, s ? s : ""));
 }
 
-void add_imp_param(InteractionTypeParameters *ps, int ai, int aj, int ak, int al, real c0, real c1,
+void add_imp_param(InteractionsOfType *ps, int ai, int aj, int ak, int al, real c0, real c1,
                    const char *s)
 {
     std::vector<int>  atoms     = {ai, aj, ak, al};
     std::vector<real> forceParm = {c0, c1};
-    ps->interactionTypes.emplace_back(InteractionType(atoms, forceParm, s ? s : ""));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, forceParm, s ? s : ""));
 }
 
-void add_dih_param(InteractionTypeParameters *ps, int ai, int aj, int ak, int al, real c0, real c1,
+void add_dih_param(InteractionsOfType *ps, int ai, int aj, int ak, int al, real c0, real c1,
                    real c2, const char *s)
 {
     std::vector<int>  atoms     = {ai, aj, ak, al};
     std::vector<real> forceParm = {c0, c1, c2};
-    ps->interactionTypes.emplace_back(InteractionType(atoms, forceParm, s ? s : ""));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, forceParm, s ? s : ""));
 }
 
-void add_cmap_param(InteractionTypeParameters *ps, int ai, int aj, int ak, int al, int am, const char *s)
+void add_cmap_param(InteractionsOfType *ps, int ai, int aj, int ak, int al, int am, const char *s)
 {
     std::vector<int> atoms = {ai, aj, ak, al, am};
-    ps->interactionTypes.emplace_back(InteractionType(atoms, {}, s ? s : ""));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, {}, s ? s : ""));
 }
 
-void add_vsite2_atoms(InteractionTypeParameters *ps, int ai, int aj, int ak)
+void add_vsite2_atoms(InteractionsOfType *ps, int ai, int aj, int ak)
 {
     std::vector<int> atoms = {ai, aj, ak};
-    ps->interactionTypes.emplace_back(InteractionType(atoms, {}));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, {}));
 }
 
-void add_vsite2_param(InteractionTypeParameters *ps, int ai, int aj, int ak, real c0)
+void add_vsite2_param(InteractionsOfType *ps, int ai, int aj, int ak, real c0)
 {
     std::vector<int>  atoms     = {ai, aj, ak};
     std::vector<real> forceParm = {c0};
-    ps->interactionTypes.emplace_back(InteractionType(atoms, forceParm));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, forceParm));
 }
 
-void add_vsite3_param(InteractionTypeParameters *ps, int ai, int aj, int ak, int al,
+void add_vsite3_param(InteractionsOfType *ps, int ai, int aj, int ak, int al,
                       real c0, real c1)
 {
     std::vector<int>  atoms     = {ai, aj, ak, al};
     std::vector<real> forceParm = {c0, c1};
-    ps->interactionTypes.emplace_back(InteractionType(atoms, forceParm));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, forceParm));
 }
 
-void add_vsite3_atoms(InteractionTypeParameters *ps, int ai, int aj, int ak, int al, bool bSwapParity)
+void add_vsite3_atoms(InteractionsOfType *ps, int ai, int aj, int ak, int al, bool bSwapParity)
 {
     std::vector<int>  atoms = {ai, aj, ak, al};
-    ps->interactionTypes.emplace_back(InteractionType(atoms, {}));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, {}));
 
     if (bSwapParity)
     {
@@ -122,10 +122,10 @@ void add_vsite3_atoms(InteractionTypeParameters *ps, int ai, int aj, int ak, int
     }
 }
 
-void add_vsite4_atoms(InteractionTypeParameters *ps, int ai, int aj, int ak, int al, int am)
+void add_vsite4_atoms(InteractionsOfType *ps, int ai, int aj, int ak, int al, int am)
 {
     std::vector<int> atoms = {ai, aj, ak, al, am};
-    ps->interactionTypes.emplace_back(InteractionType(atoms, {}));
+    ps->interactionTypes.emplace_back(InteractionOfType(atoms, {}));
 }
 
 int search_jtype(const PreprocessResidue &localPpResidue, const char *name, bool bNterm)
index afc517c1bea8961371fe4e1a6c19c831c0e86d11..f26fc891cf203502655cbf029da25fc6fd54177b 100644 (file)
 #include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/real.h"
 
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 struct PreprocessResidue;
 
-void add_param(InteractionTypeParameters *ps,
+void add_param(InteractionsOfType        *ps,
                int                        ai,
                int                        aj,
                gmx::ArrayRef<const real>  c,
                const char                *s);
 
-void add_imp_param(InteractionTypeParameters *ps, int ai, int aj, int ak, int al,
+void add_imp_param(InteractionsOfType *ps, int ai, int aj, int ak, int al,
                    real c0, real c1, const char *s);
 
-void add_dih_param(InteractionTypeParameters *ps, int ai, int aj, int ak, int al,
+void add_dih_param(InteractionsOfType *ps, int ai, int aj, int ak, int al,
                    real c0, real c1, real c2, const char *s);
 
-void add_cmap_param(InteractionTypeParameters *ps, int ai, int aj, int ak, int al, int am,
+void add_cmap_param(InteractionsOfType *ps, int ai, int aj, int ak, int al, int am,
                     const char *s);
 
-void add_vsite2_atoms(InteractionTypeParameters *ps, int ai, int aj, int ak);
+void add_vsite2_atoms(InteractionsOfType *ps, int ai, int aj, int ak);
 
-void add_vsite3_atoms(InteractionTypeParameters *ps, int ai, int aj, int ak, int al,
+void add_vsite3_atoms(InteractionsOfType *ps, int ai, int aj, int ak, int al,
                       bool bSwapParity);
 
-void add_vsite2_param(InteractionTypeParameters *ps, int ai, int aj, int ak, real c0);
+void add_vsite2_param(InteractionsOfType *ps, int ai, int aj, int ak, real c0);
 
-void add_vsite3_param(InteractionTypeParameters *ps, int ai, int aj, int ak, int al,
+void add_vsite3_param(InteractionsOfType *ps, int ai, int aj, int ak, int al,
                       real c0, real c1);
 
-void add_vsite4_atoms(InteractionTypeParameters *ps, int ai, int aj, int ak, int al,
+void add_vsite4_atoms(InteractionsOfType *ps, int ai, int aj, int ak, int al,
                       int am);
 
 int search_jtype(const PreprocessResidue &localPpResidue, const char *name, bool bFirstRes);
index f3e6fb9c565e9db2dc62d4f281240da827cb9ed8..16c77479cd69ac5b7ec23a92a63e7c46e2af71f9 100644 (file)
@@ -496,7 +496,7 @@ static void append_interaction(InteractionList *ilist,
     }
 }
 
-static void enter_function(const InteractionTypeParameters *p, t_functype ftype, int comb, real reppow,
+static void enter_function(const InteractionsOfType *p, t_functype ftype, int comb, real reppow,
                            gmx_ffparams_t *ffparams, InteractionList *il,
                            bool bNB, bool bAppend)
 {
@@ -515,11 +515,11 @@ static void enter_function(const InteractionTypeParameters *p, t_functype ftype,
     }
 }
 
-void convertInteractionTypeParameters(int atnr, gmx::ArrayRef<const InteractionTypeParameters> nbtypes,
-                                      gmx::ArrayRef<const MoleculeInformation> mi,
-                                      const MoleculeInformation *intermolecular_interactions,
-                                      int comb, double reppow, real fudgeQQ,
-                                      gmx_mtop_t *mtop)
+void convertInteractionsOfType(int atnr, gmx::ArrayRef<const InteractionsOfType> nbtypes,
+                               gmx::ArrayRef<const MoleculeInformation> mi,
+                               const MoleculeInformation *intermolecular_interactions,
+                               int comb, double reppow, real fudgeQQ,
+                               gmx_mtop_t *mtop)
 {
     int             i;
     unsigned long   flags;
@@ -544,14 +544,14 @@ void convertInteractionTypeParameters(int atnr, gmx::ArrayRef<const InteractionT
         {
             molt->ilist[i].iatoms.clear();
 
-            gmx::ArrayRef<const InteractionTypeParameters> plist = mi[mt].plist;
+            gmx::ArrayRef<const InteractionsOfType> interactions = mi[mt].interactions;
 
             flags = interaction_function[i].flags;
             if ((i != F_LJ) && (i != F_BHAM) && ((flags & IF_BOND) ||
                                                  (flags & IF_VSITE) ||
                                                  (flags & IF_CONSTRAINT)))
             {
-                enter_function(&(plist[i]), static_cast<t_functype>(i), comb, reppow,
+                enter_function(&(interactions[i]), static_cast<t_functype>(i), comb, reppow,
                                ffp, &molt->ilist[i],
                                FALSE, (i == F_POSRES  || i == F_FBPOSRES));
             }
@@ -568,9 +568,9 @@ void convertInteractionTypeParameters(int atnr, gmx::ArrayRef<const InteractionT
         {
             (*mtop->intermolecular_ilist)[i].iatoms.clear();
 
-            gmx::ArrayRef<const InteractionTypeParameters> plist = intermolecular_interactions->plist;
+            gmx::ArrayRef<const InteractionsOfType> interactions = intermolecular_interactions->interactions;
 
-            if (!plist[i].interactionTypes.empty())
+            if (!interactions[i].interactionTypes.empty())
             {
                 flags = interaction_function[i].flags;
                 /* For intermolecular interactions we (currently)
@@ -592,7 +592,7 @@ void convertInteractionTypeParameters(int atnr, gmx::ArrayRef<const InteractionT
                 }
                 else
                 {
-                    enter_function(&(plist[i]), static_cast<t_functype>(i), comb, reppow,
+                    enter_function(&(interactions[i]), static_cast<t_functype>(i), comb, reppow,
                                    ffp, &(*mtop->intermolecular_ilist)[i],
                                    FALSE, FALSE);
 
index bcc82b83c532471c400a39810995cb62dd59a741..a245f6f01b5cd9bc697be64e824bcdde7188f23e 100644 (file)
 
 struct gmx_mtop_t;
 struct MoleculeInformation;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 
-void convertInteractionTypeParameters(int atnr, gmx::ArrayRef<const InteractionTypeParameters> nbtypes,
-                                      gmx::ArrayRef<const MoleculeInformation> mi,
-                                      const MoleculeInformation *intermolecular_interactions,
-                                      int comb, double reppow, real fudgeQQ,
-                                      gmx_mtop_t *mtop);
+void convertInteractionsOfType(int atnr, gmx::ArrayRef<const InteractionsOfType> nbtypes,
+                               gmx::ArrayRef<const MoleculeInformation> mi,
+                               const MoleculeInformation *intermolecular_interactions,
+                               int comb, double reppow, real fudgeQQ,
+                               gmx_mtop_t *mtop);
 
 #endif
index 98d5031625070797fc56d2dff622d2d13196ef0b..e1766220746ef0d4c601ddfb46c96e8976955a65 100644 (file)
 #include "resall.h"
 
 #define DIHEDRAL_WAS_SET_IN_RTP 0
-static bool was_dihedral_set_in_rtp(const InteractionType &dih)
+static bool was_dihedral_set_in_rtp(const InteractionOfType &dih)
 {
     // This is a bad way to check this, but I don't know how to make this better now.
     gmx::ArrayRef<const real> forceParam = dih.forceParam();
     return forceParam[MAXFORCEPARAM-1] == DIHEDRAL_WAS_SET_IN_RTP;
 }
 
-typedef bool (*peq)(const InteractionType &p1, const InteractionType &p2);
+typedef bool (*peq)(const InteractionOfType &p1, const InteractionOfType &p2);
 
-static bool acomp(const InteractionType &a1, const InteractionType &a2)
+static bool acomp(const InteractionOfType &a1, const InteractionOfType &a2)
 {
     int            ac;
 
@@ -91,7 +91,7 @@ static bool acomp(const InteractionType &a1, const InteractionType &a2)
     }
 }
 
-static bool pcomp(const InteractionType &a1, const InteractionType &a2)
+static bool pcomp(const InteractionOfType &a1, const InteractionOfType &a2)
 {
     int            pc;
 
@@ -105,7 +105,7 @@ static bool pcomp(const InteractionType &a1, const InteractionType &a2)
     }
 }
 
-static bool dcomp(const InteractionType &d1, const InteractionType &d2)
+static bool dcomp(const InteractionOfType &d1, const InteractionOfType &d2)
 {
     int            dc;
 
@@ -150,19 +150,19 @@ static bool dcomp(const InteractionType &d1, const InteractionType &d2)
 }
 
 
-static bool is_dihedral_on_same_bond(const InteractionType &p1, const InteractionType &p2)
+static bool is_dihedral_on_same_bond(const InteractionOfType &p1, const InteractionOfType &p2)
 {
     return ((p1.aj() == p2.aj()) && (p1.ak() == p2.ak())) ||
            ((p1.aj() == p2.ak()) && (p1.ak() == p2.aj()));
 }
 
 
-static bool preq(const InteractionType &p1, const InteractionType &p2)
+static bool preq(const InteractionOfType &p1, const InteractionOfType &p2)
 {
     return (p1.ai() == p2.ai()) && (p1.aj() == p2.aj());
 }
 
-static void rm2par(std::vector<InteractionType> *p, peq eq)
+static void rm2par(std::vector<InteractionOfType> *p, peq eq)
 {
     if (p->empty())
     {
@@ -183,9 +183,9 @@ static void rm2par(std::vector<InteractionType> *p, peq eq)
     }
 }
 
-static void cppar(gmx::ArrayRef<const InteractionType>          types,
-                  gmx::ArrayRef<InteractionTypeParameters>      plist,
-                  int                                           ftype)
+static void cppar(gmx::ArrayRef<const InteractionOfType>          types,
+                  gmx::ArrayRef<InteractionsOfType>               plist,
+                  int                                             ftype)
 {
     /* Keep old stuff */
     for (const auto &type : types)
@@ -194,7 +194,7 @@ static void cppar(gmx::ArrayRef<const InteractionType>          types,
     }
 }
 
-static bool idcomp(const InteractionType &a, const InteractionType &b)
+static bool idcomp(const InteractionOfType &a, const InteractionOfType &b)
 {
     int            d;
 
@@ -216,7 +216,7 @@ static bool idcomp(const InteractionType &a, const InteractionType &b)
     }
 }
 
-static void sort_id(gmx::ArrayRef<InteractionType> ps)
+static void sort_id(gmx::ArrayRef<InteractionOfType> ps)
 {
     if (ps.size() > 1)
     {
@@ -254,21 +254,21 @@ static int n_hydro(gmx::ArrayRef<const int> a, char ***atomname)
 
 /* Clean up the dihedrals (both generated and read from the .rtp
  * file). */
-static std::vector<InteractionType> clean_dih(gmx::ArrayRef<const InteractionType> dih,
-                                              gmx::ArrayRef<const InteractionType> improper,
-                                              t_atoms *atoms, bool bKeepAllGeneratedDihedrals,
-                                              bool bRemoveDihedralIfWithImproper)
+static std::vector<InteractionOfType> clean_dih(gmx::ArrayRef<const InteractionOfType> dih,
+                                                gmx::ArrayRef<const InteractionOfType> improper,
+                                                t_atoms *atoms, bool bKeepAllGeneratedDihedrals,
+                                                bool bRemoveDihedralIfWithImproper)
 {
     /* Construct the list of the indices of the dihedrals
      * (i.e. generated or read) that might be kept. */
-    std::vector < std::pair < InteractionType, int>> newDihedrals;
+    std::vector < std::pair < InteractionOfType, int>> newDihedrals;
     if (bKeepAllGeneratedDihedrals)
     {
         fprintf(stderr, "Keeping all generated dihedrals\n");
         int i = 0;
         for (const auto &dihedral : dih)
         {
-            newDihedrals.emplace_back(std::pair<InteractionType, int>(dihedral, i++));
+            newDihedrals.emplace_back(std::pair<InteractionOfType, int>(dihedral, i++));
         }
     }
     else
@@ -288,7 +288,7 @@ static std::vector<InteractionType> clean_dih(gmx::ArrayRef<const InteractionTyp
                 dihedral == dih.begin() ||
                 !is_dihedral_on_same_bond(*dihedral, *(dihedral-1)))
             {
-                newDihedrals.emplace_back(std::pair<InteractionType, int>(*dihedral, i++));
+                newDihedrals.emplace_back(std::pair<InteractionOfType, int>(*dihedral, i++));
             }
         }
     }
@@ -351,7 +351,7 @@ static std::vector<InteractionType> clean_dih(gmx::ArrayRef<const InteractionTyp
             dihedral = newDihedrals.erase(dihedral);
         }
     }
-    std::vector<InteractionType> finalDihedrals;
+    std::vector<InteractionOfType> finalDihedrals;
     finalDihedrals.reserve(newDihedrals.size());
     for (const auto &param : newDihedrals)
     {
@@ -360,11 +360,11 @@ static std::vector<InteractionType> clean_dih(gmx::ArrayRef<const InteractionTyp
     return finalDihedrals;
 }
 
-static std::vector<InteractionType> get_impropers(t_atoms                             *atoms,
-                                                  gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
-                                                  bool                                 bAllowMissing)
+static std::vector<InteractionOfType> get_impropers(t_atoms                             *atoms,
+                                                    gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
+                                                    bool                                 bAllowMissing)
 {
-    std::vector<InteractionType> improper;
+    std::vector<InteractionOfType> improper;
 
     /* Add all the impropers from the residue database to the list. */
     int start     = 0;
@@ -394,7 +394,7 @@ static std::vector<InteractionType> get_impropers(t_atoms
                 if (!bStop)
                 {
                     /* Not broken out */
-                    improper.emplace_back(InteractionType(ai, {}, bondeds.s));
+                    improper.emplace_back(InteractionOfType(ai, {}, bondeds.s));
                 }
             }
             while ((start < atoms->nr) && (atoms->atom[start].resind == i))
@@ -614,19 +614,19 @@ void generate_excls(t_nextnb *nnb, int nrexcl, t_excls excls[])
 
 /* Generate pairs, angles and dihedrals from .rtp settings */
 void gen_pad(t_nextnb *nnb, t_atoms *atoms, gmx::ArrayRef<const PreprocessResidue> rtpFFDB,
-             gmx::ArrayRef<InteractionTypeParameters> plist, t_excls excls[], gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
+             gmx::ArrayRef<InteractionsOfType> plist, t_excls excls[], gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
              bool bAllowMissing)
 {
     /* These are the angles, dihedrals and pairs that we generate
      * from the bonds. The ones that are already there from the rtp file
      * will be retained.
      */
-    std::vector<InteractionType>   ang;
-    std::vector<InteractionType>   dih;
-    std::vector<InteractionType>   pai;
-    std::vector<InteractionType>   improper;
+    std::vector<InteractionOfType>   ang;
+    std::vector<InteractionOfType>   dih;
+    std::vector<InteractionOfType>   pai;
+    std::vector<InteractionOfType>   improper;
 
-    std::array<std::string, 4>     anm;
+    std::array<std::string, 4>       anm;
 
     if (!globalPatches.empty())
     {
@@ -701,7 +701,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, gmx::ArrayRef<const PreprocessResidu
                             }
                             while (res < maxres);
                         }
-                        ang.push_back(InteractionType(atomNumbers, {}, name));
+                        ang.push_back(InteractionOfType(atomNumbers, {}, name));
                     }
                     /* Generate every dihedral, 1-4 exclusion and 1-4 interaction
                        only once */
@@ -756,7 +756,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, gmx::ArrayRef<const PreprocessResidu
                                                    if the dihedral was in the rtp list.
                                                  */
                                                 nFound++;
-                                                dih.push_back(InteractionType(atomNumbers, {}, name));
+                                                dih.push_back(InteractionOfType(atomNumbers, {}, name));
                                                 dih.back().setForceParameter(MAXFORCEPARAM-1, DIHEDRAL_WAS_SET_IN_RTP);
                                             }
                                         }
@@ -766,7 +766,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, gmx::ArrayRef<const PreprocessResidu
                                 if (nFound == 0)
                                 {
                                     std::vector<int> atoms = {i, j1, k1, l1};
-                                    dih.push_back(InteractionType(atoms, {},   ""));
+                                    dih.push_back(InteractionOfType(atoms, {},   ""));
                                 }
 
                                 int nbd = nb_dist(nnb, i, l1);
@@ -785,7 +785,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, gmx::ArrayRef<const PreprocessResidu
                                             !(is_hydro(atoms, i1) && is_hydro(atoms, i2)))
                                         {
                                             std::vector<int> atoms = {i1, i2};
-                                            pai.push_back(InteractionType(atoms, {}, ""));
+                                            pai.push_back(InteractionOfType(atoms, {}, ""));
                                         }
                                     }
                                 }
@@ -840,7 +840,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, gmx::ArrayRef<const PreprocessResidu
                 {
                     bondeds.match = true;
                     /* Incrementing nang means we save this angle */
-                    ang.push_back(InteractionType(atomNumbers, {}, bondeds.s));
+                    ang.push_back(InteractionOfType(atomNumbers, {}, bondeds.s));
                 }
             }
 
@@ -878,7 +878,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, gmx::ArrayRef<const PreprocessResidu
                 {
                     bondeds.match = true;
                     /* Incrementing ndih means we save this dihedral */
-                    dih.push_back(InteractionType(atomNumbers, {}, bondeds.s));
+                    dih.push_back(InteractionOfType(atomNumbers, {}, bondeds.s));
                 }
             }
         }
index f4b2456141c9459b4939bdbf097f079abc576578..d6833ff97e67236e5ee5d8be29cad7f4af1b3d05 100644 (file)
@@ -44,7 +44,7 @@ struct t_atoms;
 struct t_excls;
 struct MoleculePatchDatabase;
 struct t_nextnb;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 struct PreprocessResidue;
 
 void generate_excls(t_nextnb *nnb, int nrexcl, t_excls excls[]);
@@ -53,7 +53,7 @@ void clean_excls(t_nextnb *nnb, int nrexcl, t_excls excls[]);
 void gen_pad(t_nextnb                                       *nnb,
              t_atoms                                        *atoms,
              gmx::ArrayRef<const PreprocessResidue>          rtpFFDB,
-             gmx::ArrayRef<InteractionTypeParameters>        plist,
+             gmx::ArrayRef<InteractionsOfType>               plist,
              t_excls                                         excls[],
              gmx::ArrayRef<MoleculePatchDatabase>            globalPatches,
              bool                                            bAllowMissing);
index d7acf13224f1c52aa5c757671772369683e5f672..38537e1a4cafc8ef47501c0a950c00a52d5fe848 100644 (file)
@@ -469,7 +469,7 @@ static real get_ddb_angle(gmx::ArrayRef<const VirtualSiteTopology> vsitetop,
 }
 
 
-static void count_bonds(int atom, InteractionTypeParameters *psb, char ***atomname,
+static void count_bonds(int atom, InteractionsOfType *psb, char ***atomname,
                         int *nrbonds, int *nrHatoms, int Hatoms[], int *Heavy,
                         int *nrheavies, int heavies[])
 {
@@ -606,7 +606,7 @@ static real get_amass(int atom, t_atoms *at, gmx::ArrayRef<const PreprocessResid
     return mass;
 }
 
-static void my_add_param(InteractionTypeParameters *plist, int ai, int aj, real b)
+static void my_add_param(InteractionsOfType *plist, int ai, int aj, real b)
 {
     static real c[MAXFORCEPARAM] =
     { NOTSET, NOTSET, NOTSET, NOTSET, NOTSET, NOTSET };
@@ -615,7 +615,7 @@ static void my_add_param(InteractionTypeParameters *plist, int ai, int aj, real
     add_param(plist, ai, aj, c, nullptr);
 }
 
-static void add_vsites(gmx::ArrayRef<InteractionTypeParameters> plist, int vsite_type[],
+static void add_vsites(gmx::ArrayRef<InteractionsOfType> plist, int vsite_type[],
                        int Heavy, int nrHatoms, int Hatoms[],
                        int nrheavies, int heavies[])
 {
@@ -722,7 +722,7 @@ static void add_vsites(gmx::ArrayRef<InteractionTypeParameters> plist, int vsite
 /* get cos(alpha) when a, b and c are given: */
 #define acosrule(a, b, c) ( (gmx::square(b)+gmx::square(c)-gmx::square(a))/(2*(b)*(c)) )
 
-static int gen_vsites_6ring(t_atoms *at, int *vsite_type[], gmx::ArrayRef<InteractionTypeParameters> plist,
+static int gen_vsites_6ring(t_atoms *at, int *vsite_type[], gmx::ArrayRef<InteractionsOfType> plist,
                             int nrfound, int *ats, real bond_cc, real bond_ch,
                             real xcom, bool bDoZ)
 {
@@ -813,7 +813,7 @@ static int gen_vsites_6ring(t_atoms *at, int *vsite_type[], gmx::ArrayRef<Intera
     return nvsite;
 }
 
-static int gen_vsites_phe(t_atoms *at, int *vsite_type[], gmx::ArrayRef<InteractionTypeParameters> plist,
+static int gen_vsites_phe(t_atoms *at, int *vsite_type[], gmx::ArrayRef<InteractionsOfType> plist,
                           int nrfound, int *ats, gmx::ArrayRef<const VirtualSiteTopology> vsitetop)
 {
     real bond_cc, bond_ch;
@@ -879,7 +879,7 @@ static int gen_vsites_trp(PreprocessingAtomTypes *atype,
                           t_symtab *symtab, int *nadd,
                           gmx::ArrayRef<const gmx::RVec> x, int *cgnr[],
                           t_atoms *at, int *vsite_type[],
-                          gmx::ArrayRef<InteractionTypeParameters> plist,
+                          gmx::ArrayRef<InteractionsOfType> plist,
                           int nrfound, int *ats, int add_shift,
                           gmx::ArrayRef<const VirtualSiteTopology> vsitetop)
 {
@@ -1153,7 +1153,7 @@ static int gen_vsites_tyr(PreprocessingAtomTypes *atype,
                           t_symtab *symtab, int *nadd,
                           gmx::ArrayRef<const gmx::RVec> x, int *cgnr[],
                           t_atoms *at, int *vsite_type[],
-                          gmx::ArrayRef<InteractionTypeParameters> plist,
+                          gmx::ArrayRef<InteractionsOfType> plist,
                           int nrfound, int *ats, int add_shift,
                           gmx::ArrayRef<const VirtualSiteTopology> vsitetop)
 {
@@ -1298,7 +1298,7 @@ static int gen_vsites_tyr(PreprocessingAtomTypes *atype,
 }
 
 static int gen_vsites_his(t_atoms *at, int *vsite_type[],
-                          gmx::ArrayRef<InteractionTypeParameters> plist,
+                          gmx::ArrayRef<InteractionsOfType> plist,
                           int nrfound, int *ats, gmx::ArrayRef<const VirtualSiteTopology> vsitetop)
 {
     int  nvsite, i;
@@ -1553,7 +1553,7 @@ static char atomnamesuffix[] = "1234";
 void do_vsites(gmx::ArrayRef<const PreprocessResidue> rtpFFDB, PreprocessingAtomTypes *atype,
                t_atoms *at, t_symtab *symtab,
                std::vector<gmx::RVec> *x,
-               gmx::ArrayRef<InteractionTypeParameters> plist, int *vsite_type[], int *cgnr[],
+               gmx::ArrayRef<InteractionsOfType> plist, int *vsite_type[], int *cgnr[],
                real mHmult, bool bVsiteAromatics,
                const char *ffdir)
 {
@@ -2135,7 +2135,7 @@ void do_vsites(gmx::ArrayRef<const PreprocessResidue> rtpFFDB, PreprocessingAtom
     /* now renumber all the interactions because of the added atoms */
     for (int ftype = 0; ftype < F_NRE; ftype++)
     {
-        InteractionTypeParameters *params = &(plist[ftype]);
+        InteractionsOfType *params = &(plist[ftype]);
         if (debug)
         {
             fprintf(debug, "Renumbering %zu %s\n", params->size(),
@@ -2167,7 +2167,7 @@ void do_vsites(gmx::ArrayRef<const PreprocessResidue> rtpFFDB, PreprocessingAtom
                     newAtomNumber.emplace_back(o2n[atomNumbers[j]]);
                 }
             }
-            *parm = InteractionType(newAtomNumber, parm->forceParam(), parm->interactionTypeName());
+            *parm = InteractionOfType(newAtomNumber, parm->forceParam(), parm->interactionTypeName());
             if (debug)
             {
                 fprintf(debug, "\n");
@@ -2175,7 +2175,7 @@ void do_vsites(gmx::ArrayRef<const PreprocessResidue> rtpFFDB, PreprocessingAtom
         }
     }
     /* sort constraint parameters */
-    InteractionTypeParameters *params = &(plist[F_CONSTRNC]);
+    InteractionsOfType *params = &(plist[F_CONSTRNC]);
     for (auto &type : params->interactionTypes)
     {
         type.sortAtomIds();
@@ -2190,7 +2190,7 @@ void do_vsites(gmx::ArrayRef<const PreprocessResidue> rtpFFDB, PreprocessingAtom
     fprintf(stderr, "Added %zu new constraints\n", plist[F_CONSTRNC].size());
 }
 
-void do_h_mass(InteractionTypeParameters *psb, int vsite_type[], t_atoms *at, real mHmult,
+void do_h_mass(InteractionsOfType *psb, int vsite_type[], t_atoms *at, real mHmult,
                bool bDeuterate)
 {
     /* loop over all atoms */
index 532d6b79e66824f5e43396955d8fd8f0feb477f4..580d1dbe5c76555f1e55525355784c23bd008e89 100644 (file)
@@ -44,7 +44,7 @@
 
 class PreprocessingAtomTypes;
 struct t_atoms;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 struct PreprocessResidue;
 struct t_symtab;
 
@@ -52,11 +52,11 @@ struct t_symtab;
 
 void do_vsites(gmx::ArrayRef<const PreprocessResidue> rtpFFDB, PreprocessingAtomTypes *atype,
                t_atoms *at, t_symtab *symtab, std::vector<gmx::RVec> *x,
-               gmx::ArrayRef<InteractionTypeParameters> plist, int *dummy_type[], int *cgnr[],
+               gmx::ArrayRef<InteractionsOfType> plist, int *dummy_type[], int *cgnr[],
                real mHmult, bool bVSiteAromatics,
                const char *ffdir);
 
-void do_h_mass(InteractionTypeParameters *psb, int vsite_type[], t_atoms *at, real mHmult,
+void do_h_mass(InteractionsOfType *psb, int vsite_type[], t_atoms *at, real mHmult,
                bool bDeuterate);
 
 #endif
index 1023c0ae434a2616170f15b98f2c1604fadcf869..1cf8bad2c4404d5580332c05a15970e59ffd2cd3 100644 (file)
 struct AtomTypeData
 {
     //! Explicit constructor.
-    AtomTypeData(const t_atom          &a,
-                 char                 **name,
-                 const InteractionType &nb,
-                 const int              bondAtomType,
-                 const int              atomNumber) :
+    AtomTypeData(const t_atom            &a,
+                 char                   **name,
+                 const InteractionOfType &nb,
+                 const int                bondAtomType,
+                 const int                atomNumber) :
         atom_(a), name_(name), nb_(nb),
         bondAtomType_(bondAtomType),
         atomNumber_(atomNumber)
     {
     }
     //! Actual atom data.
-    t_atom           atom_;
+    t_atom             atom_;
     //! Atom name.
-    char           **name_;
+    char             **name_;
     //! Nonbonded data.
-    InteractionType  nb_;
+    InteractionOfType  nb_;
     //! Bonded atomtype for the type.
-    int              bondAtomType_;
+    int                bondAtomType_;
     //! Atom number for the atom type.
-    int              atomNumber_;
+    int                atomNumber_;
 };
 
 class PreprocessingAtomTypes::Impl
@@ -176,12 +176,12 @@ PreprocessingAtomTypes &PreprocessingAtomTypes::operator=(PreprocessingAtomTypes
 PreprocessingAtomTypes::~PreprocessingAtomTypes()
 {}
 
-int PreprocessingAtomTypes::addType(t_symtab              *tab,
-                                    const t_atom          &a,
-                                    const std::string     &name,
-                                    const InteractionType &nb,
-                                    int                    bondAtomType,
-                                    int                    atomNumber)
+int PreprocessingAtomTypes::addType(t_symtab                *tab,
+                                    const t_atom            &a,
+                                    const std::string       &name,
+                                    const InteractionOfType &nb,
+                                    int                      bondAtomType,
+                                    int                      atomNumber)
 {
     int position = atomTypeFromName(name);
     if (position == NOTSET)
@@ -199,13 +199,13 @@ int PreprocessingAtomTypes::addType(t_symtab              *tab,
     }
 }
 
-int PreprocessingAtomTypes::setType(int                    nt,
-                                    t_symtab              *tab,
-                                    const t_atom          &a,
-                                    const std::string     &name,
-                                    const InteractionType &nb,
-                                    int                    bondAtomType,
-                                    int                    atomNumber)
+int PreprocessingAtomTypes::setType(int                      nt,
+                                    t_symtab                *tab,
+                                    const t_atom            &a,
+                                    const std::string       &name,
+                                    const InteractionOfType &nb,
+                                    int                      bondAtomType,
+                                    int                      atomNumber)
 {
     if (!isSet(nt))
     {
@@ -236,12 +236,12 @@ void PreprocessingAtomTypes::printTypes(FILE * out)
     fprintf (out, "\n");
 }
 
-static int search_atomtypes(const PreprocessingAtomTypes        *ga,
-                            int                                 *n,
-                            gmx::ArrayRef<int>                   typelist,
-                            int                                  thistype,
-                            gmx::ArrayRef<const InteractionType> interactionTypes,
-                            int                                  ftype)
+static int search_atomtypes(const PreprocessingAtomTypes          *ga,
+                            int                                   *n,
+                            gmx::ArrayRef<int>                     typelist,
+                            int                                    thistype,
+                            gmx::ArrayRef<const InteractionOfType> interactionTypes,
+                            int                                    ftype)
 {
     int nn    = *n;
     int nrfp  = NRFP(ftype);
@@ -294,7 +294,7 @@ static int search_atomtypes(const PreprocessingAtomTypes        *ga,
     return i;
 }
 
-void PreprocessingAtomTypes::renumberTypes(gmx::ArrayRef<InteractionTypeParameters> plist,
+void PreprocessingAtomTypes::renumberTypes(gmx::ArrayRef<InteractionsOfType>        plist,
                                            gmx_mtop_t                              *mtop,
                                            int                                     *wall_atomtype,
                                            bool                                     bVerbose)
@@ -359,15 +359,15 @@ void PreprocessingAtomTypes::renumberTypes(gmx::ArrayRef<InteractionTypeParamete
     /* We now have a list of unique atomtypes in typelist */
 
     /* Renumber nlist */
-    std::vector<InteractionType> nbsnew;
+    std::vector<InteractionOfType> nbsnew;
 
     for (int i = 0; (i < nat); i++)
     {
         int mi = typelist[i];
         for (int j = 0; (j < nat); j++)
         {
-            int                    mj              = typelist[j];
-            const InteractionType &interactionType = plist[ftype].interactionTypes[ntype*mi+mj];
+            int                      mj              = typelist[j];
+            const InteractionOfType &interactionType = plist[ftype].interactionTypes[ntype*mi+mj];
             nbsnew.emplace_back(interactionType.atoms(), interactionType.forceParam(), interactionType.interactionTypeName());
         }
         new_types.push_back(impl_->types[mi]);
index a6ed9e24f0368173070b64132363b40829dfd9b1..8869f7270245e79f842657dd5adef0da8745d547 100644 (file)
@@ -55,8 +55,8 @@
 struct gmx_mtop_t;
 struct t_atom;
 struct t_atomtypes;
-class InteractionType;
-struct InteractionTypeParameters;
+class InteractionOfType;
+struct InteractionsOfType;
 struct t_symtab;
 
 /*! \libinternal \brief
@@ -173,13 +173,13 @@ class PreprocessingAtomTypes
          * \param[in] atomNumber Atomic number of the entry.
          * \returns Number of the type set or NOTSET
          */
-        int setType(int                    nt,
-                    t_symtab              *tab,
-                    const t_atom          &a,
-                    const std::string     &name,
-                    const InteractionType &nb,
-                    int                    bondAtomType,
-                    int                    atomNumber);
+        int setType(int                      nt,
+                    t_symtab                *tab,
+                    const t_atom            &a,
+                    const std::string       &name,
+                    const InteractionOfType &nb,
+                    int                      bondAtomType,
+                    int                      atomNumber);
 
         /*! \brief
          * Add new atom type to database.
@@ -192,12 +192,12 @@ class PreprocessingAtomTypes
          * \param[in] atomNumber Atomic number of the entry.
          * \returns Number of entries in database.
          */
-        int addType(t_symtab              *tab,
-                    const t_atom          &a,
-                    const std::string     &name,
-                    const InteractionType &nb,
-                    int                    bondAtomType,
-                    int                    atomNumber);
+        int addType(t_symtab                *tab,
+                    const t_atom            &a,
+                    const std::string       &name,
+                    const InteractionOfType &nb,
+                    int                      bondAtomType,
+                    int                      atomNumber);
 
         /*! \brief
          * Renumber existing atom type entries.
@@ -207,7 +207,7 @@ class PreprocessingAtomTypes
          * \param[inout] wallAtomType Atom types of wall atoms, which may also be renumbered
          * \param[in] verbose If we want to print additional info.
          */
-        void renumberTypes(gmx::ArrayRef<InteractionTypeParameters> plist,
+        void renumberTypes(gmx::ArrayRef<InteractionsOfType>        plist,
                            gmx_mtop_t                              *mtop,
                            int                                     *wallAtomType,
                            bool                                     verbose);
index 394c026e6095b76dba2c443eb766a355c6a9436f..f544dfae5075de28b6d690559ffed438447e899b 100644 (file)
@@ -340,7 +340,7 @@ static void do_gen(int       nrbonds, /* total number of bonds in s */
 
 }
 
-static void add_b(InteractionTypeParameters *bonds, int *nrf, sortable *s)
+static void add_b(InteractionsOfType *bonds, int *nrf, sortable *s)
 {
     int i = 0;
     for (const auto &bond : bonds->interactionTypes)
@@ -361,7 +361,7 @@ static void add_b(InteractionTypeParameters *bonds, int *nrf, sortable *s)
     }
 }
 
-void gen_nnb(t_nextnb *nnb, gmx::ArrayRef<InteractionTypeParameters> plist)
+void gen_nnb(t_nextnb *nnb, gmx::ArrayRef<InteractionsOfType> plist)
 {
     sortable *s;
     int       nrbonds, nrf;
@@ -442,7 +442,7 @@ sort_and_purge_nnb(t_nextnb *nnb)
 
 void generate_excl (int nrexcl,
                     int nratoms,
-                    gmx::ArrayRef<InteractionTypeParameters> plist, t_nextnb *nnb, t_blocka *excl)
+                    gmx::ArrayRef<InteractionsOfType> plist, t_nextnb *nnb, t_blocka *excl)
 {
     if (nrexcl < 0)
     {
index 1e6f8a420aeb37621679b0692a1d8f7bc6916480..1cf6ce18938ff6a5aedecf9104c5bafc23f964d1 100644 (file)
@@ -41,7 +41,7 @@
 #include "gromacs/utility/arrayref.h"
 
 struct t_blocka;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 
 struct t_nextnb
 {
@@ -68,7 +68,7 @@ void print_nnb(t_nextnb *nnb, char *s);
 #define print_nnb(nnb, s)
 #endif
 
-void gen_nnb(t_nextnb *nnb, gmx::ArrayRef<InteractionTypeParameters> plist);
+void gen_nnb(t_nextnb *nnb, gmx::ArrayRef<InteractionsOfType> plist);
 /* Generate a t_nextnb structure from bond information.
  * With the structure you can either generate exclusions
  * or generate angles and dihedrals. The structure must be
@@ -76,7 +76,7 @@ void gen_nnb(t_nextnb *nnb, gmx::ArrayRef<InteractionTypeParameters> plist);
  */
 
 void generate_excl (int nrexcl, int nratoms,
-                    gmx::ArrayRef<InteractionTypeParameters> plist, t_nextnb *nnb, t_blocka *excl);
+                    gmx::ArrayRef<InteractionsOfType> plist, t_nextnb *nnb, t_blocka *excl);
 /* Generate an exclusion block from bonds and constraints in
  * plist.
  */
index 5852c03a6a4563b5afbd1865fbf5c2f8324634e0..1c8b99d808e9ac2641cbf4bf3f5ebfb18ca9bb54 100644 (file)
 #include "gromacs/utility/snprintf.h"
 
 /* TODO The implementation details should move to their own source file. */
-InteractionType::InteractionType(gmx::ArrayRef<const int>  atoms,
-                                 gmx::ArrayRef<const real> params,
-                                 const std::string        &name)
+InteractionOfType::InteractionOfType(gmx::ArrayRef<const int>  atoms,
+                                     gmx::ArrayRef<const real> params,
+                                     const std::string        &name)
     : atoms_(atoms.begin(), atoms.end()),
       interactionTypeName_(name)
 {
@@ -124,57 +124,57 @@ InteractionType::InteractionType(gmx::ArrayRef<const int>  atoms,
     }
 }
 
-const int &InteractionType::ai() const
+const int &InteractionOfType::ai() const
 {
     GMX_RELEASE_ASSERT(!atoms_.empty(), "Need to have at least one atom set");
     return atoms_[0];
 }
 
-const int &InteractionType::aj() const
+const int &InteractionOfType::aj() const
 {
     GMX_RELEASE_ASSERT(atoms_.size() > 1, "Need to have at least two atoms set");
     return atoms_[1];
 }
 
-const int &InteractionType::ak() const
+const int &InteractionOfType::ak() const
 {
     GMX_RELEASE_ASSERT(atoms_.size() > 2, "Need to have at least three atoms set");
     return atoms_[2];
 }
 
-const int &InteractionType::al() const
+const int &InteractionOfType::al() const
 {
     GMX_RELEASE_ASSERT(atoms_.size() > 3, "Need to have at least four atoms set");
     return atoms_[3];
 }
 
-const int &InteractionType::am() const
+const int &InteractionOfType::am() const
 {
     GMX_RELEASE_ASSERT(atoms_.size() > 4, "Need to have at least five atoms set");
     return atoms_[4];
 }
 
-const real &InteractionType::c0() const
+const real &InteractionOfType::c0() const
 {
     return forceParam_[0];
 }
 
-const real &InteractionType::c1() const
+const real &InteractionOfType::c1() const
 {
     return forceParam_[1];
 }
 
-const real &InteractionType::c2() const
+const real &InteractionOfType::c2() const
 {
     return forceParam_[2];
 }
 
-const std::string &InteractionType::interactionTypeName() const
+const std::string &InteractionOfType::interactionTypeName() const
 {
     return interactionTypeName_;
 }
 
-void InteractionType::sortBondAtomIds()
+void InteractionOfType::sortBondAtomIds()
 {
     if (aj() < ai())
     {
@@ -182,7 +182,7 @@ void InteractionType::sortBondAtomIds()
     }
 }
 
-void InteractionType::sortAngleAtomIds()
+void InteractionOfType::sortAngleAtomIds()
 {
     if (ak() < ai())
     {
@@ -190,7 +190,7 @@ void InteractionType::sortAngleAtomIds()
     }
 }
 
-void InteractionType::sortDihedralAtomIds()
+void InteractionOfType::sortDihedralAtomIds()
 {
     if (al() < ai())
     {
@@ -199,7 +199,7 @@ void InteractionType::sortDihedralAtomIds()
     }
 }
 
-void InteractionType::sortAtomIds()
+void InteractionOfType::sortAtomIds()
 {
     if (isBond())
     {
@@ -219,7 +219,7 @@ void InteractionType::sortAtomIds()
     }
 };
 
-void InteractionType::setForceParameter(int pos, real value)
+void InteractionOfType::setForceParameter(int pos, real value)
 {
     GMX_RELEASE_ASSERT(pos < MAXFORCEPARAM, "Can't set parameter beyond the maximum number of parameters");
     forceParam_[pos] = value;
@@ -251,8 +251,8 @@ static int rm_interactions(int ifunc, gmx::ArrayRef<MoleculeInformation> mols)
     /* For all the molecule types */
     for (auto &mol : mols)
     {
-        n                  += mol.plist[ifunc].size();
-        mol.plist[ifunc].interactionTypes.clear();
+        n                  += mol.interactions[ifunc].size();
+        mol.interactions[ifunc].interactionTypes.clear();
     }
     return n;
 }
@@ -550,7 +550,7 @@ static int nint_ftype(gmx_mtop_t *mtop, gmx::ArrayRef<const MoleculeInformation>
     int nint = 0;
     for (const gmx_molblock_t &molb : mtop->molblock)
     {
-        nint += molb.nmol*mi[molb.type].plist[ftype].size();
+        nint += molb.nmol*mi[molb.type].interactions[ftype].size();
     }
 
     return nint;
@@ -627,7 +627,7 @@ new_status(const char *topfile, const char *topppfile, const char *confin,
            PreprocessingAtomTypes *atypes, gmx_mtop_t *sys,
            std::vector<MoleculeInformation> *mi,
            std::unique_ptr<MoleculeInformation> *intermolecular_interactions,
-           gmx::ArrayRef<InteractionTypeParameters> plist,
+           gmx::ArrayRef<InteractionsOfType> interactions,
            int *comb, double *reppow, real *fudgeQQ,
            gmx_bool bMorse,
            warninp *wi)
@@ -640,7 +640,7 @@ new_status(const char *topfile, const char *topppfile, const char *confin,
 
     /* TOPOLOGY processing */
     sys->name = do_top(bVerbose, topfile, topppfile, opts, bZero, &(sys->symtab),
-                       plist, comb, reppow, fudgeQQ,
+                       interactions, comb, reppow, fudgeQQ,
                        atypes, mi, intermolecular_interactions,
                        ir,
                        &molblock,
@@ -988,8 +988,8 @@ static void read_posres(gmx_mtop_t *mtop,
     for (gmx_molblock_t &molb : mtop->molblock)
     {
         nat_molb = molb.nmol*mtop->moltype[molb.type].atoms.nr;
-        const InteractionTypeParameters *pr   = &(molinfo[molb.type].plist[F_POSRES]);
-        const InteractionTypeParameters *prfb = &(molinfo[molb.type].plist[F_FBPOSRES]);
+        const InteractionsOfType *pr   = &(molinfo[molb.type].interactions[F_POSRES]);
+        const InteractionsOfType *prfb = &(molinfo[molb.type].interactions[F_FBPOSRES]);
         if (pr->size() > 0 || prfb->size() > 0)
         {
             atom = mtop->moltype[molb.type].atoms.atom;
@@ -1331,17 +1331,17 @@ static int count_constraints(const gmx_mtop_t                        *mtop,
     for (const gmx_molblock_t &molb : mtop->molblock)
     {
         count_mol = 0;
-        gmx::ArrayRef<const InteractionTypeParameters> plist = mi[molb.type].plist;
+        gmx::ArrayRef<const InteractionsOfType> interactions = mi[molb.type].interactions;
 
         for (int i = 0; i < F_NRE; i++)
         {
             if (i == F_SETTLE)
             {
-                count_mol += 3*plist[i].size();
+                count_mol += 3*interactions[i].size();
             }
             else if (interaction_function[i].flags & IF_CONSTRAINT)
             {
-                count_mol += plist[i].size();
+                count_mol += interactions[i].size();
             }
         }
 
@@ -1913,9 +1913,9 @@ int gmx_grompp(int argc, char *argv[])
         warning_error(wi, warn_buf);
     }
 
-    std::array<InteractionTypeParameters, F_NRE> plist;
-    gmx_mtop_t             sys;
-    PreprocessingAtomTypes atypes;
+    std::array<InteractionsOfType, F_NRE> interactions;
+    gmx_mtop_t                            sys;
+    PreprocessingAtomTypes                atypes;
     if (debug)
     {
         pr_symtab(debug, 0, "Just opened", &sys.symtab);
@@ -1931,7 +1931,7 @@ int gmx_grompp(int argc, char *argv[])
     new_status(fn, opt2fn_null("-pp", NFILE, fnm), opt2fn("-c", NFILE, fnm),
                opts, ir, bZero, bGenVel, bVerbose, &state,
                &atypes, &sys, &mi, &intermolecular_interactions,
-               plist, &comb, &reppow, &fudgeQQ,
+               interactions, &comb, &reppow, &fudgeQQ,
                opts->bMorse,
                wi);
 
@@ -1945,7 +1945,7 @@ int gmx_grompp(int argc, char *argv[])
     for (size_t mt = 0; mt < sys.moltype.size(); mt++)
     {
         nvsite +=
-            set_vsites(bVerbose, &sys.moltype[mt].atoms, &atypes, mi[mt].plist);
+            set_vsites(bVerbose, &sys.moltype[mt].atoms, &atypes, mi[mt].interactions);
     }
     /* now throw away all obsolete bonds, angles and dihedrals: */
     /* note: constraints are ALWAYS removed */
@@ -1953,7 +1953,7 @@ int gmx_grompp(int argc, char *argv[])
     {
         for (size_t mt = 0; mt < sys.moltype.size(); mt++)
         {
-            clean_vsite_bondeds(mi[mt].plist, sys.moltype[mt].atoms.nr, bRmVSBds);
+            clean_vsite_bondeds(mi[mt].interactions, sys.moltype[mt].atoms.nr, bRmVSBds);
         }
     }
 
@@ -2068,16 +2068,16 @@ int gmx_grompp(int argc, char *argv[])
     }
 
     /* If we are using CMAP, setup the pre-interpolation grid */
-    if (plist[F_CMAP].ncmap() > 0)
+    if (interactions[F_CMAP].ncmap() > 0)
     {
-        init_cmap_grid(&sys.ffparams.cmap_grid, plist[F_CMAP].cmapAngles, plist[F_CMAP].cmakeGridSpacing);
-        setup_cmap(plist[F_CMAP].cmakeGridSpacing, plist[F_CMAP].cmapAngles, plist[F_CMAP].cmap, &sys.ffparams.cmap_grid);
+        init_cmap_grid(&sys.ffparams.cmap_grid, interactions[F_CMAP].cmapAngles, interactions[F_CMAP].cmakeGridSpacing);
+        setup_cmap(interactions[F_CMAP].cmakeGridSpacing, interactions[F_CMAP].cmapAngles, interactions[F_CMAP].cmap, &sys.ffparams.cmap_grid);
     }
 
     set_wall_atomtype(&atypes, opts, ir, wi);
     if (bRenum)
     {
-        atypes.renumberTypes(plist, &sys, ir->wall_atomtype, bVerbose);
+        atypes.renumberTypes(interactions, &sys, ir->wall_atomtype, bVerbose);
     }
 
     if (ir->implicit_solvent)
@@ -2099,12 +2099,12 @@ int gmx_grompp(int argc, char *argv[])
     }
 
     const int ntype = atypes.size();
-    convertInteractionTypeParameters(ntype, plist, mi, intermolecular_interactions.get(),
-                                     comb, reppow, fudgeQQ, &sys);
+    convertInteractionsOfType(ntype, interactions, mi, intermolecular_interactions.get(),
+                              comb, reppow, fudgeQQ, &sys);
 
     if (debug)
     {
-        pr_symtab(debug, 0, "After converInteractionTypeParameters", &sys.symtab);
+        pr_symtab(debug, 0, "After converInteractionsOfType", &sys.symtab);
     }
 
     /* set ptype to VSite for virtual sites */
index eae3711ae588f7ef13ea61fc070c229a6eec580f..18411cd7a3e31a2bc2d17775d29cff62f9a9253f 100644 (file)
 #include "gromacs/utility/real.h"
 
 /*! \libinternal \brief
- * Describes a single parameter in a force field.
+ * Describes an interaction of a given type, plus its parameters.
  */
-class InteractionType
+class InteractionOfType
 {
     public:
         //! Constructor that initializes vectors.
-        InteractionType(gmx::ArrayRef<const int>  atoms,
-                        gmx::ArrayRef<const real> params,
-                        const std::string        &name = "");
+        InteractionOfType(gmx::ArrayRef<const int>  atoms,
+                          gmx::ArrayRef<const real> params,
+                          const std::string        &name = "");
         /*!@{*/
         //! Access the individual elements set for the parameter.
         const int       &ai() const;
@@ -130,18 +130,18 @@ class InteractionType
  * lists of interactions of a given type in a [moleculetype]
  * topology file definition.
  */
-struct InteractionTypeParameters
+struct InteractionsOfType
 {                       // NOLINT (clang-analyzer-optin.performance.Padding)
     //! The different parameters in the system.
-    std::vector<InteractionType> interactionTypes;
+    std::vector<InteractionOfType> interactionTypes;
     //! CMAP grid spacing.
-    int                          cmakeGridSpacing = -1;
+    int                            cmakeGridSpacing = -1;
     //! Number of cmap angles.
-    int                          cmapAngles = -1;
+    int                            cmapAngles = -1;
     //! CMAP grid data.
-    std::vector<real>            cmap;
+    std::vector<real>              cmap;
     //! The five atomtypes followed by a number that identifies the type.
-    std::vector<int>             cmapAtomTypes;
+    std::vector<int>               cmapAtomTypes;
 
     //! Number of parameters.
     size_t size() const { return interactionTypes.size(); }
@@ -179,8 +179,8 @@ struct MoleculeInformation
     t_block                                      mols;
     //! Exclusions in the molecule.
     t_blocka                                     excls;
-    //! Parameters in old style.
-    std::array<InteractionTypeParameters, F_NRE> plist;
+    //! Interactions of a defined type.
+    std::array<InteractionsOfType, F_NRE>        interactions;
 
     /*! \brief
      * Initializer.
index 9a7513d9f06e4599eef11315586217bd3d6087d4..437030c57b655622bb325f0eaed88210fa1a57b6 100644 (file)
@@ -192,7 +192,7 @@ static int match_str(const char *atom, const char *template_string)
 }
 
 int nm2type(int nnm, t_nm2type nm2t[], t_symtab *tab, t_atoms *atoms,
-            PreprocessingAtomTypes *atype, int *nbonds, InteractionTypeParameters *bonds)
+            PreprocessingAtomTypes *atype, int *nbonds, InteractionsOfType *bonds)
 {
     int          cur = 0;
 #define prev (1-cur)
@@ -336,7 +336,7 @@ int nm2type(int nnm, t_nm2type nm2t[], t_symtab *tab, t_atoms *atoms,
             {
                 atoms->atom[i].qB = alpha;
                 atoms->atom[i].m  = atoms->atom[i].mB = mm;
-                k                 = atype->addType(tab, atoms->atom[i], type, InteractionType({}, {}),
+                k                 = atype->addType(tab, atoms->atom[i], type, InteractionOfType({}, {}),
                                                    atoms->atom[i].type, atomnr);
             }
             atoms->atom[i].type  = k;
index f982ececb7bde7f273d20f66329f99ff99559ef4..4107337c1a34838a3662d0035052a9fa7de89f1e 100644 (file)
@@ -41,7 +41,7 @@
 
 class PreprocessingAtomTypes;
 struct t_atoms;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 struct t_symtab;
 
 struct t_nm2type
@@ -62,7 +62,7 @@ void dump_nm2type(FILE *fp, int nnm, t_nm2type nm2t[]);
 /* Dump the database for debugging. Can be reread by the program */
 
 int nm2type(int nnm, t_nm2type nm2t[], t_symtab *tab, t_atoms *atoms,
-            PreprocessingAtomTypes *atype, int *nbonds, InteractionTypeParameters *bond);
+            PreprocessingAtomTypes *atype, int *nbonds, InteractionsOfType *bond);
 /* Try to determine the atomtype (force field dependent) for the atoms
  * with help of the bond list
  */
index 584ba950fa709ba91f1ff7f4c48da7da057825e3..713e2819781152fe33bed13a123cfe12d3a4a8f9 100644 (file)
@@ -672,7 +672,7 @@ void print_top_mols(FILE *out,
 
 void write_top(FILE *out, const char *pr, const char *molname,
                t_atoms *at, bool bRTPresname,
-               int bts[], gmx::ArrayRef<const InteractionTypeParameters> plist, t_excls excls[],
+               int bts[], gmx::ArrayRef<const InteractionsOfType> plist, t_excls excls[],
                PreprocessingAtomTypes *atype, int *cgnr, int nrexcl)
 /* NOTE: nrexcl is not the size of *excl! */
 {
@@ -711,7 +711,7 @@ void write_top(FILE *out, const char *pr, const char *molname,
 
 
 
-static void do_ssbonds(InteractionTypeParameters *ps, t_atoms *atoms,
+static void do_ssbonds(InteractionsOfType *ps, t_atoms *atoms,
                        gmx::ArrayRef<const DisulfideBond> ssbonds, bool bAllowMissing)
 {
     for (const auto &bond : ssbonds)
@@ -731,7 +731,7 @@ static void do_ssbonds(InteractionTypeParameters *ps, t_atoms *atoms,
     }
 }
 
-static void at2bonds(InteractionTypeParameters *psb, gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
+static void at2bonds(InteractionsOfType *psb, gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
                      t_atoms *atoms,
                      gmx::ArrayRef<const gmx::RVec> x,
                      real long_bond_dist, real short_bond_dist)
@@ -813,7 +813,7 @@ static void at2bonds(InteractionTypeParameters *psb, gmx::ArrayRef<MoleculePatch
     }
 }
 
-static bool pcompar(const InteractionType &a, const InteractionType &b)
+static bool pcompar(const InteractionOfType &a, const InteractionOfType &b)
 {
     int                d;
 
@@ -831,7 +831,7 @@ static bool pcompar(const InteractionType &a, const InteractionType &b)
     }
 }
 
-static void clean_bonds(InteractionTypeParameters *ps)
+static void clean_bonds(InteractionsOfType *ps)
 {
     if (ps->size() > 0)
     {
@@ -1332,7 +1332,7 @@ void match_atomnames_with_rtp(gmx::ArrayRef<PreprocessResidue>     usedPpResidue
 }
 
 #define NUM_CMAP_ATOMS 5
-static void gen_cmap(InteractionTypeParameters *psb, gmx::ArrayRef<const PreprocessResidue> usedPpResidues, t_atoms *atoms)
+static void gen_cmap(InteractionsOfType *psb, gmx::ArrayRef<const PreprocessResidue> usedPpResidues, t_atoms *atoms)
 {
     int         residx;
     const char *ptr;
@@ -1462,7 +1462,7 @@ void pdb2top(FILE *top_file, const char *posre_fn, const char *molname,
              bool bDeuterate, bool bChargeGroups, bool bCmap,
              bool bRenumRes, bool bRTPresname)
 {
-    std::array<InteractionTypeParameters, F_NRE> plist;
+    std::array<InteractionsOfType, F_NRE>        plist;
     t_excls                                     *excls;
     t_nextnb                                     nnb;
     int                                         *cgnr;
index 072371e15e16fe08fdf252c5f97fea2c636d5788..d350688a04ce9e3e01c3626e4e66e03c50db29f4 100644 (file)
@@ -50,7 +50,7 @@ struct t_atoms;
 struct t_excls;
 struct MoleculePatchDatabase;
 struct t_mols;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 struct t_resinfo;
 struct PreprocessResidue;
 struct DisulfideBond;
@@ -113,7 +113,7 @@ void print_top_mols(FILE *out,
 
 void write_top(FILE *out, const char *pr, const char *molname,
                t_atoms *at, bool bRTPresname,
-               int bts[], gmx::ArrayRef<const InteractionTypeParameters> plist, t_excls excls[],
+               int bts[], gmx::ArrayRef<const InteractionsOfType> plist, t_excls excls[],
                PreprocessingAtomTypes *atype, int *cgnr, int nrexcl);
 /* NOTE: nrexcl is not the size of *excl! */
 
index 1da6d137ea5fd17d11d47f1c05effa6c5fe5c4cc..60df05b6fb06a918a1e3fcefe192190f6458c1f3 100644 (file)
@@ -92,7 +92,7 @@ PreprocessingAtomTypes read_atype(const char *ffdir, t_symtab *tab)
             if (sscanf(buf, "%s%lf", name, &m) == 2)
             {
                 a->m = m;
-                at.addType(tab, *a, name, InteractionType({}, {}), 0, 0);
+                at.addType(tab, *a, name, InteractionOfType({}, {}), 0, 0);
                 fprintf(stderr, "\rAtomtype %d", ++nratt);
                 fflush(stderr);
             }
index a7ebbb214060f648f3c44e5937961438e5a1ab57..50042a89414020f4ca25cb1af34d1fa2cd9d9d7b 100644 (file)
@@ -81,10 +81,10 @@ class PreprocessingAtomTypesTest : public ::testing::Test
             done_symtab(&symtab_);
         }
     protected:
-        PreprocessingAtomTypes atypes_;
-        t_symtab               symtab_;
-        t_atom                 atom_;
-        InteractionType        nb_;
+        PreprocessingAtomTypes   atypes_;
+        t_symtab                 symtab_;
+        t_atom                   atom_;
+        InteractionOfType        nb_;
 };
 
 TEST_F(PreprocessingAtomTypesTest, EmptyOnCreate)
index 5c854a88a6aeefdf61d46560a7e3ce2af2069909..72d14acfd046ada31e8263052967861bc3421c87 100644 (file)
@@ -211,11 +211,11 @@ void convert_harmonics(gmx::ArrayRef<MoleculeInformation> mols, PreprocessingAto
         {
             if ((interaction_function[bb].flags & IF_BTYPE) && (bb != F_MORSE))
             {
-                int nrharm  = mol.plist[bb].size();
+                int nrharm  = mol.interactions[bb].size();
 
                 /* Now loop over the harmonics, trying to convert them */
-                for (auto harmonic = mol.plist[bb].interactionTypes.begin();
-                     harmonic != mol.plist[bb].interactionTypes.end(); )
+                for (auto harmonic = mol.interactions[bb].interactionTypes.begin();
+                     harmonic != mol.interactions[bb].interactionTypes.end(); )
                 {
                     int  ni   = harmonic->ai();
                     int  nj   = harmonic->aj();
@@ -230,9 +230,9 @@ void convert_harmonics(gmx::ArrayRef<MoleculeInformation> mols, PreprocessingAto
                         real              beta           = std::sqrt(kb/(2*edis));
                         std::vector<int>  atoms          = {ni, nj};
                         std::vector<real> forceParam     = {b0, edis, beta};
-                        mol.plist[F_MORSE].interactionTypes.emplace_back(
-                                InteractionType(atoms, forceParam));
-                        harmonic = mol.plist[bb].interactionTypes.erase(harmonic);
+                        mol.interactions[F_MORSE].interactionTypes.emplace_back(
+                                InteractionOfType(atoms, forceParam));
+                        harmonic = mol.interactions[bb].interactionTypes.erase(harmonic);
                     }
                     else
                     {
@@ -240,7 +240,7 @@ void convert_harmonics(gmx::ArrayRef<MoleculeInformation> mols, PreprocessingAto
                     }
                 }
 
-                int newHarmonics = mol.plist[bb].size();
+                int newHarmonics = mol.interactions[bb].size();
                 fprintf(stderr, "Converted %d out of %d %s to morse bonds for mol %d\n",
                         nrharm-newHarmonics, nrharm, interaction_function[bb].name, i);
             }
index abdf0ecd1f3c6cb3a183d519ec4b9180fcb3d424..cee2f1b3b2fa30875ac41875e593b65685807f7e 100644 (file)
@@ -85,7 +85,7 @@
 #define OPENDIR     '[' /* starting sign for directive */
 #define CLOSEDIR    ']' /* ending sign for directive   */
 
-static void gen_pairs(const InteractionTypeParameters &nbs, InteractionTypeParameters *pairs, real fudge, int comb)
+static void gen_pairs(const InteractionsOfType &nbs, InteractionsOfType *pairs, real fudge, int comb)
 {
     real    scaling;
     int     ntp       = nbs.size();
@@ -130,7 +130,7 @@ static void gen_pairs(const InteractionTypeParameters &nbs, InteractionTypeParam
             forceParam[j]      = scaling*existingParam[j];
             forceParam[nrfp+j] = scaling*existingParam[j];
         }
-        pairs->interactionTypes.emplace_back(InteractionType(atomNumbers, forceParam));
+        pairs->interactionTypes.emplace_back(InteractionOfType(atomNumbers, forceParam));
         i++;
     }
 }
@@ -377,7 +377,7 @@ static char **read_topol(const char *infile, const char *outfile,
                          PreprocessingAtomTypes *atypes,
                          std::vector<MoleculeInformation> *molinfo,
                          std::unique_ptr<MoleculeInformation> *intermolecular_interactions,
-                         gmx::ArrayRef<InteractionTypeParameters> plist,
+                         gmx::ArrayRef<InteractionsOfType> interactions,
                          int         *combination_rule,
                          double      *reppow,
                          t_gromppopts *opts,
@@ -447,8 +447,8 @@ static char **read_topol(const char *infile, const char *outfile,
     *reppow  = 12.0;      /* Default value for repulsion power     */
 
     /* Init the number of CMAP torsion angles  and grid spacing */
-    plist[F_CMAP].cmakeGridSpacing = 0;
-    plist[F_CMAP].cmapAngles       = 0;
+    interactions[F_CMAP].cmakeGridSpacing = 0;
+    interactions[F_CMAP].cmapAngles       = 0;
 
     bWarn_copy_A_B = bFEP;
 
@@ -638,10 +638,10 @@ static char **read_topol(const char *infile, const char *outfile,
                             break;
 
                         case Directive::d_bondtypes:
-                            push_bt(d, plist, 2, nullptr, &bondAtomType, pline, wi);
+                            push_bt(d, interactions, 2, nullptr, &bondAtomType, pline, wi);
                             break;
                         case Directive::d_constrainttypes:
-                            push_bt(d, plist, 2, nullptr, &bondAtomType, pline, wi);
+                            push_bt(d, interactions, 2, nullptr, &bondAtomType, pline, wi);
                             break;
                         case Directive::d_pairtypes:
                             if (bGenPairs)
@@ -650,15 +650,15 @@ static char **read_topol(const char *infile, const char *outfile,
                             }
                             else
                             {
-                                push_bt(d, plist, 2, atypes, nullptr, pline, wi);
+                                push_bt(d, interactions, 2, atypes, nullptr, pline, wi);
                             }
                             break;
                         case Directive::d_angletypes:
-                            push_bt(d, plist, 3, nullptr, &bondAtomType, pline, wi);
+                            push_bt(d, interactions, 3, nullptr, &bondAtomType, pline, wi);
                             break;
                         case Directive::d_dihedraltypes:
                             /* Special routine that can read both 2 and 4 atom dihedral definitions. */
-                            push_dihedraltype(d, plist, &bondAtomType, pline, wi);
+                            push_dihedraltype(d, interactions, &bondAtomType, pline, wi);
                             break;
 
                         case Directive::d_nonbond_params:
@@ -678,7 +678,7 @@ static char **read_topol(const char *infile, const char *outfile,
                             break;
 
                         case Directive::d_cmaptypes:
-                            push_cmaptype(d, plist, 5, atypes, &bondAtomType, pline, wi);
+                            push_cmaptype(d, interactions, 5, atypes, &bondAtomType, pline, wi);
                             break;
 
                         case Directive::d_moleculetype:
@@ -697,15 +697,15 @@ static char **read_topol(const char *infile, const char *outfile,
                                 }
                                 ntype  = atypes->size();
                                 ncombs = (ntype*(ntype+1))/2;
-                                generate_nbparams(*combination_rule, nb_funct, &(plist[nb_funct]), atypes, wi);
-                                ncopy = copy_nbparams(nbparam, nb_funct, &(plist[nb_funct]),
+                                generate_nbparams(*combination_rule, nb_funct, &(interactions[nb_funct]), atypes, wi);
+                                ncopy = copy_nbparams(nbparam, nb_funct, &(interactions[nb_funct]),
                                                       ntype);
                                 fprintf(stderr, "Generated %d of the %d non-bonded parameter combinations\n", ncombs-ncopy, ncombs);
                                 free_nbparam(nbparam, ntype);
                                 if (bGenPairs)
                                 {
-                                    gen_pairs((plist[nb_funct]), &(plist[F_LJ14]), fudgeLJ, *combination_rule);
-                                    ncopy = copy_nbparams(pair, nb_funct, &(plist[F_LJ14]),
+                                    gen_pairs((interactions[nb_funct]), &(interactions[F_LJ14]), fudgeLJ, *combination_rule);
+                                    ncopy = copy_nbparams(pair, nb_funct, &(interactions[F_LJ14]),
                                                           ntype);
                                     fprintf(stderr, "Generated %d of the %d 1-4 parameter combinations\n", ncombs-ncopy, ncombs);
                                     free_nbparam(pair, ntype);
@@ -731,12 +731,12 @@ static char **read_topol(const char *infile, const char *outfile,
 
                         case Directive::d_pairs:
                             GMX_RELEASE_ASSERT(mi0, "Need to have a valid MoleculeInformation object to work on");
-                            push_bond(d, plist, mi0->plist, &(mi0->atoms), atypes, pline, FALSE,
+                            push_bond(d, interactions, mi0->interactions, &(mi0->atoms), atypes, pline, FALSE,
                                       bGenPairs, *fudgeQQ, bZero, &bWarn_copy_A_B, wi);
                             break;
                         case Directive::d_pairs_nb:
                             GMX_RELEASE_ASSERT(mi0, "Need to have a valid MoleculeInformation object to work on");
-                            push_bond(d, plist, mi0->plist, &(mi0->atoms), atypes, pline, FALSE,
+                            push_bond(d, interactions, mi0->interactions, &(mi0->atoms), atypes, pline, FALSE,
                                       FALSE, 1.0, bZero, &bWarn_copy_A_B, wi);
                             break;
 
@@ -758,17 +758,17 @@ static char **read_topol(const char *infile, const char *outfile,
                         case Directive::d_water_polarization:
                         case Directive::d_thole_polarization:
                             GMX_RELEASE_ASSERT(mi0, "Need to have a valid MoleculeInformation object to work on");
-                            push_bond(d, plist, mi0->plist, &(mi0->atoms), atypes, pline, TRUE,
+                            push_bond(d, interactions, mi0->interactions, &(mi0->atoms), atypes, pline, TRUE,
                                       bGenPairs, *fudgeQQ, bZero, &bWarn_copy_A_B, wi);
                             break;
                         case Directive::d_cmap:
                             GMX_RELEASE_ASSERT(mi0, "Need to have a valid MoleculeInformation object to work on");
-                            push_cmap(d, plist, mi0->plist, &(mi0->atoms), atypes, pline, wi);
+                            push_cmap(d, interactions, mi0->interactions, &(mi0->atoms), atypes, pline, wi);
                             break;
 
                         case Directive::d_vsitesn:
                             GMX_RELEASE_ASSERT(mi0, "Need to have a valid MoleculeInformation object to work on");
-                            push_vsitesn(d, mi0->plist, &(mi0->atoms), pline, wi);
+                            push_vsitesn(d, mi0->interactions, &(mi0->atoms), pline, wi);
                             break;
                         case Directive::d_exclusions:
                             GMX_ASSERT(!exclusionBlocks.empty(), "exclusionBlocks must always be allocated so exclusions can be processed");
@@ -816,11 +816,11 @@ static char **read_topol(const char *infile, const char *outfile,
                                 t_nextnb nnb;
                                 generate_excl(mi0->nrexcl,
                                               mi0->atoms.nr,
-                                              mi0->plist,
+                                              mi0->interactions,
                                               &nnb,
                                               &(mi0->excls));
                                 gmx::mergeExclusions(&(mi0->excls), exclusionBlocks[whichmol]);
-                                make_shake(mi0->plist, &mi0->atoms, opts->nshake);
+                                make_shake(mi0->interactions, &mi0->atoms, opts->nshake);
 
                                 done_nnb(&nnb);
 
@@ -829,7 +829,7 @@ static char **read_topol(const char *infile, const char *outfile,
                                     convert_moltype_couple(mi0, dcatt, *fudgeQQ,
                                                            opts->couple_lam0, opts->couple_lam1,
                                                            opts->bCoupleIntra,
-                                                           nb_funct, &(plist[nb_funct]), wi);
+                                                           nb_funct, &(interactions[nb_funct]), wi);
                                 }
                                 stupid_fill_block(&mi0->mols, mi0->atoms.nr, TRUE);
                                 mi0->bProcessed = TRUE;
@@ -933,7 +933,7 @@ char **do_top(bool                                            bVerbose,
               t_gromppopts                                   *opts,
               bool                                            bZero,
               t_symtab                                       *symtab,
-              gmx::ArrayRef<InteractionTypeParameters>        plist,
+              gmx::ArrayRef<InteractionsOfType>               interactions,
               int                                            *combination_rule,
               double                                         *repulsion_power,
               real                                           *fudgeQQ,
@@ -965,7 +965,7 @@ char **do_top(bool                                            bVerbose,
     title = read_topol(topfile, tmpfile, opts->define, opts->include,
                        symtab, atypes,
                        molinfo, intermolecular_interactions,
-                       plist, combination_rule, repulsion_power,
+                       interactions, combination_rule, repulsion_power,
                        opts, fudgeQQ, molblock,
                        ffParametrizedWithHBondConstraints,
                        ir->efep != efepNO, bZero,
index c5e5386e3a23eb528c28b0edbe490fd9c45a7a0c..39e84c04741115f16aac850a4e76fb28646d7104 100644 (file)
@@ -50,7 +50,7 @@ class PreprocessingAtomTypes;
 struct t_gromppopts;
 struct t_inputrec;
 struct MoleculeInformation;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 struct t_symtab;
 struct warninp;
 enum struct GmxQmmmMode;
@@ -65,7 +65,7 @@ char **do_top(bool                                                         bVerb
               t_gromppopts                                                *opts,
               bool                                                         bZero,
               t_symtab                                                    *symtab,
-              gmx::ArrayRef<InteractionTypeParameters>                     plist,
+              gmx::ArrayRef<InteractionsOfType>                            plist,
               int                                                         *combination_rule,
               double                                                      *repulsion_power,
               real                                                        *fudgeQQ,
index 52551d6806694392ed25704f4e40e5a036ba7546..751fad0ab4fabe75674d1d6daaacebbff6b09c14 100644 (file)
@@ -68,7 +68,7 @@
 
 void generate_nbparams(int                         comb,
                        int                         ftype,
-                       InteractionTypeParameters  *plist,
+                       InteractionsOfType         *interactions,
                        PreprocessingAtomTypes     *atypes,
                        warninp                    *wi)
 {
@@ -78,7 +78,7 @@ void generate_nbparams(int                         comb,
     /* Lean mean shortcuts */
     nr   = atypes->size();
     nrfp = NRFP(ftype);
-    plist->interactionTypes.clear();
+    interactions->interactionTypes.clear();
 
     std::array<real, MAXFORCEPARAM> forceParam = {NOTSET};
     /* Fill the matrix with force parameters */
@@ -100,7 +100,7 @@ void generate_nbparams(int                         comb,
                                 c              = std::sqrt(ci * cj);
                                 forceParam[nf] = c;
                             }
-                            plist->interactionTypes.emplace_back(InteractionType({}, forceParam));
+                            interactions->interactionTypes.emplace_back(InteractionOfType({}, forceParam));
                         }
                     }
                     break;
@@ -124,7 +124,7 @@ void generate_nbparams(int                         comb,
                                 forceParam[0] *= -1;
                             }
                             forceParam[1] = std::sqrt(ci1*cj1);
-                            plist->interactionTypes.emplace_back(InteractionType({}, forceParam));
+                            interactions->interactionTypes.emplace_back(InteractionOfType({}, forceParam));
                         }
                     }
 
@@ -148,7 +148,7 @@ void generate_nbparams(int                         comb,
                                 forceParam[0] *= -1;
                             }
                             forceParam[1] = std::sqrt(ci1*cj1);
-                            plist->interactionTypes.emplace_back(InteractionType({}, forceParam));
+                            interactions->interactionTypes.emplace_back(InteractionOfType({}, forceParam));
                         }
                     }
 
@@ -181,7 +181,7 @@ void generate_nbparams(int                         comb,
                         forceParam[1] = 2.0/(1/bi+1/bj);
                     }
                     forceParam[2] = std::sqrt(ci2 * cj2);
-                    plist->interactionTypes.emplace_back(InteractionType({}, forceParam));
+                    interactions->interactionTypes.emplace_back(InteractionOfType({}, forceParam));
                 }
             }
 
@@ -194,7 +194,7 @@ void generate_nbparams(int                         comb,
 }
 
 /*! \brief Used to temporarily store the explicit non-bonded parameter
- * combinations, which will be copied to InteractionTypeParameters. */
+ * combinations, which will be copied to InteractionsOfType. */
 struct t_nbparam
 {
     //! Has this combination been set.
@@ -217,7 +217,7 @@ static void realloc_nb_params(PreprocessingAtomTypes *atypes,
     }
 }
 
-int copy_nbparams(t_nbparam **param, int ftype, InteractionTypeParameters *plist, int nr)
+int copy_nbparams(t_nbparam **param, int ftype, InteractionsOfType *interactions, int nr)
 {
     int nrfp, ncopy;
 
@@ -233,8 +233,8 @@ int copy_nbparams(t_nbparam **param, int ftype, InteractionTypeParameters *plist
             {
                 for (int f = 0; f < nrfp; f++)
                 {
-                    plist->interactionTypes[nr*i+j].setForceParameter(f, param[i][j].c[f]);
-                    plist->interactionTypes[nr*j+i].setForceParameter(f, param[i][j].c[f]);
+                    interactions->interactionTypes[nr*i+j].setForceParameter(f, param[i][j].c[f]);
+                    interactions->interactionTypes[nr*j+i].setForceParameter(f, param[i][j].c[f]);
                 }
                 ncopy++;
             }
@@ -541,7 +541,7 @@ void push_at (t_symtab *symtab, PreprocessingAtomTypes *at, PreprocessingBondAto
         forceParam[i] = c[i];
     }
 
-    InteractionType interactionType({}, forceParam, "");
+    InteractionOfType interactionType({}, forceParam, "");
 
     batype_nr = bondAtomType->addBondAtomType(symtab, btype);
 
@@ -578,13 +578,13 @@ static bool equalEitherForwardOrBackward(gmx::ArrayRef<const T> a, gmx::ArrayRef
             std::equal(a.begin(), a.end(), b.rbegin()));
 }
 
-static void push_bondtype(InteractionTypeParameters     *bt,
-                          const InteractionType         &b,
-                          int                            nral,
-                          int                            ftype,
-                          bool                           bAllowRepeat,
-                          const char                    *line,
-                          warninp                       *wi)
+static void push_bondtype(InteractionsOfType              *bt,
+                          const InteractionOfType         &b,
+                          int                              nral,
+                          int                              ftype,
+                          bool                             bAllowRepeat,
+                          const char                      *line,
+                          warninp                         *wi)
 {
     int      nr   = bt->size();
     int      nrfp = NRFP(ftype);
@@ -693,7 +693,7 @@ static void push_bondtype(InteractionTypeParameters     *bt,
     {
         /* fill the arrays up and down */
         bt->interactionTypes.emplace_back(
-                InteractionType(b.atoms(), b.forceParam(), b.interactionTypeName()));
+                InteractionOfType(b.atoms(), b.forceParam(), b.interactionTypeName()));
         /* need to store force values because they might change below */
         std::vector<real> forceParam(b.forceParam().begin(), b.forceParam().end());
 
@@ -712,12 +712,12 @@ static void push_bondtype(InteractionTypeParameters     *bt,
         {
             atoms.emplace_back(*oldAtom);
         }
-        bt->interactionTypes.emplace_back(InteractionType(atoms, forceParam, b.interactionTypeName()));
+        bt->interactionTypes.emplace_back(InteractionOfType(atoms, forceParam, b.interactionTypeName()));
     }
 }
 
 void push_bt(Directive                                 d,
-             gmx::ArrayRef<InteractionTypeParameters>  bt,
+             gmx::ArrayRef<InteractionsOfType>         bt,
              int                                       nral,
              PreprocessingAtomTypes                   *at,
              PreprocessingBondAtomType                *bondAtomType,
@@ -818,11 +818,11 @@ void push_bt(Directive                                 d,
     {
         forceParam[i] = c[i];
     }
-    push_bondtype (&(bt[ftype]), InteractionType(atoms, forceParam), nral, ftype, FALSE, line, wi);
+    push_bondtype (&(bt[ftype]), InteractionOfType(atoms, forceParam), nral, ftype, FALSE, line, wi);
 }
 
 
-void push_dihedraltype(Directive d, gmx::ArrayRef<InteractionTypeParameters> bt,
+void push_dihedraltype(Directive d, gmx::ArrayRef<InteractionsOfType> bt,
                        PreprocessingBondAtomType *bondAtomType, char *line,
                        warninp *wi)
 {
@@ -990,7 +990,7 @@ void push_dihedraltype(Directive d, gmx::ArrayRef<InteractionTypeParameters> bt,
     /* Always use 4 atoms here, since we created two wildcard atoms
      * if there wasn't of them 4 already.
      */
-    push_bondtype (&(bt[ftype]), InteractionType(atoms, forceParam), 4, ftype, bAllowRepeat, line, wi);
+    push_bondtype (&(bt[ftype]), InteractionOfType(atoms, forceParam), 4, ftype, bAllowRepeat, line, wi);
 }
 
 
@@ -1122,7 +1122,7 @@ void push_nbt(Directive d, t_nbparam **nbt, PreprocessingAtomTypes *atypes,
 
 void
 push_cmaptype(Directive                                 d,
-              gmx::ArrayRef<InteractionTypeParameters>  bt,
+              gmx::ArrayRef<InteractionsOfType>         bt,
               int                                       nral,
               PreprocessingAtomTypes                   *atomtypes,
               PreprocessingBondAtomType                *bondAtomType,
@@ -1258,7 +1258,7 @@ push_cmaptype(Directive                                 d,
     std::array<real, MAXFORCEPARAM> forceParam = {NOTSET};
 
     /* Push the bond to the bondlist */
-    push_bondtype (&(bt[ftype]), InteractionType(atoms, forceParam), nral, ftype, FALSE, line, wi);
+    push_bondtype (&(bt[ftype]), InteractionOfType(atoms, forceParam), nral, ftype, FALSE, line, wi);
 }
 
 
@@ -1508,16 +1508,16 @@ static bool findIfAllNBAtomsMatch(gmx::ArrayRef<const int>      atomsFromParamet
     }
 }
 
-static bool default_nb_params(int ftype, gmx::ArrayRef<InteractionTypeParameters> bt, t_atoms *at,
-                              InteractionType *p, int c_start, bool bB, bool bGenPairs)
+static bool default_nb_params(int ftype, gmx::ArrayRef<InteractionsOfType> bt, t_atoms *at,
+                              InteractionOfType *p, int c_start, bool bB, bool bGenPairs)
 {
-    int                  ti, tj, ntype;
-    bool                 bFound;
-    InteractionType     *pi    = nullptr;
-    int                  nr    = bt[ftype].size();
-    int                  nral  = NRAL(ftype);
-    int                  nrfp  = interaction_function[ftype].nrfpA;
-    int                  nrfpB = interaction_function[ftype].nrfpB;
+    int                    ti, tj, ntype;
+    bool                   bFound;
+    InteractionOfType     *pi    = nullptr;
+    int                    nr    = bt[ftype].size();
+    int                    nral  = NRAL(ftype);
+    int                    nrfp  = interaction_function[ftype].nrfpA;
+    int                    nrfpB = interaction_function[ftype].nrfpB;
 
     if ((!bB && nrfp == 0) || (bB && nrfpB == 0))
     {
@@ -1601,9 +1601,9 @@ static bool default_nb_params(int ftype, gmx::ArrayRef<InteractionTypeParameters
     return bFound;
 }
 
-static bool default_cmap_params(gmx::ArrayRef<InteractionTypeParameters> bondtype,
+static bool default_cmap_params(gmx::ArrayRef<InteractionsOfType> bondtype,
                                 t_atoms *at, PreprocessingAtomTypes *atypes,
-                                InteractionType *p, bool bB,
+                                InteractionOfType *p, bool bB,
                                 int *cmap_type, int *nparam_def,
                                 warninp *wi)
 {
@@ -1655,7 +1655,7 @@ static bool default_cmap_params(gmx::ArrayRef<InteractionTypeParameters> bondtyp
 /* Returns the number of exact atom type matches, i.e. non wild-card matches,
  * returns -1 when there are no matches at all.
  */
-static int natom_match(const InteractionType &pi,
+static int natom_match(const InteractionOfType &pi,
                        int type_i, int type_j, int type_k, int type_l,
                        const PreprocessingAtomTypes* atypes)
 {
@@ -1676,11 +1676,11 @@ static int natom_match(const InteractionType &pi,
     }
 }
 
-static int findNumberOfDihedralAtomMatches(const InteractionType            &currentParamFromParameterArray,
-                                           const InteractionType            &parameterToAdd,
-                                           const t_atoms                    *at,
-                                           const PreprocessingAtomTypes     *atypes,
-                                           bool                              bB)
+static int findNumberOfDihedralAtomMatches(const InteractionOfType            &currentParamFromParameterArray,
+                                           const InteractionOfType            &parameterToAdd,
+                                           const t_atoms                      *at,
+                                           const PreprocessingAtomTypes       *atypes,
+                                           bool                                bB)
 {
     if (bB)
     {
@@ -1736,11 +1736,11 @@ static bool findIfAllParameterAtomsMatch(gmx::ArrayRef<const int>      atomsFrom
     }
 }
 
-static std::vector<InteractionType>::iterator
-defaultInteractionTypeParameters(int ftype, gmx::ArrayRef<InteractionTypeParameters> bt,
-                                 t_atoms *at, PreprocessingAtomTypes *atypes,
-                                 const InteractionType &p, bool bB,
-                                 int *nparam_def)
+static std::vector<InteractionOfType>::iterator
+defaultInteractionsOfType(int ftype, gmx::ArrayRef<InteractionsOfType> bt,
+                          t_atoms *at, PreprocessingAtomTypes *atypes,
+                          const InteractionOfType &p, bool bB,
+                          int *nparam_def)
 {
     int              nparam_found;
     int              nrfpA = interaction_function[ftype].nrfpA;
@@ -1823,8 +1823,8 @@ defaultInteractionTypeParameters(int ftype, gmx::ArrayRef<InteractionTypeParamet
 
 
 
-void push_bond(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
-               gmx::ArrayRef<InteractionTypeParameters> bond,
+void push_bond(Directive d, gmx::ArrayRef<InteractionsOfType> bondtype,
+               gmx::ArrayRef<InteractionsOfType> bond,
                t_atoms *at, PreprocessingAtomTypes *atypes, char *line,
                bool bBonded, bool bGenPairs, real fudgeQQ,
                bool bZero, bool *bWarn_copy_A_B,
@@ -1965,19 +1965,19 @@ void push_bond(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
     /* Get force params for normal and free energy perturbation
      * studies, as determined by types!
      */
-    InteractionType param(atoms, forceParam, "");
+    InteractionOfType param(atoms, forceParam, "");
 
-    std::vector<InteractionType>::iterator foundAParameter = bondtype[ftype].interactionTypes.end();
-    std::vector<InteractionType>::iterator foundBParameter = bondtype[ftype].interactionTypes.end();
+    std::vector<InteractionOfType>::iterator foundAParameter = bondtype[ftype].interactionTypes.end();
+    std::vector<InteractionOfType>::iterator foundBParameter = bondtype[ftype].interactionTypes.end();
     if (bBonded)
     {
-        foundAParameter = defaultInteractionTypeParameters(ftype,
-                                                           bondtype,
-                                                           at,
-                                                           atypes,
-                                                           param,
-                                                           FALSE,
-                                                           &nparam_defA);
+        foundAParameter = defaultInteractionsOfType(ftype,
+                                                    bondtype,
+                                                    at,
+                                                    atypes,
+                                                    param,
+                                                    FALSE,
+                                                    &nparam_defA);
         if (foundAParameter != bondtype[ftype].interactionTypes.end())
         {
             /* Copy the A-state and B-state default parameters. */
@@ -1993,13 +1993,13 @@ void push_bond(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
         {
             bFoundA = true;
         }
-        foundBParameter = defaultInteractionTypeParameters(ftype,
-                                                           bondtype,
-                                                           at,
-                                                           atypes,
-                                                           param,
-                                                           TRUE,
-                                                           &nparam_defB);
+        foundBParameter = defaultInteractionsOfType(ftype,
+                                                    bondtype,
+                                                    at,
+                                                    atypes,
+                                                    param,
+                                                    TRUE,
+                                                    &nparam_defB);
         if (foundBParameter != bondtype[ftype].interactionTypes.end())
         {
             /* Copy only the B-state default parameters */
@@ -2260,8 +2260,8 @@ void push_bond(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
     }
 }
 
-void push_cmap(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
-               gmx::ArrayRef<InteractionTypeParameters> bond,
+void push_cmap(Directive d, gmx::ArrayRef<InteractionsOfType> bondtype,
+               gmx::ArrayRef<InteractionsOfType> bond,
                t_atoms *at, PreprocessingAtomTypes *atypes, char *line,
                warninp *wi)
 {
@@ -2328,8 +2328,8 @@ void push_cmap(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
     {
         atoms.emplace_back(aa[j]-1);
     }
-    std::array<real, MAXFORCEPARAM>     forceParam = {0.0};
-    InteractionType                     param(atoms, forceParam, "");
+    std::array<real, MAXFORCEPARAM>       forceParam = {0.0};
+    InteractionOfType                     param(atoms, forceParam, "");
     /* Get the cmap type for this cmap angle */
     bFound = default_cmap_params(bondtype, at, atypes, &param, FALSE, &cmap_type, &ncmap_params, wi);
 
@@ -2351,7 +2351,7 @@ void push_cmap(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
 
 
 
-void push_vsitesn(Directive d, gmx::ArrayRef<InteractionTypeParameters> bond,
+void push_vsitesn(Directive d, gmx::ArrayRef<InteractionsOfType> bond,
                   t_atoms *at, char *line,
                   warninp *wi)
 {
@@ -2442,7 +2442,7 @@ void push_vsitesn(Directive d, gmx::ArrayRef<InteractionTypeParameters> bond,
         forceParam[0] = nj;
         forceParam[1] = weight[j]/weight_tot;
         /* Put the values in the appropriate arrays */
-        add_param_to_list (&bond[ftype], InteractionType(atoms, forceParam));
+        add_param_to_list (&bond[ftype], InteractionOfType(atoms, forceParam));
     }
 
     sfree(atc);
@@ -2577,7 +2577,7 @@ int add_atomtype_decoupled(t_symtab *symtab, PreprocessingAtomTypes *at,
     atom.ptype = eptAtom;
 
     std::array<real, MAXFORCEPARAM> forceParam = {0.0};
-    nr = at->addType(symtab, atom, "decoupled", InteractionType({}, forceParam, ""), -1, 0);
+    nr = at->addType(symtab, atom, "decoupled", InteractionOfType({}, forceParam, ""), -1, 0);
 
     /* Add space in the non-bonded parameters matrix */
     realloc_nb_params(at, nbparam, pair);
@@ -2585,14 +2585,14 @@ int add_atomtype_decoupled(t_symtab *symtab, PreprocessingAtomTypes *at,
     return nr;
 }
 
-static void convert_pairs_to_pairsQ(gmx::ArrayRef<InteractionTypeParameters> plist,
+static void convert_pairs_to_pairsQ(gmx::ArrayRef<InteractionsOfType> interactions,
                                     real fudgeQQ, t_atoms *atoms)
 {
     /* Add the pair list to the pairQ list */
-    std::vector<InteractionType>         paramnew;
+    std::vector<InteractionOfType>         paramnew;
 
-    gmx::ArrayRef<const InteractionType> paramp1 = plist[F_LJ14].interactionTypes;
-    gmx::ArrayRef<const InteractionType> paramp2 = plist[F_LJC14_Q].interactionTypes;
+    gmx::ArrayRef<const InteractionOfType> paramp1 = interactions[F_LJ14].interactionTypes;
+    gmx::ArrayRef<const InteractionOfType> paramp2 = interactions[F_LJC14_Q].interactionTypes;
 
     /* Fill in the new F_LJC14_Q array with the old one. NOTE:
        it may be possible to just ADD the converted F_LJ14 array
@@ -2612,17 +2612,17 @@ static void convert_pairs_to_pairsQ(gmx::ArrayRef<InteractionTypeParameters> pli
             fudgeQQ, atoms->atom[param.ai()].q, atoms->atom[param.aj()].q,
             param.c0(), param.c1()
         };
-        paramnew.emplace_back(InteractionType(param.atoms(), forceParam, ""));
+        paramnew.emplace_back(InteractionOfType(param.atoms(), forceParam, ""));
     }
 
     /* now assign the new data to the F_LJC14_Q structure */
-    plist[F_LJC14_Q].interactionTypes   = paramnew;
+    interactions[F_LJC14_Q].interactionTypes   = paramnew;
 
     /* Empty the LJ14 pairlist */
-    plist[F_LJ14].interactionTypes.clear();
+    interactions[F_LJ14].interactionTypes.clear();
 }
 
-static void generate_LJCpairsNB(MoleculeInformation *mol, int nb_funct, InteractionTypeParameters *nbp, warninp *wi)
+static void generate_LJCpairsNB(MoleculeInformation *mol, int nb_funct, InteractionsOfType *nbp, warninp *wi)
 {
     int           n, ntype;
     t_atom       *atom;
@@ -2665,7 +2665,7 @@ static void generate_LJCpairsNB(MoleculeInformation *mol, int nb_funct, Interact
                     nbp->interactionTypes[ntype*atom[i].type+atom[j].type].c0(),
                     nbp->interactionTypes[ntype*atom[i].type+atom[j].type].c1()
                 };
-                add_param_to_list(&mol->plist[F_LJC_PAIRS_NB], InteractionType(atoms, forceParam));
+                add_param_to_list(&mol->interactions[F_LJC_PAIRS_NB], InteractionOfType(atoms, forceParam));
             }
         }
     }
@@ -2735,10 +2735,10 @@ static void decouple_atoms(t_atoms *atoms, int atomtype_decouple,
 
 void convert_moltype_couple(MoleculeInformation *mol, int atomtype_decouple, real fudgeQQ,
                             int couple_lam0, int couple_lam1,
-                            bool bCoupleIntra, int nb_funct, InteractionTypeParameters *nbp,
+                            bool bCoupleIntra, int nb_funct, InteractionsOfType *nbp,
                             warninp *wi)
 {
-    convert_pairs_to_pairsQ(mol->plist, fudgeQQ, &mol->atoms);
+    convert_pairs_to_pairsQ(mol->interactions, fudgeQQ, &mol->atoms);
     if (!bCoupleIntra)
     {
         generate_LJCpairsNB(mol, nb_funct, nbp, wi);
index 0c1a689a5411ff0c4ebf2a6a8c70381ea1f63a0a..626fd79f750899b9eeac987e377aefff6e09cbb5 100644 (file)
@@ -50,8 +50,8 @@ struct t_atoms;
 struct t_block;
 struct MoleculeInformation;
 struct t_nbparam;
-class InteractionType;
-struct InteractionTypeParameters;
+class InteractionOfType;
+struct InteractionsOfType;
 struct PreprocessResidue;
 struct warninp;
 
@@ -60,7 +60,7 @@ namespace gmx
 struct ExclusionBlock;
 } // namespace gmx
 
-void generate_nbparams(int comb, int funct, InteractionTypeParameters *plist,
+void generate_nbparams(int comb, int funct, InteractionsOfType *plist,
                        PreprocessingAtomTypes *atype,
                        warninp *wi);
 
@@ -69,15 +69,15 @@ void push_at (struct t_symtab *symtab, PreprocessingAtomTypes *at,
               t_nbparam ***nbparam, t_nbparam ***pair,
               warninp *wi);
 
-void push_bt(Directive d, gmx::ArrayRef<InteractionTypeParameters> bt, int nral,
+void push_bt(Directive d, gmx::ArrayRef<InteractionsOfType> bt, int nral,
              PreprocessingAtomTypes *at, PreprocessingBondAtomType *bat, char *line,
              warninp *wi);
 
-void push_dihedraltype(Directive d, gmx::ArrayRef<InteractionTypeParameters> bt,
+void push_dihedraltype(Directive d, gmx::ArrayRef<InteractionsOfType> bt,
                        PreprocessingBondAtomType *bat, char *line,
                        warninp *wi);
 
-void push_cmaptype(Directive d, gmx::ArrayRef<InteractionTypeParameters> bt, int nral, PreprocessingAtomTypes *at,
+void push_cmaptype(Directive d, gmx::ArrayRef<InteractionsOfType> bt, int nral, PreprocessingAtomTypes *at,
                    PreprocessingBondAtomType *bat, char *line,
                    warninp *wi);
 
@@ -93,20 +93,20 @@ void push_atom(struct t_symtab           *symtab,
                int                       *lastcg,
                warninp                   *wi);
 
-void push_bond(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
-               gmx::ArrayRef<InteractionTypeParameters> bond,
+void push_bond(Directive d, gmx::ArrayRef<InteractionsOfType> bondtype,
+               gmx::ArrayRef<InteractionsOfType> bond,
                t_atoms *at, PreprocessingAtomTypes *atype, char *line,
                bool bBonded, bool bGenPairs, real fudgeQQ,
                bool bZero, bool *bWarn_copy_A_B,
                warninp *wi);
 
 void push_cmap(Directive d,
-               gmx::ArrayRef<InteractionTypeParameters> bondtype,
-               gmx::ArrayRef<InteractionTypeParameters> bond,
+               gmx::ArrayRef<InteractionsOfType> bondtype,
+               gmx::ArrayRef<InteractionsOfType> bond,
                t_atoms *at, PreprocessingAtomTypes *atype, char *line,
                warninp *wi);
 
-void push_vsitesn(Directive d, gmx::ArrayRef<InteractionTypeParameters> bond,
+void push_vsitesn(Directive d, gmx::ArrayRef<InteractionsOfType> bond,
                   t_atoms *at, char *line,
                   warninp *wi);
 
@@ -119,7 +119,7 @@ void push_molt(struct t_symtab *symtab, std::vector<MoleculeInformation> *mol, c
 
 void push_excl(char *line, gmx::ArrayRef<gmx::ExclusionBlock> b2, warninp *wi);
 
-int copy_nbparams(t_nbparam **param, int ftype, InteractionTypeParameters *plist, int nr);
+int copy_nbparams(t_nbparam **param, int ftype, InteractionsOfType *plist, int nr);
 
 void free_nbparam(t_nbparam **param, int nr);
 
@@ -133,7 +133,7 @@ void convert_moltype_couple(MoleculeInformation *mol, int atomtype_decouple,
                             real fudgeQQ,
                             int couple_lam0, int couple_lam1,
                             bool bCoupleIntra,
-                            int nb_funct, InteractionTypeParameters *nbp,
+                            int nb_funct, InteractionsOfType *nbp,
                             warninp *wi);
 /* Setup mol such that the B-state has no interaction with the rest
  * of the system, but full interaction with itself.
index 5129535d428f04e5dc3e96c0d9f25e3611329b61..d640f6ca22176bfc4ef9f7239b86b0dc7d5ec6a8 100644 (file)
@@ -75,7 +75,7 @@ static int count_hydrogens (char ***atomname, int nra, gmx::ArrayRef<const int>
     return nh;
 }
 
-void make_shake(gmx::ArrayRef<InteractionTypeParameters> plist, t_atoms *atoms, int nshake)
+void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms *atoms, int nshake)
 {
     char                  ***info = atoms->atomname;
     real                     b_ij, b_jk;
@@ -108,17 +108,17 @@ void make_shake(gmx::ArrayRef<InteractionTypeParameters> plist, t_atoms *atoms,
             {
                 if (interaction_function[ftype].flags & IF_BTYPE)
                 {
-                    InteractionTypeParameters *bonds = &(plist[ftype]);
+                    InteractionsOfType *bonds = &(plist[ftype]);
 
                     for (int ftype_a = 0; (gmx::ssize(*bonds) > 0 && ftype_a < F_NRE); ftype_a++)
                     {
                         if (interaction_function[ftype_a].flags & IF_ATYPE)
                         {
-                            InteractionTypeParameters *pr = &(plist[ftype_a]);
+                            InteractionsOfType *pr = &(plist[ftype_a]);
 
                             for (auto parm = pr->interactionTypes.begin(); parm != pr->interactionTypes.end(); )
                             {
-                                const InteractionType *ang = &(*parm);
+                                const InteractionOfType *ang = &(*parm);
 #ifdef DEBUG
                                 printf("Angle: %d-%d-%d\n", ang->ai(), ang->aj(), ang->ak());
 #endif
@@ -164,7 +164,7 @@ void make_shake(gmx::ArrayRef<InteractionTypeParameters> plist, t_atoms *atoms,
                                         printf("p: %d, q: %d, dist: %12.5e\n", atomNumbers[0],
                                                atomNumbers[1], forceParm[0]);
 #endif
-                                        add_param_to_list (&(plist[F_CONSTR]), InteractionType(atomNumbers, forceParm));
+                                        add_param_to_list (&(plist[F_CONSTR]), InteractionOfType(atomNumbers, forceParm));
                                         /* move the last bond to this position */
                                         *parm = *(pr->interactionTypes.end() - 1);
                                         pr->interactionTypes.erase(pr->interactionTypes.end() - 1);
@@ -188,7 +188,7 @@ void make_shake(gmx::ArrayRef<InteractionTypeParameters> plist, t_atoms *atoms,
         {
             if (interaction_function[ftype].flags & IF_BTYPE)
             {
-                InteractionTypeParameters *pr = &(plist[ftype]);
+                InteractionsOfType *pr = &(plist[ftype]);
                 for (auto parm = pr->interactionTypes.begin(); parm != pr->interactionTypes.end(); )
                 {
                     if ( (nshake != eshHBONDS) ||
@@ -197,7 +197,7 @@ void make_shake(gmx::ArrayRef<InteractionTypeParameters> plist, t_atoms *atoms,
                         /* append this bond to the shake list */
                         std::vector<int>  atomNumbers = {parm->ai(), parm->aj()};
                         std::vector<real> forceParm   = { parm->c0(), parm->c2()};
-                        add_param_to_list (&(plist[F_CONSTR]), InteractionType(atomNumbers, forceParm));
+                        add_param_to_list (&(plist[F_CONSTR]), InteractionOfType(atomNumbers, forceParm));
                         parm = pr->interactionTypes.erase(parm);
                     }
                     else
index f9163f50db88f744c7d0f29ae957dc7d256d4479..7f2d57fe08e87e0f47754d7687ac17baa2c8a8b2 100644 (file)
@@ -41,8 +41,8 @@
 #include "gromacs/utility/arrayref.h"
 
 struct t_atoms;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 
-void make_shake (gmx::ArrayRef<InteractionTypeParameters> plist, t_atoms *atoms, int nshake);
+void make_shake (gmx::ArrayRef<InteractionsOfType> plist, t_atoms *atoms, int nshake);
 
 #endif
index 8a1dd6941264e5a65aa0f9d91e1c84342004da40..92aa543fcc7d71bebd0010e95298570373feb621 100644 (file)
@@ -57,7 +57,7 @@
 
 /* UTILITIES */
 
-void add_param_to_list(InteractionTypeParameters *list, const InteractionType &b)
+void add_param_to_list(InteractionsOfType *list, const InteractionOfType &b)
 {
     list->interactionTypes.emplace_back(b);
 }
@@ -65,7 +65,7 @@ void add_param_to_list(InteractionTypeParameters *list, const InteractionType &b
 /* PRINTING STRUCTURES */
 
 static void print_bt(FILE *out, Directive d, PreprocessingAtomTypes *at,
-                     int ftype, int fsubtype, gmx::ArrayRef<const InteractionTypeParameters> plist,
+                     int ftype, int fsubtype, gmx::ArrayRef<const InteractionsOfType> plist,
                      bool bFullDih)
 {
     /* This dihp is a DIRTY patch because the dih-types do not use
@@ -75,7 +75,7 @@ static void print_bt(FILE *out, Directive d, PreprocessingAtomTypes *at,
     int                              nral, nrfp;
     bool                             bDih = false, bSwapParity;
 
-    const InteractionTypeParameters *bt = &(plist[ftype]);
+    const InteractionsOfType        *bt = &(plist[ftype]);
 
     if (bt->size() == 0)
     {
@@ -386,7 +386,7 @@ void print_atoms(FILE *out, PreprocessingAtomTypes *atype, t_atoms *at, int *cgn
 }
 
 void print_bondeds(FILE *out, int natoms, Directive d,
-                   int ftype, int fsubtype, gmx::ArrayRef<const InteractionTypeParameters> plist)
+                   int ftype, int fsubtype, gmx::ArrayRef<const InteractionsOfType> plist)
 {
     t_symtab               stab;
     t_atom                *a;
@@ -398,7 +398,7 @@ void print_bondeds(FILE *out, int natoms, Directive d,
     {
         char buf[12];
         sprintf(buf, "%4d", (i+1));
-        atype.addType(&stab, *a, buf, InteractionType({}, {}), 0, 0);
+        atype.addType(&stab, *a, buf, InteractionOfType({}, {}), 0, 0);
     }
     print_bt(out, d, &atype, ftype, fsubtype, plist, TRUE);
 
index 1c04e647045e1a496161718ad09e3e9939caeb23..beca74c6e9a00bec7cf3d10428af46dcce8cc322 100644 (file)
@@ -50,14 +50,14 @@ struct t_atoms;
 struct t_blocka;
 struct t_excls;
 struct MoleculeInformation;
-class InteractionType;
-struct InteractionTypeParameters;
+class InteractionOfType;
+struct InteractionsOfType;
 
 /* UTILITIES */
 
 int name2index(char *str, char ***typenames, int ntypes);
 
-void add_param_to_list(InteractionTypeParameters *list, const InteractionType &b);
+void add_param_to_list(InteractionsOfType *list, const InteractionOfType &b);
 
 
 
@@ -70,7 +70,7 @@ void print_atoms(FILE *out, PreprocessingAtomTypes *atype, t_atoms *at, int *cgn
                  bool bRTPresname);
 
 void print_bondeds(FILE *out, int natoms, Directive d,
-                   int ftype, int fsubtype, gmx::ArrayRef<const InteractionTypeParameters> plist);
+                   int ftype, int fsubtype, gmx::ArrayRef<const InteractionsOfType> plist);
 
 void print_excl(FILE *out, int natoms, t_excls excls[]);
 
index b20cf08008535a35a10275e6e736379b422f3752..0a3c2ccbb000c51cbd03a78b964836a454b3cdf3 100644 (file)
@@ -62,6 +62,7 @@
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/strconvert.h"
 
+#include "hackblock.h"
 #include "resall.h"
 
 typedef struct {
@@ -75,11 +76,11 @@ typedef struct {
 
 struct VsiteBondParameter
 {
-    VsiteBondParameter(int ftype, const InteractionType &type)
-        : ftype_(ftype), type_(type)
+    VsiteBondParameter(int ftype, const InteractionOfType &vsiteInteraction)
+        : ftype_(ftype), vsiteInteraction_(vsiteInteraction)
     {}
-    int                    ftype_;
-    const InteractionType &type_;
+    int                      ftype_;
+    const InteractionOfType &vsiteInteraction_;
 };
 
 struct Atom2VsiteBond
@@ -109,7 +110,7 @@ static int vsite_bond_nrcheck(int ftype)
 }
 
 static void enter_bonded(int nratoms, int *nrbonded, t_mybonded **bondeds,
-                         const InteractionType &type)
+                         const InteractionOfType &type)
 {
     srenew(*bondeds, *nrbonded+1);
 
@@ -136,9 +137,9 @@ static void get_bondeds(int nrat, gmx::ArrayRef<const int> atoms,
     {
         for (auto &vsite : at2vb[atoms[k]].vSiteBondedParameters)
         {
-            int                    ftype   = vsite.ftype_;
-            const InteractionType &type    = vsite.type_;
-            int                    nrcheck = vsite_bond_nrcheck(ftype);
+            int                      ftype   = vsite.ftype_;
+            const InteractionOfType &type    = vsite.vsiteInteraction_;
+            int                      nrcheck = vsite_bond_nrcheck(ftype);
             /* abuse nrcheck to see if we're adding bond, angle or idih */
             switch (nrcheck)
             {
@@ -151,7 +152,7 @@ static void get_bondeds(int nrat, gmx::ArrayRef<const int> atoms,
 }
 
 static std::vector<Atom2VsiteBond>
-make_at2vsitebond(int natoms, gmx::ArrayRef<InteractionTypeParameters> plist)
+make_at2vsitebond(int natoms, gmx::ArrayRef<InteractionsOfType> plist)
 {
     bool                       *bVSI;
 
@@ -197,7 +198,7 @@ make_at2vsitebond(int natoms, gmx::ArrayRef<InteractionTypeParameters> plist)
 }
 
 static std::vector<Atom2VsiteConnection>
-make_at2vsitecon(int natoms, gmx::ArrayRef<InteractionTypeParameters> plist)
+make_at2vsitecon(int natoms, gmx::ArrayRef<InteractionsOfType> plist)
 {
     std::vector<bool>                 bVSI(natoms);
     std::vector<Atom2VsiteConnection> at2vc(natoms);
@@ -278,7 +279,7 @@ static void print_bad(FILE *fp,
     }
 }
 
-static void printInteractionType(FILE *fp, int ftype, int i, const InteractionType &type)
+static void printInteractionOfType(FILE *fp, int ftype, int i, const InteractionOfType &type)
 {
     static int pass       = 0;
     static int prev_ftype = NOTSET;
@@ -362,7 +363,7 @@ static const char *get_atomtype_name_AB(t_atom *atom, PreprocessingAtomTypes *at
 }
 
 static bool calc_vsite3_param(PreprocessingAtomTypes *atypes,
-                              InteractionType *param, t_atoms *at,
+                              InteractionOfType *param, t_atoms *at,
                               int nrbond, t_mybonded *bonds,
                               int nrang,  t_mybonded *angles )
 {
@@ -440,7 +441,7 @@ static bool calc_vsite3_param(PreprocessingAtomTypes *atypes,
     return bError;
 }
 
-static bool calc_vsite3fd_param(InteractionType *param,
+static bool calc_vsite3fd_param(InteractionOfType *param,
                                 int nrbond, t_mybonded *bonds,
                                 int nrang,  t_mybonded *angles)
 {
@@ -468,7 +469,7 @@ static bool calc_vsite3fd_param(InteractionType *param,
     return bError;
 }
 
-static bool calc_vsite3fad_param(InteractionType *param,
+static bool calc_vsite3fad_param(InteractionOfType *param,
                                  int nrbond, t_mybonded *bonds,
                                  int nrang,  t_mybonded *angles)
 {
@@ -499,7 +500,7 @@ static bool calc_vsite3fad_param(InteractionType *param,
 }
 
 static bool calc_vsite3out_param(PreprocessingAtomTypes *atypes,
-                                 InteractionType *param, t_atoms *at,
+                                 InteractionOfType *param, t_atoms *at,
                                  int nrbond, t_mybonded *bonds,
                                  int nrang,  t_mybonded *angles)
 {
@@ -595,7 +596,7 @@ static bool calc_vsite3out_param(PreprocessingAtomTypes *atypes,
     return bError;
 }
 
-static bool calc_vsite4fd_param(InteractionType *param,
+static bool calc_vsite4fd_param(InteractionOfType *param,
                                 int nrbond, t_mybonded *bonds,
                                 int nrang,  t_mybonded *angles)
 {
@@ -652,7 +653,7 @@ static bool calc_vsite4fd_param(InteractionType *param,
 
 
 static bool
-calc_vsite4fdn_param(InteractionType *param,
+calc_vsite4fdn_param(InteractionOfType *param,
                      int nrbond, t_mybonded *bonds,
                      int nrang,  t_mybonded *angles)
 {
@@ -710,7 +711,7 @@ calc_vsite4fdn_param(InteractionType *param,
 
 
 int set_vsites(bool bVerbose, t_atoms *atoms, PreprocessingAtomTypes *atypes,
-               gmx::ArrayRef<InteractionTypeParameters> plist)
+               gmx::ArrayRef<InteractionsOfType> plist)
 {
     int             ftype;
     int             nvsite, nrbond, nrang, nridih, nrset;
@@ -752,7 +753,7 @@ int set_vsites(bool bVerbose, t_atoms *atoms, PreprocessingAtomTypes *atypes,
                 if (debug)
                 {
                     fprintf(debug, "bSet=%s ", gmx::boolToString(bSet));
-                    printInteractionType(debug, ftype, i, plist[ftype].interactionTypes[i]);
+                    printInteractionOfType(debug, ftype, i, plist[ftype].interactionTypes[i]);
                 }
                 if (!bSet)
                 {
@@ -872,11 +873,35 @@ void set_vsites_ptype(bool bVerbose, gmx_moltype_t *molt)
 
 }
 
-typedef struct {
-    int ftype, parnr;
-} t_pindex;
+/*! \brief
+ *  Convenience typedef for linking function type to parameter numbers.
+ *
+ *  The entries in this datastructure are valid if the particle participates in
+ *  a virtual site interaction and has a valid vsite function type other than VSITEN.
+ *  \todo Change to remove empty constructor when gmx::compat::optional is available.
+ */
+class VsiteAtomMapping
+{
+    public:
+        //! Only construct with all information in place or nothing
+        VsiteAtomMapping(int functionType, int interactionIndex)
+            : functionType_(functionType), interactionIndex_(interactionIndex)
+        {}
+        VsiteAtomMapping()
+            : functionType_(-1), interactionIndex_(-1)
+        {}
+        //! Get function type.
+        const int &functionType() const { return functionType_; }
+        //! Get parameter number.
+        const int &interactionIndex() const { return interactionIndex_; };
+    private:
+        //! Function type for the linked parameter.
+        int functionType_;
+        //! The linked parameter.
+        int interactionIndex_;
+};
 
-static void check_vsite_constraints(gmx::ArrayRef<InteractionTypeParameters> plist,
+static void check_vsite_constraints(gmx::ArrayRef<InteractionsOfType> plist,
                                     int cftype, const int vsite_type[])
 {
     int n  = 0;
@@ -900,14 +925,15 @@ static void check_vsite_constraints(gmx::ArrayRef<InteractionTypeParameters> pli
     }
 }
 
-static void clean_vsite_bonds(gmx::ArrayRef<InteractionTypeParameters> plist, t_pindex pindex[],
+static void clean_vsite_bonds(gmx::ArrayRef<InteractionsOfType> plist,
+                              gmx::ArrayRef<const VsiteAtomMapping> pindex,
                               int cftype, const int vsite_type[])
 {
     int                           ftype, nOut;
     int                           nconverted, nremoved;
     int                           oatom, at1, at2;
     bool                          bKeep, bRemove, bAllFD;
-    InteractionTypeParameters    *ps;
+    InteractionsOfType           *ps;
 
     if (cftype == F_CONNBONDS)
     {
@@ -936,18 +962,18 @@ static void clean_vsite_bonds(gmx::ArrayRef<InteractionTypeParameters> plist, t_
             if (vsite_type[atom] != NOTSET && vsite_type[atom] != F_VSITEN)
             {
                 nvsite++;
-                bool bThisFD = ( (pindex[atom].ftype == F_VSITE3FD ) ||
-                                 (pindex[atom].ftype == F_VSITE3FAD) ||
-                                 (pindex[atom].ftype == F_VSITE4FD ) ||
-                                 (pindex[atom].ftype == F_VSITE4FDN ) );
-                bool bThisOUT = ( (pindex[atom].ftype == F_VSITE3OUT) &&
+                bool bThisFD = ( (pindex[atom].functionType() == F_VSITE3FD ) ||
+                                 (pindex[atom].functionType() == F_VSITE3FAD) ||
+                                 (pindex[atom].functionType() == F_VSITE4FD ) ||
+                                 (pindex[atom].functionType() == F_VSITE4FDN ) );
+                bool bThisOUT = ( (pindex[atom].functionType() == F_VSITE3OUT) &&
                                   ((interaction_function[cftype].flags & IF_CONSTRAINT) != 0u) );
                 bAllFD = bAllFD && bThisFD;
                 if (bThisFD || bThisOUT)
                 {
                     oatom = atoms[1-k]; /* the other atom */
                     if (vsite_type[oatom] == NOTSET &&
-                        oatom == plist[pindex[atom].ftype].interactionTypes[pindex[atom].parnr].aj())
+                        oatom == plist[pindex[atom].functionType()].interactionTypes[pindex[atom].interactionIndex()].aj())
                     {
                         /* if the other atom isn't a vsite, and it is AI */
                         bRemove = true;
@@ -969,8 +995,8 @@ static void clean_vsite_bonds(gmx::ArrayRef<InteractionTypeParameters> plist, t_
                         /* TODO This would be nicer to implement with
                            a C++ "vector view" class" with an
                            STL-container-like interface. */
-                        vsnral      = NRAL(pindex[atom].ftype) - 1;
-                        first_atoms = plist[pindex[atom].ftype].interactionTypes[pindex[atom].parnr].atoms().data() + 1;
+                        vsnral      = NRAL(pindex[atom].functionType()) - 1;
+                        first_atoms = plist[pindex[atom].functionType()].interactionTypes[pindex[atom].interactionIndex()].atoms().data() + 1;
                     }
                     else
                     {
@@ -978,14 +1004,14 @@ static void clean_vsite_bonds(gmx::ArrayRef<InteractionTypeParameters> plist, t_
                         GMX_ASSERT(first_atoms != nullptr, "nvsite > 1 must have first_atoms != NULL");
                         /* if it is not the first then
                            check if this vsite is constructed from the same atoms */
-                        if (vsnral == NRAL(pindex[atom].ftype)-1)
+                        if (vsnral == NRAL(pindex[atom].functionType())-1)
                         {
                             for (int m = 0; (m < vsnral) && !bKeep; m++)
                             {
                                 const int *atoms;
 
                                 bool       bPresent = false;
-                                atoms    = plist[pindex[atom].ftype].interactionTypes[pindex[atom].parnr].atoms().data() + 1;
+                                atoms    = plist[pindex[atom].functionType()].interactionTypes[pindex[atom].interactionIndex()].atoms().data() + 1;
                                 for (int n = 0; (n < vsnral) && !bPresent; n++)
                                 {
                                     if (atoms[m] == first_atoms[n])
@@ -1121,12 +1147,13 @@ static void clean_vsite_bonds(gmx::ArrayRef<InteractionTypeParameters> plist, t_
     }
 }
 
-static void clean_vsite_angles(gmx::ArrayRef<InteractionTypeParameters> plist, t_pindex pindex[],
+static void clean_vsite_angles(gmx::ArrayRef<InteractionsOfType> plist,
+                               gmx::ArrayRef<VsiteAtomMapping> pindex,
                                int cftype, const int vsite_type[],
                                gmx::ArrayRef<const Atom2VsiteConnection> at2vc)
 {
     int                           atom, at1, at2;
-    InteractionTypeParameters    *ps;
+    InteractionsOfType           *ps;
 
     ps     = &(plist[cftype]);
     int oldSize = ps->size();
@@ -1146,26 +1173,26 @@ static void clean_vsite_angles(gmx::ArrayRef<InteractionTypeParameters> plist, t
             if (vsite_type[atom] != NOTSET && vsite_type[atom] != F_VSITEN)
             {
                 nvsite++;
-                bAll3FAD = bAll3FAD && (pindex[atom].ftype == F_VSITE3FAD);
+                bAll3FAD = bAll3FAD && (pindex[atom].functionType() == F_VSITE3FAD);
                 if (nvsite == 1)
                 {
                     /* store construction atoms of first vsite */
-                    vsnral      = NRAL(pindex[atom].ftype) - 1;
-                    first_atoms = plist[pindex[atom].ftype].interactionTypes[pindex[atom].parnr].atoms().data() + 1;
+                    vsnral      = NRAL(pindex[atom].functionType()) - 1;
+                    first_atoms = plist[pindex[atom].functionType()].interactionTypes[pindex[atom].interactionIndex()].atoms().data() + 1;
                 }
                 else
                 {
                     GMX_ASSERT(vsnral != 0, "If we've seen a vsite before, we know how many constructing atoms it had");
                     GMX_ASSERT(first_atoms != nullptr, "If we've seen a vsite before, we know what its first atom index was");
                     /* check if this vsite is constructed from the same atoms */
-                    if (vsnral == NRAL(pindex[atom].ftype)-1)
+                    if (vsnral == NRAL(pindex[atom].functionType())-1)
                     {
                         for (int m = 0; (m < vsnral) && !bKeep; m++)
                         {
                             const int *subAtoms;
 
                             bool       bPresent = false;
-                            subAtoms    = plist[pindex[atom].ftype].interactionTypes[pindex[atom].parnr].atoms().data() + 1;
+                            subAtoms    = plist[pindex[atom].functionType()].interactionTypes[pindex[atom].interactionIndex()].atoms().data() + 1;
                             for (int n = 0; (n < vsnral) && !bPresent; n++)
                             {
                                 if (subAtoms[m] == first_atoms[n])
@@ -1256,10 +1283,11 @@ static void clean_vsite_angles(gmx::ArrayRef<InteractionTypeParameters> plist, t
     }
 }
 
-static void clean_vsite_dihs(gmx::ArrayRef<InteractionTypeParameters> plist, t_pindex pindex[],
+static void clean_vsite_dihs(gmx::ArrayRef<InteractionsOfType> plist,
+                             gmx::ArrayRef<const VsiteAtomMapping> pindex,
                              int cftype, const int vsite_type[])
 {
-    InteractionTypeParameters *ps;
+    InteractionsOfType *ps;
 
     ps = &(plist[cftype]);
 
@@ -1282,22 +1310,22 @@ static void clean_vsite_dihs(gmx::ArrayRef<InteractionTypeParameters> plist, t_p
                 if (nvsite == 0)
                 {
                     /* store construction atoms of first vsite */
-                    vsnral      = NRAL(pindex[atom].ftype) - 1;
-                    first_atoms = plist[pindex[atom].ftype].interactionTypes[pindex[atom].parnr].atoms().data() + 1;
+                    vsnral      = NRAL(pindex[atom].functionType()) - 1;
+                    first_atoms = plist[pindex[atom].functionType()].interactionTypes[pindex[atom].interactionIndex()].atoms().data() + 1;
                 }
                 else
                 {
                     GMX_ASSERT(vsnral != 0, "If we've seen a vsite before, we know how many constructing atoms it had");
                     GMX_ASSERT(first_atoms != nullptr, "If we've seen a vsite before, we know what its first atom index was");
                     /* check if this vsite is constructed from the same atoms */
-                    if (vsnral == NRAL(pindex[atom].ftype)-1)
+                    if (vsnral == NRAL(pindex[atom].functionType())-1)
                     {
                         for (int m = 0; (m < vsnral) && !bKeep; m++)
                         {
                             const int *subAtoms;
 
                             bool       bPresent = false;
-                            subAtoms    = plist[pindex[atom].ftype].interactionTypes[pindex[atom].parnr].atoms().data() + 1;
+                            subAtoms    = plist[pindex[atom].functionType()].interactionTypes[pindex[atom].interactionIndex()].atoms().data() + 1;
                             for (int n = 0; (n < vsnral) && !bPresent; n++)
                             {
                                 if (subAtoms[m] == first_atoms[n])
@@ -1368,14 +1396,14 @@ static void clean_vsite_dihs(gmx::ArrayRef<InteractionTypeParameters> plist, t_p
     }
 }
 
-void clean_vsite_bondeds(gmx::ArrayRef<InteractionTypeParameters> plist, int natoms, bool bRmVSiteBds)
+// TODO use gmx::compat::optional for pindex.
+void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> plist, int natoms, bool bRmVSiteBds)
 {
-    int                               nvsite, vsite;
-    int                              *vsite_type;
-    t_pindex                         *pindex;
-    std::vector<Atom2VsiteConnection> at2vc;
+    int                                 nvsite, vsite;
+    int                                *vsite_type;
+    std::vector<VsiteAtomMapping>       pindex;
+    std::vector<Atom2VsiteConnection>   at2vc;
 
-    pindex = nullptr; /* avoid warnings */
     /* make vsite_type array */
     snew(vsite_type, natoms);
     for (int i = 0; i < natoms; i++)
@@ -1424,7 +1452,7 @@ void clean_vsite_bondeds(gmx::ArrayRef<InteractionTypeParameters> plist, int nat
         /* Make a reverse list to avoid ninteractions^2 operations */
         at2vc = make_at2vsitecon(natoms, plist);
 
-        snew(pindex, natoms);
+        pindex.resize(natoms);
         for (int ftype = 0; ftype < F_NRE; ftype++)
         {
             /* Here we skip VSITEN. In neary all practical use cases this
@@ -1441,11 +1469,12 @@ void clean_vsite_bondeds(gmx::ArrayRef<InteractionTypeParameters> plist, int nat
             if ((interaction_function[ftype].flags & IF_VSITE) &&
                 ftype != F_VSITEN)
             {
-                for (int parnr = 0; (parnr < gmx::ssize(plist[ftype])); parnr++)
+                for (int interactionIndex = 0;
+                     interactionIndex < gmx::ssize(plist[ftype]);
+                     interactionIndex++)
                 {
-                    int k               = plist[ftype].interactionTypes[parnr].ai();
-                    pindex[k].ftype = ftype;
-                    pindex[k].parnr = parnr;
+                    int k               = plist[ftype].interactionTypes[interactionIndex].ai();
+                    pindex[k] = VsiteAtomMapping(ftype, interactionIndex);
                 }
             }
         }
@@ -1480,6 +1509,5 @@ void clean_vsite_bondeds(gmx::ArrayRef<InteractionTypeParameters> plist, int nat
         }
 
     }
-    sfree(pindex);
     sfree(vsite_type);
 }
index ec383ac64c868510a8e91833426203581305e373..0026edc91a1fc2b397320bc7a46de397ea8c1499 100644 (file)
 class PreprocessingAtomTypes;
 struct gmx_moltype_t;
 struct t_atoms;
-struct InteractionTypeParameters;
+struct InteractionsOfType;
 
 int set_vsites(bool bVerbose, t_atoms *atoms,  PreprocessingAtomTypes *atype,
-               gmx::ArrayRef<InteractionTypeParameters> plist);
+               gmx::ArrayRef<InteractionsOfType> plist);
 /* set parameters for virtual sites, return number of virtual sites */
 
 void set_vsites_ptype(bool bVerbose,  gmx_moltype_t *molt);
@@ -56,6 +56,6 @@ void set_vsites_ptype(bool bVerbose,  gmx_moltype_t *molt);
  *
  * Throw away all obsolete bonds, angles and dihedrals.
  * Throw away all constraints. */
-void clean_vsite_bondeds(gmx::ArrayRef<InteractionTypeParameters> ps, int natoms, bool bRmVSiteBds);
+void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> ps, int natoms, bool bRmVSiteBds);
 
 #endif
index 35af9d383deaa930438991878d6237aebd08eedf..476eb7755ee93252dc10218831bd6ddd2bfd81fd 100644 (file)
@@ -94,7 +94,7 @@ static bool is_bond(int nnm, t_nm2type nmt[], char *ai, char *aj, real blen)
 }
 
 static void mk_bonds(int nnm, t_nm2type nmt[],
-                     t_atoms *atoms, const rvec x[], InteractionTypeParameters *bond, int nbond[],
+                     t_atoms *atoms, const rvec x[], InteractionsOfType *bond, int nbond[],
                      bool bPBC, matrix box)
 {
     int                             i, j;
@@ -131,7 +131,7 @@ static void mk_bonds(int nnm, t_nm2type nmt[],
             {
                 forceParam[0] = std::sqrt(dx2);
                 std::vector<int> atoms = {i, j};
-                add_param_to_list (bond, InteractionType(atoms, forceParam));
+                add_param_to_list (bond, InteractionOfType(atoms, forceParam));
                 nbond[i]++;
                 nbond[j]++;
             }
@@ -171,7 +171,7 @@ static int *set_cgnr(t_atoms *atoms, bool bUsePDBcharge, real *qtot, real *mtot)
 static void set_atom_type(PreprocessingAtomTypes     *atypes,
                           t_symtab                   *tab,
                           t_atoms                    *atoms,
-                          InteractionTypeParameters  *bonds,
+                          InteractionsOfType         *bonds,
                           int                        *nbonds,
                           int                         nnm,
                           t_nm2type                   nm2t[])
@@ -190,7 +190,7 @@ static void set_atom_type(PreprocessingAtomTypes     *atypes,
             atypes->size());
 }
 
-static void lo_set_force_const(InteractionTypeParameters *plist, real c[], int nrfp, bool bRound,
+static void lo_set_force_const(InteractionsOfType *plist, real c[], int nrfp, bool bRound,
                                bool bDih, bool bParam)
 {
     double cc;
@@ -236,11 +236,11 @@ static void lo_set_force_const(InteractionTypeParameters *plist, real c[], int n
             forceParam[j]      = c[j];
             forceParam[nrfp+j] = c[j];
         }
-        param = InteractionType(param.atoms(), forceParam);
+        param = InteractionOfType(param.atoms(), forceParam);
     }
 }
 
-static void set_force_const(gmx::ArrayRef<InteractionTypeParameters> plist, real kb, real kt, real kp, bool bRound,
+static void set_force_const(gmx::ArrayRef<InteractionsOfType> plist, real kb, real kt, real kp, bool bRound,
                             bool bParam)
 {
     real c[MAXFORCEPARAM];
@@ -255,7 +255,7 @@ static void set_force_const(gmx::ArrayRef<InteractionTypeParameters> plist, real
     lo_set_force_const(&plist[F_PDIHS], c, 3, bRound, TRUE, bParam);
 }
 
-static void calc_angles_dihs(InteractionTypeParameters *ang, InteractionTypeParameters *dih, const rvec x[], bool bPBC,
+static void calc_angles_dihs(InteractionsOfType *ang, InteractionsOfType *dih, const rvec x[], bool bPBC,
                              matrix box)
 {
     int    t1, t2, t3;
@@ -296,7 +296,7 @@ static void dump_hybridization(FILE *fp, t_atoms *atoms, int nbonds[])
     }
 }
 
-static void print_pl(FILE *fp, gmx::ArrayRef<const InteractionTypeParameters> plist, int ftp, const char *name,
+static void print_pl(FILE *fp, gmx::ArrayRef<const InteractionsOfType> plist, int ftp, const char *name,
                      char ***atomname)
 {
     if (!plist[ftp].interactionTypes.empty())
@@ -327,7 +327,7 @@ static void print_pl(FILE *fp, gmx::ArrayRef<const InteractionTypeParameters> pl
 static void print_rtp(const char                                     *filenm,
                       const char                                     *title,
                       t_atoms                                        *atoms,
-                      gmx::ArrayRef<const InteractionTypeParameters>  plist,
+                      gmx::ArrayRef<const InteractionsOfType>         plist,
                       PreprocessingAtomTypes                         *atypes,
                       int                                             cgnr[])
 {
@@ -390,7 +390,7 @@ int gmx_x2top(int argc, char *argv[])
         "The atoms to atomtype translation table is incomplete ([TT]atomname2type.n2t[tt] file in the data directory). Please extend it and send the results back to the GROMACS crew."
     };
     FILE                                        *fp;
-    std::array<InteractionTypeParameters, F_NRE> plist;
+    std::array<InteractionsOfType, F_NRE>        plist;
     t_excls                                     *excls;
     t_nextnb                                     nnb;
     t_nm2type                                   *nm2t;