Ejemplo n.º 1
0
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES; parameters used in the last half of the */
/* sequence are declared and initialized as 0.0 in bionmr.h, and       */
/* reinitialized below  */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
 	    TROSY[MAXSTR];			    /* do TROSY on N15 and H1 */
 
int         t1_counter,  		        /* used for states tppi in t1 */
            t2_counter,  	 	        /* used for states tppi in t2 */
	    ni2 = getval("ni2");

double      d2_init=0.0,  		        /* used for states tppi in t1 */
	    d3_init=0.0,  	 	        /* used for states tppi in t2 */
	    tau1,         				         /*  t1 delay */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */

   pwS1,					   /* length of sinc 90 on CO */
   phshift,        /*  phase shift induced on CO by 180 on Ca in middle of t1 */
   pwS2,					       /* length of 180 on Ca */
   pwS = getval("pwS"), /* used to change 180 on Ca in t1 for 1D calibrations */
   pwZ,					   /* the largest of pwS2 and 2.0*pwN */
   pwZ1,	        /* the largest of pwS2 and 2.0*pwN for 1D experiments */


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

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

	gt0 = getval("gt0"),				   /* other gradients */
	gt3 = getval("gt3"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3");

    getstr("f1180",f1180);
    getstr("f2180",f2180);
    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   */
	
 	kappa = 5.4e-3;
	lambda = 2.4e-3;

   pwHs = 1.7e-3*500.0/sfrq;       /* length of H2O flipback, 1.7ms at 500 MHz*/
   widthHd=2.681*(waltzB1/sfrq);     /* 2.681 factor produces same bandwidth */
                                     /* as ghn_co.c sequence  */
   pwHd = h1dec90pw("WALTZ16", widthHd, 0.0);     /* H1 90 length for WALTZ16 */

    /* get calculated pulse lengths of shaped C13 pulses */
	pwS1 = c13pulsepw("co", "ca", "sinc", 90.0); 
	pwS2 = c13pulsepw("ca", "co", "square", 180.0); 

    /* the 180 pulse on Ca at the middle of t1 */
	if ((ni2 > 0.0) && (ni == 1.0)) ni = 0.0;
        if (pwS2 > 2.0*pwN) pwZ = pwS2; else pwZ = 2.0*pwN;
        if ((pwS==0.0) && (pwS2>2.0*pwN)) pwZ1=pwS2-2.0*pwN; else pwZ1=0.0;
	if ( ni > 1 )     pwS = 180.0;
	if ( pwS > 0 )   phshift = 48.0;
	else             phshift = 0.0;



/* 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 > 20.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' && 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);

	rcvroff();
        set_c13offset("co");
	obsoffset(tof);
	obspower(tpwr);
 	obspwrf(4095.0);
	decpower(pwClvl);
	decpwrf(4095.0);
 	dec2power(pwNlvl);
	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 (TROSY[A]=='y')
   {txphase(two);
    shiftedpulse("sinc", pwHs, 90.0, 0.0, two, 2.0e-6, 0.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);
    delay(timeTN - 0.5*kappa - WFG3_START_DELAY);
   }
else
   {txphase(zero);
    shiftedpulse("sinc", pwHs, 90.0, 0.0, zero, 2.0e-6, 0.0);
    zgradpulse(gzlvl3, gt3);
    delay(2.0e-4);
    dec2rgpulse(pwN, zero, 0.0, 0.0);

    delay(kappa - POWER_DELAY - PWRF_DELAY - pwHd - 4.0e-6 - PRG_START_DELAY);
					   /* delays for h1waltzon subtracted */
    h1waltzon("WALTZ16", widthHd, 0.0);
    decphase(zero);
    dec2phase(zero);
    delay(timeTN - kappa - WFG3_START_DELAY);
   }
							  /* WFG3_START_DELAY */
	sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
					     zero, zero, zero, 2.0e-6, 2.0e-6);
	decphase(t3);
	delay(timeTN);

	dec2rgpulse(pwN, zero, 0.0, 0.0);
	if (TROSY[A]=='n')   h1waltzoff("WALTZ16", widthHd, 0.0);
	zgradpulse(gzlvl3, gt3);
 	delay(2.0e-4);

/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION        xxxxxxxxxxxxxxxxxx    */

	c13pulse("co", "ca", "sinc", 90.0, t3, 2.0e-6, 0.0);        /*  pwS1  */
	decphase(zero);

if ((ni>1.0) && (tau1>0.0))          /* total 13C evolution equals d2 exactly */
   {				  /* 13C evolution during sinc is at 60% rate */
     if (tau1 - 0.6*pwS1 - WFG3_START_DELAY - 0.5*pwZ - 2.0e-6
			 	- 2.0*PWRF_DELAY - 2.0*POWER_DELAY > 0.0)
	   {
	delay(tau1 - 0.6*pwS1 - WFG3_START_DELAY - 0.5*pwZ - 2.0e-6 
					 - 2.0*PWRF_DELAY - 2.0*POWER_DELAY);
							  /* WFG3_START_DELAY */
	sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
					     zero, zero, zero, 2.0e-6, 0.0);
	initval(phshift, v3);
	decstepsize(1.0);
	dcplrphase(v3);  				        /* SAPS_DELAY */
	delay(tau1 - 0.6*pwS1 - SAPS_DELAY - 0.5*pwZ - WFG_START_DELAY
				- 2.0e-6 - 2.0*PWRF_DELAY - 2.0*POWER_DELAY);
	   }
      else
	   {
	initval(180.0, v3);
	decstepsize(1.0);
	dcplrphase(v3);  				        /* SAPS_DELAY */
	delay(2.0*tau1 - 2.0*0.6*pwS1 - SAPS_DELAY - WFG_START_DELAY - 2.0e-6 
					 	- PWRF_DELAY - POWER_DELAY);
	   }
   }


else if ((ni==1.0) && (pwS==1.0))            /* 13CO evolution for dof calib. */
   {
	delay(1.0/(dfrq*80.0) + 10.0e-6);		   /* WFG_START_DELAY */
	c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);
	delay(10.0e-6);
   }


else if (ni==1.0)         /* special 1D check of phaseshift enabled when ni=1 */
   {
	delay(10.0e-6 + SAPS_DELAY + 0.5*pwZ1 + WFG_START_DELAY);
							  /* WFG3_START_DELAY */
	sim3_c13pulse("", "ca", "co", "square", "", 0.0, pwS, 2.0*pwN,
						 zero, zero, zero, 2.0e-6, 0.0);
	initval(phshift, 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 ni=0  */
   {
	delay(10.0e-6);					   /* WFG_START_DELAY */
	c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);
	delay(10.0e-6);
   }

	decphase(t5);					   /* WFG_START_DELAY */
	c13pulse("co", "ca", "sinc", 90.0, t5, 2.0e-6, 0.0);        /*  pwS1  */


/*  xxxxxxxxxxxxxxxxxxxx  N15 EVOLUTION & SE TRAIN   xxxxxxxxxxxxxxxxxxxxxxx  */	
	hn_evol_se_train("co", "ca"); /* common part of sequence in bionmr.h  */

}
Ejemplo n.º 2
0
void pulsesequence()
{
/* DECLARE VARIABLES */

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

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

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

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

             pwhshp,

             pwd1,        /* 2H flip back pulses   */

             d_reb,
             pwreb,

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

             pwco180,

             dhpwr2,
             pwn,

             d_co180,

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

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

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

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


/* LOAD VARIABLES */

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

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

  pwd1 = getval("pwd1");

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

  TC2 = getval("TC2");

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

  setautocal();

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

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

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

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

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


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

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

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

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

   }

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

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

   }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/*  Phase incrementation for hypercomplex 2D data */

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

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

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

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

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

    }

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

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

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

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

     } 

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

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

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

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

     } 

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

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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */


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

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

/* Begin Pulses */

status(B);

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

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

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

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

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

/* this is the real start */

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

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

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

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

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

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

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

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

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

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

   delay(tau1);

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

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

   dec3rgpulse(pwd1,zero,0.0,0.0);

   delay(tau1);

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

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

   decpower(d_reb);

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

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

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

   decrgpulse(pwc,zero,0.0,0.0);

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


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

   rgpulse(pw,zero,0.0,0.0);

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

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

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

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


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

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

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

   decrgpulse(pwc,zero,0.0,0.0);

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

   decpower(d_ib); /* set power level for iburp */

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

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

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

   delay(taua - gt8 - 4.0e-6 - WFG2_START_DELAY);   /* taua <= 1/4JCH */                          
   simshaped_pulse(Hshp,shib,pwhshp,pwib,zero,zero,0.0,0.0);
   decphase(zero);

   }

   else {
 delay(taua - gt8 - 4.0e-6 - WFG3_START_DELAY);                 
 sim3shaped_pulse(Hshp,shib,"hard",pwhshp,pwib,2.0*pwn,zero,zero,zero,0.0,0.0);
    }


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

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

   if(n_shift[A] == 'n') 
      delay(taua - gt8 - 4.0e-6 - WFG2_STOP_DELAY - POWER_DELAY); 
   else
      delay(taua - gt8 - 4.0e-6 - WFG3_STOP_DELAY - POWER_DELAY); 

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

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

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

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

   delay(tau2);

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

   delay(TC2/2.0 - tau2 - POWER_DELAY - 4.0e-6 - WFG3_START_DELAY - pwco180
         - WFG3_STOP_DELAY - pwd1 
         - gt10 - gstab -2.0e-6 - POWER_DELAY
         - 4.0e-6 - WFG_START_DELAY);

   dec3rgpulse(pwd1,zero,0.0,0.0);

   delay(tau2);

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

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

   decpower(d_reb);

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

   decphase(zero); decpower(dhpwr);
   
   delay(2.0e-6);
   zgradpulse(gzlvl10,gt10);
   delay(gstab);

   delay(TC2/2.0 - tau2 - WFG_STOP_DELAY - POWER_DELAY 
         - gt10 - gstab -2.0e-6); 

   decrgpulse(pwc,zero,0.0,0.0);

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

   }

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

   dec2phase(t2); delay(2.0e-6);

   dec2rgpulse((pwn-pwc)/2.0,t2,0.0,0.0);
   sim3pulse(0.0e-6,pwc,pwc,zero,t2,t2,0.0,0.0);
   dec2rgpulse((pwn-pwc)/2.0,t2,0.0,0.0);

   decphase(zero);

   delay(tau2);

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

   decpower(d_ibca);
   decshaped_pulse(shibca,pwibca,zero,4.0e-6,0.0);
   decphase(zero);

   delay(TC2/2.0 - tau2 - POWER_DELAY - 4.0e-6 - WFG3_START_DELAY - pwco180
         - WFG3_STOP_DELAY - 2.0e-6 - POWER_DELAY - WFG_START_DELAY
         - 4.0e-6 - pwibca - WFG_STOP_DELAY - pwd1 
         - gt10 - gstab -2.0e-6 - POWER_DELAY
         - 4.0e-6 - WFG3_START_DELAY);

   dec3rgpulse(pwd1,zero,0.0,0.0);

   delay(tau2);

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

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

   decpower(d_reb);

   sim3shaped_pulse("hard",shreb,"hard",0.0e-6,pwreb,2.0*pwn,zero,zero,zero,4.0e-6,0.0);
   dcplrphase(zero);

   decphase(t7); decpower(d_ibca);
   decshaped_pulse(shibcai,pwibca,t7,4.0e-6,0.0);
   decpower(dhpwr); decphase(zero);
   
   delay(2.0e-6);
   zgradpulse(gzlvl10,gt10);
   delay(gstab);

   delay(TC2/2.0 - tau2 - WFG3_STOP_DELAY - POWER_DELAY 
         - 4.0e-6 - WFG_START_DELAY - pwibca - WFG_STOP_DELAY 
         - POWER_DELAY
         - gt10 - gstab -2.0e-6); 

   dec2rgpulse((pwn-pwc)/2.0,zero,0.0,0.0);
   sim3pulse(0.0e-6,pwc,pwc,zero,zero,zero,0.0,0.0);
   dec2rgpulse((pwn-pwc)/2.0,zero,0.0,0.0);

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

   }

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

      txphase(one);
      decrgpulse(pwc,t2,0.0,0.0);

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

      decphase(zero);

      /* seduce on */
      decpower(dpwrsed);
      decprgon(codecseq,pwcodec,dressed);
      decon();
      /* seduce on */

      delay(tau2);

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

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

      delay(tau2); 

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

    }

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

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

   }

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

      txphase(one); dec2phase(t2);

      dec2rgpulse((PI-2.0)/PI*(pwn-pwc),t2,2.0e-6,0.0);
      sim3pulse(0.0e-6,pwc,pwc,zero,t2,t2,0.0,0.0);
      dec2rgpulse((2.0/PI)*(pwn-pwc),t2,0.0,0.0);

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

      decphase(zero);

      /* seduce on */
      decpower(dpwrsed);
      decprgon(codecseq,pwcodec,dressed);
      decon();
      /* seduce on */

      delay(tau2);

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

      delay(tau2); 

      /* seduce off */
      decoff();
      decprgoff();      /* note that ca-n evolves ; keep t2,max <= 9.5ms */
      decpower(dhpwr);
      /* seduce off */

    }

      else
         sim3pulse(0.0,2.0*pwc,2.0*pwn,zero,zero,zero,4.0e-6,0.0);

      dec2rgpulse((2.0/PI)*(pwn-pwc),zero,4.0e-6,0.0);
      sim3pulse(0.0e-6,pwc,pwc,zero,zero,zero,0.0,0.0);
      dec2rgpulse((PI-2.0)/PI*(pwn-pwc),zero,0.0,0.0);

   }

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

   lk_sample();

   rgpulse(pw,t8,4.0e-6,0.0);                    /* 90 deg 1H pulse */

   delay(2.0e-6);
   zgradpulse(gzlvl12,gt12);
   delay(2.0e-6);

   decpower(d_ib);

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

   delay(taua - gt12 - 4.0e-6 - WFG2_START_DELAY - POWER_DELAY);
   simshaped_pulse(Hshp,shib,pwhshp,pwib,t8,zero,0.0,0.0);
   decphase(zero);
   }

   else {
 delay(taua - gt12 - 4.0e-6 - WFG3_START_DELAY - POWER_DELAY);                 
 sim3shaped_pulse(Hshp,shib,"hard",pwhshp,pwib,2.0*pwn,t8,zero,zero,0.0,0.0);
    }

   delay(2.0e-6);
   zgradpulse(gzlvl12,gt12);
   delay(2.0e-6);

   if(n_shift[A] == 'n')
     delay(taua - gt12 - 4.0e-6 - WFG2_STOP_DELAY - 2.0*POWER_DELAY);
   else
     delay(taua - gt12 - 4.0e-6 - WFG3_STOP_DELAY - 2.0*POWER_DELAY);

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

   rgpulse(pw,t8,0.0,rof2);

/* BEGIN ACQUISITION */

status(C);
setreceiver(t9);

}
Ejemplo n.º 3
0
pulsesequence()
{
 char       f1180[MAXSTR],   
            f2180[MAXSTR],  
            mag_flg[MAXSTR],
            flg_3919[MAXSTR],
            ref_flg[MAXSTR];

 int         phase, ni2,
             t1_counter,   
             t2_counter;   

 double      gzcal = getval("gzcal"),
             factor = 0.08, /* used for 3-9-19 water gate */
             tau_3919 = getval("tau_3919"),
             flipphase = getval("flipphase"),
             tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  1/4JNH   ~ 2.3 ms   */
             taub,        /*  1/4JNH    ~ 2.3 ms  */
             bigT,         /* ~ 19  ms   */

             pwNlvl,       
             pwN,  
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8,


  compH = getval("compH"),         /* adjustment for C13 amplifier compression */
  pwHs = getval("pwHs"),	        /* H1 90 degree pulse length at tpwrs */
  tpwrsf = getval("tpwrsf"),     /* fine power adjustment for flipback pulse   */
  tpwrs;	  	              /* power for the pwHs ("H2Osinc") pulse */
	
/* LOAD VARIABLES */

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

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  bigT   = getval("bigT");
   
  tpwr = getval("tpwr");
  pwNlvl = getval("pwNlvl");
  pwN = getval("pwN");
  
  dpwr = getval("dpwr");
  dpwr2 = getval("dpwr2");
  phase = (int)( getval("phase") + 0.5);
  phase2 = (int)( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");  
  ni = getval("ni");
  ni2 = getval("ni2");
  
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl8 = getval("gzlvl8");

/* LOAD PHASE TABLE */
           
  settable(t1,4,phi1);
  settable(t2,2,phi2);
  settable(t3,8,phi3);
  settable(t4,16, phi4);

  if (ref_flg[A] == 'y')
  {
     settable(t10,8,ref);
  }
  else
  {
     settable(t10,8,rec);
  }
  

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if (ref_flg[A] == 'y' && ni > 1)
    {
       printf(" Incorrect setting of ni and ref_flg.\n");
       printf(" Please choose either ni=1 or ref_flg=n.\n");
       psg_abort(1);
    }
    
    if (ref_flg[A] == 'y' && dps_flag)
    {
       printf(" Please use phase2 and ni2 for 2D reference spectrum\n");
       if (ni2/sw2 > 2.0*(2.0*bigT - gt5 - 200.0e-6))
       {
           printf("ni2 is too big, should be < %f\n", 2.0*sw2*(2.0*bigT-gt5-200.0e-6));
           psg_abort(1);
       }
    }

    if ((ni2/sw2 > 2.0*(bigT -  gt5 - 200.0e-6)) && (ref_flg[A] !='y'))
    {
       printf(" ni2 is too big, should be < %f\n", 2.0*sw2*(bigT-gt6-200.0e-6));
       psg_abort(1);
    }

    if(dpwr2 > 50)
    {
        printf("don't fry the probe, dpwr2 is  too large!  ");
        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);
    }

/*  Phase incrementation for hypercomplex 2D data */

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

/*  Set up f1180  half_dwell time (1/sw1)/2.0           */
   
    tau1 = d2 - (4.0*pw/PI + 2.0*pwN);
    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   half dwell time (1/sw2)/2.0              */

    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(t1,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(t2,2,4);  
      tsadd(t10,2,4);    
   }

   if (flipphase < -0.01)  flipphase = flipphase + 360.0;
   initval(flipphase, v10);
   obsstepsize(0.25);


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tpwr);
   dec2power(pwNlvl);
   txphase(zero);
   dec2phase(zero);

   delay(d1);

   if(gt1 > 0.2e-6)
   {
      dec2rgpulse(pwN, zero, 0.2e-6, 0.0);
      delay(2.0e-6);
      zgradpulse(gzlvl1, gt1);
      delay(0.001);
   }
   rcvroff();

status(B);

   rgpulse(pw, zero,rof1, 0.0);
   delay(2.0e-6);
   if (gt2 > 0.2e-6)
      zgradpulse(gzlvl2,gt2);
   delay(taua - gt2 - 2.0e-6);
   sim3pulse(2.0*pw,(double)0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);
   delay(taua - gt2 - 400.0e-6);
   if (gt2 > 0.2e-6)
   {
      zgradpulse(gzlvl2,gt2);
   }
   txphase(one);
   dec2phase(t2);
   delay(400.0e-6);
   rgpulse(pw, one, 0.0, 0.0);
   if (gt3 > 0.2e-6)
   {
      delay(2.0e-6);
      zgradpulse(gzlvl3, gt3);
      delay(200.0e-6);
   }
   txphase(zero);
   dec2rgpulse(pwN, t2, 0.0, 0.0);

   if (ref_flg[A] == 'y')
   {
      delay(tau2);
      rgpulse(2.0*pw, zero, 0.0, 0.0);
      dec2phase(t3);
      if (gt5 > 0.2e-6)
      {
         delay(2.0*bigT - gt5 - 2.0*pw - 1.0e-3);
         zgradpulse(gzlvl5, gt5);
         delay(1.0e-3);
         dec2rgpulse(2.0*pwN, t3, 0.0, 0.0);
         delay(2.0e-6);
         zgradpulse(gzlvl5, gt5);
         delay(2.0*bigT - tau2 - gt5 - 2.0e-6);
      }
      else
      {
         delay(2.0*bigT - 2.0*pw);
         dec2rgpulse(2.0*pwN, t3, 0.0, 0.0);
         delay(2.0*bigT - tau2);
      }
   }
   else
   {
      dec2phase(zero);
      if (gt4 > 0.2e-6)
      {
         delay(2.0e-6);
         zgradpulse(gzlvl4, gt4);
         delay(bigT - gt4 - 2.0e-6);
         sim3pulse(2.0*pw,(double)0.0, 2.0*pwN, zero,zero, zero, 0.0, 0.0);
         delay(2.0e-6);
         zgradpulse(gzlvl4, gt4);
         delay(1.0e-3 - 2.0e-6);
      }
      else
      {
         delay(bigT);
         sim3pulse(2.0*pw,(double)0.0, 2.0*pwN, zero,zero, zero, 0.0, 0.0);
         delay(1.0e-3);
         gt4 = 0.0;
      }

      zgradpulse(gzlvl5, gt5);
      txphase(t1);
      delay(bigT - gt4 - gt5 - 1.0e-3 - 2.0*GRADIENT_DELAY);

      rgpulse(pw, t1, 0.0, 0.0);
      delay(tau1);
      dec2rgpulse(2.0*pwN, t3, 0.0, 0.0);
      txphase(zero);
      delay(tau1);
      rgpulse(pw, zero, 0.0, 0.0);

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

      if (gt6 > 0.2e-6)
      {
         delay(tau2 + 100.0e-6);
         zgradpulse(gzlvl6, gt6);
         delay(bigT - gt5 - gt6 - 100.0e-6 - 2.0*GRADIENT_DELAY);
         sim3pulse(2.0*pw,(double)0.0, 2.0*pwN, zero,zero, t4, 0.0, 0.0);
         delay(2.0e-6);
         dec2phase(zero);
         zgradpulse(gzlvl6, gt6);
         delay(bigT - tau2 - gt6 - 2.0e-6);
      }
      else
      {
         delay(bigT + tau2 - gt5 - 2.0*GRADIENT_DELAY);
         sim3pulse(2.0*pw,(double)0.0, 2.0*pwN, zero,zero, t4, 0.0, 0.0);
         dec2phase(zero);
         delay(bigT - tau2);
      }
   }

   if (gt7 > 0.2e-6)
   {
      dec2rgpulse(pwN, zero, 0.0,2.0e-6);
      zgradpulse(gzlvl7, gt7);
      txphase(zero);
      
      delay(200.0e-6);
      if (pwHs > 0.2e-6)
      {
         xmtrphase(v10);
         if (tpwrsf<4095.0) {obspower(tpwrs+6.0); obspwrf(tpwrsf);}
          else obspower(tpwrs);
         txphase(two);
         shaped_pulse("H2Osinc", pwHs, two, 2.0e-6, 0.0);
         xmtrphase(zero);
         obspower(tpwr); obspwrf(4095.0);
      }
      rgpulse(pw, zero, 2.0e-6, 0.0);
   }
   else
   {
      sim3pulse(pw,(double)0.0, pwN, zero,zero, zero, 0.0, 0.0);
   }


   delay(2.0e-6);
   if(mag_flg[A] == 'y')
   {
      magradpulse(gzcal*gzlvl8, gt8);
   }
   else
   {
      zgradpulse(gzlvl8, gt8);
   }
   if (flg_3919[A] == 'y')
   {
      delay(taub - 31.0*factor*pw - 2.5*tau_3919 - gt8 - 2.0e-6);
      rgpulse(pw*factor*3.0, two, 0.0, 0.0);
      delay(tau_3919);
      rgpulse(pw*factor*9.0, two, 0.0, 0.0);
      delay(tau_3919);
      rgpulse(pw*factor*19.0, two, 0.0, 0.0);
      delay(tau_3919/2.0 - pwN);
      dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
      delay(tau_3919/2.0 - pwN);
      rgpulse(pw*factor*19.0, zero, 0.0, 0.0);
      delay(tau_3919);
      rgpulse(pw*factor*9.0, zero, 0.0, 0.0);
      delay(tau_3919);
      rgpulse(pw*factor*3.0, zero, 0.0, 0.0);
      delay(taub - 31.0*factor*pw - 2.5*tau_3919 - gt8 - POWER_DELAY - 402.0e-6);
   }
   else
   {
      if (tpwrsf<4095.0) {obspower(tpwrs+6.0); obspwrf(tpwrsf);}
       else obspower(tpwrs);
      txphase(two);
      xmtrphase(v10);
      delay(taub - pwHs - gt8 - 2.0*POWER_DELAY - 2.0e-6);
      shaped_pulse("H2Osinc", pwHs, two, 0.0, 0.0);
      obspower(tpwr); obspwrf(4095.0);
      xmtrphase(zero);
      txphase(zero);
      sim3pulse(2.0*pw, (double)0.0, 2.0*pwN, zero, zero, zero, 2.0e-6, 0.0);
      if (tpwrsf<4095.0) {obspower(tpwrs+6.0); obspwrf(tpwrsf);}
       else obspower(tpwrs);
      txphase(two);
      xmtrphase(v10);
      shaped_pulse("H2Osinc", pwHs, two, 2.0e-6, 0.0);
      xmtrphase(zero);
      obspower(tpwr); obspwrf(4095.0);
      dec2power(dpwr2);
      delay(taub - pwHs  - gt8 - 3.0*POWER_DELAY - 402.0e-6);
   }
   dec2power(dpwr2);
   if(mag_flg[A] == 'y')
   {
      magradpulse(gzcal*gzlvl8, gt8);
   }
   else
   {
      zgradpulse(gzlvl8, gt8);
   }
   delay(400.0e-6);

