qml.qchem.decompose

decompose(hf_file, mapping='jordan_wigner', core=None, active=None)[source]

Decomposes the molecular Hamiltonian into a linear combination of Pauli operators using OpenFermion tools.

This function uses OpenFermion functions to build the second-quantized electronic Hamiltonian of the molecule and map it to the Pauli basis using the Jordan-Wigner or Bravyi-Kitaev transformation.

Parameters
  • hf_file (str) – absolute path to the hdf5-formatted file with the Hartree-Fock electronic structure

  • mapping (str) – Specifies the transformation to map the fermionic Hamiltonian to the Pauli basis. Input values can be 'jordan_wigner' or 'bravyi_kitaev'.

  • core (list) – indices of core orbitals, i.e., the orbitals that are not correlated in the many-body wave function

  • active (list) – indices of active orbitals, i.e., the orbitals used to build the correlated many-body wave function

Returns

an instance of OpenFermion’s QubitOperator

Return type

QubitOperator

Example

>>> decompose('./pyscf/sto-3g/h2', mapping='bravyi_kitaev')
(-0.04207897696293986+0j) [] + (0.04475014401986122+0j) [X0 Z1 X2] +
(0.04475014401986122+0j) [X0 Z1 X2 Z3] +(0.04475014401986122+0j) [Y0 Z1 Y2] +
(0.04475014401986122+0j) [Y0 Z1 Y2 Z3] +(0.17771287459806262+0j) [Z0] +
(0.17771287459806265+0j) [Z0 Z1] +(0.1676831945625423+0j) [Z0 Z1 Z2] +
(0.1676831945625423+0j) [Z0 Z1 Z2 Z3] +(0.12293305054268105+0j) [Z0 Z2] +
(0.12293305054268105+0j) [Z0 Z2 Z3] +(0.1705973832722409+0j) [Z1] +
(-0.2427428049645989+0j) [Z1 Z2 Z3] +(0.1762764080276107+0j) [Z1 Z3] +
(-0.2427428049645989+0j) [Z2]