Merge branch release-5-1 into release-2016
[alexxy/gromacs.git] / src / gromacs / mdlib / minimize.cpp
index 591e20a7dc88cbfa338f971b35b97ed014b2a718..2d5290d4b9502a9d1f900089717a5b1578c490ed 100644 (file)
@@ -580,9 +580,7 @@ static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md,
 
 {
     t_state *s1, *s2;
-    int      i;
     int      start, end;
-    rvec    *x1, *x2;
     real     dvdl_constr;
     int      nthreads gmx_unused;
 
@@ -615,7 +613,7 @@ static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md,
     s2->natoms = s1->natoms;
     copy_mat(s1->box, s2->box);
     /* Copy free energy state */
-    for (i = 0; i < efptNR; i++)
+    for (int i = 0; i < efptNR; i++)
     {
         s2->lambda[i] = s1->lambda[i];
     }
@@ -624,18 +622,16 @@ static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md,
     start = 0;
     end   = md->homenr;
 
-    x1 = s1->x;
-    x2 = s2->x;
-
     // cppcheck-suppress unreadVariable
     nthreads = gmx_omp_nthreads_get(emntUpdate);
 #pragma omp parallel num_threads(nthreads)
     {
-        int gf, i, m;
+        rvec *x1 = s1->x;
+        rvec *x2 = s2->x;
 
-        gf = 0;
+        int   gf = 0;
 #pragma omp for schedule(static) nowait
-        for (i = start; i < end; i++)
+        for (int i = start; i < end; i++)
         {
             try
             {
@@ -643,7 +639,7 @@ static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md,
                 {
                     gf = md->cFREEZE[i];
                 }
-                for (m = 0; m < DIM; m++)
+                for (int m = 0; m < DIM; m++)
                 {
                     if (ir->opts.nFreeze[gf][m])
                     {
@@ -661,13 +657,13 @@ static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md,
         if (s2->flags & (1<<estCGP))
         {
             /* Copy the CG p vector */
-            x1 = s1->cg_p;
-            x2 = s2->cg_p;
+            rvec *p1 = s1->cg_p;
+            rvec *p2 = s2->cg_p;
 #pragma omp for schedule(static) nowait
-            for (i = start; i < end; i++)
+            for (int i = start; i < end; i++)
             {
                 // Trivial OpenMP block that does not throw
-                copy_rvec(x1[i], x2[i]);
+                copy_rvec(p1[i], p2[i]);
             }
         }
 
@@ -690,7 +686,7 @@ static bool do_em_step(t_commrec *cr, t_inputrec *ir, t_mdatoms *md,
             }
             s2->ncg_gl = s1->ncg_gl;
 #pragma omp for schedule(static) nowait
-            for (i = 0; i < s2->ncg_gl; i++)
+            for (int i = 0; i < s2->ncg_gl; i++)
             {
                 s2->cg_gl[i] = s1->cg_gl[i];
             }