# Variables
p = 1.;
q = 1./2;
r = 3.;
# Calculations
h = 1./p;
k = 1./q;
l = 1./r;
h1 = 3.*h;
k1 = 3.*k;
l1 = 3.*l;
# Results
print "MILLER INDICES OF THE PLANE are h = ",h1
print "k = ",k1
print "l = ",l1
# Variables
p = 2./4; #intercepts
q = 3./3;
r = 4./2;
# Calculations
h = 1./p;
k = 1./q;
l = 1./r;
h1 = 2.*h;
k1 = 2.*k;
l1 = 2.*l;
# Results
print "MILLER INDICES ARE ",l1,k1,h1
import math
# Variables
r = 1.246; #radius in angstorm
h = 2.;
k = 0.;
l = 0.;
h1 = 2.;
k1 = 2.;
l1 = 0.;
h2 = 1.;
k2 = 1.;
l2 = 1.;
# Calculations
x = math.sqrt(h**2+k**2+l**2);
a = 2*math.sqrt(2)*r; #in angstorm
d_200 = a/x; #interplanar spacing in angstorm
x1 = math.sqrt(h1**2+k1**2+l1**2);
d_220 = a/x1; #interplanar spacing in angstorm
x2 = math.sqrt(h2**2+k2**2+l2**2);
d_111 = a/x2; #interplanar spacing in angstorm
print "Interplanar Spacing (200) (in Angstorm) = %.3f A"%d_200
print "Interplanar Spacing (220) (in Angstorm) = %.3f A"%d_220
print "Interplanar Spacing (111) (in Angstorm) = %.3f A"%d_111
import math
# Variables
a = 3.61*10**-10; #unit cell in m
# Calculations
r_110 = 2/(math.sqrt(2)*a); #in atoms/m
r_a = r_110/10**3; #in atoms/mm
r_111 = 1/(math.sqrt(3)*a); #in atoms/m
r_b = r_111/10**3; #in atoms/mm
# Results
print "Linear Density per unit length along direction [110] (in atoms/mm) = %.2e atoms/mm"%r_a
print "Linear Density per unit length along direction [111] (in atoms/mm) = %.2e atoms/mm"%r_b
import math
# Variables
r_po = 1.7*10**-10; #radius of polonium in m
r_rh = 1.34*10**-10; #radius of rhodium in m
r_cr = 1.25*10**-10; #radius of chromium in m
# Calculations
a_po = 2*r_po; #in m
a_rh = 2*math.sqrt(2)*r_rh; #in m
a_cr = 4*r_cr/math.sqrt(3);
p_po = 1/a_po**2; # /sqm
p_rh = 1.414/a_rh**2; # /sqm
p_cr = 1.732/a_cr**2; # /sqm
# Results
print "Planar Density on [100] in Polonium (per sqm) = %.2e /m**2"%p_po
print "Planar Density on [110] in Rhodium (per sqm) = %.2e /m**2"%p_rh
print "Planar Density on [111] in Chromium (per sqm) = %.2e /m**2"%p_cr
# Note : To check answer , please calculate manually for p_rh
import math
# Variables
w = 0.824; #wavelength in angstorm
theta1 = 8.35; #angle at n = 1 in degrees
n1 = 1.;
n3 = 3.;
# Calculations
d = w/(2*math.sin(math.radians(theta1))); #in angstorm
theta3 = math.degrees(math.asin(3*math.sin(math.radians(theta1))))
# Results
print "Glancing angle for third order diffraction = %f degrees"%theta3
print "Interplanar spacing of the crystal (in Angstorm) = %.3f A"%d
import math
# Variables
a = 17.03; #in degrees
w = 0.71; #in angstorm
n = 1.;
# Calculations
d = n*w/(2*math.sin(math.radians(a))); #interplanar spacing in angstorm
# given that h**2+k**2+l**2 = 8
a = math.sqrt(8)*d; #in angstorm
# Results
print "Interplanar Spacing (in angstorm) = %.3f A"%d
print "Lattice parameter of the crystal (in Angstorm) = %.2f A"%a
# Variables
w = 0.0708; #wavelength in nm
h = 1.;
k = 0.;
l = 0.;
s = 0.0132; #a common divisor i.e.math.sin**2(theta) = 0.0132
# Calculations
a = math.sqrt((w**2*(h**2+k**2+l**2))/(4*s)); #in nm
a1 = 10.**3*a; #in pm
# Results
print "Dimension of unit cell (in Picometer) = %.1f pm"%a1