qml.qchem.diff_hamiltonian

diff_hamiltonian(mol, cutoff=1e-12, core=None, active=None)[source]

Return a function that computes the qubit Hamiltonian.

Parameters
  • mol (Molecule) – the molecule object

  • cutoff (float) – cutoff value for discarding the negligible electronic integrals

  • core (list[int]) – indices of the core orbitals

  • active (list[int]) – indices of the active orbitals

Returns

function that computes the qubit hamiltonian

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]
>>> h = diff_hamiltonian(mol)(*args)
>>> h.coeffs
array([ 0.29817879+0.j,  0.20813365+0.j,  0.20813365+0.j,
         0.17860977+0.j,  0.04256036+0.j, -0.04256036+0.j,
        -0.04256036+0.j,  0.04256036+0.j, -0.34724873+0.j,
         0.13290293+0.j, -0.34724873+0.j,  0.17546329+0.j,
         0.17546329+0.j,  0.13290293+0.j,  0.18470917+0.j])