You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

243 lines
8.9 KiB

  1. %% Elementary constants
  2. clear;
  3. load qf
  4. epsilon=8.854187817e-12;
  5. c = 299792458; %Speed of light [m/s]
  6. h = 6.626070040e-34; %Planck constant [J/Hz]
  7. hbar = h/2/pi;
  8. u0 = 4*pi*1e-7; %Vacuum permeability [N/A^2]
  9. e0 = 1/u0/(c^2); %Vacuum permittivity [A^2*s^4/kg/m^3]
  10. qe = 1.6021766208e-19; %Elementary charge [C]
  11. G = 6.67408e-11; %Gravitational constant [m^3/kg/s^2]
  12. kB = 1.38064852e-23; %Boltzmann constant [J/K]
  13. me = 9.10938356e-31; %Electron rest mass [kg]
  14. mp = 1.672621898e-27; %Proton mass [kg]
  15. uB = qe*hbar /2/me; %Bohr magneton [J/T]
  16. uN = qe*hbar /2/mp; %Nuclear magnton [J/T]
  17. alpha = u0*qe^2*c/(2*h); %Fine structure constant
  18. u = 1.660539040e-27; %Atomic mass unit [kg]
  19. a0 = 4*pi*e0*hbar^2/me/qe^2; %Bohr radius [m]
  20. Eh = hbar^2/(me*a0^2); %Rydberg energy [eV]
  21. %% Laser Properties
  22. wavelength=532e-9; %Laser wavlength [m]
  23. k=2*pi/wavelength; %Wave vector [m^-1]
  24. P=10; %Power of each beam [W]
  25. wz0=60e-6; %Beam waist in z-theta-direction[m]
  26. wy0=250e-6;
  27. zRy=pi*wy0^2./wavelength; %Rayleigh wavelength
  28. zRz=pi*wz0^2./wavelength;
  29. theta=0.5/180*pi; %Half angle of interference
  30. x_ext =wz0./tan(theta);
  31. %Dysprosium Properties
  32. polar532=350*qe^2*a0^2/Eh; %Dynamical Polarizability of Dy at 532nm
  33. polar1064=193*qe^2*a0^2/Eh;
  34. mDy = 164*u; %Dysprosium mass [kg]
  35. %% Trapping frequency as Plane wave
  36. vz=sqrt(P.*polar532*k^2*sin(theta)^2/(pi^3*wz0*wy0*c*mDy*epsilon));
  37. d = wavelength/(2*tan(theta)); %Fringe distance
  38. focus = 100e-3;
  39. D = wavelength*focus/d;
  40. %% Gaussian beams
  41. %Coordinate System
  42. n=[2001,3,2001];
  43. xmax=(x_ext.*3/2);
  44. xmin=-(x_ext).*3/2;
  45. ymax=2.*wy0;
  46. ymin=-2.*wy0;
  47. zmax=2.*wz0;
  48. zmin=-2.*wz0;
  49. for i=1:3
  50. x=linspace(xmin,xmax,n(1));
  51. y=linspace(ymin,ymax,n(2));
  52. z=linspace(zmin,zmax,n(3));
  53. [X,Y,Z]=meshgrid(x,y,z);
  54. %Rotation of the coordinte system
  55. xTheta=X.*cos(theta)+Z.*sin(theta);
  56. xPhi=X.*cos(theta)-Z.*sin(theta);
  57. zTheta=-X.*sin(theta)+Z.*cos(theta);
  58. zPhi=X.*sin(theta)+Z.*cos(theta);
  59. %Electric field
  60. E0=sqrt(2*P/pi/(wz0*wy0)/c/epsilon); %Electric field at 0
  61. wz1=wz0*sqrt(1+(xTheta./zRz).^2); %Beam waist in z-direction for Beam 1
  62. wy1=wy0*sqrt(1+(xTheta./zRy).^2); %Beam waist in y-direction for Beam 1
  63. wz2=wz0*sqrt(1+(xPhi./zRz).^2); %Beam waist in z-direction for Beam 2
  64. wy2=wy0*sqrt(1+(xPhi./zRy).^2); %Beam waist in y-direction for Beam 1
  65. R1y=xTheta.*(1+(zRy./xTheta).^2); %Rayleigh length Beam 1
  66. R1z=xTheta.*(1+(zRz./xTheta).^2);
  67. R2y=xPhi.*(1+(zRy./xPhi).^2); %Rayleigh length Beam 2
  68. R2z=xPhi.*(1+(zRz./xPhi).^2);
  69. R1y(:,floor(n(1)/2)+1,floor(n(3)/2)+1)=Inf; %Rayleigh length ->0
  70. R1z(:,floor(n(1)/2)+1,floor(n(3)/2)+1)=Inf;
  71. R2y(:,floor(n(1)/2)+1,floor(n(3)/2)+1)=Inf;
  72. R2z(:,floor(n(1)/2)+1,floor(n(3)/2)+1)=Inf;
  73. gouyPhase1=atan(wavelength.*xTheta./(pi.*wz0.*wy0));
  74. gouyPhase2=atan(wavelength.*xPhi./(pi.*wz0.*wy0));
  75. E1=E0.*sqrt(wz0.*wy0)./sqrt(wz1.*wy1).*exp(-(zTheta./wz1).^2-(Y./wy1).^2).*exp(1i*(k.*xTheta-gouyPhase1)+1i.*k.*(zTheta.^2./2./R1z+Y.^2./2./R1y)); %Electric field Beam 1
  76. E2=E0.*sqrt(wz0.*wy0)./sqrt(wz2.*wy2).*exp(-(zPhi./wz2).^2-(Y./wy2).^2).*exp(1i*(k.*xPhi-gouyPhase2)+1i.*k.*(zPhi.^2./2./R2z+Y.^2./2./R2y)); %Electric field Beam 2
  77. %Intensity and trapping Potential
  78. Itot=abs(E1+E2).^2./2*c*epsilon;
  79. if i==1 %Set y=0
  80. Itot_y=squeeze(Itot(2,:,:));
  81. Imax=Itot_y(1001,1001);
  82. figure
  83. imagesc(x,z, Itot_y')
  84. title('x-z Interference Pattern for \theta=', theta*180/pi);
  85. colormap(QF);
  86. caxis([0 Imax]);
  87. %z-profile for x=0
  88. Udip=0.5.*Itot_y.*polar532./epsilon./c;
  89. Umid=squeeze(Udip(floor(n(1)/2)+1,:));
  90. zrange = find((-pi/(3*k*sin(theta))) < z & z < (pi./(3*k*sin(theta))));
  91. zfit = z(zrange(1):zrange(length(zrange)));
  92. Ufit = Umid(zrange(1):zrange(length(zrange)));
  93. zfit = zfit(:);
  94. Ufit = Ufit(:);
  95. [pks, locs]=findpeaks(Umid);
  96. p = polyfitn(zfit,Ufit,'constant x^2');
  97. % figure
  98. % plot(z,Umid, zfit, Ufit,'.', zfit, polyvaln(p,zfit))
  99. % title('Trapping potential in z-direction for x=y=0')
  100. % %Fitted Trapping frequency
  101. % nu_zfixed=sqrt(-p.Coefficients(2)*2/mDy)/2/pi;
  102. %FWHM of x-profile (actually 1/e^2)
  103. Uz0=squeeze(Udip(:,floor(n(1)/2)+1));
  104. Ufwhm= find(Uz0>Uz0(floor(n(1)/2)+1)/exp(2));
  105. x_ext_fwhm=abs(x(Ufwhm(1))-x(Ufwhm(length(Ufwhm))));
  106. x_range=x(Ufwhm);
  107. %x-profile for z=0
  108. xrange=find((-x_ext_fwhm/10)<x & x<(x_ext_fwhm/10));
  109. xfit=x(xrange(1):xrange(length(xrange)));
  110. Ufitx = Uz0(xrange(1):xrange(length(xrange)));
  111. px= polyfitn(xfit,Ufitx, 'constant x^2');
  112. % figure
  113. % plot(x,Uz0,xfit, Ufitx, '.',xfit, polyvaln(px,xfit) )
  114. % xline(x_ext_fwhm/2)
  115. % xline(-x_ext_fwhm/2)
  116. % title('x-Potential')
  117. % nu_xfixed=sqrt(-px.Coefficients(2)*2/mDy)/2/pi;
  118. %
  119. %z-profile x=x_ext
  120. Ux_ext=squeeze(Udip(Ufwhm(1),:));
  121. Ux_ext_fit=Ux_ext(zrange(1):zrange(length(zrange)));
  122. p_xext = polyfitn(zfit,Ux_ext_fit,'constant x^2');
  123. % figure
  124. % plot(z,Ux_ext, zfit, Ux_ext_fit,'.', zfit, polyvaln(p_xext,zfit))
  125. % %Fitted Trapping Frequency
  126. % nu_zxext=sqrt(-p_xext.Coefficients(2)*2/mDy)/2/pi;
  127. else
  128. if i==2
  129. Itot_z=squeeze(Itot(:,:,2));
  130. %
  131. % figure
  132. % imagesc(x,y,Itot_z)
  133. % title('x-y Interference Pattern for \theta=', theta*180/pi);
  134. % colormap(QF);
  135. % %caxis([min(min(Itot_z)) max(max(Itot_z))])
  136. %Gaussian profile y
  137. Udip_y=0.5.*Itot_z.*polar532./epsilon./c;
  138. Umid_y=squeeze(Udip_y(:,floor(n(1)/2)+1));
  139. Ufwhm_y= find(Umid_y>Umid_y(floor(n(1)/2)+1)/exp(2));
  140. y_ext_fwhm=abs(y(Ufwhm_y(1))-y(Ufwhm_y(length(Ufwhm_y))));
  141. y_range=y(Ufwhm_y);
  142. yrange = find( -y_ext_fwhm/20 < y & y < y_ext_fwhm/20);
  143. yfit = y(yrange(1):yrange(length(yrange)));
  144. Ufit_y = Umid_y(yrange(1):yrange(length(yrange)));
  145. yfit = yfit(:);
  146. Ufit_y = Ufit_y(:);
  147. p_ext_y = polyfitn(yfit,Ufit_y, 'constant x^2');
  148. % figure
  149. % plot(y,Umid_y, yfit, Ufit_y,'.', yfit, polyvaln(p_ext_y,yfit))
  150. % title('y profile for \theta=', theta*180/pi);
  151. nu_y=sqrt(-p_ext_y.Coefficients(2)*2/mDy)/2/pi;
  152. %Gaussian profile x
  153. Udip_x=0.5.*Itot_z.*polar532./epsilon./c;
  154. Umid_x=squeeze(Udip_x(floor(n(1)/2)+1,:));
  155. Ufwhm_x= find(Umid_x>Umid_x(floor(n(1)/2)+1)/exp(2));
  156. x_ext_fwhm=abs(x(Ufwhm_x(1))-x(Ufwhm_x(length(Ufwhm_x))));
  157. x_range=x(Ufwhm_x);
  158. xrange = find( -x_ext_fwhm/20 < x & x < x_ext_fwhm/20);
  159. xfit = x(xrange(1):xrange(length(xrange)));
  160. Ufit_x = Umid_x(xrange(1):xrange(length(xrange)));
  161. xfit = xfit(:);
  162. Ufit_x = Ufit_x(:);
  163. p_ext_x = polyfitn(xfit,Ufit_x,'constant x^2');
  164. % figure
  165. % plot(x,Umid_x, xfit, Ufit_x,'.', xfit, polyvaln(p_ext_x,xfit))
  166. % title('x profile for \theta=', theta*180/pi);
  167. nu_x=sqrt(-p_ext_x.Coefficients(2)*2/mDy)/2/pi;
  168. else
  169. Itot_x=squeeze(Itot(:,2,:));
  170. % figure
  171. % imagesc(y,z,Itot_x')
  172. % title('y-z Interference Pattern for \theta=', theta*180/pi);
  173. % colormap(QF);
  174. % %caxis([min(min(Itot_x)) max(max(Itot_x))])
  175. end
  176. end
  177. tempn=n(3);
  178. n(3)=n(2);
  179. n(2)=n(1);
  180. n(1)=tempn;
  181. end
  182. Trap_f= table(theta*180/pi,P, wavelength, vz, nu_zfixed,nu_zxext, nu_xfixed,nu_x, nu_y,'VariableNames',{'Theta', 'Laser Power','Laser Wavelength', 'vz Plane wave','vz Gaussian Beam', 'vz Gaussian Beam at x_ext','vx in x-z-Plane','vx in x-y-Plane', 'vy in x-y-Plane'});
  183. %% Peaks for shallow angle
  184. npeaks=length(pks);
  185. smax=(npeaks-1)/2;
  186. fringeratios=zeros(smax,3);
  187. for s=1:1:smax+1
  188. ratio=pks((npeaks+1)/2+s-1)/pks((npeaks+1)/2);
  189. fringeratios(s,1)=s-1;
  190. fringeratios(s,2)=pks((npeaks+1)/2+s-1);
  191. fringeratios(s,3)=ratio;
  192. end