Ejemplo n.º 1
0
pulsesequence()
{
  int       t1_counter;
  char	    CCLS[MAXSTR],	      /* C13 refocussing pulse in middle of t1 */
            wtg3919[MAXSTR],
	    f1180[MAXSTR];   		       /* Flag to start t1 @ halfdwell */

  double    timeCT=getval("timeCT"),
 	    tauxh, tau1,
            gzlvl3=getval("gzlvl3"),
            gzlvl4=getval("gzlvl4"),
            gt3=getval("gt3"),
            gt4=getval("gt4"),
            gstab=getval("gstab"),			/* gradient recovery delay */
            JNH = getval("JNH"),
            pwN = getval("pwN"),
            pwNlvl = getval("pwNlvl"),  
            pwHs, tpwrs=0.0, compH=1.0,          /* H1 90 degree pulse length at tpwrs */               
            sw1 = getval("sw1"),
                               /* temporary Pbox parameters */
            pwClvl = getval("pwClvl"), 	         /* coarse power for C13 pulse */
            pwC = getval("pwC");       /* C13 90 degree pulse length at pwClvl */

    getstr("CCLS",CCLS);
    getstr("wtg3919",wtg3919);
    getstr("f1180",f1180);
    
/* check validity of parameter range */

    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') )
    { text_error("incorrect Dec2 decoupler flags!  "); psg_abort(1); } 

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

/* INITIALIZE VARIABLES */
    
    if(wtg3919[0] != 'y')      /* selective H20 one-lobe sinc pulse needs 1.69  */
    {                                   /* times more power than a square pulse */
      pwHs = getval("pwHs");            
      compH = getval("compH");
    }
    else 
      pwHs = pw*2.385+7.0*rof1+d3*2.5; 

    tauxh = ((JNH != 0.0) ? 1/(4*(JNH)) : 2.25e-3);

    setautocal();                        /* activate auto-calibration flags */ 
        
    if (autocal[0] == 'n') 
    {
      if(wtg3919[0] != 'y')      /* selective H20 one-lobe sinc pulse needs 1.69  */
      {                                   /* times more power than a square pulse */
        if (pwHs > 1e-6) tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));  
        else tpwrs = 0.0;
        tpwrs = (int) (tpwrs); 
      }	  
    }
    else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
    {
      if(FIRST_FID)                                            /* call Pbox */
      {
        if(wtg3919[0] != 'y')
          H2Osinc = pbox_Rsh("H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
      }
      if (wtg3919[0] != 'y') 
        { pwHs = H2Osinc.pw; tpwrs = H2Osinc.pwr-1.0; } /* 1dB correction applied */ 
    }

/* LOAD VARIABLES */

    if(ix == 1) d2_init = d2;
    t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5);
    
/*  Set up f1180  */
   
    tau1 = d2;
    if((f1180[A] == 'y') && (ni > 1.0)) 
	{ tau1 += ( 1.0 / (2.0*sw1) ); if(tau1 < 0.2e-6) tau1 = 0.0; }
    tau1 = tau1/2.0;


/* LOAD PHASE TABLES */

      assign(one,v7); 
      assign(three,v8);
      settable(t1, 4, phi1);
      settable(t2, 2, phi2);
      settable(t3, 8, phi3);
      settable(t4, 16, phi4);
      settable(t5, 8, rec);  

      if ( phase1 == 2 ) tsadd(t2, 1, 4); 
                                   
    if(t1_counter %2)          /* calculate modification to phases based on */
    { tsadd(t2,2,4); tsadd(t5,2,4); }   /* current t1 values */

    if(wtg3919[0] != 'y') 
    { add(one,v7,v7); add(one,v8,v8); }
         
                           /* sequence starts!! */
   status(A);
     
     obspower(tpwr);
     dec2power(pwNlvl);
     decpower(pwClvl); decpwrf(4095.0);
     delay(d1);
     
   status(B);

     rgpulse(pw, zero, rof1, rof1);
     
     zgradpulse(0.3*gzlvl3,gt3);
     txphase(zero);
     dec2phase(zero);
     delay(tauxh-gt3);               /* delay=1/4J(XH)   */

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

     zgradpulse(0.3*gzlvl3,gt3);
     dec2phase(t2);
     delay(tauxh-gt3 );               /* delay=1/4J(XH)   */
  
     rgpulse(pw, t1, rof1, rof1);

     decphase(zero);
     txphase(t4);      
     zgradpulse(gzlvl3,gt3);
     delay(gstab); 

       dec2rgpulse(pwN, t2, rof1, rof1);
/* CT EVOLUTION BEGINS */
       dec2phase(t3);

       delay(timeCT -SAPS_DELAY -tau1);
       if (CCLS[A]=='y')
         {
          sim3pulse(0.0, 2.0*pwC, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
 
          delay(timeCT -2.0*pw); 

          rgpulse(2.0*pw, t4, 0.0, 0.0);  
         }
        else
         {
          dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
 
          delay(timeCT -2.0*pwC); 

          simpulse(2.0*pw, 2.0*pwC, t4, zero, 0.0, 0.0);
         }
       delay(tau1);
/* CT EVOLUTION ENDS */
       dec2rgpulse(pwN, t3, rof1, rof1);
       
       zgradpulse(gzlvl3,gt3);
       delay(gstab);

       rgpulse(pw, two, rof1, rof1);
       decrgpulse(pwC, zero, rof1, rof1);  

     zgradpulse(gzlvl4,gt4);
     txphase(v7); dec2phase(zero);
     delay(tauxh -gt4 -pwHs -rof1 -2.0*pwC -2.0*rof1);
     
     if(wtg3919[0] == 'y')
     {     	
       rgpulse(pw*0.231,v7,rof1,rof1);     
       delay(d3);
       rgpulse(pw*0.692,v7,rof1,rof1);
       delay(d3);
       rgpulse(pw*1.462,v7,rof1,rof1);

       delay(d3/2-pwN);
       dec2rgpulse(2*pwN, zero, rof1, rof1);
       txphase(v8);
       delay(d3/2-pwN);

       rgpulse(pw*1.462,v8,rof1,rof1);
       delay(d3);
       rgpulse(pw*0.692,v8,rof1,rof1);
       delay(d3);
       rgpulse(pw*0.231,v8,rof1,rof1); 
     }
     else
     {
       obspower(tpwrs);  
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr);
       sim3pulse(2.0*pw, 0.0, 2.0*pwN, v8, zero, zero, 0.0, 0.0);
       obspower(tpwrs);
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr);
     } 
        
     zgradpulse(gzlvl4,gt4);   
     delay(tauxh -gt4 -pwHs -rof1 -POWER_DELAY); 
     dec2power(dpwr2);

   status(C);
     setreceiver(t5);   
}
Ejemplo n.º 2
0
pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
            mag_flg[MAXSTR],      /* magic-angle coherence transfer gradients */
 	    TROSY[MAXSTR];			    /* To check for TROSY flag */
 
int         icosel,          			  /* used to get n and p type */
            t1_counter,  		        /* used for states tppi in t1 */
            t2_counter,  	 	        /* used for states tppi in t2 */
	    ni2 = getval("ni2");

double      p_d,
	    rfd,
	    ncyc,
	    COmix = getval("COmix"),
	    p_trim,
	    rftrim,
	    tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    kappa = 5.4e-3,
	    lambda = 2.4e-3,
            
	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 */
      bw, ofs, ppm,  /* bandwidth, offset, ppm - temporary Pbox parameters */

/* the following pulse lengths for SLP pulses are automatically calculated    */
/* by the macro "biocal".  SLP pulse shapes, "offC3" etc are called       */
/* directly from your shapelib.                    			      */
   pwC3 = getval("pwC3"),  /*180 degree pulse at Ca(56ppm) null at CO(174ppm) */
   pwC3a,                      /* pwC3a=pwC3, but not set to zero when pwC3=0 */
   phshift3,             /* phase shift induced on CO by pwC3 ("offC3") pulse */
   pwZ,					   /* the largest of pwC3 and 2.0*pwN */
   pwZ1,	       /* the largest of pwC3a and 2.0*pwN for 1D experiments */
   pwC6,                  /* 90 degree selective sinc pulse on CO(174ppm) */
   pwC8,                 /* 180 degree selective sinc pulse on CO(174ppm) */
   rf3,	                           /* fine power for the pwC3 ("offC3") pulse */
   rf6,	                           /* fine power for the pwC6 ("offC6") pulse */
   rf8,	                           /* fine power for the pwC8 ("offC8") pulse */

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

   	pwHs = getval("pwHs"),	        /* H1 90 degree pulse length at tpwrs */
   	tpwrsf = getval("tpwrsf"),    /* fine power adjustment for flipback   */
   	tpwrs,	  	              /* power for the pwHs ("H2Osinc") pulse */

   	pwHd,	    		        /* H1 90 degree pulse length at tpwrd */
   	tpwrd,	  	                   /* rf for WALTZ decoupling */

        waltzB1 = getval("waltzB1"),  /* waltz16 field strength (in Hz)     */
	pwNlvl = getval("pwNlvl"),	              /* power for N15 pulses */
        pwN = getval("pwN"),          /* N15 90 degree pulse length at pwNlvl */

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

	gt1 = getval("gt1"),  		       /* coherence pathway gradients */
        gzcal  = getval("gzcal"),            /* g/cm to DAC conversion factor */
	gzlvl1 = getval("gzlvl1"),
	gzlvl2 = getval("gzlvl2"),

	gt0 = getval("gt0"),				   /* other gradients */
	gt3 = getval("gt3"),
	gt4 = getval("gt4"),
	gt5 = getval("gt5"),
	gstab = getval("gstab"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),
	gzlvl6 = getval("gzlvl6");

    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("mag_flg",mag_flg);
    getstr("TROSY",TROSY);



/*   LOAD PHASE TABLE    */

	settable(t3,2,phi3);
	settable(t4,1,phx);
	settable(t5,4,phi5);

        settable(t8,1,phx);
	settable(t9,8,phi9);
	settable(t10,1,phx);
	settable(t11,1,phy);
	settable(t12,4,rec);


/*   INITIALIZE VARIABLES   */

    if( dpwrf < 4095 )
	{ printf("reset dpwrf=4095 and recalibrate C13 90 degree pulse");
	  psg_abort(1); }

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

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

      if (autocal[0] == 'n') 
      {
    /* offC3 - 180 degree pulse on Ca, null at CO 118ppm away */
        pwC3a = getval("pwC3a");    
        rf3 = (compC*4095.0*pwC*2.0)/pwC3a;
	  rf3 = (int) (rf3 + 0.5);  
	
    /* 90 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */	
        pwC6 = getval("pwC6");    
	  rf6 = (compC*4095.0*pwC*1.69)/pwC6;	/* needs 1.69 times more     */
	  rf6 = (int) (rf6 + 0.5);		/* power than a square pulse */

    /* 180 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */
        pwC8 = getval("pwC8");
	  rf8 = (compC*4095.0*pwC*2.0*1.65)/pwC8;	/* needs 1.65 times more     */
	  rf8 = (int) (rf8 + 0.5);		      /* power than a square pulse */

    /* selective H20 one-lobe sinc pulse */
        tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69)); /* needs 1.69 times more */
        tpwrs = (int) (tpwrs);                       /* power than a square pulse */

    /* power level and pulse time for WALTZ 1H decoupling */
	  pwHd = 1/(4.0 * waltzB1) ;                          
	  tpwrd = tpwr - 20.0*log10(pwHd/(compH*pw));
	  tpwrd = (int) (tpwrd + 0.5);
      }
      else      /* if autocal = 'y'(yes), 'q'(quiet), 'r'(read) or 's'(semi) */
      {
        if(FIRST_FID)                                         /* make shapes */
        {
          ppm = getval("dfrq"); 
          bw = 118.0*ppm; ofs = -bw; 
          offC3 = pbox_make("offC3", "square180n", bw, ofs, compC*pwC, pwClvl);
          offC6 = pbox_make("offC6", "sinc90n", bw, 0.0, compC*pwC, pwClvl);
          offC8 = pbox_make("offC8", "sinc180n", bw, 0.0, compC*pwC, pwClvl);
          H2Osinc = pbox_Rsh("H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
          wz16 = pbox_Dcal("WALTZ16", 2.8*waltzB1, 0.0, compH*pw, tpwr);


          ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
        }
        pwC3a = offC3.pw; rf3 = offC3.pwrf;             /* set up parameters */
        pwC6 = offC6.pw; rf6 = offC6.pwrf; 
        pwC8 = offC8.pw; rf8 = offC8.pwrf;
        pwHs = H2Osinc.pw; tpwrs = H2Osinc.pwr-1.0;  /* 1dB correction applied */
        tpwrd = wz16.pwr; pwHd = 1.0/wz16.dmf;  
      }

      if (tpwrsf < 4095.0) tpwrs = tpwrs + 6.0;

    /* the pwC3 pulse at the middle of t1  */
	if ((ni2 > 0.0) && (ni == 1.0)) ni = 0.0;
        if (pwC3a > 2.0*pwN) pwZ = pwC3a; else pwZ = 2.0*pwN;
        if ((pwC3==0.0) && (pwC3a>2.0*pwN)) pwZ1=pwC3a-2.0*pwN; else pwZ1=0.0;
	if ( ni > 1 )     pwC3 = pwC3a;
	if ( pwC3 > 0 )   phshift3 = 48.0;
	else              phshift3 = 0.0;

 
   /* dipsi-3 decoupling on COCO */
        p_trim = 1/(4*5000*(sfrq/600.0));  /* 5 kHz trim pulse at 600MHz as per Bax */
        p_d = (5.0)/(9.0*4.0*2800.0*(sfrq/600.0)); /* 2.8 kHz DIPSI-3 at 600MHz as per Bax*/
        rftrim = (compC*4095.0*pwC)/p_trim;
        rftrim = (int)(rftrim+0.5);
        rfd = (compC*4095.0*pwC*5.0)/(p_d*9.0);
        rfd = (int) (rfd + 0.5);
        ncyc = ((COmix - 0.002)/51.8/4/p_d);
        ncyc = (int) (ncyc + 0.5);
        initval(ncyc,v9);


/* CHECK VALIDITY OF PARAMETER RANGES */

    if ( 0.5*ni2*1/(sw2) > timeTN - WFG3_START_DELAY)
       { printf(" ni2 is too big. Make ni2 equal to %d or less.\n", 
  	 ((int)((timeTN - WFG3_START_DELAY)*2.0*sw2))); psg_abort(1);}

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

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

    if ( dpwr2 > 50 )
       { printf("dpwr2 too large! recheck value  "); psg_abort(1);}

    if ( pw > 50.0e-6 )
       { printf(" pw too long ! recheck value "); psg_abort(1);} 
  
    if ( (pwN > 100.0e-6) && (ni>1 || ni2>1))
       { printf(" pwN too long! recheck value "); psg_abort(1);} 
 
    if ( TROSY[A] == 'y')
      { printf(" TROSY option is not implemented"); psg_abort(1);}
      


/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 2)   tsadd(t3,1,4);  
    if (phase2 == 2)  
    {tsadd(t10,2,4); icosel = +1;}
    else 			       
    icosel = -1;    


/*  Set up f1180  */
   
    tau1 = d2;
    if((f1180[A] == 'y') && (ni > 1.0)) 
	{ tau1 += ( 1.0 / (2.0*sw1) ); if(tau1 < 0.2e-6) tau1 = 0.0; }


/*  Set up f2180  */

    tau2 = d3;
    if((f2180[A] == 'y') && (ni2 > 1.0)) 
	{ tau2 += ( 1.0 / (2.0*sw2) ); if(tau2 < 0.2e-6) tau2 = 0.0; }
    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(t3,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(t8,2,4); tsadd(t12,2,4); }



/* BEGIN PULSE SEQUENCE */

status(A);
   	delay(d1);
	rcvroff();
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rf0);
	obsoffset(tof);
	txphase(zero);
   	delay(1.0e-5);

	dec2rgpulse(pwN, zero, 0.0, 0.0);  /*destroy N15 and C13 magnetization*/
	decrgpulse(pwC, zero, 0.0, 0.0);
	zgradpulse(gzlvl0, 0.5e-3);
	delay(1.0e-4);
	dec2rgpulse(pwN, one, 0.0, 0.0);
	decrgpulse(pwC, zero, 0.0, 0.0);
	zgradpulse(0.7*gzlvl0, 0.5e-3);
	delay(5.0e-4);

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

   	dec2phase(zero);
	zgradpulse(gzlvl0, gt0);
	delay(lambda - gt0);

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

   	txphase(one);
	zgradpulse(gzlvl0, gt0);
	delay(lambda - gt0);

 	rgpulse(pw, one, 0.0, 0.0);
    txphase(zero);
    
    obspower(tpwrs); 
    if (tpwrsf<4095.0) obspwrf(tpwrsf);
    shaped_pulse("H2Osinc", pwHs, zero, 5.0e-4, 0.0);
    obspower(tpwrd); 
    if (tpwrsf<4095.0) obspwrf(4095.0);
    zgradpulse(gzlvl3, gt3);
    delay(2.0e-4);
    dec2rgpulse(pwN, zero, 0.0, 0.0);

    txphase(one);
    delay(kappa - pwHd - 2.0e-6 - PRG_START_DELAY);

    rgpulse(pwHd,one,0.0,0.0);
    txphase(zero);
    delay(2.0e-6);
    obsprgon("waltz16", pwHd, 90.0);	          /* PRG_START_DELAY */
    xmtron();
    decphase(zero);
    dec2phase(zero);
    decpwrf(rf8);
    delay(timeTN - kappa - WFG3_START_DELAY);
   
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC8", "", 0.0, pwC8, 2.0*pwN, zero, zero, zero, 
								     0.0, 0.0);
	decphase(t3);
	decpwrf(rf6);
	delay(timeTN);

	dec2rgpulse(pwN, zero, 0.0, 0.0);

    xmtroff();
    obsprgoff();
    rgpulse(pwHd,three,2.0e-6,0.0);
	zgradpulse(gzlvl3, gt3);
 	delay(2.0e-4);
 /***************************************************************/
 /* The sequence is different from here with respect to ghn_co **/
 /***************************************************************/

    rgpulse(pwHd,one,2.0e-6,0.0);	/* H1 decoupler is turned on */
    txphase(zero);
    delay(2.0e-6);
    obsprgon("waltz16", pwHd, 90.0);	          
    xmtron();
    decshaped_pulse("offC6", pwC6, t3, 0.0, 0.0);
    decphase(zero);


	/* Refocus CO, evolve CO, spinlock CO and defocus CO  */


	delay(timeTN - tau1/2 - 0.6*pwC6 - WFG3_START_DELAY);
	decpwrf(rf8);
	sim3shaped_pulse("", "offC8","",0.0,pwC8, 2.0*pwN, zero,zero,zero,0.0,0.0);
	decpwrf(rf3);
	delay(timeTN - WFG3_STOP_DELAY - WFG_START_DELAY - pwC3a/2);
	decshaped_pulse("offC3",pwC3a,zero,0.0,0.0);
	if (tau1 > 0)
	delay(tau1/2 - WFG_STOP_DELAY - pwC3a/2 - 2.0e-6);
	else
	  delay(tau1/2);
	  
/*******DO SPINLOCK ********/

	decpwrf(rftrim);		
	decrgpulse(0.002,zero,2.0e-6,0.0);
	decpwrf(rfd);
	starthardloop(v9);
		decrgpulse(6.4*p_d,zero,0.0,0.0);
		decrgpulse(8.2*p_d,two,0.0,0.0);
		decrgpulse(5.8*p_d,zero,0.0,0.0);
		decrgpulse(5.7*p_d,two,0.0,0.0);
		decrgpulse(0.6*p_d,zero,0.0,0.0);
		decrgpulse(4.9*p_d,two,0.0,0.0);
		decrgpulse(7.5*p_d,zero,0.0,0.0);
		decrgpulse(5.3*p_d,two,0.0,0.0);
		decrgpulse(7.4*p_d,zero,0.0,0.0);
		
		decrgpulse(6.4*p_d,two,0.0,0.0);
		decrgpulse(8.2*p_d,zero,0.0,0.0);
		decrgpulse(5.8*p_d,two,0.0,0.0);
		decrgpulse(5.7*p_d,zero,0.0,0.0);
		decrgpulse(0.6*p_d,two,0.0,0.0);
		decrgpulse(4.9*p_d,zero,0.0,0.0);
		decrgpulse(7.5*p_d,two,0.0,0.0);
		decrgpulse(5.3*p_d,zero,0.0,0.0);
		decrgpulse(7.4*p_d,two,0.0,0.0);
		
		decrgpulse(6.4*p_d,two,0.0,0.0);
		decrgpulse(8.2*p_d,zero,0.0,0.0);
		decrgpulse(5.8*p_d,two,0.0,0.0);
		decrgpulse(5.7*p_d,zero,0.0,0.0);
		decrgpulse(0.6*p_d,two,0.0,0.0);
		decrgpulse(4.9*p_d,zero,0.0,0.0);
		decrgpulse(7.5*p_d,two,0.0,0.0);
		decrgpulse(5.3*p_d,zero,0.0,0.0);
		decrgpulse(7.4*p_d,two,0.0,0.0);
		
		decrgpulse(6.4*p_d,zero,0.0,0.0);
		decrgpulse(8.2*p_d,two,0.0,0.0);
		decrgpulse(5.8*p_d,zero,0.0,0.0);
		decrgpulse(5.7*p_d,two,0.0,0.0);
		decrgpulse(0.6*p_d,zero,0.0,0.0);
		decrgpulse(4.9*p_d,two,0.0,0.0);
		decrgpulse(7.5*p_d,zero,0.0,0.0);
		decrgpulse(5.3*p_d,two,0.0,0.0);
		decrgpulse(7.4*p_d,zero,0.0,0.0);
		
	endhardloop();
	decpwrf(4095.0);
	
/*   End of spinlock */

	delay(timeTN - WFG3_START_DELAY);
	decpwrf(rf8);
	sim3shaped_pulse("","offC8","",0.0,pwC8,2*pwN,zero,zero,zero,0.0,0.0);
	decpwrf(rf6);
	delay(timeTN - WFG3_STOP_DELAY);
	
 /***************************************************************/
 /*      The sequence is same as ghn_co from this point  ********/
 /***************************************************************/
 
	decshaped_pulse("offC6", pwC6, t5, 0.0, 0.0);


