abtem.integrals

Contents

abtem.integrals#

Module to describe projection integrals of radial potential parametrizations.

Module Contents#

Classes#

FieldIntegrator

Base class for projection integrator object used for calculating projection integrals of radial potentials.

GaussianProjectionIntegrals

param parametrization:

The correction radial potential parametrization to integrate. Used for correcting the dependence of the potential close to the nuclear core. Default is the Lobato parametrization.

type parametrization:

str or Parametrization, optional

param gaussian_parametrization:

The Gaussian radial potential parametrization to integrate. Must be parametrization described by a superposition of Gaussians. Default is the Peng parametrization.

type gaussian_parametrization:

str or Parametrization, optional

param cutoff_tolerance:

The error tolerance used for deciding the radial cutoff distance of the potential [eV / e]. Default is 1e-3.

type cutoff_tolerance:

float, optional

ProjectionIntegralTable

A ProjectionIntegrator calculating finite projections of radial potential parametrizations. An integral table for each used to evaluate the projection integrals for each atom in a slice given p integral limits. The projected potential evaluated along the

QuadratureProjectionIntegrals

Projection integration plan for calculating finite projection integrals based on Gaussian quadrature rule.

ScatteringFactorProjectionIntegrals

A FieldIntegrator calculating infinite projections of radial potential parametrizations. The hybrid real and reciprocal space method by Wouter Van den Broek et al. is used.

Functions#

correction_projected_scattering_factors

cutoff_taper

gaussian_projected_scattering_factors

gaussian_projection_weights

interpolate_radial_functions

optimize_cutoff

Calculate the point where a function becomes lower than a given tolerance within a given bracketing interval.

sinc

Returns an array representing a 2D sinc function centered at [0, 0]. The result is used to compensate for the finite size of single pixels used for representing delta functions.

superpose_deltas

Add superposition of delta functions at given positions to a 2D array.

API#

class abtem.integrals.FieldIntegrator(...)[source]#

Bases: abtem.core.utils.EqualityMixin, abtem.core.utils.CopyMixin

Base class for projection integrator object used for calculating projection integrals of radial potentials.

Parameters:
  • periodic (bool) – True indicates that the projection integrals are periodic perpendicular to the projection direction.

  • finite (bool) – True indicates that the projection integrals are finite along the projection direction.

  • retain_data (bool, optional) – If True, intermediate calculations are kept.

Initialization

abstract cutoff(...) float[source]#

Radial cutoff of the potential for the given chemical symbol.

property finite: bool#

True indicates that the created projection integrators are implemented only for infinite potential projections.

abstract integrate_on_grid(...) ndarray[source]#

Integrate radial potential between two limits at the given 2D positions on a grid. The integration limits are only used when the integration method is finite.

Parameters:
  • positions (ndarray) – 2D array of xy-positions of the centers of each radial function [Å].

  • a (ndarray) – Lower integration limit of the pr ojection integrals along z for each position [Å]. The limit is given relative to the center of the radial function.

  • b (ndarray) – Upper integration limit of the projection integrals along z for each position [Å]. The limit is given relative to the center of the radial function.

  • gpts (two int) – Number of grid points in x and y describing each slice of the potential.

  • sampling (two float) – Sampling of the potential in x and y [1 / Å].

  • device (str, optional) – The device used for calculating the potential, ‘cpu’ or ‘gpu’. The default is determined by the user configuration file.

property periodic: bool#

True indicates that the created projection integrators are implemented only for periodic potentials.

class abtem.integrals.GaussianProjectionIntegrals(...)[source]#

Bases: abtem.integrals.FieldIntegrator

Parameters:
  • parametrization (str or Parametrization, optional) – The correction radial potential parametrization to integrate. Used for correcting the dependence of the potential close to the nuclear core. Default is the Lobato parametrization.

  • gaussian_parametrization (str or Parametrization, optional) – The Gaussian radial potential parametrization to integrate. Must be parametrization described by a superposition of Gaussians. Default is the Peng parametrization.

  • cutoff_tolerance (float, optional) – The error tolerance used for deciding the radial cutoff distance of the potential [eV / e]. Default is 1e-3.

Initialization

property correction_parametrization#
cutoff(...) float[source]#
property cutoff_tolerance#

The error tolerance used for deciding the radial cutoff distance of the potential [eV / e].

property gaussian_parametrization#

The error tolerance used for deciding the radial cutoff distance of the potential [eV / e].

get_corrections(...)[source]#
get_gaussians(...)[source]#
integrate_on_grid(...) ndarray[source]#
class abtem.integrals.ProjectionIntegralTable(...)[source]#

A ProjectionIntegrator calculating finite projections of radial potential parametrizations. An integral table for each used to evaluate the projection integrals for each atom in a slice given p integral limits. The projected potential evaluated along the

