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 1879 by gezelter, Sun Jun 16 15:15:42 2013 UTC vs.
Revision 2022 by gezelter, Fri Sep 26 22:22:28 2014 UTC

# Line 70 | 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 103 | Line 104 | namespace OpenMD {
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 128 | 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;            
# Line 152 | 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;  
# Line 188 | 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 297 | 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 <    
308 <    if( !frameData.orthoRhombic )
309 <      pos = frameData.hmat * scaled;    
310 <    else {
311 <      
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 412 | 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 421 | 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 584 | 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