| 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 */ | 
| 225 | 
  | 
     | 
| 226 | 
  | 
    if( oldOrthoRhombic != frameData.orthoRhombic){ | 
| 227 | 
  | 
       | 
| 228 | 
< | 
      if( frameData.orthoRhombic ) { | 
| 229 | 
< | 
        sprintf( painCave.errMsg, | 
| 230 | 
< | 
                 "OpenMD is switching from the default Non-Orthorhombic\n" | 
| 231 | 
< | 
                 "\tto the faster Orthorhombic periodic boundary computations.\n" | 
| 232 | 
< | 
                 "\tThis is usually a good thing, but if you want the\n" | 
| 233 | 
< | 
                 "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" | 
| 234 | 
< | 
                 "\tvariable ( currently set to %G ) smaller.\n", | 
| 235 | 
< | 
                 orthoTolerance_); | 
| 236 | 
< | 
        painCave.severity = OPENMD_INFO; | 
| 237 | 
< | 
        simError(); | 
| 238 | 
< | 
      } | 
| 239 | 
< | 
      else { | 
| 240 | 
< | 
        sprintf( painCave.errMsg, | 
| 241 | 
< | 
                 "OpenMD is switching from the faster Orthorhombic to the more\n" | 
| 242 | 
< | 
                 "\tflexible Non-Orthorhombic periodic boundary computations.\n" | 
| 243 | 
< | 
                 "\tThis is usually because the box has deformed under\n" | 
| 244 | 
< | 
                 "\tNPTf integration. If you want to live on the edge with\n" | 
| 245 | 
< | 
                 "\tthe Orthorhombic computations, make the orthoBoxTolerance\n" | 
| 246 | 
< | 
                 "\tvariable ( currently set to %G ) larger.\n", | 
| 247 | 
< | 
                 orthoTolerance_); | 
| 248 | 
< | 
        painCave.severity = OPENMD_WARNING; | 
| 249 | 
< | 
        simError(); | 
| 250 | 
< | 
      } | 
| 228 | 
> | 
      // It is finally time to suppress these warnings once and for | 
| 229 | 
> | 
      // all.  They were annoying and not very informative. | 
| 230 | 
> | 
 | 
| 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 | 
  | 
   | 
| 259 | 
  | 
    return frameData.invHmat; | 
| 260 | 
  | 
  } | 
| 261 | 
  | 
 | 
| 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 | 
+ | 
  /** Returns the inverse Bounding Box */ | 
| 275 | 
+ | 
  Mat3x3d Snapshot::getInvBoundingBox() { | 
| 276 | 
+ | 
    return frameData.invBbox; | 
| 277 | 
+ | 
  } | 
| 278 | 
+ | 
 | 
| 279 | 
  | 
  RealType Snapshot::getXYarea() { | 
| 280 | 
  | 
    if (!hasXYarea) { | 
| 281 | 
  | 
      Vector3d x = frameData.hmat.getColumn(0); | 
| 299 | 
  | 
    frameData.volume = vol; | 
| 300 | 
  | 
  } | 
| 301 | 
  | 
 | 
| 302 | 
+ | 
 | 
| 303 | 
  | 
  /** Wrap a vector according to periodic boundary conditions */ | 
| 304 | 
  | 
  void Snapshot::wrapVector(Vector3d& pos) { | 
| 305 | 
  | 
     | 
| 306 | 
< | 
    Vector3d scaled = scaleVector(pos); | 
| 307 | 
< | 
     | 
| 308 | 
< | 
    for (int i = 0; i < 3; i++)  | 
| 309 | 
< | 
      scaled[i] -= roundMe(scaled[i]); | 
| 310 | 
< | 
     | 
| 286 | 
< | 
    if( !frameData.orthoRhombic ) | 
| 287 | 
< | 
      pos = frameData.hmat * scaled;     | 
| 288 | 
< | 
    else { | 
| 289 | 
< | 
       | 
| 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 | 
< | 
      for (int i=0; i<3; i++) { | 
| 313 | 
< | 
        pos[i] = scaled[i] * frameData.hmat(i, i); | 
| 314 | 
< | 
      }    | 
| 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 | 
  | 
 | 
| 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 | 
  | 
  } | 
| 433 | 
  | 
      for (int i = 0; i < N_INTERACTION_FAMILIES; i++) { | 
| 434 | 
  | 
        frameData.longRangePotential += frameData.lrPotentials[i]; | 
| 435 | 
  | 
      } | 
| 436 | 
+ | 
      frameData.longRangePotential += frameData.reciprocalPotential; | 
| 437 | 
  | 
      hasLongRangePotential = true; | 
| 438 | 
  | 
    }    | 
| 439 | 
  | 
    return frameData.longRangePotential; |