qml.qchem.dipole_moment¶
- dipole_moment(mol, cutoff=1e-16, core=None, active=None, mapping='jordan_wigner')[source]¶
Return a function that computes the qubit dipole moment observable.
The dipole operator in the second-quantized form is
ˆD=−∑pqdpq[ˆc†p↑ˆcq↑+ˆc†p↓ˆcq↓]−ˆDc+ˆDn,where the matrix elements dpq are given by the integral of the position operator ˆr over molecular orbitals ϕ
dpq=∫ϕ∗p(r)ˆrϕq(r)dr,and ˆc† and ˆc are the creation and annihilation operators, respectively. The contribution of the core orbitals and nuclei are denoted by ˆDc and ˆDn, respectively, which are computed as
ˆDc=2Ncore∑i=1dii,and
ˆDn=Natoms∑i=1ZiRi,where Zi and Ri denote, respectively, the atomic number and the nuclear coordinates of the i-th atom of the molecule.
The fermonic dipole operator is then transformed to the qubit basis which gives
ˆD=∑jcjPj,where cj is a numerical coefficient and Pj is a ternsor product of single-qubit Pauli operators X,Y,Z,I.
- Parameters
mol (Molecule) – the molecule object
cutoff (float) – cutoff value for discarding the negligible dipole moment integrals
core (list[int]) – indices of the core orbitals
active (list[int]) – indices of the active orbitals
mapping (str) – Specifies the transformation to map the fermionic dipole operator to the Pauli basis. Input values can be
'jordan_wigner'
,'parity'
or'bravyi_kitaev'
.
- Returns
function that computes the qubit dipole moment observable
- Return type
function
Example
>>> symbols = ['H', 'H'] >>> geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]], requires_grad = False) >>> alpha = np.array([[3.42525091, 0.62391373, 0.1688554], >>> [3.42525091, 0.62391373, 0.1688554]], requires_grad=True) >>> mol = qml.qchem.Molecule(symbols, geometry, alpha=alpha) >>> args = [alpha] >>> dipole_moment(mol)(*args)[2].ops [I(0), Z(0), Y(0) @ Z(1) @ Y(2), X(0) @ Z(1) @ X(2), Z(1), Y(1) @ Z(2) @ Y(3), X(1) @ Z(2) @ X(3), Z(2), Z(3)]