@@ -88,10 +88,11 @@ supplied via the keyword arguments or directly as an [`CTMRGAlgorithm`](@ref) st
8888
8989## Return values
9090
91- The `leading_boundary` routine returns the final environment as well as an information `NamedTuple`
92- that generally contains a `contraction_metrics` `NamedTuple` storing different contents depending
93- on the chosen `alg`. Depending on the contraction method, the information tuple may also contain
94- the final tensor decomposition (used in the projectors) including its truncation indices.
91+ * `env` : The final environment.
92+ * `info` : A `NamedTuple` containing information about the `leading_boundary` convergence, which has the following fields:
93+ - `info.converged::Bool` : Convergence flag indicating whether the contraction converged within `maxiter` and `tol`.
94+ - `info.convergence_error::Real` : The final convergence error at the end of the contraction procedure.
95+ - `info.contraction_metrics::NamedTuple` : A `NamedTuple` containing metrics which characterize the contraction. The precise contents depend on `alg`.
9596"""
9697function leading_boundary (env₀:: CTMRGEnv , network:: InfiniteSquareNetwork ; kwargs... )
9798 alg = select_algorithm (leading_boundary, env₀; kwargs... )
@@ -109,13 +110,15 @@ function leading_boundary(
109110 end
110111 η = one (real (scalartype (network)))
111112 ctmrg_loginit! (log, η, network, env₀)
112- local info
113+ local info_iter
114+ converged = false
113115 for iter in 1 : (alg. maxiter)
114- env, info = ctmrg_iteration (network, env, alg)
116+ env, info_iter = ctmrg_iteration (network, env, alg)
115117 η, CS, TS = calc_convergence (env, CS, TS)
116118
117119 if η ≤ alg. tol && iter ≥ alg. miniter
118120 ctmrg_logfinish! (log, iter, η, network, env)
121+ converged = true
119122 break
120123 end
121124 if iter == alg. maxiter
@@ -124,6 +127,11 @@ function leading_boundary(
124127 ctmrg_logiter! (log, iter, η, network, env)
125128 end
126129 end
130+ info = (;
131+ converged,
132+ convergence_error = η,
133+ contraction_metrics = info_iter. contraction_metrics,
134+ )
127135 return env, info
128136 end
129137end
0 commit comments