Skip to content

Commit

Permalink
Added widget for STO supercell creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaSusi committed Sep 4, 2024
1 parent b68eab1 commit 532edfb
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 21 deletions.
5 changes: 3 additions & 2 deletions STEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ It is important to remember the difference between the wavefunction sampling and
Aluminum, iron and gold nanoparticles on a carbon film: **Left** image from a circular detector. **Middle** image from an annular detector **Right** differential phase contrast reconstruction. Notice how changing the collection angles impacts the contrast and signal to noise.
```

(stem-image-simulation)=
#### Image simulation: STO/LTO

Scanning imaging modes such as STEM works by rastering an electron probe across a sample pixel by pixel and recording the scattering signal. The computational cost of the simulation is directly proportional to the number of scan pixels, each requiring a separate multislice simulation. For periodic speciments, even though the potential needs to be large enough to fit the probe, there is no need to scan over repated unit cells as tiling afterwards can yield the same result.

As an example, we simulate the BF (0 to 20 mrad), MAADF (40 to 100 mrad) and HAADF (100 to 180 mrad) images of a STO/LTO interface that we built in the [simulation inputs](./sim_inputs.md) chapter. Note that since the structure repeats in the $x$-direction, we only scan over the unit cell, as shown in [](#fig_stem_specimen) below. The images simulated with a primary beam energy of 150 keV, a defocus of 50 Å, and a probe convergence-semiangle of 20 mrad are shown in [](#fig_stem_sto-lto_image) below. Note that these are quite pixelated since we simulated at Nyqvist sampling to save computational effort; see [post-processing](./post.md) for how these are interpolated to a higher resolution.
As an example, we simulate the BF (0 to 20 mrad), MAADF (40 to 100 mrad) and HAADF (100 to 180 mrad) images of a STO/LTO interface that we built in the [simulation inputs](./sim_inputs.md) chapter. Note that since the structure repeats in the $x$-direction, we only scan over the unit cell, as shown in [](#fig_stem_specimen) below. The images simulated with a primary beam energy of 150 keV, a defocus of 50 Å, and a probe convergence-semiangle of 20 mrad are shown in [](#fig_stem_image) below. Note that these are quite pixelated since we simulated at Nyqvist sampling to save computational effort; see [post-processing](./post.md) for how these are interpolated to a higher resolution.

```{figure} #app:stem_sto-lto_scan
:name: fig_stem_specimen
Expand All @@ -118,7 +119,7 @@ A SrTiO<sub>3</sub>/LaTiO<sub>3</sub> (STO/LTO) interface model. The red overlai

```{figure} #app:stem_sto-lto_image
:name: fig_stem_image
:placeholder: ./static/stem_image.png
:placeholder: ./static/stem_images.png
Bright-field (BF), medium-angle annular dark-field (MAADF), and high-angle annular dark-field (HAADF) imges of the SrTiO<sub>3</sub>/LaTiO<sub>3</sub> (STO/LTO) interface.
```

Expand Down
19 changes: 15 additions & 4 deletions inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ numbering:
label : sim_inputs_page
---

text

(specimen-models)=
## Specimen models

Expand All @@ -24,15 +22,19 @@ The `Atoms` object defines a collection of atoms. To define `Atoms` from scratch

For example, to create a basic model of the N<sub>2</sub> molecule, we could define:

`atoms = ase.Atoms("N2", positions=[(0.0, 0.0, 0.0), (1.0, 0.0, 0.0)], cell=[6, 6, 6])`
```Python
atoms = ase.Atoms("N2", positions=[(0.0, 0.0, 0.0), (1.0, 0.0, 0.0)], cell=[6, 6, 6])
```

All these attributes of the `Atoms` object are stored in underlying NumPy arrays, which can be directly modified if desired. Convenient arithmetic operations also directly work for the `Atoms` object, so structures can be easily combined to create more complex specimens.

#### Importing structures from files

