src/BWRRelax/relaxNMR.cc
// ---------------- Level 2 via Element Calculation ---------------------
//                    (No Degenerate Transitions)
Level 2 via Element Calculation
(No Degenerate Transitions)
Level 2 via Element Calculation ( No Degenerate Transitions )
void R_2(super_op& LOp, int rank, gen_op* T1s, gen_op* T2s, matrix& J12)
					       LOp    = LOp   + R2
					          out	   in     12
	 Note				T1s, T2s, and LOp assumed in proper bases
                  <a,a'| LOp |b,b'> += <a,a'| R2   |b,b'>
		                                  1,2
 where a, a', b, b' are basis function indices.
   {
   int hs = T1s[0].dim();			 Get Hilbert space size
   int aaa=0, bbb=0;
   complex Rel;
   for (int a=0; a<hs; a++)			 Sum over transitions a-aa
     for (int aa=0; aa<hs; aa++)
       {
       bbb = 0;
       for (int b=0; b<hs; b++)			 Sum over transitions b-bb
         for (int bb=0; bb<hs; bb++)
           {
           if((a==b) && (aa==bb))		 Algorithm for diagonals
             {					     <a,aa|R|a,aa>
             Rel = LOp.get(aaa,bbb);
             Rel += Rdiag_2(hs, T1s, T2s,
			      J12, rank, a, aa);
             LOp.put(aaa, bbb, Rel);
             }
           else if((a==aa) && (b==bb) && (a!=b)) Algorithm for off-diagonals
             {					      <a,a|R|b,b>
             Rel = LOp.get(aaa,bbb);
             Rel += Rodiag_2(hs, T1s, T2s,
			      J12, rank, a, b);
             LOp.put(aaa, bbb, Rel);
             }
           bbb++;
           }
       aaa++;
       }
   return;
  }
void R_2 ( super_op & LOp , int rank , gen_op * T1s , gen_op * T2s , matrix & J12 ) { int hs = T1s [ 0 ] . dim ( ) ; int aaa = 0 , bbb = 0 ; complex Rel ; for ( int a = 0 ; a < hs ; a ++ ) for ( int aa = 0 ; aa < hs ; aa ++ ) { bbb = 0 ; for ( int b = 0 ; b < hs ; b ++ ) for ( int bb = 0 ; bb < hs ; bb ++ ) { if ( ( a == b ) && ( aa == bb ) ) { Rel = LOp . get ( aaa , bbb ) ; Rel += Rdiag_2 ( hs , T1s , T2s , J12 , rank , a , aa ) ; LOp . put ( aaa , bbb , Rel ) ; } else if ( ( a == aa ) && ( b == bb ) && ( a != b ) ) { Rel = LOp . get ( aaa , bbb ) ; Rel += Rodiag_2 ( hs , T1s , T2s , J12 , rank , a , b ) ; LOp . put ( aaa , bbb , Rel ) ; } bbb ++ ; } aaa ++ ; } return ; }
Level 2 via Element Calculation
(No Degenerate Transitions)
Level 2 via Element Calculation ( No Degenerate Transitions )
// Input		LOp   : Current relaxation superoperator //			rank  : Rank of the two interactions // 			T1s   : Spin tensor components, 1st interaction // 			T2s   : Spin tensor components, 2nd interaction //			J12   : Matrix of reduced spectral density  //				function values for 2 interactions //				times the two interaction constants // Return		void  : Level 2 relaxation superop for interactions //			        1 & 2 added to input superoperator LOp // //				       LOp    = LOp   + R2 //				          out	   in     12 // // Note				T1s, T2s, and LOp assumed in proper bases //                  <a,a'| LOp |b,b'> += <a,a'| R2   |b,b'> //		                                  1,2 // where a, a', b, b' are basis function indices. // Get Hilbert space size // Sum over transitions a-aa // Sum over transitions b-bb // Algorithm for diagonals //     <a,aa|R|a,aa> // Algorithm for off-diagonals //      <a,a|R|b,b>