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
039bb3fb
Commit
039bb3fb
authored
May 08, 2013
by
Peter Eastman
Browse files
Very minor code simplification
parent
70ff98db
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
86 deletions
+82
-86
platforms/cuda/src/kernels/coulombLennardJones.cu
platforms/cuda/src/kernels/coulombLennardJones.cu
+41
-43
platforms/opencl/src/kernels/coulombLennardJones.cl
platforms/opencl/src/kernels/coulombLennardJones.cl
+41
-43
No files found.
platforms/cuda/src/kernels/coulombLennardJones.cu
View file @
039bb3fb
#if USE_EWALD
#if USE_EWALD
bool
needCorrection
=
hasExclusions
&&
isExcluded
&&
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
;
bool
needCorrection
=
hasExclusions
&&
isExcluded
&&
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
;
if
(
!
isExcluded
||
needCorrection
)
{
if
((
!
isExcluded
&&
r2
<
CUTOFF_SQUARED
)
||
needCorrection
)
{
if
(
r2
<
CUTOFF_SQUARED
||
needCorrection
)
{
const
real
alphaR
=
EWALD_ALPHA
*
r
;
const
real
alphaR
=
EWALD_ALPHA
*
r
;
const
real
expAlphaRSqr
=
EXP
(
-
alphaR
*
alphaR
);
const
real
expAlphaRSqr
=
EXP
(
-
alphaR
*
alphaR
);
const
real
prefactor
=
138.935456
f
*
posq1
.
w
*
posq2
.
w
*
invR
;
const
real
prefactor
=
138.935456
f
*
posq1
.
w
*
posq2
.
w
*
invR
;
...
@@ -52,7 +51,6 @@ if (!isExcluded || needCorrection) {
...
@@ -52,7 +51,6 @@ if (!isExcluded || needCorrection) {
#endif
#endif
}
}
dEdR
+=
tempForce
*
invR
*
invR
;
dEdR
+=
tempForce
*
invR
*
invR
;
}
}
}
#else
#else
{
{
...
...
platforms/opencl/src/kernels/coulombLennardJones.cl
View file @
039bb3fb
#
if
USE_EWALD
#
if
USE_EWALD
bool
needCorrection
=
hasExclusions
&&
isExcluded
&&
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
;
bool
needCorrection
=
hasExclusions
&&
isExcluded
&&
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
;
if
(
!isExcluded
|
| needCorrection) {
if
((
!isExcluded
&&
r2
<
CUTOFF_SQUARED
)
||
needCorrection
)
{
if (r2 < CUTOFF_SQUARED |
|
needCorrection
)
{
const
real
alphaR
=
EWALD_ALPHA*r
;
const
real
alphaR
=
EWALD_ALPHA*r
;
const
real
expAlphaRSqr
=
EXP
(
-alphaR*alphaR
)
;
const
real
expAlphaRSqr
=
EXP
(
-alphaR*alphaR
)
;
const
real
prefactor
=
138.935456f*posq1.w*posq2.w*invR
;
const
real
prefactor
=
138.935456f*posq1.w*posq2.w*invR
;
...
@@ -52,7 +51,6 @@ if (!isExcluded || needCorrection) {
...
@@ -52,7 +51,6 @@ if (!isExcluded || needCorrection) {
#
endif
#
endif
}
}
dEdR
+=
tempForce*invR*invR
;
dEdR
+=
tempForce*invR*invR
;
}
}
}
#
else
#
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