/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#if GMX_USE_TNG
gmx_tng_add_mtop(gmx_tng, mtop);
set_writing_intervals(gmx_tng, FALSE, ir);
- tng_time_per_frame_set(gmx_tng->tng, ir->delta_t * PICO);
+ tng_time_per_frame_set(gmx_tng->tng, ir->delta_t * gmx::c_pico);
gmx_tng->timePerFrameIsSet = true;
#else
GMX_UNUSED_VALUE(gmx_tng);
gmx_tng_add_mtop(gmx_tng, mtop);
add_selection_groups(gmx_tng, mtop);
set_writing_intervals(gmx_tng, TRUE, ir);
- tng_time_per_frame_set(gmx_tng->tng, ir->delta_t * PICO);
+ tng_time_per_frame_set(gmx_tng->tng, ir->delta_t * gmx::c_pico);
gmx_tng->timePerFrameIsSet = true;
gmx_tng_set_compression_precision(gmx_tng, ir->x_compression_precision);
#else
# else
static write_data_func_pointer write_data = tng_util_generic_with_time_write;
# endif
- double elapsedSeconds = elapsedPicoSeconds * PICO;
+ double elapsedSeconds = elapsedPicoSeconds * gmx::c_pico;
int64_t nParticles;
char compression;
tng_num_frames_get(tng, &nFrames);
tng_util_time_of_frame_get(tng, nFrames - 1, &time);
- fTime = time / PICO;
+ fTime = time / gmx::c_pico;
return fTime;
#else
GMX_UNUSED_VALUE(gmx_tng);
tng_molecule_system_copy(*input, *output);
tng_time_per_frame_get(*input, &time);
- tng_time_per_frame_set(*output, time);
- // Since we have copied the value from the input TNG we should not change it again
- (*gmx_tng_output)->timePerFrameIsSet = true;
+ /* Only write the time per frame if it was written (and valid). E.g., single
+ * frame files do not usually contain any time per frame information. */
+ if (time >= 0)
+ {
+ (*gmx_tng_input)->timePerFrameIsSet = true;
+ tng_time_per_frame_set(*output, time);
+ // Since we have copied the value from the input TNG we should not change it again
+ (*gmx_tng_output)->timePerFrameIsSet = true;
+ }
tng_num_frames_per_frame_set_get(*input, &n_frames_per_frame_set);
tng_num_frames_per_frame_set_set(*output, n_frames_per_frame_set);
// GROMACS expects distances in nm
switch (exp)
{
- case 9: distanceScaleFactor = NANO / NANO; break;
- case 10: distanceScaleFactor = NANO / ANGSTROM; break;
+ case 9: distanceScaleFactor = gmx::c_nano / gmx::c_nano; break;
+ case 10: distanceScaleFactor = gmx::c_nano / gmx::c_angstrom; break;
default: distanceScaleFactor = pow(10.0, exp + 9.0);
}
fr->bStep = TRUE;
// Convert the time to ps
- fr->time = frameTime / PICO;
+ fr->time = frameTime / gmx::c_pico;
fr->bTime = (frameTime > 0);
// TODO This does not leak, but is not exception safe.