Convert gmx_mtop_t to C++
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_nmeig.cpp
index dbddf790ba5ee5c54ecb9b2553d0b60a356d001e..1f5fbad25d510077cd7947507e66b968a4d30f62 100644 (file)
@@ -114,10 +114,9 @@ static int get_nharm(const gmx_mtop_t *mtop)
 {
     int nh = 0;
 
-    for (int j = 0; (j < mtop->nmolblock); j++)
+    for (const gmx_molblock_t &molb : mtop->molblock)
     {
-        int mt  = mtop->molblock[j].type;
-        nh += mtop->molblock[j].nmol * get_nharm_mt(&(mtop->moltype[mt]));
+        nh += molb.nmol * get_nharm_mt(&(mtop->moltype[molb.type]));
     }
     return nh;
 }