From ce236f4d245d9bdc9538b8a92e7b561a0d11b977 Mon Sep 17 00:00:00 2001 From: ydamour Date: Thu, 2 Feb 2023 20:43:16 +0100 Subject: [PATCH] fix segfault restore_symmetry if all elem > thresh --- src/utils/linear_algebra.irp.f | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/linear_algebra.irp.f b/src/utils/linear_algebra.irp.f index 44344a19..fb292d6d 100644 --- a/src/utils/linear_algebra.irp.f +++ b/src/utils/linear_algebra.irp.f @@ -1736,7 +1736,7 @@ subroutine restore_symmetry(m,n,A,LDA,thresh) ! Symmetrize i = 1 - do while( (i < sze).and.(-copy(i) > thresh) ) + do while (i < sze) pi = i pf = i val = 1d0/copy(i) @@ -1760,6 +1760,10 @@ subroutine restore_symmetry(m,n,A,LDA,thresh) ! Update i i = pf endif + + ! Exit if the remaining elements are below thresh + if (-copy(i) <= thresh) exit + ! Update i i = i + 1 enddo