Chapter 2: Crystal Structure

Example 2.2, page no-30

In [2]:
# Lattice spacing from Miller indices

import math
# Intercepts are in the ratio 3a:4b along X,Y and parallel to Z axis
# x-intercept 3, y-intercept 4 and z-intercept infinity 

#variable declaration
a=2.0*10**-10       # 2 Angstrom
h=4.0               # Miller indices wrt X-axis
k=3.0               # Miller indices wrt Y-axis
l=0.0               # Miller indices wrt Z-axis

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#result
print('The lattice spacing for the plane (%d%d%d) is %.1f*10^-10 m'%(h,k,l,d*10**10))
The lattice spacing for the plane (430) is 0.4*10^-10 m

Example 2.3, page no-31

In [3]:
#Lattice constant of Sodium

import math
#variable declaration
d=9.6*10**2          # Density of sodium in kg/m^3
awt=23               # Atomic weight of sodium
n=2                  # No of sodium atoms present in one unit cell
avg=6.023*10**26     # Avogadro number


#calculation
m=n*awt/avg
a=(m/d)**(1.0/3.0)

#Result
print('The lattice constant of sodium is %.1f A°'%(a*10**10))
The lattice constant of sodium is 4.3 A°

Example 2.4, page no-31

In [4]:
#Avogadro Constant 

import math
#variable declaration
d=4.0*10**3                 # Density of CsCl in kg/m^3
awtcs=132.9                 # Atomic weigt of Cs 
awtcl=35.5                  # Atomic weigt of Cl
a=4.12*10**-10              # Lattice constant

#Calculations
m=d*a**3
N=(awtcs+awtcl)/m

#Result
print('The value of Avogadro Constant %.4f *10^26 per kg mole'%(N*10**-26))
The value of Avogadro Constant 6.0199 *10^26 per kg mole

Example 2.5, page no-31

In [5]:
# Interatomic spacing

import math 
#variable declaration
lam=1.5418*10**-10         # Wavelength of X-rays
theta=30.0                 # Angle of diffracted angle
h=1.0                      # Miller indices wrt X-axis
k=1.0                      # Miller indices wrt Y-axis
l=1.0                      # Miller indices wrt Z-axis

#Calculation
a=lam*math.sqrt(h**2+k**2+l**2)/(2*math.sin(theta*math.pi/180))

#Result
print('The lattice constant is %.4f *10^-10 m'%(a*10**10))
The lattice constant is 2.6705 *10^-10 m

Example 2.6, page no-33

In [6]:
#Lattice spacing in a rock salt

import math
#variable cdeclaration
h=1.0                      # Miller indices wrt X-axis
k=0.0                      # Miller indices wrt Y-axis
l=0.0                      # Miller indices wrt Z-axis
a=2.814*10**-10            # interatomic spacing

#calculations
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('The lattice spacing for the plane(%d%d%d) is %.3f*10^-10 m'%(h,k,l,d*10**10))
The lattice spacing for the plane(100) is 2.814*10^-10 m

Example 2.7, page no-33

In [7]:
#Lattice spacing from Miller indices

import math
#variable declaration
h=3.0                       # Miller indices wrt X-axis
k=2.0                       # Miller indices wrt Y-axis
l=1.0                       # Miller indices wrt Z-axis
a=4.12*10**-10              # interatomic spacing

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#result
print('The lattice spacing for the plane(%d%d%d) is %.4f*10^-10 m'%(h,k,l,d*10**10))
The lattice spacing for the plane(321) is 1.1011*10^-10 m

Example 2.8, page no-34

In [12]:
#Lattice spacing from Miller indices

import math
#(i)
#variable declaration
h=1.0                              # Miller indices wrt X-axis
k=0.0                              # Miller indices wrt Y-axis
l=1.0                              # Miller indices wrt Z-axis
a=4.2*10**-10                    # lattice constant

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('\nThe lattice spacing for the plane(%d%d%d) is %.4f*10^-10 m'%(h,k,l,d*10**10))

