MeshGrids

GreenFunc.MeshGrids.DLRFreqType
function DLRFreq(β, isFermi::Bool=false;
    dtype=Float64,
    rtol=1e-12,
    Euv=1000 / β,
    sym=:none,
    rebuild=false,
    dlr::Union{DLRGrid,Nothing}=nothing
)

Create a DLRFreq struct from parameters.

Arguments

  • β: inverse temperature.
  • isFermi: the statistics for particles is fermionic or not. False by default.
  • dtype: type of β and Euv.
  • rtol: tolerance absolute error. By default, rtol = 1e-12.
  • Euv: the UV energy scale of the spectral density. By default, Euv = 1000 / β.
  • symmetry: :ph for particle-hole symmetric, :pha for particle-hole symmetry, and :none for no symmetry. By default, sym = :none.
  • rebuild: if no dlr is input, set false to load DLRGrid from the file; set true to recalculate the DLRGrid on the fly. By default, rebuild = false.
source
GreenFunc.MeshGrids.DLRFreqType
struct DLRFreq{T<:Real} <: TemporalGrid{Int}

Discrete-Lehmann-representation grid for Green's functions.

Parameters

  • T: type of the grid point, β and Euv.

Members

  • dlr: built-in DLR grid.
  • grid: 1D grid of time axis, with locate, volume, and AbstractArray interface implemented. It should be grid of Int for ImFreq, and DLRGrid for DLRFreq.
  • β: inverse temperature.
  • Euv: the UV energy scale of the spectral density.
  • rtol: tolerance absolute error.
  • symmetry: :ph for particle-hole symmetric, :pha for particle-hole symmetry, and :none for no symmetry. By default, sym = :none.
  • isFermi: the statistics for particles.
source
GreenFunc.MeshGrids.ImFreqType
function ImFreq(β, isFermi::Bool=false;
    dtype=Float64,
    Euv=1000 / β,
    rtol=1e-12,
    symmetry=:none,
    grid::Union{AbstractGrid,AbstractVector,Nothing}=nothing
)

Create a ImFreq struct from parameters.

Arguments

  • β: inverse temperature.
  • isFermi: the statistics for particles is fermionic or not. False by default.
  • dtype: type of β and Euv. By default, dtype = Float64.
  • Euv: the UV energy scale of the spectral density. By default, Euv = 1000 / β.
  • symmetry: :ph for particle-hole symmetric, :pha for particle-hole symmetry, and :none for no symmetry. By default, sym = :none.
  • grid: 1D Matsubara-frequency integer-valued grid as a AbstractVector or CompositeGrids.AbstractGrid. By default, a optimized grid built in DLR is used.
source
GreenFunc.MeshGrids.ImFreqType
struct ImFreq{T, G, R} <: TemporalGrid{Int}

Imaginary-frequency grid for Green's functions.

Parameters

  • T<:Real: type of the grid point, β and Euv.
  • G<:AbstractGrid{T}: type of 1D grid with T as the grid point type.
  • R: type of the representation.
  • REV: access the grid in reverse order or not.

Members

  • grid: 1D grid of time axis, with locate, volume, and AbstractArray interface implemented. Always in ascend order It should be grid of Int for ImFreq, and DLRGrid for DLRFreq.
  • β: inverse temperature.
  • Euv: the UV energy scale of the spectral density.
  • isFermi: the statistics for particles is fermionic or not.
  • symmetry: :ph for particle-hole symmetric, :pha for particle-hole symmetry, and :none for no symmetry. By default, sym = :none.
  • rtol: relative tolerance
  • representation: the representation of the Green's function.
source
GreenFunc.MeshGrids.ImFreqMethod
function ImFreq(dlr::DLRGrid; dtype=Float64, grid::Union{AbstractGrid,AbstractVector}=SimpleG.Arbitrary{Int}(dlr.n))

Construct ImFreq from a DLRGrid, with a given grid. By default, grid is the Matsubara-frequency points from DLRGrid.

source
GreenFunc.MeshGrids.ImTimeType
function ImTime(β, isFermi::Bool=false;
    dtype=Float64,
    rtol=1e-12,
    Euv=1000 / β,
    symmetry=:none,
    grid::Union{AbstractGrid,AbstractVector,Nothing}=nothing
)

Create a ImTime struct.

Arguments

  • β: inverse temperature.
  • isFermi: the statistics for particles is fermionic or not. False by default.
  • dtype: type of the grid point. By default, dtype = Float64.
  • Euv: the UV energy scale of the spectral density. By default, Euv = 1000 / β.
  • symmetry: :ph for particle-hole symmetric, :pha for particle-hole symmetry, and :none for no symmetry. By default, sym = :none.
  • grid: 1D time grid as a AbstractVector or CompositeGrids.AbstractGrid. By default, a optimized grid built in DLR is used.
