Feynman Diagram

Diagrams as an AbstractTree

NumericalEFT.FeynmanDiagram.DiagTree.DiagramType
mutable struct Diagram{W}

struct of a diagram. A diagram of a sum or produce of various subdiagrams.

Members

  • hash::Int : the unique hash number to identify the diagram
  • name::Symbol : name of the diagram
  • id::DiagramId : diagram id
  • operator::Operator : operation, support Sum() and Prod()
  • factor::W : additional factor of the diagram
  • subdiagram::Vector{Diagram{W}} : vector of sub-diagrams
  • weight::W : weight of the diagram
source
NumericalEFT.FeynmanDiagram.DiagTree.derivativeMethod
function derivative(diags::Union{Diagram,Tuple,AbstractVector}, ::Type{ID}, order::Int) where {ID<:PropagatorId}

Automatic differentiation derivative on the diagrams

Arguments

  • diags : diagrams to take derivative
  • ID : DiagramId to apply the differentiation
  • order::Int : derivative order
source
NumericalEFT.FeynmanDiagram.DiagTree.derivativeMethod
function derivative(diags::Union{Tuple,AbstractVector}, ::Type{ID}; index::Int=index(ID)) where {W,ID<:PropagatorId}
function derivative(diags::Vector{Diagram{W}}, ::Type{ID}; index::Int=index(ID)) where {W,ID<:PropagatorId}

Automatic differentiation derivative on the diagrams

Arguments

  • diags : diagrams to take derivative
  • ID : DiagramId to apply the differentiation
  • index : index of the id.order array element to increase the order
source
NumericalEFT.FeynmanDiagram.DiagTree.plot_treeMethod
function plot_tree(diag::Diagram; verbose = 0, maxdepth = 6)

Visualize the diagram tree using ete3 python package

#Arguments

  • diag : the Diagram struct to visualize
  • verbose=0 : the amount of information to show
  • maxdepth=6 : deepest level of the diagram tree to show
source
NumericalEFT.FeynmanDiagram.DiagTree.removeHartreeFock!Method
function removeHartreeFock!(diag::Diagram{W}) where {W}
function removeHartreeFock!(diags::Union{Tuple,AbstractVector})

Remove the Hartree-Fock insertions that without any derivatives on the propagator and the interaction.

Arguments

  • diags : diagrams to remove the Fock insertion

Remarks

  • The operations removeHartreeFock! and taking derivatives doesn't commute with each other!
  • If the input diagram is a Hartree-Fock diagram, then the overall weight will become zero!
  • The return value is always nothing
source

Diagrams as an Expression Tree

NumericalEFT.FeynmanDiagram.ExprTree.CachedPoolType
struct CachedPool{O,T}

    Use this pool to host the objects that are heavy to evaluate so that one wants to cache their status.
    The user should defines a compare

Members

  • name::Symbol : name of the pool
  • object::O : object
  • current::T : current status
  • new::T : the new status wants to assign later
  • version::Int128 : the current version
  • excited::Bool : if set to excited, then the current status needs to be replaced with the new status
source
NumericalEFT.FeynmanDiagram.ExprTree.ExpressionTreeType
mutable struct ExpressionTree{V,PARA,F,W}

Diagram Object represents a set of Feynman diagrams in an experssion tree (forest) structure

Members

  • name::Symbol : Name of the tree
  • loopBasis::V : Tuple of pools of cached basis in a format of (BasisPool1, BasisPool2, ...)
  • node::CachedPool{Node{PARA,F},W} : Pool of the nodes in the diagram tree
  • root::Vector{Int} : indices of the cached nodes that are the root(s) of the diagram tree. Each element corresponds to one root.
source
NumericalEFT.FeynmanDiagram.ExprTree.LoopPoolType
struct LoopPool{T}

Pool of loop basis. Each loop basis corresponds to a loop variable.
A loop variable is a linear combination of N independent loops. The combination coefficients is what we call a loop basis.
For example, if a loop is a momentum K, then

varibale_i = K_1*basis[1, i] + K_2*basis[2, i] + K_3*basis[3, i] + ...

