56 REAL(
dp),
INTENT(IN) :: energies(:), width, rate1, rate2
59 INTEGER :: iband, jband, nband
60 REAL(
dp) :: difference, gaussian
62 IF (.NOT. all(ieee_is_finite(energies)) .OR. .NOT. ieee_is_finite(width) .OR. &
63 .NOT. ieee_is_finite(rate1) .OR. .NOT. ieee_is_finite(rate2) .OR. &
64 width <= 0.0_dp .OR. rate1 <= 0.0_dp .OR. rate2 < rate1)
THEN
65 cpabort(
'Invalid NLO band-transition relaxation parameters.')
67 IF (
ALLOCATED(relaxation%pair_rate))
DEALLOCATE (relaxation%pair_rate)
68 IF (
ALLOCATED(relaxation%energies))
DEALLOCATE (relaxation%energies)
69 ALLOCATE (relaxation%energies(
SIZE(energies)))
70 relaxation%energies(:) = energies
71 relaxation%width = width
72 relaxation%rate_difference = rate1 - rate2
73 CALL nlo_gaussian_quadrature(relaxation%integration_points, relaxation%integration_weights)
74 nband =
SIZE(energies)
76 ALLOCATE (relaxation%pair_rate(nband, nband))
79 difference = energies(iband) - energies(jband)
81 IF (width >= abs(difference)/26.0_dp) gaussian = exp(-(difference/width)**2)
82 relaxation%pair_rate(iband, jband) = rate1 + (rate2 - rate1)*(1.0_dp - gaussian)
123 COMPLEX(dp),
INTENT(IN) :: hamiltonian(:, :, :), density(:, :, :)
124 INTEGER,
INTENT(IN) :: grade
125 COMPLEX(dp),
INTENT(OUT) :: correction(:, :, :)
127 COMPLEX(dp) :: weight
128 COMPLEX(dp),
ALLOCATABLE :: inverse(:, :), lower_density(:, :, :), &
129 matrix_term(:, :), remainder(:, :)
130 INTEGER :: alpha(3,
nlo_n_derivatives), ia, iband, ibeta, igamma, ipoint, jband, nband, &
133 cpassert(grade >= 1 .AND. grade <= 4)
134 cpassert(
ALLOCATED(relaxation%pair_rate))
135 nband =
SIZE(relaxation%pair_rate, 1)
138 cpassert(
SIZE(hamiltonian, 1) == nband)
139 cpassert(
SIZE(hamiltonian, 2) == nband)
140 cpassert(
SIZE(hamiltonian, 3) >= ncoeff)
141 cpassert(
SIZE(density, 1) == nband)
142 cpassert(
SIZE(density, 2) == nband)
143 cpassert(
SIZE(density, 3) >= nlower)
144 cpassert(
SIZE(correction, 1) == nband)
145 cpassert(
SIZE(correction, 2) == nband)
146 cpassert(
SIZE(correction, 3) == ncoeff - nlower)
147 ALLOCATE (inverse(nband, nband), lower_density(nband, nband, nlower), &
148 remainder(nband, nband), matrix_term(nband, nband))
156 correction = cmplx(0.0_dp, 0.0_dp,
dp)
157 DO ipoint = 1,
SIZE(relaxation%integration_points)
160 inverse(iband, jband) = 1.0_dp/ &
161 (relaxation%energies(iband) - relaxation%energies(jband) - &
162 relaxation%width*relaxation%integration_points(ipoint))
165 weight = relaxation%width*relaxation%integration_weights(ipoint)
167 remainder = cmplx(0.0_dp, 0.0_dp,
dp)
169 igamma = partner(ibeta, ia)
170 IF (igamma == 0) cycle
171 matrix_term(:, :) = matmul(hamiltonian(:, :, ibeta), lower_density(:, :, igamma))
172 remainder(:, :) = remainder - matrix_term
173 matrix_term(:, :) = matmul(lower_density(:, :, igamma), hamiltonian(:, :, ibeta))
174 remainder(:, :) = remainder + matrix_term
176 remainder(:, :) = remainder*inverse
177 IF (ia <= nlower)
THEN
178 lower_density(:, :, ia) = density(:, :, ia)*inverse + remainder
180 correction(:, :, ia - nlower) = correction(:, :, ia - nlower) + weight*remainder
184 correction = cmplx(relaxation%rate_difference, 0.0_dp,
dp)*correction