diff options
-rw-r--r-- | useful_functions.m | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/useful_functions.m b/useful_functions.m index b9668b0..5492609 100644 --- a/useful_functions.m +++ b/useful_functions.m @@ -79,8 +79,6 @@ function [L0m, polarizability_m]=L0_and_polarization_submatrices( ... m=rhoLiouville_r(s); n=rhoLiouville_c(s); - % 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); decay_part_m(p,s)= ... ( ... decay_total(g_decay,k)/2 ... @@ -88,9 +86,16 @@ function [L0m, polarizability_m]=L0_and_polarization_submatrices( ... + 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) ; - 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) ); + + % speed up avoiding guaranteed to be zero calculations + if ( kron_delta_m(k,n) || 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); + + 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) ); + endif endfor endfor L0m=-im_one/hbar*L0m - decay_part_m; |