PAOFLOW.projection.upf_gaussfit#

upf_gaussfit — Gaussian fitting of UPF radial pseudo-wavefunctions.

This module fits the radial pseudo-wavefunctions \(\chi_{nl}(r)\) stored in Quantum ESPRESSO UPF pseudopotential files (versions 1 and 2) with contracted Gaussian-type orbital (cGTO) expansions. The resulting basis is used by the ACBN0 and eACBN0 workflows, where two-electron Coulomb repulsion integrals computed in pyints require analytic GTO representations of the projector functions.

Fitting procedure#

For each pseudo-wavefunction labelled \(n l\) the radial part is approximated as

\[\chi_{nl}^\text{GTO}(r) = \sum_{j=1}^{N_\zeta} c_j\, r^l\, e^{-\zeta_j r^2}, \qquad \zeta_j = \alpha / \beta^{j-1}\]

where \((\alpha, \beta)\) control the geometric spacing of the exponents and \(c_j\) are the contraction coefficients. The two- parameter exponential progression means only \(N_\zeta + 2\) free parameters are needed regardless of the contraction length.

The fit minimises the least-squares residual \(\sum_r [\chi_{nl}^\text{ref}(r) - r\, \chi_{nl}^\text{GTO}(r)]^2\) using either the Levenberg–Marquardt algorithm (fit() with least_squares=True, default) or conjugate-gradient minimisation. Starting from \(N_\zeta = 2\) the multiplicity is increased by one until the residual norm falls below threshold or \(N_\zeta = 5\).

Angular-momentum conventions#

Contraction coefficients output by build_basis_dict() and write_basis_file() are expressed in the cubic (real) harmonic basis with the following conventions for each \(l\):

  • \(l=0\) (s): single \((0,0,0)\) Cartesian GTO.

  • \(l=1\) (p): \(p_z, p_y, p_x\) in standard \((n_x,n_y,n_z)\) form.

  • \(l=2\) (d): \(d_{z^2}, d_{xz}, d_{yz}, d_{x^2-y^2}, d_{xy}\) as linear combinations of Cartesian GTOs (standard \(\sqrt{3}\) prefactors).

  • \(l=3\) (f): \(f_{z^3}, f_{xz^2}, f_{yz^2}, f_{z(x^2-y^2)}, f_{xyz}, f_{x(x^2-3y^2)}, f_{y(3x^2-y^2)}\) with appropriate prefactors.

These Cartesian tuples are consumed directly by contr_coulomb() to evaluate four-centre integrals.

Main entry point#

gaussian_fit()

Read a UPF file, fit every pseudo-wavefunction, and return the atomic number together with the full Cartesian-GTO basis dictionary. Automatically increments \(N_\zeta\) until convergence.

I/O helpers#

read_upf()

Parse the <PP_PSWFC> section of a UPF v1 or v2 XML file and return the radial grid, integration weights, labels, angular momenta, and wavefunction arrays.

read_atom_no_xml()

Extract the element symbol and atomic number from a UPF XML header.

write_basis_file()

Write the fitted basis to a Python-importable .py file containing a basis_data dict keyed by atomic number.

build_basis_dict()

Convert per-orbital coefficient/exponent lists to the nested Cartesian-GTO tuple structure expected by pyints.

Low-level fitting helpers#

gto()

Evaluate the contracted radial GTO \(\chi^\text{GTO}(r)\) for given exponent/coefficient parameters.

target() / target_squared()

Residual vector and sum-of-squares objective for scipy optimisers.

fit()

Fit a single pseudo-wavefunction channel with \(N_\zeta\) primitive Gaussians; returns coefficients, exponents, and an exit code.

Utilities#

spn_map

dict mapping element symbol → atomic number for Z = 1–112.

get_atom_no()

Look up atomic number from element symbol; raises if symbol unknown.

fact2()

Recursive double factorial \(n!!\) used in GTO normalisation.

Attributes#

Functions#

get_atom_no(n)

fact2(n)

gto(r, l, params)

target(params, r, rab, wfc, l)

target_squared(params, r, rab, wfc, l)

fit(nzeta, label, l, r, rab, wfc, threshold[, ...])

build_basis_dict(labels, ls, coefficients, exponents)

write_basis_file(fname, atom_no, labels, ls, ...)

read_atom_no_xml(upf_version, root)

read_upf(upf_version, root)

gaussian_fit(xml_file[, threshold])

Module Contents#

PAOFLOW.projection.upf_gaussfit.spn_map[source]#
PAOFLOW.projection.upf_gaussfit.get_atom_no(n)[source]#
PAOFLOW.projection.upf_gaussfit.fact2(n)[source]#
PAOFLOW.projection.upf_gaussfit.gto(r, l, params)[source]#
PAOFLOW.projection.upf_gaussfit.target(params, r, rab, wfc, l)[source]#
PAOFLOW.projection.upf_gaussfit.target_squared(params, r, rab, wfc, l)[source]#
PAOFLOW.projection.upf_gaussfit.fit(nzeta, label, l, r, rab, wfc, threshold, least_squares=True)[source]#
PAOFLOW.projection.upf_gaussfit.build_basis_dict(labels, ls, coefficients, exponents)[source]#
PAOFLOW.projection.upf_gaussfit.write_basis_file(fname, atom_no, labels, ls, coefficients, exponents)[source]#
PAOFLOW.projection.upf_gaussfit.read_atom_no_xml(upf_version, root)[source]#
PAOFLOW.projection.upf_gaussfit.read_upf(upf_version, root)[source]#
PAOFLOW.projection.upf_gaussfit.gaussian_fit(xml_file, threshold=0.5)[source]#