Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Co-authored-by: Lukas Devos <ldevos98@gmail.com>
|
I just noticed one more way to initialize the environment (I already have some code on this in my neighborhood tensor update branch), which we may call
For example, an edge tensor is constructed like this: In this way, the initialized environment directly have boundary dimension Recently I realized that having a good initialization is also important during full update. Right now, I'm using the environment from the last iteration as initialization for the next step. But sometimes even this doesn't work well. So I kind of hope that we can finish this PR soon. |
|
Would this give a different result from starting from environments that are the identity and doing a single step of ctmrg without truncating? |
|
Nice insight, they may indeed be the same thing... for fermions we may need to further ensure that the twists are correctly added. |
| @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) |
There was a problem hiding this comment.
We definitely need a test with fermionic iPEPS on this, in case parity-odd elements become -1 due to twists.
|
Given the fact that this PR might be useful for #321, I'll try to pick this up again now. However, considering the original purpose, the review comments, and the new use case in #321, it's not entirely clear to me where to go with this. Let me try to summarize. The original motivation for this PR was to solve #255, by making it 'easy' to initialize a CTMRG environment with a given bond dimension/virtual space by growing it from a smaller environment (with a product state being the default starting point. Basically, package up what people do all the time in a single method. The easiest way to do this would be to write a specialized However, since initializing environments is something very common, I tried to make it a bit more generic so that the same signature and initialization flavors could be reused in other places. This came out a bit awkward right away, as can be seen from the review comments. A first obvious problem is that the specification of virtual environment spaces really depends on what exactly we're doing, which gives rise to some awkward argument orderings. In addition, to actually 'grow' an environment we need to apply a few iterations of an algorithm (see Now in #321 there's an additional aspect, where we actually want to initialize a different kind of environment depending on the contraction algorithm we use. For now the C4v implementation uses the normal Trying to consider all of this feels a bit annoying, which is also why this PR got completely stalled in the first place. To get this moving, I think the first thing to decide is whether we want to solve the whole (potentially still growing) problem here, or we first just address the original issue #255. To address the original problem, I would switch to just writing an To go for a full generic initialize_environment([T,] network, contraction_algorithm, initialization_style, virtual_space_specification)for the generic case withing PEPSKit.jl alone. The question then becomes if this is compatible with other kinds of environment initializations (e.g. in MPSKit.jl), and if we still want it to be. Asking for any and all opinions from @lkdvos, @pbrehmer and @Yue-Zhengyuan, after which I'll have a go at getting this to a point where it's usable. |
| return ProductStateEnv(f, T, Ds_north, Ds_east) | ||
| end | ||
| function ProductStateEnv(network::InfiniteSquareNetwork) | ||
| return ProductStateEnv(ones, scalartype(network), network) # TODO: do we want to use a different default function? |
There was a problem hiding this comment.
I suggest we default to creating a "trivial" environment: with the trivial 1D chargeless environment spaces removed, the edge tensors should be an identity map. Currently it can be done with CTMRGEnv(SUWeight(peps)) for InfinitePEPS. But here your use of one fills all tensor elements, not only the diagonal elements.
We may consider adding a keyword argument to control whether we want to fill only the diagonal elements or all elements for the edge tensors.
There was a problem hiding this comment.
The problem is that this way of initializing only really makes sense for InfiniteSquareNetwork{<:PEPSSandwich}, while here I was trying to come up with something that works in general, in particular also for partition functions. To initialize a product state environment consisting of identities between two factors of the PEPS virtual space, we could call ProductStateEnv with a custom initializing function. Something like ProductStateEnv(bipartite_id, T, n), where bipartite_id is a custom function for initializing an identity between the two factors of a two-component ProductSpace.
So I fully agree with your suggestion, but it's not that straightforward to make this a default for all InfiniteSquareNetworks.
| elt::Type{<:Number}, | ||
| n::InfiniteSquareNetwork, | ||
| alg::RandomInitialization, | ||
| virtual_spaces... = oneunit(spacetype(n)), |
There was a problem hiding this comment.
How about calling it environment_spaces (or env_spaces for short) to avoid confusion with the virtual spaces in n? (Unless you want to be consistent with src/environments/ctmrg_environments.jl)
There was a problem hiding this comment.
I was indeed trying to be consistent with src/environments/ctmrg_environments.jl, but I'm definitely open to renaming both instances it this would be less confusing.
|
I applied |
Co-authored-by: Yue Zhengyuan <yuezy1997@icloud.com>
|
Kind of starting over on this one, hopefully I can work toward something useful that can be merged soon. I'm giving up on trying to fit everything into a single Currently I have three initialization styles in mind that are useful:
These should solve both #136 and #255 already, without considering how to use this in optimization for now. In particular, none of these take a contraction algorithm as an input, which means we can avoid the nightmare of plumbing in all possible configurations. Any additional steps needed for initialization should then just be handled by the user. These last two initialization styles make use of a product state environment as an intermediate step, where especially for the To push this over the line, I'm planning to
|
Attempt at some better environment initialization routines for CTMRG. Should solve #255 once it's finished and documented.
This implements an
initialize_environmentmethod which initializes aCTMRGEnvfor a given network according to a specificInitializationStyle. I specified three kinds ofInitializationStyles:RandomInitializationfor initializing a random environment,ProductStateInitializationfor initializing a (potentially embedded) product state environment, andApplicationInitializationwhich grows an initial environment from a product state according to a given truncation scheme. Names, arguments and which ones are optional for discussion, but at least this already handles the test case from #255 in a fairly straightforward way.