In [1]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)
d = 2.18*10**3; #Density of rock salt(kg/m**3)
n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal
N = 6.02*10**26; #Avogadro's No., atoms/k-mol
#Calculation
a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)
a = a*10**9; ##Lattice constant of unit cell of NaCl(nm)
a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals
#Result
print "Lattice parameter for the NaCl crystal is",a, "nm"
```

In [2]:

```
#importing modules
import math
#Variable declaration
m = 3;
n = 2;
p = 1; #Coefficients of intercepts along three axes
#Calculation
#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/3, 1/2, 1
#multiplying by LCM the reciprocals become 2, 3, 6
#Result
print "The required miller indices are : (2, 3, 6)"
```

In [3]:

```
#importing modules
import math
#Variable declaration
m = 2; #Coefficient of intercept along x-axis
#n = infinite Coefficient of intercept along y-axis
p = 3/2; #Coefficient of intercept along z-axis
#Calculation
#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/2, 0, 2/3
#multiplying by LCM the reciprocals become 3, 0, 4
#Result
print "The required miller indices are : (3, 0, 4)"
```

In [4]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
#For (110) planes
h1 = 1;
k1 = 1;
l1 = 0; #Miller Indices for planes in a cubic crystal
a1 = 0.43; #Interatomic spacing(nm)
#For (212) planes
h2 = 2;
k2 = 1;
l2 = 2; #Miller Indices for planes in a cubic crystal
a2 = 0.43; #Interatomic spacing(nm)
#Calculation
d1 = a1/(h1**2+k1**2+l1**2)**(1/2); #The interplanar spacing for cubic crystals(nm)
d1 = math.ceil(d1*10**4)/10**4; #rounding off the value of d1 to 4 decimals
d2 = a2/(h2**2+k2**2+l2**2)**(1/2); #The interplanar spacing for cubic crystals(nm)
d2 = math.ceil(d2*10**4)/10**4; #rounding off the value of d2 to 4 decimals
#Result
print "The interplanar spacing between consecutive (110) planes is",d1, "nm";
print "The interplanar spacing between consecutive (212) planes is",d2, "nm"
```

In [5]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
h = 2;
k = 3;
l = 1; #Miller Indices for planes in a cubic crystal
r = 0.175; #Atomic radius of fcc lattice(nm)
#Calculation
a = 2*math.sqrt(2)*r; #Interatomic spacing of fcc lattice(nm)
d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystals(nm)
d = math.ceil(d*10**4)/10**4; #rounding off the value of d to 4 decimals
#Result
print "The interplanar spacing between consecutive (231) planes is",d, "nm"
```

In [6]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
lamda = 1.44; #Wavelength of X-rays(A)
d = 2.8; #Interplanar spacing of rocksalt crystal(A)
n1 = 1; #For 1st Order diffraction
n2 = 2; #For 2nd Order diffraction
#Calculation
theta1 = math.asin(n1*lamda/(2*d)); #Angle of diffraction(radians)
theeta1 = theta1*57.2957795; #Angle of diffraction(degrees)
theeta1 = math.ceil(theeta1*10**2)/10**2; #rounding off the value of theeta1 to 2 decimals
theta2 = math.asin(n2*lamda/(2*d)); #Angle of diffraction(radians)
theeta2 = theta2*57.2957795; #Angle of diffraction(degrees)
theeta2 = math.ceil(theeta2*10**2)/10**2; #rounding off the value of theeta2 to 2 decimals
#Result
print "The angle of diffraction for first order maxima is",theeta1, "degrees"
print "The angle of diffraction for second order maxima is",theeta2, "degrees"
```

In [7]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
a = 1; #For convenience, assume interatomic spacing to be unity(m)
#Calculation
N = 8*(1/8) + 6*(1/2); #total number of spheres in a unit cell
r = a/(2*math.sqrt(2)); #The atomic radius(m)
V_atom = N*(4/3)*math.pi*r**3; #Volume of atoms(m**3)
V_uc = a**3; #Volume of unit cell(m**3)
PV = (V_atom/V_uc)*100; #percentage of actual volume
PV = math.ceil(PV*10)/10; #rounding off the value of PV to 1 decimal
#Result
print "The percentage of actual volume occupied by the spheres in fcc structure is",PV, "percent"
```

In [9]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
#For (221) planes
h = 2;
k = 2;
l = 1; #Miller Indices for planes in a cubic crystal
a = 2.68; #Interatomic spacing(A)
n1 = 1; #First Order of diffraction
n2 = 2; #Second order of diffraction
theta1 = 8.5; #Glancing angle at which Bragg's reflection occurs(degrees)
#Calculation
theta1 = theta1*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)
a = a*10**-10; #Interatomic spacing(m)
d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystal(m)
lamda = 2*d*math.sin(theta1)/n1; #Bragg's Law for wavelength of X-rays(m)
lamda_A = lamda*10**10; #Bragg's Law for wavelength of X-rays(A)
lamda_A = math.ceil(lamda_A*10**4)/10**4; #rounding off the value of lamda_A to 4 decimals
theta2 = math.asin(n2*lamda/(2*d)); #Angle at which second order Bragg reflection occurs(radians)
theta2 = theta2*57.2957795; #Angle at which second order Bragg reflection occurs(degrees)
theta2 = math.ceil(theta2*10)/10; #rounding off the value of theta2 to 1 decimal
#Result
print "The interplanar spacing between consecutive (221) planes is",d, "m"
print "The wavelength of X-rays is",lamda_A, "angstrom"
print "The angle at which second order Bragg reflection occurs is",theta2, "degrees"
```

