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 1895 by gezelter, Mon Jul 1 21:09:37 2013 UTC vs.
Revision 1896 by gezelter, Tue Jul 2 20:02:31 2013 UTC

# Line 296 | Line 296 | namespace OpenMD {
296      hasVolume = true;
297      frameData.volume = vol;
298    }
299 +
300  
301    /** Wrap a vector according to periodic boundary conditions */
302    void Snapshot::wrapVector(Vector3d& pos) {
303      
304      if( !frameData.orthoRhombic ) {
305        Vector3d scaled = frameData.invHmat * pos;
306 <      for (int i = 0; i < 3; i++)
307 <        scaled[i] -= roundMe(scaled[i]);
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        pos = frameData.hmat * scaled;
311      } else {
310      // calc the scaled coordinates.
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);
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  
320
321    /** Scaling a vector to multiples of the periodic box */
322    inline Vector3d Snapshot::scaleVector(Vector3d& pos) {  
323      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines