"platforms/cuda2/tests/TestCudaNonbondedForce.cpp" did not exist on "306d99e8472d9061aec0caab942fde5a03398de4"
Commit cf990200 authored by peastman's avatar peastman
Browse files

Merge pull request #110 from peastman/master

Fixed numeric problems using PME with Drude particles
parents 80dde429 26c51a0c
......@@ -224,6 +224,8 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
compilationDefines["ACOS"] = useDoublePrecision ? "acos" : "acosf";
compilationDefines["ASIN"] = useDoublePrecision ? "asin" : "asinf";
compilationDefines["ATAN"] = useDoublePrecision ? "atan" : "atanf";
compilationDefines["ERF"] = useDoublePrecision ? "erf" : "erff";
compilationDefines["ERFC"] = useDoublePrecision ? "erfc" : "erfcf";
// Create the work thread used for parallelization when running on multiple devices.
......
......@@ -23,8 +23,9 @@ if ((!isExcluded && r2 < CUTOFF_SQUARED) || needCorrection) {
// Subtract off the part of this interaction that was included in the reciprocal space contribution.
if (1-erfcAlphaR > 1e-6) {
tempForce = -prefactor*((1.0f-erfcAlphaR)-alphaR*expAlphaRSqr*TWO_OVER_SQRT_PI);
tempEnergy += -prefactor*(1.0f-erfcAlphaR);
real erfAlphaR = ERF(alphaR); // Our erfc approximation is not accurate enough when r is very small, which happens with Drude particles.
tempForce = -prefactor*(erfAlphaR-alphaR*expAlphaRSqr*TWO_OVER_SQRT_PI);
tempEnergy += -prefactor*erfAlphaR;
}
}
else {
......
......@@ -23,8 +23,9 @@ if ((!isExcluded && r2 < CUTOFF_SQUARED) || needCorrection) {
// Subtract off the part of this interaction that was included in the reciprocal space contribution.
if (1-erfcAlphaR > 1e-6) {
tempForce = -prefactor*((1.0f-erfcAlphaR)-alphaR*expAlphaRSqr*TWO_OVER_SQRT_PI);
tempEnergy += -prefactor*(1.0f-erfcAlphaR);
real erfAlphaR = erf(alphaR); // Our erfc approximation is not accurate enough when r is very small, which happens with Drude particles.
tempForce = -prefactor*(erfAlphaR-alphaR*expAlphaRSqr*TWO_OVER_SQRT_PI);
tempEnergy += -prefactor*erfAlphaR;
}
}
else {
......
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