In [10]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
h = 1;
k = 1;
l = 0; #Miller Indices for planes in a cubic crystal
n = 1; #First Order of diffraction
theta = 25; #Glancing angle at which Bragg's reflection occurs(degrees)
lamda = 0.7; #Wavelength of X-rays(A)
#Calculation
theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)
d = n*lamda/(2*math.sin(theta)); #Interplanar spacing of cubic crystal(A)
a = d*(h**2+k**2+l**2)**(1/2); #The lattice parameter for cubic crystal(A)
a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals
#Result
print "The lattice parameter for cubic crystal is",a, "angstrom"
```

In [11]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
d = 0.31; #Interplanar spacing(nm)
n = 1; #First Order of diffraction
theta = 9.25; #Glancing angle at which Bragg's reflection occurs(degrees)
theta_max = 90; #Maximum possible angle at which reflection can occur(degrees)
theta_max = theta_max*0.0174532925; #Maximum possible angle at which reflection can occur(radians)
#Calculation
theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)
lamda = 2*d*math.sin(theta)/n; #Wavelength of X-rays(nm) (Bragg's Law)
lamda = math.ceil(lamda*10**5)/10**5; #rounding off the value of lamda to 5 decimals
n = 2*d*math.sin(theta_max)/lamda; #Maximum possible order of diffraction
#Result
print "The wavelength of X-rays is",lamda, "nm"
print "The Maximum possible order of diffraction is",round(n)
```

In [12]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
#For (110) planes
h1 = 1;
k1 = 1;
l1 = 0; #Miller indices for (110) planes
d_110 = 0.195; #Interplanar spacing between (110) planes(nm)
#For (210) planes
h2 = 2;
k2 = 1;
l2 = 0; #Miller indices for (110) planes
n = 2; #Second Order of diffraction
lamda = 0.071; #Wavelength of X-rays(nm)
#Calculation
a = d_110*(h1**2 + k1**2 + l1**2)**(1/2); #Lattice parameter for bcc crystal(nm)
d_210 = a/(h2**2 + k2**2 + l2**2)**(1/2); #Interplanar spacing between (210) planes(nm)
theta = math.asin(n*lamda/(2*d_210)); #Bragg reflection angle for the second order diffraction(radians)
theeta = theta*57.2957795; #Bragg reflection angle for the second order diffraction(degrees)
theeta = math.ceil(theeta*10**3)/10**3; #rounding off the value of theeta to 3 decimals
#Result
print "Bragg reflection angle for the second order diffraction is",theeta, "degrees"
```

In [13]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
d = 2182; #Density of rock salt(kg/m**3)
n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal
N = 6.02*10**26; #Avogadro's number(atoms/k-mol)
#Calculation
M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)
#V = a^3 = M*n/(N*d)
a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)
D = a/2; #distance between nearest neighbours(m)
D = D*10**9; #distance between nearest neighbours(nm)
D = math.ceil(D*10**4)/10**4; #rounding off the value of D to 4 decimals
#Result
print "The distance between nearest neighbours of NaCl structure is",D, "nm"
```

In [15]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
r1 = 1.258; #Atomic radius of bcc structure of iron(A)
N1 = 2; #Number of atoms per unit cell in bcc structure
#For fcc structure
r2 = 1.292; #Atomic radius of fcc structure of iron(A)
N2 = 4; #Number of atoms per unit cell in fcc structure
#Calculation
a1 = 4*r1/math.sqrt(3); #Lattice parameter of bcc structure of iron(A)
V1 = a1**3; #Volume of bcc unit cell(A)
V_atom_bcc = V1/N1; #Volume occupied by one atom(A)
a2 = 2*math.sqrt(2)*r2; #Lattice parameter of fcc structure of iron(A)
V2 = a2**3; #Volume of fcc unit cell(A)
V_atom_fcc = V2/N2; #Volume occupied by one atom(A)
delta_V = (V_atom_bcc-V_atom_fcc)/V_atom_bcc*100; #Percentage change in volume due to structural change of iron
delta_V = math.ceil(delta_V*10**3)/10**3; #rounding off the value of delta_V to 3 decimals
#Result
print "The percentage change in volume of iron is",delta_V, "percent"
```

In [ ]:

```
```