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 |
|
*/ |
44 |
|
* @file Snapshot.cpp |
45 |
|
* @author tlin |
46 |
|
* @date 11/11/2004 |
47 |
– |
* @time 10:56am |
47 |
|
* @version 1.0 |
48 |
|
*/ |
49 |
|
|
70 |
|
frameData.torsionPotential = 0.0; |
71 |
|
frameData.inversionPotential = 0.0; |
72 |
|
frameData.lrPotentials = potVec(0.0); |
73 |
+ |
frameData.reciprocalPotential = 0.0; |
74 |
|
frameData.excludedPotentials = potVec(0.0); |
75 |
|
frameData.restraintPotential = 0.0; |
76 |
|
frameData.rawPotential = 0.0; |
95 |
|
frameData.id = -1; |
96 |
|
frameData.currentTime = 0; |
97 |
|
frameData.hmat = Mat3x3d(0.0); |
98 |
< |
frameData.invHmat = Mat3x3d(0.0); |
98 |
> |
frameData.invHmat = Mat3x3d(0.0); |
99 |
> |
frameData.bBox = Mat3x3d(0.0); |
100 |
> |
frameData.invBbox = Mat3x3d(0.0); |
101 |
|
frameData.orthoRhombic = false; |
102 |
|
frameData.bondPotential = 0.0; |
103 |
|
frameData.bendPotential = 0.0; |
104 |
|
frameData.torsionPotential = 0.0; |
105 |
|
frameData.inversionPotential = 0.0; |
106 |
|
frameData.lrPotentials = potVec(0.0); |
107 |
+ |
frameData.reciprocalPotential = 0.0; |
108 |
|
frameData.excludedPotentials = potVec(0.0); |
109 |
|
frameData.restraintPotential = 0.0; |
110 |
|
frameData.rawPotential = 0.0; |
135 |
|
frameData.electronicTemperature = 0.0; |
136 |
|
frameData.COM = V3Zero; |
137 |
|
frameData.COMvel = V3Zero; |
138 |
< |
frameData.COMw = V3Zero; |
138 |
> |
frameData.COMw = V3Zero; |
139 |
|
|
140 |
|
hasTotalEnergy = false; |
141 |
|
hasTranslationalKineticEnergy = false; |
159 |
|
hasGyrationalVolume = false; |
160 |
|
hasHullVolume = false; |
161 |
|
hasConservedQuantity = false; |
162 |
+ |
hasBoundingBox = false; |
163 |
|
} |
164 |
|
|
165 |
|
/** Returns the id of this Snapshot */ |
190 |
|
int Snapshot::getNumberOfCutoffGroups() { |
191 |
|
return cgData.getSize(); |
192 |
|
} |
193 |
+ |
|
194 |
+ |
/** Returns the number of bytes in a FrameData structure */ |
195 |
+ |
int Snapshot::getFrameDataSize() { |
196 |
+ |
return sizeof(FrameData); |
197 |
+ |
} |
198 |
|
|
199 |
|
/** Returns the H-Matrix */ |
200 |
|
Mat3x3d Snapshot::getHmat() { |
230 |
|
|
231 |
|
if( oldOrthoRhombic != frameData.orthoRhombic){ |
232 |
|
|
233 |
< |
if( frameData.orthoRhombic ) { |
234 |
< |
sprintf( painCave.errMsg, |
235 |
< |
"OpenMD is switching from the default Non-Orthorhombic\n" |
236 |
< |
"\tto the faster Orthorhombic periodic boundary computations.\n" |
237 |
< |
"\tThis is usually a good thing, but if you want the\n" |
238 |
< |
"\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" |
239 |
< |
"\tvariable ( currently set to %G ) smaller.\n", |
240 |
< |
orthoTolerance_); |
241 |
< |
painCave.severity = OPENMD_INFO; |
242 |
< |
simError(); |
243 |
< |
} |
244 |
< |
else { |
245 |
< |
sprintf( painCave.errMsg, |
246 |
< |
"OpenMD is switching from the faster Orthorhombic to the more\n" |
247 |
< |
"\tflexible Non-Orthorhombic periodic boundary computations.\n" |
248 |
< |
"\tThis is usually because the box has deformed under\n" |
249 |
< |
"\tNPTf integration. If you want to live on the edge with\n" |
250 |
< |
"\tthe Orthorhombic computations, make the orthoBoxTolerance\n" |
251 |
< |
"\tvariable ( currently set to %G ) larger.\n", |
252 |
< |
orthoTolerance_); |
253 |
< |
painCave.severity = OPENMD_WARNING; |
254 |
< |
simError(); |
255 |
< |
} |
233 |
> |
// It is finally time to suppress these warnings once and for |
234 |
> |
// all. They were annoying and not very informative. |
235 |
> |
|
236 |
> |
// if( frameData.orthoRhombic ) { |
237 |
> |
// sprintf( painCave.errMsg, |
238 |
> |
// "OpenMD is switching from the default Non-Orthorhombic\n" |
239 |
> |
// "\tto the faster Orthorhombic periodic boundary computations.\n" |
240 |
> |
// "\tThis is usually a good thing, but if you want the\n" |
241 |
> |
// "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" |
242 |
> |
// "\tvariable ( currently set to %G ) smaller.\n", |
243 |
> |
// orthoTolerance_); |
244 |
> |
// painCave.severity = OPENMD_INFO; |
245 |
> |
// simError(); |
246 |
> |
// } |
247 |
> |
// else { |
248 |
> |
// sprintf( painCave.errMsg, |
249 |
> |
// "OpenMD is switching from the faster Orthorhombic to the more\n" |
250 |
> |
// "\tflexible Non-Orthorhombic periodic boundary computations.\n" |
251 |
> |
// "\tThis is usually because the box has deformed under\n" |
252 |
> |
// "\tNPTf integration. If you want to live on the edge with\n" |
253 |
> |
// "\tthe Orthorhombic computations, make the orthoBoxTolerance\n" |
254 |
> |
// "\tvariable ( currently set to %G ) larger.\n", |
255 |
> |
// orthoTolerance_); |
256 |
> |
// painCave.severity = OPENMD_WARNING; |
257 |
> |
// simError(); |
258 |
> |
// } |
259 |
|
} |
260 |
|
} |
261 |
|
|
264 |
|
return frameData.invHmat; |
265 |
|
} |
266 |
|
|
267 |
+ |
/** Returns the Bounding Box */ |
268 |
+ |
Mat3x3d Snapshot::getBoundingBox() { |
269 |
+ |
return frameData.bBox; |
270 |
+ |
} |
271 |
+ |
|
272 |
+ |
/** Sets the Bounding Box */ |
273 |
+ |
void Snapshot::setBoundingBox(const Mat3x3d& m) { |
274 |
+ |
frameData.bBox = m; |
275 |
+ |
frameData.invBbox = frameData.bBox.inverse(); |
276 |
+ |
hasBoundingBox = true; |
277 |
+ |
} |
278 |
+ |
|
279 |
+ |
/** Returns the inverse Bounding Box */ |
280 |
+ |
Mat3x3d Snapshot::getInvBoundingBox() { |
281 |
+ |
return frameData.invBbox; |
282 |
+ |
} |
283 |
+ |
|
284 |
|
RealType Snapshot::getXYarea() { |
285 |
|
if (!hasXYarea) { |
286 |
|
Vector3d x = frameData.hmat.getColumn(0); |
304 |
|
frameData.volume = vol; |
305 |
|
} |
306 |
|
|
307 |
+ |
|
308 |
|
/** Wrap a vector according to periodic boundary conditions */ |
309 |
|
void Snapshot::wrapVector(Vector3d& pos) { |
310 |
|
|
311 |
< |
Vector3d scaled = scaleVector(pos); |
312 |
< |
|
313 |
< |
for (int i = 0; i < 3; i++) |
314 |
< |
scaled[i] -= roundMe(scaled[i]); |
315 |
< |
|
286 |
< |
if( !frameData.orthoRhombic ) |
287 |
< |
pos = frameData.hmat * scaled; |
288 |
< |
else { |
289 |
< |
|
311 |
> |
if( !frameData.orthoRhombic ) { |
312 |
> |
Vector3d scaled = frameData.invHmat * pos; |
313 |
> |
for (int i = 0; i < 3; i++) { |
314 |
> |
scaled[i] -= roundMe( scaled[i] ); |
315 |
> |
} |
316 |
|
// calc the wrapped real coordinates from the wrapped scaled coordinates |
317 |
< |
for (int i=0; i<3; i++) { |
318 |
< |
pos[i] = scaled[i] * frameData.hmat(i, i); |
319 |
< |
} |
317 |
> |
pos = frameData.hmat * scaled; |
318 |
> |
} else { |
319 |
> |
RealType scaled; |
320 |
> |
for (int i=0; i<3; i++) { |
321 |
> |
scaled = pos[i] * frameData.invHmat(i,i); |
322 |
> |
scaled -= roundMe( scaled ); |
323 |
> |
pos[i] = scaled * frameData.hmat(i,i); |
324 |
> |
} |
325 |
|
} |
326 |
|
} |
327 |
|
|
421 |
|
return frameData.shortRangePotential; |
422 |
|
} |
423 |
|
|
424 |
+ |
void Snapshot::setReciprocalPotential(RealType rp){ |
425 |
+ |
frameData.reciprocalPotential = rp; |
426 |
+ |
} |
427 |
+ |
|
428 |
+ |
RealType Snapshot::getReciprocalPotential() { |
429 |
+ |
return frameData.reciprocalPotential; |
430 |
+ |
} |
431 |
+ |
|
432 |
|
void Snapshot::setLongRangePotential(potVec lrPot) { |
433 |
|
frameData.lrPotentials = lrPot; |
434 |
|
} |
438 |
|
for (int i = 0; i < N_INTERACTION_FAMILIES; i++) { |
439 |
|
frameData.longRangePotential += frameData.lrPotentials[i]; |
440 |
|
} |
441 |
+ |
frameData.longRangePotential += frameData.reciprocalPotential; |
442 |
|
hasLongRangePotential = true; |
443 |
|
} |
444 |
|
return frameData.longRangePotential; |