From: Dariusz Murakowski Date: Wed, 29 Apr 2015 22:08:32 +0000 (-0400) Subject: Firing the viral growth/death reactions should probably iterate over the entire map... X-Git-Url: http://src.murakowski.org/?a=commitdiff_plain;h=8bcc3b7889db0cb40d43b38aa5bfe05d46b51a0c;p=VirEvoDyn.git Firing the viral growth/death reactions should probably iterate over the entire map container.... --- diff --git a/reaction.cpp b/reaction.cpp index 5abc6e9..4fc010f 100644 --- a/reaction.cpp +++ b/reaction.cpp @@ -90,7 +90,7 @@ void VirusReaction::fire() double rand = gsl_rng_uniform_pos(rnd) * this->propensity; double a_sum = 0.0; virus_map::iterator iter = V->pop.begin(), - end = V->pop.begin(); + end = V->pop.end(); for(; iter != end; ++iter) { a_sum += RC_fun(iter->first.energy) * iter->second; if (rand <= a_sum * rate_constant) @@ -152,7 +152,7 @@ void VirusDeathReaction::fire() double rand = gsl_rng_uniform_pos(rnd) * this->propensity; double a_sum = 0.0; virus_map::iterator iter = V->pop.begin(), - end = V->pop.begin(); + end = V->pop.end(); for (; iter != end; ++iter) { a_sum += iter->second; if (rand <= a_sum * rate_constant) @@ -258,7 +258,7 @@ void NTVirusReaction::fire() double rand = gsl_rng_uniform_pos(rnd) * this->propensity; double a_sum = 0.0; NTVirus_map::iterator iter = V->pop.begin(), - end = V->pop.begin(); + end = V->pop.end(); for(; iter != end; ++iter) { a_sum += RC_fun(iter->first.energy) * iter->second; if (rand <= a_sum * rate_constant) @@ -346,7 +346,7 @@ void NTVirusDeathReaction::fire() double rand = gsl_rng_uniform_pos(rnd) * this->propensity; double a_sum = 0.0; NTVirus_map::iterator iter = V->pop.begin(), - end = V->pop.begin(); + end = V->pop.end(); for (; iter != end; ++iter) { a_sum += iter->second; if (rand <= a_sum * rate_constant)