# Calculating correlations for fermions with spin

Hi!
I'm using the following code to calculate correlations of the type cdagup(i) cup(j) and take its log. I'm using Electron sites with {"ConserveSz=",false}

auto ampo2 = AutoMPO(sites);
auto i = 100;
for(auto j=200;j<250;j++)
{
ampo2 += 1,"Cdagup",i,"Cup",j;
auto mpo = toMPO(ampo2);
auto result = innerC(psi,mpo,psi);
outfile<<i<<", "<<j<<", "<<log(abs(i-j))<<", "<<log(abs(result))<<"\n";
ampo2 = AutoMPO(sites);

}
outfile.close();


The answer depends on whether j is even or odd for a fixed i. Here is a small excerpt from the output. The log of the correlations are higher when j is odd.

i, j, Log(|i-j|), Log|cdagup(i) cup(j)| are printed below

100, 200, 4.60517, -8.32898
100, 201, 4.61512, -6.1358
100, 202, 4.62497, -8.33054
100, 203, 4.63473, -6.1581
100, 204, 4.64439, -8.33459
100, 205, 4.65396, -6.17968
100, 206, 4.66344, -8.34129
100, 207, 4.67283, -6.20057

What is the reason for this? Is this a proper way to calculate the correlations?

commented by (50.7k points)
Hi, thanks for the question. When you say it depends on whether j is even or odd, I see that you mean there is an strong oscillation in the magnitude from even to odd sites. But I guess you are saying this is not the answer you expected? A system could actually have these kind of oscillations if, say, one is close to an edge in which case there could be strong Friedel oscillations. But it could be a bug. I just wanted to make sure you think it is a bug not a physical effect - thanks.