Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions src/algorithms/changebonds/optimalexpand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,35 @@ function changebond!(
# a sweep that already holds one should pass it: this is called once per site
allocator = default_allocator(ψ, SerialScheduler()),
)
bond = site
# two-site update from the projected effective Hamiltonian
AC2 = AC2_projection(site, ψ, H, ψ, envs; alg.backend, allocator)
return expand_from_projection!(site, Val(:right), ψ, AC2, alg; normalize)
end
function changebond!(
site::Int, ::Val{:left}, ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs;
normalize::Bool = true,
# a sweep that already holds one should pass it: this is called once per site
allocator = default_allocator(ψ, SerialScheduler()),
)
# two-site update from the projected effective Hamiltonian
AC2 = AC2_projection(site - 1, ψ, H, ψ, envs; alg.backend, allocator)
return expand_from_projection!(site, Val(:left), ψ, AC2, alg; normalize)
end

"""
expand_from_projection!(site, direction, ψ, AC2, alg::OptimalExpand; normalize = true)

Expand the bond of `site` in `direction` of `ψ` from `AC2`, the projected two-site update of that
bond, as [`changebond!`](@ref) does after forming it.
"""
function expand_from_projection!(
site::Int, ::Val{:right}, ψ::AbstractFiniteMPS, AC2, alg::OptimalExpand; normalize::Bool = true
)
left = ψ.AC[site]
right = ψ.AR[site + 1]
NL = left_null(left)
NR = right_null!(_transpose_tail(right; copy = true))

# two-site update from the projected effective Hamiltonian
AC2 = AC2_projection(bond, ψ, H, ψ, envs; alg.backend, allocator)

# select the dominant directions in the complement of the current state
g2 = adjoint(NL) * AC2 * adjoint(NR)
nrm = norm(g2)
Expand All @@ -155,21 +175,14 @@ function changebond!(
ψ.AC[site + 1] = (nc, nar)
return ψ
end
function changebond!(
site::Int, ::Val{:left}, ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs;
normalize::Bool = true,
# a sweep that already holds one should pass it: this is called once per site
allocator = default_allocator(ψ, SerialScheduler()),
function expand_from_projection!(
site::Int, ::Val{:left}, ψ::AbstractFiniteMPS, AC2, alg::OptimalExpand; normalize::Bool = true
)
bond = site - 1
left = ψ.AL[site - 1]
right = ψ.AC[site]
NL = left_null(left)
NR = right_null!(_transpose_tail(right; copy = true))

# two-site update from the projected effective Hamiltonian
AC2 = AC2_projection(bond, ψ, H, ψ, envs; alg.backend, allocator)

# select the dominant directions in the complement of the current state
g2 = adjoint(NL) * AC2 * adjoint(NR)
nrm = norm(g2)
Expand Down
Loading
Loading