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
470c9b7f
Commit
470c9b7f
authored
Jan 27, 2012
by
Mark Friedrichs
Browse files
Renamed math functions in Cuda kernels to single-precision equivalent [cos() -> cosf()]
parent
fed50628
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
195 additions
and
195 deletions
+195
-195
platforms/cuda/src/kernels/kBrownianUpdate.cu
platforms/cuda/src/kernels/kBrownianUpdate.cu
+1
-1
platforms/cuda/src/kernels/kCalculateAndersenThermostat.cu
platforms/cuda/src/kernels/kCalculateAndersenThermostat.cu
+2
-2
platforms/cuda/src/kernels/kCalculateCDLJEwaldFastReciprocal.h
...orms/cuda/src/kernels/kCalculateCDLJEwaldFastReciprocal.h
+6
-6
platforms/cuda/src/kernels/kCalculateCDLJEwaldReciprocal.h
platforms/cuda/src/kernels/kCalculateCDLJEwaldReciprocal.h
+4
-4
platforms/cuda/src/kernels/kCalculateCDLJForces.h
platforms/cuda/src/kernels/kCalculateCDLJForces.h
+26
-26
platforms/cuda/src/kernels/kCalculateCDLJObcGbsaForces1.h
platforms/cuda/src/kernels/kCalculateCDLJObcGbsaForces1.h
+30
-30
platforms/cuda/src/kernels/kCalculateCMAPTorsionForces.cu
platforms/cuda/src/kernels/kCalculateCMAPTorsionForces.cu
+5
-5
platforms/cuda/src/kernels/kCalculateCustomAngleForces.cu
platforms/cuda/src/kernels/kCalculateCustomAngleForces.cu
+3
-3
platforms/cuda/src/kernels/kCalculateCustomBondForces.cu
platforms/cuda/src/kernels/kCalculateCustomBondForces.cu
+1
-1
platforms/cuda/src/kernels/kCalculateCustomNonbondedForces.h
platforms/cuda/src/kernels/kCalculateCustomNonbondedForces.h
+16
-16
platforms/cuda/src/kernels/kCalculateCustomTorsionForces.cu
platforms/cuda/src/kernels/kCalculateCustomTorsionForces.cu
+4
-4
platforms/cuda/src/kernels/kCalculateGBVIBornSum.cu
platforms/cuda/src/kernels/kCalculateGBVIBornSum.cu
+2
-2
platforms/cuda/src/kernels/kCalculateGBVIBornSum.h
platforms/cuda/src/kernels/kCalculateGBVIBornSum.h
+12
-12
platforms/cuda/src/kernels/kCalculateGBVIForces2.h
platforms/cuda/src/kernels/kCalculateGBVIForces2.h
+12
-12
platforms/cuda/src/kernels/kCalculateLocalForces.cu
platforms/cuda/src/kernels/kCalculateLocalForces.cu
+15
-15
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.h
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.h
+17
-17
platforms/cuda/src/kernels/kCalculateObcGbsaForces2.h
platforms/cuda/src/kernels/kCalculateObcGbsaForces2.h
+17
-17
platforms/cuda/src/kernels/kCalculatePME.cu
platforms/cuda/src/kernels/kCalculatePME.cu
+9
-9
platforms/cuda/src/kernels/kFindInteractingBlocks.h
platforms/cuda/src/kernels/kFindInteractingBlocks.h
+12
-12
platforms/cuda/src/kernels/kForces.cu
platforms/cuda/src/kernels/kForces.cu
+1
-1
No files found.
platforms/cuda/src/kernels/kBrownianUpdate.cu
View file @
470c9b7f
...
...
@@ -72,7 +72,7 @@ void kBrownianUpdatePart1_kernel()
float4
force
=
cSim
.
pForce4
[
pos
];
float
invMass
=
cSim
.
pVelm4
[
pos
].
w
;
float
forceScale
=
cSim
.
tauDeltaT
*
invMass
;
float
noiseScale
=
cSim
.
noiseAmplitude
*
sqrt
(
invMass
);
float
noiseScale
=
cSim
.
noiseAmplitude
*
sqrt
f
(
invMass
);
cSim
.
pOldPosq
[
pos
]
=
apos
;
apos
.
x
=
force
.
x
*
forceScale
+
noiseScale
*
random4a
.
x
;
...
...
platforms/cuda/src/kernels/kCalculateAndersenThermostat.cu
View file @
470c9b7f
...
...
@@ -58,14 +58,14 @@ __global__ void kCalculateAndersenThermostat_kernel(int* atomGroups)
__syncthreads
();
float
collisionProbability
=
1.0
f
-
exp
(
-
cSim
.
collisionFrequency
*
cSim
.
pStepSize
[
0
].
y
);
float
randomRange
=
erf
(
collisionProbability
/
sqrt
(
2.0
f
));
float
randomRange
=
erf
(
collisionProbability
/
sqrt
f
(
2.0
f
));
while
(
pos
<
cSim
.
atoms
)
{
float4
velocity
=
cSim
.
pVelm4
[
pos
];
float4
selectRand
=
cSim
.
pRandom4
[
rpos
+
atomGroups
[
pos
]];
float4
velRand
=
cSim
.
pRandom4
[
rpos
+
pos
];
float
scale
=
(
selectRand
.
w
>
-
randomRange
&&
selectRand
.
w
<
randomRange
?
0.0
f
:
1.0
f
);
float
add
=
(
1.0
f
-
scale
)
*
sqrt
(
cSim
.
kT
*
velocity
.
w
);
float
add
=
(
1.0
f
-
scale
)
*
sqrt
f
(
cSim
.
kT
*
velocity
.
w
);
velocity
.
x
=
scale
*
velocity
.
x
+
add
*
velRand
.
x
;
velocity
.
y
=
scale
*
velocity
.
y
+
add
*
velRand
.
y
;
velocity
.
z
=
scale
*
velocity
.
z
+
add
*
velRand
.
z
;
...
...
platforms/cuda/src/kernels/kCalculateCDLJEwaldFastReciprocal.h
View file @
470c9b7f
...
...
@@ -83,11 +83,11 @@ __global__ void kCalculateEwaldFastCosSinSums_kernel()
{
float4
apos
=
cSim
.
pPosq
[
atom
];
float
phase
=
apos
.
x
*
kx
;
float2
structureFactor
=
make_float2
(
cos
(
phase
),
sin
(
phase
));
float2
structureFactor
=
make_float2
(
cos
f
(
phase
),
sin
f
(
phase
));
phase
=
apos
.
y
*
ky
;
structureFactor
=
MultofFloat2
(
structureFactor
,
make_float2
(
cos
(
phase
),
sin
(
phase
)));
structureFactor
=
MultofFloat2
(
structureFactor
,
make_float2
(
cos
f
(
phase
),
sin
f
(
phase
)));
phase
=
apos
.
z
*
kz
;
structureFactor
=
MultofFloat2
(
structureFactor
,
make_float2
(
cos
(
phase
),
sin
(
phase
)));
structureFactor
=
MultofFloat2
(
structureFactor
,
make_float2
(
cos
f
(
phase
),
sin
f
(
phase
)));
sum
.
x
+=
apos
.
w
*
structureFactor
.
x
;
sum
.
y
+=
apos
.
w
*
structureFactor
.
y
;
}
...
...
@@ -129,9 +129,9 @@ __global__ void kCalculateEwaldFastForces_kernel()
for
(
int
ry
=
lowry
;
ry
<
cSim
.
kmaxY
;
ry
++
)
{
float
ky
=
ry
*
cSim
.
recipBoxSizeY
;
float
phase
=
apos
.
x
*
kx
;
float2
tab_xy
=
make_float2
(
cos
(
phase
),
sin
(
phase
));
float2
tab_xy
=
make_float2
(
cos
f
(
phase
),
sin
f
(
phase
));
phase
=
apos
.
y
*
ky
;
tab_xy
=
MultofFloat2
(
tab_xy
,
make_float2
(
cos
(
phase
),
sin
(
phase
)));
tab_xy
=
MultofFloat2
(
tab_xy
,
make_float2
(
cos
f
(
phase
),
sin
f
(
phase
)));
for
(
int
rz
=
lowrz
;
rz
<
cSim
.
kmaxZ
;
rz
++
)
{
float
kz
=
rz
*
cSim
.
recipBoxSizeZ
;
...
...
@@ -141,7 +141,7 @@ __global__ void kCalculateEwaldFastForces_kernel()
float
k2
=
kx
*
kx
+
ky
*
ky
+
kz
*
kz
;
float
ak
=
exp
(
k2
*
cSim
.
factorEwald
)
/
k2
;
phase
=
apos
.
z
*
kz
;
float2
structureFactor
=
MultofFloat2
(
tab_xy
,
make_float2
(
cos
(
phase
),
sin
(
phase
)));
float2
structureFactor
=
MultofFloat2
(
tab_xy
,
make_float2
(
cos
f
(
phase
),
sin
f
(
phase
)));
float2
cosSinSum
=
cSim
.
pEwaldCosSinSum
[
index
];
float
dEdR
=
ak
*
apos
.
w
*
(
cosSinSum
.
x
*
structureFactor
.
y
-
cosSinSum
.
y
*
structureFactor
.
x
);
force
.
x
+=
2
*
recipCoeff
*
dEdR
*
kx
;
...
...
platforms/cuda/src/kernels/kCalculateCDLJEwaldReciprocal.h
View file @
470c9b7f
...
...
@@ -63,10 +63,10 @@ __global__ void kCalculateCDLJEwaldReciprocalForces_kernel()
float
arg1
=
kx
*
apos1
.
x
+
ky
*
apos1
.
y
+
kz
*
apos1
.
z
;
float
arg2
=
kx
*
apos2
.
x
+
ky
*
apos2
.
y
+
kz
*
apos2
.
z
;
float
sinI
=
sin
(
arg1
);
float
sinJ
=
sin
(
arg2
);
float
cosI
=
cos
(
arg1
);
float
cosJ
=
cos
(
arg2
);
float
sinI
=
sin
f
(
arg1
);
float
sinJ
=
sin
f
(
arg2
);
float
cosI
=
cos
f
(
arg1
);
float
cosJ
=
cos
f
(
arg2
);
float
f
=
scale
*
ek
*
(
-
sinI
*
cosJ
+
cosI
*
sinJ
)
/
k2
;
af
.
x
-=
kx
*
f
;
...
...
platforms/cuda/src/kernels/kCalculateCDLJForces.h
View file @
470c9b7f
...
...
@@ -56,7 +56,7 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
#endif
#ifdef USE_EWALD
const
float
TWO_OVER_SQRT_PI
=
2
.
0
f
/
sqrt
(
LOCAL_HACK_PI
);
const
float
TWO_OVER_SQRT_PI
=
2
.
0
f
/
sqrt
f
(
LOCAL_HACK_PI
);
#endif
unsigned
int
lasty
=
0xFFFFFFFF
;
...
...
@@ -108,12 +108,12 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
dy
=
psA
[
j
].
y
-
apos
.
y
;
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
invR
=
1
.
0
f
/
sqrt
(
r2
);
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
sig
=
a
.
x
+
psA
[
j
].
sig
;
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -124,7 +124,7 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
CDLJ_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_EWALD
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
erfcAlphaR
=
fastErfc
(
alphaR
);
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
...
...
@@ -170,12 +170,12 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
dy
=
psA
[
j
].
y
-
apos
.
y
;
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
invR
=
1
.
0
f
/
sqrt
(
r2
);
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
sig
=
a
.
x
+
psA
[
j
].
sig
;
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -186,7 +186,7 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
CDLJ_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_EWALD
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
erfcAlphaR
=
fastErfc
(
alphaR
);
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
...
...
@@ -287,12 +287,12 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
dy
=
psA
[
tj
].
y
-
apos
.
y
;
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
invR
=
1
.
0
f
/
sqrt
(
r2
);
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
sig
=
a
.
x
+
psA
[
tj
].
sig
;
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -303,7 +303,7 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
CDLJ_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_EWALD
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
erfcAlphaR
=
fastErfc
(
alphaR
);
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
...
...
@@ -355,12 +355,12 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
dy
=
psA
[
j
].
y
-
apos
.
y
;
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
invR
=
1
.
0
f
/
sqrt
(
r2
);
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
sig
=
a
.
x
+
psA
[
j
].
sig
;
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -371,7 +371,7 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
CDLJ_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_EWALD
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
erfcAlphaR
=
fastErfc
(
alphaR
);
dEdR
+=
apos
.
w
*
psA
[
j
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
...
...
@@ -458,12 +458,12 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
dy
=
psA
[
tj
].
y
-
apos
.
y
;
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
invR
=
1
.
0
f
/
sqrt
(
r2
);
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
sig
=
a
.
x
+
psA
[
tj
].
sig
;
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -474,7 +474,7 @@ void METHOD_NAME(kCalculateCDLJ, Forces_kernel)(unsigned int* workUnit)
CDLJ_energy
=
eps
*
(
sig6
-
1
.
0
f
)
*
sig6
;
#ifdef USE_CUTOFF
#ifdef USE_EWALD
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
float
alphaR
=
cSim
.
alphaEwald
*
r
;
float
erfcAlphaR
=
fastErfc
(
alphaR
);
dEdR
+=
apos
.
w
*
psA
[
tj
].
q
*
invR
*
(
erfcAlphaR
+
alphaR
*
exp
(
-
alphaR
*
alphaR
)
*
TWO_OVER_SQRT_PI
);
...
...
platforms/cuda/src/kernels/kCalculateCDLJObcGbsaForces1.h
View file @
470c9b7f
...
...
@@ -94,14 +94,14 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
// CDLJ part
float
invR
=
1
.
0
f
/
sqrt
(
r2
);
float
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
float
sig
=
a
.
x
+
psA
[
j
].
sig
;
float
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -123,9 +123,9 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
// ObcGbsaForce1 part
float
alpha2_ij
=
br
*
psA
[
j
].
br
;
float
D_ij
=
r2
/
(
4
.
0
f
*
alpha2_ij
);
float
expTerm
=
exp
(
-
D_ij
);
float
expTerm
=
exp
f
(
-
D_ij
);
float
denominator2
=
r2
+
alpha2_ij
*
expTerm
;
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
f
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
...
...
@@ -164,14 +164,14 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
// CDLJ part
float
invR
=
1
.
0
f
/
sqrt
(
r2
);
float
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
float
sig
=
a
.
x
+
psA
[
j
].
sig
;
float
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -198,9 +198,9 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
// ObcGbsaForce1 part
float
alpha2_ij
=
br
*
psA
[
j
].
br
;
float
D_ij
=
r2
/
(
4
.
0
f
*
alpha2_ij
);
float
expTerm
=
exp
(
-
D_ij
);
float
expTerm
=
exp
f
(
-
D_ij
);
float
denominator2
=
r2
+
alpha2_ij
*
expTerm
;
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
f
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
...
...
@@ -283,14 +283,14 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
float
dy
=
psA
[
tj
].
y
-
apos
.
y
;
float
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
// CDLJ part
float
invR
=
1
.
0
f
/
sqrt
(
r2
);
float
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
float
sig
=
a
.
x
+
psA
[
tj
].
sig
;
float
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -312,9 +312,9 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
// ObcGbsaForce1 part
float
alpha2_ij
=
br
*
psA
[
tj
].
br
;
float
D_ij
=
r2
/
(
4
.
0
f
*
alpha2_ij
);
float
expTerm
=
exp
(
-
D_ij
);
float
expTerm
=
exp
f
(
-
D_ij
);
float
denominator2
=
r2
+
alpha2_ij
*
expTerm
;
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
f
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
tj
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
...
...
@@ -362,14 +362,14 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
// CDLJ part
float
invR
=
1
.
0
f
/
sqrt
(
r2
);
float
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
float
sig
=
a
.
x
+
psA
[
j
].
sig
;
float
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -391,9 +391,9 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
// ObcGbsaForce1 part
float
alpha2_ij
=
br
*
psA
[
j
].
br
;
float
D_ij
=
r2
/
(
4
.
0
f
*
alpha2_ij
);
float
expTerm
=
exp
(
-
D_ij
);
float
expTerm
=
exp
f
(
-
D_ij
);
float
denominator2
=
r2
+
alpha2_ij
*
expTerm
;
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
f
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
j
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
...
...
@@ -486,14 +486,14 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
float
dy
=
psA
[
tj
].
y
-
apos
.
y
;
float
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
// CDLJ part
float
invR
=
1
.
0
f
/
sqrt
(
r2
);
float
invR
=
1
.
0
f
/
sqrt
f
(
r2
);
float
sig
=
a
.
x
+
psA
[
tj
].
sig
;
float
sig2
=
invR
*
sig
;
sig2
*=
sig2
;
...
...
@@ -519,9 +519,9 @@ void METHOD_NAME(kCalculateCDLJObcGbsa, Forces1_kernel)(unsigned int* workUnit )
// ObcGbsaForce1 part
float
alpha2_ij
=
br
*
psA
[
tj
].
br
;
float
D_ij
=
r2
/
(
4
.
0
f
*
alpha2_ij
);
float
expTerm
=
exp
(
-
D_ij
);
float
expTerm
=
exp
f
(
-
D_ij
);
float
denominator2
=
r2
+
alpha2_ij
*
expTerm
;
float
denominator
=
sqrt
(
denominator2
);
float
denominator
=
sqrt
f
(
denominator2
);
float
Gpol
=
(
q2
*
psA
[
tj
].
q
)
/
(
denominator
*
denominator2
);
float
dGpol_dalpha2_ij
=
-
0
.
5
f
*
Gpol
*
expTerm
*
(
1
.
0
f
+
D_ij
);
dEdR
+=
Gpol
*
(
1
.
0
f
-
0
.
25
f
*
expTerm
);
...
...
platforms/cuda/src/kernels/kCalculateCMAPTorsionForces.cu
View file @
470c9b7f
...
...
@@ -48,7 +48,7 @@ using namespace std;
dp = DOT3(v1, v2); \
float norm1 = DOT3(v1, v1); \
float norm2 = DOT3(v2, v2); \
dp /= sqrt(norm1 * norm2); \
dp /= sqrt
f
(norm1 * norm2); \
dp = min(dp, 1.0f); \
dp = max(dp, -1.0f); \
}
...
...
@@ -60,12 +60,12 @@ using namespace std;
if (dp > 0.99f || dp < -0.99f) { \
float3 cross = CROSS_PRODUCT(v1, v2); \
float scale = DOT3(v1, v1)*DOT3(v2, v2); \
angle = asin(sqrt(DOT3(cross, cross)/scale)); \
angle = asin
f
(sqrt
f
(DOT3(cross, cross)/scale)); \
if (dp < 0.0f) \
angle = LOCAL_HACK_PI-angle; \
} \
else { \
angle = acos(dp); \
angle = acos
f
(dp); \
} \
}
...
...
@@ -166,7 +166,7 @@ void kCalculateCMAPTorsionForces_kernel(int numAtoms, int numTorsions, float4* f
float
normCross1
=
DOT3
(
cp0a
,
cp0a
);
float
normSqrBC
=
DOT3
(
v1a
,
v1a
);
float
normBC
=
sqrt
(
normSqrBC
);
float
normBC
=
sqrt
f
(
normSqrBC
);
float
normCross2
=
DOT3
(
cp1a
,
cp1a
);
float
dp
=
1.0
f
/
normSqrBC
;
float4
ff
=
make_float4
((
-
dEdA
*
normBC
)
/
normCross1
,
DOT3
(
v0a
,
v1a
)
*
dp
,
DOT3
(
v2a
,
v1a
)
*
dp
,
(
dEdA
*
normBC
)
/
normCross2
);
...
...
@@ -204,7 +204,7 @@ void kCalculateCMAPTorsionForces_kernel(int numAtoms, int numTorsions, float4* f
normCross1
=
DOT3
(
cp0b
,
cp0b
);
normSqrBC
=
DOT3
(
v1b
,
v1b
);
normBC
=
sqrt
(
normSqrBC
);
normBC
=
sqrt
f
(
normSqrBC
);
normCross2
=
DOT3
(
cp1b
,
cp1b
);
dp
=
1.0
f
/
normSqrBC
;
ff
=
make_float4
((
-
dEdB
*
normBC
)
/
normCross1
,
DOT3
(
v0b
,
v1b
)
*
dp
,
DOT3
(
v2b
,
v1b
)
*
dp
,
(
dEdB
*
normBC
)
/
normCross2
);
...
...
platforms/cuda/src/kernels/kCalculateCustomAngleForces.cu
View file @
470c9b7f
...
...
@@ -108,12 +108,12 @@ void kCalculateCustomAngleForces_kernel()
float3
v1
=
make_float3
(
a2
.
x
-
a3
.
x
,
a2
.
y
-
a3
.
y
,
a2
.
z
-
a3
.
z
);
float3
cp
=
CROSS_PRODUCT
(
v0
,
v1
);
float
rp
=
DOT3
(
cp
,
cp
);
rp
=
max
(
sqrt
(
rp
),
1.0e-06
f
);
rp
=
max
(
sqrt
f
(
rp
),
1.0e-06
f
);
float
r21
=
DOT3
(
v0
,
v0
);
float
r23
=
DOT3
(
v1
,
v1
);
float
dot
=
DOT3
(
v0
,
v1
);
float
cosine
=
max
(
-
1.0
f
,
min
(
1.0
f
,
dot
/
sqrt
(
r21
*
r23
)));
VARIABLE
(
0
)
=
acos
(
cosine
);
float
cosine
=
max
(
-
1.0
f
,
min
(
1.0
f
,
dot
/
sqrt
f
(
r21
*
r23
)));
VARIABLE
(
0
)
=
acos
f
(
cosine
);
VARIABLE
(
1
)
=
params
.
x
;
VARIABLE
(
2
)
=
params
.
y
;
VARIABLE
(
3
)
=
params
.
z
;
...
...
platforms/cuda/src/kernels/kCalculateCustomBondForces.cu
View file @
470c9b7f
...
...
@@ -102,7 +102,7 @@ void kCalculateCustomBondForces_kernel()
float
dx
=
a1
.
x
-
a2
.
x
;
float
dy
=
a1
.
y
-
a2
.
y
;
float
dz
=
a1
.
z
-
a2
.
z
;
float
r
=
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
r
=
sqrt
f
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
invR
=
1.0
f
/
r
;
VARIABLE
(
0
)
=
r
;
VARIABLE
(
1
)
=
params
.
x
;
...
...
platforms/cuda/src/kernels/kCalculateCustomNonbondedForces.h
View file @
470c9b7f
...
...
@@ -97,11 +97,11 @@ __global__ void METHOD_NAME(kCalculateCustomNonbonded, Forces_kernel)(unsigned i
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r
=
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
r
=
sqrt
f
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
invR
=
1
.
0
f
/
r
;
VARIABLE
(
8
)
=
r
;
float
dEdR
=
-
kEvaluateExpression_kernel
(
&
forceExp
,
stack
,
variables
)
*
invR
;
...
...
@@ -188,11 +188,11 @@ __global__ void METHOD_NAME(kCalculateCustomNonbonded, Forces_kernel)(unsigned i
float
dy
=
psA
[
tj
].
y
-
apos
.
y
;
float
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r
=
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
r
=
sqrt
f
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
invR
=
1
.
0
f
/
r
;
VARIABLE
(
8
)
=
r
;
float
dEdR
=
-
kEvaluateExpression_kernel
(
&
forceExp
,
stack
,
variables
)
*
invR
;
...
...
@@ -243,11 +243,11 @@ __global__ void METHOD_NAME(kCalculateCustomNonbonded, Forces_kernel)(unsigned i
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r
=
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
r
=
sqrt
f
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
invR
=
1
.
0
f
/
r
;
VARIABLE
(
8
)
=
r
;
float
dEdR
=
-
kEvaluateExpression_kernel
(
&
forceExp
,
stack
,
variables
)
*
invR
;
...
...
@@ -334,11 +334,11 @@ __global__ void METHOD_NAME(kCalculateCustomNonbonded, Forces_kernel)(unsigned i
float
dy
=
psA
[
tj
].
y
-
apos
.
y
;
float
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r
=
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
r
=
sqrt
f
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
float
invR
=
1
.
0
f
/
r
;
VARIABLE
(
8
)
=
r
;
float
dEdR
=
-
kEvaluateExpression_kernel
(
&
forceExp
,
stack
,
variables
)
*
invR
;
...
...
platforms/cuda/src/kernels/kCalculateCustomTorsionForces.cu
View file @
470c9b7f
...
...
@@ -88,7 +88,7 @@ void SetCustomTorsionGlobalParams(const vector<float>& paramValues)
dp = DOT3(v1, v2); \
float norm1 = DOT3(v1, v1); \
float norm2 = DOT3(v2, v2); \
dp /= sqrt(norm1 * norm2); \
dp /= sqrt
f
(norm1 * norm2); \
dp = min(dp, 1.0f); \
dp = max(dp, -1.0f); \
}
...
...
@@ -100,12 +100,12 @@ void SetCustomTorsionGlobalParams(const vector<float>& paramValues)
if (dp > 0.99f || dp < -0.99f) { \
float3 cross = CROSS_PRODUCT(v1, v2); \
float scale = DOT3(v1, v1)*DOT3(v2, v2); \
angle = asin(sqrt(DOT3(cross, cross)/scale)); \
angle = asin
f
(sqrt
f
(DOT3(cross, cross)/scale)); \
if (dp < 0.0f) \
angle = LOCAL_HACK_PI-angle; \
} \
else { \
angle = acos(dp); \
angle = acos
f
(dp); \
} \
}
...
...
@@ -155,7 +155,7 @@ void kCalculateCustomTorsionForces_kernel()
VARIABLE
(
4
)
=
params
.
w
;
float
dEdAngle
=
kEvaluateExpression_kernel
(
&
forceExp
,
stack
,
variables
);
totalEnergy
+=
kEvaluateExpression_kernel
(
&
energyExp
,
stack
,
variables
);
float
normBC
=
sqrt
(
DOT3
(
v1
,
v1
));
float
normBC
=
sqrt
f
(
DOT3
(
v1
,
v1
));
float
dp
=
1.0
f
/
DOT3
(
v1
,
v1
);
float4
ff
=
make_float4
((
-
dEdAngle
*
normBC
)
/
DOT3
(
cp0
,
cp0
),
DOT3
(
v0
,
v1
)
*
dp
,
DOT3
(
v2
,
v1
)
*
dp
,
(
dEdAngle
*
normBC
)
/
DOT3
(
cp1
,
cp1
));
float3
internalF0
=
make_float3
(
ff
.
x
*
cp0
.
x
,
ff
.
x
*
cp0
.
y
,
ff
.
x
*
cp0
.
z
);
...
...
platforms/cuda/src/kernels/kCalculateGBVIBornSum.cu
View file @
470c9b7f
...
...
@@ -195,7 +195,7 @@ __device__ void computeBornRadiiUsingQuinticSpline( float atomicRadius3, float b
sum
=
atomicRadius3
-
bornSum
;
*
switchDeriviative
=
one
;
}
*
bornRadius
=
pow
(
sum
,
minusOneThird
);
*
bornRadius
=
pow
f
(
sum
,
minusOneThird
);
}
__global__
void
kReduceGBVIBornSum_kernel
()
...
...
@@ -221,7 +221,7 @@ __global__ void kReduceGBVIBornSum_kernel()
Rinv
=
Rinv
*
Rinv
*
Rinv
;
if
(
cSim
.
gbviBornRadiusScalingMethod
==
0
){
sum
=
Rinv
-
sum
;
cSim
.
pBornRadii
[
pos
]
=
pow
(
sum
,
(
-
1.0
f
/
3.0
f
)
);
cSim
.
pBornRadii
[
pos
]
=
pow
f
(
sum
,
(
-
1.0
f
/
3.0
f
)
);
cSim
.
pGBVISwitchDerivative
[
pos
]
=
1.0
f
;
}
else
{
float
bornRadius
;
...
...
platforms/cuda/src/kernels/kCalculateGBVIBornSum.h
View file @
470c9b7f
...
...
@@ -98,9 +98,9 @@ void METHOD_NAME(kCalculateGBVI, BornSum_kernel)(unsigned int* workUnit)
dy
=
psA
[
j
].
y
-
apos
.
y
;
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
#if defined USE_CUTOFF
...
...
@@ -109,7 +109,7 @@ void METHOD_NAME(kCalculateGBVI, BornSum_kernel)(unsigned int* workUnit)
if
(
i
<
cSim
.
atoms
&&
x
+
j
<
cSim
.
atoms
&&
j
!=
tgx
)
#endif
{
r
=
sqrt
(
r2
);
r
=
sqrt
f
(
r2
);
apos
.
w
+=
getGBVI_Volume
(
r
,
ar
.
x
,
psA
[
j
].
sr
);
}
}
...
...
@@ -161,9 +161,9 @@ void METHOD_NAME(kCalculateGBVI, BornSum_kernel)(unsigned int* workUnit)
dy
=
psA
[
tj
].
y
-
apos
.
y
;
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
#ifdef USE_CUTOFF
...
...
@@ -173,7 +173,7 @@ void METHOD_NAME(kCalculateGBVI, BornSum_kernel)(unsigned int* workUnit)
#endif
{
r
=
sqrt
(
r2
);
r
=
sqrt
f
(
r2
);
apos
.
w
+=
getGBVI_Volume
(
r
,
ar
.
x
,
psA
[
tj
].
sr
);
psA
[
tj
].
sum
+=
getGBVI_Volume
(
r
,
psA
[
tj
].
r
,
ar
.
y
);
}
...
...
@@ -194,9 +194,9 @@ void METHOD_NAME(kCalculateGBVI, BornSum_kernel)(unsigned int* workUnit)
dy
=
psA
[
j
].
y
-
apos
.
y
;
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
#ifdef USE_CUTOFF
...
...
@@ -205,7 +205,7 @@ void METHOD_NAME(kCalculateGBVI, BornSum_kernel)(unsigned int* workUnit)
if
(
i
<
cSim
.
atoms
&&
y
+
j
<
cSim
.
atoms
)
#endif
{
r
=
sqrt
(
r2
);
r
=
sqrt
f
(
r2
);
apos
.
w
+=
getGBVI_Volume
(
r
,
ar
.
x
,
psA
[
j
].
sr
);
tempBuffer
[
threadIdx
.
x
]
=
getGBVI_Volume
(
r
,
psA
[
j
].
r
,
ar
.
y
);
}
...
...
platforms/cuda/src/kernels/kCalculateGBVIForces2.h
View file @
470c9b7f
...
...
@@ -94,12 +94,12 @@ METHOD_NAME(kCalculateGBVI, Forces2_kernel)(unsigned int* workUnit )
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
// Atom I Born forces and sum
float
dE
=
getGBVI_dE2
(
r
,
ar
.
x
,
psA
[
j
].
sr
,
fb
);
...
...
@@ -171,12 +171,12 @@ METHOD_NAME(kCalculateGBVI, Forces2_kernel)(unsigned int* workUnit )
float
dy
=
psA
[
tj
].
y
-
apos
.
y
;
float
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
float
dE
=
getGBVI_dE2
(
r
,
ar
.
x
,
psA
[
tj
].
sr
,
fb
);
...
...
@@ -236,12 +236,12 @@ METHOD_NAME(kCalculateGBVI, Forces2_kernel)(unsigned int* workUnit )
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
// Interleaved Atom I and J Born Forces and sum components
float
dE
=
getGBVI_dE2
(
r
,
ar
.
x
,
psA
[
j
].
sr
,
fb
);
...
...
platforms/cuda/src/kernels/kCalculateLocalForces.cu
View file @
470c9b7f
...
...
@@ -48,7 +48,7 @@ static __constant__ cudaGmxSimulation cSim;
dp
=
DOT3
(
v1
,
v2
);
\
float
norm1
=
DOT3
(
v1
,
v1
);
\
float
norm2
=
DOT3
(
v2
,
v2
);
\
dp
/=
sqrt
(
norm1
*
norm2
);
\
dp
/=
sqrt
f
(
norm1
*
norm2
);
\
dp
=
min
(
dp
,
1.0
f
);
\
dp
=
max
(
dp
,
-
1.0
f
);
\
}
...
...
@@ -60,14 +60,14 @@ static __constant__ cudaGmxSimulation cSim;
#define GETPREFACTORSGIVENANGLECOSINE(cosine, param, dEdR) \
{
\
float
angle
=
acos
(
cosine
);
\
float
angle
=
acos
f
(
cosine
);
\
float
deltaIdeal
=
angle
-
(
param
.
x
*
(
LOCAL_HACK_PI
/
180.0
f
));
\
dEdR
=
param
.
y
*
deltaIdeal
;
\
}
#define GETENERGYGIVENANGLECOSINE(cosine, param, dEdR) \
{
\
float
angle
=
acos
(
cosine
);
\
float
angle
=
acos
f
(
cosine
);
\
float
deltaIdeal
=
angle
-
(
param
.
x
*
(
LOCAL_HACK_PI
/
180.0
f
));
\
dEdR
=
param
.
y
*
deltaIdeal
*
deltaIdeal
;
\
}
...
...
@@ -80,12 +80,12 @@ static __constant__ cudaGmxSimulation cSim;
float4
cross
;
\
CROSS_PRODUCT
(
v1
,
v2
,
cross
);
\
float
scale
=
DOT3
(
v1
,
v1
)
*
DOT3
(
v2
,
v2
);
\
angle
=
asin
(
sqrt
(
DOT3
(
cross
,
cross
)
/
scale
));
\
angle
=
asin
f
(
sqrt
f
(
DOT3
(
cross
,
cross
)
/
scale
));
\
if
(
dp
<
0.0
f
)
\
angle
=
LOCAL_HACK_PI
-
angle
;
\
}
\
else
{
\
angle
=
acos
(
dp
);
\
angle
=
acos
f
(
dp
);
\
}
\
}
...
...
@@ -105,7 +105,7 @@ static __constant__ cudaGmxSimulation cSim;
GETANGLEBETWEENTWOVECTORS
(
cp0
,
cp1
,
angle
);
\
float
dp
=
DOT3
(
signVector
,
cp1
);
\
angle
=
(
dp
>=
0
)
?
angle
:
-
angle
;
\
cosine
=
cos
(
angle
);
\
cosine
=
cos
f
(
angle
);
\
}
void
SetCalculateLocalForcesSim
(
gpuContext
gpu
)
...
...
@@ -150,7 +150,7 @@ void kCalculateLocalForces_kernel()
float
dy
=
atomB
.
y
-
atomA
.
y
;
float
dz
=
atomB
.
z
-
atomA
.
z
;
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
float
deltaIdeal
=
r
-
bond
.
x
;
/* E */
energy
+=
0.5
f
*
bond
.
y
*
deltaIdeal
*
deltaIdeal
;
float
dEdR
=
bond
.
y
*
deltaIdeal
;
...
...
@@ -194,11 +194,11 @@ void kCalculateLocalForces_kernel()
float3
cp
;
CROSS_PRODUCT
(
A
->
v0
,
A
->
v1
,
cp
);
float
rp
=
DOT3
(
cp
,
cp
);
//cx * cx + cy * cy + cz * cz;
rp
=
max
(
sqrt
(
rp
),
1.0e-06
f
);
rp
=
max
(
sqrt
f
(
rp
),
1.0e-06
f
);
float
r21
=
DOT3
(
A
->
v0
,
A
->
v0
);
// dx1 * dx1 + dy1 * dy1 + dz1 * dz1;
float
r23
=
DOT3
(
A
->
v1
,
A
->
v1
);
// dx2 * dx2 + dy2 * dy2 + dz2 * dz2;
float
dot
=
DOT3
(
A
->
v0
,
A
->
v1
);
// dx1 * dx2 + dy1 * dy2 + dz1 * dz2;
float
cosine
=
max
(
-
1.0
f
,
min
(
1.0
f
,
dot
/
sqrt
(
r21
*
r23
)));
float
cosine
=
max
(
-
1.0
f
,
min
(
1.0
f
,
dot
/
sqrt
f
(
r21
*
r23
)));
float
angle_energy
;
/* E */
GETENERGYGIVENANGLECOSINE
(
cosine
,
bond_angle
,
angle_energy
);
...
...
@@ -270,7 +270,7 @@ void kCalculateLocalForces_kernel()
// ATTENTION: This section leads to a divergent deltaAngle values wrt
// forces and energies. We separate the case dihedral.z = n = 0, which
// is treated by the calculation of energies via a harmonic potential
/* E */
if
(
dihedral
.
z
)
energy
+=
dihedral
.
x
*
(
1.0
f
+
cos
(
deltaAngle
));
/* E */
if
(
dihedral
.
z
)
energy
+=
dihedral
.
x
*
(
1.0
f
+
cos
f
(
deltaAngle
));
/* E */
else
{
float
deltaAngle
=
dihedralAngle
-
dihedral
.
y
;
...
...
@@ -279,10 +279,10 @@ void kCalculateLocalForces_kernel()
energy
+=
dihedral
.
x
*
deltaAngle
*
deltaAngle
;
}
float
sinDeltaAngle
=
sin
(
deltaAngle
);
float
sinDeltaAngle
=
sin
f
(
deltaAngle
);
float
dEdAngle
=
-
dihedral
.
x
*
dihedral
.
z
*
sinDeltaAngle
;
float
normCross1
=
DOT3
(
cp0
,
cp0
);
float
normBC
=
sqrt
(
DOT3
(
A
->
v1
,
A
->
v1
));
float
normBC
=
sqrt
f
(
DOT3
(
A
->
v1
,
A
->
v1
));
float4
ff
;
ff
.
x
=
(
-
dEdAngle
*
normBC
)
/
normCross1
;
float
normCross2
=
DOT3
(
cp1
,
cp1
);
...
...
@@ -400,11 +400,11 @@ void kCalculateLocalForces_kernel()
rb_energy
+=
dihedral2
.
y
*
cosFactor
*
cosPhi
;
/* E */
energy
+=
rb_energy
;
// printf("%4d - 5: %9.4f %9.4f\n", pos1, dEdAngle, cosFactor);
dEdAngle
*=
sin
(
dihedralAngle
);
dEdAngle
*=
sin
f
(
dihedralAngle
);
// printf("%4d - f: %9.4f\n", pos1, dEdAngle);
float
normCross1
=
DOT3
(
cp0
,
cp0
);
float
normBC
=
sqrt
(
DOT3
(
A
->
v1
,
A
->
v1
));
float
normBC
=
sqrt
f
(
DOT3
(
A
->
v1
,
A
->
v1
));
float4
ff
;
ff
.
x
=
(
-
dEdAngle
*
normBC
)
/
normCross1
;
float
normCross2
=
DOT3
(
cp1
,
cp1
);
...
...
@@ -475,7 +475,7 @@ void kCalculateLocalForces_kernel()
d
.
y
=
a1
.
y
-
a2
.
y
;
d
.
z
=
a1
.
z
-
a2
.
z
;
float
r2
=
DOT3
(
d
,
d
);
float
inverseR
=
1.0
f
/
sqrt
(
r2
);
float
inverseR
=
1.0
f
/
sqrt
f
(
r2
);
float
sig2
=
inverseR
*
LJ14
.
y
;
sig2
*=
sig2
;
float
sig6
=
sig2
*
sig2
*
sig2
;
...
...
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.h
View file @
470c9b7f
...
...
@@ -88,9 +88,9 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
dy
=
psA
[
j
].
y
-
apos
.
y
;
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
#if defined USE_CUTOFF
...
...
@@ -99,7 +99,7 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
if
(
i
<
cSim
.
atoms
&&
x
+
j
<
cSim
.
atoms
)
#endif
{
r
=
sqrt
(
r2
);
r
=
sqrt
f
(
r2
);
float
rInverse
=
1
.
0
f
/
r
;
float
rScaledRadiusJ
=
r
+
psA
[
j
].
sr
;
if
((
j
!=
tgx
)
&&
(
ar
.
x
<
rScaledRadiusJ
))
...
...
@@ -108,7 +108,7 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
float
u_ij
=
1
.
0
f
/
rScaledRadiusJ
;
float
l_ij2
=
l_ij
*
l_ij
;
float
u_ij2
=
u_ij
*
u_ij
;
float
ratio
=
log
(
u_ij
/
l_ij
);
float
ratio
=
log
f
(
u_ij
/
l_ij
);
apos
.
w
+=
l_ij
-
u_ij
+
0
.
25
f
*
r
*
(
u_ij2
-
l_ij2
)
+
...
...
@@ -167,9 +167,9 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
dy
=
psA
[
tj
].
y
-
apos
.
y
;
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
#ifdef USE_CUTOFF
...
...
@@ -178,7 +178,7 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
if
(
i
<
cSim
.
atoms
&&
y
+
tj
<
cSim
.
atoms
)
#endif
{
r
=
sqrt
(
r2
);
r
=
sqrt
f
(
r2
);
float
rInverse
=
1
.
0
f
/
r
;
float
rScaledRadiusJ
=
r
+
psA
[
tj
].
sr
;
if
(
ar
.
x
<
rScaledRadiusJ
)
...
...
@@ -187,7 +187,7 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
float
u_ij
=
1
.
0
f
/
rScaledRadiusJ
;
float
l_ij2
=
l_ij
*
l_ij
;
float
u_ij2
=
u_ij
*
u_ij
;
float
ratio
=
log
(
u_ij
/
l_ij
);
float
ratio
=
log
f
(
u_ij
/
l_ij
);
float
term
=
l_ij
-
u_ij
+
0
.
25
f
*
r
*
(
u_ij2
-
l_ij2
)
+
...
...
@@ -208,7 +208,7 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
float
u_ij
=
1
.
0
f
/
rScaledRadiusI
;
float
l_ij2
=
l_ij
*
l_ij
;
float
u_ij2
=
u_ij
*
u_ij
;
float
ratio
=
log
(
u_ij
/
l_ij
);
float
ratio
=
log
f
(
u_ij
/
l_ij
);
float
term
=
l_ij
-
u_ij
+
0
.
25
f
*
r
*
(
u_ij2
-
l_ij2
)
+
...
...
@@ -240,9 +240,9 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
dy
=
psA
[
j
].
y
-
apos
.
y
;
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
#ifdef USE_CUTOFF
...
...
@@ -251,7 +251,7 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
if
(
i
<
cSim
.
atoms
&&
y
+
j
<
cSim
.
atoms
)
#endif
{
r
=
sqrt
(
r2
);
r
=
sqrt
f
(
r2
);
float
rInverse
=
1
.
0
f
/
r
;
float
rScaledRadiusJ
=
r
+
psA
[
j
].
sr
;
if
(
ar
.
x
<
rScaledRadiusJ
)
...
...
@@ -260,7 +260,7 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
float
u_ij
=
1
.
0
f
/
rScaledRadiusJ
;
float
l_ij2
=
l_ij
*
l_ij
;
float
u_ij2
=
u_ij
*
u_ij
;
float
ratio
=
log
(
u_ij
/
l_ij
);
float
ratio
=
log
f
(
u_ij
/
l_ij
);
float
term
=
l_ij
-
u_ij
+
0
.
25
f
*
r
*
(
u_ij2
-
l_ij2
)
+
...
...
@@ -281,7 +281,7 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
float
u_ij
=
1
.
0
f
/
rScaledRadiusI
;
float
l_ij2
=
l_ij
*
l_ij
;
float
u_ij2
=
u_ij
*
u_ij
;
float
ratio
=
log
(
u_ij
/
l_ij
);
float
ratio
=
log
f
(
u_ij
/
l_ij
);
float
term
=
l_ij
-
u_ij
+
0
.
25
f
*
r
*
(
u_ij2
-
l_ij2
)
+
...
...
platforms/cuda/src/kernels/kCalculateObcGbsaForces2.h
View file @
470c9b7f
...
...
@@ -87,12 +87,12 @@ void METHOD_NAME(kCalculateObcGbsa, Forces2_kernel)(unsigned int* workUnit)
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
// Atom I Born forces and sum
...
...
@@ -104,7 +104,7 @@ void METHOD_NAME(kCalculateObcGbsa, Forces2_kernel)(unsigned int* workUnit)
float
l_ij2
=
l_ij
*
l_ij
;
float
u_ij2
=
u_ij
*
u_ij
;
float
r2Inverse
=
rInverse
*
rInverse
;
float
t1
=
log
(
u_ij
/
l_ij
);
float
t1
=
log
f
(
u_ij
/
l_ij
);
float
t2
=
(
l_ij2
-
u_ij2
);
float
t3
=
t2
*
rInverse
;
t1
*=
rInverse
;
...
...
@@ -182,12 +182,12 @@ void METHOD_NAME(kCalculateObcGbsa, Forces2_kernel)(unsigned int* workUnit)
float
dy
=
psA
[
tj
].
y
-
apos
.
y
;
float
dz
=
psA
[
tj
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
// Interleaved Atom I and J Born Forces and sum components
float
r2Inverse
=
1
.
0
f
/
r2
;
...
...
@@ -202,8 +202,8 @@ void METHOD_NAME(kCalculateObcGbsa, Forces2_kernel)(unsigned int* workUnit)
float
l_ij2I
=
l_ijI
*
l_ijI
;
float
u_ij2J
=
u_ijJ
*
u_ijJ
;
float
u_ij2I
=
u_ijI
*
u_ijI
;
float
t1J
=
log
(
u_ijJ
/
l_ijJ
);
float
t1I
=
log
(
u_ijI
/
l_ijI
);
float
t1J
=
log
f
(
u_ijJ
/
l_ijJ
);
float
t1I
=
log
f
(
u_ijI
/
l_ijI
);
float
t2J
=
(
l_ij2J
-
u_ij2J
);
float
t2I
=
(
l_ij2I
-
u_ij2I
);
float
t3J
=
t2J
*
rInverse
;
...
...
@@ -280,12 +280,12 @@ void METHOD_NAME(kCalculateObcGbsa, Forces2_kernel)(unsigned int* workUnit)
float
dy
=
psA
[
j
].
y
-
apos
.
y
;
float
dz
=
psA
[
j
].
z
-
apos
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
float
r
=
sqrt
(
r2
);
float
r
=
sqrt
f
(
r2
);
// Interleaved Atom I and J Born Forces and sum components
float
r2Inverse
=
1
.
0
f
/
r2
;
...
...
@@ -300,8 +300,8 @@ void METHOD_NAME(kCalculateObcGbsa, Forces2_kernel)(unsigned int* workUnit)
float
l_ij2I
=
l_ijI
*
l_ijI
;
float
u_ij2J
=
u_ijJ
*
u_ijJ
;
float
u_ij2I
=
u_ijI
*
u_ijI
;
float
t1J
=
log
(
u_ijJ
/
l_ijJ
);
float
t1I
=
log
(
u_ijI
/
l_ijI
);
float
t1J
=
log
f
(
u_ijJ
/
l_ijJ
);
float
t1I
=
log
f
(
u_ijI
/
l_ijI
);
float
t2J
=
(
l_ij2J
-
u_ij2J
);
float
t2I
=
(
l_ij2I
-
u_ij2I
);
float
t3J
=
t2J
*
rInverse
;
...
...
platforms/cuda/src/kernels/kCalculatePME.cu
View file @
470c9b7f
...
...
@@ -121,9 +121,9 @@ void kUpdateBsplines_kernel()
}
float4
posq
=
cSim
.
pPosq
[
i
];
posq
.
x
-=
floor
(
posq
.
x
*
cSim
.
invPeriodicBoxSizeX
)
*
cSim
.
periodicBoxSizeX
;
posq
.
y
-=
floor
(
posq
.
y
*
cSim
.
invPeriodicBoxSizeY
)
*
cSim
.
periodicBoxSizeY
;
posq
.
z
-=
floor
(
posq
.
z
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
periodicBoxSizeZ
;
posq
.
x
-=
floor
f
(
posq
.
x
*
cSim
.
invPeriodicBoxSizeX
)
*
cSim
.
periodicBoxSizeX
;
posq
.
y
-=
floor
f
(
posq
.
y
*
cSim
.
invPeriodicBoxSizeY
)
*
cSim
.
periodicBoxSizeY
;
posq
.
z
-=
floor
f
(
posq
.
z
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
periodicBoxSizeZ
;
float3
t
=
make_float3
((
posq
.
x
*
cSim
.
invPeriodicBoxSizeX
)
*
cSim
.
pmeGridSize
.
x
,
(
posq
.
y
*
cSim
.
invPeriodicBoxSizeY
)
*
cSim
.
pmeGridSize
.
y
,
(
posq
.
z
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
pmeGridSize
.
z
);
...
...
@@ -210,7 +210,7 @@ void kFindAtomRangeForGrid_kernel()
// some work in the charge spreading kernel.
float
posz
=
cSim
.
pPosq
[
atomData
.
x
].
z
;
posz
-=
floor
(
posz
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
periodicBoxSizeZ
;
posz
-=
floor
f
(
posz
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
periodicBoxSizeZ
;
int
z
=
((
int
)
((
posz
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
pmeGridSize
.
z
))
%
cSim
.
pmeGridSize
.
z
;
cSim
.
pPmeAtomGridIndex
[
i
].
y
=
z
;
}
...
...
@@ -278,7 +278,7 @@ void kGridSpreadCharge_kernel()
}
}
}
cSim
.
pPmeGrid
[
gridIndex
]
=
make_cuComplex
(
result
*
sqrt
(
cSim
.
epsfac
),
0.0
f
);
cSim
.
pPmeGrid
[
gridIndex
]
=
make_cuComplex
(
result
*
sqrt
f
(
cSim
.
epsfac
),
0.0
f
);
}
}
...
...
@@ -337,9 +337,9 @@ void kGridInterpolateForce_kernel()
{
float3
force
=
make_float3
(
0.0
f
,
0.0
f
,
0.0
f
);
float4
posq
=
cSim
.
pPosq
[
atom
];
posq
.
x
-=
floor
(
posq
.
x
*
cSim
.
invPeriodicBoxSizeX
)
*
cSim
.
periodicBoxSizeX
;
posq
.
y
-=
floor
(
posq
.
y
*
cSim
.
invPeriodicBoxSizeY
)
*
cSim
.
periodicBoxSizeY
;
posq
.
z
-=
floor
(
posq
.
z
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
periodicBoxSizeZ
;
posq
.
x
-=
floor
f
(
posq
.
x
*
cSim
.
invPeriodicBoxSizeX
)
*
cSim
.
periodicBoxSizeX
;
posq
.
y
-=
floor
f
(
posq
.
y
*
cSim
.
invPeriodicBoxSizeY
)
*
cSim
.
periodicBoxSizeY
;
posq
.
z
-=
floor
f
(
posq
.
z
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
periodicBoxSizeZ
;
float3
t
=
make_float3
((
posq
.
x
*
cSim
.
invPeriodicBoxSizeX
)
*
cSim
.
pmeGridSize
.
x
,
(
posq
.
y
*
cSim
.
invPeriodicBoxSizeY
)
*
cSim
.
pmeGridSize
.
y
,
(
posq
.
z
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
pmeGridSize
.
z
);
...
...
@@ -373,7 +373,7 @@ void kGridInterpolateForce_kernel()
}
}
float4
totalForce
=
cSim
.
pForce4
[
atom
];
float
q
=
posq
.
w
*
sqrt
(
cSim
.
epsfac
);
float
q
=
posq
.
w
*
sqrt
f
(
cSim
.
epsfac
);
totalForce
.
x
-=
q
*
force
.
x
*
cSim
.
pmeGridSize
.
x
*
cSim
.
invPeriodicBoxSizeX
;
totalForce
.
y
-=
q
*
force
.
y
*
cSim
.
pmeGridSize
.
y
*
cSim
.
invPeriodicBoxSizeY
;
totalForce
.
z
-=
q
*
force
.
z
*
cSim
.
pmeGridSize
.
z
*
cSim
.
invPeriodicBoxSizeZ
;
...
...
platforms/cuda/src/kernels/kFindInteractingBlocks.h
View file @
470c9b7f
...
...
@@ -41,9 +41,9 @@ __global__ void METHOD_NAME(kFindBlockBounds, _kernel)()
{
float4
apos
=
cSim
.
pPosq
[
base
];
#ifdef USE_PERIODIC
apos
.
x
-=
floor
(
apos
.
x
*
cSim
.
invPeriodicBoxSizeX
)
*
cSim
.
periodicBoxSizeX
;
apos
.
y
-=
floor
(
apos
.
y
*
cSim
.
invPeriodicBoxSizeY
)
*
cSim
.
periodicBoxSizeY
;
apos
.
z
-=
floor
(
apos
.
z
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
periodicBoxSizeZ
;
apos
.
x
-=
floor
f
(
apos
.
x
*
cSim
.
invPeriodicBoxSizeX
)
*
cSim
.
periodicBoxSizeX
;
apos
.
y
-=
floor
f
(
apos
.
y
*
cSim
.
invPeriodicBoxSizeY
)
*
cSim
.
periodicBoxSizeY
;
apos
.
z
-=
floor
f
(
apos
.
z
*
cSim
.
invPeriodicBoxSizeZ
)
*
cSim
.
periodicBoxSizeZ
;
float4
firstPoint
=
apos
;
#endif
float
minx
=
apos
.
x
;
...
...
@@ -56,9 +56,9 @@ __global__ void METHOD_NAME(kFindBlockBounds, _kernel)()
{
apos
=
cSim
.
pPosq
[
base
+
i
];
#ifdef USE_PERIODIC
apos
.
x
-=
floor
((
apos
.
x
-
firstPoint
.
x
)
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
apos
.
y
-=
floor
((
apos
.
y
-
firstPoint
.
y
)
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
apos
.
z
-=
floor
((
apos
.
z
-
firstPoint
.
z
)
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
apos
.
x
-=
floor
f
((
apos
.
x
-
firstPoint
.
x
)
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
apos
.
y
-=
floor
f
((
apos
.
y
-
firstPoint
.
y
)
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
apos
.
z
-=
floor
f
((
apos
.
z
-
firstPoint
.
z
)
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
minx
=
min
(
minx
,
apos
.
x
);
maxx
=
max
(
maxx
,
apos
.
x
);
...
...
@@ -95,9 +95,9 @@ __global__ void METHOD_NAME(kFindBlocksWithInteractions, _kernel)()
float
dy
=
centera
.
y
-
centerb
.
y
;
float
dz
=
centera
.
z
-
centerb
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
float4
boxSizea
=
cSim
.
pGridBoundingBox
[
x
];
float4
boxSizeb
=
cSim
.
pGridBoundingBox
[
y
];
...
...
@@ -156,9 +156,9 @@ __global__ void METHOD_NAME(kFindInteractionsWithinBlocks, _kernel)(unsigned int
float
dy
=
apos
.
y
-
center
.
y
;
float
dz
=
apos
.
z
-
center
.
z
;
#ifdef USE_PERIODIC
dx
-=
floor
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
dx
-=
floor
f
(
dx
*
cSim
.
invPeriodicBoxSizeX
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeX
;
dy
-=
floor
f
(
dy
*
cSim
.
invPeriodicBoxSizeY
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeY
;
dz
-=
floor
f
(
dz
*
cSim
.
invPeriodicBoxSizeZ
+
0
.
5
f
)
*
cSim
.
periodicBoxSizeZ
;
#endif
dx
=
max
(
0
.
0
f
,
abs
(
dx
)
-
boxSize
.
x
);
dy
=
max
(
0
.
0
f
,
abs
(
dy
)
-
boxSize
.
y
);
...
...
platforms/cuda/src/kernels/kForces.cu
View file @
470c9b7f
...
...
@@ -346,7 +346,7 @@ void kReduceObcGbsaBornForces_kernel()
totalForce
+=
*
pFt
;
}
float
r
=
(
obcData
.
x
+
cSim
.
dielectricOffset
+
cSim
.
probeRadius
);
float
ratio6
=
pow
((
obcData
.
x
+
cSim
.
dielectricOffset
)
/
bornRadius
,
6.0
f
);
float
ratio6
=
pow
f
((
obcData
.
x
+
cSim
.
dielectricOffset
)
/
bornRadius
,
6.0
f
);
float
saTerm
=
cSim
.
surfaceAreaFactor
*
r
*
r
*
ratio6
;
totalForce
+=
saTerm
/
bornRadius
;
...
...
Prev
1
2
3
Next
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