PED quickstart

Hide code cell source

import ase
import matplotlib.pyplot as plt
from abtem.tilt import precession_tilts
from ase.io import read

import abtem

PED quickstart#

Configuration#

We start by (optionally) setting our configuration. See documentation for details.

abtem.config.set(
    {
        "device": "cpu",
        "fft": "fftw",
        "diagnostics.task_progress": True,
        "diagnostics.progress_bar": "tqdm",
    }
);

Atomic model#

atoms = read("data/SiO2_zeolite.cif")

cell = atoms.cell.copy()

atoms = atoms * (1, 1, 20)

abtem.show_atoms(atoms, plane="xy");
../../../_images/9d4fec8bb6217a1f5114b71c913bc61e0c3a7abe457b80be7130d8e3a1b7ad6c.png
frozen_phonons = abtem.FrozenPhonons(atoms, 8, sigmas=0.078)
potential = abtem.Potential(
    frozen_phonons,
    sampling=0.05,
    projection="infinite",
    slice_thickness=1,
)
wave = abtem.PlaneWave(energy=100e3)
wave.grid.match(potential)
wave.tilt = precession_tilts(50, 5)
measurement = wave.multislice(potential).diffraction_patterns().mean(0).compute()
spots = (
    measurement.crop(25)
    .block_direct()
    .index_diffraction_spots(cell=atoms)
    .remove_low_intensity(1e-3)
)
visualization = spots.show(
    explode=True,
    scale=.05,
    figsize=(14, 5),
    annotations=False,
    annotation_kwargs={"threshold": 1e-2},
)
../../../_images/9beaa1dfa246ae9d9f8e8c17b8d1df0eccb2938876ab3a448bf849cb50b430f4.png

Note that PED can also be calculate using the Blochwave method, see example.