diff options
Diffstat (limited to 'faraday_and_psr')
l--------- | faraday_and_psr/L0m.cache | 1 | ||||
-rw-r--r-- | faraday_and_psr/Makefile | 42 | ||||
l--------- | faraday_and_psr/basis_transformation.m | 1 | ||||
l--------- | faraday_and_psr/dipole_elementRb87D1line.m | 1 | ||||
-rw-r--r-- | faraday_and_psr/rb87_D1_line.m | 148 | ||||
-rw-r--r-- | faraday_and_psr/susceptibility_problem.m | 99 | ||||
-rwxr-xr-x | faraday_and_psr/task_solver.m | 20 | ||||
-rwxr-xr-x | faraday_and_psr/tasks_builder.m | 39 | ||||
-rw-r--r-- | faraday_and_psr/tasks_pp.m | 65 | ||||
l--------- | faraday_and_psr/useful_constants.m | 1 | ||||
l--------- | faraday_and_psr/useful_functions.m | 1 |
11 files changed, 418 insertions, 0 deletions
diff --git a/faraday_and_psr/L0m.cache b/faraday_and_psr/L0m.cache new file mode 120000 index 0000000..c9b0aa9 --- /dev/null +++ b/faraday_and_psr/L0m.cache @@ -0,0 +1 @@ +../L0m.cache
\ No newline at end of file diff --git a/faraday_and_psr/Makefile b/faraday_and_psr/Makefile new file mode 100644 index 0000000..39f5e1e --- /dev/null +++ b/faraday_and_psr/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: tasks_builder.m + @rm -f tasks/* + @./tasks_builder.m + @touch $@ + @echo "Please run again: make calculate" + +$(RESULTS): results/% : tasks/% + ./task_solver.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 + rm -rf L0m.cache diff --git a/faraday_and_psr/basis_transformation.m b/faraday_and_psr/basis_transformation.m new file mode 120000 index 0000000..28d8beb --- /dev/null +++ b/faraday_and_psr/basis_transformation.m @@ -0,0 +1 @@ +../basis_transformation.m
\ No newline at end of file diff --git a/faraday_and_psr/dipole_elementRb87D1line.m b/faraday_and_psr/dipole_elementRb87D1line.m new file mode 120000 index 0000000..6a11745 --- /dev/null +++ b/faraday_and_psr/dipole_elementRb87D1line.m @@ -0,0 +1 @@ +../dipole_elementRb87D1line.m
\ No newline at end of file diff --git a/faraday_and_psr/rb87_D1_line.m b/faraday_and_psr/rb87_D1_line.m new file mode 100644 index 0000000..74a52f0 --- /dev/null +++ b/faraday_and_psr/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/faraday_and_psr/susceptibility_problem.m b/faraday_and_psr/susceptibility_problem.m new file mode 100644 index 0000000..140204c --- /dev/null +++ b/faraday_and_psr/susceptibility_problem.m @@ -0,0 +1,99 @@ +function [xi_linear, xi_left, xi_right, E_field_pos_freq, light_positive_freq]=susceptibility_problem(detuning_freq, Ep, psi_el, B_field, theta, phi) +% calculates transmission if light polarizations vs B field in the cell +% for given laser probe and B fields array +% Probe field defined by field strength (Ep) and ellipticity angle (pse_el) +% Magnetic field defined by magnitude (B_field) and angles theta and phi. +% +% 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; + +%light_positive_freq = [wp]; +E_field_drive = [0 ]; +E_field_probe = [Ep ]; +E_field_zero = [0 ]; +E_field_lab_pos_freq.linear = E_field_zero + (1.00000+0.00000i)*E_field_probe + (1.00000+0.00000i)*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_lab_pos_freq.y] = rotXpolarization(phi, E_field_lab_pos_freq.linear); +% we add required ellipticity +E_field_lab_pos_freq.x*=exp(I*psi_el); +E_field_lab_pos_freq.y*=exp(-I*psi_el); +E_field_lab_pos_freq.z=E_field_zero; + +E_field_pos_freq=xyz_lin2atomic_axis_polarization(theta, E_field_lab_pos_freq); + + +wp0=w_pf1-w_sf2; %Fg=2 -> Fe=1 +wp=wp0+detuning_freq; +light_positive_freq=[ wp]; +% 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/faraday_and_psr/task_solver.m b/faraday_and_psr/task_solver.m new file mode 100755 index 0000000..c044cf6 --- /dev/null +++ b/faraday_and_psr/task_solver.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, Ep, psi_el, B_field, theta, phi); + +save(output_fname, 'detuning_freq', 'Ep', 'psi_el', 'B_field', 'theta', 'phi' ... + , 'xi_linear', 'xi_left', 'xi_right' ... + , 'E_field_pos_freq', 'light_positive_freq' ... + ); + diff --git a/faraday_and_psr/tasks_builder.m b/faraday_and_psr/tasks_builder.m new file mode 100755 index 0000000..78eea9e --- /dev/null +++ b/faraday_and_psr/tasks_builder.m @@ -0,0 +1,39 @@ +#!/usr/bin/octave -qf + +task_dir='tasks/'; +task_base_name='task_'; +task_ext='.mat'; +data_dir='results/'; +output_dir='results/'; +detuning_freq=0; + + +% assign some defaults +gmg=.7; % gyro magnetic ration for ground level + +%[psr_rad]=psr_vs_detuning(Ep, psi_el, B_field, theta, phi) + +% phi is angle between linear polarization and axis x +%phi=pi/4; +phi=0; +% theta is angle between lab z axis (light propagation direction) and magnetic field axis (z') +theta=0; +% psi_el is the ellipticity parameter (phase difference between left and right polarization) +psi_el=0*3/180*pi; + +Ep=sqrt(10.1); + +% we are going to sweep B so parts related to sweep paramer(s) +zeeman_splitting=+0.5; +Nsteps=101; +B_fields=linspace(-zeeman_splitting/gmg, zeeman_splitting/gmg, 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); + B_field = B_fields(i); + save(filename_task, 'detuning_freq', 'Ep', 'psi_el', 'B_field', 'theta', 'phi'); +endfor + +disp("Tasks creation done"); diff --git a/faraday_and_psr/tasks_pp.m b/faraday_and_psr/tasks_pp.m new file mode 100644 index 0000000..82bcdac --- /dev/null +++ b/faraday_and_psr/tasks_pp.m @@ -0,0 +1,65 @@ +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.y).^2 ); +legend('y'); +title('Signal out'); diff --git a/faraday_and_psr/useful_constants.m b/faraday_and_psr/useful_constants.m new file mode 120000 index 0000000..fc5b92d --- /dev/null +++ b/faraday_and_psr/useful_constants.m @@ -0,0 +1 @@ +../useful_constants.m
\ No newline at end of file diff --git a/faraday_and_psr/useful_functions.m b/faraday_and_psr/useful_functions.m new file mode 120000 index 0000000..a2d3237 --- /dev/null +++ b/faraday_and_psr/useful_functions.m @@ -0,0 +1 @@ +../useful_functions.m
\ No newline at end of file |