Skip to content

Commit

Permalink
Extend CTMRGEnv constructor for nontrivial unit cells (#52)
Browse files Browse the repository at this point in the history
* Fix unit cell indexing in `CTMRGEnv` constructor

* Extend `CTMRGEnv` constructor

* Squash

* Remove deprecated kwarg

* Fix merge conflict

* Docstrings and defaults

* One more merge artifact

* Update src/environments/ctmrgenv.jl

Co-authored-by: Lukas <[email protected]>

---------

Co-authored-by: Lukas <[email protected]>
  • Loading branch information
leburgel and lkdvos authored Jul 12, 2024
1 parent 5cd0304 commit f96746c
Show file tree
Hide file tree
Showing 18 changed files with 417 additions and 80 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ opt_alg = PEPSOptimize(;

# ground state search
state = InfinitePEPS(2, D)
ctm = leading_boundary(CTMRGEnv(state; Venv=ComplexSpace(chi)), state, ctm_alg)
ctm = leading_boundary(CTMRGEnv(state, ComplexSpace(chi)), state, ctm_alg)
result = fixedpoint(state, H, opt_alg, ctm)

@show result.E # -0.6625...
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ opt_alg = PEPSOptimize(;

# ground state search
state = InfinitePEPS(2, D)
ctm = leading_boundary(CTMRGEnv(state; Venv=ComplexSpace(chi)), state, ctm_alg)
ctm = leading_boundary(CTMRGEnv(state, ComplexSpace(chi)), state, ctm_alg)
result = fixedpoint(state, H, opt_alg, ctm)

@show result.E # -0.6625...
Expand Down
4 changes: 2 additions & 2 deletions examples/boundary_mps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mps, envs, ϵ = leading_boundary(mps, T, VUMPS())
N = abs(prod(expectation_value(mps, T)))

# This can be compared to the result obtained using the CTMRG algorithm
ctm = leading_boundary(peps, CTMRG(; verbosity=1), CTMRGEnv(peps; Venv=ComplexSpace(20)))
ctm = leading_boundary(peps, CTMRG(; verbosity=1), CTMRGEnv(peps, ComplexSpace(20)))
= abs(norm(peps, ctm))

@show abs(N - N´) / N
Expand All @@ -53,7 +53,7 @@ mps2 = PEPSKit.initializeMPS(T2, fill(ComplexSpace(20), 2, 2))
mps2, envs2, ϵ = leading_boundary(mps2, T2, VUMPS())
N2 = abs(prod(expectation_value(mps2, T2)))

ctm2 = leading_boundary(peps2, CTMRG(; verbosity=1), CTMRGEnv(peps2; Venv=ComplexSpace(20)))
ctm2 = leading_boundary(peps2, CTMRG(; verbosity=1), CTMRGEnv(peps2, ComplexSpace(20)))
N2´ = abs(norm(peps2, ctm2))

@show abs(N2 - N2´) / N2
Expand Down
2 changes: 1 addition & 1 deletion examples/heisenberg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ opt_alg = PEPSOptimize(;
# E/N = −0.6694421, which is a QMC estimate from https://arxiv.org/abs/1101.3281.
# Of course there is a noticable bias for small χbond and χenv.
ψ₀ = InfinitePEPS(2, χbond)
env₀ = leading_boundary(CTMRGEnv(ψ₀; Venv=^χenv), ψ₀, ctm_alg)
env₀ = leading_boundary(CTMRGEnv(ψ₀, ^χenv), ψ₀, ctm_alg)
result = fixedpoint(ψ₀, H, opt_alg, env₀)
@show result.E
2 changes: 1 addition & 1 deletion src/algorithms/ctmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Contract `state` using CTMRG and return the CTM environment.
Per default, a random initial environment is used.
"""
function MPSKit.leading_boundary(state, alg::CTMRG)
return MPSKit.leading_boundary(CTMRGEnv(state), state, alg)
return MPSKit.leading_boundary(CTMRGEnv(state, oneunit(spacetype(state))), state, alg)
end
function MPSKit.leading_boundary(envinit, state, alg::CTMRG)
normold = 1.0
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/peps_opt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ in `alg`. The initial environment `env₀` serves as an initial guess for the fi
By default, a random initial environment is used.
"""
function fixedpoint(
ψ₀::InfinitePEPS{T}, H, alg::PEPSOptimize, env₀::CTMRGEnv=CTMRGEnv(ψ₀; Venv=field(T)^20)
ψ₀::InfinitePEPS{T}, H, alg::PEPSOptimize, env₀::CTMRGEnv=CTMRGEnv(ψ₀, field(T)^20)
) where {T}
(peps, env), E, ∂E, info = optimize(
(ψ₀, env₀), alg.optimizer; retract=my_retract, inner=my_inner
Expand Down
Loading

0 comments on commit f96746c

Please sign in to comment.