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 1774 by gezelter, Wed Aug 8 16:03:02 2012 UTC

# 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 62 | Line 63 | namespace OpenMD{
63      Mat3x3d  hmat;                /**< axes of the periodic box in matrix form */
64      Mat3x3d  invHmat;             /**< the inverse of the Hmat matrix */
65      bool     orthoRhombic;        /**< is this an orthorhombic periodic box? */
65    RealType volume;              /**< total volume of this frame */
66    RealType pressure;            /**< pressure of this frame */
66      RealType totalEnergy;         /**< total energy of this frame */
67 +    RealType translationalKinetic; /**< translational kinetic energy of this frame */
68 +    RealType rotationalKinetic;   /**< rotational kinetic energy of this frame */
69      RealType kineticEnergy;       /**< kinetic energy of this frame */
70      RealType potentialEnergy;     /**< potential energy of this frame */
71      RealType shortRangePotential; /**< short-range contributions to the potential*/
# Line 77 | Line 78 | namespace OpenMD{
78      potVec   excludedPotentials;  /**< breakdown of excluded potentials by family */
79      RealType restraintPotential;  /**< potential energy of restraints */
80      RealType rawPotential;        /**< unrestrained potential energy (when restraints are applied) */
81 +    RealType xyArea;              /**< XY area of this frame */
82 +    RealType volume;              /**< total volume of this frame */
83 +    RealType pressure;            /**< pressure of this frame */
84      RealType temperature;         /**< temperature of this frame */
85 <    RealType chi;                 /**< thermostat velocity */
82 <    RealType integralOfChiDt;     /**< thermostat position */
85 >    pair<RealType, RealType> thermostat;    /**< thermostat variables */
86      RealType electronicTemperature; /**< temperature of the electronic degrees of freedom */
87 <    RealType chiQ;                /**< fluctuating charge thermostat velocity */
88 <    RealType integralOfChiQDt;    /**< fluctuating charge thermostat position */
86 <    Mat3x3d  eta;                 /**< barostat matrix */
87 >    pair<RealType, RealType> electronicThermostat; /**< thermostat variables for electronic degrees of freedom */
88 >    Mat3x3d  barostat;            /**< barostat matrix */
89      Vector3d COM;                 /**< location of system center of mass */
90      Vector3d COMvel;              /**< system center of mass velocity */
91      Vector3d COMw;                /**< system center of mass angular velocity */
92 +    Mat3x3d  inertiaTensor;       /**< inertia tensor for entire system */
93 +    RealType gyrationalVolume;    /**< gyrational volume for entire system */
94 +    RealType hullVolume;          /**< hull volume for entire system */
95      Mat3x3d  stressTensor;        /**< stress tensor */
96      Mat3x3d  pressureTensor;      /**< pressure tensor */
97      Vector3d systemDipole;        /**< total system dipole moment */
98      Vector3d conductiveHeatFlux;  /**< heat flux vector (conductive only) */
99 +    Vector3d convectiveHeatFlux;  /**< heat flux vector (convective only) */
100 +    RealType conservedQuantity;   /**< anything conserved by the integrator */
101    };
102  
103  
# Line 104 | Line 111 | namespace OpenMD{
111    class Snapshot {
112  
113    public:            
114 <    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups) :
115 <      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 <    
114 >    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups);
115 >    Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, int storageLayout);    
116      /** Returns the id of this Snapshot */
117 <    int getID() {
186 <      return frameData.id;
187 <    }
188 <
117 >    int      getID();
118      /** Sets the id of this Snapshot */
119 <    void setID(int id) {
191 <      frameData.id = id;
192 <    }
119 >    void     setID(int id);
120  
121 <    int getSize() {
122 <      return atomData.getSize() + rigidbodyData.getSize();
196 <    }
121 >    /** sets the state of the computed properties to false */
122 >    void     clearDerivedProperties();
123  
124 +    int      getSize();
125      /** Returns the number of atoms */
126 <    int getNumberOfAtoms() {
200 <      return atomData.getSize();
201 <    }
202 <
126 >    int      getNumberOfAtoms();
127      /** Returns the number of rigid bodies */
128 <    int getNumberOfRigidBodies() {
205 <      return rigidbodyData.getSize();
206 <    }
207 <
128 >    int      getNumberOfRigidBodies();
129      /** Returns the number of rigid bodies */
130 <    int getNumberOfCutoffGroups() {
210 <      return cgData.getSize();
211 <    }
130 >    int      getNumberOfCutoffGroups();
131  
132      /** Returns the H-Matrix */
133 <    Mat3x3d getHmat() {
215 <      return frameData.hmat;
216 <    }
217 <
133 >    Mat3x3d  getHmat();
134      /** Sets the H-Matrix */
135 <    void setHmat(const Mat3x3d& m);
135 >    void     setHmat(const Mat3x3d& m);
136 >    /** Returns the inverse H-Matrix */
137 >    Mat3x3d  getInvHmat();
138              
139 <    RealType getVolume() {
140 <      if (!hasVolume_) {
141 <        frameData.volume = frameData.hmat.determinant();
224 <        hasVolume_ = true;
225 <      }
226 <      return frameData.volume;
227 <    }
139 >    RealType getVolume();
140 >    RealType getXYarea();
141 >    void     setVolume(const RealType vol);
142  
229    void setVolume(RealType volume){
230      hasVolume_=true;
231      frameData.volume = volume;
232    }
233
234    /** Returns the inverse H-Matrix */
235    Mat3x3d getInvHmat() {
236      return frameData.invHmat;
237    }
238
143      /** Wrapping the vector according to periodic boundary condition*/
144 <    void wrapVector(Vector3d& v);
144 >    void     wrapVector(Vector3d& v);
145 >
146      /** Scaling a vector to multiples of the periodic box */
147      Vector3d scaleVector(Vector3d &v);
148  
149 +    void     setCOM(const Vector3d &com);
150 +    void     setCOMvel(const Vector3d &comVel);
151 +    void     setCOMw(const Vector3d &comw);
152  
153      Vector3d getCOM();
154      Vector3d getCOMvel();
155      Vector3d getCOMw();
156              
157 <    RealType getTime() {
158 <      return frameData.currentTime;
159 <    }
157 >    RealType getTime();
158 >    void     increaseTime(const RealType dt);
159 >    void     setTime(const RealType time);
160  
161 <    void increaseTime(RealType dt) {
162 <      setTime(getTime() + dt);
163 <    }
161 >    void     setBondPotential(const RealType bp);
162 >    void     setBendPotential(const RealType bp);
163 >    void     setTorsionPotential(const RealType tp);
164 >    void     setInversionPotential(const RealType ip);
165 >    RealType getBondPotential();
166 >    RealType getBendPotential();
167 >    RealType getTorsionPotential();
168 >    RealType getInversionPotential();
169  
170 <    void setTime(RealType time) {
258 <      frameData.currentTime =time;
259 <      //time at statData is redundant
260 <      statData[Stats::TIME] = frameData.currentTime;
261 <    }
170 >    RealType getShortRangePotential();
171  
172 <    void setShortRangePotential(RealType srp) {
173 <      frameData.shortRangePotential = srp;
174 <      hasShortRangePotential_ = true;
266 <      statData[Stats::SHORT_RANGE_POTENTIAL] = frameData.shortRangePotential;
267 <    }
172 >    void     setLongRangePotential(const potVec lrPot);
173 >    RealType getLongRangePotential();
174 >    potVec   getLongRangePotentials();
175  
176 <    RealType getShortRangePotential() {
177 <      return frameData.shortRangePotential;
178 <    }
176 >    void     setExcludedPotentials(const potVec exPot);
177 >    potVec   getExcludedPotentials();
178 >  
179 >    void     setRestraintPotential(const RealType rp);
180 >    RealType getRestraintPotential();
181  
182 <    void setBondPotential(RealType bp) {
183 <      frameData.bondPotential = bp;
275 <      hasBondPotential_ = true;
276 <      statData[Stats::BOND_POTENTIAL] = frameData.bondPotential;
277 <    }
182 >    void     setRawPotential(const RealType rp);
183 >    RealType getRawPotential();
184  
185 <    void setBendPotential(RealType bp) {
186 <      frameData.bendPotential = bp;
187 <      hasBendPotential_ = true;
188 <      statData[Stats::BEND_POTENTIAL] = frameData.bendPotential;
189 <    }
185 >    RealType getPotentialEnergy();
186 >    RealType getKineticEnergy();
187 >    RealType getTranslationalKineticEnergy();
188 >    RealType getRotationalKineticEnergy();
189 >    void     setKineticEnergy(const RealType ke);
190 >    void     setTranslationalKineticEnergy(const RealType tke);
191 >    void     setRotationalKineticEnergy(const RealType rke);
192 >    RealType getTotalEnergy();
193 >    void     setTotalEnergy(const RealType te);
194 >    RealType getConservedQuantity();
195 >    void     setConservedQuantity(const RealType cq);
196 >    RealType getTemperature();
197 >    void     setTemperature(const RealType temp);
198 >    RealType getElectronicTemperature();
199 >    void     setElectronicTemperature(const RealType eTemp);
200 >    RealType getPressure();
201 >    void     setPressure(const RealType pressure);
202  
203 <    void setTorsionPotential(RealType tp) {
204 <      frameData.torsionPotential = tp;
287 <      hasTorsionPotential_ = true;
288 <      statData[Stats::DIHEDRAL_POTENTIAL] = frameData.torsionPotential;
289 <    }
203 >    Mat3x3d  getPressureTensor();
204 >    void     setPressureTensor(const Mat3x3d& pressureTensor);
205  
206 <    void setInversionPotential(RealType ip) {
207 <      frameData.inversionPotential = ip;
293 <      hasInversionPotential_ = true;
294 <      statData[Stats::INVERSION_POTENTIAL] = frameData.inversionPotential;
295 <    }
206 >    Mat3x3d  getStressTensor();
207 >    void     setStressTensor(const Mat3x3d& stressTensor);
208  
209 <    void setLongRangePotential(RealType lrp) {
210 <      frameData.longRangePotential = lrp;
299 <      hasLongRangePotential_ = true;
300 <      statData[Stats::LONG_RANGE_POTENTIAL] = frameData.longRangePotential;
301 <    }
209 >    Vector3d getConductiveHeatFlux();
210 >    void     setConductiveHeatFlux(const Vector3d& chf);
211  
212 <    RealType getLongRangePotential() {
213 <      return frameData.longRangePotential;
305 <    }
212 >    Vector3d getConvectiveHeatFlux();
213 >    void     setConvectiveHeatFlux(const Vector3d& chf);
214  
215 <    void setLongRangePotentialFamilies(potVec lrPot) {
308 <      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 <    }
315 <
316 <    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 <
215 >    Vector3d getHeatFlux();
216      
217 <    void setRestraintPotential(RealType rp) {
218 <      frameData.restraintPotential = rp;
332 <      hasRestraintPotential_ = true;
333 <      statData[Stats::RESTRAINT_POTENTIAL] = frameData.restraintPotential;
334 <    }
217 >    Vector3d getSystemDipole();
218 >    void     setSystemDipole(const Vector3d& bd);
219  
220 <    RealType getRestraintPotential() {
221 <      return frameData.restraintPotential;
338 <    }
220 >    pair<RealType, RealType> getThermostat();
221 >    void setThermostat(const pair<RealType, RealType>& thermostat);
222  
223 <    void setRawPotential(RealType rp) {
224 <      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 <    }
223 >    pair<RealType, RealType> getElectronicThermostat();
224 >    void setElectronicThermostat(const pair<RealType, RealType>& eThermostat);
225              
226 <    RealType getChiElectronic() {
227 <      return frameData.chiQ;
368 <    }
226 >    Mat3x3d  getBarostat();
227 >    void     setBarostat(const Mat3x3d& barostat);
228  
229 <    void setChiElectronic(RealType chiQ) {
230 <      frameData.chiQ = chiQ;
372 <    }
229 >    Mat3x3d  getInertiaTensor();
230 >    void     setInertiaTensor(const Mat3x3d& inertiaTensor);
231  
232 <    RealType getIntegralOfChiElectronicDt() {
233 <      return frameData.integralOfChiQDt;
376 <    }
232 >    RealType getGyrationalVolume();
233 >    void     setGyrationalVolume(const RealType gv);
234  
235 <    void setIntegralOfChiElectronicDt(RealType integralOfChiQDt) {
236 <      frameData.integralOfChiQDt = integralOfChiQDt;
237 <    }
235 >    RealType getHullVolume();
236 >    void     setHullVolume(const RealType hv);
237 >    
238 >    void     setOrthoTolerance(RealType orthoTolerance);
239  
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
240      DataStorage atomData;
241      DataStorage rigidbodyData;
242      DataStorage cgData;
243 <    FrameData frameData;
425 <    Stats statData;
243 >    FrameData   frameData;
244  
245 +    bool hasTotalEnergy;        
246 +    bool hasTranslationalKineticEnergy;    
247 +    bool hasRotationalKineticEnergy;    
248 +    bool hasKineticEnergy;    
249 +    bool hasShortRangePotential;
250 +    bool hasLongRangePotential;
251 +    bool hasPotentialEnergy;    
252 +    bool hasXYarea;
253 +    bool hasVolume;        
254 +    bool hasPressure;      
255 +    bool hasTemperature;    
256 +    bool hasElectronicTemperature;
257 +    bool hasCOM;            
258 +    bool hasCOMvel;
259 +    bool hasCOMw;
260 +    bool hasPressureTensor;    
261 +    bool hasSystemDipole;    
262 +    bool hasConvectiveHeatFlux;
263 +    bool hasInertiaTensor;
264 +    bool hasGyrationalVolume;
265 +    bool hasHullVolume;
266 +    bool hasConservedQuantity;
267 +
268    private:
269      RealType orthoTolerance_;
270 <    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_;
270 >    
271    };
272  
273    typedef DataStorage (Snapshot::*DataStoragePointer);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines