Safeguard
Supply Chain Security•

Bragg's Law Explained: X-Ray Crystallography to Chip Metrology

Bragg's law, nλ = 2d sin θ, links wavelength, plane spacing and angle. History, Miller indices and worked silicon, powder, neutron and strain examples.

Safeguard Security Team
47 min read

Bragg's law says that waves reflected from parallel planes of atoms in a crystal reinforce each other only when nλ = 2d sin θ, where λ is the wavelength, d is the spacing between the planes, θ is the glancing angle between the beam and the planes, and n is a whole number. Measure the angle where a bright reflection appears, and if you know the wavelength you know the plane spacing to a few parts per million. William Henry Bragg and his son William Lawrence Bragg set out this picture in 1913 and shared the 1915 Nobel Prize in Physics for it, and the same equation now runs everything from protein structure work to strain checks on silicon wafers.

This post goes one level deeper than our tour of the electromagnetic spectrum, which explains where X-rays sit relative to visible light. It also pairs with two siblings: the photoelectric effect, which treats light as particles with energy E = hf, and semiconductor doping and p-n junctions, which explains why chipmakers care so much about the silicon crystal that Bragg's law lets them measure. Here we work through the geometry, check every number against NIST reference values, and show where the arithmetic most often goes wrong.

This is a general science explainer. Every calculation below is ordinary textbook physics that you can reproduce with a calculator or the short Python script near the end. Safeguard does not do physics, crystallography or materials analysis, and nothing here suggests otherwise; the only Safeguard section is an honest note about the open source software that diffraction labs depend on.

Key takeaways

  • Bragg's law is nλ = 2d sin θ. The left side is a whole number of wavelengths; the right side is the extra distance a wave travels when it reflects from the next plane down. When they match, reflections add up and a diffraction peak appears.
  • θ is the glancing angle to the planes, not the angle to the surface normal, and a diffractometer usually reports 2θ, the angle between the incoming and outgoing beams. Mixing up θ and 2θ is the most common mistake in the field.
  • Miller indices (hkl) name a family of planes. For a cubic crystal the spacing is d = a / √(h² + k² + l²), where a is the lattice parameter.
  • With copper Kα₁ X-rays (λ = 1.540 592 9 Å, NIST) on silicon (a = 5.431 020 511 Å, CODATA 2022), the (111) reflection sits at 2θ = 28.442°, which matches the 28.441° NIST lists for its silicon powder standard, SRM 640g.
  • Electrons and neutrons diffract too, because they have de Broglie wavelengths λ = h/p. A thermal neutron at 2,200 m/s has λ ≈ 1.80 Å, close to copper X-rays; a 200 kV electron has λ ≈ 0.025 Å, so its Bragg angles are a fraction of a degree.
  • In practice the law underpins protein crystallography (about 80% of the experimental structures in the Protein Data Bank came from X-ray diffraction when we queried it on 24 October 2026), powder diffraction for identifying materials, and high resolution diffraction for measuring strain and composition in thin semiconductor layers.
  • Small angle errors matter: differentiating Bragg's law gives Δd/d = −cot θ · Δθ, which is why precise lattice measurements favour high angles.
  • X-ray diffraction equipment produces ionising radiation. Use it only under your institution's radiation safety programme, and never bypass an interlock.

What does Bragg's law say?

In one line:

n λ = 2 d sin θ

Read it as a condition, not a formula that always produces an answer. A crystal is a stack of planes of atoms, repeated with a fixed spacing d. A beam of wavelength λ hits those planes at a glancing angle θ. Each plane scatters a tiny fraction of the beam. For almost every angle, those scattered waves arrive out of step with each other and cancel. Only at the special angles where the condition holds do they arrive in step and add up to a strong reflected beam, which a detector records as a peak.

What each symbol means, with units

SymbolMeaningUsual unitNotes
nOrder of reflectionnone (1, 2, 3, ...)Usually absorbed into the Miller indices, so n = 1 in modern practice
λWavelength of the radiationångström (Å) or nanometre (nm)1 Å = 0.1 nm = 10⁻¹⁰ m
dSpacing between adjacent lattice planesÅ or nmDepends on the crystal and on which planes (hkl) you mean
θGlancing angle between beam and planesdegreesAlso called the Bragg angle; the instrument often reports 2θ
2θAngle between incident and diffracted beamsdegreesWhat a powder diffractometer scan is plotted against

Two things follow from the equation before any numbers go in. First, sin θ can never exceed 1, so nλ ≤ 2d. A wavelength more than twice the largest plane spacing produces no Bragg reflection at all, which is why visible light (hundreds of nanometres) does not diffract from atomic planes while X-rays (around a tenth of a nanometre) do. Second, for a fixed wavelength, smaller spacings give larger angles. The finest detail you can ever resolve with a given wavelength is d = λ/2, reached at θ = 90°, when the beam bounces straight back.

Bragg's law in energy units

X-ray sources are often described by photon energy rather than wavelength. Since E = hc/λ, and the 2019 SI fixes h, c and the elementary charge e exactly, the conversion constant is exact too:

λ (Å) = 12.398 42 / E (keV)

Using the CODATA values for the Planck constant (6.626 070 15 × 10⁻³⁴ J s, exact), the speed of light (299 792 458 m/s) and e (1.602 176 634 × 10⁻¹⁹ C), hc/e works out to 12 398.42 eV·Å. Copper Kα₁ at 1.540 592 9 Å therefore corresponds to 8.0478 keV. Synchrotron beamlines quote energies such as 12 keV, which is 1.0332 Å. If you work in energy, Bragg's law becomes E = n · 12.398 42 / (2d sin θ), which is the form energy dispersive detectors use.

Who discovered Bragg's law, and when?

The story starts with Max von Laue, who received the 1914 Nobel Prize in Physics "for his discovery of the diffraction of X-rays by crystals." Laue's experiment proved that X-rays are waves with wavelengths comparable to the distances between atoms, but his description of the spot patterns was mathematically involved.

The Nobel Prize facts page for William Lawrence Bragg explains what came next: Laue's discovery inspired William and Lawrence Bragg to study the effect, and their contribution was "establishing the relationship between the wavelength of the X-ray, its angle of incidence, and the distance between the atomic layers inside the crystal." The younger Bragg's insight was to treat the spots as reflections from planes of atoms, which turns a three dimensional interference problem into the single line above. His father built an X-ray spectrometer that measured the reflected intensity against angle, which made the method quantitative.

Their joint paper, "The reflection of X-rays by crystals," appeared in the Proceedings of the Royal Society of London, Series A, volume 88, pages 428 to 438, dated 1 July 1913 in the Crossref record. In 1915 the Nobel Committee awarded the Physics prize jointly to Sir William Henry Bragg and William Lawrence Bragg "for their services in the analysis of crystal structure by means of X-rays." Lawrence Bragg, born in Adelaide on 31 March 1890, was 25 at the time of the award, and the Nobel Prize site notes that he did the prize winning work when he was only 23.

A dated timeline

YearEventPrimary source
1913W. H. Bragg and W. L. Bragg publish "The reflection of X-rays by crystals," Proc. R. Soc. A 88, 428 to 438Crossref record, DOI 10.1098/rspa.1913.0040
1914Max von Laue receives the Nobel Prize in Physics for X-ray diffraction by crystalsNobelPrize.org
1915Both Braggs share the Nobel Prize in Physics for crystal structure analysis by X-raysNobelPrize.org
1929Louis de Broglie receives the Nobel Prize in Physics for the wave nature of electronsNobelPrize.org
1937Clinton Davisson and George Paget Thomson share the Nobel Prize in Physics for electron diffraction by crystalsNobelPrize.org
1994Clifford Shull (neutron diffraction) and Bertram Brockhouse (neutron spectroscopy) share the Nobel Prize in PhysicsNobelPrize.org
2012NIST issues SRM 2000, a calibration standard for high resolution X-ray diffraction on a SiGe layer over siliconNIST certificate, issue date 5 March 2012
2015NIST issues the SRM 660c LaB₆ line position standard certificateNIST certificate, issue date 29 October 2015
2022CODATA 2022 adjustment gives the silicon lattice parameter as 5.431 020 511(89) × 10⁻¹⁰ mNIST CODATA
2024NIST issues SRM 640g, the silicon powder line position standardNIST certificate, 27 February 2024

Why do X-rays diffract from crystal planes?

Diffraction is interference. When two waves of the same wavelength meet in step, crest on crest, their amplitudes add. When they meet half a wavelength out of step, crest on trough, they cancel. A crystal is a natural interference device because its atoms repeat with near perfect regularity over millions of unit cells.

The path difference argument

Picture two parallel planes of atoms a distance d apart. A beam arrives at glancing angle θ. Part of it reflects from the top plane; part travels on and reflects from the plane beneath. Leave the top reflection as the reference. The lower ray travels an extra stretch going down to the second plane and an equal extra stretch coming back up. Drop perpendiculars from the point where the upper ray reflects onto the lower ray's path and simple trigonometry gives each stretch as d sin θ. The total extra distance is:

path difference = 2 d sin θ

The two reflected waves leave in step only if that extra distance is a whole number of wavelengths, nλ. Set them equal and you have Bragg's law. Because a real crystal has thousands of planes, not two, the condition is extremely sharp: at an angle even slightly off, the contributions from deep planes drift steadily out of phase and cancel almost completely. That is why diffraction peaks from a good crystal are narrow.

What are Miller indices?

A crystal contains many families of planes, each tilted differently through the lattice. Miller indices are the standard way to name them. Take a plane, find where it cuts the three cell axes in units of the cell edges, take reciprocals, and clear fractions to the smallest whole numbers. The result (hkl) names the family.

A few cubic examples:

PlanesIntercepts on a, b, cMiller indicesCubic d-spacing
Cube faces1, ∞, ∞(100)a
Face diagonals1, 1, ∞(110)a / √2
Body diagonal planes1, 1, 1(111)a / √3
Half way across the cell½, ∞, ∞(200)a / 2

Negative intercepts are written with a bar over the number. Curly brackets such as a set written as the 111 family mean all symmetry equivalent planes; for a cubic crystal that family includes (111), (1̄11), (11̄1) and the rest, all with the same spacing.

How d-spacing depends on the lattice

The spacing between (hkl) planes follows from the cell geometry. The common cases:

Crystal system1 / d² equals
Cubic(h² + k² + l²) / a²
Tetragonal(h² + k²) / a² + l² / c²
Orthorhombich² / a² + k² / b² + l² / c²
Hexagonal4 (h² + hk + k²) / (3a²) + l² / c²

For this post we stay with cubic crystals, where one number, a, fixes every spacing.

Why some reflections are missing

Bragg's law tells you where a peak can appear. It does not promise one will. The intensity depends on the structure factor, which adds up the waves scattered by every atom in the unit cell with their phases. In some crystal structures those contributions cancel exactly for certain (hkl), and the reflection is systematically absent.

Silicon is the classic case. It has the diamond cubic structure: a face centred cubic lattice with a two atom basis. Reflections appear only when h, k and l are all odd, or all even with h + k + l divisible by 4. So silicon shows (111), (220), (311), (400), (331) and (422), but not (100), (110), (200) or (222). The NIST SRM 640g peak list, which runs (111), (220), (311), (400), (331), (422), (511), (440), (531), (620), (533), follows exactly this rule. Lanthanum hexaboride, by contrast, has a primitive cubic lattice, so every (hkl) is allowed, which is one reason it makes a good calibration standard with many evenly spread peaks.

Higher orders and why n is usually 1

Second order reflection from (111) planes, n = 2, satisfies 2λ = 2d₁₁₁ sin θ. Divide both sides by 2 and you get λ = 2(d₁₁₁/2) sin θ, which is first order reflection from a set of imaginary planes at half the spacing. Those are the (222) planes. Crystallographers therefore fold n into the indices and write every reflection as first order from (nh nk nl). In silicon, (222) is forbidden by the diamond structure rule, so the second order of (111) is, to a first approximation, absent.

Why instruments report 2θ

