#include <config.h>
#endif
-#include <vector>
-
#include "tngio.h"
#include "trx.h"
#include "gromacs/legacyheaders/smalloc.h"
#include "gromacs/legacyheaders/physics.h"
#include "gromacs/legacyheaders/gmx_fatal.h"
-#include "gromacs/tools/dump.h"
void gmx_prepare_tng_writing(const char *filename,
char mode,
return FALSE;
#endif
}
-
-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_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,
- 0,
- NULL,
- &step, &ndatablocks,
- &block_ids);
- do
- {
- for (i = 0; i < ndatablocks; i++)
- {
- double frame_time;
- real prec, *values = NULL;
- gmx_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,
- &step, &frame_time,
- &n_values_per_frame, &n_atoms,
- &prec,
- block_name, STRLEN, &bOK);
- if (!bOK)
- {
- /* 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), 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,
- 0,
- NULL,
- &step,
- &ndatablocks,
- &block_ids));
-
- if (block_ids)
- {
- sfree(block_ids);
- }
-
- gmx_tng_close(&tng);
-#else
- GMX_UNUSED_VALUE(fn);
-#endif
-}
#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trnio.h"
#include "gromacs/fileio/futil.h"
+#include "gromacs/fileio/tngio.h"
#include "gromacs/fileio/tngio_for_tools.h"
#ifdef HAVE_UNISTD_H
close_xtc(xd);
}
-/* Callback used by list_tng_for_gmx_dump. */
-void list_tng_inner(const char *fn,
+/*! \brief Callback used by list_tng_for_gmx_dump. */
+static void list_tng_inner(const char *fn,
gmx_bool bFirstFrame,
real *values,
gmx_int64_t step,
pr_reals_of_dim(stdout, indent, block_name, values, n_atoms, n_values_per_frame);
}
+static void list_tng(const char gmx_unused *fn)
+{
+#ifdef GMX_USE_TNG
+ tng_trajectory_t tng;
+ gmx_int64_t nframe = 0;
+ gmx_int64_t i, *block_ids = NULL, step, ndatablocks;
+ 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,
+ 0,
+ NULL,
+ &step, &ndatablocks,
+ &block_ids);
+ do
+ {
+ for (i = 0; i < ndatablocks; i++)
+ {
+ double frame_time;
+ real prec, *values = NULL;
+ gmx_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,
+ &step, &frame_time,
+ &n_values_per_frame, &n_atoms,
+ &prec,
+ block_name, STRLEN, &bOK);
+ if (!bOK)
+ {
+ /* 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), 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,
+ 0,
+ NULL,
+ &step,
+ &ndatablocks,
+ &block_ids));
+
+ if (block_ids)
+ {
+ sfree(block_ids);
+ }
+
+ gmx_tng_close(&tng);
+#endif
+}
+
void list_trx(const char *fn)
{
int ftp;
}
else if (ftp == efTNG)
{
- list_tng_for_gmx_dump(fn);
+ list_tng(fn);
}
else
{