src/Pulses/PulSinc.cc
/*
  Note that these use the symmetry and only calculate step Hamiltonians and
  propagators over half of the waveform.  That makes it faster than using 
  the functions which return Hamiltonian or Propagator arrays for all steps
  then summing/multiplying over them.                                        */
Note that these use the symmetry and only calculate step Hamiltonians and
propagators over half of the waveform.  That makes it faster than using
the functions which return Hamiltonian or Propagator arrays for all steps
then summing/multiplying over them.
Note that these use the symmetry and only calculate step Hamiltonians and propagators over half of the waveform . That makes it faster than using the functions which return Hamiltonian or Propagator arrays for all steps then summing / multiplying over them .
gen_op SincPulseU(gen_op& H0rot, gen_op& Fxy,
                                        int N, double ang, double tp, int node)
  {
  double dN = double(N);			
  double tdiv = tp/dN;				
  double gamB1 = SincGamB1(ang, tp, N, node);	
  row_vector Sinc = SincVect(gamB1, N, node);	
  Fxy.Op_base(H0rot);				
  double gB1 = Sinc.getRe(0);			
  gen_op H = H0rot + gB1*Fxy; 			
  gen_op Utlow = prop(H, tdiv);			
  gen_op Uthigh = Utlow;			
  gen_op U, Ustep;				
  int i;
  for(i=1; i<N-1-i; i++)			
    {						
    gB1 = Sinc.getRe(i);			
    H = H0rot + gB1*Fxy;			
    Ustep = prop(H, tdiv);			
    Utlow &= Ustep;				
    Uthigh *= Ustep;				
    }
  if(N == 1) U = Utlow;				
  else if(i == N-1-i)				
    {						
    gB1 = Sinc.getRe(i);			
    H = H0rot + gB1*Fxy;			
    U = prop(H,tdiv);				
    U *= Utlow;					
    U &= Uthigh;				
    }
  else U = Uthigh*Utlow;			
  return U;
  }
gen_op SincPulseU ( gen_op & H0rot , gen_op & Fxy , int N , double ang , double tp , int node ) { double dN = double ( N ) ; double tdiv = tp / dN ; double gamB1 = SincGamB1 ( ang , tp , N , node ) ; row_vector Sinc = SincVect ( gamB1 , N , node ) ; Fxy . Op_base ( H0rot ) ; double gB1 = Sinc . getRe ( 0 ) ; gen_op H = H0rot + gB1 * Fxy ; gen_op Utlow = prop ( H , tdiv ) ; gen_op Uthigh = Utlow ; gen_op U , Ustep ; int i ; for ( i = 1 ; i < N - 1 - i ; i ++ ) { gB1 = Sinc . getRe ( i ) ; H = H0rot + gB1 * Fxy ; Ustep = prop ( H , tdiv ) ; Utlow &= Ustep ; Uthigh *= Ustep ; } if ( N == 1 ) U = Utlow ; else if ( i == N - 1 - i ) { gB1 = Sinc . getRe ( i ) ; H = H0rot + gB1 * Fxy ; U = prop ( H , tdiv ) ; U *= Utlow ; U &= Uthigh ; } else U = Uthigh * Utlow ; return U ; }
Note that these use the symmetry and only calculate step Hamiltonians and
propagators over half of the waveform.
Note that these use the symmetry and only calculate step Hamiltonians and propagators over half of the waveform .
// Input        H0rot   : Static Hamiltonian * //              Fxy     : RF-Field Hamiltonian * //              N       : Number of Sinc steps //              ang     : Pulse rotation angle (degrees) //              tp      : Sinc pulse length (sec) //              node 	: Sinc function end node // Output       U       : Propagator for a Sinc pulse // Note                 : HOrot is the static Hamiltonian //                        in the rotating frame of the pulse. // Note                 : Fxy implicitly contains rf-pulse phase /*                      U     = U       * U     * U
                         Sinc    t>tp/2    tp/2    t<tp/2                    */ // Pulse steps // Inc. prop. time // Get field strength // Sinc RF intensities // Set Fxy basis for easy add // Field strength of 1st step // Total Ham., 1st step // Propagator for 1st step // Propagator for Nth step // Working propagators // Loop 1st half of Sinc // steps, symmetry for 2nd half // RF-field strength this step // Total Hamiltonian, this step // Prop. for this pulse step // Utlow = Ustep*Utlow // Uthigh = Uthigh*Ustep // For one step, U is 1st step // For odd number steps (odd N) // still need to do middle step // RF-field of middle step // Total Hamiltonian, this step // Prop. for middle step // Add in after earlier steps // Add later steps after middle // Even # steps(even N), this U