qat.fermion.transforms.transform_to_parity_basis
- qat.fermion.transforms.transform_to_parity_basis(fermion_hamiltonian: Union[FermionHamiltonian, ElectronicStructureHamiltonian]) SpinHamiltonian
Transform to parity basis.
- Parameters
fermion_hamiltonian (Union[FermionHamiltonian, ElectronicStructureHamiltonian]) – The fermionic hamiltonian.
- Returns
Hamiltonian in parity spin representation.
- Return type
Examples:
from qat.core import Term from qat.fermion import FermionHamiltonian from qat.fermion.transforms import transform_to_parity_basis hamiltonian = FermionHamiltonian( 2, [Term(0.3, "Cc", [0, 1]), Term(1.4, "CcCc", [0, 1, 1, 0])]) spin_hamiltonian = transform_to_parity_basis(hamiltonian) print(f"H = {hamiltonian} \n") print(f"H(spin) = {spin_hamiltonian}")
H = 0.3 * (Cc|[0, 1]) + 1.4 * (Cc|[0, 0]) + 1.4 * (CCcc|[0, 1, 0, 1]) H(spin) = (0.35+0j) * I^2 + -0.075j * (Y|[0]) + (-0.075+0j) * (XZ|[0, 1]) + (0.075+0j) * (X|[0]) + 0.075j * (YZ|[0, 1]) + (-0.35+0j) * (Z|[1]) + (-0.35+0j) * (Z|[0]) + (0.35+0j) * (ZZ|[0, 1])