24 zdd,
zdd_abs2,
zdd_add,
zdd_conjg,
zdd_div,
zdd_i,
zdd_mul,
zdd_one,
zdd_sub,
zdd_to_dp, &
28#include "./base/base_uses.f90"
34 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'gw_nevanlinna'
37 REAL(KIND=
dp),
DIMENSION(9),
PARAMETER :: nevanlinna_deltas = [0.0_dp, 1.0e-14_dp, 1.0e-12_dp, &
38 1.0e-10_dp, 1.0e-8_dp, 1.0e-6_dp, &
39 1.0e-4_dp, 1.0e-3_dp, 1.0e-2_dp]
40 REAL(KIND=
dp),
PARAMETER :: tiny_schur = 1.0e-40_dp
52 REAL(kind=
dp) :: rcond_weights = 0.0_dp
55 INTEGER :: window_min_points = 0
56 REAL(kind=
dp) :: window_freq_min = 0.0_dp, &
57 window_freq_max = 0.0_dp
59 REAL(kind=
dp) :: window_spread = 0.0_dp
62 REAL(kind=
dp) :: qp_newton_max_step = 0.0_dp, &
63 qp_maxz_radius = 0.0_dp
70 LOGICAL :: solvable = .false.
71 LOGICAL :: mirrored = .false.
73 REAL(kind=
dp) :: delta = 0.0_dp
74 REAL(kind=
dp) :: pick_min = 0.0_dp
75 COMPLEX(KIND=dp),
DIMENSION(:),
ALLOCATABLE :: xis, phis
90 COMPLEX(KIND=dp),
DIMENSION(:),
INTENT(IN) :: x, y
92 CHARACTER(len=*),
PARAMETER :: routinen =
'nevanlinna_create'
95 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:) :: xx, yy
96 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: pick, pick_vec
97 INTEGER :: handle, i, i_delta, k, n
98 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: order
99 REAL(kind=
dp) :: scale
100 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: pick_eig
101 TYPE(
zdd_type),
ALLOCATABLE,
DIMENSION(:) :: lams, phis, xis
103 CALL timeset(routinen, handle)
109 ALLOCATE (nev%xis(n), nev%phis(n), xis(n), phis(n), lams(n), xx(n), yy(n), order(n))
110 nev%xis(:) = (0.0_dp, 0.0_dp)
111 nev%phis(:) = (0.0_dp, 0.0_dp)
114 nev%mirrored = all(aimag(x) < 0.0_dp)
115 IF (nev%mirrored)
THEN
123 IF (n == 0 .OR. .NOT. (all(abs(xx) < huge(1.0_dp)) .AND. all(abs(yy) < huge(1.0_dp))))
THEN
124 DEALLOCATE (xis, phis, lams, xx, yy, order)
125 CALL timestop(handle)
129 CALL sort_by_imag(xx, order)
131 scale = maxval(abs(yy))
132 IF (scale == 0.0_dp) scale = 1.0_dp
135 xis(i) = moebius(
zdd(xx(order(i))))
138 DO i_delta = 1,
SIZE(nevanlinna_deltas)
140 s = yy(order(i)) - cmplx(0.0_dp, nevanlinna_deltas(i_delta)*scale, kind=
dp)
142 lams(i) = moebius(
zdd(-s))
145 IF (i_delta == 1)
THEN
148 ALLOCATE (pick(n, n), pick_vec(n, n), pick_eig(n))
155 pick(:, :) = 0.5_dp*(pick + conjg(transpose(pick)))
157 nev%pick_min = minval(pick_eig)/max(maxval(abs(pick_eig)), tiny(1.0_dp))
158 DEALLOCATE (pick, pick_vec, pick_eig)
161 IF (schur_parameters(xis, lams, phis))
THEN
162 nev%solvable = .true.
163 nev%delta = nevanlinna_deltas(i_delta)
170 IF (nev%solvable) nev%phis(i) =
zdd_to_dp(phis(i))
173 DEALLOCATE (xis, phis, lams, xx, yy, order)
175 CALL timestop(handle)
187 REAL(kind=
dp),
INTENT(IN) :: x_val
188 COMPLEX(KIND=dp),
INTENT(OUT) :: func_val
190 COMPLEX(KIND=dp),
PARAMETER :: ii = (0.0_dp, 1.0_dp), &
191 one = (1.0_dp, 0.0_dp), &
192 zero = (0.0_dp, 0.0_dp)
194 COMPLEX(KIND=dp) :: aa, bb, bj, cc, cphi, dd, na, nb, nc, &
200 xz = (cmplx(x_val, 0.0_dp, kind=
dp) - ii)/(cmplx(x_val, 0.0_dp, kind=
dp) + ii)
208 bj = (xz - xi)/(one - conjg(xi)*xz)
210 na = aa*bj + bb*cphi*bj
212 nc = cc*bj + dd*cphi*bj
215 sc = max(abs(na), abs(nb), abs(nc), abs(nd))
216 IF (sc == 0.0_dp) sc = 1.0_dp
224 func_val = -ii*(one + th)/(one - th)
225 IF (nev%mirrored) func_val = conjg(func_val)
236 IF (
ALLOCATED(nev%xis))
DEALLOCATE (nev%xis)
237 IF (
ALLOCATED(nev%phis))
DEALLOCATE (nev%phis)
238 nev%solvable = .false.
248 ELEMENTAL FUNCTION moebius(w)
RESULT(h)
264 FUNCTION schur_parameters(xis, lams, phis)
RESULT(ok)
265 TYPE(
zdd_type),
DIMENSION(:),
INTENT(IN) :: xis, lams
266 TYPE(
zdd_type),
DIMENSION(:),
INTENT(OUT) :: phis
271 TYPE(
zdd_type),
DIMENSION(SIZE(xis)) :: vals
283 DO k = j + 1,
SIZE(xis)
294 END FUNCTION schur_parameters
301 SUBROUTINE sort_by_imag(z, order)
302 COMPLEX(KIND=dp),
DIMENSION(:),
INTENT(IN) :: z
303 INTEGER,
DIMENSION(:),
INTENT(OUT) :: order
314 IF (aimag(z(order(j))) <= aimag(z(tmp)))
EXIT
315 order(j + 1) = order(j)
321 END SUBROUTINE sort_by_imag
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public fei2021
Double-double arithmetic: real and complex numbers stored as unevaluated sums hi + lo of two double-p...
elemental type(zdd_type) function, public zdd_mul(a, b)
Product of two complex double-double numbers.
type(zdd_type), parameter, public zdd_zero
elemental type(zdd_type) function, public zdd(z)
Complex double-double number from a double-precision one.
type(zdd_type), parameter, public zdd_i
type(zdd_type), parameter, public zdd_one
elemental type(zdd_type) function, public zdd_conjg(a)
Complex conjugate of a complex double-double number.
elemental type(zdd_type) function, public zdd_add(a, b)
Sum of two complex double-double numbers.
elemental type(zdd_type) function, public zdd_div(a, b)
Quotient of two complex double-double numbers.
elemental real(kind=dp) function, public zdd_abs2(a)
Squared modulus of a complex double-double number, rounded to double precision.
elemental type(zdd_type) function, public zdd_sub(a, b)
Difference of two complex double-double numbers.
elemental complex(kind=dp) function, public zdd_to_dp(a)
Rounds a complex double-double number to double precision.
Nevanlinna analytic continuation of the GW correlation self-energy from the imaginary to the real fre...
subroutine, public nevanlinna_release(nev)
Releases the interpolant.
subroutine, public nevanlinna_create(nev, x, y)
Builds the Nevanlinna interpolant of y(x). If the samples are not causal within the accuracy of the d...
subroutine, public nevanlinna_evaluate(nev, x_val, func_val)
Evaluates the interpolant on the real axis.
Defines the basic variable types.
integer, parameter, public dp
Collection of simple mathematical functions and subroutines.
subroutine, public diag_complex(matrix, eigenvectors, eigenvalues)
Diagonalizes a local complex Hermitian matrix using LAPACK. Based on cp_cfm_heevd.
Complex double-double number.
Parameters of the quasiparticle solution with the Nevanlinna continuation; they are set in set_heuris...
Schur parameters of one Nevanlinna interpolant.