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
6d8cf12e
Commit
6d8cf12e
authored
Apr 03, 2018
by
Leonardo Solis
Browse files
first version in Shoemake-space for rotation genes, works nrun=5, popsize=10
parent
d3275d6f
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
6d8cf12e
...
...
@@ -197,11 +197,12 @@ odock: check-env-all stringify $(SRC)
# Example
PDB
:=
3ce3
NRUN
:=
100
NRUN
:=
5
POPSIZE
:=
10
TESTNAME
:=
test
test
:
odock
$(BIN_DIR)
/
$(TARGET)
-ffile
./input/
$(PDB)
/derived/
$(PDB)
_protein.maps.fld
-lfile
./input/
$(PDB)
/derived/
$(PDB)
_ligand.pdbqt
-nrun
$(NRUN)
-resnam
$(TESTNAME)
-gfpop
1
$(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
clean
:
rm
-f
$(BIN_DIR)
/
*
initpop.txt
device/calcenergy.cl
View file @
6d8cf12e
...
...
@@ -88,8 +88,32 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
float
weights[2][2][2]
;
int
x_low,
x_high,
y_low,
y_high,
z_low,
z_high
;
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
//
Original
code
commented
out
/*
float
phi,
theta,
genrotangle,
rotation_angle,
sin_angle
;
float
genrot_unitvec[3],
rotation_unitvec[3],
rotation_movingvec[3]
;
*/
float
rotation_angle,
sin_angle
;
float
rotation_unitvec[3],
rotation_movingvec[3]
;
int
rotation_counter,
rotation_list_element
;
float
atom_to_rotate[3]
;
int
atom_id,
rotbond_id
;
...
...
@@ -107,13 +131,53 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
//CALCULATE
CONFORMATION
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
/*
//calculate
vectors
for
general
rotation
phi
=
genotype[3]*DEG_TO_RAD
;
theta
=
genotype[4]*DEG_TO_RAD
;
genrotangle
=
genotype[5]*DEG_TO_RAD
;
*/
//
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
;
#
if
defined
(
IMPROVE_GRID
)
#
if
defined
(
IMPROVE_GRID
)
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
//
Original
code
is
commented
out
/*
#
if
defined
(
NATIVE_PRECISION
)
sin_angle
=
native_sin
(
theta
)
;
genrot_unitvec
[0]
=
sin_angle*native_cos
(
phi
)
;
...
...
@@ -130,6 +194,7 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
genrot_unitvec
[1]
=
sin_angle*sin
(
phi
)
;
genrot_unitvec
[2]
=
cos
(
theta
)
;
#
endif
*/
//
INTERMOLECULAR
for-loop
(
intermediate
results
)
//
It
stores
a
product
of
two
chars
...
...
@@ -137,25 +202,43 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
unsigned
char
g1
=
dockpars_gridsize_x
;
unsigned
int
g2
=
dockpars_gridsize_x
*
dockpars_gridsize_y
;
unsigned
int
g3
=
dockpars_gridsize_x
*
dockpars_gridsize_y
*
dockpars_gridsize_z
;
unsigned
int
g3
=
dockpars_gridsize_x
*
dockpars_gridsize_y
*
dockpars_gridsize_z
;
unsigned
int
ylow_times_g1,
yhigh_times_g1
;
unsigned
int
zlow_times_g2,
zhigh_times_g2
;
unsigned
int
cube_000
;
unsigned
int
cube_100
;
unsigned
int
cube_010
;
unsigned
int
cube_010
;
unsigned
int
cube_110
;
unsigned
int
cube_001
;
unsigned
int
cube_101
;
unsigned
int
cube_011
;
unsigned
int
cube_111
;
unsigned
int
cube_101
;
unsigned
int
cube_011
;
unsigned
int
cube_111
;
#
else
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
//
Original
code
commented
out
/*
sin_angle
=
sin
(
theta
)
;
genrot_unitvec
[0]
=
sin_angle*cos
(
phi
)
;
genrot_unitvec
[1]
=
sin_angle*sin
(
phi
)
;
genrot_unitvec
[2]
=
cos
(
theta
)
;
*/
#
endif
//
================================================
...
...
@@ -188,12 +271,36 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
//capturing
rotation
vectors
and
angle
if
((
rotation_list_element
&
RLIST_GENROT_MASK
)
!=
0
)
//if
general
rotation
{
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
/*
rotation_unitvec[0]
=
genrot_unitvec[0]
;
rotation_unitvec[1]
=
genrot_unitvec[1]
;
rotation_unitvec[2]
=
genrot_unitvec[2]
;
rotation_angle
=
genrotangle
;
rotation_angle
=
genrotangle
;rotation_unitvec
*/
//
Moved
back
in
here
//
Transforming
Shoemake
(
u1,
u2,
u3
)
into
quaternions
//
FIXME:
add
precision
choices
with
preprocessor
directives:
//
NATIVE_PRECISION,
HALF_PRECISION,
Full
precision
quatrot_left_q
=
sqrt
(
1
-
u1
)
*
sin
(
u2
)
;
quatrot_left_x
=
sqrt
(
1
-
u1
)
*
cos
(
u2
)
;
quatrot_left_y
=
sqrt
(
u1
)
*
sin
(
u3
)
;
quatrot_left_z
=
sqrt
(
u1
)
*
cos
(
u3
)
;
//
Kept
as
the
original
rotation_movingvec[0]
=
genotype[0]
;
rotation_movingvec[1]
=
genotype[1]
;
rotation_movingvec[2]
=
genotype[2]
;
...
...
@@ -215,26 +322,82 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
atom_to_rotate[0]
-=
rotation_movingvec[0]
;
atom_to_rotate[1]
-=
rotation_movingvec[1]
;
atom_to_rotate[2]
-=
rotation_movingvec[2]
;
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
//
Moved
back
in
here
//
Transforming
torsion
angles
into
quaternions
//
FIXME:
add
precision
choices
with
preprocessor
directives:
//
NATIVE_PRECISION,
HALF_PRECISION,
Full
precision
rotation_angle
=
rotation_angle/2
;
quatrot_left_q
=
cos
(
rotation_angle
)
;
sin_angle
=
sin
(
rotation_angle
)
;
quatrot_left_x
=
sin_angle*rotation_unitvec[0]
;
quatrot_left_y
=
sin_angle*rotation_unitvec[1]
;
quatrot_left_z
=
sin_angle*rotation_unitvec[2]
;
}
//performing
rotation
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
//
Original
code
is
commented
out
//
The
purpose
of
this
block
of
code
is
to
ultimately
//
calculate
quatrot_left_q,
quatrot_left_x,
quatrot_left_y,
quatrot_left_z.
//
The
calculation
of
these
is
moved
to
each
respective
case:
//
a
)
if
generarl
rotation,
b
)
if
rotating
around
rotatable
bond
/*
#
if
defined
(
NATIVE_PRECISION
)
rotation_angle
=
native_divide
(
rotation_angle,2
)
;
quatrot_left_q
=
native_cos
(
rotation_angle
)
;
sin_angle
=
native_sin
(
rotation_angle
)
;
sin_angle
=
native_sin
(
rotation_angle
)
;
#
elif
defined
(
HALF_PRECISION
)
rotation_angle
=
half_divide
(
rotation_angle,2
)
;
quatrot_left_q
=
half_cos
(
rotation_angle
)
;
sin_angle
=
half_sin
(
rotation_angle
)
;
sin_angle
=
half_sin
(
rotation_angle
)
;
#
else
//
Full
precision
rotation_angle
=
rotation_angle/2
;
quatrot_left_q
=
cos
(
rotation_angle
)
;
sin_angle
=
sin
(
rotation_angle
)
;
sin_angle
=
sin
(
rotation_angle
)
;
#
endif
quatrot_left_x
=
sin_angle*rotation_unitvec[0]
;
quatrot_left_y
=
sin_angle*rotation_unitvec[1]
;
quatrot_left_z
=
sin_angle*rotation_unitvec[2]
;
*/
if
((
rotation_list_element
&
RLIST_GENROT_MASK
)
!=
0
)
//
if
general
rotation,
//
two
rotations
should
be
performed
...
...
@@ -248,53 +411,53 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
quatrot_temp_z
=
quatrot_left_z
;
quatrot_left_q
=
quatrot_temp_q*ref_orientation_quats_const[4*
(
*run_id
)
]-
quatrot_temp_x*ref_orientation_quats_const[4*
(
*run_id
)
+1]-
quatrot_temp_y*ref_orientation_quats_const[4*
(
*run_id
)
+2]-
quatrot_temp_z*ref_orientation_quats_const[4*
(
*run_id
)
+3]
;
quatrot_temp_x*ref_orientation_quats_const[4*
(
*run_id
)
+1]-
quatrot_temp_y*ref_orientation_quats_const[4*
(
*run_id
)
+2]-
quatrot_temp_z*ref_orientation_quats_const[4*
(
*run_id
)
+3]
;
quatrot_left_x
=
quatrot_temp_q*ref_orientation_quats_const[4*
(
*run_id
)
+1]+
ref_orientation_quats_const[4*
(
*run_id
)
]*quatrot_temp_x+
quatrot_temp_y*ref_orientation_quats_const[4*
(
*run_id
)
+3]-
ref_orientation_quats_const[4*
(
*run_id
)
+2]*quatrot_temp_z
;
ref_orientation_quats_const[4*
(
*run_id
)
]*quatrot_temp_x+
quatrot_temp_y*ref_orientation_quats_const[4*
(
*run_id
)
+3]-
ref_orientation_quats_const[4*
(
*run_id
)
+2]*quatrot_temp_z
;
quatrot_left_y
=
quatrot_temp_q*ref_orientation_quats_const[4*
(
*run_id
)
+2]+
ref_orientation_quats_const[4*
(
*run_id
)
]*quatrot_temp_y+
ref_orientation_quats_const[4*
(
*run_id
)
+1]*quatrot_temp_z-
quatrot_temp_x*ref_orientation_quats_const[4*
(
*run_id
)
+3]
;
ref_orientation_quats_const[4*
(
*run_id
)
]*quatrot_temp_y+
ref_orientation_quats_const[4*
(
*run_id
)
+1]*quatrot_temp_z-
quatrot_temp_x*ref_orientation_quats_const[4*
(
*run_id
)
+3]
;
quatrot_left_z
=
quatrot_temp_q*ref_orientation_quats_const[4*
(
*run_id
)
+3]+
ref_orientation_quats_const[4*
(
*run_id
)
]*quatrot_temp_z+
quatrot_temp_x*ref_orientation_quats_const[4*
(
*run_id
)
+2]-
ref_orientation_quats_const[4*
(
*run_id
)
+1]*quatrot_temp_y
;
ref_orientation_quats_const[4*
(
*run_id
)
]*quatrot_temp_z+
quatrot_temp_x*ref_orientation_quats_const[4*
(
*run_id
)
+2]-
ref_orientation_quats_const[4*
(
*run_id
)
+1]*quatrot_temp_y
;
}
quatrot_temp_q
=
0
-
quatrot_left_x*atom_to_rotate
[0]
-
quatrot_left_y*atom_to_rotate
[1]
-
quatrot_left_z*atom_to_rotate
[2]
;
quatrot_left_x*atom_to_rotate
[0]
-
quatrot_left_y*atom_to_rotate
[1]
-
quatrot_left_z*atom_to_rotate
[2]
;
quatrot_temp_x
=
quatrot_left_q*atom_to_rotate
[0]
+
quatrot_left_y*atom_to_rotate
[2]
-
quatrot_left_z*atom_to_rotate
[1]
;
quatrot_left_y*atom_to_rotate
[2]
-
quatrot_left_z*atom_to_rotate
[1]
;
quatrot_temp_y
=
quatrot_left_q*atom_to_rotate
[1]
-
quatrot_left_x*atom_to_rotate
[2]
+
quatrot_left_z*atom_to_rotate
[0]
;
quatrot_left_x*atom_to_rotate
[2]
+
quatrot_left_z*atom_to_rotate
[0]
;
quatrot_temp_z
=
quatrot_left_q*atom_to_rotate
[2]
+
quatrot_left_x*atom_to_rotate
[1]
-
quatrot_left_y*atom_to_rotate
[0]
;
quatrot_left_x*atom_to_rotate
[1]
-
quatrot_left_y*atom_to_rotate
[0]
;
atom_to_rotate
[0]
=
0
-
quatrot_temp_q*quatrot_left_x
+
quatrot_temp_x*quatrot_left_q
-
quatrot_temp_y*quatrot_left_z
+
quatrot_temp_z*quatrot_left_y
;
quatrot_temp_q*quatrot_left_x
+
quatrot_temp_x*quatrot_left_q
-
quatrot_temp_y*quatrot_left_z
+
quatrot_temp_z*quatrot_left_y
;
atom_to_rotate
[1]
=
0
-
quatrot_temp_q*quatrot_left_y
+
quatrot_temp_x*quatrot_left_z
+
quatrot_temp_y*quatrot_left_q
-
quatrot_temp_z*quatrot_left_x
;
quatrot_temp_q*quatrot_left_y
+
quatrot_temp_x*quatrot_left_z
+
quatrot_temp_y*quatrot_left_q
-
quatrot_temp_z*quatrot_left_x
;
atom_to_rotate
[2]
=
0
-
quatrot_temp_q*quatrot_left_z
-
quatrot_temp_x*quatrot_left_y
+
quatrot_temp_y*quatrot_left_x
+
quatrot_temp_z*quatrot_left_q
;
quatrot_temp_q*quatrot_left_z
-
quatrot_temp_x*quatrot_left_y
+
quatrot_temp_y*quatrot_left_x
+
quatrot_temp_z*quatrot_left_q
;
//performing
final
movement
and
storing
values
calc_coords_x[atom_id]
=
atom_to_rotate
[0]
+
rotation_movingvec[0]
;
...
...
@@ -321,8 +484,8 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
q
=
atom_charges_const[atom1_id]
;
if
((
x
<
0
)
|
| (y < 0) || (z < 0) || (x >= dockpars_gridsize_x-1)
|| (y >= dockpars_gridsize_y-1)
|
|
(
z
>=
dockpars_gridsize_z-1
))
{
|| (y >= dockpars_gridsize_y-1)
|
|
(
z
>=
dockpars_gridsize_z-1
))
{
partial_energies[get_local_id
(
0
)
]
+=
16777216.0f
; //100000.0f;
}
else
...
...
device/kernel3.cl
View file @
6d8cf12e
...
...
@@ -162,10 +162,38 @@ perform_LS( char dockpars_num_of_atoms,
{
genotype_deviate[gene_counter]
=
rho*
(
2*gpu_randf
(
dockpars_prng_states
)
-1
)
;
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
//
Original
code
is
commented
out
/*
if
(
gene_counter
<
3
)
genotype_deviate[gene_counter]
*=
dockpars_base_dmov_mul_sqrt3
;
else
genotype_deviate[gene_counter]
*=
dockpars_base_dang_mul_sqrt3
;
*/
if
(
gene_counter
<
3
)
genotype_deviate[gene_counter]
*=
dockpars_base_dmov_mul_sqrt3
;
else
if
(
gene_counter
==
3
)
//
u1,
FIXME:
hardcoded
genotype_deviate[gene_counter]
*=
0.2f
;
else
if
(
gene_counter
<
6
)
//
u2&u3,
FIXME:
harcoded
genotype_deviate[gene_counter]
*=
90.0f
;
else
genotype_deviate[gene_counter]
*=
dockpars_base_dang_mul_sqrt3
;
}
//generating
new
genotype
candidate
...
...
@@ -370,11 +398,33 @@ perform_LS( char dockpars_num_of_atoms,
}
//mapping
angles
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
/*
for
(
gene_counter=get_local_id
(
0
)
;
gene_counter<dockpars_num_of_genes
;
gene_counter+=NUM_OF_THREADS_PER_BLOCK
)
if
(
gene_counter
>=
3
)
map_angle
(
&
(
offspring_genotype[gene_counter]
))
;
*/
for
(
gene_counter=get_local_id
(
0
)
;
gene_counter<dockpars_num_of_genes
;
gene_counter+=NUM_OF_THREADS_PER_BLOCK
)
if
(
gene_counter
>=
4
)
map_angle
(
&
(
offspring_genotype[gene_counter]
))
;
//updating
old
offspring
in
population
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
...
...
device/kernel4.cl
View file @
6d8cf12e
...
...
@@ -123,7 +123,8 @@ gpu_gen_and_eval_newpops(char dockpars_num_of_atoms,
best_ID
)
;
else
{
//generating
the
following
random
numbers:
[0..3]
for
parent
candidates,
//generating
the
following
random
numbers:
//[0..3]
for
parent
candidates,
//[4..5]
for
binary
tournaments,
[6]
for
deciding
crossover,
//[7..8]
for
crossover
points,
[9]
for
local
search
...
...
@@ -222,13 +223,45 @@ gpu_gen_and_eval_newpops(char dockpars_num_of_atoms,
{
if
(
100.0f*gpu_randf
(
dockpars_prng_states
)
<
dockpars_mutation_rate
)
{
//
-------------------------------------------------------------------
//
L30nardoSV
//
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
[6:N]:
torsions
->
kept
as
original
angles
(
all
in
sexagesimal
)
//
Shoemake
ranges:
//
u1:
[0,
1]
//
u2:
[0:
2PI]
or
[0:
360]
//
Random
generator
in
the
host
is
changed:
//
LCG
(
original,
myrand
())
->
CPP
std
(
rand
())
//
-------------------------------------------------------------------
//
Original
code
commented
out
/*
if
(
gene_counter
<
3
)
offspring_genotype[gene_counter]
+=
dockpars_abs_max_dmov*
(
2*gpu_randf
(
dockpars_prng_states
)
-1
)
;
else
{
offspring_genotype[gene_counter]
+=
dockpars_abs_max_dang*
(
2*gpu_randf
(
dockpars_prng_states
)
-1
)
;
map_angle
(
&
(
offspring_genotype[gene_counter]
))
;
}
*/
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*
(
2*gpu_randf
(
dockpars_prng_states
)
-1
)
;
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
{
offspring_genotype[gene_counter]
+=
dockpars_abs_max_dang*
(
2*gpu_randf
(
dockpars_prng_states
)
-1
)
;
map_angle
(
&
(
offspring_genotype[gene_counter]
))
;
}
}
}
...
...
host/inc/miscellaneous.h
View file @
6d8cf12e
...
...
@@ -66,8 +66,25 @@ double distance(const double [], const double []);
void
vec_point2line
(
const
double
[],
const
double
[],
const
double
[],
double
[]);
// -------------------------------------------------------------------
// L30nardoSV
// 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 [6:N]: torsions -> kept as original angles (all in sexagesimal)
// Shoemake ranges:
// u1: [0, 1]
// u2: [0: 2PI] or [0: 360]
// Random generator in the host is changed:
// LCG (original, myrand()) -> CPP std (rand())
// -------------------------------------------------------------------
void
rotate
(
double
[],
const
double
[],
const
double
[],
const
double
*
,
int
);
void
rotate_shoemake
(
double
[],
const
double
[],
const
double
[],
int
);
double
angle_of_vectors
(
const
double
[],
const
double
[]);
void
vec_crossprod
(
const
double
[],
const
double
[],
double
[]);
...
...
host/src/calcenergy.cpp
View file @
6d8cf12e
...
...
@@ -78,7 +78,22 @@ int prepare_const_fields_for_gpu(Liganddata* myligand_reference,
int
type_id1
,
type_id2
;
float
*
floatpoi
;
char
*
charpoi
;
float
phi
,
theta
,
genrotangle
;
// -------------------------------------------------------------------
// L30nardoSV
// 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 (all in radians)
// gene [6:N]: torsions -> kept as original angles (all in sexagesimal)
// Shoemake ranges:
// u1: [0, 1]
// u2: [0: 2PI]
// Random generator in the host is changed:
// LCG (original, myrand()) -> CPP std (rand())
// -------------------------------------------------------------------
//float phi, theta, genrotangle;
// ------------------------------
float
atom_charges
[
MAX_NUM_OF_ATOMS
];
...
...
@@ -212,6 +227,21 @@ int prepare_const_fields_for_gpu(Liganddata* myligand_reference,
{
//printf("Pregenerated angles for run %d: %f %f %f\n", i, cpu_ref_ori_angles[3*i], cpu_ref_ori_angles[3*i+1], cpu_ref_ori_angles[3*i+2]);
// -------------------------------------------------------------------
// L30nardoSV
// 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 [6:N]: torsions -> kept as original angles (all in sexagesimal)
// Shoemake ranges:
// u1: [0, 1]
// u2: [0: 2PI] or [0: 360]
// Random generator in the host is changed:
// LCG (original, myrand()) -> CPP std (rand())
// -------------------------------------------------------------------
/*
phi = cpu_ref_ori_angles[3*i]*DEG_TO_RAD;
theta = cpu_ref_ori_angles[3*i+1]*DEG_TO_RAD;
genrotangle = cpu_ref_ori_angles[3*i+2]*DEG_TO_RAD;
...
...
@@ -220,6 +250,19 @@ int prepare_const_fields_for_gpu(Liganddata* myligand_reference,
ref_orientation_quats[4*i+1] = sinf(genrotangle/2.0f)*sinf(theta)*cosf(phi); //x
ref_orientation_quats[4*i+2] = sinf(genrotangle/2.0f)*sinf(theta)*sinf(phi); //y
ref_orientation_quats[4*i+3] = sinf(genrotangle/2.0f)*cosf(theta); //z
*/
// Shoemake genes
// autodockdev/motions.py
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
;
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
//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 @
6d8cf12e
...
...
@@ -613,12 +613,12 @@ void gen_initpop_and_reflig(Dockpars* mypars,
// L30nardoSV
// 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 (
all in radians
)
// gene [3:5]: rotation -> transformed into Shoemake (
u1: adimensional, u2&u3: sexagesimal
)
// gene [6:N]: torsions -> kept as original angles (all in sexagesimal)
// Shoemake ranges:
// u1: [0, 1]
//