#importing modules
import math
from __future__ import division
#Variable declaration
a=0.28; #lattice spacing(nm)
lamda=0.071; #wavelength of X-rays(nm)
h=1;
k=1;
l=0;
n=2;
#Calculation
d=a/math.sqrt(h**2+k**2+l**2);
sintheta=n*lamda/(2*d);
theta=math.asin(sintheta)*180/math.pi; #glancing angle(degrees)
#Result
print "glancing angle is",int(theta),"degrees"
#importing modules
import math
from __future__ import division
#Variable declaration
d=0.282; #lattice spacing(nm)
theta=(8+(35/60))*math.pi/180; #glancing angle(radian)
n=1; #order
#Calculation
lamda=2*d*math.sin(theta)/n; #wavelength of X-rays(nm)
n=2*d/lamda; #maximum order of diffraction
#Result
print "wavelength of X-rays is",round(lamda,4),"nm"
print "maximum order of diffraction is",int(round(n))
#importing modules
import math
from __future__ import division
#Variable declaration
T1=773; #temperature(K)
T2=1273; #temperature(K)
f=10**-10; #fraction of vacant sites
#Calculation
x=round(T1*math.log(f)/T2,3);
N=math.exp(x); #fraction of vacancy sites
#Result
print "fraction of vacancy sites is",round(N*10**7,3),"*10**-7"
#importing modules
import math
from __future__ import division
#Variable declaration
h1=1;
k1=0;
l1=0; #miller indices of (100)
h2=1;
k2=1;
l2=0; #miller indices of (110)
h3=1;
k3=1;
l3=1; #miller indices of (111)
a=1; #assume
#Calculation
d100=a/math.sqrt(h1**2+k1**2+l1**2); #spacing(nm)
d110=a/math.sqrt(h2**2+k2**2+l2**2); #spacing(nm)
d111=a/math.sqrt(h3**2+k3**2+l3**2); #spacing(nm)
x=int(1/d100)**2;
y=int((1/d110)**2);
z=int(round((1/d111)**2)); #taking squares of the value of spacing since lcm function doesnt work on square root
def lcm(y, z):
if y > z:
greater = y
else:
greater = z
while(True):
if((greater % y == 0) and (greater % z == 0)):
lcm = greater
break
greater += 1
return lcm
l=lcm(y,z);
l=math.sqrt(l);
d1=d100*l;
d10=d110*l;
d11=d111*l; #ratio d100:d110:d111
d1=int(d1/math.sqrt(6));
d10=int(round(d10/math.sqrt(3)));
d11=int(d11/math.sqrt(2));
#Result
print "ratio d100:d110:d111 is",d1,"*math.sqrt(6) :",d10,"*math.sqrt(3) :",d11,"*math.sqrt(2)"
#importing modules
import math
from __future__ import division
#Variable declaration
n=1; #order
theta=38.2*math.pi/180; #glancing angle(radian)
lamda=1.54; #wavelength(angstrom)
h=2;
k=2;
l=0;
#Calculation
a=math.sqrt(h**2+k**2+l**2);
d=n*lamda*a/(2*math.sin(theta)); #lattice parameter(angstrom)
#Result
print "lattice parameter is",round(d,3),"angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
d=1.6; #lattice spacing(angstrom)
theta=90*math.pi/180; #glancing angle(radian)
lamda=1.5; #wavelength of X-rays(angstrom)
#Calculation
n=2*d*math.sin(theta)/lamda; #maximum order of diffraction
#Result
print "maximum order of diffraction is",int(n)
#importing modules
import math
from __future__ import division
#Variable declaration
d=0.203*10**-9; #lattice spacing(m)
h=1;
k=1;
l=0; #miller indices of (110)
lamda=1.5; #wavelength of X-rays(angstrom)
#Calculation
a=d*math.sqrt(h**2+k**2+l**2); #length(m)
V=a**3; #volume of unit cell(m**3)
r=math.sqrt(3)*a/4; #radius of atom(m)
#Result
print "length is",round(a*10**9,3),"*10**-9 m"
print "volume of unit cell is",round(V*10**27,5),"*10**-27 m**3"
print "answer for volume given in the book varies due to rounding off errors"
print "radius of atom is",round(r*10**9,4),"*10**-9 m"
#importing modules
import math
from __future__ import division
#Variable declaration
d=1.6; #lattice spacing(angstrom)
theta=90*math.pi/180; #glancing angle(radian)
lamda=1.5; #wavelength of X-rays(angstrom)
#Calculation
n=2*d*math.sin(theta)/lamda; #maximum order of diffraction
#Result
print "maximum order of diffraction is",int(n)
#importing modules
import math
from __future__ import division
#Variable declaration
a=0.26; #lattice spacing(nm)
lamda=0.065; #wavelength of X-rays(nm)
h=1;
k=1;
l=0;
n=2;
#Calculation
d=a/math.sqrt(h**2+k**2+l**2);
sintheta=n*lamda/(2*d);
theta=math.asin(sintheta)*180/math.pi; #glancing angle(degrees)
thetad=int(theta); #glancing angle(degrees)
thetam=(theta-thetad)*60; #glancing angle(minutes)
thetas=60*(thetam-int(thetam)); #glancing angle(seconds)
#Result
print "glancing angle is",thetad,"degrees",int(thetam),"minutes",int(thetas),"seconds"
print "answer in the book is wrong"
#importing modules
import math
from __future__ import division
#Variable declaration
n=1; #order
theta=19.2*math.pi/180; #glancing angle(radian)
lamda=1.54; #wavelength(angstrom)
h=1;
k=1;
l=1;
#Calculation
d=n*lamda/(2*math.sin(theta)); #lattice parameter(angstrom)
a=d*math.sqrt(h**2+k**2+l**2); #cube edge of unit cell(angstrom)
#Result
print "cube edge of unit cell is",round(a,3),"angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
n=1; #order
theta=38.2*math.pi/180; #glancing angle(radian)
lamda=1.54; #wavelength(angstrom)
h=2;
k=2;
l=0;
#Calculation
d=n*lamda/(2*math.sin(theta)); #lattice parameter(angstrom)
a=d*math.sqrt(h**2+k**2+l**2); #lattice parameter(angstrom)
#Result
print "lattice parameter is",round(a,3),"angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
a=0.36; #cube edge of unit cell(nm)
h1=1;
k1=1;
l1=1;
h2=3;
k2=2;
l2=1;
#Calculation
d1=a/math.sqrt(h1**2+k1**2+l1**2); #interplanar spacing for (111)(nm)
d2=a/math.sqrt(h2**2+k2**2+l2**2); #interplanar spacing for (321)(nm)
#Result
print "interplanar spacing for (111) is",round(d1,3),"nm"
print "interplanar spacing for (321) is",round(d2,3),"nm"
#importing modules
import math
from __future__ import division
#Variable declaration
theta=(5+(25/60))*math.pi/180; #glancing angle(radian)
lamda=0.675; #wavelength of X-rays(angstrom)
n1=1; #order
n3=3; #order
#Calculation
d=n1*lamda/(2*math.sin(theta)); #lattice spacing(angstrom)
d=round(d,3);
theta3=math.asin(n3*lamda/(2*d))*180/math.pi; #glancing angle for 3rd order(degrees)
theta3d=int(theta3); #glancing angle for 3rd order(degrees)
theta3m=(theta3-theta3d)*60; #glancing angle for 3rd order(minutes)
#Result
print "lattice spacing is",d,"angstrom"
print "glancing angle for 3rd order is",theta3d,"degrees",round(theta3m,1),"minutes"
print "answer for minutes given in the book varies due to rounding off errors"
#importing modules
import math
from __future__ import division
#Variable declaration
d=3.04; #interplanar spacing(angstrom)
lamda=0.79; #wavelength of X-rays(angstrom)
n=3;
#Calculation
sintheta=n*lamda/(2*d);
thetad=math.asin(sintheta)*180/math.pi; #glancing angle(degrees)
thetam=(theta-int(theta))*60; #glancing angle(minutes)
thetas=60*(thetam-int(thetam)); #glancing angle(seconds)
#Result
print "glancing angle is",int(round(thetad)),"degrees",int(thetam),"minutes",int(thetas),"seconds"
print "answer given in the book is wrong"