ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/Snapshot.hpp
(Generate patch)

Comparing branches/development/src/brains/Snapshot.hpp (file contents):
Revision 1544 by gezelter, Fri Mar 18 19:31:52 2011 UTC vs.
Revision 1757 by gezelter, Tue Jun 19 02:11:07 2012 UTC

# Line 36 | Line 36
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38   * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42    
43   /**
# Line 53 | Line 54
54   #include <vector>
55  
56   #include "brains/DataStorage.hpp"
57 + #include "nonbonded/NonBondedInteraction.hpp"
58   #include "brains/Stats.hpp"
57 #include "UseTheForce/DarkSide/simulation_interface.h"
59  
59
60   namespace OpenMD{
61  
62 +  struct FrameData {
63 +    int id;                   /**< identification number of the snapshot */
64 +    RealType currentTime;     /**< current time */
65 +    Mat3x3d hmat;             /**< axes of the periodic box in matrix form */
66 +    Mat3x3d invHmat;          /**< the inverse of the Hmat matrix */
67 +    bool orthoRhombic;        /**< is this an orthorhombic periodic box? */
68 +    RealType volume;          /**< total volume of this frame */
69 +    RealType pressure;        /**< pressure of this frame */
70 +    RealType totalEnergy;     /**< total energy of this frame */
71 +    RealType kineticEnergy;   /**< kinetic energy of this frame */
72 +    RealType potentialEnergy; /**< potential energy of this frame */
73 +    RealType shortRangePotential; /**< short-range contributions to the potential*/
74 +    RealType longRangePotential; /**< long-range contributions to the potential */
75 +    RealType bondPotential;   /**< bonded contribution to the potential */
76 +    RealType bendPotential;   /**< angle-bending contribution to the potential */
77 +    RealType torsionPotential; /**< dihedral (torsion angle) contribution to the potential */
78 +    RealType inversionPotential; /**< inversion (planarity) contribution to the potential */
79 +    potVec   lrPotentials;    /**< breakdown of long-range potentials by family */
80 +    RealType temperature;     /**< temperature of this frame */
81 +    RealType chi;             /**< thermostat velocity */
82 +    RealType integralOfChiDt; /**< the actual thermostat */
83 +    RealType electronicTemperature; /**< temperature of the electronic degrees of freedom */
84 +    RealType chiQ;            /**< fluctuating charge thermostat velocity */
85 +    RealType integralOfChiQDt; /**< the actual fluctuating charge thermostat */
86 +    Mat3x3d eta;              /**< barostat matrix */
87 +    Vector3d COM;             /**< location of center of mass */
88 +    Vector3d COMvel;          /**< system center of mass velocity */
89 +    Vector3d COMw;            /**< system center of mass angular velocity */
90 +    Mat3x3d stressTensor;     /**< stress tensor */
91 +    Mat3x3d pressureTensor;   /**< pressure tensor */
92 +    Vector3d systemDipole;    /**< total system dipole moment */
93 +    Vector3d conductiveHeatFlux; /**< heat flux vector (conductive only) */
94 +  };
95 +
96 +
97    /**
98     * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp"
99     * @brief Snapshot class is a repository class for storing dynamic data during
# Line 72 | Line 107 | namespace OpenMD{
107      Snapshot(int nAtoms, int nRigidbodies,
108               int nCutoffGroups) : atomData(nAtoms),
109                                    rigidbodyData(nRigidbodies),
110 <                                  cgData(nCutoffGroups, DataStorage::dslPosition),
111 <                                  currentTime_(0),
112 <                                  orthoTolerance_(1e-6),
113 <                                  orthoRhombic_(0),
114 <                                  chi_(0.0),
115 <                                  integralOfChiDt_(0.0),
116 <                                  eta_(0.0), id_(-1), hasCOM_(false),
117 <                                  hasVolume_(false), volume_(0.0) {
118 <
110 >                                  cgData(nCutoffGroups, DataStorage::dslPosition),
111 >                                  orthoTolerance_(1e-6), hasCOM_(false), hasVolume_(false){
112 >      
113 >      frameData.id = -1;                  
114 >      frameData.currentTime = 0;    
115 >      frameData.hmat = Mat3x3d(0.0);            
116 >      frameData.invHmat = Mat3x3d(0.0);          
117 >      frameData.orthoRhombic = false;        
118 >      frameData.volume = 0.0;          
119 >      frameData.pressure = 0.0;        
120 >      frameData.totalEnergy = 0.0;    
121 >      frameData.kineticEnergy = 0.0;  
122 >      frameData.potentialEnergy = 0.0;
123 >      frameData.temperature = 0.0;    
124 >      frameData.chi = 0.0;            
125 >      frameData.integralOfChiDt = 0.0;
126 >      frameData.electronicTemperature = 0.0;
127 >      frameData.chiQ = 0.0;            
128 >      frameData.integralOfChiQDt = 0.0;
129 >      frameData.eta = Mat3x3d(0.0);              
130 >      frameData.COM = V3Zero;            
131 >      frameData.COMvel = V3Zero;          
132 >      frameData.COMw = V3Zero;            
133 >      frameData.stressTensor = Mat3x3d(0.0);              
134 >      frameData.pressureTensor = Mat3x3d(0.0);  
135 >      frameData.systemDipole = Vector3d(0.0);            
136 >      frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0);
137      }
138  
139      Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups,
140               int storageLayout) : atomData(nAtoms, storageLayout),
141                                    rigidbodyData(nRigidbodies, storageLayout),
142                                    cgData(nCutoffGroups, DataStorage::dslPosition),
143 <                                  currentTime_(0), orthoTolerance_(1e-6),
144 <                                  orthoRhombic_(0), chi_(0.0),
145 <                                  integralOfChiDt_(0.0), eta_(0.0), id_(-1),
146 <                                  hasCOM_(false), hasVolume_(false),
147 <                                  volume_(0.0)  {
143 >                                  orthoTolerance_(1e-6),
144 >                                  hasCOM_(false),
145 >                                  hasVolume_(false) {
146 >      frameData.id = -1;                  
147 >      frameData.currentTime = 0;    
148 >      frameData.hmat = Mat3x3d(0.0);            
149 >      frameData.invHmat = Mat3x3d(0.0);          
150 >      frameData.orthoRhombic = false;        
151 >      frameData.volume = 0.0;          
152 >      frameData.pressure = 0.0;        
153 >      frameData.totalEnergy = 0.0;    
154 >      frameData.kineticEnergy = 0.0;  
155 >      frameData.potentialEnergy = 0.0;
156 >      frameData.temperature = 0.0;    
157 >      frameData.chi = 0.0;            
158 >      frameData.integralOfChiDt = 0.0;
159 >      frameData.electronicTemperature = 0.0;
160 >      frameData.chiQ = 0.0;            
161 >      frameData.integralOfChiQDt = 0.0;
162 >      frameData.eta = Mat3x3d(0.0);              
163 >      frameData.COM = V3Zero;            
164 >      frameData.COMvel = V3Zero;          
165 >      frameData.COMw = V3Zero;            
166 >      frameData.stressTensor = Mat3x3d(0.0);              
167 >      frameData.pressureTensor = Mat3x3d(0.0);  
168 >      frameData.systemDipole = V3Zero;            
169 >      frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0);            
170      }
171      
172      /** Returns the id of this Snapshot */
173      int getID() {
174 <      return id_;
174 >      return frameData.id;
175      }
176  
177      /** Sets the id of this Snapshot */
178      void setID(int id) {
179 <      id_ = id;
179 >      frameData.id = id;
180      }
181  
182      int getSize() {
# Line 125 | Line 200 | namespace OpenMD{
200  
201      /** Returns the H-Matrix */
202      Mat3x3d getHmat() {
203 <      return hmat_;
203 >      return frameData.hmat;
204      }
205  
206      /** Sets the H-Matrix */
# Line 133 | Line 208 | namespace OpenMD{
208              
209      RealType getVolume() {
210        if (hasVolume_){
211 <        return volume_;
211 >        return frameData.volume;
212        }else{
213 <        return hmat_.determinant();
213 >        return frameData.hmat.determinant();
214        }
215      }
216  
217      void setVolume(RealType volume){
218        hasVolume_=true;
219 <      volume_ = volume;
219 >      frameData.volume = volume;
220      }
221  
222      /** Returns the inverse H-Matrix */
223      Mat3x3d getInvHmat() {
224 <      return invHmat_;
224 >      return frameData.invHmat;
225      }
226  
227      /** Wrapping the vector according to periodic boundary condition*/
228      void wrapVector(Vector3d& v);
229 +    /** Scaling a vector to multiples of the periodic box */
230 +    Vector3d scaleVector(Vector3d &v);
231 +
232 +
233      Vector3d getCOM();
234      Vector3d getCOMvel();
235      Vector3d getCOMw();
236              
237      RealType getTime() {
238 <      return currentTime_;
238 >      return frameData.currentTime;
239      }
240  
241      void increaseTime(RealType dt) {
# Line 164 | Line 243 | namespace OpenMD{
243      }
244  
245      void setTime(RealType time) {
246 <      currentTime_ =time;
247 <      //time at statData is redundant
248 <      statData[Stats::TIME] = currentTime_;
246 >      frameData.currentTime =time;
247 >      //time at statData is redundant
248 >      statData[Stats::TIME] = frameData.currentTime;
249      }
250  
251      RealType getChi() {
252 <      return chi_;
252 >      return frameData.chi;
253      }
254  
255      void setChi(RealType chi) {
256 <      chi_ = chi;
256 >      frameData.chi = chi;
257      }
258  
259      RealType getIntegralOfChiDt() {
260 <      return integralOfChiDt_;
260 >      return frameData.integralOfChiDt;
261      }
262  
263      void setIntegralOfChiDt(RealType integralOfChiDt) {
264 <      integralOfChiDt_ = integralOfChiDt;
264 >      frameData.integralOfChiDt = integralOfChiDt;
265      }
266              
267 +    RealType getChiElectronic() {
268 +      return frameData.chiQ;
269 +    }
270  
271 +    void setChiElectronic(RealType chiQ) {
272 +      frameData.chiQ = chiQ;
273 +    }
274 +
275 +    RealType getIntegralOfChiElectronicDt() {
276 +      return frameData.integralOfChiQDt;
277 +    }
278 +
279 +    void setIntegralOfChiElectronicDt(RealType integralOfChiQDt) {
280 +      frameData.integralOfChiQDt = integralOfChiQDt;
281 +    }
282 +            
283 +
284      void setOrthoTolerance(RealType orthoTolerance) {
285        orthoTolerance_ = orthoTolerance;
286      }
287  
288      Mat3x3d getEta() {
289 <      return eta_;
289 >      return frameData.eta;
290      }
291  
292      void setEta(const Mat3x3d& eta) {
293 <      eta_ = eta;
293 >      frameData.eta = eta;
294      }
295  
296 <    bool hasCOM() {
297 <      return hasCOM_;
296 >    Mat3x3d getStressTensor() {
297 >      return frameData.stressTensor;
298      }
299 <
300 <    void setCOMprops(const Vector3d& COM, const Vector3d& COMvel, const Vector3d& COMw) {
301 <      COM_ = COM;
207 <      COMvel_ = COMvel;
208 <      COMw_ = COMw;
209 <      hasCOM_ = true;
299 >        
300 >    void setStressTensor(const Mat3x3d& stressTensor) {
301 >      frameData.stressTensor = stressTensor;
302      }
303  
304 <    Vector3d getAtomPosByIindex(int iIndex) {
305 < #ifdef IS_MPI
214 <      return atomIData.position[iIndex];
215 < #else
216 <      return atomData.position[iIndex];
217 < #endif
304 >    Vector3d getConductiveHeatFlux() {
305 >      return frameData.conductiveHeatFlux;
306      }
307 <    Vector3d getAtomPosByJindex(int jIndex) {
308 < #ifdef IS_MPI
309 <      return atomJData.position[jIndex];
222 < #else
223 <      return atomData.position[jIndex];
224 < #endif
307 >        
308 >    void setConductiveHeatFlux(const Vector3d& heatFlux) {
309 >      frameData.conductiveHeatFlux = heatFlux;
310      }
311  
312 <    Vector3d getCutoffGroupPosByIindex(int iIndex) {
313 < #ifdef IS_MPI
229 <      return cgIData.position[iIndex];
230 < #else
231 <      return cgData.position[iIndex];
232 < #endif
312 >    bool hasCOM() {
313 >      return hasCOM_;
314      }
315 <    Vector3d getCutoffGroupPosByJindex(int jIndex) {
316 < #ifdef IS_MPI
317 <      return cgJData.position[jIndex];
318 < #else
319 <      return cgData.position[jIndex];
320 < #endif
315 >
316 >    void setCOMprops(const Vector3d& COM, const Vector3d& COMvel, const Vector3d& COMw) {
317 >      frameData.COM = COM;
318 >      frameData.COMvel = COMvel;
319 >      frameData.COMw = COMw;
320 >      hasCOM_ = true;
321      }
322  
323      DataStorage atomData;
324      DataStorage rigidbodyData;
325      DataStorage cgData;
326 +    FrameData frameData;
327      Stats statData;
328  
247 #ifdef IS_MPI
248    DataStorage atomIData;
249    DataStorage atomJData;
250    DataStorage cgIData;
251    DataStorage cgJData;
252 #endif
253  
254            
329    private:
256    RealType currentTime_;
257
258    Mat3x3d hmat_;
259    Mat3x3d invHmat_;
330      RealType orthoTolerance_;
261    int orthoRhombic_;
262    RealType volume_;
263
264    RealType chi_;
265    RealType integralOfChiDt_;
266    Mat3x3d eta_;
267    Vector3d COM_;
268    Vector3d COMvel_;
269    Vector3d COMw_;
270    int id_; /**< identification number of the snapshot */
331      bool hasCOM_;
332 <    bool hasVolume_;
273 <            
332 >    bool hasVolume_;    
333    };
334  
335    typedef DataStorage (Snapshot::*DataStoragePointer);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines