BALL
1.4.2
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
BALL
FORMAT
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
9
# include <
BALL/FORMAT/trajectoryFile.h
>
10
#endif
11
12
#ifndef BALL_SYSTEM_BINARYFILEADAPTOR_H
13
# include <
BALL/SYSTEM/binaryFileAdaptor.h
>
14
#endif
15
16
namespace
BALL
17
{
28
class
BALL_EXPORT
TRRFile
29
:
public
TrajectoryFile
30
{
31
32
public
:
33
static
const
double
to_angstrom
;
34
static
const
double
to_nanometer
;
35
39
46
class
BALL_EXPORT
TRRHeader
47
{
48
public
:
49
51
Size
MAGIC
;
53
Size
VERSION
;
55
Size
title_string_length
;
57
String
title_string
;
61
Size
ir_size
;
65
Size
e_size
;
66
73
Size
bounding_box_data_size
;
74
79
Size
vir_size
;
80
85
Size
pres_size
;
86
90
Size
top_size
;
91
95
Size
sym_size
;
96
100
Size
position_data_size
;
101
106
Size
velocity_data_size
;
107
112
Size
force_data_size
;
113
116
Size
number_of_atoms
;
117
120
Size
timestep_index
;
121
125
Size
nre
;
126
129
float
timestep_time
;
130
134
float
lambda
;
135
136
TRRHeader
()
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
293
TRRHeader
header_
;
294
295
// the precision of the file in bytes per value
296
Size
precision_
;
297
298
// a flag deciding if the file contains velocities
299
bool
has_velocities_
;
300
301
// a flag deciding if the file contains forces
302
bool
has_forces_
;
303
304
// the index of the current timestep / snapshot
305
Size
timestep_index_
;
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
314
BinaryFileAdaptor<Size>
adapt_size_
;
315
BinaryFileAdaptor<char>
adapt_char_
;
316
BinaryFileAdaptor<float>
adapt_float_
;
317
BinaryFileAdaptor<double>
adapt_double_
;
318
319
Size
old_file_size_
;
320
};
321
}
// namespace BALL
322
323
#endif // BALL_FORMAT_TRRFILE_H
Generated by
1.8.3.1