/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

	dec2phase(t8);
	zgradpulse(gzlvl4, gt4);
	txphase(one);
	dcplrphase(zero);
 	delay(2.0e-4);
	dec2rgpulse(pwN, t8, 0.0, 0.0);

	decphase(zero);
	dec2phase(t9);
	decpwrf(rf8);
	delay(timeTN - WFG3_START_DELAY - tau2);
							 /* WFG3_START_DELAY  */
	sim3shaped_pulse("", "offC8", "", 0.0, pwC8, 2.0*pwN, zero, zero, t9, 0.0, 0.0);
	dec2phase(t10);
	decpwrf(rf3);


    if (tau2 > kappa)
	{
          delay(timeTN - pwC3a - WFG_START_DELAY);     	   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
          delay(kappa - gt1 - 2.0*GRADIENT_DELAY - 1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else if (tau2 > (kappa - pwC3a - WFG_START_DELAY))
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);                                     /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(kappa -pwC3a -WFG_START_DELAY -gt1 -2.0*GRADIENT_DELAY -1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
          delay(kappa - tau2 - pwC3a - WFG_START_DELAY);   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
	  obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
    	  delay(kappa-tau2-pwC3a-WFG_START_DELAY-gt1-2.0*GRADIENT_DELAY-1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                    /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2);
	}
/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */
	sim3pulse(pw, 0.0, pwN, t4, zero, t10, 0.0, 0.0);

	txphase(zero);
	dec2phase(zero);
	zgradpulse(gzlvl5, gt5);
	delay(lambda - 1.3*pwN - gt5);

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

	zgradpulse(gzlvl5, gt5);
	txphase(one);
	dec2phase(t11);
	delay(lambda - 1.3*pwN - gt5);

	sim3pulse(pw, 0.0, pwN, one, zero, t11, 0.0, 0.0);

	txphase(zero);
	dec2phase(zero);
	zgradpulse(gzlvl6, gt5);
	delay(lambda - 1.3*pwN - gt5);

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

	dec2phase(t10);
	zgradpulse(gzlvl6, gt5);
	delay(lambda - 0.65*pwN - gt5);

	rgpulse(pw, zero, 0.0, 0.0); 

	delay((gt1/10.0) + 1.0e-4 +gstab - 0.5*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);

	rgpulse(2.0*pw, zero, 0.0,0.0);
	dec2power(dpwr2);				       /* POWER_DELAY */
        if (mag_flg[A] == 'y')    magradpulse(icosel*gzcal*gzlvl2, gt1/10.0);
        else   zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4);

	setreceiver(t12);
}		 
Ejemplo n.º 3
0
pulsesequence()
{
  void      makeHHdec(), makeCdec(); 	                  /* utility functions */
  int       ihh=1,        /* used in HH decoupling to improve water suppression */
            t1_counter;
  char	    C13refoc[MAXSTR],		/* C13 sech/tanh pulse in middle of t1 */
	    Hdecflg[MAXSTR],                        /* HH-h**o decoupling flag */
	    Cdecflg[MAXSTR],                 /* low power C-13 decoupling flag */
            TROSY[MAXSTR],
            wtg3919[MAXSTR];
  double    tauxh, tau1,
            pwNt = 0.0,               /* pulse only active in the TROSY option */
            gsign = 1.0,
                               /* temporary Pbox parameters */
            bw, pws, ofs, ppm, nst,  /* bandwidth, pulsewidth, offset, ppm, # steps */
            gzlvl3=getval("gzlvl3"),
            gt3=getval("gt3"),
            JNH = getval("JNH"),
            pwN = getval("pwN"),
            pwNlvl = getval("pwNlvl"),  
            pwHs, tpwrs=0.0, compH=1.0,  /* H1 90 degree pulse length at tpwrs */               
            sw1 = getval("sw1"),
            pwClvl = getval("pwClvl"), 	         /* coarse power for C13 pulse */
            pwC = getval("pwC"),       /* C13 90 degree pulse length at pwClvl */
            rfst = 4095.0,	            /* fine power for the stCall pulse */
            compC = getval("compC"),   /* adjustment for C13 amplifier compr-n */
            tpwrsf = getval("tpwrsf");   /* adjustment for soft pulse power*/


/* INITIALIZE VARIABLES */

    getstr("C13refoc",C13refoc);
    getstr("TROSY",TROSY);
    getstr("wtg3919",wtg3919);
    getstr("Hdecflg", Hdecflg);
    getstr("Cdecflg", Cdecflg);

    if(wtg3919[0] != 'y')      /* selective H20 one-lobe sinc pulse needs 1.69  */
    {                                   /* times more power than a square pulse */
      pwHs = getval("pwHs");            
      compH = getval("compH");
    }
    else 
      pwHs = pw*2.385+7.0*rof1+d3*2.5; 

    tauxh = ((JNH != 0.0) ? 1/(4*(JNH)) : 2.25e-3);

    setautocal();                        /* activate auto-calibration flags */ 
        
    if (autocal[0] == 'n') 
    {
      if (C13refoc[A]=='y') 
      {
        /* 180 degree adiabatic C13 pulse from 0 to 200 ppm */
        rfst = (compC*4095.0*pwC*4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)); 
        rfst = (int) (rfst + 0.5);
        if ( 1.0/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)) < pwC )
           { text_error( " Not enough C13 RF. pwC must be %f usec or less.\n", 
	     (1.0e6/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35))) ); psg_abort(1); }
      }

      if(wtg3919[0] != 'y')      /* selective H20 one-lobe sinc pulse needs 1.69  */
      {                                   /* times more power than a square pulse */
        if (pwHs > 1e-6) tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));  
        else tpwrs = 0.0;
        tpwrs = (int) (tpwrs); 
      }	  
    }
    else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
    {
      if(FIRST_FID)                                            /* call Pbox */
      {
        if (C13refoc[A]=='y') 
        {
          ppm = getval("dfrq"); ofs = 0.0;   pws = 0.001;  /* 1 ms long pulse */
          bw = 200.0*ppm;       nst = 1000;          /* nst - number of steps */
          stC200 = pbox_makeA("stC200", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
          C13ofs = 100.0;
        }
        if(wtg3919[0] != 'y')
          H2Osinc = pbox_Rsh("H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
        ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
      }
      if (C13refoc[A]=='y') rfst = stC200.pwrf;
      if (wtg3919[0] != 'y') 
      { 
        pwHs = H2Osinc.pw; tpwrs = H2Osinc.pwr-1.0;  /* 1dB correction applied */ 
      }
    }
    if (tpwrsf<4095.0) tpwrs = tpwrs + 6.0;

    tauxh = ((JNH != 0.0) ? 1/(4*(JNH)) : 2.25e-3);

    if(Cdecflg[0] == 'y') makeCdec();     /* make shapes for HH h**o-decoupling */
    if(Hdecflg[0] == 'y') makeHHdec();
    if(Hdecflg[0] != 'n') ihh = -3;

/* check validity of parameter range */

    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') )
    { text_error("incorrect Dec2 decoupler flags!  "); psg_abort(1); } 

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

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

    if ((TROSY[A]=='y') && (dm2[C] == 'y'))
    { text_error("Choose either TROSY='n' or dm2='n' ! "); psg_abort(1); }

/* LOAD VARIABLES */

    if(ix == 1) d2_init = d2;
    t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5);
    
    tau1 = d2/2.0 - pw;
    if(tau1 < 0.0) tau1 = 0.0;

/* LOAD PHASE TABLES */

      settable(t6, 4, recT); 
    if (TROSY[A] == 'y')
    { gsign = -1.0;
      pwNt = pwN;
      assign(zero,v7); 
      assign(two,v8);
      settable(t1, 1, phT1);
      settable(t2, 4, phT2);
      settable(t3, 1, phT4); 
      settable(t4, 1, phT4);
      settable(t5, 4, recT); }
    else
    { assign(one,v7); 
      assign(three,v8);
      settable(t1, 4, phi1);
      settable(t2, 2, phi2);
      settable(t3, 8, phi3);
      settable(t4, 1, phi4);
      settable(t5, 8, rec); } 

      if ( phase1 == 2 )                  /* Hypercomplex in t1 */
      { if (TROSY[A] == 'y')          
        { tsadd(t3, 2, 4); tsadd(t5, 2, 4); }                      
        else tsadd(t2, 1, 4); }
                                   
    if(t1_counter %2)          /* calculate modification to phases based on */
    { tsadd(t2,2,4); tsadd(t5,2,4); tsadd(t6,2,4); }   /* current t1 values */

    if(wtg3919[0] != 'y') 
    { add(one,v7,v7); add(one,v8,v8); }
         
                           /* sequence starts!! */
   status(A);
     
     obspower(tpwr);
     dec2power(pwNlvl);
     decpower(pwClvl);
     decpwrf(rfst);
     if(Hdecflg[0] != 'n')
     {
       delay(5.0e-5);
       rgpulse(pw,zero,rof1,0.0);                 
       rgpulse(pw,one,0.0,rof1);                 
       zgradpulse(1.5*gzlvl3, 0.5e-3);
       delay(5.0e-4);
       rgpulse(pw,zero,rof1,0.0);                 
       rgpulse(pw,one,0.0,rof1);                 
       zgradpulse(-gzlvl3, 0.5e-3);
     }
     
     delay(d1);
     rcvroff();
     
   status(B);

     rgpulse(pw, zero, rof1, rof1);
     
     zgradpulse(0.3*gzlvl3,gt3);
     txphase(zero);
     dec2phase(zero);
     delay(tauxh-gt3);               /* delay=1/4J(XH)   */

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

     zgradpulse(0.3*gzlvl3,gt3);
     dec2phase(t2);
     delay(tauxh-gt3 );               /* delay=1/4J(XH)   */
  
     rgpulse(pw, t1, rof1, rof1);

     zgradpulse(0.5*gsign*ihh*gzlvl3,gt3);
     delay(200.0e-6); 
     decphase(zero);
            
     if (TROSY[A] == 'y')
     { 
       txphase(t3);       
       if ( phase1 == 2 ) 
         dec2rgpulse(pwN, t6, rof1, 0.0);
       else 
         dec2rgpulse(pwN, t2, rof1, 0.0);              
       if ( (C13refoc[A]=='y') && (d2 > 1.0e-3 + 2.0*WFG2_START_DELAY) )
       {
         delay(d2/2.0 - 0.5e-3 - WFG2_START_DELAY);     
         decshaped_pulse("stC200", 1.0e-3, zero, 0.0, 0.0);
         delay(d2/2.0 - 0.5e-3 - WFG2_STOP_DELAY);
       }
       else
         delay(d2);

       rgpulse(pw, t3, 0.0, rof1);         
       zgradpulse(0.65*gzlvl3,gt3);
       delay(tauxh-gt3 );
       
       sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,rof1,rof1);
       
       zgradpulse(0.65*gzlvl3,gt3);
       delay(tauxh-gt3 );       
       sim3pulse(pw,0.0,pwN,zero,zero,t3,rof1,rof1);
     }
     else
     {         
       txphase(t4);      
       dec2rgpulse(pwN, t2, rof1, 0.0);
        
       if ( (C13refoc[A]=='y') && (tau1 > 0.5e-3 + WFG2_START_DELAY) )
       {
         delay(tau1 - 0.5e-3 - WFG2_START_DELAY); 
         simshaped_pulse("", "stC200", 2.0*pw, 1.0e-3, t4, zero, 0.0, 0.0);  
         dec2phase(t3);  
         delay(tau1 - 0.5e-3 - WFG2_STOP_DELAY);
       }
       else 
       {
         delay(tau1);
         rgpulse(2.0*pw, t4, 0.0, 0.0);
         dec2phase(t3);
         delay(tau1);
       }
       
       dec2rgpulse(pwN, t3, 0.0, 0.0);
       
       zgradpulse(0.5*gzlvl3,gt3);
       delay(200.0e-6);
       rgpulse(pw, two, rof1, rof1);
     } 
     
     zgradpulse(gzlvl3,gt3);
     txphase(v7); dec2phase(zero);
     delay(tauxh-gt3-pwHs-rof1+5.0e-5);
     
     if(wtg3919[0] == 'y')
     {     	
       rgpulse(pw*0.231,v7,rof1,rof1);     
       delay(d3);
       rgpulse(pw*0.692,v7,rof1,rof1);
       delay(d3);
       rgpulse(pw*1.462,v7,rof1,rof1);

       delay(d3/2-pwN);
       dec2rgpulse(2*pwN, zero, rof1, rof1);
       txphase(v8);
       delay(d3/2-pwN);

       rgpulse(pw*1.462,v8,rof1,rof1);
       delay(d3);
       rgpulse(pw*0.692,v8,rof1,rof1);
       delay(d3);
       rgpulse(pw*0.231,v8,rof1,rof1); 
     }
     else
     {
       obspower(tpwrs); if (tpwrsf<4095.0) obspwrf(tpwrsf);  
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr); if (tpwrsf<4095.0) obspwrf(4095.0);
       sim3pulse(2.0*pw, 0.0, 2.0*pwN, v8, zero, zero, 0.0, 0.0);
       obspower(tpwrs); if (tpwrsf<4095.0)obspwrf(tpwrsf);
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr); if (tpwrsf<4095.0)obspwrf(4095.0);
     } 
        
     zgradpulse(gzlvl3,gt3);   

     if(Cdecflg[0] == 'y')
     {
       delay(tauxh-gt3-pwHs-rof1-pwNt-3.0*POWER_DELAY-PRG_START_DELAY); 
       dec2rgpulse(pwNt, zero, rof1, rof1); 
       dec2power(dpwr2);
       rcvron();

     statusdelay(C,5.0e-5);
       setreceiver(t5);  
       pbox_decon(&Cdseq);
      
       if(Hdecflg[0] == 'y')
         homodec(&HHdseq); 
     }
     else
     {
       delay(tauxh-gt3-pwHs-rof1-pwNt-POWER_DELAY); 
       dec2rgpulse(pwNt, zero, rof1, rof1); 
       dec2power(dpwr2);
       rcvron();

     statusdelay(C,5.0e-5);
       setreceiver(t5);  
      
       if(Hdecflg[0] == 'y')
         homodec(&HHdseq); 
     }       
}
Ejemplo n.º 4
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char        fscuba[MAXSTR],f1180[MAXSTR],f2180[MAXSTR],fsat[MAXSTR],
             shape[MAXSTR],sh_ad[MAXSTR],f3180[MAXSTR],
             N_flg[MAXSTR],diag_supp[MAXSTR];

 int	     phase,
             phase2,
             phase3,
             t1_counter,
             t2_counter,
             t3_counter, icosel;

 double      hscuba,                /* length of 1/2 scuba delay */
             pwx2,                  /* PW90 for X-nuc            */
             tsatpwr,               /* low power level for presat*/
             dhpwr2,                /* power level for X hard pulses */
             jxh,                   /* coupling for XH           */
             tauxh,                 /* delay = 1/(2jxh)          */
	     tau1,	      	    /* t1/2  H */
	     tau2,	      	    /* t2/2 N */
	     tau3,	      	    /* t3/2 N */
	     sw1,                  /* spectral width in 1H dimension */
             sw2,                  /* spectral width in 15N dimension */
             sw3,                  /* spectral width in 15N dimension */
             MIX,                  /* Total Mixing time for noesy portion */
             pw_sl,                /* selective 2ms pulse on water */
             tpwrsl,               /* power level for pw_sl   */ 
             ppm,nst,pws,bw,ofs,   /* used by Pbox */
             pwN,pwNlvl,compH,compC,pwC,pwClvl,
             d_ad,                 /* C high power for adiabatic pulses */
             pwc_ad,               /* C 90 pulse width   */

             zeta,                /* Bax-Logan trick */
             zeta1,               /* Bax-Logan trick */

             BigT,
             BigT1,

             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8,
             gzlvl9,
             gzlvl10,
             gzlvl11,
             gzlvl12,

             gstab,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gt9,
             gt10,
             gt11,
             gt12;

/* LOAD VARIABLES */
          pwNlvl=getval("pwNlvl");
          pwN=getval("pwN");
          compC=getval("compC");
          pwC=getval("pwC");
          pwClvl=getval("pwClvl");
          compH=getval("compH");

  jxh = getval("jxh");
  dhpwr2 = getval("dhpwr2"); 
  pwx2 = getval("pwx2");
  tsatpwr = getval("tsatpwr");
  hscuba = getval("hscuba");
  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");
  MIX  = getval("MIX");
  pw_sl = getval("pw_sl");
  tpwrsl = getval("tpwrsl");

  pwc_ad = getval("pwc_ad");
  d_ad = getval("d_ad");

  ni = getval("ni"); 

  BigT = getval("BigT");
  BigT1 = getval("BigT1");

  gstab  = getval("gstab");
  gzlvl0 = getval("gzlvl0");
  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");

  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");

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

  getstr("N_flg",N_flg);

  getstr("diag_supp",diag_supp);
  getstr("sh_ad",sh_ad);
  getstr("shape",shape);
  if(d_ad > 62) {
   printf("chirp power is too high \n");
   psg_abort(1);
  }
  if(pwc_ad > 1.2e-3) {
    printf("adiabatic pulse is too long; set < 0.5 ms\n");
    psg_abort(1);
  } 

   setautocal();                        /* activate auto-calibration flags */ 
        
      if (autocal[0] != 'n') 
        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
      {
        strcpy(shape,"H2Osel");
        strcpy(sh_ad,"C13adiab");
        if(FIRST_FID)                                            /* call Pbox */
        {
          ppm = getval("dfrq"); ofs = 0.0;   pws = 0.0005; /*0.5 ms pulse */
          bw = 200.0*ppm;       nst = 1000;          /* nst - number of steps */
          C13adiab = pbox_makeA("C13adiab", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
          H2Osel = pbox_Rsh("H2Osel", "sinc90", pw_sl, 0.0, compH*pw, tpwr);
          ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
        }
        pw_sl = H2Osel.pw; tpwrsl = H2Osel.pwr-1.0;  /* 1dB correction applied */
        d_ad = C13adiab.pwr; pwc_ad = C13adiab.pw;
        pwx2=pwN; dhpwr2=pwNlvl;
      }

/* check validity of parameter range */

    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!  ");
	psg_abort(1);
    } 

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

    if( dpwr > -16 )
    {
	printf("No C decoupling used in this expt. ");
	psg_abort(1);
    }

    if( dpwr2 > -16 )
    {
	printf("No N decoupling used in this expt. ");
	psg_abort(1);
    }

    if(gzlvl0 > 500) {
        printf("gzlvl0_max is 500\n");
        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 || gt11 > 3e-3  
        || gt12 > 3e-3)
    {
        printf("gradients are on for too long !!! ");
        psg_abort(1);
    } 


    if(ix==1) {
    if(f1180[A] != 'n' || f2180[A] !='y' || f3180[A] != 'y') {
        printf("f1180 should be n, f2180 y, and f3180 should be y\n");
    }
   }


/* LOAD VARIABLES */

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

/* INITIALIZE VARIABLES */

  tauxh = 1/(4*jxh);

/* Phase incrementation for hypercomplex data */

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

   if ( phase2 == 2 ) {    /* Hypercomplex in t2 */
        tsadd(t1, 1, 4);
   }

   if ( phase3 == 2 )     /* Hypercomplex in t3 */
   {
        tsadd(t6, 2, 4);
        tsadd(t7, 2, 4);
        tsadd(t8, 2, 4);
        tsadd(t10, 2, 4);
        icosel = -1;
   }
   else
       icosel = 1;

/* calculate modifications to phases based on current t2/t3 values
   to achieve States-TPPI acquisition */

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

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

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

/* set up so that get (-90,180) phase corrects in F1 if f1180 flag is y */

     tau1 = d2;
     if(f1180[A] == 'y') {
            tau1 += 1/(2.0*sw1);
     }

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

/* set up so that get (-90,180) phase corrects in F2 if f2180 flag is y */

   tau2 = d3;
   if(f2180[A] == 'y')  
      tau2 += ( 1.0/(2.0*sw2) - (4.0/PI)*pwx2
                - 2.0*(2.0*GRADIENT_DELAY + 50.0e-6 + 5.0e-6) );
   if(f2180[A] == 'n')  
      tau2 = ( tau2 - (4.0/PI)*pwx2
                - 2.0*(2.0*GRADIENT_DELAY + 50.0e-6 + 5.0e-6) );

   tau2 = tau2/2.0;

   if(ix==1)
     if((tau2 + 5.0e-6 - 0.5*(WFG_START_DELAY + 4.0*pw + WFG_STOP_DELAY)
         < 5.0e-6) && N_flg[A] == 'n')
      printf("tau2 is negative; set f1180 to y\n");

/* set up so that get (-90,180) phase corrects in F3 if f3180 flag is y */

   tau3 = d4;
   if(f3180[A] == 'y')  tau3 += ( 1.0/(2.0*sw3) );

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

/* Now include Bax/Logan trick */

   if(ni != 1) {
     if(diag_supp[A] == 'n')
        zeta = (tauxh - gt5 - 102.0e-6 + 2.0*pwx2 - 2.0e-6);
     else 
        zeta = (1.0/(8.0*93.39) - gt5 - 102.0e-6 + 2.0*pwx2 - 2.0e-6);
     zeta = zeta / ( (double) (ni-1) );

     if(zeta < 0.0) {
        printf("problem with zeta\n");
        psg_abort(1);
     }

   }

   else
      zeta = 0.0;

   if( ix == 1) d2_init = d2;
   t1_counter = (int) ( (d2 - d2_init)*sw1 + 0.5 );

   zeta1 = zeta*( (double)t1_counter );
   tau1 = tau1 - zeta1; 



/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tsatpwr);            /* Set power for presaturation  */
   decpower(d_ad);               /* Set decoupler1 power to d_ad */
   dec2power(dhpwr2);            /* Set decoupler2 power to dhpwr2 */

/* Presaturation Period */


 if(fsat[0] == 'y')
{
  txphase(zero);
  rgpulse(d1,zero,2.0e-6,2.0e-6);  /* presat */
  obspower(tpwr);                /* Set power for hard pulses  */

    if (fscuba[0] == 'y')            /* Scuba pulse sequence */
    {  
      hsdelay(hscuba);

      rgpulse(pw,zero,1.0e-6,0.0);	/* 90x180y90x */
      rgpulse(2*pw,one,1.0e-6,0.0);
      rgpulse(pw,zero,1.0e-6,0.0);
 
      txphase(zero);
      delay(hscuba);        
    }
}

else  {
 obspower(tpwr);                /* Set power for hard pulses  */
 delay(d1);
}

status(B);

   obsoffset(tof);

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

  /* eliminate all magnetization originating from 15N */

  dec2rgpulse(pwx2,zero,0.0,0.0);

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

  rgpulse(pw,zero,0.0,0.0);

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

  delay(tauxh - gt2 - 4.0e-6);               /* delay=1/4J(XH)   */

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

  delay(tauxh - gt2 - 202.0e-6);             /* delay=1/4J(XH)   */

  txphase(one); dec2phase(t1);

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

  rgpulse(pw,one,0.0,0.0);       

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

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

  txphase(zero);

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

  if(N_flg[A] == 'n') 
  {
    if(tau2 + 5.0e-6 - 0.5*(WFG2_START_DELAY
                 + pwc_ad + WFG2_STOP_DELAY) < 0.2e-6)
     {
      rgradient('z',gzlvl0); /* use rgradient since shaping takes more time */
      delay(tau2 + 5.0e-6 - 0.5*(WFG_START_DELAY + 4.0*pw + WFG_STOP_DELAY));
      rgradient('z',0.0);
      delay(50.0e-6);

      shaped_pulse("composite",4.0*pw,zero,0.0,0.0);  /* 90x-180y-90x  */

      rgradient('z',-1.0*gzlvl0);
      delay(tau2 + 5.0e-6 - 0.5*(WFG_START_DELAY + 4.0*pw + WFG_STOP_DELAY));
      rgradient('z',0.0);
      delay(50.0e-6);

     }

     else

     {
      rgradient('z',gzlvl0); /* use rgradient since shaping takes more time */
      delay(tau2 + 5.0e-6 - 0.5*(WFG2_START_DELAY
              + pwc_ad + WFG2_STOP_DELAY));
      rgradient('z',0.0);
      delay(50.0e-6);

      simshaped_pulse("composite",sh_ad,4.0*pw,pwc_ad,zero,zero,0.0,0.0);

      rgradient('z',-1.0*gzlvl0); /* use rgradient since shaping takes more time */
      delay(tau2 + 5.0e-6 - 0.5*(WFG2_START_DELAY
              + pwc_ad + WFG2_STOP_DELAY));
      rgradient('z',0.0);
      delay(50.0e-6);

     }
  }   /* N_flg[A] == y */

  else
    sim3pulse(2.0*pw,0.0,2.0*pwx2,zero,zero,zero,4.0e-6,4.0e-6);

  dec2rgpulse(pwx2,zero,0.0,0.0);

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

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

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,t3,2.0e-6,0.0);
  delay(2.0e-6);
  obspower(tpwr);
  /* shaped pulse */

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

  delay(tau1 + tauxh + zeta1 - gt5 - 102.0e-6);

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

  dec2rgpulse(2.0*pwx2,zero,0.0,0.0);

  delay(tau1);

  rgpulse(2.0*pw,t9,0.0,0.0); txphase(one);

  delay(tauxh - zeta1 - gt5 - 102.0e-6 + 2.0*pwx2);

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

  rgpulse(pw,one,0.0,0.0);

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,one,2.0e-6,0.0);
  delay(2.0e-6);
  obspower(tpwr);
  /* shaped pulse */

  delay(MIX - gt6 - gstab -2.0e-6); 

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

  }

  else {

  initval(1.0,v4);
  obsstepsize(45.0);
  xmtrphase(v4);

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

  initval(1.0,v4);
  obsstepsize(45.0);
  xmtrphase(v4);
*/
  
  rgpulse(pw,t2,2.0e-6,0.0);

  xmtrphase(zero);
  txphase(t9);

  delay(tau1 + 1.0/(8.0*93.39) + zeta1 - gt5 - 102.0e-6 - SAPS_DELAY);

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

  dec2rgpulse(2.0*pwx2,zero,0.0,0.0);

  delay(tau1);

  rgpulse(2.0*pw,t9,0.0,0.0); txphase(one);

  delay(1.0/(8.0*93.39) - zeta1 - gt5 - 102.0e-6 + 2.0*pwx2);

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

  rgpulse(pw,one,0.0,0.0);

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,one,2.0e-6,0.0);
  delay(2.0e-6);
  obspower(tpwr);
  /* shaped pulse */

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

    delay(MIX - 1.5*gt6 - 2.0*(gstab+2.0e-6) - 2.0*pwx2); 

    dec2rgpulse(2.0*pwx2,zero,0.0,0.0); 

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

  }

   rgpulse(pw,two,2.0e-6,0.0);

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

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

  delay(tauxh  
      - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
      - pw_sl - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY 
      - gt7 - 4.0e-6);               /* delay=1/4J(XH)   */

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

  delay(tauxh 
      - gt7 - gstab -2.0e-6
      - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
      - pw_sl - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY); 

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

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

  rgpulse(pw,one,0.0,0.0);

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

  txphase(t6);

  if(phase3 == 1)
    dec2rgpulse(pwx2,t4,4.0e-6,0.0);
  if(phase3 == 2)
    dec2rgpulse(pwx2,t5,4.0e-6,0.0);

  decphase(zero); 

  if(tau3 - 0.5*(WFG_START_DELAY
                 + pwc_ad + WFG_STOP_DELAY)
          < 0.2e-6) {

  delay(tau3);
  delay(tau3);

  }

  else {

  delay(tau3 - 0.5*(WFG_START_DELAY
               + pwc_ad + WFG_STOP_DELAY));

  decshaped_pulse(sh_ad,pwc_ad,zero,0.0,0.0); 

  delay(tau3 - 0.5*(WFG_START_DELAY
               + pwc_ad + WFG_STOP_DELAY));

  }

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

  delay(BigT - 4.0/PI*pwx2 + pw - 2.0*GRADIENT_DELAY - gt11
        - 102.0e-6);

  dec2rgpulse(2.0*pwx2,zero,0.0,0.0);

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

  delay(BigT - 2.0*GRADIENT_DELAY - gt11
        - 102.0e-6);

  rgpulse(pw,t6,0.0,0.0);

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,t7,2.0e-6,0.0);
  delay(2.0e-6); txphase(zero);
  obspower(tpwr);
  /* shaped pulse */

  delay(2.0e-6);
  zgradpulse(gzlvl9,gt9);
  delay(100.0e-6);

  delay(tauxh 
      - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
      - pw_sl - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY 
      - gt9 - 102.0e-6);

  sim3pulse(2.0*pw,0.0,2.0*pwx2,zero,zero,zero,0.0,0.0);
  dec2phase(t8);

  delay(2.0e-6);
  zgradpulse(gzlvl9,gt9);
  delay(100.0e-6);

  delay(tauxh 
      - gt9 - 102.0e-6
      - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
      - pw_sl - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY); 

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

  sim3pulse(pw,0.0,pwx2,zero,zero,t8,0.0,0.0);

  dec2phase(zero);

  delay(2.0e-6);
  zgradpulse(gzlvl10,gt10);
  delay(2.0e-6);

  delay(tauxh - gt10 - 4.0e-6);

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

  delay(2.0e-6);
  zgradpulse(gzlvl10,gt10);
  delay(100.0e-6);

  delay(tauxh
        - gt10 - 102.0e-6
        + 2.0/PI*pw - pwx2 + 0.5*(pwx2-pw));

  dec2rgpulse(pwx2,zero,0.0,0.0);

  dec2power(dpwr2);  /* Very Important */
  decpower(dpwr);

  delay(BigT1 - 2.0*POWER_DELAY);

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

  delay(2.0e-6);
  zgradpulse(-1.0*icosel*gzlvl12,gt12);
  delay(50.0e-6);

  delay(BigT1 - 2.0*GRADIENT_DELAY - 52.0e-6 - gt12);

/* acquire data */

status(C);
     setreceiver(t10);
}
Ejemplo n.º 5
0
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);

}
Ejemplo n.º 6
0
pulsesequence()
{

    /* DECLARE AND LOAD VARIABLES */

    char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
                mag_flg[MAXSTR],      /* magic-angle coherence transfer gradients */
                C13refoc[MAXSTR],		/* C13 sech/tanh pulse in middle of t1*/
                NH2only[MAXSTR],		       /* spectrum of only NH2 groups */
                amino[MAXSTR],                     /* select amino nitrogens      */
                imino[MAXSTR],                     /* select imino nitrogens      */
                T1[MAXSTR],				/* insert T1 relaxation delay */
                T1rho[MAXSTR],		     /* insert T1rho relaxation delay */
                T2[MAXSTR],				/* insert T2 relaxation delay */
                bottom[MAXSTR],
                right[MAXSTR],
                TROSY[MAXSTR];			    /* do TROSY on N15 and H1 */

    int         icosel,          			  /* used to get n and p type */
                t1_counter,  		        /* used for states tppi in t1 */
                rTnum,			/* number of relaxation times, relaxT */
                rTcounter;		    /* to obtain maximum relaxT, ie relaxTmax */

    double      tau1,         				         /*  t1 delay */
                lambda = 0.91/(4.0*getval("JNH")), 	   /* 1/4J H1 evolution delay */
                tNH = 1.0/(4.0*getval("JNH")),	  /* 1/4J N15 evolution delay */
                relaxT = getval("relaxT"),		     /* total relaxation time */
                rTarray[1000], 	    /* to obtain maximum relaxT, ie relaxTmax */
                maxrelaxT = getval("maxrelaxT"),    /* maximum relaxT in all exps */
                ncyc,			 /* number of pulsed cycles in relaxT */

                /* the sech/tanh pulse is automatically calculated by the macro "rna_cal", */  /* and is called directly from your shapelib.                  		      */
                pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
                pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
                rfC,            	          /* maximum fine power when using pwC pulses */
                rfst,	                       /* fine power for the rna_stC140 pulse */
                /* temporary Pbox parameters */
                bw, pws, ofs, ppm, nst,     /* bandwidth, pulsewidth, offset, ppm, # steps */

                compH = getval("compH"),        /* adjustment for H1 amplifier compression */
                compN = getval("compN"),       /* adjustment for N15 amplifier compression */
                compC = getval("compC"),       /* adjustment for C13 amplifier compression */

                calH = getval("calH"), /* multiplier on a pw pulse for H1 calibration */
                pwHs = getval("pwHs"),	        /* H1 90 degree pulse length at tpwrs */
                tpwrs,	  	              /* power for the pwHs ("H2Osinc") pulse */

                pwNlvl = getval("pwNlvl"),	              /* power for N15 pulses */
                pwN = getval("pwN"),          /* N15 90 degree pulse length at pwNlvl */
                calN = getval("calN"),   /* multiplier on a pwN pulse for calibration */
                slNlvl,					   /* power for N15 spin lock */
                slNrf = 1500.0,        /* RF field in Hz for N15 spin lock at 600 MHz */
                dof2a,                                      /* offset for imino/amino */

                sw1 = getval("sw1"),

                gt1 = getval("gt1"),  		       /* coherence pathway gradients */
                gzcal = getval("gzcal"),               /* dac to G/cm conversion      */
                gzlvl1 = getval("gzlvl1"),
                gzlvl2 = getval("gzlvl2"),

                BPpwrlimits,                    /*  =0 for no limit, =1 for limit */

                gt0 = getval("gt0"),				   /* other gradients */
                gt3 = getval("gt3"),
                gt4 = getval("gt4"),
                gt5 = getval("gt5"),
                gzlvl0 = getval("gzlvl0"),
                gzlvl3 = getval("gzlvl3"),
                gzlvl4 = getval("gzlvl4"),
                gzlvl5 = getval("gzlvl5");

    P_getreal(GLOBAL,"BPpwrlimits",&BPpwrlimits,1);
    getstr("f1180",f1180);
    getstr("mag_flg",mag_flg);
    getstr("C13refoc",C13refoc);
    getstr("NH2only",NH2only);
    getstr("T1",T1);
    getstr("T1rho",T1rho);
    getstr("T2",T2);
    getstr("bottom",bottom);
    getstr("right",right);
    getstr("TROSY",TROSY);
    getstr("imino",imino);
    getstr("amino",amino);



    /*   LOAD PHASE TABLE    */

    settable(t3,2,phi3);
    if (TROSY[A]=='y')
    {   settable(t1,1,ph_x);

        if (bottom[A]=='y')
            settable(t4,1,phx);
        else
            settable(t4,1,ph_x);
        if (right[A]=='y')
            settable(t10,1,phy);
        else
            settable(t10,1,ph_y);

        settable(t9,1,phx);
        settable(t11,1,phx);
        settable(t12,2,recT);
    }
    else
    {   settable(t1,1,phx);
        settable(t4,1,phx);
        settable(t9,8,phi9);
        settable(t10,1,phx);
        settable(t11,1,phy);
        settable(t12,4,rec);
    }



    /*   INITIALIZE VARIABLES   */
    dof2a=dof2;
    /* IMINO-region setting of dof2 */
    if (imino[A] == 'y') dof2a=dof2-45*dfrq2;
    if (amino[A] == 'y') dof2a=dof2-115*dfrq2;
    if ((imino[A] == 'n') && (amino[A] == 'n')) dof2a=dof2;

    /* maximum fine power for pwC pulses (and initialize rfst) */
    rfC = 4095.0;
    rfst=0.0;


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

    if (autocal[0] == 'n')
    {
        /* 180 degree adiabatic C13 pulse covers 140 ppm */
        if (C13refoc[A]=='y')
        {   rfst = (compC*4095.0*pwC*4000.0*sqrt((21.0*sfrq/600.0+7.0)/0.35));
            rfst = (int) (rfst + 0.5);
            if ( 1.0/(4000.0*sqrt((21.0*sfrq/600.0+7.0)/0.35)) < pwC )
            {   text_error( " Not enough C13 RF. pwC must be %f usec or less.\n",
                            (1.0e6/(4000.0*sqrt((21.0*sfrq/600.0+7.0)/0.35))) );
                psg_abort(1);
            }
        }

        /* selective H20 one-lobe sinc pulse */
        tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));   /*needs 1.69 times more*/
        tpwrs = (int) (tpwrs);                   	  /*power than a square pulse */
    }
    else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
    {
        if(FIRST_FID)                                            /* call Pbox */
        {
            ppm = getval("dfrq");
            bw = 140.0*ppm;
            pws = 0.001;
            ofs = 0.0;
            nst = 1000.0;
            if (C13refoc[A]=='y')
                stC140 = pbox_makeA("rna_stC140", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
            H2Osinc = pbox_Rsh("rna_H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
            if (dm3[B] == 'y') H2ofs = 3.2;
            ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
        }
        if (C13refoc[A]=='y') rfst = stC140.pwrf;
        pwHs = H2Osinc.pw;
        tpwrs = H2Osinc.pwr;
    }

    /* power level for N15 spinlock (90 degree pulse length calculated first) */
    slNlvl = 1/(4.0*slNrf*sfrq/600.0) ;
    slNlvl = pwNlvl - 20.0*log10(slNlvl/(pwN*compN));
    slNlvl = (int) (slNlvl + 0.5);

    /* use 1/8J times for relaxation measurements of NH2 groups */
    if ( (NH2only[A]=='y') && ((T1[A]=='y') || (T1rho[A]=='y') || (T2[A]=='y')) )
    {
        tNH = tNH/2.0;
    }

    /* reset calH and calN for 2D if inadvertently left at 2.0 */
    if (ni>1.0) {
        calH=1.0;
        calN=1.0;
    }



    /* CHECK VALIDITY OF PARAMETER RANGES */

    if ( ((imino[A] == 'y') && (amino[A] == 'y')) )
    {
        printf(" Choose ONE of the cases: imino='y' OR amino='y' ");
        psg_abort(1);
    }

    if ( ((imino[A] == 'y') && (NH2only[A] == 'y')) )
    {
        printf(" NH2only='y' only valide for  amino='y' ");
        psg_abort(1);
    }

    if ((TROSY[A]=='y') && (gt1 < -2.0e-4 + pwHs + 1.0e-4 + 2.0*POWER_DELAY))
    {   text_error( " gt1 is too small. Make gt1 equal to %f or more.\n",
                    (-2.0e-4 + pwHs + 1.0e-4 + 2.0*POWER_DELAY) );
        psg_abort(1);
    }

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

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

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

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

    if( (pwN > 100.0e-6) && (pwNlvl > 54) )
    {
        text_error("dont fry the probe, pwN too high ! ");
        psg_abort(1);
    }



    /*  RELAXATION TIMES AND FLAGS */

    /* evaluate maximum relaxT, relaxTmax chosen by the user */
    rTnum = getarray("relaxT", rTarray);
    relaxTmax = rTarray[0];
    for (rTcounter=1; rTcounter<rTnum; rTcounter++)
        if (relaxTmax < rTarray[rTcounter]) relaxTmax = rTarray[rTcounter];


    /* compare relaxTmax with maxrelaxT */
    if (maxrelaxT > relaxTmax)  relaxTmax = maxrelaxT;




    if ( ((T1rho[A]=='y') || (T2[A]=='y')) && (relaxTmax > d1) )
    {
        text_error("Maximum relaxation time, relaxT, is greater than d1 ! ");
        psg_abort(1);
    }

    if ( ((T1[A]=='y') && (T1rho[A]=='y'))   ||   ((T1[A]=='y') && (T2[A]=='y')) ||
            ((T1rho[A]=='y') && (T2[A]=='y')) )
    {
        text_error("Choose only one relaxation measurement ! ");
        psg_abort(1);
    }


    if ( ((T1[A]=='y') || (T1rho[A]=='y')) &&
            ((relaxT*100.0 - (int)(relaxT*100.0+1.0e-4)) > 1.0e-6) )
    {
        text_error("Relaxation time, relaxT, must be zero or multiple of 10msec");
        psg_abort(1);
    }


    if ( (T2[A]=='y') &&
            (((relaxT+0.01)*50.0 - (int)((relaxT+0.01)*50.0+1.0e-4)) > 1.0e-6) )
    {
        text_error("Relaxation time, relaxT, must be odd multiple of 10msec");
        psg_abort(1);
    }

    if ( ((T1rho[A]=='y') || (T2[A]=='y'))  &&  (relaxTmax > 0.25) && (ix==1) )
    {
        printf("WARNING, sample heating may result in a reduced lock level for relaxT>0.25sec");
    }


    if ( ((T1rho[A]=='y') ||  (T2[A]=='y'))  &&  (relaxTmax > 0.5) )
    {
        text_error("relaxT greater than 0.5 seconds will heat sample");
        psg_abort(1);
    }


    if ( ((NH2only[A]=='y') || (T1[A]=='y') || (T1rho[A]=='y') || (T2[A]=='y'))
            &&  (TROSY[A]=='y') )
    {
        text_error("TROSY not implemented with NH2 spectrum, or relaxation exps.");
        psg_abort(1);
    }


    if ((TROSY[A]=='y') && (dm2[C] == 'y'))
    {
        text_error("Choose either TROSY='n' or dm2='nnn' ! ");
        psg_abort(1);
    }


    /* PHASES AND INCREMENTED TIMES */

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

    if (TROSY[A]=='y')
    {   if (phase1 == 1)   				      icosel = -1;
        else 	  {
            tsadd(t4,2,4);
            tsadd(t10,2,4);
            icosel = +1;
        }
    }
    else {
        if (phase1 == 1)  {
            tsadd(t10,2,4);
            icosel = +1;
        }
        else 			       icosel = -1;
    }


    /*  Set up f1180  */

    tau1 = d2;
    if((f1180[A] == 'y') && (ni > 1.0))
    {
        tau1 += ( 1.0 / (2.0*sw1) );
        if(tau1 < 0.2e-6) tau1 = 0.0;
    }
    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(t3,2,4);
        tsadd(t12,2,4);
    }



    /*  Correct inverted signals for NH2 only spectra  */

    if ((NH2only[A]=='y') && (T1[A]=='n')  &&  (T1rho[A]=='n')  && (T2[A]=='n'))
    {
        tsadd(t3,2,4);
    }



    /* BEGIN PULSE SEQUENCE */

    status(A);

    obspower(tpwr);
    decpower(pwClvl);
    decpwrf(rfC);
    dec2power(pwNlvl);
    dec2offset(dof2a);
    txphase(zero);
    decphase(zero);
    dec2phase(zero);

    delay(d1);


    /*  xxxxxxxxxxxxxxxxx  CONSTANT SAMPLE HEATING FROM N15 RF xxxxxxxxxxxxxxxxx  */

    if  (T1rho[A]=='y')
    {   dec2power(slNlvl);
        dec2rgpulse(relaxTmax-relaxT, zero, 0.0, 0.0);
        dec2power(pwNlvl);
    }

    if  (T2[A]=='y')
    {   ncyc = 8.0*100.0*(relaxTmax - relaxT);
        if (BPpwrlimits > 0.5)
        {
            dec2power(pwNlvl-3.0);    /* reduce for probe protection */
            pwN=pwN*compN*1.4;
        }
        if (ncyc > 0)
        {   initval(ncyc,v1);
            loop(v1,v2);
            delay(0.625e-3 - pwN);
            dec2rgpulse(2*pwN, zero, 0.0, 0.0);
            delay(0.625e-3 - pwN);
            endloop(v2);
        }
        if (BPpwrlimits > 0.5)
        {
            dec2power(pwNlvl);         /* restore normal value */
            pwN=getval("pwN");
        }
    }
    /*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */
    rcvroff();
    if (TROSY[A]=='n')    dec2rgpulse(pwN, zero, 0.0, 0.0);
    decrgpulse(pwC, zero, 0.0, 0.0);   /*destroy N15 and C13 magnetization*/
    zgradpulse(gzlvl0, 0.5e-3);
    delay(1.0e-4);
    if (TROSY[A]=='n')    dec2rgpulse(pwN, one, 0.0, 0.0);
    decrgpulse(pwC, one, 0.0, 0.0);
    zgradpulse(0.7*gzlvl0, 0.5e-3);
    decpwrf(rfst);
    txphase(t1);
    delay(5.0e-4);

    if(dm3[B] == 'y')				  /*optional 2H decoupling on */
    {   lk_hold();
        dec3unblank();
        dec3rgpulse(1/dmf3, one, 0.0, 0.0);
        dec3unblank();
        setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
    }

    rgpulse(calH*pw,t1,0.0,0.0);                 /* 1H pulse excitation */

    txphase(zero);
    dec2phase(zero);
    zgradpulse(gzlvl0, gt0);
    delay(lambda - gt0);

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

    txphase(one);
    zgradpulse(gzlvl0, gt0);
    delay(lambda - gt0);

    rgpulse(pw, one, 0.0, 0.0);
    txphase(two);
    obspower(tpwrs);
    shaped_pulse("rna_H2Osinc", pwHs, two, 5.0e-5, 0.0);
    obspower(tpwr);
    zgradpulse(gzlvl3, gt3);
    dec2phase(t3);
    delay(2.0e-4);
    dec2rgpulse(calN*pwN, t3, 0.0, 0.0);
    txphase(zero);
    decphase(zero);

    /*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 RELAXATION    xxxxxxxxxxxxxxxxxxxx  */

    if ( (T1[A]=='y') || (T1rho[A]=='y') || (T2[A]=='y') )
    {
        dec2phase(one);
        zgradpulse(gzlvl4, gt4);				/* 2.0*GRADIENT_DELAY */
        delay(tNH - gt4 - 2.0*GRADIENT_DELAY);

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

        zgradpulse(gzlvl4, gt4);				/* 2.0*GRADIENT_DELAY */
        delay(tNH - gt4 - 2.0*GRADIENT_DELAY);
    }

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

    if  (T1[A]=='y')
    {
        dec2rgpulse(pwN, one, 0.0, 0.0);
        dec2phase(three);

        zgradpulse(gzlvl0, gt0);				/* 2.0*GRADIENT_DELAY */
        delay(2.5e-3 - gt0 - 2.0*GRADIENT_DELAY - pw);
        rgpulse(2.0*pw, zero, 0.0, 0.0);
        delay(2.5e-3 - pw);

        ncyc = (100.0*relaxT);
        initval(ncyc,v4);
        if (ncyc > 0)
        {   loop(v4,v5);

            delay(2.5e-3 - pw);
            rgpulse(2.0*pw, two, 0.0, 0.0);
            delay(2.5e-3 - pw);

            delay(2.5e-3 - pw);
            rgpulse(2.0*pw, zero, 0.0, 0.0);
            delay(2.5e-3 - pw);

            endloop(v5);
        }

        dec2rgpulse(pwN, three, 0.0, 0.0);
    }

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

    /* Theory suggests 8.0 is better than 2PI as RF  */
    /* field multiplier and experiment confirms this.*/
    if  (T1rho[A]=='y')          /* Shift evolution of 2.0*pwN/PI for one pulse   */
    {   /* at end left unrefocused as for normal sequence*/
        delay(1.0/(8.0*slNrf) - pwN);
        decrgpulse(pwN, zero, 0.0, 0.0);
        dec2power(slNlvl);
        /* minimum 5ms spinlock to dephase */
        dec2rgpulse((2.5e-3-pw), zero, 0.0, 0.0);	         /*  spins not locked */
        sim3pulse(2.0*pw, 0.0, 2.0*pw, zero, zero, zero, 0.0, 0.0);
        dec2rgpulse((2.5e-3-pw), zero, 0.0, 0.0);

        ncyc = 100.0*relaxT;
        initval(ncyc,v4);
        if (ncyc > 0)
        {   loop(v4,v5);
            dec2rgpulse((2.5e-3-pw), zero, 0.0, 0.0);
            sim3pulse(2.0*pw, 0.0, 2.0*pw, two, zero, zero, 0.0, 0.0);
            dec2rgpulse((2.5e-3-pw), zero, 0.0, 0.0);
            dec2rgpulse((2.5e-3-pw), zero, 0.0, 0.0);
            sim3pulse(2.0*pw, 0.0, 2.0*pw, zero, zero, zero, 0.0, 0.0);
            dec2rgpulse((2.5e-3-pw), zero, 0.0, 0.0);
            endloop(v5);
        }

        dec2power(pwNlvl);
        decrgpulse(pwN, zero, 0.0, 0.0);
        delay(1.0/(8.0*slNrf) + 2.0*pwN/PI - pwN);
    }
    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

    if  (T2[A]=='y')
    {
        dec2phase(zero);
        initval(0.0,v3);
        initval(180.0,v4);
        if (BPpwrlimits > 0.5)
        {
            dec2power(pwNlvl-3.0);    /* reduce for probe protection */
            pwN=pwN*compN*1.4;
        }

        ncyc = 100.0*relaxT;
        initval(ncyc,v5);

        loop(v5,v6);

        initval(3.0,v7);
        loop(v7,v8);
        delay(0.625e-3 - pwN);
        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
        delay(0.625e-3 - pwN);
        endloop(v8);

        delay(0.625e-3 - pwN - SAPS_DELAY);
        add(v4,v3,v3);
        obsstepsize(1.0);
        xmtrphase(v3);	   	/* SAPS_DELAY */
        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
        delay(0.625e-3 - pwN - pw);

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

        delay(0.625e-3 - pwN - pw );
        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
        xmtrphase(zero);						/* SAPS_DELAY */
        delay(0.625e-3 - pwN - SAPS_DELAY);

        initval(3.0,v9);
        loop(v9,v10);
        delay(0.625e-3 - pwN);
        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
        delay(0.625e-3 - pwN);
        endloop(v10);

        endloop(v6);
        if (BPpwrlimits > 0.5)
        {
            dec2power(pwNlvl);    /* restore normal value */
            pwN=getval("pwN");
        }
    }

    /*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */
    txphase(zero);
    dec2phase(t9);

    if ( (NH2only[A]=='y') || (T1[A]=='y') || (T1rho[A]=='y') || (T2[A]=='y') )
    {
        delay(tau1);
        /* optional sech/tanh pulse in middle of t1 */
        if (C13refoc[A]=='y') 				   /* WFG_START_DELAY */
        {   decshaped_pulse("rna_stC140", 1.0e-3, zero, 0.0, 0.0);
            delay(tNH - 1.0e-3 - WFG_START_DELAY - 2.0*pw);
        }
        else
        {
            delay(tNH - 2.0*pw);
        }
        rgpulse(2.0*pw, zero, 0.0, 0.0);
        if (tNH < gt1 + 1.99e-4)  delay(gt1 + 1.99e-4 - tNH);

        delay(tau1);

        dec2rgpulse(2.0*pwN, t9, 0.0, 0.0);

        if (mag_flg[A] == 'y')  magradpulse(gzcal*gzlvl1, gt1);
        else  zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
        txphase(t4);
        dec2phase(t10);
        if (tNH > gt1 + 1.99e-4)  delay(tNH - gt1 - 2.0*GRADIENT_DELAY);
        else   delay(1.99e-4 - 2.0*GRADIENT_DELAY);
    }

    else if (TROSY[A]=='y')
    {
        if ( (C13refoc[A]=='y') && (tau1 > 0.5e-3 + WFG2_START_DELAY) )
        {   delay(tau1 - 0.5e-3 - WFG2_START_DELAY);     /* WFG2_START_DELAY */
            decshaped_pulse("rna_stC140", 1.0e-3, zero, 0.0, 0.0);
            delay(tau1 - 0.5e-3);
        }
        else    delay(2.0*tau1);

        if (mag_flg[A] == 'y')  magradpulse(gzcal*gzlvl1, gt1);
        else  zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
        delay(2.0e-4 - 2.0*GRADIENT_DELAY);

        dec2rgpulse(2.0*pwN, t9, 0.0, 0.0);

        delay(gt1 + 2.0e-4 - pwHs - 1.0e-4 - 2.0*POWER_DELAY);
        txphase(three);
        obspower(tpwrs);				       /* POWER_DELAY */
        shaped_pulse("rna_H2Osinc", pwHs, three, 5.0e-5, 0.0);
        txphase(t4);
        obspower(tpwr);					       /* POWER_DELAY */
        delay(5.0e-5);
    }

    else
    {   /* fully-coupled spectrum */
        if (dm2[C]=='n')  {
            rgpulse(2.0*pw, zero, 0.0, 0.0);
            pw=0.0;
        }

        if ( (C13refoc[A]=='y') && (tau1 > 0.5e-3 + WFG2_START_DELAY) )
        {   delay(tau1 - 0.5e-3 - WFG2_START_DELAY);     /* WFG2_START_DELAY */
            simshaped_pulse("", "rna_stC140", 2.0*pw, 1.0e-3, zero, zero, 0.0, 0.0);
            delay(tau1 - 0.5e-3);
            delay(gt1 + 2.0e-4);
        }
        else
        {   delay(tau1);
            rgpulse(2.0*pw, zero, 0.0, 0.0);
            delay(gt1 + 2.0e-4 - 2.0*pw);
            delay(tau1);
        }
        decphase(zero);
        pw=getval("pw");
        dec2rgpulse(2.0*pwN, t9, 0.0, 0.0);

        if (mag_flg[A] == 'y')  magradpulse(gzcal*gzlvl1, gt1);
        else  zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
        txphase(t4);
        dec2phase(t10);
        delay(2.0e-4 - 2.0*GRADIENT_DELAY);
    }

    if  (T1rho[A]=='y')   delay(POWER_DELAY);


    /*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */
    if (TROSY[A]=='y')  rgpulse(pw, t4, 0.0, 0.0);
    else                sim3pulse(pw, 0.0, pwN, t4, zero, t10, 0.0, 0.0);

    txphase(zero);
    dec2phase(zero);
    zgradpulse(gzlvl5, gt5);
    if (TROSY[A]=='y')   delay(lambda - 0.65*(pw + pwN) - gt5);
    else   delay(lambda - 1.3*pwN - gt5);

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

    zgradpulse(gzlvl5, gt5);
    txphase(one);
    dec2phase(t11);
    delay(lambda - 1.3*pwN - gt5);

    sim3pulse(pw, 0.0, pwN, one, zero, t11, 0.0, 0.0);

    txphase(zero);
    dec2phase(zero);
    zgradpulse(1.5*gzlvl5, gt5);
    delay(lambda - 1.3*pwN - gt5);

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

    dec2phase(t10);
    zgradpulse(1.5*gzlvl5, gt5);
    if (TROSY[A]=='y')   delay(lambda - 1.6*pwN - gt5);
    else   delay(lambda - 0.65*pwN - gt5);

    if (TROSY[A]=='y')   dec2rgpulse(pwN, t10, 0.0, 0.0);
    else    	     rgpulse(pw, zero, 0.0, 0.0);

    delay((gt1/10.0) + 1.0e-4 - 0.65*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);

    if (dm3[B] == 'y')			         /*optional 2H decoupling off */
    {   dec3rgpulse(1/dmf3, three, 0.0, 0.0);
        dec3blank();
        setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
        dec3blank();
    }

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

    dec2power(dpwr2);				       /* POWER_DELAY */
    if (mag_flg[A] == 'y')	  magradpulse(icosel*gzcal*gzlvl2, 0.1*gt1);
    else   zgradpulse(icosel*gzlvl2, 0.1*gt1);		/* 2.0*GRADIENT_DELAY */
    rcvron();
    statusdelay(C,1.0e-4-rof1);

    if (dm3[B] == 'y') {
        delay(1/dmf3);
        lk_sample();
    }

    setreceiver(t12);
}
Ejemplo n.º 7
0
void pulsesequence()

{
/* DECLARE VARIABLES */

 char       C13refoc[MAXSTR],comp_flg[MAXSTR],fsat[MAXSTR],f1180[MAXSTR];

 int	     phase,t1_counter;

 double   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 */
          rfst,                    /* fine power for the stCall pulse */
          compC = getval("compC"), /* adjustment for C13 amplifier compression */
             tau1,                 /* t1 delay */
             taua,                 /* < 1 / 4J(NH) 2.25 ms      */
             taub,                 /*   1 / 4J(NH) in NH : 2.68 ms  */
             pwn,                  /* PW90 for N-nuc            */
             pwN,                  /* N15 pw90 for BioPack      */
             pwNlvl,               /* N15 power for BioPack     */
             pwn_cp,               /* PW90 for N CPMG           */
             pwHs,                 /* BioPack selective PW90 for water excitation */
             compH,                /* amplifier compression factor*/
             compN,                /* amplifier compression factor*/
             phase_sl,
             tsatpwr,              /* low power level for presat */
             tpwrsf_u,             /* fine power adjustment on flip-up sel 90 */
             tpwrsf_d,             /* fine power adjustment on flip-down sel 90 */
             tpwrsl,               /* low power level for sel 90 */
             dhpwr2,               /* power level for N hard pulses */
             dpwr2_comp,           /* power level for CPMG compensation       */
             dpwr2_cp,             /* power level for N CPMG        */
             tauCPMG,              /* CPMG delay */
             ncyc,                 /* number of times to loop    */
             ncyc_max,              /* max number of times to loop    */
             time_T2,              /* total time for T2 measuring     */
             tofps,                /* water freq */
	     sw1,
             pwr_delay,            /* POWER_DELAY recalculated*/
             timeC,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gstab,                /* stabilization delay */
             BPpwrlimits,                    /*  =0 for no limit, =1 for limit */

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

   P_getreal(GLOBAL,"BPpwrlimits",&BPpwrlimits,1);

/* LOAD VARIABLES */

  getstr("C13refoc", C13refoc);
/*  taub = 1/(8*93.0); */

  taua = getval("taua");
  taub = getval("taub");
  pwNlvl = getval("pwNlvl");
  pwN = getval("pwN");
  pwn = getval("pwn");
  pwn_cp = getval("pwn_cp");
  pwHs = getval("pwHs");
  compH = getval("compH");
  compN = getval("compN");
  phase_sl = getval("phase_sl");
  tsatpwr = getval("tsatpwr");
  tpwrsf_u = getval("tpwrsf_u");
  tpwrsf_d = getval("tpwrsf_d");
  tpwrsl = getval("tpwrsl");
  dhpwr2 = getval("dhpwr2"); 
  dpwr2_comp = getval("dpwr2_comp"); 
  dpwr2_cp = getval("dpwr2_cp"); 
  ncyc = getval("ncyc");
  ncyc_max = getval("ncyc_max");
  time_T2 = getval("time_T2");
  phase = (int) (getval("phase") + 0.5);
  sw1 = getval("sw1");
  tofps = getval("tofps");

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

  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  
  getstr("fsat",fsat); 
  getstr("comp_flg",comp_flg);
  getstr("f1180",f1180);



      setautocal();                        /* activate auto-calibration flags */ 
        
      if (autocal[0] == 'n') 
      {
        /* selective H20 one-lobe sinc pulse */
        if (pwHs > 0.0)
          tpwrsl = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));   /*needs 1.69 times more*/
        else tpwrsl = 0.0;
        tpwrsl = (int) (tpwrsl);                   	  /*power than a square pulse */
      }
      else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
      {
        if(FIRST_FID)                                            /* call Pbox */
        {
          H2OsincA = pbox_Rsh("H2OsincA", "sinc90", pwHs, 0.0, compH*pw, tpwr);
          ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
        }
        pwHs = H2OsincA.pw; tpwrsl = H2OsincA.pwr-1.0;  /* 1dB correction applied */
        pwn = pwN; dhpwr2 = pwNlvl;
      }

      if (tpwrsf_u < 4095.0) 
      {
        tpwrsl = tpwrsl + 6.0;   
        pwr_delay = POWER_DELAY + PWRF_DELAY;
      }
      else pwr_delay = POWER_DELAY;

