Skip to content

Commit c26ff3a

Browse files
committed
Add support for symmetric boundary MPS contractions
1 parent 9b24a74 commit c26ff3a

13 files changed

Lines changed: 1156 additions & 6 deletions

‎src/Defaults.jl‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ Module containing default algorithm parameter values and arguments.
1717
* `ctmrg_tol_max=$(Defaults.ctmrg_tol_max)` : Maximal CTMRG tolerance used by `ctmrg_dynamic_tols`.
1818
* `ctmrg_tol_factor=$(Defaults.ctmrg_tol_factor)` : Tolerance scaling factor used by `ctmrg_dynamic_tols`.
1919
20+
## Boundary contraction
21+
22+
* `boundary_alg=:$(Defaults.boundary_alg)` : Default algorithm family used to contract a network, see [`PEPSKit.BoundaryAlgorithm`](@ref).
23+
- `:SimultaneousCTMRG`, `:SequentialCTMRG`, `:C4vCTMRG` : CTMRG variants.
24+
- `:SymmetricBoundaryMPS` : Boundary MPS contraction of a fully symmetric single-site network.
25+
26+
## Boundary MPS
27+
28+
* `boundarymps_mps_alg=:$(Defaults.boundarymps_mps_alg)` : Default MPS optimization algorithm driving a boundary MPS contraction.
29+
- `:VUMPS` : Variational uniform MPS.
30+
- `:VOMPS` : Variational optimization of the MPS through MPO-MPS overlap maximization.
31+
2032
## SVD forward & reverse
2133
2234
* `trunc=:$(Defaults.trunc)` : Truncation scheme for SVDs and other decompositions.
@@ -150,6 +162,12 @@ const ctmrg_tol_min = 1.0e-12
150162
const ctmrg_tol_max = 1.0e-4
151163
const ctmrg_tol_factor = 1.0e-3
152164

165+
# Boundary contraction
166+
const boundary_alg = :SimultaneousCTMRG # ∈ {:SimultaneousCTMRG, :SequentialCTMRG, :C4vCTMRG, :SymmetricBoundaryMPS}
167+
168+
# Boundary MPS
169+
const boundarymps_mps_alg = :VUMPS # ∈ {:VUMPS, :VOMPS}
170+
153171
# SVD forward & reverse
154172
const trunc = :FixedSpaceTruncation # ∈ {:FixedSpaceTruncation, :notrunc, :truncerror, :truncspace, :trunctol}
155173
const rrule_degeneracy_atol = 1.0e-13

‎src/PEPSKit.jl‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ include("operators/models.jl")
8181

8282
include("environments/ctmrg_environments.jl")
8383
include("environments/vumps_environments.jl")
84+
include("environments/boundarymps_environments.jl")
8485
include("environments/suweight.jl")
8586
include("environments/bp_environments.jl")
8687
include("environments/product_state_environments.jl")
@@ -102,6 +103,7 @@ include("algorithms/contractions/absorb_weight.jl")
102103
include("algorithms/contractions/transfer.jl")
103104
include("algorithms/contractions/localoperator.jl")
104105
include("algorithms/contractions/vumps_contractions.jl")
106+
include("algorithms/contractions/boundarymps_contractions.jl")
105107
include("algorithms/contractions/bp_contractions.jl")
106108
include("algorithms/contractions/bondenv/benv_tools.jl")
107109
include("algorithms/contractions/bondenv/gaugefix.jl")
@@ -111,6 +113,8 @@ include("algorithms/contractions/correlator/peps.jl")
111113
include("algorithms/contractions/correlator/pepo_purified.jl")
112114
include("algorithms/contractions/correlator/pepo_1layer.jl")
113115

116+
include("algorithms/boundary_algorithm.jl")
117+
114118
include("algorithms/ctmrg/sparse_environments.jl")
115119
include("algorithms/ctmrg/ctmrg.jl")
116120
include("algorithms/ctmrg/projectors.jl")
@@ -145,6 +149,10 @@ include("algorithms/toolbox.jl")
145149
include("algorithms/correlator_adapters.jl")
146150
include("algorithms/correlators.jl")
147151

152+
include("algorithms/boundarymps/symmetric_boundarymps.jl")
153+
include("algorithms/boundarymps/characteristic_equations.jl")
154+
include("algorithms/boundarymps/observables.jl")
155+
148156
include("algorithms/optimization/implicit_differentiation.jl")
149157
include("algorithms/optimization/preconditioning.jl")
150158
include("algorithms/optimization/peps_optimization.jl")
@@ -161,6 +169,7 @@ export corner, edge, setcorner!, setedge!
161169
export FixedSpaceTruncation, SiteDependentTruncation
162170
export HalfInfiniteProjector, FullInfiniteProjector
163171
export C4vCTMRG, C4vEighProjector, C4vQRProjector
172+
export SymmetricBoundaryMPS, SymmetricBoundaryMPSEnv
164173
export initialize_random_c4v_env, initialize_singlet_c4v_env
165174
export LocalOperator, physicalspace
166175
export product_peps
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""
2+
$(TYPEDEF)
3+
4+
Abstract super type for all algorithms that contract an infinite square network by computing
5+
a boundary fixed point, such as CTMRG and boundary MPS algorithms.
6+
7+
This is the type of the `boundary_alg` field of [`PEPSOptimize`](@ref), and hence the
8+
supertype every algorithm which can be used to contract a network during a variational
9+
optimization must belong to.
10+
"""
11+
abstract type BoundaryAlgorithm end
12+
13+
const BOUNDARY_ALGORITHM_SYMBOLS = IdDict{Symbol, Type{<:BoundaryAlgorithm}}()
14+
15+
"""
16+
_tol(alg::BoundaryAlgorithm)
17+
18+
Effective convergence tolerance of a boundary contraction algorithm. Defaults to the `tol`
19+
field; algorithms which keep their tolerance elsewhere (such as boundary MPS algorithms,
20+
where it lives on the wrapped MPS optimization algorithm) must overload this.
21+
"""
22+
_tol(alg::BoundaryAlgorithm) = alg.tol
23+
24+
"""
25+
BoundaryAlgorithm(; alg=:$(Defaults.boundary_alg), kwargs...)
26+
27+
Keyword argument parser returning the appropriate [`BoundaryAlgorithm`](@ref) struct, where
28+
`alg` selects the boundary contraction *family*:
29+
30+
* `:SimultaneousCTMRG`, `:SequentialCTMRG`, `:C4vCTMRG` : dispatch to [`CTMRGAlgorithm`](@ref)
31+
* `:SymmetricBoundaryMPS` : dispatch to [`SymmetricBoundaryMPS`](@ref)
32+
33+
All remaining keyword arguments are forwarded to the corresponding parser. Note that the
34+
underlying MPS optimization algorithm of a boundary MPS contraction is *not* selected here,
35+
but through that parser's own `mps_alg` keyword, since several boundary MPS families can be
36+
driven by the same MPS algorithm.
37+
"""
38+
function BoundaryAlgorithm(; alg = Defaults.boundary_alg, kwargs...)
39+
# CTMRG variants go through their own parser, which handles the projector and
40+
# decomposition keyword arguments
41+
haskey(CTMRG_SYMBOLS, alg) && return CTMRGAlgorithm(; alg, kwargs...)
42+
haskey(BOUNDARY_ALGORITHM_SYMBOLS, alg) ||
43+
throw(ArgumentError("unknown boundary algorithm: $alg"))
44+
return BOUNDARY_ALGORITHM_SYMBOLS[alg](; kwargs...)
45+
end
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#
2+
# Characteristic equation used in implicit differentiation of symmetric boundary MPS
3+
# contractions
4+
#
5+
6+
"""
7+
generate_boundary_mps_characteristic_equation(
8+
env::SymmetricBoundaryMPSEnv, (VLfp, VRfp)::Tuple{<:EdgeTensor, <:RightProjector}
9+
)
10+
11+
Takes the fixed-point values of a converged symmetric boundary MPS contraction, given by the
12+
environment `env`, along with the left null space `VLfp` of its left-gauged MPS tensor and
13+
the right null space `VRfp` of its right-gauged MPS tensor, and generates a function
14+
``F(s, l, r, c, gl, gr)`` which characterizes the convergence of the boundary MPS contraction
15+
in terms of the characteristic equation ``F(s, l, r, c, gl, gr) = 0``.
16+
17+
Here, ``s`` corresponds to a state variable (e.g. an `InfinitePEPS` that is being optimized),
18+
``c``, ``gl`` and ``gr`` directly represent the MPS bond tensor and the left and right
19+
environments, while ``l`` and ``r`` parametrize differentiable left- and
20+
right-gauged MPS tensors as ``AL = AL_{fp} + V_{L,fp} * l`` and
21+
``AR = AR_{fp} + (r * V_{R,fp})``.
22+
23+
``F`` returns a tuple of five tensors, corresponding to an equation for each of ``l``, ``r``,
24+
``c``, ``gl`` and ``gr``. The first three are obtained by projecting the effective site
25+
operator applied to the center-gauged MPS tensor onto the respective tangent directions, and
26+
the last two express that the environments are fixed points of the MPS-network-MPS transfer
27+
matrix. All equations are normalized by the eigenvalue ``λ`` of the effective site operator.
28+
29+
See also [`generate_symmetric_characteristic_equation`](@ref).
30+
"""
31+
function generate_boundary_mps_characteristic_equation(
32+
env::SymmetricBoundaryMPSEnv, (VLfp, VRfp)::Tuple{TE, TP}
33+
) where {TE <: EdgeTensor, TP <: RightProjector}
34+
ALfp, ARfp, Cfp, = _unpack(env)
35+
36+
# constant preconditioner
37+
# NOTE: this relies on the bond tensor having been diagonalized, which
38+
# `leading_boundary` takes care of
39+
iCfp = sdiag_pow(real(DiagonalTensorMap(Cfp)), -1)
40+
41+
function boundary_mps_characteristic_equation(state, l, r, c, gl, gr)
42+
network = InfiniteSquareNetwork(state)
43+
O = network[1, 1]
44+
45+
# prepare appropriately parametrized MPS tensors
46+
AL = ALfp + VLfp * l
47+
AR = ARfp + repartition_left(r * VRfp)
48+
ARR = repartition_right(AR) # 'right isometry' form
49+
50+
# construct the center tensor in a symmetric way
51+
AC = (absorb_right(AL, c) + absorb_left(AR, c)) / 2
52+
53+
# main partial contractions to reuse
54+
AC´L = ∂AC(AC, gl, O, gr) # 'left isometry' form
55+
AC´R = repartition_right(AC´L) # 'right isometry' form
56+
λ = dot(AC, AC´L)
57+
58+
F1 = VLfp' * AC´L * iCfp / λ - l
59+
F2 = iCfp * AC´R * VRfp' / λ - r
60+
F3 = (AL' * AC´L + AC´R * ARR') / (2 * λ) - c
61+
F4 = MPSKit.transfer_left(gl, O, AL, AL) / λ - gl
62+
F5 = MPSKit.transfer_right(gr, O, AR, AR) / λ - gr
63+
64+
return F1, F2, F3, F4, F5
65+
end
66+
67+
return boundary_mps_characteristic_equation
68+
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Observables evaluated using a symmetric boundary MPS environment
3+
#
4+
5+
"""
6+
network_value(network::InfiniteSquareNetwork, env::SymmetricBoundaryMPSEnv)
7+
8+
Return the value (per unit cell) of a contractible network contracted using a symmetric
9+
boundary MPS environment.
10+
"""
11+
function network_value(network::InfiniteSquareNetwork, env::SymmetricBoundaryMPSEnv)
12+
size(network) == (1, 1) ||
13+
throw(ArgumentError("symmetric boundary MPS environments require a single-site unit cell"))
14+
AC = get_AC(env)
15+
AC´ = PEPS_AC_Hamiltonian(env.GL, network[1, 1], env.GR) * AC
16+
return dot(AC, AC´)
17+
end
18+
function network_value(state, env::SymmetricBoundaryMPSEnv)
19+
return network_value(InfiniteSquareNetwork(state), env)
20+
end
21+
22+
function LinearAlgebra.norm(peps::InfinitePEPS, env::SymmetricBoundaryMPSEnv)
23+
return network_value(InfiniteSquareNetwork(peps), env)
24+
end
25+
26+
## Partition function tensor insertions
27+
28+
function contract_local_tensor(
29+
::Union{CartesianIndex{2}, Tuple{Int, Int}}, O::PartitionFunctionTensor,
30+
env::SymmetricBoundaryMPSEnv,
31+
)
32+
# the index is irrelevant here: symmetric boundary MPS environments are single-site
33+
return _contract_site(get_AC(env), env.GL, env.GR, O)
34+
end

0 commit comments

Comments
 (0)