Commit 4b102962 authored by Leonardo Solis's avatar Leonardo Solis

#31, removed alternative fixed-point for simplicity

parent 8bd524e8
......@@ -9,24 +9,13 @@ __kernel __attribute__ ((max_global_work_dim(0)))
__kernel __attribute__ ((reqd_work_group_size(1,1,1)))
void Krnl_Conform(
__global const int* restrict KerConstStatic_rotlist_const,
#if defined (FIXED_POINT_CONFORM)
__constant fixedpt3* restrict KerConstStatic_ref_coords_const,
__constant fixedpt3* restrict KerConstStatic_rotbonds_moving_vectors_const,
__constant fixedpt3* restrict KerConstStatic_rotbonds_unit_vectors_const,
#else
__constant float3* restrict KerConstStatic_ref_coords_const,
__constant float3* restrict KerConstStatic_rotbonds_moving_vectors_const,
__constant float3* restrict KerConstStatic_rotbonds_unit_vectors_const,
#endif
__constant float3* restrict KerConstStatic_rotbonds_unit_vectors_const,
unsigned int DockConst_rotbondlist_length,
unsigned char DockConst_num_of_atoms,
unsigned char DockConst_num_of_genes,
#if defined (FIXED_POINT_CONFORM)
__constant fixedpt4* restrict KerConstStatic_ref_orientation_quats_const,
#else
__constant float4* restrict KerConstStatic_ref_orientation_quats_const,
#endif
unsigned short Host_RunId
)
{
......@@ -59,23 +48,7 @@ LOOP_WHILE_CONFORM_MAIN:
while(active) {
char mode;
#if defined (FIXED_POINT_CONFORM)
fixedpt phi;
fixedpt theta;
fixedpt genrotangle;
fixedpt3 genotype_xyz;
/*
fixedpt3 __attribute__ ((
memory,
numbanks(1),
bankwidth(16),
singlepump,
numreadports(3),
numwriteports(1)
)) loc_coords [MAX_NUM_OF_ATOMS];
*/
fixedpt3 loc_coords [MAX_NUM_OF_ATOMS];
#else
float phi;
float theta;
float genrotangle;
......@@ -91,7 +64,6 @@ while(active) {
)) loc_coords [MAX_NUM_OF_ATOMS];
*/
float3 loc_coords [MAX_NUM_OF_ATOMS];
#endif
char actmode;
read_pipe_block(chan_IGL2Conform_actmode, &actmode);
......@@ -103,11 +75,7 @@ while(active) {
//printf("Conform: %u\n", mode);
#if defined (FIXED_POINT_CONFORM)
fixedpt genotype [ACTUAL_GENOTYPE_LENGTH];
#else
float genotype [ACTUAL_GENOTYPE_LENGTH];
#endif
__attribute__((xcl_pipeline_loop))
LOOP_FOR_CONFORM_READ_GENOTYPE:
......@@ -133,19 +101,6 @@ while(active) {
//printf("Conform: %u %u\n", mode, i);
#if defined (FIXED_POINT_CONFORM)
// Convert float to fixedpt
fixedpt fx_tmp = fixedpt_fromfloat(fl_tmp);
switch (i) {
case 0: genotype_xyz.x = fx_tmp; break;
case 1: genotype_xyz.y = fx_tmp; break;
case 2: genotype_xyz.z = fx_tmp; break;
case 3: phi = fx_tmp; break;
case 4: theta = fx_tmp; break;
case 5: genrotangle = fx_tmp; break;
}
genotype [i] = fx_tmp;
#else
switch (i) {
case 0: genotype_xyz.x = fl_tmp; break;
case 1: genotype_xyz.y = fl_tmp; break;
......@@ -155,7 +110,6 @@ while(active) {
case 5: genrotangle = fl_tmp; break;
}
genotype [i] = fl_tmp;
#endif
}
#if defined (DEBUG_ACTIVE_KERNEL)
......@@ -173,11 +127,7 @@ while(active) {
uint atom_id = rotation_list_element & RLIST_ATOMID_MASK;
// Capturing atom coordinates
#if defined (FIXED_POINT_CONFORM)
fixedpt3 atom_to_rotate;
#else
float3 atom_to_rotate;
#endif
if ((rotation_list_element & RLIST_FIRSTROT_MASK) != 0) // If first rotation of this atom
{
......@@ -189,27 +139,12 @@ while(active) {
}
// Capturing rotation vectors and angle
#if defined (FIXED_POINT_CONFORM)
fixedpt3 rotation_unitvec;
fixedpt3 rotation_movingvec;
fixedpt rotation_angle;
#else
float3 rotation_unitvec;
float3 rotation_movingvec;
float rotation_angle;
#endif
if ((rotation_list_element & RLIST_GENROT_MASK) != 0) // If general rotation
{
#if defined (FIXED_POINT_CONFORM)
fixedpt sin_theta, cos_theta;
fixedpt3 genrot_unitvec;
sin_theta = fixedpt_sin(theta);
cos_theta = fixedpt_cos(theta);
genrot_unitvec.x = fixedpt_mul(sin_theta, fixedpt_cos(phi));
genrot_unitvec.y = fixedpt_mul(sin_theta, fixedpt_sin(phi));
genrot_unitvec.z = cos_theta;
#else
float sin_theta, cos_theta;
float3 genrot_unitvec;
sin_theta = native_sin(theta);
......@@ -217,12 +152,9 @@ while(active) {
genrot_unitvec.x = sin_theta*native_cos(phi);
genrot_unitvec.y = sin_theta*native_sin(phi);
genrot_unitvec.z = cos_theta;
#endif
rotation_unitvec = genrot_unitvec;
rotation_angle = genrotangle;
rotation_movingvec = genotype_xyz;
}
else // If rotating around rotatable bond
......@@ -237,40 +169,15 @@ while(active) {
// In addition performing the first movement
// which is needed only if rotating around rotatable bond
#if defined (FIXED_POINT_CONFORM)
atom_to_rotate.x = fixedpt_sub(atom_to_rotate.x, rotation_movingvec.x);
atom_to_rotate.y = fixedpt_sub(atom_to_rotate.y, rotation_movingvec.y);
atom_to_rotate.z = fixedpt_sub(atom_to_rotate.z, rotation_movingvec.z);
#else
atom_to_rotate -= rotation_movingvec;
#endif
}
// Performing rotation
#if defined (FIXED_POINT_CONFORM)
fixedpt quatrot_left_x, quatrot_left_y, quatrot_left_z, quatrot_left_q;
fixedpt quatrot_temp_x, quatrot_temp_y, quatrot_temp_z, quatrot_temp_q;
#else
float4 quatrot_left;
float4 quatrot_temp;
#endif
#if defined (FIXED_POINT_CONFORM)
rotation_angle = rotation_angle >> 1;
#else
rotation_angle = rotation_angle*0.5f;
#endif
#if defined (FIXED_POINT_CONFORM)
fixedpt sin_angle, cos_angle;
sin_angle = fixedpt_sin(rotation_angle);
cos_angle = fixedpt_cos(rotation_angle);
quatrot_left_x = fixedpt_mul(sin_angle, rotation_unitvec.x);
quatrot_left_y = fixedpt_mul(sin_angle, rotation_unitvec.y);
quatrot_left_z = fixedpt_mul(sin_angle, rotation_unitvec.z);
quatrot_left_q = cos_angle;
#else
float sin_angle, cos_angle;
sin_angle = native_sin(rotation_angle);
cos_angle = native_cos(rotation_angle);
......@@ -278,59 +185,22 @@ while(active) {
quatrot_left.y = sin_angle*rotation_unitvec.y;
quatrot_left.z = sin_angle*rotation_unitvec.z;
quatrot_left.w = cos_angle;
#endif
if ((rotation_list_element & RLIST_GENROT_MASK) != 0) // If general rotation,
// two rotations should be performed
// (multiplying the quaternions)
{
#if defined (FIXED_POINT_CONFORM)
const fixedpt4 ref_orientation_quats_const = KerConstStatic_ref_orientation_quats_const[Host_RunId];
const fixedpt ref_orientation_quats_const_0 = ref_orientation_quats_const.x;
const fixedpt ref_orientation_quats_const_1 = ref_orientation_quats_const.y;
const fixedpt ref_orientation_quats_const_2 = ref_orientation_quats_const.z;
const fixedpt ref_orientation_quats_const_3 = ref_orientation_quats_const.w;
#else
const float4 ref_orientation_quats_const = KerConstStatic_ref_orientation_quats_const[Host_RunId];
const float ref_orientation_quats_const_0 = ref_orientation_quats_const.x;
const float ref_orientation_quats_const_1 = ref_orientation_quats_const.y;
const float ref_orientation_quats_const_2 = ref_orientation_quats_const.z;
const float ref_orientation_quats_const_3 = ref_orientation_quats_const.w;
#endif
// Calculating quatrot_left*ref_orientation_quats_const,
// which means that reference orientation rotation is the first
#if defined (FIXED_POINT_CONFORM)
quatrot_temp_q = quatrot_left_q;
quatrot_temp_x = quatrot_left_x;
quatrot_temp_y = quatrot_left_y;
quatrot_temp_z = quatrot_left_z;
#else
quatrot_temp = quatrot_left;
#endif
// Taking the first element of ref_orientation_quats_const member
#if defined (FIXED_POINT_CONFORM)
quatrot_left_q = fixedpt_mul(quatrot_temp_q, ref_orientation_quats_const_0)
- fixedpt_mul(quatrot_temp_x, ref_orientation_quats_const_1)
- fixedpt_mul(quatrot_temp_y, ref_orientation_quats_const_2)
- fixedpt_mul(quatrot_temp_z, ref_orientation_quats_const_3);
quatrot_left_x = fixedpt_mul(quatrot_temp_q, ref_orientation_quats_const_1)
+ fixedpt_mul(quatrot_temp_x, ref_orientation_quats_const_0)
+ fixedpt_mul(quatrot_temp_y, ref_orientation_quats_const_3)
- fixedpt_mul(quatrot_temp_z, ref_orientation_quats_const_2);
quatrot_left_y = fixedpt_mul(quatrot_temp_q, ref_orientation_quats_const_2)
- fixedpt_mul(quatrot_temp_x, ref_orientation_quats_const_3)
+ fixedpt_mul(quatrot_temp_y, ref_orientation_quats_const_0)
+ fixedpt_mul(quatrot_temp_z, ref_orientation_quats_const_1);
quatrot_left_z = fixedpt_mul(quatrot_temp_q, ref_orientation_quats_const_3)
+ fixedpt_mul(quatrot_temp_x, ref_orientation_quats_const_2)
- fixedpt_mul(quatrot_temp_y, ref_orientation_quats_const_1)
+ fixedpt_mul(quatrot_temp_z, ref_orientation_quats_const_0);
#else
float4 ref4x = { ref_orientation_quats_const_0, ref_orientation_quats_const_3, - ref_orientation_quats_const_2, ref_orientation_quats_const_1};
float4 ref4y = { - ref_orientation_quats_const_3, ref_orientation_quats_const_0, ref_orientation_quats_const_1, ref_orientation_quats_const_2};
float4 ref4z = { ref_orientation_quats_const_2, - ref_orientation_quats_const_1, ref_orientation_quats_const_0, ref_orientation_quats_const_3};
......@@ -340,41 +210,8 @@ while(active) {
quatrot_left.y = dot(quatrot_temp, ref4y);
quatrot_left.z = dot(quatrot_temp, ref4z);
quatrot_left.w = dot(quatrot_temp, ref4w);
#endif
}
#if defined (FIXED_POINT_CONFORM)
quatrot_temp_q = - fixedpt_mul(quatrot_left_x, atom_to_rotate.x)
- fixedpt_mul(quatrot_left_y, atom_to_rotate.y)
- fixedpt_mul(quatrot_left_z, atom_to_rotate.z);
quatrot_temp_x = fixedpt_mul(quatrot_left_q, atom_to_rotate.x)
+ fixedpt_mul(quatrot_left_y, atom_to_rotate.z)
- fixedpt_mul(quatrot_left_z, atom_to_rotate.y);
quatrot_temp_y = fixedpt_mul(quatrot_left_q, atom_to_rotate.y)
- fixedpt_mul(quatrot_left_x, atom_to_rotate.z)
+ fixedpt_mul(quatrot_left_z, atom_to_rotate.x);
quatrot_temp_z = fixedpt_mul(quatrot_left_q, atom_to_rotate.z)
+ fixedpt_mul(quatrot_left_x, atom_to_rotate.y)
- fixedpt_mul(quatrot_left_y, atom_to_rotate.x);
atom_to_rotate.x = - fixedpt_mul(quatrot_temp_q, quatrot_left_x)
+ fixedpt_mul(quatrot_temp_x, quatrot_left_q)
- fixedpt_mul(quatrot_temp_y, quatrot_left_z)
+ fixedpt_mul(quatrot_temp_z, quatrot_left_y);
atom_to_rotate.y = - fixedpt_mul(quatrot_temp_q, quatrot_left_y)
+ fixedpt_mul(quatrot_temp_x, quatrot_left_z)
+ fixedpt_mul(quatrot_temp_y, quatrot_left_q)
- fixedpt_mul(quatrot_temp_z, quatrot_left_x);
atom_to_rotate.z = - fixedpt_mul(quatrot_temp_q, quatrot_left_z)
- fixedpt_mul(quatrot_temp_x, quatrot_left_y)
+ fixedpt_mul(quatrot_temp_y, quatrot_left_x)
+ fixedpt_mul(quatrot_temp_z, quatrot_left_q);
#else
float3 left3x = { quatrot_left.w, - quatrot_left.z, quatrot_left.y};
float3 left3y = { quatrot_left.z, quatrot_left.w, - quatrot_left.x};
float3 left3z = {- quatrot_left.y, quatrot_left.x, quatrot_left.w};
......@@ -392,7 +229,6 @@ while(active) {
atom_to_rotate.x = dot(quatrot_temp, left4x);
atom_to_rotate.y = dot(quatrot_temp, left4y);
atom_to_rotate.z = dot(quatrot_temp, left4z);
#endif
// Performing final movement and storing values
loc_coords[atom_id] = atom_to_rotate + rotation_movingvec;
......@@ -410,49 +246,6 @@ while(active) {
// --------------------------------------------------------------
// Send ligand atomic coordinates to channel
// --------------------------------------------------------------
/*
write_channel_altera(chan_Conf2Intere_active, active);
write_channel_altera(chan_Conf2Intrae_active, active);
mem_fence(CLK_CHANNEL_MEM_FENCE);
write_channel_altera(chan_Conf2Intere_mode, mode);
write_channel_altera(chan_Conf2Intrae_mode, mode);
mem_fence(CLK_CHANNEL_MEM_FENCE);
//float3 position_xyz;
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt++) {
write_channel_altera(chan_Conf2Intere_xyz, loc_coords[pipe_cnt]);
write_channel_altera(chan_Conf2Intrae_xyz, loc_coords[pipe_cnt]);
}*/
/*
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt++) {
if (pipe_cnt == 0) {
char active_tmp = active;
char mode_tmp = mode;
char2 actmode = {active_tmp, mode_tmp};
write_channel_altera(chan_Conf2Intere_actmode, actmode);
write_channel_altera(chan_Conf2Intrae_actmode, actmode);
}
mem_fence(CLK_CHANNEL_MEM_FENCE);
#if defined (FIXED_POINT_CONFORM)
// convert fixedpt3 to float3
float tmp_x = fixedpt_tofloat(loc_coords[pipe_cnt].x);
float tmp_y = fixedpt_tofloat(loc_coords[pipe_cnt].y);
float tmp_z = fixedpt_tofloat(loc_coords[pipe_cnt].z);
float3 tmp = {tmp_x, tmp_y, tmp_z};
#else
float3 tmp = loc_coords[pipe_cnt];
#endif
write_channel_altera(chan_Conf2Intere_xyz, tmp);
write_channel_altera(chan_Conf2Intrae_xyz, tmp);
}
*/
__attribute__((xcl_pipeline_loop))
LOOP_FOR_CONFORM_WRITE_XYZ:
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt+=2) {
......@@ -464,11 +257,7 @@ while(active) {
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
#if defined (FIXED_POINT_CONFORM)
fixedpt3 tmp_coords[2];
#else
float3 tmp_coords[2];
#endif
__attribute__((opencl_unroll_hint))
LOOP_CONFORM_OUT:
......@@ -478,20 +267,8 @@ while(active) {
float8 tmp;
#if defined (FIXED_POINT_CONFORM)
// Convert fixedpt3 to float3
float tmp_x1 = fixedpt_tofloat(tmp_coords[0].x);
float tmp_y1 = fixedpt_tofloat(tmp_coords[0].y);
float tmp_z1 = fixedpt_tofloat(tmp_coords[0].z);
float tmp_x2 = fixedpt_tofloat(tmp_coords[1].x);
float tmp_y2 = fixedpt_tofloat(tmp_coords[1].y);
float tmp_z2 = fixedpt_tofloat(tmp_coords[1].z);
tmp.s0 = tmp_x1; tmp.s1 = tmp_y1; tmp.s2 = tmp_z1; //tmp.s3
tmp.s4 = tmp_x2; tmp.s5 = tmp_y2; tmp.s6 = tmp_z2; //tmp.s7
#else
tmp.s0 = tmp_coords[0].x; tmp.s1 = tmp_coords[0].y; tmp.s2 = tmp_coords[0].z; //tmp.s3
tmp.s4 = tmp_coords[1].x; tmp.s5 = tmp_coords[1].y; tmp.s6 = tmp_coords[1].z; //tmp.s7
#endif
write_pipe_block(chan_Conf2Intere_xyz, &tmp);
write_pipe_block(chan_Conf2Intrae_xyz, &tmp);
......
......@@ -183,26 +183,6 @@ pipe float chan_IGL2Conform_genotype __attribute__((xcl_reqd_pipe_depth(P
// Resized to valid SDAccel depths: 16, 32, ...
pipe int chan_IGLArbiter_Off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
#if defined (FIXED_POINT_CONFORM) || \
defined (FIXED_POINT_LS1) || \
defined (FIXED_POINT_LS2) || \
defined (FIXED_POINT_LS3) || \
defined (FIXED_POINT_LS4) || \
defined (FIXED_POINT_LS5) || \
defined (FIXED_POINT_LS6) || \
defined (FIXED_POINT_LS7) || \
defined (FIXED_POINT_LS8) || \
defined (FIXED_POINT_LS9)
#include "../defines_fixedpt.h"
typedef int3 fixedpt3;
typedef int4 fixedpt4;
#endif
#if defined (FIXED_POINT_INTERE) || defined (FIXED_POINT_INTRAE)
#include "../defines_fixedpt_64.h"
#endif
// --------------------------------------------------------------------------
// Map the argument into the interval 0 - 180, or 0 - 360
// by adding/subtracting n*ang_max to/from it.
......@@ -233,43 +213,6 @@ float map_angle_360(float angle)
return x;
}
#if defined (FIXED_POINT_LS1) || \
defined (FIXED_POINT_LS2) || \
defined (FIXED_POINT_LS3) || \
defined (FIXED_POINT_LS4) || \
defined (FIXED_POINT_LS5) || \
defined (FIXED_POINT_LS6) || \
defined (FIXED_POINT_LS7) || \
defined (FIXED_POINT_LS8) || \
defined (FIXED_POINT_LS9)
#define FIXEDPT_180 0xB40000
#define FIXEDPT_360 0x1680000
fixedpt fixedpt_map_angle_180(fixedpt angle)
{
fixedpt x = angle;
//while (x < 0.0f)
if (x < 0)
{ x += FIXEDPT_180; }
//while (x > 180.0f)
if (x > FIXEDPT_180)
{ x -= FIXEDPT_180; }
return x;
}
fixedpt fixedpt_map_angle_360(fixedpt angle)
{
fixedpt x = angle;
//while (x < 0.0f)
if (x < 0)
{ x += FIXEDPT_360; }
//while (x > 360.0f)
if (x > FIXEDPT_360)
{ x -= FIXEDPT_360;}
return x;
}
#endif
// --------------------------------------------------------------------------
// Lamarckian Genetic-Algorithm (GA): GA + LS (Local Search)
// Originally from: searchoptimum.c
......
......@@ -12,39 +12,17 @@ __kernel __attribute__ ((max_global_work_dim(0)))
__kernel __attribute__ ((reqd_work_group_size(1,1,1)))
void Krnl_InterE(
__global const float* restrict GlobFgrids,
#if defined (FIXED_POINT_INTERE)
__constant fixedpt64* restrict KerConstStatic_atom_charges_const,
#else
__constant float* restrict KerConstStatic_atom_charges_const,
#endif
__constant char* restrict KerConstStatic_atom_types_const,
unsigned char DockConst_g1,
unsigned int DockConst_g2,
unsigned int DockConst_g3,
unsigned char DockConst_num_of_atoms,
#if defined (FIXED_POINT_INTERE)
unsigned char DockConst_gridsize_x_minus1,
unsigned char DockConst_gridsize_y_minus1,
unsigned char DockConst_gridsize_z_minus1,
#else
float DockConst_gridsize_x_minus1,
float DockConst_gridsize_y_minus1,
float DockConst_gridsize_z_minus1,
#endif
/*
#if defined(SEPARATE_FGRID_INTERE)
__constant float* restrict GlobFgrids2,
__constant float* restrict GlobFgrids3
#else
*/
unsigned int Host_mul_tmp2,
unsigned int Host_mul_tmp2,
unsigned int Host_mul_tmp3
/*
#endif
*/
)
{
char active = 0x01;
......@@ -102,11 +80,7 @@ while(active) {
if (active == 0x00) {printf(" %-20s: %s\n", "Krnl_InterE", "must be disabled");}
#endif
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_interE = 0;
#else
float interE = 0.0f;
#endif
// For each ligand atom
__attribute__((xcl_pipeline_loop))
......@@ -121,54 +95,24 @@ while(active) {
float y = loc_coords_atid1.y;
float z = loc_coords_atid1.z;
#if defined (FIXED_POINT_INTERE)
#else
float q = KerConstStatic_atom_charges_const [atom1_id];
#endif
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_x = fixedpt64_fromfloat(loc_coords_atid1.x);
fixedpt64 fixpt_y = fixedpt64_fromfloat(loc_coords_atid1.y);
fixedpt64 fixpt_z = fixedpt64_fromfloat(loc_coords_atid1.z);
// fixedpt64 fixpt_q = fixedpt64_fromfloat(atom_charges_localcache [atom1_id]);
fixedpt64 fixpt_q = KerConstStatic_atom_charges_const [atom1_id];
#endif
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_partialE1;
fixedpt64 fixpt_partialE2;
fixedpt64 fixpt_partialE3;
#else
float partialE1;
float partialE2;
float partialE3;
#endif
// If the atom is outside of the grid
#if defined (FIXED_POINT_INTERE)
if ((fixpt_x < 0) || (fixpt_x >= fixedpt64_fromint(DockConst_gridsize_x_minus1)) ||
(fixpt_y < 0) || (fixpt_y >= fixedpt64_fromint(DockConst_gridsize_y_minus1)) ||
(fixpt_z < 0) || (fixpt_z >= fixedpt64_fromint(DockConst_gridsize_z_minus1))) {
#else
if ((x < 0.0f) || (x >= DockConst_gridsize_x_minus1) ||
(y < 0.0f) || (y >= DockConst_gridsize_y_minus1) ||
(z < 0.0f) || (z >= DockConst_gridsize_z_minus1)) {
#endif
// Penalty is 2^24 for each atom outside the grid
/*
interE += 16777216.0f;
*/
#if defined (FIXED_POINT_INTERE)
fixpt_partialE1 = /*fixedpt64_fromfloat(16777216.0f)*/ 0x100000000000000;
fixpt_partialE2 = 0;
fixpt_partialE3 = 0;
#else
partialE1 = 16777216.0f;
partialE2 = 0.0f;
partialE3 = 0.0f;
#endif
}
else
{
......@@ -179,38 +123,12 @@ while(active) {
int y_high = convert_int(ceil(y));
int z_high = convert_int(ceil(z));
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_x_low = fixedpt64_floor(fixpt_x);
fixedpt64 fixpt_y_low = fixedpt64_floor(fixpt_y);
fixedpt64 fixpt_z_low = fixedpt64_floor(fixpt_z);
fixedpt64 fixpt_x_high = fixedpt64_ceil(fixpt_x);
fixedpt64 fixpt_y_high = fixedpt64_ceil(fixpt_y);
fixedpt64 fixpt_z_high = fixedpt64_ceil(fixpt_z);
#endif
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_dx = fixedpt64_sub(fixpt_x, fixpt_x_low);
fixedpt64 fixpt_dy = fixedpt64_sub(fixpt_y, fixpt_y_low);
fixedpt64 fixpt_dz = fixedpt64_sub(fixpt_z, fixpt_z_low);
#else
float dx = x - x_low;
float dy = y - y_low;
float dz = z - z_low;
#endif
// Calculates the weights for trilinear interpolation
// based on the location of the point inside
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_weights [2][2][2];
fixpt_weights [0][0][0] = fixedpt64_mul((FIXEDPT64_ONE-fixpt_dx), fixedpt64_mul((FIXEDPT64_ONE-fixpt_dy), (FIXEDPT64_ONE-fixpt_dz)));
fixpt_weights [1][0][0] = fixedpt64_mul(fixpt_dx, fixedpt64_mul((FIXEDPT64_ONE-fixpt_dy), (FIXEDPT64_ONE-fixpt_dz)));
fixpt_weights [0][1][0] = fixedpt64_mul((FIXEDPT64_ONE-fixpt_dx), fixedpt64_mul(fixpt_dy,(FIXEDPT64_ONE-fixpt_dz)));
fixpt_weights [1][1][0] = fixedpt64_mul(fixpt_dx, fixedpt64_mul(fixpt_dy, (FIXEDPT64_ONE-fixpt_dz)));
fixpt_weights [0][0][1] = fixedpt64_mul((FIXEDPT64_ONE-fixpt_dx), fixedpt64_mul((FIXEDPT64_ONE-fixpt_dy), fixpt_dz));
fixpt_weights [1][0][1] = fixedpt64_mul(fixpt_dx, fixedpt64_mul((FIXEDPT64_ONE-fixpt_dy), fixpt_dz));
fixpt_weights [0][1][1] = fixedpt64_mul((FIXEDPT64_ONE-fixpt_dx), fixedpt64_mul(fixpt_dy, fixpt_dz));
fixpt_weights [1][1][1] = fixedpt64_mul(fixpt_dx, fixedpt64_mul(fixpt_dy, fixpt_dz));
#else
float weights [2][2][2];
weights [0][0][0] = (1-dx)*(1-dy)*(1-dz);
weights [1][0][0] = dx*(1-dy)*(1-dz);
......@@ -220,7 +138,6 @@ while(active) {
weights [1][0][1] = dx*(1-dy)*dz;
weights [0][1][1] = (1-dx)*dy*dz;
weights [1][1][1] = dx*dy*dz;
#endif
#if defined (DEBUG_KRNL_INTERE)
printf("\n\nPartial results for atom with id %i:\n", atom1_id);
......@@ -257,17 +174,6 @@ while(active) {
uint mul_tmp = atom1_typeid * DockConst_g3;
// Energy contribution of the current grid type
#if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_cube [2][2][2];
fixpt_cube [0][0][0] = fixedpt64_fromfloat(GlobFgrids[cube_000 + mul_tmp]);
fixpt_cube [1][0][0] = fixedpt64_fromfloat(GlobFgrids[cube_100 + mul_tmp]);
fixpt_cube [0][1][0] = fixedpt64_fromfloat(GlobFgrids[cube_010 + mul_tmp]);
fixpt_cube [1][1][0] = fixedpt64_fromfloat(GlobFgrids[cube_110 + mul_tmp]);
fixpt_cube [0][0][1] = fixedpt64_fromfloat(GlobFgrids[cube_001 + mul_tmp]);
fixpt_cube [1][0][1] = fixedpt64_fromfloat(GlobFgrids[cube_101 + mul_tmp]);
fixpt_cube [0][1][1] = fixedpt64_fromfloat(GlobFgrids[cube_011 + mul_tmp]);
fixpt_cube [1][1][1] = fixedpt64_fromfloat(GlobFgrids[cube_111 + mul_tmp]);
#else
float cube [2][2][2];
cube [0][0][0] = GlobFgrids[cube_000 + mul_tmp];
cube [1][0][0] = GlobFgrids[cube_100 + mul_tmp];
......@@ -277,7 +183,6 @@ while(active) {
cube [1][0][1] = GlobFgrids[cube_101 + mul_tmp];
cube [0][1][1] = GlobFgrids[cube_011 + mul_tmp];
cube [1][1][1] = GlobFgrids[cube_111 + mul_tmp];
#endif