Species_parray species;
Rxn_parray reactions;
- //std::string couplingsFile = "neutral_2site.j";
Hamiltonian H(r.couplingsInfile);
H.set_temp(r.bh, r.bJ);
- //H.set_temp(0.01);
- //double mu = 6.0e-5;
- //double mu = 1.0e-1;
+
+ for (unsigned n = 0; n < r.num_runs; n++) {
// initialize virus
VirusSpecies *s1 = new VirusSpecies("I");
// V -> V + V'
VirusReaction* r1 = new VirusReaction(r.rate_s); // s_k
- //r1->rate_constant = 1.5;
r1->mu = r.mu;
r1->H = H;
r1->V = s1;
reactions.push_back(r1);
// V -> 0
VirusDeathReaction* r2 = new VirusDeathReaction(r.rate_u); // u
- //r2->rate_constant = 0.5;
r2->H = H;
r2->V = s1;
reactions.push_back(r2);
- //double t_end = 1000.0;
- //long max_steps = LONG_MAX;
- //double sample_interval = 1.0;
simulate(reactions, species, r.t_end, r.max_steps, r.sample_interval, print_spec, r.useVerbose);
- gsl_rng_free(rnd); //Free up memory from random number generator
-
// clean up reaction array
for (Rxn_parray::iterator it = reactions.begin(),
end = reactions.end();
delete (*it);
}
species.clear();
+ print_spec.clear();
+
+ } // num_runs
+
+ gsl_rng_free(rnd); //Free up memory from random number generator
}
double total_propensity = 0.0;
print_species_header(print_spec);
+ print_species_traj(t,print_spec,verbose); // XXX
Rxn_parray::iterator rxn, end;
}
- // stop if time runs out or too many steps
- for (; (max_steps == 0 || step < max_steps) && (t < t_end); ++step) {
+ // stop if time runs out or too many steps or no more reactions will occur
+ for (; (max_steps == 0 || step < max_steps) && (t < t_end) && (total_propensity > 0.0); ++step) {
double rand = (1.0-gsl_rng_uniform_pos(rnd)) * total_propensity; // uniform on (0,R]
double a_sum = 0.0;
" -E (int) number of steps (default 0 = no limit)\n"
" -mu (double) mutation rate\n"
" -b (double) \"inverse temperature\" multiplier\n"
-" -esc flag to run until escape observed (or max number of generations reached)\n"
-" -esc_all flag to run until escape from *all* immune pressure (or max num gen)\n"
" -v flag for verbose output\n"
" -numruns (int) number of trajectories to simulate\n"
+" -rate_X (double) X in [s,u,p,a,r,d,dprime,b,e,w,aprime,g,h]\n"
; std::cout.flush();
}
else if (strcmp(argv[i],"-E")==0) { if (++i==argc) break; else r.max_steps=(long)strtodouble(argv[i]); }
else if (strcmp(argv[i],"-t")==0) { if (++i==argc) break; else r.sample_interval=strtodouble(argv[i]); }
- else if (strcmp(argv[i],"-esc")==0) { r.runUntilEscape=true; }
- else if (strcmp(argv[i],"-esc_all")==0) { r.runUntilEscape_all=true; }
else if (strcmp(argv[i],"-v")==0) { r.useVerbose=true; }
else if (strcmp(argv[i],"-numruns")==0) { if (++i==argc) break; else r.num_runs=(unsigned int)strtodouble(argv[i]); }
else if (strcmp(argv[i],"-seed")==0) { if (++i==argc) break; else seed=(unsigned)strtodouble(argv[i]); }
+ else if (strcmp(argv[i],"-rate_s")==0) { if (++i==argc) break; else r.rate_s=strtodouble(argv[i]); }
+ else if (strcmp(argv[i],"-rate_u")==0) { if (++i==argc) break; else r.rate_u=strtodouble(argv[i]); }
else if (strcmp(argv[i],"-rate_p")==0) { if (++i==argc) break; else r.rate_p=strtodouble(argv[i]); }
else if (strcmp(argv[i],"-rate_a")==0) { if (++i==argc) break; else r.rate_a=strtodouble(argv[i]); }
else if (strcmp(argv[i],"-rate_r")==0) { if (++i==argc) break; else r.rate_r=strtodouble(argv[i]); }