abtem.potentials.gpaw#

Module to handle ab initio electrostatic potentials from the DFT code GPAW.

Module Contents#

Classes#

GPAWParametrization

Calculate an Independent Atomic Model (IAM) potential based on a GPAW DFT calculation.

GPAWPotential

Calculate the electrostatic potential from a (set of) converged GPAW DFT calculation(s). Frozen phonons can be included either by specifying multiple GPAW calculators corresponding to the different phonon configurations, or approximately for a single calculator by using the frozen_phonons keyword.

Functions#

API#

class abtem.potentials.gpaw.GPAWParametrization(...)[source]#

Calculate an Independent Atomic Model (IAM) potential based on a GPAW DFT calculation.

Parameters:
  • nodes (int, optional) – Number of nodes used by the Hankel transform (hankel.SymmetricFourierTransform) that converts the all-electron radial charge density into an X-ray scattering factor. None (default) lets hankel choose automatically.

  • integration_step (float, optional) – Step size used by the Hankel transform. The default of 0.002 is fine for light elements, but is too coarse for heavier ones (e.g. In, Z=49), where it can produce a non-monotonic, unphysical scattering factor; 0.001 resolves this for most elements at negligible extra cost. The heaviest elements (e.g. Re, Z=75) may still show a several-percent-level mismatch against tabulated parametrizations even at this step size, plausibly from GPAW’s scalar-relativistic treatment diverging from whatever reference the tabulated parameters were fit to.

Initialization

charge(...)[source]#

Calculate the radial charge density for an atom.

Parameters:
  • symbol (str) – Chemical symbol of the atomic element.

  • charge (float, optional) – Charge the atom by the given fractional number of electrons.

Returns:

charge – Function of the radial charge density with parameter ‘r’ corresponding to the radial distance from the core.

Return type:

callable

potential(...)[source]#
scattering_factor(...)[source]#
x_ray_scattering_factor(...)[source]#
class abtem.potentials.gpaw.GPAWPotential(...)[source]#

Bases: abtem.potentials.iam._PotentialBuilder

Calculate the electrostatic potential from a (set of) converged GPAW DFT calculation(s). Frozen phonons can be included either by specifying multiple GPAW calculators corresponding to the different phonon configurations, or approximately for a single calculator by using the frozen_phonons keyword.

Parameters:
  • calculators ((list of) gpaw.calculator.GPAW or (list of) str) – GPAW calculator or path to GPAW calculator or list of calculators or paths. Atoms are read from the calculator.

  • gpts (one or two int, optional) – Number of grid points in x and y describing each slice of the potential. Provide either “sampling” (spacing between consecutive grid points) or “gpts” (total number of grid points).

  • sampling (one or two float, optional) – Sampling of the potential in x and y [1 / Å]. Provide either “sampling” or “gpts”.

  • slice_thickness (float or sequence of float, optional) – Thickness of the potential slices in the propagation direction in [Å] (default is 0.5 Å). If given as a float the number of slices is calculated by dividing the slice thickness into the z-height of supercell. The slice thickness may be given as a sequence of values for each slice, in which case an error will be thrown if the sum of slice thicknesses is not equal to the height of the atoms.

  • exit_planes (int or tuple of int, optional) – The exit_planes argument can be used to calculate thickness series. Providing exit_planes as a tuple of int indicates that the tuple contains the slice indices after which an exit plane is desired, and hence during a multislice simulation a measurement is created. If exit_planes is an integer a measurement will be collected every exit_planes number of slices.

  • plane (str or two tuples of three float, optional) – The plane relative to the provided atoms mapped to xy plane of the potential, i.e. provided plane is perpendicular to the propagation direction. If string, it must be a concatenation of two of ‘x’, ‘y’ and ‘z’; the default value ‘xy’ indicates that potential slices are cuts along the xy-plane of the atoms. The plane may also be specified with two arbitrary 3D vectors, which are mapped to the x and y directions of the potential. The length of the vectors has no influence. If the vectors are not perpendicular, the second vector is rotated in the plane to become perpendicular to the first. Providing a value of ((1., 0., 0.), (0., 1., 0.)) is equivalent to providing ‘xy’.

  • origin (three float, optional) – The origin relative to the provided Atoms mapped to the origin of the Potential. This is equivalent to translating the atoms. The default is (0., 0., 0.)

  • box (three float, optional) – The extent of the potential in x, y and z. If not given this is determined from the atoms’ cell. If the box size does not match an integer number of the atoms’ supercell, an affine transformation may be necessary to preserve periodicity, determined by the periodic keyword

  • periodic (bool) – If a transformation of the atomic structure is required, periodic determines how the atomic structure is transformed. If True (default), the periodicity of the Atoms is preserved, which may require applying a small affine transformation to the atoms. If False, the transformed potential is effectively cut out of a larger repeated potential, which may not preserve periodicity.

  • frozen_phonons (abtem.AbstractFrozenPhonons, optional) – Approximates frozen phonons for a single GPAW calculator by displacing only the nuclear core potentials. Supercedes the atoms from the calculator.

  • repetitions (tuple of int) – Repeats the atoms by integer amounts in the x, y and z directions before applying frozen phonon displacements to calculate the potential contribution of the nuclear cores. Necessary when using frozen phonons.

  • gridrefinement (int) – Necessary interpolation of the charge density into a finer grid for improved numerical precision. Allowed values are ‘2’ and ‘4’.

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

Initialization

property calculators#
property ensemble_axes_metadata: List[AxisMetadata]#
property ensemble_shape#
property frozen_phonons#
generate_slices(...)[source]#

Generate the slices for the potential.

Parameters:
  • first_slice (int, optional) – Index of the first slice of the generated potential.

  • last_slice (int, optional) – Index of the last slice of the generated potential.

Returns:

slices – Generator for the array of slices.

Return type:

generator of ndarray

property gridrefinement#
property num_configurations#
property num_frozen_phonons#
property repetitions#
abtem.potentials.gpaw.get_core_correction_interpolators(...)[source]#
abtem.potentials.gpaw.integrate_slice(...)[source]#