# 11: Crystal Structure¶

## Example number 1, Page number 357¶

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

#Variable declaration
a=1/2;
b=1/3;
c=1/4;     #intercepts along the three axes

#Calculations
def lcm(x, y):
if x > y:
greater = x
else:
greater = y
while(True):
if((greater % x == 0) and (greater % y == 0)):
lcm = greater
break
greater += 1

return lcm

z=lcm(1/a,1/b);
lcm=lcm(z,1/c);
h=a*lcm;
k=b*lcm;
l=c*lcm;      #miller indices of plane

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

miller indices of plane are ( 6 4 3 )


## Example number 2, Page number 357¶

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

#Variable declaration
a=1/2;
b=1/3;
x=float("inf");
c=1/x;     #intercepts along the three axes

#Calculations
def lcm(x, y):
if x > y:
greater = x
else:
greater = y
while(True):
if((greater % x == 0) and (greater % y == 0)):
lcm = greater
break
greater += 1

return lcm

lcm=lcm(1/a,1/b);
h=a*lcm;
k=b*lcm;
l=c*lcm;      #miller indices of plane

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

miller indices of plane are ( 3 2 0 )


## Example number 3, Page number 358¶

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

#Variable declaration
a=1/1;
b=1/2;
c=1/3;     #intercepts along the three axes

#Calculations
def lcm(x, y):
if x > y:
greater = x
else:
greater = y
while(True):
if((greater % x == 0) and (greater % y == 0)):
lcm = greater
break
greater += 1

return lcm

z=lcm(1/a,1/b);
lcm=lcm(z,1/c);
h=a*lcm;
k=b*lcm;
l=c*lcm;      #miller indices of plane

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

miller indices of plane are ( 6 3 2 )


## Example number 4, Page number 359¶

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

#Variable declaration
a=1.1;
b=1.2;
c=1.3;     #intercepts along the three axes(angstrom)
h=2;
k=3;
l=4;       #miller indices of plane

#Calculations
l1=a*h/h;
l2=b*h/k;    #corresponding intercept on Y-axis(angstrom)
l3=c*h/l;    #corresponding intercept on Z-axis(angstrom)

#Result
print "corresponding intercept on Y-axis and Z-axis are",l2,"angstrom and",l3,"angstrom"

corresponding intercept on Y-axis and Z-axis are 0.8 angstrom and 0.65 angstrom


## Example number 5, Page number 360¶

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

#Variable declaration
a=1/1;
b=-1/3;
c=1/2;     #intercepts along the three axes

#Calculations
def lcm(x, y):
if x > y:
greater = x
else:
greater = y
while(True):
if((greater % x == 0) and (greater % y == 0)):
lcm = greater
break
greater += 1

return lcm

z=lcm(1/a,1/b);
lcm=lcm(z,1/c);
h=a*lcm;
k=b*lcm;
l=c*lcm;      #miller indices of plane

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

miller indices of plane are ( 6 -2 3 )


## Example number 6, Page number 360¶

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

#Variable declaration
n=4;        #number of molecules per unit cell
M=63.5;     #molecular weight
rho=8.96*10**3;    #density(kg/m**3)

#Calculations
a=(n*M/(rho*N))**(1/3);     #lattice constant(m)
a=round(a*10**10,2);        #lattice constant(angstrom)
d=a/math.sqrt(2);           #distance between two nearest copper atoms(angstrom)

#Result
print "lattice constant is",a,"angstrom"
print "distance between two nearest copper atoms is",round(d,2),"angstrom"

lattice constant is 3.61 angstrom
distance between two nearest copper atoms is 2.55 angstrom


## Example number 7, Page number 361¶

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

#Variable declaration
n=2;        #number of molecules per unit cell
M=55.85;     #molecular weight

lattice constant is 2.8687 angstrom