qat.fermion.transforms.transform_to_jw_basis

qat.fermion.transforms.transform_to_jw_basis(fermion_hamiltonian: Union[FermionHamiltonian, ElectronicStructureHamiltonian]) SpinHamiltonian

Transform to Jordan-Wigner (JW) basis.

Parameters

fermion_hamiltonian (Union[FermionHamiltonian, ElectronicStructureHamiltonian]) – The fermionic hamiltonian.

Returns

Hamiltonian in spin representation.

Return type

SpinHamiltonian

Examples:

from qat.core import Term
from qat.fermion import FermionHamiltonian
from qat.fermion.transforms import transform_to_jw_basis

hamiltonian = FermionHamiltonian(
    2, [Term(0.3, "Cc", [0, 1]), Term(1.4, "CcCc", [0, 1, 1, 0])])

spin_hamiltonian = transform_to_jw_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 * (YX|[0, 1]) +
(0.075+0j) * (YY|[0, 1]) +
(0.075+0j) * (XX|[0, 1]) +
0.075j * (XY|[0, 1]) +
(-0.35+0j) * (ZZ|[0, 1]) +
(-0.35+0j) * (Z|[0]) +
(0.35+0j) * (Z|[1])