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

mutation and LS modify u1 gene as 0.2f

parent f9234691
......@@ -296,6 +296,9 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
// FIXME: add precision choices with preprocessor directives:
// NATIVE_PRECISION, HALF_PRECISION, Full precision
// Used to test if u1 is within the valid range [0,1]
/*
if (u1 > 1) {
u1 = 0.9f;
}
......@@ -303,13 +306,14 @@ void gpu_calc_energy( int dockpars_rotbondlist_length,
if (u1 < 0) {
u1 = 0.1f;
}
*/
quatrot_left_q = native_sqrt(1 - u1) * native_sin(u2);
quatrot_left_x = native_sqrt(1 - u1) * native_cos(u2);
quatrot_left_y = native_sqrt(u1) * native_sin(u3);
quatrot_left_z = native_sqrt(u1) * native_cos(u3);
// Used to test if u1 is within the valid range [0,1]
/*
if ((1-u1) < 0) {
printf("u1:%f 1-u1:%f sqrt(1-u1):%f\n", u1, (1-u1), sqrt(1-u1));
......
......@@ -200,9 +200,15 @@ perform_LS( char dockpars_num_of_atoms,
for (gene_counter=get_local_id(0);
gene_counter<dockpars_num_of_genes;
gene_counter += NUM_OF_THREADS_PER_BLOCK) {
if (gene_counter == 3) {
genotype_candidate[gene_counter] = 0.2f*gpu_randf(dockpars_prng_states);
}
else {
genotype_candidate[gene_counter] = offspring_genotype[gene_counter] + genotype_deviate[gene_counter] + genotype_bias[gene_counter];
}
/*
genotype_candidate[gene_counter] = offspring_genotype[gene_counter] + genotype_deviate[gene_counter] + genotype_bias[gene_counter];
///*
if (gene_counter == 3) {// u1, FIXME: hardcoded
if (genotype_candidate[gene_counter] > 1.0f) { // clamp it
offspring_genotype[gene_counter] = 0.9f;
......@@ -212,7 +218,7 @@ perform_LS( char dockpars_num_of_atoms,
}
//printf("LS positive - genotype_candidate[gene_counter]: %f\n", genotype_candidate[gene_counter]);
}
//*/
*/
}
......@@ -295,9 +301,18 @@ perform_LS( char dockpars_num_of_atoms,
for (gene_counter=get_local_id(0);
gene_counter<dockpars_num_of_genes;
gene_counter += NUM_OF_THREADS_PER_BLOCK) {
if (gene_counter == 3) {
genotype_candidate[gene_counter] = 0.2f*gpu_randf(dockpars_prng_states);
}
else {
genotype_candidate[gene_counter] = offspring_genotype[gene_counter] - genotype_deviate[gene_counter] - genotype_bias[gene_counter];
}
/*
genotype_candidate[gene_counter] = offspring_genotype[gene_counter] - genotype_deviate[gene_counter] - genotype_bias[gene_counter];
///*
if (gene_counter == 3) {// u1, FIXME: hardcoded
if (genotype_candidate[gene_counter] > 1.0f) { // clamp it
offspring_genotype[gene_counter] = 0.9f;
......@@ -307,7 +322,7 @@ perform_LS( char dockpars_num_of_atoms,
}
//printf("LS negative - genotype_candidate[gene_counter]: %f\n", genotype_candidate[gene_counter]);
}
//*/
*/
}
......
......@@ -251,9 +251,13 @@ gpu_gen_and_eval_newpops(char dockpars_num_of_atoms,
if (gene_counter < 3)
offspring_genotype[gene_counter] += dockpars_abs_max_dmov*(2*gpu_randf(dockpars_prng_states)-1);
else if (gene_counter == 3) {// u1, FIXME: hardcoded
offspring_genotype[gene_counter] = 0.2f*gpu_randf(dockpars_prng_states);
/*
offspring_genotype[gene_counter] += 0.2f*(2*gpu_randf(dockpars_prng_states)-1);
///*
if (offspring_genotype[gene_counter] > 1.0f) { // clamp it
offspring_genotype[gene_counter] = 0.9f;
}
......@@ -261,7 +265,7 @@ gpu_gen_and_eval_newpops(char dockpars_num_of_atoms,
offspring_genotype[gene_counter] = 0.1f;
}
//printf("mutation - offspring_genotype[gene_counter]: %f\n", offspring_genotype[gene_counter]);
//*/
*/
}
else if (gene_counter < 6) { // u2&3, FIXME: hardcoded
......
......@@ -722,9 +722,10 @@ filled with clock() */
#if defined (DOCK_DEBUG)
for (int cnt_pop=0;cnt_pop<size_populations/sizeof(float);cnt_pop++)
printf("total_num_pop: %u, cpu_final_populations[%u]: %f\n",(unsigned int)(size_populations/sizeof(float)),cnt_pop,cpu_final_populations[cnt_pop]);
#endif
for (int cnt_pop=0;cnt_pop<size_energies/sizeof(float);cnt_pop++)
printf("total_num_energies: %u, cpu_energies[%u]: %f\n", (unsigned int)(size_energies/sizeof(float)),cnt_pop,cpu_energies[cnt_pop]);
#endif
// ===============================================================================
......
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