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 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
branches/development/src/brains/Snapshot.hpp (file contents), Revision 1715 by gezelter, Tue May 22 21:55:31 2012 UTC

# 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   /**
# 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 +  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 +
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
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 <    Snapshot(int nAtoms, int nRigidbodies) : atomData(nAtoms), rigidbodyData(nRigidbodies),
99 <                                             currentTime_(0), orthoRhombic_(0), chi_(0.0), integralOfChiDt_(0.0), eta_(0.0), id_(-1) {
100 <
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 <    Snapshot(int nAtoms, int nRigidbodies, int storageLayout)
130 <      : atomData(nAtoms, storageLayout), rigidbodyData(nRigidbodies, storageLayout),
131 <        currentTime_(0), orthoRhombic_(0), chi_(0.0), integralOfChiDt_(0.0), eta_(0.0), id_(-1) {
132 <
133 <      }
134 <            
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 id_;
163 >      return frameData.id;
164      }
165  
166      /** Sets the id of this Snapshot */
167      void setID(int id) {
168 <      id_ = id;
168 >      frameData.id = id;
169      }
170  
171      int getSize() {
# Line 103 | Line 182 | namespace oopse{
182        return rigidbodyData.getSize();
183      }
184  
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 hmat_;
192 >      return frameData.hmat;
193      }
194  
195      /** Sets the H-Matrix */
196      void setHmat(const Mat3x3d& m);
197              
198      RealType getVolume() {
199 <      return hmat_.determinant();
199 >      if (hasVolume_){
200 >        return frameData.volume;
201 >      }else{
202 >        return frameData.hmat.determinant();
203 >      }
204      }
205  
206 +    void setVolume(RealType volume){
207 +      hasVolume_=true;
208 +      frameData.volume = volume;
209 +    }
210 +
211      /** Returns the inverse H-Matrix */
212      Mat3x3d getInvHmat() {
213 <      return invHmat_;
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      RealType getTime() {
227 <      return currentTime_;
227 >      return frameData.currentTime;
228      }
229  
230      void increaseTime(RealType dt) {
# Line 133 | Line 232 | namespace oopse{
232      }
233  
234      void setTime(RealType time) {
235 <      currentTime_ =time;
235 >      frameData.currentTime =time;
236        //time at statData is redundant
237 <      statData[Stats::TIME] = currentTime_;
237 >      statData[Stats::TIME] = frameData.currentTime;
238      }
239  
240      RealType getChi() {
241 <      return chi_;
241 >      return frameData.chi;
242      }
243  
244      void setChi(RealType chi) {
245 <      chi_ = chi;
245 >      frameData.chi = chi;
246      }
247  
248      RealType getIntegralOfChiDt() {
249 <      return integralOfChiDt_;
249 >      return frameData.integralOfChiDt;
250      }
251  
252      void setIntegralOfChiDt(RealType integralOfChiDt) {
253 <      integralOfChiDt_ = integralOfChiDt;
253 >      frameData.integralOfChiDt = integralOfChiDt;
254      }
255              
256 +    RealType getChiElectronic() {
257 +      return frameData.chiQ;
258 +    }
259 +
260 +    void setChiElectronic(RealType chiQ) {
261 +      frameData.chiQ = chiQ;
262 +    }
263 +
264 +    RealType getIntegralOfChiElectronicDt() {
265 +      return frameData.integralOfChiQDt;
266 +    }
267 +
268 +    void setIntegralOfChiElectronicDt(RealType integralOfChiQDt) {
269 +      frameData.integralOfChiQDt = integralOfChiQDt;
270 +    }
271 +            
272 +
273 +    void setOrthoTolerance(RealType orthoTolerance) {
274 +      orthoTolerance_ = orthoTolerance;
275 +    }
276 +
277      Mat3x3d getEta() {
278 <      return eta_;
278 >      return frameData.eta;
279      }
280  
281      void setEta(const Mat3x3d& eta) {
282 <      eta_ = eta;
282 >      frameData.eta = eta;
283      }
284 <            
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;
168            
169  private:
170    RealType currentTime_;
309  
310 <    Mat3x3d hmat_;
311 <    Mat3x3d invHmat_;
312 <    int orthoRhombic_;
313 <
176 <    RealType chi_;
177 <    RealType integralOfChiDt_;
178 <    Mat3x3d eta_;
179 <            
180 <    int id_; /**< identification number of the snapshot */
310 >  private:
311 >    RealType orthoTolerance_;
312 >    bool hasCOM_;
313 >    bool hasVolume_;    
314    };
315  
316    typedef DataStorage (Snapshot::*DataStoragePointer);

Comparing:
trunk/src/brains/Snapshot.hpp (property svn:keywords), Revision 963 by tim, Wed May 17 21:51:42 2006 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