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 1896 by gezelter, Tue Jul 2 20:02:31 2013 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 95 | Line 94 | namespace OpenMD {
94      frameData.id = -1;                  
95      frameData.currentTime = 0;    
96      frameData.hmat = Mat3x3d(0.0);            
97 <    frameData.invHmat = Mat3x3d(0.0);          
97 >    frameData.invHmat = Mat3x3d(0.0);      
98 >    frameData.bBox = Mat3x3d(0.0);            
99 >    frameData.invBbox = Mat3x3d(0.0);
100      frameData.orthoRhombic = false;        
101      frameData.bondPotential = 0.0;      
102      frameData.bendPotential = 0.0;      
# Line 132 | Line 133 | namespace OpenMD {
133      frameData.electronicTemperature = 0.0;
134      frameData.COM = V3Zero;            
135      frameData.COMvel = V3Zero;          
136 <    frameData.COMw = V3Zero;            
136 >    frameData.COMw = V3Zero;  
137  
138      hasTotalEnergy = false;        
139      hasTranslationalKineticEnergy = false;      
# Line 156 | Line 157 | namespace OpenMD {
157      hasGyrationalVolume = false;  
158      hasHullVolume = false;
159      hasConservedQuantity = false;
160 +    hasBoundingBox = false;
161    }
162  
163    /** Returns the id of this Snapshot */
# Line 221 | Line 223 | namespace OpenMD {
223      
224      if( oldOrthoRhombic != frameData.orthoRhombic){
225        
226 <      if( frameData.orthoRhombic ) {
227 <        sprintf( painCave.errMsg,
228 <                 "OpenMD is switching from the default Non-Orthorhombic\n"
229 <                 "\tto the faster Orthorhombic periodic boundary computations.\n"
230 <                 "\tThis is usually a good thing, but if you want the\n"
231 <                 "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n"
232 <                 "\tvariable ( currently set to %G ) smaller.\n",
233 <                 orthoTolerance_);
234 <        painCave.severity = OPENMD_INFO;
235 <        simError();
236 <      }
237 <      else {
238 <        sprintf( painCave.errMsg,
239 <                 "OpenMD is switching from the faster Orthorhombic to the more\n"
240 <                 "\tflexible Non-Orthorhombic periodic boundary computations.\n"
241 <                 "\tThis is usually because the box has deformed under\n"
242 <                 "\tNPTf integration. If you want to live on the edge with\n"
243 <                 "\tthe Orthorhombic computations, make the orthoBoxTolerance\n"
244 <                 "\tvariable ( currently set to %G ) larger.\n",
245 <                 orthoTolerance_);
246 <        painCave.severity = OPENMD_WARNING;
247 <        simError();
248 <      }
226 >      // It is finally time to suppress these warnings once and for
227 >      // all.  They were annoying and not very informative.
228 >
229 >      // if( frameData.orthoRhombic ) {
230 >      //   sprintf( painCave.errMsg,
231 >      //         "OpenMD is switching from the default Non-Orthorhombic\n"
232 >      //         "\tto the faster Orthorhombic periodic boundary computations.\n"
233 >      //         "\tThis is usually a good thing, but if you want the\n"
234 >      //         "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n"
235 >      //         "\tvariable ( currently set to %G ) smaller.\n",
236 >      //         orthoTolerance_);
237 >      //   painCave.severity = OPENMD_INFO;
238 >      //   simError();
239 >      // }
240 >      // else {
241 >      //   sprintf( painCave.errMsg,
242 >      //         "OpenMD is switching from the faster Orthorhombic to the more\n"
243 >      //         "\tflexible Non-Orthorhombic periodic boundary computations.\n"
244 >      //         "\tThis is usually because the box has deformed under\n"
245 >      //         "\tNPTf integration. If you want to live on the edge with\n"
246 >      //         "\tthe Orthorhombic computations, make the orthoBoxTolerance\n"
247 >      //         "\tvariable ( currently set to %G ) larger.\n",
248 >      //         orthoTolerance_);
249 >      //   painCave.severity = OPENMD_WARNING;
250 >      //   simError();
251 >      // }
252      }    
253    }
254    
# Line 252 | Line 257 | namespace OpenMD {
257      return frameData.invHmat;
258    }
259  
260 +  /** Returns the Bounding Box */
261 +  Mat3x3d Snapshot::getBoundingBox() {
262 +    return frameData.bBox;
263 +  }
264 +
265 +  /** Sets the Bounding Box */  
266 +  void Snapshot::setBoundingBox(const Mat3x3d& m) {
267 +    frameData.bBox = m;
268 +    frameData.invBbox = frameData.bBox.inverse();
269 +    hasBoundingBox = true;
270 +  }
271 +
272 +  /** Returns the inverse Bounding Box */
273 +  Mat3x3d Snapshot::getInvBoundingBox() {
274 +    return frameData.invBbox;
275 +  }
276 +
277    RealType Snapshot::getXYarea() {
278      if (!hasXYarea) {
279        Vector3d x = frameData.hmat.getColumn(0);
# Line 275 | Line 297 | namespace OpenMD {
297      frameData.volume = vol;
298    }
299  
300 +
301    /** Wrap a vector according to periodic boundary conditions */
302    void Snapshot::wrapVector(Vector3d& pos) {
303      
304 <    Vector3d scaled = scaleVector(pos);
305 <    
306 <    for (int i = 0; i < 3; i++)
307 <      scaled[i] -= roundMe(scaled[i]);
308 <    
286 <    if( !frameData.orthoRhombic )
287 <      pos = frameData.hmat * scaled;    
288 <    else {
289 <      
304 >    if( !frameData.orthoRhombic ) {
305 >      Vector3d scaled = frameData.invHmat * pos;
306 >      for (int i = 0; i < 3; i++) {
307 >        scaled[i] -= roundMe( scaled[i] );        
308 >      }
309        // calc the wrapped real coordinates from the wrapped scaled coordinates
310 <      for (int i=0; i<3; i++) {
311 <        pos[i] = scaled[i] * frameData.hmat(i, i);
312 <      }  
310 >      pos = frameData.hmat * scaled;
311 >    } else {
312 >      RealType scaled;
313 >      for (int i=0; i<3; i++) {      
314 >        scaled = pos[i] * frameData.invHmat(i,i);
315 >        scaled -= roundMe( scaled );
316 >        pos[i] = scaled * frameData.hmat(i,i);
317 >      }
318      }
319    }
320  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines