Returns the qubit Hamiltonian for the fermionic Hamiltonian

supplied, with two qubits removed using conservation of electron spin and number, as described in arXiv:1701.08213.

fermion_hamiltonian A fermionic hamiltonian obtained using OpenFermion. An instance of the FermionOperator class.
active_orbitals Int type object. The number of active orbitals being considered for the system.
active_fermions Int type object. The number of active fermions being considered for the system (note, this is less than the number of electrons in a molecule if some orbitals have been assumed filled).

qubit_hamiltonian The qubit Hamiltonian corresponding to the supplied fermionic Hamiltonian, with two qubits removed using spin symmetries.


Reorders orbitals from the default even-odd ordering to all spin-up orbitals, then all spin-down orbitals.

ValueError if fermion_hamiltonian isn't of the type FermionOperator, or active_orbitals isn't an integer, or active_fermions isn't an integer.

Notes: This function reorders the spin orbitals as all spin-up, then all spin-down. It uses the OpenFermion bravyi_kitaev_tree mapping, rather than the bravyi-kitaev mapping. Caution advised when using with a Fermi-Hubbard Hamiltonian; this technique correctly reduces the Hamiltonian only for the lowest energy even and odd fermion number states, not states with an arbitrary number of fermions.