Example #1
0
pulsesequence()
{
   char   
          autocal[MAXSTR],
          shname1[MAXSTR],
	  shname2[MAXSTR],
          ipap_flg[MAXSTR],
          ab_flg[MAXSTR],
	  f1180[MAXSTR],
          SE[MAXSTR],        /*Use Sensitivity Enhancement */
          c13refoc[MAXSTR],
          refpat[MAXSTR],    /* pulse shape pattern refocus. pulse*/
          hetsofast_flg[MAXSTR],
          grad3_flg[MAXSTR];     /*gradient flag */

   int   
          t1_counter,
          phase;


   double d2_init=0.0,
          pwS,pwS1,pwS2, 
          tpwrsf = getval("tpwrsf"),
   	  adjust = getval("adjust"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gstab = getval("gstab"),
          gt1 = getval("gt1"),
          gt2 = getval("gt2"),
          gt3 = getval("gt3"),
          shlvl1 = getval("shlvl1"),
          shlvl2 = getval("shlvl2"),
          shdmf2 = getval("shdmf2"),
          shbw = getval("shbw"),
          shpw1 = getval("shpw1"),
          shpw2 = getval("shpw2"),
          shpw3 = 0.0,

          shofs = getval("shofs"),
          flipangle = getval("flipangle"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          dpwr2 = getval("dpwr2"),
          d2 = getval("d2"),
          tau1,
          taunh = 1.0/(2.0*getval("JNH"));

void compo_pulse();
void compo1_pulse();
void makeshape_pc9();
void makeshape_refoc();
void makeshape_ndec();

   getstr("autocal",autocal);
   getstr("f1180",f1180);
   getstr("c13refoc",c13refoc);
   getstr("hetsofast_flg",hetsofast_flg);
   getstr("refpat", refpat); /* pulse pattern refocussing pulse */
   getstr("ipap_flg",ipap_flg);
   getstr("grad3_flg",grad3_flg);
   getstr("ab_flg",ab_flg);
   getstr("SE",SE);
   getstr("shname1",shname1);
   getstr("shname2",shname2);

 pwS = c_shapedpw("sech",200.0,0.0,zero, 0.0, 0.0);
 pwS1 = hn_simshapedpw(refpat,shbw,shofs-4.8,"isnob3",50.0,0.0, zero, zero, 0.0, 0.0);
 pwS2 = h_shapedpw(refpat,shbw,3.5,zero, 0.0, 0.0);



 if (hetsofast_flg[0] == 'a')
   shpw3 = h_shapedpw("isnob5",4.0,-3.0,two, 2.0e-6, 2.0e-6);
 if (hetsofast_flg[0] == 'b')
   shpw3 = h_shapedpw("gaus180",0.015,0.0,two, 2.0e-6, 2.0e-6);

  phase = (int) (getval("phase") + 0.5);
   
   settable(t1,2,phi1);
   settable(t2,2,phi2);

if (autocal[0] == 'y')
{
(void) makeshape_pc9(flipangle, shbw, shofs);  /*create pc9 pulse*/
   sh90 = getRsh("hn_pc9");
   shpw1 = sh90.pw;
   shlvl1 = sh90.pwr;
     sprintf(shname1,"hn_pc9");


(void) makeshape_refoc(refpat, shbw, shofs);  /* create refocussing pulse */
   shref = getDsh("hn_refoc");
   shpw2 = shref.pw;
   shlvl2 = shref.pwr;
   shdmf2 = shref.dmf;
   sprintf(shname2,"hn_refoc");

  if (dmm2[2] == 'p')  /* waveform capability present on channel 3 */
 {
  (void) makeshape_ndec();  /* create n15 wurst decoupling */
   shdec = getDsh("hncompdec");
   dpwr2 = shdec.pwr;
   dmf2 = shdec.dmf;
   dres2 = shdec.dres;
   sprintf(dseq2,"hncompdec");
 }

}

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

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

    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;
  
    if (f1180[0] == 'y')  tau1 = tau1-pwN*4.0/3.0;

    


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



   status(A);

   decoffset(dof);
   dec2power(pwNlvl);
   dec2offset(dof2);
   obsoffset(tof);
   obspower(tpwr);


/**********************************************/
 if (hetsofast_flg[0] != 'n')
 {
     if (hetsofast_flg[0] == 'a')
     h_shapedpulse("isnob5",4.0,-3.0,two, 2.0e-6, 2.0e-6);
     if (hetsofast_flg[0] == 'b')
     h_shapedpulse("gaus180",0.015,0.0,two, 2.0e-6, 2.0e-6);
     zgradpulse(gzlvl2, gt2);
     delay(gstab);
     delay(d1-gt2-shpw3);
     lk_hold();
 }
 else
 {
     zgradpulse(gzlvl2, gt2);
     delay(gstab);
     delay(d1-gt2);
     lk_hold();
 }
   obspower(shlvl1);
   shaped_pulse(shname1,shpw1,zero,2.0e-4,2.0e-6);

if (SE[0] == 'y')
 {

  if (ipap_flg[0] == 'y')
  {
    if ((tau1+pwN*2.0) < pwS2) delay((pwS2*0.5-tau1*0.5-pwN)*0.5);
    if (grad3_flg[0]== 'y')
     delay(taunh*0.5-shpw1*0.533-pwS1*0.5+(gt3*2.0+2.0*gstab+pwN*3.0));
    else
     delay(taunh*0.5-shpw1*0.533-pwS1*0.5+pwN);

    hn_simshapedpulse(refpat,shbw,shofs-4.8,"bip720_50_20",40.0,0.0, zero, zero, 0.0, 0.0);
    obspower(shlvl2);
    obspwrf(4095.0);
    compo1_pulse(shname2,shpw2,pwN,shdmf2,t1,tau1,c13refoc,pwS,taunh,pwS1,pwS2,gt1,gt3,gzlvl3,grad3_flg,gstab);
    obspower(shlvl2);
    obspwrf(4095.0);
    zgradpulse(gzlvl1, gt1);
    delay(gstab);
    h_sim3shapedpulse(refpat,shbw,shofs-4.8,0.0,2.0*pwN, one, zero, zero, 0.0, 0.0);
    zgradpulse(gzlvl1, gt1);
    delay(gstab);
    delay(taunh*0.5-gt1-gstab-POWER_DELAY-pwS1*0.5);
    if ((tau1+pwN*2.0) < pwS2) delay((pwS2*0.5-tau1*0.5-pwN)*0.5);
    if (ab_flg[0] == 'a')
      dec2rgpulse(pwN,one,0.0,0.0);
    else
      dec2rgpulse(pwN,three,0.0,0.0);
    if (grad3_flg[0]== 'y')
     {
      delay(gt3+gstab);
      dec2rgpulse(pwN*2.0,zero,0.0,0.0);
      zgradpulse(gzlvl3,gt3);
      delay(gstab);
     }
  }
  else
  {
    zgradpulse(gzlvl1, gt1);
    delay(gstab);
    if ((tau1+pwN*2.0) < pwS2) 
     delay(taunh-gt1-gstab-shpw1*0.533-adjust-(pwS2*0.5-tau1*0.5-pwN)*0.5);
    else
     delay(taunh-gt1-gstab-shpw1*0.533-adjust);
    obspower(shlvl2);
    obspwrf(tpwrsf);
    compo_pulse(shname2,shpw2,pwN,shdmf2,t1,tau1,c13refoc,pwS);
    obspower(shlvl1);
    obspwrf(4095.0);
    zgradpulse(gzlvl1, gt1);
    delay(gstab);
    if ((tau1+pwN*2.0) < pwS2) 
     delay(taunh-gt1-gstab-POWER_DELAY-(pwS2*0.5-tau1*0.5-pwN)*0.5);
    else
     delay(taunh-gt1-gstab-POWER_DELAY);
  }
 }
else
 {
  if ((ni == 0) || (ni == 1))
   {
    zgradpulse(gzlvl1, gt1);
    delay(gstab);
    delay(taunh-gt1-gstab-WFG_START_DELAY+pwN*4.0-shpw1*0.533-adjust);
    obspwrf(tpwrsf);
    obspower(shlvl2);

    xmtrphase(zero);
    xmtron();
    obsunblank();
    obsprgon(shname2,1/shdmf2,9.0);
    delay(shpw2);
    obsprgoff();
    obsblank();
    xmtroff();

    obspower(shlvl2);
    obspwrf(4095.0);
    dec2rgpulse(pwN,t1,0.0,0.0);
    dec2rgpulse(pwN*2.0,zero,0.0,0.0);
    dec2rgpulse(pwN,zero,0.0,0.0);
   }
  else
   {
    zgradpulse(gzlvl1, gt1);
    delay(gstab);
    delay(taunh-gt1-gstab-shpw1*0.533-adjust);
    obspower(shlvl2);
    obspwrf(tpwrsf);
    compo_pulse(shname2,shpw2,pwN,shdmf2,t1,tau1,c13refoc,pwS);
    obspower(shlvl1);
    obspwrf(4095.0);
   }

  if (ipap_flg[0] == 'y')
   {
   if (ab_flg[0] == 'b')
     {
     zgradpulse(gzlvl1, gt1);
     delay(gstab);
     delay(taunh-gt1-gstab-pwN-POWER_DELAY);
     dec2rgpulse(pwN,one,0.0,0.0);
     }
   else
     {
     zgradpulse(gzlvl1, gt1);
     delay(gstab);
     delay(taunh*0.5-gt1-pwN-gstab);
     dec2rgpulse(pwN*2.0,zero,0.0,0.0);
     delay(taunh*0.5-pwN-POWER_DELAY);
     }
   }
  else
   {
   zgradpulse(gzlvl1, gt1);
   delay(gstab);
   delay(taunh-gt1-gstab-POWER_DELAY);
   }
 }
 dec2power(dpwr2);
 lk_sample(); 
 setreceiver(t2);
 status(C);


}
Example #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],			    /* do TROSY on N15 and H1 */
	    h1dec[MAXSTR],		/* Flag to waltz-decouple of H1 for t1*/
	    CT_c[MAXSTR];           /* Flag to constant time evolution for C13*/
 
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      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            timeTC = getval("timeTC"),     /* constant time for 13C evolution */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    kappa = 5.4e-3,
	    lambda = 2.4e-3,
	    taud = 1.7e-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 */

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

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

/* the following pulse lengths for SLP pulses are automatically calculated    */
/* by the macro "BPcal".  SLP pulse shapes, "offC9" etc are called       */
/* directly from your shapelib.                    			      */
   pwC9 = getval("pwC9"),  /*180 degree pulse at CO(174ppm) null at Ca(56ppm) */
   pwC9a = getval("pwC9a"),    /* pwC9a=pwC9, but not set to zero when pwC9=0 */
   phshift9,             /* phase shift induced on Ca by pwC9 ("offC9") pulse */
   pwZ,					   /* the largest of pwC9 and 2.0*pwN */
   pwZ1,                /* the larger of pwC9a and 2.0*pwN for 1D experiments */
   rf9,	                           /* fine power for the pwC9 ("offC9") 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 */
   	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"),
	gt7 = getval("gt7"),
	gstab = getval("gstab"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),
	gzlvl6 = getval("gzlvl6"),
	gzlvl7 = getval("gzlvl7");

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



/*   LOAD PHASE TABLE    */

	settable(t3,2,phi3);
	settable(t4,1,phx);
	settable(t5,4,phi5);
   if (TROSY[A]=='y')
       {settable(t8,1,phy);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,4,recT);}
    else
       {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;
	
     /* 90 degree pulse on Ca, null at CO 118ppm away */
       pwC1 = sqrt(15.0)/(4.0*118.0*dfrq);
        rf1 = (compC*4095.0*pwC)/pwC1;
        rf1 = (int) (rf1 + 0.5);

    /* 180 degree pulse on Ca, null at CO 118ppm away */
        pwC2 = sqrt(3.0)/(2.0*118.0*dfrq);
        rf2 = (4095.0*compC*pwC*2.0)/pwC2;
        rf2 = (int) (rf2 + 0.5);
        if( rf2 > 4095.0 )
         {printf("increase pwClvl so that C13 90 < 24us*(600/sfrq)"); psg_abort(1);}

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

    /* the pwC9 pulse at the middle of t1  */
        if ((ni2 > 0.0) && (ni == 1.0)) ni = 0.0;
        if (pwC9a > 2.0*pwN) pwZ = pwC9a; else pwZ = 2.0*pwN;
        if ((pwC9==0.0) && (pwC9a>2.0*pwN)) pwZ1=pwC9a-2.0*pwN; else pwZ1=0.0;
        if (ni > 1)  pwC9 = pwC9a;
        if ( pwC9 > 0 )  phshift9 = 320.0;
	else             phshift9 = 0.0;

    /* 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);
 


/* CHECK VALIDITY OF PARAMETER RANGES */

    if ( 0.5*ni*1/(sw1) > timeTC)
       { printf(" ni is too big. Make ni less than %d . Check by using dps and make sure no ? appears for d2=t1max (ni/sw1).\n", 
  	 ((int)((timeTC)*2.0*sw1-7))); psg_abort(1);   }

    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 ( dm3[A] == 'y' || dm3[C] == 'y' )
       { printf("incorrect dec3 decoupler flags! Should be 'nyn' or 'nnn' ");
							             psg_abort(1);}	
    if ( dpwr2 > 46 )
       { printf("dpwr2 too large! recheck value  "); psg_abort(1);}

    if ( pw > 20.0e-6 )
       { printf(" pw too long ! recheck value "); psg_abort(1);} 
  
    if ( pwN > 100.0e-6 )
       { printf(" pwN too long! recheck value "); psg_abort(1);} 
 
    if ( TROSY[A]=='y' && dm2[C] == 'y')
       { text_error("Choose either TROSY='n' or dm2='n' ! "); psg_abort(1);}



/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 2)   tsadd(t3,1,4);  
    if (TROSY[A]=='y')
	 {  if (phase2 == 2)   				      icosel = +1;
            else 	    {tsadd(t4,2,4);  tsadd(t10,2,4);  icosel = -1;}
	 }
    else {  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; }
    tau1 = tau1/2.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);
if ( dm3[B] == 'y' )
  { lk_hold(); lk_sampling_off();}  /*freezes z0 correction, stops lock pulsing*/

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

if (TROSY[A]=='y')
   {
    txphase(two);
    obspower(tpwrs);
    shaped_pulse("H2Osinc",pwHs,two,5.0e-4,0.0);
    obspower(tpwr);
    zgradpulse(gzlvl3, gt3);
    delay(2.0e-4);
    dec2rgpulse(pwN, zero, 0.0, 0.0);

    delay(0.5*kappa - 2.0*pw);
    rgpulse(2.0*pw, two, 0.0, 0.0);

    dec2phase(zero);
    decpwrf(rf2);
    delay(timeTN - 0.5*kappa);
   }

else
   {
    txphase(zero);
    obspower(tpwrs);
    shaped_pulse("H2Osinc",pwHs,zero,5.0e-4,0.0);
    obspower(tpwrd);
    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(rf2);
    delay(timeTN - kappa);
   }

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

	decphase(t3);
	decpwrf(rf1);
	delay(timeTN);

	dec2rgpulse(pwN, zero, 0.0, 0.0);
if (TROSY[A]=='n')
   {
    xmtroff();
    obsprgoff();
    if (h1dec[0]=='y')
      rgpulse(pwHd,three,2.0e-6,0.0);
    else
      rgpulse(pwHd,one,2.0e-6,0.0);
   }

   zgradpulse(gzlvl3, gt3);
   txphase(one);
   delay(2.0e-4);

if(h1dec[0]=='y')
   {
     obspower(tpwrd);
     rgpulse(pwHd,one,0.0,0.0);
     txphase(zero);
     delay(2.0e-6);
     obsprgon("waltz16", pwHd, 90.0);	       
     xmtron();
   }

      if ( dm3[B] == 'y' )     /* begins optional 2H decoupling */
        {
          dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
          dec3unblank();
          dec3phase(zero);
          delay(2.0e-6);
          setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
        }

decrgpulse(pwC1,t3,0.0,0.0);
decphase(zero);
/*   xxxxxxxxxxxxxxxxxxxxxx       13Ca EVOLUTION        xxxxxxxxxxxxxxxxxx    */

if (CT_c[0]=='n')  {
  if ((ni>1.0) && (tau1>0.0))          /* total 13C evolution equals d2 exactly */
   {         /* 2.0*pwC1/PI compensates for evolution at 64% rate duting pwC1 */
	decpwrf(rf9);
     if(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 0.5*pwZ > 0.0)
	   {
	delay(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 0.5*pwZ);
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC9", "", 0.0, pwC9a, 2.0*pwN, zero, zero, zero,
								      0.0, 0.0);
	initval(phshift9, v9);
	decstepsize(1.0);
	dcplrphase(v9);  				        /* SAPS_DELAY */
	delay(tau1 - 2.0*pwC1/PI  - SAPS_DELAY - 0.5*pwZ - 2.0e-6);
	   }
      else
	   {
	initval(180.0, v9);
	decstepsize(1.0);
	dcplrphase(v9);  				        /* SAPS_DELAY */
	delay(2.0*tau1 - 4.0*pwC1/PI - SAPS_DELAY - 2.0e-6);
	   }
   }

  else if (ni==1.0)         /* special 1D check of pwC9 phase enabled when ni=1 */
    {
	decpwrf(rf9);
	delay(10.0e-6 + SAPS_DELAY + 0.5*pwZ1);
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC9", "", 0.0, pwC9, 2.0*pwN, zero, zero, zero,
							          2.0e-6, 0.0);
	initval(phshift9, v9);
	decstepsize(1.0);
	dcplrphase(v9);  					/* SAPS_DELAY */
	delay(10.0e-6 + WFG3_START_DELAY + 0.5*pwZ1);
     }

  else			       /* 13Ca evolution refocused for 1st increment  */
    {
	decpwrf(rf2);
	decrgpulse(pwC2, zero, 2.0e-6, 0.0);
     }

}

else {   /* %%%%%%%%%%STARTING 13Ca Constant Time EVOLUTION %%%%%%%%%%%%%%%%%%*/
    decpwrf(rf9);
    if(tau1 - 2.0*pwC1/PI - WFG_START_DELAY -POWER_DELAY> 0.0) {
       delay(tau1 -2.0*pwC1/PI -POWER_DELAY -WFG_START_DELAY);
       sim3shaped_pulse("","offC9","",0.0,pwC9a, 2.0*pwN, zero, zero, zero, 
								0.0, 0.0);
    }
    else {
       sim3shaped_pulse("","offC9","",0.0,pwC9a, 2.0*pwN, zero, zero, zero, 
								0.0, 0.0);
    }
    if (h1dec[0]=='n'){
      delay(taud-POWER_DELAY);
      obspower(tpwr);
      rgpulse(2.0*pw,zero,0.0,0.0);
        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           delay(timeTC -pwZ -2.0*WFG_STOP_DELAY -taud -2.0*pw -1/dmf3 -2.0e-6 -202.0e-6 -gt7);
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           }
      else{				       /* Should be forbidden?? */
        delay(timeTC -pwZ -WFG_STOP_DELAY -taud -2.0*pw -202.0e-6 -gt7);
      } 
    }
    else {						/*  hdec=y    */
        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           delay(timeTC -pwZ -2.0*WFG_STOP_DELAY -PRG_STOP_DELAY -pwHd -1/dmf3
						-4.0e-6-202.0e-6-gt7);
           xmtroff();
           obsprgoff();
           rgpulse(pwHd,three,2.0e-6,2.0e-6);
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           }
      else{
        delay(timeTC -pwZ -WFG_STOP_DELAY -PRG_STOP_DELAY -4.0e-6 -202.0e-6
								-gt7);
        xmtroff();     
        obsprgoff();   
        rgpulse(pwHd,three,2.0e-6,2.0e-6);
     }
  }

    delay(2.0e-6);
    zgradpulse(gzlvl7,gt7);
    delay(200.0e-6-POWER_DELAY);
    decpwrf(rf2);

    decrgpulse(pwC2, zero, 0.0, 0.0); 	             /* 13Ca 180 degree pulse */ 

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

    if (h1dec[0]=='n') {
      if ( dm3[B] == 'y' )     /* begins optional 2H decoupling */
        {
          dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
          dec3unblank();
          dec3phase(zero);
          delay(2.0e-6);
          setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
        delay(timeTC-tau1-202.0e-6-gt7-2.0*WFG_START_DELAY-1/dmf3-
	  2.0*POWER_DELAY-pwC9a-2.0e-6-WFG_STOP_DELAY-SAPS_DELAY);
        }
      else{                                            /* Should be forbidden??? */
        delay(timeTC -tau1 - 202.0e-6 - gt7-2.0*POWER_DELAY-pwC9a-
	  WFG_START_DELAY-WFG_STOP_DELAY-2.0e-6-SAPS_DELAY);
      }
    }
    else {
      if (dm3[B]=='y') {
	rgpulse(pwHd,one,0.0,0.0);
        txphase(zero);
        delay(2.0e-6);
        obsprgon("waltz16", pwHd, 90.0);
        xmtron();

          dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
          dec3unblank();
          dec3phase(zero);
          delay(2.0e-6);
          setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
        delay(timeTC-tau1-202.0e-6-gt7-2.0*WFG_START_DELAY-4.0e-6-1/dmf3-pwHd-
	           PRG_START_DELAY-2.0*POWER_DELAY-pwC9a-2.0e-6-SAPS_DELAY);
      }
      else {
        delay(2.0e-6);
        rgpulse(pwHd,one,0.0,0.0);
        txphase(zero);
        delay(2.0e-6);
        obsprgon("waltz16", pwHd, 90.0);
        xmtron();
        delay(timeTC-tau1-202.0e-6-gt7-4.0e-6-pwHd-PRG_START_DELAY-
	  2.0*POWER_DELAY-pwC9a-WFG_START_DELAY-WFG_STOP_DELAY-SAPS_DELAY);
      }
    }
    decpwrf(rf9);

    decshaped_pulse("offC9",pwC9a,zero,0.0,0.0); 
    initval(phshift9, v9);
    decstepsize(1.0);
    dcplrphase(v9);                                         /* SAPS_DELAY */

}  /* %%%%%%%%%%%%%%%%%%ENDING 13Ca Constant Time EVOLUTION %%%%%%%%%%%%%%%%%%*/


  decphase(t5);
  decpwrf(rf1);
  decrgpulse(pwC1, t5, 2.0e-6, 0.0);

  dec2phase(t8);
  dcplrphase(zero);

        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           lk_autotrig();   /* resumes lock pulsing */
           }
  if (h1dec[0]=='y')
  {
    xmtroff();
    obsprgoff();
    rgpulse(pwHd,three,2.0e-6,0.0);
    txphase(one);
  }

  delay(2.0e-6);
  zgradpulse(gzlvl4, gt4);
  delay(2.0e-4);
  if (TROSY[A]=='n') {
    rgpulse(pwHd,one,0.0,0.0);
    txphase(zero);
    delay(2.0e-6);
    obsprgon("waltz16", pwHd, 90.0);
    xmtron();
  }

/* %%%%%%%%%%%%%%%%%%STARTING N15 Constant Time Evolution %%%%%%%%%%%%%%%%%%*/

	dec2rgpulse(pwN, t8, 0.0, 0.0);

	decphase(zero);
	dec2phase(t9);
	decpwrf(rf2);
	delay(timeTN - tau2);

	sim3pulse(0.0, pwC2, 2.0*pwN, zero, zero, t9, 0.0, 0.0);

	dec2phase(t10);
        decpwrf(rf9);

if (TROSY[A]=='y')
{    if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.5e-4 + pwHs)
	{
	  txphase(three);
          delay(timeTN - pwC9a - WFG_START_DELAY);         /* WFG_START_DELAY */
          decshaped_pulse("offC9", pwC9a, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')  magradpulse(gzcal*gzlvl1, gt1);
          else  zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(0.5e-4 - POWER_DELAY);
	}

    else if (tau2 > pwHs + 0.5e-4)
	{
	  txphase(three);
          delay(timeTN-pwC9a-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(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                     /* WFG_START_DELAY */
          decshaped_pulse("offC9", pwC9a, zero, 0.0, 0.0);
          delay(tau2 - pwHs - 0.5e-4);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(0.5e-4 - POWER_DELAY);
	}
    else
	{
	  txphase(three);
          delay(timeTN - pwC9a - WFG_START_DELAY - gt1 - 2.0*GRADIENT_DELAY
							    - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else  zgradpulse(gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                     /* WFG_START_DELAY */
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(0.5e-4 - POWER_DELAY);
          decshaped_pulse("offC9", pwC9a, zero, 0.0, 0.0);
          delay(tau2);
	}
}
else
{
    if (tau2 > kappa)
	{
          delay(timeTN - pwC9a - WFG_START_DELAY);     	   /* WFG_START_DELAY */
          decshaped_pulse("offC9", pwC9a, 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 - pwC9a - 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("offC9", pwC9a, zero, 0.0, 0.0);
          delay(kappa -pwC9a -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 - pwC9a - WFG_START_DELAY);   /* WFG_START_DELAY */
          decshaped_pulse("offC9", pwC9a, 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-pwC9a-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("offC9", pwC9a, zero, 0.0, 0.0);
          delay(tau2);
	}
}                                                          
/*  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(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);
	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 +gstab - 0.5*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);

	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);            /* 2.0*GRADIENT_DELAY */

        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4 - rof1);
   if (dm3[B]=='y') lk_sample();

	setreceiver(t12);
}		 
Example #3
0
pulsesequence()
{
   char   CT_flg[MAXSTR],	/* Constant time flag */
          shname1[MAXSTR],
	  shname2[MAXSTR],
	  shname3[MAXSTR],
	  f1180[MAXSTR],
          Cdecflg[MAXSTR],
          Cdecseq[MAXSTR],
          grad_flg[MAXSTR];     /*gradient flag */

   int    t1_counter,
          phase;


   double d2_init=0.0,
          adjust = getval("adjust"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gt1 = getval("gt1"),
          gt2 = getval("gt2"),
          shlvl1 = getval("shlvl1"),
          shlvl2 = getval("shlvl2"),
          shlvl3 = getval("shlvl3"),
          shdmf2 = getval("shdmf2"),
          shpw1 = getval("shpw1"),
          shpw2 = getval("shpw2"),
          shpw3 = getval("shpw3"),
	  pwClvl = getval("pwClvl"),
          pwC = getval("pwC"),
          dpwr = getval("dpwr"),
          CT_delay = getval("CT_delay"),
          d2 = getval("d2"),
          tau1 = getval("tau1"),
          tauch = getval("tauch");


   getstr("shname1", shname1);
   getstr("shname2", shname2);
   getstr("shname3", shname3);
   getstr("CT_flg", CT_flg);
   getstr("grad_flg",grad_flg);
   getstr("f1180",f1180);
   getstr("Cdecflg",Cdecflg);
   getstr("Cdecseq",Cdecseq);


  phase = (int) (getval("phase") + 0.5);
   
   settable(t1,2,phi1);
   settable(t2,2,phi2);


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

    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;
  
    if (f1180[0] == 'y')  tau1 = tau1-pwC*4.0/3.0;

if(CT_flg[0] == 'y')
 {
     if ( (ni/sw1) > (CT_delay-pwC*8.0/3.0))
  { text_error( " ni is too big. Make ni equal to %d or less.\n",
      ((int)((CT_delay-pwC*8.0/3.0)*sw1)) );                psg_abort(1); }
 } 


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


   status(A);

   decpower(pwClvl);
   decoffset(dof);
   obsoffset(tof);

   zgradpulse(gzlvl2, gt2);
   lk_sample();
   delay(1.0e-4);
   delay(d1-gt2);
   if (ix < (int)(2.0*ni)) lk_hold(); /*force lock sampling at end of experiment*/

   obspower(shlvl1);
   shaped_pulse(shname1,shpw1,zero,2.0e-4,2.0e-6);
   zgradpulse(gzlvl1, gt1);
   delay(1.0e-4);

  if (ni == 0)
  {
       delay(tauch-gt1-1.0e-4-WFG_START_DELAY+pwC*4.0-adjust);
       obspower(shlvl2);
     shaped_pulse(shname2,shpw2,zero,2.0e-6,2.0e-6);
       obspower(shlvl1);
     decrgpulse(pwC,t1,0.0,0.0);
     decrgpulse(pwC*2.0,zero,0.0,0.0);
     decrgpulse(pwC,zero,0.0,0.0);
  }

else
  {
  delay(tauch-gt1-1.0e-4-adjust);
  obspower(shlvl2);
  status(B);

  if(CT_flg[0] == 'y')
   {
    /*************************************************/
    /****           CT EVOLUTION            **********/
    /*************************************************/

     decrgpulse(pwC,t1,0.0,0.0);
     delay((CT_delay-tau1)*0.25-pwC*2.0/3.0);
     decpower(shlvl3);
     decshaped_pulse(shname3,shpw3,zero,0.0,0.0);
     delay((CT_delay+tau1)*0.25-shpw2*0.5);
     shapedpulse(shname2,shpw2,zero,0.0,0.0);
     delay((CT_delay+tau1)*0.25-shpw2*0.5);
     decshaped_pulse(shname3,shpw3,zero,0.0,0.0);
     decpower(pwClvl);
     delay((CT_delay-tau1)*0.25-pwC*2.0/3.0);
     decrgpulse(pwC,zero,0.0,0.0);
    }
   
   else
   {
    /*************************************************/
    /****     REAL-TIME EVOLUTION           **********/
    /*************************************************/
     if ((tau1) > shpw2)
    {
     decrgpulse(pwC,t1,0.0,0.0);
      if(Cdecflg[0] == 'y')
      {
      decpower(getval("Cdecpwr"));
      decprgon(Cdecseq, 1.0/getval("Cdecdmf"), getval("Cdecres"));
      decon();
      }
     delay((tau1-shpw2)*0.5);

    xmtrphase(zero);
    xmtron();
    obsunblank();
    obsprgon(shname2,1/shdmf2,9.0);
    delay(shpw2);
    obsprgoff();
    obsblank();
    xmtroff();

     delay((tau1-shpw2)*0.5);
      if(Cdecflg[0] == 'y')
      {
      decoff(); decprgoff();
      decpower(pwClvl);
      }
     decrgpulse(pwC,zero,0.0,0.0);
    }
   else
    {
    xmtrphase(zero);
    xmtron();
    obsunblank();
    obsprgon(shname2,1/shdmf2,9.0);
    delay((shpw2-tau1-pwC*2.0)*0.5);

    decrgpulse(pwC,t1,0.0,0.0);
      if(Cdecflg[0] == 'y')
      {
      decpower(getval("Cdecpwr"));
      decprgon(Cdecseq, 1.0/getval("Cdecdmf"), getval("Cdecres"));
      decon();
      delay(tau1);
      decoff(); decprgoff();
      decpower(pwClvl);
      }
    else
      delay(tau1);
    decrgpulse(pwC,zero,0.0,0.0);
    delay((shpw2-tau1-pwC*2.0)*0.5);
    obsprgoff();
    obsblank();
    xmtroff();
    }
  }

       obspower(shlvl1);
   status(A);


           zgradpulse(gzlvl1, gt1);
           delay(1.0e-4);
       delay(tauch-gt1-1.0e-4-POWER_DELAY);

   decpower(dpwr);

   status(C);
   setreceiver(t2);

}
}
Example #4
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 */
 
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      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 */

/* 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 */
   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 */
   bw, ofs, ppm,  /* bandwidth, offset, ppm - temporary Pbox parameters */

   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 for pwHs pulse          */
   	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"),
	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);



/*   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) ;                              /* 7.5 kHz rf   */
	  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);
          bw = 2.8*7500.0;
          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 (pwC3a > 2.0*pwN) pwZ = pwC3a; else pwZ = 2.0*pwN;
       phshift3=0.0;
       if(pwC3 > 0) phshift3 = 48.0;

/* CHECK VALIDITY OF PARAMETER RANGES */

    if ( 0.5*ni2*1/(sw2) > timeTN - pwC3a - 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);} 
 

/* 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') 
	{ tau1 += ( 1.0 / (2.0*sw1) ); if(tau1 < 0.2e-6) tau1 = 0.0; }
    tau1 = tau1/2.0;


/*  Set up f2180  */

    tau2 = d3;
    if(f2180[A] == 'y') 
	{ 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);

    if (tpwrsf < 4095.0) obspwrf(tpwrsf);
    obspower(tpwrs);
    txphase(two);
    shaped_pulse("H2Osinc", pwHs, two, 2.0e-6, 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);
    rgpulse(pwHd,one,0.0,0.0);
    txphase(zero);
    delay(2.0e-6);
    obsprgon("waltz16", pwHd, 90.0);	          /* PRG_START_DELAY */
    xmtron();
/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION        xxxxxxxxxxxxxxxxxx    */

   decshaped_pulse("offC6", pwC6, t3, 1.0e-6, 0.0);
   decphase(zero);


   if((tau1 - 2.0*pwC6/3.14 - WFG3_START_DELAY - 0.5*pwZ - POWER_DELAY) > SAPS_DELAY)
   {
      decpwrf(rf3);
      delay(tau1 - 2.0*pwC6/3.14 - WFG3_START_DELAY - 0.5*pwZ - POWER_DELAY);
      sim3shaped_pulse("", "offC3", "", 0.0, pwC3a, 2.0*pwN, zero, zero, zero,0.0,0.0);
      initval(phshift3, v3);
      decstepsize(1.0);
      dcplrphase(v3);  				        /* SAPS_DELAY */
      decpwrf(rf6);
      decphase(t5);
      delay(tau1 - 2.0*pwC6/3.14 - SAPS_DELAY - 0.5*pwZ- WFG3_START_DELAY - POWER_DELAY);
   }
   else
   {
       decpwrf(rf8);
       decshaped_pulse("offC8", pwC8, zero, 2.0e-6, 0.0);
       decpwrf(rf6);
       decphase(t5);
       delay(2.0e-6);
   }

   decshaped_pulse("offC6", pwC6, t5, 0.5e-6, 1.0e-6);
   xmtroff();
   obsprgoff();
   rgpulse(pwHd,three,2.0e-6,0.0);

/*  xxxxxxxxxxxxxxxxxx    N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

   dec2phase(t8);
   zgradpulse(gzlvl4, gt4);
   dcplrphase(zero);
   obspower(tpwr);
   delay(2.0e-4);

   dec2rgpulse(pwN, t8, 0.0, 0.0);
   decpwrf(rf3);
   decphase(zero);
   delay((timeTN - tau2 - pwC3a)/2.0);
   decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);

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

   delay((timeTN + tau2 - pwC3a)/2.0);
   decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
   delay((timeTN + tau2 - pwC3a)/2.0 - 2.75e-3 - 2.0*pw);
   rgpulse(2.0*pw,zero, 0.0, 0.0);
   if (mag_flg[A]=='y')   
   {
        magradpulse(gzcal*gzlvl1, gt1);
   }
   else
   {
        zgradpulse(gzlvl1, gt1);  
        delay(4.0*GRADIENT_DELAY);
   }
   txphase(t4);
   delay(2.75e-3 - gt1 - 6.0*GRADIENT_DELAY);     

/*  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);

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

   rgpulse(pw, zero, 0.0, 0.0); 

   delay((gt1/10.0) + 1.0e-4 - 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 */
   rcvron();
statusdelay(C,1.0e-4);

	setreceiver(t12);
}		 
Example #5
0
void 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];			    /* do TROSY on N15 and H1 */
 
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 */
	    ni = getval("ni"),
	    ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
	    tauCH = getval("tauCH"), 		         /* 1/4J delay for CH */
	    zeta = getval("zeta"),   /* zeta delay, 0.006 for 1D, 0.011 for 2D*/
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    timeCH = 1.1e-3,				      /* other delays */
	    timeAB = 3.3e-3,
	    kappa = 5.4e-3,
	    lambda = 2.4e-3,
            csa, sna,
            pra = M_PI*getval("pra")/180.0,
        bw, ofs, ppm,                            /* temporary Pbox parameters */            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	rf0,            	  /* maximum fine power when using pwC pulses */

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

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

