Skip to content

Commit

Permalink
fix a few bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
garyzhang91 committed Jun 12, 2018
1 parent e8479a7 commit a9aa647
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions energy.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ double lowerGridEnergy(double E) {
// //return log10f(E) + 9;
// return log(E) + 1.71828;
//}
if (E > 5) {
if (E > 1) {
//return log10f(E) + 9;
return log(E) + 5;
return log(E) + 1;
}
return E;
}
Expand Down
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ void simulate(Chain * chain, Chaint *chaint, Biasmap* biasmap, simulation_params
//sim_params->protein_model.external_k[0] = external_k;
//bestIndex = i*sim_params->pace + j;
}
else if (currIndex - lastIndex > swapGoodSteps) {
else if (currIndex - lastIndex > swapGoodSteps && rand()%10000<100) {
if (swapAneal || external_k == sim_params->protein_model.external_k[0]) {

swapInd = rand() % (swapLength + 1);
Expand All @@ -427,7 +427,7 @@ void simulate(Chain * chain, Chaint *chaint, Biasmap* biasmap, simulation_params


}
else if (currIndex - lastIndex > swapBadSteps) {
else if (currIndex - lastIndex > swapBadSteps && rand()%10000<1000 ) {
if (swapAneal || external_k == sim_params->protein_model.external_k[0]) {
swapInd = rand() % (swapLength + 1);
//energy_matrix_print(chain, biasmap, sim_params);
Expand Down
2 changes: 1 addition & 1 deletion metropolis.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static int allowed(Chain *chain, Chaint *chaint, Biasmap* biasmap, int start, in
double internalloss = loss;
double external_k = 1.0;
if (sim_params->protein_model.external_potential_type == 5 || sim_params->protein_model.external_potential_type2 == 4) external_k = sim_params->protein_model.external_k[0];
//if (q > 5) external_k = 0.02;
if (q > 5) external_k = 0.02;
//loss is negative!! if loss is negative, it's worse, bad
/* Metropolis criteria */
//loss += q - chain->Erg(0, 0);
Expand Down

0 comments on commit a9aa647

Please sign in to comment.