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
80dde429
Commit
80dde429
authored
Aug 15, 2013
by
peastman
Browse files
Merge pull request #109 from peastman/master
Avoid nans when using PME with Drude particles
parents
68632d78
f4f5b568
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
18 deletions
+24
-18
platforms/cuda/src/kernels/coulombLennardJones.cu
platforms/cuda/src/kernels/coulombLennardJones.cu
+4
-2
platforms/opencl/src/kernels/coulombLennardJones.cl
platforms/opencl/src/kernels/coulombLennardJones.cl
+4
-2
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
...ms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
+16
-14
No files found.
platforms/cuda/src/kernels/coulombLennardJones.cu
View file @
80dde429
...
@@ -22,8 +22,10 @@ if ((!isExcluded && r2 < CUTOFF_SQUARED) || needCorrection) {
...
@@ -22,8 +22,10 @@ if ((!isExcluded && r2 < CUTOFF_SQUARED) || needCorrection) {
if
(
needCorrection
)
{
if
(
needCorrection
)
{
// Subtract off the part of this interaction that was included in the reciprocal space contribution.
// Subtract off the part of this interaction that was included in the reciprocal space contribution.
tempForce
=
-
prefactor
*
((
1.0
f
-
erfcAlphaR
)
-
alphaR
*
expAlphaRSqr
*
TWO_OVER_SQRT_PI
);
if
(
1
-
erfcAlphaR
>
1e-6
)
{
tempEnergy
+=
-
prefactor
*
(
1.0
f
-
erfcAlphaR
);
tempForce
=
-
prefactor
*
((
1.0
f
-
erfcAlphaR
)
-
alphaR
*
expAlphaRSqr
*
TWO_OVER_SQRT_PI
);
tempEnergy
+=
-
prefactor
*
(
1.0
f
-
erfcAlphaR
);
}
}
}
else
{
else
{
#if HAS_LENNARD_JONES
#if HAS_LENNARD_JONES
...
...
platforms/opencl/src/kernels/coulombLennardJones.cl
View file @
80dde429
...
@@ -22,8 +22,10 @@ if ((!isExcluded && r2 < CUTOFF_SQUARED) || needCorrection) {
...
@@ -22,8 +22,10 @@ if ((!isExcluded && r2 < CUTOFF_SQUARED) || needCorrection) {
if
(
needCorrection
)
{
if
(
needCorrection
)
{
//
Subtract
off
the
part
of
this
interaction
that
was
included
in
the
reciprocal
space
contribution.
//
Subtract
off
the
part
of
this
interaction
that
was
included
in
the
reciprocal
space
contribution.
tempForce
=
-prefactor*
((
1.0f-erfcAlphaR
)
-alphaR*expAlphaRSqr*TWO_OVER_SQRT_PI
)
;
if
(
1-erfcAlphaR
>
1e-6
)
{
tempEnergy
+=
-prefactor*
(
1.0f-erfcAlphaR
)
;
tempForce
=
-prefactor*
((
1.0f-erfcAlphaR
)
-alphaR*expAlphaRSqr*TWO_OVER_SQRT_PI
)
;
tempEnergy
+=
-prefactor*
(
1.0f-erfcAlphaR
)
;
}
}
}
else
{
else
{
#
if
HAS_LENNARD_JONES
#
if
HAS_LENNARD_JONES
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
View file @
80dde429
...
@@ -432,25 +432,27 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
...
@@ -432,25 +432,27 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
RealOpenMM
r
=
deltaR
[
0
][
ReferenceForce
::
RIndex
];
RealOpenMM
r
=
deltaR
[
0
][
ReferenceForce
::
RIndex
];
RealOpenMM
inverseR
=
one
/
(
deltaR
[
0
][
ReferenceForce
::
RIndex
]);
RealOpenMM
inverseR
=
one
/
(
deltaR
[
0
][
ReferenceForce
::
RIndex
]);
RealOpenMM
alphaR
=
alphaEwald
*
r
;
RealOpenMM
alphaR
=
alphaEwald
*
r
;
RealOpenMM
dEdR
=
(
RealOpenMM
)
(
ONE_4PI_EPS0
*
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
inverseR
*
inverseR
);
if
(
erf
(
alphaR
)
>
1e-6
)
{
dEdR
=
(
RealOpenMM
)
(
dEdR
*
(
erf
(
alphaR
)
-
2
*
alphaR
*
exp
(
-
alphaR
*
alphaR
)
/
SQRT_PI
));
RealOpenMM
dEdR
=
(
RealOpenMM
)
(
ONE_4PI_EPS0
*
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
inverseR
*
inverseR
);
dEdR
=
(
RealOpenMM
)
(
dEdR
*
(
erf
(
alphaR
)
-
2
*
alphaR
*
exp
(
-
alphaR
*
alphaR
)
/
SQRT_PI
));
// accumulate forces
// accumulate forces
for
(
int
kk
=
0
;
kk
<
3
;
kk
++
){
for
(
int
kk
=
0
;
kk
<
3
;
kk
++
){
RealOpenMM
force
=
dEdR
*
deltaR
[
0
][
kk
];
RealOpenMM
force
=
dEdR
*
deltaR
[
0
][
kk
];
forces
[
ii
][
kk
]
-=
force
;
forces
[
ii
][
kk
]
-=
force
;
forces
[
jj
][
kk
]
+=
force
;
forces
[
jj
][
kk
]
+=
force
;
}
}
// accumulate energies
// accumulate energies
realSpaceEwaldEnergy
=
(
RealOpenMM
)
(
ONE_4PI_EPS0
*
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
erf
(
alphaR
));
realSpaceEwaldEnergy
=
(
RealOpenMM
)
(
ONE_4PI_EPS0
*
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
erf
(
alphaR
));
totalExclusionEnergy
+=
realSpaceEwaldEnergy
;
totalExclusionEnergy
+=
realSpaceEwaldEnergy
;
if
(
energyByAtom
){
if
(
energyByAtom
){
energyByAtom
[
ii
]
-=
realSpaceEwaldEnergy
;
energyByAtom
[
ii
]
-=
realSpaceEwaldEnergy
;
energyByAtom
[
jj
]
-=
realSpaceEwaldEnergy
;
energyByAtom
[
jj
]
-=
realSpaceEwaldEnergy
;
}
}
}
}
}
}
}
...
...
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