| 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; |
| 130 |
|
frameData.pressure = 0.0; |
| 131 |
|
frameData.temperature = 0.0; |
| 132 |
|
frameData.pressureTensor = Mat3x3d(0.0); |
| 133 |
< |
frameData.systemDipole = Vector3d(0.0); |
| 133 |
> |
frameData.systemDipole = Vector3d(0.0); |
| 134 |
> |
frameData.systemQuadrupole = Mat3x3d(0.0); |
| 135 |
|
frameData.convectiveHeatFlux = Vector3d(0.0, 0.0, 0.0); |
| 136 |
|
frameData.electronicTemperature = 0.0; |
| 137 |
|
frameData.COM = V3Zero; |
| 138 |
|
frameData.COMvel = V3Zero; |
| 139 |
< |
frameData.COMw = V3Zero; |
| 139 |
> |
frameData.COMw = V3Zero; |
| 140 |
|
|
| 141 |
|
hasTotalEnergy = false; |
| 142 |
|
hasTranslationalKineticEnergy = false; |
| 155 |
|
hasCOMw = false; |
| 156 |
|
hasPressureTensor = false; |
| 157 |
|
hasSystemDipole = false; |
| 158 |
+ |
hasSystemQuadrupole = false; |
| 159 |
|
hasConvectiveHeatFlux = false; |
| 160 |
|
hasInertiaTensor = false; |
| 161 |
|
hasGyrationalVolume = false; |
| 162 |
|
hasHullVolume = false; |
| 163 |
|
hasConservedQuantity = false; |
| 164 |
+ |
hasBoundingBox = false; |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
/** Returns the id of this Snapshot */ |
| 192 |
|
int Snapshot::getNumberOfCutoffGroups() { |
| 193 |
|
return cgData.getSize(); |
| 194 |
|
} |
| 195 |
+ |
|
| 196 |
+ |
/** Returns the number of bytes in a FrameData structure */ |
| 197 |
+ |
int Snapshot::getFrameDataSize() { |
| 198 |
+ |
return sizeof(FrameData); |
| 199 |
+ |
} |
| 200 |
|
|
| 201 |
|
/** Returns the H-Matrix */ |
| 202 |
|
Mat3x3d Snapshot::getHmat() { |
| 232 |
|
|
| 233 |
|
if( oldOrthoRhombic != frameData.orthoRhombic){ |
| 234 |
|
|
| 235 |
< |
if( frameData.orthoRhombic ) { |
| 236 |
< |
sprintf( painCave.errMsg, |
| 237 |
< |
"OpenMD is switching from the default Non-Orthorhombic\n" |
| 238 |
< |
"\tto the faster Orthorhombic periodic boundary computations.\n" |
| 239 |
< |
"\tThis is usually a good thing, but if you want the\n" |
| 240 |
< |
"\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" |
| 241 |
< |
"\tvariable ( currently set to %G ) smaller.\n", |
| 242 |
< |
orthoTolerance_); |
| 243 |
< |
painCave.severity = OPENMD_INFO; |
| 244 |
< |
simError(); |
| 245 |
< |
} |
| 246 |
< |
else { |
| 247 |
< |
sprintf( painCave.errMsg, |
| 248 |
< |
"OpenMD is switching from the faster Orthorhombic to the more\n" |
| 249 |
< |
"\tflexible Non-Orthorhombic periodic boundary computations.\n" |
| 250 |
< |
"\tThis is usually because the box has deformed under\n" |
| 251 |
< |
"\tNPTf integration. If you want to live on the edge with\n" |
| 252 |
< |
"\tthe Orthorhombic computations, make the orthoBoxTolerance\n" |
| 253 |
< |
"\tvariable ( currently set to %G ) larger.\n", |
| 254 |
< |
orthoTolerance_); |
| 255 |
< |
painCave.severity = OPENMD_WARNING; |
| 256 |
< |
simError(); |
| 257 |
< |
} |
| 235 |
> |
// It is finally time to suppress these warnings once and for |
| 236 |
> |
// all. They were annoying and not very informative. |
| 237 |
> |
|
| 238 |
> |
// if( frameData.orthoRhombic ) { |
| 239 |
> |
// sprintf( painCave.errMsg, |
| 240 |
> |
// "OpenMD is switching from the default Non-Orthorhombic\n" |
| 241 |
> |
// "\tto the faster Orthorhombic periodic boundary computations.\n" |
| 242 |
> |
// "\tThis is usually a good thing, but if you want the\n" |
| 243 |
> |
// "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" |
| 244 |
> |
// "\tvariable ( currently set to %G ) smaller.\n", |
| 245 |
> |
// orthoTolerance_); |
| 246 |
> |
// painCave.severity = OPENMD_INFO; |
| 247 |
> |
// simError(); |
| 248 |
> |
// } |
| 249 |
> |
// else { |
| 250 |
> |
// sprintf( painCave.errMsg, |
| 251 |
> |
// "OpenMD is switching from the faster Orthorhombic to the more\n" |
| 252 |
> |
// "\tflexible Non-Orthorhombic periodic boundary computations.\n" |
| 253 |
> |
// "\tThis is usually because the box has deformed under\n" |
| 254 |
> |
// "\tNPTf integration. If you want to live on the edge with\n" |
| 255 |
> |
// "\tthe Orthorhombic computations, make the orthoBoxTolerance\n" |
| 256 |
> |
// "\tvariable ( currently set to %G ) larger.\n", |
| 257 |
> |
// orthoTolerance_); |
| 258 |
> |
// painCave.severity = OPENMD_WARNING; |
| 259 |
> |
// simError(); |
| 260 |
> |
// } |
| 261 |
|
} |
| 262 |
|
} |
| 263 |
|
|
| 266 |
|
return frameData.invHmat; |
| 267 |
|
} |
| 268 |
|
|
| 269 |
+ |
/** Returns the Bounding Box */ |
| 270 |
+ |
Mat3x3d Snapshot::getBoundingBox() { |
| 271 |
+ |
return frameData.bBox; |
| 272 |
+ |
} |
| 273 |
+ |
|
| 274 |
+ |
/** Sets the Bounding Box */ |
| 275 |
+ |
void Snapshot::setBoundingBox(const Mat3x3d& m) { |
| 276 |
+ |
frameData.bBox = m; |
| 277 |
+ |
frameData.invBbox = frameData.bBox.inverse(); |
| 278 |
+ |
hasBoundingBox = true; |
| 279 |
+ |
} |
| 280 |
+ |
|
| 281 |
+ |
/** Returns the inverse Bounding Box */ |
| 282 |
+ |
Mat3x3d Snapshot::getInvBoundingBox() { |
| 283 |
+ |
return frameData.invBbox; |
| 284 |
+ |
} |
| 285 |
+ |
|
| 286 |
|
RealType Snapshot::getXYarea() { |
| 287 |
|
if (!hasXYarea) { |
| 288 |
|
Vector3d x = frameData.hmat.getColumn(0); |
| 306 |
|
frameData.volume = vol; |
| 307 |
|
} |
| 308 |
|
|
| 309 |
+ |
|
| 310 |
|
/** Wrap a vector according to periodic boundary conditions */ |
| 311 |
|
void Snapshot::wrapVector(Vector3d& pos) { |
| 312 |
|
|
| 313 |
< |
Vector3d scaled = scaleVector(pos); |
| 314 |
< |
|
| 315 |
< |
for (int i = 0; i < 3; i++) |
| 316 |
< |
scaled[i] -= roundMe(scaled[i]); |
| 317 |
< |
|
| 286 |
< |
if( !frameData.orthoRhombic ) |
| 287 |
< |
pos = frameData.hmat * scaled; |
| 288 |
< |
else { |
| 289 |
< |
|
| 313 |
> |
if( !frameData.orthoRhombic ) { |
| 314 |
> |
Vector3d scaled = frameData.invHmat * pos; |
| 315 |
> |
for (int i = 0; i < 3; i++) { |
| 316 |
> |
scaled[i] -= roundMe( scaled[i] ); |
| 317 |
> |
} |
| 318 |
|
// calc the wrapped real coordinates from the wrapped scaled coordinates |
| 319 |
< |
for (int i=0; i<3; i++) { |
| 320 |
< |
pos[i] = scaled[i] * frameData.hmat(i, i); |
| 321 |
< |
} |
| 319 |
> |
pos = frameData.hmat * scaled; |
| 320 |
> |
} else { |
| 321 |
> |
RealType scaled; |
| 322 |
> |
for (int i=0; i<3; i++) { |
| 323 |
> |
scaled = pos[i] * frameData.invHmat(i,i); |
| 324 |
> |
scaled -= roundMe( scaled ); |
| 325 |
> |
pos[i] = scaled * frameData.hmat(i,i); |
| 326 |
> |
} |
| 327 |
|
} |
| 328 |
|
} |
| 329 |
|
|
| 423 |
|
return frameData.shortRangePotential; |
| 424 |
|
} |
| 425 |
|
|
| 426 |
+ |
void Snapshot::setReciprocalPotential(RealType rp){ |
| 427 |
+ |
frameData.reciprocalPotential = rp; |
| 428 |
+ |
} |
| 429 |
+ |
|
| 430 |
+ |
RealType Snapshot::getReciprocalPotential() { |
| 431 |
+ |
return frameData.reciprocalPotential; |
| 432 |
+ |
} |
| 433 |
+ |
|
| 434 |
|
void Snapshot::setLongRangePotential(potVec lrPot) { |
| 435 |
|
frameData.lrPotentials = lrPot; |
| 436 |
|
} |
| 440 |
|
for (int i = 0; i < N_INTERACTION_FAMILIES; i++) { |
| 441 |
|
frameData.longRangePotential += frameData.lrPotentials[i]; |
| 442 |
|
} |
| 443 |
+ |
frameData.longRangePotential += frameData.reciprocalPotential; |
| 444 |
|
hasLongRangePotential = true; |
| 445 |
|
} |
| 446 |
|
return frameData.longRangePotential; |
| 454 |
|
if (!hasPotentialEnergy) { |
| 455 |
|
frameData.potentialEnergy = this->getLongRangePotential(); |
| 456 |
|
frameData.potentialEnergy += this->getShortRangePotential(); |
| 457 |
+ |
frameData.potentialEnergy += this->getRestraintPotential(); |
| 458 |
|
hasPotentialEnergy = true; |
| 459 |
|
} |
| 460 |
|
return frameData.potentialEnergy; |
| 605 |
|
frameData.systemDipole = bd; |
| 606 |
|
} |
| 607 |
|
|
| 608 |
+ |
Mat3x3d Snapshot::getSystemQuadrupole() { |
| 609 |
+ |
return frameData.systemQuadrupole; |
| 610 |
+ |
} |
| 611 |
+ |
|
| 612 |
+ |
void Snapshot::setSystemQuadrupole(const Mat3x3d& bq) { |
| 613 |
+ |
hasSystemQuadrupole = true; |
| 614 |
+ |
frameData.systemQuadrupole = bq; |
| 615 |
+ |
} |
| 616 |
+ |
|
| 617 |
|
void Snapshot::setThermostat(const pair<RealType, RealType>& thermostat) { |
| 618 |
|
frameData.thermostat = thermostat; |
| 619 |
|
} |