From eb0d2e82add0278e69dd5dd8084f131cc469e10e Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Fri, 3 Oct 2025 19:08:24 -0400 Subject: [PATCH 01/16] bump TensorKit compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 89193f81b..6f585726e 100644 --- a/Project.toml +++ b/Project.toml @@ -40,7 +40,7 @@ Plots = "1.40" Printf = "1" Random = "1" RecipesBase = "1.1" -TensorKit = "0.14" +TensorKit = "0.15" TensorKitManifolds = "0.7" TensorOperations = "5" Test = "1" From d1eb1d19da096bcc83d6ac420376b0950700ef23 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Fri, 3 Oct 2025 19:09:50 -0400 Subject: [PATCH 02/16] Bump BlockTensorKit compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 6f585726e..e1b3f170a 100644 --- a/Project.toml +++ b/Project.toml @@ -25,7 +25,7 @@ VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8" [compat] Accessors = "0.1" Aqua = "0.8.9" -BlockTensorKit = "0.2" +BlockTensorKit = "0.3" Combinatorics = "1" Compat = "3.47, 4.10" DocStringExtensions = "0.9.3" From 6d29b342645cc5550bc82f72a3a841f559417163 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Fri, 3 Oct 2025 19:21:22 -0400 Subject: [PATCH 03/16] update utility.jl --- src/utility/utility.jl | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/utility/utility.jl b/src/utility/utility.jl index 1da699fec..40716cec7 100644 --- a/src/utility/utility.jl +++ b/src/utility/utility.jl @@ -22,34 +22,29 @@ _lastspace(t::AbstractTensorMap) = space(t, numind(t)) #given a hamiltonian with unit legs on the side, decompose it using svds to form a "localmpo" function decompose_localmpo( - inpmpo::AbstractTensorMap{T, PS, N, N}, trunc = truncbelow(Defaults.tol) + inpmpo::AbstractTensorMap{T, PS, N, N}, trunc = trunctol(; atol = eps(real(T))^(3 / 4)) ) where {T, PS, N} N == 2 && return [inpmpo] leftind = (N + 1, 1, 2) rightind = (ntuple(x -> x + N + 1, N - 1)..., reverse(ntuple(x -> x + 2, N - 2))...) - U, S, V = tsvd(transpose(inpmpo, (leftind, rightind)); trunc = trunc) + V, C = left_orth!(transpose(inpmpo, (leftind, rightind)); trunc) - A = transpose(U * S, ((2, 3), (1, 4))) - B = transpose( - V, - ((1, reverse(ntuple(x -> x + N, N - 2))...), ntuple(x -> x + 1, N - 1)) - ) + A = transpose(V, ((2, 3), (1, 4))) + B = transpose(C, ((1, reverse(ntuple(x -> x + N, N - 2))...), ntuple(x -> x + 1, N - 1))) return [A; decompose_localmpo(B)] end # given a state with util legs on the side, decompose using svds to form an array of mpstensors function decompose_localmps( - state::AbstractTensorMap{T, PS, N, 1}, trunc = truncbelow(Defaults.tol) + state::AbstractTensorMap{T, PS, N, 1}, trunc = trunctol(; atol = eps(real(T))^(3 / 4)) ) where {T, PS, N} N == 2 && return [state] leftind = (1, 2) rightind = reverse(ntuple(x -> x + 2, N - 1)) - U, S, V = tsvd(transpose(state, (leftind, rightind)); trunc = trunc) - - A = U * S - B = _transpose_front(V) + A, C = left_orth!(transpose(state, (leftind, rightind)); trunc) + B = _transpose_front(C) return [A; decompose_localmps(B)] end From 79618ac1e95586186f91e65de870bc81775f5ed0 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Fri, 3 Oct 2025 19:30:35 -0400 Subject: [PATCH 04/16] Add MatrixAlgebraKit dependency --- Project.toml | 2 ++ src/MPSKit.jl | 1 + 2 files changed, 3 insertions(+) diff --git a/Project.toml b/Project.toml index e1b3f170a..020344d94 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ HalfIntegers = "f0d1745a-41c9-11e9-1dd9-e5d34d218721" KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" +MatrixAlgebraKit = "6c742aac-3347-4629-af66-fc926824e5e4" OhMyThreads = "67456a42-1dca-4109-a031-0a68de7e3ad5" OptimKit = "77e91f04-9b3b-57a6-a776-40b61faaebe0" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" @@ -33,6 +34,7 @@ HalfIntegers = "1.6.0" KrylovKit = "0.8.3, 0.9.2, 0.10" LinearAlgebra = "1.6" LoggingExtras = "~1.0" +MatrixAlgebraKit = "0.5.0" OhMyThreads = "0.7, 0.8" OptimKit = "0.3.1, 0.4" Pkg = "1" diff --git a/src/MPSKit.jl b/src/MPSKit.jl index 51ee82e32..f8f2ef11d 100644 --- a/src/MPSKit.jl +++ b/src/MPSKit.jl @@ -59,6 +59,7 @@ using Compat: @compat # ------- using TensorKit using TensorKit: BraidingTensor +using MatrixAlgebraKit using BlockTensorKit using BlockTensorKit: TensorMapSumSpace using TensorOperations From fed4cf1ea9baf907593f81d1b961dc62b623d1f2 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Fri, 3 Oct 2025 19:40:34 -0400 Subject: [PATCH 05/16] update states rework gauging of InfiniteMPS --- src/states/abstractmps.jl | 8 ++--- src/states/finitemps.jl | 27 ++++++++-------- src/states/ortho.jl | 66 ++++++++++++++++++++++----------------- src/states/orthoview.jl | 8 ++--- src/utility/utility.jl | 28 +++++++++++++++++ test/states.jl | 2 +- 6 files changed, 88 insertions(+), 51 deletions(-) diff --git a/src/states/abstractmps.jl b/src/states/abstractmps.jl index fb405e19a..dd756b2f4 100644 --- a/src/states/abstractmps.jl +++ b/src/states/abstractmps.jl @@ -109,20 +109,20 @@ function isfullrank(A::GenericMPSTensor; side = :both) end """ - makefullrank!(A::PeriodicVector{<:GenericMPSTensor}; alg=QRpos()) + makefullrank!(A::PeriodicVector{<:GenericMPSTensor}; alg=Defalts.alg_qr()) Make the set of MPS tensors full rank by performing a series of orthogonalizations. """ -function makefullrank!(A::PeriodicVector{<:GenericMPSTensor}; alg = QRpos()) +function makefullrank!(A::PeriodicVector{<:GenericMPSTensor}; alg = Defaults.alg_qr()) while true i = findfirst(!isfullrank, A) isnothing(i) && break if !isfullrank(A[i]; side = :left) - L, Q = rightorth!(_transpose_tail(A[i]); alg = alg') + L, Q = _right_orth!(_transpose_tail(A[i]); alg) A[i] = _transpose_front(Q) A[i - 1] = A[i - 1] * L else - A[i], R = leftorth!(A[i]; alg) + A[i], R = _left_orth!(A[i]; alg) A[i + 1] = _transpose_front(R * _transpose_tail(A[i + 1])) end end diff --git a/src/states/finitemps.jl b/src/states/finitemps.jl index cc877603e..9d0fe986a 100644 --- a/src/states/finitemps.jl +++ b/src/states/finitemps.jl @@ -211,15 +211,14 @@ function FiniteMPS(As::Vector{<:GenericMPSTensor}; normalize = false, overwrite # vectors anyways, maybe deprecate `overwrite`. As = overwrite ? As : copy(As) N = length(As) - for i in 1:(N - 1) - As[i], C = leftorth(As[i]; alg = QRpos()) + As[1] = MatrixAlgebraKit.copy_input(qr_compact, As[1]) + local C + for i in eachindex(As) + As[i], C = qr_compact!(As[i]; positive = true) normalize && normalize!(C) - As[i + 1] = _transpose_front(C * _transpose_tail(As[i + 1])) + i == N || (As[i + 1] = _transpose_front(C * _transpose_tail(As[i + 1]))) end - As[end], C = leftorth(As[end]; alg = QRpos()) - normalize && normalize!(C) - A = eltype(As) B = typeof(C) @@ -533,11 +532,11 @@ function Base.:+(ψ₁::MPS, ψ₂::MPS) where {MPS <: FiniteMPS} F₁ = isometry( storagetype(ψ), (_lastspace(ψ₁.AL[1]) ⊕ _lastspace(ψ₂.AL[1]))', _lastspace(ψ₁.AL[1])' ) - F₂ = leftnull(F₁) + F₂ = left_null(F₁) @assert _lastspace(F₂) == _lastspace(ψ₂.AL[1]) AL = ψ₁.AL[1] * F₁' + ψ₂.AL[1] * F₂' - ψ.ALs[1], R = leftorth!(AL) + ψ.ALs[1], R = left_orth!(AL) for i in 2:halfN AL₁ = _transpose_front(F₁ * _transpose_tail(ψ₁.AL[i])) @@ -546,11 +545,11 @@ function Base.:+(ψ₁::MPS, ψ₂::MPS) where {MPS <: FiniteMPS} F₁ = isometry( storagetype(ψ), (_lastspace(AL₁) ⊕ _lastspace(ψ₂.AL[i]))', _lastspace(AL₁)' ) - F₂ = leftnull(F₁) + F₂ = left_null(F₁) @assert _lastspace(F₂) == _lastspace(ψ₂.AL[i]) AL = _transpose_front(R * _transpose_tail(AL₁ * F₁' + AL₂ * F₂')) - ψ.ALs[i], R = leftorth!(AL) + ψ.ALs[i], R = left_orth!(AL) end C₁ = F₁ * ψ₁.C[halfN] @@ -560,11 +559,11 @@ function Base.:+(ψ₁::MPS, ψ₂::MPS) where {MPS <: FiniteMPS} F₁ = isometry( storagetype(ψ), _firstspace(ψ₁.AR[end]) ⊕ _firstspace(ψ₂.AR[end]), _firstspace(ψ₁.AR[end]) ) - F₂ = leftnull(F₁) + F₂ = left_null(F₁) @assert _lastspace(F₂) == _firstspace(ψ₂.AR[end])' AR = F₁ * _transpose_tail(ψ₁.AR[end]) + F₂ * _transpose_tail(ψ₂.AR[end]) - L, AR′ = rightorth!(AR) + L, AR′ = right_orth!(AR) ψ.ARs[end] = _transpose_front(AR′) for i in Iterators.reverse((halfN + 1):(length(ψ) - 1)) @@ -574,11 +573,11 @@ function Base.:+(ψ₁::MPS, ψ₂::MPS) where {MPS <: FiniteMPS} F₁ = isometry( storagetype(ψ), _firstspace(ψ₁.AR[i]) ⊕ _firstspace(AR₂), _firstspace(ψ₁.AR[i]) ) - F₂ = leftnull(F₁) + F₂ = left_null(F₁) @assert _lastspace(F₂) == _firstspace(AR₂)' AR = _transpose_tail(_transpose_front(F₁ * AR₁ + F₂ * AR₂) * L) - L, AR′ = rightorth!(AR) + L, AR′ = right_orth!(AR) ψ.ARs[i] = _transpose_front(AR′) end diff --git a/src/states/ortho.jl b/src/states/ortho.jl index 572a7b8e3..4adb9776d 100644 --- a/src/states/ortho.jl +++ b/src/states/ortho.jl @@ -21,7 +21,7 @@ $(TYPEDFIELDS) verbosity::Int = VERBOSE_WARN "algorithm used for orthogonalization of the tensors" - alg_orth = QRpos() + alg_orth = LAPACK_HouseholderQR(; positive = true) "algorithm used for the eigensolver" alg_eigsolve = _GAUGE_ALG_EIGSOLVE "minimal amount of iterations before using the eigensolver steps" @@ -46,7 +46,7 @@ $(TYPEDFIELDS) verbosity::Int = VERBOSE_WARN "algorithm used for orthogonalization of the tensors" - alg_orth = LQpos() + alg_orth = LAPACK_HouseholderLQ(; positive = true) "algorithm used for the eigensolver" alg_eigsolve = _GAUGE_ALG_EIGSOLVE "minimal amount of iterations before using the eigensolver steps" @@ -73,18 +73,18 @@ end function MixedCanonical(; tol::Real = Defaults.tolgauge, maxiter::Int = Defaults.maxiter, - verbosity::Int = VERBOSE_WARN, alg_orth = QRpos(), + verbosity::Int = VERBOSE_WARN, alg_orth = LAPACK_HouseholderQR(; positive = true), alg_eigsolve = _GAUGE_ALG_EIGSOLVE, eig_miniter::Int = 10, order::Symbol = :LR ) - if alg_orth isa QR || alg_orth isa QRpos + if alg_orth isa LAPACK_HouseholderQR alg_leftorth = alg_orth - alg_rightorth = alg_orth' - elseif alg_orth isa LQ || alg_orth isa LQpos - alg_leftorth = alg_orth' + alg_rightorth = LAPACK_HouseholderLQ(; alg_orth.kwargs...) + elseif alg_orth isa LAPACK_HouseholderLQ + alg_leftorth = LAPACK_HouseholderQR(; alg_orth.kwargs...) alg_rightorth = alg_orth else - throw(ArgumentError("Invalid orthogonalization algorithm: $(typeof(alg_orth))")) + alg_leftorth = alg_rightorth = alg_orth end left = LeftCanonical(; @@ -145,45 +145,54 @@ function gaugefix!(ψ::InfiniteMPS, A, C₀, alg::RightCanonical) end @doc """ - regauge!(AC::GenericMPSTensor, C::MPSBondTensor; alg=QRpos()) -> AL - regauge!(CL::MPSBondTensor, AC::GenericMPSTensor; alg=LQpos()) -> AR + regauge!(AC::GenericMPSTensor, C::MPSBondTensor; alg) -> AL + regauge!(CL::MPSBondTensor, AC::GenericMPSTensor; alg) -> AR Bring updated `AC` and `C` tensors back into a consistent set of left or right canonical -tensors. This minimizes `∥AC_i - AL_i * C_i∥` or `∥AC_i - C_{i-1} * AR_i∥`. The optimal algorithm uses -`Polar()` decompositions, but `QR`-based algorithms are typically more performant. +tensors. This minimizes `∥AC_i - AL_i * C_i∥` or `∥AC_i - C_{i-1} * AR_i∥`. + +The `alg` is passed on to [`left_orth!`](@extref MatrixAlgebraKit) and +[`right_orth!`](@extref MatrixAlgebraKit), and can be used to control the kind of +factorization used. By default, this is set to a (positive) QR/LQ, even though the +optimal algorithm would use a polar decompositions instead, sacrificing a bit of +performance for accuracy. !!! note Computing `AL` is slightly faster than `AR`, as it avoids an intermediate transposition. """ regauge! -function regauge!(AC::GenericMPSTensor, C::MPSBondTensor; alg = QRpos()) - Q_AC, _ = leftorth!(AC; alg) - Q_C, _ = leftorth!(C; alg) +function regauge!( + AC::GenericMPSTensor, C::MPSBondTensor; alg = Defaults.alg_qr() + ) + Q_AC, _ = _left_orth!(AC; alg) + Q_C, _ = _left_orth!(C; alg) return mul!(AC, Q_AC, Q_C') end -function regauge!(AC::Vector{<:GenericMPSTensor}, C::Vector{<:MPSBondTensor}; alg = QRpos()) +function regauge!(AC::Vector{<:GenericMPSTensor}, C::Vector{<:MPSBondTensor}; kwargs...) for i in 1:length(AC) - regauge!(AC[i], C[i]; alg) + regauge!(AC[i], C[i]; kwargs...) end return AC end -function regauge!(CL::MPSBondTensor, AC::GenericMPSTensor; alg = LQpos()) +function regauge!( + CL::MPSBondTensor, AC::GenericMPSTensor; alg = Defaults.alg_lq() + ) AC_tail = _transpose_tail(AC) - _, Q_AC = rightorth!(AC_tail; alg) - _, Q_C = rightorth!(CL; alg) + _, Q_AC = _right_orth!(AC_tail; alg) + _, Q_C = _right_orth!(CL; alg) AR_tail = mul!(AC_tail, Q_C', Q_AC) return repartition!(AC, AR_tail) end -function regauge!(CL::Vector{<:MPSBondTensor}, AC::Vector{<:GenericMPSTensor}; alg = LQpos()) +function regauge!(CL::Vector{<:MPSBondTensor}, AC::Vector{<:GenericMPSTensor}; kwargs...) for i in length(CL):-1:1 - regauge!(CL[i], AC[i]; alg) + regauge!(CL[i], AC[i]; kwargs...) end return CL end # fix ambiguity + error -regauge!(::MPSBondTensor, ::MPSBondTensor; alg = QRpos()) = error("method ambiguity") -function regauge!(::Vector{<:MPSBondTensor}, ::Vector{<:MPSBondTensor}; alg = QRpos()) +regauge!(::MPSBondTensor, ::MPSBondTensor; kwargs...) = error("method ambiguity") +function regauge!(::Vector{<:MPSBondTensor}, ::Vector{<:MPSBondTensor}; kwargs...) return error("method ambiguity") end @@ -232,7 +241,7 @@ function gauge_eigsolve_step!(it::IterativeSolver{LeftCanonical}, state) if iter ≥ it.eig_miniter alg_eigsolve = updatetol(it.alg_eigsolve, 1, ϵ^2) _, vec = fixedpoint(flip(TransferMatrix(A, AL)), C[end], :LM, alg_eigsolve) - _, C[end] = leftorth!(vec; alg = it.alg_orth) + _, C[end] = _left_orth!(vec; alg = it.alg_orth) end return C[end] end @@ -240,9 +249,10 @@ end function gauge_orth_step!(it::IterativeSolver{LeftCanonical}, state) (; AL, C, A_tail, CA_tail) = state for i in 1:length(AL) + # repartition!(A_tail[i], AL[i]) mul!(CA_tail[i], C[i - 1], A_tail[i]) repartition!(AL[i], CA_tail[i]) - AL[i], C[i] = leftorth!(AL[i]; alg = it.alg_orth) + AL[i], C[i] = _left_orth!(AL[i]; alg = it.alg_orth) end normalize!(C[end]) return C[end] @@ -289,7 +299,7 @@ function gauge_eigsolve_step!(it::IterativeSolver{RightCanonical}, state) if iter ≥ it.eig_miniter alg_eigsolve = updatetol(it.alg_eigsolve, 1, ϵ^2) _, vec = fixedpoint(TransferMatrix(A, AR), C[end], :LM, alg_eigsolve) - C[end], _ = rightorth!(vec; alg = it.alg_orth) + C[end], _ = _right_orth!(vec; alg = it.alg_orth) end return C[end] end @@ -299,7 +309,7 @@ function gauge_orth_step!(it::IterativeSolver{RightCanonical}, state) for i in length(AR):-1:1 AC = mul!(AR[i], A[i], C[i]) # use AR as temporary storage for A * C tmp = repartition!(AC_tail[i], AC) - C[i - 1], tmp = rightorth!(tmp; alg = it.alg_orth) + C[i - 1], tmp = _right_orth!(tmp; alg = it.alg_orth) repartition!(AR[i], tmp) # TODO: avoid doing this every iteration end normalize!(C[end]) diff --git a/src/states/orthoview.jl b/src/states/orthoview.jl index fd810e95d..3fc99bc2e 100644 --- a/src/states/orthoview.jl +++ b/src/states/orthoview.jl @@ -60,7 +60,7 @@ function Base.getindex(v::CView{<:FiniteMPS, E}, i::Int)::E where {E} end for j in Iterators.reverse((i + 1):center) - v.parent.Cs[j], tmp = rightorth(_transpose_tail(v.parent.ACs[j]); alg = LQpos()) + v.parent.Cs[j], tmp = lq_compact!(_transpose_tail(v.parent.ACs[j]); positive = true) v.parent.ARs[j] = _transpose_front(tmp) if j != i + 1 # last AC not needed v.parent.ACs[j - 1] = _mul_tail(v.parent.ALs[j - 1], v.parent.Cs[j]) @@ -76,7 +76,7 @@ function Base.getindex(v::CView{<:FiniteMPS, E}, i::Int)::E where {E} end for j in center:i - v.parent.ALs[j], v.parent.Cs[j + 1] = leftorth(v.parent.ACs[j]; alg = QRpos()) + v.parent.ALs[j], v.parent.Cs[j + 1] = qr_compact(v.parent.ACs[j]; positive = true) if j != i # last AC not needed v.parent.ACs[j + 1] = _mul_front(v.parent.Cs[j + 1], v.parent.ARs[j + 1]) end @@ -89,10 +89,10 @@ end function Base.setindex!(v::CView{<:FiniteMPS}, vec, i::Int) if ismissing(v.parent.Cs[i + 1]) if !ismissing(v.parent.ALs[i]) - v.parent.Cs[i + 1], temp = rightorth(_transpose_tail(v.parent.AC[i + 1]); alg = LQpos()) + v.parent.Cs[i + 1], temp = lq_compact!(_transpose_tail(v.parent.AC[i + 1]); positive = true) v.parent.ARs[i + 1] = _transpose_front(temp) else - v.parent.ALs[i], v.parent.Cs[i + 1] = leftorth(v.parent.AC[i]; alg = QRpos()) + v.parent.ALs[i], v.parent.Cs[i + 1] = qr_compact(v.parent.AC[i]; positive = true) end end diff --git a/src/utility/utility.jl b/src/utility/utility.jl index 40716cec7..a8fec396b 100644 --- a/src/utility/utility.jl +++ b/src/utility/utility.jl @@ -149,3 +149,31 @@ function check_unambiguous_braiding(V::VectorSpace) return check_unambiguous_braiding(Bool, V) || throw(ArgumentError("cannot unambiguously braid $V")) end + +# temporary workaround for the fact that left_orth and right_orth are poorly designed: +function _left_orth!(t; alg::MatrixAlgebraKit.AbstractAlgorithm) + if alg isa LAPACK_HouseholderQR + return left_orth!(t; kind = :qr, alg_qr = alg) + elseif alg isa LAPACK_HouseholderLQ + return left_orth!(t; kind = :qr, alg_qr = LAPACK_HouseholderQR(; alg.kwargs...)) + elseif alg isa PolarViaSVD + return left_orth!(t; kind = :polar, alg_polar = alg) + elseif alg isa LAPACK_SVDAlgorithm + return left_orth!(t; kind = :svd, alg_svd = alg) + else + error(lazy"unkown algorithm $alg") + end +end +function _right_orth!(t; alg::MatrixAlgebraKit.AbstractAlgorithm) + if alg isa LAPACK_HouseholderLQ + return right_orth!(t; kind = :lq, alg_lq = alg) + elseif alg isa LAPACK_HouseholderQr + return right_orth!(t; kind = :lq, alg_lq = LAPACK_HouseholderLQ(; alg.kwargs...)) + elseif alg isa PolarViaSVD + return right_orth!(t; kind = :polar, alg_polar = alg) + elseif alg isa LAPACK_SVDAlgorithm + return right_orth!(t; kind = :svd, alg_svd = alg) + else + error(lazy"unkown algorithm $alg") + end +end diff --git a/test/states.jl b/test/states.jl index e641c0b99..04990ea50 100644 --- a/test/states.jl +++ b/test/states.jl @@ -207,7 +207,7 @@ module TestStates @test real(e2) ≤ real(e1) - window, envs = timestep(window, ham, 0.1, 0.0, TDVP2(; trscheme = truncdim(20)), envs) + window, envs = timestep(window, ham, 0.1, 0.0, TDVP2(; trscheme = truncrank(20)), envs) window, envs = timestep(window, ham, 0.1, 0.0, TDVP(), envs) e3 = expectation_value(window, (2, 3) => O) From 3b931dccf0df44ad59c116678592606e8205f6d1 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Sat, 4 Oct 2025 20:47:58 -0400 Subject: [PATCH 06/16] update operators --- src/operators/mpo.jl | 26 +++++++++++----------- src/operators/mpohamiltonian.jl | 20 ++++++++--------- src/operators/ortho.jl | 38 ++++++--------------------------- test/operators.jl | 4 ++-- 4 files changed, 32 insertions(+), 56 deletions(-) diff --git a/src/operators/mpo.jl b/src/operators/mpo.jl index 3fb28fa29..ae16181fd 100644 --- a/src/operators/mpo.jl +++ b/src/operators/mpo.jl @@ -126,14 +126,14 @@ function Base.:+(mpo1::FiniteMPO{<:MPOTensor}, mpo2::FiniteMPO{<:MPOTensor}) A, (right_virtualspace(mpo1, 1) ⊕ right_virtualspace(mpo2, 1)), right_virtualspace(mpo1, 1) ) - F₂ = leftnull(F₁) + F₂ = left_null(F₁) @assert _lastspace(F₂) == right_virtualspace(mpo2, 1)' @plansor O[-3 -1 -2; -4] := mpo1[1][-1 -2; -3 1] * conj(F₁[-4; 1]) + mpo2[1][-1 -2; -3 1] * conj(F₂[-4; 1]) # making sure that the new operator is "full rank" - O, R = leftorth!(O) + O, R = qr_compact!(O) O′ = transpose(O, ((2, 3), (1, 4))) mpo = similar(mpo1, typeof(O′)) mpo[1] = O′ @@ -148,13 +148,13 @@ function Base.:+(mpo1::FiniteMPO{<:MPOTensor}, mpo2::FiniteMPO{<:MPOTensor}) A, (right_virtualspace(mpo1, i) ⊕ right_virtualspace(mpo2, i)), right_virtualspace(mpo1, i) ) - F₂ = leftnull(F₁) + F₂ = left_null(F₁) @assert _lastspace(F₂) == right_virtualspace(mpo2, i)' @plansor O[-3 -1 -2; -4] := O₁[-1 -2; -3 1] * conj(F₁[-4; 1]) + O₂[-1 -2; -3 1] * conj(F₂[-4; 1]) # making sure that the new operator is "full rank" - O, R = leftorth!(O) + O, R = qr_compact!(O) mpo[i] = transpose(O, ((2, 3), (1, 4))) end @@ -165,14 +165,14 @@ function Base.:+(mpo1::FiniteMPO{<:MPOTensor}, mpo2::FiniteMPO{<:MPOTensor}) A, left_virtualspace(mpo1, N) ⊕ left_virtualspace(mpo2, N), left_virtualspace(mpo1, N) ) - F₂ = leftnull(F₁) + F₂ = left_null(F₁) @assert _lastspace(F₂) == left_virtualspace(mpo2, N)' @plansor O[-1; -3 -4 -2] := F₁[-1; 1] * mpo1[N][1 -2; -3 -4] + F₂[-1; 1] * mpo2[N][1 -2; -3 -4] # making sure that the new operator is "full rank" - L, O = rightorth!(O) + L, O = lq_compact!(O) mpo[end] = transpose(O, ((1, 4), (2, 3))) for i in (N - 1):-1:(halfN + 1) @@ -185,13 +185,13 @@ function Base.:+(mpo1::FiniteMPO{<:MPOTensor}, mpo2::FiniteMPO{<:MPOTensor}) A, left_virtualspace(mpo1, i) ⊕ left_virtualspace(mpo2, i), left_virtualspace(mpo1, i) ) - F₂ = leftnull(F₁) + F₂ = left_null(F₁) @assert _lastspace(F₂) == left_virtualspace(mpo2, i)' @plansor O[-1; -3 -4 -2] := F₁[-1; 1] * O₁[1 -2; -3 -4] + F₂[-1; 1] * O₂[1 -2; -3 -4] # making sure that the new operator is "full rank" - L, O = rightorth!(O) + L, O = lq_compact!(O) mpo[i] = transpose(O, ((1, 4), (2, 3))) end @@ -247,7 +247,7 @@ function Base.:*(mpo::FiniteMPO, mps::FiniteMPS) Fᵣ = fuser(A, right_virtualspace(mps, i), right_virtualspace(mpo, i)) return _fuse_mpo_mps(mpo[i], A1, Fₗ, Fᵣ) end - trscheme = truncbelow(eps(real(T))) + trscheme = trunctol(; atol = eps(real(T))) return changebonds!(FiniteMPS(A2), SvdCut(; trscheme); normalize = false) end function Base.:*(mpo::InfiniteMPO, mps::InfiniteMPS) @@ -392,8 +392,8 @@ function Base.isapprox( end @doc """ - swap(mpo::FiniteMPO, i::Integer; inv::Bool=false, alg=SDD(), trscheme) - swap!(mpo::FiniteMPO, i::Integer; inv::Bool=false, alg=SDD(), trscheme) + swap(mpo::FiniteMPO, i::Integer; inv::Bool=false, alg=Defaults.alg_svd(), trscheme) + swap!(mpo::FiniteMPO, i::Integer; inv::Bool=false, alg=Defaults.alg_svd(), trscheme) Compose the mpo with a swap gate applied to indices `i` and `i + 1`, effectively creating an operator that acts on the Hilbert spaces with those factors swapped. @@ -405,7 +405,7 @@ swap(mpo::FiniteMPO, i::Integer; kwargs...) = swap!(copy(mpo), i; kwargs...) function swap!( mpo::FiniteMPO{<:MPOTensor}, i::Integer; inv::Bool = false, - alg = SDD(), trscheme = truncbelow(eps(real(scalartype(mpo)))^(4 / 5)) + alg = Defaults.alg_svd(), trscheme = trunctol(; atol = eps(real(scalartype(mpo)))^(4 / 5)) ) O₁, O₂ = mpo[i], mpo[i + 1] @@ -417,7 +417,7 @@ function swap!( τ[-3 -6; 4 5] * O₁[-2 4; 2 1] * O₂[1 5; 3 -5] * τ'[2 3; -1 -4] end - U, S, Vᴴ, = tsvd!(O₂₁; alg, trunc = trscheme) + U, S, Vᴴ = svd_trunc!(O₂₁; alg, trunc = trscheme) sqrtS = sqrt(S) @plansor mpo[i][-1 -2; -3 -4] := U[-3 -1 -2; 1] * sqrtS[1; -4] @plansor mpo[i + 1][-1 -2; -3 -4] := sqrtS[-1; 1] * Vᴴ[1; -3 -4 -2] diff --git a/src/operators/mpohamiltonian.jl b/src/operators/mpohamiltonian.jl index 3e04ed5fe..79664095c 100644 --- a/src/operators/mpohamiltonian.jl +++ b/src/operators/mpohamiltonian.jl @@ -791,31 +791,31 @@ function Base.:*(H::FiniteMPOHamiltonian, mps::FiniteMPS) # left to middle U = ones(scalartype(H), left_virtualspace(H, 1)) @plansor a[-1 -2; -3 -4] := A[1][-1 2; -3] * H[1][1 -2; 2 -4] * conj(U[1]) - Q, R = leftorth!(a; alg = QR()) - A′[1] = convert(TensorMap, Q) + Q, R = qr_compact!(a) + A′[1] = TensorMap(Q) for i in 2:(N ÷ 2) @plansor a[-1 -2; -3 -4] := R[-1; 1 2] * A[i][1 3; -3] * H[i][2 -2; 3 -4] - Q, R = leftorth!(a; alg = QR()) - A′[i] = convert(TensorMap, Q) + Q, R = qr_compact!(a) + A′[i] = TensorMap(Q) end # right to middle U = ones(scalartype(H), right_virtualspace(H, N)) @plansor a[-1 -2; -3 -4] := A[end][-1 2; -3] * H[end][-2 -4; 2 1] * U[1] - L, Q = rightorth!(a; alg = LQ()) - A′[end] = transpose(convert(TensorMap, Q), ((1, 3), (2,))) + L, Q = lq_compact!(a) + A′[end] = transpose(TensorMap(Q), ((1, 3), (2,))) for i in (N - 1):-1:(N ÷ 2 + 2) @plansor a[-1 -2; -3 -4] := A[i][-1 3; 1] * H[i][-2 -4; 3 2] * L[1 2; -3] - L, Q = rightorth!(a; alg = LQ()) - A′[i] = transpose(convert(TensorMap, Q), ((1, 3), (2,))) + L, Q = lq_compact!(a) + A′[i] = transpose(TensorMap(Q), ((1, 3), (2,))) end # connect pieces @plansor a[-1 -2; -3] := R[-1; 1 2] * A[N ÷ 2 + 1][1 3; 4] * H[N ÷ 2 + 1][2 -2; 3 5] * L[4 5; -3] - A′[N ÷ 2 + 1] = convert(TensorMap, a) + A′[N ÷ 2 + 1] = TensorMap(a) return FiniteMPS(A′) end @@ -826,7 +826,7 @@ function Base.:*(H::FiniteMPOHamiltonian{<:MPOTensor}, x::AbstractTensorMap) L = removeunit(H[1], 1) M = Tuple(H[2:(end - 1)]) R = removeunit(H[end], 4) - return convert(TensorMap, _apply_finitempo(x, L, M, R)) + return TensorMap(_apply_finitempo(x, L, M, R)) end function TensorKit.dot(H₁::FiniteMPOHamiltonian, H₂::FiniteMPOHamiltonian) diff --git a/src/operators/ortho.jl b/src/operators/ortho.jl index 1b7ecb924..5b003d021 100644 --- a/src/operators/ortho.jl +++ b/src/operators/ortho.jl @@ -1,6 +1,6 @@ function left_canonicalize!( H::FiniteMPOHamiltonian, i::Int; - alg = QRpos(), trscheme::TruncationScheme = notrunc() + alg = Defaults.alg_qr(), trscheme::TruncationStrategy = notrunc() ) 1 ≤ i < length(H) || throw(ArgumentError("Bounds error in canonicalize")) @@ -19,14 +19,7 @@ function left_canonicalize!( # QR of second column if size(W, 1) == 1 tmp = transpose(C′, ((2, 1), (3,))) - - if trscheme == notrunc() - Q, R = leftorth!(tmp; alg) - else - @assert alg == SVD() || alg == SDD() - Q, Σ, Vᴴ = tsvd!(tmp; alg, trunc = trscheme) - R = Σ * Vᴴ - end + Q, R = _left_orth!(tmp; alg, trunc = trscheme) if dim(R) == 0 # fully truncated V = BlockTensorKit.oplus(oneunit(S), oneunit(S)) @@ -42,13 +35,8 @@ function left_canonicalize!( H[i] = JordanMPOTensor(codomain(W) ← physicalspace(W) ⊗ V, Q1, W.B, Q2, W.D) else tmp = transpose(cat(insertleftunit(C′, 1), W.A; dims = 1), ((3, 1, 2), (4,))) - if trscheme == notrunc() - Q, R = leftorth!(tmp; alg) - else - @assert alg == SVD() || alg == SDD() - Q, Σ, Vᴴ = tsvd!(tmp; alg, trunc = trscheme) - R = Σ * Vᴴ - end + Q, R = _left_orth!(tmp; alg, trunc = trscheme) + if dim(R) == 0 # fully truncated V = BlockTensorKit.oplus(oneunit(S), oneunit(S)) Q1 = typeof(W.A)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) @@ -98,7 +86,7 @@ end function right_canonicalize!( H::FiniteMPOHamiltonian, i::Int; - alg = LQpos(), trscheme::TruncationScheme = notrunc() + alg = Defaults.alg_lq(), trscheme::TruncationStrategy = notrunc() ) 1 < i ≤ length(H) || throw(ArgumentError("Bounds error in canonicalize")) @@ -117,13 +105,7 @@ function right_canonicalize!( # LQ of second row if size(W, 4) == 1 tmp = transpose(B′, ((1,), (3, 2))) - if trscheme == notrunc() - R, Q = rightorth!(tmp; alg) - else - @assert alg == SVD() || alg == SDD() - U, Σ, Q = tsvd!(tmp; alg, trunc = trscheme) - R = U * Σ - end + R, Q = _right_orth!(tmp; alg, trunc = trscheme) if dim(R) == 0 V = BlockTensorKit.oplus(oneunit(S), oneunit(S)) @@ -139,13 +121,7 @@ function right_canonicalize!( H[i] = JordanMPOTensor(V ⊗ physicalspace(W) ← domain(W), Q1, Q2, W.C, W.D) else tmp = transpose(cat(insertleftunit(B′, 4), W.A; dims = 4), ((1,), (3, 4, 2))) - if trscheme == notrunc() - R, Q = rightorth!(tmp; alg) - else - @assert alg == SVD() || alg == SDD() - U, Σ, Q = tsvd!(tmp; alg, trunc = trscheme) - R = U * Σ - end + R, Q = _right_orth!(tmp; alg, trunc = trscheme) if dim(R) == 0 V = BlockTensorKit.oplus(oneunit(S), oneunit(S)) Q1 = typeof(W.A)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) diff --git a/test/operators.jl b/test/operators.jl index 2b8bb7f7c..03fadeea4 100644 --- a/test/operators.jl +++ b/test/operators.jl @@ -180,7 +180,7 @@ module TestOperators FiniteMPOHamiltonian(lattice, 3 => O₁) @test 0.8 * H1 + 0.2 * H1 ≈ H1 atol = 1.0e-6 @test convert(TensorMap, H1 + H2) ≈ convert(TensorMap, H1) + convert(TensorMap, H2) atol = 1.0e-6 - H1_trunc = changebonds(H1, SvdCut(; trscheme = truncdim(0))) + H1_trunc = changebonds(H1, SvdCut(; trscheme = truncrank(0))) @test H1_trunc ≈ H1 @test all(left_virtualspace(H1_trunc) .== left_virtualspace(H1)) @@ -212,7 +212,7 @@ module TestOperators FiniteMPOHamiltonian(grid, vertical_operators) + FiniteMPOHamiltonian(grid, horizontal_operators) atol = 1.0e-4 - H5 = changebonds(H4 / 3 + 2H4 / 3, SvdCut(; trscheme = truncbelow(1.0e-12))) + H5 = changebonds(H4 / 3 + 2H4 / 3, SvdCut(; trscheme = trunctol(; atol = 1.0e-12))) psi = FiniteMPS(physicalspace(H5), V ⊕ oneunit(V)) @test expectation_value(psi, H4) ≈ expectation_value(psi, H5) end From 2e05e6caed9fae3277ca9c6ec753d25947a1f1a4 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Sun, 5 Oct 2025 18:03:17 -0400 Subject: [PATCH 07/16] update algorithms --- src/algorithms/approximate/fvomps.jl | 2 +- src/algorithms/approximate/idmrg.jl | 4 ++-- src/algorithms/approximate/vomps.jl | 4 ++-- src/algorithms/changebonds/optimalexpand.jl | 26 ++++++++++----------- src/algorithms/changebonds/randexpand.jl | 24 +++++++++---------- src/algorithms/changebonds/svdcut.jl | 23 +++++++++--------- src/algorithms/changebonds/vumpssvd.jl | 12 ++++------ src/algorithms/excitation/chepigaansatz.jl | 2 +- src/algorithms/grassmann.jl | 2 +- src/algorithms/groundstate/dmrg.jl | 14 +++++------ src/algorithms/groundstate/idmrg.jl | 12 +++++----- src/algorithms/groundstate/vumps.jl | 5 ++-- src/algorithms/statmech/idmrg.jl | 8 +++---- src/algorithms/statmech/vomps.jl | 4 ++-- src/algorithms/timestep/tdvp.jl | 10 ++++---- test/algorithms.jl | 10 ++++---- 16 files changed, 80 insertions(+), 82 deletions(-) diff --git a/src/algorithms/approximate/fvomps.jl b/src/algorithms/approximate/fvomps.jl index 7f62c817c..0ac30a047 100644 --- a/src/algorithms/approximate/fvomps.jl +++ b/src/algorithms/approximate/fvomps.jl @@ -8,7 +8,7 @@ function approximate!(ψ::AbstractFiniteMPS, Oϕ, alg::DMRG2, envs = environment ϵ = 0.0 for pos in [1:(length(ψ) - 1); (length(ψ) - 2):-1:1] AC2′ = AC2_projection(pos, ψ, Oϕ, envs) - al, c, ar, = tsvd!(AC2′; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(AC2′; trunc = alg.trscheme, alg = alg.alg_svd) AC2 = ψ.AC[pos] * _transpose_tail(ψ.AR[pos + 1]) ϵ = max(ϵ, norm(al * c * ar - AC2) / norm(AC2)) diff --git a/src/algorithms/approximate/idmrg.jl b/src/algorithms/approximate/idmrg.jl index a08f618dd..b7e4922a8 100644 --- a/src/algorithms/approximate/idmrg.jl +++ b/src/algorithms/approximate/idmrg.jl @@ -82,7 +82,7 @@ function approximate!( CartesianIndex(row, site), ψ, toapprox, envs; kind = :ACAR ) - al, c, ar, = tsvd!(AC2′; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(AC2′; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[row + 1, site] = al @@ -104,7 +104,7 @@ function approximate!( CartesianIndex(row, site), ψ, toapprox, envs; kind = :ALAC ) - al, c, ar, = tsvd!(AC2′; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(AC2′; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[row + 1, site] = al diff --git a/src/algorithms/approximate/vomps.jl b/src/algorithms/approximate/vomps.jl index 7011bbe3e..224d77486 100644 --- a/src/algorithms/approximate/vomps.jl +++ b/src/algorithms/approximate/vomps.jl @@ -65,7 +65,7 @@ end function localupdate_step!( ::IterativeSolver{<:VOMPS}, state::VOMPSState{<:Any, <:Tuple}, ::SerialScheduler ) - alg_orth = QRpos() + alg_orth = Defaults.alg_qr() ACs = similar(state.mps.AC) dst_ACs = state.mps isa Multiline ? eachcol(ACs) : ACs @@ -88,7 +88,7 @@ end function localupdate_step!( ::IterativeSolver{<:VOMPS}, state::VOMPSState{<:Any, <:Tuple}, scheduler ) - alg_orth = QRpos() + alg_orth = Defaults.alg_qr() ACs = similar(state.mps.AC) dst_ACs = state.mps isa Multiline ? eachcol(ACs) : ACs diff --git a/src/algorithms/changebonds/optimalexpand.jl b/src/algorithms/changebonds/optimalexpand.jl index 3631c481c..ddee28bbd 100644 --- a/src/algorithms/changebonds/optimalexpand.jl +++ b/src/algorithms/changebonds/optimalexpand.jl @@ -14,7 +14,7 @@ $(TYPEDFIELDS) alg_svd::S = Defaults.alg_svd() "algorithm used for truncating the expanded space" - trscheme::TruncationScheme + trscheme::TruncationStrategy end function changebonds( @@ -30,13 +30,13 @@ function changebonds( AC2 = AC2_hamiltonian(i, ψ, H, ψ, envs) * AC2 # Use the nullspaces and SVD decomposition to determine the optimal expansion space - VL = leftnull(ψ.AL[i]) - VR = rightnull!(_transpose_tail(ψ.AR[i + 1])) + VL = left_null(ψ.AL[i]) + VR = right_null!(_transpose_tail(ψ.AR[i + 1])) intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR)) - U, _, V, = tsvd!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) + U, _, Vᴴ = svd_trunc!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) AL′[i] = VL * U - AR′[i + 1] = V * VR + AR′[i + 1] = Vᴴ * VR end newψ = _expand(ψ, AL′, AR′) @@ -56,13 +56,13 @@ function changebonds(ψ::MultilineMPS, H, alg::OptimalExpand, envs = environment AC2 = AC2_hamiltonian(CartesianIndex(i - 1, j), ψ, H, ψ, envs) * AC2 # Use the nullspaces and SVD decomposition to determine the optimal expansion space - VL = leftnull(ψ.AL[i, j]) - VR = rightnull!(_transpose_tail(ψ.AR[i, j + 1])) + VL = left_null(ψ.AL[i, j]) + VR = right_null!(_transpose_tail(ψ.AR[i, j + 1])) intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR)) - U, _, V, = tsvd!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) + U, _, Vᴴ = svd_trunc!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) AL′[i, j] = VL * U - AR′[i, j + 1] = V * VR + AR′[i, j + 1] = Vᴴ * VR end newψ = _expand(ψ, AL′, AR′) @@ -85,17 +85,17 @@ function changebonds!(ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs = envir AC2 = AC2_hamiltonian(i, ψ, H, ψ, envs) * AC2 #Calculate nullspaces for left and right - NL = leftnull(ψ.AC[i]) - NR = rightnull!(_transpose_tail(ψ.AR[i + 1])) + NL = left_null(ψ.AC[i]) + NR = right_null!(_transpose_tail(ψ.AR[i + 1])) #Use this nullspaces and SVD decomposition to determine the optimal expansion space intermediate = normalize!(adjoint(NL) * AC2 * adjoint(NR)) - _, _, V, = tsvd!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) + _, _, V, = svd_trunc!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) ar_re = V * NR ar_le = zerovector!(similar(ar_re, codomain(ψ.AC[i]) ← space(V, 1))) - nal, nc = leftorth!(catdomain(ψ.AC[i], ar_le); alg = QRpos()) + nal, nc = qr_compact!(catdomain(ψ.AC[i], ar_le)) nar = _transpose_front(catcodomain(_transpose_tail(ψ.AR[i + 1]), ar_re)) ψ.AC[i] = (nal, nc) diff --git a/src/algorithms/changebonds/randexpand.jl b/src/algorithms/changebonds/randexpand.jl index c933519f5..28e87b3d6 100644 --- a/src/algorithms/changebonds/randexpand.jl +++ b/src/algorithms/changebonds/randexpand.jl @@ -13,8 +13,8 @@ $(TYPEDFIELDS) "algorithm used for the singular value decomposition" alg_svd::S = Defaults.alg_svd() - "algorithm used for [truncation](@extref TensorKit.tsvd] the expanded space" - trscheme::TruncationScheme + "algorithm used for [truncation](@extref MatrixAlgebraKit.TruncationStrategy] the expanded space" + trscheme::TruncationStrategy end function changebonds(ψ::InfiniteMPS, alg::RandExpand) @@ -26,13 +26,13 @@ function changebonds(ψ::InfiniteMPS, alg::RandExpand) AC2 = randomize!(_transpose_front(ψ.AC[i]) * _transpose_tail(ψ.AR[i + 1])) # Use the nullspaces and SVD decomposition to determine the optimal expansion space - VL = leftnull(ψ.AL[i]) - VR = rightnull!(_transpose_tail(ψ.AR[i + 1])) + VL = left_null(ψ.AL[i]) + VR = right_null!(_transpose_tail(ψ.AR[i + 1])) intermediate = normalize!(adjoint(VL) * AC2 * adjoint(VR)) - U, _, V, = tsvd!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) + U, _, Vᴴ = svd_trunc!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) AL′[i] = VL * U - AR′[i + 1] = V * VR + AR′[i + 1] = Vᴴ * VR end return _expand(ψ, AL′, AR′) @@ -48,17 +48,17 @@ function changebonds!(ψ::AbstractFiniteMPS, alg::RandExpand) AC2 = randomize!(_transpose_front(ψ.AC[i]) * _transpose_tail(ψ.AR[i + 1])) #Calculate nullspaces for left and right - NL = leftnull(ψ.AC[i]) - NR = rightnull!(_transpose_tail(ψ.AR[i + 1])) + NL = left_null(ψ.AC[i]) + NR = right_null!(_transpose_tail(ψ.AR[i + 1])) #Use this nullspaces and SVD decomposition to determine the optimal expansion space intermediate = normalize!(adjoint(NL) * AC2 * adjoint(NR)) - _, _, V, = tsvd!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) + _, _, Vᴴ = svd_trunc!(intermediate; trunc = alg.trscheme, alg = alg.alg_svd) - ar_re = V * NR - ar_le = zerovector!(similar(ar_re, codomain(ψ.AC[i]) ← space(V, 1))) + ar_re = Vᴴ * NR + ar_le = zerovector!(similar(ar_re, codomain(ψ.AC[i]) ← space(Vᴴ, 1))) - (nal, nc) = leftorth!(catdomain(ψ.AC[i], ar_le); alg = QRpos()) + nal, nc = qr_compact!(catdomain(ψ.AC[i], ar_le)) nar = _transpose_front(catcodomain(_transpose_tail(ψ.AR[i + 1]), ar_re)) ψ.AC[i] = (nal, nc) diff --git a/src/algorithms/changebonds/svdcut.jl b/src/algorithms/changebonds/svdcut.jl index 095e260f6..1324cecb0 100644 --- a/src/algorithms/changebonds/svdcut.jl +++ b/src/algorithms/changebonds/svdcut.jl @@ -18,8 +18,8 @@ $(TYPEDFIELDS) "algorithm used for the singular value decomposition" alg_svd::S = Defaults.alg_svd() - "algorithm used for [truncation][@extref TensorKit.tsvd] of the gauge tensors" - trscheme::TruncationScheme + "algorithm used for [truncation][@extref MatrixAlgebraKit.TruncationStrategy] of the gauge tensors" + trscheme::TruncationStrategy end function changebonds(ψ::AbstractFiniteMPS, alg::SvdCut; kwargs...) @@ -27,10 +27,10 @@ function changebonds(ψ::AbstractFiniteMPS, alg::SvdCut; kwargs...) end function changebonds!(ψ::AbstractFiniteMPS, alg::SvdCut; normalize::Bool = true) for i in (length(ψ) - 1):-1:1 - U, S, V, = tsvd(ψ.C[i]; trunc = alg.trscheme, alg = alg.alg_svd) + U, S, Vᴴ = svd_trunc(ψ.C[i]; trunc = alg.trscheme, alg = alg.alg_svd) AL′ = ψ.AL[i] * U ψ.AC[i] = (AL′, S) - AR′ = _transpose_front(V * _transpose_tail(ψ.AR[i + 1])) + AR′ = _transpose_front(Vᴴ * _transpose_tail(ψ.AR[i + 1])) ψ.AC[i + 1] = (S, AR′) end return normalize ? normalize!(ψ) : ψ @@ -51,24 +51,23 @@ function changebonds!(mpo::FiniteMPO, alg::SvdCut) O_left = transpose(mpo[1], ((3, 1, 2), (4,))) local O_right for i in 2:length(mpo) - U, S, V, = tsvd!(O_left; trunc = alg.trscheme, alg = alg.alg_svd) + U, S, Vᴴ = svd_trunc!(O_left; trunc = alg.trscheme, alg = alg.alg_svd) @inbounds mpo[i - 1] = transpose(U, ((2, 3), (1, 4))) if i < length(mpo) - @plansor O_left[-3 -1 -2; -4] := S[-1; 1] * V[1; 2] * mpo[i][2 -2; -3 -4] + @plansor O_left[-3 -1 -2; -4] := S[-1; 1] * Vᴴ[1; 2] * mpo[i][2 -2; -3 -4] else - @plansor O_right[-1; -3 -4 -2] := S[-1; 1] * V[1; 2] * mpo[end][2 -2; -3 -4] + @plansor O_right[-1; -3 -4 -2] := S[-1; 1] * Vᴴ[1; 2] * mpo[end][2 -2; -3 -4] end end # right to left for i in (length(mpo) - 1):-1:1 - U, S, V, = tsvd!(O_right; trunc = alg.trscheme, alg = alg.alg_svd) - @inbounds mpo[i + 1] = transpose(V, ((1, 4), (2, 3))) + U, S, Vᴴ = svd_trunc!(O_right; trunc = alg.trscheme, alg = alg.alg_svd) + @inbounds mpo[i + 1] = transpose(Vᴴ, ((1, 4), (2, 3))) if i > 1 @plansor O_right[-1; -3 -4 -2] := mpo[i][-1 -2; -3 2] * U[2; 1] * S[1; -4] else - @plansor _O[-1 -2; -3 -4] := mpo[1][-1 -2; -3 2] * U[2; 1] * - S[1; -4] + @plansor _O[-1 -2; -3 -4] := mpo[1][-1 -2; -3 2] * U[2; 1] * S[1; -4] @inbounds mpo[1] = _O end end @@ -91,7 +90,7 @@ function changebonds(ψ::InfiniteMPS, alg::SvdCut) ncr = ψ.C[1] for i in 1:length(ψ) - U, ncr, = tsvd(ψ.C[i]; trunc = alg.trscheme, alg = alg.alg_svd) + U, ncr, = svd_trunc(ψ.C[i]; trunc = alg.trscheme, alg = alg.alg_svd) copied[i] = copied[i] * U copied[i + 1] = _transpose_front(U' * _transpose_tail(copied[i + 1])) end diff --git a/src/algorithms/changebonds/vumpssvd.jl b/src/algorithms/changebonds/vumpssvd.jl index 697915978..2a5968eca 100644 --- a/src/algorithms/changebonds/vumpssvd.jl +++ b/src/algorithms/changebonds/vumpssvd.jl @@ -17,8 +17,8 @@ $(TYPEDFIELDS) "algorithm used for the singular value decomposition" alg_svd = Defaults.alg_svd() - "algorithm used for [truncation][@extref TensorKit.tsvd] of the two-site update" - trscheme::TruncationScheme + "algorithm used for [truncation][@extref MatrixAlgebraKit.TruncationStrategy] of the two-site update" + trscheme::TruncationStrategy end function changebonds_1( @@ -50,7 +50,6 @@ function changebonds_1( end function changebonds_n(state::InfiniteMPS, H, alg::VUMPSSvdCut, envs = environments(state, H)) - meps = 0.0 for loc in 1:length(state) @plansor AC2[-1 -2; -3 -4] := state.AC[loc][-1 -2; 1] * state.AR[loc + 1][1 -4; -3] @@ -61,13 +60,12 @@ function changebonds_n(state::InfiniteMPS, H, alg::VUMPSSvdCut, envs = environme _, nC2 = fixedpoint(Hc, state.C[loc + 1], :SR, alg.alg_eigsolve) #svd ac2, get new AL1 and S,V ---> AC - AL1, S, V, eps = tsvd!(nAC2; trunc = alg.trscheme, alg = alg.alg_svd) + AL1, S, V = svd_trunc!(nAC2; trunc = alg.trscheme, alg = alg.alg_svd) @plansor AC[-1 -2; -3] := S[-1; 1] * V[1; -3 -2] - meps = max(eps, meps) #find AL2 from AC and C as in vumps paper - QAC, _ = leftorth(AC; alg = QRpos()) - QC, _ = leftorth(nC2; alg = QRpos()) + QAC, _ = qr_compact(AC) + QC, _ = qr_compact(nC2; positive = true) dom_map = isometry(domain(QC), domain(QAC)) @plansor AL2[-1 -2; -3] := QAC[-1 -2; 1] * conj(dom_map[2; 1]) * conj(QC[-3; 2]) diff --git a/src/algorithms/excitation/chepigaansatz.jl b/src/algorithms/excitation/chepigaansatz.jl index 63f5efb6d..e92a618be 100644 --- a/src/algorithms/excitation/chepigaansatz.jl +++ b/src/algorithms/excitation/chepigaansatz.jl @@ -121,7 +121,7 @@ function excitations( # map back to finitemps ψs = map(AC2s) do ac ψ′ = copy(ψ) - AL, C, AR, = tsvd!(ac; trunc = alg.trscheme) + AL, C, AR = svd_trunc!(ac; trunc = alg.trscheme) normalize!(C) ψ′.AC[pos] = (AL, complex(C)) ψ′.AC[pos + 1] = (complex(C), _transpose_front(AR)) diff --git a/src/algorithms/grassmann.jl b/src/algorithms/grassmann.jl index 7dadfcf88..58b548c06 100644 --- a/src/algorithms/grassmann.jl +++ b/src/algorithms/grassmann.jl @@ -216,7 +216,7 @@ Here we use the Tikhonov regularization, i.e. `inv(ρ) = inv(C * C' + δ²1)`, where the regularization parameter is `δ = rtol * norm(C)`. """ function rho_inv_regularized(C; rtol = eps(real(scalartype(C)))^(3 / 4)) - U, S, _ = tsvd(C) + U, S, _ = svd_compact(C) return U * pinv_tikhonov!!(S; rtol) * U' end diff --git a/src/algorithms/groundstate/dmrg.jl b/src/algorithms/groundstate/dmrg.jl index abb253bfa..bbca5157d 100644 --- a/src/algorithms/groundstate/dmrg.jl +++ b/src/algorithms/groundstate/dmrg.jl @@ -92,8 +92,8 @@ struct DMRG2{A, S, F} <: Algorithm "algorithm used for the singular value decomposition" alg_svd::S - "algorithm used for [truncation](@extref TensorKit.tsvd) of the two-site update" - trscheme::TruncationScheme + "algorithm used for [truncation](@extref MatrixAlgebraKit.TruncationStrategy) of the two-site update" + trscheme::TruncationStrategy "callback function applied after each iteration, of signature `finalize(iter, ψ, H, envs) -> ψ, envs`" finalize::F @@ -125,10 +125,9 @@ function find_groundstate!(ψ::AbstractFiniteMPS, H, alg::DMRG2, envs = environm Hac2 = AC2_hamiltonian(pos, ψ, H, ψ, envs) _, newA2center = fixedpoint(Hac2, ac2, :SR, alg_eigsolve) - al, c, ar, = tsvd!(newA2center; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(newA2center; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) - v = @plansor ac2[1 2; 3 4] * conj(al[1 2; 5]) * conj(c[5; 6]) * - conj(ar[6; 3 4]) + v = @plansor ac2[1 2; 3 4] * conj(al[1 2; 5]) * conj(c[5; 6]) * conj(ar[6; 3 4]) ϵs[pos] = max(ϵs[pos], abs(1 - abs(v))) ψ.AC[pos] = (al, complex(c)) @@ -141,10 +140,9 @@ function find_groundstate!(ψ::AbstractFiniteMPS, H, alg::DMRG2, envs = environm Hac2 = AC2_hamiltonian(pos, ψ, H, ψ, envs) _, newA2center = fixedpoint(Hac2, ac2, :SR, alg_eigsolve) - al, c, ar, = tsvd!(newA2center; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(newA2center; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) - v = @plansor ac2[1 2; 3 4] * conj(al[1 2; 5]) * conj(c[5; 6]) * - conj(ar[6; 3 4]) + v = @plansor ac2[1 2; 3 4] * conj(al[1 2; 5]) * conj(c[5; 6]) * conj(ar[6; 3 4]) ϵs[pos] = max(ϵs[pos], abs(1 - abs(v))) ψ.AC[pos + 1] = (complex(c), _transpose_front(ar)) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index 413d408cd..b10a95b7e 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -127,8 +127,8 @@ $(TYPEDFIELDS) "algorithm used for the singular value decomposition" alg_svd::S = Defaults.alg_svd() - "algorithm used for [truncation](@extref TensorKit.tsvd) of the two-site update" - trscheme::TruncationScheme + "algorithm used for [truncation](@extref MatrixAlgebraKit.TruncationStrategy) of the two-site update" + trscheme::TruncationStrategy end function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs = environments(ost, H)) @@ -151,7 +151,7 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs = environments( h_ac2 = AC2_hamiltonian(pos, ψ, H, ψ, envs) _, ac2′ = fixedpoint(h_ac2, ac2, :SR, alg_eigsolve) - al, c, ar, = tsvd!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[pos] = al @@ -170,7 +170,7 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs = environments( h_ac2 = AC2_hamiltonian(0, ψ, H, ψ, envs) _, ac2′ = fixedpoint(h_ac2, ac2, :SR, alg_eigsolve) - al, c, ar, = tsvd!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[end] = al @@ -193,7 +193,7 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs = environments( h_ac2 = AC2_hamiltonian(pos, ψ, H, ψ, envs) _, ac2′ = fixedpoint(h_ac2, ac2, :SR, alg_eigsolve) - al, c, ar, = tsvd!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[pos] = al @@ -212,7 +212,7 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG2, envs = environments( ac2 = AC2(ψ, 0; kind = :ACAR) h_ac2 = AC2_hamiltonian(0, ψ, H, ψ, envs) _, ac2′ = fixedpoint(h_ac2, ac2, :SR, alg_eigsolve) - al, c, ar, = tsvd!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[end] = al diff --git a/src/algorithms/groundstate/vumps.jl b/src/algorithms/groundstate/vumps.jl index 59edde95b..99da8234c 100644 --- a/src/algorithms/groundstate/vumps.jl +++ b/src/algorithms/groundstate/vumps.jl @@ -105,7 +105,7 @@ function localupdate_step!( it::IterativeSolver{<:VUMPS}, state, scheduler = Defaults.scheduler[] ) alg_eigsolve = updatetol(it.alg_eigsolve, state.iter, state.ϵ) - alg_orth = QRpos() + alg_orth = Defaults.alg_qr() mps = state.mps src_Cs = mps isa Multiline ? eachcol(mps.C) : mps.C @@ -126,7 +126,8 @@ end function _localupdate_vumps_step!( site, mps, operator, envs, AC₀, C₀; - parallel::Bool = false, alg_orth = QRpos(), alg_eigsolve = Defaults.eigsolver, which + parallel::Bool = false, alg_orth = Defaults.alg_qr(), + alg_eigsolve = Defaults.eigsolver, which ) if !parallel Hac = AC_hamiltonian(site, mps, operator, mps, envs) diff --git a/src/algorithms/statmech/idmrg.jl b/src/algorithms/statmech/idmrg.jl index 372373a30..5aa7b0b74 100644 --- a/src/algorithms/statmech/idmrg.jl +++ b/src/algorithms/statmech/idmrg.jl @@ -82,7 +82,7 @@ function leading_boundary( _, ac2′ = fixedpoint(h, ac2, :LM, alg_eigsolve) for row in 1:size(ψ, 1) - al, c, ar, = tsvd!(ac2′[row]; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(ac2′[row]; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[row + 1, site] = al @@ -106,7 +106,7 @@ function leading_boundary( _, ac2′ = fixedpoint(h, ac2, :LM, alg_eigsolve) for row in 1:size(ψ, 1) - al, c, ar, = tsvd!(ac2′[row]; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(ac2′[row]; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[row + 1, site] = al @@ -131,7 +131,7 @@ function leading_boundary( _, ac2′ = fixedpoint(h, ac2, :LM, alg_eigsolve) for row in 1:size(ψ, 1) - al, c, ar, = tsvd!(ac2′[row]; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(ac2′[row]; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[row + 1, site] = al @@ -153,7 +153,7 @@ function leading_boundary( _, ac2′ = fixedpoint(h, ac2, :LM, alg_eigsolve) for row in 1:size(ψ, 1) - al, c, ar, = tsvd!(ac2′[row]; trunc = alg.trscheme, alg = alg.alg_svd) + al, c, ar = svd_trunc!(ac2′[row]; trunc = alg.trscheme, alg = alg.alg_svd) normalize!(c) ψ.AL[row + 1, end] = al diff --git a/src/algorithms/statmech/vomps.jl b/src/algorithms/statmech/vomps.jl index b259fe19d..8849d74da 100644 --- a/src/algorithms/statmech/vomps.jl +++ b/src/algorithms/statmech/vomps.jl @@ -102,7 +102,7 @@ end function localupdate_step!( ::IterativeSolver{<:VOMPS}, state, scheduler = Defaults.scheduler[] ) - alg_orth = QRpos() + alg_orth = Defaults.alg_qr() mps = state.mps src_Cs = mps isa Multiline ? eachcol(mps.C) : mps.C src_ACs = mps isa Multiline ? eachcol(mps.AC) : mps.AC @@ -121,7 +121,7 @@ function localupdate_step!( end function _localupdate_vomps_step!( - site, mps, operator, envs, AC₀, C₀; parallel::Bool = false, alg_orth = QRpos() + site, mps, operator, envs, AC₀, C₀; parallel::Bool = false, alg_orth = Defaults.alg_qr() ) if !parallel AC = AC_hamiltonian(site, mps, operator, mps, envs) * AC₀ diff --git a/src/algorithms/timestep/tdvp.jl b/src/algorithms/timestep/tdvp.jl index e372c4fbd..2d67f90a1 100644 --- a/src/algorithms/timestep/tdvp.jl +++ b/src/algorithms/timestep/tdvp.jl @@ -72,11 +72,11 @@ function timestep( end if leftorthflag - regauge!.(temp_ACs, temp_Cs; alg = TensorKit.QRpos()) + regauge!.(temp_ACs, temp_Cs) ψ′ = InfiniteMPS(temp_ACs, ψ.C[end]; tol = alg.tolgauge, maxiter = alg.gaugemaxiter) else circshift!(temp_Cs, 1) - regauge!.(temp_Cs, temp_ACs; alg = TensorKit.LQpos()) + regauge!.(temp_Cs, temp_ACs) ψ′ = InfiniteMPS(ψ.C[0], temp_ACs; tol = alg.tolgauge, maxiter = alg.gaugemaxiter) end @@ -158,7 +158,7 @@ $(TYPEDFIELDS) alg_svd::S = Defaults.alg_svd() "algorithm used for truncation of the two-site update" - trscheme::TruncationScheme + trscheme::TruncationStrategy "callback function applied after each iteration, of signature `finalize(iter, ψ, H, envs) -> ψ, envs`" finalize::F = Defaults._finalize @@ -176,7 +176,7 @@ function timestep!( Hac2 = AC2_hamiltonian(i, ψ, H, ψ, envs) ac2′ = integrate(Hac2, ac2, t, dt / 2, alg.integrator; imaginary_evolution) - nal, nc, nar = tsvd!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) + nal, nc, nar = svd_trunc!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) ψ.AC[i] = (nal, complex(nc)) ψ.AC[i + 1] = (complex(nc), _transpose_front(nar)) @@ -195,7 +195,7 @@ function timestep!( Hac2 = AC2_hamiltonian(i - 1, ψ, H, ψ, envs) ac2′ = integrate(Hac2, ac2, t + dt / 2, dt / 2, alg.integrator; imaginary_evolution) - nal, nc, nar = tsvd!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) + nal, nc, nar = svd_trunc!(ac2′; trunc = alg.trscheme, alg = alg.alg_svd) ψ.AC[i - 1] = (nal, complex(nc)) ψ.AC[i] = (complex(nc), _transpose_front(nar)) diff --git a/test/algorithms.jl b/test/algorithms.jl index 1589b586d..030517b4b 100644 --- a/test/algorithms.jl +++ b/test/algorithms.jl @@ -40,7 +40,8 @@ module TestAlgorithms # test using low variance @test sum(δ) ≈ 0 atol = 1.0e-3 - @test v < v₀ && v < 1.0e-2 + @test v < v₀ + @test v < 1.0e-2 end @testset "DMRG2" begin @@ -59,7 +60,8 @@ module TestAlgorithms # test using low variance @test sum(δ) ≈ 0 atol = 1.0e-3 - @test v < v₀ && v < 1.0e-2 + @test v < v₀ + @test v < 1.0e-2 end @testset "GradientGrassmann" begin @@ -1045,7 +1047,7 @@ module TestAlgorithms H = XY_model(U1Irrep; L) H_dense = convert(TensorMap, H) - vals_dense = eigvals(H_dense) + vals_dense = TensorKit.SectorDict(c => sort(v; by = real) for (c, v) in eigvals(H_dense)) tol = 1.0e-18 # tolerance required to separate degenerate eigenvalues alg = MPSKit.Defaults.alg_eigsolve(; dynamic_tols = false, tol) @@ -1080,7 +1082,7 @@ module TestAlgorithms # so effectively shifting the charges by -1 H_shift = MPSKit.add_physical_charge(H, U1Irrep.([1, 0, 0, 0])) H_shift_dense = convert(TensorMap, H_shift) - vals_shift_dense = eigvals(H_shift_dense) + vals_shift_dense = TensorKit.SectorDict(c => sort(v; by = real) for (c, v) in eigvals(H_shift_dense)) for (sector, vals) in vals_dense sector′ = only(sector ⊗ U1Irrep(-1)) @test vals ≈ vals_shift_dense[sector′] From 48458ba492bc395dfe2a9ca630a5bdeb314f423e Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Sun, 5 Oct 2025 18:03:25 -0400 Subject: [PATCH 08/16] update quasiparticles --- src/states/quasiparticle_state.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/states/quasiparticle_state.jl b/src/states/quasiparticle_state.jl index cf476f914..200c70237 100644 --- a/src/states/quasiparticle_state.jl +++ b/src/states/quasiparticle_state.jl @@ -39,7 +39,7 @@ function LeftGaugedQP( ) # find the left null spaces for the TNS excitation_space = Vect[typeof(sector)](sector => 1) - VLs = convert(Vector, map(leftnull, left_gs.AL)) + VLs = convert(Vector, map(left_null, left_gs.AL)) Xs = map(enumerate(VLs)) do (loc, vl) x = similar( vl, @@ -73,7 +73,7 @@ function RightGaugedQP( ) # find the left null spaces for the TNS excitation_space = Vect[typeof(sector)](sector => 1) - VRs = convert(Vector, map(rightnull! ∘ _transpose_tail, right_gs.AR)) + VRs = convert(Vector, map(right_null! ∘ _transpose_tail, right_gs.AR)) Xs = map(enumerate(VRs)) do (i, vr) x = similar( vr, @@ -309,7 +309,7 @@ function Base.convert(::Type{<:FiniteMPS}, v::QP{S}) where {S <: FiniteMPS} ou = oneunit(utl) utsp = ou ⊕ ou upper = isometry(storagetype(site_type(v.left_gs)), utsp, ou) - lower = leftnull(upper) + lower = left_null(upper) upper_I = upper * upper' lower_I = lower * lower' uplow_I = upper * lower' From ce2d7ed0082f1454b50a9ae3a45c3ece05186938 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Sun, 5 Oct 2025 18:03:43 -0400 Subject: [PATCH 09/16] add utility and defaults --- src/MPSKit.jl | 1 + src/utility/defaults.jl | 5 ++++- src/utility/utility.jl | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/MPSKit.jl b/src/MPSKit.jl index f8f2ef11d..a6c586144 100644 --- a/src/MPSKit.jl +++ b/src/MPSKit.jl @@ -60,6 +60,7 @@ using Compat: @compat using TensorKit using TensorKit: BraidingTensor using MatrixAlgebraKit +using MatrixAlgebraKit: TruncationStrategy, PolarViaSVD, LAPACK_SVDAlgorithm using BlockTensorKit using BlockTensorKit: TensorMapSumSpace using TensorOperations diff --git a/src/utility/defaults.jl b/src/utility/defaults.jl index b99f2e63f..ba1c5aeec 100644 --- a/src/utility/defaults.jl +++ b/src/utility/defaults.jl @@ -9,6 +9,7 @@ import KrylovKit: GMRES, Arnoldi, Lanczos using OhMyThreads using ..MPSKit: DynamicTol using TensorKit: TensorKit +using MatrixAlgebraKit: LAPACK_HouseholderQR, LAPACK_HouseholderLQ, LAPACK_DivideAndConquer const VERBOSE_NONE = 0 const VERBOSE_WARN = 1 @@ -56,7 +57,9 @@ function alg_eigsolve(; return dynamic_tols ? DynamicTol(alg, tol_min, tol_max, tol_factor) : alg end -alg_svd() = TensorKit.SDD() +alg_svd() = LAPACK_DivideAndConquer() +alg_qr() = LAPACK_HouseholderQR(; positive = true) +alg_lq() = LAPACK_HouseholderLQ(; positive = true) # TODO: make verbosity and maxiter actually do something function alg_environments(; diff --git a/src/utility/utility.jl b/src/utility/utility.jl index a8fec396b..2817c1fb6 100644 --- a/src/utility/utility.jl +++ b/src/utility/utility.jl @@ -76,13 +76,13 @@ function _embedders(spaces) totalspace = reduce(⊕, spaces) maps = [isometry(totalspace, first(spaces))] - restmap = leftnull(first(maps)) + restmap = left_null(first(maps)) for sp in spaces[2:end] cm = isometry(domain(restmap), sp) push!(maps, restmap * cm) - restmap = restmap * leftnull(cm) + restmap = restmap * left_null(cm) end return maps @@ -151,28 +151,28 @@ function check_unambiguous_braiding(V::VectorSpace) end # temporary workaround for the fact that left_orth and right_orth are poorly designed: -function _left_orth!(t; alg::MatrixAlgebraKit.AbstractAlgorithm) +function _left_orth!(t; alg::MatrixAlgebraKit.AbstractAlgorithm, trunc::MatrixAlgebraKit.TruncationStrategy = notrunc()) if alg isa LAPACK_HouseholderQR - return left_orth!(t; kind = :qr, alg_qr = alg) + return left_orth!(t; kind = :qr, alg_qr = alg, trunc) elseif alg isa LAPACK_HouseholderLQ - return left_orth!(t; kind = :qr, alg_qr = LAPACK_HouseholderQR(; alg.kwargs...)) + return left_orth!(t; kind = :qr, alg_qr = LAPACK_HouseholderQR(; alg.kwargs...), trunc) elseif alg isa PolarViaSVD - return left_orth!(t; kind = :polar, alg_polar = alg) + return left_orth!(t; kind = :polar, alg_polar = alg, trunc) elseif alg isa LAPACK_SVDAlgorithm - return left_orth!(t; kind = :svd, alg_svd = alg) + return left_orth!(t; kind = :svd, alg_svd = alg, trunc) else error(lazy"unkown algorithm $alg") end end -function _right_orth!(t; alg::MatrixAlgebraKit.AbstractAlgorithm) +function _right_orth!(t; alg::MatrixAlgebraKit.AbstractAlgorithm, trunc::TruncationStrategy = notrunc()) if alg isa LAPACK_HouseholderLQ - return right_orth!(t; kind = :lq, alg_lq = alg) - elseif alg isa LAPACK_HouseholderQr - return right_orth!(t; kind = :lq, alg_lq = LAPACK_HouseholderLQ(; alg.kwargs...)) + return right_orth!(t; kind = :lq, alg_lq = alg, trunc) + elseif alg isa LAPACK_HouseholderQR + return right_orth!(t; kind = :lq, alg_lq = LAPACK_HouseholderLQ(; alg.kwargs...), trunc) elseif alg isa PolarViaSVD - return right_orth!(t; kind = :polar, alg_polar = alg) + return right_orth!(t; kind = :polar, alg_polar = alg, trunc) elseif alg isa LAPACK_SVDAlgorithm - return right_orth!(t; kind = :svd, alg_svd = alg) + return right_orth!(t; kind = :svd, alg_svd = alg, trunc) else error(lazy"unkown algorithm $alg") end From b3db14792f27eb0c3cca9610a91a6ea461d0d4af Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Wed, 8 Oct 2025 18:11:59 -0400 Subject: [PATCH 10/16] change oplus to boxplus --- src/algorithms/timestep/taylorcluster.jl | 4 ++-- src/algorithms/timestep/wii.jl | 4 ++-- src/operators/mpohamiltonian.jl | 8 ++++---- src/operators/ortho.jl | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/algorithms/timestep/taylorcluster.jl b/src/algorithms/timestep/taylorcluster.jl index d9cd70247..dd3c3be9c 100644 --- a/src/algorithms/timestep/taylorcluster.jl +++ b/src/algorithms/timestep/taylorcluster.jl @@ -186,14 +186,14 @@ function make_time_mpo( H′ = copy(parent(H)) V_left = left_virtualspace(H[1]) - V_left′ = BlockTensorKit.oplus(V_left, oneunit(V_left), oneunit(V_left)) + V_left′ = ⊞(V_left, oneunit(V_left), oneunit(V_left)) H′[1] = similar(H[1], V_left′ ⊗ space(H[1], 2) ← domain(H[1])) for (I, v) in nonzero_pairs(H[1]) H′[1][I] = v end V_right = right_virtualspace(H[end]) - V_right′ = BlockTensorKit.oplus(oneunit(V_right), oneunit(V_right), V_right) + V_right′ = ⊞(oneunit(V_right), oneunit(V_right), V_right) H′[end] = similar(H[end], codomain(H[end]) ← space(H[end], 3)' ⊗ V_right′) for (I, v) in nonzero_pairs(H[end]) H′[end][I[1], 1, 1, end] = v diff --git a/src/algorithms/timestep/wii.jl b/src/algorithms/timestep/wii.jl index 3cf65cad6..7b2fe2169 100644 --- a/src/algorithms/timestep/wii.jl +++ b/src/algorithms/timestep/wii.jl @@ -94,14 +94,14 @@ function make_time_mpo( H′ = copy(parent(H)) V_left = left_virtualspace(H[1]) - V_left′ = BlockTensorKit.oplus(V_left, oneunit(V_left), oneunit(V_left)) + V_left′ = ⊞(V_left, oneunit(V_left), oneunit(V_left)) H′[1] = similar(H[1], V_left′ ⊗ space(H[1], 2) ← domain(H[1])) for (I, v) in nonzero_pairs(H[1]) H′[1][I] = v end V_right = right_virtualspace(H[end]) - V_right′ = BlockTensorKit.oplus(oneunit(V_right), oneunit(V_right), V_right) + V_right′ = ⊞(oneunit(V_right), oneunit(V_right), V_right) H′[end] = similar(H[end], codomain(H[end]) ← space(H[end], 3)' ⊗ V_right′) for (I, v) in nonzero_pairs(H[end]) H′[end][I[1], 1, 1, end] = v diff --git a/src/operators/mpohamiltonian.jl b/src/operators/mpohamiltonian.jl index 79664095c..97f938609 100644 --- a/src/operators/mpohamiltonian.jl +++ b/src/operators/mpohamiltonian.jl @@ -689,9 +689,9 @@ function Base.:+( D = H₁[i].D + H₂[i].D Vleft = i == 1 ? left_virtualspace(H₁, 1) : - BlockTensorKit.oplus(Vtriv, left_virtualspace(A), Vtriv) + ⊞(Vtriv, left_virtualspace(A), Vtriv) Vright = i == N ? right_virtualspace(H₁, N) : - BlockTensorKit.oplus(Vtriv, right_virtualspace(A), Vtriv) + ⊞(Vtriv, right_virtualspace(A), Vtriv) V = Vleft ⊗ physicalspace(A) ← physicalspace(A) ⊗ Vright H[i] = eltype(H)(V, A, B, C, D) @@ -711,8 +711,8 @@ function Base.:+( C = cat(H₁[i].C, H₂[i].C; dims = 3) D = H₁[i].D + H₂[i].D - Vleft = BlockTensorKit.oplus(Vtriv, left_virtualspace(A), Vtriv) - Vright = BlockTensorKit.oplus(Vtriv, right_virtualspace(A), Vtriv) + Vleft = ⊞(Vtriv, left_virtualspace(A), Vtriv) + Vright = ⊞(Vtriv, right_virtualspace(A), Vtriv) V = Vleft ⊗ physicalspace(A) ← physicalspace(A) ⊗ Vright H[i] = eltype(H)(V, A, B, C, D) diff --git a/src/operators/ortho.jl b/src/operators/ortho.jl index 5b003d021..d4f0f607f 100644 --- a/src/operators/ortho.jl +++ b/src/operators/ortho.jl @@ -22,11 +22,11 @@ function left_canonicalize!( Q, R = _left_orth!(tmp; alg, trunc = trscheme) if dim(R) == 0 # fully truncated - V = BlockTensorKit.oplus(oneunit(S), oneunit(S)) + V = oneunit(S) ⊞ oneunit(S) Q1 = typeof(W.A)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) Q2 = typeof(W.C)(undef, physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) else - V = BlockTensorKit.oplus(oneunit(S), space(R, 1), oneunit(S)) + V = ⊞(oneunit(S), space(R, 1), oneunit(S)) scale!(Q, d) scale!(R, inv(d)) Q1 = typeof(W.A)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W) ⊗ space(R, 1)) @@ -38,7 +38,7 @@ function left_canonicalize!( Q, R = _left_orth!(tmp; alg, trunc = trscheme) if dim(R) == 0 # fully truncated - V = BlockTensorKit.oplus(oneunit(S), oneunit(S)) + V = oneunit(S) ⊞ oneunit(S) Q1 = typeof(W.A)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) Q2 = typeof(W.C)(undef, physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) else @@ -47,7 +47,7 @@ function left_canonicalize!( Q′ = transpose(Q, ((2, 3), (1, 4))) Q1 = Q′[2:end, 1, 1, 1] Q2 = removeunit(SparseBlockTensorMap(Q′[1:1, 1, 1, 1]), 1) - V = BlockTensorKit.oplus(oneunit(S), right_virtualspace(Q′), oneunit(S)) + V = ⊞(oneunit(S), right_virtualspace(Q′), oneunit(S)) end H[i] = JordanMPOTensor(codomain(W) ← physicalspace(W) ⊗ V, Q1, W.B, Q2, W.D) end @@ -108,11 +108,11 @@ function right_canonicalize!( R, Q = _right_orth!(tmp; alg, trunc = trscheme) if dim(R) == 0 - V = BlockTensorKit.oplus(oneunit(S), oneunit(S)) + V = oneunit(S) ⊞ oneunit(S) Q1 = typeof(W.A)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) Q2 = typeof(W.B)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W)) else - V = BlockTensorKit.oplus(oneunit(S), space(Q, 1), oneunit(S)) + V = ⊞(oneunit(S), space(Q, 1), oneunit(S)) scale!(Q, d) scale!(R, inv(d)) Q1 = typeof(W.A)(undef, space(Q, 1) ⊗ physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) @@ -123,7 +123,7 @@ function right_canonicalize!( tmp = transpose(cat(insertleftunit(B′, 4), W.A; dims = 4), ((1,), (3, 4, 2))) R, Q = _right_orth!(tmp; alg, trunc = trscheme) if dim(R) == 0 - V = BlockTensorKit.oplus(oneunit(S), oneunit(S)) + V = oneunit(S) ⊞ oneunit(S) Q1 = typeof(W.A)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W) ⊗ SumSpace{S}()) Q2 = typeof(W.B)(undef, SumSpace{S}() ⊗ physicalspace(W) ← physicalspace(W)) else @@ -132,7 +132,7 @@ function right_canonicalize!( Q′ = transpose(Q, ((1, 4), (2, 3))) Q1 = SparseBlockTensorMap(Q′[1, 1, 1, 2:end]) Q2 = removeunit(SparseBlockTensorMap(Q′[1, 1, 1, 1:1]), 4) - V = BlockTensorKit.oplus(oneunit(S), left_virtualspace(Q′), oneunit(S)) + V = ⊞(oneunit(S), left_virtualspace(Q′), oneunit(S)) end H[i] = JordanMPOTensor(V ⊗ physicalspace(W) ← domain(W), Q1, Q2, W.C, W.D) end From 48fb1e77cbbd65df176f2a7034600e080983f13e Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Thu, 9 Oct 2025 10:13:47 -0400 Subject: [PATCH 11/16] bump TensorKit version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 020344d94..5189c3795 100644 --- a/Project.toml +++ b/Project.toml @@ -42,7 +42,7 @@ Plots = "1.40" Printf = "1" Random = "1" RecipesBase = "1.1" -TensorKit = "0.15" +TensorKit = "0.15.1" TensorKitManifolds = "0.7" TensorOperations = "5" Test = "1" From 6954c4f4f07204261b8b2f145b4b64e6827cb0b8 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Thu, 9 Oct 2025 13:10:34 -0400 Subject: [PATCH 12/16] fix deprecation warnings --- examples/quantum1d/6.hubbard/main.jl | 4 +-- src/algorithms/approximate/idmrg.jl | 4 +-- src/algorithms/groundstate/idmrg.jl | 6 ++-- test/algorithms.jl | 52 ++++++++++++++-------------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/quantum1d/6.hubbard/main.jl b/examples/quantum1d/6.hubbard/main.jl index 6e6a2f79e..baa7a3bb0 100644 --- a/examples/quantum1d/6.hubbard/main.jl +++ b/examples/quantum1d/6.hubbard/main.jl @@ -68,7 +68,7 @@ function compute_groundstate( for _ in 1:expansioniter D = maximum(x -> dim(left_virtualspace(psi, x)), 1:length(psi)) D′ = max(5, round(Int, D * expansionfactor)) - trscheme = truncbelow(svalue / 10) & truncdim(D′) + trscheme = trunctol(; atol = svalue / 10) & truncrank(D′) psi′, = changebonds(psi, H, OptimalExpand(; trscheme = trscheme)) all( left_virtualspace.(Ref(psi), 1:length(psi)) .== @@ -78,7 +78,7 @@ function compute_groundstate( end ## convergence steps - psi, = changebonds(psi, H, SvdCut(; trscheme = truncbelow(svalue))) + psi, = changebonds(psi, H, SvdCut(; trscheme = trunctol(; atol = svalue))) psi, = find_groundstate( psi, H, VUMPS(; tol = svalue / 100, verbosity, maxiter = 100) & diff --git a/src/algorithms/approximate/idmrg.jl b/src/algorithms/approximate/idmrg.jl index b7e4922a8..75248f5b5 100644 --- a/src/algorithms/approximate/idmrg.jl +++ b/src/algorithms/approximate/idmrg.jl @@ -18,7 +18,7 @@ function approximate!( CartesianIndex(row, col), ψ, toapprox, envs ) normalize!(ψ.AC[row + 1, col]) - ψ.AL[row + 1, col], ψ.C[row + 1, col] = leftorth!(ψ.AC[row + 1, col]) + ψ.AL[row + 1, col], ψ.C[row + 1, col] = left_orth!(ψ.AC[row + 1, col]) end transfer_leftenv!(envs, ψ, toapprox, col + 1) end @@ -30,7 +30,7 @@ function approximate!( CartesianIndex(row, col), ψ, toapprox, envs ) normalize!(ψ.AC[row + 1, col]) - ψ.C[row + 1, col - 1], temp = rightorth!(_transpose_tail(ψ.AC[row + 1, col])) + ψ.C[row + 1, col - 1], temp = right_orth!(_transpose_tail(ψ.AC[row + 1, col])) ψ.AR[row + 1, col] = _transpose_front(temp) end transfer_rightenv!(envs, ψ, toapprox, col - 1) diff --git a/src/algorithms/groundstate/idmrg.jl b/src/algorithms/groundstate/idmrg.jl index b10a95b7e..0b1e848fd 100644 --- a/src/algorithms/groundstate/idmrg.jl +++ b/src/algorithms/groundstate/idmrg.jl @@ -45,9 +45,9 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG, envs = environments(o _, ψ.AC[pos] = fixedpoint(h, ψ.AC[pos], :SR, alg_eigsolve) if pos == length(ψ) # AC needed in next sweep - ψ.AL[pos], ψ.C[pos] = leftorth(ψ.AC[pos]) + ψ.AL[pos], ψ.C[pos] = left_orth(ψ.AC[pos]) else - ψ.AL[pos], ψ.C[pos] = leftorth!(ψ.AC[pos]) + ψ.AL[pos], ψ.C[pos] = left_orth!(ψ.AC[pos]) end transfer_leftenv!(envs, ψ, H, ψ, pos + 1) end @@ -57,7 +57,7 @@ function find_groundstate(ost::InfiniteMPS, H, alg::IDMRG, envs = environments(o h = AC_hamiltonian(pos, ψ, H, ψ, envs) _, ψ.AC[pos] = fixedpoint(h, ψ.AC[pos], :SR, alg_eigsolve) - ψ.C[pos - 1], temp = rightorth!(_transpose_tail(ψ.AC[pos])) + ψ.C[pos - 1], temp = right_orth!(_transpose_tail(ψ.AC[pos])) ψ.AR[pos] = _transpose_front(temp) transfer_rightenv!(envs, ψ, H, ψ, pos - 1) diff --git a/test/algorithms.jl b/test/algorithms.jl index 030517b4b..c1d0ad9e9 100644 --- a/test/algorithms.jl +++ b/test/algorithms.jl @@ -47,7 +47,7 @@ module TestAlgorithms @testset "DMRG2" begin ψ₀ = FiniteMPS(randn, ComplexF64, 10, ℙ^2, ℙ^D) v₀ = variance(ψ₀, H) - trscheme = truncdim(floor(Int, D * 1.5)) + trscheme = truncrank(floor(Int, D * 1.5)) # test logging ψ, envs, δ = find_groundstate( ψ₀, H, DMRG2(; verbosity = verbosity_full, maxiter = 2, trscheme) @@ -133,7 +133,7 @@ module TestAlgorithms ψ = repeat(InfiniteMPS(ℙ^2, ℙ^D), 2) H = repeat(H_ref, 2) - trscheme = truncbelow(1.0e-8) + trscheme = trunctol(; atol = 1.0e-8) # test logging ψ, envs, δ = find_groundstate( @@ -225,7 +225,7 @@ module TestAlgorithms @testset "DMRG2" begin # test logging passes - trscheme = truncdim(floor(Int, D * 1.5)) + trscheme = truncrank(floor(Int, D * 1.5)) ψ, envs, δ = find_groundstate( ψ₀, H_lazy, DMRG2(; tol, verbosity = verbosity_full, maxiter = 1, trscheme) ) @@ -303,7 +303,7 @@ module TestAlgorithms H_lazy′ = repeat(H_lazy, 2) H′ = repeat(H, 2) - trscheme = truncdim(floor(Int, D * 1.5)) + trscheme = truncrank(floor(Int, D * 1.5)) # test logging passes ψ, envs, δ = find_groundstate( ψ₀′, H_lazy′, IDMRG2(; tol, verbosity = verbosity_full, maxiter = 2, trscheme) @@ -332,7 +332,7 @@ module TestAlgorithms @testset "timestep" verbose = true begin dt = 0.1 - algs = [TDVP(), TDVP2(; trscheme = truncdim(10))] + algs = [TDVP(), TDVP2(; trscheme = truncrank(10))] L = 10 H = force_planar(heisenberg_XXX(Trivial, Float64; spin = 1 // 2, L)) @@ -410,7 +410,7 @@ module TestAlgorithms @testset "time_evolve" verbose = true begin t_span = 0:0.1:0.1 - algs = [TDVP(), TDVP2(; trscheme = truncdim(10))] + algs = [TDVP(), TDVP2(; trscheme = truncrank(10))] L = 10 H = force_planar(heisenberg_XXX(; spin = 1 // 2, L)) @@ -442,7 +442,7 @@ module TestAlgorithms algs = [ VUMPS(; tol, verbosity), VOMPS(; tol, verbosity), GradientGrassmann(; tol, verbosity), IDMRG(; tol, verbosity), - IDMRG2(; tol, verbosity, trscheme = truncdim(D1)), + IDMRG2(; tol, verbosity, trscheme = truncrank(D1)), ] mpo = force_planar(classical_ising()) @@ -456,7 +456,7 @@ module TestAlgorithms @test expectation_value(ψ, mpo2, envs) ≈ 2.5337^2 atol = 1.0e-3 else ψ, envs = leading_boundary(ψ₀, mpo, alg) - ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme = truncdim(D1 - D)), envs) + ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme = truncrank(D1 - D)), envs) ψ, envs = leading_boundary(ψ, mpo, alg) @test dim(space(ψ.AL[1, 1], 1)) == dim(space(ψ₀.AL[1, 1], 1)) + (D1 - D) @test expectation_value(ψ, mpo, envs) ≈ 2.5337 atol = 1.0e-3 @@ -524,7 +524,7 @@ module TestAlgorithms # find energy with normal dmrg for gsalg in ( DMRG(; verbosity, tol = 1.0e-6), - DMRG2(; verbosity, tol = 1.0e-6, trscheme = truncbelow(1.0e-4)), + DMRG2(; verbosity, tol = 1.0e-6, trscheme = trunctol(; atol = 1.0e-4)), ) energies_dm, _ = @inferred excitations(H, FiniteExcited(; gsalg), ψ) @test energies_dm[1] ≈ energies_QP[1] + expectation_value(ψ, H, envs) atol = 1.0e-4 @@ -557,7 +557,7 @@ module TestAlgorithms O = MPSKit.DenseMPO(expH) Op = periodic_boundary_conditions(O, 10) - Op′ = changebonds(Op, SvdCut(; trscheme = truncdim(5))) + Op′ = changebonds(Op, SvdCut(; trscheme = truncrank(5))) @test dim(space(Op′[5], 1)) < dim(space(Op[5], 1)) end @@ -574,7 +574,7 @@ module TestAlgorithms state = InfiniteMPS(fill(pspace, unit_cell_size), fill(Dspace, unit_cell_size)) state_re = changebonds( - state, RandExpand(; trscheme = truncdim(dim(Dspace) * dim(Dspace))) + state, RandExpand(; trscheme = truncrank(dim(Dspace) * dim(Dspace))) ) @test dot(state, state_re) ≈ 1 atol = 1.0e-8 end @@ -584,7 +584,7 @@ module TestAlgorithms state = InfiniteMPS(fill(pspace, unit_cell_size), fill(Dspace, unit_cell_size)) state_oe, _ = changebonds( - state, H, OptimalExpand(; trscheme = truncdim(dim(Dspace) * dim(Dspace))) + state, H, OptimalExpand(; trscheme = truncrank(dim(Dspace) * dim(Dspace))) ) @test dot(state, state_oe) ≈ 1 atol = 1.0e-8 end @@ -596,7 +596,7 @@ module TestAlgorithms state_vs, _ = changebonds(state, H, VUMPSSvdCut(; trscheme = notrunc())) @test dim(left_virtualspace(state, 1)) < dim(left_virtualspace(state_vs, 1)) - state_vs_tr = changebonds(state_vs, SvdCut(; trscheme = truncdim(dim(Dspace)))) + state_vs_tr = changebonds(state_vs, SvdCut(; trscheme = truncrank(dim(Dspace)))) @test dim(right_virtualspace(state_vs_tr, 1)) < dim(right_virtualspace(state_vs, 1)) end end @@ -611,16 +611,16 @@ module TestAlgorithms state = FiniteMPS(L, pspace, Dspace) state_re = changebonds( - state, RandExpand(; trscheme = truncdim(dim(Dspace) * dim(Dspace))) + state, RandExpand(; trscheme = truncrank(dim(Dspace) * dim(Dspace))) ) @test dot(state, state_re) ≈ 1 atol = 1.0e-8 state_oe, _ = changebonds( - state, H, OptimalExpand(; trscheme = truncdim(dim(Dspace) * dim(Dspace))) + state, H, OptimalExpand(; trscheme = truncrank(dim(Dspace) * dim(Dspace))) ) @test dot(state, state_oe) ≈ 1 atol = 1.0e-8 - state_tr = changebonds(state_oe, SvdCut(; trscheme = truncdim(dim(Dspace)))) + state_tr = changebonds(state_oe, SvdCut(; trscheme = truncrank(dim(Dspace)))) @test dim(left_virtualspace(state_tr, 5)) < dim(left_virtualspace(state_oe, 5)) end @@ -633,16 +633,16 @@ module TestAlgorithms state = MultilineMPS(fill(t, 1, 1)) state_re = changebonds( - state, RandExpand(; trscheme = truncdim(dim(Dspace) * dim(Dspace))) + state, RandExpand(; trscheme = truncrank(dim(Dspace) * dim(Dspace))) ) @test dot(state, state_re) ≈ 1 atol = 1.0e-8 state_oe, _ = changebonds( - state, mpo, OptimalExpand(; trscheme = truncdim(dim(Dspace) * dim(Dspace))) + state, mpo, OptimalExpand(; trscheme = truncrank(dim(Dspace) * dim(Dspace))) ) @test dot(state, state_oe) ≈ 1 atol = 1.0e-8 - state_tr = changebonds(state_oe, SvdCut(; trscheme = truncdim(dim(Dspace)))) + state_tr = changebonds(state_oe, SvdCut(; trscheme = truncrank(dim(Dspace)))) @test dim(left_virtualspace(state_tr, 1, 1)) < dim(left_virtualspace(state_oe, 1, 1)) end @@ -756,20 +756,20 @@ module TestAlgorithms MPSKit.Defaults.set_scheduler!() ψ3, _ = approximate(ψ0, (W1, ψ), IDMRG(; verbosity)) - ψ4, _ = approximate(ψ0, (sW2, ψ), IDMRG2(; trscheme = truncdim(12), verbosity)) + ψ4, _ = approximate(ψ0, (sW2, ψ), IDMRG2(; trscheme = truncrank(12), verbosity)) ψ5, _ = timestep(ψ, H, 0.0, dt, TDVP()) - ψ6 = changebonds(W1 * ψ, SvdCut(; trscheme = truncdim(12))) + ψ6 = changebonds(W1 * ψ, SvdCut(; trscheme = truncrank(12))) @test abs(dot(ψ1, ψ5)) ≈ 1.0 atol = dt @test abs(dot(ψ3, ψ5)) ≈ 1.0 atol = dt @test abs(dot(ψ6, ψ5)) ≈ 1.0 atol = dt @test abs(dot(ψ2, ψ4)) ≈ 1.0 atol = dt - nW1 = changebonds(W1, SvdCut(; trscheme = truncbelow(dt))) # this should be a trivial mpo now + nW1 = changebonds(W1, SvdCut(; trscheme = trunctol(; atol = dt))) # this should be a trivial mpo now @test dim(space(nW1[1], 1)) == 1 end - finite_algs = [DMRG(; verbosity), DMRG2(; verbosity, trscheme = truncdim(10))] + finite_algs = [DMRG(; verbosity), DMRG2(; verbosity, trscheme = truncrank(10))] @testset "finitemps1 ≈ finitemps2" for alg in finite_algs a = FiniteMPS(10, ℂ^2, ℂ^10) b = FiniteMPS(10, ℂ^2, ℂ^20) @@ -956,7 +956,7 @@ module TestAlgorithms @testset "Finite-size" begin L = 6 H = transverse_field_ising(; L) - trscheme = truncdim(20) + trscheme = truncrank(20) verbosity = 1 beta = 0.1 @@ -1003,7 +1003,7 @@ module TestAlgorithms @testset "Infinite-size" begin H = transverse_field_ising() - trscheme = truncdim(20) + trscheme = truncrank(20) verbosity = 1 beta = 0.1 @@ -1030,7 +1030,7 @@ module TestAlgorithms # TDVP rho_0 = MPSKit.infinite_temperature_density_matrix(H) - rho_0_mps, = changebonds(convert(InfiniteMPS, rho_0), H, OptimalExpand(; trscheme = truncdim(20))) + rho_0_mps, = changebonds(convert(InfiniteMPS, rho_0), H, OptimalExpand(; trscheme = truncrank(20))) rho_mps_tdvp, = timestep(rho_0_mps, H, 0.0, beta, TDVP(); imaginary_evolution) E_tdvp = expectation_value(rho_mps_tdvp, H) @test E_tdvp ≈ E_taylor atol = 1.0e-2 From 97fb433091b3b4dd8a4e72188aefb8759067e909 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Thu, 9 Oct 2025 13:30:53 -0400 Subject: [PATCH 13/16] Explicit overloaded import --- src/operators/jordanmpotensor.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operators/jordanmpotensor.jl b/src/operators/jordanmpotensor.jl index bb7932414..6688b8182 100644 --- a/src/operators/jordanmpotensor.jl +++ b/src/operators/jordanmpotensor.jl @@ -163,7 +163,7 @@ BlockTensorKit.issparse(W::JordanMPOTensor) = true # Converters # ---------- -function SparseBlockTensorMap(W::JordanMPOTensor) +function BlockTensorKit.SparseBlockTensorMap(W::JordanMPOTensor) τ = BraidingTensor{scalartype(W)}(eachspace(W)[1]) W′ = SparseBlockTensorMap{AbstractTensorMap{scalartype(W), spacetype(W), 2, 2}}( undef_blocks, space(W) From 671e1a7a180c7d13d4e37f9c68c63547ef621a55 Mon Sep 17 00:00:00 2001 From: lkdvos Date: Thu, 9 Oct 2025 17:29:56 -0400 Subject: [PATCH 14/16] Update examples --- .../classic2d/1.hard-hexagon/index.md | 84 +- .../classic2d/1.hard-hexagon/main.ipynb | 32 +- .../examples/quantum1d/1.ising-cft/index.md | 375 ++---- .../examples/quantum1d/1.ising-cft/main.ipynb | 45 +- .../src/examples/quantum1d/2.haldane/index.md | 190 +--- .../examples/quantum1d/2.haldane/main.ipynb | 42 +- .../examples/quantum1d/3.ising-dqpt/index.md | 62 +- .../quantum1d/3.ising-dqpt/main.ipynb | 38 +- .../quantum1d/4.xxz-heisenberg/index.md | 1004 +++++++---------- .../quantum1d/4.xxz-heisenberg/main.ipynb | 30 +- .../examples/quantum1d/5.haldane-spt/index.md | 890 +-------------- .../quantum1d/5.haldane-spt/main.ipynb | 38 +- .../src/examples/quantum1d/6.hubbard/index.md | 659 +++-------- .../examples/quantum1d/6.hubbard/main.ipynb | 141 +-- .../examples/quantum1d/7.xy-finiteT/index.md | 713 +++--------- .../quantum1d/7.xy-finiteT/main.ipynb | 221 ++-- examples/Cache.toml | 16 +- examples/classic2d/1.hard-hexagon/main.jl | 2 +- examples/quantum1d/3.ising-dqpt/main.jl | 8 +- examples/quantum1d/4.xxz-heisenberg/main.jl | 2 +- examples/quantum1d/7.xy-finiteT/main.jl | 8 +- examples/windowmps.jl | 2 +- 22 files changed, 1214 insertions(+), 3388 deletions(-) diff --git a/docs/src/examples/classic2d/1.hard-hexagon/index.md b/docs/src/examples/classic2d/1.hard-hexagon/index.md index e94b03bb6..c1dafc781 100644 --- a/docs/src/examples/classic2d/1.hard-hexagon/index.md +++ b/docs/src/examples/classic2d/1.hard-hexagon/index.md @@ -33,7 +33,7 @@ function virtual_space(D::Integer) return Vect[FibonacciAnyon](sector => _D for sector in (:I, :τ)) end -@assert isapprox(dim(virtual_space(100)), 100; atol=3) +@assert isapprox(dim(virtual_space(100)), 100; atol = 3) ```` ## The leading boundary @@ -47,10 +47,10 @@ Additionally, we can compute the entanglement entropy as well as the correlation D = 10 V = virtual_space(D) ψ₀ = InfiniteMPS([P], [V]) -ψ, envs, = leading_boundary(ψ₀, mpo, - VUMPS(; verbosity=0, - alg_eigsolve=MPSKit.Defaults.alg_eigsolve(; - ishermitian=false))) # use non-hermitian eigensolver +ψ, envs, = leading_boundary( + ψ₀, mpo, + VUMPS(; verbosity = 0, alg_eigsolve = MPSKit.Defaults.alg_eigsolve(; ishermitian = false)) +) # use non-hermitian eigensolver F = real(expectation_value(ψ, mpo)) S = real(first(entropy(ψ))) ξ = correlation_length(ψ) @@ -58,7 +58,7 @@ println("F = $F\tS = $S\tξ = $ξ") ```` ```` -F = 0.8839037051703852 S = 1.2807829622066444 ξ = 13.849682583029384 +F = 0.8839037051703853 S = 1.2807829622000708 ξ = 13.849682582620911 ```` @@ -70,8 +70,10 @@ First we need to know the entropy and correlation length at a bunch of different According to the scaling hypothesis we should have ``S \propto \frac{c}{6} log(ξ)``. Therefore we should find ``c`` using ````julia -function scaling_simulations(ψ₀, mpo, Ds; verbosity=0, tol=1e-6, - alg_eigsolve=MPSKit.Defaults.alg_eigsolve(; ishermitian=false)) +function scaling_simulations( + ψ₀, mpo, Ds; verbosity = 0, tol = 1.0e-6, + alg_eigsolve = MPSKit.Defaults.alg_eigsolve(; ishermitian = false) + ) entropies = similar(Ds, Float64) correlations = similar(Ds, Float64) alg = VUMPS(; verbosity, tol, alg_eigsolve) @@ -81,7 +83,7 @@ function scaling_simulations(ψ₀, mpo, Ds; verbosity=0, tol=1e-6, correlations[1] = correlation_length(ψ) for (i, d) in enumerate(diff(Ds)) - ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme=truncdim(d)), envs) + ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme = truncrank(d)), envs) ψ, envs, = leading_boundary(ψ, mpo, alg, envs) entropies[i + 1] = real(entropy(ψ)[1]) correlations[i + 1] = correlation_length(ψ) @@ -98,71 +100,17 @@ c = f.coeffs[2] ```` ```` -0.8025249301530266 +0.802524583072294 ```` ````julia -p = plot(; xlabel="logarithmic correlation length", ylabel="entanglement entropy") -p = plot(log.(ξs), Ss; seriestype=:scatter, label=nothing) -plot!(p, ξ -> f(ξ) / 6; label="fit") +p = plot(; xlabel = "logarithmic correlation length", ylabel = "entanglement entropy") +p = plot(log.(ξs), Ss; seriestype = :scatter, label = nothing) +plot!(p, ξ -> f(ξ) / 6; label = "fit") ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` --- diff --git a/docs/src/examples/classic2d/1.hard-hexagon/main.ipynb b/docs/src/examples/classic2d/1.hard-hexagon/main.ipynb index fd7e7be84..81e443120 100644 --- a/docs/src/examples/classic2d/1.hard-hexagon/main.ipynb +++ b/docs/src/examples/classic2d/1.hard-hexagon/main.ipynb @@ -45,7 +45,7 @@ " return Vect[FibonacciAnyon](sector => _D for sector in (:I, :τ))\n", "end\n", "\n", - "@assert isapprox(dim(virtual_space(100)), 100; atol=3)" + "@assert isapprox(dim(virtual_space(100)), 100; atol = 3)" ], "metadata": {}, "execution_count": null @@ -69,10 +69,10 @@ "D = 10\n", "V = virtual_space(D)\n", "ψ₀ = InfiniteMPS([P], [V])\n", - "ψ, envs, = leading_boundary(ψ₀, mpo,\n", - " VUMPS(; verbosity=0,\n", - " alg_eigsolve=MPSKit.Defaults.alg_eigsolve(;\n", - " ishermitian=false))) # use non-hermitian eigensolver\n", + "ψ, envs, = leading_boundary(\n", + " ψ₀, mpo,\n", + " VUMPS(; verbosity = 0, alg_eigsolve = MPSKit.Defaults.alg_eigsolve(; ishermitian = false))\n", + ") # use non-hermitian eigensolver\n", "F = real(expectation_value(ψ, mpo))\n", "S = real(first(entropy(ψ)))\n", "ξ = correlation_length(ψ)\n", @@ -97,8 +97,10 @@ "outputs": [], "cell_type": "code", "source": [ - "function scaling_simulations(ψ₀, mpo, Ds; verbosity=0, tol=1e-6,\n", - " alg_eigsolve=MPSKit.Defaults.alg_eigsolve(; ishermitian=false))\n", + "function scaling_simulations(\n", + " ψ₀, mpo, Ds; verbosity = 0, tol = 1.0e-6,\n", + " alg_eigsolve = MPSKit.Defaults.alg_eigsolve(; ishermitian = false)\n", + " )\n", " entropies = similar(Ds, Float64)\n", " correlations = similar(Ds, Float64)\n", " alg = VUMPS(; verbosity, tol, alg_eigsolve)\n", @@ -108,7 +110,7 @@ " correlations[1] = correlation_length(ψ)\n", "\n", " for (i, d) in enumerate(diff(Ds))\n", - " ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme=truncdim(d)), envs)\n", + " ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme = truncrank(d)), envs)\n", " ψ, envs, = leading_boundary(ψ, mpo, alg, envs)\n", " entropies[i + 1] = real(entropy(ψ)[1])\n", " correlations[i + 1] = correlation_length(ψ)\n", @@ -122,9 +124,9 @@ "\n", "f = fit(log.(ξs), 6 * Ss, 1)\n", "c = f.coeffs[2]\n", - "p = plot(; xlabel=\"logarithmic correlation length\", ylabel=\"entanglement entropy\")\n", - "p = plot(log.(ξs), Ss; seriestype=:scatter, label=nothing)\n", - "plot!(p, ξ -> f(ξ) / 6; label=\"fit\")" + "p = plot(; xlabel = \"logarithmic correlation length\", ylabel = \"entanglement entropy\")\n", + "p = plot(log.(ξs), Ss; seriestype = :scatter, label = nothing)\n", + "plot!(p, ξ -> f(ξ) / 6; label = \"fit\")" ], "metadata": {}, "execution_count": null @@ -145,13 +147,13 @@ "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.10.4" + "version": "1.12.0" }, "kernelspec": { - "name": "julia-1.10", - "display_name": "Julia 1.10.4", + "name": "julia-1.12", + "display_name": "Julia 1.12.0", "language": "julia" } }, "nbformat": 4 -} +} \ No newline at end of file diff --git a/docs/src/examples/quantum1d/1.ising-cft/index.md b/docs/src/examples/quantum1d/1.ising-cft/index.md index 49b15148a..647943ce2 100644 --- a/docs/src/examples/quantum1d/1.ising-cft/index.md +++ b/docs/src/examples/quantum1d/1.ising-cft/index.md @@ -27,18 +27,18 @@ H = periodic_boundary_conditions(transverse_field_ising(), L) ```` 12-site FiniteMPOHamiltonian{MPSKit.JordanMPOTensor{ComplexF64, TensorKit.ComplexSpace, Union{TensorKit.BraidingTensor{ComplexF64, TensorKit.ComplexSpace}, TensorKit.TensorMap{ComplexF64, TensorKit.ComplexSpace, 2, 2, Vector{ComplexF64}}}, TensorKit.TensorMap{ComplexF64, TensorKit.ComplexSpace, 2, 1, Vector{ComplexF64}}, TensorKit.TensorMap{ComplexF64, TensorKit.ComplexSpace, 1, 2, Vector{ComplexF64}}, TensorKit.TensorMap{ComplexF64, TensorKit.ComplexSpace, 1, 1, Vector{ComplexF64}}}}: -┬ W[12]: 6×1×1×1 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ ⊕(ℂ^1))) -┼ W[11]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[10]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[9]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[8]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[7]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[6]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[5]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[4]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[3]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┼ W[2]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) -┴ W[1]: 1×1×1×6 JordanMPOTensor((⊕(ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^1 ⊕ ℂ^1 ⊕ ⋯ ⊕ ℂ^1 ⊗ ℂ^1 ⊗ ℂ^1))) +┬ W[12]: 6×1×1×1 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ ⊞(ℂ^1))) +┼ W[11]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[10]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[9]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[8]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[7]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[6]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[5]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[4]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[3]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┼ W[2]: 6×1×1×6 JordanMPOTensor(((ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) +┴ W[1]: 1×1×1×6 JordanMPOTensor((⊞(ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ⋯ ⊞ ℂ^1 ⊞ ℂ^1 ⊞ ℂ^1))) ```` @@ -51,83 +51,15 @@ tensor is equivalent to optimixing a state in the entire Hilbert space, as all o are just unitary matrices that mix the basis. ````julia -energies, states = exact_diagonalization(H; num=18, alg=Lanczos(; krylovdim=200)); -plot(real.(energies); - seriestype=:scatter, - legend=false, - ylabel="energy", - xlabel="#eigenvalue") +energies, states = exact_diagonalization(H; num = 18, alg = Lanczos(; krylovdim = 200)); +plot( + real.(energies); + seriestype = :scatter, legend = false, ylabel = "energy", xlabel = "#eigenvalue" +) ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` !!! note "Krylov dimension" @@ -193,21 +125,21 @@ append!(momenta, fix_degeneracies(states[17:18])) ```` 18-element Vector{Float64}: - 1.246186266146853e-17 - -8.631511857294761e-18 - -1.3216734210710249e-17 + -5.378354829155499e-17 + -7.106988585426104e-20 + -1.1970611374275794e-17 + -0.5235987755982987 + 0.523598775598299 + -1.0471975511965979 + 1.0471975511965974 + 0.5235987755982988 -0.5235987755982986 - 0.5235987755982986 - 1.0471975511965979 - -1.0471975511965976 - -0.5235987755982994 - 0.5235987755982986 + 1.0471975511965976 -1.0471975511965979 + 1.705690506440868e-17 + -1.570796326794897 + 1.5707963267948963 1.047197551196598 - 2.045951729445069e-18 - 1.5707963267948972 - -1.5707963267948966 - 1.0471975511965976 -1.0471975511965976 1.5707963267948968 -1.5707963267948966 @@ -223,95 +155,18 @@ v = 2.0 Δ = real.(energies[1:18] .- energies[1]) ./ (2π * v / L) S = momenta ./ (2π / L) -p = plot(S, real.(Δ); - seriestype=:scatter, xlabel="conformal spin (S)", ylabel="scaling dimension (Δ)", - legend=false) -vline!(p, -3:3; color="gray", linestyle=:dash) -hline!(p, [0, 1 / 8, 1, 9 / 8, 2, 17 / 8]; color="gray", linestyle=:dash) +p = plot( + S, real.(Δ); + seriestype = :scatter, xlabel = "conformal spin (S)", ylabel = "scaling dimension (Δ)", + legend = false +) +vline!(p, -3:3; color = "gray", linestyle = :dash) +hline!(p, [0, 1 / 8, 1, 9 / 8, 2, 17 / 8]; color = "gray", linestyle = :dash) p ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` ## Finite bond dimension @@ -327,29 +182,46 @@ D = 64 ```` ```` -[ Info: DMRG init: obj = -1.962262453177e+01 err = 7.3556e-02 -[ Info: DMRG 1: obj = -2.549098959968e+01 err = 6.9556083849e-03 time = 6.15 sec -[ Info: DMRG 2: obj = -2.549098968636e+01 err = 9.6981397128e-07 time = 1.72 sec -[ Info: DMRG 3: obj = -2.549098968636e+01 err = 1.3889229576e-07 time = 3.00 sec -[ Info: DMRG 4: obj = -2.549098968636e+01 err = 1.0660559825e-08 time = 1.22 sec -[ Info: DMRG 5: obj = -2.549098968636e+01 err = 4.3665500904e-09 time = 1.61 sec -[ Info: DMRG 6: obj = -2.549098968636e+01 err = 2.3077809720e-09 time = 1.46 sec -[ Info: DMRG 7: obj = -2.549098968636e+01 err = 1.5733990931e-09 time = 1.77 sec -[ Info: DMRG 8: obj = -2.549098968636e+01 err = 1.1971538263e-09 time = 1.61 sec -[ Info: DMRG 9: obj = -2.549098968636e+01 err = 9.8752978358e-10 time = 1.91 sec -[ Info: DMRG 10: obj = -2.549098968636e+01 err = 8.1374220442e-10 time = 1.58 sec -[ Info: DMRG 11: obj = -2.549098968636e+01 err = 6.7075749015e-10 time = 1.81 sec -[ Info: DMRG 12: obj = -2.549098968636e+01 err = 5.5405183201e-10 time = 1.55 sec -[ Info: DMRG 13: obj = -2.549098968636e+01 err = 4.5909617368e-10 time = 2.38 sec -[ Info: DMRG 14: obj = -2.549098968636e+01 err = 3.8179578214e-10 time = 2.88 sec -[ Info: DMRG 15: obj = -2.549098968636e+01 err = 3.1869349978e-10 time = 2.66 sec -[ Info: DMRG 16: obj = -2.549098968636e+01 err = 2.6697738491e-10 time = 2.45 sec -[ Info: DMRG 17: obj = -2.549098968636e+01 err = 2.2440327341e-10 time = 2.17 sec -[ Info: DMRG 18: obj = -2.549098968636e+01 err = 1.8919500490e-10 time = 1.83 sec -[ Info: DMRG 19: obj = -2.549098968636e+01 err = 1.5994966767e-10 time = 1.73 sec -[ Info: DMRG 20: obj = -2.549098968636e+01 err = 1.3555718171e-10 time = 1.98 sec -[ Info: DMRG 21: obj = -2.549098968636e+01 err = 1.1513558901e-10 time = 2.08 sec -[ Info: DMRG conv 22: obj = -2.549098968636e+01 err = 9.7980377538e-11 time = 47.77 sec +[ Info: DMRG init: obj = -1.959798006201e+01 err = 3.9034e-01 +[ Info: DMRG 1: obj = -2.548860604005e+01 err = 1.7104122458e-02 time = 2.94 sec +[ Info: DMRG 2: obj = -2.549098968635e+01 err = 4.7769187563e-06 time = 1.19 sec +[ Info: DMRG 3: obj = -2.549098968636e+01 err = 1.4444395774e-07 time = 0.56 sec +[ Info: DMRG 4: obj = -2.549098968636e+01 err = 2.4683334253e-08 time = 0.47 sec +[ Info: DMRG 5: obj = -2.549098968636e+01 err = 9.2494811019e-09 time = 0.47 sec +[ Info: DMRG 6: obj = -2.549098968636e+01 err = 4.2700930707e-09 time = 0.47 sec +[ Info: DMRG 7: obj = -2.549098968636e+01 err = 2.8468477933e-09 time = 0.46 sec +[ Info: DMRG 8: obj = -2.549098968636e+01 err = 2.2214754548e-09 time = 0.48 sec +[ Info: DMRG 9: obj = -2.549098968636e+01 err = 1.7977223058e-09 time = 0.47 sec +[ Info: DMRG 10: obj = -2.549098968636e+01 err = 1.4634778351e-09 time = 0.47 sec +[ Info: DMRG 11: obj = -2.549098968636e+01 err = 1.3630887037e-09 time = 0.48 sec +[ Info: DMRG 12: obj = -2.549098968636e+01 err = 1.5594810847e-09 time = 0.47 sec +[ Info: DMRG 13: obj = -2.549098968636e+01 err = 1.7301607123e-09 time = 0.46 sec +[ Info: DMRG 14: obj = -2.549098968636e+01 err = 1.8601697500e-09 time = 0.46 sec +[ Info: DMRG 15: obj = -2.549098968636e+01 err = 1.9357644569e-09 time = 0.44 sec +[ Info: DMRG 16: obj = -2.549098968636e+01 err = 1.9483292750e-09 time = 1.29 sec +[ Info: DMRG 17: obj = -2.549098968636e+01 err = 1.9124252703e-09 time = 0.40 sec +[ Info: DMRG 18: obj = -2.549098968636e+01 err = 1.8333796427e-09 time = 0.36 sec +[ Info: DMRG 19: obj = -2.549098968636e+01 err = 1.7086486342e-09 time = 0.39 sec +[ Info: DMRG 20: obj = -2.549098968636e+01 err = 1.5546926753e-09 time = 0.40 sec +[ Info: DMRG 21: obj = -2.549098968636e+01 err = 1.3877708971e-09 time = 0.40 sec +[ Info: DMRG 22: obj = -2.549098968636e+01 err = 1.2209468902e-09 time = 0.40 sec +[ Info: DMRG 23: obj = -2.549098968636e+01 err = 1.0630324605e-09 time = 0.41 sec +[ Info: DMRG 24: obj = -2.549098968636e+01 err = 9.1895063136e-10 time = 0.41 sec +[ Info: DMRG 25: obj = -2.549098968636e+01 err = 7.9071631158e-10 time = 0.41 sec +[ Info: DMRG 26: obj = -2.549098968636e+01 err = 6.7846224132e-10 time = 0.41 sec +[ Info: DMRG 27: obj = -2.549098968636e+01 err = 5.8125445739e-10 time = 0.41 sec +[ Info: DMRG 28: obj = -2.549098968636e+01 err = 4.9765022739e-10 time = 0.41 sec +[ Info: DMRG 29: obj = -2.549098968636e+01 err = 4.2604131419e-10 time = 0.41 sec +[ Info: DMRG 30: obj = -2.549098968636e+01 err = 3.6484596128e-10 time = 0.41 sec +[ Info: DMRG 31: obj = -2.549098968636e+01 err = 3.1260439575e-10 time = 0.41 sec +[ Info: DMRG 32: obj = -2.549098968636e+01 err = 2.6801737353e-10 time = 0.41 sec +[ Info: DMRG 33: obj = -2.549098968636e+01 err = 2.2995321952e-10 time = 0.41 sec +[ Info: DMRG 34: obj = -2.549098968636e+01 err = 1.9743900235e-10 time = 0.41 sec +[ Info: DMRG 35: obj = -2.549098968636e+01 err = 1.6964470820e-10 time = 0.43 sec +[ Info: DMRG 36: obj = -2.549098968636e+01 err = 1.4586531713e-10 time = 1.39 sec +[ Info: DMRG 37: obj = -2.549098968636e+01 err = 1.2550327335e-10 time = 0.49 sec +[ Info: DMRG 38: obj = -2.549098968636e+01 err = 1.0805248647e-10 time = 0.41 sec +[ Info: DMRG conv 39: obj = -2.549098968636e+01 err = 9.3084268982e-11 time = 22.02 sec ```` @@ -358,7 +230,7 @@ ansatz. This returns quasiparticle states, which can be converted to regular `Fi objects. ````julia -E_ex, qps = excitations(H_mps, QuasiparticleAnsatz(), ψ, envs; num=18) +E_ex, qps = excitations(H_mps, QuasiparticleAnsatz(), ψ, envs; num = 18) states_mps = vcat(ψ, map(qp -> convert(FiniteMPS, qp), qps)) energies_mps = map(x -> expectation_value(x, H_mps), states_mps) @@ -377,91 +249,18 @@ v = 2.0 Δ_mps = real.(energies_mps[1:18] .- energies_mps[1]) ./ (2π * v / L_mps) S_mps = momenta_mps ./ (2π / L_mps) -p_mps = plot(S_mps, real.(Δ_mps); - seriestype=:scatter, xlabel="conformal spin (S)", - ylabel="scaling dimension (Δ)", legend=false) -vline!(p_mps, -3:3; color="gray", linestyle=:dash) -hline!(p_mps, [0, 1 / 8, 1, 9 / 8, 2, 17 / 8]; color="gray", linestyle=:dash) +p_mps = plot( + S_mps, real.(Δ_mps); + seriestype = :scatter, xlabel = "conformal spin (S)", + ylabel = "scaling dimension (Δ)", legend = false +) +vline!(p_mps, -3:3; color = "gray", linestyle = :dash) +hline!(p_mps, [0, 1 / 8, 1, 9 / 8, 2, 17 / 8]; color = "gray", linestyle = :dash) p_mps ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` --- diff --git a/docs/src/examples/quantum1d/1.ising-cft/main.ipynb b/docs/src/examples/quantum1d/1.ising-cft/main.ipynb index b72803229..857d0f4a6 100644 --- a/docs/src/examples/quantum1d/1.ising-cft/main.ipynb +++ b/docs/src/examples/quantum1d/1.ising-cft/main.ipynb @@ -56,12 +56,11 @@ "outputs": [], "cell_type": "code", "source": [ - "energies, states = exact_diagonalization(H; num=18, alg=Lanczos(; krylovdim=200));\n", - "plot(real.(energies);\n", - " seriestype=:scatter,\n", - " legend=false,\n", - " ylabel=\"energy\",\n", - " xlabel=\"#eigenvalue\")" + "energies, states = exact_diagonalization(H; num = 18, alg = Lanczos(; krylovdim = 200));\n", + "plot(\n", + " real.(energies);\n", + " seriestype = :scatter, legend = false, ylabel = \"energy\", xlabel = \"#eigenvalue\"\n", + ")" ], "metadata": {}, "execution_count": null @@ -167,11 +166,13 @@ "Δ = real.(energies[1:18] .- energies[1]) ./ (2π * v / L)\n", "S = momenta ./ (2π / L)\n", "\n", - "p = plot(S, real.(Δ);\n", - " seriestype=:scatter, xlabel=\"conformal spin (S)\", ylabel=\"scaling dimension (Δ)\",\n", - " legend=false)\n", - "vline!(p, -3:3; color=\"gray\", linestyle=:dash)\n", - "hline!(p, [0, 1 / 8, 1, 9 / 8, 2, 17 / 8]; color=\"gray\", linestyle=:dash)\n", + "p = plot(\n", + " S, real.(Δ);\n", + " seriestype = :scatter, xlabel = \"conformal spin (S)\", ylabel = \"scaling dimension (Δ)\",\n", + " legend = false\n", + ")\n", + "vline!(p, -3:3; color = \"gray\", linestyle = :dash)\n", + "hline!(p, [0, 1 / 8, 1, 9 / 8, 2, 17 / 8]; color = \"gray\", linestyle = :dash)\n", "p" ], "metadata": {}, @@ -212,7 +213,7 @@ "outputs": [], "cell_type": "code", "source": [ - "E_ex, qps = excitations(H_mps, QuasiparticleAnsatz(), ψ, envs; num=18)\n", + "E_ex, qps = excitations(H_mps, QuasiparticleAnsatz(), ψ, envs; num = 18)\n", "states_mps = vcat(ψ, map(qp -> convert(FiniteMPS, qp), qps))\n", "energies_mps = map(x -> expectation_value(x, H_mps), states_mps)\n", "\n", @@ -231,11 +232,13 @@ "Δ_mps = real.(energies_mps[1:18] .- energies_mps[1]) ./ (2π * v / L_mps)\n", "S_mps = momenta_mps ./ (2π / L_mps)\n", "\n", - "p_mps = plot(S_mps, real.(Δ_mps);\n", - " seriestype=:scatter, xlabel=\"conformal spin (S)\",\n", - " ylabel=\"scaling dimension (Δ)\", legend=false)\n", - "vline!(p_mps, -3:3; color=\"gray\", linestyle=:dash)\n", - "hline!(p_mps, [0, 1 / 8, 1, 9 / 8, 2, 17 / 8]; color=\"gray\", linestyle=:dash)\n", + "p_mps = plot(\n", + " S_mps, real.(Δ_mps);\n", + " seriestype = :scatter, xlabel = \"conformal spin (S)\",\n", + " ylabel = \"scaling dimension (Δ)\", legend = false\n", + ")\n", + "vline!(p_mps, -3:3; color = \"gray\", linestyle = :dash)\n", + "hline!(p_mps, [0, 1 / 8, 1, 9 / 8, 2, 17 / 8]; color = \"gray\", linestyle = :dash)\n", "p_mps" ], "metadata": {}, @@ -257,13 +260,13 @@ "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.10.4" + "version": "1.12.0" }, "kernelspec": { - "name": "julia-1.10", - "display_name": "Julia 1.10.4", + "name": "julia-1.12", + "display_name": "Julia 1.12.0", "language": "julia" } }, "nbformat": 4 -} +} \ No newline at end of file diff --git a/docs/src/examples/quantum1d/2.haldane/index.md b/docs/src/examples/quantum1d/2.haldane/index.md index 5a1d86df5..6facc6123 100644 --- a/docs/src/examples/quantum1d/2.haldane/index.md +++ b/docs/src/examples/quantum1d/2.haldane/index.md @@ -53,82 +53,34 @@ H = heisenberg_XXX(symmetry, chain; J, spin) physical_space = SU2Space(1 => 1) virtual_space = SU2Space(0 => 12, 1 => 12, 2 => 5, 3 => 3) ψ₀ = FiniteMPS(L, physical_space, virtual_space) -ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity=0)) +ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity = 0)) E₀ = real(expectation_value(ψ, H)) -En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(1)) -En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(2)) +En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector = SU2Irrep(1)) +En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector = SU2Irrep(2)) ΔE_finite = real(En_2[1] - En_1[1]) ```` ```` -0.7989253589480468 +0.7989253589480493 ```` We can go even further and doublecheck the claim that ``S = 1`` is an edge excitation, by plotting the energy density. ````julia -p_density = plot(; xaxis="position", yaxis="energy density") +p_density = plot(; xaxis = "position", yaxis = "energy density") excited_1 = convert(FiniteMPS, st_1[1]) excited_2 = convert(FiniteMPS, st_2[1]) -SS = -S_exchange(ComplexF64, SU2Irrep; spin=1) +SS = -S_exchange(ComplexF64, SU2Irrep; spin = 1) e₀ = [real(expectation_value(ψ, (i, i + 1) => SS)) for i in 1:(L - 1)] e₁ = [real(expectation_value(excited_1, (i, i + 1) => SS)) for i in 1:(L - 1)] e₂ = [real(expectation_value(excited_2, (i, i + 1) => SS)) for i in 1:(L - 1)] -plot!(p_density, e₀; label="S = 0") -plot!(p_density, e₁; label="S = 1") -plot!(p_density, e₂; label="S = 2") +plot!(p_density, e₀; label = "S = 0") +plot!(p_density, e₁; label = "S = 1") +plot!(p_density, e₂; label = "S = 2") ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` Finally, we can obtain a value for the Haldane gap by extrapolating our results for different system sizes. @@ -139,9 +91,9 @@ Ls = 12:4:30 @info "computing L = $L" ψ₀ = FiniteMPS(L, physical_space, virtual_space) H = heisenberg_XXX(symmetry, FiniteChain(L); J, spin) - ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity=0)) - En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(1)) - En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(2)) + ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity = 0)) + En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector = SU2Irrep(1)) + En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector = SU2Irrep(2)) return real(En_2[1] - En_1[1]) end @@ -150,67 +102,17 @@ f = fit(Ls .^ (-2), ΔEs, 1) ```` ```` -0.4517340158582977 +0.4517340158584577 ```` ````julia -p_size_extrapolation = plot(; xaxis="L^(-2)", yaxis="ΔE", xlims=(0, 0.015)) -plot!(p_size_extrapolation, Ls .^ (-2), ΔEs; seriestype=:scatter, label="numerical") -plot!(p_size_extrapolation, x -> f(x); label="fit") +p_size_extrapolation = plot(; xaxis = "L^(-2)", yaxis = "ΔE", xlims = (0, 0.015)) +plot!(p_size_extrapolation, Ls .^ (-2), ΔEs; seriestype = :scatter, label = "numerical") +plot!(p_size_extrapolation, x -> f(x); label = "fit") ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` ## Thermodynamic limit @@ -228,18 +130,16 @@ chain = InfiniteChain(1) H = heisenberg_XXX(symmetry, chain; J, spin) virtual_space_inf = Rep[SU₂](1 // 2 => 16, 3 // 2 => 16, 5 // 2 => 8, 7 // 2 => 4) ψ₀_inf = InfiniteMPS([physical_space], [virtual_space_inf]) -ψ_inf, envs_inf, delta_inf = find_groundstate(ψ₀_inf, H; verbosity=0) +ψ_inf, envs_inf, delta_inf = find_groundstate(ψ₀_inf, H; verbosity = 0) kspace = range(0, π, 16) -Es, _ = excitations(H, QuasiparticleAnsatz(), kspace, ψ_inf, envs_inf; sector=SU2Irrep(1)) +Es, _ = excitations(H, QuasiparticleAnsatz(), kspace, ψ_inf, envs_inf; sector = SU2Irrep(1)) ΔE, idx = findmin(real.(Es)) println("minimum @k = $(kspace[idx]):\t ΔE = $(ΔE)") ```` ```` -┌ Warning: resorting to η -└ @ OptimKit ~/.julia/packages/OptimKit/G6i79/src/cg.jl:207 [ Info: Found excitations for momentum = 0.0 [ Info: Found excitations for momentum = 0.20943951023931953 [ Info: Found excitations for momentum = 0.41887902047863906 @@ -256,60 +156,16 @@ println("minimum @k = $(kspace[idx]):\t ΔE = $(ΔE)") [ Info: Found excitations for momentum = 2.722713633111154 [ Info: Found excitations for momentum = 2.9321531433504737 [ Info: Found excitations for momentum = 3.141592653589793 -minimum @k = 3.141592653589793: ΔE = 0.41047924862708485 +minimum @k = 3.141592653589793: ΔE = 0.41047924851920886 ```` ````julia -plot(kspace, real.(Es); xaxis="momentum", yaxis="ΔE", label="S = 1") +plot(kspace, real.(Es); xaxis = "momentum", yaxis = "ΔE", label = "S = 1") ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` --- diff --git a/docs/src/examples/quantum1d/2.haldane/main.ipynb b/docs/src/examples/quantum1d/2.haldane/main.ipynb index a3ec1bc5c..5af3641d7 100644 --- a/docs/src/examples/quantum1d/2.haldane/main.ipynb +++ b/docs/src/examples/quantum1d/2.haldane/main.ipynb @@ -71,10 +71,10 @@ "physical_space = SU2Space(1 => 1)\n", "virtual_space = SU2Space(0 => 12, 1 => 12, 2 => 5, 3 => 3)\n", "ψ₀ = FiniteMPS(L, physical_space, virtual_space)\n", - "ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity=0))\n", + "ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity = 0))\n", "E₀ = real(expectation_value(ψ, H))\n", - "En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(1))\n", - "En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(2))\n", + "En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector = SU2Irrep(1))\n", + "En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector = SU2Irrep(2))\n", "ΔE_finite = real(En_2[1] - En_1[1])" ], "metadata": {}, @@ -91,16 +91,16 @@ "outputs": [], "cell_type": "code", "source": [ - "p_density = plot(; xaxis=\"position\", yaxis=\"energy density\")\n", + "p_density = plot(; xaxis = \"position\", yaxis = \"energy density\")\n", "excited_1 = convert(FiniteMPS, st_1[1])\n", "excited_2 = convert(FiniteMPS, st_2[1])\n", - "SS = -S_exchange(ComplexF64, SU2Irrep; spin=1)\n", + "SS = -S_exchange(ComplexF64, SU2Irrep; spin = 1)\n", "e₀ = [real(expectation_value(ψ, (i, i + 1) => SS)) for i in 1:(L - 1)]\n", "e₁ = [real(expectation_value(excited_1, (i, i + 1) => SS)) for i in 1:(L - 1)]\n", "e₂ = [real(expectation_value(excited_2, (i, i + 1) => SS)) for i in 1:(L - 1)]\n", - "plot!(p_density, e₀; label=\"S = 0\")\n", - "plot!(p_density, e₁; label=\"S = 1\")\n", - "plot!(p_density, e₂; label=\"S = 2\")" + "plot!(p_density, e₀; label = \"S = 0\")\n", + "plot!(p_density, e₁; label = \"S = 1\")\n", + "plot!(p_density, e₂; label = \"S = 2\")" ], "metadata": {}, "execution_count": null @@ -121,17 +121,17 @@ " @info \"computing L = $L\"\n", " ψ₀ = FiniteMPS(L, physical_space, virtual_space)\n", " H = heisenberg_XXX(symmetry, FiniteChain(L); J, spin)\n", - " ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity=0))\n", - " En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(1))\n", - " En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(2))\n", + " ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity = 0))\n", + " En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector = SU2Irrep(1))\n", + " En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector = SU2Irrep(2))\n", " return real(En_2[1] - En_1[1])\n", "end\n", "\n", "f = fit(Ls .^ (-2), ΔEs, 1)\n", "ΔE_extrapolated = f.coeffs[1]\n", - "p_size_extrapolation = plot(; xaxis=\"L^(-2)\", yaxis=\"ΔE\", xlims=(0, 0.015))\n", - "plot!(p_size_extrapolation, Ls .^ (-2), ΔEs; seriestype=:scatter, label=\"numerical\")\n", - "plot!(p_size_extrapolation, x -> f(x); label=\"fit\")" + "p_size_extrapolation = plot(; xaxis = \"L^(-2)\", yaxis = \"ΔE\", xlims = (0, 0.015))\n", + "plot!(p_size_extrapolation, Ls .^ (-2), ΔEs; seriestype = :scatter, label = \"numerical\")\n", + "plot!(p_size_extrapolation, x -> f(x); label = \"fit\")" ], "metadata": {}, "execution_count": null @@ -159,14 +159,14 @@ "H = heisenberg_XXX(symmetry, chain; J, spin)\n", "virtual_space_inf = Rep[SU₂](1 // 2 => 16, 3 // 2 => 16, 5 // 2 => 8, 7 // 2 => 4)\n", "ψ₀_inf = InfiniteMPS([physical_space], [virtual_space_inf])\n", - "ψ_inf, envs_inf, delta_inf = find_groundstate(ψ₀_inf, H; verbosity=0)\n", + "ψ_inf, envs_inf, delta_inf = find_groundstate(ψ₀_inf, H; verbosity = 0)\n", "\n", "kspace = range(0, π, 16)\n", - "Es, _ = excitations(H, QuasiparticleAnsatz(), kspace, ψ_inf, envs_inf; sector=SU2Irrep(1))\n", + "Es, _ = excitations(H, QuasiparticleAnsatz(), kspace, ψ_inf, envs_inf; sector = SU2Irrep(1))\n", "\n", "ΔE, idx = findmin(real.(Es))\n", "println(\"minimum @k = $(kspace[idx]):\\t ΔE = $(ΔE)\")\n", - "plot(kspace, real.(Es); xaxis=\"momentum\", yaxis=\"ΔE\", label=\"S = 1\")" + "plot(kspace, real.(Es); xaxis = \"momentum\", yaxis = \"ΔE\", label = \"S = 1\")" ], "metadata": {}, "execution_count": null @@ -187,13 +187,13 @@ "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.10.4" + "version": "1.12.0" }, "kernelspec": { - "name": "julia-1.10", - "display_name": "Julia 1.10.4", + "name": "julia-1.12", + "display_name": "Julia 1.12.0", "language": "julia" } }, "nbformat": 4 -} +} \ No newline at end of file diff --git a/docs/src/examples/quantum1d/3.ising-dqpt/index.md b/docs/src/examples/quantum1d/3.ising-dqpt/index.md index f72756afe..60b79922e 100644 --- a/docs/src/examples/quantum1d/3.ising-dqpt/index.md +++ b/docs/src/examples/quantum1d/3.ising-dqpt/index.md @@ -6,7 +6,7 @@ EditURL = "../../../../../examples/quantum1d/3.ising-dqpt/main.jl" [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](https://nbviewer.jupyter.org/github/QuantumKitHub/MPSKit.jl/blob/gh-pages/dev/examples/quantum1d/3.ising-dqpt/main.ipynb) [![](https://img.shields.io/badge/download-project-orange)](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/QuantumKitHub/MPSKit.jl/examples/tree/gh-pages/dev/examples/quantum1d/3.ising-dqpt) -# DQPT in the Ising model(@id demo_dqpt) +# [DQPT in the Ising model](@id demo_dqpt) In this tutorial we will try to reproduce the results from [this paper](https://arxiv.org/pdf/1206.2505.pdf). The needed packages are @@ -33,20 +33,19 @@ First we construct the hamiltonian in mpo form, and obtain the pre-quenched grou ````julia L = 20 -H₀ = transverse_field_ising(FiniteChain(L); g=-0.5) +H₀ = transverse_field_ising(FiniteChain(L); g = -0.5) ψ₀ = FiniteMPS(L, ℂ^2, ℂ^10) ψ₀, _ = find_groundstate(ψ₀, H₀, DMRG()); ```` ```` -[ Info: DMRG init: obj = +9.906929661608e+00 err = 1.4654e-01 -[ Info: DMRG 1: obj = -2.040021714938e+01 err = 9.3181641986e-04 time = 0.05 sec -[ Info: DMRG 2: obj = -2.040021715179e+01 err = 2.4688856530e-07 time = 0.03 sec -[ Info: DMRG 3: obj = -2.040021786221e+01 err = 4.2747944525e-05 time = 0.08 sec -[ Info: DMRG 4: obj = -2.040021786699e+01 err = 1.6446674043e-06 time = 0.04 sec -[ Info: DMRG 5: obj = -2.040021786703e+01 err = 2.4678293656e-07 time = 0.03 sec -[ Info: DMRG 6: obj = -2.040021786703e+01 err = 2.3749087526e-10 time = 0.03 sec -[ Info: DMRG conv 7: obj = -2.040021786703e+01 err = 4.3310784899e-12 time = 0.29 sec +[ Info: DMRG init: obj = +9.814858589284e+00 err = 6.2050e-01 +[ Info: DMRG 1: obj = -2.040021714839e+01 err = 2.3171232950e-03 time = 0.03 sec +[ Info: DMRG 2: obj = -2.040021715177e+01 err = 2.1683169804e-07 time = 0.02 sec +[ Info: DMRG 3: obj = -2.040021782399e+01 err = 3.6729918367e-05 time = 0.06 sec +[ Info: DMRG 4: obj = -2.040021786693e+01 err = 1.5200955823e-06 time = 0.03 sec +[ Info: DMRG 5: obj = -2.040021786703e+01 err = 2.8646117610e-07 time = 0.03 sec +[ Info: DMRG conv 6: obj = -2.040021786703e+01 err = 7.0484493208e-11 time = 0.18 sec ```` @@ -56,16 +55,16 @@ We can define a helper function that measures the loschmith echo ````julia echo(ψ₀::FiniteMPS, ψₜ::FiniteMPS) = -2 * log(abs(dot(ψ₀, ψₜ))) / length(ψ₀) -@assert isapprox(echo(ψ₀, ψ₀), 0, atol=1e-10) +@assert isapprox(echo(ψ₀, ψ₀), 0, atol = 1.0e-10) ```` We will initially use a two-site TDVP scheme to dynamically increase the bond dimension while time evolving, and later on switch to a faster one-site scheme. A single timestep can be done using ````julia -H₁ = transverse_field_ising(FiniteChain(L); g=-2.0) +H₁ = transverse_field_ising(FiniteChain(L); g = -2.0) ψₜ = deepcopy(ψ₀) dt = 0.01 -ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP2(; trscheme=truncdim(20))); +ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP2(; trscheme = truncrank(20))); ```` "envs" is a kind of cache object that keeps track of all environments in `ψ`. It is often advantageous to re-use the environment, so that mpskit doesn't need to recalculate everything. @@ -73,12 +72,12 @@ dt = 0.01 Putting it all together, we get ````julia -function finite_sim(L; dt=0.05, finaltime=5.0) +function finite_sim(L; dt = 0.05, finaltime = 5.0) ψ₀ = FiniteMPS(L, ℂ^2, ℂ^10) - H₀ = transverse_field_ising(FiniteChain(L); g=-0.5) + H₀ = transverse_field_ising(FiniteChain(L); g = -0.5) ψ₀, _ = find_groundstate(ψ₀, H₀, DMRG()) - H₁ = transverse_field_ising(FiniteChain(L); g=-2.0) + H₁ = transverse_field_ising(FiniteChain(L); g = -2.0) ψₜ = deepcopy(ψ₀) envs = environments(ψₜ, H₁) @@ -86,7 +85,7 @@ function finite_sim(L; dt=0.05, finaltime=5.0) times = collect(0:dt:finaltime) for t in times[2:end] - alg = t > 3 * dt ? TDVP() : TDVP2(; trscheme=truncdim(50)) + alg = t > 3 * dt ? TDVP() : TDVP2(; trscheme = truncrank(50)) ψₜ, envs = timestep(ψₜ, H₁, 0, dt, alg, envs) push!(echos, echo(ψₜ, ψ₀)) end @@ -107,18 +106,19 @@ Similarly we could start with an initial infinite state and find the pre-quench ````julia ψ₀ = InfiniteMPS([ℂ^2], [ℂ^10]) -H₀ = transverse_field_ising(; g=-0.5) +H₀ = transverse_field_ising(; g = -0.5) ψ₀, _ = find_groundstate(ψ₀, H₀, VUMPS()); ```` ```` -[ Info: VUMPS init: obj = +4.937592959715e-01 err = 3.8640e-01 -[ Info: VUMPS 1: obj = -1.041532472680e+00 err = 1.0207037612e-01 time = 7.91 sec -[ Info: VUMPS 2: obj = -1.063544395012e+00 err = 1.0570052184e-04 time = 0.01 sec -[ Info: VUMPS 3: obj = -1.063544409972e+00 err = 1.3451291600e-06 time = 0.01 sec -[ Info: VUMPS 4: obj = -1.063544409973e+00 err = 2.1982905922e-08 time = 0.00 sec -[ Info: VUMPS 5: obj = -1.063544409973e+00 err = 8.6218866571e-10 time = 0.00 sec -[ Info: VUMPS conv 6: obj = -1.063544409973e+00 err = 7.1345139950e-11 time = 7.94 sec +[ Info: VUMPS init: obj = +4.868298549128e-01 err = 3.9079e-01 +[ Info: VUMPS 1: obj = -1.058483590962e+00 err = 7.5407605847e-02 time = 7.02 sec +[ Info: VUMPS 2: obj = -1.063544286238e+00 err = 3.1160989378e-04 time = 0.01 sec +[ Info: VUMPS 3: obj = -1.063544409943e+00 err = 5.9017642250e-06 time = 0.01 sec +[ Info: VUMPS 4: obj = -1.063544409973e+00 err = 1.5639699231e-07 time = 0.00 sec +[ Info: VUMPS 5: obj = -1.063544409973e+00 err = 5.8340710042e-09 time = 0.00 sec +[ Info: VUMPS 6: obj = -1.063544409973e+00 err = 3.3087676594e-10 time = 0.00 sec +[ Info: VUMPS conv 7: obj = -1.063544409973e+00 err = 3.9690136612e-11 time = 7.05 sec ```` @@ -130,14 +130,14 @@ dot(ψ₀, ψ₀) ```` ```` -0.9999999999999991 + 5.43344267830843e-16im +1.000000000000001 - 2.1950801504054652e-16im ```` so the loschmidth echo takes on the pleasant form ````julia echo(ψ₀::InfiniteMPS, ψₜ::InfiniteMPS) = -2 * log(abs(dot(ψ₀, ψₜ))) -@assert isapprox(echo(ψ₀, ψ₀), 0, atol=1e-10) +@assert isapprox(echo(ψ₀, ψ₀), 0, atol = 1.0e-10) ```` This time we cannot use a two-site scheme to grow the bond dimension, as this isn't implemented (yet). @@ -147,8 +147,8 @@ Growing the bond dimension by ``5`` can be done by calling: ````julia ψₜ = deepcopy(ψ₀) -H₁ = transverse_field_ising(; g=-2.0) -ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(5))); +H₁ = transverse_field_ising(; g = -2.0) +ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme = truncrank(5))); ```` a single timestep is easy @@ -162,7 +162,7 @@ With performance in mind we should once again try to re-use these "envs" cache o The final code is ````julia -function infinite_sim(dt=0.05, finaltime=5.0) +function infinite_sim(dt = 0.05, finaltime = 5.0) ψ₀ = InfiniteMPS([ℂ^2], [ℂ^10]) ψ₀, _ = find_groundstate(ψ₀, H₀, VUMPS()) @@ -174,7 +174,7 @@ function infinite_sim(dt=0.05, finaltime=5.0) for t in times[2:end] if t < 50dt # if t is sufficiently small, we increase the bond dimension - ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(1)), envs) + ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme = truncrank(1)), envs) end ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP(), envs) push!(echos, echo(ψₜ, ψ₀)) diff --git a/docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb b/docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb index 983169527..03f23362a 100644 --- a/docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb +++ b/docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb @@ -3,7 +3,7 @@ { "cell_type": "markdown", "source": [ - "# DQPT in the Ising model(@id demo_dqpt)\n", + "# DQPT in the Ising model\n", "\n", "In this tutorial we will try to reproduce the results from\n", "[this paper](https://arxiv.org/pdf/1206.2505.pdf). The needed packages are" @@ -45,7 +45,7 @@ "cell_type": "code", "source": [ "L = 20\n", - "H₀ = transverse_field_ising(FiniteChain(L); g=-0.5)\n", + "H₀ = transverse_field_ising(FiniteChain(L); g = -0.5)\n", "ψ₀ = FiniteMPS(L, ℂ^2, ℂ^10)\n", "ψ₀, _ = find_groundstate(ψ₀, H₀, DMRG());" ], @@ -66,7 +66,7 @@ "cell_type": "code", "source": [ "echo(ψ₀::FiniteMPS, ψₜ::FiniteMPS) = -2 * log(abs(dot(ψ₀, ψₜ))) / length(ψ₀)\n", - "@assert isapprox(echo(ψ₀, ψ₀), 0, atol=1e-10)" + "@assert isapprox(echo(ψ₀, ψ₀), 0, atol = 1.0e-10)" ], "metadata": {}, "execution_count": null @@ -82,10 +82,10 @@ "outputs": [], "cell_type": "code", "source": [ - "H₁ = transverse_field_ising(FiniteChain(L); g=-2.0)\n", + "H₁ = transverse_field_ising(FiniteChain(L); g = -2.0)\n", "ψₜ = deepcopy(ψ₀)\n", "dt = 0.01\n", - "ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP2(; trscheme=truncdim(20)));" + "ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP2(; trscheme = truncrank(20)));" ], "metadata": {}, "execution_count": null @@ -103,12 +103,12 @@ "outputs": [], "cell_type": "code", "source": [ - "function finite_sim(L; dt=0.05, finaltime=5.0)\n", + "function finite_sim(L; dt = 0.05, finaltime = 5.0)\n", " ψ₀ = FiniteMPS(L, ℂ^2, ℂ^10)\n", - " H₀ = transverse_field_ising(FiniteChain(L); g=-0.5)\n", + " H₀ = transverse_field_ising(FiniteChain(L); g = -0.5)\n", " ψ₀, _ = find_groundstate(ψ₀, H₀, DMRG())\n", "\n", - " H₁ = transverse_field_ising(FiniteChain(L); g=-2.0)\n", + " H₁ = transverse_field_ising(FiniteChain(L); g = -2.0)\n", " ψₜ = deepcopy(ψ₀)\n", " envs = environments(ψₜ, H₁)\n", "\n", @@ -116,7 +116,7 @@ " times = collect(0:dt:finaltime)\n", "\n", " for t in times[2:end]\n", - " alg = t > 3 * dt ? TDVP() : TDVP2(; trscheme=truncdim(50))\n", + " alg = t > 3 * dt ? TDVP() : TDVP2(; trscheme = truncrank(50))\n", " ψₜ, envs = timestep(ψₜ, H₁, 0, dt, alg, envs)\n", " push!(echos, echo(ψₜ, ψ₀))\n", " end\n", @@ -148,7 +148,7 @@ "cell_type": "code", "source": [ "ψ₀ = InfiniteMPS([ℂ^2], [ℂ^10])\n", - "H₀ = transverse_field_ising(; g=-0.5)\n", + "H₀ = transverse_field_ising(; g = -0.5)\n", "ψ₀, _ = find_groundstate(ψ₀, H₀, VUMPS());" ], "metadata": {}, @@ -183,7 +183,7 @@ "cell_type": "code", "source": [ "echo(ψ₀::InfiniteMPS, ψₜ::InfiniteMPS) = -2 * log(abs(dot(ψ₀, ψₜ)))\n", - "@assert isapprox(echo(ψ₀, ψ₀), 0, atol=1e-10)" + "@assert isapprox(echo(ψ₀, ψ₀), 0, atol = 1.0e-10)" ], "metadata": {}, "execution_count": null @@ -203,8 +203,8 @@ "cell_type": "code", "source": [ "ψₜ = deepcopy(ψ₀)\n", - "H₁ = transverse_field_ising(; g=-2.0)\n", - "ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(5)));" + "H₁ = transverse_field_ising(; g = -2.0)\n", + "ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme = truncrank(5)));" ], "metadata": {}, "execution_count": null @@ -238,7 +238,7 @@ "outputs": [], "cell_type": "code", "source": [ - "function infinite_sim(dt=0.05, finaltime=5.0)\n", + "function infinite_sim(dt = 0.05, finaltime = 5.0)\n", " ψ₀ = InfiniteMPS([ℂ^2], [ℂ^10])\n", " ψ₀, _ = find_groundstate(ψ₀, H₀, VUMPS())\n", "\n", @@ -250,7 +250,7 @@ "\n", " for t in times[2:end]\n", " if t < 50dt # if t is sufficiently small, we increase the bond dimension\n", - " ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(1)), envs)\n", + " ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme = truncrank(1)), envs)\n", " end\n", " ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP(), envs)\n", " push!(echos, echo(ψₜ, ψ₀))\n", @@ -285,13 +285,13 @@ "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.10.4" + "version": "1.12.0" }, "kernelspec": { - "name": "julia-1.10", - "display_name": "Julia 1.10.4", + "name": "julia-1.12", + "display_name": "Julia 1.12.0", "language": "julia" } }, "nbformat": 4 -} +} \ No newline at end of file diff --git a/docs/src/examples/quantum1d/4.xxz-heisenberg/index.md b/docs/src/examples/quantum1d/4.xxz-heisenberg/index.md index 01541310e..712b6b3ef 100644 --- a/docs/src/examples/quantum1d/4.xxz-heisenberg/index.md +++ b/docs/src/examples/quantum1d/4.xxz-heisenberg/index.md @@ -22,13 +22,13 @@ Then we specify an initial guess, which we then further optimize. Working directly in the thermodynamic limit, this is achieved as follows: ````julia -H = heisenberg_XXX(; spin=1 // 2) +H = heisenberg_XXX(; spin = 1 // 2) ```` ```` single site InfiniteMPOHamiltonian{MPSKit.JordanMPOTensor{ComplexF64, TensorKit.ComplexSpace, Union{TensorKit.BraidingTensor{ComplexF64, TensorKit.ComplexSpace}, TensorKit.TensorMap{ComplexF64, TensorKit.ComplexSpace, 2, 2, Vector{ComplexF64}}}, TensorKit.TensorMap{ComplexF64, TensorKit.ComplexSpace, 2, 1, Vector{ComplexF64}}, TensorKit.TensorMap{ComplexF64, TensorKit.ComplexSpace, 1, 2, Vector{ComplexF64}}, TensorKit.TensorMap{ComplexF64, TensorKit.ComplexSpace, 1, 1, Vector{ComplexF64}}}}: ╷ ⋮ -┼ W[1]: 3×1×1×3 JordanMPOTensor(((ℂ^1 ⊕ ℂ^3 ⊕ ℂ^1) ⊗ ⊕(ℂ^2)) ← (⊕(ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^3 ⊕ ℂ^1))) +┼ W[1]: 3×1×1×3 JordanMPOTensor(((ℂ^1 ⊞ ℂ^3 ⊞ ℂ^1) ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ (ℂ^1 ⊞ ℂ^3 ⊞ ℂ^1))) ╵ ⋮ ```` @@ -55,208 +55,208 @@ groundstate, cache, delta = find_groundstate(state, H, VUMPS()); ```` ```` -[ Info: VUMPS init: obj = +2.499952940580e-01 err = 6.3441e-03 -[ Info: VUMPS 1: obj = -1.289444927303e-01 err = 3.6505534112e-01 time = 0.02 sec -[ Info: VUMPS 2: obj = -3.046604131170e-01 err = 3.5438451443e-01 time = 0.03 sec -[ Info: VUMPS 3: obj = -1.151380226837e-01 err = 3.7396849153e-01 time = 0.03 sec -[ Info: VUMPS 4: obj = -7.859906223027e-02 err = 3.8101931668e-01 time = 0.02 sec -[ Info: VUMPS 5: obj = -8.570311273681e-02 err = 4.5415600150e-01 time = 0.04 sec -[ Info: VUMPS 6: obj = -1.607866955582e-01 err = 3.7328533114e-01 time = 0.02 sec -[ Info: VUMPS 7: obj = -2.590055398932e-01 err = 3.6315039435e-01 time = 0.02 sec -[ Info: VUMPS 8: obj = -3.985401345056e-01 err = 2.4797713082e-01 time = 0.03 sec -[ Info: VUMPS 9: obj = -2.980269171709e-01 err = 3.5009326244e-01 time = 0.04 sec -[ Info: VUMPS 10: obj = -7.766811941836e-02 err = 3.7146004460e-01 time = 0.04 sec -[ Info: VUMPS 11: obj = -1.513433486022e-01 err = 3.9298119907e-01 time = 0.04 sec -[ Info: VUMPS 12: obj = -1.636153457041e-01 err = 3.8567245083e-01 time = 0.02 sec -[ Info: VUMPS 13: obj = -8.850847675954e-02 err = 3.8567080613e-01 time = 0.03 sec -[ Info: VUMPS 14: obj = -1.933682984363e-01 err = 3.8578605637e-01 time = 0.08 sec -[ Info: VUMPS 15: obj = -4.668791737320e-02 err = 4.0507831578e-01 time = 0.03 sec -[ Info: VUMPS 16: obj = -6.685207964181e-02 err = 4.4181563160e-01 time = 0.03 sec -[ Info: VUMPS 17: obj = -2.672203890897e-01 err = 3.3906178990e-01 time = 0.03 sec -[ Info: VUMPS 18: obj = -3.428995365711e-01 err = 3.2686747553e-01 time = 0.03 sec -[ Info: VUMPS 19: obj = -2.863734743969e-01 err = 3.5064087667e-01 time = 0.04 sec -[ Info: VUMPS 20: obj = -1.067319756533e-01 err = 3.8187305789e-01 time = 0.03 sec -[ Info: VUMPS 21: obj = -1.318548228297e-01 err = 3.6108954481e-01 time = 0.02 sec -[ Info: VUMPS 22: obj = -4.044279153596e-02 err = 3.7520252599e-01 time = 0.02 sec -[ Info: VUMPS 23: obj = -3.945104968675e-02 err = 3.9224571991e-01 time = 0.03 sec -[ Info: VUMPS 24: obj = -2.671412452672e-01 err = 3.6585228539e-01 time = 0.03 sec -[ Info: VUMPS 25: obj = -3.310347250642e-01 err = 3.1899906877e-01 time = 0.03 sec -[ Info: VUMPS 26: obj = -2.168383952062e-01 err = 3.7166034087e-01 time = 0.03 sec -[ Info: VUMPS 27: obj = -3.507015235665e-01 err = 3.0330946464e-01 time = 0.04 sec -[ Info: VUMPS 28: obj = -2.810889490868e-01 err = 3.5384589143e-01 time = 0.04 sec -[ Info: VUMPS 29: obj = -1.491679715343e-01 err = 3.7712897712e-01 time = 0.03 sec -[ Info: VUMPS 30: obj = -2.103310942986e-01 err = 3.6804474254e-01 time = 0.02 sec -[ Info: VUMPS 31: obj = -2.570407107876e-01 err = 3.5647467556e-01 time = 0.03 sec -[ Info: VUMPS 32: obj = -2.622474733096e-01 err = 3.6359049960e-01 time = 0.03 sec -[ Info: VUMPS 33: obj = -2.747408111088e-01 err = 3.5217438909e-01 time = 0.02 sec -[ Info: VUMPS 34: obj = -2.795011381225e-01 err = 3.5577849785e-01 time = 0.03 sec -[ Info: VUMPS 35: obj = +6.109686520960e-02 err = 3.7478423163e-01 time = 0.03 sec -[ Info: VUMPS 36: obj = -3.235177003488e-01 err = 3.2501656960e-01 time = 0.03 sec -[ Info: VUMPS 37: obj = -3.607718277418e-01 err = 3.0399210370e-01 time = 0.03 sec -[ Info: VUMPS 38: obj = -1.522405023809e-01 err = 3.8460611720e-01 time = 0.03 sec -[ Info: VUMPS 39: obj = -1.401486230679e-01 err = 4.2359144803e-01 time = 0.04 sec -[ Info: VUMPS 40: obj = -3.016337945443e-01 err = 3.3760785136e-01 time = 0.02 sec -[ Info: VUMPS 41: obj = -3.592630330471e-01 err = 2.8277667197e-01 time = 0.04 sec -[ Info: VUMPS 42: obj = -9.648261609327e-02 err = 3.9800363224e-01 time = 0.03 sec -[ Info: VUMPS 43: obj = -2.068120169738e-01 err = 3.4795790120e-01 time = 0.07 sec -[ Info: VUMPS 44: obj = -3.320461487347e-01 err = 3.3031447114e-01 time = 0.03 sec -[ Info: VUMPS 45: obj = -2.748266113721e-01 err = 3.3719047760e-01 time = 0.03 sec -[ Info: VUMPS 46: obj = +5.825197478980e-02 err = 3.7299269867e-01 time = 0.03 sec -[ Info: VUMPS 47: obj = -2.209737585465e-01 err = 3.6224489048e-01 time = 0.03 sec -[ Info: VUMPS 48: obj = -3.495730972764e-01 err = 3.1370483925e-01 time = 0.03 sec -[ Info: VUMPS 49: obj = -1.184295942341e-02 err = 3.8132184336e-01 time = 0.03 sec -[ Info: VUMPS 50: obj = -2.253818587474e-01 err = 3.6351801471e-01 time = 0.02 sec -[ Info: VUMPS 51: obj = -2.611723114106e-01 err = 3.6263568517e-01 time = 0.04 sec -[ Info: VUMPS 52: obj = -2.391735319717e-01 err = 3.4034883778e-01 time = 0.03 sec -[ Info: VUMPS 53: obj = -2.076637304355e-01 err = 3.7785371429e-01 time = 0.03 sec -[ Info: VUMPS 54: obj = +1.233357556406e-01 err = 3.6817687888e-01 time = 0.03 sec -[ Info: VUMPS 55: obj = -1.064547626837e-02 err = 3.6875802199e-01 time = 0.03 sec -[ Info: VUMPS 56: obj = -1.051495232666e-01 err = 4.0131031658e-01 time = 0.03 sec -[ Info: VUMPS 57: obj = -1.412941986925e-01 err = 3.8676020133e-01 time = 0.02 sec -[ Info: VUMPS 58: obj = -5.105594856383e-02 err = 4.1918593555e-01 time = 0.03 sec -[ Info: VUMPS 59: obj = -9.429180669034e-02 err = 3.5663676393e-01 time = 0.02 sec -[ Info: VUMPS 60: obj = -3.211645595234e-01 err = 3.3556696008e-01 time = 0.03 sec -[ Info: VUMPS 61: obj = -4.997897659120e-02 err = 3.6911454941e-01 time = 0.03 sec -[ Info: VUMPS 62: obj = +5.061815735283e-02 err = 3.9240870402e-01 time = 0.03 sec -[ Info: VUMPS 63: obj = -2.858216622151e-02 err = 3.9031720030e-01 time = 0.03 sec -[ Info: VUMPS 64: obj = -3.066897558850e-01 err = 3.4219120029e-01 time = 0.02 sec -[ Info: VUMPS 65: obj = -1.035726948011e-01 err = 3.9992774981e-01 time = 0.03 sec -[ Info: VUMPS 66: obj = +9.359087106400e-02 err = 3.2551512023e-01 time = 0.03 sec -[ Info: VUMPS 67: obj = -1.506323639493e-01 err = 3.8851758838e-01 time = 0.03 sec -[ Info: VUMPS 68: obj = -2.694024194911e-01 err = 3.4908885270e-01 time = 0.02 sec -[ Info: VUMPS 69: obj = -1.666459363907e-01 err = 3.7191916042e-01 time = 0.03 sec -[ Info: VUMPS 70: obj = -3.295401946651e-01 err = 3.2485997665e-01 time = 0.02 sec -[ Info: VUMPS 71: obj = -1.716492900593e-01 err = 3.4774685002e-01 time = 0.05 sec -[ Info: VUMPS 72: obj = -2.062243894572e-01 err = 3.4367048189e-01 time = 0.03 sec -[ Info: VUMPS 73: obj = -2.270916009662e-01 err = 3.4883289649e-01 time = 0.04 sec -[ Info: VUMPS 74: obj = +6.972996650156e-03 err = 3.6664495072e-01 time = 0.03 sec -[ Info: VUMPS 75: obj = -2.140897386871e-01 err = 3.6896873908e-01 time = 0.02 sec -[ Info: VUMPS 76: obj = -2.776215003655e-01 err = 3.5162263908e-01 time = 0.03 sec -[ Info: VUMPS 77: obj = -2.548517060346e-01 err = 3.5985886200e-01 time = 0.04 sec -[ Info: VUMPS 78: obj = -3.627093129660e-01 err = 2.8522543561e-01 time = 0.04 sec -[ Info: VUMPS 79: obj = -4.246979337066e-01 err = 1.8433888114e-01 time = 0.04 sec -[ Info: VUMPS 80: obj = -2.768088632211e-01 err = 3.6889157455e-01 time = 0.04 sec -[ Info: VUMPS 81: obj = -3.333529535371e-01 err = 3.2461308190e-01 time = 0.04 sec -[ Info: VUMPS 82: obj = +9.739742280028e-02 err = 3.6140350665e-01 time = 0.04 sec -[ Info: VUMPS 83: obj = -8.001219240663e-02 err = 3.3065484133e-01 time = 0.03 sec -[ Info: VUMPS 84: obj = -1.494867091384e-01 err = 3.6515333400e-01 time = 0.02 sec -[ Info: VUMPS 85: obj = -3.357585607378e-01 err = 3.2062204533e-01 time = 0.03 sec -[ Info: VUMPS 86: obj = -1.214350882454e-01 err = 3.8756516414e-01 time = 0.03 sec -[ Info: VUMPS 87: obj = -1.720890136641e-01 err = 3.7209498473e-01 time = 0.03 sec -[ Info: VUMPS 88: obj = -2.513176623582e-01 err = 3.6428215490e-01 time = 0.03 sec -[ Info: VUMPS 89: obj = -1.167825455975e-01 err = 3.7816700280e-01 time = 0.03 sec -[ Info: VUMPS 90: obj = -1.487085246354e-01 err = 3.8452112070e-01 time = 0.03 sec -[ Info: VUMPS 91: obj = -1.492511193594e-01 err = 3.6888008833e-01 time = 0.04 sec -[ Info: VUMPS 92: obj = -2.942886788237e-01 err = 3.3926362090e-01 time = 0.02 sec -[ Info: VUMPS 93: obj = -2.513546381842e-01 err = 3.5669021055e-01 time = 0.04 sec -[ Info: VUMPS 94: obj = -2.592696224289e-01 err = 3.8742412819e-01 time = 0.04 sec -[ Info: VUMPS 95: obj = -1.670969129733e-01 err = 4.0396565424e-01 time = 0.04 sec -[ Info: VUMPS 96: obj = -8.982884784032e-02 err = 4.0673356787e-01 time = 0.04 sec -[ Info: VUMPS 97: obj = -1.162574886965e-01 err = 4.0014599231e-01 time = 0.03 sec -[ Info: VUMPS 98: obj = -9.485766256473e-02 err = 3.6567908225e-01 time = 0.02 sec -[ Info: VUMPS 99: obj = -1.626897465348e-01 err = 3.9836027057e-01 time = 0.06 sec -[ Info: VUMPS 100: obj = -2.820414385240e-01 err = 3.3860149095e-01 time = 0.02 sec -[ Info: VUMPS 101: obj = +3.653164331064e-03 err = 3.8214630304e-01 time = 0.04 sec -[ Info: VUMPS 102: obj = -1.488426870678e-01 err = 3.5921878796e-01 time = 0.02 sec -[ Info: VUMPS 103: obj = -3.107550441980e-01 err = 3.3205507908e-01 time = 0.03 sec -[ Info: VUMPS 104: obj = -2.991475468045e-01 err = 3.4083808929e-01 time = 0.04 sec -[ Info: VUMPS 105: obj = -1.521003309052e-01 err = 4.0772463716e-01 time = 0.05 sec -[ Info: VUMPS 106: obj = -8.123652136498e-02 err = 3.7546849297e-01 time = 0.03 sec -[ Info: VUMPS 107: obj = -2.596284651709e-01 err = 3.4976630049e-01 time = 0.03 sec -[ Info: VUMPS 108: obj = -2.935877769698e-01 err = 3.3783749995e-01 time = 0.04 sec -[ Info: VUMPS 109: obj = -2.402370295781e-01 err = 3.6810295199e-01 time = 0.04 sec -[ Info: VUMPS 110: obj = -3.150592845722e-01 err = 3.3233905128e-01 time = 0.04 sec -[ Info: VUMPS 111: obj = -3.266942906048e-01 err = 3.3265129842e-01 time = 0.05 sec -[ Info: VUMPS 112: obj = -3.089623364833e-02 err = 3.8736213578e-01 time = 0.03 sec -[ Info: VUMPS 113: obj = +1.187921857755e-01 err = 3.5846597520e-01 time = 0.03 sec -[ Info: VUMPS 114: obj = -6.812831791961e-02 err = 3.6601110780e-01 time = 0.03 sec -[ Info: VUMPS 115: obj = -2.169545739645e-02 err = 3.7328578080e-01 time = 0.02 sec -[ Info: VUMPS 116: obj = -6.651891606433e-02 err = 3.7799893055e-01 time = 0.03 sec -[ Info: VUMPS 117: obj = -7.188213532364e-02 err = 3.9041626270e-01 time = 0.02 sec -[ Info: VUMPS 118: obj = -1.858708677528e-01 err = 3.8364886262e-01 time = 0.02 sec -[ Info: VUMPS 119: obj = -1.426092420792e-01 err = 4.0022614912e-01 time = 0.04 sec -[ Info: VUMPS 120: obj = -5.966800560939e-02 err = 3.7475162153e-01 time = 0.03 sec -[ Info: VUMPS 121: obj = -1.927011968813e-01 err = 3.7213373940e-01 time = 0.02 sec -[ Info: VUMPS 122: obj = -1.332482420009e-01 err = 3.9823332335e-01 time = 0.03 sec -[ Info: VUMPS 123: obj = -5.583604028721e-02 err = 3.8811845128e-01 time = 0.02 sec -[ Info: VUMPS 124: obj = -1.173769997886e-01 err = 3.9758982598e-01 time = 0.03 sec -[ Info: VUMPS 125: obj = -1.623302909431e-01 err = 3.9006196969e-01 time = 0.03 sec -[ Info: VUMPS 126: obj = -1.945385790084e-01 err = 3.7801724719e-01 time = 0.06 sec -[ Info: VUMPS 127: obj = -1.198866351263e-01 err = 3.8641158608e-01 time = 0.04 sec -[ Info: VUMPS 128: obj = -4.982327612008e-02 err = 3.8983422860e-01 time = 0.02 sec -[ Info: VUMPS 129: obj = -1.566708742911e-01 err = 3.6570433006e-01 time = 0.03 sec -[ Info: VUMPS 130: obj = -3.746845720087e-01 err = 2.7790316765e-01 time = 0.03 sec -[ Info: VUMPS 131: obj = -4.113990855397e-01 err = 2.1938734166e-01 time = 0.04 sec -[ Info: VUMPS 132: obj = +2.987037930122e-02 err = 3.9820435991e-01 time = 0.03 sec -[ Info: VUMPS 133: obj = -1.361451053253e-01 err = 3.5853656852e-01 time = 0.04 sec -[ Info: VUMPS 134: obj = +1.459826659542e-02 err = 3.6344259860e-01 time = 0.02 sec -[ Info: VUMPS 135: obj = -1.625462338965e-01 err = 3.8750540849e-01 time = 0.03 sec -[ Info: VUMPS 136: obj = -1.945260498995e-01 err = 3.7322465363e-01 time = 0.03 sec -[ Info: VUMPS 137: obj = -2.378874547137e-01 err = 3.5236618024e-01 time = 0.02 sec -[ Info: VUMPS 138: obj = -3.397752713889e-01 err = 3.1681390396e-01 time = 0.04 sec -[ Info: VUMPS 139: obj = +3.872021456876e-02 err = 3.9044746200e-01 time = 0.03 sec -[ Info: VUMPS 140: obj = -2.931409673729e-02 err = 4.0519520800e-01 time = 0.03 sec -[ Info: VUMPS 141: obj = -3.558928281290e-02 err = 3.9408216725e-01 time = 0.03 sec -[ Info: VUMPS 142: obj = -7.419482234602e-02 err = 3.5450836272e-01 time = 0.03 sec -[ Info: VUMPS 143: obj = -1.320472388492e-01 err = 3.8629858112e-01 time = 0.02 sec -[ Info: VUMPS 144: obj = -9.540887842838e-02 err = 3.6612197907e-01 time = 0.03 sec -[ Info: VUMPS 145: obj = -1.425512039944e-01 err = 3.8151598515e-01 time = 0.02 sec -[ Info: VUMPS 146: obj = -1.889146812574e-01 err = 3.7124283218e-01 time = 0.03 sec -[ Info: VUMPS 147: obj = -2.150431811539e-01 err = 3.5676583668e-01 time = 0.02 sec -[ Info: VUMPS 148: obj = -5.190628673026e-02 err = 3.8934562140e-01 time = 0.02 sec -[ Info: VUMPS 149: obj = -1.783612875181e-01 err = 3.6973710837e-01 time = 0.03 sec -[ Info: VUMPS 150: obj = -1.973875305247e-01 err = 3.7126107705e-01 time = 0.02 sec -[ Info: VUMPS 151: obj = -2.899275740844e-01 err = 3.6876702526e-01 time = 0.03 sec -[ Info: VUMPS 152: obj = -1.958917623537e-01 err = 3.6026243367e-01 time = 0.04 sec -[ Info: VUMPS 153: obj = -1.658053486005e-01 err = 3.7110180704e-01 time = 0.03 sec -[ Info: VUMPS 154: obj = -1.826177780294e-01 err = 4.1264125075e-01 time = 0.06 sec -[ Info: VUMPS 155: obj = -1.059120939251e-02 err = 3.9019355474e-01 time = 0.04 sec -[ Info: VUMPS 156: obj = -1.197063315403e-01 err = 3.8266860150e-01 time = 0.03 sec -[ Info: VUMPS 157: obj = -1.518053401692e-01 err = 3.9773151275e-01 time = 0.03 sec -[ Info: VUMPS 158: obj = -3.627713872160e-01 err = 3.0031072551e-01 time = 0.03 sec -[ Info: VUMPS 159: obj = -3.817082298432e-01 err = 2.7493910948e-01 time = 0.04 sec -[ Info: VUMPS 160: obj = -3.859619689587e-01 err = 2.7048867198e-01 time = 0.04 sec -[ Info: VUMPS 161: obj = -4.307827862211e-01 err = 1.2679659771e-01 time = 0.05 sec -[ Info: VUMPS 162: obj = -4.409832181424e-01 err = 5.1946083987e-02 time = 0.05 sec -[ Info: VUMPS 163: obj = -3.974418237321e-01 err = 2.6311596995e-01 time = 0.06 sec -[ Info: VUMPS 164: obj = -1.705693106104e-01 err = 3.7489488650e-01 time = 0.04 sec -[ Info: VUMPS 165: obj = -2.811377309143e-01 err = 3.5373076558e-01 time = 0.02 sec -[ Info: VUMPS 166: obj = -3.580031548549e-01 err = 3.0296648457e-01 time = 0.03 sec -[ Info: VUMPS 167: obj = -3.498256310994e-01 err = 3.0138171612e-01 time = 0.04 sec -[ Info: VUMPS 168: obj = -3.961930709656e-01 err = 2.3106926668e-01 time = 0.05 sec -[ Info: VUMPS 169: obj = -3.012322573839e-01 err = 3.4871517230e-01 time = 0.05 sec -[ Info: VUMPS 170: obj = -3.236118252223e-01 err = 3.2683561230e-01 time = 0.03 sec -[ Info: VUMPS 171: obj = -4.207960751090e-01 err = 1.9439910804e-01 time = 0.04 sec -[ Info: VUMPS 172: obj = +6.486820083537e-02 err = 3.7997567109e-01 time = 0.04 sec -[ Info: VUMPS 173: obj = -2.205989590288e-01 err = 3.5392631042e-01 time = 0.02 sec -[ Info: VUMPS 174: obj = -3.040541044421e-01 err = 3.4795284083e-01 time = 0.02 sec -[ Info: VUMPS 175: obj = -2.700316483862e-01 err = 3.5371268695e-01 time = 0.04 sec -[ Info: VUMPS 176: obj = -1.451879669536e-01 err = 3.7441207912e-01 time = 0.03 sec -[ Info: VUMPS 177: obj = -1.675392520421e-01 err = 3.5821939134e-01 time = 0.03 sec -[ Info: VUMPS 178: obj = -1.067646782592e-01 err = 3.5902159365e-01 time = 0.02 sec -[ Info: VUMPS 179: obj = +5.087477936752e-02 err = 3.8379007723e-01 time = 0.06 sec -[ Info: VUMPS 180: obj = +2.700648055200e-02 err = 3.5560967889e-01 time = 0.03 sec -[ Info: VUMPS 181: obj = -4.040983881654e-02 err = 3.1955366201e-01 time = 0.03 sec -[ Info: VUMPS 182: obj = -2.974889920215e-01 err = 3.4443915929e-01 time = 0.03 sec -[ Info: VUMPS 183: obj = -3.470958294750e-01 err = 3.1478705957e-01 time = 0.03 sec -[ Info: VUMPS 184: obj = -2.257989223447e-01 err = 3.8360838997e-01 time = 0.04 sec -[ Info: VUMPS 185: obj = -1.892095032963e-01 err = 3.9861950100e-01 time = 0.04 sec -[ Info: VUMPS 186: obj = -1.178703030512e-01 err = 3.9409430451e-01 time = 0.03 sec -[ Info: VUMPS 187: obj = -1.803058178275e-01 err = 3.8179418477e-01 time = 0.02 sec -[ Info: VUMPS 188: obj = +2.026839055691e-02 err = 3.9195067790e-01 time = 0.02 sec -[ Info: VUMPS 189: obj = -2.213025303557e-01 err = 3.6496697752e-01 time = 0.03 sec -[ Info: VUMPS 190: obj = -3.308949018046e-01 err = 3.0825188354e-01 time = 0.03 sec -[ Info: VUMPS 191: obj = -3.358030111876e-01 err = 3.2213471244e-01 time = 0.04 sec -[ Info: VUMPS 192: obj = -3.879783512495e-01 err = 2.6554883101e-01 time = 0.04 sec -[ Info: VUMPS 193: obj = -4.235762853319e-01 err = 1.6965146723e-01 time = 0.04 sec -[ Info: VUMPS 194: obj = -2.904118238494e-01 err = 3.5667684109e-01 time = 0.06 sec -[ Info: VUMPS 195: obj = -2.142437785647e-01 err = 3.8141868514e-01 time = 0.04 sec -[ Info: VUMPS 196: obj = -7.074078690463e-02 err = 3.4787569806e-01 time = 0.04 sec -[ Info: VUMPS 197: obj = -1.976927769100e-01 err = 3.7553265539e-01 time = 0.02 sec -[ Info: VUMPS 198: obj = -2.828727739426e-01 err = 3.5757076377e-01 time = 0.03 sec -[ Info: VUMPS 199: obj = -2.312961866796e-01 err = 3.7739801742e-01 time = 0.04 sec -┌ Warning: VUMPS cancel 200: obj = -2.166543836900e-01 err = 3.7105307386e-01 time = 6.55 sec -└ @ MPSKit ~/git/MPSKit.jl/src/algorithms/groundstate/vumps.jl:73 +[ Info: VUMPS init: obj = +2.499995549467e-01 err = 1.8944e-03 +[ Info: VUMPS 1: obj = -1.637326006220e-01 err = 3.4380167886e-01 time = 0.02 sec +[ Info: VUMPS 2: obj = +4.022469296605e-02 err = 3.6124904819e-01 time = 0.02 sec +[ Info: VUMPS 3: obj = -1.451781276155e-01 err = 3.7525843588e-01 time = 0.02 sec +[ Info: VUMPS 4: obj = -3.297874086946e-01 err = 3.0974732609e-01 time = 0.03 sec +[ Info: VUMPS 5: obj = +8.480531607776e-02 err = 4.2311149602e-01 time = 0.02 sec +[ Info: VUMPS 6: obj = -4.682900333525e-02 err = 3.9435625697e-01 time = 0.03 sec +[ Info: VUMPS 7: obj = -2.038899540195e-01 err = 3.7392529829e-01 time = 0.02 sec +[ Info: VUMPS 8: obj = -1.567891704735e-01 err = 3.9440419459e-01 time = 0.02 sec +[ Info: VUMPS 9: obj = +1.798128191908e-02 err = 3.8563879385e-01 time = 0.02 sec +[ Info: VUMPS 10: obj = -1.627417051509e-02 err = 4.0179419114e-01 time = 0.02 sec +[ Info: VUMPS 11: obj = +1.971444286808e-01 err = 3.1358642027e-01 time = 0.02 sec +[ Info: VUMPS 12: obj = -1.544732012749e-01 err = 3.9113131940e-01 time = 0.03 sec +[ Info: VUMPS 13: obj = -5.143757541054e-02 err = 3.6158026015e-01 time = 0.02 sec +[ Info: VUMPS 14: obj = -2.378431775937e-01 err = 3.6684775265e-01 time = 0.15 sec +[ Info: VUMPS 15: obj = -2.335972628792e-01 err = 3.5833112567e-01 time = 0.02 sec +[ Info: VUMPS 16: obj = -3.513837130591e-01 err = 3.1447160955e-01 time = 0.03 sec +[ Info: VUMPS 17: obj = -1.269547785447e-01 err = 4.0560571685e-01 time = 0.03 sec +[ Info: VUMPS 18: obj = -5.526651111523e-02 err = 3.9877496947e-01 time = 0.02 sec +[ Info: VUMPS 19: obj = -1.736900085076e-01 err = 3.7193659518e-01 time = 0.02 sec +[ Info: VUMPS 20: obj = -2.041914181357e-01 err = 3.5751923396e-01 time = 0.02 sec +[ Info: VUMPS 21: obj = -3.693165536045e-01 err = 2.7182712254e-01 time = 0.03 sec +[ Info: VUMPS 22: obj = -2.011720710870e-01 err = 3.6676865727e-01 time = 0.02 sec +[ Info: VUMPS 23: obj = -1.633950485920e-01 err = 4.1193224347e-01 time = 0.02 sec +[ Info: VUMPS 24: obj = -4.626612529510e-02 err = 4.0924314691e-01 time = 0.03 sec +[ Info: VUMPS 25: obj = -1.281611280890e-01 err = 3.9044251366e-01 time = 0.02 sec +[ Info: VUMPS 26: obj = -3.368232288231e-01 err = 3.2045176746e-01 time = 0.02 sec +[ Info: VUMPS 27: obj = -5.824695053770e-02 err = 3.9279884760e-01 time = 0.02 sec +[ Info: VUMPS 28: obj = -1.584622209274e-01 err = 3.9976472773e-01 time = 0.11 sec +[ Info: VUMPS 29: obj = -1.002822977314e-01 err = 3.8803754727e-01 time = 0.03 sec +[ Info: VUMPS 30: obj = +7.400348453278e-03 err = 3.9371296126e-01 time = 0.03 sec +[ Info: VUMPS 31: obj = -1.177431901110e-01 err = 3.9678690292e-01 time = 0.02 sec +[ Info: VUMPS 32: obj = -1.648756258411e-01 err = 3.8382308262e-01 time = 0.03 sec +[ Info: VUMPS 33: obj = -1.486770429634e-01 err = 3.6066618432e-01 time = 0.02 sec +[ Info: VUMPS 34: obj = -3.115577559394e-01 err = 3.4055409376e-01 time = 0.03 sec +[ Info: VUMPS 35: obj = -3.431437826768e-01 err = 3.1792959691e-01 time = 0.03 sec +[ Info: VUMPS 36: obj = -4.164170397906e-01 err = 2.0323232703e-01 time = 0.03 sec +[ Info: VUMPS 37: obj = -4.347019355186e-01 err = 1.2218577552e-01 time = 0.04 sec +[ Info: VUMPS 38: obj = +1.126876972824e-02 err = 3.8542612776e-01 time = 0.03 sec +[ Info: VUMPS 39: obj = -1.054351314040e-01 err = 4.0525492793e-01 time = 0.06 sec +[ Info: VUMPS 40: obj = -1.414301602807e-01 err = 4.0916217647e-01 time = 0.03 sec +[ Info: VUMPS 41: obj = -1.893357319314e-01 err = 3.7913998013e-01 time = 0.02 sec +[ Info: VUMPS 42: obj = -2.638139371875e-01 err = 3.5727613224e-01 time = 0.03 sec +[ Info: VUMPS 43: obj = -1.087944796522e-01 err = 3.5097164414e-01 time = 0.02 sec +[ Info: VUMPS 44: obj = -1.601735087524e-01 err = 3.9348691903e-01 time = 0.02 sec +[ Info: VUMPS 45: obj = -3.599764269854e-01 err = 2.9117042431e-01 time = 0.03 sec +[ Info: VUMPS 46: obj = -4.307479018240e-01 err = 1.4590877399e-01 time = 0.03 sec +[ Info: VUMPS 47: obj = +1.409551265290e-01 err = 3.7003839916e-01 time = 0.02 sec +[ Info: VUMPS 48: obj = -1.237917373142e-01 err = 3.8254863769e-01 time = 0.02 sec +[ Info: VUMPS 49: obj = -1.627580205525e-01 err = 3.7367727861e-01 time = 0.02 sec +[ Info: VUMPS 50: obj = -2.769089084247e-01 err = 3.5236198797e-01 time = 0.05 sec +[ Info: VUMPS 51: obj = -2.343888370451e-01 err = 3.6427105579e-01 time = 0.02 sec +[ Info: VUMPS 52: obj = -2.248449151603e-01 err = 3.7977874636e-01 time = 0.03 sec +[ Info: VUMPS 53: obj = -7.550510266759e-02 err = 4.0150761461e-01 time = 0.02 sec +[ Info: VUMPS 54: obj = -1.157957101584e-01 err = 4.1227979674e-01 time = 0.03 sec +[ Info: VUMPS 55: obj = -3.546254055503e-02 err = 3.9957978395e-01 time = 0.03 sec +[ Info: VUMPS 56: obj = -1.129978671789e-01 err = 4.0034284390e-01 time = 0.02 sec +[ Info: VUMPS 57: obj = -2.329800814496e-01 err = 3.7187892563e-01 time = 0.03 sec +[ Info: VUMPS 58: obj = +2.751650323643e-02 err = 4.0247044284e-01 time = 0.03 sec +[ Info: VUMPS 59: obj = +1.917009780601e-01 err = 3.3210927196e-01 time = 0.02 sec +[ Info: VUMPS 60: obj = -1.263549808391e-01 err = 3.9315953588e-01 time = 0.07 sec +[ Info: VUMPS 61: obj = -8.215407597511e-02 err = 3.9533232172e-01 time = 0.02 sec +[ Info: VUMPS 62: obj = -2.064545516441e-01 err = 3.7374649705e-01 time = 0.02 sec +[ Info: VUMPS 63: obj = -2.034027935096e-01 err = 3.9761679200e-01 time = 0.03 sec +[ Info: VUMPS 64: obj = -2.846911108688e-03 err = 3.7662169289e-01 time = 0.03 sec +[ Info: VUMPS 65: obj = +7.553415672703e-02 err = 3.7835378290e-01 time = 0.02 sec +[ Info: VUMPS 66: obj = -1.171790490724e-01 err = 3.5935068701e-01 time = 0.03 sec +[ Info: VUMPS 67: obj = -1.497117506752e-01 err = 3.7395334449e-01 time = 0.03 sec +[ Info: VUMPS 68: obj = -2.039793547678e-01 err = 3.7667227814e-01 time = 0.03 sec +[ Info: VUMPS 69: obj = -2.089140931903e-01 err = 3.6415207135e-01 time = 0.02 sec +[ Info: VUMPS 70: obj = -1.134944918293e-01 err = 3.6436812433e-01 time = 0.06 sec +[ Info: VUMPS 71: obj = -1.157762777756e-01 err = 3.8567331411e-01 time = 0.02 sec +[ Info: VUMPS 72: obj = -2.394261860644e-01 err = 3.6057044079e-01 time = 0.02 sec +[ Info: VUMPS 73: obj = -3.342400580410e-01 err = 3.1317816493e-01 time = 0.02 sec +[ Info: VUMPS 74: obj = -3.904134305503e-01 err = 2.5856894641e-01 time = 0.03 sec +[ Info: VUMPS 75: obj = +8.449256685246e-02 err = 3.8483086625e-01 time = 0.03 sec +[ Info: VUMPS 76: obj = -3.933130622801e-02 err = 4.0208977801e-01 time = 0.03 sec +[ Info: VUMPS 77: obj = +8.653869040795e-02 err = 3.8802124228e-01 time = 0.03 sec +[ Info: VUMPS 78: obj = +9.587848560625e-02 err = 3.5722735528e-01 time = 0.02 sec +[ Info: VUMPS 79: obj = -5.563236275270e-02 err = 4.1092165670e-01 time = 0.03 sec +[ Info: VUMPS 80: obj = -6.486296834251e-03 err = 3.9951995891e-01 time = 0.06 sec +[ Info: VUMPS 81: obj = -1.209081100544e-01 err = 3.6666868713e-01 time = 0.02 sec +[ Info: VUMPS 82: obj = -2.521478349167e-01 err = 3.5309480836e-01 time = 0.02 sec +[ Info: VUMPS 83: obj = -3.517052113063e-01 err = 3.1461835111e-01 time = 0.03 sec +[ Info: VUMPS 84: obj = -3.299898797334e-01 err = 3.1486702189e-01 time = 0.03 sec +[ Info: VUMPS 85: obj = -3.493479897924e-01 err = 3.1357877281e-01 time = 0.03 sec +[ Info: VUMPS 86: obj = -9.705041624306e-02 err = 3.8584904079e-01 time = 0.02 sec +[ Info: VUMPS 87: obj = -6.719503369858e-02 err = 3.8802177181e-01 time = 0.02 sec +[ Info: VUMPS 88: obj = +7.083873868280e-02 err = 3.8329406568e-01 time = 0.02 sec +[ Info: VUMPS 89: obj = +1.427527172763e-01 err = 3.6625276364e-01 time = 0.02 sec +[ Info: VUMPS 90: obj = -2.155800529197e-02 err = 4.3111181536e-01 time = 0.03 sec +[ Info: VUMPS 91: obj = -3.535552416184e-02 err = 4.1031265505e-01 time = 0.05 sec +[ Info: VUMPS 92: obj = +4.038017896823e-02 err = 3.8143678194e-01 time = 0.02 sec +[ Info: VUMPS 93: obj = -1.670680877582e-01 err = 3.8295252948e-01 time = 0.02 sec +[ Info: VUMPS 94: obj = -9.389358669508e-02 err = 4.0264966465e-01 time = 0.04 sec +[ Info: VUMPS 95: obj = -6.539125878566e-02 err = 3.6997274129e-01 time = 0.03 sec +[ Info: VUMPS 96: obj = -2.076204063368e-01 err = 3.8010942600e-01 time = 0.02 sec +[ Info: VUMPS 97: obj = -2.793821365956e-01 err = 3.4935730821e-01 time = 0.02 sec +[ Info: VUMPS 98: obj = -7.458031879980e-02 err = 3.8897663409e-01 time = 0.02 sec +[ Info: VUMPS 99: obj = -2.819439484489e-01 err = 3.6706683600e-01 time = 0.03 sec +[ Info: VUMPS 100: obj = -1.001823219839e-01 err = 3.7624054699e-01 time = 0.02 sec +[ Info: VUMPS 101: obj = -6.394432799715e-02 err = 3.9177673956e-01 time = 0.06 sec +[ Info: VUMPS 102: obj = -1.465694002120e-01 err = 3.8378109832e-01 time = 0.02 sec +[ Info: VUMPS 103: obj = -2.405698991621e-01 err = 3.7543291978e-01 time = 0.02 sec +[ Info: VUMPS 104: obj = -3.513218895760e-01 err = 3.0159411514e-01 time = 0.02 sec +[ Info: VUMPS 105: obj = -1.023723784151e-01 err = 3.6048545911e-01 time = 0.03 sec +[ Info: VUMPS 106: obj = -1.254960641829e-01 err = 3.5705227068e-01 time = 0.03 sec +[ Info: VUMPS 107: obj = -2.439341345938e-01 err = 3.6666868249e-01 time = 0.03 sec +[ Info: VUMPS 108: obj = -1.822440707693e-01 err = 3.9830893422e-01 time = 0.03 sec +[ Info: VUMPS 109: obj = -2.501473062742e-01 err = 3.5974890197e-01 time = 0.02 sec +[ Info: VUMPS 110: obj = -2.907188314950e-01 err = 3.3385674670e-01 time = 0.03 sec +[ Info: VUMPS 111: obj = -3.880803577729e-01 err = 2.6012194034e-01 time = 0.05 sec +[ Info: VUMPS 112: obj = -3.135177544690e-01 err = 3.5859183499e-01 time = 0.03 sec +[ Info: VUMPS 113: obj = -3.239598468980e-01 err = 3.4821622589e-01 time = 0.03 sec +[ Info: VUMPS 114: obj = -4.092283711908e-01 err = 2.1862198400e-01 time = 0.03 sec +[ Info: VUMPS 115: obj = -4.220328070787e-01 err = 1.8801072163e-01 time = 0.03 sec +[ Info: VUMPS 116: obj = +1.547122686700e-02 err = 4.0231050978e-01 time = 0.03 sec +[ Info: VUMPS 117: obj = -7.971332985234e-02 err = 3.7654696853e-01 time = 0.02 sec +[ Info: VUMPS 118: obj = +1.462167544480e-02 err = 3.7464919429e-01 time = 0.02 sec +[ Info: VUMPS 119: obj = -2.507716805320e-01 err = 3.7118480512e-01 time = 0.02 sec +[ Info: VUMPS 120: obj = -3.534787471790e-01 err = 3.1688927832e-01 time = 0.05 sec +[ Info: VUMPS 121: obj = -1.108707448425e-01 err = 4.1451059429e-01 time = 0.02 sec +[ Info: VUMPS 122: obj = -1.842124515165e-01 err = 3.8528792301e-01 time = 0.02 sec +[ Info: VUMPS 123: obj = -2.998975814447e-01 err = 3.4023194006e-01 time = 0.02 sec +[ Info: VUMPS 124: obj = -1.186804385815e-01 err = 4.1899473179e-01 time = 0.04 sec +[ Info: VUMPS 125: obj = -1.948725735956e-01 err = 3.6431703182e-01 time = 0.02 sec +[ Info: VUMPS 126: obj = +3.273407063701e-02 err = 3.4643539632e-01 time = 0.02 sec +[ Info: VUMPS 127: obj = -2.266211833470e-01 err = 3.4825725987e-01 time = 0.03 sec +[ Info: VUMPS 128: obj = -3.116731680576e-01 err = 3.4010142993e-01 time = 0.03 sec +[ Info: VUMPS 129: obj = -2.826698629538e-01 err = 3.6929476876e-01 time = 0.03 sec +[ Info: VUMPS 130: obj = -1.572495813700e-01 err = 3.9971170739e-01 time = 0.06 sec +[ Info: VUMPS 131: obj = -1.732268711440e-02 err = 3.6936890832e-01 time = 0.02 sec +[ Info: VUMPS 132: obj = -4.775357014229e-02 err = 3.9962098427e-01 time = 0.03 sec +[ Info: VUMPS 133: obj = -2.431698382557e-01 err = 3.6404028082e-01 time = 0.02 sec +[ Info: VUMPS 134: obj = -2.821932941813e-01 err = 3.5445708250e-01 time = 0.02 sec +[ Info: VUMPS 135: obj = -9.024883449741e-02 err = 3.7670364392e-01 time = 0.03 sec +[ Info: VUMPS 136: obj = -2.262433195377e-01 err = 3.8532078673e-01 time = 0.03 sec +[ Info: VUMPS 137: obj = -8.163381818312e-02 err = 3.8947952861e-01 time = 0.02 sec +[ Info: VUMPS 138: obj = -7.989801779312e-03 err = 3.8868571809e-01 time = 0.02 sec +[ Info: VUMPS 139: obj = +2.634778860890e-02 err = 3.6599239785e-01 time = 0.02 sec +[ Info: VUMPS 140: obj = -1.307675815427e-01 err = 3.4665317823e-01 time = 0.03 sec +[ Info: VUMPS 141: obj = -3.217088121498e-01 err = 3.2313971501e-01 time = 0.05 sec +[ Info: VUMPS 142: obj = -4.246143494691e-01 err = 1.5885779904e-01 time = 0.03 sec +[ Info: VUMPS 143: obj = -8.774044006206e-02 err = 3.8014515500e-01 time = 0.03 sec +[ Info: VUMPS 144: obj = -8.327043512249e-02 err = 3.7969588944e-01 time = 0.02 sec +[ Info: VUMPS 145: obj = -1.325167744344e-01 err = 3.8919621062e-01 time = 0.02 sec +[ Info: VUMPS 146: obj = -1.662916750343e-01 err = 3.4606874768e-01 time = 0.03 sec +[ Info: VUMPS 147: obj = -1.901394048799e-01 err = 3.8421371861e-01 time = 0.03 sec +[ Info: VUMPS 148: obj = -2.601825005552e-02 err = 3.9297149298e-01 time = 0.03 sec +[ Info: VUMPS 149: obj = -2.376758303565e-01 err = 3.6086607615e-01 time = 0.03 sec +[ Info: VUMPS 150: obj = -2.272499924592e-01 err = 3.7479126222e-01 time = 0.05 sec +[ Info: VUMPS 151: obj = -2.036843938804e-01 err = 3.9925741694e-01 time = 0.03 sec +[ Info: VUMPS 152: obj = -2.313892960788e-01 err = 3.7972643403e-01 time = 0.03 sec +[ Info: VUMPS 153: obj = -1.986998610932e-01 err = 3.9191236797e-01 time = 0.03 sec +[ Info: VUMPS 154: obj = -2.108517047947e-01 err = 3.7580583074e-01 time = 0.03 sec +[ Info: VUMPS 155: obj = -3.176605702081e-01 err = 3.2923368977e-01 time = 0.03 sec +[ Info: VUMPS 156: obj = +9.435660504635e-02 err = 3.8427690796e-01 time = 0.02 sec +[ Info: VUMPS 157: obj = -7.759368642086e-02 err = 3.9643333120e-01 time = 0.02 sec +[ Info: VUMPS 158: obj = -3.957699631929e-02 err = 4.0189632984e-01 time = 0.02 sec +[ Info: VUMPS 159: obj = -1.217059048082e-01 err = 3.7324188583e-01 time = 0.03 sec +[ Info: VUMPS 160: obj = -3.009908896146e-02 err = 3.8322255280e-01 time = 0.05 sec +[ Info: VUMPS 161: obj = -7.237850128759e-02 err = 4.0889926487e-01 time = 0.03 sec +[ Info: VUMPS 162: obj = -1.373382697223e-01 err = 4.2014320380e-01 time = 0.02 sec +[ Info: VUMPS 163: obj = -1.099154797758e-01 err = 4.1417886345e-01 time = 0.03 sec +[ Info: VUMPS 164: obj = -1.374913376578e-01 err = 3.5906146231e-01 time = 0.02 sec +[ Info: VUMPS 165: obj = -1.464572634014e-01 err = 3.8610039285e-01 time = 0.03 sec +[ Info: VUMPS 166: obj = -3.497532054532e-01 err = 3.2149526676e-01 time = 0.03 sec +[ Info: VUMPS 167: obj = -3.538682309356e-01 err = 3.0937161510e-01 time = 0.03 sec +[ Info: VUMPS 168: obj = -1.174426478371e-01 err = 4.0570387888e-01 time = 0.02 sec +[ Info: VUMPS 169: obj = -1.003314337439e-01 err = 3.9330106579e-01 time = 0.03 sec +[ Info: VUMPS 170: obj = -1.397014985899e-01 err = 3.8327251771e-01 time = 0.05 sec +[ Info: VUMPS 171: obj = -1.485590666911e-02 err = 3.6193610363e-01 time = 0.02 sec +[ Info: VUMPS 172: obj = -2.841425862542e-01 err = 3.5517293193e-01 time = 0.03 sec +[ Info: VUMPS 173: obj = -3.175669710557e-01 err = 3.2886842202e-01 time = 0.02 sec +[ Info: VUMPS 174: obj = -4.215876012708e-01 err = 1.8272144933e-01 time = 0.03 sec +[ Info: VUMPS 175: obj = +1.080077314978e-01 err = 3.8650612296e-01 time = 0.03 sec +[ Info: VUMPS 176: obj = -1.105754803548e-01 err = 3.7491324259e-01 time = 0.02 sec +[ Info: VUMPS 177: obj = -1.534253812824e-01 err = 3.6869415832e-01 time = 0.02 sec +[ Info: VUMPS 178: obj = -1.418091290806e-01 err = 3.7395180342e-01 time = 0.02 sec +[ Info: VUMPS 179: obj = -2.897274308719e-01 err = 3.5651563652e-01 time = 0.02 sec +[ Info: VUMPS 180: obj = -2.391169842001e-02 err = 3.7325894327e-01 time = 0.05 sec +[ Info: VUMPS 181: obj = -1.721332943936e-01 err = 3.7821121884e-01 time = 0.03 sec +[ Info: VUMPS 182: obj = -1.052070523338e-01 err = 3.8451236128e-01 time = 0.02 sec +[ Info: VUMPS 183: obj = -6.354898914006e-02 err = 4.3678211247e-01 time = 0.02 sec +[ Info: VUMPS 184: obj = +5.549252056570e-02 err = 3.6090995884e-01 time = 0.03 sec +[ Info: VUMPS 185: obj = +5.565063849145e-02 err = 4.0136597605e-01 time = 0.03 sec +[ Info: VUMPS 186: obj = +1.768269685046e-01 err = 3.2651611381e-01 time = 0.02 sec +[ Info: VUMPS 187: obj = +1.593690655282e-04 err = 3.8841746150e-01 time = 0.02 sec +[ Info: VUMPS 188: obj = +4.130061860625e-02 err = 3.7222674602e-01 time = 0.02 sec +[ Info: VUMPS 189: obj = -1.930146741248e-01 err = 3.8117696997e-01 time = 0.03 sec +[ Info: VUMPS 190: obj = -3.519361182836e-01 err = 3.0263989022e-01 time = 0.02 sec +[ Info: VUMPS 191: obj = -2.601579677807e-01 err = 3.6061622733e-01 time = 0.05 sec +[ Info: VUMPS 192: obj = -1.002975257021e-01 err = 4.1048517065e-01 time = 0.02 sec +[ Info: VUMPS 193: obj = -1.563988174307e-01 err = 3.9315686700e-01 time = 0.02 sec +[ Info: VUMPS 194: obj = -9.911970259716e-02 err = 3.7832099886e-01 time = 0.02 sec +[ Info: VUMPS 195: obj = -1.044710830190e-01 err = 4.0631216492e-01 time = 0.03 sec +[ Info: VUMPS 196: obj = -1.858694684809e-01 err = 3.9336892502e-01 time = 0.02 sec +[ Info: VUMPS 197: obj = -3.090115170517e-01 err = 3.5367444183e-01 time = 0.03 sec +[ Info: VUMPS 198: obj = -1.946258306654e-02 err = 3.6965265025e-01 time = 0.02 sec +[ Info: VUMPS 199: obj = -2.238429310745e-01 err = 3.7577524599e-01 time = 0.03 sec +┌ Warning: VUMPS cancel 200: obj = -3.951359685829e-01 err = 2.5736930769e-01 time = 5.62 sec +└ @ MPSKit ~/Projects/MPSKit.jl/src/algorithms/groundstate/vumps.jl:76 ```` @@ -265,12 +265,12 @@ On it's own, that is already quite curious. Maybe we can do better using another algorithm, such as gradient descent. ````julia -groundstate, cache, delta = find_groundstate(state, H, GradientGrassmann(; maxiter=20)); +groundstate, cache, delta = find_groundstate(state, H, GradientGrassmann(; maxiter = 20)); ```` ```` -[ Info: CG: initializing with f = 0.249995294058, ‖∇f‖ = 4.4866e-03 -┌ Warning: CG: not converged to requested tol after 20 iterations and time 8.67 s: f = -0.441284034826, ‖∇f‖ = 1.1624e-02 +[ Info: CG: initializing with f = 0.249999554947, ‖∇f‖ = 1.3395e-03 +┌ Warning: CG: not converged to requested tol after 20 iterations and time 6.30 s: f = -0.441802293068, ‖∇f‖ = 1.0800e-02 └ @ OptimKit ~/.julia/packages/OptimKit/G6i79/src/cg.jl:172 ```` @@ -283,147 +283,7 @@ transferplot(groundstate, groundstate) ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` We can clearly see multiple eigenvalues close to the unit circle. @@ -455,114 +315,115 @@ Alternatively, the hamiltonian can be constructed directly on a two-site unitcel ````julia # H2 = repeat(H, 2); -- copies the one-site version -H2 = heisenberg_XXX(ComplexF64, Trivial, InfiniteChain(2); spin=1 // 2) -groundstate, envs, delta = find_groundstate(state, H2, - VUMPS(; maxiter=100, tol=1e-12)); +H2 = heisenberg_XXX(ComplexF64, Trivial, InfiniteChain(2); spin = 1 // 2) +groundstate, envs, delta = find_groundstate( + state, H2, VUMPS(; maxiter = 100, tol = 1.0e-12) +); ```` ```` -[ Info: VUMPS init: obj = +4.984019701133e-01 err = 8.5802e-02 -[ Info: VUMPS 1: obj = -1.587916149322e-01 err = 3.0275893671e-01 time = 0.04 sec -[ Info: VUMPS 2: obj = -8.673455076862e-01 err = 1.2709823901e-01 time = 0.03 sec -[ Info: VUMPS 3: obj = -8.851574658168e-01 err = 1.3169797608e-02 time = 0.03 sec -[ Info: VUMPS 4: obj = -8.859091848496e-01 err = 6.4392637469e-03 time = 0.10 sec -[ Info: VUMPS 5: obj = -8.861109088796e-01 err = 4.0495543537e-03 time = 0.03 sec -[ Info: VUMPS 6: obj = -8.861799998365e-01 err = 3.2423747666e-03 time = 0.04 sec -[ Info: VUMPS 7: obj = -8.862098845534e-01 err = 2.5878808961e-03 time = 0.04 sec -[ Info: VUMPS 8: obj = -8.862231663400e-01 err = 2.2980643190e-03 time = 0.04 sec -[ Info: VUMPS 9: obj = -8.862302410094e-01 err = 1.9030792239e-03 time = 0.04 sec -[ Info: VUMPS 10: obj = -8.862337476758e-01 err = 1.5771139900e-03 time = 0.04 sec -[ Info: VUMPS 11: obj = -8.862357477670e-01 err = 1.3386319635e-03 time = 0.05 sec -[ Info: VUMPS 12: obj = -8.862368077969e-01 err = 1.1118556991e-03 time = 0.04 sec -[ Info: VUMPS 13: obj = -8.862374143689e-01 err = 9.6368190823e-04 time = 0.05 sec -[ Info: VUMPS 14: obj = -8.862377772951e-01 err = 8.9527621802e-04 time = 0.04 sec -[ Info: VUMPS 15: obj = -8.862380175272e-01 err = 8.0363531590e-04 time = 0.05 sec -[ Info: VUMPS 16: obj = -8.862381809910e-01 err = 8.1310379974e-04 time = 0.05 sec -[ Info: VUMPS 17: obj = -8.862383289606e-01 err = 7.6372744918e-04 time = 0.04 sec -[ Info: VUMPS 18: obj = -8.862384512228e-01 err = 7.7168418781e-04 time = 0.05 sec -[ Info: VUMPS 19: obj = -8.862385939943e-01 err = 7.2169619957e-04 time = 0.05 sec -[ Info: VUMPS 20: obj = -8.862387296086e-01 err = 6.9847750143e-04 time = 0.14 sec -[ Info: VUMPS 21: obj = -8.862388823501e-01 err = 6.4519851323e-04 time = 0.08 sec -[ Info: VUMPS 22: obj = -8.862390299430e-01 err = 5.9543430924e-04 time = 0.08 sec -[ Info: VUMPS 23: obj = -8.862391796049e-01 err = 5.2965230331e-04 time = 0.08 sec -[ Info: VUMPS 24: obj = -8.862393105628e-01 err = 4.6746973021e-04 time = 0.08 sec -[ Info: VUMPS 25: obj = -8.862394256169e-01 err = 4.0012165330e-04 time = 0.08 sec -[ Info: VUMPS 26: obj = -8.862395146213e-01 err = 3.4348612692e-04 time = 0.05 sec -[ Info: VUMPS 27: obj = -8.862395831043e-01 err = 2.9133403018e-04 time = 0.05 sec -[ Info: VUMPS 28: obj = -8.862396319943e-01 err = 2.5002069641e-04 time = 0.05 sec -[ Info: VUMPS 29: obj = -8.862396671228e-01 err = 2.1555353820e-04 time = 0.05 sec -[ Info: VUMPS 30: obj = -8.862396917938e-01 err = 1.8787657127e-04 time = 0.05 sec -[ Info: VUMPS 31: obj = -8.862397096146e-01 err = 1.6535795978e-04 time = 0.05 sec -[ Info: VUMPS 32: obj = -8.862397226287e-01 err = 1.4647959939e-04 time = 0.04 sec -[ Info: VUMPS 33: obj = -8.862397325704e-01 err = 1.3058029797e-04 time = 0.04 sec -[ Info: VUMPS 34: obj = -8.862397403210e-01 err = 1.1703644593e-04 time = 0.05 sec -[ Info: VUMPS 35: obj = -8.862397466535e-01 err = 1.0479443543e-04 time = 0.05 sec -[ Info: VUMPS 36: obj = -8.862397518883e-01 err = 9.4757697496e-05 time = 0.07 sec -[ Info: VUMPS 37: obj = -8.862397563857e-01 err = 8.4793760071e-05 time = 0.05 sec -[ Info: VUMPS 38: obj = -8.862397602492e-01 err = 7.7330476046e-05 time = 0.05 sec -[ Info: VUMPS 39: obj = -8.862397636664e-01 err = 6.9007080884e-05 time = 0.05 sec -[ Info: VUMPS 40: obj = -8.862397666688e-01 err = 6.3574783777e-05 time = 0.05 sec -[ Info: VUMPS 41: obj = -8.862397693669e-01 err = 5.6541518218e-05 time = 0.05 sec -[ Info: VUMPS 42: obj = -8.862397717706e-01 err = 5.2754788593e-05 time = 0.05 sec -[ Info: VUMPS 43: obj = -8.862397739510e-01 err = 4.6775683210e-05 time = 0.05 sec -[ Info: VUMPS 44: obj = -8.862397759130e-01 err = 4.4320904414e-05 time = 0.05 sec -[ Info: VUMPS 45: obj = -8.862397777047e-01 err = 3.9206640444e-05 time = 0.05 sec -[ Info: VUMPS 46: obj = -8.862397793305e-01 err = 3.7808257666e-05 time = 0.05 sec -[ Info: VUMPS 47: obj = -8.862397808237e-01 err = 3.3398078106e-05 time = 0.05 sec -[ Info: VUMPS 48: obj = -8.862397821887e-01 err = 3.2810027183e-05 time = 0.05 sec -[ Info: VUMPS 49: obj = -8.862397834489e-01 err = 2.8968297396e-05 time = 0.05 sec -[ Info: VUMPS 50: obj = -8.862397846088e-01 err = 2.8975455638e-05 time = 0.07 sec -[ Info: VUMPS 51: obj = -8.862397856847e-01 err = 2.5588978527e-05 time = 0.05 sec -[ Info: VUMPS 52: obj = -8.862397866809e-01 err = 2.6012564811e-05 time = 0.05 sec -[ Info: VUMPS 53: obj = -8.862397876092e-01 err = 2.3457901855e-05 time = 0.05 sec -[ Info: VUMPS 54: obj = -8.862397884732e-01 err = 2.3689215433e-05 time = 0.05 sec -[ Info: VUMPS 55: obj = -8.862397892815e-01 err = 2.1824090291e-05 time = 0.05 sec -[ Info: VUMPS 56: obj = -8.862397900373e-01 err = 2.1828940191e-05 time = 0.05 sec -[ Info: VUMPS 57: obj = -8.862397907469e-01 err = 2.0446827272e-05 time = 0.05 sec -[ Info: VUMPS 58: obj = -8.862397914131e-01 err = 2.0302723176e-05 time = 0.05 sec -[ Info: VUMPS 59: obj = -8.862397920405e-01 err = 1.9254981490e-05 time = 0.05 sec -[ Info: VUMPS 60: obj = -8.862397926316e-01 err = 1.9019089435e-05 time = 0.05 sec -[ Info: VUMPS 61: obj = -8.862397931898e-01 err = 1.8202179915e-05 time = 0.05 sec -[ Info: VUMPS 62: obj = -8.862397937172e-01 err = 1.7914246472e-05 time = 0.05 sec -[ Info: VUMPS 63: obj = -8.862397942165e-01 err = 1.7257569224e-05 time = 0.05 sec -[ Info: VUMPS 64: obj = -8.862397946895e-01 err = 1.6944227459e-05 time = 0.05 sec -[ Info: VUMPS 65: obj = -8.862397951382e-01 err = 1.6400243806e-05 time = 0.07 sec -[ Info: VUMPS 66: obj = -8.862397955643e-01 err = 1.6078941938e-05 time = 0.05 sec -[ Info: VUMPS 67: obj = -8.862397959693e-01 err = 1.5615639391e-05 time = 0.05 sec -[ Info: VUMPS 68: obj = -8.862397963546e-01 err = 1.5297227747e-05 time = 0.05 sec -[ Info: VUMPS 69: obj = -8.862397967215e-01 err = 1.4893178345e-05 time = 0.05 sec -[ Info: VUMPS 70: obj = -8.862397970712e-01 err = 1.4584085106e-05 time = 0.05 sec -[ Info: VUMPS 71: obj = -8.862397974047e-01 err = 1.4224856670e-05 time = 0.05 sec -[ Info: VUMPS 72: obj = -8.862397977230e-01 err = 1.3928611175e-05 time = 0.05 sec -[ Info: VUMPS 73: obj = -8.862397980271e-01 err = 1.3604370840e-05 time = 0.05 sec -[ Info: VUMPS 74: obj = -8.862397983177e-01 err = 1.3322648086e-05 time = 0.05 sec -[ Info: VUMPS 75: obj = -8.862397985958e-01 err = 1.3026579806e-05 time = 0.05 sec -[ Info: VUMPS 76: obj = -8.862397988619e-01 err = 1.2759903586e-05 time = 0.05 sec -[ Info: VUMPS 77: obj = -8.862397991167e-01 err = 1.2487175232e-05 time = 0.05 sec -[ Info: VUMPS 78: obj = -8.862397993609e-01 err = 1.2235379085e-05 time = 0.05 sec -[ Info: VUMPS 79: obj = -8.862397995950e-01 err = 1.1982470825e-05 time = 0.05 sec -[ Info: VUMPS 80: obj = -8.862397998196e-01 err = 1.1744996531e-05 time = 0.07 sec -[ Info: VUMPS 81: obj = -8.862398000351e-01 err = 1.1509266452e-05 time = 0.05 sec -[ Info: VUMPS 82: obj = -8.862398002421e-01 err = 1.1285351075e-05 time = 0.05 sec -[ Info: VUMPS 83: obj = -8.862398004410e-01 err = 1.1064753788e-05 time = 0.05 sec -[ Info: VUMPS 84: obj = -8.862398006321e-01 err = 1.0853545836e-05 time = 0.05 sec -[ Info: VUMPS 85: obj = -8.862398008159e-01 err = 1.0646449681e-05 time = 0.05 sec -[ Info: VUMPS 86: obj = -8.862398009928e-01 err = 1.0447078851e-05 time = 0.05 sec -[ Info: VUMPS 87: obj = -8.862398011630e-01 err = 1.0252146279e-05 time = 0.05 sec -[ Info: VUMPS 88: obj = -8.862398013268e-01 err = 1.0063763685e-05 time = 0.05 sec -[ Info: VUMPS 89: obj = -8.862398014847e-01 err = 9.8798722021e-06 time = 0.05 sec -[ Info: VUMPS 90: obj = -8.862398016367e-01 err = 9.7016721333e-06 time = 0.04 sec -[ Info: VUMPS 91: obj = -8.862398017834e-01 err = 9.5278612850e-06 time = 0.04 sec -[ Info: VUMPS 92: obj = -8.862398019247e-01 err = 9.3590916174e-06 time = 0.04 sec -[ Info: VUMPS 93: obj = -8.862398020611e-01 err = 9.1945267654e-06 time = 0.04 sec -[ Info: VUMPS 94: obj = -8.862398021927e-01 err = 9.0344925557e-06 time = 0.05 sec -[ Info: VUMPS 95: obj = -8.862398023197e-01 err = 8.8784395519e-06 time = 0.07 sec -[ Info: VUMPS 96: obj = -8.862398024423e-01 err = 8.7265026811e-06 time = 0.05 sec -[ Info: VUMPS 97: obj = -8.862398025608e-01 err = 8.5783096813e-06 time = 0.05 sec -[ Info: VUMPS 98: obj = -8.862398026752e-01 err = 8.4338863245e-06 time = 0.05 sec -[ Info: VUMPS 99: obj = -8.862398027858e-01 err = 8.2929703487e-06 time = 0.05 sec -┌ Warning: VUMPS cancel 100: obj = -8.862398028927e-01 err = 8.1555273601e-06 time = 5.09 sec -└ @ MPSKit ~/git/MPSKit.jl/src/algorithms/groundstate/vumps.jl:73 +[ Info: VUMPS init: obj = +4.988938408716e-01 err = 6.6329e-02 +[ Info: VUMPS 1: obj = -4.739248140491e-01 err = 3.3816850792e-01 time = 0.03 sec +[ Info: VUMPS 2: obj = -8.743783163834e-01 err = 8.7782281077e-02 time = 0.03 sec +[ Info: VUMPS 3: obj = -8.852289662056e-01 err = 1.1261717077e-02 time = 0.03 sec +[ Info: VUMPS 4: obj = -8.859341540347e-01 err = 6.0581249357e-03 time = 0.12 sec +[ Info: VUMPS 5: obj = -8.861158625188e-01 err = 4.1548303785e-03 time = 0.03 sec +[ Info: VUMPS 6: obj = -8.861822061550e-01 err = 2.8484872369e-03 time = 0.03 sec +[ Info: VUMPS 7: obj = -8.862103323128e-01 err = 2.1781142069e-03 time = 0.03 sec +[ Info: VUMPS 8: obj = -8.862234788867e-01 err = 1.6559901778e-03 time = 0.03 sec +[ Info: VUMPS 9: obj = -8.862298897521e-01 err = 1.3551274661e-03 time = 0.03 sec +[ Info: VUMPS 10: obj = -8.862331118301e-01 err = 1.1002219058e-03 time = 0.04 sec +[ Info: VUMPS 11: obj = -8.862347480843e-01 err = 9.4695562130e-04 time = 0.09 sec +[ Info: VUMPS 12: obj = -8.862355951169e-01 err = 8.0634081582e-04 time = 0.04 sec +[ Info: VUMPS 13: obj = -8.862360364673e-01 err = 7.1458186619e-04 time = 0.03 sec +[ Info: VUMPS 14: obj = -8.862362718663e-01 err = 6.3113350829e-04 time = 0.04 sec +[ Info: VUMPS 15: obj = -8.862363996891e-01 err = 5.6139764728e-04 time = 0.04 sec +[ Info: VUMPS 16: obj = -8.862364715964e-01 err = 5.0511718667e-04 time = 0.04 sec +[ Info: VUMPS 17: obj = -8.862365136698e-01 err = 4.5105971790e-04 time = 0.06 sec +[ Info: VUMPS 18: obj = -8.862365394867e-01 err = 4.0773238562e-04 time = 0.03 sec +[ Info: VUMPS 19: obj = -8.862365562591e-01 err = 3.6503807001e-04 time = 0.04 sec +[ Info: VUMPS 20: obj = -8.862365676678e-01 err = 3.3014036465e-04 time = 0.03 sec +[ Info: VUMPS 21: obj = -8.862365758645e-01 err = 2.9598570227e-04 time = 0.04 sec +[ Info: VUMPS 22: obj = -8.862365819255e-01 err = 2.6762287043e-04 time = 0.07 sec +[ Info: VUMPS 23: obj = -8.862365865819e-01 err = 2.4021341209e-04 time = 0.03 sec +[ Info: VUMPS 24: obj = -8.862365902034e-01 err = 2.1707752879e-04 time = 0.03 sec +[ Info: VUMPS 25: obj = -8.862365930830e-01 err = 1.9507319179e-04 time = 0.03 sec +[ Info: VUMPS 26: obj = -8.862365953820e-01 err = 1.7616283550e-04 time = 0.03 sec +[ Info: VUMPS 27: obj = -8.862365972387e-01 err = 1.5851786128e-04 time = 0.03 sec +[ Info: VUMPS 28: obj = -8.862365987416e-01 err = 1.4302884556e-04 time = 0.07 sec +[ Info: VUMPS 29: obj = -8.862365999644e-01 err = 1.2889703895e-04 time = 0.03 sec +[ Info: VUMPS 30: obj = -8.862366009623e-01 err = 1.1617835138e-04 time = 0.03 sec +[ Info: VUMPS 31: obj = -8.862366017775e-01 err = 1.0488359393e-04 time = 0.03 sec +[ Info: VUMPS 32: obj = -8.862366024472e-01 err = 9.4408469738e-05 time = 0.03 sec +[ Info: VUMPS 33: obj = -8.862366029961e-01 err = 8.5404044738e-05 time = 0.03 sec +[ Info: VUMPS 34: obj = -8.862366034498e-01 err = 7.6748331848e-05 time = 0.03 sec +[ Info: VUMPS 35: obj = -8.862366038231e-01 err = 6.9594627182e-05 time = 0.06 sec +[ Info: VUMPS 36: obj = -8.862366041338e-01 err = 6.2415914486e-05 time = 0.03 sec +[ Info: VUMPS 37: obj = -8.862366043907e-01 err = 5.6758538061e-05 time = 0.03 sec +[ Info: VUMPS 38: obj = -8.862366046064e-01 err = 5.0780009127e-05 time = 0.03 sec +[ Info: VUMPS 39: obj = -8.862366047860e-01 err = 4.6333072643e-05 time = 0.03 sec +[ Info: VUMPS 40: obj = -8.862366049382e-01 err = 4.1331207549e-05 time = 0.03 sec +[ Info: VUMPS 41: obj = -8.862366050662e-01 err = 3.7863899058e-05 time = 0.06 sec +[ Info: VUMPS 42: obj = -8.862366051761e-01 err = 3.3658336653e-05 time = 0.03 sec +[ Info: VUMPS 43: obj = -8.862366052696e-01 err = 3.0983965257e-05 time = 0.03 sec +[ Info: VUMPS 44: obj = -8.862366053511e-01 err = 2.7523802341e-05 time = 0.04 sec +[ Info: VUMPS 45: obj = -8.862366054215e-01 err = 2.5397047125e-05 time = 0.03 sec +[ Info: VUMPS 46: obj = -8.862366054839e-01 err = 2.2595519406e-05 time = 0.03 sec +[ Info: VUMPS 47: obj = -8.862366055388e-01 err = 2.0862977631e-05 time = 0.06 sec +[ Info: VUMPS 48: obj = -8.862366055883e-01 err = 1.8599136674e-05 time = 0.03 sec +[ Info: VUMPS 49: obj = -8.862366056327e-01 err = 1.7188042263e-05 time = 0.03 sec +[ Info: VUMPS 50: obj = -8.862366056736e-01 err = 1.5364204857e-05 time = 0.04 sec +[ Info: VUMPS 51: obj = -8.862366057110e-01 err = 1.4215375363e-05 time = 0.03 sec +[ Info: VUMPS 52: obj = -8.862366057460e-01 err = 1.2752194421e-05 time = 0.04 sec +[ Info: VUMPS 53: obj = -8.862366057787e-01 err = 1.1817843549e-05 time = 0.06 sec +[ Info: VUMPS 54: obj = -8.862366058097e-01 err = 1.0651271784e-05 time = 0.03 sec +[ Info: VUMPS 55: obj = -8.862366058392e-01 err = 9.8929892467e-06 time = 0.04 sec +[ Info: VUMPS 56: obj = -8.862366058675e-01 err = 8.9706820132e-06 time = 0.03 sec +[ Info: VUMPS 57: obj = -8.862366058948e-01 err = 8.3567048894e-06 time = 0.04 sec +[ Info: VUMPS 58: obj = -8.862366059214e-01 err = 7.6361746845e-06 time = 0.04 sec +[ Info: VUMPS 59: obj = -8.862366059472e-01 err = 7.1407423616e-06 time = 0.07 sec +[ Info: VUMPS 60: obj = -8.862366059725e-01 err = 6.5866324690e-06 time = 0.04 sec +[ Info: VUMPS 61: obj = -8.862366059973e-01 err = 6.1886994474e-06 time = 0.04 sec +[ Info: VUMPS 62: obj = -8.862366060219e-01 err = 5.7708691344e-06 time = 0.04 sec +[ Info: VUMPS 63: obj = -8.862366060460e-01 err = 5.4526696713e-06 time = 0.04 sec +[ Info: VUMPS 64: obj = -8.862366060700e-01 err = 5.1458563859e-06 time = 0.07 sec +[ Info: VUMPS 65: obj = -8.862366060938e-01 err = 4.8920859232e-06 time = 0.03 sec +[ Info: VUMPS 66: obj = -8.862366061174e-01 err = 4.6741015849e-06 time = 0.03 sec +[ Info: VUMPS 67: obj = -8.862366061409e-01 err = 4.4720328824e-06 time = 0.03 sec +[ Info: VUMPS 68: obj = -8.862366061643e-01 err = 4.3236853227e-06 time = 0.04 sec +[ Info: VUMPS 69: obj = -8.862366061876e-01 err = 4.1624035800e-06 time = 0.04 sec +[ Info: VUMPS 70: obj = -8.862366062109e-01 err = 4.0670654185e-06 time = 0.06 sec +[ Info: VUMPS 71: obj = -8.862366062341e-01 err = 3.9372522985e-06 time = 0.04 sec +[ Info: VUMPS 72: obj = -8.862366062573e-01 err = 3.8814470100e-06 time = 0.04 sec +[ Info: VUMPS 73: obj = -8.862366062805e-01 err = 3.7755570661e-06 time = 0.04 sec +[ Info: VUMPS 74: obj = -8.862366063037e-01 err = 3.7485088165e-06 time = 0.04 sec +[ Info: VUMPS 75: obj = -8.862366063269e-01 err = 3.6605911620e-06 time = 0.04 sec +[ Info: VUMPS 76: obj = -8.862366063501e-01 err = 3.6540367594e-06 time = 0.06 sec +[ Info: VUMPS 77: obj = -8.862366063733e-01 err = 3.5795056881e-06 time = 0.04 sec +[ Info: VUMPS 78: obj = -8.862366063965e-01 err = 3.5873001441e-06 time = 0.04 sec +[ Info: VUMPS 79: obj = -8.862366064197e-01 err = 3.5226970394e-06 time = 0.04 sec +[ Info: VUMPS 80: obj = -8.862366064429e-01 err = 3.5403874329e-06 time = 0.04 sec +[ Info: VUMPS 81: obj = -8.862366064662e-01 err = 3.4831436727e-06 time = 0.07 sec +[ Info: VUMPS 82: obj = -8.862366064895e-01 err = 3.5075667400e-06 time = 0.03 sec +[ Info: VUMPS 83: obj = -8.862366065128e-01 err = 3.4557926414e-06 time = 0.04 sec +[ Info: VUMPS 84: obj = -8.862366065361e-01 err = 3.4847339467e-06 time = 0.04 sec +[ Info: VUMPS 85: obj = -8.862366065595e-01 err = 3.4370450912e-06 time = 0.04 sec +[ Info: VUMPS 86: obj = -8.862366065829e-01 err = 3.4689709047e-06 time = 0.04 sec +[ Info: VUMPS 87: obj = -8.862366066063e-01 err = 3.4243527295e-06 time = 0.06 sec +[ Info: VUMPS 88: obj = -8.862366066297e-01 err = 3.4582089166e-06 time = 0.04 sec +[ Info: VUMPS 89: obj = -8.862366066532e-01 err = 3.4159150211e-06 time = 0.03 sec +[ Info: VUMPS 90: obj = -8.862366066767e-01 err = 3.4509811256e-06 time = 0.04 sec +[ Info: VUMPS 91: obj = -8.862366067002e-01 err = 3.4104587388e-06 time = 0.04 sec +[ Info: VUMPS 92: obj = -8.862366067238e-01 err = 3.4462444730e-06 time = 0.07 sec +[ Info: VUMPS 93: obj = -8.862366067473e-01 err = 3.4093962434e-06 time = 0.03 sec +[ Info: VUMPS 94: obj = -8.862366067709e-01 err = 3.4432535858e-06 time = 0.03 sec +[ Info: VUMPS 95: obj = -8.862366067945e-01 err = 3.4135991515e-06 time = 0.03 sec +[ Info: VUMPS 96: obj = -8.862366068182e-01 err = 3.4414722655e-06 time = 0.04 sec +[ Info: VUMPS 97: obj = -8.862366068418e-01 err = 3.4175821732e-06 time = 0.04 sec +[ Info: VUMPS 98: obj = -8.862366068655e-01 err = 3.4405116799e-06 time = 0.06 sec +[ Info: VUMPS 99: obj = -8.862366068892e-01 err = 3.4212410568e-06 time = 0.04 sec +┌ Warning: VUMPS cancel 100: obj = -8.862366069129e-01 err = 3.4400872838e-06 time = 4.02 sec +└ @ MPSKit ~/Projects/MPSKit.jl/src/algorithms/groundstate/vumps.jl:76 ```` @@ -570,92 +431,14 @@ We get convergence, but it takes an enormous amount of iterations. The reason behind this becomes more obvious at higher bond dimensions: ````julia -groundstate, envs, delta = find_groundstate(state, H2, - IDMRG2(; trscheme=truncdim(50), maxiter=20, - tol=1e-12)); +groundstate, envs, delta = find_groundstate( + state, H2, IDMRG2(; trscheme = truncrank(50), maxiter = 20, tol = 1.0e-12) +); entanglementplot(groundstate) ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` We see that some eigenvalues clearly belong to a group, and are almost degenerate. @@ -672,7 +455,7 @@ The XXZ Heisenberg hamiltonian is SU(2) symmetric and we can exploit this to gre It is cumbersome to construct symmetric hamiltonians, but luckily su(2) symmetric XXZ is already implemented: ````julia -H2 = heisenberg_XXX(ComplexF64, SU2Irrep, InfiniteChain(2); spin=1 // 2); +H2 = heisenberg_XXX(ComplexF64, SU2Irrep, InfiniteChain(2); spin = 1 // 2); ```` Our initial state should also be SU(2) symmetric. @@ -692,7 +475,7 @@ state = InfiniteMPS([P, P], [V1, V2]); ```` ┌ Warning: Constructing an MPS from tensors that are not full rank -└ @ MPSKit ~/git/MPSKit.jl/src/states/infinitemps.jl:149 +└ @ MPSKit ~/Projects/MPSKit.jl/src/states/infinitemps.jl:160 ```` @@ -701,83 +484,86 @@ Even though the bond dimension is higher than in the example without symmetry, c ````julia println(dim(V1)) println(dim(V2)) -groundstate, cache, delta = find_groundstate(state, H2, - VUMPS(; maxiter=400, tol=1e-12)); +groundstate, cache, delta = find_groundstate(state, H2, VUMPS(; maxiter = 400, tol = 1.0e-12)); ```` ```` 52 70 -[ Info: VUMPS init: obj = +2.876758033543e-02 err = 4.0644e-01 -[ Info: VUMPS 1: obj = -8.737906665472e-01 err = 1.2045339353e-01 time = 0.02 sec -[ Info: VUMPS 2: obj = -8.857246450469e-01 err = 7.4507510196e-03 time = 0.02 sec -[ Info: VUMPS 3: obj = -8.861168843924e-01 err = 3.8806594310e-03 time = 0.02 sec -[ Info: VUMPS 4: obj = -8.862224229828e-01 err = 1.8866990312e-03 time = 0.02 sec -[ Info: VUMPS 5: obj = -8.862604919935e-01 err = 9.5632297117e-04 time = 0.03 sec -[ Info: VUMPS 6: obj = -8.862756622261e-01 err = 6.9689351881e-04 time = 0.03 sec -[ Info: VUMPS 7: obj = -8.862821568604e-01 err = 5.4384343431e-04 time = 0.03 sec -[ Info: VUMPS 8: obj = -8.862851144799e-01 err = 4.3498937171e-04 time = 0.03 sec -[ Info: VUMPS 9: obj = -8.862865208255e-01 err = 3.4022284480e-04 time = 0.04 sec -[ Info: VUMPS 10: obj = -8.862872092893e-01 err = 2.6155639792e-04 time = 0.04 sec -[ Info: VUMPS 11: obj = -8.862875517233e-01 err = 1.9816403910e-04 time = 0.04 sec -[ Info: VUMPS 12: obj = -8.862877233984e-01 err = 1.4833091166e-04 time = 0.04 sec -[ Info: VUMPS 13: obj = -8.862878098491e-01 err = 1.1002989377e-04 time = 0.04 sec -[ Info: VUMPS 14: obj = -8.862878534672e-01 err = 8.1031399491e-05 time = 0.04 sec -[ Info: VUMPS 15: obj = -8.862878754996e-01 err = 5.9348893102e-05 time = 0.04 sec -[ Info: VUMPS 16: obj = -8.862878866404e-01 err = 4.3288174232e-05 time = 0.05 sec -[ Info: VUMPS 17: obj = -8.862878922801e-01 err = 3.1476890398e-05 time = 0.05 sec -[ Info: VUMPS 18: obj = -8.862878951379e-01 err = 2.2833727293e-05 time = 0.04 sec -[ Info: VUMPS 19: obj = -8.862878965878e-01 err = 1.6534345712e-05 time = 0.04 sec -[ Info: VUMPS 20: obj = -8.862878973242e-01 err = 1.1956033801e-05 time = 0.04 sec -[ Info: VUMPS 21: obj = -8.862878976987e-01 err = 8.6354344118e-06 time = 0.04 sec -[ Info: VUMPS 22: obj = -8.862878978893e-01 err = 6.2316368830e-06 time = 0.14 sec -[ Info: VUMPS 23: obj = -8.862878979864e-01 err = 4.4936852018e-06 time = 0.04 sec -[ Info: VUMPS 24: obj = -8.862878980359e-01 err = 3.2380407694e-06 time = 0.04 sec -[ Info: VUMPS 25: obj = -8.862878980612e-01 err = 2.3317908791e-06 time = 0.05 sec -[ Info: VUMPS 26: obj = -8.862878980741e-01 err = 1.6782796290e-06 time = 0.04 sec -[ Info: VUMPS 27: obj = -8.862878980807e-01 err = 1.2073259818e-06 time = 0.04 sec -[ Info: VUMPS 28: obj = -8.862878980841e-01 err = 8.6818060956e-07 time = 0.04 sec -[ Info: VUMPS 29: obj = -8.862878980858e-01 err = 6.2400887691e-07 time = 0.04 sec -[ Info: VUMPS 30: obj = -8.862878980867e-01 err = 4.4833124713e-07 time = 0.04 sec -[ Info: VUMPS 31: obj = -8.862878980871e-01 err = 3.2198399757e-07 time = 0.04 sec -[ Info: VUMPS 32: obj = -8.862878980874e-01 err = 2.3117466228e-07 time = 0.04 sec -[ Info: VUMPS 33: obj = -8.862878980875e-01 err = 1.6592578229e-07 time = 0.04 sec -[ Info: VUMPS 34: obj = -8.862878980876e-01 err = 1.1905960048e-07 time = 0.04 sec -[ Info: VUMPS 35: obj = -8.862878980876e-01 err = 8.5408410847e-08 time = 0.04 sec -[ Info: VUMPS 36: obj = -8.862878980876e-01 err = 6.1253530320e-08 time = 0.04 sec -[ Info: VUMPS 37: obj = -8.862878980876e-01 err = 4.3920166462e-08 time = 0.04 sec -[ Info: VUMPS 38: obj = -8.862878980877e-01 err = 3.1485556009e-08 time = 0.04 sec -[ Info: VUMPS 39: obj = -8.862878980877e-01 err = 2.2566832411e-08 time = 0.04 sec -[ Info: VUMPS 40: obj = -8.862878980877e-01 err = 1.6171599796e-08 time = 0.04 sec -[ Info: VUMPS 41: obj = -8.862878980877e-01 err = 1.1586823278e-08 time = 0.04 sec -[ Info: VUMPS 42: obj = -8.862878980877e-01 err = 8.3006991909e-09 time = 0.04 sec -[ Info: VUMPS 43: obj = -8.862878980877e-01 err = 5.9456786414e-09 time = 0.04 sec -[ Info: VUMPS 44: obj = -8.862878980877e-01 err = 4.2582593636e-09 time = 0.10 sec -[ Info: VUMPS 45: obj = -8.862878980877e-01 err = 3.0493882526e-09 time = 0.04 sec -[ Info: VUMPS 46: obj = -8.862878980877e-01 err = 2.1834676831e-09 time = 0.04 sec -[ Info: VUMPS 47: obj = -8.862878980877e-01 err = 1.5632717223e-09 time = 0.04 sec -[ Info: VUMPS 48: obj = -8.862878980877e-01 err = 1.1191534669e-09 time = 0.04 sec -[ Info: VUMPS 49: obj = -8.862878980877e-01 err = 8.0114053028e-10 time = 0.04 sec -[ Info: VUMPS 50: obj = -8.862878980877e-01 err = 5.7344926629e-10 time = 0.04 sec -[ Info: VUMPS 51: obj = -8.862878980877e-01 err = 4.1044557276e-10 time = 0.04 sec -[ Info: VUMPS 52: obj = -8.862878980877e-01 err = 2.9375533030e-10 time = 0.04 sec -[ Info: VUMPS 53: obj = -8.862878980877e-01 err = 2.1022890604e-10 time = 0.04 sec -[ Info: VUMPS 54: obj = -8.862878980877e-01 err = 1.5044585215e-10 time = 0.04 sec -[ Info: VUMPS 55: obj = -8.862878980877e-01 err = 1.0765471631e-10 time = 0.04 sec -[ Info: VUMPS 56: obj = -8.862878980878e-01 err = 7.7031624881e-11 time = 0.04 sec -[ Info: VUMPS 57: obj = -8.862878980878e-01 err = 5.5116540056e-11 time = 0.04 sec -[ Info: VUMPS 58: obj = -8.862878980878e-01 err = 3.9433877868e-11 time = 0.04 sec -[ Info: VUMPS 59: obj = -8.862878980878e-01 err = 2.8212244668e-11 time = 0.04 sec -[ Info: VUMPS 60: obj = -8.862878980878e-01 err = 2.0184013518e-11 time = 0.03 sec -[ Info: VUMPS 61: obj = -8.862878980878e-01 err = 1.4441829469e-11 time = 0.03 sec -[ Info: VUMPS 62: obj = -8.862878980878e-01 err = 1.0334072641e-11 time = 0.03 sec -[ Info: VUMPS 63: obj = -8.862878980878e-01 err = 7.3919424370e-12 time = 0.03 sec -[ Info: VUMPS 64: obj = -8.862878980878e-01 err = 5.2875140115e-12 time = 0.03 sec -[ Info: VUMPS 65: obj = -8.862878980878e-01 err = 3.7817587214e-12 time = 0.03 sec -[ Info: VUMPS 66: obj = -8.862878980878e-01 err = 2.7051025623e-12 time = 0.03 sec -[ Info: VUMPS 67: obj = -8.862878980878e-01 err = 1.9384032618e-12 time = 0.03 sec -[ Info: VUMPS 68: obj = -8.862878980878e-01 err = 1.3868042929e-12 time = 0.06 sec -[ Info: VUMPS conv 69: obj = -8.862878980878e-01 err = 9.8790427735e-13 time = 2.76 sec +[ Info: VUMPS init: obj = -1.141245853330e-02 err = 4.0215e-01 +[ Info: VUMPS 1: obj = -8.788989897232e-01 err = 8.3126786202e-02 time = 0.13 sec +[ Info: VUMPS 2: obj = -8.857995903945e-01 err = 6.7432032291e-03 time = 0.03 sec +[ Info: VUMPS 3: obj = -8.861329058794e-01 err = 3.4413406908e-03 time = 0.03 sec +[ Info: VUMPS 4: obj = -8.862249298781e-01 err = 2.0932139560e-03 time = 0.03 sec +[ Info: VUMPS 5: obj = -8.862609030986e-01 err = 1.0275091935e-03 time = 0.03 sec +[ Info: VUMPS 6: obj = -8.862754866598e-01 err = 7.4461572015e-04 time = 0.04 sec +[ Info: VUMPS 7: obj = -8.862819270462e-01 err = 5.8510697988e-04 time = 0.05 sec +[ Info: VUMPS 8: obj = -8.862849475005e-01 err = 4.8578532406e-04 time = 0.04 sec +[ Info: VUMPS 9: obj = -8.862864073427e-01 err = 4.0315541644e-04 time = 0.05 sec +[ Info: VUMPS 10: obj = -8.862871279225e-01 err = 3.5445010854e-04 time = 0.05 sec +[ Info: VUMPS 11: obj = -8.862874891630e-01 err = 3.1822823463e-04 time = 0.05 sec +[ Info: VUMPS 12: obj = -8.862876773439e-01 err = 2.7443998839e-04 time = 0.05 sec +[ Info: VUMPS 13: obj = -8.862877793817e-01 err = 2.2054254501e-04 time = 0.12 sec +[ Info: VUMPS 14: obj = -8.862878353269e-01 err = 1.6605215489e-04 time = 0.04 sec +[ Info: VUMPS 15: obj = -8.862878654264e-01 err = 1.1979575296e-04 time = 0.04 sec +[ Info: VUMPS 16: obj = -8.862878812303e-01 err = 8.4769125422e-05 time = 0.05 sec +[ Info: VUMPS 17: obj = -8.862878894026e-01 err = 5.9778171991e-05 time = 0.05 sec +[ Info: VUMPS 18: obj = -8.862878936100e-01 err = 4.2285093952e-05 time = 0.05 sec +[ Info: VUMPS 19: obj = -8.862878957743e-01 err = 3.0076620714e-05 time = 0.05 sec +[ Info: VUMPS 20: obj = -8.862878968901e-01 err = 2.1497977400e-05 time = 0.05 sec +[ Info: VUMPS 21: obj = -8.862878974666e-01 err = 1.5431141918e-05 time = 0.05 sec +[ Info: VUMPS 22: obj = -8.862878977650e-01 err = 1.1107227296e-05 time = 0.05 sec +[ Info: VUMPS 23: obj = -8.862878979198e-01 err = 8.0121943412e-06 time = 0.05 sec +[ Info: VUMPS 24: obj = -8.862878980003e-01 err = 5.7884597378e-06 time = 0.05 sec +[ Info: VUMPS 25: obj = -8.862878980421e-01 err = 4.1862569480e-06 time = 0.10 sec +[ Info: VUMPS 26: obj = -8.862878980639e-01 err = 3.0295966217e-06 time = 0.05 sec +[ Info: VUMPS 27: obj = -8.862878980752e-01 err = 2.1934508934e-06 time = 0.05 sec +[ Info: VUMPS 28: obj = -8.862878980811e-01 err = 1.5884579833e-06 time = 0.05 sec +[ Info: VUMPS 29: obj = -8.862878980842e-01 err = 1.1504627834e-06 time = 0.05 sec +[ Info: VUMPS 30: obj = -8.862878980858e-01 err = 8.3325912425e-07 time = 0.05 sec +[ Info: VUMPS 31: obj = -8.862878980867e-01 err = 6.0349319385e-07 time = 0.05 sec +[ Info: VUMPS 32: obj = -8.862878980871e-01 err = 4.3705144218e-07 time = 0.05 sec +[ Info: VUMPS 33: obj = -8.862878980874e-01 err = 3.1648278136e-07 time = 0.09 sec +[ Info: VUMPS 34: obj = -8.862878980875e-01 err = 2.2914950477e-07 time = 0.04 sec +[ Info: VUMPS 35: obj = -8.862878980876e-01 err = 1.6589609004e-07 time = 0.04 sec +[ Info: VUMPS 36: obj = -8.862878980876e-01 err = 1.2008839249e-07 time = 0.04 sec +[ Info: VUMPS 37: obj = -8.862878980876e-01 err = 8.6918909626e-08 time = 0.05 sec +[ Info: VUMPS 38: obj = -8.862878980876e-01 err = 6.2903889958e-08 time = 0.05 sec +[ Info: VUMPS 39: obj = -8.862878980876e-01 err = 4.5519032022e-08 time = 0.05 sec +[ Info: VUMPS 40: obj = -8.862878980877e-01 err = 3.2940004401e-08 time = 0.05 sec +[ Info: VUMPS 41: obj = -8.862878980877e-01 err = 2.3832479903e-08 time = 0.09 sec +[ Info: VUMPS 42: obj = -8.862878980877e-01 err = 1.7241026505e-08 time = 0.05 sec +[ Info: VUMPS 43: obj = -8.862878980877e-01 err = 1.2471412997e-08 time = 0.05 sec +[ Info: VUMPS 44: obj = -8.862878980877e-01 err = 9.0205419450e-09 time = 0.05 sec +[ Info: VUMPS 45: obj = -8.862878980877e-01 err = 6.5240508358e-09 time = 0.05 sec +[ Info: VUMPS 46: obj = -8.862878980877e-01 err = 4.7181601548e-09 time = 0.05 sec +[ Info: VUMPS 47: obj = -8.862878980877e-01 err = 3.4119389042e-09 time = 0.05 sec +[ Info: VUMPS 48: obj = -8.862878980877e-01 err = 2.4672054622e-09 time = 0.05 sec +[ Info: VUMPS 49: obj = -8.862878980877e-01 err = 1.7839684924e-09 time = 0.05 sec +[ Info: VUMPS 50: obj = -8.862878980877e-01 err = 1.2898741454e-09 time = 0.09 sec +[ Info: VUMPS 51: obj = -8.862878980877e-01 err = 9.3258970310e-10 time = 0.05 sec +[ Info: VUMPS 52: obj = -8.862878980877e-01 err = 6.7423602771e-10 time = 0.04 sec +[ Info: VUMPS 53: obj = -8.862878980877e-01 err = 4.8743673761e-10 time = 0.04 sec +[ Info: VUMPS 54: obj = -8.862878980877e-01 err = 3.5238100286e-10 time = 0.04 sec +[ Info: VUMPS 55: obj = -8.862878980877e-01 err = 2.5473951258e-10 time = 0.05 sec +[ Info: VUMPS 56: obj = -8.862878980878e-01 err = 1.8414828185e-10 time = 0.05 sec +[ Info: VUMPS 57: obj = -8.862878980878e-01 err = 1.3311459508e-10 time = 0.05 sec +[ Info: VUMPS 58: obj = -8.862878980878e-01 err = 9.6221597943e-11 time = 0.05 sec +[ Info: VUMPS 59: obj = -8.862878980878e-01 err = 6.9553567834e-11 time = 0.09 sec +[ Info: VUMPS 60: obj = -8.862878980878e-01 err = 5.0274813406e-11 time = 0.05 sec +[ Info: VUMPS 61: obj = -8.862878980878e-01 err = 3.6335883698e-11 time = 0.05 sec +[ Info: VUMPS 62: obj = -8.862878980878e-01 err = 2.6254468114e-11 time = 0.04 sec +[ Info: VUMPS 63: obj = -8.862878980878e-01 err = 1.8980171184e-11 time = 0.04 sec +[ Info: VUMPS 64: obj = -8.862878980878e-01 err = 1.3721774296e-11 time = 0.04 sec +[ Info: VUMPS 65: obj = -8.862878980878e-01 err = 9.9185056725e-12 time = 0.04 sec +[ Info: VUMPS 66: obj = -8.862878980878e-01 err = 7.1729564828e-12 time = 0.04 sec +[ Info: VUMPS 67: obj = -8.862878980878e-01 err = 5.1845841611e-12 time = 0.04 sec +[ Info: VUMPS 68: obj = -8.862878980878e-01 err = 3.7451968982e-12 time = 0.04 sec +[ Info: VUMPS 69: obj = -8.862878980878e-01 err = 2.7085301699e-12 time = 0.08 sec +[ Info: VUMPS 70: obj = -8.862878980878e-01 err = 1.9547335304e-12 time = 0.04 sec +[ Info: VUMPS 71: obj = -8.862878980878e-01 err = 1.4119541453e-12 time = 0.04 sec +[ Info: VUMPS 72: obj = -8.862878980878e-01 err = 1.0222255848e-12 time = 0.03 sec +[ Info: VUMPS conv 73: obj = -8.862878980878e-01 err = 7.3834786497e-13 time = 3.71 sec ```` diff --git a/docs/src/examples/quantum1d/4.xxz-heisenberg/main.ipynb b/docs/src/examples/quantum1d/4.xxz-heisenberg/main.ipynb index 0fecfb03c..9d851880a 100644 --- a/docs/src/examples/quantum1d/4.xxz-heisenberg/main.ipynb +++ b/docs/src/examples/quantum1d/4.xxz-heisenberg/main.ipynb @@ -34,7 +34,7 @@ "outputs": [], "cell_type": "code", "source": [ - "H = heisenberg_XXX(; spin=1 // 2)" + "H = heisenberg_XXX(; spin = 1 // 2)" ], "metadata": {}, "execution_count": null @@ -84,7 +84,7 @@ "outputs": [], "cell_type": "code", "source": [ - "groundstate, cache, delta = find_groundstate(state, H, GradientGrassmann(; maxiter=20));" + "groundstate, cache, delta = find_groundstate(state, H, GradientGrassmann(; maxiter = 20));" ], "metadata": {}, "execution_count": null @@ -148,9 +148,10 @@ "cell_type": "code", "source": [ "# H2 = repeat(H, 2); -- copies the one-site version\n", - "H2 = heisenberg_XXX(ComplexF64, Trivial, InfiniteChain(2); spin=1 // 2)\n", - "groundstate, envs, delta = find_groundstate(state, H2,\n", - " VUMPS(; maxiter=100, tol=1e-12));" + "H2 = heisenberg_XXX(ComplexF64, Trivial, InfiniteChain(2); spin = 1 // 2)\n", + "groundstate, envs, delta = find_groundstate(\n", + " state, H2, VUMPS(; maxiter = 100, tol = 1.0e-12)\n", + ");" ], "metadata": {}, "execution_count": null @@ -167,9 +168,9 @@ "outputs": [], "cell_type": "code", "source": [ - "groundstate, envs, delta = find_groundstate(state, H2,\n", - " IDMRG2(; trscheme=truncdim(50), maxiter=20,\n", - " tol=1e-12));\n", + "groundstate, envs, delta = find_groundstate(\n", + " state, H2, IDMRG2(; trscheme = truncrank(50), maxiter = 20, tol = 1.0e-12)\n", + ");\n", "entanglementplot(groundstate)" ], "metadata": {}, @@ -202,7 +203,7 @@ "outputs": [], "cell_type": "code", "source": [ - "H2 = heisenberg_XXX(ComplexF64, SU2Irrep, InfiniteChain(2); spin=1 // 2);" + "H2 = heisenberg_XXX(ComplexF64, SU2Irrep, InfiniteChain(2); spin = 1 // 2);" ], "metadata": {}, "execution_count": null @@ -245,8 +246,7 @@ "source": [ "println(dim(V1))\n", "println(dim(V2))\n", - "groundstate, cache, delta = find_groundstate(state, H2,\n", - " VUMPS(; maxiter=400, tol=1e-12));" + "groundstate, cache, delta = find_groundstate(state, H2, VUMPS(; maxiter = 400, tol = 1.0e-12));" ], "metadata": {}, "execution_count": null @@ -267,13 +267,13 @@ "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.10.4" + "version": "1.12.0" }, "kernelspec": { - "name": "julia-1.10", - "display_name": "Julia 1.10.4", + "name": "julia-1.12", + "display_name": "Julia 1.12.0", "language": "julia" } }, "nbformat": 4 -} +} \ No newline at end of file diff --git a/docs/src/examples/quantum1d/5.haldane-spt/index.md b/docs/src/examples/quantum1d/5.haldane-spt/index.md index e020519ca..abd4f7a80 100644 --- a/docs/src/examples/quantum1d/5.haldane-spt/index.md +++ b/docs/src/examples/quantum1d/5.haldane-spt/index.md @@ -41,7 +41,7 @@ using Plots casimir(s::SU2Irrep) = s.j * (s.j + 1) -function heisenberg_hamiltonian(; J=-1.0) +function heisenberg_hamiltonian(; J = -1.0) s = SU2Irrep(1) ℋ = SU2Space(1 => 1) SS = zeros(ComplexF64, ℋ ⊗ ℋ ← ℋ ⊗ ℋ) @@ -56,7 +56,7 @@ H = heisenberg_hamiltonian() ```` single site InfiniteMPOHamiltonian{MPSKit.JordanMPOTensor{ComplexF64, TensorKit.GradedSpace{TensorKitSectors.SU2Irrep, TensorKit.SortedVectorDict{TensorKitSectors.SU2Irrep, Int64}}, Union{TensorKit.BraidingTensor{ComplexF64, TensorKit.GradedSpace{TensorKitSectors.SU2Irrep, TensorKit.SortedVectorDict{TensorKitSectors.SU2Irrep, Int64}}}, TensorKit.TensorMap{ComplexF64, TensorKit.GradedSpace{TensorKitSectors.SU2Irrep, TensorKit.SortedVectorDict{TensorKitSectors.SU2Irrep, Int64}}, 2, 2, Vector{ComplexF64}}}, TensorKit.TensorMap{ComplexF64, TensorKit.GradedSpace{TensorKitSectors.SU2Irrep, TensorKit.SortedVectorDict{TensorKitSectors.SU2Irrep, Int64}}, 2, 1, Vector{ComplexF64}}, TensorKit.TensorMap{ComplexF64, TensorKit.GradedSpace{TensorKitSectors.SU2Irrep, TensorKit.SortedVectorDict{TensorKitSectors.SU2Irrep, Int64}}, 1, 2, Vector{ComplexF64}}, TensorKit.TensorMap{ComplexF64, TensorKit.GradedSpace{TensorKitSectors.SU2Irrep, TensorKit.SortedVectorDict{TensorKitSectors.SU2Irrep, Int64}}, 1, 1, Vector{ComplexF64}}}}: ╷ ⋮ -┼ W[1]: 3×1×1×3 JordanMPOTensor(((Rep[SU₂](0=>1) ⊕ Rep[SU₂](1=>1) ⊕ Rep[SU₂](0=>1)) ⊗ ⊕(Rep[SU₂](1=>1))) ← (⊕(Rep[SU₂](1=>1)) ⊗ (Rep[SU₂](0=>1) ⊕ Rep[SU₂](1=>1) ⊕ Rep[SU₂](0=>1)))) +┼ W[1]: 3×1×1×3 JordanMPOTensor(((Rep[SU₂](0=>1) ⊞ Rep[SU₂](1=>1) ⊞ Rep[SU₂](0=>1)) ⊗ ⊞(Rep[SU₂](1=>1))) ← (⊞(Rep[SU₂](1=>1)) ⊗ (Rep[SU₂](0=>1) ⊞ Rep[SU₂](1=>1) ⊞ Rep[SU₂](0=>1)))) ╵ ⋮ ```` @@ -95,295 +95,13 @@ non-injective MPS. ℋ = SU2Space(1 => 1) V_wrong = SU2Space(0 => 8, 1 // 2 => 8, 1 => 3, 3 // 2 => 3) ψ = InfiniteMPS(ℋ, V_wrong) -ψ, environments, δ = find_groundstate(ψ, H, VUMPS(; maxiter=10)) +ψ, environments, δ = find_groundstate(ψ, H, VUMPS(; maxiter = 10)) sectors = SU2Irrep[0, 1 // 2, 1, 3 // 2] -transferplot(ψ; sectors, title="Transfer matrix spectrum", legend=:outertop) +transferplot(ψ; sectors, title = "Transfer matrix spectrum", legend = :outertop) ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` Nevertheless, using the symmetry, this can be remedied rather easily, by imposing the @@ -405,607 +123,49 @@ right SPT phase. ````julia V_plus = SU2Space(0 => 10, 1 => 5, 2 => 3) ψ_plus = InfiniteMPS(ℋ, V_plus) -ψ_plus, = find_groundstate(ψ_plus, H, VUMPS(; maxiter=100)) +ψ_plus, = find_groundstate(ψ_plus, H, VUMPS(; maxiter = 100)) E_plus = expectation_value(ψ_plus, H) ```` ```` --1.4014193313392993 - 2.900712048241961e-17im +-1.401419331339302 - 1.2835881733092454e-17im ```` ````julia V_minus = SU2Space(1 // 2 => 10, 3 // 2 => 5, 5 // 2 => 3) ψ_minus = InfiniteMPS(ℋ, V_minus) -ψ_minus, = find_groundstate(ψ_minus, H, VUMPS(; maxiter=100)) +ψ_minus, = find_groundstate(ψ_minus, H, VUMPS(; maxiter = 100)) E_minus = expectation_value(ψ_minus, H) ```` ```` --1.4014839739630869 - 1.670298784395022e-16im +-1.401483973963085 + 2.188327525534786e-16im ```` ````julia -transferp_plus = transferplot(ψ_plus; sectors=SU2Irrep[0, 1, 2], title="ψ_plus", - legend=:outertop) -transferp_minus = transferplot(ψ_minus; sectors=SU2Irrep[0, 1, 2], title="ψ_minus", - legend=:outertop) -plot(transferp_plus, transferp_minus; layout=(1, 2), size=(800, 400)) +transferp_plus = transferplot( + ψ_plus; + sectors = SU2Irrep[0, 1, 2], title = "ψ_plus", legend = :outertop +) +transferp_minus = transferplot( + ψ_minus; + sectors = SU2Irrep[0, 1, 2], title = "ψ_minus", legend = :outertop +) +plot(transferp_plus, transferp_minus; layout = (1, 2), size = (800, 400)) ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` ````julia -entanglementp_plus = entanglementplot(ψ_plus; title="ψ_plus", legend=:outertop) -entanglementp_minus = entanglementplot(ψ_minus; title="ψ_minus", legend=:outertop) -plot(entanglementp_plus, entanglementp_minus; layout=(1, 2), size=(800, 400)) +entanglementp_plus = entanglementplot(ψ_plus; title = "ψ_plus", legend = :outertop) +entanglementp_minus = entanglementplot(ψ_minus; title = "ψ_minus", legend = :outertop) +plot(entanglementp_plus, entanglementp_minus; layout = (1, 2), size = (800, 400)) ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` As we can see, the groundstate can be found in the non-trivial SPT phase, $\ket{\psi_-}$. We @@ -1032,8 +192,8 @@ println("S_plus = $S_plus") ```` ```` -S_minus + log(2) = 1.5486227235407952 -S_plus = 1.5450323530589885 +S_minus + log(2) = 1.5486227235438952 +S_plus = 1.54503235302521 ```` diff --git a/docs/src/examples/quantum1d/5.haldane-spt/main.ipynb b/docs/src/examples/quantum1d/5.haldane-spt/main.ipynb index 964f3765f..6c03ba77a 100644 --- a/docs/src/examples/quantum1d/5.haldane-spt/main.ipynb +++ b/docs/src/examples/quantum1d/5.haldane-spt/main.ipynb @@ -43,7 +43,7 @@ "\n", "casimir(s::SU2Irrep) = s.j * (s.j + 1)\n", "\n", - "function heisenberg_hamiltonian(; J=-1.0)\n", + "function heisenberg_hamiltonian(; J = -1.0)\n", " s = SU2Irrep(1)\n", " ℋ = SU2Space(1 => 1)\n", " SS = zeros(ComplexF64, ℋ ⊗ ℋ ← ℋ ⊗ ℋ)\n", @@ -99,9 +99,9 @@ "ℋ = SU2Space(1 => 1)\n", "V_wrong = SU2Space(0 => 8, 1 // 2 => 8, 1 => 3, 3 // 2 => 3)\n", "ψ = InfiniteMPS(ℋ, V_wrong)\n", - "ψ, environments, δ = find_groundstate(ψ, H, VUMPS(; maxiter=10))\n", + "ψ, environments, δ = find_groundstate(ψ, H, VUMPS(; maxiter = 10))\n", "sectors = SU2Irrep[0, 1 // 2, 1, 3 // 2]\n", - "transferplot(ψ; sectors, title=\"Transfer matrix spectrum\", legend=:outertop)" + "transferplot(ψ; sectors, title = \"Transfer matrix spectrum\", legend = :outertop)" ], "metadata": {}, "execution_count": null @@ -133,20 +133,24 @@ "source": [ "V_plus = SU2Space(0 => 10, 1 => 5, 2 => 3)\n", "ψ_plus = InfiniteMPS(ℋ, V_plus)\n", - "ψ_plus, = find_groundstate(ψ_plus, H, VUMPS(; maxiter=100))\n", + "ψ_plus, = find_groundstate(ψ_plus, H, VUMPS(; maxiter = 100))\n", "E_plus = expectation_value(ψ_plus, H)\n", "V_minus = SU2Space(1 // 2 => 10, 3 // 2 => 5, 5 // 2 => 3)\n", "ψ_minus = InfiniteMPS(ℋ, V_minus)\n", - "ψ_minus, = find_groundstate(ψ_minus, H, VUMPS(; maxiter=100))\n", + "ψ_minus, = find_groundstate(ψ_minus, H, VUMPS(; maxiter = 100))\n", "E_minus = expectation_value(ψ_minus, H)\n", - "transferp_plus = transferplot(ψ_plus; sectors=SU2Irrep[0, 1, 2], title=\"ψ_plus\",\n", - " legend=:outertop)\n", - "transferp_minus = transferplot(ψ_minus; sectors=SU2Irrep[0, 1, 2], title=\"ψ_minus\",\n", - " legend=:outertop)\n", - "plot(transferp_plus, transferp_minus; layout=(1, 2), size=(800, 400))\n", - "entanglementp_plus = entanglementplot(ψ_plus; title=\"ψ_plus\", legend=:outertop)\n", - "entanglementp_minus = entanglementplot(ψ_minus; title=\"ψ_minus\", legend=:outertop)\n", - "plot(entanglementp_plus, entanglementp_minus; layout=(1, 2), size=(800, 400))" + "transferp_plus = transferplot(\n", + " ψ_plus;\n", + " sectors = SU2Irrep[0, 1, 2], title = \"ψ_plus\", legend = :outertop\n", + ")\n", + "transferp_minus = transferplot(\n", + " ψ_minus;\n", + " sectors = SU2Irrep[0, 1, 2], title = \"ψ_minus\", legend = :outertop\n", + ")\n", + "plot(transferp_plus, transferp_minus; layout = (1, 2), size = (800, 400))\n", + "entanglementp_plus = entanglementplot(ψ_plus; title = \"ψ_plus\", legend = :outertop)\n", + "entanglementp_minus = entanglementplot(ψ_minus; title = \"ψ_minus\", legend = :outertop)\n", + "plot(entanglementp_plus, entanglementp_minus; layout = (1, 2), size = (800, 400))" ], "metadata": {}, "execution_count": null @@ -200,13 +204,13 @@ "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.10.4" + "version": "1.12.0" }, "kernelspec": { - "name": "julia-1.10", - "display_name": "Julia 1.10.4", + "name": "julia-1.12", + "display_name": "Julia 1.12.0", "language": "julia" } }, "nbformat": 4 -} +} \ No newline at end of file diff --git a/docs/src/examples/quantum1d/6.hubbard/index.md b/docs/src/examples/quantum1d/6.hubbard/index.md index d05b363bd..a012ed02b 100644 --- a/docs/src/examples/quantum1d/6.hubbard/index.md +++ b/docs/src/examples/quantum1d/6.hubbard/index.md @@ -64,38 +64,44 @@ e(u) = - u - 4 \int_0^{\infty} \frac{d\omega}{\omega} \frac{J_0(\omega) J_1(\ome We can easily verify this by comparing the numerical results to the analytic solution. ````julia -function hubbard_energy(u; rtol=1e-12) +function hubbard_energy(u; rtol = 1.0e-12) integrandum(ω) = besselj0(ω) * besselj1(ω) / (1 + exp(2u * ω)) / ω - int, err = quadgk(integrandum, 0, Inf; rtol=rtol) + int, err = quadgk(integrandum, 0, Inf; rtol = rtol) return -u - 4 * int end -function compute_groundstate(psi, H; - svalue=1e-3, - expansionfactor=(1 / 10), - expansioniter=20) +function compute_groundstate( + psi, H; + svalue = 1.0e-3, + expansionfactor = (1 / 10), + expansioniter = 20 + ) verbosity = 2 - psi, = find_groundstate(psi, H; tol=svalue * 10, verbosity) + psi, = find_groundstate(psi, H; tol = svalue * 10, verbosity) for _ in 1:expansioniter D = maximum(x -> dim(left_virtualspace(psi, x)), 1:length(psi)) D′ = max(5, round(Int, D * expansionfactor)) - trscheme = truncbelow(svalue / 10) & truncdim(D′) - psi′, = changebonds(psi, H, OptimalExpand(; trscheme=trscheme)) - all(left_virtualspace.(Ref(psi), 1:length(psi)) .== - left_virtualspace.(Ref(psi′), 1:length(psi))) && break - psi, = find_groundstate(psi′, H, VUMPS(; tol=svalue / 5, maxiter=10, verbosity)) + trscheme = trunctol(; atol = svalue / 10) & truncrank(D′) + psi′, = changebonds(psi, H, OptimalExpand(; trscheme = trscheme)) + all( + left_virtualspace.(Ref(psi), 1:length(psi)) .== + left_virtualspace.(Ref(psi′), 1:length(psi)) + ) && break + psi, = find_groundstate(psi′, H, VUMPS(; tol = svalue / 5, maxiter = 10, verbosity)) end # convergence steps - psi, = changebonds(psi, H, SvdCut(; trscheme=truncbelow(svalue))) - psi, = find_groundstate(psi, H, - VUMPS(; tol=svalue / 100, verbosity, maxiter=100) & - GradientGrassmann(; tol=svalue / 1000)) + psi, = changebonds(psi, H, SvdCut(; trscheme = trunctol(; atol = svalue))) + psi, = find_groundstate( + psi, H, + VUMPS(; tol = svalue / 100, verbosity, maxiter = 100) & + GradientGrassmann(; tol = svalue / 1000) + ) return psi end -H = hubbard_model(InfiniteChain(2); U, t, mu=U / 2) +H = hubbard_model(InfiniteChain(2); U, t, mu = U / 2) Vspaces = fill(Vect[fℤ₂](0 => 10, 1 => 10), 2) psi = InfiniteMPS(physicalspace(H), Vspaces) psi = compute_groundstate(psi, H) @@ -108,54 +114,54 @@ Groundstate energy: ```` ```` -[ Info: VUMPS init: obj = -1.418138980906e+00 err = 5.4975e-01 -[ Info: VUMPS conv 7: obj = -4.376662745131e+00 err = 8.7994117461e-03 time = 5.77 sec -[ Info: VUMPS init: obj = -4.376662745131e+00 err = 2.1471e-02 -[ Info: VUMPS conv 8: obj = -4.378745586158e+00 err = 1.5392590844e-04 time = 0.67 sec -[ Info: VUMPS init: obj = -4.378745586158e+00 err = 8.1759e-03 -[ Info: VUMPS conv 6: obj = -4.379161067061e+00 err = 1.5555838326e-04 time = 0.44 sec -[ Info: VUMPS init: obj = -4.379161067061e+00 err = 6.1229e-03 -[ Info: VUMPS conv 5: obj = -4.379452165287e+00 err = 1.7041880980e-04 time = 0.61 sec -[ Info: VUMPS init: obj = -4.379452165287e+00 err = 5.6967e-03 -[ Info: VUMPS conv 4: obj = -4.379651685338e+00 err = 1.9086298845e-04 time = 0.47 sec -[ Info: VUMPS init: obj = -4.379651685338e+00 err = 4.1042e-03 -[ Info: VUMPS conv 4: obj = -4.379735588923e+00 err = 1.4107256275e-04 time = 0.59 sec -[ Info: VUMPS init: obj = -4.379735588923e+00 err = 3.5761e-03 -[ Info: VUMPS conv 3: obj = -4.379797862274e+00 err = 1.3847431310e-04 time = 0.47 sec -[ Info: VUMPS init: obj = -4.379797862274e+00 err = 2.7695e-03 -[ Info: VUMPS conv 2: obj = -4.379838498353e+00 err = 1.8068332663e-04 time = 0.33 sec -[ Info: VUMPS init: obj = -4.379838498352e+00 err = 2.7281e-03 -[ Info: VUMPS conv 3: obj = -4.379878843329e+00 err = 1.9308669443e-04 time = 0.73 sec -[ Info: VUMPS init: obj = -4.379878843329e+00 err = 2.6902e-03 -[ Info: VUMPS conv 3: obj = -4.379929213991e+00 err = 1.7246879281e-04 time = 0.97 sec -[ Info: VUMPS init: obj = -4.379929213991e+00 err = 2.5537e-03 -[ Info: VUMPS conv 3: obj = -4.379968050470e+00 err = 1.7633765416e-04 time = 1.23 sec -[ Info: VUMPS init: obj = -4.379968050470e+00 err = 1.7676e-03 -[ Info: VUMPS conv 2: obj = -4.379986897845e+00 err = 1.7982149771e-04 time = 0.93 sec -[ Info: VUMPS init: obj = -4.379986897845e+00 err = 1.5832e-03 -[ Info: VUMPS conv 2: obj = -4.380001017729e+00 err = 1.8565198322e-04 time = 1.22 sec -[ Info: VUMPS init: obj = -4.380001017729e+00 err = 1.5102e-03 -[ Info: VUMPS conv 2: obj = -4.380013168324e+00 err = 1.5019893736e-04 time = 1.55 sec -[ Info: VUMPS init: obj = -4.380013168324e+00 err = 1.4228e-03 -[ Info: VUMPS conv 2: obj = -4.380024392465e+00 err = 1.7662069399e-04 time = 2.36 sec -[ Info: VUMPS init: obj = -4.380024392465e+00 err = 1.3320e-03 -[ Info: VUMPS conv 2: obj = -4.380038151479e+00 err = 1.5891915641e-04 time = 2.25 sec -[ Info: VUMPS init: obj = -4.380038151479e+00 err = 1.0034e-03 -[ Info: VUMPS conv 1: obj = -4.380043679645e+00 err = 1.6778281273e-04 time = 0.83 sec -[ Info: VUMPS init: obj = -4.380043679649e+00 err = 9.1040e-04 -[ Info: VUMPS conv 1: obj = -4.380048640213e+00 err = 1.8625092812e-04 time = 1.14 sec -[ Info: VUMPS init: obj = -4.380048640225e+00 err = 8.3097e-04 -[ Info: VUMPS conv 1: obj = -4.380053201812e+00 err = 1.8243182942e-04 time = 1.01 sec -[ Info: VUMPS init: obj = -4.380053201846e+00 err = 6.8228e-04 -[ Info: VUMPS conv 1: obj = -4.380057143072e+00 err = 1.9139721436e-04 time = 1.85 sec -[ Info: VUMPS init: obj = -4.380057143076e+00 err = 6.0387e-04 -[ Info: VUMPS conv 1: obj = -4.380060547201e+00 err = 1.8483235697e-04 time = 1.31 sec -[ Info: VUMPS init: obj = -4.379609329367e+00 err = 4.0967e-03 -[ Info: VUMPS conv 19: obj = -4.379762979233e+00 err = 9.9502287579e-06 time = 10.30 sec -[ Info: CG: initializing with f = -4.379762978878, ‖∇f‖ = 3.1550e-05 -[ Info: CG: converged after 166 iterations and time 130.43 s: f = -4.379763024867, ‖∇f‖ = 9.5155e-07 +[ Info: VUMPS init: obj = -1.579081573143e+00 err = 5.2411e-01 +[ Info: VUMPS conv 7: obj = -4.377030027572e+00 err = 9.5143497631e-03 time = 8.04 sec +[ Info: VUMPS init: obj = -4.377030027572e+00 err = 1.6737e-02 +[ Info: VUMPS conv 6: obj = -4.378747216681e+00 err = 1.5036098687e-04 time = 0.37 sec +[ Info: VUMPS init: obj = -4.378747216681e+00 err = 8.0072e-03 +[ Info: VUMPS conv 6: obj = -4.379161050350e+00 err = 1.6595379794e-04 time = 0.38 sec +[ Info: VUMPS init: obj = -4.379161050350e+00 err = 6.1111e-03 +[ Info: VUMPS conv 5: obj = -4.379452139513e+00 err = 1.7635676107e-04 time = 0.40 sec +[ Info: VUMPS init: obj = -4.379452139513e+00 err = 5.6960e-03 +[ Info: VUMPS conv 4: obj = -4.379651657382e+00 err = 1.7362696368e-04 time = 0.38 sec +[ Info: VUMPS init: obj = -4.379651657382e+00 err = 4.1057e-03 +[ Info: VUMPS conv 3: obj = -4.379734893707e+00 err = 1.9418536588e-04 time = 0.32 sec +[ Info: VUMPS init: obj = -4.379734893707e+00 err = 3.5576e-03 +[ Info: VUMPS conv 3: obj = -4.379797734073e+00 err = 1.3530833964e-04 time = 0.50 sec +[ Info: VUMPS init: obj = -4.379797734073e+00 err = 2.7583e-03 +[ Info: VUMPS conv 2: obj = -4.379838443218e+00 err = 1.7548586831e-04 time = 0.34 sec +[ Info: VUMPS init: obj = -4.379838443218e+00 err = 2.7244e-03 +[ Info: VUMPS conv 3: obj = -4.379878819613e+00 err = 1.9910900463e-04 time = 0.68 sec +[ Info: VUMPS init: obj = -4.379878819613e+00 err = 2.6903e-03 +[ Info: VUMPS conv 3: obj = -4.379929209976e+00 err = 1.7353866489e-04 time = 0.89 sec +[ Info: VUMPS init: obj = -4.379929209976e+00 err = 2.5534e-03 +[ Info: VUMPS conv 3: obj = -4.379968033957e+00 err = 1.8030717590e-04 time = 1.15 sec +[ Info: VUMPS init: obj = -4.379968033957e+00 err = 1.7669e-03 +[ Info: VUMPS conv 2: obj = -4.379986875953e+00 err = 1.8529970888e-04 time = 0.75 sec +[ Info: VUMPS init: obj = -4.379986875953e+00 err = 1.5829e-03 +[ Info: VUMPS conv 2: obj = -4.380001233738e+00 err = 1.8857698446e-04 time = 0.86 sec +[ Info: VUMPS init: obj = -4.380001233739e+00 err = 1.4982e-03 +[ Info: VUMPS conv 2: obj = -4.380013190309e+00 err = 1.4999356908e-04 time = 1.14 sec +[ Info: VUMPS init: obj = -4.380013190309e+00 err = 1.4212e-03 +[ Info: VUMPS conv 2: obj = -4.380024391046e+00 err = 1.7666048459e-04 time = 1.45 sec +[ Info: VUMPS init: obj = -4.380024391046e+00 err = 1.3326e-03 +[ Info: VUMPS conv 2: obj = -4.380038154943e+00 err = 1.5589147881e-04 time = 1.71 sec +[ Info: VUMPS init: obj = -4.380038154943e+00 err = 1.0028e-03 +[ Info: VUMPS conv 1: obj = -4.380043680273e+00 err = 1.6697843620e-04 time = 0.74 sec +[ Info: VUMPS init: obj = -4.380043680277e+00 err = 9.0960e-04 +[ Info: VUMPS conv 1: obj = -4.380048637666e+00 err = 1.8527886431e-04 time = 0.83 sec +[ Info: VUMPS init: obj = -4.380048637678e+00 err = 8.3048e-04 +[ Info: VUMPS conv 1: obj = -4.380053195003e+00 err = 1.8076356558e-04 time = 0.94 sec +[ Info: VUMPS init: obj = -4.380053195036e+00 err = 6.8162e-04 +[ Info: VUMPS conv 1: obj = -4.380057137143e+00 err = 1.8928785082e-04 time = 1.17 sec +[ Info: VUMPS init: obj = -4.380057137148e+00 err = 6.0309e-04 +[ Info: VUMPS conv 1: obj = -4.380060540455e+00 err = 1.8334294673e-04 time = 1.33 sec +[ Info: VUMPS init: obj = -4.379609563543e+00 err = 4.0950e-03 +[ Info: VUMPS conv 19: obj = -4.379763089580e+00 err = 9.9477192904e-06 time = 8.38 sec +[ Info: CG: initializing with f = -4.379763089225, ‖∇f‖ = 3.1536e-05 +[ Info: CG: converged after 170 iterations and time 89.57 s: f = -4.379763311396, ‖∇f‖ = 9.4220e-07 ┌ Info: Groundstate energy: -│ * numerical: -2.1899960610082476 +│ * numerical: -2.1899960609614597 └ * analytic: -2.190038374277775 ```` @@ -172,14 +178,14 @@ In order to work at half-filling, we need to effectively inject one particle per In MPSKit, this is achieved by the `add_physical_charge` function, which shifts the physical spaces of the tensors to the desired charge sector. ````julia -H_u1_su2 = hubbard_model(ComplexF64, U1Irrep, SU2Irrep, InfiniteChain(2); U, t, mu=U / 2); +H_u1_su2 = hubbard_model(ComplexF64, U1Irrep, SU2Irrep, InfiniteChain(2); U, t, mu = U / 2); charges = fill(FermionParity(1) ⊠ U1Irrep(1) ⊠ SU2Irrep(0), 2); H_u1_su2 = MPSKit.add_physical_charge(H_u1_su2, charges); pspaces = physicalspace.(Ref(H_u1_su2), 1:2) vspaces = [oneunit(eltype(pspaces)), first(pspaces)] psi = InfiniteMPS(pspaces, vspaces) -psi = compute_groundstate(psi, H_u1_su2; expansionfactor=1 / 3) +psi = compute_groundstate(psi, H_u1_su2; expansionfactor = 1 / 3) E = real(expectation_value(psi, H_u1_su2)) / 2 @info """ Groundstate energy: @@ -189,56 +195,56 @@ Groundstate energy: ```` ```` -[ Info: VUMPS init: obj = -3.310849814614e-03 err = 9.6889e-01 -[ Info: VUMPS conv 1: obj = -4.000000000000e+00 err = 1.7910070597e-15 time = 4.40 sec +[ Info: VUMPS init: obj = +8.497854905331e-01 err = 6.4635e-01 +[ Info: VUMPS conv 1: obj = -4.000000000000e+00 err = 2.0411791683e-15 time = 4.67 sec [ Info: VUMPS init: obj = -4.000000000000e+00 err = 3.3634e-01 -[ Info: VUMPS conv 4: obj = -4.289650419703e+00 err = 1.8515305877e-04 time = 0.04 sec +[ Info: VUMPS conv 4: obj = -4.289650419703e+00 err = 1.8515305877e-04 time = 0.06 sec [ Info: VUMPS init: obj = -4.289650419703e+00 err = 1.1203e-01 -[ Info: VUMPS conv 6: obj = -4.359865567633e+00 err = 1.0046406773e-04 time = 0.10 sec +[ Info: VUMPS conv 6: obj = -4.359865567633e+00 err = 1.0046406773e-04 time = 0.16 sec [ Info: VUMPS init: obj = -4.359865567633e+00 err = 4.3643e-02 -[ Info: VUMPS conv 6: obj = -4.372880928577e+00 err = 1.3023373974e-04 time = 1.98 sec +[ Info: VUMPS conv 6: obj = -4.372880928577e+00 err = 1.3023373974e-04 time = 2.56 sec [ Info: VUMPS init: obj = -4.372880928577e+00 err = 3.2693e-02 -[ Info: VUMPS conv 4: obj = -4.375236954734e+00 err = 1.1803697903e-04 time = 0.11 sec +[ Info: VUMPS conv 4: obj = -4.375236954734e+00 err = 1.1803697903e-04 time = 0.09 sec [ Info: VUMPS init: obj = -4.375236954734e+00 err = 2.9487e-02 -[ Info: VUMPS conv 7: obj = -4.378159083989e+00 err = 1.1902548728e-04 time = 0.28 sec +[ Info: VUMPS conv 7: obj = -4.378159083989e+00 err = 1.1902548728e-04 time = 0.29 sec [ Info: VUMPS init: obj = -4.378159083989e+00 err = 1.9312e-02 -[ Info: VUMPS conv 5: obj = -4.379272965038e+00 err = 1.5792669082e-04 time = 0.26 sec +[ Info: VUMPS conv 5: obj = -4.379272965038e+00 err = 1.5792669082e-04 time = 0.18 sec [ Info: VUMPS init: obj = -4.379272965037e+00 err = 9.9127e-03 -[ Info: VUMPS conv 4: obj = -4.379592225819e+00 err = 1.5571559712e-04 time = 0.64 sec +[ Info: VUMPS conv 4: obj = -4.379592225819e+00 err = 1.5571559713e-04 time = 0.19 sec [ Info: VUMPS init: obj = -4.379592225819e+00 err = 6.4839e-03 -[ Info: VUMPS conv 4: obj = -4.379819373805e+00 err = 1.7517067710e-04 time = 0.29 sec +[ Info: VUMPS conv 4: obj = -4.379819373805e+00 err = 1.7517067710e-04 time = 0.27 sec [ Info: VUMPS init: obj = -4.379819373805e+00 err = 3.8752e-03 -┌ Warning: VUMPS cancel 10: obj = -4.379964036336e+00 err = 2.1162213354e-04 time = 1.09 sec -└ @ MPSKit ~/git/MPSKit.jl/src/algorithms/groundstate/vumps.jl:73 +┌ Warning: VUMPS cancel 10: obj = -4.379964036336e+00 err = 2.1162213354e-04 time = 0.88 sec +└ @ MPSKit ~/Projects/MPSKit.jl/src/algorithms/groundstate/vumps.jl:76 [ Info: VUMPS init: obj = -4.379964036335e+00 err = 2.8980e-03 -[ Info: VUMPS conv 3: obj = -4.380010370460e+00 err = 1.4802655346e-04 time = 0.43 sec +[ Info: VUMPS conv 3: obj = -4.380010370460e+00 err = 1.4802655346e-04 time = 0.37 sec [ Info: VUMPS init: obj = -4.380010370460e+00 err = 2.0599e-03 -[ Info: VUMPS conv 3: obj = -4.380041745689e+00 err = 1.6343265011e-04 time = 0.61 sec +[ Info: VUMPS conv 3: obj = -4.380041745689e+00 err = 1.6343265011e-04 time = 0.53 sec [ Info: VUMPS init: obj = -4.380041745689e+00 err = 1.2361e-03 -[ Info: VUMPS conv 2: obj = -4.380055779898e+00 err = 1.8387821190e-04 time = 0.54 sec +[ Info: VUMPS conv 2: obj = -4.380055779898e+00 err = 1.8387821190e-04 time = 0.42 sec [ Info: VUMPS init: obj = -4.380055779898e+00 err = 8.5853e-04 -[ Info: VUMPS conv 2: obj = -4.380064751120e+00 err = 1.3920368100e-04 time = 0.82 sec +[ Info: VUMPS conv 2: obj = -4.380064751120e+00 err = 1.3920368100e-04 time = 0.63 sec [ Info: VUMPS init: obj = -4.380064751120e+00 err = 5.2503e-04 -[ Info: VUMPS conv 1: obj = -4.380067975496e+00 err = 1.5780382243e-04 time = 0.45 sec +[ Info: VUMPS conv 1: obj = -4.380067975496e+00 err = 1.5780382243e-04 time = 0.35 sec [ Info: VUMPS init: obj = -4.380067975589e+00 err = 3.3360e-04 -[ Info: VUMPS conv 1: obj = -4.380070355793e+00 err = 1.3292468609e-04 time = 0.61 sec +[ Info: VUMPS conv 1: obj = -4.380070355793e+00 err = 1.3292468609e-04 time = 0.49 sec [ Info: VUMPS init: obj = -4.380070355905e+00 err = 2.0509e-04 -[ Info: VUMPS conv 1: obj = -4.380072130176e+00 err = 1.1399026715e-04 time = 0.89 sec +[ Info: VUMPS conv 1: obj = -4.380072130176e+00 err = 1.1399026715e-04 time = 0.70 sec [ Info: VUMPS init: obj = -4.380072130335e+00 err = 1.3827e-04 -[ Info: VUMPS conv 1: obj = -4.380073468947e+00 err = 8.7912179069e-05 time = 1.30 sec +[ Info: VUMPS conv 1: obj = -4.380073468947e+00 err = 8.7912179067e-05 time = 1.13 sec [ Info: VUMPS init: obj = -4.380073469160e+00 err = 9.9636e-05 -[ Info: VUMPS conv 1: obj = -4.380074456012e+00 err = 6.8484929133e-05 time = 2.04 sec +[ Info: VUMPS conv 1: obj = -4.380074456012e+00 err = 6.8484929131e-05 time = 3.50 sec [ Info: VUMPS init: obj = -4.380074456584e+00 err = 7.7488e-05 -[ Info: VUMPS conv 1: obj = -4.380075158440e+00 err = 6.5951776335e-05 time = 4.26 sec +[ Info: VUMPS conv 1: obj = -4.380075158440e+00 err = 6.5951776337e-05 time = 3.49 sec [ Info: VUMPS init: obj = -4.380075159046e+00 err = 6.3891e-05 -[ Info: VUMPS conv 1: obj = -4.380075656659e+00 err = 4.7588615250e-05 time = 6.33 sec -[ Info: VUMPS init: obj = -4.379308902466e+00 err = 8.0000e-03 -┌ Warning: VUMPS cancel 100: obj = -4.379693243679e+00 err = 1.5955101981e-05 time = 17.79 sec -└ @ MPSKit ~/git/MPSKit.jl/src/algorithms/groundstate/vumps.jl:73 +[ Info: VUMPS conv 1: obj = -4.380075656659e+00 err = 4.7588615231e-05 time = 8.17 sec +[ Info: VUMPS init: obj = -4.379308902467e+00 err = 8.0000e-03 +┌ Warning: VUMPS cancel 100: obj = -4.379693243679e+00 err = 1.5955101978e-05 time = 15.41 sec +└ @ MPSKit ~/Projects/MPSKit.jl/src/algorithms/groundstate/vumps.jl:76 [ Info: CG: initializing with f = -4.379693243679, ‖∇f‖ = 5.7833e-05 -[ Info: CG: converged after 13 iterations and time 4.96 s: f = -4.379693244608, ‖∇f‖ = 6.3799e-07 +[ Info: CG: converged after 13 iterations and time 6.25 s: f = -4.379693244608, ‖∇f‖ = 6.3799e-07 ┌ Info: Groundstate energy: -│ * numerical: -2.1900153475149438 +│ * numerical: -2.1900153475149375 └ * analytic: -2.190038374277775 ```` @@ -254,22 +260,24 @@ In other words, the groundstates are ``\psi_{AB}` and ``\psi_{BA}``, where ``A`` These excitations can be constructed as follows: ````julia -alg = QuasiparticleAnsatz(; tol=1e-3) -momenta = range(-π, π; length=33) +alg = QuasiparticleAnsatz(; tol = 1.0e-3) +momenta = range(-π, π; length = 33) psi_AB = psi envs_AB = environments(psi_AB, H_u1_su2); psi_BA = circshift(psi, 1) envs_BA = environments(psi_BA, H_u1_su2); spinon_charge = FermionParity(0) ⊠ U1Irrep(0) ⊠ SU2Irrep(1 // 2) -E_spinon, ϕ_spinon = excitations(H_u1_su2, alg, momenta, - psi_AB, envs_AB, psi_BA, envs_BA; - sector=spinon_charge, num=1); +E_spinon, ϕ_spinon = excitations( + H_u1_su2, alg, momenta, psi_AB, envs_AB, psi_BA, envs_BA; + sector = spinon_charge, num = 1 +); holon_charge = FermionParity(1) ⊠ U1Irrep(-1) ⊠ SU2Irrep(0) -E_holon, ϕ_holon = excitations(H_u1_su2, alg, momenta, - psi_AB, envs_AB, psi_BA, envs_BA; - sector=holon_charge, num=1); +E_holon, ϕ_holon = excitations( + H_u1_su2, alg, momenta, psi_AB, envs_AB, psi_BA, envs_BA; + sector = holon_charge, num = 1 +); ```` ```` @@ -346,25 +354,25 @@ Again, we can compare the numerical results to the analytic solution. Here, the formulae for the excitation energies are expressed in terms of dressed momenta: ````julia -function spinon_momentum(Λ, u; rtol=1e-12) +function spinon_momentum(Λ, u; rtol = 1.0e-12) integrandum(ω) = besselj0(ω) * sin(ω * Λ) / ω / cosh(ω * u) - return π / 2 - quadgk(integrandum, 0, Inf; rtol=rtol)[1] + return π / 2 - quadgk(integrandum, 0, Inf; rtol = rtol)[1] end -function spinon_energy(Λ, u; rtol=1e-12) +function spinon_energy(Λ, u; rtol = 1.0e-12) integrandum(ω) = besselj1(ω) * cos(ω * Λ) / ω / cosh(ω * u) - return 2 * quadgk(integrandum, 0, Inf; rtol=rtol)[1] + return 2 * quadgk(integrandum, 0, Inf; rtol = rtol)[1] end -function holon_momentum(k, u; rtol=1e-12) +function holon_momentum(k, u; rtol = 1.0e-12) integrandum(ω) = besselj0(ω) * sin(ω * sin(k)) / ω / (1 + exp(2u * abs(ω))) - return π / 2 - k - 2 * quadgk(integrandum, 0, Inf; rtol=rtol)[1] + return π / 2 - k - 2 * quadgk(integrandum, 0, Inf; rtol = rtol)[1] end -function holon_energy(k, u; rtol=1e-12) +function holon_energy(k, u; rtol = 1.0e-12) integrandum(ω) = besselj1(ω) * cos(ω * sin(k)) * exp(-ω * u) / ω / cosh(ω * u) - return 2 * cos(k) + 2u + 2 * quadgk(integrandum, 0, Inf; rtol=rtol)[1] + return 2 * cos(k) + 2u + 2 * quadgk(integrandum, 0, Inf; rtol = rtol)[1] end -Λs = range(-10, 10; length=51) +Λs = range(-10, 10; length = 51) P_spinon_analytic = rem2pi.(spinon_momentum.(Λs, U / 4), RoundNearest) E_spinon_analytic = spinon_energy.(Λs, U / 4) I_spinon = sortperm(P_spinon_analytic) @@ -373,146 +381,26 @@ E_spinon_analytic = E_spinon_analytic[I_spinon] P_spinon_analytic = [reverse(-P_spinon_analytic); P_spinon_analytic] E_spinon_analytic = [reverse(E_spinon_analytic); E_spinon_analytic]; -ks = range(0, 2π; length=51) +ks = range(0, 2π; length = 51) P_holon_analytic = rem2pi.(holon_momentum.(ks, U / 4), RoundNearest) E_holon_analytic = holon_energy.(ks, U / 4) I_holon = sortperm(P_holon_analytic) P_holon_analytic = P_holon_analytic[I_holon] E_holon_analytic = E_holon_analytic[I_holon]; -p = let p_excitations = plot(; xaxis="momentum", yaxis="energy") - scatter!(p_excitations, momenta, real(E_spinon); label="spinon") - plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label="spinon (analytic)") +p = let p_excitations = plot(; xaxis = "momentum", yaxis = "energy") + scatter!(p_excitations, momenta, real(E_spinon); label = "spinon") + plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label = "spinon (analytic)") - scatter!(p_excitations, momenta, real(E_holon); label="holon") - plot!(p_excitations, P_holon_analytic, E_holon_analytic; label="holon (analytic)") + scatter!(p_excitations, momenta, real(E_holon); label = "holon") + plot!(p_excitations, P_holon_analytic, E_holon_analytic; label = "holon (analytic)") p_excitations end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` The plot shows some discrepancies between the numerical and analytic results. @@ -522,137 +410,19 @@ Here, we can fix this shift by realizing that our choice of shifting the grounds ````julia momenta_shifted = rem2pi.(momenta .- π / 2, RoundNearest) -p = let p_excitations = plot(; xaxis="momentum", yaxis="energy", xlims=(-π, π)) - scatter!(p_excitations, momenta_shifted, real(E_spinon); label="spinon") - plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label="spinon (analytic)") +p = let p_excitations = plot(; xaxis = "momentum", yaxis = "energy", xlims = (-π, π)) + scatter!(p_excitations, momenta_shifted, real(E_spinon); label = "spinon") + plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label = "spinon (analytic)") - scatter!(p_excitations, momenta_shifted, real(E_holon); label="holon") - plot!(p_excitations, P_holon_analytic, E_holon_analytic; label="holon (analytic)") + scatter!(p_excitations, momenta_shifted, real(E_holon); label = "holon") + plot!(p_excitations, P_holon_analytic, E_holon_analytic; label = "holon (analytic)") p_excitations end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` The second discrepancy is that while the spinon dispersion is well-reproduced, the holon dispersion is not. @@ -662,10 +432,14 @@ If these are truly scattering states, the energy of the scattering state should Thus, we can find the lowest-energy scattering states by minimizing the energy over the combination of momenta for the constituent elementary excitations. ````julia -holon_dispersion_itp = linear_interpolation(P_holon_analytic, E_holon_analytic; - extrapolation_bc=Line()) -spinon_dispersion_itp = linear_interpolation(P_spinon_analytic, E_spinon_analytic; - extrapolation_bc=Line()) +holon_dispersion_itp = linear_interpolation( + P_holon_analytic, E_holon_analytic; + extrapolation_bc = Line() +) +spinon_dispersion_itp = linear_interpolation( + P_spinon_analytic, E_spinon_analytic; + extrapolation_bc = Line() +) function scattering_energy(p1, p2, p3) p1, p2, p3 = rem2pi.((p1, p2, p3), RoundNearest) return holon_dispersion_itp(p1) + spinon_dispersion_itp(p2) + spinon_dispersion_itp(p3) @@ -696,156 +470,27 @@ E_scattering_max = map(momenta_shifted) do p return e end; -p = let p_excitations = plot(; xaxis="momentum", yaxis="energy", xlims=(-π, π), - ylims=(-0.1, 5)) - scatter!(p_excitations, momenta_shifted, real(E_spinon); label="spinon") - plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label="spinon (analytic)") +p = let p_excitations = plot(; + xaxis = "momentum", yaxis = "energy", xlims = (-π, π), ylims = (-0.1, 5) + ) + scatter!(p_excitations, momenta_shifted, real(E_spinon); label = "spinon") + plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label = "spinon (analytic)") - scatter!(p_excitations, momenta_shifted, real(E_holon); label="holon") - plot!(p_excitations, P_holon_analytic, E_holon_analytic; label="holon (analytic)") + scatter!(p_excitations, momenta_shifted, real(E_holon); label = "holon") + plot!(p_excitations, P_holon_analytic, E_holon_analytic; label = "holon (analytic)") I = sortperm(momenta_shifted) - plot!(p_excitations, momenta_shifted[I], E_scattering_min[I]; label="scattering states", - fillrange=E_scattering_max[I], fillalpha=0.3, fillstyle=:x) + plot!( + p_excitations, momenta_shifted[I], E_scattering_min[I]; label = "scattering states", + fillrange = E_scattering_max[I], fillalpha = 0.3, fillstyle = :x + ) p_excitations end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` --- diff --git a/docs/src/examples/quantum1d/6.hubbard/main.ipynb b/docs/src/examples/quantum1d/6.hubbard/main.ipynb index e28d0fa35..932573445 100644 --- a/docs/src/examples/quantum1d/6.hubbard/main.ipynb +++ b/docs/src/examples/quantum1d/6.hubbard/main.ipynb @@ -77,38 +77,44 @@ "outputs": [], "cell_type": "code", "source": [ - "function hubbard_energy(u; rtol=1e-12)\n", + "function hubbard_energy(u; rtol = 1.0e-12)\n", " integrandum(ω) = besselj0(ω) * besselj1(ω) / (1 + exp(2u * ω)) / ω\n", - " int, err = quadgk(integrandum, 0, Inf; rtol=rtol)\n", + " int, err = quadgk(integrandum, 0, Inf; rtol = rtol)\n", " return -u - 4 * int\n", "end\n", "\n", - "function compute_groundstate(psi, H;\n", - " svalue=1e-3,\n", - " expansionfactor=(1 / 10),\n", - " expansioniter=20)\n", + "function compute_groundstate(\n", + " psi, H;\n", + " svalue = 1.0e-3,\n", + " expansionfactor = (1 / 10),\n", + " expansioniter = 20\n", + " )\n", " verbosity = 2\n", - " psi, = find_groundstate(psi, H; tol=svalue * 10, verbosity)\n", + " psi, = find_groundstate(psi, H; tol = svalue * 10, verbosity)\n", " for _ in 1:expansioniter\n", " D = maximum(x -> dim(left_virtualspace(psi, x)), 1:length(psi))\n", " D′ = max(5, round(Int, D * expansionfactor))\n", - " trscheme = truncbelow(svalue / 10) & truncdim(D′)\n", - " psi′, = changebonds(psi, H, OptimalExpand(; trscheme=trscheme))\n", - " all(left_virtualspace.(Ref(psi), 1:length(psi)) .==\n", - " left_virtualspace.(Ref(psi′), 1:length(psi))) && break\n", - " psi, = find_groundstate(psi′, H, VUMPS(; tol=svalue / 5, maxiter=10, verbosity))\n", + " trscheme = trunctol(; atol = svalue / 10) & truncrank(D′)\n", + " psi′, = changebonds(psi, H, OptimalExpand(; trscheme = trscheme))\n", + " all(\n", + " left_virtualspace.(Ref(psi), 1:length(psi)) .==\n", + " left_virtualspace.(Ref(psi′), 1:length(psi))\n", + " ) && break\n", + " psi, = find_groundstate(psi′, H, VUMPS(; tol = svalue / 5, maxiter = 10, verbosity))\n", " end\n", "\n", " # convergence steps\n", - " psi, = changebonds(psi, H, SvdCut(; trscheme=truncbelow(svalue)))\n", - " psi, = find_groundstate(psi, H,\n", - " VUMPS(; tol=svalue / 100, verbosity, maxiter=100) &\n", - " GradientGrassmann(; tol=svalue / 1000))\n", + " psi, = changebonds(psi, H, SvdCut(; trscheme = trunctol(; atol = svalue)))\n", + " psi, = find_groundstate(\n", + " psi, H,\n", + " VUMPS(; tol = svalue / 100, verbosity, maxiter = 100) &\n", + " GradientGrassmann(; tol = svalue / 1000)\n", + " )\n", "\n", " return psi\n", "end\n", "\n", - "H = hubbard_model(InfiniteChain(2); U, t, mu=U / 2)\n", + "H = hubbard_model(InfiniteChain(2); U, t, mu = U / 2)\n", "Vspaces = fill(Vect[fℤ₂](0 => 10, 1 => 10), 2)\n", "psi = InfiniteMPS(physicalspace(H), Vspaces)\n", "psi = compute_groundstate(psi, H)\n", @@ -142,14 +148,14 @@ "outputs": [], "cell_type": "code", "source": [ - "H_u1_su2 = hubbard_model(ComplexF64, U1Irrep, SU2Irrep, InfiniteChain(2); U, t, mu=U / 2);\n", + "H_u1_su2 = hubbard_model(ComplexF64, U1Irrep, SU2Irrep, InfiniteChain(2); U, t, mu = U / 2);\n", "charges = fill(FermionParity(1) ⊠ U1Irrep(1) ⊠ SU2Irrep(0), 2);\n", "H_u1_su2 = MPSKit.add_physical_charge(H_u1_su2, charges);\n", "\n", "pspaces = physicalspace.(Ref(H_u1_su2), 1:2)\n", "vspaces = [oneunit(eltype(pspaces)), first(pspaces)]\n", "psi = InfiniteMPS(pspaces, vspaces)\n", - "psi = compute_groundstate(psi, H_u1_su2; expansionfactor=1 / 3)\n", + "psi = compute_groundstate(psi, H_u1_su2; expansionfactor = 1 / 3)\n", "E = real(expectation_value(psi, H_u1_su2)) / 2\n", "@info \"\"\"\n", "Groundstate energy:\n", @@ -179,22 +185,24 @@ "outputs": [], "cell_type": "code", "source": [ - "alg = QuasiparticleAnsatz(; tol=1e-3)\n", - "momenta = range(-π, π; length=33)\n", + "alg = QuasiparticleAnsatz(; tol = 1.0e-3)\n", + "momenta = range(-π, π; length = 33)\n", "psi_AB = psi\n", "envs_AB = environments(psi_AB, H_u1_su2);\n", "psi_BA = circshift(psi, 1)\n", "envs_BA = environments(psi_BA, H_u1_su2);\n", "\n", "spinon_charge = FermionParity(0) ⊠ U1Irrep(0) ⊠ SU2Irrep(1 // 2)\n", - "E_spinon, ϕ_spinon = excitations(H_u1_su2, alg, momenta,\n", - " psi_AB, envs_AB, psi_BA, envs_BA;\n", - " sector=spinon_charge, num=1);\n", + "E_spinon, ϕ_spinon = excitations(\n", + " H_u1_su2, alg, momenta, psi_AB, envs_AB, psi_BA, envs_BA;\n", + " sector = spinon_charge, num = 1\n", + ");\n", "\n", "holon_charge = FermionParity(1) ⊠ U1Irrep(-1) ⊠ SU2Irrep(0)\n", - "E_holon, ϕ_holon = excitations(H_u1_su2, alg, momenta,\n", - " psi_AB, envs_AB, psi_BA, envs_BA;\n", - " sector=holon_charge, num=1);" + "E_holon, ϕ_holon = excitations(\n", + " H_u1_su2, alg, momenta, psi_AB, envs_AB, psi_BA, envs_BA;\n", + " sector = holon_charge, num = 1\n", + ");" ], "metadata": {}, "execution_count": null @@ -211,25 +219,25 @@ "outputs": [], "cell_type": "code", "source": [ - "function spinon_momentum(Λ, u; rtol=1e-12)\n", + "function spinon_momentum(Λ, u; rtol = 1.0e-12)\n", " integrandum(ω) = besselj0(ω) * sin(ω * Λ) / ω / cosh(ω * u)\n", - " return π / 2 - quadgk(integrandum, 0, Inf; rtol=rtol)[1]\n", + " return π / 2 - quadgk(integrandum, 0, Inf; rtol = rtol)[1]\n", "end\n", - "function spinon_energy(Λ, u; rtol=1e-12)\n", + "function spinon_energy(Λ, u; rtol = 1.0e-12)\n", " integrandum(ω) = besselj1(ω) * cos(ω * Λ) / ω / cosh(ω * u)\n", - " return 2 * quadgk(integrandum, 0, Inf; rtol=rtol)[1]\n", + " return 2 * quadgk(integrandum, 0, Inf; rtol = rtol)[1]\n", "end\n", "\n", - "function holon_momentum(k, u; rtol=1e-12)\n", + "function holon_momentum(k, u; rtol = 1.0e-12)\n", " integrandum(ω) = besselj0(ω) * sin(ω * sin(k)) / ω / (1 + exp(2u * abs(ω)))\n", - " return π / 2 - k - 2 * quadgk(integrandum, 0, Inf; rtol=rtol)[1]\n", + " return π / 2 - k - 2 * quadgk(integrandum, 0, Inf; rtol = rtol)[1]\n", "end\n", - "function holon_energy(k, u; rtol=1e-12)\n", + "function holon_energy(k, u; rtol = 1.0e-12)\n", " integrandum(ω) = besselj1(ω) * cos(ω * sin(k)) * exp(-ω * u) / ω / cosh(ω * u)\n", - " return 2 * cos(k) + 2u + 2 * quadgk(integrandum, 0, Inf; rtol=rtol)[1]\n", + " return 2 * cos(k) + 2u + 2 * quadgk(integrandum, 0, Inf; rtol = rtol)[1]\n", "end\n", "\n", - "Λs = range(-10, 10; length=51)\n", + "Λs = range(-10, 10; length = 51)\n", "P_spinon_analytic = rem2pi.(spinon_momentum.(Λs, U / 4), RoundNearest)\n", "E_spinon_analytic = spinon_energy.(Λs, U / 4)\n", "I_spinon = sortperm(P_spinon_analytic)\n", @@ -238,19 +246,19 @@ "P_spinon_analytic = [reverse(-P_spinon_analytic); P_spinon_analytic]\n", "E_spinon_analytic = [reverse(E_spinon_analytic); E_spinon_analytic];\n", "\n", - "ks = range(0, 2π; length=51)\n", + "ks = range(0, 2π; length = 51)\n", "P_holon_analytic = rem2pi.(holon_momentum.(ks, U / 4), RoundNearest)\n", "E_holon_analytic = holon_energy.(ks, U / 4)\n", "I_holon = sortperm(P_holon_analytic)\n", "P_holon_analytic = P_holon_analytic[I_holon]\n", "E_holon_analytic = E_holon_analytic[I_holon];\n", "\n", - "p = let p_excitations = plot(; xaxis=\"momentum\", yaxis=\"energy\")\n", - " scatter!(p_excitations, momenta, real(E_spinon); label=\"spinon\")\n", - " plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label=\"spinon (analytic)\")\n", + "p = let p_excitations = plot(; xaxis = \"momentum\", yaxis = \"energy\")\n", + " scatter!(p_excitations, momenta, real(E_spinon); label = \"spinon\")\n", + " plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label = \"spinon (analytic)\")\n", "\n", - " scatter!(p_excitations, momenta, real(E_holon); label=\"holon\")\n", - " plot!(p_excitations, P_holon_analytic, E_holon_analytic; label=\"holon (analytic)\")\n", + " scatter!(p_excitations, momenta, real(E_holon); label = \"holon\")\n", + " plot!(p_excitations, P_holon_analytic, E_holon_analytic; label = \"holon (analytic)\")\n", "\n", " p_excitations\n", "end" @@ -273,12 +281,12 @@ "cell_type": "code", "source": [ "momenta_shifted = rem2pi.(momenta .- π / 2, RoundNearest)\n", - "p = let p_excitations = plot(; xaxis=\"momentum\", yaxis=\"energy\", xlims=(-π, π))\n", - " scatter!(p_excitations, momenta_shifted, real(E_spinon); label=\"spinon\")\n", - " plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label=\"spinon (analytic)\")\n", + "p = let p_excitations = plot(; xaxis = \"momentum\", yaxis = \"energy\", xlims = (-π, π))\n", + " scatter!(p_excitations, momenta_shifted, real(E_spinon); label = \"spinon\")\n", + " plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label = \"spinon (analytic)\")\n", "\n", - " scatter!(p_excitations, momenta_shifted, real(E_holon); label=\"holon\")\n", - " plot!(p_excitations, P_holon_analytic, E_holon_analytic; label=\"holon (analytic)\")\n", + " scatter!(p_excitations, momenta_shifted, real(E_holon); label = \"holon\")\n", + " plot!(p_excitations, P_holon_analytic, E_holon_analytic; label = \"holon (analytic)\")\n", "\n", " p_excitations\n", "end" @@ -301,10 +309,14 @@ "outputs": [], "cell_type": "code", "source": [ - "holon_dispersion_itp = linear_interpolation(P_holon_analytic, E_holon_analytic;\n", - " extrapolation_bc=Line())\n", - "spinon_dispersion_itp = linear_interpolation(P_spinon_analytic, E_spinon_analytic;\n", - " extrapolation_bc=Line())\n", + "holon_dispersion_itp = linear_interpolation(\n", + " P_holon_analytic, E_holon_analytic;\n", + " extrapolation_bc = Line()\n", + ")\n", + "spinon_dispersion_itp = linear_interpolation(\n", + " P_spinon_analytic, E_spinon_analytic;\n", + " extrapolation_bc = Line()\n", + ")\n", "function scattering_energy(p1, p2, p3)\n", " p1, p2, p3 = rem2pi.((p1, p2, p3), RoundNearest)\n", " return holon_dispersion_itp(p1) + spinon_dispersion_itp(p2) + spinon_dispersion_itp(p3)\n", @@ -335,17 +347,20 @@ " return e\n", "end;\n", "\n", - "p = let p_excitations = plot(; xaxis=\"momentum\", yaxis=\"energy\", xlims=(-π, π),\n", - " ylims=(-0.1, 5))\n", - " scatter!(p_excitations, momenta_shifted, real(E_spinon); label=\"spinon\")\n", - " plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label=\"spinon (analytic)\")\n", + "p = let p_excitations = plot(;\n", + " xaxis = \"momentum\", yaxis = \"energy\", xlims = (-π, π), ylims = (-0.1, 5)\n", + " )\n", + " scatter!(p_excitations, momenta_shifted, real(E_spinon); label = \"spinon\")\n", + " plot!(p_excitations, P_spinon_analytic, E_spinon_analytic; label = \"spinon (analytic)\")\n", "\n", - " scatter!(p_excitations, momenta_shifted, real(E_holon); label=\"holon\")\n", - " plot!(p_excitations, P_holon_analytic, E_holon_analytic; label=\"holon (analytic)\")\n", + " scatter!(p_excitations, momenta_shifted, real(E_holon); label = \"holon\")\n", + " plot!(p_excitations, P_holon_analytic, E_holon_analytic; label = \"holon (analytic)\")\n", "\n", " I = sortperm(momenta_shifted)\n", - " plot!(p_excitations, momenta_shifted[I], E_scattering_min[I]; label=\"scattering states\",\n", - " fillrange=E_scattering_max[I], fillalpha=0.3, fillstyle=:x)\n", + " plot!(\n", + " p_excitations, momenta_shifted[I], E_scattering_min[I]; label = \"scattering states\",\n", + " fillrange = E_scattering_max[I], fillalpha = 0.3, fillstyle = :x\n", + " )\n", "\n", " p_excitations\n", "end" @@ -369,13 +384,13 @@ "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.10.4" + "version": "1.12.0" }, "kernelspec": { - "name": "julia-1.10", - "display_name": "Julia 1.10.4", + "name": "julia-1.12", + "display_name": "Julia 1.12.0", "language": "julia" } }, "nbformat": 4 -} +} \ No newline at end of file diff --git a/docs/src/examples/quantum1d/7.xy-finiteT/index.md b/docs/src/examples/quantum1d/7.xy-finiteT/index.md index 5cc714959..4b01212f7 100644 --- a/docs/src/examples/quantum1d/7.xy-finiteT/index.md +++ b/docs/src/examples/quantum1d/7.xy-finiteT/index.md @@ -39,14 +39,15 @@ J = 1 / 2 T = ComplexF64 symmetry = U1Irrep -function XY_hamiltonian(::Type{T}=ComplexF64, ::Type{S}=Trivial; J=1 / 2, - N) where {T<:Number,S<:Sector} +function XY_hamiltonian( + ::Type{T} = ComplexF64, ::Type{S} = Trivial; J = 1 / 2, N + ) where {T <: Number, S <: Sector} spin = 1 // 2 term = J * (S_xx(T, S; spin) + S_yy(T, S; spin)) lattice = isfinite(N) ? FiniteChain(N) : InfiniteChain(1) return @mpoham begin sum(nearest_neighbours(lattice)) do (i, j) - return term{i,j} + return term{i, j} end end end @@ -87,7 +88,7 @@ We can check our results by comparing them to the exact diagonalization of the H ````julia N_exact = 6 -H = open_boundary_conditions(XY_hamiltonian(T, symmetry; J, N=Inf), N_exact) +H = open_boundary_conditions(XY_hamiltonian(T, symmetry; J, N = Inf), N_exact) H_dense = convert(TensorMap, H); vals = eigvals(H_dense)[one(symmetry)] ./ N_exact groundstate_energy(J, N_exact) @@ -98,7 +99,7 @@ println("Exact (N=Inf):\t", groundstate_energy(J, Inf)) ```` ```` -Numerical: -0.14558163364312235 +Numerical: -0.1455816336431223 Exact (N=6): -0.14558163364312227 Exact (N=Inf): -0.15915494309189535 @@ -114,8 +115,8 @@ H = XY_hamiltonian(T, symmetry; J, N) D = 64 V_init = symmetry === Trivial ? ℂ^32 : U1Space(i => 10 for i in -1:(1 // 2):1) psi_init = FiniteMPS(N, physicalspace(H, 1), V_init) -trscheme = truncdim(D) -psi, envs, = find_groundstate(psi_init, H, DMRG2(; trscheme, maxiter=5)); +trscheme = truncrank(D) +psi, envs, = find_groundstate(psi_init, H, DMRG2(; trscheme, maxiter = 5)); E_0 = expectation_value(psi, H, envs) / N println("Numerical:\t", real(E_0)) @@ -124,10 +125,10 @@ println("Exact (N=Inf):\t", groundstate_energy(J, Inf)) ```` ```` -[ Info: DMRG2 1: obj = -5.004084861350e+00 err = 9.8293025834e-01 time = 1.27 min -[ Info: DMRG2 2: obj = -5.004096939909e+00 err = 1.1403678304e-06 time = 0.55 sec -[ Info: DMRG2 3: obj = -5.004096975044e+00 err = 2.3606914201e-09 time = 0.91 sec -[ Info: DMRG2 conv 4: obj = -5.004096975044e+00 err = 1.1624035068e-13 time = 1.31 min +[ Info: DMRG2 1: obj = -5.004084850990e+00 err = 9.7717634223e-01 time = 1.69 min +[ Info: DMRG2 2: obj = -5.004096939452e+00 err = 1.1654525568e-06 time = 0.49 sec +[ Info: DMRG2 3: obj = -5.004096975044e+00 err = 2.4907168550e-09 time = 0.61 sec +[ Info: DMRG2 conv 4: obj = -5.004096975044e+00 err = 1.1812772982e-13 time = 1.71 min Numerical: -0.15637803047010954 Exact (N=32): -0.15637803047254015 Exact (N=Inf): -0.15915494309189535 @@ -207,8 +208,7 @@ expansion_orders = 1:3 function logpartition_taylor(β, H; expansion_order) dτ = im * β - expH = make_time_mpo(H, dτ, - TaylorCluster(; N=expansion_order)) + expH = make_time_mpo(H, dτ, TaylorCluster(; N = expansion_order)) return log(real(tr(expH))) / length(H) end @@ -219,108 +219,27 @@ end F_taylor = -(1 ./ βs) .* Z_taylor p_taylor = let - labels = reshape(map(expansion_orders) do N - return "Taylor N=$N" - end, 1, :) - p1 = plot(βs, Z_analytic; label="analytic", - title="Partition function", - xlabel="β", ylabel="Z(β)") - plot!(p1, βs, Z_taylor; label=labels) - p2 = plot(βs, F_analytic; label="analytic", title="Free energy", - xlabel="β", ylabel="F(β)") - plot!(p2, βs, F_taylor; label=labels) + labels = reshape( + map(expansion_orders) do N + return "Taylor N=$N" + end, 1, : + ) + p1 = plot( + βs, Z_analytic; label = "analytic", title = "Partition function", + xlabel = "β", ylabel = "Z(β)" + ) + plot!(p1, βs, Z_taylor; label = labels) + p2 = plot( + βs, F_analytic; label = "analytic", title = "Free energy", + xlabel = "β", ylabel = "F(β)" + ) + plot!(p2, βs, F_taylor; label = labels) plot(p1, p2) end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` Some observations: @@ -356,104 +275,26 @@ Z_taylor = Z_taylor[:, 2:end] F_taylor = F_taylor[:, 2:end] p_taylor_diff = let - labels = reshape(map(expansion_orders) do N - return "Taylor N=$N" - end, 1, :) - p1 = plot(βs, abs.(Z_taylor .- Z_analytic); - label=labels, title="Partition function error", - xlabel="β", ylabel="ΔZ(β)", legend=:topleft) - p2 = plot(βs, abs.(F_taylor .- F_analytic); label=labels, - xlabel="β", ylabel="ΔF(β)", title="Free energy error", legend=:topleft) + labels = reshape( + map(expansion_orders) do N + return "Taylor N=$N" + end, 1, : + ) + p1 = plot( + βs, abs.(Z_taylor .- Z_analytic); + label = labels, title = "Partition function error", + xlabel = "β", ylabel = "ΔZ(β)", legend = :topleft + ) + p2 = plot( + βs, abs.(F_taylor .- F_analytic); label = labels, + xlabel = "β", ylabel = "ΔF(β)", title = "Free energy error", legend = :topleft + ) plot(p1, p2) end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` We can now clearly see that, somewhat unsurprisingly, the error increases the larger $\beta$ becomes. @@ -475,11 +316,11 @@ Otherwise, we could still use the same trick, but we would have to compute the e Add a figure to illustrate this trick. ````julia -double_logpartition(ρ₁, ρ₂=ρ₁) = log(real(dot(ρ₁, ρ₂))) / length(ρ₁) +double_logpartition(ρ₁, ρ₂ = ρ₁) = log(real(dot(ρ₁, ρ₂))) / length(ρ₁) function logpartition_taylor2(β, H; expansion_order) dτ = im * β / 2 - expH = make_time_mpo(H, dτ, TaylorCluster(; N=expansion_order)) + expH = make_time_mpo(H, dτ, TaylorCluster(; N = expansion_order)) return double_logpartition(expH) end @@ -490,106 +331,26 @@ end F_taylor2 = -(1 ./ βs) .* Z_taylor2 p_taylor2_diff = let - labels = reshape(map(expansion_orders[2:end]) do N - return "Taylor N=$N" - end, 1, :) - p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic); - label=labels, title="Partition function error", - xlabel="β", ylabel="ΔZ(β)", legend=:topleft) - p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels, - xlabel="β", ylabel="ΔF(β)", title="Free energy error", legend=:topleft) + labels = reshape( + map(expansion_orders[2:end]) do N + return "Taylor N=$N" + end, 1, : + ) + p1 = plot( + βs, abs.(Z_taylor2 .- Z_analytic); + label = labels, title = "Partition function error", + xlabel = "β", ylabel = "ΔZ(β)", legend = :topleft + ) + p2 = plot( + βs, abs.(F_taylor2 .- F_analytic); label = labels, + xlabel = "β", ylabel = "ΔF(β)", title = "Free energy error", legend = :topleft + ) plot(p1, p2) end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` ### MPO multiplication approach (linear) @@ -623,7 +384,7 @@ Z_mpo_mul = zeros(length(βs)) D_max = 64 # first iteration: start from high order Taylor expansion -ρ₀ = make_time_mpo(H, im * βs[2] / 2, TaylorCluster(; N=3)) +ρ₀ = make_time_mpo(H, im * βs[2] / 2, TaylorCluster(; N = 3)) Z_mpo_mul[1] = Z_taylor[1] Z_mpo_mul[2] = double_logpartition(ρ₀) @@ -632,103 +393,43 @@ Z_mpo_mul[2] = double_logpartition(ρ₀) for i in 3:length(βs) global ρ_mps @info "Computing β = $(βs[i])" - ρ_mps, = approximate(ρ_mps, (ρ₀, ρ_mps), - DMRG2(; trscheme=truncdim(D_max), maxiter=10)) + ρ_mps, = approximate( + ρ_mps, (ρ₀, ρ_mps), DMRG2(; trscheme = truncrank(D_max), maxiter = 10) + ) Z_mpo_mul[i] = double_logpartition(ρ_mps) end F_mpo_mul = -(1 ./ βs) .* Z_mpo_mul p_mpo_mul_diff = let - labels = reshape(map(expansion_orders) do N - return "Taylor N=$N" - end, 1, :) - p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic); - label=labels, title="Partition function error", - xlabel="β", ylabel="ΔZ(β)", legend=:bottomright, yscale=:log10) - plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); - label="MPO multiplication") - p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels, - xlabel="β", ylabel="ΔF(β)", title="Free energy error", legend=nothing, - yscale=:log10) - plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); - label="MPO multiplication") + labels = reshape( + map(expansion_orders) do N + return "Taylor N=$N" + end, 1, : + ) + p1 = plot( + βs, abs.(Z_taylor2 .- Z_analytic); + label = labels, title = "Partition function error", + xlabel = "β", ylabel = "ΔZ(β)", legend = :bottomright, yscale = :log10 + ) + plot!( + p1, βs, abs.(Z_mpo_mul .- Z_analytic); + label = "MPO multiplication" + ) + p2 = plot( + βs, abs.(F_taylor2 .- F_analytic); label = labels, + xlabel = "β", ylabel = "ΔF(β)", title = "Free energy error", legend = nothing, + yscale = :log10 + ) + plot!( + p2, βs, abs.(F_mpo_mul .- F_analytic); + label = "MPO multiplication" + ) plot(p1, p2) end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` This approach clearly improves the accuracy of the results, indicating that we can indeed compute partition functions at larger $\beta$ values. @@ -768,7 +469,7 @@ F_analytic_exp = free_energy.(βs_exp, J, N) Z_mpo_mul_exp = zeros(length(βs_exp)) # first iteration: start from high order Taylor expansion -ρ₀ = make_time_mpo(H, im * first(βs_exp) / 2, TaylorCluster(; N=3)) +ρ₀ = make_time_mpo(H, im * first(βs_exp) / 2, TaylorCluster(; N = 3)) Z_mpo_mul_exp[1] = double_logpartition(ρ₀) # subsequent iterations: square @@ -777,107 +478,40 @@ Z_mpo_mul_exp[1] = double_logpartition(ρ₀) for i in 2:length(βs_exp) global ρ_mps, ρ @info "Computing β = $(βs_exp[i])" - ρ_mps, = approximate(ρ_mps, (ρ, ρ_mps), - DMRG2(; trscheme=truncdim(D_max), maxiter=10)) + ρ_mps, = approximate( + ρ_mps, (ρ, ρ_mps), DMRG2(; trscheme = truncrank(D_max), maxiter = 10) + ) Z_mpo_mul_exp[i] = double_logpartition(ρ_mps) ρ = convert(FiniteMPO, ρ_mps) end F_mpo_mul_exp = -(1 ./ βs_exp) .* Z_mpo_mul_exp p_mpo_mul_exp_diff = let - labels = reshape(map(expansion_orders[2:end]) do N - return "Taylor N=$N" - end, 1, :) - p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic); - label=labels, title="Partition function error", xlabel="β", ylabel="ΔZ(β)", - legend=:bottomright, yscale=:log10) - plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label="MPO multiplication") - plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label="MPO multiplication exp") - - p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels, xlabel="β", ylabel="ΔF(β)", - title="Free energy error", legend=nothing, yscale=:log10) - plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label="MPO multiplication") - plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label="MPO multiplication exp") + labels = reshape( + map(expansion_orders[2:end]) do N + return "Taylor N=$N" + end, 1, : + ) + p1 = plot( + βs, abs.(Z_taylor2 .- Z_analytic); + label = labels, title = "Partition function error", xlabel = "β", ylabel = "ΔZ(β)", + legend = :bottomright, yscale = :log10 + ) + plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label = "MPO multiplication") + plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label = "MPO multiplication exp") + + p2 = plot( + βs, abs.(F_taylor2 .- F_analytic); label = labels, xlabel = "β", ylabel = "ΔF(β)", + title = "Free energy error", legend = nothing, yscale = :log10 + ) + plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label = "MPO multiplication") + plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label = "MPO multiplication exp") plot(p1, p2) end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` Clearly, the exponential approach allows us to reach larger $\beta$ values much quicker, but there is again a trade-off. @@ -913,112 +547,43 @@ Z_tdvp[1] = double_logpartition(ρ₀) for i in 2:length(βs) global ρ_mps @info "Computing β = $(βs[i])" - ρ_mps, = timestep(ρ_mps, H, βs[i - 1] / 2, -im * (βs[i] - βs[i - 1]) / 2, - TDVP2(; trscheme=truncdim(64))) + ρ_mps, = timestep( + ρ_mps, H, βs[i - 1] / 2, -im * (βs[i] - βs[i - 1]) / 2, + TDVP2(; trscheme = truncrank(64)) + ) Z_tdvp[i] = double_logpartition(ρ_mps) end F_tdvp = -(1 ./ βs) .* Z_tdvp p_mpo_mul_diff = let - labels = reshape(map(expansion_orders) do N - return "Taylor N=$N" - end, 1, :) - p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic); label=labels, - title="Partition function error", xlabel="β", ylabel="ΔZ(β)", - legend=:bottomright, yscale=:log10) - plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label="MPO multiplication") - plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label="MPO multiplication exp") - plot!(p1, βs, abs.(Z_tdvp .- Z_analytic); label="TDVP") - - p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels, xlabel="β", ylabel="ΔF(β)", - title="Free energy error", legend=nothing, yscale=:log10) - plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label="MPO multiplication") - plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label="MPO multiplication exp") - plot!(p2, βs, abs.(F_tdvp .- F_analytic); label="TDVP") + labels = reshape( + map(expansion_orders) do N + return "Taylor N=$N" + end, 1, : + ) + p1 = plot( + βs, abs.(Z_taylor2 .- Z_analytic); label = labels, + title = "Partition function error", xlabel = "β", ylabel = "ΔZ(β)", + legend = :bottomright, yscale = :log10 + ) + plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label = "MPO multiplication") + plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label = "MPO multiplication exp") + plot!(p1, βs, abs.(Z_tdvp .- Z_analytic); label = "TDVP") + + p2 = plot( + βs, abs.(F_taylor2 .- F_analytic); label = labels, xlabel = "β", ylabel = "ΔF(β)", + title = "Free energy error", legend = nothing, yscale = :log10 + ) + plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label = "MPO multiplication") + plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label = "MPO multiplication exp") + plot!(p2, βs, abs.(F_tdvp .- F_analytic); label = "TDVP") plot(p1, p2) end ```` ```@raw html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ``` !!! note diff --git a/docs/src/examples/quantum1d/7.xy-finiteT/main.ipynb b/docs/src/examples/quantum1d/7.xy-finiteT/main.ipynb index 7a14ede2e..8936d8bde 100644 --- a/docs/src/examples/quantum1d/7.xy-finiteT/main.ipynb +++ b/docs/src/examples/quantum1d/7.xy-finiteT/main.ipynb @@ -51,14 +51,15 @@ "T = ComplexF64\n", "symmetry = U1Irrep\n", "\n", - "function XY_hamiltonian(::Type{T}=ComplexF64, ::Type{S}=Trivial; J=1 / 2,\n", - " N) where {T<:Number,S<:Sector}\n", + "function XY_hamiltonian(\n", + " ::Type{T} = ComplexF64, ::Type{S} = Trivial; J = 1 / 2, N\n", + " ) where {T <: Number, S <: Sector}\n", " spin = 1 // 2\n", " term = J * (S_xx(T, S; spin) + S_yy(T, S; spin))\n", " lattice = isfinite(N) ? FiniteChain(N) : InfiniteChain(1)\n", " return @mpoham begin\n", " sum(nearest_neighbours(lattice)) do (i, j)\n", - " return term{i,j}\n", + " return term{i, j}\n", " end\n", " end\n", "end" @@ -112,7 +113,7 @@ "cell_type": "code", "source": [ "N_exact = 6\n", - "H = open_boundary_conditions(XY_hamiltonian(T, symmetry; J, N=Inf), N_exact)\n", + "H = open_boundary_conditions(XY_hamiltonian(T, symmetry; J, N = Inf), N_exact)\n", "H_dense = convert(TensorMap, H);\n", "vals = eigvals(H_dense)[one(symmetry)] ./ N_exact\n", "groundstate_energy(J, N_exact)\n", @@ -142,8 +143,8 @@ "D = 64\n", "V_init = symmetry === Trivial ? ℂ^32 : U1Space(i => 10 for i in -1:(1 // 2):1)\n", "psi_init = FiniteMPS(N, physicalspace(H, 1), V_init)\n", - "trscheme = truncdim(D)\n", - "psi, envs, = find_groundstate(psi_init, H, DMRG2(; trscheme, maxiter=5));\n", + "trscheme = truncrank(D)\n", + "psi, envs, = find_groundstate(psi_init, H, DMRG2(; trscheme, maxiter = 5));\n", "E_0 = expectation_value(psi, H, envs) / N\n", "\n", "println(\"Numerical:\\t\", real(E_0))\n", @@ -245,8 +246,7 @@ "\n", "function logpartition_taylor(β, H; expansion_order)\n", " dτ = im * β\n", - " expH = make_time_mpo(H, dτ,\n", - " TaylorCluster(; N=expansion_order))\n", + " expH = make_time_mpo(H, dτ, TaylorCluster(; N = expansion_order))\n", " return log(real(tr(expH))) / length(H)\n", "end\n", "\n", @@ -257,16 +257,21 @@ "F_taylor = -(1 ./ βs) .* Z_taylor\n", "\n", "p_taylor = let\n", - " labels = reshape(map(expansion_orders) do N\n", - " return \"Taylor N=$N\"\n", - " end, 1, :)\n", - " p1 = plot(βs, Z_analytic; label=\"analytic\",\n", - " title=\"Partition function\",\n", - " xlabel=\"β\", ylabel=\"Z(β)\")\n", - " plot!(p1, βs, Z_taylor; label=labels)\n", - " p2 = plot(βs, F_analytic; label=\"analytic\", title=\"Free energy\",\n", - " xlabel=\"β\", ylabel=\"F(β)\")\n", - " plot!(p2, βs, F_taylor; label=labels)\n", + " labels = reshape(\n", + " map(expansion_orders) do N\n", + " return \"Taylor N=$N\"\n", + " end, 1, :\n", + " )\n", + " p1 = plot(\n", + " βs, Z_analytic; label = \"analytic\", title = \"Partition function\",\n", + " xlabel = \"β\", ylabel = \"Z(β)\"\n", + " )\n", + " plot!(p1, βs, Z_taylor; label = labels)\n", + " p2 = plot(\n", + " βs, F_analytic; label = \"analytic\", title = \"Free energy\",\n", + " xlabel = \"β\", ylabel = \"F(β)\"\n", + " )\n", + " plot!(p2, βs, F_taylor; label = labels)\n", " plot(p1, p2)\n", "end" ], @@ -319,14 +324,20 @@ "F_taylor = F_taylor[:, 2:end]\n", "\n", "p_taylor_diff = let\n", - " labels = reshape(map(expansion_orders) do N\n", - " return \"Taylor N=$N\"\n", - " end, 1, :)\n", - " p1 = plot(βs, abs.(Z_taylor .- Z_analytic);\n", - " label=labels, title=\"Partition function error\",\n", - " xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:topleft)\n", - " p2 = plot(βs, abs.(F_taylor .- F_analytic); label=labels,\n", - " xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=:topleft)\n", + " labels = reshape(\n", + " map(expansion_orders) do N\n", + " return \"Taylor N=$N\"\n", + " end, 1, :\n", + " )\n", + " p1 = plot(\n", + " βs, abs.(Z_taylor .- Z_analytic);\n", + " label = labels, title = \"Partition function error\",\n", + " xlabel = \"β\", ylabel = \"ΔZ(β)\", legend = :topleft\n", + " )\n", + " p2 = plot(\n", + " βs, abs.(F_taylor .- F_analytic); label = labels,\n", + " xlabel = \"β\", ylabel = \"ΔF(β)\", title = \"Free energy error\", legend = :topleft\n", + " )\n", " plot(p1, p2)\n", "end" ], @@ -361,11 +372,11 @@ "outputs": [], "cell_type": "code", "source": [ - "double_logpartition(ρ₁, ρ₂=ρ₁) = log(real(dot(ρ₁, ρ₂))) / length(ρ₁)\n", + "double_logpartition(ρ₁, ρ₂ = ρ₁) = log(real(dot(ρ₁, ρ₂))) / length(ρ₁)\n", "\n", "function logpartition_taylor2(β, H; expansion_order)\n", " dτ = im * β / 2\n", - " expH = make_time_mpo(H, dτ, TaylorCluster(; N=expansion_order))\n", + " expH = make_time_mpo(H, dτ, TaylorCluster(; N = expansion_order))\n", " return double_logpartition(expH)\n", "end\n", "\n", @@ -376,14 +387,20 @@ "F_taylor2 = -(1 ./ βs) .* Z_taylor2\n", "\n", "p_taylor2_diff = let\n", - " labels = reshape(map(expansion_orders[2:end]) do N\n", - " return \"Taylor N=$N\"\n", - " end, 1, :)\n", - " p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic);\n", - " label=labels, title=\"Partition function error\",\n", - " xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:topleft)\n", - " p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels,\n", - " xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=:topleft)\n", + " labels = reshape(\n", + " map(expansion_orders[2:end]) do N\n", + " return \"Taylor N=$N\"\n", + " end, 1, :\n", + " )\n", + " p1 = plot(\n", + " βs, abs.(Z_taylor2 .- Z_analytic);\n", + " label = labels, title = \"Partition function error\",\n", + " xlabel = \"β\", ylabel = \"ΔZ(β)\", legend = :topleft\n", + " )\n", + " p2 = plot(\n", + " βs, abs.(F_taylor2 .- F_analytic); label = labels,\n", + " xlabel = \"β\", ylabel = \"ΔF(β)\", title = \"Free energy error\", legend = :topleft\n", + " )\n", " plot(p1, p2)\n", "end" ], @@ -430,7 +447,7 @@ "D_max = 64\n", "\n", "# first iteration: start from high order Taylor expansion\n", - "ρ₀ = make_time_mpo(H, im * βs[2] / 2, TaylorCluster(; N=3))\n", + "ρ₀ = make_time_mpo(H, im * βs[2] / 2, TaylorCluster(; N = 3))\n", "Z_mpo_mul[1] = Z_taylor[1]\n", "Z_mpo_mul[2] = double_logpartition(ρ₀)\n", "\n", @@ -439,26 +456,37 @@ "for i in 3:length(βs)\n", " global ρ_mps\n", " @info \"Computing β = $(βs[i])\"\n", - " ρ_mps, = approximate(ρ_mps, (ρ₀, ρ_mps),\n", - " DMRG2(; trscheme=truncdim(D_max), maxiter=10))\n", + " ρ_mps, = approximate(\n", + " ρ_mps, (ρ₀, ρ_mps), DMRG2(; trscheme = truncrank(D_max), maxiter = 10)\n", + " )\n", " Z_mpo_mul[i] = double_logpartition(ρ_mps)\n", "end\n", "F_mpo_mul = -(1 ./ βs) .* Z_mpo_mul\n", "\n", "p_mpo_mul_diff = let\n", - " labels = reshape(map(expansion_orders) do N\n", - " return \"Taylor N=$N\"\n", - " end, 1, :)\n", - " p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic);\n", - " label=labels, title=\"Partition function error\",\n", - " xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:bottomright, yscale=:log10)\n", - " plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic);\n", - " label=\"MPO multiplication\")\n", - " p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels,\n", - " xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=nothing,\n", - " yscale=:log10)\n", - " plot!(p2, βs, abs.(F_mpo_mul .- F_analytic);\n", - " label=\"MPO multiplication\")\n", + " labels = reshape(\n", + " map(expansion_orders) do N\n", + " return \"Taylor N=$N\"\n", + " end, 1, :\n", + " )\n", + " p1 = plot(\n", + " βs, abs.(Z_taylor2 .- Z_analytic);\n", + " label = labels, title = \"Partition function error\",\n", + " xlabel = \"β\", ylabel = \"ΔZ(β)\", legend = :bottomright, yscale = :log10\n", + " )\n", + " plot!(\n", + " p1, βs, abs.(Z_mpo_mul .- Z_analytic);\n", + " label = \"MPO multiplication\"\n", + " )\n", + " p2 = plot(\n", + " βs, abs.(F_taylor2 .- F_analytic); label = labels,\n", + " xlabel = \"β\", ylabel = \"ΔF(β)\", title = \"Free energy error\", legend = nothing,\n", + " yscale = :log10\n", + " )\n", + " plot!(\n", + " p2, βs, abs.(F_mpo_mul .- F_analytic);\n", + " label = \"MPO multiplication\"\n", + " )\n", " plot(p1, p2)\n", "end" ], @@ -515,7 +543,7 @@ "Z_mpo_mul_exp = zeros(length(βs_exp))\n", "\n", "# first iteration: start from high order Taylor expansion\n", - "ρ₀ = make_time_mpo(H, im * first(βs_exp) / 2, TaylorCluster(; N=3))\n", + "ρ₀ = make_time_mpo(H, im * first(βs_exp) / 2, TaylorCluster(; N = 3))\n", "Z_mpo_mul_exp[1] = double_logpartition(ρ₀)\n", "\n", "# subsequent iterations: square\n", @@ -524,27 +552,34 @@ "for i in 2:length(βs_exp)\n", " global ρ_mps, ρ\n", " @info \"Computing β = $(βs_exp[i])\"\n", - " ρ_mps, = approximate(ρ_mps, (ρ, ρ_mps),\n", - " DMRG2(; trscheme=truncdim(D_max), maxiter=10))\n", + " ρ_mps, = approximate(\n", + " ρ_mps, (ρ, ρ_mps), DMRG2(; trscheme = truncrank(D_max), maxiter = 10)\n", + " )\n", " Z_mpo_mul_exp[i] = double_logpartition(ρ_mps)\n", " ρ = convert(FiniteMPO, ρ_mps)\n", "end\n", "F_mpo_mul_exp = -(1 ./ βs_exp) .* Z_mpo_mul_exp\n", "\n", "p_mpo_mul_exp_diff = let\n", - " labels = reshape(map(expansion_orders[2:end]) do N\n", - " return \"Taylor N=$N\"\n", - " end, 1, :)\n", - " p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic);\n", - " label=labels, title=\"Partition function error\", xlabel=\"β\", ylabel=\"ΔZ(β)\",\n", - " legend=:bottomright, yscale=:log10)\n", - " plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label=\"MPO multiplication\")\n", - " plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label=\"MPO multiplication exp\")\n", - "\n", - " p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels, xlabel=\"β\", ylabel=\"ΔF(β)\",\n", - " title=\"Free energy error\", legend=nothing, yscale=:log10)\n", - " plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label=\"MPO multiplication\")\n", - " plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label=\"MPO multiplication exp\")\n", + " labels = reshape(\n", + " map(expansion_orders[2:end]) do N\n", + " return \"Taylor N=$N\"\n", + " end, 1, :\n", + " )\n", + " p1 = plot(\n", + " βs, abs.(Z_taylor2 .- Z_analytic);\n", + " label = labels, title = \"Partition function error\", xlabel = \"β\", ylabel = \"ΔZ(β)\",\n", + " legend = :bottomright, yscale = :log10\n", + " )\n", + " plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label = \"MPO multiplication\")\n", + " plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label = \"MPO multiplication exp\")\n", + "\n", + " p2 = plot(\n", + " βs, abs.(F_taylor2 .- F_analytic); label = labels, xlabel = \"β\", ylabel = \"ΔF(β)\",\n", + " title = \"Free energy error\", legend = nothing, yscale = :log10\n", + " )\n", + " plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label = \"MPO multiplication\")\n", + " plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label = \"MPO multiplication exp\")\n", " plot(p1, p2)\n", "end" ], @@ -598,28 +633,36 @@ "for i in 2:length(βs)\n", " global ρ_mps\n", " @info \"Computing β = $(βs[i])\"\n", - " ρ_mps, = timestep(ρ_mps, H, βs[i - 1] / 2, -im * (βs[i] - βs[i - 1]) / 2,\n", - " TDVP2(; trscheme=truncdim(64)))\n", + " ρ_mps, = timestep(\n", + " ρ_mps, H, βs[i - 1] / 2, -im * (βs[i] - βs[i - 1]) / 2,\n", + " TDVP2(; trscheme = truncrank(64))\n", + " )\n", " Z_tdvp[i] = double_logpartition(ρ_mps)\n", "end\n", "F_tdvp = -(1 ./ βs) .* Z_tdvp\n", "\n", "p_mpo_mul_diff = let\n", - " labels = reshape(map(expansion_orders) do N\n", - " return \"Taylor N=$N\"\n", - " end, 1, :)\n", - " p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic); label=labels,\n", - " title=\"Partition function error\", xlabel=\"β\", ylabel=\"ΔZ(β)\",\n", - " legend=:bottomright, yscale=:log10)\n", - " plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label=\"MPO multiplication\")\n", - " plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label=\"MPO multiplication exp\")\n", - " plot!(p1, βs, abs.(Z_tdvp .- Z_analytic); label=\"TDVP\")\n", - "\n", - " p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels, xlabel=\"β\", ylabel=\"ΔF(β)\",\n", - " title=\"Free energy error\", legend=nothing, yscale=:log10)\n", - " plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label=\"MPO multiplication\")\n", - " plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label=\"MPO multiplication exp\")\n", - " plot!(p2, βs, abs.(F_tdvp .- F_analytic); label=\"TDVP\")\n", + " labels = reshape(\n", + " map(expansion_orders) do N\n", + " return \"Taylor N=$N\"\n", + " end, 1, :\n", + " )\n", + " p1 = plot(\n", + " βs, abs.(Z_taylor2 .- Z_analytic); label = labels,\n", + " title = \"Partition function error\", xlabel = \"β\", ylabel = \"ΔZ(β)\",\n", + " legend = :bottomright, yscale = :log10\n", + " )\n", + " plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label = \"MPO multiplication\")\n", + " plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label = \"MPO multiplication exp\")\n", + " plot!(p1, βs, abs.(Z_tdvp .- Z_analytic); label = \"TDVP\")\n", + "\n", + " p2 = plot(\n", + " βs, abs.(F_taylor2 .- F_analytic); label = labels, xlabel = \"β\", ylabel = \"ΔF(β)\",\n", + " title = \"Free energy error\", legend = nothing, yscale = :log10\n", + " )\n", + " plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label = \"MPO multiplication\")\n", + " plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label = \"MPO multiplication exp\")\n", + " plot!(p2, βs, abs.(F_tdvp .- F_analytic); label = \"TDVP\")\n", "\n", " plot(p1, p2)\n", "end" @@ -653,13 +696,13 @@ "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.10.4" + "version": "1.12.0" }, "kernelspec": { - "name": "julia-1.10", - "display_name": "Julia 1.10.4", + "name": "julia-1.12", + "display_name": "Julia 1.12.0", "language": "julia" } }, "nbformat": 4 -} +} \ No newline at end of file diff --git a/examples/Cache.toml b/examples/Cache.toml index 4524ed74f..8820b4277 100644 --- a/examples/Cache.toml +++ b/examples/Cache.toml @@ -1,11 +1,11 @@ [classic2d] -"1.hard-hexagon" = "6a351c0f8ee413bb8e3ab4ee09de9493856bd1c308c060b6a7e052c5d38b7bc9" +"1.hard-hexagon" = "2c01966230ba56faa19a6751a734e53b8db744e7522b03b6a554662ccc76c550" [quantum1d] -"2.haldane" = "769a4ef9d7a878d011f2e5bbcc790f2db23c63fd673db9a4729a8501392c1fdf" -"6.hubbard" = "708c865dd9681d36d5d1b3dc43914d3df59d3f97ae7bcc6e3a24092890b8d44f" -"7.xy-finiteT" = "8ba5bd93407263202d3f07aa5e36d8387308a9107202ea06df9755ee128058c1" -"3.ising-dqpt" = "bfa10659a7c002fc7237948367474064f81071d773d493f30f222c0842fc416f" -"5.haldane-spt" = "e5b4665915d5a91e845f85c03b47a628c45ae3d326f1c0dbf01df7e7ff1bad6e" -"4.xxz-heisenberg" = "8d27d51408b6dbb5550afd7d2d80307e134f8a32a163923e12e74ad3ce8c5041" -"1.ising-cft" = "999e9643a38198e8586005978878c5f96158336d029df7e5ce8088976e8cc4f5" +"2.haldane" = "804433b690faa1ce268a430edb4185af77a38de7a9f53e097795688a53c30c5e" +"6.hubbard" = "af14e1df11b2392a69260ce061a716370a2ce50b5c907f0a7d2548e796d543fe" +"7.xy-finiteT" = "7afb26fb9ff8ef84722fee3442eaed2ddffda4a5f70a7844b61ce5178093706c" +"3.ising-dqpt" = "2d314fd05a75c5c91ff81391c7bf166171b35a7b32933e9490756dc584fe8437" +"5.haldane-spt" = "3de1b3baa1e4c5dc2252bbe8688d0c6ac8e5d5265deeb6ab66818bbfb02dd4aa" +"4.xxz-heisenberg" = "1a2093a182f3ce070b53488484d1024e45496b291c1b74e3f370201d4c056be2" +"1.ising-cft" = "fc99e02aed275ca8f588a780a9de09ab09e16901681fcb72103e1e7dc4be157c" diff --git a/examples/classic2d/1.hard-hexagon/main.jl b/examples/classic2d/1.hard-hexagon/main.jl index 5001c3f9d..600703c4a 100644 --- a/examples/classic2d/1.hard-hexagon/main.jl +++ b/examples/classic2d/1.hard-hexagon/main.jl @@ -70,7 +70,7 @@ function scaling_simulations( correlations[1] = correlation_length(ψ) for (i, d) in enumerate(diff(Ds)) - ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme = truncdim(d)), envs) + ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme = truncrank(d)), envs) ψ, envs, = leading_boundary(ψ, mpo, alg, envs) entropies[i + 1] = real(entropy(ψ)[1]) correlations[i + 1] = correlation_length(ψ) diff --git a/examples/quantum1d/3.ising-dqpt/main.jl b/examples/quantum1d/3.ising-dqpt/main.jl index e81d4b997..678be6c29 100644 --- a/examples/quantum1d/3.ising-dqpt/main.jl +++ b/examples/quantum1d/3.ising-dqpt/main.jl @@ -46,7 +46,7 @@ We will initially use a two-site TDVP scheme to dynamically increase the bond di H₁ = transverse_field_ising(FiniteChain(L); g = -2.0) ψₜ = deepcopy(ψ₀) dt = 0.01 -ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP2(; trscheme = truncdim(20))); +ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP2(; trscheme = truncrank(20))); md""" "envs" is a kind of cache object that keeps track of all environments in `ψ`. It is often advantageous to re-use the environment, so that mpskit doesn't need to recalculate everything. @@ -67,7 +67,7 @@ function finite_sim(L; dt = 0.05, finaltime = 5.0) times = collect(0:dt:finaltime) for t in times[2:end] - alg = t > 3 * dt ? TDVP() : TDVP2(; trscheme = truncdim(50)) + alg = t > 3 * dt ? TDVP() : TDVP2(; trscheme = truncrank(50)) ψₜ, envs = timestep(ψₜ, H₁, 0, dt, alg, envs) push!(echos, echo(ψₜ, ψ₀)) end @@ -110,7 +110,7 @@ Growing the bond dimension by ``5`` can be done by calling: ψₜ = deepcopy(ψ₀) H₁ = transverse_field_ising(; g = -2.0) -ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme = truncdim(5))); +ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme = truncrank(5))); # a single timestep is easy @@ -134,7 +134,7 @@ function infinite_sim(dt = 0.05, finaltime = 5.0) for t in times[2:end] if t < 50dt # if t is sufficiently small, we increase the bond dimension - ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme = truncdim(1)), envs) + ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme = truncrank(1)), envs) end ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP(), envs) push!(echos, echo(ψₜ, ψ₀)) diff --git a/examples/quantum1d/4.xxz-heisenberg/main.jl b/examples/quantum1d/4.xxz-heisenberg/main.jl index 548490fed..93fe3235c 100644 --- a/examples/quantum1d/4.xxz-heisenberg/main.jl +++ b/examples/quantum1d/4.xxz-heisenberg/main.jl @@ -77,7 +77,7 @@ The reason behind this becomes more obvious at higher bond dimensions: """ groundstate, envs, delta = find_groundstate( - state, H2, IDMRG2(; trscheme = truncdim(50), maxiter = 20, tol = 1.0e-12) + state, H2, IDMRG2(; trscheme = truncrank(50), maxiter = 20, tol = 1.0e-12) ); entanglementplot(groundstate) diff --git a/examples/quantum1d/7.xy-finiteT/main.jl b/examples/quantum1d/7.xy-finiteT/main.jl index cab8dcd7c..fd154438f 100644 --- a/examples/quantum1d/7.xy-finiteT/main.jl +++ b/examples/quantum1d/7.xy-finiteT/main.jl @@ -90,7 +90,7 @@ H = XY_hamiltonian(T, symmetry; J, N) D = 64 V_init = symmetry === Trivial ? ℂ^32 : U1Space(i => 10 for i in -1:(1 // 2):1) psi_init = FiniteMPS(N, physicalspace(H, 1), V_init) -trscheme = truncdim(D) +trscheme = truncrank(D) psi, envs, = find_groundstate(psi_init, H, DMRG2(; trscheme, maxiter = 5)); E_0 = expectation_value(psi, H, envs) / N @@ -348,7 +348,7 @@ for i in 3:length(βs) global ρ_mps @info "Computing β = $(βs[i])" ρ_mps, = approximate( - ρ_mps, (ρ₀, ρ_mps), DMRG2(; trscheme = truncdim(D_max), maxiter = 10) + ρ_mps, (ρ₀, ρ_mps), DMRG2(; trscheme = truncrank(D_max), maxiter = 10) ) Z_mpo_mul[i] = double_logpartition(ρ_mps) end @@ -431,7 +431,7 @@ for i in 2:length(βs_exp) global ρ_mps, ρ @info "Computing β = $(βs_exp[i])" ρ_mps, = approximate( - ρ_mps, (ρ, ρ_mps), DMRG2(; trscheme = truncdim(D_max), maxiter = 10) + ρ_mps, (ρ, ρ_mps), DMRG2(; trscheme = truncrank(D_max), maxiter = 10) ) Z_mpo_mul_exp[i] = double_logpartition(ρ_mps) ρ = convert(FiniteMPO, ρ_mps) @@ -499,7 +499,7 @@ for i in 2:length(βs) @info "Computing β = $(βs[i])" ρ_mps, = timestep( ρ_mps, H, βs[i - 1] / 2, -im * (βs[i] - βs[i - 1]) / 2, - TDVP2(; trscheme = truncdim(64)) + TDVP2(; trscheme = truncrank(64)) ) Z_tdvp[i] = double_logpartition(ρ_mps) end diff --git a/examples/windowmps.jl b/examples/windowmps.jl index 967b18979..e05f17569 100644 --- a/examples/windowmps.jl +++ b/examples/windowmps.jl @@ -26,7 +26,7 @@ let szdat = [expectation_value(mpco, sz)] for i in 1:(totaltime / deltat) - mpco, envs = timestep(mpco, th, deltat, TDVP2(; trscheme = truncdim(20)), envs) + mpco, envs = timestep(mpco, th, deltat, TDVP2(; trscheme = truncrank(20)), envs) push!(szdat, expectation_value(mpco, sz)) end From 58f8264cb2e2f9971dfdcf2023eed9907444ea49 Mon Sep 17 00:00:00 2001 From: lkdvos Date: Thu, 9 Oct 2025 17:30:08 -0400 Subject: [PATCH 15/16] more deprecations --- test/other.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/other.jl b/test/other.jl index 2cc1ff95f..af1ca0563 100644 --- a/test/other.jl +++ b/test/other.jl @@ -32,7 +32,7 @@ module TestMiscellaneous fill(SU2Space(1 => 1), N), fill(SU2Space(1 // 2 => 2, 3 // 2 => 1), N) ) - alg = IDMRG2(; verbosity = 0, tol = 1.0e-5, trscheme = truncdim(32)) + alg = IDMRG2(; verbosity = 0, tol = 1.0e-5, trscheme = truncrank(32)) ψ, envs, δ = find_groundstate(ψ₀, H, alg) # used to error @test ψ isa InfiniteMPS @@ -40,7 +40,7 @@ module TestMiscellaneous @testset "NaN entanglement entropy" begin ψ = InfiniteMPS([ℂ^2], [ℂ^5]) - ψ = changebonds(ψ, RandExpand(; trscheme = truncdim(2))) + ψ = changebonds(ψ, RandExpand(; trscheme = truncrank(2))) @test !isnan(sum(entropy(ψ))) @test !isnan(sum(entropy(ψ, 2))) end @@ -48,11 +48,11 @@ module TestMiscellaneous @testset "changebonds with unitcells" begin ψ = InfiniteMPS([ℂ^2, ℂ^2, ℂ^2], [ℂ^2, ℂ^3, ℂ^4]) H = repeat(transverse_field_ising(), 3) - ψ1, envs = changebonds(ψ, H, OptimalExpand(; trscheme = truncdim(2))) + ψ1, envs = changebonds(ψ, H, OptimalExpand(; trscheme = truncrank(2))) @test ψ1 isa InfiniteMPS @test norm(ψ1) ≈ 1 - ψ2 = changebonds(ψ, RandExpand(; trscheme = truncdim(2))) + ψ2 = changebonds(ψ, RandExpand(; trscheme = truncrank(2))) @test ψ2 isa InfiniteMPS @test norm(ψ2) ≈ 1 end From 862127f7df04df1e6e5ab8e7898e94e2eba943d7 Mon Sep 17 00:00:00 2001 From: lkdvos Date: Thu, 9 Oct 2025 20:15:54 -0400 Subject: [PATCH 16/16] Fix doc build --- docs/make.jl | 3 ++- src/states/ortho.jl | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index b74971ee2..de1a1ed1d 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -30,7 +30,8 @@ links = InterLinks( "TensorKit" => "https://quantumkithub.github.io/TensorKit.jl/stable/", "TensorOperations" => "https://quantumkithub.github.io/TensorOperations.jl/stable/", "KrylovKit" => "https://jutho.github.io/KrylovKit.jl/stable/", - "BlockTensorKit" => "https://lkdvos.github.io/BlockTensorKit.jl/dev/" + "BlockTensorKit" => "https://lkdvos.github.io/BlockTensorKit.jl/dev/", + "MatrixAlgebraKit" => "https://quantumkithub.github.io/MatrixAlgebraKit.jl/stable/" ) # include MPSKit in all doctests diff --git a/src/states/ortho.jl b/src/states/ortho.jl index 4adb9776d..a29942339 100644 --- a/src/states/ortho.jl +++ b/src/states/ortho.jl @@ -151,8 +151,7 @@ end Bring updated `AC` and `C` tensors back into a consistent set of left or right canonical tensors. This minimizes `∥AC_i - AL_i * C_i∥` or `∥AC_i - C_{i-1} * AR_i∥`. -The `alg` is passed on to [`left_orth!`](@extref MatrixAlgebraKit) and -[`right_orth!`](@extref MatrixAlgebraKit), and can be used to control the kind of +The `alg` is passed on to `left_orth!` and `right_orth!`, and can be used to control the kind of factorization used. By default, this is set to a (positive) QR/LQ, even though the optimal algorithm would use a polar decompositions instead, sacrificing a bit of performance for accuracy.