Commit 41cd79a5 authored by peastman's avatar peastman
Browse files

Cleaned up formatting of AMOEBA reference code

parent 25a308e6
...@@ -357,7 +357,7 @@ public: ...@@ -357,7 +357,7 @@ public:
* *
* @return pointer to initialized instance of AmoebaReferenceMultipoleForce * @return pointer to initialized instance of AmoebaReferenceMultipoleForce
*/ */
AmoebaReferenceMultipoleForce* setupAmoebaReferenceMultipoleForce(ContextImpl& context ); AmoebaReferenceMultipoleForce* setupAmoebaReferenceMultipoleForce(ContextImpl& context);
/** /**
* Execute the kernel to calculate the forces and/or energy. * Execute the kernel to calculate the forces and/or energy.
* *
...@@ -382,7 +382,7 @@ public: ...@@ -382,7 +382,7 @@ public:
* @param outputElectrostaticPotential output potential * @param outputElectrostaticPotential output potential
*/ */
void getElectrostaticPotential(ContextImpl& context, const std::vector< Vec3 >& inputGrid, void getElectrostaticPotential(ContextImpl& context, const std::vector< Vec3 >& inputGrid,
std::vector< double >& outputElectrostaticPotential ); std::vector< double >& outputElectrostaticPotential);
/** /**
* Get the system multipole moments. * Get the system multipole moments.
...@@ -393,7 +393,7 @@ public: ...@@ -393,7 +393,7 @@ public:
dipole_x, dipole_y, dipole_z, dipole_x, dipole_y, dipole_z,
quadrupole_xx, quadrupole_xy, quadrupole_xz, quadrupole_xx, quadrupole_xy, quadrupole_xz,
quadrupole_yx, quadrupole_yy, quadrupole_yz, quadrupole_yx, quadrupole_yy, quadrupole_yz,
quadrupole_zx, quadrupole_zy, quadrupole_zz ) quadrupole_zx, quadrupole_zy, quadrupole_zz)
*/ */
void getSystemMultipoleMoments(ContextImpl& context, std::vector< double >& outputMultipoleMoments); void getSystemMultipoleMoments(ContextImpl& context, std::vector< double >& outputMultipoleMoments);
/** /**
...@@ -555,14 +555,14 @@ public: ...@@ -555,14 +555,14 @@ public:
* *
* @return includeCavityTerm * @return includeCavityTerm
*/ */
int getIncludeCavityTerm( void ) const; int getIncludeCavityTerm() const;
/** /**
* Get the number of particles. * Get the number of particles.
* *
* @return number of particles * @return number of particles
*/ */
int getNumParticles( void ) const; int getNumParticles() const;
/** /**
* Get Direct Polarization flag. * Get Direct Polarization flag.
...@@ -570,7 +570,7 @@ public: ...@@ -570,7 +570,7 @@ public:
* @return directPolarization * @return directPolarization
* *
*/ */
int getDirectPolarization( void ) const; int getDirectPolarization() const;
/** /**
* Get the solute dielectric. * Get the solute dielectric.
...@@ -578,7 +578,7 @@ public: ...@@ -578,7 +578,7 @@ public:
* @return soluteDielectric * @return soluteDielectric
* *
*/ */
RealOpenMM getSoluteDielectric( void ) const; RealOpenMM getSoluteDielectric() const;
/** /**
* Get the solvent dielectric. * Get the solvent dielectric.
...@@ -586,7 +586,7 @@ public: ...@@ -586,7 +586,7 @@ public:
* @return solventDielectric * @return solventDielectric
* *
*/ */
RealOpenMM getSolventDielectric( void ) const; RealOpenMM getSolventDielectric() const;
/** /**
* Get the dielectric offset. * Get the dielectric offset.
...@@ -594,7 +594,7 @@ public: ...@@ -594,7 +594,7 @@ public:
* @return dielectricOffset * @return dielectricOffset
* *
*/ */
RealOpenMM getDielectricOffset( void ) const; RealOpenMM getDielectricOffset() const;
/** /**
* Get the probe radius. * Get the probe radius.
...@@ -602,7 +602,7 @@ public: ...@@ -602,7 +602,7 @@ public:
* @return probeRadius * @return probeRadius
* *
*/ */
RealOpenMM getProbeRadius( void ) const; RealOpenMM getProbeRadius() const;
/** /**
* Get the surface area factor. * Get the surface area factor.
...@@ -610,7 +610,7 @@ public: ...@@ -610,7 +610,7 @@ public:
* @return surfaceAreaFactor * @return surfaceAreaFactor
* *
*/ */
RealOpenMM getSurfaceAreaFactor( void ) const; RealOpenMM getSurfaceAreaFactor() const;
/** /**
* Get the vector of particle radii. * Get the vector of particle radii.
...@@ -618,7 +618,7 @@ public: ...@@ -618,7 +618,7 @@ public:
* @param atomicRadii vector of atomic radii * @param atomicRadii vector of atomic radii
* *
*/ */
void getAtomicRadii( std::vector<RealOpenMM>& atomicRadii ) const; void getAtomicRadii(std::vector<RealOpenMM>& atomicRadii) const;
/** /**
* Get the vector of scale factors. * Get the vector of scale factors.
...@@ -626,7 +626,7 @@ public: ...@@ -626,7 +626,7 @@ public:
* @param scaleFactors vector of scale factors * @param scaleFactors vector of scale factors
* *
*/ */
void getScaleFactors( std::vector<RealOpenMM>& scaleFactors ) const; void getScaleFactors(std::vector<RealOpenMM>& scaleFactors) const;
/** /**
* Get the vector of charges. * Get the vector of charges.
...@@ -634,7 +634,7 @@ public: ...@@ -634,7 +634,7 @@ public:
* @param charges vector of charges * @param charges vector of charges
* *
*/ */
void getCharges( std::vector<RealOpenMM>& charges ) const; void getCharges(std::vector<RealOpenMM>& charges) const;
/** /**
* Copy changed parameters over to a context. * Copy changed parameters over to a context.
......
...@@ -46,11 +46,11 @@ using namespace OpenMM; ...@@ -46,11 +46,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine(RealOpenMM cosine,
RealOpenMM idealAngle, RealOpenMM angleK, RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR ) const { RealOpenMM* dEdR) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -67,9 +67,9 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM ...@@ -67,9 +67,9 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
RealOpenMM angle; RealOpenMM angle;
if( cosine >= one ){ if (cosine >= one) {
angle = zero; angle = zero;
} else if( cosine <= -one ){ } else if (cosine <= -one) {
angle = RADIAN*PI_M; angle = RADIAN*PI_M;
} else { } else {
angle = RADIAN*ACOS(cosine); angle = RADIAN*ACOS(cosine);
...@@ -79,10 +79,10 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM ...@@ -79,10 +79,10 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM
RealOpenMM deltaIdeal3 = deltaIdeal*deltaIdeal2; RealOpenMM deltaIdeal3 = deltaIdeal*deltaIdeal2;
RealOpenMM deltaIdeal4 = deltaIdeal2*deltaIdeal2; RealOpenMM deltaIdeal4 = deltaIdeal2*deltaIdeal2;
*dEdR = ( two + three*angleCubic*deltaIdeal + *dEdR = (two + three*angleCubic*deltaIdeal +
four*angleQuartic*deltaIdeal2 + four*angleQuartic*deltaIdeal2 +
five*anglePentic*deltaIdeal3 + five*anglePentic*deltaIdeal3 +
six*angleSextic*deltaIdeal4 ); six*angleSextic*deltaIdeal4);
*dEdR *= RADIAN*angleK*deltaIdeal; *dEdR *= RADIAN*angleK*deltaIdeal;
...@@ -113,12 +113,12 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM ...@@ -113,12 +113,12 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& positionAtomA, const RealVec& positionAtomB, RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomC,
RealOpenMM angle, RealOpenMM angleK, RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
RealVec* forces ) const { RealVec* forces) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -132,30 +132,30 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position ...@@ -132,30 +132,30 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
std::vector<RealOpenMM> deltaR[2]; std::vector<RealOpenMM> deltaR[2];
AmoebaReferenceForce::loadDeltaR( positionAtomA, positionAtomB, deltaR[0] ); AmoebaReferenceForce::loadDeltaR(positionAtomA, positionAtomB, deltaR[0]);
RealOpenMM rAB2 = AmoebaReferenceForce::getNormSquared3( deltaR[0] ); RealOpenMM rAB2 = AmoebaReferenceForce::getNormSquared3(deltaR[0]);
RealOpenMM rAB = SQRT( rAB2 ); RealOpenMM rAB = SQRT(rAB2);
AmoebaReferenceForce::loadDeltaR( positionAtomC, positionAtomB, deltaR[1] ); AmoebaReferenceForce::loadDeltaR(positionAtomC, positionAtomB, deltaR[1]);
RealOpenMM rCB2 = AmoebaReferenceForce::getNormSquared3( deltaR[1] ); RealOpenMM rCB2 = AmoebaReferenceForce::getNormSquared3(deltaR[1]);
RealOpenMM rCB = SQRT( rCB2 ); RealOpenMM rCB = SQRT(rCB2);
if( rAB <= zero || rCB <= zero ){ if (rAB <= zero || rCB <= zero) {
return zero; return zero;
} }
std::vector<RealOpenMM> pVector(3); std::vector<RealOpenMM> pVector(3);
AmoebaReferenceForce::getCrossProduct( deltaR[0], deltaR[1], pVector ); AmoebaReferenceForce::getCrossProduct(deltaR[0], deltaR[1], pVector);
RealOpenMM rp = AmoebaReferenceForce::getNorm3( pVector ); RealOpenMM rp = AmoebaReferenceForce::getNorm3(pVector);
if( rp < 1.0e-06 ){ if (rp < 1.0e-06) {
rp = 1.0e-06; rp = 1.0e-06;
} }
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3( deltaR[0], deltaR[1] ); RealOpenMM dot = AmoebaReferenceForce::getDotProduct3(deltaR[0], deltaR[1]);
RealOpenMM cosine = dot/(rAB*rCB); RealOpenMM cosine = dot/(rAB*rCB);
RealOpenMM dEdR; RealOpenMM dEdR;
RealOpenMM energy = getPrefactorsGivenAngleCosine( cosine, angle, angleK, angleCubic, angleQuartic, RealOpenMM energy = getPrefactorsGivenAngleCosine(cosine, angle, angleK, angleCubic, angleQuartic,
anglePentic, angleSextic, &dEdR ); anglePentic, angleSextic, &dEdR);
RealOpenMM termA = dEdR/(rAB2*rp); RealOpenMM termA = dEdR/(rAB2*rp);
RealOpenMM termC = -dEdR/(rCB2*rp); RealOpenMM termC = -dEdR/(rCB2*rp);
...@@ -164,9 +164,9 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position ...@@ -164,9 +164,9 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
deltaCrossP[0].resize(3); deltaCrossP[0].resize(3);
deltaCrossP[1].resize(3); deltaCrossP[1].resize(3);
deltaCrossP[2].resize(3); deltaCrossP[2].resize(3);
AmoebaReferenceForce::getCrossProduct( deltaR[0], pVector, deltaCrossP[0] ); AmoebaReferenceForce::getCrossProduct(deltaR[0], pVector, deltaCrossP[0]);
AmoebaReferenceForce::getCrossProduct( deltaR[1], pVector, deltaCrossP[2] ); AmoebaReferenceForce::getCrossProduct(deltaR[1], pVector, deltaCrossP[2]);
for( unsigned int ii = 0; ii < 3; ii++ ){ for (unsigned int ii = 0; ii < 3; ii++) {
deltaCrossP[0][ii] *= termA; deltaCrossP[0][ii] *= termA;
deltaCrossP[2][ii] *= termC; deltaCrossP[2][ii] *= termC;
deltaCrossP[1][ii] = -1.0f*(deltaCrossP[0][ii] + deltaCrossP[2][ii]); deltaCrossP[1][ii] = -1.0f*(deltaCrossP[0][ii] + deltaCrossP[2][ii]);
...@@ -174,7 +174,7 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position ...@@ -174,7 +174,7 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
// accumulate forces // accumulate forces
for( int jj = 0; jj < 3; jj++ ){ for (int jj = 0; jj < 3; jj++) {
forces[jj][0] = deltaCrossP[jj][0]; forces[jj][0] = deltaCrossP[jj][0];
forces[jj][1] = deltaCrossP[jj][1]; forces[jj][1] = deltaCrossP[jj][1];
forces[jj][2] = deltaCrossP[jj][2]; forces[jj][2] = deltaCrossP[jj][2];
...@@ -183,7 +183,7 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position ...@@ -183,7 +183,7 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
return energy; return energy;
} }
RealOpenMM AmoebaReferenceAngleForce::calculateForceAndEnergy( int numAngles, vector<RealVec>& posData, RealOpenMM AmoebaReferenceAngleForce::calculateForceAndEnergy(int numAngles, vector<RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
...@@ -202,10 +202,10 @@ RealOpenMM AmoebaReferenceAngleForce::calculateForceAndEnergy( int numAngles, ve ...@@ -202,10 +202,10 @@ RealOpenMM AmoebaReferenceAngleForce::calculateForceAndEnergy( int numAngles, ve
RealOpenMM idealAngle = angle[ii]; RealOpenMM idealAngle = angle[ii];
RealOpenMM angleK = kQuadratic[ii]; RealOpenMM angleK = kQuadratic[ii];
RealVec forces[3]; RealVec forces[3];
energy += calculateAngleIxn( posData[particle1Index], posData[particle2Index], posData[particle3Index], energy += calculateAngleIxn(posData[particle1Index], posData[particle2Index], posData[particle3Index],
idealAngle, angleK, angleCubic, angleQuartic, anglePentic, angleSextic, forces ); idealAngle, angleK, angleCubic, angleQuartic, anglePentic, angleSextic, forces);
for( unsigned int jj = 0; jj < 3; jj++ ){ for (unsigned int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] += forces[0][jj]; forceData[particle1Index][jj] += forces[0][jj];
forceData[particle2Index][jj] += forces[1][jj]; forceData[particle2Index][jj] += forces[1][jj];
forceData[particle3Index][jj] += forces[2][jj]; forceData[particle3Index][jj] += forces[2][jj];
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
AmoebaReferenceAngleForce( ){}; AmoebaReferenceAngleForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~AmoebaReferenceAngleForce( ){}; ~AmoebaReferenceAngleForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -72,17 +72,17 @@ public: ...@@ -72,17 +72,17 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numAngles, std::vector<OpenMM::RealVec>& posData, RealOpenMM calculateForceAndEnergy(int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
const std::vector<RealOpenMM>& angle, const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic, const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM globalAngleCubic, RealOpenMM globalAngleCubic,
RealOpenMM globalAngleQuartic, RealOpenMM globalAngleQuartic,
RealOpenMM globalAnglePentic, RealOpenMM globalAnglePentic,
RealOpenMM globalAngleSextic, RealOpenMM globalAngleSextic,
std::vector<OpenMM::RealVec>& forceData ) const; std::vector<OpenMM::RealVec>& forceData) const;
private: private:
...@@ -104,10 +104,10 @@ private: ...@@ -104,10 +104,10 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM idealAngle, RealOpenMM angleK, RealOpenMM getPrefactorsGivenAngleCosine(RealOpenMM cosine, RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR ) const; RealOpenMM* dEdR) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -128,12 +128,12 @@ private: ...@@ -128,12 +128,12 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateAngleIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB, RealOpenMM calculateAngleIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomC,
RealOpenMM angle, RealOpenMM angleK, RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces ) const; OpenMM::RealVec* forces) const;
}; };
......
...@@ -44,10 +44,10 @@ using namespace OpenMM; ...@@ -44,10 +44,10 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAtomA, const RealVec& positionAtomB, RealOpenMM AmoebaReferenceBondForce::calculateBondIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
RealOpenMM bondLength, RealOpenMM bondK, RealOpenMM bondLength, RealOpenMM bondK,
RealOpenMM bondCubic, RealOpenMM bondQuartic, RealOpenMM bondCubic, RealOpenMM bondQuartic,
RealVec* forces ) const { RealVec* forces) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -63,8 +63,8 @@ RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAt ...@@ -63,8 +63,8 @@ RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAt
// get deltaR, R2, and R between 2 atoms // get deltaR, R2, and R between 2 atoms
std::vector<RealOpenMM> deltaR; std::vector<RealOpenMM> deltaR;
AmoebaReferenceForce::loadDeltaR( positionAtomA, positionAtomB, deltaR ); AmoebaReferenceForce::loadDeltaR(positionAtomA, positionAtomB, deltaR);
RealOpenMM r = AmoebaReferenceForce::getNorm3( deltaR ); RealOpenMM r = AmoebaReferenceForce::getNorm3(deltaR);
// deltaIdeal = r - r_0 // deltaIdeal = r - r_0
...@@ -84,11 +84,11 @@ RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAt ...@@ -84,11 +84,11 @@ RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAt
forces[1][1] = dEdR*deltaR[1]; forces[1][1] = dEdR*deltaR[1];
forces[1][2] = dEdR*deltaR[2]; forces[1][2] = dEdR*deltaR[2];
RealOpenMM energy = bondK*deltaIdeal2*( one + bondCubic*deltaIdeal + bondQuartic*deltaIdeal2 ); RealOpenMM energy = bondK*deltaIdeal2*(one + bondCubic*deltaIdeal + bondQuartic*deltaIdeal2);
return energy; return energy;
} }
RealOpenMM AmoebaReferenceBondForce::calculateForceAndEnergy( int numBonds, RealOpenMM AmoebaReferenceBondForce::calculateForceAndEnergy(int numBonds,
vector<RealVec>& particlePositions, vector<RealVec>& particlePositions,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
...@@ -96,20 +96,20 @@ RealOpenMM AmoebaReferenceBondForce::calculateForceAndEnergy( int numBonds, ...@@ -96,20 +96,20 @@ RealOpenMM AmoebaReferenceBondForce::calculateForceAndEnergy( int numBonds,
const std::vector<RealOpenMM>& kQuadratic, const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM globalBondCubic, RealOpenMM globalBondCubic,
RealOpenMM globalBondQuartic, RealOpenMM globalBondQuartic,
vector<RealVec>& forceData ) const { vector<RealVec>& forceData) const {
RealOpenMM energy = 0.0; RealOpenMM energy = 0.0;
for( int ii = 0; ii < numBonds; ii++ ){ for (int ii = 0; ii < numBonds; ii++) {
int particle1Index = particle1[ii]; int particle1Index = particle1[ii];
int particle2Index = particle2[ii]; int particle2Index = particle2[ii];
RealOpenMM bondLength = length[ii]; RealOpenMM bondLength = length[ii];
RealOpenMM bondK = kQuadratic[ii]; RealOpenMM bondK = kQuadratic[ii];
RealVec forces[2]; RealVec forces[2];
energy += calculateBondIxn( particlePositions[particle1Index], particlePositions[particle2Index], energy += calculateBondIxn(particlePositions[particle1Index], particlePositions[particle2Index],
bondLength, bondK, globalBondCubic, globalBondQuartic, bondLength, bondK, globalBondCubic, globalBondQuartic,
forces ); forces);
for( int jj = 0; jj < 3; jj++ ){ for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] += forces[0][jj]; forceData[particle1Index][jj] += forces[0][jj];
forceData[particle2Index][jj] += forces[1][jj]; forceData[particle2Index][jj] += forces[1][jj];
} }
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
AmoebaReferenceBondForce( ){}; AmoebaReferenceBondForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~AmoebaReferenceBondForce( ){}; ~AmoebaReferenceBondForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -69,13 +69,13 @@ public: ...@@ -69,13 +69,13 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numBonds, std::vector<OpenMM::RealVec>& posData, RealOpenMM calculateForceAndEnergy(int numBonds, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<RealOpenMM>& bondLength, const std::vector<RealOpenMM>& bondLength,
const std::vector<RealOpenMM>& bondK, const std::vector<RealOpenMM>& bondK,
RealOpenMM bondCubic, RealOpenMM bondQuartic, RealOpenMM bondCubic, RealOpenMM bondQuartic,
std::vector<OpenMM::RealVec>& forceData ) const; std::vector<OpenMM::RealVec>& forceData) const;
private: private:
...@@ -95,10 +95,10 @@ private: ...@@ -95,10 +95,10 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateBondIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB, RealOpenMM calculateBondIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
RealOpenMM bondLength, RealOpenMM bondK, RealOpenMM bondLength, RealOpenMM bondK,
RealOpenMM bondCubic, RealOpenMM bondQuartic, RealOpenMM bondCubic, RealOpenMM bondQuartic,
OpenMM::RealVec* forces ) const; OpenMM::RealVec* forces) const;
}; };
......
...@@ -37,8 +37,8 @@ using namespace OpenMM; ...@@ -37,8 +37,8 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yVector, void AmoebaReferenceForce::loadDeltaR(const RealVec& xVector, const RealVec& yVector,
std::vector<RealOpenMM>& deltaR ){ std::vector<RealOpenMM>& deltaR) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -48,9 +48,9 @@ void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yV ...@@ -48,9 +48,9 @@ void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yV
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
deltaR.resize(0); deltaR.resize(0);
deltaR.push_back( yVector[0] - xVector[0] ); deltaR.push_back(yVector[0] - xVector[0]);
deltaR.push_back( yVector[1] - xVector[1] ); deltaR.push_back(yVector[1] - xVector[1]);
deltaR.push_back( yVector[2] - xVector[2] ); deltaR.push_back(yVector[2] - xVector[2]);
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -63,7 +63,7 @@ void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yV ...@@ -63,7 +63,7 @@ void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yV
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceForce::getNormSquared3( const std::vector<RealOpenMM>& inputVector ){ RealOpenMM AmoebaReferenceForce::getNormSquared3(const std::vector<RealOpenMM>& inputVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -73,7 +73,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const std::vector<RealOpenMM>& ...@@ -73,7 +73,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const std::vector<RealOpenMM>&
// get 3 norm // get 3 norm
return ( inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2] ); return (inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2]);
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -86,7 +86,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const std::vector<RealOpenMM>& ...@@ -86,7 +86,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const std::vector<RealOpenMM>&
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector ){ RealOpenMM AmoebaReferenceForce::getNormSquared3(const RealOpenMM* inputVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -96,7 +96,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector ...@@ -96,7 +96,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector
// get 3 norm // get 3 norm
return ( inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2] ); return (inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2]);
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -109,7 +109,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector ...@@ -109,7 +109,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceForce::getNorm3( const std::vector<RealOpenMM>& inputVector ){ RealOpenMM AmoebaReferenceForce::getNorm3(const std::vector<RealOpenMM>& inputVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -119,10 +119,10 @@ RealOpenMM AmoebaReferenceForce::getNorm3( const std::vector<RealOpenMM>& inputV ...@@ -119,10 +119,10 @@ RealOpenMM AmoebaReferenceForce::getNorm3( const std::vector<RealOpenMM>& inputV
// get 3 norm // get 3 norm
return SQRT( inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2] ); return SQRT(inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2]);
} }
RealOpenMM AmoebaReferenceForce::getNorm3( const RealOpenMM* inputVector ){ RealOpenMM AmoebaReferenceForce::getNorm3(const RealOpenMM* inputVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -132,10 +132,10 @@ RealOpenMM AmoebaReferenceForce::getNorm3( const RealOpenMM* inputVector ){ ...@@ -132,10 +132,10 @@ RealOpenMM AmoebaReferenceForce::getNorm3( const RealOpenMM* inputVector ){
// get 3 norm // get 3 norm
return SQRT( inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2] ); return SQRT(inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2]);
} }
RealOpenMM AmoebaReferenceForce::normalizeVector3( RealOpenMM* inputVector ){ RealOpenMM AmoebaReferenceForce::normalizeVector3(RealOpenMM* inputVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -143,8 +143,8 @@ RealOpenMM AmoebaReferenceForce::normalizeVector3( RealOpenMM* inputVector ){ ...@@ -143,8 +143,8 @@ RealOpenMM AmoebaReferenceForce::normalizeVector3( RealOpenMM* inputVector ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
RealOpenMM norm = SQRT( inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2] ); RealOpenMM norm = SQRT(inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2]);
if( norm > 0.0 ){ if (norm > 0.0) {
RealOpenMM normI = 1.0/norm; RealOpenMM normI = 1.0/norm;
inputVector[0] *= normI; inputVector[0] *= normI;
inputVector[1] *= normI; inputVector[1] *= normI;
...@@ -165,7 +165,7 @@ RealOpenMM AmoebaReferenceForce::normalizeVector3( RealOpenMM* inputVector ){ ...@@ -165,7 +165,7 @@ RealOpenMM AmoebaReferenceForce::normalizeVector3( RealOpenMM* inputVector ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceForce::getDotProduct3( const std::vector<RealOpenMM>& xVector, const std::vector<RealOpenMM>& yVector ){ RealOpenMM AmoebaReferenceForce::getDotProduct3(const std::vector<RealOpenMM>& xVector, const std::vector<RealOpenMM>& yVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -189,7 +189,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const std::vector<RealOpenMM>& ...@@ -189,7 +189,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const std::vector<RealOpenMM>&
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceForce::getDotProduct3( const RealOpenMM* xVector, const RealOpenMM* yVector ){ RealOpenMM AmoebaReferenceForce::getDotProduct3(const RealOpenMM* xVector, const RealOpenMM* yVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -202,7 +202,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const RealOpenMM* xVector, cons ...@@ -202,7 +202,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const RealOpenMM* xVector, cons
return xVector[0]*yVector[0] + xVector[1]*yVector[1] + xVector[2]*yVector[2]; return xVector[0]*yVector[0] + xVector[1]*yVector[1] + xVector[2]*yVector[2];
} }
RealOpenMM AmoebaReferenceForce::getDotProduct3( const RealOpenMM* xVector, const OpenMM::Vec3& yVector ){ RealOpenMM AmoebaReferenceForce::getDotProduct3(const RealOpenMM* xVector, const OpenMM::Vec3& yVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -227,7 +227,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const RealOpenMM* xVector, cons ...@@ -227,7 +227,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const RealOpenMM* xVector, cons
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceForce::getDotProduct3( unsigned int vectorOffset, const std::vector<RealOpenMM>& xVector, const RealOpenMM* yVector ){ RealOpenMM AmoebaReferenceForce::getDotProduct3(unsigned int vectorOffset, const std::vector<RealOpenMM>& xVector, const RealOpenMM* yVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -250,9 +250,9 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( unsigned int vectorOffset, cons ...@@ -250,9 +250,9 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( unsigned int vectorOffset, cons
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void AmoebaReferenceForce::getCrossProduct( const std::vector<RealOpenMM>& xVector, void AmoebaReferenceForce::getCrossProduct(const std::vector<RealOpenMM>& xVector,
const std::vector<RealOpenMM>& yVector, const std::vector<RealOpenMM>& yVector,
std::vector<RealOpenMM>& zVector ){ std::vector<RealOpenMM>& zVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -277,9 +277,9 @@ void AmoebaReferenceForce::getCrossProduct( const std::vector<RealOpenMM>& xVect ...@@ -277,9 +277,9 @@ void AmoebaReferenceForce::getCrossProduct( const std::vector<RealOpenMM>& xVect
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void AmoebaReferenceForce::getCrossProduct( const RealOpenMM* xVector, void AmoebaReferenceForce::getCrossProduct(const RealOpenMM* xVector,
const RealOpenMM* yVector, const RealOpenMM* yVector,
RealOpenMM* zVector ){ RealOpenMM* zVector) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
AmoebaReferenceForce( ); AmoebaReferenceForce();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~AmoebaReferenceForce( ); ~AmoebaReferenceForce();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -62,8 +62,8 @@ public: ...@@ -62,8 +62,8 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static void loadDeltaR( const OpenMM::RealVec& xVector, const OpenMM::RealVec& yVector, static void loadDeltaR(const OpenMM::RealVec& xVector, const OpenMM::RealVec& yVector,
std::vector<RealOpenMM>& deltaR ); std::vector<RealOpenMM>& deltaR);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -75,8 +75,8 @@ public: ...@@ -75,8 +75,8 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getNormSquared3( const std::vector<RealOpenMM>& inputVector ); static RealOpenMM getNormSquared3(const std::vector<RealOpenMM>& inputVector);
static RealOpenMM getNormSquared3( const RealOpenMM* inputVector ); static RealOpenMM getNormSquared3(const RealOpenMM* inputVector);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -88,8 +88,8 @@ public: ...@@ -88,8 +88,8 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getNorm3( const std::vector<RealOpenMM>& inputVector ); static RealOpenMM getNorm3(const std::vector<RealOpenMM>& inputVector);
static RealOpenMM getNorm3( const RealOpenMM* inputVector ); static RealOpenMM getNorm3(const RealOpenMM* inputVector);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -101,7 +101,7 @@ public: ...@@ -101,7 +101,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM normalizeVector3( RealOpenMM* inputVector ); static RealOpenMM normalizeVector3(RealOpenMM* inputVector);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -114,10 +114,10 @@ public: ...@@ -114,10 +114,10 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getDotProduct3( const std::vector<RealOpenMM>& xVector, const std::vector<RealOpenMM>& yVector ); static RealOpenMM getDotProduct3(const std::vector<RealOpenMM>& xVector, const std::vector<RealOpenMM>& yVector);
static RealOpenMM getDotProduct3( const RealOpenMM* xVector, const RealOpenMM* yVector ); static RealOpenMM getDotProduct3(const RealOpenMM* xVector, const RealOpenMM* yVector);
static RealOpenMM getDotProduct3( const RealOpenMM* xVector, const OpenMM::Vec3& yVector ); static RealOpenMM getDotProduct3(const RealOpenMM* xVector, const OpenMM::Vec3& yVector);
static RealOpenMM getDotProduct3( unsigned int vectorOffset, const std::vector<RealOpenMM>& xVector, const RealOpenMM* yVector ); static RealOpenMM getDotProduct3(unsigned int vectorOffset, const std::vector<RealOpenMM>& xVector, const RealOpenMM* yVector);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -129,10 +129,10 @@ public: ...@@ -129,10 +129,10 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static void getCrossProduct( const std::vector<RealOpenMM>& xVector, const std::vector<RealOpenMM>& yVector, static void getCrossProduct(const std::vector<RealOpenMM>& xVector, const std::vector<RealOpenMM>& yVector,
std::vector<RealOpenMM>& zVector ); std::vector<RealOpenMM>& zVector);
static void getCrossProduct( const RealOpenMM* xVector, const RealOpenMM* yVector, RealOpenMM* zVector ); static void getCrossProduct(const RealOpenMM* xVector, const RealOpenMM* yVector, RealOpenMM* zVector);
}; };
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
using std::vector; using std::vector;
using namespace OpenMM; using namespace OpenMM;
AmoebaReferenceGeneralizedKirkwoodForce::AmoebaReferenceGeneralizedKirkwoodForce( ) : _numParticles(0), AmoebaReferenceGeneralizedKirkwoodForce::AmoebaReferenceGeneralizedKirkwoodForce() : _numParticles(0),
_includeCavityTerm(1), _includeCavityTerm(1),
_directPolarization(0), _directPolarization(0),
_soluteDielectric(1.0), _soluteDielectric(1.0),
...@@ -37,101 +37,101 @@ AmoebaReferenceGeneralizedKirkwoodForce::AmoebaReferenceGeneralizedKirkwoodForce ...@@ -37,101 +37,101 @@ AmoebaReferenceGeneralizedKirkwoodForce::AmoebaReferenceGeneralizedKirkwoodForce
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setNumParticles( int numParticles ){ void AmoebaReferenceGeneralizedKirkwoodForce::setNumParticles(int numParticles) {
_numParticles = numParticles; _numParticles = numParticles;
} }
int AmoebaReferenceGeneralizedKirkwoodForce::getNumParticles( void ) const { int AmoebaReferenceGeneralizedKirkwoodForce::getNumParticles() const {
return _numParticles; return _numParticles;
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setIncludeCavityTerm( int includeCavityTerm ){ void AmoebaReferenceGeneralizedKirkwoodForce::setIncludeCavityTerm(int includeCavityTerm) {
_includeCavityTerm = includeCavityTerm; _includeCavityTerm = includeCavityTerm;
} }
int AmoebaReferenceGeneralizedKirkwoodForce::getIncludeCavityTerm( void ) const { int AmoebaReferenceGeneralizedKirkwoodForce::getIncludeCavityTerm() const {
return _includeCavityTerm; return _includeCavityTerm;
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setDirectPolarization( int directPolarization ){ void AmoebaReferenceGeneralizedKirkwoodForce::setDirectPolarization(int directPolarization) {
_directPolarization = directPolarization; _directPolarization = directPolarization;
} }
int AmoebaReferenceGeneralizedKirkwoodForce::getDirectPolarization( void ) const { int AmoebaReferenceGeneralizedKirkwoodForce::getDirectPolarization() const {
return _directPolarization; return _directPolarization;
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setSoluteDielectric( RealOpenMM soluteDielectric ){ void AmoebaReferenceGeneralizedKirkwoodForce::setSoluteDielectric(RealOpenMM soluteDielectric) {
_soluteDielectric = soluteDielectric; _soluteDielectric = soluteDielectric;
} }
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSoluteDielectric( void ) const { RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSoluteDielectric() const {
return _soluteDielectric; return _soluteDielectric;
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setSolventDielectric( RealOpenMM solventDielectric ){ void AmoebaReferenceGeneralizedKirkwoodForce::setSolventDielectric(RealOpenMM solventDielectric) {
_solventDielectric = solventDielectric; _solventDielectric = solventDielectric;
} }
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSolventDielectric( void ) const { RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSolventDielectric() const {
return _solventDielectric; return _solventDielectric;
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setDielectricOffset( RealOpenMM dielectricOffset ){ void AmoebaReferenceGeneralizedKirkwoodForce::setDielectricOffset(RealOpenMM dielectricOffset) {
_dielectricOffset = dielectricOffset; _dielectricOffset = dielectricOffset;
} }
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getDielectricOffset( void ) const { RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getDielectricOffset() const {
return _dielectricOffset; return _dielectricOffset;
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setProbeRadius( RealOpenMM probeRadius ){ void AmoebaReferenceGeneralizedKirkwoodForce::setProbeRadius(RealOpenMM probeRadius) {
_probeRadius = probeRadius; _probeRadius = probeRadius;
} }
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getProbeRadius( void ) const { RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getProbeRadius() const {
return _probeRadius; return _probeRadius;
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setSurfaceAreaFactor( RealOpenMM surfaceAreaFactor ){ void AmoebaReferenceGeneralizedKirkwoodForce::setSurfaceAreaFactor(RealOpenMM surfaceAreaFactor) {
_surfaceAreaFactor = surfaceAreaFactor; _surfaceAreaFactor = surfaceAreaFactor;
} }
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSurfaceAreaFactor( void ) const { RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSurfaceAreaFactor() const {
return _surfaceAreaFactor; return _surfaceAreaFactor;
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setAtomicRadii( const vector<RealOpenMM>& atomicRadii ){ void AmoebaReferenceGeneralizedKirkwoodForce::setAtomicRadii(const vector<RealOpenMM>& atomicRadii) {
_atomicRadii.resize( atomicRadii.size() ); _atomicRadii.resize(atomicRadii.size());
copy( atomicRadii.begin(), atomicRadii.end(), _atomicRadii.begin() ); copy(atomicRadii.begin(), atomicRadii.end(), _atomicRadii.begin());
} }
void AmoebaReferenceGeneralizedKirkwoodForce::getAtomicRadii( vector<RealOpenMM>& atomicRadii ) const { void AmoebaReferenceGeneralizedKirkwoodForce::getAtomicRadii(vector<RealOpenMM>& atomicRadii) const {
atomicRadii.resize( _atomicRadii.size() ); atomicRadii.resize(_atomicRadii.size());
copy( _atomicRadii.begin(), _atomicRadii.end(), atomicRadii.begin() ); copy(_atomicRadii.begin(), _atomicRadii.end(), atomicRadii.begin());
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setScaleFactors( const vector<RealOpenMM>& scaleFactors ){ void AmoebaReferenceGeneralizedKirkwoodForce::setScaleFactors(const vector<RealOpenMM>& scaleFactors) {
_scaleFactors.resize( scaleFactors.size() ); _scaleFactors.resize(scaleFactors.size());
copy( scaleFactors.begin(), scaleFactors.end(), _scaleFactors.begin() ); copy(scaleFactors.begin(), scaleFactors.end(), _scaleFactors.begin());
} }
void AmoebaReferenceGeneralizedKirkwoodForce::getScaleFactors( vector<RealOpenMM>& scaleFactors ) const { void AmoebaReferenceGeneralizedKirkwoodForce::getScaleFactors(vector<RealOpenMM>& scaleFactors) const {
scaleFactors.resize( _scaleFactors.size() ); scaleFactors.resize(_scaleFactors.size());
copy( _scaleFactors.begin(), _scaleFactors.end(), scaleFactors.begin() ); copy(_scaleFactors.begin(), _scaleFactors.end(), scaleFactors.begin());
} }
void AmoebaReferenceGeneralizedKirkwoodForce::setCharges( const vector<RealOpenMM>& charges ){ void AmoebaReferenceGeneralizedKirkwoodForce::setCharges(const vector<RealOpenMM>& charges) {
_charges.resize( charges.size() ); _charges.resize(charges.size());
copy( charges.begin(), charges.end(), _charges.begin() ); copy(charges.begin(), charges.end(), _charges.begin());
} }
void AmoebaReferenceGeneralizedKirkwoodForce::getGrycukBornRadii( vector<RealOpenMM>& bornRadii ) const { void AmoebaReferenceGeneralizedKirkwoodForce::getGrycukBornRadii(vector<RealOpenMM>& bornRadii) const {
bornRadii.resize( _bornRadii.size() ); bornRadii.resize(_bornRadii.size());
copy( _bornRadii.begin(), _bornRadii.end(), bornRadii.begin() ); copy(_bornRadii.begin(), _bornRadii.end(), bornRadii.begin());
} }
void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const vector<RealVec>& particlePositions ) { void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii(const vector<RealVec>& particlePositions) {
const RealOpenMM zero = 0.0; const RealOpenMM zero = 0.0;
const RealOpenMM one = 1.0; const RealOpenMM one = 1.0;
...@@ -142,30 +142,30 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve ...@@ -142,30 +142,30 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
const RealOpenMM oneThird = 1.0/3.0; const RealOpenMM oneThird = 1.0/3.0;
const RealOpenMM bigRadius = 1000.0; const RealOpenMM bigRadius = 1000.0;
_bornRadii.resize( _numParticles ); _bornRadii.resize(_numParticles);
for( unsigned int ii = 0; ii < _numParticles; ii++ ){ for (unsigned int ii = 0; ii < _numParticles; ii++) {
if( _atomicRadii[ii] <= zero ){ if (_atomicRadii[ii] <= zero) {
_bornRadii[ii] = bigRadius; _bornRadii[ii] = bigRadius;
continue; continue;
} }
RealOpenMM bornSum = zero; RealOpenMM bornSum = zero;
for( unsigned int jj = 0; jj < _numParticles; jj++ ){ for (unsigned int jj = 0; jj < _numParticles; jj++) {
if( ii == jj || _atomicRadii[jj] < zero )continue; if (ii == jj || _atomicRadii[jj] < zero)continue;
RealOpenMM xr = particlePositions[jj][0] - particlePositions[ii][0]; RealOpenMM xr = particlePositions[jj][0] - particlePositions[ii][0];
RealOpenMM yr = particlePositions[jj][1] - particlePositions[ii][1]; RealOpenMM yr = particlePositions[jj][1] - particlePositions[ii][1];
RealOpenMM zr = particlePositions[jj][2] - particlePositions[ii][2]; RealOpenMM zr = particlePositions[jj][2] - particlePositions[ii][2];
RealOpenMM r2 = xr*xr + yr*yr + zr*zr; RealOpenMM r2 = xr*xr + yr*yr + zr*zr;
RealOpenMM r = SQRT( r2 ); RealOpenMM r = SQRT(r2);
RealOpenMM sk = _atomicRadii[jj]*_scaleFactors[jj]; RealOpenMM sk = _atomicRadii[jj]*_scaleFactors[jj];
RealOpenMM sk2 = sk*sk; RealOpenMM sk2 = sk*sk;
if( (_atomicRadii[ii] + r) < sk ){ if ((_atomicRadii[ii] + r) < sk) {
RealOpenMM lik = _atomicRadii[ii]; RealOpenMM lik = _atomicRadii[ii];
RealOpenMM uik = sk - r; RealOpenMM uik = sk - r;
RealOpenMM lik3 = lik*lik*lik; RealOpenMM lik3 = lik*lik*lik;
...@@ -175,9 +175,9 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve ...@@ -175,9 +175,9 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
RealOpenMM uik = r + sk; RealOpenMM uik = r + sk;
RealOpenMM lik; RealOpenMM lik;
if( (_atomicRadii[ii] + r) < sk ){ if ((_atomicRadii[ii] + r) < sk) {
lik = sk - r; lik = sk - r;
} else if( r < (_atomicRadii[ii] + sk) ){ } else if (r < (_atomicRadii[ii] + sk)) {
lik = _atomicRadii[ii]; lik = _atomicRadii[ii];
} else { } else {
lik = r - sk; lik = r - sk;
...@@ -198,7 +198,7 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve ...@@ -198,7 +198,7 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
} }
bornSum = one/(_atomicRadii[ii]*_atomicRadii[ii]*_atomicRadii[ii]) - bornSum; bornSum = one/(_atomicRadii[ii]*_atomicRadii[ii]*_atomicRadii[ii]) - bornSum;
_bornRadii[ii] = (bornSum <= zero) ? bigRadius : POW( bornSum, -oneThird ); _bornRadii[ii] = (bornSum <= zero) ? bigRadius : POW(bornSum, -oneThird);
} }
return; return;
......
...@@ -41,13 +41,13 @@ public: ...@@ -41,13 +41,13 @@ public:
* Constructor * Constructor
* *
*/ */
AmoebaReferenceGeneralizedKirkwoodForce( ); AmoebaReferenceGeneralizedKirkwoodForce();
/** /**
* Destructor * Destructor
* *
*/ */
~AmoebaReferenceGeneralizedKirkwoodForce( ){}; ~AmoebaReferenceGeneralizedKirkwoodForce() {};
/** /**
* Get number of particles * Get number of particles
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
* @return numParticles * @return numParticles
* *
*/ */
int getNumParticles( void ) const; int getNumParticles() const;
/** /**
* Set numParticles * Set numParticles
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
* @param numParticles * @param numParticles
* *
*/ */
void setNumParticles( int numParticles ); void setNumParticles(int numParticles);
/** /**
* Get includeCavityTerm flag * Get includeCavityTerm flag
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
* @return includeCavityTerm * @return includeCavityTerm
* *
*/ */
int getIncludeCavityTerm( void ) const; int getIncludeCavityTerm() const;
/** /**
* Set includeCavityTerm flag * Set includeCavityTerm flag
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
* @param includeCavityTerm flag indicating whether surface area term is to be included * @param includeCavityTerm flag indicating whether surface area term is to be included
* *
*/ */
void setIncludeCavityTerm( int includeCavityTerm ); void setIncludeCavityTerm(int includeCavityTerm);
/** /**
* Get directPolarization flag * Get directPolarization flag
...@@ -87,21 +87,21 @@ public: ...@@ -87,21 +87,21 @@ public:
* @return directPolarization * @return directPolarization
* *
*/ */
int getDirectPolarization( void ) const; int getDirectPolarization() const;
/** /**
* Set directPolarization flag * Set directPolarization flag
* *
* @param directPolarization nonzero if direct as opposed to mutual polarization * @param directPolarization nonzero if direct as opposed to mutual polarization
*/ */
void setDirectPolarization( int directPolarization ); void setDirectPolarization(int directPolarization);
/** /**
* Get solute dielectric * Get solute dielectric
* *
* @return soluteDielectric * @return soluteDielectric
*/ */
RealOpenMM getSoluteDielectric( void ) const; RealOpenMM getSoluteDielectric() const;
/** /**
* Set solute dielectric * Set solute dielectric
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
* @param soluteDielectric solute dielectric * @param soluteDielectric solute dielectric
* *
*/ */
void setSoluteDielectric( RealOpenMM soluteDielectric ); void setSoluteDielectric(RealOpenMM soluteDielectric);
/** /**
* Get solvent dielectric * Get solvent dielectric
...@@ -117,7 +117,7 @@ public: ...@@ -117,7 +117,7 @@ public:
* @return solventDielectric * @return solventDielectric
* *
*/ */
RealOpenMM getSolventDielectric( void ) const; RealOpenMM getSolventDielectric() const;
/** /**
* Set solvent dielectric * Set solvent dielectric
...@@ -125,7 +125,7 @@ public: ...@@ -125,7 +125,7 @@ public:
* @param solventDielectric solvent dielectric * @param solventDielectric solvent dielectric
* *
*/ */
void setSolventDielectric( RealOpenMM solventDielectric ); void setSolventDielectric(RealOpenMM solventDielectric);
/** /**
* Get dielectric offset * Get dielectric offset
...@@ -133,7 +133,7 @@ public: ...@@ -133,7 +133,7 @@ public:
* @return dielectricOffset * @return dielectricOffset
* *
*/ */
RealOpenMM getDielectricOffset( void ) const; RealOpenMM getDielectricOffset() const;
/** /**
* Set dielectric offset * Set dielectric offset
...@@ -141,7 +141,7 @@ public: ...@@ -141,7 +141,7 @@ public:
* @param dielectricOffset dielectric offset * @param dielectricOffset dielectric offset
* *
*/ */
void setDielectricOffset( RealOpenMM dielectricOffset ); void setDielectricOffset(RealOpenMM dielectricOffset);
/** /**
* Get probeRadius * Get probeRadius
...@@ -149,7 +149,7 @@ public: ...@@ -149,7 +149,7 @@ public:
* @return probeRadius * @return probeRadius
* *
*/ */
RealOpenMM getProbeRadius( void ) const; RealOpenMM getProbeRadius() const;
/** /**
* Set probe radius * Set probe radius
...@@ -157,7 +157,7 @@ public: ...@@ -157,7 +157,7 @@ public:
* @param probeRadius probe radiue * @param probeRadius probe radiue
* *
*/ */
void setProbeRadius( RealOpenMM probeRadius ); void setProbeRadius(RealOpenMM probeRadius);
/** /**
* Get surfaceAreaFactor * Get surfaceAreaFactor
...@@ -165,7 +165,7 @@ public: ...@@ -165,7 +165,7 @@ public:
* @return surfaceAreaFactor * @return surfaceAreaFactor
* *
*/ */
RealOpenMM getSurfaceAreaFactor( void ) const; RealOpenMM getSurfaceAreaFactor() const;
/** /**
* Set surface area factor * Set surface area factor
...@@ -173,7 +173,7 @@ public: ...@@ -173,7 +173,7 @@ public:
* @param surfaceAreaFactor surface area factor * @param surfaceAreaFactor surface area factor
* *
*/ */
void setSurfaceAreaFactor( RealOpenMM surfaceAreaFactor ); void setSurfaceAreaFactor(RealOpenMM surfaceAreaFactor);
/** /**
* Set atomic radii * Set atomic radii
...@@ -181,7 +181,7 @@ public: ...@@ -181,7 +181,7 @@ public:
* @param atomicRadii input vector of atomic radii * @param atomicRadii input vector of atomic radii
* *
*/ */
void setAtomicRadii( const vector<RealOpenMM>& atomicRadii ); void setAtomicRadii(const vector<RealOpenMM>& atomicRadii);
/** /**
* Get atomic radii * Get atomic radii
...@@ -189,7 +189,7 @@ public: ...@@ -189,7 +189,7 @@ public:
* @param atomicRadii output vector of atomic radii * @param atomicRadii output vector of atomic radii
* *
*/ */
void getAtomicRadii( vector<RealOpenMM>& atomicRadii ) const; void getAtomicRadii(vector<RealOpenMM>& atomicRadii) const;
/** /**
* Set scale factors * Set scale factors
...@@ -197,7 +197,7 @@ public: ...@@ -197,7 +197,7 @@ public:
* @param scaleFactors input vector of scale factors * @param scaleFactors input vector of scale factors
* *
*/ */
void setScaleFactors( const vector<RealOpenMM>& scaleFactors ); void setScaleFactors(const vector<RealOpenMM>& scaleFactors);
/** /**
* Get scale factors * Get scale factors
...@@ -205,7 +205,7 @@ public: ...@@ -205,7 +205,7 @@ public:
* @param scaleFactors output vector of scale factors * @param scaleFactors output vector of scale factors
* *
*/ */
void getScaleFactors( vector<RealOpenMM>& scaleFactors ) const; void getScaleFactors(vector<RealOpenMM>& scaleFactors) const;
/** /**
* Set charges * Set charges
...@@ -213,7 +213,7 @@ public: ...@@ -213,7 +213,7 @@ public:
* @param charges input vector of charges * @param charges input vector of charges
* *
*/ */
void setCharges( const vector<RealOpenMM>& charges ); void setCharges(const vector<RealOpenMM>& charges);
/** /**
* Calculate Grycuk Born radii * Calculate Grycuk Born radii
...@@ -221,7 +221,7 @@ public: ...@@ -221,7 +221,7 @@ public:
* @param particlePositions particle positions * @param particlePositions particle positions
* *
*/ */
void calculateGrycukBornRadii( const vector<RealVec>& particlePositions ); void calculateGrycukBornRadii(const vector<RealVec>& particlePositions);
/** /**
* Get Grycik Born radii (must have called calculateGrycukBornRadii()) * Get Grycik Born radii (must have called calculateGrycukBornRadii())
...@@ -229,7 +229,7 @@ public: ...@@ -229,7 +229,7 @@ public:
* @param bornRadii vector of Born radii * @param bornRadii vector of Born radii
* *
*/ */
void getGrycukBornRadii( vector<RealOpenMM>& bornRadii ) const; void getGrycukBornRadii(vector<RealOpenMM>& bornRadii) const;
private: private:
......
...@@ -46,11 +46,11 @@ using namespace OpenMM; ...@@ -46,11 +46,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine(RealOpenMM cosine,
RealOpenMM idealAngle, RealOpenMM angleK, RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR ) const { RealOpenMM* dEdR) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -67,9 +67,9 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real ...@@ -67,9 +67,9 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
RealOpenMM angle; RealOpenMM angle;
if( cosine >= one ){ if (cosine >= one) {
angle = zero; angle = zero;
} else if( cosine <= -one ){ } else if (cosine <= -one) {
angle = RADIAN*PI_M; angle = RADIAN*PI_M;
} else { } else {
angle = RADIAN*ACOS(cosine); angle = RADIAN*ACOS(cosine);
...@@ -79,10 +79,10 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real ...@@ -79,10 +79,10 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real
RealOpenMM deltaIdeal3 = deltaIdeal*deltaIdeal2; RealOpenMM deltaIdeal3 = deltaIdeal*deltaIdeal2;
RealOpenMM deltaIdeal4 = deltaIdeal2*deltaIdeal2; RealOpenMM deltaIdeal4 = deltaIdeal2*deltaIdeal2;
*dEdR = ( two + three*angleCubic*deltaIdeal + *dEdR = (two + three*angleCubic*deltaIdeal +
four*angleQuartic*deltaIdeal2 + four*angleQuartic*deltaIdeal2 +
five*anglePentic*deltaIdeal3 + five*anglePentic*deltaIdeal3 +
six*angleSextic*deltaIdeal4 ); six*angleSextic*deltaIdeal4);
*dEdR *= RADIAN*angleK*deltaIdeal; *dEdR *= RADIAN*angleK*deltaIdeal;
...@@ -114,12 +114,12 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real ...@@ -114,12 +114,12 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& positionAtomA, const RealVec& positionAtomB, RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomD, const RealVec& positionAtomC, const RealVec& positionAtomD,
RealOpenMM angle, RealOpenMM angleK, RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
RealVec* forces ) const { RealVec* forces) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -140,80 +140,80 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p ...@@ -140,80 +140,80 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p
enum { AD, BD, CD, T, AP, P, CP, M, APxM, CPxM, ADxBD, BDxCD, TxCD, ADxT, dBxAD, CDxdB, LastDeltaAtomIndex }; enum { AD, BD, CD, T, AP, P, CP, M, APxM, CPxM, ADxBD, BDxCD, TxCD, ADxT, dBxAD, CDxdB, LastDeltaAtomIndex };
std::vector<RealOpenMM> deltaR[LastDeltaAtomIndex]; std::vector<RealOpenMM> deltaR[LastDeltaAtomIndex];
for( int ii = 0; ii < LastDeltaAtomIndex; ii++ ){ for (int ii = 0; ii < LastDeltaAtomIndex; ii++) {
deltaR[ii].resize(3); deltaR[ii].resize(3);
} }
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomA, deltaR[AD] ); AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomA, deltaR[AD]);
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomB, deltaR[BD] ); AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomB, deltaR[BD]);
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomC, deltaR[CD] ); AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomC, deltaR[CD]);
AmoebaReferenceForce::getCrossProduct( deltaR[AD], deltaR[CD], deltaR[T] ); AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[CD], deltaR[T]);
RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3( deltaR[T] ); RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3(deltaR[T]);
RealOpenMM delta = AmoebaReferenceForce::getDotProduct3( deltaR[T], deltaR[BD] )/rT2; RealOpenMM delta = AmoebaReferenceForce::getDotProduct3(deltaR[T], deltaR[BD])/rT2;
delta *= -one; delta *= -one;
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
deltaR[P][ii] = positionAtomB[ii] + deltaR[T][ii]*delta; deltaR[P][ii] = positionAtomB[ii] + deltaR[T][ii]*delta;
deltaR[AP][ii] = positionAtomA[ii] - deltaR[P][ii]; deltaR[AP][ii] = positionAtomA[ii] - deltaR[P][ii];
deltaR[CP][ii] = positionAtomC[ii] - deltaR[P][ii]; deltaR[CP][ii] = positionAtomC[ii] - deltaR[P][ii];
} }
RealOpenMM rAp2 = AmoebaReferenceForce::getNormSquared3( deltaR[AP] ); RealOpenMM rAp2 = AmoebaReferenceForce::getNormSquared3(deltaR[AP]);
RealOpenMM rCp2 = AmoebaReferenceForce::getNormSquared3( deltaR[CP] ); RealOpenMM rCp2 = AmoebaReferenceForce::getNormSquared3(deltaR[CP]);
if( rAp2 <= zero && rCp2 <= zero ){ if (rAp2 <= zero && rCp2 <= zero) {
return zero; return zero;
} }
AmoebaReferenceForce::getCrossProduct( deltaR[CP], deltaR[AP], deltaR[M] ); AmoebaReferenceForce::getCrossProduct(deltaR[CP], deltaR[AP], deltaR[M]);
RealOpenMM rm = AmoebaReferenceForce::getNorm3( deltaR[M] ); RealOpenMM rm = AmoebaReferenceForce::getNorm3(deltaR[M]);
if( rm < 1.0e-06 ){ if (rm < 1.0e-06) {
rm = 1.0e-06; rm = 1.0e-06;
} }
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3( deltaR[AP], deltaR[CP] ); RealOpenMM dot = AmoebaReferenceForce::getDotProduct3(deltaR[AP], deltaR[CP]);
RealOpenMM cosine = dot/SQRT( rAp2*rCp2 ); RealOpenMM cosine = dot/SQRT(rAp2*rCp2);
RealOpenMM dEdR; RealOpenMM dEdR;
RealOpenMM energy = getPrefactorsGivenAngleCosine( cosine, angle, angleK, angleCubic, angleQuartic, RealOpenMM energy = getPrefactorsGivenAngleCosine(cosine, angle, angleK, angleCubic, angleQuartic,
anglePentic, angleSextic, &dEdR ); anglePentic, angleSextic, &dEdR);
RealOpenMM termA = -dEdR/(rAp2*rm); RealOpenMM termA = -dEdR/(rAp2*rm);
RealOpenMM termC = dEdR/(rCp2*rm); RealOpenMM termC = dEdR/(rCp2*rm);
AmoebaReferenceForce::getCrossProduct( deltaR[AP], deltaR[M], deltaR[APxM] ); AmoebaReferenceForce::getCrossProduct(deltaR[AP], deltaR[M], deltaR[APxM]);
AmoebaReferenceForce::getCrossProduct( deltaR[CP], deltaR[M], deltaR[CPxM] ); AmoebaReferenceForce::getCrossProduct(deltaR[CP], deltaR[M], deltaR[CPxM]);
// forces will be gathered here // forces will be gathered here
enum { dA, dB, dC, dD, LastDIndex }; enum { dA, dB, dC, dD, LastDIndex };
std::vector<RealOpenMM> forceTerm[LastDIndex]; std::vector<RealOpenMM> forceTerm[LastDIndex];
for( int ii = 0; ii < LastDIndex; ii++ ){ for (int ii = 0; ii < LastDIndex; ii++) {
forceTerm[ii].resize(3); forceTerm[ii].resize(3);
} }
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
forceTerm[dA][ii] = deltaR[APxM][ii]*termA; forceTerm[dA][ii] = deltaR[APxM][ii]*termA;
forceTerm[dC][ii] = deltaR[CPxM][ii]*termC; forceTerm[dC][ii] = deltaR[CPxM][ii]*termC;
forceTerm[dB][ii] = -one*( forceTerm[dA][ii] + forceTerm[dC][ii] ); forceTerm[dB][ii] = -one*(forceTerm[dA][ii] + forceTerm[dC][ii]);
} }
RealOpenMM pTrT2 = AmoebaReferenceForce::getDotProduct3( forceTerm[dB], deltaR[T] ); RealOpenMM pTrT2 = AmoebaReferenceForce::getDotProduct3(forceTerm[dB], deltaR[T]);
pTrT2 /= rT2; pTrT2 /= rT2;
AmoebaReferenceForce::getCrossProduct( deltaR[CD], forceTerm[dB], deltaR[CDxdB] ); AmoebaReferenceForce::getCrossProduct(deltaR[CD], forceTerm[dB], deltaR[CDxdB]);
AmoebaReferenceForce::getCrossProduct( forceTerm[dB], deltaR[AD], deltaR[dBxAD] ); AmoebaReferenceForce::getCrossProduct(forceTerm[dB], deltaR[AD], deltaR[dBxAD]);
if( FABS( pTrT2 ) > 1.0e-08 ){ if (FABS(pTrT2) > 1.0e-08) {
RealOpenMM delta2 = delta*two; RealOpenMM delta2 = delta*two;
AmoebaReferenceForce::getCrossProduct( deltaR[BD], deltaR[CD], deltaR[BDxCD] ); AmoebaReferenceForce::getCrossProduct(deltaR[BD], deltaR[CD], deltaR[BDxCD]);
AmoebaReferenceForce::getCrossProduct( deltaR[T], deltaR[CD], deltaR[TxCD] ); AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[CD], deltaR[TxCD] );
AmoebaReferenceForce::getCrossProduct( deltaR[AD], deltaR[BD], deltaR[ADxBD] ); AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[BD], deltaR[ADxBD]);
AmoebaReferenceForce::getCrossProduct( deltaR[AD], deltaR[T], deltaR[ADxT] ); AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[T], deltaR[ADxT] );
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
RealOpenMM term = deltaR[BDxCD][ii] + delta2*deltaR[TxCD][ii]; RealOpenMM term = deltaR[BDxCD][ii] + delta2*deltaR[TxCD][ii];
forceTerm[dA][ii] += delta*deltaR[CDxdB][ii] + term*pTrT2; forceTerm[dA][ii] += delta*deltaR[CDxdB][ii] + term*pTrT2;
...@@ -221,21 +221,21 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p ...@@ -221,21 +221,21 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p
term = deltaR[ADxBD][ii] + delta2*deltaR[ADxT][ii]; term = deltaR[ADxBD][ii] + delta2*deltaR[ADxT][ii];
forceTerm[dC][ii] += delta*deltaR[dBxAD][ii] + term*pTrT2; forceTerm[dC][ii] += delta*deltaR[dBxAD][ii] + term*pTrT2;
forceTerm[dD][ii] = -( forceTerm[dA][ii] + forceTerm[dB][ii] + forceTerm[dC][ii] ); forceTerm[dD][ii] = -(forceTerm[dA][ii] + forceTerm[dB][ii] + forceTerm[dC][ii]);
} }
} else { } else {
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
forceTerm[dA][ii] += delta*deltaR[CDxdB][ii]; forceTerm[dA][ii] += delta*deltaR[CDxdB][ii];
forceTerm[dC][ii] += delta*deltaR[dBxAD][ii]; forceTerm[dC][ii] += delta*deltaR[dBxAD][ii];
forceTerm[dD][ii] = -( forceTerm[dA][ii] + forceTerm[dB][ii] + forceTerm[dC][ii] ); forceTerm[dD][ii] = -(forceTerm[dA][ii] + forceTerm[dB][ii] + forceTerm[dC][ii]);
} }
} }
// accumulate forces // accumulate forces
for( int jj = 0; jj < 4; jj++ ){ for (int jj = 0; jj < 4; jj++) {
forces[jj][0] = forceTerm[jj][0]; forces[jj][0] = forceTerm[jj][0];
forces[jj][1] = forceTerm[jj][1]; forces[jj][1] = forceTerm[jj][1];
forces[jj][2] = forceTerm[jj][2]; forces[jj][2] = forceTerm[jj][2];
...@@ -245,18 +245,18 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p ...@@ -245,18 +245,18 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p
} }
RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateForceAndEnergy( int numAngles, vector<RealVec>& posData, RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateForceAndEnergy(int numAngles, vector<RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
const std::vector<int>& particle4, const std::vector<int>& particle4,
const std::vector<RealOpenMM>& angle, const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic, const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM angleCubic, RealOpenMM angleCubic,
RealOpenMM angleQuartic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM anglePentic,
RealOpenMM angleSextic, RealOpenMM angleSextic,
vector<RealVec>& forceData) const { vector<RealVec>& forceData) const {
RealOpenMM energy = 0.0; RealOpenMM energy = 0.0;
for (unsigned int ii = 0; ii < static_cast<unsigned int>(numAngles); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(numAngles); ii++) {
int particle1Index = particle1[ii]; int particle1Index = particle1[ii];
...@@ -266,12 +266,12 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateForceAndEnergy( int numAng ...@@ -266,12 +266,12 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateForceAndEnergy( int numAng
RealOpenMM idealAngle = angle[ii]; RealOpenMM idealAngle = angle[ii];
RealOpenMM angleK = kQuadratic[ii]; RealOpenMM angleK = kQuadratic[ii];
RealVec forces[4]; RealVec forces[4];
energy += calculateAngleIxn( posData[particle1Index], posData[particle2Index], posData[particle3Index], posData[particle4Index], energy += calculateAngleIxn(posData[particle1Index], posData[particle2Index], posData[particle3Index], posData[particle4Index],
idealAngle, angleK, angleCubic, angleQuartic, anglePentic, angleSextic, forces ); idealAngle, angleK, angleCubic, angleQuartic, anglePentic, angleSextic, forces);
// accumulate forces // accumulate forces
for( int jj = 0; jj < 3; jj++ ){ for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] -= forces[0][jj]; forceData[particle1Index][jj] -= forces[0][jj];
forceData[particle2Index][jj] -= forces[1][jj]; forceData[particle2Index][jj] -= forces[1][jj];
forceData[particle3Index][jj] -= forces[2][jj]; forceData[particle3Index][jj] -= forces[2][jj];
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
AmoebaReferenceInPlaneAngleForce( ){}; AmoebaReferenceInPlaneAngleForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~AmoebaReferenceInPlaneAngleForce( ){}; ~AmoebaReferenceInPlaneAngleForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -73,18 +73,18 @@ public: ...@@ -73,18 +73,18 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numAngles, std::vector<OpenMM::RealVec>& posData, RealOpenMM calculateForceAndEnergy(int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
const std::vector<int>& particle4, const std::vector<int>& particle4,
const std::vector<RealOpenMM>& angle, const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic, const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM globalAngleCubic, RealOpenMM globalAngleCubic,
RealOpenMM globalAngleQuartic, RealOpenMM globalAngleQuartic,
RealOpenMM globalAnglePentic, RealOpenMM globalAnglePentic,
RealOpenMM globalAngleSextic, RealOpenMM globalAngleSextic,
std::vector<OpenMM::RealVec>& forceData ) const; std::vector<OpenMM::RealVec>& forceData) const;
private: private:
...@@ -106,10 +106,10 @@ private: ...@@ -106,10 +106,10 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM idealAngle, RealOpenMM angleK, RealOpenMM getPrefactorsGivenAngleCosine(RealOpenMM cosine, RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR ) const; RealOpenMM* dEdR) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -131,12 +131,12 @@ private: ...@@ -131,12 +131,12 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateAngleIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB, RealOpenMM calculateAngleIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD, const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
RealOpenMM angle, RealOpenMM angleK, RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces ) const; OpenMM::RealVec* forces) const;
}; };
......
...@@ -789,7 +789,7 @@ void AmoebaReferenceMultipoleForce::convergeInduceDipolesBySOR(const vector<Mult ...@@ -789,7 +789,7 @@ void AmoebaReferenceMultipoleForce::convergeInduceDipolesBySOR(const vector<Mult
// (2) iterations == max iterations or // (2) iterations == max iterations or
// (3) convergence factor (spsilon) increases // (3) convergence factor (spsilon) increases
while(!done) { while (!done) {
RealOpenMM epsilon = updateInducedDipoleFields(particleData, updateInducedDipoleField); RealOpenMM epsilon = updateInducedDipoleFields(particleData, updateInducedDipoleField);
epsilon = _polarSOR*_debye*SQRT(epsilon/(static_cast<RealOpenMM>(_numParticles))); epsilon = _polarSOR*_debye*SQRT(epsilon/(static_cast<RealOpenMM>(_numParticles)));
...@@ -1868,7 +1868,7 @@ void AmoebaReferenceMultipoleForce::calculateElectrostaticPotential(const vector ...@@ -1868,7 +1868,7 @@ void AmoebaReferenceMultipoleForce::calculateElectrostaticPotential(const vector
for (unsigned int ii = 0; ii < _numParticles; ii++) { for (unsigned int ii = 0; ii < _numParticles; ii++) {
for (unsigned int jj = 0; jj < grid.size(); jj++) { for (unsigned int jj = 0; jj < grid.size(); jj++) {
potential[jj] += calculateElectrostaticPotentialForParticleGridPoint(particleData[ii], grid[jj] ); potential[jj] += calculateElectrostaticPotentialForParticleGridPoint(particleData[ii], grid[jj]);
} }
} }
...@@ -4947,7 +4947,7 @@ void AmoebaReferencePmeMultipoleForce::calculateFixedMultipoleField(const vector ...@@ -4947,7 +4947,7 @@ void AmoebaReferencePmeMultipoleForce::calculateFixedMultipoleField(const vector
/** /**
* This is called from computeBsplines(). It calculates the spline coefficients for a single atom along a single axis. * This is called from computeBsplines(). It calculates the spline coefficients for a single atom along a single axis.
*/ */
void AmoebaReferencePmeMultipoleForce::computeBSplinePoint(vector<RealOpenMM4>& thetai, RealOpenMM w ) void AmoebaReferencePmeMultipoleForce::computeBSplinePoint(vector<RealOpenMM4>& thetai, RealOpenMM w)
{ {
RealOpenMM array[AMOEBA_PME_ORDER*AMOEBA_PME_ORDER]; RealOpenMM array[AMOEBA_PME_ORDER*AMOEBA_PME_ORDER];
......
...@@ -354,7 +354,7 @@ public: ...@@ -354,7 +354,7 @@ public:
* Destructor * Destructor
* *
*/ */
virtual ~AmoebaReferenceMultipoleForce(){}; virtual ~AmoebaReferenceMultipoleForce() {};
/** /**
* Get nonbonded method. * Get nonbonded method.
......
...@@ -48,12 +48,12 @@ using namespace OpenMM; ...@@ -48,12 +48,12 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const RealVec& positionAtomA, const RealVec& positionAtomB, RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomD, const RealVec& positionAtomC, const RealVec& positionAtomD,
RealOpenMM angleK, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
RealVec* forces ) const { RealVec* forces) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -76,34 +76,34 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const ...@@ -76,34 +76,34 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// and various intermediate terms // and various intermediate terms
std::vector<RealOpenMM> deltaR[LastDeltaIndex]; std::vector<RealOpenMM> deltaR[LastDeltaIndex];
for( int ii = 0; ii < LastDeltaIndex; ii++ ){ for (int ii = 0; ii < LastDeltaIndex; ii++) {
deltaR[ii].resize(3); deltaR[ii].resize(3);
} }
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomA, deltaR[AB] ); AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomA, deltaR[AB]);
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomC, deltaR[CB] ); AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomC, deltaR[CB]);
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomD, deltaR[DB] ); AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomD, deltaR[DB]);
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomA, deltaR[AD] ); AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomA, deltaR[AD]);
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomC, deltaR[CD] ); AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomC, deltaR[CD]);
RealOpenMM rDB2 = AmoebaReferenceForce::getNormSquared3( deltaR[DB] ); RealOpenMM rDB2 = AmoebaReferenceForce::getNormSquared3(deltaR[DB]);
RealOpenMM rAD2 = AmoebaReferenceForce::getNormSquared3( deltaR[AD] ); RealOpenMM rAD2 = AmoebaReferenceForce::getNormSquared3(deltaR[AD]);
RealOpenMM rCD2 = AmoebaReferenceForce::getNormSquared3( deltaR[CD] ); RealOpenMM rCD2 = AmoebaReferenceForce::getNormSquared3(deltaR[CD]);
std::vector<RealOpenMM> tempVector(3); std::vector<RealOpenMM> tempVector(3);
AmoebaReferenceForce::getCrossProduct( deltaR[CB], deltaR[DB], tempVector ); AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[DB], tempVector);
RealOpenMM eE = AmoebaReferenceForce::getDotProduct3( deltaR[AB], tempVector ); RealOpenMM eE = AmoebaReferenceForce::getDotProduct3(deltaR[AB], tempVector );
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3( deltaR[AD], deltaR[CD] ); RealOpenMM dot = AmoebaReferenceForce::getDotProduct3(deltaR[AD], deltaR[CD]);
RealOpenMM cc = rAD2*rCD2 - dot*dot; RealOpenMM cc = rAD2*rCD2 - dot*dot;
if( rDB2 <= zero || cc == zero ){ if (rDB2 <= zero || cc == zero) {
return zero; return zero;
} }
RealOpenMM bkk2 = rDB2 - eE*eE/cc; RealOpenMM bkk2 = rDB2 - eE*eE/cc;
RealOpenMM cosine = SQRT(bkk2/rDB2); RealOpenMM cosine = SQRT(bkk2/rDB2);
RealOpenMM angle; RealOpenMM angle;
if( cosine >= one ){ if (cosine >= one) {
angle = zero; angle = zero;
} else if( cosine <= -one ){ } else if (cosine <= -one) {
angle = PI_M; angle = PI_M;
} else { } else {
angle = RADIAN*ACOS(cosine); angle = RADIAN*ACOS(cosine);
...@@ -122,7 +122,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const ...@@ -122,7 +122,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
dEdDt *= angleK*dt*RADIAN; dEdDt *= angleK*dt*RADIAN;
RealOpenMM dEdCos = dEdDt/SQRT(cc*bkk2); RealOpenMM dEdCos = dEdDt/SQRT(cc*bkk2);
if( eE > zero ){ if (eE > zero) {
dEdCos *= -one; dEdCos *= -one;
} }
...@@ -131,20 +131,20 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const ...@@ -131,20 +131,20 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
std::vector<RealOpenMM> dccd[LastAtomIndex]; std::vector<RealOpenMM> dccd[LastAtomIndex];
std::vector<RealOpenMM> deed[LastAtomIndex]; std::vector<RealOpenMM> deed[LastAtomIndex];
std::vector<RealOpenMM> subForce[LastAtomIndex]; std::vector<RealOpenMM> subForce[LastAtomIndex];
for( int ii = 0; ii < LastAtomIndex; ii++ ){ for (int ii = 0; ii < LastAtomIndex; ii++) {
dccd[ii].resize(3); dccd[ii].resize(3);
deed[ii].resize(3); deed[ii].resize(3);
subForce[ii].resize(3); subForce[ii].resize(3);
} }
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
dccd[A][ii] = (deltaR[AD][ii]*rCD2 - deltaR[CD][ii]*dot)*term; dccd[A][ii] = (deltaR[AD][ii]*rCD2 - deltaR[CD][ii]*dot)*term;
dccd[C][ii] = (deltaR[CD][ii]*rAD2 - deltaR[AD][ii]*dot)*term; dccd[C][ii] = (deltaR[CD][ii]*rAD2 - deltaR[AD][ii]*dot)*term;
dccd[D][ii] = -one*(dccd[A][ii] + dccd[C][ii]); dccd[D][ii] = -one*(dccd[A][ii] + dccd[C][ii]);
} }
AmoebaReferenceForce::getCrossProduct( deltaR[DB], deltaR[CB], deed[A] ); AmoebaReferenceForce::getCrossProduct(deltaR[DB], deltaR[CB], deed[A]);
AmoebaReferenceForce::getCrossProduct( deltaR[AB], deltaR[DB], deed[C] ); AmoebaReferenceForce::getCrossProduct(deltaR[AB], deltaR[DB], deed[C]);
AmoebaReferenceForce::getCrossProduct( deltaR[CB], deltaR[AB], deed[D] ); AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[AB], deed[D]);
term = eE/rDB2; term = eE/rDB2;
deed[D][0] += deltaR[DB][0]*term; deed[D][0] += deltaR[DB][0]*term;
...@@ -156,23 +156,23 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const ...@@ -156,23 +156,23 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// forces // forces
// calculate forces for atoms a, c, d // calculate forces for atoms a, c, d
// the force for b is then -( a+ c + d) // the force for b is then -(a+ c + d)
for( int jj = 0; jj < LastAtomIndex; jj++ ){ for (int jj = 0; jj < LastAtomIndex; jj++) {
// A, C, D // A, C, D
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
subForce[jj][ii] = dEdCos*( dccd[jj][ii] + deed[jj][ii] ); subForce[jj][ii] = dEdCos*(dccd[jj][ii] + deed[jj][ii]);
} }
if( jj == 0 )jj++; // skip B if (jj == 0)jj++; // skip B
// now compute B // now compute B
if( jj == 3 ){ if (jj == 3) {
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
subForce[1][ii] = -one*(subForce[0][ii] + subForce[2][ii] + subForce[3][ii]); subForce[1][ii] = -one*(subForce[0][ii] + subForce[2][ii] + subForce[3][ii]);
} }
} }
...@@ -180,8 +180,8 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const ...@@ -180,8 +180,8 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// add in forces // add in forces
for( int jj = 0; jj < LastAtomIndex; jj++ ){ for (int jj = 0; jj < LastAtomIndex; jj++) {
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
forces[jj][ii] = subForce[jj][ii]; forces[jj][ii] = subForce[jj][ii];
} }
} }
...@@ -196,7 +196,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const ...@@ -196,7 +196,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
return energy; return energy;
} }
RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateForceAndEnergy( int numOutOfPlaneBends, vector<RealVec>& posData, RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateForceAndEnergy(int numOutOfPlaneBends, vector<RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
...@@ -215,9 +215,9 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateForceAndEnergy( int numO ...@@ -215,9 +215,9 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateForceAndEnergy( int numO
int particle4Index = particle4[ii]; int particle4Index = particle4[ii];
RealOpenMM kAngle = kQuadratic[ii]; RealOpenMM kAngle = kQuadratic[ii];
RealVec forces[4]; RealVec forces[4];
energy += calculateOutOfPlaneBendIxn( posData[particle1Index], posData[particle2Index], posData[particle3Index], posData[particle4Index], energy += calculateOutOfPlaneBendIxn(posData[particle1Index], posData[particle2Index], posData[particle3Index], posData[particle4Index],
kAngle, angleCubic, angleQuartic, anglePentic, angleSextic, forces ); kAngle, angleCubic, angleQuartic, anglePentic, angleSextic, forces);
for( int jj = 0; jj < 3; jj++ ){ for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] -= forces[0][jj]; forceData[particle1Index][jj] -= forces[0][jj];
forceData[particle2Index][jj] -= forces[1][jj]; forceData[particle2Index][jj] -= forces[1][jj];
forceData[particle3Index][jj] -= forces[2][jj]; forceData[particle3Index][jj] -= forces[2][jj];
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
AmoebaReferenceOutOfPlaneBendForce( ){}; AmoebaReferenceOutOfPlaneBendForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~AmoebaReferenceOutOfPlaneBendForce( ){}; ~AmoebaReferenceOutOfPlaneBendForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -72,17 +72,17 @@ public: ...@@ -72,17 +72,17 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numOutOfPlaneBends, std::vector<OpenMM::RealVec>& posData, RealOpenMM calculateForceAndEnergy(int numOutOfPlaneBends, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
const std::vector<int>& particle4, const std::vector<int>& particle4,
const std::vector<RealOpenMM>& kAngle, const std::vector<RealOpenMM>& kAngle,
RealOpenMM angleCubic, RealOpenMM angleCubic,
RealOpenMM angleQuartic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM anglePentic,
RealOpenMM angleSextic, RealOpenMM angleSextic,
std::vector<OpenMM::RealVec>& forceData) const; std::vector<OpenMM::RealVec>& forceData) const;
private: private:
...@@ -105,12 +105,12 @@ private: ...@@ -105,12 +105,12 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateOutOfPlaneBendIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB, RealOpenMM calculateOutOfPlaneBendIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD, const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
RealOpenMM angleK, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic, RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic, RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces ) const; OpenMM::RealVec* forces) const;
}; };
......
...@@ -46,10 +46,10 @@ using namespace OpenMM; ...@@ -46,10 +46,10 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec& positionAtomA, const RealVec& positionAtomB, RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomD, const RealVec& positionAtomC, const RealVec& positionAtomD,
const RealVec& positionAtomE, const RealVec& positionAtomF, const RealVec& positionAtomE, const RealVec& positionAtomF,
RealOpenMM piTorsionK, RealVec* forces ) const { RealOpenMM piTorsionK, RealVec* forces) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -64,23 +64,23 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec& ...@@ -64,23 +64,23 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
enum { AD, BD, EC, FC, P, Q, CP, DC, QD, T, U, TU, DP, QC, dT, dU, dP, dQ, dC1, dC2, dD1, dD2, LastDeltaIndex }; enum { AD, BD, EC, FC, P, Q, CP, DC, QD, T, U, TU, DP, QC, dT, dU, dP, dQ, dC1, dC2, dD1, dD2, LastDeltaIndex };
std::vector<RealOpenMM> deltaR[LastDeltaIndex]; std::vector<RealOpenMM> deltaR[LastDeltaIndex];
for( unsigned int ii = 0; ii < LastDeltaIndex; ii++ ){ for (unsigned int ii = 0; ii < LastDeltaIndex; ii++) {
deltaR[ii].resize(3); deltaR[ii].resize(3);
} }
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomA, deltaR[AD] ); AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomA, deltaR[AD]);
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomB, deltaR[BD] ); AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomB, deltaR[BD]);
AmoebaReferenceForce::loadDeltaR( positionAtomC, positionAtomE, deltaR[EC] ); AmoebaReferenceForce::loadDeltaR(positionAtomC, positionAtomE, deltaR[EC]);
AmoebaReferenceForce::loadDeltaR( positionAtomC, positionAtomF, deltaR[FC] ); AmoebaReferenceForce::loadDeltaR(positionAtomC, positionAtomF, deltaR[FC]);
enum { A, B, C, D, E, F, LastAtomIndex }; enum { A, B, C, D, E, F, LastAtomIndex };
std::vector<RealOpenMM> d[LastAtomIndex]; std::vector<RealOpenMM> d[LastAtomIndex];
for( unsigned int ii = 0; ii < LastAtomIndex; ii++ ){ for (unsigned int ii = 0; ii < LastAtomIndex; ii++) {
d[ii].resize(3); d[ii].resize(3);
} }
AmoebaReferenceForce::getCrossProduct( deltaR[AD], deltaR[BD], deltaR[P] ); AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[BD], deltaR[P]);
AmoebaReferenceForce::getCrossProduct( deltaR[EC], deltaR[FC], deltaR[Q] ); AmoebaReferenceForce::getCrossProduct(deltaR[EC], deltaR[FC], deltaR[Q]);
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
deltaR[CP][ii] = -deltaR[P][ii]; deltaR[CP][ii] = -deltaR[P][ii];
deltaR[DC][ii] = positionAtomD[ii] - positionAtomC[ii]; deltaR[DC][ii] = positionAtomD[ii] - positionAtomC[ii];
deltaR[QD][ii] = deltaR[Q][ii]; deltaR[QD][ii] = deltaR[Q][ii];
...@@ -88,24 +88,24 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec& ...@@ -88,24 +88,24 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
deltaR[P][ii] += positionAtomC[ii]; deltaR[P][ii] += positionAtomC[ii];
deltaR[Q][ii] += positionAtomD[ii]; deltaR[Q][ii] += positionAtomD[ii];
} }
AmoebaReferenceForce::getCrossProduct( deltaR[CP], deltaR[DC], deltaR[T] ); AmoebaReferenceForce::getCrossProduct(deltaR[CP], deltaR[DC], deltaR[T] );
AmoebaReferenceForce::getCrossProduct( deltaR[DC], deltaR[QD], deltaR[U] ); AmoebaReferenceForce::getCrossProduct(deltaR[DC], deltaR[QD], deltaR[U] );
AmoebaReferenceForce::getCrossProduct( deltaR[T], deltaR[U], deltaR[TU] ); AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[U], deltaR[TU]);
RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3( deltaR[T] ); RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3(deltaR[T]);
RealOpenMM rU2 = AmoebaReferenceForce::getNormSquared3( deltaR[U] ); RealOpenMM rU2 = AmoebaReferenceForce::getNormSquared3(deltaR[U]);
RealOpenMM rTrU = SQRT( rT2*rU2 ); RealOpenMM rTrU = SQRT(rT2*rU2);
if( rTrU <= zero ){ if (rTrU <= zero) {
return zero; return zero;
} }
RealOpenMM rDC = AmoebaReferenceForce::getNorm3( deltaR[DC] ); RealOpenMM rDC = AmoebaReferenceForce::getNorm3(deltaR[DC]);
RealOpenMM cosine = AmoebaReferenceForce::getDotProduct3( deltaR[T], deltaR[U] ); RealOpenMM cosine = AmoebaReferenceForce::getDotProduct3(deltaR[T], deltaR[U]);
cosine /= rTrU; cosine /= rTrU;
RealOpenMM sine = AmoebaReferenceForce::getDotProduct3( deltaR[DC], deltaR[TU] ); RealOpenMM sine = AmoebaReferenceForce::getDotProduct3(deltaR[DC], deltaR[TU]);
sine /= ( rDC*rTrU ); sine /= (rDC*rTrU);
RealOpenMM cosine2 = cosine*cosine - sine*sine; RealOpenMM cosine2 = cosine*cosine - sine*sine;
RealOpenMM sine2 = two*cosine*sine; RealOpenMM sine2 = two*cosine*sine;
...@@ -115,37 +115,37 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec& ...@@ -115,37 +115,37 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
RealOpenMM dedphi = piTorsionK*dphi2; RealOpenMM dedphi = piTorsionK*dphi2;
for( unsigned int ii = 0; ii < 3; ii++ ){ for (unsigned int ii = 0; ii < 3; ii++) {
deltaR[DP][ii] = positionAtomD[ii] - deltaR[P][ii]; deltaR[DP][ii] = positionAtomD[ii] - deltaR[P][ii];
deltaR[QC][ii] = deltaR[Q][ii] - positionAtomC[ii]; deltaR[QC][ii] = deltaR[Q][ii] - positionAtomC[ii];
} }
RealOpenMM factorT = dedphi/( rDC*rT2 ); RealOpenMM factorT = dedphi/(rDC*rT2);
RealOpenMM factorU = -dedphi/( rDC*rU2 ); RealOpenMM factorU = -dedphi/(rDC*rU2);
AmoebaReferenceForce::getCrossProduct( deltaR[T], deltaR[DC], deltaR[dT] ); AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[DC], deltaR[dT] );
AmoebaReferenceForce::getCrossProduct( deltaR[U], deltaR[DC], deltaR[dU] ); AmoebaReferenceForce::getCrossProduct(deltaR[U], deltaR[DC], deltaR[dU] );
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
deltaR[dT][ii] *= factorT; deltaR[dT][ii] *= factorT;
deltaR[dU][ii] *= factorU; deltaR[dU][ii] *= factorU;
} }
AmoebaReferenceForce::getCrossProduct( deltaR[dT], deltaR[DC], deltaR[dP] ); AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[DC], deltaR[dP] );
AmoebaReferenceForce::getCrossProduct( deltaR[dU], deltaR[DC], deltaR[dQ] ); AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[DC], deltaR[dQ] );
AmoebaReferenceForce::getCrossProduct( deltaR[DP], deltaR[dT], deltaR[dC1] ); AmoebaReferenceForce::getCrossProduct(deltaR[DP], deltaR[dT], deltaR[dC1] );
AmoebaReferenceForce::getCrossProduct( deltaR[dU], deltaR[QD], deltaR[dC2] ); AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[QD], deltaR[dC2] );
AmoebaReferenceForce::getCrossProduct( deltaR[dT], deltaR[CP], deltaR[dD1] ); AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[CP], deltaR[dD1] );
AmoebaReferenceForce::getCrossProduct( deltaR[QC], deltaR[dU], deltaR[dD2] ); AmoebaReferenceForce::getCrossProduct(deltaR[QC], deltaR[dU], deltaR[dD2] );
AmoebaReferenceForce::getCrossProduct( deltaR[BD], deltaR[dP], d[A] ); AmoebaReferenceForce::getCrossProduct(deltaR[BD], deltaR[dP], d[A] );
AmoebaReferenceForce::getCrossProduct( deltaR[dP], deltaR[AD], d[B] ); AmoebaReferenceForce::getCrossProduct(deltaR[dP], deltaR[AD], d[B] );
AmoebaReferenceForce::getCrossProduct( deltaR[FC], deltaR[dQ], d[E] ); AmoebaReferenceForce::getCrossProduct(deltaR[FC], deltaR[dQ], d[E] );
AmoebaReferenceForce::getCrossProduct( deltaR[dQ], deltaR[EC], d[F] ); AmoebaReferenceForce::getCrossProduct(deltaR[dQ], deltaR[EC], d[F] );
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
d[C][ii] = deltaR[dC1][ii] + deltaR[dC2][ii] + deltaR[dP][ii] - d[E][ii] - d[F][ii]; d[C][ii] = deltaR[dC1][ii] + deltaR[dC2][ii] + deltaR[dP][ii] - d[E][ii] - d[F][ii];
d[D][ii] = deltaR[dD1][ii] + deltaR[dD2][ii] + deltaR[dQ][ii] - d[A][ii] - d[B][ii]; d[D][ii] = deltaR[dD1][ii] + deltaR[dD2][ii] + deltaR[dQ][ii] - d[A][ii] - d[B][ii];
} }
...@@ -186,15 +186,15 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec& ...@@ -186,15 +186,15 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
} }
RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy( int numPiTorsions, vector<RealVec>& posData, RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy(int numPiTorsions, vector<RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
const std::vector<int>& particle4, const std::vector<int>& particle4,
const std::vector<int>& particle5, const std::vector<int>& particle5,
const std::vector<int>& particle6, const std::vector<int>& particle6,
const std::vector<RealOpenMM>& kTorsion, const std::vector<RealOpenMM>& kTorsion,
vector<RealVec>& forceData ) const { vector<RealVec>& forceData) const {
RealOpenMM energy = 0.0; RealOpenMM energy = 0.0;
for (unsigned int ii = 0; ii < static_cast<unsigned int>(numPiTorsions); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(numPiTorsions); ii++) {
...@@ -206,13 +206,13 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy( int numPiTors ...@@ -206,13 +206,13 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy( int numPiTors
int particle6Index = particle6[ii]; int particle6Index = particle6[ii];
RealVec forces[6]; RealVec forces[6];
energy += calculatePiTorsionIxn( posData[particle1Index], posData[particle2Index], energy += calculatePiTorsionIxn(posData[particle1Index], posData[particle2Index],
posData[particle3Index], posData[particle4Index], posData[particle3Index], posData[particle4Index],
posData[particle5Index], posData[particle6Index], posData[particle5Index], posData[particle6Index],
kTorsion[ii], forces ); kTorsion[ii], forces);
// accumulate forces // accumulate forces
for( int jj = 0; jj < 3; jj++ ){ for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] -= forces[0][jj]; forceData[particle1Index][jj] -= forces[0][jj];
forceData[particle2Index][jj] -= forces[1][jj]; forceData[particle2Index][jj] -= forces[1][jj];
forceData[particle3Index][jj] -= forces[2][jj]; forceData[particle3Index][jj] -= forces[2][jj];
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
AmoebaReferencePiTorsionForce( ){}; AmoebaReferencePiTorsionForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~AmoebaReferencePiTorsionForce( ){}; ~AmoebaReferencePiTorsionForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -72,15 +72,15 @@ public: ...@@ -72,15 +72,15 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numPiTorsions, std::vector<OpenMM::RealVec>& posData, RealOpenMM calculateForceAndEnergy(int numPiTorsions, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
const std::vector<int>& particle4, const std::vector<int>& particle4,
const std::vector<int>& particle5, const std::vector<int>& particle5,
const std::vector<int>& particle6, const std::vector<int>& particle6,
const std::vector<RealOpenMM>& kTorsion, const std::vector<RealOpenMM>& kTorsion,
std::vector<OpenMM::RealVec>& forceData ) const; std::vector<OpenMM::RealVec>& forceData) const;
private: private:
...@@ -102,10 +102,10 @@ private: ...@@ -102,10 +102,10 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculatePiTorsionIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB, RealOpenMM calculatePiTorsionIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD, const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
const OpenMM::RealVec& positionAtomE, const OpenMM::RealVec& positionAtomF, const OpenMM::RealVec& positionAtomE, const OpenMM::RealVec& positionAtomF,
RealOpenMM kTorsion, OpenMM::RealVec* forces ) const; RealOpenMM kTorsion, OpenMM::RealVec* forces) const;
}; };
......
...@@ -49,11 +49,11 @@ using namespace OpenMM; ...@@ -49,11 +49,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealVec& positionAtomA, const RealVec& positionAtomB, RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomC,
RealOpenMM lengthAB, RealOpenMM lengthCB, RealOpenMM lengthAB, RealOpenMM lengthCB,
RealOpenMM idealAngle, RealOpenMM k1Parameter, RealOpenMM idealAngle, RealOpenMM k1Parameter,
RealOpenMM k2Parameter, RealVec* forces ) const { RealOpenMM k2Parameter, RealVec* forces) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -73,28 +73,28 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV ...@@ -73,28 +73,28 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// and various intermediate terms // and various intermediate terms
std::vector<RealOpenMM> deltaR[LastDeltaIndex]; std::vector<RealOpenMM> deltaR[LastDeltaIndex];
for( unsigned int ii = 0; ii < LastDeltaIndex; ii++ ){ for (unsigned int ii = 0; ii < LastDeltaIndex; ii++) {
deltaR[ii].resize(3); deltaR[ii].resize(3);
} }
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomA, deltaR[AB] ); AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomA, deltaR[AB]);
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomC, deltaR[CB] ); AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomC, deltaR[CB]);
RealOpenMM rAB2 = AmoebaReferenceForce::getNormSquared3( deltaR[AB] ); RealOpenMM rAB2 = AmoebaReferenceForce::getNormSquared3(deltaR[AB]);
RealOpenMM rAB = SQRT( rAB2 ); RealOpenMM rAB = SQRT(rAB2);
RealOpenMM rCB2 = AmoebaReferenceForce::getNormSquared3( deltaR[CB] ); RealOpenMM rCB2 = AmoebaReferenceForce::getNormSquared3(deltaR[CB]);
RealOpenMM rCB = SQRT( rCB2 ); RealOpenMM rCB = SQRT(rCB2);
AmoebaReferenceForce::getCrossProduct( deltaR[CB], deltaR[AB], deltaR[CBxAB] ); AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[AB], deltaR[CBxAB]);
RealOpenMM rP = AmoebaReferenceForce::getNorm3( deltaR[CBxAB] ); RealOpenMM rP = AmoebaReferenceForce::getNorm3(deltaR[CBxAB]);
if( rP <= zero ){ if (rP <= zero) {
return zero; return zero;
} }
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3( deltaR[CB], deltaR[AB] ); RealOpenMM dot = AmoebaReferenceForce::getDotProduct3(deltaR[CB], deltaR[AB]);
RealOpenMM cosine = dot/(rAB*rCB); RealOpenMM cosine = dot/(rAB*rCB);
RealOpenMM angle; RealOpenMM angle;
if( cosine >= one ){ if (cosine >= one) {
angle = zero; angle = zero;
} else if( cosine <= -one ){ } else if (cosine <= -one) {
angle = PI_M; angle = PI_M;
} else { } else {
angle = RADIAN*ACOS(cosine); angle = RADIAN*ACOS(cosine);
...@@ -105,9 +105,9 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV ...@@ -105,9 +105,9 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// P = CBxAB // P = CBxAB
AmoebaReferenceForce::getCrossProduct( deltaR[AB], deltaR[CBxAB], deltaR[ABxP] ); AmoebaReferenceForce::getCrossProduct(deltaR[AB], deltaR[CBxAB], deltaR[ABxP]);
AmoebaReferenceForce::getCrossProduct( deltaR[CB], deltaR[CBxAB], deltaR[CBxP] ); AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[CBxAB], deltaR[CBxP]);
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
deltaR[ABxP][ii] *= termA; deltaR[ABxP][ii] *= termA;
deltaR[CBxP][ii] *= termC; deltaR[CBxP][ii] *= termC;
} }
...@@ -123,22 +123,22 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV ...@@ -123,22 +123,22 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// forces // forces
// calculate forces for atoms a, b, c // calculate forces for atoms a, b, c
// the force for b is then -( a + c) // the force for b is then -(a + c)
std::vector<RealOpenMM> subForce[LastAtomIndex]; std::vector<RealOpenMM> subForce[LastAtomIndex];
for( int ii = 0; ii < LastAtomIndex; ii++ ){ for (int ii = 0; ii < LastAtomIndex; ii++) {
subForce[ii].resize(3); subForce[ii].resize(3);
} }
RealOpenMM dt = angle - idealAngle*RADIAN; RealOpenMM dt = angle - idealAngle*RADIAN;
for( int jj = 0; jj < 3; jj++ ){ for (int jj = 0; jj < 3; jj++) {
subForce[A][jj] = k1Parameter*dt*termA*deltaR[AB][jj] + drkk*deltaR[ABxP][jj]; subForce[A][jj] = k1Parameter*dt*termA*deltaR[AB][jj] + drkk*deltaR[ABxP][jj];
subForce[C][jj] = k2Parameter*dt*termC*deltaR[CB][jj] + drkk*deltaR[CBxP][jj]; subForce[C][jj] = k2Parameter*dt*termC*deltaR[CB][jj] + drkk*deltaR[CBxP][jj];
subForce[B][jj] = -( subForce[A][jj] + subForce[C][jj] ); subForce[B][jj] = -(subForce[A][jj] + subForce[C][jj]);
} }
// add in forces // add in forces
for( int jj = 0; jj < LastAtomIndex; jj++ ){ for (int jj = 0; jj < LastAtomIndex; jj++) {
forces[jj][0] = subForce[jj][0]; forces[jj][0] = subForce[jj][0];
forces[jj][1] = subForce[jj][1]; forces[jj][1] = subForce[jj][1];
forces[jj][2] = subForce[jj][2]; forces[jj][2] = subForce[jj][2];
...@@ -149,7 +149,7 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV ...@@ -149,7 +149,7 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
return dt*drkk; return dt*drkk;
} }
RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStretchBends, vector<RealVec>& posData, RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy(int numStretchBends, vector<RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
...@@ -170,11 +170,11 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStre ...@@ -170,11 +170,11 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStre
RealOpenMM angleK1 = k1Quadratic[ii]; RealOpenMM angleK1 = k1Quadratic[ii];
RealOpenMM angleK2 = k2Quadratic[ii]; RealOpenMM angleK2 = k2Quadratic[ii];
RealVec forces[3]; RealVec forces[3];
energy += calculateStretchBendIxn( posData[particle1Index], posData[particle2Index], posData[particle3Index], energy += calculateStretchBendIxn(posData[particle1Index], posData[particle2Index], posData[particle3Index],
abLength, cbLength, idealAngle, angleK1, angleK2, forces ); abLength, cbLength, idealAngle, angleK1, angleK2, forces);
// accumulate forces // accumulate forces
for( int jj = 0; jj < 3; jj++ ){ for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] -= forces[0][jj]; forceData[particle1Index][jj] -= forces[0][jj];
forceData[particle2Index][jj] -= forces[1][jj]; forceData[particle2Index][jj] -= forces[1][jj];
forceData[particle3Index][jj] -= forces[2][jj]; forceData[particle3Index][jj] -= forces[2][jj];
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
AmoebaReferenceStretchBendForce( ){}; AmoebaReferenceStretchBendForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~AmoebaReferenceStretchBendForce( ){}; ~AmoebaReferenceStretchBendForce() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -70,16 +70,16 @@ public: ...@@ -70,16 +70,16 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numAngles, std::vector<OpenMM::RealVec>& posData, RealOpenMM calculateForceAndEnergy(int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1, const std::vector<int>& particle1,
const std::vector<int>& particle2, const std::vector<int>& particle2,
const std::vector<int>& particle3, const std::vector<int>& particle3,
const std::vector<RealOpenMM>& lengthABParameters, const std::vector<RealOpenMM>& lengthABParameters,
const std::vector<RealOpenMM>& lengthCBParameters, const std::vector<RealOpenMM>& lengthCBParameters,
const std::vector<RealOpenMM>& angle, const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& k1Quadratic, const std::vector<RealOpenMM>& k1Quadratic,
const std::vector<RealOpenMM>& k2Quadratic, const std::vector<RealOpenMM>& k2Quadratic,
std::vector<OpenMM::RealVec>& forceData ) const; std::vector<OpenMM::RealVec>& forceData) const;
private: private:
...@@ -102,11 +102,11 @@ private: ...@@ -102,11 +102,11 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM calculateStretchBendIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB, RealOpenMM calculateStretchBendIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomC,
RealOpenMM lengthAB, RealOpenMM lengthCB, RealOpenMM lengthAB, RealOpenMM lengthCB,
RealOpenMM idealAngle, RealOpenMM k1Parameter, RealOpenMM idealAngle, RealOpenMM k1Parameter,
RealOpenMM k2Parameter, OpenMM::RealVec* forces ) const; RealOpenMM k2Parameter, OpenMM::RealVec* forces) const;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment