diff options
Diffstat (limited to 'useful_functions.m')
-rw-r--r-- | useful_functions.m | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/useful_functions.m b/useful_functions.m index 5492609..0cc4952 100644 --- a/useful_functions.m +++ b/useful_functions.m @@ -79,22 +79,37 @@ function [L0m, polarizability_m]=L0_and_polarization_submatrices( ... m=rhoLiouville_r(s); n=rhoLiouville_c(s); - decay_part_m(p,s)= ... - ( ... - decay_total(g_decay,k)/2 ... - + decay_total(g_decay,j)/2 ... - + g_dephasing(j,k) ... - )* kron_delta_m(j,m)*kron_delta_m(k,n) ... - - kron_delta_m(m,n)*kron_delta_m(j,k)*g_decay(m,j) ; + % speed up avoiding guaranteed to be zero calculations + if ( kron_delta_m(k,n) && kron_delta_m(j,m) ) + decay_part_m(p,s)= ... + ( ... + decay_total(g_decay,k)/2 ... + + decay_total(g_decay,j)/2 ... + + g_dephasing(j,k) ... + ); + endif + if ( kron_delta_m(m,n) && kron_delta_m(j,k) ) + decay_part_m(p,s) += - g_decay(m,j) ; + endif + + % speed up avoiding guaranteed to be zero calculations + if ( kron_delta_m(k,n) ) + % calculate unperturbed part (Hamiltonian without EM field) + L0m(p,s)=H0(j,m); + + polarizability_m.linear(p,s) = dipole_elements.linear(j,m); + polarizability_m.left(p,s) = dipole_elements.left(j,m) ; + polarizability_m.right(p,s) = dipole_elements.right(j,m) ; + endif % speed up avoiding guaranteed to be zero calculations - if ( kron_delta_m(k,n) || kron_delta_m(j,m) ) + if ( kron_delta_m(j,m) ) % calculate unperturbed part (Hamiltonian without EM field) - L0m(p,s)=H0(j,m)*kron_delta_m(k,n)-H0(n,k)*kron_delta_m(j,m); + L0m(p,s)+=-H0(n,k)*kron_delta_m(j,m); - polarizability_m.linear(p,s)= ( dipole_elements.linear(j,m)*kron_delta_m(k,n)-dipole_elements.linear(n,k)*kron_delta_m(j,m) ); - polarizability_m.left(p,s)= ( dipole_elements.left(j,m)*kron_delta_m(k,n)-dipole_elements.left(n,k)*kron_delta_m(j,m) ); - polarizability_m.right(p,s)= ( dipole_elements.right(j,m)*kron_delta_m(k,n)-dipole_elements.right(n,k)*kron_delta_m(j,m) ); + polarizability_m.linear(p,s) +=-dipole_elements.linear(n,k); + polarizability_m.left(p,s) +=-dipole_elements.left(n,k); + polarizability_m.right(p,s) +=-dipole_elements.right(n,k); endif endfor endfor |