In a common laboratory powder diffractometer, the Bragg-Brentano geometry, the sample sits flat at the centre of a goniometer while the X-ray tube and detector move symmetrically. When the sample surface makes angle θ with the incoming beam, the detector sits at 2θ from the straight through direction, because the diffracted beam has been turned through twice the glancing angle. The scan is plotted against 2θ, and peak tables, including the NIST certificates quoted below, list 2θ. Before you put a number into Bragg's law, halve it.

Worked example 1: copper Kα X-rays on silicon

This is the canonical calibration calculation. We predict where silicon's first few peaks should appear with copper radiation and compare the prediction with NIST's published values.

Step 1: choose the wavelength carefully

A copper X-ray tube does not emit one wavelength. The NIST X-ray Transition Energies Database lists the strongest copper lines, measured directly, as:

Line (IUPAC and Siegbahn names)Wavelength (Å), direct experimental value
KL₃ (Kα₁)1.540 592 90(50)
KL₂ (Kα₂)1.544 427 40(50)
KM₃ (Kβ₁)1.392 2340(60)

Kα₁ and Kα₂ are a doublet about 0.0038 Å apart. Kβ is usually removed with a nickel filter or a monochromator. NIST's SRM 640g certificate computes its peak positions with λ = 0.154 059 29 nm, which is the same Kα₁ value in nanometres. We use it here.

Step 2: get the lattice parameter

CODATA 2022, as published by NIST, gives the lattice parameter of silicon as a = 5.431 020 511(89) × 10⁻¹⁰ m, that is 5.431 020 511 Å with an uncertainty in the eleventh significant figure. CODATA also lists the spacing of the ideal Si (220) planes directly: d₂₂₀ = 1.920 155 716(32) Å. You can check one against the other: 5.431 020 511 / √8 = 1.920 156 Å. They agree.

Step 3: compute d for the (111) planes

d(111) = a / √(1² + 1² + 1²) = 5.431 020 511 / 1.732 051 = 3.135 60 Å

Step 4: solve for θ

sin θ = λ / (2 d) = 1.540 592 9 / (2 × 3.135 60) = 0.245 661
θ = arcsin(0.245 661) = 14.2209°
2θ = 28.442°

Step 5: compare with NIST

NIST lists 28.441° for Si (111) in SRM 640g. The 0.001° gap is real and instructive. SRM 640g is a powder whose certified lattice parameter is 0.543 110 9 nm (expanded uncertainty 0.000 008 0 nm), slightly larger than the CODATA value for ideal crystalline silicon. Put 5.431 109 Å into the same calculation and 2θ comes out at 28.441°, matching the certificate. The lesson: a reference material is certified for itself, and when you calibrate an instrument against it you use its certified value, not a textbook one.

The full table

Repeating the steps for the reflections that diamond cubic silicon allows, with the CODATA lattice parameter and Cu Kα₁:

(hkl)h² + k² + l²d (Å)θ (degrees)2θ computed2θ, NIST SRM 640g
(111)33.135 6014.220928.44228.441
(220)81.920 1623.650947.30247.301
(311)111.637 5128.060756.12156.120
(400)161.357 7634.564369.12969.127
(331)191.245 9638.187376.37576.373
(422)241.108 6044.014188.02888.026

Every computed value sits 0.001° to 0.002° above NIST's, consistently, because of the small lattice parameter difference. A consistent offset like that is the signature of a parameter difference, not of an arithmetic error.

The Kα doublet in practice

Most laboratory tubes deliver both Kα₁ and Kα₂, roughly in a 2 to 1 intensity ratio, unless a monochromator strips Kα₂. Each reflection is then a pair of peaks. Repeat the calculation with λ = 1.544 427 4 Å:

(hkl)2θ with Kα₁2θ with Kα₂Separation
(111)28.442°28.514°0.072°
(400)69.129°69.325°0.197°
(533)136.888°137.616°0.728°

At low angles the two overlap into one slightly lopsided peak. At high angles they split cleanly. That growth with angle is a direct consequence of the equation: differentiate nλ = 2d sin θ at fixed d and you get Δθ = (Δλ/λ) tan θ, and tan θ climbs steeply as θ heads towards 90°.

Worked example 2: from a measured angle to d-spacing and the lattice parameter

Now run the law backwards, which is what a laboratory does every day. You have an unknown cubic powder and a diffractometer with Cu Kα₁. The first five peaks appear at these 2θ values:

21.358°, 30.385°, 37.442°, 43.507°, 48.958°

Step 1: halve each angle and solve for d

For the first peak, θ = 10.679°, sin θ = 0.185 31, and

d = λ / (2 sin θ) = 1.540 592 9 / (2 × 0.185 31) = 4.1569 Å

Doing the same for all five:

2θ measuredd (Å)1/d² (Å⁻²)Ratio to firstAssigned (hkl)
21.358°4.15690.057 871.000(100)
30.385°2.93940.115 742.000(110)
37.442°2.40000.173 613.000(111)
43.507°2.07840.231 494.000(200)
48.958°1.85900.289 365.000(210)

Step 2: index the pattern

For a cubic crystal, 1/d² = (h² + k² + l²)/a², so the values of 1/d² must stand in the ratio of integers that can be written as a sum of three squares. Here the ratios are 1, 2, 3, 4, 5: every integer in order. That pattern, with nothing missing, is the fingerprint of a primitive cubic lattice. A face centred cubic lattice would give ratios 3, 4, 8, 11, 12 (only all odd or all even indices), a body centred cubic lattice would give 2, 4, 6, 8, 10 (h + k + l even), and diamond cubic, as in silicon, gives 3, 8, 11, 16, 19.

Step 3: get the lattice parameter

Each peak gives an estimate, a = d √(h² + k² + l²). From (210): a = 1.8590 × √5 = 4.1568 Å. From (100): a = 4.1569 Å. The numbers agree to four decimals, and they match the value NIST certifies for its lanthanum hexaboride standard, SRM 660c: 0.415 682 6 nm ± 0.000 008 nm at 22.5 °C. These angles were in fact computed from that certified value, so the example closes the loop: the "unknown" was LaB₆.

Why high angles give better lattice parameters

Differentiate Bragg's law at fixed wavelength:

Δd / d = − cot θ · Δθ      (Δθ in radians)

Suppose your goniometer has an angle error of 0.01° in θ, which is 0.000 175 rad. At θ = 10.7° (the first LaB₆ peak), cot θ is 5.30, so the relative error in d is about 9.3 × 10⁻⁴. At θ = 70°, cot θ is 0.364 and the same angle error produces only 6.4 × 10⁻⁵, roughly fifteen times smaller. This is why precision lattice work uses high angle reflections, and why NIST standards list peaks up to about 137° in 2θ for silicon.

Real instruments also have a 2θ zero offset and sample height errors, which is why labs fit them as parameters and run a line position standard such as SRM 640g or 660c alongside unknowns.

Worked example 3: electrons and neutrons with de Broglie wavelengths

Bragg's law cares only about wavelength, not about what is doing the waving. Louis de Broglie proposed that any particle with momentum p has a wavelength λ = h/p, and the 1929 Nobel Prize recognised "his discovery of the wave nature of electrons." The 1937 prize to Davisson and Thomson, "for their experimental discovery of the diffraction of electrons by crystals," confirmed it experimentally. The 1994 prize recognised Clifford Shull "for the development of the neutron diffraction technique."

We use CODATA 2022 values: h = 6.626 070 15 × 10⁻³⁴ J s (exact), electron mass mₑ = 9.109 383 7139 × 10⁻³¹ kg, neutron mass mₙ = 1.674 927 500 56 × 10⁻²⁷ kg.

Electrons accelerated through a voltage

An electron accelerated through a potential difference V gains kinetic energy eV. At low voltages, p = √(2 mₑ e V), so:

λ = h / √(2 mₑ e V)

At 54 V, the energy used in the classic low energy electron experiments:

p = √(2 × 9.109 383 7 × 10⁻³¹ × 1.602 176 6 × 10⁻¹⁹ × 54) = 3.970 × 10⁻²⁴ kg m/s
λ = 6.626 070 15 × 10⁻³⁴ / 3.970 × 10⁻²⁴ = 1.669 × 10⁻¹⁰ m = 1.669 Å

That is close to copper X-ray wavelengths, so slow electrons diffract from crystal surfaces at similar, comfortably large angles. Because they penetrate only a few atomic layers, low energy electron diffraction is a surface technique.

At transmission electron microscope voltages, relativity matters. The momentum becomes p = √(2 mₑ e V (1 + eV / (2 mₑ c²))). The table compares both forms:

Accelerating voltageλ, non-relativistic (Å)λ, relativistic (Å)Error from ignoring relativity
54 V1.6691.669negligible
100 V1.2261.226negligible
200 kV0.02740.0251about 9%
300 kV0.02240.0197about 14%

Now apply Bragg's law with 200 kV electrons to silicon (220), d = 1.920 16 Å:

sin θ = 0.025 08 / (2 × 1.920 16) = 0.006 531
θ = 0.374° = 6.53 mrad

The Bragg angle is under four tenths of a degree. Electron diffraction patterns in a microscope therefore spread over a few degrees in total, and sin θ ≈ θ is an excellent approximation. That small angle regime is why electron diffraction is often analysed with a flat projection of reciprocal space.

Thermal neutrons

Neutrons from a reactor are slowed in a moderator until they are near room temperature. The reference speed for thermal neutrons is 2,200 m/s. Then:

λ = h / (mₙ v) = 6.626 070 15 × 10⁻³⁴ / (1.674 927 5 × 10⁻²⁷ × 2200) = 1.798 Å
E = ½ mₙ v² = 25.3 meV

A thermal neutron's wavelength is almost the same as a copper X-ray's, so the same planes diffract at similar angles. For silicon (111):

sin θ = 1.798 / (2 × 3.135 60) = 0.2867
θ = 16.66°, 2θ = 33.33°

What changes is what the radiation sees. X-rays scatter from electrons, so heavy atoms dominate and hydrogen is nearly invisible. Neutrons scatter from nuclei, with strengths that vary irregularly from element to element and even between isotopes, and they carry a magnetic moment. That makes neutron diffraction the method of choice for locating hydrogen (or deuterium), telling neighbouring elements apart and mapping magnetic order. The open source refinement package GSAS-II, for example, describes itself as supporting "both x-ray and neutron probes," including constant wavelength and time of flight neutron data.

Worked example 4: strain in a thin film from a peak shift

Chip makers deliberately strain silicon and grow thin layers such as silicon germanium on silicon. A layer that is compressed in the plane of the wafer expands perpendicular to it, which changes the out of plane d-spacing and moves the corresponding diffraction peak. Bragg's law turns that shift into a strain.

Take the symmetric (004) reflection of the silicon substrate with Cu Kα₁. From Example 1, d₀₀₄ = a/4 = 1.357 755 Å, θ = 34.5643° and 2θ = 69.129°. A thin layer on top produces its own (004) peak, 0.20° lower in θ (0.40° lower in 2θ).

Small shift approximation

ε = Δd / d = − cot θ · Δθ
  = − cot(34.5643°) × (−0.20° × π / 180)
  = − 1.4515 × (−0.003 491)
  = + 0.005 07

The layer's out of plane spacing is about 0.51% larger than the substrate's.

Exact check

θ_layer = 34.3643°
d_layer = 1.540 592 9 / (2 sin 34.3643°) = 1.364 68 Å
ε = (1.364 68 − 1.357 755) / 1.357 755 = + 0.005 10

The approximation is good to about 1% of the strain value at this shift and gets better for smaller shifts. Turning out of plane strain into in plane strain, germanium fraction or relaxation needs elastic constants and asymmetric reflections, and real analysis fits the whole rocking curve with dynamical diffraction theory. The point of the example is the first step: Bragg's law converts a fraction of a degree into a strain of a fraction of a percent.

How X-ray diffraction is used

Protein crystallography

