Interaction Tree

Use a bi-tree structure to store the interactions and generate sparse Hamiltonian MPO.

FiniteMPS.AbstractInteractionIteratorType
 abstract type AbstractInteractionIterator{L}

The abstract type for the iterator of interaction terms. All the concrete subtypes should implement the iterate method so that the following usages are both valid where Ops is an instance of AbstractInteractionIterator.

for O in Ops
     # the i-th loop will give the i-th LocalOperator
end

collect(Ops) # return the vector of all LocalOperators 
source
FiniteMPS.OnSiteInteractionIteratorType
 struct OnSiteInteractionIterator{L, T} <: AbstractInteractionIterator{L}
      Op::AbstractLocalOperator
      Z::T
 end

The iterator for on-site terms such as bosonic n_i or fermionic c_i together with its Jordan-Wigner stringZ_{i+1} Z_{i+2} ... Z_{L}.

Fields

 Op::AbstractLocalOperator

The local operator which tells both the operator and its site index.

 Z::Nothing

For bosonic operators. Z::AbstractTensorMap For fermionic operators. Assume all sites are fermionic therefore each site after Op will give Z operator. Z::AbstractVector{<:AbstractTensorMap} Directly give the Z operator for each site to deal with the systems mixed with bosons and fermions.

Constructors

 OnSiteInteractionIterator{L}(Op::AbstractLocalOperator, Z::T) where {L, T}

Direct constructor.

 OnSiteInteractionIterator{L}(Op::AbstractTensorMap,
      name::Union{String, Symbol},
      si::Int64;
      swap::Bool=false,
      Z=nothing)

Generate the LocalOperator object with Op, name, si and kwarg swap, details please see the constructors of LocalOperator.

source
FiniteMPS.TwoSiteInteractionIteratorType
 struct TwoSiteInteractionIterator{L, T} <: AbstractInteractionIterator{L}
      O₁::AbstractLocalOperator
      O₂::AbstractLocalOperator
      Z::T
 end

The iterator for two-site terms such as bosonic n_i n_j or fermionic c_i c_j together with its Jordan-Wigner string Z_{i+1} Z_{i+2} ... Z_{j}.

Note the two site indices can be in both ascending and descending order but should not be the same. For the latter case, please use OnSiteInteractionIterator to get an on-site term instead.

Fields

 O₁::AbstractLocalOperator
 O₂::AbstractLocalOperator

The local operators.

 Z::Nothing

For bosonic operators. Z::AbstractTensorMap For fermionic operators. Note we assume both O₁ and O₂ are fermionic operators if Z ≠ nothing. Z::AbstractVector{<:AbstractTensorMap} Directly give the Z operator for each site to deal with the systems mixed with bosons and fermions.

Constructors

 TwoSiteInteractionIterator{L}(O₁::AbstractLocalOperator, O₂::AbstractLocalOperator, Z::T) where {L, T}

Direct constructor.

 TwoSiteInteractionIterator{L}(Op::NTuple{2, AbstractTensorMap},
      name::NTuple{2, Union{String, Symbol}},
      si::NTuple{2, Int64};
      convertRight::Bool=false,
      Z=nothing)

Generate the LocalOperator objects with 2-tuples Op, name and si. If convertRight == true, convert the the second operator (with larger site index, can be O₁ or O₂) to a right one (i.e. only have left horizontal leg), which is used to uniquely determine the contraction when calculating ITP.

source
FiniteMPS.ArbitraryInteractionIteratorType
 ArbitraryInteractionIterator{L} <: AbstractInteractionIterator{L}
      Ops::Vector{<:AbstractLocalOperator}
      Z::Union{Nothing, AbstractTensorMap, AbstractVector{<:AbstractTensorMap}}
      pspace::Union{Nothing, VectorSpace, Vector{<:VectorSpace}}
 end

The iterator for an arbitrary interaction term.

Fields

 Ops::Vector{<:AbstractLocalOperator}

A vector to store the local operators, length(Ops) == N means a N-site interaction term.

 Z::Union{Nothing, AbstractTensorMap, AbstractVector{<:AbstractTensorMap}}
 pspace::Union{Nothing, VectorSpace, Vector{<:VectorSpace}}

Provide the fermion parity operator Z and the local physical space pspace. Assume a site-independent Z or pspace if a single object is provided, otherwise, a length-L vector is expected to deal with the site-dependent cases.

Constructors

 ArbitraryInteractionIterator{L}(Ops::Vector{<:AbstractLocalOperator},
      Z::Union{Nothing, AbstractTensorMap, AbstractVector{<:AbstractTensorMap}},
      pspace::Union{Nothing, VectorSpace, Vector{<:VectorSpace}} = nothing)

The direct constructor.

source
FiniteMPS.InteractionChannelType
mutable struct InteractionChannel{T}
	Ops::Vector{Int64}
	ref::Ref
	LeafL::T
	LeafR::T
	preserve::Bool
end

A concrete type for labeling an interaction channel in an InteractionTree.

Fields

Ops::Vector{Int64}

Stores the indices of local operators.

ref::Ref

Ref for the interaction strength.

LeafL::T
LeafR::T

The left and right leaf nodes.

preserve::Bool

If true, the channel will not be merged so that the interaction strength can be dynamical tuned via Ref.

Constructors

