# How to calculate diffraction pattern from a model of unit cell?

I remember that 20+ years ago we used a program called Powder Cell to calculate diffraction patterns from models of materials (for example, to compare it with experimental data from powder diffraction). I just fired this program up under wine and it still works: What are modern alternatives?

Note: this program takes description of a unit cell (atoms and unit cell parameters) and produces indexed pattern. This is different than using the Debye scattering formula to calculate diffraction pattern of any set of atoms, but without Miller indices.

Perhaps the easiest solution is to use VESTA, which can read in a CIF (and many other crystalline structure formats) and produce a powder diffraction pattern ("Utilities" > "Powder Diffraction Pattern"). Behind the scenes, VESTA is using RIETAN-FP to do the calculation, which has a standalone version to download if you wanted. Another way you could do this, especially for those who have to do this for many structures and don't mind using Python, is with the xrd module in Pymatgen, which provides a bit more flexibility. This could be done as shown below:

import pymatgen as pm
from pymatgen.analysis.diffraction.xrd import XRDCalculator
p = '/path/to/my.cif' #path to CIF
structure = pm.Structure.from_file(p) #read in structure
xrd = XRDCalculator() #initiate XRD calculator (can specify various options here)
pattern = xrd.get_pattern(structure)
print(pattern)

• There's MAUD but who's gonna argue with a Python solution!
– uhoh
May 1 '20 at 15:43

You are looking for the calculation of structure factor. Basically the X-Ray spectra could be calculated as Fourier transform of your crystal lattice and the Intensity ($$I(\mathbf{q})$$) could be estimated as:

$$I(\mathbf{q}) = f^{2} \sum_{i=1}^{N} \exp{(-i \mathbf{q} \cdot \mathbf{R}_{i})}$$

Basically, $$\mathbf{q}$$ is the scattering vector and the X-Ray spectra would be a 3D field in Fourier space but because you have other knowledge about your crystal structure, you could just plot $$I$$ versus $$2\theta$$ the angle of scattering vector and you would get your X-Ray spectra.