Esempio n. 1
0
void pulsesequence()
{
/* DECLARE VARIABLES */

  char  aliph[MAXSTR],	        /* aliphatic CHn groups only */
        arom[MAXSTR],		/* aromatic CHn groups only */
        wudec[MAXSTR],		/* automatic WURST decoupling */
        CNrefoc[MAXSTR],	/* flag for refocusing 15N during indirect H1 evolution */
        SBSUPR[MAXSTR],	        /* flag for side-band suppression (use 8 step phase cycle) */

        f1180[MAXSTR],	        /* Flag to start t1 @ halfdwell */
        mag_flg[MAXSTR],	/* magic angle gradient */
        f2180[MAXSTR];	        /* Flag to start t2 @ halfdwell */

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

  double csa, sna, tau1, tau2,	/*  t1 and t2 delays */   
         bw, ofs, ppm, pwd, nst,

        rfst = 0.0,			/* fine power level for adiabatic pulse initialized */
        slpwr = getval("slpwr"),        /* spinlock power level */
        slofs = getval("slofs"),        /* spinlock offset (in Hz) from carrier frequency */

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

        pra = M_PI*getval("pra")/180.0,
        jch = getval("jch"),		/*  CH coupling constant */
        ni2 = getval("ni2"),

        pwC = getval("pwC"),		/* PW90 for 13C nucleus @ pwClvl */
        pwClvl = getval("pwClvl"),	/* high power for 13C hard pulses on dec1  */
        pwC180 = getval("pwC180"),	/* PW180 for 13C nucleus in INEPT transfers */
        pwN = getval("pwN"),		/* PW90 for 15N nucleus @ pwNlvl */
        pwNlvl = getval("pwNlvl"),	/* high power for 15N hard pulses on dec2 */

        pwClw=getval("pwClw"), 
        pwNlw=getval("pwNlw"),
        pwZlw=0.0,			/* largest of pwNlw and 2*pwClw */

        mix  = getval("mix"),		/* tocsy mix time */
        sw1  = getval("sw1"),		/* spectral width in t1 (H) */
        sw2  = getval("sw2"),		/* spectral width in t2 (C) */
        gstab = getval("gstab"),	/* gradient recovery delay (300 us recom.) */
        gsign = 1.0,
        gzcal = getval("gzcal"),	/* dac to G/cm conversion factor */
        gt0 = getval("gt0"),
        gt1 = getval("gt1"),
        gt2 = getval("gt2"),
        gt3 = getval("gt3"),
        gt4 = getval("gt4"),
        gt5 = getval("gt5"),
        gt6 = getval("gt6"),
        gzlvl0 = getval("gzlvl0"),
        gzlvl1 = getval("gzlvl1"),
        gzlvl2 = getval("gzlvl2"),
        gzlvl3 = getval("gzlvl3"),
        gzlvl4 = getval("gzlvl4"),
        gzlvl5 = getval("gzlvl5"),
        gzlvl6 = getval("gzlvl6");

/* LOAD VARIABLES */

  getstr("aliph",aliph);
  getstr("arom",arom);
  getstr("wudec",wudec);
  getstr("CNrefoc",CNrefoc);

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


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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if((dm[A] == 'y' || dm[C] == 'y' ))
    {
        printf("incorrect 13C decoupler flags! dm='nnnn' or 'nnny' only  ");
        psg_abort(1);
    }

    if((dm2[A] == 'y' || dm2[C] == 'y' ))
    {
        printf("incorrect 15N decoupler flags! No decoupling in relax or mix periods  ");
        psg_abort(1);
    }

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

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

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

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

    if( slpwr > 49.0 )
    {
        printf("dont fry the probe, spinlock strength too high ! ");
        psg_abort(1);
    } 

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

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

   if( gzlvl3*gzlvl4 > 0.0 ) 

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

    if (phase2 == 1)  {tsadd(t5,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-7) tau1 = 2.0e-7;

/* 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(t4,2,4); }

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

/* calculate 3db lower power hard pulses for simultaneous CN decoupling during
   indirect H1 evoluion pwNlw and pwClw should be calculated by the macro that 
   calls the experiment. */

   if (CNrefoc[A] == 'y')
   {
     if (pwNlw==0.0) pwNlw = compN*pwN*exp(3.0*2.303/20.0);
     if (pwClw==0.0) pwClw = compC*pwC*exp(3.0*2.303/20.0);
     if (pwNlw > 2.0*pwClw) pwZlw=pwNlw;
     else  pwZlw=2.0*pwClw;
   }


/* make sure gt3 and gt1 have always opposite sign to help dephasing H2O */

   if (gzlvl3*gzlvl1 > 0.0) gsign=-1.0;
     else gsign=1.0; 

   ppm = getval("dfrq"); ofs = 0.0; nst = 1000;     /* number of steps */       

   if(arom[A]=='y')                /* AROMATIC spectrum only */
     bw = 40.0*ppm;
   else if(aliph[A]=='y')          /* ALIPHATIC spectrum only */
     bw = 80.0*ppm;
   else    
   {
     bw = 0.1/(pwC*compC);       /* maximum bandwidth */
     bw = pwC180*bw*bw;  
   } 
     
   if(FIRST_FID) 
   {      
     adC180 = pbox_makeA("adC180", "wurst2i", bw, pwC180, ofs, compC*pwC, pwClvl, nst);   
     wuHmix = pbox_Adec("adsl", "amwurst", 0.0, mix, slofs, 0.0, 0.0);
     pwd = 0.0013;
     if(wudec[A]=='y') 
       wuCdec = pbox_Adec("wurstC", "WURST40", bw, pwd, ofs, compC*pwC, pwClvl);
   }          
   rfst = adC180.pwrf;
   wuHmix.pwr = slpwr;
   wuHmix.pwrf = 4095.0;

/* BEGIN ACTUAL PULSE SEQUENCE */


status(A);

   presat();
   obspower(tpwr);		/* Set transmitter power for hard 1H pulses */
   decpower(pwClvl);		/* Set Dec1 power for hard 13C pulses */
   dec2power(pwNlvl);		/* Set Dec2 power for decoupling during tau1 */
   decpwrf(4095.0);       
   dec2pwrf(4095.0);       

/* destroy N15 and C13 magnetization */
   if (CNrefoc[A] == 'y') dec2rgpulse(pwN, zero, 0.0, 0.0);
   decrgpulse(pwC, zero, 0.0, 0.0);
   zgradpulse(gzlvl0, 0.5e-3);
   delay(gstab);
   if (CNrefoc[A] == 'y') dec2rgpulse(pwN, one, 0.0, 0.0);
   decrgpulse(pwC, one, 0.0, 0.0);
   zgradpulse(0.7*gzlvl0, 0.5e-3);

   decphase(zero);       
   dec2phase(zero);       
   rcvroff();
   delay(gstab);


status(B);
   rgpulse(pw, t1, rof1 ,rof1);                  /* 90 deg 1H pulse */
   txphase(zero); 

   if (ni > 0) 
    {
     if ((CNrefoc[A]=='y') && (tau1 > pwZlw +2.0*pw/PI +3.0*SAPS_DELAY +2.0*POWER_DELAY +2.0*rof1))
      {
       decpower(pwClvl-3.0); dec2power(pwNlvl-3.0);
       delay(tau1 -pwNlw -2.0*pw/PI -3.0*SAPS_DELAY -2.0*POWER_DELAY -2.0*rof1);

       if (pwNlw > 2.0*pwClw)
         {
	  dec2rgpulse(pwNlw -2.0*pwClw,zero,rof1,0.0);
	  sim3pulse(0.0,pwClw,pwClw,zero,zero,zero,0.0,0.0);
          decphase(one);
	  sim3pulse(0.0,2*pwClw,2*pwClw,zero,one,zero,0.0,0.0);
          decphase(zero);
	  sim3pulse(0.0,pwClw,pwClw,zero,zero,zero,0.0,0.0);
	  dec2rgpulse(pwNlw -2.0*pwClw,zero,0.0,rof1);
         }
	else
         {
	  decrgpulse(2.0*pwClw-pwNlw,zero,rof1,0.0);
	  sim3pulse(0.0,pwNlw-pwClw,pwNlw-pwClw,zero,zero,zero,0.0,0.0);
          decphase(one);
	  sim3pulse(0.0,2.0*pwClw,2.0*pwClw,zero,one,zero,0.0,0.0);
          decphase(zero);
	  sim3pulse(0.0,pwNlw-pwClw,pwNlw-pwClw,zero,zero,zero,0.0,0.0);
	  decrgpulse(2.0*pwClw-pwNlw,zero,0.0,rof1);
         }

       decpower(pwClvl); dec2power(pwNlvl);
       delay(tau1 -pwZlw -2.0*pw/PI -SAPS_DELAY -2.0*POWER_DELAY -2.0*rof1);
      }     
     else if (tau1 > 2.0*pwC +2.0*pw/PI +3.0*SAPS_DELAY +2.0*rof1)
      {
       delay(tau1 -2.0*pwC -2.0*pw/PI -3.0*SAPS_DELAY -2.0*rof1);

       decrgpulse(pwC, zero, rof1, 0.0);
       decphase(one);
       decrgpulse(2.0*pwC, one, 0.0, 0.0);
       decphase(zero);
       decrgpulse(pwC, zero, 0.0, rof1);

       delay(tau1 -2.0*pwC -2.0*pw/PI -SAPS_DELAY -2.0*rof1);
      }
     else if (tau1 > 2.0*pw/PI +2.0*SAPS_DELAY +rof1)
	  delay(2.0*tau1 -4.0*pw/PI -2.0*SAPS_DELAY -2.0*rof1);
    }

   rgpulse(pw, zero, rof1, rof1);             /*  2nd 1H 90 pulse   */
status(C);

   zgradpulse(gzlvl0,gt0);
   delay(gstab);
   
   obspower(slpwr);
   xmtron();
   obsprgon(wuHmix.name, 1.0/wuHmix.dmf, wuHmix.dres);
   delay(mix);
   obsprgoff(); xmtroff();

   decrgpulse(pwC,zero,2.0e-6,2.0e-6); 
   zgradpulse(-gzlvl0,gt0);
   obspower(tpwr);
   decpwrf(rfst);                           /* fine power for inversion pulse */
   delay(gstab);

/* FIRST HSQC INEPT TRANSFER */
   rgpulse(pw,zero,0.0,0.0);
   zgradpulse(gzlvl4, gt4);
   delay(1/(4.0*jch) -gt4 -2.0*GRADIENT_DELAY -WFG2_START_DELAY -pwC180*0.45);

   simshaped_pulse("","adC180",2*pw,pwC180,zero,zero,0.0,0.0);
   decphase(zero);

   zgradpulse(gzlvl4, gt4);
   decpwrf(4095.0);
   txphase(one);
   delay(1/(4.0*jch) -gt4 -2.0*GRADIENT_DELAY -pwC180*0.45 -PWRF_DELAY -SAPS_DELAY);

   rgpulse(pw,one,0.0,0.0);
   zgradpulse(gsign*gzlvl3, gt3);
   txphase(zero);
   delay(gstab);

/* C13 EVOLUTION */
   decrgpulse(pwC,t2,0.0,0.0);   

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

   decphase(zero);
   delay(gt1 +2.0*GRADIENT_DELAY +gstab -2.0*pw -SAPS_DELAY);
   decrgpulse(2*pwC,zero,0.0,0.0);

   if (mag_flg[A] == 'y')  magradpulse(gzcal*gzlvl1, gt1);
     else  zgradpulse(gzlvl1, gt1);
   decphase(t5);
   delay(gstab);

   decrgpulse(pwC,t5,0.0,0.0);
   delay(pw);
   rgpulse(pw,zero,0.0,0.0);

   zgradpulse(gzlvl5, gt5);
   decphase(zero);
   delay(1/(8.0*jch) -gt5 -SAPS_DELAY -2.0*GRADIENT_DELAY);		/* d3 = 1/8*Jch */

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

   zgradpulse(gzlvl5, gt5);
   decphase(one);
   txphase(one);
   delay(1/(8.0*jch) -gt5 -2.0*SAPS_DELAY -2.0*GRADIENT_DELAY);		/* d3 = 1/8*Jch */

   delay(pwC);
   decrgpulse(pwC,one,0.0,2.0e-6);
   rgpulse(pw,one,0.0,0.0);

   zgradpulse(gzlvl6, gt6);
   decpwrf(rfst);                           /* fine power for inversion pulse */
   decphase(zero);
   txphase(zero);
   delay(1/(4.0*jch) -gt6 -pwC180*0.45 -PWRF_DELAY 
		-WFG2_START_DELAY -2.0*SAPS_DELAY -2.0*GRADIENT_DELAY);	/* d2 = 1/4*Jch */

   simshaped_pulse("","adC180",2*pw,pwC180,zero,zero,0.0,0.0);
   decphase(zero);

   zgradpulse(gzlvl6, gt6);
   decpwrf(4095.0);
   delay(1/(4.0*jch) -gt6 -pwC180*0.45 -PWRF_DELAY -2.0*GRADIENT_DELAY);	/* d2 = 1/4*Jch */

   rgpulse(pw,zero,0.0,0.0);  

   if (SBSUPR[A]=='y') delay(gt2 +gstab +2.0*GRADIENT_DELAY +2.0*pwC 
					+SAPS_DELAY +rof2 +POWER_DELAY);
   else delay(gt2 +gstab +2.0*GRADIENT_DELAY +POWER_DELAY);

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

   if (mag_flg[A] == 'y')  magradpulse(icosel*gzcal*gzlvl2, gt2);
     else  zgradpulse(icosel*gzlvl2, gt2);
   delay(gstab);

   if (SBSUPR[A]=='y') {
       decrgpulse(pwC,zero,0.0,0.0);     
       decphase(t3);
       decrgpulse(pwC,t3,0.0,rof2);     
      }

   setreceiver(t4);
   rcvron();
   if ((wudec[A]=='y') && (dm[D] == 'y'))
   {
     decpower(wuCdec.pwr+3.0);
     decprgon("wurstC", 1.0/wuCdec.dmf, wuCdec.dres);
     decon();
   }
   else	
   { 
     decpower(dpwr);
     status(D);
   }
}
Esempio n. 2
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();
        }	
}