#(ii)
#variable declaration
h=2                            # Miller indices wrt X-axis
k=2                            # Miller indices wrt Y-axis
l=1                            # Miller indices wrt Z-axis
a=4.12*10**-10                 # Lattice constant 

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('\nThe lattice spacing for the plane(%d%d%d) is %.1f*10^-10 m'%(h,k,l,d*10**10))

#Answer in the book for plane(101) is wrong
The lattice spacing for the plane(101) is 2.9698*10^-10 m

The lattice spacing for the plane(221) is 1.4*10^-10 m

Example 2.13, page no-37

In [16]:
#Lattice spacing from Miller indices

import math

#(i)
#variable declaration
h=1.0                    # Miller indices wrt X-axis
k=1.0                    # Miller indices wrt Y-axis
l=1.0                    # Miller indices wrt Z-axis
a=4.12*10**-10           # lattice Constant

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('\nFor (%d%d%d) plane\nThe lattice spacing is %.4f*10^-10 m'%(h,k,l,d*10**10))

#(ii)

#variable declaration
h=1.0                  # Miller indices wrt X-axis
k=1.0                  # Miller indices wrt Y-axis
l=2.0                  # Miller indices wrt Z-axis
a=4.12*10**-10         # Lattice Constant

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('\n\nFor (%d%d%d) plane\nThe lattice spacing is %.4f*10^-10 m'%(h,k,l,d*10**10))


#(iii)

#variable declaration
h=1.0                   # Miller indices wrt X-axis
k=2.0                   # Miller indices wrt Y-axis  
l=3.0                   # Miller indices wrt Z-axis
a=4.12*10**-10          # Lattice Constant

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('\n\nFor (%d%d%d) plane\nThe lattice spacing is %.4f*10^-10 m'%(h,k,l,d*10**10))
For (111) plane
The lattice spacing is 2.3787*10^-10 m


For (112) plane
The lattice spacing is 1.6820*10^-10 m


For (123) plane
The lattice spacing is 1.1011*10^-10 m

Example 2.15, page no-38

In [19]:
# Lattice spacing from Miller indice

import math
#variable declaration
h=2.0                     # Miller indices wrt X-axis
k=2.0                     # Miller indices wrt Y-axis 
l=0.0                     # Miller indices wrt Z-axis
a=4.938*10**-10           # Lattice Constant

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('\nThe lattice spacing for (%d%d%d) plane is %.4f*10^-10 m'%(h,k,l,d*10**10))

#Note: Final answer in the book is as follow:
# The lattice spacing for the plane (110) is 2.968 x 10^-10 m 
The lattice spacing for (220) plane is 1.7458*10^-10 m

Example 2.16, page no-39

In [20]:
#Number of atoms in Al foil

import math
#variable declaration
a=0.405*10**-10      # lattice constant
t=0.005              # thickness of Al foil
A=25*10**-2          # side length of Al foil

#calculation
n=t*A/a**3

#Result
print('The number of atoms in the Al foil is %.2f * 10^28'%(n*10**-28))
The number of atoms in the Al foil is 1.88 * 10^28

Example 2.17, page no-39

In [21]:
#no of unit cells in 1 kg metal

import math
#variable declaration
a=2.88*10**-10          # lattice constant
d=7200.0                # Density of metal in k/m^3

#calculation
n=1/(d*a**3)

#Result
print('The number of unit cells present in 1 kg metal is %.4f *10^24'%(n*10**-24))
The number of unit cells present in 1 kg metal is 5.8142 *10^24

Example 2.18, page no-39

In [22]:
#percentage volume change during structural changes

import math
#variable declaration
rbcc=0.1258*10**-9              # Atomic radius at bcc state
rfcc=0.1292*10**-9              # Atomic radius at fcc state

#calculation
a=4*rbcc/math.sqrt(3)
vbcc=(a**3)/2
a1=4*rfcc/math.sqrt(2)
vfcc=(a1**3)/4
vp=(vbcc-vfcc)
vp=math.floor(vp*10**32)
vp=vp*10**-32/vbcc

#Result
print('The volume change in %% duringg the structural change is %.4f'%(vp*100))
The volume change in % duringg the structural change is 0.4894

