Observable Tree
Similar with InteractionTree
, for computing expectation value of observables.
FiniteMPS.ObservableTree
— Typestruct ObservableTree{L}
Ops::Vector{Vector{AbstractLocalOperator}}
Refs::Dict{String, Dict}
RootL::InteractionTreeNode
RootR::InteractionTreeNode
end
Similar to InteractionTree
but specially used for calculation of observables.
Constructors
ObservableTree(L)
Initialize an empty object, where L
is the number of sites.
Base.merge!
— Methodmerge!(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.
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.
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
.
FiniteMPS.treewidth
— Functiontreewidth(Tree::ObservableTree) -> Tuple{Int64, Int64}
Return the tree width of the left and right trees.
FiniteMPS.addObs!
— FunctionaddObs!(Tree::ObservableTree{L},
Op::NTuple{N, AbstractTensorMap},
si::NTuple{N, Int64},
fermionic::NTuple{N, Bool};
Z = nothing,
pspace = nothing,
name = _default_IntrName(N),
IntrName = prod(string.(name)),
) -> nothing
Add an N
-site observable to Tree
, where the observable is characterized by N
-tuples Op
, si
and fermionic
. The implementation and usage is similar to addIntr!
, except for the logic to deal with same operator which is added twice.
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.
FiniteMPS.calObs!
— FunctioncalObs!(Tree::ObservableTree{L},
Ψ::AbstractMPS{L},
Φ::AbstractMPS{L} = Ψ;
kwargs...
) -> TO::TimerOutput
Calculate ⟨Ψ|O|Φ⟩
of all observables O
stored in Tree
, using bra ⟨Ψ|
and ket |Φ⟩
.
Kwargs
El::AbstractTensorMap
Er::AbstractTensorMap
Manually set boundary left or right environment tensor. Default is the rank-2
isometry deduced from Ψ
and Φ
, which may be incorrect if the operators have nontrivial auxiliary spaces.
normalize::Bool = false
If 'true', calculate ⟨Ψ|O|Φ⟩/(|Ψ||Φ|)
instead of ⟨Ψ|O|Φ⟩
.
serial::Bool = false
Force to choose serial mode, usually used when debugging.
disk::Bool = false
Store environment tensor in disk or not.
maxsize::Int64 = maximum(treewidth(Tree))
Number of environment tensors left in memory. Default is the larger one of the width of left tree or right tree.
verbose::Int64 = 0
Show the timer several times if verbose > 0
.
showtimes::Int64 = 10
Times to show the timer.
GCSpacing::Int64 = 100
The spacing (count nodes) between two nearest manual GC.gc()
.
ntasks::Int64 = get_num_threads()
Number of distributed tasks, used in multithreaded mode.