#Example 3.1: miller indices
import math
#given data
x1=1.0;#
x2=1.0;#
x3=2.0;#
h1=1/x1;#
h2=1/x2;#
h3=1/x3;#
print "Miller indices of the plane (112) are: ",h1,",",h2,",",h3
x11=0.0;#
x21=0.0;#
x31=1.0;#
h11=inf;#
h21=inf;#
h31=1/x31;#
print "Miller indices of the plane (001) are : ",h11,",",h21,",",h31
x111=1.0;#
x211=0.0;#
x311=1.0;#
h111=1/x111;#
h211=inf;#
h311=1/x311;#
print "Miller indices of the plane (101) are : ",h111,",",h211,",",h311
#Example 3.2: miller indices
#given data
x1=0.0;#
x2=2.0;#
x3=0.0;#
h1=inf;#
h2=1/x2;#
h3=inf;#
print"Miller indices of the plane (020) are: ",h1,",",h2,",",h3
x11=1.0;#
x21=2.0;#
x31=0;#
h11=1/x11;#
h21=1/x21;#
h31=inf;#
print"Miller indices of the plane (120) are : ",h11,",",h21,",",h31
x111=2.0;#
x211=2.0;#
x311=0.0;#
h111=1/x111;#
h211=1/x211;#
h311=inf;#
print"Miller indices of the plane (220) are : ",h111,",",h211,",",h311
#miller indices for plane (120) is calculated wrong in the book
# Example 3.3: miller indices
x=1/2.0;#
x1=1/x;#
r2=0;#
r3=0;#
x10=-1;#
x2=1.0/x10;#
r4=0;#
r5=0;#
print"miller indices (Case 1) of the given plane are ",x1," : ",r2," : ",r3
print"miller indices (Case 2) of the given plane are ",x2," : ",r3," : ",r4
# Example 3.4: miller indices
a=0.529;#
b=1;#
c=0.477;#
a1=0.264;#
b1=1;#
c1=0.238;#
r1=round(a/a1);#
r2=b/b1;#
r3=round(c/c1);#
print"miller indices of the given plane are ",r1," : ",r2," : ",r3
#Example 3.5: miller indices
#given data
x1=1;#
x2=1;#
x3=0;#
h1=1/x1#
h2=1/x2;#
h3=inf;#
print"Miller indices of the plane (110) are: ",h1,",",h2,",",h3
x11=1;#
x21=1;#
x31=1;#
h11=1/x11;#
h21=1/x21;#
h31=1/x31;#
print"Miller indices of the plane (111) are : ",h11,",",h21,",",h31
# Example 3.9: atoms per unit cell
c=8;#corners
f=6;#faces
nf=(1/2.0)*f;#no. of atoms in all six faces
nc=(1/8.0)*c;#no. of atoms in all corners
ta=nf+nc;#
print ta,"are total number of atoms "
#Example 3.10 : largest diameter
import math
#given data :
a=3.61; # edge length in angstrum
r=(a*math.sqrt(2))/4;
d=2*r;
print round(d,4),"= largest diameter,d(angstrom) "
#Example 3.11 : volume change in percentage
import math
#given data :
r_bcc=0.1258; # in nm
r_fcc=0.1292;# in nm
a_bcc=(r_bcc*4)/math.sqrt(3);
a_fcc=(r_fcc*4)/math.sqrt(2);
v_fcc=(a_fcc)**3;# in nmn**3
v_bcc=(a_bcc)**3; # in nm**3
V=((v_fcc-v_bcc)/v_bcc)*100;
print round(V,2),"=volume change in percentage,V(%) "
#Example 3.12 : number of atom/mm**2
#given data :
a=3.03*10**-7; # lattice constant in mm
A=1/a**2;# for 100 planes
B=0.707/a**2;#for(110) planes
C=0.58/a**2;# for(111) planes
print round(A,-11),"=number of atoms for (100) plane "
print round(B,-10),"=number of atoms for (110) plane "
print round(C,-11),"=number of atoms for (111) plane "
#Example 3.13 : number of atom/mm**2 of planes
#given data :
a=2.87*10**-7; # lattice constant in mm
A=1/a**2;# for 100 planes
B=1.414/a**2;#for(110) planes
C=1.732/a**2;# for(111) planes
print round(A,-11),"=number of atoms for (100) plane "
print round(B,-11),"=number of atoms for (110) plane "
print round(C,-11),"=number of atoms for (111) plane "
#Example 3.14 : number of atom/mm**2 surface area
#given data :
a=4.93*10**-7; # lattice constant in mm
A=2/a**2;# for 100 planes
B=1.414/a**2;#for(110) planes
C=2.31/a**2;# for(111) planes
print round(A,-11),"=number of atoms for (100) plane "
print round(B,-11),"=number of atoms for (110) plane "
print round(C,-11),"=number of atoms for (111) plane "
#Example 3.15 : planar density
#given data :
a=0.143*10**-6; # atomic radius in mm
A=2.31/(a**2);# for(111) planes
print round(A,-10),"= atom,A(atoms/mm**2) "
# answer is wrong in book
#Example 3.16 : volume
import math
#given data :
a=0.2665; # in mm
c=0.4947;# in mm
V=(3*math.sqrt(3)*a**2*c)/2.0;
print round(V,4),"=volume,V(mm**3) "
#Example 3.17 : find the packing efficiency and lattice parameter
#given data :
r=1.22# in angstrum
a=(4*r)/math.sqrt(3);
efficiency=(math.pi*math.sqrt(3))/8;
print round(efficiency,2),"=efficiency "
print round(a,2),"= lattice parameter,a(angstrom) "
#Example 3.18 : interplanar distance
import math
#given data :
h=1;
k=1;
l=1;
#d=a/math.sqrt(h**2+k**2+l**2)
dBYa=1/math.sqrt(h**2+k**2+l**2);
print "Interplaner distance in (Angstrom) is a*",round(dBYa,3)
#Example 3.19 : spacing
import math
#given data :
h1=2;
k1=0;
l1=0;
h2=2;
k2=2;
l2=0;
h3=1;
k3=1;
l3=1;
r=1.246;
a=(4*r)/math.sqrt(2);# in angstrum
#d=a/math.sqrt(h**2+k**2+l**2)
d1=a/math.sqrt(h1**2+k1**2+l1**2);
d2=a/math.sqrt(h2**2+k2**2+l2**2);
d3=a/math.sqrt(h3**2+k3**2+l3**2);
print round(d1,2),"=d_200 spacind,d1(angstrom) "
print round(d2,2),"=d_220 spacind,d2(angstrom) "
print round(d3,2),"=d_111 spacind,d3(angstrom) "
#Example 3.20 : interplaner spacing d_220
import math
#given data :
a=0.316;# in nm
h=2;
k=2;
l=0;
d=a/math.sqrt(h**2+k**2+l**2);
print round(d,3),"= inter planer spacing d_220,d(nm) "
# answer is wrong in book
# Example 3.21: interplanar spacing d220
import math
a=1;#constant assume
a1=[1,0,0];#lattice planes
a2=[1,1,0];#lattice planes
a3=[1,1,1];#lattice planes
d100=a/(math.sqrt(a1[0]+a1[1]**2+a1[2]**2));#interplanar distance between (100)planes
d110=a/(math.sqrt(a2[0]**2+a2[1]**2+a2[2]**2));#interplanar distance between (110)planes
d111=a/(math.sqrt(a3[0]**2+a3[1]**2+a3[2]**2));#interplanar distance between (111)planes
print "ratio of interplanar distances is ",d100,":",round(d110,2),":",round(d111,2)
# Example 3.22: perpendicular distance
import math
a=1;#constant assume
a1=[1,1,1];#lattice planes
a2=[2,2,2];#lattice planes
d1=a/(math.sqrt(a1[0]**2+a1[1]**2+a1[2]**2));#perpendicular distance between origin and (111)planes
d2=a/(math.sqrt(a2[0]**2+a2[1]**2+a2[2]**2));#perpendicular distance between origin and (222)planes
d22 = d1-d2;#perpendicular distance between the planes (111) and (222)
print round(d22,2),"= perpendicular distance between the planes (111) and (222)"
# a is assumed to be 1
# Example 3.23: angle between planes (122) and (111)
import math
a=1;# assume
a1=[1,2,2];#lattice planes
a2=[1,1,1];#lattice planes
d1=a/(math.sqrt(a1[0]**2+a1[1]**2+a1[2]**2));#perpendicular distance between origin and (111)planes
d2=a/(math.sqrt(a2[0]**2+a2[1]**2+a2[2]**2));#perpendicular distance between origin and (222)planes
cphi= ((a1[0]*a2[0])+(a1[1]*a2[1])+(a1[2]*a2[2]))*(d1*d2);#
d=math.degrees(math.acos((cphi)));# in degree
d1=math.floor(d);#
d2=d-d1;#
print"angle between planes (122) and (111) is ",d1," degree ",round(60*d2)," minutes"
#Example 3.24 : concentration of iron
#given data :
d=7.87;
N=6.023*10**23; # avogadro's number
A=55.85;# atomic weight
I=A/N;# mass of iron atom
atom=d/I;
print round(atom,-20),"= number of atoms(atoms/cm**3) "
#Example 3.25 : lattice constant
#given data :
n=2;
A=55.8;
N=6.023*10**26; # avogadro's number in /kg-mole
b=7.87*10**3;# in kg/m**3
a=((A*n)/(N*b))**(1/3.0);
print round(a*10**10,3),"= lattice constant,a(angstrom)"
#Example 3.26 : density
import math
#given data :
n=4;
N=6.023*10**23; # avogadro's number
r=1.278*10**-8;# in cm
A=63.5;
a=(r*4)/math.sqrt(2);# in cm
b=(A*n)/(a**3*N);
print round(b,2),"= density of copper,b(g/cc) "
#Example 3.27 : number of atoms
#given data :
n=4;
N=6.023*10**23; # avogadro's number
A=55.85;
a=2.9*10**-8;
b=7.87;#density in g/cc
#a**3=(A*n)/(N*b)
n=round((a**3*N*b)/A);
print n,"= number of atoms,n "
#Example 3.28 : lattice constant
#given data :
d=6250;#density
N=6.02*10**23;#avogadro's number
n=4;
m=60.2*10**-3;# atomic mass
M=(n*m)/N;
V=M/d;
a=V**(1/3.0)*10**9;
print a,"= the lattice constant,a(nm) "
#ANSWER IS WRONG IN THE TEXT BOOK
#Example 3.29 : the number of atoms
#given data :
d=7.87;#in g/cm**3
A=55.85;
a=2.9*10**-8;# in cm
N=6.02*10**23;#avogadro's number
n=(d*a**3*N)/A;
print round(n),"= the number of atom,n "
# Example 3.30: calculate the number of vacancies in the copper
import math
B=1.38*10**-23;#boltzman constant in J/atom-K
B1=8.62*10**-5;# bolzman constant in ev/atom-K
Qv=0.9;# eV/atom
t=27;# room temperatyre in degree celsius
pcu=8.4;#in g/cm**3
Acv=63.5;# in g/mol
T=t+273;#temperture in kelvin
Nv=6.023*10**23;#
P=8.4;#
Ns=(Nv*P)/Acv;# number of regular lattice sites
Nv1=Ns*math.exp(-Qv/(B1*T));#
print "{:.1e}".format(Nv1),"is number of vacancies in copper in vacancies/cm**3"
#answer is wrong in the textbook
#Example 3.31 : interplanar spacing
import math
#given data :
theta=20.3;#in degree
lamda=1.54;# in angstrum
n=1.0;
a=math.sin(math.radians(theta))
d=lamda/(2*a);
print round(d,2),"= interplanar spacing,d(angstrom) "
#Example 3.32 : interatomic spacing
import math
#given data :
theta=30;#in degree
lamda=1.54;# in angstrum
n=1;
a=math.sin(math.radians(theta))
d=lamda/(2*a);
print d,"=interatomic spacing,d(angstrom) "
#Example 3.33 : number of per order
import math
#given data :
theta=90;#in degree
lamda=1.54;# in angstrum
a=math.sin(math.radians(theta))
d=1.181;
n=(2*d*a)/lamda;
print round(n,2),"= number of order,n "
# Example 3.34: size of unit cell
import math
n=1.0;#
a=1.0;#assume
h=0.58;#wavelnegth in armstrong
th=9.5;#reflection angle in degree
a1=[2.0,0,0];#miller indices
d200=a/(math.sqrt(a1[0]**2+a1[1]**2+a1[2]**2));#interplanar distance between (200)planes
a=((n*h)/(2*d200*math.sin(math.radians(th))));#zsize of unit cell
print round(a,3),"= size of unit cell in Ä"
#amswer is wrong in the textbook
# Example 3.35: bragg angle
import math
n=1;#
a=3.57;#in Ä
h=0.54;#wavelnegth in Ä
a1=[1,1,1];#miller indices
d111=a/(math.sqrt(a1[0]**2+a1[1]**2+a1[2]**2));#interplanar distance between (111)planes
snd=((n*h)/(2*d111));#
th=math.degrees(math.asin(snd));# bragg angle in degree
d1=math.floor(th);#
d2=th-math.floor(d1);#
print"angle between planes (122) and (111) is ",d1," degree ",round(60*d2)," minutes"
#wavelength is given wrong in example it is 0.54Ä and it is taken as 1.54Ä
# Example 3.36: interplanner spacing and miller indices
a=3.16;# in Ä
h=1.54;# in Ä
n=1;#
th=20.3;# in degree
d=((n*h)/(2*math.sin(math.radians(th))));# interplanner spacing in Ä
x=a/d;#
y=x**2;#
print round(d,2),"= interplanner spacing in Ä "
print "miller indices are (110) , (011) or (101)"
# Example 3.36: interplanner spacing and diffraction angle
import math
a=.2866;# in Ä
h=0.1542;# in nm
n=1.0;#
a1=[2.0,1.0,1.0];#miller indices
d211=a/(math.sqrt(a1[0]**2+a1[1]**2+a1[2]**2));#interplanar distance between (211)planes
snd=((n*h)/(2*d211));#
th=math.degrees(math.asin(snd));# bragg angle in degree
d1=math.floor(th);#
d2=th-math.floor(d1);#
print"angle between planes (122) and (111) is ",d1," degree ",round(60*d2)," minutes"
print round(d211,2),"=interplanner spacing in Ä "
#answer is wrong in the textbook