horton_part.core.basis module
Module for handling basis functions used in GISA and LISA schemes.
- class AnalyticBasisFuncHelper(initials, *args, **kwargs)
Bases:
BasisFuncHelper
Analytic basis function helper class.
- __init__(initials, *args, **kwargs)
- compute_proatom_dens(number, populations, points, nderiv=0)
Compute pro-atom density on points for an atom.
- compute_proshell_dens(number, ishell, population, points, nderiv=0)
Compute pro-shell density on points for an atom.
- get_initial(number, ishell=None)
Get initial value for an atom for its ishell basis function.
- get_nshell(number)
Get number of basis functions based on the atomic number of an atom.
- property initials
A dictionary mapping atomic numbers to their initial values.
- class BasisFuncHelper(initials, *args, **kwargs)
Bases:
object
Base of basis function helper.
- __init__(initials, *args, **kwargs)
- compute_proatom_dens(number, populations, points, nderiv=0)
Compute pro-atom density on points for an atom.
- compute_proshell_dens(number, ishell, population, points, nderiv=0)
Compute pro-shell density on points for an atom.
- get_initial(number, ishell=None)
Get initial value for an atom for its ishell basis function.
- get_nshell(number)
Get number of basis functions based on the atomic number of an atom.
- property initials
A dictionary mapping atomic numbers to their initial values.
- class ExpBasisFuncHelper(exponents_orders, exponents=None, initials=None)
Bases:
AnalyticBasisFuncHelper
A helper class for handling basis functions in GISA and LISA methods.
This class provides functionalities to load and access parameters of basis functions used in GISA and LISA methods. It supports operations for different atoms characterized by atomic numbers, and allows computations of densities and other properties at specified points in space.
- __init__(exponents_orders, exponents=None, initials=None)
- compute_proatom_dens(number, populations, points, nderiv=0)
Compute pro-atom density on points for an atom.
- compute_proshell_dens(number, ishell, population, points, nderiv=0)
Compute pro-shell density on points for an atom.
- property exponents
A dictionary mapping atomic numbers to their exponents.
- classmethod from_file(filename)
Construct class from a file.
- classmethod from_function_type(func_type='gauss')
Construct class from basis type.
- classmethod from_json(filename)
Construct from a yaml file.
- classmethod from_yaml(filename)
Construct from a yaml file.
- get_exponent(number, ishell=None)
Get exponent coefficient for an atom for its ishell basis function.
- get_initial(number, ishell=None)
Get initial value for an atom for its ishell basis function.
- get_nshell(number)
Get number of basis functions based on the atomic number of an atom.
- get_order(number, ishell=None)
Get exponent order for an atom for its ishell basis function.
- property initials
A dictionary mapping atomic numbers to their initial values.
- property orders
A dictionary mapping atomic numbers to their exponential orders.
- class NumericBasisFuncHelper(splines_dict, initials)
Bases:
BasisFuncHelper
Numerical basis function helper class.
- __init__(splines_dict, initials)
- compute_proatom_dens(number, populations, points, nderiv=0)
Compute pro-atom density on points for an atom.
- compute_proshell_dens(number, ishell, population, points, nderiv=0)
Compute pro-shell density on points for an atom.
- classmethod from_file(filename, nrad=150)
- classmethod from_function_type(func_type='gauss_num', nrad=150)
Construct class from basis type.
- get_initial(number, ishell=None)
Get initial value for an atom for its ishell basis function.
- get_nshell(number)
Get number of basis functions based on the atomic number of an atom.
- property initials
A dictionary mapping atomic numbers to their initial values.
- property splines_dict
Return splines dict.
- evaluate_function(n, population, alpha, r, nderiv=0, axis=None)
Evaluate a general function and its derivative, with support for vectorized operations.
This function calculates a custom mathematical function \(f(\mathbf{r})\) and optionally its derivative, given certain parameters. The calculation can be vectorized over multiple values of \(n\), \(\text{population}\), and \(\alpha\).
The function is defined as:
\[f(\mathbf{r}) = N(\alpha, n) \exp(-\alpha |\mathbf{r}|^n)\]where \(N(\alpha, n)\) is a normalization factor ensuring the integral of \(f\) over all space equals 1. The derivative of \(f\) with respect to \(r\) is also provided.
The normalization factor can be obtained as follows:
\[ \begin{align}\begin{aligned}\int N(\alpha, n) f(\mathbf{r}) d\mathbf{r} = 4 \pi * \int_0^{\infty} r^2 \exp^{-\alpha r^n} = 1\\N(\alpha, n) = \frac{n \alpha^{3/n}}{4 \pi \Gamma(3/n)}\end{aligned}\end{align} \]where N(α, n) is a normalization factor ensuring the integral of f over all space equals 1.
For Slater function, i.e., \(n=1\), the normalization factor is
\[N(\alpha, 1) = \frac{\alpha^3}{8 \pi}\]For Gaussian function, \(n=2\), the normalization factor is
\[N(\alpha, 2) = (\frac{\alpha}{\pi})^{3/2}\]The derivative of function f w.r.t the \(|r|\) is defined as:
\[\frac{\partial{f(\mathbf{r})}}{\partial{r}} = - n r^{n-1} \alpha f(\mathbf{r})\]- Parameters:
n (float or np.ndarray) – Order, positive. Scalar or 1D array.
population (float) – Constant representing population.
alpha (float or np.ndarray) – Exponential coefficient. Scalar or 1D array matching n.
r (np.ndarray) – Points. 1D array.
nderiv (int, optional) – The order of derivative. Currently supports 0 (function) and 1 (first derivative).
axis (int, optional) – The axis of the array to sum. Applicable if n, alpha are arrays.
- Returns:
f (np.ndarray) – Function values at points r.
df (np.ndarray, optional) – Derivative of function at points r, if nderiv == 1.
- load_params(filename, extension='json')
Loads parameters from a JSON or YAML file.
The function reads a file specified by the filename, which can be in JSON or YAML format, and extracts orders, exponents, and initial values for different elements based on their atomic numbers.
- Parameters:
filename (str) – The path to the file containing the parameters in JSON or YAML format.
extension (str, optional) – The format of the file, either ‘json’ or ‘yaml’. Default is ‘json’.
- Returns:
A tuple containing three dictionaries: orders, exponents, and initials. Each dictionary maps an atomic number (int) to its corresponding numpy array values (orders, exponents, and initials).
- Return type:
tuple of dict