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

Comparing:
trunk/src/brains/Snapshot.hpp (file contents), Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
branches/development/src/brains/Snapshot.hpp (file contents), Revision 1715 by gezelter, Tue May 22 21:55:31 2012 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
28   * arising out of the use of or inability to use software, even if the
29   * University of Notre Dame has been advised of the possibility of
30   * such damages.
31 + *
32 + * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your
33 + * research, please cite the appropriate papers when you publish your
34 + * work.  Good starting points are:
35 + *                                                                      
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]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 + * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42    
43 < /**
44 <  * @file Snapshot.hpp
45 <  * @author tlin
46 <  * @date 10/20/2004
47 <  * @time 23:56am
48 <  * @version 1.0
49 <  */
43 > /**
44 > * @file Snapshot.hpp
45 > * @author tlin
46 > * @date 10/20/2004
47 > * @time 23:56am
48 > * @version 1.0
49 > */
50    
51   #ifndef BRAINS_SNAPSHOT_HPP
52   #define BRAINS_SNAPSHOT_HPP
# Line 54 | Line 55
55  
56   #include "brains/DataStorage.hpp"
57   #include "brains/Stats.hpp"
57 #include "UseTheForce/DarkSide/simulation_interface.h"
58  
59 < namespace oopse{
59 > namespace OpenMD{
60  
61 <    /**
62 <     * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp"
63 <     * @brief Snapshot class is a repository class for storing dynamic data during
64 <     *  Simulation
65 <     * Every snapshot class will contain one DataStorage  for atoms and one DataStorage
66 <     *  for rigid bodies.
67 <     */
68 <    class Snapshot {
69 <        public:
70 <            
71 <            Snapshot(int nAtoms, int nRigidbodies) : atomData(nAtoms), rigidbodyData(nRigidbodies),
72 <                currentTime_(0), orthoRhombic_(0), chi_(0.0), integralOfChiDt_(0.0), eta_(0.0) {
61 >  struct FrameData {
62 >    int id;                   /**< identification number of the snapshot */
63 >    RealType currentTime;     /**< current time */
64 >    Mat3x3d hmat;             /**< axes of the periodic box in matrix form */
65 >    Mat3x3d invHmat;          /**< the inverse of the Hmat matrix */
66 >    bool orthoRhombic;        /**< is this an orthorhombic periodic box? */
67 >    RealType volume;          /**< total volume of this frame */
68 >    RealType pressure;        /**< pressure of this frame */
69 >    RealType totalEnergy;     /**< total energy of this frame */
70 >    RealType kineticEnergy;   /**< kinetic energy of this frame */
71 >    RealType potentialEnergy; /**< potential energy of this frame */
72 >    RealType temperature;     /**< temperature of this frame */
73 >    RealType chi;             /**< thermostat velocity */
74 >    RealType integralOfChiDt; /**< the actual thermostat */
75 >    RealType electronicTemperature; /**< temperature of the electronic degrees of freedom */
76 >    RealType chiQ;            /**< fluctuating charge thermostat velocity */
77 >    RealType integralOfChiQDt; /**< the actual fluctuating charge thermostat */
78 >    Mat3x3d eta;              /**< barostat matrix */
79 >    Vector3d COM;             /**< location of center of mass */
80 >    Vector3d COMvel;          /**< system center of mass velocity */
81 >    Vector3d COMw;            /**< system center of mass angular velocity */
82 >    Mat3x3d tau;              /**< stress tensor */
83 >    Mat3x3d pressureTensor;   /**< pressure tensor */
84 >    Vector3d systemDipole;    /**< total system dipole moment */
85 >  };
86  
74            }
87  
88 +  /**
89 +   * @class Snapshot Snapshot.hpp "brains/Snapshot.hpp"
90 +   * @brief Snapshot class is a repository class for storing dynamic data during
91 +   *  Simulation
92 +   * Every snapshot class will contain one DataStorage for atoms and one DataStorage
93 +   *  for rigid bodies.
94 +   */
95 +  class Snapshot {
96 +  public:
97              
98 <            /** Returns the id of this Snapshot */
99 <            int getID() {
100 <                return id_;
101 <            }
98 >    Snapshot(int nAtoms, int nRigidbodies,
99 >             int nCutoffGroups) : atomData(nAtoms),
100 >                                  rigidbodyData(nRigidbodies),
101 >                                  cgData(nCutoffGroups, DataStorage::dslPosition),
102 >                                  orthoTolerance_(1e-6), hasCOM_(false), hasVolume_(false){
103 >      
104 >      frameData.id = -1;                  
105 >      frameData.currentTime = 0;    
106 >      frameData.hmat = Mat3x3d(0.0);            
107 >      frameData.invHmat = Mat3x3d(0.0);          
108 >      frameData.orthoRhombic = false;        
109 >      frameData.volume = 0.0;          
110 >      frameData.pressure = 0.0;        
111 >      frameData.totalEnergy = 0.0;    
112 >      frameData.kineticEnergy = 0.0;  
113 >      frameData.potentialEnergy = 0.0;
114 >      frameData.temperature = 0.0;    
115 >      frameData.chi = 0.0;            
116 >      frameData.integralOfChiDt = 0.0;
117 >      frameData.electronicTemperature = 0.0;
118 >      frameData.chiQ = 0.0;            
119 >      frameData.integralOfChiQDt = 0.0;
120 >      frameData.eta = Mat3x3d(0.0);              
121 >      frameData.COM = V3Zero;            
122 >      frameData.COMvel = V3Zero;          
123 >      frameData.COMw = V3Zero;            
124 >      frameData.tau = Mat3x3d(0.0);              
125 >      frameData.pressureTensor = Mat3x3d(0.0);  
126 >      frameData.systemDipole = V3Zero;            
127 >    }
128  
129 <            /** Sets the id of this Snapshot */
130 <            void setID(int id) {
131 <                id_ = id;
132 <            }
129 >    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups,
130 >             int storageLayout) : atomData(nAtoms, storageLayout),
131 >                                  rigidbodyData(nRigidbodies, storageLayout),
132 >                                  cgData(nCutoffGroups, DataStorage::dslPosition),
133 >                                  orthoTolerance_(1e-6),
134 >                                  hasCOM_(false),
135 >                                  hasVolume_(false) {
136 >      frameData.id = -1;                  
137 >      frameData.currentTime = 0;    
138 >      frameData.hmat = Mat3x3d(0.0);            
139 >      frameData.invHmat = Mat3x3d(0.0);          
140 >      frameData.orthoRhombic = false;        
141 >      frameData.volume = 0.0;          
142 >      frameData.pressure = 0.0;        
143 >      frameData.totalEnergy = 0.0;    
144 >      frameData.kineticEnergy = 0.0;  
145 >      frameData.potentialEnergy = 0.0;
146 >      frameData.temperature = 0.0;    
147 >      frameData.chi = 0.0;            
148 >      frameData.integralOfChiDt = 0.0;
149 >      frameData.electronicTemperature = 0.0;
150 >      frameData.chiQ = 0.0;            
151 >      frameData.integralOfChiQDt = 0.0;
152 >      frameData.eta = Mat3x3d(0.0);              
153 >      frameData.COM = V3Zero;            
154 >      frameData.COMvel = V3Zero;          
155 >      frameData.COMw = V3Zero;            
156 >      frameData.tau = Mat3x3d(0.0);              
157 >      frameData.pressureTensor = Mat3x3d(0.0);  
158 >      frameData.systemDipole = V3Zero;            
159 >    }
160 >    
161 >    /** Returns the id of this Snapshot */
162 >    int getID() {
163 >      return frameData.id;
164 >    }
165  
166 <            int getSize() {
167 <                return atomData.getSize() + rigidbodyData.getSize();
168 <            }
166 >    /** Sets the id of this Snapshot */
167 >    void setID(int id) {
168 >      frameData.id = id;
169 >    }
170  
171 <            /** Returns the number of atoms */
172 <            int getNumberOfAtoms() {
173 <                return atomData.getSize();
94 <            }
171 >    int getSize() {
172 >      return atomData.getSize() + rigidbodyData.getSize();
173 >    }
174  
175 <            /** Returns the number of rigid bodies */
176 <            int getNumberOfRigidBodies() {
177 <                return rigidbodyData.getSize();
178 <            }
175 >    /** Returns the number of atoms */
176 >    int getNumberOfAtoms() {
177 >      return atomData.getSize();
178 >    }
179  
180 <            /** Returns the H-Matrix */
181 <            Mat3x3d getHmat() {
182 <                return hmat_;
183 <            }
180 >    /** Returns the number of rigid bodies */
181 >    int getNumberOfRigidBodies() {
182 >      return rigidbodyData.getSize();
183 >    }
184  
185 <            /** Sets the H-Matrix */
186 <            void setHmat(const Mat3x3d& m);
185 >    /** Returns the number of rigid bodies */
186 >    int getNumberOfCutoffGroups() {
187 >      return cgData.getSize();
188 >    }
189 >
190 >    /** Returns the H-Matrix */
191 >    Mat3x3d getHmat() {
192 >      return frameData.hmat;
193 >    }
194 >
195 >    /** Sets the H-Matrix */
196 >    void setHmat(const Mat3x3d& m);
197              
198 <            double getVolume() {
199 <                return hmat_.determinant();
200 <            }
198 >    RealType getVolume() {
199 >      if (hasVolume_){
200 >        return frameData.volume;
201 >      }else{
202 >        return frameData.hmat.determinant();
203 >      }
204 >    }
205  
206 <            /** Returns the inverse H-Matrix */
207 <            Mat3x3d getInvHmat() {
208 <                return invHmat_;
209 <            }
206 >    void setVolume(RealType volume){
207 >      hasVolume_=true;
208 >      frameData.volume = volume;
209 >    }
210  
211 <            /** Wrapping the vector according to periodic boundary condition*/
212 <            void wrapVector(Vector3d& v);
211 >    /** Returns the inverse H-Matrix */
212 >    Mat3x3d getInvHmat() {
213 >      return frameData.invHmat;
214 >    }
215  
216 +    /** Wrapping the vector according to periodic boundary condition*/
217 +    void wrapVector(Vector3d& v);
218 +    /** Scaling a vector to multiples of the periodic box */
219 +    Vector3d scaleVector(Vector3d &v);
220 +
221 +
222 +    Vector3d getCOM();
223 +    Vector3d getCOMvel();
224 +    Vector3d getCOMw();
225              
226 <            double getTime() {
227 <                return currentTime_;
228 <            }
226 >    RealType getTime() {
227 >      return frameData.currentTime;
228 >    }
229  
230 <            void increaseTime(double dt) {
231 <                setTime(getTime() + dt);
232 <            }
230 >    void increaseTime(RealType dt) {
231 >      setTime(getTime() + dt);
232 >    }
233  
234 <            void setTime(double time) {
235 <                currentTime_ =time;
236 <                //time at statData is redundant
237 <                statData[Stats::TIME] = currentTime_;
238 <            }
234 >    void setTime(RealType time) {
235 >      frameData.currentTime =time;
236 >      //time at statData is redundant
237 >      statData[Stats::TIME] = frameData.currentTime;
238 >    }
239  
240 <            double getChi() {
241 <                return chi_;
242 <            }
240 >    RealType getChi() {
241 >      return frameData.chi;
242 >    }
243  
244 <            void setChi(double chi) {
245 <                chi_ = chi;
246 <            }
244 >    void setChi(RealType chi) {
245 >      frameData.chi = chi;
246 >    }
247  
248 <            double getIntegralOfChiDt() {
249 <                return integralOfChiDt_;
250 <            }
248 >    RealType getIntegralOfChiDt() {
249 >      return frameData.integralOfChiDt;
250 >    }
251  
252 <            void setIntegralOfChiDt(double integralOfChiDt) {
253 <                integralOfChiDt_ = integralOfChiDt;
254 <            }
252 >    void setIntegralOfChiDt(RealType integralOfChiDt) {
253 >      frameData.integralOfChiDt = integralOfChiDt;
254 >    }
255              
256 <            Mat3x3d getEta() {
257 <                return eta_;
258 <            }
256 >    RealType getChiElectronic() {
257 >      return frameData.chiQ;
258 >    }
259  
260 <            void setEta(const Mat3x3d& eta) {
261 <                eta_ = eta;
262 <            }
159 <            
160 <            DataStorage atomData;
161 <            DataStorage rigidbodyData;
162 <            Stats statData;
163 <            
164 <        private:
165 <            double currentTime_;
260 >    void setChiElectronic(RealType chiQ) {
261 >      frameData.chiQ = chiQ;
262 >    }
263  
264 <            Mat3x3d hmat_;
265 <            Mat3x3d invHmat_;
266 <            int orthoRhombic_;
264 >    RealType getIntegralOfChiElectronicDt() {
265 >      return frameData.integralOfChiQDt;
266 >    }
267  
268 <            double chi_;
269 <            double integralOfChiDt_;
270 <            Mat3x3d eta_;
268 >    void setIntegralOfChiElectronicDt(RealType integralOfChiQDt) {
269 >      frameData.integralOfChiQDt = integralOfChiQDt;
270 >    }
271              
175            int id_; /**< identification number of the snapshot */
176    };
272  
273 <    typedef DataStorage (Snapshot::*DataStoragePointer);
273 >    void setOrthoTolerance(RealType orthoTolerance) {
274 >      orthoTolerance_ = orthoTolerance;
275 >    }
276 >
277 >    Mat3x3d getEta() {
278 >      return frameData.eta;
279 >    }
280 >
281 >    void setEta(const Mat3x3d& eta) {
282 >      frameData.eta = eta;
283 >    }
284 >
285 >    Mat3x3d getTau() {
286 >      return frameData.tau;
287 >    }
288 >        
289 >    void setTau(const Mat3x3d& tau) {
290 >      frameData.tau = tau;
291 >    }
292 >
293 >    bool hasCOM() {
294 >      return hasCOM_;
295 >    }
296 >
297 >    void setCOMprops(const Vector3d& COM, const Vector3d& COMvel, const Vector3d& COMw) {
298 >      frameData.COM = COM;
299 >      frameData.COMvel = COMvel;
300 >      frameData.COMw = COMw;
301 >      hasCOM_ = true;
302 >    }
303 >
304 >    DataStorage atomData;
305 >    DataStorage rigidbodyData;
306 >    DataStorage cgData;
307 >    FrameData frameData;
308 >    Stats statData;
309 >
310 >  private:
311 >    RealType orthoTolerance_;
312 >    bool hasCOM_;
313 >    bool hasVolume_;    
314 >  };
315 >
316 >  typedef DataStorage (Snapshot::*DataStoragePointer);
317   }
318   #endif //BRAINS_SNAPSHOT_HPP

Comparing:
trunk/src/brains/Snapshot.hpp (property svn:keywords), Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
branches/development/src/brains/Snapshot.hpp (property svn:keywords), Revision 1715 by gezelter, Tue May 22 21:55:31 2012 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines