Skip to content

Commit c44c556

Browse files
AFeuerpfeillkdvos
andauthored
Remove explicit call to InfiniteMPS in VUMPS (#396)
* remove explicit call to InfiniteMPS in VUMPS and IDMRG * fix formatting * revert original change and instead use gaugefix! in the gauging step * format * copy mps in VUMPSState to avoid modifying the input mps during the iteration * copy instead of similar in IDMRG * fix vumps * hopefully fix idmrg bug (no copy needed, as mps is copied at the beginning) * hopefully fix idmrg * format * small weird fixes --------- Co-authored-by: lkdvos <ldevos98@gmail.com>
1 parent 4712074 commit c44c556

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/algorithms/groundstate/idmrg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function find_groundstate(mps, operator, alg::alg_type, envs = environments(mps,
102102
end
103103

104104
alg_gauge = updatetol(alg.alg_gauge, it.state.iter, it.state.ϵ)
105-
ψ′ = InfiniteMPS(it.state.mps.AR[1:end]; alg_gauge.tol, alg_gauge.maxiter)
105+
ψ′ = InfiniteMPS(it.state.mps.AR; alg_gauge.tol, alg_gauge.maxiter)
106106
envs = recalculate!(it.state.envs, ψ′, it.state.operator, ψ′)
107107
return ψ′, envs, it.state.ϵ
108108
end

src/algorithms/groundstate/vumps.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function dominant_eigsolve(
5757
)
5858
log = IterLog("VUMPS")
5959
iter = 0
60+
mps = copy(mps)
6061
ϵ = calc_galerkin(mps, operator, mps, envs)
6162
alg_environments = updatetol(alg.alg_environments, iter, ϵ)
6263
recalculate!(envs, mps, operator, mps; alg_environments.tol)
@@ -110,7 +111,7 @@ function localupdate_step!(
110111
mps = state.mps
111112
src_Cs = mps isa Multiline ? eachcol(mps.C) : mps.C
112113
src_ACs = mps isa Multiline ? eachcol(mps.AC) : mps.AC
113-
ACs = similar(mps.AC)
114+
ACs = mps.AL
114115
dst_ACs = mps isa Multiline ? eachcol(ACs) : ACs
115116

116117
tforeach(eachsite(mps), src_ACs, src_Cs; scheduler) do site, AC₀, C₀
@@ -153,7 +154,12 @@ end
153154

154155
function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractVector)
155156
alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ)
156-
return InfiniteMPS(ACs, state.mps.C[end]; alg_gauge.tol, alg_gauge.maxiter)
157+
mps = gaugefix!(
158+
state.mps, ACs, state.mps.C[end];
159+
alg_gauge.tol, alg_gauge.maxiter, order = :R
160+
)
161+
mul!.(mps.AC, mps.AL, mps.C)
162+
return mps
157163
end
158164
function gauge_step!(it::IterativeSolver{<:VUMPS}, state, ACs::AbstractMatrix)
159165
alg_gauge = updatetol(it.alg_gauge, state.iter, state.ϵ)

0 commit comments

Comments
 (0)