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
c9b5d2e2
Commit
c9b5d2e2
authored
Jul 10, 2018
by
lvs
Browse files
improved printfs + added case 2brt (4 tors)
parent
d7a0eb02
Changes
2
Hide whitespace changes
Inline
Side-by-side
device/calcgradient.cl
View file @
c9b5d2e2
...
@@ -34,10 +34,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
...
@@ -34,10 +34,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
whose
population
includes
the
current
entity
(
which
can
be
determined
with
get_group_id
(
0
))
,
//
whose
population
includes
the
current
entity
(
which
can
be
determined
with
get_group_id
(
0
))
,
//
since
this
determines
which
reference
orientation
should
be
used.
//
since
this
determines
which
reference
orientation
should
be
used.
//#define
DEBUG
_GRAD_TRANSLATION_GENES
//#define
PRINT
_GRAD_TRANSLATION_GENES
//#define
DEBUG
_GRAD_ROTATION_GENES
//#define
PRINT
_GRAD_ROTATION_GENES
#
define
DEBUG
_GRAD_TORSION_GENES
//
#define
PRINT
_GRAD_TORSION_GENES
#
define
ENABLE_PARALLEL_GRAD_TORSION
void
map_priv_angle
(
float*
angle
)
void
map_priv_angle
(
float*
angle
)
//
The
GPU
device
function
maps
//
The
GPU
device
function
maps
...
@@ -797,7 +798,7 @@ void gpu_calc_gradient(
...
@@ -797,7 +798,7 @@ void gpu_calc_gradient(
gradient_inter_y[atom_cnt]
=
native_divide
(
gradient_inter_y[atom_cnt],
dockpars_grid_spacing
)
;
gradient_inter_y[atom_cnt]
=
native_divide
(
gradient_inter_y[atom_cnt],
dockpars_grid_spacing
)
;
gradient_inter_z[atom_cnt]
=
native_divide
(
gradient_inter_z[atom_cnt],
dockpars_grid_spacing
)
;
gradient_inter_z[atom_cnt]
=
native_divide
(
gradient_inter_z[atom_cnt],
dockpars_grid_spacing
)
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
if
(
atom_cnt
==
0
)
{
if
(
atom_cnt
==
0
)
{
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%s\n"
,
"Gradients: inter and intra"
)
;
printf
(
"%s\n"
,
"Gradients: inter and intra"
)
;
...
@@ -815,7 +816,7 @@ void gpu_calc_gradient(
...
@@ -815,7 +816,7 @@ void gpu_calc_gradient(
//printf
(
"%-15s %-5u %-10.8f %-10.8f %-10.8f\n"
,
"grad_intra"
,
atom_cnt,
gradient_intra_x[atom_cnt],
gradient_intra_y[atom_cnt],
gradient_intra_z[atom_cnt]
)
;
//printf
(
"%-15s %-5u %-10.8f %-10.8f %-10.8f\n"
,
"grad_intra"
,
atom_cnt,
gradient_intra_x[atom_cnt],
gradient_intra_y[atom_cnt],
gradient_intra_z[atom_cnt]
)
;
//printf
(
"%-15s %-5u %-10.8f %-10.8f %-10.8f\n"
,
"calc_coords"
,
atom_cnt,
calc_coords_x[atom_cnt],
calc_coords_y[atom_cnt],
calc_coords_z[atom_cnt]
)
;
//printf
(
"%-15s %-5u %-10.8f %-10.8f %-10.8f\n"
,
"calc_coords"
,
atom_cnt,
calc_coords_x[atom_cnt],
calc_coords_y[atom_cnt],
calc_coords_z[atom_cnt]
)
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
if
(
atom_cnt
==
0
)
{
if
(
atom_cnt
==
0
)
{
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%s\n"
,
"Gradients: total = inter + intra"
)
;
printf
(
"%s\n"
,
"Gradients: total = inter + intra"
)
;
...
@@ -851,7 +852,8 @@ void gpu_calc_gradient(
...
@@ -851,7 +852,8 @@ void gpu_calc_gradient(
gradient_genotype[1]
*=
dockpars_grid_spacing
;
gradient_genotype[1]
*=
dockpars_grid_spacing
;
gradient_genotype[2]
*=
dockpars_grid_spacing
;
gradient_genotype[2]
*=
dockpars_grid_spacing
;
#
if
defined
(
DEBUG_GRAD_TRANSLATION_GENES
)
#
if
defined
(
PRINT_GRAD_TRANSLATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"gradient_x:%f\n"
,
gradient_genotype
[0]
)
;
printf
(
"gradient_x:%f\n"
,
gradient_genotype
[0]
)
;
printf
(
"gradient_y:%f\n"
,
gradient_genotype
[1]
)
;
printf
(
"gradient_y:%f\n"
,
gradient_genotype
[1]
)
;
printf
(
"gradient_z:%f\n"
,
gradient_genotype
[2]
)
;
printf
(
"gradient_z:%f\n"
,
gradient_genotype
[2]
)
;
...
@@ -877,7 +879,7 @@ void gpu_calc_gradient(
...
@@ -877,7 +879,7 @@ void gpu_calc_gradient(
torque_rot.y
=
0.0f
;
torque_rot.y
=
0.0f
;
torque_rot.z
=
0.0f
;
torque_rot.z
=
0.0f
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-20s %-10.6f %-10.6f %-10.6f\n"
,
"initial torque: "
,
torque_rot.x,
torque_rot.y,
torque_rot.z
)
;
printf
(
"%-20s %-10.6f %-10.6f %-10.6f\n"
,
"initial torque: "
,
torque_rot.x,
torque_rot.y,
torque_rot.z
)
;
#
endif
#
endif
...
@@ -909,7 +911,7 @@ void gpu_calc_gradient(
...
@@ -909,7 +911,7 @@ void gpu_calc_gradient(
torque_rot
+=
cross
(
r,
force
)
;
torque_rot
+=
cross
(
r,
force
)
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
#
if
0
#
if
0
printf
(
"%-20s %-10u\n"
,
"contrib. of atom-id: "
,
lig_atom_id
)
;
printf
(
"%-20s %-10u\n"
,
"contrib. of atom-id: "
,
lig_atom_id
)
;
printf
(
"%-20s %-10.5f %-10.5f %-10.5f\n"
,
"r : "
,
r.x,
r.y,
r.z
)
;
printf
(
"%-20s %-10.5f %-10.5f %-10.5f\n"
,
"r : "
,
r.x,
r.y,
r.z
)
;
...
@@ -933,7 +935,7 @@ void gpu_calc_gradient(
...
@@ -933,7 +935,7 @@ void gpu_calc_gradient(
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-20s %-10.6f %-10.6f %-10.6f\n"
,
"final torque: "
,
torque_rot.x,
torque_rot.y,
torque_rot.z
)
;
printf
(
"%-20s %-10.6f %-10.6f %-10.6f\n"
,
"final torque: "
,
torque_rot.x,
torque_rot.y,
torque_rot.z
)
;
#
endif
#
endif
...
@@ -942,7 +944,7 @@ void gpu_calc_gradient(
...
@@ -942,7 +944,7 @@ void gpu_calc_gradient(
//
genes[3:7]
=
rotation.axisangle_to_q
(
torque,
rad
)
//
genes[3:7]
=
rotation.axisangle_to_q
(
torque,
rad
)
float
torque_length
=
fast_length
(
torque_rot
)
;
float
torque_length
=
fast_length
(
torque_rot
)
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-20s %-10.6f\n"
,
"torque length: "
,
torque_length
)
;
printf
(
"%-20s %-10.6f\n"
,
"torque length: "
,
torque_length
)
;
#
endif
#
endif
...
@@ -967,7 +969,7 @@ void gpu_calc_gradient(
...
@@ -967,7 +969,7 @@ void gpu_calc_gradient(
quat_torque.y
=
fast_normalize
(
torque_rot
)
.
y
*
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
;
quat_torque.z
=
fast_normalize
(
torque_rot
)
.
z
*
SIN_HALF_INFINITESIMAL_RADIAN
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
#
if
0
#
if
0
printf
(
"fast_normalize(torque_rot).x:%-.6f\n"
,
fast_normalize
(
torque_rot
)
.
x
)
;
printf
(
"fast_normalize(torque_rot).x:%-.6f\n"
,
fast_normalize
(
torque_rot
)
.
x
)
;
printf
(
"fast_normalize(torque_rot).y:%-.6f\n"
,
fast_normalize
(
torque_rot
)
.
y
)
;
printf
(
"fast_normalize(torque_rot).y:%-.6f\n"
,
fast_normalize
(
torque_rot
)
.
y
)
;
...
@@ -1001,7 +1003,7 @@ void gpu_calc_gradient(
...
@@ -1001,7 +1003,7 @@ void gpu_calc_gradient(
bool
is_theta_gt_pi
=
(
current_theta
>
PI_FLOAT
)
?
true:
false
;
bool
is_theta_gt_pi
=
(
current_theta
>
PI_FLOAT
)
?
true:
false
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-30s %-10.6f %-10.6f %-10.6f\n"
,
"current_axisangle (1,2,3): "
,
current_phi,
current_theta,
current_rotangle
)
;
printf
(
"%-30s %-10.6f %-10.6f %-10.6f\n"
,
"current_axisangle (1,2,3): "
,
current_phi,
current_theta,
current_rotangle
)
;
#
endif
#
endif
...
@@ -1022,7 +1024,7 @@ void gpu_calc_gradient(
...
@@ -1022,7 +1024,7 @@ void gpu_calc_gradient(
current_q.y
=
rotaxis_y
*
native_sin
(
ang
)
;
current_q.y
=
rotaxis_y
*
native_sin
(
ang
)
;
current_q.z
=
rotaxis_z
*
native_sin
(
ang
)
;
current_q.z
=
rotaxis_z
*
native_sin
(
ang
)
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-30s %-10.6f %-10.6f %-10.6f %-10.6f\n"
,
"current_q (w,x,y,z): "
,
current_q.w,
current_q.x,
current_q.y,
current_q.z
)
;
printf
(
"%-30s %-10.6f %-10.6f %-10.6f %-10.6f\n"
,
"current_q (w,x,y,z): "
,
current_q.w,
current_q.x,
current_q.y,
current_q.z
)
;
#
endif
#
endif
...
@@ -1037,7 +1039,7 @@ void gpu_calc_gradient(
...
@@ -1037,7 +1039,7 @@ void gpu_calc_gradient(
target_q.x
=
quat_torque.w*current_q.x
+
quat_torque.x*current_q.w
+
quat_torque.y*current_q.z
-
quat_torque.z*current_q.y
;// x
target_q.x
=
quat_torque.w*current_q.x
+
quat_torque.x*current_q.w
+
quat_torque.y*current_q.z
-
quat_torque.z*current_q.y
;// x
target_q.y
=
quat_torque.w*current_q.y
+
quat_torque.y*current_q.w
+
quat_torque.z*current_q.x
-
quat_torque.x*current_q.z
;// y
target_q.y
=
quat_torque.w*current_q.y
+
quat_torque.y*current_q.w
+
quat_torque.z*current_q.x
-
quat_torque.x*current_q.z
;// y
target_q.z
=
quat_torque.w*current_q.z
+
quat_torque.z*current_q.w
+
quat_torque.x*current_q.y
-
quat_torque.y*current_q.x
;// z
target_q.z
=
quat_torque.w*current_q.z
+
quat_torque.z*current_q.w
+
quat_torque.x*current_q.y
-
quat_torque.y*current_q.x
;// z
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-30s %-10.6f %-10.6f %-10.6f %-10.6f\n"
,
"target_q (w,x,y,z): "
,
target_q.w,
target_q.x,
target_q.y,
target_q.z
)
;
printf
(
"%-30s %-10.6f %-10.6f %-10.6f %-10.6f\n"
,
"target_q (w,x,y,z): "
,
target_q.w,
target_q.x,
target_q.y,
target_q.z
)
;
#
endif
#
endif
...
@@ -1067,7 +1069,7 @@ void gpu_calc_gradient(
...
@@ -1067,7 +1069,7 @@ void gpu_calc_gradient(
target_theta = PI_TIMES_2 - target_theta;
target_theta = PI_TIMES_2 - target_theta;
}
}
#if defined (
DEBUG
_GRAD_ROTATION_GENES)
#if defined (
PRINT
_GRAD_ROTATION_GENES)
printf("\n%s\n", "----------------------------------------------------------");
printf("\n%s\n", "----------------------------------------------------------");
printf("%-30s %-10.6f %-10.6f %-10.6f\n", "target_axisangle (1,2,3): ", target_phi, target_theta, target_rotangle);
printf("%-30s %-10.6f %-10.6f %-10.6f\n", "target_axisangle (1,2,3): ", target_phi, target_theta, target_rotangle);
#endif
#endif
...
@@ -1080,7 +1082,7 @@ void gpu_calc_gradient(
...
@@ -1080,7 +1082,7 @@ void gpu_calc_gradient(
//float shoemake_scaling = native_divide(torque_length, INFINITESIMAL_RADIAN/*infinitesimal_radian*/);
//float shoemake_scaling = native_divide(torque_length, INFINITESIMAL_RADIAN/*infinitesimal_radian*/);
float orientation_scaling = torque_length * INV_INFINITESIMAL_RADIAN;
float orientation_scaling = torque_length * INV_INFINITESIMAL_RADIAN;
#if defined (
DEBUG
_GRAD_ROTATION_GENES)
#if defined (
PRINT
_GRAD_ROTATION_GENES)
printf("\n%s\n", "----------------------------------------------------------");
printf("\n%s\n", "----------------------------------------------------------");
printf("%-30s %-10.6f\n", "orientation_scaling: ", orientation_scaling);
printf("%-30s %-10.6f\n", "orientation_scaling: ", orientation_scaling);
#endif
#endif
...
@@ -1096,7 +1098,7 @@ void gpu_calc_gradient(
...
@@ -1096,7 +1098,7 @@ void gpu_calc_gradient(
grad_theta = orientation_scaling * (fmod(target_theta - current_theta + PI_FLOAT, PI_TIMES_2) - PI_FLOAT);
grad_theta = orientation_scaling * (fmod(target_theta - current_theta + PI_FLOAT, PI_TIMES_2) - PI_FLOAT);
grad_rotangle = orientation_scaling * (fmod(target_rotangle - current_rotangle + PI_FLOAT, PI_TIMES_2) - PI_FLOAT);
grad_rotangle = orientation_scaling * (fmod(target_rotangle - current_rotangle + PI_FLOAT, PI_TIMES_2) - PI_FLOAT);
#if defined (
DEBUG
_GRAD_ROTATION_GENES)
#if defined (
PRINT
_GRAD_ROTATION_GENES)
printf("\n%s\n", "----------------------------------------------------------");
printf("\n%s\n", "----------------------------------------------------------");
printf("%-30s \n", "grad_axisangle (1,2,3) - before empirical scaling: ");
printf("%-30s \n", "grad_axisangle (1,2,3) - before empirical scaling: ");
printf("%-13s %-13s %-13s \n", "grad_phi", "grad_theta", "grad_rotangle");
printf("%-13s %-13s %-13s \n", "grad_phi", "grad_theta", "grad_rotangle");
...
@@ -1167,7 +1169,7 @@ void gpu_calc_gradient(
...
@@ -1167,7 +1169,7 @@ void gpu_calc_gradient(
}
}
dependence_on_theta
=
(
Y0_theta
*
(
X1_theta-X_theta
)
+
Y1_theta
*
(
X_theta-X0_theta
))
*
inv_angle_delta
;
dependence_on_theta
=
(
Y0_theta
*
(
X1_theta-X_theta
)
+
Y1_theta
*
(
X_theta-X0_theta
))
*
inv_angle_delta
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-30s %-10.6f\n"
,
"dependence_on_theta: "
,
dependence_on_theta
)
;
printf
(
"%-30s %-10.6f\n"
,
"dependence_on_theta: "
,
dependence_on_theta
)
;
#
endif
#
endif
...
@@ -1196,7 +1198,7 @@ void gpu_calc_gradient(
...
@@ -1196,7 +1198,7 @@ void gpu_calc_gradient(
}
}
dependence_on_rotangle
=
(
Y0_rotangle
*
(
X1_rotangle-X_rotangle
)
+
Y1_rotangle
*
(
X_rotangle-X0_rotangle
))
*
inv_angle_delta
;
dependence_on_rotangle
=
(
Y0_rotangle
*
(
X1_rotangle-X_rotangle
)
+
Y1_rotangle
*
(
X_rotangle-X0_rotangle
))
*
inv_angle_delta
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-30s %-10.6f\n"
,
"dependence_on_rotangle: "
,
dependence_on_rotangle
)
;
printf
(
"%-30s %-10.6f\n"
,
"dependence_on_rotangle: "
,
dependence_on_rotangle
)
;
#
endif
#
endif
...
@@ -1206,7 +1208,7 @@ void gpu_calc_gradient(
...
@@ -1206,7 +1208,7 @@ void gpu_calc_gradient(
gradient_genotype[3]
=
native_divide
(
grad_phi,
(
dependence_on_theta
*
dependence_on_rotangle
))
*
DEG_TO_RAD
;
gradient_genotype[3]
=
native_divide
(
grad_phi,
(
dependence_on_theta
*
dependence_on_rotangle
))
*
DEG_TO_RAD
;
gradient_genotype[4]
=
native_divide
(
grad_theta,
dependence_on_rotangle
)
*
DEG_TO_RAD
;
gradient_genotype[4]
=
native_divide
(
grad_theta,
dependence_on_rotangle
)
*
DEG_TO_RAD
;
gradient_genotype[5]
=
grad_rotangle
*
DEG_TO_RAD
;
gradient_genotype[5]
=
grad_rotangle
*
DEG_TO_RAD
;
#
if
defined
(
DEBUG
_GRAD_ROTATION_GENES
)
#
if
defined
(
PRINT
_GRAD_ROTATION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-30s \n"
,
"grad_axisangle (1,2,3) - after empirical scaling: "
)
;
printf
(
"%-30s \n"
,
"grad_axisangle (1,2,3) - after empirical scaling: "
)
;
printf
(
"%-13s %-13s %-13s \n"
,
"grad_phi"
,
"grad_theta"
,
"grad_rotangle"
)
;
printf
(
"%-13s %-13s %-13s \n"
,
"grad_phi"
,
"grad_theta"
,
"grad_rotangle"
)
;
...
@@ -1218,24 +1220,23 @@ void gpu_calc_gradient(
...
@@ -1218,24 +1220,23 @@ void gpu_calc_gradient(
//
Obtaining
torsion-related
gradients
//
Obtaining
torsion-related
gradients
//
------------------------------------------
//
------------------------------------------
//----------------------------------
#
if
defined
(
ENABLE_PARALLEL_GRAD_TORSION
)
//
fastergrad
for
(
uint
rotbond_id
=
get_local_id
(
0
)
;
//----------------------------------
rotbond_id
<
dockpars_num_of_genes-6
;
///*
rotbond_id
+=NUM_OF_THREADS_PER_BLOCK
)
{
#
if
defined
(
PRINT_GRAD_TORSION_GENES
)
if
(
rotbond_id
==
0
)
{
printf
(
"\n%s\n"
,
"NOTE: torsion gradients are calculated by many work-items"
)
;
}
#
endif
#
else
if
(
get_local_id
(
0
)
==
2
)
{
if
(
get_local_id
(
0
)
==
2
)
{
for
(
uint
rotbond_id
=
0
;
for
(
uint
rotbond_id
=
0
;
rotbond_id
<
dockpars_num_of_genes-6
;
rotbond_id
<
dockpars_num_of_genes-6
;
rotbond_id
++
)
{
rotbond_id
++
)
{
//*/
#
endif
/*
for
(
uint
rotbond_id
=
get_local_id
(
0
)
;
rotbond_id
<
dockpars_num_of_genes-6
;
rotbond_id
+=NUM_OF_THREADS_PER_BLOCK
)
{
*/
//----------------------------------
//
Querying
ids
of
atoms
belonging
to
the
rotatable
bond
in
question
//
Querying
ids
of
atoms
belonging
to
the
rotatable
bond
in
question
int
atom1_id
=
rotbonds_const[2*rotbond_id]
;
int
atom1_id
=
rotbonds_const[2*rotbond_id]
;
...
@@ -1246,7 +1247,7 @@ void gpu_calc_gradient(
...
@@ -1246,7 +1247,7 @@ void gpu_calc_gradient(
atomRef_coords.y
=
calc_coords_y[atom1_id]
;
atomRef_coords.y
=
calc_coords_y[atom1_id]
;
atomRef_coords.z
=
calc_coords_z[atom1_id]
;
atomRef_coords.z
=
calc_coords_z[atom1_id]
;
#
if
defined
(
DEBUG
_GRAD_TORSION_GENES
)
#
if
defined
(
PRINT
_GRAD_TORSION_GENES
)
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%-5s %3u \n\t %-5s %3i \n\t %-5s %3i\n"
,
"gene: "
,
(
rotbond_id+6
)
,
"atom1: "
,
atom1_id,
"atom2: "
,
atom2_id
)
;
printf
(
"%-5s %3u \n\t %-5s %3i \n\t %-5s %3i\n"
,
"gene: "
,
(
rotbond_id+6
)
,
"atom1: "
,
atom1_id,
"atom2: "
,
atom2_id
)
;
#
endif
#
endif
...
@@ -1262,7 +1263,7 @@ void gpu_calc_gradient(
...
@@ -1262,7 +1263,7 @@ void gpu_calc_gradient(
rotation_unitvec.z
=
calc_coords_z[atom2_id]
-
calc_coords_z[atom1_id]
;
rotation_unitvec.z
=
calc_coords_z[atom2_id]
-
calc_coords_z[atom1_id]
;
rotation_unitvec
=
fast_normalize
(
rotation_unitvec
)
;
rotation_unitvec
=
fast_normalize
(
rotation_unitvec
)
;
#
if
defined
(
DEBUG
_GRAD_TORSION_GENES
)
#
if
defined
(
PRINT
_GRAD_TORSION_GENES
)
printf
(
"\n"
)
;
printf
(
"\n"
)
;
printf
(
"%-15s \n\t %-10.6f %-10.6f %-10.6f\n"
,
"unitvec: "
,
rotation_unitvec.x,
rotation_unitvec.y,
rotation_unitvec.z
)
;
printf
(
"%-15s \n\t %-10.6f %-10.6f %-10.6f\n"
,
"unitvec: "
,
rotation_unitvec.x,
rotation_unitvec.y,
rotation_unitvec.z
)
;
#
endif
#
endif
...
@@ -1303,7 +1304,7 @@ void gpu_calc_gradient(
...
@@ -1303,7 +1304,7 @@ void gpu_calc_gradient(
torque_tor
+=
cross
(
r,
atom_force
)
;
torque_tor
+=
cross
(
r,
atom_force
)
;
#
if
defined
(
DEBUG
_GRAD_TORSION_GENES
)
#
if
defined
(
PRINT
_GRAD_TORSION_GENES
)
if
(
rotable_atom_cnt
==
0
)
{
if
(
rotable_atom_cnt
==
0
)
{
printf
(
"\n %-30s %3i\n"
,
"contributor for gene : "
,
(
rotbond_id+6
))
;
printf
(
"\n %-30s %3i\n"
,
"contributor for gene : "
,
(
rotbond_id+6
))
;
}
}
...
@@ -1317,7 +1318,7 @@ void gpu_calc_gradient(
...
@@ -1317,7 +1318,7 @@ void gpu_calc_gradient(
#
endif
#
endif
}
}
#
if
defined
(
DEBUG
_GRAD_TORSION_GENES
)
#
if
defined
(
PRINT
_GRAD_TORSION_GENES
)
printf
(
"\n"
)
;
printf
(
"\n"
)
;
#
endif
#
endif
...
@@ -1327,18 +1328,17 @@ void gpu_calc_gradient(
...
@@ -1327,18 +1328,17 @@ void gpu_calc_gradient(
//
Assignment
of
gene-based
gradient
//
Assignment
of
gene-based
gradient
gradient_genotype[rotbond_id+6]
=
torque_on_axis
*
DEG_TO_RAD
/*
(
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
)
#
if
defined
(
PRINT
_GRAD_TORSION_GENES
)
printf
(
"gradient_torsion [%u] :%f\n"
,
rotbond_id+6,
gradient_genotype
[rotbond_id+6]
)
;
printf
(
"gradient_torsion [%u] :%f\n"
,
rotbond_id+6,
gradient_genotype
[rotbond_id+6]
)
;
#
endif
#
endif
}
//
End
of
iterations
over
rotatable
bonds
}
//
End
of
iterations
over
rotatable
bonds
//----------------------------------
#
if
defined
(
ENABLE_PARALLEL_GRAD_TORSION
)
//
fastergrad
//----------------------------------
#
else
///*
}
}
//*/
#
endif
//----------------------------------
//----------------------------------
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
...
...
device/kernel_gradient.cl
View file @
c9b5d2e2
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
//
Alternative
to
Solis-Wetts
//
Alternative
to
Solis-Wetts
#
define
DEBUG_ENERGY_KERNEL5
#
define
DEBUG_ENERGY_KERNEL5
#
define
PRINT_ENERGIES
#
define
PRINT_GENES_AND_GRADS
//#define
PRINT_ATOMIC_COORDS
__kernel
void
__attribute__
((
reqd_work_group_size
(
NUM_OF_THREADS_PER_BLOCK,1,1
)))
__kernel
void
__attribute__
((
reqd_work_group_size
(
NUM_OF_THREADS_PER_BLOCK,1,1
)))
gradient_minimizer
(
gradient_minimizer
(
...
@@ -271,6 +274,8 @@ gradient_minimizer(
...
@@ -271,6 +274,8 @@ gradient_minimizer(
genotype[20]
=
0.0f
;
genotype[20]
=
0.0f
;
#
endif
#
endif
#
if
0
//
2j5s
genotype[0]
=
28.464
;
genotype[0]
=
28.464
;
genotype[1]
=
25.792762
;
genotype[1]
=
25.792762
;
genotype[2]
=
23.740571
;
genotype[2]
=
23.740571
;
...
@@ -292,6 +297,32 @@ gradient_minimizer(
...
@@ -292,6 +297,32 @@ gradient_minimizer(
genotype[18]
=
0.0f
;
genotype[18]
=
0.0f
;
genotype[19]
=
0.0f
;
genotype[19]
=
0.0f
;
genotype[20]
=
0.0f
;
genotype[20]
=
0.0f
;
#
endif
#
if
1
//
2brt
genotype[0]
=
24.093334
;
genotype[1]
=
24.658667
;
genotype[2]
=
24.210667
;
genotype[3]
=
50.0
;
genotype[4]
=
50.0
;
genotype[5]
=
50.0
;
genotype[6]
=
0.0f
;
genotype[7]
=
0.0f
;
genotype[8]
=
0.0f
;
genotype[9]
=
0.0f
;
genotype[10]
=
0.0f
;
genotype[11]
=
0.0f
;
genotype[12]
=
0.0f
;
genotype[13]
=
0.0f
;
genotype[14]
=
0.0f
;
genotype[15]
=
0.0f
;
genotype[16]
=
0.0f
;
genotype[17]
=
0.0f
;
genotype[18]
=
0.0f
;
genotype[19]
=
0.0f
;
genotype[20]
=
0.0f
;
#
endif
if
(
get_local_id
(
0
)
==
0
)
{
if
(
get_local_id
(
0
)
==
0
)
{
//
Finding
maximum
of
the
absolute
value
//
Finding
maximum
of
the
absolute
value
...
@@ -430,15 +461,22 @@ gradient_minimizer(
...
@@ -430,15 +461,22 @@ gradient_minimizer(
)
;
)
;
//
=============================================================
//
=============================================================
///*
//
This
could
be
enabled
back
for
double
checking
#
if
0
#
if
defined
(
DEBUG_ENERGY_KERNEL5
)
if
((
get_group_id
(
0
)
==
0
)
&&
(
get_local_id
(
0
)
==
0
))
{
if
((
get_group_id
(
0
)
==
0
)
&&
(
get_local_id
(
0
)
==
0
))
{
#
if
0
#
if
defined
(
PRINT_GENES_AND_GRADS
)
for
(
uint
i
=
0
; i < dockpars_num_of_genes; i++) {
for
(
uint
i
=
0
; i < dockpars_num_of_genes; i++) {
printf
(
"gradient[%u]=%f \n"
,
i,
gradient[i]
)
;
if
(
i
==
0
)
{
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%13s %13s %5s %15s %15s\n"
,
"gene_id"
,
"gene.value"
,
"|"
,
"gene.grad"
,
"(autodockdevpy units)"
)
;
}
printf
(
"%13u %13.6f %5s %15.6f %15.6f\n"
,
i,
genotype[i],
"|"
,
gradient[i],
(
i<3
)
?
(
gradient[i]/0.375f
)
:
(
gradient[i]*180.0f/PI_FLOAT
))
;
}
}
printf
(
"\n"
)
;
#
endif
#
endif
#
if
defined
(
PRINT_ATOMIC_COORDS
)
for
(
uint
i
=
0
; i < dockpars_num_of_atoms; i++) {
for
(
uint
i
=
0
; i < dockpars_num_of_atoms; i++) {
if
(
i
==
0
)
{
if
(
i
==
0
)
{
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
...
@@ -448,8 +486,10 @@ gradient_minimizer(
...
@@ -448,8 +486,10 @@ gradient_minimizer(
printf
(
"%12u %12.6f %12.6f %12.6f\n"
,
i,
calc_coords_x[i],
calc_coords_y[i],
calc_coords_z[i]
)
;
printf
(
"%12u %12.6f %12.6f %12.6f\n"
,
i,
calc_coords_x[i],
calc_coords_y[i],
calc_coords_z[i]
)
;
}
}
printf
(
"\n"
)
;
printf
(
"\n"
)
;
#
endif
}
}
//*/
#
endif
#
endif
for
(
uint
i
=
get_local_id
(
0
)
; i < dockpars_num_of_genes; i+= NUM_OF_THREADS_PER_BLOCK) {
for
(
uint
i
=
get_local_id
(
0
)
; i < dockpars_num_of_genes; i+= NUM_OF_THREADS_PER_BLOCK) {
//
Taking
step
//
Taking
step
...
@@ -486,7 +526,7 @@ gradient_minimizer(
...
@@ -486,7 +526,7 @@ gradient_minimizer(
dockpars_coeff_elec,
dockpars_coeff_elec,
dockpars_qasp,
dockpars_qasp,
dockpars_coeff_desolv,
dockpars_coeff_desolv,
/*candidate_genotype,*/
genotype,
/*use
genotype
only
for
reproduce
results*/
/*candidate_genotype,*/
genotype,
/*
WARNING:
use
genotype
ONLY
to
reproduce
results*/
&candidate_energy,
&candidate_energy,
&run_id,
&run_id,
//
Some
OpenCL
compilers
don
't
allow
declaring
//
Some
OpenCL
compilers
don
't
allow
declaring
...
@@ -529,24 +569,24 @@ gradient_minimizer(
...
@@ -529,24 +569,24 @@ gradient_minimizer(
#
if
defined
(
DEBUG_ENERGY_KERNEL5
)
#
if
defined
(
DEBUG_ENERGY_KERNEL5
)
if
((
get_group_id
(
0
)
==
0
)
&&
(
get_local_id
(
0
)
==
0
))
{
if
((
get_group_id
(
0
)
==
0
)
&&
(
get_local_id
(
0
)
==
0
))
{
#
if
defined
(
PRINT_ENERGIES
)
printf
(
"\n"
)
;
printf
(
"\n"
)
;
printf
(
"%-10s %-10.6f \n"
,
"intra: "
,
partial_intraE[0]
)
;
printf
(
"%-10s %-10.6f \n"
,
"intra: "
,
partial_intraE[0]
)
;
printf
(
"%-10s %-10.6f \n"
,
"grids: "
,
partial_interE[0]
)
;
printf
(
"%-10s %-10.6f \n"
,
"grids: "
,
partial_interE[0]
)
;
printf
(
"%-10s %-10.6f \n"
,
"Energy: "
,
(
partial_intraE[0]
+
partial_interE[0]
))
;
printf
(
"%-10s %-10.6f \n"
,
"Energy: "
,
(
partial_intraE[0]
+
partial_interE[0]
))
;
#
endif
#
if
defined
(
PRINT_GENES_AND_GRADS
)
for
(
uint
i
=
0
; i < dockpars_num_of_genes; i++) {
for
(
uint
i
=
0
; i < dockpars_num_of_genes; i++) {
if
(
i
==
0
)
{
if
(
i
==
0
)
{
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"%13s %13s %
13
s\n"
,
"gene_id"
,
"gene.value"
,
"gene.grad"
)
;
printf
(
"%13s %13s %
5s %15s %15
s\n"
,
"gene_id"
,
"gene.value"
,
"|"
,
"gene.grad"
,
"(autodockdevpy units)"
)
;
}
}
printf
(
"%13u %13.6f %
13
.6f\n"
,
i,
genotype[i],
gradient[i]
)
;
printf
(
"%13u %13.6f %
5s %15.6f %15
.6f\n"
,
i,
genotype[i],
"|"
,
gradient[i],
(
i<3
)
?
(
gradient[i]/0.375f
)
:
(
gradient[i]*180.0f/PI_FLOAT
)
)
;
}
}
#
endif
#
if
0
#
if
defined
(
PRINT_ATOMIC_COORDS
)
for
(
uint
i
=
0
; i < dockpars_num_of_atoms; i++) {
printf
(
"atom [%u]: x=%f y=%f z=%f\n"
,
i,
calc_coords_x[i],
calc_coords_y[i],
calc_coords_z[i]
)
;
}
#
endif
for
(
uint
i
=
0
; i < dockpars_num_of_atoms; i++) {
for
(
uint
i
=
0
; i < dockpars_num_of_atoms; i++) {
if
(
i
==
0
)
{
if
(
i
==
0
)
{
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
printf
(
"\n%s\n"
,
"----------------------------------------------------------"
)
;
...
@@ -556,6 +596,7 @@ gradient_minimizer(
...
@@ -556,6 +596,7 @@ gradient_minimizer(
printf
(
"%12u %12.6f %12.6f %12.6f\n"
,
i,
calc_coords_x[i],
calc_coords_y[i],
calc_coords_z[i]
)
;
printf
(
"%12u %12.6f %12.6f %12.6f\n"
,
i,
calc_coords_x[i],
calc_coords_y[i],
calc_coords_z[i]
)
;
}
}
printf
(
"\n"
)
;
printf
(
"\n"
)
;
#
endif
}
}
#
endif
#
endif
...
...
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