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

Cleaned up formatting of AMOEBA reference code

parent 25a308e6
......@@ -91,16 +91,16 @@ ReferenceCalcAmoebaBondForceKernel::~ReferenceCalcAmoebaBondForceKernel() {
void ReferenceCalcAmoebaBondForceKernel::initialize(const System& system, const AmoebaBondForce& force) {
numBonds = force.getNumBonds();
for( int ii = 0; ii < numBonds; ii++) {
for (int ii = 0; ii < numBonds; ii++) {
int particle1Index, particle2Index;
double lengthValue, kValue;
force.getBondParameters(ii, particle1Index, particle2Index, lengthValue, kValue );
force.getBondParameters(ii, particle1Index, particle2Index, lengthValue, kValue);
particle1.push_back( particle1Index );
particle2.push_back( particle2Index );
length.push_back( static_cast<RealOpenMM>( lengthValue ) );
kQuadratic.push_back( static_cast<RealOpenMM>( kValue ) );
particle1.push_back(particle1Index);
particle2.push_back(particle2Index);
length.push_back( static_cast<RealOpenMM>(lengthValue));
kQuadratic.push_back(static_cast<RealOpenMM>(kValue));
}
globalBondCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalBondCubic());
globalBondQuartic = static_cast<RealOpenMM>(force.getAmoebaGlobalBondQuartic());
......@@ -110,9 +110,9 @@ double ReferenceCalcAmoebaBondForceKernel::execute(ContextImpl& context, bool in
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferenceBondForce amoebaReferenceBondForce;
RealOpenMM energy = amoebaReferenceBondForce.calculateForceAndEnergy( numBonds, posData, particle1, particle2, length, kQuadratic,
RealOpenMM energy = amoebaReferenceBondForce.calculateForceAndEnergy(numBonds, posData, particle1, particle2, length, kQuadratic,
globalBondCubic, globalBondQuartic,
forceData );
forceData);
return static_cast<double>(energy);
}
......@@ -150,11 +150,11 @@ void ReferenceCalcAmoebaAngleForceKernel::initialize(const System& system, const
int particle1Index, particle2Index, particle3Index;
double angleValue, k;
force.getAngleParameters(ii, particle1Index, particle2Index, particle3Index, angleValue, k);
particle1.push_back( particle1Index );
particle2.push_back( particle2Index );
particle3.push_back( particle3Index );
angle.push_back( static_cast<RealOpenMM>( angleValue ) );
kQuadratic.push_back( static_cast<RealOpenMM>( k) );
particle1.push_back(particle1Index);
particle2.push_back(particle2Index);
particle3.push_back(particle3Index);
angle.push_back( static_cast<RealOpenMM>(angleValue));
kQuadratic.push_back(static_cast<RealOpenMM>(k));
}
globalAngleCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalAngleCubic());
globalAngleQuartic = static_cast<RealOpenMM>(force.getAmoebaGlobalAngleQuartic());
......@@ -166,8 +166,8 @@ double ReferenceCalcAmoebaAngleForceKernel::execute(ContextImpl& context, bool i
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferenceAngleForce amoebaReferenceAngleForce;
RealOpenMM energy = amoebaReferenceAngleForce.calculateForceAndEnergy( numAngles,
posData, particle1, particle2, particle3, angle, kQuadratic, globalAngleCubic, globalAngleQuartic, globalAnglePentic, globalAngleSextic, forceData );
RealOpenMM energy = amoebaReferenceAngleForce.calculateForceAndEnergy(numAngles,
posData, particle1, particle2, particle3, angle, kQuadratic, globalAngleCubic, globalAngleQuartic, globalAnglePentic, globalAngleSextic, forceData);
return static_cast<double>(energy);
}
......@@ -202,12 +202,12 @@ void ReferenceCalcAmoebaInPlaneAngleForceKernel::initialize(const System& system
int particle1Index, particle2Index, particle3Index, particle4Index;
double angleValue, k;
force.getAngleParameters(ii, particle1Index, particle2Index, particle3Index, particle4Index, angleValue, k);
particle1.push_back( particle1Index );
particle2.push_back( particle2Index );
particle3.push_back( particle3Index );
particle4.push_back( particle4Index );
angle.push_back( static_cast<RealOpenMM>( angleValue ) );
kQuadratic.push_back( static_cast<RealOpenMM>( k ) );
particle1.push_back(particle1Index);
particle2.push_back(particle2Index);
particle3.push_back(particle3Index);
particle4.push_back(particle4Index);
angle.push_back( static_cast<RealOpenMM>(angleValue));
kQuadratic.push_back( static_cast<RealOpenMM>(k));
}
globalInPlaneAngleCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalInPlaneAngleCubic());
globalInPlaneAngleQuartic = static_cast<RealOpenMM>(force.getAmoebaGlobalInPlaneAngleQuartic());
......@@ -220,9 +220,9 @@ double ReferenceCalcAmoebaInPlaneAngleForceKernel::execute(ContextImpl& context,
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferenceInPlaneAngleForce amoebaReferenceInPlaneAngleForce;
RealOpenMM energy = amoebaReferenceInPlaneAngleForce.calculateForceAndEnergy( numAngles, posData, particle1, particle2, particle3, particle4,
RealOpenMM energy = amoebaReferenceInPlaneAngleForce.calculateForceAndEnergy(numAngles, posData, particle1, particle2, particle3, particle4,
angle, kQuadratic, globalInPlaneAngleCubic, globalInPlaneAngleQuartic,
globalInPlaneAnglePentic, globalInPlaneAngleSextic, forceData );
globalInPlaneAnglePentic, globalInPlaneAngleSextic, forceData);
return static_cast<double>(energy);
}
......@@ -257,14 +257,14 @@ void ReferenceCalcAmoebaPiTorsionForceKernel::initialize(const System& system, c
int particle1Index, particle2Index, particle3Index, particle4Index, particle5Index, particle6Index;
double kTorsionParameter;
force.getPiTorsionParameters(ii, particle1Index, particle2Index, particle3Index, particle4Index, particle5Index, particle6Index, kTorsionParameter );
particle1.push_back( particle1Index );
particle2.push_back( particle2Index );
particle3.push_back( particle3Index );
particle4.push_back( particle4Index );
particle5.push_back( particle5Index );
particle6.push_back( particle6Index );
kTorsion.push_back( static_cast<RealOpenMM>(kTorsionParameter) );
force.getPiTorsionParameters(ii, particle1Index, particle2Index, particle3Index, particle4Index, particle5Index, particle6Index, kTorsionParameter);
particle1.push_back(particle1Index);
particle2.push_back(particle2Index);
particle3.push_back(particle3Index);
particle4.push_back(particle4Index);
particle5.push_back(particle5Index);
particle6.push_back(particle6Index);
kTorsion.push_back(static_cast<RealOpenMM>(kTorsionParameter));
}
}
......@@ -272,9 +272,9 @@ double ReferenceCalcAmoebaPiTorsionForceKernel::execute(ContextImpl& context, bo
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferencePiTorsionForce amoebaReferencePiTorsionForce;
RealOpenMM energy = amoebaReferencePiTorsionForce.calculateForceAndEnergy( numPiTorsions, posData, particle1, particle2,
RealOpenMM energy = amoebaReferencePiTorsionForce.calculateForceAndEnergy(numPiTorsions, posData, particle1, particle2,
particle3, particle4, particle5, particle6,
kTorsion, forceData );
kTorsion, forceData);
return static_cast<double>(energy);
}
......@@ -305,18 +305,18 @@ ReferenceCalcAmoebaStretchBendForceKernel::~ReferenceCalcAmoebaStretchBendForceK
void ReferenceCalcAmoebaStretchBendForceKernel::initialize(const System& system, const AmoebaStretchBendForce& force) {
numStretchBends = force.getNumStretchBends();
for ( int ii = 0; ii < numStretchBends; ii++) {
for (int ii = 0; ii < numStretchBends; ii++) {
int particle1Index, particle2Index, particle3Index;
double lengthAB, lengthCB, angle, k1, k2;
force.getStretchBendParameters(ii, particle1Index, particle2Index, particle3Index, lengthAB, lengthCB, angle, k1, k2);
particle1.push_back( particle1Index );
particle2.push_back( particle2Index );
particle3.push_back( particle3Index );
lengthABParameters.push_back( static_cast<RealOpenMM>(lengthAB) );
lengthCBParameters.push_back( static_cast<RealOpenMM>(lengthCB) );
angleParameters.push_back( static_cast<RealOpenMM>(angle) );
k1Parameters.push_back( static_cast<RealOpenMM>(k1) );
k2Parameters.push_back( static_cast<RealOpenMM>(k2) );
particle1.push_back(particle1Index);
particle2.push_back(particle2Index);
particle3.push_back(particle3Index);
lengthABParameters.push_back(static_cast<RealOpenMM>(lengthAB));
lengthCBParameters.push_back(static_cast<RealOpenMM>(lengthCB));
angleParameters.push_back( static_cast<RealOpenMM>(angle));
k1Parameters.push_back( static_cast<RealOpenMM>(k1));
k2Parameters.push_back( static_cast<RealOpenMM>(k2));
}
}
......@@ -324,9 +324,9 @@ double ReferenceCalcAmoebaStretchBendForceKernel::execute(ContextImpl& context,
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferenceStretchBendForce amoebaReferenceStretchBendForce;
RealOpenMM energy = amoebaReferenceStretchBendForce.calculateForceAndEnergy( numStretchBends, posData, particle1, particle2, particle3,
RealOpenMM energy = amoebaReferenceStretchBendForce.calculateForceAndEnergy(numStretchBends, posData, particle1, particle2, particle3,
lengthABParameters, lengthCBParameters, angleParameters, k1Parameters,
k2Parameters, forceData );
k2Parameters, forceData);
return static_cast<double>(energy);
}
......@@ -366,16 +366,16 @@ void ReferenceCalcAmoebaOutOfPlaneBendForceKernel::initialize(const System& syst
double k;
force.getOutOfPlaneBendParameters(ii, particle1Index, particle2Index, particle3Index, particle4Index, k);
particle1.push_back( particle1Index );
particle2.push_back( particle2Index );
particle3.push_back( particle3Index );
particle4.push_back( particle4Index );
kParameters.push_back( static_cast<RealOpenMM>(k) );
particle1.push_back(particle1Index);
particle2.push_back(particle2Index);
particle3.push_back(particle3Index);
particle4.push_back(particle4Index);
kParameters.push_back(static_cast<RealOpenMM>(k));
}
globalOutOfPlaneBendAngleCubic = static_cast<RealOpenMM>( force.getAmoebaGlobalOutOfPlaneBendCubic());
globalOutOfPlaneBendAngleQuartic = static_cast<RealOpenMM>( force.getAmoebaGlobalOutOfPlaneBendQuartic());
globalOutOfPlaneBendAnglePentic = static_cast<RealOpenMM>( force.getAmoebaGlobalOutOfPlaneBendPentic());
globalOutOfPlaneBendAngleSextic = static_cast<RealOpenMM>( force.getAmoebaGlobalOutOfPlaneBendSextic());
globalOutOfPlaneBendAngleCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalOutOfPlaneBendCubic());
globalOutOfPlaneBendAngleQuartic = static_cast<RealOpenMM>(force.getAmoebaGlobalOutOfPlaneBendQuartic());
globalOutOfPlaneBendAnglePentic = static_cast<RealOpenMM>(force.getAmoebaGlobalOutOfPlaneBendPentic());
globalOutOfPlaneBendAngleSextic = static_cast<RealOpenMM>(force.getAmoebaGlobalOutOfPlaneBendSextic());
}
......@@ -383,13 +383,13 @@ double ReferenceCalcAmoebaOutOfPlaneBendForceKernel::execute(ContextImpl& contex
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferenceOutOfPlaneBendForce amoebaReferenceOutOfPlaneBendForce;
RealOpenMM energy = amoebaReferenceOutOfPlaneBendForce.calculateForceAndEnergy( numOutOfPlaneBends, posData,
RealOpenMM energy = amoebaReferenceOutOfPlaneBendForce.calculateForceAndEnergy(numOutOfPlaneBends, posData,
particle1, particle2, particle3, particle4,
kParameters,
globalOutOfPlaneBendAngleCubic,
globalOutOfPlaneBendAngleQuartic,
globalOutOfPlaneBendAnglePentic,
globalOutOfPlaneBendAngleSextic, forceData );
globalOutOfPlaneBendAngleSextic, forceData);
return static_cast<double>(energy);
}
......@@ -426,13 +426,13 @@ void ReferenceCalcAmoebaTorsionTorsionForceKernel::initialize(const System& syst
int particle1Index, particle2Index, particle3Index, particle4Index, particle5Index, chiralCheckAtomIndex, gridIndex;
force.getTorsionTorsionParameters(ii, particle1Index, particle2Index, particle3Index,
particle4Index, particle5Index, chiralCheckAtomIndex, gridIndex);
particle1.push_back( particle1Index );
particle2.push_back( particle2Index );
particle3.push_back( particle3Index );
particle4.push_back( particle4Index );
particle5.push_back( particle5Index );
chiralCheckAtom.push_back( chiralCheckAtomIndex );
gridIndices.push_back( gridIndex );
particle1.push_back(particle1Index);
particle2.push_back(particle2Index);
particle3.push_back(particle3Index);
particle4.push_back(particle4Index);
particle5.push_back(particle5Index);
chiralCheckAtom.push_back(chiralCheckAtomIndex);
gridIndices.push_back(gridIndex);
}
// torsion-torsion grids
......@@ -441,25 +441,25 @@ void ReferenceCalcAmoebaTorsionTorsionForceKernel::initialize(const System& syst
torsionTorsionGrids.resize(numTorsionTorsionGrids);
for (int ii = 0; ii < numTorsionTorsionGrids; ii++) {
const TorsionTorsionGrid grid = force.getTorsionTorsionGrid( ii );
torsionTorsionGrids[ii].resize( grid.size() );
const TorsionTorsionGrid grid = force.getTorsionTorsionGrid(ii);
torsionTorsionGrids[ii].resize(grid.size());
// check if grid needs to be reordered: x-angle should be 'slow' index
TorsionTorsionGrid reorderedGrid;
int reorder = 0;
if( grid[0][0][0] != grid[0][1][0] ){
AmoebaTorsionTorsionForceImpl::reorderGrid( grid, reorderedGrid );
if (grid[0][0][0] != grid[0][1][0]) {
AmoebaTorsionTorsionForceImpl::reorderGrid(grid, reorderedGrid);
reorder = 1;
}
for (unsigned int kk = 0; kk < grid.size(); kk++) {
torsionTorsionGrids[ii][kk].resize( grid[kk].size() );
torsionTorsionGrids[ii][kk].resize(grid[kk].size());
for (unsigned int jj = 0; jj < grid[kk].size(); jj++) {
torsionTorsionGrids[ii][kk][jj].resize( grid[kk][jj].size() );
if( reorder ){
torsionTorsionGrids[ii][kk][jj].resize(grid[kk][jj].size());
if (reorder) {
for (unsigned int ll = 0; ll < grid[ll][jj].size(); ll++) {
torsionTorsionGrids[ii][kk][jj][ll] = static_cast<RealOpenMM>(reorderedGrid[kk][jj][ll]);
}
......@@ -478,9 +478,9 @@ double ReferenceCalcAmoebaTorsionTorsionForceKernel::execute(ContextImpl& contex
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferenceTorsionTorsionForce amoebaReferenceTorsionTorsionForce;
RealOpenMM energy = amoebaReferenceTorsionTorsionForce.calculateForceAndEnergy( numTorsionTorsions, posData,
RealOpenMM energy = amoebaReferenceTorsionTorsionForce.calculateForceAndEnergy(numTorsionTorsions, posData,
particle1, particle2, particle3, particle4, particle5,
chiralCheckAtom, gridIndices, torsionTorsionGrids, forceData );
chiralCheckAtom, gridIndices, torsionTorsionGrids, forceData);
return static_cast<double>(energy);
}
......@@ -517,7 +517,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
int quadrupoleIndex = 0;
int maxCovalentRange = 0;
double totalCharge = 0.0;
for( int ii = 0; ii < numMultipoles; ii++ ){
for (int ii = 0; ii < numMultipoles; ii++) {
// multipoles
......@@ -526,7 +526,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
std::vector<double> dipolesD;
std::vector<double> quadrupolesD;
force.getMultipoleParameters(ii, charge, dipolesD, quadrupolesD, axisType, multipoleAtomZ, multipoleAtomX, multipoleAtomY,
tholeD, dampingFactorD, polarityD );
tholeD, dampingFactorD, polarityD);
totalCharge += charge;
axisTypes[ii] = axisType;
......@@ -556,13 +556,13 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
// covalent info
std::vector< std::vector<int> > covalentLists;
force.getCovalentMaps(ii, covalentLists );
force.getCovalentMaps(ii, covalentLists);
multipoleAtomCovalentInfo[ii] = covalentLists;
}
polarizationType = force.getPolarizationType();
if( polarizationType == AmoebaMultipoleForce::Mutual ){
if (polarizationType == AmoebaMultipoleForce::Mutual) {
mutualInducedMaxIterations = force.getMutualInducedMaxIterations();
mutualInducedTargetEpsilon = force.getMutualInducedTargetEpsilon();
}
......@@ -570,7 +570,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
// PME
nonbondedMethod = force.getNonbondedMethod();
if( nonbondedMethod == AmoebaMultipoleForce::PME ){
if (nonbondedMethod == AmoebaMultipoleForce::PME) {
usePme = true;
alphaEwald = force.getAEwald();
cutoffDistance = force.getCutoffDistance();
......@@ -591,7 +591,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
return;
}
AmoebaReferenceMultipoleForce* ReferenceCalcAmoebaMultipoleForceKernel::setupAmoebaReferenceMultipoleForce(ContextImpl& context )
AmoebaReferenceMultipoleForce* ReferenceCalcAmoebaMultipoleForceKernel::setupAmoebaReferenceMultipoleForce(ContextImpl& context)
{
// amoebaReferenceMultipoleForce is set to AmoebaReferenceGeneralizedKirkwoodForce if AmoebaGeneralizedKirkwoodForce is present
......@@ -609,66 +609,66 @@ AmoebaReferenceMultipoleForce* ReferenceCalcAmoebaMultipoleForceKernel::setupAmo
}
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = NULL;
if( gkKernel ){
if (gkKernel) {
// amoebaReferenceGeneralizedKirkwoodForce is deleted in AmoebaReferenceGeneralizedKirkwoodMultipoleForce
// destructor
AmoebaReferenceGeneralizedKirkwoodForce* amoebaReferenceGeneralizedKirkwoodForce = new AmoebaReferenceGeneralizedKirkwoodForce();
amoebaReferenceGeneralizedKirkwoodForce->setNumParticles( gkKernel->getNumParticles() );
amoebaReferenceGeneralizedKirkwoodForce->setSoluteDielectric( gkKernel->getSoluteDielectric() );
amoebaReferenceGeneralizedKirkwoodForce->setSolventDielectric( gkKernel->getSolventDielectric() );
amoebaReferenceGeneralizedKirkwoodForce->setDielectricOffset( gkKernel->getDielectricOffset() );
amoebaReferenceGeneralizedKirkwoodForce->setProbeRadius( gkKernel->getProbeRadius() );
amoebaReferenceGeneralizedKirkwoodForce->setSurfaceAreaFactor( gkKernel->getSurfaceAreaFactor() );
amoebaReferenceGeneralizedKirkwoodForce->setIncludeCavityTerm( gkKernel->getIncludeCavityTerm() );
amoebaReferenceGeneralizedKirkwoodForce->setDirectPolarization( gkKernel->getDirectPolarization() );
amoebaReferenceGeneralizedKirkwoodForce->setNumParticles(gkKernel->getNumParticles());
amoebaReferenceGeneralizedKirkwoodForce->setSoluteDielectric(gkKernel->getSoluteDielectric());
amoebaReferenceGeneralizedKirkwoodForce->setSolventDielectric(gkKernel->getSolventDielectric());
amoebaReferenceGeneralizedKirkwoodForce->setDielectricOffset(gkKernel->getDielectricOffset());
amoebaReferenceGeneralizedKirkwoodForce->setProbeRadius(gkKernel->getProbeRadius());
amoebaReferenceGeneralizedKirkwoodForce->setSurfaceAreaFactor(gkKernel->getSurfaceAreaFactor());
amoebaReferenceGeneralizedKirkwoodForce->setIncludeCavityTerm(gkKernel->getIncludeCavityTerm());
amoebaReferenceGeneralizedKirkwoodForce->setDirectPolarization(gkKernel->getDirectPolarization());
vector<RealOpenMM> parameters;
gkKernel->getAtomicRadii( parameters );
amoebaReferenceGeneralizedKirkwoodForce->setAtomicRadii( parameters );
gkKernel->getAtomicRadii(parameters);
amoebaReferenceGeneralizedKirkwoodForce->setAtomicRadii(parameters);
gkKernel->getScaleFactors( parameters );
amoebaReferenceGeneralizedKirkwoodForce->setScaleFactors( parameters );
gkKernel->getScaleFactors(parameters);
amoebaReferenceGeneralizedKirkwoodForce->setScaleFactors(parameters);
gkKernel->getCharges( parameters );
amoebaReferenceGeneralizedKirkwoodForce->setCharges( parameters );
gkKernel->getCharges(parameters);
amoebaReferenceGeneralizedKirkwoodForce->setCharges(parameters);
// calculate Grycuk Born radii
vector<RealVec>& posData = extractPositions(context);
amoebaReferenceGeneralizedKirkwoodForce->calculateGrycukBornRadii( posData );
amoebaReferenceGeneralizedKirkwoodForce->calculateGrycukBornRadii(posData);
amoebaReferenceMultipoleForce = new AmoebaReferenceGeneralizedKirkwoodMultipoleForce( amoebaReferenceGeneralizedKirkwoodForce );
amoebaReferenceMultipoleForce = new AmoebaReferenceGeneralizedKirkwoodMultipoleForce(amoebaReferenceGeneralizedKirkwoodForce);
} else if( usePme ) {
} else if (usePme) {
AmoebaReferencePmeMultipoleForce* amoebaReferencePmeMultipoleForce = new AmoebaReferencePmeMultipoleForce( );
amoebaReferencePmeMultipoleForce->setAlphaEwald( alphaEwald );
amoebaReferencePmeMultipoleForce->setCutoffDistance( cutoffDistance );
amoebaReferencePmeMultipoleForce->setPmeGridDimensions( pmeGridDimension );
AmoebaReferencePmeMultipoleForce* amoebaReferencePmeMultipoleForce = new AmoebaReferencePmeMultipoleForce();
amoebaReferencePmeMultipoleForce->setAlphaEwald(alphaEwald);
amoebaReferencePmeMultipoleForce->setCutoffDistance(cutoffDistance);
amoebaReferencePmeMultipoleForce->setPmeGridDimensions(pmeGridDimension);
RealVec* boxVectors = extractBoxVectors(context);
double minAllowedSize = 1.999999*cutoffDistance;
if (boxVectors[0][0] < minAllowedSize || boxVectors[1][1] < minAllowedSize || boxVectors[2][2] < minAllowedSize){
if (boxVectors[0][0] < minAllowedSize || boxVectors[1][1] < minAllowedSize || boxVectors[2][2] < minAllowedSize) {
throw OpenMMException("The periodic box size has decreased to less than twice the nonbonded cutoff.");
}
amoebaReferencePmeMultipoleForce->setPeriodicBoxSize(boxVectors);
amoebaReferenceMultipoleForce = static_cast<AmoebaReferenceMultipoleForce*>(amoebaReferencePmeMultipoleForce);
} else {
amoebaReferenceMultipoleForce = new AmoebaReferenceMultipoleForce( AmoebaReferenceMultipoleForce::NoCutoff );
amoebaReferenceMultipoleForce = new AmoebaReferenceMultipoleForce(AmoebaReferenceMultipoleForce::NoCutoff);
}
// set polarization type
if( polarizationType == AmoebaMultipoleForce::Mutual ){
amoebaReferenceMultipoleForce->setPolarizationType( AmoebaReferenceMultipoleForce::Mutual );
amoebaReferenceMultipoleForce->setMutualInducedDipoleTargetEpsilon( mutualInducedTargetEpsilon );
amoebaReferenceMultipoleForce->setMaximumMutualInducedDipoleIterations( mutualInducedMaxIterations );
} else if( polarizationType == AmoebaMultipoleForce::Direct ){
amoebaReferenceMultipoleForce->setPolarizationType( AmoebaReferenceMultipoleForce::Direct );
if (polarizationType == AmoebaMultipoleForce::Mutual) {
amoebaReferenceMultipoleForce->setPolarizationType(AmoebaReferenceMultipoleForce::Mutual);
amoebaReferenceMultipoleForce->setMutualInducedDipoleTargetEpsilon(mutualInducedTargetEpsilon);
amoebaReferenceMultipoleForce->setMaximumMutualInducedDipoleIterations(mutualInducedMaxIterations);
} else if (polarizationType == AmoebaMultipoleForce::Direct) {
amoebaReferenceMultipoleForce->setPolarizationType(AmoebaReferenceMultipoleForce::Direct);
} else {
throw OpenMMException("Polarization type not recognzied." );
throw OpenMMException("Polarization type not recognzied.");
}
return amoebaReferenceMultipoleForce;
......@@ -677,11 +677,11 @@ AmoebaReferenceMultipoleForce* ReferenceCalcAmoebaMultipoleForceKernel::setupAmo
double ReferenceCalcAmoebaMultipoleForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = setupAmoebaReferenceMultipoleForce( context );
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = setupAmoebaReferenceMultipoleForce(context);
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
RealOpenMM energy = amoebaReferenceMultipoleForce->calculateForceAndEnergy( posData, charges, dipoles, quadrupoles, tholes,
RealOpenMM energy = amoebaReferenceMultipoleForce->calculateForceAndEnergy(posData, charges, dipoles, quadrupoles, tholes,
dampingFactors, polarity, axisTypes,
multipoleAtomZs, multipoleAtomXs, multipoleAtomYs,
multipoleAtomCovalentInfo, forceData);
......@@ -697,7 +697,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::getInducedDipoles(ContextImpl& con
// Create an AmoebaReferenceMultipoleForce to do the calculation.
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = setupAmoebaReferenceMultipoleForce( context );
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = setupAmoebaReferenceMultipoleForce(context);
vector<RealVec>& posData = extractPositions(context);
// Retrieve the induced dipoles.
......@@ -711,44 +711,44 @@ void ReferenceCalcAmoebaMultipoleForceKernel::getInducedDipoles(ContextImpl& con
}
void ReferenceCalcAmoebaMultipoleForceKernel::getElectrostaticPotential(ContextImpl& context, const std::vector< Vec3 >& inputGrid,
std::vector< double >& outputElectrostaticPotential ){
std::vector< double >& outputElectrostaticPotential) {
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = setupAmoebaReferenceMultipoleForce( context );
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = setupAmoebaReferenceMultipoleForce(context);
vector<RealVec>& posData = extractPositions(context);
vector<RealVec> grid( inputGrid.size() );
vector<RealOpenMM> potential( inputGrid.size() );
for( unsigned int ii = 0; ii < inputGrid.size(); ii++ ){
vector<RealVec> grid(inputGrid.size());
vector<RealOpenMM> potential(inputGrid.size());
for (unsigned int ii = 0; ii < inputGrid.size(); ii++) {
grid[ii] = inputGrid[ii];
}
amoebaReferenceMultipoleForce->calculateElectrostaticPotential( posData, charges, dipoles, quadrupoles, tholes,
dampingFactors, polarity, axisTypes,
multipoleAtomZs, multipoleAtomXs, multipoleAtomYs,
multipoleAtomCovalentInfo, grid, potential );
amoebaReferenceMultipoleForce->calculateElectrostaticPotential(posData, charges, dipoles, quadrupoles, tholes,
dampingFactors, polarity, axisTypes,
multipoleAtomZs, multipoleAtomXs, multipoleAtomYs,
multipoleAtomCovalentInfo, grid, potential);
outputElectrostaticPotential.resize( inputGrid.size() );
for( unsigned int ii = 0; ii < inputGrid.size(); ii++ ){
outputElectrostaticPotential.resize(inputGrid.size());
for (unsigned int ii = 0; ii < inputGrid.size(); ii++) {
outputElectrostaticPotential[ii] = potential[ii];
}
delete amoebaReferenceMultipoleForce;
}
void ReferenceCalcAmoebaMultipoleForceKernel::getSystemMultipoleMoments(ContextImpl& context, std::vector< double >& outputMultipoleMoments){
void ReferenceCalcAmoebaMultipoleForceKernel::getSystemMultipoleMoments(ContextImpl& context, std::vector< double >& outputMultipoleMoments) {
// retrieve masses
const System& system = context.getSystem();
vector<RealOpenMM> masses;
for (int i = 0; i < system.getNumParticles(); ++i) {
masses.push_back( static_cast<RealOpenMM>(system.getParticleMass(i)) );
masses.push_back(static_cast<RealOpenMM>(system.getParticleMass(i)));
}
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = setupAmoebaReferenceMultipoleForce( context );
AmoebaReferenceMultipoleForce* amoebaReferenceMultipoleForce = setupAmoebaReferenceMultipoleForce(context);
vector<RealVec>& posData = extractPositions(context);
amoebaReferenceMultipoleForce->calculateAmoebaSystemMultipoleMoments( masses, posData, charges, dipoles, quadrupoles, tholes,
dampingFactors, polarity, axisTypes,
multipoleAtomZs, multipoleAtomXs, multipoleAtomYs,
multipoleAtomCovalentInfo, outputMultipoleMoments );
amoebaReferenceMultipoleForce->calculateAmoebaSystemMultipoleMoments(masses, posData, charges, dipoles, quadrupoles, tholes,
dampingFactors, polarity, axisTypes,
multipoleAtomZs, multipoleAtomXs, multipoleAtomYs,
multipoleAtomCovalentInfo, outputMultipoleMoments);
delete amoebaReferenceMultipoleForce;
}
......@@ -801,51 +801,51 @@ ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::ReferenceCalcAmoebaGeneralize
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::~ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel() {
}
int ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getNumParticles( void ) const {
int ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getNumParticles() const {
return numParticles;
}
int ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getIncludeCavityTerm( void ) const {
int ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getIncludeCavityTerm() const {
return includeCavityTerm;
}
int ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getDirectPolarization( void ) const {
int ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getDirectPolarization() const {
return directPolarization;
}
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getSoluteDielectric( void ) const {
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getSoluteDielectric() const {
return soluteDielectric;
}
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getSolventDielectric( void ) const {
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getSolventDielectric() const {
return solventDielectric;
}
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getDielectricOffset( void ) const {
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getDielectricOffset() const {
return dielectricOffset;
}
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getProbeRadius( void ) const {
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getProbeRadius() const {
return probeRadius;
}
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getSurfaceAreaFactor( void ) const {
RealOpenMM ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getSurfaceAreaFactor() const {
return surfaceAreaFactor;
}
void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getAtomicRadii( vector<RealOpenMM>& outputAtomicRadii ) const {
outputAtomicRadii.resize( atomicRadii.size() );
copy( atomicRadii.begin(), atomicRadii.end(), outputAtomicRadii.begin() );
void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getAtomicRadii(vector<RealOpenMM>& outputAtomicRadii) const {
outputAtomicRadii.resize(atomicRadii.size());
copy(atomicRadii.begin(), atomicRadii.end(), outputAtomicRadii.begin());
}
void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getScaleFactors( vector<RealOpenMM>& outputScaleFactors ) const {
outputScaleFactors.resize( scaleFactors.size() );
copy( scaleFactors.begin(), scaleFactors.end(), outputScaleFactors.begin() );
void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getScaleFactors(vector<RealOpenMM>& outputScaleFactors) const {
outputScaleFactors.resize(scaleFactors.size());
copy(scaleFactors.begin(), scaleFactors.end(), outputScaleFactors.begin());
}
void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getCharges( vector<RealOpenMM>& outputCharges ) const {
outputCharges.resize( charges.size() );
copy( charges.begin(), charges.end(), outputCharges.begin() );
void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::getCharges(vector<RealOpenMM>& outputCharges) const {
outputCharges.resize(charges.size());
copy(charges.begin(), charges.end(), outputCharges.begin());
}
void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::initialize(const System& system, const AmoebaGeneralizedKirkwoodForce& force) {
......@@ -861,37 +861,37 @@ void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::initialize(const System&
throw OpenMMException("AmoebaGeneralizedKirkwoodForce requires the System to also contain an AmoebaMultipoleForce.");
}
if (amoebaMultipoleForce->getNonbondedMethod() != AmoebaMultipoleForce::NoCutoff ) {
if (amoebaMultipoleForce->getNonbondedMethod() != AmoebaMultipoleForce::NoCutoff) {
throw OpenMMException("AmoebaGeneralizedKirkwoodForce requires the AmoebaMultipoleForce use the NoCutoff nonbonded method.");
}
numParticles = system.getNumParticles();
for( int ii = 0; ii < numParticles; ii++ ){
for (int ii = 0; ii < numParticles; ii++) {
double particleCharge, particleRadius, scalingFactor;
force.getParticleParameters(ii, particleCharge, particleRadius, scalingFactor);
atomicRadii.push_back( static_cast<RealOpenMM>( particleRadius ) );
scaleFactors.push_back( static_cast<RealOpenMM>( scalingFactor ) );
charges.push_back( static_cast<RealOpenMM>( particleCharge ) );
atomicRadii.push_back(static_cast<RealOpenMM>(particleRadius));
scaleFactors.push_back(static_cast<RealOpenMM>(scalingFactor));
charges.push_back(static_cast<RealOpenMM>(particleCharge));
// Make sure the charge matches the one specified by the AmoebaMultipoleForce.
double charge2, thole, damping, polarity;
int axisType, atomX, atomY, atomZ;
vector<double> dipole, quadrupole;
amoebaMultipoleForce->getMultipoleParameters( ii, charge2, dipole, quadrupole, axisType, atomZ, atomX, atomY, thole, damping, polarity);
if ( particleCharge != charge2 ){
amoebaMultipoleForce->getMultipoleParameters(ii, charge2, dipole, quadrupole, axisType, atomZ, atomX, atomY, thole, damping, polarity);
if (particleCharge != charge2) {
throw OpenMMException("AmoebaGeneralizedKirkwoodForce and AmoebaMultipoleForce must specify the same charge for every atom.");
}
}
includeCavityTerm = force.getIncludeCavityTerm();
soluteDielectric = static_cast<RealOpenMM>( force.getSoluteDielectric() );
solventDielectric = static_cast<RealOpenMM>( force.getSolventDielectric() );
dielectricOffset = static_cast<RealOpenMM>( 0.009 );
probeRadius = static_cast<RealOpenMM>( force.getProbeRadius() ),
surfaceAreaFactor = static_cast<RealOpenMM>( force.getSurfaceAreaFactor() );
soluteDielectric = static_cast<RealOpenMM>(force.getSoluteDielectric());
solventDielectric = static_cast<RealOpenMM>(force.getSolventDielectric());
dielectricOffset = static_cast<RealOpenMM>(0.009);
probeRadius = static_cast<RealOpenMM>(force.getProbeRadius()),
surfaceAreaFactor = static_cast<RealOpenMM>(force.getSurfaceAreaFactor());
directPolarization = amoebaMultipoleForce->getPolarizationType() == AmoebaMultipoleForce::Direct ? 1 : 0;
}
......@@ -924,7 +924,7 @@ ReferenceCalcAmoebaVdwForceKernel::ReferenceCalcAmoebaVdwForceKernel(std::string
}
ReferenceCalcAmoebaVdwForceKernel::~ReferenceCalcAmoebaVdwForceKernel() {
if( neighborList ){
if (neighborList) {
delete neighborList;
}
}
......@@ -935,28 +935,28 @@ void ReferenceCalcAmoebaVdwForceKernel::initialize(const System& system, const A
numParticles = system.getNumParticles();
indexIVs.resize( numParticles );
allExclusions.resize( numParticles );
sigmas.resize( numParticles );
epsilons.resize( numParticles );
reductions.resize( numParticles );
indexIVs.resize(numParticles);
allExclusions.resize(numParticles);
sigmas.resize(numParticles);
epsilons.resize(numParticles);
reductions.resize(numParticles);
for( int ii = 0; ii < numParticles; ii++ ){
for (int ii = 0; ii < numParticles; ii++) {
int indexIV;
double sigma, epsilon, reduction;
std::vector<int> exclusions;
force.getParticleParameters( ii, indexIV, sigma, epsilon, reduction );
force.getParticleExclusions( ii, exclusions );
for( unsigned int jj = 0; jj < exclusions.size(); jj++ ){
allExclusions[ii].insert( exclusions[jj] );
force.getParticleParameters(ii, indexIV, sigma, epsilon, reduction);
force.getParticleExclusions(ii, exclusions);
for (unsigned int jj = 0; jj < exclusions.size(); jj++) {
allExclusions[ii].insert(exclusions[jj]);
}
indexIVs[ii] = indexIV;
sigmas[ii] = static_cast<RealOpenMM>( sigma );
epsilons[ii] = static_cast<RealOpenMM>( epsilon );
reductions[ii] = static_cast<RealOpenMM>( reduction );
sigmas[ii] = static_cast<RealOpenMM>(sigma);
epsilons[ii] = static_cast<RealOpenMM>(epsilon);
reductions[ii] = static_cast<RealOpenMM>(reduction);
}
sigmaCombiningRule = force.getSigmaCombiningRule();
epsilonCombiningRule = force.getEpsilonCombiningRule();
......@@ -972,27 +972,27 @@ double ReferenceCalcAmoebaVdwForceKernel::execute(ContextImpl& context, bool inc
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferenceVdwForce vdwForce( sigmaCombiningRule, epsilonCombiningRule );
AmoebaReferenceVdwForce vdwForce(sigmaCombiningRule, epsilonCombiningRule);
RealOpenMM energy;
if( useCutoff ){
vdwForce.setCutoff( cutoff );
computeNeighborListVoxelHash( *neighborList, numParticles, posData, allExclusions, extractBoxVectors(context), usePBC, cutoff, 0.0);
if( usePBC ){
vdwForce.setNonbondedMethod( AmoebaReferenceVdwForce::CutoffPeriodic);
if (useCutoff) {
vdwForce.setCutoff(cutoff);
computeNeighborListVoxelHash(*neighborList, numParticles, posData, allExclusions, extractBoxVectors(context), usePBC, cutoff, 0.0);
if (usePBC) {
vdwForce.setNonbondedMethod(AmoebaReferenceVdwForce::CutoffPeriodic);
RealVec* boxVectors = extractBoxVectors(context);
double minAllowedSize = 1.999999*cutoff;
if (boxVectors[0][0] < minAllowedSize || boxVectors[1][1] < minAllowedSize || boxVectors[2][2] < minAllowedSize){
if (boxVectors[0][0] < minAllowedSize || boxVectors[1][1] < minAllowedSize || boxVectors[2][2] < minAllowedSize) {
throw OpenMMException("The periodic box size has decreased to less than twice the cutoff.");
}
vdwForce.setPeriodicBox(boxVectors);
energy = vdwForce.calculateForceAndEnergy( numParticles, posData, indexIVs, sigmas, epsilons, reductions, *neighborList, forceData);
energy = vdwForce.calculateForceAndEnergy(numParticles, posData, indexIVs, sigmas, epsilons, reductions, *neighborList, forceData);
energy += dispersionCoefficient/(boxVectors[0][0]*boxVectors[1][1]*boxVectors[2][2]);
} else {
vdwForce.setNonbondedMethod( AmoebaReferenceVdwForce::CutoffNonPeriodic);
vdwForce.setNonbondedMethod(AmoebaReferenceVdwForce::CutoffNonPeriodic);
}
} else {
vdwForce.setNonbondedMethod( AmoebaReferenceVdwForce::NoCutoff );
energy = vdwForce.calculateForceAndEnergy( numParticles, posData, indexIVs, sigmas, epsilons, reductions, allExclusions, forceData);
vdwForce.setNonbondedMethod(AmoebaReferenceVdwForce::NoCutoff);
energy = vdwForce.calculateForceAndEnergy(numParticles, posData, indexIVs, sigmas, epsilons, reductions, allExclusions, forceData);
}
return static_cast<double>(energy);
}
......@@ -1032,32 +1032,32 @@ void ReferenceCalcAmoebaWcaDispersionForceKernel::initialize(const System& syste
numParticles = system.getNumParticles();
radii.resize(numParticles);
epsilons.resize(numParticles);
for( int ii = 0; ii < numParticles; ii++ ){
for (int ii = 0; ii < numParticles; ii++) {
double radius, epsilon;
force.getParticleParameters( ii, radius, epsilon );
force.getParticleParameters(ii, radius, epsilon);
radii[ii] = static_cast<RealOpenMM>( radius );
epsilons[ii] = static_cast<RealOpenMM>( epsilon );
radii[ii] = static_cast<RealOpenMM>(radius);
epsilons[ii] = static_cast<RealOpenMM>(epsilon);
}
totalMaximumDispersionEnergy = static_cast<RealOpenMM>( AmoebaWcaDispersionForceImpl::getTotalMaximumDispersionEnergy( force ) );
totalMaximumDispersionEnergy = static_cast<RealOpenMM>(AmoebaWcaDispersionForceImpl::getTotalMaximumDispersionEnergy(force));
epso = static_cast<RealOpenMM>( force.getEpso() );
epsh = static_cast<RealOpenMM>( force.getEpsh() );
rmino = static_cast<RealOpenMM>( force.getRmino() );
rminh = static_cast<RealOpenMM>( force.getRminh() );
awater = static_cast<RealOpenMM>( force.getAwater() );
shctd = static_cast<RealOpenMM>( force.getShctd() );
dispoff = static_cast<RealOpenMM>( force.getDispoff());
slevy = static_cast<RealOpenMM>( force.getSlevy() );
epso = static_cast<RealOpenMM>(force.getEpso() );
epsh = static_cast<RealOpenMM>(force.getEpsh() );
rmino = static_cast<RealOpenMM>(force.getRmino() );
rminh = static_cast<RealOpenMM>(force.getRminh() );
awater = static_cast<RealOpenMM>(force.getAwater());
shctd = static_cast<RealOpenMM>(force.getShctd() );
dispoff = static_cast<RealOpenMM>(force.getDispoff());
slevy = static_cast<RealOpenMM>(force.getSlevy() );
}
double ReferenceCalcAmoebaWcaDispersionForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
vector<RealVec>& posData = extractPositions(context);
vector<RealVec>& forceData = extractForces(context);
AmoebaReferenceWcaDispersionForce amoebaReferenceWcaDispersionForce( epso, epsh, rmino, rminh, awater, shctd, dispoff, slevy );
RealOpenMM energy = amoebaReferenceWcaDispersionForce.calculateForceAndEnergy( numParticles, posData, radii, epsilons, totalMaximumDispersionEnergy, forceData);
AmoebaReferenceWcaDispersionForce amoebaReferenceWcaDispersionForce(epso, epsh, rmino, rminh, awater, shctd, dispoff, slevy);
RealOpenMM energy = amoebaReferenceWcaDispersionForce.calculateForceAndEnergy(numParticles, posData, radii, epsilons, totalMaximumDispersionEnergy, forceData);
return static_cast<double>(energy);
}
......
......@@ -357,7 +357,7 @@ public:
*
* @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.
*
......@@ -382,7 +382,7 @@ public:
* @param outputElectrostaticPotential output potential
*/
void getElectrostaticPotential(ContextImpl& context, const std::vector< Vec3 >& inputGrid,
std::vector< double >& outputElectrostaticPotential );
std::vector< double >& outputElectrostaticPotential);
/**
* Get the system multipole moments.
......@@ -393,7 +393,7 @@ public:
dipole_x, dipole_y, dipole_z,
quadrupole_xx, quadrupole_xy, quadrupole_xz,
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);
/**
......@@ -555,14 +555,14 @@ public:
*
* @return includeCavityTerm
*/
int getIncludeCavityTerm( void ) const;
int getIncludeCavityTerm() const;
/**
* Get the number of particles.
*
* @return number of particles
*/
int getNumParticles( void ) const;
int getNumParticles() const;
/**
* Get Direct Polarization flag.
......@@ -570,7 +570,7 @@ public:
* @return directPolarization
*
*/
int getDirectPolarization( void ) const;
int getDirectPolarization() const;
/**
* Get the solute dielectric.
......@@ -578,7 +578,7 @@ public:
* @return soluteDielectric
*
*/
RealOpenMM getSoluteDielectric( void ) const;
RealOpenMM getSoluteDielectric() const;
/**
* Get the solvent dielectric.
......@@ -586,7 +586,7 @@ public:
* @return solventDielectric
*
*/
RealOpenMM getSolventDielectric( void ) const;
RealOpenMM getSolventDielectric() const;
/**
* Get the dielectric offset.
......@@ -594,7 +594,7 @@ public:
* @return dielectricOffset
*
*/
RealOpenMM getDielectricOffset( void ) const;
RealOpenMM getDielectricOffset() const;
/**
* Get the probe radius.
......@@ -602,7 +602,7 @@ public:
* @return probeRadius
*
*/
RealOpenMM getProbeRadius( void ) const;
RealOpenMM getProbeRadius() const;
/**
* Get the surface area factor.
......@@ -610,7 +610,7 @@ public:
* @return surfaceAreaFactor
*
*/
RealOpenMM getSurfaceAreaFactor( void ) const;
RealOpenMM getSurfaceAreaFactor() const;
/**
* Get the vector of particle radii.
......@@ -618,7 +618,7 @@ public:
* @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.
......@@ -626,7 +626,7 @@ public:
* @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.
......@@ -634,7 +634,7 @@ public:
* @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.
......
......@@ -46,11 +46,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM cosine,
RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine(RealOpenMM cosine,
RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR ) const {
RealOpenMM* dEdR) const {
// ---------------------------------------------------------------------------------------
......@@ -67,9 +67,9 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM
// ---------------------------------------------------------------------------------------
RealOpenMM angle;
if( cosine >= one ){
if (cosine >= one) {
angle = zero;
} else if( cosine <= -one ){
} else if (cosine <= -one) {
angle = RADIAN*PI_M;
} else {
angle = RADIAN*ACOS(cosine);
......@@ -79,10 +79,10 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM
RealOpenMM deltaIdeal3 = deltaIdeal*deltaIdeal2;
RealOpenMM deltaIdeal4 = deltaIdeal2*deltaIdeal2;
*dEdR = ( two + three*angleCubic*deltaIdeal +
four*angleQuartic*deltaIdeal2 +
five*anglePentic*deltaIdeal3 +
six*angleSextic*deltaIdeal4 );
*dEdR = (two + three*angleCubic*deltaIdeal +
four*angleQuartic*deltaIdeal2 +
five*anglePentic*deltaIdeal3 +
six*angleSextic*deltaIdeal4);
*dEdR *= RADIAN*angleK*deltaIdeal;
......@@ -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,
RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealVec* forces ) const {
RealVec* forces) const {
// ---------------------------------------------------------------------------------------
......@@ -132,30 +132,30 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
// ---------------------------------------------------------------------------------------
std::vector<RealOpenMM> deltaR[2];
AmoebaReferenceForce::loadDeltaR( positionAtomA, positionAtomB, deltaR[0] );
RealOpenMM rAB2 = AmoebaReferenceForce::getNormSquared3( deltaR[0] );
RealOpenMM rAB = SQRT( rAB2 );
AmoebaReferenceForce::loadDeltaR(positionAtomA, positionAtomB, deltaR[0]);
RealOpenMM rAB2 = AmoebaReferenceForce::getNormSquared3(deltaR[0]);
RealOpenMM rAB = SQRT(rAB2);
AmoebaReferenceForce::loadDeltaR( positionAtomC, positionAtomB, deltaR[1] );
RealOpenMM rCB2 = AmoebaReferenceForce::getNormSquared3( deltaR[1] );
RealOpenMM rCB = SQRT( rCB2 );
AmoebaReferenceForce::loadDeltaR(positionAtomC, positionAtomB, deltaR[1]);
RealOpenMM rCB2 = AmoebaReferenceForce::getNormSquared3(deltaR[1]);
RealOpenMM rCB = SQRT(rCB2);
if( rAB <= zero || rCB <= zero ){
if (rAB <= zero || rCB <= zero) {
return zero;
}
std::vector<RealOpenMM> pVector(3);
AmoebaReferenceForce::getCrossProduct( deltaR[0], deltaR[1], pVector );
RealOpenMM rp = AmoebaReferenceForce::getNorm3( pVector );
if( rp < 1.0e-06 ){
AmoebaReferenceForce::getCrossProduct(deltaR[0], deltaR[1], pVector);
RealOpenMM rp = AmoebaReferenceForce::getNorm3(pVector);
if (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 dEdR;
RealOpenMM energy = getPrefactorsGivenAngleCosine( cosine, angle, angleK, angleCubic, angleQuartic,
anglePentic, angleSextic, &dEdR );
RealOpenMM energy = getPrefactorsGivenAngleCosine(cosine, angle, angleK, angleCubic, angleQuartic,
anglePentic, angleSextic, &dEdR);
RealOpenMM termA = dEdR/(rAB2*rp);
RealOpenMM termC = -dEdR/(rCB2*rp);
......@@ -164,9 +164,9 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
deltaCrossP[0].resize(3);
deltaCrossP[1].resize(3);
deltaCrossP[2].resize(3);
AmoebaReferenceForce::getCrossProduct( deltaR[0], pVector, deltaCrossP[0] );
AmoebaReferenceForce::getCrossProduct( deltaR[1], pVector, deltaCrossP[2] );
for( unsigned int ii = 0; ii < 3; ii++ ){
AmoebaReferenceForce::getCrossProduct(deltaR[0], pVector, deltaCrossP[0]);
AmoebaReferenceForce::getCrossProduct(deltaR[1], pVector, deltaCrossP[2]);
for (unsigned int ii = 0; ii < 3; ii++) {
deltaCrossP[0][ii] *= termA;
deltaCrossP[2][ii] *= termC;
deltaCrossP[1][ii] = -1.0f*(deltaCrossP[0][ii] + deltaCrossP[2][ii]);
......@@ -174,7 +174,7 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
// accumulate forces
for( int jj = 0; jj < 3; jj++ ){
for (int jj = 0; jj < 3; jj++) {
forces[jj][0] = deltaCrossP[jj][0];
forces[jj][1] = deltaCrossP[jj][1];
forces[jj][2] = deltaCrossP[jj][2];
......@@ -183,7 +183,7 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
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>& particle2,
const std::vector<int>& particle3,
......@@ -202,10 +202,10 @@ RealOpenMM AmoebaReferenceAngleForce::calculateForceAndEnergy( int numAngles, ve
RealOpenMM idealAngle = angle[ii];
RealOpenMM angleK = kQuadratic[ii];
RealVec forces[3];
energy += calculateAngleIxn( posData[particle1Index], posData[particle2Index], posData[particle3Index],
idealAngle, angleK, angleCubic, angleQuartic, anglePentic, angleSextic, forces );
energy += calculateAngleIxn(posData[particle1Index], posData[particle2Index], posData[particle3Index],
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[particle2Index][jj] += forces[1][jj];
forceData[particle3Index][jj] += forces[2][jj];
......
......@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceAngleForce( ){};
AmoebaReferenceAngleForce() {};
/**---------------------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~AmoebaReferenceAngleForce( ){};
~AmoebaReferenceAngleForce() {};
/**---------------------------------------------------------------------------------------
......@@ -72,17 +72,17 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM globalAngleCubic,
RealOpenMM globalAngleQuartic,
RealOpenMM globalAnglePentic,
RealOpenMM globalAngleSextic,
std::vector<OpenMM::RealVec>& forceData ) const;
RealOpenMM calculateForceAndEnergy(int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM globalAngleCubic,
RealOpenMM globalAngleQuartic,
RealOpenMM globalAnglePentic,
RealOpenMM globalAngleSextic,
std::vector<OpenMM::RealVec>& forceData) const;
private:
......@@ -104,10 +104,10 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR ) const;
RealOpenMM getPrefactorsGivenAngleCosine(RealOpenMM cosine, RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR) const;
/**---------------------------------------------------------------------------------------
......@@ -128,12 +128,12 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateAngleIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC,
RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces ) const;
RealOpenMM calculateAngleIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC,
RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces) const;
};
......
......@@ -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 bondCubic, RealOpenMM bondQuartic,
RealVec* forces ) const {
RealVec* forces) const {
// ---------------------------------------------------------------------------------------
......@@ -63,8 +63,8 @@ RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAt
// get deltaR, R2, and R between 2 atoms
std::vector<RealOpenMM> deltaR;
AmoebaReferenceForce::loadDeltaR( positionAtomA, positionAtomB, deltaR );
RealOpenMM r = AmoebaReferenceForce::getNorm3( deltaR );
AmoebaReferenceForce::loadDeltaR(positionAtomA, positionAtomB, deltaR);
RealOpenMM r = AmoebaReferenceForce::getNorm3(deltaR);
// deltaIdeal = r - r_0
......@@ -84,11 +84,11 @@ RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAt
forces[1][1] = dEdR*deltaR[1];
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;
}
RealOpenMM AmoebaReferenceBondForce::calculateForceAndEnergy( int numBonds,
RealOpenMM AmoebaReferenceBondForce::calculateForceAndEnergy(int numBonds,
vector<RealVec>& particlePositions,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
......@@ -96,20 +96,20 @@ RealOpenMM AmoebaReferenceBondForce::calculateForceAndEnergy( int numBonds,
const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM globalBondCubic,
RealOpenMM globalBondQuartic,
vector<RealVec>& forceData ) const {
vector<RealVec>& forceData) const {
RealOpenMM energy = 0.0;
for( int ii = 0; ii < numBonds; ii++ ){
for (int ii = 0; ii < numBonds; ii++) {
int particle1Index = particle1[ii];
int particle2Index = particle2[ii];
RealOpenMM bondLength = length[ii];
RealOpenMM bondK = kQuadratic[ii];
RealVec forces[2];
energy += calculateBondIxn( particlePositions[particle1Index], particlePositions[particle2Index],
energy += calculateBondIxn(particlePositions[particle1Index], particlePositions[particle2Index],
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[particle2Index][jj] += forces[1][jj];
}
......
......@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceBondForce( ){};
AmoebaReferenceBondForce() {};
/**---------------------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~AmoebaReferenceBondForce( ){};
~AmoebaReferenceBondForce() {};
/**---------------------------------------------------------------------------------------
......@@ -69,13 +69,13 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numBonds, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<RealOpenMM>& bondLength,
const std::vector<RealOpenMM>& bondK,
RealOpenMM bondCubic, RealOpenMM bondQuartic,
std::vector<OpenMM::RealVec>& forceData ) const;
RealOpenMM calculateForceAndEnergy(int numBonds, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<RealOpenMM>& bondLength,
const std::vector<RealOpenMM>& bondK,
RealOpenMM bondCubic, RealOpenMM bondQuartic,
std::vector<OpenMM::RealVec>& forceData) const;
private:
......@@ -95,10 +95,10 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateBondIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
RealOpenMM bondLength, RealOpenMM bondK,
RealOpenMM bondCubic, RealOpenMM bondQuartic,
OpenMM::RealVec* forces ) const;
RealOpenMM calculateBondIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
RealOpenMM bondLength, RealOpenMM bondK,
RealOpenMM bondCubic, RealOpenMM bondQuartic,
OpenMM::RealVec* forces) const;
};
......
......@@ -37,8 +37,8 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yVector,
std::vector<RealOpenMM>& deltaR ){
void AmoebaReferenceForce::loadDeltaR(const RealVec& xVector, const RealVec& yVector,
std::vector<RealOpenMM>& deltaR) {
// ---------------------------------------------------------------------------------------
......@@ -48,9 +48,9 @@ void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yV
// ---------------------------------------------------------------------------------------
deltaR.resize(0);
deltaR.push_back( yVector[0] - xVector[0] );
deltaR.push_back( yVector[1] - xVector[1] );
deltaR.push_back( yVector[2] - xVector[2] );
deltaR.push_back(yVector[0] - xVector[0]);
deltaR.push_back(yVector[1] - xVector[1]);
deltaR.push_back(yVector[2] - xVector[2]);
}
/**---------------------------------------------------------------------------------------
......@@ -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>&
// 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>&
--------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector ){
RealOpenMM AmoebaReferenceForce::getNormSquared3(const RealOpenMM* inputVector) {
// ---------------------------------------------------------------------------------------
......@@ -96,7 +96,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector
// 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
--------------------------------------------------------------------------------------- */
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
// 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 ){
// 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 ){
// ---------------------------------------------------------------------------------------
RealOpenMM norm = SQRT( inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2] );
if( norm > 0.0 ){
RealOpenMM norm = SQRT(inputVector[0]*inputVector[0] + inputVector[1]*inputVector[1] + inputVector[2]*inputVector[2]);
if (norm > 0.0) {
RealOpenMM normI = 1.0/norm;
inputVector[0] *= normI;
inputVector[1] *= normI;
......@@ -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>&
--------------------------------------------------------------------------------------- */
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
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
--------------------------------------------------------------------------------------- */
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
--------------------------------------------------------------------------------------- */
void AmoebaReferenceForce::getCrossProduct( const std::vector<RealOpenMM>& xVector,
const std::vector<RealOpenMM>& yVector,
std::vector<RealOpenMM>& zVector ){
void AmoebaReferenceForce::getCrossProduct(const std::vector<RealOpenMM>& xVector,
const std::vector<RealOpenMM>& yVector,
std::vector<RealOpenMM>& zVector) {
// ---------------------------------------------------------------------------------------
......@@ -277,9 +277,9 @@ void AmoebaReferenceForce::getCrossProduct( const std::vector<RealOpenMM>& xVect
--------------------------------------------------------------------------------------- */
void AmoebaReferenceForce::getCrossProduct( const RealOpenMM* xVector,
const RealOpenMM* yVector,
RealOpenMM* zVector ){
void AmoebaReferenceForce::getCrossProduct(const RealOpenMM* xVector,
const RealOpenMM* yVector,
RealOpenMM* zVector) {
// ---------------------------------------------------------------------------------------
......
......@@ -41,7 +41,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceForce( );
AmoebaReferenceForce();
/**---------------------------------------------------------------------------------------
......@@ -49,7 +49,7 @@ public:
--------------------------------------------------------------------------------------- */
~AmoebaReferenceForce( );
~AmoebaReferenceForce();
/**---------------------------------------------------------------------------------------
......@@ -62,8 +62,8 @@ public:
--------------------------------------------------------------------------------------- */
static void loadDeltaR( const OpenMM::RealVec& xVector, const OpenMM::RealVec& yVector,
std::vector<RealOpenMM>& deltaR );
static void loadDeltaR(const OpenMM::RealVec& xVector, const OpenMM::RealVec& yVector,
std::vector<RealOpenMM>& deltaR);
/**---------------------------------------------------------------------------------------
......@@ -75,8 +75,8 @@ public:
--------------------------------------------------------------------------------------- */
static RealOpenMM getNormSquared3( const std::vector<RealOpenMM>& inputVector );
static RealOpenMM getNormSquared3( const RealOpenMM* inputVector );
static RealOpenMM getNormSquared3(const std::vector<RealOpenMM>& inputVector);
static RealOpenMM getNormSquared3(const RealOpenMM* inputVector);
/**---------------------------------------------------------------------------------------
......@@ -88,8 +88,8 @@ public:
--------------------------------------------------------------------------------------- */
static RealOpenMM getNorm3( const std::vector<RealOpenMM>& inputVector );
static RealOpenMM getNorm3( const RealOpenMM* inputVector );
static RealOpenMM getNorm3(const std::vector<RealOpenMM>& inputVector);
static RealOpenMM getNorm3(const RealOpenMM* inputVector);
/**---------------------------------------------------------------------------------------
......@@ -101,7 +101,7 @@ public:
--------------------------------------------------------------------------------------- */
static RealOpenMM normalizeVector3( RealOpenMM* inputVector );
static RealOpenMM normalizeVector3(RealOpenMM* inputVector);
/**---------------------------------------------------------------------------------------
......@@ -114,10 +114,10 @@ public:
--------------------------------------------------------------------------------------- */
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 OpenMM::Vec3& yVector );
static RealOpenMM getDotProduct3( unsigned int vectorOffset, const std::vector<RealOpenMM>& xVector, const 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 OpenMM::Vec3& yVector);
static RealOpenMM getDotProduct3(unsigned int vectorOffset, const std::vector<RealOpenMM>& xVector, const RealOpenMM* yVector);
/**---------------------------------------------------------------------------------------
......@@ -129,10 +129,10 @@ public:
--------------------------------------------------------------------------------------- */
static void getCrossProduct( const std::vector<RealOpenMM>& xVector, const std::vector<RealOpenMM>& yVector,
std::vector<RealOpenMM>& zVector );
static void getCrossProduct(const std::vector<RealOpenMM>& xVector, const std::vector<RealOpenMM>& yVector,
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 @@
using std::vector;
using namespace OpenMM;
AmoebaReferenceGeneralizedKirkwoodForce::AmoebaReferenceGeneralizedKirkwoodForce( ) : _numParticles(0),
AmoebaReferenceGeneralizedKirkwoodForce::AmoebaReferenceGeneralizedKirkwoodForce() : _numParticles(0),
_includeCavityTerm(1),
_directPolarization(0),
_soluteDielectric(1.0),
......@@ -37,101 +37,101 @@ AmoebaReferenceGeneralizedKirkwoodForce::AmoebaReferenceGeneralizedKirkwoodForce
}
void AmoebaReferenceGeneralizedKirkwoodForce::setNumParticles( int numParticles ){
void AmoebaReferenceGeneralizedKirkwoodForce::setNumParticles(int numParticles) {
_numParticles = numParticles;
}
int AmoebaReferenceGeneralizedKirkwoodForce::getNumParticles( void ) const {
int AmoebaReferenceGeneralizedKirkwoodForce::getNumParticles() const {
return _numParticles;
}
void AmoebaReferenceGeneralizedKirkwoodForce::setIncludeCavityTerm( int includeCavityTerm ){
void AmoebaReferenceGeneralizedKirkwoodForce::setIncludeCavityTerm(int includeCavityTerm) {
_includeCavityTerm = includeCavityTerm;
}
int AmoebaReferenceGeneralizedKirkwoodForce::getIncludeCavityTerm( void ) const {
int AmoebaReferenceGeneralizedKirkwoodForce::getIncludeCavityTerm() const {
return _includeCavityTerm;
}
void AmoebaReferenceGeneralizedKirkwoodForce::setDirectPolarization( int directPolarization ){
void AmoebaReferenceGeneralizedKirkwoodForce::setDirectPolarization(int directPolarization) {
_directPolarization = directPolarization;
}
int AmoebaReferenceGeneralizedKirkwoodForce::getDirectPolarization( void ) const {
int AmoebaReferenceGeneralizedKirkwoodForce::getDirectPolarization() const {
return _directPolarization;
}
void AmoebaReferenceGeneralizedKirkwoodForce::setSoluteDielectric( RealOpenMM soluteDielectric ){
void AmoebaReferenceGeneralizedKirkwoodForce::setSoluteDielectric(RealOpenMM soluteDielectric) {
_soluteDielectric = soluteDielectric;
}
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSoluteDielectric( void ) const {
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSoluteDielectric() const {
return _soluteDielectric;
}
void AmoebaReferenceGeneralizedKirkwoodForce::setSolventDielectric( RealOpenMM solventDielectric ){
void AmoebaReferenceGeneralizedKirkwoodForce::setSolventDielectric(RealOpenMM solventDielectric) {
_solventDielectric = solventDielectric;
}
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSolventDielectric( void ) const {
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSolventDielectric() const {
return _solventDielectric;
}
void AmoebaReferenceGeneralizedKirkwoodForce::setDielectricOffset( RealOpenMM dielectricOffset ){
void AmoebaReferenceGeneralizedKirkwoodForce::setDielectricOffset(RealOpenMM dielectricOffset) {
_dielectricOffset = dielectricOffset;
}
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getDielectricOffset( void ) const {
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getDielectricOffset() const {
return _dielectricOffset;
}
void AmoebaReferenceGeneralizedKirkwoodForce::setProbeRadius( RealOpenMM probeRadius ){
void AmoebaReferenceGeneralizedKirkwoodForce::setProbeRadius(RealOpenMM probeRadius) {
_probeRadius = probeRadius;
}
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getProbeRadius( void ) const {
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getProbeRadius() const {
return _probeRadius;
}
void AmoebaReferenceGeneralizedKirkwoodForce::setSurfaceAreaFactor( RealOpenMM surfaceAreaFactor ){
void AmoebaReferenceGeneralizedKirkwoodForce::setSurfaceAreaFactor(RealOpenMM surfaceAreaFactor) {
_surfaceAreaFactor = surfaceAreaFactor;
}
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSurfaceAreaFactor( void ) const {
RealOpenMM AmoebaReferenceGeneralizedKirkwoodForce::getSurfaceAreaFactor() const {
return _surfaceAreaFactor;
}
void AmoebaReferenceGeneralizedKirkwoodForce::setAtomicRadii( const vector<RealOpenMM>& atomicRadii ){
_atomicRadii.resize( atomicRadii.size() );
copy( atomicRadii.begin(), atomicRadii.end(), _atomicRadii.begin() );
void AmoebaReferenceGeneralizedKirkwoodForce::setAtomicRadii(const vector<RealOpenMM>& atomicRadii) {
_atomicRadii.resize(atomicRadii.size());
copy(atomicRadii.begin(), atomicRadii.end(), _atomicRadii.begin());
}
void AmoebaReferenceGeneralizedKirkwoodForce::getAtomicRadii( vector<RealOpenMM>& atomicRadii ) const {
atomicRadii.resize( _atomicRadii.size() );
copy( _atomicRadii.begin(), _atomicRadii.end(), atomicRadii.begin() );
void AmoebaReferenceGeneralizedKirkwoodForce::getAtomicRadii(vector<RealOpenMM>& atomicRadii) const {
atomicRadii.resize(_atomicRadii.size());
copy(_atomicRadii.begin(), _atomicRadii.end(), atomicRadii.begin());
}
void AmoebaReferenceGeneralizedKirkwoodForce::setScaleFactors( const vector<RealOpenMM>& scaleFactors ){
_scaleFactors.resize( scaleFactors.size() );
copy( scaleFactors.begin(), scaleFactors.end(), _scaleFactors.begin() );
void AmoebaReferenceGeneralizedKirkwoodForce::setScaleFactors(const vector<RealOpenMM>& scaleFactors) {
_scaleFactors.resize(scaleFactors.size());
copy(scaleFactors.begin(), scaleFactors.end(), _scaleFactors.begin());
}
void AmoebaReferenceGeneralizedKirkwoodForce::getScaleFactors( vector<RealOpenMM>& scaleFactors ) const {
scaleFactors.resize( _scaleFactors.size() );
copy( _scaleFactors.begin(), _scaleFactors.end(), scaleFactors.begin() );
void AmoebaReferenceGeneralizedKirkwoodForce::getScaleFactors(vector<RealOpenMM>& scaleFactors) const {
scaleFactors.resize(_scaleFactors.size());
copy(_scaleFactors.begin(), _scaleFactors.end(), scaleFactors.begin());
}
void AmoebaReferenceGeneralizedKirkwoodForce::setCharges( const vector<RealOpenMM>& charges ){
_charges.resize( charges.size() );
copy( charges.begin(), charges.end(), _charges.begin() );
void AmoebaReferenceGeneralizedKirkwoodForce::setCharges(const vector<RealOpenMM>& charges) {
_charges.resize(charges.size());
copy(charges.begin(), charges.end(), _charges.begin());
}
void AmoebaReferenceGeneralizedKirkwoodForce::getGrycukBornRadii( vector<RealOpenMM>& bornRadii ) const {
bornRadii.resize( _bornRadii.size() );
copy( _bornRadii.begin(), _bornRadii.end(), bornRadii.begin() );
void AmoebaReferenceGeneralizedKirkwoodForce::getGrycukBornRadii(vector<RealOpenMM>& bornRadii) const {
bornRadii.resize(_bornRadii.size());
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 one = 1.0;
......@@ -142,30 +142,30 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
const RealOpenMM oneThird = 1.0/3.0;
const RealOpenMM bigRadius = 1000.0;
_bornRadii.resize( _numParticles );
for( unsigned int ii = 0; ii < _numParticles; ii++ ){
_bornRadii.resize(_numParticles);
for (unsigned int ii = 0; ii < _numParticles; ii++) {
if( _atomicRadii[ii] <= zero ){
if (_atomicRadii[ii] <= zero) {
_bornRadii[ii] = bigRadius;
continue;
}
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 yr = particlePositions[jj][1] - particlePositions[ii][1];
RealOpenMM zr = particlePositions[jj][2] - particlePositions[ii][2];
RealOpenMM r2 = xr*xr + yr*yr + zr*zr;
RealOpenMM r = SQRT( r2 );
RealOpenMM r = SQRT(r2);
RealOpenMM sk = _atomicRadii[jj]*_scaleFactors[jj];
RealOpenMM sk2 = sk*sk;
if( (_atomicRadii[ii] + r) < sk ){
if ((_atomicRadii[ii] + r) < sk) {
RealOpenMM lik = _atomicRadii[ii];
RealOpenMM uik = sk - r;
RealOpenMM lik3 = lik*lik*lik;
......@@ -175,9 +175,9 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
RealOpenMM uik = r + sk;
RealOpenMM lik;
if( (_atomicRadii[ii] + r) < sk ){
if ((_atomicRadii[ii] + r) < sk) {
lik = sk - r;
} else if( r < (_atomicRadii[ii] + sk) ){
} else if (r < (_atomicRadii[ii] + sk)) {
lik = _atomicRadii[ii];
} else {
lik = r - sk;
......@@ -198,7 +198,7 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
}
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;
......
......@@ -41,13 +41,13 @@ public:
* Constructor
*
*/
AmoebaReferenceGeneralizedKirkwoodForce( );
AmoebaReferenceGeneralizedKirkwoodForce();
/**
* Destructor
*
*/
~AmoebaReferenceGeneralizedKirkwoodForce( ){};
~AmoebaReferenceGeneralizedKirkwoodForce() {};
/**
* Get number of particles
......@@ -55,7 +55,7 @@ public:
* @return numParticles
*
*/
int getNumParticles( void ) const;
int getNumParticles() const;
/**
* Set numParticles
......@@ -63,7 +63,7 @@ public:
* @param numParticles
*
*/
void setNumParticles( int numParticles );
void setNumParticles(int numParticles);
/**
* Get includeCavityTerm flag
......@@ -71,7 +71,7 @@ public:
* @return includeCavityTerm
*
*/
int getIncludeCavityTerm( void ) const;
int getIncludeCavityTerm() const;
/**
* Set includeCavityTerm flag
......@@ -79,7 +79,7 @@ public:
* @param includeCavityTerm flag indicating whether surface area term is to be included
*
*/
void setIncludeCavityTerm( int includeCavityTerm );
void setIncludeCavityTerm(int includeCavityTerm);
/**
* Get directPolarization flag
......@@ -87,21 +87,21 @@ public:
* @return directPolarization
*
*/
int getDirectPolarization( void ) const;
int getDirectPolarization() const;
/**
* Set directPolarization flag
*
* @param directPolarization nonzero if direct as opposed to mutual polarization
*/
void setDirectPolarization( int directPolarization );
void setDirectPolarization(int directPolarization);
/**
* Get solute dielectric
*
* @return soluteDielectric
*/
RealOpenMM getSoluteDielectric( void ) const;
RealOpenMM getSoluteDielectric() const;
/**
* Set solute dielectric
......@@ -109,7 +109,7 @@ public:
* @param soluteDielectric solute dielectric
*
*/
void setSoluteDielectric( RealOpenMM soluteDielectric );
void setSoluteDielectric(RealOpenMM soluteDielectric);
/**
* Get solvent dielectric
......@@ -117,7 +117,7 @@ public:
* @return solventDielectric
*
*/
RealOpenMM getSolventDielectric( void ) const;
RealOpenMM getSolventDielectric() const;
/**
* Set solvent dielectric
......@@ -125,7 +125,7 @@ public:
* @param solventDielectric solvent dielectric
*
*/
void setSolventDielectric( RealOpenMM solventDielectric );
void setSolventDielectric(RealOpenMM solventDielectric);
/**
* Get dielectric offset
......@@ -133,7 +133,7 @@ public:
* @return dielectricOffset
*
*/
RealOpenMM getDielectricOffset( void ) const;
RealOpenMM getDielectricOffset() const;
/**
* Set dielectric offset
......@@ -141,7 +141,7 @@ public:
* @param dielectricOffset dielectric offset
*
*/
void setDielectricOffset( RealOpenMM dielectricOffset );
void setDielectricOffset(RealOpenMM dielectricOffset);
/**
* Get probeRadius
......@@ -149,7 +149,7 @@ public:
* @return probeRadius
*
*/
RealOpenMM getProbeRadius( void ) const;
RealOpenMM getProbeRadius() const;
/**
* Set probe radius
......@@ -157,7 +157,7 @@ public:
* @param probeRadius probe radiue
*
*/
void setProbeRadius( RealOpenMM probeRadius );
void setProbeRadius(RealOpenMM probeRadius);
/**
* Get surfaceAreaFactor
......@@ -165,7 +165,7 @@ public:
* @return surfaceAreaFactor
*
*/
RealOpenMM getSurfaceAreaFactor( void ) const;
RealOpenMM getSurfaceAreaFactor() const;
/**
* Set surface area factor
......@@ -173,7 +173,7 @@ public:
* @param surfaceAreaFactor surface area factor
*
*/
void setSurfaceAreaFactor( RealOpenMM surfaceAreaFactor );
void setSurfaceAreaFactor(RealOpenMM surfaceAreaFactor);
/**
* Set atomic radii
......@@ -181,7 +181,7 @@ public:
* @param atomicRadii input vector of atomic radii
*
*/
void setAtomicRadii( const vector<RealOpenMM>& atomicRadii );
void setAtomicRadii(const vector<RealOpenMM>& atomicRadii);
/**
* Get atomic radii
......@@ -189,7 +189,7 @@ public:
* @param atomicRadii output vector of atomic radii
*
*/
void getAtomicRadii( vector<RealOpenMM>& atomicRadii ) const;
void getAtomicRadii(vector<RealOpenMM>& atomicRadii) const;
/**
* Set scale factors
......@@ -197,7 +197,7 @@ public:
* @param scaleFactors input vector of scale factors
*
*/
void setScaleFactors( const vector<RealOpenMM>& scaleFactors );
void setScaleFactors(const vector<RealOpenMM>& scaleFactors);
/**
* Get scale factors
......@@ -205,7 +205,7 @@ public:
* @param scaleFactors output vector of scale factors
*
*/
void getScaleFactors( vector<RealOpenMM>& scaleFactors ) const;
void getScaleFactors(vector<RealOpenMM>& scaleFactors) const;
/**
* Set charges
......@@ -213,7 +213,7 @@ public:
* @param charges input vector of charges
*
*/
void setCharges( const vector<RealOpenMM>& charges );
void setCharges(const vector<RealOpenMM>& charges);
/**
* Calculate Grycuk Born radii
......@@ -221,7 +221,7 @@ public:
* @param particlePositions particle positions
*
*/
void calculateGrycukBornRadii( const vector<RealVec>& particlePositions );
void calculateGrycukBornRadii(const vector<RealVec>& particlePositions);
/**
* Get Grycik Born radii (must have called calculateGrycukBornRadii())
......@@ -229,7 +229,7 @@ public:
* @param bornRadii vector of Born radii
*
*/
void getGrycukBornRadii( vector<RealOpenMM>& bornRadii ) const;
void getGrycukBornRadii(vector<RealOpenMM>& bornRadii) const;
private:
......
......@@ -46,11 +46,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM cosine,
RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine(RealOpenMM cosine,
RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR ) const {
RealOpenMM* dEdR) const {
// ---------------------------------------------------------------------------------------
......@@ -67,9 +67,9 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real
// ---------------------------------------------------------------------------------------
RealOpenMM angle;
if( cosine >= one ){
if (cosine >= one) {
angle = zero;
} else if( cosine <= -one ){
} else if (cosine <= -one) {
angle = RADIAN*PI_M;
} else {
angle = RADIAN*ACOS(cosine);
......@@ -79,10 +79,10 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real
RealOpenMM deltaIdeal3 = deltaIdeal*deltaIdeal2;
RealOpenMM deltaIdeal4 = deltaIdeal2*deltaIdeal2;
*dEdR = ( two + three*angleCubic*deltaIdeal +
four*angleQuartic*deltaIdeal2 +
five*anglePentic*deltaIdeal3 +
six*angleSextic*deltaIdeal4 );
*dEdR = (two + three*angleCubic*deltaIdeal +
four*angleQuartic*deltaIdeal2 +
five*anglePentic*deltaIdeal3 +
six*angleSextic*deltaIdeal4);
*dEdR *= RADIAN*angleK*deltaIdeal;
......@@ -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,
RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealVec* forces ) const {
RealVec* forces) const {
// ---------------------------------------------------------------------------------------
......@@ -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 };
std::vector<RealOpenMM> deltaR[LastDeltaAtomIndex];
for( int ii = 0; ii < LastDeltaAtomIndex; ii++ ){
for (int ii = 0; ii < LastDeltaAtomIndex; ii++) {
deltaR[ii].resize(3);
}
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomA, deltaR[AD] );
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomB, deltaR[BD] );
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomC, deltaR[CD] );
AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomA, deltaR[AD]);
AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomB, deltaR[BD]);
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 delta = AmoebaReferenceForce::getDotProduct3( deltaR[T], deltaR[BD] )/rT2;
RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3(deltaR[T]);
RealOpenMM delta = AmoebaReferenceForce::getDotProduct3(deltaR[T], deltaR[BD])/rT2;
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[AP][ii] = positionAtomA[ii] - deltaR[P][ii];
deltaR[CP][ii] = positionAtomC[ii] - deltaR[P][ii];
}
RealOpenMM rAp2 = AmoebaReferenceForce::getNormSquared3( deltaR[AP] );
RealOpenMM rCp2 = AmoebaReferenceForce::getNormSquared3( deltaR[CP] );
if( rAp2 <= zero && rCp2 <= zero ){
RealOpenMM rAp2 = AmoebaReferenceForce::getNormSquared3(deltaR[AP]);
RealOpenMM rCp2 = AmoebaReferenceForce::getNormSquared3(deltaR[CP]);
if (rAp2 <= zero && rCp2 <= 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] );
if( rm < 1.0e-06 ){
RealOpenMM rm = AmoebaReferenceForce::getNorm3(deltaR[M]);
if (rm < 1.0e-06) {
rm = 1.0e-06;
}
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3( deltaR[AP], deltaR[CP] );
RealOpenMM cosine = dot/SQRT( rAp2*rCp2 );
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3(deltaR[AP], deltaR[CP]);
RealOpenMM cosine = dot/SQRT(rAp2*rCp2);
RealOpenMM dEdR;
RealOpenMM energy = getPrefactorsGivenAngleCosine( cosine, angle, angleK, angleCubic, angleQuartic,
anglePentic, angleSextic, &dEdR );
RealOpenMM energy = getPrefactorsGivenAngleCosine(cosine, angle, angleK, angleCubic, angleQuartic,
anglePentic, angleSextic, &dEdR);
RealOpenMM termA = -dEdR/(rAp2*rm);
RealOpenMM termC = dEdR/(rCp2*rm);
AmoebaReferenceForce::getCrossProduct( deltaR[AP], deltaR[M], deltaR[APxM] );
AmoebaReferenceForce::getCrossProduct( deltaR[CP], deltaR[M], deltaR[CPxM] );
AmoebaReferenceForce::getCrossProduct(deltaR[AP], deltaR[M], deltaR[APxM]);
AmoebaReferenceForce::getCrossProduct(deltaR[CP], deltaR[M], deltaR[CPxM]);
// forces will be gathered here
enum { dA, dB, dC, dD, LastDIndex };
std::vector<RealOpenMM> forceTerm[LastDIndex];
for( int ii = 0; ii < LastDIndex; ii++ ){
for (int ii = 0; ii < LastDIndex; ii++) {
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[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;
AmoebaReferenceForce::getCrossProduct( deltaR[CD], forceTerm[dB], deltaR[CDxdB] );
AmoebaReferenceForce::getCrossProduct( forceTerm[dB], deltaR[AD], deltaR[dBxAD] );
AmoebaReferenceForce::getCrossProduct(deltaR[CD], forceTerm[dB], deltaR[CDxdB]);
AmoebaReferenceForce::getCrossProduct(forceTerm[dB], deltaR[AD], deltaR[dBxAD]);
if( FABS( pTrT2 ) > 1.0e-08 ){
if (FABS(pTrT2) > 1.0e-08) {
RealOpenMM delta2 = delta*two;
AmoebaReferenceForce::getCrossProduct( deltaR[BD], deltaR[CD], deltaR[BDxCD] );
AmoebaReferenceForce::getCrossProduct( deltaR[T], deltaR[CD], deltaR[TxCD] );
AmoebaReferenceForce::getCrossProduct( deltaR[AD], deltaR[BD], deltaR[ADxBD] );
AmoebaReferenceForce::getCrossProduct( deltaR[AD], deltaR[T], deltaR[ADxT] );
for( int ii = 0; ii < 3; ii++ ){
AmoebaReferenceForce::getCrossProduct(deltaR[BD], deltaR[CD], deltaR[BDxCD]);
AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[CD], deltaR[TxCD] );
AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[BD], deltaR[ADxBD]);
AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[T], deltaR[ADxT] );
for (int ii = 0; ii < 3; ii++) {
RealOpenMM term = deltaR[BDxCD][ii] + delta2*deltaR[TxCD][ii];
forceTerm[dA][ii] += delta*deltaR[CDxdB][ii] + term*pTrT2;
......@@ -221,21 +221,21 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p
term = deltaR[ADxBD][ii] + delta2*deltaR[ADxT][ii];
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 {
for( int ii = 0; ii < 3; ii++ ){
for (int ii = 0; ii < 3; ii++) {
forceTerm[dA][ii] += delta*deltaR[CDxdB][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
for( int jj = 0; jj < 4; jj++ ){
for (int jj = 0; jj < 4; jj++) {
forces[jj][0] = forceTerm[jj][0];
forces[jj][1] = forceTerm[jj][1];
forces[jj][2] = forceTerm[jj][2];
......@@ -245,18 +245,18 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p
}
RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateForceAndEnergy( int numAngles, vector<RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM angleCubic,
RealOpenMM angleQuartic,
RealOpenMM anglePentic,
RealOpenMM angleSextic,
vector<RealVec>& forceData) const {
RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateForceAndEnergy(int numAngles, vector<RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM angleCubic,
RealOpenMM angleQuartic,
RealOpenMM anglePentic,
RealOpenMM angleSextic,
vector<RealVec>& forceData) const {
RealOpenMM energy = 0.0;
for (unsigned int ii = 0; ii < static_cast<unsigned int>(numAngles); ii++) {
int particle1Index = particle1[ii];
......@@ -266,12 +266,12 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateForceAndEnergy( int numAng
RealOpenMM idealAngle = angle[ii];
RealOpenMM angleK = kQuadratic[ii];
RealVec forces[4];
energy += calculateAngleIxn( posData[particle1Index], posData[particle2Index], posData[particle3Index], posData[particle4Index],
idealAngle, angleK, angleCubic, angleQuartic, anglePentic, angleSextic, forces );
energy += calculateAngleIxn(posData[particle1Index], posData[particle2Index], posData[particle3Index], posData[particle4Index],
idealAngle, angleK, angleCubic, angleQuartic, anglePentic, angleSextic, forces);
// accumulate forces
for( int jj = 0; jj < 3; jj++ ){
for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] -= forces[0][jj];
forceData[particle2Index][jj] -= forces[1][jj];
forceData[particle3Index][jj] -= forces[2][jj];
......
......@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceInPlaneAngleForce( ){};
AmoebaReferenceInPlaneAngleForce() {};
/**---------------------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~AmoebaReferenceInPlaneAngleForce( ){};
~AmoebaReferenceInPlaneAngleForce() {};
/**---------------------------------------------------------------------------------------
......@@ -73,18 +73,18 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM globalAngleCubic,
RealOpenMM globalAngleQuartic,
RealOpenMM globalAnglePentic,
RealOpenMM globalAngleSextic,
std::vector<OpenMM::RealVec>& forceData ) const;
RealOpenMM calculateForceAndEnergy(int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& kQuadratic,
RealOpenMM globalAngleCubic,
RealOpenMM globalAngleQuartic,
RealOpenMM globalAnglePentic,
RealOpenMM globalAngleSextic,
std::vector<OpenMM::RealVec>& forceData) const;
private:
......@@ -106,10 +106,10 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR ) const;
RealOpenMM getPrefactorsGivenAngleCosine(RealOpenMM cosine, RealOpenMM idealAngle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealOpenMM* dEdR) const;
/**---------------------------------------------------------------------------------------
......@@ -131,12 +131,12 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateAngleIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces ) const;
RealOpenMM calculateAngleIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
RealOpenMM angle, RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces) const;
};
......
......@@ -789,7 +789,7 @@ void AmoebaReferenceMultipoleForce::convergeInduceDipolesBySOR(const vector<Mult
// (2) iterations == max iterations or
// (3) convergence factor (spsilon) increases
while(!done) {
while (!done) {
RealOpenMM epsilon = updateInducedDipoleFields(particleData, updateInducedDipoleField);
epsilon = _polarSOR*_debye*SQRT(epsilon/(static_cast<RealOpenMM>(_numParticles)));
......@@ -1868,7 +1868,7 @@ void AmoebaReferenceMultipoleForce::calculateElectrostaticPotential(const vector
for (unsigned int ii = 0; ii < _numParticles; ii++) {
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
/**
* 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];
......
......@@ -354,7 +354,7 @@ public:
* Destructor
*
*/
virtual ~AmoebaReferenceMultipoleForce(){};
virtual ~AmoebaReferenceMultipoleForce() {};
/**
* Get nonbonded method.
......
......@@ -48,12 +48,12 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomD,
RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealVec* forces ) const {
RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomD,
RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
RealVec* forces) const {
// ---------------------------------------------------------------------------------------
......@@ -76,34 +76,34 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// and various intermediate terms
std::vector<RealOpenMM> deltaR[LastDeltaIndex];
for( int ii = 0; ii < LastDeltaIndex; ii++ ){
for (int ii = 0; ii < LastDeltaIndex; ii++) {
deltaR[ii].resize(3);
}
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomA, deltaR[AB] );
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomC, deltaR[CB] );
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomD, deltaR[DB] );
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomA, deltaR[AD] );
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomC, deltaR[CD] );
AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomA, deltaR[AB]);
AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomC, deltaR[CB]);
AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomD, deltaR[DB]);
AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomA, deltaR[AD]);
AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomC, deltaR[CD]);
RealOpenMM rDB2 = AmoebaReferenceForce::getNormSquared3( deltaR[DB] );
RealOpenMM rAD2 = AmoebaReferenceForce::getNormSquared3( deltaR[AD] );
RealOpenMM rCD2 = AmoebaReferenceForce::getNormSquared3( deltaR[CD] );
RealOpenMM rDB2 = AmoebaReferenceForce::getNormSquared3(deltaR[DB]);
RealOpenMM rAD2 = AmoebaReferenceForce::getNormSquared3(deltaR[AD]);
RealOpenMM rCD2 = AmoebaReferenceForce::getNormSquared3(deltaR[CD]);
std::vector<RealOpenMM> tempVector(3);
AmoebaReferenceForce::getCrossProduct( deltaR[CB], deltaR[DB], tempVector );
RealOpenMM eE = AmoebaReferenceForce::getDotProduct3( deltaR[AB], tempVector );
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3( deltaR[AD], deltaR[CD] );
AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[DB], tempVector);
RealOpenMM eE = AmoebaReferenceForce::getDotProduct3(deltaR[AB], tempVector );
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3(deltaR[AD], deltaR[CD]);
RealOpenMM cc = rAD2*rCD2 - dot*dot;
if( rDB2 <= zero || cc == zero ){
if (rDB2 <= zero || cc == zero) {
return zero;
}
RealOpenMM bkk2 = rDB2 - eE*eE/cc;
RealOpenMM cosine = SQRT(bkk2/rDB2);
RealOpenMM angle;
if( cosine >= one ){
if (cosine >= one) {
angle = zero;
} else if( cosine <= -one ){
} else if (cosine <= -one) {
angle = PI_M;
} else {
angle = RADIAN*ACOS(cosine);
......@@ -122,7 +122,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
dEdDt *= angleK*dt*RADIAN;
RealOpenMM dEdCos = dEdDt/SQRT(cc*bkk2);
if( eE > zero ){
if (eE > zero) {
dEdCos *= -one;
}
......@@ -131,20 +131,20 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
std::vector<RealOpenMM> dccd[LastAtomIndex];
std::vector<RealOpenMM> deed[LastAtomIndex];
std::vector<RealOpenMM> subForce[LastAtomIndex];
for( int ii = 0; ii < LastAtomIndex; ii++ ){
for (int ii = 0; ii < LastAtomIndex; ii++) {
dccd[ii].resize(3);
deed[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[C][ii] = (deltaR[CD][ii]*rAD2 - deltaR[AD][ii]*dot)*term;
dccd[D][ii] = -one*(dccd[A][ii] + dccd[C][ii]);
}
AmoebaReferenceForce::getCrossProduct( deltaR[DB], deltaR[CB], deed[A] );
AmoebaReferenceForce::getCrossProduct( deltaR[AB], deltaR[DB], deed[C] );
AmoebaReferenceForce::getCrossProduct( deltaR[CB], deltaR[AB], deed[D] );
AmoebaReferenceForce::getCrossProduct(deltaR[DB], deltaR[CB], deed[A]);
AmoebaReferenceForce::getCrossProduct(deltaR[AB], deltaR[DB], deed[C]);
AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[AB], deed[D]);
term = eE/rDB2;
deed[D][0] += deltaR[DB][0]*term;
......@@ -156,23 +156,23 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// forces
// 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
for( int ii = 0; ii < 3; ii++ ){
subForce[jj][ii] = dEdCos*( dccd[jj][ii] + deed[jj][ii] );
for (int ii = 0; ii < 3; 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
if( jj == 3 ){
for( int ii = 0; ii < 3; ii++ ){
if (jj == 3) {
for (int ii = 0; ii < 3; ii++) {
subForce[1][ii] = -one*(subForce[0][ii] + subForce[2][ii] + subForce[3][ii]);
}
}
......@@ -180,8 +180,8 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// add in forces
for( int jj = 0; jj < LastAtomIndex; jj++ ){
for( int ii = 0; ii < 3; ii++ ){
for (int jj = 0; jj < LastAtomIndex; jj++) {
for (int ii = 0; ii < 3; ii++) {
forces[jj][ii] = subForce[jj][ii];
}
}
......@@ -196,7 +196,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
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>& particle2,
const std::vector<int>& particle3,
......@@ -215,9 +215,9 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateForceAndEnergy( int numO
int particle4Index = particle4[ii];
RealOpenMM kAngle = kQuadratic[ii];
RealVec forces[4];
energy += calculateOutOfPlaneBendIxn( posData[particle1Index], posData[particle2Index], posData[particle3Index], posData[particle4Index],
kAngle, angleCubic, angleQuartic, anglePentic, angleSextic, forces );
for( int jj = 0; jj < 3; jj++ ){
energy += calculateOutOfPlaneBendIxn(posData[particle1Index], posData[particle2Index], posData[particle3Index], posData[particle4Index],
kAngle, angleCubic, angleQuartic, anglePentic, angleSextic, forces);
for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] -= forces[0][jj];
forceData[particle2Index][jj] -= forces[1][jj];
forceData[particle3Index][jj] -= forces[2][jj];
......
......@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceOutOfPlaneBendForce( ){};
AmoebaReferenceOutOfPlaneBendForce() {};
/**---------------------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~AmoebaReferenceOutOfPlaneBendForce( ){};
~AmoebaReferenceOutOfPlaneBendForce() {};
/**---------------------------------------------------------------------------------------
......@@ -72,17 +72,17 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numOutOfPlaneBends, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<RealOpenMM>& kAngle,
RealOpenMM angleCubic,
RealOpenMM angleQuartic,
RealOpenMM anglePentic,
RealOpenMM angleSextic,
std::vector<OpenMM::RealVec>& forceData) const;
RealOpenMM calculateForceAndEnergy(int numOutOfPlaneBends, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<RealOpenMM>& kAngle,
RealOpenMM angleCubic,
RealOpenMM angleQuartic,
RealOpenMM anglePentic,
RealOpenMM angleSextic,
std::vector<OpenMM::RealVec>& forceData) const;
private:
......@@ -105,12 +105,12 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateOutOfPlaneBendIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces ) const;
RealOpenMM calculateOutOfPlaneBendIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
RealOpenMM angleK,
RealOpenMM angleCubic, RealOpenMM angleQuartic,
RealOpenMM anglePentic, RealOpenMM angleSextic,
OpenMM::RealVec* forces) const;
};
......
......@@ -46,10 +46,10 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomD,
const RealVec& positionAtomE, const RealVec& positionAtomF,
RealOpenMM piTorsionK, RealVec* forces ) const {
RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC, const RealVec& positionAtomD,
const RealVec& positionAtomE, const RealVec& positionAtomF,
RealOpenMM piTorsionK, RealVec* forces) const {
// ---------------------------------------------------------------------------------------
......@@ -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 };
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);
}
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomA, deltaR[AD] );
AmoebaReferenceForce::loadDeltaR( positionAtomD, positionAtomB, deltaR[BD] );
AmoebaReferenceForce::loadDeltaR( positionAtomC, positionAtomE, deltaR[EC] );
AmoebaReferenceForce::loadDeltaR( positionAtomC, positionAtomF, deltaR[FC] );
AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomA, deltaR[AD]);
AmoebaReferenceForce::loadDeltaR(positionAtomD, positionAtomB, deltaR[BD]);
AmoebaReferenceForce::loadDeltaR(positionAtomC, positionAtomE, deltaR[EC]);
AmoebaReferenceForce::loadDeltaR(positionAtomC, positionAtomF, deltaR[FC]);
enum { A, B, C, D, E, F, 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);
}
AmoebaReferenceForce::getCrossProduct( deltaR[AD], deltaR[BD], deltaR[P] );
AmoebaReferenceForce::getCrossProduct( deltaR[EC], deltaR[FC], deltaR[Q] );
for( int ii = 0; ii < 3; ii++ ){
AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[BD], deltaR[P]);
AmoebaReferenceForce::getCrossProduct(deltaR[EC], deltaR[FC], deltaR[Q]);
for (int ii = 0; ii < 3; ii++) {
deltaR[CP][ii] = -deltaR[P][ii];
deltaR[DC][ii] = positionAtomD[ii] - positionAtomC[ii];
deltaR[QD][ii] = deltaR[Q][ii];
......@@ -88,24 +88,24 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
deltaR[P][ii] += positionAtomC[ii];
deltaR[Q][ii] += positionAtomD[ii];
}
AmoebaReferenceForce::getCrossProduct( deltaR[CP], deltaR[DC], deltaR[T] );
AmoebaReferenceForce::getCrossProduct( deltaR[DC], deltaR[QD], deltaR[U] );
AmoebaReferenceForce::getCrossProduct( deltaR[T], deltaR[U], deltaR[TU] );
RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3( deltaR[T] );
RealOpenMM rU2 = AmoebaReferenceForce::getNormSquared3( deltaR[U] );
RealOpenMM rTrU = SQRT( rT2*rU2 );
if( rTrU <= zero ){
AmoebaReferenceForce::getCrossProduct(deltaR[CP], deltaR[DC], deltaR[T] );
AmoebaReferenceForce::getCrossProduct(deltaR[DC], deltaR[QD], deltaR[U] );
AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[U], deltaR[TU]);
RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3(deltaR[T]);
RealOpenMM rU2 = AmoebaReferenceForce::getNormSquared3(deltaR[U]);
RealOpenMM rTrU = SQRT(rT2*rU2);
if (rTrU <= 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;
RealOpenMM sine = AmoebaReferenceForce::getDotProduct3( deltaR[DC], deltaR[TU] );
sine /= ( rDC*rTrU );
RealOpenMM sine = AmoebaReferenceForce::getDotProduct3(deltaR[DC], deltaR[TU]);
sine /= (rDC*rTrU);
RealOpenMM cosine2 = cosine*cosine - sine*sine;
RealOpenMM sine2 = two*cosine*sine;
......@@ -115,37 +115,37 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
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[QC][ii] = deltaR[Q][ii] - positionAtomC[ii];
}
RealOpenMM factorT = dedphi/( rDC*rT2 );
RealOpenMM factorU = -dedphi/( rDC*rU2 );
RealOpenMM factorT = dedphi/(rDC*rT2);
RealOpenMM factorU = -dedphi/(rDC*rU2);
AmoebaReferenceForce::getCrossProduct( deltaR[T], deltaR[DC], deltaR[dT] );
AmoebaReferenceForce::getCrossProduct( deltaR[U], deltaR[DC], deltaR[dU] );
for( int ii = 0; ii < 3; ii++ ){
AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[DC], deltaR[dT] );
AmoebaReferenceForce::getCrossProduct(deltaR[U], deltaR[DC], deltaR[dU] );
for (int ii = 0; ii < 3; ii++) {
deltaR[dT][ii] *= factorT;
deltaR[dU][ii] *= factorU;
}
AmoebaReferenceForce::getCrossProduct( deltaR[dT], deltaR[DC], deltaR[dP] );
AmoebaReferenceForce::getCrossProduct( deltaR[dU], deltaR[DC], deltaR[dQ] );
AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[DC], deltaR[dP] );
AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[DC], deltaR[dQ] );
AmoebaReferenceForce::getCrossProduct( deltaR[DP], deltaR[dT], deltaR[dC1] );
AmoebaReferenceForce::getCrossProduct( deltaR[dU], deltaR[QD], deltaR[dC2] );
AmoebaReferenceForce::getCrossProduct(deltaR[DP], deltaR[dT], deltaR[dC1] );
AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[QD], deltaR[dC2] );
AmoebaReferenceForce::getCrossProduct( deltaR[dT], deltaR[CP], deltaR[dD1] );
AmoebaReferenceForce::getCrossProduct( deltaR[QC], deltaR[dU], deltaR[dD2] );
AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[CP], deltaR[dD1] );
AmoebaReferenceForce::getCrossProduct(deltaR[QC], deltaR[dU], deltaR[dD2] );
AmoebaReferenceForce::getCrossProduct( deltaR[BD], deltaR[dP], d[A] );
AmoebaReferenceForce::getCrossProduct( deltaR[dP], deltaR[AD], d[B] );
AmoebaReferenceForce::getCrossProduct(deltaR[BD], deltaR[dP], d[A] );
AmoebaReferenceForce::getCrossProduct(deltaR[dP], deltaR[AD], d[B] );
AmoebaReferenceForce::getCrossProduct( deltaR[FC], deltaR[dQ], d[E] );
AmoebaReferenceForce::getCrossProduct( deltaR[dQ], deltaR[EC], d[F] );
AmoebaReferenceForce::getCrossProduct(deltaR[FC], deltaR[dQ], d[E] );
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[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&
}
RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy( int numPiTorsions, vector<RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<int>& particle5,
const std::vector<int>& particle6,
const std::vector<RealOpenMM>& kTorsion,
vector<RealVec>& forceData ) const {
RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy(int numPiTorsions, vector<RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<int>& particle5,
const std::vector<int>& particle6,
const std::vector<RealOpenMM>& kTorsion,
vector<RealVec>& forceData) const {
RealOpenMM energy = 0.0;
for (unsigned int ii = 0; ii < static_cast<unsigned int>(numPiTorsions); ii++) {
......@@ -206,13 +206,13 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy( int numPiTors
int particle6Index = particle6[ii];
RealVec forces[6];
energy += calculatePiTorsionIxn( posData[particle1Index], posData[particle2Index],
posData[particle3Index], posData[particle4Index],
posData[particle5Index], posData[particle6Index],
kTorsion[ii], forces );
energy += calculatePiTorsionIxn(posData[particle1Index], posData[particle2Index],
posData[particle3Index], posData[particle4Index],
posData[particle5Index], posData[particle6Index],
kTorsion[ii], forces);
// accumulate forces
for( int jj = 0; jj < 3; jj++ ){
for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] -= forces[0][jj];
forceData[particle2Index][jj] -= forces[1][jj];
forceData[particle3Index][jj] -= forces[2][jj];
......
......@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferencePiTorsionForce( ){};
AmoebaReferencePiTorsionForce() {};
/**---------------------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~AmoebaReferencePiTorsionForce( ){};
~AmoebaReferencePiTorsionForce() {};
/**---------------------------------------------------------------------------------------
......@@ -72,15 +72,15 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numPiTorsions, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<int>& particle5,
const std::vector<int>& particle6,
const std::vector<RealOpenMM>& kTorsion,
std::vector<OpenMM::RealVec>& forceData ) const;
RealOpenMM calculateForceAndEnergy(int numPiTorsions, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<int>& particle4,
const std::vector<int>& particle5,
const std::vector<int>& particle6,
const std::vector<RealOpenMM>& kTorsion,
std::vector<OpenMM::RealVec>& forceData) const;
private:
......@@ -102,10 +102,10 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM calculatePiTorsionIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
const OpenMM::RealVec& positionAtomE, const OpenMM::RealVec& positionAtomF,
RealOpenMM kTorsion, OpenMM::RealVec* forces ) const;
RealOpenMM calculatePiTorsionIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC, const OpenMM::RealVec& positionAtomD,
const OpenMM::RealVec& positionAtomE, const OpenMM::RealVec& positionAtomF,
RealOpenMM kTorsion, OpenMM::RealVec* forces) const;
};
......
......@@ -49,11 +49,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC,
RealOpenMM lengthAB, RealOpenMM lengthCB,
RealOpenMM idealAngle, RealOpenMM k1Parameter,
RealOpenMM k2Parameter, RealVec* forces ) const {
RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn(const RealVec& positionAtomA, const RealVec& positionAtomB,
const RealVec& positionAtomC,
RealOpenMM lengthAB, RealOpenMM lengthCB,
RealOpenMM idealAngle, RealOpenMM k1Parameter,
RealOpenMM k2Parameter, RealVec* forces) const {
// ---------------------------------------------------------------------------------------
......@@ -73,28 +73,28 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// and various intermediate terms
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);
}
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomA, deltaR[AB] );
AmoebaReferenceForce::loadDeltaR( positionAtomB, positionAtomC, deltaR[CB] );
RealOpenMM rAB2 = AmoebaReferenceForce::getNormSquared3( deltaR[AB] );
RealOpenMM rAB = SQRT( rAB2 );
RealOpenMM rCB2 = AmoebaReferenceForce::getNormSquared3( deltaR[CB] );
RealOpenMM rCB = SQRT( rCB2 );
AmoebaReferenceForce::getCrossProduct( deltaR[CB], deltaR[AB], deltaR[CBxAB] );
RealOpenMM rP = AmoebaReferenceForce::getNorm3( deltaR[CBxAB] );
if( rP <= zero ){
AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomA, deltaR[AB]);
AmoebaReferenceForce::loadDeltaR(positionAtomB, positionAtomC, deltaR[CB]);
RealOpenMM rAB2 = AmoebaReferenceForce::getNormSquared3(deltaR[AB]);
RealOpenMM rAB = SQRT(rAB2);
RealOpenMM rCB2 = AmoebaReferenceForce::getNormSquared3(deltaR[CB]);
RealOpenMM rCB = SQRT(rCB2);
AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[AB], deltaR[CBxAB]);
RealOpenMM rP = AmoebaReferenceForce::getNorm3(deltaR[CBxAB]);
if (rP <= 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 angle;
if( cosine >= one ){
if (cosine >= one) {
angle = zero;
} else if( cosine <= -one ){
} else if (cosine <= -one) {
angle = PI_M;
} else {
angle = RADIAN*ACOS(cosine);
......@@ -105,9 +105,9 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// P = CBxAB
AmoebaReferenceForce::getCrossProduct( deltaR[AB], deltaR[CBxAB], deltaR[ABxP] );
AmoebaReferenceForce::getCrossProduct( deltaR[CB], deltaR[CBxAB], deltaR[CBxP] );
for( int ii = 0; ii < 3; ii++ ){
AmoebaReferenceForce::getCrossProduct(deltaR[AB], deltaR[CBxAB], deltaR[ABxP]);
AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[CBxAB], deltaR[CBxP]);
for (int ii = 0; ii < 3; ii++) {
deltaR[ABxP][ii] *= termA;
deltaR[CBxP][ii] *= termC;
}
......@@ -123,22 +123,22 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// forces
// 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];
for( int ii = 0; ii < LastAtomIndex; ii++ ){
for (int ii = 0; ii < LastAtomIndex; ii++) {
subForce[ii].resize(3);
}
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[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
for( int jj = 0; jj < LastAtomIndex; jj++ ){
for (int jj = 0; jj < LastAtomIndex; jj++) {
forces[jj][0] = subForce[jj][0];
forces[jj][1] = subForce[jj][1];
forces[jj][2] = subForce[jj][2];
......@@ -149,7 +149,7 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
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>& particle2,
const std::vector<int>& particle3,
......@@ -170,11 +170,11 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStre
RealOpenMM angleK1 = k1Quadratic[ii];
RealOpenMM angleK2 = k2Quadratic[ii];
RealVec forces[3];
energy += calculateStretchBendIxn( posData[particle1Index], posData[particle2Index], posData[particle3Index],
abLength, cbLength, idealAngle, angleK1, angleK2, forces );
energy += calculateStretchBendIxn(posData[particle1Index], posData[particle2Index], posData[particle3Index],
abLength, cbLength, idealAngle, angleK1, angleK2, forces);
// accumulate forces
for( int jj = 0; jj < 3; jj++ ){
for (int jj = 0; jj < 3; jj++) {
forceData[particle1Index][jj] -= forces[0][jj];
forceData[particle2Index][jj] -= forces[1][jj];
forceData[particle3Index][jj] -= forces[2][jj];
......
......@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceStretchBendForce( ){};
AmoebaReferenceStretchBendForce() {};
/**---------------------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~AmoebaReferenceStretchBendForce( ){};
~AmoebaReferenceStretchBendForce() {};
/**---------------------------------------------------------------------------------------
......@@ -70,16 +70,16 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateForceAndEnergy( int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<RealOpenMM>& lengthABParameters,
const std::vector<RealOpenMM>& lengthCBParameters,
const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& k1Quadratic,
const std::vector<RealOpenMM>& k2Quadratic,
std::vector<OpenMM::RealVec>& forceData ) const;
RealOpenMM calculateForceAndEnergy(int numAngles, std::vector<OpenMM::RealVec>& posData,
const std::vector<int>& particle1,
const std::vector<int>& particle2,
const std::vector<int>& particle3,
const std::vector<RealOpenMM>& lengthABParameters,
const std::vector<RealOpenMM>& lengthCBParameters,
const std::vector<RealOpenMM>& angle,
const std::vector<RealOpenMM>& k1Quadratic,
const std::vector<RealOpenMM>& k2Quadratic,
std::vector<OpenMM::RealVec>& forceData) const;
private:
......@@ -102,11 +102,11 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM calculateStretchBendIxn( const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC,
RealOpenMM lengthAB, RealOpenMM lengthCB,
RealOpenMM idealAngle, RealOpenMM k1Parameter,
RealOpenMM k2Parameter, OpenMM::RealVec* forces ) const;
RealOpenMM calculateStretchBendIxn(const OpenMM::RealVec& positionAtomA, const OpenMM::RealVec& positionAtomB,
const OpenMM::RealVec& positionAtomC,
RealOpenMM lengthAB, RealOpenMM lengthCB,
RealOpenMM idealAngle, RealOpenMM k1Parameter,
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