status(C);
   setreceiver(t10);
   rcvron();
}
Ejemplo n.º 4
0
pulsesequence()
{

/* DECLARE VARIABLES */

char
        SE[MAXSTR],          /* coherence gradients & sensitivity enhance */
        CT[MAXSTR],                                /* constant time in t1 */
        CCdseq[MAXSTR],
        CChomodec[MAXSTR],          /* Setup for C-imino - C-H6 */

	C13refoc[MAXSTR],                         /* C13 pulse in middle of t1*/
	f1180[MAXSTR],                        /* Flag to start t1 @ halfdwell */
	f2180[MAXSTR];                        /* Flag to start t1 @ halfdwell */

int	icosel,
        ni2 = getval("ni2"),
	t1_counter,
	t2_counter;

double  tau1,                                                /*  t1 delay */
        tau2,                                                /*  t2 delay */
	lambda = 0.94/(4.0*getval("JCH")),        /* 1/4J C-H INEPT delay */
        CTdelay = getval("CTdelay"),     /* total constant time evolution */

        CCdpwr = getval("CCdpwr"),    /*   power level for CC decoupling */
        CCdres = getval("CCdres"),    /*   dres for CC decoupling */
        CCdmf = getval("CCdmf"),      /*   dmf for CC decoupling */

        pwClvl = getval("pwClvl"),              /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	compC = getval("compC"),  /* adjustment for C13 amplifier compression */

        pwNlvl = getval("pwNlvl"),                    /* power for N15 pulses */
        pwN = getval("pwN"),          /* N15 90 degree pulse length at pwNlvl */
        pwZa,                                   /* the largest of 2.0*pw and 2.0
*pwN */

        tpwr = getval("tpwr"),    	               /* power for H1 pulses */
        pw = getval("pw"),               /* H1 90 degree pulse length at tpwr */
	compH = getval("compH"),   /* adjustment for H1 amplifier compression */

	ncyc_cc = getval("ncyc_cc"), /* number of DIPSI3 cycles for CC spinlock */

        tof_75,                  /* tof shifted to 7.5 ppm for H4-N4 transfer */
        tof_12,                   /* tof shifted to 12 ppm for H3-N3 transfer */

	dof_80,		 /* dof shifted to 169 ppm for N3-C4 transfer */
	dof_92p5,		 /* dof shifted to 92.5ppm */

/* p_d is used to calculate the isotropic mixing */
        p_d,                 /* 50 degree pulse for DIPSI-3 at rfdC */
        p_d2,                /* 50 degree pulse for DIPSI-3 at rfd */
        rfd,             /* fine C13 power for 10 kHz rf for 500MHz magnet */

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

        pwHs = getval("pwHs"),         /* H1 90 degree pulse length at tpwrs */
        tpwrs,                   /* power for the pwHs ("rna_H2Osinc") pulse */

        pwHs2 = getval("pwHs2"),       /* H1 90 degree pulse length at tpwrs2 */
        tpwrs2,                           /* power for the pwHs2 square pulse */

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

  gzlvl0 = getval("gzlvl0"),
  gzlvl3 = getval("gzlvl3"),
  gt3 = getval("gt3"),
  gzlvl4 = getval("gzlvl4"),
  gt4 = getval("gt4"),
  gzlvl5 = getval("gzlvl5"),
  gzlvl6 = getval("gzlvl6"),
  gt5 = getval("gt5"),
  gzlvlr = getval("gzlvlr");

    getstr("SE",SE);
    getstr("CT",CT);

  getstr("CChomodec",CChomodec);

  getstr("CCdseq",CCdseq);

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


/* LOAD PHASE TABLE */
 
	settable(t1,2,phi1);
	settable(t3,8,phi3);
	settable(t4,16,phi4);
	settable(t9,1,phi9);
	settable(t10,1,phi10);
	settable(t5,4,phi5);
	settable(t11,8,rec1);


/* INITIALIZE VARIABLES */

/* different offset values tof=H2O, dof=110ppm, dof2=200ppm */

	tof_75 = tof + 2.5*sfrq;        /* tof shifted to nH2 */
	tof_12 = tof + 8.0*sfrq;	/* tof shifted to nH */
	dof_92p5 = dof - 17.5*dfrq;	/* dof shifted to C1' */
	dof_80 = dof - 30*dfrq;	        /* dof shifted to C6 */

/* 1.9 kHz DIPSI-3 at 500MHz scaled to this sfrq*/
        p_d = (5.0)/(9.0*4.0*1900.0*(sfrq/500.0));

/* 7 kHz DIPSI-3 at 500MHz scaled to this sfrq*/
        p_d2 = (5.0)/(9.0*4.0*7000.0*(sfrq/500.0));
        ncyc_cc = (int) (ncyc_cc + 0.5);
        if (ncyc_cc > 0 )
         {
           printf("CC-mixing time is %f ms.\n",(ncyc_cc*51.8*4*p_d2));
         }
        if( ncyc_cc > 12 )
         {
           text_error("check C->C dipsi-3 time !! ");
           psg_abort(1);
         }
        initval(ncyc_cc,v2);

/* fine C13 power for dipsi-3 isotropic mixing */
        rfd = (compC*4095.0*pwC*5.0)/(p_d2*9.0);
        rfd = (int) (rfd + 0.5);

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

/* selective H20 square pulse */
        tpwrs2 = tpwr - 20.0*log10(pwHs2/(compH*pw));
        tpwrs2 = (int) (tpwrs2);

  if (2.0*pw > 2.0*pwN) pwZa = 2.0*pw;
  else pwZa = 2.0*pwN;

  if ((CT[A]=='y') && (ni2/(4.0*sw2) > CTdelay))
  { text_error( " ni2 is too big. Make ni2 equal to %d or less.\n",
      ((int)(CTdelay*sw2*4.0)) );                                       psg_abort(1); }




/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 2)
         tsadd(t5,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(t5,2,4); tsadd(t11,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;


        icosel=1;

  if (SE[A]=='y')
   {
        if (phase2 == 2)
        {
                tsadd(t10,2,4);
                icosel = -1;
        }
   }

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

        t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );

  if(t2_counter % 2)
   {
        tsadd(t3,2,4);
        tsadd(t11,2,4);
   }


/* CHECK VALIDITY OF PARAMETER RANGE */


    if( sfrq > 610 )
        { printf("Power Levels at 750/800 MHz may be too high for probe");
          psg_abort(1); }

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

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

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

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

    if( ((dm[C] == 'y') && (dm2[C] == 'y') && (at > 0.18)) )
    {
        text_error("check at time! Don't fry probe !! ");
        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( pw > 20.0e-6 )
    {
        printf("dont fry the probe, pw too high ! ");
        psg_abort(1);
    }

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

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

    if (gzlvlr > 500 || gzlvlr < -500)
    {
	text_error(" RDt1-gzlvlr must be -500 to 500 (0.5G/cm) \n");
	psg_abort(1);
    }

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

        obspower(tpwr);
	obsstepsize(0.5);
        decpower(pwClvl);
	decstepsize(0.5);
	obsoffset(tof);
        dec2power(pwNlvl);
	dec2stepsize(0.5);

        decoffset(dof_80);	/* Preset the carbon frequency for the C1' carbons */

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

        delay(d1);
        rcvroff();

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

	delay(lambda);

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

	delay(lambda - SAPS_DELAY);

	simpulse(pw, pwC, zero, t5, 0.0, 0.0); /* 2x, -2x*/
	dec2phase(zero);
        txphase(one);

	zgradpulse(gzlvl5,gt5);
	delay(lambda - SAPS_DELAY - gt5);

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

	zgradpulse(gzlvl5,gt5);
        delay(lambda - 2*SAPS_DELAY - gt5 - 2*POWER_DELAY);


	decpwrf(4095.0);


	txphase(zero);
	decphase(zero);

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

        if (tau1 > (2.0*GRADIENT_DELAY + pwN + 0.64*pw + 5.0*SAPS_DELAY))
        {
        zgradpulse(gzlvlr, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw) - SAPS_DELAY);
        sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
        zgradpulse(-1.0*gzlvlr, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        }
        else if (tau1 > (0.64*pw + 0.5*SAPS_DELAY))
        delay(2.0*tau1 - 2.0*0.64*pw - SAPS_DELAY );
   }
  else
   {
        if (tau1 > (2.0*GRADIENT_DELAY + pwN + 0.64*pw + 5.0*SAPS_DELAY))
        {
        zgradpulse(gzlvlr, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw) - SAPS_DELAY);
        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
        zgradpulse(-1.0*gzlvlr, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        }
        else if (tau1 > (0.64*pw + 0.5*SAPS_DELAY))
        delay(2.0*tau1 - 2.0*0.64*pw - SAPS_DELAY );
   }


	decrgpulse(pwC,three,0.0,0.0);   /* flip transferred 13C-magn. to z */
	decrgpulse(pwC,one,0.0,0.0);   /* flip transferred 13C-magn. to z */

        decphase(zero);
        decpwrf(rfd);

        starthardloop(v2);
    decrgpulse(6.4*p_d2,zero,0.0,0.0);
    decrgpulse(8.2*p_d2,two,0.0,0.0);
    decrgpulse(5.8*p_d2,zero,0.0,0.0);
    decrgpulse(5.7*p_d2,two,0.0,0.0);
    decrgpulse(0.6*p_d2,zero,0.0,0.0);
    decrgpulse(4.9*p_d2,two,0.0,0.0);
    decrgpulse(7.5*p_d2,zero,0.0,0.0);
    decrgpulse(5.3*p_d2,two,0.0,0.0);
    decrgpulse(7.4*p_d2,zero,0.0,0.0);

    decrgpulse(6.4*p_d2,two,0.0,0.0);
    decrgpulse(8.2*p_d2,zero,0.0,0.0);
    decrgpulse(5.8*p_d2,two,0.0,0.0);
    decrgpulse(5.7*p_d2,zero,0.0,0.0);
    decrgpulse(0.6*p_d2,two,0.0,0.0);
    decrgpulse(4.9*p_d2,zero,0.0,0.0);
    decrgpulse(7.5*p_d2,two,0.0,0.0);
    decrgpulse(5.3*p_d2,zero,0.0,0.0);
    decrgpulse(7.4*p_d2,two,0.0,0.0);

    decrgpulse(6.4*p_d2,two,0.0,0.0);
    decrgpulse(8.2*p_d2,zero,0.0,0.0);
    decrgpulse(5.8*p_d2,two,0.0,0.0);
    decrgpulse(5.7*p_d2,zero,0.0,0.0);
    decrgpulse(0.6*p_d2,two,0.0,0.0);
    decrgpulse(4.9*p_d2,zero,0.0,0.0);
    decrgpulse(7.5*p_d2,two,0.0,0.0);
    decrgpulse(5.3*p_d2,zero,0.0,0.0);
    decrgpulse(7.4*p_d2,two,0.0,0.0);

    decrgpulse(6.4*p_d2,zero,0.0,0.0);
    decrgpulse(8.2*p_d2,two,0.0,0.0);
    decrgpulse(5.8*p_d2,zero,0.0,0.0);
    decrgpulse(5.7*p_d2,two,0.0,0.0);
    decrgpulse(0.6*p_d2,zero,0.0,0.0);
    decrgpulse(4.9*p_d2,two,0.0,0.0);
    decrgpulse(7.5*p_d2,zero,0.0,0.0);
    decrgpulse(5.3*p_d2,two,0.0,0.0);
    decrgpulse(7.4*p_d2,zero,0.0,0.0);
        endhardloop();


	decphase(t3);

        decpwrf(4095.0);

        decrgpulse(pwC,three,0.0,0.0);  /* flip transferred 13C-magnetization to z */
        decoffset(dof_92p5);	/* Preset the carbon frequency for the C1' carbon */

	decrgpulse(pwC,t3,0.0,0.0);  /* 4x,-4x  flip transferred 13C-magnetization to x */


if (SE[A]=='y') 
{
 /*****************     CONSTANT TIME EVOLUTION      *****************/
      if (CT[A]=='y') {
     /***************/

        initval(90.0, v9);
        decstepsize(1.0);
        dcplrphase(v9);
        decphase(t9);
        delay(CTdelay/2.0 - tau2);

    decrgpulse(2.0*pwC, t9, 0.0, 0.0);
    dcplrphase(zero);
    decphase(t10);

          if (tau2 < gt1 + gstab)
               {delay(CTdelay/2.0 - pwZa - gt1 - gstab);
                 zgradpulse(icosel*gzlvl1, gt1);        /* 2.0*GRADIENT_DELAY */
                delay(gstab - 2.0*GRADIENT_DELAY);
                sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
                delay(tau2);}

          else {delay(CTdelay/2.0 - pwZa);
                sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
                delay(tau2 - gt1 - gstab);
                 zgradpulse(icosel*gzlvl1, gt1);        /* 2.0*GRADIENT_DELAY */
                delay(gstab - 2.0*GRADIENT_DELAY);}


     /***************/
                      }
     /********************************************************************/

     /*****************         NORMAL EVOLUTION         *****************/
      else            {
     /***************/

if (CChomodec[A]=='y')

    {
    decpower(CCdpwr); decphase(zero);
    decprgon(CCdseq,1.0/CCdmf,CCdres);
    decon();  /* CC decoupling on */
    }

decphase(zero);
delay(tau2);

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

         decphase(t9);
         delay(gt1 + gstab - pwZa);
         delay(tau2);

if 	(CChomodec[A]=='y')
        {
        decoff(); decprgoff();        /* CC decoupling off */
        decpower(pwClvl);
        }

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

          zgradpulse(icosel*gzlvl1, gt1);               /* 2.0*GRADIENT_DELAY */
         decphase(t10);
         delay(gstab - 2.0*GRADIENT_DELAY);


     /***************/
                      }
     /********************************************************************/

/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */

        decrgpulse(pwC, zero, 0.0, 0.0);

        decphase(zero);
        zgradpulse(gzlvl5, gt5);
        delay(lambda - 0.5*pwC - gt5);

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

        zgradpulse(gzlvl5, gt5);
        txphase(one);
        decphase(t10);
        delay(lambda  - 0.5*pwC - gt5);

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

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

        simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0);
        txphase(two);
        zgradpulse(gzlvl6, gt5);
        delay(lambda - 0.5*pwC - gt5);

        simpulse(pw, pwC, two, zero, 0.0, 0.0);
        txphase(zero);
        delay(lambda - 0.5*pwC);

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

        dcplrphase(zero);                                       /* SAPS_DELAY */
        zgradpulse(gzlvl2, gt1/4.0);                   /* 2.0*GRADIENT_DELAY */
        delay(lambda - gt1/4.0 - 0.5*pwC - 2.0*GRADIENT_DELAY - 2*POWER_DELAY - SAPS_DELAY);

}

else
{
        decphase(zero);
        zgradpulse(gzlvl5,gt5);

        delay(lambda - gt5);
        simpulse(2*pw,2*pwC,zero,zero,0.0,0.0);
        zgradpulse(gzlvl5,gt5);
        delay(lambda - gt5);

	decrgpulse(pwC,zero,0.0,0.0);

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

        obspower(tpwrs);
        shaped_pulse("rna_H2Osinc", pwHs, zero, 5.0e-4, 0.0);
        obspower(tpwr);

	rgpulse(pw, zero, 2*rof1, 0.0);
	txphase(two);
	obspower(tpwrs2);
	
	zgradpulse(gzlvl4,gt4);
        delay(gstab - 2*SAPS_DELAY - 2*POWER_DELAY - GRADIENT_DELAY);

        rgpulse((lambda-gstab-gt4-pwC), two, 0.0, 0.0);
        simpulse(pwC,pwC,two,three,0.0,0.0);
        simpulse(2*pwC,2*pwC,two,zero,0.0,0.0);
        simpulse(pwC,pwC,two,three,0.0,0.0);
        rgpulse((pwHs2-2*pwC-(lambda-gstab-gt4-pwC)), two, 0.0, 0.0);

        txphase(zero);
        obspower(tpwr);
        rgpulse(2*pw, zero, 0.0, 0.0);
        obspower(tpwrs2);

        rgpulse(pwHs2, two, 4.0e-6, 0.0);
        decphase(t4);

        zgradpulse(gzlvl4,gt4);
        delay(gstab-2*pwC-2*SAPS_DELAY - POWER_DELAY - GRADIENT_DELAY);

        decrgpulse(pwC,t4,0.0,0.0);
        decrgpulse(pwC,zero,0.0,0.0);
}
        dec2power(dpwr2);               /* 2*POWER_DELAY */
        decpower(dpwr);

status(C);

 setreceiver(t11);
}
Ejemplo n.º 5
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          SE_flg[MAXSTR];

   int    icosel = 0,
          t1_counter,
          t2_counter,
          ni2 = getval("ni2"),
          phase;


   double d2_init=0.0,
          d3_init=0.0,
          pwS1,pwS2,pwS3,pwS4,pwS5,pwS6,pwS7,pwS8,
          lambda = getval("lambda"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gzlvl4 = getval("gzlvl4"), 
          gzlvl5 = getval("gzlvl5"), 
          gzlvl6 = getval("gzlvl6"), 
          gt1 = getval("gt1"),
          gt3 = getval("gt3"),
          gt4 = getval("gt4"),
          gt5 = getval("gt5"),
          gt6 = getval("gt6"),
          gstab = getval("gstab"),
          shlvl1 = getval("shlvl1"),
          shpw1 = getval("shpw1"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          d2 = getval("d2"),
          timeTN = getval("timeTN"),
          Delta,
          tauNCO = getval("tauNCO"),
          tauC = getval("tauC"),
          tau1 = getval("tau1"),
          tau2 = getval("tau2"),
          taunh = getval("taunh");



   getstr("shname1", shname1);
   getstr("SE_flg",SE_flg);
   getstr("f1180",f1180);
   getstr("f2180",f2180);

  phase = (int) (getval("phase") + 0.5);
   
   settable(t1,2,phi1);
   settable(t2,1,phi2);
   settable(t3,4,phi3);
   settable(t4,8,phi4);
   settable(t10,1,phi10);
   settable(t12,8,phi12);
   settable(t13,8,phi13);

/*   INITIALIZE VARIABLES   */

  Delta = timeTN-tauNCO;

   pwS1 = c13pulsepw("ca", "co", "square", 90.0);
   pwS2 = c13pulsepw("ca", "co", "square", 180.0);
   pwS3 = c13pulsepw("co", "ca", "sinc", 180.0);
   pwS7 = c13pulsepw("co", "ca", "sinc", 90.0);
   pwS8 = c_shapedpw("reburp",60.0 ,-135.0,zero, 0.0, 0.0);
   pwS4 = h_shapedpw("eburp2",4.0,3.5,zero, 0.0, 0.0);  
   pwS6 = h_shapedpw("reburp",4.0,3.5,zero, 0.0, 0.0);
   pwS5 = h_shapedpw("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);



if (SE_flg[0] == 'y')
{
   if ( ni2*1/(sw2)/2.0 > (timeTN-Delta-pwS3-pwS4))
       { printf(" ni2 is too big. Make ni2 equal to %d or less.\n",
         ((int)((timeTN-Delta-pwS3-pwS4)*2.0*sw2)));    psg_abort(1);}
}
else
{

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



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

if (SE_flg[0] =='y')
{
  if (phase2 == 2)  {tsadd(t10,2,4); icosel = +1;}
            else 			       icosel = -1;   
}
else
{
  if (phase2 == 2) {tsadd(t3,1,4); icosel = 1;}
}
 

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

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

  
    


   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); tsadd(t13,2,4); }

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



   status(A);
   decpower(pwClvl);
   dec2power(pwNlvl);
   set_c13offset("co");
   zgradpulse(gzlvl6, gt6);
   delay(1.0e-4);
   delay(d1-gt6);
lk_hold();
   rcvroff();

        h_shapedpulse("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);  

	delay(lambda-pwS5*0.5-pwS6*0.4); 

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, one, zero, zero, 0.0, 0.0);

	delay(lambda-pwS5*0.5-pwS6*0.4);

        h_shapedpulse("pc9f_",4.0,3.5,one, 2.0e-6, 0.0);  


   obspower(shlvl1);
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx   N-> CA transfer           xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/
   set_c13offset("ca");
      dec2rgpulse(pwN,zero,0.0,0.0);

           delay(timeTN);

      sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);

           delay(Delta);
	c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      
           delay(timeTN-Delta-pwS3-taunh*0.5-shpw1);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
           delay(taunh*0.5);

     dec2rgpulse(pwN,zero,0.0,0.0);				     
        shaped_pulse(shname1,shpw1,zero,0.0,0.0);
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx       CA->CO TRANSFER       xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/
       set_c13offset("ca");
        c13pulse("ca", "co", "square", 90.0, t2, 2.0e-6, 0.0);
/*
        initval(0.0, v2);
        decstepsize(1.0);
        dcplrphase(v2);
*/

           zgradpulse(gzlvl4, gt4);
        delay(tauC*0.5-gt4);
 
       c_shapedpulse2("isnob5",20.0,0.0,"isnob5",20.0,119.0,zero,0.0,0.0);

           zgradpulse(gzlvl4, gt4);

        delay(tauC-gt4);
       c_shapedpulse2("isnob5",20.0,0.0,"isnob5",20.0,119.0,two,0.0,0.0);
        delay(tauC*0.5);

        c13pulse("ca", "co", "square", 90.0, one, 0.0, 0.0);


           zgradpulse(gzlvl3, gt3*3.5);
           delay(1.0e-4);
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION       xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/

       set_c13offset("co");
        c13pulse("co", "ca", "sinc", 90.0, t1, 2.0e-6, 0.0);
        delay(tau1*0.5);
        sim3_c13pulse(shname1, "ca", "co", "square", "",shpw1, 180.0, 2.0*pwN,
                                                  zero, zero, zero, 0.0, 0.0);
        delay(tau1*0.5);
        c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
        sim3_c13pulse(shname1, "ca", "co", "square", "",shpw1, 180.0, 0.0,
                                                  two, zero, zero, 0.0, 0.0);
        if (pwN*2.0 > pwS2) delay(pwN*2.0-pwS2);
        c13pulse("co", "ca", "sinc", 90.0, t4, 0.0, 0.0);

/***************************************************************************/
/* CA->CO transfer                                                         */
/***************************************************************************/
       set_c13offset("ca");
        c13pulse("ca", "co", "square", 90.0, zero, 2.0e-6, 0.0);

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

           zgradpulse(gzlvl3, gt3*2.0);
        delay(tauC*0.5-gt3*2.0);
 
       c_shapedpulse2("isnob5",20.0,0.0,"isnob5",20.0,119.0,two,0.0,0.0);

           zgradpulse(gzlvl3, gt3*2.0);

        delay(tauC-gt3*2.0);
       c_shapedpulse2("isnob5",20.0,0.0,"isnob5",20.0,119.0,zero,0.0,0.0);
        delay(tauC*0.5);

        c13pulse("ca", "co", "square", 90.0, one, 0.0, 0.0);

/*      dcplrphase(v2); */

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

   obspower(shlvl1);

        shaped_pulse(shname1,shpw1,zero,0.0,0.0);
     dec2rgpulse(pwN,t3,0.0,0.0);

 	   delay(tau2*0.5+taunh*0.5);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
           delay(timeTN-shpw1-taunh*0.5-gt1-1.0e-4);
        zgradpulse(-gzlvl1, gt1);
        delay(1.0e-4);
      sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);


      if (SE_flg[0] == 'y')
      {
       delay(Delta);
	c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      
           delay(timeTN-tau2*0.5-pwS4-Delta-pwS3);
        h_shapedpulse("eburp2",4.0,3.5,zero, 2.0e-6, 0.0); 
	dec2rgpulse(pwN, t10, 0.0, 0.0);
      }
      else
      {
       delay(Delta);
	c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      
       delay(timeTN-tau2*0.5-Delta-pwS3);
       dec2rgpulse(pwN, zero, 0.0, 0.0);
      }

/**************************************************************************/
if (SE_flg[0] == 'y')
{
	zgradpulse(gzlvl5, gt5);
	delay(lambda-pwS6*0.4  - gt5);

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

	zgradpulse(gzlvl5, gt5);
	delay(lambda-pwS6*0.4  - gt5);

	dec2rgpulse(pwN, one, 0.0, 0.0);
  
        h_shapedpulse("eburp2_",4.0,3.5,one, 0.0, 0.0); 
 

	txphase(zero);
	dec2phase(zero);
	delay(lambda-pwS4*0.5-pwS6*0.4);

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

	dec2phase(t10);
	delay(lambda-pwS4*0.5-pwS6*0.4);

 
        h_shapedpulse("eburp2",4.0,3.5,zero, 0.0, 0.0); 


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

        h_shapedpulse("reburp",4.0,3.5,zero, 0.0, 0.0); 
        zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
}
else
{
        h_shapedpulse("eburp2",4.0,3.5,zero, 2.0e-6, 0.0);
        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.4  - gt5);

        h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.4  - gt5-POWER_DELAY-1.0e-4);
}

	dec2power(dpwr2);				       /* POWER_DELAY */
lk_sample();
if (SE_flg[0] == 'y')
	setreceiver(t13);
else
	setreceiver(t12);
      rcvron();  
statusdelay(C,1.0e-4 );

}		 
Ejemplo n.º 6
0
void pulsesequence()
{
   double          j1xh,
		   pwx2lvl,
		   pwx2,
		hsglvl,
		hsgt,
		   tau,
		   null,
                satfrq,
                satdly,
                satpwr;

   int             iphase;
   char            sspul[MAXSTR],
		nullflg[MAXSTR],
		PFGflg[MAXSTR],
                satmode[MAXSTR];


   null = getval("null");
   pwx2lvl = getval("pwx2lvl");
   pwx2 = getval("pwx2");
   hsglvl = getval("hsglvl");
   hsgt = getval("hsgt");
   j1xh = getval("j1xh");
   getstr("PFGflg",PFGflg);
   getstr("nullflg",nullflg);
        satfrq = getval("satfrq");
        satdly = getval("satdly");
        satpwr = getval("satpwr");
        getstr("satmode",satmode);

   iphase = (int) (getval("phase") + 0.5);
   getstr("sspul",sspul);

   tau = 1.0 / (2.0*j1xh);

    if ((iphase == 1)||(iphase == 2))
     initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v14);
    else
     assign(zero, v14);


/* Check for correct DM settings */
   if ((dm2[A] == 'y') || (dm2[B] == 'y'))
   {
      printf("DM must be set to either 'nny' or 'nnn'.\n");
      psg_abort(1);
   }


   settable(t1,8,phs1);
   settable(t2,8,phs2);
   settable(t3,2,phs3);
   settable(t4,1,phs4);
   settable(t5,4,phs5);

   getelem(t3,ct,v3);
   getelem(t2,ct,oph);

   if (iphase == 2)
      incr(v3);

   add(v14, v3, v3);
   add(v14, oph, oph);


/* BEGIN ACTUAL PULSE SEQUENCE CODE */
   status(A);
      dec2power(pwx2lvl);

   if (sspul[0] == 'y')
   {
        if (PFGflg[0] == 'y')
        {
         zgradpulse(hsglvl,hsgt);
         rgpulse(pw,zero,rof1,rof1);
         zgradpulse(hsglvl,hsgt);
        }
        else
        {
        obspower(tpwr-12);
        rgpulse(500*pw,zero,rof1,rof1);
        rgpulse(500*pw,one,rof1,rof1);
        obspower(tpwr);
        }
   }

      delay(d1);

        if (satmode[0] == 'y')
        {
                if (satfrq != tof)
                obsoffset(satfrq);
                obspower(satpwr);
                rgpulse(satdly,zero,rof1,rof1);
                obspower(tpwr);
                if (satfrq != tof)
                obsoffset(tof);
        }

   status(B);
 
    
    if (PFGflg[0] == 'y')
     {
      if (nullflg[0] == 'y')
      {
        rgpulse(0.5*pw,zero,rof1,rof1);
        delay(tau);
        sim3pulse(2.0*pw,0.0,2.0*pwx2,zero,zero,zero,rof1,rof1);
        delay(tau);
        rgpulse(1.5*pw,two,rof1,rof1);
        zgradpulse(hsglvl,hsgt);
        delay(1e-3);
      }
     } 
     else
     {
      if (null != 0.0)
	{
	rgpulse(pw,zero,rof1,rof1);
	delay(tau);
	sim3pulse(2*pw,0.0,2*pwx2,zero,zero,zero,rof1,rof1);
	delay(tau);
	rgpulse(pw,two,rof1,rof1);
	delay(null);
	}
      }

      rcvroff();
      rgpulse(pw, t1, rof1, rof1);
      delay(tau - (2*pw/PI) - 2*rof1);

      dec2rgpulse(pwx2, v3, rof1, 1.0e-6);
      if (d2 > 0.0)
       delay(d2/2.0 - pw - 3.0e-6 - (2*pwx2/PI));
      else
       delay(d2/2.0);
      rgpulse(2.0*pw, t4, 2.0e-6, 2.0e-6);
      if (d2 > 0.0) 
       delay(d2/2.0 - pw - 3.0e-6 - (2*pwx2/PI)); 
      else 
       delay(d2/2.0);
      dec2rgpulse(pwx2, t5, 1.0e-6, rof2);

      rcvron();
      dec2power(dpwr2);
      delay(tau - POWER_DELAY);

   status(C);
}
Ejemplo n.º 7
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char      
	     satmode[MAXSTR],
	     f1180[MAXSTR],
	     abfilter[MAXSTR];	    /* set 'a' for inphase and 'b' for antiphase */


 int	     t1_counter,icosel,first_FID;

 double      /* DELAYS */
             tau1,                      /* t1/2 */
             tauhn,taunco,taucoca,taunca,tauhaca,taucaha,taucacb,

	     /* COUPLINGS */ 
             jhn = getval("jhn"),
             jnco = getval("jnco"),
             jcoca = getval("jcoca"),
             jnca = getval("jnca"),
             jhaca = getval("jhaca"),
             jcaha = getval("jcaha"),
             jcacb = getval("jcacb"),
   
	     /* PULSES */
             pwN = getval("pwN"),               /* PW90 for N-nuc */
             pwC = getval("pwC"),               /* PW90 for C-nuc */
             pwHs = getval("pwHs"),

	     /* POWER LEVELS */
             satpwr = getval("satpwr"),       /* low power level for presat */
             tpwrsf_d = getval("tpwrsf_d"),       /* fine power level for first pwHs */
             tpwrsf_u = getval("tpwrsf_u"),       /* fine power level for second pwHs */
             tpwrs,
             pwClvl = getval("pwClvl"),         /* power level for C hard pulses */ 
             compC = getval("compC"),         /* amplifier compression factor */ 
             compH = getval("compH"),         /* amplifier compression factor */ 
             pwNlvl = getval("pwNlvl"),         /* power level for N hard pulses */
             rf90onco,pw90onco,              /* power level/pw for CO 90 pulses */ 
             rf180onco,pw180onco,            /* power level/pw for CO 180 pulses */
             rf180offca,pw180offca,          /* power level/pw for CA 180 pulses */

             /* CONSTANTS */
             kappa,
   	     lambda = getval("lambda"),         /* scaling factor for JNCa */
 
	     /* GRADIENT DELAYS AND LEVELS */
             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");

/* LOAD VARIABLES */

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

/* 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(t6, 4, phi6);
  settable(t7, 2, phi7);

/* INITIALIZE VARIABLES AND POWER LEVELS FOR PULSES */

   tauhn = ((jhn != 0.0) ? 1/(4*(jhn)) : 2.25e-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 */
    
     kappa=(taunco - tauhn - gt1 - gstab)/(0.5*ni/sw1)-0.001;
      if (kappa > 1.0) 
     {  
	              kappa=1.0-0.01;
     }   

       if ( phase1 == 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(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;


/* 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.0; /* allow for fine power control via tpwrsf_d */

/* 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,rof1);
      obspower(tpwr);              /* Set power for hard pulses  */
    }
  else  
    {
      obspower(tpwr);              /* Set power for hard pulses  */
      delay(d1);
    }

status(B);

  rcvroff();
     /* eliminate all magnetization originating on 13C */
   
     decpwrf(rf90onco); 
     decrgpulse(pw90onco,zero,0.0,0.0);
      
     zgradpulse(gzlvl0,gt0);
     delay(gstab);
  
/* shaped pulse for water flip-back */
      obspower(tpwrs); obspwrf(tpwrsf_d);
      shaped_pulse("H2Osinc_d",pwHs,one,rof1,0.0);
      delay(2.0e-6);
      obspower(tpwr); obspwrf(4095.0);
  /* shaped pulse */   
   
  /* transfer from HN to N by INEPT */

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

  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,0.0,0.0);  /* 180 for 1H and 15N */

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

  rgpulse(pw,three,rof1,0.0);
      
  zgradpulse(gzlvl3,gt3);
  delay(gstab);
   
/* start transfer from N to CO */
      
  dec2rgpulse(pwN,zero,0.0,0.0);
    
  delay(taunco - gt0 - gstab - POWER_DELAY - 0.5*pw180onco);	 /* 1/4J(NCO) */
	  
  decpwrf(rf180onco);              	/* Set decoupler1 power to rf180onco */

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

  sim3pulse(0.0,pw180onco,2.0*pwN,zero,zero,zero,rof1,rof1);  /* 180 for 13C' and 15N */

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

  decpwrf(rf90onco);            /* Set decoupler1 power to rf90onco */

  delay(taunco - gt0 - gstab - POWER_DELAY - 0.5*pw180onco); 	    /* 1/4J(NCO) */

  dec2rgpulse(pwN,one,0.0,0.0);  /* 90 for 15N */
   
  zgradpulse(gzlvl3*1.1,gt3);
  delay(gstab);
   
  decphase(t4);
  decrgpulse(pw90onco,t4,0.0,0.0);  /* 90 for 13C' */
      
   if (abfilter[0] == 'b')
     {
	  decpwrf(rf180offca);    /* Set decoupler1 power to rf180offca */
	  decshaped_pulse("offC3",pw180offca,zero,0.0,0.0); 
	   
          decpwrf(rf180onco);           /* Set decoupler1 power to rf180onco */

	  delay(taucoca - gt0 - gstab - 0.5*pw180onco - pw180offca - 2.0*POWER_DELAY);  /* 1/4J(COCA) */

          zgradpulse(gzlvl0*0.9,gt0);
          delay(gstab);
	
          decrgpulse(pw180onco,zero,0.0,0.0);  /* 180 13C' */
  	  decpwrf(rf180offca);              	     /* Set decoupler1 power to rf180offca */
	  decshaped_pulse("offC3",pw180offca,zero,0.0,0.0); 
    
          zgradpulse(gzlvl0*0.9,gt0);
          delay(gstab);

	  delay(taucoca - gt0 - gstab - 0.5*pw180onco - pw180offca - 2.0*POWER_DELAY);   /* 1/4J(NCO) */

          decpwrf(rf90onco);    /* Set decoupler1 power to rf90onco */

          decrgpulse(pw90onco,one,0.0,0.0); /* 90 for 13C' do not touch alpha's */

          /* Field crusher gradient */
          zgradpulse(gzlvl3*0.9,gt3);
          delay(gstab);
	  /* Field crusher gradient */

        }

      if (abfilter[0] == 'a')
     {
        zgradpulse(gzlvl0*0.9,gt0);
        delay(gstab);
		  
        decpwrf(rf180offca);   /* Set decoupler1 power to rf180offca */

	delay(0.5*taucoca - gt0 - gstab - POWER_DELAY - 0.5*pw180offca);                   /* 1/8J(COCA) */
	 
	decshaped_pulse("offC3",pw180offca,zero,0.0,0.0); 

	delay(0.5*taucoca - gt0 - gstab - POWER_DELAY - 0.5*pw180offca - 0.5*pw180onco);     /* 1/8J(COCA) */
	
        decpwrf(rf180onco);   /* Set decoupler1 power to rf180onco */

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

        decrgpulse(pw180onco,zero,0.0,0.0);   /* 180 13C' */

        zgradpulse(gzlvl0*0.9,gt0);
        delay(gstab);
	
	decpwrf(rf180offca);      

	delay(0.5*taucoca - gt0 - gstab - POWER_DELAY - 0.5*pw180onco - 0.5*pw180offca); 	  /* 1/8J(COCA) */
	      
        decshaped_pulse("offC3",pw180offca,zero,0.0,0.0);
	 
	delay(0.5*taucoca - gt0 - gstab - POWER_DELAY - 0.5*pw180offca); /* 1/8J(COCA) */

        decpwrf(rf90onco);         /* Set decoupler1 power to rf90onco */

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


        decrgpulse(pw90onco,zero,0.0,0.0);  /* 90 for 13C' */

        /* Field crusher gradient */
           zgradpulse(gzlvl3*0.9,gt3);
           delay(gstab);
	/* Field crusher gradient */

      }  
 
     dec2rgpulse(pwN,t1,0.0,0.0); /* 90 15N */
  
     if (lambda>0.0)
      { 
        delay(lambda*tau1);  /* (lambda)t1/2 */
   
        decpwrf(rf180offca);   
        sim3shaped_pulse("","offC3","",0.0,pw180offca,2.0*pwN,zero,zero,zero,rof1,rof1);

        delay(lambda*tau1);  /* (lambda)t1/2 */
      }

     delay(tau1);                             /* t1/2 */
     delay(taunco - tauhn - pw180onco);  

     decpwrf(rf180onco);
     decrgpulse(pw180onco,zero,0.0,0.0);     /* 180 for 13C' */

     delay((1-kappa)*tau1);                  /* (1-k)t1/2 */

     dec2rgpulse(2.0*pwN,zero,0.0,0.0);     /* 180 for 15N */
   
     delay((taunco - tauhn - gt1 - gstab) - kappa*tau1);  /* 1/4J(NCO) - 1/4J(NH) - kt1/2 */
          
     zgradpulse(gzlvl1,gt1);
     delay(gstab);
   
   /* start TROSY transfer from N to HN */
      
         
     sim3pulse(pw,0.0,0.0,t2,zero,zero,rof1,rof1);

     zgradpulse(gzlvl5,gt5);
     delay(gstab);
 
     delay(tauhn - gt5 - gstab - POWER_DELAY);
   
      
     decpwrf(rf180onco);
     sim3pulse(2.0*pw,pw180onco,2*pwN,zero,zero,zero,rof1,rof1);
   
     delay(tauhn - gt5 - gstab - POWER_DELAY);
   
      
     zgradpulse(gzlvl5,gt5);
     delay(gstab);
   
     decpwrf(rf90onco);
     sim3pulse(pw,pw90onco,pwN,one,t6,zero,rof1,rof1);
   
      /* shaped pulse WATERGATE */
         obspower(tpwrs); obspwrf(tpwrsf_u);
         shaped_pulse("H2Osinc_u",pwHs,t2,rof1,0.0);
         obspower(tpwr); obspwrf(4095.0);
       /* shaped pulse */
   
     zgradpulse(gzlvl5*0.8,gt5);
     delay(gstab);
      
     delay(tauhn - gt5 - gstab - 2.0*POWER_DELAY - pwHs);
   
     sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,rof1,rof1);
   
      
     delay(tauhn - gt5 - gstab - 2.0*POWER_DELAY);
   
      decpower(dpwr);
      
     zgradpulse(gzlvl5*0.8,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);
      
   status(C);
     setreceiver(t7);
}
Ejemplo n.º 8
0
void pulsesequence()

{
/* DECLARE VARIABLES */

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

 int	     phase,t1_counter;

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

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

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

/* LOAD VARIABLES */

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

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

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

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



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

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

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

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

/* check validity of parameter range */

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

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

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

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

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

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

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

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

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

/* LOAD VARIABLES */

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

/* Phase incrementation for hypercomplex 2D data */

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

/* Set up f1180  */

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

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

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

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


/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */

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

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

  obsoffset(tof);

status(B);

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

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

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

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

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

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

  txphase(zero);
  dec2phase(zero);

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

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

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

  txphase(one);
  dec2phase(t1);

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

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

  rgpulse(pw,one,0.0,0.0);

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

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

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

  dec2phase(zero);

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

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

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

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

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

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

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

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

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

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

  dec2phase(t3);

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

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

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

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

  rgpulse(pw,t4,0.0,0.0);

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

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

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

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

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

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

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

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

  txphase(zero);
  dec2phase(zero);

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

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

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

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

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

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

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

  dec2rgpulse(pwn,zero,0.0,0.0);

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

/* acquire data */

status(C);
     setreceiver(t7);
}
Ejemplo n.º 9
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);
}		 
Ejemplo n.º 10
0
pulsesequence()
{
 
char      N15edit[MAXSTR], C13edit[MAXSTR];	      /* C13 editing*/
	   
 double tpwrs,pwC,d2,tau,d3,d4,d5,d6,
 gt2,gt3,gt0,gzlvl0,gzlvl2,gzlvl3,phincr1,tpwrsf_u,tpwrsf_d,pwHs,compH,
 pwN,pwNlvl,ref_pwr,ref_pw90,pwZa,pwClvl,JXH;     
  


     pwC=getval("pwC");
     pwClvl=getval("pwClvl");
     ref_pw90=getval("ref_pw90"); 
     ref_pwr=getval("ref_pwr"); 
     pwHs=getval("pwHs");
     gt2=getval("gt2");
     gt3=getval("gt3");
     gt0=getval("gt0");
 /*    tau=getval("tau"); */
     d2=getval("d2");
     d3=getval("d3");
     d4=getval("d4");
     d5=getval("d5");
     gzlvl2=getval("gzlvl2");
     gzlvl3=getval("gzlvl3");
     gzlvl0=getval("gzlvl0");
     phincr1 = getval("phincr1");
     d6=getval("d6");
     JXH = getval("JXH");

 
    tpwrsf_u = getval("tpwrsf_u"); /* fine power adjustment           */
    tpwrsf_d = getval("tpwrsf_d"); /* fine power adjustment           */
    pwHs = getval("pwHs");       /* H1 90 degree pulse length at tpwrs2 */
    compH = getval("compH");
    pwNlvl = getval("pwNlvl");                    /* power for N15 pulses */
    pwN = getval("pwN");          /* N15 90 degree pulse length at pwNlvl */
    
	 
 getstr("N15edit",N15edit); 
 getstr("C13edit",C13edit); 
 pwZa=pw;                         /* initialize variable */

/* optional editing for C13 enriched samples */
  if ((N15edit[A]=='y') && (C13edit[A]=='n')) 
     {
      pwC = 0.0;  
      if (2.0*pw > 2.0*pwN) pwZa = pw; 
      else pwZa = pwN; 
     }      
  if ((C13edit[A]=='y')&& (N15edit[A]=='n')) 
     {
      pwN = 0.0;  
      if (2.0*pw > 2.0*pwC) pwZa = pw; 
      else pwZa = pwC; 
     }      
  if ((C13edit[A]=='y') && (N15edit[A]=='y'))
     {
      
      if (2.0*pw > 2.0*pwN) pwZa = pw; /*pwN always longer than pwC*/
      else pwZa = pwN; 
     }      

tau = 1/(2*(JXH));

printf("tau is %f\n",tau);
printf("pwZa is %f\n",pwZa);

/* set pwZa to either pw or pwX depending on which is the largest (for calculating delays) */


/*calculate phase cycle for WATERGATE*/
   hlv(ct,v1);
   hlv(v1,v2);
   mod2(v2,v3);
   dbl(v3,v4);
   assign(two,v5);
   add(v4,v5,v6);

   obsstepsize(1.0);
   if (phincr1 < 0.0) phincr1=360+phincr1;
   initval(phincr1,v7);

   settable(t1,16,ph1);
   settable(t2,16,ph2);
   settable(t3,16,ph3);
   settable(t4,16,ph4);      
   settable(t5,16,ph5);
   settable(t6,16,ph6);
   settable(t7,16,ph7); 
   settable(t8,16,ph8);
   settable(t9,16,ph9);
   settable(t10,2,ph10); 



   tpwrs=tpwr-20.0*log10(pwHs/(compH*pw*1.69)); /* sinc pulse */
   tpwrs = (int) (tpwrs) +6.0;  /* to permit finepower ~2048 */ 




/* START THE PULSE SEQUENCE */

     status(A);
     decpower(pwClvl);
     delay(d1);
     obsoffset(tof);
     /*zgradpulse(gzlvl2,gt2);
     delay(d3+d5-pwHs);*/
     obspower(tpwrs); obspwrf(tpwrsf_d);
     shaped_pulse("H2Osinc_d",pwHs,t2,rof1,rof1);

     status(B);
     obspower(tpwr); obspwrf(4095.0);
     rgpulse(pw,t1,3.0e-6,0.0);
     delay(d2);
      zgradpulse(gzlvl2,gt2);
     delay(d5);
     rgpulse(pw,t3,3.0e-6,3.0e-6);
     obspower(tpwrs); obspwrf(tpwrsf_u);
     shaped_pulse("H2Osinc_u",pwHs,t4,rof1,rof1);

     zgradpulse(gzlvl3,gt3);
     delay(d3); obspwrf(tpwrsf_d);
     shaped_pulse("H2Osinc_d",pwHs,t6,rof1,rof1);
     obspower(tpwr); obspwrf(4095.0);
     rgpulse(pw,t5,3.0e-6,3.0e-6);
     delay(d2);
     zgradpulse(gzlvl2,gt2);     
     delay(d5);
     delay(d6);

   
     zgradpulse(gzlvl0,gt0);
     obspower(tpwrs);
     obspwrf(tpwrsf_d);
     xmtrphase(v7);
     delay(tau-pwHs-pwZa-gt0-d6-pwN);
     shaped_pulse("H2Osinc_d",pwHs,v6,rof1,rof1);
     obspower(tpwr);
     obspwrf(4095.0);
     xmtrphase(zero); 
     dec2power(pwNlvl);

     dec2rgpulse(pwN,zero,1.0e-6,1.0e-6);
     decrgpulse(pwC,zero,1.0e-6,1.0e-6);
     rgpulse(2*pw,t7,1.0e-6, 1.0e-6);
     decrgpulse(pwC,t10,1.0e-6,1.0e-6);
     dec2rgpulse(pwN,t10,1.0e-6,1.0e-6);  
     obspower(tpwrs);
     obspwrf(tpwrsf_u); 
     shaped_pulse("H2Osinc_u",pwHs,t9,rof1,rof1);
     delay(tau-pwHs-pwZa-gt0-d6-pwN);
     zgradpulse(gzlvl0,gt0);
     dec2power(dpwr2);
     decpower(dpwr);
     delay(d6); 

     setreceiver(t8);
   status(C);
}
Ejemplo n.º 11
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            Nterminus[MAXSTR], /*Flag to use BB 180 in place of reburp    */
            ch_plane[MAXSTR];    /* Flag to start t2 @ halfdwell             */

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

 double      tau1,         /*  t1 delay */
 	     tau2,         /*  t2 delay */
             taua,         /*  ~ 1/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 */
             pwc90a,       /* PW90 at d_c90a power level */
             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 level for waltz decoupling */
             pwClvl,        /* power level for 13C pulses on dec1 - 64 us 
                              90 for part a of the sequence  */
             d_c90,        /* power level for pw90 on Ca or Co nucleus */
             d_c90a,       /* power level for pw90a*/
             d_c180,       /* power level for pw180 on Ca or Co nucleus */
             d_coff180,    /* power level for pbox pw180 of Co nucleus */
             d_reb,        /* power level for reburp 180 pulse */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */
             waltzB1,      /* proton decoupling field */
             compH,        /* compression factor */
             compC,        /* compression factor */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             dof_coca,     /* offset between Co and Ca for comp180 at ~ 12.5 kHz */
             bw,ofs,ppm,   /* temporary Pbox parameters */
 

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

/* LOAD VARIABLES */


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

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  TC   = getval("TC"); 
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  satpwr = getval("satpwr");
  waltzB1 = getval("waltzB1");
  compH = getval("compH");
  compC = getval("compC");
  pwC = getval("pwC");
  pwClvl = getval("pwClvl");
  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");

  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");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  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);

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

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

   pwc90a = 1/(4.0 * (15000*(dfrq/150))) ;  /*  15kHz at 150 MHz 13C */
   d_c90a = pwClvl - 20.0*log10(pwc90a/(compC*pwC));
   d_c90a = (int) (d_c90a + 0.5);

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

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

 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(d_c90a);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

   rcvroff();
   delay(20.0e-6);
   
   decrgpulse(pwc90a,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*pwc90a,zero,zero,0.0,0.0);
   
   txphase(t1); decphase(zero); 
   zgradpulse(gzlvl1,gt1);

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


   rgpulse(pw,t1,0.0,0.0);

   decpower(d_c90);

   zgradpulse(gzlvl2,gt2);
   delay(gstab);
/* Ca to N, while refocusing to H */
   decrgpulse(pwc90,zero,0.0,0.0);

   delay(taub/2.0);
   rgpulse(2.0*pw,zero,0.0,0.0);

   decpower(d_c180);

   delay(0.5*TC - taub/2.0 - 2.0*pw - 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);

/* clean-up before proceeding */

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

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

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

     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(2.0e-6);
   }
   else {
       delay(tau1);
     decrgpulse(pwc90a, one, 0.0, 0.0);
     decrgpulse(2.0*pwc90a, zero, 2.0e-6, 2.0e-6);
     decrgpulse(pwc90a, one, 0.0, 0.0);
       dec2phase(zero);
       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 */

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

   decrgpulse(pwc90,t5,0.0,0.0);

/* refocus Ca-N and Ca-H couplings and constant time CA evolution */

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

     decphase(zero);
     decpower(pwClvl); decpwrf(d_coff180);
   simshaped_pulse("","spco180",2.0*pw,pwcoff180,zero,zero,2.0e-6,2.0e-6);	/* Bloch siegert correction */
     decpower(d_c180); decpwrf(4095.0);
   decrgpulse(pwcon180,t4,2.0e-6,2.0e-6);
   decpwrf(d_coff180); decpower(pwClvl);
   dec2rgpulse(2.0*pwN,zero,0.0,0.0);
     delay(tau2);
   decshaped_pulse("spco180", pwcoff180, zero, 2.0e-6, 2.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 - 2.0e-6 -pwcon180/2 - 2.0*pwN - pwcoff180 \
          - 2.0*2.0e-6 - 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);
   if (Nterminus[A]=='y')
   {
    decpwrf(4095.0); decpower(pwClvl);
    delay(taua - 2.0*POWER_DELAY - gt8 - 0.5*pwC );
    simshaped_pulse("","",2.0*pw,2.0*pwC,zero,zero,0.0,0.0);	/* Purge all C outside 26-46 ppm */
    zgradpulse(gzlvl8,gt8);
    dec2power(dpwr2);    /* set power for 15N decoupling */
    decpower(dpwr);      /* set power for 13C decoupling */
    delay(taua - 0.5*pwreb180 - 2.0e-6 - gt8 - 2.0*POWER_DELAY);
   }
  else
   {
    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.0,0.0);	/* Purge all C outside 26-46 ppm */
    zgradpulse(gzlvl8,gt8);
    dec2power(dpwr2);    /* set power for 15N decoupling */
    decpower(dpwr);      /* set power for 13C decoupling */
    decpwrf(4095.0);
    delay(taua - 0.5*pwreb180 - 2.0e-6 - gt8 - 3.0*POWER_DELAY);
   }


   rgpulse(pw,zero,0.0,0.0);

/* BEGIN ACQUISITION */

