Structure factors for perfect crystals

Question

The scattering of X-rays by the atoms in a crystal is described mathematically by the structure factor, $F_{hkl}$. In particular, the intensity of a diffracted beam scattered by a crystal plane with Miller indices $(hkl)$ with a vector $\boldsymbol{K} = h\boldsymbol{\hat{x}}^* + k\boldsymbol{\hat{y}}^* +l\boldsymbol{\hat{z}}^* = 2\pi\left(\frac{h}{a} \boldsymbol{\hat{x}} + \frac{k}{b} \boldsymbol{\hat{y}} + \frac{l}{c} \boldsymbol{\hat{z}}\right)$ is given by the square of the quantity:

$$ F_{hkl} = \sum_j f_j \exp\left( -2\pi i \boldsymbol{K}\cdot \boldsymbol{r_j} \right), $$ where $f_j$ is the form factor of atom $j$ and $\boldsymbol{r_j}$ is its position in the crystal lattice unit cell.

In this exercise, we will focus on crystals that are cubic (so $a=b=c$ and $\boldsymbol{K} = \frac{2\pi}{a}(\boldsymbol{\hat{x}} + \boldsymbol{\hat{y}} + \boldsymbol{\hat{z}})$) and monatomic (so that $f_j$ is the same for all atoms and we will set it equal to unity).

Write a function to calculate $F_{hkl}$ using the above formula for a given crystal structure. Your functions should take two arguments: a sequence of $m$ scattering vectors, hkl, provided as a NumPy array with dimensions (m,3) and an array of atom positions within the unit cell with dimensions (n,3).

Test your function against the following analytical results:

  1. Body-centred cubic crystals

    Atom positions: $$ \textstyle r_1 = (0,0,0) \quad r_2 = (\frac{a}{2},\frac{a}{2},\frac{a}{2}) $$

    Structure factor: \begin{align*} F_{hkl} = \left\{ \begin{array}{ll} 2f, & h+k + l \; \mathrm{even}\\ 0, & h+k + l \; \mathrm{odd} \end{array}\right. \end{align*}

    For example, this function could be defined by the code:

    def F_bcc(hkl):
        """Structure factor for a perfect bcc crystal."""
    
        # F = 2 if h+k+l is even; otherwise F = 0.
        return 2 * (~np.sum(hkl, axis=1) % 2)
    

    Here, the (m,3) array hkl is summed over axis=1 (the three $h$, $k$, $l$ values) to give an array of shape (m,). Each $m$ value is taken modulo 2 to leave the remainder 0 for even values and 1 for odd values. The complement (~) of this is then 1 for even values and 0 for odd values. We return twice this value as the structure factor for a bcc crystal.

  2. Face-centred cubic crystals

    Atom positions: $$ \textstyle r_1 = (0,0,0) \quad r_2 = (\frac{a}{2},\frac{a}{2},0) \quad r_3 = (0, \frac{a}{2},\frac{a}{2}) \quad r_4 = (\frac{a}{2}, 0, \frac{a}{2}) $$

    Structure factor: \begin{align*} F_{hkl} = \left\{ \begin{array}{ll} 4f, & h, k, l \; \mathrm{all\;even\;or\;all\;odd}\\ 0, & \mathrm{otherwise} \end{array}\right. \end{align*}

  3. Diamond crystal structure (Harder)

    Atom positions $$ \textstyle r_1 = (0,0,0) \quad r_2 = (\frac{a}{4},\frac{a}{4},\frac{a}{4}) \quad r_3 = (\frac{a}{2},\frac{a}{2},0) \quad r_4 = (\frac{3a}{4},\frac{3a}{4},\frac{a}{4}) $$ $$ \textstyle r_5 = (\frac{a}{2},0,\frac{a}{2}) \quad r_6 = (0,\frac{a}{2},\frac{a}{2}) \quad r_7 = (\frac{3a}{4},\frac{a}{4},\frac{3a}{4}) \quad r_8 = (\frac{a}{4},\frac{3a}{4},\frac{3a}{4}) $$

    Structure factor: \begin{align*} F_{hkl} = \left\{ \begin{array}{ll} 4f [1 + (-i)^{h+k+l}], & h+k+l \; \mathrm{odd}\\ 8f, & h+k+l = 4n \; \mathrm{(i.e.\;divisible\;by\;4)}\\ 0 & \mathrm{otherwise} \end{array}\right. \end{align*}


Solution

To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.