# Given
x = 2 # intercepts cut by the plane along vector a of crystallographic axes
y = 3 # intercepts cut by the plane along vector b of crystallographic axes
z = 1 # intercepts cut by the plane along vector c of crystallographic axes
#Calculations
x_ = 6 / x
y_ = 6 / y
z_ = 6 / z
#Result
print "Miller indices of the plane are (%d %d %d)"%(x_,y_,z_)
# Given
x = 1 # intercepts cut by the plane along vector a of crystallographic axes
y = 2 # intercepts cut by the plane along vector b of crystallographic axes
z = -3. / 2 # intercepts cut by the plane along vector c of crystallographic axes
#Calculations
x_ = 6 / x
y_ = 6 / y
z_ = 6 / z
print "Miller indices of the plane are (%d %d %d)"%(x_,y_,z_)
# Given
x1 = 3. # intercepts cut by the plane along vector a of crystallographic axes in first case
y1 = 3. # intercepts cut by the plane along vector b of crystallographic axes in first case
z1 = 2. # intercepts cut by the plane along vector c of crystallographic axes in first case
x2 = 1. # intercepts cut by the plane along vector a of crystallographic axes in second case
y2 = 2. # intercepts cut by the plane along vector b of crystallographic axes in second case
k2 = 0. # raciprocal of intercepts cut by the plane along vector c of crystallographic axes in second case
x3 = 1. # intercepts cut by the plane along vector a of crystallographic axes in third case
y3 = 1./2 # intercepts cut by the plane along vector b of crystallographic axes in third case
z3 = 1. # intercepts cut by the plane along vector c of crystallographic axes in third case
#Calculations
x_1 = 6. / x1
y_1 = 6. / y1
z_1 = 6. / z1
x_2 = 2. / x2
y_2 = 2. / y2
z_2 = 2*k2
x_3 = 2 * x3
y_3 = 2 * y3
z_3 = 2 * z3
#Result
print "Miller indices of the plane (i) In first case are (%d %d %d)\n(ii) In second case are (%d %d %d)\n(iii)In the third case are (%d %d %d)."%(x_1,y_1,z_1,x_2,y_2,z_2,x_3,y_3,z_3)
from math import sqrt
# Given
x1 = 1 # coordinate on x axis for first plane
y1 = 0 # coordinate on y axis for first plane
z1 = 0 # coordinate on z axis for first plane
x2 = 1 # coordinate on x axis for second plane
y2 = 1 # coordinate on y axis for second plane
z2 = 1 # coordinate on z axis for second plane
#Calculations
d1 = 1 / sqrt(x1**2 + y1**2 + z1**2)
d2 = 1 / sqrt(x2**2 + y2**2 + z2**2)
#Result
print "Spacing between the plane in first case is a / %d\nSpacing between the plane in second case is a / %f"%(d1,d2)
from math import sqrt
# Given that
x = 1. # intercepts cut by the plane along vector a of crystallographic axes
y = 2. # intercepts cut by the plane along vector b of crystallographic axes
k = 0. # raciprocal of intercepts cut by the plane along vector c of crystallographic axes
a = 5. # length of vector a of crystallographic axes in angstrom
b = 5. # length of vector b of crystallographic axes in angstrom
c = 5. # length of vector c of crystallographic axes in angstrom
#Calculations
x_ = 2. / x
y_ = 2. / y
z_ = 2 * k
d = a / sqrt(x_**2 + y_**2 + z_**2)
D=d**2
#Result
print "Miller indices of the plane are (%d %d %d)\nInter planar distance is sqrt(%d) angstrom"%(x_,y_,z_,D)
# Given
x = 2 # intercepts cut by the plane along vector a of crystallographic axes
y = 2. / 3 # intercepts cut by the plane along vector b of crystallographic axes
k = 0 # raciprocal of intercepts cut by the plane along vector c of crystallographic axes
#Calculations
x_ = 2. / x
y_ = 2. / y
z_ = 2 * k
#Result
print "Miller indices of the plane are (%d %d %d)"%(x_,y_,z_)
from math import *
# Given
x1 = 2 # coordinate on x axis
y1 = 3 # coordinate on y axis
z1 = 1 # coordinate on z axis
r = 0.175 # atomic radius of fcc structure in nm
#Calculations
a = (4 * r) / sqrt(2)
d = a / sqrt(x1**2 + y1**2 + z1**2)
#Result
print "Inter planar spacing is %.3f nm"%d
# Given
x1 = 1 # coordinate on x axis in first case
y1 = 2 # coordinate on y axis in first case
z1 = 3 # coordinate on z axis in first case
x2 = 1
y2 = 1
z2 = 0
# coordinate of first plane in second case
x3 = 1
y3= 1
z3 = 1
# coordinate of second plane in second case
#Calculations
x_=6/x1
y_=6/y1
z_=6/z1
d1 = 1 / sqrt(x2^2 + y2^2 + z2^2)
d2= 1/ sqrt(x3^2 + y3^2 + z3^2)
d = d1/d2
#Results
print "The ratio of intercepts of three axes by the point are %d : %d : %d\nThe ratio of spacing between two planes is %.3f"%(x_,y_,z_,d)
from math import *
# Given
a = 5 # the lattice constant of the structure in angstrom
#Calculations
d = (sqrt(3) / 4) * a
#Result
print "Distance between two atoms is %.2f A"%d
from math import *
# Given that
a = 3.56 # the length of cube edge in angstrom
#Calculations
d = a / sqrt(2)
#Result
print "Permitive translation vector is %.2f A"%d
# Given
w = 207.2 # atomic weight of Pb
d = 11.36e3 # density of Pb in kg/m^3
a = 3.2e-10 # length of cube edge in meter
N = 6.023e26 # Avogadro's no. in per kg mole
#Calculations
n = (a**3 * d * N) / w
#Result
print "Number of atom per unit cell is %d"%n
# Given
M = 60.2 # molecular weight
d = 6250 # density in kg/m^3
N = 6.023e+26 # Avogadro's no. in per kg mole
n = 4. # for fcc lattice
#Calculations
a = (((4 * M) / (N * d))**(1. / 3)) * 1e10
#Result
print "Lattice constant is %.f A"%a
from math import *
# Given
x1 = 1 # coordinate on x axis of plane
y1 = 0 # coordinate on y axis of plane
z1 = 0 # coordinate on z axis of plane
d = 2.82 # the space between successive plane in angstrom
theta = 8.8 # glancing angle in degree
#Calculations
n = 1
lamda = 2 * d * sin(theta*pi/180) / n
#Result
print "Wavelength of x-ray is %.3f A"%lamda
from math import *
# Given
d = 2.51 # the space between adjacent plane in angstrom
theta = 9 # glancing angle in degree
#Calculations
n = 1 # for n=1
lamda = 2 * d * sin(theta*pi/180) / n
n = 2 # for n=2
theta = degrees(asin(lamda / d))
#Result
print "Wavelength of x-ray is %.4f A\nGlancing angle for second order diffraction is %.1f degree"%(lamda,theta)
from math import *
# Given
lamda = 1.5 # wavelength of x-ray in angstrom
theta = 60 # glancing angle in degree
#Calculations
n = 1 # for first order
d = ( n * lamda) / (2 * sin(theta*pi/180))
#Result
print "Lattice constant of NaCl is %.2f A"%d
from math import *
# Given
lamda = 1.4 # wavelength of x-ray in angstrom
x1 = 1 # coordinate on x axis of plane
y1 = 1 # coordinate on y axis of plane
z1 = 1 # coordinate on z axis of plane
a = 5. # lattice parameter of of crystal in angstrom
#Calculations
n = 1 # for first order
d = a / sqrt(x1**2 + y1**2 + z1**2)
theta = degrees(asin((n * lamda) / (2 * d)))
#Result
print "Angle of incidence of x-ray on the plane is %.f degree"%theta
from math import *
# Given
lamda = 0.710 # wavelength of x-ray in angstrom
x1 = 1 # coordinate on x axis of plane
y1 = 0 # coordinate on y axis of plane
z1 = 0 # coordinate on z axis of plane
a = 2.814 # lattice parameter of of crystal in angstrom
#Calculations
n = 2 # for second order
d = a / sqrt(x1**2 + y1**2 + z1**2)
theta = degrees(asin((n * lamda) / (2 * d)))
#Result
print "Glancing angle is %.1f degree"%theta
from math import *
# Given
n = 1 # order of brag reflection
d = 3.84e-10 # the space between successive plane in m
theta = 30. # glancing angle in degree
#Calculations
lamda = 2 * d * sin(theta*pi/180) / n
v = 6.62e-34 / (1.67e-27 * lamda)
#Result
print "Wavelength of neutron beam is %.2f A\nSpeed of neutron beam is %.2e meter/sec"%(lamda * 10**10,v)
from math import *
# Given
v = 120 # voltage at which electron is accelerated in v
n = 1 # order of Bragg reflection
x1 = 1 # coordinate on x axis of plane
y1 = 1 # coordinate on y axis of plane
z1 = 1 # coordinate on z axis of plane
theta = 22 # angle at which maximum reflection is obtain in degree
n = 1 # order of reflection
#Calculations
lamda = 6.62e-34 / sqrt(2 * 9.1e-31 * 1.6e-19 * v)
d = (n * lamda) / (2 * sin(theta*pi/180))
a = d * sqrt(3)
#Result
print "Lattice parameter is %.3f A"%(a * 10**10)
from math import *
# Given
lamda = 1.24e-10 # wavelength of X-ray in A
x1 = 1 # coordinate on x axis of first plane
y1 = 0 # coordinate on y axis of first plane
z1 = 0 # coordinate on z axis of first plane
x2 = 1 # coordinate on x axis of second plane
y2 = 1 # coordinate on y axis of second plane
z2 = 0 # coordinate on z axis of second plane
x3 = 1 # coordinate on x axis of third plane
y3 = 1 # coordinate on y axis of third plane
z3 = 1 # coordinate on z axis of third plane
M = 74.5 # molecular weight of KCl
d = 1980 # density of KCl in kg/m^3
N = 6.023e+26 # Avogadro's No per Kg mole
#Calculations
a = (4*M / (N*d))**(1./3)
D1 = a/sqrt(x1**2 + y1**2 + z1**2)
D2 = a/sqrt(x2**2 + y2**2 + z2**2)
D3 = a/sqrt(x3**2 + y3**2 + z3**2)
#Result
print "Inter planner distances are - \n(1) in first case %.1f A \n(2) in second case %.2f A \n(3) in third case %.2f A"%(D1*10**10,D2*10**10,D3*10**10)
from math import *
# Given
d = 0.15e-9 # distance between K(+) and Cl(-) in m
#Calculations
v = -1.6e-19 / (4 * pi * 8.85e-12 * d)
#Result
print "Potential energy of molecule is %.1f eV"%v
from math import *
# Given
d = 0.32e-9 # equilibrium separation in m
alpha = 1.748
n = 9
e = 4 # ionization energy in eV
a = -2.16 # electron affinity in eV
#Calculations
E = -((alpha * 1.6e-19) / (4 * pi * 8.85e-12 * d)) * (1 - (1. / n))
#Result
print "Cohesive energy of Nacl is %f eV"%E
#Incorrect answer in the textbook
from math import *
# Given
E = 2.02 # average energy required to produce a Schottky defect at room temperature in eV
k = 1.38e-23 # Boltzmann constant in J/k
T = 300 # room temperature in K
#Calculations
r = exp(-(E * 1.6e-19) / (2 * k * T))
#Result
print "Ratio of number of Schottky defects to total number of cation-anion pairs is %.2e"%r