# 2: Crystal Structure¶

## Example number 2.1, Page number 29¶

In [3]:
#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"

The lattice parameter is 5.77 Angstrom


## Example number 2.2, Page number 29¶

In [6]:
#importing modules
import math
from __future__ import division

#Variable declaration

#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"

The free volume per unit cell is 47.9 *10**-30 m**3


## Example number 2.3, Page number 29¶

In [9]:
#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"

The ratio of vacancies is 2.7 *10**5


## Example number 2.4, Page number 29¶

In [12]:
#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"

The ratio of number of vacancies to the number of atoms is 2.7 *10**-10


## Example number 2.5, Page number 30¶

In [14]:
#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

#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"

The spacing of (111) planes in a monoatomic structure is 0.29 nm


## Example number 2.6, Page number 30¶

In [17]:
#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"

The density of the bcc structure is 5.31 *10**3 kg/m**3


## Example number 2.7, Page number 30¶

In [21]:
#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

#Result
print "The atomic radius is",round(r),"Angstrom"

The atomic radius is 2.0 Angstrom


## Example number 2.8, Page number 30¶

In [24]:
#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"

The lattice parameter is 5.79 Angstrom
answer in the book varies due to rounding off errors


## Example number 2.9, Page number 30¶

In [26]:
#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"

The density of free electrons is 1.167 *10**29 electrons/m**3


## Example number 2.10, Page number 31¶

In [28]:
#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"

The lattice parameter is 0.7 Angstrom