# 2: Crystallography and Crystal Structures¶

## Example number 2, Page number 2.21¶

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

#Variable declaration
a=5.64;      #lattice constant(angstrom)
h1=1;
k1=0;
l1=0;
h2=1;
k2=1;
l2=0;
h3=1;
k3=1;
l3=1;

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

#Result
print "spacing between (100) plane is",d100,"angstrom"
print "spacing between (110) plane is",round(d110,2),"angstrom"
print "answer for spacing between (110) plane given in the book is wrong"
print "spacing between (111) plane is",round(d111,2),"angstrom"

spacing between (100) plane is 5.64 angstrom
spacing between (110) plane is 3.99 angstrom
answer for spacing between (110) plane given in the book is wrong
spacing between (111) plane is 3.26 angstrom


## Example number 3, Page number 2.22¶

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

#Variable declaration
a=3.61*10**-7;        #lattice constant(mm)

#Calculation
A100=a**2;     #surface area(mm**2)
n=1+(4*(1/4));
N1=n/A100;      #number of atoms in (100)(per mm**2)
A110=math.sqrt(2)*a**2;      #surface area(mm**2)
N2=n/A110;      #number of atoms in (110)(per mm**2)
A111=math.sqrt(3)*a**2/2;    #surface area(mm**2)
N3=n/A111;     #number of atoms in (110)(per mm**2)

#Result
print "number of atoms in (100) is",round(N1/10**13,3),"*10**13 atoms/mm**2"
print "number of atoms in (110) is",round(N2/10**13,3),"*10**13 atoms/mm**2"
print "number of atoms in (111) is",round(N3/10**13,3),"*10**13 atoms/mm**2"
print "answers given in the book vary due to rounding off errors"

number of atoms in (100) is 1.535 *10**13 atoms/mm**2
number of atoms in (110) is 1.085 *10**13 atoms/mm**2
number of atoms in (111) is 1.772 *10**13 atoms/mm**2
answers given in the book vary due to rounding off errors


## Example number 4, Page number 2.23¶

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

#Variable declaration
n=4;
A=107.87;    #atomic weight
rho=10500;     #density(kg/m**3)
N=6.02*10**26;    #number of molecules
theta=19+(12/60);   #angle(degrees)
h=1;
k=1;
l=1;
h0=6.625*10**-34;     #planck constant
c=3*10**8;     #velocity of light(m/s)
e=1.6*10**-19;   #charge(coulomb)

#Calculation
a=(n*A/(N*rho))**(1/3);
d=a*10**10/math.sqrt(h**2+k**2+l**2);
lamda=2*d*math.sin(theta);     #wavelength of x rays(angstrom)
E=h0*c/(lamda*10**-10*e);      #energy of x rays(eV)

#Result
print "wavelength of x rays is",round(lamda,3),"angstrom"
print "answer varies due to rounding off errors"
print "energy of x rays is",int(E/10**3),"*10**3 eV"

wavelength of x rays is 1.552 angstrom
answer varies due to rounding off errors
energy of x rays is 8 *10**3 eV


## Example number 5, Page number 2.23¶

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

#Variable declaration
n=8;    #number of atoms
r=2.351*10**-10;     #bond length(angstrom)
A=28.09;                #Atomic wt. of NaCl

#Calculation
a=4*r/math.sqrt(3);
rho=n*A/(N*a**3);     #density(kg/m**3)

#Result
print "density is",int(rho),"kg/m**3"
print "answer varies due to rounding off errors"

density is 2332 kg/m**3
answer varies due to rounding off errors


## Example number 6, Page number 2.24¶

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

#Variable declaration
r=Symbol('r')

#Calculation
a1=4*r/math.sqrt(3);
a2=4*r/math.sqrt(2);

#Result
print "radius of largest sphere is",round(R1/r,4),"r"
print "maximum radius of sphere is",round(R2/r,3),"r"

radius of largest sphere is 0.1547 r
maximum radius of sphere is 0.414 r


## Example number 7, Page number 2.25¶

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

#Variable declaration

#Calculation
a_bcc=4*r1/math.sqrt(3);
v=a_bcc**3;
V1=v/2;
a_fcc=2*math.sqrt(2)*r2;
V2=a_fcc**3/4;
V=(V1-V2)*100/V1;           #percent volume change is",V,"%"

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

percent volume change is 0.5 %