18#ifndef VOTCA_CSG_H5MDTRAJECTORYREADER_PRIVATE_H
19#define VOTCA_CSG_H5MDTRAJECTORYREADER_PRIVATE_H
30#include <boost/regex.hpp>
54 bool Open(
const std::string &file)
override;
66 void Close()
override;
72 template <
typename T1>
75 offset[0] = hsize_t(row);
78 hsize_t chunk_rows[3];
82 hid_t dsp = H5Dget_space(ds);
83 H5Sselect_hyperslab(dsp, H5S_SELECT_SET, offset,
nullptr, chunk_rows,
88 H5Dread(ds, ds_data_type, mspace1, dsp, H5P_DEFAULT, data_out);
90 throw std::runtime_error(
"Error ReadVectorData: " +
91 boost::lexical_cast<std::string>(status));
98 template <
typename T1>
106 hid_t dsp = H5Dget_space(ds);
107 H5Sselect_hyperslab(dsp, H5S_SELECT_SET, offset,
nullptr, ch_rows,
nullptr);
108 hid_t mspace1 = H5Screate_simple(2, ch_rows,
nullptr);
111 H5Dread(ds, ds_data_type, mspace1, dsp, H5P_DEFAULT, data_out);
113 throw std::runtime_error(
"Error ReadScalarData: " +
114 boost::lexical_cast<std::string>(status));
120 template <
typename T1>
122 std::unique_ptr<T1> &outbuf) {
124 H5Dread(ds, ds_data_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, outbuf.get());
126 H5Eprint(H5E_DEFAULT, stderr);
131 std::unique_ptr<
double[]> &data_out);
138 throw std::runtime_error(error_message);
144 herr_t status = H5Gget_objinfo(file_id, path.c_str(), 0, &info);
148 return info.type == H5G_GROUP;
195 std::unordered_map<std::string, double>({{
"fm", 0.000001},
class for reading H5MD trajectory.
DatasetState has_id_group_
void Close() override
Closes original trajectory file.
double ReadScaleFactor(const hid_t &ds, const std::string &unit_type)
~H5MDTrajectoryReader() override
DatasetState has_velocity_
hid_t atom_position_group_
void ReadBox(hid_t ds, hid_t ds_data_type, Index row, std::unique_ptr< double[]> &data_out)
void ReadStaticData(hid_t ds, hid_t ds_data_type, std::unique_ptr< T1 > &outbuf)
bool NextFrame(Topology &conf) override
Reads in the next frame.
T1 * ReadVectorData(hid_t ds, hid_t ds_data_type, Index row)
Reads dataset that contains vectors.
void CheckError(hid_t hid, std::string error_message)
T1 * ReadScalarData(hid_t ds, hid_t ds_data_type, Index row)
Reads dataset with scalar values.
boost::regex suffix_units
std::unordered_map< std::string, double > votca_units_scaling_factors
bool GroupExists(hid_t file_id, std::string path)
void Initialize(Topology &top)
Initialize data structures.
bool Open(const std::string &file) override
Opens original trajectory file.
bool FirstFrame(Topology &conf) override
Reads in the first frame.
bool unit_module_enabled_
hid_t atom_velocity_group_
topology of the whole system
trajectoryreader interface
base class for all analysis tools