Allow trjconv to keep some box dimensions unchanged.
authorRossen Apostolov <rossen@kth.se>
Fri, 23 May 2014 14:30:06 +0000 (16:30 +0200)
committerSzilárd Páll <pall.szilard@gmail.com>
Sat, 24 May 2014 17:33:04 +0000 (19:33 +0200)
Giving -1 to option box will preserve the original box size
for the given dimension.

Fixes #871.

Change-Id: I339aedcf09da8ecb4eb8f32e8057f953a21e0f5f

src/gromacs/gmxana/gmx_trjconv.c

index 48f4560bd1bf85f463caf40d36e8aa4c55c2e883..827ef907cc251a5b555af4736abacea175c3b768 100644 (file)
@@ -697,6 +697,10 @@ int gmx_trjconv(int argc, char *argv[])
         "Use option [TT]-pbc mol[tt] in addition to [TT]-center[tt] when you",
         "want all molecules in the box after the centering.[PAR]",
 
+        "Option [TT]-box[tt] sets the size of the new box. If you want to"
+        "modify only some of the dimensions, e.g. when reading from a trajectory,"
+        "you can use -1 for those dimensions that should stay the same"
+
         "It is not always possible to use combinations of [TT]-pbc[tt],",
         "[TT]-fit[tt], [TT]-ur[tt] and [TT]-center[tt] to do exactly what",
         "you want in one call to [THISMODULE]. Consider using multiple",
@@ -1414,7 +1418,10 @@ int gmx_trjconv(int argc, char *argv[])
                     clear_mat(fr.box);
                     for (m = 0; m < DIM; m++)
                     {
-                        fr.box[m][m] = newbox[m];
+                        if (newbox[m] >= 0)
+                        {
+                            fr.box[m][m] = newbox[m];
+                        }
                     }
                 }