src/MultiSys/MultiExch0.cc
/* This function checkes whether a particular element in a non-mutual exchange
   superoperator may be non-zero. This exchange supoeroperator is associated
   with the multiple spin system msys and the partiuclar exchange process Pro.
   The element <I|Xp|J> is specified by two Hilbert space bras and kets, i.e.
   <I|Xp|J> = <|i><i||Xp||j><j||. These are input as braI, ketI, braJ, ketJ
   respectively. Each off-diagonal element must be associated with exchange
   between two component spin systems cmpI and cmpJ (where cmpI != cmpJ).
   The function returns false if <I|Xp|J> is zero for exchange process Pro. If
   the element is non-zero, the function returns true and sets the value of
   the element normalization, hsnorm, based on spin Hilbert spaces.         

   To decide if an element is non-zero a comparison is made between the spin
   quantum states of two components spins. The Hilbert space bra and ket of
   component A is given by

         |A> = |Am  Am  ... Am  >   and   <A| = <Am  Am  ... Am  |
                  z1  z2      zn                   z1  z2      zn
  
   where n is the number of spins in A. An element of Xp can be considered to
   be
                    '   '   '          ''   ''   ''      '''  '''  '''
     <|A>|B>|C>...<A |<B |<C |...|Xp||A  >|B  >|C  >...<A   |B   |C   |...|

   where the primes indicate that the associated mz values are different. Now
   consider an element <I|Xp|J> which happens to line in the area where say
   component B exchanges with component D. We know that, within the block 
   associated with B & D, the spin quantum numbers will match for any other 
   components (since they are unchanging within the block). Thus we might 
   write
                                           '        '
                         <I|Xp|J> == <|B><B||Xp|D><D||

   That is, only the spin quantum numbers for the exchange components need to
   be considered. Expanding over the individual spin quantum numbers we have

                                 '   '       '                      '      '
 <I|Xp|J> = <|Bm  Bm  .. Bm  ><Bm  Bm  ... Bm  ||Xp||Dm  .. Dm  ><Dm  .. Dm  |>
                z1  z2     zn    z1  z2      zn        z1     zl    z1     zl

   An exchange process will potentially swap spins on the left with spins on
   the right. 
*/
This function checkes whether a particular element in a non-mutual exchange
superoperator may be non-zero. This exchange supoeroperator is associated
with the multiple spin system msys and the partiuclar exchange process Pro.
The element  is specified by two Hilbert space bras and kets, i.e.

To decide if an element is non-zero a comparison is made between the spin
quantum states of two components spins. The Hilbert space bra and ket of
component A is given by







That is, only the spin quantum numbers for the exchange components need to
be considered. Expanding over the individual spin quantum numbers we have



An exchange process will potentially swap spins on the left with spins on
the right.
This function checkes whether a particular element in a non - mutual exchange superoperator may be non - zero . This exchange supoeroperator is associated with the multiple spin system msys and the partiuclar exchange process Pro . The element is specified by two Hilbert space bras and kets i . e . To decide if an element is non - zero a comparison is made between the spin quantum states of two components spins . The Hilbert space bra and ket of component A is given by That is only the spin quantum numbers for the exchange components need to be considered . Expanding over the individual spin quantum numbers we have An exchange process will potentially swap spins on the left with spins on the right .
bool Xnmpelem(const multi_sys& msys, const ExchProc& Pro,
       const row_vector& braI, const row_vector& ketI,
       const row_vector& braJ, const row_vector& ketJ,
                                        int cmpI, int cmpJ, int& hsnorm)
  {
  hsnorm = 1;					
  bool passive;					
  double qIb = 0, qIk = 0;			
  double qJb = 0, qJk = 0;			
  int sI, sJ;					
  int ncI = braI.cols();			
  int ncJ = braJ.cols();			
  for(sI=0; sI<ncI; sI++)			
    {						
    passive = true;				
    qIb = braI.getRe(sI);			
    qIk = ketI.getRe(sI);			
    for(sJ=0; sJ<ncJ && passive; sJ++)		
      { 					
      if(Pro.mapped(cmpI,sI,cmpJ,sJ))		
        {					
        passive = false;
        qJb = braJ.getRe(sJ);			
        qJk = ketJ.getRe(sJ);			
        if((qIb!=qJb) || (qIk!=qJk))		
          return false;				
        }
      }
    if(passive)					
      {						
      if(qIb!=qIk) return false;		
      hsnorm *= (msys.Comp(cmpI)).HS(sI); 	
      } 					
    }
  for(sJ=0; sJ<ncJ; sJ++) 			
    {						
    qJb = braJ.getRe(sJ);			
    qJk = ketJ.getRe(sJ);			
    passive = true;				
    for(sI=0; sI<ncI && passive; sI++)		
      {						
      if(Pro.mapped(cmpJ,sJ,cmpI,sI))		
        passive = false;			
      }
    if(passive)					
      if(qJb != qJk) return false; 		
    }
  return true;
  }
bool Xnmpelem ( const multi_sys & msys , const ExchProc & Pro , const row_vector & braI , const row_vector & ketI , const row_vector & braJ , const row_vector & ketJ , int cmpI , int cmpJ , int & hsnorm ) { hsnorm = 1 ; bool passive ; double qIb = 0 , qIk = 0 ; double qJb = 0 , qJk = 0 ; int sI , sJ ; int ncI = braI . cols ( ) ; int ncJ = braJ . cols ( ) ; for ( sI = 0 ; sI < ncI ; sI ++ ) { passive = true ; qIb = braI . getRe ( sI ) ; qIk = ketI . getRe ( sI ) ; for ( sJ = 0 ; sJ < ncJ && passive ; sJ ++ ) { if ( Pro . mapped ( cmpI , sI , cmpJ , sJ ) ) { passive = false ; qJb = braJ . getRe ( sJ ) ; qJk = ketJ . getRe ( sJ ) ; if ( ( qIb != qJb ) || ( qIk != qJk ) ) return false ; } } if ( passive ) { if ( qIb != qIk ) return false ; hsnorm *= ( msys . Comp ( cmpI ) ) . HS ( sI ) ; } } for ( sJ = 0 ; sJ < ncJ ; sJ ++ ) { qJb = braJ . getRe ( sJ ) ; qJk = ketJ . getRe ( sJ ) ; passive = true ; for ( sI = 0 ; sI < ncI && passive ; sI ++ ) { if ( Pro . mapped ( cmpJ , sJ , cmpI , sI ) ) passive = false ; } if ( passive ) if ( qJb != qJk ) return false ; } return true ; }
This function checkes whether a particular element in a non-mutual exchange
superoperator may be non-zero.
This function checkes whether a particular element in a non - mutual exchange superoperator may be non - zero .
// Starting normalization // Flag if spin in exchange // Mz quantum numbers for sI // Mz quantum numbers for sJ // Spin indices // Number spins in braI // Number spins in braJ /* ----------------------------------------------------------------------------
   Before Calling This Function We Insured That Some Spins In Component cmpI
   Were In Exchange With Spins In Componet cmpJ. Any Spin sI In Component cmpI
   May Have At Most 1 Exchange Spin Partner, sJ, In Component cmpJ. Here We
   Loop Over All Spins sI In cmpI And Find Their Corresponding Spin In cmpJ,
   If Any. If Spin sI Has No Exchange Partner, It Cannot Change Spin States In
   The Basis Function Coherence, (<cmpI, mzsI| == |cmpI, mzsI|), Else The 
   Element Must Be Zero. If Spin sI Is Passive In The Exchange Then It Will
   Contribute To The Norm Of Any Exchange Matrix Element. Alternatively, If We
   Find An Exchanging Spin Pair We Insure That The Assosicated Mz States Are
   Swapped Or Else The Element Must Be Zero.
   --------------------------------------------------------------------------*/ // Loop spins in braI & ket I // (i.e. spins in component I) //   Assume spin sI passive //   Mz of spin sI in braI <i| //   Mz of spin sI in ketI |i> //   Loop spins in braJ & ket J //   (i.e. spins in compon. J) //     If partners in exchange //     cmpI sI <--> cmpJ sJ //        Mz spin sJ, braJ <j| //        Mz spin sJ, ketJ |j> //        Unequal quantum state //        element must be zero // If cmpI spin sI not exchange // with any spin in comp. cmpJ //   No element if not |m><m| //   Else a passive spin will //   contribute to norm factor  // ---------------------------------------------------------------------------- // At This Point We Know That For All Spins In Components cmpI And cmpJ This // Exchange Superoperator Element Has Properly Swapped Spin Quantum Numbers In // Its Two Basis Functions. We Have Also Set A Proper Normalization Factor. // ---------------------------------------------------------------------------- // Loop spins in braJ & ketJ // (i.e. spins in component J) //   Mz of spin sJ in braJ //   Mz of spin sJ in ketJ //   Assume spin sJ is passive //   Loop spins in braI & ketI //   (i.e. spins in comp I) //     See if sJ & sI exchange //     & flag non-passive if so //   If sJ is not exchanging, //   No element if not |m><m|