/* maximum fine power for pwC pulses (and initialize rfst) */
        rf0 = 4095.0;    rfst=0.0;

/* 180 degree adiabatic C13 pulse from 0 to 200 ppm */
     if (C13refoc[A]=='y')
       {rfst = (compC*4095.0*pwC*4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35));
        rfst = (int) (rfst + 0.5);
        if ( 1.0/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)) < pwC )
           { text_error( " Not enough C13 RF. pwC must be %f usec or less.\n",
            (1.0e6/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35))) ); psg_abort(1); }}

/* check validity of parameter range */

    if(dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y') 
	{
	printf("incorrect Dec1 decoupler flags! Should be nnn  ");
	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 > 8 )
    {
	printf("tsatpwr too large !!!  ");
	psg_abort(1);
    }

    if( dpwr2_cp > 61 )
    {
        printf("don't fry the probe, dpwr2_cp too large for cpmg !");
	psg_abort(1);
    }

   if( ncyc > 100)
    {
       printf("ncyc exceeds 100. May be too much \n");
       psg_abort(1);
    }  

   if( time_T2 > 0.090 )
    {
       printf("total T2 recovery time exceeds 90 msec. May be too long \n");
       psg_abort(1);
    }  

   if( ncyc > 0)
    {
      tauCPMG = time_T2/(4*ncyc) - pwn_cp;
      if( ix == 1 )
      printf("nuCPMG for current experiment is (Hz): %5.3f \n",1/(4*(tauCPMG+pwn_cp)) );
    }
   else
    {
      tauCPMG = time_T2/4 - pwn_cp;
      if( ix == 1 )
      printf("nuCPMG for current experiment is (Hz): not applicable \n");
    }

   ncyc_max = time_T2/1e-3;
   if( tauCPMG + pwn_cp < 0.000250)
   {
      printf("WARNING: value of tauCPMG must be larger than or equal to 250 us\n");
      printf("maximum value of ncyc allowed for current time_T2 is: %5.2f \n",ncyc_max);
      psg_abort(1);
   }

   if(gt1 > 3e-3 || gt2 > 3e-3 || gt3 > 3e-3|| gt4 > 3e-3
                  || gt5 > 3e-3 || gt6 > 3e-3 )
   {
      printf("gti must be less than 3e-3\n");
      psg_abort(1);
   }

/* LOAD VARIABLES */

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

/* Phase incrementation for hypercomplex 2D data */

   if (phase == 2) {
     tsadd(t4,2,4);
     tsadd(t5,2,4);
     tsadd(t6,2,4);
     tsadd(t7,2,4);
   }

/* Set up f1180  */

   tau1 = d2;
   if(f1180[A] == 'y') 
     tau1 += ( 1.0 / (2.0*sw1) - (pw + pwN*2.0/3.1415));
   else
     tau1 = tau1 - pw; 

   if(tau1 < 0.2e-6) tau1 = 0.2e-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(t2,2,4);
      tsadd(t3,2,4);
      tsadd(t7,2,4);
   }


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   decpower(dpwr);               /* Set decoupler1 power to dpwr */
decpower(pwClvl);
decpwrf(rfst);
decoffset(dof);
   dec2power(dhpwr2);            /* Set decoupler2 power to dhpwr2 */

/* Presaturation Period */

 if(fsat[0] == 'y')
{
  obspower(tsatpwr);            /* Set power for presaturation  */
  obsoffset(tofps);            /* move H carrier to the water */
  rgpulse(d1,zero,rof1,rof1);  /* presat. with transmitter */
  obspower(tpwr);                /* Set power for hard pulses  */
}

else
{
 obspower(tpwr);                /* Set power for hard pulses  */
 delay(d1);
}

  obsoffset(tof);

status(B);

/* apply the compensation 15N pulses if desired */
 if(comp_flg[A] == 'y') {

  dec2power(dpwr2_comp);            /* Set decoupler2 compensation power */

  timeC = time_T2*(ncyc_max-ncyc)/ncyc_max;

  dec2rgpulse(timeC,zero,0.0,0.0);
  dec2power(dhpwr2);
}

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

  /* shaped pulse on water */
  obspower(tpwrsl);
  if (tpwrsf_d<4095.0) obspwrf(tpwrsf_d);
  if (autocal[A] == 'y')
   shaped_pulse("H2OsincA",pwHs,three,rof1,0.0);
  else
   shaped_pulse("H2Osinc_d",pwHs,three,rof1,0.0);
  if (tpwrsf_d<4095.0) obspwrf(4095.0);
  obspower(tpwr);
  /* shaped pulse on water */
  
  rgpulse(pw,two,rof1,0.0);     

  txphase(zero);
  dec2phase(zero);

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

  delay(taua - gt1 - gstab -2.0e-6);                   /* delay < 1/4J(XH)   */

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

  txphase(one);
  dec2phase(t1);

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

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

  rgpulse(pw,one,0.0,0.0);

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

  if (BPpwrlimits > 0.5)
   {
    dec2power(dpwr2_cp -3.0);    /* reduce for probe protection */
    pwn_cp=pwn_cp*compN*1.4;
   }
  else
   dec2power(dpwr2_cp);            /* Set decoupler2 power to dpwr2_cp for CPMG period */

  dec2rgpulse(pwn_cp,t1,rof1,2.0e-6);

  dec2phase(zero);

  /* start of the CPMG train for first period time_T2/2 on Ny(1-2Hz) */
  if(ncyc > 0) 
  {
    delay(tauCPMG - (2/PI)*pwn_cp - 2.0e-6);
    dec2rgpulse(2*pwn_cp,one,0.0,0.0);
    delay(tauCPMG);   
  }
 
  if(ncyc > 1) 
  {
  initval(ncyc-1,v4);
  loop(v4,v5);
 
    delay(tauCPMG);
    dec2rgpulse(2*pwn_cp,one,0.0,0.0);
    delay(tauCPMG);   
 
  endloop(v5);
  }
 
  /* eliminate cross-relaxation  */

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

  delay(taub - gt3 - gstab -2.0e-6 - pwn_cp);

  /* composite 1H 90y-180x-90y on top of 15N 180x */
  dec2rgpulse(pwn_cp-2*pw,zero,0.0e-6,0.0);
  sim3pulse(pw,0.0e-6,pw,one,zero,zero,0.0,0.0);
  sim3pulse(2*pw,0.0e-6,2*pw,zero,zero,zero,0.0,0.0);
  sim3pulse(pw,0.0e-6,pw,one,zero,zero,0.0,0.0);
  dec2rgpulse(pwn_cp-2*pw,zero,0.0,0.0e-6);
  /* composite 1H 90y-180x-90y on top of 15N 180x */

  delay(taub - gt3 - gstab -2.0e-6 - pwn_cp - 4.0*pw); 

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

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

  /* start of the CPMG train for second period time_T2/2 on Nx(1-2Iz) */
  if(ncyc > 1) 
  {
  initval(ncyc-1,v4);
  loop(v4,v5);
 
    delay(tauCPMG);
    dec2rgpulse(2*pwn_cp,zero,0.0,0.0);
    delay(tauCPMG);   
 
  endloop(v5);
  }
 
  if(ncyc > 0) 
  {
    delay(tauCPMG);
    dec2rgpulse(2*pwn_cp,zero,0.0,0.0);
    delay(tauCPMG - (2/PI)*pwn_cp - 2.0e-6);   
  }
 
  dec2phase(one);

  dec2rgpulse(pwn_cp,one,2.0e-6,0.0);

  delay(rof1);
  dec2power(dhpwr2);            /* Set decoupler2 power back to dhpwr2 */

  dec2phase(t3);

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

  if(phase==1)
   dec2rgpulse(pwn,t2,rof1,0.0);
  if(phase==2)
   dec2rgpulse(pwn,t3,rof1,0.0);

  txphase(t4); 
  decphase(one);
  dec2phase(zero);

/* 15N chemical shift labeling with optional 13C decoupling of Ca & C'*/
        if ( (C13refoc[A]=='y') && (tau1 > 0.5e-3 + WFG2_START_DELAY) )
           {delay(tau1 - 0.5e-3 - WFG2_START_DELAY);     /* WFG2_START_DELAY */
            decshaped_pulse("stC200", 1.0e-3, zero, 0.0, 0.0);
            delay(tau1 - 0.5e-3);}
        else    delay(2.0*tau1);
/* finish of 15N shift labeling*/

  rgpulse(pw,t4,0.0,0.0);

  /* shaped pulse on water */
  obspower(tpwrsl);
  if (tpwrsf_u<4095.0) obspwrf(tpwrsf_u);
  if (autocal[A] == 'y')
   shaped_pulse("H2OsincA",pwHs,t5,rof1,0.0);
  else
   shaped_pulse("H2Osinc_u",pwHs,t5,rof1,0.0);
  if (tpwrsf_u<4095.0) obspwrf(4095.0);
  obspower(tpwr);
  /* shaped pulse on water */

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

  delay(taua - pwr_delay - rof1 - WFG_START_DELAY
        - pwHs - WFG_STOP_DELAY - pwr_delay
        - gt5 - gstab/2.0 -2.0e-6);

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

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

  delay(taua 
        - gt5 - 2.0e-6 -gstab
        - pwr_delay - rof1 - WFG_START_DELAY
        - pwHs - WFG_STOP_DELAY - pwr_delay - 2.0e-6);

  /* shaped pulse on water */
  obspower(tpwrsl);
  if (tpwrsf_u<4095.0) obspwrf(tpwrsf_u);
  if (autocal[A] == 'y')
   shaped_pulse("H2OsincA",pwHs,zero,rof1,0.0);
  else
   shaped_pulse("H2Osinc_u",pwHs,zero,rof1,0.0);
  if (tpwrsf_u<4095.0) obspwrf(4095.0);
  obspower(tpwr);
  /* shaped pulse on water */

  sim3pulse(pw,0.0e-6,pwn,zero,zero,t6,2.0e-6,0.0);

  txphase(zero);
  dec2phase(zero);

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

  delay(taua - gt6 - gstab/2.0 -2.0e-6 - pwr_delay
        - pwHs);

  initval(1.0,v3);
  obsstepsize(phase_sl);
  xmtrphase(v3);
  obspower(tpwrsl);
  if (tpwrsf_d<4095.0) obspwrf(tpwrsf_d);
  if (autocal[A] == 'y')
   shaped_pulse("H2OsincA",pwHs,two,rof1,0.0);
  else
   shaped_pulse("H2Osinc_d",pwHs,two,rof1,0.0);
  if (tpwrsf_d<4095.0) obspwrf(4095.0);
  obspower(tpwr);
  xmtrphase(zero);

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

  initval(1.0,v3);
  obsstepsize(phase_sl);
  xmtrphase(v3);
  obspower(tpwrsl);
  if (tpwrsf_u<4095.0) obspwrf(tpwrsf_u);
  if (autocal[A] == 'y')
   shaped_pulse("H2OsincA",pwHs,two,rof1,0.0);
  else
   shaped_pulse("H2Osinc_u",pwHs,two,rof1,0.0);
  if (tpwrsf_u<4095.0) obspwrf(4095.0);
  obspower(tpwr);
  xmtrphase(zero);

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

  delay(taua - pwHs - gt6 - gstab/2.0 -2.0e-6          
        + 2.0*pw/PI - pwn
        - 2.0*POWER_DELAY);

  dec2rgpulse(pwn,zero,0.0,0.0);

  decpower(dpwr);                                 /* lower power on dec */
  dec2power(dpwr2);                               /* lower power on dec2 */

