numericalEFT / GreenFunc.jl

Toolbox to study quantum many-body problem at the treelevel
https://numericaleft.github.io/GreenFunc.jl/
MIT License
11 stars 1 forks source link
effective-field-theory feynman-diagrams julia many-body-physics

GreenFunc

Stable Dev Build Status Coverage

GreenFunc.jl is a numerical framework to manipulate multidimensional Green's functions.

Features

Installation

This package has been registered. So, simply type import Pkg; Pkg.add("GreenFunc") in the Julia REPL to install.

Basic Usage

Example 1: Green's function of a single level

We first show how to use MeshArray to present Green's function of a single-level quantum system filled with spinless fermionic particles. We assume that the system could exchange particles and energy with the environment so that it's equilibrium state is a grand canonical ensemble. The single-particle Green's function then has a simple form in Matsubara-frequency representation: $G(ωₙ) = \frac{1}{(iωₙ - E)}$ where $E$ is the level energy. We show how to generate and manipulate this Green's function.

    using GreenFunc

    β = 100.0; E = 1.0 # inverse temperature and the level energy
    ωₙ_mesh = MeshGrids.ImFreq(100.0, FERMION; Euv = 100E) # UV energy cutoff is 100 times larger than the level energy
    Gn =  MeshArray(ωₙ_mesh; dtype=ComplexF64); # Green's function defined on the ωₙ_mesh

    for (n, ωₙ) in enumerate(Gn.mesh[1])
        Gn[n] = 1/(ωₙ*im - E)
    end

Example 2: Green's function of a free electron gas

Now let us show how to create a Green's function of a free electron gas. Unlike the spinless fermionic particle, the electron is a spin-1/2 particle so that it has two inner states. In free space, it has a kinetic energy $ϵ_q = q^2-E$ (we use the unit where $m_e = 1/2$). The Green's function in Matsubara-frequency space is then given by the following equation: $Gn = G{\sigma_1, \sigma_2}(q,\omega_n) = \frac{1}{i \omega_n - \epsilon_q}$, where $\sigma_i$ denotes the spins of the incoming and the outgoing electron in the propagator. We inherit the Matsubara-frequency grid from the first example. We show how to use the CompositeGrids package to generate momentum grids and how to treat the multiple inner states and the meshes with MeshArray.

    using GreenFunc, CompositeGrids
    β = 100.0; E = 1.0 # inverse temperature and the level energy
    ωₙ_mesh = MeshGrids.ImFreq(100.0, FERMION; Euv = 100E) # UV energy cutoff is 100 times larger than the level energy
    kmesh = SimpleGrid.Uniform{Float64}([0.0, 10.0], 50); # initialze an uniform momentum grid
    G_n =  MeshArray(1:2, 1:2, kmesh, ωₙ_mesh; dtype=ComplexF64); # Green's function of free electron gas with 2x2 innerstates

    for ind in eachindex(G_n)
        q = G_n.mesh[3][ind[3]]
        ω_n = G_n.mesh[4][ind[4]]
        G_n[ind] = 1/(ω_n*im - (q^2-E))
    end

Example 3: Green's function of a Hubbard lattice

Now we show how to generate a multi-dimensional Green's function on a Brillouin Zone meshe. We calculate the Green's function of a free spinless Fermi gas on a square lattice. It has a tight-binding dispersion $\epsilon_q = -2t(\cos(q_x)+\cos(q_y))$, which gives $G(q, \omega_n) = \frac{1}{i\omega_n - \epsilon_q}$. The momentum is defined on the first Brillouin zone captured by a 2D k-mesh.

    using GreenFunc
    using GreenFunc: BrillouinZoneMeshes

    DIM, nk = 2, 8
    lattice = Matrix([1.0 0; 0 1]')
    br = BrillouinZoneMeshes.BZMeshes.Cell(lattice=lattice)
    bzmesh = BrillouinZoneMeshes.BZMeshes.UniformBZMesh(cell=br, size=(nk, nk))
    ωₙmesh = ImFreq(10.0, FERMION)
    g_freq =  MeshArray(bzmesh, ωₙmesh; dtype=ComplexF64)

    t = 1.0
    for ind in eachindex(g_freq)
        q = g_freq.mesh[1][ind[1]]
        ωₙ = g_freq.mesh[2][ind[2]]
        g_freq[ind] = 1/(ωₙ*im - (-2*t*sum(cos.(q))))
    end

Example 4: Fourier Transform of Green's function with DLR

DLR provides a compact representation for one-body Green's functions. At a temperature $T$ and an accuracy level $\epsilon$, it represents a generic Green's function with only $\log (1/T) \log (1/\epsilon)$ basis functions labeled by a set of real frequency grid points. It enables fast Fourier transform and interpolation between the imaginary-time and the Matsubara-frequency representations with a cost $O(\log (1/T) \log (1/\epsilon))$. GreenFunc.jl provide DLR through the package Lehmann.jl.

In the following example, we demonstrate how to perform DLR-based Fourier transform in GreenFunc.jl between the imaginary-time and the Matsubara-frequency domains back and forth through the DLR representation.

    using GreenFunc, CompositeGrids

    β = 100.0; E = 1.0 # inverse temperature and the level energy
    ωₙ_mesh = ImFreq(100.0, FERMION; Euv = 100E) # UV energy cutoff is 100 times larger than the level energy
    kmesh = SimpleGrid.Uniform{Float64}([0.0, 10.0], 50); # initialze an uniform momentum grid
    G_n =  MeshArray(1:2, 1:2, kmesh, ωₙ_mesh; dtype=ComplexF64); # Green's function of free electron gas with 2x2 innerstates

    for ind in eachindex(G_n)
        q = G_n.mesh[3][ind[3]]
        ω_n = G_n.mesh[4][ind[4]]
        G_n[ind] = 1/(im*ω_n - (q^2-E))
    end

    G_dlr = to_dlr(G_n) # convert G_n to DLR space 
    G_tau = to_imtime(G_dlr) # convert G_dlr to the imaginary-time domain 

    #alternative, you can use the pipe operator
    G_tau = G_n |> to_dlr |> to_imtime #Fourier transform to (k, tau) domain

The imaginary-time Green's function after the Fourier transform shoud be consistent with the analytic solution $G_{\tau} = -e^{-\tau \epsilon_q}/(1+e^{-\beta \epsilon_q})$.

Interface with TRIQS

TRIQS (Toolbox for Research on Interacting Quantum Systems) is a scientific project providing a set of C++ and Python libraries for the study of interacting quantum systems. We provide a direct interface to convert TRIQS objects, such as the temporal meshes, the Brillouin zone meshes, and the multi-dimensional (blocked) Green's functions, to the equivalent objects in our package. It would help TRIQS users to make use of our package without worrying about the different internal data structures.

The interface is provided by an independent package NEFTInterface.jl. We provide several examples of interfacing TRIQS and GreenFunc.jl in the NEFTInterface.jl README.