| 6 |  | * redistribute this software in source and binary code form, provided | 
| 7 |  | * that the following conditions are met: | 
| 8 |  | * | 
| 9 | < | * 1. Acknowledgement of the program authors must be made in any | 
| 10 | < | *    publication of scientific results based in part on use of the | 
| 11 | < | *    program.  An acceptable form of acknowledgement is citation of | 
| 12 | < | *    the article in which the program was described (Matthew | 
| 13 | < | *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher | 
| 14 | < | *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented | 
| 15 | < | *    Parallel Simulation Engine for Molecular Dynamics," | 
| 16 | < | *    J. Comput. Chem. 26, pp. 252-271 (2005)) | 
| 17 | < | * | 
| 18 | < | * 2. Redistributions of source code must retain the above copyright | 
| 9 | > | * 1. Redistributions of source code must retain the above copyright | 
| 10 |  | *    notice, this list of conditions and the following disclaimer. | 
| 11 |  | * | 
| 12 | < | * 3. Redistributions in binary form must reproduce the above copyright | 
| 12 | > | * 2. Redistributions in binary form must reproduce the above copyright | 
| 13 |  | *    notice, this list of conditions and the following disclaimer in the | 
| 14 |  | *    documentation and/or other materials provided with the | 
| 15 |  | *    distribution. | 
| 28 |  | * arising out of the use of or inability to use software, even if the | 
| 29 |  | * University of Notre Dame has been advised of the possibility of | 
| 30 |  | * such damages. | 
| 31 | + | * | 
| 32 | + | * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your | 
| 33 | + | * research, please cite the appropriate papers when you publish your | 
| 34 | + | * work.  Good starting points are: | 
| 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, 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 |  | */ | 
| 42 |  |  | 
| 43 |  | /** | 
| 44 |  | * @file Snapshot.cpp | 
| 45 |  | * @author tlin | 
| 46 |  | * @date 11/11/2004 | 
| 46 | – | * @time 10:56am | 
| 47 |  | * @version 1.0 | 
| 48 |  | */ | 
| 49 |  |  | 
| 51 |  | #include "utils/NumericConstant.hpp" | 
| 52 |  | #include "utils/simError.h" | 
| 53 |  | #include "utils/Utility.hpp" | 
| 54 | < | namespace oopse { | 
| 54 | > | #include <cstdio> | 
| 55 |  |  | 
| 56 | < | void  Snapshot::setHmat(const Mat3x3d& m) { | 
| 57 | < | hmat_ = m; | 
| 58 | < | invHmat_ = hmat_.inverse(); | 
| 56 | > | namespace OpenMD { | 
| 57 | > |  | 
| 58 | > | Snapshot::Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups) : | 
| 59 | > | atomData(nAtoms), rigidbodyData(nRigidbodies), | 
| 60 | > | cgData(nCutoffGroups, DataStorage::dslPosition), | 
| 61 | > | orthoTolerance_(1e-6) { | 
| 62 |  |  | 
| 63 | < | //prepare fortran Hmat | 
| 64 | < | RealType fortranHmat[9]; | 
| 65 | < | RealType fortranInvHmat[9]; | 
| 66 | < | hmat_.getArray(fortranHmat); | 
| 67 | < | invHmat_.getArray(fortranInvHmat); | 
| 63 | > | frameData.id = -1; | 
| 64 | > | frameData.currentTime = 0; | 
| 65 | > | frameData.hmat = Mat3x3d(0.0); | 
| 66 | > | frameData.invHmat = Mat3x3d(0.0); | 
| 67 | > | frameData.orthoRhombic = false; | 
| 68 | > | frameData.bondPotential = 0.0; | 
| 69 | > | frameData.bendPotential = 0.0; | 
| 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; | 
| 77 | > | frameData.xyArea = 0.0; | 
| 78 | > | frameData.volume = 0.0; | 
| 79 | > | frameData.thermostat = make_pair(0.0, 0.0); | 
| 80 | > | frameData.electronicThermostat = make_pair(0.0, 0.0); | 
| 81 | > | frameData.barostat = Mat3x3d(0.0); | 
| 82 | > | frameData.stressTensor = Mat3x3d(0.0); | 
| 83 | > | frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0); | 
| 84 |  |  | 
| 85 | + | clearDerivedProperties(); | 
| 86 | + | } | 
| 87 | + |  | 
| 88 | + | Snapshot::Snapshot(int nAtoms, int nRigidbodies, int nCutoffGroups, | 
| 89 | + | int storageLayout) : | 
| 90 | + | atomData(nAtoms, storageLayout), | 
| 91 | + | rigidbodyData(nRigidbodies, storageLayout), | 
| 92 | + | cgData(nCutoffGroups, DataStorage::dslPosition), | 
| 93 | + | orthoTolerance_(1e-6) { | 
| 94 | + |  | 
| 95 | + | frameData.id = -1; | 
| 96 | + | frameData.currentTime = 0; | 
| 97 | + | frameData.hmat = 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; | 
| 111 | + | frameData.xyArea = 0.0; | 
| 112 | + | frameData.volume = 0.0; | 
| 113 | + | frameData.thermostat = make_pair(0.0, 0.0); | 
| 114 | + | frameData.electronicThermostat = make_pair(0.0, 0.0); | 
| 115 | + | frameData.barostat = Mat3x3d(0.0); | 
| 116 | + | frameData.stressTensor = Mat3x3d(0.0); | 
| 117 | + | frameData.conductiveHeatFlux = Vector3d(0.0, 0.0, 0.0); | 
| 118 | + |  | 
| 119 | + | clearDerivedProperties(); | 
| 120 | + | } | 
| 121 | + |  | 
| 122 | + | void Snapshot::clearDerivedProperties() { | 
| 123 | + | frameData.totalEnergy = 0.0; | 
| 124 | + | frameData.translationalKinetic = 0.0; | 
| 125 | + | frameData.rotationalKinetic = 0.0; | 
| 126 | + | frameData.kineticEnergy = 0.0; | 
| 127 | + | frameData.potentialEnergy = 0.0; | 
| 128 | + | frameData.shortRangePotential = 0.0; | 
| 129 | + | frameData.longRangePotential = 0.0; | 
| 130 | + | frameData.pressure = 0.0; | 
| 131 | + | frameData.temperature = 0.0; | 
| 132 | + | frameData.pressureTensor = Mat3x3d(0.0); | 
| 133 | + | frameData.systemDipole = Vector3d(0.0); | 
| 134 | + | frameData.convectiveHeatFlux = Vector3d(0.0, 0.0, 0.0); | 
| 135 | + | frameData.electronicTemperature = 0.0; | 
| 136 | + | frameData.COM = V3Zero; | 
| 137 | + | frameData.COMvel = V3Zero; | 
| 138 | + | frameData.COMw = V3Zero; | 
| 139 | + |  | 
| 140 | + | hasTotalEnergy = false; | 
| 141 | + | hasTranslationalKineticEnergy = false; | 
| 142 | + | hasRotationalKineticEnergy = false; | 
| 143 | + | hasKineticEnergy = false; | 
| 144 | + | hasShortRangePotential = false; | 
| 145 | + | hasLongRangePotential = false; | 
| 146 | + | hasPotentialEnergy = false; | 
| 147 | + | hasXYarea = false; | 
| 148 | + | hasVolume = false; | 
| 149 | + | hasPressure = false; | 
| 150 | + | hasTemperature = false; | 
| 151 | + | hasElectronicTemperature = false; | 
| 152 | + | hasCOM = false; | 
| 153 | + | hasCOMvel = false; | 
| 154 | + | hasCOMw = false; | 
| 155 | + | hasPressureTensor = false; | 
| 156 | + | hasSystemDipole = false; | 
| 157 | + | hasConvectiveHeatFlux = false; | 
| 158 | + | hasInertiaTensor = false; | 
| 159 | + | hasGyrationalVolume = false; | 
| 160 | + | hasHullVolume = false; | 
| 161 | + | hasConservedQuantity = false; | 
| 162 | + | hasBoundingBox = false; | 
| 163 | + | } | 
| 164 | + |  | 
| 165 | + | /** Returns the id of this Snapshot */ | 
| 166 | + | int Snapshot::getID() { | 
| 167 | + | return frameData.id; | 
| 168 | + | } | 
| 169 | + |  | 
| 170 | + | /** Sets the id of this Snapshot */ | 
| 171 | + | void Snapshot::setID(int id) { | 
| 172 | + | frameData.id = id; | 
| 173 | + | } | 
| 174 | + |  | 
| 175 | + | int Snapshot::getSize() { | 
| 176 | + | return atomData.getSize() + rigidbodyData.getSize(); | 
| 177 | + | } | 
| 178 | + |  | 
| 179 | + | /** Returns the number of atoms */ | 
| 180 | + | int Snapshot::getNumberOfAtoms() { | 
| 181 | + | return atomData.getSize(); | 
| 182 | + | } | 
| 183 | + |  | 
| 184 | + | /** Returns the number of rigid bodies */ | 
| 185 | + | int Snapshot::getNumberOfRigidBodies() { | 
| 186 | + | return rigidbodyData.getSize(); | 
| 187 | + | } | 
| 188 | + |  | 
| 189 | + | /** Returns the number of rigid bodies */ | 
| 190 | + | int Snapshot::getNumberOfCutoffGroups() { | 
| 191 | + | return cgData.getSize(); | 
| 192 | + | } | 
| 193 | + |  | 
| 194 | + | /** Returns the H-Matrix */ | 
| 195 | + | Mat3x3d Snapshot::getHmat() { | 
| 196 | + | return frameData.hmat; | 
| 197 | + | } | 
| 198 | + |  | 
| 199 | + | /** Sets the H-Matrix */ | 
| 200 | + | void Snapshot::setHmat(const Mat3x3d& m) { | 
| 201 | + | hasVolume = false; | 
| 202 | + | frameData.hmat = m; | 
| 203 | + | frameData.invHmat = frameData.hmat.inverse(); | 
| 204 | + |  | 
| 205 |  | //determine whether the box is orthoTolerance or not | 
| 206 | < | int oldOrthoRhombic = orthoRhombic_; | 
| 206 | > | bool oldOrthoRhombic = frameData.orthoRhombic; | 
| 207 |  |  | 
| 208 | < | RealType smallDiag = fabs(hmat_(0, 0)); | 
| 209 | < | if(smallDiag > fabs(hmat_(1, 1))) smallDiag = fabs(hmat_(1, 1)); | 
| 210 | < | if(smallDiag > fabs(hmat_(2, 2))) smallDiag = fabs(hmat_(2, 2)); | 
| 208 | > | RealType smallDiag = fabs(frameData.hmat(0, 0)); | 
| 209 | > | if(smallDiag > fabs(frameData.hmat(1, 1))) smallDiag = fabs(frameData.hmat(1, 1)); | 
| 210 | > | if(smallDiag > fabs(frameData.hmat(2, 2))) smallDiag = fabs(frameData.hmat(2, 2)); | 
| 211 |  | RealType tol = smallDiag * orthoTolerance_; | 
| 212 |  |  | 
| 213 | < | orthoRhombic_ = 1; | 
| 213 | > | frameData.orthoRhombic = true; | 
| 214 |  |  | 
| 215 |  | for (int i = 0; i < 3; i++ ) { | 
| 216 |  | for (int j = 0 ; j < 3; j++) { | 
| 217 |  | if (i != j) { | 
| 218 | < | if (orthoRhombic_) { | 
| 219 | < | if ( fabs(hmat_(i, j)) >= tol) | 
| 220 | < | orthoRhombic_ = 0; | 
| 218 | > | if (frameData.orthoRhombic) { | 
| 219 | > | if ( fabs(frameData.hmat(i, j)) >= tol) | 
| 220 | > | frameData.orthoRhombic = false; | 
| 221 |  | } | 
| 222 |  | } | 
| 223 |  | } | 
| 224 |  | } | 
| 225 | + |  | 
| 226 | + | if( oldOrthoRhombic != frameData.orthoRhombic){ | 
| 227 | + |  | 
| 228 | + | // It is finally time to suppress these warnings once and for | 
| 229 | + | // all.  They were annoying and not very informative. | 
| 230 |  |  | 
| 231 | < | if( oldOrthoRhombic != orthoRhombic_ ){ | 
| 232 | < |  | 
| 233 | < | if( orthoRhombic_ ) { | 
| 234 | < | sprintf( painCave.errMsg, | 
| 235 | < | "OOPSE 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 = OOPSE_INFO; | 
| 242 | < | simError(); | 
| 243 | < | } | 
| 244 | < | else { | 
| 245 | < | sprintf( painCave.errMsg, | 
| 246 | < | "OOPSE 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 = OOPSE_WARNING; | 
| 110 | < | simError(); | 
| 111 | < | } | 
| 231 | > | // if( frameData.orthoRhombic ) { | 
| 232 | > | //   sprintf( painCave.errMsg, | 
| 233 | > | //         "OpenMD is switching from the default Non-Orthorhombic\n" | 
| 234 | > | //         "\tto the faster Orthorhombic periodic boundary computations.\n" | 
| 235 | > | //         "\tThis is usually a good thing, but if you want the\n" | 
| 236 | > | //         "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" | 
| 237 | > | //         "\tvariable ( currently set to %G ) smaller.\n", | 
| 238 | > | //         orthoTolerance_); | 
| 239 | > | //   painCave.severity = OPENMD_INFO; | 
| 240 | > | //   simError(); | 
| 241 | > | // } | 
| 242 | > | // else { | 
| 243 | > | //   sprintf( painCave.errMsg, | 
| 244 | > | //         "OpenMD is switching from the faster Orthorhombic to the more\n" | 
| 245 | > | //         "\tflexible Non-Orthorhombic periodic boundary computations.\n" | 
| 246 | > | //         "\tThis is usually because the box has deformed under\n" | 
| 247 | > | //         "\tNPTf integration. If you want to live on the edge with\n" | 
| 248 | > | //         "\tthe Orthorhombic computations, make the orthoBoxTolerance\n" | 
| 249 | > | //         "\tvariable ( currently set to %G ) larger.\n", | 
| 250 | > | //         orthoTolerance_); | 
| 251 | > | //   painCave.severity = OPENMD_WARNING; | 
| 252 | > | //   simError(); | 
| 253 | > | // } | 
| 254 |  | } | 
| 255 | + | } | 
| 256 | + |  | 
| 257 | + | /** Returns the inverse H-Matrix */ | 
| 258 | + | Mat3x3d Snapshot::getInvHmat() { | 
| 259 | + | return frameData.invHmat; | 
| 260 | + | } | 
| 261 |  |  | 
| 262 | < | //notify fortran simulation box has changed | 
| 263 | < | setFortranBox(fortranHmat, fortranInvHmat, &orthoRhombic_); | 
| 262 | > | /** Returns the Bounding Box */ | 
| 263 | > | Mat3x3d Snapshot::getBoundingBox() { | 
| 264 | > | return frameData.bBox; | 
| 265 |  | } | 
| 266 |  |  | 
| 267 | + | /** Sets the Bounding Box */ | 
| 268 | + | void Snapshot::setBoundingBox(const Mat3x3d& m) { | 
| 269 | + | frameData.bBox = m; | 
| 270 | + | frameData.invBbox = frameData.bBox.inverse(); | 
| 271 | + | hasBoundingBox = true; | 
| 272 | + | } | 
| 273 |  |  | 
| 274 | < | void Snapshot::wrapVector(Vector3d& pos) { | 
| 274 | > | /** Returns the inverse Bounding Box */ | 
| 275 | > | Mat3x3d Snapshot::getInvBoundingBox() { | 
| 276 | > | return frameData.invBbox; | 
| 277 | > | } | 
| 278 |  |  | 
| 279 | < | int i; | 
| 280 | < | Vector3d scaled; | 
| 279 | > | RealType Snapshot::getXYarea() { | 
| 280 | > | if (!hasXYarea) { | 
| 281 | > | Vector3d x = frameData.hmat.getColumn(0); | 
| 282 | > | Vector3d y = frameData.hmat.getColumn(1); | 
| 283 | > | frameData.xyArea = cross(x,y).length(); | 
| 284 | > | hasXYarea = true; | 
| 285 | > | } | 
| 286 | > | return frameData.xyArea; | 
| 287 | > | } | 
| 288 |  |  | 
| 289 | < | if( !orthoRhombic_ ){ | 
| 289 | > | RealType Snapshot::getVolume() { | 
| 290 | > | if (!hasVolume) { | 
| 291 | > | frameData.volume = frameData.hmat.determinant(); | 
| 292 | > | hasVolume = true; | 
| 293 | > | } | 
| 294 | > | return frameData.volume; | 
| 295 | > | } | 
| 296 |  |  | 
| 297 | < | // calc the scaled coordinates. | 
| 298 | < | scaled = invHmat_* pos; | 
| 297 | > | void Snapshot::setVolume(RealType vol) { | 
| 298 | > | hasVolume = true; | 
| 299 | > | frameData.volume = vol; | 
| 300 | > | } | 
| 301 |  |  | 
| 129 | – | // wrap the scaled coordinates | 
| 130 | – | for (i = 0; i < 3; ++i) { | 
| 131 | – | scaled[i] -= roundMe(scaled[i]); | 
| 132 | – | } | 
| 302 |  |  | 
| 303 | + | /** Wrap a vector according to periodic boundary conditions */ | 
| 304 | + | void Snapshot::wrapVector(Vector3d& pos) { | 
| 305 | + |  | 
| 306 | + | if( !frameData.orthoRhombic ) { | 
| 307 | + | Vector3d scaled = frameData.invHmat * pos; | 
| 308 | + | for (int i = 0; i < 3; i++) { | 
| 309 | + | scaled[i] -= roundMe( scaled[i] ); | 
| 310 | + | } | 
| 311 |  | // calc the wrapped real coordinates from the wrapped scaled coordinates | 
| 312 | < | pos = hmat_ * scaled; | 
| 312 | > | pos = frameData.hmat * scaled; | 
| 313 | > | } else { | 
| 314 | > | RealType scaled; | 
| 315 | > | for (int i=0; i<3; i++) { | 
| 316 | > | scaled = pos[i] * frameData.invHmat(i,i); | 
| 317 | > | scaled -= roundMe( scaled ); | 
| 318 | > | pos[i] = scaled * frameData.hmat(i,i); | 
| 319 | > | } | 
| 320 | > | } | 
| 321 | > | } | 
| 322 |  |  | 
| 323 | < | } else {//if it is orthoRhombic, we could improve efficiency by only caculating the diagonal element | 
| 323 | > | /** Scaling a vector to multiples of the periodic box */ | 
| 324 | > | inline Vector3d Snapshot::scaleVector(Vector3d& pos) { | 
| 325 |  |  | 
| 326 | + | Vector3d scaled; | 
| 327 | + |  | 
| 328 | + | if( !frameData.orthoRhombic ) | 
| 329 | + | scaled = frameData.invHmat * pos; | 
| 330 | + | else { | 
| 331 |  | // calc the scaled coordinates. | 
| 332 | < | for (i=0; i<3; i++) { | 
| 333 | < | scaled[i] = pos[i] * invHmat_(i, i); | 
| 334 | < | } | 
| 143 | < |  | 
| 144 | < | // wrap the scaled coordinates | 
| 145 | < | for (i = 0; i < 3; ++i) { | 
| 146 | < | scaled[i] -= roundMe(scaled[i]); | 
| 147 | < | } | 
| 332 | > | for (int i=0; i<3; i++) | 
| 333 | > | scaled[i] = pos[i] * frameData.invHmat(i, i); | 
| 334 | > | } | 
| 335 |  |  | 
| 336 | < | // calc the wrapped real coordinates from the wrapped scaled coordinates | 
| 337 | < | for (i=0; i<3; i++) { | 
| 338 | < | pos[i] = scaled[i] * hmat_(i, i); | 
| 336 | > | return scaled; | 
| 337 | > | } | 
| 338 | > |  | 
| 339 | > | void Snapshot::setCOM(const Vector3d& com) { | 
| 340 | > | frameData.COM = com; | 
| 341 | > | hasCOM = true; | 
| 342 | > | } | 
| 343 | > |  | 
| 344 | > | void Snapshot::setCOMvel(const Vector3d& comVel) { | 
| 345 | > | frameData.COMvel = comVel; | 
| 346 | > | hasCOMvel = true; | 
| 347 | > | } | 
| 348 | > |  | 
| 349 | > | void Snapshot::setCOMw(const Vector3d& comw) { | 
| 350 | > | frameData.COMw = comw; | 
| 351 | > | hasCOMw = true; | 
| 352 | > | } | 
| 353 | > |  | 
| 354 | > | Vector3d Snapshot::getCOM() { | 
| 355 | > | return frameData.COM; | 
| 356 | > | } | 
| 357 | > |  | 
| 358 | > | Vector3d Snapshot::getCOMvel() { | 
| 359 | > | return frameData.COMvel; | 
| 360 | > | } | 
| 361 | > |  | 
| 362 | > | Vector3d Snapshot::getCOMw() { | 
| 363 | > | return frameData.COMw; | 
| 364 | > | } | 
| 365 | > |  | 
| 366 | > | RealType Snapshot::getTime() { | 
| 367 | > | return frameData.currentTime; | 
| 368 | > | } | 
| 369 | > |  | 
| 370 | > | void Snapshot::increaseTime(RealType dt) { | 
| 371 | > | setTime(getTime() + dt); | 
| 372 | > | } | 
| 373 | > |  | 
| 374 | > | void Snapshot::setTime(RealType time) { | 
| 375 | > | frameData.currentTime = time; | 
| 376 | > | } | 
| 377 | > |  | 
| 378 | > | void Snapshot::setBondPotential(RealType bp) { | 
| 379 | > | frameData.bondPotential = bp; | 
| 380 | > | } | 
| 381 | > |  | 
| 382 | > | void Snapshot::setBendPotential(RealType bp) { | 
| 383 | > | frameData.bendPotential = bp; | 
| 384 | > | } | 
| 385 | > |  | 
| 386 | > | void Snapshot::setTorsionPotential(RealType tp) { | 
| 387 | > | frameData.torsionPotential = tp; | 
| 388 | > | } | 
| 389 | > |  | 
| 390 | > | void Snapshot::setInversionPotential(RealType ip) { | 
| 391 | > | frameData.inversionPotential = ip; | 
| 392 | > | } | 
| 393 | > |  | 
| 394 | > |  | 
| 395 | > | RealType Snapshot::getBondPotential() { | 
| 396 | > | return frameData.bondPotential; | 
| 397 | > | } | 
| 398 | > | RealType Snapshot::getBendPotential() { | 
| 399 | > | return frameData.bendPotential; | 
| 400 | > | } | 
| 401 | > | RealType Snapshot::getTorsionPotential() { | 
| 402 | > | return frameData.torsionPotential; | 
| 403 | > | } | 
| 404 | > | RealType Snapshot::getInversionPotential() { | 
| 405 | > | return frameData.inversionPotential; | 
| 406 | > | } | 
| 407 | > |  | 
| 408 | > | RealType Snapshot::getShortRangePotential() { | 
| 409 | > | if (!hasShortRangePotential) { | 
| 410 | > | frameData.shortRangePotential = frameData.bondPotential; | 
| 411 | > | frameData.shortRangePotential += frameData.bendPotential; | 
| 412 | > | frameData.shortRangePotential += frameData.torsionPotential; | 
| 413 | > | frameData.shortRangePotential += frameData.inversionPotential; | 
| 414 | > | hasShortRangePotential = true; | 
| 415 | > | } | 
| 416 | > | return frameData.shortRangePotential; | 
| 417 | > | } | 
| 418 | > |  | 
| 419 | > | void Snapshot::setReciprocalPotential(RealType rp){ | 
| 420 | > | frameData.reciprocalPotential = rp; | 
| 421 | > | } | 
| 422 | > |  | 
| 423 | > | RealType Snapshot::getReciprocalPotential() { | 
| 424 | > | return frameData.reciprocalPotential; | 
| 425 | > | } | 
| 426 | > |  | 
| 427 | > | void Snapshot::setLongRangePotential(potVec lrPot) { | 
| 428 | > | frameData.lrPotentials = lrPot; | 
| 429 | > | } | 
| 430 | > |  | 
| 431 | > | RealType Snapshot::getLongRangePotential() { | 
| 432 | > | if (!hasLongRangePotential) { | 
| 433 | > | for (int i = 0; i < N_INTERACTION_FAMILIES; i++) { | 
| 434 | > | frameData.longRangePotential += frameData.lrPotentials[i]; | 
| 435 |  | } | 
| 436 | < |  | 
| 436 | > | frameData.longRangePotential += frameData.reciprocalPotential; | 
| 437 | > | hasLongRangePotential = true; | 
| 438 | > | } | 
| 439 | > | return frameData.longRangePotential; | 
| 440 | > | } | 
| 441 | > |  | 
| 442 | > | potVec Snapshot::getLongRangePotentials() { | 
| 443 | > | return frameData.lrPotentials; | 
| 444 | > | } | 
| 445 | > |  | 
| 446 | > | RealType Snapshot::getPotentialEnergy() { | 
| 447 | > | if (!hasPotentialEnergy) { | 
| 448 | > | frameData.potentialEnergy = this->getLongRangePotential(); | 
| 449 | > | frameData.potentialEnergy += this->getShortRangePotential(); | 
| 450 | > | hasPotentialEnergy = true; | 
| 451 |  | } | 
| 452 | + | return frameData.potentialEnergy; | 
| 453 | + | } | 
| 454 | + |  | 
| 455 | + | void Snapshot::setExcludedPotentials(potVec exPot) { | 
| 456 | + | frameData.excludedPotentials = exPot; | 
| 457 | + | } | 
| 458 |  |  | 
| 459 | + | potVec Snapshot::getExcludedPotentials() { | 
| 460 | + | return frameData.excludedPotentials; | 
| 461 |  | } | 
| 462 | + |  | 
| 463 | + | void Snapshot::setRestraintPotential(RealType rp) { | 
| 464 | + | frameData.restraintPotential = rp; | 
| 465 | + | } | 
| 466 | + |  | 
| 467 | + | RealType Snapshot::getRestraintPotential() { | 
| 468 | + | return frameData.restraintPotential; | 
| 469 | + | } | 
| 470 | + |  | 
| 471 | + | void Snapshot::setRawPotential(RealType rp) { | 
| 472 | + | frameData.rawPotential = rp; | 
| 473 | + | } | 
| 474 | + |  | 
| 475 | + | RealType Snapshot::getRawPotential() { | 
| 476 | + | return frameData.rawPotential; | 
| 477 | + | } | 
| 478 |  |  | 
| 479 | < | } | 
| 479 | > | RealType Snapshot::getTranslationalKineticEnergy() { | 
| 480 | > | return frameData.translationalKinetic; | 
| 481 | > | } | 
| 482 | > |  | 
| 483 | > | RealType Snapshot::getRotationalKineticEnergy() { | 
| 484 | > | return frameData.rotationalKinetic; | 
| 485 | > | } | 
| 486 | > |  | 
| 487 | > | RealType Snapshot::getKineticEnergy() { | 
| 488 | > | return frameData.kineticEnergy; | 
| 489 | > | } | 
| 490 | > |  | 
| 491 | > | void Snapshot::setTranslationalKineticEnergy(RealType tke) { | 
| 492 | > | hasTranslationalKineticEnergy = true; | 
| 493 | > | frameData.translationalKinetic = tke; | 
| 494 | > | } | 
| 495 | > |  | 
| 496 | > | void Snapshot::setRotationalKineticEnergy(RealType rke) { | 
| 497 | > | hasRotationalKineticEnergy = true; | 
| 498 | > | frameData.rotationalKinetic = rke; | 
| 499 | > | } | 
| 500 | > |  | 
| 501 | > | void Snapshot::setKineticEnergy(RealType ke) { | 
| 502 | > | hasKineticEnergy = true; | 
| 503 | > | frameData.kineticEnergy = ke; | 
| 504 | > | } | 
| 505 | > |  | 
| 506 | > | RealType Snapshot::getTotalEnergy() { | 
| 507 | > | return frameData.totalEnergy; | 
| 508 | > | } | 
| 509 | > |  | 
| 510 | > | void Snapshot::setTotalEnergy(RealType te) { | 
| 511 | > | hasTotalEnergy = true; | 
| 512 | > | frameData.totalEnergy = te; | 
| 513 | > | } | 
| 514 | > |  | 
| 515 | > | RealType Snapshot::getConservedQuantity() { | 
| 516 | > | return frameData.conservedQuantity; | 
| 517 | > | } | 
| 518 | > |  | 
| 519 | > | void Snapshot::setConservedQuantity(RealType cq) { | 
| 520 | > | hasConservedQuantity = true; | 
| 521 | > | frameData.conservedQuantity = cq; | 
| 522 | > | } | 
| 523 | > |  | 
| 524 | > | RealType Snapshot::getTemperature() { | 
| 525 | > | return frameData.temperature; | 
| 526 | > | } | 
| 527 | > |  | 
| 528 | > | void Snapshot::setTemperature(RealType temp) { | 
| 529 | > | hasTemperature = true; | 
| 530 | > | frameData.temperature = temp; | 
| 531 | > | } | 
| 532 | > |  | 
| 533 | > | RealType Snapshot::getElectronicTemperature() { | 
| 534 | > | return frameData.electronicTemperature; | 
| 535 | > | } | 
| 536 | > |  | 
| 537 | > | void Snapshot::setElectronicTemperature(RealType eTemp) { | 
| 538 | > | hasElectronicTemperature = true; | 
| 539 | > | frameData.electronicTemperature = eTemp; | 
| 540 | > | } | 
| 541 | > |  | 
| 542 | > | RealType Snapshot::getPressure() { | 
| 543 | > | return frameData.pressure; | 
| 544 | > | } | 
| 545 | > |  | 
| 546 | > | void Snapshot::setPressure(RealType pressure) { | 
| 547 | > | hasPressure = true; | 
| 548 | > | frameData.pressure = pressure; | 
| 549 | > | } | 
| 550 | > |  | 
| 551 | > | Mat3x3d Snapshot::getPressureTensor() { | 
| 552 | > | return frameData.pressureTensor; | 
| 553 | > | } | 
| 554 | > |  | 
| 555 | > |  | 
| 556 | > | void Snapshot::setPressureTensor(const Mat3x3d& pressureTensor) { | 
| 557 | > | hasPressureTensor = true; | 
| 558 | > | frameData.pressureTensor = pressureTensor; | 
| 559 | > | } | 
| 560 | > |  | 
| 561 | > | void Snapshot::setStressTensor(const Mat3x3d& stressTensor) { | 
| 562 | > | frameData.stressTensor = stressTensor; | 
| 563 | > | } | 
| 564 | > |  | 
| 565 | > | Mat3x3d  Snapshot::getStressTensor() { | 
| 566 | > | return frameData.stressTensor; | 
| 567 | > | } | 
| 568 | > |  | 
| 569 | > | void Snapshot::setConductiveHeatFlux(const Vector3d& chf) { | 
| 570 | > | frameData.conductiveHeatFlux = chf; | 
| 571 | > | } | 
| 572 | > |  | 
| 573 | > | Vector3d Snapshot::getConductiveHeatFlux() { | 
| 574 | > | return frameData.conductiveHeatFlux; | 
| 575 | > | } | 
| 576 |  |  | 
| 577 | + | Vector3d Snapshot::getConvectiveHeatFlux() { | 
| 578 | + | return frameData.convectiveHeatFlux; | 
| 579 | + | } | 
| 580 | + |  | 
| 581 | + | void Snapshot::setConvectiveHeatFlux(const Vector3d& chf) { | 
| 582 | + | hasConvectiveHeatFlux = true; | 
| 583 | + | frameData.convectiveHeatFlux = chf; | 
| 584 | + | } | 
| 585 | + |  | 
| 586 | + | Vector3d Snapshot::getHeatFlux() { | 
| 587 | + | // BE CAREFUL WITH UNITS | 
| 588 | + | return getConductiveHeatFlux() + getConvectiveHeatFlux(); | 
| 589 | + | } | 
| 590 | + |  | 
| 591 | + | Vector3d Snapshot::getSystemDipole() { | 
| 592 | + | return frameData.systemDipole; | 
| 593 | + | } | 
| 594 | + |  | 
| 595 | + | void Snapshot::setSystemDipole(const Vector3d& bd) { | 
| 596 | + | hasSystemDipole = true; | 
| 597 | + | frameData.systemDipole = bd; | 
| 598 | + | } | 
| 599 | + |  | 
| 600 | + | void Snapshot::setThermostat(const pair<RealType, RealType>& thermostat) { | 
| 601 | + | frameData.thermostat = thermostat; | 
| 602 | + | } | 
| 603 | + |  | 
| 604 | + | pair<RealType, RealType> Snapshot::getThermostat() { | 
| 605 | + | return frameData.thermostat; | 
| 606 | + | } | 
| 607 | + |  | 
| 608 | + | void Snapshot::setElectronicThermostat(const pair<RealType, RealType>& eTherm) { | 
| 609 | + | frameData.electronicThermostat = eTherm; | 
| 610 | + | } | 
| 611 | + |  | 
| 612 | + | pair<RealType, RealType> Snapshot::getElectronicThermostat() { | 
| 613 | + | return frameData.electronicThermostat; | 
| 614 | + | } | 
| 615 | + |  | 
| 616 | + | void Snapshot::setBarostat(const Mat3x3d& barostat) { | 
| 617 | + | frameData.barostat = barostat; | 
| 618 | + | } | 
| 619 | + |  | 
| 620 | + | Mat3x3d Snapshot::getBarostat() { | 
| 621 | + | return frameData.barostat; | 
| 622 | + | } | 
| 623 | + |  | 
| 624 | + | void Snapshot::setInertiaTensor(const Mat3x3d& inertiaTensor) { | 
| 625 | + | frameData.inertiaTensor = inertiaTensor; | 
| 626 | + | hasInertiaTensor = true; | 
| 627 | + | } | 
| 628 | + |  | 
| 629 | + | Mat3x3d Snapshot::getInertiaTensor() { | 
| 630 | + | return frameData.inertiaTensor; | 
| 631 | + | } | 
| 632 | + |  | 
| 633 | + | void Snapshot::setGyrationalVolume(const RealType gyrationalVolume) { | 
| 634 | + | frameData.gyrationalVolume = gyrationalVolume; | 
| 635 | + | hasGyrationalVolume = true; | 
| 636 | + | } | 
| 637 | + |  | 
| 638 | + | RealType Snapshot::getGyrationalVolume() { | 
| 639 | + | return frameData.gyrationalVolume; | 
| 640 | + | } | 
| 641 | + |  | 
| 642 | + | void Snapshot::setHullVolume(const RealType hullVolume) { | 
| 643 | + | frameData.hullVolume = hullVolume; | 
| 644 | + | hasHullVolume = true; | 
| 645 | + | } | 
| 646 | + |  | 
| 647 | + | RealType Snapshot::getHullVolume() { | 
| 648 | + | return frameData.hullVolume; | 
| 649 | + | } | 
| 650 | + |  | 
| 651 | + | void Snapshot::setOrthoTolerance(RealType ot) { | 
| 652 | + | orthoTolerance_ = ot; | 
| 653 | + | } | 
| 654 | + | } |