Skip to content

Commit

Permalink
Fix early exit of TRS4 (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
william-dawson authored Aug 31, 2023
1 parent 8d76e75 commit ae4cae7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Source/Fortran/DensityMatrixSolversModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,13 @@ SUBROUTINE TRS4(H, ISQ, trace, K, &
CALL DotMatrix(X_k2, Fx_right, trace_fx)
CALL DotMatrix(X_k2, Gx_right, trace_gx)

!! Avoid Overflow
!! Compute Sigma - avoiding overflow
IF (ABS(trace_gx) .LT. 1.0e-14_NTREAL) THEN
EXIT
sigma_array(II) = sigma_max + 1.0_NTREAL
ELSE
sigma_array(II) = (trace - trace_fx) / trace_gx
END IF

!! Compute Sigma
sigma_array(II) = (trace - trace_fx) / trace_gx

!! Update The Matrix
IF (sigma_array(II) .GT. sigma_max) THEN
CALL CopyMatrix(X_k, TempMat)
Expand Down

0 comments on commit ae4cae7

Please sign in to comment.