src/BWRRelax/relaxNMR.cc
// ------------------- Level 3 via Element Calculation ------------------------
//                     (Applies Secular Approximation)
Level 3 via Element Calculation
(Applies Secular Approximation)
Level 3 via Element Calculation ( Applies Secular Approximation )
void R_3(super_op& LOp, double* w, int rank, gen_op* T1s, gen_op* T2s,
	                                            matrix& J12, double cutoff)
					       LOp    = LOp   + R3
					          out	   in     12
	 Note				T1s, T2s, & LOp assumed in proper bases
  {
  int hs = T1s[0].dim();			 Get Hilbert space size
  double delwaa, delwbb;			 Transition frequencies (lab)
  int aaa=0, bbb=0;				 Element indices in LS
  complex Rel;					 Temporary element storage
  for(int a=0; a<hs; a++)			 Sum over transition a-aa
    for(int aa=0; aa<hs; aa++)
      {
      delwaa = w[a] - w[aa];			 Transition a-aa frequency
      bbb = 0;					 Set column index to 0
      for (int b=0; b<hs; b++)			 Sum over transition b-bb
        for (int bb=0; bb<hs; bb++)		 (or R matrix columns)
          {
          delwbb = w[b] - w[bb];		 Transition b-bb frequency
	  if(fabs(delwaa-delwbb) < cutoff)	 Apply secular approximation
            {
            Rel = LOp.get(aaa,bbb);		 Get current R matrix element
            Rel += R_4(hs,T1s,T2s,J12,		 Add in the contribution here
	                        rank,a,b,aa,bb);
            LOp.put(aaa, bbb, Rel);		 Add to the R matrix element
            }
          bbb++;				 Next element (next column)
          }
      aaa++;
      }
  }
void R_3 ( super_op & LOp , double * w , int rank , gen_op * T1s , gen_op * T2s , matrix & J12 , double cutoff ) { int hs = T1s [ 0 ] . dim ( ) ; double delwaa , delwbb ; int aaa = 0 , bbb = 0 ; complex Rel ; for ( int a = 0 ; a < hs ; a ++ ) for ( int aa = 0 ; aa < hs ; aa ++ ) { delwaa = w [ a ] - w [ aa ] ; bbb = 0 ; for ( int b = 0 ; b < hs ; b ++ ) for ( int bb = 0 ; bb < hs ; bb ++ ) { delwbb = w [ b ] - w [ bb ] ; if ( fabs ( delwaa - delwbb ) < cutoff ) { Rel = LOp . get ( aaa , bbb ) ; Rel += R_4 ( hs , T1s , T2s , J12 , rank , a , b , aa , bb ) ; LOp . put ( aaa , bbb , Rel ) ; } bbb ++ ; } aaa ++ ; } }
Level 3 via Element Calculation
(Applies Secular Approximation)
Level 3 via Element Calculation ( Applies Secular Approximation )
// Input		LOp   : Current relaxation superoperator //			w     : Vector of system energies //				in rad/sec in the LAB frame //			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 //			cutoff: Secular approximation cutoff value (Hz) // Return		void  : Level 3 relax. superop for interactions //			        1 & 2 added to input superoperator LOp // //				       LOp    = LOp   + R3 //				          out	   in     12 // // Note				T1s, T2s, & LOp assumed in proper bases /*  <a,a'| LOp |b,b'> += <a,a'| R3   |b,b'> == del         * <a,a'| R4   |b,b'>
                                  1,2             w   ,w              1,2
                                                    aa'  bb'

   where a, a', b, b' are basis function indices.                            */ // Get Hilbert space size // Transition frequencies (lab) // Element indices in LS // Temporary element storage // Sum over transition a-aa // Transition a-aa frequency // Set column index to 0 // Sum over transition b-bb // (or R matrix columns) // Transition b-bb frequency // Apply secular approximation // Get current R matrix element // Add in the contribution here // Add to the R matrix element // Next element (next column)