quri_parts.chem.transforms package#

FermionQubitStateMapper#

Interface for a function that maps a collection of occupied spin orbital indices to a computational basis state of qubits. Note that the mapping does not depend on the order of the occupied indices. A computational basis state with a positive sign should always be returned.

alias of Callable[[Collection[int]], ComputationalBasisState]

QubitFermionStateMapper#

Interface for a function that maps a computational basis state of qubits to a collection of occupied spin orbital indices.

alias of Callable[[ComputationalBasisState], Collection[int]]

class FermionCreationTerm(indices, coef=1.0)#

Bases: object

Represents a term for creating a single Fermionic Fock state with a coefficient.

indices specify indices of occupied spin orbitals. The orbitals should be indexed in an alternating order of up and down spins (especially important when using symmetry-conserving Bravyi-Kitaev mapping). The order of indices in indices corresponds to the order of Fermionic creation operators. Therefore this class also contains information about a sign coming from ordering of creation operators.

Parameters:
  • indices (Sequence[int]) –

  • coef (complex) –

class FermionQubitMapperFactory(*args, **kwargs)#

Bases: Protocol

Mapping from Fermionic states to qubit states.

abstract static n_qubits_required(n_spin_orbitals)#

Returns a number of qubits the mapping requires for a given number of spin orbitals.

Parameters:

n_spin_orbitals (int) –

Return type:

int

abstract static n_spin_orbitals(n_qubits)#

Returns a number of spin orbitals that the mapping can represent with a given number of qubits.

Parameters:

n_qubits (int) –

Return type:

int

abstract get_state_mapper(n_spin_orbitals, n_fermions=None, sz=None)#

Returns a function that maps occupied spin orbital indices to a computational basis state of qubits.

Parameters:
  • n_spin_orbitals (int) – The number of spin orbitals to be mapped to qubits.

  • n_fermions (int | None) – When specified, restrict the mapping to a subspace spanned by states containing the fixed number of Fermions. Some mappings require this argument (e.g. symmetry-conserving Bravyi-Kitaev transformation) while the others ignore it.

  • sz (float | None) – The spin along the z-axis of the state you want to transform. Some mappings require this argument (e.g. symmetry-conserving Bravyi-Kitaev transformation) while the others ignore it.

Return type:

chem.transforms.FermionQubitStateMapper

abstract get_inv_state_mapper(n_spin_orbitals, n_fermions=None, sz=None)#

Returns a function that maps a computational basis state of qubits to the set of occupied spin orbital indices.

Parameters:
  • n_spin_orbitals (int) – The number of spin orbitals.

  • n_fermions (int | None) – The number of fermions considered when the qubit state is mapped. Some mappings require this argument (e.g. symmetry-conserving Bravyi-Kitaev transformation) while the others ignore it.

  • sz (float | None) – The spin along the z-axis of the state you want to transform. Some mappings require this argument (e.g. symmetry-conserving Bravyi-Kitaev transformation) while the others ignore it.

Return type:

chem.transforms.QubitFermionStateMapper

class FermionQubitMapping(*args, **kwargs)#

Bases: Protocol

Mapping from Fermionic states to qubit states.

abstract property n_spin_orbitals: int#

Number of spin orbitals this mapping object works with.

abstract property n_qubits: int#

Number of qubits this mapping object works with.

abstract property state_mapper: chem.transforms.FermionQubitStateMapper#

Returns a function that maps occupied spin orbital indices to a computational basis state of qubits.

abstract property inv_state_mapper: chem.transforms.QubitFermionStateMapper#

Returns a function that maps a computational basis state of qubits to the set of occupied spin orbital indices.

jordan_wigner_n_qubits_required(n_spin_orbitals)#

Number of qubits required to perform Jordan-Wigner mapping for a system with n_spin_orbtals spin orbitals.

Parameters:

n_spin_orbitals (int) –

Return type:

int

jordan_wigner_n_spin_orbitals(n_qubits)#

