summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
l---------squeezing_filter/L0m.cache1
-rw-r--r--squeezing_filter/Makefile42
l---------squeezing_filter/basis_transformation.m1
-rwxr-xr-xsqueezing_filter/builder_tasks.m37
l---------squeezing_filter/dipole_elementRb87D1line.m1
-rw-r--r--squeezing_filter/pp_tasks.m76
-rw-r--r--squeezing_filter/rb87_D1_line.m148
-rwxr-xr-xsqueezing_filter/solver_task.m20
-rw-r--r--squeezing_filter/susceptibility_problem.m102
l---------squeezing_filter/useful_constants.m1
l---------squeezing_filter/useful_functions.m1
11 files changed, 430 insertions, 0 deletions
diff --git a/squeezing_filter/L0m.cache b/squeezing_filter/L0m.cache
new file mode 120000
index 0000000..c9b0aa9
--- /dev/null
+++ b/squeezing_filter/L0m.cache
@@ -0,0 +1 @@
+../L0m.cache \ No newline at end of file
diff --git a/squeezing_filter/Makefile b/squeezing_filter/Makefile
new file mode 100644
index 0000000..1121c70
--- /dev/null
+++ b/squeezing_filter/Makefile
@@ -0,0 +1,42 @@
+
+
+PROBLEMS = $(wildcard tasks/*.mat)
+RESULTS = $(PROBLEMS:tasks/%=results/%)
+
+
+calculate: problems solutions
+
+solutions: results $(RESULTS)
+
+results:
+ @mkdir results
+
+
+problems: tasks problems_prepared.stamp
+
+tasks:
+ @mkdir tasks
+
+problems_prepared.stamp: builder_tasks.m
+ @rm -f tasks/*
+ @./builder_tasks.m
+ @touch $@
+ @echo "Please run again: make calculate"
+
+$(RESULTS): results/% : tasks/%
+ ./solver_task.m $< $@
+
+tasks_clean:
+ rm -rf tasks/*
+
+results_clean:
+ rm -rf results/*
+
+clean: tasks_clean results_clean
+ rm -f problems_prepared.stamp
+
+
+real_clean: clean
+ rm -rf tasks
+ rm -rf results
+
diff --git a/squeezing_filter/basis_transformation.m b/squeezing_filter/basis_transformation.m
new file mode 120000
index 0000000..28d8beb
--- /dev/null
+++ b/squeezing_filter/basis_transformation.m
@@ -0,0 +1 @@
+../basis_transformation.m \ No newline at end of file
diff --git a/squeezing_filter/builder_tasks.m b/squeezing_filter/builder_tasks.m
new file mode 100755
index 0000000..970f5e5
--- /dev/null
+++ b/squeezing_filter/builder_tasks.m
@@ -0,0 +1,37 @@
+#!/usr/bin/octave -qf
+
+task_dir='tasks/';
+task_base_name='task_';
+task_ext='.mat';
+data_dir='results/';
+output_dir='results/';
+
+
+detuning_freq_start=-100;
+detuning_freq_stop=-detuning_freq_start;
+
+
+
+% theta is angle between lab z axis (light propagation direction) and magnetic field axis (z')
+theta=0;
+
+Ep=sqrt(0.01);
+Ed=sqrt(100);
+
+% we are going to sweep B so parts related to sweep paramer(s)
+gmg=.7; % gyro magnetic ration for ground level
+zeeman_splitting=+0.5;
+B_field=zeeman_splitting/gmg;
+
+Nsteps=101;
+detunings=linspace(detuning_freq_start, detuning_freq_stop, Nsteps);
+
+for i=1:Nsteps
+ filename_task=strcat(task_dir, task_base_name);
+ i_str=num2str(i, "%04d");
+ filename_task=strcat(filename_task,i_str, task_ext);
+ detuning_freq = detunings(i);
+ save(filename_task, 'detuning_freq', 'Ed', 'Ep', 'B_field', 'theta');
+endfor
+
+disp("Tasks creation done");
diff --git a/squeezing_filter/dipole_elementRb87D1line.m b/squeezing_filter/dipole_elementRb87D1line.m
new file mode 120000
index 0000000..6a11745
--- /dev/null
+++ b/squeezing_filter/dipole_elementRb87D1line.m
@@ -0,0 +1 @@
+../dipole_elementRb87D1line.m \ No newline at end of file
diff --git a/squeezing_filter/pp_tasks.m b/squeezing_filter/pp_tasks.m
new file mode 100644
index 0000000..a3919ba
--- /dev/null
+++ b/squeezing_filter/pp_tasks.m
@@ -0,0 +1,76 @@
+basis_transformation;
+
+fnames=glob('results/*.mat');
+
+Nsteps=length(fnames)
+B_field=zeros(1,Nsteps);
+xi_linear=zeros(1,Nsteps);
+xi_left=zeros(1,Nsteps);
+xi_right=zeros(1,Nsteps);
+
+% read the information from resulting files
+for i=1:Nsteps
+ d=load(fnames{i});
+ B_field(i)=d.B_field;
+ xi_linear(i)=d.xi_linear;
+ xi_left(i)=d.xi_left;
+ xi_right(i)=d.xi_right;
+ Ep.linear(i)=d.E_field_pos_freq.linear;
+ Ep.left(i)=d.E_field_pos_freq.left;
+ Ep.right(i)=d.E_field_pos_freq.right;
+endfor
+
+Ep_out.linear=(1-xi_linear).*Ep.linear;
+Ep_out.left=(1-xi_left).*Ep.left;
+Ep_out.right=(1-xi_right).*Ep.right;
+
+Ep_out.x= (Ep_out.left + Ep_out.right)/sqrt(2);
+Ep_out.y= 1i*(Ep_out.left - Ep_out.right)/sqrt(2);
+
+xi_x=(xi_right+xi_left)/sqrt(2);
+xi_y=(1i*xi_right-1i*xi_left)/sqrt(2);
+
+%figure(1);
+%plot(B_field, real(xi_x), B_field, real(xi_y));
+%legend('x','y');
+%title('xi-real');
+
+%figure(2);
+%plot(B_field, imag(xi_x), B_field, imag(xi_y));
+%legend('x','y');
+%title('xi-imag');
+
+%figure(3);
+%plot(B_field, real(xi_left), B_field, real(xi_right));
+%legend('left','right');
+%title('xi-real');
+
+%figure(4);
+%plot(B_field, imag(xi_left), B_field, imag(xi_right));
+%legend('left','right');
+%title('xi-imag');
+
+%figure(5);
+%plot(B_field, abs(Ep_out.x).^2, B_field, abs(Ep_out.y).^2 );
+%legend('x','y');
+%title('Signal out');
+
+%figure(6);
+%plot(B_field, abs(Ep_out.left).^2, B_field, abs(Ep_out.right).^2 );
+%legend('left','right');
+%title('Signal out');
+
+figure(7);
+plot(B_field, abs(Ep_out.x).^2 );
+legend('x');
+title('Signal out');
+
+figure(8);
+plot(B_field, abs(Ep_out.y).^2 );
+legend('y');
+title('Signal out');
+
+figure(9);
+plot(B_field, abs(Ep_out.x).^2-abs(Ep_out.y).^2 );
+legend('x-y');
+title('Differential x-y out');
diff --git a/squeezing_filter/rb87_D1_line.m b/squeezing_filter/rb87_D1_line.m
new file mode 100644
index 0000000..74a52f0
--- /dev/null
+++ b/squeezing_filter/rb87_D1_line.m
@@ -0,0 +1,148 @@
+1;
+useful_constants;
+
+% note all frequency values are in MHz
+
+% 87Rb D1 line
+%
+% m=-2 m=-1 m=0 m=1 m=2
+% ---- ---- ---- ---- ---- |P,F=2>
+%
+% ---- ---- ---- |P,F=1>
+% m=-1 m=0 m=1
+%
+%
+%
+%
+%
+% m=-2 m=-1 m=0 m=1 m=2
+% ---- ---- ---- ---- ---- |S,F=2>
+%
+% ---- ---- ---- |S,F=1>
+% m=-1 m=0 m=1
+
+
+w_hpf_ground=6834;
+w_hpf_exited=817;
+w_sf2 = w_hpf_ground; % Distance from |S,F=1> to |S,F=2>
+w_pf1 =1e9; % something big Distance from |S,F=1> to |P,F=1>
+w_pf2 = w_pf1+w_hpf_exited; %Distance from |S,F=1> to |P,F=2>
+gmg=.7; % gyro magnetic ration for ground level
+gme=.23; % gyro magnetic ration for exited level % CHECKME
+
+
+%bottom level |F=1>
+levels( 1)=struct( "ang_momentum", 0, "total_momentum", 1, "m", -1, "energy", 0, "gm", -gmg);
+levels( 2)=struct( "ang_momentum", 0, "total_momentum", 1, "m", 0, "energy", 0, "gm", -gmg);
+levels( 3)=struct( "ang_momentum", 0, "total_momentum", 1, "m", 1, "energy", 0, "gm", -gmg);
+
+%second bottom level |F=2>
+levels( 4)=struct( "ang_momentum", 0, "total_momentum", 2, "m", -2, "energy", w_sf2, "gm", gmg);
+levels( 5)=struct( "ang_momentum", 0, "total_momentum", 2, "m", -1, "energy", w_sf2, "gm", gmg);
+levels( 6)=struct( "ang_momentum", 0, "total_momentum", 2, "m", 0, "energy", w_sf2, "gm", gmg);
+levels( 7)=struct( "ang_momentum", 0, "total_momentum", 2, "m", 1, "energy", w_sf2, "gm", gmg);
+levels( 8)=struct( "ang_momentum", 0, "total_momentum", 2, "m", 2, "energy", w_sf2, "gm", gmg);
+
+% first exited level |F=1>
+levels( 9)=struct( "ang_momentum", 1, "total_momentum", 1, "m", -1, "energy", w_pf1, "gm", -gme);
+levels(10)=struct( "ang_momentum", 1, "total_momentum", 1, "m", 0, "energy", w_pf1, "gm", -gme);
+levels(11)=struct( "ang_momentum", 1, "total_momentum", 1, "m", 1, "energy", w_pf1, "gm", -gme);
+
+% second exited level |F=2>
+levels(12)=struct( "ang_momentum", 1, "total_momentum", 2, "m", -2, "energy", w_pf2, "gm", gme);
+levels(13)=struct( "ang_momentum", 1, "total_momentum", 2, "m", -1, "energy", w_pf2, "gm", gme);
+levels(14)=struct( "ang_momentum", 1, "total_momentum", 2, "m", 0, "energy", w_pf2, "gm", gme);
+levels(15)=struct( "ang_momentum", 1, "total_momentum", 2, "m", 1, "energy", w_pf2, "gm", gme);
+levels(16)=struct( "ang_momentum", 1, "total_momentum", 2, "m", 2, "energy", w_pf2, "gm", gme);
+
+Nlevels=size(levels)(2);
+
+
+H0=zeros(Nlevels);
+energy = [1:Nlevels].*0;
+ang_momentum = [1:Nlevels].*0;
+total_momentum = [1:Nlevels].*0;
+m = [1:Nlevels].*0;
+gm = [1:Nlevels].*0;
+
+for i=1:Nlevels
+ energy(i) = levels(i).energy;
+ ang_momentum(i) = levels(i).ang_momentum;
+ total_momentum(i) = levels(i).total_momentum;
+ m(i) = levels(i).m;
+ gm(i) = levels(i).gm;
+endfor
+H0=diag(energy)*hbar;
+
+
+dipole_elements.left = zeros(Nlevels);
+dipole_elements.right = zeros(Nlevels);
+dipole_elements.linear = zeros(Nlevels);
+% define dipole elements for transition from level j->k
+for j=1:Nlevels
+ for k=1:Nlevels
+ if ( abs(ang_momentum(j) - ang_momentum(k)) == 1)
+ %transition allowed for L =L' +/- 1
+ % but they correct within a factor, but not sign
+ if ( ( H0(j,j) < H0(k,k)) )
+ de=dipole_elementRb87D1line(...
+ total_momentum(j),m(j), ...
+ total_momentum(k),m(k) ...
+ );
+ dipole_elements.left(j,k) = de.left;
+ dipole_elements.right(j,k) = de.right;
+ dipole_elements.linear(j,k) = de.linear;
+ endif
+ endif
+ endfor
+endfor
+dipole_elements.linear+=dipole_elements.linear';
+dipole_elements.left+=dipole_elements.left';
+dipole_elements.right+=dipole_elements.right';
+
+maximum_dipole_elements=abs(dipole_elements.linear) + abs(dipole_elements.left) + abs(dipole_elements.right);
+
+%defasing matrix
+g_deph=0;
+g_dephasing=zeros(Nlevels);
+% dephasing only for non zero dipole elements (am I right?)
+g_dephasing=g_deph*(abs(maximum_dipole_elements) != 0);
+
+% decay matrix g(i,j) correspnds to decay from i-->j
+gamma=6;
+g_decay=zeros(Nlevels);
+for i=1:Nlevels
+ for j=1:Nlevels
+ if ( H0(i,i) > H0(j,j) )
+ % only upper levels decaying and decay is always positive
+ g_decay(i,j)=gamma * abs( maximum_dipole_elements(i,j) );
+ endif
+ endfor
+endfor
+
+% ground level mixing need to be artificial
+gamma_hpf=.0001;
+for i=1:Nlevels
+ for j=1:Nlevels
+ % it would be better to introduce a level corresponding to the bath
+ % but this slows calculations
+ % So
+ % ground hyperfine are equally mixed together
+ if ( (abs( H0(i,i) - H0(j,j)) == w_hpf_ground*hbar ) || ...
+ (abs( H0(i,i) - H0(j,j)) == 0 ) )
+ % i and j correspond to 2 ground levels
+ % we cannot decay to itself
+ if ( i != j )
+ % total eight ground levels F=2 and F=1 so we decay in 7 channels
+ g_decay(i,j)+=gamma_hpf/7;
+ endif
+ endif
+ endfor
+endfor
+
+% apply B field Zeeman splitting
+energy+=B_field * ( gm .* m);
+% convert frequency to energy units
+H0=diag(energy)*hbar;
+
+% vim: ts=2:sw=2:fdm=indent
diff --git a/squeezing_filter/solver_task.m b/squeezing_filter/solver_task.m
new file mode 100755
index 0000000..1253a6f
--- /dev/null
+++ b/squeezing_filter/solver_task.m
@@ -0,0 +1,20 @@
+#!/usr/bin/octave -qf
+% reads parameters file (argv1) and output results of the calculations into output file (argv(2)
+
+arg_list = argv ();
+
+if (nargin < 2)
+ error("need at least two parameters");
+end
+params_file=arg_list{1};
+output_fname=arg_list{2};
+
+load(params_file);
+
+[xi_linear, xi_left, xi_right, E_field_pos_freq, light_positive_freq]=susceptibility_problem(detuning_freq, Ed, Ep, B_field, theta);
+
+save(output_fname, 'detuning_freq', 'Ed', 'Ep', 'B_field', 'theta' ...
+ , 'xi_linear', 'xi_left', 'xi_right' ...
+ , 'E_field_pos_freq', 'light_positive_freq' ...
+ );
+
diff --git a/squeezing_filter/susceptibility_problem.m b/squeezing_filter/susceptibility_problem.m
new file mode 100644
index 0000000..b9c74fc
--- /dev/null
+++ b/squeezing_filter/susceptibility_problem.m
@@ -0,0 +1,102 @@
+function [xi_linear, xi_left, xi_right, E_field_pos_freq, light_positive_freq]=susceptibility_problem(detuning_freq, Ed, Ep, B_field, theta)
+% calculates transmission if light polarizations vs B field in the cell
+% for given laser probe, drive and B field
+% Probe field defined by field strength (Ep), drive (Ed)
+% Magnetic field defined by magnitude (B_field) and angles theta with respect to 'z' axis
+% of light propagation
+%
+% Note: it is expensive to recalculate atom property for each given B_field strength
+% so run as many calculation for constant magnetic field as possible
+
+t0 = clock (); % we will use this latter to calculate elapsed time
+
+
+% load useful functions;
+useful_functions;
+
+% some physical constants
+useful_constants;
+
+basis_transformation; % load subroutines
+
+
+% load atom energy levels and decay description
+rb87_D1_line;
+
+
+B_str=num2str(B_field(1),"%g");
+% the child file to which calculated matrices are written
+cfile='L0m.cache/L0m_and_polarizability_calculated_for_B=';
+cfile=strcat(cfile,B_str,'.mat');
+
+need_update=true;
+[s, err, msg] = stat (cfile);
+if(err)
+ %file does not exist
+ need_update=true;
+else
+ need_update=false;
+endif;
+if ( !need_update)
+ % matrices already calculated and up to date, all we need to load them
+ load(cfile);
+ else
+ % calculate E_field independent properties of the atom
+ % to be used as sub matrix templates for Liouville operator matrix
+ [L0m, polarizability_m]=L0_and_polarization_submatrices( ...
+ Nlevels, ...
+ H0, g_decay, g_dephasing, dipole_elements ...
+ );
+ save(cfile, 'L0m', 'polarizability_m');
+ endif
+
+global atom_properties;
+atom_properties.L0m=L0m;
+atom_properties.polarizability_m=polarizability_m;
+atom_properties.dipole_elements=dipole_elements;
+
+%wp0=w_pf1-w_sf2; %Fg=2 -> Fe=1
+w0=w_pf1-w_hpf_exited+w_hpf_exited; %Fg=2 -> Fe=2
+wp=w0+detuning_freq;
+light_positive_freq=[w0, wp, wp-w0]; % [drive_freq, probe_dreq];
+
+%light_positive_freq = [wp];
+E_field_drive = [Ed, 0, 0 ];
+E_field_probe = [0, Ep, 0 ];
+E_field_zero = [0, 0, 0 ];
+E_field_lab_pos_freq.linear = E_field_probe + E_field_drive;
+
+% we define light as linearly polarized
+% where phi is angle between light polarization and axis x
+% only sign of modulation frequency is important now
+% we define actual frequency later on
+E_field_lab_pos_freq.x = E_field_drive;
+E_field_lab_pos_freq.y = E_field_probe;
+E_field_lab_pos_freq.z=E_field_zero;
+
+E_field_pos_freq=xyz_lin2atomic_axis_polarization(theta, E_field_lab_pos_freq);
+
+% we calculate dc and negative frequencies as well as amplitudes
+[modulation_freq, E_field] = ...
+ light_positive_frequencies_and_amplitudes2full_set_of_modulation_frequencies_and_amlitudes(...
+ light_positive_freq, E_field_pos_freq);
+freq_index=freq2index(wp,modulation_freq);
+
+
+
+
+atom_field_problem.E_field = E_field;
+atom_field_problem.modulation_freq = modulation_freq;
+atom_field_problem.freq_index = freq_index;
+
+problems_cell_array=atom_field_problem;
+
+[xi_linear, xi_left, xi_right]=susceptibility_steady_state_at_freq( problems_cell_array);
+
+
+elapsed_time = etime (clock (), t0)
+return
+
+endfunction
+
+% vim: ts=2:sw=2:fdm=indent
diff --git a/squeezing_filter/useful_constants.m b/squeezing_filter/useful_constants.m
new file mode 120000
index 0000000..fc5b92d
--- /dev/null
+++ b/squeezing_filter/useful_constants.m
@@ -0,0 +1 @@
+../useful_constants.m \ No newline at end of file
diff --git a/squeezing_filter/useful_functions.m b/squeezing_filter/useful_functions.m
new file mode 120000
index 0000000..a2d3237
--- /dev/null
+++ b/squeezing_filter/useful_functions.m
@@ -0,0 +1 @@
+../useful_functions.m \ No newline at end of file