ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/Snapshot.cpp
(Generate patch)

Comparing trunk/src/brains/Snapshot.cpp (file contents):
Revision 1782 by gezelter, Wed Aug 22 02:28:28 2012 UTC vs.
Revision 2022 by gezelter, Fri Sep 26 22:22:28 2014 UTC

# Line 35 | Line 35
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   */
# Line 44 | Line 44
44   * @file Snapshot.cpp
45   * @author tlin
46   * @date 11/11/2004
47 * @time 10:56am
47   * @version 1.0
48   */
49  
# Line 71 | Line 70 | namespace OpenMD {
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;  
# Line 95 | Line 95 | namespace OpenMD {
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;      
# Line 127 | Line 130 | namespace OpenMD {
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;      
# Line 151 | Line 155 | namespace OpenMD {
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 */
# Line 186 | Line 192 | namespace OpenMD {
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() {
# Line 221 | Line 232 | namespace OpenMD {
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    
# Line 252 | Line 266 | namespace OpenMD {
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);
# Line 275 | Line 306 | namespace OpenMD {
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  
# Line 390 | Line 423 | namespace OpenMD {
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    }
# Line 399 | Line 440 | namespace OpenMD {
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;
# Line 562 | Line 604 | namespace OpenMD {
604      frameData.systemDipole = bd;
605    }
606  
607 +  Mat3x3d Snapshot::getSystemQuadrupole() {
608 +    return frameData.systemQuadrupole;
609 +  }
610 +
611 +  void Snapshot::setSystemQuadrupole(const Mat3x3d& bq) {    
612 +    hasSystemQuadrupole = true;
613 +    frameData.systemQuadrupole = bq;
614 +  }
615 +
616    void Snapshot::setThermostat(const pair<RealType, RealType>& thermostat) {
617      frameData.thermostat = thermostat;
618    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines