from pylab import *; from pydao.physics import Wave,CystalDiffraction,CrystalPlane,Lattice; ############################ # Here is pretty much all the inputs phic = 210/180.*pi; index = (1,0,6); photoenergy = 12e3*1.6e-19 ########################################## ## First we setup the diffraction plane a=6.; b=6.; c=11.7; la = Lattice(); basis=la.length_angle_2basis([a,b,c],[90.,90.,120.]); la.set('basis',basis); plane = CrystalPlane(lattice=la,index=index); plane.plot(); ########################################### # Then the energy of the diffraction wave wave = Wave(type='EM',energy = photoenergy); ########################################### # Align the diffraction plane and the wave using the assigned phic or thetac dif = CystalDiffraction(plane = plane, incidentwave = wave); theta = dif.cal_theta(); print "2theta:",theta*2*180/pi; incident = dif.align_incident(phic = phic);
from pylab import * from pydao.physics import Wave, CystalDiffraction, CrystalPlane, Lattice ############################ # Here is pretty much all the inputs phic = 210 / 180. * pi index = (1, 0, 6) photoenergy = 12e3 * 1.6e-19 ########################################## ## First we setup the diffraction plane a = 6. b = 6. c = 11.7 la = Lattice() basis = la.length_angle_2basis([a, b, c], [90., 90., 120.]) la.set('basis', basis) plane = CrystalPlane(lattice=la, index=index) plane.plot() ########################################### # Then the energy of the diffraction wave wave = Wave(type='EM', energy=photoenergy) ########################################### # Align the diffraction plane and the wave using the assigned phic or thetac dif = CystalDiffraction(plane=plane, incidentwave=wave) theta = dif.cal_theta() print "2theta:", theta * 2 * 180 / pi incident = dif.align_incident(phic=phic)
wavelength = 6.64e-34 * 3e8 / E / 1.6e-19 * 1e10 # wave length in angstrom k_photon = 2 * pi / wavelength ######################################### # the lattice and unit cell in real space a = 6. b = 6. c = 11.7 a_axis = array([1., 0., 0.]) * a b_axis = array([-0.5, sqrt(3) / 2, 0.]) * b c_axis = array([0., 0., 1.]) * c axis = array([a_axis, b_axis, c_axis]) la = Lattice(basis=axis) at = Atom() at.set('position', zeros(3)) la.plot3d_basis(labelwidth=0.01) surfacenormal = array([0, 0, 1]) ######################################### # the k-space and diffraction plane la.cal_kbasis() kbasis = la.get('kbasis') planenormal = h * kbasis[0] + k * kbasis[1] + l * kbasis[2] theta = arcsin(vlen(planenormal) / k_photon / 2) ########################################## #angle between diffraction plane and surface
E = 12e3; # photon energy in eV wavelength = 6.64e-34*3e8/E/1.6e-19*1e10; # wave length in angstrom k_photon = 2*pi/wavelength; ######################################### # the lattice and unit cell in real space a=6.; b=6.; c=11.7; a_axis=array([1.,0.,0.])*a; b_axis=array([-0.5,sqrt(3)/2,0.])*b; c_axis=array([0.,0.,1.])*c; axis=array([a_axis,b_axis,c_axis]); la=Lattice(basis=axis); at=Atom(); at.set('position',zeros(3)); la.plot3d_basis(labelwidth = 0.01); surfacenormal=array([0,0,1]) ######################################### # the k-space and diffraction plane la.cal_kbasis(); kbasis=la.get('kbasis'); planenormal = h*kbasis[0]+k*kbasis[1]+l*kbasis[2]; theta = arcsin(vlen(planenormal)/k_photon/2); ########################################## #angle between diffraction plane and surface