From ff1534249b6c083cc02cd2cd0cb4171ffcf1944c Mon Sep 17 00:00:00 2001 From: kamischi <karl-michael.schindler@web.de> Date: Sun, 19 May 2024 13:48:42 +0200 Subject: [PATCH] prevent division by zero --- source/f90/seteps.f90 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/f90/seteps.f90 b/source/f90/seteps.f90 index 2900bcd..743ff75 100644 --- a/source/f90/seteps.f90 +++ b/source/f90/seteps.f90 @@ -71,7 +71,11 @@ subroutine seteps(neps, nos, osc, epsinf, wn, name, eps, layers, mode) ! because all cases of nos(l) > 1 are treated in case 1 above do k = 1, nos(l) j = j + 1 - x = wn / osc(1, j) + if (osc(1, j) > 1d-3) then ! prevent division by zero + x = wn / osc(1, j) + else + x = wn * 1d3 + endif deno = x * dcmplx(x, osc(3, j)) if (osc(2, j) >= 0.0d0) then deno = 1.0d0 - deno -- GitLab