Members

  • name::Symbol : name of the pool
  • dim::Int : dimension of a loop variable (for example, the dimension of a momentum-frequency loop variable is (d+1) where d is the spatial dimension)
  • N::Int : number of independent loops (dimension of loop basis)
  • basis::Matrix{T} : Matrix of (N x Nb) that stores the loop basis, where Nb is the number of loop basis (or number of loop variables).
  • current::Matrix{T} : Matrix of (dim x Nb) that stores the loop variables, where Nb is the number of loop basis (or number of loop variables).
source
NumericalEFT.FeynmanDiagram.ExprTree.NodeType
mutable struct Node{PARA,F}

Node Object, which is the building block of the diagram tree. Each node is a collection of CACHED proapgator objects and other child CACHED node objects

Members

  • para::PARA : user-defined parameters, which will be used to evaluate the factor and the weight of the node (e.g., if the node represents a vertex function, then the parameter may be the momentum basis of the external legs)
  • operation::Int : #1: multiply, 2: add, ...
  • factor::F : additional factor of the node
  • components::Vector{Vector{Int}} : Index to the cached propagators stored in certain pools. Each Vector{Int} is for one kind of propagator.
  • childNodes::Vector{Int} : Indices to the cached nodes stored in certain pool. They are the child of the current node in the diagram tree.
  • parent::Int : Index to the cached nodes which is the parent of the current node.
source
NumericalEFT.FeynmanDiagram.ExprTree.addnode!Method
function addnode!(diag::ExpressionTree{V,PARA,F,W}, operator, name, children::Union{Tuple, AbstractVector}, factor = 1.0; para = nothing) where {V,PARA,F,W}

Add a node into the expression tree.

Arguments

  • diag::ExpressionTree : diagrammatic experssion tree.
  • operator::Int : #1: multiply, 2: add, ...
  • name : name of the node
  • children : Indices to the cached nodes stored in certain pool. They are the child of the current node in the diagram tree. It should be in the format of Vector{Int}.
  • factor = 1.0 : Factor of the node
  • para = nothing : Additional paramenter required to evaluate the node. Set to nothing by default.
source
NumericalEFT.FeynmanDiagram.ExprTree.addpropagator!Method
function addPropagator!(diag::ExpressionTree, name, factor = 1.0; site = [], loop = nothing, para = nothing, order::Int = 0)

Add a propagator into the diagram tree.

Arguments

  • diag : diagrammatic experssion tree.
  • order::Int = 0 : Order of the propagator.
  • name = :none : name of the propagator.
  • factor = 1 : Factor of the propagator.
  • site = [] : site basis (e.g, time and space coordinate) of the propagator.
  • loop = nothing : loop basis (e.g, momentum and frequency) of the propagator.
  • para = nothing : Additional paramenter required to evaluate the propagator.
source
NumericalEFT.FeynmanDiagram.ExprTree.showTreeMethod
showTree(diag::Diagrams, _root = diag.root[end]; verbose = 0, depth = 999)

Visualize the diagram tree using ete3 python package

#Arguments

  • diag: the Diagrams struct to visualize
  • _root: the index of the root node to visualize
  • verbose=0: the amount of information to show
  • depth=999: deepest level of the diagram tree to show
source

Parquet Algorithm to Build Diagrams

NumericalEFT.FeynmanDiagram.Parquet.ParquetBlocksType
struct ParquetBlocks

The channels of the left and right sub-vertex4 of a bubble diagram in the parquet equation

#Members

  • phi : channels of left sub-vertex for the particle-hole and particle-hole-exchange bubbles
  • ppi : channels of left sub-vertex for the particle-particle bubble
  • Γ4 : channels of right sub-vertex of all channels
source
NumericalEFT.FeynmanDiagram.Parquet.greenMethod
green(para::DiagPara, extK = DiagTree.getK(para.totalLoopNum, 1), extT = para.hasTau ? (1, 2) : (0, 0), subdiagram = false;
    name = :G, resetuid = false, blocks::ParquetBlocks=ParquetBlocks())

Build composite Green's function.
By definition, para.firstTauIdx is the first Tau index of the left most self-energy subdiagram.

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • extT: [Tau index of the left leg, Tau index of the right leg]
  • subdiagram : a sub-vertex or not
  • name : name of the diagram
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A Diagram object or nothing if the Green's function is illegal.
source
NumericalEFT.FeynmanDiagram.Parquet.polarizationMethod
function polarization(para, extK = DiagTree.getK(para.totalLoopNum, 1), subdiagram = false; name = :Π, resetuid = false, blocks::ParquetBlocks=ParquetBlocks())