Example 2.19, page no-40

In [35]:
#Copper Density

import math
#variable declaration
awt=63.5*10**-3              # Atomic weight of copper
avg=6.023*10**26             # Avagadro No. 
r=1.273*10**-10              # Atomic radius for fcc system
n=4.0                        # No of atoms per unit cell for fcc

#calculation
a=4*r/math.sqrt(2)
a= math.floor(a*10**11)/10**11
d=n*awt/(avg*a**3)

#Result
print('The density of copper is %.5f gm/m^3'%d)
The density of copper is 9.03885 gm/m^3

Example 2.20, page no-41

In [36]:
# Atomic Radius

import math
#variable declaration
d=7860.0                   # Density of alfa-iron
m=55.85                    # atomic weight of alfa-iron
n=2.0                      # No of atoms per unit cell for Bcc
avg=6.023*10**26           # Avoigadro's Number

#calculation
a=(n*m*10**-3/(avg*d))**(1.0/3.0)
r=a*math.sqrt(3)/4.0

#Result
print('\nThe lattice constant of alfa-iron is %.4f A°'%(a*10**10))
print('\nThe atomic radius  of alfa-iron is %.5f *10^-10 m'%(r*10**10))
The lattice constant of alfa-iron is 0.2868 A°

The atomic radius  of alfa-iron is 0.12420 *10^-10 m

Example 2.21, page no-42

In [37]:
#Lattice constant

import math
#variable declaration
d=8960.0                     # Density of copper
m=63.54                      # Atomic weight of copper
n=4.0                        # No of atoms per unit cell for Fcc
avg=6.023*10**26             # Avogadro's number

#calculation
a=(n*m*10**-3/(avg*d))**(1.0/3.0)

#Result
print('\nThe lattice constant of copper is %.4f A°'%(a*10**10))
The lattice constant of copper is 0.3611 A°

Example 2.22, page no-42

In [40]:
# Glancing angle 

import math
#variable declaration
a=3.81*10**-10               # lattice spacing
h=1.0                        # Miller indices wrt X-axis
k=3.0                        # Miller indices wrt Y-axis
l=2.0                        # Miller indices wrt Z-axis
lam=0.58*10**-10             # Wavelength of X-rays
n=2.0                        # order of diffraction

#calculation
d=a/math.sqrt(h**2+k**2+l**2)
theta=math.asin(n*lam/(2*d))

#Result
print('The angle of glancing at which 2nd order diffraction pattern of NaCl occurs is %.2f°'%(theta*180/math.pi))
The angle of glancing at which 2nd order diffraction pattern of NaCl occurs is 34.72°

Example 2.23, page no-43

In [41]:
# Lattice constant

import math
#variable declaration
h=3.0                          # Miller indices wrt X-axis                     
k=0.0                          # Miller indices wrt Y-axis 
l=2.0                          # Miller indices wrt Z-axis 
theta=35                       # glancing angle
lam=0.7*10**-10                # wavelength of X-rays 
n=1.0                          # order of diffraction

#calculations
d=n*lam/(2*math.sin(theta*math.pi/180))
a=d*math.sqrt(h**2+k**2+l**2)

#Result
print('\nThe interplanar distance for(302) plane is %.3f*10^-11 m'%(d*10**11))
print('\nThe lattice constance is %.2f*10^-10 m'%(a*10**10))
The interplanar distance for(302) plane is 6.102*10^-11 m

The lattice constance is 2.20*10^-10 m

Example 2.24, page no-44

For plane (0 0 1)

In [31]:
# Plane drawing 1

from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

point = np.array([0, 0, 1])
normal = np.array([0, 0, 1])

# calculations
d = -point.dot(normal)
x, y = np.meshgrid(range(10), range(10))                           # create x,y
z = (-normal[0] * x - normal[1] * y - d) * 1. / normal[2]          # calculate corresponding z

# Result
plt3d = plt.figure().gca(projection='3d')
plt3d.plot_surface(x, y, z, rstride=1, cstride=1)
plt.show()

For plane(1 0 1)

In [32]:
# Plane drawing 2

from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

