Ejemplo n.º 1
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values

   double aYxy8 = getval("aYxy8");  
   double pwYxy8 = getval("pwYxy8");
   double nYxy8 = getval("nYxy8");
   int cycles = (int) nYxy8/2.0;
   nYxy8 = 2.0*cycles;
   int counter = (int) (nYxy8 - 1.0);
   initval((nYxy8 - 1.0),v8);
   double onYxy8 = getval("onYxy8");
   double srate = getval("srate");

   DSEQ dec = getdseq("H");
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n"); 
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

   DSEQ mix = getdseq("Hmix");
   strncpy(mix.t.ch,"dec",3);
   putCmd("chHmixtppm='mix'\n"); 
   strncpy(mix.s.ch,"dec",3);
   putCmd("chHmixspinal='mix'\n");

//--------------------------------------
// Copy Current Parameters to Processed
//-------------------------------------

   putCmd("groupcopy('current','processed','acquisition')");

// Dutycycle Protection

   DUTY d = init_dutycycle();
   d.dutyon = getval("pwX90") + 4.0*nYxy8*pwYxy8 + getval("pwX180");
   d.dutyoff = d1 + 4.0e-6;
   d.c1 = d.c1 + (!strcmp(dec.seq,"tppm"));
   d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0));
   d.t1 = getval("rd") + getval("ad") + at;
   d.c2 = d.c2 + (!strcmp(dec.seq,"spinal"));
   d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0));
   d.t2 = getval("rd") + getval("ad") + at;
   d.c3 = d.c3 + (!strcmp(mix.seq,"tppm"));
   d.c3 = d.c3 + ((!strcmp(mix.seq,"tppm")) && (mix.t.a > 0.0));
   d.t3 = 2.0*nYxy8*(1.0/srate - 2.0*pwYxy8) + 1.0/srate - getval("pwX180");
   d.c4 = d.c4 + (!strcmp(mix.seq,"spinal"));
   d.c4 = d.c4 + ((!strcmp(mix.seq,"spinal")) && (mix.s.a > 0.0));
   d.t4 = 2.0*nYxy8*(1.0/srate - 2.0*pwYxy8) + 1.0/srate - getval("pwX180");
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0);

// Set Phase Tables

   settable(phX90,4,table1);
   settable(ph1Yxy8,8,table2);
   settable(ph2Yxy8,4,table3);
   settable(phX180,4,table4);
   settable(phRec,4,table5);

   if (counter < 0) tsadd(phRec,2,4);
   setreceiver(phRec);

// Begin Sequence

   txphase(phX90); decphase(zero);
   obspwrf(getval("aX90")); 
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// X Single Pulse

  rgpulse(getval("pwX90"),phX90,0.0,0.0);

// xy8Y Period One

  obspwrf(getval("aX180"));
  txphase(phX180); 
  if (counter >= 0) {
      _dseqon(mix);
      delay(pwYxy8/2.0);
      dec2pwrf(aYxy8);
      sub(v1,v1,v1);
      if (counter >= 1) {
         if (counter > 1) loop(v8,v9);
	    getelem(ph1Yxy8,v1,v4);
	    incr(v1);
	    getelem(ph2Yxy8,ct,v2);
	    add(v4,v2,v2);
	    dec2phase(v2);
	    delay(0.5/srate - pwYxy8);
	    if (onYxy8 == 2)
               dec2rgpulse(pwYxy8,v2,0.0,0.0);
            else
               delay(pwYxy8);
	 if (counter > 1) endloop(v9);
      }

// X Refocussing Pulse

      delay(0.5/srate - pwYxy8/2.0 - getval("pwX180")/2.0);
      rgpulse(getval("pwX180"),phX180,0.0,0.0);
      dec2pwrf(aYxy8);
      delay(0.5/srate - pwYxy8/2.0 - getval("pwX180")/2.0);

// xy8Y Period Two

      if (counter >= 1) {
         if (counter > 1) loop(v8,v9);
	    if (onYxy8 == 2)
               dec2rgpulse(pwYxy8,v2,0.0,0.0);
            else
               delay(pwYxy8);
            getelem(ph1Yxy8,v1,v4);
	    incr(v1);
	    getelem(ph2Yxy8,ct,v2);
	    add(v4,v2,v2);
	    dec2phase(v2);
	    delay(0.5/srate - pwYxy8);
	 if (counter > 1) endloop(v9);
      }
      delay(pwYxy8/2.0);
      _dseqoff(mix);
   }

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Ejemplo n.º 2
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);
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
pulsesequence()
{



    /* DECLARE AND LOAD VARIABLES */

    char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
                CT[MAXSTR],
                refocN15[MAXSTR],
                refocCO[MAXSTR], COshape[MAXSTR],
                C180shape[MAXSTR];

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

    double      tau1,         				         /*  t1 delay */
                tauch =  getval("tauch"), 	   /* 1/4J   evolution delay */
                tauch1 =  getval("tauch1"),   /* 1/4J or 1/8JC13H   evolution delay */
                timeCC =  getval("timeCC"),  /* 13C constant-time if needed*/
                corrD, corrB, /* small  correction delays */

                dof_dec =  getval("dof_dec"), /*decoupler offset for decoupling during acq - folding */

                pwClvl = getval("pwClvl"),	              /* power for hard C13 pulses */
                pwC180lvl = getval("pwC180lvl"),           /*power levels for 180 shaped pulse */
                pwC180lvlF = getval("pwC180lvlF"),
                pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
                pwC180 = getval("pwC180"),   /* shaped 180 pulse on C13channl */

                sw1 = getval("sw1"),

                pwNlvl = getval("pwNlvl"),
                pwN = getval("pwN"),

                pwCOlvl = getval("pwCOlvl"),
                pwCO = getval("pwCO"),

                gstab = getval("gstab"),
                gstab1 = getval("gstab1"), /* recovery for club sandwitch, short*/
                gt0 = getval("gt0"),
                gt1 = getval("gt1"),
                gt2 = getval("gt2"),
                gt3 = getval("gt3"),                               /* other gradients */
                gt4 = getval("gt4"),
                gt5 = getval("gt5"),
                gt9 = getval("gt9"),

                gzlvl0 = getval("gzlvl0"),
                gzlvl2 = getval("gzlvl2"),
                gzlvl3 = getval("gzlvl3"),
                gzlvl4 = getval("gzlvl4"),
                gzlvl5 = getval("gzlvl5"),
                gzlvl9 = getval("gzlvl9");



    getstr("f1180",f1180);
    getstr("C180shape",C180shape);
    getstr("COshape",COshape);
    getstr("refocCO",refocCO);
    getstr("refocN15",refocN15);
    getstr("CT",CT);


    /*   LOAD PHASE TABLE    */


    settable(t2,2,phi2);
    settable(t3,1,phi3);
    settable(t4,1,phi4);
    settable(t10,1,phix);
    settable(t11,4,rec);


    /*   INITIALIZE VARIABLES   */




    /* CHECK VALIDITY OF PARAMETER RANGES */
    /* like in olde good times */

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

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

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

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

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


    /* PHASES AND INCREMENTED TIMES */

    /*  Phase incrementation for hypercomplex 2D data, States-TPPI-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(t11,2,4);
    }



    /*  Set up f1180  */

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

    if(CT[A]=='y')   {
        refocN15[A]='y';
        refocCO[A]='y';

        if ( (timeCC-ni/sw1*0.5)*0.5 -pw -pwCO*0.5 -pwN-rof1  <0.2e-6 )
        {
            text_error("too many increments in t1 for a constant time");
            psg_abort(1);
        }
    }

    /*temporary*/
    /* correction delays */

    corrB=0.0;
    corrD=2.0/M_PI*pwC-pw-rof1;

    if (corrD < 0.0) {
        corrB=-corrD;
        corrD=0.0;
    }


    /* BEGIN PULSE SEQUENCE */

    status(A);
    obsoffset(tof);
    obspower(tpwr);
    decpower(pwClvl);
    decpwrf(4095.0);
    decoffset(dof);
    obspwrf(4095.0);
    delay(d1);

    txphase(zero);
    decphase(zero);

    decrgpulse(pwC, zero, rof1, rof1);
    zgradpulse(gzlvl0, gt0);
    delay(2.0*gstab);
    delay(5.0e-3);


    /************ H->C13 */
    txphase(zero);
    decphase(zero);

    rgpulse(pw,zero,rof1,rof1);

    decpower(pwC180lvl);
    decpwrf(pwC180lvlF);

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


    simshaped_pulse("hard",C180shape,2.0*pw,pwC180,zero,zero, 0.0, 0.0);


    decpower(pwClvl);
    decpwrf(4095.0);
    txphase(one);
    delay(tauch - gt5-gstab);
    zgradpulse(gzlvl5, gt5);
    delay(gstab);

    rgpulse(pw, one, rof1,rof1);

    /*** purge   */
    dec2power(pwNlvl);
    dec2pwrf(4095.0);
    txphase(zero);
    decphase(t2);
    delay(gstab);
    zgradpulse(gzlvl2, gt2);

    delay(3.0*gstab);


    /*  evolution on t1 */

    /* real time here */
    if(CT[A]=='n')
    {
        decrgpulse(pwC, t2, 0.0, 0.0);
        decphase(zero);
        decpower(pwC180lvl);
        decpwrf(pwC180lvlF);

        delay(tau1);
        obsunblank();
        rgpulse(pw,one,rof1,0.0);
        rgpulse(2.0*pw,zero,0.0,0.0);
        rgpulse(pw,one,0.0,rof1);
        obsblank();

        if(refocN15[A]=='y') dec2rgpulse(2.0*pwN,zero,0.0,0.0); /*n15 refocusing */

        if(refocCO[A]=='y')
        {
            decpower(pwCOlvl);
            decshaped_pulse(COshape,pwCO,zero, 3.0e-6, 3.0e-6);
            decpower(pwC180lvl);
        }


        delay(tau1);


        /*************** CODING with CLUB sandwitches and BIPS */


        zgradpulse(gzlvl3*icosel, gt3);
        delay(gstab1);
        decshaped_pulse(C180shape,pwC180,zero, 0.0, 0.0);
        zgradpulse(-gzlvl3*icosel, gt3);

        delay(gstab1 +rof1*2.0+pw*4.0 +pwC*4.0/M_PI +2.0*POWER_DELAY+2.0*PWRF_DELAY);

        if(refocN15[A]=='y') delay(2.0*pwN); /*n15 refocusing */
        if(refocCO[A]=='y') /* ghost CO pulse */
        {
            decpower(pwCOlvl);
            decshaped_pulse(COshape,pwCO,zero, 3.0e-6, 3.0e-6);
            decpower(pwC180lvl);
        }


        zgradpulse(-gzlvl3*icosel, gt3);
        delay(gstab1);
        decshaped_pulse(C180shape,pwC180,zero, 0.0, 0.0);
        zgradpulse( gzlvl3*icosel, gt3);
        decpower(pwClvl);
        decpwrf(4095.0);
        delay(gstab1);
    }      /* end of if bracket  for real-time  */
    /*^^^^^^^ end of real time */


    /* CONSTANT TIME VESION: */
    if(CT[A]=='y')
    {
        decrgpulse(pwC, t2, 0.0, 0.0);

        /* timeCC-t1 evolution */
        decpower(pwC180lvl);
        decpwrf(pwC180lvlF);
        delay((timeCC-tau1)*0.5 -2.0*pw -pwCO*0.5 -pwN-rof1);

        obsunblank();
        rgpulse(pw,one,rof1,0.0);
        rgpulse(2.0*pw,zero,0.0,0.0);
        rgpulse(pw,one,0.0,rof1);
        obsblank();

        if(refocN15[A]=='y') dec2rgpulse(2.0*pwN,zero,0.0,0.0); /*n15 refocusing */
        if(refocCO[A]=='y' )
        {
            decpower(pwCOlvl);
            decshaped_pulse(COshape,pwCO,zero, 3.0e-6, 3.0e-6);
            decpower(pwC180lvl);
        }
        delay((timeCC-tau1)*0.5 -2.0*pw -pwCO*0.5 -pwN-rof1);
        /* end of timeCC-t1 evolution */
        /* 180 on carbons in T1 */

        decshaped_pulse(C180shape,pwC180,zero, 0.0, 0.0);

        /* timeCC+t1 evolution  + encoding */

        delay((timeCC+tau1)*0.5 -2.0*pw -pwCO*0.5 -pwN -rof1);

        obsunblank();
        rgpulse(pw,one,rof1,0.0);
        rgpulse(2.0*pw,zero,0.0,0.0);
        rgpulse(pw,one,0.0,rof1);
        obsblank();
        if(refocN15[A]=='y') dec2rgpulse(2.0*pwN,zero,0.0,0.0); /*n15 refocusing */
        if(refocCO[A]=='y' )
        {
            decpower(pwCOlvl);
            decshaped_pulse(COshape,pwCO,zero, 3.0e-6, 3.0e-6);
            decpower(pwC180lvl);
        }

        delay((timeCC+tau1)*0.5 -2.0*pw -pwCO*0.5 -pwN -rof1);

        zgradpulse(-gzlvl3*icosel, gt3*2.0); /* coding */
        delay(gstab +pwC*4.0/M_PI);
        decshaped_pulse(C180shape,pwC180,zero, 2e-6, 2e-6); /* ghost BIP pulse */
        zgradpulse(gzlvl3*icosel, gt3*2.0); /* coding */
        delay(gstab);

    } /*^^^^^^^ end of CONSTANT  time  bracket*/

    /*reverse INPET */



    simpulse(pw, pwC, zero, t10, 0.0, 0.0);
    delay(gstab);
    zgradpulse(gzlvl4,gt4);
    decpower(pwC180lvl);
    decpwrf(pwC180lvlF);
    delay(tauch - gt4 - gstab -corrD-pwC180 -POWER_DELAY-PWRF_DELAY);


    decshaped_pulse(C180shape,pwC180,zero, 0.0, 0.0);
    delay(corrD);
    rgpulse(2.0*pw,zero,rof1,rof1);

    zgradpulse(gzlvl4,gt4);
    delay(tauch - gt4 - gstab -corrB-pwC180 -POWER_DELAY-PWRF_DELAY);

    delay(gstab);

    decphase(one);
    txphase(one);
    decshaped_pulse(C180shape,pwC180,zero, 0.0, 0.0);
    decpower(pwClvl);
    decpwrf(4095.0);
    delay(corrB);


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

    decpower(pwC180lvl);
    decpwrf(pwC180lvlF);
    delay(gstab-POWER_DELAY-PWRF_DELAY -WFG_START_DELAY);
    zgradpulse(gzlvl5,gt5);
    delay(tauch1 - gt5 - gstab);

    simshaped_pulse("hard",C180shape,2.0*pw,pwC180,zero,zero, 0.0, 0.0);

    delay(tauch1- gt5 - gstab -  WFG_STOP_DELAY);
    zgradpulse(gzlvl5,gt5);
    delay(gstab-rof1);
    rgpulse(pw, zero,rof1,rof1);

    /* echo and decoding */

    delay(gstab+gt9-rof1+10.0e-6 + 2.0*POWER_DELAY+PWRF_DELAY +2.0*GRADIENT_DELAY);
    decoffset(dof_dec);
    rgpulse(2.0*pw, zero,rof1,rof1);
    delay(10.0e-6);
    zgradpulse(gzlvl9,gt9);
    decpower(dpwr);
    decpwrf(4095.0);
    decoffset(dof_dec);
    dec2power(dpwr2); /* POWER_DELAY EACH */
    delay(gstab);
    status(C);
    setreceiver(t11);
}
Ejemplo n.º 5
0
void pulsesequence() {

// Define Variables and Objects and Get Parameter Values

   CP hy = getcp("HY",0.0,0.0,0,1);
   strncpy(hy.fr,"dec",3);
   strncpy(hy.to,"dec2",4);
   putCmd("frHY='dec'\n"); 
   putCmd("toHY='dec2'\n");

   CP yx = getcp("YX",0.0,0.0,0,1);
   strncpy(yx.fr,"dec2",4);
   strncpy(yx.to,"obs",3);
   putCmd("frYX='dec2'\n");
   putCmd("toYX='obs'\n");
   
   MPSEQ spc5 = getspc5("spc5X",0,0.0,0.0,0,1);
   MPSEQ spc5ref = getspc5("spc5X",spc5.iSuper,spc5.phAccum,spc5.phInt,1,1);   
   strncpy(spc5.ch,"obs",3);
   putCmd("chXspc5='obs'\n");

   DSEQ dec = getdseq("H");
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n"); 
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

// Set Constant-time Period for d2. 

   if (d2_index == 0) d2_init = getval("d2");
   double d2_ = (ni - 1)/sw1 + d2_init;
   putCmd("d2acqret = %f\n",roundoff(d2_,12.5e-9));
   putCmd("d2dwret = %f\n",roundoff(1.0/sw1,12.5e-9));

// Set Constant-time Period for d3. 

   if (d3_index == 0) d3_init = getval("d3");
   double d3_ = (ni - 1)/sw1 + d3_init;
   putCmd("d3acqret = %f\n",roundoff(d3_,12.5e-9));
   putCmd("d3dwret = %f\n",roundoff(1.0/sw2,12.5e-9));

//--------------------------------------
// Copy Current Parameters to Processed
//-------------------------------------

   putCmd("groupcopy('current','processed','acquisition')");

// Dutycycle Protection

   DUTY d = init_dutycycle();
   d.dutyon = getval("pwY90") + getval("pwH90") + getval("tHY") + getval("tYX")
              + 2.0*getval("pwX90") + spc5.t + spc5ref.t;
   d.dutyoff = d1 + 4.0e-6;
   d.c1 = d.c1 + (!strcmp(dec.seq,"tppm"));
   d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0));
   d.t1 = d2 +  d3 + getval("rd") + getval("ad") + at;
   d.c2 = d.c2 + (!strcmp(dec.seq,"spinal"));
   d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0));
   d.t2 = d2 +  d3 + getval("rd") + getval("ad") + at;
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0);

// Create Phasetables 

   settable(phH90,4,table1);
   settable(phHhy,4,table2);
   settable(phY90,4,table3);
   settable(phYhy,4,table4);
   settable(phHyx,4,table5);
   settable(phYyx,4,table6);
   settable(phXyx,4,table7);
   settable(phXmix1,4,table8);
   settable(phXmix2,4,table9);
   settable(phRec,4,table10);
   setreceiver(phRec);

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

   if (phase2 == 2)
      tsadd(phYhy,1,4);
      
// Begin Sequence

   txphase(phXyx); decphase(phH90); dec2phase(phY90);
   obspwrf(getval("aXyx")); decpwrf(getval("aH90")); dec2pwrf(getval("aY90"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// H to Y Cross Polarization with a Y Prepulse 

   dec2rgpulse(getval("pwY90"),phY90,0.0,0.0);
   dec2phase(phYhy);
   dec2pwrf(getval("aYyx"));
   decrgpulse(getval("pwH90"),phH90,0.0,0.0);
   decphase(phHhy);
   _cp_(hy,phHhy,phYhy);

// F1 Indirect Period For Y

    _dseqon(dec);
    delay(d3);
    _dseqoff(dec);

// Y to X Cross Polarization 

   decphase(phHyx); dec2phase(phYyx);
   decpwrf(getval("aHyx"));
   decunblank(); decon();
   _cp_(yx,phYyx,phXyx);
   decphase(phHhy);
   decoff();

// F2 Indirect Period for X

   obspwrf(getval("aX90"));
   _dseqon(dec);
   delay(d2);
   _dseqoff(dec);

 // Mixing with SPC5 Recoupling

   rgpulse(getval("pwX90"),phXmix1,0.0,0.0);
   obspwrf(getval("aXspc5"));
   xmtrphase(v1); txphase(phXmix1);
   delay(getval("tZF"));
   decpwrf(getval("aHmix"));
   decon();
   _mpseq(spc5, phXmix1);
   xmtrphase(v2); txphase(phXmix2);
   _mpseq(spc5ref, phXmix2);
   decoff();
   obspwrf(getval("aX90"));
   xmtrphase(zero); txphase(phXmix2);
   delay(getval("tZF"));
   rgpulse(getval("pwX90"),phXmix2,0.0,0.0);

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Ejemplo n.º 6
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       satmode[MAXSTR],
	    fscuba[MAXSTR],
            fc180[MAXSTR],    /* Flag for checking sequence              */
            ddseq[MAXSTR],    /* 2H decoupling seqfile */
            fCTCa[MAXSTR],    /* Flag for CT or non_CT on Ca dimension */
            sel_flg[MAXSTR],
	    cbdecseq[MAXSTR];

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

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             tau3,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             taub,         /*  ~ 1/4JNH =  2.25 ms */
             tauc,         /*  ~ 1/4JCaC' =  4 ms */
             taud,         /*  ~ 1/4JCaC' =  4.5 ms if bigTCo can be set to be
				less than 4.5ms and then taud can be smaller*/
             zeta,        /* time for C'-N to refocuss set to 0.5*24.0 ms */
             bigTCa,      /* Ca T period */
             bigTCo,      /* Co T period */
             bigTN,       /* nitrogen T period */
             BigT1,       /* delay to compensate for gradient gt5 */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
	     sphase,       /* small angle phase shift */
	     sphase1,
	     sphase2,      /* used only for constant t2 period */
             pwS4,         /* selective CO 180 */
             pwS3,         /* selective Ca 180 */
             pwS1,         /* selecive Ca 90 */
             pwS2,         /* selective CO 90 */
	     cbpwr,        /* power level for selective CB decoupling */
	     cbdmf,        /* pulse width for selective CB decoupling */
             cbres,        /* decoupling resolution of CB decoupling */

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

             compH = getval("compH"),         /* adjustment for amplifier compression */
             pwHs = getval ("pwHs"),         /* H1 90 degree pulse at tpwrs */
             tpwrs,                          /* power for pwHs ("H2osinc") pulse */

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

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

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

	     cos_N, cos_CO, cos_Ca,
	     angle_N, angle_CO, angle_Ca;
             angle_N=0.0;                      /*initialize variable*/

/* LOAD VARIABLES */


  getstr("satmode",satmode);
  getstr("fc180",fc180);
  getstr("fscuba",fscuba);
  getstr("ddseq",ddseq);
  getstr("fCTCa",fCTCa);

  getstr("sel_flg",sel_flg);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  tauc   = getval("tauc"); 
  taud   = getval("taud"); 
  zeta  = getval("zeta");
  bigTCa = getval("bigTCa");
  bigTCo = getval("bigTCo");
  bigTN = getval("bigTN");
  BigT1 = getval("BigT1");
  tpwr = getval("tpwr");
  dpwr = getval("dpwr");
  dpwr3 = getval("dpwr3");
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  sphase = getval("sphase");
  sphase1 = getval("sphase1");
  sphase2 = getval("sphase2");

  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  gt9 = getval("gt9");
  gt10 = getval("gt10");
  gt11 = getval("gt11");
  gt12 = getval("gt12");

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

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

     getstr("cbdecseq", cbdecseq);

/* LOAD PHASE TABLE */

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

    if( gt3 > 2.5e-3 ) 
    {
        printf("gt3 is too long\n");
        psg_abort(1);
    }
    if( gt1 > 10.0e-3 || gt2 > 10.0e-3 || gt4 > 10.0e-3 || gt5 > 10.0e-3
        || gt6 > 10.0e-3 || gt7 > 10.0e-3 || gt8 > 10.0e-3
	|| gt9 > 10.0e-3 || gt10 > 10.0e-3 || gt11 > 50.0e-6)
    {
        printf("gt values are too long. Must be < 10.0e-3 or gt11=50us\n");
        psg_abort(1);
    } 


/* PHASES AND INCREMENTED TIMES */


   /* Set up angles and phases */

   angle_CO=getval("angle_CO");  cos_CO=cos(PI*angle_CO/180.0);
   angle_Ca=getval("angle_Ca");  cos_Ca=cos(PI*angle_Ca/180.0);

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

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

   if ( 1.0 < (cos_CO*cos_CO + cos_Ca*cos_Ca) )
   {
       printf ("Impossible angles.\n"); psg_abort(1);
   }
   else
   {
           cos_N=sqrt(1.0- (cos_CO*cos_CO + cos_Ca*cos_Ca));
           angle_N = 180.0*acos(cos_N)/PI;
   }

   swTilt=swCO*cos_CO + swCa*cos_Ca + swN*cos_N;

   if (ix ==1)
   {
      printf("\n\nn\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
      printf ("Maximum Sweep Width: \t\t %f Hz\n", swTilt);
      printf ("Anlge_CO:\t%6.2f\n", angle_CO);
      printf ("Anlge_Ca:\t%6.2f\n", angle_Ca);
      printf ("Anlge_N :\t%6.2f\n", angle_N );
   }

/* Set up hyper complex */

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

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

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

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */

    if (bigTN - 0.5*ni*(cos_N/swTilt) + pwS4 < 0.2e-6)
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((bigTN + pwS4)*2.0*swTilt/cos_N)));              psg_abort(1);}

    if ((fCTCa[A]=='y') && (bigTCa - 0.5*ni*(cos_Ca/swTilt) - WFG_STOP_DELAY 
             - POWER_DELAY - gt11 - 50.2e-6 < 0.2e-6))
       {
         printf(" ni is too big for Ca. Make ni equal to %d or less.\n",
            (int) ((bigTCa -WFG_STOP_DELAY
              - POWER_DELAY - gt11 - 50.2e-6)/(0.5*cos_Ca/swTilt)) );
         psg_abort(1);
       }

     if (bigTCo - 0.5*ni*(cos_CO/swTilt) - 4.0e-6 - POWER_DELAY < 0.2e-6)
       {
        printf(" ni is too big for CO. Make ni equal to %d or less.\n",
        (int) ((bigTCo -  4.0e-6 - POWER_DELAY) / (0.5*cos_CO/swTilt)) );
        psg_abort(1);
        }


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obsoffset(tof);
   obspower(satpwr);      /* Set transmitter power for 1H presaturation */
   obspwrf(4095.0);
   decpower(pwClvl);       /* Set Dec1 power for hard 13C pulses         */
   decpwrf(4095.0);
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */
   dec2pwrf(4095.0);
   set_c13offset("ca");		/* set Dec1 carrier at Ca		      */
   sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 0.0,
                             zero, zero, zero, 2.0e-6, 0.0);
   set_c13offset("co");		/* set Dec1 carrier at Co		      */

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

   rcvroff();
   lk_hold();

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


/*   xxxxxxxxxxxxxxxxxxxxxx    1HN to 15N TRANSFER   xxxxxxxxxxxxxxxxxx    */

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

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

   delay(taua - gt1 - 2.2e-6);   /* taua <= 1/4JNH */ 

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

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

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

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

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

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

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

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

   dec2rgpulse(pwN,zero,0.0,0.0);

   delay( zeta + pwS4 );

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

   delay(zeta - 2.0e-6);

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

  }

   else {

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

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


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

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

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

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

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

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

   delay(zeta - 2.0e-6);

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

  }

   dec2phase(zero); decphase(zero);

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

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

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

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

  delay(tauc - POWER_DELAY - gt10 - 100.2e-6 - (0.5*10.933*pwC));

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

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

      delay(tauc - POWER_DELAY - 4.0e-6 - gt10 - 100.2e-6 - (0.5*10.933*pwC));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   decoff();
   decprgoff();
}

/* non_constant t2 */
else
{
  if (fc180[A]=='n')
   {
    if ((ni>1.0) && (tau1>0.0))
    {
    if (tau1 - 2.0*pwS1/PI - PRG_START_DELAY - 2*POWER_DELAY -
        PRG_STOP_DELAY - pwN > 0.0)
     {
   decpower(cbpwr);
   decphase(zero);
   decprgon(cbdecseq,1/cbdmf,cbres);
   decon();

   delay(tau1 - 2.0*pwS1/PI - PRG_START_DELAY - 2*POWER_DELAY -
        PRG_STOP_DELAY - pwN);
   decoff();
   decprgoff();

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

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

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

   delay(tau1 - 2.0*pwS1/PI - PRG_START_DELAY - 2*POWER_DELAY -
        PRG_STOP_DELAY - pwN);
   decoff();
   decprgoff();

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

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

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

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

   set_c13offset("co");   /* set carrier back to Co */

   delay(0.2e-6);

   zgradpulse(gzlvl12, gt12);
   delay(gstab);


/* xxxxxxxxxxxxxxx  13CA to 13CO TRANSFER and CT 13CO EVOLUTION xxxxxxxxxxxxxxxxx */

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

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

   delay(taud - 4.0*pwN - POWER_DELAY
         - 0.5*(WFG_START_DELAY + pwS3 + WFG_STOP_DELAY));

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

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

      delay(bigTCo - taud
            - 0.5*(WFG_START_DELAY + pwS3 + WFG_STOP_DELAY) );

      c13pulse("co", "ca", "sinc", 180.0, t8, 0.0, 0.0);
      dcplrphase(zero); decphase(one);

    delay(bigTCo - tau2 - POWER_DELAY - 4.0e-6);

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

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

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

   dec2phase(t3);

   delay(bigTN - tau3 + pwS4);

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

   txphase(zero);
   dec2phase(t4);

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

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

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

   delay(tau3);

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

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

   dec2phase(zero);
   delay(taub - gt6 - 2.2e-6);

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

   delay(0.2e-6);
   zgradpulse(gzlvl6, gt6);
   delay(200.0e-6);
   
   txphase(one);
   dec2phase(one);

   delay(taub - gt6 - 200.2e-6);

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

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

   delay(taub - gt7 - 2.2e-6);

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

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

   delay(taub - gt7 - 200.2e-6);

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

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

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

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

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

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

/* BEGIN ACQUISITION */

status(C);
         setreceiver(t6);

}
Ejemplo n.º 7
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);
}
pulsesequence()
{
/* DECLARE VARIABLES */

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

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

 double      d2_init=0.0,                        /* used for states tppi in t1 */
             tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             tau3,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             taub,         /*  ~ 1/4JNH =  2.25 ms */
             zeta,        /* time for C'-N to refocuss set to 0.5*24.0 ms */
             bigTN,       /* nitrogen T period */
             BigT1,       /* delay to compensate for gradient gt5 */
             satpwr,     /* low level 1H trans.power for presat  */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             cophase,      /* phase correction for CO evolution  */
             caphase,      /* phase correction for Ca evolution  */
             cbpwr,        /* power level for selective CB decoupling */
             cbdmf,        /* pulse width for selective CB decoupling */
             cbres,        /* decoupling resolution of CB decoupling */
             pwS1,         /* length of  90 on Ca */
             pwS2,         /* length of  90 on CO */
             pwS3,         /* length of 180 on Ca  */
             pwS4,         /* length of 180 on CO  */
             pwS5,         /* CHIRP inversion pulse on CO and CA  */
             pwrS5=0.0,        /* power of CHIRP pulse */

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

             compH = getval("compH"),         /* adjustment for amplifier compression */
             pwHs = getval ("pwHs"),         /* H1 90 degree pulse at tpwrs */
             tpwrs,                          /* power for pwHs ("H2osinc") pulse */
             waltzB1 = getval("waltzB1"),

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

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

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

  cos_N, cos_CO, cos_Ca,
  angle_N, angle_CO, angle_Ca;
  angle_N=0.0;


/* LOAD VARIABLES */


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

  getstr("sel_flg",sel_flg);

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

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

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

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

    getstr("cbdecseq", cbdecseq);

/* LOAD PHASE TABLE */

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

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


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

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

   tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));   /*needs 1.69 times more*/
   tpwrs = (int) (tpwrs);                          /*power than a square pulse */
   widthHd = 2.681*waltzB1/sfrq;  /* bandwidth of H1 WALTZ16 decoupling */
   pwHd = h1dec90pw("WALTZ16", widthHd, 0.0);     /* H1 90 length for WALTZ16 */


/* CHECK VALIDITY OF PARAMETER RANGES */


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

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


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

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

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

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

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

    if( gt3 > 2.5e-3 ) 
    {
        printf("gt3 is too long\n");
        psg_abort(1);
    }
    if( gt1 > 10.0e-3 || gt2 > 10.0e-3 || gt4 > 10.0e-3 || gt5 > 10.0e-3
        || gt6 > 10.0e-3 || gt7 > 10.0e-3 || gt8 > 10.0e-3
	|| gt9 > 10.0e-3)
    {
        printf("gt values are too long. Must be < 10.0e-3 or gt11=50us\n");
        psg_abort(1);
    } 


/* PHASES AND INCREMENTED TIMES */


   /* Set up angles and phases */

   angle_CO=getval("angle_CO");  cos_CO=cos(PI*angle_CO/180.0);
   angle_Ca=getval("angle_Ca");  cos_Ca=cos(PI*angle_Ca/180.0);

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

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

   if ( 1.0 < (cos_CO*cos_CO + cos_Ca*cos_Ca) )
   {
       printf ("Impossible angles.\n"); psg_abort(1);
   }
   else
   {
           cos_N=sqrt(1.0- (cos_CO*cos_CO + cos_Ca*cos_Ca));
           angle_N = 180.0*acos(cos_N)/PI;
   }

   swTilt=swCO*cos_CO + swCa*cos_Ca + swN*cos_N;

   if (ix ==1)
   {
      printf("\n\nn\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
      printf ("Maximum Sweep Width: \t\t %f Hz\n", swTilt);
      printf ("Anlge_CO:\t%6.2f\n", angle_CO);
      printf ("Anlge_Ca:\t%6.2f\n", angle_Ca);
      printf ("Anlge_N :\t%6.2f\n", angle_N );
   }

/* Set up hyper complex */

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

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

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

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */

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


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   set_c13offset("co");		/* set Dec1 carrier at Co		      */
   obspower(satpwr);      /* Set transmitter power for 1H presaturation */
   obspwrf(4095.0);
   decpower(pwClvl);      /* Set Dec1 power for hard 13C pulses         */
   decpwrf(4095.0);
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */
   dec2pwrf(4095.0);

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

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

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

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

   delay(taua - gt1 - 2.2e-6);   /* taua <= 1/4JNH */ 

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

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

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

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

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

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

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

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

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

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

  }

  else {

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

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

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

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

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

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

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

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

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

   }

   dec2phase(zero); decphase(t1);

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

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

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

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

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

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

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

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

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

    if (!strcmp(fca180, "y"))
    {
      delay(10.0e-6);
      sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
                             zero, zero, zero, 2.0e-6, 2.0e-6);
      decstepsize(1.0);
      initval(caphase,v5);
      dcplrphase(v5);
      delay(10.0e-6);
    }
    else
    {

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

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

      decoff();
      decprgoff();

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

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

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

      decoff();
      decprgoff();

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

     decpower(pwClvl);

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

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


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

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

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

   txphase(zero);
   dec2phase(t4);

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

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

   delay(tau3);

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

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


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

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

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

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

   delay(taub - gt6 - gstab);

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

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

   delay(taub - gt7 - 2.2e-6);

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

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

   delay(taub - gt7 - gstab);

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

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

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

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

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

lk_sample();

status(C);
         setreceiver(t6);

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

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

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

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

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

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

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

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

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

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

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

/* LOAD VARIABLES */

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

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


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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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

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

   if( gzlvl3*gzlvl4 > 0.0 ) 

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

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

/* set up Projection-Reconstruction experiment */
   
    PRexp = 0;      
    if((pra > 0.0) && (pra < 90.0)) PRexp = 1;

    csa = cos(pra);
    sna = sin(pra);
    
    if(PRexp)
    {
      tau1 = d2*csa;
      tau2 = d2*sna;
    }
    else
    {
      tau1 = d2;
      tau2 = d3;
    }

    if((f1180[A] == 'y') && (ni > 1.0))    /*  Set up f1180  tau1 = t1 */
      tau1 += 1.0/(2.0*sw1);
    tau1 = tau1/2.0;

    if((PRexp == 0) && (f2180[A] == 'y') && (ni2 > 1.0)) /*  Set up f2180  tau2 = t2 */
      tau2 += 1.0/(2.0*sw2);     
    tau2 = tau2/2.0;

    if(tau1 < 0.2e-7) tau1 = 2.0e-7;

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

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

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

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

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


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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */


status(A);

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   rgpulse(pw,zero,0.0,0.0);  

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

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

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

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

   setreceiver(t4);
   rcvron();
   if ((wudec[A]=='y') && (dm[D] == 'y'))
   {
     decpower(wuCdec.pwr+3.0);
     decprgon("wurstC", 1.0/wuCdec.dmf, wuCdec.dres);
     decon();
   }
   else	
   { 
     decpower(dpwr);
     status(D);
   }
}
Ejemplo n.º 10
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values
     
   CP hy = getcp("HY",0.0,0.0,0,1);
   strncpy(hy.fr,"dec",3);
   strncpy(hy.to,"dec2",4);
   putCmd("frHY='dec'\n");
   putCmd("toHY='dec2'\n");
    
   CP yx = getcp("YX",0.0,0.0,0,1);
   strncpy(yx.fr,"dec2",4);
   strncpy(yx.to,"obs",3);
   putCmd("frYX='dec2'\n");
   putCmd("toYX='obs'\n");

   DSEQ dec = getdseq("H");
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n"); 
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

// Set Constant-time Period for d2. 

   if (d2_index == 0) d2_init = getval("d2");
   double d2_ = (ni - 1)/sw1 + d2_init;
   putCmd("d2acqret = %f\n",roundoff(d2_,12.5e-9));
   putCmd("d2dwret = %f\n",roundoff(1.0/sw1,12.5e-9));

// Set Constant-time Period for d3. 

   if (d3_index == 0) d3_init = getval("d3");
   double d3_ = (ni - 1)/sw1 + d3_init;
   putCmd("d3acqret = %f\n",roundoff(d3_,12.5e-9));
   putCmd("d3dwret = %f\n",roundoff(1.0/sw2,12.5e-9));

// Set Mixing Period to N Rotor Cycles

   double taur,mix,srate;
   mix =  getval("tXmix");
   srate =  getval("srate");
   taur = 0.0;
   if (srate >= 500.0)
      taur = roundoff((1.0/srate), 0.125e-6);
   else {
      printf("ABORT: Spin Rate (srate) must be greater than 500\n");
      psg_abort(1);
   }
   mix = roundoff(mix,taur);
   mix = mix - getval("pwX90"); 
   if (mix < 0.0) mix = 0.0; 

//--------------------------------------
// Copy Current Parameters to Processed
//-------------------------------------

   putCmd("groupcopy('current','processed','acquisition')");

// Dutycycle Protection

   DUTY d = init_dutycycle();
   d.dutyon = getval("pwY90") + getval("pwH90") + getval("tHY") + getval("tYX") 
              + 2.0*getval("pwX90") + mix; 
   d.dutyoff = d1 + 4.0e-6; 
   d.c1 = d.c1 + (!strcmp(dec.seq,"tppm"));
   d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0));
   d.t1 = d2 +  d3 + getval("rd") + getval("ad") + at;
   d.c2 = d.c2 + (!strcmp(dec.seq,"spinal"));
   d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0));
   d.t2 = d2 +  d3 + getval("rd") + getval("ad") + at;
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0); 

// Create Phasetables

   settable(phH90,4,table1);
   settable(phHhy,4,table2);
   settable(phY90,4,table3);
   settable(phYhy,4,table4);
   settable(phHyx,4,table5);
   settable(phYyx,4,table6);
   settable(phXyx,8,table7);
   settable(phXmix1,8,table8);
   settable(phXmix2,8,table9);
   settable(phRec,8,table10);

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

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

// Begin Sequence

   setreceiver(phRec);
   txphase(phXyx); decphase(phH90); dec2phase(phY90);
   obspwrf(getval("aXyx")); decpwrf(getval("aH90")); dec2pwrf(getval("aY90"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// H to Y Cross Polarization with a Y Prepulse

   dec2rgpulse(getval("pwY90"),phY90,0.0,0.0);
   dec2phase(phYhy);
   dec2pwrf(getval("aYyx"));
   decrgpulse(getval("pwH90"),phH90,0.0,0.0);
   decphase(phHhy);
   _cp_(hy,phHhy,phYhy);

// F1 Indirect Period For Y

    _dseqon(dec);
    delay(d2);
    _dseqoff(dec);

// Y to X Cross Polarization

   decphase(phHyx); dec2phase(phYyx);
   decpwrf(getval("aHyx"));
   decunblank(); decon();
   _cp_(yx,phYyx,phXyx);
   decphase(phHhy);
   decoff();

// F2 Indirect Period for X

    txphase(phXmix1);
    obspwrf(getval("aX90"));
   _dseqon(dec);
   delay(d3);
   _dseqoff(dec);

// RAD(DARR) Mixing For X

   decpwrf(getval("aHmix"));
   decunblank(); decon();
   rgpulse(getval("pwX90"),phXmix1,0.0,0.0);
   txphase(phXmix2);
   obsunblank();
   delay(mix);
   rgpulse(getval("pwX90"),phXmix2,0.0,0.0);
   decoff();

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Ejemplo n.º 11
0
void pulsesequence() {

// Define Variables and Objects and Get Parameter Values
     
   CP hy = getcp("HY",0.0,0.0,0,1);
   strncpy(hy.fr,"dec",3);
   strncpy(hy.to,"dec2",4);
   putCmd("frHY='dec'\n");
   putCmd("toHY='dec2'\n");
    
   CP yx = getcp("YX",0.0,0.0,0,1);
   strncpy(yx.fr,"dec2",4);
   strncpy(yx.to,"obs",3);
   putCmd("frYX='dec2'\n");
   putCmd("toYX='obs'\n");

   DSEQ dec = getdseq("H");
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n"); 
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

//--------------------------------------
// Copy Current Parameters to Processed
//-------------------------------------

   putCmd("groupcopy('current','processed','acquisition')");

// Dutycycle Protection

   DUTY d = init_dutycycle();
   d.dutyon = getval("pwY90") + getval("pwH90") + getval("tHY") + getval("tYX")
              + 2.0*getval("pwX90");
   d.dutyoff = d1 + 4.0e-6;
   d.c1 = d.c1 + (!strcmp(dec.seq,"tppm"));
   d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0));
   d.t1 = getval("rd") + getval("ad") + at;
   d.c2 = d.c2 + (!strcmp(dec.seq,"spinal"));
   d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0));
   d.t2 = getval("rd") + getval("ad") + at;
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0);

// Create Phasetables

   settable(phH90,4,table1);
   settable(phHhy,4,table2);
   settable(phY90,4,table3);
   settable(phYhy,4,table4);
   settable(phHyx,4,table5);
   settable(phYyx,4,table6);
   settable(phXyx,8,table7);
   settable(phRec,8,table8);

// Begin Sequence

   setreceiver(phRec);
   txphase(phXyx); decphase(phH90); dec2phase(phY90);
   obspwrf(getval("aXyx")); decpwrf(getval("aH90")); dec2pwrf(getval("aY90"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// H to Y Cross Polarization with a Y Prepulse

   dec2rgpulse(getval("pwY90"),phY90,0.0,0.0);
   dec2phase(phYhy);
   dec2pwrf(getval("aYyx"));
   decrgpulse(getval("pwH90"),phH90,0.0,0.0);
   decphase(phHhy);
   _cp_(hy,phHhy,phYhy);

// Y to X Cross Polarization

   decphase(phHyx); dec2phase(phYyx);
   decpwrf(getval("aHyx"));
   decunblank(); decon();
   _cp_(yx,phYyx,phXyx);
   decphase(phHhy);
   dec2blank();
   decoff();

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Ejemplo n.º 12
0
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */
int         t1_counter, t2_counter;	/* used for states tppi in t1 & t2*/

char	    IPAP[MAXSTR], Hstart[MAXSTR],
            f1180[MAXSTR],H2dec[MAXSTR],
            shCACB_90[MAXSTR],shCACB_90r[MAXSTR],
	    shCACB_180[MAXSTR], shCB_180[MAXSTR], decCB[MAXSTR],
            shCACB_180off[MAXSTR],
            shCBIP[MAXSTR],
	    shCO_90[MAXSTR],            
	    shCO_180[MAXSTR],
            shCO_180off[MAXSTR];

double
	    tau1,			/*  t1 delay */
               x,
            TCH = getval("TCH"), 
	    TC = getval("TC"), 		/* delay 1/(2JCACB) ~  7.0ms in Ref. */ 
            del = getval("del"),	/* delay del = 1/(2JC'C) ~ 9.0ms in Ref. */         
            pwClvl = getval("pwClvl"), 	/* coarse power for C13 pulse */
            pwC = getval("pwC"),        /* C13 90 degree pulse length at pwClvl */
            compC = getval("compC"),    /* adjustment for C13 amplifier compression */
	    pwClvlF=getval("pwClvlF"),   /* maximum fine power when using pwC pulses */

	     pwHlvl = getval("pwHlvl"),
             pwH = getval("pwH"),
	    

        pwCBIP  =  getval("pwCBIP"),	
  /* 90 degree pulse at CO (174ppm)    */
      
        pwCO_90  =  getval("pwCO_90"),			/* 90 degree pulse length on C13  */
        pwCO_90phase_roll  =  getval("pwCO_90phase_roll") , /* fraction of CACB pulse to compensate for phase roll */
        pwrCO_90 =  getval("pwrCO_90"),		       	/*power  */
        pwrfCO_90 = getval("pwrfCO_90"),
        
/* 180 degree pulse at CO (174ppm)  */

        pwCO_180   =  getval("pwCO_180"),			/* 180 degree pulse length on C13  */
        pwrCO_180  =  getval("pwrCO_180"),		       	/*power  */
        pwrfCO_180 =  getval("pwrfCO_180"),

/* 90 degree pulse at CAB (57.7ppm)  */

        tofCACB    =  getval("tofCACB"), 
        pwCACB_90  =  getval("pwCACB_90"),
        pwCACB_90phase_roll  =  getval("pwCACB_90phase_roll") , /* fraction of CACB pulse to compensate for phase roll */

			/* 90 degree pulse length on C13  */
        pwrCACB_90 =  getval("pwrCACB_90"),		       	/*power  */
        pwrfCACB_90 = getval("pwrfCACB_90"),

/* 180 degree pulse at CA (57.7ppm)  */
        pwCACB_180   =  getval("pwCACB_180"),			/* 180 degree pulse length on C13  */
        pwrCACB_180  =  getval("pwrCACB_180"),		       	/*power  */
        pwrfCACB_180 =  getval("pwrfCACB_180"),

        pwCB_180   =  getval("pwCB_180"),			/* 180 degree pulse length on C13  */
        pwrCB_180  =  getval("pwrCB_180"),
 

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

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

	gt2 = getval("gt2"),				   
	gzlvl2 = getval("gzlvl2"),
        gt3 = getval("gt3"),
        gzlvl3 = getval("gzlvl3"),
        gstab = getval("gstab");
        getstr("IPAP",IPAP); 
        getstr("H2dec",H2dec); 

         getstr("shCBIP",shCBIP);
         getstr("f1180",f1180);
	 getstr("shCACB_90",shCACB_90); getstr("shCACB_90r",shCACB_90r);
         getstr("shCACB_180",shCACB_180); getstr("shCACB_180off",shCACB_180off);
         getstr("shCB_180",shCB_180); getstr("decCB",decCB);
	 getstr("shCO_90",shCO_90);
         getstr("shCO_180",shCO_180);    getstr("shCO_180off",shCO_180off);

	getstr("Hstart",Hstart);

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

         

	 

/*   INITIALIZE VARIABLES   */
if( (IPAP[A] != 'i') &&  (IPAP[A] != 'a')&&  (IPAP[A] != 't'))
  { text_error("IPAP flag either i or a, exiting "); psg_abort(1); }

if( (Hstart[A]=='y') && ((dmm[A]!='c' || dm[A]=='y')) ) 
{ 
 text_error("Incorrect combination of dm, dmm and Hstart.  "); 
                         psg_abort(1);};


x=0.0;
if(decCB[A]=='y'){x=1.0;}
if(ni/sw1 > TC-2.0*pwCB_180*x) { 

 text_error("too many increments in CAB t1 evolution %d\n",(int)( (TC-2.0*pwCB_180*x)*sw1 +0.5)); 
                         psg_abort(1);};


/* PHASES AND INCREMENTED TIMES */

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

    if (phase1 == 2)    tsadd(t1,1,4);  
    
    tau1 = d2;
    if(f1180[A]=='y') {tau1+=0.5/sw1;}
    tau1 = tau1/2.0;

    
/* Calculate modifications to phases for States-TPPI acquisition          */
if(IPAP[A]=='a'){tsadd(t4,1,4);};




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

/* BEGIN PULSE SEQUENCE */

status(A);
   	 delay(10.0e-6);
        obspower(pwClvl);
        obspwrf(4095.0);
        dec2power(dpwr2); dec2pwrf(4095.0);
   	obsoffset(tofCACB);
        delay(d1);


/* option to start from H magnetization */
if(Hstart[A]=='y') 
     {
	decpower(pwHlvl); decpwrf(4095.0);

	   decrgpulse(pwH, zero, 0.0, 0.0);
	   delay(TCH);
	   simpulse(2.0*pwC,2.0*pwH, zero,zero, 0.0, 0.0);
	   delay(TCH);
	   decrgpulse(pwH, one, 0.0, 0.0);

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

 	   rgpulse(pwC, two, 0.0, 0.0);
 	    delay(TCH);
 	    simpulse(2.0*pwC,2.0*pwH, zero,zero, 0.0, 0.0);
 	    delay(TCH);
  	    rgpulse(pwC, one, 0.0, 0.0);

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

	decpower(dpwr); decpwrf(4095.0);
}


if (H2dec[A] == 'y') lk_hold();
status(B);
 /* CACO experiment */     

/************optional deuterium decoupling**************************/
	if(H2dec[A] == 'y'){  dec3unblank();
                             if(1.0/dmf3>900.0e-6) {
						     dec3power(dpwr3+6.0);
						     dec3rgpulse(0.5/dmf3, one, 1.0e-6, 0.0e-6);
						     dec3power(dpwr3);
						     }
			   else dec3rgpulse(1.0/dmf3, one, 1.0e-6,0.0e-6);
  			   dec3phase(zero);       setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
	                    }	

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

	/* begin CA   evolution and transfer to CO */


        obspwrf(pwrfCACB_90);  obspower(pwrCACB_90);
	shapedpulse(shCACB_90,pwCACB_90,t1,0.0,0.0);


        obspwrf(4095.0);  obspower(pwClvl);

 
        delay(10.0e-6);
        shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);
        delay(10.0e-6);

        if(decCB[A]=='y') {
                delay( (TC/2.0-tau1 + 2.0*pwCACB_90phase_roll*pwCACB_90)*0.5 -pwCB_180*0.5);
         	obspower(pwrCB_180);
	 	shapedpulse(shCB_180,pwCB_180,zero,0.0,0.0);
                delay( (TC/2.0-tau1 + 2.0*pwCACB_90phase_roll*pwCACB_90)*0.5 -pwCB_180*0.5);
		}

        else	delay(TC/2.0-tau1 + 2.0*pwCACB_90phase_roll*pwCACB_90);
        
        obspower(pwClvl);
        shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);
   
       if(decCB[A]=='y') {
			delay((TC/2.0+tau1)*0.5 -pwCB_180*0.5);
         		obspower(pwrCB_180);
	 		shapedpulse(shCB_180,pwCB_180,zero,0.0,0.0);
			delay((TC/2.0+tau1)*0.5 -pwCB_180*0.5);
           }
        else delay(TC/2.0+tau1);

        obspower(pwrCACB_90);
	shapedpulse(shCACB_90r,pwCACB_90,one,0.0,0.0);

/*************************************************************/
 	if(H2dec[A] == 'y')  {                     
	                    setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
                             

                             if(1.0/dmf3>900.0e-6) {
						     dec3power(dpwr3+6.0);
						     dec3rgpulse(0.5/dmf3, three, 1.0e-6, 0.0e-6);
						     dec3power(dpwr3);
						     }

	                    else dec3rgpulse(1.0/dmf3, three, 1.0e-6, 0.0e-6);	    dec3blank();  
			   }
/*************************************************************/

    /* CAzCOz */

 
         delay(10e-6);
         obsoffset(tof);
         delay(10e-6);
	zgradpulse(gzlvl1,gt1);
	delay(gstab);
status(C);
     /* CAzCOz ->  CO or CACO */

        obspwrf(pwrfCO_90);  obspower(pwrCO_90);
	shapedpulse(shCO_90,pwCO_90,t4,0.0,0.0);

        /* ghost 180 on CA*/
     
  if(IPAP[A]=='i')   {

       obspwrf(pwClvlF);  obspower(pwClvl);
        delay(10.0e-6);
        shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);
        delay(10.0e-6);

         
       delay(del/2.0 + pwCO_90phase_roll*pwCO_90);

 	obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
 	delay(10.0e-6);
 	shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
  	obspwrf(pwClvlF);  obspower(pwClvl);
 	delay(10.0e-6);

       shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);

	obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
 	delay(10.0e-6);
 	shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
  
 	delay(10.0e-6);


       delay(del/2.0 );
  }


/***>>>>>>>>>>>**TEST*********/
  if(IPAP[A]=='t')   {
         obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
        delay(10.0e-6);
        shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
        delay(10.0e-6);
        obspwrf(pwrfCO_180); obspower(pwrCO_180);
	delay(del/2.0);
   

     shapedpulse(shCO_180,pwCO_180,zero,0.0,0.0);

        
        obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
        delay(10.0e-6);
         shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
        delay(10.0e-6);

        obspwrf(pwrfCO_90);  obspower(pwrCO_90);
        delay(del/2.0);
  }

/********<<<<<<<<<<<<<**TEST*********/

  if(IPAP[A]=='a')   {

       obspwrf(pwClvlF);  obspower(pwClvl);
          
        delay(10.0e-6);
        shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);
        delay(10.0e-6);

         
        delay(del/4.0 + pwCO_90phase_roll*pwCO_90);

 	obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
 	delay(10.0e-6);
 	shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
  	obspwrf(pwClvlF);  obspower(pwClvl);

 	delay(10.0e-6);
        delay(del/4.0 );

       shapedpulse(shCBIP,pwCBIP,zero,0.0,0.0);

        delay(del/4.0);

	obspwrf(pwrfCACB_180); obspower(pwrCACB_180);
 	delay(10.0e-6);
 	shapedpulse(shCACB_180off,pwCACB_180,zero,0.0,0.0);
  
 	delay(10.0e-6);

       delay(del/4.0 );
  }

 if (H2dec[A]=='y') lk_sample();

status(D);
	setreceiver(t12);
	
}
Ejemplo n.º 13
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values

   double aXxyxy8 = getval("aXxyxy8");
   double aYxyxy8 = getval("aYxyxy8");
   double pwXxyxy8 = getval("pwXxyxy8");
   double pwYxyxy8 = getval("pwYxyxy8");
   double nXYxy8 = getval("nXYxy8");
   int counter = nXYxy8;
   initval(nXYxy8,v8);
   double fXYxy8 = getval("fXYxy8");
   double onYxyxy8 = getval("onYxyxy8");
   double srate = getval("srate");

   DSEQ dec = getdseq("H");
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n"); 
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

   DSEQ mix = getdseq("Hmix");
   strncpy(mix.t.ch,"dec",3);
   putCmd("chHmixtppm='dec'\n");
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHmixspinal='dec'\n");

//--------------------------------------
// Copy Current Parameters to Processed
//-------------------------------------

   putCmd("groupcopy('current','processed','acquisition')");

// Dutycycle Protection

   DUTY d = init_dutycycle();
   d.dutyon = getval("pwX90") + nXYxy8*(pwXxyxy8 + pwYxyxy8);
   d.dutyoff = d1 + 4.0e-6;
   d.c1 = d.c1 + (!strcmp(dec.seq,"tppm"));
   d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0));
   d.t1 = getval("rd") + getval("ad") + at;
   d.c2 = d.c2 + (!strcmp(dec.seq,"spinal"));
   d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0));
   d.t2 = getval("rd") + getval("ad") + at;
   d.c3 = d.c3 + (!strcmp(mix.seq,"tppm"));
   d.c3 = d.c3 + ((!strcmp(mix.seq,"tppm")) && (mix.t.a > 0.0));
   d.t3 = nXYxy8*(1.0/srate - pwXxyxy8 - pwYxyxy8);
   d.c4 = d.c4 + (!strcmp(mix.seq,"spinal"));
   d.c4 = d.c4 + ((!strcmp(mix.seq,"spinal")) && (mix.s.a > 0.0));
   d.t4 = nXYxy8*(1.0/srate - pwXxyxy8 - pwYxyxy8);
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0);

// Set Phase Tables

   settable(phX90,4,table1);
   settable(phXYxy8,8,table2);
   settable(phXxyxy8,4,table3);
   settable(phYxyxy8,4,table4);
   settable(phRec,4,table5);
   settable(ph1Rec,4,table6);
   settable(ph2Rec,4,table7);
   settable(ph3Rec,4,table8);
   int tix = counter%8;

   if ((tix == 1) || (tix == 7)) ttadd(phRec,ph1Rec,4);
   if ((tix == 2) || (tix == 6)) ttadd(phRec,ph2Rec,4);
   if ((tix == 3) || (tix == 5)) ttadd(phRec,ph3Rec,4);
   setreceiver(phRec);

// Begin Sequence

   txphase(phX90); decphase(zero);
   obspwrf(getval("aX90"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// X Direct Polarization

   rgpulse(getval("pwX90"),phX90,0.0,0.0);

// xy8XY Period

   if (counter > 0) {
      _dseqon(mix);
      delay(pwXxyxy8/2.0);
      obspwrf(aXxyxy8); dec2pwrf(aYxyxy8);
      sub(v1,v1,v1);
      if (counter >= 1) {
         loop(v8,v9);
	    getelem(phXYxy8,v1,v4);
	    incr(v1);
	    getelem(phXxyxy8,ct,v2);
	    getelem(phYxyxy8,ct,v3);
	    add(v4,v2,v2);
	    add(v4,v3,v3);
	    txphase(v2); dec2phase(v3);
	    delay((1.0 - fXYxy8)/srate - pwYxyxy8/2.0 - pwXxyxy8/2.0);
	    if (onYxyxy8 == 2)
               dec2rgpulse(pwYxyxy8,v3,0.0,0.0);
            else
               delay(pwYxyxy8);
	    delay(fXYxy8/srate - pwYxyxy8/2.0 - pwXxyxy8/2.0);
	    rgpulse(pwXxyxy8,v2,0.0,0.0);
	 endloop(v9);
	 delay(1.0/srate - pwXxyxy8/2.0);
      }
      _dseqoff(mix);
   }

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Ejemplo n.º 14
0
void pulsesequence()
{
/* DECLARE VARIABLES */

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

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

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

double    

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


/* LOAD VARIABLES */

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

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

  getstr("auto_dof",auto_dof);

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

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

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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

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

/*   if( gzlvl3*gzlvl4 > 0.0 )*/ 

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

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

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

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if((f2180[A] == 'y') && (ni2 > 1.0)) tau2 += ( 1.0 / (2.0*sw2) ); 
    tau2 = tau2/2.0;

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

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

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

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

  if (N15refoc[A] == 'y')
    {
     if (pwNlw==0.0) pwNlw = compN*pwN*exp(3.0*2.303/20.0);
     if (pwClw==0.0) pwClw = compC*pwC*exp(3.0*2.303/20.0);
     if (pwNlw > 2.0*pwClw) 
	 pwZlw=pwNlw;
      else
	 pwZlw=2.0*pwClw;
/* Uncomment to check pwClw and pwNlw
     if (d2==0.0 && d3==0.0) printf(" pwClw = %.2f ; pwNlw = %.2f\n", pwClw*1e6,pwNlw*1e6);
*/
    }


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


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


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

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

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

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

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

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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

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

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

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


   delay(d1);

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

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


status(B);

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

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

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

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

      decrgpulse(pwC, zero, 0.0, 0.0);

      delay(taud -taue -pwC);

/* CN FILTER ENDS */

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

      zgradpulse(gzlvl8,gt8);
      decpwrf(rffil);
      delay(taud -gt8 -2.0*GRADIENT_DELAY -WFG2_START_DELAY -0.5e-3 +70.0e-6);

      simshaped_pulse("", "stC200", 2.0*pw, pwC180, zero, zero, 0.0, 0.0);

      zgradpulse(gzlvl8,gt8);
      decpwrf(rf0);
      delay(taud -gt8 -2.0*GRADIENT_DELAY -0.5e-3 +70.0e-6);

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

      zgradpulse(gzlvl4,gt4);
      txphase(t7);
      delay(gstab);

      rgpulse(pw, t7, 0.0, 0.0);
/* BEGIN 2nd FILTER */

      zgradpulse(gzlvl9,gt9);
      decpwrf(rffil);
      delay(taue -gt9 -2.0*GRADIENT_DELAY -WFG2_START_DELAY -0.5e-3 +70.0e-6);

      simshaped_pulse("", "stC200", 2.0*pw, pwC180, zero, zero, 0.0, 0.0);

      zgradpulse(gzlvl9,gt9);
      decpwrf(rf0);
      delay(taue -gt9 -2.0*GRADIENT_DELAY -0.5e-3 +70.0e-6);

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

      zgradpulse(gzlvl7,gt7);
      txphase(t1); xmtrphase(v1);
      delay(gstab);

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

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

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

      decpwrf(rffil);
      delay(tauNH -taud -0.5e-3 -WFG_START_DELAY -PWRF_DELAY);

      decshaped_pulse("stC200", pwC180, zero, 0.0, 0.0);

      zgradpulse(gzlvl8,gt8);
      decpwrf(rf0);
      delay(taud -gt8 -2.0*GRADIENT_DELAY -0.5e-3 -PWRF_DELAY);

      sim3pulse(pw, pwC, pwN, zero, zero, zero, 0.0, 0.0);
      zgradpulse(gzlvl14,gt14);
      txphase(t7);
      delay(gstab);

      rgpulse(pw, t7, 0.0, 0.0);
/* BEGIN 2nd FILTER */

      zgradpulse(gzlvl9,gt9);
      delay(tauNH -gt9 -2.0*GRADIENT_DELAY);

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

      decpwrf(rffil);
      delay(tauNH -taue -0.5e-3 -WFG_START_DELAY -PWRF_DELAY);

      decshaped_pulse("stC200", pwC180, zero, 0.0, 0.0);

      zgradpulse(gzlvl9,gt9);
      decpwrf(rf0);
      delay(taue -gt9 -2.0*GRADIENT_DELAY -0.5e-3 -PWRF_DELAY);

      sim3pulse(pw, pwC, pwN, zero, zero, zero, 0.0, 0.0);
      zgradpulse(gzlvl17,gt17);
      txphase(t1); xmtrphase(v1);
      delay(gstab);

      rgpulse(pw, t1, 0.0, 0.0);
      txphase(zero); xmtrphase(zero);
   }

/* H1 INDIRECT EVOLUTION BEGINS */
   if (ni > 0) 
    txphase(t3);
    {
     if ( (N15refoc[A]=='y') && ((tau1 -pwN -2.0*pw/PI -rof1 -SAPS_DELAY) > 0.0) )
      {
       delay(tau1 -pwN -2.0*pw/PI -SAPS_DELAY);
       dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
       delay(tau1 -pwN -2.0*pw/PI -rof1);
      }     
     else if (tau1 > 2.0*pw/PI +rof1 +SAPS_DELAY)
       delay(2.0*tau1 -4.0*pw/PI -2.0*rof1 -SAPS_DELAY);
    }
/* H1 INDIRECT EVOLUTION ENDS */
   rgpulse(pw, t3, rof1, rof1);             /*  2nd 1H 90 pulse   */

status(C);

   delay(mix -pwC -gt0 -PWRF_DELAY -gstab -2.0*GRADIENT_DELAY); 

   decrgpulse(pwC,zero,0.0,0.0); 
   zgradpulse(gzlvl0, gt0);
   decpwrf(rfst);                           /* fine power for inversion pulse */
   delay(gstab);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   rgpulse(pw,zero,0.0,0.0);  

   delay(gt2 +gstab +2.0*GRADIENT_DELAY +POWER_DELAY);

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

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

  setreceiver(t4);
   rcvron();
   if ((STUD[A]=='y') && (dm[D] == 'y'))
    {
     decpower(studlvl);
     decprgon(stCdec, 1.0/stdmf, 1.0);
     decon();
    }
   else	
    { 
     decpower(dpwr);
     status(D);
    }
}
Ejemplo n.º 15
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values

   CP hx = getcp("HX",0.0,0.0,0,1); 
   strncpy(hx.fr,"dec",3);
   strncpy(hx.to,"obs",3);
   putCmd("frHX='dec'\n"); 
   putCmd("toHX='obs'\n");

   DSEQ dec = getdseq("H");
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n"); 
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

//--------------------------------------
// Copy Current Parameters to Processed
//-------------------------------------

   putCmd("groupcopy('current','processed','acquisition')");

// Dutycycle Protection

   DUTY d = init_dutycycle();
   d.dutyon = getval("pw1Hhytrap") + getval("pw2Hhytrap") + getval("tHX"); 
   d.dutyoff = d1 + 4.0e-6 + getval("t1HYtrap") + getval("t2HYtrap");
   d.c1 = d.c1 + (!strcmp(dec.seq,"tppm"));
   d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0));
   d.t1 = getval("rd") + getval("ad") + at;
   d.c2 = d.c2 + (!strcmp(dec.seq,"spinal"));
   d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0));
   d.t2 = getval("rd") + getval("ad") + at;
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0);

// Set Phase Tables

   settable(ph1Hhytrap,4,table1);
   settable(phYhytrap,4,table2);
   settable(ph2Hhytrap,4,table3);
   settable(phXhx,4,table4);
   settable(phHhx,4,table5);
   settable(phRec,4,table6);
   setreceiver(phRec);

// Begin Sequence

   txphase(phXhx); decphase(ph1Hhytrap); dec2phase(phYhytrap);
   obspwrf(getval("aXhx")); decpwrf(getval("aHhytrap")); dec2pwrf(getval("aYhytrap"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// TRAPDOR on H with Y Modulation

   decrgpulse(getval("pw1Hhytrap"),ph1Hhytrap,0.0,0.0);
   decphase(ph2Hhytrap);
   decunblank();
   dec2on();
   delay(getval("t1HYtrap"));
   dec2off();
   decrgpulse(getval("pw2Hhytrap"),ph2Hhytrap,0.0,0.0);
   decphase(phHhx);
   decunblank();
   decphase(phHhx);
   decpwrf(getval("aHhx"));
   delay(getval("t2HYtrap"));

// H to X Cross Polarization

    _cp_(hx,phHhx,phXhx);

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Ejemplo n.º 16
0
pulsesequence()

{
/* DECLARE VARIABLES */

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

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

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             tau3,         /*  t3 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             taub,         /*  ~ 1/4JNH =  2.25 ms */
             tauc,         /*  ~ 1/4JNCa =  ~13 ms */
             taud,         /*  ~ 1/4JCaC' =  3~4.5 ms ms */
             d2_init=0.0,                        /* used for states tppi in t1 */
             bigTN,        /* nitrogen T period */
             bigTC,        /* carbon T period */
             BigT1,        /* delay about 200 us */
             satpwr,      /* low level 1H trans.power for presat  */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             at,
             sphase,
             cbpwr,        /* power level for selective CB decoupling */
             cbdmf,        /* pulse width for selective CB decoupling */
             cbres,        /* decoupling resolution of CB decoupling */

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

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

             compH = getval("compH"),         /* adjustment for amplifier compression */
             pwHs = getval ("pwHs"),         /* H1 90 degree pulse at tpwrs */
             tpwrs,                          /* power for pwHs ("H2osinc") pulse */
             waltzB1 = getval("waltzB1"),

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

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

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

  cos_N, cos_CO, cos_Ca,
  angle_N, angle_CO, angle_Ca;
  angle_N=0.0;

/* LOAD VARIABLES */

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

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  tauc   = getval("tauc"); 
  taud   = getval("taud"); 
  bigTN = getval("bigTN");
  bigTC = getval("bigTC");
  BigT1 = getval("BigT1");
  tpwr = getval("tpwr");
  satpwr = getval("satpwr");
  dpwr = getval("dpwr");
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  at = getval("at");
  sphase = getval("sphase");

  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  gt9 = getval("gt9");
  gt10 = getval("gt10");
  gt11 = getval("gt11");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl8 = getval("gzlvl8");
  gzlvl9 = getval("gzlvl9");
  gzlvl10 = getval("gzlvl10");
  gzlvl11 = getval("gzlvl11");

/* Load variable */
        cbpwr = getval("cbpwr");
        cbdmf = getval("cbdmf");
        cbres = getval("cbres");
        tau1 = 0;
        tau2 = 0;
        tau3 = 0;
        cos_N = 0;
        cos_CO = 0;
        cos_Ca = 0;
        kappa = 5.4e-3;

    getstr("cbdecseq", cbdecseq);

/* LOAD PHASE TABLE */

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

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

   tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));   /*needs 1.69 times more*/
   tpwrs = (int) (tpwrs);                          /*power than a square pulse */
   widthHd = 2.681*waltzB1/sfrq;  /* bandwidth of H1 WALTZ16 decoupling */
   pwHd = h1dec90pw("WALTZ16", widthHd, 0.0);     /* H1 90 length for WALTZ16 */


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

    if( dpwr3 > 56) {
       printf("dpwr3 too high\n");
       psg_abort(1);
    }


/* PHASES AND INCREMENTED TIMES */


   /* Set up angles and phases */

   angle_CO=getval("angle_CO");  cos_CO=cos(PI*angle_CO/180.0);
   angle_Ca=getval("angle_Ca");  cos_Ca=cos(PI*angle_Ca/180.0);

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

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

   if ( 1.0 < (cos_CO*cos_CO + cos_Ca*cos_Ca) )
   {
       printf ("Impossible angles.\n"); psg_abort(1);
   }
   else
   {
           cos_N=sqrt(1.0- (cos_CO*cos_CO + cos_Ca*cos_Ca));
           angle_N = 180.0*acos(cos_N)/PI;
   }

   swTilt=swCO*cos_CO + swCa*cos_Ca + swN*cos_N;

   if (ix ==1)
   {
      printf("\n\nn\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
      printf ("Maximum Sweep Width: \t\t %f Hz\n", swTilt);
      printf ("Angle_CO:\t%6.2f\n", angle_CO);
      printf ("Angle_Ca:\t%6.2f\n", angle_Ca);
      printf ("Angle_N :\t%6.2f\n", angle_N );
   }

/* Set up hyper complex */

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

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

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

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */

    if (bigTN - 0.5*ni*(cos_N/swTilt) + pwS3 < 0.2e-6) 
       { printf(" ni is too big. Make ni equal to %d or less.\n",
         ((int)((bigTN + pwS3)*2.0*swTilt/cos_N)));              psg_abort(1);}

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(satpwr);     /* Set transmitter power for 1H presaturation */
   obspwrf(4095.0);
   decpower(pwClvl);       /* Set Dec1 power for hard 13C pulses         */
   decpwrf(4095.0);
   dec2power(pwNlvl);      /* Set Dec2 power for hard 15N pulses         */
   dec2pwrf(4095.0);
   set_c13offset("ca");

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

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

/*   xxxxxxxxxxxxxxxxxxxxxx    1HN to 15N TRANSFER   xxxxxxxxxxxxxxxxxx    */

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

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

   delay(taua - gt1 - 2.2e-6);   /* taua <= 1/4JNH */ 

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

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

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

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

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

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

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

       dec2rgpulse(pwN,zero,0.0,0.0);

       delay(kappa - POWER_DELAY - PWRF_DELAY - pwHd - 4.0e-6 - PRG_START_DELAY);
                            /* delays for h1waltzon subtracted */

       h1waltzon("WALTZ16", widthHd, 0.0);
       decphase(zero);
       dec2phase(zero);

       delay(tauc - kappa - WFG3_START_DELAY );

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

       delay(tauc - pwS3);

       dec2rgpulse(pwN,zero,0.0,0.0);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

      decoff();
      decprgoff();

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

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

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

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

      decoff();
      decprgoff();

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

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

   txphase(zero);

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

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

   dec2phase(t2);

   delay(bigTN - tau3 + pwS3);

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

   dec2phase(t3);
   txphase(zero);

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

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

      delay(kappa - pwS4 - WFG_START_DELAY - 2.0*POWER_DELAY
            - 2.0*PWRF_DELAY - 2.0e-6 - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
      zgradpulse(gzlvl5, gt5);
      delay(1.0e-4);
   }
   else if (tau3 > gt5 + 2.0*GRADIENT_DELAY + 1.0e-4)
   {
      delay(bigTN + tau3 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6
                                 - POWER_DELAY - PWRF_DELAY);
      h1waltzoff("WALTZ16", widthHd, 0.0);
      delay(kappa - tau3 - pwS4 - WFG_START_DELAY - 2.0*POWER_DELAY
                                   - 2.0*PWRF_DELAY - 2.0e-6);
      c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
      delay(tau3 - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
      zgradpulse(gzlvl5, gt5);
      delay(1.0e-4);
   }
   else
   {
      delay(bigTN + tau3 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6
                                 - POWER_DELAY - PWRF_DELAY);
      h1waltzoff("WALTZ16", widthHd, 0.0);
      delay(kappa - tau3 - pwS4 - WFG_START_DELAY - 2.0*POWER_DELAY
            - 2.0*PWRF_DELAY - 2.0e-6 - gt5 - 2.0*GRADIENT_DELAY - 1.0e-4);
      zgradpulse(gzlvl5, gt5);        /* 2.0*GRADIENT_DELAY */
      delay(1.0e-4);
      c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
      delay(tau3);
   }

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

   delay(0.2e-6);
   zgradpulse(gzlvl6, gt6);
   delay(2.0e-6);
 
   dec2phase(zero);
   delay(taub - gt6 - 2.2e-6);
 
   sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);
 
   delay(0.2e-6);
   zgradpulse(gzlvl6, gt6);
   delay(200.0e-6);
   
   delay(taub - gt6 - 200.2e-6);
   txphase(one);
   dec2phase(one);
 
   sim3pulse(pw,0.0,pwN,one,zero,one,0.0,0.0);
 
   delay(0.2e-6);
   zgradpulse(gzlvl7, gt7);
   delay(2.0e-6);
 
   txphase(zero);
   dec2phase(zero);
 
   delay(taub - gt7 - 2.2e-6);
 
   sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);
 
   delay(0.2e-6);
   zgradpulse(gzlvl7, gt7);
   delay(200.0e-6);
 
   delay(taub - gt7 - 200.2e-6);

   rgpulse(pw, zero, 0.0, 0.0);
   delay(gt8 + 1.0e-4 + 50.2e-6 - 0.3*pw + 2.0*GRADIENT_DELAY
                                   + POWER_DELAY);
   rgpulse(2*pw,zero,0.0,0.0);
   dec2power(dpwr2);
   decpower(dpwr);
   zgradpulse(icosel*gzlvl8, gt8);
   delay(50.2e-6);

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

/* BEGIN ACQUISITION */

status(C);
         setreceiver(t6);

}
Ejemplo n.º 17
0
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);
} 
Ejemplo n.º 18
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);
}
Ejemplo n.º 19
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values

   CP hy = getcp("HY",0.0,0.0,0,1);
   strncpy(hy.fr,"dec",3);
   strncpy(hy.to,"dec2",4);
   putCmd("frHY='dec'\n");
   putCmd("toHY='dec2'\n");

   GP inept = getinept("ineptYX");
   strncpy(inept.ch1,"dec2",4);
   strncpy(inept.ch2,"obs",3);
   putCmd("ch1YXinept='dec2'\n");
   putCmd("ch2YXinept='obs'\n");
   
   DSEQ dec = getdseq("H");
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n"); 
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

   DSEQ mix = getdseq("Hmix");
   strncpy(mix.t.ch,"dec",3);
   putCmd("chHmixtppm='dec'\n"); 
   strncpy(mix.s.ch,"dec",3);
   putCmd("chHmixspinal='dec'\n");

