BALL 1.5.0
snapShot.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5// This file contains the definitions of the classes
6// SnapshotManager and Snapshot.
7// They can be used to obtain snapshots from an MD simulation or an energy
8// minimisation.
9// A snapshot contains atom positions, velocities, forces and potential energy.
10
11
12#ifndef BALL_MOLMEC_COMMON_SNAPSHOT_H
13#define BALL_MOLMEC_COMMON_SNAPSHOT_H
14
15#ifndef BALL_MATHS_VECTOR3_H
16# include <BALL/MATHS/vector3.h>
17#endif
18
19namespace BALL
20{
21 class System;
22
30 {
31
32 public:
33
35
36
38
42
44 SnapShot(const SnapShot& snapshot);
45
47 virtual ~SnapShot();
48
50
52
54 const SnapShot& operator = (const SnapShot& snapshot);
55
57 virtual void clear();
58
60
62
64 bool operator == (const SnapShot& snapshot) const;
65
69 bool isValid() const;
70
72
74
76 void setIndex(Size index);
77
79 Size getIndex() const;
80
82 void setNumberOfAtoms(Size number_of_atoms);
83
85 Size getNumberOfAtoms() const;
86
88 void setPotentialEnergy(DoubleReal potential_energy);
89
91 DoubleReal getPotentialEnergy() const;
92
94 void setKineticEnergy(DoubleReal kinetic_energy);
95
97 DoubleReal getKineticEnergy() const;
98
100 void setAtomPositions(const ::std::vector<Vector3>& atom_postions);
101
103 const ::std::vector<Vector3>& getAtomPositions() const;
104
106 void setAtomVelocities(const ::std::vector<Vector3>& atom_velocities);
107
109 const ::std::vector<Vector3>& getAtomVelocities() const;
110
112 void setAtomForces(const ::std::vector<Vector3>& atom_forces);
113
115 const ::std::vector<Vector3>& getAtomForces() const;
116
118
120
126 void takeSnapShot(const System& system);
127
135 void applySnapShot(System& system) const;
136
142 void getAtomPositions(const System& system);
143
148 void setAtomPositions(System& system) const;
149
155 void getAtomVelocities(const System& system);
156
161 void setAtomVelocitites(System& system) const;
162
168 void getAtomForces(const System& system);
169
174 void setAtomForces(System& system) const;
175
177
178 protected:
179
180 //_ @name Protected Attributes
182
183 //_ The index of the current snapshot object. Valid indices start at 1.
184 Size index_;
185
186 /*_ The number of atoms of the underlying system. The system being
187 snapshot must always be the same, especially with respect to
188 the number of atoms.
189 */
190 Size number_of_atoms_;
191
192 /*_ The potential energy in the system when the snapshot is taken.
193 Only contributions from selected atoms are considered.
194 */
195 double potential_energy_;
196
197 /*_ The kinetic energy due to electrostatic interactions.
198 Only contributions from selected atoms are considered.
199 */
200 double kinetic_energy_;
201
202 //_ An STL vector with the positions of all atoms
203 vector<Vector3> atom_positions_;
204
205 //_ An STL vector with the velocities of all atoms
206 vector<Vector3> atom_velocities_;
207
208 //_ An STL vector with the forces of all atoms
209 vector<Vector3> atom_forces_;
210
212
213 }; // Snapshot
214
216 ::std::ostream& operator << (::std::ostream& os, const SnapShot& ss);
217
219 ::std::istream& operator >> (::std::istream& is, SnapShot& ss);
220
221} // end of namespace BALL
222
223#endif // BALL_MOLMEC_COMMON_SNAPSHOT_H
#define BALL_CREATE(name)
Definition: create.h:62
STL namespace.
Definition: constants.h:13
#define BALL_EXPORT
Definition: COMMON/global.h:50