src/Bloch/BlochSys.cc
/* The spin system will be assumed to be weakly coupled! In this manner it is
   easier to determine which transitions are associated with which spins.    */
The spin system will be assumed to be weakly coupled. In this manner it is
easier to determine which transitions are associated with which spins.
The spin system will be assumed to be weakly coupled . In this manner it is easier to determine which transitions are associated with which spins .
BlochSys::BlochSys(const spin_system& sys, const RBasic& Rs)
  {
  int ns       = sys.spins();			
  if(!CheckSpins(ns, Rs.spins())) BSfatal(29);	
  gen_op H     = How(sys);			
  gen_op sigma = Fx(sys);			
  gen_op D;					
  double mag;					
  TTable1D TT;					
  int i,j,k;					
  std::vector<MagVec> Ms;				
  MagVec M;					
  int nc, NC=0;					
  for(i=0; i<ns; i++)				
    {
    D = Fm(sys, i);				
    acquire1D Acq(D, H);			
    TT = Acq.table(sigma);			
    nc = TT.size();				
    NC += nc;					
    M = MagVec(nc);				
    for(j=0; j<TT.size(); j++)			
      {
      Offsets.push_back(TT.Fr(j));		
      isotopes.push_back(sys.isotope(i));	
      R1rates.push_back(Rs.R1(i));		
      R2rates.push_back(Rs.R2(i));		
      mag = norm(TT.I(j));			
      M.put(mag, 3*j+2);			
      Spins.push_back(i);			
      }
    Ms.push_back(M);				
    }
  _M = MagVec(NC);				
  for(i=0, k=0; i<ns; i++)
    {
    nc = Ms[i].NComps();
    for(j=0; j<nc; j++, k++)
      _M.put(Ms[i].Mz(j), 3*k+2);
    }
  int nm  = Offsets.size();			
  int nex = (nm*nm-nm)/2;			
  Krates  = std::vector<double>  (nex, 0);		
  }
BlochSys :: BlochSys ( const spin_system & sys , const RBasic & Rs ) { int ns = sys . spins ( ) ; if ( ! CheckSpins ( ns , Rs . spins ( ) ) ) BSfatal ( 29 ) ; gen_op H = How ( sys ) ; gen_op sigma = Fx ( sys ) ; gen_op D ; double mag ; TTable1D TT ; int i , j , k ; std :: vector < MagVec > Ms ; MagVec M ; int nc , NC = 0 ; for ( i = 0 ; i < ns ; i ++ ) { D = Fm ( sys , i ) ; acquire1D Acq ( D , H ) ; TT = Acq . table ( sigma ) ; nc = TT . size ( ) ; NC += nc ; M = MagVec ( nc ) ; for ( j = 0 ; j < TT . size ( ) ; j ++ ) { Offsets . push_back ( TT . Fr ( j ) ) ; isotopes . push_back ( sys . isotope ( i ) ) ; R1rates . push_back ( Rs . R1 ( i ) ) ; R2rates . push_back ( Rs . R2 ( i ) ) ; mag = norm ( TT . I ( j ) ) ; M . put ( mag , 3 * j + 2 ) ; Spins . push_back ( i ) ; } Ms . push_back ( M ) ; } _M = MagVec ( NC ) ; for ( i = 0 , k = 0 ; i < ns ; i ++ ) { nc = Ms [ i ] . NComps ( ) ; for ( j = 0 ; j < nc ; j ++ , k ++ ) _M . put ( Ms [ i ] . Mz ( j ) , 3 * k + 2 ) ; } int nm = Offsets . size ( ) ; int nex = ( nm * nm - nm ) / 2 ; Krates = std :: vector < double > ( nex , 0 ) ; }
The spin system will be assumed to be weakly coupled!
The spin system will be assumed to be weakly coupled!
// Number of spins // Check spin count matches // Isotropic Hamiltonian // System total Fx operator // Detection operator // |M> intensity // Transitions table // Dummy indices // Vector of |M>s // Single vector |M> // Components  // Loop over all spins //   Detect F- spin i //   Set up acquisition //   Find all transitions   //   Number of transitions //   Total # of transitions //   Initialize |M> //   Loop transitions //     Set offset //     Set spin type //     Set R1 rate //     Set R2 rate //     Set norm //     Sub-vector @ (0,0,mag) //     Set spin // Store |M> this spin // Concatonated |M> // Number of mag. vectors // Number of exchange rates  // Array of exchange rates