Commit c14cba0d authored by Leonardo Solis's avatar Leonardo Solis
Browse files

added mult constants

parent d83d530e
......@@ -57,13 +57,16 @@ 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])
// Constants for dielelectric term of the intramolecular energy/gradient
#define DIEL_A -8.5525f
#define DIEL_WAT 78.4f
#define DIEL_B (DIEL_WAT - DIEL_A)
#define DIEL_LAMBDA 0.003627f
#define DIEL_H DIEL_LAMBDA
#define DIEL_K 7.7839f
// Constants for dielelectric term of the
// electrostatic component of the intramolecular energy/gradient
#define DIEL_A -8.5525f
#define DIEL_WAT 78.4f
#define DIEL_B (DIEL_WAT - DIEL_A)
#define DIEL_LAMBDA 0.003627f
#define DIEL_H DIEL_LAMBDA
#define DIEL_K 7.7839f
#define DIEL_B_TIMES_H (DIEL_B*DIEL_H)
#define DIEL_B_TIMES_H_TIMES_K (DIEL_B_TIMES_H*DIEL_K)
// Used for Shoemake to quternion transformation
#define PI_TIMES_2 (float)(2.0f*M_PI)
......
......@@ -597,6 +597,8 @@ void gpu_calc_energy(
#endif
//calculating electrostatic term
/*
#if defined (NATIVE_PRECISION)
partial_energies[get_local_id(0)] += native_divide (
dockpars_coeff_elec * atom_charges_const[atom1_id] * atom_charges_const[atom2_id],
......@@ -611,6 +613,30 @@ void gpu_calc_energy(
partial_energies[get_local_id(0)] += dockpars_coeff_elec*atom_charges_const[atom1_id]*atom_charges_const[atom2_id]/
(atomic_distance*(-8.5525f + 86.9525f/(1.0f + 7.7839f*exp(-0.3154f*atomic_distance))));
#endif
*/
#if defined (NATIVE_PRECISION)
partial_energies[get_local_id(0)] += native_divide (
dockpars_coeff_elec * atom_charges_const[atom1_id] * atom_charges_const[atom2_id],
atomic_distance * (DIEL_A + native_divide(DIEL_B,(1.0f + DIEL_K*native_exp(-DIEL_B_TIMES_H*atomic_distance))))
);
#elif defined (HALF_PRECISION)
partial_energies[get_local_id(0)] += half_divide (
dockpars_coeff_elec * atom_charges_const[atom1_id] * atom_charges_const[atom2_id],
atomic_distance * (DIEL_A + half_divide(DIEL_B,(1.0f + DIEL_K*half_exp(-DIEL_B_TIMES_H*atomic_distance))))
);
#else // Full precision
partial_energies[get_local_id(0)] += dockpars_coeff_elec*atom_charges_const[atom1_id]*atom_charges_const[atom2_id]/
(atomic_distance*(DIEL_A + DIEL_B/(1.0f + DIEL_K*exp(-DIEL_B_TIMES_H*atomic_distance))));
#endif
//calculating desolvation term
#if defined (NATIVE_PRECISION)
......
......@@ -39,15 +39,11 @@ void gpu_calc_gradient(
float dockpars_coeff_elec,
float dockpars_qasp,
float dockpars_coeff_desolv,
// 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.
// 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* genotype,
/*
__local float* energy,
*/
__local int* run_id,
__local float* calc_coords_x,
......@@ -590,17 +586,11 @@ void gpu_calc_gradient(
// Calculating electrostatic term
// http://www.wolframalpha.com/input/?i=1%2F(x*(A%2B(B%2F(1%2BK*exp(-h*B*x)))))
float upper = DIEL_A*native_powr(native_exp(DIEL_B*DIEL_H*atomic_distance) + DIEL_K, 2) + (DIEL_B)*native_exp(DIEL_B*DIEL_H*atomic_distance)*(DIEL_B*DIEL_H*DIEL_K*atomic_distance + native_exp(DIEL_B*DIEL_H*atomic_distance) + DIEL_K);
float upper = DIEL_A*native_powr(native_exp(DIEL_B_TIMES_H*atomic_distance) + DIEL_K, 2) + (DIEL_B)*native_exp(DIEL_B_TIMES_H*atomic_distance)*(DIEL_B_TIMES_H_TIMES_K*atomic_distance + native_exp(DIEL_B_TIMES_H*atomic_distance) + DIEL_K);
float lower = native_powr(atomic_distance, 2) * native_powr(DIEL_A * (native_exp(DIEL_B*DIEL_H*atomic_distance) + DIEL_K) + DIEL_B * native_exp(DIEL_B*DIEL_H*atomic_distance), 2);
gradient_per_intracontributor[contributor_counter] += -dockpars_coeff_elec * atom_charges_const[atom1_id] * atom_charges_const[atom2_id] *
native_divide (upper, lower);
// (-8.5525f + native_divide(86.9525f,(1.0f + 7.7839f*native_exp(-0.3154f*atomic_distance))))
float lower = native_powr(atomic_distance, 2) * native_powr(DIEL_A * (native_exp(DIEL_B_TIMES_H*atomic_distance) + DIEL_K) + DIEL_B * native_exp(DIEL_B_TIMES_H*atomic_distance), 2);
gradient_per_intracontributor[contributor_counter] += -dockpars_coeff_elec * atom_charges_const[atom1_id] * atom_charges_const[atom2_id] * native_divide (upper, lower);
// Calculating desolvation term
gradient_per_intracontributor[contributor_counter] += (
......
Markdown is supported
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