Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LEEDtal

LEEDtal is a lightweight Python tool for simulating and analyzing Low Energy Electron Diffraction (LEED) patterns. It lets you load experimental LEED images, tweak contrast/brightness, and overlay simulated diffraction patterns derived from 2D reciprocal lattice calculations—including surface superstructures and reconstructions inspired by ViperLEED. Main motivation was to write something like ProLEED that would be natively supported on Linux. Vibe coding was used heavily, since I just needed quick tool while processing images. More will be may be added in the future, if you would have any ideas for improvement, just do a commit and I will review it.

Built with a dark Tkinter interface and matplotlib canvas, it utilizes canvas blitting and slider debouncing to keep the pattern overlay smooth and responsive during real-time adjustments.


Key Features

1. Image Adjustments & Display

  • Supported Formats: PNG, JPEG, TIFF, BMP.
  • Image Controls: Real-time adjustments for brightness, contrast, and gamma correction.
  • Display Options: Invert colors and switch between colormaps (gray, hot, viridis, inferno, magma, bone).

2. Bulk 2D Unit Cell Selection

Includes 5 two-dimensional Bravais lattice geometries matching standard crystallographic constraints. Selecting a lattice shape automatically locks dependent parameters:

Shape Constraints User-Editable Parameters
Oblique None ($a \neq b$, $\gamma$ arbitrary) a, b, γ
Rectangular $\gamma = 90^\circ$ a, b
Square $a = b$, $\gamma = 90^\circ$ a
Rhombic $a = b$, $\gamma$ arbitrary a, γ
Hexagonal $a = b$, $\gamma = 120^\circ$ a

Locked parameters are greyed out in the interface and update automatically.

3. Surface Reconstructions & Superstructures

Define surface superstructures relative to the bulk substrate lattice using methods similar to ViperLEED:

  • Matrix Mode: Custom transformation matrix $M$ ($2 \times 2$) where $a_s = M \cdot a_{\text{bulk}}$.
  • Wood's Notation: $(m \times n) R\phi$ notation specifying scale factors and rotation angle $\phi$.
  • Presets: Includes common surface structures: $1\times 1$, $2\times 1$, $1\times 2$, $2\times 2$, $3\times 1$, $3\times 3$, $c(2\times 2)$, $\sqrt{3}\times\sqrt{3},R30^\circ$, $\sqrt{7}\times\sqrt{7}$, $\text{Si}(111)\text{-}7\times 7$, and Custom.
  • Domains & Symmetry: Handles rotational domain generation based on substrate rotational symmetry (Sym) and domain count (Domains).
  • Spot Classification: Separate handling and visual styling for integer spots (bulk $1\times 1$) and fractional spots (superstructure additions).

4. Diffraction & Beam Parameters

  • Beam Energy ($E$): Sets electron energy in eV to determine the Ewald sphere radius ($k_0$).
  • Reciprocal Cutoff: Filters spots satisfying $|G_{hk}| \le k_0$.
  • Pattern Rotation: Rotates the calculated pattern relative to the image frame.
  • Order Limit ($h_{\text{max}}$): Sets maximum Miller index range ($1$ to $6$).

5. Overlay Customization

  • Visual Separation: Toggle integer and fractional spots independently.
  • Unit Cell Highlight: Option to render full lines for the bulk unit cell and dashed lines for the surface unit cell.
  • Labels: Optional $(h,k)$ Miller index overlay for diffraction spots.
  • Styling: Custom spot sizes, opacity (alpha), and independent color pickers for bulk vs. superstructure spots. Direct beam $(0,0)$ is rendered as a prominent centered marker.

6. Alignment & Interaction

  • Interactive Alignment: Click anywhere on the image canvas to re-center the pattern (direct beam position), or tune center coordinates via X/Y sliders.
  • Pattern Scaling: Adjust scale slider to align simulated reciprocal space distances with detector pixel dimensions.
  • Reset View: One-click reset for zoom, centering, and image enhancements.

Physics Summary

Real & Reciprocal Space Vectors

For real-space 2D lattice basis vectors:

$$\vec{a}_1 = a [1, 0]$$ $$\vec{a}_2 = b [\cos\gamma, \sin\gamma]$$

The unit cell area is $A = a b \sin\gamma$. The reciprocal basis vectors are given by:

$$\vec{b}_1 = \frac{2\pi}{A} [a_{2,y}, -a_{2,x}]$$ $$\vec{b}_2 = \frac{2\pi}{A} [-a_{1,y}, a_{1,x}]$$

Reciprocal lattice vector for reflection $(h,k)$:

$$\vec{G}_{hk} = h\vec{b}_1 + k\vec{b}_2$$

Ewald Sphere Cutoff & Detector Projection

The electron wave vector magnitude $k_0$ is calculated from energy $E$:

$$k_0 = \frac{\sqrt{2 m_e E}}{\hbar}$$

Only reflections meeting the condition $|\vec{G}_{hk}| \le k_0$ are active. The normalized detector coordinates are projected to image pixels via:

$$x_{\text{pixel}} = x_{\text{center}} + \left(\frac{G_{x,\text{rot}}}{k_0}\right) \cdot \text{scale}$$ $$y_{\text{pixel}} = y_{\text{center}} - \left(\frac{G_{y,\text{rot}}}{k_0}\right) \cdot \text{scale}$$


Installation

Ensure Python 3.8+ is installed. Install required packages via pip:

pip install numpy matplotlib pillow

About

This is simple LEED pattern diagnosis tool written in Python. It's inspired by ProLwhenEED and viperLEED and is compatible with Linux, unlike ProLEED.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages