## My correlation functions from MPS.correlation_function and MPSEnvironment.expectation value disagree

How do I use this algorithm? What does that parameter do?
xaver
Posts: 10
Joined: 23 Apr 2021, 07:51

### My correlation functions from MPS.correlation_function and MPSEnvironment.expectation value disagree

Hello,

I have issues, calculation correlation functions of 2-site operators in different ways. Before posting a lot of specific code, let me pls. ask in a more general context:
• Let $$|\psi\rangle$$ be an MPS of finite even length L
• Let $$A_i B_{i+1}$$ denote a nearest neighbor 2-site operator, i.e. some npc.Array shape=(2, 2, 2, 2) labels=['p0', 'p0*', 'p1', 'p1*'], which is composed from two 1-site operators , and  where - to simplify matter - both, $$A$$ and $$B$$ do also have string labels $$Astr$$ and $$Bstr$$ (Eg. one could just have Astr=Bstr='Sz' on some spin model).
• To not have any questions about canonical forms later, let the 2-site op be unitary. (I don't know if this is relevant, but anyway)
• Eval $$C_a = \langle\psi|A_{L/2} B_{L/2+1} A_i B_{i+1}|\psi\rangle$$ i.e. Ca = psi.correlation_function([Astr,Bstr],[Astr,Bstr], [L/2])
• Now, set $$|\phi\rangle = A_{L/2} B_{L/2+1} |\psi\rangle$$, i.e. phi = copy.deepcopy(psi); phi.apply_local_op(L/2,A B)
• Define an MPSEnvironment like bk = MPSEnvironment(phi,psi) and eval the expectation value $$C_b = \langle\phi|A_i B_{i+1}|\psi\rangle$$ with Cb = bk.expectation_value(AB)
My naive expectation was that $$C_a = C_b$$, which however it is not for me. By that I mean they just disagree completely.
So what is it that I do not understand?
And, how to properly eval correlation functions using MPSEnvironment?

PS.: If I play the same game with only a single site operator, then $$C_a = C_b$$ as I expected.
Johannes
Posts: 337
Joined: 21 Jul 2018, 12:52
Location: TU Munich

### Re: My correlation functions from MPS.correlation_function and MPSEnvironment.expectation value disagree

The issue is confusion about the (first two) arguments of correlation_function.

Giving a list of operators as arguments does not mean that you evaluate correlations between multi-site terms, but that you evaluate different correlation functions on even vs odd sites:
psi.correlation_function(['A','B'], ['C', 'D']) evaluates
$\begin{cases} \langle A_i C_j\rangle & \text{for even i, even j} \\ \langle B_i C_j\rangle & \text{for odd i, even j} \\ \langle A_i D_j\rangle & \text{for even i, odd j} \\ \langle B_i D_j\rangle & \text{for odd i, odd j} \\ \end{cases}$

If you want to evaluate $$\langle A_i B_{i+1} C_j D_{j+1} \rangle$$, you need to use the term_correlation_function_right or term_correlation_function_left, respectively, which does exactly that!
xaver
Posts: 10
Joined: 23 Apr 2021, 07:51

### Re: My correlation functions from MPS.correlation_function and MPSEnvironment.expectation value disagree

Aah! Now I do get $$C_a = C_b$$ for my system. Great. Thx.

(I was trying to interpret the list of strings from the 2nd figure in tenpy.networks.mps.MPS.correlation_function following the description of correlation_function, which kind of suggested to someone=me, lost in the very helpful docs, that the elements of an optional list of opstr might be consecutively attached to the physical legs ... )