Skip to content

Conversation

@lkdvos
Copy link
Member

@lkdvos lkdvos commented Oct 21, 2025

  • The changebonds(state, ::RandExpand) algorithm now no longer needs to multiply and decompose a random twosite state, and instead generates the correct vectors directly.
  • The dynamic tolerances now properly handle iter = 0
  • The InfiniteMPOHamiltonian environments now properly clamp the Krylov dimension if the MPS bond dimension is low.

@lkdvos
Copy link
Member Author

lkdvos commented Oct 21, 2025

@AFeuerpfeil, tagging you here

@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 58.13953% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/states/abstractmps.jl 21.73% 18 Missing ⚠️
Files with missing lines Coverage Δ
src/algorithms/changebonds/randexpand.jl 100.00% <100.00%> (ø)
src/environments/abstract_envs.jl 92.10% <100.00%> (+0.21%) ⬆️
src/utility/dynamictols.jl 75.00% <100.00%> (+2.27%) ⬆️
src/states/abstractmps.jl 51.76% <21.73%> (-13.39%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AFeuerpfeil
Copy link
Contributor

Hi Lukas,

Thanks, the subspace expansion itself looks good now.

Calculating the environments currently errors:

nested task error: SpaceMismatch("ProductSpace(⊞(Rep[U₁ × Cyclic{36} × U₁]((0, 0, 0)=>1, (3, 6, 3)=>1))) ≠ ProductSpace(⊞(Rep[U₁ × Cyclic{36} × U₁]((0, 0, 0)=>1, (3, 0, 3)=>1)))")

I also identified the reason: When calling right_virtualspace in the initialize_environments, it constructs the right virtualspace of AL and not AR, which are different, as you are using different expansions for the two:

right_virtualspace(ket, i) = Rep[U₁ × Cyclic{36} × U₁]((0, 0, 0)=>1, (3, 0, 3)=>1)

TensorKit.space(ket.AL[i]) = (Rep[U₁ × Cyclic{36} × U₁]((1, 35, 1)=>1, (4, 29, 4)=>1)  Rep[U₁ × Cyclic{36} × U₁]((-1, 1, -1)=>1, (2, 1, 2)=>1))  Rep[U₁ × Cyclic{36} × U₁]((0, 0, 0)=>1, (3, 0, 3)=>1)

TensorKit.space(ket.AR[i]) = (Rep[U₁ × Cyclic{36} × U₁]((1, 35, 1)=>1, (-2, 35, -2)=>1)  Rep[U₁ × Cyclic{36} × U₁]((-1, 1, -1)=>1, (2, 1, 2)=>1))  Rep[U₁ × Cyclic{36} × U₁]((0, 0, 0)=>1, (3, 6, 3)=>1)

@lkdvos
Copy link
Member Author

lkdvos commented Oct 22, 2025

Thanks for checking and investigating! I pushed some more changes that should hopefully resolve the issue, it would be nice if you could check again!

@AFeuerpfeil
Copy link
Contributor

Sure, I will look into that today.

@AFeuerpfeil
Copy link
Contributor

I have 2 comments:

  1. In your rewrite, AR' is only a Vector{TensorMap}, in order to fix that I currently use return _expand!(ψ, AL′, PeriodicVector(AR′)).
  2. I still get a very similar error:
ERROR: TaskFailedException

    nested task error: SpaceMismatch("ProductSpace(⊞(Rep[U₁ × Cyclic{36} × U₁]((0, 0, 0)=>1))) ≠ ProductSpace(⊞(Rep[U₁ × Cyclic{36} × U₁]((0, 0, 0)=>1, (3, 0, 3)=>1)))")

@AFeuerpfeil
Copy link
Contributor

I observe some peculiarities with the truncscheme and when subsequently running VUMPS get this error

[ Info: VUMPS init:     obj = +2.216860652296e+03       err = 0.0000e+00
┌ Warning: Constructing an MPS from tensors that are not full rank
└ @ MPSKit ~/.julia/dev/MPSKit/src/states/infinitemps.jl:191
ERROR: SpaceMismatch("Incompatible spaces for permuting")
Stacktrace:
  [1] TensorKit.TreeTransformer(transform::Function, p::Tuple{…}, Vdst::TensorMapSpace{…}, Vsrc::TensorMapSpace{…})
    @ TensorKit ~/.julia/packages/TensorKit/JuisY/src/tensors/treetransformers.jl:161
  [2] _treetransposer
    @ ~/.julia/packages/TensorKit/JuisY/src/tensors/treetransformers.jl:199 [inlined]
  [3] #treetransposer##5
    @ ~/.julia/packages/TensorKit/JuisY/src/auxiliary/caches.jl:113 [inlined]
  [4] get!(default::TensorKit.var"#treetransposer##5#treetransposer##6"{}, lru::LRUCache.LRU{…}, key::Tuple{…})
    @ LRUCache ~/.julia/packages/LRUCache/ZH7qB/src/LRUCache.jl:169
  [5] treetransposer(Vdst::TensorMapSpace{…}, Vsrc::TensorMapSpace{…}, p::Tuple{…}, ::TensorKit.GlobalLRUCache)
    @ TensorKit ./none:-1
  [6] treetransposer
    @ ./none:-1 [inlined]
  [7] treetransposer
    @ ~/.julia/packages/TensorKit/JuisY/src/tensors/treetransformers.jl:193 [inlined]
  [8] add_transpose!
    @ ~/.julia/packages/TensorKit/JuisY/src/tensors/indexmanipulations.jl:450 [inlined]
  [9] transpose!
    @ ~/.julia/packages/TensorKit/JuisY/src/tensors/indexmanipulations.jl:181 [inlined]
 [10] repartition!(tdst::TensorMap{…}, tsrc::TensorMap{…})
    @ TensorKit ~/.julia/packages/TensorKit/JuisY/src/tensors/indexmanipulations.jl:238
 [11] gauge_orth_step!(it::MPSKit.IterativeSolver{…}, state::@NamedTuple{})
    @ MPSKit ~/.julia/dev/MPSKit/src/states/ortho.jl:312
 [12] iterate(it::MPSKit.IterativeSolver{…}, state::@NamedTuple{})
    @ MPSKit ~/.julia/dev/MPSKit/src/states/ortho.jl:287
 [13] iterate(it::MPSKit.IterativeSolver{MPSKit.RightCanonical, @NamedTuple{…}})
    @ MPSKit ~/.julia/dev/MPSKit/src/states/ortho.jl:286
 [14] (::MPSKit.var"#uniform_rightorth!##0#uniform_rightorth!##1"{})()
    @ MPSKit ~/.julia/dev/MPSKit/src/states/ortho.jl:271
 [15] #30
    @ ~/.julia/packages/LoggingExtras/VLO3o/src/verbosity.jl:103 [inlined]
 [16] with_logstate(f::LoggingExtras.var"#30#31"{}, logstate::Base.CoreLogging.LogState)
    @ Base.CoreLogging ./logging/logging.jl:540
 [17] with_logger
    @ ./logging/logging.jl:651 [inlined]
 [18] withlevel(f::MPSKit.var"#uniform_rightorth!##0#uniform_rightorth!##1"{}, level::Base.CoreLogging.LogLevel; verbosity::Int64)
    @ LoggingExtras ~/.julia/packages/LoggingExtras/VLO3o/src/verbosity.jl:99
 [19] withlevel (repeats 2 times)
    @ ~/.julia/packages/LoggingExtras/VLO3o/src/verbosity.jl:98 [inlined]
 [20] uniform_rightorth!(::Tuple{…}, A::PeriodicVector{…}, C₀::TensorMap{…}, alg::MPSKit.RightCanonical)
    @ MPSKit ~/.julia/dev/MPSKit/src/states/ortho.jl:262
 [21] gaugefix!
    @ ~/.julia/dev/MPSKit/src/states/ortho.jl:143 [inlined]
 [22] #gaugefix!#105
    @ ~/.julia/dev/MPSKit/src/states/ortho.jl:122 [inlined]
 [23] gaugefix!
    @ ~/.julia/dev/MPSKit/src/states/ortho.jl:111 [inlined]
 [24] InfiniteMPS(AL::PeriodicVector{…}, C₀::TensorMap{…}; kwargs::@Kwargs{})
    @ MPSKit ~/.julia/dev/MPSKit/src/states/infinitemps.jl:202
 [25] gauge_step!(it::MPSKit.IterativeSolver{…}, state::MPSKit.VUMPSState{…}, ACs::PeriodicVector{…})
    @ MPSKit ~/.julia/dev/MPSKit/src/algorithms/groundstate/vumps.jl:156
 [26] iterate
    @ ~/.julia/dev/MPSKit/src/algorithms/groundstate/vumps.jl:89 [inlined]
 [27] iterate
    @ ~/.julia/dev/MPSKit/src/algorithms/groundstate/vumps.jl:88 [inlined]
 [28] (::MPSKit.var"#459#460"{})()
    @ MPSKit ~/.julia/dev/MPSKit/src/algorithms/groundstate/vumps.jl:70
 [29] #30
    @ ~/.julia/packages/LoggingExtras/VLO3o/src/verbosity.jl:103 [inlined]
 [30] with_logstate(f::LoggingExtras.var"#30#31"{MPSKit.var"#459#460"{}}, logstate::Base.CoreLogging.LogState)
    @ Base.CoreLogging ./logging/logging.jl:540
 [31] with_logger
    @ ./logging/logging.jl:651 [inlined]
 [32] withlevel(f::MPSKit.var"#459#460"{}, level::Base.CoreLogging.LogLevel; verbosity::Int64)
    @ LoggingExtras ~/.julia/packages/LoggingExtras/VLO3o/src/verbosity.jl:99
 [33] withlevel (repeats 2 times)
    @ ~/.julia/packages/LoggingExtras/VLO3o/src/verbosity.jl:98 [inlined]
 [34] dominant_eigsolve(operator::InfiniteMPOHamiltonian{…}, mps::InfiniteMPS{…}, alg::VUMPS{…}, envs::MPSKit.InfiniteEnvironments{…}; which::Symbol)
    @ MPSKit ~/.julia/dev/MPSKit/src/algorithms/groundstate/vumps.jl:67
 [35] dominant_eigsolve
    @ ~/.julia/dev/MPSKit/src/algorithms/groundstate/vumps.jl:54 [inlined]
 [36] find_groundstate
    @ ~/.julia/dev/MPSKit/src/algorithms/groundstate/vumps.jl:51 [inlined]
 [37] find_groundstate(mps::InfiniteMPS{…}, operator::InfiniteMPOHamiltonian{…}, alg::VUMPS{…})
    @ MPSKit ~/.julia/dev/MPSKit/src/algorithms/groundstate/vumps.jl:51
 [38] top-level scope
    @ ~/.julia/dev/ITensorTensorKitInterface/scripts/benchmarks/ergodicity.jl:93
Some type information was truncated. Use `show(err)` to see complete types.

@AFeuerpfeil
Copy link
Contributor

Thanks. The error is gone, but at least in my examples the GMRES for the environment does not converge after expanding leading to weird errors and Lapack Exceptions, when the local update is ill-defined.
Let's discuss that tomorrow, if you have some time in the afternoon.

@lkdvos lkdvos changed the title Change RandExpand to go beyond the two-site subspace Various small fixes and improvements Oct 26, 2025
@lkdvos lkdvos changed the title Various small fixes and improvements Various small fixes and improvements to RandExpand Oct 26, 2025
@lkdvos
Copy link
Member Author

lkdvos commented Oct 26, 2025

@AFeuerpfeil as we discussed I abandoned this approach, after realizing that the proper way of doing this is to sequentially expand and sweep through the unit cell. I will open a new PR for that.

@AFeuerpfeil
Copy link
Contributor

Hi Lukas,
OK. Does that mean that our idea to add some noise to the expanded isometries did not work?

@lkdvos
Copy link
Member Author

lkdvos commented Oct 26, 2025

I'm currently trying that out, but I felt like at that point it no longer fits the changes I'm doing to changebonds so I didn't want to mix this in here. (Basically I want to still merge the small improvements I have here but start fresh on the other ideas)

@AFeuerpfeil
Copy link
Contributor

I agree.
Even if our approach works, for most applications like nearest-neighbour interactions, this 2-site expansion is still useful and does not change the state in contrast to our idea. Therefore, it is reasonable to keep it and for our idea to overload a new function like approx_changebonds or so...

@lkdvos lkdvos requested a review from VictorVanthilt October 28, 2025 13:25
Copy link
Member

@VictorVanthilt VictorVanthilt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G2G for me!

@lkdvos lkdvos merged commit b41cd92 into main Oct 28, 2025
26 of 27 checks passed
@lkdvos lkdvos deleted the ld-randexpand branch October 28, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants