コード例 #1
0
ファイル: ddec4.c プロジェクト: timburrow/OpenVnmrJ
pulsesequence()
{
   settable(t1,4,phasecycle);
      dec3power(dpwr3); 
      diplexer_override(0);
      delay(d1);
      dec3rgpulse(pw, t1, rof1, rof2);
    setreceiver(t1);
}
コード例 #2
0
ファイル: hNCAnH_A.c プロジェクト: timburrow/OpenVnmrJ
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */

char    	 
        CA90_in_str[MAXSTR],     
  	CA180_in_str[MAXSTR],  CA180n_in_str[MAXSTR],       
        CO180offCA_in_str[MAXSTR],   
        RFpars[MAXSTR],       
        exp_mode[MAXSTR],         /* flag to run 3D, or 2D time-shared 15N TROSY /13C HSQC-SE*/   

	f1180[MAXSTR],   		                     /* Flag to start t1 @ halfdwell */
	f2180[MAXSTR],
	f3180[MAXSTR];			                           /* do TROSY on N15 and H1 */
 
int     icosel=1.0;      			                 /* used to get n and p type */
     

double  x,y,z, t2max, t1max, tpwrs,

        tpwrsf_d = getval("tpwrsf_d"), /* fine power adustment for first soft pulse(down)*/
        tpwrsf_u = getval("tpwrsf_u"), /* fine power adustment for second soft pulse(up) */
        pwHs = getval("pwHs"),                     /* H1 90 degree pulse length at tpwrs */
        compH =getval("compH"),

        tau1, tau2,                                 /*evolution times in indirect dimensions */
        ni2=getval("ni2"),

        tauNH=getval("tauNH"),                                     /* 1/(4Jhn), INEPTs, 2.4ms*/
        tauNH1=getval("tauNH1"),                           /* 1/(4Jhn), TROSY in CN CT, 2.7ms*/
        timeTN1=getval("timeTN1"),                   /* CT time for (first) N->CA*N transfer */
        timeTN=getval("timeTN"),                                /* CT time for last SE TROSY */ 
        timeCN=getval("timeCN"),                     /* CT time for CA -> N transfer, middle */
 
	pwClvl = getval("pwClvl"), 	       	               /* coarse power for C13 pulse */
	pwC = getval("pwC"),     	             /* C13 90 degree pulse length at pwClvl */
        compC = getval("compC"),
        dfrq = getval("dfrq"),
   	              
	pwNlvl = getval("pwNlvl"),	                            /* power for N15 pulses */
        pwN = getval("pwN"),                        /* N15 90 degree pulse length at pwNlvl */
        
	gstab = getval("gstab"),
	g6bal= getval("g6bal"),  
	                         /* balance of the decoding gradient around last 180 pulse on 1H
			        g6bal=1.0 : full g6 is on the right side of the last pw180 on 1H
			        g6bal=0.0:  full g6 is on the left side*/

  	gt0 = getval("gt0"),     
        gt1 = getval("gt1"),
        gt2 = getval("gt2"),
 	gt3 = getval("gt3"),
	gt4 = getval("gt4"),
	gt5 = getval("gt5"),
        gt6 = getval("gt6"),
 	gt7 = getval("gt7"),

	gzlvl0 = getval("gzlvl0"),
	gzlvl1 = getval("gzlvl1"),
	gzlvl2 = getval("gzlvl2"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),	
        gzlvl6 = getval("gzlvl6"),
	gzlvl7 = getval("gzlvl7"),
        gzlvl11 = getval("gzlvl11");

    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("exp_mode",exp_mode);
        
    tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));          /*needs 1.69 times more*/
    tpwrs = (int) (tpwrs);                               /*power than a square pulse */
    if (tpwrsf_d<4095.0)
        tpwrs=tpwrs+6.0;  /* add 6dB to let tpwrsf_d control fine power ~2048*/

/*   LOAD PHASE TABLE    */
	
        
        settable(t1,1,phi1);

        settable(t2,4,phi2);                                        /* default double trosy */
	  if (exp_mode[A] == 'h') {settable(t2,4,phi2h);};      /*option for regular hNcaNH */
                
        settable(t3,4,phi3);
        settable(t4,8,phi4);
        settable(t5,2,phi5);
        settable(t6,4,phi6);
        settable(t7,4,phi7);
        settable(t8,4,phi8);
	settable(t21,1,psi1);                          /*trosy and SE hsqc in reverse INPET */
	settable(t22,1,psi2);
        settable(t23,1,psi2c);  
        settable(t31,8,rec); 

/* some checks */

 if((dm2[A] == 'y') || (dm2[B] == 'y') || (dm2[C] == 'y') || (dm2[D] == 'y'))
  { text_error("incorrect dec2 decoupler flags! Should be 'nnnn' "); psg_abort(1); }

     if ( dm3[A] == 'y' || dm3[C] == 'y' )
       { printf("incorrect dec3 decoupler flags! Should be 'nyn' or 'nnn' ");
							             psg_abort(1);}	
    if ( dpwr3 > 56 )
       { printf("dpwr3 too large! recheck value  "); psg_abort(1);}

    if ( (dm3[B] == 'y' )  && (timeCN*2.0 > 60.0e-3) )
       { printf("too lond time for 2H decoupling, SOL ");psg_abort(1);}


/*   INITIALIZE VARIABLES   */
  if(FIRST_FID)                                                          /* call Pbox */
    {
     getstr("CA180_in_str",CA180_in_str);  getstr("CA180n_in_str",CA180n_in_str);
     getstr("CA90_in_str",CA90_in_str);    getstr("CO180offCA_in_str",CO180offCA_in_str);

     strcpy(RFpars,             "-stepsize 0.5 -attn i");

     CA180 =  pbox("et_CA180_auto", CA180_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CA180n = pbox("et_CA180n_auto", CA180n_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CA90  =  pbox("et_CA90_auto", CA90_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CO180offCA = pbox("et_CO180offCA_auto", CO180offCA_in_str, RFpars, dfrq, compC*pwC, pwClvl);
    };


 /*  Phase incrementation for hypercomplex 2D data, States-Haberkorn element */

   /* t1 , N15 */
    if (phase1 == 2)  {tsadd(t2 ,1,4);}
    if(d2_index % 2)  {tsadd(t2,2,4); tsadd(t31,2,4); }  
   
   
/* setting up semi-CT on t1 (ni) dimension */
    tau1  = d2; 
    t1max=(ni-1.0)/sw1;
  
    if((f1180[A] == 'y') && (ni > 0.0)) 
          {tau1 +=  0.5/sw1 ; t1max+= 0.5/sw1; }  

    if( t1max < timeTN1*2.0) {t1max=2.0*timeTN1;}; 
                            /* if not enough  ni increments, then just regular CT in t1/ni CN */
   /* t2, CA  */

      if  (phase2 == 2)    { tsadd(t3,1,4); }	 
      if (d3_index % 2)    { tsadd(t3,2,4);  tsadd(t31,2,4); }   

/* setup  constant time in t2 (ni2) */
    tau2 = d3;  
    t2max=2.0*(timeCN - CO180offCA.pw);

    if((f2180[A] == 'y') && (ni2 > 0.0)) 
          {tau2 +=  0.5/sw2 ; t2max +=  0.5/sw2 ;}

    if(tau2 < 0.2e-6) {tau2 = 0.0;}


    if ( (ni2-1.0)/sw2 > t2max) 
       { text_error("too  many ni2 increments in t2 !  "); psg_abort(1); }
     
  if(FIRST_FID)                                            
        {
             printf("t1max is %f\n",t1max);
	     printf("t2max is %f\n",t2max);
        };
   

/* BEGIN PULSE SEQUENCE */

status(A);

	obspower(tpwr);
	decpower(pwClvl);
	dec2power(pwNlvl);

	txphase(zero);
        decphase(zero);
        dec2phase(zero);

        delay(d1);
        zgradpulse(gzlvl2, gt2);
	delay(gstab*3.0);

 if (exp_mode[B]=='n') dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);     /* test for steady-state 15N */
		
       /* Hz -> HzXz INEPT */

   	rgpulse(pw,zero,rof1,rof1);                              /* 1H pulse excitation */
 
        zgradpulse(gzlvl0, gt0);
	delay(tauNH -gt0);

   	sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);

   	delay(tauNH - gt0 -gstab);
	zgradpulse(gzlvl0, gt0);
	delay(gstab);

 	rgpulse(pw, t6, rof1, rof1);

       /* on HzNz now */
      /* water flipback*/

        obspower(tpwrs); obspwrf(tpwrsf_u);
 	shaped_pulse("H2Osinc",pwHs,zero,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0);

       /* purge */
       
	zgradpulse(gzlvl3, gt3);
        dec2phase(t2);
	
	delay(gstab*2.0);
        
/*  HzNz -> NzCAz  +t1 evolution*/

	dec2rgpulse(pwN, t2, 0.0, 0.0);

      /* double-trosy hNcaNH */
	
	delay(tauNH1  -pwHs-4.0*rof1 -pw  
               -2.0*POWER_DELAY -WFG_STOP_DELAY-WFG_START_DELAY);            
        obspower(tpwrs); obspwrf(tpwrsf_d);
 	shaped_pulse("H2Osinc",pwHs,two,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0); 
        rgpulse(pw, zero, rof1, rof1);   
        rgpulse(pw, t7, rof1, rof1);
        obspower(tpwrs); obspwrf(tpwrsf_u);
 	shaped_pulse("H2Osinc",pwHs,t8,rof1,rof1);
	obspower(tpwr);  obspwrf(4095.0);         		
        dec_c13_shpulse(CO180offCA,zero);  
        delay(tau1*0.5);
	dec_c13_shpulse(CO180offCA,zero); dec2phase(zero);

       	delay( timeTN1 -tauNH1 -pwHs  -4.0*rof1 -pw  -2.0*POWER_DELAY
               -WFG_STOP_DELAY -WFG_START_DELAY -CA180.pw -2.0*CO180offCA.pw 
               -3.0*(2.0*POWER_DELAY +WFG_STOP_DELAY +WFG_START_DELAY)); 
                       
	dec_c13_shpulse(CA180,zero);
	delay(tau1*0.5 -timeTN1*tau1/t1max); 
        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);      
	delay( timeTN1 -tau1*timeTN1/t1max);
       	dec2rgpulse(pwN, zero, 0.0, 0.0);

/*   on CAzNz now */

/* purge */
       zgradpulse(gzlvl7, gt7);
       delay(gstab);	

       if(dm3[B] == 'y')
        {  dec3unblank();
           if(1.0/dmf3>900.0e-6)
            {
	     dec3power(dpwr3+6.0);
	     dec3rgpulse(0.5/dmf3, one, 1.0e-6, 0.0e-6);
	     dec3power(dpwr3);
	    }
           else 
            dec3rgpulse(1.0/dmf3, one, 1.0e-6,0.0e-6);
  	    dec3phase(zero);      
            setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
        }	

	/* dec_c13_shpulse(CA90,t3);*/
        
        /* t2 time, CA evolution */
	decrgpulse(pwC,t3,0.0,0.0);
	decphase(zero);
        delay(0.5*(timeCN+tau2*0.5-CO180offCA.pw)  );
        dec_c13_shpulse(CO180offCA,zero);  
        delay(0.5*(timeCN+tau2*0.5-CO180offCA.pw)  -pwN*2.0 + WFG_STOP_DELAY);

        if (exp_mode[A]=='R')  /* test CA.N relaxation rate  */
           {
	    delay(2.0*pwN);
           } 
        else
           dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
	
	dec_c13_shpulse(CA180n,zero);
        delay(0.5*(timeCN-tau2*0.5-CO180offCA.pw)  );
        dec_c13_shpulse(CO180offCA,zero);  
        delay(0.5*(timeCN-tau2*0.5-CO180offCA.pw) + WFG_START_DELAY);

	/*dec_c13_shpulse(CA90,zero);*/

	decrgpulse(pwC,zero,0.0,0.0);
 

 	if(dm3[B] == 'y') 
         {                     
	  setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);                  
	  if(1.0/dmf3>900.0e-6)
           {
	    dec3power(dpwr3+6.0);
	    dec3rgpulse(0.5/dmf3, three, 1.0e-6, 0.0e-6);
	    dec3power(dpwr3);
	   }
	  else 
           dec3rgpulse(1.0/dmf3, three, 1.0e-6, 0.0e-6);
           dec3blank();
           delay(PRG_START_DELAY);
         }

       zgradpulse(gzlvl5, gt5);
	dec2phase(t4);
       delay(gstab);	

       /*    CaN->N + back to NH */

   	dec2rgpulse(pwN, t4, 0.0, 0.0);
        dec2phase(zero);
        delay(timeTN);
	dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);     
        dec_c13_shpulse(CA180,zero);
        delay(timeTN - CA180.pw   -gt4-gstab -pwHs-3.0*rof1
             -4.0*POWER_DELAY -2.0*WFG_STOP_DELAY-2.0*WFG_START_DELAY
             -2.0*GRADIENT_DELAY
             +4.0*pwN/3.1415-pw);
       zgradpulse(gzlvl4, gt4);
       delay(gstab);	  
    
       /*Water flipback (flipdown actually ) */
        obspower(tpwrs); obspwrf(tpwrsf_d);                         
 	shaped_pulse("H2Osinc",pwHs,three,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0);  
 
/* reverse double INEPT */


/* 90 */  
   rgpulse(pw, t21, rof1, rof1);  
   zgradpulse(gzlvl11, gt1);		       
   delay(tauNH  -gt1 -rof1 
        -CA180.pw -2.0*POWER_DELAY - WFG_STOP_DELAY- WFG_START_DELAY );        
   dec_c13_shpulse(CA180,zero);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   delay(tauNH  - gt1 -gstab);
   zgradpulse(gzlvl11, gt1);		 
   delay(gstab);

 /* 90 */ 

   sim3pulse(pw, 0.0, pwN, one, zero, zero, 0.0, 0.0);
   zgradpulse(gzlvl1, gt1);		 
   delay(tauNH  -gt1);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   delay(tauNH -POWER_DELAY  -gt1- gstab);
   zgradpulse(gzlvl1, gt1);
   dec2phase(t22);		 
   delay(gstab);      
   sim3pulse(0.0,0.0, pwN, one, zero, t22, 0.0, 0.0);  
   zgradpulse(-(1.0-g6bal)*gzlvl6*icosel, gt6);                 /* 2.0*GRADIENT_DELAY */
   delay( gstab   -pwN*0.5 +pw*(2.0/3.1415-0.5) );
   rgpulse(2.0*pw, zero, rof1, rof1);
   dec2power(dpwr2); decpower(dpwr);			      
   zgradpulse(g6bal*gzlvl6*icosel, gt6);		        /* 2.0*GRADIENT_DELAY */
   delay(gstab +2.0*POWER_DELAY );
   status(C);
	setreceiver(t31);
}	 
コード例 #3
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            f3180[MAXSTR],    /* Flag to start t3 @ halfdwell             */
            fco180[MAXSTR],    /* Flag for checking sequence              */
            fca180[MAXSTR],    /* Flag for checking sequence              */
            spca180[MAXSTR],  /* string for the waveform Ca 180 */
            spco180[MAXSTR],  /* string for the waveform Co 180 */
            spchirp[MAXSTR],  /* string for the waveform reburp 180 */
            ddseq[MAXSTR],    /* 2H decoupling seqfile */
            shp_sl[MAXSTR],   /* string for seduce shape */
            sel_flg[MAXSTR];

 int         phase, phase2, phase3, ni2, ni3, icosel,
             t1_counter,   /* used for states tppi in t1           */ 
             t2_counter,   /* used for states tppi in t2           */ 
             t3_counter;   /* used for states tppi in t3           */ 

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             tau3,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             taub,         /*  ~ 1/4JNH =  2.25 ms */
             zeta,        /* time for C'-N to refocuss set to 0.5*24.0 ms */
             bigTN,       /* nitrogen T period */
             pwc90,       /* PW90 for c nucleus @ d_c90         */
             pwc180on,    /* PW180 at @ d_c180         */
             pwchirp,     /* PW180 for ca nucleus @ d_creb         */
             pwc180off,     /* PW180 at d_c180 + pad              */
             tsatpwr,     /* low level 1H trans.power for presat  */
             d_c90,       /* power level for 13C pulses(pwc90 = sqrt(15)/4delta)
                             delta is the separation between Ca and Co  */
             d_c180,      /* power level for 180 13C pulses
				(pwc180on=sqrt(3)/2delta   */
	     d_chirp,
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             sw3,          /* sweep width in f3                    */             
             pw_sl,        /* pw90 for H selective pulse on water ~ 2ms */
             phase_sl,     /* phase for pw_sl */
             tpwrsl,       /* power level for square pw_sl       */

	     pwDlvl,	   /* Power for D decoupling */
	     pwD,	   /* pw90 at pwDlvl  */

	     pwC, pwClvl,  /* C-13 calibration */
	     compC, 

             pwN,         /* PW90 for 15N pulse              */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */

             gstab,       /* delay to compensate for gradient gt5 */

             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gt9,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7, 
             gzlvl8, 
             gzlvl9; 

/* LOAD VARIABLES */


  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("fco180",fco180);
  getstr("fca180",fca180);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("f3180",f3180);
  getstr("fscuba",fscuba);
  getstr("ddseq",ddseq);
  getstr("shp_sl",shp_sl);

  getstr("sel_flg",sel_flg);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  zeta  = getval("zeta");
  bigTN = getval("bigTN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  pwN = getval("pwN");
  pwNlvl = getval("pwNlvl");
  pwD = getval("pwD");
  pwDlvl = getval("pwDlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  phase3 = (int) ( getval("phase3") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  sw3 = getval("sw3");
  ni2 = getval("ni2");
  ni3 = getval("ni3");
  pw_sl = getval("pw_sl");
  phase_sl = getval("phase_sl");
  tpwrsl = getval("tpwrsl");

  gstab = getval("gstab");

  gt1 = getval("gt1");
  if (getval("gt2") > 0) gt2=getval("gt2");
    else gt2=gt1*0.1;
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  gt9 = getval("gt9");

  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl8 = getval("gzlvl8");
  gzlvl9 = getval("gzlvl9");

  if(autocal[0]=='n')
  {     
    getstr("spca180",spca180);
    getstr("spco180",spco180);
    getstr("spchirp",spchirp);
    pwc90 = getval("pwc90");
    pwc180on = getval("pwc180on");
    pwc180off = getval("pwc180off");
    d_c90 = getval("d_c90");
    d_c180 = getval("d_c180");
    pwchirp = getval("pwchirp");
    d_chirp = getval("d_chirp");    
  }
  else
  {    
    strcpy(spca180,"Phard180ca");
    strcpy(spco180,"Phard180co");    
    strcpy(spchirp,"Pchirp180");    
    
    if (FIRST_FID)
    {
      pwC = getval("pwC");
      compC = getval("compC");
      pwClvl = getval("pwClvl");
      co90 = pbox("cal", CO90, CO180ps, dfrq, pwC*compC, pwClvl);          
      co180 = pbox("cal", CO180, CO180ps, dfrq, pwC*compC, pwClvl);          
      ca180 = pbox(spca180, CA180, CA180ps, dfrq, pwC*compC, pwClvl);  
      co180a = pbox(spco180, CO180a, CA180ps, dfrq, pwC*compC, pwClvl);                        
      chirp = pbox(spchirp, CHIRP, CHIRPps, dfrq, pwC*compC, pwClvl);
    }
    pwc90 = co90.pw;         d_c90 = co90.pwr;
    pwc180on = co180.pw;     d_c180 = co180.pwr;    
    pwc180off = ca180.pw;            
    pwchirp = chirp.pw;      d_chirp = chirp.pwr;    
  }   

/* LOAD PHASE TABLE */

  settable(t1,2,phi1);
  settable(t2,2,phi2);
  settable(t3,4,phi3);
  settable(t4,1,phi4);
  settable(t5,4,phi5);
  settable(t6,4,rec);

/* CHECK VALIDITY OF PARAMETER RANGES */


    if( bigTN - (ni3-1)*0.5/sw3 - WFG3_START_DELAY < 0.2e-6 )
    {
        text_error(" ni3 is too big\n");
        text_error(" please set ni3 smaller or equal to %d\n",
			(int) ((bigTN -WFG3_START_DELAY)*sw3*2.0) +1 );
        psg_abort(1);
    }


    if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y' || dm[D] == 'y' ))
    {
        text_error("incorrect dec1 decoupler flags!  ");
        psg_abort(1);
    }

    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y' || dm2[D] == 'y'))
    {
        text_error("incorrect dec2 decoupler flags! Should be 'nnnn' ");
        psg_abort(1);
    }


    if( tsatpwr > 6 )
    {
        text_error("TSATPWR too large !!!  ");
        psg_abort(1);
    }

    if( dpwr > 46 )
    {
        text_error("don't fry the probe, DPWR too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > 46 )
    {
        text_error("don't fry the probe, DPWR2 too large!  ");
        psg_abort(1);
    }

    if( dpwr3 > 50 )
    {
        text_error("don't fry the probe, dpwr3 too large!  ");
        psg_abort(1);
    }

    if( d_c90 > 62 )
    {
        text_error("don't fry the probe, DHPWR too large!  ");
        psg_abort(1);
    }

    if( pw > 200.0e-6 )
    {
        text_error("dont fry the probe, pw too high ! ");
        psg_abort(1);
    } 
    if( pwN > 200.0e-6 )
    {
        text_error("dont fry the probe, pwN too high ! ");
        psg_abort(1);
    } 
    if( pwc90 > 200.0e-6 )
    {
        text_error("dont fry the probe, pwc90 too high ! ");
        psg_abort(1);
    } 
    if( pwc180off > 200.0e-6 )
    {
        text_error("dont fry the probe, pwc180 too high ! ");
        psg_abort(1);
    } 

    if( gt3 > 2.5e-3 ) 
    {
        text_error("gt3 is too long\n");
        psg_abort(1);
    }
    if( gt1 > 10.0e-3 || gt2 > 10.0e-3 || gt4 > 10.0e-3 || gt5 > 10.0e-3
        || gt6 > 10.0e-3 || gt7 > 10.0e-3 || gt8 > 10.0e-3
	|| gt9 > 10.0e-3)
    {
        text_error("gt values are too long. Must be < 10.0e-3 or gt11=50us\n");
        psg_abort(1);
    } 

    if((fca180[A] == 'y') && (ni2 > 1))
    {
        text_error("must set fca180='n' to allow Calfa evolution (ni2>1)\n");
        psg_abort(1);
    } 

    if((fco180[A] == 'y') && (ni > 1))
    {
        text_error("must set fco180='n' to allow CO evolution (ni>1)\n");
        psg_abort(1);
    } 


/*  Phase incrementation for hypercomplex 2D data */

    if (phase == 2) tsadd(t1,1,4);

    if (phase2 == 2) tsadd(t5,1,4);

    if (phase3 == 2) { tsadd(t4, 2, 4); icosel = 1; }
      else icosel = -1;

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    if((f1180[A] == 'y') && (ni > 1)) {
      if (pwc180off > 2.0*pwN) 
        tau1 += (1.0/(2.0*sw1) - 4.0*pwc90/PI - pwc180off 
	      - WFG3_START_DELAY - WFG3_STOP_DELAY - 4.0e-6 - 2.0*POWER_DELAY - 4.0e-6);
      else 
        tau1 += (1.0/(2.0*sw1) - 4.0*pwc90/PI - 2.0*pwN 
              - WFG3_START_DELAY - WFG3_STOP_DELAY - 4.0e-6 - 2.0*POWER_DELAY - 4.0e-6);

        if(tau1 < 0.2e-6) {
         tau1 = 0.4e-6;
	 text_error("tau1 could be negative");
	}
    }
    else
    {

      if (pwc180off > 2.0*pwN)
        tau1 = tau1 - 4.0*pwc90/PI - pwc180off
              - WFG3_START_DELAY - WFG3_STOP_DELAY - 4.0e-6 - 2.0*POWER_DELAY - 4.0e-6;
      else
        tau1 = tau1 - 4.0*pwc90/PI - 2.0*pwN 
              - WFG3_START_DELAY - WFG3_STOP_DELAY - 4.0e-6 - 2.0*POWER_DELAY - 4.0e-6;
 
        if(tau1 < 0.2e-6) tau1 = 0.4e-6;
     }

        tau1 = tau1/2.0;

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if((f2180[A] == 'y') && (ni2 > 1)) {
	if (pwc180off > 2.0*pwN)
          tau2 += ( 1.0 / (2.0*sw2) - 4.0*pwc90/PI - 4.0e-6
		 - 2.0*POWER_DELAY
		 - WFG3_START_DELAY - pwc180off - WFG3_STOP_DELAY - 4.0e-6);
	else
          tau2 += ( 1.0 / (2.0*sw2) - 4.0*pwc90/PI - 4.0e-6
                 - 2.0*POWER_DELAY
                 - WFG3_START_DELAY - 2.0*pwN - WFG3_STOP_DELAY - 4.0e-6);
        if(tau2 < 0.2e-6) {
	  tau2 = 0.4e-6;
	  text_error("tau2 could be negative");
 	} 

    }
    else
    {
        if (pwc180off > 2.0*pwN)
          tau2 = tau2 - 4.0*pwc90/PI - 4.0e-6
                 - 2.0*POWER_DELAY
                 - WFG3_START_DELAY - pwc180off - WFG3_STOP_DELAY - 4.0e-6;
        else
          tau2 = tau2 - 4.0*pwc90/PI - 4.0e-6
                 - 2.0*POWER_DELAY
                 - WFG3_START_DELAY - 2.0*pwN - WFG3_STOP_DELAY - 4.0e-6;
        if(tau2 < 0.2e-6) tau2 = 0.4e-6;
    }

        tau2 = tau2/2.0;

/*  Set up f3180  tau3 = t3               */
 
    tau3 = d4;
    if ((f3180[A] == 'y') && (ni3 > 1)) {
        tau3 += ( 1.0 / (2.0*sw3) );
        if(tau3 < 0.2e-6) tau3 = 0.4e-6;
    }
        tau3 = tau3/2.0;

/* Calculate modifications to phases for States-TPPI acquisition          */

   if( ix == 1) d2_init = d2 ;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) {
      tsadd(t1,2,4);     
      tsadd(t6,2,4);    
    }

   if( ix == 1) d3_init = d3 ;
   t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );
   if(t2_counter % 2) {
      tsadd(t5,2,4);
      tsadd(t6,2,4);
    }

   if( ix == 1) d4_init = d4 ;
   t3_counter = (int) ( (d4-d4_init)*sw3 + 0.5 );
   if(t3_counter % 2) {
      tsadd(t2,2,4);  
      tsadd(t6,2,4);    
    }

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obsoffset(tof);
   decoffset(dof);		/* set Dec1 carrier at Co		      */
   obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
   decpower(d_chirp);      /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */

/* Presaturation Period */

   if (fsat[0] == 'y')
     {
      delay(2.0e-5);
      rgpulse(d1,zero,2.0e-6,2.0e-6); /* presaturation */
      obspower(tpwr);      /* Set transmitter power for hard 1H pulses */
      delay(2.0e-5);
      if (fscuba[0] == 'y')
        {
         delay(2.2e-2);
         rgpulse(pw,zero,2.0e-6,0.0);
         rgpulse(2*pw,one,2.0e-6,0.0);
         rgpulse(pw,zero,2.0e-6,0.0);
         delay(2.2e-2);
        }
     }
    else
     {
      delay(d1);
     }

   obspower(tpwr);           /* Set transmitter power for hard 1H pulses */
   txphase(zero);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

   rcvroff();
   lk_hold();
   delay(20.0e-6);

   initval(1.0,v2);
   obsstepsize(phase_sl);
   xmtrphase(v2);

   /* shaped pulse */
   obspower(tpwrsl);
   shaped_pulse(shp_sl,pw_sl,one,4.0e-6,0.0);
   xmtrphase(zero);
   obspower(tpwr);  txphase(zero);  
   delay(4.0e-6);
   /* shaped pulse */

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */

   delay(0.2e-6);
   zgradpulse(gzlvl5,gt5);
   delay(2.0e-6);

   delay(taua - gt5 - 2.2e-6);   /* taua <= 1/4JNH */ 

   sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);

   txphase(three); dec2phase(zero); decphase(zero); 

   delay(0.2e-6);
   zgradpulse(gzlvl5,gt5);
   delay(200.0e-6);

   delay(taua - gt5 - 200.2e-6 - 2.0e-6); 

   if (sel_flg[A] == 'n') 
     {
      rgpulse(pw,three,2.0e-6,0.0);

      delay(0.2e-6);
      zgradpulse(gzlvl3,gt3);
      delay(200.0e-6);

      dec2rgpulse(pwN,zero,0.0,0.0);

      delay( zeta );
  
      dec2rgpulse(2.0*pwN,zero,0.0,0.0);
      decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

      delay(zeta -WFG_START_DELAY -pwchirp -WFG_STOP_DELAY -2.0e-6);

     dec2rgpulse(pwN,zero,2.0e-6,0.0);

    }
   else 
    {
     rgpulse(pw,one,2.0e-6,0.0);

     initval(1.0,v3);
     dec2stepsize(45.0); 
     dcplr2phase(v3);

     delay(0.2e-6);
     zgradpulse(gzlvl3,gt3);
     delay(200.0e-6);

     dec2rgpulse(pwN,zero,0.0,0.0);
     dcplr2phase(zero);

     delay(1.34e-3 - SAPS_DELAY - 2.0*pw);

     rgpulse(pw,one,0.0,0.0);
     rgpulse(2.0*pw,zero,0.0,0.0);
     rgpulse(pw,one,0.0,0.0);

     delay( zeta - 1.34e-3 - 2.0*pw);
  
     dec2rgpulse(2.0*pwN,zero,0.0,0.0);
     decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

     delay(zeta -WFG_START_DELAY -pwchirp -WFG_STOP_DELAY -2.0e-6);

     dec2rgpulse(pwN,zero,2.0e-6,0.0);
    }

   dec2phase(zero); decphase(t1);
   decpower(d_c90);

   delay(0.2e-6);
   zgradpulse(gzlvl8,gt8);
   delay(200.0e-6);

   decrgpulse(pwc90,t1,2.0e-6,0.0);
/* t1 period for Co evolution begins */
   if (fco180[A]=='n')  
     {
      decpower(d_c180);

      delay(tau1);
      sim3shaped_pulse("",spca180,"",0.0,pwc180off,2.0*pwN,zero,zero,zero,4.0e-6,0.0);

      decpower(d_c90);

       delay(tau1);
     }
   else /* for checking sequence */
     {
      decpower(d_c180);
      decrgpulse(pwc180on,zero,4.0e-6,0.0);
      decpower(d_c90);
     }
/* t1 period for Co evolution ends */
   decrgpulse(pwc90,zero,4.0e-6,0.0);

   decoffset(dof-(174-56)*dfrq);   /* change Dec1 carrier to Ca (55 ppm) */
   delay(0.2e-6);
   zgradpulse(gzlvl4,gt4);
   delay(150.0e-6);

   /* Turn on D decoupling using the third decoupler */
   dec3phase(one);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3power(dpwr3);
   dec3unblank();
   setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
   /* Turn on D decoupling */

   decrgpulse(pwc90,t5,2.0e-6,0.0);
/* t2 period  for Ca evolution begins */
  if (fca180[A]=='n')
    {
     decphase(zero); dec2phase(zero);
     decpower(d_c180); 
     delay(tau2);
     sim3shaped_pulse("",spco180,"",0.0,pwc180off,2.0*pwN,zero,zero,zero,4.0e-6,0.0);
     decpower(d_c90); 
     delay(tau2);
    }
   else /* for checking sequence */
    {
     decpower(d_c180);
     decrgpulse(pwc180on,zero,4.0e-6,0.0);
     decpower(d_c90);
    }
/* t2 period  for Ca evolution ends */
   decrgpulse(pwc90,zero,4.0e-6,0.0);
 
   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank();
   dec3phase(three);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

   decoffset(dof);   /* set carrier back to Co */
   decpower(d_chirp);

   delay(0.2e-6);
   zgradpulse(gzlvl9,gt9);
   delay(150.0e-6);

/* t3 period begins */
   dec2rgpulse(pwN,t2,2.0e-6,0.0);

   dec2phase(t3);

   delay(bigTN - tau3);

   dec2rgpulse(2.0*pwN,t3,0.0,0.0);
   decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

   txphase(zero);
   dec2phase(t4);

   delay(0.2e-6);
   zgradpulse(gzlvl1,gt1);
   delay(500.0e-6);

   delay(bigTN - WFG_START_DELAY - pwchirp - WFG_STOP_DELAY
         -gt1 -500.2e-6 -2.0*GRADIENT_DELAY);

   delay(tau3);

   sim3pulse(pw,0.0e-6,pwN,zero,zero,t4,0.0,0.0);
/* t3 period ends */

   decpower(d_c90);
   decrgpulse(pwc90,zero,4.0e-6,0.0);
   decoffset(dof-(174-56)*dfrq);
   decrgpulse(pwc90,zero,20.0e-6,0.0);

   delay(0.2e-6);
   zgradpulse(gzlvl6,gt6);
   delay(2.0e-6);

   dec2phase(zero);
   delay(taub - POWER_DELAY - 4.0e-6 - pwc90 - 20.0e-6 - pwc90 - gt6 - 2.2e-6);

   sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);

   decoffset(dof);
   delay(0.2e-6);
   zgradpulse(gzlvl6,gt6);
   delay(200.0e-6);
   
   txphase(one);
   dec2phase(one);

   delay(taub - gt6 - 200.2e-6);

   sim3pulse(pw,0.0e-6,pwN,one,zero,one,0.0,0.0);

   delay(0.2e-6);
   zgradpulse(gzlvl7,gt7);
   delay(2.0e-6);
 
   txphase(zero);
   dec2phase(zero);

   delay(taub - gt7 - 2.2e-6);

   sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);

   delay(0.2e-6);
   zgradpulse(gzlvl7,gt7);
   delay(200.0e-6);

   delay(taub - gt7 - 200.2e-6);

   sim3pulse(pw,0.0e-6,pwN,zero,zero,zero,0.0,0.0);

   delay(gt2 +gstab -0.5*(pwN -pw) -2.0*pw/PI);

   rgpulse(2*pw,zero,0.0,0.0);

   delay(2.0e-6);
   zgradpulse(icosel*gzlvl2,gt2);
   decpower(dpwr);
   dec2power(dpwr2);
   delay(gstab -2.0e-6 -2.0*GRADIENT_DELAY -2.0*POWER_DELAY);

   lk_sample();
/* BEGIN ACQUISITION */
status(C);
   setreceiver(t6);

}
コード例 #4
0
ファイル: hmcmcgcbcaA.c プロジェクト: timburrow/OpenVnmrJ
pulsesequence()
{
/* DECLARE VARIABLES */

 char       fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            C_flg[MAXSTR],
            dtt_flg[MAXSTR];

 int         phase, phase2, ni, ni2, 
             t1_counter,   /* used for states tppi in t1           */ 
             t2_counter;   /* used for states tppi in t2           */ 

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JHC =  1.6 ms */
             taub,         /*    1/6JCH =   1.1 ms  */
             BigTC,        /* Carbon constant time period = 1/4Jcc = 7.0 ms */ 
             BigTC1,       /* Carbon constant time period2 < 1/4Jcc to account for relaxation */ 
             pwN,          /* PW90 for 15N pulse @ pwNlvl           */
             pwC,          /* PW90 for c nucleus @ pwClvl         */
             pwcrb180,      /* PW180 for C 180 reburp @ rfrb */
             pwClvl,        /* power level for 13C pulses on dec1  */
             compC, compH,  /* compression factors for H1 and C13 amps */
	     rfrb,       /* power level for 13C reburp pulse     */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             tofps,        /* tof for presat                       */ 

	     gt0,
             gt1,
             gt2,
             gt3,
             gt4,

             gstab,
             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
        
             decstep1,
             bw, ofs, ppm,

             pwd1,
             dpwr3_D,
             pwd,
             tpwrs,
             pwHs, 
             dof_me,
             
             tof_dtt,
             tpwrs1,
             pwHs1,

             dpwrsed,
             pwsed,
             dressed,
              
             rfrb_cg,
             pwrb_cg; 
             
   
/* LOAD VARIABLES */

  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("fscuba",fscuba);

  getstr("C_flg",C_flg);
  getstr("dtt_flg",dtt_flg); 

  tofps  = getval("tofps");
  taua   = getval("taua"); 
  taub   = getval("taub"); 
  BigTC  = getval("BigTC");
  BigTC1 = getval("BigTC1");
  pwC = getval("pwC");
  pwcrb180 = getval("pwcrb180");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  pwClvl = getval("pwClvl");
  compC = getval("compC");
  compH = getval("compH");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni = getval("ni");
  ni2 = getval("ni2");

  gt0 = getval("gt0");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
 
  gstab = getval("gstab");
  gzlvl0 = getval("gzlvl0");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
 
  decstep1 = getval("decstep1");

  pwd1 = getval("pwd1");
  dpwr3_D = getval("dpwr3_D");
  pwd = getval("pwd");
  pwHs = getval("pwHs");
  dof_me = getval("dof_me");

  pwHs1 = pwHs; 
  tpwrs=-16.0; tpwrs1=tpwrs;
  tof_dtt = getval("tof_dtt");

  dpwrsed = -16;
  pwsed = 1000.0;
  dressed = 90.0;
  pwrb_cg = 0.0;  
  setautocal();                      /* activate auto-calibration */   

  if(FIRST_FID)                                         /* make shapes */
  {
    ppm = getval("dfrq"); 
    bw = 80.0*ppm;  
    rb180 = pbox_make("rb180P", "reburp", bw, 0.0, compC*pwC, pwClvl);
    bw = 8.125*ppm;  ofs = -24.0*ppm;
    rb180_cg = pbox_make("rb180_cgP", "reburp", bw, ofs, compC*pwC, pwClvl);
    bw = 20.0*ppm;  ofs = 136.0*ppm;
    cosed = pbox("COsedP", CODEC, CODECps, dfrq, compC*pwC, pwClvl);
    if(taua < (gt4+106e-6+pwHs)) printf("gt4 or pwHs may be too long! ");
    if(taub < rb180_cg.pw) printf("rb180_cgP pulse may be too long! ");
  }
  pwcrb180 = rb180.pw;   rfrb = rb180.pwrf;             /* set up parameters */
  pwrb_cg = rb180_cg.pw; rfrb_cg = rb180_cg.pwrf;       /* set up parameters */
  tpwrs = tpwr - 20.0*log10(pwHs/((compH*pw)*1.69));    /* sinc=1.69xrect */
  tpwrs = (int) (tpwrs); tpwrs1=tpwrs;              
  dpwrsed = cosed.pwr; pwsed = 1.0/cosed.dmf; dressed = cosed.dres;

/* LOAD PHASE TABLE */

  settable(t1,2,phi1);
  settable(t2,4,phi2);
  settable(t3,4,phi3);
  settable(t4,4,phi4);
  settable(t5,8,phi5);
  settable(t6,8,phi6);
  settable(t7,8,phi7);
  settable(t8,1,phi8);
  settable(t9,2,rec);

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( BigTC - 0.5*(ni2-1)*1/(sw2) - WFG_STOP_DELAY - POWER_DELAY 
              - 4.0e-6
              < 0.2e-6 )
    {
        printf(" ni2 is too big\n");
        psg_abort(1);
    }


    if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y' ))
    {
        printf("incorrect dec1 decoupler flags!  ");
        psg_abort(1);
    }

    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y' || dm2[D] == 'y'))
    {
        printf("incorrect dec2 decoupler flags! Should be 'nnnn' ");
        psg_abort(1);
    }

    if( satpwr > 6 )
    {
        printf("SATPWR too large !!!  ");
        psg_abort(1);
    }

    if( dpwr > 48 )
    {
        printf("don't fry the probe, DPWR too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > -16 )
    {
        printf("don't fry the probe, DPWR2 too large!  ");
        psg_abort(1);
    }

    if( pw > 200.0e-6 )
    {
        printf("dont fry the probe, pw too high ! ");
        psg_abort(1);
    } 

    if( pwN > 200.0e-6 )
    {
        printf("dont fry the probe, pwN too high ! ");
        psg_abort(1);
    } 

    if( pwC > 200.0e-6 )
    {
        printf("dont fry the probe, pwC too high ! ");
        psg_abort(1);
    } 

    if( pwcrb180 > 500.0e-6 )
    {  
        printf("dont fry the probe, pwcrb180 too high ! ");
        psg_abort(1);
    } 

    if(dpwr3 > 51)
    {
       printf("dpwr3 is too high; < 52\n");
       psg_abort(1);
    }

    if(dpwr3_D > 49)
    {
       printf("dpwr3_D is too high; < 50\n");
       psg_abort(1);
    }

   if(d1 < 1)
    {
       printf("d1 must be > 1\n");
       psg_abort(1);
    }

   if(dpwrsed > 48)
   {
       printf("dpwrsed must be less than 49\n");
       psg_abort(1);
   }

    if(  gt0 > 5.0e-3 || gt1 > 5.0e-3  || gt2 > 5.0e-3 ||
         gt3 > 5.0e-3 || gt4 > 5.0e-3  )
    {  printf(" all values of gti must be < 5.0e-3\n");
        psg_abort(1);
    }

   if(ix==1) {
     printf("make sure that BigTC1 is set properly for your application\n");
     printf("7 ms, neglecting relaxation \n");
   }

/*  Phase incrementation for hypercomplex 2D data */

    if (phase == 2) {
      tsadd(t1,1,4);
      tsadd(t2,1,4);
      tsadd(t3,1,4);
      tsadd(t4,1,4);
    }

    if (phase2 == 2)
      tsadd(t8,1,4);

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    tau1 = tau1 - 2.0*pw - 4.0/PI*pwC - POWER_DELAY - 2.0e-6 - PRG_START_DELAY
           - PRG_STOP_DELAY - POWER_DELAY - 2.0e-6;

    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1) );
        if(tau1 < 0.4e-6) tau1 = 4.0e-7;
    }
        tau1 = tau1/2.0;

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) ); 
        if(tau2 < 0.4e-6) tau2 = 4.0e-7;
    }
        tau2 = tau2/2.0;

/* Calculate modifications to phases for States-TPPI acquisition          */

   if( ix == 1) d2_init = d2 ;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) {
      tsadd(t1,2,4);     
      tsadd(t9,2,4);    
    }

   if( ix == 1) d3_init = d3 ;
   t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );
   if(t2_counter % 2) {
      tsadd(t8,2,4);  
      tsadd(t9,2,4);    
    }

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(satpwr);      /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 to low power       */

/* Presaturation Period */

status(B);
   if (fsat[0] == 'y')
   {
        obsoffset(tofps);
	delay(2.0e-5);
        rgpulse(d1,zero,2.0e-6,2.0e-6);  /* presat with transmitter */
   	obspower(tpwr);      /* Set transmitter power for hard 1H pulses */
	delay(2.0e-5);
	if(fscuba[0] == 'y')
	{
		delay(2.2e-2);
		rgpulse(pw,zero,2.0e-6,0.0);
		rgpulse(2.0*pw,one,2.0e-6,0.0);
		rgpulse(pw,zero,2.0e-6,0.0);
		delay(2.2e-2);
	}
   }
   else
   {
    delay(d1);
   }
   obspower(tpwr);           /* Set transmitter power for hard 1H pulses */
   obsoffset(tof);
   txphase(t1);
   decphase(zero);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(C);

   decoffset(dof_me);

   lk_hold();

   rcvroff();
   delay(20.0e-6);

/* ensure that magnetization originates on 1H and not 13C */

   if(dtt_flg[A] == 'y') {
     obsoffset(tof_dtt);
     obspower(tpwrs1);
     shaped_pulse("H2Osinc",pwHs1,zero,10.0e-6,0.0);
     obspower(tpwr);

     obsoffset(tof); 
   }
 
   decrgpulse(pwC,zero,0.0,0.0);
 
   zgradpulse(gzlvl0,gt0);
   delay(gstab);

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */

   zgradpulse(gzlvl1,gt1);
   delay(gstab);

   delay(taua - gt1 -gstab); 

   simpulse(2.0*pw,2.0*pwC,zero,zero,0.0,0.0);
   txphase(one);

   delay(taua - gt1 - gstab); 
   	
   zgradpulse(gzlvl1,gt1);
   delay(gstab);


   rgpulse(pw,one,0.0,0.0);

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,zero,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   decoffset(dof);  /* jump 13C to 40 ppm */

   zgradpulse(gzlvl2,gt2);
   delay(gstab);

   decrgpulse(pwC,t1,4.0e-6,0.0); decphase(zero); 

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decpwrf(rfrb);
   delay(BigTC - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t2);

   decpwrf(4095.0);
   delay(BigTC - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t2,0.0,0.0);
   decphase(zero);

   /* turn on 2H decoupling */
   dec3phase(one);
   dec3power(dpwr3); 
   dec3rgpulse(pwd1,one,4.0e-6,0.0); 
   dec3phase(zero);
   dec3unblank();
   dec3power(dpwr3_D);
   dec3prgon(dseq3,pwd,dres3);
   dec3on();
   /* turn on 2H decoupling */

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decpwrf(rfrb);

   delay(BigTC1 - POWER_DELAY - 4.0e-6 - pwd1
         - POWER_DELAY - PRG_START_DELAY - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t3);

   decpwrf(4095.0);
   delay(BigTC1 - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t3,0.0,0.0);
   decpwrf(rfrb_cg); decphase(zero);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - POWER_DELAY - WFG_START_DELAY);
   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(rfrb);
   
   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - POWER_DELAY - SAPS_DELAY
         - 2.0e-6 - WFG_START_DELAY);

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decshaped_pulse(rb180.name,pwcrb180,zero,2.0e-6,0.0);
   dcplrphase(zero);

   decpwrf(rfrb_cg); decphase(zero);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - SAPS_DELAY 
                  - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(4095.0); decphase(t4);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t4,0.0,0.0);

   if(C_flg[A] == 'n') {

   decpower(dpwrsed); decunblank(); decphase(zero); delay(2.0e-6);
   decprgon(cosed.name,pwsed,dressed);
   decon();
  
   delay(tau1);
   rgpulse(2.0*pw,zero,0.0,0.0);
   delay(tau1);

   decoff();
   decprgoff();
   decblank();
   decpower(pwClvl);
   }

   else 
    simpulse(2.0*pw,2.0*pwC,zero,zero,4.0e-6,4.0e-6);

   decrgpulse(pwC,t5,2.0e-6,0.0);
   decpwrf(rfrb_cg); decphase(zero);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - POWER_DELAY - WFG_START_DELAY);
   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(rfrb);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - POWER_DELAY - SAPS_DELAY
         - 2.0e-6 - WFG_START_DELAY);

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decshaped_pulse(rb180.name,pwcrb180,zero,2.0e-6,0.0);
   dcplrphase(zero);

   decpwrf(rfrb_cg); decphase(zero);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - SAPS_DELAY 
                  - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(4095.0); decphase(t6);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t6,0.0,0.0);
   decphase(zero);

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decpwrf(rfrb);
   delay(BigTC1 - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t7);

   decpwrf(4095.0);
   delay(BigTC1 - WFG_STOP_DELAY - POWER_DELAY
          - PRG_STOP_DELAY - POWER_DELAY - 4.0e-6 - pwd1);

   /* 2H decoupling off */
   dec3off();
   dec3prgoff();
   dec3blank();
   dec3power(dpwr3);
   dec3rgpulse(pwd1,three,4.0e-6,0.0);
   /* 2H decoupling off */

   decrgpulse(pwC,t7,0.0,0.0);
   decphase(zero);

   delay(tau2);
   rgpulse(2.0*pw,zero,0.0,0.0);

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decpwrf(rfrb);
   delay(BigTC - 2.0*pw - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t8);
   decpwrf(4095.0);

   delay(BigTC - tau2 - WFG_STOP_DELAY - POWER_DELAY - 4.0e-6);

   decrgpulse(pwC,t8,4.0e-6,0.0);


   decoffset(dof_me);

   zgradpulse(gzlvl3,gt3);
   delay(gstab);

   lk_sample();

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,two,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   rgpulse(pw,zero,4.0e-6,0.0);

   zgradpulse(gzlvl4,gt4);
   delay(gstab);

   delay(taua - gt4 -gstab 
         - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
         - pwHs - WFG_STOP_DELAY - POWER_DELAY - 2.0e-6);

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,two,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   simpulse(2.0*pw,2.0*pwC,zero,zero,2.0e-6,0.0);

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,two,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   zgradpulse(gzlvl4,gt4);
   delay(gstab);
 
   delay(taua - POWER_DELAY - WFG_START_DELAY
         - pwHs - WFG_STOP_DELAY - POWER_DELAY 
         - gt4 - gstab - 2.0*POWER_DELAY);

   decpower(dpwr);  /* Set power for decoupling */
   dec2power(dpwr2);

/*   rcvron();  */          /* Turn on receiver to warm up before acq */ 

/* BEGIN ACQUISITION */

status(D);
   setreceiver(t9);

}
コード例 #5
0
pulsesequence()
{
/* DECLARE VARIABLES */
  char        fsat[MAXSTR],
              fscuba[MAXSTR],
              f1180[MAXSTR],      /* Flag to start t1 @ halfdwell           */
              sh_reb[MAXSTR],
              codec[MAXSTR],
              MQ_flg[MAXSTR],
              filter_flg[MAXSTR];
  int          phase,
               t1_counter;    /* used for states tppi in t1          */
  double       tau1,          /* t1 delay */
               taua,          /* set to exactly 1/4JCH */
               tsatpwr,       /* low level 1H trans.power for presat */
               sw1,           /* sweep width in f1                   */
               tpwr_cp,       /* power level for 1H CPMG     */
               pw_cp,         /* 1H pw for CPMG      */
               ncyc_cp,       /* number of CPMG cycles */
               time_T2,       /* total time for CPMG trains   */
               tau_cpmg,
               dhpwr,
               pwc,
               dmf_co,
               dpwr_co,
               dresco,
              gt0,
              gt1,
              gt2,
              gt3,
              gt4,
              gt5,
              gt6,
              gzlvl0,
              gzlvl1,
              gzlvl2,
              gzlvl3,
              gzlvl4,
              gzlvl5,
              gzlvl6,
              tpwr,
              pw,
              d_reb,
              pwc_reb,
              dpwr3_D,
              pwd,
              pwd1,
              tau_eq,
              pwn,
              dhpwr2;
/* LOAD VARIABLES */
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("fscuba",fscuba);
  getstr("sh_reb",sh_reb);
  getstr("codec",codec);
  getstr("MQ_flg",MQ_flg);
  getstr("filter_flg",filter_flg);
  taua    = getval("taua");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  phase = (int) ( getval("phase") + 0.5);
  sw1 = getval("sw1");
  tpwr_cp  = getval("tpwr_cp");
  pw_cp =  getval("pw_cp");
  ncyc_cp  = getval("ncyc_cp");
  time_T2  = getval("time_T2");
  dhpwr = getval("dhpwr");
  pwc = getval("pwc");
  pwn = getval("pwn");
  dhpwr2 = getval("dhpwr2");
  dmf_co = getval("dmf_co");
  dpwr_co = getval("dpwr_co");
  dresco = getval("dresco");
  gt0  = getval("gt0");
  gt1  = getval("gt1");
  gt2  = getval("gt2");
  gt3  = getval("gt3");
  gt4  = getval("gt4");
  gt5  = getval("gt5");
  gt6 = getval("gt6");
  gzlvl0  = getval("gzlvl0");
  gzlvl1  = getval("gzlvl1");
  gzlvl2  = getval("gzlvl2");
  gzlvl3  = getval("gzlvl3");
  gzlvl4  = getval("gzlvl4");
  gzlvl5  = getval("gzlvl5");
  gzlvl6  = getval("gzlvl6");
  tpwr = getval("tpwr");
  pw = getval("pw");
  d_reb = getval("d_reb");
  pwc_reb = getval("pwc_reb");
  dpwr3_D = getval("dpwr3_D");
  pwd = getval("pwd");
  pwd1 = getval("pwd1");
  tau_eq = getval("tau_eq");
/* LOAD PHASE TABLE */
  settable(t1,4,phi1);
  settable(t2,2,phi2);
  settable(t4,8,phi4);
  settable(t5,4,rec);
/* CHECK VALIDITY OF PARAMETER RANGES */
    if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y' ))
    {
         printf("incorrect dec1 decoupler flags! ");
         abort(1);
    }
    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y' || dm2[D] == 'y'))
    {
         printf("incorrect dec2 decoupler flags! ");
         abort(1);
    }
    if( tsatpwr > 6 )
    {
         printf("TSATPWR too large !!!  ");
         abort(1);
    }
    if( dpwr > 48 )
    {
         printf("don't fry the probe, DPWR too large!  ");
         abort(1);
    }
    if(tpwr_cp > 62)
    {
         printf("don't fry the probe, tpwr_cp too large: < 62! ");
         abort(1);
    }
    if(pw_cp < 9.5e-6) {
         printf("pw_cp is too low; > 9.5us\n");
         abort(1);
    }
    if( dpwr2 > -16 )
    {
         printf("don't fry the probe, DPWR2 too large!  ");
         abort(1);
    }
      if( pw > 20.0e-6 )
      {
            printf("dont fry the probe, pw too high ! ");
            abort(1);
      }
      if(gt1 > 3e-3 || gt2 > 3e-3 || gt3 > 3e-3 || gt4 > 3e-3
             || gt5 > 3e-3 || gt6 > 3e-3)
      {
            printf("gradients on for too long. Must be < 3e-3 \n");
            abort(1);
      }
      if(ncyc_cp > 80) {
            printf("ncyc_cp is too large; must be less than 81\n");
            abort(1);
      }
      if(time_T2 > .080) {
            printf("time_T2 is too large; must be less than 80 ms\n");
            abort(1);
      }
      if(ncyc_cp > 0) {
            tau_cpmg = time_T2/(4.0*ncyc_cp) - pw_cp;
            if(ix==1)
              printf("nuCPMG for curent experiment is (Hz): %5.3f\n",1/(4.0*(tau_cpmg+pw_cp)));
        }
        else {
            tau_cpmg = time_T2/(4.0) - pw_cp;
            if(ix==1)
              printf("nuCPMG for curent experiment is (Hz): not applicable");
        }
      if(tau_cpmg + pw_cp < 125e-6) {
           printf("tau_cpmg is too small; decrease ncyc_cp\n");
           abort(1);
      }
      if(dpwr_co > 42) {
           printf("dpwr_co is too high; < 42\n");
           abort(1);
    }
      if(dpwr3_D > 51) {
           printf("dpwr3_D is too high; < 52\n");
           abort(1);
      }
      if(dpwr3 > 59) {
           printf("dpwr3 is too high; < 60\n");
           abort(1);
    }
    if(ix==1)
        printf("If at 800 turn dpwr3=-16, pwd1=0\n");
/*    Phase incrementation for hypercomplex 2D data */
      if (phase == 2)
          tsadd(t1,1,4);
/*    Set up f1180    tau1 = t1               */
      tau1 = d2;
   if(MQ_flg[A] == 'n')
      tau1 = tau1 - 4.0/PI*pwc - POWER_DELAY - PRG_START_DELAY
                - 2.0*pw - 2.0*pwn - PRG_STOP_DELAY - POWER_DELAY
                - 4.0e-6;
    else
      tau1 = tau1 - 4.0/PI*pwc - POWER_DELAY - PRG_START_DELAY
              - 2.0*pw - 2.0*pwn - PRG_STOP_DELAY - POWER_DELAY
              - 4.0e-6;
     if(f1180[A] == 'y') {
          tau1 += ( 1.0 / (2.0*sw1));
          if(tau1 < 0.4e-6) tau1 = 0.4e-6;
     }
     if(tau1 < 0.4e-6)
          tau1 = 0.4e-6;
       tau1 = tau1/2.0;
/* Calculate modifications to phases for States-TPPI acquisition              */
   if( ix == 1) d2_init = d2 ;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) {
        tsadd(t1,2,4);
        tsadd(t5,2,4);
     }
/* BEGIN ACTUAL PULSE SEQUENCE */
status(A);
   rlpower(tsatpwr,TODEV);       /* Set transmitter power for 1H presaturation */
   rlpower(dhpwr,DODEV);         /* Set Dec1 power for 13C pulses          */
   rlpower(dhpwr2,DO2DEV);       /* Set Dec2 power for 15N pulses       */
   obsoffset(tof);
/* Presaturation Period */
status(B);
   if (fsat[0] == 'y')
   {
          delay(2.0e-5);
          rgpulse(d1,zero,2.0e-6,2.0e-6); /* presaturation */
          rlpower(tpwr,TODEV);    /* Set transmitter power for hard 1H pulses */
          delay(2.0e-5);
          if(fscuba[0] == 'y')
          {
                  delay(2.2e-2);
                  rgpulse(pw,zero,2.0e-6,0.0);
                  rgpulse(2*pw,one,2.0e-6,0.0);
                  rgpulse(pw,zero,2.0e-6,0.0);
                  delay(2.2e-2);
          }
   }
   else
   {
     delay(d1);
   }
   rlpower(tpwr,TODEV);               /* Set transmitter power for 1H CPMG pulses */
   txphase(zero);
   dec2phase(zero);
   decphase(zero);
   delay(1.0e-5);
/* Begin Pulses */
status(C);
   rcvroff();
   delay(20.0e-6);
   decrgpulse(pwc,zero,4.0e-6,0.0);
delay(2.0e-6);
rgradient('z',gzlvl1);
delay(gt1);
rgradient('z',0.0);
delay(250.0e-6);
rgpulse(pw,zero,0.0,0.0);
decpower(d_reb);
delay(2.0e-6);
rgradient('z',gzlvl2);
delay(gt2);
rgradient('z',0.0);
delay(150.0e-6);
if(filter_flg[A] == 'y')
   delay(taua - POWER_DELAY - gt2 - 152e-6
     - WFG2_START_DELAY - 0.5*pwc_reb - 4.0/PI*pw);
else
   delay(taua - POWER_DELAY - gt2 - 152e-6
     - WFG2_START_DELAY - 0.5*pwc_reb);
simshaped_pulse("hard",sh_reb,2.0*pw,pwc_reb,zero,zero,0.0,0.0);
txphase(one);
decpower(dhpwr);
decphase(t4);
delay(taua - 0.5*pwc_reb - WFG2_STOP_DELAY - POWER_DELAY - gt2 - 152e-6 );
delay(2.0e-6);
rgradient('z',gzlvl2);
delay(gt2);
rgradient('z',0.0);
delay(150.0e-6);
if(filter_flg[A] == 'n')
  rgpulse(pw,one,0.0,0.0);
if(filter_flg[A] == 'y') {
decrgpulse(pwc,t4,0.,0.);
decpower(d_reb);
decphase(zero);
delay(2.0e-6);
rgradient('z',gzlvl0);
delay(gt0);
rgradient('z',0.0);
delay(150.0e-6);
delay(taua - POWER_DELAY - gt0 - 152e-6
     - WFG2_START_DELAY - 0.5*pwc_reb);
simshaped_pulse("hard",sh_reb,2.0*pw,pwc_reb,zero,zero,0.0,0.0);
txphase(one);
decpower(dhpwr);
decphase(t4);
delay(taua - 0.5*pwc_reb - WFG2_STOP_DELAY - POWER_DELAY - gt0 - 152e-6 );
delay(2.0e-6);
rgradient('z',gzlvl0);
delay(gt0);
rgradient('z',0.0);
delay(150.0e-6);
decrgpulse(pwc,t4,0.0,0.0);
rgpulse(pw,one,0.0,0.0);
}
  decphase(t1);
  delay(2.0e-6);
  rgradient('z',gzlvl3);
  delay(gt3);
  rgradient('z',0.0);
  delay(250.0e-6);
  /* turn on 2H decoupling */
  dec3phase(one);
  dec3power(dpwr3);
  dec3rgpulse(pwd1,one,4.0e-6,0.0);
  dec3phase(zero);
  dec3unblank();
  dec3power(dpwr3_D);
  dec3prgon(dseq3,pwd,dres3);
  dec3on();
  /* turn on 2H decoupling */
  if(MQ_flg[A] == 'y') {
     rgpulse(pw,zero,2.0e-6,0.0);
     delay(2.0*pwn - PRG_START_DELAY - PRG_STOP_DELAY);
  }
  decrgpulse(pwc,t1,4.0e-6,0.0);
  decphase(zero);
  /* 13CO decoupling on */
  decpower(dpwr_co);
  decprgon(codec,1.0/dmf_co,dresco);
  decon();
  /* 13CO decoupling on */
  delay(tau1);
  rgpulse(2.0*pw,zero,0.0,0.0);
  dec2rgpulse(2.0*pwn,zero,0.0,0.0);
  delay(tau1);
  /* 13CO decoupling off */
  decoff();
  decprgoff();
  /* 13CO decoupling off */
  decpower(dhpwr);
  decrgpulse(pwc,zero,4.0e-6,0.0);
  if(MQ_flg[A] == 'y')
    rgpulse(pw,zero,0.0,0.0);
  /* turn off decoupling */
  dec3off();
  dec3prgoff();
  dec3blank();
  dec3phase(three);
  dec3power(dpwr3);
  dec3rgpulse(pwd1,three,4.0e-6,0.0);
  /* turn off decoupling */
  obspower(tpwr_cp);
  if(MQ_flg[A] == 'n') {
    delay(2.0e-6);
    rgradient('z',gzlvl4);
    delay(gt4);
    rgradient('z',0.0);
    delay(250.0e-6);
  }
  else {
    delay(2.0e-6);
    rgradient('z',-1.0*gzlvl4);
    delay(gt4);
    rgradient('z',0.0);
    delay(250.0e-6);
}
    /* now include a delay to allow the spin system to equilibrate */
    delay(tau_eq);
    rgpulse(pw_cp,t2,4.0e-6,0.0);
    txphase(one);
    /* start of the CPMG period 1    */
    if(ncyc_cp == 1) {
        delay(tau_cpmg - (2.0/PI)*pw_cp);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
    }
    if(ncyc_cp == 2) {
        delay(tau_cpmg - (2.0/PI)*pw_cp);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
        delay(tau_cpmg);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
    }
    if(ncyc_cp > 2) {
        delay(tau_cpmg - (2.0/PI)*pw_cp);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
        initval(ncyc_cp-2,v4);
        loop(v4,v5);
          delay(tau_cpmg);
          rgpulse(2.0*pw_cp,one,0.0,0.0);
          delay(tau_cpmg);
         endloop(v5);
        delay(tau_cpmg);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
      }
    txphase(t4); decphase(zero);
    rgpulse(2.0*pw_cp,t4,2.0e-6,2.0e-6);
    txphase(one);
    if(ncyc_cp == 1) {
        delay(tau_cpmg);
        rgpulse(2.0*pw_cp,one,0.0,0.0); txphase(one);
        delay(tau_cpmg - 2.0/PI*pw_cp);
    }
    if(ncyc_cp == 2) {
        delay(tau_cpmg);
       rgpulse(2.0*pw_cp,one,0.0,0.0);
       delay(tau_cpmg);
       delay(tau_cpmg);
       rgpulse(2.0*pw_cp,one,0.0,0.0); txphase(one);
       delay(tau_cpmg - 2.0/PI*pw_cp);
   }
   if(ncyc_cp > 2) {
       delay(tau_cpmg);
       rgpulse(2.0*pw_cp,one,0.0,0.0);
       delay(tau_cpmg);
       initval(ncyc_cp-2,v4);
       loop(v4,v5);
         delay(tau_cpmg);
         rgpulse(2.0*pw_cp,one,0.0,0.0);
         delay(tau_cpmg);
        endloop(v5);
       delay(tau_cpmg);
       rgpulse(2.0*pw_cp,one,0.0,0.0); txphase(one);
       delay(tau_cpmg - 2.0/PI*pw_cp);
     }
     rgpulse(pw_cp,zero,0.0,0.0);
     delay(2.0e-6);
     rgradient('z',gzlvl5);
     delay(gt5);
     rgradient('z',0.0);
     delay(250.0e-6);
     obspower(tpwr);
     rgpulse(pw,zero,4.0e-6,0.0);
     decpower(d_reb);
   delay(2.0e-6);
   rgradient('z',gzlvl6);
   delay(gt6);
   rgradient('z',0.0);
   delay(150.0e-6);
   delay(taua - POWER_DELAY - gt6 - 152e-6
          - WFG2_START_DELAY - 0.5*pwc_reb);
   simshaped_pulse("hard",sh_reb,2.0*pw,pwc_reb,zero,zero,0.0,0.0);
   delay(taua - 0.5*pwc_reb - WFG2_STOP_DELAY - 2.0*POWER_DELAY - gt6 - 152e-6);
     rlpower(dpwr,DODEV); /* Set power for decoupling */
     rlpower(dpwr2,DO2DEV); /* Set power for decoupling */
     delay(2.0e-6);
     rgradient('z',gzlvl6);
     delay(gt6);
     rgradient('z',0.0);
     delay(150.0e-6);
     rgpulse(pw,zero,0.0,0.0);
/*     rcvron();  */          /* Turn on receiver to warm up before acq */
/* BEGIN ACQUISITION */
status(D);
     setreceiver(t5);
}
コード例 #6
0
ファイル: T2D.c プロジェクト: OpenVnmrJ/OpenVnmrJ
pulsesequence()
{
/* DECLARE VARIABLES */

 char       fsat[MAXSTR],
            fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            codecseq[MAXSTR],
            ddseq[MAXSTR], 
            shca180[MAXSTR],
            shca90[MAXSTR];

 int         phase,  ni, 
             t1_counter,   /* used for states tppi in t1           */ 
             tau2;

 double      tau1,         /*  t1 delay */
             taua,         /*  ~ 1/4JCH =  1.7 ms */
             taub,         /* ~ 1/2JCH for AX spin systems */
             taud,         /* ~ 1/4JCD 12.5 ms for AX spin system */
             TC,           /* carbon constant time period 1/2JCC */
             pwc,          /* 90 c pulse at dhpwr            */
             tsatpwr,      /* low level 1H trans.power for presat  */
             dhpwr,        /* power level for high power 13C pulses on dec1 */
             sw1,          /* sweep width in f1                    */ 
             time_T2,      /*  total relaxation time for T2 measurement */
             pwcodec,      /* pw90 for C' decoupling */
             dressed,      /* = 2 for seduce-1 decoupling */
             dpwrsed,
             pwd,          /* pulse width for D decoupling at dpwr3_D  */
             dresD,
             dpwr3_D,
             lk_wait,      /* delay for lk receiver recovery  */

             pwd1,         /* pulse width for D +/- pulses at dpwr3  */

             d_ca180,
             pwca180,

             pwca90,       /* ca selective pulse at 57.5 ppm */
             d_ca90,       /* power level for pwca90   */

             dpwr3_sl,     /* D power level for spin locking */
             pwd_sl,       /* pw for D at dpwr3_sl    */

             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gstab=getval("gstab"),

             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8;

/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */

  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("fscuba",fscuba);
  getstr("codecseq",codecseq);
  getstr("ddseq",ddseq);
  getstr("shca180",shca180);
  getstr("shca90",shca90);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  taud   = getval("taud"); 
  TC = getval("TC");
  pwc = getval("pwc");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dhpwr = getval("dhpwr");
  dpwr = getval("dpwr");
  phase = (int) ( getval("phase") + 0.5);
  sw1 = getval("sw1");
  ni = getval("ni");
  pwcodec = getval("pwcodec");
  dressed = getval("dressed");
  dpwrsed = getval("dpwrsed");
  pwd = getval("pwd");
  dresD = getval("dresD");
  dpwr3_D = getval("dpwr3_D");
  lk_wait = getval("lk_wait");

  pwd1 = getval("pwd1");

  d_ca180 = getval("d_ca180");
  pwca180 = getval("pwca180");

  pwca90 = getval("pwca90");
  d_ca90 = getval("d_ca90");

  dpwr3_sl = getval("dpwr3_sl"); 
  pwd_sl = getval("pwd_sl");

  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");

  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl8 = getval("gzlvl8");

/* LOAD PHASE TABLE */

  settable(t1,16,phi1);
  settable(t2,2,phi2);
  settable(t3,16,phi3);
  settable(t4,4,phi4);
  settable(t6,4,phi6);
  settable(t7,8,phi7);
  settable(t5,16,rec_d);

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( TC - 0.50*(ni-1)*1/(sw1) - WFG_STOP_DELAY 
             - gt6 - 102e-6 - POWER_DELAY 
             - PRG_START_DELAY - POWER_DELAY
             - 4.0e-6 - pwd1 - POWER_DELAY
             - PRG_START_DELAY - PRG_STOP_DELAY
             - 2.0e-6 - POWER_DELAY - 2.0e-6
             < 0.2e-6 ) 
    {
        printf(" ni is too big\n");
        psg_abort(1);
    }


    if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y' ))
    {
        printf("incorrect dec1 decoupler flags!  ");
        psg_abort(1);
    }

    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y' || dm2[D] == 'y'))
    {
        printf("incorrect dec2 decoupler flags!  ");
        psg_abort(1);
    }

    if( tsatpwr > 6 )
    {
        printf("TSATPWR too large !!!  ");
        psg_abort(1);
    }

    if( dpwr > 48 )
    {
        printf("don't fry the probe, DPWR too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > 49 )
    {
        printf("don't fry the probe, DPWR2 too large!  ");
        psg_abort(1);
    }

    if( dhpwr > 63 )
    {
        printf("don't fry the probe, DHPWR too large!  ");
        psg_abort(1);
    }

    if( pw > 200.0e-6 )
    {
        printf("dont fry the probe, pw too high ! ");
        psg_abort(1);
    } 

    if(gt1 > 15e-3 || gt2 > 15e-3 || gt3 > 15e-3 || 
        gt4 > 15e-3 || gt5 > 15e-3 || gt6 > 15e-3 || gt7 > 15e-3
        || gt8 > 15e-3)
    {
        printf("gradients on for too long. Must be < 15e-3 \n");
        psg_abort(1);
    }

   if(dpwr3_D > 54)
   {
       printf("D decoupling power is too high\n");
       psg_abort(1);
   }

   if(lk_wait > .015 )
   {
       printf("lk_wait delay may be too long\n");
       psg_abort(1);
   }
/* change back to 48 */
   if(dpwr3_sl > 53) {
       printf("dpwr3_sl is too large; must be less than 53\n");
       psg_abort(1);
   }
/* change back to 250 */
   if(pwd_sl < 170.0e-6) {
       printf("pwd_sl is too large; Must be larger than 170 us\n");
       psg_abort(1);
   }


/* Calculation of IzCzDz relaxation delay */

   tau2 = (int) (d3+0.1);
   time_T2 = z_array[tau2];

   if(time_T2 > 0.030) {
       printf("time_T2 is too long; Must be less than 30 ms\n");
       psg_abort(1);
   }

/*  Phase incrementation for hypercomplex 2D data */

    if (phase == 2) {
      tsadd(t7,1,4);  
    }

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1) );
        if(tau1 < 0.4e-6) tau1 = 0.4e-6;
    }
        tau1 = tau1/2.0;


/* Calculate modifications to phases for States-TPPI acquisition          */

   if( ix == 1) d2_init = d2 ;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) {
      tsadd(t7,2,4);     
      tsadd(t5,2,4);    
    }


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   decoffset(dof);
   obspower(tsatpwr);     /* Set transmitter power for 1H presaturation */
   decpower(dhpwr);       /* Set Dec1 power for hard 13C pulses         */
   dec2power(dpwr2);      /* Set Dec2 power for 15N decoupling       */

/* Presaturation Period */

status(B);


   if (fsat[0] == 'y')
   {
        rgpulse(d1,zero,2.0e-6,2.0e-6); /* presat */
        obspower(tpwr);    /* Set transmitter power for hard 1H pulses */
        delay(2.0e-5);
        if(fscuba[0] == 'y')
        {
                delay(2.2e-2);
                rgpulse(pw,zero,2.0e-6,0.0);
                rgpulse(2*pw,one,2.0e-6,0.0);
                rgpulse(pw,zero,2.0e-6,0.0);
                delay(2.2e-2);
        }
   }
   else
   {
    delay(d1);
   }

   obspower(tpwr);          /* Set transmitter power for hard 1H pulses */
   txphase(zero);
   dec2phase(zero);
   decphase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(C);

/* Prepare for signs of gradients 0 1 0 1 0 1   */

   mod2(ct,v1);

   rcvroff();
   lk_hold();
   delay(20.0e-6);

/* first ensure that magnetization does infact start on H and not C */

   decrgpulse(pwc,zero,2.0e-6,2.0e-6);

   delay(2.0e-6);
   zgradpulse(gzlvl1,gt1);
   delay(gstab);


/* this is the real start */

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */

   delay(2.0e-6);
   zgradpulse(gzlvl2,gt2);
   delay(2.0e-6);

   delay(taua - gt2 - 4.0e-6);                 /* taua <= 1/4JCH */                          

   simpulse(2*pw,2*pwc,zero,zero,0.0,0.0);

   txphase(one); decphase(t1);

   delay(2.0e-6);
   zgradpulse(gzlvl2,gt2);
   delay(2.0e-6);

   delay(taua - gt2 - 4.0e-6); 

   rgpulse(pw,one,0.0,0.0);
   txphase(zero);

   delay(2.0e-6);
   zgradpulse(gzlvl3,gt3);
   delay(gstab);

   /* 2D decoupling on */
   dec3phase(one);
   dec3power(dpwr3);
   dec3rgpulse(pwd1,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3unblank();
   dec3power(dpwr3_D);                    /* keep power down */
   dec3prgon(ddseq,pwd,dresD);
   dec3on();
   /* 2D decoupling on */

   decrgpulse(pwc,t1,2.0e-6,0.0); 

   decphase(zero);

   delay(taub - 2.0*pw - 2.0e-6);

   rgpulse(pw,zero,0.0,0.0);
   rgpulse(pw,t2,2.0e-6,0.0);

   delay(TC - taub 
           - gt4 - 102e-6
           - PRG_STOP_DELAY - POWER_DELAY - pwd1
           - 4.0e-6 - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

   /* 2D decoupling off */
   dec3off();
   dec3prgoff();
   dec3blank();
   dec3phase(three);
   dec3power(dpwr3);
   dec3rgpulse(pwd1,three,4.0e-6,0.0);
   /* 2D decoupling off */

   ifzero(v1);

   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(gstab);

   elsenz(v1);

   delay(2.0e-6);
   zgradpulse(-1.0*gzlvl4,gt4);
   delay(gstab);

  endif(v1);

   initval(1.0,v3);
   decstepsize(353.0);
   dcplrphase(v3); 

   decpower(d_ca180);
   decshaped_pulse(shca180,pwca180,zero,4.0e-6,0.0);
   dcplrphase(zero); 

   ifzero(v1);

   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(gstab);

   elsenz(v1);

   delay(2.0e-6);
   zgradpulse(-1.0*gzlvl4,gt4);
   delay(gstab);

  endif(v1);

   /* 2D decoupling on */  
   dec3phase(one);
   dec3power(dpwr3);
   dec3rgpulse(pwd1,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3unblank();
   dec3power(dpwr3_D);   /* keep power down */ 
   dec3prgon(ddseq,pwd,dresD);
   dec3on();
   /* 2D decoupling on */

    delay(TC - taud - WFG_STOP_DELAY - gt4 - 102e-6
            - POWER_DELAY - 4.0e-6 - pwd1 - POWER_DELAY 
            - PRG_START_DELAY); 

   /* 2D decoupling off */
   dec3off();
   dec3prgoff();
   dec3blank();
   decphase(three);
   dec3power(dpwr3);
   dec3rgpulse(pwd1,three,4.0e-6,0.0);
   /* 2D decoupling off */

   delay(taud - PRG_STOP_DELAY -POWER_DELAY - pwd1 - 4.0e-6 
         - POWER_DELAY
         - WFG_START_DELAY - pwca90 - 4.0e-6
         - WFG_STOP_DELAY - POWER_DELAY - 4.0e-6);

   decpower(d_ca90);
   decshaped_pulse(shca90,pwca90,t3,4.0e-6,0.0);
   decpower(dhpwr);

   decrgpulse(pwc,one,4.0e-6,0.0);

   /* T2 period */

   dec3power(dpwr3);   

      dec3rgpulse(pwd1,t4,2.0e-6,0.0);

      dec3phase(one);
      dec3power(dpwr3_sl);
      dec3rgpulse(time_T2,one,2.0e-6,2.0e-7);
      dec3phase(zero);

      dec3power(dpwr3);
      dec3rgpulse(pwd1,zero,2.0e-6,0.0);

       
      ifzero(v1);

      delay(2.0e-6);
      zgradpulse(gzlvl5,gt5);
      delay(gstab);

      elsenz(v1);

      delay(2.0e-6);
      zgradpulse(-1.0*gzlvl5,gt5);
      delay(gstab);

      endif(v1);

   decphase(zero);

   decrgpulse(pwc,t7,4.0e-6,0.0);

   /* C' decoupling on */
   decpower(dpwrsed);
   decprgon(codecseq,pwcodec,dressed);
   decon();
   /* C' decoupling on */

  if(taud + 3.0*POWER_DELAY + 2.0*PRG_START_DELAY + pwd1 + 4.0e-6 >= tau1) {
        
        delay(tau1);
        rgpulse(2.0*pw,zero,0.0,0.0);
        delay(taud + 3.0*POWER_DELAY + 2.0*PRG_START_DELAY + pwd1 + 4.0e-6
              - tau1);

        /* 2D decoupling on */  
        dec3phase(t6);
        dec3power(dpwr3);
        dec3rgpulse(pwd1,t6,4.0e-6,0.0);
        dec3phase(zero);
        dec3unblank();
        dec3power(dpwr3_D);   /* keep power down */ 
        dec3prgon(ddseq,pwd,dresD);
        dec3on();
        /* 2D decoupling on */

        delay(TC - taud + tau1 - POWER_DELAY 
              - PRG_START_DELAY - 2.0*pw
              - POWER_DELAY - pwd1 - 4.0e-6 - POWER_DELAY - PRG_START_DELAY
              - 3.0*POWER_DELAY - 2.0*PRG_START_DELAY - pwd1 - 4.0e-6 
              - PRG_STOP_DELAY - POWER_DELAY - pwd1 - 4.0e-6 
              - PRG_STOP_DELAY
              - POWER_DELAY - gt6 - 102e-6
              - WFG_START_DELAY);

        /* 2D decoupling off */  
        dec3off();
        dec3prgoff();
        dec3blank();
        dec3power(dpwr3);
        dec3rgpulse(pwd1,three,4.0e-6,0.0);
        /*  2D decoupler off */

        /* C' decoupling off */
        decoff();
        decprgoff();
        decpower(d_ca180);  /* set power for reburp  */
        /* C' decoupling off */

     }

     else {

        delay(taud);

        /* 2D decoupling on */  
        dec3phase(t6);
        dec3power(dpwr3);
        dec3rgpulse(pwd1,t6,4.0e-6,0.0);
        dec3phase(zero);
        dec3unblank();
        dec3power(dpwr3_D);   /* keep power down */ 
        dec3prgon(ddseq,pwd,dresD);
        dec3on();
        /* 2D decoupling on */

        delay(tau1 - taud - POWER_DELAY - PRG_START_DELAY
              - POWER_DELAY - pwd1 - 4.0e-6 
              - POWER_DELAY - PRG_START_DELAY);

        rgpulse(2.0*pw,zero,0.0,0.0);

        delay(TC 
              - 2.0*pw - PRG_STOP_DELAY - POWER_DELAY - pwd1 - 4.0e-6 
              - POWER_DELAY
              - PRG_STOP_DELAY - gt6 - 102e-6
              - WFG_START_DELAY);

        /* 2D decoupling off */  
        dec3off();
        dec3prgoff();
        dec3blank();
        dec3phase(three);
        dec3power(dpwr3);
        dec3rgpulse(pwd1,three,4.0e-6,0.0);
        /*  2D decoupler off */

        /* C' decoupling off */
        decoff();
        decprgoff();
        decpower(d_ca180);  /* set power for reburp  */
        /* C' decoupling off */

     }

   initval(1.0,v4);
   decstepsize(353.0);
   dcplrphase(v4); 

   ifzero(v1);

   delay(2.0e-6);
   zgradpulse(gzlvl6,gt6);
   delay(gstab);

   elsenz(v1);

   delay(2.0e-6);
   zgradpulse(-1.0*gzlvl6,gt6);
   delay(gstab);

   endif(v1);

   decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
   dcplrphase(zero); 

   ifzero(v1);

   delay(2.0e-6);
   zgradpulse(gzlvl6,gt6);
   delay(gstab);

   elsenz(v1);

   delay(2.0e-6);
   zgradpulse(-1.0*gzlvl6,gt6);
   delay(gstab);

   endif(v1);

   /* C' decoupling on */
   decpower(dpwrsed);
   decprgon(codecseq,pwcodec,dressed);
   decon();
   /* C' decoupling on */

   /* 2D decoupling on */  
   dec3phase(one);
   dec3power(dpwr3);
   dec3rgpulse(pwd1,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3unblank();
   dec3power(dpwr3_D);   /* keep power down */ 
   dec3prgon(ddseq,pwd,dresD);
   dec3on();
   /* 2D decoupling on */

   delay(TC - tau1 - WFG_STOP_DELAY - gt6
           - 102e-6 - POWER_DELAY - PRG_START_DELAY - POWER_DELAY - pwd1
           - 4.0e-6 - POWER_DELAY - PRG_START_DELAY - PRG_STOP_DELAY
           - POWER_DELAY - 4.0e-6);

   /* C' decoupling off */
   decoff();
   decprgoff();
   decpower(dhpwr);
   /* C' decoupling off */

   decrgpulse(pwc,one,4.0e-6,0.0);

   /* 2D decoupling off */  
   dec3off();
   dec3prgoff();
   dec3blank();
   dec3phase(three);
   dec3power(dpwr3);
   dec3rgpulse(pwd1,three,4.0e-6,0.0);
   /*  2D decoupler off */

  ifzero(v1);

   delay(2.0e-6);
   zgradpulse(gzlvl7,gt7);
   delay(gstab);

  elsenz(v1);

   delay(2.0e-6);
   zgradpulse(-1.0*gzlvl7,gt7);
   delay(gstab);

  endif(v1);
  
   delay(lk_wait);   /* delay for lk receiver recovery */

   rgpulse(pw,zero,0.0,0.0);

   delay(2.0e-6);
   zgradpulse(gzlvl8,gt8);

  decphase(zero);

  delay(taua - gt8 - 4.0e-6);

  simpulse(2*pw,2*pwc,zero,zero,0.0,0.0);

   delay(2.0e-6);
   zgradpulse(gzlvl8,gt8);
   delay(2.0e-6);

   delay(taua - 2*POWER_DELAY - gt8 - 4.0e-6);

   decpower(dpwr);  /* Set power for decoupling */
   dec2power(dpwr2);  /* Set power for decoupling */

   rgpulse(pw,zero,0.0,rof2);

  lk_sample();

/*   rcvron();  */          /* Turn on receiver to warm up before acq */ 

/* BEGIN ACQUISITION */

status(D);
   setreceiver(t5);

}
コード例 #7
0
ファイル: CCtocsyCA.c プロジェクト: timburrow/ovj3
pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */


 
int         t1_counter;  		        /* used for states tppi in t1 */


double      tau1,         				         /*  t1 delay */
	    TC = getval("TC"), 		   /* Constant delay 1/(JCC) ~ 13.5 ms */
            mix = getval("mix"),	   /* TOCSY mixing time */
            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	rf0,            	  /* maximum fine power when using pwC pulses */

/* 90 degree pulse at Cab (46ppm), first off-resonance null at CO (174ppm)    */
        pwC1,		              /* 90 degree pulse length on C13 at rf1 */
        rf1,		       /* fine power for 5.1 kHz rf for 600MHz magnet */

/* 180 degree pulse at Ca (46ppm), first off-resonance null at CO(174ppm)     */
        pwC2,		                    /* 180 degree pulse length at rf2 */
        rf2,		      /* fine power for 11.4 kHz rf for 600MHz magnet */


   compC = getval("compC"),       /* adjustment for C13 amplifier compression */




	sw1 = getval("sw1"),

	gt1 = getval("gt1"),  		     
	gzlvl1 = getval("gzlvl1"),

	gt2 = getval("gt2"),				   
	gzlvl2 = getval("gzlvl2"),
        gstab = getval("gstab"),
        ppm,
        co_ofs = getval("co_ofs"),	/* offset for C' */
        co_bw = getval("co_bw"),	/* bandwidth for C' */
        copwr = getval("copwr"),	/* power for C' decoupling. Get from CO_dec.DEC*/
	codmf = getval("codmf"),	/* dmf for C' decoupling. Get from CO_dec.DEC  */
        codres = getval("codres"), 	/* dres for C' decoupling. Get from CO_dec.DEC */
        mixbw,                          /* band width for mixing shape */
        mixpwr = getval("mixpwr"),   	/* power for CC mixing. Get from ccmix.DEC*/
        mixdmf= getval("mixdmf"),  	/* dmf for CC decoupling. Get from ccmix.DEC  */
        mixdres = getval("mixdres"); 	/* dres for CC decoupling. Get from ccmix.DEC */ 



/*   LOAD PHASE TABLE    */

	settable(t1,2,phi1);
        settable(t2,1,phi2);
	settable(t3,1,phi3);
	settable(t12,2,rec);

        setautocal();           /* activate auto-calibration */

/*   INITIALIZE VARIABLES   */



    /* maximum fine power for pwC pulses */
	rf0 = 4095.0;

    /* 90 degree pulse on Cab, null at CO 128ppm away */
	pwC1 = sqrt(15.0)/(4.0*128.0*sfrq);
        rf1 = (compC*4095.0*pwC)/pwC1;
	rf1 = (int) (rf1 + 0.5);
	
    /* 180 degree pulse on Cab, null at CO 128ppm away */
        pwC2 = sqrt(3.0)/(2.0*128.0*sfrq);
	rf2 = (4095.0*compC*pwC*2.0)/pwC2;
	rf2 = (int) (rf2 + 0.5);	
	if( rf2 > 4295 )
         { printf("increase pwClvl"); psg_abort(1);}
	if(( rf2 > 4095 ) && (rf2 <4296)) rf2=4095; 



/* CHECK VALIDITY OF PARAMETER RANGES */


      if ( 0.5*ni*1/(sw1) > TC)
       { printf(" ni is too big. Make ni equal to %d or less.\n", 
         ((int)((TC)*2.0*sw1))); psg_abort(1);}


/* PHASES AND INCREMENTED TIMES */

/*  Phase incrementation for hypercomplex 2D data, States-Haberkorn element */

    if (phase1 == 2)    tsadd(t1,1,4);  
   
    tau1 = d2;
    tau1 = tau1/2.0;

/* Calculate modifications to phases for States-TPPI acquisition          */

   if( ix == 1) d2_init = d2;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) 
	{ tsadd(t1,2,4); tsadd(t12,2,4); }


	if (autocal[0] == 'y')
        {
         if(FIRST_FID)
         {
          ppm = getval("sfrq");
          ofs_check(C13ofs);
          co_ofs = (C13ofs+118.0)*ppm; co_bw = 20*ppm; 
          CO_dec = pbox_Dsh("CO_dec", "SEDUCE1", co_bw, co_ofs, pwC*compC, pwClvl); 
          copwr = CO_dec.pwr; codmf = CO_dec.dmf; codres = CO_dec.dres;
          mixbw = sw1;
          mix_seq = pbox_Dsh("mix_seq", "FLOPSY8", mixbw, 0.0, pwC*compC, pwClvl);
          mixpwr = mix_seq.pwr; mixdmf = mix_seq.dmf; mixdres = mix_seq.dres; 
         }
        }
/* BEGIN PULSE SEQUENCE */

status(A);
   	delay(d1);
        if ( dm3[B] == 'y' )
          { lk_hold(); lk_sampling_off();}  /*freezes z0 correction, stops lock pulsing*/

	rcvroff();
	obspower(pwClvl);
	decpower(tpwr);
 	dec2power(dpwr2);
        dec3power(dpwr3);
	obspwrf(rf1);			/*fine power for Cab 90 degree pulse */
	obsoffset(tof);			/*13C carrier at 46 ppm */
	txphase(zero);
   	delay(1.0e-5);

status(B);        
        rgpulse(pwC1, t1, 0.0,0.0);


/*   xxxxxxxxxxxxxxxxxxxxxx   13Cab Constant Time Evolution       xxxxxxxxxxxxxxxxxx    */

       obspower(copwr); obspwrf(rf0); txphase(zero);
       obsunblank();
       xmtron();
       obsprgon("CO_dec",1.0/codmf,codres);

       if ( dm3[B] == 'y' )   /* turns on 2H decoupling  */
            {
            dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
            dec3unblank();
            dec3phase(zero);
            delay(2.0e-6);
            setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
            delay(TC - tau1 - pwC2/2 - 1/dmf3);
            }
       else
       delay(TC - tau1 - pwC2/2);
       obsprgoff();
       xmtroff();
       obsblank();
       obspower(pwClvl); obspwrf(rf2);
       rgpulse(pwC2, zero, 0.0, 0.0);
       obspower(copwr); obspwrf(rf0); txphase(zero);
       obsunblank();
       xmtron();
       obsprgon("CO_dec",1.0/codmf,codres);

       if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           delay(TC + tau1 - pwC2/2 - 1/dmf3);
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           lk_autotrig();   /* resumes lock pulsing */
           }
       else
       delay(TC + tau1 - pwC2/2);

       obsprgoff();
       xmtroff();
       obsblank();
       obspower(pwClvl); obspwrf(rf1);

       rgpulse(pwC1,t2,0.0,0.0);
       status(C);
       zgradpulse(gzlvl1, gt1);
       delay(gstab);
/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxx  FLOPSY 8 Spin lock for mixing xxxxxxxxxxxxxxxxxxxx	*/
       obspower(mixpwr); obspwrf(rf0); txphase(zero);
       obsunblank();
       xmtron();
       obsprgon("mix_seq",1.0/mixdmf,mixdres);
       delay(mix-gt1-gt2);
       obsprgoff();
       xmtroff();
       obsblank();
       obspower(pwClvl); obspwrf(rf1);
       zgradpulse(gzlvl2,gt2);
       delay(gstab);
       rgpulse(pwC1,t3,0.0,rof2);
       getelem(t3,ct,v3);
       add(v3,one,v3);
       obspower(pwClvl); obspwrf(rf0);
       delay(350e-6-rof2);
       rgpulse(pwC*2.0,v3,0.0,0.0);
       delay(350e-6);
       
       status(D);
       setreceiver(t12); 
       
}		 
コード例 #8
0
ファイル: hmcmcgcbcacoA.c プロジェクト: timburrow/ovj3
pulsesequence()
{
/* DECLARE VARIABLES */

 char       fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ fulldwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            C_flg[MAXSTR],
            dtt_flg[MAXSTR];

 int         phase, phase2, ni, ni2, 
             t1_counter,   /* used for states tppi in t1           */ 
             t2_counter;   /* used for states tppi in t2           */ 

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JHC =  1.6 ms */
             taub,         /*    1/6JCH =   1.1 ms  */
             BigTC,        /* Carbon constant time period = 1/4Jcc = 7.0 ms */ 
             pwN,          /* PW90 for 15N pulse @ pwNlvl           */
             pwC,          /* PW90 for c nucleus @ pwClvl         */
             pwcrb180,      /* PW180 for C 180 reburp @ rfrb */
             pwClvl,        /* power level for 13C pulses on dec1  */
             compC, compH,  /* compression factors for H1 and C13 amps */
	     rfrb,       /* power level for 13C reburp pulse     */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             bw, ofs, ppm,

	     gt0,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gstab,

             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
        
             decstep1,
             decstep2,
             decstep3,

             tpwrs,
             pwHs, 
             dof_me, rfrb_cg, rfrb_co, pwrb_co, pwrb_cg,
             
             tof_dtt,

             rfca90,
             pwca90,
             rfca180,
             pwca180,
             pwco90,

             dofCO;
             
   
/* LOAD VARIABLES */

  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("fscuba",fscuba);

  getstr("C_flg",C_flg);
  getstr("dtt_flg",dtt_flg); 

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  BigTC  = getval("BigTC");
  pwC = getval("pwC");
  pwcrb180 = getval("pwcrb180");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  pwClvl = getval("pwClvl");
  compC = getval("compC");
  compH = getval("compH");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni = getval("ni");
  ni2 = getval("ni2");

  gstab = getval("gstab");
  gt0 = getval("gt0");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
 
  gzlvl0 = getval("gzlvl0");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
 
  decstep1 = getval("decstep1");
  decstep2 = getval("decstep2");
  decstep3 = getval("decstep3");

  pwHs = getval("pwHs");
  dof_me = getval("dof_me");
  tof_dtt = getval("tof_dtt");

  dofCO = getval("dofCO");

  tpwrs = 0.0;
  setautocal();                      /* activate auto-calibration */   

  if(FIRST_FID)                                         /* make shapes */
  {
    ppm = getval("dfrq"); 
    bw = 80.0*ppm;  
    rb180 = pbox_make("rb180P", "reburp", bw, 0.0, compC*pwC, pwClvl);
    bw = 8.125*ppm;  ofs = -24.0*ppm;
    rb180_cg = pbox_make("rb180_cgP", "reburp", bw, ofs, compC*pwC, pwClvl);
    bw = 60*ppm;  ofs = 136.0*ppm;
    rb180_co = pbox_make("rb180_coP", "reburp", bw, ofs, compC*pwC, pwClvl);
    bw = 118.0*ppm; ofs = -118.0*ppm;
    ca180 = pbox_make("ca180P", "square180n", bw, ofs, compC*pwC, pwClvl);
    bw = 118.0*ppm; ofs = 18.0*ppm;
    ca90 = pbox_make("ca90P", "square90n", bw, ofs, compC*pwC, pwClvl);

  }
  pwcrb180 = rb180.pw;   rfrb = rb180.pwrf;             /* set up parameters */
  pwrb_cg = rb180_cg.pw; rfrb_cg = rb180_cg.pwrf;             /* set up parameters */
  pwrb_co = rb180_co.pw; rfrb_co = rb180_co.pwrf;             /* set up parameters */
  pwca90 = ca90.pw;      rfca90 = ca90.pwrf;             /* set up parameters */
  pwca180 = ca180.pw;    rfca180 = ca180.pwrf;             /* set up parameters */
  pwco90 = pwca90;
  tpwrs = tpwr - 20.0*log10(pwHs/((compH*pw)*1.69));   /* sinc=1.69xrect */
  tpwrs = (int) (tpwrs);              

/* LOAD PHASE TABLE */

  settable(t1,2,phi1);
  settable(t2,4,phi2);
  settable(t3,4,phi3);
  settable(t4,4,phi4);
  settable(t5,1,phi5);
  settable(t6,16,phi6);
  settable(t7,8,phi7);
  settable(t8,8,phi8);
  settable(t9,8,phi9);
  settable(t10,1,phi10);
  settable(t11,8,phi11);
  settable(t12,16,rec);

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( BigTC - 0.5*(ni2-1)*1/(sw2) - WFG_STOP_DELAY - POWER_DELAY 
              - 4.0e-6
              < 0.2e-6 )
    {
        printf(" ni2 is too big\n");
        psg_abort(1);
    }


    if((dm[A] == 'y' || dm[B] == 'y' ))
    {
        printf("incorrect dec1 decoupler flags!  ");
        psg_abort(1);
    }

    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y'))
    {
        printf("incorrect dec2 decoupler flags! Should be 'nnn' ");
        psg_abort(1);
    }

    if( satpwr > 9 )
    {
        printf("SATPWR too large !!!  ");
        psg_abort(1);
    }

    if( dpwr > 48 )
    {
        printf("don't fry the probe, DPWR too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > -16 )
    {
        printf("don't fry the probe, DPWR2 too large!  ");
        psg_abort(1);
    }

    if( pw > 200.0e-6 )
    {
        printf("dont fry the probe, pw too high ! ");
        psg_abort(1);
    } 

    if( pwN > 200.0e-6 )
    {
        printf("dont fry the probe, pwN too high ! ");
        psg_abort(1);
    } 

    if( pwC > 200.0e-6 )
    {
        printf("dont fry the probe, pwC too high ! ");
        psg_abort(1);
    } 

    if( pwcrb180 > 500.0e-6 )
    {  
        printf("dont fry the probe, pwcrb180 too high ! ");
        psg_abort(1);
    } 

    if(dpwr3 > 51)
    {
       printf("dpwr3 is too high; < 52\n");
       psg_abort(1);
    }


   if(d1 < 1)
    {
       printf("d1 must be > 1\n");
       psg_abort(1);
    }

    if(  gt0 > 5.0e-3 || gt1 > 5.0e-3  || gt2 > 5.0e-3 ||
         gt3 > 5.0e-3 || gt4 > 5.0e-3 || gt5 > 5.0e-3 || gt6 > 5.0e-3  )
    {  printf(" all values of gti must be < 5.0e-3\n");
        psg_abort(1);
    }

/*  Phase incrementation for hypercomplex 2D data */

    if (phase == 2) {
      tsadd(t11,1,4);
    }

    if (phase2 == 2)
      tsadd(t10,1,4);

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    tau1 = tau1 - 4.0/PI*pwco90 - POWER_DELAY - WFG_START_DELAY 
           - 4.0e-6 - pwca180 - WFG_STOP_DELAY - POWER_DELAY - 2.0*pwN;

    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1) );
        if(tau1 < 0.4e-6) tau1 = 4.0e-7;
    }
        tau1 = tau1/2.0;

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) ); 
        if(tau2 < 0.4e-6) tau2 = 4.0e-7;
    }
        tau2 = tau2/2.0;

/* Calculate modifications to phases for States-TPPI acquisition          */

   if( ix == 1) d2_init = d2 ;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) {
      tsadd(t11,2,4);     
      tsadd(t12,2,4);    
    }

   if( ix == 1) d3_init = d3 ;
   t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );
   if(t2_counter % 2) {
      tsadd(t10,2,4);  
      tsadd(t12,2,4);    
    }

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(satpwr);      /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 to high power       */

/* Presaturation Period */

   if (satmode[A] == 'y')
   {
	delay(2.0e-5);
        rgpulse(d1,zero,2.0e-6,2.0e-6);  /* presat with transmitter */
   	obspower(tpwr);      /* Set transmitter power for hard 1H pulses */
	delay(2.0e-5);
	if(fscuba[0] == 'y')
	{
		delay(2.2e-2);
		rgpulse(pw,zero,2.0e-6,0.0);
		rgpulse(2.0*pw,one,2.0e-6,0.0);
		rgpulse(pw,zero,2.0e-6,0.0);
		delay(2.2e-2);
	}
   }
   else
   {
    delay(d1);
   }
   obspower(tpwr);           /* Set transmitter power for hard 1H pulses */
   txphase(t1);
   decphase(zero);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

   decoffset(dof_me);

   lk_hold(); lk_sampling_off();

   rcvroff();
   delay(20.0e-6);

/* ensure that magnetization originates on 1H and not 13C */

   if(dtt_flg[A] == 'y') {
     obsoffset(tof_dtt);

     obspower(tpwrs);
     shaped_pulse("H2Osinc",pwHs,zero,10.0e-6,0.0);
     obspower(tpwr);
     obsoffset(tof); 
   }
 
   decrgpulse(pwC,zero,0.0,0.0);
 
   delay(2.0e-6);
   zgradpulse(gzlvl0,gt0);
   delay(gstab);

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */

   delay(2.0e-6);
   zgradpulse(gzlvl1,gt1);
   delay(gstab);

   delay(taua - gt1  -gstab -2.0e-6 ); 

   simpulse(2.0*pw,2.0*pwC,zero,zero,0.0,0.0);
   txphase(one);

   delay(taua - gt1 - gstab -2.0e-6); 
   	
   delay(2.0e-6);
   zgradpulse(gzlvl1,gt1);
   delay(gstab);

   rgpulse(pw,one,0.0,0.0);

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,zero,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   decoffset(dof);  /* jump 13C to 40 ppm */

   delay(2.0e-6);
   zgradpulse(gzlvl2,gt2);
   delay(gstab);

   decrgpulse(pwC,t1,4.0e-6,0.0); decphase(zero); 

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decpwrf(rfrb);
   delay(BigTC - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t2);

   decpwrf(4095.0);
   delay(BigTC - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t2,0.0,0.0);
   decphase(zero);

   /* turn on 2H decoupling */
   dec3phase(one);
   dec3power(dpwr3);
   dec3rgpulse(1/dmf3,one,4.0e-6,0.0); 
   dec3phase(zero);
   dec3unblank();
   dec3prgon(dseq3,1/dmf3,dres3);
   dec3on();
   /* turn on 2H decoupling */

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decpwrf(rfrb);

   delay(BigTC - POWER_DELAY - 4.0e-6 - 1/dmf3
         - POWER_DELAY - PRG_START_DELAY - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t3);

   decpwrf(4095.0);
   delay(BigTC - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t3,0.0,0.0);
   decpwrf(rfrb_cg); decphase(zero);

   delay(BigTC/2.0 - POWER_DELAY - WFG_START_DELAY - 0.5*pwrb_cg);
   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(rfrb);

   delay(BigTC/2.0 - 0.5*pwrb_cg - WFG_STOP_DELAY - POWER_DELAY - SAPS_DELAY
         - 2.0e-6 - WFG_START_DELAY);

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decshaped_pulse(rb180.name,pwcrb180,zero,2.0e-6,0.0);
   dcplrphase(zero);

   decpwrf(rfrb_cg); decphase(zero);

   delay(BigTC/2.0 - WFG_STOP_DELAY - SAPS_DELAY 
                  - POWER_DELAY - WFG_START_DELAY - 0.5*pwrb_cg);

   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(4095.0); decphase(t4);

   delay(BigTC/2.0 - 0.5*pwrb_cg - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t4,0.0,0.0);

   decpwrf(rfrb_co); decphase(zero);
   decshaped_pulse(rb180_co.name,pwrb_co,zero,4.0e-6,0.0);  /* BS */
   decpwrf(rfrb); 
   delay(taub - (2.0/PI)*pwC - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
         - pwrb_co - WFG_STOP_DELAY - 2.0e-6
         - WFG_START_DELAY);

   initval(1.0,v3);
   decstepsize(decstep2);
   dcplrphase(v3);

   decshaped_pulse(rb180.name,pwcrb180,zero,2.0e-6,0.0);
   dcplrphase(zero); decpwrf(rfrb_co); 
   decshaped_pulse(rb180_co.name,pwrb_co,zero,4.0e-6,0.0);
   decphase(t5);
   decpwrf(rfca90); 

   delay(taub - WFG_STOP_DELAY - 4.0e-6 - WFG_START_DELAY
         - pwcrb180 - WFG_STOP_DELAY - POWER_DELAY 
         - WFG_START_DELAY - (2.0/PI)*pwca90);

   decshaped_pulse(ca90.name,pwca90,t5,0.0,0.0);

   decoffset(dofCO);

   /* 2H decoupling off */
   dec3off();
   dec3prgoff();
   dec3blank();
   dec3rgpulse(1/dmf3,three,4.0e-6,0.0);
   /* 2H decoupling off */

   delay(2.0e-6); 
   zgradpulse(gzlvl5,gt5);
   delay(gstab);

   decrgpulse(pwco90,t11,4.0e-6,0.0);

   if(C_flg[A] == 'n') {

   decpwrf(rfca180);  

   delay(tau1);
   decshaped_pulse(ca180.name,pwca180,zero,4.0e-6,0.0);
   decpwrf(rfca90); decphase(zero);
   dec2rgpulse(2.0*pwN,zero,0.0,0.0);
   delay(tau1);

   }

   else 
     decrgpulse(2.0*pwco90,zero,4.0e-6,4.0e-6);
   decrgpulse(pwco90,zero,0.0,0.0);

   delay(2.0e-6);
   zgradpulse(gzlvl6,gt6);
   delay(gstab);

   /* turn on 2H decoupling */
   dec3phase(one);
   dec3rgpulse(1/dmf3,one,4.0e-6,0.0); 
   dec3phase(zero);
   dec3unblank();
   dec3prgon(dseq3,1/dmf3,dres3);
   dec3on();
   /* turn on 2H decoupling */

   decoffset(dof);

   decpwrf(rfca90);

   decshaped_pulse(ca90.name,pwca90,t6,4.0e-6,0.0);

   decpwrf(rfrb_co); decphase(zero);

   delay(taub - WFG_STOP_DELAY - (2.0/PI)*pwca90 - POWER_DELAY - WFG_START_DELAY
         - pwrb_co - WFG_STOP_DELAY - 2.0e-6
         - WFG_START_DELAY);

   decshaped_pulse(rb180_co.name,pwrb_co,zero,0.0,0.0);
   decpwrf(rfrb); 
   initval(1.0,v3);
   decstepsize(decstep3);
   dcplrphase(v3);

   decshaped_pulse(rb180.name,pwcrb180,zero,2.0e-6,0.0);
   dcplrphase(zero);
   decpwrf(rfrb_co); 
   delay(taub - WFG_STOP_DELAY - 4.0e-6 - WFG_START_DELAY
         - pwcrb180 - WFG_STOP_DELAY - POWER_DELAY - 4.0e-6 
         - (2.0/PI)*pwC);
  
   decshaped_pulse(rb180_co.name,pwrb_co,zero,4.0e-6,0.0);  /* BS */

   decpwrf(4095.0); 
   decrgpulse(pwC,t7,4.0e-6,0.0);

   decpwrf(rfrb_cg); decphase(zero);

   delay(BigTC/2.0 - POWER_DELAY - WFG_START_DELAY - 0.5*pwrb_cg);
   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(rfrb);

   delay(BigTC/2.0 - 0.5*pwrb_cg - WFG_STOP_DELAY - POWER_DELAY - SAPS_DELAY
         - 2.0e-6 - WFG_START_DELAY);

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decshaped_pulse(rb180.name,pwcrb180,zero,2.0e-6,0.0);
   dcplrphase(zero);

   decpwrf(rfrb_cg); decphase(zero);

   delay(BigTC/2.0 - WFG_STOP_DELAY - SAPS_DELAY 
                  - POWER_DELAY - WFG_START_DELAY - 0.5*pwrb_cg);

   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(4095.0); decphase(t8);

   delay(BigTC/2.0 - 0.5*pwrb_cg - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t8,0.0,0.0);
   decphase(zero);

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decpwrf(rfrb);
   delay(BigTC - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t9);

   decpwrf(4095.0);
   delay(BigTC - WFG_STOP_DELAY - POWER_DELAY
          - PRG_STOP_DELAY - POWER_DELAY - 4.0e-6 - 1/dmf3);

   /* 2H decoupling off */
   dec3off();
   dec3prgoff();
   dec3blank();
   dec3rgpulse(1/dmf3,three,4.0e-6,0.0);
   lk_autotrig();
   /* 2H decoupling off */

   decrgpulse(pwC,t9,0.0,0.0);
   decphase(zero);

   delay(tau2);
   rgpulse(2.0*pw,zero,0.0,0.0);

   initval(1.0,v3);
   decstepsize(decstep1);
   dcplrphase(v3);

   decpwrf(rfrb);
   delay(BigTC - 2.0*pw - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t10);
   decpwrf(4095.0);

   delay(BigTC - tau2 - WFG_STOP_DELAY - POWER_DELAY - 4.0e-6);

   decrgpulse(pwC,t10,4.0e-6,0.0);


   decoffset(dof_me);

   delay(2.0e-6);
   zgradpulse(gzlvl3,gt3);
   delay(gstab);

   lk_sample();

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,zero,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   rgpulse(pw,zero,4.0e-6,0.0);

   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(gstab);

   delay(taua - gt4 - gstab -2.0e-6
         - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
         - pwHs - WFG_STOP_DELAY - POWER_DELAY - 2.0e-6);

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,two,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   simpulse(2.0*pw,2.0*pwC,zero,zero,2.0e-6,0.0);

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,two,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(gstab);
 
   delay(taua 
         - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
         - pwHs - WFG_STOP_DELAY - POWER_DELAY 
         - gt4 - gstab -2.0e-6 - 2.0*POWER_DELAY);

   decpower(dpwr);  /* Set power for decoupling */
   dec2power(dpwr2);


/* BEGIN ACQUISITION */
   lk_sample();

status(C);
   setreceiver(t12);

}
コード例 #9
0
ファイル: caco.c プロジェクト: timburrow/ovj3
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */
int         t1_counter, t2_counter;	/* used for states tppi in t1 & t2*/

char	    IPAP[MAXSTR], Hstart[MAXSTR],
            f1180[MAXSTR],H2dec[MAXSTR],
            shCACB_90[MAXSTR],shCACB_90r[MAXSTR],
	    shCACB_180[MAXSTR], shCB_180[MAXSTR], decCB[MAXSTR],
            shCACB_180off[MAXSTR],
            shCBIP[MAXSTR],
	    shCO_90[MAXSTR],            
	    shCO_180[MAXSTR],
            shCO_180off[MAXSTR];

double
	    tau1,			/*  t1 delay */
               x,
            TCH = getval("TCH"), 
	    TC = getval("TC"), 		/* delay 1/(2JCACB) ~  7.0ms in Ref. */ 
            del = getval("del"),	/* delay del = 1/(2JC'C) ~ 9.0ms in Ref. */         
            pwClvl = getval("pwClvl"), 	/* coarse power for C13 pulse */
            pwC = getval("pwC"),        /* C13 90 degree pulse length at pwClvl */
            compC = getval("compC"),    /* adjustment for C13 amplifier compression */
	    pwClvlF=getval("pwClvlF"),   /* maximum fine power when using pwC pulses */

	     pwHlvl = getval("pwHlvl"),
             pwH = getval("pwH"),
	    

        pwCBIP  =  getval("pwCBIP"),	
  /* 90 degree pulse at CO (174ppm)    */
      
        pwCO_90  =  getval("pwCO_90"),			/* 90 degree pulse length on C13  */
        pwCO_90phase_roll  =  getval("pwCO_90phase_roll") , /* fraction of CACB pulse to compensate for phase roll */
        pwrCO_90 =  getval("pwrCO_90"),		       	/*power  */
        pwrfCO_90 = getval("pwrfCO_90"),
        
/* 180 degree pulse at CO (174ppm)  */

        pwCO_180   =  getval("pwCO_180"),			/* 180 degree pulse length on C13  */
        pwrCO_180  =  getval("pwrCO_180"),		       	/*power  */
        pwrfCO_180 =  getval("pwrfCO_180"),

/* 90 degree pulse at CAB (57.7ppm)  */

        tofCACB    =  getval("tofCACB"), 
        pwCACB_90  =  getval("pwCACB_90"),
        pwCACB_90phase_roll  =  getval("pwCACB_90phase_roll") , /* fraction of CACB pulse to compensate for phase roll */

			/* 90 degree pulse length on C13  */
        pwrCACB_90 =  getval("pwrCACB_90"),		       	/*power  */
        pwrfCACB_90 = getval("pwrfCACB_90"),

/* 180 degree pulse at CA (57.7ppm)  */
        pwCACB_180   =  getval("pwCACB_180"),			/* 180 degree pulse length on C13  */
        pwrCACB_180  =  getval("pwrCACB_180"),		       	/*power  */
        pwrfCACB_180 =  getval("pwrfCACB_180"),

        pwCB_180   =  getval("pwCB_180"),			/* 180 degree pulse length on C13  */
        pwrCB_180  =  getval("pwrCB_180"),
 

	sw1 = getval("sw1"),
        sw2 = getval("sw2"),

	gt1 = getval("gt1"),  		     
	gzlvl1 = getval("gzlvl1"),

	gt2 = getval("gt2"),				   
	gzlvl2 = getval("gzlvl2"),
        gt3 = getval("gt3"),
        gzlvl3 = getval("gzlvl3"),
        gstab = getval("gstab");
        getstr("IPAP",IPAP); 
        getstr("H2dec",H2dec); 

         getstr("shCBIP",shCBIP);
         getstr("f1180",f1180);
	 getstr("shCACB_90",shCACB_90); getstr("shCACB_90r",shCACB_90r);
         getstr("shCACB_180",shCACB_180); getstr("shCACB_180off",shCACB_180off);
         getstr("shCB_180",shCB_180); getstr("decCB",decCB);
	 getstr("shCO_90",shCO_90);
         getstr("shCO_180",shCO_180);    getstr("shCO_180off",shCO_180off);

	getstr("Hstart",Hstart);

/*   LOAD PHASE TABLE    */
	settable(t1,4,phi1);
        settable(t2,4,phi2);
	settable(t3,4,phi3);
	settable(t4,4,phi4);
        settable(t5,4,phi5);
	settable(t12,4,rec);
        

         

	 

/*   INITIALIZE VARIABLES   */
if( (IPAP[A] != 'i') &&  (IPAP[A] != 'a')&&  (IPAP[A] != 't'))
  { text_error("IPAP flag either i or a, exiting "); psg_abort(1); }

if( (Hstart[A]=='y') && ((dmm[A]!='c' || dm[A]=='y')) ) 
{ 
 text_error("Incorrect combination of dm, dmm and Hstart.  "); 
                         psg_abort(1);};


x=0.0;
if(decCB[A]=='y'){x=1.0;}
if(ni/sw1 > TC-2.0*pwCB_180*x) { 

 text_error("too many increments in CAB t1 evolution %d\n",(int)( (TC-2.0*pwCB_180*x)*sw1 +0.5)); 
                         psg_abort(1);};


/* PHASES AND INCREMENTED TIMES */

/*  Phase incrementation for hypercomplex 2D data, States-Haberkorn element */

    if (phase1 == 2)    tsadd(t1,1,4);  
    
    tau1 = d2;
    if(f1180[A]=='y') {tau1+=0.5/sw1;}
    tau1 = tau1/2.0;

    
/* Calculate modifications to phases for States-TPPI acquisition          */
if(IPAP[A]=='a'){tsadd(t4,1,4);};




   if( ix == 1) d2_init = d2;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) 
	{ tsadd(t1,2,4); tsadd(t12,2,4); }

/* BEGIN PULSE SEQUENCE */

status(A);
   	 delay(10.0e-6);
        obspower(pwClvl);
        obspwrf(4095.0);
        dec2power(dpwr2); dec2pwrf(4095.0);
   	obsoffset(tofCACB);
        delay(d1);


/* option to start from H magnetization */
if(Hstart[A]=='y') 
     {
	decpower(pwHlvl); decpwrf(4095.0);

	   decrgpulse(pwH, zero, 0.0, 0.0);
	   delay(TCH);
	   simpulse(2.0*pwC,2.0*pwH, zero,zero, 0.0, 0.0);
	   delay(TCH);
	   decrgpulse(pwH, one, 0.0, 0.0);

	   zgradpulse(gzlvl2,gt2);
	   delay(gstab);

 	   rgpulse(pwC, two, 0.0, 0.0);
 	    delay(TCH);
 	    simpulse(2.0*pwC,2.0*pwH, zero,zero, 0.0, 0.0);
 	    delay(TCH);
  	    rgpulse(pwC, one, 0.0, 0.0);

	    zgradpulse(gzlvl3,gt3);
	     delay(gstab*2.0);

	decpower(dpwr); decpwrf(4095.0);
}


if (H2dec[A] == 'y') lk_hold();
status(B);
 /* CACO experiment */     

/************optional deuterium decoupling**************************/
	if(H2dec[A] == 'y'){  dec3unblank();
                             if(1.0/dmf3>900.0e-6) {
						     dec3power(dpwr3+6.0);
						     dec3rgpulse(0.5/dmf3, one, 1.0e-6, 0.0e-6);
						     dec3power(dpwr3);
						     }
			   else dec3rgpulse(1.0/dmf3, one, 1.0e-6,0.0e-6);
  			   dec3phase(zero);       setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
	                    }	

/**************************************/

	/* begin CA   evolution and transfer to CO */


        obspwrf(pwrfCACB_90);  obspower(pwrCACB_90);
	shapedpulse(shCACB_90,pwCACB_90,t1,0.0,0.0);


        obspwrf(4095.0);  obspower(pwClvl);

 
        delay(10.0e-6);
        shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);
        delay(10.0e-6);

        if(decCB[A]=='y') {
                delay( (TC/2.0-tau1 + 2.0*pwCACB_90phase_roll*pwCACB_90)*0.5 -pwCB_180*0.5);
         	obspower(pwrCB_180);
	 	shapedpulse(shCB_180,pwCB_180,zero,0.0,0.0);
                delay( (TC/2.0-tau1 + 2.0*pwCACB_90phase_roll*pwCACB_90)*0.5 -pwCB_180*0.5);
		}

        else	delay(TC/2.0-tau1 + 2.0*pwCACB_90phase_roll*pwCACB_90);
        
        obspower(pwClvl);
        shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);
   
       if(decCB[A]=='y') {
			delay((TC/2.0+tau1)*0.5 -pwCB_180*0.5);
         		obspower(pwrCB_180);
	 		shapedpulse(shCB_180,pwCB_180,zero,0.0,0.0);
			delay((TC/2.0+tau1)*0.5 -pwCB_180*0.5);
           }
        else delay(TC/2.0+tau1);

        obspower(pwrCACB_90);
	shapedpulse(shCACB_90r,pwCACB_90,one,0.0,0.0);

/*************************************************************/
 	if(H2dec[A] == 'y')  {                     
	                    setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
                             

                             if(1.0/dmf3>900.0e-6) {
						     dec3power(dpwr3+6.0);
						     dec3rgpulse(0.5/dmf3, three, 1.0e-6, 0.0e-6);
						     dec3power(dpwr3);
						     }

	                    else dec3rgpulse(1.0/dmf3, three, 1.0e-6, 0.0e-6);	    dec3blank();  
			   }
/*************************************************************/

    /* CAzCOz */

 
         delay(10e-6);
         obsoffset(tof);
         delay(10e-6);
	zgradpulse(gzlvl1,gt1);
	delay(gstab);
status(C);
     /* CAzCOz ->  CO or CACO */

        obspwrf(pwrfCO_90);  obspower(pwrCO_90);
	shapedpulse(shCO_90,pwCO_90,t4,0.0,0.0);

        /* ghost 180 on CA*/
     
  if(IPAP[A]=='i')   {

       obspwrf(pwClvlF);  obspower(pwClvl);
        delay(10.0e-6);
        shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);
        delay(10.0e-6);

         
       delay(del/2.0 + pwCO_90phase_roll*pwCO_90);

 	obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
 	delay(10.0e-6);
 	shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
  	obspwrf(pwClvlF);  obspower(pwClvl);
 	delay(10.0e-6);

       shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);

	obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
 	delay(10.0e-6);
 	shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
  
 	delay(10.0e-6);


       delay(del/2.0 );
  }


/***>>>>>>>>>>>**TEST*********/
  if(IPAP[A]=='t')   {
         obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
        delay(10.0e-6);
        shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
        delay(10.0e-6);
        obspwrf(pwrfCO_180); obspower(pwrCO_180);
	delay(del/2.0);
   

     shapedpulse(shCO_180,pwCO_180,zero,0.0,0.0);

        
        obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
        delay(10.0e-6);
         shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
        delay(10.0e-6);

        obspwrf(pwrfCO_90);  obspower(pwrCO_90);
        delay(del/2.0);
  }

/********<<<<<<<<<<<<<**TEST*********/

  if(IPAP[A]=='a')   {

       obspwrf(pwClvlF);  obspower(pwClvl);
          
        delay(10.0e-6);
        shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);
        delay(10.0e-6);

         
        delay(del/4.0 + pwCO_90phase_roll*pwCO_90);

 	obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
 	delay(10.0e-6);
 	shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
  	obspwrf(pwClvlF);  obspower(pwClvl);

 	delay(10.0e-6);
        delay(del/4.0 );

       shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);

        delay(del/4.0);

	obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
 	delay(10.0e-6);
 	shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
  
 	delay(10.0e-6);

       delay(del/4.0 );
  }

 if (H2dec[A]=='y') lk_sample();

status(D);
	setreceiver(t12);
	
}
コード例 #10
0
ファイル: ghncacb_trosy_3DA.c プロジェクト: timburrow/ovj3
pulsesequence()