Protein crystallography uses Bragg's law on a crystal whose unit cell can be tens to hundreds of ångströms across, containing one or more protein molecules. The RCSB Protein Data Bank's educational guide describes the process: the protein is purified and crystallised, then exposed to an intense X-ray beam, and the crystal diffracts the beam "into one or another characteristic pattern of spots." Each spot is a Bragg reflection from one (hkl) family. Its position follows from Bragg's law and the cell; its intensity encodes the arrangement of atoms.

The catch is that a detector records only intensities, not the phases of the diffracted waves. Recovering the phases, the "phase problem," needs extra information: a related known structure, heavy atom derivatives, or anomalous scattering near an absorption edge. With phases in hand, a Fourier transform gives an electron density map that scientists interpret atom by atom.

Bragg's law sets the resolution limit. The highest resolution reflection you record, d_min, comes from the largest angle you capture. A structure at "2.0 Å resolution" means reflections out to d = 2.0 Å were used. With Cu Kα (λ ≈ 1.5406 Å) that needs 2θ = 45.3°. At a synchrotron set to λ = 1.0 Å, the same 2.0 Å data sit at 2θ = 29.0°, so a flat detector can capture higher resolution within a smaller angular range. The theoretical floor for any wavelength is d = λ/2 at 2θ = 180°; for Cu Kα that is 0.77 Å.

X-ray diffraction still dominates the archive. On 24 October 2026 the RCSB search API returned 208,325 entries with experimental method "X-RAY DIFFRACTION" out of 261,139 entries determined by experimental methods, about 80%. That share has been falling as cryo-electron microscopy grows, so treat the figure as a dated snapshot rather than a trend.

Open source software carries much of this work. DIALS, for "Diffraction Integration for Advanced Light Sources," describes itself as a collaborative project to build diffraction integration software for modern pixel array detectors, micro focus beamlines and X-ray free electron lasers. The Computational Crystallography Toolbox (cctbx) is an open source library on which many crystallography programs build.

Powder diffraction for materials identification

A powder contains millions of tiny crystals in random orientations, so for every (hkl) some fraction is always at the right angle. The result is a set of cones that a detector sweeping 2θ records as a one dimensional pattern of peaks. Peak positions come from Bragg's law and the cell; relative intensities come from the structure; the whole pattern is a fingerprint.

Typical uses:

  • Phase identification. Match peak positions and intensities against a reference database to say whether a white powder is quartz, calcite or something else, and in what proportions.
  • Lattice parameters and solid solutions. As composition changes in an alloy or a doped ceramic, the cell expands or contracts and every peak shifts, which Bragg's law turns into a lattice parameter.
  • Crystallite size and microstrain. Small crystallites and microscopic strain broaden peaks; the angle dependence of the broadening separates the two.

Rietveld refinement fits the entire calculated pattern to the measured one, refining lattice parameters, atomic positions, peak shapes and instrument errors together. GSAS-II, an open source Python project, is one widely used package for this, covering powder and single crystal data.

NIST's line position standards exist for this world. The SRM 640g certificate says its certified values are "intended for the calibration of powder diffraction equipment with respect to line position and profile breadth as a function of 2θ angle." Running a standard and fitting the offsets is how a lab knows its peak positions are right before it trusts a lattice parameter from an unknown.

Thin films and strain in semiconductor fabs

Semiconductor manufacturing uses high resolution X-ray diffraction (HRXRD) to check epitaxial layers: their thickness, composition, strain and degree of relaxation. The instrument uses a highly collimated, monochromatic beam and scans a fraction of a degree around a substrate reflection, recording a rocking curve. Layers produce their own peaks offset from the substrate peak, and thin layers produce interference fringes whose spacing gives thickness.

NIST's SRM 2000 shows what metrology grade looks like here. The certificate describes 25 mm by 25 mm by 0.725 mm (100) oriented silicon specimens carrying "a nominal 50 nm Si0.85Ge0.15 epitaxial layer and 25 nm Si cap." It certifies an SI traceable Si (220) d-spacing of 0.192 016 1 nm at 22.5 °C (expanded uncertainty 0.000 000 9 nm), the wafer miscut, and the angle of the Si (004) reflection from the wafer surface, so that fab and laboratory instruments can be calibrated against the same artefact. Its value for d₂₂₀ agrees with the CODATA ideal silicon value, 1.920 155 716 Å, to within the stated uncertainty.

The certificate also explains why a single peak measured in reflection is not enough: interpreting it "requires substantial knowledge about instrument alignment and goniometer orientation," and reflection geometry needs corrections including the index of refraction. NIST instead measures the (220) reflection in transmission at both plus and minus the Bragg angle, so the angle between the two peaks is exactly 2θ_B, which removes several alignment errors at once. It is a nice reminder that Bragg's law is simple and the metrology around it is not.

Radiation types compared

RadiationTypical wavelengthHow it is producedScatters fromTypical diffraction use
Lab X-rays, Cu Kα₁1.5406 ÅSealed tube or rotating copper anodeElectronsPowder XRD, thin films, small molecule and protein crystals
Lab X-rays, Mo Kα₁0.7093 ÅMolybdenum anodeElectronsSmall molecule single crystals, more penetrating samples
Synchrotron X-raysabout 0.5 to 2 Å, tunableElectron storage ringElectronsProtein crystallography, anomalous phasing, fast and in situ studies
Thermal neutronsabout 1 to 2.5 Å (1.80 Å at 2,200 m/s)Research reactor or spallation sourceNuclei and magnetic momentsHydrogen positions, magnetic structures, bulk residual stress
Low energy electronsabout 1 to 2 Å (1.67 Å at 54 eV)Electron gun, tens to hundreds of voltsElectrostatic potentialSurface structure
Microscope electronsabout 0.02 to 0.03 Å (0.025 Å at 200 kV)Transmission electron microscopeElectrostatic potentialDiffraction from nanometre regions, phase mapping

Common laboratory anode lines

From the NIST X-ray Transition Energies Database, direct experimental Kα₁ (KL₃) wavelengths:

AnodeKα₁ wavelength (Å)Photon energy (keV)Why labs pick it
Chromium2.289 7265.415Longer wavelength spreads peaks out; used for stress work in steels
Cobalt1.788 9966.930Avoids strong fluorescence from iron rich samples under copper
Copper1.540 5938.048General purpose default for powders and films
Molybdenum0.709 31717.479Shorter wavelength reaches more reflections; single crystals
Silver0.559 42222.163Even shorter wavelength; high penetration and total scattering

The energies follow from E = 12.398 42 / λ. The last column describes common practice, not a rule.

An X-ray safety note

Diffraction instruments make ionising radiation, and the primary beam from even a small laboratory tube can cause serious local injury in seconds to a hand or an eye placed in it. This post explains the physics only. Do not build, modify or open an X-ray source, and do not operate one outside an approved programme.

What the rules look like in the United States, as examples:

  • Enclosed systems. The FDA performance standard for cabinet X-ray systems, 21 CFR 1020.40, limits leakage to "an exposure of 0.5 milliroentgen in one hour at any point five centimeters outside the external surface," requires safety interlocks on doors and access panels whose opening must physically disconnect the energy supply to the high voltage generator, and requires a key actuated control so that X-ray generation is not possible with the key removed.
  • Occupational dose. The Nuclear Regulatory Commission's limit in 10 CFR 20.1201 is an annual total effective dose equivalent of 5 rems (0.05 Sv) for adults, with separate limits for the lens of the eye of 15 rems (0.15 Sv) and for the skin and extremities of 50 rems (0.5 Sv). OSHA's general industry standard for ionising radiation, 29 CFR 1910.1096, sets quarterly limits for individuals in restricted areas, including 1¼ rems per calendar quarter to the whole body.
  • Open beam and analytical equipment is often registered and inspected by state radiation control programmes, with their own training and survey requirements. Your institution's radiation safety officer will know which rules apply.

Practical habits that every diffraction lab teaches: complete the site training before touching an instrument; never defeat, tape over or "temporarily" bypass an interlock; check shutter and warning lights before opening an enclosure; wear the dosimeter you are issued; and report any interlock fault rather than working around it. Synchrotron and neutron facilities run their own access controls and search procedures before beam is allowed into a hutch, and those procedures are not optional either.

Step by step: compute Bragg angles in Python and check them against NIST

You can reproduce every number in this post with a short script and no special libraries. Below is a walkthrough on a laptop. These commands only read and print; nothing here touches an instrument.

1. Create an isolated environment

python3 -m venv bragg-env
source bragg-env/bin/activate
python -m pip install --upgrade pip

2. Write the calculator

Save this as bragg.py:

"""Bragg's law calculator: n * lambda = 2 * d * sin(theta).

Values: Cu K-alpha-1 from the NIST X-ray Transition Energies Database,
Si lattice parameter from CODATA 2022 (NIST).
"""
from math import asin, sin, sqrt, degrees, radians

CU_KA1 = 1.54059290          # angstrom, NIST direct experimental KL3
SI_A = 5.431020511           # angstrom, CODATA 2022

# Constants for de Broglie wavelengths (CODATA 2022)
H = 6.62607015e-34           # J s, exact
E_CHARGE = 1.602176634e-19   # C, exact
C = 299792458.0              # m/s, exact
M_E = 9.1093837139e-31       # kg
M_N = 1.67492750056e-27      # kg


def d_cubic(a, h, k, l):
    """Plane spacing for a cubic lattice."""
    return a / sqrt(h * h + k * k + l * l)


def two_theta(wavelength, d, n=1):
    """Return 2-theta in degrees, or None if no reflection is possible."""
    s = n * wavelength / (2.0 * d)
    if s > 1.0:
        return None
    return 2.0 * degrees(asin(s))   # asin returns radians


def d_from_two_theta(wavelength, tt_deg, n=1):
    """Run Bragg's law backwards from a measured 2-theta."""
    theta = radians(tt_deg / 2.0)   # halve FIRST, then convert
    return n * wavelength / (2.0 * sin(theta))


def electron_wavelength(volts):
    """Relativistic de Broglie wavelength in angstrom."""
    ev = E_CHARGE * volts
    p = sqrt(2 * M_E * ev * (1 + ev / (2 * M_E * C * C)))
    return H / p * 1e10


def neutron_wavelength(speed):
    return H / (M_N * speed) * 1e10


def diamond_allowed(h, k, l):
    """Diamond cubic rule: all odd, or all even with h+k+l divisible by 4."""
    parities = {h % 2, k % 2, l % 2}
    if parities == {1}:
        return True
    if parities == {0}:
        return (h + k + l) % 4 == 0
    return False


if __name__ == "__main__":
    print("Silicon, Cu K-alpha-1")
    for hkl in [(1, 1, 1), (2, 2, 0), (3, 1, 1), (4, 0, 0), (3, 3, 1), (4, 2, 2)]:
        assert diamond_allowed(*hkl)
        d = d_cubic(SI_A, *hkl)
        print(f"  {hkl}: d = {d:.5f} A, 2theta = {two_theta(CU_KA1, d):.3f} deg")

    print("Measured peak at 21.358 deg 2theta ->",
          f"d = {d_from_two_theta(CU_KA1, 21.358):.4f} A")
    print(f"Electron at 200 kV: {electron_wavelength(200e3):.5f} A")
    print(f"Neutron at 2200 m/s: {neutron_wavelength(2200):.4f} A")

3. Run it and compare

python bragg.py

Expected output:

Silicon, Cu K-alpha-1
  (1, 1, 1): d = 3.13560 A, 2theta = 28.442 deg
  (2, 2, 0): d = 1.92016 A, 2theta = 47.302 deg
  (3, 1, 1): d = 1.63751 A, 2theta = 56.121 deg
  (4, 0, 0): d = 1.35776 A, 2theta = 69.129 deg
  (3, 3, 1): d = 1.24596 A, 2theta = 76.375 deg
  (4, 2, 2): d = 1.10860 A, 2theta = 88.028 deg
Measured peak at 21.358 deg 2theta -> d = 4.1569 A
Electron at 200 kV: 0.02508 A
Neutron at 2200 m/s: 1.7982 A

Then open the SRM 640g certificate and check the table against its Appendix A. If you change SI_A to the certified 5.431 109 Å, the (111) and (220) values become 28.441° and 47.301°, matching NIST to the last digit.

4. Optional: let an open source library build the whole pattern

For full patterns with intensities, materials libraries do the structure factor work. With pymatgen, for example:

python -m pip install pymatgen
from pymatgen.core import Lattice, Structure
from pymatgen.analysis.diffraction.xrd import XRDCalculator

a = 5.431020511
coords = [
    [0, 0, 0], [0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0],
    [0.25, 0.25, 0.25], [0.25, 0.75, 0.75], [0.75, 0.25, 0.75], [0.75, 0.75, 0.25],
]
si = Structure(Lattice.cubic(a), ["Si"] * 8, coords)

calc = XRDCalculator(wavelength="CuKa1")
pattern = calc.get_pattern(si, two_theta_range=(20, 90))
for tt, inten, hkls in zip(pattern.x, pattern.y, pattern.hkls):
    print(f"{tt:8.3f}  {inten:6.1f}  {hkls[0]['hkl']}")

pymatgen's documentation lists the named wavelengths its XRDCalculator accepts, from CuKa, CuKa1 and CuKa2 through molybdenum, chromium, iron, cobalt and silver lines. In the current source, the default CuKa is a blended value of 1.54184 Å and CuKa1 is 1.54056 Å, rounded slightly differently from NIST's 1.540 592 9 Å. Name the line explicitly, and expect differences of around a thousandth of a degree when you compare with a certificate. The silicon structure is written out atom by atom here to avoid any ambiguity about space group origin settings.

5. Pin what you installed

Scientific Python stacks pull in dozens of transitive packages. Record exactly what you ran:

python -m pip freeze > requirements.txt

Commit requirements.txt with the analysis so anyone can rebuild the same environment, and so you can later check those exact versions against vulnerability advisories. More on that in the bridge section below.

Common mistakes

  1. Degrees versus radians. Most programming languages' sin and asin work in radians. Feed 14.221 (degrees) straight into sin and you get 0.9965 instead of 0.2457, and the "answer" is nonsense. Convert with radians() going in and degrees() coming out.
  2. Using 2θ where θ belongs. The instrument reports 2θ. Bragg's law needs θ. Plugging 28.442° straight in gives d = 1.62 Å for silicon (111) instead of 3.136 Å, which looks plausible enough to slip through. Halve first, always.
  3. Forgetting the factor of 2 in 2d sin θ. The path difference is down and back up. Dropping the 2 doubles every d-spacing.
  4. Using the wrong wavelength. Copper Kα₁, Kα₂, a weighted Kα average and Kβ all differ. A 0.1% wavelength error is a 0.1% d-spacing error, which is enormous in lattice parameter work. State which line you used.
  5. Ignoring systematic absences. Predicting a silicon (200) or (222) peak, or indexing a face centred cubic pattern as primitive, comes from forgetting the structure factor. Check the allowed reflection rule for the structure before you assign indices.
  6. Treating sin θ above 1 as a rounding issue. If λ/(2d) is greater than 1, that reflection does not exist for that wavelength. It is physics, not a bug.
  7. Using a textbook lattice parameter for a certified standard. As the SRM 640g comparison showed, the certified value for the actual material is what calibrates the instrument.
  8. Ignoring relativity for microscope electrons. At 200 kV the non-relativistic formula is about 9% off.
  9. Trusting a single low angle peak for precision. Δd/d = −cot θ · Δθ makes low angle peaks the least precise. Use many peaks and high angles, and fit instrument errors.
  10. Defeating an interlock "for a quick look." See the safety section. There is no quick look.

FAQ

What is Bragg's law in simple terms?

When waves hit a stack of evenly spaced layers, the reflections from different layers only add up at particular angles, the ones where the extra distance travelled by the deeper reflection is a whole number of wavelengths. Bragg's law, nλ = 2d sin θ, tells you those angles. Turn it around and a measured angle tells you the layer spacing.

What is the difference between θ and 2θ in X-ray diffraction?

θ is the glancing angle between the incoming beam and the crystal planes. 2θ is the angle between the incoming and diffracted beams, which is what most diffractometers record. Bragg's law uses θ, so halve the instrument reading first.

What wavelength is copper Kα radiation?

The NIST X-ray Transition Energies Database gives the direct experimental copper Kα₁ wavelength as 1.540 592 90 Å and Kα₂ as 1.544 427 40 Å. Many software packages also offer a weighted Kα average; check which one your analysis uses.

Why do X-rays diffract from crystals but visible light does not?

Bragg's law requires λ ≤ 2d. Atomic plane spacings are a few ångströms, so only radiation with wavelengths of that order can satisfy it. X-rays, thermal neutrons and fast electrons qualify. Visible light, at thousands of ångströms, does not, although it does diffract from structures with spacings near its own wavelength, such as the grooves on an optical disc.

Can Bragg's law be used with electrons and neutrons?

Yes. Any particle with momentum p has a de Broglie wavelength λ = h/p, and Bragg's law applies unchanged. Thermal neutrons at 2,200 m/s have λ ≈ 1.80 Å. Electrons at 200 kV have λ ≈ 0.025 Å after the relativistic correction.

Who discovered Bragg's law?

William Lawrence Bragg and his father William Henry Bragg. Their joint paper on the reflection of X-rays by crystals was published in 1913 in the Proceedings of the Royal Society, and they shared the 1915 Nobel Prize in Physics.

How is X-ray diffraction used in semiconductor manufacturing?

High resolution X-ray diffraction measures the thickness, composition, strain and relaxation of epitaxial layers such as silicon germanium on silicon by recording small shifts and fringes around substrate reflections. NIST's SRM 2000 is a calibration standard made for exactly this, with a 50 nm Si0.85Ge0.15 layer on silicon.

Is X-ray diffraction dangerous?

The instruments produce ionising radiation, and the direct beam can injure tissue quickly. Enclosed instruments are built with interlocks and shielding to keep exposure very low in normal use. Operate them only after site training, under your institution's radiation safety programme, and never bypass an interlock.

The software around diffractometers: an honest bridge