Returns a number of spin orbitals that the Jordan-Wigner mapping can represent with a given number of qubits.

Parameters:

n_qubits (int) –

Return type:

int

class JordanWignerMapperFactory(*args, **kwargs)#

Bases: FermionQubitMapperFactory, ABC

Jordan-Wigner transformation.

static n_qubits_required(n_spin_orbitals)#

Number of qubits required to perform Jordan-Wigner mapping for a system with n_spin_orbtals spin orbitals.

Parameters:

n_spin_orbitals (int) –

Return type:

int

static n_spin_orbitals(n_qubits)#

Returns the number of spin orbitals that the Jordan-Wigner mapping can represent with a given number of qubits.

Parameters:

n_qubits (int) –

Return type:

int

class JordanWigner(*args, **kwargs)#

Bases: FermionQubitMapping, ABC

property n_qubits: int#

Number of qubits to perform Jordan-Wigner mapping with.

bravyi_kitaev_n_qubits_required(n_spin_orbtals)#

Number of qubits required to perform Bravyi-Kitaev mapping for a system with n_spin_orbtals spin orbitals.

Parameters:

n_spin_orbtals (int) –

Return type:

int

bravyi_kitaev_n_spin_orbitals(n_qubits)#

Returns the number of spin orbitals that the Bravyi-Kitaev mapping can represent with a given number of qubits.

Parameters:

n_qubits (int) –

Return type:

int

class BravyiKitaevMapperFactory(*args, **kwargs)#

Bases: FermionQubitMapperFactory, ABC

Bravyi-Kitaev transformation.

static n_qubits_required(n_spin_orbitals)#

Number of qubits required to perform Bravyi-Kitaev mapping for a system with n_spin_orbtals spin orbitals.

Parameters:

n_spin_orbitals (int) –

Return type:

int

static n_spin_orbitals(n_qubits)#

Returns the number of spin orbitals that the Bravyi-Kitaev mapping can represent with a given number of qubits.

Parameters:

n_qubits (int) –

Return type:

int

class BravyiKitaev(*args, **kwargs)#

Bases: FermionQubitMapping, ABC

property n_qubits: int#

Number of qubits to perform Bravyi-Kitaev mapping with.

symmetry_conserving_bravyi_kitaev_n_qubits_required(n_spin_orbtals)#

Number of qubits required to perform symmetry-conserving Bravyi-Kitaev mapping for a system with n_spin_orbtals spin orbitals.

Parameters:

n_spin_orbtals (int) –

Return type:

int

symmetry_conserving_bravyi_kitaev_n_spin_orbitals(n_qubits)#

Returns the number of spin orbitals that the symmetry-conservinh Bravyi- Kitaev mapping can represent with a given number of qubits.

Parameters:

n_qubits (int) –

Return type:

int

class SymmetryConservingBravyiKitaevMapperFactory(*args, **kwargs)#

Bases: FermionQubitMapperFactory, ABC

Symmetry-conserving Bravyi-Kitaev transformation described in arXiv:1701.08213.

Note that in this mapping the spin orbital indices are first reordered to all spin-up orbitals, then all spin-down orbitals. Bravyi-Kitaev transoformation is applied after the reordering and then two qubits are dropped using conservation of particle number and spin.

static n_qubits_required(n_spin_orbitals)#

Number of qubits required to perform symmetry-conserving Bravyi- Kitaev mapping for a system with n_spin_orbtals spin orbitals.

Parameters:

n_spin_orbitals (int) –

Return type:

int

static n_spin_orbitals(n_qubits)#

Returns the number of spin orbitals that the symmetry-conserving Bravyi-Kitaev mapping can represent with a given number of qubits.

Parameters:

n_qubits (int) –

Return type:

int

class SymmetryConservingBravyiKitaev(*args, **kwargs)#

Bases: FermionQubitMapping, ABC

property n_qubits: int#

Number of qubits to perform symmetry-conserving Bravyi-Kitaev mapping with.