Esempio n. 1
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        f2180[MAXSTR],   		      /* Flag to start t2 @ halfdwell */
            fil_flg1[MAXSTR],
            had_flg[MAXSTR],
            shname1[MAXSTR],
	    shname2[MAXSTR],
	    ala_flg[MAXSTR],	    
            ser_flg[MAXSTR],
	    SE_flg[MAXSTR],			    /* SE_flg */
  	    TROSY[MAXSTR];			    /* do TROSY on N15 and H1 */

int         t2_counter,  		        /* used for states tppi in t2 */
	    ni2 = getval("ni2");

double      d3_init=0.0,  		        /* used for states tppi in t2 */
            stCwidth = 80.0,
	    shpw1,shpw2,         				         /*  t1 delay */
	    tauCH = getval("tauCH"), 		         /* 1/4J delay for CH */
	    tauC1 = getval("tauC1"),
	    tauC2 = getval("tauC2"),
	    tauC3 = getval("tauC3"),
            had2,had3,
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    eta = 4.6e-3,
	    theta = 14.0e-3,
            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */

   pwS1, pwS2,	pwS3,	pwS4, pwS5,pwS6,pwS7,
   phi7cal = getval("phi7cal"),  /* phase in degrees of the last C13 90 pulse */

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

	sw2 = getval("sw2"),

	gt3 = getval("gt3"),
	gt5 = getval("gt5"),
	gstab = getval("gstab"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl5 = getval("gzlvl5"),
	flip_angle=120.0,had1=0.0,
	epsilon = getval("epsilon");
    fil_flg1[0]='n'; 
    ser_flg[0]='n';   /*initialize*/

    getstr("f2180",f2180);
    getstr("had_flg",had_flg);
    getstr("shname1",shname1);
    getstr("shname2",shname2);    
    getstr("TROSY",TROSY);
    getstr("SE_flg",SE_flg);


/*   LOAD PHASE TABLE    */

	settable(t1,4,phi1);
	settable(t3,4,phi3);
	settable(t4,1,phx);
	settable(t5,2,phi5);
	settable(t6,2,phi6);
        settable(t8,1,phx);
	settable(t9,8,phi9);
	settable(t10,1,phx);
	settable(t11,1,phy);

	settable(t12,8,phi12);
	settable(t13,8,rec2);




/*   INITIALIZE VARIABLES   */

        shpw1 = pw*8.0;
        shpw2 = pwC*8.0;
 	kappa = 5.4e-3;
	lambda = 2.4e-3;
        had2=0.5/135.0;
        had3=0.5/135.0;

        ala_flg[0]='n';

        if (had_flg[0] == '1')
          { fil_flg1[0]='n';ser_flg[0]='n';flip_angle=120.0;had1=0.0;} 
        if (had_flg[0] == '2')
          { fil_flg1[0]='y';ser_flg[0]='n';flip_angle=120.0;had1=0.0;} 
        if (had_flg[0] == '3')
          { fil_flg1[0]='n';ser_flg[0]='y';flip_angle=120.0;had1=0.0;} 
        if (had_flg[0] == '4')
          { fil_flg1[0]='y';ser_flg[0]='y';flip_angle=120.0;had1=0.0;} 
        if (had_flg[0] == '5')
          { fil_flg1[0]='n';ser_flg[0]='n';flip_angle=60.0;had1=0.5/140.0;} 
        if (had_flg[0] == '6')
          { fil_flg1[0]='y';ser_flg[0]='n';flip_angle=60.0;had1=0.5/140.0;} 
        if (had_flg[0] == '7')
          { fil_flg1[0]='n';ser_flg[0]='y';flip_angle=60.0;had1=0.5/140.0;} 
        if (had_flg[0] == '8')
          { fil_flg1[0]='y';ser_flg[0]='y';flip_angle=60.0;had1=0.5/140.0;} 
	


    if( pwC > 20.0*600.0/sfrq )
	{ printf("increase pwClvl so that pwC < 20*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); 
	pwS3 = c13pulsepw("co", "ca", "sinc", 180.0); 
        pwS4 = c_shapedpw("isnob5",80.0,0.0,zero, 2.0e-6, 2.0e-6);

        pwS6 = c_shapedpw("reburp",80.0,0.0,zero, 2.0e-6, 2.0e-6); /* attention, y a aussi des 180 CaCb après les filtres*/

        pwS7 = c_shapedpw(shname2,80.0,150.0,zero, 2.0e-6, 2.0e-6);
        pwS5 = c_shapedpw("isnob5",30.0,0.0,zero, 2.0e-6, 2.0e-6);

/* 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 > 46 )
       { printf("dpwr2 too large! recheck value  ");		     psg_abort(1);}

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



/* PHASES AND INCREMENTED TIMES */

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

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



/*  Set up f2180  */

    tau2 = d3;    /* run 2D exp for NH correlation, but must use tau2 instead of tau1
                     because bionmr.h is written for nh_evol* to do tau2 evolution*/

    if((f2180[A] == 'y') && (ni2 > 1.0))  /* use f2180 to control tau2 */
	{ 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)*sw1 + 0.5 );
   if(t2_counter % 2)
        { tsadd(t8,2,4); tsadd(t12,2,4);  tsadd(t13,2,4);  }




/* BEGIN PULSE SEQUENCE */

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

	rcvroff();
        set_c13offset("cab");
	obsoffset(tof);
	obspower(tpwr);
 	obspwrf(4095.0);
	decpower(pwClvl);
	decpwrf(4095.0);
 	dec2power(pwNlvl);
	txphase(one);
	delay(1.0e-5);
        if (TROSY[A] == 'n')
	dec2rgpulse(pwN, zero, 0.0, 0.0);  /*destroy N15 and C13 magnetization*/
	decrgpulse(pwC, zero, 0.0, 0.0);
	zgradpulse(gzlvl0, 0.5e-3);
	delay(gstab);
      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(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, 2.0e-6, 0.0);
        zgradpulse(gzlvl5, gt5);
        delay(tauCH - gt5 - WFG2_START_DELAY - 0.5e-3 + 68.0e-6 );

        sim_c13adiab_inv_pulse("", "aliph", stCwidth, "sech1", 2.0*pw, 1.0e-3,
                                                  zero, zero, 2.0e-6, 2.0e-6);

        zgradpulse(gzlvl5, gt5);
        delay(tauCH - gt5 - 0.5e-3 + 68.0e-6);
        rgpulse(pw, one, 0.0, 0.0);

      if (ser_flg[0] == 'n' )
         delay(pwS5);
      if (ser_flg[0] == 'y' )
        c_shapedpulse("isnob5",30.0,24.0,zero, 2.0e-6, 2.0e-6);  

/*********************************** transfer  CB->CA + DEPT CBH **************/
	zgradpulse(gzlvl3, gt3*1.2);
	delay(gstab);

        decrgpulse(pwC, t3, 0.0, 0.0);

        rgpulse(pw, three, 0.0, 0.0);
      if (flip_angle > 90.0) delay(pw*(flip_angle/90.0-1));

      if (fil_flg1[0] == 'y') 
        {
         /* JCOCA & JCOCB is turned on*/
          zgradpulse(gzlvl3, gt3);
	  delay(had2*0.5-pwS4*0.5-pwS7-gt3);
          c_simshapedpulse(shname2,80.0,150.0,0.0,0.0,zero,zero,zero, 2.0e-6, 2.0e-6);	
          c_simshapedpulse("isnob5",80.0,0.0,pw*2.0,0.0,zero,zero,zero, 2.0e-6, 2.0e-6);
          zgradpulse(gzlvl3, gt3);        
          delay(had2*0.5-pwS4*0.5-gt3);
          rgpulse(pw*flip_angle/90.0, t1, 0.0, 0.0);
	if (flip_angle < 90.0) delay(pw*(1-flip_angle/90.0));
          zgradpulse(gzlvl3, 1.1*gt3);		
          delay(had3*0.5-shpw1*0.5-1.1*gt3);		
          shaped_pulse(shname1,shpw1,two,0.0,0.0);
          delay((tauC3-(had2+pw*120/90*2))*0.5-pwS4*0.5-had3*0.5-shpw1*0.5-pwS7);
          c_simshapedpulse(shname2,80.0,150.0,0.0,0.0,zero,zero,zero, 2.0e-6, 2.0e-6);			
          c_shapedpulse("isnob5",80.0,0.0,two, 2.0e-6, 2.0e-6);  
          zgradpulse(gzlvl3, 1.1*gt3);	
          delay((tauC3-(had2+pw*120/90*2))*0.5-pwS4*0.5-1.1*gt3);
       }

     if (fil_flg1[0] == 'n') 
       {
         /* JCOCA & JCOCB is turned off*/
          zgradpulse(gzlvl3, gt3);
          delay(epsilon/4.0-pwS7*0.5-gt3);
	  c_simshapedpulse(shname2,80.0,150.0,0.0,0.0,zero,zero,zero, 2.0e-6, 2.0e-6);	
          delay(had2*0.5-pwS4*0.5-epsilon/4.0-pwS7*0.5);
          c_simshapedpulse("isnob5",80.0,0.0,pw*2.0,0.0,zero,zero,zero, 2.0e-6, 2.0e-6);
          zgradpulse(gzlvl3, gt3);
          delay(had2*0.5-pwS4*0.5-gt3);
          rgpulse(pw*flip_angle/90.0, t1, 0.0, 0.0);
	if (flip_angle < 90.0) delay(pw*(1-flip_angle/90.0));
        if (had3*0.5-shpw1*0.5-epsilon/4.0-pwS7*0.5>0.0)		
          {
            zgradpulse(gzlvl3, 1.1*gt3);		
	    delay(epsilon/4.0-pwS7*0.5-1.1*gt3);
	    c_simshapedpulse(shname2,80.0,150.0,0.0,0.0,zero,zero,zero, 2.0e-6, 2.0e-6);		
	    delay(had3*0.5-shpw1*0.5-epsilon/4.0-pwS7*0.5);		
	    shaped_pulse(shname1,shpw1,two,0.0,0.0);
	    delay((tauC3-(had2+pw*120/90*2))*0.5-pwS4*0.5-had3*0.5-shpw1*0.5);
          }
        else 
          {
            zgradpulse(gzlvl3, 1.1*gt3);		
	    delay(had3*0.5-shpw1*0.5-1.1*gt3);		
	    shaped_pulse(shname1,shpw1,two,0.0,0.0);
	    delay(epsilon/4.0-pwS7*0.5-had3*0.5-shpw1*0.5);
	    c_simshapedpulse(shname2,80.0,150.0,0.0,0.0,zero,zero,zero, 2.0e-6, 2.0e-6);		
	    delay((tauC3-(had2+pw*120/90*2))*0.5-pwS4*0.5-epsilon/4.0-pwS7*0.5);
          }
	
	  c_shapedpulse("isnob5",80.0,0.0,two, 2.0e-6, 2.0e-6);  
          zgradpulse(gzlvl3, 1.1*gt3);		
	  delay((tauC3-(had2+pw*120/90*2))*0.5-pwS4*0.5-1.1*gt3);
       }

     if (fil_flg1[0] == 'c') 
       {
        /* JCOCA & JCOCB is turned off*/
          zgradpulse(gzlvl3, gt3);
	  delay(had2*0.5-pwS4*0.5-gt3);
	  c_simshapedpulse("isnob5",80.0,0.0,pw*2.0,0.0,zero,zero,zero, 2.0e-6, 2.0e-6);
          zgradpulse(gzlvl3, gt3);
	  delay(had2*0.5-pwS4*0.5-gt3);
          rgpulse(pw*flip_angle/90.0, t1, 0.0, 0.0);
	if (flip_angle < 90.0) delay(pw*(1-flip_angle/90.0));
          zgradpulse(gzlvl3, 1.1*gt3);
	  delay(had3*0.5-shpw1*0.5-1.1*gt3);		
	  shaped_pulse(shname1,shpw1,two,0.0,0.0);
	  delay((tauC3-(had2+pw*120.0/90.0*2.0))*0.5-pwS4*0.5-had3*0.5-shpw1*0.5);
	  c_shapedpulse("isnob5",80.0,0.0,two, 2.0e-6, 2.0e-6);  
          zgradpulse(gzlvl3, 1.1*gt3);
       	  delay((tauC3-(had2+pw*120.0/90.0*2.0))*0.5-pwS4*0.5-1.1*gt3);
       }

/*********************************** 2nd transfer  CB->CA +DEPT CAH ***********/
          decrgpulse(pwC, zero, 0.0, 0.0);
	  c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);  
          delay(tauC1-pwS3-pwS4*0.5);
          c_shapedpulse("reburp",80.0,0.0,zero, 2.0e-6, 2.0e-6);  
          delay(tauC1-tauC2-pwS3-pwS4*0.5);
	  c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);  
          delay(tauC2-pw*8.0-had1);
          shaped_pulse(shname1,shpw1,two,0.0,0.0);
          delay(had1);
	  c13pulse("cab", "co", "square", 90.0, zero, 0.0, 0.0);  