/* the following pulse lengths for SLP pulses are automatically calculated    */
/* by the macro "biocal".  SLP pulse shapes, "offC7" etc are called       */
/* directly from your shapelib.                    			      */
   pwC7,                     /* 180 degree selective sinc pulse on CO(174ppm) */
   rf7,	                           /* fine power for the pwC7 ("offC7") pulse */

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

   	pwH,	    		        /* H1 90 degree pulse length at tpwr1 */
   	tpwr1,	  	                     /* 9.2 kHz rf magnet for DIPSI-2 */
   	DIPSI2time,     	        /* total length of DIPSI-2 decoupling */
        ncyc_dec,
        waltzB1=getval("waltzB1"),

	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);
 
    csa = cos(pra);
    sna = sin(pra);


/*   LOAD PHASE TABLE    */

	settable(t3,1,phx);
	settable(t4,1,phx);
   if (TROSY[A]=='y')
       {settable(t8,2,phi8T);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,2,recT);}
    else
       {settable(t8,2,phi8);
	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); }
 
    /* set zeta to 6ms for 1D spectral check, otherwise it will be the    */
    /* value in the dg2 parameter set (about 11ms) for 2D/13C and 3D work */
        if (ni>1)  zeta = zeta;
	else  zeta = 0.006;
	
    /* maximum fine power for pwC pulses */
	rf0 = 4095.0;

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

      if (autocal[0] == 'n') 
      {
    /* 90 degree pulse on Cab, null at CO 128ppm away */
	pwC1 = sqrt(15.0)/(4.0*128.0*dfrq);
        rf1 = 4095.0*(compC*pwC/pwC1);
	rf1 = (int) (rf1 + 0.5);
	
    /* 180 degree pulse on Cab, null at CO 128ppm away */
        pwC2 = sqrt(3.0)/(2.0*128.0*dfrq);
	rf2 = (4095.0*compC*pwC*2.0)/pwC2;
	rf2 = (int) (rf2 + 0.5);	
	if( rf2 > 4295 )
       { printf("increase pwClvl"); psg_abort(1);}
	if(( rf2 < 4296 ) && (rf2>4095)) rf2=4095;
	
    /* 180 degree one-lobe sinc pulse on CO, null at Ca 118m away */
        pwC7 = getval("pwC7");
	rf7 = (compC*4095.0*pwC*2.0*1.65)/pwC7;	/* needs 1.65 times more     */
	rf7 = (int) (rf7 + 0.5);		/* 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 = 128.0*ppm; ofs = bw;           
          offC1 = pbox_Rcal("square90n", bw, compC*pwC, pwClvl);
          offC2 = pbox_Rcal("square180n", bw, compC*pwC, pwClvl); 
          bw = 118.0*ppm; 
          offC7 = pbox_make("offC7", "sinc180n", bw, ofs, compC*pwC, pwClvl);
          if (dm3[B] == 'y') H2ofs = 3.2;     
          ofs_check(H1ofs, C13ofs, N15ofs, H2ofs); 
        }
        pwC1 = offC1.pw; rf1 = offC1.pwrf;
        pwC2 = offC2.pw; rf2 = offC2.pwrf;
        pwC7 = offC7.pw; rf7 = offC7.pwrf;  

   /* Example of semi-automatic calibration - use parameters, if they exist : 

        if ((autocal[0] == 's') || (autocal[1] == 's'))       
        { 
          if (find("pwC1") > 0) pwC1 = getval("pwC1");
          if (find("rf1") > 0) rf1 = getval("rf1");
        }
   */
      }	
	
    /* power level and pulse times for DIPSI 1H decoupling */
	DIPSI2time = 2.0*zeta + 2.0*timeTN - 5.4e-3 + pwC1 + 5.0*pwN + gt3 + 5.0e-5 + 2.0*GRADIENT_DELAY + 3.0*POWER_DELAY;
        pwH=1.0/(4.0*waltzB1);

	ncyc_dec = (DIPSI2time*90.0)/(pwH*2590.0*4.0);
        ncyc_dec = (int) (ncyc_dec +0.5);

	pwH = (DIPSI2time*90.0)/(ncyc_dec*2590.0*4.0);   /* adjust pwH  */
	tpwr1 = 4095.0*(compH*pw/pwH);
	tpwr1 = (int) (2.0*tpwr1 + 0.5);  /* x2 because obs atten will be reduced by 6dB  */
 
/* CHECK VALIDITY OF PARAMETER RANGES */

    if ( 0.5*ni*1/(sw1) > timeAB - gt4 - WFG_START_DELAY - pwC7 )
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((timeAB - gt4 - WFG_START_DELAY - pwC7)*2.0*sw1))); psg_abort(1);}
    PRexp = 0;
    if((pra > 0.0) && (pra < 90.0)) PRexp = 1;

    if (PRexp) 
    {
      if( 0.5*ni*sna/sw1 > timeTN - WFG3_START_DELAY)
        { printf(" ni is too big. Make ni equal to %d or less.\n",
        ((int)((timeTN - WFG3_START_DELAY)*2.0*sw1/sna))); psg_abort(1);}
    }
    else 
    {
      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 ( dm3[A] == 'y' || dm3[C] == 'y' )
       { printf("incorrect dec3 decoupler flags! Should be 'nyn' or 'nnn' ");
							             psg_abort(1);}
    if ( dpwr2 > 50 )
       { printf("dpwr2 too large! recheck value  "); psg_abort(1);}

    if ( pw > 20.0e-6 )
       { printf(" pw too long ! recheck value "); psg_abort(1);} 
  
    if ( pwN > 100.0e-6 )
       { printf(" pwN too long! recheck value "); psg_abort(1);} 
 
    if ( TROSY[A]=='y' && dm2[C] == 'y')
       { text_error("Choose either TROSY='n' or dm2='n' ! "); psg_abort(1);}


/* PHASES AND INCREMENTED TIMES */

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

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


/*  Set up f1180  */
   
    
    if(PRexp)                /* set up Projection-Reconstruction experiment */
      tau1 = d2*csa;
    else
      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;


/*  Set up f2180  */

    if(PRexp)
      tau2 = d2*sna;
    else
    {
      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 ACTUAL PULSE SEQUENCE */

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

	rcvroff();
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rf0);
	obsoffset(tof);
	txphase(zero);
   	delay(1.0e-5);
        if (TROSY[A] == 'n')
	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);
        if (TROSY[A] == 'n')
	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 */

   	decphase(zero);
	zgradpulse(gzlvl0, gt0);
	delay(tauCH - gt0);

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

   	txphase(one);
	decphase(t3);
	zgradpulse(gzlvl0, gt0);
	delay(tauCH - gt0);

   	rgpulse(pw, one, 0.0, 0.0);
	zgradpulse(gzlvl3, gt3);
	delay(2.0e-4);
      if ( dm3[B] == 'y' )     /* begins optional 2H decoupling */
        {
          gt4=0.0;             /* no gradients during 2H decoupling */
          dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
          dec3unblank();
          dec3phase(zero);
          delay(2.0e-6);
          setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
        }
   	decrgpulse(pwC, t3, 0.0, 0.0);                         	
								/* point a */	
	txphase(zero);
	decphase(zero);
        decpwrf(rf7);
     	delay(tau1);

						        /*  WFG3_START_DELAY  */
	sim3shaped_pulse("", "offC7", "", 0.0, pwC7, 2.0*pwN, zero, zero, zero, 
								     0.0, 0.0);

	zgradpulse(gzlvl4, gt4);
        decpwrf(rf2);	
        if ( pwC7 > 2.0*pwN)
     	   {delay(timeCH - pwC7 - gt4 - WFG3_START_DELAY - 2.0*pw);}
        else
     	   {delay(timeCH - 2.0*pwN - gt4 - WFG3_START_DELAY - 2.0*pw);}

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

     	delay(timeAB - timeCH);

     	decrgpulse(pwC2, zero, 0.0, 0.0);

	zgradpulse(gzlvl4, gt4);
        decpwrf(rf7);
     	delay(timeAB - tau1 - gt4 - WFG_START_DELAY - pwC7 - 2.0e-6);

 							/*  WFG_START_DELAY   */
     	decshaped_pulse("offC7", pwC7, zero, 0.0, 0.0);
                                                              
	decpwrf(rf1);					       	/* point b */
   	decrgpulse(pwC1, zero, 2.0e-6, 0.0);                   		
	obspwrf(tpwr1); obspower(tpwr-6);				       /* POWER_DELAY */
	obsprgon("dipsi2", pwH, 5.0);		           /* PRG_START_DELAY */
	xmtron();
								/* point c */
	dec2phase(zero);
	decpwrf(rf2);
	delay(zeta - POWER_DELAY - PRG_START_DELAY);

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

	decpwrf(rf1);
	dec2phase(t8);
	delay(zeta);
								/* point d */
	decrgpulse(pwC1, zero, 0.0, 0.0);                        
        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           lk_autotrig();   /* resumes lock pulsing */
           }

/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

	zgradpulse(gzlvl3, gt3);
        if (TROSY[A]=='y') { xmtroff(); obsprgoff(); }
 	delay(2.0e-4);
	dec2rgpulse(pwN, t8, 0.0, 0.0);
								/* point e */

	decpwrf(rf2);
	decphase(zero);
	dec2phase(t9);
	delay(timeTN - WFG3_START_DELAY - tau2);
							 /* WFG3_START_DELAY  */
	sim3pulse(0.0, pwC2, 2.0*pwN, zero, zero, t9, 0.0, 0.0);

	dec2phase(t10);
        decpwrf(rf7);

if (TROSY[A]=='y')
{
    if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
	{
	  txphase(t4);
          delay(timeTN - pwC7 - WFG_START_DELAY);          /* WFG_START_DELAY */
          decshaped_pulse("offC7", pwC7, 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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);
	}
    else
	{
	  txphase(t4);
          delay(timeTN -pwC7 -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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);                    /* WFG_START_DELAY */
          decshaped_pulse("offC7", pwC7, zero, 0.0, 0.0);
          delay(tau2);
	}
}
else
{
    if (tau2 > kappa)
	{
          delay(timeTN - pwC7 - WFG_START_DELAY);     	   /* WFG_START_DELAY */
          decshaped_pulse("offC7", pwC7, zero, 0.0, 0.0);
          delay(tau2 - kappa - PRG_STOP_DELAY);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);
	}
    else if (tau2 > (kappa - pwC7 - WFG_START_DELAY))
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  txphase(t4);                                     /* WFG_START_DELAY */
          decshaped_pulse("offC7", pwC7, zero, 0.0, 0.0);
          delay(kappa -pwC7 -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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);
	}
    else if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  txphase(t4);
          delay(kappa - tau2 - pwC7 - WFG_START_DELAY);    /* WFG_START_DELAY */
          decshaped_pulse("offC7", pwC7, 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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);
	}
    else
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY);
          xmtroff();
	  obsprgoff();					    /* PRG_STOP_DELAY */
	  txphase(t4);
    	  delay(kappa-tau2-pwC7-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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);                    /* WFG_START_DELAY */
          decshaped_pulse("offC7", pwC7, zero, 0.0, 0.0);
          delay(tau2);
	}
}                                                            	/* point f */
/*  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(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);
	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 +gstab - 0.5*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);

	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);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4 - rof1);
   if (dm3[B]=='y') lk_sample();

	setreceiver(t12);
}		 
Example #6
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            mess_flg[MAXSTR], /* water purging */
            ar180a[MAXSTR],   /* waveform shape for aromatic 180 pulse 
                                   with C transmitter at dof  */
            cb180b[MAXSTR],   /* waveform shape for aliphatic 180 pulse 
                                   with C transmitter at dofar   */
            ar180b[MAXSTR];   /* waveform shape for aromatic 180 pulse
                                   with C transmitter at dofar   */
 int         phase, ni, 
             t1_counter;   /* used for states tppi in t1           */ 

 double      tau1,         /*  t1 delay */
             taua,         /*  ~ 1/4JCbHb =  1.7 ms */
             taub,         /*  ~ 1/4JCgCd =  2.7 ms */
             tauc,         /*  ~ 1/4JCgCd =  2.1 ms */
             taud,         /*  ~ 1/4JCdHd =  1.5 ms */
             taue,         /*  = 1/4JCbHb =  1.8 ms */
             tauf,         /*  2(tauc-tauf) ~ 1/2JCdHd =  3.1 ms */
             TCb,          /* carbon constant time period 
                              for recording the Cb chemical shifts    */
             dly_pg1,      /* delay for water purging */
             pwar180a,     /* 180 aro pulse at d_ar180a and dof  */
             pwcb180b,     /* 180 cb pulse at d_cb180b and dofar   */ 
             pwC,          /* 90 c pulse at pwClvl            */
             pwsel90,       /* 90 c pulse at d_sel90 */
             pwar180b,     /* 180 c pulse at d_ar180b */
             compC,        /* C-13 RF calibration parameters */
             compH,
             d_ar180a,
             d_cb180b,
             d_sel90,
             d_ar180b,     
             dofar, 
             tsatpwr,      /* low level 1H trans.power for presat  */
             tpwrmess,     /* power level for water purging */
             tpwrml,       /* power level for 1H decoupling */
             pwmlev,       /* 90 pulse at tpwrml */
             pwClvl,        /* power level for high power 13C pulses on dec1 */ 
             sw1,          /* sweep width in f1                    */
             at,
             gp11,         /* gap between 90-90 for selective 180 of Cb */
             fab,          /* chemical shift difference of Ca-Cb (Hz) */
             gt0,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gstab,
             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7;


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


