#include "gromacs/legacyheaders/gmx_fatal.h"
#include "gromacs/utility/smalloc.h"
+#include "gromacs/timing/wallcycle.h"
struct gmx_mdoutf {
t_fileio *fp_trn;
int natoms_global;
int natoms_x_compressed;
gmx_groups_t *groups; /* for compressed position writing */
+ gmx_wallcycle_t wcycle;
};
gmx_mdoutf_t init_mdoutf(FILE *fplog, int nfile, const t_filenm fnm[],
int mdrun_flags, const t_commrec *cr,
const t_inputrec *ir, gmx_mtop_t *top_global,
- const output_env_t oenv)
+ const output_env_t oenv, gmx_wallcycle_t wcycle)
{
gmx_mdoutf_t of;
char filemode[3];
of->elamstats = ir->expandedvals->elamstats;
of->simulation_part = ir->simulation_part;
of->x_compression_precision = ir->x_compression_precision;
+ of->wcycle = wcycle;
if (MASTER(cr))
{
return of->fp_dhdl;
}
+gmx_wallcycle_t mdoutf_get_wcycle(gmx_mdoutf_t of)
+{
+ return of->wcycle;
+}
+
void mdoutf_write_to_trajectory_files(FILE *fplog, t_commrec *cr,
gmx_mdoutf_t of,
int mdof_flags,
}
}
+void mdoutf_tng_close(gmx_mdoutf_t of)
+{
+ if (of->tng || of->tng_low_prec)
+ {
+ wallcycle_start(of->wcycle, ewcTRAJ);
+ gmx_tng_close(&of->tng);
+ gmx_tng_close(&of->tng_low_prec);
+ wallcycle_stop(of->wcycle, ewcTRAJ);
+ }
+}
+
void done_mdoutf(gmx_mdoutf_t of)
{
if (of->fp_ene != NULL)
{
gmx_fio_fclose(of->fp_field);
}
+
gmx_tng_close(&of->tng);
gmx_tng_close(&of->tng_low_prec);