/* acquire data */

status(C);
     setreceiver(t7);
}
Ejemplo n.º 8
0
pulsesequence()
{
/* DECLARE AND LOAD VARIABLES */

  char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
              mag_flg[MAXSTR],    /* magic-angle coherence transfer gradients */
              f2180[MAXSTR],                  /* Flag to start t2 @ halfdwell */
              wudec[MAXSTR],	 /* automatic low power C-13 WURST decoupling */
              C13refoc[MAXSTR],	       /* adiabatic C13  pulse in middle of t1*/
	      NH2only[MAXSTR];		       /* spectrum of only NH2 groups */

 
  int         icosel,          		          /* used to get n and p type */
              t1_counter,  		        /* used for states tppi in t1 */
              t2_counter,  	 	        /* used for states tppi in t2 */
              PRexp,                        /* projection-reconstruction flag */
	      ni2 = getval("ni2");

  double      csa, sna, tau1, tau2,	                 /*  t1 and t2 delays */ 
              bw, ofs, ppm, nst,        /* bandwidth, offset, ppm, # of steps */
	      mix = getval("mix"),		 	    /* NOESY mix time */
	      tNH = 1.0/(4.0*getval("JNH")),	  /* 1/4J N15 evolution delay */
              pra = M_PI*getval("pra")/180.0,             /* projection angle */
              pwClvl = getval("pwClvl"), 	/* coarse power for C13 pulse */
              pwC = getval("pwC"),    /* C13 90 degree pulse length at pwClvl */
              compC = getval("compC"), /* adjust for C13 amplifier compression */
              pwC180 = 0.001,   /* duration of C13 180 degree adiabatic pulse */ 
              compH = getval("compH"), /* adjust for H1 amplifier compression */

   	tpwrsf = getval("tpwrsf"), /* fine power adjustment for flipback pulse */
   	pwHs = getval("pwHs"),	         /* H1 90 degree pulse length at tpwrs */
   	tpwrs = 0.0,	  	       /* power for the pwHs ("H2Osinc") pulse */
   	xdel = 2.0*GRADIENT_DELAY + POWER_DELAY,                /* xtra delay */

	pwNlvl = getval("pwNlvl"),	               /* power for N15 pulses */
        pwN = getval("pwN"),           /* N15 90 degree pulse length at pwNlvl */

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

        gzcal=getval("gzcal"),
	gt1 = getval("gt1"),  		        /* coherence pathway gradients */
	gzlvl1 = getval("gzlvl1"),
	gzlvl2 = getval("gzlvl2"),

	gt0 = getval("gt0"),				    /* other gradients */
	gt3 = getval("gt3"), 
	gt4 = getval("gt4"),
	gt5 = getval("gt5"),
	gstab = getval("gstab"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl6 = getval("gzlvl6"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5");

    getstr("f1180",f1180);
    getstr("mag_flg",mag_flg);
    getstr("f2180",f2180);
    getstr("C13refoc",C13refoc);
    getstr("NH2only",NH2only);
    getstr("wudec",wudec);

/*   LOAD PHASE TABLE    */

	settable(t1,2,phi1);
	settable(t3,4,phi3);
	settable(t9,16,phi9);
	settable(t10,1,phi10);
	settable(t11,8,rec);

/*   MAKE PBOX SHAPES   */

   if((FIRST_FID) && ((C13refoc[A]=='y') || (wudec[A]=='y')))   /* call Pbox */
   {
     ppm = getval("dfrq"); ofs = 0.0; nst = 1000;   /* nst - number of steps */ 
     bw = pwC*compC;
     if(bw > 0.0) 
     {
       bw = 0.1/bw;                                     /* maximum bandwidth */
       bw = pwC180*bw*bw; 
     }
     else
       bw = 200.0*ppm; 
       
     if(C13refoc[A]=='y')
       adC180 = pbox_makeA("adC180", "wurst2i", bw, pwC180, ofs, compC*pwC, pwClvl, nst);
     if(wudec[A]=='y') 
       wuCdec_lr = pbox_Adec("wurstC_lr", "CAWURST", bw, 0.01, ofs, compC*pwC, pwClvl);
   }      
    
   if(pwHs > 1.0e-5)                /* selective H20 one-lobe sinc pulse */
   {
     if(FIRST_FID) 
       H2Osinc = pbox_Rsh("H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
     tpwrs = H2Osinc.pwr;
     pwHs = H2Osinc.pw;
   }

/* CHECK VALIDITY OF PARAMETER RANGES */

  if ((mix - gt4 - gt5) < 0.0 )
  { text_error("mix is too small. Make mix equal to %f or more.\n",(gt4 + gt5));
						   		    psg_abort(1); }

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

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

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

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

/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 2) 
      tsadd(t1,1,4);  
    if (phase2 == 1) 
    { tsadd(t10,2,4); icosel = 1; }
    else              icosel = -1; 

/* set up Projection-Reconstruction experiment */
   
    PRexp = 0;      
    if((pra > 0.0) && (pra < 90.0)) PRexp = 1;

    csa = cos(pra);
    sna = sin(pra);
    
    if(PRexp)
    {
      tau1 = d2*csa;
      tau2 = d2*sna;
    }
    else
    {
      tau1 = d2;
      tau2 = d3;
    }

    if((f1180[A] == 'y') && (ni > 1.0))    /*  Set up f1180, tau1 = t1 */
      tau1 += 1.0/(2.0*sw1);
    tau1 = tau1/2.0;

    if((PRexp == 0) && (f2180[A] == 'y') && (ni2 > 1.0)) /*  Set up f2180  tau2 = t2 */
      tau2 += 1.0/(2.0*sw2);     
    tau2 = tau2/2.0;

    if(tau1 < 0.2e-6) tau1 = 0.0;
    if(tau2 < 0.2e-6) tau2 = 0.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(t11,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(t11,2,4); }

/*  Correct inverted signals for NH2 only spectra  */

   if(NH2only[A]=='y') { tsadd(t3,2,4); }

   if(wudec[A]=='y') xdel = xdel + POWER_DELAY + PWRF_DELAY + PRG_START_DELAY;

/* BEGIN PULSE SEQUENCE */

status(A);

	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(4095.0);
	txphase(zero);
        dec2phase(zero);

	delay(d1);

	dec2rgpulse(pwN, zero, 0.0, 0.0);  /* destroy N15 and C13 magnetization */
	decrgpulse(pwC, zero, 0.0, 0.0);
	zgradpulse(gzlvl0, 0.5e-3);
	delay(1.0e-4);
	dec2rgpulse(pwN, one, 0.0, 0.0);
	decrgpulse(pwC, one, 0.0, 0.0);
	zgradpulse(0.7*gzlvl0, 0.5e-3);

   	txphase(t1);
   	decphase(zero);
   	dec2phase(zero);
	delay(5.0e-4);
	rcvroff();

   	rgpulse(pw, t1, 50.0e-6, 0.0);                     /* 1H pulse excitation */

   	txphase(zero);

   if (tau1 > (2.0*GRADIENT_DELAY + pwN + 0.64*pw + 5.0*SAPS_DELAY))  
   {
     if (tau1>0.002)
     {
       zgradpulse(gzlvl6, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
       delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw) - SAPS_DELAY);
     }
     else
     {
       delay(tau1-pwN-0.64*pw);
     }
     
     if (C13refoc[A]=='y')
       sim3pulse(0.0, 2.0*pwC, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
     else
       dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
       
     if (tau1>0.002)
     {
       zgradpulse(-1.0*gzlvl6, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
       delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw) - SAPS_DELAY);
     }
     else
     {
       delay(tau1-pwN-0.64*pw);
     }
   }
   else if (tau1 > (0.64*pw + 0.5*SAPS_DELAY))
     delay(2.0*tau1 - 2.0*0.64*pw - SAPS_DELAY );

   	rgpulse(pw, zero, 0.0, 0.0);

	delay(mix - gt4 - gt5 -gstab -200.0e-6);
	dec2rgpulse(pwN, zero, 0.0, 0.0);
	zgradpulse(gzlvl4, gt4);
        delay(gstab);

   	rgpulse(pw, zero, 200.0e-6,0.0);			       /* HSQC begins */

   	dec2phase(zero);
	zgradpulse(gzlvl0, gt0);
	delay(tNH - gt0);

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

   	txphase(one);
	zgradpulse(gzlvl0, gt0);
	delay(tNH - gt0);

 	rgpulse(pw, one, 0.0, 0.0);
	txphase(two);
        if (tpwrsf<4095.0)
        {
          obspower(tpwrs+6.0); obspwrf(tpwrsf);
   	  shaped_pulse("H2Osinc", pwHs, two, 5.0e-4, 0.0);
	  obspower(tpwr); obspwrf(4095.0);
        }
        else
        {
          obspower(tpwrs);
   	  shaped_pulse("H2Osinc", pwHs, two, 5.0e-4, 0.0);
	  obspower(tpwr);
        }
	zgradpulse(gzlvl3, gt3);
	dec2phase(t3);
	decpwrf(adC180.pwrf);
	delay(2.0e-4);
   	dec2rgpulse(pwN, t3, 0.0, 0.0);
	decphase(zero);


/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

        txphase(zero);
	dec2phase(t9);

     if (NH2only[A]=='y')	
     {      
    	delay(tau2);
         			  /* optional sech/tanh pulse in middle of t2 */
    	if (C13refoc[A]=='y') 				   /* WFG_START_DELAY */
           { decshaped_pulse("adC180", pwC180, zero, 0.0, 0.0);
             delay(tNH - 1.0e-3 - WFG_START_DELAY - 2.0*pw); }
    	else
           { delay(tNH - 2.0*pw);}
    	rgpulse(2.0*pw, zero, 0.0, 0.0);
    	if (tNH < gt1 + 1.99e-4)  delay(gt1 + 1.99e-4 - tNH);

    	delay(tau2);

    	dec2rgpulse(2.0*pwN, t9, 0.0, 0.0);
        if (mag_flg[A] == 'y')
          magradpulse(gzcal*gzlvl1, gt1);
        else
          zgradpulse(gzlvl1, gt1);
    	dec2phase(t10);
   	if (tNH > gt1 + 1.99e-4)  delay(tNH - gt1 - 2.0*GRADIENT_DELAY);
   	else   delay(1.99e-4 - 2.0*GRADIENT_DELAY);
     }
     else
     {
        if ( (C13refoc[A]=='y') && (tau2 > 0.5e-3 + WFG2_START_DELAY) )
           {  delay(tau2 - 0.5e-3 - WFG2_START_DELAY); /* WFG2_START_DELAY */
            simshaped_pulse("", "adC180", 2.0*pw, pwC180, zero, zero, 0.0, 0.0);
            delay(tau2 - 0.5e-3);
            delay(gt1 + 2.0e-4);}
	else
           { delay(tau2);
            rgpulse(2.0*pw, zero, 0.0, 0.0);
            delay(gt1 + 2.0e-4 - 2.0*pw);
            delay(tau2); }

	dec2rgpulse(2.0*pwN, t9, 0.0, 0.0);

        if(mag_flg[A] == 'y')
          magradpulse(gzcal*gzlvl1, gt1);
        else
          zgradpulse(gzlvl1, gt1);
          
	dec2phase(t10);
	delay(2.0e-4 - 2.0*GRADIENT_DELAY);
     } 

/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */

	sim3pulse(pw, 0.0, pwN, zero, zero, t10, 0.0, 0.0);

	dec2phase(zero);
	zgradpulse(gzlvl5, gt5);
	delay(tNH - 1.5*pwN - gt5);

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

	zgradpulse(gzlvl5, gt5);
	txphase(one);
	dec2phase(one);
	delay(tNH  - 1.5*pwN - gt5);

	sim3pulse(pw, 0.0, pwN, one, zero, one, 0.0, 0.0);

	txphase(zero);
	dec2phase(zero);
	zgradpulse(1.5*gzlvl5, gt5);
	delay(tNH - 1.5*pwN - gt5);

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

	zgradpulse(1.5*gzlvl5, gt5);
	delay(tNH - pwN - 0.5*pw - gt5);

	rgpulse(pw, zero, 0.0, 0.0);

	delay((gt1/10.0) + 1.0e-4+ gstab - 0.5*pw + xdel);

	rgpulse(2.0*pw, zero, 0.0, rof1);
	dec2power(dpwr2);				       /* POWER_DELAY */
	
        if (mag_flg[A] == 'y')
          magradpulse(icosel*gzcal*gzlvl2, gt1/10.0);
        else
          zgradpulse(icosel*gzlvl2, gt1/10.0);
        delay(gstab + rof2);
        
	setreceiver(t11);
        rcvron();
        statusdelay(C,1.0e-4-rof1);		
        if(wudec[A]=='y') 
        {
          decpwrf(4095.0);
          decpower(wuCdec_lr.pwr+3.0);
          decprgon("wurstC_lr", 1.0/wuCdec_lr.dmf, wuCdec_lr.dres);
          decon();
        }	
}