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
a161d091
Commit
a161d091
authored
Jan 31, 2011
by
Mark Friedrichs
Browse files
Fix for Born force calculation when cutoffs are applied
parent
e772c611
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
72 deletions
+53
-72
platforms/cuda/src/kernels/kCalculateCDLJObcGbsaForces1.h
platforms/cuda/src/kernels/kCalculateCDLJObcGbsaForces1.h
+53
-72
No files found.
platforms/cuda/src/kernels/kCalculateCDLJObcGbsaForces1.h
View file @
a161d091
...
@@ -147,19 +147,16 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -147,19 +147,16 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
j
].
br
;
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
/* E */
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
j
].
q
)
/
denominator
;
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
j
].
q
)
/
denominator
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
dGpol_dalpha2_ij
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
#endif
#endif
/* E */
if
(
i
<
cSim
.
atoms
)
if
(
i
<
cSim
.
atoms
)
{
{
energy
+=
0
.
5
f
*
CDLJObcGbsa_energy
;
energy
+=
0
.
5
f
*
CDLJObcGbsa_energy
;
...
@@ -171,6 +168,7 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -171,6 +168,7 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
af
.
x
-=
dx
;
af
.
x
-=
dx
;
af
.
y
-=
dy
;
af
.
y
-=
dy
;
af
.
z
-=
dz
;
af
.
z
-=
dz
;
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
j
].
br
;
}
}
}
}
else
// bExclusion
else
// bExclusion
...
@@ -198,7 +196,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -198,7 +196,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
sig6
=
sig2
*
sig2
*
sig2
;
float
sig6
=
sig2
*
sig2
*
sig2
;
float
eps
=
a
.
y
*
psA
[
j
].
eps
;
float
eps
=
a
.
y
*
psA
[
j
].
eps
;
float
dEdR
=
eps
*
(
12
.
0
f
*
sig6
-
6
.
0
f
)
*
sig6
;
float
dEdR
=
eps
*
(
12
.
0
f
*
sig6
-
6
.
0
f
)
*
sig6
;
/* E */
CDLJObcGbsa_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
CDLJObcGbsa_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
#ifdef USE_EWALD
#ifdef USE_EWALD
...
@@ -206,7 +203,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -206,7 +203,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
erfcAlphaR
=
fastErfc
(
alphaR
);
float
erfcAlphaR
=
fastErfc
(
alphaR
);
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
/* E */
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
erfcAlphaR
;
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
erfcAlphaR
;
bool
needCorrection
=
!
(
excl
&
0x1
)
&&
x
+
tgx
!=
y
+
j
&&
x
+
tgx
<
cSim
.
atoms
&&
y
+
j
<
cSim
.
atoms
;
bool
needCorrection
=
!
(
excl
&
0x1
)
&&
x
+
tgx
!=
y
+
j
&&
x
+
tgx
<
cSim
.
atoms
&&
y
+
j
<
cSim
.
atoms
;
if
(
needCorrection
)
if
(
needCorrection
)
...
@@ -218,14 +214,12 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -218,14 +214,12 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
}
}
#else
#else
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
(
invR
-
2
.
0
f
*
cSim
.
reactionFieldK
*
r2
);
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
(
invR
-
2
.
0
f
*
cSim
.
reactionFieldK
*
r2
);
/* E */
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
j
].
q
*
(
invR
+
cSim
.
reactionFieldK
*
r2
-
cSim
.
reactionFieldC
);
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
j
].
q
*
(
invR
+
cSim
.
reactionFieldK
*
r2
-
cSim
.
reactionFieldC
);
#endif
#endif
#else
#else
float
factorX
=
apos
.
w
*
psA
[
j
].
q
*
invR
;
float
factorX
=
apos
.
w
*
psA
[
j
].
q
*
invR
;
dEdR
+=
factorX
;
dEdR
+=
factorX
;
/* E */
CDLJObcGbsa_energy
+=
factorX
;
CDLJObcGbsa_energy
+=
factorX
;
#endif
#endif
dEdR
*=
invR
*
invR
;
dEdR
*=
invR
*
invR
;
...
@@ -236,7 +230,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -236,7 +230,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
#endif
#endif
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
...
@@ -248,22 +241,20 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -248,22 +241,20 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
j
].
br
;
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
/* E */
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
j
].
q
)
/
denominator
;
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
j
].
q
)
/
denominator
;
#if defined USE_PERIODIC
#if defined USE_PERIODIC
if
(
i
>=
cSim
.
atoms
||
x
+
j
>=
cSim
.
atoms
||
r2
>
cSim
.
nonbondedCutoffSqr
)
if
(
i
>=
cSim
.
atoms
||
x
+
j
>=
cSim
.
atoms
||
r2
>
cSim
.
nonbondedCutoffSqr
)
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
dGpol_dalpha2_ij
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
#elif defined USE_CUTOFF
#elif defined USE_CUTOFF
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
dGpol_dalpha2_ij
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
#endif
#endif
...
@@ -279,6 +270,7 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -279,6 +270,7 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
af
.
x
-=
dx
;
af
.
x
-=
dx
;
af
.
y
-=
dy
;
af
.
y
-=
dy
;
af
.
z
-=
dz
;
af
.
z
-=
dz
;
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
j
].
br
;
excl
>>=
1
;
excl
>>=
1
;
}
}
}
}
...
@@ -352,7 +344,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -352,7 +344,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
sig6
=
sig2
*
sig2
*
sig2
;
float
sig6
=
sig2
*
sig2
*
sig2
;
float
eps
=
a
.
y
*
psA
[
tj
].
eps
;
float
eps
=
a
.
y
*
psA
[
tj
].
eps
;
float
dEdR
=
eps
*
(
12
.
0
f
*
sig6
-
6
.
0
f
)
*
sig6
;
float
dEdR
=
eps
*
(
12
.
0
f
*
sig6
-
6
.
0
f
)
*
sig6
;
/* E */
CDLJObcGbsa_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
CDLJObcGbsa_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
#ifdef USE_EWALD
#ifdef USE_EWALD
...
@@ -360,18 +351,15 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -360,18 +351,15 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
erfcAlphaR
=
fastErfc
(
alphaR
);
float
erfcAlphaR
=
fastErfc
(
alphaR
);
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
/* E */
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
erfcAlphaR
;
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
erfcAlphaR
;
#else
#else
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
(
invR
-
2
.
0
f
*
cSim
.
reactionFieldK
*
r2
);
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
(
invR
-
2
.
0
f
*
cSim
.
reactionFieldK
*
r2
);
/* E */
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
tj
].
q
*
(
invR
+
cSim
.
reactionFieldK
*
r2
-
cSim
.
reactionFieldC
);
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
tj
].
q
*
(
invR
+
cSim
.
reactionFieldK
*
r2
-
cSim
.
reactionFieldC
);
#endif
#endif
#else
#else
float
factorX
=
apos
.
w
*
psA
[
tj
].
q
*
invR
;
float
factorX
=
apos
.
w
*
psA
[
tj
].
q
*
invR
;
dEdR
+=
factorX
;
dEdR
+=
factorX
;
/* E */
CDLJObcGbsa_energy
+=
factorX
;
CDLJObcGbsa_energy
+=
factorX
;
#endif
#endif
dEdR
*=
invR
*
invR
;
dEdR
*=
invR
*
invR
;
...
@@ -384,16 +372,13 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -384,16 +372,13 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
tj
].
q
)
/
(
denominator
*
denominator2
);
float
Gpol
=
(
q2
*
psA
[
tj
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
tj
].
br
;
psA
[
tj
].
fb
+=
dGpol_dalpha2_ij
*
br
;
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
/* E */
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
tj
].
q
)
/
denominator
;
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
tj
].
q
)
/
denominator
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
dGpol_dalpha2_ij
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
#endif
#endif
...
@@ -409,9 +394,11 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -409,9 +394,11 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
af
.
x
-=
dx
;
af
.
x
-=
dx
;
af
.
y
-=
dy
;
af
.
y
-=
dy
;
af
.
z
-=
dz
;
af
.
z
-=
dz
;
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
tj
].
br
;
psA
[
tj
].
fx
+=
dx
;
psA
[
tj
].
fx
+=
dx
;
psA
[
tj
].
fy
+=
dy
;
psA
[
tj
].
fy
+=
dy
;
psA
[
tj
].
fz
+=
dz
;
psA
[
tj
].
fz
+=
dz
;
psA
[
tj
].
fb
+=
dGpol_dalpha2_ij
*
br
;
tj
=
(
tj
+
1
)
&
(
GRID
-
1
);
tj
=
(
tj
+
1
)
&
(
GRID
-
1
);
}
}
}
}
...
@@ -442,7 +429,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -442,7 +429,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
sig6
=
sig2
*
sig2
*
sig2
;
float
sig6
=
sig2
*
sig2
*
sig2
;
float
eps
=
a
.
y
*
psA
[
j
].
eps
;
float
eps
=
a
.
y
*
psA
[
j
].
eps
;
float
dEdR
=
eps
*
(
12
.
0
f
*
sig6
-
6
.
0
f
)
*
sig6
;
float
dEdR
=
eps
*
(
12
.
0
f
*
sig6
-
6
.
0
f
)
*
sig6
;
/* E */
CDLJObcGbsa_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
CDLJObcGbsa_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
#ifdef USE_EWALD
#ifdef USE_EWALD
...
@@ -453,14 +439,12 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -453,14 +439,12 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
erfcAlphaR
;
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
erfcAlphaR
;
#else
#else
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
(
invR
-
2
.
0
f
*
cSim
.
reactionFieldK
*
r2
);
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
(
invR
-
2
.
0
f
*
cSim
.
reactionFieldK
*
r2
);
/* E */
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
j
].
q
*
(
invR
+
cSim
.
reactionFieldK
*
r2
-
cSim
.
reactionFieldC
);
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
j
].
q
*
(
invR
+
cSim
.
reactionFieldK
*
r2
-
cSim
.
reactionFieldC
);
#endif
#endif
#else
#else
float
factorX
=
apos
.
w
*
psA
[
j
].
q
*
invR
;
float
factorX
=
apos
.
w
*
psA
[
j
].
q
*
invR
;
dEdR
+=
factorX
;
dEdR
+=
factorX
;
/* E */
CDLJObcGbsa_energy
+=
factorX
;
CDLJObcGbsa_energy
+=
factorX
;
#endif
#endif
dEdR
*=
invR
*
invR
;
dEdR
*=
invR
*
invR
;
...
@@ -473,33 +457,17 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -473,33 +457,17 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
j
].
br
;
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
/* E */
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
j
].
q
)
/
denominator
;
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
j
].
q
)
/
denominator
;
// Sum the Born forces.
tempBuffer
[
threadIdx
.
x
]
=
dGpol_dalpha2_ij
*
br
;
if
(
tgx
%
2
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
1
];
if
(
tgx
%
4
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
2
];
if
(
tgx
%
8
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
4
];
if
(
tgx
%
16
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
8
];
if
(
tgx
==
0
)
psA
[
j
].
fb
+=
tempBuffer
[
threadIdx
.
x
]
+
tempBuffer
[
threadIdx
.
x
+
16
];
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
dGpol_dalpha2_ij
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
#endif
#endif
/* E */
if
(
i
<
cSim
.
atoms
)
if
(
i
<
cSim
.
atoms
)
{
{
energy
+=
CDLJObcGbsa_energy
;
energy
+=
CDLJObcGbsa_energy
;
...
@@ -511,6 +479,8 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -511,6 +479,8 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
af
.
x
-=
dx
;
af
.
x
-=
dx
;
af
.
y
-=
dy
;
af
.
y
-=
dy
;
af
.
z
-=
dz
;
af
.
z
-=
dz
;
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
j
].
br
;
tempBuffer
[
threadIdx
.
x
]
=
dx
;
tempBuffer
[
threadIdx
.
x
]
=
dx
;
if
(
tgx
%
2
==
0
)
if
(
tgx
%
2
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
1
];
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
1
];
...
@@ -522,6 +492,7 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -522,6 +492,7 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
8
];
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
8
];
if
(
tgx
==
0
)
if
(
tgx
==
0
)
psA
[
j
].
fx
+=
tempBuffer
[
threadIdx
.
x
]
+
tempBuffer
[
threadIdx
.
x
+
16
];
psA
[
j
].
fx
+=
tempBuffer
[
threadIdx
.
x
]
+
tempBuffer
[
threadIdx
.
x
+
16
];
tempBuffer
[
threadIdx
.
x
]
=
dy
;
tempBuffer
[
threadIdx
.
x
]
=
dy
;
if
(
tgx
%
2
==
0
)
if
(
tgx
%
2
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
1
];
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
1
];
...
@@ -533,6 +504,7 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -533,6 +504,7 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
8
];
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
8
];
if
(
tgx
==
0
)
if
(
tgx
==
0
)
psA
[
j
].
fy
+=
tempBuffer
[
threadIdx
.
x
]
+
tempBuffer
[
threadIdx
.
x
+
16
];
psA
[
j
].
fy
+=
tempBuffer
[
threadIdx
.
x
]
+
tempBuffer
[
threadIdx
.
x
+
16
];
tempBuffer
[
threadIdx
.
x
]
=
dz
;
tempBuffer
[
threadIdx
.
x
]
=
dz
;
if
(
tgx
%
2
==
0
)
if
(
tgx
%
2
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
1
];
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
1
];
...
@@ -544,6 +516,21 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -544,6 +516,21 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
8
];
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
8
];
if
(
tgx
==
0
)
if
(
tgx
==
0
)
psA
[
j
].
fz
+=
tempBuffer
[
threadIdx
.
x
]
+
tempBuffer
[
threadIdx
.
x
+
16
];
psA
[
j
].
fz
+=
tempBuffer
[
threadIdx
.
x
]
+
tempBuffer
[
threadIdx
.
x
+
16
];
// Sum the Born forces.
tempBuffer
[
threadIdx
.
x
]
=
dGpol_dalpha2_ij
*
br
;
if
(
tgx
%
2
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
1
];
if
(
tgx
%
4
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
2
];
if
(
tgx
%
8
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
4
];
if
(
tgx
%
16
==
0
)
tempBuffer
[
threadIdx
.
x
]
+=
tempBuffer
[
threadIdx
.
x
+
8
];
if
(
tgx
==
0
)
psA
[
j
].
fb
+=
tempBuffer
[
threadIdx
.
x
]
+
tempBuffer
[
threadIdx
.
x
+
16
];
}
}
}
}
}
}
...
@@ -576,7 +563,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -576,7 +563,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
sig6
=
sig2
*
sig2
*
sig2
;
float
sig6
=
sig2
*
sig2
*
sig2
;
float
eps
=
a
.
y
*
psA
[
tj
].
eps
;
float
eps
=
a
.
y
*
psA
[
tj
].
eps
;
float
dEdR
=
eps
*
(
12
.
0
f
*
sig6
-
6
.
0
f
)
*
sig6
;
float
dEdR
=
eps
*
(
12
.
0
f
*
sig6
-
6
.
0
f
)
*
sig6
;
/* E */
CDLJObcGbsa_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
CDLJObcGbsa_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
#ifdef USE_EWALD
#ifdef USE_EWALD
...
@@ -584,7 +570,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -584,7 +570,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
erfcAlphaR
=
fastErfc
(
alphaR
);
float
erfcAlphaR
=
fastErfc
(
alphaR
);
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
/* E */
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
erfcAlphaR
;
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
erfcAlphaR
;
bool
needCorrection
=
!
(
excl
&
0x1
)
&&
x
+
tgx
!=
y
+
tj
&&
x
+
tgx
<
cSim
.
atoms
&&
y
+
tj
<
cSim
.
atoms
;
bool
needCorrection
=
!
(
excl
&
0x1
)
&&
x
+
tgx
!=
y
+
tj
&&
x
+
tgx
<
cSim
.
atoms
&&
y
+
tj
<
cSim
.
atoms
;
if
(
needCorrection
)
if
(
needCorrection
)
...
@@ -596,13 +581,11 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -596,13 +581,11 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
}
}
#else
#else
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
(
invR
-
2
.
0
f
*
cSim
.
reactionFieldK
*
r2
);
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
(
invR
-
2
.
0
f
*
cSim
.
reactionFieldK
*
r2
);
/* E */
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
tj
].
q
*
(
invR
+
cSim
.
reactionFieldK
*
r2
-
cSim
.
reactionFieldC
);
CDLJObcGbsa_energy
+=
apos
.
w
*
psA
[
tj
].
q
*
(
invR
+
cSim
.
reactionFieldK
*
r2
-
cSim
.
reactionFieldC
);
#endif
#endif
#else
#else
float
factorX
=
apos
.
w
*
psA
[
tj
].
q
*
invR
;
float
factorX
=
apos
.
w
*
psA
[
tj
].
q
*
invR
;
dEdR
+=
factorX
;
dEdR
+=
factorX
;
/* E */
CDLJObcGbsa_energy
+=
factorX
;
CDLJObcGbsa_energy
+=
factorX
;
#endif
#endif
dEdR
*=
invR
*
invR
;
dEdR
*=
invR
*
invR
;
...
@@ -613,7 +596,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -613,7 +596,6 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
#endif
#endif
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
...
@@ -625,23 +607,20 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -625,23 +607,20 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
tj
].
q
)
/
(
denominator
*
denominator2
);
float
Gpol
=
(
q2
*
psA
[
tj
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
tj
].
br
;
psA
[
tj
].
fb
+=
dGpol_dalpha2_ij
*
br
;
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
/* E */
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
tj
].
q
)
/
denominator
;
CDLJObcGbsa_energy
+=
(
q2
*
psA
[
tj
].
q
)
/
denominator
;
#if defined USE_PERIODIC
#if defined USE_PERIODIC
if
(
i
>=
cSim
.
atoms
||
y
+
tj
>=
cSim
.
atoms
||
r2
>
cSim
.
nonbondedCutoffSqr
)
if
(
i
>=
cSim
.
atoms
||
y
+
tj
>=
cSim
.
atoms
||
r2
>
cSim
.
nonbondedCutoffSqr
)
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
dGpol_dalpha2_ij
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
#elif defined USE_CUTOFF
#elif defined USE_CUTOFF
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
if
(
r2
>
cSim
.
nonbondedCutoffSqr
)
{
{
dEdR
=
0
.
0
f
;
dEdR
=
0
.
0
f
;
/* E */
dGpol_dalpha2_ij
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
CDLJObcGbsa_energy
=
0
.
0
f
;
}
}
#endif
#endif
...
@@ -657,9 +636,11 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
...
@@ -657,9 +636,11 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit)
af
.
x
-=
dx
;
af
.
x
-=
dx
;
af
.
y
-=
dy
;
af
.
y
-=
dy
;
af
.
z
-=
dz
;
af
.
z
-=
dz
;
af
.
w
+=
dGpol_dalpha2_ij
*
psA
[
tj
].
br
;
psA
[
tj
].
fx
+=
dx
;
psA
[
tj
].
fx
+=
dx
;
psA
[
tj
].
fy
+=
dy
;
psA
[
tj
].
fy
+=
dy
;
psA
[
tj
].
fz
+=
dz
;
psA
[
tj
].
fz
+=
dz
;
psA
[
tj
].
fb
+=
dGpol_dalpha2_ij
*
br
;
excl
>>=
1
;
excl
>>=
1
;
tj
=
(
tj
+
1
)
&
(
GRID
-
1
);
tj
=
(
tj
+
1
)
&
(
GRID
-
1
);
}
}
...
...
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