Permalink
Browse files

Fix divisions by zero

git-svn-id: svn://svn.code.sf.net/p/cp2k/code/trunk@18509 bac0169d-1eea-4375-b5f6-f89d2ced9994
  • Loading branch information...
alazzaro committed Jul 5, 2018
1 parent 11cd3a3 commit bf943b4e733332f058f824fca68e9d2d98a84e27
Showing with 5 additions and 1 deletion.
  1. +5 −1 cp2k/src/iterate_matrix.F
@@ -326,7 +326,11 @@ SUBROUTINE invert_Taylor(matrix_inverse, matrix, threshold, use_inv_as_guess, &
!CALL dbcsr_print(tmp1)
! invert the main diagonal
CALL dbcsr_get_diag(matrix, p_diagonal)
p_diagonal(:) = 1.0_dp/p_diagonal(:)
DO i = 1, nrows
IF (p_diagonal(i) .NE. 0.0_dp) THEN
p_diagonal(i) = 1.0_dp/p_diagonal(i)
ENDIF
ENDDO
CALL dbcsr_set(matrix_inverse, 0.0_dp)
CALL dbcsr_add_on_diag(matrix_inverse, 1.0_dp)
CALL dbcsr_set_diag(matrix_inverse, p_diagonal)

0 comments on commit bf943b4

Please sign in to comment.