+
Visualizing X-Ray Diffraction

Developed by W. Brian Lane - Published October 6, 2020

This exercise set enables students to visualize the results of an xray diffraction experiment using a tunable sample. By varying the lattice constants (edge lengths $a$, $b$, and $c$ and angles $\alpha$, $\beta$, and $\gamma$), students can explore the impact of the lattice geometry on the interference pattern, presented in two dimensions to mimic the Laue dots produced in crystallography. This exercise set was first deployed in a junior-level modern physics course, and would make an appropriate complement to crystallography experiments. The mathematics employed (although lengthy in the calculation of the plane separation $d$) is algebra-based and therefore accessible to first-year students, as well.
Subject Areas Modern Physics, Waves & Optics, and Condensed Matter Physics First Year and Beyond the First Year IPython/Jupyter Notebook and Python After completing this assignment, students will be able to... * Apply the crystal model of solids to make comparisons between two materials. (Exercise 1) * Describe the process of xray diffraction. (Exercises 2 and 3) * Describe the use of xray diffraction to determine the structure of a crystal. (Exercises 2 and 3) * Examine the outcomes of an xray diffraction experiment using a simulation. (Exercise 4) * Explain the relationship between a crystal structure and the diffraction pattern it produces. (Exercises 4 and 5) * Modify a crystal model and examine the changes in the diffraction pattern it produces. (Exercise 5) 120 min

These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).

