Qiskit’s chemistry module
qiskit.chemistry
This is Qiskit’s chemistry module that provides for experimentation with chemistry domain problems such as ground state energy and excited state energies of molecules.
Overview
This is an overview of the workings of the chemistry module and how it may be used. There are different levels of exposure to its functionality, allowing for experimentation at different abstractions. The outline below starts with the flow that provides the most control of the process.
A classical chemistry driver is first instantiated, from the available drivers
, by means of a molecule specification, along with other configuration such as basis set and method (RHF, ROHF, UHF). This configuration may include custom settings for the specific driver for more custom control over the driver’s behavior. When the driver is run the output is a mostly driver independent QMolecule
. This contains various quantities that were computed including one and two-body electron integrals that are used as input FermionicOperator
. Mostly driver independent means that these integrals, for example, will be there from every driver but the values may differ due to how each underlying chemistry library/program computes them. Also some fields in the QMolecule may not be populated by all drivers, for instance dipole integrals are not output from the PyQuante driver, and hence the dipole moment cannot be computed by qiskit.chemistry when using this driver. The FermionicOperator once created can then be converted/mapped to a qubit operator for use as input to an Aqua algorithms. The operator must be in qubit form at this stage since the execution target of the algorithm will be a quantum device, or simulator ,comprised of qubits and the mapping is needed as qubits behave differently than fermions. Once the algorithm is run it will compute the electronic part of the quantity, such as the electronic ground state energy. To get the total ground state energy this can be combined with the nuclear repulsion energy in the QMolecule.
Instead of using the FermionicOperator the core.Hamiltonian
may be used. This itself uses the FermionicOperator but provides a higher level of function to simplify use. For instance the FermionicOperator supports particle-hole transformation and different mappings. And to compute dipole moments each of the X, Y and Z dipole integrals must be prepared, as individual FermionicOperators, in a like manner to the main electronic energy one, i.e. same transformations, and eventually same qubit mapping. The core.Hamiltonian class does all this and more, such as orbital reductions, frozen core and automatic symmetry reduction. When run with a QMolecule output from a driver it produces qubit operators that can be given directly to Aqua algorithms for the computation. Also available are several properties, such as number of particles and number of orbitals, that are needed to correctly instantiate chemistry specific components such as UCCSD
and HartreeFock
. Using the FermionicOperator directly requires taking the initial values for the QMolecule and then keeping track of any changes based on any orbital elimination and/or freezing, and/or Z2Symmetry reductions that are done. Once the output qubit operators have been used with an Aqua algorithm, to compute the electronic result, this result can be fed back to the core.Hamiltonian, to process_algorithm_result()
which will then compute a final total result including a user friendly formatted text result that may be printed.
Lastly the chemistry applications
may be used. These are given a chemistry driver and, in the case of MolecularGroundStateEnergy
an optional instance of an Aqua MinimumEigensolver
, such as VQE
. Optional since components such as UCCSD
need certain information that may be unknown at this point. So alternatively, when its method compute_energy()
is run a callback can be provided which will later be passed information, such as number of particles and orbitals, and allow a complete MinimumEigensolver to be built using say UCCSD with HartreeFock, and subsequently returned to the application and run. MinimumEigensolver itself uses the core.Hamiltonian class wrapping it to form this high level application.
Mappings
To map the FermionicOperator to a qubit operator the chemistry module supports the following mappings:
Jordan Wigner
The Jordan-Wigner transformation, maps spin operators onto fermionic creation and annihilation operators. It was proposed by Ernst Pascual Jordan and Eugene Paul Wigner for one-dimensional lattice models, but now two-dimensional analogues of the transformation have also been created. The Jordan–Wigner transformation is often used to exactly solve 1D spin-chains by transforming the spin operators to fermionic operators and then diagonalizing in the fermionic basis.
Parity
The parity-mapping transformation. optimizes encodings of fermionic many-body systems by qubits in the presence of symmetries. Such encodings eliminate redundant degrees of freedom in a way that preserves a simple structure of the system Hamiltonian enabling quantum simulations with fewer qubits.
Bravyi-Kitaev
Also known as binary-tree-based qubit mapping, the Bravyi-Kitaev transformation is a method of mapping the occupation state of a fermionic system onto qubits. This transformation maps the Hamiltonian of interacting fermions to an local Hamiltonian of qubits. This is an improvement in locality over the Jordan–Wigner transformation, which results in an local qubit Hamiltonian. The Bravyi–Kitaev transformation was proposed by Sergey B. Bravyi and Alexei Yu. Kitaev.
Bravyi-Kitaev Superfast
Bravyi-Kitaev Superfast (BKSF) algorithm is a mapping from fermionic operators to qubit operators. BKSF algorithm defines an abstract model where the fermionic modes are mapped to vertices of an interaction graph. The edges of the graph correspond to the interaction between the modes. The graph can be constructed from the Hamiltonian. The simulation is done by putting qubits on the edges of the graph. Each fermionic operator costs qubit operations, where is the degree of the interaction graph. The BKSF was proposed by Kanav Setia and James D. Whitfield.
The classes and submodules of qiskit.chemistry are now listed for reference:
Chemistry Error
QiskitChemistryError | Class for errors returned by Qiskit’s Chemistry module. |
Chemistry Classes
BosonicOperator | A set of functions to map bosonic Hamiltonians to qubit Hamiltonians. |
FermionicOperator | A set of functions to map fermionic Hamiltonians to qubit Hamiltonians. |
QMolecule | Molecule data class containing driver result. |
WatsonHamiltonian | Watson Hamiltonian class containing the results of a driver’s anharmonic calculation |
MP2Info | A utility class for Moller-Plesset 2nd order (MP2) information |
Submodules
algorithms | Chemistry specific Aqua algorithms (qiskit.chemistry.algorithms ) |
applications | Chemistry Applications (qiskit.chemistry.applications ) |
components | Chemistry Components (qiskit.chemistry.components ) |
core | Chemistry Core (qiskit.chemistry.core ) |
drivers | Chemistry Drivers (qiskit.chemistry.drivers ) |
results | Chemistry Results (qiskit.chemistry.results ) |
transformations | Qubit Transformations (qiskit.chemistry.transformations ) |