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
43aa19f1
Commit
43aa19f1
authored
Apr 19, 2018
by
Leonardo Solis
Browse files
hardcoded different alphas for gene-type
parent
d6f2d704
Changes
6
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
43aa19f1
...
...
@@ -203,7 +203,7 @@ odock: check-env-all stringify $(SRC)
PDB
:=
7cpa
NRUN
:=
1
POPSIZE
:=
1
0
POPSIZE
:=
1
TESTNAME
:=
test
test
:
odock
...
...
device/auxiliary_gradient.cl
View file @
43aa19f1
#
define
DEBUG_GRADDESC_ENABLED
//
Implementation
of
auxiliary
functions
//
for
the
gradient-based
minimizer
...
...
@@ -8,6 +10,7 @@ void is_gradDescent_enabled(
__local
uint*
local_nIter,
uint
gradMin_maxiter,
__local
float*
local_perturbation,
__local
float*
local_genotype,
__constant
float*
gradMin_conformation_min_perturbation,
uint
gradMin_numElements,
__local
bool*
is_gradDescentEn
...
...
@@ -18,11 +21,23 @@ void is_gradDescent_enabled(
bool
is_perturb_gt_genotype
;
if
(
get_local_id
(
0
)
==
0
)
{
is_gNorm_gt_gMin
=
(
local_gNorm[0]
>=
gradMin_tol
)
;
is_nIter_lt_maxIter
=
(
local_nIter[0]
<=
gradMin_maxiter
)
;
is_perturb_gt_genotype
=
true
;
//is_gNorm_gt_gMin
=
(
local_gNorm[0]
>=
gradMin_tol
)
;
is_nIter_lt_maxIter
=
(
local_nIter[0]
<
gradMin_maxiter
)
;
//is_perturb_gt_genotype
=
true
;
}
//
Verifying
that
Shoemake
genes
do
not
get
out
of
valid
range.
//
If
they
do
so,
then
set
them
to
0.0f
if
(
get_local_id
(
0
)
<
3
)
{
if
((
local_genotype[get_local_id
(
0
)
]
<
0.0f
)
&&
(
local_genotype[get_local_id
(
0
)
]
>
1.0f
))
{
local_genotype[get_local_id
(
0
)
]
=
0.0f
;
}
}
#
if
0
//
For
every
gene,
let
's
determine
//
if
perturbation
is
greater
than
min
conformation
for
(
uint
i
=
get_local_id
(
0
)
;
...
...
@@ -30,41 +45,45 @@ void is_gradDescent_enabled(
i+=
NUM_OF_THREADS_PER_BLOCK
)
{
is_perturb_gt_gene_min[i]
=
(
local_perturbation[i]
>=
gradMin_conformation_min_perturbation[i]
)
;
}
#
endif
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
if
(
get_local_id
(
0
)
==
0
)
{
#
if
0
//
Reduce
all
is_perturb_gt_gene_min
's
//
into
their
corresponding
genotype
for
(
uint
i
=
0
;
i
<
gradMin_numElements
;
i++
)
{
is_perturb_gt_genotype
=
is_perturb_gt_genotype
&&
is_perturb_gt_gene_min[i]
;
/*
#
if
defined
(
DEBUG_GRADDESC_ENABLED
)
printf
(
"is_perturb_gt_gene_min[%u]?: %s\n"
,
i,
(
is_perturb_gt_gene_min[i]
==
true
)
?
"yes"
:
"no"
)
;
*/
#
endif
}
#
endif
//
Reduce
all
three
previous
//
partial
evaluations
(
gNorm,
nIter,
perturb
)
into
a
final
one
//*is_gradDescentEn
=
is_gNorm_gt_gMin
&&
is_nIter_lt_maxIter
&&
is_perturb_gt_genotype
;
*is_gradDescentEn
=
is_gNorm_gt_gMin
&&
is_nIter_lt_maxIter
&&
is_perturb_gt_genotype
;
/*
*is_gradDescentEn
=
is_nIter_lt_maxIter
;
#
if
1
#
if
defined
(
DEBUG_GRADDESC_ENABLED
)
if
(
get_local_id
(
0
)
==
0
)
{
printf
(
"is_gNorm_gt_gMin?: %s\n"
,
(
is_gNorm_gt_gMin
==
true
)
?
"yes"
:
"no"
)
;
printf
(
"is_nIter_lt_maxIter?: %s\n"
,
(
is_nIter_lt_maxIter
==
true
)
?
"yes"
:
"no"
)
;
printf
(
"is_perturb_gt_genotype?: %s\n"
,
(
is_perturb_gt_genotype
==
true
)
?
"yes"
:
"no"
)
;
//
printf
(
"is_gNorm_gt_gMin?: %s\n"
,
(
is_gNorm_gt_gMin
==
true
)
?
"yes"
:
"no"
)
;
//
printf
(
"is_nIter_lt_maxIter?: %s\n"
,
(
is_nIter_lt_maxIter
==
true
)
?
"yes"
:
"no"
)
;
//
printf
(
"is_perturb_gt_genotype?: %s\n"
,
(
is_perturb_gt_genotype
==
true
)
?
"yes"
:
"no"
)
;
printf
(
"Continue gradient iteration?: %s\n"
,
(
*is_gradDescentEn
==
true
)
?
"yes"
:
"no"
)
;
}
*/
}
#
endif
#
endif
/*
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
return
*is_gradDescentEn
;
*/
}
}
void
gradient_norm
(
...
...
device/calcgradient.cl
View file @
43aa19f1
...
...
@@ -574,9 +574,8 @@ void gpu_calc_gradient(
//
Getting
atom
IDs
uint
atom1_id
=
intraE_contributors_const[3*contributor_counter]
;
uint
atom2_id
=
intraE_contributors_const[3*contributor_counter+1]
;
///*
printf
(
"%-5u %-5u %-5u\n"
,
contributor_counter,
atom1_id,
atom2_id
)
;
//*/
//printf
(
"%-5u %-5u %-5u\n"
,
contributor_counter,
atom1_id,
atom2_id
)
;
//
Calculating
vector
components
of
vector
going
//
from
first
atom
's
to
second
atom
's
coordinates
...
...
device/kernel_gradient.cl
View file @
43aa19f1
...
...
@@ -5,6 +5,10 @@
#
define
DEBUG_MINIMIZER
#
define
TRANGENE_ALPHA
1E-8
#
define
ROTAGENE_ALPHA
1E-15
#
define
TORSGENE_ALPHA
1E-3
//
FIXME:
original
call
of
stepGPU
//
stepGPU<<<iDivUp
(
M,
BLOCK_SIZE
)
,
BLOCK_SIZE>>>
...
...
@@ -209,6 +213,7 @@ gradient_minimizer(
//
-----------------------------------------------------------------------------
//
Perform
gradient-descent
iterations
#
if
0
//
7cpa
float
grid_center_x
=
49.836
;
float
grid_center_y
=
17.609
;
...
...
@@ -219,26 +224,25 @@ gradient_minimizer(
float
shoemake_gene_u1
=
0.02
;
float
shoemake_gene_u2
=
0.23
;
float
shoemake_gene_u3
=
0.95
;
#
endif
/*
//
3tmn
float
grid_center_x
=
52.340
;
float
grid_center_y
=
15.029
;
float
grid_center_z
=
-2.932
;
float
ligand_center_x
=
52.22740741
;
float
ligand_center_y
=
15.51751852
;
float
ligand_center_z
=
-2.40896296
;
*/
#
if
0
//
3tmn
float
grid_center_x
=
52.340
;
float
grid_center_y
=
15.029
;
float
grid_center_z
=
-2.932
;
float
ligand_center_x
=
52.22740741
;
float
ligand_center_y
=
15.51751852
;
float
ligand_center_z
=
-2.40896296
;
#
endif
do
{
/*
#
if
0
//
Specific
input
genotypes
for
a
ligand
with
no
rotatable
bonds
(
1ac8
)
.
//
Translation
genes
must
be
expressed
in
grids
in
OCLADock
(
local_genotype
[0|1|2]
)
.
//
However,
for
testing
purposes,
//
we
start
using
translation
values
in
real
space
(
Angstrom
)
:
{31.79575,
93.743875
,
47.699875}
//
Rotation
genes
are
exp5.96902604
/
(
2*math.pi
)
resed
in
the
Shoemake
space:
local_genotype
[3|4|5]
//
Rotation
genes
are
expresed
in
the
Shoemake
space:
local_genotype
[3|4|5]
//
xyz_gene_gridspace
=
gridcenter_gridspace
+
(
input_gene_realspace
-
gridcenter_realspace
)
/gridsize
//
1ac8
...
...
@@ -248,11 +252,10 @@ resed in the Shoemake space: local_genotype [3|4|5]
local_genotype[3]
=
0.1f
;
local_genotype[4]
=
0.5f
;
local_genotype[5]
=
0.9f
;
*/
#
endif
///*
#
if
0
//
3tmn
local_genotype[0]
=
30
+
(
ligand_center_x
-
grid_center_x
)
/
0.375
;
local_genotype[1]
=
30
+
(
ligand_center_y
-
grid_center_y
)
/
0.375
;
local_genotype[2]
=
30
+
(
ligand_center_z
-
grid_center_z
)
/
0.375
;
...
...
@@ -274,9 +277,7 @@ resed in the Shoemake space: local_genotype [3|4|5]
local_genotype[18]
=
0.0f
;
local_genotype[19]
=
0.0f
;
local_genotype[20]
=
0.0f
;
//*/
#
endif
//
Calculating
gradient
//
=============================================================
...
...
@@ -342,20 +343,24 @@ resed in the Shoemake space: local_genotype [3|4|5]
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
#
if
defined
(
DEBUG_MINIMIZER
)
if
(
get_local_id
(
0
)
==
0
)
{
for
(
uint
i=0
; i<dockpars_num_of_genes; i++) {
printf
(
"AFTER- GRADIENT - local_gradient[%u]: %f\n"
,
i,
local_gradient[i]
)
;
}
}
#
endif
float
alpha
;
for
(
uint
i
=
get_local_id
(
0
)
;
i
<
dockpars_num_of_genes
;
i+=
NUM_OF_THREADS_PER_BLOCK
)
{
//
Taking
step
local_genotype_new[i]
=
local_genotype[i]
-
gradMin_alpha
*
local_gradient[i]
;
//local_genotype_new[i]
=
local_genotype[i]
-
gradMin_alpha
*
local_gradient[i]
;
if
(
i<3
)
{
alpha
=
TRANGENE_ALPHA
; }
else
if
(
i<6
)
{
alpha
=
ROTAGENE_ALPHA
; }
else
{
alpha
=
TORSGENE_ALPHA
; }
local_genotype_new[i]
=
local_genotype[i]
-
alpha
*
local_gradient[i]
;
#
if
defined
(
DEBUG_MINIMIZER
)
printf
(
"(%u) %-15.15f %-10.10f %-10.10f %-10.10f\n"
,
i,
alpha,
local_genotype[i],
local_gradient[i],
local_genotype_new[i]
)
;
#
endif
//
Updating
termination
metrics
local_genotype_diff[i]
=
local_genotype_new[i]
-
local_genotype[i]
;
...
...
@@ -370,8 +375,15 @@ resed in the Shoemake space: local_genotype [3|4|5]
//
Updating
number
of
stepest-descent
iterations
if
(
get_local_id
(
0
)
==
0
)
{
local_nIter
=
local_nIter
+
1
;
#
if
defined
(
DEBUG_MINIMIZER
)
printf
(
"Number of grad-minimizer iterations: %u\n"
,
local_nIter
)
;
#
endif
}
//
Storing
the
norm
of
all
gradients
gradient_norm
(
local_gradient,
dockpars_num_of_genes,
dotProduct,
&local_gNorm
)
;
...
...
@@ -389,13 +401,6 @@ resed in the Shoemake space: local_genotype [3|4|5]
printf
(
"Entity: %u, Run: %u, minimized E: %f\n"
,
entity_id,
run_id,
local_energy
)
;
}
*/
///*
if
(
get_local_id
(
0
)
==
0
)
{
printf
(
"Number of gradient iterations: %u\n"
,
local_nIter
)
;
}
//*/
is_gradDescent_enabled
(
is_perturb_gt_gene_min,
&local_gNorm,
...
...
@@ -403,6 +408,7 @@ resed in the Shoemake space: local_genotype [3|4|5]
&local_nIter,
gradMin_maxiter,
local_perturbation,
local_genotype,
gradMin_conformation_min_perturbation,
dockpars_num_of_genes,
&is_gradDescentEn
...
...
@@ -411,7 +417,7 @@ resed in the Shoemake space: local_genotype [3|4|5]
//
-----------------------------------------------------------------------------
/*
#
if
0
//
1ac8
local_genotype[0]
=
30
+
(
31.79575
-
31.924
)
/
0.375
;
local_genotype[1]
=
30
+
(
93.743875
-
93.444
)
/
0.375
;
...
...
@@ -419,33 +425,32 @@ resed in the Shoemake space: local_genotype [3|4|5]
local_genotype[3]
=
0.1f
;
local_genotype[4]
=
0.5f
;
local_genotype[5]
=
0.9f
;
*/
#
endif
///*
#
if
0
//
7cpa
local_genotype[0]
=
30
+
(
ligand_center_x
-
grid_center_x
)
/
0.375
;
local_genotype[1]
=
30
+
(
ligand_center_y
-
grid_center_y
)
/
0.375
;
local_genotype[2]
=
30
+
(
ligand_center_z
-
grid_center_z
)
/
0.375
;
local_genotype[3]
=
shoemake_gene_u1
;
local_genotype[4]
=
shoemake_gene_u2
;
local_genotype[5]
=
shoemake_gene_u3
;
local_genotype[6]
=
0.0f
;
local_genotype[7]
=
0.0f
;
local_genotype[8]
=
0.0f
;
local_genotype[9]
=
0.0f
;
local_genotype[10]
=
0.0f
;
local_genotype[11]
=
0.0f
;
local_genotype[12]
=
0.0f
;
local_genotype[13]
=
0.0f
;
local_genotype[14]
=
0.0f
;
local_genotype[15]
=
0.0f
;
local_genotype[16]
=
0.0f
;
local_genotype[17]
=
0.0f
;
local_genotype[18]
=
0.0f
;
local_genotype[19]
=
0.0f
;
local_genotype[20]
=
0.0f
;
//*/
local_genotype[6]
=
0.0f
;
local_genotype[7]
=
0.0f
;
local_genotype[8]
=
0.0f
;
local_genotype[9]
=
0.0f
;
local_genotype[10]
=
0.0f
;
local_genotype[11]
=
0.0f
;
local_genotype[12]
=
0.0f
;
local_genotype[13]
=
0.0f
;
local_genotype[14]
=
0.0f
;
local_genotype[15]
=
0.0f
;
local_genotype[16]
=
0.0f
;
local_genotype[17]
=
0.0f
;
local_genotype[18]
=
0.0f
;
local_genotype[19]
=
0.0f
;
local_genotype[20]
=
0.0f
;
#
endif
//
Calculating
energy
//
=============================================================
...
...
host/src/getparameters.cpp
View file @
43aa19f1
...
...
@@ -785,13 +785,13 @@ void gen_initpop_and_reflig(Dockpars* mypars,
// These specific values for the rotation genes (in Shoemake space)
// correspond to a quaternion for NO rotation.
ref_ori_angles
[
3
*
i
]
=
0.0
f
;
ref_ori_angles
[
3
*
i
+
1
]
=
0.25
f
;
ref_ori_angles
[
3
*
i
+
2
]
=
0.0
f
;
//
ref_ori_angles[3*i] = 0.0f;
//
ref_ori_angles[3*i+1] = 0.25f;
//
ref_ori_angles[3*i+2] = 0.0f;
//#else
//
ref_ori_angles[3*i] = ((float) rand()/ (float) RAND_MAX); // u1
//
ref_ori_angles[3*i+1] = ((float) rand()/ (float) RAND_MAX); // u2
//
ref_ori_angles[3*i+2] = ((float) rand()/ (float) RAND_MAX); // u3
ref_ori_angles
[
3
*
i
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
// u1
ref_ori_angles
[
3
*
i
+
1
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
// u2
ref_ori_angles
[
3
*
i
+
2
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
// u3
//printf("u1, u2, u3: %10f %10f %10f \n", ref_ori_angles[3*i], ref_ori_angles[3*i+1], ref_ori_angles[3*i+2]);
//#endif
}
...
...
host/src/performdocking.cpp
View file @
43aa19f1
...
...
@@ -409,23 +409,23 @@ filled with clock() */
// This should be ultimately configurable by the user as program exec. flags.
Gradientparameters
gradientpars
;
gradientpars
.
tolerance
=
1.e-6
;
gradientpars
.
max_num_of_iters
=
300
;
// Same as Solis-Wetts local search
gradientpars
.
alpha
=
0.00001
f
;
//0.001f; // TODO: find out why 0.001f, 0.0001f (100 runs, 500 popsize) throws segmentation fault
gradientpars
.
max_num_of_iters
=
4
;
// Same as Solis-Wetts local search
gradientpars
.
alpha
=
0.0000
0
1
f
;
//0.001f; // TODO: find out why 0.001f, 0.0001f (100 runs, 500 popsize) throws segmentation fault
gradientpars
.
h
=
0.0001
f
;
// Set minimum values for input conformation (translation genes as x, y, z)
for
(
unsigned
int
gene_cnt
=
0
;
gene_cnt
<
3
;
gene_cnt
++
)
{
gradientpars
.
conformation_min_perturbation
[
0
]
=
1e-5
;
// FIXME: set right min values
gradientpars
.
conformation_min_perturbation
[
0
]
=
1e-5
;
// FIXME: set right min values
max .1/.375
}
// Set minimum values for input conformation (rotation genes as Shoemake genes)
for
(
unsigned
int
gene_cnt
=
3
;
gene_cnt
<
6
;
gene_cnt
++
)
{
gradientpars
.
conformation_min_perturbation
[
0
]
=
0.0
1
f
;
gradientpars
.
conformation_min_perturbation
[
0
]
=
0.0
005
f
;
//max 0.01
}
// Set minimum values for input conformations (torsion genes as angles)
for
(
unsigned
int
gene_cnt
=
6
;
gene_cnt
<
(
dockpars
.
num_of_genes
-
6
);
gene_cnt
++
)
{
gradientpars
.
conformation_min_perturbation
[
0
]
=
5.0
f
;
// FIXME: set right min values
gradientpars
.
conformation_min_perturbation
[
0
]
=
0.1
f
;
// FIXME: set right min values
max 1.0
}
cl_mem
mem_gradpars_conformation_min_perturbation
;
...
...
Write
Preview
Supports
Markdown
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