Page 1 of 1

computing correlation function and expectation value

Posted: 14 Nov 2024, 17:16
by amankumar
I am computing two quantities which I expect should give me the same answer but they are not in the fermi Hubbard model.

Code: Select all

cc_ij = psi.correlation_function("Cdu", "Cu")+psi.correlation_function("Cdd", "Cd")


print(cc_ij[1][2])
print(psi.expectation_value_term([('Cdu', 1), ('Cu', 2)])+psi.expectation_value_term([('Cdd', 1), ('Cd', 2)]))
I expect that correlation function and expectation value should give the same answer. Is there any issue of projection being taken care in any one of them. Please let me know.

Re: computing correlation function and expectation value

Posted: 07 Jan 2025, 13:53
by Johannes
This should really give the same. It's been a while since you wrote this - has this been resolved by now?
I quickly tried to reproduce this for a random MPS, but it seemed to work as expected. If you still find differences, it would be great if you can open an issue on github and provide a (minimal working example) or example MPS where this fails.