# Introduction¶

This notebook shows how to plot an XRD plot for the two polymorphs of CsCl ($Pm\overline{3}m$ and $Fm\overline{3}m$). You can also use matgenie.py's diffraction command to plot an XRD pattern from a structure file.

In [1]:
# Set up some imports that we will need
from pymatgen import Lattice, Structure
from pymatgen.analysis.diffraction.xrd import XRDCalculator
from IPython.display import Image, display

%matplotlib inline


# $\alpha$-CsCl ($Pm\overline{3}m$)¶

Let's start with the typical $\alpha$ form of CsCl.

In [2]:
# Create CsCl structure
a = 4.209 #Angstrom
latt = Lattice.cubic(a)
structure = Structure(latt, ["Cs", "Cl"], [[0, 0, 0], [0.5, 0.5, 0.5]])

c = XRDCalculator()
c.show_xrd_plot(structure)


Compare it with the experimental XRD pattern below.

In [3]:
display(Image(filename=('./PDF - alpha CsCl.png')))


# $\beta$-CsCl ($Fm\overline{3}m$)¶

Let's now look at the $\beta$ (high-temperature) form of CsCl.

In [4]:
# Create CsCl structure
a = 6.923 #Angstrom
latt = Lattice.cubic(a)
structure = Structure(latt, ["Cs", "Cs", "Cs", "Cs", "Cl", "Cl", "Cl", "Cl"],
[[0, 0, 0], [0.5, 0.5, 0], [0, 0.5, 0.5], [0.5, 0, 0.5],
[0.5, 0.5, 0.5], [0, 0, 0.5], [0, 0.5, 0], [0.5, 0, 0]])

c.show_xrd_plot(structure)


Compare it with the experimental XRD pattern below.

In [5]:
display(Image(filename=('./PDF - beta CsCl.png')))