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 1760 by gezelter, Thu Jun 21 19:26:46 2012 UTC vs.
Revision 1858 by gezelter, Wed Apr 3 21:32:13 2013 UTC

# Line 35 | Line 35
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).          
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39   * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40   * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
# Line 49 | Line 49
49   #include "nonbonded/NonBondedInteraction.hpp"
50   #include "brains/Stats.hpp"
51  
52 + using namespace std;
53   namespace OpenMD{
54  
55    /**
# Line 61 | Line 62 | namespace OpenMD{
62      RealType currentTime;         /**< current time */
63      Mat3x3d  hmat;                /**< axes of the periodic box in matrix form */
64      Mat3x3d  invHmat;             /**< the inverse of the Hmat matrix */
65 +    Mat3x3d  bBox;                /**< axes of a bounding box in matrix form */
66 +    Mat3x3d  invBbox;             /**< the inverse of the bounding box */
67      bool     orthoRhombic;        /**< is this an orthorhombic periodic box? */
65    RealType volume;              /**< total volume of this frame */
66    RealType pressure;            /**< pressure of this frame */
68      RealType totalEnergy;         /**< total energy of this frame */
69 +    RealType translationalKinetic; /**< translational kinetic energy of this frame */
70 +    RealType rotationalKinetic;   /**< rotational kinetic 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*/
# Line 77 | Line 80 | namespace OpenMD{
80      potVec   excludedPotentials;  /**< breakdown of excluded potentials by family */
81      RealType restraintPotential;  /**< potential energy of restraints */
82      RealType rawPotential;        /**< unrestrained potential energy (when restraints are applied) */
83 +    RealType xyArea;              /**< XY area of this frame */
84 +    RealType volume;              /**< total volume of this frame */
85 +    RealType pressure;            /**< pressure of this frame */
86      RealType temperature;         /**< temperature of this frame */
87 <    RealType chi;                 /**< thermostat velocity */
82 <    RealType integralOfChiDt;     /**< thermostat position */
87 >    pair<RealType, RealType> thermostat;    /**< thermostat variables */
88      RealType electronicTemperature; /**< temperature of the electronic degrees of freedom */
89 <    RealType chiQ;                /**< fluctuating charge thermostat velocity */
90 <    RealType integralOfChiQDt;    /**< fluctuating charge thermostat position */
86 <    Mat3x3d  eta;                 /**< barostat matrix */
89 >    pair<RealType, RealType> electronicThermostat; /**< thermostat variables for electronic degrees of freedom */
90 >    Mat3x3d  barostat;            /**< barostat matrix */
91      Vector3d COM;                 /**< location of system center of mass */
92      Vector3d COMvel;              /**< system center of mass velocity */
93      Vector3d COMw;                /**< system center of mass angular velocity */
94 +    Mat3x3d  inertiaTensor;       /**< inertia tensor for entire system */
95 +    RealType gyrationalVolume;    /**< gyrational volume for entire system */
96 +    RealType hullVolume;          /**< hull volume for entire system */
97      Mat3x3d  stressTensor;        /**< stress tensor */
98      Mat3x3d  pressureTensor;      /**< pressure tensor */
99      Vector3d systemDipole;        /**< total system dipole moment */
100      Vector3d conductiveHeatFlux;  /**< heat flux vector (conductive only) */
101 +    Vector3d convectiveHeatFlux;  /**< heat flux vector (convective only) */
102 +    RealType conservedQuantity;   /**< anything conserved by the integrator */
103    };
104  
105  
# Line 104 | Line 113 | namespace OpenMD{
113    class Snapshot {
114  
115    public:            
116 <    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups) :
117 <      atomData(nAtoms), rigidbodyData(nRigidbodies),
109 <      cgData(nCutoffGroups, DataStorage::dslPosition),
110 <      orthoTolerance_(1e-6), hasCOM_(false), hasVolume_(false),
111 <      hasShortRangePotential_(false),
112 <      hasBondPotential_(false), hasBendPotential_(false),
113 <      hasTorsionPotential_(false), hasInversionPotential_(false),
114 <      hasLongRangePotential_(false), hasLongRangePotentialFamilies_(false),
115 <      hasRestraintPotential_(false), hasRawPotential_(false),
116 <      hasExcludedPotentials_(false)
117 <    {
118 <      
119 <      frameData.id = -1;                  
120 <      frameData.currentTime = 0;    
121 <      frameData.hmat = Mat3x3d(0.0);            
122 <      frameData.invHmat = Mat3x3d(0.0);          
123 <      frameData.orthoRhombic = false;        
124 <      frameData.volume = 0.0;          
125 <      frameData.pressure = 0.0;        
126 <      frameData.totalEnergy = 0.0;    
127 <      frameData.kineticEnergy = 0.0;  
128 <      frameData.potentialEnergy = 0.0;
129 <      frameData.temperature = 0.0;    
130 <      frameData.chi = 0.0;            
131 <      frameData.integralOfChiDt = 0.0;
132 <      frameData.electronicTemperature = 0.0;
133 <      frameData.chiQ = 0.0;            
134 <      frameData.integralOfChiQDt = 0.0;
135 <      frameData.eta = Mat3x3d(0.0);              
136 <      frameData.COM = V3Zero;            
137 <      frameData.COMvel = V3Zero;          
138 <      frameData.COMw = V3Zero;            
139 <      frameData.stressTensor = Mat3x3d(0.0);              
140 <      frameData.pressureTensor = Mat3x3d(0.0);  
141 <      frameData.systemDipole = Vector3d(0.0);            
142 <      frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0);
143 <    }
144 <
145 <    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, int storageLayout) :
146 <      atomData(nAtoms, storageLayout),
147 <      rigidbodyData(nRigidbodies, storageLayout),
148 <      cgData(nCutoffGroups, DataStorage::dslPosition),
149 <      orthoTolerance_(1e-6), hasCOM_(false), hasVolume_(false),
150 <      hasShortRangePotential_(false),
151 <      hasBondPotential_(false), hasBendPotential_(false),
152 <      hasTorsionPotential_(false), hasInversionPotential_(false),
153 <      hasLongRangePotential_(false), hasLongRangePotentialFamilies_(false),
154 <      hasRestraintPotential_(false), hasRawPotential_(false),
155 <      hasExcludedPotentials_(false)
156 <    {
157 <
158 <      frameData.id = -1;                  
159 <      frameData.currentTime = 0;    
160 <      frameData.hmat = Mat3x3d(0.0);            
161 <      frameData.invHmat = Mat3x3d(0.0);          
162 <      frameData.orthoRhombic = false;        
163 <      frameData.volume = 0.0;          
164 <      frameData.pressure = 0.0;        
165 <      frameData.totalEnergy = 0.0;    
166 <      frameData.kineticEnergy = 0.0;  
167 <      frameData.potentialEnergy = 0.0;
168 <      frameData.temperature = 0.0;    
169 <      frameData.chi = 0.0;            
170 <      frameData.integralOfChiDt = 0.0;
171 <      frameData.electronicTemperature = 0.0;
172 <      frameData.chiQ = 0.0;            
173 <      frameData.integralOfChiQDt = 0.0;
174 <      frameData.eta = Mat3x3d(0.0);              
175 <      frameData.COM = V3Zero;            
176 <      frameData.COMvel = V3Zero;          
177 <      frameData.COMw = V3Zero;            
178 <      frameData.stressTensor = Mat3x3d(0.0);              
179 <      frameData.pressureTensor = Mat3x3d(0.0);  
180 <      frameData.systemDipole = V3Zero;            
181 <      frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0);            
182 <    }
183 <    
116 >    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups);
117 >    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, int storageLayout);    
118      /** Returns the id of this Snapshot */
119 <    int getID() {
186 <      return frameData.id;
187 <    }
188 <
119 >    int      getID();
120      /** Sets the id of this Snapshot */
121 <    void setID(int id) {
191 <      frameData.id = id;
192 <    }
121 >    void     setID(int id);
122  
123 <    int getSize() {
124 <      return atomData.getSize() + rigidbodyData.getSize();
196 <    }
123 >    /** sets the state of the computed properties to false */
124 >    void     clearDerivedProperties();
125  
126 +    int      getSize();
127      /** Returns the number of atoms */
128 <    int getNumberOfAtoms() {
200 <      return atomData.getSize();
201 <    }
202 <
128 >    int      getNumberOfAtoms();
129      /** Returns the number of rigid bodies */
130 <    int getNumberOfRigidBodies() {
205 <      return rigidbodyData.getSize();
206 <    }
207 <
130 >    int      getNumberOfRigidBodies();
131      /** Returns the number of rigid bodies */
132 <    int getNumberOfCutoffGroups() {
210 <      return cgData.getSize();
211 <    }
132 >    int      getNumberOfCutoffGroups();
133  
134      /** Returns the H-Matrix */
135 <    Mat3x3d getHmat() {
215 <      return frameData.hmat;
216 <    }
217 <
135 >    Mat3x3d  getHmat();
136      /** Sets the H-Matrix */
137 <    void setHmat(const Mat3x3d& m);
220 <            
221 <    RealType getVolume() {
222 <      if (!hasVolume_) {
223 <        frameData.volume = frameData.hmat.determinant();
224 <        hasVolume_ = true;
225 <      }
226 <      return frameData.volume;
227 <    }
228 <
229 <    void setVolume(RealType volume){
230 <      hasVolume_=true;
231 <      frameData.volume = volume;
232 <    }
233 <
137 >    void     setHmat(const Mat3x3d& m);
138      /** Returns the inverse H-Matrix */
139 <    Mat3x3d getInvHmat() {
236 <      return frameData.invHmat;
237 <    }
139 >    Mat3x3d  getInvHmat();
140  
141 +    /** Returns the Bounding Box */
142 +    Mat3x3d  getBoundingBox();
143 +    /** Sets the Bounding Box */
144 +    void     setBoundingBox(const Mat3x3d& m);
145 +    /** Returns the inverse Bounding Box*/
146 +    Mat3x3d  getInvBoundingBox();
147 +            
148 +    RealType getVolume();
149 +    RealType getXYarea();
150 +    void     setVolume(const RealType vol);
151 +
152      /** Wrapping the vector according to periodic boundary condition*/
153 <    void wrapVector(Vector3d& v);
153 >    void     wrapVector(Vector3d& v);
154 >
155      /** Scaling a vector to multiples of the periodic box */
156      Vector3d scaleVector(Vector3d &v);
157  
158 +    void     setCOM(const Vector3d &com);
159 +    void     setCOMvel(const Vector3d &comVel);
160 +    void     setCOMw(const Vector3d &comw);
161  
162      Vector3d getCOM();
163      Vector3d getCOMvel();
164      Vector3d getCOMw();
165              
166 <    RealType getTime() {
167 <      return frameData.currentTime;
168 <    }
166 >    RealType getTime();
167 >    void     increaseTime(const RealType dt);
168 >    void     setTime(const RealType time);
169  
170 <    void increaseTime(RealType dt) {
171 <      setTime(getTime() + dt);
172 <    }
170 >    void     setBondPotential(const RealType bp);
171 >    void     setBendPotential(const RealType bp);
172 >    void     setTorsionPotential(const RealType tp);
173 >    void     setInversionPotential(const RealType ip);
174 >    RealType getBondPotential();
175 >    RealType getBendPotential();
176 >    RealType getTorsionPotential();
177 >    RealType getInversionPotential();
178  
179 <    void setTime(RealType time) {
258 <      frameData.currentTime =time;
259 <      //time at statData is redundant
260 <      statData[Stats::TIME] = frameData.currentTime;
261 <    }
179 >    RealType getShortRangePotential();
180  
181 <    void setShortRangePotential(RealType srp) {
182 <      frameData.shortRangePotential = srp;
183 <      hasShortRangePotential_ = true;
266 <      statData[Stats::SHORT_RANGE_POTENTIAL] = frameData.shortRangePotential;
267 <    }
181 >    void     setLongRangePotential(const potVec lrPot);
182 >    RealType getLongRangePotential();
183 >    potVec   getLongRangePotentials();
184  
185 <    RealType getShortRangePotential() {
186 <      return frameData.shortRangePotential;
187 <    }
185 >    void     setExcludedPotentials(const potVec exPot);
186 >    potVec   getExcludedPotentials();
187 >  
188 >    void     setRestraintPotential(const RealType rp);
189 >    RealType getRestraintPotential();
190  
191 <    void setBondPotential(RealType bp) {
192 <      frameData.bondPotential = bp;
275 <      hasBondPotential_ = true;
276 <      statData[Stats::BOND_POTENTIAL] = frameData.bondPotential;
277 <    }
278 <
279 <    void setBendPotential(RealType bp) {
280 <      frameData.bendPotential = bp;
281 <      hasBendPotential_ = true;
282 <      statData[Stats::BEND_POTENTIAL] = frameData.bendPotential;
283 <    }
191 >    void     setRawPotential(const RealType rp);
192 >    RealType getRawPotential();
193  
194 <    void setTorsionPotential(RealType tp) {
195 <      frameData.torsionPotential = tp;
196 <      hasTorsionPotential_ = true;
197 <      statData[Stats::DIHEDRAL_POTENTIAL] = frameData.torsionPotential;
198 <    }
194 >    RealType getPotentialEnergy();
195 >    RealType getKineticEnergy();
196 >    RealType getTranslationalKineticEnergy();
197 >    RealType getRotationalKineticEnergy();
198 >    void     setKineticEnergy(const RealType ke);
199 >    void     setTranslationalKineticEnergy(const RealType tke);
200 >    void     setRotationalKineticEnergy(const RealType rke);
201 >    RealType getTotalEnergy();
202 >    void     setTotalEnergy(const RealType te);
203 >    RealType getConservedQuantity();
204 >    void     setConservedQuantity(const RealType cq);
205 >    RealType getTemperature();
206 >    void     setTemperature(const RealType temp);
207 >    RealType getElectronicTemperature();
208 >    void     setElectronicTemperature(const RealType eTemp);
209 >    RealType getPressure();
210 >    void     setPressure(const RealType pressure);
211  
212 <    void setInversionPotential(RealType ip) {
213 <      frameData.inversionPotential = ip;
293 <      hasInversionPotential_ = true;
294 <      statData[Stats::INVERSION_POTENTIAL] = frameData.inversionPotential;
295 <    }
212 >    Mat3x3d  getPressureTensor();
213 >    void     setPressureTensor(const Mat3x3d& pressureTensor);
214  
215 <    void setLongRangePotential(RealType lrp) {
216 <      frameData.longRangePotential = lrp;
299 <      hasLongRangePotential_ = true;
300 <      statData[Stats::LONG_RANGE_POTENTIAL] = frameData.longRangePotential;
301 <    }
215 >    Mat3x3d  getStressTensor();
216 >    void     setStressTensor(const Mat3x3d& stressTensor);
217  
218 <    RealType getLongRangePotential() {
219 <      return frameData.longRangePotential;
305 <    }
218 >    Vector3d getConductiveHeatFlux();
219 >    void     setConductiveHeatFlux(const Vector3d& chf);
220  
221 <    void setLongRangePotentialFamilies(potVec lrPot) {
222 <      frameData.lrPotentials = lrPot;
309 <      hasLongRangePotentialFamilies_ = true;
310 <      statData[Stats::VANDERWAALS_POTENTIAL] = frameData.lrPotentials[VANDERWAALS_FAMILY];
311 <      statData[Stats::ELECTROSTATIC_POTENTIAL] = frameData.lrPotentials[ELECTROSTATIC_FAMILY];
312 <      statData[Stats::METALLIC_POTENTIAL] = frameData.lrPotentials[METALLIC_FAMILY];
313 <      statData[Stats::HYDROGENBONDING_POTENTIAL] = frameData.lrPotentials[HYDROGENBONDING_FAMILY];
314 <    }
221 >    Vector3d getConvectiveHeatFlux();
222 >    void     setConvectiveHeatFlux(const Vector3d& chf);
223  
224 <    potVec getLongRangePotentials() {
317 <      return frameData.lrPotentials;
318 <    }
319 <
320 <    void setExcludedPotentials(potVec exPot) {
321 <      frameData.excludedPotentials = exPot;
322 <      hasExcludedPotentials_ = true;
323 <    }
324 <
325 <    potVec getExcludedPotentials() {
326 <      return frameData.excludedPotentials;
327 <    }
328 <
224 >    Vector3d getHeatFlux();
225      
226 <    void setRestraintPotential(RealType rp) {
227 <      frameData.restraintPotential = rp;
332 <      hasRestraintPotential_ = true;
333 <      statData[Stats::RESTRAINT_POTENTIAL] = frameData.restraintPotential;
334 <    }
226 >    Vector3d getSystemDipole();
227 >    void     setSystemDipole(const Vector3d& bd);
228  
229 <    RealType getRestraintPotential() {
230 <      return frameData.restraintPotential;
338 <    }
229 >    pair<RealType, RealType> getThermostat();
230 >    void setThermostat(const pair<RealType, RealType>& thermostat);
231  
232 <    void setRawPotential(RealType rp) {
233 <      frameData.rawPotential = rp;
342 <      hasRawPotential_ = true;
343 <      statData[Stats::RAW_POTENTIAL] = frameData.rawPotential;
344 <    }
345 <
346 <    RealType getRawPotential() {
347 <      return frameData.rawPotential;
348 <    }
349 <
350 <    RealType getChi() {
351 <      return frameData.chi;
352 <    }
353 <
354 <    void setChi(RealType chi) {
355 <      frameData.chi = chi;
356 <    }
357 <
358 <    RealType getIntegralOfChiDt() {
359 <      return frameData.integralOfChiDt;
360 <    }
361 <
362 <    void setIntegralOfChiDt(RealType integralOfChiDt) {
363 <      frameData.integralOfChiDt = integralOfChiDt;
364 <    }
232 >    pair<RealType, RealType> getElectronicThermostat();
233 >    void setElectronicThermostat(const pair<RealType, RealType>& eThermostat);
234              
235 <    RealType getChiElectronic() {
236 <      return frameData.chiQ;
368 <    }
235 >    Mat3x3d  getBarostat();
236 >    void     setBarostat(const Mat3x3d& barostat);
237  
238 <    void setChiElectronic(RealType chiQ) {
239 <      frameData.chiQ = chiQ;
372 <    }
238 >    Mat3x3d  getInertiaTensor();
239 >    void     setInertiaTensor(const Mat3x3d& inertiaTensor);
240  
241 <    RealType getIntegralOfChiElectronicDt() {
242 <      return frameData.integralOfChiQDt;
376 <    }
241 >    RealType getGyrationalVolume();
242 >    void     setGyrationalVolume(const RealType gv);
243  
244 <    void setIntegralOfChiElectronicDt(RealType integralOfChiQDt) {
245 <      frameData.integralOfChiQDt = integralOfChiQDt;
246 <    }
244 >    RealType getHullVolume();
245 >    void     setHullVolume(const RealType hv);
246 >    
247 >    void     setOrthoTolerance(RealType orthoTolerance);
248  
382    void setOrthoTolerance(RealType orthoTolerance) {
383      orthoTolerance_ = orthoTolerance;
384    }
385
386    Mat3x3d getEta() {
387      return frameData.eta;
388    }
389
390    void setEta(const Mat3x3d& eta) {
391      frameData.eta = eta;
392    }
393
394    Mat3x3d getStressTensor() {
395      return frameData.stressTensor;
396    }
397        
398    void setStressTensor(const Mat3x3d& stressTensor) {
399      frameData.stressTensor = stressTensor;
400    }
401
402    Vector3d getConductiveHeatFlux() {
403      return frameData.conductiveHeatFlux;
404    }
405        
406    void setConductiveHeatFlux(const Vector3d& heatFlux) {
407      frameData.conductiveHeatFlux = heatFlux;
408    }
409
410    bool hasCOM() {
411      return hasCOM_;
412    }
413
414    void setCOMprops(const Vector3d& COM, const Vector3d& COMvel, const Vector3d& COMw) {
415      frameData.COM = COM;
416      frameData.COMvel = COMvel;
417      frameData.COMw = COMw;
418      hasCOM_ = true;
419    }
420
249      DataStorage atomData;
250      DataStorage rigidbodyData;
251      DataStorage cgData;
252 <    FrameData frameData;
425 <    Stats statData;
252 >    FrameData   frameData;
253  
254 +    bool hasTotalEnergy;        
255 +    bool hasTranslationalKineticEnergy;    
256 +    bool hasRotationalKineticEnergy;    
257 +    bool hasKineticEnergy;    
258 +    bool hasShortRangePotential;
259 +    bool hasLongRangePotential;
260 +    bool hasPotentialEnergy;    
261 +    bool hasXYarea;
262 +    bool hasVolume;        
263 +    bool hasPressure;      
264 +    bool hasTemperature;    
265 +    bool hasElectronicTemperature;
266 +    bool hasCOM;            
267 +    bool hasCOMvel;
268 +    bool hasCOMw;
269 +    bool hasPressureTensor;    
270 +    bool hasSystemDipole;    
271 +    bool hasConvectiveHeatFlux;
272 +    bool hasInertiaTensor;
273 +    bool hasGyrationalVolume;
274 +    bool hasHullVolume;
275 +    bool hasConservedQuantity;
276 +    bool hasBoundingBox;
277 +
278    private:
279      RealType orthoTolerance_;
280 <    bool hasCOM_;
430 <    bool hasVolume_;    
431 <    bool hasShortRangePotential_;
432 <    bool hasBondPotential_;
433 <    bool hasBendPotential_;
434 <    bool hasTorsionPotential_;
435 <    bool hasInversionPotential_;
436 <    bool hasLongRangePotential_;
437 <    bool hasLongRangePotentialFamilies_;
438 <    bool hasRestraintPotential_;
439 <    bool hasRawPotential_;
440 <    bool hasExcludedPotentials_;
280 >    
281    };
282  
283    typedef DataStorage (Snapshot::*DataStoragePointer);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines