Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
cf990200
Commit
cf990200
authored
Aug 16, 2013
by
peastman
Browse files
Merge pull request #110 from peastman/master
Fixed numeric problems using PME with Drude particles
parents
80dde429
26c51a0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
platforms/cuda/src/CudaContext.cpp
platforms/cuda/src/CudaContext.cpp
+2
-0
platforms/cuda/src/kernels/coulombLennardJones.cu
platforms/cuda/src/kernels/coulombLennardJones.cu
+3
-2
platforms/opencl/src/kernels/coulombLennardJones.cl
platforms/opencl/src/kernels/coulombLennardJones.cl
+3
-2
No files found.
platforms/cuda/src/CudaContext.cpp
View file @
cf990200
...
...
@@ -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.
...
...
platforms/cuda/src/kernels/coulombLennardJones.cu
View file @
cf990200
...
...
@@ -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.0
f
-
erfcAlphaR
)
-
alphaR
*
expAlphaRSqr
*
TWO_OVER_SQRT_PI
);
tempEnergy
+=
-
prefactor
*
(
1.0
f
-
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
{
...
...
platforms/opencl/src/kernels/coulombLennardJones.cl
View file @
cf990200
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment