BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: snapShot.h,v 1.28 2005/12/23 17:01:52 amoll Exp $ 00005 // 00006 00007 // This file contains the definitions of the classes 00008 // SnapshotManager and Snapshot. 00009 // They can be used to obtain snapshots from an MD simulation or an energy 00010 // minimisation. 00011 // A snapshot contains atom positions, velocities, forces and potential energy. 00012 00013 00014 #ifndef BALL_MOLMEC_COMMON_SNAPSHOT_H 00015 #define BALL_MOLMEC_COMMON_SNAPSHOT_H 00016 00017 #ifndef BALL_MATHS_VECTOR3_H 00018 # include <BALL/MATHS/vector3.h> 00019 #endif 00020 00021 namespace BALL 00022 { 00023 class System; 00024 00031 class BALL_EXPORT SnapShot 00032 { 00033 00034 public: 00035 00036 BALL_CREATE(SnapShot) 00037 00038 00039 00040 00043 SnapShot() 00044 ; 00045 00047 SnapShot(const SnapShot& snapshot) 00048 ; 00049 00051 virtual ~SnapShot() 00052 ; 00053 00055 00056 00057 00059 const SnapShot& operator = (const SnapShot& snapshot) 00060 ; 00061 00063 virtual void clear() 00064 ; 00065 00067 00068 00069 00071 bool operator == (const SnapShot& snapshot) const 00072 ; 00073 00077 bool isValid() const 00078 ; 00079 00081 00082 00083 00085 void setIndex(Size index) 00086 ; 00087 00089 Size getIndex() const 00090 ; 00091 00093 void setNumberOfAtoms(Size number_of_atoms) 00094 ; 00095 00097 Size getNumberOfAtoms() const 00098 ; 00099 00101 void setPotentialEnergy(DoubleReal potential_energy) 00102 ; 00103 00105 DoubleReal getPotentialEnergy() const 00106 ; 00107 00109 void setKineticEnergy(DoubleReal kinetic_energy) 00110 ; 00111 00113 DoubleReal getKineticEnergy() const 00114 ; 00115 00117 void setAtomPositions(const ::std::vector<Vector3>& atom_postions) 00118 ; 00119 00121 const ::std::vector<Vector3>& getAtomPositions() const 00122 ; 00123 00125 void setAtomVelocities(const ::std::vector<Vector3>& atom_velocities) 00126 ; 00127 00129 const ::std::vector<Vector3>& getAtomVelocities() const 00130 ; 00131 00133 void setAtomForces(const ::std::vector<Vector3>& atom_forces) 00134 ; 00135 00137 const ::std::vector<Vector3>& getAtomForces() const 00138 ; 00139 00141 00142 00143 00148 void takeSnapShot(const System& system) 00149 throw(Exception::OutOfMemory); 00150 00158 void applySnapShot(System& system) const 00159 ; 00160 00165 void getAtomPositions(const System& system) 00166 throw(Exception::OutOfMemory); 00167 00172 void setAtomPositions(System& system) const 00173 ; 00174 00179 void getAtomVelocities(const System& system) 00180 throw(Exception::OutOfMemory); 00181 00186 void setAtomVelocitites(System& system) const 00187 ; 00188 00193 void getAtomForces(const System& system) 00194 throw(Exception::OutOfMemory); 00195 00200 void setAtomForces(System& system) const 00201 ; 00202 00204 00205 protected: 00206 00207 //_ @name Protected Attributes 00209 00210 //_ The index of the current snapshot object. Valid indices start at 1. 00211 Size index_; 00212 00213 /*_ The number of atoms of the underlying system. The system being 00214 snapshot must always be the same, especially with respect to 00215 the number of atoms. 00216 */ 00217 Size number_of_atoms_; 00218 00219 /*_ The potential energy in the system when the snapshot is taken. 00220 Only contributions from selected atoms are considered. 00221 */ 00222 double potential_energy_; 00223 00224 /*_ The kinetic energy due to electrostatic interactions. 00225 Only contributions from selected atoms are considered. 00226 */ 00227 double kinetic_energy_; 00228 00229 //_ An STL vector with the positions of all atoms 00230 vector<Vector3> atom_positions_; 00231 00232 //_ An STL vector with the velocities of all atoms 00233 vector<Vector3> atom_velocities_; 00234 00235 //_ An STL vector with the forces of all atoms 00236 vector<Vector3> atom_forces_; 00237 00239 00240 }; // Snapshot 00241 00243 ::std::ostream& operator << (::std::ostream& os, const SnapShot& ss); 00244 00246 ::std::istream& operator >> (::std::istream& is, SnapShot& ss); 00247 00248 } // end of namespace BALL 00249 00250 #endif // BALL_MOLMEC_COMMON_SNAPSHOT_H