/******************************************************************************/
        if(dm3[B] == 'y')		         /*optional 2H decoupling off */
           {dec3rgpulse(1/dmf3, three, 0.0, 0.0); dec3blank();
            setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3); dec3blank();}
  	  zgradpulse(gzlvl3, gt3);
	  delay(2.0e-4);
	  h1decon("DIPSI2", 27.0, 0.0);/*POWER_DELAY+PWRF_DELAY+PRG_START_DELAY */
	  c13pulse("co", "ca", "sinc", 90.0, t5, 2.0e-6, 0.0);          /* point e */
 	  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);
      if (SE_flg[0]=='y')                                               /* point f */
	{
 	  nh_evol_se_train("co", "ca"); /* common part of sequence in bionmr.h  */
          if (dm3[B]=='y') lk_sample();
	}
	else
	{
	  nh_evol_train("co", "ca"); /* common part of sequence in bionmr.h  */
          if (dm3[B]=='y') lk_sample();
	}
}		 
Esempio n. 2
0
void 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 );

}		 
pulsesequence()
{
/* DECLARE VARIABLES */

 char       satmode[MAXSTR],
	    fscuba[MAXSTR],
            fc180[MAXSTR],    /* Flag for checking sequence              */
            ddseq[MAXSTR],    /* 2H decoupling seqfile */
            fCTCa[MAXSTR],    /* Flag for CT or non_CT on Ca dimension */
            sel_flg[MAXSTR],
	    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 */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
	     sphase,       /* small angle phase shift */
	     sphase1,
	     sphase2,      /* used only for constant t2 period */
             pwS4,         /* selective CO 180 */
             pwS3,         /* selective Ca 180 */
             pwS1,         /* selecive Ca 90 */
             pwS2,         /* selective CO 90 */
	     cbpwr,        /* power level for selective CB decoupling */
	     cbdmf,        /* pulse width for selective CB decoupling */
             cbres,        /* decoupling resolution of CB decoupling */

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

             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);
  getstr("ddseq",ddseq);
  getstr("fCTCa",fCTCa);

  getstr("sel_flg",sel_flg);

  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");
  dpwr = getval("dpwr");
  dpwr3 = getval("dpwr3");
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  sphase = getval("sphase");
  sphase1 = getval("sphase1");
  sphase2 = getval("sphase2");

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

   pwS1=c13pulsepw("ca", "co", "square", 90.0);
   pwS2=c13pulsepw("co", "ca", "sinc", 90.0);
   pwS3=c13pulsepw("ca", "co", "square", 180.0);
   pwS4=c13pulsepw("co", "ca", "sinc", 180.0);

   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((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( 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( 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 ("Anlge_CO:\t%6.2f\n", angle_CO);
      printf ("Anlge_Ca:\t%6.2f\n", angle_Ca);
      printf ("Anlge_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) + pwS4 < 0.2e-6)
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((bigTN + pwS4)*2.0*swTilt/cos_N)));              psg_abort(1);}

    if ((fCTCa[A]=='y') && (bigTCa - 0.5*ni*(cos_Ca/swTilt) - WFG_STOP_DELAY 
             - POWER_DELAY - gt11 - 50.2e-6 < 0.2e-6))
       {
         printf(" ni is too big for Ca. Make ni equal to %d or less.\n",
            (int) ((bigTCa -WFG_STOP_DELAY
              - POWER_DELAY - gt11 - 50.2e-6)/(0.5*cos_Ca/swTilt)) );
         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);
   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 15N hard pulses         */
   dec2pwrf(4095.0);
   set_c13offset("ca");		/* set Dec1 carrier at Ca		      */
   sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 0.0,
                             zero, zero, zero, 2.0e-6, 0.0);
   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(one);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

   rcvroff();
   lk_hold();

   shiftedpulse("sinc", pwHs, 90.0, 0.0, one, 2.0e-6, 0.0);
   txphase(zero);
   delay(2.0e-6);


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

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

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

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

   dec2rgpulse(pwN,zero,0.0,0.0);

   delay( zeta + pwS4 );

   dec2rgpulse(2*pwN,zero,0.0,0.0);
   c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
   dec2phase(one);

   delay(zeta - 2.0e-6);

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

  }

   else {

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

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


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

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

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

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

   delay( zeta - 1.34e-3 - 2.0*pw + pwS4 );

   dec2rgpulse(2*pwN,zero,0.0,0.0);
   c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
   dec2phase(one);

   delay(zeta - 2.0e-6);

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

  }

   dec2phase(zero); decphase(zero);

   delay(0.2e-6);
   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(100.0e-6);

  delay(tauc - POWER_DELAY - gt10 - 100.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(100.0e-6);

      delay(tauc - POWER_DELAY - 4.0e-6 - gt10 - 100.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);
   delay(gstab);

/* xxxxxxxxxxxxxxxxxx 13CA EVOLUTION xxxxxxxxxxxxxxxxxxxxxx */
                /* Turn on D decoupling using the third decoupler */
                dec3unblank(); dec3rgpulse(1/dmf3, one, 0.0, 0.0);
                dec3unblank(); setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
                /* Turn on D decoupling */

   c13pulse("ca", "co", "square", 90.0, t5, 2.0e-6, 0.0);

if (fCTCa[A]=='y')  
{
/* Constant t2 */
   decpower(cbpwr);
   decphase(zero);
   decprgon(cbdecseq,1/cbdmf,cbres);
   decon();
	   
   delay(tau1);

   decoff();
   decprgoff();
   decpower(pwClvl);

   dec2rgpulse(pwN,one,0.0,0.0);
   dec2rgpulse(2*pwN,zero,0.0,0.0);
   dec2rgpulse(pwN,one,0.0,0.0);
   c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);

   decpower(cbpwr);
   decphase(zero);
   decprgon(cbdecseq,1/cbdmf,cbres);
   decon();

   delay(bigTCa - 4.0*pwN - WFG_START_DELAY - pwS4
         - WFG_STOP_DELAY - POWER_DELAY - WFG_START_DELAY - gt11 - gstab -0.2e-6);

   decoff();
   decprgoff();
   decpower(pwClvl);

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

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

   c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);

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

   decpower(cbpwr);
   decphase(zero);
   decprgon(cbdecseq,1/cbdmf,cbres);
   decon();

   delay(bigTCa - tau1 - WFG_STOP_DELAY - POWER_DELAY - gt11 - gstab -0.2e-6);

   decoff();
   decprgoff();
}

/* non_constant t2 */
else
{
  if (fc180[A]=='n')
   {
    if ((ni>1.0) && (tau1>0.0))
    {
    if (tau1 - 2.0*pwS1/PI - PRG_START_DELAY - 2*POWER_DELAY -
        PRG_STOP_DELAY - pwN > 0.0)
     {
   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 - pwN);
   decoff();
   decprgoff();

   decphase(zero); dec2phase(zero);
   decpower(pwClvl);

   sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 0.0, 0.0);

   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 - pwN);
   decoff();
   decprgoff();

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

     }
    else
     {
       tsadd(t6,2,4);
       delay(2.0*tau1);
       delay(10.0e-6); 
       sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 0.0);
       delay(10.0e-6);
     }
   }
   else
   {

       tsadd(t6,2,4);
       delay(10.0e-6);
       sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 0.0);
       delay(10.0e-6);
   }
 }
   else
  {
   /* for checking sequence */
   c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);
  }
}

   decpower(pwClvl);
   decphase(t7);
   c13pulse("ca", "co", "square", 90.0, t7, 4.0e-6, 0.0);
   dcplrphase(zero);
 
                /* Turn off D decoupling */
                dec3rgpulse(1/dmf3, three, 0.0, 0.0); dec3blank();
                setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3); dec3blank();
                /* Turn off D decoupling */
 

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

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

   dec2phase(t3);

   delay(bigTN - tau3 + pwS4);

     dec2rgpulse(2*pwN,t3,0.0,0.0);
     c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);

   txphase(zero);
   dec2phase(t4);

  delay(bigTN - gt5 - gstab -0.2e-6 - 2.0*GRADIENT_DELAY
	- 4.0e-6 - WFG_START_DELAY - pwS3 - WFG_STOP_DELAY);

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

      c13pulse("ca", "co", "square", 180.0, zero, 4.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*pw,0.0,2*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*pw,0.0,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.0,pwN,zero,zero,zero,0.0,0.0);

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

   delay(BigT1 - gt8/2.0 - 50.2e-6 - 0.5*(pwN - pw) - 2.0*pw/PI);

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

   delay(0.2e-6);
   zgradpulse(gzlvl8, gt8/2.0);
   delay(50.0e-6);
   
   dec2power(dpwr2);
   decpower(dpwr);
   
   delay(BigT1 - gt8/2.0 - 50.2e-6 - 2.0*POWER_DELAY);

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

/* BEGIN ACQUISITION */

status(C);
         setreceiver(t6);

}
Esempio n. 4
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 */
            stCshape[MAXSTR],
 	    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 */
	    tauCH = getval("tauCH"), 		         /* 1/4J delay for CH */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
            timeNCA = getval("timeNCA"),
            timeC = getval("timeC"),      /* other delays */
            tauCC = getval("tauCC"),
	    zeta = getval("zeta"),

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

   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 */
   phshift = getval("phshift"),        /*  phase shift induced on CO by 180 on CA in middle of t1 */

	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(t1,2,phi1);
	settable(t2,4,phi2);
        settable(t4,1,phx);
   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,16,phi9);
	settable(t10,1,phx);
	settable(t11,1,phy);
	settable(t12,8,rec);}

        

/*   INITIALIZE VARIABLES   */

 	kappa = 5.4e-3;
	lambda = 2.4e-3;

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

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



/* 30 ppm sech/tanh inversion for Ca-Carbons */

        rfst = (compC*4095.0*pwC*4000.0*sqrt((4.5*sfrq/600.0+3.85)/0.41));
        rfst = (int) (rfst + 0.5);
        strcpy(stCshape, "stC30");

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if ( gt4 > zeta - 0.6*pwC)
       { printf(" gt4 is too big. Make gt4 equal to %f or less.\n", 
  	 (zeta - 0.6*pwC)); 	     				     psg_abort(1);}

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

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

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

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

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

/* PHASES AND INCREMENTED TIMES */

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

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



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


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

	rcvroff();
        set_c13offset("ca");
	obsoffset(tof);
	obspower(tpwr);
 	obspwrf(4095.0);
	decpower(pwClvl);
	decpwrf(4095.0);
 	dec2power(pwNlvl);
	txphase(three);
	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);

        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 */
                          
        txphase(zero);
        decphase(zero);
	zgradpulse(gzlvl0, gt0);			/* 2.0*GRADIENT_DELAY */

	decpwrf(rfst);
        delay(tauCH - gt0 - WFG2_START_DELAY - 0.5e-3 + 70.0e-6);

        simshaped_pulse("",stCshape, 2.0*pw, 1.0e-3, zero, zero, 0.0, 0.0);

        delay(tauCH - gt0 - 0.5e-3 + 70.0e-6 - 150.0e-6);

        decpwrf(rf0);

	zgradpulse(gzlvl0, gt0);   	 	        /* 2.0*GRADIENT_DELAY */
	delay(150.0e-6);
           
	rgpulse(pw, one, 0.0, 0.0);	
	zgradpulse(gzlvl3, gt3);
	delay(2.0e-4);
        decrgpulse(pwC, t1, 0.0, 0.0);

        set_c13offset("co");

	delay(zeta - 0.6*pwC - OFFSET_DELAY - POWER_DELAY - PWRF_DELAY - PRG_START_DELAY);
        
        h1decon("DIPSI2", widthHd, 0.0); /*POWER_DELAY+PWRF_DELAY+PRG_START_DELAY */
         
	delay(2.0*timeC - zeta);
 
        c13pulse("co", "ca", "sinc", 90.0, t2, 0.0, 0.0); /* pwS1 */		
	
        delay(timeNCA - tau1);

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

        delay(timeNCA + tau1 + (60.0e-6));
        
        initval(phshift, v3);
        decstepsize(1.0);
        dcplrphase(v3);        
        c13pulse("co", "ca", "sinc", 90.0, one, 0.0, 0.0); /* pwS1 */

        delay(2.0*timeC + tauCC - OFFSET_DELAY - SAPS_DELAY - tau1);
        c13pulse("ca", "co", "sinc", 180.0, zero, 0.0, 0.0);
        delay(tauCC);
        sim3_c13pulse("", "co", "ca", "square", "", 0.0, 180.0, 2.0*pwN, zero, zero, zero, 0.0, 60.0e-6); 
        delay(tau1);

        set_c13offset("ca");

        initval(phi7cal, v7);
        decstepsize(1.0);
        dcplrphase(v7);                                         /* SAPS_DELAY */
        dec2phase(t8);

	nh_evol_se_train("ca", "co"); /* common part of sequence in bionmr.h  */

if (dm3[B] == 'y')  lk_sample();

}		 
Esempio n. 5
0
void 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 );

}		 
Esempio n. 6
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,
          lambda = getval("lambda"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl6 = getval("gzlvl6"), 
          gzlvl5 = getval("gzlvl5"), 
          gt1 = getval("gt1"),
          gt6 = getval("gt6"),
          gt5 = getval("gt5"),
          gstab = getval("gstab"),
          shlvl1 = getval("shlvl1"),
          shpw1 = getval("shpw1"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          d2 = getval("d2"),
          timeTN = getval("timeTN"),
          timeTN1,
          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(t3,4,phi3);
   settable(t10,1,phi10);
   settable(t12,4,phi12);
   settable(t13,4,phi13);

/*   INITIALIZE VARIABLES   */

  timeTN1= timeTN-tauC;
  Delta = timeTN-tauC-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);
   pwS4 = h_shapedpw("eburp2",4.0,3.5,zero, 0.0, 0.0);  
   pwS5 = h_shapedpw("reburp",4.0,3.5,zero, 0.0, 0.0);
   pwS6 = h_shapedpw("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);



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

   if ( ni2*1/(sw2)/2.0 > (timeTN1-Delta-pwS3))
       { printf(" ni2 is too big. Make ni2 equal to %d or less.\n",
         ((int)((timeTN1-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(d1-gt6 +1.0e-4);
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    */
/**************************************************************************/
      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-taunh*0.5-shpw1+pwS2+pwS7);
        shaped_pulse(shname1,shpw1,zero,0.0,0.0);
           delay(taunh*0.5-pwS2-pwS7);
        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,zero,0.0,0.0);				     
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx       13CA EVOLUTION        xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/
   set_c13offset("ca");
   
	c13pulse("ca", "co", "square", 90.0, t1, 2.0e-6, 0.0);       
        delay(tau1*0.5);
        sim3_c13pulse(shname1, "co", "ca", "sinc", "", shpw1, 180.0, 2.0*pwN,
                                                  zero, zero, zero, 0.0, 0.0);
        delay(tau1*0.5);
	c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);      

        sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 0.0,
                                                   zero, zero, zero, 0.0, 0.0);
        if (pwN*2.0 > pwS3) delay(pwN*2.0-pwS3);
	c13pulse("ca", "co", "square", 90.0, zero, 0.0, 0.0);       

   set_c13offset("co");
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
   obspower(shlvl1);

     dec2rgpulse(pwN,t3,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-taunh*0.5-shpw1);
        shaped_pulse(shname1,shpw1,zero,0.0,0.0);
           delay(taunh*0.5);
	c13pulse("co", "ca", "sinc", 90.0, zero, 0.0, 0.0);      
/**************************************************************************/

      if (SE_flg[0] == 'y')
      {
 	   delay(tau2*0.5);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
           delay(timeTN1+pwN*4.0/3.0-shpw1-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);
       delay(Delta);
	c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      
           delay(timeTN1-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(tau2*0.5);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
           delay(timeTN1+pwN*4.0/3.0-shpw1);
      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-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 );

}		 
Esempio n. 7
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          SE_flg[MAXSTR],
          dec_flg[MAXSTR],
          CT_flg[MAXSTR];

   int    icosel=1,
          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"),
          CTdelay =  getval("CTdelay"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gzlvl4 = getval("gzlvl4"), 
          gzlvl5 = getval("gzlvl5"), 
          gzlvl6 = getval("gzlvl6"), 
          gt1 = getval("gt1"),
          gt2 = getval("gt2"),
          gt3 = getval("gt3"),
          gt4 = getval("gt4"),
          gt5 = getval("gt5"),
          gt6 = getval("gt6"),
          gstab = getval("gstab"),
          tpwrsf = getval("tpwrsf"),
          shlvl1,
          shpw1,
          pwClvl = getval("pwClvl"),
          pwC = getval("pwC"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          dpwr2 = getval("dpwr2"),
          d2 = getval("d2"),
          shbw = getval("shbw"),
          shofs = getval("shofs")-4.77,
          timeTN = getval("timeTN"),
          tauC = getval("tauC"),
          tau1 = getval("tau1"),
          tau2 = getval("tau2"),
          taunh = getval("taunh");



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



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

/*   INITIALIZE VARIABLES   */

   shpw1 = pw*8.0;
   shlvl1 = tpwr;

   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 (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 (CT_flg[0] == 'y')
{
   if ( ni*1/(sw1) > (CTdelay))
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)(CTdelay*sw1)));    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);
}

 

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

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


     zgradpulse(gzlvl2, gt2);
       delay(1.0e-4);

       delay(d1-gt2);
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);

        h_shapedpulse("pc9f_",shbw,shofs,one, 0.0, 0.0);  


   obspower(shlvl1);
/**************************************************************************/
      dec2rgpulse(pwN,zero,0.0,0.0);

           zgradpulse(gzlvl6,gt6);
           delay(timeTN-pwS2*0.5-gt6);

      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-taunh*0.5-shpw1);
           shaped_pulse(shname1,shpw1,two,0.0,0.0);
           zgradpulse(gzlvl6, gt6);
           delay(taunh*0.5-gt6);

     dec2rgpulse(pwN,zero,0.0,0.0);				     
           shaped_pulse(shname1,shpw1,zero,0.0,0.0);
