src/HSLib/SpinSystem.cc
/* This function attempts to determine the stataic external field strength, Bo.
   The following parameters are looked for in the input parameter set:

         Omega       - Proton Larmor frequency (MHz)
       * GOmega      - EPR base frequency      (GHz)
         Field       - Bo field strength       (Gauss)
         FieldT      - Bo Field strength       (Tesla)

   The * parameter is allowed only if there are electrons present in the spin
   system. If multiple spin systems are read in a program, i.e. the above
   parameters have a prefix [#], the prefix should be stripped from the pset
   prior to calling this function.


        // Input                sys	: A spin system (this)
        //                      pset    : A parameter set
        // Output               TF      : Spin system field strength
        //                                is set from parameter in pset
        //                                TRUE if set from pset, FALSE
        //                                if set to a default value
	// Note				: Assumes that the base class spin
	//				  system has already been read
	// Note				: Parameter Omega sets the frequency
	//				  based on 1H resonance (in MHz)
	// Note				: If electrons are present in the
	//				  system, GOmega (in GHz) is allowed 
	//				  for the e- base Larmor frequency  */
This function attempts to determine the stataic external field strength, Bo.
The following parameters are looked for in the input parameter set.

Omega       - Proton Larmor frequency (MHz)
GOmega      - EPR base frequency      (GHz)
Field       - Bo field strength       (Gauss)
FieldT      - Bo Field strength       (Tesla)

The * parameter is allowed only if there are electrons present in the spin
system. If multiple spin systems are read in a program, i.e. the above
parameters have a prefix [#], the prefix should be stripped from the pset
prior to calling this function.


This function attempts to determine the stataic external field strength Bo . The following parameters are looked for in the input parameter set . Omega - Proton Larmor frequency ( MHz ) GOmega - EPR base frequency ( GHz ) Field - Bo field strength ( Gauss ) FieldT - Bo Field strength ( Tesla ) The * parameter is allowed only if there are electrons present in the spin system . If multiple spin systems are read in a program i . e . the above parameters have a prefix [ # ] the prefix should be stripped from the pset prior to calling this function .
bool spin_system::setOm(const ParameterSet& pset)
  {
  double dval = 0;				
  std::string pstate, pname = "Omega";               
  bool Omegaf = false;				
  ParameterSet::const_iterator item;         
  item = pset.seek(pname);                      
  if(item != pset.end()) 			
    {						
    (*item).parse(pname,dval,pstate);		
    spectrometer_frequency(fabs(dval));		
    return true;				
    }
  if(!Omegaf && electrons()) 			
    {						
    pname = "GOmega";				
    item = pset.seek(pname);			
    if(item != pset.end())			
      {						
      (*item).parse(pname,dval,pstate);		
      Omega(fabs(dval)*1.e3, "e-");		
      return true;				
      }
    }
  if(!Omegaf) 					
    {						
    pname = "Field";				
    item = pset.seek(pname);			
    if(item != pset.end())			
      {						
      (*item).parse(pname,dval,pstate);		
      Omega(fabs(dval)*GAMMA1H*1.e-10/HZ2RAD);	
      return true;				
      }
    }
  if(!Omegaf) 					
    {						
    pname = "FieldT";				
    item = pset.seek(pname);			T
    if(item != pset.end())			
      {						
      (*item).parse(pname,dval,pstate);		
      Omega(fabs(dval)*GAMMA1H*1.e-6/HZ2RAD);	
      return true;				T
      }
    }
  if(!Omegaf)					
    {						
    spectrometer_frequency(DefOm);		
    if(warnings())				
      {						
      SYSTerror(2, "Omega", 1); 		
      if(electrons()) SYSTerror(2, pname, 1);	
      SYSTerror(103, Gform("%7.3f", DefOm));	
      } 
    }
  return Omegaf;
  }
bool spin_system :: setOm ( const ParameterSet & pset ) { double dval = 0 ; std :: string pstate , pname = " " ; bool Omegaf = false ; ParameterSet :: const_iterator item ; item = pset . seek ( pname ) ; if ( item != pset . end ( ) ) { ( * item ) . parse ( pname , dval , pstate ) ; spectrometer_frequency ( fabs ( dval ) ) ; return true ; } if ( ! Omegaf && electrons ( ) ) { pname = " " ; item = pset . seek ( pname ) ; if ( item != pset . end ( ) ) { ( * item ) . parse ( pname , dval , pstate ) ; Omega ( fabs ( dval ) * 1.e3 , " " ) ; return true ; } } if ( ! Omegaf ) { pname = " " ; item = pset . seek ( pname ) ; if ( item != pset . end ( ) ) { ( * item ) . parse ( pname , dval , pstate ) ; Omega ( fabs ( dval ) * GAMMA1H * 1.e-10 / HZ2RAD ) ; return true ; } } if ( ! Omegaf ) { pname = " " ; item = pset . seek ( pname ) ; if ( item != pset . end ( ) ) { ( * item ) . parse ( pname , dval , pstate ) ; Omega ( fabs ( dval ) * GAMMA1H * 1.e-6 / HZ2RAD ) ; return true ; } } if ( ! Omegaf ) { spectrometer_frequency ( DefOm ) ; if ( warnings ( ) ) { SYSTerror ( 2 , " " , 1 ) ; if ( electrons ( ) ) SYSTerror ( 2 , pname , 1 ) ; SYSTerror ( 103 , Gform ( " " , DefOm ) ) ; } } return Omegaf ; }
This function attempts to determine the stataic external field strength, Bo.
This function attempts to determine the stataic external field strength Bo .
// Default spec. freq. // Retrieve spect. frequency // Flag if read properly // A pix into parameter list // Pix in param. list for Omega // If Omega has been defined  // we'll parse the information // & set 1H based spectromter // frequency // Exit, we found Omega // If electrons present, also // allow Omega to be set in GHz // for e-.  Parameter GOmega // Pix in param. list for GOmega // If GOmega has been defined  // we'll parse the info and // set e- based spectrometer // Convert from GHz to MHz too // Exit, we found GOmega // We can try looking for a // field strength directly // This will be assumed in Gauss // Pix in param. list for Field // If Field has been defined  // we'll parse the info and // set field appropriately // using proton Larmor frequency // Exit, we found Field // Last, we'll try looking for // a field strength in Tesla // This will be assumed in Tesla // Pix in param. list for FieldT // If Field has been defined  // we'll parse the info and // set field appropriately // using proton Larmor frequency // Exit, we found FieldT // If we still haven't found a // defined field strength then // just set a default value // Output these warnings if we // want them...... // Can't read in Omega // Can't read in GOmega // Omega at 500 MHz (FALSE)