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
2586776f
Commit
2586776f
authored
Nov 28, 2011
by
Peter Eastman
Browse files
Switched to a more accurate approximation for erfc()
parent
da5196d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
platforms/opencl/src/kernels/coulombLennardJones.cl
platforms/opencl/src/kernels/coulombLennardJones.cl
+6
-3
No files found.
platforms/opencl/src/kernels/coulombLennardJones.cl
View file @
2586776f
...
...
@@ -9,10 +9,13 @@ if (!isExcluded || needCorrection) {
//
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
2.5
e-
5
.
//
error
of
3
e-
7
.
const
float
t
=
1.0f/
(
1.0f+0.47047f*alphaR
)
;
const
float
erfcAlphaR
=
(
t*
(
0.3480242f+t*
(
-0.0958798f+t*0.7478556f
)))
*expAlphaRSqr
;
float
t
=
1.0f+
(
0.0705230784f+
(
0.0422820123f+
(
0.0092705272f+
(
0.0001520143f+
(
0.0002765672f+0.0000430638f*alphaR
)
*alphaR
)
*alphaR
)
*alphaR
)
*alphaR
)
*alphaR
;
t
*=
t
;
t
*=
t
;
t
*=
t
;
const
float
erfcAlphaR
=
RECIP
(
t*t
)
;
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