API Reference
SpectralDensities
SpectralDensities.AbstractSD — Typeabstract type AbstractSDAbstractSD represents an abstract bath spectral density.
Any subtype of AbstractSD must at least define either sd or sdoverω for the new type.
SpectralDensities.CompositeSD — Typestruct CompositeSD <: AbstractSDCompositeSD represents a composite spectral density consisting of the sum of multiple individual spectral densities.
Fields
Jlist::Vector{AbstractSD}: A vector containing individual spectral densties.
SpectralDensities.DebyeSD — Typestruct DebyeSD <: AbstractSDDebyeSD represents a Debye spectral density. It is characterized by an amplitude α representing the strength of the coupling and the cutoff frequency ωc. That is
\[J(\omega) = \frac{2\alpha}{\pi}\frac{\omega\omega_c^2}{\omega^2 + \omega_c^2}\]
Fields
α::Float64: The amplitudeα, indicating the strength of the coupling.ωc::Float64: The cutoff frequency.
SpectralDensities.DebyeSD — MethodDebyeSD(α::Real, ωc::Real)Construct a Debye spectral density with the given amplitude α and cutoff frequency ωc.
Arguments
α::Real: The amplitudeα, indicating the strength of the coupling.ωc::Real: The cutoff frequency.
Returns
- An instance of the
DebyeSDstruct representing the Debye spectral density.
SpectralDensities.ExponentialCutoffSD — Typestruct ExponentialCutoffSD{T <: AbstractSD} <: AbstractSDExponentialCutoffSD represents a spectral density with an exponential frequency cutoff. It is parameterized by the underlying spectral density J, and the frequency cutoff ωcutoff. That is
\[J_\mathrm{exp}(\omega) = J(\omega)e^{-\omega/\omega_c}\]
Fields
J::T: The underlying spectral density.ωcutoff::Float64: The frequency cutoff.
SpectralDensities.ExponentialCutoffSD — MethodExponentialCutoffSD(J::AbstractSD, ωcutoff)Construct a spectral density with an exponential frequency cutoff using the underlying spectral density J and the given frequency cutoff ωcutoff.
Arguments
J::AbstractSD: The underlying spectral density.ωcutoff: The frequency cutoff.
Returns
- An instance of the
ExponentialCutoffSDstruct representing the spectral density with an exponential frequency cutoff.
SpectralDensities.GaussianCutoffSD — Typestruct GaussianCutoffSD{T <: AbstractSD} <: AbstractSDGaussianCutoffSD represents a spectral density with a Gaussian frequency cutoff. It is parameterized by the underlying spectral density J, and the frequency cutoff ωcutoff. That is
\[J_\mathrm{gauss}(\omega) = J(\omega)e^{-\omega^2/\omega_c^2}\]
Fields
J::T: The underlying spectral density.ωcutoff::Float64: The frequency cutoff.
SpectralDensities.GaussianCutoffSD — MethodGaussianCutoffSD(J::AbstractSD, ωcutoff)Construct a spectral density with a Gaussian frequency cutoff using the underlying spectral density J and the given frequency cutoff ωcutoff.
Arguments
J::AbstractSD: The underlying spectral density.ωcutoff: The frequency cutoff.
Returns
- An instance of the
GaussianCutoffSDstruct representing the spectral density with a Gaussian frequency cutoff.
SpectralDensities.HardCutoffSD — Typestruct HardCutoffSD{T <: AbstractSD} <: AbstractSDHardCutoffSD represents a spectral density with a hard frequency cutoff. It is parameterized by the underlying spectral density J, and the frequency cutoff ωcutoff. That is
\[J_\mathrm{hard}(\omega) = J(\omega)\Theta(\omega_c - \omega)\]
where $\Theta$ is the Heaviside theta function.
Fields
J::T: The underlying spectral density.ωcutoff::Float64: The frequency cutoff.
SpectralDensities.HardCutoffSD — MethodHardCutoffSD(J::AbstractSD, ωcutoff)Construct a spectral density with a hard frequency cutoff using the underlying spectral density J and the given frequency cutoff ωcutoff.
Arguments
J::AbstractSD: The underlying spectral density.ωcutoff::Float64: The frequency cutoff.
Returns
- An instance of the
HardCutoffSDstruct representing the spectral density with a hard frequency cutoff.
SpectralDensities.InversePolyKernelSD — Typestruct InversePolyKernelSD <: AbstractSDInversePolyKernelSD represents a spectral density whose corresponding memory kernel in frequency space is given by one over a polynomial in frequency. It is characterized by the degree of the polynomial deg and the list of coefficients coefs (in ascending order of powers). That is,
\[J(\omega) = \frac{1}{\pi}\mathrm{Im}\left[\frac{1}{\sum_{k=0}^{\mathrm{deg}}I_k\mathrm{coeffs}[k+1]\omega^k}\right],\]
where $math I_k = 1$ if k is even, and $math I_k = i$ if k is odd.
Fields
deg::Int64: The degree of the polynomial.coeffs::AbstractVector{ComplexF64}: Coefficients of the polynomial (in ascending order of powers). The length of the vector should bedeg + 1.
SpectralDensities.InversePolyKernelSD — MethodInversePolyKernelSD(J::DebyeSD)Construct a InversePolyKernelSD spectral density from a Debye spectral density.
Arguments
J::DebyeSD: The Debye spectral density.
Returns
- An instance of the InversePolyKernelSD that represents the Debye spectral density.
SpectralDensities.InversePolyKernelSD — MethodInversePolyKernelSD(J::LorentzianSD)Construct a InversePolyKernelSD spectral density from a Lorentzian spectral density.
Arguments
J::LorentzianSD: The Lorentzian spectral density.
Returns
- An instance of the InversePolyKernelSD that represents the Lorentzian spectral density.
SpectralDensities.InversePolyKernelSD — MethodInversePolyKernelSD(coeffs::AbstractVector)Construct a InversePolyKernelSD spectral density with the given coefficients.
Arguments
coeffs::AbstractVector: A vector containing the coefficients of the polynomial (in ascending order of powers).
Returns
- An instance of the InversePolyKernelSD struct representing the spectral density.
SpectralDensities.LorentzDrudeSD — Typestruct LorentzDrudeSD <: AbstractSDRepresents a Lorentz-Drude spectral density. This is just an alias for DebyeSD.
SpectralDensities.LorentzianSD — Typestruct LorentzianSD <: AbstractSDLorentzianSD represents a Lorentzian spectral density. It is characterized by an amplitude α representing the strength of the coupling, the peak centre frequency ω0, and the width of the Lorentzian peak Γ. That is
\[J(\omega) = \frac{\alpha\Gamma}{\pi}\frac{\omega}{(\omega^2 - \omega_0^2)^2 + \omega^2\Gamma^2}\]
Fields
α::Float64: The amplitudeα, indicating the strength of the coupling.ω0::Float64: The centre frequency of the Lorentzian peak.Γ::Float64: The width of the Lorentzian peak.
SpectralDensities.LorentzianSD — MethodLorentzianSD(α::Real, ω0::Real, Γ::Real)Construct a Lorentzian spectral density with the given amplitude α, centre frequency ω0, and width Γ.
Arguments
α::Real: The amplitudeα, indicating the strength of the coupling.ω0::Real: The centre frequency of the Lorentzian peak.Γ::Real: The width of the Lorentzian peak.
Returns
- An instance of the
LorentzianSDstruct representing the Lorentzian spectral density.
SpectralDensities.OhmicSD — Typestruct OhmicSD <: AbstractSDOhmicSD represents an Ohmic spectral density. It is characterized by an amplitude α representing the strength of the Ohmic coupling. That is
\[J(\omega) = \alpha\omega\]
Fields
α::Float64: The amplitudeα, indicating the strength of the Ohmic coupling.
SpectralDensities.OhmicSD — MethodOhmicSD(α::Real)Construct an Ohmic spectral density with amplitude α.
Arguments
α::Real: The amplitudeα, indicating the strength of the Ohmic coupling.
Returns
- An instance of the
OhmicSDstruct representing the Ohmic spectral density.
SpectralDensities.OverdampedSD — Typestruct OverdampedSD <: AbstractSDRepresents an overdamped spectral density. This is just an alias for DebyeSD.
SpectralDensities.PolySD — Typestruct PolySD <: AbstractSDPolySD represents a polynomial spectral density. It is characterized by an amplitude α representing the strength of the coupling and the polynomial degree n. That is
\[J(\omega) = \alpha\omega^n\]
Fields
α::Float64: The amplitudeα, indicating the strength of the coupling.n::Int: The polynomial degree.
SpectralDensities.PolySD — MethodPolySD(α::Real, n::Int)Construct a polynomial spectral density with the given amplitude α and degree n.
Arguments
α::Real: The amplitudeα, indicating the strength of the coupling.n::Int: The polynomial degree.
Returns
- An instance of the
PolySDstruct representing the polynomial spectral density.
SpectralDensities.UnderdampedSD — Typestruct UnderdampedSD <: AbstractSDRepresents an underdamped spectral density. This is just an alias for LorentzianSD.
SpectralDensities.correlations — Methodcorrelations(J::AbstractSD, τ, β)Calculate the correlation function for a spectral density J at a given time delay τ and inverse temperature β, that is
\[\mathcal{C}(\tau) = \int_0^\infty J(\omega)\coth\left(\frac{\hbar\omega\beta}{2}\right)\cos(\omega\tau)\mathrm{d}\omega -i\int_0^\infty J(\omega)\sin(\omega\tau)\mathrm{d}\omega.\]
Arguments
J::AbstractSD: The spectral density.τ: The time delay at which the correlation function is calculated.β: The inverse temperature.
Returns
- The correlation function for the spectral density
Jat the given time delayτand inverse temperature β.
SpectralDensities.correlations_imag — Methodcorrelations_imag(J::AbstractSD, τ)Calculate the imaginary part of the correlation function for a spectral density J at a given time delay τ, that is
\[\mathrm{Im}[\mathcal{C}(\tau)] = -\int_0^\infty J(\omega)\sin(\omega\tau)\mathrm{d}\omega.\]
Arguments
J::AbstractSD: The spectral density.τ: The time delay at which the correlation function is calculated.
Returns
- The imaginary part of the correlation function for the spectral density
Jat
the given time delay τ.
SpectralDensities.correlations_real — Methodcorrelations_real(J::AbstractSD, τ, β)Calculate the real part of the correlation function for a spectral density J at a given time delay τ and inverse temperature β, that is
\[\mathrm{Re}[\mathcal{C}(\tau)] = \int_0^\infty J(\omega)\coth\left(\frac{\hbar\omega\beta}{2}\right)\cos(\omega\tau)\mathrm{d}\omega.\]
Arguments
J::AbstractSD: The spectral density.τ: The time delay at which the correlation function is calculated.β: The inverse temperature.
Returns
- The real part of the correlation function for the spectral density
Jat the
given time delay τ and inverse temperature β.
SpectralDensities.frequency_cutoff — Methodfrequency_cutoff(J::AbstractSD; tol=eps())Return the frequency cutoff of the spectral density J to accuracy set by the tolerance parameter tol.
Arguments
J::AbstractSD: The spectral density.tol: The tolerance at which to truncate the spectral density.
Returns
- The frequency cutoff for the desired tolerance.
SpectralDensities.frequency_step — Methodfrequency_step(J::AbstractSD; tol=eps())Calculate an appropriate frequency step for accurate numerical discretisation of the spectral density J.
Arguments
J::AbstractSD: The spectral density.tol::Real: (optional, default=eps()) The tolerance used to determine the appropriate frequency setp.
Returns
- The calculated frequency step for discretisation at the given tolerance.
SpectralDensities.imag_memory_kernel_ft — Methodimag_memory_kernel_ft(J::AbstractSD, ω)Calculate the imaginary part of the Fourier-transform of the memory kernel for a spectral density J at a given frequency ω.
Arguments
J::AbstractSD: The spectral density.ω: The frequency at which the imaginary part of the Fourier-transform of the memory kernel is evaluated.
Returns
- The imaginary part of the Fourier-transform of the memory kernel for the spectral density
Jat the given frequencyω.
SpectralDensities.memory_kernel — Methodmemory_kernel(J::AbstractSD, τ)Calculate the memory kernel for a spectral density J at a given time delay τ, that is
\[\mathcal{K}(\tau) = 2\Theta(\tau)\int_0^\infty J(\omega)\sin(\omega\tau)\mathrm{d}\omega.\]
where $\Theta$ is the Heavisde theta function.
Arguments
J::AbstractSD: The spectral density.τ: The time delay at which the memory kernel is evaluated.ωcutoff: (optinal, default: Inf) Frequency cutoff to be used when calculating the correlation function.
Returns
- The memory kernel for the spectral density
Jat the given time delayτ.
SpectralDensities.memory_kernel_ft — Methodmemory_kernel_ft(J::AbstractSD, ω)Calculate the Fourier-transform of the memory kernel for a spectral density J at a given frequency ω.
Arguments
J::AbstractSD: The spectral density.ω: The frequency at which the Fourier-transform of the memory kernel is evaluated.
Returns
- The Fourier-transform of the memory kernel for the spectral density
Jat the given frequencyω.
SpectralDensities.real_memory_kernel_ft — Methodreal_memory_kernel_ft(J::AbstractSD, ω)Calculate the real part of the Fourier-transform of the memory kernel for a spectral density J at a given frequency ω.
Arguments
J::AbstractSD: The spectral density.ω: The frequency at which the real part of the Fourier-transform of the memory kernel is evaluated.
Returns
- The real part of the Fourier-transform of the memory kernel for the spectral density
Jat the given frequencyω.
SpectralDensities.reorganisation_energy — Methodreorganisation_energy(J::AbstractSD)Calculate the reorganization energy of a given spectral density J, i.e.
\[\int_0^\infty \frac{J(\omega)}{\omega} \mathrm{d}\omega \]
Arguments
J::AbstractSD: The spectral density.
Returns
- The reorganization energy of the spectral density
J.
SpectralDensities.sd — Methodsd(J::T, ω) where T <: AbstractSDEvaluate the spectral density represented by J at a given frequency ω, i.e. J(ω).
Arguments
J::T: The spectral density.ω: The frequency at which the spectral density is evaluated.
Returns
- The spectral density
Jat the frequencyω.
SpectralDensities.sdoverω — Methodsdoverω(J::T, ω) where T <: AbstractSDEvaluate the spectral density represented by J divided by a given frequency ω, i.e. J(ω)/ω.
Arguments
J::T: The spectral density.ω: The frequency at which the spectral density is evaluated.
Returns
- The spectral density
J(ω)divided byω.
WeakCoupling
SpectralDensities.WeakCoupling.weak_coupling_Δ — Methodweak_coupling_Δ(J::AbstractSD, ωB, β; ωcutoff=Inf, ħ=one(ωB))Calculate the weak-coupling coefficient Δ for the spectral density J, system Bohr frequency ωB, and inverse temperature β, defined as
\[\Delta_\beta(\omega_\mathrm{B}) = 2\omega_\mathrm{B}\int_0^\infty J(\omega)\frac{1}{\omega^2-\omega_\mathrm{B}^2} \coth\left(\frac{\beta\hbar\omega}{2}\right) \mathrm{d}\omega\]
See: J.D. Cresser, J. Anders, Phys. Rev. Lett. 127, 250601 (2021).
Arguments
J::AbstractSD: The spectral density.ωB: The system Bohr frequency of interest.β: The inverse temperature.ωcutoff: (optional, default=Inf) Frequency cutoff to help with the convergence of the integration.ħ: The value of the reduced Planck constant. Default is 1.
Returns
- The weak-coupling coefficient
Δfor the spectral densityJ, system Bohr frequencyωB, and inverse temperatureβ.
SpectralDensities.WeakCoupling.weak_coupling_Δprime — Methodweak_coupling_Δprime(J::AbstractSD, ωB, β; ωcutoff=Inf, ħ=one(ωB))Calculate the weak-coupling coefficient Δ′ for the spectral density J, system Bohr frequency ωB, and inverse temperature β, defined as
\[{\Delta'}_\beta(\omega_\mathrm{B}) = 2\int_0^\infty J(\omega)\frac{(\omega^2 + \omega_\mathrm{B}^2)}{(\omega^2-\omega_\mathrm{B}^2)^2} \coth\left(\frac{\beta\hbar\omega}{2}\right) \mathrm{d}\omega\]
See: J.D. Cresser, J. Anders, Phys. Rev. Lett. 127, 250601 (2021).
Note: The spectral density J must support automatic differentiation with ForwardDiff.jl.
Arguments
J::AbstractSD: The spectral density.ωB: The system Bohr frequency of interest.β: The inverse temperature.ωcutoff: (optional, default=Inf) Frequency cutoff to help with the convergence of the integration.ħ: The value of the reduced Planck constant. Default is 1.
Returns
- The weak-coupling coefficient
Δ′for the spectral densityJ, system Bohr frequencyωB, and inverse temperatureβ.
SpectralDensities.WeakCoupling.weak_coupling_Σ — Methodweak_coupling_Σ(J::AbstractSD, ωB; ωcutoff=Inf)Calculate the weak-coupling coefficient Σ for the spectral density J and system Bohr frequency ωB, defined as
\[\Sigma(\omega_\mathrm{B}) = 2\int_0^\infty J(\omega)\frac{\omega}{\omega^2-\omega_\mathrm{B}^2} \mathrm{d}\omega\]
See: J.D. Cresser, J. Anders, Phys. Rev. Lett. 127, 250601 (2021).
Arguments
J::AbstractSD: The spectral denstiy.ωB: The system Bohr frequency of interest.ωcutoff: (optional, default=Inf) Frequency cutoff to help with the convergence of the integration.
Returns
- The weak-coupling coefficient
Σfor the spectral densityJand system Bohr frequencyωB.
SpectralDensities.WeakCoupling.weak_coupling_Σprime — Methodweak_coupling_Σprime(J::AbstractSD, ωB; ωcutoff=Inf)Calculate the weak-coupling coefficient Σ′ for the spectral density J and system Bohr frequency ωB, defined as
\[\Sigma'(\omega_\mathrm{B}) = 4\omega_\mathrm{B}\int_0^\infty J(\omega)\frac{\omega}{(\omega^2-\omega_\mathrm{B}^2)^2} \mathrm{d}\omega\]
See: J.D. Cresser, J. Anders, Phys. Rev. Lett. 127, 250601 (2021).
Note: The spectral density J must support automatic differentiation with ForwardDiff.jl.
Arguments
J::AbstractSD: The spectral density.ωB: The system Bohr frequency of interest.ωcutoff: (optional, default=Inf) Frequency cutoff to help with the convergence of the integration.
Returns
- The weak-coupling coefficient
Σ′for the spectral densityJand system Bohr frequencyωB.
SingularIntegrals
SpectralDensities.SingularIntegrals.cauchy_quadgk — Functioncauchy_quadgk(g, a, b, x0=0; kws...)Computes the Cauchy principal value of the integral of a function g with singularity at x0 over the interval [a, b], that is
\[\mathrm{P.V.}\int_a^b\frac{g(x)}{x-x_0}\mathrm{d}x\]
Note that x0 must be contained in the interval [a, b]. The actual integration is performed by the quadgk method of the QuadGK.jl package and the keyword arguments kws are passed directly onto quadgk.
Note: If the function g contains additional integrable singularities, the user should manually split the integration interval around them, since currently there is no way of passing integration break points onto quadgk.
Arguments
g: The function to integrate.a: The lower bound of the interval.b: The upper bound of the interval.x0: The location of the singularity. Default value is the origin.kws...: Additional keyword arguments accepted byquadgk.
Returns
A tuple (I, E) containing the approximated integral I and an estimated upper bound on the absolute error E.
Throws
ArgumentError: If the interval[a, b]does not include the singularityx0.
Examples
julia> cauchy_quadgk(x -> 1/(x+2), -1.0, 1.0)
(-0.549306144334055, 9.969608472104596e-12)
julia> cauchy_quadgk(x -> x^2, 0.0, 2.0, 1.0)
(4.0, 2.220446049250313e-16)SpectralDensities.SingularIntegrals.hadamard_quadgk — Functionhadamard_quadgk(g, g′, a, b, x0=0; kws...)Computes the Hadamard finite part of the integral of a function g with a singularity at x0 over the interval [a, b], that is
\[\mathcal{H}\int_a^b\frac{g(x)}{(x-x_0)^2}\mathrm{d}x\]
Note that x0 must be contained in the interval [a, b]. The actual integration is performed by the quadgk method of the QuadGK.jl package and the keyword arguments kws are passed directly onto quadgk.
Note: If the function g′ contains additional integrable singularities, the user should manually split the integration interval around them, since currently there is no way of passing integration break points onto quadgk.
Arguments
g: The function to integrate.g′: The derivative of the functiong.a: The lower bound of the interval.b: The upper bound of the interval.x0: The location of the singularity. Defaults value is the origin.kws...: Additional keyword arguments accepted byquadgk.
Returns
A tuple (I, E...) containing the approximated Hadamard finite part integral I and an additional error estimate E from the quadrature method.
Throws
ArgumentError: If the interval[a, b]does not include the singularityx0.
Examples
julia> hadamard_quadgk(x -> log(x+1), x -> 1/(x+1), 0.0, 2.0, 1.0)
(-1.6479184330021648, 9.969608472104596e-12)SpectralDensities.SingularIntegrals.kramers_kronig — Methodkramers_kronig(f, ω; cutoff=Inf, type=:real)Use the Kramers-Kronig relations to compute the analytic continuation of the function f at point ω. That is, if type == :real compute
\[\frac{1}{\pi}\int_{-\infty}^{\infty} \frac{f(\omega')}{\omega'-\omega} \mathrm{d}\omega',\]
and if type == :imag compute
\[-\frac{1}{\pi}\int_{-\infty}^{\infty} \frac{f(\omega')}{\omega'-\omega} \mathrm{d}\omega'.\]
Arguments
f: A function that is either the real or imaginary part of an analytic complex function.ω: The point where to evaluate the analytic continuation off.cutoff: (optional, default=Inf) A cutoff that bounds the range of integration.type::Symbol: (optional, default=:real) If:real, takefas the imaginary part and calculate the real part of the analytic continuation.
If :imag, take f as the real part and calculate the imaginary part of the analytic continuation.
Returns
- The real or imaginary part of the analytic continuation of
fevaluated atω.