How to compute the bipartite entanglement entropy with the first site as the subsystem us orthogonalize??

I’m new to tensor networks. I understand that for an MPS state in the form of orthogonalization, the bipartite entanglement entropy of a subsystem is center site’s singular spectrum. I’ve found useful code on ITensors.jl 's example:

orthogonalize!(psi, b)
U,S,V = svd(psi[b], (linkind(psi, b-1), siteind(psi,b)))
SvN = 0.0
for n=1:dim(S, 1)
  p = S[n,n]^2
  SvN -= p * log(p)
end

and have been using them without any issues still I needed to calculate the entropy for an open boundary condition MPS with the first site as the subsystem, there is no longer the ‘b-1’ index. How can I calculate the entropy for this system? Can I directly calculate singular spectrum for ‘psi[1]’? Additionally, is it possible to use the first lattice site as the center for orthogonalization?

1 Like

That’s the right code to be using. What it will do is compute the entanglement across the b’th bond, so between the sites (1,2,…,b) and (b+1,b+2, …, N).

But I see the issue you mean for the case of b=1, because the function linkind(psi,b-1) will fail in that case. So you will need to fix or generalize that part for that case. A fix could be:

if b==1
  U,S,V = svd(psi[b], (siteind(psi,b),))
else
  U,S,V = svd(psi[b], (linkind(psi, b-1), siteind(psi,b)))
end

and the rest of the code otherwise. Please give that a try and let us know if it doesn’t work for the b=1 case.

1 Like

Also there is a more specialized user support & discussion forum about ITensor here if you’d like to ask us questions there:
https://itensor.discourse.group

Thanks, it worked.

1 Like