{

/* DECLARE VARIABLES */

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            ddseq[MAXSTR],    /* deuterium decoupling sequence */
            shp_sl[MAXSTR],

            shcreb[MAXSTR],  /* reburp shape for center of t1 period */
            shcgcob[MAXSTR], /* g3 inversion at 154 ppm (350 us) */
            shcgcoib[MAXSTR],  /* g3 time inversion at 154 ppm (350 us) */
            shca180[MAXSTR],   /* Ca 180 [D/sq(3)] during 15N CT */
            shco180[MAXSTR],   /* Co 180 [D/sq(15)] during 15N CT */
            sel_flg[MAXSTR],   /* active/passive purging of undesired 
                                  component  */ 
            fCT[MAXSTR],	       /* Flag for constant time C13 evolution */
            fc180[MAXSTR],
            cal_sphase[MAXSTR],
            shared_CT[MAXSTR],
            nietl_flg[MAXSTR];

 int         phase, phase2, ni2, icosel, 
             t1_counter,   /* used for states tppi in t1           */ 
             t2_counter;   /* used for states tppi in t2           */ 

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             del1,       /* time for C'-N to refocus set to 0.5*24.0 ms */
             bigTN,        /* nitrogen T period */
             bigTC,        /* carbon T period */
             zeta,         /* delay for transfer from ca to cb = 3.5 ms */
             tsatpwr,      /* low level 1H trans.power for presat  */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             tauf,         /* 1/2J NH value                     */
             pw_sl,        /* selective pulse on water      */
             phase_sl,     /* phase on water      */
             tpwrsl,       /* power for pw_sl               */
             at,

             d_cgcob,     /* power level for g3 pulses at 154 ppm */
             d_creb,      /* power level for reburp 180 at center of t1 */
             pwcgcob,     /* g3 ~ 35o us 180 pulse */
             pwcreb,      /* reburp ~ 400us 180 pulse */ 
 
             pwD,        /* 2H 90 pulse, about 125 us */
             pwDlvl,        /* 2H 90 pulse, about 125 us */

             pwca180,     /* Ca 180 during N CT at d_ca180 */
             pwco180,     /* Co 180 during N CT at d_co180 */

             d_ca180,
             d_co180,

             compC = getval("compC"),	/* C-13 RF calibration parameters */
             pwC = getval("pwC"),
             pwClvl = getval("pwClvl"),

             pwN,
             pwNlvl,

             sphase,

             pw_sl1,
             tpwrsl1,

             gstab,

             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gt9,
             gt11,
             gt13,
             gt14,

             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8,
             gzlvl9,
             gzlvl11,
             gzlvl13,
             gzlvl14;
            
/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */


  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("fscuba",fscuba);
  getstr("ddseq",ddseq);
  getstr("shp_sl",shp_sl);

  getstr("sel_flg",sel_flg);
  
  getstr("fCT",fCT);
  getstr("fc180",fc180);
  getstr("cal_sphase",cal_sphase);

  getstr("shared_CT",shared_CT);

  getstr("nietl_flg",nietl_flg);

  taua   = getval("taua"); 
  del1  = getval("del1");
  bigTN = getval("bigTN");
  bigTC = getval("bigTC");
  zeta = getval("zeta");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  pwD = getval("pwD");
  pwDlvl = getval("pwDlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni2 = getval("ni2");
  tauf = getval("tauf");
  pw_sl = getval("pw_sl");
  phase_sl = getval("phase_sl");
  tpwrsl = getval("tpwrsl");
  at = getval("at");

  sphase = getval("sphase");

  pw_sl1 = getval("pw_sl1");
  tpwrsl1 = getval("tpwrsl1");

  gstab = getval("gstab");

  gt1 = getval("gt1");
  if (getval("gt2") > 0) gt2=getval("gt2");
    else gt2=gt1*0.1;
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  gt9 = getval("gt9");
  gt11 = getval("gt11");
  gt13 = getval("gt13");
  gt14 = getval("gt14");

  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl8 = getval("gzlvl8");
  gzlvl9 = getval("gzlvl9");
  gzlvl11 = getval("gzlvl11");
  gzlvl13 = getval("gzlvl13");
  gzlvl14 = getval("gzlvl14");

  if(autocal[0]=='n')
  {     
    getstr("shcgcob",shcgcob);
    getstr("shcgcoib",shcgcoib);
    getstr("shcreb",shcreb);
    getstr("shca180",shca180);
    getstr("shco180",shco180);
    
    d_ca180 = getval("d_ca180");
    d_co180 = getval("d_co180");
    d_cgcob = getval("d_cgcob");
    d_creb = getval("d_creb");
    pwca180 = getval("pwca180");
    pwco180 = getval("pwco180");
    pwcgcob = getval("pwcgcob");
    pwcreb = getval("pwcreb");
  }
  else
  {        
    strcpy(shcgcob,"Pg3_107p");    
    strcpy(shcgcoib,"Pg3i_107p");    
    strcpy(shcreb,"Preb_on");    
    strcpy(shca180,"Phard_15p");    
    strcpy(shco180,"Phard_133p");    
    if (FIRST_FID)  
    {
      cgcob = pbox(shcgcob, G3CGCOB, CAB180ps, dfrq, compC*pwC, pwClvl);
      cgcoib = pbox(shcgcoib, G3CGCOBi, CAB180ps, dfrq, compC*pwC, pwClvl);  
      creb = pbox(shcreb, CREB180, CAB180ps, dfrq, compC*pwC, pwClvl);      
      ca180 = pbox(shca180, CA180, CA180ps, dfrq, compC*pwC, pwClvl);        
      co180 = pbox(shco180, CO180, CA180ps, dfrq, compC*pwC, pwClvl);  
    }   
    d_ca180 = ca180.pwr;
    d_co180 = co180.pwr;
    d_cgcob = cgcob.pwr;
    d_creb = creb.pwr;
    pwca180 = ca180.pw;
    pwco180 = co180.pw;
    pwcgcob = cgcob.pw;
    pwcreb = creb.pw;
  }   

/* LOAD PHASE TABLE */

  settable(t1,2,phi1);
  settable(t2,4,phi2);
  settable(t3,8,phi3);
  settable(t4,1,phi4);
  settable(t5,16,phi5);
  settable(t6,8,phi6);
  settable(t7,1,phi7);
  settable(t8,16,rec); 

/* CHECK VALIDITY OF PARAMETER RANGES */

   if(shared_CT[A] == 'n')
    if(bigTN - 0.5*(ni2 -1)/sw2 - POWER_DELAY < 0.2e-6)
    {
        text_error(" ni2 is too big\n");
        text_error(" please set ni2 smaller or equal to %d\n",
    			(int) ((bigTN -POWER_DELAY)*sw2*2.0) +1 );
        psg_abort(1);
    }

   if(fCT[A] == 'y')
    if(bigTC - 0.5*(ni-1)/sw1 - WFG_STOP_DELAY - gt14 - 102.0e-6
        - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        - POWER_DELAY - WFG_START_DELAY - 4.0e-6 - pwcgcob - WFG_STOP_DELAY
        - POWER_DELAY - 4.0e-6 < 0.2e-6) {

          text_error("ni is too big\n");
          text_error(" please set ni smaller or equal to %d\n",
    			(int) ((bigTC - WFG_STOP_DELAY - gt14 - 102.0e-6
        			- POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        			- POWER_DELAY - WFG_START_DELAY - 4.0e-6 - pwcgcob - WFG_STOP_DELAY
        			- POWER_DELAY - 4.0e-6)*sw1*2.0) +1 );
          psg_abort(1);
    }

    if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y'))
    {
        text_error("incorrect dec1 decoupler flags!  ");
        psg_abort(1);
    }

    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y'))
    {
        text_error("incorrect dec2 decoupler flags! Should be 'nnn' ");
        psg_abort(1);
    }

    if( tsatpwr > 6 )
    {
        text_error("TSATPWR too large !!!  ");
        psg_abort(1);
    }

    if( dpwr > 46 )
    {
        text_error("don't fry the probe, DPWR too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > 47 )
    {
        text_error("don't fry the probe, DPWR2 too large!  ");
        psg_abort(1);
    }

    if( pwClvl > 63 )
    {
        text_error("don't fry the probe, pwClvl too large!  ");
        psg_abort(1);
    }

    if( pwNlvl > 63 )
    {
        text_error("don't fry the probe, pwNlvl too large!  ");
        psg_abort(1);
    }

    if( pw > 200.0e-6 )
    {
        text_error("dont fry the probe, pw too high ! ");
        psg_abort(1);
    } 
    if( pwN > 200.0e-6 )
    {
        text_error("dont fry the probe, pwN too high ! ");
        psg_abort(1);
    } 
    if( pwC > 200.0e-6 )
    {
        text_error("dont fry the probe, pwC too high ! ");
        psg_abort(1);
    } 

    if( f1180[A] != 'n' && f2180[A] != 'n' ) {
        text_error("flags may be set wrong: set f1180=n and f2180=n for 3d\n");
        psg_abort(1);
    }

    if(d_ca180 > 58) 
    {
        text_error("dont fry the probe, d_ca180 too high ! ");
        psg_abort(1);
    }

    if(d_co180 > 58) 
    {
        text_error("dont fry the probe, d_ca180 too high ! ");
        psg_abort(1);
    }

    if( gt1 > 15e-3 || gt2 > 15e-3 || gt3 > 15e-3 
        || gt4 > 15e-3 || gt5 > 15e-3 || gt6 > 15e-3 
        || gt7 > 15e-3 || gt8 > 15e-3 || gt9 > 15e-3 
        || gt11 > 15e-3 || gt13 > 15e-3  
        || gt14 > 15e-3)
    {
       text_error("gti values must be < 15e-3\n");
       psg_abort(1);
    } 

    if(tpwrsl > 25) {
       text_error("tpwrsl must be less than 25\n");
       psg_abort(1);
    }

    if(tpwrsl1 > 25) {
       text_error("tpwrsl1 must be less than 25\n");
       psg_abort(1);
    }

    if( dpwr3 > 50) {
       text_error("dpwr3 too high\n");
       psg_abort(1);
    }
    if( del1 > 0.1 ) {
       text_error("too long del1\n");
       psg_abort(1);
    }
    if( zeta > 0.1 ) {
       text_error("too long zeta\n");
       psg_abort(1);
    }
    if( bigTN > 0.1) {
       text_error("too long bigTN\n");
       psg_abort(1);
    }
    if( bigTC > 0.1) {
       text_error("too long bigTC\n");
       psg_abort(1);
    }
    if( pw_sl > 10e-3) {
       text_error("too long pw_sl\n");
       psg_abort(1);
    }
    if( pw_sl1 > 10e-3) {
       text_error("too long pw_sl1\n");
       psg_abort(1);
    }
    if( at > 0.1 && dm2[D] == 'y') {
       text_error("too long at with dec2\n");
       psg_abort(1);
    }

    if(pwDlvl > 59) {
        text_error("pwDlvl is too high; <= 59\n");
        psg_abort(1);
    }

    if(d_creb > 62) {
        text_error("d_creb is too high; <= 62\n");
        psg_abort(1);
    }

    if(d_cgcob > 60) {
        text_error("d_cgcob is too high; <=60\n");
        psg_abort(1);
    }

    if(cal_sphase[A] == 'y') {
      text_error("Use only to calibrate sphase\n");
      text_error("Set zeta to 600 us, gt11=gt13=0, fCT=y, fc180=n\n");
    }

    if(nietl_flg[A] == 'y' && sel_flg[A] == 'y') {
       text_error("Both nietl_flg and sel_flg cannot by y\n");
       psg_abort(1);
    }

    if (fCT[A] == 'n' && fc180[A] =='y' && ni > 1.0) {
       text_error("must set fc180='n' to allow Calfa/Cbeta evolution (ni>1)\n");
       psg_abort(1);
   }


/*  Phase incrementation for hypercomplex 2D data */

    /* changed from 1 to 3; spect. rev. not needed */
    if (phase == 2) { tsadd(t2,3,4); tsadd(t3,3,4); }

    if (shared_CT[A] == 'n') 
      {
       if (phase2 == 2) { tsadd(t7,2,4); icosel = 1; }
         else icosel = -1;
      }
     else 
      {
       if (phase2 == 2) { tsadd(t7,2,4); icosel = -1; }
         else icosel = 1;
      }

    if (nietl_flg[A] == 'y') icosel = -1*icosel;

/* Calculate modifications to phases for States-TPPI acquisition          */

   if( ix == 1) d2_init = d2 ;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) {
      tsadd(t2,2,4);     
      tsadd(t8,2,4);    
    }

   if( ix == 1) d3_init = d3 ;
   t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );
   if(t2_counter % 2) {
      tsadd(t5,2,4);  
      tsadd(t8,2,4);    
    }

/*  Set up f1180  tau1 = t1         */

      tau1 = d2;
      if(f1180[A] == 'y' && fCT[A] == 'y') 
          tau1 += ( 1.0 / (2.0*sw1) );

      if(f1180[A] == 'y' && fCT[A] == 'n') 
          tau1 += (1.0 / (2.0*sw1) - 4.0/PI*pwC - POWER_DELAY
                    - 4.0e-6);

      if(f1180[A] == 'n' && fCT[A] == 'n') 
          tau1 = (tau1 - 4.0/PI*pwC - POWER_DELAY
                    - 4.0e-6);

      if(tau1 < 0.2e-6) tau1 = 4.0e-7; 
      tau1 = tau1/2.0;

/*  Set up f2180  tau2 = t2         */

    tau2 = d3;
    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) ); 
        if(tau2 < 0.2e-6) tau2 = 0.2e-6;
    }
        tau2 = tau2/2.0;

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tsatpwr);     /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);      /* Set Dec1 power to high power          */
   dec2power(pwNlvl);     /* Set Dec2 power for 15N hard pulses         */
   dec3power(pwDlvl);     /* Set Dec3 for 2H hard pulses */

/* Presaturation Period */

   if (fsat[0] == 'y')
     {
      delay(2.0e-5);
      rgpulse(d1,zero,0.0,2.0e-6);
      obspower(tpwr);      /* Set transmitter power for hard 1H pulses */
      delay(2.0e-5);
      if (fscuba[0] == 'y')
	{
	 delay(2.2e-2);
	 rgpulse(pw,zero,2.0e-6,0.0);
	 rgpulse(2*pw,one,2.0e-6,0.0);
	 rgpulse(pw,zero,2.0e-6,0.0);
	 delay(2.2e-2);
        }
     }
    else
     {
      delay(d1);
     }
   obspower(tpwr);           /* Set transmitter power for hard 1H pulses */
   txphase(zero);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

   rcvroff();
   lk_hold();
   delay(20.0e-6);

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */

   delay(0.2e-6);
   zgradpulse(gzlvl5,gt5);
   delay(2.0e-6);

   delay(taua - gt5 - 2.2e-6);   /* taua <= 1/4JNH */ 

   sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);

   dec2phase(t1); decphase(zero); 

   delay(taua - gt5 - 200.2e-6); 

   delay(0.2e-6);
   zgradpulse(gzlvl5,gt5);
   delay(200.0e-6);

   if (sel_flg[A] == 'y') 
     {
      rgpulse(pw,one,4.0e-6,0.0);

      initval(1.0,v2);
      obsstepsize(phase_sl);
      xmtrphase(v2);

      /* shaped pulse */
      obspower(tpwrsl);
      shaped_pulse(shp_sl,pw_sl,two,2.0e-6,0.0);
      xmtrphase(zero);
      delay(2.0e-6);
      obspower(tpwr);
      /* shaped pulse */

      initval(1.0,v6);
      dec2stepsize(45.0);
      dcplr2phase(v6);

      delay(0.2e-6);
      zgradpulse(gzlvl3,gt3);
      delay(200.0e-6);

      dec2rgpulse(pwN,t1,0.0,0.0);
      dcplr2phase(zero);

      delay(1.34e-3 - SAPS_DELAY);
   
      rgpulse(pw,zero,0.0,0.0);
      rgpulse(2.0*pw,one,2.0e-6,0.0);
      rgpulse(pw,zero,2.0e-6,0.0);

      decpower(d_ca180);

        dec2phase(zero);
   
        delay(del1 - 1.34e-3 - 4.0*pw - 4.0e-6 
              - POWER_DELAY + WFG_START_DELAY + pwca180 + WFG_STOP_DELAY);
     }
    else  
     {
      rgpulse(pw,three,4.0e-6,0.0);

      initval(1.0,v2);
      obsstepsize(phase_sl);
      xmtrphase(v2);
   
      /* shaped pulse */
      obspower(tpwrsl);
      shaped_pulse(shp_sl,pw_sl,zero,2.0e-6,0.0);
      xmtrphase(zero);
      delay(2.0e-6);
      obspower(tpwr);
      /* shaped pulse */
   
      delay(0.2e-6);
      zgradpulse(gzlvl3,gt3);
      delay(200.0e-6);

      dec2rgpulse(pwN,t1,0.0,0.0);
      dec2phase(zero);

      decpower(d_ca180);

      delay(del1 - POWER_DELAY + WFG_START_DELAY
      		+ pwca180 + WFG_STOP_DELAY);
     }

   decphase(zero);
   dec2rgpulse(2*pwN,zero,0.0,0.0);
   decshaped_pulse(shca180,pwca180,zero,0.0,0.0);

   dec2phase(one);

   delay(del1);

   dec2rgpulse(pwN,one,0.0,0.0);

   decpower(pwClvl);

   decphase(t2); 

   delay(0.2e-6);
   zgradpulse(gzlvl4,gt4);
   delay(200.0e-6);

   dec2phase(t5); 

   /* Turn on D decoupling using the third decoupler */
   dec3phase(one);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3power(dpwr3);
   dec3unblank();
   setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
   /* Turn on D decoupling */

   decrgpulse(pwC,t2,0.0,0.0);

   delay(zeta
	- PRG_STOP_DELAY - DELAY_BLANK - POWER_DELAY - 4.0e-6
        - pwD
        - gt11 - 102.0e-6 - POWER_DELAY - WFG_START_DELAY); 
      
   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank(); 
   dec3phase(three);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

    decphase(zero);

   delay(2.0e-6);
   zgradpulse(gzlvl11,gt11);
   delay(100.0e-6);

   if (cal_sphase[A] == 'y') 
     {
      decpower(pwClvl);
      decshaped_pulse("hard",2.0*pwC,zero,4.0e-6,4.0e-6);
     }
    else 
     {
      initval(1.0,v3);
      decstepsize(sphase);
      dcplrphase(v3);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
     }

   delay(2.0e-6);
   zgradpulse(gzlvl11,gt11);
   delay(100.0e-6);

   /* Turn on D decoupling using the third decoupler */
   dec3phase(one);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3power(dpwr3);
   dec3unblank();
   setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
   /* Turn on D decoupling */

   delay(zeta - WFG_STOP_DELAY - gt11 - 102.0e-6 
	- POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        - DELAY_BLANK - POWER_DELAY - 4.0e-6);

   decpower(pwClvl);
   decrgpulse(pwC,t3,4.0e-6,0.0);

   if (fCT[A] == 'y') 
     {
      delay(tau1);

      decpower(d_cgcob);
      decshaped_pulse(shcgcob,pwcgcob,zero,4.0e-6,0.0);

      delay(bigTC - POWER_DELAY - WFG_START_DELAY - 4.0e-6
            - pwcgcob - WFG_STOP_DELAY 
            - 102.0e-6 - gt14 
            - PRG_STOP_DELAY - DELAY_BLANK
            - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - WFG_START_DELAY);
 
      /* Turn off D decoupling */
      setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
      dec3blank();
      dec3phase(three);
      dec3power(pwDlvl);
      dec3rgpulse(pwD,three,4.0e-6,0.0);
      /* Turn off D decoupling */

      delay(2.0e-6);
      zgradpulse(gzlvl14,gt14);
      delay(100.0e-6);

      initval(1.0,v4);
      decstepsize(sphase);
      dcplrphase(v4);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
    
      delay(2.0e-6);
      zgradpulse(gzlvl14,gt14);
      delay(100.0e-6);

      /* Turn on D decoupling using the third decoupler */
      dec3phase(one);
      dec3power(pwDlvl);
      dec3rgpulse(pwD,one,4.0e-6,0.0);
      dec3phase(zero);
      dec3power(dpwr3);
      dec3unblank(); 
      setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
      /* Turn on D decoupling */


      delay(bigTC - tau1 - WFG_STOP_DELAY - gt14
            - 102.0e-6 - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY
            - PRG_START_DELAY - POWER_DELAY - WFG_START_DELAY
            - 4.0e-6 - pwcgcob - WFG_STOP_DELAY - POWER_DELAY 
            - 4.0e-6);

      decpower(d_cgcob);
      decshaped_pulse(shcgcoib,pwcgcob,zero,4.0e-6,0.0);
      decphase(t4);
     }
    else if(fCT[A] == 'n' && fc180[A] == 'n') 
     {
      delay(tau1);
      delay(tau1);
     }
    else if(fCT[A] == 'n' && fc180[A] == 'y') 
     {
      initval(1.0,v4);
      decstepsize(sphase);
      dcplrphase(v4);

      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,0.0);

      dcplrphase(zero);
     }

   decpower(pwClvl);
   decrgpulse(pwC,t4,4.0e-6,0.0);

   delay(zeta - POWER_DELAY - 4.0e-6
          - pwD - PRG_STOP_DELAY - DELAY_BLANK
          - gt13
          - 102.0e-6 - POWER_DELAY - WFG_START_DELAY); 

   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank(); 
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

   delay(2.0e-6);
   zgradpulse(gzlvl13,gt13);
   delay(100.0e-6);

   if (cal_sphase[A] == 'y') 
     {
      decpower(pwClvl);
      decshaped_pulse("hard",2.0*pwC,zero,4.0e-6,4.0e-6);
     }
    else 
     {
      initval(1.0,v5);
      decstepsize(sphase);
      dcplrphase(v5);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
     }

   delay(2.0e-6);
   zgradpulse(gzlvl13,gt13);
   delay(100.0e-6);

   /* Turn on D decoupling using the third decoupler */
   dec3phase(one);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3power(dpwr3);
   dec3unblank();
   setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
   /* Turn on D decoupling */


   delay(zeta - WFG_STOP_DELAY - gt13 - 102.0e-6  
        - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY
        - PRG_START_DELAY - DELAY_BLANK
        - POWER_DELAY - 4.0e-6);

   decpower(pwClvl);
   decrgpulse(pwC,zero,4.0e-6,0.0);

   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank();
   dec3phase(three);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

   delay(0.2e-6);
   zgradpulse(gzlvl9,gt9);
   delay(200.0e-6);

   if (shared_CT[A] == 'n') 
     {
      dec2rgpulse(pwN,t5,2.0e-6,0.0);

      decpower(d_ca180);

      dec2phase(t6); 

      delay(bigTN - tau2 - POWER_DELAY);

      dec2rgpulse(2*pwN,t6,0.0,0.0);
      decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
      dec2phase(t7);

      delay(bigTN - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY
            - gt1 - 2.0*GRADIENT_DELAY - 500.2e-6 
            - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
            - pwco180 - WFG_STOP_DELAY);

      delay(0.2e-6);
      zgradpulse(gzlvl1,gt1);
      delay(500.0e-6);

      decpower(d_co180);
      decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);

      delay(tau2);
   
      sim3pulse(pw,0.0,pwN,zero,zero,t7,0.0,0.0);
     }
    else if (shared_CT[A] == 'y') 
     {
      dec2rgpulse(pwN,t5,2.0e-6,0.0);

      decpower(d_co180);
      dec2phase(t6); 

      if (bigTN - tau2 >= 0.2e-6) 
        {
         delay(tau2);

         decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);
         decpower(d_ca180);

         delay(0.2e-6);
         zgradpulse(gzlvl1,gt1);
         delay(500.0e-6);

         delay(bigTN - 4.0e-6 - WFG_START_DELAY - pwco180 - WFG_STOP_DELAY
               - POWER_DELAY - gt1 - 500.2e-6 - 2.0*GRADIENT_DELAY
               - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY);

         decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
         dec2rgpulse(2*pwN,t6,0.0,0.0);

         delay(bigTN - tau2);
        }
       else 
        {
         delay(tau2);
         decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);

         delay(0.2e-6);
         zgradpulse(gzlvl1,gt1);
         delay(500.0e-6);
     
         decpower(d_ca180);
         delay(bigTN - 4.0e-6 - WFG_START_DELAY - pwco180
               - WFG_STOP_DELAY - gt1 - 500.2e-6 - 2.0*GRADIENT_DELAY
               - POWER_DELAY - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY); 
   
         decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
    
         delay(tau2 - bigTN);
         dec2rgpulse(2.0*pwN,t6,0.0,0.0);
        }
      sim3pulse(pw,0.0,pwN,zero,zero,t7,0.0,0.0);
     }
/* end of shared_CT */

   if (nietl_flg[A] == 'n') 
     {
      decpower(pwClvl);
      decrgpulse(pwC,zero,4.0e-6,0.0);

      delay(0.2e-6);
      zgradpulse(gzlvl6,gt6);
      delay(2.0e-6);

      dec2phase(zero);
      delay(tauf - POWER_DELAY - 4.0e-6 
                 - pwC - gt6 - 2.2e-6);

      sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);

      txphase(one);
      dec2phase(one);
   
      delay(tauf - gt6 - 200.2e-6);

      delay(0.2e-6);
      zgradpulse(gzlvl6,gt6);
      delay(200.0e-6);

      sim3pulse(pw,0.0,pwN,one,zero,one,0.0,0.0);
      
      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(2.0e-6);
 
      txphase(zero);
      dec2phase(zero);
      delay(tauf - gt7 - 2.2e-6);

      sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);

      delay(tauf - gt7 - 200.2e-6);

      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(200.0e-6);
   
      sim3pulse(pw,0.0e-6,pwN,zero,zero,zero,0.0,0.0);
     }
    else  
     {   /* nietl_flg == y */
      /* shaped pulse */
      obspower(tpwrsl1);
      shaped_pulse(shp_sl,pw_sl1,zero,2.0e-6,0.0);
      delay(2.0e-6);
      obspower(tpwr);
      /* shaped pulse */

      decpower(pwClvl);
      decrgpulse(pwC,zero,4.0e-6,0.0);

      delay(0.2e-6);
      zgradpulse(gzlvl6,gt6);
      delay(2.0e-6);
   
      dec2phase(zero);
      delay(tauf 
                 - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
                 - pw_sl1 - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY
                 - POWER_DELAY - 4.0e-6 
                 - pwC - gt6 - 2.2e-6);

      sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);

      txphase(one);
      dec2phase(zero);

      delay(tauf - gt6 - 200.2e-6);

      delay(0.2e-6);
      zgradpulse(gzlvl6,gt6);
      delay(200.0e-6);

      sim3pulse(pw,0.0,pwN,one,zero,zero,0.0,0.0);
   
      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(2.0e-6);
 
      txphase(zero);
      dec2phase(zero);
      delay(tauf - gt7 - 2.2e-6);

      sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);
      txphase(one);
      dec2phase(one);
   
      delay(tauf - gt7 - 200.2e-6);

      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(200.0e-6);
   
      sim3pulse(pw,0.0e-6,pwN,one,zero,one,0.0,0.0);
      txphase(zero);
     }  /* end of nietl_flg == y  */

   delay(gt2 +gstab -0.5*(pwN-pw) -2.0*pw/PI);

   rgpulse(2*pw,zero,0.0,0.0);

   delay(2.0e-6);
   zgradpulse(icosel*gzlvl2,gt2);
   decpower(dpwr);    /* NO  13C decoupling */
   dec2power(dpwr2);  /* NO  15N decoupling */
   delay(gstab -2.0e-6 -2.0*GRADIENT_DELAY -2.0*POWER_DELAY);

   lk_sample();
