BALL  1.4.2
 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 // $Id: snapShot.h,v 1.28 2005/12/23 17:01:52 amoll Exp $
5 //
6 
7 // This file contains the definitions of the classes
8 // SnapshotManager and Snapshot.
9 // They can be used to obtain snapshots from an MD simulation or an energy
10 // minimisation.
11 // A snapshot contains atom positions, velocities, forces and potential energy.
12 
13 
14 #ifndef BALL_MOLMEC_COMMON_SNAPSHOT_H
15 #define BALL_MOLMEC_COMMON_SNAPSHOT_H
16 
17 #ifndef BALL_MATHS_VECTOR3_H
18 # include <BALL/MATHS/vector3.h>
19 #endif
20 
21 namespace BALL
22 {
23  class System;
24 
32  {
33 
34  public:
35 
37 
38 
39 
40 
43  SnapShot()
44  ;
45 
47  SnapShot(const SnapShot& snapshot)
48  ;
49 
51  virtual ~SnapShot()
52  ;
53 
55 
56 
57 
59  const SnapShot& operator = (const SnapShot& snapshot)
60  ;
61 
63  virtual void clear()
64  ;
65 
67 
68 
69 
71  bool operator == (const SnapShot& snapshot) const
72  ;
73 
77  bool isValid() const
78  ;
79 
81 
82 
83 
85  void setIndex(Size index)
86  ;
87 
89  Size getIndex() const
90  ;
91 
93  void setNumberOfAtoms(Size number_of_atoms)
94  ;
95 
97  Size getNumberOfAtoms() const
98  ;
99 
101  void setPotentialEnergy(DoubleReal potential_energy)
102  ;
103 
105  DoubleReal getPotentialEnergy() const
106  ;
107 
109  void setKineticEnergy(DoubleReal kinetic_energy)
110  ;
111 
113  DoubleReal getKineticEnergy() const
114  ;
115 
117  void setAtomPositions(const ::std::vector<Vector3>& atom_postions)
118  ;
119 
121  const ::std::vector<Vector3>& getAtomPositions() const
122  ;
123 
125  void setAtomVelocities(const ::std::vector<Vector3>& atom_velocities)
126  ;
127 
129  const ::std::vector<Vector3>& getAtomVelocities() const
130  ;
131 
133  void setAtomForces(const ::std::vector<Vector3>& atom_forces)
134  ;
135 
137  const ::std::vector<Vector3>& getAtomForces() const
138  ;
139 
141 
142 
143 
148  void takeSnapShot(const System& system)
149  throw(Exception::OutOfMemory);
150 
158  void applySnapShot(System& system) const
159  ;
160 
165  void getAtomPositions(const System& system)
166  throw(Exception::OutOfMemory);
167 
172  void setAtomPositions(System& system) const
173  ;
174 
179  void getAtomVelocities(const System& system)
180  throw(Exception::OutOfMemory);
181 
186  void setAtomVelocitites(System& system) const
187  ;
188 
193  void getAtomForces(const System& system)
194  throw(Exception::OutOfMemory);
195 
200  void setAtomForces(System& system) const
201  ;
202 
204 
205  protected:
206 
207  //_ @name Protected Attributes
209 
210  //_ The index of the current snapshot object. Valid indices start at 1.
212 
213  /*_ The number of atoms of the underlying system. The system being
214  snapshot must always be the same, especially with respect to
215  the number of atoms.
216  */
218 
219  /*_ The potential energy in the system when the snapshot is taken.
220  Only contributions from selected atoms are considered.
221  */
223 
224  /*_ The kinetic energy due to electrostatic interactions.
225  Only contributions from selected atoms are considered.
226  */
228 
229  //_ An STL vector with the positions of all atoms
230  vector<Vector3> atom_positions_;
231 
232  //_ An STL vector with the velocities of all atoms
233  vector<Vector3> atom_velocities_;
234 
235  //_ An STL vector with the forces of all atoms
236  vector<Vector3> atom_forces_;
237 
239 
240  }; // Snapshot
241 
243  ::std::ostream& operator << (::std::ostream& os, const SnapShot& ss);
244 
246  ::std::istream& operator >> (::std::istream& is, SnapShot& ss);
247 
248 } // end of namespace BALL
249 
250 #endif // BALL_MOLMEC_COMMON_SNAPSHOT_H