class_docstr: Tests for overlap integrals
class_docstr_tok: ["Tests","for","overlap","integrals"]
docstr: Test that the overlap gradient computed with respect to the basis parameters is
  correct.
docstr_tok: ["Test","that","the","overlap","gradient","computed","with","respect","to","the","basis","parameters","is","correct","."]
code: def test_gradient_overlap(self, symbols, geometry, alpha, coeff):
      r"""Test that the overlap gradient computed with respect to the basis parameters is
      correct."""
      mol = qchem.Molecule(symbols, geometry, alpha=alpha, coeff=coeff)
      basis_a = mol.basis_set[0]
      basis_b = mol.basis_set[1]
      args = [mol.alpha, mol.coeff]
  
      g_alpha = qml.grad(
          qchem.overlap_integral(basis_a, basis_b), argnum=0
      )(*args)
      g_coeff = qml.grad(
          qchem.overlap_integral(basis_a, basis_b), argnum=1
      )(*args)
  
      # compute overlap gradients with respect to alpha and coeff using finite diff
      delta = 0.0001
      g_ref_alpha = np.zeros(6).reshape(alpha.shape)
      g_ref_coeff = np.zeros(6).reshape(coeff.shape)
  
      for i in range(len(alpha)):
          for j in range(len(alpha[0])):
              alpha_minus = alpha.copy()
              alpha_plus = alpha.copy()
              alpha_minus[i][j] = alpha_minus[i][j] - delta
              alpha_plus[i][j] = alpha_plus[i][j] + delta
              o_minus = qchem.overlap_integral(basis_a, basis_b)(
                  *[alpha_minus, coeff]
              )
              o_plus = qchem.overlap_integral(basis_a, basis_b)(
                  *[alpha_plus, coeff]
              )
              g_ref_alpha[i][j] = (o_plus - o_minus) / (2 * delta)
  
              coeff_minus = coeff.copy()
              coeff_plus = coeff.copy()
              coeff_minus[i][j] = coeff_minus[i][j] - delta
              coeff_plus[i][j] = coeff_plus[i][j] + delta
              o_minus = qchem.overlap_integral(basis_a, basis_b)(
                  *[alpha, coeff_minus]
              )
              o_plus = qchem.overlap_integral(basis_a, basis_b)(
                  *[alpha, coeff_plus]
              )
              g_ref_coeff[i][j] = (o_plus - o_minus) / (2 * delta)
  
      assert np.allclose(g_alpha, g_ref_alpha)
      assert np.allclose(g_coeff, g_ref_coeff)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane import qchem
label_desc: Use image node_id 3 for calling the TestOverlap obj's underlying member method code with example usage: obj.test_gradient_overlap(symbols, geometry, alpha, coeff) without return types