status(C);
   setreceiver(t6);

}
Ejemplo n.º 12
0
pulsesequence()
{
  /* DECLARE AND LOAD VARIABLES */
  shape offC10P;
  char f1180[MAXSTR],		/* Flag to start t1 @ halfdwell */
       f2180[MAXSTR],		/* Flag to start t2 @ halfdwell */
       mixpat[MAXSTR],		/* Spinlock waveform            */
       H2Opurge[MAXSTR], stCdec[MAXSTR],	/* calls STUD+ waveforms from shapelib */
       STUD[MAXSTR];		/* apply automatically calculated STUD decoupling */

  int ncyc, t1_counter,		/* used for states tppi in t1 */
      first_FID, t2_counter;	/* used for states tppi in t2 */

  double tau1,			/*  t1 delay */
         tau2,			/*  t2 delay */
         ni = getval("ni"), ni2 = getval("ni2"),
	 stdmf = getval("dmf80"),	/* dmf for 80 ppm of STUD decoupling */
         rf80 = getval("rf80"),	/* rf in Hz for 80ppm STUD+ */
         taua = getval("taua"),	/* time delays for CH coupling evolution */
         taub = getval("taub"), tauc = getval("tauc"),
	 /* string parameter stCdec calls stud decoupling waveform from your shapelib. */
         studlvl,		/* coarse power for STUD+ decoupling */
         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 length for the SLP pulse is automatically calculated   */
         /* by the macro "hcch_tocsyP".  The SLP pulse shape,"offC10P" is created       */
         /* by Pbox "on-the-fly"                                                       */
         pwC10,			/* 180 degree selective sinc pulse on CO(174ppm) */
         rf7,			/* fine power for the pwC10 ("offC10P") pulse */
         compC = getval("compC"),	/* adjustment for C13 amplifier compression */
         mixpwr = getval("mixpwr"), mixpwrf = getval("mixpwrf"), mixdmf = getval("mixdmf"),
         pwmix = getval("pwmix"), mixres = getval("mixres"),
	 pwNlvl = getval("pwNlvl"),		/* power for N15 pulses */
         pwN = getval("pwN"),	/* N15 90 degree pulse length at pwNlvl */
         sw1 = getval("sw1"), sw2 = getval("sw2"),
	 gt0 = getval("gt0"),	/* other gradients */
         gt3 = getval("gt3"), gt4 = getval("gt4"), gt5 = getval("gt5"),
         gt7 = getval("gt7"), gzlvl0 = getval("gzlvl0"), gzlvl3 = getval("gzlvl3"),
         gzlvl4 = getval("gzlvl4"), gzlvl5 = getval("gzlvl5"), gzlvl6 = getval("gzlvl6"),
         gzlvl7 = getval("gzlvl7");

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

  getstr("mixpat", mixpat);
  getstr("f1180", f1180);
  getstr("f2180", f2180);
  getstr("H2Opurge", H2Opurge);
  getstr("STUD", STUD);

  if (first_FID)		/* calculate the shape only once */
  {
    rf7 = 1.0e-6 * 80.5 * 600.0 / sfrq;
    offC10P = pbox_make("offC10P", "sinc180", rf7, 139.0 * dfrq, pwClvl, compC * pwC);
  }
  else
    offC10P = getRsh("offC10P");

  pwC10 = offC10P.pw;
  rf7 = offC10P.pwrf;


  /* 80 ppm STUD+ decoupling */
  strcpy(stCdec, "stCdec80");
  studlvl = pwClvl + 20.0 * log10(compC * pwC * 4.0 * rf80);
  studlvl = (int) (studlvl + 0.5);


  /*   LOAD PHASE TABLE    */
  settable(t3, 2, phi3);
  settable(t5, 4, phi5);
  settable(t11, 4, rec);



  /*   INITIALIZE VARIABLES   */

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

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

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

  /* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

  if (pw > 80.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 */
  if (phase1 == 2)
    tsadd(t3, 1, 4);
  if (phase2 == 2)
    tsadd(t5, 1, 4);


  /*  C13 TIME INCREMENTATION and set up f1180  */

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

  ncyc = getval("ncyc");
  if (ix < 2)
    printf("ncyc = %d, mix = %.6f\n", ncyc, (double) ncyc * pwmix);

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

  /*   BEGIN PULSE SEQUENCE   */

  status(A);
  if (dm3[B] == 'y')
    lk_sample();
  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 */
  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(t3);
  delay(1.0e-5);

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

  if (dm3[B] == 'y')
  {
    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, t3, 0.0, 0.0);	/* 1H pulse excitation */
  zgradpulse(gzlvl0, gt0);	/* 2.0*GRADIENT_DELAY */
  decphase(zero);
  delay(taua + tau1 - gt0 - 2.0 * GRADIENT_DELAY - 2.0 * pwC);
  decrgpulse(2.0 * pwC, zero, 0.0, 0.0);
  txphase(zero);
  delay(tau1);
  rgpulse(2.0 * pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl0, gt0);
  txphase(one);
  decphase(t5);
  delay(taua - gt0);
  rgpulse(pw, one, 0.0, 0.0);
  zgradpulse(gzlvl3, gt3);
  delay(2.0e-4);
  decrgpulse(pwC, t5, 0.0, 0.0);
  delay(tau2);
  dec2rgpulse(2.0 * pwN, zero, 0.0, 0.0);
  zgradpulse(gzlvl4, gt4);	/* 2.0*GRADIENT_DELAY */
  decphase(zero);
  decpwrf(rf7);
  delay(taub - 2.0 * pwN - gt4 - 2.0 * GRADIENT_DELAY);
  decshaped_pulse("offC10P", pwC10, zero, 0.0, 0.0);
  txphase(zero);
  decpwrf(rf0);
  delay(taub - 2.0 * pw);
  rgpulse(2.0 * pw, zero, 0.0, 0.0);
  delay(tau2);
  decrgpulse(2.0 * pwC, zero, 0.0, 0.0);
  decpwrf(rf7);
  delay(taub);
  decshaped_pulse("offC10P", pwC10, zero, 0.0, 0.0);
  zgradpulse(gzlvl4, gt4);	/* 2.0*GRADIENT_DELAY */
  decpwrf(rf0);
  delay(taub - gt4 - 2.0 * GRADIENT_DELAY);
  decrgpulse(pwC, one, 0.0, 0.0);
  decpower(mixpwr);
  decpwrf(mixpwrf);
  if (ncyc > 0)
    decspinlock(mixpat, 1.0 / mixdmf, mixres, one, ncyc);
  decpower(pwClvl);
  decpwrf(rf0);
  if (H2Opurge[A] == 'y')
  {
    obspwrf(1000.0);
    rgpulse(900 * pw, zero, 0.0, 0.0);
    rgpulse(500 * pw, one, 0.0, 0.0);
    obspwrf(4095.0);
  }
  zgradpulse(gzlvl7, gt7);
  delay(50.0e-6);
  rgpulse(pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl7, gt7 / 1.6);
  decrgpulse(pwC, three, 100.0e-6, 0.0);
  zgradpulse(gzlvl5, gt5);
  decphase(zero);
  delay(tauc - gt5);
  simpulse(2.0 * pw, 2.0 * pwC, zero, zero, 0.0, 0.0);
  zgradpulse(gzlvl5, gt5);
  delay(tauc - gt5);
  decrgpulse(pwC, zero, 0.0, 0.0);
  zgradpulse(gzlvl3, gt3);
  if (dm3[B] == 'y')
  {
    setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
    dec3rgpulse(1 / dmf3, three, 2.0e-6, 2.0e-6);
    dec3blank();
    lk_autotrig();		/* resumes lock pulsing */
  }
  delay(2.0e-4);
  rgpulse(pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl6, gt5);
  delay(taua - gt5 + rof1);
  simpulse(2.0 * pw, 2.0 * pwC, zero, zero, 0.0, rof1);
  zgradpulse(gzlvl6, gt5);
  delay(taua - gt5 - 2.0 * pwC - 2.0 * POWER_DELAY);
  decrgpulse(pwC, zero, 0.0, 0.0);
  decrgpulse(pwC, one, 0.0, 0.0);
  if (STUD[A] == 'y')
    decpower(studlvl);
  else
    decpower(dpwr);
  dec2power(dpwr2);
  rgpulse(pw, zero, 0.0, rof2);
  rcvron();
  if (dm3[B] == 'y')
    lk_sample();
  setreceiver(t11);
  if ((STUD[A] == 'y') && (dm[C] == 'y'))
  {
        decunblank();
        decon();
        decprgon(stCdec,1/stdmf, 1.0);
        startacq(alfa);
        acquire(np, 1.0/sw);
        decprgoff();
        decoff();
        decblank();
    if (dm2[C] == 'y')
    {
      setstatus(DEC2ch, TRUE, dmm2[C], FALSE, dmf2);
    }
  }
  else
    status(C);
}
Ejemplo n.º 13
0
void pulsesequence()
{

/* DECLARE VARIABLES */

char
	URA[MAXSTR],				  /* Setup for U-imino - U-H6 */
	flipback[MAXSTR],			

        CCdseq[MAXSTR],

	CYT[MAXSTR],				  /* Setup for C-imino - C-H6 */
	CChomodec[MAXSTR],			  /* Setup for C-imino - C-H6 */
	C5[MAXSTR],				  /* Setup for C-imino - C-H6 */
	C6[MAXSTR],				  /* Setup for C-imino - C-H6 */
        CT[MAXSTR],                                /* constant time in t1 */
	N15refoc[MAXSTR],                         /* N15 pulse in middle of t1*/
	f1180[MAXSTR],                        /* Flag to start t1 @ halfdwell */
        f2180[MAXSTR];                        /* Flag to start t1 @ halfdwell */

int	ni2 = getval("ni2"),
        t1_counter,
        t2_counter;

double      
        CCdpwr = getval("CCdpwr"),    /*   power level for CC decoupling */
        CCdres = getval("CCdres"),    /*   dres for CC decoupling */
        CCdmf = getval("CCdmf"),      /*   dmf for CC decoupling */

	tau1,                                                /*  t1 delay */
        tau2,                                                /*  t2 delay */
	    lambda = 0.94/(4.0*getval("JCH")),        /* 1/4J C-H INEPT delay */
	    lambdaN = 0.94/(4.0*getval("JNH")),       /* 1/4J N-H INEPT delay */

        pwClvl = getval("pwClvl"),              /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
        rfC,                      /* maximum fine power when using pwC pulses */
	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 */
        rfN,                      /* maximum fine power when using pwN pulses */
        compN = getval("compN"),  /* adjustment for N15 amplifier compression */

        tpwr = getval("tpwr"),    	               /* power for H1 pulses */
        pw = getval("pw"),               /* H1 90 degree pulse length at tpwr */
        rfH,                       /* maximum fine power when using pw pulses */
	compH = getval("compH"),   /* adjustment for H1 amplifier compression */


        tof_75,                  /* tof shifted to 7.5 ppm for H4-N4 transfer */
        tof_65,                  /* tof shifted to 6.0 ppm for H4-N4 transfer */
        tof_125,                   /* tof shifted to 12 ppm for H3-N3 transfer */

	dof_169,		 /* dof shifted to 169 ppm for N3-C4 transfer */
	dof_140,     /* dof shifted to 140 ppm for C4-C5-C6 transfer and DEC1 */
	dof_104,     /* dof shifted to 104 ppm for C4-C5-C6 transfer and DEC1 */
	dof_153,     /* dof shifted to 153 ppm for C4-C5-C6 transfer and DEC1 */
	dof_135,     /* dof shifted to 135 ppm for C4-C5-C6 transfer and DEC1 */
	dof_120,     /* dof shifted to 120 ppm for C4-C5-C6 transfer and DEC1 */
	dof_130,     /* dof shifted to 130 ppm for C4-C5-C6 transfer and DEC1 */
	dof_141,     /* dof shifted to 141 ppm for C4-C5-C6 transfer and DEC1 */
	dof_133,     /* dof shifted to 132.5 ppm for C4-C5-C6 transfer and DEC1 */
	dof_123,     /* dof shifted to 122.5 ppm for C4-C5-C6 transfer and DEC1 */
	dof_98,     /* dof shifted to 98.0 ppm for C4-C5-C6 transfer and DEC1 */
	dof_175,     /* dof shifted to 175 ppm for C4-C5-C6 transfer and DEC1 */

	dof2_98,       /* dof2 shifted to 98.5 ppm for H4-N4 and N4-C4 transfer */
        dof2_160,     /* dof2 shifted to 160 ppm for H3-N3 and N3-C4 transfer */

/* p_d is used to calculate the isotropic mixing */
        p_d,                 /* 50 degree pulse for DIPSI-3 at rfdC-rfdN-rfdH */
        pwZa,                /* the largest of 2.0*pw and 2.0*pwN */
        rfdC,             /* fine C13 power for 1.9 kHz rf for 500MHz magnet  */
        p_d2,                /* 50 degree pulse for DIPSI-3 at rfdC3 */
        rfdC3,             /* fine C13 power for 10 kHz rf for 500MHz magnet */
        rfdN,             /* fine N15 power for 1.9 kHz rf for 500MHz magnet  */
        rfdH,              /* fine H1 power for 1.9 kHz rf for 500MHz magnet  */
        ncyc_hn = getval("ncyc_hn"),  /* number of pulsed cycles in HN half-DIPSI-3 */
        ncyc_nc = getval("ncyc_nc"), /* number of pulsed cycles in NC DIPSI-3 */
        ncyc_cc = getval("ncyc_cc"), /* number of pulsed cycles in CC DIPSI-3 */

        CTdelay = getval("CTdelay"),     /* total constant time evolution */

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

        finepwrf = getval("finepwrf"), /*     fine power adjustment           */

        pwHs = getval("pwHs"),         /* H1 90 degree pulse length at tpwrs */
        tpwrs,                   /* power for the pwHs ("rna_H2Osinc") pulse */

        pwHs2 = getval("pwHs2"),       /* H1 90 degree pulse length at tpwrs2 */
        tpwrs2,                           /* power for the pwHs2 square pulse */


  gzlvl0 = getval("gzlvl0"),
  gzlvl3 = getval("gzlvl3"),
  gt3 = getval("gt3"),
  gzlvl4 = getval("gzlvl4"),
  gt4 = getval("gt4"),
  gzlvl5 = getval("gzlvl5"),
  gt5 = getval("gt5"),
  gzlvlr = getval("gzlvlr");

  getstr("URA",URA);
  getstr("flipback",flipback);
  getstr("CYT",CYT);
  getstr("C5",C5);
  getstr("C6",C6);
    getstr("CT",CT);
  getstr("N15refoc",N15refoc);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("CCdseq",CCdseq);
  getstr("CChomodec",CChomodec);


/* LOAD PHASE TABLE */
/*
static int  phi1[2] = {0,2},
	    phi3[8] = {0,0,0,0, 2,2,2,2},
            phi4[16]= {0,0,0,0, 0,0,0,0, 2,2,2,2, 2,2,2,2},
            phi5[4] = {0,0,2,2},
            rec2[8] = {0,2,2,0, 2,0,0,2};

*/
 
	settable(t1,2,phi1);
	settable(t3,8,phi3);
	settable(t4,16,phi4);
	settable(t5,4,phi5);
	settable(t10,8,rec2);


/* INITIALIZE VARIABLES */
  if (2.0*pw > 2.0*pwN) pwZa = 2.0*pw;
  else pwZa = 2.0*pwN;


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

/* maximum fine power for pwN pulses */
        rfN = 4095.0;

/* maximum fine power for pw pulses */
        rfH = 4095.0;

/* different offset values tof=H2O, dof=110ppm, dof2=200ppm */
/* For U 10-15 ppm in Imino region during acquisition (ie 12.5 +/- 2.5 ppm)
   and 4.5 -9 ppm during indirect dimensional acquisition (ie 6.75 +/- 2.25 ppm)
   For C 4.5 -9ppm (6.75 +/- 2.25ppm) during indirect acqusisition and 6-9ppm during direct (7.5 +/- 1.5ppm)
*/
	tof_65 = tof + 2.05*sfrq;       /* tof shifted to nH2/nH */
	tof_75 = tof + 2.5*sfrq;        /* tof shifted to nH2 */
	tof_125 = tof + 7.8*sfrq;	/* tof shifted to nH */
	dof_175 = dof + 65*dfrq;	/* dof shifted to C4 */
	dof_169 = dof + 59*dfrq;	/* dof shifted to C4 */
	dof_140 = dof + 30*dfrq;	/* dof shifted to C6 */
	dof_104 = dof - 6.0*dfrq;	/* dof shifted to C6 */
	dof_141 = dof + 31*dfrq;	/* dof shifted to C6 */
	dof_153 = dof + 43*dfrq;	/* dof shifted to C6 */
	dof_135 = dof + 25*dfrq;	/* dof shifted to C6 */
	dof_133 = dof + 22.5*dfrq;	/* dof shifted to C6 */
	dof_120 = dof + 10*dfrq;	/* dof shifted to C6 */
	dof_130 = dof + 20*dfrq;	/* dof shifted to C6 */
	dof_98 = dof - 12*dfrq;	        /* dof shifted to C6 */
	dof_123 = dof + 12.5*dfrq;	/* dof shifted to C6 */
	dof2_160 = dof2 - 40*dfrq2;	/* dof2 shifted to Nh */
	dof2_98 = dof2 - 101.5*dfrq2;   /* dof2 shifted to Nh2 */

/* 1.9 kHz field strength DIPSI-3 at 500MHz adjusted for this sfrq*/
        p_d = (5.0)/(9.0*4.0*1900.0*(sfrq/500.0)); 

/* fine C13 power for dipsi-3 isotropic mixing on C4 region */
        rfdC = (compC*4095.0*pwC*5.0)/(p_d*9.0);
        rfdC = (int) (rfdC + 0.5);

/* 10 kHz field strength DIPSI-3 at 500MHz adjusted for this sfrq*/
        p_d2 = (5.0)/(9.0*4.0*10000.0*(sfrq/500.0)); 

/* fine C13 power for dipsi-3 isotropic mixing on C2/C6 region */
        rfdC3 = (compC*4095.0*pwC*5.0)/(p_d2*9.0);
        rfdC3 = (int) (rfdC3 + 0.5);

/* fine N15 power for dipsi-3 isotropic mixing on Nh region */
        rfdN = (compN*4095.0*pwN*5.0)/(p_d*9.0);
        rfdN = (int) (rfdN + 0.5);

/* fine H1 power for half dipsi-3 isotropic mixing on nH2 region */
        rfdH = (compH*4095.0*pw*5.0)/(p_d*9.0);
        rfdH = (int) (rfdH + 0.5);

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

/* selective H20 square pulse */
        tpwrs2 = tpwr - 20.0*log10(pwHs2/(compH*pw));
        tpwrs2 = (int) (tpwrs2);

/* number of cycles and mixing time */
        ncyc_nc = (int) (ncyc_nc + 0.5);
	ncyc_hn = (int) (ncyc_hn + 0.5);
        ncyc_cc = (int) (ncyc_cc + 0.5);

  if (ncyc_nc > 0 )
   {
        printf("NC-mixing time is %f ms.\n",(ncyc_nc*51.8*4*p_d));
   }

  if (ncyc_cc > 0 )
   {
        printf("CC-mixing time is %f s.\n",(ncyc_cc*51.8*4*p_d2));
   }


/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 2)
         tsadd(t5,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(t5,2,4); tsadd(t10,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;

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

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

        t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );

  if(t2_counter % 2)
   {
        tsadd(t3,2,4);
        tsadd(t10,2,4);
   }



/* CHECK VALIDITY OF PARAMETER RANGE */


  if ((CT[A]=='y') && (ni/sw1 > CTdelay))
  { text_error( " ni is too big. Make ni equal to %d or less.\n",
      ((int)(CTdelay*sw1)) );                                       psg_abort(1); }


    if( sfrq > 610 )
        { printf("Power Levels at 750/800 MHz may be too high for probe");
          psg_abort(1); }

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

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

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

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

    if( ((dm[C] == 'y') && (dm2[C] == 'y') && (at > 0.18)) )
    {
        text_error("check at time! Don't fry probe !! ");
        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( pw > 20.0e-6 )
    {
        printf("dont fry the probe, pw too high ! ");
        psg_abort(1);
    }

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

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

    if (gzlvlr > 500 || gzlvlr < -500)
    {
	text_error(" RDt1-gzlvlr must be -500 to 500 (0.5G/cm) \n");
	psg_abort(1);
    }

    if( ncyc_hn > 2 )
    {
        text_error("check H->N half-dipsi-3 time !! ");
        psg_abort(1);
    }

    if( ncyc_nc > 7 )
    {
        text_error("check N->C dipsi-3 time !! ");
        psg_abort(1);
    }

    if( ncyc_cc > 7 )
    {
        text_error("check C->C dipsi-3 time !! ");
        psg_abort(1);
    }


    if((C5[A] == 'y') && ( ncyc_cc > 4) )
    {
        text_error("check C->C dipsi-3 time equal to 6.5 ms !! ");
        psg_abort(1);
    }


    if((C6[A] == 'y') && (( ncyc_cc > 6) || ( ncyc_cc < 3)))
    {
        text_error("check C->C dipsi-3 time equal to 13 ms !! ");
        psg_abort(1);
    }

    if( (URA[A] == 'y') && (CYT[A] == 'y') )
    {
        text_error("Choose either URA or CYT !! ");
        psg_abort(1);
    }

    if( (URA[A] == 'n') && (CYT[A] == 'n') )
    {
        text_error("Do you really want to run this experiment ?? ");
        psg_abort(1);
    }


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);


        obspower(tpwr);
	obspwrf(rfH);
	obsstepsize(0.5);
        decpower(pwClvl);
        decpwrf(rfC);
	decstepsize(0.5);
        dec2power(pwNlvl);
	dec2pwrf(rfN);
	dec2stepsize(0.5);

        if (C6[A]=='y') decoffset(dof_141);	/* frequency for the NC-tocsy */

  if (URA[A] == 'y')
   {
        obsoffset(tof_65);	/* Set the proton frequency to U-nH */
        dec2offset(dof2_160);   /* Set the nitrogen frequency to U-Nh */
        if (C5[A]=='y') decoffset(dof_104);
   }
  else if (CYT[A] == 'y')
   {
        obsoffset(tof_65);      /* Set the proton frequency to C-nH2 */
	dec2offset(dof2_98);    /* Set the nitrogen frequency to C-Nh2 */
        if (C5[A]=='y') decoffset(dof_98);
   }
  else
   {
   }


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

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


	initval(ncyc_nc,v11);

        initval(ncyc_cc,v2);

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

	rgpulse(pw, t1, 50.0e-6, 0.0); /* x,-x */
	txphase(zero);


	delay(lambda);

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

	delay(lambda);

	simpulse(pw, pwC, one, t5, 0.0, 0.0); /* x, -x */
	decphase(zero);

	zgradpulse(gzlvl5,gt5);
	delay(lambda - gt5);

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

	zgradpulse(gzlvl5,gt5);
        delay(lambda - gt5 - 2*POWER_DELAY);



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

decpower(CCdpwr); decphase(zero);
decprgon(CCdseq,1.0/CCdmf,CCdres); 
decon();  /* CC decoupling on */


   if (N15refoc[A]=='y')
    {
        if (tau1 > (pwN + 0.64*pw))
        {
        delay(tau1 - pwN - 0.64*pw);
        sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
        delay(tau1 - pwN - 0.64*pw);
        }
        else if (tau1 > 0.64*pw)
        delay(2.0*tau1 - 2.0*0.64*pw);
   }
  else
   {
        if (tau1 > pw)
        {
        delay(tau1 - 0.64*pw);
        rgpulse(2.0*pw, zero, 0.0, 0.0);
        delay(tau1 - 0.64*pw);
        }
        else 
        delay(2.0*tau1);
   }

decoff(); decprgoff();        /* CC decoupling off */
decpower(pwClvl);

} /* END CC H**O DEC */


else
{
     /*****************     CONSTANT TIME EVOLUTION      *****************/
      if (CT[A]=='y') {
     /***************/

    delay(CTdelay/2.0 - tau1);

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

    {delay(CTdelay/2.0 - pwZa);
           sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);}

    delay(tau1);

     /***************/
                      }


 else  if (N15refoc[A]=='y')
   {

        if (tau1 > (2.0*GRADIENT_DELAY + pwN + 0.64*pw + 5.0*SAPS_DELAY))
        {
        zgradpulse(gzlvlr, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw) - SAPS_DELAY);
        sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
        zgradpulse(-1.0*gzlvlr, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        }
        else if (tau1 > (0.64*pw + 0.5*SAPS_DELAY))
        delay(2.0*tau1 - 2.0*0.64*pw - SAPS_DELAY );
   }
  else
   {
        if (tau1 > (2.0*GRADIENT_DELAY + pw + 5.0*SAPS_DELAY))
        {
        zgradpulse(gzlvlr, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw) - SAPS_DELAY);
        rgpulse(2.0*pw, zero, 0.0, 0.0);
        zgradpulse(-1.0*gzlvlr, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
        }
        else if (tau1 > (pw + 0.5*SAPS_DELAY))
        delay(2.0*tau1 - 2.0*pw - SAPS_DELAY );
   }
} /* End No CC homodec */

        decrgpulse(pwC,one,0.0,0.0);  /* flip transferred 13C-magnetization to x */

        decoffset(dof_135);	/* frequency for the NC-tocsy */

        decrgpulse(pwC,three,0.0,0.0);  /* flip transferred 13C-magnetization to x */
        decphase(zero);
        decpwrf(rfdC3);

        starthardloop(v2);
    decrgpulse(6.4*p_d2,zero,0.0,0.0);
    decrgpulse(8.2*p_d2,two,0.0,0.0);
    decrgpulse(5.8*p_d2,zero,0.0,0.0);
    decrgpulse(5.7*p_d2,two,0.0,0.0);
    decrgpulse(0.6*p_d2,zero,0.0,0.0);
    decrgpulse(4.9*p_d2,two,0.0,0.0);
    decrgpulse(7.5*p_d2,zero,0.0,0.0);
    decrgpulse(5.3*p_d2,two,0.0,0.0);
    decrgpulse(7.4*p_d2,zero,0.0,0.0);

    decrgpulse(6.4*p_d2,two,0.0,0.0);
    decrgpulse(8.2*p_d2,zero,0.0,0.0);
    decrgpulse(5.8*p_d2,two,0.0,0.0);
    decrgpulse(5.7*p_d2,zero,0.0,0.0);
    decrgpulse(0.6*p_d2,two,0.0,0.0);
    decrgpulse(4.9*p_d2,zero,0.0,0.0);
    decrgpulse(7.5*p_d2,two,0.0,0.0);
    decrgpulse(5.3*p_d2,zero,0.0,0.0);
    decrgpulse(7.4*p_d2,two,0.0,0.0);

    decrgpulse(6.4*p_d2,two,0.0,0.0);
    decrgpulse(8.2*p_d2,zero,0.0,0.0);
    decrgpulse(5.8*p_d2,two,0.0,0.0);
    decrgpulse(5.7*p_d2,zero,0.0,0.0);
    decrgpulse(0.6*p_d2,two,0.0,0.0);
    decrgpulse(4.9*p_d2,zero,0.0,0.0);
    decrgpulse(7.5*p_d2,two,0.0,0.0);
    decrgpulse(5.3*p_d2,zero,0.0,0.0);
    decrgpulse(7.4*p_d2,two,0.0,0.0);

    decrgpulse(6.4*p_d2,zero,0.0,0.0);
    decrgpulse(8.2*p_d2,two,0.0,0.0);
    decrgpulse(5.8*p_d2,zero,0.0,0.0);
    decrgpulse(5.7*p_d2,two,0.0,0.0);
    decrgpulse(0.6*p_d2,zero,0.0,0.0);
    decrgpulse(4.9*p_d2,two,0.0,0.0);
    decrgpulse(7.5*p_d2,zero,0.0,0.0);
    decrgpulse(5.3*p_d2,two,0.0,0.0);
    decrgpulse(7.4*p_d2,zero,0.0,0.0);
        endhardloop();


        decphase(one);

        decpwrf(rfC);

        decrgpulse(pwC,three,0.0,0.0);  /* flip transferred 13C-magnetization to x */

	decoffset(dof_175);

        decrgpulse(pwC,one,0.0,0.0);  /* flip transferred 13C-magnetization to x */

        decpwrf(rfdC);          /* Set fine power for carbon */
        dec2pwrf(rfdN);         /* Set fine power for nitrogen */

	dec2phase(zero);
        decphase(zero);

	starthardloop(v11);
    sim3pulse(0.0,6.4*p_d,6.4*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,8.2*p_d,8.2*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,5.8*p_d,5.8*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,5.7*p_d,5.7*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,0.6*p_d,0.6*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,4.9*p_d,4.9*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,7.5*p_d,7.5*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,5.3*p_d,5.3*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,7.4*p_d,7.4*p_d,zero,zero,zero,0.0,0.0);

    sim3pulse(0.0,6.4*p_d,6.4*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,8.2*p_d,8.2*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,5.8*p_d,5.8*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,5.7*p_d,5.7*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,0.6*p_d,0.6*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,4.9*p_d,4.9*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,7.5*p_d,7.5*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,5.3*p_d,5.3*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,7.4*p_d,7.4*p_d,two,two,two,0.0,0.0);

    sim3pulse(0.0,6.4*p_d,6.4*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,8.2*p_d,8.2*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,5.8*p_d,5.8*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,5.7*p_d,5.7*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,0.6*p_d,0.6*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,4.9*p_d,4.9*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,7.5*p_d,7.5*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,5.3*p_d,5.3*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,7.4*p_d,7.4*p_d,two,two,two,0.0,0.0);

    sim3pulse(0.0,6.4*p_d,6.4*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,8.2*p_d,8.2*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,5.8*p_d,5.8*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,5.7*p_d,5.7*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,0.6*p_d,0.6*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,4.9*p_d,4.9*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,7.5*p_d,7.5*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(0.0,5.3*p_d,5.3*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.0,7.4*p_d,7.4*p_d,zero,zero,zero,0.0,0.0);
	endhardloop();

	obspwrf(rfH);
	decpwrf(rfC);
	dec2pwrf(rfN);

	obsoffset(tof);

	txphase(zero);
	decphase(one);


if (tau2 > 0.0)
   {

        if (tau2 > (2.0*GRADIENT_DELAY + pwC + 0.64*pw + 5.0*SAPS_DELAY))
        {
        zgradpulse(gzlvlr, 0.8*(tau2 - 2.0*GRADIENT_DELAY - pwC - 0.64*pw));
        delay(0.2*(tau2 - 2.0*GRADIENT_DELAY - pwC - 0.64*pw) - SAPS_DELAY);
        simpulse(2.0*pw, 2.0*pwC, zero, zero,  0.0, 0.0);
        zgradpulse(-1.0*gzlvlr, 0.8*(tau2 - 2.0*GRADIENT_DELAY - pwC - 0.64*pw));
        delay(0.2*(tau2 - 2.0*GRADIENT_DELAY - pwC - 0.64*pw));
        }
        else if (tau2 > (0.64*pw + 0.5*SAPS_DELAY))
        delay(2.0*tau2 - 2.0*0.64*pw - SAPS_DELAY );
   }


else
{;}

    if( CYT[A] == 'y' )
        {
        zgradpulse(gzlvl5,gt5);
        delay(lambdaN/2.0 - gt5);
        sim3pulse(2*pw, 0.0, 2*pwN,zero, zero,zero,0.0,0.0);
        zgradpulse(gzlvl5,gt5);
        delay(lambdaN/2.0 - gt5);

        }
    else if( URA[A] == 'y' )
        {
        zgradpulse(gzlvl5,gt5);
        delay(lambdaN - gt5);
        sim3pulse(2*pw, 0.0, 2*pwN,zero, zero,zero,0.0,0.0);
        zgradpulse(gzlvl5,gt5);
        delay(lambdaN - gt5);
        }

	dec2rgpulse(pwN,t3,0.0,0.0);

if (flipback[A]=='y')
{
	zgradpulse(gzlvl3,gt3);
	delay(gstab);

        txphase(zero);
        obspower(tpwrs);
        shaped_pulse("rna_H2Osinc", pwHs, zero, 5.0e-4, 0.0);
        obspower(tpwr);
}
	rgpulse(pw, zero, 2*rof1, 0.0);
	txphase(two);
	obspower(tpwrs2);
        obspwrf(finepwrf);
	
        zgradpulse(gzlvl4,gt4);
        delay(lambdaN - 2.0*POWER_DELAY - gt4 -rof1 -2.0*GRADIENT_DELAY - pwHs2);

        rgpulse(pwHs2, two, rof1, rof1);
        obspower(tpwr);
        obspwrf(4095.0);
        sim3pulse(2*pw, 0.0, 2*pwN, zero, zero, zero, rof1, rof1);
        obspwrf(finepwrf);
        obspower(tpwrs2);
        rgpulse(pwHs2, two, rof1, rof1);

        zgradpulse(gzlvl4,gt4);
        delay(lambdaN - 3*POWER_DELAY - gt4 - 2.0*GRADIENT_DELAY - pwHs2);


        dec2rgpulse(pwN,t4,0.0,0.0);
        dec2rgpulse(pwN,zero,0.0,0.0);
        dec2power(dpwr2);               /* 2*POWER_DELAY */
        decpower(dpwr);

status(C);
	rcvron();

 setreceiver(t10);
}
Ejemplo n.º 14
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          CT_flg[MAXSTR],
          n15_flg[MAXSTR];

   int    icosel,
          t1_counter,
          t2_counter,
          ni2 = getval("ni2"),
          phase;


   double d2_init=0.0,
          d3_init=0.0,
          pwS1,pwS2,pwS3,pwS4,pwS5,pwS6,pwS7,max,
          kappa,
          lambda = getval("lambda"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gzlvl4 = getval("gzlvl4"), 
          gzlvl5 = getval("gzlvl5"), 
          gzlvl6 = getval("gzlvl6"), 
          gt1 = getval("gt1"),
          gt3 = getval("gt3"),
          gt4 = getval("gt4"),
          gt5 = getval("gt5"),
          gt6 = getval("gt6"),
          gstab = getval("gstab"),
          tpwrsf = getval("tpwrsf"),
          shlvl1,
          shpw1 = getval("shpw1"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          dpwr2 = getval("dpwr2"),
          d2 = getval("d2"),
          shbw = getval("shbw"),
          shofs = getval("shofs")-4.77,
          scale = getval("scale"),
          sw1 = getval("sw1"),
          timeTN = getval("timeTN"),
          timeTN1,
          Delta,
          t2a,t2b,halfT2,ctdelay,
          tauNCO = getval("tauNCO"),
          CTdelay = getval("CTdelay"),
          tauC = getval("tauC"),
          tau1, tau2,
          taunh = getval("taunh");



   getstr("shname1", shname1);
   getstr("CT_flg",CT_flg);
   getstr("n15_flg",n15_flg);
   getstr("f1180",f1180);
   getstr("f2180",f2180);



  phase = (int) (getval("phase") + 0.5);
   
   settable(t1,2,phi1);
   settable(t3,1,phi3);
   settable(t4,4,phi4);
   settable(t5,1,phi5);
   settable(t14,4,phi14);
   settable(t24,4,phi24);


/*   INITIALIZE VARIABLES   */

  timeTN1= timeTN-tauC;
  Delta = timeTN-tauC-tauNCO;

  //shpw1 = pw*8.0;
  shlvl1=tpwr;

   pwS1 = c13pulsepw("ca", "co", "square", 90.0);
   pwS2 = c13pulsepw("ca", "co", "square", 180.0);
   pwS3 = c13pulsepw("co", "ca", "sinc", 180.0);
   pwS7 = c13pulsepw("co", "ca", "sinc", 90.0);
   pwS4 = h_shapedpw("eburp2",shbw,shofs,zero, 0.0, 0.0);  
   pwS6 = h_shapedpw("reburp",shbw,shofs,zero, 0.0, 0.0);
   pwS5 = h_shapedpw("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);



if (CT_flg[0] == 'y')
{
   if ( ni*1/(sw1)/2.0 > (CTdelay*0.5-gt3-1.0e-4))
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((CTdelay*0.5-gt3-1.0e-4)*2.0*sw1)));    psg_abort(1);}
}

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

if   ( phase2 == 2 )
        {
        tsadd ( t3,2,4  );
        tsadd ( t5,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; }

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

   if( ix == 1) d2_init = d2;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2)
        { tsadd(t1,2,4); tsadd(t14,2,4); tsadd(t24,2,4); }
   
  if( ix == 1) d3_init = d3;
   t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 );
   if(t2_counter % 2)
        { tsadd(t4,2,4); tsadd(t14,2,4); tsadd(t24,2,4);  }
   
/************************************************************/
/* Set up CONSTANT/SEMI-CONSTANT time evolution in N15 */
/************************************************************/

   ctdelay = timeTN1-gt1-1.0e-4;
   // ctdelay = timeTN1-gt1-1.0e-4-2.0*GRADIENT_DELAY-4*POWER_DELAY-4*PWRF_DELAY-(4/PI)*pwN;
   if (ni2 > 1)
   {
   halfT2 = 0.5*(ni2-1)/sw2;
   t2b = (double) t2_counter*((halfT2 - ctdelay)/((double)(ni2-1)));
   if( ix==1 && halfT2 - timeTN > 0 ) printf("SCT mode on, max ni2=%g\n",timeTN*sw2*2+1);
    if(t2b < 0.0) t2b = 0.0;
   
    t2a = ctdelay - tau2*0.5 + t2b;
    if(t2a < 0.2e-6)  t2a = 0.0;
    }
    else
    {
    t2b = 0.0;
    t2a = ctdelay - tau2*0.5;
    }
/************************************************************/

   status(A);
      rcvroff();  

   decpower(pwClvl);
   decoffset(dof);
   dec2power(pwNlvl);
   dec2offset(dof2);
   obspwrf(tpwrsf);
   decpwrf(4095.0);
   obsoffset(tof);
   set_c13offset("co");


      dec2rgpulse(pwN*2.0,zero,0.0,0.0);
     zgradpulse(gzlvl4, gt4);
       delay(1.0e-4);

       delay(d1-gt4);
