Shortcuts

qiskit.chemistry.FermionicOperator

class FermionicOperator(h1, h2=None, ph_trans_shift=None)[source]

A set of functions to map fermionic Hamiltonians to qubit Hamiltonians.

References:

  • E. Wigner and P. Jordan., Über das Paulische Äquivalenzverbot, Z. Phys., 47:631 (1928).

  • S. Bravyi and A. Kitaev. Fermionic quantum computation, Ann. of Phys., 298(1):210–226 (2002).

  • A. Tranter, S. Sofia, J. Seeley, M. Kaicher, J. McClean, R. Babbush, P. Coveney, F. Mintert, F. Wilhelm, and P. Love. The Bravyi–Kitaev transformation: Properties and applications. Int. Journal of Quantum Chemistry, 115(19):1431–1441 (2015).

  • S. Bravyi, J. M. Gambetta, A. Mezzacapo, and K. Temme, arXiv e-print arXiv:1701.08213 (2017).

  • K. Setia, J. D. Whitfield, arXiv:1712.00446 (2017)

This class requires the integrals stored in the ‘chemist’ notation

h2(i,j,k,l) –> adag_i adag_k a_l a_j

and the integral values are used for the coefficients of the second-quantized Hamiltonian that is built. The integrals input here should be in block spin format and also have indexes reordered as follows ‘ijkl->ljik’

There is another popular notation, the ‘physicist’ notation

h2(i,j,k,l) –> adag_i adag_j a_k a_l

If you are using the ‘physicist’ notation, you need to convert it to the ‘chemist’ notation. E.g. h2=numpy.einsum(‘ikmj->ijkm’, h2)

The QMolecule class has one_body_integrals and two_body_integrals properties that can be directly supplied to the h1 and h2 parameters here respectively.

Parameters
  • h1 (numpy.ndarray) – second-quantized fermionic one-body operator, a 2-D (NxN) tensor

  • h2 (numpy.ndarray) – second-quantized fermionic two-body operator, a 4-D (NxNxNxN) tensor

  • ph_trans_shift (float) – energy shift caused by particle hole transformation

__init__(h1, h2=None, ph_trans_shift=None)[source]

This class requires the integrals stored in the ‘chemist’ notation

h2(i,j,k,l) –> adag_i adag_k a_l a_j

and the integral values are used for the coefficients of the second-quantized Hamiltonian that is built. The integrals input here should be in block spin format and also have indexes reordered as follows ‘ijkl->ljik’

There is another popular notation, the ‘physicist’ notation

h2(i,j,k,l) –> adag_i adag_j a_k a_l

If you are using the ‘physicist’ notation, you need to convert it to the ‘chemist’ notation. E.g. h2=numpy.einsum(‘ikmj->ijkm’, h2)

The QMolecule class has one_body_integrals and two_body_integrals properties that can be directly supplied to the h1 and h2 parameters here respectively.

Parameters
  • h1 (numpy.ndarray) – second-quantized fermionic one-body operator, a 2-D (NxN) tensor

  • h2 (numpy.ndarray) – second-quantized fermionic two-body operator, a 4-D (NxNxNxN) tensor

  • ph_trans_shift (float) – energy shift caused by particle hole transformation

Methods

__init__(h1[, h2, ph_trans_shift])

This class requires the integrals stored in the ‘chemist’ notation

fermion_mode_elimination(fermion_mode_array)

Eliminate modes.

fermion_mode_freezing(fermion_mode_array)

Freezing modes and extracting its energy.

mapping(map_type[, threshold])

Map fermionic operator to qubit operator.

particle_hole_transformation(num_particles)

The ‘standard’ second quantized Hamiltonian can be transformed in the particle-hole (p/h) picture, which makes the expansion of the trail wavefunction from the HF reference state more natural.

total_angular_momentum()

Total angular momentum.

total_magnetization()

A data_preprocess_helper fermionic operator which can be used to evaluate the magnetization of the given eigenstate.

total_particle_number()

A data_preprocess_helper fermionic operator which can be used to evaluate the number of particle of the given eigenstate.

transform(unitary_matrix)

Transform the one and two body term based on unitary_matrix.

Attributes

h1

Getter of one body integral tensor.

h2

Getter of two body integral tensor.

modes

Getter of modes.

fermion_mode_elimination(fermion_mode_array)[source]

Eliminate modes.

Generate a new fermionic operator with the modes in fermion_mode_array deleted

Parameters

fermion_mode_array (list) – orbital index for elimination

Returns

Fermionic Hamiltonian

Return type

FermionicOperator

fermion_mode_freezing(fermion_mode_array)[source]

Freezing modes and extracting its energy.

Generate a fermionic operator with the modes in fermion_mode_array deleted and provide the shifted energy after freezing.

Parameters

fermion_mode_array (list) – orbital index for freezing

Returns

Fermionic Hamiltonian and energy of frozen modes

Return type

tuple(FermionicOperator, float)

property h1

Getter of one body integral tensor.

property h2

Getter of two body integral tensor.

mapping(map_type, threshold=1e-08)[source]

Map fermionic operator to qubit operator.

Using multiprocess to speedup the mapping, the improvement can be observed when h2 is a non-sparse matrix.

Parameters
  • map_type (str) – case-insensitive mapping type. “jordan_wigner”, “parity”, “bravyi_kitaev”, “bksf”

  • threshold (float) – threshold for Pauli simplification

Returns

create an Operator object in Paulis form.

Return type

WeightedPauliOperator

Raises

QiskitChemistryError – if the map_type can not be recognized.

property modes

Getter of modes.

particle_hole_transformation(num_particles)[source]

The ‘standard’ second quantized Hamiltonian can be transformed in the particle-hole (p/h) picture, which makes the expansion of the trail wavefunction from the HF reference state more natural. In fact, for both trail wavefunctions implemented in q-lib (‘heuristic’ hardware efficient and UCCSD) the p/h Hamiltonian improves the speed of convergence of the VQE algorithm for the calculation of the electronic ground state properties. For more information on the p/h formalism see: P. Barkoutsos, arXiv:1805.04340(https://arxiv.org/abs/1805.04340).

Parameters

num_particles (list, int) – number of particles, if it is a list, the first number is alpha and the second number is beta.

Returns

new_fer_op, energy_shift

Return type

tuple

total_angular_momentum()[source]

Total angular momentum.

A data_preprocess_helper fermionic operator which can be used to evaluate the total angular momentum of the given eigenstate.

Returns

Fermionic Hamiltonian

Return type

FermionicOperator

total_magnetization()[source]

A data_preprocess_helper fermionic operator which can be used to evaluate the magnetization of the given eigenstate.

Returns

Fermionic Hamiltonian

Return type

FermionicOperator

total_particle_number()[source]

A data_preprocess_helper fermionic operator which can be used to evaluate the number of particle of the given eigenstate.

Returns

Fermionic Hamiltonian

Return type

FermionicOperator

transform(unitary_matrix)[source]

Transform the one and two body term based on unitary_matrix.

You are viewing lang: English
Languages
English
Japanese
German
Korean