from __future__ import division
from math import sqrt
#given data
#atomic radius
r=1.278 #in Angstrum
#atomic weight
aw=63.5
#Avogadro's number
an=6.023*10**23
#copper has FCC structure for which
a=(4*r)/sqrt(2) # in Angstrum
a=a*10**-10 #in m
#Mass of one atom
m=aw/an #in gm
m=m*10**-3 #in kg
#volume of one unit cell of copper crystal,
V=a**3 #in meter cube
#Number of atoms present in one unit cell of Cu(FCC Structure),
n=4
#Density of crystal
rho=(m*n)/V #in kg/m**3
print "Density of crystal is : ",round(rho,0),"kg/m**3"
from math import pi, sin
#given data :
#wavelength
lamda=1.539 #in Angstrum
#angle
theta=22.5 # in degree
n=1 #(first order)
# Formula n*lamda=2*d*sin(theta) , so
# interplaner distance,
d=lamda/(2*sin(theta*pi/180))
print "Interplaner distance is : ",round(d,2)," Angstrum"
#given data :
n=2
d=0.4 # in nenometer
d=d*10**-9 # in meter
theta=16.8/2 # in degree
#using Bragg's equation we have n*lamda=2*d*sin(theta), so
lamda=(2*d*sin(8.4*pi/180))/n
print "Wavelength of X-rays used is : ",round(lamda*10**10,3)," Angstrum"
#given data :
a=3.15 #in Angstrum
a=a*10**-10 #in meter
#angle
theta=20.2 #in degree
n=1 #(first order)
#for BCC crystal
d110=a/sqrt(2) #in meter
#Formula n*lamda=2*d*sin(theta)
lamda=(2*d110*sin(theta*pi/180))/n #in meter
print "Wavelength is : ",round(lamda*10**10,2)," Angstrum"
from math import asin, degrees
#given data :
lamda=0.842 #in Angstrum
lamda=lamda*10**-10 # in meter
#theta=8degree 35minutes
theta=8+35/60 #in degree
n=1 #(first order)
#Formula n*lamda=2*d*sin(theta)
d=n*lamda/(2*sin(pi/180*theta))
#For third Order reflection :
#Formula n*lamda=2*d*sin(theta)
n=3 #order
theta=degrees(asin(n*lamda/(2*d)) )
print "Angle of incidence for third order reflection",round(theta),"degree " # Answer wrong in the textbook.