English
Languages
English
Bengali
Japanese
Spanish



ElectronicEnergy

class ElectronicEnergy(electronic_integrals, *, constants=None)[source]

Bases: Hamiltonian

The electronic energy Hamiltonian.

This class implements the following Hamiltonian:

\[\sum_{p, q} h_{pq} a^\dagger_p a_q + \sum_{p, q, r, s} g_{pqrs} a^\dagger_p a^\dagger_q a_r a_s ,\]

where \(h_{pq}\) and \(g_{pqrs}\) are the one- and two-body electronic integrals, stored in an ElectronicIntegrals container. When dealing with separate coefficients for the \(\alpha\)- and \(\beta\)-spin electrons, the unrestricted-spin Hamiltonian can be obtained from the one above in a straight-forward manner, following any quantum chemistry textbook.

You can construct an instance of this Hamiltonian in multiple ways:

  1. With an existing instance of ElectronicIntegrals:

integrals: ElectronicIntegrals = ...

from qiskit_nature.second_q.hamiltonians import ElectronicEnergy

hamiltonian = ElectronicEnergy(integrals, constants={"nuclear_repulsion_energy": 1.0})
  1. From a raw set of integral coefficient matrices:

# assuming, you have your one- and two-body integrals from somewhere
h1_a, h2_aa, h1_b, h2_bb, h2_ba = ...

hamiltonian = ElectronicEnergy.from_raw_integrals(h1_a, h2_aa, h1_b, h2_bb, h2_ba)
hamiltonian.nuclear_repulsion_energy = 1.0

Note, how we specified the nuclear repulsion energy as a constant energy offset in the above examples. This term will not be included in the mapped qubit operator since it is a constant offset term and does not need to incur any errors from being measured on a quantum device. It is however possible to include constant energy terms inside of the ElectronicIntegrals container, if you want it to be included in the qubit operator, once mapping the second-quantized operator to the qubit space (see also QubitMapper).

from qiskit_nature.second_q.operators import PolynomialTensor

e_nuc = hamiltonian.nuclear_repulsion_energy
hamiltonian.electronic_integrals.alpha += PolynomialTensor({"": e_nuc})
hamiltonian.nuclear_repulsion_energy = None

It is also possible to add other constant energy offsets to the constants attribute of this Hamiltonian. All offsets registered in that dictionary will not be mapped to the qubit operator.

hamiltonian.constants["my custom offset"] = 5.0

# be careful, the following overwrites the hamiltonian.nuclear_repulsion_energy value
hamiltonian.constants["nuclear_repulsion_energy"] = 10.0
electronic_integrals

The qiskit_nature.second_q.operators.ElectronicIntegrals.

constants

A mapping of constant energy offsets, not mapped to the qubit operator.

Parameters:
  • electronic_integrals (ElectronicIntegrals) – The container with the one- and two-body coefficients.

  • constants (MutableMapping[str, float]) – A mapping of constant energy offsets.

Attributes

nuclear_repulsion_energy

The nuclear repulsion energy.

register_length

The size of the operator generated by the second_q_op() method.

Methods

coulomb(density)

Computes the Coulomb term for the given reduced density matrix.

exchange(density)

Computes the Exchange term for the given reduced density matrix.

fock(density)

Computes the Fock operator for the given reduced density matrix.

from_raw_integrals(h1_a, h2_aa[, h1_b, ...])

Constructs a hamiltonian instance from raw integrals.

interpret(result)

Interprets an EigenstateResult.

second_q_op()

Returns the second quantized operator constructed from the contained electronic integrals.