# defining composite on-site operators in AutoMPO (Julia)

+1 vote

I was wondering if you could help me with the following problem I ran into when using the Julia version of ITensor. When I define a composite on-site operator in the autoMPO of a Hamiltonian such as writing $C^\dagger{up} C{up}$ instead of $N_{up}$ when using "Electron" site types, I get unphysical results for the energy and ground state properties.

I have included a minimal code (based on your example of the Hubbard model) showing the problem I am having. It would be great if you could let me know how I can avoid this problem. In particular how can I avoid this problem in four Fermi terms where two fermi operators belong to one site.

Thank you.

============================================================

using ITensors

N = 5
Npart = 3
t1 = 1.0

sites = siteinds("Electron",N; conserve_qns=true);

ampo = AutoMPO()

for b=1:N-1
ampo += -t1,"Cdagup",b,"Cup",b+1
ampo += -t1,"Cdagup",b+1,"Cup",b
ampo += -t1,"Cdagdn",b,"Cdn",b+1
ampo += -t1,"Cdagdn",b+1,"Cdn",b
end

## The following two choices for including an on-site potential result in two different results for the energy and ground state properties. In particular the second choice seems defective.

## Choice 1:
ampo += 1000.,"Nup",1
ampo += 1000.,"Ndn",1

## Choice 2:
# ampo += 1000.,"Cdagup",1,"Cup",1
# ampo += 1000.,"Cdagdn",1,"Cdn",1

H = MPO(ampo,sites);

commented by (70.1k points)
Thanks! You are definitely right about this. An extra minus sign is resulting from the code in Choice 2 compared to Choice one whereas I agree these should be the same. I'll look into it and post a reply here.
commented by (14.1k points)
This may be related to this issue that I raised: https://github.com/ITensor/ITensors.jl/issues/514
commented by (70.1k points)
Yes, looks to be the same issue. Thanks for reporting that too, Matt. I'll try to prioritize this.

selected by

Hi, so I just patched the latest ITensor (Julia) with a fix for this issue. Thank you for finding it and please let us know if anything else like this seems inconsistent in the future.

If you do update ITensors in the Julia pkg system you should now get this bug fix.

Related pull request:
https://github.com/ITensor/ITensors.jl/pull/519

Best,
Miles

commented by (280 points)
Hi Miles, thanks for the update.
It works correctly now, I tried a few examples of four Fermi interaction terms as well and they also gave correct results.
Thanks!