# 3: X-ray Diffraction¶

## Example number 3.1, Page number 80¶

In [1]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=2.82*10**-10;    #lattice spacing(m)
theta=10;   #glancing angle(degree)
n=1;   #order

#Calculation
lamda=2*d*math.sin(theta)/n;    #wavelength(m)

#Result
print "wavelength is",round(lamda*10**10,5),"angstrom"

wavelength is 0.97938 angstrom


## Example number 3.2, Page number 80¶

In [1]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=3.035*10**-10;    #lattice spacing(m)
theta=12;   #glancing angle(degree)
n=1;   #order

#Calculation
lamda=2*d*math.sin(theta)/n;    #wavelength(m)

#Result
print "wavelength is",round(lamda*10**10,3),"angstrom"

wavelength is 1.262 angstrom


## Example number 3.3, Page number 81¶

In [2]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=2.81;    #lattice spacing(angstrom)
theta1=15.1;   #glancing angle(degree)
theta2=17.1;   #glancing angle(degree)

#Calculation
lamda1=2*d*math.sin(theta1);    #wavelength(angstrom)
lamda2=2*d*math.sin(theta2);    #wavelength(angstrom)

#Result
print "wavelengths are",round(lamda1,3),"angstrom and",round(lamda2,4),"angstrom"
print "answer varies due to rounding off errors"

wavelengths are 1.464 angstrom and 1.6525 angstrom
answer varies due to rounding off errors


## Example number 3.4, Page number 81¶

In [3]:
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=1.54;      #wavelength(angstrom)
theta=11;   #glancing angle(degree)

#Calculation
d=lamda/(2*math.sin(theta));   #separation between lattice planes(angstrom)

#Result
print "separation between lattice planes is",round(d,3),"angstrom"

separation between lattice planes is 4.035 angstrom


## Example number 3.5, Page number 81¶

In [4]:
#importing modules
import math
from __future__ import division

#Variable declaration
lamdaB=0.92;    #wavelength(angstrom)
theta1=30;   #glancing angle(degree)
theta2=60;   #glancing angle(degree)

#Calculation
lamdaA=2*lamdaB*math.sin(theta1)/math.sin(theta1);    #wavelength of line A(angstrom)

#Result
print "wavelength is",lamdaA,"angstrom"
print "answer in the book is wrong"

wavelength is 1.84 angstrom
answer in the book is wrong


## Example number 3.6, Page number 81¶

In [5]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=0.4086*10**-10;    #lattice spacing(m)
theta=65;   #glancing angle(degree)
h=6.6*10**-34;    #plank's constant(Js)
m=9.1*10**-31;    #mass(kg)
n=1;

#Calculation
lamda=2*d*math.sin(theta)/n;    #debroglie wavelength(m)
v=h/(m*lamda);        #velocity(m/sec)

#Result
print "debroglie wavelength is",round(lamda*10**10,4),"*10**-10 metre"
print "velocity is",round(v/10**6,3),"*10**6 m/sec"
print "answer in the book is wrong"

debroglie wavelength is 0.7406 *10**-10 metre
velocity is 9.793 *10**6 m/sec
answer in the book is wrong


## Example number 3.7, Page number 82¶

In [6]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=2.82*10**-10;    #lattice spacing(m)
sintheta=1;
n=1;

#Calculation
lamda_max=2*d*sintheta/n;    #longest wavelength(m)

#Result
print "longest wavelength is",lamda_max*10**10,"angstrom"

longest wavelength is 5.64 angstrom


## Example number 3.8, Page number 82¶

In [7]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=0.842*10**-10;    #lattice spacing(m)
theta1=8+(35/60);   #glancing angle(degree)
n1=1;   #order
n2=3;   #order

#Calculation
theta3=theta3*180/math.pi;       #glancing angle(degree)

#Result
print "glancing angle is",round(theta3,3),"degree"

glancing angle is 26.599 degree


## Example number 3.9, Page number 82¶

In [8]:
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=0.58;      #wavelength(angstrom)
theta1=6+(45/60);   #glancing angle(degree)
theta2=9+(15/60);   #glancing angle(degree)
theta3=13;   #glancing angle(degree)

#Calculation
x1=lamda/(2*math.sin(theta1));
x2=lamda/(2*math.sin(theta2));

