qml.qchem.attraction_matrix

attraction_matrix(basis_functions, charges, r)[source]

Return a function that computes the electron-nuclear attraction matrix for a given set of basis functions.

Parameters
  • basis_functions (list[BasisFunction]) – basis functions

  • charges (list[int]) – nuclear charges

  • r (array[float]) – nuclear positions

Returns

function that computes the electron-nuclear attraction matrix

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]
>>> attraction_matrix(mol.basis_set, mol.nuclear_charges, mol.coordinates)(*args)
array([[-2.03852057, -1.60241667], [-1.60241667, -2.03852057]])