# How to implement a truly periodic MPS? (Julia)

+1 vote

I am interested in implementing an MPS that is truly periodic in ITensors.jl. By this, what I mean is that sites 1 and N have a common index, the same way that sites j and j+1 have a common index for j = 1, 2, ..., N-1. Here is what I am thinking:

(1) Make a sweepnext_periodic function so that, rather than turning around when it reaches the end of the chain, it just repeatedly works its way around the loop. For instance, if it were 3-site DMRG on an N-site chain, it would do sites 1:2:3, then sites 2:3:4, and so on, until sites (N-2):(N-1):N, then sites (N-1):N:1, then sites N:1:2, and that would complete the sweep. The next sweep will begin with 1:2:3 again.

(2) Make a productMPS_periodic function that includes an ITensors Index object for site N during initialization. Right now, Index objects are created to follow sites 1 through N-1, but this new site will connect sites N and 1.

(3) Create a replacebond_periodic! function so that it understands "wrapping around." For instance, if it is fed index N, it should understand that it is to look at sites N and 1, rather than throwing an error.

Is there anything else I am fundamentally missing, or is anything fundamentally wrong about what I am proposing above? Are there better ways to implement what I am thinking about implementing? For example, should I just make new objects rather than adding methods to the old ones? (I wouldn't want to do this unless the differences are just way too much to accommodate.) Making this work will likely take many hours of coding, so I want to make sure I have some sense of what I am doing before I begin.

This would also be a good time to double-check my understanding of the difficulties associated with My understanding is that this is not natively in the code primarily because it has poor performance on large chains. Is this correct? If not, what is (are) the primary obstacle(s) to the implementation of truly periodic matrix product states?

In case you may be wondering about my initial motivation for doing this, basically it is that I want to implement a lattice formulation of the Schwinger model. Up until now, I have tried to avoid this issue in a number of ways, but at this point, I think I am out of alternatives. In particular, the combination of DMRG and local gauge constraints makes it imperative that the last site and the first site are actually connected in the MPS and not just in the Hamiltonian. Otherwise, the last site gets "stuck" because, if you want to respect the gauge constraint, there is no way to alter that site without altering the first or second site.

Hi Sujay,
This is a worthy goal to think about, but let me discuss what I know about the status of periodic MPS and a possible alternative.

First, would your technical issue with quantum numbers be solved also if you were to consider an infinitely-long system? As you likely know, MPS methods work well in an infinite setup and there are some very advanced and efficient algorithms for optimizing infinite MPS.

Truly periodic MPS, on the other hand, run into a number of crucial technical problems that to my knowledge have never been satisfactorily solved. They include:
1. poor scaling or of periodic algorithms, which either involve a step that scales as bond dimension to the fourth power (so much worse that finite DMRG)
2. alternatively, better scaling methods but at the cost slow updates like gradient descent optimization
3. inability to efficiently compute a canonical form of periodic MPS, making steps like SVD'ing a two-site tensor or otherwise adapting the bond dimension either uncontrolled / inaccurate or inefficient

At the same time, for many systems either open boundary conditions are as good or an even better choice (believe it or not) though I do get that yours is a special case. But then there is the case of infinite MPS which of course is even better in some ways than periodic because it's completely free of finite-size effects.

Regarding the specific algorithm you sketched, I bet if you write it out in more detail you will see that it suffers from the first and third issues above, namely it will scale as the fourth power of bond dimension (thus hundreds of times slower than open DMRG) and the replacebond step will not occur in an orthogonal basis, making it an uncontrolled method.

Hope that helps -

Miles

commented by (850 points)
Hi Miles, so I think in general the answer to your first question is no. I am trying to compare my results to those achieved on finite lattices with fairly small numbers  of spatial sites (anywhere from 1 to 100). And in general, my overarching project pertains to speeding up certain computations specific to finite lattices. So my issue wouldn't be solved with an infinite system.

I'm glad that you mentioned these issues with periodic matrix product states to me. I will continue to try to find some sneaky workaround for my original problem, but I think at this point I may have no choice but to implement a periodic MPS and suffer these inconveniences. I'll see what happens.

Also, regarding your last remark, could you clarify why it's important that replacebond occur in an orthogonal basis and and what you mean by an "uncontrolled method"?
commented by (46.8k points)
Hi Sujay,
Ok that's helpful to know. One idea that just occurred to me, but I'm not sure is helpful, is that you could perhaps fix the last bond (the "periodic" bond) connecting site N back to site 1 to have a dimension of 1. I'm not sure if doing so allows the quantum numbers to work out the way you want. But if by chance it does, then all of the other issues about efficiency and "controlled"-ness of the algorithm would be taken care of. But probably that doesn't work with your QN situation.

So the question about replacebond, orthogonal environments, etc. is a very crucial one for MPS techniques but also rather technical and not always discussed in papers on MPS, especially the more theoretically oriented ones.

First of all, by a controlled method what I mean is a method which has a control parameter or parameters where if these parameters are increased (say, increasing bond dimension in MPS or increasing number of samples in Monte Carlo) then one can get arbitrarily close to the exact answer (up to machine precision). So then an uncontrolled method is where this isn't true. For example, mean-field calculations are uncontrolled because they just give some single answer which can't be progressively refined toward the exact one. Doing MPS calculations without using MPS orthogonality conditions *might* give a good answer but essentially there's no guarantee that increasing the bond dimension will take you steadily toward the exact result and it's highly dependent on details of the optimization algorithm, the system one is studying, and basically luck.

Now, to explain briefly what is meant by orthogonal environments for replacebond, if one can reach an orthogonal or canonical form of an MPS, where contracting each MPS tensor with its conjugate in a certain way "cancels" that pair of tensors to an identity matrix (i.e. the tensors are "partial isometries") then when doing the procedure of merging a pair of MPS tensors, modifying this pair tensor, and SVD'ing it apart to restore MPS form incurs a certain truncation error, it can be easily proven that the global error made on the whole MPS in the original space is the same as the local truncation error. Without an orthogonality condition, the true, global error could be arbitrarily larger than the local truncation error. In practice it can get quite bad if care isn't taken.

For periodic MPS, it's never been figured out how to bring such MPS into an orthogonal form, so one just doesn't get these guarantees about local truncation errors translating into global errors of the same size.

Hope that helps. For more information, the article by Schollwoeck on "DMRG in the Age of Matrix Product States" discusses canonical forms of MPS in a lot of detail.

Best,
Miles
commented by (850 points)
Thank you for such a thorough answer, Miles!

One other question: would it be possible to keep the MPS open but to do an optimization step where the states you vary are some from one end and one from the other (e.g. sites 1, N-1, N)? This could be part of DMRG, or it could be a separate optimization step that I do at the end of each sweep (I can just run the sweeps individually and run this separate optimization step after each sweep). This would probably work as another way of fixing my problem.

If this is not possible, why not? If this is possible, how might one use the exisitng code to do so? My guess based on my reading of dmrg.jl is that one would have to handle the eigsolve and replacebond! methods differently, perhaps by creating custom methods for this special case, although I noticed that eigsolve doesn't seem to be an ITensors function but rather a function imported from elsewhere. And if one chooses this round, what difficulties might they run into?
commented by (46.8k points)
Hi Sujay,
I think I see what you are asking. One answer to your question is that you could vary any of the MPS tensors you'd like to at any step, but there would be drawbacks to varying tensors which are not neighbors of each other. The main drawback is that it would destroy the property of the MPS having an orthogonal form. You could always bring it back into an orthogonal form by a series of QR's or SVD's, but if the tensors you vary at at each end of the system, you'd have to do N of these SVD's for a system of length N so your algorithm would have a large cost. Or you could work without having any orthogonality of the MPS tensors but you'd run into problems such as not having truncations of tensors be a controlled approximation as well as needing to use a generalized eigensolver if you do a DMRG optimization step etc. It can be done but people who have tried it have found that the drawback usually outweigh the benefits from what I've heard. You may have a special case where on a certain step you do need to vary the tensors at each end then just pay the price of reorthogonalizing the MPS, but you'll have to evaluate that within the particular demands of your project.

Hope that helps!

Miles