Merge release-2018 into master
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_editconf.cpp
index f26bd749cb7346bb0e53de011b1c314effed5efe..d03f922cb1cf7dcb6ff950389bcacb02360e8bcd 100644 (file)
@@ -87,7 +87,7 @@ static real calc_mass(t_atoms *atoms, gmx_bool bGetMass, gmx_atomprop_t aps)
     return tmass;
 }
 
-static real calc_geom(int isize, int *index, rvec *x, rvec geom_center, rvec minval,
+static real calc_geom(int isize, const int *index, rvec *x, rvec geom_center, rvec minval,
                       rvec maxval, gmx_bool bDiam)
 {
     real  diam2, d;
@@ -178,7 +178,7 @@ static void center_conf(int natom, rvec *x, rvec center, rvec geom_cent)
     }
 }
 
-static void scale_conf(int natom, rvec x[], matrix box, rvec scale)
+static void scale_conf(int natom, rvec x[], matrix box, const rvec scale)
 {
     int i, j;
 
@@ -366,7 +366,7 @@ static void visualize_images(const char *fn, int ePBC, matrix box)
     sfree(img);
 }
 
-static void visualize_box(FILE *out, int a0, int r0, matrix box, rvec gridsize)
+static void visualize_box(FILE *out, int a0, int r0, matrix box, const rvec gridsize)
 {
     int  *edge;
     rvec *vert, shift;
@@ -707,7 +707,7 @@ int gmx_editconf(int argc, char *argv[])
     int              *bfac_nr = nullptr;
     t_topology       *top     = nullptr;
     char             *grpname, *sgrpname, *agrpname;
-    int               isize, ssize, asize;
+    int               isize, ssize, numAlignmentAtoms;
     int              *index, *sindex, *aindex;
     rvec             *x, *v, gc, rmin, rmax, size;
     int               ePBC;
@@ -1002,28 +1002,28 @@ int gmx_editconf(int argc, char *argv[])
         {
             fprintf(stderr, "\nSelect a group that you want to align:\n");
             get_index(&atoms, ftp2fn_null(efNDX, NFILE, fnm),
-                      1, &asize, &aindex, &agrpname);
+                      1, &numAlignmentAtoms, &aindex, &agrpname);
         }
         else
         {
-            asize = atoms.nr;
-            snew(aindex, asize);
-            for (i = 0; i < asize; i++)
+            numAlignmentAtoms = atoms.nr;
+            snew(aindex, numAlignmentAtoms);
+            for (i = 0; i < numAlignmentAtoms; i++)
             {
                 aindex[i] = i;
             }
         }
-        printf("Aligning %d atoms (out of %d) to %g %g %g, center of rotation %g %g %g\n", asize, natom,
+        printf("Aligning %d atoms (out of %d) to %g %g %g, center of rotation %g %g %g\n", numAlignmentAtoms, natom,
                targetvec[XX], targetvec[YY], targetvec[ZZ],
                aligncenter[XX], aligncenter[YY], aligncenter[ZZ]);
         /*subtract out pivot point*/
-        for (i = 0; i < asize; i++)
+        for (i = 0; i < numAlignmentAtoms; i++)
         {
             rvec_dec(x[aindex[i]], aligncenter);
         }
         /*now determine transform and rotate*/
         /*will this work?*/
-        principal_comp(asize, aindex, atoms.atom, x, trans, princd);
+        principal_comp(numAlignmentAtoms, aindex, atoms.atom, x, trans, princd);
 
         unitv(targetvec, targetvec);
         printf("Using %g %g %g as principal axis\n", trans[0][2], trans[1][2], trans[2][2]);
@@ -1031,14 +1031,14 @@ int gmx_editconf(int argc, char *argv[])
         calc_rotmatrix(tmpvec, targetvec, rotmatrix);
         /* rotmatrix finished */
 
-        for (i = 0; i < asize; ++i)
+        for (i = 0; i < numAlignmentAtoms; ++i)
         {
             mvmul(rotmatrix, x[aindex[i]], tmpvec);
             copy_rvec(tmpvec, x[aindex[i]]);
         }
 
         /*add pivot point back*/
-        for (i = 0; i < asize; i++)
+        for (i = 0; i < numAlignmentAtoms; i++)
         {
             rvec_inc(x[aindex[i]], aligncenter);
         }
@@ -1321,7 +1321,7 @@ int gmx_editconf(int argc, char *argv[])
                 index[i] = i;
             }
             write_pdbfile_indexed(out, *top_tmp->name, &atoms, x, ePBC, box, ' ', -1, atoms.nr, index, conect,
-                                  TRUE, outftp == efPQR ? true : false);
+                                  TRUE, outftp == efPQR);
             sfree(index);
             if (bLegend)
             {