// Dutycycle Protection

   double simpw1 = inept.pw1;
   if (inept.pw2 > inept.pw1) simpw1 = inept.pw2;

   double simpw2 = inept.pw3;
   if (inept.pw4 > inept.pw3) simpw2 = inept.pw4;

   DUTY d = init_dutycycle();
   d.dutyon = getval("pwH90") + getval("tHY") + 2.0*simpw1 + 2.0*simpw2;
   d.dutyoff = d1 + 4.0e-6;
   d.c1 = d.c1 + (!strcmp(dec.seq,"tppm"));
   d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0));
   d.t1 = inept.t1 + inept.t2 + inept.t3 + inept.t4 + 
          getval("rd") + getval("ad") + at;
   d.c2 = d.c2 + (!strcmp(dec.seq,"spinal"));
   d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0));
   d.t2 = inept.t1 + inept.t2 + inept.t3 + inept.t4 + 
          getval("rd") + getval("ad") + at;
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0);

// Set Phase Tables

   settable(phH90,16,table1);
   settable(phHhy,4,table2);
   settable(phYhy,4,table3);
   settable(ph1Yyxinept,4,table4);
   settable(ph1Xyxinept,4,table5);
   settable(ph2Yyxinept,4,table6);
   settable(ph2Xyxinept,16,table7);
   settable(ph3Yyxinept,8,table8);
   settable(ph3Xyxinept,4,table9);
   settable(phRec,8,table10);
   setreceiver(phRec);

// Begin Sequence

   txphase(ph1Xyxinept); decphase(phH90); dec2phase(phYhy);
   obspwrf(getval("aXyxinept")); decpwrf(getval("aH90")); dec2pwrf(getval("aYhy"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// H to Y Cross Polarization

   decrgpulse(getval("pwH90"),phH90,0.0,0.0);
   decphase(phHhy);
   _cp_(hy,phHhy,phYhy);
   decphase(zero);

// INEPT Transfer from Y to X

   _dseqon(mix);
   _ineptref(inept,ph1Yyxinept,ph1Xyxinept,ph2Yyxinept,ph2Xyxinept,ph3Yyxinept,ph3Xyxinept);
   _dseqoff(mix);

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Ejemplo n.º 20
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values

   CP hy = getcp("HY",0.0,0.0,0,1);
   strncpy(hy.fr,"dec",3);
   strncpy(hy.to,"dec2",4);
   putCmd("frHY='dec'\n");
   putCmd("toHY='dec2'\n");

   PBOXPULSE shca = getpboxpulse("shcaX",0,1);
   strncpy(shca.ch,"obs",3);
   putCmd("chXshca ='obs'\n");

   PBOXPULSE sh = getpboxpulse("shY",0,1);
   strncpy(sh.ch,"dec2",4);
   putCmd("chYsh ='dec2'\n");

   PBOXPULSE shco = getpboxpulse("shcoX",0,1);
   strncpy(shco.ch,"obs",3);
   putCmd("chXshco ='obs'\n"); 

   DSEQ dec = getdseq("H");   
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n");
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

   DSEQ mix = getdseq("Hmix");
   strncpy(mix.t.ch,"dec",3);
   putCmd("chHmixtppm='dec'\n");
   strncpy(mix.s.ch,"dec",3);
   putCmd("chHmixspinal='dec'\n");

   double pwsim = getval("pwX90"); 
   if (getval("pwY90") > getval("pwX90")) pwsim = getval("pwY90"); 
   pwsim = pwsim/2.0;

   double shcalen = (shca.pw + 2.0*shca.t2)/2.0;
   double shlen = (sh.pw + 2.0*sh.t2)/2.0;
   double shsim = shcalen;
   double simpw = shca.pw;
   double simt1 = shca.t1;
   double simt2 = shca.t2;
   if (shlen > shcalen) { 
      shsim = shlen; 
      simpw = sh.pw;
      simt1 = sh.t1;
      simt2 = sh.t2;
   }
   double shcolen = (shco.pw + 2.0*shco.t2)/2.0;
   double d22 = d2/2.0;

// Set Constant-time Period for d2. 

   if (d2_index == 0) d2_init = getval("d2");
   double d2_ = (ni - 1)/sw1 + d2_init;
   putCmd("d2acqret = %f\n",roundoff(d2_,12.5e-9));
   putCmd("d2dwret = %f\n",roundoff(1.0/sw1,12.5e-9));

//--------------------------------------
// Copy Current Parameters to Processed
//-------------------------------------

   putCmd("groupcopy('current','processed','acquisition')");
  
// Dutycycle Protection

   DUTY d = init_dutycycle();
   d.dutyon = getval("pwH90") + getval("tHY") + 2.0* simpw + shco.pw;
   d.dutyoff = d1 + 4.0e-6;
   d.c1 = d.c1 + (!strcmp(dec.seq,"tppm"));
   d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0));
   d.t1 = d2_ + getval("rd") + getval("ad") + at;
   d.c2 = d.c2 + (!strcmp(dec.seq,"spinal"));
   d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0));
   d.t2 = d2_ + getval("rd") + getval("ad") + at;
   d.c3 = d.c3 + (!strcmp(mix.seq,"tppm"));
   d.c3 = d.c3 + ((!strcmp(mix.seq,"tppm")) && (mix.t.a > 0.0));
   d.t3 = 2.0*getval("taua") + 2.0*getval("taub") - 2.0*shsim - shcolen +
          2.0*simt1 + 2.0*simt2 - pwsim - 2.0*shsim;
   d.c4 = d.c4 + (!strcmp(mix.seq,"spinal"));
   d.c4 = d.c4 + ((!strcmp(mix.seq,"spinal")) && (mix.s.a > 0.0));
   d.t4 = 2.0*getval("taua") + 2.0*getval("taub") - 2.0*shsim - shcolen +
          2.0*simt1 + 2.0*simt2 - pwsim - 2.0*shsim;
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0);

// Set Up 2D
   
   int errval = (int) ((getval("taua") - shsim)*2.0*sw1);
   if ((getval("taua") - ni/(2.0*sw1) - shsim) < 0.0) { 
     text_error("Error:ni is too large. Make ni equal to %d or less.\n",errval); 
     psg_abort(1);
   }

// Set Phase Tables

   settable(phH90,4,table1);
   settable(phHhy,4,table2);
   settable(phYhy,4,table3);
   settable(ph1Xshca,4,table4);
   settable(ph1Ysh,4,table5);
   settable(phXshco,4,table6);
   settable(phX90,4,table7);
   settable(phY90,4,table8);
   settable(ph2Xshca,4,table9);
   settable(ph2Ysh,4,table10);
   settable(phRec,4,table11);
   setreceiver(phRec);

// States Acquisition

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

// Begin Sequence

   txphase(ph1Xshca); decphase(phH90); dec2phase(phYhy);
   obspwrf(getval("aXshca")); decpwrf(getval("aH90")); dec2pwrf(getval("aYhy"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// H to Y Cross Polarization

   decrgpulse(getval("pwH90"),phH90,0.0,0.0);
   decphase(phHhy);
   _cp_(hy,phHhy,phYhy);
   decphase(zero);

// Begin F1 INEPT

   _dseqon(mix);
   dec2phase(ph1Ysh); 
   dec2pwrf(getval("aYsh"));
   delay(getval("taua") - d22 - shsim);
   _pboxsimpulse(shca,sh,ph1Xshca,ph1Ysh);
   obsblank();
   obspower(getval("tpwr")); dec2power(getval("dpwr2"));
   delay(3.0e-6);
   obsunblank();
   if (d22 < (shcolen + pwsim))  {
      txphase(phX90); dec2phase(phY90);   
      obspwrf(getval("aX90")); dec2pwrf(getval("aY90"));
      delay(getval("taua") + d22 - shsim - pwsim - 3.0e-6);
   } 
   else
   {
      txphase(phXshco);
      obspwrf(getval("aXshco"));
      delay(getval("taua") - shsim - shcolen - 3.0e-6); 
      _pboxpulse(shco,phXshco);
      obsblank();
      obspower(getval("tpwr"));
      delay(3.0e-6);
      obsunblank();
      txphase(phX90); dec2phase(phY90);
      obspwrf(getval("aX90")); dec2pwrf(getval("aY90"));
      delay(d22 - shcolen - pwsim - 3.0e-6);
   }
   sim3pulse(getval("pwX90"),0.0,getval("pwY90"),phX90,zero,phY90,0.0,0.0);
   obsunblank(); dec2unblank(); 
   txphase(ph2Xshca); dec2phase(ph2Ysh);
   delay(getval("taub") - pwsim - shsim);
   _pboxsimpulse(shca,sh,ph2Xshca,ph2Ysh);
   obsblank();
   obspower(getval("tpwr")); dec2power(getval("dpwr2"));
   delay(3.0e-6);
   obsunblank();
   delay(getval("taub") - shsim - 3.0e-6);
   _dseqoff(mix);

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}