Merge branch release-2020 into master
[alexxy/gromacs.git] / src / gromacs / mdlib / dispersioncorrection.cpp
index 2d06168cbedf1fee0be36f28aeda75b5811aee51..d53a7e6b383638666780781bee3e9ad6cc601911 100644 (file)
@@ -43,6 +43,7 @@
 #include "gromacs/math/vec.h"
 #include "gromacs/mdtypes/forcerec.h"
 #include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
 #include "gromacs/mdtypes/md_enums.h"
 #include "gromacs/mdtypes/nblist.h"
 #include "gromacs/tables/forcetable.h"
@@ -186,17 +187,14 @@ DispersionCorrection::TopologyParams::TopologyParams(const gmx_mtop_t&         m
              */
             for (const gmx_molblock_t& molb : mtop.molblock)
             {
-                const int       nmol  = molb.nmol;
-                const t_atoms*  atoms = &mtop.moltype[molb.type].atoms;
-                const t_blocka* excl  = &mtop.moltype[molb.type].excls;
+                const int      nmol  = molb.nmol;
+                const t_atoms* atoms = &mtop.moltype[molb.type].atoms;
+                const auto&    excl  = mtop.moltype[molb.type].excls;
                 for (int i = 0; (i < atoms->nr); i++)
                 {
                     const int tpi = atomtypeAOrB(atoms->atom[i], q);
-                    const int j1  = excl->index[i];
-                    const int j2  = excl->index[i + 1];
-                    for (int j = j1; j < j2; j++)
+                    for (const int k : excl[i])
                     {
-                        const int k = excl->a[j];
                         if (k > i)
                         {
                             const int tpj = atomtypeAOrB(atoms->atom[k], q);