#Result
print "interplanar spacing is",round(x2,3),"angstrom"
print "answer varies due to rounding off errors"

interplanar spacing is 1.804 angstrom
answer varies due to rounding off errors


## Example number 3.10, Page number 83¶

In [9]:
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=1.3922;      #wavelength(angstrom)
n=1;
theta=14+(27/60)+(26/(60*60));   #glancing angle(degree)
M=58.454;          #molecular weight
rho=2163;          #density(kg/m**3)

#Calculation
d=n*lamda/(2*math.sin(theta));   #lattice spacing(angstrom)
d_m=d*10**-10;        #lattice spacing(m)

#Result
print "lattice spacing is",round(d,4),"angstrom"
print "answer varies due to rounding off errors"

lattice spacing is 2.7882 angstrom
avagadro number is 6.2337 *10**26 mol/k-mole
answer varies due to rounding off errors


## Example number 3.11, Page number 84¶

In [10]:
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=0.586*10**-10;      #wavelength(m)
theta1=5+(58/60);   #glancing angle(degree)
theta2=12+(10/60);   #glancing angle(degree)
theta3=18+(12/60);   #glancing angle(degree)

#Calculation
x1=math.sin(theta1);
x2=math.sin(theta2);
x3=math.sin(theta3);
d1=lamda/(2*math.sin(theta1));     #spacing for 1st order(m)
d2=2*lamda/(2*math.sin(theta2));     #spacing for 2nd order(m)
d3=3*lamda/(2*math.sin(theta3));     #spacing for 3rd order(m)
d=(d1+d2+d3)/3;      #spacing(m)

#Result
print "ratio of angles of incidence are",round(x1,3),":",round(x2,4),":",round(x3,4),"which is nothing but",round(x1,1)*10,":",round(x2,1)*10,":",round(x3,1)*10
print "angles of incidence should be 1st, 2nd and 3rd orders"
print "spacing is",round(d*10**10,3),"*10**-10 m"
print "answer varies due to rounding off errors"

ratio of angles of incidence are 0.104 : 0.2108 : 0.3123 which is nothing but 1.0 : 2.0 : 3.0
angles of incidence should be 1st, 2nd and 3rd orders
spacing is 2.804 *10**-10 m
answer varies due to rounding off errors


## Example number 3.12, Page number 84¶

In [11]:
#importing modules
import math
from __future__ import division

#Variable declaration
theta1=5+(23/60);   #glancing angle(degree)
theta2=7+(37/60);   #glancing angle(degree)
theta3=9+(25/60);   #glancing angle(degree)

#Calculation
x1=math.sin(theta1);
X1=1/(10*x1);
x2=math.sin(theta2)/x1;
x3=math.sin(theta3)/x1;

#Result
print "ratio of angles of incidence are",int(x1),":",round(x2,3),":",round(x3,3)
print "the crystal is a simple cubic crystal"

ratio of angles of incidence are 0 : 1.413 : 1.744
the crystal is a simple cubic crystal


## Example number 3.13, Page number 85¶

In [12]:
#importing modules
import math
from __future__ import division

#Variable declaration
h=6.62*10**-34;      #planck's constant(J sec)
e=1.6*10**-19;       #charge(coulomb)
m=9*10**-31;        #mass(kg)
E=344;     #energy(volts)
n=1;
theta=60;   #angle(degrees)

#Calculation
lamda=h/math.sqrt(2*m*e*E);       #wavelength(m)
d=n*lamda*10**10/(2*math.sin(theta));           #spacing of crystal(angstrom)

#Result
print "spacing of crystal is",round(d,2),"angstrom"

spacing of crystal is 0.38 angstrom


## Example number 3.14, Page number 85¶

In [13]:
#importing modules
import math
from __future__ import division

#Variable declaration
h=2;
k=2;
l=0;
n=1;
theta=32;   #angle(degrees)
lamda=1.54*10**-10;      #wavelength(m)

#Calculation
d=n*lamda*10**10/(2*math.sin(theta));           #spacing of crystal(angstrom)
a=d*math.sqrt(h**2+k**2+l**2);     #lattice parameter(angstrom)

#Result
print "lattice parameter is",round(a,1),"angstrom"

lattice parameter is 4.1 angstrom
radius of atom is 1.45 angstrom