src/BWRRelax/relaxanalyze.cc
// These functions fill numerical arrays which represent the terms which
// contribute to a specific relaxation matrix element from a specific
// pair of interaction types (relaxation mechanisms) and a specific set
// of involved spins (e.g. ij-kl, ij-k, i-j).  Terms from both the sym-
// metric and anti-symmetric (dynamic frequency shift) spectral density
// components are treated.
These functions fill numerical arrays which represent the terms which
contribute to a specific relaxation matrix element from a specific
pair of interaction types (relaxation mechanisms) and a specific set
of involved spins .  Terms from both the sym
metric and anti-symmetric (dynamic frequency shift) spectral density
components are treated.
These functions fill numerical arrays which represent the terms which contribute to a specific relaxation matrix element from a specific pair of interaction types ( relaxation mechanisms ) and a specific set of involved spins . Terms from both the sym metric and anti - symmetric ( dynamic frequency shift ) spectral density components are treated .
void Rel_12(int hs, int rank, gen_op* T1s, gen_op* T2s,
    int& Jterms, complex* strsJ, int* trnsJ,
      int& Lterms, complex* strsL, int* trnsL,
        std::string* Wlbls, int a, int aa, int b, int bb, double cutoff)
						    Mechanism	  Rank	1    2
						----------------- ---- ---- ----
						 Dipolar	   2    ij   kl
						 Shift Anisotropy  2    i    j
						 Quadrupolar	   2    i    j
						 Random Field      1    i    j
  {
cutoff=0;					 Keep compiler happy
  int Jtermi = Jterms;				 There are already this many J(w) terms
  int Ltermi = Lterms;				 There are already this many L(w) terms
  Rel_12(hs,rank,T1s,T2s,			 Get terms for <a,a'|R  |b,b'> for J(w)
                 Jterms,strsJ,trnsJ,a,aa,b,bb);				12
  int trm;
  for(trm=Jtermi; trm<Jterms; trm++,Lterms++)	 Now copy these into arrays for the L(w)
    {						 terms.  They are the same at this point
    strsL[Lterms] = strsJ[trm];			 although J is symmetric but L is asymmetric
    trnsL[Lterms] = trnsJ[trm];
    }
  Rel_12_condense(hs, Jtermi, Jterms,		 Place all the terms so that have a postive
                         strsJ, trnsJ, Wlbls);	 w in J(w) by use of symmetry J(-w) = J(w)
  Rel_12_condense(hs, Jtermi, 			 Add together terms having the same J(w)
                        Jterms, strsJ, trnsJ);
  Rel_12_condense(hs, Ltermi, Lterms,		 Place all the terms so that they have a
                     strsL, trnsL, Wlbls, 1);	 positive w in L(w) by use of symmetry L(-w) = -L(w)
  Rel_12_condense(hs, Ltermi,			 Add together terms having the same L(w)
                    Lterms, strsL, trnsL, 1);
  return;
  }