/* LOAD VARIABLES */


  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("fscuba",fscuba);
  getstr("mess_flg",mess_flg);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  tauc   = getval("tauc"); 
  taud   = getval("taud"); 
  taue   = getval("taue"); 
  tauf   = getval("tauf"); 
  TCb = getval("TCb");
  pwC = getval("pwC");
  dofar = getval("dofar");
  dly_pg1 = getval("dly_pg1");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  tpwrmess = getval("tpwrmess");
  tpwrml = getval("tpwrml");
  pwClvl = getval("pwClvl");
  dpwr = getval("dpwr");
  phase = (int) ( getval("phase") + 0.5);
  sw1 = getval("sw1");
  ni = getval("ni");
  at = getval("at");
  fab = getval("fab");

  if(autocal[0]=='n')
  {     
    getstr("ar180a",ar180a);
    getstr("ar180b",ar180b);
    getstr("cb180b",cb180b);
    pwar180a = getval("pwar180a");
    pwar180b = getval("pwar180b");
    pwcb180b = getval("pwcb180b");
    pwsel90 = getval("pwsel90");
    d_ar180a = getval("d_ar180a");
    d_cb180b = getval("d_cb180b");
    d_ar180b  = getval("d_ar180b");
    d_sel90  = getval("d_sel90");
    pwmlev = getval("pwmlev");
  }
  else
  {    
    strcpy(ar180a,"Pg3_off_cb180a");
    strcpy(ar180b,"Pg3_off_cb180b");    
    strcpy(cb180b,"Pg3_on");
    if (FIRST_FID)
    {
      compC = getval("compC");
      compH = getval("compH");
      sel90 = pbox("cal", SEL90, "", dfrq, compC*pwC, pwClvl);
      ar_180a = pbox(ar180a, AR180a, CB180ps, dfrq, compC*pwC, pwClvl);
      ar_180b = pbox(ar180b, AR180b, CB180ps, dfrq, compC*pwC, pwClvl);
      cb_180b = pbox(cb180b, CB180b, CB180ps, dfrq, compC*pwC, pwClvl);
      w16 = pbox_dec("cal", "WALTZ16", tpwrml, sfrq, compH*pw, tpwr);
    }
    pwsel90 = sel90.pw;      d_sel90 = sel90.pwr;
    pwar180a = ar_180a.pw;   d_ar180a = ar_180a.pwr;
    pwar180b = ar_180b.pw;   d_ar180b = ar_180b.pwr;       
    pwcb180b = cb_180b.pw;   d_cb180b = cb_180b.pwr;  
    pwmlev = 1.0/w16.dmf;
  }   

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

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

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( 0.5*ni*1/(sw1) > TCb - 2*POWER_DELAY 
        - WFG_START_DELAY - pwar180a  - WFG_STOP_DELAY)
    {
        printf(" ni is too big\n");
        psg_abort(1);
    }

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

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

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

    if( tpwrml > 53 )
    {
        printf("tpwrml too large !!!  ");
        psg_abort(1);
    }

    if( tpwrmess > 56 )
    {
        printf("tpwrmess too large !!!  ");
        psg_abort(1);
    }

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

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

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

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

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

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

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

    if (pwsel90 > 100.0e-6)
    {
        printf("dont fry the probe, pwsel90 too long !");
        psg_abort(1);
    }

    if(d_ar180a > 60)
    {
        printf("dont fry the probe, d_ar180a too high !");
        psg_abort(1);
    }

    if(d_cb180b > 60)
    {
        printf("dont fry the probe, d_cb180b too high !");
        psg_abort(1);
    }

    if (d_ar180b > 60)
    {
        printf("dont fry the probe, d_ar180b too high ! ");
        psg_abort(1);
    }

    if (d_sel90 > 50)
    {
        printf("dont fry the probe, d_sel90 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 || gt7 > 15e-3)
    {
        printf("gradients on for too long. Must be < 15e-3 \n");
        psg_abort(1);
    }

    if( fabs(gzlvl0) > 30000 || fabs(gzlvl1) > 30000 || fabs(gzlvl2) > 30000
      ||fabs(gzlvl3) > 30000 || fabs(gzlvl4) > 30000 || fabs(gzlvl5) > 30000
      ||fabs(gzlvl6) > 30000 || fabs(gzlvl7) > 30000)
    {
        printf("too strong gradient");
        psg_abort(1);
    }


    if( 2*TCb - taue > 0.1 )
    {
        printf("dont fry the probe, too long TCb");
        psg_abort(1);
    }

    if( at > 0.1 && (dm[C]=='y' || dm2[C]=='y'))
    {
        printf("dont fry the probe, too long at with decoupling");
        psg_abort(1);
    }

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

    if( dly_pg1 > 10.0e-3)
    {
        printf("dont fry the probe, too long dly_pg1");
        psg_abort(1);
    }

    


/*  Phase incrementation for hypercomplex 2D data */

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

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

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

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

/*  90-90 pulse for selective 180 of Cb but not Ca */

    gp11 = 1/(2*fab) - 4/PI*pwsel90;
    if (gp11 < 0.0) {
        printf("gap of 90-90 negative, check fab and pwsel90");
        psg_abort(1);
    }


/* BEGIN ACTUAL PULSE SEQUENCE */

/* Receiver off time */

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

/* Presaturation Period */

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

     obspower(tpwrmess);
     rgpulse(dly_pg1,zero,20.0e-6,20.0e-6);
     rgpulse(dly_pg1/1.62,one,20.0e-6,20.0e-6);
     obspower(tsatpwr);

  }

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

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

/* Begin Pulses */

   rcvroff();
   delay(10.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(gzlvl0,gt0);
   delay(gstab);


/* this is the real start */

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

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

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

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

   txphase(t1);

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

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

   rgpulse(pw,t1,0.0,0.0);

   txphase(zero);

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

   decphase(t2);
   decpower(d_sel90);
   decrgpulse(pwsel90,t2,2.0e-6,0.0);

   decphase(zero);
   decpower(d_ar180a);
   decshaped_pulse(ar180a,pwar180a,zero,2.0e-6,0.0);  /* bs effect */

   delay(taue 
     - POWER_DELAY - 2.0e-6 - WFG_START_DELAY - pwar180a - WFG_STOP_DELAY
     - POWER_DELAY - PRG_START_DELAY);

   /* H decoupling on */
   obspower(tpwrml);
   obsprgon("waltz16",pwmlev,90.0);
   xmtron();    /* TURN ME OFF  DONT FORGET  */
   /* Hldecoupling on */
   
   delay(TCb + tau1 - taue - POWER_DELAY - 2.0e-6);

   decphase(t3);

   decpower(d_sel90);
   decrgpulse(pwsel90,t3,2.0e-6,0.0);
   delay(gp11);
   decrgpulse(pwsel90,t3,0.0,0.0);

   decphase(zero);
   decpower(d_ar180a);
   decshaped_pulse(ar180a,pwar180a,zero,2.0e-6,0.0); 

   delay(TCb - tau1
     - POWER_DELAY - WFG_START_DELAY - 2.0e-6 - pwar180a - WFG_STOP_DELAY
     - POWER_DELAY - 2.0e-6);
   
   decphase(zero);
   decpower(d_sel90);
   decrgpulse(pwsel90,zero,2.0e-6,0.0);

   /* H decoupling off */
   xmtroff();
   obsprgoff();
   obspower(tpwr);
   /* H decoupling off */

   decoffset(dofar);

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

   decphase(t4);
   decpower(d_sel90); 
   decrgpulse(pwsel90,t4,2.0e-6,0.0);

   decphase(zero);
   decpower(d_cb180b);
   decshaped_pulse(cb180b,pwcb180b,zero,2.0e-6,0.0);   /* B.S. */

   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(2.0e-6);
   
   delay(taub 
     - POWER_DELAY - WFG_START_DELAY - 2.0e-6 - pwcb180b - WFG_STOP_DELAY
     - gt4 - 4.0e-6
     - POWER_DELAY - WFG_START_DELAY - 2.0e-6);

   decphase(zero);
   decpower(d_ar180b);
   decshaped_pulse(ar180b,pwar180b,zero,2.0e-6,0.0);
 
   decpower(d_cb180b);
   decshaped_pulse(cb180b,pwcb180b,zero,2.0e-6,0.0);
   
   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(2.0e-6);

   delay(taub
     - WFG_STOP_DELAY
     - POWER_DELAY - WFG_START_DELAY - 2.0e-6 - pwcb180b - WFG_STOP_DELAY
     - gt4 - 4.0e-6
     - POWER_DELAY - 2.0e-6);

   decpower(d_sel90);
   decrgpulse(pwsel90,zero,2.0e-6,0.0);

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

   decphase(t5);
   decpower(pwClvl);
   decrgpulse(2*pwC,t5,2.0e-6,0.0);

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

   txphase(zero);
   delay(tauf - gt5 - 102.0e-6);

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

   delay(tauc - tauf - 2*pw
     - POWER_DELAY - 2.0e-6);

   decphase(zero);
   decpower(d_sel90); 
   decrgpulse(pwsel90,zero,2.0e-6,0.0);

   txphase(zero);
   delay(2.0e-6);
   zgradpulse(gzlvl6,gt6);
   delay(gstab);
   
   rgpulse(pw,zero,0.0,0.0);

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

   delay(taud 
     - gt7 - 4.0e-6
     - POWER_DELAY - 2.0e-6);

   decphase(zero);
   decpower(pwClvl);
   simpulse(2*pw,2*pwC,zero,zero,2.0e-6,0.0);

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

   delay(taud 
     - gt7 - 4.0e-6
     - 2*POWER_DELAY);

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

   rgpulse(pw,zero,0.0,0.0);  
    
/*   rcvron();  */          /* Turn on receiver to warm up before acq */ 

/* BEGIN ACQUISITION */

status(C);
setreceiver(t6);

}
Example #7
0
pulsesequence()
{
 char    
    f1180[MAXSTR],    
    f2180[MAXSTR],
    mag_flg[MAXSTR];  /* y for magic angle, n for z-gradient only  */

 int        
    icosel,
    t1_counter,   
    t2_counter;   

 double      
    ni2,  
    ratio,        /* used to adjust t1 semi-constant time increment */
    tau1,       
    tau2,       
    taua,         /*  ~ 1/4JCH =  1.5 ms - 1.7 ms]        */
    taub,         /*  ~ 3.3 ms          */
    bigTC,        /*  ~ 8 ms            */
    bigTCO,       /*  ~ 6 ms           */
    bigTN,        /*  ~ 12 ms           */
    tauc,         /*  ~ 5.4 ms          */
    taud,         /*  ~ 2.3 ms          */
    gstab,         /*  ~0.2 ms, gradient recovery time     */

    pwClvl,   /* High power level for carbon on channel 2 */
    pwC,      /* C13 90 degree pulse length at pwClvl     */

    compH,     /* Compression factor for H1 on channel 1  */
    compC,     /* Compression factor for C13 on channel 2  */
    pwNlvl,   /* Power level for Nitrogen on channel 3    */
    pwN,      /* N15 90 degree pulse lenght at pwNlvl     */
    maxpwCN,
    bw, ofs, ppm, /* bandwidth, offset, ppm - temporary Pbox parameters */
    pwCa90,   /*90 "offC13" pulse at Ca(56ppm) xmtr at CO(174ppm) */
    pwCa180,  /*180 "offC17" pulse at Ca(56ppm) xmtr at CO(174ppm) */
    pwCO90,   /* 90 "offC6" pulse at CO(174ppm) xmtr at CO(174ppm)*/
    pwCO180,  /* 180 "offC8" pulse at CO(174ppm) xmtr at CO(174ppm)*/
    pwCab180, /* 180 "offC27" pulse at Cab(46ppm) xmtr at CO(174ppm)*/

    tpwrHd,   /* Power level for proton decoupling on channel 1  */
    pwHd,     /* H1 90 degree pulse lenth at tpwrHd.             */
    waltzB1 = getval("waltzB1"),  /* waltz16 field strength (in Hz)     */

    phi_CO,   /* phase correction for Bloch-Siegert effect on CO */
    phi_Ca,   /* phase correction for Bloch-Siegert effect on Ca */

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

    gzlvl1,  
    gzlvl2,   
    gzlvl3,
    gzlvl4, 
    gzlvl5,
    gzlvl6,   /* N15 selection gradient level in DAC units */
    gzlvl7,
    gzlvl0,   /* H1 gradient level in DAC units            */
    gzcal,    /* gradient calibration (gcal)               */
    dfCa180,
    dfCab180,
    dfC90,
    dfCa90,
    dfCO180;
 
         
/* LOAD VARIABLES */

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

    gzcal  = getval("gzcal");
      ni2  = getval("ni2");
    taua   = getval("taua"); 
    taub   = getval("taub");
    tauc = getval("tauc");
    bigTC = getval("bigTC");
    bigTCO = getval("bigTCO");
    bigTN = getval("bigTN");
    taud = getval("taud");
    gstab = getval("gstab");
  
    pwClvl = getval("pwClvl");
    pwC = getval("pwC");
    compH = getval("compH");
    compC = getval("compC");

    pwNlvl = getval("pwNlvl");
    pwN = getval("pwN");

    phi_CO = getval("phi_CO");
    phi_Ca = getval("phi_Ca");

    gt1 = getval("gt1");
    gt2 = getval("gt2");
    gt3 = getval("gt3");
    gt4 = getval("gt4");
    gt5 = getval("gt5");
    gt6 = getval("gt6");
    gt7 = getval("gt7");
    gt0 = getval("gt0");
 
    gzlvl1 = getval("gzlvl1");
    gzlvl2 = getval("gzlvl2");
    gzlvl3 = getval("gzlvl3");
    gzlvl4 = getval("gzlvl4");
    gzlvl5 = getval("gzlvl5");
    gzlvl6 = getval("gzlvl6");
    gzlvl7 = getval("gzlvl7");
    gzlvl0 = getval("gzlvl0");

    setautocal();                        /* activate auto-calibration flags */ 
        
    if (autocal[0] == 'n') 
    { 
      pwCa90 = getval("pwCa90");
      pwCa180 = getval("pwCa180");
      pwCab180 = getval("pwCab180");
      pwCO90 = getval("pwCO90");
      pwCO180 = getval("pwCO180");

      dfCa180 = (compC*4095.0*pwC*2.0*1.69)/pwCa180;           /*power for "offC17" pulse*/
      dfCab180 = (compC*4095.0*pwC*2.0*1.69)/pwCab180;       /*power for "offC27" pulse*/
      dfC90  = (compC*4095.0*pwC*1.69)/pwCO90;                  /*power for "offC6" pulse */
      dfCa90  = (compC*4095.0*pwC)/pwCa90;                     /*power for "offC13" pulse*/
      dfCO180  = (compC*4095.0*pwC*2.0*1.65)/pwCO180;          /*power for "offC8" pulse */

      dfCa90 = (int) (dfCa90 + 0.5);
      dfCa180 = (int) (dfCa180 + 0.5);
      dfC90 = (int) (dfC90 + 0.5);
      dfCO180 = (int) (dfCO180 + 0.5);	
      dfCab180 = (int) (dfCab180 +0.5);

    /* power level and pulse time for WALTZ 1H decoupling */
	pwHd = 1/(4.0 * waltzB1) ;                          
	tpwrHd = tpwr - 20.0*log10(pwHd/(compH*pw));
	tpwrHd = (int) (tpwrHd + 0.5);
    }
    else
    {
      if(FIRST_FID)                                            /* call Pbox */
      {
        ppm = getval("dfrq"); bw = 118.0*ppm; ofs = -118.0*ppm;
        offC6 = pbox_make("offC6", "sinc90n", bw, 0.0, compC*pwC, pwClvl);
        offC8 = pbox_make("offC8", "sinc180n", bw, 0.0, compC*pwC, pwClvl);
        offC17 = pbox_make("offC17", "sinc180n", bw, ofs, compC*pwC, pwClvl);
        bw = 128.0*ppm;
        offC13 = pbox_make("offC13", "square90n", bw, ofs, compC*pwC, pwClvl);
        ofs = -128.0*ppm;
        offC27 = pbox_make("offC27", "sinc180n", bw, ofs, compC*pwC, pwClvl);
        bw = 2.8*7500.0;
        wz16 = pbox_Dcal("WALTZ16", 2.8*waltzB1, 0.0, compH*pw, tpwr);

        ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
      } 
      dfC90 = offC6.pwrf;      pwCO90 = offC6.pw;
      dfCO180 = offC8.pwrf;    pwCO180 = offC8.pw;
      dfCa90 = offC13.pwrf;    pwCa90 = offC13.pw;
      dfCa180 = offC17.pwrf;   pwCa180 = offC17.pw;
      dfCab180 = offC27.pwrf;  pwCab180 = offC27.pw;
      tpwrHd = wz16.pwr;       pwHd = 1.0/wz16.dmf;
    }

    maxpwCN = 2.0*pwN;
    if (pwCab180 > pwN) maxpwCN = pwCab180;

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */
   
    if(ni > 64)
    {
       printf("ni is out of range. Should be: 14 to 64 ! \n");
       psg_abort(1);
    }
/*
    if(ni/sw1 > 2.0*(bigTCO))
    {
       printf("ni is too big, should be < %f\n", sw1*2.0*(bigTCO));
       psg_abort(1);
    }
*/

    if(ni2/sw2 > 2.0*(bigTN - pwCO180))
    {
       printf("ni2 is too big, should be < %f\n",2.0*sw2*(bigTN-pwCO180));
       psg_abort(1);
    }

    if((dm[A] == 'y' || dm[B] == '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( dpwr > 50 )
    {
        printf("don't fry the probe, DPWR too large!  ");
        psg_abort(1);
    }

/*  Phase incrementation for hypercomplex 2D data */

    if (phase1 == 1) 
    {
       tsadd(t1, 1, 4);   
    }

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

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

    ratio = 2.0*bigTCO*sw1/((double) ni);
    ratio = (double)((int)(ratio*100.0))/100.0;
    if (ratio > 1.0) ratio = 1.0;
    if((dps_flag) && (ni > 1)) 
        printf("ratio = %f => %f\n",2.0*bigTCO*sw1/((double) ni), ratio);

/*  Set up f2180  tau2 = t2               */
    tau2 = d3;
    if ((f2180[A] == 'y') && (ni2 > 1))
      { tau2 += (1.0/(2.0*sw2)); }
    if(tau2 < 0.2e-6) tau2 = 0.0;
    tau2 = tau2/4.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(t16,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(t16,2,4);    
    }

    decstepsize(1.0);
    initval(phi_CO, v1);
    initval(phi_Ca, v2);

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   	delay(d1-1.0e-3);
    obsoffset(tof);
    decoffset(dof);
    obspower(tpwr);        
    decpower(pwClvl);
    decpwrf(4095.0);
    dec2power(pwNlvl);
    txphase(zero);
    decphase(zero);
    dec2phase(zero);
    rcvroff();

    if(gt6 > 0.2e-6)
    {
       delay(10.0e-6);
       decrgpulse(pwC, zero, 1.0e-6, 1.0e-6);
       delay(0.2e-6);
       zgradpulse(gzlvl6, gt6);
    }  
    decpwrf(dfCa180); 
    delay(1.0e-3);

    rgpulse(pw,zero,1.0e-6,1.0e-6);            
    delay(2.0e-6);
    zgradpulse(gzlvl0,gt0);  
    delay(taua - gt0 - 2.0e-6 - WFG_START_DELAY);

    simshaped_pulse("","offC17",2.0*pw,pwCa180,zero,zero,1.0e-6,1.0e-6);
      /* c13 offset on CO, slp 180 on Ca */
    delay(taua - gt0 - 500.0e-6 - WFG_STOP_DELAY);
    zgradpulse(gzlvl0,gt0); 
    txphase(one);
    delay(500.0e-6);
    rgpulse(pw, one, 1.0e-6, 1.0e-6);
    decphase(zero);
  
    delay(2.0e-6);
    zgradpulse(gzlvl3,gt3);

    obspower(tpwrHd);
    decpwrf(dfCa90);
    delay(200.0e-6);
   

/* c13 offset on CO, slp 90 on Ca */
    decshaped_pulse("offC13", pwCa90, zero, 0.0, 0.0);
    delay(taub -PRG_START_DELAY);

    obsprgon("waltz16", pwHd, 180.0);
    xmtron();

    decpwrf(dfC90);
    decphase(t1);
    delay(bigTC -taub -SAPS_DELAY -PWRF_DELAY);

/* c13 offset on CO, on-res 90 on CO */
    decshaped_pulse("offC6", pwCO90, t1, 0.0, 0.0);
/* CO EVOLUTION BEGINS */

    decpwrf(dfCO180);
    decphase(zero);
    delay(bigTCO/2.0 +maxpwCN/2.0 +WFG_STOP_DELAY -2.0*pwCO90/PI -ratio*tau1);

/* c13 offset on CO, on-res 180 on CO */
    decshaped_pulse("offC8", pwCO180, zero, 0.0, 0.0);

    decpwrf(dfCab180);
    delay(bigTCO/2.0 +(2.0 -ratio)*tau1 -PRG_STOP_DELAY);
    xmtroff();
    obsprgoff();

/* c13 offset on CO, slp 180 at Cab */
    sim3shaped_pulse("","offC27","",0.0,pwCab180,2.0*pwN,zero,zero,zero,0.0,0.0); 

    obsprgon("waltz16", pwHd, 180.0);
    xmtron();
    decpwrf(dfCO180);
    delay(bigTCO/2.0 +(2.0 -ratio)*tau1 -PRG_START_DELAY);

/* c13 offset on CO, on-res 180 on CO */
    decshaped_pulse("offC8", pwCO180, zero, 0.0, 0.0);

    decpwrf(dfC90);
    dcplrphase(v1);  
    delay(bigTCO/2.0 +maxpwCN/2.0 +WFG_STOP_DELAY -2.0*pwCO90/PI -ratio*tau1 -SAPS_DELAY);

/* CO EVOLUTION ENDS */
    decshaped_pulse("offC6", pwCO90, zero, 0.0, 0.0);
/* c13 offset on CO, on-res 90 on CO */

    decpwrf(dfCa90);
    decphase(t3); dcplrphase(v2);
    delay(bigTC -2.0*SAPS_DELAY -PWRF_DELAY);

/* c13 offset on CO, slp 90 at Ca */
    decshaped_pulse("offC13", pwCa90, t3, 0.0, 0.0);

    xmtroff();

    decpwrf(dfCO180);
    decphase(zero); dcplrphase(zero);
    dec2phase(t2);   

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

    obsprgon("waltz16", pwHd, 180.0);
    xmtron();
    txphase(zero);
    delay(150.0e-6);

    dec2rgpulse(pwN, t2, 0.0, 0.0);
/* N15 EVOLUTION BEGINS HERE */

    delay(bigTN/2.0 -tau2);

    decshaped_pulse("offC8", pwCO180, zero, 0.0, 0.0); /* c13 offset on CO, on-res 180 on CO */

    decpwrf(dfCa180);
    dec2phase(t4);
    delay(bigTN/2.0 -tau2);
 
    dec2rgpulse(2.0*pwN, t4, 0.0, 0.0);
    decshaped_pulse("offC17", pwCa180, zero, 0.0, 0.0); /* c13 offset on CO, slp 180 at Ca */

    decpwrf(dfCO180);
    delay(bigTN/2.0 +tau2 -pwCa180 -WFG_START_DELAY -WFG_STOP_DELAY);

    decshaped_pulse("offC8", pwCO180, zero, 0.0, 0.0);
       /* c13 offset on CO, on-res 180 on CO */

    delay(bigTN/2.0 +tau2 -tauc -PRG_STOP_DELAY);
    dec2phase(t5);
    xmtroff();
    obsprgoff();
    obspower(tpwr);

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

    delay(tauc -gt1 -2.0*GRADIENT_DELAY);
  
/* N15 EVOLUTION ENDS HERE */
    sim3pulse(pw,0.0, pwN, zero,zero, t5, 0.0, 0.0);

    dec2phase(zero);
    delay(2.0e-6);
    zgradpulse(0.8*gzlvl5, gt5);
    delay(taud - gt5 - 2.0e-6);

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

    delay(taud - gt5 - 500.0e-6);
    zgradpulse(0.8*gzlvl5, gt5);
    txphase(one);
    decphase(one);
    delay(500.0e-6);

    sim3pulse(pw,0.0, pwN, one,zero, one, 0.0, 0.0);
    
    delay(2.0e-6);
    txphase(zero);
    decphase(zero);
    zgradpulse(gzlvl5, gt5);
    delay(taud - gt5 - 2.0e-6);
    sim3pulse(2.0*pw,0.0, 2.0*pwN, zero,zero, zero, 0.0, 0.0);
  
    delay(taud - gt5 - 2.0*POWER_DELAY - 500.0e-6);
    zgradpulse(gzlvl5, gt5);
    decpower(dpwr);
    dec2power(dpwr2);
    delay(500.0e-6);

    rgpulse(pw, zero, 0.0, 0.0);

    delay(gstab +gt2 +2.0*GRADIENT_DELAY);

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

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

    delay(0.5*gstab);    

    rcvron();
statusdelay(C, 0.5*gstab);
    setreceiver(t16);
}
Example #8
0
pulsesequence()
{
  double mix = getval("mix"),
	 pw180 = 0.0,
	 tpwr_cf = getval("tpwr_cf"),
         j1xh = getval("j1xh"), 
         hsglvl = getval("hsglvl"),
         hsgt = getval("hsgt"),
         gzlvlE = getval("gzlvlE"),
         gtE = getval("gtE"),
         EDratio = getval("EDratio"),
         gstab = getval("gstab"),
	 pwxlvl = getval("pwxlvl"),
	 pwx = getval("pwx"),
	 taua=getval("taua");       /* asap delay ca 0.3/J */
  char   asap[MAXSTR], adiabatic[MAXSTR],lkgate_flg[MAXSTR],cmd[MAXSTR];
  int    ncycles=0, icosel=1,
         iphase = (int)(getval("phase")+0.5);

  getstr("asap",asap);    
  getstr("adiabatic",adiabatic);    
  getstr("lkgate_flg",lkgate_flg);
  if(j1xh<1.0) j1xh=150.0;
   
  if (FIRST_FID)
  {
    if(adiabatic[A] == 'y')
      ad180 = pbox_ad180("ad180", pwx, pwxlvl);    /* make adiabatic 180 */
    sprintf(cmd, "Pbox wu2mix -u %s -w \"WURST2m 20k/0.4m\" -p %.0f -l %.2f -s 2.0",userdir,
    tpwr, 1.0e6*pw*tpwr_cf);
    system(cmd);
    mixsh = getDsh("wu2mix");
  }

  if(adiabatic[A] == 'y')
    pw180 = ad180.pw;

  ncycles = (int) (0.5 + mix/mixsh.pw);

  if ((0.5/j1xh) < (gtE+gstab))
  {
    text_error("0.5/1jxh must be greater than gtE+gstab\n");
    psg_abort(1);
  }

  settable(t1,2,ph1);
  settable(t2,4,ph2);
  settable(t3,4,ph3);

  assign(zero,v4);
  getelem(t1,ct,v1);
  getelem(t3,ct,oph);

  if (iphase == 2)
    icosel = -1;

  initval(2.0*(double)((int)(d2*getval("sw1")+0.5)%2),v10); 
  add(v1,v10,v1);
  add(v4,v10,v4);
  add(oph,v10,oph);

  status(A);
  
     if (lkgate_flg[0] == 'y')  lk_hold(); /* turn lock sampling off */
     if (asap[A] == 'y')
     {
        mix = 7.0e-5 + 2.0*POWER_DELAY + 2.0*hsgt + mixsh.pw*ncycles;
        delay(1.0e-5);
        obspower(mixsh.pwr);
        zgradpulse(hsglvl,hsgt);
        delay(5.0e-5);

        obsunblank(); xmtron();
        obsprgon(mixsh.name, 1.0/mixsh.dmf, mixsh.dres);
        delay(mixsh.pw*ncycles);
	obsprgoff(); obsblank();
        xmtroff(); 

           
        delay(1.0e-5);
        zgradpulse(hsglvl,hsgt);
        obspower(tpwr);
        delay(d1 - mix);
      }
      else
      {
        delay(1.0e-5);
        obspower(tpwr);
        zgradpulse(hsglvl,2.0*hsgt);
        rgpulse(pw, zero, rof1, rof1);
        zgradpulse(hsglvl,hsgt);
        rgpulse(pw, one, rof1, rof1);
        zgradpulse(0.5*hsglvl,hsgt);
        delay(d1 - 2.0*hsgt - 4.0*rof1 - 2.0*pw - 1.0e-5 - POWER_DELAY);
      }


   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        if (getflag("slpsat"))
           {
                shaped_satpulse("relaxD",satdly,zero);
                if (getflag("prgflg"))
                   shaped_purge(v6,zero,v18,v19);
           }
        else
           {
                satpulse(satdly,zero,rof1,rof1);
                if (getflag("prgflg"))
                   purge(v6,zero,v18,v19);
           }
     }

   if (getflag("wet"))
     wet4(zero,one);

  status(B);
     decpower(pwxlvl);

      if (asap[0] == 'y')
      {
        rgpulse(pw,zero,rof1,rof1);
        delay(taua/2.0 - pw - 2.0*rof1 + pw180/2.0);
	if(adiabatic[A] == 'y')
	{
          rgpulse(2.0*pw,two,rof1,0.0);
          decshaped_pulse(ad180.name,ad180.pw,zero,0.0,rof1);
	}
	else
          simpulse(2.0*pw,2.0*pwx,two,zero,rof1,rof1); 
        delay(taua/2.0 - pw - 2.0*rof1 - pw180/2.0);
        simpulse(pw,pwx,zero,v1,rof1,1.0e-6);
      }
      else
      {
        rgpulse(pw,zero,rof1,rof1);
        delay(taua - rof1 - (2*pw/PI));
        decrgpulse(pwx,v1,rof1,1.0e-6);
      }
      delay(gtE + 2*gstab + 2*GRADIENT_DELAY - (2*pwx/PI) - pwx - 1.0e-6 - rof1);
      if(adiabatic[A] == 'y')
        decshaped_pulse(ad180.name,ad180.pw,v4,rof1,1.0e-6);
      else
        decrgpulse(2*pwx,v4,rof1,1.0e-6); 
      delay(gstab - pwx - 1.0e-6);
      zgradpulse(gzlvlE,gtE);
      delay(gstab - rof1 - pw);
      delay(d2/2);
      rgpulse(2.0*pw,zero,rof1,rof1);
      delay(d2/2);

      delay(gstab - rof1 - pw);
      zgradpulse(gzlvlE,gtE);
      delay(gstab - pwx - rof1);
      if(adiabatic[A] == 'y')
        decshaped_pulse(ad180.name,ad180.pw,zero,rof1,1.0e-6);
      else
        decrgpulse(2*pwx,zero,rof1,1.0e-6); 
      delay(gtE + 2*gstab + 2*GRADIENT_DELAY - (2*pwx/PI) - pwx - 1.0e-6 - rof1);
      decrgpulse(pwx,t2,rof1,rof1);
      if(asap[0] == 'y')
      {
        delay(0.25/j1xh + ad180.pw/2.0);    
        if(adiabatic[A] == 'y')
	{
          rgpulse(2.0*pw,zero,rof1,0.0);
          decshaped_pulse(ad180.name,ad180.pw,zero,0.0,rof1);
	}
	else
          simpulse(2.0*pw,2.0*pwx,zero,zero,rof1,rof1); 	
        delay(0.1*gstab - rof1);
        if(EDratio > 4)
        {
          zgradpulse(icosel*gzlvlE/EDratio*4.0,gtE/2.0);
          delay(0.25/j1xh - ad180.pw/2.0 - gtE/2.0 - 0.1*gstab - 2*GRADIENT_DELAY);
        }
        else
        {
          zgradpulse(icosel*gzlvlE/EDratio*2.0,gtE);
          delay(0.25/j1xh - ad180.pw/2.0 - gtE - 0.1*gstab - 2*GRADIENT_DELAY);
        }
      }
      else
      {
        delay(0.1*gstab - rof1);
        if(EDratio > 4)
        {
          zgradpulse(icosel*gzlvlE/EDratio*4.0,gtE/2.0);
          delay(0.5/j1xh - gtE/2.0 - 0.1*gstab - 2*GRADIENT_DELAY);
        }
        else
        {
          zgradpulse(icosel*gzlvlE/EDratio*2.0,gtE);
          delay(0.5/j1xh - gtE - 0.1*gstab - 2*GRADIENT_DELAY);
        }
      }
      if (lkgate_flg[0] == 'y') lk_sample(); /* turn lock sampling on */
      decpower(dpwr);
      delay(rof2 - POWER_DELAY);
      
  status(C);
} 
Example #9
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);
   }
}
Example #10
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             */
            mess_flg[MAXSTR], /* water purging */
            c180_flg[MAXSTR],
            spco90a[MAXSTR],
            spco180a[MAXSTR],
            spco90b[MAXSTR],
            spco180b[MAXSTR];

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

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JCH =  1.7 ms */
             tauc1,         /* ca/cb refocus and ca/c' defocus = 4.5 ms */
             tauc2,         /* ca/cb stay and ca/c' refocus = 2.7 ms */
             taud,         /* ca-ha refocus; 1.8 ms   */
             BigTC,        /* carbon constant time period */
             dly_pg1,      /* delay for water purging */
             pwN,          /* PW90 for 15N pulse              */
             pwca90a,       /* PW90 for ca nucleus @ pwClvl         */
             pwca180a,      /* PW180 for ca at dvhpwra               */
             pwco180a,      /* PW180 for c' using seduce shape  */
             pwca90b,       /* PW90 for ca nucleus @ dhpwrb         */
             pwca180b,      /* PW180 for ca nucleus @ dvhpwrb         */
             pwco180b,      /* PW180 for c' using rectang. pulse     */
             pwco90b,      /* PW90 for co nucleus @ dhpwrb         */
             tsatpwr,      /* low level 1H trans.power for presat  */
             tpwrml,       /* power level for h decoupling  */
             tpwrmess,     /* power level for water purging */
             pwmlev,       /* h 90 pulse at tpwrml            */
             pwClvl,        /* power level for 13C pulses on dec1  
                              90 for part a of the sequence at 43 ppm */
             dvhpwra,        /* power level for 180 13C pulses at 43 ppm */
             dpwr_coa,      /* power level for C' 180 pulses at 43 ppm */
             dhpwrb,        /* power level for 13C pulses on dec1 - 54 ppm
                               90  for part b of the sequence */
             dvhpwrb,        /* power level for 13C pulses on dec1 - 54 ppm
                               180 for part b of the sequence     */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             dofcacb,      /* dof for dipsi part, 43  ppm            */      
             cln_dly,    /* so that get rid of crap from hb etc with
                              zero tocsy transfer   */
             sphase,
             pwC, compC,      /* C-13 RF calibration parameters */
             compH,
             waltzB1,gstab,
             ni2=getval("ni2"),
             gt0,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7;


/*  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("mess_flg",mess_flg);
  getstr("c180_flg",c180_flg);

  taua   = getval("taua"); 
  tauc1   = getval("tauc1"); 
  tauc2   = getval("tauc2"); 
  taud   = getval("taud"); 
  BigTC  = getval("BigTC");
  dly_pg1 = getval("dly_pg1");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  tpwrml  = getval("tpwrml");
  tpwrmess = getval("tpwrmess");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  dofcacb = getval("dofcacb");
  cln_dly = getval("cln_dly");
  ni = getval("ni");

  sphase = getval("sphase");

  gt0 = getval("gt0");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  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");

  if(autocal[0]=='n')
  {     
    getstr("spco90a",spco90a);
    getstr("spco180a",spco180a);
    getstr("spco90b",spco90b);
    getstr("spco180b",spco180b);
    pwmlev = getval("pwmlev");
    pwca90a = getval("pwca90a");
    pwca180a = getval("pwca180a");
    pwco180a = getval("pwco180a");
    pwca90b = getval("pwca90b");
    pwca180b = getval("pwca180b");
    pwco90b = getval("pwco90b");
    pwco180b = getval("pwco180b"); 
    pwClvl = getval("pwClvl");
    dvhpwra = getval("dvhpwra");
    dpwr_coa = getval("dpwr_coa"); 
    dhpwrb = getval("dhpwrb");
    dvhpwrb = getval("dvhpwrb");
  }
  else
  {
    waltzB1=getval("waltzB1");
    pwmlev=1/(4.0*waltzB1);
    compH = getval("compH");
    tpwrml= tpwr - 20.0*log10(pwmlev/(compH*pw));
    tpwrml= (int) (tpwrml + 0.5);
    strcpy(spco90a,"Psed180_133p");
    strcpy(spco180a,"Psed180_133p");
    strcpy(spco90b,"Phard90co_118p");
    strcpy(spco180b,"Phard180co_118p");
    if (FIRST_FID)
    {
      pwC = getval("pwC");
      pwClvl = getval("pwClvl");
      compC = getval("compC");
      ca90 = pbox("cal", CA90, "", dfrq, compC*pwC, pwClvl);
      ca180 = pbox("cal", CA180, "", dfrq, compC*pwC, pwClvl);      
      co180 = pbox(spco180a, CO180, CO180ps, dfrq, compC*pwC, pwClvl);
      ca90b = pbox("cal", CA90b, "", dfrq, compC*pwC, pwClvl);
      ca180b = pbox("cal", CA180b, "", dfrq, compC*pwC, pwClvl);          
      co90b = pbox(spco90b, CO90b, CA180ps, dfrq, compC*pwC, pwClvl);
      co180b = pbox(spco180b, CO180b, CA180ps, dfrq, compC*pwC, pwClvl);
      w16 = pbox_dec("cal", "WALTZ16", tpwrml, sfrq, compH*pw, tpwr);
    }
    pwca90a = ca90.pw;       pwClvl = ca90.pwr;    
    pwca180a = ca180.pw;     dvhpwra = ca180.pwr;
    pwco180a = co180.pw;     dpwr_coa = co180.pwr;
    pwco90b = co90b.pw;      dhpwrb = co90b.pwr;
    pwco180b = co180b.pw;    
    pwca90b = ca90b.pw;          
    pwca180b = ca180b.pw;    dvhpwrb = ca180b.pwr;    
    pwmlev = 1.0/w16.dmf;
  }   

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( ni*1/(sw1) > 2.0*BigTC )
    {
        printf(" ni is too big\n");
        psg_abort(1);
    }

    if((c180_flg[A] == 'y') && (ni2>1))
    {
        printf("set c180_flg=n for C=O evolution");
        psg_abort(1);
    }

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

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

    if( pwmlev < 30.0e-6 ) 
    {
        printf("too much power during proton mlev sequence\n");
        psg_abort(1);
     }

    if( tpwrml > 53 )
     {
        printf("tpwrml is too high\n");
        psg_abort(1);
     }

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

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

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

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

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

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

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

    if( pw > 200.0e-6 )
    {
        printf("dont fry the probe, pw too high ! ");
        psg_abort(1);
    } 
    if( pwmlev > 200.0e-6 )
    {
        printf("dont fry the probe, pwmlev too high ! ");
        psg_abort(1);
    } 
    if( pwN > 200.0e-6 )
    {
        printf("dont fry the probe, pwN too high ! ");
        psg_abort(1);
    } 
    if( pwca90a > 200.0e-6 )
    {
        printf("dont fry the probe, pwca90a too high ! ");
        psg_abort(1);
    } 
    if( pwca90b > 200.0e-6 )
    {
        printf("dont fry the probe, pwca90b too high ! ");
        psg_abort(1);
    } 
    if( pwca180b > 200.0e-6 )
    {
        printf("dont fry the probe, pwca180b too high ! ");
        psg_abort(1);
    } 
    if( pwco90b > 200.0e-6 )
    {
        printf("dont fry the probe, pwco180b 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 || gt7 > 15e-3 )
    {
        printf("gradients on for too long. Must be < 15e-3 \n");
        psg_abort(1);
    }


/*  Phase incrementation for hypercomplex 2D data */

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

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

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) - pwca180b - 2.0*pwN - (4.0/PI)*pwco90b - 2*POWER_DELAY - WFG_START_DELAY - WFG_STOP_DELAY - 2.0e-6 ); 
        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(t8,2,4);    
    }

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

/* BEGIN ACTUAL PULSE SEQUENCE */

/* Receiver off time */

status(A);
   decoffset(dofcacb);       /* initially pulse at 43 ppm */
   obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */

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

/* Begin Pulses */
status(B);
   rcvroff();
   delay(20.0e-6);

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

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

   delay(2.0e-6);
   zgradpulse(gzlvl0,gt0);
   delay(gstab);

/* this is the real start */

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */
   decphase(t1);
   decpower(dvhpwra);
 
   delay(2.0e-6);
   zgradpulse(gzlvl1,gt1);
   delay(2.0e-6);

   delay(taua - POWER_DELAY - gt1 - 4.0e-6);   /* taua <= 1/4JCH */                          
   simpulse(2*pw,pwca180a,zero,t1,0.0,0.0);

   decpower(pwClvl);
   txphase(t2); decphase(t3);

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

   delay(taua - POWER_DELAY - gt1 - 4.0e-6); 

   rgpulse(pw,t2,0.0,0.0);

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

   decrgpulse(pwca90a,t3,0.0,2.0e-6);

   delay(tau1);

   decpower(dpwr_coa);
   decshaped_pulse(spco180a,pwco180a,zero,2.0e-6,0.0);

   dec2rgpulse(2*pwN,zero,0.0,0.0);

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

   decpower(dvhpwra);

   delay(0.8e-3 - gt7 - 4.0e-6 - 2*POWER_DELAY);
   delay(0.2e-6);
     
   rgpulse(2*pw,zero,0.0,0.0);

   decphase(t4);
   delay(BigTC - 0.8e-3);

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

   decrgpulse(pwca180a,t4,2.0e-6,2.0e-6);
   dcplrphase(zero);

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

   delay(BigTC - tau1 + 2*pwN + 2*pw - 2.0*POWER_DELAY - gt7 - 4.0e-6);
   delay(0.2e-6);

   decpower(dpwr_coa);
   decshaped_pulse(spco180a,pwco180a,zero,2.0e-6,0.0); /* bloch seigert */
   decpower(pwClvl);

   decrgpulse(pwca90a,t9,2.0e-6,0.0);

   /* H decoupling on */
   obspower(tpwrml);
   obsprgon("waltz16",pwmlev,90.0);
   xmtron();    /* TURN ME OFF  DONT FORGET  */
   /* H decoupling on */

   decpower(dpwr_coa);
   decshaped_pulse(spco180a,pwco180a,zero,2.0e-6,0.0);   /* bloch seigert */
   decpower(pwClvl);
   delay(tauc1 - 4.0*POWER_DELAY - PRG_START_DELAY - 2.0e-6);

   decpower(dvhpwra);
   decrgpulse(pwca180a,t5,2.0e-6,0.0);
   decpower(dpwr_coa);
   decshaped_pulse(spco180a,pwco180a,zero,2.0e-6,0.0);
   decpower(pwClvl);
   delay(tauc1 - 2.0*POWER_DELAY - 2.0e-6);
   decrgpulse(pwca90a,t6,2.0e-6,0.0);

   delay(2.0e-6);
   decphase(t7);

     /* H decoupling off */
     xmtroff();
     obsprgoff();
     /* H decoupling off */

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

   decoffset(dof);
   hsdelay(cln_dly);
   decpower(dhpwrb);

     /* H decoupling on */
     obspower(tpwrml);
     obsprgon("waltz16",pwmlev,90.0);
     xmtron();    /* TURN ME OFF  DONT FORGET  */
     /* H decoupling on */

   delay(2.0e-6);

   decshaped_pulse(spco90b,pwco90b,t7,0.0,0.0);

   delay(tau2);
  
   if(c180_flg[A] == 'y') {
       delay(4.0e-6);
       decshaped_pulse(spco180b,pwco180b,zero,0.0,0.0);
       delay(4.0e-6);
   }
   else
   {
       decpower(dvhpwrb);
       decrgpulse(pwca180b,zero,2.0e-6,0.0);
       decpower(dhpwrb);
      
       dec2rgpulse(2*pwN,zero,0.0,0.0);
    }

   delay(tau2);

   decshaped_pulse(spco90b,pwco90b,zero,0.0,0.0);

   delay(0.2e-6);

     /* H decoupling off */
     xmtroff();
     obsprgoff();
     /* H decoupling off */

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

     obspower(tpwrmess);
     rgpulse(dly_pg1,zero,2.0e-6,2.0e-6);
     rgpulse(dly_pg1/1.62,one,2.0e-6,2.0e-6);

  }


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

   obspower(tpwr);

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

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

  decrgpulse(pwca90b,zero,0.0,0.0);

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

  delay(taud - gt5 - 4.0e-6);

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

  delay(tauc2 - taud - POWER_DELAY - 2*pw - 2.0e-6 - 2.0e-6);

  decshaped_pulse(spco180b,pwco180b,zero,2.0e-6,0.0);   
  decpower(dvhpwrb);
  decrgpulse(pwca180b,zero,2.0e-6,0.0);
  decpower(dhpwrb);

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

  delay(tauc2 - gt5 - 6.0e-6 - POWER_DELAY); 

  decshaped_pulse(spco180b,pwco180b,zero,0.0,0.0); /* bloch seigert */   
  simpulse(pw,pwca90b,zero,zero,2.0e-6,0.0);

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

  delay(taua - POWER_DELAY - gt6 - 4.0e-6 - 2.0e-6);

  decpower(dvhpwrb);
  simpulse(2*pw,pwca180b,zero,zero,2.0e-6,0.0);

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

   delay(taua - POWER_DELAY - gt6 - 4.0e-6);

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

   rgpulse(pw,zero,0.0,0.0);  
    
/*   rcvron();  */          /* Turn on receiver to warm up before acq */ 

/* BEGIN ACQUISITION */

status(C);
setreceiver(t8);

}
Example #11
0
pulsesequence()
{
/* DECLARE VARIABLES */

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

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

 double      tau1,         /*  t1 delay */
 	     tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JCH =  1.7 ms */
             taub,         /*  = 1/4JCH or 1/8JCH for editing */
             TC,           /*  ~ 1/2JCaCo =  9 ms */
             pw_ml,        /* PW90 for mlev 1H decoupling */
             pwN,          /* PW90 for 15N pulse  */
             pwC,          /* PW90 hard 13C pulse */
             pwc90,        /* PW90 for Ca or Co nucleus */
             pw_dip,       /* PW90 for Ca or Co nucleus */
             pwreb180,     /* PW180 for reburp */
             pwcon180,     /* PW for Ca or Co on-res 180 */
             pwcoff180,    /* PW for Ca or Co off-res 180 */
             satpwr,      /* low level 1H trans.power for presat  */
             tpwrml,       /* power for 1H decoupling */
             pwClvl,        /* power level for 13C pulses on dec1 - 64 us 
                              90 for part a of the sequence  */
             compH,        /* compression factor */
             compC,        /* compression factor */
             waltzB1,      /* power level for proton decoupling */
             d_c90,        /* power level for Ca or Co 90 pulse */
             d_c180,       /* power level for Ca or Co 180 pulse */
             d_coff180,    /* power level for shifted 180 */
             d_reb,        /* power level for reburp 180 pulse */
             dpwr_dip,     /* power level for reburp 180 pulse */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             dof_coca,     /* offset between Co and Ca for comp180 */
             bw,ofs,ppm,   /* temporary Pbox parameters */



             zeta,
             zeta1,

             gt0,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gstab,
             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8; 

/* LOAD VARIABLES */


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

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  TC   = getval("TC"); 
  pwc90 = getval("pwc90");
  pwN = getval("pwN");
  pwC = getval("pwC");
  pwClvl = getval("pwClvl");
  compC = getval("compC");
  compH = getval("compH");
  waltzB1 = getval("waltzB1");
  tpwr = getval("tpwr");
  satpwr = getval("satpwr");
  d_c180 = getval("d_c180");
  d_reb = getval("d_reb");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni  = getval("ni");
  ni2  = getval("ni2");
  ncyc = getval("ncyc");

  gt0 = getval("gt0");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  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");

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

    if( ncyc > 9 )
    {
        printf("dont fry the probe, ncyc must be <= 9\n");
        psg_abort(1);
    }


    if( gt0 > 10.0e-3 || gt1 > 10.0e-3 || gt2 > 10.0e-3 || gt3 >10.0e-3 ||
       gt4 > 10.0e-3 || gt5 > 10.0e-3 || gt6 > 10.0e-3 || gt7 > 10.0e-3 )
    {
        printf("gt values are too long. Must be < 10.0e-3\n");
        psg_abort(1);
    } 

/*  Phase incrementation for hypercomplex 2D & 3D data */

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

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

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    if(f1180[A] == 'y') {
        tau1 += 1.0 / (2.0*sw1) - 4.0*pwC - 4.0*2.0e-6 - 2.0*(2.0/PI)*pwN ;
        if(tau1 < 0.4e-6) {
           tau1 = 0.4e-6;
           printf("tau1 is negative; decrease sw1 for proper phasing \n");
        }
    }
        tau1 = tau1/2.0;

/*  Set up f2180  tau2 = t2               */

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

    tau2 = tau2 / 2.0;


/* Calculate modifications to phases for States-TPPI acquisition in t1 & t2  */

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

   if( ix == 1) d3_init = d3 ;
   t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );
   if(t2_counter % 2) {
      tsadd(t5,2,4);     
      tsadd(t6,2,4);    
    }
   pwc90 = 1/(4.0 * (4700*(dfrq/150))) ;  /*  4.7kHz at 150 MHz 13C */
   d_c90 = pwClvl - 20.0*log10(pwc90/(compC*pwC));
   d_c90 = (int) (d_c90 + 0.5);

   pwcon180 = 1/(4.0 * (10900*(dfrq/150))) ;  /*  10.9kHz at 150 MHz 13C */   d_c180 = pwClvl - 20.0*log10(pwcon180/(compC*pwC));
   d_c180 = (int) (d_c180 + 0.5);


/* Now include the Bax/Logan trick (shared time evolution in 13C) */

    if(ni2 != 1)
      zeta = (taub/2.0 + 2*pw) / ( (double)(ni2-1) );
    else
      zeta = 0.0;

    zeta1 = zeta*( (double)t2_counter );

 if (FIRST_FID)                                      /* call Pbox */
  {
          ppm = getval("dfrq");
          bw = 132.0*ppm; ofs = bw;   /* carrier at 42ppm, inversion at 174ppm */
          spco180 = pbox_make("spco180","square180n", bw, ofs, compC*pwC, pwClvl);
          spreb180 = pbox_make("spreb180","reburp", 20*dfrq, -4*dfrq, compC*pwC, pwClvl);
  }
  pwcoff180=spco180.pw; d_coff180=spco180.pwrf;
  pwreb180=spreb180.pw; d_reb=spreb180.pwrf;

    if (0.5*TC - 0.5*(ni2-1)/sw2 - pwcon180/2.0 - 2.0e-6 - pwcoff180 -2.0*2.0e-6 \
           - WFG_START_DELAY - WFG_STOP_DELAY - POWER_DELAY < 0.4e-6) {
	printf("ni2 too large !\n");
	psg_abort(1);
    }

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obsoffset(tof);
   decoffset(dof);
   dec2offset(dof2);
   obspower(satpwr);      /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

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

   decrgpulse(pwC,zero,0.0,0.0);

   delay(0.2e-6);
   zgradpulse(gzlvl0,gt0);
   delay(gstab);

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

   zgradpulse(gzlvl1,gt1);
   delay(taua - gt1);                /* taua <= 1/4JCH */ 
   simpulse(2*pw,2*pwC,zero,zero,0.0,0.0);
   zgradpulse(gzlvl1,gt1);
   delay(taua - gt1 );                /* taua <= 1/4JCH */ 

   rgpulse(pw,t1,0.0,0.0);

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

   decrgpulse(pwC,t5,2.0e-6,0.0);

   txphase(zero); decphase(zero);

   delay(tau2);

   dec2rgpulse(2*pwN,zero,0.0,0.0);

   delay(taub/2.0 - 2*pwN);

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

   zgradpulse(gzlvl3,gt3);
   delay(tau2 - zeta1);

   decrgpulse(2.0*pwC,zero,0.0,0.0);
   zgradpulse(gzlvl3,gt3);

   delay(taub/2.0 - zeta1 + 2*pw);

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


   zgradpulse(gzlvl6,gt6/1.7);
   delay(gstab);

   pw_dip = 1/(4.0 * (6700*(dfrq/150))) ;  /*  6.7kHz at 150 MHz 13C */
   dpwr_dip = pwClvl - 20.0*log10(pw_dip/(compC*pwC));
   dpwr_dip = (int) (dpwr_dip + 0.5);
   decpower(dpwr_dip);

   if( (float) ncyc > 0.1) {
      decspinlock("FLOPSY8",pw_dip,1.0,zero,ncyc);
   }

   decphase(one); 
   decpower(d_c90);
   zgradpulse(gzlvl6,gt6);
   delay(gstab);

   pw_ml = 1/(4.0 * waltzB1) ;
   tpwrml = tpwr - 20.0*log10(pw_ml/(compH*pw));
   tpwrml = (int) (tpwrml + 0.5);

   obspower(tpwrml);

/* H decoupling on */
     rgpulse(pw_ml,one,2.0e-6,0.0);
     txphase(zero);
     delay(2.0e-6);
     obsprgon("waltz16",pw_ml,90.0);
     xmtron();
    
/* Cz */
   decrgpulse(pwc90,one,0.0,2.0e-6);

   decpower(d_c180);
   delay(0.5*TC - 2.0e-6 - POWER_DELAY  - 2.0*pwN - 2.0e-6);
   dec2rgpulse(2.0*pwN,zero,0.0,2.0e-6);
   decrgpulse(pwcon180,zero,0.0,0.0);
   delay(0.5*TC - POWER_DELAY );

   decphase(t2);
   decpower(d_c90);
   decrgpulse(pwc90,t2,0.0,0.0);

/* CzNz */

/* H decoupling off */
     xmtroff();
     obsprgoff();
     rgpulse(pw_ml,three,2.0e-6,2.0e-6);
     zgradpulse(gzlvl4,gt4);
     dec2phase(t3);
     delay(gstab);

     decpower(pwClvl);
     dof_coca=dof+(110-42)*dfrq;
     decoffset(dof_coca);	/* move C carrier for comp180 */
     decphase(one);

/* H decoupling on */
     obspower(tpwrml);
     rgpulse(pw_ml,one,2.0e-6,0.0);
     txphase(zero);
     delay(2.0e-6);
     obsprgon("waltz16",pw_ml,90.0);
     xmtron();
    
/* N evolution */

   dec2rgpulse(pwN,t3, 0.0, 2.0e-6);
   if(ch_plane[0] == 'y')
   {
     dec2phase(zero);
     delay(0.2e-6);
   }
   else {
       delay(tau1);
     decrgpulse(pwC, one, 0.0, 0.0);
     decrgpulse(2.0*pwC, zero, 2.0e-6, 2.0e-6);
     decrgpulse(pwC, one, 0.0, 0.0);
       delay(tau1);
   }
   dec2rgpulse(pwN, zero, 2.0e-6, 0.0);

/* H decoupling off */
     xmtroff();
     obsprgoff();
     rgpulse(pw_ml,three,2.0e-6,2.0e-6);
     obspower(tpwr);

     decpower(d_c90);
     decoffset(dof);		/* move back C carrier */
     decphase(t5);

/* clean-up before proceeding */

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

   decrgpulse(pwc90,zero,0.0,0.0);

/* refocus Ca-N and Ca-H couplings */

     delay(0.5*TC - pwcon180/2.0 - pwcoff180  \
           - WFG_START_DELAY - WFG_STOP_DELAY - POWER_DELAY );

   decphase(zero);
   decpower(pwClvl); decpwrf(d_coff180);
   simshaped_pulse("","spco180",2.0*pw,pwcoff180,zero,zero,0.0e-6,0.0e-6);	/* Bloch siegert correction */
   decphase(zero); decpower(d_c180); decpwrf(4095.0);
   decrgpulse(pwcon180,t4,0.0e-6,0.0e-6);
   decpwrf(d_coff180); decpower(pwClvl);
   dec2rgpulse(2.0*pwN,zero,0.0,0.0);
   decshaped_pulse("spco180", pwcoff180, zero, 0.0e-6, 0.0e-6);
     delay(taub/2.0);
   rgpulse(2.0*pw,zero,0.0,0.0);
     decpower(d_c90); decpwrf(4095.0);
     decphase(zero);
     delay(0.5*TC - taub/2.0 - 2.0*pw  -pwcon180/2 - 2.0*pwN - pwcoff180 \
          - WFG_START_DELAY - WFG_STOP_DELAY \
          - 2.0*POWER_DELAY);

   decrgpulse(pwc90,zero,0.0,0.0);
 
   zgradpulse(gzlvl7,gt7);
   delay(gstab);
   rgpulse(pw,zero,0.0,0.0);
   zgradpulse(gzlvl8,gt8);
   txphase(zero);
   dec2phase(zero);
   decpwrf(d_reb); decpower(pwClvl);
   delay(taua - 2.0*POWER_DELAY - gt8  - 0.5*pwreb180 );
   simshaped_pulse("","spreb180",2.0*pw,pwreb180,zero,zero,0.0e-6,0.0e-6);	/* Purge all C outside 26-46 ppm */
   zgradpulse(gzlvl8,gt8);
   decphase(zero);
   dec2power(dpwr2);    /* set power for 15N decoupling */
   decpower(dpwr);      /* set power for 13C decoupling */
   decpwrf(4095.0);
   delay(taua - 0.5*pwreb180 - gt8 - 3.0*POWER_DELAY);

   rgpulse(pw,zero,0.0,0.0);



/* BEGIN ACQUISITION */

status(C);
   setreceiver(t6);

}
Example #12
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            spco180a[MAXSTR],
            spco90b[MAXSTR],
            spco180b[MAXSTR],
            cadecseq[MAXSTR];


 int         phase, phase2, ni, ni2, icosel,  /* used to get n and p type */
             t1_counter,   /* used for states tppi in t1           */ 
             t2_counter;   /* used for states tppi in t2           */ 

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JCH =  1.7 ms */
             tauc,         /* ~ 1/4JCAC' = 3.6 ms  */
             taud,         /* ~ 1/4JC'CA = 4.3, 4.4 ms */
             taue,         /* 1/4JC'N = 12.4 ms    */
             tauf,         /* 1/4JNH = 2.25 ms */
             BigTC,        /* carbon constant time period */
             BigTN,        /* nitrogen constant time period */
             pwn,          /* PW90 for 15N pulse              */
             pwca90a,      /* PW90 for 13C at dvhpwr    */
             pwca180a,     /* PW180 for 13C at dvhpwra  */
             pwco180a,
             pwca180b,      /* PW180 for ca nucleus @ dvhpwrb         */
             pwco180b,
             pwco90b,      /* PW90 for co nucleus @ dhpwrb         */
             tsatpwr,      /* low level 1H trans.power for presat  */
             tpwrml,       /* power level for h decoupling  */
             pwmlev,       /* h 90 pulse at tpwrml            */
             dhpwr,        /* power level for 13C pulses on dec1  
                              90 for part a of the sequence at 43 ppm */
             dvhpwra,        /* power level for 180 13C pulses at 43 ppm */
             dhpwrb,        /* power level for 13C pulses on dec1 - 54 ppm
                               90  for part b of the sequence*/
             dvhpwrb,        /* power level for 13C pulses on dec1 - 54 ppm
                               180 for part b of the sequence     */
             dhpwr2,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             dofcacb,      /* dof for dipsi part, 43  ppm            */      
             pwcadec,     /* seduce ca decoupling at dpwrsed        */
             dpwrsed,     /* power level for seduce ca decoupling   */
             dressed,     /* resoln for seduce decoupling  = 2      */
             dhpwrcoa,    /* power level for pwco180a, 180 shaped C'  */
             sphase1,     /* phase shift for off resonance C' 180  */
             pwN, pwNlvl,      /* N-15 RF calibration parameters */
             pwC, compC, pwClvl,      /* C-13 RF calibration parameters */
             compH,waltzB1,
             BigT1,     
             gt1,
             gt2,
             gt4,
             gt5,
             gt6,
             gt7,
             gt9,
             gt10,
             gstab,
             gzlvl1,
             gzlvl2,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl9,
             gzlvl10;
           


/*  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);

  taua   = getval("taua"); 
  tauc   = getval("tauc"); 
  taud   = getval("taud");
  taue   = getval("taue");
  tauf   = getval("tauf");
  BigTC  = getval("BigTC");
  BigTN  = getval("BigTN");
  pwN = getval("pwN");
  pwNlvl = getval("pwNlvl");
  pwn = getval("pwn");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  tpwrml  = getval("tpwrml");
  dpwr = getval("dpwr");
  dhpwr2 = getval("dhpwr2");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  dofcacb = getval("dofcacb");
  ni = getval("ni");
  ni2 = getval("ni2");
  BigT1 = getval("BigT1");
  sphase1 = getval("sphase1");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt9 = getval("gt9");
  gt10 = getval("gt10");
  gstab = getval("gstab");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl9 = getval("gzlvl9");
  gzlvl10 = getval("gzlvl10");


  if(autocal[0]=='n')
  {
    getstr("spco180a",spco180a);
    getstr("spco90b",spco90b);
    getstr("spco180b",spco180b);
    getstr("cadecseq",cadecseq);    
    pwca90a = getval("pwca90a");
    pwca180a = getval("pwca180a");
    pwco180a = getval("pwco180a");
    pwca180b = getval("pwca180b");
    pwco90b = getval("pwco90b");
    pwco180b = getval("pwco180b"); 
    dhpwr = getval("dhpwr");
    dvhpwra = getval("dvhpwra");
    dhpwrb = getval("dhpwrb");
    dvhpwrb = getval("dvhpwrb");    
    dhpwrcoa = getval("dhpwrcoa");
    dpwrsed = getval("dpwrsed"); 
    dressed = getval("dressed");
    pwcadec = getval("pwcadec");    
    pwmlev = getval("pwmlev");
  }
  else
  {
    waltzB1=getval("waltzB1");
    pwmlev=1/(4.0*waltzB1);
    compH = getval("compH");
    tpwrml= tpwr - 20.0*log10(pwmlev/(compH*pw));
    tpwrml= (int) (tpwrml + 0.5);
    strcpy(spco180a,"Psed180_133p");
    strcpy(spco90b,"Phard90co_118p");
    strcpy(spco180b,"Phard180co_118p");
    strcpy(cadecseq,"Pseduce1_lek");
    if (FIRST_FID)
    {
      pwN = getval("pwN");
      pwNlvl = getval("pwNlvl");
      pwC = getval("pwC");
      pwClvl = getval("pwClvl");
      compC = getval("compC");
      ca90 = pbox("cal", CA90, "", dfrq, compC*pwC, pwClvl);
      ca180 = pbox("cal", CA180, "", dfrq, compC*pwC, pwClvl);      
      co180 = pbox(spco180a, CO180, CO180ps, dfrq, compC*pwC, pwClvl);
      co90b = pbox(spco90b, CO90b, CA180ps, dfrq, compC*pwC, pwClvl);
      co180b = pbox(spco180b, CO180b, CA180ps, dfrq, compC*pwC, pwClvl);
      ca180b = pbox("cal", CA180b, "", dfrq, compC*pwC, pwClvl);          
      cadec = pbox(cadecseq, CADEC, CADECps, dfrq, compC*pwC, pwClvl);
      w16 = pbox_dec("cal", "WALTZ16", tpwrml, sfrq, compH*pw, tpwr);
    }
    pwca90a = ca90.pw;       dhpwr = ca90.pwr;    
    pwca180a = ca180.pw;     dvhpwra = ca180.pwr;
    pwco180a = co180.pw;     dhpwrcoa = co180.pwr;
    pwco90b = co90b.pw;      dhpwrb = co90b.pwr;
    pwco180b = co180b.pw;    
    pwca180b = ca180b.pw;    dvhpwrb = ca180b.pwr;    
    pwcadec = 1.0/cadec.dmf; dpwrsed = cadec.pwr; dressed = cadec.dres;
    pwmlev = 1.0/w16.dmf;
    pwn=pwN; dhpwr2=pwNlvl;
  }   



/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( 0.5*ni*1/(sw1) > BigTC - gt10 )
    {
        printf(" ni is too big\n");
        psg_abort(1);
    }

    if( ni2*1/(sw2) > 2.0*BigTN )
    {
        printf(" ni2 is too big\n");
        psg_abort(1);
    }

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

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

    if( pwmlev < 30.0e-6 ) 
    {
        printf("too much power during proton mlev sequence\n");
        psg_abort(1);
     }

    if( tpwrml > 53 )
     {
        printf("tpwrml is too high\n");
        psg_abort(1);
     }

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

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

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

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

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

    if( dvhpwrb > 62 )   /* pwr level for dipsi  */
    {
        printf("don't fry the probe, DVHPWRB too large!  ");
        psg_abort(1);
    }

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

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


    if( pwcadec > 500.0e-6 || pwcadec < 200.0e-6 )
    {
        printf("pwcadec outside reasonable limits: < 500e-6 > 200e-6 \n");
        psg_abort(1);
    }

    if( dpwrsed > 45 )
    {
        printf("dpwrsed is too high\n");
        psg_abort(1);
    }

    if( gt1 > 15e-3 || gt2 > 15e-3 || gt4 >=15e-3 || gt5 > 15e-3 || gt6 >= 15e-3 || gt7 >= 15e-3 || gt9 >= 15e-3 || gt10 >= 15e-3) 
    {
        printf("all gti values must be < 15e-3\n");
        psg_abort(1);
    }

    if(gt10 > 250.0e-6) {
        printf("gt10 must be 250e-6\n");
        psg_abort(1);
    }


/*  Phase incrementation for hypercomplex 2D data */

    if (phase == 2)
      tsadd(t3,1,4);  
    if (phase2 == 2) {
      tsadd(t11,2,4);   
      icosel = 1;
    }
    else icosel = -1; 

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

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) ); 
        if(tau2 < 0.2e-6) tau2 = 0.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(t10,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(t10,2,4);    
    }

/* BEGIN ACTUAL PULSE SEQUENCE */


status(A);
   decoffset(dofcacb);       /* initially pulse at 43 ppm */
   decpower(dhpwr);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(dhpwr2);      /* Set Dec2 power for 15N hard pulses         */