Nothing about Safeguard measures angles, refines structures or calibrates goniometers, and Safeguard's models are single purpose security models that do not solve physics problems. The connection is narrower and practical. A modern diffraction lab runs on software: instrument control firmware and drivers from the manufacturer, a data acquisition PC, and an analysis stack that is very often open source Python and C++ (integration packages such as DIALS, toolkits such as cctbx, refinement suites such as GSAS-II, and materials libraries such as pymatgen, each with its own tree of dependencies from numerical libraries to plotting packages). Those dependencies receive security fixes like any other software, and a pipeline that pulls them into a shared server or a web facing results portal inherits their vulnerabilities. Knowing exactly which versions your analysis environment and services contain, and updating them on purpose, is ordinary software hygiene that applies to a crystallography group as much as to a web team. Instrument firmware itself comes from the instrument vendor, and its updates have to come through that vendor.

Rebuilding an analysis environment or a lab results service pulls dependencies again, and scientific Python stacks are deep. The section below is our standard guide to closing the gap between a published fix and the version you actually run; it applies to the open source code you build and deploy, not to the diffractometer.

Fix it without waiting for upstream

Whatever the vulnerability, most of the risk sits in two gaps. The first is the time between a fix being published and that fix actually running in your production builds. The second, and worse, is the time before any fix exists at all, while a maintainer works out a patch and a release schedule. Waiting through both gaps is a habit, not a requirement. Safeguard gives teams three ways to close them.

1. Autonomous remediation: pull requests, not tickets

When a fixed version exists, Safeguard's Griffin models open a tested, policy gated pull request that moves the affected dependency to the safe version. You can run it on one repository or in bulk across every project that carries the vulnerable version. Remediation covers eight categories, including dependencies, licenses, security posture and findings. Reachability analysis ranks the vulnerable code paths your application actually calls first, so the first pull requests you merge are the ones that matter most. Autonomous remediation ships switched off, with every category set to Manual, so your team decides how much runs on its own and what still needs a human approval.

2. Gold Open Source: the safe version in seconds, free

gold.safeguard.sh is free and needs no login. Search any CVE or package to see affected and fixed versions, CVSS, EPSS, CISA KEV status and a recommended safe version, or use the "Am I affected?" checker. The same data is available through a free read API, README status badges and RSS threat feeds. The safeguard-sh/gold-scan-action GitHub Action can fail a build on a known exploited vulnerability, on any known vulnerability, or never, so a version you have just removed cannot quietly come back in next week's merge.

3. Gold Registry: start from components that are already fixed

registry.safeguard.sh provides hardened, drop in replacements for upstream packages and container images. Every Gold artifact is held continuously to zero exploitable critical or high CVEs, zero malware and a completed license check, with SLSA L3 or higher provenance, a Sigstore signature and a public evidence page you can hand to an auditor. An artifact loses its Gold badge if it regresses. Teams can point their own package directory at the registry so hardened equivalents resolve without changing how developers install anything.

When upstream has no fix yet, or will not ship one, Safeguard first works to get the fix accepted upstream. If the issue is severe or upstream will not move, Safeguard builds a fork, fixes the vulnerability there and publishes a hardened Gold build, so you are not stuck on a maintainer's release schedule. You can also request a hardened, compatibility tested build of a specific package. This fork and patch flow is in early access today, so ask which packages it covers before you plan around it.

Your situationWhat to use
A fixed version existsAutonomous remediation opens the upgrade pull request; Gold Open Source confirms the safe version
You need to know today whether you are affectedGold Open Source lookup and "Am I affected?" checker, free and without login
You want vulnerable versions to stop shippingThe Gold scan GitHub Action in CI, plus Safeguard policies and gates
Upstream has no fix yet, or will not ship oneA custom Gold request; fork and patch (early access)
You want to start clean on new projectsPull hardened components and images from Gold Registry

One honest limit: when the vulnerable code lives in a vendor appliance, a hosted service or an operating system runtime you do not build yourself, the fix still has to come from that vendor or distribution. The steps above apply to the open source dependencies and container images you build and ship, which is where most teams carry the largest and least tracked share of their exposure.

See how Safeguard would help

None of these demos involve diffraction, crystallography or instrument analysis; they show the software side described in the bridge above.

The first demo is a real Safeguard CLI session: it installs the CLI, opens the interactive terminal and asks it to fix a lodash CVE in a repository. It reads the finding and advisory, asks before each command, edits package.json to lodash 4.17.21, runs npm install and npm test with approval, prints a summary and pushes nothing. The same flow applies to a results dashboard or sample tracking web app a lab maintains: scan the repository, then let the assistant propose the dependency upgrade under your approval.

Click through it at your own pace, or open it full screen.

The second demo sets up the Safeguard runner on your own machine, approves it with its device code and then scans from the terminal. That suits research groups who keep analysis scripts and their pinned requirements.txt on their own workstations or cluster nodes and want the scan to run where the code lives.

Click through it at your own pace, or open it full screen.

The third demo connects Claude to the Safeguard MCP server with OAuth and lets you choose which tools Claude can use. For a scientist who already uses Claude while writing a data reduction pipeline, it brings dependency findings into the same conversation, limited to the tools you allow.

Click through it at your own pace, or open it full screen.

To try it on your own repositories, download Safeguard and follow the CLI documentation.

Quick check

Copper Kα₁ X-rays (λ = 1.5406 Å) hit silicon (220) planes, d = 1.9202 Å. At what 2θ does the peak appear?

sin θ = 1.5406 / (2 × 1.9202) = 0.4012, so θ = 23.65° and 2θ = 47.30°. NIST lists 47.301° for the (220) peak of its silicon powder standard, SRM 640g.

A thermal neutron travels at 2,200 m/s. What is its wavelength, and why does that make neutrons useful for diffraction?

λ = h / (mv) = 6.626 × 10⁻³⁴ / (1.6749 × 10⁻²⁷ × 2200) ≈ 1.80 Å. That is close to typical interatomic spacings and to copper X-ray wavelengths, so crystal planes diffract neutrons at convenient angles. Because neutrons scatter from nuclei rather than electrons, they can locate light atoms such as hydrogen and reveal magnetic order that X-rays struggle to see.

Sources

Last reviewed: 24 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.