-
Notifications
You must be signed in to change notification settings - Fork 29
Environment initialization for CTMRG + ProductStateEnv
#264
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
Merged
Changes from 7 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
cb6b2a3
Add `initialize_environment`
leburgel 2b32182
Merge branch 'master' into lb/initialize_env
leburgel c1216f4
Add test
leburgel 2a6f121
Not converging isn't really passing though
leburgel 78cef7c
Pass virtual space specification through to `CTMRGEnv` constructor
leburgel c20aab3
Slurp, make an actual product state, and increase coverage
leburgel 11d8535
Better optional alg specification
leburgel 10ea2ef
Merge branch 'master' into lb/initialize_env
lkdvos 991ecc7
Apply suggestions from code review
leburgel 707728d
Merge branch 'master' into lb/initialize_env
leburgel 4996e1b
Add initialization function to `ProductStateInitialization` struct
leburgel c5855c0
Merge branch 'master' into lb/initialize_env
leburgel 7e4dd21
Merge remote-tracking branch 'upstream/master' into lb/initialize_env
Yue-Zhengyuan f4a9afb
Change `trscheme` to `trunc`
Yue-Zhengyuan 12f4b0f
Merge branch 'master' into lb/initialize_env
leburgel e12b527
Merge branch 'master' into lb/initialize_env
Yue-Zhengyuan 5a7605b
Stash update
leburgel 854aa77
Merge branch 'master' into lb/initialize_env
leburgel a767c94
Merge remote-tracking branch 'upstream/master' into lb/initialize_env
Yue-Zhengyuan 2502615
Update env init in finite-T SU tests
Yue-Zhengyuan 885faaf
Update test/ctmrg/initialization.jl
leburgel ad77085
Merge branch 'main' into lb/initialize_env
leburgel d56074a
Some fixes, and add environment initialization for PEPS using identit…
leburgel fa0d980
No longer use `@insert`
leburgel 203266a
Remove `bipartite_id`, add dedicated initialization from identity, ad…
leburgel ae9abe0
Merge branch 'main' into lb/initialize_env
leburgel 4c844f9
Reduce boilerplate a bit, add test for starting from specific product…
leburgel e05f662
Small cleanup for `BPEnv`
leburgel 9123bb3
Merge remote-tracking branch 'origin/main' into lb/initialize_env
leburgel af90a13
TensorMap data should be a matrix
leburgel 9dfd6b3
Forgot import
leburgel d0ec8d9
Actually use seed
leburgel 9a72484
Only seed at the start
leburgel f5f25ae
Merge remote-tracking branch 'origin/main' into lb/initialize_env
leburgel f51ed73
Update src/environments/product_state_environments.jl
leburgel b8a36dd
Define `TensorKit.storagetype` for `ProductStateEnv`
leburgel bed9c2f
Add actual `CTMRGEnv(::CTMRGEnv)` constructor
leburgel 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
|
lkdvos marked this conversation as resolved.
|
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,56 @@ | ||
| abstract type InitializationStyle end | ||
| struct ProductStateInitialization <: InitializationStyle end | ||
| struct RandomInitialization <: InitializationStyle end | ||
|
leburgel marked this conversation as resolved.
Outdated
|
||
| struct ApplicationInitialization <: InitializationStyle end | ||
|
|
||
| function initialize_environment( | ||
|
Yue-Zhengyuan marked this conversation as resolved.
Outdated
|
||
| elt::Type{<:Number}, | ||
| n::InfiniteSquareNetwork, | ||
| ::RandomInitialization, | ||
| virtual_spaces... = oneunit(spacetype(n)), | ||
|
leburgel marked this conversation as resolved.
|
||
| ) | ||
| return CTMRGEnv(randn, elt, n, virtual_spaces...) | ||
| end | ||
|
|
||
| function initialize_environment( | ||
| elt::Type{<:Number}, | ||
| n::InfiniteSquareNetwork, | ||
| ::ProductStateInitialization, | ||
|
Yue-Zhengyuan marked this conversation as resolved.
Outdated
|
||
| virtual_spaces... = oneunit(spacetype(n)), | ||
| ) | ||
| i = one(sectortype(n)) | ||
| env = CTMRGEnv(ones, elt, n, virtual_spaces...) | ||
| for (dir, r, c) in Iterators.product(axes(env)...) | ||
| @assert i in blocksectors(env.corners[dir, r, c]) | ||
| for (c, b) in blocks(env.corners[dir, r, c]) | ||
| b .= 0 | ||
| c == i && (b[1, 1] = 1) | ||
|
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. We definitely need a test with fermionic iPEPS on this, in case parity-odd elements become -1 due to twists. |
||
| end | ||
| end | ||
| return env | ||
| end | ||
|
|
||
| function initialize_environment( | ||
| elt::Type{<:Number}, | ||
| n::InfiniteSquareNetwork, | ||
| ::ApplicationInitialization, | ||
| trscheme::TruncationScheme; | ||
| boundary_alg = (; | ||
| alg = :sequential, tol = 1.0e-5, maxiter = 10, verbosity = -1, | ||
| ) | ||
|
leburgel marked this conversation as resolved.
Outdated
|
||
| ) | ||
| boundary_alg = (; boundary_alg..., trscheme) # merge trscheme with optional alg definition | ||
| env = initialize_environment(elt, n, ProductStateInitialization()) | ||
| env, = leading_boundary(env, n; boundary_alg...) | ||
| return env | ||
| end | ||
|
|
||
| function initialize_environment(n::InfiniteSquareNetwork, args...; kwargs...) | ||
| return initialize_environment(ComplexF64, n, args...; kwargs...) | ||
|
leburgel marked this conversation as resolved.
Outdated
|
||
| end | ||
| function initialize_environment(A::Union{InfinitePEPS, InfinitePartitionFunction}, args...; kwargs...) | ||
| return initialize_environment(ComplexF64, A, args...; kwargs...) | ||
|
leburgel marked this conversation as resolved.
Outdated
|
||
| end | ||
| function initialize_environment(elt::Type{<:Number}, A::Union{InfinitePEPS, InfinitePartitionFunction}, args...; kwargs...) | ||
| return initialize_environment(elt, InfiniteSquareNetwork(A), args...; kwargs...) | ||
| 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
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,51 @@ | ||
| using Test | ||
| using TensorKit | ||
| using PEPSKit | ||
| using Random | ||
|
|
||
| using MPSKitModels: classical_ising | ||
|
|
||
| sd = 12345 | ||
|
|
||
| # toggle symmetry, but same issue for both | ||
| symmetries = [Z2Irrep, Trivial] | ||
|
|
||
| χ = 20 | ||
| tol = 1.0e-4 | ||
| maxiter = 1000 | ||
| verbosity = 2 | ||
| trscheme = FixedSpaceTruncation() | ||
| boundary_alg = (; | ||
| alg = :simultaneous, | ||
| tol, | ||
| verbosity, | ||
| trscheme, | ||
| maxiter, | ||
| ) | ||
|
|
||
| @testset "CTMRG environment initialization for critical ising with $S symmetry (#255)" for S in symmetries | ||
| # initialize | ||
| T = classical_ising(S) | ||
| O = T[1] | ||
| n = InfinitePartitionFunction([O O; O O]) | ||
| Venv = S == Z2Irrep ? Z2Space(0 => χ / 2, 1 => χ / 2) : ℂ^χ | ||
| P = space(O, 2) | ||
|
|
||
| # random, doesn't converge | ||
| Random.seed!(sd) | ||
| env0_rand = initialize_environment(n, RandomInitialization(), Venv) | ||
| env_rand, info = leading_boundary(env0_rand, n; boundary_alg...) | ||
| @test_broken info.convergence_error ≤ tol | ||
|
|
||
| # embedded product state, converges | ||
| Random.seed!(sd) | ||
| env0_prod = initialize_environment(n, ProductStateInitialization(), Venv) | ||
| env_prod, info = leading_boundary(env0_prod, n; boundary_alg...) | ||
| @test info.convergence_error ≤ tol | ||
|
|
||
| # grown product state, converges | ||
| Random.seed!(sd) | ||
| env0_appl = initialize_environment(InfiniteSquareNetwork(n), ApplicationInitialization(), truncdim(χ)) | ||
| env_appl, info = leading_boundary(env0_appl, n; boundary_alg...) | ||
| @test info.convergence_error ≤ tol | ||
| 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.
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.