# 2: Crystallography and Crystal Structures¶

## Example number 2.3, Page number 2.9¶

In [5]:
#importing modules
import math
from __future__ import division
from sympy import Symbol
import numpy as np

#Variable declaration
a=Symbol('a');      #lattice constant(mm)
x1=4;
x2=math.sqrt(2);
b=a*math.sqrt(2);
theta=30;   #angle(degrees)

#Calculation
na1=x1*1/(x1*a**2);     #number of atoms in (100)(per mm**2)
na2=1/(x2*a**2);      #number of atoms in (110)(per mm**2)
A3=(1/2)*b*b*math.cos(theta);
t=60/360*3;
na3=t/A3;     #number of atoms in (111)(per mm**2)

#Result
print "number of atoms in (100) is",na1,"atoms/mm**2"
print "number of atoms in (110) is",na2,"atoms/mm**2"
print "number of atoms in (111) is",na3,"atoms/mm**2"

number of atoms in (100) is a**(-2) atoms/mm**2
number of atoms in (110) is 0.707106781186547/a**2 atoms/mm**2
number of atoms in (111) is 0.577350269189626/a**2 atoms/mm**2


## Example number 2.4, Page number 2.11¶

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

#Variable declaration
h1=1;
k1=1;
l1=0;
h2=2;
k2=1;
l2=2;

#Calculation
a=round(4*r/math.sqrt(2),4);
d110=a/math.sqrt(h1**2+k1**2+l1**2);    #interplanar spacing for (110)(nm)
d212=a/math.sqrt(h2**2+k2**2+l2**2);    #interplanar spacing for (212)(nm)

#Result
print "interplanar spacing for (110) is",round(d110,4),"nm"
print "interplanar spacing for (212) is",d212,"nm"

interplanar spacing for (110) is 0.2556 nm
interplanar spacing for (212) is 0.1205 nm


## Example number 2.5, Page number 2.11¶

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

#Variable declaration
h1=1;
k1=0;
l1=0;
h2=1;
k2=1;
l2=0;
h3=1;
k3=1;
l3=1;

#Calculation
d100=1/math.sqrt(h1**2+k1**2+l1**2);    #interplanar spacing for (110)
d110=1/math.sqrt(h2**2+k2**2+l2**2);    #interplanar spacing for (110)
d111=1/math.sqrt(h3**2+k3**2+l3**2);    #interplanar spacing for (111)

#Result
print "seperation between successive lattice planes is",int(d100),":",round(d110,2),":",round(d111,2)

seperation between successive lattice planes is 1 : 0.71 : 0.58


## Example number 2.6, Page number 2.12¶

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

#Variable declaration
a=1;
b=1/2;
c=3;

#Calculation
A=1/a;
B=1/b;
C=1/c;
h=A*c;
k=B*c;
l=C*c;      #miller indices of plane

#Result
print "miller indices of plane is (",h,k,l,")"

miller indices of plane is ( 3.0 6.0 1.0 )


## Example number 2.7, Page number 2.22¶

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

#Variable declaration
r=1;    #assume

#Calculation
a=4/math.sqrt(3);

#Result
print "radius of interstitial sphere is",round(R,3),"r"

radius of interstitial sphere is 0.155 r


## Example number 2.8, Page number 2.23¶

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

#Variable declaration

#Calculation
a1=4*r1/math.sqrt(3);       #spacing(angstrom)
n1=((1/8)*8)+1;      #number of atoms per unit cell
v1=a1**3/n1;           #volume occupied by 1 atom(m**3)
n2=(1/2*6)+(1/8*8);    #number of atoms per unit cell
a2=2*math.sqrt(2)*r2;   #spacing(angstrom)
v2=a2**3/n2;           #volume occupied by 1 atom(m**3)
dc=(v1-v2)*100/v1;     #change in volume(%)

#Result
print "decrease of volume is",round(dc,1),"%"

decrease of volume is 0.5 %


## Example number 2.9, Page number 2.24¶

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

#Variable declaration
a=0.27*10**-9;     #spacing(m)
c=0.494*10**-9;
n=6;    #number of atoms
M=65.37;    #atomic weight

#Calculation
V=3*math.sqrt(3)*a**2*c/2;     #volume of unit cell(m**3)
rho=n*M/(N*V);     #density of zinc(kg/m**3)

#Result
print "volume of unit cell is",round(V*10**29,3),"*10**-29 m**3"
print "density of zinc is",int(rho),"kg/m**3"
print "answer varies due to rounding off errors"

volume of unit cell is 9.356 *10**-29 m**3
density of zinc is 6960 kg/m**3
answer varies due to rounding off errors


## Example number 2.10, Page number 2.24¶

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

#Variable declaration
r=1;    #assume

#Calculation
a=4*r/math.sqrt(2);

#Result
print "radius of interstitial sphere is",round(R,3),"r"

radius of interstitial sphere is 0.414 r


## Example number 2.11, Page number 2.25¶

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

#Variable declaration
a=0.356*10**-9;       #cube edge(m)
m=12.01;    #atomic weight of carbon

#Calculation
n=8/a**3;     #number of atoms per m**3
M=m/N;
d=M*n;       #density of diamond(kg/m**3)

#Result
print "number of atoms per m**3 is",round(n/10**29,2),"*10**29"
print "density of diamond is",round(d,1),"kg/m**3"
print "answer varies due to rounding off errors"

number of atoms per m**3 is 1.77 *10**29
density of diamond is 3535.7 kg/m**3
answer varies due to rounding off errors


## Example number 2.12, Page number 2.26¶

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

#Variable declaration
mw=23+35.5;     #molecular weight of NaCl(gm/mol)
d=2.18;       #mass of unit volume

#Calculation
M=mw/N;     #mass of NaCl molecule(gm)
n=2*d/M;      #number of atoms per unit volume(atoms/cm**3)
a=(1/n)**(1/3);     #distance between 2 adjacent atoms(cm)

#Result
print "distance between 2 adjacent atoms is",round(a*10**8,2),"angstrom"

distance between 2 adjacent atoms is 2.81 angstrom


## Example number 2.13, Page number 2.26¶

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

#Variable declaration
M=63.5;    #atomic weight
n=4;

#Calculation
m=M/N;     #mass of copper atom(gm)
a=4*r/math.sqrt(2);
Mu=n*m;     #mass of unit cell
d=Mu/a**3;    #density of copper crystal(gm/cm**3)

#Result
print "density of copper crystal is",round(d,3),"gm/cm**3"

density of copper crystal is 8.929 gm/cm**3


## Example number 2.14, Page number 2.27¶

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

#Variable declaration
pf=0.68;      #packing factor

#Calculation
a=4*r/math.sqrt(3);    #lattice constant(m)
v=a**3;     #volume of unit cell(m**3)
Fv=(1-pf)*v;     #free volume per unit cell(m**3)

#Result
print "free volume per unit cell is",round(Fv*10**30,4),"*10**-30 m**3"
print "answer varies due to rounding off errors"

free volume per unit cell is 7.6795 *10**-30 m**3
answer varies due to rounding off errors