source
GreenFunc.MeshGrids.ImTimeType
struct ImTime{T, G, R} <: TemporalGrid{T}

Time grid for Green's functions.

Parameters

  • T<:Real: type of the grid point, β and Euv.
  • G<:AbstractGrid{T}: type of 1D grid with T as the grid point type.
  • R: type of the representation.
  • REV: access the grid in reverse order or not.

Members

  • grid: 1D grid of time axis, with locate, volume, and AbstractArray interface implemented. Always in ascend order. It should be grid of Int for ImFreq, and DLRGrid for DLRFreq.
  • β: inverse temperature.
  • Euv: the UV energy scale of the spectral density.
  • isFermi: the statistics for particles is fermionic or not.
  • symmetry: :ph for particle-hole symmetric, :pha for particle-hole symmetry, and :none for no symmetry. By default, sym = :none.
  • rtol: relative tolerance
  • representation: the representation of the Green's function.
source
GreenFunc.MeshGrids.ImTimeMethod
function ImTime(dlr::DLRGrid; dtype=Float64, grid::Union{AbstractGrid,AbstractVector}=SimpleG.Arbitrary{dtype}(dlr.τ))

Construct ImTime from a DLRGrid, with a given grid. By default, grid is the imaginary-time grid points from DLRGrid.

source
GreenFunc.MeshGrids.MeshProductType

The cartesian Mesh product:

#Parameters:

  • 'MT': Type of meshes
  • 'N' : Number of meshes

#Members:

  • 'meshes' : The list of Meshes in the MeshProduct
  • 'dims' : A tuple of the length of the mesh factors
source
Base.floorMethod
Base.floor(tg::TemporalGrid{T,false}, pos) where {T} = floor(tg.grid, pos) #TODO: how to implement?
Base.floor(tg::TemporalGrid{T,true}, pos) where {T} = length(tg) - floor(tg.grid, pos) #TODO: how to implement?

If the grid is in ascend order, then floor returns the largest index that the grid point is smaller than pos. If the grid is in descend order, then floor returns the largest index that the grid point is larger than pos.

In both cases, the returned index is in the range [1, length(tg)-1]

source
Base.getindexMethod
getindex(g::ImFreq{T, G, R, REV}, I::Int)

Equivalent to g[I], get the real-valued Matsubara frequency of the Ith point in the grid. For fermion, return (2g[I]+1)π/β, for boson, return 2g[I]*π/β.

If REV = true, then index in the reversed order, namely I will be replaced with length(g) - I + 1.

If you need the integer-valued frequency, use g.grid[I] instead.

source
Base.lengthMethod
function Base.length(obj::MeshProduct)

Return the number of grids of the MeshProduct.

source
Base.showMethod
show(io::IO, tg::DLRFreq)

Write a text representation of the DLR grid tg to the output stream io.

source
Base.showMethod
show(io::IO, tg::ImFreq)

Write a text representation of the Imaginary-frequency grid tg to the output stream io.

source
Base.showMethod
show(io::IO, tg::ImTime)

Write a text representation of the Imaginary-time grid tg to the output stream io.

source
Base.showMethod
function Base.show(io::IO, obj::MeshProduct)

Print the MeshProduct.

source
Base.sizeMethod
function Base.size(obj::MeshProduct, I::Int)

Return the length of the specifict Ith mesh factor of the MeshProduct.

source
Base.sizeMethod
function Base.size(obj::MeshProduct, I::Int)

Return the length of the specifict Ith mesh factor of the MeshProduct.

source
GreenFunc.MeshGrids.index_to_linearMethod
function index_to_linear(obj::MeshProduct, index...)

Convert a tuple of the indexes of each mesh to a single linear index of the MeshProduct.

Argument:

  • 'obj': The MeshProduct object
  • 'index...': N indexes of the mesh factor, where N is the number of mesh factor
source
GreenFunc.MeshGrids.linear_to_indexMethod
function linear_to_index(obj::MeshProduct, I::Int)

Convert the single linear index of the MeshProduct to a tuple of indexes of each mesh.

Argument:

  • 'obj': The MeshProduct object
  • 'I': The linear index of the MeshProduct
source
GreenFunc.MeshGrids.locateMethod
locate(tg::ImFreq, n::Int)
locate(tg::ImFreq, ωn)

Find the location in tg.grid for the Matsubara frequency ωn or the integer n.

source