InteractionChannel(Ops::Vector{Int64},
	ref::Ref,
	LeafL::T,
	LeafR::T,
	preserve::Bool = false) -> InteractionChannel{T}
source
FiniteMPS.InteractionTreeNodeType
mutable struct InteractionTreeNode 
	Op::NTuple{2, Int64}
	parent::Union{Nothing, InteractionTreeNode}
	children::Vector{InteractionTreeNode}
	Intrs::Vector{InteractionChannel}
end

Concrete type for a node of InteractionTree.

Fields

Op::NTuple{2, Int64}

(si, idx) to label the idx-st operator at site si.

parent::Union{Nothing, InteractionTreeNode}
children::Vector{InteractionTreeNode}

The parent node and children nodes.

Intrs::Vector{InteractionChannel}

Stores all interaction channels linked to this node.

Constructors

InteractionTreeNode(Op::NTuple{2, Int64},
	parent::Union{Nothing, InteractionTreeNode},
	children::Vector{InteractionTreeNode} = InteractionTreeNode[],
	Intrs::Vector{InteractionChannel} = InteractionChannel[]
	) -> InteractionTreeNode
source
FiniteMPS.InteractionTreeType
mutable struct InteractionTree{L}
	Ops::Vector{Vector{AbstractLocalOperator}}
	Refs::Dict{String, Dict}
	RootL::InteractionTreeNode
	RootR::InteractionTreeNode
end

Implementation of a bi-tree structure for storing all interactions in a L-site Hamiltonian.

Fields

Ops::Vector{Vector{AbstractLocalOperator}}

Stores all concrete local operators used at each site, Ops[si][idx] is the idx-st operator at site si.

Refs::Dict{String, Dict}

A dictionary to store all interactions strength. Refs[name] is a dictionary (i, j, ...) => Ref, where Ref[] is the strength of this interaction term with site indices i, j, ....

RootL::InteractionTreeNode
RootR::InteractionTreeNode

The root node of left (from the first site) or right (from the last site) tree.

Constructors

InteractionTree(L::Int64) -> ::InteractionTree{L}

Construct an empty InteractionTree.

source
Base.merge!Method
merge!(Tree::InteractionTree) -> Tree::InteractionTree

Merge interactions with same left or right environment tensor. Symmetrical merging from boundary to bulk is used here, which works well for most cases.

source
merge!(Tree::ObservableTree) -> Tree::ObservableTree

Merge observables in Tree that share the same parent node to reduce the computation cost of environment tensors. The behavior is similar to merge! for InteractionTree, but some detailed logic is different.

source
 merge!(G::ImagTimeProxyGraph;
      verbose::Int64=0,
      half::Bool=false) -> nothing

Search and merge some repeated vertices in the ITP graph G.

Kwargs

 verbose::Int64 = 0

Display the merging process if verbose > 0.

 half::Bool = false

Only execute the left(right) merging for the left(right) half sites if half = true.

source
FiniteMPS.addIntr!Function
addIntr!(Tree::InteractionTree{L},
	Op::NTuple{N, AbstractTensorMap},
	si::NTuple{N, Int64},
	fermionic::NTuple{N, Bool},
	strength::Number;
	Z = nothing,
	pspace = nothing,
	name = _default_IntrName(N),
	IntrName = prod(string.(name)),
) -> nothing

Add an interaction characterized by N local operators at si = (i, j, ...) sites. fermionic indicates whether each operator is fermionic or not.

Kwargs

Z::Union{Nothing, AbstractTensorMap, Vector{<:AbstractTensorMap}}

Provide the parity operator to deal with the fermionic anti-commutation relations.If Z == nothing, assume all operators are bosonic. Otherwise, a uniform (single operator) Z::AbstractTensorMap or site-dependent (length L vector) Z::Vector{<:AbstractTensorMap} should be given.

pspace::Union{Nothing, VectorSpace, Vector{<:VectorSpace}}

Provide the local Hilbert space (VectorSpace in TensorKit.jl). This is not required in generating Hamiltonian, so the default value is set as nothing. But some processes like generating an identity MPO require this information. In such cases, a uniform or site-dependent (length L vector) pspace should be given.

name::NTuple{N, Union{Symbol, String}}

Give a name of each operator.

IntrName::Union{Symbol, String}

Give a name of the interaction, which is used as the key of Tree.Refs::Dict that stores interaction strengths. The default value is the product of each operator name.

source
addIntr!(Tree::InteractionTree{L},
	Op::AbstractTensorMap,
	si::Int64,
	strength::Number;
	pspace::Union{Nothing, VectorSpace, Vector{<:VectorSpace}} = nothing,
	name::Union{Symbol, String} = "A",
	IntrName::Union{Symbol, String} = string.(name),
)

The special case for on-site interactions. Compared with the standard usage, converting to tuples is not required for convenience.

source
FiniteMPS.AutomataMPOFunction
AutomataMPO(Tree::InteractionTree;
	compress::Int64 = 1,
	tol::Float64 = 1e-12
) -> H::SparseMPO

Generate the Hamiltonian MPO H::SparseMPO according to an InteractionTree.

Kwargs

compress::Int64 = 1

The compress level. 0: without compression. 1(default): merge the same rows/columns. 2: compress via lu decomposition. 3: compress via svd. Note higher compress results in lower MPO bond dimension, however may lead to more operators in the sparse matrix at each site.

tol::Float64 = 1e-12

Tolerance of the low-rank decompositions.

source