Discrete Lehmann representation
Main Module
NumericalEFT.Lehmann.DLRGrid
— Typefunction DLRGrid(Euv, β, rtol, isFermi::Bool; symmetry::Symbol = :none, rebuild = false, folder = nothing, algorithm = :functional, verbose = false) function DLRGrid(; isFermi::Bool, β = -1.0, beta = -1.0, Euv = 1.0, symmetry::Symbol = :none, rtol = 1e-14, rebuild = false, folder = nothing, algorithm = :functional, verbose = false)
Create DLR grids
#Arguments:
Euv
: the UV energy scale of the spectral densityβ
orbeta
: inverse temepratureisFermi
: bool is fermionic or bosonicsymmetry
: particle-hole symmetric :ph, or particle-hole asymmetric :pha, or :nonertol
: tolerance absolute errorrebuild
: set false to load DLR basis from the file, set true to recalculate the DLR basis on the flyfolder
: if rebuild is true and folder is set, then dlrGrid will be rebuilt and saved to the specified folder if rebuild is false and folder is set, then dlrGrid will be loaded from the specified folderalgorithm
: if rebuild = true, then set :functional to use the functional algorithm to generate the DLR basis, or set :discrete to use the matrix algorithm.verbose
: false not to print DLRGrid to terminal, or true to print
NumericalEFT.Lehmann.DLRGrid
— Typestruct DLRGrid
DLR grids for imaginary-time/Matsubara frequency correlators
#Members:
isFermi
: bool is fermionic or bosonicsymmetry
: particle-hole symmetric :ph, or particle-hole asymmetric :pha, or :noneEuv
: the UV energy scale of the spectral densityβ
orbeta
: inverse temepratureΛ
orlambda
: cutoff = UV Energy scale of the spectral density * inverse temperaturertol
: tolerance absolute errorsize
: number of DLR basisω
oromega
: selected representative real-frequency gridn
: selected representative Matsubara-frequency grid (integer)ωn
oromegaN
: (2n+1)π/βτ
ortau
: selected representative imaginary-time grid
Base.size
— MethodBase.size(dlrGrid::DLRGrid) = (length(dlrGrid.ω),) Base.length(dlrGrid::DLRGrid) = length(dlrGrid.ω) rank(dlrGrid::DLRGrid) = length(dlrGrid.ω)
get the rank of the DLR grid, namely the number of the DLR coefficients.
NumericalEFT.Lehmann.dlr2matfreq
— Methodfunction dlr2matfreq(dlrGrid::DLRGrid, dlrcoeff, nGrid = dlrGrid.n; axis = 1, verbose = true)
DLR representation to Matsubara-frequency representation
#Members:
dlrGrid
: DLRGriddlrcoeff
: DLR coefficientsnGrid
: expected fine Matsubara-freqeuncy grids (integer)axis
: Matsubara-frequency axis in the datadlrcoeff
verbose
: true to print warning information
NumericalEFT.Lehmann.dlr2tau
— Methodfunction dlr2tau(dlrGrid::DLRGrid, dlrcoeff, τGrid = dlrGrid.τ; axis = 1, verbose = true)
DLR representation to imaginary-time representation
#Members:
dlrGrid
: DLRGriddlrcoeff
: DLR coefficientsτGrid
: expected fine imaginary-time gridsaxis
: imaginary-time axis in the datadlrcoeff
verbose
: true to print warning information
NumericalEFT.Lehmann.matfreq2dlr
— Methodfunction matfreq2dlr(dlrGrid::DLRGrid, green, nGrid = dlrGrid.n; error = nothing, axis = 1, sumrule = nothing, verbose = true)
Matsubara-frequency representation to DLR representation
#Members:
dlrGrid
: DLRGrid struct.green
: green's function in Matsubara-frequency domainnGrid
: the n grid that Green's function is defined on.error
: error the Green's function.axis
: the Matsubara-frequency axis in the datagreen
sumrule
: enforce the sum ruleverbose
: true to print warning information
NumericalEFT.Lehmann.matfreq2matfreq
— Functionfunction matfreq2matfreq(dlrGrid, green, nNewGrid, nGrid = dlrGrid.n; error = nothing, axis = 1, sumrule = nothing, verbose = true)
Fourier transform from Matsubara-frequency to imaginary-time using the DLR representation
#Members:
dlrGrid
: DLRGridgreen
: green's function in Matsubara-freqeuncy repsentationnNewGrid
: expected fine Matsubara-freqeuncy grids (integer)nGrid
: the n grid that Green's function is defined on.error
: error the Green's function.axis
: Matsubara-frequency axis in the datagreen
sumrule
: enforce the sum ruleverbose
: true to print warning information
NumericalEFT.Lehmann.matfreq2tau
— Functionfunction matfreq2tau(dlrGrid, green, τNewGrid = dlrGrid.τ, nGrid = dlrGrid.n; error = nothing, axis = 1, sumrule = nothing, verbose = true)
Fourier transform from Matsubara-frequency to imaginary-time using the DLR representation
#Members:
dlrGrid
: DLRGridgreen
: green's function in Matsubara-freqeuncy repsentationτNewGrid
: expected fine imaginary-time gridsnGrid
: the n grid that Green's function is defined on.error
: error the Green's function.axis
: Matsubara-frequency axis in the datagreen
sumrule
: enforce the sum ruleverbose
: true to print warning information
NumericalEFT.Lehmann.tau2dlr
— Methodfunction tau2dlr(dlrGrid::DLRGrid, green, τGrid = dlrGrid.τ; error = nothing, axis = 1, sumrule = nothing, verbose = true)
imaginary-time domain to DLR representation
#Members:
dlrGrid
: DLRGrid struct.green
: green's function in imaginary-time domain.τGrid
: the imaginary-time grid that Green's function is defined on.error
: error the Green's function.axis
: the imaginary-time axis in the datagreen
.sumrule
: enforce the sum ruleverbose
: true to print warning information
NumericalEFT.Lehmann.tau2matfreq
— Methodfunction tau2matfreq(dlrGrid, green, nNewGrid = dlrGrid.n, τGrid = dlrGrid.τ; error = nothing, axis = 1, sumrule = nothing, verbose = true)
Fourier transform from imaginary-time to Matsubara-frequency using the DLR representation
#Members:
dlrGrid
: DLRGridgreen
: green's function in imaginary-time domainnNewGrid
: expected fine Matsubara-freqeuncy grids (integer)τGrid
: the imaginary-time grid that Green's function is defined on.error
: error the Green's function.axis
: the imaginary-time axis in the datagreen
sumrule
: enforce the sum ruleverbose
: true to print warning information
NumericalEFT.Lehmann.tau2tau
— Functionfunction tau2tau(dlrGrid, green, τNewGrid, τGrid = dlrGrid.τ; error = nothing, axis = 1, sumrule = nothing, verbose = true)
Interpolation from the old imaginary-time grid to a new grid using the DLR representation
#Members:
dlrGrid
: DLRGridgreen
: green's function in imaginary-time domainτNewGrid
: expected fine imaginary-time gridsτGrid
: the imaginary-time grid that Green's function is defined on.error
: error the Green's function.axis
: the imaginary-time axis in the datagreen
sumrule
: enforce the sum ruleverbose
: true to print warning information
Spectral functions
This module defines the kernels of Lehmann representation for different particles and symmetries.
NumericalEFT.Lehmann.Spectral
— ModuleSpectral representation related functions
NumericalEFT.Lehmann.Spectral.boseEinstein
— MethodboseEinstein(ω)
Compute the Fermi Dirac function. Assume $k_B T/\hbar=1$
\[f(ω) = 1/(e^{ωβ}-1)\]
Arguments
ω
: frequencyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.density
— Methoddensity(isFermi::Bool, ω, β)
Compute the imaginary-time kernel of different type. Assume $k_B T/\hbar=1$
Arguments
isFermi
: fermionic or bosonicω
: energyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.fermiDirac
— MethodfermiDirac(ω)
Compute the Fermi Dirac function. Assume $k_B T/\hbar=1$
\[f(ω) = 1/(e^{ωβ}+1)\]
Arguments
ω
: frequencyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelBoseT
— MethodkernelBoseT(τ, ω, β)
Compute the imaginary-time bosonic kernel. Machine accuracy ~eps(g) is guaranteed``
\[g(τ>0) = e^{-ωτ}/(1-e^{-ωβ}), g(τ≤0) = -e^{-ωτ}/(1-e^{ωβ})\]
Arguments
τ
: the imaginary time, must be (-β, β]ω
: frequencyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelBoseT_PH
— MethodkernelBoseT_PH(τ, ω, β)
Compute the imaginary-time kernel for correlation function $⟨O(τ)O(0)⟩$. Machine accuracy ~eps(C) is guaranteed``
\[K(τ) = e^{-ω|τ|}+e^{-ω(β-|τ|)}\]
Arguments
τ
: the imaginary time, must be (-β, β]ω
: frequency, ω>=0β
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelBoseT_PHA
— MethodkernelBoseT_PHA(τ, ω, β)
Compute the imaginary-time kernel for correlation function $⟨O(τ)O(0)⟩$. Machine accuracy ~eps(C) is guaranteed``
\[K(τ) = e^{-ω|τ|}-e^{-ω(β-|τ|)}\]
Arguments
τ
: the imaginary time, must be (0, β]ω
: frequency, ω>=0β
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelBoseT_regular
— MethodkernelBoseT_regular(τ, ω, β)
Compute the imaginary-time bosonic kernel with a regulator near ω=0. Machine accuracy ~eps(g) is guaranteed``
\[g(τ>0) = e^{-ωτ}/(1+e^{-ωβ}), g(τ≤0) = e^{-ωτ}/(1+e^{ωβ})\]
Arguments
τ
: the imaginary time, must be (-β, β]ω
: frequencyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelBoseΩ
— MethodkernelBoseΩ(n::Int, ω::T, β::T) where {T <: AbstractFloat}
Compute the bosonic kernel with Matsubara frequency.
\[g(iω_n) = -1/(iω_n-ω),\]
where $ω_n=2nπ/β$. The convention here is consist with the book "Quantum Many-particle Systems" by J. Negele and H. Orland, Page 95
Arguments
n
: index of the Matsubara frequencyω
: energyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelBoseΩ_PH
— MethodkernelBoseΩ_PH(n::Int, ω::T, β::T) where {T <: AbstractFloat}
Compute the Matsubara-frequency kernel for a correlator $⟨O(τ)O(0)⟩_{iω_n}$.
\[K(iω_n) = \frac{2ω}{ω^2+ω_n^2}(1-e^{-ωβ}),\]
where $ω_n=2nπ/β$. The convention here is consist with the book "Quantum Many-particle Systems" by J. Negele and H. Orland, Page 95
Arguments
n
: index of the Matsubara frequencyω
: energyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelBoseΩ_PHA
— MethodkernelBoseΩ_PHA(n::Int, ω::T, β::T) where {T <: AbstractFloat}
Compute the Matsubara-frequency kernel for a anormalous fermionic correlator with particle-hole symmetry.
\[K(iω_n) = -\frac{2iω_n}{ω^2+ω_n^2}(1-e^{-ωβ}),\]
where $ω_n=2nπ/β$. The convention here is consist with the book "Quantum Many-particle Systems" by J. Negele and H. Orland, Page 95
Arguments
n
: index of the fermionic Matsubara frequencyω
: energyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelBoseΩ_regular
— MethodkernelBoseΩ_regular(n::Int, ω::T, β::T) where {T <: AbstractFloat}
Compute the bosonic kernel in Matsubara frequency with a regulartor near ω=0
\[g(iω_n) = -(1-e^{-ωβ})/(1+e^{-ωβ})/(iω_n-ω),\]
where $ω_n=2nπ/β$. The convention here is consist with the book "Quantum Many-particle Systems" by J. Negele and H. Orland, Page 95
Arguments
n
: index of the Matsubara frequencyω
: energyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelFermiT
— MethodkernelFermiT(τ, ω, β)
Compute the imaginary-time fermionic kernel. Machine accuracy ~eps(g) is guaranteed``
\[g(τ>0) = e^{-ωτ}/(1+e^{-ωβ}), g(τ≤0) = -e^{-ωτ}/(1+e^{ωβ})\]
Arguments
τ
: the imaginary time, must be (-β, β]ω
: frequencyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelFermiT_PH
— MethodkernelFermiT_PH(τ, ω, β)
Compute the imaginary-time kernel for correlation function $⟨O(τ)O(0)⟩$. Machine accuracy ~eps(C) is guaranteed``
\[K(τ) = e^{-ω|τ|}+e^{-ω(β-|τ|)}\]
Arguments
τ
: the imaginary time, must be (-β, β]ω
: frequency, ω>=0β
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelFermiT_PHA
— MethodkernelFermiT_PHA(τ, ω, β)
Compute the imaginary-time kernel for correlation function $⟨O(τ)O(0)⟩$. Machine accuracy ~eps(C) is guaranteed``
\[K(τ) = e^{-ω|τ|}-e^{-ω(β-|τ|)}\]
Arguments
τ
: the imaginary time, must be (0, β]ω
: frequency, ω>=0β
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelFermiΩ
— MethodkernelFermiΩ(n::Int, ω::T, β::T) where {T <: AbstractFloat}
Compute the fermionic kernel with Matsubara frequency.
\[g(iω_n) = -1/(iω_n-ω),\]
where $ω_n=(2n+1)π/β$. The convention here is consist with the book "Quantum Many-particle Systems" by J. Negele and H. Orland, Page 95
Arguments
n
: index of the Matsubara frequencyω
: energyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelFermiΩ_PH
— MethodkernelFermiΩ_PH(n::Int, ω::T, β::T) where {T <: AbstractFloat}
Compute the Matsubara-frequency kernel for a correlator $⟨O(τ)O(0)⟩_{iω_n}$.
\[K(iω_n) = -\frac{2iω_n}{ω^2+ω_n^2}(1+e^{-ωβ}),\]
where $ω_n=(2n+1)π/β$. The convention here is consist with the book "Quantum Many-particle Systems" by J. Negele and H. Orland, Page 95
Arguments
n
: index of the Matsubara frequencyω
: energyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelFermiΩ_PHA
— MethodkernelFermiΩ_PHA(n::Int, ω::T, β::T) where {T <: AbstractFloat}
Compute the Matsubara-frequency kernel for a anormalous fermionic correlator with particle-hole symmetry.
\[K(iω_n) = \frac{2ω}{ω^2+ω_n^2}(1+e^{-ωβ}),\]
where $ω_n=(2n+1)π/β$. The convention here is consist with the book "Quantum Many-particle Systems" by J. Negele and H. Orland, Page 95
Arguments
n
: index of the fermionic Matsubara frequencyω
: energyβ
: the inverse temperature
NumericalEFT.Lehmann.Spectral.kernelT
— MethodkernelT(isFermi, symmetry, τGrid::AbstractVector{T}, ωGrid::AbstractVector{T}, β::T, regularized::Bool = false; type = T) where {T<:AbstractFloat}
Compute kernel with given τ and ω grids.
NumericalEFT.Lehmann.Spectral.kernelT
— MethodkernelT(::Val{isFermi}, ::Val{symmetry}, τ::T, ω::T, β::T, regularized::Bool = false) where {T<:AbstractFloat}
Compute the imaginary-time kernel of different type.
Arguments
isFermi
: fermionic or bosonic. It should be wrapped asVal(isFermi)
.symmetry
: :ph, :pha, or :none. It should be wrapped asVal(symmetry)
.τ
: the imaginary time, must be (-β, β]ω
: energyβ
: the inverse temperatureregularized
: use regularized kernel or not
NumericalEFT.Lehmann.Spectral.kernelΩ
— MethodkernelΩ(isFermi, symmetry, nGrid::Vector{Int}, ωGrid::Vector{T}, β::T, regularized::Bool = false; type = Complex{T}) where {T<:AbstractFloat}
Compute kernel matrix with given ωn (integer!) and ω grids.
NumericalEFT.Lehmann.Spectral.kernelΩ
— MethodkernelΩ(::Val{isFermi}, ::Val{symmetry}, n::Int, ω::T, β::T, regularized::Bool = false) where {T<:AbstractFloat}
Compute the imaginary-time kernel of different type. Assume $k_B T/\hbar=1$
Arguments
isFermi
: fermionic or bosonic. It should be wrapped asVal(isFermi)
.symmetry
: :ph, :pha, or :none. It should be wrapped asVal(symmetry)
.n
: index of the Matsubara frequencyω
: energyβ
: the inverse temperatureregularized
: use regularized kernel or not
Sample Green's Function Builder
This module provides subroutines to generate Green's function samples.
NumericalEFT.Lehmann.Sample.MultiPole
— FunctionMultiPole(β, isFermi::Bool, symmetry::Symbol, Grid, type::Symbol, poles, regularized::Bool = true)
MultiPole(dlr, type::Symbol, poles, Grid = dlrGrid(dlr, type); regularized::Bool = true)
Generate Green's function from a spectral density with delta peaks specified by the argument $poles$. Return the function on Grid and the systematic error.
#Arguments
dlr
: dlrGrid structβ
: inverse temperatureisFermi
: is fermionic or bosonicsymmetry
: particle-hole symmetric :ph, particle-hole antisymmetric :pha, or :noneGrid
: grid to evalute ontype
: imaginary-time with :τ, or Matsubara-frequency with :npoles
: a list of frequencies for the delta functionsregularized
: use regularized bosonic kernel if symmetry = :none
NumericalEFT.Lehmann.Sample.SemiCircle
— FunctionSemiCircle(Euv, β, isFermi::Bool, Grid, type::Symbol, symmetry::Symbol = :none; rtol = nothing, degree = 24, regularized::Bool = true)
SemiCircle(dlr, type::Symbol, Grid = dlrGrid(dlr, type); degree = 24, regularized::Bool = true)
Generate Green's function from a semicircle spectral density. Return the function on Grid and the systematic error.
#Arguments
dlr
: dlrGrid structEuv
: ultraviolet energy cutoffβ
: inverse temperatureisFermi
: is fermionic or bosonicGrid
: grid to evalute ontype
: imaginary-time with :τ, or Matsubara-frequency with :nsymmetry
: particle-hole symmetric :ph, particle-hole antisymmetric :pha, or :nonertol
: accuracy to achievedegree
: polynomial degree for integralregularized
: use regularized bosonic kernel if symmetry = :none
Discrete DLR builder
This module provides a DLR builder based on the conventional QR algorithm.
NumericalEFT.Lehmann.Discrete.build
— Functionfunction build(dlrGrid, print::Bool = true) Construct discrete Lehmann representation
#Arguments:
dlrGrid
: struct that contains the information to construct the DLR grid. The following entries are required: Λ: the dimensionless scale β*Euv, rtol: the required relative accuracy, isFermi: fermionic or bosonic, symmetry: particle-hole symmetry/antisymmetry or noneprint
: print the internal information or not
NumericalEFT.Lehmann.Discrete.preciseKernelT
— Functionfunction preciseKernelT(dlrGrid, τ, ω, print::Bool = true)
Calculate the kernel matrix(τ, ω) for given τ, ω grids
Arguments
- τ: a CompositeChebyshevGrid struct or a simple one-dimensional array
- ω: a CompositeChebyshevGrid struct or a simple one-dimensional array
- print: print information or not
Functional DLR builder
This module provides a DLR builder based on a functional QR algorithm. It can generate DLR at extremely low temperature.
NumericalEFT.Lehmann.Functional.build
— Functionfunction build(dlrGrid, print::Bool = true) Construct discrete Lehmann representation
#Arguments:
dlrGrid
: struct that contains the information to construct the DLR grid. The following entries are required: Λ: the dimensionless scale β*Euv, rtol: the required relative accuracy, isFermi: fermionic or bosonic, symmetry: particle-hole symmetry/antisymmetry or noneprint
: print the internal information or not
NumericalEFT.Lehmann.Functional.kernel
— Method(1-exp(-Λ*x)/x
NumericalEFT.Lehmann.Functional.mGramSchmidt
— Methodmodified Gram-Schmidt process
NumericalEFT.Lehmann.Functional.projKernel
— Method<K(gi), K(gj)>
NumericalEFT.Lehmann.Functional.projPHA_τ
— Methodparticle-hole asymmetric kernel: K(ω, τ)=e^{-ωτ}-e^{-ω(β-τ)}
KK=int_0^{Λ} dτ K(ω,t1)*K(ω2,t2)=(1-e^{t1+t2})/(t1+t2)+(1-e^{2β-t1-t2})/(2β-t1-t2)-(1-e^{β+t1-t2})/(β+t1-t2)-(1-e^{β-t1+t2})/(β-t1+t2)
NumericalEFT.Lehmann.Functional.projPHA_ω
— Methodparticle=hole asymmetric kernel: K(ω, τ)=e^{-ωτ}-e^{-ω(β-τ)}
KK=int_0^{1/2} dτ K(ω1,τ)*K(ω2,τ)=(1-e^{ω1+ω2})/(ω1+ω2)-(e^{-ω2}-e^{-ω1})/(ω1-ω2)
NumericalEFT.Lehmann.Functional.projPH_τ
— Methodparticle-hole symmetric kernel: K(ω, τ)=e^{-ωτ}+e^{-ω(β-τ)}
KK=int_0^{Λ} dτ K(ω,t1)*K(ω2,t2)=(1-e^{t1+t2})/(t1+t2)+(1-e^{2β-t1-t2})/(2β-t1-t2)+(1-e^{β+t1-t2})/(β+t1-t2)+(1-e^{β-t1+t2})/(β-t1+t2)
NumericalEFT.Lehmann.Functional.projPH_ω
— Methodparticle-hole symmetric kernel: K(ω, τ)=e^{-ωτ}+e^{-ω(β-τ)}
KK=int_0^{1/2} dτ K(ω1,τ)*K(ω2,τ)=(1-e^{ω1+ω2})/(ω1+ω2)+(e^{-ω2}-e^{-ω1})/(ω1-ω2)
NumericalEFT.Lehmann.Functional.projqq
— Methodq1=sumj cj Kj q2=sumk dk Kk return <q1, q2> = sumjk cj*dk <Kj, K_k>
Utility
This module provides the utility subroutines for other DLR modules.
NumericalEFT.Lehmann.Interp.barycheb
— Methodfunction barycheb(n, x, f, wc, xc)
Barycentric Lagrange interpolation at Chebyshev nodes Reference: Berrut, J.P. and Trefethen, L.N., 2004. Barycentric lagrange interpolation. SIAM review, 46(3), pp.501-517.
Arguments
n
: order of the Chebyshev interpolationx
: coordinate to interpolatef
: array of size n, function at the Chebyshev nodeswc
: array of size n, Barycentric Lagrange interpolation weightsxc
: array of size n, coordinates of Chebyshev nodes
Returns
- Interpolation result
NumericalEFT.Lehmann.Interp.barychebinit
— Methodbarychebinit(n)
Get Chebyshev nodes of first kind and corresponding barycentric Lagrange interpolation weights. Reference: Berrut, J.P. and Trefethen, L.N., 2004. Barycentric lagrange interpolation. SIAM review, 46(3), pp.501-517.
Arguments
n
: order of the Chebyshev interpolation
Returns
- Chebyshev nodes
- Barycentric Lagrange interpolation weights