Introduction¶
Convergent Beam Electron Diffraction (CBED)¶
Conevergent Beam Electron Diffraction (CBED) is a powerful technique in transmission electron microscopy (TEM) that provides detailed information about the crystal structure, symmetry, and defects of materials. In CBED, a convergent electron beam is focused onto a small area of the specimen, producing a diffraction pattern that contains both bright-field and dark-field information. The resulting patterns can be analyzed to determine the crystal’s space group, lattice parameters, and even the presence of strain or defects. CBED is particularly useful for studying thin specimens and can provide insights into the local crystallography at the nanoscale.
The main purpose of this package is to provide a flexible and efficient framework for simulating and refining CBED patterns using modern computational techniques. By leveraging the power of JAX for automatic differentiation and GPU acceleration, we aim to enable researchers to perform high-quality structure factor refinement and physical parameter optimization.
A great starting point for learning about CBED is the book “Electron Microdiffraction” by J. M. Zuo and J. C. H. Spence, which provides a comprehensive introduction to the theory and applications of electron diffraction techniques.
Large Angle Rocking Beam Electron Diffraction (LARBED)¶
Large Angle Rocking Beam Electron Diffraction (LARBED) is an advanced technique in transmission electron microscopy (TEM) that extends the capabilities of traditional CBED by allowing for the collection of diffraction patterns over a larger angular range. In LARBED, the electron beam is rocked or tilted across a wide range of angles while maintaining a convergent beam condition. This results in a series of diffraction patterns that capture information from multiple crystallographic orientations, providing a more comprehensive view of the crystal structure and its variations. By combining the data from these patterns, researchers can gain access to much bigger field of view in reciprocal space without the issue of disk overlap that arises in traditional CBED. LARBED is particularly useful for studying complex materials, such as those with large unit cells.
A good reference for LARBED is the paper Large-Angle Rocking Beam Electron Diffraction of Large Unit Cell Crystals Using Direct Electron Detector by R. Busch et al., which demonstrates the technique and its applications in detail.
Bloch Wave Simulation¶
Bloch wave simulation is a computational method used to model the propagation of electron waves through a crystalline material in transmission electron microscopy (TEM). This approach is based on the Bloch theorem, which states that the wavefunction of an electron in a periodic potential can be expressed as a product of a plane wave and a periodic function. In the context of electron diffraction, Bloch wave simulations allow for the calculation of diffraction patterns by solving the Schrödinger equation for electrons interacting with the crystal potential. This method is particularly effective for simulating CBED and LARBED patterns, as it can account for multiple scattering events and complex crystal structures. By comparing simulated patterns with experimental data, researchers can refine their understanding of the crystal structure and other physical parameters.
Crystal Structure and Structure Factor Refinement¶
Crystal structure refinement is the process of adjusting a proposed model of a crystal’s atomic arrangement to best fit experimental data, such as diffraction patterns. In the context of electron diffraction, this often involves refining the structure factors, which are complex numbers that describe the amplitude and phase of scattered waves from the crystal lattice. By optimizing these structure factors, researchers can improve the agreement between simulated and observed diffraction patterns, leading to a more accurate representation of the crystal structure. This refinement process can also include adjustments to other physical parameters, such as sample thickness and probe characteristics, to further enhance the fidelity of the simulation.
PyExtal-JAX Optimization Engine¶
PyExtal-JAX is a high-performance optimization engine designed for the quantitative refinement of structure factors and physical parameters in electron diffraction. By integrating the dynamical diffraction theory of the Bloch wave method with JAX, it provides a modern, GPU-accelerated framework for solving complex inverse problems in crystallography.
Key Features¶
JAX-Accelerated Forward Model: The core engine implements dynamical diffraction theory using JAX primitives. It solves the Schrödinger equation for electrons in a periodic potential via matrix exponentiation (
expm), supporting multi-slice/multi-layer sample architectures and Bethe perturbation for the inclusion of weak reflections.Automatic Differentiation: Leveraging JAX’s automatic differentiation (AD), the engine computes exact gradients of the diffraction intensity with respect to any physical parameter. This enables the use of efficient gradient-based optimizers (e.g., Adam via
optax) instead of traditional derivative-free or finite-difference methods.Flexible Refinement Targets:
Structure Factors: Direct refinement of complex structure factors (\(U_g\)), allowing for ab-initio electron density mapping.
Physical Models: A flexible model registry system allows users to define and refine physical crystal parameters (such as atomic coordinates, occupancy, and Debye-Waller factors) directly, with structure factors computed on-the-fly.
Comprehensive Parameter Optimization: Beyond crystal structure, the engine can simultaneously refine experimental parameters including:
Sample Thickness: Multi-layer thickness refinement.
Probe Characteristics: Convolution with Gaussian or Voigt profiles to account for beam convergence and coherence.
Experimental Conditions: Intensity scaling and background levels.
Symmetry Constraints: Built-in support for Friedel symmetry and full Space Group symmetry constraints to reduce the parameter space and ensure physical consistency.
Performance & Scalability: Optimized for large datasets through JIT compilation and specialized batching strategies, including 2D chunking for efficient processing of high-resolution Scanning Precession Electron Diffraction (SPED) or LARBED data.
Workflow Overview¶
Configuration: Define the optimization task using a unified
OptConfig, specifying refinement targets, bounds, and optimization hyperparameters.Initialization: Load experimental data (intensities and variance) and initialize the Bloch wave parameters using the core
pyextallibrary.Optimization: Run the JAX-based loop where the forward model generates simulated intensities, compares them to experimental data via loss functions (e.g., Chi-squared or Cosine distance), and updates parameters using gradient descent.
Validation: Generate simulated patterns and error maps using the refined parameters to assess the quality of the fit.
Citations¶
If you use this package in your research, please consider citing the following paper:
@article{Ni:yr5166,
author = "Ni, Hsu-Chih and Busch, Robert and Zuo, Jian-Min",
title = "{{\it PyExtal}: a Python package for quantitative convergent-beam electron diffraction}",
journal = "Journal of Applied Crystallography",
year = "2026",
volume = "59",
number = "2",
pages = "687--699",
month = "Apr",
doi = {10.1107/S1600576726001469},
url = {https://doi.org/10.1107/S1600576726001469},
abstract = {Quantitative convergent-beam electron diffraction (QCBED) enables the measurement of structure factors and other structural parameters with high accuracy using dynamical diffraction theory. To do this, rigorous diffraction simulations and iterative intensity refinement are required. We have developed {\it PyExtal}, a Python-based software package for QCBED. {\it PyExtal} supports refinement of both small- and large-unit-cell crystals through automated computation workflows and flexible data handling of convergent-beam electron diffraction (CBED) and large-angle CBED patterns. The performance of {\it PyExtal} is demonstrated by using silicon and yttrium iron garnet as benchmark systems, with refined silicon structure factors showing excellent agreement with previous experimental results. As a computational platform, {\it PyExtal} provides a direct basis for experimental mapping of electron charge density in crystals and facilitates broader applications of dynamical-diffraction-based quantitative crystallographic analysis.},
keywords = {quantitative convergent-beam electron diffraction, large-angle CBED, LACBED, structure factors, refinement algorithms, electron diffraction, multiple scattering},
}