BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
19 namespace BALL
20 {
21  class System;
22 
30  {
31 
32  public:
33 
35 
36 
37 
38 
41  SnapShot();
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 
125  void takeSnapShot(const System& system)
126  throw(Exception::OutOfMemory);
127 
135  void applySnapShot(System& system) const;
136 
141  void getAtomPositions(const System& system)
142  throw(Exception::OutOfMemory);
143 
148  void setAtomPositions(System& system) const;
149 
154  void getAtomVelocities(const System& system)
155  throw(Exception::OutOfMemory);
156 
161  void setAtomVelocitites(System& system) const;
162 
167  void getAtomForces(const System& system)
168  throw(Exception::OutOfMemory);
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.
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  */
191 
192  /*_ The potential energy in the system when the snapshot is taken.
193  Only contributions from selected atoms are considered.
194  */
196 
197  /*_ The kinetic energy due to electrostatic interactions.
198  Only contributions from selected atoms are considered.
199  */
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
double kinetic_energy_
Definition: snapShot.h:200
double potential_energy_
Definition: snapShot.h:195
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
Size number_of_atoms_
Definition: snapShot.h:190
vector< Vector3 > atom_velocities_
Definition: snapShot.h:206
BALL_EXPORT bool operator==(const String &s1, const String &s2)
vector< Vector3 > atom_positions_
Definition: snapShot.h:203
vector< Vector3 > atom_forces_
Definition: snapShot.h:209
#define BALL_EXPORT
Definition: COMMON/global.h:50