# Any Two-site wavefunction

edited

Hi Everyone,
I want to calculate bipartite entanglement on a spin chain, governed by some interaction Hamiltonian. For this, I need the bipartite density matrix of any two sites on the spin chain. I know neighbouring two-site Wave functions are determined using the following:

ITensor bondket = psi.A(j)*psi.A(j+1);

But I want something like: ITensor bondket = psi.A(j)*psi.A(j+n); where, n=1,2,3,....

Can anyone tell how to do it?

commented by (28.2k points)

commented by (160 points)
Hi Miles,
I want to calculate Logarithmic Negativity of the bipartite states. So, I actually need to know two things: how to take partial transposition of a density matrix in ITensor and how to calculate bipartite wavefunction of any two sites. In this code formula  http://itensor.org/docs.cgi?page=formulas/entanglement_mps the wavefunction is calculated only for the neighbouring sites b and b+1. i want the ket for any indices b & k.
commented by (28.2k points)
Hi Ipsita,
I see, so the negativity. But what is the definition of the "wavefunction of two sites"? Do you mean the reduced density matrix where one traces over all the other sites except for two? Or do you mean a different thing?
commented by (160 points)
Hi Miles,
Yes, it's the reduced density matrix of any two sites I'm asking. Sorry for the malapropism.
commented by (28.2k points)
Great - ok thanks for clarifying! I'll work on an answer for you -

+1 vote
selected by

Hi Ipsita,
I've posted a new code formula that should show you how to compute the two-site reduced density matrix you are asking about.

http://itensor.org/docs.cgi?page=formulas/mps_two_rdm

I read your sample code and come up with a simple question: Is it necessary to have the last for(int k = j+1; k <= psi.N(); ++k) because all the tensors at the right hand of j is right-normalized.