when playing with some active space Hamiltonians with pyscf and generating them as FermionOperator objects (or rather InteractionOperator objects), I found that the resulting Hamiltonian included a lot of unnecessary terms: namely, operators such as
h_{kklm} a_k^dag a_k^dag a_l a_m,
where h_{kklm} was different than zero and the operator thus included (but the operator a_k^dag a_k^dag a_l am is zero, so one should just set h{kklm} to zero right away (k,l,m are here spinorbital indices).
Hi,
when playing with some active space Hamiltonians with pyscf and generating them as FermionOperator objects (or rather InteractionOperator objects), I found that the resulting Hamiltonian included a lot of unnecessary terms: namely, operators such as
h_{kklm} a_k^dag a_k^dag a_l a_m,
where h_{kklm} was different than zero and the operator thus included (but the operator a_k^dag a_k^dag a_l am is zero, so one should just set h{kklm} to zero right away (k,l,m are here spinorbital indices).
Maybe this problem could be solved by just adding:
if not (p==q or r==s):
before# Same spin two_body_coefficients[2 * p, 2 * q, 2 * r, 2 * s] = (two_body_integrals[p, q, r, s] / 2.) two_body_coefficients[2 * p + 1, 2 * q + 1, 2 * r + 1, 2 * s + 1] = (two_body_integrals[p, q, r, s] / 2.)
in line 272 of https://github.com/quantumlib/OpenFermion/blob/v1.6.0/src/openfermion/hamiltonians/hartree_fock.py#L245-L291Would this cause any problems?
Cheers, Michael.