netket.experimental.operator.from_pyscf_molecule

netket.experimental.operator.from_pyscf_molecule#

class netket.experimental.operator.from_pyscf_molecule[source]#

Bases:

Construct a netket operator encoding the electronic hamiltonian of a pyscf molecule in a chosen orbital basis.

Example

Constructs the hamiltonian for a Li-H molecule, using the sto-3g basis and the default Hartree-Fock molecular orbitals.

>>> from pyscf import gto, scf, fci
>>> import netket as nk; import netket.experimental as nkx
>>>
>>> bond_length = 1.5109
>>> geometry = [('Li', (0., 0., -bond_length/2)), ('H', (0., 0., bond_length/2))]
>>> mol = gto.M(atom=geometry, basis='STO-3G')
>>>
>>> mf = scf.RHF(mol).run()  
    converged SCF energy = -7.86338...
>>> E_hf = sum(mf.scf_summary.values())
>>>
>>> E_fci = fci.FCI(mf).kernel()[0]
>>>
>>> ha = nkx.operator.from_pyscf_molecule(mol)  
    converged SCF energy = -7.86338...
>>> E0 = float(nk.exact.lanczos_ed(ha))
>>> print(f"{E0 = :.5f}, {E_fci = :.5f}")
E0 = -7.88253, E_fci = -7.88253

Example

Constructs the hamiltonian for a Li-H molecule, using the sto-3g basis and the Boys orbitals using Boys.

>>> from pyscf import gto, scf, lo
>>> import netket as nk; import netket.experimental as nkx
>>>
>>> bond_length = 1.5109
>>> geometry = [('Li', (0., 0., -bond_length/2)), ('H', (0., 0., bond_length/2))]
>>> mol = gto.M(atom=geometry, basis='STO-3G')
>>>
>>> # compute the boys orbitals
>>> mf = scf.RHF(mol).run()  
    converged SCF energy = -7.86338...
>>> mo_coeff = lo.Boys(mol).kernel(mf.mo_coeff)
>>> # use the boys orbitals to construct the netket hamiltonian
>>> ha = nkx.operator.from_pyscf_molecule(mol, mo_coeff=mo_coeff)
Parameters:
  • molecule – The pyscf Mole object describing the Hamiltonian

  • mo_coeff (Optional[ndarray]) – The molecular orbital coefficients determining the linear combination of atomic orbitals to produce the molecular orbitals. If unspecified this defaults to the hartree fock orbitals computed using HF.

  • cutoff (float) – Ignores all matrix elements in the V and T matrix that have magnitude less than this value. Defaults to \(10^{-11}\)

  • implementation (DiscreteOperator) – The particular implementation to use for the operator. Different fermionic operator implementation might have different performances. Defaults to netket.experimental.operator.FermionOperator2nd (this might change in the future).

Return type:

DiscreteOperator

Returns:

A netket second quantised operator that encodes the electronic hamiltonian.