Merge branch release-5-0
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_trjconv.c
index b1c7a5ed51910d4a73aff9446e4ed8bcb4e1b9d4..1bd02fe2d91e8b6a5671b52767d82394e51ece8c 100644 (file)
@@ -692,9 +692,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"
+        "Option [TT]-box[tt] sets the size of the new box. This option only works",
+        "for leading dimensions and is thus generally only useful for rectangular boxes.",
+        "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",
@@ -1412,13 +1413,23 @@ int gmx_trjconv(int argc, char *argv[])
                 if (bSetBox)
                 {
                     /* generate new box */
-                    clear_mat(fr.box);
+                    if (fr.bBox == FALSE)
+                    {
+                        clear_mat(fr.box);
+                    }
                     for (m = 0; m < DIM; m++)
                     {
                         if (newbox[m] >= 0)
                         {
                             fr.box[m][m] = newbox[m];
                         }
+                        else
+                        {
+                            if (fr.bBox == FALSE)
+                            {
+                                gmx_fatal(FARGS, "Cannot preserve a box that does not exist.\n");
+                            }
+                        }
                     }
                 }