Make gmx vanhove work without PBC
authorBerk Hess <hess@kth.se>
Fri, 26 Feb 2016 08:38:40 +0000 (09:38 +0100)
committerBerk Hess <hess@kth.se>
Tue, 22 Mar 2016 10:11:15 +0000 (11:11 +0100)
Change-Id: I37d59fc7edf6d6da36778ac3f342c71a876e2872

src/gromacs/gmxana/gmx_vanhove.cpp

index 5b0249c4b22404236e9d9310d60c8e1ccf2f628b..6c18620885f44afff7867938364c2ff6c92c0e79 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, 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.
@@ -52,6 +52,7 @@
 #include "gromacs/math/invertmatrix.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
 #include "gromacs/topology/index.h"
 #include "gromacs/topology/topology.h"
 #include "gromacs/utility/arraysize.h"
@@ -296,24 +297,27 @@ int gmx_vanhove(int argc, char *argv[])
         {
             fprintf(stderr, "\rProcessing frame %d", f);
         }
-        /* Scale all the configuration to the average box */
-        gmx::invertBoxMatrix(sbox[f], corr);
-        mmul_ur0(avbox, corr, corr);
-        for (i = 0; i < isize; i++)
+        if (ePBC != epbcNONE)
         {
-            mvmul_ur0(corr, sx[f][i], sx[f][i]);
-            if (f > 0)
+            /* Scale all the configuration to the average box */
+            gmx::invertBoxMatrix(sbox[f], corr);
+            mmul_ur0(avbox, corr, corr);
+            for (i = 0; i < isize; i++)
             {
-                /* Correct for periodic jumps */
-                for (m = DIM-1; m >= 0; m--)
+                mvmul_ur0(corr, sx[f][i], sx[f][i]);
+                if (f > 0)
                 {
-                    while (sx[f][i][m] - sx[f-1][i][m] > 0.5*avbox[m][m])
-                    {
-                        rvec_dec(sx[f][i], avbox[m]);
-                    }
-                    while (sx[f][i][m] - sx[f-1][i][m] <= -0.5*avbox[m][m])
+                    /* Correct for periodic jumps */
+                    for (m = DIM-1; m >= 0; m--)
                     {
-                        rvec_inc(sx[f][i], avbox[m]);
+                        while (sx[f][i][m] - sx[f-1][i][m] > 0.5*avbox[m][m])
+                        {
+                            rvec_dec(sx[f][i], avbox[m]);
+                        }
+                        while (sx[f][i][m] - sx[f-1][i][m] <= -0.5*avbox[m][m])
+                        {
+                            rvec_inc(sx[f][i], avbox[m]);
+                        }
                     }
                 }
             }