21#include <boost/interprocess/sync/file_lock.hpp>
36 std::vector<Index> frames = std::vector<Index>{};
39 }
catch (std::runtime_error&) {
46 std::cout <<
"Creating statefile " <<
hdf5file_ << std::endl;
49 boost::interprocess::file_lock flock(
hdf5file_.c_str());
50 flock.lock_sharable();
52 std::vector<Index> frames = this->
getFrames();
53 frames.push_back(top.
getStep());
57 std::cout <<
"Frame with id " << top.
getStep() <<
" was not in statefile "
58 <<
hdf5file_ <<
" ,adding it now." << std::endl;
65 flock.unlock_sharable();
67 std::cout <<
"Wrote MD topology (step = " << top.
getStep()
72 std::cout <<
". " << std::endl;
78 throw std::runtime_error(
"Statefile " +
hdf5file_ +
" does not exist.");
80 std::cout <<
"Import MD Topology (i.e. frame " << frameid <<
")"
83 boost::interprocess::file_lock flock(
hdf5file_.c_str());
84 flock.lock_sharable();
86 throw std::runtime_error(
"Frame with id " + std::to_string(frameid) +
87 " is not in statefile.");
94 flock.unlock_sharable();
95 std::cout <<
". " << std::endl;
100 std::vector<Index> frames = this->
getFrames();
101 return std::find(frames.begin(), frames.end(), frameid) != frames.end();
CheckpointReader getReader()
CheckpointWriter getWriter()
Topology ReadFrame(Index frameid) const
void WriteFrame(const Topology &top)
bool TopStepisinFrames(Index frameid) const
std::vector< Index > getFrames() const
Container for segments and box and atoms.
void WriteToCpt(CheckpointWriter &w) const
void ReadFromCpt(CheckpointReader &r)
base class for all analysis tools