PySCF Electronic Analyzers

An analyzer binds a molecule, density matrix, molecular orbitals, occupations, orbital energies, and atom-centered grid. It evaluates and caches quantities used in model construction, including the density, kinetic-energy density, Hartree and exchange energy densities, and orbital-resolved responses.

ciderpress.pyscf.analyzers.RHFAnalyzer stores a restricted state, and ciderpress.pyscf.analyzers.UHFAnalyzer stores separate alpha and beta states. from_calc creates an analyzer from a completed PySCF calculation. dump and load preserve the molecule, grid specification, orbitals, density matrix, and cached arrays in HDF5.

The descriptor workflow is described in Inspecting Densities and Descriptors.

class ciderpress.pyscf.analyzers.ElectronAnalyzer(mol, dm, grids_level=3, mo_occ=None, mo_coeff=None, mo_energy=None, grid_spec=None)

A class for generating and storing data derived from a PySCF electronic structure calculation, in particular distributions on a real-space grid such as the density, exchange (correlation) energy density, Coulomb energy density, etc.

calculate_vxc(xcname, xcfunc=None, grids=None, xctype='MGGA')

Computes the XC potential matrix for a functional, store it, and return it.

Parameters:
  • xcname (str) – XC functional

  • xcfunc (callable) – XC function in case one wants to use an XC functional not in libxc

  • grids (optional) – Grid to use to calculate XC.

Returns:

XC potential matrix

Return type:

vxc (nspin x nao x nao)

calculate_vxc_on_mo(xcname, orbs=None, **kwargs)

Compute contributions of XC potential to the eigenvalues. If VXC_{xcname} is not in _data, calculate_vxc is called first.

Parameters:
  • xcname (str) – Name of XC functional (for libxc)

  • orbs – Orbital index dictionary for computing orbital derivatives, in the format use for descriptors.get_descriptors.

  • **kwargs – extra arguments to pass to calculate_vxc, if it is called.

Returns:

eigenvalue contributions. If orbs is provided, it will be in

the same format used by descritpors.get_descriptors. Otherwise, it will be a numpy array with all the eigenvalue contributions.

dump(fname)

Dump self to an hdf5 file called fname.

Parameters:

fname (str) – Name of file to dump to

static from_calc(calc, grids_level=None, store_energy_orig=True, grid_spec=None)

NOTE: This has side effects on calc, see notes below.

Parameters:
  • calc – SCF object from PySCF

  • grids_level – Size of PySCF grids for XC integration

  • store_energy_orig – Whether to store original xc energy.

Returns:

analyzer constructed from calc

Return type:

ElectronAnalyzer

static load(fname)

Load instance of cls from hdf5

Parameters:

fname (str) – Name of file from which to load

class ciderpress.pyscf.analyzers.RHFAnalyzer(mol, dm, grids_level=3, mo_occ=None, mo_coeff=None, mo_energy=None, grid_spec=None)
get_ee_energy_density()

Returns the sum of E_{Ha} and E_{X}, i.e. the Coulomb repulsion energy of the HF or KS Slater determinant.

get_rs(term, omega, tol=1e-09)

Function for accessing range-separated data from _data Finds match based on a tolerance, in case rounding issues arise with floats.

get_xc(xcname)

Function for accessing XC functional data from _data

get_xc_energy(xcname)

Store and return the XC energy for the functional given by xcname

ciderpress.pyscf.analyzers.RKSAnalyzer

alias of RHFAnalyzer

class ciderpress.pyscf.analyzers.UHFAnalyzer(mol, dm, grids_level=3, mo_occ=None, mo_coeff=None, mo_energy=None, grid_spec=None)
ciderpress.pyscf.analyzers.UKSAnalyzer

alias of UHFAnalyzer