Remove hidden option to gmx dump
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 21 Jan 2014 09:36:45 +0000 (10:36 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 21 Jan 2014 09:36:45 +0000 (10:36 +0100)
gmx dump -xvg -f a.xtc duplicates gmx traj -ox a.xtc

Change-Id: I674d41de5dec9f99fac41f031be7c65e6bc72246

src/gromacs/fileio/tngio_for_tools.cpp
src/gromacs/fileio/tngio_for_tools.h
src/gromacs/tools/dump.c
src/gromacs/tools/dump.h

index fc007183339a191979d3e56ab741c2fcbdef7463..66d24121fabb8ee91e5fa599ed1a24eb2b82e119 100644 (file)
@@ -863,21 +863,20 @@ gmx_bool gmx_get_tng_data_next_frame_of_block_type(tng_trajectory_t     input,
 #endif
 }
 
-void list_tng_for_gmx_dump(const char *fn, gmx_bool bXVG)
+void list_tng_for_gmx_dump(const char *fn)
 {
 #ifdef GMX_USE_TNG
     tng_trajectory_t     tng;
     gmx_int64_t          nframe = 0;
     gmx_int64_t          i, *block_ids = NULL, step, ndatablocks;
-    gmx_int64_t          pos_block_id = TNG_TRAJ_POSITIONS;
     gmx_bool             bOK;
 
     gmx_tng_open(fn, 'r', &tng);
     gmx_print_tng_molecule_system(tng, stdout);
 
     bOK    = gmx_get_tng_data_block_types_of_next_frame(tng, -1,
-                                                        bXVG ? 1 : 0,
-                                                        bXVG ? &pos_block_id : NULL,
+                                                        0,
+                                                        NULL,
                                                         &step, &ndatablocks,
                                                         &block_ids);
     do
@@ -899,15 +898,15 @@ void list_tng_for_gmx_dump(const char *fn, gmx_bool bXVG)
                 /* Can't write any output because we don't know what
                    arrays are valid. */
                 fprintf(stderr, "\nWARNING: Incomplete frame at time %g, will not write output\n", frame_time);
-                list_tng_inner(fn, (0 == i), bXVG, values, step, frame_time,
+                list_tng_inner(fn, (0 == i), values, step, frame_time,
                                n_values_per_frame, n_atoms, prec, nframe, block_name);
             }
         }
         nframe++;
     }
     while (gmx_get_tng_data_block_types_of_next_frame(tng, step,
-                                                      bXVG ? 1 : 0,
-                                                      bXVG ? &pos_block_id : NULL,
+                                                      0,
+                                                      NULL,
                                                       &step,
                                                       &ndatablocks,
                                                       &block_ids));
@@ -920,6 +919,5 @@ void list_tng_for_gmx_dump(const char *fn, gmx_bool bXVG)
     gmx_tng_close(&tng);
 #else
     GMX_UNUSED_VALUE(fn);
-    GMX_UNUSED_VALUE(bXVG);
 #endif
 }
index c8a30991d78975802ac51a9251d57029a4b2479a..6dd9a04e59dc8401552c86a9828c7d793af48ed7 100644 (file)
@@ -110,8 +110,7 @@ gmx_bool gmx_get_tng_data_next_frame_of_block_type(tng_trajectory_t     input,
                                                    gmx_bool            *bOK);
 
 /*! \brief Implements TNG file reading for gmxdump. */
-void list_tng_for_gmx_dump(const char *fn,
-                           gmx_bool bXVG);
+void list_tng_for_gmx_dump(const char *fn);
 
 #ifdef __cplusplus
 }
index 731c81bc1c010e1247bfedf8352e17665d962660..06212fed7f1e62867b53e8d58d7432761e193132 100644 (file)
@@ -280,7 +280,7 @@ static void list_trn(const char *fn)
     close_trn(fpread);
 }
 
-void list_xtc(const char *fn, gmx_bool bXVG)
+void list_xtc(const char *fn)
 {
     t_fileio  *xd;
     int        indent;
@@ -297,31 +297,14 @@ void list_xtc(const char *fn, gmx_bool bXVG)
     nframe = 0;
     do
     {
-        if (bXVG)
-        {
-            int i, d;
-
-            fprintf(stdout, "%g", time);
-            for (i = 0; i < natoms; i++)
-            {
-                for (d = 0; d < DIM; d++)
-                {
-                    fprintf(stdout, " %g", x[i][d]);
-                }
-            }
-            fprintf(stdout, "\n");
-        }
-        else
-        {
-            sprintf(buf, "%s frame %d", fn, nframe);
-            indent = 0;
-            indent = pr_title(stdout, indent, buf);
-            pr_indent(stdout, indent);
-            fprintf(stdout, "natoms=%10d  step=%10d  time=%12.7e  prec=%10g\n",
-                    natoms, step, time, prec);
-            pr_rvecs(stdout, indent, "box", box, DIM);
-            pr_rvecs(stdout, indent, "x", x, natoms);
-        }
+        sprintf(buf, "%s frame %d", fn, nframe);
+        indent = 0;
+        indent = pr_title(stdout, indent, buf);
+        pr_indent(stdout, indent);
+        fprintf(stdout, "natoms=%10d  step=%10d  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));
@@ -336,7 +319,6 @@ void list_xtc(const char *fn, gmx_bool bXVG)
 /* Callback used by list_tng_for_gmx_dump. */
 void list_tng_inner(const char *fn,
                     gmx_bool bFirstFrame,
-                    gmx_bool bXVG,
                     real *values,
                     gmx_int64_t step, 
                     double frame_time,
@@ -349,52 +331,31 @@ void list_tng_inner(const char *fn,
     char                 buf[256];
     int                  indent = 0;
 
-    if (bXVG)
+    if (bFirstFrame)
     {
-        gmx_int64_t j;
-        int         d;
-
-        if (bFirstFrame)
+        sprintf(buf, "%s frame %" GMX_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",
+                n_atoms, step, frame_time);
+        if (prec > 0)
         {
-            fprintf(stdout, "%g", (real)frame_time);
-        }
-        for (j = 0; j < n_atoms; j++)
-        {
-            for (d = 0; d < DIM; d++)
-            {
-                fprintf(stdout, " %g", values[j * DIM + d]);
-            }
+            fprintf(stdout, "  prec=%10g", prec);
         }
         fprintf(stdout, "\n");
     }
-    else
-    {
-        if (bFirstFrame)
-        {
-            sprintf(buf, "%s frame %" GMX_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",
-                    n_atoms, step, frame_time);
-            if (prec > 0)
-            {
-                fprintf(stdout, "  prec=%10g", prec);
-            }
-            fprintf(stdout, "\n");
-        }
-        pr_reals_of_dim(stdout, indent, block_name, values, n_atoms, n_values_per_frame);
-    }
+    pr_reals_of_dim(stdout, indent, block_name, values, n_atoms, n_values_per_frame);
 }
 
-void list_trx(const char *fn, gmx_bool bXVG)
+void list_trx(const char *fn)
 {
     int ftp;
 
     ftp = fn2ftp(fn);
     if (ftp == efXTC)
     {
-        list_xtc(fn, bXVG);
+        list_xtc(fn);
     }
     else if ((ftp == efTRR) || (ftp == efTRJ))
     {
@@ -402,7 +363,7 @@ void list_trx(const char *fn, gmx_bool bXVG)
     }
     else if (ftp == efTNG)
     {
-        list_tng_for_gmx_dump(fn, bXVG);
+        list_tng_for_gmx_dump(fn);
     }
     else
     {
@@ -614,11 +575,9 @@ int gmx_dump(int argc, char *argv[])
 
     output_env_t    oenv;
     /* Command line options */
-    static gmx_bool bXVG         = FALSE;
     static gmx_bool bShowNumbers = TRUE;
     static gmx_bool bSysTop      = FALSE;
     t_pargs         pa[]         = {
-        { "-xvg", FALSE, etBOOL, {&bXVG}, "HIDDENXVG layout for xtc" },
         { "-nr", FALSE, etBOOL, {&bShowNumbers}, "Show index numbers in output (leaving them out makes comparison easier, but creates a useless topology)" },
         { "-sys", FALSE, etBOOL, {&bSysTop}, "List the atoms and bonded interactions for the whole system instead of for each molecule type" }
     };
@@ -637,7 +596,7 @@ int gmx_dump(int argc, char *argv[])
     }
     else if (ftp2bSet(efTRX, NFILE, fnm))
     {
-        list_trx(ftp2fn(efTRX, NFILE, fnm), bXVG);
+        list_trx(ftp2fn(efTRX, NFILE, fnm));
     }
     else if (ftp2bSet(efEDR, NFILE, fnm))
     {
index 8db58a8efcfb66409e7ee9bc18c9bd784961f963..9476e4e57b22606f4054b55929a3171d827a0bee 100644 (file)
@@ -57,7 +57,6 @@ int gmx_dump(int argc, char *argv[]);
  * dumping-related stuff in the dumping file. */
 void list_tng_inner(const char *fn,
                     gmx_bool bFirstFrame,
-                    gmx_bool bXVG,
                     real *values,
                     gmx_int64_t step, 
                     double frame_time,