qstack.spahm.LB2020guess

Laikov-Briling 2020 guess Hamiltonian implementation.

class qstack.spahm.LB2020guess.LB2020guess(fname=None, parameters='HF')[source]

Bases: object

Laikov-Briling 2020 guess Hamiltonian implementation.

Reference:

D. N. Laikov, K. R. Briling, “Atomic effective potentials for starting molecular electronic structure calculations”, Theor. Chem. Acc. 139, 17 (2020), doi:10.1007/s00214-019-2521-3

Implements the atomic effective potential method for initial guess generation. See https://github.com/briling/aepm for a C implementation.

HLB20(mol)[source]

Compute the LB2020 effective potential matrix.

Parameters:

mol (pyscf.gto.Mole) – Molecule object.

Returns:

LB2020 potential matrix in AO basis (nao x nao).

Return type:

numpy.ndarray

HLB20_generator(mol)[source]

Create generator for LB2020 potential gradient contributions.

Parameters:

mol (pyscf.gto.Mole) – Molecule object.

Returns:

Function that takes atom index and returns LB2020 potential

gradient as numpy.ndarray of shape (3, nao, nao).

Return type:

callable

HLB20_ints_generator(mol, auxmol)[source]

Create generator for LB2020 potential gradients.

Computes derivative integrals and returns a function that evaluates the gradient of LB2020 potential with respect to atomic positions.

Parameters:
  • mol (pyscf.gto.Mole) – Molecule object.

  • auxmol (pyscf.gto.Mole) – Auxiliary molecule object.

Returns:

Function that takes atom index and returns gradient integrals

as numpy.ndarray of shape (3, nao, nao, naux).

Return type:

callable

Heff(mol)[source]

Construct one-electron Hamiltonian for initial guess.

Combines standard core Hamiltonian with LB2020 effective potential.

Parameters:

mol (pyscf.gto.Mole) – Molecule object.

Returns:

Effective Hamiltonian matrix in AO basis (nao x nao).

Return type:

numpy.ndarray

add_caps(basis)[source]

Add cap (diffuse) functions to the auxiliary basis.

Parameters:

basis (dict) – Basis set dictionary to modify in-place.

Output:

Modifies basis in-place.

check_coefficients(mol, acbasis)[source]

Validate that auxiliary basis coefficients sum to correct total charge.

Ensures basis set modifications (charge adjustment, ECP) maintain consistency with molecular electronic structure.

Parameters:
  • mol (pyscf.gto.Mole) – Molecule object.

  • acbasis (dict) – Auxiliary basis set dictionary.

Raises:

RuntimeError – If coefficient sum doesn’t match expected charge.

get_auxweights(auxmol)[source]

Extract auxiliary basis weights from the basis.

Collects the coefficients from each auxiliary basis primitive into a single array aligned with auxiliary orbital indices.

Parameters:

auxmol (pyscf.gto.Mole) – Molecule object with auxiliary basis.

Returns:

Array of auxiliary basis function weights (length nao).

Return type:

numpy.ndarray

get_basis(fname, parameters)[source]

Initialize auxiliary basis set from file or predefined parameters.

Loads basis set from either predefined HF/HFS parameters or custom file, then adds cap functions and stores in self.acbasis.

Parameters:
  • fname (str, optional) – Path to custom parameter file.

  • parameters (str) – Parameter set to use (‘HF’, ‘HFS’, or None for custom file).

get_eri3c(mol, auxmol)[source]

Compute 3-center electron repulsion integrals.

Parameters:
  • mol (pyscf.gto.Mole) – Main molecule object.

  • auxmol (pyscf.gto.Mole) – Auxiliary molecule object.

Returns:

3-center ERIs (ij|P) where i,j are primary AO indices

and P is auxiliary basis index.

Return type:

numpy.ndarray

init_data()[source]

Set parameters.

  • self._caps_array: Diffuse function exponents for each element.

  • self._hf_basis: Predefined HF parameter set for all elements.

  • self._hfs_basis: Predefined HFS parameter set for all elements.

merge_caps(w, eri3c)[source]

Contracts 3-center integrals with auxiliary basis weights.

PySCF internally renormalizes basis functions, thus ignores the charge normalization of the auxiliary basis, and the weights must be used directly later.

Parameters:
  • w (numpy.ndarray) – Auxiliary basis weights.

  • eri3c (numpy.ndarray) – 3-center electron repulsion integrals (ij|P).

Returns:

Contracted integrals (ij) = sum_P w_P * (ij|P).

Return type:

numpy.ndarray

read_ac(fname)[source]

Read auxiliary basis parameters from file.

Parameters:

fname (str, optional) – Path to parameter file. If None, uses default.

Returns:

Dictionary mapping element symbols to lists of basis function

parameters [[l, [exponent, coefficient]], …].

Return type:

dict

renormalize(a)[source]

Compute renormalization factor for Gaussian basis functions.

The auxiliary basis functions are given in charge normalization, thus we need to renormalize them to square-integral normalization for use in integrals.

1/norm1 = int exp(-a*r^2) d^3 r => norm1 = (a/pi)^(3/2) 1/norm2^2 = int (exp(-a*r^2))^2 d^3 r => norm2 = (2.0*a/pi)^(3/4) coefficient = norm1 / norm2 = (0.5*a/pi)^(3/4)

Parameters:

a (float) – Gaussian exponent.

Returns:

Renormalization factor (0.5*a/pi)^(3/4).

Return type:

float

use_charge(mol)[source]

Adjust basis coefficients based on molecular charge.

For charged molecules with HF parameters, scales the cap function coefficient to account for charge redistribution.

Parameters:

mol (pyscf.gto.Mole) – pyscf Mole object.

Returns:

Adjusted auxiliary basis set for molecule’s elements.

Return type:

dict

use_ecp(mol, acbasis)[source]

Adjust basis set to account for effective core potentials (ECP).

When ECP is present, removes basis functions corresponding to core electrons by reducing coefficients proportionally until core charge is accounted for.

Parameters:
  • mol (pyscf.gto.Mole) – pyscf Mole object potentially with ECP.

  • acbasis (dict) – Auxiliary basis set dictionary.

Returns:

Adjusted auxiliary basis set with core electrons removed if ECP present.

Return type:

dict