"csrc/vscode:/vscode.git/clone" did not exist on "a4b49551a93eb72c7bb19f62f69ff55e253f62b1"
Commit f11bafd9 authored by peastman's avatar peastman
Browse files

Merge pull request #828 from peastman/cleanup

Cleanup to AMOEBA code
parents 162d69a2 d95b90b9
...@@ -54,30 +54,18 @@ const double TOL = 1e-4; ...@@ -54,30 +54,18 @@ const double TOL = 1e-4;
extern "C" void registerAmoebaCudaKernelFactories(); extern "C" void registerAmoebaCudaKernelFactories();
void compareForcesEnergy( std::string& testName, double expectedEnergy, double energy, void compareForcesEnergy(std::string& testName, double expectedEnergy, double energy,
const std::vector<Vec3>& expectedForces, const std::vector<Vec3>& expectedForces,
const std::vector<Vec3>& forces, double tolerance, FILE* log ) { const std::vector<Vec3>& forces, double tolerance) {
for (unsigned int ii = 0; ii < forces.size(); ii++) {
#ifdef AMOEBA_DEBUG ASSERT_EQUAL_VEC_MOD(expectedForces[ii], forces[ii], tolerance, testName);
if( log ){
(void) fprintf( log, "%s: expected energy=%14.7e %14.7e\n", testName.c_str(), expectedEnergy, energy );
for( unsigned int ii = 0; ii < forces.size(); ii++ ){
(void) fprintf( log, "%6u [%14.7e %14.7e %14.7e] [%14.7e %14.7e %14.7e]\n", ii,
expectedForces[ii][0], expectedForces[ii][1], expectedForces[ii][2], forces[ii][0], forces[ii][1], forces[ii][2] );
}
(void) fflush( log );
} }
#endif ASSERT_EQUAL_TOL_MOD(expectedEnergy, energy, tolerance, testName);
for( unsigned int ii = 0; ii < forces.size(); ii++ ){
ASSERT_EQUAL_VEC_MOD( expectedForces[ii], forces[ii], tolerance, testName );
}
ASSERT_EQUAL_TOL_MOD( expectedEnergy, energy, tolerance, testName );
} }
// test Wca dispersion // test Wca dispersion
void testWcaDispersionAmmonia( FILE* log ) { void testWcaDispersionAmmonia() {
std::string testName = "testWcaDispersionAmmonia"; std::string testName = "testWcaDispersionAmmonia";
...@@ -88,48 +76,48 @@ void testWcaDispersionAmmonia( FILE* log ) { ...@@ -88,48 +76,48 @@ void testWcaDispersionAmmonia( FILE* log ) {
System system; System system;
AmoebaWcaDispersionForce* amoebaWcaDispersionForce = new AmoebaWcaDispersionForce();; AmoebaWcaDispersionForce* amoebaWcaDispersionForce = new AmoebaWcaDispersionForce();;
amoebaWcaDispersionForce->setEpso( 4.6024000e-01 ); amoebaWcaDispersionForce->setEpso( 4.6024000e-01);
amoebaWcaDispersionForce->setEpsh( 5.6484000e-02 ); amoebaWcaDispersionForce->setEpsh( 5.6484000e-02);
amoebaWcaDispersionForce->setRmino( 1.7025000e-01 ); amoebaWcaDispersionForce->setRmino( 1.7025000e-01);
amoebaWcaDispersionForce->setRminh( 1.3275000e-01 ); amoebaWcaDispersionForce->setRminh( 1.3275000e-01);
amoebaWcaDispersionForce->setDispoff( 2.6000000e-02 ); amoebaWcaDispersionForce->setDispoff(2.6000000e-02);
amoebaWcaDispersionForce->setAwater( 3.3428000e+01 ); amoebaWcaDispersionForce->setAwater( 3.3428000e+01);
amoebaWcaDispersionForce->setSlevy( 1.0000000e+00 ); amoebaWcaDispersionForce->setSlevy( 1.0000000e+00);
amoebaWcaDispersionForce->setShctd( 8.1000000e-01 ); amoebaWcaDispersionForce->setShctd( 8.1000000e-01);
// addParticle: radius, epsilon // addParticle: radius, epsilon
for( unsigned int ii = 0; ii < 2; ii++ ){ for (unsigned int ii = 0; ii < 2; ii++) {
system.addParticle( 1.4007000e+01 ); system.addParticle( 1.4007000e+01);
amoebaWcaDispersionForce->addParticle( 1.8550000e-01, 4.3932000e-01 ); amoebaWcaDispersionForce->addParticle( 1.8550000e-01, 4.3932000e-01);
system.addParticle( 1.0080000e+00 ); system.addParticle( 1.0080000e+00);
amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02 ); amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02);
system.addParticle( 1.0080000e+00 ); system.addParticle( 1.0080000e+00);
amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02 ); amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02);
system.addParticle( 1.0080000e+00 ); system.addParticle( 1.0080000e+00);
amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02 ); amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02);
} }
std::vector<Vec3> positions(numberOfParticles); std::vector<Vec3> positions(numberOfParticles);
positions[0] = Vec3( 1.5927280e-01, 1.7000000e-06, 1.6491000e-03 ); positions[0] = Vec3( 1.5927280e-01, 1.7000000e-06, 1.6491000e-03);
positions[1] = Vec3( 2.0805540e-01, -8.1258800e-02, 3.7282500e-02 ); positions[1] = Vec3( 2.0805540e-01, -8.1258800e-02, 3.7282500e-02);
positions[2] = Vec3( 2.0843610e-01, 8.0953200e-02, 3.7462200e-02 ); positions[2] = Vec3( 2.0843610e-01, 8.0953200e-02, 3.7462200e-02);
positions[3] = Vec3( 1.7280780e-01, 2.0730000e-04, -9.8741700e-02 ); positions[3] = Vec3( 1.7280780e-01, 2.0730000e-04, -9.8741700e-02);
positions[4] = Vec3( -1.6743680e-01, 1.5900000e-05, -6.6149000e-03 ); positions[4] = Vec3( -1.6743680e-01, 1.5900000e-05, -6.6149000e-03);
positions[5] = Vec3( -2.0428260e-01, 8.1071500e-02, 4.1343900e-02 ); positions[5] = Vec3( -2.0428260e-01, 8.1071500e-02, 4.1343900e-02);
positions[6] = Vec3( -6.7308300e-02, 1.2800000e-05, 1.0623300e-02 ); positions[6] = Vec3( -6.7308300e-02, 1.2800000e-05, 1.0623300e-02);
positions[7] = Vec3( -2.0426290e-01, -8.1231400e-02, 4.1033500e-02 ); positions[7] = Vec3( -2.0426290e-01, -8.1231400e-02, 4.1033500e-02);
system.addForce(amoebaWcaDispersionForce); system.addForce(amoebaWcaDispersionForce);
std::string platformName; std::string platformName;
platformName = "CUDA"; platformName = "CUDA";
LangevinIntegrator integrator(0.0, 0.1, 0.01); LangevinIntegrator integrator(0.0, 0.1, 0.01);
Context context(system, integrator, Platform::getPlatformByName( platformName ) ); Context context(system, integrator, Platform::getPlatformByName(platformName));
context.setPositions(positions); context.setPositions(positions);
State state = context.getState(State::Forces | State::Energy); State state = context.getState(State::Forces | State::Energy);
...@@ -141,17 +129,17 @@ void testWcaDispersionAmmonia( FILE* log ) { ...@@ -141,17 +129,17 @@ void testWcaDispersionAmmonia( FILE* log ) {
std::vector<Vec3> expectedForces(numberOfParticles); std::vector<Vec3> expectedForces(numberOfParticles);
double expectedEnergy = -2.6981209e+01; double expectedEnergy = -2.6981209e+01;
expectedForces[0] = Vec3( 4.7839388e+00, -7.3510133e-04, -5.0382764e-01 ); expectedForces[0] = Vec3( 4.7839388e+00, -7.3510133e-04, -5.0382764e-01);
expectedForces[1] = Vec3( 1.4657758e+00, 1.2431003e+00, -6.7075886e-01 ); expectedForces[1] = Vec3( 1.4657758e+00, 1.2431003e+00, -6.7075886e-01);
expectedForces[2] = Vec3( 1.4563936e+00, -1.2399917e+00, -6.7443841e-01 ); expectedForces[2] = Vec3( 1.4563936e+00, -1.2399917e+00, -6.7443841e-01);
expectedForces[3] = Vec3( 2.1116744e+00, -2.7407512e-03, 1.3271245e+00 ); expectedForces[3] = Vec3( 2.1116744e+00, -2.7407512e-03, 1.3271245e+00);
expectedForces[4] = Vec3( -4.7528440e+00, -1.5148066e-03, 1.2653813e+00 ); expectedForces[4] = Vec3( -4.7528440e+00, -1.5148066e-03, 1.2653813e+00);
expectedForces[5] = Vec3( -1.1875619e+00, -1.2866678e+00, -3.9109060e-01 ); expectedForces[5] = Vec3( -1.1875619e+00, -1.2866678e+00, -3.9109060e-01);
expectedForces[6] = Vec3( -2.6885679e+00, -4.3038639e-04, 3.3763583e-02 ); expectedForces[6] = Vec3( -2.6885679e+00, -4.3038639e-04, 3.3763583e-02);
expectedForces[7] = Vec3( -1.1888087e+00, 1.2889802e+00, -3.8615387e-01 ); expectedForces[7] = Vec3( -1.1888087e+00, 1.2889802e+00, -3.8615387e-01);
double tolerance = 1.0e-04; double tolerance = 1.0e-04;
compareForcesEnergy( testName, expectedEnergy, energy, expectedForces, forces, tolerance, log ); compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance);
// Try changing the particle parameters and make sure it's still correct. // Try changing the particle parameters and make sure it's still correct.
...@@ -168,7 +156,7 @@ void testWcaDispersionAmmonia( FILE* log ) { ...@@ -168,7 +156,7 @@ void testWcaDispersionAmmonia( FILE* log ) {
bool exceptionThrown = false; bool exceptionThrown = false;
try { try {
// This should throw an exception. // This should throw an exception.
compareForcesEnergy(testName, state1.getPotentialEnergy(), state2.getPotentialEnergy(), state1.getForces(), state2.getForces(), tolerance, log); compareForcesEnergy(testName, state1.getPotentialEnergy(), state2.getPotentialEnergy(), state1.getForces(), state2.getForces(), tolerance);
} }
catch (std::exception ex) { catch (std::exception ex) {
exceptionThrown = true; exceptionThrown = true;
...@@ -176,7 +164,7 @@ void testWcaDispersionAmmonia( FILE* log ) { ...@@ -176,7 +164,7 @@ void testWcaDispersionAmmonia( FILE* log ) {
ASSERT(exceptionThrown); ASSERT(exceptionThrown);
amoebaWcaDispersionForce->updateParametersInContext(context); amoebaWcaDispersionForce->updateParametersInContext(context);
state1 = context.getState(State::Forces | State::Energy); state1 = context.getState(State::Forces | State::Energy);
compareForcesEnergy(testName, state1.getPotentialEnergy(), state2.getPotentialEnergy(), state1.getForces(), state2.getForces(), tolerance, log); compareForcesEnergy(testName, state1.getPotentialEnergy(), state2.getPotentialEnergy(), state1.getForces(), state2.getForces(), tolerance);
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
...@@ -185,11 +173,10 @@ int main(int argc, char* argv[]) { ...@@ -185,11 +173,10 @@ int main(int argc, char* argv[]) {
registerAmoebaCudaKernelFactories(); registerAmoebaCudaKernelFactories();
if (argc > 1) if (argc > 1)
Platform::getPlatformByName("CUDA").setPropertyDefaultValue("CudaPrecision", std::string(argv[1])); Platform::getPlatformByName("CUDA").setPropertyDefaultValue("CudaPrecision", std::string(argv[1]));
FILE* log = NULL;
// test Wca dispersion force using two ammonia molecules // test Wca dispersion force using two ammonia molecules
testWcaDispersionAmmonia( log ); testWcaDispersionAmmonia();
} catch(const std::exception& e) { } catch(const std::exception& e) {
......
...@@ -99,7 +99,7 @@ void ReferenceCalcAmoebaBondForceKernel::initialize(const System& system, const ...@@ -99,7 +99,7 @@ void ReferenceCalcAmoebaBondForceKernel::initialize(const System& system, const
particle1.push_back(particle1Index); particle1.push_back(particle1Index);
particle2.push_back(particle2Index); particle2.push_back(particle2Index);
length.push_back( static_cast<RealOpenMM>(lengthValue)); length.push_back(static_cast<RealOpenMM>(lengthValue));
kQuadratic.push_back(static_cast<RealOpenMM>(kValue)); kQuadratic.push_back(static_cast<RealOpenMM>(kValue));
} }
globalBondCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalBondCubic()); globalBondCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalBondCubic());
...@@ -153,7 +153,7 @@ void ReferenceCalcAmoebaAngleForceKernel::initialize(const System& system, const ...@@ -153,7 +153,7 @@ void ReferenceCalcAmoebaAngleForceKernel::initialize(const System& system, const
particle1.push_back(particle1Index); particle1.push_back(particle1Index);
particle2.push_back(particle2Index); particle2.push_back(particle2Index);
particle3.push_back(particle3Index); particle3.push_back(particle3Index);
angle.push_back( static_cast<RealOpenMM>(angleValue)); angle.push_back(static_cast<RealOpenMM>(angleValue));
kQuadratic.push_back(static_cast<RealOpenMM>(k)); kQuadratic.push_back(static_cast<RealOpenMM>(k));
} }
globalAngleCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalAngleCubic()); globalAngleCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalAngleCubic());
...@@ -206,8 +206,8 @@ void ReferenceCalcAmoebaInPlaneAngleForceKernel::initialize(const System& system ...@@ -206,8 +206,8 @@ void ReferenceCalcAmoebaInPlaneAngleForceKernel::initialize(const System& system
particle2.push_back(particle2Index); particle2.push_back(particle2Index);
particle3.push_back(particle3Index); particle3.push_back(particle3Index);
particle4.push_back(particle4Index); particle4.push_back(particle4Index);
angle.push_back( static_cast<RealOpenMM>(angleValue)); angle.push_back(static_cast<RealOpenMM>(angleValue));
kQuadratic.push_back( static_cast<RealOpenMM>(k)); kQuadratic.push_back(static_cast<RealOpenMM>(k));
} }
globalInPlaneAngleCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalInPlaneAngleCubic()); globalInPlaneAngleCubic = static_cast<RealOpenMM>(force.getAmoebaGlobalInPlaneAngleCubic());
globalInPlaneAngleQuartic = static_cast<RealOpenMM>(force.getAmoebaGlobalInPlaneAngleQuartic()); globalInPlaneAngleQuartic = static_cast<RealOpenMM>(force.getAmoebaGlobalInPlaneAngleQuartic());
...@@ -314,9 +314,9 @@ void ReferenceCalcAmoebaStretchBendForceKernel::initialize(const System& system, ...@@ -314,9 +314,9 @@ void ReferenceCalcAmoebaStretchBendForceKernel::initialize(const System& system,
particle3.push_back(particle3Index); particle3.push_back(particle3Index);
lengthABParameters.push_back(static_cast<RealOpenMM>(lengthAB)); lengthABParameters.push_back(static_cast<RealOpenMM>(lengthAB));
lengthCBParameters.push_back(static_cast<RealOpenMM>(lengthCB)); lengthCBParameters.push_back(static_cast<RealOpenMM>(lengthCB));
angleParameters.push_back( static_cast<RealOpenMM>(angle)); angleParameters.push_back(static_cast<RealOpenMM>(angle));
k1Parameters.push_back( static_cast<RealOpenMM>(k1)); k1Parameters.push_back(static_cast<RealOpenMM>(k1));
k2Parameters.push_back( static_cast<RealOpenMM>(k2)); k2Parameters.push_back(static_cast<RealOpenMM>(k2));
} }
} }
...@@ -1043,14 +1043,14 @@ void ReferenceCalcAmoebaWcaDispersionForceKernel::initialize(const System& syste ...@@ -1043,14 +1043,14 @@ void ReferenceCalcAmoebaWcaDispersionForceKernel::initialize(const System& syste
totalMaximumDispersionEnergy = static_cast<RealOpenMM>(AmoebaWcaDispersionForceImpl::getTotalMaximumDispersionEnergy(force)); totalMaximumDispersionEnergy = static_cast<RealOpenMM>(AmoebaWcaDispersionForceImpl::getTotalMaximumDispersionEnergy(force));
epso = static_cast<RealOpenMM>(force.getEpso() ); epso = static_cast<RealOpenMM>(force.getEpso());
epsh = static_cast<RealOpenMM>(force.getEpsh() ); epsh = static_cast<RealOpenMM>(force.getEpsh());
rmino = static_cast<RealOpenMM>(force.getRmino() ); rmino = static_cast<RealOpenMM>(force.getRmino());
rminh = static_cast<RealOpenMM>(force.getRminh() ); rminh = static_cast<RealOpenMM>(force.getRminh());
awater = static_cast<RealOpenMM>(force.getAwater()); awater = static_cast<RealOpenMM>(force.getAwater());
shctd = static_cast<RealOpenMM>(force.getShctd() ); shctd = static_cast<RealOpenMM>(force.getShctd());
dispoff = static_cast<RealOpenMM>(force.getDispoff()); dispoff = static_cast<RealOpenMM>(force.getDispoff());
slevy = static_cast<RealOpenMM>(force.getSlevy() ); slevy = static_cast<RealOpenMM>(force.getSlevy());
} }
double ReferenceCalcAmoebaWcaDispersionForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) { double ReferenceCalcAmoebaWcaDispersionForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
......
...@@ -210,9 +210,9 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn(const RealVec& po ...@@ -210,9 +210,9 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn(const RealVec& po
RealOpenMM delta2 = delta*two; RealOpenMM delta2 = delta*two;
AmoebaReferenceForce::getCrossProduct(deltaR[BD], deltaR[CD], deltaR[BDxCD]); AmoebaReferenceForce::getCrossProduct(deltaR[BD], deltaR[CD], deltaR[BDxCD]);
AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[CD], deltaR[TxCD] ); AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[CD], deltaR[TxCD]);
AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[BD], deltaR[ADxBD]); AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[BD], deltaR[ADxBD]);
AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[T], deltaR[ADxT] ); AmoebaReferenceForce::getCrossProduct(deltaR[AD], deltaR[T], deltaR[ADxT]);
for (int ii = 0; ii < 3; ii++) { for (int ii = 0; ii < 3; ii++) {
RealOpenMM term = deltaR[BDxCD][ii] + delta2*deltaR[TxCD][ii]; RealOpenMM term = deltaR[BDxCD][ii] + delta2*deltaR[TxCD][ii];
......
...@@ -91,7 +91,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn(const ...@@ -91,7 +91,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn(const
std::vector<RealOpenMM> tempVector(3); std::vector<RealOpenMM> tempVector(3);
AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[DB], tempVector); AmoebaReferenceForce::getCrossProduct(deltaR[CB], deltaR[DB], tempVector);
RealOpenMM eE = AmoebaReferenceForce::getDotProduct3(deltaR[AB], tempVector ); RealOpenMM eE = AmoebaReferenceForce::getDotProduct3(deltaR[AB], tempVector);
RealOpenMM dot = AmoebaReferenceForce::getDotProduct3(deltaR[AD], deltaR[CD]); RealOpenMM dot = AmoebaReferenceForce::getDotProduct3(deltaR[AD], deltaR[CD]);
RealOpenMM cc = rAD2*rCD2 - dot*dot; RealOpenMM cc = rAD2*rCD2 - dot*dot;
......
...@@ -88,8 +88,8 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn(const RealVec& p ...@@ -88,8 +88,8 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn(const RealVec& p
deltaR[P][ii] += positionAtomC[ii]; deltaR[P][ii] += positionAtomC[ii];
deltaR[Q][ii] += positionAtomD[ii]; deltaR[Q][ii] += positionAtomD[ii];
} }
AmoebaReferenceForce::getCrossProduct(deltaR[CP], deltaR[DC], deltaR[T] ); AmoebaReferenceForce::getCrossProduct(deltaR[CP], deltaR[DC], deltaR[T]);
AmoebaReferenceForce::getCrossProduct(deltaR[DC], deltaR[QD], deltaR[U] ); AmoebaReferenceForce::getCrossProduct(deltaR[DC], deltaR[QD], deltaR[U]);
AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[U], deltaR[TU]); AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[U], deltaR[TU]);
RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3(deltaR[T]); RealOpenMM rT2 = AmoebaReferenceForce::getNormSquared3(deltaR[T]);
...@@ -123,27 +123,27 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn(const RealVec& p ...@@ -123,27 +123,27 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn(const RealVec& p
RealOpenMM factorT = dedphi/(rDC*rT2); RealOpenMM factorT = dedphi/(rDC*rT2);
RealOpenMM factorU = -dedphi/(rDC*rU2); RealOpenMM factorU = -dedphi/(rDC*rU2);
AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[DC], deltaR[dT] ); AmoebaReferenceForce::getCrossProduct(deltaR[T], deltaR[DC], deltaR[dT]);
AmoebaReferenceForce::getCrossProduct(deltaR[U], deltaR[DC], deltaR[dU] ); AmoebaReferenceForce::getCrossProduct(deltaR[U], deltaR[DC], deltaR[dU]);
for (int ii = 0; ii < 3; ii++) { for (int ii = 0; ii < 3; ii++) {
deltaR[dT][ii] *= factorT; deltaR[dT][ii] *= factorT;
deltaR[dU][ii] *= factorU; deltaR[dU][ii] *= factorU;
} }
AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[DC], deltaR[dP] ); AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[DC], deltaR[dP] );
AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[DC], deltaR[dQ] ); AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[DC], deltaR[dQ] );
AmoebaReferenceForce::getCrossProduct(deltaR[DP], deltaR[dT], deltaR[dC1] ); AmoebaReferenceForce::getCrossProduct(deltaR[DP], deltaR[dT], deltaR[dC1]);
AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[QD], deltaR[dC2] ); AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[QD], deltaR[dC2]);
AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[CP], deltaR[dD1] ); AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[CP], deltaR[dD1]);
AmoebaReferenceForce::getCrossProduct(deltaR[QC], deltaR[dU], deltaR[dD2] ); AmoebaReferenceForce::getCrossProduct(deltaR[QC], deltaR[dU], deltaR[dD2]);
AmoebaReferenceForce::getCrossProduct(deltaR[BD], deltaR[dP], d[A] ); AmoebaReferenceForce::getCrossProduct(deltaR[BD], deltaR[dP], d[A] );
AmoebaReferenceForce::getCrossProduct(deltaR[dP], deltaR[AD], d[B] ); AmoebaReferenceForce::getCrossProduct(deltaR[dP], deltaR[AD], d[B] );
AmoebaReferenceForce::getCrossProduct(deltaR[FC], deltaR[dQ], d[E] ); AmoebaReferenceForce::getCrossProduct(deltaR[FC], deltaR[dQ], d[E] );
AmoebaReferenceForce::getCrossProduct(deltaR[dQ], deltaR[EC], d[F] ); AmoebaReferenceForce::getCrossProduct(deltaR[dQ], deltaR[EC], d[F] );
for (int ii = 0; ii < 3; ii++) { for (int ii = 0; ii < 3; ii++) {
d[C][ii] = deltaR[dC1][ii] + deltaR[dC2][ii] + deltaR[dP][ii] - d[E][ii] - d[F][ii]; d[C][ii] = deltaR[dC1][ii] + deltaR[dC2][ii] + deltaR[dP][ii] - d[E][ii] - d[F][ii];
......
...@@ -478,7 +478,7 @@ RealOpenMM AmoebaReferenceTorsionTorsionForce::calculateTorsionTorsionIxn(const ...@@ -478,7 +478,7 @@ RealOpenMM AmoebaReferenceTorsionTorsionForce::calculateTorsionTorsionIxn(const
AmoebaReferenceForce::getCrossProduct(deltaR[CA], deltaR[dT], d[B]); AmoebaReferenceForce::getCrossProduct(deltaR[CA], deltaR[dT], d[B]);
AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[DC], tmp[0]); AmoebaReferenceForce::getCrossProduct(deltaR[dU], deltaR[DC], tmp[0]);
AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[BA], d[C] ); AmoebaReferenceForce::getCrossProduct(deltaR[dT], deltaR[BA], d[C]);
AmoebaReferenceForce::getCrossProduct(deltaR[DB], deltaR[dU], tmp[1]); AmoebaReferenceForce::getCrossProduct(deltaR[DB], deltaR[dU], tmp[1]);
d[B][0] += tmp[0][0]; d[B][0] += tmp[0][0];
...@@ -507,12 +507,12 @@ RealOpenMM AmoebaReferenceTorsionTorsionForce::calculateTorsionTorsionIxn(const ...@@ -507,12 +507,12 @@ RealOpenMM AmoebaReferenceTorsionTorsionForce::calculateTorsionTorsionIxn(const
// dB2 // dB2
AmoebaReferenceForce::getCrossProduct(deltaR[dU2], deltaR[DC], tmp[0] ); AmoebaReferenceForce::getCrossProduct(deltaR[dU2], deltaR[DC], tmp[0]);
// dC2 // dC2
AmoebaReferenceForce::getCrossProduct(deltaR[DB], deltaR[dU2], tmp[1] ); AmoebaReferenceForce::getCrossProduct(deltaR[DB], deltaR[dU2], tmp[1]);
AmoebaReferenceForce::getCrossProduct(deltaR[dV2], deltaR[ED], tmp[2] ); AmoebaReferenceForce::getCrossProduct(deltaR[dV2], deltaR[ED], tmp[2]);
d[B][0] += tmp[0][0]; d[B][0] += tmp[0][0];
d[B][1] += tmp[0][1]; d[B][1] += tmp[0][1];
...@@ -524,8 +524,8 @@ RealOpenMM AmoebaReferenceTorsionTorsionForce::calculateTorsionTorsionIxn(const ...@@ -524,8 +524,8 @@ RealOpenMM AmoebaReferenceTorsionTorsionForce::calculateTorsionTorsionIxn(const
// dD2 // dD2
AmoebaReferenceForce::getCrossProduct(deltaR[dU2], deltaR[CB], tmp[0] ); AmoebaReferenceForce::getCrossProduct(deltaR[dU2], deltaR[CB], tmp[0]);
AmoebaReferenceForce::getCrossProduct(deltaR[EC], deltaR[dV2], tmp[1] ); AmoebaReferenceForce::getCrossProduct(deltaR[EC], deltaR[dV2], tmp[1]);
d[D][0] += tmp[0][0] + tmp[1][0]; d[D][0] += tmp[0][0] + tmp[1][0];
d[D][1] += tmp[0][1] + tmp[1][1]; d[D][1] += tmp[0][1] + tmp[1][1];
...@@ -533,7 +533,7 @@ RealOpenMM AmoebaReferenceTorsionTorsionForce::calculateTorsionTorsionIxn(const ...@@ -533,7 +533,7 @@ RealOpenMM AmoebaReferenceTorsionTorsionForce::calculateTorsionTorsionIxn(const
// dE // dE
AmoebaReferenceForce::getCrossProduct(deltaR[dV2], deltaR[DC], d[E] ); AmoebaReferenceForce::getCrossProduct(deltaR[dV2], deltaR[DC], d[E]);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -252,8 +252,8 @@ private: ...@@ -252,8 +252,8 @@ private:
CombiningFunction _combineEpsilons; CombiningFunction _combineEpsilons;
RealOpenMM arithmeticEpsilonCombiningRule(RealOpenMM epsilonI, RealOpenMM epsilonJ) const; RealOpenMM arithmeticEpsilonCombiningRule(RealOpenMM epsilonI, RealOpenMM epsilonJ) const;
RealOpenMM geometricEpsilonCombiningRule(RealOpenMM epsilonI, RealOpenMM epsilonJ) const; RealOpenMM geometricEpsilonCombiningRule(RealOpenMM epsilonI, RealOpenMM epsilonJ) const;
RealOpenMM harmonicEpsilonCombiningRule( RealOpenMM epsilonI, RealOpenMM epsilonJ) const; RealOpenMM harmonicEpsilonCombiningRule(RealOpenMM epsilonI, RealOpenMM epsilonJ) const;
RealOpenMM hhgEpsilonCombiningRule( RealOpenMM epsilonI, RealOpenMM epsilonJ) const; RealOpenMM hhgEpsilonCombiningRule( RealOpenMM epsilonI, RealOpenMM epsilonJ) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
......
...@@ -101,7 +101,7 @@ static void getPrefactorsGivenAngleCosine(double cosine, double idealAngle, doub ...@@ -101,7 +101,7 @@ static void getPrefactorsGivenAngleCosine(double cosine, double idealAngle, doub
3.0*cubicK* deltaIdeal + 3.0*cubicK* deltaIdeal +
4.0*quarticK*deltaIdeal2 + 4.0*quarticK*deltaIdeal2 +
5.0*penticK* deltaIdeal3 + 5.0*penticK* deltaIdeal3 +
6.0*sexticK* deltaIdeal4 ); 6.0*sexticK* deltaIdeal4 );
*dEdR *= RADIAN*quadraticK*deltaIdeal; *dEdR *= RADIAN*quadraticK*deltaIdeal;
......
...@@ -90,7 +90,7 @@ static void setupMultipoleAmmonia(System& system, AmoebaGeneralizedKirkwoodForce ...@@ -90,7 +90,7 @@ static void setupMultipoleAmmonia(System& system, AmoebaGeneralizedKirkwoodForce
// first N // first N
   
system.addParticle(1.4007000e+01); system.addParticle(1.4007000e+01);
amoebaMultipoleForce->addMultipole( -5.7960000e-01, nitrogenMolecularDipole, nitrogenMolecularQuadrupole, 2, 1, 2, 3, 3.9000000e-01, 3.1996314e-01, 1.0730000e-03); amoebaMultipoleForce->addMultipole(-5.7960000e-01, nitrogenMolecularDipole, nitrogenMolecularQuadrupole, 2, 1, 2, 3, 3.9000000e-01, 3.1996314e-01, 1.0730000e-03);
   
// 3 H attached to first N // 3 H attached to first N
   
...@@ -113,23 +113,23 @@ static void setupMultipoleAmmonia(System& system, AmoebaGeneralizedKirkwoodForce ...@@ -113,23 +113,23 @@ static void setupMultipoleAmmonia(System& system, AmoebaGeneralizedKirkwoodForce
system.addParticle(1.0080000e+00); system.addParticle(1.0080000e+00);
system.addParticle(1.0080000e+00); system.addParticle(1.0080000e+00);
system.addParticle(1.0080000e+00); system.addParticle(1.0080000e+00);
amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 0, 2, 3, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04); amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 0, 2, 3, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04);
amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 0, 1, 3, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04); amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 0, 1, 3, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04);
amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 0, 1, 2, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04); amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 0, 1, 2, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04);
   
// second N // second N
   
system.addParticle( 1.4007000e+01); system.addParticle( 1.4007000e+01);
amoebaMultipoleForce->addMultipole( -5.7960000e-01, nitrogenMolecularDipole, nitrogenMolecularQuadrupole, 2, 5, 6, 7, 3.9000000e-01, 3.1996314e-01, 1.0730000e-03); amoebaMultipoleForce->addMultipole(-5.7960000e-01, nitrogenMolecularDipole, nitrogenMolecularQuadrupole, 2, 5, 6, 7, 3.9000000e-01, 3.1996314e-01, 1.0730000e-03);
   
// 3 H attached to second N // 3 H attached to second N
   
system.addParticle( 1.0080000e+00); system.addParticle( 1.0080000e+00);
system.addParticle( 1.0080000e+00); system.addParticle( 1.0080000e+00);
system.addParticle( 1.0080000e+00); system.addParticle( 1.0080000e+00);
amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 4, 6, 7, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04); amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 4, 6, 7, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04);
amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 4, 5, 7, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04); amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 4, 5, 7, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04);
amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 4, 5, 6, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04); amoebaMultipoleForce->addMultipole( 1.9320000e-01, hydrogenMolecularDipole, hydrogenMolecularQuadrupole, 2, 4, 5, 6, 3.9000000e-01, 2.8135002e-01, 4.9600000e-04);
   
// covalent maps // covalent maps
   
...@@ -260,17 +260,17 @@ static void setupMultipoleAmmonia(System& system, AmoebaGeneralizedKirkwoodForce ...@@ -260,17 +260,17 @@ static void setupMultipoleAmmonia(System& system, AmoebaGeneralizedKirkwoodForce
   
// GK force // GK force
   
amoebaGeneralizedKirkwoodForce->setSolventDielectric( 7.8300000e+01); amoebaGeneralizedKirkwoodForce->setSolventDielectric( 7.8300000e+01);
amoebaGeneralizedKirkwoodForce->setSoluteDielectric( 1.0000000e+00); amoebaGeneralizedKirkwoodForce->setSoluteDielectric( 1.0000000e+00);
amoebaGeneralizedKirkwoodForce->setIncludeCavityTerm(includeCavityTerm); amoebaGeneralizedKirkwoodForce->setIncludeCavityTerm(includeCavityTerm);
   
// addParticle: charge, radius, scalingFactor // addParticle: charge, radius, scalingFactor
   
for (unsigned int ii = 0; ii < 2; ii++) { for (unsigned int ii = 0; ii < 2; ii++) {
amoebaGeneralizedKirkwoodForce->addParticle( -5.7960000e-01, 1.5965000e-01, 6.9000000e-01); amoebaGeneralizedKirkwoodForce->addParticle(-5.7960000e-01, 1.5965000e-01, 6.9000000e-01);
amoebaGeneralizedKirkwoodForce->addParticle( 1.9320000e-01, 1.2360000e-01, 6.9000000e-01); amoebaGeneralizedKirkwoodForce->addParticle( 1.9320000e-01, 1.2360000e-01, 6.9000000e-01);
amoebaGeneralizedKirkwoodForce->addParticle( 1.9320000e-01, 1.2360000e-01, 6.9000000e-01); amoebaGeneralizedKirkwoodForce->addParticle( 1.9320000e-01, 1.2360000e-01, 6.9000000e-01);
amoebaGeneralizedKirkwoodForce->addParticle( 1.9320000e-01, 1.2360000e-01, 6.9000000e-01); amoebaGeneralizedKirkwoodForce->addParticle( 1.9320000e-01, 1.2360000e-01, 6.9000000e-01);
} }
system.addForce(amoebaGeneralizedKirkwoodForce); system.addForce(amoebaGeneralizedKirkwoodForce);
} }
...@@ -278,14 +278,14 @@ static void setupMultipoleAmmonia(System& system, AmoebaGeneralizedKirkwoodForce ...@@ -278,14 +278,14 @@ static void setupMultipoleAmmonia(System& system, AmoebaGeneralizedKirkwoodForce
static void getForcesEnergyMultipoleAmmonia(Context& context, std::vector<Vec3>& forces, double& energy) { static void getForcesEnergyMultipoleAmmonia(Context& context, std::vector<Vec3>& forces, double& energy) {
std::vector<Vec3> positions(context.getSystem().getNumParticles()); std::vector<Vec3> positions(context.getSystem().getNumParticles());
   
positions[0] = Vec3( 1.5927280e-01, 1.7000000e-06, 1.6491000e-03); positions[0] = Vec3( 1.5927280e-01, 1.7000000e-06, 1.6491000e-03);
positions[1] = Vec3( 2.0805540e-01, -8.1258800e-02, 3.7282500e-02); positions[1] = Vec3( 2.0805540e-01, -8.1258800e-02, 3.7282500e-02);
positions[2] = Vec3( 2.0843610e-01, 8.0953200e-02, 3.7462200e-02); positions[2] = Vec3( 2.0843610e-01, 8.0953200e-02, 3.7462200e-02);
positions[3] = Vec3( 1.7280780e-01, 2.0730000e-04, -9.8741700e-02); positions[3] = Vec3( 1.7280780e-01, 2.0730000e-04, -9.8741700e-02);
positions[4] = Vec3( -1.6743680e-01, 1.5900000e-05, -6.6149000e-03); positions[4] = Vec3(-1.6743680e-01, 1.5900000e-05, -6.6149000e-03);
positions[5] = Vec3( -2.0428260e-01, 8.1071500e-02, 4.1343900e-02); positions[5] = Vec3(-2.0428260e-01, 8.1071500e-02, 4.1343900e-02);
positions[6] = Vec3( -6.7308300e-02, 1.2800000e-05, 1.0623300e-02); positions[6] = Vec3(-6.7308300e-02, 1.2800000e-05, 1.0623300e-02);
positions[7] = Vec3( -2.0426290e-01, -8.1231400e-02, 4.1033500e-02); positions[7] = Vec3(-2.0426290e-01, -8.1231400e-02, 4.1033500e-02);
   
context.setPositions(positions); context.setPositions(positions);
State state = context.getState(State::Forces | State::Energy); State state = context.getState(State::Forces | State::Energy);
...@@ -5744,8 +5744,8 @@ static void setupAndGetForcesEnergyMultipoleVillin(AmoebaMultipoleForce::Polariz ...@@ -5744,8 +5744,8 @@ static void setupAndGetForcesEnergyMultipoleVillin(AmoebaMultipoleForce::Polariz
// GK force // GK force
   
AmoebaGeneralizedKirkwoodForce* amoebaGeneralizedKirkwoodForce = new AmoebaGeneralizedKirkwoodForce(); AmoebaGeneralizedKirkwoodForce* amoebaGeneralizedKirkwoodForce = new AmoebaGeneralizedKirkwoodForce();
amoebaGeneralizedKirkwoodForce->setSolventDielectric( 7.8300000e+01); amoebaGeneralizedKirkwoodForce->setSolventDielectric(7.8300000e+01);
amoebaGeneralizedKirkwoodForce->setSoluteDielectric( 1.0000000e+00); amoebaGeneralizedKirkwoodForce->setSoluteDielectric( 1.0000000e+00);
amoebaGeneralizedKirkwoodForce->setIncludeCavityTerm(includeCavityTerm); amoebaGeneralizedKirkwoodForce->setIncludeCavityTerm(includeCavityTerm);
   
// addParticle: charge, radius, scalingFactor // addParticle: charge, radius, scalingFactor
...@@ -7039,14 +7039,14 @@ static void testGeneralizedKirkwoodAmmoniaDirectPolarization() { ...@@ -7039,14 +7039,14 @@ static void testGeneralizedKirkwoodAmmoniaDirectPolarization() {
   
double expectedEnergy = -7.6636680e+01; double expectedEnergy = -7.6636680e+01;
   
expectedForces[0] = Vec3( -6.9252994e+02, -8.9085133e+00, 9.6489739e+01); expectedForces[0] = Vec3(-6.9252994e+02, -8.9085133e+00, 9.6489739e+01);
expectedForces[1] = Vec3( 1.5593797e+02, -6.0331931e+01, 1.5104507e+01); expectedForces[1] = Vec3( 1.5593797e+02, -6.0331931e+01, 1.5104507e+01);
expectedForces[2] = Vec3( 1.5870088e+02, 6.1702809e+01, 6.7708985e+00); expectedForces[2] = Vec3( 1.5870088e+02, 6.1702809e+01, 6.7708985e+00);
expectedForces[3] = Vec3( 1.4089885e+02, 7.5870617e+00, -1.1362294e+02); expectedForces[3] = Vec3( 1.4089885e+02, 7.5870617e+00, -1.1362294e+02);
expectedForces[4] = Vec3( -1.8916205e+02, 2.1465549e-01, -4.3433152e+02); expectedForces[4] = Vec3(-1.8916205e+02, 2.1465549e-01, -4.3433152e+02);
expectedForces[5] = Vec3( 1.0208290e+01, 6.2676753e+01, 1.4987953e+02); expectedForces[5] = Vec3( 1.0208290e+01, 6.2676753e+01, 1.4987953e+02);
expectedForces[6] = Vec3( 4.0621859e+02, 1.8962203e-01, 1.3021956e+02); expectedForces[6] = Vec3( 4.0621859e+02, 1.8962203e-01, 1.3021956e+02);
expectedForces[7] = Vec3( 9.7274235e+00, -6.3130458e+01, 1.4949024e+02); expectedForces[7] = Vec3( 9.7274235e+00, -6.3130458e+01, 1.4949024e+02);
   
double tolerance = 1.0e-04; double tolerance = 1.0e-04;
compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance); compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance);
...@@ -7072,14 +7072,14 @@ static void testGeneralizedKirkwoodAmmoniaMutualPolarization() { ...@@ -7072,14 +7072,14 @@ static void testGeneralizedKirkwoodAmmoniaMutualPolarization() {
   
double expectedEnergy = -7.8018875e+01; double expectedEnergy = -7.8018875e+01;
   
expectedForces[0] = Vec3( -7.6820301e+02, -1.0102760e+01, 1.0094389e+02); expectedForces[0] = Vec3(-7.6820301e+02, -1.0102760e+01, 1.0094389e+02);
expectedForces[1] = Vec3( 1.7037307e+02, -7.5621857e+01, 2.3320365e+01); expectedForces[1] = Vec3( 1.7037307e+02, -7.5621857e+01, 2.3320365e+01);
expectedForces[2] = Vec3( 1.7353828e+02, 7.7199741e+01, 1.3965379e+01); expectedForces[2] = Vec3( 1.7353828e+02, 7.7199741e+01, 1.3965379e+01);
expectedForces[3] = Vec3( 1.5045244e+02, 8.5784569e+00, -1.3377619e+02); expectedForces[3] = Vec3( 1.5045244e+02, 8.5784569e+00, -1.3377619e+02);
expectedForces[4] = Vec3( -2.1811615e+02, -1.6818022e-01, -4.6103163e+02); expectedForces[4] = Vec3(-2.1811615e+02, -1.6818022e-01, -4.6103163e+02);
expectedForces[5] = Vec3( 6.2091942e+00, 7.6748687e+01, 1.5883463e+02); expectedForces[5] = Vec3( 6.2091942e+00, 7.6748687e+01, 1.5883463e+02);
expectedForces[6] = Vec3( 4.8035662e+02, 4.9704902e-01, 1.3948083e+02); expectedForces[6] = Vec3( 4.8035662e+02, 4.9704902e-01, 1.3948083e+02);
expectedForces[7] = Vec3( 5.3895456e+00, -7.7131137e+01, 1.5826273e+02); expectedForces[7] = Vec3( 5.3895456e+00, -7.7131137e+01, 1.5826273e+02);
   
double tolerance = 1.0e-04; double tolerance = 1.0e-04;
compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance); compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance);
...@@ -7108,14 +7108,14 @@ static void testGeneralizedKirkwoodAmmoniaMutualPolarizationWithCavityTerm() { ...@@ -7108,14 +7108,14 @@ static void testGeneralizedKirkwoodAmmoniaMutualPolarizationWithCavityTerm() {
   
double expectedEnergy = -6.0434582e+01; double expectedEnergy = -6.0434582e+01;
   
expectedForces[0] = Vec3( -7.8323218e+02, -1.0097644e+01, 1.0256890e+02); expectedForces[0] = Vec3(-7.8323218e+02, -1.0097644e+01, 1.0256890e+02);
expectedForces[1] = Vec3( 1.7078480e+02, -7.1896701e+01, 2.0840172e+01); expectedForces[1] = Vec3( 1.7078480e+02, -7.1896701e+01, 2.0840172e+01);
expectedForces[2] = Vec3( 1.7394089e+02, 7.3488594e+01, 1.1484648e+01); expectedForces[2] = Vec3( 1.7394089e+02, 7.3488594e+01, 1.1484648e+01);
expectedForces[3] = Vec3( 1.5169364e+02, 8.5611299e+00, -1.2968050e+02); expectedForces[3] = Vec3( 1.5169364e+02, 8.5611299e+00, -1.2968050e+02);
expectedForces[4] = Vec3( -2.1669693e+02, -1.5926823e-01, -4.6636274e+02); expectedForces[4] = Vec3(-2.1669693e+02, -1.5926823e-01, -4.6636274e+02);
expectedForces[5] = Vec3( 8.7397444e+00, 7.3330990e+01, 1.6016898e+02); expectedForces[5] = Vec3( 8.7397444e+00, 7.3330990e+01, 1.6016898e+02);
expectedForces[6] = Vec3( 4.8684950e+02, 4.8937161e-01, 1.4137061e+02); expectedForces[6] = Vec3( 4.8684950e+02, 4.8937161e-01, 1.4137061e+02);
expectedForces[7] = Vec3( 7.9205382e+00, -7.3716473e+01, 1.5960993e+02); expectedForces[7] = Vec3( 7.9205382e+00, -7.3716473e+01, 1.5960993e+02);
   
double tolerance = 1.0e-04; double tolerance = 1.0e-04;
compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance); compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance);
......
...@@ -99,18 +99,18 @@ static void getPrefactorsGivenInPlaneAngleCosine(double cosine, double idealInPl ...@@ -99,18 +99,18 @@ static void getPrefactorsGivenInPlaneAngleCosine(double cosine, double idealInPl
// deltaIdeal = r - r_0 // deltaIdeal = r - r_0
*dEdR = (2.0 + *dEdR = (2.0 +
3.0*cubicK* deltaIdeal + 3.0*cubicK* deltaIdeal +
4.0*quarticK*deltaIdeal2 + 4.0*quarticK*deltaIdeal2 +
5.0*penticK* deltaIdeal3 + 5.0*penticK* deltaIdeal3 +
6.0*sexticK* deltaIdeal4 ); 6.0*sexticK* deltaIdeal4 );
*dEdR *= RADIAN*quadraticK*deltaIdeal; *dEdR *= RADIAN*quadraticK*deltaIdeal;
*energyTerm = 1.0f + cubicK* deltaIdeal + *energyTerm = 1.0f + cubicK* deltaIdeal +
quarticK*deltaIdeal2 + quarticK*deltaIdeal2 +
penticK* deltaIdeal3 + penticK* deltaIdeal3 +
sexticK* deltaIdeal4; sexticK* deltaIdeal4;
*energyTerm *= quadraticK*deltaIdeal2; *energyTerm *= quadraticK*deltaIdeal2;
...@@ -215,9 +215,9 @@ static void computeAmoebaInPlaneAngleForce(int bondIndex, std::vector<Vec3>& po ...@@ -215,9 +215,9 @@ static void computeAmoebaInPlaneAngleForce(int bondIndex, std::vector<Vec3>& po
double delta2 = delta*2.0; double delta2 = delta*2.0;
crossProductVector3(deltaR[BD], deltaR[CD], deltaR[BDxCD]); crossProductVector3(deltaR[BD], deltaR[CD], deltaR[BDxCD]);
crossProductVector3(deltaR[T], deltaR[CD], deltaR[TxCD] ); crossProductVector3(deltaR[T], deltaR[CD], deltaR[TxCD]);
crossProductVector3(deltaR[AD], deltaR[BD], deltaR[ADxBD]); crossProductVector3(deltaR[AD], deltaR[BD], deltaR[ADxBD]);
crossProductVector3(deltaR[AD], deltaR[T], deltaR[ADxT] ); crossProductVector3(deltaR[AD], deltaR[T], deltaR[ADxT]);
for (int ii = 0; ii < 3; ii++) { for (int ii = 0; ii < 3; ii++) {
double term = deltaR[BDxCD][ii] + delta2*deltaR[TxCD][ii]; double term = deltaR[BDxCD][ii] + delta2*deltaR[TxCD][ii];
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -114,7 +114,7 @@ static void computeAmoebaOutOfPlaneBendForce(int bondIndex, std::vector<Vec3>& ...@@ -114,7 +114,7 @@ static void computeAmoebaOutOfPlaneBendForce(int bondIndex, std::vector<Vec3>&
double tempVector[3]; double tempVector[3];
crossProductVector3(deltaR[CB], deltaR[DB], tempVector); crossProductVector3(deltaR[CB], deltaR[DB], tempVector);
double eE = dotVector3(deltaR[AB], tempVector ); double eE = dotVector3(deltaR[AB], tempVector);
double dot = dotVector3(deltaR[AD], deltaR[CD]); double dot = dotVector3(deltaR[AD], deltaR[CD]);
double cc = rAD2*rCD2 - dot*dot; double cc = rAD2*rCD2 - dot*dot;
...@@ -277,10 +277,10 @@ void testOneOutOfPlaneBend() { ...@@ -277,10 +277,10 @@ void testOneOutOfPlaneBend() {
AmoebaOutOfPlaneBendForce* amoebaOutOfPlaneBendForce = new AmoebaOutOfPlaneBendForce(); AmoebaOutOfPlaneBendForce* amoebaOutOfPlaneBendForce = new AmoebaOutOfPlaneBendForce();
amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendCubic( -0.1400000E-01); amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendCubic( -0.1400000E-01);
amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendQuartic( 0.5600000E-04); amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendQuartic(0.5600000E-04);
amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendPentic( -0.7000000E-06); amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendPentic(-0.7000000E-06);
amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendSextic( 0.2200000E-07); amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendSextic( 0.2200000E-07);
double kOutOfPlaneBend = 0.328682196E-01; double kOutOfPlaneBend = 0.328682196E-01;
amoebaOutOfPlaneBendForce->addOutOfPlaneBend(0, 1, 2, 3, kOutOfPlaneBend); amoebaOutOfPlaneBendForce->addOutOfPlaneBend(0, 1, 2, 3, kOutOfPlaneBend);
...@@ -329,10 +329,10 @@ void testOneOutOfPlaneBend2(int setId) { ...@@ -329,10 +329,10 @@ void testOneOutOfPlaneBend2(int setId) {
AmoebaOutOfPlaneBendForce* amoebaOutOfPlaneBendForce = new AmoebaOutOfPlaneBendForce(); AmoebaOutOfPlaneBendForce* amoebaOutOfPlaneBendForce = new AmoebaOutOfPlaneBendForce();
amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendCubic( -0.1400000E-01); amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendCubic( -0.1400000E-01);
amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendQuartic( 0.5600000E-04); amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendQuartic(0.5600000E-04);
amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendPentic( -0.7000000E-06); amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendPentic(-0.7000000E-06);
amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendSextic( 0.2200000E-07); amoebaOutOfPlaneBendForce->setAmoebaGlobalOutOfPlaneBendSextic( 0.2200000E-07);
/* /*
285 441 442 443 444 0.328682196E-01 285 441 442 443 444 0.328682196E-01
286 441 442 444 443 0.164493407E-01 286 441 442 444 443 0.164493407E-01
...@@ -352,15 +352,15 @@ void testOneOutOfPlaneBend2(int setId) { ...@@ -352,15 +352,15 @@ void testOneOutOfPlaneBend2(int setId) {
*/ */
std::map<int,Vec3> coordinates; std::map<int,Vec3> coordinates;
coordinates[440] = Vec3( 0.893800000E+01, 0.439800000E+01, 0.343100000E+01); coordinates[440] = Vec3(0.893800000E+01, 0.439800000E+01, 0.343100000E+01);
coordinates[441] = Vec3( 0.779100000E+01, 0.614600000E+01, 0.390100000E+01); coordinates[441] = Vec3(0.779100000E+01, 0.614600000E+01, 0.390100000E+01);
coordinates[442] = Vec3( 0.915400000E+01, 0.683900000E+01, 0.389400000E+01); coordinates[442] = Vec3(0.915400000E+01, 0.683900000E+01, 0.389400000E+01);
coordinates[443] = Vec3( 0.101770000E+02, 0.619000000E+01, 0.379900000E+01); coordinates[443] = Vec3(0.101770000E+02, 0.619000000E+01, 0.379900000E+01);
coordinates[444] = Vec3( 0.921000000E+01, 0.813800000E+01, 0.398600000E+01); coordinates[444] = Vec3(0.921000000E+01, 0.813800000E+01, 0.398600000E+01);
coordinates[445] = Vec3( 0.708500000E+01, 0.672900000E+01, 0.332700000E+01); coordinates[445] = Vec3(0.708500000E+01, 0.672900000E+01, 0.332700000E+01);
coordinates[446] = Vec3( 0.744300000E+01, 0.605200000E+01, 0.491900000E+01); coordinates[446] = Vec3(0.744300000E+01, 0.605200000E+01, 0.491900000E+01);
coordinates[447] = Vec3( 0.100820000E+02, 0.859300000E+01, 0.398200000E+01); coordinates[447] = Vec3(0.100820000E+02, 0.859300000E+01, 0.398200000E+01);
coordinates[448] = Vec3( 0.838000000E+01, 0.866100000E+01, 0.406000000E+01); coordinates[448] = Vec3(0.838000000E+01, 0.866100000E+01, 0.406000000E+01);
double kOutOfPlaneBend = 0.328682196E-01; double kOutOfPlaneBend = 0.328682196E-01;
std::vector<int> particleIndices; std::vector<int> particleIndices;
...@@ -435,15 +435,15 @@ void testOneOutOfPlaneBend2(int setId) { ...@@ -435,15 +435,15 @@ void testOneOutOfPlaneBend2(int setId) {
static double totalEnergy; static double totalEnergy;
if (iter == 0) { if (iter == 0) {
totalForces[441] = Vec3( 0.0, 0.0, 0.0); totalForces[441] = Vec3(0.0, 0.0, 0.0);
totalForces[442] = Vec3( 0.0, 0.0, 0.0); totalForces[442] = Vec3(0.0, 0.0, 0.0);
totalForces[443] = Vec3( 0.0, 0.0, 0.0); totalForces[443] = Vec3(0.0, 0.0, 0.0);
totalForces[444] = Vec3( 0.0, 0.0, 0.0); totalForces[444] = Vec3(0.0, 0.0, 0.0);
totalForces[445] = Vec3( 0.0, 0.0, 0.0); totalForces[445] = Vec3(0.0, 0.0, 0.0);
totalForces[446] = Vec3( 0.0, 0.0, 0.0); totalForces[446] = Vec3(0.0, 0.0, 0.0);
totalForces[447] = Vec3( 0.0, 0.0, 0.0); totalForces[447] = Vec3(0.0, 0.0, 0.0);
totalForces[448] = Vec3( 0.0, 0.0, 0.0); totalForces[448] = Vec3(0.0, 0.0, 0.0);
totalForces[449] = Vec3( 0.0, 0.0, 0.0); totalForces[449] = Vec3(0.0, 0.0, 0.0);
totalEnergy = 0.0; totalEnergy = 0.0;
} }
iter++; iter++;
......
...@@ -108,8 +108,8 @@ static void computeAmoebaPiTorsionForce(int bondIndex, std::vector<Vec3>& posit ...@@ -108,8 +108,8 @@ static void computeAmoebaPiTorsionForce(int bondIndex, std::vector<Vec3>& posit
deltaR[P][ii] += positions[particle3][ii]; deltaR[P][ii] += positions[particle3][ii];
deltaR[Q][ii] += positions[particle4][ii]; deltaR[Q][ii] += positions[particle4][ii];
} }
crossProductVector3(deltaR[CP], deltaR[DC], deltaR[T] ); crossProductVector3(deltaR[CP], deltaR[DC], deltaR[T]);
crossProductVector3(deltaR[DC], deltaR[QD], deltaR[U] ); crossProductVector3(deltaR[DC], deltaR[QD], deltaR[U]);
crossProductVector3(deltaR[T], deltaR[U], deltaR[TU]); crossProductVector3(deltaR[T], deltaR[U], deltaR[TU]);
double rT2 = dotVector3(deltaR[T], deltaR[T]); double rT2 = dotVector3(deltaR[T], deltaR[T]);
...@@ -144,27 +144,27 @@ static void computeAmoebaPiTorsionForce(int bondIndex, std::vector<Vec3>& posit ...@@ -144,27 +144,27 @@ static void computeAmoebaPiTorsionForce(int bondIndex, std::vector<Vec3>& posit
double factorT = dedphi/(rDC*rT2); double factorT = dedphi/(rDC*rT2);
double factorU = -dedphi/(rDC*rU2); double factorU = -dedphi/(rDC*rU2);
crossProductVector3(deltaR[T], deltaR[DC], deltaR[dT] ); crossProductVector3(deltaR[T], deltaR[DC], deltaR[dT]);
crossProductVector3(deltaR[U], deltaR[DC], deltaR[dU] ); crossProductVector3(deltaR[U], deltaR[DC], deltaR[dU]);
for (int ii = 0; ii < 3; ii++) { for (int ii = 0; ii < 3; ii++) {
deltaR[dT][ii] *= factorT; deltaR[dT][ii] *= factorT;
deltaR[dU][ii] *= factorU; deltaR[dU][ii] *= factorU;
} }
crossProductVector3(deltaR[dT], deltaR[DC], deltaR[dP] ); crossProductVector3(deltaR[dT], deltaR[DC], deltaR[dP] );
crossProductVector3(deltaR[dU], deltaR[DC], deltaR[dQ] ); crossProductVector3(deltaR[dU], deltaR[DC], deltaR[dQ] );
crossProductVector3(deltaR[DP], deltaR[dT], deltaR[dC1] ); crossProductVector3(deltaR[DP], deltaR[dT], deltaR[dC1]);
crossProductVector3(deltaR[dU], deltaR[QD], deltaR[dC2] ); crossProductVector3(deltaR[dU], deltaR[QD], deltaR[dC2]);
crossProductVector3(deltaR[dT], deltaR[CP], deltaR[dD1] ); crossProductVector3(deltaR[dT], deltaR[CP], deltaR[dD1]);
crossProductVector3(deltaR[QC], deltaR[dU], deltaR[dD2] ); crossProductVector3(deltaR[QC], deltaR[dU], deltaR[dD2]);
crossProductVector3(deltaR[BD], deltaR[dP], d[A] ); crossProductVector3(deltaR[BD], deltaR[dP], d[A] );
crossProductVector3(deltaR[dP], deltaR[AD], d[B] ); crossProductVector3(deltaR[dP], deltaR[AD], d[B] );
crossProductVector3(deltaR[FC], deltaR[dQ], d[E] ); crossProductVector3(deltaR[FC], deltaR[dQ], d[E] );
crossProductVector3(deltaR[dQ], deltaR[EC], d[F] ); crossProductVector3(deltaR[dQ], deltaR[EC], d[F] );
for (int ii = 0; ii < 3; ii++) { for (int ii = 0; ii < 3; ii++) {
d[C][ii] = deltaR[dC1][ii] + deltaR[dC2][ii] + deltaR[dP][ii] - d[E][ii] - d[F][ii]; d[C][ii] = deltaR[dC1][ii] + deltaR[dC2][ii] + deltaR[dP][ii] - d[E][ii] - d[F][ii];
......
...@@ -2611,12 +2611,12 @@ void testTorsionTorsion(int systemId, bool includeDerivs) { ...@@ -2611,12 +2611,12 @@ void testTorsionTorsion(int systemId, bool includeDerivs) {
positions[4] = Vec3(-0.760612300E+01, -0.992590200E+01, -0.275088400E+01); positions[4] = Vec3(-0.760612300E+01, -0.992590200E+01, -0.275088400E+01);
positions[5] = Vec3(-0.516893900E+01, -0.788347000E+01, -0.316943000E+01); positions[5] = Vec3(-0.516893900E+01, -0.788347000E+01, -0.316943000E+01);
expectedForces[0] = Vec3( 0.906091624E+00, -0.529814945E-01, 0.690384140E+00); expectedForces[0] = Vec3(0.906091624E+00, -0.529814945E-01, 0.690384140E+00);
expectedForces[1] = Vec3(-0.124550232E+01, -0.999341692E+00, -0.590867130E+00); expectedForces[1] = Vec3(-0.124550232E+01, -0.999341692E+00, -0.590867130E+00);
expectedForces[2] = Vec3( 0.534419689E+00, 0.612404926E-01, 0.547380310E-01); expectedForces[2] = Vec3(0.534419689E+00, 0.612404926E-01, 0.547380310E-01);
expectedForces[3] = Vec3(-5.732010432E-01, 2.645718463E+00, -1.585204274E-01); expectedForces[3] = Vec3(-5.732010432E-01, 2.645718463E+00, -1.585204274E-01);
expectedForces[4] = Vec3( 3.781920539E-01, -1.654635768E+00, 4.265386268E-03); expectedForces[4] = Vec3(3.781920539E-01, -1.654635768E+00, 4.265386268E-03);
expectedForces[5] = Vec3( 0.0, 0.0, 0.0); expectedForces[5] = Vec3(0.0, 0.0, 0.0);
expectedEnergy = -2.699654759E+00; expectedEnergy = -2.699654759E+00;
...@@ -2632,14 +2632,14 @@ void testTorsionTorsion(int systemId, bool includeDerivs) { ...@@ -2632,14 +2632,14 @@ void testTorsionTorsion(int systemId, bool includeDerivs) {
positions[2] = Vec3(-0.128314660E+02, -0.876338000E+00, 0.942959800E+01); positions[2] = Vec3(-0.128314660E+02, -0.876338000E+00, 0.942959800E+01);
positions[3] = Vec3(-0.130879850E+02, -0.760280000E-01, 0.814732200E+01); positions[3] = Vec3(-0.130879850E+02, -0.760280000E-01, 0.814732200E+01);
positions[4] = Vec3(-0.120888080E+02, 0.112050000E-01, 0.722704500E+01); positions[4] = Vec3(-0.120888080E+02, 0.112050000E-01, 0.722704500E+01);
positions[5] = Vec3( 0.0, 0.0, 0.0); positions[5] = Vec3(0.0, 0.0, 0.0);
expectedForces[0] = Vec3( 4.165851130E-01, 6.608242922E-01, -8.082168261E-01); expectedForces[0] = Vec3(4.165851130E-01, 6.608242922E-01, -8.082168261E-01);
expectedForces[1] = Vec3(-6.024659721E-01, -8.878744406E-01, 1.322274444E+00); expectedForces[1] = Vec3(-6.024659721E-01, -8.878744406E-01, 1.322274444E+00);
expectedForces[2] = Vec3( 3.196925118E-02, -3.137497848E-01, -8.207984001E-01); expectedForces[2] = Vec3(3.196925118E-02, -3.137497848E-01, -8.207984001E-01);
expectedForces[3] = Vec3( 3.842205941E-02, 2.602732089E-01, 1.547586195E-01); expectedForces[3] = Vec3(3.842205941E-02, 2.602732089E-01, 1.547586195E-01);
expectedForces[4] = Vec3( 1.154895485E-01, 2.805267242E-01, 1.519821623E-01); expectedForces[4] = Vec3(1.154895485E-01, 2.805267242E-01, 1.519821623E-01);
expectedForces[5] = Vec3( 0.0, 0.0, 0.0); expectedForces[5] = Vec3(0.0, 0.0, 0.0);
expectedEnergy = -3.372536909E+00; expectedEnergy = -3.372536909E+00;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -79,41 +79,41 @@ void testWcaDispersionAmmonia(FILE* log) { ...@@ -79,41 +79,41 @@ void testWcaDispersionAmmonia(FILE* log) {
System system; System system;
AmoebaWcaDispersionForce* amoebaWcaDispersionForce = new AmoebaWcaDispersionForce();; AmoebaWcaDispersionForce* amoebaWcaDispersionForce = new AmoebaWcaDispersionForce();;
amoebaWcaDispersionForce->setEpso( 4.6024000e-01); amoebaWcaDispersionForce->setEpso( 4.6024000e-01);
amoebaWcaDispersionForce->setEpsh( 5.6484000e-02); amoebaWcaDispersionForce->setEpsh( 5.6484000e-02);
amoebaWcaDispersionForce->setRmino( 1.7025000e-01); amoebaWcaDispersionForce->setRmino( 1.7025000e-01);
amoebaWcaDispersionForce->setRminh( 1.3275000e-01); amoebaWcaDispersionForce->setRminh( 1.3275000e-01);
amoebaWcaDispersionForce->setDispoff(2.6000000e-02); amoebaWcaDispersionForce->setDispoff(2.6000000e-02);
amoebaWcaDispersionForce->setAwater( 3.3428000e+01); amoebaWcaDispersionForce->setAwater(3.3428000e+01);
amoebaWcaDispersionForce->setSlevy( 1.0000000e+00); amoebaWcaDispersionForce->setSlevy( 1.0000000e+00);
amoebaWcaDispersionForce->setShctd( 8.1000000e-01); amoebaWcaDispersionForce->setShctd( 8.1000000e-01);
// addParticle: radius, epsilon // addParticle: radius, epsilon
for (unsigned int ii = 0; ii < 2; ii++) { for (unsigned int ii = 0; ii < 2; ii++) {
system.addParticle( 1.4007000e+01); system.addParticle( 1.4007000e+01);
amoebaWcaDispersionForce->addParticle( 1.8550000e-01, 4.3932000e-01); amoebaWcaDispersionForce->addParticle( 1.8550000e-01, 4.3932000e-01);
system.addParticle( 1.0080000e+00); system.addParticle( 1.0080000e+00);
amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02); amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02);
system.addParticle( 1.0080000e+00); system.addParticle( 1.0080000e+00);
amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02); amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02);
system.addParticle( 1.0080000e+00); system.addParticle( 1.0080000e+00);
amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02); amoebaWcaDispersionForce->addParticle( 1.3500000e-01, 8.3680000e-02);
} }
std::vector<Vec3> positions(numberOfParticles); std::vector<Vec3> positions(numberOfParticles);
positions[0] = Vec3( 1.5927280e-01, 1.7000000e-06, 1.6491000e-03); positions[0] = Vec3( 1.5927280e-01, 1.7000000e-06, 1.6491000e-03);
positions[1] = Vec3( 2.0805540e-01, -8.1258800e-02, 3.7282500e-02); positions[1] = Vec3( 2.0805540e-01, -8.1258800e-02, 3.7282500e-02);
positions[2] = Vec3( 2.0843610e-01, 8.0953200e-02, 3.7462200e-02); positions[2] = Vec3( 2.0843610e-01, 8.0953200e-02, 3.7462200e-02);
positions[3] = Vec3( 1.7280780e-01, 2.0730000e-04, -9.8741700e-02); positions[3] = Vec3( 1.7280780e-01, 2.0730000e-04, -9.8741700e-02);
positions[4] = Vec3( -1.6743680e-01, 1.5900000e-05, -6.6149000e-03); positions[4] = Vec3(-1.6743680e-01, 1.5900000e-05, -6.6149000e-03);
positions[5] = Vec3( -2.0428260e-01, 8.1071500e-02, 4.1343900e-02); positions[5] = Vec3(-2.0428260e-01, 8.1071500e-02, 4.1343900e-02);
positions[6] = Vec3( -6.7308300e-02, 1.2800000e-05, 1.0623300e-02); positions[6] = Vec3(-6.7308300e-02, 1.2800000e-05, 1.0623300e-02);
positions[7] = Vec3( -2.0426290e-01, -8.1231400e-02, 4.1033500e-02); positions[7] = Vec3(-2.0426290e-01, -8.1231400e-02, 4.1033500e-02);
system.addForce(amoebaWcaDispersionForce); system.addForce(amoebaWcaDispersionForce);
ASSERT(!amoebaWcaDispersionForce->usesPeriodicBoundaryConditions()); ASSERT(!amoebaWcaDispersionForce->usesPeriodicBoundaryConditions());
...@@ -134,14 +134,14 @@ void testWcaDispersionAmmonia(FILE* log) { ...@@ -134,14 +134,14 @@ void testWcaDispersionAmmonia(FILE* log) {
std::vector<Vec3> expectedForces(numberOfParticles); std::vector<Vec3> expectedForces(numberOfParticles);
double expectedEnergy = -2.6981209e+01; double expectedEnergy = -2.6981209e+01;
expectedForces[0] = Vec3( 4.7839388e+00, -7.3510133e-04, -5.0382764e-01); expectedForces[0] = Vec3( 4.7839388e+00, -7.3510133e-04, -5.0382764e-01);
expectedForces[1] = Vec3( 1.4657758e+00, 1.2431003e+00, -6.7075886e-01); expectedForces[1] = Vec3( 1.4657758e+00, 1.2431003e+00, -6.7075886e-01);
expectedForces[2] = Vec3( 1.4563936e+00, -1.2399917e+00, -6.7443841e-01); expectedForces[2] = Vec3( 1.4563936e+00, -1.2399917e+00, -6.7443841e-01);
expectedForces[3] = Vec3( 2.1116744e+00, -2.7407512e-03, 1.3271245e+00); expectedForces[3] = Vec3( 2.1116744e+00, -2.7407512e-03, 1.3271245e+00);
expectedForces[4] = Vec3( -4.7528440e+00, -1.5148066e-03, 1.2653813e+00); expectedForces[4] = Vec3(-4.7528440e+00, -1.5148066e-03, 1.2653813e+00);
expectedForces[5] = Vec3( -1.1875619e+00, -1.2866678e+00, -3.9109060e-01); expectedForces[5] = Vec3(-1.1875619e+00, -1.2866678e+00, -3.9109060e-01);
expectedForces[6] = Vec3( -2.6885679e+00, -4.3038639e-04, 3.3763583e-02); expectedForces[6] = Vec3(-2.6885679e+00, -4.3038639e-04, 3.3763583e-02);
expectedForces[7] = Vec3( -1.1888087e+00, 1.2889802e+00, -3.8615387e-01); expectedForces[7] = Vec3(-1.1888087e+00, 1.2889802e+00, -3.8615387e-01);
double tolerance = 1.0e-04; double tolerance = 1.0e-04;
compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance, log); compareForcesEnergy(testName, expectedEnergy, energy, expectedForces, forces, tolerance, log);
......
...@@ -66,13 +66,13 @@ void* AmoebaAngleForceProxy::deserialize(const SerializationNode& node) const { ...@@ -66,13 +66,13 @@ void* AmoebaAngleForceProxy::deserialize(const SerializationNode& node) const {
AmoebaAngleForce* force = new AmoebaAngleForce(); AmoebaAngleForce* force = new AmoebaAngleForce();
try { try {
force->setAmoebaGlobalAngleCubic(node.getDoubleProperty( "cubic")); force->setAmoebaGlobalAngleCubic(node.getDoubleProperty("cubic"));
force->setAmoebaGlobalAngleQuartic(node.getDoubleProperty("quartic")); force->setAmoebaGlobalAngleQuartic(node.getDoubleProperty("quartic"));
force->setAmoebaGlobalAnglePentic(node.getDoubleProperty( "pentic")); force->setAmoebaGlobalAnglePentic(node.getDoubleProperty("pentic"));
force->setAmoebaGlobalAngleSextic(node.getDoubleProperty( "sextic")); force->setAmoebaGlobalAngleSextic(node.getDoubleProperty("sextic"));
const SerializationNode& bonds = node.getChildNode("Angles"); const SerializationNode& bonds = node.getChildNode("Angles");
for ( unsigned int ii = 0; ii < bonds.getChildren().size(); ii++) { for (unsigned int ii = 0; ii < bonds.getChildren().size(); ii++) {
const SerializationNode& bond = bonds.getChildren()[ii]; const SerializationNode& bond = bonds.getChildren()[ii];
force->addAngle(bond.getIntProperty("p1"), bond.getIntProperty("p2"), bond.getIntProperty("p3"), bond.getDoubleProperty("d"), bond.getDoubleProperty("k")); force->addAngle(bond.getIntProperty("p1"), bond.getIntProperty("p2"), bond.getIntProperty("p3"), bond.getDoubleProperty("d"), bond.getDoubleProperty("k"));
} }
......
...@@ -65,7 +65,7 @@ void* AmoebaBondForceProxy::deserialize(const SerializationNode& node) const { ...@@ -65,7 +65,7 @@ void* AmoebaBondForceProxy::deserialize(const SerializationNode& node) const {
force->setAmoebaGlobalBondCubic(node.getDoubleProperty("cubic")); force->setAmoebaGlobalBondCubic(node.getDoubleProperty("cubic"));
force->setAmoebaGlobalBondQuartic(node.getDoubleProperty("quartic")); force->setAmoebaGlobalBondQuartic(node.getDoubleProperty("quartic"));
const SerializationNode& bonds = node.getChildNode("Bonds"); const SerializationNode& bonds = node.getChildNode("Bonds");
for ( unsigned int ii = 0; ii < (int) bonds.getChildren().size(); ii++) { for (unsigned int ii = 0; ii < (int) bonds.getChildren().size(); ii++) {
const SerializationNode& bond = bonds.getChildren()[ii]; const SerializationNode& bond = bonds.getChildren()[ii];
force->addBond(bond.getIntProperty("p1"), bond.getIntProperty("p2"), bond.getDoubleProperty("d"), bond.getDoubleProperty("k")); force->addBond(bond.getIntProperty("p1"), bond.getIntProperty("p2"), bond.getDoubleProperty("d"), bond.getDoubleProperty("k"));
} }
......
...@@ -45,17 +45,17 @@ void AmoebaGeneralizedKirkwoodForceProxy::serialize(const void* object, Serializ ...@@ -45,17 +45,17 @@ void AmoebaGeneralizedKirkwoodForceProxy::serialize(const void* object, Serializ
node.setIntProperty("version", 1); node.setIntProperty("version", 1);
const AmoebaGeneralizedKirkwoodForce& force = *reinterpret_cast<const AmoebaGeneralizedKirkwoodForce*>(object); const AmoebaGeneralizedKirkwoodForce& force = *reinterpret_cast<const AmoebaGeneralizedKirkwoodForce*>(object);
node.setDoubleProperty("GeneralizedKirkwoodSolventDielectric", force.getSolventDielectric() ); node.setDoubleProperty("GeneralizedKirkwoodSolventDielectric", force.getSolventDielectric());
node.setDoubleProperty("GeneralizedKirkwoodSoluteDielectric", force.getSoluteDielectric() ); node.setDoubleProperty("GeneralizedKirkwoodSoluteDielectric", force.getSoluteDielectric());
//node.setDoubleProperty("GeneralizedKirkwoodDielectricOffset", force.getDielectricOffset() ); //node.setDoubleProperty("GeneralizedKirkwoodDielectricOffset", force.getDielectricOffset());
node.setDoubleProperty("GeneralizedKirkwoodProbeRadius", force.getProbeRadius() ); node.setDoubleProperty("GeneralizedKirkwoodProbeRadius", force.getProbeRadius());
node.setDoubleProperty("GeneralizedKirkwoodSurfaceAreaFactor", force.getSurfaceAreaFactor() ); node.setDoubleProperty("GeneralizedKirkwoodSurfaceAreaFactor", force.getSurfaceAreaFactor());
node.setIntProperty( "GeneralizedKirkwoodIncludeCavityTerm", force.getIncludeCavityTerm() ); node.setIntProperty( "GeneralizedKirkwoodIncludeCavityTerm", force.getIncludeCavityTerm());
SerializationNode& particles = node.createChildNode("GeneralizedKirkwoodParticles"); SerializationNode& particles = node.createChildNode("GeneralizedKirkwoodParticles");
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumParticles()); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumParticles()); ii++) {
double radius, charge, scalingFactor; double radius, charge, scalingFactor;
force.getParticleParameters( ii, charge, radius, scalingFactor ); force.getParticleParameters(ii, charge, radius, scalingFactor);
particles.createChildNode("Particle").setDoubleProperty("charge", charge).setDoubleProperty("radius", radius).setDoubleProperty("scaleFactor", scalingFactor); particles.createChildNode("Particle").setDoubleProperty("charge", charge).setDoubleProperty("radius", radius).setDoubleProperty("scaleFactor", scalingFactor);
} }
...@@ -67,17 +67,17 @@ void* AmoebaGeneralizedKirkwoodForceProxy::deserialize(const SerializationNode& ...@@ -67,17 +67,17 @@ void* AmoebaGeneralizedKirkwoodForceProxy::deserialize(const SerializationNode&
AmoebaGeneralizedKirkwoodForce* force = new AmoebaGeneralizedKirkwoodForce(); AmoebaGeneralizedKirkwoodForce* force = new AmoebaGeneralizedKirkwoodForce();
try { try {
force->setSolventDielectric( node.getDoubleProperty( "GeneralizedKirkwoodSolventDielectric" ) ); force->setSolventDielectric( node.getDoubleProperty("GeneralizedKirkwoodSolventDielectric"));
force->setSoluteDielectric( node.getDoubleProperty( "GeneralizedKirkwoodSoluteDielectric" ) ); force->setSoluteDielectric( node.getDoubleProperty("GeneralizedKirkwoodSoluteDielectric"));
//force->setDielectricOffset( node.getDoubleProperty( "GeneralizedKirkwoodDielectricOffset" ) ); //force->setDielectricOffset( node.getDoubleProperty("GeneralizedKirkwoodDielectricOffset"));
force->setProbeRadius( node.getDoubleProperty( "GeneralizedKirkwoodProbeRadius" ) ); force->setProbeRadius( node.getDoubleProperty("GeneralizedKirkwoodProbeRadius"));
force->setSurfaceAreaFactor( node.getDoubleProperty( "GeneralizedKirkwoodSurfaceAreaFactor" ) ); force->setSurfaceAreaFactor( node.getDoubleProperty("GeneralizedKirkwoodSurfaceAreaFactor"));
force->setIncludeCavityTerm( node.getIntProperty( "GeneralizedKirkwoodIncludeCavityTerm" ) ); force->setIncludeCavityTerm( node.getIntProperty( "GeneralizedKirkwoodIncludeCavityTerm"));
const SerializationNode& particles = node.getChildNode("GeneralizedKirkwoodParticles"); const SerializationNode& particles = node.getChildNode("GeneralizedKirkwoodParticles");
for (unsigned int ii = 0; ii < particles.getChildren().size(); ii++) { for (unsigned int ii = 0; ii < particles.getChildren().size(); ii++) {
const SerializationNode& particle = particles.getChildren()[ii]; const SerializationNode& particle = particles.getChildren()[ii];
force->addParticle( particle.getDoubleProperty("charge"), particle.getDoubleProperty("radius"), particle.getDoubleProperty("scaleFactor")); force->addParticle(particle.getDoubleProperty("charge"), particle.getDoubleProperty("radius"), particle.getDoubleProperty("scaleFactor"));
} }
} }
catch (...) { catch (...) {
......
...@@ -52,7 +52,7 @@ void AmoebaInPlaneAngleForceProxy::serialize(const void* object, SerializationNo ...@@ -52,7 +52,7 @@ void AmoebaInPlaneAngleForceProxy::serialize(const void* object, SerializationNo
node.setDoubleProperty("sextic", force.getAmoebaGlobalInPlaneAngleSextic()); node.setDoubleProperty("sextic", force.getAmoebaGlobalInPlaneAngleSextic());
SerializationNode& bonds = node.createChildNode("InPlaneAngles"); SerializationNode& bonds = node.createChildNode("InPlaneAngles");
for ( unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumAngles()); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumAngles()); ii++) {
int particle1, particle2, particle3, particle4; int particle1, particle2, particle3, particle4;
double distance, k; double distance, k;
force.getAngleParameters(ii, particle1, particle2, particle3, particle4, distance, k); force.getAngleParameters(ii, particle1, particle2, particle3, particle4, distance, k);
...@@ -66,10 +66,10 @@ void* AmoebaInPlaneAngleForceProxy::deserialize(const SerializationNode& node) c ...@@ -66,10 +66,10 @@ void* AmoebaInPlaneAngleForceProxy::deserialize(const SerializationNode& node) c
AmoebaInPlaneAngleForce* force = new AmoebaInPlaneAngleForce(); AmoebaInPlaneAngleForce* force = new AmoebaInPlaneAngleForce();
try { try {
force->setAmoebaGlobalInPlaneAngleCubic( node.getDoubleProperty("cubic")); force->setAmoebaGlobalInPlaneAngleCubic( node.getDoubleProperty("cubic"));
force->setAmoebaGlobalInPlaneAngleQuartic(node.getDoubleProperty("quartic")); force->setAmoebaGlobalInPlaneAngleQuartic(node.getDoubleProperty("quartic"));
force->setAmoebaGlobalInPlaneAnglePentic( node.getDoubleProperty("pentic")); force->setAmoebaGlobalInPlaneAnglePentic(node.getDoubleProperty("pentic"));
force->setAmoebaGlobalInPlaneAngleSextic( node.getDoubleProperty("sextic")); force->setAmoebaGlobalInPlaneAngleSextic(node.getDoubleProperty("sextic"));
const SerializationNode& bonds = node.getChildNode("InPlaneAngles"); const SerializationNode& bonds = node.getChildNode("InPlaneAngles");
for (unsigned int ii = 0; ii < bonds.getChildren().size(); ii++) { for (unsigned int ii = 0; ii < bonds.getChildren().size(); ii++) {
......
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