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
21ab85f0
Commit
21ab85f0
authored
Apr 06, 2018
by
Leonardo Solis
Browse files
redefined Shoemake genes limits all [0,1]
parent
7f3818e0
Changes
7
Hide whitespace changes
Inline
Side-by-side
common/calcenergy_basic.h
View file @
21ab85f0
...
...
@@ -57,4 +57,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
cube[0][0][1]*weights[0][0][1] +cube[1][0][1]*weights[1][0][1] + \
cube[0][1][1]*weights[0][1][1] +cube[1][1][1]*weights[1][1][1])
// Used for Shoemake to quternion transformation
#define PI_TIMES_2 (float)(2.0f*M_PI)
#endif
/* CALCENERGY_BASIC_H_ */
device/calcenergy.cl
View file @
21ab85f0
...
...
@@ -107,13 +107,14 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
}
}
#
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
;
u2
=
genotype[4]
/*
*DEG_TO_RAD
*/
;
u3
=
genotype[5]
/*
*DEG_TO_RAD
*/
;
#
endif
#
if
defined
(
IMPROVE_GRID
)
//
INTERMOLECULAR
for-loop
(
intermediate
results
)
...
...
@@ -182,11 +183,18 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
//
FIXME:
add
precision
choices
with
preprocessor
directives:
//
NATIVE_PRECISION,
HALF_PRECISION,
Full
precision
//
u1
should
be
within
the
valid
range
[0,1]
quatrot_left_q
=
native_sqrt
(
1
-
u1
)
*
native_sin
(
u2
)
;
quatrot_left_x
=
native_sqrt
(
1
-
u1
)
*
native_cos
(
u2
)
;
quatrot_left_y
=
native_sqrt
(
u1
)
*
native_sin
(
u3
)
;
quatrot_left_z
=
native_sqrt
(
u1
)
*
native_cos
(
u3
)
;
//
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*/
;
//
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
)
;
quatrot_left_x
=
native_sqrt
(
1
-
u1
)
*
native_cos
(
PI_TIMES_2*u2
)
;
quatrot_left_y
=
native_sqrt
(
u1
)
*
native_sin
(
PI_TIMES_2*u3
)
;
quatrot_left_z
=
native_sqrt
(
u1
)
*
native_cos
(
PI_TIMES_2*u3
)
;
rotation_movingvec[0]
=
genotype[0]
;
rotation_movingvec[1]
=
genotype[1]
;
...
...
@@ -705,7 +713,7 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
dockpars_gridsize_y,
dockpars_gridsize_z,
atom_typeid, z_low, y_low, x_low);
cube [1][0][0] = GETGRIDVALUE(dockpars_fgrids,
cube [1][0][0] = GETGRIDVALUE(dockpars_fgrids
u2
,
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
...
...
@@ -966,10 +974,10 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
// where we are in quaternion space
// current_q = cube3_to_quaternion(current_u)
float current_qw, current_qx, current_qy, current_qz;
current_qw = native_sqrt(1-current_u1) * native_sin(u2);
current_qx = native_sqrt(1-current_u1) * native_cos(u2);
current_qy = native_sqrt(current_u1) * native_sin(u3);
current_qz = native_sqrt(current_u1) * native_cos(u3);
current_qw = native_sqrt(1-current_u1) * native_sin(
PI_TIMES_2*current_
u2);
current_qx = native_sqrt(1-current_u1) * native_cos(
PI_TIMES_2*current_
u2);
current_qy = native_sqrt(current_u1) * native_sin(
PI_TIMES_2*current_
u3);
current_qz = native_sqrt(current_u1) * native_cos(
PI_TIMES_2*current_
u3);
// where we want to be in quaternion space
float target_qw, target_qx, target_qy, target_qz;
...
...
@@ -989,8 +997,8 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
// Derived from autodockdev/motions.py/quaternion_to_cube3()
// In our terms means quaternion_to_cube3(target_q{w|x|y|z}
)
target_u1
=
target_qy*target_qy
+
target_qz*target_qz
;
target_u2
=
atan2pi
(
target_qw,
target_qx
)
*180.0f
; // in sexagesimal
target_u3
=
atan2pi
(
target_qy,
target_qz
)
*180.0f
; // in sexagesimal
target_u2
=
atan2pi
(
target_qw,
target_qx
)
/PI_TIMES_2
;
target_u3
=
atan2pi
(
target_qy,
target_qz
)
/PI_TIMES_2
;
//
derivates
in
cube3
float
grad_u1,
grad_u2,
grad_u3
;
...
...
device/kernel3.cl
View file @
21ab85f0
...
...
@@ -228,8 +228,8 @@ perform_LS( char dockpars_num_of_atoms,
for
(
gene_counter=get_local_id
(
0
)
;
gene_counter<dockpars_num_of_genes
;
gene_counter
+=
NUM_OF_THREADS_PER_BLOCK
)
{
if
(
gene_counter
==
3
)
{
genotype_candidate[gene_counter]
=
/*0.2f**/
gpu_randf
(
dockpars_prng_states
)
;
if
(
(
gene_counter
>
2
)
|
| (gene_counter < 6)) { // Shoemake genes: u1, u2, u3
genotype_candidate[gene_counter] = gpu_randf(dockpars_prng_states);
}
else {
genotype_candidate[gene_counter] = offspring_genotype[gene_counter] + genotype_deviate[gene_counter] + genotype_bias[gene_counter];
...
...
@@ -348,8 +348,8 @@ perform_LS( char dockpars_num_of_atoms,
gene_counter<dockpars_num_of_genes;
gene_counter += NUM_OF_THREADS_PER_BLOCK) {
if
(
gene_counter
==
3
)
{
genotype_candidate[gene_counter]
=
/*0.2f**/
gpu_randf
(
dockpars_prng_states
)
;
if
(
(gene_counter
> 2) |
|
(
gene_counter
<
6
))
{
//
Shoemake
genes:
u1,
u2,
u3
genotype_candidate[gene_counter]
=
gpu_randf
(
dockpars_prng_states
)
;
}
else
{
genotype_candidate[gene_counter]
=
offspring_genotype[gene_counter]
-
genotype_deviate[gene_counter]
-
genotype_bias[gene_counter]
;
...
...
device/kernel4.cl
View file @
21ab85f0
...
...
@@ -276,27 +276,9 @@ gpu_gen_and_eval_newpops(char dockpars_num_of_atoms,
*/
if
(
gene_counter
<
3
)
offspring_genotype[gene_counter]
+=
dockpars_abs_max_dmov*
(
2*gpu_randf
(
dockpars_prng_states
)
-1
)
;
else
if
(
gene_counter
==
3
)
{//
u1,
FIXME:
hardcoded
offspring_genotype[gene_counter]
=
/*0.2f**/gpu_randf
(
dockpars_prng_states
)
;
/*
offspring_genotype[gene_counter]
+=
0.2f*
(
2*gpu_randf
(
dockpars_prng_states
)
-1
)
;
if
(
offspring_genotype[gene_counter]
>
1.0f
)
{
//
clamp
it
offspring_genotype[gene_counter]
=
0.9f
;
}
if
(
offspring_genotype[gene_counter]
<
0.0f
)
{
//
clamp
it
offspring_genotype[gene_counter]
=
0.1f
;
}
//printf
(
"mutation - offspring_genotype[gene_counter]: %f\n"
,
offspring_genotype[gene_counter]
)
;
*/
}
else
if
(
gene_counter
<
6
)
{
//
u2&3,
FIXME:
hardcoded
offspring_genotype[gene_counter]
+=
90.0f*
(
2*gpu_randf
(
dockpars_prng_states
)
-1
)
;
map_angle
(
&
(
offspring_genotype[gene_counter]
))
;
else
if
(
gene_counter
<
6
)
{
//
Shoemake
genes:
u1,
u2,
23
offspring_genotype[gene_counter]
=
gpu_randf
(
dockpars_prng_states
)
;
}
else
{
...
...
host/src/calcenergy.cpp
View file @
21ab85f0
...
...
@@ -256,13 +256,13 @@ int prepare_const_fields_for_gpu(Liganddata* myligand_reference,
float
u1
,
u2
,
u3
;
u1
=
cpu_ref_ori_angles
[
3
*
i
];
u2
=
cpu_ref_ori_angles
[
3
*
i
+
1
]
*
DEG_TO_RAD
;
u3
=
cpu_ref_ori_angles
[
3
*
i
+
2
]
*
DEG_TO_RAD
;
u2
=
cpu_ref_ori_angles
[
3
*
i
+
1
];
u3
=
cpu_ref_ori_angles
[
3
*
i
+
2
];
ref_orientation_quats
[
4
*
i
]
=
sqrt
(
1
-
u1
)
*
sinf
(
u2
);
//q
ref_orientation_quats
[
4
*
i
+
1
]
=
sqrt
(
1
-
u1
)
*
cosf
(
u2
);
//x
ref_orientation_quats
[
4
*
i
+
2
]
=
sqrt
(
u1
)
*
sinf
(
u3
);
//y
ref_orientation_quats
[
4
*
i
+
3
]
=
sqrt
(
u1
)
*
cosf
(
u3
);
//z
ref_orientation_quats
[
4
*
i
]
=
sqrt
(
1
-
u1
)
*
sinf
(
2
*
PI
*
u2
);
//q
ref_orientation_quats
[
4
*
i
+
1
]
=
sqrt
(
1
-
u1
)
*
cosf
(
2
*
PI
*
u2
);
//x
ref_orientation_quats
[
4
*
i
+
2
]
=
sqrt
(
u1
)
*
sinf
(
2
*
PI
*
u3
);
//y
ref_orientation_quats
[
4
*
i
+
3
]
=
sqrt
(
u1
)
*
cosf
(
2
*
PI
*
u3
);
//z
//printf("Precalculated quaternion for run %d: %f %f %f %f\n", i, ref_orientation_quats[4*i], ref_orientation_quats[4*i+1], ref_orientation_quats[4*i+2], ref_orientation_quats[4*i+3]);
}
...
...
host/src/getparameters.cpp
View file @
21ab85f0
...
...
@@ -648,19 +648,19 @@ void gen_initpop_and_reflig(Dockpars* mypars,
#if defined (REPRO)
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
22.0452
;
#else
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
)
*
360
;
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
#endif
else
if
(
gene_id
==
5
)
// u3 (Shoemake)
#if defined (REPRO)
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
26.0555
;
#else
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
)
*
360
;
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
#endif
else
// torsions
#if defined (REPRO)
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
22.0452
;
#else
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
)
*
360
;
init_populations
[
entity_id
*
GENOTYPE_LENGTH_IN_GLOBMEM
+
gene_id
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
#endif
...
...
@@ -700,9 +700,9 @@ void gen_initpop_and_reflig(Dockpars* mypars,
mypars
->
ref_ori_angles
[
1
]
=
190.279
;
mypars
->
ref_ori_angles
[
2
]
=
190.279
;
#else
mypars
->
ref_ori_angles
[
0
]
=
floor
(
(
float
)
rand
()
/
(
float
)
RAND_MAX
);
// u1
mypars
->
ref_ori_angles
[
1
]
=
floor
((
(
float
)
rand
()
/
(
float
)
RAND_MAX
)
*
360
)
;
// u2
mypars
->
ref_ori_angles
[
2
]
=
floor
((
(
float
)
rand
()
/
(
float
)
RAND_MAX
)
*
360
)
;
// u3
mypars
->
ref_ori_angles
[
0
]
=
floor
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
// u1
mypars
->
ref_ori_angles
[
1
]
=
floor
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
// u2
mypars
->
ref_ori_angles
[
2
]
=
floor
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
// u3
#endif
...
...
@@ -787,8 +787,8 @@ void gen_initpop_and_reflig(Dockpars* mypars,
ref_ori_angles
[
3
*
i
+
2
]
=
190.279
;
#else
ref_ori_angles
[
3
*
i
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
);
// u1
ref_ori_angles
[
3
*
i
+
1
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
)
*
360
;
// u2
ref_ori_angles
[
3
*
i
+
2
]
=
((
float
)
rand
()
/
(
float
)
RAND_MAX
)
*
360
;
// u3
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/processligand.cpp
View file @
21ab85f0
...
...
@@ -1281,12 +1281,12 @@ void change_conform_f(Liganddata* myligand,
genotype
[
i
]
=
genotype_f
[
i
];
shoemake
[
0
]
=
(
genotype
[
3
]);
shoemake
[
1
]
=
(
genotype
[
4
])
*
(
PI
/
180
);
shoemake
[
2
]
=
(
genotype
[
5
])
*
(
PI
/
180
);
shoemake
[
1
]
=
(
genotype
[
4
])
*
(
2
*
PI
);
shoemake
[
2
]
=
(
genotype
[
5
])
*
(
2
*
PI
);
refori_shoemake
[
0
]
=
(
cpu_ref_ori_angles
[
0
]);
refori_shoemake
[
1
]
=
(
cpu_ref_ori_angles
[
1
])
*
(
PI
/
180
);
refori_shoemake
[
2
]
=
(
cpu_ref_ori_angles
[
2
])
*
(
PI
/
180
);
refori_shoemake
[
1
]
=
(
cpu_ref_ori_angles
[
1
])
*
(
2
*
PI
);
refori_shoemake
[
2
]
=
(
cpu_ref_ori_angles
[
2
])
*
(
2
*
PI
);
// +++++++++++++++++++++++++++++++++++++++
// OCLADock
...
...
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