Added old files
This commit is contained in:
112
Matlab/Forces_Ashkin_Axial.m
Normal file
112
Matlab/Forces_Ashkin_Axial.m
Normal file
@@ -0,0 +1,112 @@
|
||||
%all distances in m
|
||||
clear
|
||||
close all
|
||||
clc
|
||||
format compact
|
||||
|
||||
% These calculations are based on Ashkin's article "Forces of a single-beam
|
||||
% gradient laser trap on a dielectric sphere in the ray optics regime".
|
||||
% There are axial forces only
|
||||
|
||||
n1 = 1.33; % index of refraction of the immersion medium
|
||||
n2 = 1.6; % index of refraction of the fused silica at wavelength 523 nm
|
||||
n = n2/n1; % n2/n1
|
||||
c0 = 3e8; % speed of light
|
||||
NA = 1.25; % numerical aperture
|
||||
th_max = asin(NA/n1); % maximum angle of incidence
|
||||
f = 100.0e-3; % objective lens focus or WD
|
||||
r_max = f*tan(th_max); % radius of a Gaussian beam (1:1 with input aperture condition)
|
||||
Rsp = 1.0e-6; % sphere radius
|
||||
P = 20.0e-3; % power of the laser
|
||||
|
||||
thr = @(th) asin(n1/n2*sin(th)); % refraction angle
|
||||
|
||||
%reflectivity
|
||||
R = @(th,psi) (tan(th-thr(th)).^2./tan(th+thr(th)).^2).*cos(psi).^2+...
|
||||
(sin(th-thr(th)).^2./sin(th+thr(th)).^2).*sin(psi).^2;
|
||||
|
||||
%transparency
|
||||
T = @(th,psi) 1-R(th,psi);
|
||||
|
||||
% Factors
|
||||
Qs = @(th, psi) 1 + R(th, psi) .* cos(2*th) - T(th,psi).^2 .* (cos(2*th -...
|
||||
2*thr(th)) + R(th, psi) .* cos(2*th)) ./ (1 + R(th,psi).^2 +...
|
||||
2*R(th,psi) .* cos(2*thr(th)));
|
||||
|
||||
Qg = @(th, psi) R(th, psi) .* sin(2*th) - T(th,psi).^2 .* (sin(2*th -...
|
||||
2*thr(th)) + R(th, psi) .* sin(2*th)) ./ (1 + R(th,psi).^2 +...
|
||||
2*R(th,psi) .* cos(2*thr(th)));
|
||||
|
||||
Qmag = @(th, psi) sqrt(Qs(th, psi).^2 + Qg(th, psi).^2);
|
||||
|
||||
% Average factors (circular polarization
|
||||
Qs_avg = @(th) 0.5*(Qs(th, 0) + Qs(th, pi/2));
|
||||
Qg_avg = @(th) 0.5*(Qg(th, 0) + Qg(th, pi/2));
|
||||
Qmag_avg = @(th) sqrt(Qs_avg(th).^2 + Qg_avg(th).^2);
|
||||
|
||||
% Angles
|
||||
phi = @(r) atan(r/f);
|
||||
thi = @(r,z) asin(z/Rsp.*sin(phi(r)));
|
||||
|
||||
Qgz = @(r,z) -Qg_avg(thi(r,z)).*sin(phi(r));
|
||||
Qsz = @(r,z) Qs_avg(thi(r,z)).*cos(phi(r));
|
||||
|
||||
% Intensity profile
|
||||
a = 1.0;
|
||||
w0 = a*r_max;
|
||||
|
||||
%I = @(r) P/(pi*r_max^2); % uniform distribution
|
||||
|
||||
A = (1-exp(-2*r_max.^2/w0^2));
|
||||
I0 = P*2/(pi*w0^2)/A;
|
||||
I = @(r) I0*exp(-2*r.^2/w0^2); % Gaussian TEM00 beam
|
||||
|
||||
%A = 2*pi*integral(@(r) r.*besselj(0,2.405/w0*r).^2,0,r_max)/P0;
|
||||
%w0_bb = 0.5*r_max;
|
||||
%I0 = P*2/(pi*w0^2);
|
||||
%I = @(r) I0*besselj(0,2.405/w0_bb*r).^2.*exp(-2*r.^2/w0^2); % Bessel beam
|
||||
|
||||
% Intensity profile graphics
|
||||
rho = linspace(-r_max, r_max, 500);
|
||||
figure
|
||||
plot(rho, I(rho)/max(I(rho)),'k')
|
||||
grid
|
||||
xlabel('r, ì')
|
||||
ylabel('I(r)')
|
||||
sdf('my')
|
||||
|
||||
% Integration
|
||||
Qres_g = @(z) 1/(pi*r_max^2)*2/(A*pi*w0^2)*integral2(@(beta,r) r.*I(r).*...
|
||||
iscomplex(Qgz(r,z)),0,2*pi,0,r_max,...
|
||||
'Method','iterated','AbsTol',1e-12,'RelTol',1e-6);
|
||||
|
||||
Qres_s = @(z) 1/(pi*r_max^2)*2/(A*pi*w0^2)*integral2(@(beta,r) r.*I(r).*...
|
||||
iscomplex(Qsz(r,z)),0,2*pi,0,r_max,...
|
||||
'Method','iterated','AbsTol',1e-12,'RelTol',1e-6);
|
||||
|
||||
% Calulation
|
||||
N = 200;
|
||||
z = linspace(-2*Rsp,2*Rsp,N);
|
||||
Axial_g = zeros(1,N);
|
||||
Axial_s = zeros(1,N);
|
||||
|
||||
for ii = 1:N
|
||||
Axial_g(ii) = Qres_g(z(ii));
|
||||
Axial_s(ii) = Qres_s(z(ii));
|
||||
end
|
||||
|
||||
F0 = n1*P/c0; % net force
|
||||
|
||||
Axial_g = fliplr(Axial_g);
|
||||
Axial_s = fliplr(Axial_s);
|
||||
Axial = Axial_g + Axial_s;
|
||||
z = -fliplr(z);
|
||||
|
||||
%Graphics
|
||||
figure
|
||||
plot(z,F0*Axial_g,'b-.',z,F0*Axial_s,'r--',z,F0*Axial,'k')
|
||||
legend('F_{g}','F_{s}','F_{t}')
|
||||
xlabel('r, ì')
|
||||
ylabel('F, Í')
|
||||
grid
|
||||
sdf('my')
|
||||
48
Matlab/Forces_Ashkin_Ray_Efficiencies.m
Normal file
48
Matlab/Forces_Ashkin_Ray_Efficiencies.m
Normal file
@@ -0,0 +1,48 @@
|
||||
close all
|
||||
clear
|
||||
format compact
|
||||
clc
|
||||
|
||||
% These calculations are based on Ashkin's article "Forces of a single-beam
|
||||
% gradient laser trap on a dielectric sphere in the ray optics regime
|
||||
|
||||
%all distances in mm
|
||||
a = 1.0e-6; % radius of the bead
|
||||
n1 = 1.0; % index of rafraction of the medium
|
||||
n = 1.4607; % n2/n1
|
||||
n2 = n*n1; % index of refraction of the fused silica
|
||||
c0 = 3e8; % speed of light
|
||||
|
||||
%reflectivity
|
||||
R = @(th,psi) (tan(th-asin(n1/n2*sin(th))).^2./...
|
||||
tan(th+asin(n1/n2*sin(th))).^2).*cos(psi).^2+...
|
||||
(sin(th-asin(n1/n2*sin(th))).^2./...
|
||||
sin(th+asin(n1/n2*sin(th))).^2).*sin(psi).^2;
|
||||
|
||||
%transparency
|
||||
T = @(th,psi) 1-R(th,psi);
|
||||
|
||||
r = @(th) asin(n1/n2*sin(th));
|
||||
|
||||
% Factors
|
||||
Qs = @(th, psi) 1 + R(th, psi) .* cos(2*th) - T(th,psi).^2 .* (cos(2*th -...
|
||||
2*r(th)) + R(th, psi) .* cos(2*th)) ./ (1 + R(th,psi).^2 +...
|
||||
2*R(th,psi) .* cos(2*r(th)));
|
||||
|
||||
Qg = @(th, psi) R(th, psi) .* sin(2*th) - T(th,psi).^2 .* (sin(2*th -...
|
||||
2*r(th)) + R(th, psi) .* sin(2*th)) ./ (1 + R(th,psi).^2 +...
|
||||
2*R(th,psi) .* cos(2*r(th)));
|
||||
|
||||
Qmag = @(th, psi) sqrt(Qs(th, psi).^2 + Qg(th, psi).^2);
|
||||
|
||||
t = linspace(0, pi/2, 1000);
|
||||
t_deg = t*180/pi;
|
||||
pol = pi/4;
|
||||
|
||||
figure
|
||||
plot(t_deg, Qs(t, pol),'r--', t_deg, -Qg(t, pol),'b-.', t_deg, Qmag(t, pol),'k');
|
||||
grid
|
||||
xlabel('\theta, deg')
|
||||
ylabel('Q')
|
||||
legend('Q_s','Q_g','Q_t','location','northwest')
|
||||
sdf('my')
|
||||
106
Matlab/Forces_Ashkin_Transverse.m
Normal file
106
Matlab/Forces_Ashkin_Transverse.m
Normal file
@@ -0,0 +1,106 @@
|
||||
%all distances in m
|
||||
close all
|
||||
clear
|
||||
clc
|
||||
format compact
|
||||
|
||||
% These calculations are based on Ashkin's article "Forces of a single-beam
|
||||
% gradient laser trap on a dielectric sphere in the ray optics regime".
|
||||
% There are transverse forces only
|
||||
|
||||
n1 = 1.33; % index of refraction of the immersion medium
|
||||
n2 = 1.6; % index of refraction of the fused silica at wavelength 523 nm
|
||||
n = n2/n1; % n2/n1
|
||||
c0 = 3e8; % speed of light
|
||||
NA = 1.25; % numerical aperture
|
||||
th_max = asin(NA/n1); % maximum angle of incidence
|
||||
f = 100.0e-3; % objective lens focus or WD
|
||||
r_max = f*tan(th_max); % radius of a Gaussian beam (1:1 with input aperture condition)
|
||||
Rsp = 1.0e-6; % sphere radius
|
||||
P = 20.0e-3; % power of the laser
|
||||
|
||||
thr = @(th) asin(n1/n2*sin(th)); % refraction angle
|
||||
|
||||
%reflectivity
|
||||
R = @(th,psi) (tan(th-thr(th)).^2./tan(th+thr(th)).^2).*cos(psi).^2+...
|
||||
(sin(th-thr(th)).^2./sin(th+thr(th)).^2).*sin(psi).^2;
|
||||
|
||||
%transparency
|
||||
T = @(th,psi) 1-R(th,psi);
|
||||
|
||||
% Factors
|
||||
Qs = @(th, psi) 1 + R(th, psi) .* cos(2*th) - T(th,psi).^2 .* (cos(2*th -...
|
||||
2*thr(th)) + R(th, psi) .* cos(2*th)) ./ (1 + R(th,psi).^2 +...
|
||||
2*R(th,psi) .* cos(2*thr(th)));
|
||||
|
||||
Qg = @(th, psi) R(th, psi) .* sin(2*th) - T(th,psi).^2 .* (sin(2*th -...
|
||||
2*thr(th)) + R(th, psi) .* sin(2*th)) ./ (1 + R(th,psi).^2 +...
|
||||
2*R(th,psi) .* cos(2*thr(th)));
|
||||
|
||||
% Average factors (circular polarization
|
||||
Qs_avg = @(th) 0.5*(Qs(th, 0) + Qs(th, pi/2));
|
||||
Qg_avg = @(th) 0.5*(Qg(th, 0) + Qg(th, pi/2));
|
||||
|
||||
% Angles
|
||||
phi = @(r) atan(r/f);
|
||||
gamma = @(beta,r) acos(cos(pi/2-phi(r)).*cos(beta));
|
||||
thi = @(beta,r,y) asin(y/Rsp.*sin(gamma(beta,r)));
|
||||
|
||||
Qgy = @(beta,r,y) Qg_avg(thi(beta,r,y)).*cos(phi(r));
|
||||
Qsy = @(beta,r,y) Qs_avg(thi(beta,r,y)).*sin(gamma(beta,r));
|
||||
|
||||
% Intensity profile
|
||||
a = 1.0;
|
||||
w0 = a*r_max;
|
||||
|
||||
%I = @(r) P/(pi*r_max^2); % uniform distribution
|
||||
|
||||
A = (1-exp(-2*r_max.^2/w0^2));
|
||||
I0 = 2*P/(pi*w0^2)*A;
|
||||
I = @(r) I0*exp(-2*r.^2/w0^2); % Gaussian TEM00 beam
|
||||
|
||||
%P0 = exp(0.5)*w0*0.0025/4.81;
|
||||
%A = 2*pi*integral(@(r) r.*besselj(0,2.405/w0*r).^2,0,r_max)/P0;
|
||||
%I = @(r) 1/(A*P0)*besselj(0,2.405/w0*r).^2; % Bessel beam
|
||||
|
||||
% Intensity profile graphics
|
||||
rho = linspace(-r_max, r_max, 500);
|
||||
figure
|
||||
plot(rho, I(rho)/max(I(rho)),'k')
|
||||
grid
|
||||
xlabel('r, m')
|
||||
ylabel('I(r)')
|
||||
sdf('my')
|
||||
|
||||
% Integration
|
||||
Qres_g = @(y) 1/(pi*r_max^2)*integral2(@(beta,r) r.*I(r).*...
|
||||
iscomplex(Qgy(beta,r,y)),0,2*pi,0,r_max,...
|
||||
'Method','iterated','AbsTol',1e-6,'RelTol',1e-6);
|
||||
|
||||
Qres_s = @(y) 1/(pi*r_max^2)*integral2(@(beta,r) r.*I(r).*...
|
||||
iscomplex(Qsy(beta,r,y)),0,2*pi,0,r_max,...
|
||||
'Method','iterated','AbsTol',1e-6,'RelTol',1e-6);
|
||||
|
||||
% Calulation
|
||||
N = 150;
|
||||
y = linspace(-2*Rsp,2*Rsp,N);
|
||||
Transverse_g = zeros(1,N);
|
||||
Transverse_s = zeros(1,N);
|
||||
|
||||
for ii = 1:N
|
||||
Transverse_g(ii) = abs(Qres_g(y(ii)));
|
||||
Transverse_s(ii) = Qres_s(y(ii));
|
||||
end
|
||||
|
||||
Transverse = abs(Transverse_g) + Transverse_s;
|
||||
|
||||
F0 = n1*P/c0; % net force;
|
||||
|
||||
%Graphics
|
||||
figure
|
||||
plot(y,F0*Transverse_g,'r--',y,F0*Transverse_s,'b-.',y,F0*Transverse,'k')
|
||||
legend('F_{g}','F_{s}','F_{t}')
|
||||
xlabel('r, ì')
|
||||
ylabel('F, Í')
|
||||
grid
|
||||
sdf('my')
|
||||
11
Matlab/iscomplex.m
Normal file
11
Matlab/iscomplex.m
Normal file
@@ -0,0 +1,11 @@
|
||||
function S = iscomplex(A)
|
||||
[n,m] = size(A);
|
||||
S = zeros(n,m);
|
||||
|
||||
for ii = 1:n
|
||||
for jj = 1:m
|
||||
S(ii,jj) = A(ii,jj)*double(isreal(A(ii,jj)));
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
85
Matlab/sdf.m
Normal file
85
Matlab/sdf.m
Normal file
@@ -0,0 +1,85 @@
|
||||
function sdf(varargin)
|
||||
% SDF Set the line width and fonts of a figure
|
||||
%
|
||||
% sdf(fig)
|
||||
%
|
||||
% where fig is the figure number. If the figure number is omitted, the
|
||||
% currently active figure is updated. Edit the file to set you own style
|
||||
% settings.
|
||||
%
|
||||
% sdf(fig, 'stylename')
|
||||
% applies a pre-configured style from the File-->Export Setup menu of the
|
||||
% figure's window. The stylename should be one of the 'Export Styles'
|
||||
% section of the dialog.
|
||||
%
|
||||
% The function allows applying the same settings as through the
|
||||
% File-->Export Setup-->Apply menu of the figure, but much faster and
|
||||
% without the annoying clicking.
|
||||
%
|
||||
% Example
|
||||
% figure(1); t=0:0.1:10; plot(t, sin(t));
|
||||
% sdf(1)
|
||||
% pause
|
||||
% sdf(1,'PowerPoint')
|
||||
|
||||
% Andrey Popov, Hamburg, 2009
|
||||
|
||||
%% Parse the input data
|
||||
default = true;
|
||||
if nargin == 0 % no input - take current fig and apply default style
|
||||
fig = gcf();
|
||||
else % at least 1 input
|
||||
if ischar(varargin{1}) % style name
|
||||
default = false;
|
||||
style_name = varargin{1};
|
||||
fig = gcf();
|
||||
else
|
||||
fig = varargin{1};
|
||||
figure(fig); % just in case it does not exist
|
||||
if nargin == 2
|
||||
default = false;
|
||||
style_name = varargin{2};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
%% Apply a style
|
||||
if default % Apply a default style
|
||||
style = struct();
|
||||
style.Version = '1';
|
||||
style.Format = 'eps';
|
||||
style.Preview = 'none';
|
||||
style.Width = 'auto';
|
||||
style.Height = 'auto';
|
||||
style.Units = 'centimeters';
|
||||
style.Color = 'rgb';
|
||||
style.Background = 'w'; % '' = no change; 'w' = white background
|
||||
style.FixedFontSize = '10';
|
||||
style.ScaledFontSize = 'auto';
|
||||
style.FontMode = 'fixed';
|
||||
style.FontSizeMin = '8';
|
||||
style.FixedLineWidth = '2';
|
||||
style.ScaledLineWidth = 'auto';
|
||||
style.LineMode = 'fixed';
|
||||
style.LineWidthMin = '0.5';
|
||||
style.FontName = 'auto';
|
||||
style.FontWeight = 'auto';
|
||||
style.FontAngle = 'auto';
|
||||
style.FontEncoding = 'latin1';
|
||||
style.PSLevel = '2';
|
||||
style.Renderer = 'auto';
|
||||
style.Resolution = 'auto';
|
||||
style.LineStyleMap = 'none';
|
||||
style.ApplyStyle = '0';
|
||||
style.Bounds = 'loose';
|
||||
style.LockAxes = 'on';
|
||||
style.ShowUI = 'on';
|
||||
style.SeparateText = 'off';
|
||||
|
||||
hgexport(fig,'temp_dummy',style,'applystyle', true);
|
||||
|
||||
else % Apply an existing style, defined as in the Export dialog
|
||||
% The files are in folder fullfile(prefdir(0),'ExportSetup');
|
||||
style = hgexport('readstyle',style_name);
|
||||
hgexport(fig,'temp_dummy',style,'applystyle', true);
|
||||
end
|
||||
152
Python/trap_forces_axial.py
Normal file
152
Python/trap_forces_axial.py
Normal file
@@ -0,0 +1,152 @@
|
||||
# These calculations are based on Ashkin's article "Forces of a single-beam
|
||||
# gradient laser trap on a dielectric sphere in the ray optics regime".
|
||||
# There are axial forces only
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
from scipy import integrate
|
||||
from scipy import special
|
||||
from scipy import constants
|
||||
|
||||
n1 = 1.3337 # index of refraction of the immersion medium
|
||||
n2 = 1.4607 # index of refraction of the fused silica at wavelength 523 nm
|
||||
n = n2 / n1 # n2/n1
|
||||
NA = 1.25 # numerical aperture
|
||||
th_max = np.arcsin(NA / n1) # maximum angle of incidence
|
||||
f = 2.0e-3 # objective lens focus or WD
|
||||
r_max = f * np.tan(th_max) # radius of a Gaussian beam (1:1 with input aperture condition)
|
||||
Rsp = 1.03e-6 # sphere radius
|
||||
P = 4.4e-3 # power of the laser
|
||||
|
||||
|
||||
# angle of refraction
|
||||
def r(th):
|
||||
return np.arcsin(n1 / n2 * np.sin(th))
|
||||
|
||||
|
||||
# Fresnel reflectivity
|
||||
def r_f(th, psi):
|
||||
return (np.tan(th - r(th)) ** 2 / np.tan(th + r(th)) ** 2) * np.cos(psi) ** 2 + \
|
||||
(np.sin(th - r(th)) ** 2 / np.sin(th + r(th)) ** 2) * np.sin(psi) ** 2
|
||||
|
||||
|
||||
# Fresnel transparency
|
||||
def t_f(th, psi):
|
||||
return 1 - r_f(th, psi)
|
||||
|
||||
|
||||
# force factors
|
||||
def q_s(th, psi):
|
||||
return 1 + r_f(th, psi) * np.cos(2 * th) - t_f(th, psi) ** 2 * \
|
||||
(np.cos(2 * th - 2 * r(th)) + r_f(th, psi) * np.cos(2*th)) / \
|
||||
(1 + r_f(th, psi) ** 2 + 2 * r_f(th, psi) * np.cos(2*r(th)))
|
||||
|
||||
|
||||
def q_g(th, psi):
|
||||
return r_f(th, psi) * np.sin(2 * th) - t_f(th, psi) ** 2 * \
|
||||
(np.sin(2 * th - 2 * r(th)) + r_f(th, psi) * np.sin(2 * th)) / \
|
||||
(1 + r_f(th, psi) ** 2 + 2 * r_f(th, psi) * np.cos(2 * r(th)))
|
||||
|
||||
|
||||
def q_mag(th, psi):
|
||||
return np.sqrt(q_s(th, psi) ** 2 + q_g(th, psi) ** 2)
|
||||
|
||||
|
||||
# Average factors (circular polarization
|
||||
def q_s_avg(th):
|
||||
return 0.5 * (q_s(th, 0) + q_s(th, np.pi/2))
|
||||
|
||||
|
||||
def q_g_avg(th):
|
||||
return 0.5 * (q_g(th, 0) + q_g(th, np.pi/2))
|
||||
|
||||
|
||||
def q_mag_avg(th):
|
||||
return np.sqrt(q_s_avg(th) ** 2 + q_g_avg(th) ** 2)
|
||||
|
||||
|
||||
# Angles
|
||||
def phi(dr):
|
||||
return np.arctan(dr / f)
|
||||
|
||||
|
||||
def thi(dr, dz):
|
||||
return np.arcsin(dz / Rsp * np.sin(phi(dr)), dtype=np.cfloat)
|
||||
|
||||
|
||||
def q_g_z(dr, dz):
|
||||
return -q_g_avg(thi(dr, dz)) * np.sin(phi(dr))
|
||||
|
||||
|
||||
def q_s_z(dr, dz):
|
||||
return q_s_avg(thi(dr, dz)) * np.cos(phi(dr))
|
||||
|
||||
|
||||
# Intensity profile
|
||||
a = 1.0
|
||||
w0 = a * r_max
|
||||
|
||||
|
||||
def intensity_uniform():
|
||||
return P / (np.pi * r_max ** 2)
|
||||
|
||||
|
||||
def intensity_gaussian_tem00(dr):
|
||||
i_0 = P * 2 / (np.pi*w0 ** 2)
|
||||
return i_0 * np.exp(-2 * dr ** 2 / w0 ** 2)
|
||||
|
||||
|
||||
def intensity_bessel(dr):
|
||||
w0_bb = 0.5 * r_max
|
||||
i_0 = P * 2 / (np.pi * w0 ** 2)
|
||||
return i_0 * special.jv(0, 2.405 / w0_bb * dr) ** 2 * np.exp(- 2 * dr ** 2 / w0 ** 2)
|
||||
|
||||
|
||||
# Intensity profile graphics
|
||||
sns.set()
|
||||
sns.set_style("darkgrid")
|
||||
|
||||
rho = np.linspace(-r_max, r_max, 500)
|
||||
fig1 = plt.figure(1, figsize=(10, 6))
|
||||
plt.plot(rho, intensity_gaussian_tem00(rho), 'k')
|
||||
plt.xlabel('r, m', fontsize=18)
|
||||
plt.ylabel('I(r)', fontsize=18)
|
||||
|
||||
|
||||
# Integration
|
||||
def q_res_g(dz, func):
|
||||
ans = integrate.quad(lambda x: x * func(x) * q_g_z(x, dz) * (~np.iscomplex(q_g_z(x, dz))).astype(float),
|
||||
0, r_max, epsabs=1e-12, epsrel=1e-6)
|
||||
return 2 * np.pi * ans[0]
|
||||
|
||||
|
||||
def q_res_s(dz, func):
|
||||
ans = integrate.quad(lambda x: x * func(x) * q_s_z(x, dz) * (~np.iscomplex(q_s_z(x, dz))).astype(float),
|
||||
0, r_max, epsabs=1e-12, epsrel=1e-6)
|
||||
return 2 * np.pi * ans[0]
|
||||
|
||||
|
||||
# Calculation
|
||||
n = 200
|
||||
z = np.linspace(-2 * Rsp, 2 * Rsp, n)
|
||||
|
||||
axial_g = [q_res_g(x, intensity_gaussian_tem00) for x in z]
|
||||
axial_s = [q_res_s(x, intensity_gaussian_tem00) for x in z]
|
||||
|
||||
f_0 = n1 * P / constants.c # net force
|
||||
|
||||
axial_g = np.array(axial_g[::-1])
|
||||
axial_s = np.array(axial_s[::-1])
|
||||
axial = axial_g + axial_s
|
||||
z = -z[::-1]
|
||||
|
||||
# Graphics
|
||||
fig2 = plt.figure(2, figsize=(10, 6))
|
||||
plt.plot(z, f_0*axial_g, 'b-.', lw=1, label='$F_{g}$')
|
||||
plt.plot(z, f_0*axial_s, 'r--', lw=1, label='$F_{s}$')
|
||||
plt.plot(z, f_0*axial, 'k', lw=1, label='$F_{t}$')
|
||||
plt.xlabel('r, m', fontsize=18)
|
||||
plt.ylabel('F, N', fontsize=18)
|
||||
plt.legend(fontsize=18)
|
||||
plt.show()
|
||||
65
Python/trap_forces_efficiencies.py
Normal file
65
Python/trap_forces_efficiencies.py
Normal file
@@ -0,0 +1,65 @@
|
||||
# These calculations are based on Ashkin's article "Forces of a single-beam
|
||||
# gradient laser trap on a dielectric sphere in the ray optics regime
|
||||
|
||||
# all distances in mm
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
a = 1.0 * 1e-6 # radius of the bead
|
||||
n1 = 1.33 # index of refraction of the medium
|
||||
n = 1.8 # n2/n1
|
||||
n2 = n * n1 # index of refraction of the fused silica
|
||||
c0 = 3 * 1e8 # speed of light
|
||||
|
||||
|
||||
# Fresnel reflectivity
|
||||
def r_f(th, psi):
|
||||
return (np.tan(th - np.arcsin(n1 / n2 * np.sin(th))) ** 2 /
|
||||
np.tan(th + np.arcsin(n1 / n2 * np.sin(th))) ** 2) * np.cos(psi) ** 2 + \
|
||||
(np.sin(th - np.arcsin(n1 / n2 * np.sin(th))) ** 2 /
|
||||
np.sin(th + np.arcsin(n1 / n2 * np.sin(th))) ** 2) * np.sin(psi) ** 2
|
||||
|
||||
|
||||
# Fresnel transparency
|
||||
def t_f(th, psi):
|
||||
return 1 - r_f(th, psi)
|
||||
|
||||
|
||||
# angle of refraction
|
||||
def r(th):
|
||||
return np.arcsin(n1 / n2 * np.sin(th))
|
||||
|
||||
|
||||
# force factors
|
||||
def q_s(th, psi):
|
||||
return 1 + r_f(th, psi) * np.cos(2 * th) - t_f(th, psi) ** 2 * \
|
||||
(np.cos(2 * th - 2 * r(th)) + r_f(th, psi) * np.cos(2*th)) / \
|
||||
(1 + r_f(th, psi) ** 2 + 2 * r_f(th, psi) * np.cos(2*r(th)))
|
||||
|
||||
|
||||
def q_g(th, psi):
|
||||
return r_f(th, psi) * np.sin(2 * th) - t_f(th, psi) ** 2 * \
|
||||
(np.sin(2 * th - 2 * r(th)) + r_f(th, psi) * np.sin(2 * th)) / \
|
||||
(1 + r_f(th, psi) ** 2 + 2 * r_f(th, psi) * np.cos(2 * r(th)))
|
||||
|
||||
|
||||
def q_mag(th, psi):
|
||||
return np.sqrt(q_s(th, psi) ** 2 + q_g(th, psi) ** 2)
|
||||
|
||||
|
||||
t = np.linspace(0, np.pi / 2, 1000)
|
||||
t_deg = t * 180 / np.pi
|
||||
pol = np.pi / 4
|
||||
|
||||
plt.figure(figsize=(13, 8))
|
||||
plt.plot(t_deg, q_s(t, pol), 'r--', label='Q_s')
|
||||
plt.plot(t_deg, -q_g(t, pol), 'b-.', label='Q_g')
|
||||
plt.plot(t_deg, q_mag(t, pol), 'k', label='Q_t')
|
||||
plt.grid()
|
||||
plt.xlabel(r'$\theta$, deg', fontsize=18)
|
||||
plt.ylabel('Q', fontsize=18)
|
||||
plt.legend(fontsize=18)
|
||||
plt.title('Beam efficiencies', fontsize=20)
|
||||
plt.show()
|
||||
158
Python/trap_forces_transverse.py
Normal file
158
Python/trap_forces_transverse.py
Normal file
@@ -0,0 +1,158 @@
|
||||
# These calculations are based on Ashkin's article "Forces of a single-beam
|
||||
# gradient laser trap on a dielectric sphere in the ray optics regime".
|
||||
# There are transverse forces only
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from scipy import integrate
|
||||
from scipy import special
|
||||
from scipy import constants
|
||||
|
||||
n1 = 1.3337 # index of refraction of the immersion medium
|
||||
n2 = 1.4607 # index of refraction of the fused silica at wavelength 523 nm
|
||||
n = n2 / n1 # n2/n1
|
||||
NA = 1.25 # numerical aperture
|
||||
th_max = np.arcsin(NA / n1) # maximum angle of incidence
|
||||
f = 2.0e-3 # objective lens focus or WD
|
||||
r_max = f * np.tan(th_max) # radius of a Gaussian beam (1:1 with input aperture condition)
|
||||
Rsp = 1.03e-6 # sphere radius
|
||||
P = 14e-3 # power of the laser
|
||||
|
||||
|
||||
# Angles
|
||||
def r(th):
|
||||
return np.arcsin(n1 / n2 * np.sin(th, dtype=np.cfloat))
|
||||
|
||||
|
||||
def phi(dr):
|
||||
return np.arctan(dr / f, dtype=np.cfloat)
|
||||
|
||||
|
||||
def gamma(db, dr):
|
||||
return np.arccos(np.cos(np.pi / 2 - phi(dr)) * np.cos(db), dtype=np.cfloat)
|
||||
|
||||
|
||||
def thi(db, dr, dy):
|
||||
return np.arcsin(dy / Rsp * np.sin(gamma(db, dr)), dtype=np.cfloat)
|
||||
|
||||
|
||||
# Fresnel reflectivity
|
||||
def r_f(th, psi):
|
||||
return (np.tan(th - r(th)) ** 2 / np.tan(th + r(th)) ** 2) * np.cos(psi) ** 2 + \
|
||||
(np.sin(th - r(th)) ** 2 / np.sin(th + r(th)) ** 2) * np.sin(psi) ** 2
|
||||
|
||||
|
||||
# Fresnel transparency
|
||||
def t_f(th, psi):
|
||||
return 1 - r_f(th, psi)
|
||||
|
||||
|
||||
# force factors
|
||||
def q_s(th, psi):
|
||||
return 1 + r_f(th, psi) * np.cos(2 * th) - t_f(th, psi) ** 2 * \
|
||||
(np.cos(2 * th - 2 * r(th)) + r_f(th, psi) * np.cos(2*th)) / \
|
||||
(1 + r_f(th, psi) ** 2 + 2 * r_f(th, psi) * np.cos(2*r(th)))
|
||||
|
||||
|
||||
def q_g(th, psi):
|
||||
return r_f(th, psi) * np.sin(2 * th) - t_f(th, psi) ** 2 * \
|
||||
(np.sin(2 * th - 2 * r(th)) + r_f(th, psi) * np.sin(2 * th)) / \
|
||||
(1 + r_f(th, psi) ** 2 + 2 * r_f(th, psi) * np.cos(2 * r(th)))
|
||||
|
||||
|
||||
def q_mag(th, psi):
|
||||
return np.sqrt(q_s(th, psi) ** 2 + q_g(th, psi) ** 2)
|
||||
|
||||
|
||||
# Average factors (circular polarization)
|
||||
def q_s_avg(th):
|
||||
return 0.5 * (q_s(th, 0) + q_s(th, np.pi/2))
|
||||
|
||||
|
||||
def q_g_avg(th):
|
||||
return 0.5 * (q_g(th, 0) + q_g(th, np.pi/2))
|
||||
|
||||
|
||||
def q_mag_avg(th):
|
||||
return np.sqrt(q_s_avg(th) ** 2 + q_g_avg(th) ** 2)
|
||||
|
||||
|
||||
def q_g_z(db, dr, dy):
|
||||
return q_g_avg(thi(db, dr, dy)) * np.cos(phi(dr), dtype=np.cfloat)
|
||||
|
||||
|
||||
def q_s_z(db, dr, dy):
|
||||
return q_s_avg(thi(db, dr, dy)) * np.sin(gamma(db, dr), dtype=np.cfloat)
|
||||
|
||||
|
||||
# Intensity profile
|
||||
a = 1.0
|
||||
w0 = a * r_max
|
||||
|
||||
|
||||
def intensity_uniform(dr):
|
||||
return 1 / (np.pi * r_max ** 2)
|
||||
|
||||
|
||||
def intensity_gaussian_tem00(dr):
|
||||
amp = (1 - np.exp(-2 * r_max ** 2 / w0 ** 2))
|
||||
p_0 = np.pi * w0 ** 2 / 2
|
||||
return 1 / (amp * p_0) * np.exp(-2 * dr ** 2 / w0 ** 2)
|
||||
|
||||
|
||||
def intensity_bessel(dr):
|
||||
p_0 = np.exp(0.5) * w0 * 0.0025 / 4.81
|
||||
|
||||
def temp_f(w):
|
||||
return w * special.jv(0, 2.405 / w0 * w) ** 2
|
||||
amp = integrate.quad(temp_f, 0, r_max)
|
||||
return 1 / (2 * np.pi * amp[0]) * special.jv(0, 2.405 / w0 * dr) ** 2
|
||||
|
||||
|
||||
# Intensity profile graphics
|
||||
rho = np.linspace(-r_max, r_max, 500)
|
||||
fig1 = plt.figure(1, figsize=(10, 6))
|
||||
plt.plot(rho, intensity_gaussian_tem00(rho), 'k')
|
||||
plt.grid()
|
||||
plt.xlabel('r, m', fontsize=18)
|
||||
plt.ylabel('I(r)', fontsize=18)
|
||||
plt.show()
|
||||
|
||||
|
||||
# Integration
|
||||
def q_res_g(dy, func):
|
||||
ans = integrate.dblquad(lambda dr, db, dy: dr * func(dr) * q_g_z(db, dr, dy) * (~np.iscomplex(q_g_z(db, dr, P))).astype(float),
|
||||
0, 2 * np.pi, 0, r_max, args=(dy, ),
|
||||
epsabs=1e-4, epsrel=1e-6)
|
||||
return ans[0]
|
||||
|
||||
|
||||
def q_res_s(dy, func):
|
||||
ans = integrate.dblquad(lambda dr, db: dr * func(dr) * q_s_z(db, dr, dy) * (~np.iscomplex(q_g_z(db, dr, P))).astype(float),
|
||||
0, 2 * np.pi, 0, r_max,
|
||||
epsabs=1e-4, epsrel=1e-6)
|
||||
return ans[0]
|
||||
|
||||
|
||||
# Calculation
|
||||
n = 150
|
||||
y = np.linspace(-2 * Rsp, 2 * Rsp, n)
|
||||
|
||||
transverse_g = np.abs(np.array([q_res_g(x, intensity_gaussian_tem00) for x in y]))
|
||||
transverse_s = np.array([q_res_s(x, intensity_gaussian_tem00) for x in y])
|
||||
|
||||
f_0 = n1 * P / constants.c # net force
|
||||
|
||||
transverse = transverse_g + transverse_s
|
||||
|
||||
|
||||
# Graphics
|
||||
fig2 = plt.figure(2, figsize=(10, 6))
|
||||
plt.plot(y, transverse_g, 'b-.', lw=1, label='$F_{g}$')
|
||||
plt.plot(y, transverse_s, 'r--', lw=1, label='$F_{s}$')
|
||||
plt.plot(y, transverse, 'k', lw=1, label='$F_{t}$')
|
||||
plt.xlabel('r, m', fontsize=18)
|
||||
plt.ylabel('F, m', fontsize=18)
|
||||
plt.legend()
|
||||
plt.grid()
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user