ASE can import all common atomic-structure formats (full list [here](https://wiki.fysik.dtu.dk/ase/ase/io/io.html)). Below we import a `.cif`-file defining a unit cell of strontium titanate (SrTiO<sub>3</sub>) that we provide with this text and will use in further examples.

`srtio3 = ase.io.read("srtio3.cif")`
```Python
srtio3 = ase.io.read("srtio3.cif")
```

### Manipulating atoms
*ab*TEM always assumes that the imaging electrons propagate along the $z$-axis in the direction from _negative to positive_ coordinate values. Hence, to choose the zone axis, we need to manipulate the atoms so they are properly aligned.
Expand All @@ -45,4 +47,13 @@ In the widget below, we have oriented the strontium titanate structure along the
:name: fig_sto_supercell
:placeholder: ./static/sto_supercell.png
**Interactive widget showing supercell construction for the STO(110) supercell.
```

Since the positions and atomic numbers are just `NumPy` arrays, they can be modified in-place. Below, we create an SrTiO<sub>3</sub>/LaTiO<sub>3</sub> interface by changing the atomic numbers of the Sr atoms with a $y$-coordinate less than $7.5 \ \mathrm{Å}$ in a (3,4,10) supercell oriented along the (110) zone axis. This interface created from a will be later used for [STEM image simulations](#stem-image-simulation).

```python
sto_lto = repeated_srtio3.copy()
mask = sto_lto.symbols == "Sr"
mask = mask * (sto_lto.positions[:, 1] < 7.5)
sto_lto.numbers[mask] = 57
```
83 changes: 72 additions & 11 deletions notebooks/06.1_Atoms_STO-LTO.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion notebooks/09.x_STEM_STO-LTO.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"source": [
"#| label: app:stem_sto-lto_image\n",
"stacked_measurements.show(explode=True)\n",
"plt.savefig(\"../static/stem_images.png\", dpi=600)"
"#plt.savefig(\"../static/stem_images.png\", dpi=600)"
]
},
{
Expand Down
Binary file modified notebooks/data/STO_LTO_STEM.zarr/array0/0.0.0
Binary file not shown.
6 changes: 3 additions & 3 deletions post.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ STEM simulations usually requires some post-processing, we apply some of the mos
For these examples, we use an STO/LTO heterointerface as a specimen. The structure was built earlier in the [simulation inputs](./sim_inputs.md) chapter, and simple BF/ADF images simulated in the chapter on [STEM](./STEM.md).

#### Interpolation
We can save a great deal of computational effort by scanning at the Nyquist frequency [https://en.wikipedia.org/wiki/Nyquist_frequency], which is information-theoretically guaranteed to be sufficient -- but the result is visually quite pixelated. To address this, we can interpolate the images to a sampling of 0.05 Å. *ab*TEM’s default interpolation algorithm is Fourier-space padding, but spline interpolation is also available, which is more appropriate if the image in non-periodic.
We can save a great deal of computational effort by scanning at the Nyquist frequency [https://en.wikipedia.org/wiki/Nyquist_frequency], which is information-theoretically guaranteed to be sufficient -- but the result is visually quite pixelated. To address this, we can interpolate the images to a sampling of 0.05 $\mathrm{\AA}$. *ab*TEM’s default interpolation algorithm is Fourier-space padding, but spline interpolation is also available, which is more appropriate if the image in non-periodic.

#### Blurring
Standard multislice simulations are too idealized to describe a realistic experimental image. For example, a finite Gaussian-shaped source will result in a blurring of the image, and vibrations and other instabilities may further contribute to the blur. It is typical and convenient to approximate these by applying a Gaussian blur with a standard deviation of $0.35 \ \mathrm{Å}$ (corresponding to a source of approximately that size). However, note that correctly including spatial and temporal incoherence is a bit more complicated and may be necessary for quantitative comparisons with experiment.
Standard multislice simulations are too idealized to describe a realistic experimental image. For example, a finite Gaussian-shaped source will result in a blurring of the image, and vibrations and other instabilities may further contribute to the blur. It is typical and convenient to approximate these by applying a Gaussian blur with a standard deviation of $0.35 \ \mathrm{\AA}$ (corresponding to a source of approximately that size). However, note that correctly including spatial and temporal incoherence is a bit more complicated and may be necessary for quantitative comparisons with experiment.

#### Noise
Simulations correspond to the limit of infinite electron dose, which again is not realistic for an experimental image. Leaving aside other factors, the main source of noise in STEM is so-called shot noise arising from the discrete nature of electrons. We can effectively emulate finite dose by drawing random numbers from a Poisson distribution for every pixel. We apply this so-called Poisson noise corresponding a dose per area of $10^5 \ \mathrm{e}^- / \mathrm{Å}^2$ to form a more realistic image.
Simulations correspond to the limit of infinite electron dose, which again is not realistic for an experimental image. Leaving aside other factors, the main source of noise in STEM is so-called shot noise arising from the discrete nature of electrons. We can effectively emulate finite dose by drawing random numbers from a Poisson distribution for every pixel. We apply this so-called Poisson noise corresponding a dose per area of $10^5 \ \mathrm{e}^- / \mathrm{\AA}^2$ to form a more realistic image.

The different STEM post-processing steps can be explored in [](#fig_stem_processing).

Expand Down

1 comment on commit 532edfb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curvenote Preview

Directory Preview Checks Updated (UTC)
. 🔍 Inspect 57 checks passed (22 optional) Sep 4, 2024, 11:29 AM

Please sign in to comment.