#importing modules
import math
#Variable declaration
r=0.071; #radius in nm
N=6.022*10**26;
#Calculation
r=r*10**-9; #converting r from nm to m
#mass of carbon atom m = 12/N
m=12/N;
#mass of diamond M = 8*mass of one carbon atom
M=8*m;
#volume of diamond V = (8*r/sqrt(3))^3
V=(8*r/math.sqrt(3))**3;
d=M/V; #density in kg/m^3
d=math.ceil(d*100)/100; #rounding off to 2 decimals
#Result
print("density of diamond in kg/m^3 is",d);
#importing modules
import math
#Variable declaration
aBCC=0.332; #lattice constant in nm
aHCP=0.296; #lattice constant in nm
c=0.468; #c in nm
#Calculation
aBCC=aBCC*10**-9; #converting nm to m
Vbcc=aBCC**3;
aHCP=aHCP*10**-9; #converting nm to m
c=c*10**-9; #converting nm to m
Vhcp=6*(math.sqrt(3)/4)*aHCP**2*c;
V=Vhcp-Vbcc;
Vch=(V*100)/Vbcc;
Vch=math.ceil(Vch*100)/100; #rounding off to 2 decimals
#Result
print("percentage change in volume is",Vch);
#answer given in the book is wrong
#importing modules
import math
#Variable declaration
r=1.278; #atomic radius of Cu in Angstrom
A=63.54; #atomic weight of Cu
n=4; #for FCC n=4
Na=6.022*10**26;
#Calculation
r=r*10**-10; #converting atomic radius from Angstrom to m
a=2*math.sqrt(2)*r;
rho=(n*A)/(Na*a**3);
rho=math.ceil(rho*100)/100; #rounding off to 2 decimals
#Result
print("density of Cu in kg/m^3 is",rho);
#answer given in the book is wrong
#importing modules
import math
import numpy as np
#Variable declaration
rho=2180; #density of NaCl in kg/m^3
wNa=23; #atomic weight of Na
wCl=35.5; #atomic weight of Cl
n=4; #for FCC n=4
Na=6.022*10**26;
#Calculation
A=wNa+wCl; #molecular weight of NaCl
x=np.reciprocal(3.);
a=((n*A)/(Na*rho))**x;
#Result
print("interatomic distance in NaCl in m is",a);
#importing modules
import math
#Variable declaration
a=0.42; #lattice constant in nm
h1=1;
k1=0;
l1=1; #indices of the plane (101)
h2=2;
k2=2;
l2=1; #indices of the plane (221)
#Calculation
a=a*10**-9; #converting from nm to m
d1=a/math.sqrt((h1**2)+(k1**2)+(l1**2)); #interplanar spacing for plane (101)
d1=d1*10**9; #converting from m to nm
d1=math.ceil(d1*10**5)/10**5; #rounding off to 5 decimals
d2=a/math.sqrt((h2**2)+(k2**2)+(l2**2)); #interplanar spacing for plane (221)
d2=d2*10**9; #converting from m to nm
#Result
print("interplanar spacing for (101) in nm is",d1);
print("interplanar spacing for (221) in nm is",d2);
#Variable declaration
h1=1;
k1=0;
l1=2; #indices for plane (102)
h2=2;
k2=3;
l2=1; #indices for plane (231)
h3=3;
k3=-1;
l3=2; #indices for plane (31'2)
#Calculation
#intercepts made by the plane is a/h, b/k, c/l
#for plane (102) intercepts are a/1=a, b/0=infinite, c/2
#for plane (231) intercepts are a/2, b/3, c/1=c
#for plane (31'2) intercepts are a/3=a, b/-1=-b, c/2
#Result
print("for plane (102) intercepts are a/1=a, b/0=infinite, c/2");
print("for plane (231) intercepts are a/2, b/3, c/1=c");
print("for plane (312) intercepts are a/3=a, b/-1=-b, c/2");
#importing modules
import math
#Variable declaration
u1=1;
v1=1;
w1=1; #indices for plane (111)
u2=2;
v2=1;
w2=2; #indices for plane (212)
#Calculation
A=u1*u2+v1*v2+w1*w2;
B1=math.sqrt((u1**2)+(v1**2)+(w1**2));
B2=math.sqrt((u2**2)+(v2**2)+(w2**2));
B=A/(B1*B2);
B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals
theta=math.acos(B); #angle in radian
theta=theta*57.2957795; #converting radian to degrees
theeta=math.ceil(theta*10**3)/10**3; #rounding off to 3 decimals
deg=int(theta); #converting to degrees
t=60*(theta-deg);
mi=int(t); #converting to minutes
sec=60*(t-mi); #converting to seconds
sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals
#Result
print("angle between the planes in degrees is",theeta);
print("angle between the planes is",deg,"degrees",mi,"minutes",sec,"seconds");
#answer given in the book is wrong
#importing modules
import math
#Variable declaration
d=0.2338; #interplanar distance in nm
h=-1;
k=1;
l=1; #indices of the plane (1'11)
#Calculation
d=d*10**-9; #converting from nm to m
a=d*math.sqrt((h**2)+(k**2)+(l**2));
a=a*10**9; #converting lattice constant from m to nm
a=math.ceil(a*10**5)/10**5; #rounding off to 5 decimals
#Result
print("lattice constant in nm is",a);
#importing modules
import math
#variable declaration
h1=1;
k1=0;
l1=0; #indices for plane (100)
h2=1;
k2=1;
l2=0; #indices for plane (110)
h3=1;
k3=1;
l3=1; #indices for plane (111)
#Calculation
#d=a/math.sqrt((h**2)+(k**2)+(l**2))
#d100=a/math.sqrt((h1**2)+(k1**2)+(l1**2))
x1=math.sqrt((h1**2)+(k1**2)+(l1**2));
#d100=a/x1 = a/1 = a
#d110=a/math.sqrt((h2**2)+(k2**2)+(l2**2))
x2=math.sqrt((h2**2)+(k2**2)+(l2**2));
x2=math.ceil(x2*10**4)/10**4; #rounding off to 4 decimals
#d110=a/x2 = a/sqrt(2)
#d111=a/math.sqrt((h3**2)+(k3**2)+(l3**2))
x3=math.sqrt((h3**2)+(k3**2)+(l3**2));
x3=math.ceil(x3*10**4)/10**4; #rounding off to 4 decimals
#d111=a/x3 = a/sqrt(3)
#hence d100:d110:d111=a:a/sqrt(2):a/sqrt(3)
#multiplying RHS by sqrt(6) we get d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)
#Result
print("value of x1 is",x1);
print("value of x2 is",x2);
print("value of x3 is",x3);
print("d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)");
#variable declaration
h=2;
k=3;
l=1; #indices for plane (231)
#Calculation
#intercepts made by the plane is a/h, b/k, c/l
#for a cubic unit cell, a=b=c
#for plane (231) intercepts are a/2, a/3, a/1 = a
#ratio of the intercepts is 1/2:1/3:1
#LCM is 6. multiplying by LCM, we get ratio l1:l2:l3 = 3:2:6
#Result
print("l1:l2:l3 = 3:2:6");
#variable declaration
h=1;
k=2;
l=3; #indices for plane (123)
l1=0.8; #l1 in armstrong
a=0.8; #a in armstrong
b=1.2; #b in armstrong
c=1.5; #c in armstrong
#Calculation
#intercepts made by the plane is a/h, b/k, c/l
#for plane (123) intercepts are a/1 = a, b/2, c/3
#ratio of the intercepts l1:l2:l3 = a:b/2:c/3
#thus 0.8:l2:l3 = 0.8:1.2/2:1.5/3
l2=1.2/2; #l2 in armstrong
l3=1.5/3; #l3 in armstrong
#Result
print("value of l2 in armstrong is",l2);
print("value of l3 in armstrong is",l3);
#Result
print("in simple cubic unit cell nearest neighbour distance is a");
print("in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2");
print("in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)");
#importing modules
import math
#variable declaration
a=2.04; #lattice parameter in armstrong
h=2;
k=1;
l=2; #indices for plane (212)
#Calculation
a=a*10**-10; #converting from armstrong to m
d=a/math.sqrt((h**2)+(k**2)+(l**2));
d=d*10**10; #converting from m to armstrong
d=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals
#Result
print("interplanar distance in armstrong is",d);
#importing modules
import math
#variable declaration
r=1.278; #radius of Cu in armstrong
M=63.54; #atomic weight of Cu
rho=8980; #density in kg/m^3
Na=6.022*10**26;
#Calculation
r=r*10**-10; #radius in m
a=math.sqrt(8)*r;
n=(rho*Na*a**3)/M;
#Result
print("interatomic distance in m is",a);
print("number of atoms per Cu unit cell is",int(n));
#variable declaration
a=0.429;
b=1;
c=0.379; #intercepts of an orthorhombic crystal
#Calculation
#ratio of intercepts are 0.214:1:0.188 = (a/0.429)*0.214:1:(c/0.379)*0.188 = a/2:b:c/2
#thus the coefficients are 1/2:1:1/2. inverses are 2,1,2.
#thus miller indices for the first plane are (212)
#ratio of intercepts are 0.858:1:0.754 = (a/0.429)*0.0.858:1:(c/0.379)*0.754 = 2a:b:2c
#thus the coefficients are 2:1:2. inverses are 1/2,1,1/2. LCM is 2. multiplying with LCM we get 1,2,1
#thus miller indices for the second plane are (121)
#ratio of intercepts are 0.429:infinite:0.126 = (a/0.429)*0.429:infinite:(c/0.379)*0.126 = a:infiniteb:c/3
#thus the coefficients are 1:infinte:1/3. inverses are 1,0,3.
#thus miller indices for the third plane are (103)
#Result
print("miller indices for the first plane are (212)");
print("miller indices for the second plane are (121)");
print("miller indices for the third plane are (103)");
#importing modules
import math
import numpy as np
#variable declaration
h1=1;
k1=0;
l1=0; #indices of the first plane (100)
h2=1;
k2=1;
l2=0; #indices of the second plane (110)
h3=1;
k3=1;
l3=1; #indices of the third plane (111)
#Calculation
n_1=np.reciprocal(4.);
n_2=np.reciprocal(2.);
n_3=np.reciprocal(6.);
n1=(n_1*4)+1; #number of atoms per unit cell in (100)
#number of atoms per m^2 is 2/a**2. but a=sqrt(8)*r.
#hence number of atoms per m^2 is 1/(4*r**2)
n2=(n_1*4)+(2*n_2); #number of atoms per unit cell in (110)
#number of atoms per m^2 is 1/a*sqrt(2)*a. but a=sqrt(8)*r.
#hence number of atoms per m^2 is 1/(8*sqrt(2)*r**2)
n3=(n_3*3)+(3*n_2); #number of atoms per unit cell in (111)
#number of atoms per m^2 is 2/(sqrt(3)/4)*a**2. but a=4*r.
#hence number of atoms per m^2 is 1/(2*sqrt(3)*r**2)
#Result
print("number of atoms per unit cell in (100)",n1);
print("number of atoms per m^2 is 1/(4*r**2)");
print("number of atoms per unit cell in (110)",n2);
print("number of atoms per m^2 is 1/(8*sqrt(2)*r**2)");
print("number of atoms per unit cell in (111)",n3);
print("number of atoms per m^2 is 1/(2*sqrt(3)*r**2)");
#importing modules
import math
#variable declaration
r=0.97; #radius of Na+ ion in armstrong
R=1.81; #radius of Cl- ion in armstrong
#Calculation
#atomic packing factor=packing density PD
#PD=Volume of atoms/Volume of unit cell
#volume of unit cell=a**3
#volume of atoms=number of atoms*volume of 1 atom = 4*(4/3)*math.pi*r**3
#but r=a/sqrt(8). hence PD = 4*(4/3)*math.pi*(a/(2*sqrt(2)))**3*(1/a**3) = 0.74
#atomic packing factor = 0.74
r=r*10**-10; #radius of Na+ ion in m
R=R*10**-10; #radius of Cl- ion in m
Vna = (4*4*math.pi*r**3)/3; #volume of Na atoms
Vcl = (4*4*math.pi*R**3)/3; #volume of Cl atoms
V=(2*(r+R))**3; #volume of unit cell
IPF=(Vna+Vcl)/V; #ionic packing factor
IPF=math.ceil(IPF*10**4)/10**4; #rounding off to 4 decimals
#Result
print("atomic packing factor = 0.74");
print("ionic packing factor of NaCl crystal is",IPF);