/* BEGIN ACQUISITION */
status(C);
   setreceiver(t8);

}
コード例 #11
0
ファイル: methylnoesyA.c プロジェクト: DanIverson/OpenVnmrJ
void pulsesequence()
{
/* DECLARE VARIABLES */

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
            fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell         */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell         */
            shib[MAXSTR],     /* iburp for inversion during first inept     */
            Hshp[MAXSTR],     /* proton inversion during chirp        */
            ddseq[MAXSTR],
            shreb[MAXSTR],    /* reburb hard during t2                */
            co_shp[MAXSTR],   /* shape of co 180 at 176 ppm */
            CT_flg[MAXSTR],
            codecseq[MAXSTR],
            c180_flg[MAXSTR],

            n_shift[MAXSTR],
            shibca[MAXSTR],
            shibcai[MAXSTR];

 int         phase, phase2, t2_counter, ni2, ni,
             t1_counter;   /* used for states tppi in t2,t1        */ 

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JCH =  1.7 ms; first inept */
             mix,	   /* noesy mixing time */
             TC,           /* Variable CT period during t1 1/2JCC */
             TC2,          /* Variable CT period during t3  1/2JCC */
             pwc,          /* 90 c pulse at dhpwr            */
             tsatpwr,      /* low level 1H trans.power for presat  */
             dhpwr,        /* power level for high power 13C pulses on dec1 */
             sw1,          /* sweep width in f1                    */ 
             sw2,          /* sweep width in f2                    */ 
             pwC,pwClvl,compC,pwN,pwNlvl,ppm,ofs,bw,  /*used by Pbox */
             d_ib,
             pwib,

             pwhshp,

             pwd1,        /* 2H flip back pulses   */

             d_reb,
             pwreb,

             ph_reb,
             ph_reb1,    /* only used if CT_flg=='y' and n_shift=='y'  */

             pwco180,

             dhpwr2,
             pwn,

             d_co180,

             pwcodec,    /* carbon pw90 for seduce decoupling */
             dpwrsed,
             dressed,

             d_ibca,     /* power level for selective 13Ca pulse during CT-t2 */
             pwibca,     /* selective 13Ca pulse width  */

             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gt9,
             gt10,
             gt11,
             gt12,
             gstab,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8,
             gzlvl9,
             gzlvl10,
             gzlvl11,
             gzlvl12;

/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */

  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("fscuba",fscuba);
  getstr("ddseq",ddseq);
  getstr("n_shift",n_shift); 
  getstr("Hshp",Hshp);
  getstr("CT_flg",CT_flg);
  getstr("c180_flg",c180_flg);

  compC = getval("compC"); pwN=getval("pwN"); pwNlvl=getval("pwNlvl");
  pwC = getval("pwC"); pwClvl=getval("pwClvl");
  
  pwhshp = getval("pwhshp");
  taua   = getval("taua"); 
  mix   = getval("mix"); 
  TC = getval("TC");
  pwc = getval("pwc");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dhpwr = getval("dhpwr");
  dpwr = getval("dpwr");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni2 = getval("ni2");
  ni  = getval("ni");

  pwd1 = getval("pwd1");

  ph_reb = getval("ph_reb");
  ph_reb1 = getval("ph_reb1");

  TC2 = getval("TC2");

  dhpwr2 = getval("dhpwr2");
  pwn = getval("pwn");

  setautocal();

  if(autocal[0]=='n')
  {     
    getstr("shreb",shreb);
    getstr("shib",shib);
    getstr("shibca",shibca);
    getstr("shibcai",shibcai);
    getstr("co_shp",co_shp);
    getstr("codecseq",codecseq);

    d_reb = getval("d_reb");
    pwreb = getval("pwreb");
    d_ib = getval("d_ib");
    pwib = getval("pwib");
    d_ibca = getval("d_ibca");
    pwibca = getval("pwibca"); 
    d_co180 = getval("d_co180");
    pwco180 = getval("pwco180");
    pwcodec = getval("pwcodec");
    dpwrsed = getval("dpwrsed");
    dressed = getval("dressed");
  }
  else
  {    
  /*strcpy(Hshp,"hard");  former declarations using TNMR.h syntax
    strcpy(shreb,"Preb_5p");
    strcpy(shib,"Pib_1p5");
    strcpy(shibca,"Pib_35p");
    strcpy(shibcai,"Pib_35pi");    
    strcpy(co_shp,"Psed_156p");
    strcpy(codecseq,"Pdec_156p");*/

    strcpy(Hshp,"hard");
    strcpy(shreb,"Preb_5p");
    strcpy(shib,"Pib_1p5");
    strcpy(shibca,"Pib_35p");
    strcpy(shibcai,"Pib_35pi");    
    strcpy(co_shp,"Psed_156p");
    strcpy(codecseq,"Pdec_156p");
    if (FIRST_FID)
    {
      ppm = getval("dfrq");

/*       These are former declarations (at top) using TNMR.h syntax                     */
/*REB180   "reburp 110p 5p"*/             /* RE-BURP 180 on Cab at 24.6 ppm, 5 ppm away */
/*IB180    "iburp2 24.4p 1.5p"*/          /* I-BURP 180 on  Me at 21.1 ppm, 1.5 ppm away */
/*IBCA     "iburp2 24.4p 35p"*/           /* I-BURP 180 on Cab at 54.6 ppm, 35 ppm away */
/*IBCAI    "iburp2 24.4p 35p"*/           /* I-BURP 180 on Cab at 54.6 ppm, 35 ppm away */
/*CO180    "seduce 30p 156p"*/            /* SEDUCE 180 on C' at 175.6 ppm 156 ppm away */
/*CODEC    "WURST2 20p/4m 156p"*/  /* WURST2 decoupling on C' at 175.6 ppm 156 ppm away */
/*REB180ps "-stepsize 0.5 -attn i"*/                     /* seduce 180 shape parameters */
/*CODECps  "-dres 1.0 -maxincr 20.0 -attn i"*/
    /*co180 = pbox(co_shp, CO180, REB180ps, dfrq, compC*pwc, dhpwr);*/
    /*ibcai = pbox(shibcai, IBCAI, REB180ps, dfrq, compC*pwc, dhpwr);*/      
    /*ibca = pbox(shibca, IBCA, REB180ps, dfrq, compC*pwc, dhpwr);*/
    /*ib180 = pbox(shib, IB180, REB180ps, dfrq, compC*pwc, dhpwr);*/          
    /*reb = pbox(shreb, REB180, REB180ps, dfrq, compC*pwc, dhpwr);*/
    /*COdec = pbox(codecseq, CODEC, CODECps, dfrq, compC*pwc, dhpwr);*/

      bw = 110.0*ppm; ofs = 5.0*ppm;
      Preb_5p = pbox_Rsh("Preb_5p", "reburp", bw , ofs, compC*pwC, pwClvl);
      bw = 24.4*ppm; ofs = 1.5*ppm;
      Pib_1p5 = pbox_Rsh("Pib_1p5", "iburp2", bw , ofs, compC*pwC, pwClvl);
      bw = 24.4*ppm; ofs = 35*ppm;
      Pib_35p = pbox_Rsh("Pib_35p", "iburp2", bw , ofs, compC*pwC, pwClvl);
      bw = 24.4*ppm; ofs = 35*ppm;
      Pib_35pi = pbox_Rsh("Pib_35pi", "iburp2", bw , ofs, compC*pwC, pwClvl);
      bw = 30.0*ppm; ofs = 156*ppm;
      Psed_156p = pbox_Rsh("Psed_156p", "seduce", bw , ofs, compC*pwC, pwClvl);
      bw = 20.0*ppm; ofs = 156*ppm;
      Pdec_156p = pbox_Dsh("Pdec_156p", "WURST2", bw , ofs, compC*pwC, pwClvl);


      ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
    }
    d_reb = Preb_5p.pwr;        pwreb = Preb_5p.pw;
    d_ib = Pib_1p5.pwr;         pwib = Pib_1p5.pw;
    d_ibca = Pib_35p.pwr;       pwibca = Pib_35p.pw;       
    d_co180 = Psed_156p.pwr;    pwco180 = Psed_156p.pw;  
    dpwrsed = Pdec_156p.pwr;    pwcodec = 1.0/Pdec_156p.dmf;  dressed = Pdec_156p.dres;

    pwc=pwC; dhpwr=pwClvl; pwn=pwN; dhpwr2=pwNlvl; pwhshp=2.0*pw;
    pwd1=1/dmf3; pwhshp=2.0*pw;
  }   
   
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  gt9 = getval("gt9");
  gt10 = getval("gt10");
  gt11 = getval("gt11");
  gt12 = getval("gt12");

  gstab  = getval("gstab");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl8 = getval("gzlvl8");
  gzlvl9 = getval("gzlvl9");
  gzlvl10 = getval("gzlvl10");
  gzlvl11 = getval("gzlvl11");
  gzlvl12 = getval("gzlvl12");

/* LOAD PHASE TABLE */

  settable(t1,4,phi1);
  settable(t2,8,phi2);
  settable(t7,2,phi7);
  settable(t8,2,phi8);
  settable(t9,8,rec);

/* CHECK VALIDITY OF PARAMETER RANGES */

   if(TC/2.0 - 0.5*(ni-1)*1/(sw1) - POWER_DELAY - 4.0e-6 
         - WFG3_START_DELAY - pwco180
         - WFG3_STOP_DELAY - pwd1 
         - gt4 - gstab -2.0e-6 - POWER_DELAY
         - 4.0e-6 - WFG_START_DELAY < 0.2e-6)
    {
        printf(" ni is too big\n");
        psg_abort(1);
    }

  if(CT_flg[A] == 'y' && n_shift[A] == 'n') {

   if(TC2/2.0 - 0.5*(ni2-1)*1/(sw2) - POWER_DELAY - 4.0e-6 
         - WFG3_START_DELAY - pwco180
         - WFG3_STOP_DELAY - pwd1 
         - gt10 - gstab -2.0e-6 - POWER_DELAY
         - 4.0e-6 - WFG_START_DELAY < 0.2e-6)
    {
        printf(" ni2 is too big\n");
        psg_abort(1);
    }

   }

  if(CT_flg[A] == 'y' && n_shift[A] == 'y') {

   if(TC2/2.0 - 0.5*(ni2-1)/sw2 - POWER_DELAY 
         - 4.0e-6 - WFG3_START_DELAY - pwco180
         - WFG3_STOP_DELAY - 2.0e-6 - POWER_DELAY - WFG_START_DELAY
         - 4.0e-6 - pwibca - WFG_STOP_DELAY - pwd1 
         - gt10 - gstab -2.0e-6 - POWER_DELAY
         - 4.0e-6 - WFG3_START_DELAY < 0.2e-6)
    {
        printf(" ni2 is too big\n");
        psg_abort(1);
    }

   }

    if((dm[A] == 'y' || dm[B] == 'y' ))
    {
        printf("incorrect dec1 decoupler flags!  ");
        psg_abort(1);
    }

    if((dm2[A] == 'y' || dm2[B] == 'y'))
    {
        printf("incorrect dec2 decoupler flags!  ");
        psg_abort(1);
    }

    if((dm3[A] == 'y' || dm3[B] == 'y' || dm3[C] == 'y'))
    {
        printf("incorrect dec3 decoupler flags!  ");
        psg_abort(1);
    }

    if( tsatpwr > 6 )
    {
        printf("TSATPWR too large !!!  ");
        psg_abort(1);
    }

    if( dpwr > 48 )
    {
        printf("don't fry the probe, DPWR too large!  ");
        psg_abort(1);
    }

    if( d_ib > 54 )
    {
        printf("don't fry the probe, d_ib too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > 49 )
    {
        printf("don't fry the probe, DPWR2 too large!  ");
        psg_abort(1);
    }

    if( dpwr3 > 51 )
    {
        printf("don't fry the probe, DPWR3 too large!  ");
        psg_abort(1);
    }

    if( dhpwr > 63 )
    {
        printf("don't fry the probe, DHPWR too large!  ");
        psg_abort(1);
    }

    if( pw > 200.0e-6 )
    {
        printf("dont fry the probe, pw too high ! ");
        psg_abort(1);
    } 

    if( pwd1 < 100.0e-6 && pwd1 != 0.0)
    {
        printf("dont fry the probe, pwd1 too short and dpwr3 too high! ");
        psg_abort(1);
    } 

    if(d_co180 > 50)
    {
        printf("dont fry the probe, d_co180 is too high\n ");
        psg_abort(1);
    } 

    if(((pwco180 > 250e-6) || (pwco180 < 200e-6)) && (autocal[A] == 'n'))
     {
        printf("pwco180 is misset < 250 us > 200 us\n");
        psg_abort(1);
     }

    if(dpwrsed > 45) 
     {
        printf("dpwrsed is misset < 46\n");
        psg_abort(1);
     }

    if(gt1 > 15e-3 || gt2 > 15e-3 || gt3 > 15e-3 || 
        gt4 > 15e-3 || gt5 > 15e-3 || gt6 > 15e-3 ||
        gt7 > 15e-3 || gt8 > 15e-3 || gt9 > 15e-3 || 
        gt10 > 15e-3 || gt11 > 15e-3 || gt12 > 15e-3) 
    {
        printf("gradients on for too long. Must be < 15e-3 \n");
        psg_abort(1);
    }

/*  Phase incrementation for hypercomplex 2D data */

    if (phase2 == 2) {
      tsadd(t2,1,4);  
    }

    if (phase == 2) 
      tsadd(t1,1,4);

/*  Set up f2180  tau2 = t2               */
   
    tau2 = d3;

    if(CT_flg[A] == 'y') {

    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) );
    }

    }

    if(CT_flg[A] == 'n' && n_shift[A] == 'n') {

         if(f2180[A] == 'y') {
            tau2 += ( 1.0 / (2.0*sw2) - 4.0/PI*pwc - POWER_DELAY
                      - PRG_START_DELAY - 4.0*pw - 4.0e-6 - 2.0*pwn
                      - PRG_STOP_DELAY - POWER_DELAY - 4.0e-6);

            if(tau2 < 0.0 && ix == 1) 
               printf("tau2 start2 negative; decrease sw2\n");
          }

         if(f2180[A] == 'n') {
            tau2 = ( tau2 - 4.0/PI*pwc - POWER_DELAY
                      - PRG_START_DELAY - 4.0*pw - 4.0e-6 - 2.0*pwn
                      - PRG_STOP_DELAY - POWER_DELAY - 4.0e-6);
         }

     } 

    if(CT_flg[A] == 'n' && n_shift[A] == 'y') {

         if(f2180[A] == 'y') {
            tau2 += ( 1.0 / (2.0*sw2) - 4.0/PI*pwn - POWER_DELAY
                      - PRG_START_DELAY - 4.0*pw - 4.0e-6 
                      - PRG_STOP_DELAY - POWER_DELAY - 4.0e-6);

            if(tau2 < 0.0 && ix == 1) 
               printf("tau2 start2 negative; decrease sw2\n");
          }

         if(f2180[A] == 'n') {
            tau2 = ( tau2 - 4.0/PI*pwn - POWER_DELAY
                      - PRG_START_DELAY - 4.0*pw - 4.0e-6
                      - PRG_STOP_DELAY - POWER_DELAY - 4.0e-6);
         }

     } 

    if(tau2 < 0.4e-6) tau2 = 0.4e-6;
    tau2 = tau2/2.0;

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1) );
    }
    if(tau1 < 0.4e-6) tau1 = 0.4e-6;
    tau1 = tau1/2.0;

/* Calculate modifications to phases for States-TPPI acquisition          */

   if( ix == 1) d2_init = d2 ;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) {
      tsadd(t1,2,4);     
      tsadd(t9,2,4);     
    }

   if( ix == 1) d3_init = d3 ;
   t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );
   if(t2_counter % 2) {
      tsadd(t2,2,4);     
      tsadd(t9,2,4);    
    }

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tsatpwr);     /* Set transmitter power for 1H presaturation */
   decpower(dhpwr);       /* Set Dec1 power for hard 13C pulses         */
   dec2power(dhpwr2);    /* Set Dec2 power for hard 15N pulses         */
   dec3power(dpwr3);     /* Set Dec3 power for 2H pulses        */

/* Presaturation Period */


   if (fsat[0] == 'y')
   {
        delay(2.0e-5);
        rgpulse(d1,zero,2.0e-6,2.0e-6); /* presat */
        obspower(tpwr);    /* Set transmitter power for hard 1H pulses */
        delay(2.0e-5);
        if(fscuba[0] == 'y')
        {
                delay(2.2e-2);
                rgpulse(pw,zero,2.0e-6,0.0);
                rgpulse(2*pw,one,2.0e-6,0.0);
                rgpulse(pw,zero,2.0e-6,0.0);
                delay(2.2e-2);
        }
   }
   else
   {
    delay(d1);
   }

   obspower(tpwr);          /* Set transmitter power for hard 1H pulses */
   txphase(zero);
   dec2phase(zero);
   decphase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

   rcvroff();
   lk_hold();
   delay(20.0e-6);

/* first ensure that magnetization does infact start on H and not C */

   decrgpulse(pwc,zero,2.0e-6,2.0e-6);

   delay(2.0e-6);
   zgradpulse(gzlvl1,gt1);
   delay(gstab);

   decpower(d_ib);			/* set power for chirp during inept */
   delay(4e-6);

/* this is the real start */

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */

   delay(2.0e-6);
   zgradpulse(gzlvl2,gt2);
   delay(2.0e-6);

   delay(taua - gt2 - 4.0e-6 - WFG2_START_DELAY);   /* taua <= 1/4JCH */                          

   simshaped_pulse(Hshp,shib,pwhshp,pwib,zero,zero,0.0,0.0);
   decphase(zero);

   txphase(one); decphase(t1);
   decpower(dhpwr);

   delay(2.0e-6);
   zgradpulse(gzlvl2,gt2);
   delay(2.0e-6);

   delay(taua - gt2 - 4.0e-6 - WFG2_STOP_DELAY - POWER_DELAY); 

   rgpulse(pw,one,0.0,0.0);
   txphase(zero);

   delay(2.0e-6);
   zgradpulse(gzlvl3,gt3);
   delay(gstab);

   decrgpulse(pwc,t1,0.0,0.0);
   decphase(zero);

   delay(tau1);

   decpower(d_co180);
   sim3shaped_pulse(Hshp,co_shp,"hard",pwhshp,pwco180,2.0*pwn,zero,zero,zero,4.0e-6,0.0);

   delay(TC/2.0 - tau1 - POWER_DELAY - 4.0e-6 - WFG3_START_DELAY - pwco180
         - WFG3_STOP_DELAY - pwd1 
         - gt4 - gstab -2.0e-6 - POWER_DELAY
         - 4.0e-6 - WFG_START_DELAY);

   dec3rgpulse(pwd1,zero,0.0,0.0);

   delay(tau1);

   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(gstab);

   initval(1.0,v3);
   decstepsize(ph_reb);
   dcplrphase(v3);

   decpower(d_reb);

   decshaped_pulse(shreb,pwreb,zero,4.0e-6,0.0);
   dcplrphase(zero);

   decphase(zero); decpower(dhpwr);
  
   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(gstab);

   delay(TC/2.0 - tau1 - WFG_STOP_DELAY - POWER_DELAY
         - gt4 - gstab -2.0e-6);

   decrgpulse(pwc,zero,0.0,0.0);

   dec3rgpulse(pwd1,two,4.0e-6,0.0);


   delay(2.0e-6);
   zgradpulse(gzlvl5,gt5);
   delay(gstab);

   rgpulse(pw,zero,0.0,0.0);

   delay(2.0e-6);
   zgradpulse(gzlvl6,gt6);
   delay(gstab);

   decpower(d_ib);
   delay(taua - gt6 - 4.0e-6 - WFG2_START_DELAY - POWER_DELAY);

   simshaped_pulse(Hshp,shib,pwhshp,pwib,zero,zero,0.0,0.0);
   decphase(zero);

   delay(2.0e-6);
   zgradpulse(gzlvl6,gt6);
   delay(gstab);


   decpower(dhpwr);
   txphase(one);
   delay(taua - gt6 - gstab -2.0e-6 - POWER_DELAY - WFG2_STOP_DELAY);

   rgpulse(pw,one,0.0,0.0);
   txphase(zero);

   delay(mix - gt7 - 352.0e-6);

   decrgpulse(pwc,zero,0.0,0.0);

   delay(2.0e-6);
   zgradpulse(gzlvl7,gt7);
   delay(gstab);

   decpower(d_ib); /* set power level for iburp */

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */

   delay(2.0e-6);
   zgradpulse(gzlvl8,gt8);
   delay(2.0e-6);

   if(n_shift[A] == 'n') {

   delay(taua - gt8 - 4.0e-6 - WFG2_START_DELAY);   /* taua <= 1/4JCH */                          
   simshaped_pulse(Hshp,shib,pwhshp,pwib,zero,zero,0.0,0.0);
   decphase(zero);

   }

   else {
 delay(taua - gt8 - 4.0e-6 - WFG3_START_DELAY);                 
 sim3shaped_pulse(Hshp,shib,"hard",pwhshp,pwib,2.0*pwn,zero,zero,zero,0.0,0.0);
    }


   txphase(one); decphase(t2);
   decpower(dhpwr);

   delay(2.0e-6);
   zgradpulse(gzlvl8,gt8);
   delay(2.0e-6);

   if(n_shift[A] == 'n') 
      delay(taua - gt8 - 4.0e-6 - WFG2_STOP_DELAY - POWER_DELAY); 
   else
      delay(taua - gt8 - 4.0e-6 - WFG3_STOP_DELAY - POWER_DELAY); 

   rgpulse(pw,one,0.0,0.0);
   txphase(zero);

   delay(2.0e-6);
   zgradpulse(gzlvl9,gt9);
   delay(gstab);

  if(CT_flg[A] == 'y' && n_shift[A] == 'n') {

   decrgpulse(pwc,t2,0.0,0.0);
   decphase(zero);

   delay(tau2);

   decpower(d_co180);
   sim3shaped_pulse(Hshp,co_shp,"hard",pwhshp,pwco180,2.0*pwn,zero,zero,zero,4.0e-6,0.0);

   delay(TC2/2.0 - tau2 - POWER_DELAY - 4.0e-6 - WFG3_START_DELAY - pwco180
         - WFG3_STOP_DELAY - pwd1 
         - gt10 - gstab -2.0e-6 - POWER_DELAY
         - 4.0e-6 - WFG_START_DELAY);

   dec3rgpulse(pwd1,zero,0.0,0.0);

   delay(tau2);

   delay(2.0e-6);
   zgradpulse(gzlvl10,gt10);
   delay(gstab);

   initval(1.0,v4);
   decstepsize(ph_reb);
   dcplrphase(v4);

   decpower(d_reb);

   decshaped_pulse(shreb,pwreb,zero,4.0e-6,0.0);
   dcplrphase(zero);

   decphase(zero); decpower(dhpwr);
   
   delay(2.0e-6);
   zgradpulse(gzlvl10,gt10);
   delay(gstab);

   delay(TC2/2.0 - tau2 - WFG_STOP_DELAY - POWER_DELAY 
         - gt10 - gstab -2.0e-6); 

   decrgpulse(pwc,zero,0.0,0.0);

   dec3rgpulse(pwd1,two,4.0e-6,0.0);

   }

  if(CT_flg[A] == 'y' && n_shift[A] == 'y') {

   dec2phase(t2); delay(2.0e-6);

   dec2rgpulse((pwn-pwc)/2.0,t2,0.0,0.0);
   sim3pulse(0.0e-6,pwc,pwc,zero,t2,t2,0.0,0.0);
   dec2rgpulse((pwn-pwc)/2.0,t2,0.0,0.0);

   decphase(zero);

   delay(tau2);

   decphase(zero);
   decpower(d_co180);
   sim3shaped_pulse(Hshp,co_shp,"hard",pwhshp,pwco180,0.0e-6,zero,zero,zero,4.0e-6,2.0e-6);

   decpower(d_ibca);
   decshaped_pulse(shibca,pwibca,zero,4.0e-6,0.0);
   decphase(zero);

   delay(TC2/2.0 - tau2 - POWER_DELAY - 4.0e-6 - WFG3_START_DELAY - pwco180
         - WFG3_STOP_DELAY - 2.0e-6 - POWER_DELAY - WFG_START_DELAY
         - 4.0e-6 - pwibca - WFG_STOP_DELAY - pwd1 
         - gt10 - gstab -2.0e-6 - POWER_DELAY
         - 4.0e-6 - WFG3_START_DELAY);

   dec3rgpulse(pwd1,zero,0.0,0.0);

   delay(tau2);

   delay(2.0e-6);
   zgradpulse(gzlvl10,gt10);
   delay(gstab);

   initval(1.0,v4);
   decstepsize(ph_reb1);
   dcplrphase(v4);

   decpower(d_reb);

   sim3shaped_pulse("hard",shreb,"hard",0.0e-6,pwreb,2.0*pwn,zero,zero,zero,4.0e-6,0.0);
   dcplrphase(zero);

   decphase(t7); decpower(d_ibca);
   decshaped_pulse(shibcai,pwibca,t7,4.0e-6,0.0);
   decpower(dhpwr); decphase(zero);
   
   delay(2.0e-6);
   zgradpulse(gzlvl10,gt10);
   delay(gstab);

   delay(TC2/2.0 - tau2 - WFG3_STOP_DELAY - POWER_DELAY 
         - 4.0e-6 - WFG_START_DELAY - pwibca - WFG_STOP_DELAY 
         - POWER_DELAY
         - gt10 - gstab -2.0e-6); 

   dec2rgpulse((pwn-pwc)/2.0,zero,0.0,0.0);
   sim3pulse(0.0e-6,pwc,pwc,zero,zero,zero,0.0,0.0);
   dec2rgpulse((pwn-pwc)/2.0,zero,0.0,0.0);

   dec3rgpulse(pwd1,two,4.0e-6,0.0);

   }

   if(CT_flg[A] == 'n' && n_shift[A] == 'n') {

      txphase(one);
      decrgpulse(pwc,t2,0.0,0.0);

      if(c180_flg[A] == 'n')
    {

      decphase(zero);

      /* seduce on */
      decpower(dpwrsed);
      decprgon(codecseq,pwcodec,dressed);
      decon();
      /* seduce on */

      delay(tau2);

      rgpulse(pw,one,0.0,0.0);
      rgpulse(2.0*pw,zero,2.0e-6,0.0);
      rgpulse(pw,one,2.0e-6,0.0);

      dec2rgpulse(2.0*pwn,zero,0.0,0.0);

      delay(tau2); 

      /* seduce off */
      decoff();
      decprgoff();
      decpower(dhpwr);
      /* seduce off */

    }

      else
         decrgpulse(2.0*pwc,zero,4.0e-6,0.0);

      decrgpulse(pwc,zero,4.0e-6,0.0);

   }

   if(CT_flg[A] == 'n' && n_shift[A] == 'y') {

      txphase(one); dec2phase(t2);

      dec2rgpulse((PI-2.0)/PI*(pwn-pwc),t2,2.0e-6,0.0);
      sim3pulse(0.0e-6,pwc,pwc,zero,t2,t2,0.0,0.0);
      dec2rgpulse((2.0/PI)*(pwn-pwc),t2,0.0,0.0);

      if(c180_flg[A] == 'n')
    {

      decphase(zero);

      /* seduce on */
      decpower(dpwrsed);
      decprgon(codecseq,pwcodec,dressed);
      decon();
      /* seduce on */

      delay(tau2);

      rgpulse(pw,one,0.0,0.0);
      rgpulse(2.0*pw,zero,2.0e-6,0.0);
      rgpulse(pw,one,2.0e-6,0.0);

      delay(tau2); 

      /* seduce off */
      decoff();
      decprgoff();      /* note that ca-n evolves ; keep t2,max <= 9.5ms */
      decpower(dhpwr);
      /* seduce off */

    }

      else
         sim3pulse(0.0,2.0*pwc,2.0*pwn,zero,zero,zero,4.0e-6,0.0);

      dec2rgpulse((2.0/PI)*(pwn-pwc),zero,4.0e-6,0.0);
      sim3pulse(0.0e-6,pwc,pwc,zero,zero,zero,0.0,0.0);
      dec2rgpulse((PI-2.0)/PI*(pwn-pwc),zero,0.0,0.0);

   }

   delay(2.0e-6);
   zgradpulse(gzlvl11,gt11);
   delay(gstab);

   lk_sample();

   rgpulse(pw,t8,4.0e-6,0.0);                    /* 90 deg 1H pulse */

   delay(2.0e-6);
   zgradpulse(gzlvl12,gt12);
   delay(2.0e-6);

   decpower(d_ib);

   if(n_shift[A] == 'n') {

   delay(taua - gt12 - 4.0e-6 - WFG2_START_DELAY - POWER_DELAY);
   simshaped_pulse(Hshp,shib,pwhshp,pwib,t8,zero,0.0,0.0);
   decphase(zero);
   }

   else {
 delay(taua - gt12 - 4.0e-6 - WFG3_START_DELAY - POWER_DELAY);                 
 sim3shaped_pulse(Hshp,shib,"hard",pwhshp,pwib,2.0*pwn,t8,zero,zero,0.0,0.0);
    }

   delay(2.0e-6);
   zgradpulse(gzlvl12,gt12);
   delay(2.0e-6);

   if(n_shift[A] == 'n')
     delay(taua - gt12 - 4.0e-6 - WFG2_STOP_DELAY - 2.0*POWER_DELAY);
   else
     delay(taua - gt12 - 4.0e-6 - WFG3_STOP_DELAY - 2.0*POWER_DELAY);

   decpower(dpwr);  /* Set power for decoupling */
   dec2power(dpwr2);  /* Set power for decoupling */

   rgpulse(pw,t8,0.0,rof2);