/* Presaturation Period */
   if (fsat[A] == 'y')
   {
        obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
	delay(2.0e-5);
        rgpulse(d1,zero,rof1,rof1);
   	obspower(tpwr);      /* Set transmitter power for hard 1H pulses */
	delay(2.0e-5);
	if(fscuba[A] == '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
   obspower(tpwr);           /* Set transmitter power for hard 1H pulses */
   delay(d1);
   txphase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

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


/* ensure that magnetization originates on H and not 13C  */
   decrgpulse(pwca90a,zero,0.0,0.0);

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

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

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

   decpower(dvhpwra);
   delay(taua - POWER_DELAY - gt2 - 2.2e-6);   /* taua <= 1/4JCH */                          
   simpulse(2*pw,pwca180a,zero,t1,0.0,0.0);
   decpower(dhpwr);

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

   txphase(t2); decphase(t3);
   delay(taua - POWER_DELAY - gt2 - 2.2e-6); 

   rgpulse(pw,t2,0.0,0.0);

   decrgpulse(pwca90a,t3,2.0e-6,0.0);

   delay(2.0e-6);

     delay(tau1);

     decpower(dhpwrcoa);
     decshaped_pulse(spco180a,pwco180a,zero,4.0e-6,0.0);

     dec2rgpulse(2*pwn,zero,0.0,0.0);

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

     decpower(dvhpwra);

     delay(0.80e-3 - gt10 - 4.0e-6 - 2*POWER_DELAY);
     delay(0.2e-6);
     
     rgpulse(2*pw,zero,0.0,0.0);

     decphase(t4);

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

     delay(BigTC - 0.80e-3);

     decrgpulse(pwca180a,t4,0.0,0.0);

     dcplrphase(zero);

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

     delay(BigTC - tau1 + 2*pwn + 2*pw - 2*POWER_DELAY - gt10 - 4.0e-6);
     delay(0.2e-6);

     decpower(dhpwrcoa);
     decshaped_pulse(spco180a,pwco180a,zero,4.0e-6,0.0); /* bloch seigert */
     decpower(dhpwr);

   decrgpulse(pwca90a,zero,2.0e-6,0.0);

     txphase(one); delay(2.0e-6);

     /* H decoupling on */
     obspower(tpwrml);
     obsprgon("waltz16",pwmlev,90.0);
     xmtron();    /* TURN ME OFF  DONT FORGET  */
     /* H decoupling on */

   decpower(dhpwrcoa);
   decshaped_pulse(spco180a,pwco180a,zero,4.0e-6,0.0); /* bloch seigert */
   decphase(t5);

   initval(1.0,v3);
   decstepsize(0.0);
   dcplrphase(v3);
 
   delay(tauc - 3*POWER_DELAY - PRG_START_DELAY);
   
   decpower(dvhpwra);
   decrgpulse(pwca180a,t5,0.0,0.0);

   dcplrphase(zero);

   decpower(dhpwrcoa);
   decshaped_pulse(spco180a,pwco180a,zero,4.0e-6,0.0); 
   decphase(zero);
   decpower(dhpwr);
   delay(tauc - 2*POWER_DELAY);

   decrgpulse(pwca90a,zero,0.0,0.0);

   /* H decoupling off */
   xmtroff();
   obsprgoff();
   /* H decoupling off */

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

   delay(0.2e-6);
   decoffset(dof);
   decpower(dhpwrb);

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

   rgpulse(pwmlev,zero,2.0e-6,0.0);
   txphase(one); delay(2.0e-6);

   /* H decoupling on */
   obspower(tpwrml);
   obsprgon("waltz16",pwmlev,90.0);
   xmtron();
   /* H decoupling on */

   decphase(t6);
   delay(2.0e-6);
   decshaped_pulse(spco90b,pwco90b,t6,0.0,0.0);

   decphase(zero);
   delay(taud - POWER_DELAY - 4.0e-6);

   decpower(dvhpwrb);
   decrgpulse(pwca180b,zero,4.0e-6,0.0);
   decpower(dhpwrb);
   delay(taue - taud - POWER_DELAY + 2*pwn);

   /* adjust phase */
   initval(1.0,v2);
   decstepsize(sphase1);
   dcplrphase(v2);
   /* adjust phase */
    
   decshaped_pulse(spco180b,pwco180b,zero,0.0,0.0);
   dcplrphase(zero);
   
   dec2rgpulse(2*pwn,zero,0.0,0.0);
   delay(taue - 2*POWER_DELAY - 4.0e-6 - 4.0e-6);    

   decpower(dvhpwrb);
   decrgpulse(pwca180b,zero,4.0e-6,0.0); /* bloch seigert */
   decpower(dhpwrb);

   decshaped_pulse(spco90b,pwco90b,t7,4.0e-6,0.0);

   /* H decoupling off */
   xmtroff();
   obsprgoff();
   /* H decoupling off */

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

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

   rgpulse(pwmlev,zero,2.0e-6,0.0);

   txphase(one); delay(2.0e-6);

   /* H decoupling on */
   obspower(tpwrml);
   obsprgon("waltz16",pwmlev,90.0);
   xmtron();
   /* H decoupling on */

   dec2rgpulse(pwn,t8,2.0e-6,0.0);
   dec2phase(t9); decphase(zero);

   /* seduce on */

   decpower(dpwrsed);
   decprgon(cadecseq,pwcadec,dressed);
   decon();
   /* seduce on */

   delay(BigTN - tau2 + WFG_START_DELAY + WFG_STOP_DELAY + pwco180b);


  /* seduce off */
  decoff();
  decprgoff();
  
  decpower(dhpwrb);
  /* seduce off */

  dec2rgpulse(2*pwn,t9,0.0,0.0);
  decshaped_pulse(spco180b,pwco180b,zero,0.0,0.0);

  dec2phase(t11);

   /* seduce on */

   decpower(dpwrsed);
   decprgon(cadecseq,pwcadec,dressed);
   decon();
   /* seduce on */

  delay(BigTN + tau2 - 5.5e-3 - POWER_DELAY - PRG_STOP_DELAY - pwmlev - 2.0e-6);

   /* H decoupling off */ 
   xmtroff();
   obsprgoff();
   /* H decoupling off */

   rgpulse(pwmlev,two,2.0e-6,0.0);    
   obspower(tpwr);

   delay(2.5e-3);

  /* seduce off */
  decoff();
  decprgoff();
  decpower(dhpwrb);
  /* seduce off */

   delay(0.2e-6);
   zgradpulse(gzlvl1,gt1);
   delay(2.0e-6);
   
   txphase(zero);
   dec2phase(t11);
   delay(3.0e-3 - gt1 - 2.2e-6 - 2.0*GRADIENT_DELAY);
  
   sim3pulse(pw,0.0,pwn,zero,zero,t11,0.0,0.0);

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

   dec2phase(zero);
   delay(tauf - gt7 - 2.2e-6);

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

   delay(0.2e-6);
   zgradpulse(gzlvl7,gt7);
   delay(2.0e-6);
   
   txphase(t12);
   dec2phase(t13);
   delay(tauf - gt7 - 2.2e-6);

   sim3pulse(pw,0.0,pwn,t12,zero,t13,0.0,0.0);
   
   delay(0.2e-6);
   zgradpulse(gzlvl7,gt7);
   delay(2.0e-6);
 
   txphase(zero);
   dec2phase(zero);
   delay(tauf - gt7 - 2.2e-6);
   sim3pulse(2*pw,0.0,2*pwn,zero,zero,zero,0.0,0.0);

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

   txphase(zero);
   delay(tauf - gt7 - 2.2e-6);
   
   rgpulse(pw,zero,0.0,0.0);

   txphase(zero);

   delay(BigT1);

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

   delay(2.0e-6);
   zgradpulse(icosel*gzlvl2,gt1/10);
   delay(2.0e-6);

   delay(BigT1 - gt1/10 - POWER_DELAY - 4.0e-6 - 2*GRADIENT_DELAY);

   dec2power(dpwr2);  /* set power for 15N decoupling */
    

/* BEGIN ACQUISITION */

status(C);
         setreceiver(t10);

}
Example #13
0
pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            mag_flg[MAXSTR],                            /*magic angle gradient*/
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
            codecseq[MAXSTR];       /* sequence for 13C' decoupling */
 
int         icosel1,          			  /* used to get n and p type */
            icosel2,
	    t1_counter,  		        /* used for states tppi in t1 */
	    ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
	    del = getval("del"),     /* time delays for CH coupling evolution */
	    del1 = getval("del1"),
	    del2 = getval("del2"),
            del3 = getval("del3"),
            del4 = getval("del4"),
            TC = getval("TC"),
            satpwr = getval("satpwr"),
            waltzB1 = getval("waltzB1"),
            spinlock = getval("spinlock"),
            pwco,copwr, cores,codmf,
            kappa,

	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 */

/* p_d is used to calculate the isotropic mixing on the Cab region            */
        p_d,                  	       /* 50 degree pulse for DIPSI-2 at rfd  */
        rfd,                    /* fine power for 7 kHz rf for 500MHz magnet  */
	ncyc = getval("ncyc"), 			  /* no. of cycles of DIPSI-3 */


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


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

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

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

	gt1 = getval("gt1"),  		       /* coherence pathway gradients */
	gzcal = getval("gzcal"),               /* G/cm to DAC coversion factor*/
        gstab = getval("gstab"),
        gzlvl1 = getval("gzlvl1"),
	gzlvl2 = getval("gzlvl2"),

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

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

/*   LOAD PHASE TABLE    */

	settable(t1,2,phi1);
	settable(t2,1,phi2);
	settable(t3,1,phi3);
	settable(t4,1,phi4);
	settable(t11,2,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;

   /* dipsi-3 decoupling on CbCa */	
 	p_d = (5.0)/(9.0*4.0*spinlock); /* DIPSI-3*/
 	rfd = (compC*4095.0*pwC*5.0)/(p_d*9.0);
	rfd = (int) (rfd + 0.5);
  	ncyc = (int) (ncyc + 0.5);


   /* power level and pulse time for WALTZ 1H decoupling */
        pwHd = 1/(4.0 * waltzB1) ;    
        tpwrd = tpwr - 20.0*log10(pwHd/(pw));
        tpwrd = (int) (tpwrd + 0.5);

/* activate auto-calibration flags */
setautocal();
  if (autocal[0] == 'n')
  {
    codmf= getval("codmf");
    pwco = 1.0/codmf; /* pw for 13C' decoupling field */
    copwr = getval("copwr"); /* power level for 13C' decoupling */
    cores = getval("cores"); /* power level for 13C' decoupling */
  }
  else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
  {
    strcpy(codecseq,"Pdec_154p");
    if(FIRST_FID)                                            /* call Pbox */
    {
      ppm = getval("dfrq");
      bw=20.0*ppm; ofs=154*ppm;
      Pdec_154p = pbox_Dsh("Pdec_154p", "WURST2", bw, ofs, compC*pwC, pwClvl);
      bw=30*ppm; ofs=0.0*ppm; nst = 1000; pws = 0.001;
      me180 = pbox_makeA("me180", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
    }

    copwr = Pdec_154p.pwr; pwco = 1.0/Pdec_154p.dmf;
    cores = Pdec_154p.dres;
    pwme180 = me180.pw; me180pwr= me180.pwr; me180pwrf = me180.pwrf;

  }
/* CHECK VALIDITY OF PARAMETER RANGES */

    if( gt1 > 0.5*del - 1.0e-4)
    {
        printf(" gt1 is too big. Make gt1 less than %f.\n", (0.5*del - 1.0e-4));
        psg_abort(1);
    }

    if( dm[A] == 'y' )
    {
        printf("incorrect dec1 decoupler flag! Should be 'nny' or 'nnn' ");
        psg_abort(1);
    }

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

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

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

/* PHASES AND INCREMENTED TIMES */

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

    icosel1 = 1; icosel2 = 1;
    if (phase1 == 2) 
	{ tsadd(t2,2,4); icosel1 = -1;}
    if (phase2 == 2) 
	{ tsadd(t4,2,4); icosel2 = -1; tsadd(t2,2,4);}

/*  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;


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

   
   if(ni > 1)
           kappa = (double)(t1_counter*(del2)) / ( (double) (ni-1) );
      else kappa = 0.0;   

/*   BEGIN PULSE SEQUENCE   */

status(A);

        decoffset(dof-140*dfrq);
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rf0);
	obsoffset(tof);
	txphase(zero);
	delay(1.0e-5);

  if (satmode[A] == 'y')
    {
      obspower(satpwr);
      txphase(zero);
      rgpulse(d1,zero,20.0e-6,20.0e-6);
      obspower(tpwr);            /* Set power for hard pulses  */
    }
  else  
    {
      obspower(tpwr); /* Set power for hard pulses  */ 
      delay(d1);
    }

	decrgpulse(pwC, zero, 0.0, 0.0);	   /*destroy C13 magnetization*/
	zgradpulse(gzlvl1, 0.5e-3);
	delay(gstab);
	decrgpulse(pwC, one, 0.0, 0.0);
	zgradpulse(0.7*gzlvl1, 0.5e-3);
	delay(1.1*gstab);

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

	zgradpulse(gzlvl3, gt3);
        decphase(zero);
	delay(0.5*del - gt3);

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

	zgradpulse(gzlvl3, gt3);
        txphase(one);
        decphase(t1);
	delay(0.5*del - gt3);

        rgpulse(pw,one,0.0,0.0);
        zgradpulse(1.8*gzlvl3, gt3);
        txphase(zero);
        delay(150e-6);
	decrgpulse(pwC, t1, 0.0, 0.0);
        
      /* decoupling on for carbonyl carbon */
         decpwrf(4095.0);
         decpower(copwr);
         decprgon(codecseq,pwco,cores);
         decon();
      /* decoupling on for carbonyl carbon */

        delay(tau1);

        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
 
        zgradpulse(icosel1*gzlvl4, gt1);

	delay(0.5*del2 - 2.0*pwN - gt1 - 2.0*pw);

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

        delay(tau1 - (kappa*tau1));

      /* co-decoupling off */
         decoff();
         decprgoff();
      /* co-decoupling off */
         decpower(pwClvl);

	decrgpulse(2.0*pwC, zero, 0.0, 0.0);

      /* decoupling on for carbonyl carbon */
         decpwrf(4095.0);
         decpower(copwr);
         decprgon(codecseq,pwco,cores);
         decon();
      /* decoupling on for carbonyl carbon */

	delay(0.5*del2 - kappa*tau1);

      /* co-decoupling off */
         decoff();
         decprgoff();
      /* co-decoupling off */
         decpower(pwClvl);

        decphase(t2);

	decrgpulse(pwC, t2, 0.0, 0.0);

	decpwrf(rfd);
	delay(2.0e-6);
	initval(ncyc, v2);
	starthardloop(v2);
     decrgpulse(4.9*p_d,one,0.0,0.0);
     decrgpulse(7.9*p_d,three,0.0,0.0);
     decrgpulse(5.0*p_d,one,0.0,0.0);
     decrgpulse(5.5*p_d,three,0.0,0.0);
     decrgpulse(0.6*p_d,one,0.0,0.0);
     decrgpulse(4.6*p_d,three,0.0,0.0);
     decrgpulse(7.2*p_d,one,0.0,0.0);
     decrgpulse(4.9*p_d,three,0.0,0.0);
     decrgpulse(7.4*p_d,one,0.0,0.0);
     decrgpulse(6.8*p_d,three,0.0,0.0);
     decrgpulse(7.0*p_d,one,0.0,0.0);
     decrgpulse(5.2*p_d,three,0.0,0.0);
     decrgpulse(5.4*p_d,one,0.0,0.0);
     decrgpulse(0.6*p_d,three,0.0,0.0);
     decrgpulse(4.5*p_d,one,0.0,0.0);
     decrgpulse(7.3*p_d,three,0.0,0.0);
     decrgpulse(5.1*p_d,one,0.0,0.0);
     decrgpulse(7.9*p_d,three,0.0,0.0);

     decrgpulse(4.9*p_d,three,0.0,0.0);
     decrgpulse(7.9*p_d,one,0.0,0.0);
     decrgpulse(5.0*p_d,three,0.0,0.0);
     decrgpulse(5.5*p_d,one,0.0,0.0);
     decrgpulse(0.6*p_d,three,0.0,0.0);
     decrgpulse(4.6*p_d,one,0.0,0.0);
     decrgpulse(7.2*p_d,three,0.0,0.0);
     decrgpulse(4.9*p_d,one,0.0,0.0);
     decrgpulse(7.4*p_d,three,0.0,0.0);
     decrgpulse(6.8*p_d,one,0.0,0.0);
     decrgpulse(7.0*p_d,three,0.0,0.0);
     decrgpulse(5.2*p_d,one,0.0,0.0);
     decrgpulse(5.4*p_d,three,0.0,0.0);
     decrgpulse(0.6*p_d,one,0.0,0.0);
     decrgpulse(4.5*p_d,three,0.0,0.0);
     decrgpulse(7.3*p_d,one,0.0,0.0);
     decrgpulse(5.1*p_d,three,0.0,0.0);
     decrgpulse(7.9*p_d,one,0.0,0.0);

     decrgpulse(4.9*p_d,three,0.0,0.0);
     decrgpulse(7.9*p_d,one,0.0,0.0);
     decrgpulse(5.0*p_d,three,0.0,0.0);
     decrgpulse(5.5*p_d,one,0.0,0.0);
     decrgpulse(0.6*p_d,three,0.0,0.0);
     decrgpulse(4.6*p_d,one,0.0,0.0);
     decrgpulse(7.2*p_d,three,0.0,0.0);
     decrgpulse(4.9*p_d,one,0.0,0.0);
     decrgpulse(7.4*p_d,three,0.0,0.0);
     decrgpulse(6.8*p_d,one,0.0,0.0);
     decrgpulse(7.0*p_d,three,0.0,0.0);
     decrgpulse(5.2*p_d,one,0.0,0.0);
     decrgpulse(5.4*p_d,three,0.0,0.0);
     decrgpulse(0.6*p_d,one,0.0,0.0);
     decrgpulse(4.5*p_d,three,0.0,0.0);
     decrgpulse(7.3*p_d,one,0.0,0.0);
     decrgpulse(5.1*p_d,three,0.0,0.0);
     decrgpulse(7.9*p_d,one,0.0,0.0);

     decrgpulse(4.9*p_d,one,0.0,0.0);
     decrgpulse(7.9*p_d,three,0.0,0.0);
     decrgpulse(5.0*p_d,one,0.0,0.0);
     decrgpulse(5.5*p_d,three,0.0,0.0);
     decrgpulse(0.6*p_d,one,0.0,0.0);
     decrgpulse(4.6*p_d,three,0.0,0.0);
     decrgpulse(7.2*p_d,one,0.0,0.0);
     decrgpulse(4.9*p_d,three,0.0,0.0);
     decrgpulse(7.4*p_d,one,0.0,0.0);
     decrgpulse(6.8*p_d,three,0.0,0.0);
     decrgpulse(7.0*p_d,one,0.0,0.0);
     decrgpulse(5.2*p_d,three,0.0,0.0);
     decrgpulse(5.4*p_d,one,0.0,0.0);
     decrgpulse(0.6*p_d,three,0.0,0.0);
     decrgpulse(4.5*p_d,one,0.0,0.0);
     decrgpulse(7.3*p_d,three,0.0,0.0);
     decrgpulse(5.1*p_d,one,0.0,0.0);
     decrgpulse(7.9*p_d,three,0.0,0.0);
	endhardloop();

        txphase(one);
	decpwrf(rf0);
        decphase(t3);
        obspower(tpwrd);
        decrgpulse(pwC,t3,0.0,0.0);
        decoffset(dof - 155*dfrq);
        rgpulse(pwHd,one,0.0,2.0e-6);
        txphase(zero);
        obsunblank();
        obsprgon("waltz16", pwHd, 90.0);              /* PRG_START_DELAY */
        xmtron();

	delay(TC - OFFSET_DELAY - POWER_DELAY - PRG_START_DELAY - tau2);

	decrgpulse(2.0*pwC, zero, 0.0, 0.0);

        delay(TC + tau2 - POWER_DELAY - PRG_STOP_DELAY - 2*gt1 - gstab - 2.0*pw);

        xmtroff();
        obsprgoff();
        obsblank();
        rgpulse(pwHd,three,2.0e-6,0.0);
        obspower(tpwr);

    if (mag_flg[A] =='y')
        magradpulse(gzcal*icosel2*gzlvl2, gt1);
    else
        zgradpulse(icosel2*gzlvl2, gt1);
        delay(gstab/2.0);
        rgpulse(2.0*pw,zero,0.0,0.0);
    if (mag_flg[A] =='y')
        magradpulse(gzcal*icosel2*gzlvl2, gt1);
    else
        zgradpulse(icosel2*gzlvl2, gt1);
        delay(gstab/2.0);

        decphase(zero);
        simpulse(0.0,pwC, two, zero, 0.0, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(0.5*del1 - gt5);

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

        zgradpulse(gzlvl5, gt5);
        txphase(one);
        decphase(t4);
        delay(0.5*del1 - gt5);

	simpulse(pw, pwC, one, t4, 0.0, 0.0);

	zgradpulse(gzlvl6, gt5);
	txphase(zero);
	decphase(zero);
	delay(0.5*del4 - gt5);

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

	zgradpulse(gzlvl6, gt5);
	delay(0.5*del4 - gt5);

	simpulse(pw,pwC,zero,zero,0.0,0.0);
        zgradpulse(2.3*gzlvl6, gt1);

   if (autocal[A] == 'y')
       {
        decpower(me180pwr); decpwrf(me180pwrf);
	delay(0.5*del3 - gt1 - 0.0005 -2.0*POWER_DELAY- WFG2_START_DELAY);
	simshaped_pulse("","me180",2.0*pw,0.001, zero, zero, 0.0, 0.0);
        decpwrf(rf0);
        decphase(zero);

       }
   else
       {
	delay(0.5*del3 - 0.5*pwC - gt1);
	simpulse(2.0*pw,2.0*pwC, zero, zero, 0.0, 0.0);
       }


   decpower(dpwr);
        if (mag_flg[A] == 'y')
            magradpulse(gzcal*((2.3*gzlvl6)+gzlvl1), gt1);
        else
            zgradpulse(((2.3*gzlvl6)+gzlvl1), gt1);

   if (autocal[A] == 'y')
   {
     if(dm3[B] == 'y')
       delay(0.5*del3 - 0.0005 -gt1 -1/dmf3 - 2.0*GRADIENT_DELAY - 2.0*POWER_DELAY);
        else
       delay(0.5*del3 -  0.0005 -gt1 - 2.0*GRADIENT_DELAY - 2.0*POWER_DELAY);
   }
   else
   {
     if(dm3[B] == 'y') 
      delay(0.5*del3  - gt1 -1/dmf3 - 2.0*GRADIENT_DELAY - POWER_DELAY);
         else
      delay(0.5*del3  - gt1 - 2.0*GRADIENT_DELAY - POWER_DELAY);
   }

   if(dm3[B] == 'y')			         /*optional 2H decoupling off */
        {
          dec3rgpulse(1/dmf3, three, 0.0, 0.0); 
          setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
          dec3blank();
        }
 if (dm3[B]=='y') lk_sample();
status(C); 
 setreceiver(t11);
}
Example #14
0
void 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];			    /* do TROSY on N15 and H1 */
 
int         icosel,          			  /* used to get n and p type */
            t1_counter=getval("t1_counter"),      /* used for states tppi in t1 */
            t2_counter=getval("t2_counter"),      /* used for states tppi in t2 */
	    nli = getval("nli"),
	    nli2 = getval("nli2");

double      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 */

/* the following pulse lengths for SLP pulses are automatically calculated    */
/* by the macro "proteincal".  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 = getval("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 = getval("pwC6"),     /* 90 degree selective sinc pulse on CO(174ppm) */
   pwC8 = getval("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 for pwHs pulse          */
   	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);
   if (TROSY[A]=='y')
       {settable(t8,1,phy);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,4,recT);}
    else
       {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;

    /* 180 degree pulse on Ca, null at CO 118ppm away */
        rf3 = (compC*4095.0*pwC*2.0)/pwC3a;
	rf3 = (int) (rf3 + 0.5);

    /* the pwC3 pulse at the middle of t1  */
	if ((nli2 > 0.0) && (nli == 1.0)) nli = 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 ( nli > 1 )     pwC3 = pwC3a;
	if ( pwC3 > 0 )   phshift3 = 48.0;
	else              phshift3 = 0.0;

    /* 90 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */
	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 */
	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);
 


/* CHECK VALIDITY OF PARAMETER RANGES */

    if ( 0.5*nli2*1/(sw2) > timeTN - WFG3_START_DELAY)
       { printf(" nli2 is too big. Make nli2 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 > 46 )
       { 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) && (nli>1 || nli2>1))
       { printf(" pwN too long! recheck value "); psg_abort(1);} 
 
    if ( TROSY[A]=='y' && dm2[C] == 'y' )
       { text_error("Choose either TROSY='n' or dm2='n' ! "); psg_abort(1);}



/* PHASES AND INCREMENTED TIMES */

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

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


/*  Set up f1180  */

    if( ix == 1) d2_init = d2;
    tau1 = d2_init + (t1_counter) / sw1;

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


/*  Set up f2180  */

    if( ix == 1) d3_init = d3;
    tau2 = d3_init + (t2_counter) / sw2;

    if((f2180[A] == 'y') && (nli2 > 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(t1_counter % 2) 
	{ tsadd(t3,2,4); tsadd(t12,2,4); }

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

       if (TROSY[A] == 'n')
	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);
       if (TROSY[A] == 'n')
	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);
    if (tpwrsf < 4095.0)
     {obspwrf(tpwrsf); tpwrs=tpwrs+6.0;}
    obspower(tpwrs);
if (TROSY[A]=='y')
   {txphase(two);
    shaped_pulse("H2Osinc", pwHs, two, 5.0e-4, 0.0);
    obspower(tpwr); obspwrf(4095.0);
    zgradpulse(gzlvl3, gt3);
    delay(2.0e-4);
    dec2rgpulse(pwN, zero, 0.0, 0.0);

    delay(0.5*kappa - 2.0*pw);

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

    decphase(zero);
    dec2phase(zero);
    decpwrf(rf8);
    delay(timeTN - 0.5*kappa - WFG3_START_DELAY);
   }
else
   {txphase(zero);
    shaped_pulse("H2Osinc", pwHs, zero, 5.0e-4, 0.0);
    obspower(tpwrd); 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);
if (TROSY[A]=='n')
   {xmtroff();
    obsprgoff();
    rgpulse(pwHd,three,2.0e-6,0.0);}
	zgradpulse(gzlvl3, gt3);
 	delay(2.0e-4);
	decshaped_pulse("offC6", pwC6, t3, 0.0, 0.0);
	decphase(zero);

/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION        xxxxxxxxxxxxxxxxxx    */

if ((nli>1.0) && (tau1>0.0))          /* total 13C evolution equals d2 exactly */
   {				  /* 13C evolution during pwC6 is at 60% rate */
	decpwrf(rf3);
     if(tau1 - 0.6*pwC6 - WFG3_START_DELAY - 0.5*pwZ > 0.0)
	   {
	delay(tau1 - 0.6*pwC6 - WFG3_START_DELAY - 0.5*pwZ);
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC3", "", 0.0, pwC3a, 2.0*pwN, zero, zero, zero,
							   	      0.0, 0.0);
	initval(phshift3, v3);
	decstepsize(1.0);
	dcplrphase(v3);  				        /* SAPS_DELAY */
	delay(tau1 - 0.6*pwC6 - SAPS_DELAY - 0.5*pwZ- WFG_START_DELAY - 2.0e-6);
	   }
      else
	   {
	initval(180.0, v3);
	decstepsize(1.0);
	dcplrphase(v3);  				        /* SAPS_DELAY */
	delay(2.0*tau1 - 2.0*0.6*pwC6 - SAPS_DELAY - WFG_START_DELAY - 2.0e-6);
	   }
   }


else if ((nli==1.0) && (pwC3==1.0e-6))        /* 13CO evolution for dof calib. */
   {
 	decpwrf(rf8);
	delay((1.0/(dfrq*80.0)) + 2.0e-6);		   /* WFG_START_DELAY */
	decshaped_pulse("offC8", pwC8, zero, 0.0, 0.0);
   }


else if (nli==1.0)         /* special 1D check of pwC3 phase enabled when nli=1 */
   {
	decpwrf(rf3);
	delay(10.0e-6 + SAPS_DELAY + 0.5*pwZ1 + WFG_START_DELAY);
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC3", "", 0.0, pwC3, 2.0*pwN, zero, zero, zero, 
							         2.0e-6 , 0.0);
	initval(phshift3, v3);
	decstepsize(1.0);
	dcplrphase(v3);  					/* SAPS_DELAY */
	delay(10.0e-6 + WFG3_START_DELAY + 0.5*pwZ1);
   }


