From: Dariusz Murakowski Date: Tue, 21 Apr 2015 22:08:18 +0000 (-0400) Subject: Remove mutation rate "mu" from Virus object; now exclusively in reaction. X-Git-Url: http://src.murakowski.org/?a=commitdiff_plain;h=cd765f5de35139a68656663f0904c8523345b0c8;p=VirEvoDyn.git Remove mutation rate "mu" from Virus object; now exclusively in reaction. --- diff --git a/pop_ss.cpp b/pop_ss.cpp index 0a3d5b0..5163e27 100644 --- a/pop_ss.cpp +++ b/pop_ss.cpp @@ -11,36 +11,21 @@ //Constuct a virus object of wildtype - -Virus::Virus(const Hamiltonian &H, double mu) { +Virus::Virus(const Hamiltonian &H) { this->mutated_sites.clear(); - this->mu=mu; L=H.size; energy=0; } - //Construct a virus and compute its energy. - -Virus::Virus(const Hamiltonian &H, double mu, const std::set &mutated_sites) { +Virus::Virus(const Hamiltonian &H, const std::set &mutated_sites) { this->mutated_sites=mutated_sites; - this->mu=mu; L=H.size; update_energy(H); } - -//Print key numerical parameters of the object to the terminal for diagnostics. - -void Virus::print_parameters() { - std::cout << "mu = " << mu << std::endl; - std::cout << "energy = " << energy << std::endl; -} - - //Update the energy of the virus object. Takes as an argument the //Hamiltonian that determines the energy - void Virus::update_energy(const Hamiltonian &H) { energy=H.get_energy(mutated_sites); } diff --git a/pop_ss.h b/pop_ss.h index 6bacf5e..26cf280 100644 --- a/pop_ss.h +++ b/pop_ss.h @@ -19,14 +19,11 @@ public: double energy; std::set mutated_sites; - Virus(const Hamiltonian &H, double mu); - Virus(const Hamiltonian &H, double mu, const std::set &mutated_sites); - - void print_parameters(); + Virus(const Hamiltonian &H); + Virus(const Hamiltonian &H, const std::set &mutated_sites); //private: - double mu; unsigned int L; void update_energy(const Hamiltonian &H); diff --git a/reaction.cpp b/reaction.cpp index 191fce1..e8a2e25 100644 --- a/reaction.cpp +++ b/reaction.cpp @@ -98,8 +98,7 @@ void VirusReaction::fire() // pick how many sites to mutate in the new virus // adapted from WF Virus::mutate() - //double mu = iter->first.mu; - Virus v(H,this->mu,iter->first.mutated_sites); + Virus v(H,iter->first.mutated_sites); unsigned int n = gsl_ran_binomial(rnd,mu,H.size); MutatedSiteSequence sites_to_mutate; while (sites_to_mutate.size() < n) { diff --git a/ss.cpp b/ss.cpp index 413e379..c4fecad 100644 --- a/ss.cpp +++ b/ss.cpp @@ -75,7 +75,7 @@ void run(RunParameters_SS &r, unsigned seed) { if (r.importState) { importState(r); // .st for (size_t i=0; ipop[V] = N; s1->count += N; @@ -83,7 +83,7 @@ void run(RunParameters_SS &r, unsigned seed) { } else { s1->count = r.n; - s1->pop[Virus(H,r.mu)] = s1->count; // default mu = 6.0e-5 + s1->pop[Virus(H)] = s1->count; // default mu = 6.0e-5 } Species_parray print_spec;