From 1b0434bfaeb3c05984c50f89f9b77f961f51aaaf Mon Sep 17 00:00:00 2001
From: Kostas Vilkelis <kostasvilkelis@gmail.com>
Date: Wed, 12 Feb 2020 20:39:55 +0000
Subject: [PATCH] add powder diffraction

---
 src/10_xray.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 71 insertions(+), 3 deletions(-)

diff --git a/src/10_xray.md b/src/10_xray.md
index 9c85e63b..bc11e8be 100644
--- a/src/10_xray.md
+++ b/src/10_xray.md
@@ -16,7 +16,12 @@ jupyter:
 import matplotlib.pyplot as plt
 
 import numpy as np
-from math import sqrt,pi
+from math import pi
+from math import sqrt
+import matplotlib.pyplot as plt
+import matplotlib.patches as patches
+import matplotlib.transforms as mtransforms
+import matplotlib.image as img 
 
 from common import draw_classic_axes, configure_plotting
 
@@ -184,8 +189,8 @@ fig.update_layout(
     sliders=sliders,
     showlegend = False,
     plot_bgcolor = 'rgb(254, 254, 254)',
-    width = 1000,
-    height = 500,
+    width = 800,
+    height = 400,
     xaxis = dict(
         range=[-plot_range,plot_range],
         visible = False,
@@ -342,6 +347,69 @@ $S=4f$ if $h$, $k$, $l$ are all even or all odd
 
 $S=0$ in all other cases
 
+### Powder Diffraction
+```python
+def add_patch(ax, patches, *args,**kwargs):
+    for i in patches:
+        ax.add_patch(i,*args,**kwargs)
+        
+def circle(radius,xy=(0,0),**kwargs):
+    return patches.Circle(xy,radius=radius, fill=False, edgecolor='r', lw = 2, **kwargs)
+
+fig, ax = plt.subplots(figsize=(7,7))
+
+transform=mtransforms.Affine2D().skew_deg(0,-25) + ax.transData
+# Create the screen
+rect = patches.Rectangle((-0.5,-0.5),1,1, edgecolor = 'k', lw = 2, facecolor = np.array([217, 217, 217])/255,transform = transform)
+circle_list = [circle(i,transform=transform) for i in np.array([0.001,0.02,0.08,0.15,0.2,0.22,0.25])*2]
+add_patch(ax,[rect]+circle_list)
+
+# Add sample
+sample_pos = np.array([-0.6,-0.6])
+ax.add_patch(patches.Circle(sample_pos,radius=0.1,color='k',zorder=10))
+plt.annotate('Powder Sample',sample_pos+[-0.1,-0.2],fontsize=14)
+#Reference line
+ax.plot([sample_pos[0],0],[sample_pos[1],0],color='k',ls='--')
+
+#X-Ray Beam
+d_xray = sample_pos-np.array([-1+0.05,-1+0.05])
+ax.add_patch(patches.Arrow(-1,-1, *d_xray, width=0.05, color='r'))
+plt.annotate('X-Ray Beam',(-1,-0.85),fontsize=14,rotation = 45)
+
+# Diffracted Beams
+ax.add_patch(patches.Arrow(*sample_pos, 0.1, 0.8, width=0.05, color='r'))
+ax.add_patch(patches.Arrow(*sample_pos, 0.8, 0.285, width=0.05, color='r'))
+
+#Angle Arcs
+ellipse_radius = 0.3
+ax.add_patch(patches.Arc(sample_pos, ellipse_radius, ellipse_radius, 80, theta1=325, theta2=0))
+plt.annotate('$ 2\\theta $',(-0.56,-0.44),fontsize=14)
+
+
+plt.xlim([-1,0.5])
+plt.ylim([-1,0.5])
+plt.axis('off')
+plt.show()
+```
+
+The easiest way to do diffraction measurements is to take a crystal, shoot an X-ray beam through it and measure the direction of outgoing waves. However, it is highly unlikely that you will fulfil the Laue condition for any set of crystal planes. There does exist a more practical experiment - **powder diffraction**.
+
+By crushing the crystal into a powder, the small crystallites are now orientated in random directions. This highly improves the chances of fulfilling the Laue condition for a fixed direction incoming beam. The experiment is illustrated in the figure above. The result is that the diffracted beam exits the sample via concentric circles at discrete **deflection angles** $2 \theta$.
+
+To deduce the values of $\theta$ for a specific crystal lets put the Laue condition into a more practical form.
+
+$$
+\left|\mathbf{k'}-\mathbf{k} \right|^2=\left|\mathbf{G_{hkl}}\right|^2 \\
+2k^2-2\mathbf{k'} \cdot \mathbf{k} = G_{hkl}^2 \\
+2k^2-2 \left(\mathbf{k}+\mathbf{G_{hkl}}\right) \cdot \mathbf{k} = G_{hkl}^2 \\
+2 k \cos(\phi) = G_{hkl}^2
+$$
+
+Where we use $|\mathbf{k'}| = |\mathbf{k}|$ in the second line and insert the Laue condition in the third line. During the exercises for this week, you will derive an important relation $G_{hkl} = \frac{2}{d_{hkl}}$ where $d_{hkl}$ is the spacing between $(hkl)$ miller planes. With this, one can finally derive **Bragg's Law**:
+$$ \lambda = 2 d_{hkl} \sin(\theta) $$
+
+where $\phi = \theta - \pi/2$.
+
 ## Summary
 * We described how to construct a reciprocal lattice from a real-space lattice.
 * Points in reciprocal space that differ by a reciprocal lattice vector are equivalent --> Band structure can be fully described by considering 1st Brillouin zone.
-- 
GitLab