summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2010-06-30 20:56:51 +0000
committerEugeniy Mikhailov <evgmik@gmail.com>2010-06-30 20:56:51 +0000
commitcd501ab6c1ddb68cf258529592adf33b70e4018f (patch)
tree5768e9dcf6611ff6a1a615a1f9a06e2f45bb5bf5
parente5cb8b10da8223a50ae2a2fb6412cdf7e1722831 (diff)
downloadmulti_mode_eit-cd501ab6c1ddb68cf258529592adf33b70e4018f.tar.gz
multi_mode_eit-cd501ab6c1ddb68cf258529592adf33b70e4018f.zip
added changes to avoid recalculation of the long computed matrices
-rw-r--r--psr/psr_vs_detuning.m36
1 files changed, 21 insertions, 15 deletions
diff --git a/psr/psr_vs_detuning.m b/psr/psr_vs_detuning.m
index 3e1b956..c293d02 100644
--- a/psr/psr_vs_detuning.m
+++ b/psr/psr_vs_detuning.m
@@ -43,26 +43,31 @@ kappa_m =zeros(1,N_detun_steps+1);
fprintf (stderr, "calculating atom properties\n");
fflush (stderr);
-pfile='rb87_D1_line.m'; % the parent file from which L0_and_polarization_submatrices calculated
-cfile='L0m_and_polarizability_calculated.mat'; % the child file to which calculated matrices writen
-[s, err, msg] = stat (pfile);
-if(err)
- %file does not exist
- disp('Big troubles are coming, no file to define Hamiltonian)');
- msg=cstrcat('File: ', pfile, ' is missing...exiting');
- disp(msg);
- return;
-else
- pfile_mtime=s.mtime;
+pfile='atomic_B_field.mat'; % the parent file where B_field is stored. This is the parameter for calculated L0_and_polarization_submatrices
+cfile='L0m_and_polarizability_calculated.mat'; % the child file to which calculated matrices are written
+neef_update=false;
+[s, err_p, msg] = stat (pfile);
+if(err_p)
+ %file does not exist
+ need_update=true;
+ else
+ B_field_cur=B_field;
+ load (pfile); % loading old B_field value
+ if (B_field ~= B_field_cur)
+ % old and current B field are different
+ B_field=B_field_cur;
+ need_update=true;
+ else
+ need_update=false;
+ endif
endif
+
[s, err, msg] = stat (cfile);
if(err)
%file does not exist
- cfile_mtime=0;
-else
- cfile_mtime=s.mtime;
+ need_update=true;
endif;
-if ( cfile_mtime >= pfile_mtime)
+if ( !need_update)
% matrices already calculated and up to date, all we need to load them
load(cfile);
else
@@ -72,6 +77,7 @@ if ( cfile_mtime >= pfile_mtime)
Nlevels, ...
H0, g_decay, g_dephasing, dipole_elements ...
);
+ save(pfile, 'B_field');
save(cfile, 'L0m', 'polarizability_m');
endif
elapsed_time = etime (clock (), t0);