From 0e1fbf3eeef6882ea6a63224ba894418dd71e241 Mon Sep 17 00:00:00 2001 From: "George G. Vega Yon" Date: Mon, 9 Oct 2023 21:06:20 -0600 Subject: [PATCH] Check if any mutates [skip ci] --- examples/01-seir/main.cpp | 2 +- include/epiworld/model-meat.hpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/01-seir/main.cpp b/examples/01-seir/main.cpp index 7728f5f89..ae071a85a 100644 --- a/examples/01-seir/main.cpp +++ b/examples/01-seir/main.cpp @@ -14,7 +14,7 @@ int main() { // Adding a bernoulli graph as step 0 model.agents_from_adjlist( - rgraph_smallworld(500000, 5, .001, false, model) + rgraph_smallworld(1000000, 5, .001, false, model) ); // Running and checking the results diff --git a/include/epiworld/model-meat.hpp b/include/epiworld/model-meat.hpp index b3df43f65..2b665645e 100644 --- a/include/epiworld/model-meat.hpp +++ b/include/epiworld/model-meat.hpp @@ -1792,6 +1792,15 @@ inline void Model::update_state() { template inline void Model::mutate_virus() { + // Checking if any virus has mutation + size_t nmutates = 0u; + for (const auto & v: viruses) + if (v->mutation_fun) + nmutates++; + + if (nmutates == 0u) + return; + if (use_queuing) {