Esempio n. 1
0
pulsesequence()
{

/* DECLARE VARIABLES */

char	pw11[MAXSTR],	    /* off resonance 1-1 type proton excitation pulse */
	URA[MAXSTR],				  /* Setup for U-imino - U-H6 */
	CYT[MAXSTR],				  /* Setup for C-imino - C-H6 */
	CP[MAXSTR],					  /* CP H->N transfer */
	INEPT[MAXSTR],				       /* INEPT H->N transfer */
	C13refoc[MAXSTR],                         /* C13 pulse in middle of t1*/
	f1180[MAXSTR];                        /* Flag to start t1 @ halfdwell */

int	t1_counter;

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

        pwClvl = getval("pwClvl"),              /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
        rfC,                      /* maximum fine power when using pwC pulses */
	compC = getval("compC"),  /* adjustment for C13 amplifier compression */

        pwNlvl = getval("pwNlvl"),                    /* power for N15 pulses */
        pwN = getval("pwN"),          /* N15 90 degree pulse length at pwNlvl */
        rfN,                      /* maximum fine power when using pwN pulses */
        compN = getval("compN"),  /* adjustment for N15 amplifier compression */

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


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

	dof_169,		 /* dof shifted to 169 ppm for N3-C4 transfer */
	dof_140,     /* dof shifted to 140 ppm for C4-C5-C6 transfer and DEC1 */

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

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

	sw1 = getval("sw1"),
        grecov = getval("grecov"),

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

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


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

  getstr("pw11",pw11);
  getstr("URA",URA);
  getstr("CYT",CYT);
  getstr("CP",CP);
  getstr("INEPT",INEPT);
  getstr("C13refoc",C13refoc);
  getstr("f1180",f1180);


/* LOAD PHASE TABLE */
 
	settable(t1,2,phi1);
	settable(t3,8,phi3);
	settable(t4,4,phi4);
	settable(t5,16,phi5);
  if ( CP[A] == 'y' )
	settable(t10,8,rec1);
  if ( INEPT[A] == 'y' )
	settable(t10,16,rec2);


/* INITIALIZE VARIABLES */

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

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

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

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

	tof_75 = tof + 2.5*sfrq;        /* tof shifted to nH2 */
	tof_12 = tof + 7.0*sfrq;	/* tof shifted to nH */
	dof_169 = dof + 59*dfrq;	/* dof shifted to C4 */
	dof_140 = dof + 30*dfrq;	/* dof shifted to C6 */
	dof2_160 = dof2 - 40*dfrq2;	/* dof2 shifted to Nh */
	dof2_97 = dof2 - 103*dfrq2;     /* dof2 shifted to Nh2 */

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

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

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

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

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

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

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

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

  if (CP[A] == 'y')
   {
    if (ncyc_hn > 0 )
        printf("HN-mixing time is %f ms.\n",(ncyc_hn*51.8*2*p_d));
   }

/* PHASES AND INCREMENTED TIMES */

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

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

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

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

/*  Set up f1180  */

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


/* CHECK VALIDITY OF PARAMETER RANGE */


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

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

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

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

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

    if( ((dm[C] == 'y') && (dm2[C] == 'y') && (at > 0.18)) )
    {
        text_error("check at time! Don't fry probe !! ");
        psg_abort(1);
    }

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

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

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

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

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

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

    if( (CP[A] == 'y') && (INEPT[A] == 'y') )
    {
        text_error("Choose either CP or INEPT for H->N transfer !! ");
        psg_abort(1);
    }

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

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

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

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

    if( (URA[A] == 'y') && (CP[A] == 'y') )
    {
        printf("Remember that CP covers just 3.8 ppm !!! ");
    }


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

        rcvroff();

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

  if (URA[A] == 'y')
   {
        obsoffset(tof_12);	/* Set the proton frequency to U-nH */
        dec2offset(dof2_160);   /* Set the nitrogen frequency to U-Nh */
   }
  else if (CYT[A] == 'y')
   {
        obsoffset(tof_75);      /* Set the proton frequency to C-nH2 */
	dec2offset(dof2_97);    /* Set the nitrogen frequency to C-Nh2 */
   }
  else
   {
   }

        decoffset(dof_169);	/* Preset the carbon frequency for the NC-tocsy */

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

        delay(d1);

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

  if (CP[A] == 'y')
	initval(ncyc_hn,v12);

	initval(ncyc_nc,v11);

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

  if(pw11[A] == 'y')
   {
        rgpulse(pw/2, t1, 50.0e-6, 0.0);
	if (URA[A] == 'y')
		delay(1/(2*(tof_12-tof)));
	else if (CYT[A] == 'y')
        	delay(1/(2*(tof_75-tof)));
	else
		delay(1/(2*(tof_75-tof)));
        rgpulse(pw/2, t1, 0.0, 0.0);
   }

  else
   {
	rgpulse(pw, t1, 50.0e-6, 0.0);
   }
	txphase(zero);

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

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

  if (INEPT[A] == 'y')
   {
	delay(lambdaN);

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

	delay(lambdaN - SAPS_DELAY);

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

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

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

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

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

  else if (CP[A] == 'y')
   {
        obspwrf(rfdH);          /* Set fine power for proton */
        decpwrf(rfdC);          /* Preset fine power for carbon */
        dec2pwrf(rfdN);         /* Set fine power for nitrogen */
        delay(2.0e-6);
        starthardloop(v12);
    sim3pulse(6.4*p_d,0.0,6.4*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(8.2*p_d,0.0,8.2*p_d,two,two,two,0.0,0.0);
    sim3pulse(5.8*p_d,0.0,5.8*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(5.7*p_d,0.0,5.7*p_d,two,two,two,0.0,0.0);
    sim3pulse(0.6*p_d,0.0,0.6*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(4.9*p_d,0.0,4.9*p_d,two,two,two,0.0,0.0);
    sim3pulse(7.5*p_d,0.0,7.5*p_d,zero,zero,zero,0.0,0.0);
    sim3pulse(5.3*p_d,0.0,5.3*p_d,two,two,two,0.0,0.0);
    sim3pulse(7.4*p_d,0.0,7.4*p_d,zero,zero,zero,0.0,0.0);

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

	dec2phase(zero);
        decphase(zero);

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

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

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

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

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

	obsoffset(tof);
	decoffset(dof_140);

	txphase(zero);
	decphase(one);

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

	decrgpulse(pwC,t3,0.0,0.0);  /* flip transferred 13C-magnetization to x */
	decphase(zero);
	zgradpulse(gzlvl5,gt5);

	delay(tCC - SAPS_DELAY - gt5);
        decrgpulse(2*pwC,zero,0.0,0.0);
        zgradpulse(gzlvl5,gt5);
        delay(tCC - gt5);

	decrgpulse(pwC,zero,0.0,0.0);  /* flip transferred 13C-magnetization to x */
	decphase(zero);
	zgradpulse(gzlvl5,gt5);

	delay(tCC - SAPS_DELAY - gt5);
	decrgpulse(2*pwC,zero,0.0,0.0);  
	zgradpulse(gzlvl5,gt5);
	delay(tCC - gt5);

	decrgpulse(pwC,zero,0.0,0.0);  /* flip transferred 13C-magnetization to x */
	decphase(zero);
	delay(tCC - SAPS_DELAY);
	decrgpulse(2*pwC,zero,0.0,0.0);
	delay(tCC - lambda - pw);
	rgpulse(2*pw,zero,0.0,0.0);  /* Invert water signal */
	delay(lambda - pw);
	decrgpulse(pwC,zero,0.0,0.0);

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

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

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

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

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

        rgpulse(pwHs2, two, 0.0, 0.0);
        decphase(t4);

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

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

status(C);
	rcvron();

 setreceiver(t10);
}
Esempio n. 2
0
pulsesequence()

{

/* DECLARE VARIABLES */	

char	scuba[MAXSTR],	
	mess_flg[MAXSTR],
	imino[MAXSTR],
	amino[MAXSTR],
	jumpret[MAXSTR],
	C13refoc[MAXSTR];

int	phase,
	t1_counter;

double	hscuba,		/* length of 1/2 SCUBA delay 	*/
	taunh,		/* 1/4J(NH)			*/
	tofps,		/* water frequency		*/
	tpwrmess,	/* power level for Messerlie purge */
	dly_pg,		/* Messerlie purge delay	*/
	pwClvl,		/* power level for 13C hard pulse */
	pwNlvl,		/* power level for 15N hard pulse */
	pwC,		/* pulse width for 13C hard pulse */
	pwN,		/* pulse width for 15N hard pulse */
	JNH,		/* coupling for NH		*/
	diff,		/* freq diff H2O & exit center	*/
	dof2a,		/* offset for imino/amino	*/
	tau1,		/* t1/2				*/
	grecov,		/* gradient recovery time 	*/
	gzlvl0,		/* level of grad. for purge	*/
	gzlvl1,		/* level of grad. for 1/2J	*/
	gt1,		/* grad. duration for 1/2J	*/
	gzlvlr;		/* level of RDt1-gradient (0.5G) */

/* LOAD VARIABLES */

	JNH	= getval("JNH");
	diff	= getval("diff");
	pwC	= getval("pwC");
	pwN	= getval("pwN");
	tofps	= getval("tofps");
	tpwrmess= getval("tpwrmess");
	dly_pg	= getval("dly_pg");
	pwClvl	= getval("pwClvl");
	pwNlvl	= getval("pwNlvl");
	hscuba	= getval("hscuba");
	phase	= (int)(getval("phase") + 0.5);
	sw1	= getval("sw1");
	at	= getval("at");
	grecov	= getval("grecov");
	gt1	= getval("gt1");
	gzlvl0	= getval("gzlvl0");
	gzlvl1	= getval("gzlvl1");
	gzlvlr  = getval("gzlvlr");

	getstr("scuba",scuba);
	getstr("mess_flg",mess_flg);
	getstr("imino",imino);
	getstr("amino",amino);
        getstr("jumpret",jumpret);
	getstr("C13refoc",C13refoc);

/* CHECK VALIDITY OF PARAMETER RANGE */

  if (dm[A] == 'y' || dm[B] == 'y')
   {
	printf(" dm must be 'nny' or 'nnn' ");
	psg_abort(1);
   }

  if ((dm[C] == 'y' || dm2[C] == 'y') && at > 0.21)
   {
	printf(" check at time! Don't fry probe \n");
	psg_abort(1);
   }

  if (dm2[A] == 'y' || dm2[B] == 'y')
   {
	printf(" dm2 must be 'nny' or 'nnn' ");
	psg_abort(1);
   }

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

  if ((satmode[A] == 'y') && (jumpret[A] == 'y'))
   {
	printf(" Choose EITHER presat (satmode='y') OR Jump-Return (jumpret='y') \n");
	psg_abort(1);
   }

  if (satpwr > 12)
   {
	printf(" satpwr must be less than 13 \n");
	psg_abort(1);
   }

  if (tpwrmess > 55)
   {
	printf(" tpwrmess must be less than 55 \n");
	psg_abort(1);
   }

  if (dly_pg > 0.010)
   {
	printf(" dly_pg must be less than 10msec \n");
	psg_abort(1);
   }

  if (dpwr > 50)
   {
	printf(" dpwr must be less than 49 \n");
	psg_abort(1);
   }

  if (dpwr2 > 50)
   {
	printf(" dpwr2 must be less than 46 \n");
	psg_abort(1);
   }

  if (gt1 > 5.0e-3)
   {
	printf(" gti must be less than 5msec \n");
	psg_abort(1);
   }

  if (gzlvl0 > 32768 || gzlvl1 > 32768 || gzlvl0 < -32768 || gzlvl1 < -32768)
   {
	printf(" gzlvli must be -32768 to 32768 (30G/cm) \n");
	psg_abort(1);
   }

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

/* LOAD PHASE PARAMETERS */

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

/* INITIALIZE VARIABLES */

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

	dof2a = dof2;
/* IMINO-region setting of dof2 */
	if (imino[A] == 'y')
		dof2a = dof2 - 45*dfrq2;

/* AMINO-region setting of dof2 */
	else if (amino[A] == 'y')
		dof2a = dof2 - 115*dfrq2;

/* Phase incrementation for hyper complex data in t1 */

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

/* Calculate modification to phase based on current t1 values: 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(t5, 2, 4);
   }

/* Set up so that you get (90, -180) phase correction in F1 */

	tau1 = d2;
	tau1 = tau1 -(4.0/PI)*pwN;
        tau1 = tau1 / 2.0;


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

	obspower(satpwr);	/* Set power for presaturation	*/
	decpower(pwClvl);	/* Set DEC1 power to pwClvl	*/
	dec2power(pwNlvl);	/* Set DEC2 power to pwNlvl	*/

	obsoffset(tof);
	decoffset(dof);
	dec2offset(dof2a);


  if (mess_flg[A] == 'y')	/* Option for Messerlie purge */
   {
	obsoffset(tofps);
	obspower(tpwrmess);
	txphase(zero);
	xmtron();
	delay(dly_pg);
	xmtroff();
	txphase(one);
	xmtron();
	delay(dly_pg/1.62);
	xmtroff();
	obsoffset(tof);
	obspower(satpwr);
   }

  if (satmode[A] == 'y')		/* Presaturation Period */
   {
	txphase(zero);
	xmtron();		/* presaturation using transmitter	*/
	delay(d1);
	xmtroff();
	obspower(tpwr);		/* set power for hard pulse	*/

  if (scuba[A] == 'y')		/* SCUBA pulse	*/
   {
	hsdelay(hscuba);
	rgpulse(pw, zero, rof1, 0.0);
	rgpulse(2*pw, one, rof1, 0.0);
	rgpulse(pw, zero, rof1, 0.0);
	delay(hscuba);
   }
   }

  else 
   {
	obspower(tpwr);
	delay(d1);
   }

        dec2rgpulse(pwN,zero, 0.0, 0.0); /* destroy N15 magnetization */
        zgradpulse(gzlvl0, 0.5e-3);
        delay(1.0e-4);
        dec2rgpulse(pwN, one, 0.0, 0.0);
        zgradpulse(0.7*gzlvl0, 0.5e-3);
        decphase(t2);
        delay(grecov);

status(B);

  if (jumpret[A] == 'y')
   {
	rgpulse(pw, zero, rof1, rof1);	/* jump-return pulse */
	delay(0.25 / diff - 2.0*rof1);
	rgpulse(pw, two, rof1, rof1);
   }

  else
        rgpulse(pw, zero, rof1, rof1);

        zgradpulse(gzlvl1,gt1);
        delay(taunh - gt1 - 2.0*GRADIENT_DELAY );	/* delay = 1.0/2J(NH) */
        delay(taunh);
	dec2rgpulse(pwN, t2, 0.0, 0.0);
	dec2phase(t4);

 if (jumpret[A] == 'y')
  {
         tau1 = tau1-(pw+rof1+0.25/diff) ;
         if (tau1 < 0.0)  tau1 = 0.0;
      
        if (tau1 > 0.001)
         {
              zgradpulse(gzlvlr,(0.4*tau1-2.0*GRADIENT_DELAY));  /* delay = t1/2 */
              delay(0.1*tau1);
              zgradpulse(-gzlvlr,(0.4*tau1-2.0*GRADIENT_DELAY));
              delay(0.1*tau1);
         }
        else
             delay(tau1);				/* delay = t1/2 */
	rgpulse(pw, t1, rof1, rof1);

	if (C13refoc[A] == 'y')
	{
	delay((0.25 / diff) - pwC -rof1 );
	decrgpulse(2*pwC, zero, 0.0, 0.0);
	delay((0.25 / diff) - pwC -rof1) ;
   	}

  	else
   	{
	delay(0.25 / diff);
	delay(0.25 / diff);
   	}
	rgpulse(pw, t3, rof1, rof1);
        txphase(zero);
     if (tau1 > 0.001)
      {
        zgradpulse(gzlvlr,(0.4*tau1-2.0*GRADIENT_DELAY));  /* delay = t1/2 */
        delay(0.1*tau1);
        zgradpulse(-gzlvlr,(0.4*tau1-2.0*GRADIENT_DELAY));
        delay(0.1*tau1);
      }
     else
        delay(tau1);                               /* delay = t1/2 */
  }
else
  {
     if (C13refoc[A] == 'y')
         tau1 = tau1-(pwC+rof1) ;
     else
         tau1 = tau1-(pw+rof1) ;

     if (tau1 < 0.0)  tau1 = 0.0;
     if (tau1 > 0.001)
      {
        zgradpulse(gzlvlr,(0.4*tau1-2.0*GRADIENT_DELAY));  /* delay = t1/2 */
        delay(0.1*tau1);
        zgradpulse(-gzlvlr,(0.4*tau1-2.0*GRADIENT_DELAY));
        delay(0.1*tau1);
      }
     else
	delay(tau1);				/* delay = t1/2 */

     if (C13refoc[A] == 'y')
       simpulse(2*pw, 2*pwC, t1, zero, rof1, rof1);
     else
       rgpulse(2*pw, t1, rof1, rof1);
      txphase(zero);
	 
     if (tau1 > (4.0*GRADIENT_DELAY + 0.64*pw + rof1))
      {
        if (tau1 > 0.001)
        {
         zgradpulse(gzlvlr,(0.4*tau1-2.0*GRADIENT_DELAY));  /* delay = t1/2 */
         delay(0.1*tau1);
         zgradpulse(-gzlvlr,(0.4*tau1-2.0*GRADIENT_DELAY));
         delay(0.1*tau1);
        }
        else
         delay(tau1);
      }
     else
        delay(tau1);                               /* delay = t1/2 */
}
	dec2rgpulse(pwN, t4, 0.0, 0.0);

	zgradpulse(gzlvl1,gt1);
	decpower(dpwr);			/* low power for decoupling */
	dec2power(dpwr2);
	delay(taunh - gt1 - 2.0*GRADIENT_DELAY-2.0*POWER_DELAY);		/* delay = 1/2J(NH) */
        delay(taunh);
status(C);

	setreceiver(t5);
}
Esempio n. 3
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 );

}		 
Esempio n. 4
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          SE_flg[MAXSTR],
          href_flg[MAXSTR];    

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


   double d2_init=0.0,
          d3_init=0.0,
          pwS1,pwS2,pwS3,pwS4,pwS5,pwS6,
          lambda = getval("lambda"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gzlvl5 = getval("gzlvl5"), 
          gzlvl6 = getval("gzlvl6"), 
          gt1 = getval("gt1"),
/*        gt2 = getval("gt2"), */
          gt3 = getval("gt3"),
          gt5 = getval("gt5"),
          gt6 = getval("gt6"),
          gstab = getval("gstab"),
          shlvl1 = getval("shlvl1"),
          shpw1 = getval("shpw1"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          dpwr2 = getval("dpwr2"),
          d2 = getval("d2"),
          timeTN = getval("timeTN"),
          tau1 = getval("tau1"),
          tau2 = getval("tau2"),
          taunh = getval("taunh");

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



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

/*   INITIALIZE VARIABLES   */

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


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



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

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

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

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

  
    


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

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



   status(A);
      rcvroff();  

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


     zgradpulse(gzlvl6, gt6);
       delay(1.0e-4);

       delay(d1-gt6);
lk_hold();

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

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

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

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

        h_shapedpulse("pc9f_",4.0,3.5,one, 0.0, 0.0);  


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

           zgradpulse(gzlvl3, gt3);
           delay(timeTN-pwS2*0.5-gt3);

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

        if (href_flg[0] == 'y') 
        {
           delay(timeTN-pwS2*0.5-taunh*0.5-shpw1);
           shaped_pulse(shname1,shpw1,two,0.0,0.0);
           zgradpulse(gzlvl3, gt3);
           delay(taunh*0.5-gt3);
     dec2rgpulse(pwN,zero,0.0,0.0);				     
        }
        else
        {
           delay(timeTN-pwS2*0.5-taunh*0.5);
           zgradpulse(gzlvl3, gt3);
           delay(taunh*0.5-gt3);
     dec2rgpulse(pwN,one,0.0,0.0);				     
        }
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION        xxxxxxxxxxxxxxxxxx    */
/**************************************************************************/
   
	c13pulse("co", "ca", "sinc", 90.0, t1, 2.0e-6, 0.0);       
        delay(tau1*0.5);
        sim3_c13pulse(shname1, "ca", "co", "square", "", shpw1, 180.0, 2.0*pwN,
                                                  zero, zero, zero, 2.0e-6, 0.0);
        delay(tau1*0.5);
	c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);      
        sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 0.0,
                                                  one, zero, zero, 2.0e-6, 0.0);
        if (pwN*2.0 > pwS3) delay(pwN*2.0-pwS3);
	c13pulse("co", "ca", "sinc", 90.0, zero, 0.0, 0.0);       

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

   obspower(tpwr);
        if (href_flg[0] == 'y') 
         {
          shaped_pulse(shname1,shpw1,two,0.0,0.0);
     dec2rgpulse(pwN,t3,0.0,0.0);
         }
        else 
     dec2rgpulse(pwN,t5,0.0,0.0);

      if (SE_flg[0] == 'y')
      {
        if (href_flg[0] == 'y')
        {
           delay(tau2*0.5);
	c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);       
          delay(taunh*0.5-pwS3);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
        delay(timeTN-pwS2*0.5-shpw1-taunh*0.5-gt1-1.0e-4);
        }
        else
        {
           delay(tau2*0.5);
        sim_c13pulse(shname1,"ca", "co", "square",shpw1, 180.0, two,zero, 0.0, 0.0);
          if (shpw1 >= pwS3) delay(taunh*0.5-shpw1);
          else  delay(taunh*0.5-pwS3);
        delay(timeTN-pwS2*0.5-taunh*0.5-gt1-1.0e-4);
        }
 
        zgradpulse(-gzlvl1, gt1);
        delay(1.0e-4);

      sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
           delay(timeTN-pwS2*0.5-tau2*0.5-pwS4);
        h_shapedpulse("eburp2",4.0,3.5,zero, 2.0e-6, 0.0); 
	dec2rgpulse(pwN, t10, 0.0, 0.0);
      }
      else
      {
        if (href_flg[0] == 'y')
        {
           delay(tau2*0.5);
	c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);       
          delay(taunh*0.5-pwS3);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
        delay(timeTN-pwS2*0.5-shpw1-taunh*0.5);
        }
        else
        {
           delay(tau2*0.5);
        sim_c13pulse(shname1,"ca", "co", "square",shpw1, 180.0, two,zero, 0.0, 0.0);
         if (shpw1 >= pwS3)   delay(taunh*0.5-shpw1);
         else  delay(taunh*0.5-pwS3);
        delay(timeTN-pwS2*0.5-taunh*0.5);
        }

      sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                                             zero, zero, zero, 2.0e-6, 2.0e-6);
       delay(timeTN-pwS2*0.5-tau2*0.5);
       dec2rgpulse(pwN, zero, 0.0, 0.0);
      }

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

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

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

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

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

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

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

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


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

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

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

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

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

}		 
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()
{



/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
	    rna_stCdec[MAXSTR],	       /* calls STUD+ waveforms from shapelib */
	    STUD[MAXSTR];   /* apply automatically calculated STUD decoupling */
 
int         icosel1,          			  /* used to get n and p type */
	    icosel2,
            t1_counter,  		        /* used for states tppi in t1 */
            t2_counter,  	 	        /* used for states tppi in t2 */
	    ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
	    del = getval("del"),     /* time delays for CH coupling evolution */
	    del1 = getval("del1"),
	    del2 = getval("del2"),
/* STUD+ waveforms automatically calculated by macro "rnacal" */
/* and string parameter rna_stCdec calls them from your shapelib.*/
   stdmf,                              		   /* dmf for STUD decoupling */
   studlvl,	                         /* coarse power for STUD+ decoupling */
   rf80 = getval("rf80"), 			  /* rf in Hz for 80ppm STUD+ */

	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	rfC,            	  /* maximum fine power when using pwC pulses */
	dofa,                             /* dof shifted to 80 ppm for ribose */

/* p_d is used to calculate the isotropic mixing on the Cab region */
        p_d,                   	        /* 50 degree pulse for DIPSI-3 at rfd */
        rfd,                   			     /* fine power for 35 ppm */
	ncyc = getval("ncyc"), 			  /* no. of cycles of DIPSI-3 */

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


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

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

 grecov = getval("grecov"),   /* Gradient recovery delay, typically 150-200us */

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

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

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

/*   LOAD PHASE TABLE    */

	settable(t3,2,phi3);
	settable(t6,1,phi6);
	settable(t5,4,phi5);
	settable(t10,1,phi10);
	settable(t11,4,rec);

        

/*   INITIALIZE VARIABLES   */

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

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

/*  Center dof in RIBOSE region on 80 ppm. */
        dofa = dof - 30.0*dfrq;
		
/* dipsi-3 decoupling C-ribose */
 	p_d = (5.0)/(9.0*4.0*7000.0*(sfrq/800.0)); /* DIPSI-3 covers 35 ppm */
 	rfd = (compC*4095.0*pwC*5.0)/(p_d*9.0);
	rfd = (int) (rfd + 0.5);
  	ncyc = (int) (ncyc + 0.5);

/* 80 ppm STUD+ decoupling */
        strcpy(rna_stCdec, "wurst80");
	stdmf = getval("dmf80");
        studlvl = pwClvl + 20.0*log10(compC*pwC*4.0*rf80);
        studlvl = (int) (studlvl + 0.5);


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

  if( (((dm[C] == 'y') && (dm2[C] == 'y')) && (STUD[A] == 'y')) )
  { text_error("incorrect dec2 decoupler flags! Should be 'nnn' if STUD='y'"); psg_abort(1); }

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

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

  if( (pw > 20.0e-6) && (tpwr > 56) )
  { text_error("don't fry the probe, pw too high ! "); psg_abort(1); }

  if( (pwC > 40.0e-6) && (pwClvl > 56) )
  { text_error("don't fry the probe, pwN too high ! "); psg_abort(1); }

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

  if ((dm3[B] == 'y'  &&   dpwr3 > 44 ))
  { text_error ("Deuterium decoupling power too high ! "); psg_abort(1); }

  if ((ncyc > 1 ) && (ix == 1))
  { text_error("mixing time is %f ms.\n",(ncyc*97.8*4*p_d)); }


/* PHASES AND INCREMENTED TIMES */

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

    icosel1 = -1;  icosel2 = -1;
    if (phase1 == 2) 
	{ tsadd(t6,2,4); icosel1 = -1*icosel1; }
    if (phase2 == 2) 
	{ tsadd(t10,2,4); icosel2 = -1*icosel2; tsadd(t6,2,4); }


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


/*  Set up f2180  */

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



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

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

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



/*   BEGIN PULSE SEQUENCE   */

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

	rcvroff();
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rfC);
	obsoffset(tof);
        decoffset(dofa);
        dec2offset(dof2);
	txphase(t3);
	delay(1.0e-5);

	decrgpulse(pwC, zero, 0.0, 0.0);	   /*destroy C13 magnetization*/
	zgradpulse(gzlvl1, 0.5e-3);
	delay(grecov/2);
	decrgpulse(pwC, one, 0.0, 0.0);
	zgradpulse(0.7*gzlvl1, 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, t3, 0.0, 0.0);                    /* 1H pulse excitation */

        decphase(zero);
	delay(0.5*del + tau1 - 2.0*pwC);

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

        txphase(zero);
	delay(tau1);

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

	zgradpulse(icosel1*gzlvl1, 0.1*gt1);
        decphase(t5);
	delay(0.5*del - 0.1*gt1);

	simpulse(pw, pwC, zero, t5, 0.0, 0.0);

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

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

	zgradpulse(gzlvl3, gt3);
        txphase(t6);
        decphase(one);
	delay(0.5*del2 - gt3);

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

	zgradpulse(gzlvl4, gt3);
        txphase(zero);
        decphase(zero);
	delay(0.5*del1 - gt3);

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

	zgradpulse(gzlvl4, gt3);
	delay(0.5*del1 - gt3);

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

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

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

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

        dec2phase(zero);
        decphase(zero);
        txphase(zero);
	decpwrf(rfC);
	delay(tau2);

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

	delay(tau2);
	decpwrf(rfC);
	zgradpulse(-icosel2*gzlvl2, 1.8*gt1);
	delay(grecov+2.0e-6);

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

	decpwrf(rfC);
	zgradpulse(icosel2*gzlvl2, 1.8*gt1);
	delay(grecov + pwN);

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

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

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

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

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

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

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

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

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

	delay(0.5*del - 0.5*pwC);

	simpulse(2.0*pw,2.0*pwC, zero, zero, 0.0, 0.0);
   if (STUD[A]=='y') decpower(studlvl);

   else
    {
	decpower(dpwr);
	dec2power(dpwr2);
    }
	zgradpulse(gzlvl1, gt1);         		/* 2.0*GRADIENT_DELAY */
   if(dm3[B] == 'y') 
	delay(0.5*del - gt1 -1/dmf3 - 2.0*GRADIENT_DELAY - POWER_DELAY);
      else
	delay(0.5*del - gt1 - 2.0*GRADIENT_DELAY - POWER_DELAY);
   if(dm3[B] == 'y')			         /*optional 2H decoupling off */
        {
          dec3rgpulse(1/dmf3, three, 0.0, 0.0); dec3blank();
          setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
          dec3blank();
        }
	decpower(dpwr);				               /* POWER_DELAY */
  if (dm3[B]=='y') lk_sample();
  if ((STUD[A]=='y') && (dm[C] == 'y'))
        {decpower(studlvl);
         decunblank();
         decon();
         decprgon(rna_stCdec,1/stdmf, 1.0);
         startacq(alfa);
         acquire(np, 1.0/sw);
         decprgoff();
         decoff();
         decblank();
        }
      else
	 status(C);
 setreceiver(t11);
}		 
Esempio n. 7
0
pulsesequence()
{

/* DECLARE VARIABLES */


char    imino[MAXSTR],				/* Sets dof2 for imino region */
        amino[MAXSTR],				/* Sets dof2 for amino region */
	f1180[MAXSTR];                        /* Flag to start t1 @ halfdwell */

int     icosel,                                   /* used to get n and p type */
        t1_counter;         

double      tau1,                                                /*  t1 delay */
	    lambdaN = 0.94/(4.0*getval("JNH")),       /* 1/4J N-H INEPT delay */
	    lambdaN_int,			    /* interval in CPMG train */

        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 */
        dof2a,                                      /* offset for imino/amino */


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

	ncyc = getval("ncyc"),	   	    /* number of cycles in CPMG train */

	sw1 = getval("sw1"),
        grecov = getval("grecov"),

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

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

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

  gzlvl0 = getval("gzlvl0"),
  gzlvl3 = getval("gzlvl3"),
  gt3 = getval("gt3");

  getstr("imino",imino);
  getstr("amino",amino);
  getstr("f1180",f1180);


/* LOAD PHASE TABLE */
 
	settable(t1,1,phi1);
	settable(t2,2,phi2);
	settable(t3,1,phi3);
	settable(t9,8,phi9);
	settable(t10,1,phi10);
        settable(t11,1,phi11);
        settable(t12,1,phi12);
        settable(t13,1,phi13);
	settable(t14,4,rec);

/* INITIALIZE VARIABLES */

/* IMINO-region setting of dof2 */
        if (imino[A] == 'y')
                dof2a = dof2 - 45*dfrq2;

/* AMINO-region setting of dof2 */
        else if (amino[A] == 'y')
                dof2a = dof2 - 115*dfrq2;

        else
                dof2a = dof;

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

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

/* number of cycles and mixing time */
        ncyc = (int) (ncyc + 0.5);


/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 1)
         { 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(t14,2,4); }

/*  Set up f1180  */

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


/* CHECK VALIDITY OF PARAMETER RANGE */


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

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

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

    if( ((dm[C] == 'y') && (dm2[C] == 'y') && (at > 0.18)) )
    {
        text_error("check at time! Don't fry probe !! ");
        psg_abort(1);
    }

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

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

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

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

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

    if (ncyc > 24)
    {
        printf("CPMG heating! Reduce no. of ncyc!! ");
    }



/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

        rcvroff();

        obspower(tpwr);
        decpower(pwClvl);
        dec2power(pwNlvl);

        obsoffset(tof);         /* Set the proton frequency to H2O */
	dec2offset(dof2a);      /* Set the nitrogen frequency to Nh2 or Nh */
        decoffset(dof);		/* Set the carbon frequency for decoupling */

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

        delay(d1);

        dec2rgpulse(pwN, zero, 0.0, 0.0);  /*destroy N15 magnetization*/
        zgradpulse(gzlvl0, 0.5e-3);
        delay(grecov/2);
        dec2rgpulse(pwN, one, 0.0, 0.0);
        zgradpulse(0.7*gzlvl0, 0.5e-3);

	initval(ncyc,v1);
	lambdaN_int = ((2.0*lambdaN)/(2*ncyc));

        dec2phase(zero);
        delay(5.0e-4);
        rcvroff();

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

	assign(zero,v5);

  if ( ncyc > 0 )
   {
        loop(v1,v14);

        assign(v5,v6);   /* v6 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9*/
        hlv(v5,v7);      /* v7 = 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, */
        hlv(v7,v8);      /* v7 = 0, 0, 0, 0, 1, 1, 1, 1, 2, 2 */
        mod2(v6,v6);     /* v6 = 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 */
        mod2(v8,v8);     /* v7 = 0, 0, 0, 0, 1, 1, 1, 1, 0, 0 */
        add(v6,v8,v9);   /* v9 = 0, 1, 0, 1, 1, 2, 1, 2, 0, 1 */
        mod2(v9,v9);     /* v9 = 0, 1, 0, 1, 1, 0, 1, 0, 0, 1*/
        hlv(v8,v10);     /* v7 = 0, 0, 0, 0, 0, 0, 0, 0,
                                 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 */
        mod2(v10,v10);   /* v10 = 0, 0, 0, 0, 0, 0, 0, 0,
                                  1, 1, 1, 1, 1, 1, 1, 1)*/
        dbl(v10,v10);    /* v10 = 0, 0, 0, 0, 0, 0, 0, 0,
                                  2, 2, 2, 2, 2, 2, 2, 2)*/
        add(v9,v10,v11); /* v11 = 0, 1, 0, 1, 1, 0, 1, 0,
                                  2, 3, 2, 3, 3, 2, 3, 2)*/
        incr(v5);        /* increment v5 by 1 */
        txphase(v11);
        decphase(v11);
        delay(lambdaN_int);
        sim3pulse(2*pw,0.0,2.0*pwN,v11,zero,v11,0.0,0.0);
        delay(lambdaN_int);

        endloop(v14);
	txphase(t1);
   }

	rgpulse(pw,t1,0.0, 0.0);
        txphase(one);
	dec2phase(t2);

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

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

	dec2rgpulse(pwN,t2,0.0,0.0);
	dec2phase(t9);

	delay(tau1);
	rgpulse(2.0*pw, t11, 0.0, 0.0);
	delay(tau1);

        delay(gt1 + grecov - 2.0*pw - SAPS_DELAY);

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

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


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

        assign(zero,v5);

  if ( ncyc > 0 )
   {
        loop(v1,v14);

        assign(v5,v6);   /* v6 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9*/
        hlv(v5,v7);      /* v7 = 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, */
        hlv(v7,v8);      /* v7 = 0, 0, 0, 0, 1, 1, 1, 1, 2, 2 */
        mod2(v6,v6);     /* v6 = 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 */
        mod2(v8,v8);     /* v7 = 0, 0, 0, 0, 1, 1, 1, 1, 0, 0 */
        add(v6,v8,v9);   /* v9 = 0, 1, 0, 1, 1, 2, 1, 2, 0, 1 */
        mod2(v9,v9);     /* v9 = 0, 1, 0, 1, 1, 0, 1, 0, 0, 1*/
        hlv(v8,v10);     /* v7 = 0, 0, 0, 0, 0, 0, 0, 0,
                                 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 */
        mod2(v10,v10);   /* v10 = 0, 0, 0, 0, 0, 0, 0, 0,
                                  1, 1, 1, 1, 1, 1, 1, 1)*/
        dbl(v10,v10);    /* v10 = 0, 0, 0, 0, 0, 0, 0, 0,
                                  2, 2, 2, 2, 2, 2, 2, 2)*/
        add(v9,v10,v11); /* v11 = 0, 1, 0, 1, 1, 0, 1, 0,
                                  2, 3, 2, 3, 3, 2, 3, 2)*/
        incr(v5);        /* increment v5 by 1 */
        txphase(v11);
        decphase(v11);
        delay(lambdaN_int);
        sim3pulse(2*pw,0.0,2.0*pwN,v11,zero,v11,0.0,0.0);
        delay(lambdaN_int);

        endloop(v14);
   }

	txphase(t12);
	dec2phase(t3);

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

	txphase(zero);
        dec2phase(zero);

  if ( ncyc > 0 )
   {
        loop(v1,v14);

        assign(v5,v6);   /* v6 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9*/
        hlv(v5,v7);      /* v7 = 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, */
        hlv(v7,v8);      /* v7 = 0, 0, 0, 0, 1, 1, 1, 1, 2, 2 */
        mod2(v6,v6);     /* v6 = 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 */
        mod2(v8,v8);     /* v7 = 0, 0, 0, 0, 1, 1, 1, 1, 0, 0 */
        add(v6,v8,v9);   /* v9 = 0, 1, 0, 1, 1, 2, 1, 2, 0, 1 */
        mod2(v9,v9);     /* v9 = 0, 1, 0, 1, 1, 0, 1, 0, 0, 1*/
        hlv(v8,v10);     /* v7 = 0, 0, 0, 0, 0, 0, 0, 0,
                                 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 */
        mod2(v10,v10);   /* v10 = 0, 0, 0, 0, 0, 0, 0, 0,
                                  1, 1, 1, 1, 1, 1, 1, 1)*/
        dbl(v10,v10);    /* v10 = 0, 0, 0, 0, 0, 0, 0, 0,
                                  2, 2, 2, 2, 2, 2, 2, 2)*/
        add(v9,v10,v11); /* v11 = 0, 1, 0, 1, 1, 0, 1, 0,
                                  2, 3, 2, 3, 3, 2, 3, 2)*/
        incr(v5);        /* increment v5 by 1 */
        txphase(v11);
        decphase(v11);
        delay(lambdaN_int);
        sim3pulse(2*pw,0.0,2.0*pwN,v11,zero,v11,0.0,0.0);
        delay(lambdaN_int);

        endloop(v14);
   }

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

        delay((gt1/10.0) + grecov/2 - 0.5*pw + 2.0*GRADIENT_DELAY - SAPS_DELAY + 2*POWER_DELAY);

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

        decpower(dpwr);
        dec2power(dpwr2);                                      /* POWER_DELAY */
        zgradpulse(icosel*gzlvl2, gt1/10.0);                   /* 2.0*GRADIENT_DELAY */
        delay(grecov/2);