# Exercise 1 Describe the impact that the lattice structures of graphite and diamond have on those materials' strengths. Think about the proximity of the atoms and their bonds between each other. # Exercise 2 Xray diffraction allows us to infer the lattice structure of a sample based on the interference pattern created by that structure. Describe the physical process that gives rise to this interference. Then describe how that physical process helps us figure out a solid's lattice structure. You'll probably want to consult Section S3.2 of [this introductory reference](https://matterandinteractions.org/wp-content/uploads/2016/07/Supplement3-Waves.pdf), particularly Figures S3.16 and S3.17. # Exercise 3 We can simulate the xray diffraction pattern produced by a known lattice structure to help us match experiment with theory. First, we specify a lattice structure by specifying three parameters: **edge lengths** $a$, $b$, and $c$, and **angles** between the edges $\alpha$, $\beta$, and $\gamma$ as depicted here: ![](images/xraydiff/lattice_cell.png "") For example, graphite (pictured below) has $a = b = 2.46 \times 10^{-10}$ meters, $c = 6.71 \times 10^{-10}$ meters, $\alpha = \beta = 90^\circ$, and $\gamma = 120^\circ$. ![](images/xraydiff/graphite_and_diamond.png "") Second, we define **primitive vectors** $\vec{a}$, $\vec{b}$, and $\vec{c}$ along each edge of the crystal lattice. The planes that we detect in xray diffraction are based on these vectors. For simplicity, we place $\vec{a}$ along the $x$-axis and $\vec{b}$ in the $xy$-plane, such that only $\vec{c}$ has a $z$-component: $$\begin{eqnarray} \vec{a} & = & a \hat{x} \\ \vec{b} & = & b(\cos\gamma \hat{x} + \sin\gamma \hat{y} )\\ \vec{c} & = & c \left[ \cos\beta \hat{x} + \frac{\cos\alpha-\cos\beta\cos\gamma}{\sin\gamma} \hat{y} + \sqrt{1-\cos^2\beta - \frac{(\cos\alpha-\cos\beta\cos\gamma)^{2}}{\sin^{2}\gamma}} \hat{z} \right]. \end{eqnarray}$$ This arrangement guarantees, for example, that the angle between $\vec{a}$ and $\vec{b}$ is $\gamma$. Third, we define **reciprocal vectors** as $$\begin{eqnarray} \vec{a}^* & = & 2\pi \frac{\vec{b}\times\vec{c}}{\vec{a}\cdot\vec{b}\times\vec{c}} \\ \vec{b}^* & = & 2\pi \frac{\vec{c}\times\vec{a}}{\vec{a}\cdot\vec{b}\times\vec{c}} \\ \vec{c}^* & = & 2\pi \frac{\vec{a}\times\vec{b}}{\vec{a}\cdot\vec{b}\times\vec{c}}. \end{eqnarray}$$ These reciprocal vectors are defined such that $\vec{a}^\* \cdot \vec{b} = \vec{a}^\* \cdot \vec{c} = 0$, etc., even though $\vec{a}$, $\vec{b}$, and $\vec{c}$ don't have to be orthogonal. Fourth, each plane in the crystal lattice that produces xray diffraction has a **normal vector** given by $$\hat{n} = h \vec{a}^* + k \vec{b}^* + l \vec{c}^*,$$ where the integers $h$, $k$, and $l$ are the plane's **Miller indices**. We denote a plane in a crystal lattice by $(hkl)$, its triplet of Miller indices. Finally, because the unit cell repeats throughout the solid, each $(hkl)$ plane repeats throughout the solid, separated by a distance given by (deep breath) $$d = \sqrt{ \frac{1 - \cos^2(\alpha) - \cos^2(\beta) - \cos^2(\gamma) + 2 \cos(\alpha) \cos(\beta) \cos(\gamma)} {\frac{h^2}{a^2} \sin^2(\alpha) + \frac{k^2}{b^2}\sin(\beta)^2 + \frac{l^2}{c^2} \sin^2(\gamma) + \frac{2kl}{bc} (\cos(\beta) \cos(\gamma)-\cos(\alpha)) + \frac{2hl}{ac} (\cos(\alpha) \cos(\gamma)-\cos(\beta)) + \frac{2kh}{ba} (\cos(\beta) \cos(\alpha)-\cos(\gamma))} }$$ Here's the important part: **This is the $d$ that appears in the xray diffraction condition** $$2d\sin(\theta) = n \lambda,$$ which tells us at what angle $\theta$ we'll see a bright spot in the outgoing xray interference pattern. Here, $\lambda$ is the wavelength of the xrays and $n$ is an integer representing constructive interference. Now that ~~we~~ the computer can compute this $d$, we can determine at what angles $\theta$ a given $(hkl)$ plane will produce a bright spot in the diffraction pattern. * Suppose you were conducting a diffraction study of graphite. Write a few lines of code that will calculate the value of $d$ for the $(100)$ plane. (Note that this computation is simplified with the $0$s and the $90^\circ$s.) * Choose a wavelength $\lambda$ of electromanetic radiation that would be appropriate to use in studying this plane. Confirm that $\lambda$ falls in the xray specturm. * Calculate a non-zero value of $\theta$ where you would expect to find a bright spot during this diffraction study. Finally, we determine where on the screen the bright spots will appear based on $\theta$ and the direction of the incoming beam. If the incoming beam, for example, is directed along the $z$-axis, and the interference deflects the beam by an angle $\theta$ toward the direction $\hat{n}$ that is perpendicular to the plane that caused the interference, then the outgoing beam travels a displacement of $\Delta \vec{r} = z_{\mathrm{screen}}(\hat{z} + \sin\theta\hat{n})$, where $z_{\mathrm{screen}}$ is the distance to the screen. We can then obtain the $x$ and $y$-components of the bright spot on the screen using the dot products $\hat{x} \cdot \Delta \vec{r}$ and $\hat{y} \cdot \Delta \vec{r}$. # Exercise 4 The code template carries out a diffraction simulation as outlined above. The resulting graph shows the bright spots in the diffraction pattern on a screen a distance zscreen along the $z$-axis from the crystal. * Explain what each line of the code does. * Why is it helpful that $\vec{a}$ always points along the $x$-axis? Why is it helpful that $\vec{b}$ always points in the $xy$-plane? * What is the pattern in the equations for $\vec{a}^\*$, $\vec{b}^\*$, and $\vec{c}^\*$? * Input the $a$, $b$, $c$, $\alpha$, $\beta$, and $\gamma$ values for graphite and your selected wavelength $\lambda$. Run the code and confirm your answers for $d$ and $\theta$ from above. # Exercise 5 Re-run the code template for several different combinations of edge lengths and angles. Examine the qualitative changes in the shape of the diffraction pattern. Explain how we can use these diffraction patterns to deduce the structure of a crystal lattice. For example... * How can you tell that a crystal is longer in the $x$-direction or the $y$-direction? * How can you tell that a crystal has all right angles? Acute angles? Obtuse angles? Remember to keep adjusting $\lambda$ as needed based on the values of $d$ involved in your crystal lattice.

### Share a Variation

Did you have to edit this material to fit your needs? Share your changes by Creating a Variation

### Credits and Licensing

W. Brian Lane, "Visualizing X-Ray Diffraction," Published in the PICUP Collection, October 2020, https://doi.org/10.1119/PICUP.Exercise.xraydiff.

The instructor materials are ©2020 W. Brian Lane.

The exercises are released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license