Suppose I get a MPS state psi when I finish a time evolution, I want to calculate its second renyi entropy. Refer to the tutorial code in Itensor, I write down the code like this

```
function calcuate_entropy(psi_e, c)
orthogonalize!(psi_e, c)
## which does not modify the original tensor data
U,S,V = svd(psi_e[c], (linkind(psi_e, c-1), siteind(psi_e,c)))
SvN = 0.0
for n=1:dim(S, 1)
p = S[n,n]^2
SvN -= log(p^2)
end
return SvN
end
```

where psi_e is the MPS state, c is partition position. I am not sure that my code can give the right answer. The second renyi entropy can be calculated by S = -\log(\text{Tr}[\rho^2]).

Thanks.