Loading...
Searching...
No Matches
DCDFile.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_FORMAT_DCDFILE_H
#define BALL_FORMAT_DCDFILE_H
#ifndef BALL_FORMAT_TRAJECTORYFILE_H
# include <BALL/FORMAT/trajectoryFile.h>
#endif
#ifndef BALL_SYSTEM_BINARYFILEADAPTOR_H
# include <BALL/SYSTEM/binaryFileAdaptor.h>
#endif
namespace BALL
{
class BALL_EXPORT DCDFile
: public TrajectoryFile
{
public:
DCDFile();
DCDFile(const String& name, File::OpenMode open_mode = std::ios::in);
virtual ~DCDFile();
virtual void clear();
bool operator == (const DCDFile& file) const;
bool isSwappingBytes() const;
bool hasVelocities() const;
virtual bool open(const String& name, File::OpenMode open_mode = std::ios::in);
bool init();
virtual bool readHeader();
virtual bool writeHeader();
virtual bool seekAndWriteHeader();
// ?????:
// should append() also write the header? what is more intuitive?
virtual bool append(const SnapShot& snapshot);
virtual bool read(SnapShot& snapshot);
virtual bool flushToDisk(const std::vector<SnapShot>& buffer);
void enableVelocityStorage();
void disableVelocityStorage();
private:
const DCDFile& operator = (const DCDFile& file);
protected:
//_
void writeSize_(const Size& data)
{ *this << BinaryFileAdaptor<Size>(data);}
//_
void writeFloat_(const float& data)
{ *this << BinaryFileAdaptor<float>(data);}
//_
void writeVector_(const vector<Vector3>& v);
//_
float readFloat_();
//_
Size readSize_();
//_
bool readSize_(Size expected_size, const String& what);
//_
bool readVector_(vector<Vector3>& v);
//_
Size verbosity_;
// a flag indicating that we have to swap bytes when reading data
bool swap_bytes_;
// a floag indicating that this DCD file contains atom velocities
bool has_velocities_;
//_
bool charmm_extra_block_A_;
//_
bool charmm_extra_block_B_;
//_
String CORD_;
//_
Size step_number_of_starting_time_;
//_
Size steps_between_saves_;
//_
double time_step_length_;
//_
Size number_of_comments_;
/*_ We had a problem with read(Snapshot), as it
still returned true at the end of file. No idea
why the stream was still good! To fix this,
I added this member to count the current read snapshot.
*/
Position current_snapshot_;
BinaryFileAdaptor<Size> adapt_size_;
BinaryFileAdaptor<float> adapt_float_;
};
} // namespace BALL
#endif // BALL_FORMAT_DCDFILE_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
binaryFileAdaptor.h
BALL::BinaryFileAdaptor
Definition binaryFileAdaptor.h:54
BALL::DCDFile::readVector_
bool readVector_(vector< Vector3 > &v)
BALL::DCDFile::adapt_float_
BinaryFileAdaptor< float > adapt_float_
Definition DCDFile.h:204
BALL::DCDFile::~DCDFile
virtual ~DCDFile()
Destructor.
BALL::DCDFile::DCDFile
DCDFile(const String &name, File::OpenMode open_mode=std::ios::in)
BALL::DCDFile::DCDFile
DCDFile()
Default constructor.
BALL::DCDFile::number_of_comments_
Size number_of_comments_
Definition DCDFile.h:194
BALL::DCDFile::append
virtual bool append(const SnapShot &snapshot)
BALL::DCDFile::has_velocities_
bool has_velocities_
Definition DCDFile.h:173
BALL::DCDFile::swap_bytes_
bool swap_bytes_
Definition DCDFile.h:170
BALL::DCDFile::isSwappingBytes
bool isSwappingBytes() const
BALL::DCDFile::enableVelocityStorage
void enableVelocityStorage()
BALL::DCDFile::readSize_
Size readSize_()
BALL::DCDFile::charmm_extra_block_B_
bool charmm_extra_block_B_
Definition DCDFile.h:179
BALL::DCDFile::writeVector_
void writeVector_(const vector< Vector3 > &v)
BALL::DCDFile::CORD_
String CORD_
Definition DCDFile.h:182
BALL::DCDFile::readHeader
virtual bool readHeader()
BALL::DCDFile::adapt_size_
BinaryFileAdaptor< Size > adapt_size_
Definition DCDFile.h:203
BALL::DCDFile::writeHeader
virtual bool writeHeader()
BALL::DCDFile::writeFloat_
void writeFloat_(const float &data)
Definition DCDFile.h:148
BALL::DCDFile::read
virtual bool read(SnapShot &snapshot)
BALL::DCDFile::step_number_of_starting_time_
Size step_number_of_starting_time_
Definition DCDFile.h:185
BALL::DCDFile::charmm_extra_block_A_
bool charmm_extra_block_A_
Definition DCDFile.h:176
BALL::DCDFile::seekAndWriteHeader
virtual bool seekAndWriteHeader()
BALL::DCDFile::open
virtual bool open(const String &name, File::OpenMode open_mode=std::ios::in)
BALL::DCDFile::hasVelocities
bool hasVelocities() const
BALL::DCDFile::flushToDisk
virtual bool flushToDisk(const std::vector< SnapShot > &buffer)
BALL::DCDFile::current_snapshot_
Position current_snapshot_
Definition DCDFile.h:201
BALL::DCDFile::disableVelocityStorage
void disableVelocityStorage()
BALL::DCDFile::readSize_
bool readSize_(Size expected_size, const String &what)
BALL::DCDFile::clear
virtual void clear()
Clear method.
BALL::DCDFile::readFloat_
float readFloat_()
BALL::DCDFile::verbosity_
Size verbosity_
Definition DCDFile.h:167
BALL::DCDFile::steps_between_saves_
Size steps_between_saves_
Definition DCDFile.h:188
BALL::DCDFile::init
bool init()
BALL::DCDFile::writeSize_
void writeSize_(const Size &data)
Definition DCDFile.h:144
BALL::DCDFile::time_step_length_
double time_step_length_
Definition DCDFile.h:191
BALL::File::OpenMode
std::ios::openmode OpenMode
Definition file.h:165
BALL::SnapShot
Definition snapShot.h:30
BALL::String
Definition string.h:57
BALL::TrajectoryFile::TrajectoryFile
TrajectoryFile()
Default constructor.
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
trajectoryFile.h