A package designed to train a model for identifying structural attributes (crystallographic orientations and phases) of a single crystal from 4-dimensional scanning transmission electron microscopy (4D-STEM) diffraction patterns.
We have made modifications and additions to the original py4DSTEM codebase to support simulations of dynamic diffraction from SO3 proper orientation matrix and to support calculation of sparse correlation value between two Bragg vector point list.
- Licensed under the GNU General Public License v3.0
- Modified version of py4DSTEM codes are in "third_party" directory
- The original py4DSTEM project is available at: https://github.com/py4dstem/py4DSTEM
python -m pip install .pip install -r requirements-cuda.txtThe unit cell cif files used in this study are based on entries from the Inorganic Crystal Structure Database (ICSD) (https://icsd.products.fiz-karlsruhe.de/):
| ICSD collection code | Chemical formula | crystal space group | crystal space group IT number | variable string used in codes |
|---|---|---|---|---|
| ICSD #136042 | Cu | F m -3 m | 225 | 'Cu_fcc' |
| ICSD #63281 | Cu2O | P n -3 m Z | 224 | 'Cu2O_cubic' |
Due to licensing restrictions, cif files are not included. Users with access to the ICSD can retrieve the data via these entry numbers. If you don't have access to the ICSD, you can get unit cell information and cif files from other open-source projects including materials project (https://next-gen.materialsproject.org/).
import os
import sys
third_party_path = os.path.abspath("/path/towards/third_party/")sys.path.insert(0, third_party_path)import py4DSTEMTo train the model, you would need synthetic training and validation data, which are simulated diffraction pattern (table of Bragg disks) with orientation labels.
The "./scripts/training_and_validation_data_generation" directory contains scripts for generating synthetic training and validation data
step 02. From the sampled orientations and thickness, we simulate dynamic diffraction patterns and save them in table format.
step 03. For each diffraction pattern, we further digitize Bragg disk positions and intensities (still in table format)
The "./scripts/train_transformer/orientation_prediction" directory contains scripts for training a model for orientation prediction
The "./scripts/train_transformer/joint_phase_and_orientation_prediction" directory contains scripts for training a model for joint prediction of orientations and phases
Analaysis codes are included in "./scripts/figure". This directory also includes codes for generating figure sets.
This project is supported by the Eric and Wendy Schmidt AI in Science Postdoctoral Fellowship, a program of Schmidt Sciences, LLC