else             /* 13CO evolution refocused for 1st increment, or when nli=0  */
   {
 	decpwrf(rf8);
	delay(12.0e-6);					   /* WFG_START_DELAY */
	decshaped_pulse("offC8", pwC8, zero, 0.0, 0.0);
	delay(10.0e-6);
   }
	decphase(t5);
	decpwrf(rf6);
	delay(2.0e-6);					   /* WFG_START_DELAY */
	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);
        if (TROSY[A]=='n')
	   {rgpulse(pwHd,one,0.0,0.0);
	    txphase(zero);
	    delay(2.0e-6);
	    obsprgon("waltz16", pwHd, 90.0);
	    xmtron();}
	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 (TROSY[A]=='y')
{    if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.5e-4 + pwHs)
	{
	  txphase(three);
          delay(timeTN - pwC3a - WFG_START_DELAY);         /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')  magradpulse(icosel*gzcal*gzlvl1, gt1);
          else  zgradpulse(icosel*gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
          obspower(tpwrs);
          if (tpwrsf<4095.0)
	   {obspwrf(tpwrsf);				       /* POWER_DELAY */
	    delay(1.0e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(1.0e-4 - POWER_DELAY);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
          obspower(tpwr);
          if (tpwrsf<4095.0)
	   {obspwrf(4095.0);				       /* POWER_DELAY */
	    delay(0.50e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(0.50e-4 - POWER_DELAY);
	}

    else if (tau2 > pwHs + 0.5e-4)
	{
	  txphase(three);
          delay(timeTN-pwC3a-WFG_START_DELAY-gt1-2.0*GRADIENT_DELAY-1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else  zgradpulse(icosel*gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
          obspower(tpwrs);
          if (tpwrsf<4095.0)
	   {obspwrf(tpwrsf);				       /* POWER_DELAY */
	    delay(1.0e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(1.0e-4 - POWER_DELAY);
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - pwHs - 0.5e-4);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
          obspower(tpwr);
          if (tpwrsf<4095.0)
	   {obspwrf(4095.0);				       /* POWER_DELAY */
	    delay(0.50e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(0.50e-4 - POWER_DELAY);
	}
    else
	{
	  txphase(three);
          delay(timeTN - pwC3a - WFG_START_DELAY - gt1 - 2.0*GRADIENT_DELAY
							    - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else  zgradpulse(icosel*gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
          obspower(tpwrs);
          if (tpwrsf<4095.0)
	   {obspwrf(tpwrsf);				       /* POWER_DELAY */
	    delay(1.0e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(1.0e-4 - POWER_DELAY);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2);
          obspower(tpwr);
          if (tpwrsf<4095.0)
	   {obspwrf(4095.0);				       /* POWER_DELAY */
	    delay(0.50e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(0.50e-4 - POWER_DELAY);
	 }
}
else
{
    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(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*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(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*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(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*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(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*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  */
	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(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);
	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 +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(gzcal*gzlvl2, gt1/10.0);
        else   zgradpulse(gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4 );

	setreceiver(t12);
}		 
Example #15
0
void 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 */

/* the following pulse lengths for SLP pulses are automatically calculated    */
/* by the macro "proteincal".  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 = getval("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 = getval("pwC6"),     /* 90 degree selective sinc pulse on CO(174ppm) */
   pwC8 = getval("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;

    /* 180 degree pulse on Ca, null at CO 118ppm away */
        rf3 = (compC*4095.0*pwC*2.0)/pwC3a;
	rf3 = (int) (rf3 + 0.5);

    /* 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;

    /* 90 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */
	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 */
	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);
 
   /* 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);
    
    if (tpwrsf<4095.0) {obspower(tpwrs+6.0); obspwrf(tpwrsf);}
     else obspower(tpwrs);
    shaped_pulse("H2Osinc", pwHs, zero, 5.0e-4, 0.0);
    obspower(tpwrd); 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);
}		 
Example #16
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];			    /* do TROSY on N15 and H1 */

 
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 */
	    ni = getval("ni"),
	    ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            t1a,                       /* time increments for first dimension */
            t1b,
            t1c,
	    tauCH = getval("tauCH"), 		         /* 1/4J delay for CH */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
            timeAB = getval("timeAB"),	   /* set timeAB=1.9e-3 to get only Ha */
            				  /* set timeAB=3.3e-3 to maximize Hb */
            				  /* set timeAB=2.8e-3 for both Ha/Hb */
	    zeta = 3.0e-3,
	    eta = 4.6e-3,
	    theta = 14.0e-3,
	    kappa = 5.4e-3,
	    lambda = 2.4e-3,
            sheila,  /* to transfer J evolution time hyperbolically into tau1 */
            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	rf0,            	  /* maximum fine power when using pwC pulses */

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

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

/* the following pulse lengths for SLP pulses are automatically calculated    */
/* by the macro "proteincal".  SLP pulse shapes, "offC4" etc are called       */
/* directly from your shapelib.                    			      */
   pwC4 = getval("pwC4"),  /*180 degree pulse at Ca(56ppm) null at CO(174ppm) */
   pwC5 = getval("pwC5"),     /* 90 degree selective sinc pulse on CO(174ppm) */
   pwC7 = getval("pwC7"),    /* 180 degree selective sinc pulse on CO(174ppm) */
   rf4,	                           /* fine power for the pwC4 ("offC4") pulse */
   rf5,	                           /* fine power for the pwC5 ("offC5") pulse */
   rf7,	                           /* fine power for the pwC7 ("offC7") pulse */

   compH = getval("compH"),       /* adjustment for C13 amplifier compression */
   compC = getval("compC"),       /* adjustment for C13 amplifier compression */
   phi7cal = getval("phi7cal"),  /* phase in degrees of the last C13 90 pulse */

   	pwH,	    		        /* H1 90 degree pulse length at tpwr1 */
   	tpwr1,	  	                            /* 7.3 kHz rf for DIPSI-2 */
   	DIPSI2time,     	        /* total length of DIPSI-2 decoupling */
        ncyc_dec,
        waltzB1=getval("waltzB1"),     /* RF strength for 1H decoupling      */

	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,1,phx);
	settable(t4,1,phx);
	settable(t5,2,phi5);
	settable(t6,2,phi6);
   if (TROSY[A]=='y')
       {settable(t8,1,phy);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,2,recT);}
    else
       {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); }

    if( pwC > 24.0e-6*600.0/sfrq )
	{ printf("increase pwClvl so that pwC < 24*600/sfrq");
	  psg_abort(1); }

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

    /* 90 degree pulse on Cab, null at CO 128ppm away */
	pwC1 = sqrt(15.0)/(4.0*128.0*dfrq);
        rf1 = (compC*4095.0*pwC)/pwC1;
	rf1 = (int) (rf1 + 0.5);
	
    /* 180 degree pulse on Cab, null at CO 128ppm away */
        pwC2 = sqrt(3.0)/(2.0*128.0*dfrq);
	rf2 = (4095.0*compC*pwC*2.0)/pwC2;
	rf2 = (int) (rf2 + 0.5);	
	
    /* 180 degree pulse on Ca, null at CO 118ppm away */
	rf4 = (compC*4095.0*pwC*2.0)/pwC4;
	rf4 = (int) (rf4 + 0.5);

    /* 90 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */
	rf5 = (compC*4095.0*pwC*1.69)/pwC5;	/* needs 1.69 times more     */
	rf5 = (int) (rf5 + 0.5);		/* power than a square pulse */

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

    /* power level and pulse times for DIPSI 1H decoupling */
	DIPSI2time = 2.0*3.0e-3 + 2.0*14.0e-3 + 2.0*timeTN - 5.4e-3 + 0.5*pwC1 + 2.0*pwC5 + 5.0*pwN + 2.0*gt3 + 1.0e-4 + 4.0*GRADIENT_DELAY + 2.0*POWER_DELAY + 8.0*PRG_START_DELAY;
        pwH = 1.0/(4.0*waltzB1);
	ncyc_dec = (DIPSI2time*90.0)/(pwH*2590.0*4.0);
        ncyc_dec = (int) (ncyc_dec+0.5);
	pwH = (DIPSI2time*90.0)/(ncyc_dec*2590.0*4.0); /*fine correction of pwH */
	tpwr1 = 4095.0*(compH*pw/pwH);
	tpwr1 = (int) (2.0*tpwr1 + 0.5);   /* x2 because obs atten will be reduced by 6dB */
 


if (ix == 1)
      {
        fprintf(stdout, "\nNo of DIPSI-2 cycles = %4.1f\n",ncyc_dec);
        fprintf(stdout, "\nfine power for DIPSI-2 pulse =%6.1f\n",tpwr1);
      }


/* 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 ( dm3[A] == 'y' || dm3[C] == 'y' )
       { printf("incorrect dec3 decoupler flags! Should be 'nyn' or 'nnn' ");
							             psg_abort(1);}
    if ( dpwr2 > 50 )
       { printf("dpwr2 too large! recheck value  "); psg_abort(1);}

    if ( pw > 20.0e-6 )
       { printf(" pw too long ! recheck value "); psg_abort(1);} 
  
    if ( pwN > 100.0e-6 )
       { printf(" pwN too long! recheck value "); psg_abort(1);} 
 
    if ( TROSY[A]=='y' && dm2[C] == 'y' )
       { text_error("Choose either TROSY='n' or dm2='n' ! "); psg_abort(1);}



/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 2)   tsadd(t3,1,4);  
    if (TROSY[A]=='y')
	 {  if (phase2 == 2)   				      icosel = +1;
            else 	    {tsadd(t4,2,4);  tsadd(t10,2,4);  icosel = -1;}
	 }
    else {  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; }
    tau1 = tau1/2.0;



/*  Hyperbolic sheila seems superior to original zeta approach  */

                                  /* subtract unavoidable delays from tauCH */
    tauCH = tauCH - gt0 - 2.0*GRADIENT_DELAY - 5.0e-5;

 if ((ni-1)/(2.0*sw1) > 2.0*tauCH)
    {
      if (tau1 > 2.0*tauCH) sheila = tauCH;
      else if (tau1 > 0) sheila = 1.0/(1.0/tau1+1.0/tauCH-1.0/(2.0*tauCH));
      else          sheila = 0.0;
    }
 else
    {
      if (tau1 > 0) sheila = 1.0/(1.0/tau1 + 1.0/tauCH - 2.0*sw1/((double)(ni-1)));
      else          sheila = 0.0;
    }
    t1a = tau1 + tauCH;
    t1b = tau1 - sheila;
    t1c = tauCH - sheila;



/*  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); }


/* For ni<2 (calibration) set timeAB=1.5ms to get avoid signal cancellation between Ha and Hb */
   if (ni < 2.0) timeAB=1.5e-3;



/* BEGIN PULSE SEQUENCE */


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

        if ((ni/sw1-d2)>0)
         delay(ni/sw1-d2);       /*decreases as t1 increases for const.heating*/
        if ((ni2/sw2-d3)>0)
         delay(ni2/sw2-d3);      /*decreases as t2 increases for const.heating*/
        if ( dm3[B] == 'y' )
          { lk_hold(); lk_sampling_off();}  /*freezes z0 correction, stops lock pulsing*/

        rcvroff();
        obspower(tpwr);
        decpower(pwClvl);
        dec2power(pwNlvl);
        decpwrf(rf0);
        obsoffset(tof);
        txphase(one);
        delay(1.0e-5);
        if (TROSY[A] == 'n')
        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);
        if (TROSY[A] == 'n')
        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);

      if ( dm3[B] == 'y' )     /* begins optional 2H decoupling */
        {
          gzlvl0=0.0; gzlvl3=0.0; gzlvl4=0.0;   /* no gradients during 2H decoupling */
          dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
          dec3unblank();
          dec3phase(zero);
          delay(2.0e-6);
          setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
        }

        rgpulse(pw, one, 0.0, 0.0);                    /* 1H pulse excitation */
                                                                /* point a */
        txphase(zero);
        decphase(zero);
        zgradpulse(gzlvl0, gt0);                        /* 2.0*GRADIENT_DELAY */
        delay(5.0e-5);
        if((t1a -2.0*pwC) > 0.0) delay(t1a - 2.0*pwC);

        decrgpulse(2.0*pwC, zero, 0.0, 0.0);

        delay(t1b);

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

        zgradpulse(gzlvl0, gt0);                        /* 2.0*GRADIENT_DELAY */
        txphase(t3);
        delay(5.0e-5);
        delay(t1c);
                                                                /* point b */
        rgpulse(pw, t3, 0.0, 0.0);
        zgradpulse(gzlvl3, gt3);
        delay(2.0e-4);
        decrgpulse(pwC, zero, 0.0, 0.0);
                                                                /* point c */
        zgradpulse(gzlvl4, gt4);
        decpwrf(rf2);
        delay(timeAB - gt4);

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

        zgradpulse(gzlvl4, gt4);
        delay(timeAB - gt4);
                                                                /* point d */

/* ghc_co_nh STOPS HERE */
/* gcbca_co_nh STARTS HERE */


	decpwrf(rf1);                                         	/* point b */
   	decrgpulse(pwC1, zero, 2.0e-6, 0.0);
	obspwrf(tpwr1); obspower(tpwr-6);				      /* POWER_DELAY */
	obsprgon("dipsi2", pwH, 5.0);		          /* PRG_START_DELAY */
	xmtron();
                    						/* point c */
	decpwrf(rf0);
	decphase(t5);
	delay(zeta - 2.0*POWER_DELAY - PRG_START_DELAY - 0.5*10.933*pwC);

	decrgpulse(pwC*158.0/90.0, t5, 0.0, 0.0);
	decrgpulse(pwC*171.2/90.0, t6, 0.0, 0.0);
	decrgpulse(pwC*342.8/90.0, t5, 0.0, 0.0);	/* Shaka composite   */
	decrgpulse(pwC*145.5/90.0, t6, 0.0, 0.0);
	decrgpulse(pwC*81.2/90.0, t5, 0.0, 0.0);
	decrgpulse(pwC*85.3/90.0, t6, 0.0, 0.0);

	decpwrf(rf1);
	decphase(zero);
	delay(zeta - 0.5*10.933*pwC - 0.5*pwC1);
                     						/* point d */
   	decrgpulse(pwC1, zero, 0.0, 0.0);
	decphase(t5);
	decpwrf(rf5);
        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           lk_autotrig();   /* resumes lock pulsing */
           }
	zgradpulse(gzlvl3, gt3);
	delay(2.0e-4);
	decshaped_pulse("offC5", pwC5, t5, 0.0, 0.0);
					      			/* point e */
	decpwrf(rf4);
 	decphase(zero);
	delay(eta);

	decshaped_pulse("offC4", pwC4, zero, 0.0, 0.0);

	decpwrf(rf7);		
	dec2phase(zero);
	delay(theta - eta - pwC4 - WFG3_START_DELAY);
							 /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC7", "", 0.0, pwC7, 2.0*pwN, zero, zero, zero, 
								     0.0, 0.0);

	decpwrf(rf5);
	decpwrf(rf5);
	initval(phi7cal, v7);
	decstepsize(1.0);
	dcplrphase(v7);					       /* SAPS_DELAY */
	dec2phase(t8);
	delay(theta - SAPS_DELAY);
                           					/* point f */
	decshaped_pulse("offC5", pwC5, zero, 0.0, 0.0);

/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

	zgradpulse(gzlvl3, gt3);
        if (TROSY[A]=='y') { xmtroff(); obsprgoff(); }
     	delay(2.0e-4);
	dcplrphase(zero);
	dec2rgpulse(pwN, t8, 0.0, 0.0);

	decpwrf(rf7);
	decphase(zero);
	dec2phase(t9);
	delay(timeTN - WFG3_START_DELAY - tau2);
							 /* WFG3_START_DELAY  */
	sim3shaped_pulse("", "offC7", "", 0.0, pwC7, 2.0*pwN, zero, zero, t9, 
								    0.0, 0.0);

	dec2phase(t10);
        decpwrf(rf4);

if (TROSY[A]=='y')
{
    if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
	{
	  txphase(t4);
          delay(timeTN - pwC4 - WFG_START_DELAY);          /* WFG_START_DELAY */
          decshaped_pulse("offC4", pwC4, 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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);
	}
    else
	{
	  txphase(t4);
          delay(timeTN -pwC4 -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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);                    /* WFG_START_DELAY */
          decshaped_pulse("offC4", pwC4, zero, 0.0, 0.0);
          delay(tau2);
	}
}
else
{
    if (tau2 > kappa)
	{
          delay(timeTN - pwC4 - WFG_START_DELAY);     	   /* WFG_START_DELAY */
          decshaped_pulse("offC4", pwC4, zero, 0.0, 0.0);
          delay(tau2 - kappa - PRG_STOP_DELAY);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);
	}
    else if (tau2 > (kappa - pwC4 - WFG_START_DELAY))
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  txphase(t4);                                  /* WFG_START_DELAY */
          decshaped_pulse("offC4", pwC4, zero, 0.0, 0.0);
          delay(kappa -pwC4 -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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);
	}
    else if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  txphase(t4);
          delay(kappa - tau2 - pwC4 - WFG_START_DELAY);   /* WFG_START_DELAY */
          decshaped_pulse("offC4", pwC4, 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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);
	}
    else
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY);
          xmtroff();
	  obsprgoff();					    /* PRG_STOP_DELAY */
	  txphase(t4);
    	  delay(kappa-tau2-pwC4-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 */
	  obspwrf(4095.0); obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - 2.0*POWER_DELAY);                    /* WFG_START_DELAY */
          decshaped_pulse("offC4", pwC4, zero, 0.0, 0.0);
          delay(tau2);
	}
}                                                            	/* point g */
/*  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(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);
	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 +gstab - 0.5*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);

	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);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4 - rof1);
   if (dm3[B]=='y') lk_sample();

	setreceiver(t12);
}		 
Example #17
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 */
 	    SCT[MAXSTR],    /* Semi-constant time flag for N-15 evolution */
	    CT_c[MAXSTR],            /* Constant time flag for C-13 evolution */
 	    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 */
            t2_counter,  	 	        /* used for states tppi in t2 */
            PRexp,                          /* projection-reconstruction flag */
	    ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
	    tauC = getval("tauC"), 	      /* delay for CO to Ca evolution */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    timeTC = getval("timeTC"),     /* constant time for 13C evolution */
	    t2a=0.0, t2b=0.0, halfT2=0.0, CTdelay=0.0,
	    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 */

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

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

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

   dofCO,			       /* channel 2 offset for most CO pulses */
	
   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 */

        csa, sna,
        pra = M_PI*getval("pra")/180.0,
   	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"),
	gt7 = getval("gt7"),
	gt9 = getval("gt9"),
	gt10 = getval("gt10"),
	gstab = getval("gstab"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),
	gzlvl6 = getval("gzlvl6"),
	gzlvl7 = getval("gzlvl7"),
	gzlvl8 = getval("gzlvl8"),
	gzlvl9 = getval("gzlvl9"),
	gzlvl10 = getval("gzlvl10");

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

/*   LOAD PHASE TABLE    */
     
	settable(t3,2,phi3);
	settable(t4,1,phx);
	settable(t5,4,phi5);
   if (TROSY[A]=='y')
       {settable(t8,1,phy);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,4,recT);}
    else
       {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); }

    /* offset during CO pulses, except for t1 evolution period */	
	dofCO = dof + 118.0*dfrq;

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

     /* 90 degree pulse on Ca, null at CO 118ppm away */
       pwC1 = sqrt(15.0)/(4.0*118.0*dfrq);
        rf1 = 4095.0*(compC*pwC)/pwC1;
        rf1 = (int) (rf1 + 0.5);

    /* 180 degree pulse on Ca, null at CO 118ppm away */
        pwC2 = sqrt(3.0)/(2.0*118.0*dfrq);
	rf2 = (compC*4095.0*pwC*2.0)/pwC2;
        rf2 = (int) (rf2 + 0.5);
        if( rf2 > 4095.0 )
       { printf("increase pwClvl so that C13 90 < 24us*(600/sfrq)"); psg_abort(1);}

    /* 180 degree pulse on Ca, null at CO 118ppm away */
	rf3 = (compC*4095.0*pwC*2.0)/pwC3;
	rf3 = (int) (rf3 + 0.5);

    /* 90 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */
	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 */
	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 */

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

    /* the pwC9 pulse at the middle of t1  */
        if ((ni2 > 0.0) && (ni == 1.0)) ni = 0.0;
        if (pwC8 > 2.0*pwN) pwZ = pwC8; else pwZ = 2.0*pwN;
        if ((pwC9==0.0) && (pwC8>2.0*pwN)) pwZ1=pwC8-2.0*pwN; else pwZ1=0.0;
	if ( ni > 1 )     pwC9 = pwC8;
	if ( pwC9 > 0 )   phshift9 = 140.0;
	else              phshift9 = 0.0;
	
    /* 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) ;                              /* 7.5 kHz rf   */
	tpwrd = tpwr - 20.0*log10(pwHd/(compH*pw));
	tpwrd = (int) (tpwrd + 0.5);
 
/* set up Projection-Reconstruction experiment */
 
    tau1 = d2; tau2 = d3; 
    PRexp=0; csa = 1.0; sna = 0.0;   
    if((pra > 0.0) && (pra < 90.0)) /* PR experiments */
    {
      PRexp = 1;
      csa = cos(pra); 
      sna = sin(pra);
      tau1 = d2*csa;  
      tau2 = d2*sna;
    }

/* CHECK VALIDITY OF PARAMETER RANGES */

    if(SCT[A] == 'n')
    {
      if (PRexp) 
      {
        if( 0.5*ni*sna/sw1 > timeTN - WFG3_START_DELAY)
          { printf(" ni is too big. Make ni equal to %d or less.\n",
          ((int)((timeTN - WFG3_START_DELAY)*2.0*sw1/sna)));         psg_abort(1);}
      }
      else 
      {
        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(CT_c[A] == 'y')
    {
      if ( 0.5*ni*csa/sw1 > timeTC)
       { printf(" ni is too big. Make ni less than %d or less.\n", 
         ((int)(timeTC*2.0*sw1/csa - 4e-6 - SAPS_DELAY)));           psg_abort(1);} 	 	                                  
    }

    if ( tauC < (gt7+1.0e-4+0.5*10.933*pwC))  gt7=(tauC-1.0e-4-0.5*10.933*pwC);

    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 ( dm3[A] == 'y' || dm3[C] == 'y' )
       { printf("incorrect dec3 decoupler flags! Should be 'nyn' or 'nnn' ");
							             psg_abort(1);}	
    if ( dpwr2 > 50 )
       { printf("dpwr2 too large! recheck value  ");		     psg_abort(1);}

    if ( pw > 20.0e-6 )
       { printf(" pw too long ! recheck value ");	             psg_abort(1);} 
  
    if ( pwN > 100.0e-6 )
       { printf(" pwN too long! recheck value ");	             psg_abort(1);} 
 
    if ( TROSY[A]=='y' && dm2[C] == 'y')
       { text_error("Choose either TROSY='n' or dm2='n' ! ");        psg_abort(1);}



/* PHASES AND INCREMENTED TIMES */

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

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

/* 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); }

/* Set up CONSTANT/SEMI-CONSTANT time evolution in N15 */

    halfT2 = 0.0;  
    CTdelay = timeTN + pwC8 + WFG_START_DELAY - SAPS_DELAY;

    if(ni>1)                
    {
      if(f1180[A] == 'y')     /*  Set up f1180 */
        tau1 += 0.5*csa/sw1;  /* if not PRexp then csa = 1.0 */
      if(PRexp)
      {
        halfT2 = 0.5*(ni-1)/sw1;  /* ni2 is not defined */
        if(f1180[A] == 'y') 
        { tau2 += 0.5*sna/sw1; halfT2 += 0.25*sna/sw1; }
        t2b = (double) t1_counter*((halfT2 - CTdelay)/((double)(ni-1)));
      }
    }
    if (ni2>1)
    {
      halfT2 = 0.5*(ni2-1)/sw2;
      if(f2180[A] == 'y')        /*  Set up f2180  */
      { tau2 += 0.5/sw2; halfT2 += 0.25/sw2; }
      t2b = (double) t2_counter*((halfT2 - CTdelay)/((double)(ni2-1)));
    }
    tau1 = tau1/2.0;
    tau2 = tau2/2.0;
    if(tau1 < 0.2e-6) tau1 = 0.0; 
    if(tau2 < 0.2e-6) tau2 = 0.0; 

    if(t2b < 0.0) t2b = 0.0;
    t2a = CTdelay - tau2 + t2b;
    if(t2a < 0.2e-6)  t2a = 0.0;

/* uncomment these lines to check t2a and t2b 
    printf("%d: t2a = %.12f", t2_counter,t2a);
    printf(" ; t2b = %.12f\n", t2b);
*/


/* BEGIN PULSE SEQUENCE */

status(A);
   	delay(d1);
        if ( dm3[B] == 'y' )
          { lk_hold(); lk_sampling_off();}  /*freezes z0 correction, stops lock pulsing*/
 
	rcvroff();
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rf0);
	obsoffset(tof);
	decoffset(dofCO);
	txphase(zero);
   	delay(1.0e-5);

       if (TROSY[A] == 'n')
	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);
       if (TROSY[A] == 'n')
	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);
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf);
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */

if (TROSY[A]=='y')
   {txphase(two);
    shaped_pulse("H2Osinc", pwHs, two, 5.0e-4, 0.0);
    obspower(tpwr); obspwrf(4095.0);
    zgradpulse(gzlvl3, gt3);
    delay(2.0e-4);
    dec2rgpulse(pwN, zero, 0.0, 0.0);

    delay(0.5*kappa - 2.0*pw);

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

    obspower(tpwrd);	  				       /* POWER_DELAY */
    decphase(zero);
    dec2phase(zero);
    decpwrf(rf8);
    delay(timeTN -0.5*kappa - POWER_DELAY - WFG3_START_DELAY);
   }
else
   {txphase(zero);
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf); 
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */
    shaped_pulse("H2Osinc",pwHs,zero,5.0e-4,0.0);
    obspower(tpwrd); 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(zero);
	decpwrf(rf6);
	delay(timeTN);

	dec2rgpulse(pwN, zero, 0.0, 0.0);
if (TROSY[A]=='n')
   {xmtroff();
    obsprgoff();
    rgpulse(pwHd,three,2.0e-6,0.0);}
	zgradpulse(-gzlvl3, gt3);
 	delay(2.0e-4);
	decshaped_pulse("offC6", pwC6, zero, 0.0, 0.0);

	zgradpulse(-gzlvl7, gt7);
	decpwrf(rf0);
	decphase(zero);
	delay(tauC - gt7 - 0.5*10.933*pwC);

	decrgpulse(pwC*158.0/90.0, zero, 0.0, 0.0);
	decrgpulse(pwC*171.2/90.0, two, 0.0, 0.0);
	decrgpulse(pwC*342.8/90.0, zero, 0.0, 0.0);      /* Shaka 6 composite */
	decrgpulse(pwC*145.5/90.0, two, 0.0, 0.0);
	decrgpulse(pwC*81.2/90.0, zero, 0.0, 0.0);
	decrgpulse(pwC*85.3/90.0, two, 0.0, 0.0);

	zgradpulse(-gzlvl7, gt7);
	decpwrf(rf6);
	decphase(one);
	txphase(one);
        delay(tauC - gt7 - 0.5*10.933*pwC - WFG_START_DELAY);
							   /* WFG_START_DELAY */
	decshaped_pulse("offC6", pwC6, one, 0.0, 0.0);
	decoffset(dof);
	zgradpulse(-gzlvl9, gt9);
	decpwrf(rf1);
	decphase(t3);
	delay(2.0e-4);
      if ( dm3[B] == 'y' )     /* begins optional 2H decoupling */
        {
          dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
          dec3unblank();
          dec3phase(zero);
          delay(2.0e-6);
          setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
        }
        rgpulse(pwHd,one,0.0,0.0);
	txphase(zero);
 	delay(2.0e-6);
	obsprgon("waltz16", pwHd, 90.0);
	xmtron();

	decrgpulse(pwC1, t3, 0.0, 0.0);
	decphase(zero);

/*   xxxxxxxxxxxxxxxxxxxxxx       13Ca EVOLUTION        xxxxxxxxxxxxxxxxxx    */

  if (ni==1.0)         /* special 1D check of pwC9 phase enabled when ni=1 */
  {
        decpwrf(rf9);
	delay(10.0e-6 + SAPS_DELAY + 0.5*pwZ1);
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC9", "", 0.0, pwC9, 2.0*pwN, zero, zero, zero,
							          2.0e-6, 0.0);
	initval(phshift9, v9);
	decstepsize(1.0);
	dcplrphase(v9);  					/* SAPS_DELAY */
	delay(10.0e-6 + WFG3_START_DELAY + 0.5*pwZ1);
  }
  else if(CT_c[A] == 'y')           /* xxxxxxx 13Ca Constant Time EVOLUTION xxxxxxxx */
  {
    decpwrf(rf9);
    if(tau1 - 2.0*pwC1/PI - WFG_START_DELAY -POWER_DELAY > 0.0) {
       delay(tau1 -2.0*pwC1/PI -POWER_DELAY -WFG_START_DELAY);
       sim3shaped_pulse("","offC9","",0.0,pwC8, 2.0*pwN, zero, zero, zero, 
								0.0, 0.0);
    }
    else
       sim3shaped_pulse("","offC9","",0.0,pwC8, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
    
    delay(timeTC- 2.0e-6 -WFG_STOP_DELAY-POWER_DELAY); 

    decpwrf(rf2);
    decrgpulse(pwC2, zero, 2.0e-6, 2.0e-6); 	             /* 13Ca 180 degree pulse */ 

    delay(timeTC-tau1- 4.0e-6 -SAPS_DELAY);
    
    phshift9 = 230.0;  /* = 320-90 - correction for -90 degree phase shift in F1 */
    initval(phshift9, v9);
    decstepsize(1.0);
    dcplrphase(v9);                                         /* SAPS_DELAY */
  }
  else                         /* xxxxxxx 13Ca Conventional EVOLUTION xxxxxxxxx */
  {
    if ((ni>1.0) && (tau1>0.0))          /* total 13C evolution equals d2 exactly */
    {         /* 2.0*pwC1/PI compensates for evolution at 64% rate during pwC1 */
       decpwrf(rf9);
       if(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 0.5*pwZ > 0.0)
       {	   
	   delay(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 0.5*pwZ);
							  
	   sim3shaped_pulse("", "offC9", "", 0.0, pwC8, 2.0*pwN, zero, zero, zero,
								      0.0, 0.0);
	   initval(phshift9, v9);
	   decstepsize(1.0);
	   dcplrphase(v9);  				        /* SAPS_DELAY */
	   delay(tau1 - 2.0*pwC1/PI  - SAPS_DELAY - 0.5*pwZ - 2.0e-6);
       }
       else
       {
	 initval(180.0, v9);
	 decstepsize(1.0);
	 dcplrphase(v9);  				        /* SAPS_DELAY */
	 delay(2.0*tau1 - 4.0*pwC1/PI - SAPS_DELAY - 2.0e-6);
       }
    }
    else		       /* 13Ca evolution refocused for 1st increment  */
    {
	decpwrf(rf2);
	delay(10.0e-6);	
	decrgpulse(pwC2, zero, 2.0e-6, 0.0);
	delay(10.0e-6);	
    }
  }
        decphase(t5);
	decpwrf(rf1);
	decrgpulse(pwC1, t5, 2.0e-6, 0.0);


/*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

	xmtroff();
	obsprgoff();
        rgpulse(pwHd,three,2.0e-6,0.0);
	decoffset(dofCO);
	decpwrf(rf6);
	decphase(one);
        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           lk_autotrig();   /* resumes lock pulsing */
           }
	zgradpulse(gzlvl10, gt10);
 	delay(2.0e-4);
	decshaped_pulse("offC6", pwC6, one, 0.0, 0.0);

	zgradpulse(gzlvl8, gt7);
	decpwrf(rf0);
	decphase(zero);
	delay(tauC - gt7 - 0.5*10.933*pwC);

	decrgpulse(pwC*158.0/90.0, zero, 0.0, 0.0);
	decrgpulse(pwC*171.2/90.0, two, 0.0, 0.0);
	decrgpulse(pwC*342.8/90.0, zero, 0.0, 0.0);	/* Shaka 6 composite */
	decrgpulse(pwC*145.5/90.0, two, 0.0, 0.0);
	decrgpulse(pwC*81.2/90.0, zero, 0.0, 0.0);
	decrgpulse(pwC*85.3/90.0, two, 0.0, 0.0);

	zgradpulse(gzlvl8, gt7);
	decpwrf(rf6);
	decphase(zero);
	delay(tauC - gt7 - 0.5*10.933*pwC - WFG_START_DELAY);
							   /* WFG_START_DELAY */
	decshaped_pulse("offC6", pwC6, zero, 0.0, 0.0);

/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

	zgradpulse(gzlvl4, gt4);
	txphase(one);
	decphase(zero);
	decpwrf(rf8);
	dcplrphase(zero);
	dec2phase(t8);
 	delay(2.0e-4);
 	
        if (TROSY[A]=='n')
	   {rgpulse(pwHd,one,0.0,0.0);
	    txphase(zero);
	    delay(2.0e-6);
	    obsprgon("waltz16", pwHd, 90.0);
	    xmtron();}
	    
	dec2rgpulse(pwN, t8, 0.0, 0.0); /* N15 EVOLUTION BEGINS HERE */
	dec2phase(t9);

        if(SCT[A] == 'y')
        {
	  delay(t2a);
          dec2rgpulse(2.0*pwN, t9, 0.0, 0.0);
	  delay(t2b);
          decshaped_pulse("offC8", pwC8, zero, 0.0, 0.0); /* WFG_START_DELAY  */
        }
        else
        {	
	  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 (TROSY[A]=='y')
{    if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.5e-4 + pwHs)
	{
	  txphase(three);
          delay(timeTN - pwC3 - WFG_START_DELAY);         /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')  magradpulse(gzcal*gzlvl1, gt1);
          else  zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf); 
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
          obspower(tpwr); obspwrf(4095.0);
	  txphase(t4);
	  delay(0.5e-4 - POWER_DELAY);
	}

    else if (tau2 > pwHs + 0.5e-4)
	{
	  txphase(three);
          delay(timeTN-pwC3-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(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                     /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3, zero, 0.0, 0.0);
          delay(tau2 - pwHs - 0.5e-4);
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf); 
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
          obspower(tpwr); obspwrf(4095.0);
	  txphase(t4);
	  delay(0.5e-4 - POWER_DELAY);
	}
    else
	{
	  txphase(three);
          delay(timeTN - pwC3 - WFG_START_DELAY - gt1 - 2.0*GRADIENT_DELAY
							    - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else  zgradpulse(gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                     /* WFG_START_DELAY */
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf); 
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
          obspower(tpwr); obspwrf(4095.0);
	  txphase(t4);
	  delay(0.5e-4 - POWER_DELAY);
          decshaped_pulse("offC3", pwC3, zero, 0.0, 0.0);
          delay(tau2);
	}
}
else
{
    if (tau2 > kappa)
	{
          delay(timeTN - pwC3 - WFG_START_DELAY);     	   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3, 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 - pwC3 - 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", pwC3, zero, 0.0, 0.0);
          delay(kappa -pwC3 -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 - pwC3 - WFG_START_DELAY);   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3, 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-pwC3-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", pwC3, zero, 0.0, 0.0);
          delay(tau2);
	}
}                                                          
/*  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(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);
	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 +gstab - 0.5*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);

	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);            /* 2.0*GRADIENT_DELAY */

        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4 - rof1);
   if (dm3[B]=='y') lk_sample();

	setreceiver(t12);
}		 
Example #18
0
pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */


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


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

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

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


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




	sw1 = getval("sw1"),

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

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



/*   LOAD PHASE TABLE    */

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

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

/*   INITIALIZE VARIABLES   */



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

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



/* CHECK VALIDITY OF PARAMETER RANGES */


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


/* PHASES AND INCREMENTED TIMES */

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

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

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

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


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

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

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

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


/*   xxxxxxxxxxxxxxxxxxxxxx   13Cab Constant Time Evolution       xxxxxxxxxxxxxxxxxx    */

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

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

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

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

       rgpulse(pwC1,t2,0.0,0.0);
       status(C);
       zgradpulse(gzlvl1, gt1);
       delay(gstab);
/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxx  FLOPSY 8 Spin lock for mixing xxxxxxxxxxxxxxxxxxxx	*/
       obspower(mixpwr); obspwrf(rf0); txphase(zero);
       obsunblank();
       xmtron();
       obsprgon("mix_seq",1.0/mixdmf,mixdres);
       delay(mix-gt1-gt2);
       obsprgoff();
       xmtroff();
       obsblank();
       obspower(pwClvl); obspwrf(rf1);
       zgradpulse(gzlvl2,gt2);
       delay(gstab);
       rgpulse(pwC1,t3,0.0,rof2);
       getelem(t3,ct,v3);
       add(v3,one,v3);
       obspower(pwClvl); obspwrf(rf0);
       delay(350e-6-rof2);
       rgpulse(pwC*2.0,v3,0.0,0.0);
       delay(350e-6);
       
       status(D);
       setreceiver(t12); 
       
}		 
Example #19
0
void pulsesequence()
{
/* DECLARE VARIABLES */

 char      
 	     f1180[MAXSTR],f2180[MAXSTR],satmode[MAXSTR];

 int	     icosel,t1_counter,t2_counter,first_FID;

 double      /* DELAYS */
             tau1,                                 /* t1/2 */
             tau2,                                 /* t2/2 */

             /* COUPLINGS */
             jhn = getval("jhn"), tauhn,
             jnco = getval("jnco"), taunco,
             jcoca = getval("jcoca"), taucoca,
             jnca = getval("jnca"), taunca,
             jhaca = getval("jhaca"), tauhaca,
             jcaha = getval("jcaha"), taucaha,
             jcacb = getval("jcacb"), taucacb,
   
             /* PULSES */
             pwN = getval("pwN"),               /* PW90 for N-nuc */
             pwC = getval("pwC"),               /* PW90 for C-nuc */
             pwHs = getval("pwHs"),           /* pw for water selective pulse at twprsl */

             /* POWER LEVELS */
             satpwr = getval("satpwr"),       /* low power level for presat */
             tpwrsf_d = getval("tpwrsf_d"),   /* fine power level "down" flipback pulse*/
             tpwrsf_u = getval("tpwrsf_u"),   /* fine power level "up" flipback pulse*/
	     tpwrs,                          /* power level for selective pulse for water */
             tpwrd,pwHd,                     /* power/pulse width for decoupling */
             pwClvl = getval("pwClvl"),         /* power level for C hard pulses */ 
             compH = getval("compH"),           /* compression factor   */
             compC = getval("compC"),           /* compression factor   */
             pwNlvl = getval("pwNlvl"),         /* power level for N hard pulses */
             rf90onco, pw90onco,          /* power level/width for CO 90 pulses */ 
             rf180onco, pw180onco,        /* power level/width for CO 180 pulses */
             rf180offca, pw180offca,      /* power level/width for off-res Ca 180 pulses */

             /* CONSTANTS */
             lambda = getval("lambda"),     /* J scaling factor */
             kappa,                         /* semi constant-time factor */
             ni2=getval("ni2"),
             waltzB1 = getval("waltzB1"),  /* waltz16 field strength (in Hz)     */

             /* GRADIENT DELAYS AND LEVES */
             gt0 = getval("gt0"),       /* gradient time */
             gt1 = getval("gt1"),       /* gradient time */
             gt3 = getval("gt3"),       /* gradient time */
             gt5 = getval("gt5"),
             gstab = getval("gstab"),
             gzlvl0 = getval("gzlvl0"), /* level of gradient */
             gzlvl1 = getval("gzlvl1"),
             gzlvl2 = getval("gzlvl2"),
             gzlvl3 = getval("gzlvl3"),
             gzlvl5 = getval("gzlvl5");

    /* 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);
 

/* LOAD VARIABLES */

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

/* 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 ( satpwr > 8 )
    {
	printf("satpwr too large !!!  ");
	psg_abort(1);
    }

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

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

/* LOAD VARIABLES */

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

/* INITIALIZE VARIABLES */

  tauhn   = ((jhn != 0.0)  ? 1/(4*(jhn)) : 2.75e-3);
  taunco  = ((jnco !=0.0)  ? 1/(4*(jnco)) : 16.6e-3);
  taucoca = ((jcoca !=0.0) ? 1/(4*(jcoca)) : 4.5e-3);
  taunca  = ((jnca  !=0.0) ? 1/(4*(jnca))  : 12e-3);
  tauhaca = ((jhaca !=0.0) ? 1/(4*(jhaca)) : 12e-3);
  taucaha = ((jcaha !=0.0) ? 1/(4*(jcaha)) : 12e-3);
  taucacb = ((jcacb !=0.0) ? 1/(4*(jcacb)) : 12e-3);


       if((getval("arraydim") < 1.5) || (ix==1))
         first_FID = 1;
       else
         first_FID = 0;

    /* 90 degree pulse on CO, null at Ca 118ppm away */

        pw90onco = sqrt(15.0)/(4.0*118.0*dfrq);
        rf90onco = (4095.0*pwC*compC)/pw90onco;
        rf90onco = (int) (rf90onco + 0.5);
        if(rf90onco > 4095.0)
        {
          if(first_FID)
            printf("insufficient power for pw90onco -> rf90onco (%.0f)\n", rf90onco);
          rf90onco = 4095.0;
          pw90onco = pwC;
        }

    /* 180 degree pulse on CO, null at Ca 118ppm away */

        pw180onco = sqrt(3.0)/(2.0*118.0*dfrq);
        rf180onco = (4095.0*pwC*compC*2.0)/pw180onco;
        rf180onco = (int) (rf180onco + 0.5);
        if(rf180onco > 4095.0)
        {
          if(first_FID)
            printf("insufficient power for pw180onco -> rf180onco (%.0f)\n", rf180onco);
          rf180onco = 4095.0;
          pw180onco = pwC*2.0;
        }
        pw180offca = pw180onco;        rf180offca = rf180onco;


/* Phase incrementation for hypercomplex data */

   if (phase1 == 2)     	/* Hypercomplex in t1 */
      {
        tsadd(t4, 1, 4);
      }  
   
  if (phase1 == 4)           /* Hypercomplex in t1 */
     {
        tsadd(t4, 1, 4);
     }
   
     kappa=(taunco - tauhn)/(0.5*ni2/sw2)-0.001;
         if (kappa > 1.0) 
     {  
	                      kappa=1.0-0.01;
     }   
   
          if (phase2 == 1) /* Hypercomplex in t2 */
     {
	                        icosel = -1;
	                        tsadd(t2, 2, 4);
	                        tsadd(t3, 2, 4);
     }  
         else icosel = 1;   
         
         if (ix == 1)
           printf("semi constant time factor %4.6f\n",kappa);
   
/* calculate modification to phases based on current t1 values
   to achieve States-TPPI acquisition */
 
 
   if (ix == 1)
      d2_init = d2;
      t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5);

      if (t1_counter %2)  /* STATES-TPPI */
      {
        tsadd(t4,2,4);
        tsadd(t7,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(t7,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.0/(2.0*sw1));
   tau1 = tau1/2.0;
   
/* 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) );
   tau2 = tau2/2.0;   
   
/* 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 */
    if (tpwrsf_d<4095.0) tpwrs=tpwrs+6;   /* nominal tpwrsf_d ~ 2048 */
         /* tpwrsf_d,tpwrsf_u can be used to correct for radiation damping  */

/* BEGIN ACTUAL PULSE SEQUENCE */


status(A);
   obspower(satpwr);            /* Set power for presaturation    */
   decpower(pwClvl);             /* Set decoupler1 power to pwClvl  */
   decpwrf(rf90onco);
   dec2power(pwNlvl);            /* Set decoupler2 power to pwNlvl */

/* Presaturation Period */


  if (satmode[0] == 'y')
    {
      rgpulse(d1,zero,rof1,0.0);
      obspower(tpwr);                   /* Set power for hard pulses  */
    }
  else  
    {
      obspower(tpwr);                   /* Set power for hard pulses  */
      delay(d1);
    }

status(B);

   rcvroff();

   decpwrf(rf90onco);   /* Set decoupler1 power to rf90onco */
   sim3pulse(0.0,pw90onco,pwN,zero,zero,zero,rof1,rof1);  /* 90 for 15N and 13C' */

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

  /* transfer from HN to N by INEPT */
   
  /* shaped pulse for water flip-back */
         obspower(tpwrs); obspwrf(tpwrsf_d);
         shaped_pulse("H2Osinc_d",pwHs,one,2.0e-6,0.0);
         obspower(tpwr); obspwrf(4095.0);
  /* shaped pulse */

  rgpulse(pw,zero,rof1,0.0);

  zgradpulse(gzlvl0*1.3,gt0);
  delay(gstab);
   
  delay(tauhn - gt0 - gstab);  					 /* 1/(4JHN) */
   
  sim3pulse(2.0*pw,0.0,2.0*pwN,zero,zero,zero,rof1,rof1);

  delay(tauhn - gt0 - gstab);  					 /* 1/(4JHN) */
   
  zgradpulse(gzlvl0*1.3,gt0);
  delay(gstab);

  rgpulse(pw,three,rof1,0.0);   /* 90 1H */
   
  zgradpulse(gzlvl3,gt3);
  delay(gstab);
   
  decpwrf(rf180onco);   /* Set decoupler power to rf180onco */
  dec2rgpulse(pwN,zero,0.0,0.0);   /* 90 15N */

/* start transfer from N to CO */

  delay(5.5e-3 - pwHd - POWER_DELAY - PRG_START_DELAY); /* 1/(2JHN) */
  
  obspower(tpwrd);
  rgpulse(pwHd,one,rof1,0.0);
  txphase(zero);
  obsprgon("waltz16", pwHd, 90.0);
  xmtron();

   
   delay(taunco - 5.5e-3 - 0.5*pw180onco);  /* 1/(4JNCO) - 1/(2JHN) */

   sim3pulse(0.0,pw180onco,2.0*pwN,zero,zero,zero,rof1,rof1);

   delay(taunco - 5.5e-3 - 0.5*pw180onco); /* 1/(4JNCO) - 1/(2JHN) */

 /* turn proton decoupling off */ 
      xmtroff();
      obsprgoff();
      rgpulse(pwHd,three,rof1,0.0);
      obspower(tpwr);
 /* turned proton decoupling off */
   
   delay(5.5e-3 - PRG_STOP_DELAY - pwHd - POWER_DELAY); /* 1/(2JHN) */
   
/* Start in-phase filter */

   if (( phase1 == 1 || phase1 == 2))
      {

       dec2rgpulse(pwN,one,0.0,0.0);   /* 90 15N */

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

        /* shaped pulse WATER-FLIP-back */
             obspower(tpwrs); obspwrf(tpwrsf_d);
             shaped_pulse("H2Osinc_d",pwHs,one,rof1,0.0);
             obspower(tpwr); obspwrf(4095.0);
        /* shaped pulse */

       rgpulse(pw,one,rof1,0.0);    /* 90 1H */

	
        zgradpulse(gzlvl0*1.1,gt0);
        delay(gstab);

	delay(0.5*tauhn - gt0 - gstab);  /* 1/(8JNH) */
        dec2rgpulse(2.0*pwN,zero,0.0,0.0); /* 180 15N */
	delay(0.5*tauhn - gt0 - gstab);  /* 1/(8JNH) */

        zgradpulse(gzlvl0*1.1,gt0);
        delay(gstab);
	
        rgpulse(2.0*pw,zero,rof1,rof1); /* 180 1H */

        zgradpulse(gzlvl0*1.1,gt0);
        delay(gstab);

	delay(0.5*tauhn - gt0 -gstab); /* 1/(8JNH) */
        dec2rgpulse(2.0*pwN,zero,0.0,0.0); /* 180 15N */
        delay(0.5*tauhn - gt0 -gstab); /* 1/(8JNH) */


        zgradpulse(gzlvl0*1.1,gt0);
        delay(gstab);

        rgpulse(pw,one,rof1,0.0);  /* 90 1H */

        /* shaped pulse WATER-FLIP-back */
             obspower(tpwrs); obspwrf(tpwrsf_u);
             shaped_pulse("H2Osinc_u",pwHs,three,rof1,0.0);
             obspower(tpwr); obspwrf(4095.0);
        /* shaped pulse */

      }

/* start antiphase filter */

    if (( phase1 == 3 || phase1 == 4 ))
      {

        dec2rgpulse(pwN,one,0.0,0.0);  /* 90 15N */

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

        /* shaped pulse WATER-FLIP-back */
             obspower(tpwrs); obspwrf(tpwrsf_d);
             shaped_pulse("H2Osinc_d",pwHs,zero,rof1,0.0);
             obspower(tpwr); obspwrf(4095.0);
        /* shaped pulse */

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


        zgradpulse(gzlvl0*0.9,gt0);
        delay(gstab);
	
	delay(tauhn - gt0 - gstab - 2.0*pwN); /* 1/(4JNH) */
        sim3pulse(2.0*pw,0.0,2.0*pwN,zero,zero,zero,rof1,rof1); /* 180 1H and 15N */
	delay(tauhn - gt0 - gstab - 2.0*pwN); /* 1/(4JNH) */
	

        zgradpulse(gzlvl0*0.9,gt0);
        delay(gstab);

        rgpulse(pw,one,rof1,0.0);  /* 90 1H */

        /* shaped pulse WATER-FLIP-back */
             obspower(tpwrs); obspwrf(tpwrsf_u);
             shaped_pulse("H2Osinc_u",pwHs,three,rof1,0.0);
             obspower(tpwr); obspwrf(4095.0);
        /* shaped pulse */
      }

/* End of filter section */

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

	rgpulse(2.0*pw,zero,rof1,0.0);
        decpwrf(rf90onco);      /* Set decoupler power to rf90onco */
        decrgpulse(pw90onco,t4,0.0,0.0);   /* 90 for 13C */

/* record 13C' frequences and 13C'-15N coupling */

      delay(tau1);
      decpwrf(rf180offca);      /* Set decoupler power to rf180offca */
      simshaped_pulse("","offC3",2.0*pw,pw180offca,zero,zero,rof1,rof1); /* 180 for 1H and 13CA */
      decphase(zero);
      decpwrf(rf180onco);   
      delay(tau1);
      if (lambda>0.0)
      {
       delay(lambda*tau1);
       sim3pulse(0.0,pw180onco,2.0*pwN,zero,t5,zero,0.0,0.0);
       delay(lambda*tau1);
      } 
      else decrgpulse(pw180onco,t5,0.0,0.0);
   
      decpwrf(rf180offca); /* Set decoupler power to rf180offca */
      simshaped_pulse("","offC3",0.0,pw180offca,zero,zero,0.0,0.0); /* 180 CA */  
      decphase(zero);
      decpwrf(rf90onco); 
   
/* start reverse transfer from CO to N by INEPT */

       decrgpulse(pw90onco,zero,0.0,0.0); /* 90 for 13C' */
   
       zgradpulse(gzlvl3*0.7,gt3);
       delay(gstab);
     
       dec2rgpulse(pwN,t1,0.0,0.0);  	  /* 90 for 15N */
   
       delay((taunco - tauhn) - kappa*tau2);  /* 1/4J(NCO) - 1/4J(NH) - kt2/2 */
         
       dec2rgpulse(2.0*pwN,zero,0.0,0.0);     /* 180 for 15N */
             
       delay((1-kappa)*tau2);        /* (1-k)t2/2 */
      
       decpwrf(rf180onco);
       decrgpulse(pw180onco,zero,0.0,0.0);     /* 180 for 13C' */
       decpwrf(rf180offca);
   
       delay(taunco - tauhn - gt1 - gstab - pw180onco - pw180offca - 3.0*POWER_DELAY);
         
       zgradpulse(gzlvl1,gt1);
       delay(gstab);
   
       decshaped_pulse("offC3",pw180offca,zero,0.0,0.0);
         
       delay(tau2);                            /* t2/2 */
   
      /* start TROSY transfer from N to HN */
         
        rgpulse(pw,t2,rof1,0.0); /* 180 for 1H */
             
        zgradpulse(gzlvl5,gt5);
        delay(gstab);
    
        delay(tauhn - gt5 - gstab );
   
        decpwrf(rf180onco);
        sim3pulse(2.0*pw,pw180onco,2.0*pwN,zero,zero,zero,rof1,rof1);
      
        delay(tauhn - gt5 - gstab );
               
        zgradpulse(gzlvl5,gt5);
        delay(gstab);
   
        decpwrf(rf90onco);
        sim3pulse(pw,pw90onco,pwN,one,t6,zero,rof1,0.0);
   
      /* shaped pulse for water flip-back */
         obspower(tpwrs); obspwrf(tpwrsf_u);
         shaped_pulse("H2Osinc_u",pwHs,t2,rof1,0.0);
         obspwrf(4095.0);
         obspower(tpwr);
      /* shaped pulse */
   
        zgradpulse(gzlvl5*0.9,gt5);
        delay(gstab);
         
        delay(tauhn - gt5 - gstab - POWER_DELAY - pwHs);
      
        sim3pulse(2.0*pw,0.0,2.0*pwN,zero,zero,zero,rof1,rof1);
   
        delay(tauhn - gt5 - gstab );
      
        decpower(dpwr);
         
        zgradpulse(gzlvl5*0.9,gt5);
        delay(gstab);
      
        dec2rgpulse(pwN,t3,0.0,0.0);  /* 90 for 15N */
         
        dec2power(dpwr2);
         
        delay((gt1/10.0) - pwN + gstab -POWER_DELAY);
         
        rgpulse(2.0*pw, zero, rof1, rof1);
         
        zgradpulse(gzlvl2*icosel,gt1/10.0);
        delay(gstab);
         
     /* acquire data */
         
      status(C);
        setreceiver(t7);
}
Example #20
0
pulsesequence()
{
   char         Cdseq[MAXSTR], refoc[MAXSTR], sspul[MAXSTR];
   int          mult = (0.5 + getval("mult"));
   double	rg1 = 2.0e-6,
                j1xh = getval("j1xh"),
         	gt0 = getval("gt0"),
         	gzlvl0 = getval("gzlvl0"),
         	pp = getval("pp"),
	 	pplvl = getval("pplvl"),
	 	compH = getval("compH"),
		Cdpwr = getval("Cdpwr"),
	 	Cdres = getval("Cdres"), 
	 	tau1 = 0.002,
	 	tau2 = 0.002,
	 	Cdmf = getval("Cdmf");
   
   shape   hdx;

/* Get new variables from parameter table */

   getstr("Cdseq", Cdseq);
   getstr("refoc", refoc);
   getstr("sspul", sspul);
   
   if (j1xh < 1.0) j1xh = 150.0;

   hdx = pboxHT_F1i("gaus180", pp*compH, pplvl); /* HADAMARD stuff */

   if (getval("htcal1") > 0.5)          /* Optional fine power calibration */
     hdx.pwr = getval("htpwr1");

   if(j1xh > 0.0)
     tau1 = 0.25/j1xh;
   tau2 = tau1;
   if (mult > 2) tau2=tau1/2.5;
   else if ((mult == 0) || (mult == 2)) tau2=tau1/2.0;

   dbl(ct, v1);                     /*  v1 = 02 */
   add(two,v1,oph);
   mod4(oph,oph);                   /* oph = 02 */


/* Calculate delays */

   if (dm[0] == 'y')
   {
     abort_message("decoupler must be set as dm=nny\n");
   }
   if(refoc[A]=='n' && dm[C]=='y')
   {
     abort_message("with refoc=n decoupler must be set as dm=nnn\n");
   }
 
/* Relaxation delay */

   status(A);

   delay(0.05);
   zgradpulse(gzlvl0,gt0);
   if (sspul[0] == 'y')
   {
     obspower(tpwr); decpower(pplvl);
     simpulse(pw, pp, zero, zero, rg1, rg1);  /* destroy H and C magnetization */
     zgradpulse(gzlvl0,gt0);
   }

   delay(d1);
 
   status(B);

     obspower(Cdpwr);
     obsunblank(); xmtron(); 
     obsprgon(Cdseq, 1.0/Cdmf, Cdres);  

     pbox_decpulse(&hdx, zero, rg1, rg1);

     obsprgoff(); xmtroff(); obsblank();  
     obspower(tpwr); decpower(pplvl);
          
     delay(2.0e-4);		
     
     decrgpulse(pp, v1, rg1, rg1);
     
     delay(tau1 - POWER_DELAY);
     simpulse(2.0*pw, 2.0*pp, zero, zero, rg1, rg1);
     txphase(one); decphase(one); 
     delay(tau1);
     simpulse(pw, pp, one, one, rg1, rg1);
     if(refoc[A]=='y')
     {
       txphase(zero); decphase(zero); 
       delay(tau2);
       simpulse(2.0*pw, 2.0*pp, zero, zero, rg1, rg1);
       delay(tau2 - rof2 - POWER_DELAY);
       decrgpulse(pp, zero, rg1, rof2);
     }
     decpower(dpwr);    

   status(C);
}
void pulsesequence()
{
/* DECLARE AND LOAD VARIABLES */
char
	ch90shape[MAXSTR],
	ch180shape[MAXSTR],
        exp_mode[MAXSTR],   /* flag to run 3D, or 2D time-shared 15N TROSY /13C HSQC-SE*/    
        decCACO[MAXSTR],    
        caco180shape[MAXSTR],
	f1180[MAXSTR],   		              /* Flag to start t1 @ halfdwell */
	f2180[MAXSTR],
	f3180[MAXSTR],
	f4180[MAXSTR];			                    /* do TROSY on N15 and H1 */
 
int         icosel, max_pcyc;      			  /* used to get n and p type */
     
double  
        tpwrs,
        ni2=getval("ni2"),
        ni3=getval("ni3"),
        tau1, tau1p,tau2,tau3,tau3p,         /*evolution times in indirect dimensions */
        tauNH=getval("tauNH"),                                             /* 1/(4Jhn)*/
        tauCH=getval("tauCH"),                                            /* 1/(4Jch) */
        tauCH1= getval("tauCH1"),     /* tauCH/2.0+tauNH/2.0,*/ /* 1/(8Jch) +1/(8Jnh) */
        tauCH2= getval("tauCH2"),
        swC = getval("swC"),                        /* spectral widths in 13C methyls */
	pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
	pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
        swN = getval("swN"),                                /* spectral widths in 15N */  	              
	pwNlvl = getval("pwNlvl"),	                      /* power for N15 pulses */
        pwN = getval("pwN"),                  /* N15 90 degree pulse length at pwNlvl */   
        ch90pwr=getval("ch90pwr"),
        ch90pw=getval("ch90pw"),
	ch90corr=getval("ch90corr"),
        ch90dres=getval("ch90dres"),
        ch90dmf=getval("ch90dmf"),
 	ch180pw=getval("ch180pw"),
	ch180pwr=getval("ch180pwr"),
        caco180pw=getval("caco180pw"),
        caco180pwr=getval("caco180pwr"),
        mix=getval("mix"),
        tpwrsf_d = getval("tpwrsf_d"), /* fine power adustment for first soft pulse(down)*/
        tpwrsf_u = getval("tpwrsf_u"), /* fine power adustment for second soft pulse(up) */
        pwHs = getval("pwHs"),                     /* H1 90 degree pulse length at tpwrs */
        compH =getval("compH"),

	gstab = getval("gstab"),
	
  	gt0 = getval("gt0"),     
        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"),

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

        getstr("f1180",f1180);
        getstr("f2180",f2180);
        getstr("ch180shape",ch180shape);
        getstr("ch90shape",ch90shape);
        getstr("decCACO",decCACO);
        getstr("caco180shape",caco180shape);
        getstr("exp_mode",exp_mode);

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

        if (tpwrsf_d<4095.0)
         tpwrs=tpwrs+6.0;  /* add 6dB to let tpwrsf_d control fine power ~2048*/

      if( (exp_mode[A]!='2') && (exp_mode[A]!='3') && (exp_mode[A]!='4') )
          {text_error("invalid exp_mode, Should be either 2D or 3D or 4D\n "); psg_abort(1); }

/*   LOAD PHASE TABLE    */
	
        
        settable(t1,1,phi1);
        settable(t2,4,phi2);
	settable(t12,4,phi2); {tsadd(t12,2,4);}

        settable(t3,1,phi3);
        settable(t4,2,phi4);
        settable(t5,2,phi5);
        settable(t6,4,phi6);
        
        settable(t7,8,phi7);
        settable(t8,8,phi8);
 
        /* changing sign */

         if( (exp_mode[A]=='4') && (exp_mode[C]=='a') )
              {tsadd(t7,2,4); tsadd(t5,2,4); }
      

	settable(t21,1,psi1);                          /*trosy and SE hsqc in reverse INPET */
	settable(t22,1,psi2);
        settable(t23,1,psi2c);

        if(exp_mode[A]=='2') {settable(t31,2,rec);}
        if(exp_mode[A]=='3') {settable(t31,4,rec);}
	if(exp_mode[A]=='4') {settable(t31,8,rec);}

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


/* special case for  swapping t2 and t3 for test purposes */

if( (exp_mode[A]=='4') && (exp_mode[B]=='x') && (ni3=1) )
	{	
	 text_error("Acquiring t3 axis in ni2 dimension (instead of t2), set nt to 8! "); 
         tau3  = 0.5*(d3_index/swC+0.5/swC)-pw-rof1 -pwC*2.0/M_PI ;  /* increment corresponds to 13C increment */
	 tau3p = 0.5*(d3_index/swN+0.5/swN) -pw-rof1  -pwC -pwN*2.0/M_PI -tau3; 
         if(d3_index % 2)    { tsadd(t7,2,4); tsadd(t8,2,4); tsadd(t31,2,4); }
    	 if (phase2 == 2)  {tsadd(t7 ,1,4); tsadd(t8 ,1,4);}
         tau2=0.0;
        }
else    {    
         if (phase2 == 2)  {tsadd(t2 ,1,4); tsadd(t12,1,4);}
         if (phase3 == 2)  {tsadd(t7 ,1,4); tsadd(t8 ,1,4);}
         if(d3_index % 2)    { tsadd(t2,2,4);  tsadd(t12,2,4); tsadd(t31,2,4); }    
         tau3  = 0.5*(d4_index/swC+0.5/swC)-pw -rof1 -pwC*2.0/M_PI ;  /* increment corresponds to 13C increment */
         tau3p = 0.5*(d4_index/swN+0.5/swN) -pw -rof1 -pwC -pwN*2.0/M_PI -tau3; 
         if(d4_index % 2)    { tsadd(t7,2,4); tsadd(t8,2,4); tsadd(t31,2,4); }
         tau2 = d3;
         tau2 += 0.0*(-pw*4.0/M_PI-rof1*2.0);
         if((f2180[A] == 'y') && (ni2 > 0.0)) {tau2 += ( 1.0 / (2.0*sw2) );  }
         if(tau2 < 0.2e-6) {tau2 = 0.0;}
         tau2 = tau2/2.0;
        }

 
/* simultaneous Ntrosy-ChsqcSE, last part */
/*  Phase incrementation for hypercomplex 2D data, States-Haberkorn element */

       if (phase1 == 1)    {icosel =  1;  }
            else 	  {  tsadd(t21,2,4);  tsadd(t22,2,4); tsadd(t23,2,4); icosel = -1;  }

       if(d2_index % 2)   { tsadd(t4,2,4); tsadd(t5,2,4); tsadd(t31,2,4); }  
          /* ECHO-ANTIECHO + STATES-TPPI t1, t1' in TROSY/HSQC last step */

       tau1  = 1.0*d2_index/swC;  /* increment corresponds to 13C increment */
       tau1p = 1.0*d2_index*(1.0/swN-1.0/swC); 
    
/* BEGIN PULSE SEQUENCE */

status(A);

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

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

        delay(d1); 

  
/* Destroy 13C magnetization*/

       decrgpulse(pwC*1.0, zero, 0.0, 0.0); 
       zgradpulse(-gzlvl0, gt0);
       delay(gstab);

       /* NOESY */

if(exp_mode[A]!='2')
{  /* 3-4D */

     if(exp_mode[A]=='4')
	{ /* full 4D */
          /* t3 evolution, the very first HSQC */

 	      /* Hz -> HzXz INEPT */

	   	rgpulse(pw,two,rof1,rof1);                         /* 1H pulse excitation */
 	        zgradpulse(gzlvl7, gt0);      delay(tauCH-gt0);
	        decrgpulse(pwC*2.0, zero, 0.0, 0.0); delay(tauNH -tauCH -pwC*2.0 );
	   	sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
 	  	delay(tauNH - gt0 -gstab); zgradpulse(gzlvl7, gt0); delay(gstab);
 		rgpulse(pw, one, rof1, rof1);

             /* water defoc-refoc */
               delay(gstab); zgradpulse(gzlvl8, gt8); delay(gstab);

              /* t3 time */

               if((ni3==0))
                {
		 dec2rgpulse(pwN,t7,0.0,0.0);
     		 dec2rgpulse(pwN,two,0.0,0.0);   
		 decrgpulse(pwC, t8, 0.0, 0.0);
		 decrgpulse(pwC, two, 0.0, 0.0);
		 rgpulse(pw*2.0, zero, rof1, rof1);
                 delay(pwN*2.0+pwC*2.0);
                }
               else
                {
	      	 dec2rgpulse(pwN,t7,0.0,0.0);
                 delay(tau3p);
		 decrgpulse(pwC, t8, 0.0, 0.0);
                 delay(tau3);
		 rgpulse(pw*2.0, zero, rof1, rof1);
                 delay(tau3);
		 decrgpulse(pwC, two, 0.0, 0.0);
		 delay(tau3p);
		 dec2rgpulse(pwN,two,0.0,0.0);
                }

		/* water defoc-refoc */
               delay(gstab); zgradpulse(gzlvl8, gt8); delay(gstab);

	   	/* back inept, water to +Z */
 
		rgpulse(pw,one,rof1,rof1);                  
 	        zgradpulse(gzlvl9, gt0);      delay(tauCH-gt0);
	        decrgpulse(pwC*2.0, zero, 0.0, 0.0); delay(tauNH -tauCH -pwC*2.0 );
	   	sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
 	  	delay(tauNH - gt0 -gstab); zgradpulse(gzlvl9, gt0); delay(gstab);
 		rgpulse(pw,  two, rof1, rof1);

              /* purge */

		zgradpulse(gzlvl10, gt10); delay(2.0*gstab);


        }     /*end of full 4D */


  /************************* t2 evolution, 1H and NOE****************************** */
		/* for the case of no flipbacks in NOE part of the experiment, shift first pulse
                   in t2 time by 45 deg and let water bring itself back at the end
                   of mixing time by radiation dumping */

 		if(   (exp_mode[D]=='t') ) 
                 { initval(1.0, v10);
	           obsstepsize(45.0);
	           xmtrphase(v10);       
 		 } 
                else 
                 {
		   xmtrphase(zero);
		   obspower(tpwrs); obspwrf(tpwrsf_d);                         
		   shaped_pulse("H2Osinc",pwHs,t12,rof1,rof1);
		   obspower(tpwr); obspwrf(4095.0);
	         }
             
	        rgpulse(pw,t2,rof1,rof1);    
	        xmtrphase(zero);   /* SAPS_DELAY */
	        delay(tau2);

 	        decrgpulse(2.0*pwC,zero,0.0,0.0);  dec2rgpulse(2.0*pwN,zero,0.0,0.0);
	         
	        delay(tau2);

	        rgpulse(pw*2.0,zero,rof1,rof1);
	        delay(pwN*2.0+pwC*2.0 + SAPS_DELAY);
	        rgpulse(pw,zero,rof1,rof1);
               
		if(   (exp_mode[D]!='t') )
		{
		  obspower(tpwrs); obspwrf(tpwrsf_u);                         
		  shaped_pulse("H2Osinc",pwHs,zero,rof1,rof1);
		  obspower(tpwr);  obspwrf(4095.0);
 		}

	      /* NOESY period */

 	        delay(mix-gt2-4.0*gstab );     
		zgradpulse(gzlvl2, gt2);
		delay(4.0*gstab);
              
} /* end 3-4 D acquisition */


/* N-TROSY/C-HSQCse   */

       /* Hz -> HzXz INEPT */

   	rgpulse(pw,two,rof1,rof1);                 /* 1H pulse excitation */
        zgradpulse(gzlvl0, gt0);
        delay(tauCH-gt0);
        decrgpulse(pwC*2.0, zero, 0.0, 0.0); 	
	delay(tauNH -tauCH -pwC*2.0 );
   	sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   	delay(tauNH - gt0 -gstab);
	zgradpulse(gzlvl0, gt0);
	delay(gstab);
 	rgpulse(pw, one, rof1, rof1);

       /* on HzXz now */
      /* water flipback*/
        obspower(tpwrs); obspwrf(tpwrsf_u);
 	shaped_pulse("H2Osinc",pwHs,two,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0);

       /* purge */
	zgradpulse(gzlvl3, gt3);
	dec2phase(t4);
	delay(gstab*2.0);

       /* t1 (C) and  t1+t1'(N) evolution */

   	dec2rgpulse(pwN, t4, 0.0, 0.0);
        delay(gt4+gstab  + gt4+gstab + pwC*3.0 
			+2.0*(pwHs +2.0*rof1));
	if(decCACO[A]=='y'){ delay(2.0*caco180pw);}
	dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);  
 	delay(tau1p);   /* t1 */        
        decrgpulse(pwC,t5,0.0,0.0);
        delay(tau1*0.5);
	if(decCACO[A]=='y')
	 {
          decpower(caco180pwr);
          decshaped_pulse(caco180shape,caco180pw,zero, 0.0, 0.0);
          decpower(pwClvl);
         }
	obspower(ch180pwr);                           /*180 on methyls*/
        shaped_pulse(ch180shape,ch180pw,zero,rof1,rof1);
	obspower(tpwr);
        delay(tau1*0.5);             
       	zgradpulse(gzlvl4, gt4);        /*coding */
	delay(gstab + pwHs -ch180pw -2.0*GRADIENT_DELAY -2.0*POWER_DELAY -WFG_START_DELAY- WFG_STOP_DELAY);
        decrgpulse(2.0*pwC,zero,0.0,0.0);
	if(decCACO[A]=='y')
	 {
          decpower(caco180pwr);
          decshaped_pulse(caco180shape,caco180pw,zero, 0.0, 0.0);
          decpower(pwClvl);
         }
        /* delay(ch180pw+2.0*rof1);*/
       	zgradpulse(gzlvl5, gt4);
        delay(gstab - rof1 -2.0*GRADIENT_DELAY -2.0*POWER_DELAY -WFG_START_DELAY- WFG_STOP_DELAY);
       
       /*Water flipback (flipdown actually ) */
         obspower(tpwrs); obspwrf(tpwrsf_d);                         
 	shaped_pulse("H2Osinc",pwHs,three,rof1,rof1);
	obspower(tpwr);  obspwrf(4095.0); 
     
/* reverse double INEPT */


        sim3pulse(pw, pwC, 0.0, t21, t23, zero, rof1, rof1);
        /* rgpulse(pw, t21, rof1, rof1); */
        zgradpulse(gzlvl11, gt1);		 
        delay(gstab);
        delay(tauCH1 -gt1 -gstab -2.0*pwC 
	+     (-2.0/M_PI*pwC-0.5*(pwN-pwC) +pwN)); 
        decrgpulse(2.0*pwC,zero,0.0,0.0);
        delay(tauNH -tauCH1 - 0.65*(pw + pwN)-rof1 -(pwC-pw) 
	-(-2.0/M_PI*pwC-0.5*(pwN-pwC) +pwN) );
        sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
        zgradpulse(gzlvl11, gt1);		 
        delay(gstab);
        delay(tauCH1-gt1 -gstab-2.0*pwC); 
        decrgpulse(2.0*pwC,zero,0.0,0.0);
        delay(tauNH -1.3*pwN -tauCH1);    
        sim3pulse(pw, pwC, pwN, one, zero, zero, 0.0, 0.0);
        zgradpulse(gzlvl1, gt1);		 
        delay(gstab);
        delay(tauCH2-2.0*pwC-gt1-gstab); 
        decrgpulse(2.0*pwC,zero,0.0,0.0);
        delay(tauNH -1.3*pwN-tauCH2);
        sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0); 
        zgradpulse(gzlvl1, gt1);		 
        delay(gstab);
        delay(tauNH-1.6*pwN -POWER_DELAY -ch90pw*ch90corr -gt1-gstab +pwN*0.5 -PRG_START_DELAY);
  
        /* delay(ch90pw*0.5);
           sim3pulse(0.0,0.0, pwN, one, zero, t22, 0.0, 0.0);  
           delay(ch90pw*0.5);*/
        /* sim3shaped_pulse(ch90shape,"hard","hard",ch90pw,0.0, pwN, zero,zero, t22,0.0,0.0);*/

        /*  ch90corr is a fraction of ch90pw to correct for a 1H phase rollcaused by shaped 90 on
            CH3 protons for a sinc pulse ch90corr=0.41 seems to be good. */ 

        obspower(ch90pwr);
        txphase(one);
        obsunblank();    xmtron();
        obsprgon(ch90shape,1.0/ch90dmf,ch90dres);                          /*PRG_START_DELAY */
        delay(ch90pw*ch90corr-pwN*0.5);
        dec2rgpulse(pwN, t22, 0.0, 0.0);
        delay(ch90pw*(1.0-ch90corr)-pwN*0.5);
        obsprgoff();  xmtroff();    obsblank();                             /*PRG_STOP_DELAY */
        obspower(tpwr);                                                        /*POWER_DEALY */	 
        delay( gstab +gt6 +2.0*GRADIENT_DELAY 
               +2.0*POWER_DELAY -0.65*pw -POWER_DELAY
		+pwN*0.5 -ch90pw*(1.0-ch90corr) 
                -PRG_STOP_DELAY);
        rgpulse(2.0*pw, zero, rof1, rof1);
	dec2power(dpwr2); decpower(dpwr);	                            /* 2.0*POWER_DELAY */

        zgradpulse(gzlvl6*icosel, gt6);		                         /* 2.0*GRADIENT_DELAY */
        delay(gstab);
   status(C);

	setreceiver(t31);
}		 
Example #22
0
void 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],			    /* do TROSY on N15 and H1 */
	    CT_c[MAXSTR],
	    h1dec[MAXSTR];
 