/* BEGIN ACQUISITION */

status(C);
setreceiver(t9);

}
コード例 #12
0
ファイル: ghncaco_trosy_3DA.c プロジェクト: timburrow/ovj3
pulsesequence()

{

    /* DECLARE VARIABLES */

    char       autocal[MAXSTR],  /* auto-calibration flag */
               fsat[MAXSTR],
               fscuba[MAXSTR],
               f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
               f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
               fc180[MAXSTR],    /* Flag for checking sequence               */
               ddseq[MAXSTR],    /* deuterium decoupling sequence */
               spcosed[MAXSTR],  /* waveform Co seduce 180 */
               spcareb[MAXSTR],  /* waveform Ca reburp 180 */
               spca180[MAXSTR],  /* waveform Ca hard 180   */
               sel_flg[MAXSTR],
               shp_sl[MAXSTR],
               cacb_dec[MAXSTR],
               cacbdecseq[MAXSTR],
               nietl_flg[MAXSTR];

    int         phase, phase2, ni, icosel,
                t1_counter,   /* used for states tppi in t1           */
                t2_counter;   /* used for states tppi in t2           */

    double      tau1,         /*  t1 delay */
                tau2,         /*  t2 delay */
                taua,         /*  ~ 1/4JNH =  2.25 ms */
                taub,         /*  ~ 1/4JNH =  2.25 ms */
                tauc,         /*  ~ 1/4JNCa =  ~13 ms */
                taud,         /*  ~ 1/4JCaC' =  3~4.5 ms ms */
                bigTN,        /* nitrogen T period */
                pwc90,       /* PW90 for ca nucleus @ d_c90         */
                pwca180,      /* PW180 for ca nucleus @ d_c180         */
                pwca180dec,   /* pwca180+pad         */
                pwcareb,      /* pw180 at d_creb  ~ 1.6 ms at 600 MHz */
                pwcosed,      /* PW180 at d_csed  ~ 200us at 600 MHz  */
                tsatpwr,      /* low level 1H trans.power for presat  */
                d_c90,        /* power level for 13C pulses(pwc90=sqrt(15)/4delta
			      delta is the separation between Ca and Co */
                d_c180,	   /* power level for pwca180(sqrt(3)/2delta) */
                d_creb,	   /* power level for pwcareb */
                d_csed,       /* power level for pwcosed */
                sw1,          /* sweep width in f1                    */
                sw2,          /* sweep width in f2                    */
                pw_sl,        /* selective pulse on water      */
                tpwrsl,       /* power for pw_sl               */
                at,
                sphase,	   /* small angle phase shift  */
                sphase1,
                phase_sl,

                d_cacbdec,
                pwcacbdec,
                dres_dec,

                pwD,          /* PW90 for higher power (pwDlvl) deut 90 */
                pwDlvl,       /* high power for deut 90 hard pulse */

                compC,       /* C-13 RF calibration parameters */
                pwC,
                pwClvl,

                pwN,          /* PW90 for 15N pulse              */
                pwNlvl,       /* high dec2 pwr for 15N hard pulses    */

                gstab,

                gt1,
                gt2,
                gt3,
                gt4,
                gt5,
                gt6,
                gt7,
                gt8,
                gt9,
                gt10,

                gzlvl1,
                gzlvl2,
                gzlvl3,
                gzlvl4,
                gzlvl5,
                gzlvl6,
                gzlvl7,
                gzlvl8,
                gzlvl9,
                gzlvl10;

    /* LOAD VARIABLES */

    getstr("autocal",autocal);
    getstr("fsat",fsat);
    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("fc180",fc180);
    getstr("fscuba",fscuba);
    getstr("ddseq",ddseq);
    getstr("shp_sl",shp_sl);
    getstr("sel_flg",sel_flg);
    getstr("cacb_dec",cacb_dec);

    getstr("nietl_flg",nietl_flg);

    taua   = getval("taua");
    taub   = getval("taub");
    tauc   = getval("tauc");
    taud   = getval("taud");
    bigTN = getval("bigTN");
    pwN = getval("pwN");
    tpwr = getval("tpwr");
    tsatpwr = getval("tsatpwr");
    dpwr = getval("dpwr");
    pwNlvl = getval("pwNlvl");
    pwD = getval("pwD");
    pwDlvl = getval("pwDlvl");
    phase = (int) ( getval("phase") + 0.5);
    phase2 = (int) ( getval("phase2") + 0.5);
    sw1 = getval("sw1");
    sw2 = getval("sw2");
    ni = getval("ni");
    pw_sl = getval("pw_sl");
    tpwrsl = getval("tpwrsl");
    at = getval("at");
    sphase = getval("sphase");
    sphase1 = getval("sphase1");
    phase_sl = getval("phase_sl");

    gstab = getval("gstab");

    gt1 = getval("gt1");
    if (getval("gt2") > 0) gt2=getval("gt2");
    else gt2=gt1*0.1;
    gt3 = getval("gt3");
    gt4 = getval("gt4");
    gt5 = getval("gt5");
    gt6 = getval("gt6");
    gt7 = getval("gt7");
    gt8 = getval("gt8");
    gt9 = getval("gt9");
    gt10 = getval("gt10");

    gzlvl1 = getval("gzlvl1");
    gzlvl2 = getval("gzlvl2");
    gzlvl3 = getval("gzlvl3");
    gzlvl4 = getval("gzlvl4");
    gzlvl5 = getval("gzlvl5");
    gzlvl6 = getval("gzlvl6");
    gzlvl7 = getval("gzlvl7");
    gzlvl8 = getval("gzlvl8");
    gzlvl9 = getval("gzlvl9");
    gzlvl10 = getval("gzlvl10");


    if(autocal[0]=='n')
    {
        getstr("spcosed",spcosed);
        getstr("spcareb",spcareb);
        getstr("spca180",spca180);
        getstr("cacbdecseq",cacbdecseq);

        d_c90 = getval("d_c90");
        d_c180 = getval("d_c180");
        d_creb = getval("d_creb");
        d_csed = getval("d_csed");

        pwc90 = getval("pwc90");
        pwca180 = getval("pwca180");
        pwca180dec = getval("pwca180dec");
        pwcareb = getval("pwcareb");
        pwcosed = getval("pwcosed");

        d_cacbdec = getval("d_cacbdec");
        pwcacbdec = getval("pwcacbdec");
        dres_dec = getval("dres_dec");
    }
    else
    {
        strcpy(spcosed,"Phard_118p");
        strcpy(spcareb,"Preburp_-15p");
        strcpy(spca180,"Phard_-118p");
        strcpy(cacbdecseq,"Pcb_dec");
        if (FIRST_FID)
        {
            compC = getval("compC");
            pwC = getval("pwC");
            pwClvl = getval("pwClvl");
            co180 = pbox(spcosed, CO180, CA180ps, dfrq, compC*pwC, pwClvl);
            creb = pbox(spcareb, CREB180, CAB180ps, dfrq, compC*pwC, pwClvl);
            ca180 = pbox(spca180, CA180, CA180ps, dfrq, compC*pwC, pwClvl);
            cbdec = pbox(cacbdecseq, CBDEC,CBDECps, dfrq, compC*pwC, pwClvl);
            c90 = pbox("Phard90", C90, CA180ps, dfrq, compC*pwC, pwClvl);
        }
        d_c90 = c90.pwr;
        d_c180 = ca180.pwr;
        d_creb = creb.pwr;
        d_csed = co180.pwr;
        pwc90 = c90.pw;
        pwca180 = ca180.pw;
        pwca180dec = ca180.pw;
        pwcareb = creb.pw;
        pwcosed = co180.pw;

        d_cacbdec = cbdec.pwr;
        pwcacbdec = 1.0/cbdec.dmf;
        dres_dec = cbdec.dres;
    }

    /* LOAD PHASE TABLE */

    settable(t1,2,phi1);
    settable(t2,4,phi2);
    settable(t3,8,phi3);
    settable(t4,2,phi4);
    settable(t5,1,phi5);
    settable(t6,8,rec);

    /* CHECK VALIDITY OF PARAMETER RANGES */

    if(ix==1)
        printf("Uses shared AT in the N dimension. Choose ni2 as desired\n");


    if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y' ))
    {
        printf("incorrect dec1 decoupler flags!  ");
        psg_abort(1);
    }

    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y'))
    {
        printf("incorrect dec2 decoupler flags! Should be 'nnn' ");
        psg_abort(1);
    }


    if( tsatpwr > 6 )
    {
        printf("TSATPWR too large !!!  ");
        psg_abort(1);
    }

    if( dpwr > -16 )
    {
        printf("DPWR too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > -16 )
    {
        printf("DPWR2 too large!  ");
        psg_abort(1);
    }

    if( pw > 200.0e-6 )
    {
        printf("dont fry the probe, pw too high ! ");
        psg_abort(1);
    }

    if( pwN > 200.0e-6 )
    {
        printf("dont fry the probe, pwN too high ! ");
        psg_abort(1);
    }

    if( gt1 > 3e-3 || gt2 > 3e-3 || gt3 > 3e-3
            || gt4 > 3e-3 || gt5 > 3e-3 || gt6 > 3e-3
            || gt7 > 3e-3 || gt8 > 3e-3 || gt9 > 3e-3 || gt10 > 3e-3)
    {
        printf("gti values must be < 3e-3\n");
        psg_abort(1);
    }

    if(tpwrsl > 30) {
        printf("tpwrsl must be less than 25\n");
        psg_abort(1);
    }

    if( pwDlvl > 59) {
        printf("pwDlvl too high\n");
        psg_abort(1);
    }

    if( dpwr3 > 50) {
        printf("dpwr3 too high\n");
        psg_abort(1);
    }

    if( pw_sl > 10e-3) {
        printf("too long pw_sl\n");
        psg_abort(1);
    }

    if(d_cacbdec > 40) {
        printf("d_cacbdec is too high; < 41\n");
        psg_abort(1);
    }

    if(nietl_flg[A] == 'y' && sel_flg[A] == 'y') {
        printf("nietl_flg and sel_flg cannot both be y\n");
        psg_abort(1);
    }

    if (fc180[A] =='y' && ni > 1.0) {
        text_error("must set fc180='n' to allow C' evolution (ni>1)\n");
        psg_abort(1);
    }


    /*  Phase incrementation for hypercomplex 2D data */

    if (phase == 2) tsadd(t2,1,4);

    if (phase2 == 2) {
        tsadd(t5,2,4);
        icosel = 1;
    }
    else icosel = -1;

    if (nietl_flg[A] == 'y') icosel = -1*icosel;

    /*  Set up f1180  tau2 = t1               */

    tau1 = d2;
    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1)
                  - 4.0/PI*pwc90 - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
                  - pwca180dec - WFG_STOP_DELAY - 2.0*pwN - POWER_DELAY
                  - 4.0e-6);
    }

    if(f1180[A] == 'n')
        tau1 = ( tau1
                 - 4.0/PI*pwc90 - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
                 - pwca180dec - WFG_STOP_DELAY - 2.0*pwN - POWER_DELAY
                 - 4.0e-6);

    if(tau1 < 0.2e-6) tau1 = 0.2e-6;
    tau1 = tau1/2.0;

    /*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) );
        if(tau2 < 0.2e-6) tau2 = 0.2e-6;
    }
    tau2 = tau2/2.0;

    /* Calculate modifications to phases for States-TPPI acquisition          */

    if( ix == 1) d2_init = d2 ;
    t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
    if(t1_counter % 2) {
        tsadd(t2,2,4);
        tsadd(t6,2,4);
    }

    if( ix == 1) d3_init = d3 ;
    t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );
    if(t2_counter % 2) {
        tsadd(t3,2,4);
        tsadd(t6,2,4);
    }

    /* BEGIN ACTUAL PULSE SEQUENCE */

    status(A);
    obspower(tsatpwr);     /* Set transmitter power for 1H presaturation */
    decpower(d_c180);       /* Set Dec1 power to high power          */
    dec2power(pwNlvl);     /* Set Dec2 power for 15N hard pulses         */
    decoffset(dof);


    /* Presaturation Period */

    if (fsat[0] == 'y')
    {
        delay(2.0e-5);
        rgpulse(d1,zero,2.0e-6,2.0e-6);
        obspower(tpwr);      /* Set transmitter power for hard 1H pulses */
        delay(2.0e-5);
        if(fscuba[0] == 'y')
        {
            delay(2.2e-2);
            rgpulse(pw,zero,2.0e-6,0.0);
            rgpulse(2*pw,one,2.0e-6,0.0);
            rgpulse(pw,zero,2.0e-6,0.0);
            delay(2.2e-2);
        }
    }
    else
    {
        delay(d1);
    }
    obspower(tpwr);           /* Set transmitter power for hard 1H pulses */
    txphase(zero);
    dec2phase(zero);
    delay(1.0e-5);

    /* Begin Pulses */

    status(B);

    rcvroff();
    lk_hold();
    delay(20.0e-6);

    initval(1.0,v2);
    obsstepsize(phase_sl);
    xmtrphase(v2);

    /* shaped pulse */
    obspower(tpwrsl);
    shaped_pulse(shp_sl,pw_sl,one,4.0e-6,0.0);
    xmtrphase(zero);
    obspower(tpwr);
    txphase(zero);
    delay(4.0e-6);
    /* shaped pulse */

    rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */

    delay(0.2e-6);
    zgradpulse(gzlvl5,gt5);
    delay(2.0e-6);

    delay(taua - gt5 - 2.2e-6);   /* taua <= 1/4JNH */

    sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);

    txphase(three);
    dec2phase(zero);
    decphase(zero);

    delay(taua - gt5 - 200.2e-6 - 2.0e-6);

    delay(0.2e-6);
    zgradpulse(gzlvl5,gt5);
    delay(200.0e-6);

    if (sel_flg[A] == 'n')
    {
        rgpulse(pw,three,2.0e-6,0.0);

        decpower(d_c180);

        delay(0.2e-6);
        zgradpulse(gzlvl3,gt3);
        delay(200.0e-6);

        dec2rgpulse(pwN,zero,0.0,0.0);

        delay(tauc);

        dec2rgpulse(2*pwN,zero,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(one);

        delay(tauc - pwca180);

        dec2rgpulse(pwN,one,0.0,0.0);
    }
    else
    {
        rgpulse(pw,one,2.0e-6,0.0);

        decpower(d_c180);

        initval(1.0,v5);
        dec2stepsize(45.0);
        dcplr2phase(v5);

        delay(0.2e-6);
        zgradpulse(gzlvl3,gt3);
        delay(200.0e-6);

        dec2rgpulse(pwN,zero,0.0,0.0);
        dcplr2phase(zero);

        delay(1.34e-3 - SAPS_DELAY - 2.0*pw);

        rgpulse(pw,one,0.0,0.0);
        rgpulse(2.0*pw,zero,0.0,0.0);
        rgpulse(pw,one,0.0,0.0);

        delay(tauc - 1.34e-3 - 2.0*pw);

        dec2rgpulse(2*pwN,zero,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(one);

        delay(tauc - pwca180);

        dec2rgpulse(pwN,one,0.0,0.0);
    }
    /* END sel_flg */

    decphase(t1);

    decpower(d_c90);

    delay(0.2e-6);
    zgradpulse(gzlvl8,gt8);
    delay(200.0e-6);

    /* Cay to CaxC'z  */
    dec2phase(zero);
    txphase(zero);

    /* Turn on D decoupling using the third decoupler */
    dec3phase(one);
    dec3power(pwDlvl);
    dec3rgpulse(pwD,one,4.0e-6,0.0);
    dec3phase(zero);
    dec3power(dpwr3);
    dec3unblank();
    setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
    /* Turn on D decoupling */

    if (cacb_dec[A] == 'n')
    {
        decrgpulse(pwc90,t1,2.0e-6,0.0);

        delay(taud -POWER_DELAY -4.0e-6 -WFG_START_DELAY);

        initval(1.0,v3);
        decstepsize(sphase);
        dcplrphase(v3);

        decpower(d_creb);
        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 2.0e-6);

        decpower(d_c90);
        decrgpulse(pwc90,one,2.0e-6,0.0);
    }
    else
    {
        decrgpulse(pwc90,t1,2.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        initval(1.0,v3);
        decstepsize(sphase);
        dcplrphase(v3);

        decpower(d_creb);
        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY - 2.0e-6);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_c90);
        decrgpulse(pwc90,one,2.0e-6,0.0);
    }
    /* END cacb_dec */

    /* Turn off D decoupling */
    setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
    dec3blank();
    dec3phase(three);
    dec3power(pwDlvl);
    dec3rgpulse(pwD,three,4.0e-6,0.0);
    /* Turn off D decoupling */

    decoffset(dof+(174-56)*dfrq);   /* change Dec1 carrier to Co  */

    delay(2.0e-7);
    zgradpulse(gzlvl4,gt4);
    delay(100.0e-6);

    /*  t1 period for C' chemical shift evolution; Ca 180 and N 180 are used
        to decouple  */

    decrgpulse(pwc90,t2,2.0e-6,0.0);
    if (fc180[A]=='n')
    {
        decpower(d_c180);
        delay(tau1);
        decshaped_pulse(spca180,pwca180dec,zero,4.0e-6,0.0);
        dec2rgpulse(2*pwN,zero,0.0,0.0);
        delay(tau1);
        decpower(d_c90);
    }
    else
        decrgpulse(2*pwc90,zero,0.0,0.0);

    decrgpulse(pwc90,zero,4.0e-6,0.0);

    decoffset(dof);  /* set carrier to Ca */


    delay(2.0e-7);
    zgradpulse(gzlvl9,gt9);
    delay(100.0e-6);

    /*  Refocusing  CayC'z to Cax  */

    /* Turn on D decoupling using the third decoupler */
    dec3phase(one);
    dec3power(pwDlvl);
    dec3rgpulse(pwD,one,4.0e-6,0.0);
    dec3phase(zero);
    dec3power(dpwr3);
    dec3unblank();
    setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
    /* Turn on D decoupling */

    if (cacb_dec[A] == 'n')
    {
        decrgpulse(pwc90,zero,0.0e-6,0.0);

        delay(taud - POWER_DELAY
              - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        decpower(d_creb);
        initval(1.0,v4);
        decstepsize(sphase1);
        dcplrphase(v4);

        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6);

        decpower(d_c90);
        decrgpulse(pwc90,one,4.0e-6,0.0);
    }
    else
    {
        decrgpulse(pwc90,zero,0.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        decpower(d_creb);
        initval(1.0,v4);
        decstepsize(sphase1);
        dcplrphase(v4);

        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_c90);
        decrgpulse(pwc90,one,4.0e-6,0.0);
    }
    /* END cacb_dec */

    /* Turn off D decoupling */
    setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
    dec3blank();
    dec3phase(three);
    dec3power(pwDlvl);
    dec3rgpulse(pwD,three,4.0e-6,0.0);
    /* Turn off D decoupling */

    decpower(d_c180);
    txphase(zero);

    delay(2.0e-7);
    zgradpulse(gzlvl10,gt10);
    delay(100.0e-6);

    /* Constant t2 period  */

    if (bigTN - tau2 >= 0.2e-6)
    {
        dec2rgpulse(pwN,t3,2.0e-6,0.0);

        dec2phase(t4);

        delay(bigTN - tau2 + pwca180);

        dec2rgpulse(2*pwN,t4,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(t5);

        decpower(d_csed);

        delay(bigTN - gt1 - 502.0e-6 - 2.0*GRADIENT_DELAY - POWER_DELAY
              - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY);

        delay(2.0e-6);
        zgradpulse(gzlvl1,gt1);
        delay(500.0e-6);

        decshaped_pulse(spcosed,pwcosed,zero,0.0,0.0);

        delay(tau2);

        sim3pulse(pw,0.0e-6,pwN,zero,zero,t5,0.0,0.0);
    }
    else
    {
        dec2rgpulse(pwN,t3,2.0e-6,0.0);

        dec2rgpulse(2.0*pwN,t4,2.0e-6,2.0e-6);
        dec2phase(t5);

        delay(tau2 - bigTN);
        decrgpulse(pwca180,zero,0.0,0.0);

        decpower(d_csed);

        delay(bigTN - pwca180 - POWER_DELAY
              - gt1 - 502.0e-6 - 2.0*GRADIENT_DELAY
              - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY);

        delay(2.0e-6);
        zgradpulse(gzlvl1,gt1);
        delay(500.0e-6);

        decshaped_pulse(spcosed,pwcosed,zero,0.0,0.0);

        delay(tau2);

        sim3pulse(pw,0.0e-6,pwN,zero,zero,t5,0.0,0.0);
    }

    if (nietl_flg[A] == 'n')
    {
        delay(0.2e-6);
        zgradpulse(gzlvl6,gt6);
        delay(2.0e-6);

        dec2phase(zero);
        delay(taub - gt6 - 2.2e-6);

        sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);

        delay(0.2e-6);
        zgradpulse(gzlvl6,gt6);
        delay(200.0e-6);

        delay(taub - gt6 - 200.2e-6);
        txphase(one);
        dec2phase(one);

        sim3pulse(pw,0.0e-6,pwN,one,zero,one,0.0,0.0);

        delay(0.2e-6);
        zgradpulse(gzlvl7,gt7);
        delay(2.0e-6);

        txphase(zero);
        dec2phase(zero);

        delay(taub - gt7 - 2.2e-6);

        sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);

        delay(0.2e-6);
        zgradpulse(gzlvl7,gt7);
        delay(200.0e-6);

        delay(taub - gt7 - 200.2e-6);

        sim3pulse(pw,0.0e-6,pwN,zero,zero,zero,0.0,0.0);

    }
    else
    {

        /* shaped pulse */
        obspower(tpwrsl);
        shaped_pulse(shp_sl,pw_sl,zero,4.0e-6,0.0);
        obspower(tpwr);
        txphase(zero);
        delay(4.0e-6);
        /* shaped pulse */

        delay(0.2e-6);
        zgradpulse(gzlvl6,gt6);
        delay(2.0e-6);

        dec2phase(zero);
        delay(taub - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pw_sl
              - WFG_STOP_DELAY - POWER_DELAY - 4.0e-6
              - gt6 - 2.2e-6);

        sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);
        txphase(one);
        dec2phase(zero);

        delay(0.2e-6);
        zgradpulse(gzlvl6,gt6);
        delay(200.0e-6);

        delay(taub - gt6 - 200.2e-6);

        sim3pulse(pw,0.0e-6,pwN,one,zero,zero,0.0,0.0);

        delay(0.2e-6);
        zgradpulse(gzlvl7,gt7);
        delay(2.0e-6);

        txphase(zero);
        dec2phase(zero);

        delay(taub - gt7 - 2.2e-6);

        sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);
        txphase(one);
        dec2phase(one);

        delay(0.2e-6);
        zgradpulse(gzlvl7,gt7);
        delay(200.0e-6);

        delay(taub - gt7 - 200.2e-6);

        sim3pulse(pw,0.0e-6,pwN,one,zero,one,0.0,0.0);
        txphase(zero);
    }

    delay(gt2 +gstab -0.5*(pwN -pw) -2.0*pw/PI);

    rgpulse(2*pw,zero,0.0,0.0);

    delay(2.0e-6);
    zgradpulse(icosel*gzlvl2, gt2);
    decpower(dpwr);
    dec2power(dpwr2);
    delay(gstab -2.0e-6 -2.0*GRADIENT_DELAY -2.0*POWER_DELAY);

    lk_sample();
    status(C);
    setreceiver(t6);

}