-
Notifications
You must be signed in to change notification settings - Fork 53
Controlled Bond Expansion: randomized SVD approach #438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
63d0152
initial CBE implementation
lkdvos b37d24e
add `changebond!` implementation
lkdvos ff0e162
update CBE DMRG implementation
lkdvos a076e57
add CBEDMRG test
lkdvos 5ea3d2f
variety of updates
lkdvos a1c391f
clean up CBEDMRG
lkdvos 3c5af8e
more gauging utilities
lkdvos c0be28a
fix test environment
lkdvos d226f44
format
lkdvos c7e2c0f
docstring fix
lkdvos a4ed9fa
CBE-TDVP
lkdvos f1f7c46
project_complement
lkdvos 97e00b0
more updates and normalization
lkdvos 65c921b
more improvements
lkdvos 102c933
some more clean up
lkdvos cfefd51
remove unused field
lkdvos a946d56
remove warmstart and fix test errors
lkdvos bb841e6
more simplification
lkdvos 9e64a19
remove remnant code
lkdvos 5395a89
Guard CBE bond expansion in finite TDVP timestep!
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,9 @@ An algorithm that expands the given mps as described in | |
| [Zauner-Stauber et al. Phys. Rev. B 97 (2018)](@cite zauner-stauber2018), by selecting the | ||
| dominant contributions of a two-site updated MPS tensor, orthogonal to the original ψ. | ||
|
|
||
| The expansion does not alter the state: the added directions are connected through a zero block, | ||
| so that the expanded state is identical to the original one (as required for e.g. TDVP). | ||
|
lkdvos marked this conversation as resolved.
|
||
|
|
||
| !!! note | ||
| [`changebonds!`](@ref) is only defined for `FiniteMPS`, and modifies both the state and its environment. | ||
|
|
||
|
|
@@ -81,37 +84,71 @@ function changebonds(ψ::MultilineMPS, H, alg::OptimalExpand, envs = environment | |
| return newψ, envs | ||
| end | ||
|
|
||
| function changebonds(ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs = environments(ψ, H, ψ)) | ||
| return changebonds!(copy(ψ), H, alg, envs) | ||
| end | ||
|
|
||
| function changebonds!(ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs = environments(ψ, H, ψ)) | ||
| #inspired by the infinite mps algorithm, alternative is to use https://arxiv.org/pdf/1501.05504.pdf | ||
| # Finite system | ||
| # ------------- | ||
| function changebond!(site::Int, ::Val{:right}, ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs; normalize::Bool = true) | ||
| bond = site | ||
| left = ψ.AC[site] | ||
| right = ψ.AR[site + 1] | ||
| NL = left_null(left) | ||
| NR = right_null!(_transpose_tail(right; copy = true)) | ||
|
|
||
| # two-site update from the projected effective Hamiltonian | ||
| AC2 = AC2_projection(bond, ψ, H, ψ, envs) | ||
|
|
||
| # select the dominant directions in the complement of the current state | ||
| g2 = adjoint(NL) * AC2 * adjoint(NR) | ||
| _, _, Vᴴ = svd_trunc!(normalize!(g2); trunc = alg.trscheme, alg = alg.alg_svd) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just as a reminder, should we add a rename |
||
|
|
||
| # optimal vectors at site+1 | ||
| ar_re = Vᴴ * NR | ||
| # embed `left` into the enlarged domain (zero weight in the new directions), leaving the state | ||
| # unchanged | ||
| nal_space = codomain(left) ← (only(domain(left)) ⊕ space(Vᴴ, 1)) | ||
| nal, nc = left_gauge(absorb!(zerovector!(similar(left, nal_space)), left)) | ||
| nar = _transpose_front(catcodomain(_transpose_tail(right), ar_re)) | ||
|
|
||
| normalize && normalize!(nc) | ||
| ψ.AC[site] = (nal, nc) | ||
| ψ.AC[site + 1] = (nc, nar) | ||
| return ψ | ||
| end | ||
| function changebond!(site::Int, ::Val{:left}, ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs; normalize::Bool = true) | ||
|
lkdvos marked this conversation as resolved.
|
||
| bond = site - 1 | ||
| left = ψ.AL[site - 1] | ||
| right = ψ.AC[site] | ||
| NL = left_null(left) | ||
| NR = right_null!(_transpose_tail(right; copy = true)) | ||
|
|
||
| # two-site update from the projected effective Hamiltonian | ||
| AC2 = AC2_projection(bond, ψ, H, ψ, envs) | ||
|
|
||
| # select the dominant directions in the complement of the current state | ||
| g2 = adjoint(NL) * AC2 * adjoint(NR) | ||
| U, _, _ = svd_trunc!(normalize!(g2); trunc = alg.trscheme, alg = alg.alg_svd) | ||
|
|
||
| # optimal vectors at site-1 | ||
| Q = NL * U | ||
| right_tail = _transpose_tail(right) | ||
| # embed `_transpose_tail(right)` into the enlarged codomain (zero weight in the new | ||
| # directions), leaving the state unchanged | ||
| nc_space = (codomain(right_tail)[1] ⊕ space(Q, 3)') ← domain(right_tail) | ||
| nc, Qr = lq_compact!(absorb!(zerovector!(similar(right_tail, nc_space)), right_tail)) | ||
| AL_exp = catdomain(left, Q) | ||
|
|
||
| normalize && normalize!(nc) | ||
| ψ.AC[site] = (nc, _transpose_front(Qr)) | ||
| ψ.AC[site - 1] = (AL_exp, nc) | ||
| return ψ | ||
| end | ||
|
|
||
| #the idea is that we always want to expand the state in such a way that there are zeros at site i | ||
| #but "optimal vectors" at site i+1 | ||
| #so during optimization of site i, you have access to these optimal vectors :) | ||
| changebonds(ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs = environments(ψ, H, ψ)) = | ||
| changebonds!(copy(ψ), H, alg, envs) | ||
|
|
||
| function changebonds!(ψ::AbstractFiniteMPS, H, alg::OptimalExpand, envs = environments(ψ, H, ψ)) | ||
| for i in 1:(length(ψ) - 1) | ||
| AC2 = AC2_projection(i, ψ, H, ψ, envs) | ||
|
|
||
| #Calculate nullspaces for left and right | ||
| NL = left_null(ψ.AC[i]) | ||
| NR = right_null!(_transpose_tail(ψ.AR[i + 1]; copy = true)) | ||
|
|
||
| #Use this nullspaces and SVD decomposition to determine the optimal expansion space | ||
| intermediate = normalize!(adjoint(NL) * AC2 * adjoint(NR)) | ||
| _, _, 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 = qr_compact!(catdomain(ψ.AC[i], ar_le)) | ||
| nar = _transpose_front(catcodomain(_transpose_tail(ψ.AR[i + 1]), ar_re)) | ||
|
|
||
| ψ.AC[i] = (nal, nc) | ||
| ψ.AC[i + 1] = (nc, nar) | ||
| changebond!(i, Val(:right), ψ, H, alg, envs) | ||
| end | ||
|
|
||
| return (ψ, envs) | ||
| return ψ, envs | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.