BALL  1.5.0
TRRFile.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_FORMAT_TRRFILE_H
6 #define BALL_FORMAT_TRRFILE_H
7 
8 #ifndef BALL_FORMAT_TRAJECTORYFILE_H
10 #endif
11 
12 #ifndef BALL_SYSTEM_BINARYFILEADAPTOR_H
14 #endif
15 
16 namespace BALL
17 {
29  : public TrajectoryFile
30  {
31 
32  public:
33  static const double to_angstrom;
34  static const double to_nanometer;
35 
39 
47  {
48  public:
49 
66 
74 
80 
86 
91 
96 
101 
107 
113 
117 
121 
126 
130 
134  float lambda;
135 
137  : MAGIC(1993),
138  VERSION(13),
139  title_string_length(24),
140  title_string("Created by BALL::TRRFile"),
141  ir_size(0),
142  e_size(0),
143  vir_size(0),
144  pres_size(0),
145  top_size(0),
146  sym_size(0),
147  velocity_data_size(0),
148  force_data_size(0),
149  timestep_index(0),
150  nre(0),
151  timestep_time(0.002),
152  lambda(0)
153  {
154  }
155  };
156 
158 
162 
164  TRRFile();
165 
167  TRRFile(const String& name, File::OpenMode open_mode = std::ios::in);
168 
170  virtual ~TRRFile();
172 
176 
178  virtual void clear();
180 
184 
186  bool operator == (const TRRFile& file) const;
188 
190 
191 
193  virtual bool init();
194 
199  virtual bool readHeader();
200 
206  virtual bool writeNextHeader(const TRRHeader& header);
207 
212  virtual bool readNextHeader(TRRHeader& header);
213 
218  virtual bool append(const SnapShot& snapshot);
219 
224  virtual bool read(SnapShot& snapshot);
225 
229  virtual bool skipFrame();
230 
234  virtual Size getNumberOfSnapShots();
235 
237  virtual TRRFile& operator >> (SnapShotManager& ssm);
238 
242  virtual bool flushToDisk(const std::vector<SnapShot>& buffer);
244 
245 
248 
250  bool hasVelocities() const;
251 
253  void setVelocityStorage(bool storage);
254 
256  bool hasForces() const;
257 
259  void setForceStorage(bool storage);
260 
262  Size getPrecision() const;
263 
265  bool setPrecision(const Size precision);
266 
268  float getTimestep() const;
269 
271  void setTimestep(float timestep);
272 
274  Vector3 getBoundingBoxX() const;
275 
277  Vector3 getBoundingBoxY() const;
278 
280  Vector3 getBoundingBoxZ() const;
281 
283  void setBoundingBox(const Vector3& x, const Vector3& y, const Vector3& z);
284 
286 
287  private:
288  const TRRFile& operator = (const TRRFile& file);
289 
290  protected:
291 
292  // the current step's header
294 
295  // the precision of the file in bytes per value
297 
298  // a flag deciding if the file contains velocities
300 
301  // a flag deciding if the file contains forces
303 
304  // the index of the current timestep / snapshot
306 
307  // the length of the timestep
308  float timestep_;
309 
310  // three vectors containing the base vectors of the box in
311  // nanometers
312  Vector3 box1_, box2_, box3_;
313 
318 
320  };
321 } // namespace BALL
322 
323 #endif // BALL_FORMAT_TRRFILE_H
BALL::TRRFile::to_nanometer
static const double to_nanometer
Definition: TRRFile.h:34
BALL::TRRFile::TRRHeader::bounding_box_data_size
Size bounding_box_data_size
Definition: TRRFile.h:73
BALL::TRRFile::TRRHeader::e_size
Size e_size
Definition: TRRFile.h:65
BALL::TRRFile::old_file_size_
Size old_file_size_
Definition: TRRFile.h:319
BALL::TRRFile::TRRHeader::ir_size
Size ir_size
Definition: TRRFile.h:61
BALL::TRRFile::TRRHeader::lambda
float lambda
Definition: TRRFile.h:134
BALL::BinaryFileAdaptor
Definition: binaryFileAdaptor.h:53
BALL::TRRFile::TRRHeader
Definition: TRRFile.h:46
BALL::TRRFile::TRRHeader::VERSION
Size VERSION
The version number of the TRR format.
Definition: TRRFile.h:53
BALL::TRRFile::TRRHeader::TRRHeader
TRRHeader()
Definition: TRRFile.h:136
BALL::TRRFile::TRRHeader::number_of_atoms
Size number_of_atoms
Definition: TRRFile.h:116
BALL::TRRFile
Definition: TRRFile.h:28
BALL::TRRFile::adapt_char_
BinaryFileAdaptor< char > adapt_char_
Definition: TRRFile.h:315
BALL::TRRFile::header_
TRRHeader header_
Definition: TRRFile.h:293
BALL::String
Definition: string.h:56
BALL::TRRFile::TRRHeader::title_string_length
Size title_string_length
The length of the title string.
Definition: TRRFile.h:55
trajectoryFile.h
BALL::TRRFile::timestep_
float timestep_
Definition: TRRFile.h:308
BALL::TRRFile::TRRHeader::top_size
Size top_size
Definition: TRRFile.h:90
BALL::TRRFile::adapt_float_
BinaryFileAdaptor< float > adapt_float_
Definition: TRRFile.h:316
BALL
Definition: constants.h:12
BALL::SnapShotManager
Definition: snapShotManager.h:33
BALL::TRRFile::TRRHeader::MAGIC
Size MAGIC
Magic number for the TRR format. This must be equal to 1993.
Definition: TRRFile.h:51
BALL::TRRFile::TRRHeader::timestep_index
Size timestep_index
Definition: TRRFile.h:120
BALL::File::OpenMode
std::ios::openmode OpenMode
Definition: file.h:165
BALL::TRRFile::TRRHeader::timestep_time
float timestep_time
Definition: TRRFile.h:129
binaryFileAdaptor.h
BALL::TRRFile::TRRHeader::vir_size
Size vir_size
Definition: TRRFile.h:79
BALL::TRRFile::TRRHeader::sym_size
Size sym_size
Definition: TRRFile.h:95
BALL_SIZE_TYPE
BALL::TVector3< float >
BALL::TrajectoryFile
Definition: trajectoryFile.h:28
BALL::TRRFile::box3_
Vector3 box3_
Definition: TRRFile.h:312
BALL::TRRFile::to_angstrom
static const double to_angstrom
Definition: TRRFile.h:33
BALL::TRRFile::adapt_double_
BinaryFileAdaptor< double > adapt_double_
Definition: TRRFile.h:317
BALL::TRRFile::TRRHeader::velocity_data_size
Size velocity_data_size
Definition: TRRFile.h:106
BALL::TRRFile::timestep_index_
Size timestep_index_
Definition: TRRFile.h:305
BALL::operator==
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL::TRRFile::TRRHeader::pres_size
Size pres_size
Definition: TRRFile.h:85
BALL::operator>>
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
Definition: regularData1D.h:802
TEST::precision
double precision
Definition: classTest.h:30
BALL::TRRFile::TRRHeader::nre
Size nre
Definition: TRRFile.h:125
BALL::TRRFile::has_forces_
bool has_forces_
Definition: TRRFile.h:302
BALL::TRRFile::TRRHeader::force_data_size
Size force_data_size
Definition: TRRFile.h:112
BALL::TRRFile::TRRHeader::position_data_size
Size position_data_size
Definition: TRRFile.h:100
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL::TRRFile::adapt_size_
BinaryFileAdaptor< Size > adapt_size_
Definition: TRRFile.h:314
BALL::TRRFile::precision_
Size precision_
Definition: TRRFile.h:296
BALL::TRRFile::has_velocities_
bool has_velocities_
Definition: TRRFile.h:299
BALL::TRRFile::TRRHeader::title_string
String title_string
The title string.
Definition: TRRFile.h:57
BALL::SnapShot
Definition: snapShot.h:29