#To calculate the Miller indices
#Calculation
#The plane has intercepts a,2b,3c along 3 crystal axes
#lattice points are r = pa+qb+sc
#therefore p = 1 q = 2 s = 3
#miller indices are [1/p,1/q,1/s]
#Result
print "lattice points are p = 1 q = 2 s = 3"
print "miller indices are [1/p,1/q,1/s] or [1,1/2,1/3] or [6,3,2]"
#To calculate the density of Si
#importing modules
import math
#Variable declaration
n = 8; #number of atoms per cell
a = 5.43*10**-8; #lattice constant(cm)
w = 28.1; #atomic weight(gm)
N = 6.02*10**23; #avagadro number
#Calculation
ac = n/(a**3); #atomic concentration(atoms/cm**3)
d = ac*w/N; #density of Si(g/cm**3)
d=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals
#Result
print "density of Si is",d,"g/cm**3"
#To calculate the surface density of atoms
#importing modules
import math
from __future__ import division
#Variable declaration
a = 5; #lattice constant(Angstrom)
#Calculation
a = a*10**-10; #lattice constant(m)
#to calculate the planar concentration, only equilateral triangular region is considered of length a*math.sqrt(2) and height a*math.sqrt(3/2)
l = a*math.sqrt(2); #length of face diagonal(m)
h = a*math.sqrt(3/2); #height of triangle(m)
A = l*h/2; #area of shaded portion(m**2)
#every atom at the corner contributes 1/6 to this area.
n111 = (3/6)*(1/A); #planar concentration(atoms/m**2)
#Result
print "surface density of atoms is",n111,"atoms/m**2"
#To calculate the spacing of planes
#importing modules
import math
#Variable declaration
a = 4.049; #lattice constant(Angstrom)
h = 2;
k = 2;
l = 0; #miller indices of(2 2 0)
#Calculation
d = a/math.sqrt(h**2+k**2+l**2); #spacing of planes(Angstrom)
d=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals
#Result
print "spacing of planes is",d,"Angstrom"
#To calculate the size of unit cell
#importing modules
import math
#Variable declaration
d110 = 2.03; #distance between planes(Angstrom)
h = 1;
k = 1;
l = 0; #miller indices of(1 1 0)
#Calculation
a = d110*math.sqrt(h**2+k**2+l**2); #size of unit cell(Angstrom)
a=math.ceil(a*10**3)/10**3; #rounding off to 3 decimals
#Result
print "size of unit cell is",a,"Angstrom"
#To calculate the spacing of planes
#importing modules
import math
#Variable declaration
a = 5.64; #lattice constant(Angstrom)
h1 = 1;
k1 = 0;
l1 = 0; #miller indices of(1 0 0)
h2 = 1;
k2 = 1;
l2 = 0; #miller indices of(1 1 0)
h3 = 1;
k3 = 1;
l3 = 1; #miller indices of(1 1 1)
#Calculation
d100 = a/math.sqrt(h1**2+k1**2+l1**2); #spacing of planes[100](Angstrom)
d110 = a/math.sqrt(h2**2+k2**2+l2**2); #spacing of planes[110](Angstrom)
d111 = a/math.sqrt(h3**2+k3**2+l3**2); #spacing of planes[111](Angstrom)
d111=math.ceil(d111*10**2)/10**2; #rounding off to 2 decimals
#Result
print "spacing of plane [100] is",d100,"Angstrom"
print "spacing of plane [110] is",round(d110),"Angstrom"
print "spacing of plane [111] is",d111,"Angstrom"
#To calculate the volume of unit cell
#importing modules
import math
#Variable declaration
r = 1.605; #radius of atom(Angstrom)
#Calculation
r = r*10**-10; #radius of atom(m)
a = 2*r; #size of unit cell(m)
c = a*math.sqrt(8/3);
V = 3*math.sqrt(3)*a**2*c/2; #volume of unit cell(m**3)
#Result
print "volume of unit cell is",V,"m**3"