From ec105c9ad8833d0e516e2adafd2b8ad36d23f6b3 Mon Sep 17 00:00:00 2001
From: Mahmoud Bentriou <mahmoud.bentriou@centralesupelec.fr>
Date: Fri, 12 Feb 2021 12:51:49 +0100
Subject: [PATCH] fix in sir tauleap model

---
 models/SIR_tauleap.jl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/models/SIR_tauleap.jl b/models/SIR_tauleap.jl
index 9ed8b90..85dbdc1 100644
--- a/models/SIR_tauleap.jl
+++ b/models/SIR_tauleap.jl
@@ -23,8 +23,8 @@ t0_SIR_tauleap = 0.0
     # column-major order
     nu_1 = (-1, 1, 0)
     nu_2 = (0, -1, 1)
-    nbr_R1 = rand(Poisson(a1*tau))
-    nbr_R2 = rand(Poisson(a2*tau))
+    nbr_R1 = (a1 > 0.0) ? rand(Poisson(a1*tau)) : 0.0
+    nbr_R2 = (a2 > 0.0) ? rand(Poisson(a2*tau)) : 0.0
     for i = 1:3
         @inbounds xnplus1[i] = xn[i]+ nbr_R1*nu_1[i] + nbr_R2*nu_2[i]
     end
-- 
GitLab