/**************************************************************************/
/***        CO -> CA transfer             *********************************/
/**************************************************************************/
        c13pulse("co", "ca", "sinc", 90.0, zero, 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, 2.0e-6, 0.0);
/**************************************************************************/
/*  xxxxxxxxxxxxxxxxxxxx       13Ca EVOLUTION       xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/
        set_c13offset("ca");

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

        c13pulse("ca", "co", "square", 90.0, zero, 0.0, 0.0);   
    }
    else
    {
      if (dec_flg[0] == 'y')
      {
        c13pulse("ca", "co", "square", 90.0, t1, 2.0e-6, 2.0e-6);   
        delay(tau1*0.5);
        c_shapedpulse2("isnob5",30.0,-31.0,"isnob5",30.0,120.0 , zero, 0.0, 0.0);
        dec2rgpulse(pwN*2.0,zero,0.0,0.0);				     
        delay(tau1*0.5);

        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
 
        dec2rgpulse(pwN*2.0,two,0.0,0.0);				     
        c_shapedpulse2("isnob5",30.0,-31.0,"isnob5",30.0,120.0 , two, 0.0, 0.0);

        c13pulse("ca", "co", "square", 90.0, zero, 2.0e-6, 2.0e-6);   
      }
      else
      {
        c13pulse("ca", "co", "square", 90.0, t1, 2.0e-6, 2.0e-6);   
        delay(tau1*0.5);
        sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
        delay(tau1*0.5);

        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
        c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 2.0e-6);   
        if (pwN*2.0 > pwS2)  delay(pwN*2.0 - pwS2);

        c13pulse("ca", "co", "square", 90.0, zero, 2.0e-6, 2.0e-6);   
       }
     }
     
        set_c13offset("co");
        zgradpulse(gzlvl3, gt3);
        delay(1.0e-4);
/**************************************************************************/
/***        CO -> CA transfer             *********************************/
/**************************************************************************/
       c13pulse("co", "ca", "sinc", 90.0, one, 2.0e-6, 0.0);

        zgradpulse(gzlvl4, gt4*0.7);
        delay(tauC - gt4*0.7 - 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*0.7);
        delay(tauC - gt4*0.7 - 0.5*10.933*pwC - WFG_START_DELAY - 2.0e-6);
                                                           /* WFG_START_DELAY */
        c13pulse("co", "ca", "sinc", 90.0, zero, 2.0e-6, 0.0);



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

   obspower(shlvl1);
        shaped_pulse(shname1,shpw1,zero,0.0,0.0);

     dec2rgpulse(pwN,t3,0.0,0.0);

      if (SE_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);

        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",shbw,shofs,zero, 2.0e-6, 0.0); 
	dec2rgpulse(pwN, t10, 0.0, 0.0);
      }
      else
      {
           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-taunh*0.5-shpw1);

      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",shbw,shofs,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_",shbw,shofs,one, 0.0, 0.0); 
 

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

   	h_sim3shapedpulse("reburp",shbw,shofs,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",shbw,shofs,zero, 0.0, 0.0); 


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

        h_shapedpulse("reburp",shbw,shofs,zero, 0.0, rof2); 
        zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
}
else
{
        h_shapedpulse("eburp2",shbw,shofs,zero, 2.0e-6, 0.0);
        zgradpulse(gzlvl5, gt5);
        delay(lambda-pwS6*0.4  - 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.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 );

}		 
Esempio n. 8
0
pulsesequence()

{
/* DECLARE VARIABLES */

 char       satmode[MAXSTR],
	    fscuba[MAXSTR],
            cbdecseq[MAXSTR];

 int        icosel,
            ni = getval("ni"),
            t1_counter;   /* used for states tppi in t1           */

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             tau3,         /*  t3 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 */
             d2_init=0.0,                        /* used for states tppi in t1 */
             bigTN,        /* nitrogen T period */
             bigTC,        /* carbon T period */
             BigT1,        /* delay about 200 us */
             satpwr,      /* low level 1H trans.power for presat  */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             at,
             sphase,
             cbpwr,        /* power level for selective CB decoupling */
             cbdmf,        /* pulse width for selective CB decoupling */
             cbres,        /* decoupling resolution of CB decoupling */

             pwS1,         /* length of  90 on Ca */
             pwS2,         /* length of  90 on CO */
             pwS3,         /* length of 180 on Ca  */
             pwS4,         /* length of 180 on CO  */

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

             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;

/* LOAD VARIABLES */

  getstr("satmode",satmode);
  getstr("fscuba",fscuba);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  tauc   = getval("tauc"); 
  taud   = getval("taud"); 
  bigTN = getval("bigTN");
  bigTC = getval("bigTC");
  BigT1 = getval("BigT1");
  tpwr = getval("tpwr");
  satpwr = getval("satpwr");
  dpwr = getval("dpwr");
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  at = getval("at");
  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");
  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");

/* 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;
        kappa = 5.4e-3;

    getstr("cbdecseq", cbdecseq);

/* LOAD PHASE TABLE */

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

   /* get calculated pulse lengths of shaped C13 pulses */
        pwS1 = c13pulsepw("ca", "co", "square", 90.0);
        pwS2 = c13pulsepw("co", "ca", "sinc", 90.0);
        pwS3 = c13pulsepw("ca","co","square",180.0);
        pwS4 = c13pulsepw("co","ca","sinc",180.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' || dm2[C] == 'n'))
    {
        printf("incorrect dec2 decoupler flags! Should be 'nny' ");
        psg_abort(1);
    }

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

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

    if( dpwr2 > 47 )
    {
        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( 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 > 15.0e-3 
	|| gt11>15.0e-3)  
    {
       printf("gti values must be < 15e-3\n");
       psg_abort(1);
    } 

    if( dpwr3 > 56) {
       printf("dpwr3 too high\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(t1,2,4); tsadd(t6,2,4); }

   if (phase1 == 1)  { ;}                                                  /* CC */
   else if (phase1 == 2)  { tsadd(t7,1,4);}                                /* SC */
   else if (phase1 == 3)  { tsadd(t4,3,4); }                               /* CS */
   else if (phase1 == 4)  { tsadd(t7,1,4); tsadd(t4,3,4); }                /* SS */
   else { printf ("phase1 can only be 1,2,3,4. \n"); psg_abort(1); }

   if (phase2 == 2)  { tsadd(t3,2,4); icosel = +1; }                      /* N  */
            else                       icosel = -1;

   tau1 = 1.0*t1_counter*cos_CO/swTilt;
   tau2 = 1.0*t1_counter*cos_Ca/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) + pwS3 < 0.2e-6) 
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((bigTN + pwS3)*2.0*swTilt/cos_N)));              psg_abort(1);}

    if (bigTC - 0.5*ni*(cos_Ca/swTilt) - pwS4
                 - pwS3/2 - WFG3_START_DELAY - WFG3_STOP_DELAY
                 -3*POWER_DELAY - PRG_START_DELAY - PRG_STOP_DELAY -
                  4.0e-6 < 0.2e-6)
       {
         printf(" ni is too big for Ca. Make ni equal to %d or less.\n",
            (int) ((bigTC - pwS4 - pwS3/2 - WFG3_START_DELAY - 
                  WFG3_STOP_DELAY - 3*POWER_DELAY - PRG_START_DELAY -
                  PRG_STOP_DELAY -4.0e-6 )/(0.5*cos_Ca/swTilt)) );
         psg_abort(1);
       }

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   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);
   set_c13offset("ca");

/* Presaturation Period */

   if (satmode[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(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 - 200.2e-6 - 2.0e-6); 

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

/*   xxxxxxxxxxxxxxxxxxxxxx    15N to 13CA TRANSFER   xxxxxxxxxxxxxxxxxx    */

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

       delay(0.2e-6);
       zgradpulse(gzlvl2, gt2);
       delay(200.0e-6);

       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(tauc - kappa - WFG3_START_DELAY );

       dec2rgpulse(2*pwN,zero,0.0,0.0);
       c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);
       dec2phase(zero); 

       delay(tauc - pwS3);

       dec2rgpulse(pwN,zero,0.0,0.0);

   h1waltzoff("WALTZ16", widthHd, 0.0);
   decphase(zero);

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

/* xxxxxxxxxxxxxxxxxxxxx 13CA to 13CO TRANSFER xxxxxxxxxxxxxxxxxxxxxxx  */

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

      decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

                delay(taud - 2*POWER_DELAY -  PRG_START_DELAY - PRG_STOP_DELAY
                       - 0.5*10.933*pwC); 
      decoff();
      decprgoff();
      decpower(pwClvl);

/* CHECK if this freq jump is needed */
      set_c13offset("co");   /* change Dec1 carrier to Co  */

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

      set_c13offset("ca");   /* change Dec1 carrier to Co  */

      decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

                delay(taud - 2*POWER_DELAY
                - PRG_STOP_DELAY - PRG_START_DELAY - 0.5*10.933*pwC);

      decoff();
      decprgoff();
      decpower(pwClvl);

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

      set_c13offset("co");   /* change Dec1 carrier to Co  */

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


/*   xxxxxxxxxxxxxxxx 13CO CHEMICAL SHIFT EVOLUTION xxxxxxxxxxxxxx */
 
   c13pulse("co", "ca", "sinc", 90.0, t7, 0.0, 0.0);

   if ((ni>1.0) && (tau1>0.0))
   {
    if (tau1-2.0*pwS2/PI-pwN-WFG3_START_DELAY-POWER_DELAY-2.0e-6 > 0.0)
    {
   delay(tau1-2.0*pwS2/PI-pwN-WFG3_START_DELAY-POWER_DELAY-2.0e-6);

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

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

   delay(tau1-2.0*pwS2/PI-SAPS_DELAY-pwN-WFG3_STOP_DELAY-POWER_DELAY-2.0e-6);
   }
   else
   {
     delay(2.0*tau1);
     delay(10.0e-6);
     c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
     delay (10.0e-6);
   }
  }
   else
  { 
     c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
  }

   c13pulse("co", "ca", "sinc", 90.0, zero, 4.0e-6, 0.0);
                dcplrphase(zero);
 
   set_c13offset("ca");  /* set carrier to Ca */
 
                decphase(t4);
                delay(2.0e-7);
                zgradpulse(gzlvl9, gt9);
                delay(100.0e-6);

/* xxxxxxxxxxxxxx 13CO to 13CA TRANSFER and 13CA EVOLUTION xxxxxxxxxxxxxxxx  */

      c13pulse("ca", "co", "square", 90.0, t4, 2.0e-6, 0.0);

      decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

      delay(bigTC - tau2 - 3*POWER_DELAY - 4.0e-6 - WFG3_START_DELAY
            - pwS4 - WFG3_STOP_DELAY - PRG_START_DELAY - PRG_STOP_DELAY  
            - pwS3/2 - 4.0e-6);

      decoff();
      decprgoff();

      decpower(pwClvl);
      c13pulse("co", "ca", "sinc", 180.0, zero, 4.0e-6, 0.0);
      decphase(t5);
      c13pulse("ca", "co", "square", 180.0, t5, 4.0e-6, 0.0);

      decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

      delay(bigTC -3*POWER_DELAY - 6.0e-6 -pwS3/2 - 2*pwN
      - WFG_START_DELAY- pwS4- WFG_STOP_DELAY - PRG_START_DELAY
      - PRG_STOP_DELAY - pwS1/2);

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

      decoff();
      decprgoff();

      decpower(pwClvl);
      c13pulse("co", "ca", "sinc", 180.0, zero, 4.0e-6, 0.0);

      decphase(one);
      c13pulse("ca", "co", "square", 90.0, one, 2.0e-6, 0.0);

   txphase(zero);

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

/* Constant 15N period  */
   h1waltzon("WALTZ16", widthHd, 0.0);
   dec2rgpulse(pwN,t1,2.0e-6,0.0);

   dec2phase(t2);

   delay(bigTN - tau3 + pwS3);

   dec2rgpulse(2*pwN,t2,0.0,0.0);
   c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);

   dec2phase(t3);
   txphase(zero);

   if (tau3 > (kappa + PRG_STOP_DELAY + pwHd + 2.0e-6))
   {
       delay(bigTN - pwS4 - WFG_START_DELAY - 2.0*POWER_DELAY
                                - 2.0*PWRF_DELAY - 2.0e-6);
       c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
       delay(tau3 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6 - POWER_DELAY
                                         - PWRF_DELAY);
       h1waltzoff("WALTZ16", widthHd, 0.0);

       delay(kappa - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
       zgradpulse(gzlvl5, gt5);
       delay(1.0e-4);
   }
   else if (tau3 > (kappa - pwS4 - 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);
      c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);

      delay(kappa - pwS4 - 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);
      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);
      delay(kappa - tau3 - pwS4 - WFG_START_DELAY - 2.0*POWER_DELAY
                                   - 2.0*PWRF_DELAY - 2.0e-6);
      c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
      delay(tau3 - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
      zgradpulse(gzlvl5, gt5);
      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);
      delay(kappa - tau3 - pwS4 - 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("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
      delay(tau3);
   }

   sim3pulse(pw,0.0,pwN,zero,zero,t3,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*pw,0.0,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.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*pw,0.0,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);

   rgpulse(pw, zero, 0.0, 0.0);
   delay(gt8 + 1.0e-4 + 50.2e-6 - 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(50.2e-6);

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

/* BEGIN ACQUISITION */

status(C);
         setreceiver(t6);

}
Esempio n. 9
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   f2180[MAXSTR],
       cbdec[MAXSTR],
       cbdecseq[MAXSTR];                  /* shape for selective CB inversion */

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

double
   d2_init=0.0, d3_init=0.0,  
   tau1, tau2, tau3,                                        /* t1,t2,t3 delay */
   t1a, t1b, t1c, sheila_1,
   t2a, t2b, t2c, sheila_2,
   tauCH = getval("tauCH"),                              /* 1/4J delay for CH */
   tauCH_1,
   timeTN = getval("timeTN"),   /* ~ 12 ms for N evolution and 1JNCa transfer */
   epsilon = 1.05e-3,                               /* 0.7*1/4J delay for CHn */
   epsilon_1,
   tauCaCO = getval("tauCaCO"),                 /* 1/4J delay for CaCO, 4.5ms */
   tauNCO = getval("tauNCO"),                   /* 1/4J delay for NCO, 17.0ms */

   Hali_offset = getval("Hali_offset"),
   cbpwr,                           /* power level for selective CB inversion */
   cbdmf,                           /* pulse width for selective CB inversion */
   cbres,

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

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

   swH = getval("swH"), swC = getval("swC"), swTilt,
   angle_H = getval("angle_H"), angle_C, cos_H, cos_C,

   pwCa90,
   pwCa180,                                     /* length of square 180 on Ca */
   pwCO90,
   pwCO180,                                       /* length of sinc 180 on CO */

   pwZ,
   phi7cal = getval("phi7cal"),     /* small phase correction for 90 CO pulse */
   ncyc = getval("ncyc"),       /* no. of cycles of DIPSI-3 decoupling on Cab */
   waltzB1 = getval("waltzB1"),  /* H1 decoupling strength in Hz for DIPSI-2  */

   sw1 = getval("sw1"),   sw2 = getval("sw2"), 
  gstab= getval("gstab"),
   gt0 = getval("gt0"),     gzlvl0 = getval("gzlvl0"),             
   gt1 = getval("gt1"),     gzlvl1 = getval("gzlvl1"),
                            gzlvl2 = getval("gzlvl2"),
   gt3 = getval("gt3"),     gzlvl3 = getval("gzlvl3"),
   gt4 = getval("gt4"),     gzlvl4 = getval("gzlvl4"),
   gt5 = getval("gt5"),     gzlvl5 = getval("gzlvl5"),
   gt6 = getval("gt6"),     gzlvl6 = getval("gzlvl6"),
   gt7 = getval("gt7"),     gzlvl7 = getval("gzlvl7"),
   gt8 = getval("gt8"),     gzlvl8 = getval("gzlvl8"),
   gt9 = getval("gt9"),     gzlvl9 = getval("gzlvl9");

   getstr("f2180",f2180);
   widthHd = 2.069*(waltzB1/sfrq);          /* produces same B1 as gc_co_nh.c */

   cbpwr = getval("cbpwr");  cbdmf = getval("cbdmf");  cbres = getval("cbres");
   getstr("cbdecseq", cbdecseq);   getstr("cbdec", cbdec);

/*   LOAD PHASE TABLE    */

   settable(t2,1,phx);    settable(t3,2,phi3);    settable(t4,1,phx);
   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;

/* get calculated pulse lengths of shaped C13 pulses */
   pwCa90 = c13pulsepw("ca", "co", "square", 90.0);
   pwCa180 = c13pulsepw("ca", "co", "square", 180.0); 
   pwCO90  = c13pulsepw("co", "ca", "sinc", 90.0);
   pwCO180 = c13pulsepw("co", "ca", "sinc", 180.0); 

/* pwZ: the bigger of pwN*2.0 and pwCa180 */
   if (pwN*2.0 > pwCa180) pwZ=pwN*2.0; else pwZ=pwCa180;

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

    if ( pw > 20.0e-6 )
       { printf(" pw too long ! recheck value ");                    psg_abort(1);} 
  
    if ( pwN > 100.0e-6 )
       { printf(" pwN too long! recheck value ");                    psg_abort(1);} 
 
    if ( pwC > 20.0*600.0/sfrq )
       { printf("increase pwClvl so that pwC < 20*600/sfrq");        psg_abort(1);}

   /**********************************************************************/
   /* Calculate t1_counter from sw1 as a generic control of the sequence */
   /* Make sure sw1 is not zero                                          */
   /**********************************************************************/

   angle_C = 90.0 - angle_H;
   if ( (angle_H < 0) || (angle_H > 90) )
   { printf ("angle_H must be between 0 and 90 degree.\n");    psg_abort(1); }

   if ( sw1 < 1.0 )
   { printf ("Please set sw1 to a non-zero value.\n");         psg_abort(1); }

   cos_H = cos (PI*angle_H/180);
   cos_C = cos (PI*angle_C/180);
   swTilt = swH * cos_H + swC * cos_C;

   if (ix ==1)
   {
      printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
      printf ("PR(4,3)D intra_cbd_hccnh\n");
      printf ("Set ni2=1, phase=1,2,3,4 and phase2=1,2 \n");
      printf ("Maximum Sweep Width: \t\t %f Hz\n", swTilt);
      printf ("Angle_H:\t%6.2f degree \t\tAngle_C:\t%f degree\n", angle_H, angle_C);
   }

/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 1) {;}                                               /* CC */
    else if (phase1 == 2)  { tsadd(t2, 1, 4); }                        /* SC */
    else if (phase1 == 3)  { tsadd(t3, 1, 4); }                        /* CS */
    else if (phase1 == 4)  { tsadd(t2, 1, 4); tsadd(t3,1,4); }         /* SS */
 
    if (phase2 == 2)  {tsadd(t10,2,4); icosel = +1;}
            else                       icosel = -1;    
    
/* Calculate modifications to phases for States-TPPI acquisition */

   if( ix == 1) d2_init = d2;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if (t1_counter % 2) { tsadd(t2,2,4); tsadd(t12,2,4); }
   tau1 = 1.0 * t1_counter * cos_H / swTilt;
   tau2 = 1.0 * t1_counter * cos_C / swTilt;

   tau1 = tau1/2.0;   tau2 = tau2/2.0;

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

/*  Set up f2180  */
    tau3 = d3;
    if ((f2180[A] == 'y') && (ni2 > 1.0)) 
    { tau3 += ( 1.0 / (2.0*sw2) ); if(tau3 < 0.2e-6) tau3 = 0.0; }
    tau3 = tau3/2.0;

/*  Hyperbolic sheila_1 seems superior */ 

    tauCH_1 = tauCH - gt3 - 2.0*GRADIENT_DELAY - 5.0e-5;

 if ((ni-1)/(2.0*swTilt/cos_H) > 2.0*tauCH_1)
    {
      if (tau1 > 2.0*tauCH_1) sheila_1 = tauCH_1;
      else if (tau1 > 0)      sheila_1 = 1.0/(1.0/tau1+1.0/tauCH_1 - 1.0/(2.0*tauCH_1));
      else                    sheila_1 = 0.0;
    }
 else
    {
      if (tau1 > 0) sheila_1 = 1.0/(1.0/tau1 + 1.0/tauCH_1 - 2.0*swTilt/cos_H/((double)(ni-1)));
      else          sheila_1 = 0.0;
    }

/* The following check fixes the phase distortion of certain tilts */

   if (sheila_1 > tau1) sheila_1 = tau1;
   if (sheila_1 > tauCH_1) sheila_1 =tauCH_1;

    t1a = tau1 + tauCH_1;
    t1b = tau1 - sheila_1;
    t1c = tauCH_1 - sheila_1;

/* subtract unavoidable delays from epsilon */
    epsilon_1 = epsilon - pwCO180 - WFG_START_DELAY - 4.0e-6 - POWER_DELAY 
                - PWRF_DELAY - gt5 - 2.0*GRADIENT_DELAY - 5.0e-5;

 if ((ni-1)/(2.0*swTilt/cos_C) > 2.0*epsilon_1)
    { 
      if (tau2 > 2.0*epsilon_1) sheila_2 = epsilon_1;
      else if (tau2 > 0) sheila_2 = 1.0/(1.0/tau2+1.0/epsilon_1 - 1.0/(2.0*epsilon_1));
      else          sheila_2 = 0.0;
    }
 else
    {    
      if (tau2 > 0) sheila_2 = 1.0/(1.0/tau2 + 1.0/epsilon_1 - 2.0*swTilt/cos_C/((double)(ni-1)));
      else          sheila_2 = 0.0;
    }

/* The following check fixes the phase distortion of certain tilts */

   if (sheila_2 > tau2) sheila_2 = tau2;
   if (sheila_2 > epsilon_1) sheila_2 = epsilon_1;

    t2a = tau2;
    t2b = tau2 - sheila_2;
    t2c = epsilon_1 - sheila_2;

/*   BEGIN PULSE SEQUENCE   */

status(A);
   delay(d1);
   rcvroff();

   obsoffset(tof - Hali_offset);  obspower(tpwr);        obspwrf(4095.0);
   set_c13offset("gly");      decpower(pwClvl);      decpwrf(4095.0);
   dec2offset(dof2);              dec2power(pwNlvl);     dec2pwrf(4095.0);

   txphase(t2);    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, gt0);
      delay(gstab);

   rgpulse(pw, t2, 0.0, 0.0);                        /* 1H pulse excitation */
                                                                 /* point a */
      txphase(zero);
      decphase(zero);
      zgradpulse(gzlvl3, gt3);                        /* 2.0*GRADIENT_DELAY */
      delay(gstab);
      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(gzlvl3, gt3);                        /* 2.0*GRADIENT_DELAY */
      txphase(one);
      delay(gstab);
      delay(t1c);
                                                                 /* point b */
   rgpulse(pw, one, 0.0, 0.0);

      obsoffset(tof);
      zgradpulse(gzlvl4, gt4);
      decphase(t3);
      delay(gstab);
     
   decrgpulse(pwC, t3, 0.0, 0.0);
      decphase(zero);
      delay(t2a);
                                  /* WFG_START_DELAY+POWER_DELAY+PWRF_DELAY */
      c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);    /* pwCO180 */

      zgradpulse(gzlvl5, gt5);                        /* 2.0*GRADIENT_DELAY */
      delay(gstab);
      delay(epsilon_1 - 2.0*pw);

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

   c13pulse("gly", "co", "square", 180.0, zero, 2.0e-6, 0.0);
      zgradpulse(gzlvl5, gt5);                        /* 2.0*GRADIENT_DELAY */
      delay(gstab);
      delay(t2c);

      c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);

      delay(2.0*pwC/PI);                            /* Compensation for pwC */
      delay(WFG_START_DELAY+PWRF_DELAY + POWER_DELAY);

   decrgpulse(0.5e-3, zero, 2.0e-6, 0.0);           /* 0.5 ms trim(X) pulse */
   
   c13decouple("gly", "DIPSI3", 120.0, ncyc);             /* PRG_STOP_DELAY */


   /* ========= Begin Ca(i)x --> Ca(i)zN(i)z ================*/

   if (cbdec[A] == 'y')
   {  decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

      delay(tauCaCO*2.0 - pwCO90*0.6366 - 2.0e-6 - PRG_START_DELAY
            - 2*PRG_STOP_DELAY - WFG_START_DELAY - POWER_DELAY - PWRF_DELAY  );

      decoff();
      decprgoff();
   }
   else
   {  delay(tauCaCO*2.0 - pwCO90*0.6366 - 2.0e-6
            - PRG_STOP_DELAY - WFG_START_DELAY - POWER_DELAY - PWRF_DELAY  );
   }

   c13pulse("co", "ca", "sinc", 90.0, zero, 2.0e-6, 2.0e-6);

   if (cbdec[A] == 'y')
   {  decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

      delay(tauNCO - pwCO90*0.6366 - pwCO180 - pwZ/2.0 - 8.0e-6
            - PRG_START_DELAY - PRG_STOP_DELAY
            - WFG_START_DELAY - WFG3_START_DELAY - 4.0*POWER_DELAY - 4.0*PWRF_DELAY);

      decoff();
      decprgoff();
   }
   else
   {
      zgradpulse(gzlvl6, gt6);
      delay(gstab);

      delay(tauNCO - pwCO90*0.6366 - pwCO180 - pwZ/2.0 - 8.0e-6
            - gt6 - gstab - 2.0*GRADIENT_DELAY - WFG_START_DELAY
            - WFG3_START_DELAY - 4.0*POWER_DELAY - 4.0*PWRF_DELAY);
   }

   c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 2.0e-6);

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

   if (cbdec[A] == 'y')
   {  decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

      delay(tauNCO - pwZ/2.0 - pwCO180 - pwCO90*0.6366 - 8.0e-6
            - PRG_START_DELAY - PRG_STOP_DELAY 
            - 2*WFG_START_DELAY - 4.0*POWER_DELAY - 4.0*PWRF_DELAY - SAPS_DELAY);

      decoff();
      decprgoff();
   }
   else
   {
      zgradpulse(gzlvl6, gt6);
      delay(gstab);

      delay(tauNCO - pwZ/2.0 - pwCO180 - pwCO90*0.6366 - 8.0e-6
            - gt6 - gstab - 2.0*GRADIENT_DELAY - 2*WFG_START_DELAY
            - 4.0*POWER_DELAY - 4.0*PWRF_DELAY - SAPS_DELAY);   
   }

   c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 2.0e-6);        /* BSP */

      initval(phi7cal, v7);   decstepsize(1.0);
      decphase(one);    dcplrphase(v7);                     /* SAPS_DELAY */
 
   c13pulse("co", "ca", "sinc", 90.0, one, 2.0e-6, 2.0e-6);
      dcplrphase(zero);

   if (cbdec[A] == 'y')
   {  decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

      delay(tauCaCO*2.0 -pwCO90*0.6366 - pwCa90*0.6366 - 4.0e-6
            - PRG_START_DELAY - PRG_STOP_DELAY
            - WFG_START_DELAY - 2.0*POWER_DELAY - 2.0*PWRF_DELAY);

      decoff();
      decprgoff();
   }
   else
   {  delay(tauCaCO*2.0 -pwCO90*0.6366 - pwCa90*0.6366 - 4.0e-6
            - WFG_START_DELAY - 2.0*POWER_DELAY - 2.0*PWRF_DELAY);
   }

      decphase(one);
   c13pulse("ca", "co", "square", 90.0, one, 2.0e-6, 2.0e-6);

   /* ========= End Ca(i)x --> Ca(i)zN(i)z ================*/  
      zgradpulse(gzlvl7, gt7);
      delay(gstab);

      h1decon("DIPSI2", widthHd, 0.0);
                                   /*POWER_DELAY+PWRF_DELAY+PRG_START_DELAY */

/*  xxxxxxxxxxxx   TRIPLE RESONANCE NH EVOLUTION & SE TRAIN   xxxxxxxxxxxx  */

   dec2rgpulse(pwN, t8, 2.0e-6, 2.0e-6);
      decphase(zero);   dec2phase(t9);
      delay(timeTN - WFG3_START_DELAY - tau3);
                                                          /* WFG3_START_DELAY  */
   sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN, 
                  zero, zero, t9, 2.0e-6, 2.0e-6);
   dec2phase(t10);

   if (tau3 > kappa + PRG_STOP_DELAY)
   {
      delay(timeTN - pwCO180 - WFG_START_DELAY - 2.0*POWER_DELAY 
                  - 2.0*PWRF_DELAY - 2.0e-6);

   c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);          /* pwCO180 */

      delay(tau3 - kappa - PRG_STOP_DELAY - POWER_DELAY - PWRF_DELAY);
      h1decoff();                     /* POWER_DELAY+PWRF_DELAY+PRG_STOP_DELAY */
      txphase(zero);
      delay(kappa - gt1 - 2.0*GRADIENT_DELAY - gstab);

      zgradpulse(gzlvl1, gt1);                    /* 2.0*GRADIENT_DELAY */
      delay(gstab);
   }
   else if (tau3 > (kappa - pwCO180 - WFG_START_DELAY - 2.0*POWER_DELAY - 2.0e-6))
   {
      delay(timeTN + tau3 - kappa -PRG_STOP_DELAY -POWER_DELAY -PWRF_DELAY);
      h1decoff();                     /* POWER_DELAY+PWRF_DELAY+PRG_STOP_DELAY */
      txphase(zero);                     /* WFG_START_DELAY  + 2.0*POWER_DELAY */

   c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);          /* pwCO180 */

      delay(kappa - pwCO180 - WFG_START_DELAY - 2.0*POWER_DELAY - 1.0e-6 - gt1 
                       - 2.0*GRADIENT_DELAY - gstab);

      zgradpulse(gzlvl1, gt1);                    /* 2.0*GRADIENT_DELAY */
      delay(gstab);
   }
   else if (tau3 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
   {
      delay(timeTN + tau3 - kappa -PRG_STOP_DELAY -POWER_DELAY -PWRF_DELAY);
      h1decoff();                     /* POWER_DELAY+PWRF_DELAY+PRG_STOP_DELAY */
      txphase(zero);
      delay(kappa - tau3 - pwCO180 - WFG_START_DELAY - 2.0*POWER_DELAY
                             - 2.0e-6);
   c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);          /* pwCO180 */

      delay(tau3 - gt1 - 2.0*GRADIENT_DELAY - gstab);

      zgradpulse(gzlvl1, gt1);                    /* 2.0*GRADIENT_DELAY */
      delay(gstab);
   }
   else
   {
      delay(timeTN + tau3 - kappa -PRG_STOP_DELAY -POWER_DELAY -PWRF_DELAY);
      h1decoff();                     /* POWER_DELAY+PWRF_DELAY+PRG_STOP_DELAY */
      txphase(zero);
      delay(kappa - tau3 - pwCO180 - WFG_START_DELAY - 2.0*POWER_DELAY
                  - 2.0e-6 - gt1 - 2.0*GRADIENT_DELAY - gstab);

      zgradpulse(gzlvl1, gt1);                    /* 2.0*GRADIENT_DELAY */
      delay(gstab);

   c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);          /* pwCO180 */
      delay(tau3);
   }

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

      txphase(zero);   dec2phase(zero);
      zgradpulse(gzlvl8, gt8);
      delay(lambda - 1.3*pwN - gt8);

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

      zgradpulse(gzlvl8, gt8);
      txphase(one);  dec2phase(t11);
      delay(lambda - 1.3*pwN - gt8);

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

      txphase(zero);
      dec2phase(zero);
      zgradpulse(gzlvl9, gt9);
      delay(lambda - 1.3*pwN - gt9);

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

      dec2phase(t10);
      zgradpulse(gzlvl9, gt9);
      delay(lambda - 0.65*(pw + pwN) - gt9);

   rgpulse(pw, zero, 0.0, 0.0); 
      delay((gt1/10.0) + 1.0e-4 - 0.3*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);  
      delay(1.0e-4);
   rgpulse(2.0*pw, zero, 0.0, 0.0);
      dec2power(dpwr2);                                         /* POWER_DELAY */
      zgradpulse(icosel*gzlvl2, gt1/10.0);                      /* 2.0*GRADIENT_DELAY */
      delay(gstab);

statusdelay(C, gstab);
   setreceiver(t12);
}
Esempio n. 10
0
pulsesequence()
{

char        sel_flg[MAXSTR],
            autocal[MAXSTR],
            glyshp[MAXSTR];

int         icosel, t1_counter, ni = getval("ni");

double
   d2_init=0.0, 
   tau1, tau2, 
   tau3,  
   glypwr,glypwrf,                    /* Power levels for Cgly selective 90 */
   pwgly,                              /* Pulse width for Cgly selective 90 */

   waltzB1  = getval("waltzB1"),     /* 1H decoupling strength (in Hz) */
   timeTN  = getval("timeTN"),     /* constant time for 15N evolution */
   tauCaCb = getval("tauCaCb"),    
   tauNCa  = getval("tauNCa"),
   tauNCo  = getval("tauNCo"),
   tauCaCo = getval("tauCaCo"),
            
   compH = getval("compH"),        /* adjustment for H1 amplifier compression */
   tpwrs,                        /* power for the pwHs ("H2Osinc") pulse */
   bw,ppm,

   pwClvl = getval("pwClvl"),              /* coarse power for C13 pulse */
   compC = getval("compC"),      /* amplifier compression 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 */
   dpwr2 = getval("dpwr2"),            /* power for N15 decoupling */

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

   sw1 = getval("sw1"),   
   swCb = getval("swCb"),
   swCa = getval("swCa"),
   swN  = getval("swN"),
   swTilt,                     /* This is the sweep width of the tilt vector */

   cos_N, cos_Ca, cos_Cb,
   angle_N, angle_Ca, angle_Cb,      /* angle_N is calculated automatically */

  gstab = getval("gstab"),
   gt0 = getval("gt0"),             gzlvl0 = getval("gzlvl0"),
   gt1 = getval("gt1"),             gzlvl1 = getval("gzlvl1"),
                                    gzlvl2 = getval("gzlvl2"),
   gt3 = getval("gt3"),             gzlvl3 = getval("gzlvl3"),
   gt4 = getval("gt4"),             gzlvl4 = getval("gzlvl4"),
   gt5 = getval("gt5"),             gzlvl5 = getval("gzlvl5"),
   gt6 = getval("gt6"),             gzlvl6 = getval("gzlvl6"),
   gt7 = getval("gt7"),             gzlvl7 = getval("gzlvl7"),
   gt10= getval("gt10"),            gzlvl10= getval("gzlvl10"),
   gt11= getval("gt11"),            gzlvl11= getval("gzlvl11"),
   gt12= getval("gt12"),            gzlvl12= getval("gzlvl12");

   angle_N = 0;
   glypwr = getval("glypwr");
   pwgly = getval("pwgly");
   tau1 = 0;
   tau2 = 0;
   tau3 = 0;
   cos_N = 0;
   cos_Cb = 0;
   cos_Ca = 0;
   getstr("autocal", autocal);
   getstr("glyshp", glyshp);
   getstr("sel_flg",sel_flg);

   pwHs = getval("pwHs");          /* H1 90 degree pulse length at tpwrs */
 
/*   LOAD PHASE TABLE    */

   settable(t2,1,phy);
   settable(t3,2,phi3);     settable(t4,1,phx);     settable(t5,4,phi5);
   settable(t8,1,phy);      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;

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

   pwHs = 1.7e-3*500.0/sfrq;
   widthHd = 2.861*(waltzB1/sfrq);   /* bandwidth of H1 WALTZ16 decoupling in ppm */
   pwHd = h1dec90pw("WALTZ16", widthHd, 0.0);     /* H1 90 length for WALTZ16 */
 
/* get calculated pulse lengths of shaped C13 pulses */
   pwCa90  = c13pulsepw("ca", "co", "square", 90.0); 
   pwCa180 = c13pulsepw("ca", "co", "square", 180.0);
   pwCO180 = c13pulsepw("co", "cab", "sinc", 180.0); 
   pwCab90 = c13pulsepw("cab","co", "square", 90.0);
   pwCab180= c13pulsepw("cab","co", "square", 180.0);

/* the 180 pulse on CO at the middle of t1 */
   if (pwCO180 > 2.0*pwN) pwZ = pwCO180; else pwZ = 2.0*pwN;
   if ((pwS==0.0) && (pwCO180>2.0*pwN)) pwZ1=pwCO180-2.0*pwN; else pwZ1=0.0;
   if ( ni > 1 )     pwS = 180.0;
   if ( pwS > 0 )   phshift = 320.0;
     else             phshift = 0.0;

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

   if ( pw > 20.0e-6 )
      { printf(" pw too long ! recheck value ");                  psg_abort(1);} 
  
   if ( pwN > 100.0e-6 )
      { printf(" pwN too long! recheck value ");                  psg_abort(1);} 


/* PHASES AND INCREMENTED TIMES */

   /* Set up angles and phases */

   angle_Cb=getval("angle_Cb");  cos_Cb=cos(PI*angle_Cb/180.0);
   angle_Ca=getval("angle_Ca");  cos_Ca=cos(PI*angle_Ca/180.0);

   if ( (angle_Cb < 0) || (angle_Cb > 90) )
   {  printf ("angle_Cb 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_Cb*cos_Cb + cos_Ca*cos_Ca) )
   {
       printf ("Impossible angles.\n"); psg_abort(1);
   }
   else
   {
           cos_N=sqrt(1.0- (cos_Cb*cos_Cb + cos_Ca*cos_Ca));
           angle_N = 180.0*acos(cos_N)/PI;
   }

   swTilt=swCb*cos_Cb + 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_Cb:\t%6.2f\n", angle_Cb);
      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(t8,2,4); tsadd(t12,2,4); }

   if (phase1 == 1)  { ;}                                                  /* CC */
   else if (phase1 == 2)  { tsadd(t3,3,4); tsadd(t2,3,4);}                 /* SC */
   else if (phase1 == 3)  { tsadd(t5,1,4); }                               /* CS */
   else if (phase1 == 4)  { tsadd(t3,3,4); tsadd(t2,3,4); tsadd(t5,1,4);}  /* SS */
   else { printf ("phase1 can only be 1,2,3,4. \n"); psg_abort(1); }

   if (phase2 == 2)  { tsadd(t10,2,4); icosel = +1; }                      /* N  */
            else                       icosel = -1;

   tau1 = 1.0*t1_counter*cos_Cb/swTilt;
   tau2 = 1.0*t1_counter*cos_Ca/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 (0.5*ni*(cos_N/swTilt) > timeTN - WFG3_START_DELAY)
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((timeTN - WFG3_START_DELAY)*2.0*swTilt/cos_N)));       psg_abort(1);}


/* BEGIN PULSE SEQUENCE */

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

      rcvroff();
      obsoffset(tof);          obspower(tpwr);        obspwrf(4095.0);
      set_c13offset("cab");     decpower(pwClvl);      decpwrf(4095.0);
      dec2power(pwNlvl);

      txphase(zero);           delay(1.0e-5);

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

      decrgpulse(pwC, one, 0.0, 0.0);
      zgradpulse(0.7*gzlvl0, gt0);
      delay(gstab);


      txphase(one);      delay(1.0e-5);
      shiftedpulse("sinc", pwHs, 90.0, 0.0, one, 2.0e-6, 0.0);

      txphase(zero);  decphase(zero); dec2phase(zero);
      delay(2.0e-6);

/* pulse sequence starts */


   rgpulse(pw,zero,0.0,0.0);                      /* 1H pulse excitation */
      dec2phase(zero);
      zgradpulse(gzlvl3, gt3);
      delay(lambda - gt3);

   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
      if (sel_flg[A] == 'n') txphase(three);
          else txphase(one);

      zgradpulse(gzlvl3, gt3);
      delay(lambda - gt3);

if (sel_flg[A] == 'n')
{
   rgpulse(pw, three, 0.0, 0.0);
      txphase(zero);
      zgradpulse(gzlvl4, gt4);                       /* Crush gradient G4 */
      delay(gstab);
                                             /* Begin of N to Ca transfer */
     dec2rgpulse(pwN, one, 0.0, 0.0);
     decphase(zero);      dec2phase(zero);
     delay(tauNCo - pwCO180/2 - 2.0e-6 - WFG3_START_DELAY);
}
else  /* active suppresion */
{
   rgpulse(pw,one,2.0e-6,0.0);

      initval(1.0,v6);   dec2stepsize(45.0);   dcplr2phase(v6);
      zgradpulse(gzlvl4, gt4);                       /* Crush gradient G4 */
      delay(gstab);
                                             /* Begin of N to Ca transfer */
   dec2rgpulse(pwN,one,0.0,0.0);
      dcplr2phase(zero);                                    /* SAPS_DELAY */
      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(tauNCo - pwCO180/2 - 1.34e-3 - 2.0*pw - WFG3_START_DELAY);
}

/* Begin transfer from HzNz to N(i)zC'(i-1)zCa(i)zCa(i-1)z */

      c13pulse("co", "cab", "sinc", 180.0, zero, 2.0e-6, 0.0);
      delay(tauNCa - tauNCo - pwCO180/2 - WFG3_START_DELAY -
            WFG3_STOP_DELAY - 2.0e-6);

                                     /* WFG3_START_DELAY */
   sim3_c13pulse("", "cab", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 2.0e-6);
      delay(tauNCa - 2.0e-6 - WFG3_STOP_DELAY);

   dec2rgpulse(pwN, zero, 0.0, 0.0);

/* End transfer from HzNz to N(i)zC'(i-1)zCa(i)zCa(i-1)z */

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

/* Begin removal of Ca(i-1) */

   c13pulse("co", "cab", "sinc", 90.0, zero, 2.0e-6, 2.0e-6);
      zgradpulse(gzlvl6, gt6);
      delay(tauCaCo - gt6 - pwCab180 - pwCO180/2 - 6.0e-6);

      c13pulse("cab","co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
   c13pulse("co","cab", "sinc", 180.0, zero, 2.0e-6, 2.0e-6);

      zgradpulse(gzlvl6, gt6);
      delay(tauCaCo - gt6 - pwCab180 - pwCO180/2 - 6.0e-6);

      c13pulse("cab","co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
   c13pulse("co", "cab", "sinc", 90.0, one, 2.0e-6, 2.0e-6);

/* End removal of Ca(i-1) */

      /* xx Selective glycine pulse xx */
      set_c13offset("gly");
      setautocal();
      if (autocal[A] == 'y')
      {
        if(FIRST_FID)
        {
         ppm = getval("dfrq"); bw=9*ppm;
         gly90 = pbox_make("gly90","eburp1",bw,0.0,compC*pwC,pwClvl);
                               /* Gly selective 90 with null at 50ppm */
        }
        pwgly=gly90.pw; glypwr=gly90.pwr; glypwrf=gly90.pwrf;
        decpwrf(glypwrf);
        decpower(glypwr);                           
        decshaped_pulse("gly90",pwgly,zero,2.0e-6,0.0);
      }
      else
      {
       decpwrf(4095.0);
       decpower(glypwr);                           
       decshaped_pulse(glyshp,pwgly,zero,2.0e-6,0.0);
      }
      /* xx End of glycine selecton xx */

      zgradpulse(gzlvl7, gt7);
      set_c13offset("cab");
      delay(gstab);
      decphase(t3);

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


/* ========== Ca to Cb transfer =========== */

   c13pulse("cab", "co", "square", 90.0, t3, 2.0e-6, 2.0e-6);
      decphase(zero);
      delay(tauCaCb - 4.0e-6);

   c13pulse("cab", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
      decphase(t2);
      delay(tauCaCb - 4.0e-6 );

/*   xxxxxxxxxxxxxxxxxxxxxx   13Cb EVOLUTION        xxxxxxxxxxxxxxxxxx    */

     c13pulse("cab", "co", "square", 90.0, t2, 2.0e-6, 0.0);      /*  pwCa90  */
     decphase(zero);

     if ((ni>1.0) && (tau1>0.0))
      {
         if (tau1 - 2.0*pwCab90/PI - WFG_START_DELAY - pwN - 2.0e-6
                 - PWRF_DELAY - POWER_DELAY > 0.0)
         {
            delay(tau1 - 2.0*pwCab90/PI - pwN - 2.0e-6 );

            dec2rgpulse(2.0*pwN, zero, 2.0e-6, 0.0);
            delay(tau1 - 2.0*pwCab90/PI  - pwN - WFG_START_DELAY
                                - 2.0e-6 - PWRF_DELAY - POWER_DELAY);
         }
         else
         {
            tsadd(t12,2,4);
            delay(2.0*tau1);
            delay(10.0e-6);                                    /* WFG_START_DELAY */
         sim3_c13pulse("", "cab", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                     zero, zero, zero, 2.0e-6, 0.0);
            delay(10.0e-6);
         }
      }
      else
      {
         tsadd(t12,2,4);
         delay(10.0e-6);                                    /* WFG_START_DELAY */
         sim3_c13pulse("", "cab", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                        zero, zero, zero, 2.0e-6, 0.0);
         delay(10.0e-6);
      }

   decphase(one);
   c13pulse("cab", "co", "square", 90.0, one, 2.0e-6, 0.0);      /*  pwCa90  */

/*   xxxxxxxxxxx End of 13Cb EVOLUTION - Start 13Ca EVOLUTION   xxxxxxxxxxxx    */

        decphase(zero);
        delay(tau2);

        sim3_c13pulse("", "co", "cab", "sinc", "", 0.0, 180.0, 2.0*pwN,
                    zero, zero, zero, 2.0e-6, 0.0);
        decphase(zero);

        delay(tauCaCb - 2*pwN - pwCab180/2 - WFG2_START_DELAY - 2.0*PWRF_DELAY -
              2.0*POWER_DELAY - WFG2_STOP_DELAY - 4.0e-6 );
   c13pulse("cab", "co", "square", 180.0, zero, 2.0e-6, 0.0);

        delay(tauCaCb- tau2 - pwCO180 - pwCab180/2 - WFG2_START_DELAY - 2.0*PWRF_DELAY
              -2.0*POWER_DELAY - WFG2_STOP_DELAY - 4.0e-6);

        c13pulse("co", "cab", "sinc", 180.0, zero, 2.0e-6, 0.0);
        decphase(t5);

   c13pulse("cab", "co", "square", 90.0, t5, 2.0e-6, 0.0);

/*   xxxxxxxxxxxxxxxxxxx End of 13Ca EVOLUTION        xxxxxxxxxxxxxxxxxx    */


      if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
      {
          dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
          dec3blank();
          setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
          dec3blank();
      }
/*  xxxxxxxxxxxxxxxxxxxx  N15 EVOLUTION & SE TRAIN   xxxxxxxxxxxxxxxxxxxxxxx  */     

      dcplrphase(zero);     dec2phase(t8);
      zgradpulse(gzlvl10, gt10);
      delay(gstab);

   dec2rgpulse(pwN, t8, 2.0e-6, 0.0);
      c13pulse("co", "cab", "sinc", 180.0, zero, 2.0e-6, 0.0); /*pwCO180*/
      decphase(zero);     dec2phase(t9);
      delay(timeTN - pwCO180 - WFG3_START_DELAY - tau3 - 4.0e-6);
                                    /* WFG3_START_DELAY  */
   sim3_c13pulse("", "cab", "co", "square", "", 0.0, 180.0, 2.0*pwN, 
                              zero, zero, t9, 2.0e-6, 2.0e-6);
     c13pulse("co", "cab", "sinc", 180.0, zero, 2.0e-6, 0.0); /*pwCO180*/

      dec2phase(t10);
      txphase(t4);

      delay(timeTN - pwCO180 + tau3 - 500.0e-6 - gt1 - 2.0*GRADIENT_DELAY-
             WFG_START_DELAY - WFG_STOP_DELAY );

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

   sim3pulse(pw, 0.0, pwN, t4, zero, t10, 0.0, 0.0);
      txphase(zero);     dec2phase(zero);
      zgradpulse(gzlvl11, gt11);
      delay(lambda - 1.3*pwN - gt11);

   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
      zgradpulse(gzlvl11, gt11);     txphase(one);
      dec2phase(t11);
      delay(lambda - 1.3*pwN - gt11);

   sim3pulse(pw, 0.0, pwN, one, zero, t11, 0.0, 0.0);
      txphase(zero);     dec2phase(zero);
      zgradpulse(gzlvl12, gt12);
      delay(lambda - 1.3*pwN - gt12);

   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
      dec2phase(zero);
      zgradpulse(gzlvl12, gt12);
      delay(lambda - 1.3*pwN - gt12);

   sim3pulse(pw, 0.0, pwN, zero, zero, zero, 0.0, 0.0);
      delay((gt1/10.0) + 1.0e-4 + 2.0*GRADIENT_DELAY + POWER_DELAY);

   rgpulse(2.0*pw, zero, 0.0, 0.0);
      dec2power(dpwr2);                           /* POWER_DELAY */
      zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */

statusdelay(C, 1.0e-4 );
   setreceiver(t12);
   if (dm3[B]=='y') lk_sample();
}
Esempio n. 11
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 */
            COrefoc[MAXSTR],
 	    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 */
            timeNCA = getval("timeNCA"),
            timeC = getval("timeC"),
            lambda = 1.0/(4.0*getval("JNH")),
            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */

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

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

    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("COrefoc",COrefoc);
    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;

   pwHs = 1.7e-3*500.0/sfrq;       /* length of H2O flipback, 1.7ms at 500 MHz*/
   widthHd = 34.0;  /* bandwidth of H1 WALTZ16 decoupling, 7.3 kHz at 600 MHz */
   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);

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

    /* the 180 pulse on CO 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 = 130.0;
	else             phshift = 130.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 ( dm3[A] == 'y' || dm3[C] == 'y' )
       { printf("incorrect dec3 decoupler flags! Should be 'nyn' or 'nnn' ");
							             psg_abort(1);}	
    if ( dpwr2 > 46 )
       { printf("dpwr2 too large! recheck value  ");		     psg_abort(1);}

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



/* PHASES AND INCREMENTED TIMES */

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

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


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


/*  Set up f2180  */

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



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

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

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



/* BEGIN PULSE SEQUENCE */

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

	rcvroff();
        set_c13offset("co");
	obsoffset(tof);
	obspower(tpwr);
 	obspwrf(4095.0);
	decpower(pwClvl);
	decpwrf(4095.0);
 	dec2power(pwNlvl);
	txphase(zero);
   	delay(1.0e-5);

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

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

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

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

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

 	rgpulse(pw, one, 0.0, 0.0);

if (TROSY[A]=='y')
   {txphase(two);
    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);
   }

        c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      /*  pwS2  */

        delay(timeNCA - timeTN - timeC);

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

	c13pulse("ca", "co", "sinc", 180.0, zero, 0.0, 0.0);
	decphase(zero);
	delay(timeNCA - timeC + 1.3*pwN);

        c13pulse("co", "ca", "sinc", 90.0, zero, 0.0, 0.0);      /*  pwS1  */
        delay(timeC);

        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, 0.0, 0.0); /*  pwS2  */
       
        delay(timeC);

        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 2.0e-6);
        c13pulse("co", "ca", "sinc", 90.0, one, 0.0, 0.0);      /*  pwS1  */        
	dec2rgpulse(pwN, zero, 0.0, 0.0);

	if (TROSY[A]=='n')   h1waltzoff("WALTZ16", widthHd, 0.0);
	zgradpulse(gzlvl3, gt3);
 	delay(2.0e-4);
        if(dm3[B] == 'y')			  /*optional 2H decoupling on */
         {dec3unblank(); dec3rgpulse(1/dmf3, one, 0.0, 0.0); 
          dec3unblank(); setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);} 
    	h1waltzon("WALTZ16", widthHd, 0.0);

/*   xxxxxxxxxxxxxxxxxxxxxx       13Ca EVOLUTION        xxxxxxxxxxxxxxxxxx    */

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

if ((ni>1.0) && (tau1>0.0))          /* total 13C evolution equals d2 exactly */
   {           

   /*  2.0*pwS1/PI compensates for evolution at 64% rate during 90 */
     if (tau1 - 2.0*pwS1/PI - WFG3_START_DELAY - 0.5*pwZ - 2.0e-6
			 	- 2.0*PWRF_DELAY - 2.0*POWER_DELAY > 0.0)
	{
	delay(tau1 - 2.0*pwS1/PI - WFG3_START_DELAY - 0.5*pwZ - 2.0e-6 - 2.0*PWRF_DELAY - 2.0*POWER_DELAY);
							 
	sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,zero, zero, zero, 2.0e-6, 0.0);
	initval(phshift, v3);
	decstepsize(1.0);
	dcplrphase(v3);  				         
	delay(tau1 - 2.0*pwS1/PI  - 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);  				        
	delay(2.0*tau1 - 4.0*pwS1/PI - SAPS_DELAY - WFG_START_DELAY - 2.0e-6 - PWRF_DELAY - POWER_DELAY);
	  } 

     /*  delay(tau1);
       sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,zero, zero, zero, 2.0e-6, 0.0);
       delay(tau1);
       c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);
       sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,zero, zero, zero, 2.0e-6, 0.0);*/ 
   }

else if (ni==1.0) 
   {
        delay(10.0e-6 + SAPS_DELAY + 0.5*pwZ1 + WFG_START_DELAY);
	sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, pwS, 2.0*pwN, zero, zero, zero, 2.0e-6, 0.0);
	initval(phshift, v3);
	decstepsize(1.0);
	dcplrphase(v3); 
	delay(10.0e-6 + WFG3_START_DELAY + 0.5*pwZ1);
   }

else	 	  
   {
        delay(10.0e-6);					  	
        c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);
	delay(10.0e-6); 

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

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

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

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

if (dm3[B] == 'y')  lk_sample();

}
pulsesequence()
{
/* DECLARE VARIABLES */

 char       satmode[MAXSTR],
	    fscuba[MAXSTR],
            cbdecseq[MAXSTR],
            chirp_shp[MAXSTR],  /* name of variable containing name of Pbox shape */
            fco180[MAXSTR],    /* Flag for checking sequence              */
            fca180[MAXSTR],    /* Flag for checking sequence              */
            sel_flg[MAXSTR];

 int         icosel,
             ni = getval("ni"),
             t1_counter;   /* used for states tppi in t1           */ 

 double      d2_init=0.0,                        /* used for states tppi in t1 */
             tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             tau3,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             taub,         /*  ~ 1/4JNH =  2.25 ms */
             zeta,        /* time for C'-N to refocuss set to 0.5*24.0 ms */
             bigTN,       /* nitrogen T period */
             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                    */             
             cophase,      /* phase correction for CO evolution  */
             caphase,      /* phase correction for Ca evolution  */
             cbpwr,        /* power level for selective CB decoupling */
             cbdmf,        /* pulse width for selective CB decoupling */
             cbres,        /* decoupling resolution of CB decoupling */
             pwS1,         /* length of  90 on Ca */
             pwS2,         /* length of  90 on CO */
             pwS3,         /* length of 180 on Ca  */
             pwS4,         /* length of 180 on CO  */
             pwS5,         /* CHIRP inversion pulse on CO and CA  */
             pwrS5=0.0,        /* power of CHIRP pulse */

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

             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 */
             compC = getval("compC"),             /* ampl. compression */

             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;


/* LOAD VARIABLES */


  getstr("satmode",satmode);
  getstr("fco180",fco180);
  getstr("fca180",fca180);
  getstr("fscuba",fscuba);

  getstr("sel_flg",sel_flg);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  zeta  = getval("zeta");
  bigTN = getval("bigTN");
  BigT1 = getval("BigT1");
  tpwr = getval("tpwr");
  satpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  cophase = getval("cophase");
  caphase = getval("caphase");

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

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

/* 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,2,phi1);
  settable(t2,2,phi2);
  settable(t3,1,phi3);
  settable(t4,8,phi4);
  settable(t5,4,phi5);
  settable(t6,8,rec);

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


  /*this section creates the chirp pulse inverting both co and ca*/
  /*Pcoca180 is the name of the shapelib file created            */
  /*chirp180 is a file produced by Pbox psg containing parameter values from shape*/

  strcpy(chirp_shp,"Pcoca180");
   if (FIRST_FID)                  /* make shape once */
    chirp180 = pbox(chirp_shp, CHIRP180, CHIRP180ps, dfrq, compC*pwC, pwClvl);
   pwrS5 = chirp180.pwr;             /* get pulse power from file */
   pwS5 = chirp180.pw;             /* get pulse width from file */

   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' || dm2[C] == 'y' ))
    {
        printf("incorrect dec2 decoupler flags! Should be 'nnn' ");
        psg_abort(1);
    }


    if( satpwr > 6 )
    {
        printf("SATPWR 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( 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)
    {
        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 ("Anlge_CO:\t%6.2f\n", angle_CO);
      printf ("Anlge_Ca:\t%6.2f\n", angle_Ca);
      printf ("Anlge_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(t1,1,4);}                                /* SC */
   else if (phase1 == 3)  { tsadd(t5,1,4); }                               /* CS */
   else if (phase1 == 4)  { tsadd(t1,1,4); tsadd(t5,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_CO/swTilt;
   tau2 = 1.0*t1_counter*cos_Ca/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) < 0.2e-6)
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((bigTN )*2.0*swTilt/cos_N)));         psg_abort(1);}


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   set_c13offset("co");		/* 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 15N hard pulses         */
   dec2pwrf(4095.0);

/* 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(one);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

   rcvroff();
   lk_hold();
   delay(20.0e-6);
   shiftedpulse("sinc", pwHs, 90.0, 0.0, one, 2.0e-6, 2.0e-6);
   txphase(zero);

   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(three); dec2phase(zero); decphase(zero); 

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

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

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

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

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

   dec2rgpulse(pwN,zero,0.0,0.0);
   decpower(pwrS5);
   delay( zeta -POWER_DELAY);
  
   dec2rgpulse(2.0*pwN,zero,0.0,0.0);
   decshapedpulse(chirp_shp, pwS5, zero, 0.0, 0.0);
   decpower(pwClvl);

   delay(zeta - pwS5 - POWER_DELAY - 2.0e-6);

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

  }

  else {

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

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

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

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

   decpower(pwrS5);
   delay( zeta - 1.34e-3 - 2.0*pw -POWER_DELAY);
  
   dec2rgpulse(2.0*pwN,zero,0.0,0.0);
   decshapedpulse(chirp_shp, pwS5, zero, 0.0, 0.0);
   decpower(pwClvl);

   delay(zeta - pwS5 - POWER_DELAY - 2.0e-6);

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

   }

   dec2phase(zero); decphase(t1);

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

/* t1 period for CO evolution */
   c13pulse("co", "ca", "sinc", 90.0, t1, 0.0, 0.0);

    if (!strcmp(fco180, "y"))
    {
      delay(10.0e-6);
      sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 2.0e-6);
      decstepsize(1.0);
      initval(cophase,v4);
      dcplrphase(v4);
      delay(10.0e-6);
    }
    else
    {
     if (tau1-2.0*pwS2/PI-pwN-WFG3_START_DELAY-POWER_DELAY-2.0e-6 > 0.0)
     {
      delay(tau1-2.0*pwS2/PI-pwN-WFG3_START_DELAY-POWER_DELAY-2.0e-6);
      sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 2.0e-6);

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

      delay(tau1-2.0*pwS2/PI-pwN-SAPS_DELAY-WFG3_STOP_DELAY-POWER_DELAY-2.0e-6);
     }
    else
     {
     c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
     }
    }

   c13pulse("co", "ca", "sinc", 90.0, zero, 4.0e-6, 0.0);
   dcplrphase(zero);

   set_c13offset("ca");   /* change Dec1 carrier to Ca (55 ppm) */
   delay(0.2e-6);
   zgradpulse(gzlvl4, gt4);
   delay(gstab);

