# How to calculate two-operator correlation functions with conserved quantum numbers

Hi! I am doing some simulations with conserved quantum numbers. I am interested in computing the two-operator correlation functions. I was basing on this tutorial:

http://itensor.org/docs.cgi?vers=cppv3&page=tutorials/correlations

My code for the Sxi Sxj correlation looks as follows

auto first = [...] // This is just index of the first site
auto second = [...] // This is just index of the other site

//
// Calculate the ⟨Sx_i Sx_j⟩ (nearest-neighbor spin-spin interaction).
//

// Re-gauge psi to get ready to measure at 'first' position.
psi.position(first);
// Get the site index without QNs
auto sj_first = removeQNs(sites(first));
auto sj_second = removeQNs(sites(second));
// Create a SpinOneSite from the Index
// without QNs to use in the op function
auto op_first_x = op(SpinOneSite(sj_first),"Sx");
auto op_second_x = op(SpinOneSite(sj_second),"Sx");

// Create the bra/dual version of the MPS psi.
auto psidag = dag(psi);

// Prime the link indices to make them distinct from the original ket links.

// Index linking 'first'-1 to 'first':

auto C = prime(psi(first),li_1)*op_first_x;
C *= prime(psidag(first),"Site");
for (int k = first+1; k < second; ++k) {
C *= psi(k);
C *= psidag(k);
}
// Index linking 'second' to 'second'+1:

C *= prime(psi(second),lj)*op_second_x;
C *= prime(psidag(second),"Site");

auto spin_spin_inter_x = elt(C); // <-- final value that I wanted to compute


Is my approach correct? Or maybe I should also remove QNs on the sites between first and second?

+1 vote
edited by

Hi, so instead of removing QNs at all, I would recommend using the fact that Sx = (S+ + S-)/2. Then if you measure four correlation functions:

<S+ S+>, <S+ S->, <S- S+>, <S- S->


, you can recombine those numbers to get

<Sx Sx>


. It doesn’t require any extra code if you wrap your measurement code in a function and pass the operator names into this function in the four combinations above.

Does that sound good to you?

Miles

commented by (300 points)
That's a great note! I have two follow up questions:

1) Does the relation Sx = (S+ + S-)/2 still hold, when we calculate first the expectation values, and then just put them into the formula? So, is <Sx> = (<S+> + <S->)/2 is a correct formula?

2) How would a similar one look in the case of two-site correlators? Is it something like this <Sx_i Sx_j> = (<S+_i S+_j> + <S-_i S-_j>)/2, or is it more complicated?
commented by (6.7k points)
1) For single site expectation values, yes you can just calculate them separately as you show.

2) For multi-site correlation functions, you would need to expand it out, i.e. <Sx_i Sx_j> = (<S+_i S+_j> + <S+_i S-j> + <S-_i S+_j> + <S-_i S-_j>)/4.

-Matt
commented by (300 points)
That's fantastic! Thank you!
commented by (37.8k points)
Ok glad it’s making sense! Sorry my answer got formatted very strangely, but I just fixed it.

Yes, as Matt’s answer explains, if you just replace Sx with (S+ + S-)/2 and then expand all the terms using the linearity of correlation functions, then you get the expression he wrote (it is just a linear function because the wavefunction is a vector and the operators are linear operators on the vector space).

Best regards,
Miles’