3.5.1. horton.grid.atgrid – Atomic grids

class horton.grid.atgrid.AtomicGrid(number, pseudo_number, center, agspec=’medium’, random_rotate=True, points=None)

Bases: horton.grid.base.IntGrid

Arguments:

number
The element number for which this grid will be used.
pseudo_number
The effective core charge for which this grid will be used.
center
The center of the radial grid

Optional arguments:

agspec
A specifications of the atomic grid. This can either be an instance of the AtomicGridSpec object, or the first argument of its constructor.
random_rotate
When set to False, the random rotation of the grid points is disabled. Such random rotation improves the accuracy of the integration, but leads to small random changes in the results that are not reproducible.
points
Array to store the grid points
__init__(number, pseudo_number, center, agspec=’medium’, random_rotate=True, points=None)

Arguments:

number
The element number for which this grid will be used.
pseudo_number
The effective core charge for which this grid will be used.
center
The center of the radial grid

Optional arguments:

agspec
A specifications of the atomic grid. This can either be an instance of the AtomicGridSpec object, or the first argument of its constructor.
random_rotate
When set to False, the random rotation of the grid points is disabled. Such random rotation improves the accuracy of the integration, but leads to small random changes in the results that are not reproducible.
points
Array to store the grid points
eval_decomposition(*args, **kwargs)

Evaluate a spherical decomposition

Arguments:

cubic_splines
A list cubic splines, where each item is a radial function that is associated with a corresponding real spherical harmonic.
center
The center of the spherically symmetric function
output
The output array

Optional arguments:

cell
A unit cell when periodic boundary conditions are used.
eval_spline(*args, **kwargs)

Evaluate a spherically symmetric function

Arguments:

cubic_spline
A cubic spline with the radial dependence
center
The center of the spherically symmetric function
output
The output array

Optional arguments:

cell
A unit cell when periodic boundary conditions are used.
get_spherical_average(*args, **kwargs)

Computes the spherical average of the product of the given functions

Arguments:

data1, data2, …

All arguments must be arrays with the same size as the number of grid points. The arrays contain the functions, evaluated at the grid points.

Optional arguments:

grads
A list of gradients of data1, data2, … When given, the derivative of the spherical average is also computed.
get_spherical_decomposition(*args, **kwargs)

Returns the decomposition of the product of the given functions in spherical harmonics

Arguments:

data1, data2, …
All arguments must be arrays with the same size as the number of grid points. The arrays contain the functions, evaluated at the grid points.

Optional arguments:

lmax=0
The maximum angular momentum to consider when computing multipole moments.

Remark

A series of radial functions is returned as CubicSpline objects. These radial functions are defined as:

\[f_{\ell m}(r) = \int f(\mathbf{r}) Y_{\ell m}(\mathbf{r}) d \Omega\]

where the integral is carried out over angular degrees of freedom and \(Y_{\ell m}\) are real spherical harmonics. The radial functions can be used to reconstruct the original integrand as follows:

\[f(\mathbf{r}) = \sum_{\ell m} f_{\ell m}(|\mathbf{r}|) Y_{\ell m}(\mathbf{r})\]

One can also derive the pure multipole moments by integrating these radial functions as follows:

\[Q_{\ell m} = \sqrt{\frac{4\pi}{2\ell+1}} \int_0^\infty f_{\ell m}(r) r^l r^2 dr\]

(These multipole moments are equivalent to the ones obtained with option mtype==2 of the integrate method).

integrate(*args, **kwargs)

Integrate the product of all arguments

Arguments:

data1, data2, …
All arguments must be arrays with the same size as the number of grid points. The arrays contain the functions, evaluated at the grid points, that must be multiplied and integrated.

Optional arguments:

center=None
When given, multipole moments are computed with respect to this center instead of a plain integral.
lmax=0
The maximum angular momentum to consider when computing multipole moments
mtype=1
The type of multipole moments: 1=“cartesian“, 2=“pure“, 3=“radial“, 4=“surface“.
segments=None
This argument can be used to divide the grid in segments. When given, it must be an array with the number of grid points in each consecutive segment. The integration is then carried out over each segment separately and an array of results is returned. The sum over all elements gives back the total integral.
zeros()
center

The center of the grid.

lmaxs

The maximum angular momentum supported at each sphere.

nlls

The number of Lebedev-Laikov grid points at each sphere.

nsphere

The number of spheres in the grid.

number

The element number of the grid.

points

The grid points.

random_rotate

The random rotation flag.

rgrid

The radial integration grid

shape

The shape of the grid.

size

The size of the grid.

subgrids

A list of grid objects used to construct this grid.

weights

The grid weights.

class horton.grid.atgrid.AtomicGridSpec(definition=’medium’)

Bases: object

Optional argument:

definition

A definition of the grid.

This can be a string that can be interpreted in several ways to define the grids. Attempts to interpret the string are done in the following order:

  1. A local file that has the same format as the files in ${HORTONDATA}/grids.
  2. It can be any of ‘coarse’, ‘medium’, ‘fine’, ‘veryfine’, ‘ultrafine’, ‘insane’. These have a straightforward one-to-one mapping with the files in ${HORTONDATA}/grids.
  3. It can be the name of a file in ${HORTONDATA}/grids (without the extension .txt
  4. A string of the format: rname:rmin:rmax:nrad:nll, with the following meaning for the keywords. rname specifies the type of radial grid. It can be linear, exp or power. rmin and rmax specify the first and the last radial grid point in angstroms. nrad is the number of radial grid points. nll is the number of points for the angular Lebedev-Laikov grid.

Instead of a string, a Pythonic grid specification is also supported:

  • A tuple (rgrid, nll), where rgrid is an instance of RadialGrid and nll is an integer or a list of integers. The same grid is then used for each element.
  • A list where each element is a tuple of the form (number, pseudo_number, rgrid, nll), where number is the element number, pseudo_number is the effective core charge, rgrid is an instance of RadialGrid and nll is an integer or a list of integers. In this case, each element has its own grid specification. When using pseudo potentials, the most appropriate grid can be selected, depending on the effective core charge.
__init__(definition=’medium’)

Optional argument:

definition

A definition of the grid.

This can be a string that can be interpreted in several ways to define the grids. Attempts to interpret the string are done in the following order:

  1. A local file that has the same format as the files in ${HORTONDATA}/grids.
  2. It can be any of ‘coarse’, ‘medium’, ‘fine’, ‘veryfine’, ‘ultrafine’, ‘insane’. These have a straightforward one-to-one mapping with the files in ${HORTONDATA}/grids.
  3. It can be the name of a file in ${HORTONDATA}/grids (without the extension .txt
  4. A string of the format: rname:rmin:rmax:nrad:nll, with the following meaning for the keywords. rname specifies the type of radial grid. It can be linear, exp or power. rmin and rmax specify the first and the last radial grid point in angstroms. nrad is the number of radial grid points. nll is the number of points for the angular Lebedev-Laikov grid.

Instead of a string, a Pythonic grid specification is also supported:

  • A tuple (rgrid, nll), where rgrid is an instance of RadialGrid and nll is an integer or a list of integers. The same grid is then used for each element.
  • A list where each element is a tuple of the form (number, pseudo_number, rgrid, nll), where number is the element number, pseudo_number is the effective core charge, rgrid is an instance of RadialGrid and nll is an integer or a list of integers. In this case, each element has its own grid specification. When using pseudo potentials, the most appropriate grid can be selected, depending on the effective core charge.
classmethod from_hdf5(grp)
get(number, pseudo_number)
get_size(number, pseudo_number)

Get the size of an atomic grid for a given element

Arguments:

number
The element number
pseudo_number
The effective core charge
to_hdf5(grp, selection=None)
horton.grid.atgrid.get_rotation_matrix(axis, angle)

Rodrigues’ rotation formula

horton.grid.atgrid.get_random_rotation()

Return a random rotation matrix