How to use MPS.from_Bflat

How do I use this algorithm? What does that parameter do?
Post Reply
ksrai
Posts: 2
Joined: 13 Mar 2024, 16:55

How to use MPS.from_Bflat

Post by ksrai »

This question concerns with the correct usage of the option [tenpy] MPS.from_Bflat[/tenpy]

I am trying to create the AKLT MPS form from given tensors for the AKLT state, check section "Matrix product state representation" of https://en.wikipedia.org/wiki/AKLT_model

The shape of tensor on each site is (3,2,2), where physical dimension is 3 and the bond dimension is 2. The following code shows the implementation:

Python: Select all

tensor = aklt_tensors()
nsites = len(model.lat.mps_sites())
Bs = [tensor.copy() for i in range(nsites)]
print(f"nsites = {nsites}")
final_mps = MPS.from_Bflat(model.lat.mps_sites(),Bs,bc=model.lat.bc_MPS)
Here the model is a CouplingMPOModel, and the

Python: Select all

aklt_tensors()
is the (3,2,2) shape tensor.

However, I get the error:

Python: Select all

shape of B incompatible with len of singular values
What could be the issue? Also, note that the AKLT state I want to prepare in this way is translation-invariant, so in the MPS description it has periodic boundary conditions.

Thanks in advance!
User avatar
Johannes
Site Admin
Posts: 456
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: How to use MPS.from_Bflat

Post by Johannes »

The finite mps in Tenpy always has open boundary conditions.
In other words, in finite systems, the vL on the first tensor should be trivial of dimension 1, and so should be the vR leg of the last tensor.
Closing the loop on the virtual legs with a trace is nasty for numerical simulations, since it means that we can't define a canonical form g but we need that for efficient optimization and expectation values.

Is perfektly okay to use those tensor of shape (3,2,2) with infinite bc_MPS.

If you really want to consider a finite Ring, you can still "bend over" that extra leg on the first and last tensor and manually group them,
I.e. Reshape the first tensor to (3, 1,4), the last to (3,4,1), and the bulk tensor to (3,4,4) by taking a kronecker product with the 2x2 identity on the last virtual legs.
As you see, that MPS has a larger bond dimension - that's another reason to avoid periodic boundary conditions, even if you can formally handle them with one long range coupling from the first to the last side.
ksrai
Posts: 2
Joined: 13 Mar 2024, 16:55

Re: How to use MPS.from_Bflat

Post by ksrai »

Thanks for the quick response!
I also tried the infinite bc_MPS and it works.
However, when I check the overlap of the AKLT MPS constructed using infinite bc_MPS

Python: Select all

infinite_aklt_mps
with the ground state

Python: Select all

gs_ed_mps
obtained using ED for the AKLT Hamiltonian (for a simple 4 site system), the fidelity is not equal to 1.
I am assuming that the ground state I obtain from the ED is the correct one for AKLT.
But I am also not sure why the infinite bc_MPS doesn't give fidelity 1. To calculate the fidelity I used:

Python: Select all

(np.abs(infinite_aklt_mps.overlap(gs_ed_mps,ignore_form=False)))**2
Could it be something to do with the canonical forms while using overlap of MPS?
User avatar
Johannes
Site Admin
Posts: 456
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: How to use MPS.from_Bflat

Post by Johannes »

I'm confused. ED should give you an MPS on a finite system, possibly with PBC (?). How did you map that to the infinite system for comparison?

If you want to compare 1:1, you need to compare finite MPS on PBC to ED on PBC, as I explained above.
Post Reply