-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
693 additions
and
1,140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,47 @@ | ||
% Example file for finding spring constants | ||
% ott.axial_equilibrium can be used to calculate the trapping position | ||
% and spring constant along the z axis. If the beam is rotated, the | ||
% method can also be used for other axies too. | ||
% | ||
% This file is part of the optical tweezers toolbox. | ||
% See LICENSE.md for information about using/distributing this file. | ||
|
||
import ott.* | ||
import ott.utils.* | ||
|
||
% Make warnings less obtrusive | ||
ott_warning('once'); | ||
change_warnings('off'); | ||
|
||
% Specify refractive indices | ||
n_medium = 1.34; | ||
n_particle = 1.59; | ||
n_relative = n_particle/n_medium; | ||
|
||
% If you want to give all measurements in wavelengths in the surrounding | ||
% medium, then: | ||
wavelength = 1; | ||
% wavelength = wavelength0 / n_medium; | ||
% else you can give it in any units you want. Only k times lengths matters | ||
k = 2*pi/wavelength; | ||
% Specify the wavelength in freespace [m] | ||
wavelength = 1064.0e-9; | ||
|
||
% Specify the particle radius (sphere) | ||
radius = 1.0*wavelength/n_medium; | ||
|
||
radius = 1.5; | ||
Nmax = ka2nmax(k*radius); | ||
%% Calculate the beam | ||
|
||
if Nmax < 12 | ||
Nmax = 12; | ||
end | ||
beam = ott.BscPmGauss('angle_deg', 50, ... | ||
'polarisation', [ 1 0 ], 'power', 1.0); | ||
|
||
% a Gaussian beam: w0 = 2/(k*tan(theta)) | ||
beam_angle = 50; % Convergence half-angle of 50 degrees | ||
%% Calculate the particle T-matrix | ||
|
||
% Polarisation. [ 1 0 ] is plane-polarised along the x-axis, [ 0 1 ] is | ||
% y-polarised, and [ 1 -i ] and [ 1 i ] are circularly polarised. | ||
polarisation = [ 1 0 ]; | ||
T = ott.Tmatrix.simple('sphere', radius, ... | ||
'n_medium', n_medium, ... | ||
'n_particle', n_particle, ... | ||
'wavelength0', wavelength); | ||
|
||
[a,b] = bsc_pointmatch_farfield(Nmax,1,[ 0 0 beam_angle 1 polarisation 90 ]); | ||
%% Find the equilibrium and trap stiffness in the x and x directions | ||
|
||
% If you're going to do a range of particles, then the T-matrix has to | ||
% calculated inside the loop. | ||
% Find the equilibrium in the z-direction | ||
[z,kz] = ott.axial_equilibrium(T, beam) | ||
|
||
% To search for a refractive index, I recommend a bisection search. For an | ||
% example of bisection search, see find_axial_equilibrium.m | ||
% Translate the beam to the z-axis equilibrium | ||
beam = beam.translateZ(z); | ||
|
||
T = tmatrix_mie(Nmax,k,k*n_relative,radius); | ||
% Rotate the beam about the y axis (so the beam is aligned with the x axis) | ||
beam = beam.rotateY(pi/2.0); | ||
|
||
[z,k] = axial_equilibrium(T,a,b) | ||
% Calculate the equilibrium in the x-direction | ||
[x,kx] = ott.axial_equilibrium(T, beam); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.