Darwin model for thick-layer Laue diffraction¶
This page describes the Darwin primary extinction correction implemented in
simulate_laue_darwin and explains when and why it is necessary compared to the
kinematical model used by simulate_laue_stack.
1. The problem with the kinematical model¶
In the kinematical (Born) approximation, the diffracted amplitude from a perfect crystal slab of \(N\) unit cells is simply proportional to \(N\), so the intensity scales as
This is accurate for thin layers (epitaxial films, quantum wells) where each photon interacts with the crystal at most once before leaving. For thick perfect-crystal regions — a substrate, a thick buffer layer, or any slab with \(N \gtrsim N_\text{ext}\) — the assumption breaks down:
- The diffracted beam begins to re-diffract back into the forward beam (primary extinction).
- The leading unit cells act as a partial mirror, shadowing the deeper ones.
- The intensity saturates rather than continuing to grow as \(N^2\).
Ignoring this effect produces substrate peaks that are unrealistically strong relative to the thin-film signals of interest.
2. The Darwin extinction length¶
Darwin (1914, 1922) showed that for a perfect plane-wave incident on a perfect crystal, the extinction length \(N_\text{ext}\) is the number of reflecting planes at which the diffracted amplitude equals the incident amplitude. For X-ray diffraction it is
where
| Symbol | Meaning | Typical value |
|---|---|---|
| \(V_\text{uc}\) | unit-cell volume (ų) | ~45 ų for GaN |
| \(\sin\theta\) | sine of the Bragg angle | 0.1–0.9 |
| \(r_e\) | classical electron radius | \(2.818 \times 10^{-5}\) Å |
| \(\lambda\) | X-ray wavelength (Å) | 0.5–2.5 Å |
| \(\lvert F_\text{uc}\rvert\) | unit-cell structure factor amplitude | depends on reflection |
| \(d_{hkl}\) | interplanar spacing (Å) | e.g. 2.59 Å for GaN 0002 |
For a strong reflection in a high-\(Z\) material \(N_\text{ext}\) can be as small as a few hundred unit cells (\(\sim 100\) nm); for a weak reflection or a light-element material it can reach tens of thousands.
3. Primary extinction correction — Darwin factor¶
The effective number of coherently scattering unit cells under primary extinction is
This formula has two natural limits:
| Regime | Condition | Behaviour |
|---|---|---|
| Thin (kinematical) | \(N \ll N_\text{ext}\) | \(\tanh(N/N_\text{ext}) \approx N/N_\text{ext}\), so \(N_\text{eff} \approx N\) |
| Thick (saturation) | \(N \gg N_\text{ext}\) | \(\tanh \to 1\), so \(N_\text{eff} \to N_\text{ext}\) |
The intensity correction is therefore
For a thick substrate with \(N = 10^6\) cells and \(N_\text{ext} = 500\), the kinematical model overestimates the intensity by a factor of \((10^6/500)^2 = 4\times 10^6\). The Darwin correction reduces it to the physically correct saturation level.
Primary vs. secondary extinction
Primary extinction (corrected here) arises within a single perfect-crystal
domain — the diffracted beam re-enters the forward direction and interferes
destructively. Secondary extinction is a mosaic / grain-statistics effect
that reduces intensity when many grains are simultaneously in the Bragg
condition. Only primary extinction is implemented in simulate_laue_darwin.
4. Absorption corrections — two-beam path and overlying layers¶
In addition to primary extinction, photoelectric absorption limits the effective depth and attenuates the amplitude from each layer.
4.1 Linear absorption coefficient¶
The Beer-Lambert attenuation length for a material with imaginary refractive index \(\beta\) at energy \(E\) is
The corresponding maximum number of contributing unit cells is \(N_\text{abs} = t_\text{abs} / d\).
4.2 Two-beam depth and overlying-layer attenuation¶
Both the two-beam effective-depth correction (incident and diffracted path
through a layer) and the overlying-layer transmission factor \(T_\text{above}\)
(a photon must also cross every shallower layer twice) are geometric
absorption effects, independent of the Darwin extinction model — they apply
identically whether the underlying amplitude comes from
simulate_laue_stack or simulate_laue_darwin. They are derived once, in
Layered Structures §7.
The only Darwin-specific step is combining that absorption limit with the extinction limit from §3: the simulation caps the effective number of coherently scattering unit cells at whichever is smaller,
so a layer can be limited by extinction, by absorption, or by both.
5. Coherent multilayer sum¶
Like simulate_laue_stack, simulate_laue_darwin sums all layer amplitudes
coherently, preserving superlattice satellites and thickness fringes. The
sum has exactly the structure derived in
Layered Structures §2.2
— \(F_\text{total} = F_\text{buffer} + e^{iQ_nz_\text{buf}}F_\text{unit}S_\text{rep}(Q_n\Lambda)\)
— with one substitution: every layer's unit-cell count \(N\) is replaced by its
Darwin-corrected \(N_\text{eff}\) (§3) wherever it enters \(F_\text{buffer}\),
\(F_\text{unit}\), or the per-layer amplitude. Nothing else about the
kinematical derivation changes.
6. Superlattice satellites in the Darwin model¶
Satellite peak positions are determined purely by geometry (the Laue
condition), not by the diffraction model, so simulate_laue_darwin probes
the exact same satellite wavevectors \(\mathbf{G}_\text{sat}^{(m)}\) as
simulate_laue_stack — see
Thin-Film Satellites §2
for the formula, which covers both per-layer thickness fringes and
superlattice satellites.
The key difference from simulate_laue_stack is in the amplitude at each
satellite \(\mathbf{G}_\text{sat}\): the Darwin-corrected \(N_\text{eff}\) is
recomputed at the shifted wavevector (because \(Q_n\) and \(\sin\theta\) both change),
so the relative satellite / Bragg-peak intensity is automatically modified by the
extinction correction.
7. When to use simulate_laue_darwin vs. simulate_laue_stack¶
| Feature | simulate_laue_stack |
simulate_laue_darwin |
|---|---|---|
| Thin epitaxial layers (\(N \ll N_\text{ext}\)) | ✓ accurate | ✓ reduces to kinematical |
| Thick substrate / buffer (\(N \gg N_\text{ext}\)) | ✗ over-predicts | ✓ saturates correctly |
| Superlattice satellites | ✓ | ✓ |
| Mosaic / strained crystals | ✓ (effective N broadening) | use kinematical |
| Computation speed | faster | slightly slower |
For a typical InGaN/GaN MQW on a GaN substrate, the QW and barrier layers are
always in the kinematical regime (\(N \sim 10\)–\(200 \ll N_\text{ext} \sim 10^3\)),
while the GaN substrate can be many micrometres thick. In this situation
simulate_laue_darwin gives the most physically meaningful relative
intensities between the substrate Bragg peak and the MQW satellites.
Both functions accept the structure_model parameter ('average' by default,
'coherent' for the full inter-layer interference pattern). See the
Structure model
section of the Layered Structures page for a full description of what each
mode computes and when to use each.
8. Example — InGaN/GaN MQW¶
import xrayutilities as xu
import nrxrdct.laue as laue
GaN = xu.materials.GaN
InGaN = xu.materials.InGaN(0.20) # In₀.₂₀Ga₀.₈₀N (Vegard's law)
U = laue.euler_to_U(0, 0, 0, sample_tilt_deg=40)
C = laue.nitride_elastic_constants('InN', x=0.20, end_material='GaN')
stack = laue.LayeredCrystal(stacking_direction=(0, 0, 1))
stack.add_buffer_layer(GaN, U, thickness=5000.0, # 500 nm buffer
d_spacing=laue.d_spacing_hkl(GaN, 0, 0, 2),
label='GaN buffer')
stack.add_pseudomorphic_layer(InGaN, U, thickness=30.0, # 3 nm QW
a_substrate=GaN.lattice.a,
C13=C['C13'], C33=C['C33'],
label='InGaN QW')
stack.add_layer(GaN, U, thickness=100.0, # 10 nm barrier
d_spacing=laue.d_spacing_hkl(GaN, 0, 0, 2),
label='GaN barrier')
stack.set_repetitions(10) # QW + barrier, × 10
camera = laue.Camera()
spots = laue.simulate_laue_darwin(
stack, camera,
E_min_eV=5_000, E_max_eV=22_000,
max_satellites=5,
verbose=True,
)
laue.print_hkl_family(spots, 0, 0, 2, n=5) # GaN 000ℓ family + MQW satellites
9. Depth-parallax correction and spot elongation¶
9.1 Physical origin¶
In reflection geometry, photons that diffract from depth \(z\) below the surface exit the crystal from a point that is laterally displaced relative to the surface intercept of the incident beam. The displacement along the beam direction is
For a 775 µm Si crystal at 40° incidence (\(\cos\alpha_\text{in} \approx 0.65\)), substrate spots are displaced by ~500 µm along the beam direction relative to surface spots — a shift of several detector pixels that is clearly visible as spot elongation when integrating over a thick diffracting volume.
9.2 Enabling depth-corrected projection¶
Pass correct_depth=True to simulate_laue_darwin (or
simulate_laue_stack) to project each layer's spots from its
centre depth rather than the surface:
spots = laue.simulate_laue_darwin(
stack, camera,
sigma_h_mrad=2.5, # BM32 horizontal divergence
sigma_v_mrad=0.3, # BM32 vertical divergence
correct_depth=True, # substrate spots projected from ~387 µm depth
)
Each spot dict gains a 'source_depth_mm' key recording the beam-path
depth used. Without correct_depth, all spots are projected from
source_depth_mm = 0 (the surface).
Consistency between simulate_laue_stack and simulate_laue_darwin
Both functions now store the depth-corrected pixel position in spot['pix']
when correct_depth=True is passed. In earlier versions the vectorised
Bragg-peak path in simulate_laue_stack always projected from the surface
regardless of the flag, causing circles in plot_depth_elongation to appear
at different positions depending on which simulation was used. This
inconsistency has been fixed.
9.3 Visualising the elongation trail¶
:func:~nrxrdct.laue.plot_depth_elongation sweeps each spot's diffracting
depth from the top to the bottom of its contributing layer and projects the
position at each depth, producing an absorption-weighted trail that shows
exactly how much the spot moves across the detector:
fig, ax = laue.plot_depth_elongation(
spots, stack, camera,
top_n=20,
min_intensity=1e-4,
n_steps_per_layer=12,
space="detector",
show_divergence=True, # combined depth-parallax + beam-divergence ellipse
divergence_nsigma=2.0,
image=detector_image, # optional: show real frame behind the trails
)
The figure contains three elements per spot:
| Element | What it shows |
|---|---|
| Coloured trail | Range of projected positions from layer top (opaque) to bottom (faint) |
Tick markers (\|) |
Exact trail endpoints |
| Circle | Where the simulation placed the spot (spot['pix'], at layer-centre depth when correct_depth=True) |
| Ellipse | Combined 2σ broadening from depth-parallax covariance + beam-divergence covariance (cov_px) |
The ellipse major axis automatically aligns with the dominant elongation direction: depth-parallax (trail direction) for thick layers, beam divergence for thin layers.
9.4 Quantifying simulation accuracy¶
:func:~nrxrdct.laue.plot_pix_deviation matches each simulated spot to the
nearest measured peak and plots the displacement norm \(|\Delta\text{pix}|\)
as a function of spot properties (energy, 2θ, χ, intensity):
fig, axes, matched = laue.plot_pix_deviation(
spots, peaklist,
max_dist_px=15.0,
properties=["E", "tth", "chi", "intensity"],
)
Systematic trends in the residuals diagnose calibration errors:
| Trend | Likely cause |
|---|---|
| $ | \Delta\text{pix} |
| Offset correlated with energy | Incorrect correct_depth setting |
| Phase-dependent offset | Layer depth or orientation error |
| Random scatter \(\lesssim 2\) px | Acceptable residual for BM32 geometry |
9.5 Image-based depth reconstruction¶
depth_scan_image works directly on the raw detector pixel array — no peak
extraction required. For every simulated spot and every candidate depth z
the expected detector position is
where the slope \(dp/dz\) is obtained from two camera.project calls at
\(z = 0\) and \(z = \epsilon\). The pixel intensity is then sampled at every
\((z, \text{spot})\) combination via a single batched bilinear-interpolation
call, yielding a score matrix of shape (n_steps, n_valid_spots).
res_img = depth_scan_image(
spots, detector_image, camera, stack,
n_steps=200, z_max_mm=0.8,
min_intensity=0.02,
score_weighted=True, # weight by simulated spot intensity
)
fig, axes = plot_depth_scan_image(res_img, stack=stack, top_n_spots=30)
# Pass stack= to draw vertical lines at layer/buffer interfaces.
# For repeated units (n_rep > 1) only the outer boundaries of the
# repeated block are marked.
The two output quantities complement each other:
| Output | Shape | Interpretation |
|---|---|---|
score |
(n_steps,) |
Sum of sampled intensities vs depth; peak = best-matching depth |
score_matrix |
(n_steps, n_valid) |
Per-spot depth profile; narrow column = localised spot, broad column = depth-spread diffracting layer |
Advantages over the peak-list method (depth_scan_reconstruction):
- Works on elongated or merged spots that do not produce clean extracted peaks.
- No threshold on peak detection — faint features in the tails contribute.
- Naturally handles background gradients (they appear as a broad, featureless baseline in the score profile).
When to prefer the peak-list method:
- When the detector image contains strong parasitic signal (fluorescence, air scatter) that inflates the image score away from the true Bragg positions.
- When you need per-peak depth estimates rather than a global profile.
The two methods can be run together and their score profiles compared as a cross-check.
10. Darwin-based map fitting¶
fit_orientation_stack, fit_strain_orientation_stack, and the corresponding
LayeredMap batch methods all accept an engine keyword that selects the
simulation engine used inside the optimizer loop.
engine |
Simulation | Use when |
|---|---|---|
'stack' (default) |
simulate_laue_stack — kinematical |
Thin films, mosaic crystals, fast surveys |
'darwin' |
simulate_laue_darwin — Darwin extinction |
Thick perfect-crystal substrates; more accurate relative intensities |
10.1 Single-pixel fit¶
from nrxrdct.laue import fit_orientation_stack, fit_strain_orientation_stack
# Orientation fit with Darwin intensities
result = fit_orientation_stack(
stack, camera, obs_xy,
max_match_px=[30, 10, 3],
engine="darwin",
)
# Orientation + strain with Darwin intensities
result = fit_strain_orientation_stack(
stack, camera, obs_xy,
fit_strain=("e_xx", "e_yy", "e_zz"),
engine="darwin",
)
10.2 Full map scan¶
Pass engine="darwin" to the LayeredMap batch methods. The engine
choice is forwarded to every worker process through the fit_kwargs
mechanism, so no other change to the workflow is required:
lmap = laue.LayeredMap(ny=21, nx=21, stack=stack, h5_path="scan.h5")
# Orientation map
lmap.run_orientation_local(
camera,
seg_dir="seg/",
out_dir="ubs_darwin/",
engine="darwin", # ← Darwin instead of kinematical
max_match_px=[30, 10, 3],
)
lmap.collect("ubs_darwin/")
# Orientation + strain map
lmap.run_strain_local(
camera,
seg_dir="seg/",
out_dir="strain_darwin/",
engine="darwin",
fit_strain=("e_xx", "e_yy", "e_zz"),
orient_dir="ubs_darwin/", # warm-start from prior orientation
)
lmap.collect("strain_darwin/")
10.3 Performance notes¶
- Darwin computes a full slab calculation per spot rather than a single
structure-factor lookup, so each optimizer call is slower. For a
775 µm Si substrate the difference is modest because the Darwin correction
is dominated by a single trigonometric function (
tanh). - Pre-computing
allowed_hkl(geometry_only=True, the default) still filters absent reflections before any Darwin calculation, keeping the number of spots — and therefore the per-call cost — the same as the kinematical engine. - For predominantly thin-layer stacks where all layers satisfy
\(N \ll N_\text{ext}\), the Darwin and kinematical engines yield the same
spot positions and essentially the same intensities, so there is no
practical benefit to using
engine="darwin"in that case.
References¶
- Darwin, C. G. The theory of X-ray reflexion. Philos. Mag. 27, 315–333 and 675–690 (1914).
- Darwin, C. G. The reflexion of X-rays from imperfect crystals. Philos. Mag. 43, 800–829 (1922).
- Zachariasen, W. H. Theory of X-Ray Diffraction in Crystals. Dover, New York, 1945. (Chapter 3 — extinction in perfect crystals.)
- Als-Nielsen, J. & McMorrow, D. Elements of Modern X-ray Physics, 2nd ed. Wiley, 2011. (Section 6.4 — Darwin width and primary extinction.)
- Authier, A. Dynamical Theory of X-Ray Diffraction. Oxford University Press, 2001. (Chapters 2–4 — full dynamical treatment of which the Darwin model is the plane-wave limiting case.)