int         icosel,          			  /* used to get n and p type */
            t1_counter=getval("t1_counter"),      /* used for states tppi in t1 */
            t2_counter=getval("t2_counter"),      /* used for states tppi in t2 */
            nli = getval("nli"),
            nli2 = getval("nli2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
	    tauCC = 7.0e-3, 		   /* delay for Ca to Cb cosy */
	    tauC = 13.3e-3,	           /* constantTime for 13Cb evolution */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    kappa = 5.4e-3,
	    lambda = 2.4e-3,
	    zeta = 3.0e-3,
	    taud = 1.7e-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 */

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

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

/* the following pulse lengths for SLP pulses are automatically calculated    */
/* by the macro "proteincal".  SLP pulse shapes, "offC7" etc are called       */
/* directly from your shapelib.                    			      */
   pwC7 = getval("pwC7"),  /*180 degree pulse at CO(174ppm) null at Ca(56ppm) */
   pwC7a = getval("pwC7a"),    /* pwC7a=pwC7, but not set to zero when pwC7=0 */
   phshift7,            /* phase shift induced on Cab by pwC7 ("offC7") pulse */
   pwZ,					   /* the largest of pwC7 and 2.0*pwN */
   pwZ1,                /* the larger of pwC7a and 2.0*pwN for 1D experiments */
   rf7,	                           /* fine power for the pwC7 ("offC7") pulse */

/* the following pulse lengths for SLP pulses are automatically calculated    */
/* by the macro "proteincal".  SLP pulse shapes, "offC5" etc are called       */
/* directly from your shapelib.                                               */
   pwC5 = getval("pwC5"),  /*180 degree pulse at CO(174ppm) null at Ca(56ppm) */
   rf5,                            /* fine power for the pwC7 ("offC7") pulse */

/* g3 inversion pulse in the t1 period (centred at 150ppm)                     */
	pwCgCO_lvl = getval("pwCgCO_lvl"),
	pwCgCO = getval("pwCgCO"),



   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 */
   	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"),

        gstab = getval("gstab"),
	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"),
	gt7 = getval("gt7"),
	gt8 = getval("gt8"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),
	gzlvl6 = getval("gzlvl6"),
	gzlvl7 = getval("gzlvl7"),
	gzlvl8 = getval("gzlvl8");

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



/*   LOAD PHASE TABLE    */

	settable(t2,1,phy);
	settable(t3,2,phi3);
	settable(t4,1,phx);
	settable(t5,4,phi5);
   if (TROSY[A]=='y')
       {settable(t8,1,phy);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,4,recT);}
    else
       {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;

    /* 90 degree pulse on Cab, null at CO 128ppm away */
	pwC1 = sqrt(15.0)/(4.0*128.0*dfrq);
        rf1 = (compC*4095.0*pwC)/pwC1;
	rf1 = (int) (rf1 + 0.5);

    /* 180 degree pulse on Cab, null at CO 128ppm away */
        pwC2 = sqrt(3.0)/(2.0*128.0*dfrq);
	rf2 = (4095.0*compC*pwC*2.0)/pwC2;
	rf2 = (int) (rf2 + 0.5);	
	if( rf2 > 4095 )
	      { printf("Recalibrate so that C13 90 <22us*600/sfrq"); psg_abort(1);}

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

    /* 90 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */
        rf5 = (compC*4095.0*pwC*1.69)/pwC5;     /* needs 1.69 times more     */
        rf5 = (int) (rf5 + 0.5);                /* power than a square pulse */

    /* the pwC7 pulse at the middle of t1  */
        if ((nli2 > 0.0) && (nli == 1.0)) nli = 0.0;
        if (pwC7a > 2.0*pwN) pwZ = pwC7a; else pwZ = 2.0*pwN;
        if ((pwC7==0.0) && (pwC7a>2.0*pwN)) pwZ1=pwC7a-2.0*pwN; else pwZ1=0.0;
	if ( nli > 1 )     pwC7 = pwC7a;
	if ( pwC7 > 0 )   phshift7 = 320.0;
	else              phshift7 = 0.0;
	
    /* 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);
 


/* CHECK VALIDITY OF PARAMETER RANGES */


    if ( 0.5*nli2*1/(sw2) > timeTN - WFG3_START_DELAY)
       { printf(" nli2 is too big. Make nli2 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 ( dm3[A] == 'y' || dm3[C] == 'y' )
       { printf("incorrect dec3 decoupler flags! Should be 'nyn' or 'nnn' ");
							             psg_abort(1);}	
    if ( dpwr2 > 46 )
       { printf("dpwr2 too large! recheck value  "); psg_abort(1);}

    if ( pw > 20.0e-6 )
       { printf(" pw too long ! recheck value "); psg_abort(1);} 
  
    if ( pwN > 100.0e-6 )
       { printf(" pwN too long! recheck value "); psg_abort(1);} 
 
    if ( TROSY[A]=='y' && dm2[C] == 'y')
       { text_error("Choose either TROSY='n' or dm2='n' ! "); psg_abort(1);}



/* PHASES AND INCREMENTED TIMES */

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

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


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


/*  Set up f2180  */

    if( ix == 1) d3_init = d3;
    tau2 = d3_init + (t2_counter) / sw2;
    if((f2180[A] == 'y') && (nli2 > 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(t1_counter % 2) 
	{ tsadd(t3,2,4); tsadd(t12,2,4); }

   if(t2_counter % 2) 
	{ tsadd(t8,2,4); tsadd(t12,2,4); }



/* BEGIN PULSE SEQUENCE */

status(A);
delay(d1);
if (dm3[B] == 'y') lk_hold();

rcvroff();
obspower(tpwr);
decpower(pwClvl);
dec2power(pwNlvl);
decpwrf(rf0);
obsoffset(tof);
txphase(zero);
decphase(zero);
dcplrphase(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);

obspower(tpwrs);
if (TROSY[A]=='y') {
  txphase(two);
  shaped_pulse("H2Osinc", pwHs, two, 5.0e-4, 0.0);
  obspower(tpwr);
  zgradpulse(gzlvl3, gt3);
  delay(2.0e-4);
  dec2rgpulse(pwN, zero, 0.0, 0.0);

  delay(0.5*kappa - 2.0*pw);

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

  obspower(tpwrd);	  				       /* POWER_DELAY */
  decphase(zero);
  dec2phase(zero);
  decpwrf(rf7);
  delay(timeTN - 0.5*kappa - POWER_DELAY -WFG_START_DELAY);
}
else {
  txphase(zero);
  shaped_pulse("H2Osinc", pwHs, zero, 5.0e-4, 0.0);
  obspower(tpwrd);
  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(rf7);
  delay(timeTN - kappa -WFG_START_DELAY);
}

sim3shaped_pulse("","offC7","",0.0, pwC7, 2.0*pwN, zero, zero, zero, 0.0, 0.0);

decphase(t3);
decpwrf(rf5);
delay(timeTN -WFG_STOP_DELAY -pwHd);

dec2rgpulse(pwN, zero, 0.0, 0.0);

if (TROSY[A]=='n') {
  xmtroff();
  obsprgoff();
  rgpulse(pwHd,three,2.0e-6,0.0);
}

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

decpwrf(rf5); 
decshaped_pulse("offC5", pwC5, zero, 0.0, 0.0);
delay(2.0e-6);

zgradpulse(-gzlvl7, gt7);
decpwrf(rf0);
decphase(zero);
delay(zeta - gt7 - 0.5*10.933*pwC-2.0e-6);

  decrgpulse(pwC*158.0/90.0, zero, 0.0, 0.0);
  decrgpulse(pwC*171.2/90.0, two, 0.0, 0.0);
  decrgpulse(pwC*342.8/90.0, zero, 0.0, 0.0);      /* Shaka 6 composite */
  decrgpulse(pwC*145.5/90.0, two, 0.0, 0.0);
  decrgpulse(pwC*81.2/90.0, zero, 0.0, 0.0);
  decrgpulse(pwC*85.3/90.0, two, 0.0, 0.0);

delay(2.0e-6);
zgradpulse(-gzlvl7, gt7);
decpwrf(rf5);
decphase(one);
txphase(one);
delay(zeta - gt7 - 0.5*10.933*pwC - WFG_START_DELAY-2.0e-6);
                                                           /* WFG_START_DELAY */
decshaped_pulse("offC5", pwC5, one, 0.0, 0.0);

delay(2.0e-6);
zgradpulse(1.33*gzlvl3,gt3);
delay(200.0e-6);

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

decpwrf(rf1);
decphase(t2);
txphase(one);

if (h1dec[A]=='y') {
  rgpulse(pwHd,one,0.0,0.0);
  txphase(zero);
  delay(2.0e-6);
  obsprgon("waltz16", pwHd, 90.0);                   /* PRG_START_DELAY */
  xmtron();
}

decrgpulse(pwC1, t3, 0.0, 0.0);
decphase(zero);

decpwrf(rf2);
delay(tauCC -gt5 -202.0e-6 -POWER_DELAY- pwHd -PRG_STOP_DELAY -1/dmf3
                                            -2.0e-6 - WFG_STOP_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();
}
else delay(1/dmf3 +WFG_STOP_DELAY);
 
if(h1dec[A]=='y') {
  xmtroff();
  obsprgoff();                                        /* PRG_STOP_DELAY */
  rgpulse(pwHd,three,2.0e-6,0.0);
}
else delay(pwHd +2.0e-6 +PRG_STOP_DELAY);
  
delay(2.0e-6);
zgradpulse(-gzlvl5, gt5);
delay(200.0e-6);

decrgpulse(pwC2,zero,0.0,0.0);

delay(2.0e-6);
zgradpulse(-gzlvl5, gt5);
delay(200.0e-6);
decpwrf(rf1);

if(h1dec[A]=='y'){
  rgpulse(pwHd,one,0.0,0.0);
  txphase(zero);
  delay(2.0e-6);
  obsprgon("waltz16", pwHd, 90.0);                /* PRG_START_DELAY */
  xmtron();
}
else delay(pwHd+2.0e-6+PRG_START_DELAY);

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

delay(tauCC -gt5 -202.0e-6 -POWER_DELAY -1/dmf3 -WFG_START_DELAY
		-POWER_DELAY -pwHd -2.0e-6 -PRG_START_DELAY
		-pwHd-2.0e-6-PRG_STOP_DELAY);

if((h1dec[A]=='y') && (h1dec[B]=='n')) {
  xmtroff();
  obsprgoff();                                    /* PRG_STOP_DELAY */
  rgpulse(pwHd,one,2.0e-6,0.0);
  decrgpulse(pwC1,t2,0.0,0.0);
}
else {
  delay(pwHd+2.0e-6+PRG_STOP_DELAY-POWER_DELAY);
  if ((h1dec[A]=='y')&&(h1dec[B]=='y')) {
    delay(POWER_DELAY);
    decrgpulse(pwC1,t2,0.0,0.0);
  }
  if ((h1dec[A]=='n')&&(h1dec[B]=='n')) {
    obspower(tpwr);
    simpulse(2.0*pw,pwC1,two,t2,0.0,0.0);  /* Assuming 2.0*pw < pwC1 */
  }
}
/* It could be h1dec='ny' ??? */	

/*   xxxxxxxxxxxxxxxxxxxxxx       13Cb EVOLUTION       xxxxxxxxxxxxxxxxxx    */

if (CT_c[0]=='n') {
  if ((nli>1.0) && (tau1>0.0)) {     /* total 13C evolution equals d2 exactly */
            /* 2.0*pwC1/PI compensates for evolution at 64% rate during pwC1 */
    decpwrf(rf7);
    if(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 0.5*pwZ > 0.0) {
      delay(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 0.5*pwZ);
							  /* WFG3_START_DELAY */
      sim3shaped_pulse("", "offC7", "", 0.0, pwC7a, 2.0*pwN, zero, zero, zero,
								      0.0, 0.0);
      initval(phshift7, v7);
      decstepsize(1.0);
      dcplrphase(v7);  				        /* SAPS_DELAY */
      delay(tau1 - 2.0*pwC1/PI  - SAPS_DELAY - 0.5*pwZ - 2.0e-6);
    }
    else {
      initval(180.0, v7);
      decstepsize(1.0);
      dcplrphase(v7);  				        /* SAPS_DELAY */
      delay(2.0*tau1 - 4.0*pwC1/PI - SAPS_DELAY - 2.0e-6);
    }
  }

  else if (nli==1.0) {    /* special 1D check of pwC7 phase enabled when nli=1 */
 	 decpwrf(rf7);
	 delay(10.0e-6 + SAPS_DELAY + 0.5*pwZ1 + WFG_START_DELAY);
							  /* WFG3_START_DELAY */
	 sim3shaped_pulse("", "offC7", "", 0.0, pwC7, 2.0*pwN, zero, zero, zero,
							          2.0e-6, 0.0);
	 initval(phshift7, v7);
	 decstepsize(1.0);
	 dcplrphase(v7);  					/* SAPS_DELAY */
	 delay(10.0e-6 + WFG3_START_DELAY + 0.5*pwZ1);
      }

      else{		       /* 13Ca evolution refocused for 1st increment  */
	decpwrf(rf2);
	decrgpulse(pwC2, zero, 2.0e-6, 0.0);
      }
}  /* H1 dec. and H2 dec. status are not changed through nonCT evolution*/

else {		/* 13C CONSTANT TIME EVOLUTION */
  decpwrf(rf0);
  decpower(pwCgCO_lvl);
  if(h1dec[B]=='y') {
    if(tau1 - 2.0*pwC1/PI -WFG_START_DELAY -2*POWER_DELAY> 0.0) 
      delay(tau1 - 2.0*pwC1/PI -WFG_START_DELAY - 2*POWER_DELAY);
    decshaped_pulse("CgCO1",pwCgCO,zero,0.0,0.0);
    delay(tauC -gt8 -202.0e-6 -pwHd -2.0e-6 -PRG_STOP_DELAY
			-pwCgCO -pwC2 -WFG_STOP_DELAY-1/dmf3);

    if(dm3[B] == 'y') {                     /*optional 2H decoupling off */
      dec3rgpulse(1/dmf3, three, 0.0, 0.0);
      dec3blank();
      setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
      dec3blank();
    }
    else delay(1/dmf3+WFG_STOP_DELAY); 
    xmtroff();
    obsprgoff();                                        /* PRG_STOP_DELAY */
    rgpulse(pwHd,three,2.0e-6,0.0);
  }
  if ((h1dec[B]=='n')&&(dm3[B]=='n')) {
    obspower(tpwr);
    if(tau1 - 2.0*pwC1/PI -WFG_START_DELAY -3*POWER_DELAY> 0.0) {
      delay(tau1 - 2.0*pwC1/PI -WFG3_START_DELAY - 3*POWER_DELAY);
      simshaped_pulse("","CgCO1",2.0*pw,pwCgCO,two,zero,0.0,0.0);
    }
    else simshaped_pulse("","CgCO1",2.0*pw,pwCgCO,two,zero,0.0,0.0);
    obspower(tpwrd);
    delay(tauC -gt8 -202.0e-6 -pwCgCO -pwC2 -POWER_DELAY);
  }
  if ((h1dec[B]=='n')&&(dm3[B]=='y')) {
    obspower(tpwr);
    if(tau1 - 2.0*pwC1/PI - WFG_START_DELAY -3*POWER_DELAY> 0.0) {
      delay(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 3*POWER_DELAY);
      decshaped_pulse("CgCO1",pwCgCO,zero,0.0,0.0);
    }
    else decshaped_pulse("CgCO1",pwCgCO,zero,0.0,0.0);
    delay(taud-0.5*pwC2-WFG_START_DELAY-WFG_STOP_DELAY-pwCgCO);
    rgpulse(2.0*pw,two,0.0,0.0);
    obspower(tpwrd);
    delay(tauC -taud -gt8 -202e-6 -2.0*pw -POWER_DELAY -1/dmf3
	-pwCgCO -pwC2 -WFG_STOP_DELAY);
    dec3rgpulse(1/dmf3, three, 0.0, 0.0);
    dec3blank();
    setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
    dec3blank();
  }

  delay(2.0e-6);
  zgradpulse(gzlvl8,gt8);
  delay(200.0e-6-2*POWER_DELAY);
  decpower(pwClvl);decpwrf(rf2);

  decrgpulse(pwC2,zero,0.0,0.0);

  delay(2.0e-6);
  zgradpulse(gzlvl8,gt8);        
  delay(200.0e-6-2*POWER_DELAY);

  decpower(pwCgCO_lvl);decpwrf(rf0);

  if(h1dec[A]=='y'){
    rgpulse(pwHd,one,0.0,0.0);
    txphase(zero);
    delay(2.0e-6);
    obsprgon("waltz16", pwHd, 90.0);                /* PRG_START_DELAY */
    xmtron();
  }
  else delay(pwHd+ 2.0e-6 +PRG_START_DELAY);

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

  delay(tauC -tau1 -202.0e-6 -gt8 -pwCgCO -WFG_START_DELAY
	-WFG_STOP_DELAY -POWER_DELAY -1/dmf3 -WFG_START_DELAY
	-pwHd -2.0e-6 -PRG_START_DELAY);
  decshaped_pulse("CgCO2",pwCgCO,zero,0.0,0.0);
}		/* END of C13 CONSTANT TIME EVOLUTION */

decphase(one);
decpower(pwClvl); 
decpwrf(rf1);

decrgpulse(pwC1, one, 2.0e-6, 0.0);
delay(tauCC - gt5 -202.0e-6 -2.0e-6 -pwHd -PRG_STOP_DELAY
				-1/dmf3 -WFG_STOP_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();
}
else delay(1/dmf3+WFG_STOP_DELAY);

if(h1dec[B]=='y') {
  xmtroff();
  obsprgoff();                                      /* PRG_STOP_DELAY */
  rgpulse(pwHd,three,2.0e-6,0.0);
}
else delay(2.0e-6+pwHd+PRG_STOP_DELAY);

delay(2.0e-6);
zgradpulse(gzlvl5*1.33, gt5);
delay(200.0e-6-2.0*POWER_DELAY);
decpwrf(rf2);
decphase(zero);

decrgpulse(pwC2, zero, 0.0, 0.0);

delay(2.0e-6);
zgradpulse(gzlvl5*1.33,gt5);
delay(200.0e-6-2.0*POWER_DELAY);
decpwrf(rf1);
decphase(t5);

if(h1dec[A]=='y'){
  rgpulse(pwHd,one,0.0,0.0);
  txphase(zero);
  delay(2.0e-6);
  obsprgon("waltz16", pwHd, 90.0);                /* PRG_START_DELAY */
  xmtron();
}
else delay(pwHd+ 2.0e-6 +PRG_START_DELAY);

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


delay(tauCC - gt5 -202.0e-6 -1/dmf3 -WFG_START_DELAY -2.0e-6 -pwHd 
						-PRG_START_DELAY);

/*decrgpulse(pwC1, t5, 0.0, 0.0); */
decrgpulse(pwC1, zero, 0.0, 0.0); 

decpwrf(rf5);
decshaped_pulse("offC5", pwC5, one, 0.0, 0.0);

delay(zeta - gt7 -202.0e-6 - pwHd -2.0e-6 -PRG_STOP_DELAY
      -1/dmf3 -WFG_STOP_DELAY -0.5*10.933*pwC-2.0e-6);

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

if(h1dec[A]=='y') {
  xmtroff();
  obsprgoff();                                      /* PRG_STOP_DELAY */
  rgpulse(pwHd,three,2.0e-6,0.0);
}
else delay(2.0e-6+pwHd+PRG_STOP_DELAY);

delay(2.0e-6);
zgradpulse(-gzlvl7, gt7);
decpwrf(rf0);
decphase(zero);
delay(200.0e-6-2.0*POWER_DELAY);

  decrgpulse(pwC*158.0/90.0, zero, 0.0, 0.0);
  decrgpulse(pwC*171.2/90.0, two, 0.0, 0.0);
  decrgpulse(pwC*342.8/90.0, zero, 0.0, 0.0);      /* Shaka 6 composite */
  decrgpulse(pwC*145.5/90.0, two, 0.0, 0.0);
  decrgpulse(pwC*81.2/90.0, zero, 0.0, 0.0);
  decrgpulse(pwC*85.3/90.0, two, 0.0, 0.0);

delay(2.0e-6);
zgradpulse(-gzlvl7, gt7);
delay(200.0e-6);
decpwrf(rf5);
decphase(one);
txphase(one);

if(h1dec[A]=='y'){
  rgpulse(pwHd,one,0.0,0.0);
  txphase(zero);
  delay(2.0e-6);
  obsprgon("waltz16", pwHd, 90.0);                /* PRG_START_DELAY */
  xmtron();
}
else delay(pwHd+ 2.0e-6 +PRG_START_DELAY);

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

delay(zeta - gt7 - 0.5*10.933*pwC - WFG_START_DELAY-2.0e-6
	-1/dmf3 -WFG_START_DELAY -pwHd -2.0e-6 -PRG_START_DELAY);
                                                           /* WFG_START_DELAY */
decshaped_pulse("offC5", pwC5, t5, 0.0, 0.0);


/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

dec2phase(t8);
txphase(one);
dcplrphase(zero);
obspower(tpwrd);

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

if(h1dec[A]=='y') { 
  xmtroff();
  obsprgoff();                                      /* PRG_STOP_DELAY */
  rgpulse(pwHd,three,2.0e-6,0.0);
}

zgradpulse(gzlvl4, gt4);
delay(2.0e-4);

if (TROSY[A]=='n') {
  rgpulse(pwHd,one,0.0,0.0);
  txphase(zero);
  delay(2.0e-6);
  obsprgon("waltz16", pwHd, 90.0);
  xmtron();
}

dec2rgpulse(pwN, t8, 0.0, 0.0);

decphase(zero);
dec2phase(t9);
decpwrf(rf7);
delay(timeTN - tau2);

sim3shaped_pulse("","offC7","",0.0, pwC7, 2.0*pwN, zero, zero, t9, 0.0, 0.0);

dec2phase(t10);
decpwrf(rf5);

if (TROSY[A]=='y')
{    if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.5e-4 + pwHs)
	{
	  txphase(three);
          delay(timeTN - pwC2) ;         /* WFG_START_DELAY */
          decrgpulse(pwC2, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')  magradpulse(icosel*gzcal*gzlvl1, gt1);
          else  zgradpulse(icosel*gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(0.5e-4 - POWER_DELAY);
	}

    else if (tau2 > pwHs + 0.5e-4)
	{
	  txphase(three);
          delay(timeTN-pwC2-gt1-2.0*GRADIENT_DELAY-1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else  zgradpulse(icosel*gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                     /* WFG_START_DELAY */
          decrgpulse(pwC2, zero, 0.0, 0.0);
          delay(tau2 - pwHs - 0.5e-4);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(0.5e-4 - POWER_DELAY);
	}
    else
	{
	  txphase(three);
          delay(timeTN - pwC2 - gt1 - 2.0*GRADIENT_DELAY
							    - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else  zgradpulse(icosel*gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                     /* WFG_START_DELAY */
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(0.5e-4 - POWER_DELAY);
          decrgpulse(pwC2, zero, 0.0, 0.0);
          delay(tau2);
	}
}
else
{
    if (tau2 > kappa)
	{
          delay(timeTN - pwC2);     	   /* WFG_START_DELAY */
          decrgpulse(pwC2, 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(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else if (tau2 > (kappa - pwC2))
	{
          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 */
          decrgpulse(pwC2, zero, 0.0, 0.0);
          delay(kappa -pwC2 -gt1 -2.0*GRADIENT_DELAY -1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*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 - pwC2 );   /* WFG_START_DELAY */
          decrgpulse(pwC2, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*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-pwC2-gt1-2.0*GRADIENT_DELAY-1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                    /* WFG_START_DELAY */
          decrgpulse(pwC2, zero, 0.0, 0.0);
          delay(tau2);
	}
}
/*  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(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);
	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) + gstab - 0.5*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);

	rgpulse(2.0*pw, zero, 0.0, rof1);
	dec2power(dpwr2);				       /* POWER_DELAY */
        if (mag_flg[A] == 'y')    magradpulse(gzcal*gzlvl2, gt1/10.0);
        else   zgradpulse(gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */

statusdelay(C,gstab- rof1);
   if (dm3[B]=='y') lk_sample();

	setreceiver(t12);
}