Commit 1c913820 authored by lvs's avatar lvs
Browse files

added smoothing in grad-intraE

parent 434f58a2
...@@ -72,6 +72,15 @@ void gpu_calc_gradient( ...@@ -72,6 +72,15 @@ void gpu_calc_gradient(
__constant float* atom_charges_const, __constant float* atom_charges_const,
__constant char* atom_types_const, __constant char* atom_types_const,
__constant char* intraE_contributors_const, __constant char* intraE_contributors_const,
// -------------------------------------------
// Smoothed pairwise gradients
// -------------------------------------------
float dockpars_smooth,
__constant float* reqm,
__constant float* reqm_hbond,
// -------------------------------------------
__constant float* VWpars_AC_const, __constant float* VWpars_AC_const,
__constant float* VWpars_BD_const, __constant float* VWpars_BD_const,
__constant float* dspars_S_const, __constant float* dspars_S_const,
...@@ -570,30 +579,85 @@ void gpu_calc_gradient( ...@@ -570,30 +579,85 @@ void gpu_calc_gradient(
// Calculating atomic distance // Calculating atomic distance
float atomic_distance = native_sqrt(subx*subx + suby*suby + subz*subz)*dockpars_grid_spacing; float atomic_distance = native_sqrt(subx*subx + suby*suby + subz*subz)*dockpars_grid_spacing;
/*
// -------------------------------------------
// Smoothed pairwise gradients
// -------------------------------------------
if (atomic_distance < 1.0f) if (atomic_distance < 1.0f)
atomic_distance = 1.0f; atomic_distance = 1.0f;
// -------------------------------------------
*/
// Calculating gradient contributions // Calculating gradient contributions
/*
if ((atomic_distance < 8.0f) && (atomic_distance < 20.48f)) if ((atomic_distance < 8.0f) && (atomic_distance < 20.48f))
*/
if (atomic_distance < 8.0f)
{ {
// Getting type IDs // Getting type IDs
uint atom1_typeid = atom_types_const[atom1_id]; uint atom1_typeid = atom_types_const[atom1_id];
uint atom2_typeid = atom_types_const[atom2_id]; uint atom2_typeid = atom_types_const[atom2_id];
//printf ("%-5u %-5u %-5u\n", contributor_counter, atom1_id, atom2_id); //printf ("%-5u %-5u %-5u\n", contributor_counter, atom1_id, atom2_id);
// Getting optimum pair distance (opt_distance) from reqm and reqm_hbond
// reqm: equilibrium internuclear separation
// (sum of the vdW radii of two like atoms (A)) in the case of vdW
// reqm_hbond: equilibrium internuclear separation
// (sum of the vdW radii of two like atoms (A)) in the case of hbond
float opt_distance;
if (intraE_contributors_const[3*contributor_counter+2] == 1) //H-bond
{
opt_distance = reqm_hbond [atom1_typeid] + reqm_hbond [atom2_typeid];
}
else //van der Waals
{
opt_distance = 0.5f*(reqm [atom1_typeid] + reqm [atom2_typeid]);
}
// Getting smoothed distance
// smoothed_distance = function(atomic_distance, opt_distance)
float smoothed_distance;
float delta_distance = 0.5f*dockpars_smooth;
if (atomic_distance <= (opt_distance - delta_distance)) {
smoothed_distance = atomic_distance + delta_distance;
}
else if (atomic_distance < (opt_distance + delta_distance)) {
smoothed_distance = opt_distance;
}
else { // else if (atomic_distance >= (opt_distance + delta_distance))
smoothed_distance = atomic_distance - delta_distance;
}
/*
if (get_local_id (0) == 0) {
if (intraE_contributors_const[3*contributor_counter+2] == 1) //H-bond
{
printf("%-5s %u %u %f %f %f %f %f %f\n", "hbond", atom1_typeid, atom2_typeid, reqm_hbond [atom1_typeid], reqm_hbond [atom2_typeid], opt_distance, delta_distance, atomic_distance, smoothed_distance);
}
else //van der Waals
{
printf("%-5s %u %u %f %f %f %f %f %f\n", "vdw", atom1_typeid, atom2_typeid, reqm [atom1_typeid], reqm [atom2_typeid], opt_distance, delta_distance, atomic_distance, smoothed_distance);
}
}
*/
// Calculating van der Waals / hydrogen bond term // Calculating van der Waals / hydrogen bond term
gradient_per_intracontributor[contributor_counter] += native_divide (-12*VWpars_AC_const[atom1_typeid * dockpars_num_of_atypes+atom2_typeid], gradient_per_intracontributor[contributor_counter] += native_divide (-12*VWpars_AC_const[atom1_typeid * dockpars_num_of_atypes+atom2_typeid],
native_powr(atomic_distance, 13) native_powr(smoothed_distance/*atomic_distance*/, 13)
); );
if (intraE_contributors_const[3*contributor_counter+2] == 1) { //H-bond if (intraE_contributors_const[3*contributor_counter+2] == 1) { //H-bond
gradient_per_intracontributor[contributor_counter] += native_divide (10*VWpars_BD_const[atom1_typeid * dockpars_num_of_atypes+atom2_typeid], gradient_per_intracontributor[contributor_counter] += native_divide (10*VWpars_BD_const[atom1_typeid * dockpars_num_of_atypes+atom2_typeid],
native_powr(atomic_distance, 11) native_powr(smoothed_distance/*atomic_distance*/, 11)
); );
} }
else { //van der Waals else { //van der Waals
gradient_per_intracontributor[contributor_counter] += native_divide (6*VWpars_BD_const[atom1_typeid * dockpars_num_of_atypes+atom2_typeid], gradient_per_intracontributor[contributor_counter] += native_divide (6*VWpars_BD_const[atom1_typeid * dockpars_num_of_atypes+atom2_typeid],
native_powr(atomic_distance, 7) native_powr(smoothed_distance/*atomic_distance*/, 7)
); );
} }
......
...@@ -403,6 +403,15 @@ gradient_minimizer( ...@@ -403,6 +403,15 @@ gradient_minimizer(
atom_charges_const, atom_charges_const,
atom_types_const, atom_types_const,
intraE_contributors_const, intraE_contributors_const,
// -------------------------------------------
// Smoothed pairwise potentials
// -------------------------------------------
dockpars_smooth,
reqm,
reqm_hbond,
// -------------------------------------------
VWpars_AC_const, VWpars_AC_const,
VWpars_BD_const, VWpars_BD_const,
dspars_S_const, dspars_S_const,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment