Laue Simulator & Indexer — Help & Theory
Core Functionality
- Simulation: Define a lattice and detector to predict a Laue pattern (virtual goniometer + polychromatic beam).
- Indexing: Load a real image, pick peaks, and solve the unknown crystal orientation; then simulate and overlay spots for verification.
- Orientation: Calculate the goniometer angles required to geometrically align a specific (h,k,l) plane normal with the detector normal.
Two Orientations: how rotations are applied
Base Orientation (unknown): The sample’s as-mounted orientation found by the search. Selecting a solution sets this as the internal base matrix.
Goniometer Rotation (knobs): The
X,Y,Zsliders in the Set tab. They rotate on top of the Base Orientation and also respond to canvas drag.
Total rotation used in simulation = Base then Goniometer (XYZ Euler). After you choose a solution, the sliders are reset to 0 so the display shows the solved orientation. Moving a slider then offsets from that base.
Typical workflow (indexing)
- Analysis → Load Image. If spots are white on black, check Invert Image. Toggle Show Spots to view overlays.
- 1. Set Center. Click the beam center. This enables Set Scale and shows a blue reference crosshair.
- Set Scale. Drag the blue crosshair to a known reference. Enter its
U (mm), V (mm)from the center. (The app uses separate px/mm for U and V; V is inverted screen-to-mm.) - Experimental Peaks. Use Find Peaks or Add Peak. Prefer 3–5 peaks of high symmetry far apart and across quadrants. You can refine (U, V) values directly in the list.
- Set. Choose Bravais type, enter lattice parameters, wavelength band. Set the Detector Angle (0°=transmission, 180°=back-scatter) and Distance (mm) exactly as in the experiment.
- Search Orientation. Wait for results; then open Solutions, click the best row (lowest Score, best Matches/RMS). The view updates with a yellow overlay.
- (Optional) Orient tab. Enter target (h,k,l) and click Calculate Goniometer Angles. The tool calculates the X/Y/Z sliders needed to geometrically align the (h,k,l) plane normal to be parallel with the detector normal (based on the current Detector Angle).
- Generate Report. Saves a PDF with parameters, peak table, best solution matches (assigned hkl), and a summary of all solutions.
UI reference (tabs)
Set
- Lattice & parameters. Bravais choice enables the right fields (e.g., only
afor cubic;a,cfor tetragonal; monoclinic fixes α=γ=90°, etc.). - X-ray Source (Laue).
λ_min–λ_max(Å) define the polychromatic band. - Detector Geometry.
Angle (°)defines the detector plane's orientation relative to the beam (0° is transmission, 180° is back-scattering).Dist. (mm)is the distance from the sample to the detector plane's center. - Goniometer Rotation (°). X/Y/Z act relative to the chosen Base Orientation; dragging the canvas adjusts Y/Z.
Analysis
- Set Center → Set Scale. After center, enter a second point’s real coordinates (U, V) to establish px→mm.
- Experimental Peaks. Automatic finder prefers bright, well-separated spots; manual picks allow precise control. Edit (U, V) values inline; click a row label to select and drag on the image.
Solutions
- Rows show Score (lower is better), Matches, RMS (mm), and Rot (X,Y,Z). Multiple nearly identical rows are symmetry-equivalent orientations—choose the best group’s top row.
Orient
- Computes goniometer angles to geometrically align the chosen (h,k,l) plane normal (its reciprocal vector
g) to be parallel with the detector's normal vector.
• This calculation is dynamic: it reads the Detector Angle from the 'Set' tab and uses its normal as the alignment target.
• Note: This is a purely geometric alignment. A diffraction spot will generally not appear at the center, as this function no longer solves for the Bragg condition.
• This calculation is valid for all angles from 0° (alignsgwith the beam) to 180° (alignsganti-parallel to the beam).
Mathematical model
1) Unit cell → reciprocal basis
Given cell a,b,c and angles α,β,γ, direct vectors are
// direct basis (Å)
a = (a, 0, 0)
b = (b cosγ, b sinγ, 0)
c = (c cosβ, c (cosα − cosβ cosγ)/sinγ, V/(a b sinγ))
V = a b c √(1 − cos²α − cos²β − cos²γ + 2 cosα cosβ cosγ)
Reciprocal basis vectors (Å⁻¹) are
a* = (b × c)/V , b* = (c × a)/V , c* = (a × b)/V
Any reflection (h,k,l) maps to g₀ = h a* + k b* + l c*.
2) Systematic absences (Bravais rules)
| Type | Condition |
|---|---|
| P | all (h,k,l) allowed |
| I | h + k + l even |
| F | h, k, l all even or all odd |
| C | h + k even |
| R | −h + k + l ≡ 0 (mod 3) |
3) Orientation stacking
Reflections are rotated first by the Base Orientation U (from the solver), then by the goniometer Euler rotation R(X,Y,Z):
g = R(X,Y,Z) · U · g₀
4) Laue condition, wavelength band, and detector hit
Beam points along +X. With unit wavevectors k̂_in = (1,0,0) and k̂_out, define the (normalized) scattering vector ĝ = k̂_out − k̂_in. For a given lattice vector g (Å⁻¹), elastic diffraction requires
2 k_in · g + |g|² = 0 , with k_in = (1/λ, 0, 0)
Solving for the required wavenumber gives
k = − |g|² / (2 gₓ)
- The polychromatic band is
k ∈ [1/λ_max, 1/λ_min]. Ifkfalls outside, the spot is culled.
The diffracted ray is k_out = g + (k,0,0). The detector plane is defined by its angle φ (0° to 180°) and distance D.
// Detector plane normal and u-axis (horizontal)
n̂ = (cosφ, sinφ, 0)
û = (-sinφ, cosφ, 0)
The intersection P_hit is found by solving t for the ray P(t) = t · k_out and the plane P · n̂ = D.
- This gives
t = D / (k_out · n̂). - A hit is valid only if
t > 0(intersection is in front of the sample, pointing toward the detector). - The (U,V) coordinates on the detector are the projection of
P_hit:
v = P_hit_z // Vertical coordinate is the Z component
u = P_hit · û // Horizontal coordinate
(x₂d, y₂d) = (u, v) // These are the plotted (mm) coordinates
5) Experimental geometry → scattering vectors
From a measured spot at detector coordinates (u_mm, v_mm) relative to the center, we reconstruct the 3D scattering vector.
// φ is the detector angle, D is distance
n̂ = (cosφ, sinφ, 0)
û = (-sinφ, cosφ, 0)
v̂ = (0, 0, 1)
// Reconstruct 3D spot position from (u,v)
P_center = D · n̂
P_hit = P_center + (u_mm · û) + (v_mm · v̂)
k̂_out = normalize( P_hit )
ĝ_exp = normalize( k̂_out − (1,0,0) ) // used for orientation solving
6) Pixel ↔ millimeter conversion
After you click the beam center (pixels) and place a scale point with known (mm), the app sets independent scale factors for U and V:
pixels_per_mm_x = (x_px − x0_px) / U_mm
pixels_per_mm_y = −(y_px − y0_px) / V_mm // minus because image Y is down
Orientation search (what “Search Orientation” does)
- Gather experimental peaks ...
- Build HKL library ...
- Angle pairing: ...
- Candidate orientation: ...
- Score it: ...
- Keep top-N ...
Note on high-index reflections: The search uses two different (h,k,l) ranges.
- Seeding (Step 2-3): A small library (e.g., |h,k,l| ≤ 2) is used to quickly find pairs of angles that match your experimental data.
- Scoring (Step 5): A large library (e.g., |h,k,l| ≤ 12) is used to generate a full simulation pattern to score the candidate orientation.
This strategy is robust to small peak sets and naturally yields symmetry-related orientations (e.g., cubic equivalences).
Peak finder details
- Grayscale image; optional inversion. Threshold at ~90% of the frame’s max intensity.
- Local-max test in a small neighborhood; exclude a central disk (~5 mm radius).
- Balanced selection: take strongest candidates per quadrant to seed indexing.
- You can always refine by manual adding/dragging spots.
Report contents
- Detector snapshot with overlays.
- Simulation + analysis parameters (lattice, λ band, D, Angle, center/scale).
- Experimental peak list in (U, V) mm (+ raw pixels).
- Best solution details: each peak’s assigned
(h,k,l), simulated (U, V) and error (mm). - All solutions summary.
Troubleshooting
No or poor solutions
- Verify Bravais type and lattice parameters.
- Check detector Distance and Angle (e.g., 0° for transmission, 180° for back-scatter).
- Re-do center/scale carefully; a wrong scale ruins geometry.
- Use clear, well-separated peaks (3+ across different quadrants). Try Invert Image if the finder misses peaks.
A spot doesn't appear after “Orient to (h,k,l)”
- This is the expected behavior. The 'Orient' function now performs a purely geometric alignment, making the (h,k,l) plane normal parallel to the detector normal. It no longer calculates the angles required for a diffraction spot (the Bragg condition).
- A spot will only appear at the center if this geometric alignment also happens to satisfy the Bragg condition for a wavelength in your source's range (which is only guaranteed at 180°).
Conventions & hints
- Coordinate System: The incident beam is along the +X axis. The lab's vertical direction is +Z (mapping to the detector's +V coordinate). The detector plane's position is defined by its Angle (0° = transmission, plane at
x = +D; 90° = side, plane aty = +D; 180° = back-scatter, plane atx = -D). - In the detector's (U, V) coordinate system in mm (handled by the scale).
- The (U, V) coordinates can be manually edited (so it is the scale).
- Dragging the canvas rotates Y/Z goniometer axes; use sliders for precise values.
- Use a realistic λ band (e.g., 0.2–3.0 Å) and a correct D to reduce false solutions.