from math import pi
#given
#ionia radius of Na and cl are resp.
r1=0.98*10**(-10) #m
r2=1.81*10**(-10) #m
#no of atons in FCC
N=4
#total volume of Na and cl ions are resp
v1=N*4/3*(pi)*(r1)**3 #m**3
v2=N*4/3*(pi)*(r2)**3 #m**3
#the lattice constant
a=2*r1+2*r2
#average packing fraction
APF=(v1+v2)/a**3
print "the average packing fraction is %0.2f"%(APF)
from math import sqrt
#given
#atomic radius of copper
r=1.278*10**(-8) #cm
#lattice structure of copper is FCC
a=4*r/sqrt(2) #cm
#atomic weight of copper
Aw=63.54
N=4
#avogadro's number
Na=6.023*10**(23)
#density of copper atoms in lattice
rho=Aw*N/(Na*a**3)*1000 #kg/m**3
print "the density of copper is %d kg/m**3"%(rho)
#given
#density of NaCl is
rho=2.18 #g/cm**3
#no of effective atoms in FCC
N=4
#molecular weight of NaCl
Aw=23+35.5
#avogadro's number
Na=6.023*10**(23)
#lenght of sice of the unit cell
a=(Aw*N/(Na*rho))**(1/3)*10**8 #A
#distance between two adjacent atoms
r=a/2 #A
print "the distance b/w the two adjacent atoms is %0.1e A"%(r)
#given
#density of iron
rho=7.86 #gm/cm**3
#atomic weight of iron
Aw=55.85
#iron has BCC unit structure
Ne=2
#avogadros no.
Na=6.023*10**(23)
#side of the unit cell
a=(Aw*Ne/(Na*rho))**(1/3) #cm
#atomic radius
r=3**(1/3)*a/4*10**8 #A
print "the atomic radius of iron is %0.1e A"%(r)
from __future__ import division
#given
#the intercepts
#c1(along x-axis)=a
#c2(along y-axis)=b/2
#c3(along z-axis)=3*c
#therefore
p=1
q=1.0/2
r=3
#so
h=1/p
k=1/q
l=1/r
#hence (hkl)=(121/3)=1/3*(361) or (361)
print "miller indices for such a simple cubic unit cell is",
print str('%0.f')%(h/l)+str('%0.f')%(k/l)+str('%0.f')%(l/l)
from __future__ import division
#given
#the ratio of intercepts of orthorombic unit cell is a:b:c=0.429:1:0.379
#to find:- the miller indices of faces of the following intecepts
#(I) 0.214:1:0.188
#(II) 0.858:1:0.754
#(III) 0.429:1:0.126
#solution
#let
x=0.429
y=1
z=0.379
x1=0.214
y1=1
z1=0.188
p1=x1/x
q1=y1/y
r1=z1/z
#intercepts will be 1/2:1:1/2
#reciprocal is 2:1:2
#so miller indices is (212)
x2=0.858
y2=1
z2=0.754
p2=x2/x
q2=y2/y
r2=z2/z
#intercepts willbe 2:1:2
#reciprocal is 1/2:1:1/2
#so miller inces is (121)
x3=0.429
y3=1
z3=0.126
p3=x3/x
q3=y3/y
r3=z3/z
#th e intercept will be 1:1:1/3
#reciprocal is 1:1:3
#so miller indices is (113)
print "the miller indices for part (I),(II) and (III) are :"
print str('%0.f')%(1/p1)+str('%0.f')%(1/q1)+str('%0.f')%(1/r1)+'',
print str('%0.f')%(1/p2*p2)+str('%0.f')%(1/q2*p2)+str('%0.f')%(1/r2*p2)+'',
print str('%0.f')%(1/p3)+str('%0.f')%(1/q3)+str('%0.f')%(1/r3),
print 'respectively'
#given
#a:b:c=4:3:2
#so
a=4
b=3
c=2
#intercepts are
x=2 #armstrong
y=3 #armstrong
z=4 #armstrong
p=x/a
q=y/b
r=z/c
#reciprocals will be
h=1/p
k=1/q
l=1/r
#(hkl)=(2 1 1/2)=1/2*(421)=(421)
print "the miller indices is",
print str('%0.f')%(h/l)+str('%0.f')%(k/l)+str('%0.f')%(l/l)
from math import sqrt
#given
#atomic radius in a FCC crystal is
r=1.246 #A
#side of the unit cell
a=4*r/sqrt(2) #A
#part(I)
h1=2
k1=0
l1=0
d1=a/sqrt((h1)**2+(k1)**2+(l1)**2) #A
#part (II)
h2=2
k2=2
l2=0
d2=a/sqrt((h2)**2+(k2)**2+(l2)**2) #A
#part (III)
h3=1
k3=1
l3=1
d3=a/sqrt((h3)**2+(k3)**2+(l3)**2) #A
print "the inteplaners spacing will be d1,d2 and d3 are %0.3f A, %0.3f A and %0.3f A "%(d1,d2,d3)
#given
#lattice parameter of an orthorombic unit cell are
a=0.82 #nm
b=0.94 #nm
c=0.75 #nm
#part(I)
h1=1
k1=2
l1=3
d1=sqrt(1/((h1/a)**2+(k1/b)**2+(l1/c)**2)) #nm
#part(II)
h2=2
k2=4
l2=6
d2=sqrt(1/((h2/a)**2+(k2/b)**2+(l2/c)**2)) #nm
#aprt(III)- comment
#we note that
d=d2/d1
#i.e d2=1/2*d1
print "IT MEANS THAT INCREASING THE MILLER INDICES FREOM (123) TO (246) I.E BY 2 TIMES , DECREASES THE SEPERATION B/W THE PLANES BY 2 TIMES."
from __future__ import division
#given
#lattice constant for copper unit cell is
a=3.61*10**(-10) #m
#since the lattice structure of copper is FCC
#so the length of lattice structure (110)
r110=a*sqrt(2) #m because r110=sqrt(a**2+a**2)
#effective no of atoms present on vector OA is
Ne110=(1/2+1+1/2) #1/2 is for the atoms at corners of diagonal OA and 1 is for the atom at the centre of diagonal OA
#therefore linear density of atoms along (110) in copper unit cell is
invr110=Ne110/r110 #atoms per m
#so the length of lattice structure (111)
r111=a*sqrt(3) #m because r111=sqrt(a**2+a**2+a**2)
#effective no of atoms present on vector OB is
Ne111=(1/2+1/2) #1/2 is for each atoms at corners of diagonal OB
#therefore linear density of atoms along (111) in copper unit cell is
invr111=Ne111/r111 #atoms per m
print "the linear density of atoms along (110) and (111) are %0.2e atoms/mm and %0.2e atoms/mm resp"%(invr110,invr111)
# to find the linear density of (100) direction in BCC
#density is given by the ratio of toatal line length of the intersecting atoms to the distance between the centres of atom
#rho=2*r/(4*r/sqrt(3))
#so
rho=2*sqrt(3)/4
print "the linear density of (100) direction in BCC structure is %0.3f"%(rho)
#given
#atomic radii of polonium,rhodium and chromium are
rPo=1.7*10**(-10) #m
rRh=1.34*10**(-10) #m
rCr=1.25*10**(-10) #m
#latice strucrure of polonium , rhodiun and chromium are SC, FCC and BCC resp
#so lattice constants are
aPo=2*rPo #m
aRh=2*sqrt(2)*rRh #m
aCr=4/sqrt(3)*rCr #m
#planer density on (100) in polonium is given by
rhoPo=1/(aPo)**2 #per m**2
#planer denity on (110) in rhodium
rhoRh=sqrt(2)/(aRh)**2 #per m**2
#planer density on (111) in chromium
rhoCr=sqrt(3)/(aCr)**2 #per m**2
print """the planer density of polonium in (100) is %0.2e,
rhodium in (110) is %0.2e per m**2 and chromium in (111) is %0.2e per m**2"""%(rhoPo,rhoRh,rhoCr)