import math
#Given Data
r = 1.278*10**-10; # Atomic radius of fcc structure, m
a = 4*r/math.sqrt(2); # Lattice parameter of fcc strucure, m
V = a**3; # Volume of fcc unit cell, metre, cube
print"The lattice parameter of fcc strucure =","{0:.3e}".format(a),"m";
print"The volume of fcc unit cell =","{0:.3e}".format(V),"metre cube";
import math
#Given Data
r = 0.143*10**-9; # Radius of Nb unit cell, m
d = 8.57*10**3; # Density of Nb unit cell, kg/metre-cube
M = 92.91*10**-3; # Atomic weight of Nb, kg per mole
N = 6.023*10**23; # Avogadro's No.
# For fcc
a = 4*r/math.sqrt(2); # Lattice parameter for fcc structure of Nb, m
n = a**3*d*N/M; # Number of lattice points per unit cell
if ((n%int(n))< 0.001) :
print"The number of atoms associated with the cell is",int(n),", Nb should have fcc structure";
# For bcc
a = 4*r/math.sqrt(3); # Lattice parameter for bcc structure of Nb, m
n = a**3*d*N/M; # Number of lattice points per unit cell
if ((n%int(n)) < 0.001) :
print"The number of atoms associated with the cell is",int(n),", Nb should have bcc structure";
import math
#Given Data
V = 10.58*10**-29; # Volume of the unit cell, metre cube
#3*sqrt(3)/2*1.58*a**3-V) =0; # First lattice parameter, m
a= (V/(3*math.sqrt(3)/2*1.58))**(1.0/3); #Solving for a
c = 1.58*a; # Third lattice parameter, m
print"The lattice parameters of hcp structure of Ti are:";
print"a =",round(a/10**-10,3),"angstorm, c =",round(c/10**-10,3),"angstorm";
# Result
# The lattice parameters of hcp structure of Ti are:
# a = 2.95 angstorm, c = 4.67 angstorm
import math
#Given Data
c_by_a_ratio = 1.633; # Ideal c/a ratio
A = [[1,2,3,4],[5,6,7,8]] # Declare a cell
# Assign values to the elements of the cell from the table
A[0][0] = 'Mg';
A[1][0] = 'Cd';
A[0][1] = 5.21;
A[1][1] = 5.62;
A[0][2] = 3.21;
A[1][2]= 2.98;
A[0][3] = A[0][1]/A[0][2];
A[1][3] = A[1][1]/A[1][2];
if (A[0][3] - c_by_a_ratio) < 0.01:
print"",A[0][0],"satisfies ideal c/a ratio and",A[1][0],"has large deviation from this value.";
else:
if (A[0][3] - c_by_a_ratio) < 0.01:
print"",A[1][0],"satisfies ideal c/a ratio and",A[0][0],"has large deviation from this value.";
import math
#Given Data
M_Na = 23; # Atomic weight of Na, gram per mole
M_Cl = 35.5; # Atomic weight of Cl, gram per mole
d = 2.18*10**6; # Density of Nacl salt, g per metre cube
n = 4; # No. of atoms per unit cell for an fcc lattice of NaCl crystal
N = 6.023*10**23; # Avogadro's No.
# Volume of the unit cell is given by
# a**3 = M*n/(N*d)
# Solving for a
a = (n*(M_Na + M_Cl)/(d*N))**(1.0/3); # Lattice constant of unit cell of NaCl
print"Lattice constant for the NaCl crystal =",round(a/10**-10,3),"angstorm";
import math
#Given Data
r = 1.33; # Ionic radii of K+ ion, angstrom
R = 1.81; # Ionic radii of Cl- ion, angstrom
n = 4; # No. of atoms per unit cell for an fcc lattice of NaCl crystal
APF = (n*(4*math.pi*r**3/3)+n*(4*math.pi*R**3/3))/(2*r+2*R)**3; # Atomic packing factor of fcc KCl
print"The ionic packing factor of fcc KCl =",round(APF,3);
import math
#Given Data
N = 6.023*10**23; # Avogadro's number
M = 12.01*10**-3; # Atomic weight of diamond/graphite, kg
# For diamond
a = 3.568*10**-10; # Lattice parameter of diamond, m
rho = 3.518*10**3; # Density of diamond, kg per metre cube
n = a**3*rho*N/M; # Number of atoms in the unit cell of diamond structure
print"The number of atoms in the unit cell of diamond structure =",int(n);
# For graphite
a = 2.451*10**-10; # First lattice parameter of graphite, m
c = 6.701*10**-10; # Third lattice parameter of graphite, m
rho = 2.2589*10**3; # Density of graphite, kg per metre cube
V = 3*math.sqrt(3)*a**2*c/2; # Volume of hexagonal unit cell of graphite, metre cube
n = V*rho*N/M; # Number of atoms in the unit cell of graphite structure
print"The number of atoms in the unit cell of graphite structure =",round(n);
# Result
# The number of atoms in the unit cell of diamond structure = 8
# The number of atoms in the unit cell of graphite structure = 12
import math
#Given Data
N = 6.023*10**23; # Avogadro's number
# For silicon crystallized into diamond structure
a = 5.43*10**-8; # Lattice parameter of Si, cm
M = 28.1; # Atomic mass of Si, g/mol
n = 8/a**3; # Number of atoms per unit volume, atoms per cm cube
d = n*M/N; # Density of Si crytal, g/cm
print"The density of crystallized Si =",round(d,3),"gram per cm cube";
# For GaAs crystallized into Zinc Blende structure
a = 5.65*10**-8; # Lattice parameter of GaAs, cm
M_Ga = 69.7; # Atomic weight of Ga, g/mol
M_As = 74.9; # Atomic weight of As, g/mol
M = M_Ga + M_As; # Atomic weight of GaAs, g/mol
n = 4.0/a**3; # Number of atoms per unit volume, atoms per cm cube
d = n*M/N; # Density of Si crytal, g/cm
print"The density of crystallized GaAs =",round(d,3),"gram per cm cube";
import math
#Given Data
N = 6.023*10**23; # Avogadro's number
r1 = 0.122*10**-9; # Ionic radii of Ga, m
r2 = 0.125*10**-9; # Ionic radii of As, m
r3 = 0.11*10**-9; # Ionic radii of P, m
# For GaP
r = r1 + r3; # Interatomic separation between Ga and P atoms, m
a = 4*r/3**(1.0/2); # Lattice parameter of GaP structure, m
print"The lattice parameter of GaP structure =",round(a/10**-10,3),"angstrom";
# For GaAs
r = r1 + r2; # Interatomic separation between Ga and As atoms, m
a = 4*r/3**(1.0/2); # Lattice parameter of GaP structure, m
print"The lattice parameter of GaAs structure =",round(a/10**-10,3),"angstrom";
import math
#Given Data
def string(r_ratio):
if(r_ratio > 0.732):
st = 'Caesium Chloride';
else :
if(r_ratio < 0.732):
st = 'Rock Salt';
else :
if(r_ratio < 0.414):
st = 'Rutile';
return st
crystal = [[1,2],[3,4],[5,6],[7,8],[9,10],[11,12]]; # Declare cells of 6 rows and 2 columns
crystal[0][0] = 'I';
crystal[0][1] = 2.19; # Ionic radius of I, angstrom
crystal[1][0] = 'Cl';
crystal[1][1]= 1.81; # Ionic radius of Cl, angstrom
crystal[2][0] = 'Na';
crystal[2][1] = 0.95; # Ionic radius of Na, angstrom
crystal[3][0] = 'Cs';
crystal[3][1] = 1.69; # Ionic radius of Cs, angstrom
crystal[4][0] = 'Mg';
crystal[4][1] = 0.99; # Ionic radius of Mg2+, angstrom
crystal[5][0] = 'O';
crystal[5][1] = 1.40; # Ionic radius of O2-, angstrom
print"The crystal structure of",crystal[2][0],crystal[0][0],"with radius ratio =",round(crystal[2][1]/crystal[0][1],4),"is",string(crystal[2][1]/crystal[0][1]);
print"The crystal structure of",crystal[2][0],crystal[1][0],"with radius ratio =",round(crystal[2][1]/crystal[1][1],4),"is",string(crystal[2][1]/crystal[1][1]);
print"The crystal structure of",crystal[3][0],crystal[1][0],"with radius ratio =",round(crystal[3][1]/crystal[1][1],4),"is",string(crystal[3][1]/crystal[1][1]);
print"The crystal structure of",crystal[3][0],crystal[0][0],"with radius ratio =",round(crystal[3][1]/crystal[0][1],4),"is",string(crystal[3][1]/crystal[0][1]);
print"The crystal structure of",crystal[4][0],crystal[5][0],"with radius ratio =",round(crystal[4][1]/crystal[5][1],4),"is",string(crystal[4][1]/crystal[5][1]);
import math
#Given Data
R = 1; # For simplicity we assume radius of atom to be unity, m
# For bcc Structure,
a = 4*R/math.sqrt(3); # Lattice parameter of bcc crystal, m
# We have R+r = a/2, solving for r
r = a/2-R # Relation between radius of the void and radius of the atom, m
print"The maxiumum radius of the sphere that can fit into void between two bcc unit cells =",round(r,3),"R";
import math
#Given Data
R = 1; # For simplicity we assume radius of atom to be unity, m
# For fcc Structure,
a = 4*R/math.sqrt(2); # Lattice parameter of fcc crystal, m
# We have R+r = a/2, solving for r
r = a/2-R # Relation between radius of the void and radius of the atom, m
print"The maxiumum radius of the sphere that can fit into void between two fcc unit cells =",round(r,3),"R";
import math
#Given Data
R = 1; # For simplicity we assume radius of atom to be unity, m
# For bcc Structure,
a = 4*R/math.sqrt(3); # Lattice parameter of bcc crystal, m
# We have (R+r)**2 = (a/2)**2+(a/4)**2, solving for r
r = math.sqrt(5)*a/4-R # Relation between radius of the void and radius of the atom, m
print"The radius of largest void in the bcc lattice =",round(r,3),"R";
# For fcc Structure,
a = 4*R/math.sqrt(2); # Lattice parameter of fcc crystal, m
# We have (R+r)**2 = (a/2)**2+(a/4)**2, solving for r
r_fcc = a/2-R # Relation between radius of the void and radius of the atom, m
print"The radius of largest void in the fcc lattice is",round(r_fcc/r,3),"times larger than that in the bcc lattice";
import math
#Given Data
R = 1; # For simplicity we assume radius of atom to be unity, m
# For bcc Structure,
a = 4*R/math.sqrt(3); # Lattice parameter of bcc crystal, m
# We have (R+r)**2 = (a/2)**2+(a/4)**2, solving for r
r = a/2-R # Relation between radius of the void and radius of the atom, m
print"The radius of void for carbon atoms in iron =",round(r,3),"R";
import math
#Given Data
R = 1; # For simplicity we assume radius of atom to be unity, m
# From the right triangle LMO, LM/LO = R/(R + r) = cosd(30), solving for r
r =R/math.cos(math.radians(30))-R;
print"The radius of triangular void =",round(r,3),"R";
import math
#Given Data
R = 1; # For simplicity we assume radius of atom to be unity, m
# From the right triangle LMN similar to trinagle LPO, LM/LO = R/(R + r) = LP/LO = sqrt(2/3), solving for r
r = R/math.sqrt(2./3)-R;
print"The radius ratio of tetragonal void =",round(r/R,3);
import math
#Given Data
R = 1; # For simplicity we assume radius of atom to be unity, m
# From the isosceles right triangle LMN, LM/LO = (R + r)/R = sqrt(2)/1, solving for r
r =R*math.sqrt(2)-R;
print"The radius ratio of octahedral void =",round(r/R,3);
import math
#Given Data
p = 3; q = -3; r = 3.0/2; # Coefficients of intercepts along three axes
h = 1.0/p; # Reciprocate the first coefficient
k = 1.0/q; # Reciprocate the second coefficient
l = 1.0/r; # Reciprocate the third coefficient
# Find l.c.m. of m,n and p is 3
mul_fact = 3;
h = h*mul_fact; # Clear the first fraction
k = k*mul_fact; # Clear the second fraction
l = l*mul_fact; # Clear the third fraction
print"The required miller indices are : (",int(h),int(k),int(l),")";
import math
#Given Data
p = 2; q = 3; r = 4; # Coefficients of intercepts along three axes
h = 1.0/p; # Reciprocate the first coefficient
k = 1.0/q; # Reciprocate the second coefficient
l = 1.0/r; # Reciprocate the third coefficient
# Find l.c.m. of m,n and p
# l.c.m. of 2 and 4 is 4 and l.c.m. of 4 and 3 is 12
#hence l.c.m = 12
mul_fact =12 ;
h = h*mul_fact; # Clear the first fraction
k = k*mul_fact; # Clear the second fraction
l = l*mul_fact; # Clear the third fraction
print"The required miller indices are : (",int(h),int(k),int(l),")";
import math
#Given Data
p = 4; q = 4; r = float('inf'); # Coefficients of intercepts along three axes
h = 1.0/p; # Reciprocate the first coefficient
k = 1.0/q; # Reciprocate the second coefficient
l = 1.0/r; # Reciprocate the third coefficient
# Find l.c.m. of m,n and p
#l.c.m of p and q is 4
mul_fact =4;
h = h*mul_fact; # Clear the first fraction
k = k*mul_fact; # Clear the second fraction
l = l*mul_fact; # Clear the third fraction
print"The required miller indices are : (",int(h),int(k),int(l),")";
import math
#Given Data
a = 0.424; b = 2; c = 0.367; # Intercepts on planes along three axes, m
# Here pa = 0.424; qb = 2; rc = 0.183, solving for p, q and r, we have
p = 0.424/a; q = 2/b; r = 0.183/c; # Coefficients of intercepts along three axes
h = 1.0/p; # Reciprocate the first coefficient
k = 1.0/q; # Reciprocate the second coefficient
l = 1.0/r; # Reciprocate the third coefficient
print"The required miller indices are :(",int(h),int(k),int(l),")";
import math
#Given Data
r = 1.746*10**-10; # Atomic radius of lead atom, angstrom
a = 4*r/math.sqrt(2); # Interatomic spacing, m
h = 1; k = 0; l = 0; # Miller Indices for planes in a cubic crystal
d_100 = a/(h**2+k**2+l**2)**(1.0/2); # The interplanar spacing for cubic crystals, m
print"The interplanar spacing between consecutive (100) planes =",round(d_100/1e-010,3),"angstrom";
h = 1; k = 1; l = 0; # Miller Indices for planes in a cubic crystal
d_110 = a/(h**2+k**2+l**2)**(1.0/2); # The interplanar spacing for cubic crystals, m
print"The interplanar spacing between consecutive (110) planes =",round(d_110/1e-010,3),"angstrom";
h = 1; k = 1; l = 1; # Miller Indices for planes in a cubic crystal
d_111 = a/(h**2+k**2+l**2)**(1.0/2); # The interplanar spacing for cubic crystals, m
print"The interplanar spacing between consecutive (111) planes =",round(d_111/1e-010,3),"angstrom";
import math
#Given Data
e = 1.6*10**-19; # Energy equivalent of 1 eV, J/eV
h = 6.626*10**-34; # Planck's constant, Js
c = 3.0*10**8; # Speed of light, m/s
E_K = 13.6*29**2; # Energy of electron in the K-shell
E_L = 13.6*29**2/4; # Energy of electron in the L-shell
# As E_K - E_L = h*c/lambda, solving for lambda
lamda = h*c/((E_K - E_L)*e); # Wavelength of K_alpha radiation of tungsten, m
print"The wavelength of K_alpha radiation of Cu =",round(lamda/1e-010,3),"angstrom";
import math
#Given Data
e = 1.6*10**-19; # Energy equivalent of 1 eV, J/eV
h = 6.626*10**-34; # Planck's constant, Js
c = 3.0*10**8; # Speed of light, m/s
E_K = 13.6*74**2; # Energy of electron in the K-shell
E_L = 13.6*74**2/4; # Energy of electron in the L-shell
# As E_K - E_L = h*c/lambda, solving for lambda
lamda = h*c/((E_K - E_L)*e); # Wavelength of K_alpha radiation of tungsten, m
print"The wavelength of K_alpha radiation of tungsten =","{0:.3e}".format(lamda/1e-010),"angstrom";
import math
#Given Data
a_Cu = 3.61; # Lattice constant of Cu, angstrom
a_Pd = 3.89; # Lattice constant of Pd, angstrom
# For x = 20% of Pd
x = 0.20; # Percentage of Pd in Cu-Pd alloy
a_Cu_Pd = ((1-x)*a_Cu + x*a_Pd);
print"For",x*100,"percent of Pd in Cu-Pd alloy, a =",a_Cu_Pd,"angstrom";
# For x = 40% of Pd
x = 0.40; # Percentage of Pd in Cu-Pd alloy
a_Cu_Pd = ((1-x)*a_Cu + x*a_Pd);
print"For",x*100,"percent of Pd in Cu-Pd alloy, a =",a_Cu_Pd,"angstrom";
# For x = 60% of Pd
x = 0.60; # Percentage of Pd in Cu-Pd alloy
a_Cu_Pd = ((1-x)*a_Cu + x*a_Pd);
print"For",x*100,"percent of Pd in Cu-Pd alloy, a =",a_Cu_Pd,"angstrom";
# For x = 80% of Pd
x = 0.80; # Percentage of Pd in Cu-Pd alloy
a_Cu_Pd = ((1-x)*a_Cu + x*a_Pd);
print"For",x*100,"percent of Pd in Cu-Pd alloy, a =",a_Cu_Pd,"angstrom";
import math
#Given Data
a_Rh = 3.80; # Lattice constant of Rh, angstrom
a_Pt = 3.92; # Lattice constant of Pt, angstrom
a_Pt_Rh = 3.78; # Lattice constant of unit cell of Pt-Rh alloy, angstrom
V = (a_Pt*1e-08)**3; # Volume of unit cell of Pt, metre cube
V_90 = 0.9*V; # 90 percent of the cell volume of Pt, metre cube
# For x = 20% of Rh in Pt-Rh alloy, we have
# a_Pt_Rh = ((1-x)*a_Pt + x*a_Rh), solving for x
x = (a_Pt_Rh - a_Pt)/(a_Rh-a_Pt); # Amount of required Rh in Pt to change the unit cell volume
print"The amount of Rh required in Pt to change the unit cell volume =",round(x,2),"percent";
import math
#Given Data
r_bcc = 0.126; # Atomic radius of the iron atoms in the bcc structure, nm
r_fcc = 0.129; # Atomic radius of the iron atoms in the fcc structure, nm
a_bcc = 4*r_bcc/math.sqrt(3);
a_fcc = 4*r_fcc/math.sqrt(2);
V_bcc = 2*a_bcc**3; # Volume of bcc unit cell, nm cube
V_fcc = a_fcc**3; # Volume of fcc unit cell, nm cube
delta_V = V_fcc - V_bcc; # Change in volume from bcc to fcc structure, nm cube
V = V_bcc;
V_frac = delta_V/V; # Fractional change in volume from bcc to fcc structure
print"The percentage change in volume from bcc to fcc structure =",round(V_frac*100,2),"percent";