-
Notifications
You must be signed in to change notification settings - Fork 46
Change sector convention for excitations
#271
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
19 commits
Select commit
Hold shift + click to select a range
c3b03bf
Quasiparticle type stability improvements
lkdvos 92bb50b
Add Multiline VectorInterface support
lkdvos ffbee56
Add multiline QP constructor
lkdvos d8fbf31
utility `eltype` in type domain
lkdvos 73ebd15
More utility functions
lkdvos 195082f
Replace `@constinferred` with `@inferred`
lkdvos f13c091
Refactor QP to improve type stability (again)
lkdvos 2bc73cc
various fixes
lkdvos 342d898
restore `effective_excitation_hamiltonian`
lkdvos 9ea9df5
attempt to fix type stability for lts
lkdvos 78cefb0
Fixes and add `max_virtualspace`
lkdvos 2bf0aa2
Change ED to have excited leg on the right
lkdvos 3e87170
change sector convention quasiparticle state
lkdvos ec17bf3
Change convention add_physical_charge
lkdvos d740ed1
Merge branch 'master' into sector
lkdvos 683487a
Update src/states/finitemps.jl
lkdvos 0659eeb
Add warning for quasiparticle fusion channels
lkdvos 6150daa
Add more tests
lkdvos 7692b0b
Merge branch 'sector' of https://github.com/QuantumKitHub/MPSKit.jl i…
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
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 |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| using MPSKit, TensorKit | ||
| import LinearAlgebra.eigvals | ||
| using MPSKit: max_virtualspaces | ||
|
|
||
| V = U1Space(i => 1 for i in 0:1) | ||
| O = randn(V^2 ← V^2) | ||
| O += O' # Hermitian | ||
|
|
||
| N = 3 | ||
| H = FiniteMPOHamiltonian(fill(V, N), (i, i + 1) => O for i in 1:(N - 1)); | ||
|
|
||
| h = convert(TensorMap, H); | ||
|
|
||
| sectors = collect(blocksectors(h)) | ||
| sec = U1Irrep(1) | ||
| @assert sec in sectors | ||
| num = 10 | ||
| vals1 = eigvals(block(h, sec)) | ||
| vals2 = eigvals(h)[sec] | ||
| @assert vals1 ≈ vals2 | ||
| vals3, vecs = exact_diagonalization(H; sector=(sec), num); | ||
| vals1 | ||
| vals3 | ||
|
|
||
| right = U1Space(sec => 1) | ||
| max_virtualspaces(physicalspace(H); right) | ||
|
|
||
| psi_full = rand(oneunit(V) * V^N ← right); | ||
| dim(space(psi_full)) | ||
| psi = MPSKit.decompose_localmps(psi_full); | ||
| left_virtualspace.(psi) | ||
|
|
||
| left_virtualspace.(vecs[1].AL) | ||
| right_virtualspace.(vecs[1].AL) | ||
| max_virtualspaces(physicalspace(H); right) | ||
| psi1 = FiniteMPS(physicalspace(H), max_virtualspaces(physicalspace(H))[2:(end - 1)]) | ||
| psi1, = find_groundstate(psi1, H); | ||
| psi2 = FiniteMPS(physicalspace(H), max_virtualspaces(physicalspace(H); right)[2:(end - 1)]; | ||
| right) | ||
| left_virtualspace.(psi2.AL) | ||
| right_virtualspace.(psi2.AL) | ||
|
|
||
| psi2, = find_groundstate(psi2, H); | ||
| expectation_value(psi2, H) | ||
|
|
||
| Es, Bs = excitations(H, QuasiparticleAnsatz(), FiniteMPS(psi); sector=sec); | ||
| @inferred excitations(H, QuasiparticleAnsatz(), FiniteMPS(psi); sector=sec); | ||
|
|
||
| Es .+ expectation_value(psi1, H) | ||
|
|
||
| vals1 | ||
| vals3 | ||
|
|
||
| psi2 | ||
| using TestEnv | ||
| using Test | ||
| TestEnv.activate() | ||
| include("setup.jl") | ||
| using .TestSetup | ||
| using TensorKit, MPSKit | ||
| using MPSKit: Multiline | ||
| using KrylovKit | ||
|
|
||
| H = repeat(TestSetup.sixvertex(), 2) | ||
| ψ = InfiniteMPS([ℂ^2, ℂ^2], [ℂ^10, ℂ^10]) | ||
| ψ, envs, _ = leading_boundary(ψ, H, | ||
| VUMPS(; maxiter=400, tol=1e-10)) | ||
| energies, ϕs = @inferred excitations(H, QuasiparticleAnsatz(), | ||
| [0.0, Float64(pi / 2)], ψ, | ||
| envs; verbosity=0) | ||
| @test abs(energies[1]) > abs(energies[2]) # has a minimum at pi/2 | ||
| alg = QuasiparticleAnsatz() | ||
| ps = [0.0, Float64(pi / 2)] | ||
| excitations(H, alg, ps, ψ, envs; verbosity=0); | ||
| using Cthulhu | ||
| Hm = convert(MultilineMPO, H); | ||
| psim = convert(MultilineMPS, ψ); | ||
| envs = environments(psim, Hm); | ||
| excitations(Hm, alg, ps[1], psim, envs, psim, envs; verbosity=0); | ||
|
|
||
| @descend excitations(Hm, alg, ps[1], psim, envs, psim, envs); | ||
|
|
||
| qp = Multiline([LeftGaugedQP(rand, psim[1], psim[1]; sector=one(sectortype(psim[1])), | ||
| momentum=ps[1])]); | ||
| excitations(Hm, alg, qp, envs, envs; num=1); | ||
|
|
||
| @descend excitations(Hm, alg, qp, envs, envs; num=1); | ||
| @code_warntype excitations(Hm, alg, qp, envs, envs; num=1); | ||
|
|
||
| Heff = MPSKit.EffectiveExcitationHamiltonian(H, envs[1], envs[1], fill(1.0, length(H))); | ||
| Heffs = Multiline([Heff]); | ||
| @code_warntype KrylovKit.apply(Heff, qp[1]) | ||
| @descend KrylovKit.apply(Heff, qp[1]) | ||
|
|
||
| KrylovKit.apply(Multiline([Heff]), qp); | ||
| @code_warntype KrylovKit.apply(Heffs, qp); | ||
|
|
||
| @descend eigsolve(Heffs, qp, 1, :LM, Lanczos()); | ||
| @code_warntype eigsolve(Heffs, qp, 1, :LM); | ||
| @descend eigsolve(Heffs, qp, 1, :LM); |
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.