qml.qchem.molecular_dipole

molecular_dipole(molecule, method='dhf', active_electrons=None, active_orbitals=None, mapping='jordan_wigner', outpath='.', wires=None, args=None, cutoff=1e-16)[source]

Generate the dipole moment operator for a molecule in the Pauli basis.

The dipole operator in the second-quantized form is

\[\hat{D} = -\sum_{pq} d_{pq} [\hat{c}_{p\uparrow}^\dagger \hat{c}_{q\uparrow} + \hat{c}_{p\downarrow}^\dagger \hat{c}_{q\downarrow}] - \hat{D}_\mathrm{c} + \hat{D}_\mathrm{n},\]

where the matrix elements \(d_{pq}\) are given by the integral of the position operator \(\hat{{\bf r}}\) over molecular orbitals \(\phi\)

\[d_{pq} = \int \phi_p^*(r) \hat{{\bf r}} \phi_q(r) dr,\]

and \(\hat{c}^{\dagger}\) and \(\hat{c}\) are the creation and annihilation operators, respectively. The contribution of the core orbitals and nuclei are denoted by \(\hat{D}_\mathrm{c}\) and \(\hat{D}_\mathrm{n}\), respectively, which are computed as

\[\hat{D}_\mathrm{c} = 2 \sum_{i=1}^{N_\mathrm{core}} d_{ii} \quad \text{and} \quad \hat{D}_\mathrm{n} = \sum_{i=1}^{N_\mathrm{atoms}} Z_i {\bf R}_i,\]

where \(Z_i\) and \({\bf R}_i\) denote, respectively, the atomic number and the nuclear coordinates of the \(i\)-th atom of the molecule.

The fermionic dipole operator is then transformed to the qubit basis, which gives

\[\hat{D} = \sum_{j} c_j P_j,\]

where \(c_j\) is a numerical coefficient and \(P_j\) is a tensor product of single-qubit Pauli operators \(X, Y, Z, I\). The qubit observables corresponding to the components \(\hat{D}_x\), \(\hat{D}_y\), and \(\hat{D}_z\) of the dipole operator are then computed separately.

Parameters
  • molecule (Molecule) – The molecule object

  • method (str) – Quantum chemistry method used to solve the mean field electronic structure problem. Available options are method="dhf" to specify the built-in differentiable Hartree-Fock solver, or method="openfermion" to use the OpenFermion-PySCF plugin (this requires openfermionpyscf to be installed).

  • active_electrons (int) – Number of active electrons. If not specified, all electrons are considered to be active.

  • active_orbitals (int) – Number of active orbitals. If not specified, all orbitals are considered to be active.

  • mapping (str) – Transformation used to map the fermionic Hamiltonian to the qubit Hamiltonian. Input values can be 'jordan_wigner', 'parity' or 'bravyi_kitaev'.

  • outpath (str) – Path to the directory containing output files

  • wires (Wires, list, tuple, dict) – Custom wire mapping used to convert the qubit operator to an observable measurable in a Pennylane ansatz. For types Wires/list/tuple, each item in the iterable represents a wire label corresponding to the qubit number equal to its index. For type dict, only int-keyed dict (for qubit-to-wire conversion) is accepted for partial mapping. If None, will use identity map.

  • args (array[array[float]]) – Initial values of the differentiable parameters

  • cutoff (float) – Cutoff value for including the matrix elements \(\langle \alpha \vert \hat{{\bf r}} \vert \beta \rangle\). The matrix elements with absolute value less than cutoff are neglected.

Returns

The qubit observables corresponding to the components \(\hat{D}_x\), \(\hat{D}_y\) and \(\hat{D}_z\) of the dipole operator.

Return type

list[pennylane.Hamiltonian]

Example

>>> symbols = ["H", "H", "H"]
>>> coordinates = np.array([[0.028, 0.054, 0.0], [0.986, 1.610, 0.0], [1.855, 0.002, 0.0]])
>>> mol = qml.qchem.Molecule(symbols, coordinates, charge=1)
>>> dipole_obs = qml.qchem.molecular_dipole(mol, method="openfermion")
>>> dipole_obs[0] # x-component of D
(
    0.4781123173263876 * Z(0)
  + 0.4781123173263876 * Z(1)
  + -0.3913638489489803 * (Y(0) @ Z(1) @ Y(2))
  + -0.3913638489489803 * (X(0) @ Z(1) @ X(2))
  + -0.3913638489489803 * (Y(1) @ Z(2) @ Y(3))
  + -0.3913638489489803 * (X(1) @ Z(2) @ X(3))
  + 0.2661114704527088 * (Y(0) @ Z(1) @ Z(2) @ Z(3) @ Y(4))
  + 0.2661114704527088 * (X(0) @ Z(1) @ Z(2) @ Z(3) @ X(4))
  + 0.2661114704527088 * (Y(1) @ Z(2) @ Z(3) @ Z(4) @ Y(5))
  + 0.2661114704527088 * (X(1) @ Z(2) @ Z(3) @ Z(4) @ X(5))
  + 0.7144779061810713 * Z(2)
  + 0.7144779061810713 * Z(3)
  + -0.11734958781031017 * (Y(2) @ Z(3) @ Y(4))
  + -0.11734958781031017 * (X(2) @ Z(3) @ X(4))
  + -0.11734958781031017 * (Y(3) @ Z(4) @ Y(5))
  + -0.11734958781031017 * (X(3) @ Z(4) @ X(5))
  + 0.24190977644645698 * Z(4)
  + 0.24190977644645698 * Z(5)
)