summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--liouville.m31
-rw-r--r--useful_functions.m30
2 files changed, 35 insertions, 26 deletions
diff --git a/liouville.m b/liouville.m
index 0673a7e..5987925 100644
--- a/liouville.m
+++ b/liouville.m
@@ -1,3 +1,7 @@
+
+% load useful functions;
+useful_functions;
+
% some physical constants
hbar=1;
im_one=0+1i;
@@ -5,6 +9,7 @@ im_one=0+1i;
three_levels;
%two_levels;
+
Nfreq=length(modulation_freq);
% now we create Liouville indexes list
@@ -35,21 +40,6 @@ L=zeros(N); % NxN matrix
Li=zeros(N); % NxN Liouville interactive
L0=zeros(N); % NxN Liouville from unperturbed hamiltonian
-function ret=decay_total(g_decay,i)
- ret=0;
- for k=1:size(g_decay)(1)
- ret=ret+g_decay(i,k);
- endfor
-endfunction
-
-function ret=kron_delta(i,j)
- if ((i==j))
- ret=1;
- else
- ret=0;
- endif
-endfunction
-
for p=1:N
for s=1:N
j=rhoLiouville_r(p);
@@ -124,17 +114,6 @@ rhoLiouville_dot(1)=1;
%solving for density matrix vector
rhoLiouville=L\rhoLiouville_dot;
-% this function create from Liouville density vector
-% the density matrix with given modulation frequency
-function rho=rhoOfFreq(rhoLiouville, freqIndex, Nlevels, Nfreq)
- rho=zeros(Nlevels);
- for r=1:Nlevels
- for c=1:Nlevels
- rho(r,c)=rhoLiouville((freqIndex-1)*Nlevels^2+(r-1)*Nlevels+c);
- endfor
- endfor
-endfunction
-
rho_0=rhoOfFreq(rhoLiouville, 1, Nlevels, Nfreq)
rho_1=rhoOfFreq(rhoLiouville, 2, Nlevels, Nfreq)
diff --git a/useful_functions.m b/useful_functions.m
new file mode 100644
index 0000000..748a677
--- /dev/null
+++ b/useful_functions.m
@@ -0,0 +1,30 @@
+1;
+
+% calculate total decay for particular level taking in account all branches
+function ret=decay_total(g_decay,i)
+ ret=0;
+ for k=1:size(g_decay)(1)
+ ret=ret+g_decay(i,k);
+ endfor
+endfunction
+
+% kroneker delta symbol
+function ret=kron_delta(i,j)
+ if ((i==j))
+ ret=1;
+ else
+ ret=0;
+ endif
+endfunction
+
+% this function create from Liouville density vector
+% the density matrix with given modulation frequency
+function rho=rhoOfFreq(rhoLiouville, freqIndex, Nlevels, Nfreq)
+ rho=zeros(Nlevels);
+ for r=1:Nlevels
+ for c=1:Nlevels
+ rho(r,c)=rhoLiouville((freqIndex-1)*Nlevels^2+(r-1)*Nlevels+c);
+ endfor
+ endfor
+endfunction
+