Compute the commutator of two-body operators provided that both are

normal-ordered and that the first only has diagonal Coulomb interactions.

operator_a The first FermionOperator argument of the commutator. All terms must be normal-ordered, and furthermore either hopping operators (i^ j) or diagonal Coulomb operators (i^ i or i^ j^ i j).
operator_b The second FermionOperator argument of the commutator. operator_b can be any arbitrary two-body operator. prior_terms (optional): The initial FermionOperator to add to.

The commutator, or the commutator added to prior_terms if provided.


The function could be readily extended to the case of arbitrary two-body operator_a given that operator_b has the desired form; however, the extra check slows it down without desirable added utility.