Refactor gmx_group_t to SimulationAtomGroups
[alexxy/gromacs.git] / src / gromacs / mdlib / forcerec.cpp
index 1d42ce69b2296f31094af903df90cb51e50e5d8b..56c5707d9273454f6b2217e37191b78d63da73d4 100644 (file)
@@ -489,9 +489,9 @@ check_solvent(FILE  *                fp,
             for (cg_mol = 0; cg_mol < cgs->nr; cg_mol++)
             {
                 check_solvent_cg(molt, cg_mol, nmol,
-                                 mtop->groups.grpnr[egcQMMM] ?
-                                 mtop->groups.grpnr[egcQMMM]+at_offset+am : nullptr,
-                                 &mtop->groups.grps[egcQMMM],
+                                 mtop->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics].empty() ?
+                                 nullptr : mtop->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics].data()+at_offset+am,
+                                 &mtop->groups.groups[SimulationAtomGroupType::QuantumMechanics],
                                  fr,
                                  &n_solvent_parameters, &solvent_parameters,
                                  cginfo_mb[mb].cginfo[cgm+cg_mol],
@@ -621,17 +621,17 @@ static cginfo_mb_t *init_cginfo_mb(FILE *fplog, const gmx_mtop_t *mtop,
             {
                 a0 = cgs->index[cg];
                 a1 = cgs->index[cg+1];
-                if (getGroupType(mtop->groups, egcENER, a_offset+am+a0) !=
-                    getGroupType(mtop->groups, egcENER, a_offset   +a0))
+                if (getGroupType(mtop->groups, SimulationAtomGroupType::QuantumMechanics, a_offset+am+a0) !=
+                    getGroupType(mtop->groups, SimulationAtomGroupType::QuantumMechanics, a_offset   +a0))
                 {
                     bId = FALSE;
                 }
-                if (mtop->groups.grpnr[egcQMMM] != nullptr)
+                if (!mtop->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics].empty())
                 {
                     for (ai = a0; ai < a1; ai++)
                     {
-                        if (mtop->groups.grpnr[egcQMMM][a_offset+am+ai] !=
-                            mtop->groups.grpnr[egcQMMM][a_offset   +ai])
+                        if (mtop->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics][a_offset+am+ai] !=
+                            mtop->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics][a_offset   +ai])
                         {
                             bId = FALSE;
                         }
@@ -678,7 +678,7 @@ static cginfo_mb_t *init_cginfo_mb(FILE *fplog, const gmx_mtop_t *mtop,
                 a1 = cgs->index[cg+1];
 
                 /* Store the energy group in cginfo */
-                gid = getGroupType(mtop->groups, egcENER, a_offset+am+a0);
+                gid = getGroupType(mtop->groups, SimulationAtomGroupType::EnergyOutput, a_offset+am+a0);
                 SET_CGINFO_GID(cginfo[cgm+cg], gid);
 
                 /* Check the intra/inter charge group exclusions */
@@ -2203,7 +2203,7 @@ void init_forcerec(FILE                             *fp,
         if (negptable > 0)
         {
             /* Read the special tables for certain energy group pairs */
-            nm_ind = mtop->groups.grps[egcENER].nm_ind;
+            nm_ind = mtop->groups.groups[SimulationAtomGroupType::EnergyOutput].nm_ind;
             for (egi = 0; egi < negp_pp; egi++)
             {
                 for (egj = egi; egj < negp_pp; egj++)
@@ -2217,8 +2217,8 @@ void init_forcerec(FILE                             *fp,
                         }
                         /* Read the table file with the two energy groups names appended */
                         make_nbf_tables(fp, ic, rtab, tabfn,
-                                        *mtop->groups.grpname[nm_ind[egi]],
-                                        *mtop->groups.grpname[nm_ind[egj]],
+                                        *mtop->groups.groupNames[nm_ind[egi]],
+                                        *mtop->groups.groupNames[nm_ind[egj]],
                                         &fr->nblists[m]);
                         m++;
                     }
@@ -2336,7 +2336,7 @@ void init_forcerec(FILE                             *fp,
     init_ns(fp, cr, fr->ns, fr, mtop);
 
     /* Initialize the thread working data for bonded interactions */
-    init_bonded_threading(fp, mtop->groups.grps[egcENER].nr,
+    init_bonded_threading(fp, mtop->groups.groups[SimulationAtomGroupType::EnergyOutput].nr,
                           &fr->bondedThreading);
 
     fr->nthread_ewc = gmx_omp_nthreads_get(emntBonded);