DiffractionGenerator#

class diffsims.generators.diffraction_generator.DiffractionGenerator(accelerating_voltage, scattering_params='lobato', precession_angle=0, shape_factor_model='lorentzian', approximate_precession=True, minimum_intensity=1e-20, **kwargs)[source]#

Bases: object

Computes electron diffraction patterns for a crystal structure.

  1. Calculate reciprocal lattice of structure. Find all reciprocal points within the limiting sphere given by \(\\frac{2}{\\lambda}\).

  2. For each reciprocal point \(\\mathbf{g_{hkl}}\) corresponding to lattice plane \((hkl)\), compute the Bragg condition \(\\sin(\\theta) = \\frac{\\lambda}{2d_{hkl}}\)

  3. The intensity of each reflection is then given in the kinematic approximation as the modulus square of the structure factor. \(I_{hkl} = F_{hkl}F_{hkl}^*\)

Parameters:
  • accelerating_voltage (float) – The accelerating voltage of the microscope in kV.

  • scattering_params (str) – “lobato”, “xtables” or None. If None is provided then atomic scattering is not taken into consideration.

  • precession_angle (float) – Angle about which the beam is precessed in degrees. Default is no precession.

  • shape_factor_model (func or str) – A function that takes excitation_error and max_excitation_error (and potentially kwargs) and returns an intensity scaling factor. If None defaults to shape_factor_models.linear. A number of pre-programmed functions are available via strings.

  • approximate_precession (bool) – When using precession, whether to precisely calculate average excitation errors and intensities or use an approximation.

  • minimum_intensity (float) – Minimum intensity for a peak to be considered visible in the pattern (fractional from the maximum).

  • kwargs – Keyword arguments passed to shape_factor_model.

Notes

When using precession and approximate_precession=True, the shape factor model defaults to Lorentzian; shape_factor_model is ignored. Only with approximate_precession=False the custom shape_factor_model is used.

Methods

DiffractionGenerator.calculate_ed_data(...)

Calculates the Electron Diffraction data for a structure.

DiffractionGenerator.calculate_profile_data(...)

Calculates a one dimensional diffraction profile for a structure.