Parameters:
  • radial_gpts (array) – The points along a radial in the xy-plane where the projection integrals of the integral table are evaluated.

  • limits (array) – The points along the projection direction where the projection integrals are evaluated.

Initialization

integrate(...) ndarray[source]#
property limits: ndarray#
property radial_gpts: ndarray#
property values: ndarray#
class abtem.integrals.QuadratureProjectionIntegrals(...)[source]#

Bases: abtem.integrals.FieldIntegrator

Projection integration plan for calculating finite projection integrals based on Gaussian quadrature rule.

Parameters:
  • parametrization (str or Parametrization, optional) – The potential parametrization describing the radial dependence of the potential. Default is ‘lobato’.

  • cutoff_tolerance (float, optional) – The error tolerance used for deciding the radial cutoff distance of the potential [eV / e]. Default is 1e-3.

  • taper (float, optional) – The fraction from the cutoff of the radial distance from the core where the atomic potential starts tapering to zero. Default is 0.85.

  • integration_step (float, optional) – The step size between integration limits used for calculating the integral table. Default is 0.02.

  • quad_order (int, optional) – Order of quadrature integration passed to scipy.integrate.fixed_quad. Default is 8.

Initialization

cutoff(...) float[source]#
property cutoff_tolerance: float#

The error tolerance used for deciding the radial cutoff distance of the potential [eV / e].

get_integral_table(...)[source]#

Build table of projection integrals of the radial atomic potential.

Parameters:
  • symbol (str) – Chemical symbol to build the integral table.

  • inner_limit (float, optional) – Smallest radius from the core at which to calculate the projection integral [Å].

Returns:

ProjectionIntegralTable

Return type:

projection_integral_table

integrate_on_grid(...) ndarray[source]#
property integration_step: float#

The step size between integration limits used for calculating the integral table.

property parametrization#

The potential parametrization describing the radial dependence of the potential.

property quad_order#

Order of quadrature integration.

property tables#
class abtem.integrals.ScatteringFactorProjectionIntegrals(...)[source]#

Bases: abtem.integrals.FieldIntegrator

A FieldIntegrator calculating infinite projections of radial potential parametrizations. The hybrid real and reciprocal space method by Wouter Van den Broek et al. is used.

Parameters:

parametrization (str or Parametrization, optional) – The radial potential parametrization to integrate. Default is the Lobato parametrization.

References

W. Van den Broek et al. Ultramicroscopy, 158:89-97, 2015. doi:10.1016/j.ultramic.2015.07.005.

Initialization

cutoff(...) float[source]#
get_scattering_factor(...)[source]#
integrate_on_grid(...)[source]#
property parametrization: Parametrization#
property scattering_factors: dict[str, ndarray]#

Projected scattering factor array on a 2D grid.

abtem.integrals.correction_projected_scattering_factors(...)[source]#
abtem.integrals.cutoff_taper(...)[source]#
abtem.integrals.gaussian_projected_scattering_factors(...)[source]#
abtem.integrals.gaussian_projection_weights(...)[source]#
abtem.integrals.interpolate_radial_functions(...)[source]#
abtem.integrals.optimize_cutoff(...) float[source]#

Calculate the point where a function becomes lower than a given tolerance within a given bracketing interval.

Parameters:
  • func (callable) – The function to calculate the cutoff for.

  • tolerance (float) – The tolerance to calculate the cutoff for.

  • a (float) – One end of the bracketing interval.

  • b (float) – The other end of the bracketing interval.

Returns:

cutoff

Return type:

float

abtem.integrals.sinc(...) ndarray[source]#

Returns an array representing a 2D sinc function centered at [0, 0]. The result is used to compensate for the finite size of single pixels used for representing delta functions.

Parameters:
  • gpts (two int) – Number of grid points in the first and second dimension to evaluate the sinc over.

  • sampling (two float) – Size of the pixels of the grid determining the scale of the sinc.

  • device (str) – The array is created on this device (‘cpu’ or ‘gpu’).

Returns:

sinc – 2D sinc function.

Return type:

ndarray

abtem.integrals.superpose_deltas(...) ndarray[source]#

Add superposition of delta functions at given positions to a 2D array.

Parameters:
  • positions (ndarray) – Array of 2D positions as an nx2 array. The positions are given in units of pixels.

  • array (ndarray) – The delta functions are added to this 2D array.

  • weights (ndarray, optional) – If given each delta function is weighted by the given factor. Must match the length of positions.

  • round_positions (bool, optional) – If True, the delta function positions are rounded to the center of the nearest pixel, otherwise subpixel precision is used.

Returns:

array – The array with the delta functions added.

Return type:

ndarray