Generate polarization diagrams using Parquet Algorithm.

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :diagram, :hash.
  • All polarization share the same external Tau index. With imaginary-time variables, they are extT = (para.firstTauIdx, para.firstTauIdx+1)
source
NumericalEFT.FeynmanDiagram.Parquet.sigmaMethod
function sigma(para, extK = DiagTree.getK(para.totalLoopNum, 1), subdiagram = false; name = :Σ, resetuid = false, blocks::ParquetBlocks=ParquetBlocks())

Build sigma diagram. 
When sigma is created as a subdiagram, then no Fock diagram is generated if para.filter contains NoFock, and no sigma diagram is generated if para.filter contains Girreducible

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • subdiagram : a sub-vertex or not
  • name : name of the diagram
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :type, :extT, :diagram, :hash
  • All sigma share the same incoming Tau index, but not the outgoing one
source
NumericalEFT.FeynmanDiagram.Parquet.vertex3Method
function vertex3(para, extK = [DiagTree.getK(para.totalLoopNum, 1), DiagTree.getK(para.totalLoopNum, 2)],
    subdiagram = false; name = :Γ3, chan = [PHr, PHEr, PPr, Alli], resetuid = false, 
    blocks::ParquetBlocks=ParquetBlocks()
    )

Generate 3-vertex diagrams using Parquet Algorithm.
With imaginary-time variables, all vertex3 generated has the same bosonic Tidx ``extT[1]=para.firstTauIdx`` and the incoming fermionic Tidx ``extT[2]=para.firstTauIdx+1``.

#Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loops as a vector [bosonic leg, fermionic in, fermionic out].
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • chan : vector of channels of the current 4-vertex.
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :extT, :diagram, :hash.
source
NumericalEFT.FeynmanDiagram.Parquet.vertex4Method
vertex4(para::DiagPara,
    extK = [DiagTree.getK(para.totalLoopNum, 1), DiagTree.getK(para.totalLoopNum, 2), DiagTree.getK(para.totalLoopNum, 3)],
    chan::AbstractVector = [PHr, PHEr, PPr, Alli],
    subdiagram = false;
    level = 1, name = :none, resetuid = false,
    subchannel::Symbol=:All, #:All, :W, :Lver3, :Rver3, :RPA
    blocks::ParquetBlocks=ParquetBlocks(),
    blockstoplevel::ParquetBlocks=blocks
    )

Generate 4-vertex diagrams using Parquet Algorithm

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loops as a vector [left in, left out, right in, right out].
  • chan : vector of channels of the current 4-vertex.
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • level : level in the diagram tree
  • resetuid : restart uid count from 1
  • subchannel : :All, :W, :Lver3, :Rver3, :RPA to select all, W-interaction, left-vertex-correction, right-vertex-correction or RPA-interaction diagrams
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.
  • blockstoplevel : building blocks of the Parquet equation at the toplevel. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :type, :extT, :diagram, :hash
source

Usage

julia> using FeynmanDiagramERROR: ArgumentError: Package FeynmanDiagram not found in current path, maybe you meant `import/using ..FeynmanDiagram`.
- Otherwise, run `import Pkg; Pkg.add("FeynmanDiagram")` to install the FeynmanDiagram package.
julia> para = GenericPara(diagType = Ver4Diag, innerLoopNum = 1, hasTau = true);ERROR: UndefVarError: Ver4Diag not defined
julia> Parquet.vertex4(para)ERROR: UndefVarError: Parquet not defined
julia> para = GenericPara(diagType = Ver3Diag, innerLoopNum = 1, hasTau = true);ERROR: UndefVarError: Ver3Diag not defined
julia> Parquet.vertex3(para)ERROR: UndefVarError: Parquet not defined
julia> para = GenericPara(diagType = SigmaDiag, innerLoopNum = 1, hasTau = true);ERROR: UndefVarError: SigmaDiag not defined
julia> Parquet.sigma(para)ERROR: UndefVarError: Parquet not defined
julia> para = GenericPara(diagType = PolarDiag, innerLoopNum = 1, hasTau = true);ERROR: UndefVarError: PolarDiag not defined
julia> Parquet.polarization(para)ERROR: UndefVarError: Parquet not defined