status(C);
        setreceiver(t14);
}
void pulsesequence()
{
/* DECLARE VARIABLES */

char satflg[MAXSTR];

int          t1_counter;

double    
   tau1, tau2, tau3,
   pw  = getval("pw"), 
   tpwr= getval("tpwr"),
   mix = getval("mix"),
   sw1 = getval("sw1"),
   jch = getval("jch"), 
   pwC = getval("pwC"),
   pwClvl = getval("pwClvl"),
   pwNlvl = getval("pwNlvl"),
   tauCH, 
   sw_hm1 = getval("sw_hm1"),
   sw_cm1 = getval("sw_cm1"),
   sw_cm2 = getval("sw_cm2"),
   pwHs = getval("pwHs"),
   swTilt, 
   angle_hm1 = getval("angle_hm1"),
   angle_cm1 = getval("angle_cm1"),
   angle_cm2 = getval("angle_cm2"),
   cos_hm1, cos_cm1, cos_cm2,
   satdly= getval("satdly"),
   gstab = getval("gstab"),
   gt0 = getval("gt0"),    gzlvl0 = getval("gzlvl0"),
   gt1 = getval("gt1"),    gzlvl1 = getval("gzlvl1"),
   gt2 = getval("gt2"),    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"),
   gt10 = getval("gt10"),  gzlvl10 = getval("gzlvl10");

   cos_cm2=0.0; 
   getstr("satflg", satflg);

/* LOAD PHASE TABLE */

   tauCH = 1.0/4.0/jch;

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

/* CHECK VALIDITY OF PARAMETER RANGES */

   if (dpwr  > 49)  {printf("DPWR too large!" ); psg_abort(1); }
   if (dpwr2 > 49)  {printf("DPWR2 too large!"); psg_abort(1); }

/* Phases and delays related to PR-NMR */
   /* sw1 is used as symbolic index */
   if ( sw1 < 1000 ) { printf ("Please set sw1 to some value larger than 1000.\n"); psg_abort(1); }

   if (angle_hm1 < 0 || angle_cm1 < 0 || angle_hm1 > 90 || angle_cm1 > 90 )
   { printf("angles must be set between 0 and 90 degree.\n"); psg_abort(1); }

   cos_hm1 = cos (PI*angle_hm1/180);  cos_cm1 = cos (PI*angle_cm1/180);
   if ( (cos_hm1*cos_hm1 + cos_cm1*cos_cm1) > 1.0) { printf ("Impossible angle combinations.\n"); psg_abort(1); }
   else { cos_cm2 = sqrt(1 - (cos_hm1*cos_hm1 + cos_cm1*cos_cm1) );  angle_cm2 = acos(cos_cm2)*180/PI;  }

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

   swTilt = sw_hm1*cos_hm1 + sw_cm1*cos_cm1 + sw_cm2*cos_cm2; 

   /* Note the reconstruction software assumes the indirectly determined dimension, here cm2 */
   /* always have the phase change first */



   if (phase1 == 1) {; }                                                             /* CC */
   else if (phase1 == 2) { tsadd (t1, 1, 4); }                                       /* SC */
   else if (phase1 == 3) { tsadd (t2, 1, 4); }                                       /* CS */
   else if (phase1 == 4) { tsadd (t1, 1, 4);  tsadd(t2, 1, 4); }                     /* SS */

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


   if (t1_counter %2) { tsadd(t3, 2, 4); tsadd(t5, 2, 4); }

   tau1 = 1.0*t1_counter*cos_hm1/swTilt;
   tau2 = 1.0*t1_counter*cos_cm1/swTilt;
   tau3 = 1.0*t1_counter*cos_cm2/swTilt;

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

   if (ix ==1 )
   {
      printf ("Current Spectral Width:\t\t%5.2f\n", swTilt);
      printf ("Angle_hm1: %5.2f \n", angle_hm1);
      printf ("Angle_cm1: %5.2f \n", angle_cm1);
      printf ("Angle_cm2: %5.2f \n", angle_cm2);
      printf ("\n\n\n\n\n");
   }

/* BEGIN ACTUAL PULSE SEQUENCE */

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

   obsoffset(satfrq);   obspower(tpwr);       obspwrf(4095.0);   txphase(zero);
   decoffset(dof);      decpower(pwClvl);     decpwrf(4095.0);   decphase(zero);
   dec2offset(dof2);    dec2power(pwNlvl);    dec2pwrf(4095.0);  dec2phase(zero);

   /* Crush water and steady state carbon magnetization */

   if (satflg[A] == 'y')
   {
      obspower(satpwr);
      rgpulse(satdly, zero, 20.0e-6, 2.0e-6);
      obspower(tpwr);      
   }

   decrgpulse(pwC, zero, 2.0e-6, 2.0e-6);  /*destroy C13 magnetization*/
   zgradpulse(gzlvl0, gt0);
   delay(gstab);


   if (satflg[A] == 'y')
   {
      shiftedpulse("sinc", pwHs, 90.0, 0.0, zero, 2.0e-6, 2.0e-6);
   }
   decrgpulse(pwC, one, 2.0e-6, 2.0e-6);
   zgradpulse(0.7*gzlvl0, gt0);
   txphase(t1);         
   delay(gstab);

   obsoffset(tof);     obspower(tpwr);
 
status(B);

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

      if (tau1 > pwC)
      {
         delay(tau1 - pwC);
         decrgpulse(2.0*pwC, zero, 0.0, 0.0);
         delay(tau1 - pwC);
      }
      else
      {
         delay(2.0*tau1);
      }
                                                                /* point a */
      zgradpulse(gzlvl1, gt1);                       /* 2.0*GRADIENT_DELAY */
      txphase(zero); decphase(zero);
      delay(tauCH - gt1 - 4.0e-6);

   simpulse(2.0*pw, 2.0*pwC, zero, zero, 2.0e-6, 2.0e-6);

      delay(tauCH -gt1 -gstab -4.0e-6);
      zgradpulse(gzlvl1, gt1);                        /* 2.0*GRADIENT_DELAY */
      txphase(one);
      delay(gstab);
                                                                /* point b */
   rgpulse(pw, one, 2.0e-6, 2.0e-6);

   /* ======================HzCz=================== */
      zgradpulse(gzlvl2, gt2);
      txphase(zero);    decphase(t2);
      delay(gstab);
   /* ======================HzCz=================== */

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

      if ((tau2 - 2.0*pwC/PI -pw) > 0 )
      {
         delay(tau2 - 2.0*pwC/PI - pw);
         rgpulse (2.0*pw, zero, 0.0, 0.0);
         decphase(zero);
         delay(tau2 - 2.0*pwC/PI - pw);
      }
      else
      {
         delay(2.0*tau2);
         decphase(one);    delay(2.0e-6);
         simpulse(2.0*pw, 2.0*pwC, zero, one, 0.0, 0.0);
         decphase(zero);   delay(2.0e-6);
      }

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

   /* ======================HzCz=================== */
      zgradpulse(gzlvl3, gt3);
      txphase(zero);
      delay(gstab);
   /* ======================HzCz=================== */

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

      zgradpulse(gzlvl4, gt4);
      delay(tauCH - gt4 - 4.0e-6);
      
   simpulse(2.0*pw, 2.0*pwC, zero, zero, 2.0e-6, 2.0e-6);
      
      delay(tauCH - gt4 - gstab -4.0e-6);
      zgradpulse(gzlvl4, gt4);
      txphase(one);
      delay(gstab);

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

   /* H only, beginning of NOE transfer period */
  
      obsoffset(satfrq);

      decphase(zero);
      delay(mix - gt5 - gt6 - pwC -1.0e-3 -2.0*pwHs ); 

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

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

      txphase(one);
      decrgpulse(pwC,zero,2.0e-6, 2.0e-6); 
      shiftedpulse("sinc", pwHs, 90.0, 0.0, one, 2.0e-6, 2.0e-6);
 
      zgradpulse(gzlvl6, gt6);
      txphase(zero);
      delay(gstab);

   /* End of NOE transfer period */
  
   /* Second HSQC step begins here */

   rgpulse(pw,zero,2.0e-6,2.0e-6);
      
      zgradpulse(gzlvl7, gt7);      
      delay(tauCH - gt7 - 4.0e-6 );

   simpulse(2.0*pw, 2.0*pwC, zero, zero, 2.0e-6, 2.0e-6);

      delay(tauCH - gt7 - gstab -4.0e-6 );
      zgradpulse(gzlvl7, gt7);      
      txphase(one);
      delay(gstab);

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

   /* ------------HzCz----------------- */
      zgradpulse(gzlvl8, gt8);
      txphase(zero);  decphase(t3);
      delay(gstab);
   /* ------------HzCz----------------- */

   decrgpulse(pwC, t3, 2.0e-6,0.0);   
      if ( tau3 -2.0*pwC/PI - pw > 0.0 ) 
      {
         delay(tau3 - 2.0*pwC/PI - pw);
         rgpulse(2.0*pw, zero, 0.0, 0.0);
         decphase(zero);
         delay(tau3 - 2.0*pwC/PI - pw);
      }
      else
      {
         delay(2.0*tau3);
         decphase(one);    delay(2.0e-6);
         simpulse(2*pw, 2*pwC, zero, one, 0.0, 0.0);  
         decphase(zero);   delay(2.0e-6);
      }
   decrgpulse(pwC, zero, 0.0, 2.0e-6);

   /* ----  HzCz ------------*/
       zgradpulse(gzlvl9, gt9);
       txphase(t4);
       delay(gstab);
   /* ----  HzCz ------------*/

   rgpulse(pw, t4, 2.0e-6, 2.0e-6);
     
      zgradpulse(gzlvl10, gt10);
      delay(tauCH - gt10 - 4.0e-6 );

   simpulse(2.0*pw, 2.0*pwC, t4, zero, 2.0e-6, 2.0e-6);

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

   rgpulse(pw, t4, 2.0e-6, rof2);                        /* flip-back pulse  */

   setreceiver(t5);
   decpower(dpwr);

status(D);
}
Esempio n. 9
0
pulsesequence()
{
/* DECLARE VARIABLES */

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

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

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



             zeta,
             zeta1,

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

/* LOAD VARIABLES */


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

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

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

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

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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


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

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

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

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

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

/*  Set up f2180  tau2 = t2               */

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

    tau2 = tau2 / 2.0;


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

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

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

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


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

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

    zeta1 = zeta*( (double)t2_counter );

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

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

   decrgpulse(pwC,zero,0.0,0.0);

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

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

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

   rgpulse(pw,t1,0.0,0.0);

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

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

   txphase(zero); decphase(zero);

   delay(tau2);

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

   delay(taub/2.0 - 2*pwN);

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

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

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

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

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


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

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

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

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

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

   obspower(tpwrml);

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

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

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

/* CzNz */

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

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

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

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

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

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

/* clean-up before proceeding */

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

   decrgpulse(pwc90,zero,0.0,0.0);

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

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

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

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

   rgpulse(pw,zero,0.0,0.0);



/* BEGIN ACQUISITION */

status(C);
   setreceiver(t6);

}
Esempio n. 10
0
pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
	    ribose[MAXSTR],	 		    /* ribose CHn groups only */
	    AH2H8[MAXSTR],		         /* Adenine H2-H8 correlation */
	    H2Opurge[MAXSTR],
	    rna_stCdec[MAXSTR],	       /* calls STUD+ waveforms from shapelib */
	    STUD[MAXSTR];   /* apply automatically calculated STUD decoupling */
 
int         t1_counter,  		        /* used for states tppi in t1 */
            t2_counter;  	 	        /* used for states tppi in t2 */

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            stdmf = getval("dmf80"),     /* dmf for 80 ppm of STUD decoupling */
            rf80 = getval("rf80"),       	  /* rf in Hz for 80ppm STUD+ */
	    taua = getval("taua"),   /* time delays for CH coupling evolution */
	    taub = getval("taub"),
	    tauc = getval("tauc"),

/* string parameter rna_stCdec calls stud decoupling waveform from your shapelib.*/
   studlvl,	                         /* coarse power for STUD+ decoupling */

	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	rfC,            	  /* maximum fine power when using pwC pulses */
	dofa,	    /* dof shifted to 80 ppm for ribose and 145 ppm for AH2H8 */
	tofa,	    		    /* tof shifted to 7.5 ppm in t1 for AH2H8 */