point = np.array([1, 0, 1])
normal = np.array([1, 0, 1])

# calculations
d = -point.dot(normal)
x, y = np.meshgrid(range(10), range(10))                           # create x,y
z = (-normal[0] * x - normal[1] * y - d) * 1. / normal[2]          # calculate corresponding z

# Result
plt3d = plt.figure().gca(projection='3d')
plt3d.plot_surface(x, y, z, rstride=1, cstride=1)
plt.show()

For plane(1 1 1)

In [37]:
# Plane drawing 3

from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

point = np.array([1, 1, 1])
normal = np.array([1, 1, 1])

# calculations
d = -point.dot(normal)
x, y = np.meshgrid(range(10), range(10))                           # create x,y
z = (-normal[0] * x - normal[1] * y - d) * 1. / normal[2]          # calculate corresponding z

# Result
plt3d = plt.figure().gca(projection='3d')
plt3d.plot_surface(x, y, z, rstride=1, cstride=1)
plt.show()

Example 2.25, page no-45

In [42]:
# InterPlanar Spacing

import math
#Variable Declaration
theta=12                   # glancing angle
lam=2.82*10**-10           # interplanar spacing
n=1.0                      # order of diffraction

#Calculation
d=n*lam/(2*math.sin(theta*math.pi/180))

#Result
print('The interplanar spacing is %.3f *10^-10 m'%(d*10**10))
The interplanar spacing is 6.782 *10^-10 m

Example 2.26, page no-46

In [45]:
# Lattice spacing and deBroglie wavelength

import math
#variable Declaration
theta=27.5/2                 # glancing angle 
a=0.563*10**-9               # lattice constant
n=1.0                        # order of diffraction
h=1.0                        # Miller indices wrt X-axis
k=1.0                        # Miller indices wrt Y-axis
l=1.0                        # Miller indices wrt Z-axis

#calaculation
d=a/math.sqrt(h**2+k**2+l**2)
lam=2*d*math.sin(theta*math.pi/180)/n

#Result
print('\nThe lattice spacing for the plane (111) is %.2f * 10^-10 m'%(d*10**10))
print('\nThe deBroglie wavelength of the neutrons is %.3f *10^-10 m'%(lam*10**10))
The lattice spacing for the plane (111) is 3.25 * 10^-10 m

The deBroglie wavelength of the neutrons is 1.545 *10^-10 m

Example 2.27, page no-46

In [46]:
# Lattice constant and atomic radius

import math
#variable declaration
h=1.0                       # Miller indices wrt X-axis
k=1.0                       # Miller indices wrt Y-axis
l=0.0                       # Miller indices wrt Z-axis
d=2*10**-10                 #interplanar spacing

#Calculation
a=d*math.sqrt(h**2+k**2+l**2)
R=a/(2*math.sqrt(2))

#Result
print('The lattice constant is %.3f*10^-10 m\nThe atomic radius of the crystal is %.1f *10^-10 m'%(a*10**10,R*10**10))

#Answer in the book for lattice constant is wrong
The lattice constant is 2.828*10^-10 m
The atomic radius of the crystal is 1.0 *10^-10 m

Example 2.28, page no-47

In [53]:
#energy of the neutron

import math
#variable declaration
theta=22                     # glancing angle
d=1.8*10**-10                # interplanar spacing
n=1.0                        # order of diffraction
h=6.626*10**-34              # planck's constant
m=9.11*10**-31               # mass of an atom kg
e=1.609*10**-19              # Charge of an electron

#calculations
lam=2*d*math.sin(theta*math.pi/180)/n
lam= math.ceil(lam*10**13)/10**13
E=(1/(2*m))*(h/lam)**(2)

#result
print('\nThe deBroglie wavelength of the neutron is %.3f *10^-10\nthe energy of the neutron is %.3f eV'%(lam*10**10,E/e))
The deBroglie wavelength of the neutron is 1.349 *10^-10
the energy of the neutron is 82.295 eV

Example 2.29, page no-48

In [54]:
# InterPlanar Spacing

