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
fefc9294
Commit
fefc9294
authored
Dec 08, 2011
by
Mark Friedrichs
Browse files
Fix for case where r=S
parent
b5009324
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
24 deletions
+54
-24
platforms/cuda/src/kernels/kCalculateGBVIAux.h
platforms/cuda/src/kernels/kCalculateGBVIAux.h
+54
-24
No files found.
platforms/cuda/src/kernels/kCalculateGBVIAux.h
View file @
fefc9294
...
@@ -40,8 +40,8 @@ static __device__ float getGBVI_L( float r, float x, float S )
...
@@ -40,8 +40,8 @@ static __device__ float getGBVI_L( float r, float x, float S )
{
{
float
rInv
=
1
.
0
f
/
r
;
float
rInv
=
1
.
0
f
/
r
;
float
xInv
=
1
.
0
f
/
x
;
float
xInv
=
1
.
0
f
/
x
;
float
xInv2
=
xInv
*
xInv
;
float
xInv2
=
xInv
*
xInv
;
float
diff2
=
(
r
+
S
)
*
(
r
-
S
);
float
diff2
=
(
r
+
S
)
*
(
r
-
S
);
...
@@ -51,33 +51,22 @@ static __device__ float getGBVI_L( float r, float x, float S )
...
@@ -51,33 +51,22 @@ static __device__ float getGBVI_L( float r, float x, float S )
static
__device__
float
getGBVI_Volume
(
float
r
,
float
R
,
float
S
)
static
__device__
float
getGBVI_Volume
(
float
r
,
float
R
,
float
S
)
{
{
/*
float
addOn
=
0
.
0
f
;
float upperBound = r_ij + S;
int
mask
=
1
;
float rdiffS = r_ij - S;
float lowerBound = R > rdiffS ? R : rdiffS;
float L_upper = getGBVI_L( r_ij, upperBound, S );
float L_lower = getGBVI_L( r_ij, lowerBound, S );
float mask = r_ij < (R - S) ? 0.0f : 1.0f;
float addOn = r_ij < (S - R) ? (1.0f/(R*R*R)) : 0.0f;
return (mask*( L_upper - L_lower ) + addOn);
*/
float
addOn
=
0
.
0
;
float
mask
=
1
.
0
;
float
lowerBound
=
(
r
-
S
);
float
lowerBound
=
(
r
-
S
);
float
diff
=
(
S
-
R
);
float
diff
=
(
S
-
R
);
if
(
fabs
(
diff
)
<
r
){
if
(
fabs
f
(
diff
)
<
r
){
lowerBound
=
R
>
lowerBound
?
R
:
lowerBound
;
lowerBound
=
R
>
lowerBound
?
R
:
lowerBound
;
}
else
if
(
r
<=
diff
){
}
else
if
(
r
<=
diff
){
addOn
=
(
1
.
0
f
/
(
R
*
R
*
R
));
addOn
=
(
1
.
0
f
/
(
R
*
R
*
R
));
}
else
{
}
else
{
mask
=
0
.
0
f
;
mask
=
0
;
}
}
float
s2
=
getGBVI_L
(
r
,
lowerBound
,
S
);
float
s2
=
getGBVI_L
(
r
,
lowerBound
,
S
);
float
s1
=
getGBVI_L
(
r
,
(
r
+
S
),
S
);
float
s1
=
getGBVI_L
(
r
,
(
r
+
S
),
S
);
return
mask
*
(
s1
-
s2
+
addOn
);
s1
=
mask
?
(
s1
-
s2
+
addOn
)
:
0
.
0
f
;
return
s1
;
}
}
static
__device__
float
getGBVI_dL_dr
(
float
r
,
float
x
,
float
S
)
static
__device__
float
getGBVI_dL_dr
(
float
r
,
float
x
,
float
S
)
...
@@ -93,7 +82,22 @@ static __device__ float getGBVI_dL_dr( float r, float x, float S )
...
@@ -93,7 +82,22 @@ static __device__ float getGBVI_dL_dr( float r, float x, float S )
float
diff2
=
(
r
+
S
)
*
(
r
-
S
);
float
diff2
=
(
r
+
S
)
*
(
r
-
S
);
return
(
(
-
1
.
5
f
*
xInv2
*
rInv2
)
*
(
0
.
25
f
+
0
.
125
f
*
diff2
*
xInv2
)
+
0
.
375
f
*
xInv3
*
xInv
);
return
(
(
-
1
.
5
f
*
xInv2
*
rInv2
)
*
(
0
.
25
f
+
0
.
125
f
*
diff2
*
xInv2
)
+
0
.
375
f
*
xInv3
*
xInv
);
//return 0.0f;
}
static
__device__
float
getGBVI_dL_drNew
(
float
r
,
float
x
,
float
S
)
{
float
rInv
=
1
.
0
f
/
r
;
float
rInv2
=
rInv
*
rInv
;
float
xInv
=
1
.
0
f
/
x
;
float
xInv2
=
xInv
*
xInv
;
float
t1
=
(
S
*
rInv
);
t1
=
1
.
0
f
+
t1
*
t1
;
return
(
-
0
.
375
f
*
xInv2
)
*
(
rInv2
-
0
.
5
f
*
xInv2
*
t1
);
}
}
...
@@ -110,10 +114,9 @@ static __device__ float getGBVI_dL_dx( float r, float x, float S )
...
@@ -110,10 +114,9 @@ static __device__ float getGBVI_dL_dx( float r, float x, float S )
return
(
(
-
1
.
5
f
*
xInv3
)
*
(
(
0
.
5
f
*
rInv
)
-
xInv
+
(
0
.
5
f
*
diff
*
xInv2
*
rInv
)
));
return
(
(
-
1
.
5
f
*
xInv3
)
*
(
(
0
.
5
f
*
rInv
)
-
xInv
+
(
0
.
5
f
*
diff
*
xInv2
*
rInv
)
));
}
}
static
__device__
float
getGBVI_dE2
(
float
r
,
float
R
,
float
S
,
float
bornForce
)
static
__device__
float
getGBVI_dE2
Old
(
float
r
,
float
R
,
float
S
,
float
bornForce
)
{
{
float
diff
=
S
-
R
;
float
diff
=
S
-
R
;
...
@@ -138,6 +141,33 @@ static __device__ float getGBVI_dE2( float r, float R, float S, float bornForce
...
@@ -138,6 +141,33 @@ static __device__ float getGBVI_dE2( float r, float R, float S, float bornForce
}
}
static
__device__
float
getGBVI_dE2
(
float
r
,
float
R
,
float
S
,
float
bornForce
)
{
float
diff
=
S
-
R
;
float
dE
=
0
.
0
f
;
if
(
fabsf
(
diff
)
<
r
){
dE
=
getGBVI_dL_dr
(
r
,
r
+
S
,
S
)
+
getGBVI_dL_dx
(
r
,
r
+
S
,
S
);
float
lowerBound
;
float
mask
;
if
(
R
>
(
r
-
S
)
){
lowerBound
=
R
;
mask
=
0
.
0
f
;
}
else
{
lowerBound
=
r
-
S
;
mask
=
1
.
0
f
;
}
dE
-=
getGBVI_dL_dr
(
r
,
lowerBound
,
S
)
+
mask
*
getGBVI_dL_dx
(
r
,
lowerBound
,
S
);
}
else
if
(
r
<
(
S
-
R
)
){
dE
=
getGBVI_dL_dr
(
r
,
r
+
S
,
S
)
+
getGBVI_dL_dx
(
r
,
r
+
S
,
S
);
dE
-=
(
getGBVI_dL_dr
(
r
,
r
-
S
,
S
)
+
getGBVI_dL_dx
(
r
,
r
-
S
,
S
)
);
}
dE
*=
(
(
r
>
1.0e-08
f
)
?
(
bornForce
/
r
)
:
0
.
0
f
);
return
(
-
dE
);
}
static
__device__
float
getGBVIBornForce2
(
float
bornRadius
,
float
R
,
float
bornForce
,
float
gamma
)
static
__device__
float
getGBVIBornForce2
(
float
bornRadius
,
float
R
,
float
bornForce
,
float
gamma
)
{
{
float
ratio
=
(
R
/
bornRadius
);
float
ratio
=
(
R
/
bornRadius
);
...
...
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