Merge branch release-2018
[alexxy/gromacs.git] / src / gromacs / tools / dump.cpp
index 82cd78a7834bb11a6d33e4617e5a5191a5b3ac52..8f92475880fb57d9b3ca14cdf2975d277af7c2b3 100644 (file)
@@ -64,6 +64,7 @@
 #include "gromacs/mdtypes/state.h"
 #include "gromacs/topology/mtop_util.h"
 #include "gromacs/topology/topology.h"
+#include "gromacs/trajectory/energyframe.h"
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/utility/arraysize.h"
 #include "gromacs/utility/basedefinitions.h"
@@ -186,17 +187,17 @@ static void list_top(const char *fn)
     status = cpp_open_file(fn, &handle, cppopts);
     if (status != 0)
     {
-        gmx_fatal(FARGS, cpp_error(&handle, status));
+        gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
     }
     do
     {
         status = cpp_read_line(&handle, BUFLEN, buf);
-        done   = (status == eCPP_EOF);
+        done   = static_cast<int>(status == eCPP_EOF);
         if (!done)
         {
             if (status != eCPP_OK)
             {
-                gmx_fatal(FARGS, cpp_error(&handle, status));
+                gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
             }
             else
             {
@@ -204,11 +205,11 @@ static void list_top(const char *fn)
             }
         }
     }
-    while (!done);
+    while (done == 0);
     status = cpp_close_file(&handle);
     if (status != eCPP_OK)
     {
-        gmx_fatal(FARGS, cpp_error(&handle, status));
+        gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
     }
 }
 
@@ -240,7 +241,7 @@ static void list_trr(const char *fn)
             indent = 0;
             indent = pr_title(stdout, indent, buf);
             pr_indent(stdout, indent);
-            fprintf(stdout, "natoms=%10d  step=%10" GMX_PRId64 "  time=%12.7e  lambda=%10g\n",
+            fprintf(stdout, "natoms=%10d  step=%10" PRId64 "  time=%12.7e  lambda=%10g\n",
                     trrheader.natoms, trrheader.step, trrheader.t, trrheader.lambda);
             if (trrheader.box_size)
             {
@@ -286,7 +287,7 @@ static void list_xtc(const char *fn)
     rvec       *x;
     matrix      box;
     int         nframe, natoms;
-    gmx_int64_t step;
+    int64_t     step;
     real        prec, time;
     gmx_bool    bOK;
 
@@ -300,13 +301,13 @@ static void list_xtc(const char *fn)
         indent = 0;
         indent = pr_title(stdout, indent, buf);
         pr_indent(stdout, indent);
-        fprintf(stdout, "natoms=%10d  step=%10" GMX_PRId64 "  time=%12.7e  prec=%10g\n",
+        fprintf(stdout, "natoms=%10d  step=%10" PRId64 "  time=%12.7e  prec=%10g\n",
                 natoms, step, time, prec);
         pr_rvecs(stdout, indent, "box", box, DIM);
         pr_rvecs(stdout, indent, "x", x, natoms);
         nframe++;
     }
-    while (read_next_xtc(xd, natoms, &step, &time, box, x, &prec, &bOK));
+    while (read_next_xtc(xd, natoms, &step, &time, box, x, &prec, &bOK) != 0);
     if (!bOK)
     {
         fprintf(stderr, "\nWARNING: Incomplete frame at time %g\n", time);
@@ -321,12 +322,12 @@ static void list_xtc(const char *fn)
 static void list_tng_inner(const char *fn,
                            gmx_bool    bFirstFrame,
                            real       *values,
-                           gmx_int64_t step,
+                           int64_t     step,
                            double      frame_time,
-                           gmx_int64_t n_values_per_frame,
-                           gmx_int64_t n_atoms,
+                           int64_t     n_values_per_frame,
+                           int64_t     n_atoms,
                            real        prec,
-                           gmx_int64_t nframe,
+                           int64_t     nframe,
                            char       *block_name)
 {
     char                 buf[256];
@@ -334,11 +335,11 @@ static void list_tng_inner(const char *fn,
 
     if (bFirstFrame)
     {
-        sprintf(buf, "%s frame %" GMX_PRId64, fn, nframe);
+        sprintf(buf, "%s frame %" PRId64, fn, nframe);
         indent = 0;
         indent = pr_title(stdout, indent, buf);
         pr_indent(stdout, indent);
-        fprintf(stdout, "natoms=%10" GMX_PRId64 "  step=%10" GMX_PRId64 "  time=%12.7e",
+        fprintf(stdout, "natoms=%10" PRId64 "  step=%10" PRId64 "  time=%12.7e",
                 n_atoms, step, frame_time);
         if (prec > 0)
         {
@@ -355,8 +356,8 @@ static void list_tng(const char gmx_unused *fn)
 {
 #if GMX_USE_TNG
     gmx_tng_trajectory_t tng;
-    gmx_int64_t          nframe = 0;
-    gmx_int64_t          i, *block_ids = nullptr, step, ndatablocks;
+    int64_t              nframe = 0;
+    int64_t              i, *block_ids = nullptr, step, ndatablocks;
     gmx_bool             bOK;
     real                *values = nullptr;
 
@@ -374,7 +375,7 @@ static void list_tng(const char gmx_unused *fn)
         {
             double               frame_time;
             real                 prec;
-            gmx_int64_t          n_values_per_frame, n_atoms;
+            int64_t              n_values_per_frame, n_atoms;
             char                 block_name[STRLEN];
 
             gmx_get_tng_data_next_frame_of_block_type(tng, block_ids[i], &values,