Skip to content
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

Extend CTMRGEnv constructor for nontrivial unit cells #52

Merged
merged 9 commits into from
Jul 12, 2024

Conversation

leburgel
Copy link
Collaborator

@leburgel leburgel commented Jul 9, 2024

The CTMRGEnv(peps::InfinitePEPS{P}; Venv=oneunit(spacetype(P))) where {P} constructor was not adapted to the new unit cell convention. Noticed this right before #49 got merged, but was too late to stop the automerge.

I added this as a separate PR since there anyway might be some more things related to unit cells we want to add. One thing that comes to mind is to extend this constructor to support non-uniform virtual environment spaces. Also, we should probably add a more extensive test that puts random duals as well as random dimensions on all virtual spaces (PEPS and environments) and checks that everything matches up everywhere.

Alternatively, I could quickly tag the fix onto #15 and then add the more general constructors and tests later, if that's better @lkdvos @pbrehmer ?

@pbrehmer
Copy link
Collaborator

pbrehmer commented Jul 9, 2024

Good that you noticed, thanks! I'd say that we could still tag it onto #15 since it is an important fix. I totally agree that we need more unit cell tests and constructors, but maybe we can add them later since that takes a bit of time. (Time that I probably don't have at the moment ;-))

Copy link

codecov bot commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 78.43137% with 11 lines in your changes missing coverage. Please review.

Files Coverage Δ
src/algorithms/peps_opt.jl 95.83% <ø> (ø)
src/states/abstractpeps.jl 70.00% <ø> (ø)
src/algorithms/ctmrg.jl 94.81% <0.00%> (ø)
src/states/infinitepeps.jl 65.75% <0.00%> (ø)
src/environments/ctmrgenv.jl 73.23% <81.63%> (+1.39%) ⬆️

... and 1 file with indirect coverage changes

@lkdvos
Copy link
Member

lkdvos commented Jul 9, 2024

I would actually argue the opposite. In principle, the tests run, and the released version is not affected by this problem. So only the master is currently in a slightly broken state, which is not that big of a problem as no-one should use that version anyways.

It's nice to have changes separated by commits, large PRs with multiple different changes are very hard to debug afterwards, and pinpointing where something went wrong is a bit of a nightmare when all we are left with is the big squashed commit...

So maybe, let's ignore the issue for PR #15 , and just merge this afterwards. It would then be nice to have this PR include:

  • a CTMRGEnv constructor with variable spaces
  • a 3x3 test that uses this and covers the error discovered here

I would suggest to re-use the same structure as the InfinitePEPS constructor:

CTMRG([f, T], peps::InfinitePEPS, chi_vertical::S, chi_horizontal::S=chi_vertical; unitcell::Tuple{Int,Int}=(1,1)) where S<:Union{Int,ElementarySpace}
CTMRG([f, T], D_horizontal::S, D_vertical::S, chi_vertical::S, chi_horizontal::S=chi_vertical; unitcell::Tuple{Int,Int}=(1,1)) where S<:Union{Int,ElementarySpace}
CTMRG([f, T], peps::InfinitePEPS, chis_vertical::A, chis_horizontal::A=chis_vertical) where {A<:AbstractMatrix{<:Union{Int,ElementarySpace}}}
CTMRG([f, T], Ds_horizontal::A, Ds_vertical::A, chis_vertical::A, chis_horizontal::A=chis_vertical) where {A<:AbstractMatrix{<:Union{Int,ElementarySpace}}}

In an ideal world, it would be cool if we could also allow the peps bond dimensions to be different for the bra and the ket, which enables things like VOMPS -- approximating a peps by a different one with a different bonddimension, or some time-evolution algorithms as well.

docs/src/index.md Outdated Show resolved Hide resolved
src/algorithms/peps_opt.jl Show resolved Hide resolved
@leburgel
Copy link
Collaborator Author

Okay, I think this ticks all the boxes now. Feels a bit clunky, but I don't immediately see how to make things more compact. So good to go from my end unless there are more comments.

@leburgel leburgel changed the title Fix unit cell indexing in CTMRGEnv constructor Extend CTMRGEnv constructor for nontrivial unit cells Jul 12, 2024
lkdvos
lkdvos previously approved these changes Jul 12, 2024
Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

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

I quickly glanced over this, looks good to me. Maybe @pbrehmer want's to have another look, but otherwise we can merge this.

src/environments/ctmrgenv.jl Outdated Show resolved Hide resolved
@pbrehmer
Copy link
Collaborator

Looks lovely, I think it can be merged as it is!

@lkdvos lkdvos merged commit f96746c into master Jul 12, 2024
6 of 8 checks passed
@lkdvos lkdvos deleted the lb/ctmrgenv_fix branch July 12, 2024 14:57
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.

3 participants