F operator missing when creating Electronic Hamiltonian with ITensorChemistry.jl

Hi,
I was looking at the source of molecular_orbital_hamiltonian.jl and noticed that the F operator was not included while creating the OpSum of the electronic hamiltonian.

  for i in 1:nα, j in 1:nα
    if norm(hα[i, j]) > atol
      add!(hamiltonian, hα[i, j], "c†↑", i, "c↑", j)
      add!(hamiltonian, hα[i, j], "c†↓", i, "c↓", j)
    end
  end

I’ve seen in literature that operator F

function op!(Op::ITensor, ::OpName"F", ::SiteType"ElecK", s::Index)
  Op[s' => 1, s => 1] = +1.0
  Op[s' => 2, s => 2] = -1.0
  Op[s' => 3, s => 3] = -1.0
  return Op[s' => 4, s => 4] = +1.0
end

must be applied on the sites that have an odd number of fermionic operators on the left.
Can I have some clarification?

Thanks so much.

Are these what you’re referring to: https://github.com/ITensor/ITensors.jl/blob/b04a9738c3de587c18e247353a0ad5cfe165f1d8/src/physics/site_types/electron.jl#L222-L253?

Oh I see you’re talking about the “ElecK” site type, where is that defined?

Yes, i was cross-checking sitetypes and operator used in ITensorChemistry.
The definition of “ElectK” I’ve made a mistake for searching the source code in ITensor repository.

In ITensorChemistry the sitetype is “Electron”, so I’m referring to this:

In some papers, I’ve seen that fermionic operators have to be integrated with F to keep track of the phase factor originating from two anticommuting electrons on the same site with opposite spin

Thanks for the question. So the way this works in ITensors.jl is that when using the OpSum system, that system will put in the F operators for you when making Hamiltonians and other kinds of MPO’s. So it will be included, but you won’t see it happening because it will be done automatically behind the scenes.

The way OpSum knows which operators to attach string to is that it calls a function has_fermion_string which you can see defined for Electron operators here:
https://github.com/ITensor/ITensors.jl/blob/b04a9738c3de587c18e247353a0ad5cfe165f1d8/src/physics/site_types/electron.jl#L321

Similarly, if you use functions like correlation_matrix to compute quantities like \langle c^\dagger_i c_j \rangle then ITensor will put in the F strings for you there too.

The only case where you as a user have to put your own F strings is if you write code purely at the tensor contraction level where you contract e.g. MPS tensors together to compute observables. Hope that helps -

Miles

1 Like

Oh, now I see.
I’ve checked the autompo function and it’s encoded in the part

right?

Yes, that is one place where OpSum handles (odd-parity) fermionic operators. But there are other places too, like this one:
https://github.com/ITensor/ITensors.jl/blob/b04a9738c3de587c18e247353a0ad5cfe165f1d8/src/physics/autompo/opsum_to_mpo.jl#L49

1 Like

Perfect!
Thanks so much for clarification.

Fabio.