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] Vardeman & Gezelter, in progress (2009). |
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 |
|
/** |
55 |
|
|
56 |
|
#include "brains/DataStorage.hpp" |
57 |
|
#include "brains/Stats.hpp" |
57 |
– |
#include "UseTheForce/DarkSide/simulation_interface.h" |
58 |
|
|
59 |
– |
|
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 stressTensor; /**< stress tensor */ |
83 |
+ |
Mat3x3d pressureTensor; /**< pressure tensor */ |
84 |
+ |
Vector3d systemDipole; /**< total system dipole moment */ |
85 |
+ |
Vector3d conductiveHeatFlux; /**< heat flux vector (conductive only) */ |
86 |
+ |
}; |
87 |
+ |
|
88 |
+ |
|
89 |
|
/** |
90 |
|
* @class Snapshot Snapshot.hpp "brains/Snapshot.hpp" |
91 |
|
* @brief Snapshot class is a repository class for storing dynamic data during |
92 |
|
* Simulation |
93 |
< |
* Every snapshot class will contain one DataStorage for atoms and one DataStorage |
93 |
> |
* Every snapshot class will contain one DataStorage for atoms and one DataStorage |
94 |
|
* for rigid bodies. |
95 |
|
*/ |
96 |
|
class Snapshot { |
97 |
|
public: |
98 |
|
|
99 |
< |
Snapshot(int nAtoms, int nRigidbodies) : atomData(nAtoms), |
100 |
< |
rigidbodyData(nRigidbodies), |
101 |
< |
currentTime_(0), |
102 |
< |
orthoTolerance_(1e-6), |
103 |
< |
orthoRhombic_(0), |
104 |
< |
chi_(0.0), |
105 |
< |
integralOfChiDt_(0.0), |
106 |
< |
eta_(0.0), id_(-1), |
107 |
< |
hasCOM_(false), hasVolume_(false), volume_(0.0) { |
108 |
< |
|
99 |
> |
Snapshot(int nAtoms, int nRigidbodies, |
100 |
> |
int nCutoffGroups) : atomData(nAtoms), |
101 |
> |
rigidbodyData(nRigidbodies), |
102 |
> |
cgData(nCutoffGroups, DataStorage::dslPosition), |
103 |
> |
orthoTolerance_(1e-6), hasCOM_(false), hasVolume_(false){ |
104 |
> |
|
105 |
> |
frameData.id = -1; |
106 |
> |
frameData.currentTime = 0; |
107 |
> |
frameData.hmat = Mat3x3d(0.0); |
108 |
> |
frameData.invHmat = Mat3x3d(0.0); |
109 |
> |
frameData.orthoRhombic = false; |
110 |
> |
frameData.volume = 0.0; |
111 |
> |
frameData.pressure = 0.0; |
112 |
> |
frameData.totalEnergy = 0.0; |
113 |
> |
frameData.kineticEnergy = 0.0; |
114 |
> |
frameData.potentialEnergy = 0.0; |
115 |
> |
frameData.temperature = 0.0; |
116 |
> |
frameData.chi = 0.0; |
117 |
> |
frameData.integralOfChiDt = 0.0; |
118 |
> |
frameData.electronicTemperature = 0.0; |
119 |
> |
frameData.chiQ = 0.0; |
120 |
> |
frameData.integralOfChiQDt = 0.0; |
121 |
> |
frameData.eta = Mat3x3d(0.0); |
122 |
> |
frameData.COM = V3Zero; |
123 |
> |
frameData.COMvel = V3Zero; |
124 |
> |
frameData.COMw = V3Zero; |
125 |
> |
frameData.stressTensor = Mat3x3d(0.0); |
126 |
> |
frameData.pressureTensor = Mat3x3d(0.0); |
127 |
> |
frameData.systemDipole = V3Zero; |
128 |
> |
frameData.conductiveHeatFlux = V3Zero; |
129 |
|
} |
130 |
|
|
131 |
< |
Snapshot(int nAtoms, int nRigidbodies, int storageLayout) |
132 |
< |
: atomData(nAtoms, storageLayout), |
133 |
< |
rigidbodyData(nRigidbodies, storageLayout), |
134 |
< |
currentTime_(0), orthoTolerance_(1e-6), orthoRhombic_(0), chi_(0.0), |
135 |
< |
integralOfChiDt_(0.0), eta_(0.0), id_(-1), hasCOM_(false), hasVolume_(false),volume_(0.0) { |
136 |
< |
|
137 |
< |
} |
138 |
< |
|
131 |
> |
Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, |
132 |
> |
int storageLayout) : atomData(nAtoms, storageLayout), |
133 |
> |
rigidbodyData(nRigidbodies, storageLayout), |
134 |
> |
cgData(nCutoffGroups, DataStorage::dslPosition), |
135 |
> |
orthoTolerance_(1e-6), |
136 |
> |
hasCOM_(false), |
137 |
> |
hasVolume_(false) { |
138 |
> |
frameData.id = -1; |
139 |
> |
frameData.currentTime = 0; |
140 |
> |
frameData.hmat = Mat3x3d(0.0); |
141 |
> |
frameData.invHmat = Mat3x3d(0.0); |
142 |
> |
frameData.orthoRhombic = false; |
143 |
> |
frameData.volume = 0.0; |
144 |
> |
frameData.pressure = 0.0; |
145 |
> |
frameData.totalEnergy = 0.0; |
146 |
> |
frameData.kineticEnergy = 0.0; |
147 |
> |
frameData.potentialEnergy = 0.0; |
148 |
> |
frameData.temperature = 0.0; |
149 |
> |
frameData.chi = 0.0; |
150 |
> |
frameData.integralOfChiDt = 0.0; |
151 |
> |
frameData.electronicTemperature = 0.0; |
152 |
> |
frameData.chiQ = 0.0; |
153 |
> |
frameData.integralOfChiQDt = 0.0; |
154 |
> |
frameData.eta = Mat3x3d(0.0); |
155 |
> |
frameData.COM = V3Zero; |
156 |
> |
frameData.COMvel = V3Zero; |
157 |
> |
frameData.COMw = V3Zero; |
158 |
> |
frameData.stressTensor = Mat3x3d(0.0); |
159 |
> |
frameData.pressureTensor = Mat3x3d(0.0); |
160 |
> |
frameData.systemDipole = V3Zero; |
161 |
> |
frameData.conductiveHeatFlux = V3Zero; |
162 |
> |
} |
163 |
> |
|
164 |
|
/** Returns the id of this Snapshot */ |
165 |
|
int getID() { |
166 |
< |
return id_; |
166 |
> |
return frameData.id; |
167 |
|
} |
168 |
|
|
169 |
|
/** Sets the id of this Snapshot */ |
170 |
|
void setID(int id) { |
171 |
< |
id_ = id; |
171 |
> |
frameData.id = id; |
172 |
|
} |
173 |
|
|
174 |
|
int getSize() { |
183 |
|
/** Returns the number of rigid bodies */ |
184 |
|
int getNumberOfRigidBodies() { |
185 |
|
return rigidbodyData.getSize(); |
186 |
+ |
} |
187 |
+ |
|
188 |
+ |
/** Returns the number of rigid bodies */ |
189 |
+ |
int getNumberOfCutoffGroups() { |
190 |
+ |
return cgData.getSize(); |
191 |
|
} |
192 |
|
|
193 |
|
/** Returns the H-Matrix */ |
194 |
|
Mat3x3d getHmat() { |
195 |
< |
return hmat_; |
195 |
> |
return frameData.hmat; |
196 |
|
} |
197 |
|
|
198 |
|
/** Sets the H-Matrix */ |
200 |
|
|
201 |
|
RealType getVolume() { |
202 |
|
if (hasVolume_){ |
203 |
< |
return volume_; |
203 |
> |
return frameData.volume; |
204 |
|
}else{ |
205 |
< |
return hmat_.determinant(); |
205 |
> |
return frameData.hmat.determinant(); |
206 |
|
} |
207 |
|
} |
208 |
|
|
209 |
|
void setVolume(RealType volume){ |
210 |
|
hasVolume_=true; |
211 |
< |
volume_ = volume; |
211 |
> |
frameData.volume = volume; |
212 |
|
} |
213 |
|
|
214 |
|
/** Returns the inverse H-Matrix */ |
215 |
|
Mat3x3d getInvHmat() { |
216 |
< |
return invHmat_; |
216 |
> |
return frameData.invHmat; |
217 |
|
} |
218 |
|
|
219 |
|
/** Wrapping the vector according to periodic boundary condition*/ |
220 |
|
void wrapVector(Vector3d& v); |
221 |
+ |
/** Scaling a vector to multiples of the periodic box */ |
222 |
+ |
Vector3d scaleVector(Vector3d &v); |
223 |
+ |
|
224 |
+ |
|
225 |
|
Vector3d getCOM(); |
226 |
|
Vector3d getCOMvel(); |
227 |
|
Vector3d getCOMw(); |
228 |
|
|
229 |
|
RealType getTime() { |
230 |
< |
return currentTime_; |
230 |
> |
return frameData.currentTime; |
231 |
|
} |
232 |
|
|
233 |
|
void increaseTime(RealType dt) { |
235 |
|
} |
236 |
|
|
237 |
|
void setTime(RealType time) { |
238 |
< |
currentTime_ =time; |
238 |
> |
frameData.currentTime =time; |
239 |
|
//time at statData is redundant |
240 |
< |
statData[Stats::TIME] = currentTime_; |
240 |
> |
statData[Stats::TIME] = frameData.currentTime; |
241 |
|
} |
242 |
|
|
243 |
|
RealType getChi() { |
244 |
< |
return chi_; |
244 |
> |
return frameData.chi; |
245 |
|
} |
246 |
|
|
247 |
|
void setChi(RealType chi) { |
248 |
< |
chi_ = chi; |
248 |
> |
frameData.chi = chi; |
249 |
|
} |
250 |
|
|
251 |
|
RealType getIntegralOfChiDt() { |
252 |
< |
return integralOfChiDt_; |
252 |
> |
return frameData.integralOfChiDt; |
253 |
|
} |
254 |
|
|
255 |
|
void setIntegralOfChiDt(RealType integralOfChiDt) { |
256 |
< |
integralOfChiDt_ = integralOfChiDt; |
256 |
> |
frameData.integralOfChiDt = integralOfChiDt; |
257 |
|
} |
258 |
|
|
259 |
+ |
RealType getChiElectronic() { |
260 |
+ |
return frameData.chiQ; |
261 |
+ |
} |
262 |
|
|
263 |
+ |
void setChiElectronic(RealType chiQ) { |
264 |
+ |
frameData.chiQ = chiQ; |
265 |
+ |
} |
266 |
+ |
|
267 |
+ |
RealType getIntegralOfChiElectronicDt() { |
268 |
+ |
return frameData.integralOfChiQDt; |
269 |
+ |
} |
270 |
+ |
|
271 |
+ |
void setIntegralOfChiElectronicDt(RealType integralOfChiQDt) { |
272 |
+ |
frameData.integralOfChiQDt = integralOfChiQDt; |
273 |
+ |
} |
274 |
+ |
|
275 |
+ |
|
276 |
|
void setOrthoTolerance(RealType orthoTolerance) { |
277 |
|
orthoTolerance_ = orthoTolerance; |
278 |
|
} |
279 |
|
|
280 |
|
Mat3x3d getEta() { |
281 |
< |
return eta_; |
281 |
> |
return frameData.eta; |
282 |
|
} |
283 |
|
|
284 |
|
void setEta(const Mat3x3d& eta) { |
285 |
< |
eta_ = eta; |
285 |
> |
frameData.eta = eta; |
286 |
|
} |
287 |
|
|
288 |
+ |
Mat3x3d getStressTensor() { |
289 |
+ |
return frameData.stressTensor; |
290 |
+ |
} |
291 |
+ |
|
292 |
+ |
void setStressTensor(const Mat3x3d& stressTensor) { |
293 |
+ |
frameData.stressTensor = stressTensor; |
294 |
+ |
} |
295 |
+ |
|
296 |
+ |
Vector3d getConductiveHeatFlux() { |
297 |
+ |
return frameData.conductiveHeatFlux; |
298 |
+ |
} |
299 |
+ |
|
300 |
+ |
void setConductiveHeatFlux(const Vector3d& heatFlux) { |
301 |
+ |
frameData.conductiveHeatFlux = heatFlux; |
302 |
+ |
} |
303 |
+ |
|
304 |
|
bool hasCOM() { |
305 |
|
return hasCOM_; |
306 |
|
} |
307 |
|
|
308 |
|
void setCOMprops(const Vector3d& COM, const Vector3d& COMvel, const Vector3d& COMw) { |
309 |
< |
COM_ = COM; |
310 |
< |
COMvel_ = COMvel; |
311 |
< |
COMw_ = COMw; |
309 |
> |
frameData.COM = COM; |
310 |
> |
frameData.COMvel = COMvel; |
311 |
> |
frameData.COMw = COMw; |
312 |
|
hasCOM_ = true; |
313 |
|
} |
314 |
< |
|
314 |
> |
|
315 |
|
DataStorage atomData; |
316 |
|
DataStorage rigidbodyData; |
317 |
+ |
DataStorage cgData; |
318 |
+ |
FrameData frameData; |
319 |
|
Stats statData; |
205 |
– |
|
206 |
– |
private: |
207 |
– |
RealType currentTime_; |
320 |
|
|
321 |
< |
Mat3x3d hmat_; |
210 |
< |
Mat3x3d invHmat_; |
321 |
> |
private: |
322 |
|
RealType orthoTolerance_; |
212 |
– |
int orthoRhombic_; |
213 |
– |
RealType volume_; |
214 |
– |
|
215 |
– |
RealType chi_; |
216 |
– |
RealType integralOfChiDt_; |
217 |
– |
Mat3x3d eta_; |
218 |
– |
Vector3d COM_; |
219 |
– |
Vector3d COMvel_; |
220 |
– |
Vector3d COMw_; |
221 |
– |
int id_; /**< identification number of the snapshot */ |
323 |
|
bool hasCOM_; |
324 |
< |
bool hasVolume_; |
224 |
< |
|
324 |
> |
bool hasVolume_; |
325 |
|
}; |
326 |
|
|
327 |
|
typedef DataStorage (Snapshot::*DataStoragePointer); |