First of all: the segment [0, 1, 2, 3, 4, 5] is only equivalent to
on a finite
In an infinite
takes region A to be [..., -4, -3, -2, -1, 0, 1, 2, 3, 4, 5], which is a single cut dividing the system into left and right halfs, whereas
psi.entanglement_entropy_segment([0, 1, 2, 3, 4, 5], )
takes the segment [0, 1, 2, 3, 4, 5], not including the sites left of 0, cutting out a "segment" of sites in the center of the chain. The segment basically makes *two* cuts, one to the left and one to the right of the "cylinder ring" of sites [0, 1, 2, 3, 4, 5] with x=0. Hence, it is also expected that it has a larger entanglement entropy.
Now to the question how large the entropy should be.
We know that the ground state of the toric code with periodic boundary conditions (PBC) is an equal super position of all closed "loops", if we identify say up-spins with "activated" bonds (contained in a loop) and down spins with deactivated bonds (not in any loop).
Correct me, if I'm wrong, but my guess is that the result of \((L_y-1)*log(2)\)
on a cylinder only holds for even Ly (for which I find that result), where you can ignore boundary effects.
However, even if we do infinite MPS, it's still open boundary conditions in x-direction; infinite DMRG just grows a finite system. If you try to draw the loops on the lattice with odd \(L_y=3,5,7\)
, you will find that there is always at least one open "loop" which you can't close, going from the left edge of the system to the right.
I'm not completely sure, but I think this loop contributes an additional \(log(2)\)
to the entanglement.
This would explain the additional \(log(2)\)
in your "entropy 3", and also in entropy 1 (which the standard argument would expect \(2(L_y-1) log(2) = 4 log(2)\)
To some extend, the extra loop lifts the restriction of an even number of loops going into to the region, which is the (-1) bit subtracted from the area law entanglement \(L_y log(2)\)
Coming to think about it: the DMRG will also drop the vertex/plaquette terms at the edge of a finite system where one of the operators "leaks" out of the system.
For a finite system, you could explicitly add the corresponding terms.
Alternatively, which should also work for infinite DMRG, I think you can avoid that if you switch off any charge (parity) conservation and adjust the starting left/right environments to be all ones (or more precisely, all ones except for the IdR/IdL index, if you want to avoid adding a global constant).
Also, I've noticed that the order how the MPS winds through the system was not optimal for the toric code.
After the commit 73193b192a3c12e67217a876510cd17d01b3695a
I've just made, my tests indicate that you only need a quarter of the bond dimension for the toric code ground state.