--- trunk/src/brains/Snapshot.cpp 2013/07/01 21:09:37 1895 +++ trunk/src/brains/Snapshot.cpp 2013/08/07 15:24:16 1925 @@ -70,6 +70,7 @@ namespace OpenMD { frameData.torsionPotential = 0.0; frameData.inversionPotential = 0.0; frameData.lrPotentials = potVec(0.0); + frameData.reciprocalPotential = 0.0; frameData.excludedPotentials = potVec(0.0); frameData.restraintPotential = 0.0; frameData.rawPotential = 0.0; @@ -103,6 +104,7 @@ namespace OpenMD { frameData.torsionPotential = 0.0; frameData.inversionPotential = 0.0; frameData.lrPotentials = potVec(0.0); + frameData.reciprocalPotential = 0.0; frameData.excludedPotentials = potVec(0.0); frameData.restraintPotential = 0.0; frameData.rawPotential = 0.0; @@ -296,28 +298,28 @@ namespace OpenMD { hasVolume = true; frameData.volume = vol; } + /** Wrap a vector according to periodic boundary conditions */ void Snapshot::wrapVector(Vector3d& pos) { if( !frameData.orthoRhombic ) { Vector3d scaled = frameData.invHmat * pos; - for (int i = 0; i < 3; i++) - scaled[i] -= roundMe(scaled[i]); + for (int i = 0; i < 3; i++) { + scaled[i] -= roundMe( scaled[i] ); + } // calc the wrapped real coordinates from the wrapped scaled coordinates pos = frameData.hmat * scaled; } else { - // calc the scaled coordinates. RealType scaled; - for (int i=0; i<3; i++) { - scaled = pos[i] * frameData.invHmat(i, i); - scaled -= roundMe(scaled); - pos[i] = scaled * frameData.hmat(i, i); + for (int i=0; i<3; i++) { + scaled = pos[i] * frameData.invHmat(i,i); + scaled -= roundMe( scaled ); + pos[i] = scaled * frameData.hmat(i,i); } } } - /** Scaling a vector to multiples of the periodic box */ inline Vector3d Snapshot::scaleVector(Vector3d& pos) { @@ -414,6 +416,14 @@ namespace OpenMD { return frameData.shortRangePotential; } + void Snapshot::setReciprocalPotential(RealType rp){ + frameData.reciprocalPotential = rp; + } + + RealType Snapshot::getReciprocalPotential() { + return frameData.reciprocalPotential; + } + void Snapshot::setLongRangePotential(potVec lrPot) { frameData.lrPotentials = lrPot; } @@ -423,6 +433,7 @@ namespace OpenMD { for (int i = 0; i < N_INTERACTION_FAMILIES; i++) { frameData.longRangePotential += frameData.lrPotentials[i]; } + frameData.longRangePotential += frameData.reciprocalPotential; hasLongRangePotential = true; } return frameData.longRangePotential;