Skip to content

Commit

Permalink
fix swap good
Browse files Browse the repository at this point in the history
  • Loading branch information
garyzhang91 committed Jun 21, 2018
1 parent e27431e commit 4eb5418
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void simulate(Chain * chain, Chaint *chaint, Biasmap* biasmap, simulation_params
int stopSignal = 0;
int swapInd = 0;
int swapInd2 = 0;
int swapLength = 20; //size of swapping pool
int swapLength = 10; //size of swapping pool
int inCache = 0;
int ind = 0;
int currIndex = 0;
Expand All @@ -215,7 +215,7 @@ void simulate(Chain * chain, Chaint *chaint, Biasmap* biasmap, simulation_params
int noImprovStopSteps = 20000000;
int swapBadSteps = 200000;
int swapGoodSteps = 200000;
double goodEnergyDiff = 8.33; //5kcal
double goodEnergyDiff = 5; //5kcal=8.33
double rmsdCutoff = 2.0; // swapping clusters rmsd cutoff
double heatFactor = 0.5; // starting temp while annealing
double annealFactor = 1.02; // 1.02^35 = 1.015^47 = 1.012^58 = 2 ,first 35 *10000 to reach room temperature
Expand Down
10 changes: 5 additions & 5 deletions 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 > 0) external_k = 0.02 * external_k;
if (q > 0 || externalloss < -10 ) external_k = 0.1 * external_k;
//loss is negative!! if loss is negative, it's worse, bad
/* Metropolis criteria */
//loss += q - chain->Erg(0, 0);
Expand All @@ -113,14 +113,14 @@ static int allowed(Chain *chain, Chaint *chaint, Biasmap* biasmap, int start, in



if (loss < 0.0 && !sim_params->NS && exp(sim_params->thermobeta * (loss)) * RAND_MAX < external_k * rand()) {
if (loss < 0.0 && !sim_params->NS && exp(sim_params->thermobeta * loss) * RAND_MAX < external_k * rand()) {
//fprintf(stderr," rejected\n");
return 0; /* disregard rejected changes */
}

if (sim_params->protein_model.external_potential_type == 5 && externalloss < 0.0 && !sim_params->NS && sim_params->thermobeta * externalloss * RAND_MAX * external_k < - rand()) {
return 0;
}
if (sim_params->protein_model.external_potential_type == 5 && externalloss < 0.0 && !sim_params->NS && sim_params->thermobeta * externalloss * RAND_MAX * external_k < -rand()) {
return 0;
}
//
//if (sim_params->protein_model.external_potential_type == 5 && q >= 10 && !sim_params->NS && externalloss < 0.0 && exp(sim_params->thermobeta * externalloss) * RAND_MAX < external_k * rand()) {
// //fprintf(stderr," rejected\n");
Expand Down
4 changes: 2 additions & 2 deletions vdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ double clash(AA *a, model_params *mod_params)
double HHvDW(AA *a, AA *b)
{
double HHradii = 2.6;
double HHstrength = 0.077;
double HHstrength = 0.1;
if (a->id == 'P' || b->id == 'P') return 0.;
double distHH = distance(a->h, b->h);
if (distHH >= 9) return 0.;
double p6 = (HHradii*HHradii/distHH) * (HHradii*HHradii/distHH) *(HHradii*HHradii/distHH);
double erg=0.;
if (a->id != 'P' && b->id != 'P' && distHH<9) {
erg = 1/sqrt(distHH) + HHstrength * (p6*p6-2*p6) - 0.282;
erg = 1/sqrt(distHH) + HHstrength * (p6*p6-2*p6) - 0.2665;
//fprintf(stderr, "close exN HH %g\n", erg);
}
return erg;
Expand Down

0 comments on commit 4eb5418

Please sign in to comment.