#Example Python script for the simulation of Grazing-Incidence # Diffraction using the DWBA approximation # Note that this script (as all scripts using the \verb!pynx.gid! module) # requires the cctbx library (J. Appl. Cryst. 35(1), 126–136.) # it must be called using "cctbx.python" or "cctbx.ipython" # # Please refer to http://pynx.sourceforge.net for more information #Import libraries from numpy import * from scipy.special import erf from pynx import gpu,fthomson,gid # Energy (eV), grazing-incidence angle nrj=10000. wavelength=12398.4/nrj alphai=0.15*pi/180 a=5.4309 # Quantum dot as a truncated sphere tmp=mgrid[-50:50,-50:50,0:20] x0,y0,z0=tmp[0],tmp[1],tmp[2] idx=flatnonzero(sqrt(x0**2+y0**2+(z0+20)**2)<50) x0=take(x0.ravel(),idx) y0=take(y0.ravel(),idx) z0=take(z0.ravel(),idx) # Add all diamond sites x=append(x0,x0+.5) y=append(y0,y0+.5) z=append(z0,z0 ) x=append(x ,x0+.5) y=append(y ,y0 ) z=append(z ,z0+.5) x=append(x ,x0 ) y=append(y ,y0+.5) z=append(z ,z0+.5) x=append(x,x+.25) y=append(y,y+.25) z=append(z,z+.25) # Ge occupancy in Ge_xSi_(1-x) dot occ=0.2+0.6*z/z.max() # Ux and Uy displacements (relative to Si) ux=x*(0.005+z*0.002*(1+sqrt(x**2+y**2)/50)) uy=y*(0.005+z*0.002*(1+sqrt(x**2+y**2)/50)) #Compute refraction index for substrate si=gid.Scatterer("Si",(0.,0.,0. ), 1.0,1.0/(8*pi**2),nrj) substrate=gid.Crystal((a,a,a,90,90,90),"Fd3m:1",(si,)) #Reciprocal space coordinates h=linspace(3.85,4.02,150) k=0 alphaf=linspace(0,0.35*pi/180,200)[:,newaxis] l=a*2*sin(alphaf+alphai)/wavelength fhklge=gid.FhklDWBA4(x+ux,y+uy,z,h,k,l=None,occ=occ, alphai=alphai,alphaf=alphaf, substrate=substrate, wavelength=wavelength, e_par=0.,e_perp=1.0,gpu_name="GTX 295") fhklsi=gid.FhklDWBA4(x+ux,y+uy,z,h,k,l=None,occ=1-occ, alphai=alphai,alphaf=alphaf, substrate=substrate, wavelength=wavelength, e_par=1.,e_perp=0.,gpu_name="GTX 295") #Scattering factors s=a/sqrt(h**2+k**2+l**2) fGe=fthomson.FThomson(s,"Ge") fSi=fthomson.FThomson(s,"Si") # Sum scattering fhkl=fhklge*fGe+fhklsi*fSi #plot versus H and alpha_f from pylab import * imshow(abs(fhkl)**2,aspect='auto',origin='lower', extent=(h.min(),h.max(),0,alphaf.max()*180/pi)) xlabel("$H\ (r.l.u.)$",fontsize=18) ylabel(r"$\alpha_f\ (^\circ)$",fontsize=18) colorbar()