/*  t2 period  for Ca evolution*/
 
                /* Turn on D decoupling using the third decoupler */
                dec3unblank(); dec3rgpulse(1/dmf3, one, 0.0, 0.0);
                dec3unblank(); setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
                /* Turn on D decoupling */

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

    if (!strcmp(fca180, "y"))
    {
      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);
      decstepsize(1.0);
      initval(caphase,v5);
      dcplrphase(v5);
      delay(10.0e-6);
    }
    else
    {

    if (tau2-pwN-2.0*pwS1/PI-WFG3_START_DELAY-2*POWER_DELAY-
        -WFG_STOP_DELAY-WFG_START_DELAY-2.0e-6 > 0.0)
    {
      decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1/cbdmf,cbres);
      decon();

     delay(tau2-pwN-2.0*pwS1/PI-WFG3_START_DELAY-2*POWER_DELAY-
           WFG_STOP_DELAY-WFG_START_DELAY-2.0e-6);

      decoff();
      decprgoff();

     decphase(zero); dec2phase(zero);
     decpower(pwClvl);
     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(tau2-pwN-2.0*pwS1/PI-SAPS_DELAY-WFG3_STOP_DELAY-2*POWER_DELAY-
           WFG_STOP_DELAY-WFG_START_DELAY-2.0e-6);

      decoff();
      decprgoff();

      decstepsize(1.0);
      initval(caphase,v5);
      dcplrphase(v5);

     decpower(pwClvl);

    }
     else 
     {
     c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);
     }
    }
 
   c13pulse("ca", "co", "square", 90.0, zero, 4.0e-6, 0.0);
   dcplrphase(zero);
 
                /* Turn off D decoupling */
                dec3rgpulse(1/dmf3, three, 0.0, 0.0); dec3blank();
                setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3); dec3blank();
                /* Turn off D decoupling */
 
   set_c13offset("co");   /* set carrier back to Co */

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


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

   dec2phase(t3);
   decpower(pwrS5);
   delay(bigTN - tau3 -POWER_DELAY);

   dec2rgpulse(2.0*pwN,t3,0.0,0.0);
   decshapedpulse(chirp_shp, pwS5, zero, 0.0, 0.0);
   decpower(pwClvl);

   txphase(zero);
   dec2phase(t4);

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

 
  delay(bigTN - WFG_START_DELAY - pwS5 - WFG_STOP_DELAY
         - gt5 - gstab - 2.0*GRADIENT_DELAY);

   delay(tau3);

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

   c13pulse("co", "ca", "sinc", 90.0, zero, 4.0e-6, 0.0);
      set_c13offset("ca");
   c13pulse("ca", "co", "square", 90.0, zero, 20.0e-6, 0.0);


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

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

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

   set_c13offset("co");
   delay(0.2e-6);
   zgradpulse(gzlvl6, gt6);
   delay(gstab);
   
   txphase(one);
   dec2phase(one);

   delay(taub - gt6 - gstab);

   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*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);

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

   delay(taub - gt7 - gstab);

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

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

   delay(BigT1 - gt8/2.0 - gstab - 0.5*(pwN - pw) - 2.0*pw/PI);

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

   delay(0.2e-6);
   zgradpulse(gzlvl8, gt8/2.0);
   delay(gstab);
   
   dec2power(dpwr2);
   decpower(dpwr);
   
   delay(BigT1 - gt8/2.0 - gstab - 2.0*POWER_DELAY);

lk_sample();

status(C);
         setreceiver(t6);

}
Esempio n. 13
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        sel_flg[MAXSTR], autocal[MAXSTR],
            glyshp[MAXSTR];
   
int         t1_counter,                       /* used for states tppi in t1 */
            ni = getval("ni");

double      d2_init=0.0,                      /* used for states tppi in t1 */
            tau1,         
            tau2,
            tau3,
   glypwr,glypwrf,                    /* Power levels for Cgly selective 90 */
   pwgly,                              /* Pulse width for Cgly selective 90 */
   bw,ppm,                             /* Used for autocal Cgly selective 90*/

   tauCC = getval("tauCC"),                      /* delay for Ca to Cb cosy */
   timeTN = getval("timeTN"),            /* constant time for 15N evolution */
   waltzB1 = getval("waltzB1"),
   pwC = getval("pwC"),                              /* C13 pulse at pwClvl */
   pwClvl = getval("pwClvl"),                 /* coarse power for C13 pulse */
   compC  = getval("compC"),         /* correction for amplifier compression*/
   pwCa180,
   pwCO180,
   pwCab90,
   pwCab180,

   pwS1,                                      /* length of square 90 on Cab */
   phshift = getval("phshift"),    /* phase shift on Cab by 180 on CO in t1 */
   pwS2,                                             /* length of 180 on CO */
   pwS3,
   pwS = getval("pwS"), /*used to change 180 on CO in t1 for 1D calibration */
   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 */

   sw1 = getval("sw1"),
   swCb = getval("swCb"),
   swCa = getval("swCa"),
   swN  = getval("swN"),
   swTilt,                     /* This is the sweep width of the tilt vector */

   cos_N, cos_Ca, cos_Cb,
   angle_N, angle_Ca, angle_Cb,      /* angle_N is calculated automatically */
   gstab = getval("gstab"),
   gt1 = getval("gt1"),     gzlvl1 = getval("gzlvl1"),
                            gzlvl2 = getval("gzlvl2"),
   gt3 = getval("gt3"),     gzlvl3 = getval("gzlvl3"),
   gt4 = getval("gt4"),     gzlvl4 = getval("gzlvl4"),
   gt5 = getval("gt5"),     gzlvl5 = getval("gzlvl5"),
   gt6 = getval("gt6"),     gzlvl6 = getval("gzlvl6"),
   gt7 = getval("gt7"),     gzlvl7 = getval("gzlvl7"),
   gt8 = getval("gt8"),     gzlvl8 = getval("gzlvl8");
   angle_N=0.0;

/* Load variables */
   glypwrf = getval("glypwrf");
   glypwr = getval("glypwr");
   pwgly = getval("pwgly");
   tau1 = 0;    tau2 = 0;      tau3 = 0;
   cos_N = 0;   cos_Ca = 0;    cos_Cb = 0;
   getstr("autocal", autocal);
   getstr("glyshp", glyshp);
   getstr("sel_flg",sel_flg);

/* LOAD PHASE TABLE */
   settable(t2,1,phy);    settable(t3,2,phi3);   
   settable(t5,4,phi5);   settable(t6,8,phi6);

   settable(t8,1,phy);    settable(t9,1,phx);    settable(t10,1,phx);
   settable(t11,1,phx);   settable(t12,8,recT);

/*   INITIALIZE VARIABLES   */
   lambda = 2.4e-3;

   pwCa180=c13pulsepw("ca", "co", "square", 180.0);
   pwCO180=c13pulsepw("co", "ca", "sinc", 180.0);
   pwCab90=c13pulsepw("cab","co","square",90.0);
   pwCab180=c13pulsepw("cab","co","square",180.0);

   pwHs = 1.7e-3*500.0/sfrq;       /* length of H2O flipback, 1.7ms at 500 MHz*/
   widthHd = 2.861*(waltzB1/sfrq); /* bw of H1 WALTZ16 decoupling */
   pwHd = h1dec90pw("WALTZ16", widthHd, 0.0);     /* H1 90 length for WALTZ16 */
 
/* get calculated pulse lengths of shaped C13 pulses */
   pwS1 = c13pulsepw("cab", "co", "square", 90.0); 
   pwS2 = c13pulsepw("co", "cab", "sinc", 180.0); 
   pwS3 = c13pulsepw("cab", "co", "square", 180.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;

/* CHECK VALIDITY OF PARAMETER RANGES */

    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' || dm3[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 'nyn' or 'nnn' ");
                                                psg_abort(1);}     
    if ( dpwr2 > 46 )
       { printf("dpwr2 too large! recheck value  ");               psg_abort(1);}

    if ( pw > 20.0e-6 )
       { printf(" pw too long ! recheck value ");                  psg_abort(1);} 
  
    if ( pwN > 100.0e-6 )
       { printf(" pwN too long! recheck value ");                  psg_abort(1);} 

 
/* PHASES AND INCREMENTED TIMES */

   /* Set up angles and phases */

   angle_Cb=getval("angle_Cb");  cos_Cb=cos(PI*angle_Cb/180.0);
   angle_Ca=getval("angle_Ca");  cos_Ca=cos(PI*angle_Ca/180.0);

   if ( (angle_Cb < 0) || (angle_Cb > 90) )
   {  printf ("angle_Cb 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_Cb*cos_Cb + cos_Ca*cos_Ca) )
   {
       printf ("Impossible angles.\n"); psg_abort(1);
   }
   else
   {
           cos_N=sqrt(1.0- (cos_Cb*cos_Cb + cos_Ca*cos_Ca));
           angle_N = 180.0*acos(cos_N)/PI;
   }

   swTilt=swCb*cos_Cb + swCa*cos_Ca + swN*cos_N;

   if (ix ==1)
   {

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

      if ( (0.5*ni*cos_Ca/swTilt) > (tauCC - pwCO180 - pwCab180/2 - WFG2_START_DELAY -
           2.0*PWRF_DELAY - 2.0*POWER_DELAY - WFG2_STOP_DELAY - 4.0e-6))
      { printf (" ni is too big. Make ni equal to %d or less. \n",
        (int) ((tauCC - pwCO180 - pwCab180/2 - WFG2_START_DELAY - 2.0*PWRF_DELAY
           -2.0*POWER_DELAY - WFG2_STOP_DELAY -14.0e-6)/(0.5*cos_Ca/swTilt))); 
         psg_abort(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_Cb:\t%6.2f\n", angle_Cb);
      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(t8,2,4); tsadd(t12,2,4); }

   if (phase1 == 1)  { ;}                                                  /* CC */
   else if (phase1 == 2)  { tsadd(t3,3,4); tsadd(t2,3,4);}                 /* SC */
   else if (phase1 == 3)  { tsadd(t5,1,4); }                               /* CS */
   else if (phase1 == 4)  { tsadd(t3,3,4); tsadd(t2,3,4); tsadd(t5,1,4); } /* SS */
   else { printf ("phase1 can only be 1,2,3,4. \n"); psg_abort(1); }

   if (phase2 == 2)  { tsadd(t10,2,4); icosel = +1; }                      /* N  */
            else                       icosel = -1;

   tau1 = 1.0*t1_counter*cos_Cb/swTilt;
   tau2 = 1.0*t1_counter*cos_Ca/swTilt;
   tau3 = 1.0*t1_counter*cos_N/swTilt;

   tau1 = tau1/2.0;  tau2 = tau2/2.0;  tau3 = tau3/2.0;


/* BEGIN PULSE SEQUENCE */

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

      obsoffset(tof);          obspower(tpwr);       obspwrf(4095.0);
      set_c13offset("cab");    decpower(pwClvl);     decpwrf(4095.0);
      dec2power(pwNlvl);

      txphase(one);      delay(1.0e-5);
      shiftedpulse("sinc", pwHs, 90.0, 0.0, one, 2.0e-6, 0.0);

      txphase(zero);  decphase(zero); dec2phase(zero); 
      delay(2.0e-6);

/*   xxxxxxxxxxxxxxxxxxxxxx HN to N to Ca TRANSFER xxxxxxxxxxxxxxxxxx    */

   rgpulse(pw, zero, 0.0, 0.0);                   /* 1H pulse excitation */
      dec2phase(zero);
      zgradpulse(gzlvl3, gt3);                                     /* G3 */
      delay(lambda - gt3);

   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
      if (sel_flg[A] == 'n') txphase(three);
          else txphase(one); 
      zgradpulse(gzlvl3, gt3);                                     /* G3 */
      delay(lambda - gt3);

if (sel_flg[A] == 'n') 
{
   rgpulse(pw, three, 0.0, 0.0);
                                            
      zgradpulse(gzlvl4, gt4);                       /* Crush gradient G4 */
      delay(gstab);
                                             /* Begin of N to Ca transfer */
   dec2rgpulse(pwN, zero, 0.0, 0.0);
      delay(timeTN - WFG3_START_DELAY);
}
else  /* active suppresion */
{
   rgpulse(pw,one,2.0e-6,0.0);
                                            
      initval(1.0,v6);   dec2stepsize(45.0);   dcplr2phase(v6);
      zgradpulse(gzlvl4, gt4);                       /* Crush gradient G4 */
      delay(gstab);
                                             /* Begin of N to Ca transfer */
   dec2rgpulse(pwN,zero,0.0,0.0);
      dcplr2phase(zero);                                    /* SAPS_DELAY */
      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(timeTN -1.34e-3 - 2.0*pw - WFG3_START_DELAY);
}

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

   dec2rgpulse(pwN, one, 0.0, 0.0);
/*  xxxxxxxxxxxxxxxxxxxxxxxx END of N to CA TRANSFER xxxxxxxxxxxxxxxxxxxx */


      setautocal();
      set_c13offset("gly");
      if (autocal[A] == 'n')
      {
       decpower(glypwr);    
       decpwrf(4095.0);
       decphase(zero);
       decshaped_pulse(glyshp,pwgly,zero,2.0e-6,0.0);
      }
      else
      {
        if(FIRST_FID)
        {
         ppm = getval("dfrq"); bw=9*ppm;
         gly90 = pbox_make("gly90","eburp1",bw,0.0,compC*pwC,pwClvl);
                               /* Gly selective 90 with null at 50ppm */
        }
        pwgly=gly90.pw; glypwr=gly90.pwr; glypwrf=gly90.pwrf;
        decpwrf(glypwrf);
        decpower(glypwr);                           
        decshaped_pulse("gly90",pwgly,zero,2.0e-6,0.0);
      }
      zgradpulse(gzlvl5, gt5);                       /* Crush gradient G5 */
      set_c13offset("cab");
      decphase(t3);
      delay(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);
      } 

/*   xxxxxxxxxxxxxxxxxxxxxx    13CA to 13CB TRANSFER   xxxxxxxxxxxxxxxxxx    */

     c13pulse("cab", "co", "square", 90.0, t3, 2.0e-6, 0.0);   
     decphase(zero);
     delay(tauCC);

     c13pulse("cab", "co", "square", 180.0, zero, 2.0e-6, 0.0); 
     decphase(t2);
     delay(tauCC - POWER_DELAY - PWRF_DELAY - PRG_START_DELAY);

/*   xxxxxxxxxxxxxxxxxxxxxx       13CB EVOLUTION       xxxxxxxxxxxxxxxxxx    */

   c13pulse("cab", "co", "square", 90.0, t2, 2.0e-6, 0.0);      /*  pwS1  */
      decphase(zero);

      if ((ni>1.0) && (tau1>0.0))
      {
         if (tau1 - 2.0*pwCab90/PI - WFG_START_DELAY - pwN - 2.0e-6
                 - PWRF_DELAY - POWER_DELAY > 0.0)
         {
            delay(tau1 - 2.0*pwCab90/PI - pwN - 2.0e-6 );

            dec2rgpulse(2.0*pwN, zero, 2.0e-6, 0.0);
            delay(tau1 - 2.0*pwS1/PI  - pwN - WFG_START_DELAY
                                - 2.0e-6 - PWRF_DELAY - POWER_DELAY);
         }
         else
         {
            tsadd(t12,2,4);
            delay(2.0*tau1);
            delay(10.0e-6);                                    /* WFG_START_DELAY */
         sim3_c13pulse("", "cab", "co", "square", "", 0.0, 180.0, 2.0*pwN, 
                     zero, zero, zero, 2.0e-6, 0.0);
            delay(10.0e-6);
         }
      }
      else
      {
         tsadd(t12,2,4);
         delay(10.0e-6);                                    /* WFG_START_DELAY */
         sim3_c13pulse("", "cab", "co", "square", "", 0.0, 180.0, 2.0*pwN, 
                        zero, zero, zero, 2.0e-6, 0.0);
         delay(10.0e-6);
      }

   decphase(t6);
   c13pulse("cab", "co", "square", 90.0, t6, 2.0e-6, 0.0);      /*  pwS1  */
  
/* xxxxxxxxxxxx  13CB to 13CA BACK TRANSFER - CA EVOLUTION  xxxxxxxxxxxxxx  */

         decphase(zero);
         delay(tau2);

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

         delay(tauCC- 2*pwN - pwCab180/2 - WFG2_START_DELAY - 2.0*PWRF_DELAY -
               2.0*POWER_DELAY - WFG2_STOP_DELAY - 4.0e-6 );
   c13pulse("cab", "co", "square", 180.0, zero, 2.0e-6, 0.0);

         delay(tauCC - tau2 - pwCO180 - pwCab180/2 - WFG2_START_DELAY - 2.0*PWRF_DELAY
               -2.0*POWER_DELAY - WFG2_STOP_DELAY - 4.0e-6 );

      c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);
         decphase(t5);

   c13pulse("cab", "co", "square", 90.0, t5, 2.0e-6, 0.0);      /*  pwS1  */
/* xxxxxxxxxxx  END of 13CB to 13CA BACK TRANSFER - CA EVOLUTION  xxxxxxxxxxxx */
                                               
      if (dm3[B] == 'y')                        /*optional 2H decoupling off */
      {
         dec3rgpulse(1/dmf3, three, 0.0, 0.0); dec3blank();
         setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3); dec3blank();
      }
      dec2phase(t8);

      zgradpulse(gzlvl6, gt6);                             /* Crush gradient G6 */
      delay(gstab);

/* xxxxxxxxxxxxxxxx  13CA to 15N BACK TRANSFER - 15N EVOLUTION  xxxxxxxxxxxxxx  */
                                             
   dec2rgpulse(pwN, t8, 2.0e-6, 2.0e-6);
      decphase(zero);
      dec2phase(t9);
      delay(timeTN - WFG3_START_DELAY - tau3);
                                                           /* WFG3_START_DELAY  */
   sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, t9, 2.0e-6, 2.0e-6);
      dec2phase(t10);
      delay (timeTN - pwCO180 - WFG_START_DELAY - 2.0*POWER_DELAY
        - 2.0*PWRF_DELAY - 2.0e-6 - gt1 - 2.0*GRADIENT_DELAY - gstab);

      zgradpulse(gzlvl1, gt1);                     /* 2.0*GRADIENT_DELAY */
      delay(gstab - POWER_DELAY - PWRF_DELAY);

      c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);          /*pwCO180*/
      delay(tau3);

   sim3pulse(pw, 0.0, pwN, zero, zero, t10, 0.0, 0.0);  /* t4??*/
      zgradpulse(gzlvl7, gt7);                                            /* G7 */
      txphase(zero);
      dec2phase(zero);
      delay (lambda - 1.3*pwN - gt7);

   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
      zgradpulse(gzlvl7, gt7);                                            /* G7 */
      txphase(one); 
      dec2phase(one);
      delay (lambda - 1.3*pwN - gt7);                        

   sim3pulse(pw, 0.0, pwN, one, zero, one, 0.0, 0.0);
      zgradpulse(gzlvl8, gt8);                                            /* G8 */
      txphase(zero);
      dec2phase(zero);
      delay (lambda - 1.3*pwN - gt8);

   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
      zgradpulse(gzlvl8, gt8);                                            /* G8 */
      delay (lambda - 1.3*pwN - gt8);

   sim3pulse(pw, 0.0, pwN, zero, zero, zero, 0.0, 0.0);
      dec2power(dpwr2);   decpower(dpwr);
      delay ( (gt1/10.0) + 1.0e-4 + 2.0*GRADIENT_DELAY + POWER_DELAY);  

   rgpulse(2.0*pw, zero, 0.0, 0.0);
      zgradpulse(icosel*gzlvl2, gt1/10.0);           /* 2.0*GRADIENT_DELAY */

statusdelay(C, 1.0e-4);
   setreceiver(t12);
   if (dm3[B] == 'y') lk_sample();
}
Esempio n. 14
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        cbdecseq[MAXSTR];                     /*  selective CB decoupling */

int         t1_counter,  		        /* used for states tppi in t1 */
	    ni = getval("ni");

double      d2_init=0.0,  		        /* used for states tppi in t1 */
	    tau1,         		  /* Ha, J active for 1/4 of the time */
            t1a,                       /* time increments for first dimension */
            t1b,
            t1c,
            tau2,                               /* Ca */
            tau3,                               /* CO */
	    tauCH = getval("tauCH"), 		         /* 1/4J delay for CH */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    zeta = 4.7e-3,                            /* 1/4J delay for C-CO' */
	    theta = 14.0e-3,                          /* 1/4J delay for N-CO' */
            cbpwr,                 /* power level for selective CB decoupling */
            cbdmf,                  /* pulse width for selective CB decoupling */
            cbres,                  /* decoupling resolution of CB decoupling */
           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 */

   pwCa180,
   pwCO180,

   phi7cal = getval("phi7cal"),  /* phase in degrees of the last C13 90 pulse */

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

	sw1 = getval("sw1"),

        swHa = getval("swHa"),
        swCa = getval("swCa"),
        swN  = getval("swN"),
        swTilt,                     /* This is the sweep width of the tilt vector */

        cos_N, cos_Ca, cos_Ha, 
        angle_N, angle_Ca, angle_Ha,   /* angle_N is calculated automatically */

        gstab = getval("gstab"),

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

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

/* Load variable */
        cbpwr = getval("cbpwr");
        cbdmf = getval("cbdmf");
        cbres = getval("cbres");
        tau1 = 0;
        tau2 = 0;
        tau3 = 0;
        cos_N = 0;
        cos_Ca = 0;
        cos_Ha = 0;

    getstr("cbdecseq", cbdecseq);


/*   LOAD PHASE TABLE    */

	settable(t3,1,phi3);
	settable(t4,1,phi4);
	settable(t5,2,phi5);
	settable(t6,2,phi6);

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

        

/*   INITIALIZE VARIABLES   */

 	kappa = 5.4e-3;
	lambda = 2.4e-3;


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


/* PHASES AND INCREMENTED TIMES */

   /* Set up angles and phases */

   angle_Ha=getval("angle_Ha");  cos_Ha=cos(PI*angle_Ha/180.0);
   angle_Ca=getval("angle_Ca");  cos_Ca=cos(PI*angle_Ca/180.0);

   if ( (angle_Ha < 0) || (angle_Ha > 90) )
   {  printf ("angle_Ha 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_Ha*cos_Ha + cos_Ca*cos_Ca) )
   {
       angle_N = 0.0;
       printf ("Impossible angles.\n"); psg_abort(1);
   }
   else
   {
           cos_N=sqrt(1.0- (cos_Ha*cos_Ha + cos_Ca*cos_Ca));
           angle_N = 180.0*acos(cos_N)/PI;
   }

   swTilt=swHa*cos_Ha + 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_Ha:\t%6.2f\n", angle_Ha);
      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(t8,2,4); tsadd(t12,2,4); }

   if (phase1 == 1)  { ;}                                                  /* CC */
   else if (phase1 == 2)  { tsadd(t3,1,4);}                                /* SC */
   else if (phase1 == 3)  { tsadd(t4,1,4); }                               /* CS */
   else if (phase1 == 4)  { tsadd(t3,1,4); tsadd(t4,1,4);}                 /* SS */
   else { printf ("phase1 can only be 1,2,3,4. \n"); psg_abort(1); }

   if (phase2 == 2)  { tsadd(t10,2,4); icosel = +1; }                      /* N  */
            else                       icosel = -1;

   tau1 = 1.0*t1_counter*cos_Ha/swTilt;
   tau2 = 1.0*t1_counter*cos_Ca/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 (0.5*ni*(cos_N/swTilt) > timeTN - WFG3_START_DELAY)
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((timeTN - WFG3_START_DELAY)*2.0*swTilt/cos_N)));       psg_abort(1);}

    if ( 0.5*0.25*ni*(cos_Ha/swTilt) > tauCH - 2*pwC - 2.0e-6 - gt3)
       {
         printf(" ni is too big for Ha. Make ni equal to %d or less.\n",
            (int) ((tauCH - 2*pwC - 2.0e-6 - gt3)/(0.5*0.25*cos_Ha/swTilt))  );
         psg_abort(1);
       }

    if (0.5*ni*(cos_Ca/swTilt) > zeta - gt8 - pwCa180/2
                         -pwCO180 - WFG2_START_DELAY
                 - 3.0*POWER_DELAY - 3.0*PWRF_DELAY - 4.0e-6)
       {
         printf(" ni is too big for Ca. Make ni equal to %d or less.\n",
            (int) ((zeta - gt8 - pwCa180/2 - pwCO180 - WFG2_START_DELAY
               - 3.0*POWER_DELAY - 3.0*PWRF_DELAY - 4.0e-6)/(0.5*cos_Ca/swTilt)));
         psg_abort(1);
       }


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

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

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

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

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

 if (angle_Ca == 90.0)
  {
   sheila = 0.0;
  }
 else
 {

 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;


/*   BEGIN PULSE SEQUENCE   */

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

	rcvroff();
        set_c13offset("ca");


	obspower(tpwr);
 	obspwrf(4095.0);
        obsoffset(tof);       /* tof set to water */
	decpower(pwClvl);
	decpwrf(4095.0);
 	dec2power(pwNlvl);
	txphase(one);
	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(gstab);

status(B);

      rgpulse(pw, three, 0.0, 0.0);                  /* 1H pulse excitation */
                                                                /* point a */
        txphase(zero);
        decphase(zero);
        zgradpulse(gzlvl3, gt3);                        /* 2.0*GRADIENT_DELAY */
        delay(gstab);
        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(gzlvl3, gt3);                        /* 2.0*GRADIENT_DELAY */
        txphase(t3);
        delay(gstab);
        delay(t1c);
                                                                /* point b */
        rgpulse(pw, t3, 0.0, 0.0);

      txphase(zero);        decphase(t4);

                                               /* -----------HzCz---------- */


      zgradpulse(gzlvl4, gt4);              /* Crush graidient G12*/
      delay(gstab);
                                              /* end of HzCz */
   c13pulse("ca", "co", "square", 90.0, t4, 2.0e-6, 0.0);

      decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1.0/cbdmf,cbres);
      decon(); 

      delay(tau2);
      dec2rgpulse(2*pwN, zero, 2.0e-6, 2.0e-6);

      decoff();  
      decprgoff();

      zgradpulse(gzlvl8, gt8);

      decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1.0/cbdmf,cbres);
      decon();

      delay(tauCH- gt8 - pw - 2*pwN - 6.0e-6);

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

      delay(zeta - tauCH -pw - pwCO180 - pwCa180/2 - 2.0*WFG_START_DELAY
                 - 3.0*POWER_DELAY - 3.0*PWRF_DELAY - 4.0e-6);

      decoff();
      decprgoff();

      c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);
   c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);

      zgradpulse(gzlvl8, gt8);              /* 2.0*GRADIENT_DELAY */

      decpower(cbpwr);
      decphase(zero);
      decprgon(cbdecseq,1.0/cbdmf,cbres);
      decon();

      delay(zeta - gt8 - pwCa180/2 - pwCO180 - 2.0*WFG_START_DELAY
                 - 3.0*POWER_DELAY - 3.0*PWRF_DELAY - 4.0e-6 - tau2);   /* const-time */

      decoff();
      decprgoff();

      c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);

   c13pulse("ca", "co", "square", 90.0, zero, 2.0e-6, 0.0);
                                             /* ---------CazCOz----------- */

      set_c13offset("co");   

      zgradpulse(gzlvl6, gt6);            /* Crush gradient G14 */
      delay(gstab);


      h1decon("DIPSI2", 27.0, 0.0);
      decphase(t5);
                                             /* ------- CazCOz ------------*/

   c13pulse("co", "ca", "sinc", 90.0, t5, 2.0e-6, 0.0);


      decphase(zero);
      delay(zeta - WFG_START_DELAY - 2.0*POWER_DELAY - 2.0*PWRF_DELAY - pwCa180/2 - 2.0e-6);

    c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);     

      dec2phase(zero);
      delay(theta - zeta - pwCa180/2 - WFG_START_DELAY - pwCO180/2
                                  - 2.0*POWER_DELAY - 2.0*PWRF_DELAY - 2.0e-6);

   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);                      
      dec2phase(t8);
      delay(theta - SAPS_DELAY - WFG_START_DELAY - pwCO180/2 - 4.0e-6  
                             - 2.0*POWER_DELAY - 2.0*PWRF_DELAY);

   c13pulse("co", "ca", "sinc", 90.0, zero, 2.0e-6, 0.0);
                                          /* -----------CzNz----------- */   
      dcplrphase(zero);
      h1decoff();

      zgradpulse(gzlvl7, gt7);      
      delay(gstab);

      h1decon("DIPSI2", 27.0, 0.0);
                                                  
                                          /*  -------------CzNz---------- */
    dec2rgpulse(pwN, t8, 0.0, 0.0);

	decphase(zero);
	dec2phase(t9);
	delay(timeTN - WFG3_START_DELAY - tau3);
							 /* WFG3_START_DELAY  */
	sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN, 
						zero, zero, t9, 2.0e-6, 2.0e-6);

	dec2phase(t10);


    if (tau3 > kappa + PRG_STOP_DELAY)
	{
          delay(timeTN - pwCa180 - 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); /*pwCa180*/
          delay(tau3 - kappa - PRG_STOP_DELAY - POWER_DELAY - PWRF_DELAY);
          h1decoff();		     /* POWER_DELAY+PWRF_DELAY+PRG_STOP_DELAY */
	  txphase(zero);
          delay(kappa - gt1 - 2.0*GRADIENT_DELAY - gstab);


    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  delay(gstab);
	}
    else if (tau3 > (kappa - pwCa180 - WFG_START_DELAY - 2.0*POWER_DELAY - 2.0e-6))
	{
          delay(timeTN + tau3 - kappa -PRG_STOP_DELAY -POWER_DELAY -PWRF_DELAY);
          h1decoff();		     /* POWER_DELAY+PWRF_DELAY+PRG_STOP_DELAY */
	  txphase(zero); 			/* WFG_START_DELAY  + 2.0*POWER_DELAY */
	c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0); /*pwCa180*/
          delay(kappa - pwCa180 - WFG_START_DELAY - 2.0*POWER_DELAY - 1.0e-6 - gt1 
					        - 2.0*GRADIENT_DELAY - gstab);


  zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  delay(gstab);
	}
    else if (tau3 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
	{
          delay(timeTN + tau3 - kappa -PRG_STOP_DELAY -POWER_DELAY -PWRF_DELAY);
          h1decoff();		     /* POWER_DELAY+PWRF_DELAY+PRG_STOP_DELAY */
	  txphase(zero);
          delay(kappa - tau3 - pwCa180 - WFG_START_DELAY - 2.0*POWER_DELAY
 								    - 2.0e-6);
	c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0); /*pwCa180*/
          delay(tau3 - gt1 - 2.0*GRADIENT_DELAY - gstab);


   zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  delay(gstab);
	}
    else
	{
          delay(timeTN + tau3 - kappa -PRG_STOP_DELAY -POWER_DELAY -PWRF_DELAY);
          h1decoff();		     /* POWER_DELAY+PWRF_DELAY+PRG_STOP_DELAY */
	  txphase(zero);
    	  delay(kappa - tau3 - pwCa180 - WFG_START_DELAY - 2.0*POWER_DELAY
			         - 2.0e-6 - gt1 - 2.0*GRADIENT_DELAY - gstab);

    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  delay(gstab);
	c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0); /*pwCa180*/
          delay(tau3);
	}


        sim3pulse(pw, 0.0, pwN, zero, 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*(pw + pwN) - gt5);
	      rgpulse(pw, zero, 0.0, 0.0); 
	      delay((gt1/10.0) + gstab - 0.3*pw + 2.0*GRADIENT_DELAY
							+ POWER_DELAY);  }
	rgpulse(2.0*pw, zero, 0.0, 0.0);

	dec2power(dpwr2);				       /* POWER_DELAY */
               zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */

	setreceiver(t12);
	statusdelay(C, gstab);
}	
Esempio n. 15
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 */
	    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();

}		 
Esempio n. 16
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 );

}