#importing modules
import math
from __future__ import division
#Variable declaration
d=6.5*10**3; #density of silver bromide(Kg/m**3)
m=187.8; #molecular weight of silver bromide
#Calculation
M=(4*m)/(6.022*10**26); #mass of ion in unit cell(kg)
#d=mass of ions in unit cell/volume of unit cell
a=((M/d)**(1/3))*10**10; #lattice parameter(Angstrom)
#Result
print "The lattice parameter is",round(a,2),"Angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
r=2.3; #atomic radius(Angstrom)
#Calculation
a=(4*r)/math.sqrt(3);
fv=((a)**3-(2*(4/3)*math.pi*r**3))*10**-30; #free volume(m**3)
#Result
print "The free volume per unit cell is",round(fv*10**30,1),"*10**-30 m**3"
#importing modules
import math
from __future__ import division
#Variable declaration
k=8.625*10**-5; #Boltzmann constant(eV/K)
#n1000/n500=ln[n1000/n500]=Ev/1000k
Ev=1.08; #average energy required to create a vacancy(eV)
#Calculation
N=math.exp(Ev/(1000*k)); #ratio of vacancies
#Result
print "The ratio of vacancies is",round(N/10**5,1),"*10**5"
#importing modules
import math
from __future__ import division
#Variable declaration
#n500=N*exp(-Ev/500k)
k=8.625*10**-5; #Boltzmann constant(eV/K)
Ev=0.95; #average energy required to create a vacancy
#Calculation
n=math.exp(-Ev/(500*k)); #n500/N
#Result
print "The ratio of number of vacancies to the number of atoms is",round(n*10**10,1),"*10**-10"
#importing modules
import math
from __future__ import division
#Variable declaration
h=1;
k=1;
l=1;
#d(hkl)=a/sqrt(h^2+k^2+l^2) where "a" is the lattice parameter
r=0.18; #atomic radius(nm)
#Calculation
d111=(2*math.sqrt(2)*r)/math.sqrt((h**2)+(k**2)+(l**2)); #spacing(nm)
#Result
print "The spacing of (111) planes in a monoatomic structure is",round(d111,2),"nm"
#importing modules
import math
from __future__ import division
#Variable declaration
M=200; #atomic weight
a=5; #lattice parameter(angstrom)
Na=6.022*(10**26);
#Calculation
rho=(2*M)/(Na*(a*10**-10)**3); #density of the structure(kg/m**3)
#Result
print "The density of the bcc structure is",round(rho/10**3,2),"*10**3 kg/m**3"
#importing modules
import math
from __future__ import division
#Variable declaration
#Free volume=a^3-[(4/3)*pi*r^3];for sc,a=2r
#Therefore free volume =(2r)^3-[(4/3)*pi*r^3]
fv=30.48*10**-30; #free volume per unit cell(m**3)
#Calculation
r=(fv/(8-(4/3)*math.pi))**(1/3)*(10**10); #atomic radius(angstrom)
#Result
print "The atomic radius is",round(r),"Angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
#free volume=a^3-[2*(4/3)*pi*r^3]
#for bcc a=4r/3^(1/3)
fv=61.72*(10**-30); #free volume(m**3)
#Calculation
a=-(fv/(1-math.pi*math.sqrt(3))/8)**1/3*10**31; #lattice parameter(angstrom)
#Result
print "The lattice parameter is",round(a,2),"Angstrom"
print "answer in the book varies due to rounding off errors"
#importing modules
import math
from __future__ import division
#Variable declaration
rho=9000; #density(kg/m**3)
w=65; #atomic weight
v=1; #volume(m**3)
a=1.4; #average number of free electrons per atom
#Calculation
n=(rho*v)/(w/(6.022*10**26)); #number of atoms
rhoe=n*a; #density of free electrons per atom(electrons/m**3)
#Result
print "The density of free electrons is",round(rhoe/10**29,3),"*10**29 electrons/m**3"
#importing modules
import math
from __future__ import division
#Variable declaration
h=1;
k=0;
l=1;
d101=0.5; #spacing of (101) plane
#Calculation
#d101=a/sqrt((h^2)+(k^2)+(l^2))
a=d101*math.sqrt(2) #lattice parameter(Angstrom)
#Result
print "The lattice parameter is",round(a,1),"Angstrom"