lk_hold();

        h_shapedpulse("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);  

	delay(lambda-pwS5*0.5-pwS6*0.4); 

   	h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, one, zero, zero, 0.0, 0.0);

	delay(lambda-pwS5*0.5-pwS6*0.4);

     if(n15_flg[0]=='y') h_shapedpulse("pc9f_",shbw,shofs,three, 0.0, 0.0);
     else h_shapedpulse("pc9f_",shbw,shofs,one, 0.0, 0.0);

           zgradpulse(gzlvl4, gt4*4.0);
           delay(1.0e-4);

   obspower(shlvl1);
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx   N-> CA transfer           xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/
      dec2rgpulse(pwN,zero,0.0,0.0);

           delay(timeTN1);

      sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);

           delay(Delta);
	c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      
           delay(timeTN1-Delta-pwS3+pwN*4.0/3.0);

	c13pulse("co", "ca", "sinc", 90.0, zero, 0.0, 0.0);      
           delay(tauC);
        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
        sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
           delay(tauC);
        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
	c13pulse("co", "ca", "sinc", 90.0, one, 0.0, 0.0);      
        

     dec2rgpulse(pwN,one,0.0,0.0);				     
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx       13CA EVOLUTION        xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/
        set_c13offset("ca");

        c13pulse("ca", "co", "square", 90.0, t1, 2.0e-6, 0.0);
   if(CT_flg[0]=='y')
   {
        delay(tau1*0.5);
         sim3_c13pulse(shname1, "co", "ca", "sinc", "", shpw1, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
        zgradpulse(gzlvl3, gt3);
        delay(1.0e-4);
        delay(CTdelay*0.5-gt3-1.0e-4);
        c13pulse("cab", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
        delay(CTdelay*0.5-gt3-1.0e-4-tau1*0.5);
         sim3_c13pulse(shname1, "co", "ca", "sinc", "", shpw1, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
        zgradpulse(gzlvl3, gt3);
        delay(1.0e-4);
   }
   else
   {
        delay(tau1*0.5);
        sim3_c13pulse(shname1, "co", "ca", "sinc", "", shpw1, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
        zgradpulse(gzlvl3, gt3);
        delay(1.0e-4);
        delay(tau1*0.5);

        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
        sim3_c13pulse(shname1, "co", "ca", "sinc", "", shpw1, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
        zgradpulse(gzlvl3, gt3);
        delay(1.0e-4);
   }
        c13pulse("ca", "co", "square", 90.0, zero, 0.0, 0.0);

        set_c13offset("co");

/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx   N-> CA back transfer     xxxxxxxxxxxxxxx    */
/**************************************************************************/
   obspower(shlvl1);

     dec2rgpulse(pwN,t4,0.0,0.0);

	c13pulse("co", "ca", "sinc", 90.0, one, 0.0, 0.0);      
        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
           delay(tauC);
        sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
           delay(tauC);
	c13pulse("co", "ca", "sinc", 90.0, zero, 0.0, 0.0);      

 	 // delay(timeTN1-Delta+tau2*0.5-pwS2-pwS3);
 	 delay(timeTN1-Delta+tau2*0.5-pwS2-pwS3-2.0*GRADIENT_DELAY+4*POWER_DELAY+4*PWRF_DELAY);
	c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      
           delay(Delta);
	c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);      
           delay (t2b);
        dec2rgpulse (2.0*pwN, zero, 0.0, 0.0);
       zgradpulse(gzlvl1, gt1);
           delay(1.0e-4);
           delay (t2a);

/**************************************************************************/
/**  gradient-selected TROSY sequence                             *********/
/**************************************************************************/
        delay(gt1/10.0+1.0e-4);
        h_shapedpulse("eburp2_",shbw,shofs,t3, 2.0e-6, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.5-pwS4*scale- gt5);

        h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.5-pwS4*scale- gt5);

        h_shapedpulse("eburp2",shbw,shofs,zero, 0.0, 0.0);
        delay(gt1/10.0+1.0e-4);

        dec2rgpulse(pwN,one,0.0,0.0);

        zgradpulse(gzlvl6, gt6);

        txphase(zero);
        delay(lambda-pwS6*0.5-gt6);

        h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);
        zgradpulse(gzlvl6, gt6);

        delay(lambda-pwS6*0.5-gt6);

        dec2rgpulse(pwN,t5,0.0,0.0);
/**************************************************************************/

        zgradpulse(-icosel*gzlvl2, gt1/10.0);

	dec2power(dpwr2);
lk_sample();
 if (n15_flg[0] =='y')
{
   setreceiver(t14);
}
else
{
   setreceiver(t24);
}
      rcvron();  
statusdelay(C,1.0e-4 );

}		 
Ejemplo n.º 15
0
void pulsesequence()
{

/* DECLARE AND LOAD VARIABLES; parameters used in the last half of the */
/* sequence are declared and initialized as 0.0 in bionmr.h, and       */
/* reinitialized below  */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
 	    TROSY[MAXSTR];			    /* do TROSY on N15 and H1 */
 
int         t1_counter,  		        /* used for states tppi in t1 */
            t2_counter,  	 	        /* used for states tppi in t2 */
	    ni = getval("ni"),
	    ni2 = getval("ni2");

double      d2_init=0.0,  		        /* used for states tppi in t1 */
	    d3_init=0.0,  	 	        /* used for states tppi in t2 */
	    tau1,         				         /*  t1 delay */
         BPdpwrspinlock,        /*  user-defined upper limit for spinlock(Hz) */
         BPpwrlimits,           /*  =0 for no limit, =1 for limit             */
	    t1a,		       /* time increments for first dimension */
	    t1b,
	    t1c,
	    tauCH = getval("tauCH"), 		         /* 1/4J delay for CH */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    epsilon = 1.05e-3,				      /* other delays */
	    zeta = 3.0e-3,
	    eta = 4.6e-3,
	    theta = 14.0e-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 */
 
   widthHd,

   pwS1,					/* length of square 90 on Cab */
   pwS2,					/* length of square 180 on Ca */
   phi7cal = getval("phi7cal"),  /* phase in degrees of the last C13 90 pulse */
   spinlock = getval("spinlock"), 	/* DIPSI-3 spinlock field */
   ncyc = getval("ncyc"), 	/* no. of cycles of DIPSI-3 decoupling on Cab */

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

	sw1 = getval("sw1"),
	sw2 = getval("sw2"),
        waltzB1 = getval("waltzB1"),
	gt0 = getval("gt0"),				   /* other gradients */
	gt3 = getval("gt3"),
	gt4 = getval("gt4"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4");

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

    widthHd=2.069*(waltzB1/sfrq);  /* produces same field as std. sequence */

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

  P_getreal(GLOBAL,"BPpwrlimits",&BPpwrlimits,1);
  P_getreal(GLOBAL,"BPdpwrspinlock",&BPdpwrspinlock,1);
  if (BPpwrlimits > 0.5)
  {
   if (spinlock > BPdpwrspinlock)
    {
     printf("spinlock too large, reset to user-defined limit (BPdpwrspinlock)");
     psg_abort(1);
    }
  }
 	kappa = 5.4e-3;
	lambda = 2.4e-3;

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

    /* get calculated pulse lengths of shaped C13 pulses */
	pwS1 = c13pulsepw("cab", "co", "square", 90.0); 
	pwS2 = c13pulsepw("ca", "co", "square", 180.0); 
	

/* CHECK VALIDITY OF PARAMETER RANGES */

    if ( gt4 > epsilon - 0.6*pwC)
       { printf(" gt4 is too big. Make gt4 equal to %f or less.\n", 
  	 (epsilon - 0.6*pwC)); 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 > 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;    
	 }



/*  C13 TIME INCREMENTATION and set up f1180  */

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



/*   BEGIN PULSE SEQUENCE   */

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

	rcvroff();
        set_c13offset("cab");
	obsoffset(tof);
	obspower(tpwr);
 	obspwrf(4095.0);
	decpower(pwClvl);
	decpwrf(4095.0);
 	dec2power(pwNlvl);
	txphase(three);
	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, three, 0.0, 0.0);                  /* 1H pulse excitation */
                                             			/* point a */
        txphase(zero);
        decphase(zero);
	zgradpulse(gzlvl0, gt0); 			/* 2.0*GRADIENT_DELAY */
	delay(5.0e-5);
	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);
	delay(epsilon - gt4 - 0.6*pwC);

							  /* WFG2_START_DELAY */
	sim_c13pulse("", "cab", "co", "square", 2.0*pw, 180.0,
						zero, zero, 2.0e-6, 2.0e-6);
	delay(WFG2_START_DELAY);
	zgradpulse(gzlvl4, gt4);
	delay(epsilon - gt4);
                     						/* point d */	
	decrgpulse(0.5e-3, zero, 0.0, 0.0);
	c13decouple("cab", "DIPSI3", 2.0*spinlock/dfrq, ncyc);	    /* PRG_STOP_DELAY */
				              			/* point e */	
	h1decon("DIPSI2", widthHd, 0.0);/*POWER_DELAY+PWRF_DELAY+PRG_START_DELAY */

	decphase(t5);
	delay(zeta - PRG_STOP_DELAY - PRG_START_DELAY - POWER_DELAY -
 						PWRF_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);

	decphase(zero);
	delay(zeta - 0.5*10.933*pwC - 0.6*pwS1 - WFG_START_DELAY - 2.0e-6);

				        		  /* WFG_START_DELAY  */
	c13pulse("cab", "co", "square", 90.0, zero, 2.0e-6, 0.0);  /* point f */
	decphase(t5);
        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           gzlvl0=getval("gzlvl0");
           gzlvl3=getval("gzlvl3");
           gzlvl4=getval("gzlvl4");
           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);
	c13pulse("co", "ca", "sinc", 90.0, t5, 2.0e-6, 0.0);
	     							/* point g */ 

 	decphase(zero);
	delay(eta - 2.0*POWER_DELAY - 2.0*PWRF_DELAY);

					        /* 2*POWER_DELAY+2*PWRF_DELAY */
	c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);     /* pwS2 */

		
	dec2phase(zero);
	delay(theta - eta - pwS2 - WFG3_START_DELAY);

							  /* WFG3_START_DELAY */
	sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
					     zero, zero, zero, 2.0e-6, 2.0e-6);

	initval(phi7cal, v7);
	decstepsize(1.0);
	dcplrphase(v7);					        /* SAPS_DELAY */
	dec2phase(t8);
	delay(theta - SAPS_DELAY);
                              					/* point h */

	nh_evol_se_train("co", "ca"); /* common part of sequence in bionmr.h  */
        if (dm3[B]=='y') lk_sample();

}		 
Ejemplo n.º 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 */
                BPdpwrspinlock,        /*  user-defined upper limit for spinlock(Hz) */
                BPpwrlimits,           /*  =0 for no limit, =1 for limit             */
                t1b,
                t1c,
                tauCH = getval("tauCH"), 		         /* 1/4J delay for CH */
                timeTN = getval("timeTN"),     /* constant time for 15N evolution */
                epsilon = 1.05e-3,				      /* other delays */
                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 */

                /* p_d is used to calculate the selective decoupling on the Cab region        */
                p_d,                  	       /* 50 degree pulse for DIPSI-3 at rfd  */
                rfd,                               /* fine power for DIPSI-3 spinlock */
                spinlock = getval("spinlock"),              /* DIPSI-3 filed strength */
                ncyc = getval("ncyc"), 			  /* no. of cycles of DIPSI-3 */


                /* 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,	  	                                    /* rf for DIPSI-2 */
                DIPSI2time,     	        /* total length of DIPSI-2 decoupling */
                waltzB1 = getval("waltzB1"), /*Dipsi-2 decoupling field strength (Hz) */
                ncyc_dec,

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

    P_getreal(GLOBAL,"BPpwrlimits",&BPpwrlimits,1);
    P_getreal(GLOBAL,"BPdpwrspinlock",&BPdpwrspinlock,1);
    if (BPpwrlimits > 0.5)
    {
        if (spinlock > BPdpwrspinlock)
        {
            spinlock = BPdpwrspinlock;
            printf("spinlock too large, reset to user-defined limit (BPdpwrspinlock)");
            psg_abort(1);
        }
    }
    if( dpwrf < 4095 )
    {   printf("reset dpwrf=4095 and recalibrate C13 90 degree pulse");
        psg_abort(1);
    }

    if( pwC > 24.0*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*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/(pwH*2590*4.0);
    ncyc_dec = (int) (ncyc_dec + 0.5);

    pwH = (DIPSI2time*90.0)/(ncyc_dec*2590*4.0); /* fine correction of pwH based of ncyc_dec */
    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);
    }



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



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



    /*  C13 TIME INCREMENTATION and set up f1180  */

    /*  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 epsilon */
    epsilon = epsilon -pwC7 -WFG_START_DELAY -gt4 -2.0*GRADIENT_DELAY -5.0e-5;

    if ((ni-1)/(2.0*sw1) > 2.0*epsilon)
    {
        if (tau1 > 2.0*epsilon) sheila = epsilon;
        else if (tau1 > 0) sheila = 1.0/(1.0/tau1+1.0/epsilon-1.0/(2.0*epsilon));
        else          sheila = 0.0;
    }
    else
    {
        if (tau1 > 0) sheila = 1.0/(1.0/tau1 + 1.0/epsilon - 2.0*sw1/((double)(ni-1)));
        else          sheila = 0.0;
    }
    t1a = tau1;
    t1b = tau1 - sheila;
    t1c = epsilon - 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);
    }



    /*   BEGIN PULSE SEQUENCE   */

    status(A);
    if (dm3[B]=='y') lk_sample();
    delay(d1);

    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();    /*freezes z0 correction, stops lock pulsing*/
        lk_sampling_off();
    }
    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 X 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, one, 0.0, 0.0);                    /* 1H pulse excitation */
    /* point a */
    txphase(zero);
    decphase(zero);
    zgradpulse(gzlvl0, gt0);
    delay(tauCH - gt0);

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

    decphase(t3);
    zgradpulse(gzlvl0, gt0);
    delay(tauCH - gt0);
    /* point b */
    rgpulse(pw, zero, 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 c */

    decphase(zero);
    decpwrf(rf7);
    delay(t1a);

    decshaped_pulse("offC7", pwC7, zero, 0.0, 0.0);

    decpwrf(rf2);
    zgradpulse(gzlvl4, gt4);		        /* 2.0*GRADIENT_DELAY */
    delay(5.0e-5);
    delay(epsilon - 2.0*pw);

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

    delay(t1b);

    decrgpulse(pwC2, zero, 0.0, 0.0);

    zgradpulse(gzlvl4, gt4);		        /* 2.0*GRADIENT_DELAY */
    delay(5.0e-5);
    decpwrf(rf7);
    delay(t1c);

    decshaped_pulse("offC7", pwC7, zero, 0.0, 0.0);

    decpwrf(rfd);                                        	/* point d */
    decrgpulse(1.0e-3, zero, 2.0e-6, 0.0);
    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();	                			/* point e */
    obspwrf(tpwr1);
    obspower(tpwr-6);
    obsprgon("dipsi2", pwH, 5.0);		          /* PRG_START_DELAY */
    xmtron();

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

    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 h */
    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);
    /* point i */
    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 */
            obspower(tpwr);
            obspwrf(4095.0);	       /* 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 */
            obspower(tpwr);
            obspwrf(4095.0);	       /* 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 */
            obspower(tpwr);
            obspwrf(4095.0);	       /* POWER_DELAY */
            delay(1.0e-4 - 2.0*POWER_DELAY);                    /* WFG_START_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 */
            obspower(tpwr);
            obspwrf(4095.0);	       /* POWER_DELAY */
            delay(1.0e-4 - 2.0*POWER_DELAY);                    /* WFG_START_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 */
            obspower(tpwr);
            obspwrf(4095.0);	       /* POWER_DELAY */
            delay(1.0e-4 - 2.0*POWER_DELAY);                    /* WFG_START_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 */
            obspower(tpwr);
            obspwrf(4095.0);	       /* 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 j */
    /*  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);
}
Ejemplo n.º 17
0
void pulsesequence()
{
/* DECLARE VARIABLES */

char     
  aliph[MAXSTR],	/* aliphatic CHn groups only */
  arom[MAXSTR],		/* aromatic CHn groups only */
  N15refoc[MAXSTR],	/* flag for refocusing 15N during indirect H1 evolution */

  f1180[MAXSTR],	/* Flag to start t1 @ halfdwell */
  mag_flg[MAXSTR],	/* magic angle gradient */
  f2180[MAXSTR],	/* Flag to start t2 @ halfdwell */
  stCshape[MAXSTR],	/* C13 inversion pulse shape name */
  STUD[MAXSTR],		/* Flag to select adiabatic decoupling */
  stCdec[MAXSTR],	/* contains name of adiabatic decoupling shape */
  auto_dof[MAXSTR];	/* automatically adjust dof for aromatic, aliphatic, all carbon */

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

double    

  JCH1 = getval("JCH1"),	/* smallest coupling that you wish to purge */
  JCH2 = getval("JCH2"),	/* largest coupling that you wish to purge */
  taud,				/* 1/(2JCH1)   */
  taue,				/* 1/(2JCH2)   */

/* N15 purging */
  tauNH  = 1/(4.0*getval("JNH")),		/* HN coupling constant */

  gt4 = getval("gt4"),
  gt14 = getval("gt14"),
  gt7 = getval("gt7"),
  gt17 = getval("gt17"),
  gt8 = getval("gt8"),
  gt9 = getval("gt9"),

  gzlvl4 = getval("gzlvl4"),
  gzlvl14 = getval("gzlvl14"),
  gzlvl7 = getval("gzlvl7"),
  gzlvl17 = getval("gzlvl17"),
  gzlvl8 = getval("gzlvl8"),
  gzlvl9 = getval("gzlvl9"),

  bw, pws, ofs, ppm, nst,  /* bandwidth, pulsewidth, offset, ppm, # steps */

  ni2 = getval("ni2"),
  dofa = 0.0,			/* actual 13C offset (depends on aliph and arom)*/
  rf200 = getval("rf200"), 	/* rf in Hz for 200ppm STUD+ */
  dmf200 = getval("dmf200"),     /* dmf for 200ppm STUD+ */
  rf30 = getval("rf30"),	/* rf in Hz for 30ppm STUD+ */
  dmf30 = getval("dmf30"),	/* dmf for 30ppm STUD+ */

  stdmf = 1.0,			/* dmf for STUD decoupling initialized */ 
  studlvl = 0.0,		/* coarse power for STUD+ decoupling initialized */

  rffil = 0.0,			/* fine power level for 200ppm adiabatic pulse */

  rfst = 0.0,			/* fine power level for adiabatic pulse initialized */
  rf0,				/* full fine power */

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

  tau1,				/*  t1 delay */
  tau2,				/*  t2 delay */

  JCH = getval("JCH"),		/*  CH coupling constant */
  Cfil = getval("Cfil"),		/*  CH coupling constant */

  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"),		/* noesy 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"),
  gt5 = getval("gt5"),
  gt6 = getval("gt6"),
  gzlvl0 = getval("gzlvl0"),
  gzlvl1 = getval("gzlvl1"),
  gzlvl2 = getval("gzlvl2"),
  gzlvl3 = getval("gzlvl3"),
  gzlvl5 = getval("gzlvl5"),
  gzlvl6 = getval("gzlvl6");


/* LOAD VARIABLES */

  getstr("aliph",aliph);
  getstr("arom",arom);
  getstr("N15refoc",N15refoc);

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

  getstr("auto_dof",auto_dof);

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

  settable(t6,16,phi6);
  settable(t7,32,phi7);

  if (Cfil == 1) settable(t4,8,rec1);
    else settable(t4,32,rec2);

/* CHECK VALIDITY OF PARAMETER RANGES */

    if ( (arom[A]=='n' && aliph[A]=='n') || (arom[A]=='y' && aliph[A]=='y') )
      { 
	printf("You need to select one and only one of arom or aliph options  ");
	psg_abort(1); 
      }

    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( 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(t3,1,4);

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

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

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if((f2180[A] == 'y') && (ni2 > 1.0)) tau2 += ( 1.0 / (2.0*sw2) ); 
    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(t4,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(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 (N15refoc[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;
/* Uncomment to check pwClw and pwNlw
     if (d2==0.0 && d3==0.0) printf(" pwClw = %.2f ; pwNlw = %.2f\n", pwClw*1e6,pwNlw*1e6);
*/
    }


/* make sure that gt3 and gt1 are of opposite sign to help dephasing H2O */
   if (gzlvl3*icosel*gzlvl1 > 0.0) gsign=-1.0;
     else gsign=1.0; 


/* if coupling constants are input by user use them to calculate delays */
   if (Cfil == 1)
     {
      taud = 1.0/(2.0*JCH1);
      taue = 1.0/(2.0*JCH2);
     }
    else
     {
       taud = 1.0/(4.0*JCH1);
       taue = 1.0/(4.0*JCH2);
     }


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

   setautocal();                        /* activate auto-calibration flags */ 
        
   if (autocal[0] == 'n') 
   {
     if (arom[A]=='y')  /* AROMATIC spectrum */
     {
       /* 30ppm sech/tanh inversion */
       rfst = (compC*4095.0*pwC*4000.0*sqrt((4.5*sfrq/600.0+3.85)/0.41));   
       rfst = (int) (rfst + 0.5);
     }
  
     if (aliph[A]=='y')  /* ALIPHATIC spectrum */
     {
       /* 200ppm sech/tanh inversion pulse */
       if (pwC180>3.0*pwC) 
	 {
	   rfst = (compC*4095.0*pwC*4000.0*sqrt((12.07*sfrq/600+3.85)/0.35));
	   rfst = (int) (rfst + 0.5);
       }
       else rfst=4095.0;

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

     if (Cfil > 1)  /* 200ppm pulse for C13 filtering */
     {
       /* 200ppm sech/tanh inversion pulse */
       if (pwC180>3.0*pwC) 
	 {
	   rffil = (compC*4095.0*pwC*4000.0*sqrt((12.07*sfrq/600+3.85)/0.35));
	   rffil = (int) (rffil + 0.5);
       }
       else rfst=4095.0;

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

   }
   else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
   {
     if(FIRST_FID)                                            /* call Pbox */
     {
       ppm = getval("dfrq"); 
       bw = 118.0*ppm; ofs = 139.0*ppm;
       if (arom[A]=='y')  /* AROMATIC spectrum */
       {
         bw = 30.0*ppm; pws = 0.001; ofs = 0.0; nst = 500.0;    
         stC30 = pbox_makeA("stC30", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
       }
       if ((aliph[A]=='y') || (Cfil > 1))
       {
         bw = 200.0*ppm; pws = 0.001; ofs = 0.0; nst = 1000.0;    
         stC200 = pbox_makeA("stC200", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
       }
       ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
     }
     if (arom[A]=='y')  rfst = stC30.pwrf;
     if (aliph[A]=='y') 
     {
      if (pwC180>3.0*pwC) rfst = stC200.pwrf;
      else rfst = 4095.0;
     }
     if (Cfil > 1)
     {
      if (pwC180>3.0*pwC) rffil = stC200.pwrf;
      else rffil = 4095.0;
     }
   }

   if (arom[A]=='y')  
   {
     dofa=dof+(125-43)*dfrq;

     strcpy(stCshape, "stC30");
     /* 30 ppm STUD+ decoupling */
     strcpy(stCdec, "stCdec30");             
     stdmf = dmf30;
     studlvl = pwClvl + 20.0*log10(compC*pwC*4.0*rf30);
     studlvl = (int) (studlvl + 0.5);
   }

   if (aliph[A]=='y')
   {
     dofa=dof;
       
     strcpy(stCshape, "stC200");
     /* 200 ppm STUD+ decoupling */
     strcpy(stCdec, "stCdec200");
     stdmf = dmf200;
     studlvl = pwClvl + 20.0*log10(compC*pwC*4.0*rf200);
     studlvl = (int) (studlvl + 0.5);
   }

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

   if (auto_dof[A]=='y') decoffset(dofa);

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

   initval(135.0,v1);
   obsstepsize(1.0);


   delay(d1);

/* destroy N15 and C13 magnetization */
   if (N15refoc[A] == 'y') dec2rgpulse(pwN, zero, 0.0, 0.0);
   decrgpulse(pwC, zero, 0.0, 0.0);
   zgradpulse(gzlvl0, 0.5e-3);
   delay(gstab);
   if (N15refoc[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);

if (Cfil == 1) 
  {
   xmtrphase(v1);
   rgpulse(pw, t1, rof1 , 0.0);  
   txphase(zero); 
   xmtrphase(zero); 

/* CN FILTER BEGINS */
      zgradpulse(gzlvl8, gt8);
      txphase(zero); xmtrphase(zero);
      delay(taud -gt8 -2.0*GRADIENT_DELAY -2.0*SAPS_DELAY);

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

      zgradpulse(gzlvl8, gt8);
      delay(taue -gt8 -2.0*GRADIENT_DELAY);

      decrgpulse(pwC, zero, 0.0, 0.0);

      delay(taud -taue -pwC);

/* CN FILTER ENDS */

   }
else if (Cfil == 2)
   {
      txphase(t6);
      rgpulse(pw, t6, rof1, 0.0);                  /* 90 deg 1H pulse */
/* BEGIN 1st FILTER */
      txphase(zero);

      zgradpulse(gzlvl8,gt8);
      decpwrf(rffil);
      delay(taud -gt8 -2.0*GRADIENT_DELAY -WFG2_START_DELAY -0.5e-3 +70.0e-6);

      simshaped_pulse("", "stC200", 2.0*pw, pwC180, zero, zero, 0.0, 0.0);

      zgradpulse(gzlvl8,gt8);
      decpwrf(rf0);
      delay(taud -gt8 -2.0*GRADIENT_DELAY -0.5e-3 +70.0e-6);

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

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

      rgpulse(pw, t7, 0.0, 0.0);
/* BEGIN 2nd FILTER */

      zgradpulse(gzlvl9,gt9);
      decpwrf(rffil);
      delay(taue -gt9 -2.0*GRADIENT_DELAY -WFG2_START_DELAY -0.5e-3 +70.0e-6);

      simshaped_pulse("", "stC200", 2.0*pw, pwC180, zero, zero, 0.0, 0.0);

      zgradpulse(gzlvl9,gt9);
      decpwrf(rf0);
      delay(taue -gt9 -2.0*GRADIENT_DELAY -0.5e-3 +70.0e-6);

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

      zgradpulse(gzlvl7,gt7);
      txphase(t1); xmtrphase(v1);
      delay(gstab);

      rgpulse(pw, t1, 0.0, 0.0);
      txphase(zero); xmtrphase(zero);
   }
else if (Cfil == 3)
   {
      txphase(t6);
      rgpulse(pw, t6, rof1, 0.0);                  /* 90 deg 1H pulse */
/* BEGIN 1st FILTER */
      txphase(zero);

      zgradpulse(gzlvl8,gt8);
      delay(tauNH -gt8 -2.0*GRADIENT_DELAY);

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

      decpwrf(rffil);
      delay(tauNH -taud -0.5e-3 -WFG_START_DELAY -PWRF_DELAY);

      decshaped_pulse("stC200", pwC180, zero, 0.0, 0.0);

      zgradpulse(gzlvl8,gt8);
      decpwrf(rf0);
      delay(taud -gt8 -2.0*GRADIENT_DELAY -0.5e-3 -PWRF_DELAY);

      sim3pulse(pw, pwC, pwN, zero, zero, zero, 0.0, 0.0);
      zgradpulse(gzlvl14,gt14);
      txphase(t7);
      delay(gstab);

      rgpulse(pw, t7, 0.0, 0.0);
/* BEGIN 2nd FILTER */

      zgradpulse(gzlvl9,gt9);
      delay(tauNH -gt9 -2.0*GRADIENT_DELAY);

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

      decpwrf(rffil);
      delay(tauNH -taue -0.5e-3 -WFG_START_DELAY -PWRF_DELAY);

      decshaped_pulse("stC200", pwC180, zero, 0.0, 0.0);

      zgradpulse(gzlvl9,gt9);
      decpwrf(rf0);
      delay(taue -gt9 -2.0*GRADIENT_DELAY -0.5e-3 -PWRF_DELAY);

      sim3pulse(pw, pwC, pwN, zero, zero, zero, 0.0, 0.0);
      zgradpulse(gzlvl17,gt17);
      txphase(t1); xmtrphase(v1);
      delay(gstab);

      rgpulse(pw, t1, 0.0, 0.0);
      txphase(zero); xmtrphase(zero);
   }

/* H1 INDIRECT EVOLUTION BEGINS */
   if (ni > 0) 
    txphase(t3);
    {
     if ( (N15refoc[A]=='y') && ((tau1 -pwN -2.0*pw/PI -rof1 -SAPS_DELAY) > 0.0) )
      {
       delay(tau1 -pwN -2.0*pw/PI -SAPS_DELAY);
       dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
       delay(tau1 -pwN -2.0*pw/PI -rof1);
      }     
     else if (tau1 > 2.0*pw/PI +rof1 +SAPS_DELAY)
       delay(2.0*tau1 -4.0*pw/PI -2.0*rof1 -SAPS_DELAY);
    }
/* H1 INDIRECT EVOLUTION ENDS */
   rgpulse(pw, t3, rof1, rof1);             /*  2nd 1H 90 pulse   */

status(C);

   delay(mix -pwC -gt0 -PWRF_DELAY -gstab -2.0*GRADIENT_DELAY); 

   decrgpulse(pwC,zero,0.0,0.0); 
   zgradpulse(gzlvl0, gt0);
   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("",stCshape,2*pw,pwC180,zero,zero,0.0,0.0);

   zgradpulse(gzlvl4, gt4);
   decpwrf(rf0);
   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(icosel*gzcal*gzlvl1, gt1);
     else  zgradpulse(icosel*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("",stCshape,2*pw,pwC180,zero,zero,0.0,0.0);

   zgradpulse(gzlvl6, gt6);
   decpwrf(rf0);
   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);  

   delay(gt2 +gstab +2.0*GRADIENT_DELAY +POWER_DELAY);

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

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

  setreceiver(t4);
   rcvron();
   if ((STUD[A]=='y') && (dm[D] == 'y'))
    {
     decpower(studlvl);
     decprgon(stCdec, 1.0/stdmf, 1.0);
     decon();
    }
   else	
    { 
     decpower(dpwr);
     status(D);
    }
}
Ejemplo n.º 18
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             */
               fc180[MAXSTR],    /* Flag for checking sequence               */
               ddseq[MAXSTR],    /* deuterium decoupling sequence */
               spcosed[MAXSTR],  /* waveform Co seduce 180 */
               spcareb[MAXSTR],  /* waveform Ca reburp 180 */
               spca180[MAXSTR],  /* waveform Ca hard 180   */
               sel_flg[MAXSTR],
               shp_sl[MAXSTR],
               cacb_dec[MAXSTR],
               cacbdecseq[MAXSTR],
               nietl_flg[MAXSTR];

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

    double      tau1,         /*  t1 delay */
                tau2,         /*  t2 delay */
                taua,         /*  ~ 1/4JNH =  2.25 ms */
                taub,         /*  ~ 1/4JNH =  2.25 ms */
                tauc,         /*  ~ 1/4JNCa =  ~13 ms */
                taud,         /*  ~ 1/4JCaC' =  3~4.5 ms ms */
                bigTN,        /* nitrogen T period */
                pwc90,       /* PW90 for ca nucleus @ d_c90         */
                pwca180,      /* PW180 for ca nucleus @ d_c180         */
                pwca180dec,   /* pwca180+pad         */
                pwcareb,      /* pw180 at d_creb  ~ 1.6 ms at 600 MHz */
                pwcosed,      /* PW180 at d_csed  ~ 200us at 600 MHz  */
                tsatpwr,      /* low level 1H trans.power for presat  */
                d_c90,        /* power level for 13C pulses(pwc90=sqrt(15)/4delta
			      delta is the separation between Ca and Co */
                d_c180,	   /* power level for pwca180(sqrt(3)/2delta) */
                d_creb,	   /* power level for pwcareb */
                d_csed,       /* power level for pwcosed */
                sw1,          /* sweep width in f1                    */
                sw2,          /* sweep width in f2                    */
                pw_sl,        /* selective pulse on water      */
                tpwrsl,       /* power for pw_sl               */
                at,
                sphase,	   /* small angle phase shift  */
                sphase1,
                phase_sl,

                d_cacbdec,
                pwcacbdec,
                dres_dec,

                pwD,          /* PW90 for higher power (pwDlvl) deut 90 */
                pwDlvl,       /* high power for deut 90 hard pulse */

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

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

                gstab,

                gt1,
                gt2,
                gt3,
                gt4,
                gt5,
                gt6,
                gt7,
                gt8,
                gt9,
                gt10,

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

    /* LOAD VARIABLES */

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

    getstr("nietl_flg",nietl_flg);

    taua   = getval("taua");
    taub   = getval("taub");
    tauc   = getval("tauc");
    taud   = getval("taud");
    bigTN = getval("bigTN");
    pwN = getval("pwN");
    tpwr = getval("tpwr");
    tsatpwr = getval("tsatpwr");
    dpwr = getval("dpwr");
    pwNlvl = getval("pwNlvl");
    pwD = getval("pwD");
    pwDlvl = getval("pwDlvl");
    phase = (int) ( getval("phase") + 0.5);
    phase2 = (int) ( getval("phase2") + 0.5);
    sw1 = getval("sw1");
    sw2 = getval("sw2");
    ni = getval("ni");
    pw_sl = getval("pw_sl");
    tpwrsl = getval("tpwrsl");
    at = getval("at");
    sphase = getval("sphase");
    sphase1 = getval("sphase1");
    phase_sl = getval("phase_sl");

    gstab = getval("gstab");

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

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


    if(autocal[0]=='n')
    {
        getstr("spcosed",spcosed);
        getstr("spcareb",spcareb);
        getstr("spca180",spca180);
        getstr("cacbdecseq",cacbdecseq);

        d_c90 = getval("d_c90");
        d_c180 = getval("d_c180");
        d_creb = getval("d_creb");
        d_csed = getval("d_csed");

        pwc90 = getval("pwc90");
        pwca180 = getval("pwca180");
        pwca180dec = getval("pwca180dec");
        pwcareb = getval("pwcareb");
        pwcosed = getval("pwcosed");

        d_cacbdec = getval("d_cacbdec");
        pwcacbdec = getval("pwcacbdec");
        dres_dec = getval("dres_dec");
    }
    else
    {
        strcpy(spcosed,"Phard_118p");
        strcpy(spcareb,"Preburp_-15p");
        strcpy(spca180,"Phard_-118p");
        strcpy(cacbdecseq,"Pcb_dec");
        if (FIRST_FID)
        {
            compC = getval("compC");
            pwC = getval("pwC");
            pwClvl = getval("pwClvl");
            co180 = pbox(spcosed, CO180, CA180ps, dfrq, compC*pwC, pwClvl);
            creb = pbox(spcareb, CREB180, CAB180ps, dfrq, compC*pwC, pwClvl);
            ca180 = pbox(spca180, CA180, CA180ps, dfrq, compC*pwC, pwClvl);
            cbdec = pbox(cacbdecseq, CBDEC,CBDECps, dfrq, compC*pwC, pwClvl);
            c90 = pbox("Phard90", C90, CA180ps, dfrq, compC*pwC, pwClvl);
        }
        d_c90 = c90.pwr;
        d_c180 = ca180.pwr;
        d_creb = creb.pwr;
        d_csed = co180.pwr;
        pwc90 = c90.pw;
        pwca180 = ca180.pw;
        pwca180dec = ca180.pw;
        pwcareb = creb.pw;
        pwcosed = co180.pw;

        d_cacbdec = cbdec.pwr;
        pwcacbdec = 1.0/cbdec.dmf;
        dres_dec = cbdec.dres;
    }

    /* LOAD PHASE TABLE */

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

    /* CHECK VALIDITY OF PARAMETER RANGES */

    if(ix==1)
        printf("Uses shared AT in the N dimension. Choose ni2 as desired\n");


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

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


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

    if( dpwr > -16 )
    {
        printf("DPWR too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > -16 )
    {
        printf("DPWR2 too large!  ");
        psg_abort(1);
    }

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

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

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

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

    if( pwDlvl > 59) {
        printf("pwDlvl too high\n");
        psg_abort(1);
    }

    if( dpwr3 > 50) {
        printf("dpwr3 too high\n");
        psg_abort(1);
    }

    if( pw_sl > 10e-3) {
        printf("too long pw_sl\n");
        psg_abort(1);
    }

    if(d_cacbdec > 40) {
        printf("d_cacbdec is too high; < 41\n");
        psg_abort(1);
    }

    if(nietl_flg[A] == 'y' && sel_flg[A] == 'y') {
        printf("nietl_flg and sel_flg cannot both be y\n");
        psg_abort(1);
    }

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


    /*  Phase incrementation for hypercomplex 2D data */

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

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

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

    /*  Set up f1180  tau2 = t1               */

    tau1 = d2;
    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1)
                  - 4.0/PI*pwc90 - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
                  - pwca180dec - WFG_STOP_DELAY - 2.0*pwN - POWER_DELAY
                  - 4.0e-6);
    }

    if(f1180[A] == 'n')
        tau1 = ( tau1
                 - 4.0/PI*pwc90 - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
                 - pwca180dec - WFG_STOP_DELAY - 2.0*pwN - POWER_DELAY
                 - 4.0e-6);

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

    /*  Set up f2180  tau2 = t2               */

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

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

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

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

    /* BEGIN ACTUAL PULSE SEQUENCE */

    status(A);
    obspower(tsatpwr);     /* Set transmitter power for 1H presaturation */
    decpower(d_c180);       /* Set Dec1 power to high power          */
    dec2power(pwNlvl);     /* Set Dec2 power for 15N hard pulses         */
    decoffset(dof);


    /* Presaturation Period */

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

    /* Begin Pulses */

    status(B);

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

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

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

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

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

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

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

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

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

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

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

        decpower(d_c180);

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

        dec2rgpulse(pwN,zero,0.0,0.0);

        delay(tauc);

        dec2rgpulse(2*pwN,zero,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(one);

        delay(tauc - pwca180);

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

        decpower(d_c180);

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

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

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

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

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

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

        dec2rgpulse(2*pwN,zero,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(one);

        delay(tauc - pwca180);

        dec2rgpulse(pwN,one,0.0,0.0);
    }
    /* END sel_flg */

    decphase(t1);

    decpower(d_c90);

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

    /* Cay to CaxC'z  */
    dec2phase(zero);
    txphase(zero);

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

    if (cacb_dec[A] == 'n')
    {
        decrgpulse(pwc90,t1,2.0e-6,0.0);

        delay(taud -POWER_DELAY -4.0e-6 -WFG_START_DELAY);

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

        decpower(d_creb);
        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 2.0e-6);

        decpower(d_c90);
        decrgpulse(pwc90,one,2.0e-6,0.0);
    }
    else
    {
        decrgpulse(pwc90,t1,2.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

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

        decpower(d_creb);
        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY - 2.0e-6);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_c90);
        decrgpulse(pwc90,one,2.0e-6,0.0);
    }
    /* END cacb_dec */

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

    decoffset(dof+(174-56)*dfrq);   /* change Dec1 carrier to Co  */

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

    /*  t1 period for C' chemical shift evolution; Ca 180 and N 180 are used
        to decouple  */

    decrgpulse(pwc90,t2,2.0e-6,0.0);
    if (fc180[A]=='n')
    {
        decpower(d_c180);
        delay(tau1);
        decshaped_pulse(spca180,pwca180dec,zero,4.0e-6,0.0);
        dec2rgpulse(2*pwN,zero,0.0,0.0);
        delay(tau1);
        decpower(d_c90);
    }
    else
        decrgpulse(2*pwc90,zero,0.0,0.0);

    decrgpulse(pwc90,zero,4.0e-6,0.0);

    decoffset(dof);  /* set carrier to Ca */


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

    /*  Refocusing  CayC'z to Cax  */

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

    if (cacb_dec[A] == 'n')
    {
        decrgpulse(pwc90,zero,0.0e-6,0.0);

        delay(taud - POWER_DELAY
              - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        decpower(d_creb);
        initval(1.0,v4);
        decstepsize(sphase1);
        dcplrphase(v4);

        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6);

        decpower(d_c90);
        decrgpulse(pwc90,one,4.0e-6,0.0);
    }
    else
    {
        decrgpulse(pwc90,zero,0.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        decpower(d_creb);
        initval(1.0,v4);
        decstepsize(sphase1);
        dcplrphase(v4);

        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_c90);
        decrgpulse(pwc90,one,4.0e-6,0.0);
    }
    /* END cacb_dec */

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

    decpower(d_c180);
    txphase(zero);

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

    /* Constant t2 period  */

    if (bigTN - tau2 >= 0.2e-6)
    {
        dec2rgpulse(pwN,t3,2.0e-6,0.0);

        dec2phase(t4);

        delay(bigTN - tau2 + pwca180);

        dec2rgpulse(2*pwN,t4,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(t5);

        decpower(d_csed);

        delay(bigTN - gt1 - 502.0e-6 - 2.0*GRADIENT_DELAY - POWER_DELAY
              - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY);

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

        decshaped_pulse(spcosed,pwcosed,zero,0.0,0.0);

        delay(tau2);

        sim3pulse(pw,0.0e-6,pwN,zero,zero,t5,0.0,0.0);
    }
    else
    {
        dec2rgpulse(pwN,t3,2.0e-6,0.0);

        dec2rgpulse(2.0*pwN,t4,2.0e-6,2.0e-6);
        dec2phase(t5);

        delay(tau2 - bigTN);
        decrgpulse(pwca180,zero,0.0,0.0);

        decpower(d_csed);

        delay(bigTN - pwca180 - POWER_DELAY
              - gt1 - 502.0e-6 - 2.0*GRADIENT_DELAY
              - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY);

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

        decshaped_pulse(spcosed,pwcosed,zero,0.0,0.0);

        delay(tau2);

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

    if (nietl_flg[A] == 'n')
    {
        delay(0.2e-6);
        zgradpulse(gzlvl6,gt6);
        delay(2.0e-6);

        dec2phase(zero);
        delay(taub - gt6 - 2.2e-6);

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

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

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

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

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

        txphase(zero);
        dec2phase(zero);

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

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

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

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

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

    }
    else
    {

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

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

        dec2phase(zero);
        delay(taub - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pw_sl
              - WFG_STOP_DELAY - POWER_DELAY - 4.0e-6
              - gt6 - 2.2e-6);

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

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

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

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

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

        txphase(zero);
        dec2phase(zero);

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

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

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

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

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

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

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

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

    lk_sample();
    status(C);
    setreceiver(t6);

}
Ejemplo n.º 19
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);
}
Ejemplo n.º 20
0
pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */

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

double      p_d,
	    rfd,
	    ncyc,
	    COmix = getval("COmix"),
	    p_trim,
	    rftrim,
	    tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    kappa = 5.4e-3,
	    lambda = 2.4e-3,
            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	rf0,            	  /* maximum fine power when using pwC pulses */
      bw, ofs, ppm,  /* bandwidth, offset, ppm - temporary Pbox parameters */

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

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

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

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

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

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

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

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

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



/*   LOAD PHASE TABLE    */

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

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


/*   INITIALIZE VARIABLES   */

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

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

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

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

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

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

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


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

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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


/* PHASES AND INCREMENTED TIMES */

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

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


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


/*  Set up f2180  */

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


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

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

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



/* BEGIN PULSE SEQUENCE */

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

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

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

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

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

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

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

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

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

	dec2rgpulse(pwN, zero, 0.0, 0.0);

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

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


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


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

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

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


/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

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

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


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

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

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

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

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

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

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

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

	rgpulse(pw, zero, 0.0, 0.0); 

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

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

	setreceiver(t12);
}		 
Ejemplo n.º 21
0
pulsesequence()
{

    /* DECLARE AND LOAD VARIABLES */

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

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

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

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

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

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

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

                sw1 = getval("sw1"),

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

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

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

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



    /*   LOAD PHASE TABLE    */

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

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

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



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

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


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

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

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

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

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

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



    /* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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



    /*  RELAXATION TIMES AND FLAGS */

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


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




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

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


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


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

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


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


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


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


    /* PHASES AND INCREMENTED TIMES */

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

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


    /*  Set up f1180  */

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



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

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



    /*  Correct inverted signals for NH2 only spectra  */

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



    /* BEGIN PULSE SEQUENCE */

    status(A);

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

    delay(d1);


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

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

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

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

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

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

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

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

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

    /*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 RELAXATION    xxxxxxxxxxxxxxxxxxxx  */

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

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

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

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

            endloop(v5);
        }

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

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

        loop(v5,v6);

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

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

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

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

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

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

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

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

        delay(tau1);

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

    setreceiver(t12);
}
Ejemplo n.º 22
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          SE_flg[MAXSTR],
          href_flg[MAXSTR];    

   int    icosel = 0,
          t1_counter,
          t2_counter,
          ni2 = getval("ni2"),
          phase;


   double d2_init=0.0,
          d3_init=0.0,
          pwS1,pwS2,pwS3,pwS4,pwS5,pwS6,
          lambda = getval("lambda"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gzlvl5 = getval("gzlvl5"), 
          gzlvl6 = getval("gzlvl6"), 
          gt1 = getval("gt1"),
/*        gt2 = getval("gt2"), */
          gt3 = getval("gt3"),
          gt5 = getval("gt5"),
          gt6 = getval("gt6"),
          gstab = getval("gstab"),
          shlvl1 = getval("shlvl1"),
          shpw1 = getval("shpw1"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          dpwr2 = getval("dpwr2"),
          d2 = getval("d2"),
          timeTN = getval("timeTN"),
          tau1 = getval("tau1"),
          tau2 = getval("tau2"),
          taunh = getval("taunh");

   getstr("shname1", shname1);
   getstr("SE_flg",SE_flg);
   getstr("f1180",f1180);
   getstr("f2180",f2180);
   getstr("href_flg",href_flg);



  phase = (int) (getval("phase") + 0.5);
   
   settable(t1,4,phi1);
   settable(t3,4,phi3);
   settable(t5,4,phi5);
   settable(t10,1,phi10);
   settable(t12,4,phi12);
   settable(t13,4,phi13);

/*   INITIALIZE VARIABLES   */

   pwS1 = c13pulsepw("co", "ca", "sinc", 90.0);
   pwS2 = c13pulsepw("co", "ca", "sinc", 180.0);
   pwS3 = c13pulsepw("ca", "co", "square", 180.0);
   pwS4 = h_shapedpw("eburp2",4.0,3.5,zero, 0.0, 0.0);  
   pwS6 = h_shapedpw("reburp",4.0,3.5,zero, 0.0, 0.0);
   pwS5 = h_shapedpw("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);


if (SE_flg[0] == 'y')
{
   if ( ni2*1/(sw2)/2.0 > (timeTN-pwS2*0.5-pwS4))
       { printf(" ni2 is too big. Make ni2 equal to %d or less.\n",
         ((int)((timeTN-pwS2*0.5-pwS4)*2.0*sw2)));    psg_abort(1);}
}
else
{
   if ( ni2*1/(sw2)/2.0 > (timeTN-pwS2*0.5))
       { printf(" ni2 is too big. Make ni2 equal to %d or less.\n",
         ((int)((timeTN-pwS2*0.5)*2.0*sw2)));    psg_abort(1);}
}



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

if (SE_flg[0] =='y')
{
  if (phase2 == 2)  {tsadd(t10,2,4); icosel = +1;}
            else                               icosel = -1;
}
else
{
  if (phase2 == 2) {tsadd(t3,1,4);tsadd(t5,1,4); icosel=1;}
}
 

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

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

  
    


   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); tsadd(t13,2,4); }

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



   status(A);
      rcvroff();  

   decpower(pwClvl);
   decoffset(dof);
   dec2power(pwNlvl);
   dec2offset(dof2);
   decpwrf(4095.0);
   obsoffset(tof);
   set_c13offset("co");


     zgradpulse(gzlvl6, gt6);
       delay(1.0e-4);

       delay(d1-gt6);
lk_hold();

        h_shapedpulse("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);  

	delay(lambda-pwS5*0.5-pwS6*0.4); 

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, one, zero, zero, 0.0, 0.0);

	delay(lambda-pwS5*0.5-pwS6*0.4);

        h_shapedpulse("pc9f_",4.0,3.5,one, 0.0, 0.0);  


   obspower(shlvl1);
/**************************************************************************/
      dec2rgpulse(pwN,zero,0.0,0.0);

           zgradpulse(gzlvl3, gt3);
           delay(timeTN-pwS2*0.5-gt3);

      sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);

        if (href_flg[0] == 'y') 
        {
           delay(timeTN-pwS2*0.5-taunh*0.5-shpw1);
           shaped_pulse(shname1,shpw1,two,0.0,0.0);
           zgradpulse(gzlvl3, gt3);
           delay(taunh*0.5-gt3);
     dec2rgpulse(pwN,zero,0.0,0.0);				     
        }
        else
        {
           delay(timeTN-pwS2*0.5-taunh*0.5);
           zgradpulse(gzlvl3, gt3);
           delay(taunh*0.5-gt3);
     dec2rgpulse(pwN,one,0.0,0.0);				     
        }
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION        xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/
   
	c13pulse("co", "ca", "sinc", 90.0, t1, 2.0e-6, 0.0);       
        delay(tau1*0.5);
        sim3_c13pulse(shname1, "ca", "co", "square", "", shpw1, 180.0, 2.0*pwN,
                                                  zero, zero, zero, 2.0e-6, 0.0);
        delay(tau1*0.5);
	c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      
        sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 0.0,
                                                  one, zero, zero, 2.0e-6, 0.0);
        if (pwN*2.0 > pwS3) delay(pwN*2.0-pwS3);
	c13pulse("co", "ca", "sinc", 90.0, zero, 0.0, 0.0);       

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

   obspower(tpwr);
        if (href_flg[0] == 'y') 
         {
          shaped_pulse(shname1,shpw1,two,0.0,0.0);
     dec2rgpulse(pwN,t3,0.0,0.0);
         }
        else 
     dec2rgpulse(pwN,t5,0.0,0.0);

      if (SE_flg[0] == 'y')
      {
        if (href_flg[0] == 'y')
        {
           delay(tau2*0.5);
	c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);       
          delay(taunh*0.5-pwS3);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
        delay(timeTN-pwS2*0.5-shpw1-taunh*0.5-gt1-1.0e-4);
        }
        else
        {
           delay(tau2*0.5);
        sim_c13pulse(shname1,"ca", "co", "square",shpw1, 180.0, two,zero, 0.0, 0.0);
          if (shpw1 >= pwS3) delay(taunh*0.5-shpw1);
          else  delay(taunh*0.5-pwS3);
        delay(timeTN-pwS2*0.5-taunh*0.5-gt1-1.0e-4);
        }
 
        zgradpulse(-gzlvl1, gt1);
        delay(1.0e-4);

      sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
           delay(timeTN-pwS2*0.5-tau2*0.5-pwS4);
        h_shapedpulse("eburp2",4.0,3.5,zero, 2.0e-6, 0.0); 
	dec2rgpulse(pwN, t10, 0.0, 0.0);
      }
      else
      {
        if (href_flg[0] == 'y')
        {
           delay(tau2*0.5);
	c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);       
          delay(taunh*0.5-pwS3);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
        delay(timeTN-pwS2*0.5-shpw1-taunh*0.5);
        }
        else
        {
           delay(tau2*0.5);
        sim_c13pulse(shname1,"ca", "co", "square",shpw1, 180.0, two,zero, 0.0, 0.0);
         if (shpw1 >= pwS3)   delay(taunh*0.5-shpw1);
         else  delay(taunh*0.5-pwS3);
        delay(timeTN-pwS2*0.5-taunh*0.5);
        }

      sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
       delay(timeTN-pwS2*0.5-tau2*0.5);
       dec2rgpulse(pwN, zero, 0.0, 0.0);
      }

/**************************************************************************/
if (SE_flg[0] == 'y')
{
	zgradpulse(gzlvl5, gt5);
	delay(lambda-pwS6*0.4  - gt5);

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

	zgradpulse(gzlvl5, gt5);
	delay(lambda-pwS6*0.4  - gt5);

	dec2rgpulse(pwN, one, 0.0, 0.0);
  
        h_shapedpulse("eburp2_",4.0,3.5,one, 0.0, 0.0); 
 

	txphase(zero);
	dec2phase(zero);
	delay(lambda-pwS4*0.5-pwS6*0.4);

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

	dec2phase(t10);
	delay(lambda-pwS4*0.5-pwS6*0.4);

 
        h_shapedpulse("eburp2",4.0,3.5,zero, 0.0, 0.0); 


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

        h_shapedpulse("reburp",4.0,3.5,zero, 0.0, 0.0); 
        zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
}
else
{
        h_shapedpulse("eburp2",4.0,3.5,zero, 2.0e-6, 0.0);
        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.4  - gt5);

        h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.4  - gt5-POWER_DELAY-1.0e-4);
}

	dec2power(dpwr2);				       /* POWER_DELAY */
lk_sample();
if (SE_flg[0] == 'y')
	setreceiver(t13);
else
	setreceiver(t12);
      rcvron();  
statusdelay(C,1.0e-4 );

}		 
Ejemplo n.º 23
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
          SE_flg[MAXSTR];

   int    icosel = 0,
          t1_counter,
          phase;


   double d2_init=0.0,
          pwS4,pwS5,pwS6,pwS7,
          lambda = getval("lambda"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gzlvl5 = getval("gzlvl5"), 
          gt1 = getval("gt1"),
          gt3 = getval("gt3"),
          gt5 = getval("gt5"),
          gstab = getval("gstab"),
          shpw1,shlvl1=getval("shlvl1"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          ni = getval("ni"),
          d2 = getval("d2"),
          tau1 = getval("tau1");

   getstr("shname1", shname1);
   getstr("SE_flg",SE_flg);
   getstr("f1180",f1180);



  phase = (int) (getval("phase") + 0.5);
   
   settable(t3,2,phi3);
   settable(t10,1,phi10);
   settable(t12,2,phi12);
   settable(t13,2,phi13);

/*   INITIALIZE VARIABLES   */

   shpw1 = getval("shpw1");
   pwS4 = h_shapedpw("eburp2",4.0,3.5,zero, 0.0, 0.0);  
   pwS5 = h_shapedpw("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);
   pwS6 = h_shapedpw("reburp",4.0,3.5,zero, 0.0, 0.0);
   pwS7 = c_shapedpw2("isnob5",40.0,-125.0,"isnob5",40.0,0.0 , two, 0.0, 0.0);

if (SE_flg[0] =='y')
{
  if (phase == 2)  {tsadd(t10,2,4); icosel = +1;}
            else                               icosel = -1;
}
else
{
  if (phase == 2) {tsadd(t3,1,4); icosel=1;}
}
 

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

   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); tsadd(t13,2,4); }



   status(A);
   decpower(pwClvl);
   dec2power(pwNlvl);
   set_c13offset("co");
   zgradpulse(gzlvl3, gt3);
   delay(d1-gt3);
   lk_hold();
   rcvroff();
        h_shapedpulse("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);  

	delay(lambda-pwS5*0.5-pwS6*0.4); 

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, one, zero, zero, 0.0, 0.0);

	delay(lambda-pwS5*0.5-pwS6*0.4);

        h_shapedpulse("pc9f_",4.0,3.5,one, 0.0, 0.0);  


   obspower(shlvl1);
/**************************************************************************/ 
/** Sensitivity enhanced version                     **********************/
/**************************************************************************/ 
      if (SE_flg[0] == 'y')
      {
        shaped_pulse(shname1,shpw1,zero,0.0,0.0);
     dec2rgpulse(pwN,t3,0.0,0.0);
           delay(tau1*0.5);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
 c_shapedpulse2("isnob5",40.0,-125.0,"isnob5",40.0,0.0 , two, 0.0, 0.0);
           delay(tau1*0.5);
        zgradpulse(-gzlvl1, gt1);
           delay(pwS4-shpw1-pwS7-gt1);
     dec2rgpulse(pwN*2.0,zero,0.0,0.0);

        h_shapedpulse("eburp2",4.0,3.5,zero, 2.0e-6, 0.0); 
	dec2rgpulse(pwN, t10, 0.0, 0.0);
      }

/**************************************************************************/ 
/** standard INEPT-based version                     **********************/
/**************************************************************************/ 
      else
      {
      if (ni < 1.0)
      {
       dec2rgpulse(pwN,t3,0.0,0.0);
       dec2rgpulse(pwN*2.0, zero, 0.0, 0.0);
       dec2rgpulse(pwN, zero, 0.0, 0.0);
      }
      else
      {
           if (tau1 < shpw1)
           {
           shaped_pulse(shname1,shpw1,two,0.0,0.0);
           shaped_pulse(shname1,shpw1,zero,0.0,0.0);
           dec2rgpulse(pwN,t3,0.0,0.0);
           delay(tau1);
           dec2rgpulse(pwN*3.0, zero, 0.0, 0.0);
           }
           else
           {
             if  (tau1*0.5 < (pwS7+shpw1*0.5))
             {
             shaped_pulse(shname1,shpw1,two,0.0,0.0);
             dec2rgpulse(pwN,t3,0.0,0.0);
             delay(tau1*0.5-shpw1*0.5);
             shaped_pulse(shname1,shpw1,zero,0.0,0.0);
             delay(tau1*0.5-shpw1*0.5);
             dec2rgpulse(pwN*3.0, zero, 0.0, 0.0);
             }
             else
             {
             shaped_pulse(shname1,shpw1,two,0.0,0.0);
             dec2rgpulse(pwN,t3,0.0,0.0);
             delay(tau1*0.5-shpw1*0.5);
             shaped_pulse(shname1,shpw1,zero,0.0,0.0);
             c_shapedpulse2("isnob5",40.0,-125.0,"isnob5",40.0,0.0 , two, 0.0, 0.0);
             delay(tau1*0.5-shpw1*0.5-pwS7);
             dec2rgpulse(pwN*3.0, zero, 0.0, 0.0);
             }
           } 
      }
      }
/**************************************************************************/ 

if (SE_flg[0] == 'y')
{
	zgradpulse(gzlvl5, gt5);
	delay(lambda-pwS6*0.4  - gt5);

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

	zgradpulse(gzlvl5, gt5);
	delay(lambda-pwS6*0.4  - gt5);

	dec2rgpulse(pwN, one, 0.0, 0.0);
  
        h_shapedpulse("eburp2_",4.0,3.5,one, 0.0, 0.0); 
 

	txphase(zero);
	dec2phase(zero);
	delay(lambda-pwS4*0.5-pwS6*0.4);

   	h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

	dec2phase(t10);
	delay(lambda-pwS4*0.5-pwS6*0.4);

 
        h_shapedpulse("eburp2",4.0,3.5,zero, 0.0, 0.0); 


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

        h_shapedpulse("reburp",4.0,3.5,zero, 0.0, 0.0); 
        zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
}
else
{
        h_shapedpulse("eburp2",4.0,3.5,zero, 2.0e-6, 0.0);
        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.4  - gt5);

        h_sim3shapedpulse("reburp",4.0,3.5,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.4  - gt5-POWER_DELAY-1.0e-4); 
}

	dec2power(dpwr2);				       /* POWER_DELAY */
lk_sample();
if (SE_flg[0] == 'y')
	setreceiver(t13);
else
	setreceiver(t12);
statusdelay(C,1.0e-4 );

}		 
Ejemplo n.º 24
0
pulsesequence()
{
   char   CT_flg[MAXSTR],	/* Constant time flag */
	  f1180[MAXSTR],
          shname1[MAXSTR],      /* First pulse: name or 'vap' for
                                   automatic VAP(Variable angle pulse) */
	  ab_flg[MAXSTR];	/* inversion of 15N for coupling*/
	  
   int    t1_counter,
          phase;

   double d2_init=0.0, pwNa = 0.0,
   	  adjust = getval("adjust"),
          ref_pwr = getval("ref_pwr"),
          ref_pw90 = getval("ref_pw90"),
          fla = getval("fla"),             /* flip-angle */
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gt1 = getval("gt1"),
          gt2 = getval("gt2"),
          gstab = getval("gstab"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          dpwr2 = getval("dpwr2"),
          d2 = getval("d2"),
          tau1 = getval("tau1"),
          taunh = 1/(2.0*getval("JNH"));

   void   compo_pulse(), make_shapes();

   getstr("CT_flg", CT_flg);
   getstr("f1180",f1180);
   getstr("shname1",shname1);
   getstr("ab_flg",ab_flg);

   if(ab_flg[A] == 'a' || ab_flg[A] == 'b')
     pwNa = pwN;
  
   phase = (int) (getval("phase") + 0.5); 

   if(FIRST_FID) 
     make_shapes(shname1, ref_pw90, ref_pwr, fla);
   
   tau1 = d2;
   if((f1180[A] == 'y') && (ni > 1.0))
   { 
     tau1 += ( 1.0 / (2.0*sw1) ); 
     if(tau1 < 0.2e-6) 
       tau1 = 0.0; 
   }
  
   if (f1180[0] == 'y')  
     tau1 = tau1-pwN*4.0/3.0;

   if(ix == 1) d2_init = d2;

   dbl(ct,v1);  /* v1 = 0202 */
   t1_counter = (int) ((d2-d2_init)*sw1 + 0.5);
   if(t1_counter % 2)
     add(two,v1,v1); 
   assign(v1,oph);
   if (phase == 2) 
     incr(v1);   

   status(A);

   dec2power(pwNlvl);

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

   pbox_pulse(&sh1,zero,2.0e-4,2.0e-6);
           zgradpulse(gzlvl1, gt1);
           delay(gstab);
     
  if (ni == 0)
  {
     delay(taunh-gt1-gstab-WFG_START_DELAY+pwN*4.0-adjust);
     pbox_pulse(&sh2,zero,2.0e-6,2.0e-6);
     dec2rgpulse(pwN,v1,0.0,0.0);
     dec2rgpulse(pwN*2.0,zero,0.0,0.0);
     dec2rgpulse(pwN,zero,0.0,0.0);
  }
  else
  {
    delay(taunh-gt1-gstab-adjust);
    obspower(sh2dec.pwr);
    compo_pulse(pwN,v1,tau1);
  }

  zgradpulse(gzlvl1, gt1);
  delay(taunh*0.5-gt1-pwNa);

  if(ab_flg[A] == 'a' || ab_flg[A] == 'b')
  {
    dec2rgpulse(pwNa,zero,0.0,0.0); 
    if (ab_flg[0] == 'b')      /*INVERSION OR FLIP BACK*/
      dec2rgpulse(pwNa,two,0.0,0.0);
    else
      dec2rgpulse(pwNa,zero,0.0,0.0);
  }

  delay(taunh*0.5-pwNa-POWER_DELAY); 
  dec2power(dpwr2);
  
/*  obsoffset(tof+3.3*sfrq);  */

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

  char f1180[MAXSTR],		/* Flag to start t1 @ halfdwell */
       f2180[MAXSTR],		/* Flag to start t2 @ halfdwell */
       H2Opurge[MAXSTR], stCdec[MAXSTR],	/* calls STUD+ waveforms from shapelib */
       STUD[MAXSTR];		/* apply automatically calculated STUD decoupling */

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

  double tau1,			/*  t1 delay */
         BPdpwrspinlock,        /*  user-defined upper limit for spinlock(Hz) */
         BPpwrlimits,           /*  =0 for no limit, =1 for limit             */
         tau2,			/*  t2 delay */
         ni = getval("ni"), ni2 = getval("ni2"),
	 stdmf = getval("dmf80"),	/* dmf for 80 ppm of STUD decoupling */
         rf80 = getval("rf80"),	/* rf in Hz for 80ppm STUD+ */
         taua = getval("taua"),	/* time delays for CH coupling evolution */
         taub = getval("taub"), tauc = getval("tauc"),
	 /* string parameter stCdec calls stud decoupling waveform from your shapelib. */
         studlvl,		/* coarse power for STUD+ decoupling */
         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-3 at rfd  */
         rfd,			/* fine power for 9.0 kHz rf at 600MHz         */
         ncyc = getval("ncyc"),	/* no. of cycles of DIPSI-3 */
         spinlock = getval("spinlock"),		/* DIPSI-3 Field Strength in Hz */
	 /* the following pulse length for the SLP pulse is automatically calculated   */
	 /* by the macro "hcch_tocsy".  The SLP pulse shape,"offC10" is called         */
	 /* directly from your shapelib.                                               */
         pwC10 = getval("pwC10"),	/* 180 degree selective sinc pulse on CO(174ppm) */
         rf7,			/* fine power for the pwC10 ("offC10") pulse */
         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 */
         sw1 = getval("sw1"), sw2 = getval("sw2"),
	 gt0 = getval("gt0"),	/* other gradients */
         gt3 = getval("gt3"), gt4 = getval("gt4"), gt5 = getval("gt5"),
         gt7 = getval("gt7"), 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("H2Opurge", H2Opurge);
  getstr("STUD", STUD);
  /* 80 ppm STUD+ decoupling */
  strcpy(stCdec, "stCdec80");
  studlvl = pwClvl + 20.0 * log10(compC * pwC * 4.0 * rf80);
  studlvl = (int) (studlvl + 0.5);

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

  /*   LOAD PHASE TABLE    */
  settable(t3, 2, phi3);
  settable(t5, 4, phi5);
  settable(t9, 8, phi9);
  settable(t11, 8, rec);


  /*   INITIALIZE VARIABLES   */
  if (BPpwrlimits > 0.5)
  {
   if (spinlock > BPdpwrspinlock)
    {
     spinlock = BPdpwrspinlock;  
     printf("spinlock too large, reset to user-defined limit (BPdpwrspinlock)");
     psg_abort(1);
    }
  }

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

  if ((pwC > (25.0e-6 * 600.0 / sfrq)) && (ncyc > 0.0))
  {
    printf("Increase pwClvl so that pwC < 25*600/sfrq");
    psg_abort(1);
  }

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

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

  if (spinlock < 1000.0)
  {
    printf("Spinlock seems too low. Please check spinlock value ! ");
    psg_abort(1);
  }

  /* dipsi-3 spinlock 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);
/*************************For Ultra-High Field Probes***************************/
if (sfrq>590.0)
{
 if (ncyc>2)
  {
    if (pwC>15)
     {
      if (rfd > 2000)
       {
        printf("spinlock too large. Lower value for probe protection");
        psg_abort(1);
       }
     }
    else
     {
      if (pwC>14)
       {
        if (rfd > 1800)
         {
          printf("spinlock too large. Lower value for probe protection");
          psg_abort(1);
         }
       }
      else
       {
        if (pwC>13)
         {
          if (rfd > 1600)
           {
            printf("spinlock too large. Lower value for probe protection");
            psg_abort(1);
           }
         }
        else
         {
          if (pwC>12)
           {
            if (rfd > 1400)
             {
               printf("spinlock too large. Lower value for probe protection");
               psg_abort(1);
             }
           }
          else
           {
            if (pwC>11)
             {
              if (rfd > 1200)
               {
                printf("spinlock too large. Lower value for probe protection");
                psg_abort(1);
               }
             }
            else
             {
                if (rfd > 1000)
                 {
                  printf("spinlock too large. Lower value for probe protection");
                  psg_abort(1);
                 }
             }
           }
         }    
       }
     }
  }
 else 
  {
   if (ncyc == 2)
    {
     if (pwC>15)
      {
       if (rfd > 2200)
        {
         printf("spinlock too large. Lower value for probe protection");
         psg_abort(1);
        }
      }
     else
      {
       if (pwC>14)
        {
         if (rfd > 2000)
          {
           printf("spinlock too large. Lower value for probe protection");
           psg_abort(1);
          }
        }
       else
        {
         if (pwC>13)
          {
           if (rfd > 1800)
            {
             printf("spinlock too large. Lower value for probe protection");
             psg_abort(1);
            }
          }
         else
          {
           if (pwC>12)
            {
             if (rfd > 1600)
              {
                printf("spinlock too large. Lower value for probe protection");
                psg_abort(1);
              }
            }
           else
            {
             if (pwC>11)
              {
               if (rfd > 1400)
                {
                 printf("spinlock too large. Lower value for probe protection");
                 psg_abort(1);
                }
              }
             else
              {
                 if (rfd > 1200)
                  {
                   printf("spinlock too large. Lower value for probe protection");
                   psg_abort(1);
                  }
              }
            }
          }    
        }
      }
     }
   else
    {
     if (ncyc == 1)
      {
       if (pwC>15)
        {
         if (rfd > 2400)
          {
           printf("spinlock too large. Lower value for probe protection");
           psg_abort(1);
          }
        }
       else
        {
         if (pwC>14)
          {
           if (rfd > 2200)
            {
             printf("spinlock too large. Lower value for probe protection");
             psg_abort(1);
            }
          }
         else
          {
           if (pwC>13)
            {
             if (rfd > 2000)
              {
               printf("spinlock too large. Lower value for probe protection");
               psg_abort(1);
              }
            }
           else
            {
             if (pwC>12)
              {
               if (rfd > 1800)
                {
                  printf("spinlock too large. Lower value for probe protection");
                  psg_abort(1);
                }
              }
             else
              {
               if (pwC>11)
                {
                 if (rfd > 1600)
                  {
                   printf("spinlock too large. Lower value for probe protection");
                   psg_abort(1);
                  }
                }
               else
                {
                   if (rfd > 1400)
                    {
                     printf("spinlock too large. Lower value for probe protection");
                     psg_abort(1);
                    }
                }
              }
            }       
          }
        }
      }
    }

  }


}
/*********************End: For Ultra-High Field Probes***************************/

  /* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

  if (pw > 80.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 */
  if (phase1 == 2)
    tsadd(t3, 1, 4);
  if (phase2 == 2)
    tsadd(t5, 1, 4);

  /*  C13 TIME INCREMENTATION and set up f1180  */

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



  /*   BEGIN PULSE SEQUENCE   */

  status(A);
  if (dm3[B] == 'y')
    lk_sample();
  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 */
  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(t3);
  delay(1.0e-5);

  decrgpulse(pwC, zero, 0.0, 0.0);	/*destroy C13 magnetization */
  zgradpulse(gzlvl0, 0.5e-3);
  delay(1.0e-4);
  decrgpulse(pwC, one, 0.0, 0.0);
  zgradpulse(0.7 * gzlvl0, 0.5e-3);
  delay(5.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(pw, t3, 0.0, 0.0);	/* 1H pulse excitation */
  zgradpulse(gzlvl0, gt0);	/* 2.0*GRADIENT_DELAY */
  decphase(zero);
  delay(taua + tau1 - gt0 - 2.0 * GRADIENT_DELAY - 2.0 * pwC);
  decrgpulse(2.0 * pwC, zero, 0.0, 0.0);
  txphase(zero);
  delay(tau1);
  rgpulse(2.0 * pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl0, gt0);
  txphase(one);
  decphase(t5);
  delay(taua - gt0);
  rgpulse(pw, one, 0.0, 0.0);
  zgradpulse(gzlvl3, gt3);
  delay(2.0e-4);
  decrgpulse(pwC, t5, 0.0, 0.0);
  delay(tau2);
  dec2rgpulse(2.0 * pwN, zero, 0.0, 0.0);
  zgradpulse(gzlvl4, gt4);	/* 2.0*GRADIENT_DELAY */
  decphase(zero);
  decpwrf(rf7);
  delay(taub - 2.0 * pwN - gt4 - 2.0 * GRADIENT_DELAY);
  decshaped_pulse("offC10", pwC10, zero, 0.0, 0.0);
  txphase(zero);
  decpwrf(rf0);
  delay(taub - 2.0 * pw);
  rgpulse(2.0 * pw, zero, 0.0, 0.0);
  delay(tau2);
  decrgpulse(2.0 * pwC, zero, 0.0, 0.0);
  decpwrf(rf7);
  delay(taub);
  decshaped_pulse("offC10", pwC10, zero, 0.0, 0.0);
  zgradpulse(gzlvl4, gt4);	/* 2.0*GRADIENT_DELAY */
  delay(taub - gt4 - 2.0 * GRADIENT_DELAY);
  decpwrf(rfd);
  decrgpulse(1.0e-3, zero, 0.0, 0.0);
  if (ncyc>0)
  {
  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();
  }
  decrgpulse(9.0 * p_d / 5.0, t9, 2.0e-6, 0.0);
  if (H2Opurge[A] == 'y')
  {
    obspwrf(1000);
    rgpulse(900 * pw, zero, 0.0, 0.0);
    rgpulse(500 * pw, one, 0.0, 0.0);
    obspwrf(4095.0);
  }
  zgradpulse(gzlvl7, gt7);
  decpwrf(rf0);
  delay(50.0e-6);
  rgpulse(pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl7, gt7 / 1.6);
  decrgpulse(pwC, three, 100.0e-6, 0.0);
  zgradpulse(gzlvl5, gt5);
  decphase(zero);
  delay(tauc - gt5);
  simpulse(2.0 * pw, 2.0 * pwC, zero, zero, 0.0, 0.0);
  zgradpulse(gzlvl5, gt5);
  delay(tauc - gt5);
  decrgpulse(pwC, zero, 0.0, 0.0);
  zgradpulse(gzlvl3, gt3);
  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 */
  }
  delay(2.0e-4);
  rgpulse(pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl6, gt5);
  delay(taua - gt5 + rof1);
  simpulse(2.0 * pw, 2.0 * pwC, zero, zero, 0.0, rof1);
  zgradpulse(gzlvl6, gt5);
  if (STUD[A] == 'y')
    decpower(studlvl);
  else
    decpower(dpwr);
  dec2power(dpwr2);
  delay(taua - gt5 - 2.0 * POWER_DELAY);
  rgpulse(pw, zero, 0.0, rof2);
  rcvron();
  if (dm3[B] == 'y')
    lk_sample();
  setreceiver(t11);
  if ((STUD[A] == 'y') && (dm[C] == 'y'))
  {
    decprgon(stCdec, 1.0 / stdmf, 1.0);
    decon();
    if (dm2[C] == 'y')
    {
      setstatus(DEC2ch, TRUE, dmm2[C], FALSE, dmf2);
    }
  }
  else
    status(C);
}
Ejemplo n.º 26
0
pulsesequence()

{
   double   pwx2lvl,
            pwx2,
		gzlvl1,
		gt1,
		gzlvl3,
		gt3,
		gstab,
                hsglvl,
                hsgt,
            tau,
            j1xh,
            phase;
   int      iphase,
	    icosel;
   char     sspul[MAXSTR],
                nullflg[MAXSTR];

   pwx2lvl = getval("pwx2lvl");
   pwx2    = getval("pwx2");
   hsglvl = getval("hsglvl");
   hsgt = getval("hsgt");
   gzlvl1 = getval("gzlvl1");
   gzlvl3 = getval("gzlvl3");
   gt1 = getval("gt1");
   gt3 = getval("gt3");
   gstab = getval("gstab");
   getstr("nullflg",nullflg);
   j1xh    = getval("j1xh");
   tau  = 1/(4*j1xh);
   phase  = getval("phase");
   getstr("sspul",sspul);   

   iphase = (int) (phase + 0.5);
   icosel = 1;

   settable(t1,4,ph1);
   settable(t2,2,ph2);
   settable(t3,8,ph3);
   settable(t4,16,ph4);
   settable(t5,16,ph5);

   getelem(t2,ct,v2);
   getelem(t5,ct,oph);

   initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v14);

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

   add(v2,v14,v2);
   add(oph,v14,oph);

   status(A);
     dec2power(pwx2lvl);
     obspower(tpwr);
     if (sspul[0] == 'y')
   {
         zgradpulse(hsglvl,hsgt);
         rgpulse(pw,zero,rof1,rof1);
         zgradpulse(hsglvl,hsgt);
   }

      delay(d1);

    status(B);

      if (nullflg[0] == 'y')
      {
        rgpulse(0.5*pw,zero,rof1,rof1);
        delay(2*tau);
        sim3pulse(2.0*pw,0.0,2.0*pwx2,zero,zero,zero,rof1,rof1);
        delay(2*tau);
        rgpulse(1.5*pw,two,rof1,rof1);
        zgradpulse(hsglvl,hsgt);
        delay(1e-3);
      }

     rcvroff();
     rgpulse(pw,zero,rof1,rof1);
     delay(tau);
     sim3pulse(2*pw,0.0,2*pwx2,zero,zero,zero,rof1,rof1);
     delay(tau);
     rgpulse(pw,t1,rof1,rof1);
	zgradpulse(hsglvl,2*hsgt);
	delay(1e-3);
     dec2rgpulse(pwx2,v2,rof1,2.0e-6);
     if (d2/2 > 0.0)
      delay(d2/2 - (2*pwx2/PI) - pw - 4.0e-6);
     else
      delay(d2/2);
     rgpulse(2*pw,zero,2.0e-6,2.0e-6);
     if (d2/2 > 0.0) 
      delay(d2/2 - pw - 2.0e-6);  
     else
      delay(d2/2);

     delay(gt1+gstab + GRADIENT_DELAY + (2*pwx2/PI) + 2.0e-6);
     dec2rgpulse(2*pwx2,zero,rof1,rof1);
     zgradpulse(gzlvl1,gt1);
     delay(gstab);

     dec2rgpulse(pwx2,t4,2.0e-6,rof1);
	zgradpulse(-hsglvl,hsgt);
	delay(1e-3);
     rgpulse(pw,t3,rof1,rof1);
     delay(tau - (2*pw/PI) - 2*rof1);
     sim3pulse(2*pw,0.0,2*pwx2,zero,zero,zero,rof1, rof2);
     dec2power(dpwr2);
     zgradpulse(icosel*gzlvl3,gt3);
     delay(tau - gt3 - GRADIENT_DELAY - POWER_DELAY);
   status(C);
}
Ejemplo n.º 27
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       satmode[MAXSTR],
	    fscuba[MAXSTR],
            fc180[MAXSTR],    /* Flag for checking sequence              */
	    cbdecseq[MAXSTR];

 int         icosel,
             ni = getval("ni"),
             t1_counter;   /* used for states tppi in t1           */ 

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             tau3,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             taub,         /*  ~ 1/4JNH =  2.25 ms */
             tauc,         /*  ~ 1/4JCaC' =  4 ms */
             taud,         /*  ~ 1/4JCaC' =  4.5 ms if bigTCo can be set to be
				less than 4.5ms and then taud can be smaller*/
             zeta,        /* time for C'-N to refocuss set to 0.5*24.0 ms */
             bigTCa,      /* Ca T period */
             bigTCo,      /* Co T period */
             bigTN,       /* nitrogen T period */
             BigT1,       /* delay to compensate for gradient gt5 */
             satpwr,     /* low level 1H trans.power for presat  */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
	     sphase,       /* small angle phase shift */
	     cbpwr,        /* power level for selective CB decoupling */
	     cbdmf,        /* pulse width for selective CB decoupling */
	     cbres,        /* decoupling resolution of CB decoupling */

   pwS1,                                         /* length of square 90 on Ca */
   phshift,        /*  phase shift induced on Ca by 180 on CO in middle of t1 */
   pwS2,                                               /* length of 180 on CO */
   pwS3,                                              /* length of 180 on Ca  */
   pwS4,                                             /* length of 90 on CO */
   pwS = getval("pwS"), /* used to change 180 on CO in t1 for 1D calibrations */
   pwZ,                                    /* the largest of pwS2 and 2.0*pwN */
   pwZ1,                /* the largest of pwS2 and 2.0*pwN for 1D experiments */

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

             compH = getval("compH"),         /* adjustment for amplifier compression */
             pwHs = getval ("pwHs"),         /* H1 90 degree pulse at tpwrs */
             tpwrs,                          /* power for pwHs ("H2osinc") pulse */
             waltzB1 = getval("waltzB1"),

             pwClvl = getval("pwClvl"),                 /* coarse power for C13 pulse */
             pwC = getval("pwC"),             /* C13 90 degree pulse length at pwClvl */

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

	     swCa = getval("swCa"),
	     swCO = getval("swCO"),
	     swN  = getval("swN"),
	     swTilt,      /* This is the sweep width of the tilt vector */

	     cos_N, cos_CO, cos_Ca,
	     angle_N, angle_CO, angle_Ca;
             angle_N=0.0;                      /*initialize variable*/

/* LOAD VARIABLES */


  getstr("satmode",satmode);
  getstr("fc180",fc180);
  getstr("fscuba",fscuba);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  tauc   = getval("tauc"); 
  taud   = getval("taud"); 
  zeta  = getval("zeta");
  bigTCa = getval("bigTCa");
  bigTCo = getval("bigTCo");
  bigTN = getval("bigTN");
  BigT1 = getval("BigT1");
  tpwr = getval("tpwr");
  satpwr = getval("satpwr");
  dpwr = getval("dpwr");
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  sphase = getval("sphase");

  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  gt9 = getval("gt9");
  gt10 = getval("gt10");
  gt11 = getval("gt11");
  gt12 = getval("gt12");

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

  /* Load variable */
     cbpwr = getval("cbpwr");
     cbdmf = getval("cbdmf");
     cbres = getval("cbres");
     tau1 = 0;
     tau2 = 0;
     tau3 = 0;
     cos_N = 0;
     cos_CO = 0;
     cos_Ca = 0;

     getstr("cbdecseq", cbdecseq);

/* LOAD PHASE TABLE */

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

   kappa = 5.4e-3;

   /* get calculated pulse lengths of shaped C13 pulses */
        pwS1 = c13pulsepw("ca", "co", "square", 90.0);
        pwS2 = c13pulsepw("co", "ca", "sinc", 180.0);
        pwS3 = c13pulsepw("ca","co","square",180.0);
        pwS4 = c13pulsepw("co", "ca", "sinc", 90.0);

    /* the 180 pulse on CO at the middle of t1 */
        if (pwS2 > 2.0*pwN) pwZ = pwS2; else pwZ = 2.0*pwN;
        if ((pwS==0.0) && (pwS2>2.0*pwN)) pwZ1=pwS2-2.0*pwN; else pwZ1=0.0;
        if ( ni > 1 )     pwS = 180.0;
        if ( pwS > 0 )   phshift = 140.0;
        else             phshift = 0.0;

   tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));   /*needs 1.69 times more*/
   tpwrs = (int) (tpwrs);                          /*power than a square pulse */
   widthHd = 2.681*waltzB1/sfrq;  /* bandwidth of H1 WALTZ16 decoupling */
   pwHd = h1dec90pw("WALTZ16", widthHd, 0.0);     /* H1 90 length for WALTZ16 */


/* CHECK VALIDITY OF PARAMETER RANGES */

    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( 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( pwClvl > 62 )
    {
        printf("don't fry the probe, pwClvl 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( pwS3 > 200.0e-6 )
    {
        printf("dont fry the probe, pwS3 too high ! ");
        psg_abort(1);
    }

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


/* PHASES AND INCREMENTED TIMES */


   /* Set up angles and phases */

   angle_CO=getval("angle_CO");  cos_CO=cos(PI*angle_CO/180.0);
   angle_Ca=getval("angle_Ca");  cos_Ca=cos(PI*angle_Ca/180.0);

   if ( (angle_CO < 0) || (angle_CO > 90) )
   {  printf ("angle_CO must be between 0 and 90 degree.\n"); psg_abort(1); }

   if ( (angle_Ca < 0) || (angle_Ca > 90) )
   {  printf ("angle_Ca must be between 0 and 90 degree.\n"); psg_abort(1); }

   if ( 1.0 < (cos_CO*cos_CO + cos_Ca*cos_Ca) )
   {
       printf ("Impossible angles.\n"); psg_abort(1);
   }
   else
   {
           cos_N=sqrt(1.0- (cos_CO*cos_CO + cos_Ca*cos_Ca));
           angle_N = 180.0*acos(cos_N)/PI;
   }

   swTilt=swCO*cos_CO + swCa*cos_Ca + swN*cos_N;

   if (ix ==1)
   {
      printf("\n\nn\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
      printf ("Maximum Sweep Width: \t\t %f Hz\n", swTilt);
      printf ("Angle_CO:\t%6.2f\n", angle_CO);
      printf ("Angle_Ca:\t%6.2f\n", angle_Ca);
      printf ("Angle_N :\t%6.2f\n", angle_N );
   }

/* Set up hyper complex */

   /* sw1 is used as symbolic index */
   if ( sw1 < 1000 ) { printf ("Please set sw1 to some value larger than 1000.\n"); psg_abort(1); }

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

   if (phase1 == 1)  { ;}                                                  /* CC */
   else if (phase1 == 2)  { tsadd(t5,1,4);}                                /* SC */
   else if (phase1 == 3)  { tsadd(t1,1,4); }                               /* CS */
   else if (phase1 == 4)  { tsadd(t5,1,4); tsadd(t1,1,4); }                /* SS */
   else { printf ("phase1 can only be 1,2,3,4. \n"); psg_abort(1); }

   if (phase2 == 2)  { tsadd(t4,2,4); icosel = 1; }                      /* N  */
            else                       icosel = -1;

   tau1 = 1.0*t1_counter*cos_Ca/swTilt;
   tau2 = 1.0*t1_counter*cos_CO/swTilt;
   tau3 = 1.0*t1_counter*cos_N/swTilt;

   tau1 = tau1/2.0;  tau2 = tau2/2.0;  tau3 = tau3/2.0;


/* CHECK VALIDITY OF PARAMETER RANGES */

    if (bigTN - 0.5*ni*(cos_N/swTilt) + pwS2 < 0.2e-6)
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((bigTN + pwS2)*2.0*swTilt/cos_N)));              psg_abort(1);}


     if (bigTCo - 0.5*ni*(cos_CO/swTilt) - 4.0e-6 - POWER_DELAY < 0.2e-6)
       {
        printf(" ni is too big for CO. Make ni equal to %d or less.\n",
        (int) ((bigTCo -  4.0e-6 - POWER_DELAY) / (0.5*cos_CO/swTilt)) );
        psg_abort(1);
        }


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obsoffset(tof);
   set_c13offset("ca");		/* set Dec1 carrier at Co		      */
   obspower(satpwr);      /* Set transmitter power for 1H presaturation */
   obspwrf(4095.0);
   decpower(pwClvl);       /* Set Dec1 power for hard 13C pulses         */
   decpwrf(4095.0);
   dec2power(pwNlvl);      /* Set Dec2 power for hard 15N pulses         */
   dec2pwrf(4095.0);
   sim3_c13pulse("", "ca", "co", "sinc", "", 0.0, 180.0, 0.0, /* to produce shape  */
                             zero, zero, zero, 2.0e-6, 2.0e-4);
   set_c13offset("co");		/* set Dec1 carrier at Co		      */

/* Presaturation Period */

   if (satmode[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(three);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

   rcvroff();
   shiftedpulse("sinc", pwHs, 90.0, 0.0, three, 2.0e-6, 2.0e-6);
   txphase(zero);


/*   xxxxxxxxxxxxxxxxxxxxxx    1HN to 15N TRANSFER   xxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

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

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

/*   xxxxxxxxxxxxxxxxxxxxxx    15N to 13CO TRANSFER   xxxxxxxxxxxxxxxxxx    */

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

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

   dec2rgpulse(pwN,zero,0.0,0.0);

   delay(kappa - POWER_DELAY - PWRF_DELAY - pwHd - 4.0e-6 - PRG_START_DELAY);
                            /* delays for h1waltzon subtracted */
   h1waltzon("WALTZ16", widthHd, 0.0);
   decphase(zero);
   dec2phase(zero);
   delay(zeta - kappa - WFG3_START_DELAY);

   dec2rgpulse(2*pwN,zero,0.0,0.0);
   c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
   dec2phase(zero);

   delay(zeta - 2.0e-6);

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

   h1waltzoff("WALTZ16", widthHd, 0.0);

   dec2phase(zero); decphase(zero);

   delay(0.2e-6);
/* CHECK Negative gradient */
   zgradpulse(-gzlvl3, gt3);
   delay(gstab);

/* xxxxxxxxxxxxxxxxxxxxx 13CO to 13CA TRANSFER xxxxxxxxxxxxxxxxxxxxxxx  */

   c13pulse("co", "ca", "sinc", 90.0, zero, 2.0e-6, 0.0);

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

  delay(tauc -  gt10 - 0.2e-6 - (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);

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

      delay(tauc -  4.0e-6 - gt10 - 0.2e-6 - (0.5*10.933*pwC));

   c13pulse("co", "ca", "sinc", 90.0, one, 4.0e-6, 0.0);

   set_c13offset("ca");   /* change Dec1 carrier to Ca (55 ppm) */
   delay(0.2e-6);
   zgradpulse(gzlvl9, gt9);
   decphase(t5);
   delay(gstab);

/* xxxxxxxxxxxxxxxxxx 13CA EVOLUTION xxxxxxxxxxxxxxxxxxxxxx */

   h1waltzon("WALTZ16", widthHd, 0.0);
   c13pulse("ca", "co", "square", 90.0, t5, 2.0e-6, 0.0);      /*  pwS1  */

 if (fc180[A]=='n')
  {
   if ((ni>1.0) && (tau1>0.0))
    {
     if (tau1 - 2.0*pwS1/PI - WFG3_START_DELAY - PRG_START_DELAY - 2*POWER_DELAY -
        PRG_STOP_DELAY - 2.0*PWRF_DELAY - 0.5*pwZ > 0.0)
      {
       decpower(cbpwr);
       decphase(zero);
       decprgon(cbdecseq,1/cbdmf,cbres);
       decon();

       delay(tau1 - 2.0*pwS1/PI - WFG3_START_DELAY - PRG_START_DELAY - 2*POWER_DELAY -
        PRG_STOP_DELAY - 2.0*PWRF_DELAY - 0.5*pwZ);
       decoff();
       decprgoff();

       decpower(pwClvl);
       decphase(zero); dec2phase(zero);

       sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 2.0e-6);

       decpower(cbpwr);
       decphase(zero);
       decprgon(cbdecseq,1/cbdmf,cbres);
       decon();

       delay(tau1 - 2.0*pwS1/PI - PRG_START_DELAY - 2*POWER_DELAY -
        PRG_STOP_DELAY - WFG_START_DELAY - 2.0*PWRF_DELAY - 0.5*pwZ);
       decoff();
       decprgoff();
       decpower(pwClvl);

       initval(140.0, v9);
       decstepsize(1.0);
       dcplrphase(v9);

      }
       else
      {
       tsadd(t6,2,4);
       delay(2.0*tau1);
       delay(10.0e-6); 
       sim3_c13pulse("", "ca", "co", "sinc", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 2.0e-6);

       delay(10.0e-6);
      }
    }
     else
    {

       tsadd(t6,2,4);
       delay(10.0e-6);
	    sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 2.0e-6);
       delay(10.0e-6);
    }
  }
   else
  {
   /* for checking sequence */
   c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);
  }

   decphase(t7);
   c13pulse("ca", "co", "square", 90.0, t7, 4.0e-6, 0.0);      /*  pwS1  */
   dcplrphase(zero);
   h1waltzoff("WALTZ16", widthHd, 0.0);
 
   set_c13offset("co");   /* set carrier back to Co */

   delay(0.2e-6);

   zgradpulse(gzlvl12, gt12);
   delay(gstab);


/* xxxxxxxxxxxxxxx  13CA to 13CO TRANSFER and CT 13CO EVOLUTION xxxxxxxxxxxxxxxxx */

   c13pulse("co", "ca", "sinc", 90.0, t1, 2.0e-6, 0.0);

   delay(tau2);
   dec2rgpulse(pwN,one,0.0,0.0);
   dec2rgpulse(2*pwN,zero,0.0,0.0);
   dec2rgpulse(pwN,one,0.0,0.0);

   delay(taud - 4.0*pwN - POWER_DELAY
         - 0.5*(WFG_START_DELAY + pwS3 + WFG_STOP_DELAY));

   c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);
   decphase(t8);

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

      delay(bigTCo - taud
            - 0.5*(WFG_START_DELAY + pwS3 + WFG_STOP_DELAY) );

      c13pulse("co", "ca", "sinc", 180.0, t8, 2.0e-6, 0.0);
      dcplrphase(zero); decphase(one);

    delay(bigTCo - tau2 - POWER_DELAY - 4.0e-6);

   c13pulse("co", "ca", "sinc", 90.0, one, 4.0e-6, 0.0);

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

   h1waltzon("WALTZ16", widthHd, 0.0);

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

   dec2phase(t3);

   delay(bigTN - tau3 + pwS2);


     dec2rgpulse(2*pwN,t3,0.0,0.0);
     c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);

   dec2phase(t4);

   if (tau3 > (kappa + PRG_STOP_DELAY + pwHd + 2.0e-6))
   {
       delay(bigTN - pwS3 - WFG_START_DELAY - 2.0*POWER_DELAY
                                - 2.0*PWRF_DELAY - 2.0e-6);

      c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);

       delay(tau3 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6 - POWER_DELAY
                                         - PWRF_DELAY);
       h1waltzoff("WALTZ16", widthHd, 0.0);
       txphase(zero);

       delay(kappa - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
       zgradpulse(gzlvl5, gt5);        /* 2.0*GRADIENT_DELAY */
       delay(1.0e-4);
   }
   else if (tau3 > (kappa - pwS3 - WFG_START_DELAY - 2.0*POWER_DELAY
                                - 2.0*PWRF_DELAY - 2.0e-6))
   {
      delay(bigTN + tau3 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6
                                 - POWER_DELAY - PWRF_DELAY);
      h1waltzoff("WALTZ16", widthHd, 0.0);
      txphase(zero);

      c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);

      delay(kappa - pwS3 - WFG_START_DELAY - 2.0*POWER_DELAY
            - 2.0*PWRF_DELAY - 2.0e-6 - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
      zgradpulse(gzlvl5, gt5);        /* 2.0*GRADIENT_DELAY */
      delay(1.0e-4);
   }
   else if (tau3 > gt5 + 2.0*GRADIENT_DELAY + 1.0e-4)
   {
      delay(bigTN + tau3 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6
                                 - POWER_DELAY - PWRF_DELAY);
      h1waltzoff("WALTZ16", widthHd, 0.0);
      txphase(zero);
      delay(kappa - tau3 - pwS3 - WFG_START_DELAY - 2.0*POWER_DELAY
                                   - 2.0*PWRF_DELAY - 2.0e-6);

      c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);

      delay(tau3 - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
      zgradpulse(gzlvl5, gt5);        /* 2.0*GRADIENT_DELAY */
      delay(1.0e-4);
   }
   else
   {
      delay(bigTN + tau3 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6
                                 - POWER_DELAY - PWRF_DELAY);
      h1waltzoff("WALTZ16", widthHd, 0.0);
      txphase(zero);
      delay(kappa - tau3 - pwS3 - WFG_START_DELAY - 2.0*POWER_DELAY
            - 2.0*PWRF_DELAY - 2.0e-6 - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
      zgradpulse(gzlvl5, gt5);        /* 2.0*GRADIENT_DELAY */
      delay(1.0e-4);

      c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);
      delay(tau3);
   }

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

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

   dec2phase(zero);
   delay(taub - gt6 - 2.2e-6);

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

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

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

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

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

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

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

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

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

   rgpulse(pw, zero, 0.0, 0.0);
   delay(gt8 + 1.0e-4 + 1.0e-4 - 0.3*pw + 2.0*GRADIENT_DELAY
                                   + POWER_DELAY);

   rgpulse(2*pw,zero,0.0,0.0);
   dec2power(dpwr2);
   decpower(dpwr);
   zgradpulse(icosel*gzlvl8, gt8);
   delay(1.0e-4);
   

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

/* BEGIN ACQUISITION */

statusdelay(C, 1.0e-4);
         setreceiver(t6);
}
Ejemplo n.º 28
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          n15_flg[MAXSTR];


   int    icosel,
          t1_counter,
          t2_counter,
          ni2 = getval("ni2"),
          phase;


   double d2_init=0.0,
          d3_init=0.0,
          pwS1,pwS2,pwS3,pwS4,pwS5,pwS6,
          kappa,
          lambda = getval("lambda"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gzlvl4 = getval("gzlvl4"), 
          gzlvl5 = getval("gzlvl5"), 
          gzlvl6 = getval("gzlvl6"), 
          gt1 = getval("gt1"),
          gt3 = getval("gt3"),
          gt4 = getval("gt4"),
          gt5 = getval("gt5"),
          gt6 = getval("gt6"),
          gstab = getval("gstab"),
          scale = getval("scale"),
          sw1 = getval("sw1"),
          tpwrsf = getval("tpwrsf"),
          shlvl1,
          shpw1 = getval("shpw1"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          dpwr2 = getval("dpwr2"),
          d2 = getval("d2"),
          t2a,t2b,halfT2,
          shbw = getval("shbw"),
          shofs = getval("shofs")-4.77,
          timeTN = getval("timeTN"),
          tau1 = getval("tau1"),
          tau2 = getval("tau2"),
          taunh = getval("taunh");



   getstr("shname1", shname1);
   getstr("n15_flg",n15_flg);



  phase = (int) (getval("phase") + 0.5);
   
   settable(t1,4,phi1);
   settable(t2,4,phi2);
   settable(t3,1,phi3);
   settable(t5,1,phi5);
   settable(t14,4,phi14);
   settable(t15,4,phi15);
   settable(t24,4,phi24);
   settable(t25,4,phi25);


/*   INITIALIZE VARIABLES   */
   kappa = 5.4e-3;
   //shpw1 = pw*8.0;
   shlvl1 = tpwr;
   f1180[0] ='n'; 
   f2180[0] ='n'; 

   pwS1 = c13pulsepw("co", "ca", "sinc", 90.0);
   pwS2 = c13pulsepw("co", "ca", "sinc", 180.0);
   pwS3 = c13pulsepw("ca", "co", "square", 180.0);
   pwS4 = h_shapedpw("eburp2",shbw,shofs,zero, 0.0, 0.0);
   pwS6 = h_shapedpw("reburp",shbw,shofs,zero, 0.0, 0.0);
   pwS5 = h_shapedpw("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);
   if(ix==1) printf("pwS2 %g   pwS3 %g GRADIENT_DELAY %g POWER_DELAY %g PWRF_DELAY %g\n",
   pwS2,pwS3,2*GRADIENT_DELAY,4*POWER_DELAY,4*PWRF_DELAY);



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

if   ( phase2 == 2 )
        {
        tsadd ( t3,2,4  );
        tsadd ( t5,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;


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

/************************************************************/
/* modification for phase-cycling in consecutive experiments*/
/*  for kinetic measurements                                */
/************************************************************/

   if( ix == 1) d2_init = d2;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2)
        { tsadd(t1,2,4); tsadd(t14,2,4); tsadd(t15,2,4);tsadd(t24,2,4); tsadd(t25,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(t14,2,4); tsadd(t15,2,4);tsadd(t24,2,4); tsadd(t25,2,4);  }


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

   if (ni2 > 1)
   {
   halfT2 = 0.5*(ni2-1)/sw2;
   t2b = (double) t2_counter*((halfT2 - timeTN)/((double)(ni2-1)));
   if( ix==1 && halfT2 - timeTN > 0 ) printf("SCT mode on, max ni2=%g\n",timeTN*sw2*2+1);
    if(t2b < 0.0) t2b = 0.0;
   
    t2a = timeTN - tau2*0.5 + t2b;
    if(t2a < 0.2e-6)  t2a = 0.0;
    }
    else
    {
    t2b = 0.0;
    t2a = timeTN - tau2*0.5;
    }



   status(A);
      rcvroff();  

   decpower(pwClvl);
   decoffset(dof);
   dec2power(pwNlvl);
   dec2offset(dof2);
   obspwrf(tpwrsf);
   decpwrf(4095.0);
   obsoffset(tof);
   set_c13offset("co");


      dec2rgpulse(pwN*2.0,zero,0.0,0.0);
     zgradpulse(1.5*gzlvl4, gt4);
       delay(1.0e-4);

lk_sample();
       delay(d1-gt4);
lk_hold();
        h_shapedpulse("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);

        delay(lambda-pwS5*0.5-pwS6*0.5);

        h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, one, zero, zero, 0.0, 0.0);

        delay(lambda-pwS5*0.5-pwS6*0.5);

   if(n15_flg[0]=='y') h_shapedpulse("pc9f_",shbw,shofs,three, 0.0, 0.0);
     else h_shapedpulse("pc9f_",shbw,shofs,one, 0.0, 0.0);


   obspower(shlvl1);
/**************************************************************************/
      dec2rgpulse(pwN,zero,0.0,0.0);

           zgradpulse(gzlvl4, gt4);
           delay(timeTN-pwS2*0.5-gt4);

      sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);

           zgradpulse(gzlvl4, gt4);
           delay(timeTN-pwS2*0.5-gt4);
     dec2rgpulse(pwN,one,0.0,0.0);
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION        xxxxxxxxxxxxxxxxxx    */
   
        obspower(tpwr);
	c13pulse("co", "ca", "sinc", 90.0, t1, 2.0e-6, 0.0);       
        delay(tau1*0.5);
        sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                                                  zero, zero, zero, 2.0e-6, 0.0);
        delay(tau1*0.5);
	c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);      
        sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 0.0,
                                                  one, zero, zero, 2.0e-6, 0.0);
        if  (pwN*2.0 > pwS3) delay(pwN*2.0-pwS3);
	c13pulse("co", "ca", "sinc", 90.0, zero, 2.0e-6, 0.0);       

/**************************************************************************/
     dec2rgpulse(pwN,t2,0.0,0.0);

         delay(tau2*0.5);
         c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);
         // delay(timeTN-pwS3-pwS2-gt1-1.0e-4);
         delay(timeTN-pwS3-pwS2-gt1-1.0e-4-2.0*GRADIENT_DELAY-4*POWER_DELAY-4*PWRF_DELAY-(4/PI)*pwN);
       zgradpulse(-gzlvl1, gt1); 
       delay(1.0e-4);
        c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
        delay (t2b);
        dec2rgpulse (2.0*pwN, zero, 0.0, 0.0);
        delay (t2a);

/**************************************************************************/
        delay(gt1/10.0+1.0e-4);
        h_shapedpulse("eburp2_",shbw,shofs,t3, 2.0e-6, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.5-pwS4*scale- gt5);

        h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.5-pwS4*scale- gt5);

        h_shapedpulse("eburp2",shbw,shofs,zero, 0.0, 0.0);
        delay(gt1/10.0+1.0e-4);

     dec2rgpulse(pwN,one,0.0,0.0);
        zgradpulse(gzlvl6, gt6);

        txphase(zero);
        delay(lambda-pwS6*0.5-gt6);

        h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);
        zgradpulse(gzlvl6, gt6);

        delay(lambda-pwS6*0.5-gt6);
     dec2rgpulse(pwN,t5,0.0,0.0);
/**************************************************************************/

        zgradpulse(-icosel*gzlvl2, gt1/10.0);
        dec2power(dpwr2);                                      /* POWER_DELAY */
lk_sample();
 if (n15_flg[0] =='y')
{
   if (phase2==1) setreceiver(t14);
   else setreceiver(t15);
}
else
{
   if (phase2==1) setreceiver(t24);
   else setreceiver(t25);
}

      rcvron();
statusdelay(C,1.0e-4 );

}		 
Ejemplo n.º 29
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          n15_flg[MAXSTR],
          CT_flg[MAXSTR];


   int    icosel,
          t1_counter,
          t2_counter,
          ni2 = getval("ni2"),
          phase;


   double d2_init=0.0,
          d3_init=0.0,
          pwS1,pwS2,pwS3,pwS4,pwS5,pwS6,
          kappa,
          lambda = getval("lambda"),
          CTdelay = getval("CTdelay"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl4 = getval("gzlvl4"), 
          gzlvl5 = getval("gzlvl5"), 
          gzlvl6 = getval("gzlvl6"), 
          gt1 = getval("gt1"),
          gt4 = getval("gt4"),
          gt5 = getval("gt5"),
          gt6 = getval("gt6"),
          gstab = getval("gstab"),
          scale = getval("scale"),
          sw1 = getval("sw1"),
          tpwrsf = getval("tpwrsf"),
          shlvl1,
          shpw1 = getval("shpw1"),
          pwC = getval("pwC"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          dpwr2 = getval("dpwr2"),
          d2 = getval("d2"),
          t2a,t2b,halfT2,
          t1a,t1b,halfT1,
          shbw = getval("shbw"),
          shofs = getval("shofs")-4.77,
          timeTN = getval("timeTN"),
          timeTN1 = getval("timeTN1"),
          timeCN = getval("timeCN"),
          tauC = getval("tauC"),
          tauCC = getval("tauCC"),
          tau1 = getval("tau1"),
          tau2 = getval("tau2"),
          taunh = getval("taunh");



   getstr("shname1", shname1);
   getstr("f1180",f1180);
   getstr("f2180",f2180);
   getstr("n15_flg",n15_flg);
   getstr("CT_flg",CT_flg);



  phase = (int) (getval("phase") + 0.5);
   
   settable(t1,2,phi1);
   settable(t2,4,phi2);
   settable(t3,1,phi3);
   settable(t4,8,phi4);
   settable(t5,1,phi5);
   settable(t14,8,phi14);
   settable(t24,8,phi24);


/*   INITIALIZE VARIABLES   */
   kappa = 5.4e-3;
   //shpw1 = pw*8.0;
   shlvl1 = tpwr;
   f1180[0] ='n'; 
   f2180[0] ='n'; 

   pwS1 = c13pulsepw("co", "ca", "sinc", 90.0);
   pwS2 = c13pulsepw("co", "ca", "sinc", 180.0);
   pwS3 = c13pulsepw("ca", "co", "square", 180.0);
   pwS4 = h_shapedpw("eburp2",shbw,shofs,zero, 0.0, 0.0);
   pwS6 = h_shapedpw("reburp",shbw,shofs,zero, 0.0, 0.0);
   pwS5 = h_shapedpw("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);



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

if   ( phase2 == 2 )
        {
        tsadd ( t3,2,4  );
        tsadd ( t5,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;


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

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

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

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


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

   if (ni2 > 1)
   {
   halfT2 = 0.5*(ni2-1)/sw2;
   t2b = (double) t2_counter*((halfT2 - timeTN)/((double)(ni2-1)));
   if( ix==1 && halfT2 - timeTN > 0 ) printf("SCT mode on, max ni2=%g\n",timeTN*sw2*2+1);
    if(t2b < 0.0) t2b = 0.0;
    
    t2a = timeTN - tau2*0.5 + t2b;
    if(t2a < 0.2e-6)  t2a = 0.0;
    }
    else
    {
    t2b = 0.0;
    t2a = timeTN - tau2*0.5;
    }

/************************************************************/
   if (ni > 1)
   {
   halfT1 = 0.5*(ni-1)/sw1;
   t1b = (double) t1_counter*((halfT1 - timeTN1)/((double)(ni-1)));
    if(t1b < 0.0) t1b = 0.0;
    t1a = timeTN1 - tau1*0.5 + t1b;
    if(t1a < 0.2e-6)  t1a = 0.0;
    }
    else
    {
    t1b = 0.0;
    t1a = timeTN1 - tau1*0.5;
    }
/************************************************************/


   status(A);
      rcvroff();  

   decpower(pwClvl);
   decoffset(dof);
   dec2power(pwNlvl);
   dec2offset(dof2);
   obspwrf(tpwrsf);
   decpwrf(4095.0);
   obsoffset(tof);
   set_c13offset("co");


      dec2rgpulse(pwN*2.0,zero,0.0,0.0);
     zgradpulse(1.7*gzlvl4, gt4);
       delay(1.0e-4);

lk_sample();
       delay(d1-gt4);
lk_hold();
        h_shapedpulse("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);

        delay(lambda-pwS5*0.5-pwS6*0.5);

        h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, one, zero, zero, 0.0, 0.0);

        delay(lambda-pwS5*0.5-pwS6*0.5);

   if(n15_flg[0]=='y') h_shapedpulse("pc9f_",shbw,shofs,three, 0.0, 0.0);
     else h_shapedpulse("pc9f_",shbw,shofs,one, 0.0, 0.0);

         shaped_pulse(shname1,shpw1,zero,0.0,0.0);

           zgradpulse(2.3*gzlvl4, gt4);
           delay(1.0e-4);
/**************************************************************************/
/***         N -> CO transfer             *********************************/
/**************************************************************************/
      dec2rgpulse(pwN,t1,0.0,0.0);

           delay(tau1*0.5);
         c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);
         delay(taunh-pwS3);
         shaped_pulse(shname1,shpw1,two,0.0,0.0);
         delay(timeTN1-pwS2-taunh-shpw1);
        c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
        delay (t1b);
        dec2rgpulse (2.0*pwN, zero, 0.0, 0.0);
        delay (t1a);

     dec2rgpulse(pwN,zero,0.0,0.0);
/**************************************************************************/
/***        CO -> CA transfer             *********************************/
/**************************************************************************/
        c13pulse("co", "ca", "sinc", 90.0, t2, 2.0e-6, 0.0);

        zgradpulse(-gzlvl4, gt4);
        decphase(zero);
        delay(tauC - gt4 - 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(-gzlvl4, gt4);
        decphase(one);
        delay(tauC - gt4 - 0.5*10.933*pwC - WFG_START_DELAY - 2.0e-6);
        c13pulse("co", "ca", "sinc", 90.0, one, 0.0, 0.0);
/**************************************************************************/
/***        CA -> N transfer             *********************************/
/**************************************************************************/
        set_c13offset("ca");

        c13pulse("ca", "co", "square", 90.0, zero, 2.0e-6, 0.0);
        delay(tauC);
        c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
        delay(timeCN-tauC);
   sim3_c13pulse("", "cab", "co", "square", "", 0.0, 180.0, 2.0*pwN, zero, zero, zero, 2.0e-6, 2.0e-6);
        delay(timeCN);
        c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
        c13pulse("ca", "co", "square", 90.0, one, 2.0e-6, 0.0);


/**************************************************************************/
/***        N -> CA back transfer         *********************************/
/**************************************************************************/
     dec2rgpulse(pwN,t4,0.0,0.0);

           delay(tau2*0.5);
         c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
         //delay(timeTN-pwS3-pwS2-gt1-1.0e-4);
       
        delay(timeTN-pwS3-pwS2-gt1-1.0e-4-2.0*GRADIENT_DELAY-4*POWER_DELAY-4*PWRF_DELAY-(4/PI)*pwN);
         zgradpulse(-gzlvl1, gt1); 
       delay(1.0e-4);
        c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);
        delay (t2b);
        dec2rgpulse (2.0*pwN, zero, 0.0, 0.0);
        delay (t2a);

/**************************************************************************/
        delay(gt1/10.0+1.0e-4);
        h_shapedpulse("eburp2_",shbw,shofs,t3, 2.0e-6, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.5-pwS4*scale- gt5);

        h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);

        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.5-pwS4*scale- gt5);

        h_shapedpulse("eburp2",shbw,shofs,zero, 0.0, 0.0);
        delay(gt1/10.0+1.0e-4);

     dec2rgpulse(pwN,one,0.0,0.0);
        zgradpulse(gzlvl6, gt6);

        txphase(zero);
        delay(lambda-pwS6*0.5-gt6);

        h_sim3shapedpulse("reburp",shbw,shofs,0.0,2.0*pwN, zero, zero, zero, 0.0, 0.0);
        zgradpulse(gzlvl6, gt6);

        delay(lambda-pwS6*0.5-gt6);
     dec2rgpulse(pwN,t5,0.0,0.0);
/**************************************************************************/

        zgradpulse(-icosel*gzlvl2, gt1/10.0);
        dec2power(dpwr2);                                      /* POWER_DELAY */
lk_sample();
 if (n15_flg[0] =='y')
{
   setreceiver(t14);
}
else
{
   setreceiver(t24);
}

      rcvron();
statusdelay(C,1.0e-4 );

}		 
Ejemplo n.º 30
0
pulsesequence()
{
  int       phase, t1_counter;

  char	    C13refoc[MAXSTR],		/* C13 sech/tanh pulse in middle of t1 */
            TROSY[MAXSTR],
            wtg3919[MAXSTR];
  double    tauxh, tau1,  gt2, gt1, 
            gztm, mix,  pw180, pw135, pw120, pw110, p1lvl, 
            gzlvl1,  cycles,  
            pwNt = 0.0,               /* pulse only active in the TROSY option */
            gsign = 1.0,
            gzlvl3=getval("gzlvl3"),
            gt3=getval("gt3"),
            JNH = getval("JNH"),
            pwN = getval("pwN"),
            pwNlvl = getval("pwNlvl"),  
            pwHs, tpwrs=0.0,           /* H1 90 degree pulse length at tpwrs */               
            compH = getval("compH"),
            sw1 = getval("sw1"),
            pwClvl = getval("pwClvl"), 	         /* coarse power for C13 pulse */
            pwC = getval("pwC"),       /* C13 90 degree pulse length at pwClvl */
            rfst = 4095.0,	            /* fine power for the stCall pulse */
                   /* temporary Pbox parameters */
            bw, pws, ofs, ppm, nst,  /* bandwidth, pulsewidth, offset, ppm, # steps */
            compC = getval("compC");   /* adjustment for C13 amplifier compr-n */

   gztm=getval("gztm");
   gt2=getval("gt2");
   gt1= getval("gt1");
   mix=getval("mix");
   phase = (int) (getval("phase") + 0.5);
   sw1 = getval("sw1");
   pw180 = getval("pw180");
   gzlvl1 = getval("gzlvl1");



/* INITIALIZE VARIABLES */

        pw135 = pw180 / 180.0 * 135.0 ;
        pw120 = pw180 / 180.0 * 120.0 ;
        pw110 = pw180 / 180.0 * 110.0 ;

        p1lvl = tpwr -20*log10(pw180/(compH*2.0*pw));
        p1lvl = (int)(p1lvl + 0.5);
         cycles = mix / (730.0/180.0 * pw180) - 8.0;

         initval(cycles, v10);        /* mixing time cycles */


    getstr("C13refoc",C13refoc);
    getstr("TROSY",TROSY);
    getstr("wtg3919",wtg3919);
    
    tauxh = ((JNH != 0.0) ? 1/(4*(JNH)) : 2.25e-3);

    setautocal();                        /* activate auto-calibration flags */ 
        
    if (autocal[0] == 'n') 
    {
      if (C13refoc[A]=='y') 
      {
        /* 180 degree adiabatic C13 pulse from 0 to 200 ppm */
        rfst = (compC*4095.0*pwC*4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)); 
        rfst = (int) (rfst + 0.5);
        if ( 1.0/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)) < pwC )
           { text_error( " Not enough C13 RF. pwC must be %f usec or less.\n", 
	     (1.0e6/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35))) ); psg_abort(1); }
      }
    }
    else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
    {
      if(FIRST_FID)                                            /* call Pbox */
      {
        if (C13refoc[A]=='y') 
        {
          ppm = getval("dfrq"); ofs = 0.0;   pws = 0.001;  /* 1 ms long pulse */
          bw = 200.0*ppm;       nst = 1000;          /* nst - number of steps */
          stC200 = pbox_makeA("stC200A", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
          C13ofs = 100.0;
        }
        ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
      }
      rfst = stC200.pwrf;
    }

                               /* selective H20 one-lobe sinc pulse needs 1.69  */
     pwHs = getval("pwHs");            /* times more power than a square pulse */
     if (pwHs > 1e-6) tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));  
     else tpwrs = 0.0;
     tpwrs = (int) (tpwrs); 

/* check validity of parameter range */

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

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

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

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

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

/* LOAD VARIABLES */

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

/* LOAD PHASE TABLES */

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

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

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

/* slective excitation of water */

     rgpulse(pw, zero, rof1, rof1);
     

     zgradpulse(gzlvl1,gt1);

     obspower(tpwrs+6);  /* make it a 180 inversion pulse */
     shaped_pulse("H2Osinc", pwHs, zero, rof1, 0.0);
     obspower(tpwr);

     zgradpulse(gzlvl1,gt1);

/*  CLEANEX-PM spin-lock   */

      if (cycles > 1.5000)
      {

       obspower(p1lvl);
       txphase(zero);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/2.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);


            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0*3.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm);

         starthardloop(v10);
            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);
         endhardloop();

       rgradient('z',gztm/4.0*3.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/2.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z', 0.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);


       obspower(tpwr);

      }


/* .......................................  */

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

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

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

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

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

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

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

   status(C);
     setreceiver(t5);   
}