class netket.experimental.operator.pyscf.TV_from_pyscf_molecule[source]#


Computes the nuclear repulsion energy \(E_{nuc}\), and the T and V tensors encoding the 1-body and 2-body terms in the electronic hamiltonian of a pyscf molecule using the specified molecular orbitals.

The tensors returned correspond to the following expressions:

\[\hat{H} = E_{nuc} + \sum_{ij} T_{ij} \hat{c}^\dagger_i\hat{c}_j + \sum_{ijkl} V_{ijkl} \hat{c}^\dagger_i\hat{c}_\dagger_j\hat{c}_k\hat{c}_l\]

The electronic spin degree of freedom is encoded following the NetKet convention where the first \(N_{\downarrow}\) values of the indices \(i,j,k,l\) represent the spin down electrons, and the following \(N_{\uparrow}\) values represent the spin up.


In the netket.experimental.operator.pyscf module you can find some utility functions to convert from normal ordering to other orderings, but those are all internals so if you need them do copy-paste them somewhere else.


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

>>> from pyscf import gto, scf, lo
>>> import netket as nk; import netket.experimental as nkx
>>> geometry = [('Li', (0., 0., -1.5109/2)), ('H', (0., 0., 1.5109/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)
>>> ha = nkx.operator.pyscf.TV_from_pyscf_molecule(mol, mo_coeff)
  • molecule – The pyscf Mole object describing the Hamiltonian

  • mo_coeff (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}\)


a scalar and two numpy arrays, the first with 2 dimensions and the latter with 4 dimensions.

Return type: