summaryrefslogtreecommitdiff
path: root/compass_circ.m
blob: 4673c6aae6d20406ced6a76280401d6ad87f4fc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
1;
clear all; 
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;
%four_levels_with_polarization;
%four_levels;
%three_levels;
%two_levels;

% load EM field description
field_description;

%Nfreq=length(modulation_freq);



%tune probe frequency
detuning_p=0;
N_detun_steps=100;
%detuning_p_min=-B_field*gmg*4; % span  +/-4 Zeeman splitting
%detuning_p_max=-detuning_p_min;
detuning_freq=zeros(1,N_detun_steps+1);
kappa_p      =zeros(1,N_detun_steps+1);
kappa_m      =zeros(1,N_detun_steps+1);
%detun_step=(detuning_p_max-detuning_p_min)/N_detun_steps;

fprintf (stderr, "calculating atom properties\n");
fflush (stderr);
% 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 ...
		);
elapsed_time = etime (clock (), t0);
fprintf (stderr, "elapsed time so far is %.3f sec\n",elapsed_time);
fflush (stderr);

global atom_properties;
atom_properties.L0m=L0m;
atom_properties.polarizability_m=polarizability_m;
atom_properties.dipole_elements=dipole_elements;

%Ed=.1;     Edc=conj(Ed);
%Ep=0.8*Ed;  Epc=conj(Ep);

%light_positive_freq  = [wp, wd,  wp-wd];
E_field_drive         = [0 , Ed,  0    ];
E_field_probe         = [Ep, 0 ,  0    ];
E_field_zero          = [0 , 0 ,  0    ];
E_field_lab_pos_freq.linear = E_field_zero + (1.00000+0.00000i)*E_field_probe  + (1.00000+0.00000i)*E_field_drive; 
%E_field_lab_pos_freq.right  = E_field_zero + (0.00000+0.00000i)*E_field_probe  + (0.00000+0.00000i)*E_field_drive;
%E_field_lab_pos_freq.left   = E_field_zero + (0.00000+0.00000i)*E_field_probe  + (0.00000+0.00000i)*E_field_drive;


% phi is angle between linear polarization and axis x
phi=pi*2/8;
% theta is angle between lab z axis (light propagation direction) and magnetic field axis (z')
theta=0/4;
theta=65/180*pi;
theta=0;
%small ellipticity angle psi (0 to pi/2)
% 0 will give linear polarization
% pi/2 circular polarization
%psi=pi/2;




fprintf (stderr, "tuning laser in forloop to set conditions vs detuning\n");
fflush (stderr);

detuning_freq=[-.075, -.05, -.025, 0 , .025, .05 , .075, .1];

problem_cntr=1;
N_angle_steps=15;
min_angle=0; max_angle=pi; 
thetas=min_angle:((max_angle-min_angle)/N_angle_steps):max_angle;
for theta=thetas;
	for detuning_p_cntr=1:length(detuning_freq);

			wp0=w_pf1;
			wd=w_pf1-w_hpf_ground;
			detuning_p=detuning_freq(detuning_p_cntr);
			wp=wp0+detuning_p;
			wm=wd-(wp-wd);

		light_positive_freq=[ wp, wd, wp-wd];
		% we define light into the cell as linearly polarized 
		% let's make circularly polarized light out of incident linear one
		E_field_lab_pos_freq.x = E_field_lab_pos_freq.linear/sqrt(2);
		E_field_lab_pos_freq.y = E_field_lab_pos_freq.linear/sqrt(2)*(1i);
		E_field_lab_pos_freq.z=E_field_zero;

		% now we transfor x,y,z, to x',y', and z' with respect to magnetic field az z' axis
		E_field_pos_freq=xyz_lin2atomic_axis_polarization(theta, E_field_lab_pos_freq);

		% we calculate dc and negative frequiencies 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{problem_cntr}=atom_field_problem;
			problem_cntr++;


			%kappa_p(detuning_p_cntr)=susceptibility_steady_state_at_freq( atom_field_problem);
	endfor
endfor

save '/tmp/problem_definition.mat' problems_cell_array atom_properties  detuning_freq  theta;
fprintf (stderr, "now really hard calculations begin\n");
fflush (stderr);
% once we define all problems the main job is done here
%kappa_p=cellfun( @susceptibility_steady_state_at_freq, problems_cell_array);
%kappa_p=parcellfun(2, @susceptibility_steady_state_at_freq, problems_cell_array);
%[xi_linear, xi_left, xi_right]=parcellfun(2, @susceptibility_steady_state_at_freq, problems_cell_array);
total_relative_transmission_vs_phi=parcellfun(2, @total_relative_transmission, problems_cell_array);
%total_relative_transmission_vs_phi=cellfun(@total_relative_transmission, problems_cell_array);

%save 'xi_vs_detuning.mat' detuning_freq xi_linear xi_left xi_right  ;
problem_cntr--;
save '/tmp/total_relative_transmission_vs_phi.mat' detuning_freq total_relative_transmission_vs_phi  thetas problem_cntr;

compass_circ_output_results;

elapsed_time = etime (clock (), t0)

% vim: ts=2:sw=2:fdm=indent