abtem.magnetism.gpaw#
Module Contents#
Classes#
Bundles the electrostatic potential, magnetic vector potential and (optionally) magnetic field built from the same GPAW calculator(s) by gpaw_magnetic_fields. |
|
Functions#
Build the electrostatic potential, magnetic vector potential and (optionally) magnetic field from the same GPAW calculator(s) in one call. |
|
Rotate a 3D vector field defined on a grid using Euler angles. |
API#
- class abtem.magnetism.gpaw.GPAW[source]#
Bases:
typing.Protocol- property atoms: ase.Atoms#
- class abtem.magnetism.gpaw.GPAWMagneticField(...)[source]#
Bases:
abtem.magnetism.gpaw._GPAWMagnetics,abtem.magnetism.iam.BaseMagneticFieldInitialization
- class abtem.magnetism.gpaw.GPAWMagneticFields[source]#
Bundles the electrostatic potential, magnetic vector potential and (optionally) magnetic field built from the same GPAW calculator(s) by gpaw_magnetic_fields.
potential may carry a frozen-phonon ensemble axis (or, after tiling, come from a CrystalPotential build); vector_potential and magnetic_field are always for a single, rigid configuration – see _check_unsupported_ensemble_params. Use .tile() to bring the magnetic components up to a repeated crystal’s size, and .combined_potential() to fold the vector potential into an electrostatic potential via adjust_coulomb_potential.
- combined_potential(...) PotentialArray[source]#
Combine an electrostatic potential with vector_potential via VectorPotentialArray.adjust_coulomb_potential.
- Parameters:
energy (float) – Electron energy [eV].
potential (PotentialArray, optional) – The electrostatic potential to combine with vector_potential. Defaults to self.potential; pass a separately tiled/ensembled potential (e.g. a CrystalPotential build) after calling .tile() for the frozen-phonon workflow.
- Return type:
- magnetic_field: Optional[MagneticFieldArray]#
None
- potential: PotentialArray#
None
- show(...)[source]#
Show side-by-side projections of the electrostatic potential and the x and z components of the vector potential – and, if built, the magnetic field. Az/Bz are the components that matter for combined_potential; Ax/Bx are shown alongside for a sanity check that the in-plane and z-swapped components look sensible relative to each other.
- Parameters:
tile (two int, optional) – Tile the projected images before plotting, e.g. to preview the periodicity of a repeated unit cell.
figsize (two int, optional) – Figure size passed to matplotlib.pyplot.figure.
- Returns:
fig
- Return type:
matplotlib.figure.Figure
- tile(...) GPAWMagneticFields[source]#
Tile vector_potential (and magnetic_field, if present) to match a separately tiled/repeated electrostatic potential, e.g. built via abtem.CrystalPotential.
potential is left untouched here – tile or rebuild it separately (e.g. CrystalPotential(electrostatic_ensemble, repetitions=…)) before calling combined_potential.
- vector_potential: VectorPotentialArray#
None
- class abtem.magnetism.gpaw.GPAWVectorPotential(...)[source]#
Bases:
abtem.magnetism.gpaw._GPAWMagnetics,abtem.magnetism.iam.BaseVectorPotentialInitialization
- abtem.magnetism.gpaw.gpaw_magnetic_fields(...) GPAWMagneticFields[source]#
Build the electrostatic potential, magnetic vector potential and (optionally) magnetic field from the same GPAW calculator(s) in one call.
frozen_phonons (an ensemble of atomic-displacement configurations) is only supported for the electrostatic potential – the magnetic components come from a single, rigid ab initio calculation and cannot vary per configuration. Tile the returned object with .tile() to match a separately built, possibly-ensembled electrostatic potential (e.g. from abtem.CrystalPotential), then combine with .combined_potential().
- Parameters:
calculators ((list of) gpaw.calculator.GPAW or (list of) str) – One or more converged GPAW calculators (or paths to .gpw files). Forwarded to GPAWPotential. If a list (a frozen-phonon ensemble), magnetic_calculator must be given explicitly, since GPAWVectorPotential/GPAWMagneticField only support a single calculator.
gpts (one or two int, optional) – Forwarded to all built components. See GPAWPotential.
sampling (one or two float, optional) – Forwarded to all built components. See GPAWPotential.
slice_thickness (float or sequence of float, optional) – Forwarded to all built components. See GPAWPotential.
exit_planes (int or tuple of int, optional) – Forwarded to all built components. See GPAWPotential.
plane (str or two tuples of three float, optional) – Forwarded to all built components. See GPAWPotential.
origin (three float, optional) – Forwarded to all built components. See GPAWPotential.
box (three float, optional) – Forwarded to all built components. See GPAWPotential.
periodic (bool) – Forwarded to all built components. See GPAWPotential.
device (str, optional) – Forwarded to all built components. See GPAWPotential.
frozen_phonons (BaseFrozenPhonons, optional) – Forwarded to GPAWPotential only.
rotate_field (tuple of three float, "auto", or None) – Forwarded to GPAWVectorPotential/GPAWMagneticField. Defaults to “auto”: automatically swap the larger-magnitude in-plane component into z (see _auto_rotation_matrix_for_vector_field).
include_magnetic_field (bool) – If True, also build the magnetic field B (not used by combined_potential, only for inspection/visualization). Roughly doubles the GPAW-side cost of the magnetic part, so it is off by default.
magnetic_calculator (gpaw.calculator.GPAW, optional) – The single calculator representing the (rigid) magnetic contribution. Defaults to calculators when that is a single calculator; required when calculators is a list.
lazy (bool, optional) – Passed to the electrostatic potential’s .build(). The magnetic components are always built eagerly, since GPAWVectorPotential/GPAWMagneticField do not support lazy building.
potential_kwargs (dict, optional) – Extra keyword arguments forwarded only to GPAWPotential, or only to GPAWVectorPotential/GPAWMagneticField, respectively (e.g. their differing gridrefinement defaults).
field_kwargs (dict, optional) – Extra keyword arguments forwarded only to GPAWPotential, or only to GPAWVectorPotential/GPAWMagneticField, respectively (e.g. their differing gridrefinement defaults).
- Return type: