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
f79a7104
Commit
f79a7104
authored
Apr 10, 2018
by
Leonardo Solis
Browse files
corrections + code-restructure in grad
parent
d266192b
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
f79a7104
...
...
@@ -198,8 +198,8 @@ odock: check-env-all stringify $(SRC)
# Example
PDB
:=
3ce3
NRUN
:=
1
00
POPSIZE
:=
500
NRUN
:=
2
00
POPSIZE
:=
2048
TESTNAME
:=
test
test
:
odock
...
...
device/auxiliary_genetic.cl
View file @
f79a7104
...
...
@@ -172,7 +172,6 @@ void gpu_perform_elitist_selection(
for
(
gene_counter
=
get_local_id
(
0
)
;
gene_counter
<
dockpars_num_of_genes
;
gene_counter+=
NUM_OF_THREADS_PER_BLOCK
)
{
dockpars_conformations_next[GENOTYPE_LENGTH_IN_GLOBMEM*get_group_id
(
0
)
+gene_counter]
=
dockpars_conformations_current[GENOTYPE_LENGTH_IN_GLOBMEM*get_group_id
(
0
)
+
GENOTYPE_LENGTH_IN_GLOBMEM*best_ID[0]+gene_counter]
;
dockpars_conformations_next[GENOTYPE_LENGTH_IN_GLOBMEM*get_group_id
(
0
)
+gene_counter]
=
dockpars_conformations_current[GENOTYPE_LENGTH_IN_GLOBMEM*get_group_id
(
0
)
+
GENOTYPE_LENGTH_IN_GLOBMEM*best_ID[0]+gene_counter]
;
}
}
device/auxiliary_gradient.cl
View file @
f79a7104
...
...
@@ -2,11 +2,7 @@
//
Implementation
of
auxiliary
functions
//
for
the
gradient-based
minimizer
bool
is_gradDescent_enabled
(
__local
bool*
is_gNorm_gt_gMin,
__local
bool*
is_nIter_lt_maxIter,
__local
bool*
is_perturb_gt_gene_min,
__local
bool*
is_perturb_gt_genotype,
__local
float*
local_gNorm,
float
gradMin_tol,
__local
uint*
local_nIter,
...
...
@@ -16,10 +12,14 @@ bool is_gradDescent_enabled(
__local
bool*
is_gradDescentEn,
uint
gradMin_numElements
)
{
bool
is_gNorm_gt_gMin
;
bool
is_nIter_lt_maxIter
;
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
;
}
//
For
every
gene,
let
's
determine
...
...
@@ -35,153 +35,35 @@ bool is_gradDescent_enabled(
if
(
get_local_id
(
0
)
==
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]
;
is_perturb_gt_genotype
=
is_perturb_gt_genotype
&&
is_perturb_gt_gene_min[i]
;
/*
printf
(
"is_perturb_gt_gene_min[%u]?: %s\n"
,
i,
(
is_perturb_gt_gene_min[i]
==
true
)
?
"yes"
:
"no"
)
;
*/
}
//
Reduce
all
three
previous
//
partial
evaluations
(
gNorm,
nIter,
perturb
)
into
a
final
one
is_gradDescentEn[0]
=
*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
;
/*
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
(
"Continue gradient iteration?: %s\n"
,
(
*is_gradDescentEn
==
true
)
?
"yes"
:
"no"
)
;
}
*/
}
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
return
is_gradDescentEn[0]
;
}
void
stepGPU
(
//
Args
for
minimization
__local
float*
local_genotype,
//
originally
as
"d_x"
__local
float*
local_genotype_new,
//
originally
as
"d_xnew"
__local
float*
local_genotype_diff,
//
originally
as
"d_xdiff"
__local
float*
local_gradient,
//
originally
as
"d_g"
float
gradMin_alpha,
//
originally
as
"alpha"
float
gradMin_h,
//
originally
as
"h"
uint
gradMin_inputSize,
//
originally
as
"M"
.
initially
labelled
as
"gradMin_M"
//
Args
for
energy
and
gradient
calculation
int
dockpars_rotbondlist_length,
char
dockpars_num_of_atoms,
char
dockpars_gridsize_x,
char
dockpars_gridsize_y,
char
dockpars_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,
float
dockpars_grid_spacing,
float
dockpars_coeff_elec,
float
dockpars_qasp,
float
dockpars_coeff_desolv,
__local
float*
genotype,
__local
float*
energy,
__local
int*
run_id,
//
Some
OpenCL
compilers
don
't
allow
declaring
//
local
variables
within
non-kernel
functions.
//
These
local
variables
must
be
declared
in
a
kernel,
//
and
then
passed
to
non-kernel
functions.
__local
float*
calc_coords_x,
__local
float*
calc_coords_y,
__local
float*
calc_coords_z,
__local
float*
partial_energies,
__constant
float*
atom_charges_const,
__constant
char*
atom_types_const,
__constant
char*
intraE_contributors_const,
__constant
float*
VWpars_AC_const,
__constant
float*
VWpars_BD_const,
__constant
float*
dspars_S_const,
__constant
float*
dspars_V_const,
__constant
int*
rotlist_const,
__constant
float*
ref_coords_x_const,
__constant
float*
ref_coords_y_const,
__constant
float*
ref_coords_z_const,
__constant
float*
rotbonds_moving_vectors_const,
__constant
float*
rotbonds_unit_vectors_const,
__constant
float*
ref_orientation_quats_const
//
Gradient-related
arguments
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
//
"is_enabled_gradient_calc"
:
enables
gradient
calculation.
//
In
Genetic-Generation:
no
need
for
gradients
//
In
Gradient-Minimizer:
must
calculate
gradients
,
__local
bool*
is_enabled_gradient_calc,
__local
float*
gradient_inter_x,
__local
float*
gradient_inter_y,
__local
float*
gradient_inter_z,
__local
float*
gradient_genotype
)
{
//
Calculate
gradient
//
=============================================================
gpu_calc_energy
(
dockpars_rotbondlist_length,
dockpars_num_of_atoms,
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
dockpars_grid_spacing,
dockpars_coeff_elec,
dockpars_qasp,
dockpars_coeff_desolv,
genotype,
energy,
run_id,
//
Some
OpenCL
compilers
don
't
allow
declaring
//
local
variables
within
non-kernel
functions.
//
These
local
variables
must
be
declared
in
a
kernel,
//
and
then
passed
to
non-kernel
functions.
calc_coords_x,
calc_coords_y,
calc_coords_z,
partial_energies,
atom_charges_const,
atom_types_const,
intraE_contributors_const,
VWpars_AC_const,
VWpars_BD_const,
dspars_S_const,
dspars_V_const,
rotlist_const,
ref_coords_x_const,
ref_coords_y_const,
ref_coords_z_const,
rotbonds_moving_vectors_const,
rotbonds_unit_vectors_const,
ref_orientation_quats_const
//
Gradient-related
arguments
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
,
is_enabled_gradient_calc,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
gradient_genotype
)
;
//
=============================================================
for
(
uint
i
=
get_local_id
(
0
)
;
i
<
gradMin_inputSize
;
i+=
NUM_OF_THREADS_PER_BLOCK
)
{
//
Taking
step
local_genotype_new[i]
=
local_genotype[i]
-
gradMin_alpha
*
local_gradient[i]
;
//
Updating
termination
metrics
local_genotype_diff[i]
=
local_genotype_new[i]
-
local_genotype[i]
;
//
Updating
current
solution
local_genotype[i]
=
local_genotype_new[i]
;
}
return
*is_gradDescentEn
;
}
float
inner_product
(
__local
float*
vector1,
...
...
device/calcenergy.cl
View file @
f79a7104
This diff is collapsed.
Click to expand it.
device/calcgradient.cl
0 → 100644
View file @
f79a7104
This diff is collapsed.
Click to expand it.
device/kernel1.cl
View file @
f79a7104
...
...
@@ -59,7 +59,7 @@ gpu_calc_initpop(
//
local
variables
within
non-kernel
functions.
//
These
local
variables
must
be
declared
in
a
kernel,
//
and
then
passed
to
non-kernel
functions.
__local
float
genotype[GENOTYPE_LENGTH
_IN_GLOBMEM
]
;
__local
float
genotype[
ACTUAL_
GENOTYPE_LENGTH]
;
__local
float
energy
;
__local
int
run_id
;
...
...
@@ -80,27 +80,6 @@ gpu_calc_initpop(
run_id
=
get_group_id
(
0
)
/
dockpars_pop_size
;
}
//
-------------------------------------------------------------------
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
//
-------------------------------------------------------------------
//
Disabling
gradient
calculation
for
this
kernel
__local
bool
is_enabled_gradient_calc
;
if
(
get_local_id
(
0
)
==
0
)
{
is_enabled_gradient_calc
=
false
;
}
//
Variables
to
store
gradient
of
//
the
intermolecular
energy
per
each
ligand
atom
__local
float
gradient_inter_x[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_y[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_z[MAX_NUM_OF_ATOMS]
;
//
Final
gradient
resulting
out
of
gradient
calculation
__local
float
gradient_genotype[GENOTYPE_LENGTH_IN_GLOBMEM]
;
//
-------------------------------------------------------------------
//
=============================================================
//
WARNING:
only
energy
of
work-item=0
will
be
valid
gpu_calc_energy
(
dockpars_rotbondlist_length,
...
...
@@ -141,15 +120,6 @@ gpu_calc_initpop(
rotbonds_moving_vectors_const,
rotbonds_unit_vectors_const,
ref_orientation_quats_const
//
Gradient-related
arguments
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
,
&is_enabled_gradient_calc,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
gradient_genotype
)
;
//
=============================================================
...
...
device/kernel3.cl
View file @
f79a7104
...
...
@@ -97,27 +97,6 @@ perform_LS(
__local
float
calc_coords_z[MAX_NUM_OF_ATOMS]
;
__local
float
partial_energies[NUM_OF_THREADS_PER_BLOCK]
;
//
-------------------------------------------------------------------
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
//
-------------------------------------------------------------------
//
Disabling
gradient
calculation
for
this
kernel
__local
bool
is_enabled_gradient_calc
;
if
(
get_local_id
(
0
)
==
0
)
{
is_enabled_gradient_calc
=
false
;
}
//
Variables
to
store
gradient
of
//
the
intermolecular
energy
per
each
ligand
atom
__local
float
gradient_inter_x[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_y[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_z[MAX_NUM_OF_ATOMS]
;
//
Final
gradient
resulting
out
of
gradient
calculation
__local
float
gradient_genotype[GENOTYPE_LENGTH_IN_GLOBMEM]
;
//
-------------------------------------------------------------------
//
Determining
run
ID
and
entity
ID
//
Initializing
offspring
genotype
if
(
get_local_id
(
0
)
==
0
)
...
...
@@ -240,15 +219,6 @@ perform_LS(
rotbonds_moving_vectors_const,
rotbonds_unit_vectors_const,
ref_orientation_quats_const
//
Gradient-related
arguments
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
,
&is_enabled_gradient_calc,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
gradient_genotype
)
;
//
=================================================================
...
...
@@ -291,7 +261,7 @@ perform_LS(
//
Shoemake
genes
(
u1,
u2,
u3
)
ranges
between
[0,1]
if
((
gene_counter
>=
3
)
&&
(
gene_counter
<=
5
))
{
genotype_candidate[gene_counter]
=
gpu_randf
(
dockpars_prng_states
)
;
genotype_candidate[gene_counter]
=
gpu_randf
(
dockpars_prng_states
)
;
}
//
Other
genes:
translation
and
torsions
else
{
...
...
@@ -343,15 +313,6 @@ perform_LS(
rotbonds_moving_vectors_const,
rotbonds_unit_vectors_const,
ref_orientation_quats_const
//
Gradient-related
arguments
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
,
&is_enabled_gradient_calc,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
gradient_genotype
)
;
//
=================================================================
...
...
device/kernel4.cl
View file @
f79a7104
...
...
@@ -90,27 +90,6 @@ gpu_gen_and_eval_newpops(
__local
float
calc_coords_z[MAX_NUM_OF_ATOMS]
;
__local
float
partial_energies[NUM_OF_THREADS_PER_BLOCK]
;
//
-------------------------------------------------------------------
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
//
-------------------------------------------------------------------
//
Disabling
gradient
calculation
for
this
kernel
__local
bool
is_enabled_gradient_calc
;
if
(
get_local_id
(
0
)
==
0
)
{
is_enabled_gradient_calc
=
false
;
}
//
Variables
to
store
gradient
of
//
the
intermolecular
energy
per
each
ligand
atom
__local
float
gradient_inter_x[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_y[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_z[MAX_NUM_OF_ATOMS]
;
//
Final
gradient
resulting
out
of
gradient
calculation
__local
float
gradient_genotype[GENOTYPE_LENGTH_IN_GLOBMEM]
;
//
-------------------------------------------------------------------
//
In
this
case
this
compute-unit
is
responsible
for
elitist
selection
if
((
get_group_id
(
0
)
%
dockpars_pop_size
)
==
0
)
{
gpu_perform_elitist_selection
(
dockpars_pop_size,
...
...
@@ -291,16 +270,6 @@ gpu_gen_and_eval_newpops(
rotbonds_moving_vectors_const,
rotbonds_unit_vectors_const,
ref_orientation_quats_const
//
Gradient-related
arguments
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
,
&is_enabled_gradient_calc,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
gradient_genotype
)
;
//
=============================================================
...
...
device/kernel_gradient.cl
View file @
f79a7104
...
...
@@ -45,7 +45,6 @@ gradient_minimizer(
__constant
float*
rotbonds_moving_vectors_const,
__constant
float*
rotbonds_unit_vectors_const,
__constant
float*
ref_orientation_quats_const,
//
Specific
gradient-minimizer
args
//
__global
float*
restrict
dockpars_conformations_next,
//
initial
population
//
whose
(
some
)
entities
(
genotypes
)
are
to
be
minimized
...
...
@@ -97,6 +96,15 @@ gradient_minimizer(
}
local_energy
=
dockpars_energies_next[run_id*dockpars_pop_size+entity_id]
;
/*
printf
(
"run_id: %u, entity_id: %u, local_energy: %f\n"
,
run_id,
entity_id,
local_energy
)
;
*/
/*
printf
(
"BEFORE GRADIENT - local_energy: %f\n"
,
local_energy
)
;
*/
}
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
...
...
@@ -106,7 +114,7 @@ gradient_minimizer(
__local
float
local_gNorm
; // gradient norm (shared in the CU), originally as "gnorm"
__local
uint
local_nIter
; // iteration counter, originally as "niter"
__local
float
local_perturbation
[ACTUAL_GENOTYPE_LENGTH]
; // perturbation, originally as "dx"
__local
float
local_genotype[ACTUAL_GENOTYPE_LENGTH]
;
// optimization vector, originally as "d_x"
__local
float
local_genotype
[ACTUAL_GENOTYPE_LENGTH]
; // optimization vector, originally as "d_x"
if
(
get_local_id
(
0
)
==
0
)
{
local_gNorm
=
FLT_MAX
;
...
...
@@ -132,13 +140,10 @@ gradient_minimizer(
//
and
then
passed
to
non-kernel
functions.
//
Partial
results
in
"is_gradDescent_enabled()"
__local
bool
is_gNorm_gt_gMin
;
__local
bool
is_nIter_lt_maxIter
;
__local
bool
is_perturb_gt_gene_min
[ACTUAL_GENOTYPE_LENGTH]
;
__local
bool
is_perturb_gt_genotype
;
__local
bool
is_gradDescentEn
;
//
Partial
results
in
"stepGPU()"
//
Partial
results
of
the
gradient
step
__local
float
local_gradient
[ACTUAL_GENOTYPE_LENGTH]
; // gradient, originally as "d_g"
__local
float
local_genotype_new
[ACTUAL_GENOTYPE_LENGTH]
; // new actual solution, originally as "d_xnew"
__local
float
local_genotype_diff
[ACTUAL_GENOTYPE_LENGTH]
; // difference between actual and old solution, originally as "d_xdiff"
...
...
@@ -155,15 +160,6 @@ gradient_minimizer(
__local
float
gradient_inter_x[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_y[MAX_NUM_OF_ATOMS]
;
__local
float
gradient_inter_z[MAX_NUM_OF_ATOMS]
;
//
Enable
gradient
calculation
for
this
kernel
__local
bool
is_enabled_gradient_calc
;
if
(
get_local_id
(
0
)
==
0
)
{
is_enabled_gradient_calc
=
true
;
}
//
Final
gradient
resulting
out
of
gradient
calculation
__local
float
gradient_genotype[GENOTYPE_LENGTH_IN_GLOBMEM]
;
//
-------------------------------------------------------------------
//
Variables
to
store
partial
energies
...
...
@@ -175,10 +171,7 @@ gradient_minimizer(
//
-----------------------------------------------------------------------------
//
Perform
gradient-descent
iterations
while
(
is_gradDescent_enabled
(
&is_gNorm_gt_gMin,
&is_nIter_lt_maxIter,
is_perturb_gt_gene_min,
&is_perturb_gt_genotype,
&local_gNorm,
gradMin_tol,
&local_nIter,
...
...
@@ -187,18 +180,113 @@ gradient_minimizer(
gradMin_conformation_min_perturbation,
&is_gradDescentEn,
dockpars_num_of_genes
)
==
true
)
{
//
Calculating
gradient
//
=============================================================
gpu_calc_gradient
(
dockpars_rotbondlist_length,
dockpars_num_of_atoms,
dockpars_gridsize_x,
dockpars_gridsize_y,
dockpars_gridsize_z,
dockpars_fgrids,
dockpars_num_of_atypes,
dockpars_num_of_intraE_contributors,
dockpars_grid_spacing,
dockpars_coeff_elec,
dockpars_qasp,
dockpars_coeff_desolv,
local_genotype,
/*
&local_energy,
*/
&run_id,
//
Some
OpenCL
compilers
don
't
allow
declaring
//
local
variables
within
non-kernel
functions.
//
These
local
variables
must
be
declared
in
a
kernel,
//
and
then
passed
to
non-kernel
functions.
calc_coords_x,
calc_coords_y,
calc_coords_z,
atom_charges_const,
atom_types_const,
intraE_contributors_const,
VWpars_AC_const,
VWpars_BD_const,
dspars_S_const,
dspars_V_const,
rotlist_const,
ref_coords_x_const,
ref_coords_y_const,
ref_coords_z_const,
rotbonds_moving_vectors_const,
rotbonds_unit_vectors_const,
ref_orientation_quats_const
//
Gradient-related
arguments
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
,
dockpars_num_of_genes,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
local_gradient
)
;
//
=============================================================
stepGPU
(
//
Args
for
minimization
local_genotype,
local_genotype_new,
local_genotype_diff,
local_gradient,
gradMin_alpha,
gradMin_h,
dockpars_num_of_genes,
//gradMin_M
//
Args
for
energy
and
gradient
calculation
dockpars_rotbondlist_length,
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]
;
//
Updating
terminatiodockpars_num_of_genesn
metrics
local_genotype_diff[i]
=
local_genotype_new[i]
-
local_genotype[i]
;
//
Updating
current
solution
local_genotype[i]
=
local_genotype_new[i]
;
}
//
Updating
number
of
stepest-descent
iterations
if
(
get_local_id
(
0
)
==
0
)
{
local_nIter
=
local_nIter
+
1
;
}
//
Storing
the
norm
of
all
gradients
local_gNorm
=
inner_product
(
local_gradient,
local_gradient,
dockpars_num_of_genes,
dotProduct
)
;
if
(
get_local_id
(
0
)
==
0
)
{
local_gNorm
=
native_sqrt
(
local_gNorm
)
;
}
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
//
Storing
all
gene-based
perturbations
for
(
uint
i
=
get_local_id
(
0
)
;
i
<
dockpars_num_of_genes
;
i+=
NUM_OF_THREADS_PER_BLOCK
)
{
local_perturbation[i]
=
local_genotype_diff
[i]
;
}
/*
if
(
get_local_id
(
0
)
==
0
)
{
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
)
;
}
*/
}
//
-----------------------------------------------------------------------------
//
Calculating
energy
//
=============================================================
gpu_calc_energy
(
dockpars_rotbondlist_length,
dockpars_num_of_atoms,
dockpars_gridsize_x,
dockpars_gridsize_y,
...
...
@@ -236,64 +324,15 @@ gradient_minimizer(
rotbonds_moving_vectors_const,
rotbonds_unit_vectors_const,
ref_orientation_quats_const
//
Gradient-related
arguments
//
Calculate
gradients
(
forces
)
for
intermolecular
energy
//
Derived
from
autodockdev/maps.py
,
&is_enabled_gradient_calc,
gradient_inter_x,
gradient_inter_y,
gradient_inter_z,
gradient_genotype
)
;
//
-------------------------------------------------------------------
//
Updating
number
of
stepest-descent
iterations
if
(
get_local_id
(
0
)
==
0
)
{
local_nIter
=
local_nIter
+
1
;
}
//
Storing
the
norm
of
all
gradients
/*
local_gNorm
=
native_sqrt
(
inner_product
(
local_gradient,
local_gradient,
dockpars_num_of_genes,
dotProduct
))
;
*/
local_gNorm
=
inner_product
(
local_gradient,
local_gradient,
dockpars_num_of_genes,
dotProduct
)
;
if
(
get_local_id
(
0
)
==
0
)
{
local_gNorm
=
native_sqrt
(
local_gNorm
)
;
}