Skip to content
GitLab
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
43feab9e
Commit
43feab9e
authored
Apr 24, 2018
by
Leonardo Solis
Browse files
finalized version that exclude out-of-bound genomes in kergrad
parent
2a05277c
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
43feab9e
...
...
@@ -201,16 +201,16 @@ odock: check-env-all stringify $(SRC)
# 7cpa: for testing gradients of torsion genes (15 torsions)
# 3tmn: for testing gradients of torsion genes (1 torsion)
PDB
:=
1stp
PDB
:=
3ce3
NRUN
:=
100
POPSIZE
:=
1
50
POPSIZE
:=
50
0
TESTNAME
:=
test
test
:
odock
$(BIN_DIR)
/
$(TARGET)
-ffile
./input/
$(PDB)
/derived/
$(PDB)
_protein.maps.fld
-lfile
./input/
$(PDB)
/derived/
$(PDB)
_ligand.pdbqt
-nrun
$(NRUN)
-psize
$(POPSIZE)
-resnam
$(TESTNAME)
-gfpop
1
ASTEX_PDB
:=
2bsm
ASTEX_NRUN
:=
10
0
ASTEX_NRUN
:=
5
0
ASTEX_POPSIZE
:=
500
ASTEX_TESTNAME
:=
test_astex
...
...
common/calcenergy_basic.h
View file @
43feab9e
...
...
@@ -65,11 +65,34 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define DIEL_LAMBDA 0.003627f
#define DIEL_H DIEL_LAMBDA
#define DIEL_K 7.7839f
#define DIEL_B_TIMES_H (DIEL_B*DIEL_H)
#define DIEL_B_TIMES_H_TIMES_K (DIEL_B_TIMES_H*DIEL_K)
#define DIEL_B_TIMES_H (DIEL_B * DIEL_H)
#define DIEL_B_TIMES_H_TIMES_K (DIEL_B_TIMES_H * DIEL_K)
// Used for Shoemake to quaternion transformation
#define PI_TIMES_2 (float)(2.0f*M_PI)
// -------------------------------------------
// Gradient-related defines
// -------------------------------------------
#define INFINITESIMAL_RADIAN 1E-5
#define HALF_INFINITESIMAL_RADIAN (0.5f * INFINITESIMAL_RADIAN)
#define INV_INFINITESIMAL_RADIAN (1/INFINITESIMAL_RADIAN)
#define COS_HALF_INFINITESIMAL_RADIAN cos(HALF_INFINITESIMAL_RADIAN)
#define SIN_HALF_INFINITESIMAL_RADIAN sin(HALF_INFINITESIMAL_RADIAN)
// Enable printf statements for debugging
// the gradient-based minimizer
//#define DEBUG_MINIMIZER
#define TRANGENE_ALPHA 1E-3
#define ROTAGENE_ALPHA 1E-8
#define TORSGENE_ALPHA 1E-13
// Used for Shoemake to quternion transformation
#define PI_TIMES_2 (float)(2.0f*M_PI)
...
...
common/defines.h
View file @
43feab9e
...
...
@@ -55,9 +55,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define LS_CONT_FACTOR 0.5f
// Improvements over Pechan's implementation
//#define NATIVE_PRECISION
#define MAPPED_COPY
// TODO: convert this into a program arg
#define GRADIENT_ENABLED
#endif
/* DEFINES_H_ */
device/calcenergy.cl
View file @
43feab9e
...
...
@@ -35,6 +35,9 @@ void gpu_calc_energy(
char
dockpars_gridsize_x,
char
dockpars_gridsize_y,
char
dockpars_gridsize_z,
//
g1
=
gridsize_x
uint
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
uint
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
__global
const
float*
restrict
dockpars_fgrids,
//
This
is
too
large
to
be
allocated
in
__constant
char
dockpars_num_of_atypes,
int
dockpars_num_of_intraE_contributors,
...
...
@@ -90,9 +93,8 @@ void gpu_calc_energy(
#endif
uchar g1 = dockpars_gridsize_x;
uint g2 = dockpars_gridsize_x * dockpars_gridsize_y;
uint g3 = dockpars_gridsize_x * dockpars_gridsize_y * dockpars_gridsize_z;
uint g2 = dockpars_gridsize_x_times_y /*dockpars_gridsize_x * dockpars_gridsize_y*/;
uint g3 = dockpars_gridsize_x_times_y_times_z /*dockpars_gridsize_x * dockpars_gridsize_y * dockpars_gridsize_z*/;
// ================================================
// CALCULATING ATOMIC POSITIONS AFTER ROTATIONS
...
...
@@ -462,18 +464,19 @@ void gpu_calc_energy(
#endif
// Calculating desolvation term
// 1/25.92 = 0.038580246913580245
partial_energies[get_local_id(0)] += ((dspars_S_const[atom1_typeid] +
dockpars_qasp*fabs(atom_charges_const[atom1_id]))*dspars_V_const[atom2_typeid] +
(dspars_S_const[atom2_typeid] +
dockpars_qasp*fabs(atom_charges_const[atom2_id]))*dspars_V_const[atom1_typeid]) *
dockpars_coeff_desolv*native_exp(-
atomic_distance
*native_
divide
(atomic_distance,2
5.92f
));
dockpars_coeff_desolv*native_exp(-
0.03858025f
*native_
powr
(atomic_distance,
2));
#if defined (DEBUG_ENERGY_KERNEL1) || defined (DEBUG_ENERGY_KERNEL4) || defined (DEBUG_ENERGY_KERNEL3)
partial_intraE[get_local_id(0)] += ((dspars_S_const[atom1_typeid] +
dockpars_qasp*fabs(atom_charges_const[atom1_id]))*dspars_V_const[atom2_typeid] +
(dspars_S_const[atom2_typeid] +
dockpars_qasp*fabs(atom_charges_const[atom2_id]))*dspars_V_const[atom1_typeid]) *
dockpars_coeff_desolv*native_exp(-
atomic_distance
*native_
divide
(atomic_distance,2
5.92f
));
dockpars_coeff_desolv*native_exp(-
0.03858025f
*native_
powr
(atomic_distance,
2));
#endif
...
...
device/calcgradient.cl
View file @
43feab9e
...
...
@@ -46,6 +46,9 @@ void gpu_calc_gradient(
char
dockpars_gridsize_x,
char
dockpars_gridsize_y,
char
dockpars_gridsize_z,
//
g1
=
gridsize_x
uint
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
uint
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
__global
const
float*
restrict
dockpars_fgrids,
//
This
is
too
large
to
be
allocated
in
__constant
char
dockpars_num_of_atypes,
int
dockpars_num_of_intraE_contributors,
...
...
@@ -133,13 +136,11 @@ void gpu_calc_gradient(
gene_cnt+=
NUM_OF_THREADS_PER_BLOCK
)
{
gradient_genotype[gene_cnt]
=
0.0f
;
}
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
uchar
g1
=
dockpars_gridsize_x
;
uint
g2
=
dockpars_gridsize_x
*
dockpars_gridsize_y
;
uint
g3
=
dockpars_gridsize_x
*
dockpars_gridsize_y
*
dockpars_gridsize_z
;
uint
g2
=
dockpars_gridsize_x_times_y
/*dockpars_gridsize_x
*
dockpars_gridsize_y*/
;
uint
g3
=
dockpars_gridsize_x_times_y_times_z
/*dockpars_gridsize_x
*
dockpars_gridsize_y
*
dockpars_gridsize_z*/
;
//
================================================
//
CALCULATING
ATOMIC
POSITIONS
AFTER
ROTATIONS
...
...
@@ -781,16 +782,25 @@ void gpu_calc_gradient(
printf
(
"%-20s %-10.5f\n"
,
"torque length: "
,
torque_length
)
;
#
endif
/*
//
Infinitesimal
rotation
in
radians
const
float
infinitesimal_radian
=
1E-5
;
*/
//
Finding
the
quaternion
that
performs
//
the
infinitesimal
rotation
around
torque
axis
float4
quat_torque
;
quat_torque.w
=
native_cos
(
infinitesimal_radian*0.5f
)
;
quat_torque.x
=
fast_normalize
(
torque_rot
)
.
x
*
native_sin
(
infinitesimal_radian*0.5f
)
;
quat_torque.y
=
fast_normalize
(
torque_rot
)
.
y
*
native_sin
(
infinitesimal_radian*0.5f
)
;
quat_torque.z
=
fast_normalize
(
torque_rot
)
.
z
*
native_sin
(
infinitesimal_radian*0.5f
)
;
#
if
0
quat_torque.w
=
native_cos
(
HALF_INFINITESIMAL_RADIAN/*infinitesimal_radian*0.5f*/
)
;
quat_torque.x
=
fast_normalize
(
torque_rot
)
.
x
*
native_sin
(
HALF_INFINITESIMAL_RADIAN/*infinitesimal_radian*0.5f*/
)
;
quat_torque.y
=
fast_normalize
(
torque_rot
)
.
y
*
native_sin
(
HALF_INFINITESIMAL_RADIAN/*infinitesimal_radian*0.5f*/
)
;
quat_torque.z
=
fast_normalize
(
torque_rot
)
.
z
*
native_sin
(
HALF_INFINITESIMAL_RADIAN/*infinitesimal_radian*0.5f*/
)
;
#
endif
quat_torque.w
=
COS_HALF_INFINITESIMAL_RADIAN
;
quat_torque.x
=
fast_normalize
(
torque_rot
)
.
x
*
SIN_HALF_INFINITESIMAL_RADIAN
;
quat_torque.y
=
fast_normalize
(
torque_rot
)
.
y
*
SIN_HALF_INFINITESIMAL_RADIAN
;
quat_torque.z
=
fast_normalize
(
torque_rot
)
.
z
*
SIN_HALF_INFINITESIMAL_RADIAN
;
#
if
defined
(
DEBUG_GRAD_ROTATION_GENES
)
printf
(
"%-20s %-10.5f %-10.5f %-10.5f %-10.5f\n"
,
"quat_torque (w,x,y,z): "
,
quat_torque.w,
quat_torque.x,
quat_torque.y,
quat_torque.z
)
;
...
...
@@ -859,7 +869,8 @@ void gpu_calc_gradient(
//
the
displacement
in
shoemake
space
is
not
distorted.
//
The
correct
amount
of
displacement
in
shoemake
space
is
obtained
//
by
multiplying
the
infinitesimal
displacement
by
shoemake_scaling:
float
shoemake_scaling
=
torque_length
/
infinitesimal_radian
;
//float
shoemake_scaling
=
native_divide
(
torque_length,
INFINITESIMAL_RADIAN/*infinitesimal_radian*/
)
;
float
shoemake_scaling
=
torque_length
*
INV_INFINITESIMAL_RADIAN
;
//
Derivates
in
cube3
//
"current_u2"
and
"current_u3"
are
mapped
into
...
...
@@ -877,7 +888,7 @@ void gpu_calc_gradient(
float
temp_u1
=
genotype[3]
;
if
((
0.0f
<
temp_u1
)
&&
(
temp_u1
<
1.0f
))
{
grad_u1
*=
((
1.0f
/
temp_u1
)
+
(
1.0f
/
(
1.0f-temp_u1
)))
;
grad_u1
*=
(
native_divide
(
1.0f
,
temp_u1
)
+
native_divide
(
1.0f
,
(
1.0f-temp_u1
)))
;
}
grad_u2
*=
4.0f
*
(
1.0f-temp_u1
)
;
grad_u3
*=
4.0f
*
temp_u1
;
...
...
@@ -988,7 +999,7 @@ void gpu_calc_gradient(
float
torque_on_axis
=
dot
(
rotation_unitvec,
torque_tor
)
;
//
Assignment
of
gene-based
gradient
gradient_genotype[rotbond_id+6]
=
torque_on_axis
*
(
M_PI
/
180.0f
)
;
gradient_genotype[rotbond_id+6]
=
torque_on_axis
*
DEG_TO_RAD
/*
(
M_PI
/
180.0f
)
*/
;
#
if
defined
(
DEBUG_GRAD_TORSION_GENES
)
printf
(
"gradient_torsion [%u] :%f\n"
,
rotbond_id+6,
gradient_genotype
[rotbond_id+6]
)
;
...
...
device/kernel1.cl
View file @
43feab9e
...
...
@@ -28,6 +28,9 @@ gpu_calc_initpop(
char
dockpars_gridsize_x,
char
dockpars_gridsize_y,
char
dockpars_gridsize_z,
//
g1
=
gridsize_x
uint
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
uint
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
float
dockpars_grid_spacing,
__global
const
float*
restrict
dockpars_fgrids,
//
This
is
too
large
to
be
allocated
in
__constant
int
dockpars_rotbondlist_length,
...
...
@@ -89,6 +92,9 @@ gpu_calc_initpop(
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
//
g1
=
gridsize_x
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
...
...
device/kernel3.cl
View file @
43feab9e
...
...
@@ -30,6 +30,9 @@ perform_LS(
char
dockpars_gridsize_x,
char
dockpars_gridsize_y,
char
dockpars_gridsize_z,
//
g1
=
gridsize_x
uint
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
uint
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
float
dockpars_grid_spacing,
__global
const
float*
restrict
dockpars_fgrids,
//
This
is
too
large
to
be
allocated
in
__constant
int
dockpars_rotbondlist_length,
...
...
@@ -191,6 +194,9 @@ perform_LS(
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
//
g1
=
gridsize_x
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
...
...
@@ -293,6 +299,9 @@ perform_LS(
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
//
g1
=
gridsize_x
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
...
...
device/kernel4.cl
View file @
43feab9e
...
...
@@ -30,6 +30,9 @@ gpu_gen_and_eval_newpops(
char
dockpars_gridsize_x,
char
dockpars_gridsize_y,
char
dockpars_gridsize_z,
//
g1
=
gridsize_x
uint
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
uint
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
float
dockpars_grid_spacing,
__global
const
float*
restrict
dockpars_fgrids,
//
This
is
too
large
to
be
allocated
in
__constant
int
dockpars_rotbondlist_length,
...
...
@@ -241,6 +244,9 @@ gpu_gen_and_eval_newpops(
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
//
g1
=
gridsize_x
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
...
...
device/kernel_gradient.cl
View file @
43feab9e
//
Gradient-based
steepest
descent
minimizer
//
Alternative
to
Solis-Wetts
//#define
DEBUG_MINIMIZER
#
define
TRANGENE_ALPHA
1E-3//1E-8
#
define
ROTAGENE_ALPHA
1E-8//1E-15
#
define
TORSGENE_ALPHA
1E-13//1E-4
__kernel
void
__attribute__
((
reqd_work_group_size
(
NUM_OF_THREADS_PER_BLOCK,1,1
)))
gradient_minimizer
(
char
dockpars_num_of_atoms,
...
...
@@ -15,6 +9,9 @@ gradient_minimizer(
char
dockpars_gridsize_x,
char
dockpars_gridsize_y,
char
dockpars_gridsize_z,
//
g1
=
gridsize_x
uint
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
uint
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
float
dockpars_grid_spacing,
__global
const
float*
restrict
dockpars_fgrids,
//
This
is
too
large
to
be
allocated
in
__constant
int
dockpars_rotbondlist_length,
...
...
@@ -48,9 +45,12 @@ gradient_minimizer(
__constant
int*
num_rotating_atoms_per_rotbond_const,
//
Specific
gradient-minimizer
args
uint
gradMin_maxiters,
uint
gradMin_maxfails,
uint
gradMin_maxfails
/*
,
float
gradMin_alpha,
__constant
float*
gradMin_conformation_min_perturbation
//
minimal
values
for
gene
perturbation,
originally
as
the
scalar
"dxmin"
*/
)
//The
GPU
global
function
performs
gradient-based
minimization
on
(
some
)
entities
of
conformations_next.
//The
number
of
OpenCL
compute
units
(
CU
)
which
should
be
started
equals
to
num_of_minEntities*num_of_runs.
...
...
@@ -87,6 +87,16 @@ gradient_minimizer(
///*
run_id
=
get_group_id
(
0
)
/
dockpars_num_of_lsentities
;
entity_id
=
get_group_id
(
0
)
%
dockpars_num_of_lsentities
;
//
Since
entity
0
is
the
best
one
due
to
elitism,
//
it
should
be
subjected
to
random
selection
if
(
entity_id
==
0
)
{
//
If
entity
0
is
not
selected
according
to
LS-rate,
//
choosing
an
other
entity
if
(
100.0f*gpu_randf
(
dockpars_prng_states
)
>
dockpars_lsearch_rate
)
{
entity_id
=
dockpars_num_of_lsentities
;
}
}
//*/
energy
=
dockpars_energies_next[run_id*dockpars_pop_size+entity_id]
;
...
...
@@ -247,6 +257,9 @@ gradient_minimizer(
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
//
g1
=
gridsize_x
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
...
...
@@ -370,6 +383,9 @@ gradient_minimizer(
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
//
g1
=
gridsize_x
dockpars_gridsize_x_times_y,
//
g2
=
gridsize_x
*
gridsize_y
dockpars_gridsize_x_times_y_times_z,
//
g3
=
gridsize_x
*
gridsize_y
*
gridsize_z
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
...
...
@@ -431,7 +447,7 @@ gradient_minimizer(
genotype
[i]
=
candidate_genotype[i]
;
//
Up-scaling
alpha
by
one
order
magnitud
alpha
=
alpha*/*10*/
(
5/
(
failure_cnt
==
0?
(
failure_cnt+1
)
:
(
failure_cnt
)))
;
alpha
=
alpha*/*10*/
(
5/
(
failure_cnt
==
0?
1
:
(
failure_cnt
)))
;
#
if
defined
(
DEBUG_MINIMIZER
)
//printf
(
"(%-3u) %-15.15f %-10.10f %-10.10f %-10.10f\n"
,
i,
alpha,
genotype[i],
gradient[i],
candidate_genotype[i]
)
;
...
...
host/inc/performdocking.h
View file @
43feab9e
...
...
@@ -59,8 +59,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
typedef
struct
{
unsigned
int
max_num_of_iters
;
unsigned
int
max_num_of_consec_fails
;
/*
float alpha;
float conformation_min_perturbation [ACTUAL_GENOTYPE_LENGTH];
*/
}
Gradientparameters
;
int
docking_with_gpu
(
const
Gridinfo
*
mygrid
,
...
...
host/src/performdocking.cpp
View file @
43feab9e
This diff is collapsed.
Click to expand it.
stringify_ocl_krnls.sh
View file @
43feab9e
...
...
@@ -19,7 +19,6 @@ IN_KERNELa=$KERNEL_DIR/"auxiliary_genetic.cl"
IN_KERNEL3
=
$KERNEL_DIR
/
"kernel3.cl"
IN_KERNEL4
=
$KERNEL_DIR
/
"kernel4.cl"
IN_KERNELb
=
$KERNEL_DIR
/
"calcgradient.cl"
IN_KERNELc
=
$KERNEL_DIR
/
"auxiliary_gradient.cl"
IN_KERNEL5
=
$KERNEL_DIR
/
"kernel_gradient.cl"
echo
" "
...
...
@@ -31,7 +30,6 @@ echo $IN_KERNELa
echo
$IN_KERNEL3
echo
$IN_KERNEL4
echo
$IN_KERNELb
echo
$IN_KERNELc
echo
$IN_KERNEL5
# output file
...
...
@@ -59,7 +57,6 @@ sed 's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/' $IN_KERNELa >> $TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNEL3
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNEL4
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNELb
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNELc
>>
$TMP
sed
's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/\\n"/'
$IN_KERNEL5
>>
$TMP
echo
";"
>>
$TMP
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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