@@ -71,7 +71,7 @@ function local_update!(
7171 site, direction,
7272 ψ, O, alg:: DMRG , envs,
7373 ϵ_global, ϵ_trunc, decay_rate,
74- timeroutput
74+ alg_gauge, timeroutput
7575 )
7676 ϵ_local = calc_galerkin (site, ψ, O, ψ, envs)
7777
@@ -88,7 +88,7 @@ function local_update!(
8888 end
8989
9090 # 3. gauge
91- ψ, ϵ_trunc = @timeit timeroutput " gauge" gauge! (ψ, site, direction , AC′, alg . alg_gauge; normalize = true )
91+ ψ, ϵ_trunc = @timeit timeroutput " gauge" gauge! (site, direction, ψ, O, envs , AC′, alg_gauge; normalize = true )
9292
9393 # 4. bookkeeping: measured contraction factor per matvec, kept a strict contraction in (0, 1)
9494 decay_rate = clamp ((first (info. normres) / ϵ_local)^ (1 / max (1 , info. numops)), 1.0e-3 , 0.999 )
@@ -137,15 +137,15 @@ function DMRG2(;
137137 alg_eigsolve′ = alg_eigsolve isa NamedTuple ?
138138 Defaults. alg_eigsolve (; adaptive = true , alg_eigsolve... ) : alg_eigsolve
139139 # two-site DMRG always truncates the enlarged bond back down, so the gauge is a truncated SVD
140- alg_gauge = MatrixAlgebraKit. TruncatedAlgorithm (alg_svd, trscheme)
140+ alg_gauge = NoExpand ( MatrixAlgebraKit. TruncatedAlgorithm (alg_svd, trscheme) )
141141 return DMRG2 (tol, maxiter, verbosity, alg_eigsolve′, alg_gauge, finalize)
142142end
143143
144144function local_update! (
145145 pos, direction,
146146 ψ, O, alg:: DMRG2 , envs,
147147 ϵ_global, ϵ_trunc, decay_rate,
148- timeroutput
148+ alg_gauge, timeroutput
149149 )
150150 Heff = @timeit timeroutput " AC2_hamiltonian" AC2_hamiltonian (pos, ψ, O, ψ, envs)
151151
@@ -164,7 +164,7 @@ function local_update!(
164164
165165 # 2. gauge: truncated SVD split back into single-site tensors and install;
166166 # the discarded weight is the truncation error
167- ψ, ϵ_trunc = @timeit timeroutput " gauge" gauge2! (ψ, pos, direction , newA2center, alg . alg_gauge; normalize = true )
167+ ψ, ϵ_trunc = @timeit timeroutput " gauge" gauge2! (site, direction, ψ, O, envs , newA2center, alg_gauge; normalize = true )
168168
169169 # 3. bookkeeping: measured contraction factor per matvec, kept a strict contraction in (0, 1)
170170 decay_rate = clamp ((first (info. normres) / ϵ_local)^ (1 / max (1 , info. numops)), 1.0e-3 , 0.999 )
@@ -203,6 +203,7 @@ function find_groundstate!(
203203 LoggingExtras. withlevel (; alg. verbosity) do
204204 @infov 2 loginit! (log, ϵ_global, expectation_value (ψ, H, envs))
205205 for iter in 1 : (alg. maxiter)
206+ alg_gauge = _update_alg_gauge (alg. alg_gauge, iter, ϵ_global)
206207 @timeit timeroutput " sweep" begin
207208 # left-to-right
208209 for pos in fwd
@@ -211,7 +212,7 @@ function find_groundstate!(
211212 pos, Val (:right ),
212213 ψ, H, alg, envs,
213214 ϵ_global, ϵ_truncs[pos], decay_rates[pos],
214- timeroutput
215+ alg_gauge, timeroutput
215216 )
216217 ϵ_global = maximum (ϵ_locals)
217218 end
@@ -223,7 +224,7 @@ function find_groundstate!(
223224 pos, Val (:left ),
224225 ψ, H, alg, envs,
225226 ϵ_global, ϵ_truncs[pos], decay_rates[pos],
226- timeroutput
227+ alg_gauge, timeroutput
227228 )
228229 ϵ_global = maximum (ϵ_locals)
229230 end
0 commit comments