Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
docking
ocladock
Commits
732b15b6
Commit
732b15b6
authored
Apr 11, 2018
by
Leonardo Solis
Browse files
cleaned energy calc
parent
d65a225d
Changes
1
Hide whitespace changes
Inline
Side-by-side
device/calcenergy.cl
View file @
732b15b6
...
...
@@ -76,15 +76,6 @@ void gpu_calc_energy(
{
partial_energies[get_local_id
(
0
)
]
=
0.0f
;
#
if
0
//
Rotational
genes
in
the
Shoemake
space
expressed
in
radians
float
u1,
u2,
u3
;
u1
=
genotype[3]
;
u2
=
genotype[4]/**DEG_TO_RAD*/
;
u3
=
genotype[5]/**DEG_TO_RAD*/
;
#
endif
#
if
defined
(
IMPROVE_GRID
)
//
INTERMOLECULAR
for-loop
(
intermediate
results
)
//
It
stores
a
product
of
two
chars
...
...
@@ -98,7 +89,7 @@ void gpu_calc_energy(
#
endif
//
================================================
//
CALCULAT
E
ATOMIC
POSITIONS
AFTER
ROTATIONS
//
CALCULAT
ING
ATOMIC
POSITIONS
AFTER
ROTATIONS
//
================================================
for
(
uint
rotation_counter
=
get_local_id
(
0
)
;
rotation_counter
<
dockpars_rotbondlist_length
;
...
...
@@ -137,12 +128,11 @@ void gpu_calc_energy(
//
-------------------------------------------------------------------
//
Replacing
rotation
genes:
from
spherical
space
to
Shoemake
space
//
gene
[0:2]:
translation
->
kept
as
original
x,
y,
z
//
gene
[3:5]:
rotation
->
transformed
into
Shoemake
(
u1
:
adimensional,
u2&u3:
sexagesimal
)
//
gene
[3:5]:
rotation
->
transformed
into
Shoemake
(
u1
,
u2,
u3
)
//
gene
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
u1,
u2,
u3:
[0,
1]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
...
...
@@ -154,8 +144,8 @@ void gpu_calc_energy(
//
Rotational
genes
in
the
Shoemake
space
expressed
in
radians
float
u1
=
genotype[3]
;
float
u2
=
genotype[4]
/**DEG_TO_RAD*/
;
float
u3
=
genotype[5]
/**DEG_TO_RAD*/
;
float
u2
=
genotype[4]
;
float
u3
=
genotype[5]
;
//
u1,
u2,
u3
should
be
within
their
valid
range
of
[0,1]
quatrot_left_q
=
native_sqrt
(
1
-
u1
)
*
native_sin
(
PI_TIMES_2*u2
)
;
...
...
@@ -270,7 +260,7 @@ void gpu_calc_energy(
}
//
End
rotation_counter
for-loop
//
================================================
//
CALCULAT
E
INTERMOLECULAR
ENERGY
//
CALCULAT
ING
INTERMOLECULAR
ENERGY
//
================================================
for
(
uint
atom_id
=
get_local_id
(
0
)
;
atom_id
<
dockpars_num_of_atoms
;
...
...
@@ -289,7 +279,7 @@ void gpu_calc_energy(
}
else
{
//
Get
coordinates
//
Get
ting
coordinates
int
x_low
=
(
int
)
floor
(
x
)
;
int
y_low
=
(
int
)
floor
(
y
)
;
int
z_low
=
(
int
)
floor
(
z
)
;
...
...
@@ -300,7 +290,7 @@ void gpu_calc_energy(
float
dy
=
y
-
y_low
;
float
dz
=
z
-
z_low
;
//
Calculat
e
interpolation
weights
//
Calculat
ing
interpolation
weights
float
weights[2][2][2]
;
weights
[0][0][0]
=
(
1-dx
)
*
(
1-dy
)
*
(
1-dz
)
;
weights
[1][0][0]
=
dx*
(
1-dy
)
*
(
1-dz
)
;
...
...
@@ -311,7 +301,7 @@ void gpu_calc_energy(
weights
[0][1][1]
=
(
1-dx
)
*dy*
dz
;
weights
[1][1][1]
=
dx*dy*dz
;
//
Captur
e
affinity
values
//
Captur
ing
affinity
values
#
if
defined
(
IMPROVE_GRID
)
uint
ylow_times_g1
=
y_low*g1
;
uint
yhigh_times_g1
=
y_high*g1
;
...
...
@@ -387,10 +377,10 @@ void gpu_calc_energy(
atom_typeid,
z_high,
y_high,
x_high
)
;
#
endif
//
c
alculating
affinity
energy
//
C
alculating
affinity
energy
partial_energies[get_local_id
(
0
)
]
+=
TRILININTERPOL
(
cube,
weights
)
;
//
c
apturing
electrostatic
values
//
C
apturing
electrostatic
values
atom_typeid
=
dockpars_num_of_atypes
;
#
if
defined
(
IMPROVE_GRID
)
...
...
@@ -451,10 +441,10 @@ void gpu_calc_energy(
atom_typeid,
z_high,
y_high,
x_high
)
;
#
endif
//
c
alculating
electrosatic
energy
//
C
alculating
electrosatic
energy
partial_energies[get_local_id
(
0
)
]
+=
q
*
TRILININTERPOL
(
cube,
weights
)
;
//
c
apturing
desolvation
values
//
C
apturing
desolvation
values
atom_typeid
=
dockpars_num_of_atypes+1
;
#
if
defined
(
IMPROVE_GRID
)
...
...
@@ -515,7 +505,7 @@ void gpu_calc_energy(
atom_typeid,
z_high,
y_high,
x_high
)
;
#
endif
//
c
alculating
desolvation
energy
//
C
alculating
desolvation
energy
partial_energies[get_local_id
(
0
)
]
+=
fabs
(
q
)
*
TRILININTERPOL
(
cube,
weights
)
;
}
...
...
@@ -527,27 +517,27 @@ void gpu_calc_energy(
//
thus,
they
can
be
executed
only
sequentially
on
the
GPU.
//
================================================
//
CALCULAT
E
INTRAMOLECULAR
ENERGY
//
CALCULAT
ING
INTRAMOLECULAR
ENERGY
//
================================================
for
(
uint
contributor_counter
=
get_local_id
(
0
)
;
contributor_counter
<
dockpars_num_of_intraE_contributors
;
contributor_counter
+=NUM_OF_THREADS_PER_BLOCK
)
{
//
g
etting
atom
IDs
//
G
etting
atom
IDs
uint
atom1_id
=
intraE_contributors_const[3*contributor_counter]
;
uint
atom2_id
=
intraE_contributors_const[3*contributor_counter+1]
;
//
c
alculating
address
of
first
atom
's
coordinates
//
C
alculating
address
of
first
atom
's
coordinates
float
subx
=
calc_coords_x[atom1_id]
;
float
suby
=
calc_coords_y[atom1_id]
;
float
subz
=
calc_coords_z[atom1_id]
;
//
c
alculating
address
of
second
atom
's
coordinates
//
C
alculating
address
of
second
atom
's
coordinates
subx
-=
calc_coords_x[atom2_id]
;
suby
-=
calc_coords_y[atom2_id]
;
subz
-=
calc_coords_z[atom2_id]
;
//
c
alculating
distance
(
atomic_distance
)
//
C
alculating
atomic_distance
#
if
defined
(
NATIVE_PRECISION
)
float
atomic_distance
=
native_sqrt
(
subx*subx
+
suby*suby
+
subz*subz
)
*dockpars_grid_spacing
;
#
elif
defined
(
HALF_PRECISION
)
...
...
@@ -559,14 +549,14 @@ void gpu_calc_energy(
if
(
atomic_distance
<
1.0f
)
atomic_distance
=
1.0f
;
//
c
alculating
energy
contributions
//
C
alculating
energy
contributions
if
((
atomic_distance
<
8.0f
)
&&
(
atomic_distance
<
20.48f
))
{
//
Getting
type
IDs
uint
atom1_typeid
=
atom_types_const[atom1_id]
;
uint
atom2_typeid
=
atom_types_const[atom2_id]
;
//
c
alculating
van
der
Waals
/
hydrogen
bond
term
//
C
alculating
van
der
Waals
/
hydrogen
bond
term
#
if
defined
(
NATIVE_PRECISION
)
partial_energies[get_local_id
(
0
)
]
+=
native_divide
(
VWpars_AC_const[atom1_typeid
*
dockpars_num_of_atypes+atom2_typeid],native_powr
(
atomic_distance,12
))
;
#
elif
defined
(
HALF_PRECISION
)
...
...
@@ -596,7 +586,7 @@ void gpu_calc_energy(
partial_energies[get_local_id
(
0
)
]
-=
VWpars_BD_const[atom1_typeid*dockpars_num_of_atypes+atom2_typeid]/powr
(
atomic_distance,6
)
;
#
endif
//
c
alculating
electrostatic
term
//
C
alculating
electrostatic
term
/*
#
if
defined
(
NATIVE_PRECISION
)
...
...
@@ -638,7 +628,7 @@ void gpu_calc_energy(
//
c
alculating
desolvation
term
//
C
alculating
desolvation
term
#
if
defined
(
NATIVE_PRECISION
)
partial_energies[get_local_id
(
0
)
]
+=
((
dspars_S_const[atom1_typeid]
+
dockpars_qasp*fabs
(
atom_charges_const[atom1_id]
))
*dspars_V_const[atom2_typeid]
+
...
...
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