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 |
– |
*/ |
50 |
– |
|
43 |
|
#ifndef BRAINS_SNAPSHOT_HPP |
44 |
|
#define BRAINS_SNAPSHOT_HPP |
45 |
|
|
51 |
|
|
52 |
|
namespace OpenMD{ |
53 |
|
|
54 |
+ |
/** |
55 |
+ |
* FrameData is a structure for holding system-wide dynamic data |
56 |
+ |
* about the simulation. |
57 |
+ |
*/ |
58 |
+ |
|
59 |
|
struct FrameData { |
60 |
< |
int id; /**< identification number of the snapshot */ |
61 |
< |
RealType currentTime; /**< current time */ |
62 |
< |
Mat3x3d hmat; /**< axes of the periodic box in matrix form */ |
63 |
< |
Mat3x3d invHmat; /**< the inverse of the Hmat matrix */ |
64 |
< |
bool orthoRhombic; /**< is this an orthorhombic periodic box? */ |
65 |
< |
RealType volume; /**< total volume of this frame */ |
66 |
< |
RealType pressure; /**< pressure of this frame */ |
67 |
< |
RealType totalEnergy; /**< total energy of this frame */ |
68 |
< |
RealType kineticEnergy; /**< kinetic energy of this frame */ |
69 |
< |
RealType potentialEnergy; /**< potential energy of this frame */ |
60 |
> |
int id; /**< identification number of the snapshot */ |
61 |
> |
RealType currentTime; /**< current time */ |
62 |
> |
Mat3x3d hmat; /**< axes of the periodic box in matrix form */ |
63 |
> |
Mat3x3d invHmat; /**< the inverse of the Hmat matrix */ |
64 |
> |
bool orthoRhombic; /**< is this an orthorhombic periodic box? */ |
65 |
> |
RealType volume; /**< total volume of this frame */ |
66 |
> |
RealType pressure; /**< pressure of this frame */ |
67 |
> |
RealType totalEnergy; /**< total energy of this frame */ |
68 |
> |
RealType kineticEnergy; /**< kinetic energy of this frame */ |
69 |
> |
RealType potentialEnergy; /**< potential energy of this frame */ |
70 |
|
RealType shortRangePotential; /**< short-range contributions to the potential*/ |
71 |
< |
RealType longRangePotential; /**< long-range contributions to the potential */ |
72 |
< |
RealType bondPotential; /**< bonded contribution to the potential */ |
73 |
< |
RealType bendPotential; /**< angle-bending contribution to the potential */ |
74 |
< |
RealType torsionPotential; /**< dihedral (torsion angle) contribution to the potential */ |
75 |
< |
RealType inversionPotential; /**< inversion (planarity) contribution to the potential */ |
76 |
< |
potVec lrPotentials; /**< breakdown of long-range potentials by family */ |
77 |
< |
RealType temperature; /**< temperature of this frame */ |
78 |
< |
RealType chi; /**< thermostat velocity */ |
79 |
< |
RealType integralOfChiDt; /**< the actual thermostat */ |
71 |
> |
RealType longRangePotential; /**< long-range contributions to the potential */ |
72 |
> |
RealType bondPotential; /**< bonded contribution to the potential */ |
73 |
> |
RealType bendPotential; /**< angle-bending contribution to the potential */ |
74 |
> |
RealType torsionPotential; /**< dihedral (torsion angle) contribution to the potential */ |
75 |
> |
RealType inversionPotential; /**< inversion (planarity) contribution to the potential */ |
76 |
> |
potVec lrPotentials; /**< breakdown of long-range potentials by family */ |
77 |
> |
potVec excludedPotentials; /**< breakdown of excluded potentials by family */ |
78 |
> |
RealType restraintPotential; /**< potential energy of restraints */ |
79 |
> |
RealType rawPotential; /**< unrestrained potential energy (when restraints are applied) */ |
80 |
> |
RealType temperature; /**< temperature of this frame */ |
81 |
> |
RealType chi; /**< thermostat velocity */ |
82 |
> |
RealType integralOfChiDt; /**< thermostat position */ |
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) */ |
84 |
> |
RealType chiQ; /**< fluctuating charge thermostat velocity */ |
85 |
> |
RealType integralOfChiQDt; /**< fluctuating charge thermostat position */ |
86 |
> |
Mat3x3d eta; /**< barostat matrix */ |
87 |
> |
Vector3d COM; /**< location of system 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 |
100 |
< |
* Simulation |
101 |
< |
* Every snapshot class will contain one DataStorage for atoms and one DataStorage |
102 |
< |
* for rigid bodies. |
98 |
> |
* @class Snapshot |
99 |
> |
* @brief The Snapshot class is a repository storing dynamic data during a |
100 |
> |
* Simulation. Every Snapshot contains FrameData (for global information) |
101 |
> |
* as well as DataStorage (one for Atoms, one for RigidBodies, and one for |
102 |
> |
* CutoffGroups). |
103 |
|
*/ |
104 |
|
class Snapshot { |
105 |
< |
public: |
106 |
< |
|
107 |
< |
Snapshot(int nAtoms, int nRigidbodies, |
108 |
< |
int nCutoffGroups) : atomData(nAtoms), |
109 |
< |
rigidbodyData(nRigidbodies), |
110 |
< |
cgData(nCutoffGroups, DataStorage::dslPosition), |
111 |
< |
orthoTolerance_(1e-6), hasCOM_(false), hasVolume_(false){ |
105 |
> |
|
106 |
> |
public: |
107 |
> |
Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups) : |
108 |
> |
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; |
142 |
|
frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0); |
143 |
|
} |
144 |
|
|
145 |
< |
Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, |
146 |
< |
int storageLayout) : atomData(nAtoms, storageLayout), |
147 |
< |
rigidbodyData(nRigidbodies, storageLayout), |
148 |
< |
cgData(nCutoffGroups, DataStorage::dslPosition), |
149 |
< |
orthoTolerance_(1e-6), |
150 |
< |
hasCOM_(false), |
151 |
< |
hasVolume_(false) { |
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); |
219 |
|
void setHmat(const Mat3x3d& m); |
220 |
|
|
221 |
|
RealType getVolume() { |
222 |
< |
if (hasVolume_){ |
223 |
< |
return frameData.volume; |
224 |
< |
}else{ |
213 |
< |
return frameData.hmat.determinant(); |
222 |
> |
if (!hasVolume_) { |
223 |
> |
frameData.volume = frameData.hmat.determinant(); |
224 |
> |
hasVolume_ = true; |
225 |
|
} |
226 |
+ |
return frameData.volume; |
227 |
|
} |
228 |
|
|
229 |
|
void setVolume(RealType volume){ |
260 |
|
statData[Stats::TIME] = frameData.currentTime; |
261 |
|
} |
262 |
|
|
263 |
+ |
void setShortRangePotential(RealType srp) { |
264 |
+ |
frameData.shortRangePotential = srp; |
265 |
+ |
hasShortRangePotential_ = true; |
266 |
+ |
statData[Stats::SHORT_RANGE_POTENTIAL] = frameData.shortRangePotential; |
267 |
+ |
} |
268 |
+ |
|
269 |
+ |
RealType getShortRangePotential() { |
270 |
+ |
return frameData.shortRangePotential; |
271 |
+ |
} |
272 |
+ |
|
273 |
+ |
void setBondPotential(RealType bp) { |
274 |
+ |
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 |
+ |
} |
284 |
+ |
|
285 |
+ |
void setTorsionPotential(RealType tp) { |
286 |
+ |
frameData.torsionPotential = tp; |
287 |
+ |
hasTorsionPotential_ = true; |
288 |
+ |
statData[Stats::DIHEDRAL_POTENTIAL] = frameData.torsionPotential; |
289 |
+ |
} |
290 |
+ |
|
291 |
+ |
void setInversionPotential(RealType ip) { |
292 |
+ |
frameData.inversionPotential = ip; |
293 |
+ |
hasInversionPotential_ = true; |
294 |
+ |
statData[Stats::INVERSION_POTENTIAL] = frameData.inversionPotential; |
295 |
+ |
} |
296 |
+ |
|
297 |
+ |
void setLongRangePotential(RealType lrp) { |
298 |
+ |
frameData.longRangePotential = lrp; |
299 |
+ |
hasLongRangePotential_ = true; |
300 |
+ |
statData[Stats::LONG_RANGE_POTENTIAL] = frameData.longRangePotential; |
301 |
+ |
} |
302 |
+ |
|
303 |
+ |
RealType getLongRangePotential() { |
304 |
+ |
return frameData.longRangePotential; |
305 |
+ |
} |
306 |
+ |
|
307 |
+ |
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 |
+ |
|
329 |
+ |
|
330 |
+ |
void setRestraintPotential(RealType rp) { |
331 |
+ |
frameData.restraintPotential = rp; |
332 |
+ |
hasRestraintPotential_ = true; |
333 |
+ |
statData[Stats::RESTRAINT_POTENTIAL] = frameData.restraintPotential; |
334 |
+ |
} |
335 |
+ |
|
336 |
+ |
RealType getRestraintPotential() { |
337 |
+ |
return frameData.restraintPotential; |
338 |
+ |
} |
339 |
+ |
|
340 |
+ |
void setRawPotential(RealType rp) { |
341 |
+ |
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 |
|
} |
378 |
|
void setIntegralOfChiElectronicDt(RealType integralOfChiQDt) { |
379 |
|
frameData.integralOfChiQDt = integralOfChiQDt; |
380 |
|
} |
282 |
– |
|
381 |
|
|
382 |
|
void setOrthoTolerance(RealType orthoTolerance) { |
383 |
|
orthoTolerance_ = orthoTolerance; |
428 |
|
RealType orthoTolerance_; |
429 |
|
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_; |
441 |
|
}; |
442 |
|
|
443 |
|
typedef DataStorage (Snapshot::*DataStoragePointer); |