# 2: Crystal Structure¶

## Example number 2.1, Page number 27¶

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

#Variable declaration
M=28;     #atomic weight of Si
a=5.3*10**-10;      #lattice constant(m)
n=4;

#Calculations
V=a**3;          #volume(m**3)
m=M/(N*10**3);           #mass(kg)
rho=n*m/V;       #volume density(kg/m**3)

#Result
print "volume density is",round(rho,2),"kg/m**3"
print "answer in the book is wrong"

volume density is 1249.04 kg/m**3
answer in the book is wrong


## Example number 2.2, Page number 27¶

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

#Variable declaration
M=55.85;     #atomic weight
a=2.9*10**-8;      #lattice constant(m)
rho=7.87;       #volume density(gm/cc)

#Calculations
n=rho*N*a**3/M;       #number of atoms per unit cell

#Result
print "number of atoms per unit cell is",int(n)
print "the lattice is BCC"

number of atoms per unit cell is 2
the lattice is BCC


## Example number 2.3, Page number 28¶

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

#Variable declaration
M=120;     #atomic mass
n=2;
g=20;       #mass(gm)

#Calculations
u=n*M/N;
nu=g/u;       #number of unit cells

#Result
print "number of unit cells is",round(nu/10**22,3),"*10**22"

number of unit cells is 5.019 *10**22


## Example number 2.4, Page number 33¶

In [2]:
#importing modules
import math
from __future__ import division
from fractions import gcd

#Variable declaration
a=1;
b=2;
c=float("inf");      #intercepts

#Calculation
lcm=a*b/gcd(a,b);
h=int(lcm/a);
k=int(lcm/b);
l=int(lcm/c);     #miller indices

#Result
print "miller indices are (",h,k,l,")"

miller indices are ( 2 1 0 )


## Example number 2.5, Page number 33¶

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

#Variable declaration
a=2;
b=3;
c=6;      #intercepts

#Calculation
lcm_ab=a*b/gcd(a,b);         #lcm of a and b
lcm=lcm_ab*c/gcd(lcm_ab,c);      #lcm of a,b and c
h=int(lcm/a);
k=int(lcm/b);
l=int(lcm/c);     #miller indices

#Result
print "miller indices are (",h,k,l,")"

miller indices are ( 3 2 1 )


## Example number 2.6, Page number 33¶

In [5]:
#importing modules
import math
from __future__ import division
from fractions import gcd

#Variable declaration
a=4;
b=3;
c=float("inf");      #intercepts

#Calculation
lcm=a*b/gcd(a,b);
h=int(lcm/a);
k=int(lcm/b);
l=int(lcm/c);     #miller indices

#Result
print "miller indices are (",h,k,l,")"

miller indices are ( 3 4 0 )


## Example number 2.7, Page number 33¶

In [1]:
#importing modules
import math
from __future__ import division
from fractions import gcd

#Variable declaration
h=1;
k=-3;
l=2;     #miller indices

#Calculation
lcm_hk=h*k/gcd(h,k);         #lcm of h and k
lcm=lcm_hk*l/gcd(lcm_hk,l);      #lcm of h,k and l
l1=int(lcm/h);
l2=int(lcm/k);
l3=int(lcm/l);              #intercepts

#Result
print "ratio of intercepts is",l1,l2,l3

ratio of intercepts is 6 -2 3


## Example number 2.8, Page number 34¶

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

#Variable declaration
a=1.2;
b=1.8;
c=2.0;       #crystal primitives
x=2;
y=3;
z=1;         #intercepts
h=1.2;       #intercept on X axis

#Calculations
h1=a/x;
k1=b/y;
l1=c/z;
k=h*h1/k1;      #intercept on Y axis
l=h*l1/h1;      #intercept on Z-axis

#Result
print "intercept on Y axis is",k,"angstrom"
print "intercept on Z axis is",l,"angstrom"

intercept on Y axis is 1.2 angstrom
intercept on Z axis is 4.0 angstrom


## Example number 2.9, Page number 39¶

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

#Variable declaration
h1=2;       #intercept on X axis
k1=0;      #intercept on Y axis
l1=0;      #intercept on Z-axis
h2=2;       #intercept on X axis
k2=2;      #intercept on Y axis
l2=0;      #intercept on Z-axis
h3=1;       #intercept on X axis
k3=1;      #intercept on Y axis
l3=1;      #intercept on Z-axis

#Calculations
a=2*math.sqrt(2)*r;      #lattice constant
d1=a/math.sqrt(h1**2+k1**2+l1**2);       #interplanar spacing in 1st plane(angstrom)
d2=a/math.sqrt(h2**2+k2**2+l2**2);       #interplanar spacing in 2nd plane(angstrom)
d3=a/math.sqrt(h3**2+k3**2+l3**2);       #interplanar spacing in 3rd plane(angstrom)

#Result
print "interplanar spacing in 1st plane is",round(d1,3),"angstrom"
print "interplanar spacing in 2nd plane is",d2,"angstrom"
print "interplanar spacing in 3rd plane is",round(d3,4),"angstrom"

interplanar spacing in 1st plane is 1.762 angstrom
interplanar spacing in 2nd plane is 1.246 angstrom
interplanar spacing in 3rd plane is 2.0347 angstrom


## Example number 2.10, Page number 39¶

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

#Variable declaration
h1=0;       #intercept on X axis
k1=1;      #intercept on Y axis
l1=1;      #intercept on Z-axis
h2=1;       #intercept on X axis
k2=0;      #intercept on Y axis
l2=1;      #intercept on Z-axis
h3=1;       #intercept on X axis
k3=1;      #intercept on Y axis
l3=2;      #intercept on Z-axis

#Calculations
d1=h1**2+k1**2+l1**2;       #interplanar spacing in 1st plane(angstrom)
d2=h2**2+k2**2+l2**2;       #interplanar spacing in 2nd plane(angstrom)
d3=h3**2+k3**2+l3**2;       #interplanar spacing in 3rd plane(angstrom)

#Result
print "interplanar spacing in 1st plane is a/math.sqrt(",d1,") angstrom"
print "interplanar spacing in 2nd plane is a/math.sqrt(",d2,") angstrom"
print "interplanar spacing in 3rd plane is a/math.sqrt(",d3,") angstrom"

interplanar spacing in 1st plane is a/math.sqrt( 2 ) angstrom
interplanar spacing in 2nd plane is a/math.sqrt( 2 ) angstrom
interplanar spacing in 3rd plane is a/math.sqrt( 6 ) angstrom


## Example number 2.11, Page number 40¶

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

#Variable declaration
a=4.2;      #lattice constant(angstrom)
h=3;       #intercept on X axis
k=2;      #intercept on Y axis
l=1;      #intercept on Z-axis

#Calculations
d=a/math.sqrt(h**2+k**2+l**2);       #interplanar spacing(angstrom)

#Result
print "interplanar spacing is",round(d,2),"angstrom"

interplanar spacing is 1.12 angstrom


## Example number 2.12, Page number 40¶

In [5]:
#importing modules
import math
from __future__ import division
from fractions import gcd

#Variable declaration
a1=1;
b1=1;
c1=1;      #intercepts in 1st case
a2=2;
b2=3;
c2=6;      #intercepts in 2nd case

#Calculation
lcm_a1b1=a1*b1/gcd(a1,b1);         #lcm of a1 and b1
lcm1=lcm_ab*c1/gcd(lcm_a1b1,c1);      #lcm of a1,b1 and c1
h1=int(lcm1/a1);
k1=int(lcm1/b1);
l1=int(lcm1/c1);     #miller indices in 1st case
lcm_a2b2=a2*b2/gcd(a2,b2);         #lcm of a2 and b2
lcm2=lcm_a2b2*c2/gcd(lcm_a2b2,c2);      #lcm of a2,b2 and c2
h2=int(lcm2/a2);
k2=int(lcm2/b2);
l2=int(lcm2/c2);     #miller indices in 2nd case

#Result
print "miller indices in 1st case are (",h1,k1,l1,")"
print "miller indices in 2nd case are (",h2,k2,l2,")"

miller indices in 1st case are ( 1 1 1 )
miller indices in 2nd case are ( 3 2 1 )


## Example number 2.14, Page number 47¶

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

#Variable declaration
M=63.5;     #atomic weight(gm/mol)
n=4;

#Calculations
m=M/N;           #mass(g)
a=4*r/math.sqrt(2);      #lattice constant(cm)
V=a**3;          #volume(m**3)
rho=n*m/V;       #density of crystal(g/cm**3)

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

density of crystal is 8.929 gm/cm**3


## Example number 2.15, Page number 47¶

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

#Variable declaration
r=1;     #assume

#Calculations
a=4*r/math.sqrt(3);      #lattice constant

#Result"

minimum radius is 0.155 r


## Example number 2.16, Page number 48¶

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

#Variable declaration
r=1;     #assume

#Calculations
a=4*r/math.sqrt(2);      #lattice constant

#Result"

maximum radius is 0.414 r


## Example number 2.17, Page number 48¶

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

#Variable declaration
n1=2;
n2=4;

#Calculations
a1=4*r1/math.sqrt(3);      #lattice constant(m)
V1=a1**3/n1;          #volume(m**3)
a2=2*math.sqrt(2)*r2;      #lattice constant(m)
V2=a2**3/n2;          #volume(m**3)
V=(V1-V2)*100/V1;           #percent volume change

#Result"
print "percent volume change is",round(V,1),"%"

percent volume change is 0.5 %


## Example number 2.18, Page number 51¶

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

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

#Calculations
n=8/a**3;     #number of atoms
m=M/N;        #mass(kg)
rho=m*n;      #density of diamond(kg/m**3)

#Result"
print "number of atoms is",round(n/10**29,2),"*10**29"
print "density of diamond is",round(rho,1),"kg/m**3"
print "answer in the book is wrong"

number of atoms is 1.77 *10**29
density of diamond is 3535.7 kg/m**3
answer in the book is wrong


## Example number 2.20, Page number 55¶

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

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

#Calculations
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 in the book is wrong"

volume of unit cell is 9.356 *10**-29 m**3
density of zinc is 6960 kg/m**3
answer in the book is wrong


## Example number 2.21, Page number 57¶

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

#Variable declaration
a1=5.43*10**-8;    #lattice constant(cm)
M1=28.1;         #atomic weight
n1=8;     #number of atoms
a2=5.65*10**-8;    #lattice constant(cm)
M2=144.6;         #atomic weight
n2=4;     #number of atoms

#Calculations
rho1=n1*M1/(N*a1**3);    #density of Si(gm/cm**3)
rho2=n2*M2/(N*a2**3);    #density of GaAs(gm/cm**3)

#Result"
print "density of Si is",round(rho1,2),"gm/cm**3"
print "density of GaAs is",round(rho2,3),"gm/cm**3"
print "answer in the book varies due to rounding off errors"

density of Si is 2.33 gm/cm**3
density of GaAs is 5.324 gm/cm**3
answer in the book varies due to rounding off errors


## Example number 2.22, Page number 58¶

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

#Variable declaration
rho=6250;       #density(kg/m**3)
M=60.2;         #molecular weight
n=4;     #number of atoms

#Calculations
a=(n*M/(rho*N))**(1/3);       #lattice constant(m)

#Result
print "lattice constant is",int(a*10**10),"angstrom"

lattice constant is 4 angstrom


## Example number 2.23, Page number 58¶

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

#Variable declaration
M=63.54;         #molecular weight
n=4;     #number of atoms

#Calculations
a=4*r/math.sqrt(2);       #lattice constant(cm)
rho=n*M*10**3/(N*a**3);       #density(kg/m**3)

#Result
print "density of copper is",int(rho),"kg/m**3"
print "answer in the book is wrong"

density of copper is 8938 kg/m**3
answer in the book is wrong


## Example number 2.24, Page number 58¶

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

#Variable declaration
rho=7870;       #density(kg/m**3)
M=55.8;         #molecular weight
n=2;     #number of atoms

#Calculations
a=(n*M/(rho*N))**(1/3);      #lattice constant(m)

#Result
print "lattice constant is",round(a*10**10,3),"angstrom"

lattice constant is 2.867 angstrom


## Example number 2.25, Page number 59¶

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

#Variable declaration
rho=6.23;       #density(gm/cc)
M=60;         #molecular weight
n=4;     #number of atoms

#Calculations
a=(n*M/(rho*N))**(1/3);      #lattice constant(cm)

#Result

radius of atom is 1.414 angstrom


## Example number 2.26, Page number 59¶

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

#Variable declaration
rho=2.48;       #density(gm/cc)
M=58;         #molecular weight
n=4;     #number of atoms

#Calculations
a=(n*M/(rho*N))**(1/3);      #lattice constant(cm)
d=2*r;         #distance between ions(angstrom)

#Result
print "distance between ions is",round(d,1),"angstrom"

distance between ions is 3.8 angstrom


## Example number 2.27, Page number 59¶

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

#Variable declaration
rho=8.96;       #density(gm/cc)
M=63.5;         #molecular weight
n=4;     #number of atoms

#Calculations
a=(n*M/(rho*N))**(1/3);      #lattice constant(cm)
d=a/math.sqrt(2)*10**8;      #distance between ions(angstrom)

#Result
print "distance between ions is",round(d,2),"angstrom"

distance between ions is 2.55 angstrom


## Example number 2.28, Page number 60¶

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

#Variable declaration
rho=5.96;       #density(gm/cc)
M=50;         #molecular weight
n=2;     #number of atoms

#Calculations
a=(n*M/(rho*N))**(1/3);      #lattice constant(cm)
pf=n*(4/3)*math.pi*r**3/a**3;      #packing factor

#Result
print "packing factor is",round(pf,2)

packing factor is 0.68


## Example number 2.29, Page number 61¶

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

#Variable declaration
a=1;     #assume
n=2;     #number of atoms

#Calculations
V=4*math.pi*r**3/3;          #volume
f=n*V*100/a**3;      #packing fraction

#Result
print "packing fraction is",int(f),"%"

packing fraction is 68 %


## Example number 2.30, Page number 61¶

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

#Variable declaration
Vd=3*10**22;       #density(gm/cc)
n=8*(1/8);     #number of atoms

#Calculations
a=(n/Vd)**(1/3);      #lattice constant(cm)

#Result
print "lattice constant is",round(a*10**8,2),"angstrom"

lattice constant is 3.22 angstrom