qml.qchem

The PennyLane quantum chemistry library.

Note

To access the qml.qchem package, pennylane-qchem must be installed via pip:

pip install pennylane-qchem

The PennyLane quantum chemistry package. Supports OpenFermion, PySCF, and Psi4 for quantum chemistry calculations using PennyLane.

Functions

read_structure(filepath[, outpath])

Reads the structure of the polyatomic system from a file and creates a list containing the symbol and Cartesian coordinates of the atomic species.

meanfield(name, geometry[, charge, mult, …])

Generates a file from which the mean field electronic structure of the molecule can be retrieved.

active_space(electrons, orbitals[, mult, …])

Builds the active space for a given number of active electrons and active orbitals.

decompose(hf_file[, mapping, core, active])

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

convert_observable(qubit_observable[, wires])

Converts an OpenFermion QubitOperator operator to a Pennylane VQE observable

molecular_hamiltonian(name, geo_file[, …])

Generates the qubit Hamiltonian of a molecule.

hf_state(electrons, orbitals)

Generates the occupation-number vector representing the Hartree-Fock state.

excitations(electrons, orbitals[, delta_sz])

Generates single and double excitations from a Hartree-Fock reference state.

excitations_to_wires(singles, doubles[, wires])

Map the indices representing the single and double excitations generated with the function excitations() to the wires that the Unitary Coupled-Cluster (UCCSD) template will act on.

_qubit_operator_to_terms(qubit_operator[, wires])

Converts OpenFermion QubitOperator to a 2-tuple of coefficients and PennyLane Pauli observables.

_terms_to_qubit_operator(coeffs, ops[, wires])

Converts a 2-tuple of complex coefficients and PennyLane operations to OpenFermion QubitOperator.

_qubit_operators_equivalent(…[, wires])

Checks equivalence between OpenFermion QubitOperator and Pennylane VQE Hamiltonian (Tensor product of Pauli matrices).

qml.qchem.obs

This module contains functions to construct many-body observables whose expectation values can be used to simulate molecular properties.

observable(matrix_elements[, init_term, …])

Builds the many-body observable whose expectation value can be measured in PennyLane.

particle_number(orbitals[, mapping, wires])

Computes the particle number operator \(\hat{N}=\sum_\alpha \hat{n}_\alpha\) in the Pauli basis.

spin_z(orbitals[, mapping, wires])

Computes the total spin projection operator \(\hat{S}_z\) in the Pauli basis.

spin2(electrons, orbitals[, mapping, wires])

Computes the total spin operator \(\hat{S}^2\).

one_particle(matrix_elements[, core, …])

Generates the table of matrix elements of a given one-particle operator required to build many-body qubit observables.

two_particle(matrix_elements[, core, …])

Generates the table of matrix elements of a given two-particle operator required to build many-body qubit observables.

_spin2_matrix_elements(sz)

Builds the table of matrix elements \(\langle \bm{\alpha}, \bm{\beta} \vert \hat{s}_1 \cdot \hat{s}_2 \vert \bm{\gamma}, \bm{\delta} \rangle\) of the two-particle spin operator \(\hat{s}_1 \cdot \hat{s}_2\).