import math
#variable declaration
h=1.0                      # Miller indices wrt X-axis
k=1.0                      # Miller indices wrt Y-axis
l=1.0                      # Miller indices wrt Z-axis
a=3*10**-10                # lattice spacing

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('\nThe interplanar spacing for the plane(%d%d%d) is %.3f*10^-10 m'%(h,k,l,d*10**10))
The interplanar spacing for the plane(111) is 1.732*10^-10 m

Example 2.30, page no-48

In [56]:
# Lattice spacing from Miller indices 

import math
#variable declaration
h=3.0                      # Miller indices wrt X-axis
k=2.0                      # Miller indices wrt Y-axis
l=1.0                      # Miller indices wrt Z-axis 
rfcc=0.1278*10**-9         # Atomic radius at Fcc State

#calculation
a=4*rfcc/math.sqrt(2)
d=a/math.sqrt(h**2+k**2+l**2)

#Result
print('\nThe lattice constant = %.3f *10^-10\nThe interplanar spacing for the plane(%d%d%d) is %.2f*10^-11 m'%(a*10**10,h,k,l,d*10**11))
The lattice constant = 3.615 *10^-10
The interplanar spacing for the plane(321) is 9.66*10^-11 m

Example 2.31, page no-49

In [57]:
# Number of atoms in Al foil

import math
#variable declaration
a=0.4049*10**-10             # lattice constant
t=0.005                      # thickness of the coil
A=25*10**-2                  # Area of the foil

#calculation
n=t*A/a**3

#Result
print('The number of atoms in the Al foil is %.2f * 10^28'%(n*10**-28))
The number of atoms in the Al foil is 1.88 * 10^28

Example 2.32, page no-49

In [63]:
# energy of the neutron

import math
#variable declaration
theta=20                   # glancing angle
d=2*10**-10                # interplanar spacing
n=1.0                      # order of diffraction
h=6.626*10**-34            # planck's constant
m=1.67*10**-27             # mass of an atom
e=1.609*10**-19            # charge of an electron

#Calculation
lam=2*d*math.sin(theta*math.pi/180)/n
E=(1/(2*m))*(h/lam)**(2)

#Result
print('\nThe deBroglie wavelength of the neutron is %.3f *10^-10\nthe energy of the neutron is %.5f eV'%(lam*10**10,E/e))
The deBroglie wavelength of the neutron is 1.368 *10^-10
the energy of the neutron is 0.04365 eV

Example 2.35, page no-51

In [64]:
# deBroglie wavelength of electrons

import math
#variable declaration
e=1.602*10**-19                 # charge of an electron
h=6.626*10**-34                 # planck's constant
m=9.11*10**-31                  # mass of an electron
ek=235.2*e                      # kinetic energy
n=1.0                           # order of diffraction
theta=9.21                      # glancing angle

#Calculation
lam=h/math.sqrt(2*m*ek)
d=n*lam/(2*math.sin(theta*math.pi/180))

#Result
print('\nThe deBroglie wavelength of electron is %.3f *10^-11 m\nThe interplanar spacing is %.3f *10^-10 m'%(lam*10**11,d*10**10))
The deBroglie wavelength of electron is 7.997 *10^-11 m
The interplanar spacing is 2.498 *10^-10 m

Example 2.36, page no-52

In [65]:
# Lattice spacing from Miller indices

import math
# Intercepts are in the ratio 3a:4b along X,Y and parallel to Z axis
# x-intercept 3, y-intercept 4 and z-intercept infinity 

#variable declaration
a=2.0*10**-10       # 2 Angstrom
h=4.0               # Miller indices wrt X-axis
k=3.0               # Miller indices wrt Y-axis
l=0.0               # Miller indices wrt Z-axis

#calculation
d=a/math.sqrt(h**2+k**2+l**2)

#result
print('The lattice spacing for the plane (%d%d%d) is %.1f*10^-10 m'%(h,k,l,d*10**10))
The lattice spacing for the plane (430) is 0.4*10^-10 m

Example 2.38, page no-53

In [35]:
# Plane Drawing
print('Same as example 2.24 of the same chapter')
Same as example 2.24 of the same chapter