/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, 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.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+#include "gmxpre.h"
+
#include "tngio_for_tools.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include <math.h>
-#include "tngio.h"
-#include "trx.h"
+#include "config.h"
#ifdef GMX_USE_TNG
-#include "../../external/tng_io/include/tng_io.h"
+#include "tng/tng_io.h"
#endif
+#include "gromacs/fileio/tngio.h"
+#include "gromacs/fileio/trx.h"
+#include "gromacs/math/units.h"
#include "gromacs/utility/common.h"
-#include "gromacs/legacyheaders/types/atoms.h"
-#include "gromacs/legacyheaders/smalloc.h"
-#include "gromacs/legacyheaders/physics.h"
-#include "gromacs/legacyheaders/gmx_fatal.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
void gmx_prepare_tng_writing(const char *filename,
char mode,
"FORCES", "LAMBDAS"
};
+ typedef tng_function_status (*set_writing_interval_func_pointer)(tng_trajectory_t,
+ const gmx_int64_t,
+ const gmx_int64_t,
+ const gmx_int64_t,
+ const char*,
+ const char,
+ const char);
+#ifdef GMX_DOUBLE
+ set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_double_set;
+#else
+ set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_set;
+#endif
gmx_tng_open(filename, mode, output);
{
case TNG_TRAJ_POSITIONS:
case TNG_TRAJ_VELOCITIES:
- tng_util_generic_write_interval_set(*output, interval, 3, fallbackIds[i],
- fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
- compression_type);
+ set_writing_interval(*output, interval, 3, fallbackIds[i],
+ fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
+ compression_type);
break;
case TNG_TRAJ_FORCES:
- tng_util_generic_write_interval_set(*output, interval, 3, fallbackIds[i],
- fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
- TNG_GZIP_COMPRESSION);
+ set_writing_interval(*output, interval, 3, fallbackIds[i],
+ fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
+ TNG_GZIP_COMPRESSION);
break;
case TNG_TRAJ_BOX_SHAPE:
- tng_util_generic_write_interval_set(*output, interval, 9, fallbackIds[i],
- fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
- TNG_GZIP_COMPRESSION);
+ set_writing_interval(*output, interval, 9, fallbackIds[i],
+ fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
+ TNG_GZIP_COMPRESSION);
break;
case TNG_GMX_LAMBDA:
- tng_util_generic_write_interval_set(*output, interval, 1, fallbackIds[i],
- fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
- TNG_GZIP_COMPRESSION);
+ set_writing_interval(*output, interval, 1, fallbackIds[i],
+ fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
+ TNG_GZIP_COMPRESSION);
default:
continue;
}
GMX_UNUSED_VALUE(input);
GMX_UNUSED_VALUE(output);
GMX_UNUSED_VALUE(nAtoms);
+ GMX_UNUSED_VALUE(mtop);
+ GMX_UNUSED_VALUE(index);
+ GMX_UNUSED_VALUE(indexGroupName);
#endif
}
#else
GMX_UNUSED_VALUE(output);
GMX_UNUSED_VALUE(frame);
+ GMX_UNUSED_VALUE(natoms);
#endif
}
gmx_bool bOK = TRUE;
tng_function_status stat;
gmx_int64_t numberOfAtoms = -1, frameNumber = -1;
- gmx_int64_t nBlocks, blockId, *blockIds = NULL;
- char datatype = -1, codecId;
+ gmx_int64_t nBlocks, blockId, *blockIds = NULL, codecId;
+ char datatype = -1;
void *values = NULL;
double frameTime = -1.0;
int size, blockDependency;
- float prec;
+ double prec;
const int defaultNumIds = 5;
static gmx_int64_t fallbackRequestedIds[defaultNumIds] =
{
size = sizeof(double);
break;
default:
- size = 0; /* Just to make the compiler happy. */
gmx_incons("Illegal datatype of box shape values!");
}
for (int i = 0; i < DIM; i++)
{
convert_array_to_real_array((char *)(values) + size * i * DIM,
- (real *) fr->box[i],
- getDistanceScaleFactor(input),
- 1,
- DIM,
- datatype);
+ (real *) fr->box[i],
+ getDistanceScaleFactor(input),
+ 1,
+ DIM,
+ datatype);
}
fr->bBox = TRUE;
break;
case TNG_TRAJ_POSITIONS:
srenew(fr->x, fr->natoms);
convert_array_to_real_array(values,
- (real *) fr->x,
- getDistanceScaleFactor(input),
- fr->natoms,
- DIM,
- datatype);
+ (real *) fr->x,
+ getDistanceScaleFactor(input),
+ fr->natoms,
+ DIM,
+ datatype);
fr->bX = TRUE;
tng_util_frame_current_compression_get(input, blockId, &codecId, &prec);
/* This must be updated if/when more lossy compression methods are added */
case TNG_TRAJ_VELOCITIES:
srenew(fr->v, fr->natoms);
convert_array_to_real_array(values,
- (real *) fr->v,
- getDistanceScaleFactor(input),
- fr->natoms,
- DIM,
- datatype);
+ (real *) fr->v,
+ getDistanceScaleFactor(input),
+ fr->natoms,
+ DIM,
+ datatype);
fr->bV = TRUE;
tng_util_frame_current_compression_get(input, blockId, &codecId, &prec);
/* This must be updated if/when more lossy compression methods are added */
case TNG_TRAJ_FORCES:
srenew(fr->f, fr->natoms);
convert_array_to_real_array(values,
- (real *) fr->f,
- getDistanceScaleFactor(input),
- fr->natoms,
- DIM,
- datatype);
+ (real *) fr->f,
+ getDistanceScaleFactor(input),
+ fr->natoms,
+ DIM,
+ datatype);
fr->bF = TRUE;
break;
case TNG_GMX_LAMBDA:
GMX_UNUSED_VALUE(input);
GMX_UNUSED_VALUE(fr);
GMX_UNUSED_VALUE(requestedIds);
+ GMX_UNUSED_VALUE(numRequestedIds);
return FALSE;
#endif
}
{
#ifdef GMX_USE_TNG
tng_function_status stat;
- char datatype = -1, codecId;
+ char datatype = -1;
+ gmx_int64_t codecId;
int blockDependency;
void *data = 0;
- float localPrec;
+ double localPrec;
stat = tng_data_block_name_get(input, blockId, name, maxLen);
if (stat != TNG_SUCCESS)
}
snew(*values, sizeof(real) * *nValuesPerFrame * *nAtoms);
convert_array_to_real_array(data,
- *values,
- getDistanceScaleFactor(input),
- *nAtoms,
- *nValuesPerFrame,
- datatype);
+ *values,
+ getDistanceScaleFactor(input),
+ *nAtoms,
+ *nValuesPerFrame,
+ datatype);
tng_util_frame_current_compression_get(input, blockId, &codecId, &localPrec);