# Generating X-ray diffraction patterns from atomic coordinates

I have a list of atomic coordinates for a periodic system as a result of a molecular dynamics simulation. I want to use those coordinates and predict what it's 1D diffraction pattern looks like.

The approach I am taking is to generate a 2D cross section and then radially integrate it to get the 1D pattern. To do so, I am using the following equation taken from the reference cited at the bottom (I know this is a very computationally slow approach but I want to understand the theory right before I get fancy with FFTs):

I(ks) $\propto$ |F(q)|2 $\propto$ |$\sum_{j=1}^{N} Z_jexp(i\mathbf{q} \cdot \mathbf{r}_j)|^2$

$\mathbf{k}_s$ is the elastically scattered wavevector
$\mathbf{q}$ is the reciprocal lattice vector
$\mathbf{r}_j$ is the atomic coordinate
$Z_j$ is the atomic number of the jth atom
N is the number of atoms in the system

$\mathbf{k}_s$ can also be represented as $\mathbf{k}_s$ = $\mathbf{k}_0$ + $\mathbf{q}$ where $\mathbf{k}_0$ is the wavevector incident on the crystal

Applying the equation correctly is where I must be going wrong. Here is my approach:

I chose $\mathbf{k}_0$ to be (0, 0, 1). To get $\mathbf{k}_s$ I found and normalized the vector pointing from the sample to each pixel on the detector (shown in the picture below -- the right hand picture is a simplified detector with each pixel represented by a grey box). This lets me solve for $\mathbf{q}$ which I can then plug into the above equation.

Calculating the intensity for each pixel from the combined contributions of all atoms results in a 2D plot which I can then integrate. I get peaks but they don't make sense. Perhaps someone can shed light on what I am doing wrong. I am almost certain it has to do with $\mathbf{q}$.

References: J. Phys.:Condense. Matter 20(2008)505203

• This is a geometry for Laue diffraction. For monochromatic radiation this can only give a peak by accident. For a full Laue pattern, a continuum is needed. – Pieter Jan 5 '17 at 21:38
• @Pieter Do you mind clarifying? What do you mean by geometry - the set up shown in the diagram? And by continuum do you mean a continuum of wavelengths of radiation? – Ben Coscia Jan 5 '17 at 21:53
• I had a quick look at the paper you referenced. The authors simulated both single crystal and polycrystalline diffraction. The latter is usually calculated using the Debye Scattering Equation. I don't see why the authors used different method here. – marcin Jan 5 '17 at 21:54
• Yes, the geometry in the diagram. If you put a 3D lattice at the sample position, you need a continuum of wavelengths (Bremsstrahlung) to get a peak pattern on the screen. Now you said you made 2D slices, that will give diffraction "rods", with a length that gets longer the thinner the slice. With monochromatic radiation, that gives a 2D fourier transform on the screen. – Pieter Jan 5 '17 at 22:03
• @marcin My understanding is that the debye equation is a simplification of the equation given in the referenced paper. The debye equation is an orientational average since things like proteins and non-periodic structures are sampled at all orientations rather than a fixed one. (My system is in a fixed orientation so I resort the one used here. – Ben Coscia Jan 5 '17 at 22:04

(this is not really an answer to the question, but perhaps it'll be helpful)

Starting from the equation in question:

$$I(\mathbf{k_s}) \propto |F(\mathbf{q})|^2 \propto |\sum_{j=1}^{N} Z_j \exp(i\mathbf{q} \cdot \mathbf{r}_j)|^2$$

we can write $|F(\mathbf{q})|^2$ as $F(\mathbf{q})F^*(\mathbf{q})$, i.e.

$$I(\mathbf{k_s}) \propto \sum_{j=1}^{N} Z_j \exp(i\mathbf{q} \cdot \mathbf{r}_j) \sum_{j=1}^{N} Z_j^* \exp(-i\mathbf{q} \cdot \mathbf{r}_j)$$

and assuming that $Z_j$ has no imaginary part:

$$I(\mathbf{k_s}) \propto \sum_{j=1}^{N} \sum_{k=1}^{N} Z_j Z_k \exp(-i\mathbf{q} \cdot \mathbf{r}_{jk})$$

where $\mathbf{r}_{jk} \equiv \mathbf{r}_j - \mathbf{r}_k$.

The question suggested that the sample is a single crystal, but let's instead assume a polycrystalline sample (Debye–Scherrer geometry). The sample is made of many, many crystallites in different orientations. To emulate it we average the equation above over all possible directions of $\mathbf{q}$.

And after some integration we get surprisingly simple result:

$$\left\langle \exp(-i\mathbf{q} \cdot \mathbf{r}_{jk}) \right\rangle = \frac{\sin(qr_{jk})}{qr_{jk}}$$

(no vectors on the right, only absolute values).

This result was obtained by P. Debye about 100 years ago. It's the usual way of calculating powder diffraction patterns from atomistic models.

• Thanks for the explanation and for the link to the Debyer program website. Although this doesn't directly answer the question, it points me in the right direction which is just as helpful. – Ben Coscia Jan 9 '17 at 16:48
• I have a quick follow up question regarding Debyer - when I do an x-ray pattern, I am having trouble figuring out what the output is for the x-axis. Generally I find the correct peaks spaced properly but its within a range from 20 - 75 units. Presumably they are related to q or 2*theta. – Ben Coscia Jan 9 '17 at 16:56
• @BenCoscia If the wavelength is specified, x-axis is in degrees of 2θ. Otherwise in Q. – marcin Jan 9 '17 at 19:05