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
403b2595
"vscode:/vscode.git/clone" did not exist on "1d88314ebec9b820c0d2f6f31927bd8c7bab1bc8"
Commit
403b2595
authored
Mar 28, 2013
by
Peter Eastman
Browse files
In double precision mode, compute erfc() exactly instead of approximating it
parent
0a1f4594
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
platforms/cuda/src/kernels/coulombLennardJones.cu
platforms/cuda/src/kernels/coulombLennardJones.cu
+4
-0
platforms/opencl/src/kernels/coulombLennardJones.cl
platforms/opencl/src/kernels/coulombLennardJones.cl
+4
-0
No files found.
platforms/cuda/src/kernels/coulombLennardJones.cu
View file @
403b2595
...
...
@@ -6,6 +6,9 @@ if (!isExcluded || needCorrection) {
const
real
expAlphaRSqr
=
EXP
(
-
alphaR
*
alphaR
);
const
real
prefactor
=
138.935456
f
*
posq1
.
w
*
posq2
.
w
*
invR
;
#ifdef USE_DOUBLE_PRECISION
const
real
erfcAlphaR
=
erfc
(
alphaR
);
#else
// This approximation for erfc is from Abramowitz and Stegun (1964) p. 299. They cite the following as
// the original source: C. Hastings, Jr., Approximations for Digital Computers (1955). It has a maximum
// error of 3e-7.
...
...
@@ -15,6 +18,7 @@ if (!isExcluded || needCorrection) {
t
*=
t
;
t
*=
t
;
const
real
erfcAlphaR
=
RECIP
(
t
*
t
);
#endif
real
tempForce
=
0.0
f
;
if
(
needCorrection
)
{
// Subtract off the part of this interaction that was included in the reciprocal space contribution.
...
...
platforms/opencl/src/kernels/coulombLennardJones.cl
View file @
403b2595
...
...
@@ -6,6 +6,9 @@ if (!isExcluded || needCorrection) {
const
real
expAlphaRSqr
=
EXP
(
-alphaR*alphaR
)
;
const
real
prefactor
=
138.935456f*posq1.w*posq2.w*invR
;
#
ifdef
USE_DOUBLE_PRECISION
const
real
erfcAlphaR
=
erfc
(
alphaR
)
;
#
else
//
This
approximation
for
erfc
is
from
Abramowitz
and
Stegun
(
1964
)
p.
299.
They
cite
the
following
as
//
the
original
source:
C.
Hastings,
Jr.,
Approximations
for
Digital
Computers
(
1955
)
.
It
has
a
maximum
//
error
of
3e-7.
...
...
@@ -15,6 +18,7 @@ if (!isExcluded || needCorrection) {
t
*=
t
;
t
*=
t
;
const
real
erfcAlphaR
=
RECIP
(
t*t
)
;
#
endif
real
tempForce
=
0
;
if
(
needCorrection
)
{
//
Subtract
off
the
part
of
this
interaction
that
was
included
in
the
reciprocal
space
contribution.
...
...
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