29 eigenvalue, reference, energy_gap)
RESULT(weight)
31 REAL(kind=
dp),
INTENT(IN) :: eigenvalue, reference, energy_gap
33 REAL(kind=
dp) :: delta
35 delta = eigenvalue - reference
36 weight = 1.0_dp/max(energy_gap, delta)
49 degeneracy_tolerance)
RESULT(rank_used)
51 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenvalues
52 INTEGER,
INTENT(IN) :: nocc, max_rank
53 REAL(kind=
dp),
INTENT(IN) :: degeneracy_tolerance
55 INTEGER :: ncomplement
56 REAL(kind=
dp) :: scale
59 ncomplement =
SIZE(eigenvalues) - nocc
60 IF (nocc < 0 .OR. ncomplement <= 0 .OR. max_rank <= 0)
RETURN
62 rank_used = min(max_rank, ncomplement)
65 DO WHILE (rank_used > 0 .AND. rank_used < ncomplement)
66 scale = max(1.0_dp, abs(eigenvalues(nocc + rank_used)), &
67 abs(eigenvalues(nocc + rank_used + 1)))
68 IF (abs(eigenvalues(nocc + rank_used + 1) - eigenvalues(nocc + rank_used)) > &
69 degeneracy_tolerance*scale)
EXIT
70 rank_used = rank_used - 1
87 energy_gap, spectral_window, matrix_in, matrix_out)
89 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: overlap_inverse, vectors
90 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenvalues
91 REAL(kind=
dp),
INTENT(IN) :: reference, energy_gap, spectral_window
92 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: matrix_in
93 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: matrix_out
96 REAL(kind=
dp) :: correction
97 REAL(kind=
dp),
DIMENSION(SIZE(matrix_in, 2)) :: projections
99 matrix_out = matmul(overlap_inverse, matrix_in)/spectral_window
100 DO i = 1,
SIZE(eigenvalues)
102 1.0_dp/spectral_window
103 projections(:) = matmul(vectors(:, i), matrix_in)
104 matrix_out = matrix_out + correction*spread(vectors(:, i), 2,
SIZE(matrix_in, 2))* &
105 spread(projections, 1,
SIZE(matrix_in, 1))
pure subroutine, public apply_low_rank_dense(overlap_inverse, vectors, eigenvalues, reference, energy_gap, spectral_window, matrix_in, matrix_out)
Dense reference application used to verify right covariance under orbital rotations.
pure integer function, public low_rank_select_rank(eigenvalues, nocc, max_rank, degeneracy_tolerance)
Select a bounded spectral rank without cutting a degenerate boundary manifold.