diff options
-rw-r--r-- | psr/psr_vs_detuning.m | 36 |
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); |