void Rel_12 ( int hs , int rank , gen_op * T1s , gen_op * T2s , int & Jterms , complex * strsJ , int * trnsJ , int & Lterms , complex * strsL , int * trnsL , std :: string * Wlbls , int a , int aa , int b , int bb , double cutoff ) { cutoff = 0 ; int Jtermi = Jterms ; int Ltermi = Lterms ; Rel_12 ( hs , rank , T1s , T2s , Jterms , strsJ , trnsJ , a , aa , b , bb ) ; int trm ; for ( trm = Jtermi ; trm < Jterms ; trm ++ , Lterms ++ ) { strsL [ Lterms ] = strsJ [ trm ] ; trnsL [ Lterms ] = trnsJ [ trm ] ; } Rel_12_condense ( hs , Jtermi , Jterms , strsJ , trnsJ , Wlbls ) ; Rel_12_condense ( hs , Jtermi , Jterms , strsJ , trnsJ ) ; Rel_12_condense ( hs , Ltermi , Lterms , strsL , trnsL , Wlbls , 1 ) ; Rel_12_condense ( hs , Ltermi , Lterms , strsL , trnsL , 1 ) ; return ; }
These functions fill numerical arrays which represent the terms which
contribute to a specific relaxation matrix element from a specific
pair of interaction types (relaxation mechanisms) and a specific set
of involved spins (e.g.
These functions fill numerical arrays which represent the terms which contribute to a specific relaxation matrix element from a specific pair of interaction types ( relaxation mechanisms ) and a specific set of involved spins ( e . g .
// Input		hs    : Spin system Hilbert space //			rank  : Rank of the two interactions // 			T1s   : Spin tensor components, 1st interaction // 			T2s   : Spin tensor components, 2nd interaction //			Jterms: Number of non-zero J(w) terms in summation //			strsJ : Array of interaction strengths for J(w) //			trnsJ : Array of transition indices for J(w) //			Lterms: Number of non-zero L(w) terms in summation //			strsL : Array of interaction strengths for L(w) //			trnsL : Array of transition indices for L(w) //			Wlbls : string array of transition labels //			a, aa : 1st transition indices //			b, bb : 2nd transition indices //			cutoff: Value at which interaction is taken to be zero // Output		void  : Arrays strsJ, trnsJ, strsL, and trnsL have //				information added to them starting at Jterms,Lterms //				The values of Jterms and Lterms is adjusted // Note			      : T1s, T2s are assumed in their proper bases // Note			      : If J(L)terms != 0 at start, terms are added to arrays // Note			      : The subscripts 1 and 2 are cryptic in this context // 			        as they are often used simultaneously for indexing //				both a mechanism and the spin(s) involved in relaxation // //					    Mechanism	  Rank	1    2 //					----------------- ---- ---- ---- //					 Dipolar	   2    ij   kl //					 Shift Anisotropy  2    i    j //					 Quadrupolar	   2    i    j //					 Random Field      1    i    j /* The purpose of this routine is determine all non-zero contributions to the relaxation
   matrix element <a,a'|R|b,b'> for the interactions 1 with 2 as specified by the two
   input spin tensors (via their components), T1s and T2s.  The contribution to <a,a'|R|b,b'>
   is given by

                      rank    ls
   <a,a'|R   |b,b'>   ---   [ ---
          1,2         \     | \                 m       m 
   ---------------- = /     | /   delta     <a|T |g><b|T |g> J  (w  )
  	Xi            ---   | ---      a',b'    1       2    ~12  gb
          1,2	    m=-rank [  g
  
                                 m        m                       m        m
                           - <a|T |b><a'|T |b'> J  (w    ) - <b'|T |a'><b|T |a> J  (w  )
  	     	                 1        2     ~12  b'a'         1        2    ~12  ab

                                                     ls
                                                     ---                                      ]
                                                     \               m        m               |
                                                  +  /   delta   <g|T |a'><g|T |b'> J  (w   ) |
  	     	                                     ---      a,b    1        2     ~12  b'g  |
                                                      g                                       ]
  
   where the nomenclature is J  (w) = J  (w) + L  (w), and L  (w) = w*tau*J  (w).  L(w) are
                             ~12       12       12          12             12
  
   the antisymmetric dynamic frequency shift terms whereas J(w) are the normal symmetric
   spectral density functions. The indices where a,a',b, and b' indicate different eigenstates,
   and there are implicit spin labels on both the tensor components and on the spectral density
   functions due to the mechanism indices 1 and 2.  The expression is reduced in this function
   into a sum over nterms according to
  
                           < Jterms                        < Lterms
          <a,a'|R   |b,b'>   ---                             ---
                 1,2         \                               \
          ---------------- = /     strsJ[i] * J(w        ) + /     strsL[j] * L(w        )
              Xi             ---                 trnsJ[i]    ---                 trnsL[j]
                1,2	     i=0                             j=0
  
   where trans[i] relates to the original eigenstates according to
  
                              w           w        trnsJ[i] = a*hs+a' 
                               trnsJ[i] =  aa'           a' = tr%hs;
                                                         a  = (tr-a')/hs;
  
   There will be (2*rank+1)*[ls + 2 + ls] terms in the summation over m & g, however the spin tensor
   products act a a good filter so that most terms will be zero.  Any terms in which the spin tensor
   product has a magnitude below cutoff are herein considered zero and will not be included in the
   ouput arrays. Furthermore, many terms will add if they have the same spectral density functions.
   The end effect of this routine then, is the smallest possible amount of information needed to
   characterize the relaxation the relaxation matrix element for the pair of interactions (1,2) and
   the specified set of spins in terms of scaled spectral density functions.                      */ // Keep compiler happy // There are already this many J(w) terms // There are already this many L(w) terms // Get terms for <a,a'|R  |b,b'> for J(w) //			12 // Now copy these into arrays for the L(w) // terms.  They are the same at this point // although J is symmetric but L is asymmetric // Place all the terms so that have a postive // w in J(w) by use of symmetry J(-w) = J(w) // Add together terms having the same J(w) // Place all the terms so that they have a // positive w in L(w) by use of symmetry L(-w) = -L(w) // Add together terms having the same L(w)