Merge branch release-5-1 into release-2016
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 31 Jan 2017 14:14:36 +0000 (15:14 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 31 Jan 2017 14:15:04 +0000 (15:15 +0100)
Change-Id: I5726f23a376f1be0052afdd917537f03f703760e

src/gromacs/gmxana/gmx_rmsf.cpp

index 0cdbd1a2fc341fc5ac0cf475245285d8be62efb5..8b5118003ef44f5e39f94c28a23a6537b2a144bc 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -320,6 +320,8 @@ int gmx_rmsf(int argc, char *argv[])
         snew(pdbatoms, 1);
         *pdbatoms = top_pdb->atoms;
         read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, &pdbx, NULL, pdbbox, FALSE);
+        /* TODO Should this assert that top_pdb->atoms.nr == top.atoms.nr?
+         * See discussion at https://gerrit.gromacs.org/#/c/6430/1 */
         title = *top_pdb->name;
         snew(refatoms, 1);
         *refatoms = top_pdb->atoms;
@@ -548,24 +550,26 @@ int gmx_rmsf(int argc, char *argv[])
         /* Write a .pdb file with B-factors and optionally anisou records */
         for (i = 0; i < isize; i++)
         {
-            rvec_inc(xref[index[i]], xcm);
+            rvec_inc(pdbx[index[i]], xcm);
         }
         write_sto_conf_indexed(opt2fn("-oq", NFILE, fnm), title, pdbatoms, pdbx,
                                NULL, ePBC, pdbbox, isize, index);
     }
     if (opt2bSet("-ox", NFILE, fnm))
     {
-        /* Misuse xref as a temporary array */
+        rvec *bFactorX;
+        snew(bFactorX, top.atoms.nr);
         for (i = 0; i < isize; i++)
         {
             for (d = 0; d < DIM; d++)
             {
-                xref[index[i]][d] = xcm[d] + xav[i*DIM + d];
+                bFactorX[index[i]][d] = xcm[d] + xav[i*DIM + d];
             }
         }
         /* Write a .pdb file with B-factors and optionally anisou records */
-        write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, xref, NULL,
+        write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, bFactorX, NULL,
                                ePBC, pdbbox, isize, index);
+        sfree(bFactorX);
     }
     if (bAniso)
     {