/* p_d is used to calculate the isotropic mixing on the C-ribose region */
        p_d,                 	       /* 50 degree pulse for DIPSI-3 at rfdC */
        rfdC,               /* fine power for 7.5 kHz or 4.0 kHz rf at 500MHz */
	ncyc = getval("ncyc"), 			  /* no. of cycles of DIPSI-3 */

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

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

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

 grecov = getval("grecov"),   /* Gradient recovery delay, typically 150-200us */

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

    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("ribose",ribose);
    getstr("AH2H8",AH2H8);
    getstr("H2Opurge",H2Opurge);
    getstr("STUD",STUD);

/*   LOAD PHASE TABLE    */

	settable(t3,2,phi3);
	settable(t5,4,phi5);
	settable(t9,8,phi9);
	settable(t11,8,rec);


/*   INITIALIZE VARIABLES   */

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

  if (ribose[A] == 'y')
   {
/*  Center dof in RIBOSE region on 80ppm. */
	tofa = tof;
        dofa = dof - 30.0*dfrq;
		
/* dipsi-3 decoupling on C-ribose */	
 	p_d = (5.0)/(9.0*4.0*7000.0*(sfrq/800));  /* 35ppm DIPSI-3 */
     	rfdC = (compC*4095.0*pwC*5.0)/(p_d*9.0); 
	rfdC = (int) (rfdC + 0.5);
  	ncyc = (int) (ncyc + 0.5);
   }
  else
   {
/*  Center dof in adenine C2-C4-C6-C8-C5 region on 145 ppm. */
	tofa = tof + 2.5*sfrq;
        dofa = dof + 35.0*dfrq;

/* dipsi-3 decoupling on C-aromatic */
        p_d = (5.0)/(9.0*4.0*8000.0*(sfrq/800));  /* 40ppm DIPSI-3 */
        rfdC = (compC*4095.0*pwC*5.0)/(p_d*9.0);
        rfdC = (int) (rfdC + 0.5);
        ncyc = (int) (ncyc + 0.5);
   }

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


/* CHECK VALIDITY OF PARAMETER RANGES */


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

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

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

    if( (((dm[C] == 'y') && (dm2[C] == 'y')) && (STUD[A] == 'y')) )
    { text_error("incorrect dec2 decoupler flags! Should be 'nnn' if STUD='y'"); psg_abort(1); }

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

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

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

    if( (pw > 20.0e-6) && (tpwr > 56) )
    { text_error("don't fry the probe, pw too high ! "); psg_abort(1); }

    if( (pwC > 40.0e-6) && (pwClvl > 56) )
    { text_error("don't fry the probe, pwN too high ! "); psg_abort(1); }

    if( (pwN > 100.0e-6) && (pwNlvl > 56) )
    { text_error("don't fry the probe, pwN too high ! "); psg_abort(1); }
 
    if ((dm3[B] == 'y'  &&   dpwr3 > 44 ))
    { text_error ("Deuterium decoupling power too high ! "); psg_abort(1); }

    if ((ncyc > 1 ) && (ix == 1))
    { text_error("mixing time is %f ms.\n",(ncyc*97.8*4*p_d)); }


/* PHASES AND INCREMENTED TIMES */

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

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

/*  C13 TIME INCREMENTATION and set up f1180  */

/*  Set up f1180  */
   
    tau1 = d2;

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

    tau1 = tau1/2.0;


/*  Set up f2180  */

    tau2 = d3;

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

    tau2 = tau2/2.0;



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

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

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



/*   BEGIN PULSE SEQUENCE   */

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

	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rfC);
	obsoffset(tofa);
	decoffset(dofa);
	dec2offset(dof2);
	txphase(t3);
	delay(1.0e-5);

	decrgpulse(pwC, zero, 0.0, 0.0);	   /*destroy C13 magnetization*/
	zgradpulse(gzlvl0, 0.5e-3);
	delay(grecov/2);
	decrgpulse(pwC, one, 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, t3, 0.0, 0.0);                    /* 1H pulse excitation */
	zgradpulse(gzlvl0, gt0);		/* 2.0*GRADIENT_DELAY */	
        decphase(zero);
	delay(taua + tau1 - gt0 - 2.0*GRADIENT_DELAY - 2.0*pwC);
        decrgpulse(2.0*pwC, zero, 0.0, 0.0);
        txphase(zero);
	delay(tau1);
	rgpulse(2.0*pw, zero, 0.0, 0.0);
	zgradpulse(gzlvl0, gt0);
        txphase(one);
	decphase(t5);
	obsoffset(tof);
	delay(taua - gt0);
	rgpulse(pw, one, 0.0, 0.0);
	zgradpulse(gzlvl3, gt3);
	delay(grecov);
        decrgpulse(pwC, t5, 0.0, 0.0);
	delay(tau2);
	dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
	zgradpulse(gzlvl4, gt4);		        /* 2.0*GRADIENT_DELAY */
        decphase(zero);
	delay(taub - 2.0*pwN - gt4 - 2.0*GRADIENT_DELAY);
        txphase(zero);
	decpwrf(rfC);
	delay(taub - 2.0*pw);
	rgpulse(2.0*pw, zero, 0.0, 0.0);
	delay(tau2);
	decrgpulse(2.0*pwC, zero, 0.0, 0.0);
	delay(taub);
	zgradpulse(gzlvl4, gt4);	        /* 2.0*GRADIENT_DELAY */	
	decpwrf(rfdC);
	delay(taub - gt4 - 2.0*GRADIENT_DELAY);
	decrgpulse(1.0e-3, zero, 0.0, 0.0);
	initval(ncyc, v2);
	starthardloop(v2);
     decrgpulse(4.9*p_d,one,0.0,0.0);
     decrgpulse(7.9*p_d,three,0.0,0.0);
     decrgpulse(5.0*p_d,one,0.0,0.0);
     decrgpulse(5.5*p_d,three,0.0,0.0);
     decrgpulse(0.6*p_d,one,0.0,0.0);
     decrgpulse(4.6*p_d,three,0.0,0.0);
     decrgpulse(7.2*p_d,one,0.0,0.0);
     decrgpulse(4.9*p_d,three,0.0,0.0);
     decrgpulse(7.4*p_d,one,0.0,0.0);
     decrgpulse(6.8*p_d,three,0.0,0.0);
     decrgpulse(7.0*p_d,one,0.0,0.0);
     decrgpulse(5.2*p_d,three,0.0,0.0);
     decrgpulse(5.4*p_d,one,0.0,0.0);
     decrgpulse(0.6*p_d,three,0.0,0.0);
     decrgpulse(4.5*p_d,one,0.0,0.0);
     decrgpulse(7.3*p_d,three,0.0,0.0);
     decrgpulse(5.1*p_d,one,0.0,0.0);
     decrgpulse(7.9*p_d,three,0.0,0.0);

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

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

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

	endhardloop();
        decrgpulse(9.0*p_d/5.0, t9, 2.0e-6, 0.0);
     if( H2Opurge[A] == 'y' )
         {obspwrf(1000.0); rgpulse(900*pw, zero, 0.0, 0.0);
	   rgpulse(500*pw, one, 0.0, 0.0); obspwrf(4095.0); }
	zgradpulse(gzlvl7, gt7);
	decpwrf(rfC);
	delay(50.0e-6);
        rgpulse(pw,zero,0.0,0.0);
	zgradpulse(gzlvl7, gt7/1.6);
        decrgpulse(pwC, three, 100.0e-6, 0.0); 
	zgradpulse(gzlvl5, gt5);
	decphase(zero);
	delay(tauc - gt5);
	simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0);
	zgradpulse(gzlvl5, gt5);
	delay(tauc - gt5);
	decrgpulse(pwC, zero, 0.0, 0.0);
	zgradpulse(gzlvl3, gt3);
        if(dm3[B] == 'y')	         /*optional 2H decoupling off */
        {
         dec3rgpulse(1/dmf3, three, 0.0, 0.0);
         dec3blank();
         setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
         dec3blank();
        }
	delay(grecov);
	rgpulse(pw, zero, 0.0, 0.0);
	zgradpulse(gzlvl6, gt5);
	delay(taua - gt5);
	simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0);
	zgradpulse(gzlvl6, gt5);
  if (STUD[A]=='y') decpower(studlvl);

  else
   {
	decpower(dpwr);
	dec2power(dpwr2);
   }
	delay(taua - gt5);
	rgpulse(pw, zero, 0.0, rof2);
        rcvron();
        if (dm3[B] == 'y') lk_sample();
	setreceiver(t11);
  if ((STUD[A]=='y') && (dm[C] == 'y'))
       {
        decpower(studlvl);
        decunblank();
        decon();
        decprgon(rna_stCdec,1/stdmf, 1.0);
        startacq(alfa);
        acquire(np, 1.0/sw);
        decprgoff();
        decoff();
        decblank();
       }
   else	
	 status(C);
}		 
Esempio n. 11
0
pulsesequence()

{
/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],
            bottom[MAXSTR],
            right[MAXSTR],
            C13refoc[MAXSTR];


int	    t1_counter;

double       tau1,                 				  /* t1 delay */
             taua=getval("taua"),  		      /* < 1 / 4J(NH) 2.25 ms */
             taub=getval("taub"),  			/* 1 / 4J(NH) 2.75 ms */
   pwClvl = getval("pwClvl"),                   /* coarse power for C13 pulse */
   pwC = getval("pwC"),               /* C13 90 degree pulse length at pwClvl */
   compH = getval("compH"),        /* adjustment for H1 amplifier compression */
   compN = getval("compN"),       /* adjustment for N15 amplifier compression */
   compC = getval("compC"),       /* adjustment for C13 amplifier compression */

        pwHs = getval("pwHs"),          /* H1 90 degree pulse length at tpwrs */
        tpwrs,                        /* power for the pwHs ("H2Osinc") pulse */
	finepwrf = getval("finepwrf"), 		     /* fine power adjustment */
        pwNlvl = getval("pwNlvl"),                    /* power for N15 pulses */
        pwN = getval("pwN"),          /* N15 90 degree pulse length at pwNlvl */

        sw1 = getval("sw1"),

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

  getstr("f1180",f1180);
  getstr("bottom",bottom);
  getstr("right",right);
  getstr("C13refoc",C13refoc);

/*   INITIALIZE VARIABLES   */

compN=compN;
compC=compC;

/* 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 */
    tpwrs = tpwrs+6;        /* increase attenuator setting so that
           	fine power control can be varied about the nominal 2048 value */



/* check validity of parameter range */

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

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

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

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

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

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

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

/* LOAD VARIABLES */

  settable(t1, 8, phi1);
        if (bottom[A]=='y')
{
  settable(t2, 1, ph_y);
  settable(t5, 2, phi5);
  settable(t7, 2, phi6);
}
	else
{
  settable(t2, 1, phy);
  settable(t5, 2, phi6);
  settable(t7, 2, phi5);
}
	if (right[A]=='y')
  settable(t3, 1, ph_y);
	else
  settable(t3, 1, phy);
  settable(t4, 8, phi4);
  settable(t6, 8, rec);


/* Set up f1180  */

   tau1 = d2;
   if(f1180[A] == 'y' && C13refoc[A] == 'n') 

        tau1 += ( 1.0 / (2.0*sw1) - pw);

   if(f1180[A] == 'y' && C13refoc[A] == 'y') 

        tau1 += ( 1.0 / (2.0*sw1) - 2.0*pwC - 4.0e-6 - pw);

   if(f1180[A] == 'n' && C13refoc[A] == 'n') 

        tau1 = tau1 - pw;

   if(f1180[A] == 'n' && C13refoc[A] == 'y') 

        tau1 = ( tau1 - 2.0*pwC - 4.0e-6 - pw);

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

/* set up for complex FID */

   if (phase1 == 2)
   {
      tsadd(t2,2,4);
      tsadd(t3,2,4);
      tsadd(t6,2,4);
   }


/* Calculate modifications to phases for States-TPPI acquisition  */
 
   if( ix == 1 ) d2_init = d2;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if( t1_counter %2 ) {
      tsadd(t1,2,4);
      tsadd(t4,2,4);
      tsadd(t6,2,4);
   }
    


/* BEGIN ACTUAL PULSE SEQUENCE */


status(A);
        obsoffset(tof);
        decoffset(dof+(50*dfrq));	/* 160 ppm for DEC */
        dec2offset(dof2-(45*dfrq2));	/* Middle of imino-N15 = 155 ppm */
	obspower(tpwr);
        obspwrf(4095.0);
        decpower(pwClvl);
        dec2power(pwNlvl);
        txphase(two);
        decphase(zero);
        dec2phase(zero);

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

	rgpulse(pw,two,0.0,0.0);
	txphase(zero);
	
	zgradpulse(gzlvl5, gt5);
	delay(taua - gt5 - 2.0*GRADIENT_DELAY);	/* delay < 1/4J(XH)   */

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

	zgradpulse(gzlvl5, gt5);
        delay(taua - gt5 - 2.0*GRADIENT_DELAY);

    if (phase1 == 1)
  	sim3pulse(pw,0.0,pwN,one,zero,t1,0.0,0.0);
    if (phase1 == 2) 
  	sim3pulse(pw,0.0,pwN,one,zero,t4,0.0,0.0);

   	txphase(zero);
	decphase(zero);

   if (C13refoc[A] == 'y')
    {
        if (tau1>0.001)
        {
         zgradpulse(gzlvlr,(0.8*tau1/2.0 - 2.0*GRADIENT_DELAY ));
         delay(0.2*tau1/2.0 );
        }
        else
         delay(tau1/2.0);
	decrgpulse(pwC,zero,0.0,0.0);
	decrgpulse(2.0*pwC,one,2.0e-6,0.0);
	decrgpulse(pwC,zero,2.0e-6,0.0);
        if (tau1>0.001)
        {
         zgradpulse(-gzlvlr,(0.8*tau1/2.0 - 2.0*GRADIENT_DELAY ));
         delay(0.2*tau1/2.0 );
        }
        else
         if ((tau1/2.0)>0.0) delay(tau1/2.0);
    }
    else
    {
        if (tau1>0.001)
        {
         zgradpulse(gzlvlr,(0.8*tau1 - 2.0*GRADIENT_DELAY));
         delay(0.2*tau1);
         zgradpulse(-gzlvlr,(0.8*tau1 - 2.0*GRADIENT_DELAY ));
         delay(0.2*tau1);
        }
        else
         delay(tau1);
     }

 
   	rgpulse(pw,t2,0.0,0.0);
  	txphase(zero);
	dec2phase(zero);

	zgradpulse(gzlvl3,gt3);
  	delay(taub - gt3 - 2.0*GRADIENT_DELAY);

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

	zgradpulse(gzlvl3,gt3);
	delay(taub - gt3 - 2.0*GRADIENT_DELAY);

	sim3pulse(pw,0.0,pwN,zero,zero,t3,0.0,0.0);
	txphase(t5);
	dec2phase(zero);
        obspower(tpwrs);
        obspwrf(finepwrf);

        zgradpulse(gzlvl4,gt4);
	delay(taub - gt4 - 4.0*POWER_DELAY - rof1 - 2.0*GRADIENT_DELAY - pwHs);

	shaped_pulse("H2Osinc",pwHs,t5,0.0,0.0);
	txphase(t7);
        obspower(tpwr);
        obspwrf(4095.0);

        sim3pulse(2.0*pw,0.0e-6,2.0*pwN,t7,zero,zero,rof1,rof1);
	txphase(t5);
        obspwrf(finepwrf);
        obspower(tpwrs);

	shaped_pulse("H2Osinc",pwHs,t5,0.0,0.0);
	txphase(zero);
	obspower(tpwr);
        obspwrf(4095.0);

	zgradpulse(gzlvl4,gt4);
	delay(taub - gt4 - 6.0*POWER_DELAY - rof1 - 2.0*GRADIENT_DELAY 
		- 0.5*(pwN-pw)	- pwHs);

  	dec2rgpulse(pwN,zero,0.0,0.0);
	decpower(dpwr);
	dec2power(dpwr2);
	
/* acquire data */
status(C);
     	setreceiver(t6);
}
Esempio n. 12
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 );

}		 
Esempio n. 13
0
pulsesequence()
{

    /* DECLARE AND LOAD VARIABLES */

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

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

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

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

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

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

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

                sw1 = getval("sw1"),

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

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

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

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



    /*   LOAD PHASE TABLE    */

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

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

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



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

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


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

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

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

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

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

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



    /* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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



    /*  RELAXATION TIMES AND FLAGS */

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


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




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

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


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


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

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


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


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


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


    /* PHASES AND INCREMENTED TIMES */

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

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


    /*  Set up f1180  */

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



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

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



    /*  Correct inverted signals for NH2 only spectra  */

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



    /* BEGIN PULSE SEQUENCE */

    status(A);

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

    delay(d1);


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

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

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

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

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

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

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

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

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

    /*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 RELAXATION    xxxxxxxxxxxxxxxxxxxx  */

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

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

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

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

            endloop(v5);
        }

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

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

        loop(v5,v6);

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

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

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

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

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

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

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

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

        delay(tau1);

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

    setreceiver(t12);
}
Esempio n. 14
0
pulsesequence()
{
char    f1180[MAXSTR],
        f2180[MAXSTR],
	f3180[MAXSTR],
        mag_flg[MAXSTR];

 int	phase, icosel,
	t1_counter,
	t2_counter,
	t3_counter;

 double	pwClvl,
            pwC,
            rf0 = 4095,
            rfst,
            compC = getval("compC"),
            tpwrs,
            pwHs = getval("pwHs"),
            compH = getval("compH"),

	pwNlvl,
	pwN,

	tau1,
	tau2,
	tau3,
	tauch,   /* 3.4 ms  */
	taunh,   /* 2.4 ms  */
	mix,
        tofh,
        dofcaco,  /* ~120 ppm  */

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

/* LOAD VARIABLES */

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

  pwClvl = getval("pwClvl");
  pwC = getval("pwC");

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

  mix = getval("mix");
  tauch = getval("tauch");
  taunh = getval("taunh");
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  sw3 = getval("sw3");
  phase = (int) (getval("phase") + 0.5);
  phase2 = (int) (getval("phase2") + 0.5);
  phase3 = (int) (getval("phase3") + 0.5);

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

  setautocal();                        /* activate auto-calibration flags */ 
        
  if (autocal[0] == 'n') 
  {
    tofh = getval("tofh");
    dofcaco = getval("dofcaco");  /* ~120 ppm  */

/* 180 degree adiabatic C13 pulse from 0 to 200 ppm */
    rfst = (compC*4095.0*pwC*4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35));   
    rfst = (int) (rfst + 0.5);

    if (1.0/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)) < pwC )
    { 
      text_error( " Not enough C13 RF. pwC must be %f usec or less.\n", 
      (1.0e6/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35))) );
      psg_abort(1);
    }
  }
  else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
  {
    if(FIRST_FID)                                            /* call Pbox */
    {
      ppm = getval("dfrq"); ofs = 0.0;   pws = 0.001;  /* 1 ms long pulse */
      bw = 200.0*ppm;       nst = 1000;          /* nst - number of steps */
      stC200 = pbox_makeA("stC200", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
      ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
      ofs = getval("tof") - 1.75*getval("sfrq");
      pws = getval("dof") + 85.0*ppm;
    }
    rfst = stC200.pwrf;
    tofh = ofs;
    dofcaco = pws;
  }	

/* selective H20 one-lobe sinc pulse */
   tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));
   tpwrs = (int)(tpwrs+0.5);

/* check validity of parameter range */

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

   if((dm2[A] == 'y' || dm2[B] == 'y'))
   {
      printf("incorrect Dec2 decoupler flags!  ");
      psg_abort(1);
   }
  
   if ((dpwr > 50) || (dpwr2 > 50))
   {
      printf("don't fry the probe, dpwr too high!  ");
      psg_abort(1);
   }

/* Load phase cycling variables */

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

   settable(t11, 8, rec_1);

/* Phase incrementation for hypercomplex data */

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

/* calculate modification to phases based on current t2 values
   to achieve STATES-TPPI acquisition */

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

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

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

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

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

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

   tau2 = d3 - (4.0*pwC/PI + 2.0*pw + 2.0e-6);
   if (dm[B] == 'y')
   {
      tau2 = tau2 - (2.0*POWER_DELAY + PRG_START_DELAY + PRG_STOP_DELAY);
   }
   if(f2180[A] == 'y')
   {
      tau2 += (1.0/(2.0*sw2));
   }
   if (tau2 < 0.2e-6) tau2 = 0.0;
   tau2 = tau2/2.0;

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

   tau3 = d4;
   if(f3180[A] == 'y')
   {
      tau3 += (1.0/(2.0*sw3));
   }
   if (tau3 < 0.2e-6) tau3 = 0.0;
   tau3 = tau3/2.0;

   initval(315.0, v7);
   obsstepsize(1.0);

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   delay(10.0e-6);
   obspower(tpwr);
   decpower(pwClvl);
   decpwrf(rf0);
   dec2power(pwNlvl);
   obsoffset(tofh);
   decoffset(dof);
   dec2offset(dof2);
   txphase(t1);
   xmtrphase(v7);
   delay(d1);

   if (gt0 > 0.2e-6)
   {
      decrgpulse(pwC,zero,2.0e-6,0.0);
      dec2rgpulse(pwN,zero,2.0e-6,0.0);
      zgradpulse(gzlvl0,gt0); 
      delay(1.0e-3);
   }
   decphase(t2);

   rgpulse(pw,t1,2.0e-6,0.0);	
   xmtrphase(zero);
   zgradpulse(gzlvl3,gt3);
   delay(tauch - gt3);			
   decrgpulse(pwC,t2,2.0e-6,0.0);	
status(B);
   decpower(dpwr);
   delay(tau2); 
   rgpulse(2.0*pw,t1,0.0,0.0);              
   decphase(zero);
   if (tau2 > 2.0*pwN)
   {
      dec2rgpulse(2.0*pwN,zero,0.0,0.0);              
      delay(tau2 - 2.0*pwN);
   }
   else
      delay(tau2); 
status(A);

   decpower(pwClvl);         
   decrgpulse(pwC,zero, 2.0e-6,2.0e-6);
   txphase(zero);
   delay(tauch + tau1 + SAPS_DELAY - gt3 - 4.0*pwC - 500.0e-6);		
   zgradpulse(gzlvl3,gt3);
   delay(500.0e-6);
   decrgpulse(pwC,zero,0.0, 0.0);	
   decphase(one);
   decrgpulse(2.0*pwC, one, 0.2e-6, 0.0);
   decphase(zero);
   decrgpulse(pwC, zero, 0.2e-6, 0.0);
   delay(tau1);
   rgpulse(pw,zero,0.0,0.0);

   delay(mix - gt4 - gt5 - pwN - 2.0e-3);		
   obsoffset(tof);

   zgradpulse(gzlvl4,gt4);
   delay(1.0e-3);
   sim3pulse((double)0.0,pwC,pwN,zero,zero,zero,0.0,2.0e-6);              
   zgradpulse(gzlvl5,gt5);
   delay(1.0e-3);			

   rgpulse(pw,zero,0.0,2.0e-6);		
   zgradpulse(gzlvl6,gt6);
   delay(taunh - gt6 - 2.0e-6);
   sim3pulse(2.0*pw,(double)0.0,2*pwN,zero,zero,zero,0.0,0.0);
   delay(taunh - gt6 - 500.0e-6);
   zgradpulse(gzlvl6,gt6);
   txphase(one);
   delay(500.0e-6);
   rgpulse(pw,one,0.0,0.0);	
   txphase(two);
   obspower(tpwrs);
   shaped_pulse("H2Osinc", pwHs, two, 2.0e-6, 2.0e-6);
   obspower(tpwr);
   zgradpulse(gzlvl7,gt7);	
   dec2phase(t3);
   decoffset(dofcaco);
   decpwrf(rfst);
   delay(200.0e-6);			

   dec2rgpulse(pwN,t3,0.0,0.0);

   dec2phase(t4);
   delay(tau3); 
   rgpulse(2.0*pw, zero, 0.0, 0.0);
   decshaped_pulse("stC200", 1.0e-3, zero, 0.0, 0.0);
   delay(tau3);
   delay(gt1 + 202.0e-6 - 1.0e-3 - 2.0*pw);

   dec2rgpulse(2.0*pwN, t4, 0.0, 2.0e-6);

   dec2phase(t5);
   if(mag_flg[A] == 'y')
   {
      magradpulse(gzcal*gzlvl1, gt1);        
   }
   else
   {
      zgradpulse(gzlvl1, gt1);        
      delay(4.0*GRADIENT_DELAY);
   }
   delay(200.0e-6 + WFG_START_DELAY + WFG_STOP_DELAY - 6.0*GRADIENT_DELAY);

   sim3pulse(pw, 0.0, pwN, zero, zero, t5, 0.0, 2.0e-6);

   dec2phase(zero);
   zgradpulse(gzlvl8, gt8);
   delay(taunh - gt8);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   delay(taunh  - gt8 - 400.0e-6);
   zgradpulse(gzlvl8, gt8);
   txphase(one);
   dec2phase(one);
   delay(400.0e-6);

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

   txphase(zero);
   dec2phase(zero);
   zgradpulse(gzlvl9, gt9);
   delay(taunh - gt9);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   zgradpulse(gzlvl9, gt9);
   delay(taunh - gt9);

   rgpulse(pw, zero, 0.0, 0.0);

   delay((gt1/10.0) + gstab - 0.5*pw + 6.0*GRADIENT_DELAY + POWER_DELAY);

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

   if(mag_flg[A] == 'y')
   {
      magradpulse(icosel*gzcal*gzlvl2, gt1/10.0);     	
   }
   else
   {
      zgradpulse(icosel*gzlvl2, gt1/10.0);     	
      delay(4.0*GRADIENT_DELAY);
   }
   dec2power(dpwr2);			   
   delay(gstab);		

status(C);
   setreceiver(t11);
}		 
Esempio n. 15
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char      
       f1180[MAXSTR],
       semitrosy[MAXSTR]; /* flag for selecting either fast relaxing peak in 1H or 15N-dimension
       */

 int	     phase,t1_counter,icosel;

 double      /* DELAYS */
             JNH = getval("JNH"),
             tau1,tauhn,


             /* PULSES */
             pwN = getval("pwN"),               /* PW90 for N-nuc */
             pwC = getval("pwC"),               /* PW90 for C-nuc */
   
             /* POWER LEVELS */
             pwClvl = getval("pwClvl"),         /* power level for C hard pulses */ 
             pwNlvl = getval("pwNlvl"),         /* power level for N hard pulses */

             /* CONSTANTS */
             sw1 = getval("sw1"),
             dof = getval("dof"),

  tpwrsf_d = getval("tpwrsf_d"), /* fine power adustment for first soft pulse(down)*/
  pwHs = getval("pwHs"),	        /* H1 90 degree pulse length at tpwrs */
  compH =getval("compH"),
  tpwrs,	  	              /* power for the pwHs ("H2Osinc") pulse */

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

/* LOAD VARIABLES */

  phase = (int) (getval("phase") + 0.5);
  ni = getval("ni");
  getstr("f1180",f1180); 
  getstr("semitrosy",semitrosy);
  tauhn=1/(4.0*JNH);
/* check validity of parameter range */

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

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

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

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

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

/* LOAD VARIABLES */

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

/* INITIALIZE VARIABLES */

  tauhn = ((JNH != 0.0) ? 1/(4*(JNH)) : 2.25e-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 */

        if (tpwrsf_d<4095.0)
        {
         tpwrs=tpwrs+6.0;  /* add 6dB to let tpwrsf_d control fine power ~2048*/
        }
 
/* Phase incrementation for hypercomplex data */
icosel = 1;  /* initialize */
 if ( semitrosy[A] == 'n' ) /* to choose for the semitrosy multiplet in 15N dimension, 'n' */
{

  if (phase == 1)      /* Hypercomplex in t1 */
     {
        icosel = -1;
     }  
   
   if (phase == 2)      /* Hypercomplex in t1 */
     {
	tsadd(t2, 2, 4);
	tsadd(t3, 2, 4);
        icosel = +1;
     }
   
   if (phase == 3)      /* Hypercomplex in t1 */
     {
        tsadd(t5, 2, 4);
	tsadd(t2, 2, 4);
	tsadd(t8, 2, 4);
	icosel = -1;
     }
   if (phase == 4)      /* Hypercomplex in t1 */
     {
        tsadd(t5, 2, 4);
	tsadd(t3, 2, 4);
        tsadd(t8, 2, 4);
	icosel = +1;
     }
}

   if ( semitrosy[A] == 'h' ) /* to choose for the semitrosy multiplet in 1H dimension, 'h' */
{
   if (phase == 1)      /* Hypercomplex in t1 */
     {
        icosel = -1;
     }  
   
   if (phase == 2)      /* Hypercomplex in t1 */
     {
        tsadd(t2, 2, 4);
	tsadd(t3, 2, 4);
        icosel = +1;
     }
   
   if (phase == 3)      /* Hypercomplex in t1 */
     {
	tsadd(t3, 2, 4);
	icosel = -1;
     }
   if (phase == 4)        /* Hypercomplex in t1 */
     {
	tsadd(t2, 2, 4);
	icosel = +1;
     }
}
   
/* calculate modification to phases based on current t1 values
   to achieve States-TPPI acquisition */
  
   if(ix == 1)
      d2_init = d2;
      t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5);

      if(t1_counter %2) 
      {
        tsadd(t1, 2, 4);
        tsadd(t7, 2, 4);
      }

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

   tau1 = d2;
   if (tau1>0.0)
     tau1 = tau1 -rof1 -2.0*pwN/PI -4.0*pwC;
   if (f1180[A] == 'y')  tau1 += ( 1.0/(2.0*sw1));
   tau1 = tau1/2.0;
   

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(satpwr);            /* Set power for presaturation    */
   decpower(pwClvl);             /* Set decoupler1 power to pwClvl  */
   dec2power(pwNlvl);            /* Set decoupler2 power to pwNlvl */
   obsoffset(tof);
   decoffset(dof);
   dec2offset(dof2);

/* Presaturation Period */

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

status(B);

  obspower(tpwrs); obspwrf(tpwrsf_d);
  shaped_pulse("H2Osinc",pwHs,t8,rof1,0.0);
  obspower(tpwr); obspwrf(4095.0);

  rgpulse(pw,zero,rof1,rof1);

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

  zgradpulse(gzlvl0, gt0);

  delay(tauhn - gt0);  /* delay for 1/4JHN coupling */
   
  rgpulse(pw,t5,rof1,0.0);
            
   zgradpulse(gzlvl3, gt3);
   delay(gstab);
   
   dec2rgpulse(pwN,t1,rof1,0.0);

   delay(tau1);
   if (tau1>0.0)
   {
    decrgpulse(pwC,zero,rof1,0.0);
    decrgpulse(2.0*pwC,one,0.0,0.0);
    decrgpulse(pwC,zero,0.0,0.0);
   }
   delay(tau1);

   zgradpulse(gzlvl1, gt1);  
   delay(gstab);
   
   dec2rgpulse(2.0*pwN,t4,rof1,rof1);

   delay(gt1 + gstab -pwHs +2.0*GRADIENT_DELAY -4.0*POWER_DELAY -2.0*rof1 );

   obspower(tpwrs); obspwrf(tpwrsf_d);
   shaped_pulse("H2Osinc",pwHs,t6,rof1,0.0);
   obspower(tpwr); obspwrf(4095.0);
 
   rgpulse(pw,t2,rof1,rof1);  /* Pulse for 1H  */ 
 
   zgradpulse(gzlvl5, gt5);
   delay(tauhn  - gt5 -2.0*rof1 -pwN);

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

   zgradpulse(gzlvl5, gt5);

  delay(tauhn - gt5 - 1.5*pwN -2.0*rof1); /* 1/4J (XH)  */

  sim3pulse(pw,0.0,pwN,one,zero,zero,rof1,rof1); /* 90 for 1H and 15N */

  zgradpulse(1.5*gzlvl5, gt5);

  delay(tauhn - gt5 -1.5*pwN -2.0*rof1);   /* delay=1/4J (XH) */

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

  zgradpulse(1.5*gzlvl5, gt5);

  delay(tauhn - gt5 -2.0*rof1 -pwN/2.0);   /* 1/4J (XH)  */

  dec2rgpulse(pwN,t3,rof1,0.0);
   
  delay(gt1/10.0 -rof1 -pwN/2.0 +gstab + 2.0*GRADIENT_DELAY + POWER_DELAY);
         
  rgpulse(2.0*pw, zero, rof1, rof1);

  dec2power(dpwr2);

  zgradpulse(icosel*gzlvl2, 0.1*gt1);
  delay(gstab-rof1);

status(C);
     setreceiver(t7);
}
Esempio n. 16
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. 17
0
void pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
	    mag_flg[MAXSTR],      /* magic-angle coherence transfer gradients */
            bottom[MAXSTR],
            right[MAXSTR],
	    C13refoc[MAXSTR];		/* C13 sech/tanh pulse in middle of t1*/
 
int         t1_counter;  		        /* used for states tppi in t1 */

double      tau1,         				         /*  t1 delay */
	    lambda = 0.91/(4.0*getval("JNH")), 	   /* 1/4J H1 evolution delay */
	    timeT = getval("timeT"),	    /* HN->N transfer time: T=15-20ms */
        
/* the sech/tanh pulse is automatically calculated by the macro "rna_cal", */
/* and is called directly from your shapelib.                  		      */
   pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
   pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
   rfC,            	          /* maximum fine power when using pwC pulses */
   rfst,	                           /* fine power for the stCall pulse */

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

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

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

	sw1 = getval("sw1"),

 grecov = getval("grecov"),   /* Gradient recovery delay, typically 150-200us */

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

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


    getstr("mag_flg",mag_flg);
    getstr("f1180",f1180);
    getstr("C13refoc",C13refoc);
    getstr("bottom",bottom);
    getstr("right",right);

/*   LOAD PHASE TABLE    */
	
        settable(t3,4,phi3);
        /*settable(t4,1,ph_y);*/
        settable(t1,1,phx);
        settable(t5,8,phi5);
        settable(t6,16,phi6);

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

        settable(t9,1,phx);
        settable(t11,1,phy);
        settable(t12,4,recT);


/*   INITIALIZE VARIABLES   */

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

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

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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


/* PHASES AND INCREMENTED TIMES */

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


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

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



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


/* BEGIN PULSE SEQUENCE */

status(A);

	obspower(tpwr);
	decpower(pwClvl);
	decpwrf(rfC);
 	dec2power(pwNlvl);
	txphase(zero);
        decphase(zero);
        dec2phase(zero);
	dec2offset(dof2-(10*dfrq2));

	delay(d1);

status(B);
 
        rcvroff();

	decrgpulse(pwC, zero, 0.0, 0.0);   /*destroy C13 magnetization*/
	zgradpulse(gzlvl0, 0.5e-3);
	delay(grecov/2);
	decrgpulse(pwC, one, 0.0, 0.0);
	zgradpulse(0.7*gzlvl0, 0.5e-3);
	decpwrf(rfst);
	txphase(t1);
	delay(5.0e-4);

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

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

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

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

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

   	obspower(tpwrs);
   	shaped_pulse("H2Osinc", pwHs, two, 5.0e-5, 0.0);
	obspower(tpwr);

	zgradpulse(gzlvl3, gt3);
	dec2phase(t3);
	delay(grecov);

   	dec2rgpulse(pwN, t3, 0.0, 0.0);
	txphase(zero);
	decphase(zero);

	delay(timeT - 2.0*SAPS_DELAY);

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

        delay(timeT - SAPS_DELAY);

	dec2rgpulse(pwN, t5, 0.0, 0.0);
        dec2phase(t6);

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

	delay(timeT - lambda - SAPS_DELAY);

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

        delay(timeT - lambda - gt1 - 2.0*GRADIENT_DELAY - pwHs - 1.5e-4 - 2.0*POWER_DELAY - SAPS_DELAY);

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

        txphase(t7);
        obspower(tpwrs);
        shaped_pulse("H2Osinc", pwHs, t7, 1.0e-4, 0.0);
	txphase(t4);
        obspower(tpwr);
        delay(5.0e-5);

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

	zgradpulse(gzlvl5, gt5);
	delay(lambda - 0.65*(pw + pwN) - gt5);

	sim3pulse(2.0*pw, 0.0, 2.0*pwN, one, zero, zero, 0.0, 0.0);
	txphase(two);
        dec2phase(t11);

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

	sim3pulse(pw, 0.0, pwN, two, zero, t11, 0.0, 0.0);
	txphase(zero);
	dec2phase(zero);

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

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

	zgradpulse(1.5*gzlvl5, gt5);
	delay(lambda - 1.6*pwN - gt5);

	dec2rgpulse(pwN, t10, 0.0, 0.0); 

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

	rgpulse(2.0*pw, zero, 0.0, rof2);
	dec2power(dpwr2);				       /* POWER_DELAY */

        if (mag_flg[A] == 'y')    magradpulse(gzcal*gzlvl2, 0.1*gt1);
        else   zgradpulse(gzlvl2, 0.1*gt1);             /* 2.0*GRADIENT_DELAY */

statusdelay(C,1.0e-4-rof2);		

	setreceiver(t12);
}		 
Esempio n. 18
0
pulsesequence()
{
   char   
          autocal[MAXSTR],
          shname1[MAXSTR],
	  shname2[MAXSTR],
          ipap_flg[MAXSTR],
          ab_flg[MAXSTR],
	  f1180[MAXSTR],
          SE[MAXSTR],        /*Use Sensitivity Enhancement */
          c13refoc[MAXSTR],
          refpat[MAXSTR],    /* pulse shape pattern refocus. pulse*/
          hetsofast_flg[MAXSTR],
          grad3_flg[MAXSTR];     /*gradient flag */

   int   
          t1_counter,
          phase;


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

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

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

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

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



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

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

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


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

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

}

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

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

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

    


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



   status(A);

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


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

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

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

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

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

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

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


}
Esempio n. 19
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. 20
0
pulsesequence()
{
char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
	    f2180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            CCdseq[MAXSTR],
            CChomodec[MAXSTR],          /* Setup for C-imino - C-H6 */
	    pwC_Sel_Shape[MAXSTR],	       /* Selective C 180 refocusing pulse */
	    pwH_Sel_Shape[MAXSTR];	       /* Selective H 180 refocusing pulse */
 
int         icosel,          			  /* used to get n and p type */
            t1_counter,  		        /* used for states tppi in t1 */
	    ni2 = getval("ni2"),
            t2_counter;  		        /* used for states tppi in t2 */

double      tau1,         				          /* t1 delay */
	    tau2,         				          /* t2 delay */
            CCdpwr = getval("CCdpwr"),    /*   power level for CC decoupling */
            CCdres = getval("CCdres"),    /*   dres for CC decoupling */
            CCdmf = getval("CCdmf"),      /*   dmf for CC decoupling */

	    lambda = 1.0/(4*getval("JCH")),	   /* 1/4J H1 evolution delay */
	    taucc = 1.0/(4*getval("JCC")),	   /* 1/4J CC evolution delay */
	    delta_cc = 1.0/(4*getval("JCC")),	   /* 1/4J CC evolution delay */
	    pwH_Sel_pw = getval("pwH_Sel_pw"),	/* 180 Pulse selective pulse*/
	    pwH_Sel_lvl = getval("pwH_Sel_lvl"),	/* 180 Pulse selective pulse power level*/
	    pwC_Sel_pw = getval("pwC_Sel_pw"),	/* 180 C Pulse selective pulse*/
	    pwC_Sel_lvl = getval("pwC_Sel_lvl"),	/* 180 C Pulse selective pulse power level*/
            pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
            pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
            calC = getval("calC"),        /* multiplier on a pwC pulse for calibration */

            dofa,

            calH = getval("calH"),        /* multiplier on a pw pulse for H1 calibration */

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


	    sw1 = getval("sw1"),

            gstab = getval("gstab"),   /* Gradient recovery delay, probe-dependent */

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

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

    getstr("f1180",f1180);
    getstr("CCdseq",CCdseq);
    getstr("CChomodec",CChomodec);
    getstr("f2180",f2180);
    getstr("pwH_Sel_Shape",pwH_Sel_Shape);
    getstr("pwC_Sel_Shape",pwC_Sel_Shape);



/*   LOAD PHASE TABLE    */

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

/* reset calH and calC if the user forgets */
  if (ni>1.0)
   {
	calH=1.0; calC=1.0;
   }

/* CHECK VALIDITY OF PARAMETER RANGES */

  if ((ni/sw1) > (4*taucc - 2*gt4))
  { text_error( " ni is too big. Make ni equal to %d or less.\n",    
      ((int)((4*taucc - 2*gt4)*sw1)) );					    psg_abort(1); }

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

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

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

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

  if( (pw > 20.0e-6) && (tpwr > 56) )
  { text_error("don't fry the probe, pw too high ! ");              psg_abort(1); }
 
  if( (pwC > 40.0e-6) && (pwClvl > 56) )
  { text_error("don't fry the probe, pwN too high ! ");             psg_abort(1); }

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

  if ( ni/sw1 > 4.0*taucc)
  { text_error( " ni is too big. Make ni equal to %d or less.\n",
      ((int)(4*taucc*sw1)) );                                       psg_abort(1); }

/* PHASES AND INCREMENTED TIMES */

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

	icosel=1;

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

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

/* Calculate modifications to phases for States-TPPI acquisition          */
  if( ix == 1) d3_init = d3;

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

/* BEGIN PULSE SEQUENCE */

status(A);
        dofa = dof - 35.0*dfrq; /*start at C2' */
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	obsoffset(tof);
	decoffset(dofa);
	dec2offset(dof2);
	txphase(zero);
	decphase(zero);
        dec2phase(zero);

	delay(d1);
        rcvroff();

status(B);

	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/2);
	dec2rgpulse(pwN, one, 0.0, 0.0);
	decrgpulse(pwC, one, 0.0, 0.0);
	zgradpulse(0.7*gzlvl0, 0.5e-3);
	delay(5.0e-4);

   	rgpulse(calH*pw,zero,0.0,0.0);                 /* 1H pulse excitation */
   	decphase(t4);
        delay(2.0*lambda);
        decrgpulse(calC*pwC, t4, 0.0, 0.0);
	zgradpulse(gzlvl3, gt3);
	obspower(pwH_Sel_lvl);
   	decphase(zero);
        delay(taucc -lambda - gt3 - WFG2_START_DELAY - pwH_Sel_pw/2.0 + 70.0e-6);

        shaped_pulse(pwH_Sel_Shape, pwH_Sel_pw, zero, 0.0, 0.0);
        delay(lambda - pwH_Sel_pw/2.5);

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

        zgradpulse(gzlvl3, gt3);
	obspower(tpwr);
   	decphase(t5);
   	txphase(t2);
        delay(taucc - gt3);

        simpulse(pw, pwC, t2, t5, 0.0, 0.0);

        zgradpulse(gzlvl4, gt4);       	/* 2.0*GRADIENT_DELAY */
        txphase(zero);
	decphase(t3);
	delay(2*taucc + tau1 - gt4);

    	decrgpulse(2.0*pwC, t3, 0.0, 0.0);
        zgradpulse(gzlvl4, gt4);       	/* 2.0*GRADIENT_DELAY */
    	decphase(zero);
		
        delay(2.0*taucc - tau1 - gt4);

        dofa = dof - 17.5*dfrq; /*change to C1' */
	decoffset(dofa);
/*  ffffffffffffffffffff   BEGIN SENSITIVITY ENHANCE   fffffffffffffffffffff  */
        decrgpulse(pwC, zero, 0.0, 0.0);

if (CChomodec[A]=='y')
 {
	delay(delta_cc);
    	decrgpulse(2.0*pwC, zero, 0.0, 0.0);
	delay(delta_cc);
        decpower(CCdpwr); decphase(zero);
        decprgon(CCdseq,1.0/CCdmf,CCdres);
        decon();  /* CC decoupling on */
	delay(tau2);
    	dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
	delay(tau2);

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

        zgradpulse(icosel*gzlvl1, gt1/2.0);       	/* 2.0*GRADIENT_DELAY */
        delay(gstab);
        decshaped_pulse(pwC_Sel_Shape, pwC_Sel_pw, t9, 0.0, 0.0);
        zgradpulse(-1.0*icosel*gzlvl1, gt1/2.0);       	/* 2.0*GRADIENT_DELAY */
	decphase(t6);
        decpower(pwClvl);
        delay(gstab);
		
 }
else
 {
	decphase(zero);
        zgradpulse(icosel*gzlvl1, gt1/2.0);       	/* 2.0*GRADIENT_DELAY */
	delay(delta_cc + tau2);
    	decrgpulse(2.0*pwC, t9, 0.0, 0.0);
        zgradpulse(-1.0*icosel*gzlvl1, gt1/2.0);       	/* 2.0*GRADIENT_DELAY */
	decphase(t6);
	delay(delta_cc - tau2);
 }		
	simpulse(pw, pwC, zero, t6, 0.0, 0.0);
	decpower(pwC_Sel_lvl);
	decphase(two);
	zgradpulse(gzlvl5, gt5);
	delay(lambda - pwC_Sel_pw/2.0 - gt5);
        simshaped_pulse("",pwC_Sel_Shape, 2.0*pw,pwC_Sel_pw, zero, two, 0.0, 0.0);
	decpower(pwClvl);
	zgradpulse(gzlvl5, gt5);
	txphase(one);
	decphase(one);
	delay(lambda - pwC_Sel_pw/2.0 - gt5);
	simpulse(pw, pwC, one, one, 0.0, 0.0);
	decpower(pwC_Sel_lvl);
	txphase(zero);
	decphase(zero);
	zgradpulse(gzlvl6, gt5);
	delay(lambda - pwC_Sel_pw/2.0 - gt5);
        simshaped_pulse("",pwC_Sel_Shape, 2.0*pw,pwC_Sel_pw, zero, zero, 0.0, 0.0);
	zgradpulse(gzlvl6, gt5);
	delay(lambda - pwC_Sel_pw/2.0 - gt5);
	rgpulse(pw, zero, 0.0, 0.0);
        zgradpulse(gzlvl2, gt1/8.0);         		/* 2.0*GRADIENT_DELAY */
	delay(gstab/2-2.0*GRADIENT_DELAY);		
	rgpulse(2.0*pw, zero, 0.0, 0.0);
	decpower(dpwr);					       /* POWER_DELAY */
	dec2power(dpwr2);				      /* POWER_DELAY */
        zgradpulse(-1.0*gzlvl2, gt1/8.0);         		/* 2.0*GRADIENT_DELAY */
	delay(gstab/2 -2.0*POWER_DELAY-2.0*GRADIENT_DELAY);		
status(C);
		 
	setreceiver(t11);
}		 
Esempio n. 21
0
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
            RELAY[MAXSTR],                         /* Insert HCCH-relay delay */
            ribose[MAXSTR],                         /* ribose CHn groups only */
            aromatic[MAXSTR],                     /* aromatic CHn groups only */
            rna_stCshape[MAXSTR],     /* calls sech/tanh pulses from shapelib */
            rna_stCdec[MAXSTR],        /* calls STUD+ waveforms from shapelib */
	    mag_flg[MAXSTR],             /* Flag to use magic-angle gradients */
	    H2O_flg[MAXSTR],
	    sspul[MAXSTR],
            SHAPE[MAXSTR],
	    STUD[MAXSTR];   /* apply automatically calculated STUD decoupling */
 
int         t1_counter,  		        /* used for states tppi in t1 */
            t2_counter,  	 	        /* used for states tppi in t2 */
            ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            delta1,delta2,
               ni = getval("ni"),
            lambda = 0.94/(4*getval("JCH")),       /* 1/4J H1 evolution delay */
            tCH = 1/(6.0*getval("JCH")),          /* 1/4J C13 evolution delay */
            tCC = 1/(8*getval("JCC")),

        pwClvl = getval("pwClvl"),              /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
   rfC,                           /* maximum fine power when using pwC pulses */
   compC = getval("compC"),       /* adjustment for C13 amplifier compression */
                               /* temporary Pbox parameters */
   bw, pws, ofs, ppm, nst,     /* bandwidth, pulsewidth, offset, ppm, # steps */

/* Sech/tanh inversion pulses automatically calculated by macro "rna_cal"     */
/* and string parameter rna_stCshape calls them from your shapelib.           */
   rfst = 0.0,          /* fine power for the rna_stCshape pulse, initialised */
   dofa,        /* dof shifted to 80 or 120ppm for ribose or aromatic spectra */

/* string parameter stCdec calls stud decoupling waveform from your shapelib.*/
   studlvl,	                         /* coarse power for STUD+ decoupling */
            stdmf = getval("dmf80"),     /* dmf for 80 ppm of STUD decoupling */
            rf80 = getval("rf80"),                /* rf in Hz for 80ppm STUD+ */

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

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

	gt3 = getval("gt3"),
	gt4 = getval("gt4"),
	gt5 = getval("gt5"),
	gt7 = getval("gt7"),
	gt8 = getval("gt8"),
	gt9 = getval("gt9"),
        gzcal = getval("gzcal"),
	grecov = getval("grecov"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),

	gzlvl7 = getval("gzlvl7"),		/* triax option */
	gzlvl8 = getval("gzlvl8"),
	gzlvl9 = getval("gzlvl9");

    getstr("f1180",f1180);
    getstr("mag_flg",mag_flg);
    getstr("f2180",f2180);
    getstr("RELAY",RELAY);
    getstr("ribose",ribose);
    getstr("aromatic",aromatic);
    getstr("H2O_flg",H2O_flg);
    getstr("sspul",sspul);
    getstr("SHAPE",SHAPE);
    getstr("STUD",STUD);


/*   INITIALIZE VARIABLES   */

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

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

  if (autocal[0] == 'n') 
  {
      /* 50ppm sech/tanh inversion */
      rfst = (compC*4095.0*pwC*4000.0*sqrt((7.5*sfrq/600+3.85)/0.41));
      rfst = (int) (rfst + 0.5);
  }
  else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
  {
    if(FIRST_FID)                                            /* call Pbox */
    {
      ppm = getval("dfrq"); 
      bw = 50.0*ppm; pws = 0.001; ofs = 0.0; nst = 500.0; 
      stC50 = pbox_makeA("rna_stC50", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
      if (dm3[B] == 'y') H2ofs = 3.2;
      ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
    }
    rfst = stC50.pwrf; 
  }
        strcpy(rna_stCshape, "rna_stC50");
        strcpy(rna_stCdec, "wurst80");
        studlvl = pwClvl + 20.0*log10(compC*pwC*4.0*rf80);
        studlvl = (int) (studlvl + 0.5);

/*  RIBOSE spectrum only, centered on 80ppm. */
  if (ribose[A]=='y')
        dofa = dof - 30.0*dfrq;

/*  AROMATIC spectrum only, centered on 120ppm */
  else
        dofa = dof + 10*dfrq;


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

  if((dm3[A] == 'y' || dm3[C] == 'y' ))
	{printf("incorrect dec1 decoupler flags! Should be 'nyn' or 'nnn' ");
								psg_abort(1); }
  if ((dm3[B] == 'y'  &&   dpwr3 > 44 ))
	{ printf("Deuterium decoupling power too high ! "); psg_abort(1);}

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

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


/*  CHOICE OF PULSE SEQUENCE */

  if ( ((ribose[A]=='y') && (aromatic[A]=='y')) )
   { text_error("Choose  ONE  of  ribose='y'  OR  aromatic='y' ! ");
        psg_abort(1); }

  if ( ((aromatic[A]=='y') && (RELAY[A]=='y')) )
   { text_error("No RELAY with aromatic='y' ! ");
        psg_abort(1); }


/* LOAD VARIABLES */

   settable(t1, 2, phi1);
   settable(t2, 4, phi2);
   settable(t3, 16, phi3);
   settable(t4, 2, phi4);
   settable(t11,8, rec);


/* INITIALIZE VARIABLES */

/* Phase incrementation for hypercomplex data */

   if ( phase1 == 2 )     /* Hypercomplex in t1 */
     tsadd(t1,1,4);

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

/* calculate modification to phases based on current t1 values
   to achieve States-TPPI acquisition */

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

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

   if(ix == 1) d3_init = d3;
   t2_counter = (int)((d3-d3_init)*sw2 + 0.5);
   if(t2_counter % 2)     
   {
       tsadd(t2,2,4);
       tsadd(t11,2,4);
   }
 
/* set up so that get (90, -180) phase corrects in F1 if f1180 flag is y */

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

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

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

   if (ni > 1)
      delta1 = (double)(t1_counter*(lambda - gt5 - 0.2e-3))/((double)(ni-1));
   else delta1 = 0.0;
   if (ni2 > 1)
      delta2 = (double)(t2_counter*(tCC - 0.6e-3))/((double)(ni2-1));
   else delta2 = 0.0;

   initval(7.0, v1);
   obsstepsize (45.0);

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obsoffset(tof);
   decoffset(dofa);
   dec2offset(dof2);
   obspower(tpwr-12);                   
   decpower(pwClvl);
   decpwrf(rfC);
   dec2power(pwNlvl);                  
   decphase(zero);
   dec2phase(zero);
   if (sspul[0] == 'y')
   {
      rgpulse(200*pw, one, 10.0e-6, 0.0e-6);
      rgpulse(200*pw, zero, 0.0e-6, 1.0e-6);
   }
   obspower(tpwr);                   
   xmtrphase(v1);
   txphase(t1);
   if (dm3[B] == 'y') lk_sample();
   delay(d1);
   if (dm3[B] == 'y') lk_hold();
   rcvroff();

       decrgpulse(pwC, zero, rof1, rof1);
       delay(rof1);
       zgradpulse(gzlvl0,0.5e-3); 
       delay(grecov);

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

status(B);
	rgpulse(pw, t1, 1.0e-4, rof1);
	xmtrphase(zero);
	txphase(zero);

	zgradpulse(gzlvl5,gt5); 

/*
        decpwrf(rfst);
        delay(lambda - gt5 - rof1 - SAPS_DELAY - GRADIENT_DELAY - POWER_DELAY -
                        WFG2_START_DELAY - 0.5e-3 + 70.0e-6 + tau1);

        decshaped_pulse(rna_stCshape, 1.0e-3, zero, 0.0, 0.0);

        delay(tau1 - delta1);

        rgpulse(2.0*pw, zero, 0.0, rof1);
        txphase(one);
        decpwrf(rfC);

        zgradpulse(gzlvl5,gt5);
        delay(lambda - delta1 - gt5 - rof1 - GRADIENT_DELAY - POWER_DELAY - 0.5e-3 + 70.0e-6);
*/


        delay(lambda - gt5 - rof1 - SAPS_DELAY - GRADIENT_DELAY + tau1);

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

        delay(tau1 - delta1);

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

        zgradpulse(gzlvl5,gt5);
        delay(lambda - delta1 - gt5 - rof1 - GRADIENT_DELAY);

	rgpulse(pw, one, 0.0, rof1);
	decphase(t2);
	txphase(zero);

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

	delay(grecov);

	decrgpulse(pwC, t2, rof1, 0.0);
	decphase(zero);

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

	delay(tCH - 2*pwN);

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

	delay(tCC - tCH + tau2 - delta2 - 2.0*pw);
	
	decrgpulse(2.0*pwC, t3, 0.0, 0.0);
	decphase(t4);

	delay(tCC - delta2);

	decrgpulse(pwC, t4, 0.0, rof1);
	txphase(zero);
	decphase(zero);

  if(RELAY[A] == 'y')
   {
        zgradpulse(gzlvl4, gt4);
        delay(tCC - gt4 - GRADIENT_DELAY - pwC);

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

        zgradpulse(gzlvl4, gt4);
        delay(tCC - gt4 - GRADIENT_DELAY - pwC);

        decrgpulse(pwC, zero, 0.0, 0.0);
   }

	zgradpulse(gzlvl4,gt4); 
   	delay(tCC - gt4);

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

   if (H2O_flg[A] == 'y')
   {
      delay(tCC - gt4 - grecov - POWER_DELAY);

      zgradpulse(gzlvl4,gt4); 

      txphase(one);
      decphase(one);
      delay(grecov);

      decrgpulse(pwC, one, 0.0, rof1);
      rgpulse(900*pw, one, 0.0, rof1);
      txphase(zero);

      rgpulse(500*pw, zero, rof1, rof1);
      decphase(one);

      if(mag_flg[A] == 'y')
         magradpulse(gzcal*gzlvl7,gt7);
      else
         zgradpulse(gzlvl7,gt7);
      delay(200.0e-6);

      simpulse(pw, pwC, zero, one, 0.0, rof1);
      decphase(zero);

      zgradpulse(gzlvl4,gt4); 
      delay(tCH - gt4);

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

      zgradpulse(gzlvl4,gt4); 
      delay(tCH - gt4);
   }
   else
   {
      delay(tCC - tCH - 2.0*pw - POWER_DELAY);
      rgpulse(2.0*pw, zero, 0.0, rof1);

      zgradpulse(gzlvl4,gt4); 
      delay(tCH - gt4 - rof1);
   }
   
	decrgpulse(pwC, zero, 0.0, rof1);
	txphase(zero);

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

	delay(grecov);

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

	rgpulse(pw, zero, 0.0, rof1);

  if (SHAPE[A] =='y')
   {
	decpwrf(rfst);

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

	delay(lambda - gt9 - GRADIENT_DELAY - POWER_DELAY - WFG2_START_DELAY - 0.5e-3 + 70.0e-6);

        simshaped_pulse("",rna_stCshape,2*pw, 1.0e-3, zero, zero, 0.0, rof1);
        decphase(zero);

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

	decpwrf(rfC);

if (STUD[A]=='y') decpower(studlvl); else decpower(dpwr);

	delay(lambda - gt9 -rof1 -0.5*pw - 2*POWER_DELAY - GRADIENT_DELAY - 0.5e-3 + 70.0e-6);
   }
  else
   {
   if(mag_flg[A] == 'y')
      magradpulse(gzcal*gzlvl9,gt9);
   else
      zgradpulse(gzlvl9,gt9);

        delay(lambda - gt9 - GRADIENT_DELAY);

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

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

if (STUD[A]=='y') decpower(studlvl); else decpower(dpwr);

        delay(lambda - gt9 -rof1 -0.5*pw - POWER_DELAY - GRADIENT_DELAY);
     } 

	rgpulse(pw, zero, rof1, rof2);
	rcvron();
if (dm3[B] == 'y') lk_sample();
	setreceiver(t11);

if ((STUD[A]=='y') && (dm[C] == 'y'))
	{
        decunblank();
        decon();
        decprgon(rna_stCdec,1/stdmf, 1.0);
        startacq(alfa);
        acquire(np, 1.0/sw);
        decprgoff();
        decoff();
        decblank();
        }
   else	
	 status(C);
setreceiver(t11);
}
Esempio n. 22
0
void pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            imino[MAXSTR], amino[MAXSTR],
            mag_flg[MAXSTR],       /*magic-angle coherence transfer gradients */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
            C13refoc[MAXSTR],		/* C13 sech/tanh pulse in middle of t1*/
	    NH2only[MAXSTR];		       /* spectrum of only NH2 groups */

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

double      tau1,         				         /*  t1 delay */
	    mix = getval("mix"),		 	    /* NOESY mix time */
            tau2,        				         /*  t2 delay */
	    lambda = 0.94/(4.0*getval("JNH")),	    /* 1/4J H1 evolution delay */
	    tNH = 1.0/(4.0*getval("JNH")),	  /* 1/4J N15 evolution delay */

        
        
/* the sech/tanh pulse is automatically calculated by the macro "proteincal", */  /* and is called directly from your shapelib.                  		      */
   pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
   pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
   rf0,            	          /* maximum fine power when using pwC pulses */
   rfst,	                           /* fine power for the stCall pulse */
   compH = getval("compH"),         /* adjustment for H1 amplifier compression */
   compC = getval("compC"),         /* adjustment for C13 amplifier compression */

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

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

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

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

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

    getstr("f1180",f1180);
    getstr("imino",imino); getstr("amino",amino);
    getstr("mag_flg",mag_flg);
    getstr("f2180",f2180);
    getstr("C13refoc",C13refoc);
    getstr("NH2only",NH2only);



/*   LOAD PHASE TABLE    */

	settable(t1,2,phi1);
	settable(t3,4,phi3);

	settable(t9,16,phi9);
	settable(t10,1,phi10);
	settable(t11,8,rec);




/*   INITIALIZE VARIABLES   */

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

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

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




/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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



/* PHASES AND INCREMENTED TIMES */

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

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


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


/*  Set up f2180  */

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


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

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

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



/*  Correct inverted signals for NH2 only spectra  */

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

if ( ((imino[A]=='y') && (amino[A]=='y')) )
   {
        printf(" Choose  ONE  of  imino='y'  OR  amino='y' ");
        psg_abort(1);
   }
 
  if ( ((imino[A]=='y') && (NH2only[A]=='y')) )
   {
        printf(" NH2only='y' only for amino='y'! ");
        psg_abort(1);
   }

/* BEGIN PULSE SEQUENCE */

status(A);
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
        if (imino[A] == 'y')
	  dec2offset(dof2 - 45*dfrq2);
        if (amino[A] == 'y')
	  dec2offset(dof2 - 115*dfrq2);
	decpwrf(rf0);
	txphase(zero);
        dec2phase(zero);

	delay(d1);

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

   	txphase(t1);
   	decphase(zero);
   	dec2phase(zero);
	initval(135.0,v1);
	obsstepsize(1.0);
	xmtrphase(v1);
	delay(5.0e-4);
	rcvroff();


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

        xmtrphase(zero);					/* SAPS_DELAY */
   	txphase(zero);
	if (C13refoc[A]=='y')
         {decpower(pwClvl-3.0); dec2power(pwNlvl-3.0);}

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

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

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

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

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

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

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


/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

        txphase(zero);
	dec2phase(t9);

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

    	delay(tau2);

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

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

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

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

/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */

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

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

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

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

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

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

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

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

	rgpulse(pw, zero, 0.0, 0.0);

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

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

	setreceiver(t11);
}		 
Esempio n. 23
0
pulsesequence()
{
/* DECLARE VARIABLES */

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

 int	     phase,t1_counter,icosel,ni,first_FID;

 double      /* DELAYS */
             tauhn,
             taunco,
             tau1,                               /* t1/2 */

             /* COUPLINGS */
             jhn = getval("jhn"),
             jnco = getval("jnco"),
   
             /* PULSES */
             pw180offca = getval("pw180offca"), /* PW180 for off-res ca nucleus @ rf180offca */
             pw90onco,                          /* PW90 for on-res co nucleus @ rf90onco */
             pw180onco,                         /* PW180 for on-res co nucleus @ rf90onco */
             pwN = getval("pwN"),               /* PW90 for N-nuc */
             pwC = getval("pwC"),               /* PW90 for C-nuc */
             pwHs = getval("pwHs"),             /* pw for water selective pulse  */

             /* POWER LEVELS */
             satpwr = getval("satpwr"),       /* low power level for presat */
             pwClvl = getval("pwClvl"),         /* power level for C hard pulses */ 
             pwNlvl = getval("pwNlvl"),         /* power level for N hard pulses */
             rf90onco,                          /* power level for CO 90 pulses */
             rf180onco,                         /* power level for CO 180 pulses */
             rf180offca,                        /* power level for off-res Ca 180 pulses */

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

             /* CONSTANTS */
             sw1 = getval("sw1"),
             dof = getval("dof"),
             kappa,
             dofca,
             tpwrsf_d = getval("tpwrsf_d"), /* fine power adustment for first soft pulse*/
             tpwrsf_u = getval("tpwrsf_u"), /* fine power adustment for first soft pulse*/
             tpwrs,	  	              /* power for the pwHs ("H2Osinc") pulse */

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

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

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


/* LOAD VARIABLES */

  ni = getval("ni");
  phase = (int) (getval("phase") + 0.5);
  getstr("satmode",satmode); 
  getstr("f1180",f1180); 
  getstr("abfilter",abfilter);

/* check validity of parameter range */

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

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

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

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

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

/* LOAD VARIABLES */

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

/* INITIALIZE VARIABLES AND POWER LEVELS FOR PULSES */

  tauhn = 1/(4.0*95.0);  /* initialize */
  taunco = 1/(4.0*15.0);  /* initialize */
  tauhn = ((jhn != 0.0) ? 1/(4*(jhn)) : 2.25e-3);
  taunco = ((jnco !=0.0) ? 1/(4*(jnco)) : 16.6e-3);

  kappa=(gt1 +gstab + (4.0/PI)*pwN + WFG_START_DELAY + pw180offca)/(0.5*ni/sw1)-0.001;

  if (kappa > 1.0) 
     {  
                              kappa=1.0-0.01;
     }

  if (ix == 1)
  printf("semi-constant-time factor %4.6f\n",kappa);

  dofca = dof - 118.0*dfrq;

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

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

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

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

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

/* Phase incrementation for hypercomplex data */

  if (phase == 1)      /* Hypercomplex in t2 */
     {
	                        icosel = 1;
	                        tsadd(t2, 2, 4);
	                        tsadd(t3, 2, 4);
     }  
      else icosel = -1;
   
/* calculate modification to phases based on current t1 values
   to achieve States-TPPI acquisition */
  
   if(ix == 1)
      d2_init = d2;
      t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5);

      if(t1_counter %2) 
      {
        tsadd(t1, 2, 4);
        tsadd(t7, 2, 4);
      }

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

   tau1 = d2;
   if (f1180[A] == 'y')  tau1 += ( 1.0/(2.0*sw1));
   tau1 = tau1/2.0;
   
/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(satpwr);            /* Set power for presaturation    */
   decpower(pwClvl);              /* Set decoupler1 power to pwClvl  */
   decpwrf(rf180onco);
   dec2power(pwNlvl);            /* Set decoupler2 power to pwNlvl */
   obsoffset(tof);
   decoffset(dof);
   dec2offset(dof2);

/* Presaturation Period */

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

if (tpwrsf_d<4095.0) tpwrs=tpwrs+6.0; /* allow for fine power control via tpwrsf_d */

  rcvroff();
  dec2phase(zero);
  obspwrf(tpwrsf_d); obspower(tpwrs);
  shaped_pulse("H2Osinc_d", pwHs, one, rof1, rof1);
  obspower(tpwr); obspwrf(4095.0);

  rgpulse(pw,zero,rof1,0.0);

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

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

  dec2phase(zero);
   
  rgpulse(pw,three,rof1,0.0);
            
  zgradpulse(gzlvl3,gt3);
  delay(gstab);
   
  dec2rgpulse(pwN,zero,0.0,0.0);

  if (abfilter[0] == 'b')
    {
	
        zgradpulse(gzlvl5*1.2,gt5);
	delay(gstab);

	delay(0.5*taunco - gt5 - gstab); /* 1/8J(NCO) */

        sim3pulse(0.0*pw,0.0*pw180onco,0.0,zero,zero,zero,rof1,rof1);

	delay(0.5*taunco - gt5 - gstab);     /* 1/8J(NCO) */

        zgradpulse(gzlvl5*1.2,gt5);
	dec2phase(t4);
        delay(gstab);
	
        sim3pulse(0.0,pw180onco,2.0*pwN,zero,zero,t4,rof1,rof1);
     
        zgradpulse(gzlvl5*1.2,gt5);
	delay(gstab);

	delay(0.5*taunco - gt5 - gstab);     /* 1/8J(NCO) */

        sim3pulse(0.0*pw,0.0*pw180onco,0.0,zero,zero,zero,rof1,rof1);
       
	delay(0.5*taunco - gt5 - gstab - POWER_DELAY);  /* 1/8J(NCO) */

        decpwrf(rf180offca);   
        zgradpulse(gzlvl5*1.2,gt5);
	delay(gstab);

	dec2phase(one);

	dec2rgpulse(pwN,one,0.0,0.0);  /* purge for 15N */
    }

  if (abfilter[0] == 'a')
    {
        zgradpulse(gzlvl5*1.2,gt5);
	delay(gstab);
	
	delay(0.5*taunco - gt5 - gstab - 0.5*pw180onco);   /* 1/8J(NCO) */

	sim3pulse(0.0*pw,pw180onco,0.0,zero,zero,zero,rof1,rof1); /* 180 CO */
	
	delay(0.5*taunco - gt5 - gstab - 0.5*pw180onco);   /* 1/8J(NCO) */
	
        zgradpulse(gzlvl5*1.2,gt5);
	dec2phase(t4);
	delay(gstab);

        sim3pulse(0.0,0.0,2.0*pwN,zero,zero,t4,rof1,rof1); /* 180 15N */

        zgradpulse(gzlvl5*1.2,gt5);
	delay(gstab);
	
	delay(0.5*taunco - gt5 - gstab - 0.5*pw180onco); /* 1/8J(NCO) */
	
	sim3pulse(0.0*pw,pw180onco,0.0,zero,zero,zero,rof1,rof1);  /* 180 CO */

	delay(0.5*taunco - gt5 - gstab - 0.5*pw180onco - POWER_DELAY); /* 1/8J(NCO) */

        decpwrf(rf180offca);   
        zgradpulse(gzlvl5*1.2,gt5);
	delay(gstab);	

        decphase(t5); 
       	dec2phase(zero);
       
       	dec2rgpulse(pwN,zero,0.0,0.0); /* purge for 15N */
    }

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

       	dec2rgpulse(pwN,t1,0.0,0.0); /* read for 15N */
   
       delay(tau1);
       
       decshaped_pulse("offC3",pw180offca,t5,0.0,0.0);
       
       delay((1-kappa)*tau1);
   
       zgradpulse(gzlvl1,gt1);
       delay(gstab);

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

       delay(gt1 + gstab + (4.0/PI)*pwN + WFG_START_DELAY + pw180offca - kappa*tau1);

 
   sim3pulse(pw,0.0,0.0,t2,zero,zero,rof1,rof1);  /* Pulse for 1H  */ 
 
   zgradpulse(gzlvl5,gt5);
   delay(gstab);

  delay(tauhn - gt5 - gstab);  /* delay=1/4J (NH) */

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

  txphase(zero); 
  dec2phase(zero);

  delay(tauhn - gt5 - gstab); /* 1/4J (NH)  */

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

  txphase(one);

  sim3pulse(pw,0.0,pwN,one,zero,zero,rof1,rof1); /* 90 for 1H and 15N */
  obspower(tpwrs); obspwrf(tpwrsf_u);
  shaped_pulse("H2Osinc_u", pwHs, t2, rof1, 0.0);
  obspower(tpwr); obspwrf(4095.0);
   
  dec2phase(zero);

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

  delay(tauhn -gt5 -gstab -2.0*POWER_DELAY -pwHs -WFG_START_DELAY); /* delay=1/4J (NH) */

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

  txphase(zero); 
  dec2phase(t3);

  delay(tauhn - gt5 - gstab - 2.0*POWER_DELAY);   /* 1/4J (NH)  */

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

  dec2rgpulse(pwN,t3,0.0,0.0);

  decpower(dpwr);
  dec2power(dpwr2);
   
  delay((gt1/10.0) + gstab - 2.0*POWER_DELAY);
         
  rgpulse(2.0*pw, zero, 0.0, 0.0);
         
  zgradpulse(gzlvl2*icosel,gt1*0.1);
  delay(gstab);

/* acquire data */

     setreceiver(t7);
}
void pulsesequence()
{
 char   codec[MAXSTR], codecseq[MAXSTR];

 int	icosel,  t1_counter;

 double	d2_init = 0.0, 
        rf0 = 4095, rf200, pw200,
        copwr, codmf, cores, copwrf,

        tpwrs,   
        pwHs = getval("pwHs"), 
        compH = getval("compH"),
	pwClvl = getval("pwClvl"), 
        pwC = getval("pwC"), 
        compC = getval("compC"), 
        pwNlvl = getval("pwNlvl"), 
        pwN = getval("pwN"),

        sw1 = getval("sw1"), 
        swH = getval("swH"),
        swC = getval("swC"), 
        swN = getval("swN"), 
        swTilt,
        angle_H = getval("angle_H"), 
        angle_C = getval("angle_C"),
        angle_N, 
        cos_H, 
        cos_C,
        cos_N,

        mix = getval("mix"),
        tauCH = getval("tauCH"),                                                /* 1/4JCH  */
        tauNH = getval("tauNH"),                                                /* 1/4JNH  */
	tau1, tau2, tau3,
        tofali =getval("tofali"),                             /* aliphatic protons offset  */
        dofcaco =getval("dofcaco"),               /* offset for caco decoupling, ~120 ppm  */
        dof = getval("dof"),

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

/* LOAD VARIABLES */
   copwr = getval("copwr");        copwrf = getval("copwrf");
   codmf = getval("codmf");        cores = getval("cores");
   getstr("codecseq", codecseq);   getstr("codec", codec);

/* Load phase cycling variables */

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

   angle_N=0.0; cos_N=0.0;

/* activate auto-calibration flags */
setautocal();
  if (autocal[0] == 'n')
  {
    /* 180 degree adiabatic C13 pulse from 0 to 200 ppm */
    pw200 = getval("pw200");
    rf200 = (compC*4095.0*pwC*4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35));
    rf200 = (int) (rf200 + 0.5);
                             
    if (1.0/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)) < pwC )
    { text_error( " Not enough C13 RF. pwC must be %f usec or less.\n",
                    (1.0e6/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35))) );
      psg_abort(1); }
  }
  else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
  {
    strcpy(codecseq,"Pdec_154p");
    if(FIRST_FID)                                            /* call Pbox */
    {
      ppm = getval("dfrq");
      bw = 200.0*ppm; pws = 0.001; ofs = 0.0; nst = 1000; 
                                 /* 1 ms long pulse, nst: number of steps */
      stC200 = pbox_makeA("stC200", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);

      bw=20.0*ppm; ofs=154*ppm;
      Pdec_154p = pbox_Dsh("Pdec_154p", "WURST2", bw, ofs, compC*pwC, pwClvl);
    }
    rf200 = stC200.pwrf;  pw200 = stC200.pw;
  }
/* selective H20 one-lobe sinc pulse */
   tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));
   tpwrs = (int)(tpwrs+0.5);

/* check validity of parameter range */

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

   if((dm2[A] == 'y' || dm2[B] == 'y'))
   { printf("incorrect Dec2 decoupler flags!  ");      psg_abort(1);   }
  
   if ((dpwr > 48) || (dpwr2 > 48))
   { printf("don't fry the probe, dpwr too high!  ");  psg_abort(1);   }

/* set up angles for PR42 experiments */

   /* sw1 is used as symbolic index */
   if ( sw1 < 1000 ) { printf ("Please set sw1 to some value larger than 1000.\n"); psg_abort(1); }

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

   cos_H = cos (PI*angle_H/180);  cos_C = cos (PI*angle_C/180);
   if ( (cos_H*cos_H + cos_C*cos_C) > 1.0) { printf ("Impossible angle combinations.\n"); psg_abort(1); }
   else { cos_N = sqrt(1 - (cos_H*cos_H + cos_C*cos_C) );  angle_N = acos(cos_N)*180/PI;  }

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

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

   swTilt = swH*cos_H + swC*cos_C + swN*cos_N;


   if (phase1 == 1)  {;}                                                              /* CC */
   else if (phase1 == 2)  { tsadd(t1, 1, 4); }                                        /* SC */
   else if (phase1 == 3)  { tsadd(t2, 1, 4); tsadd(t14,1,4); }                        /* CS */
   else if (phase1 == 4)  { tsadd(t1, 1, 4); tsadd(t2,1,4); tsadd(t14,1,4); }         /* SS */

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

   tau1 = 1.0 * t1_counter * cos_H / swTilt;
   tau2 = 1.0 * t1_counter * cos_C / swTilt;
   tau3 = 1.0 * t1_counter * cos_N / swTilt;

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


   if (ix ==1 )
   {
      printf ("Current Spectral Width:\t\t%5.2f\n", swTilt);
      printf ("Angle_H: %5.2f \n", angle_H);
      printf ("Angle_C: %5.2f \n", angle_C);
      printf ("Angle_N: %5.2f \n", angle_N);
      printf ("\n\n\n\n\n");
   }


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

      delay(d1);

      rcvroff();
      obsoffset(tofali);  obspower(tpwr);     obspwrf(4095.0);
      decoffset(dof);     decpower(pwClvl);   decpwrf(rf0);
      dec2offset(dof2);   dec2power(pwNlvl);  dec2pwrf(4095.0);

      if (gt0 > 0.2e-6)
      {
         decrgpulse(pwC,zero,10.0e-6,0.0);
         dec2rgpulse(pwN,zero,2.0e-6,2.0e-6);
         zgradpulse(gzlvl0,gt0); 
         delay(gstab);
      }

      txphase(t1);   decphase(t2);   dec2phase(zero);

status(B);

   rgpulse(pw,t1,4.0e-6,2.0e-6);                     

      zgradpulse(gzlvl3,gt3);
      delay(2.0*tauCH - gt3 - 2.0*GRADIENT_DELAY -4.0e-6);

   decrgpulse(pwC,t2,2.0e-6,2.0e-6);	                        
      decphase(zero);   

   /*=======  Start of c13 evolution ==========*/

      if ( ((tau2 -PRG_START_DELAY - POWER_DELAY -pwN - 2.0*pwC/PI -2.0e-6)> 0) 
           && ((tau2 -PRG_STOP_DELAY - POWER_DELAY - pwN - 2.0*pwC/PI -2.0e-6)>0)
           && (codec[A] == 'y') )
      {
         decpower(copwr);  decpwrf(copwrf);
         decprgon(codecseq,1/codmf,cores);
         decon();

         delay(tau2 -PRG_START_DELAY - POWER_DELAY -pwN - 2.0*pwC/PI -2.0e-6);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, t1, zero, zero, 0.0, 0.0);
         delay(tau2 -PRG_STOP_DELAY - POWER_DELAY - pwN - 2.0*pwC/PI -2.0e-6);

         decoff();
         decprgoff();
      }
      else if ( (tau2 -pwN - 2.0*pwC/PI -2.0e-6) > 0)
      {
         delay(tau2 -pwN - 2.0*pwC/PI -2.0e-6);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, t1, zero, zero, 0.0, 0.0);
         delay(tau2 -pwN - 2.0*pwC/PI -2.0e-6);
      }
      else
      {
         delay(2.0*tau2);
         decphase(t14);  
         delay(4.0e-6);
   sim3pulse(2.0*pw, 2.0*pwC, 2.0*pwN, t1, t14, zero, 0.0, 0.0);
         delay(4.0e-6);
      }

      decpower(pwClvl);
      decpwrf(rf0);
      decphase(zero);
   /*======= End of  c13 evolution ==========*/
   decrgpulse(pwC,zero, 2.0e-6,2.0e-6);                       

      txphase(zero);
      delay(2.0*tauCH + tau1 - gt3 - 4.0*pwC
                    - gstab -4.0e-6 - 2.0*GRADIENT_DELAY);	
      zgradpulse(gzlvl3,gt3);
      delay(gstab);

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

      delay(tau1);

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

  /* ===========Beginning of NOE transfer ======= */

      delay(mix - gt4 - gt5 - pwN -pwC - 2.0*gstab);		
      obsoffset(tof);

      zgradpulse(gzlvl4,gt4);
      delay(gstab);

   decrgpulse(pwC, zero, 2.0e-6, 2.0e-6);
   dec2rgpulse(pwN, zero, 2.0e-6, 2.0e-6);

      zgradpulse(gzlvl5,gt5);
      delay(gstab);	
                                            /* H2O relaxes back to +z */

  /* ===========   End of NOE transfer ======= */

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

      zgradpulse(gzlvl6,gt6);
      delay(tauNH - gt6 - 4.0e-6 - 2.0*GRADIENT_DELAY);

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

      delay(tauNH - gt6 - gstab -4.0e-6 - 2.0*GRADIENT_DELAY);
      zgradpulse(gzlvl6,gt6);
      txphase(one);
      delay(gstab);

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

      txphase(two);
      obspower(tpwrs);

      shaped_pulse("H2Osinc", pwHs, two, 2.0e-6, 2.0e-6);

      obspower(tpwr);
      zgradpulse(gzlvl7,gt7);
      dec2phase(t3);
      decoffset(dofcaco);          /* offset on 120ppm for CaCO decoupling */
      decpwrf(rf200);                             /* fine power for stC200 */
      delay(gstab);			

   dec2rgpulse(pwN,t3,2.0e-6,2.0e-6);

      dec2phase(t4);
      delay(tau3); 

   rgpulse(2.0*pw, zero, 2.0e-6, 2.0e-6);
   decshaped_pulse("stC200", 1.0e-3, zero, 2.0e-6, 2.0e-6);

      delay(tau3);
      delay(gt1 +gstab +8.0e-6 - 1.0e-3 - 2.0*pw);

   dec2rgpulse(2.0*pwN, t4, 2.0e-6, 2.0e-6);

      dec2phase(t5);
      zgradpulse(gzlvl1, gt1);       
      delay(gstab + WFG_START_DELAY + WFG_STOP_DELAY - 2.0*GRADIENT_DELAY);

   sim3pulse(pw, 0.0, pwN, zero, zero, t5, 2.0e-6, 2.0e-6);

      dec2phase(zero);
      zgradpulse(gzlvl8, gt8);
      delay(tauNH - gt8 - 2.0*GRADIENT_DELAY -4.0e-6);

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

      delay(tauNH  - gt8 - gstab -4.0e-6 - 2.0*GRADIENT_DELAY);
      zgradpulse(gzlvl8, gt8);
      txphase(one);    dec2phase(one);
      delay(gstab);

   sim3pulse(pw, 0.0, pwN, one, zero, one, 2.0e-6, 2.0e-6);

      txphase(zero);   dec2phase(zero);
      zgradpulse(gzlvl9, gt9);
      delay(tauNH - gt9 - 2.0*GRADIENT_DELAY -4.0e-6);

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

      delay(tauNH - gt9 - 2.0*GRADIENT_DELAY -gstab -4.0e-6);
      zgradpulse(gzlvl9, gt9);
      delay(gstab);

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

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

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

      zgradpulse(icosel*gzlvl2, gt1/10.0);    

      dec2power(dpwr2);	
      delay(gstab);

status(C);
      setreceiver(t11);
} 
Esempio n. 25
0
void pulsesequence()
{

/* DECLARE VARIABLES */

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

        CCdseq[MAXSTR],

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

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

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

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

        pwClvl = getval("pwClvl"),              /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
        rfC,                      /* maximum fine power when using pwC pulses */
	compC = getval("compC"),  /* adjustment for C13 amplifier compression */

        pwNlvl = getval("pwNlvl"),                    /* power for N15 pulses */
        pwN = getval("pwN"),          /* N15 90 degree pulse length at pwNlvl */
        rfN,                      /* maximum fine power when using pwN pulses */
        compN = getval("compN"),  /* adjustment for N15 amplifier compression */

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


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

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

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

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

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

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

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

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

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


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

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


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

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


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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


/* PHASES AND INCREMENTED TIMES */

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

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

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

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

/*  Set up f1180  */

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

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

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

        tau2 = tau2/2.0;

/* Calculate modifications to phases for States-TPPI acquisition          */
  if( ix == 1) d3_init = d3;

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

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



/* CHECK VALIDITY OF PARAMETER RANGE */


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


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

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

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

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

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

    if( ((dm[C] == 'y') && (dm2[C] == 'y') && (at > 0.18)) )
    {
        text_error("check at time! Don't fry probe !! ");
        psg_abort(1);
    }

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

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

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

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

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

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

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

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

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


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


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

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

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


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);


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

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

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


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

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


	initval(ncyc_nc,v11);

        initval(ncyc_cc,v2);

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

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


	delay(lambda);

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

	delay(lambda);

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

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

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

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



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

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


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

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

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


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

    delay(CTdelay/2.0 - tau1);

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

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

    delay(tau1);

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


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

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

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

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

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

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

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

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

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


        decphase(one);

        decpwrf(rfC);

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

	decoffset(dof_175);

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

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

	dec2phase(zero);
        decphase(zero);

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

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

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

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

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

	obsoffset(tof);

	txphase(zero);
	decphase(one);


if (tau2 > 0.0)
   {

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


else
{;}

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

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

	dec2rgpulse(pwN,t3,0.0,0.0);

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

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

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

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


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

status(C);
	rcvron();

 setreceiver(t10);
}