Пример #1
0
pulsesequence()
{

   double	   gt1 = getval("gt1"),
		   gzlvl1=getval("gzlvl1"),
		   gt2 = getval("gt2"),
		   gzlvl2=getval("gzlvl2"),
		   selpwrPS = getval("selpwrPS"),
		   selpwPS = getval("selpwPS"),
		   gzlvlPS = getval("gzlvlPS"),
		   droppts=getval("droppts"),
		   gstab = getval("gstab"),
  		   espw180 = getval("espw180"),
                   essoftpw = getval("essoftpw"),
                   essoftpwr = getval("essoftpwr"),
                   essoftpwrf = getval("essoftpwrf");
   char		   selshapePS[MAXSTR],
		   esshape[MAXSTR];

//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gt1 = syncGradTime("gt1","gzlvl1",1.0);
        gzlvl1 = syncGradLvl("gt1","gzlvl1",1.0);
	gt2 = syncGradTime("gt2","gzlvl2",1.0);
        gzlvl2 = syncGradLvl("gt2","gzlvl2",1.0);

   getstr("esshape",esshape);

   getstr("selshapePS",selshapePS);

  assign(ct,v17);

   settable(t1,2,ph1);
   settable(t2,8,ph2);
   settable(t3,8,ph3);
   settable(t4,4,ph4);
   settable(t5,4,ph5);
   settable(t6,4,ph6);
   settable(t7,8,ph7);

   getelem(t1,v17,v1);
   getelem(t2,v17,v2);
   getelem(t3,v17,v3);
   getelem(t4,v17,v4);
   getelem(t5,v17,v5);
   getelem(t6,v17,v6);
   getelem(t7,v17,v7);
   assign(v7,oph);

   /*assign(v1,v6);
   add(oph,v18,oph);
   add(oph,v19,oph);*/

/* BEGIN THE ACTUAL PULSE SEQUENCE */
   status(A);
      obspower(tpwr);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

  delay(d1);

   status(B);
      obspower(tpwr);
      rgpulse(pw, v1, rof1, rof2);

	delay(d2/2.0);

	zgradpulse(gzlvl1,gt1);
	delay(gstab);
	delay((0.25/sw1) - gt1 - gstab - 2*pw/PI - rof2 - 2*GRADIENT_DELAY - pw - rof1-essoftpw/2.0-2.0e-6);
        obspower(essoftpwr+6); obspwrf(essoftpwrf);
        shaped_pulse(esshape,essoftpw,v2,2.0e-6,2.0e-6);
        obspower(tpwr); obspwrf(4095.0);
	rgpulse(2.0*pw,v3,rof1,rof1);
	zgradpulse(gzlvl1,gt1);
	delay(gstab);
	delay((0.25/sw1) - gt1 - gstab - 2*GRADIENT_DELAY - pw - rof1 - essoftpw/2.0-2.0e-6);

	delay(gstab);
	zgradpulse(gzlvl2,gt2);
	delay(gstab);
        obspower(essoftpwr+6); obspwrf(essoftpwrf);
        shaped_pulse(esshape,essoftpw,v4,2.0e-6,2.0e-6);
	obspower(selpwrPS); obspwrf(4095.0) ;
	rgradient('z',gzlvlPS);
	shaped_pulse(selshapePS,selpwPS,v5,rof1,rof1);
	rgradient('z',0.0);
	delay(gstab);
	obspower(tpwr);
	zgradpulse(gzlvl2,gt2);
	delay(gstab - droppts/sw);
	delay(d2/2.0);
        obspower(tpwr); obspwrf(4095.0);

   status(C);
}
Пример #2
0
pulsesequence()
{

  double j1min = getval("j1min"),
         j1max = getval("j1max"),
         gzlvlE = getval("gzlvlE"),
         gtE = getval("gtE"),
         mult = getval("mult"),
	 pwx180 = getval("pwx180"),
	 pwxlvl180 = getval("pwxlvl180"),
	 pw180 = getval("pw180"),
         pwx180r = getval("pwx180r"),
         pwxlvl180r = getval("pwxlvl180r"),
	 tpwr180 = getval("tpwr180"),
         EDratio = getval("EDratio"),
         hsglvl = getval("hsglvl"),
         hsgt = getval("hsgt"),
         gstab = getval("gstab"),
         dmfct = getval("dmfct"),
         dpwrct = getval("dpwrct"),
         tau,
	 tau1,
	 tau3,
	 taug,
         bigT = getval("BigT");

  char   pwx180ad[MAXSTR],
	 pw180ad[MAXSTR],
	 dmct[MAXSTR],
	 bipflg[MAXSTR],
         pwx180ref[MAXSTR],
         dmmct[MAXSTR];

  int	 icosel,
         igcorr,
         prgcycle = (int)(getval("prgcycle")+0.5),
	 phase1 = (int)(getval("phase")+0.5);

//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gtE = syncGradTime("gtE","gzlvlE",1.0);
        gzlvlE = syncGradLvl("gtE","gzlvlE",1.0);

  getstr("pwx180ad",pwx180ad);
  getstr("pw180ad",pw180ad);
  getstr("dmct",dmct);
  getstr("pwx180ref", pwx180ref);
  getstr("dmmct", dmmct);

  getstr("bipflg",bipflg);
  if (bipflg[0] == 'y')
  {
        tpwr180=getval("tnbippwr");
        pw180=getval("tnbippw");
        getstr("tnbipshp",pw180ad);
  }
  if (bipflg[1] == 'y')
  {
        pwxlvl180=getval("dnbippwr");
        pwx180=getval("dnbippw");
        getstr("dnbipshp",pwx180ad);
  }

  tau1 = 1/(2*(j1min + 0.07*(j1max - j1min)));
  tau3 = 1/(2*(j1max - 0.07*(j1max - j1min)));
  tau = 1 / (j1min+j1max);

  taug = tau + getval("tauC");

  icosel = 1;
  igcorr = 2;
  
  if (mult > 0.5)
    igcorr = 1;

  assign(ct,v17);
  assign(zero,v18);
  assign(zero,v19);

  if (getflag("prgflg") && (satmode[0] == 'y') && (prgcycle > 1.5))
    {
        hlv(ct,v17);
        mod2(ct,v18); dbl(v18,v18);
        if (prgcycle > 2.5)
           {
                hlv(v17,v17);
                hlv(ct,v19); mod2(v19,v19); dbl(v19,v19);
           }
     }

  settable(t1, 4, ph1);
  settable(t2, 8, ph2);
  settable(t3, 16, ph3);
  settable(t6, 2, ph6);
  getelem(t1, v17, v1);
  getelem(t3, v17, v3);
  getelem(t2, v17, v2);
  getelem(t6, v17, oph);
  assign(zero, v4);

  assign(zero,v6);
  add(oph,v18,oph);
  add(oph,v19,oph);

  initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v14);
/*
  mod2(id2, v14);
  dbl(v14,v14);
*/
  add(v2, v14, v2);
  add(v4, v14, v4);
  add(oph, v14, oph);

  if ((phase1 == 2) || (phase1 == 5))
    icosel = -1;

  status(A);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

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

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

    obspower(tpwr);
    decpower(pwxlvl);

    if (getflag("nullflg"))
    {
      decpower(pwxlvl180);
      rgpulse(0.5 * pw, zero, rof1, rof1);
      obspower(tpwr180);
      delay(tau/2.0);
      simshaped_pulse(pw180ad,pwx180ad,pw180,pwx180,zero,zero,rof1,rof1);
      delay(tau/2.0+POWER_DELAY+rof1);
      delay(tau/2.0+POWER_DELAY+rof1);
      simshaped_pulse(pw180ad,pwx180ad,pw180,pwx180,two,two,rof1,rof1);
      obspower(tpwr);
      delay(tau/2.0);
      rgpulse(0.5 * pw, zero, rof1, rof1);
      decpower(pwxlvl);
      zgradpulse(hsglvl, 1.4*hsgt);
      delay(1e-3);
    }

  status(B);

    rgpulse(pw, zero, rof1, rof1);
  if (getflag("dmct"))
  {
    decpower(dpwrct);
    decprgon("garp1",1/dmfct,1.0);
/*
    setstatus(DECch, FALSE, 'g', FALSE, dmfct);
*/
    decunblank();
    decon();
  }
    obspower(tpwr180);
    delay(bigT/2 - d2/2  - tau - taug - pwx180r);
    delay(pw180+WFG_START_DELAY+WFG_STOP_DELAY);
    shaped_pulse(pw180ad,pw180,zero,rof1,rof1);
    delay(bigT/2 - d2/2  - tau - taug - pwx180r);
    delay(4*pw/PI+2*rof1+POWER_DELAY+4*pwx/PI+2*POWER_DELAY);
  if (getflag("dmct"))
  {
    decoff();
    decblank();
    decprgoff();
/*
    setstatus(DECch, FALSE, 'c', FALSE, dmf);
*/
    decpower(pwxlvl);
  }

    if (mult > 0.5)
    {
     delay(tau-gtE-2*GRADIENT_DELAY-gstab);
     zgradpulse(icosel*gzlvlE,gtE);
     delay(gstab);
    }
    else
    {
     delay(tau);
    }

    decrgpulse(pwx,v2,rof1,rof1);

    if (mult > 0.5)
    {
    decpower(pwxlvl180r);
    delay(taug);
    decshaped_pulse(pwx180ref, pwx180r, v4, rof1, rof1);

    delay(d2/2);
    shaped_pulse(pw180ad,pw180,zero,rof1,rof1);
    delay(d2/2);
    zgradpulse(icosel*gzlvlE,gtE);

    delay(taug-gtE-2*GRADIENT_DELAY+(4*pwx/PI+2*rof1+2*POWER_DELAY-(WFG_START_DELAY+pw180+WFG_STOP_DELAY+2*rof1)));
    decshaped_pulse(pwx180ref, pwx180r, v3, rof1, rof1);
    }

    else
    {
    decpower(pwxlvl180);
    delay(taug/2+(pwx180r-pwx180)/2);
    decshaped_pulse(pwx180ad, pwx180, v4, rof1, rof1);
    delay(taug/2+(pwx180r-pwx180)/2.0-gtE-2*GRADIENT_DELAY-gstab);

    zgradpulse(icosel*gzlvlE,gtE);
    delay(gstab);

    delay(d2/2);
    shaped_pulse(pw180ad,pw180,zero,rof1,rof1);
    delay(d2/2);

    zgradpulse(icosel*gzlvlE,gtE);

    delay(taug/2+(pwx180r-pwx180)/2.0+(4*pwx/PI+2*rof1+2*POWER_DELAY-WFG_START_DELAY-pw180-WFG_STOP_DELAY-2*rof1)-gtE-2*GRADIENT_DELAY);
    decshaped_pulse(pwx180ad, pwx180, v3, rof1, rof1);
  
    delay(taug/2+(pwx180r-pwx180)/2);
    }

    decpower(pwxlvl);
    decrgpulse(pwx,v1,rof1,rof1);

    obspower(tpwr);

    delay(tau);

    rgpulse(pw,one,rof1,rof2);
    decrgpulse(pwx,zero,rof1,rof1);
    obspower(tpwr180);
    zgradpulse(igcorr*3*gzlvlE/(10*EDratio),gtE);
    delay(tau3 - gtE - 2*GRADIENT_DELAY);
    decrgpulse(pwx,zero,rof1,rof1);
    zgradpulse(igcorr*7*gzlvlE/(10*EDratio),gtE);
    delay(tau - gtE - 2*GRADIENT_DELAY);
    decrgpulse(pwx,zero,rof1,rof1);
    shaped_pulse(pw180ad,pw180,zero,rof1,rof1);
    zgradpulse(igcorr*2*gzlvlE/EDratio,gtE);
    delay(tau1 - gtE - 2*GRADIENT_DELAY - POWER_DELAY);
    decpower(dpwr);

  status(C);

    delay(tau+tau3+3*pwx+6*rof1-tau1+WFG_START_DELAY+WFG_STOP_DELAY);
}
Пример #3
0
pulsesequence()
{
   double mix,SSpwr,pwSS,hsdly,pwa,pwd,gt1,gzlvl1,gzlvl2;
   char ptable[MAXSTR],SSshape[MAXSTR];
   getstr("ptable",ptable); getstr("SSshape",SSshape);
   mix=getval("mix"); hsdly=getval("hsdly"); 
   loadtable(ptable);
   pwa=getval("pwa"); pwd=getval("pwd");
   gt1=getval("gt1"); gzlvl1=getval("gzlvl1"); gzlvl2=getval("gzlvl2");
   SSpwr=getval("SSpwr"); pwSS=getval("pwSS");
     initval(7.0,v2);   /* set up 45 degree phase shift for first pulse    */
     obsstepsize(45.0);
   getelem(t1,ct,v1);     /* 1st pulse phase    */
   getelem(t3,ct,v3);     /* read pulse phase   */
   getelem(t4,ct,v4);     /* receiver phase     */
   if (phase1 > 1.5) incr(v1);     /* hypercomplex phase shift */
   assign(v4,oph);
   /*HYPERCOMPLEX MODE USES REDFIELD TRICK TO MOVE AXIAL PEAKS TO EDGE */
    initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v6);
  if ((phase1==1)||(phase1==2)) {add(v1,v6,v1); add(v4,v6,oph);}

    assign(v3,v7);       /* for steering pulses */
    add(v3,one,v8); 
    if (pwa<0.0) { pwa = -pwa; add(v7,two,v7); }
    if (pwd<0.0) { pwd = -pwd; add(v8,two,v8); }

/* CHECK VALIDITY OF PARAMETER RANGE */

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

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

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

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

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

/* BEGIN PULSE SEQUENCE */

   status(A);
     xmtrphase(v2);
     txphase(v1);
     obspower(tpwr);
     hsdelay(d1);
   status(B);
      rgpulse(pw, v1, rof1, 1.0e-6);
      xmtrphase(zero);
      txphase(t2);
      if (d2 > 0.001)
       {
     zgradpulse(gzlvl2,0.4*d2-SAPS_DELAY/2.0-2.0*GRADIENT_DELAY-(2.0*pw/PI));
     delay(0.1*d2-rof1);
     zgradpulse(-gzlvl2,0.4*d2-SAPS_DELAY/2.0-2.0*GRADIENT_DELAY-(2.0*pw/PI));
     delay(0.1*d2-rof1);
       }
       else delay(d2);
      rgpulse(pw, t2, rof1, 1.0e-6);
   status(C);
      obspower(SSpwr);
      delay(hsdly);
      zgradpulse(gzlvl1,gt1);
      hsdelay(mix-hsdly-gt1);
      shaped_pulse(SSshape,pwSS,t3,rof1,0.0);
      obspower(SSpwr-12.0);
      rgpulse(pwa,v7,2.0e-6,0.0);    /* steering pulses */
      rgpulse(pwd,v8,0.0e-6,0.0);
      delay(rof2);
   status(D);
}
Пример #4
0
pulsesequence()
{
   double	   mixN = getval("mixN"),
		   gzlvlC = getval("gzlvlC"),
		   gtC = getval("gtC"),
		   gstab = getval("gstab"),
                   selpwrA = getval("selpwrA"),
                   selpwA = getval("selpwA"),
                   gzlvlA = getval("gzlvlA"),
                   gtA = getval("gtA"),
                   selpwrB = getval("selpwrB"),
                   selpwB = getval("selpwB"),
                   gzlvlB = getval("gzlvlB"),
                   gtB = getval("gtB"),
		   selfrq = getval("selfrq"),
		   zqfpw3 = getval("zqfpw3"),
		   zqfpwr3 = getval("zqfpwr3"),
		   gzlvlzq3 = getval("gzlvlzq3"),
		   mixNcorr,
		   sweeppw = getval("sweeppw"),
		   sweeppwr = getval("sweeppwr");
   char		   sweepshp[MAXSTR],
                   selshapeA[MAXSTR],
                   selshapeB[MAXSTR],
		   zqfpat3[MAXSTR];
//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gtC = syncGradTime("gtC","gzlvlC",1.0);
        gzlvlC = syncGradLvl("gtC","gzlvlC",1.0);
        gtA = syncGradTime("gtA","gzlvlA",1.0);
        gzlvlA = syncGradLvl("gtA","gzlvlA",1.0);
        gtB = syncGradTime("gtB","gzlvlB",1.0);
        gzlvlB = syncGradLvl("gtB","gzlvlB",1.0);

   getstr("sweepshp",sweepshp);
   getstr("selshapeA",selshapeA);
   getstr("selshapeB",selshapeB);
   getstr("zqfpat3",zqfpat3);

   mixNcorr=0.0;
   if (getflag("Gzqfilt"))
	mixNcorr=getval("zqfpw3");

   hlv(ct,v1); hlv(v1,v1); hlv(v1,v1); hlv(v1,v1); mod4(v1,v1);
   mod4(ct,v2); add(v1,v2,v2);
   hlv(ct,v3); hlv(v3,v3); mod4(v3,v3); add(v1,v3,v3); dbl(v3,v4);
   dbl(v2,oph); add(oph,v4,oph); add(oph,v1,oph);


/* BEGIN THE ACTUAL PULSE SEQUENCE */
   status(A);
   obspower(tpwr);
   delay(5.0e-5);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        satpulse(satdly,zero,rof1,rof1);
     }
   else
        delay(d1);

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

   status(B);
      if (selfrq != tof)
       obsoffset(selfrq);
      rgpulse(pw, v1, rof1, rof1);

      if (selfrq != tof)
        obsoffset(selfrq);

        zgradpulse(gzlvlA,gtA);
        delay(gstab);
        obspower(selpwrA);
        shaped_pulse(selshapeA,selpwA,v2,rof1,rof1);
        obspower(tpwr);
        zgradpulse(gzlvlA,gtA);
        delay(gstab);

      if (selfrq != tof)
        delay(2*OFFSET_DELAY);

        zgradpulse(gzlvlB,gtB);
        delay(gstab);
        obspower(selpwrB);
        shaped_pulse(selshapeB,selpwB,v3,rof1,rof1);
        obspower(tpwr);
        zgradpulse(gzlvlB,gtB);
        delay(gstab);

      if (selfrq != tof)
        obsoffset(tof);

      rgpulse(pw,v1,rof1,rof1);

        obspower(sweeppwr);
	delay(0.31*mixN);
	zgradpulse(gzlvlC,gtC);
	delay(gstab);
	shaped_pulse(sweepshp,sweeppw,zero,rof1,rof1);
	delay(gstab);
	zgradpulse(-gzlvlC,gtC);
	delay(0.49*mixN);
	zgradpulse(-gzlvlC,2*gtC);
	delay(gstab);
        if (getflag("Gzqfilt"))
           {
                obspower(zqfpwr3);
                rgradient('z',gzlvlzq3);
                delay(100.0e-6);
                shaped_pulse(zqfpat3,zqfpw3,zero,rof1,rof1);
                delay(100.0e-6);
                rgradient('z',0.0);
           }
        else
                shaped_pulse(sweepshp,sweeppw,zero,rof1,rof1);
        delay(gstab);
        zgradpulse(gzlvlC,2*gtC);
        delay(0.2*mixN);
        obspower(tpwr);

      rgpulse(pw,v1,rof1,rof2);

   status(C);
}
Пример #5
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char        fscuba[MAXSTR],f1180[MAXSTR],f2180[MAXSTR],fsat[MAXSTR],
             shape[MAXSTR],sh_ad[MAXSTR],f3180[MAXSTR],
             N_flg[MAXSTR],diag_supp[MAXSTR];

 int	     phase,
             phase2,
             phase3,
             t1_counter,
             t2_counter,
             t3_counter, icosel;

 double      hscuba,                /* length of 1/2 scuba delay */
             pwx2,                  /* PW90 for X-nuc            */
             tsatpwr,               /* low power level for presat*/
             dhpwr2,                /* power level for X hard pulses */
             jxh,                   /* coupling for XH           */
             tauxh,                 /* delay = 1/(2jxh)          */
	     tau1,	      	    /* t1/2  H */
	     tau2,	      	    /* t2/2 N */
	     tau3,	      	    /* t3/2 N */
	     sw1,                  /* spectral width in 1H dimension */
             sw2,                  /* spectral width in 15N dimension */
             sw3,                  /* spectral width in 15N dimension */
             MIX,                  /* Total Mixing time for noesy portion */
             pw_sl,                /* selective 2ms pulse on water */
             tpwrsl,               /* power level for pw_sl   */ 
             ppm,nst,pws,bw,ofs,   /* used by Pbox */
             pwN,pwNlvl,compH,compC,pwC,pwClvl,
             d_ad,                 /* C high power for adiabatic pulses */
             pwc_ad,               /* C 90 pulse width   */

             zeta,                /* Bax-Logan trick */
             zeta1,               /* Bax-Logan trick */

             BigT,
             BigT1,

             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8,
             gzlvl9,
             gzlvl10,
             gzlvl11,
             gzlvl12,

             gstab,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gt9,
             gt10,
             gt11,
             gt12;

/* LOAD VARIABLES */
          pwNlvl=getval("pwNlvl");
          pwN=getval("pwN");
          compC=getval("compC");
          pwC=getval("pwC");
          pwClvl=getval("pwClvl");
          compH=getval("compH");

  jxh = getval("jxh");
  dhpwr2 = getval("dhpwr2"); 
  pwx2 = getval("pwx2");
  tsatpwr = getval("tsatpwr");
  hscuba = getval("hscuba");
  phase = (int) (getval("phase") + 0.5);
  phase2 = (int) (getval("phase2") + 0.5);
  phase3 = (int) (getval("phase3") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  sw3 = getval("sw3");
  MIX  = getval("MIX");
  pw_sl = getval("pw_sl");
  tpwrsl = getval("tpwrsl");

  pwc_ad = getval("pwc_ad");
  d_ad = getval("d_ad");

  ni = getval("ni"); 

  BigT = getval("BigT");
  BigT1 = getval("BigT1");

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

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

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

  getstr("N_flg",N_flg);

  getstr("diag_supp",diag_supp);
  getstr("sh_ad",sh_ad);
  getstr("shape",shape);
  if(d_ad > 62) {
   printf("chirp power is too high \n");
   psg_abort(1);
  }
  if(pwc_ad > 1.2e-3) {
    printf("adiabatic pulse is too long; set < 0.5 ms\n");
    psg_abort(1);
  } 

   setautocal();                        /* activate auto-calibration flags */ 
        
      if (autocal[0] != 'n') 
        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
      {
        strcpy(shape,"H2Osel");
        strcpy(sh_ad,"C13adiab");
        if(FIRST_FID)                                            /* call Pbox */
        {
          ppm = getval("dfrq"); ofs = 0.0;   pws = 0.0005; /*0.5 ms pulse */
          bw = 200.0*ppm;       nst = 1000;          /* nst - number of steps */
          C13adiab = pbox_makeA("C13adiab", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
          H2Osel = pbox_Rsh("H2Osel", "sinc90", pw_sl, 0.0, compH*pw, tpwr);
          ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
        }
        pw_sl = H2Osel.pw; tpwrsl = H2Osel.pwr-1.0;  /* 1dB correction applied */
        d_ad = C13adiab.pwr; pwc_ad = C13adiab.pw;
        pwx2=pwN; dhpwr2=pwNlvl;
      }

/* check validity of parameter range */

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

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

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

    if( dpwr > -16 )
    {
	printf("No C decoupling used in this expt. ");
	psg_abort(1);
    }

    if( dpwr2 > -16 )
    {
	printf("No N decoupling used in this expt. ");
	psg_abort(1);
    }

    if(gzlvl0 > 500) {
        printf("gzlvl0_max is 500\n");
        psg_abort(1);
    } 

    if( gt1 > 3e-3 || gt2 > 3e-3 || gt3 > 3e-3 || gt4 > 3e-3 
        || gt5 > 3e-3 || gt6 > 3e-3 || gt7 > 3e-3 
        || gt8 > 3e-3 || gt9 > 3e-3 || gt10 > 3e-3 || gt11 > 3e-3  
        || gt12 > 3e-3)
    {
        printf("gradients are on for too long !!! ");
        psg_abort(1);
    } 


    if(ix==1) {
    if(f1180[A] != 'n' || f2180[A] !='y' || f3180[A] != 'y') {
        printf("f1180 should be n, f2180 y, and f3180 should be y\n");
    }
   }


/* LOAD VARIABLES */

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

/* INITIALIZE VARIABLES */

  tauxh = 1/(4*jxh);

/* Phase incrementation for hypercomplex data */

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

   if ( phase2 == 2 ) {    /* Hypercomplex in t2 */
        tsadd(t1, 1, 4);
   }

   if ( phase3 == 2 )     /* Hypercomplex in t3 */
   {
        tsadd(t6, 2, 4);
        tsadd(t7, 2, 4);
        tsadd(t8, 2, 4);
        tsadd(t10, 2, 4);
        icosel = -1;
   }
   else
       icosel = 1;

/* calculate modifications to phases based on current t2/t3 values
   to achieve States-TPPI acquisition */

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

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

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

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

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

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

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

   tau2 = d3;
   if(f2180[A] == 'y')  
      tau2 += ( 1.0/(2.0*sw2) - (4.0/PI)*pwx2
                - 2.0*(2.0*GRADIENT_DELAY + 50.0e-6 + 5.0e-6) );
   if(f2180[A] == 'n')  
      tau2 = ( tau2 - (4.0/PI)*pwx2
                - 2.0*(2.0*GRADIENT_DELAY + 50.0e-6 + 5.0e-6) );

   tau2 = tau2/2.0;

   if(ix==1)
     if((tau2 + 5.0e-6 - 0.5*(WFG_START_DELAY + 4.0*pw + WFG_STOP_DELAY)
         < 5.0e-6) && N_flg[A] == 'n')
      printf("tau2 is negative; set f1180 to y\n");

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

   tau3 = d4;
   if(f3180[A] == 'y')  tau3 += ( 1.0/(2.0*sw3) );

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

/* Now include Bax/Logan trick */

   if(ni != 1) {
     if(diag_supp[A] == 'n')
        zeta = (tauxh - gt5 - 102.0e-6 + 2.0*pwx2 - 2.0e-6);
     else 
        zeta = (1.0/(8.0*93.39) - gt5 - 102.0e-6 + 2.0*pwx2 - 2.0e-6);
     zeta = zeta / ( (double) (ni-1) );

     if(zeta < 0.0) {
        printf("problem with zeta\n");
        psg_abort(1);
     }

   }

   else
      zeta = 0.0;

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

   zeta1 = zeta*( (double)t1_counter );
   tau1 = tau1 - zeta1; 



/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tsatpwr);            /* Set power for presaturation  */
   decpower(d_ad);               /* Set decoupler1 power to d_ad */
   dec2power(dhpwr2);            /* Set decoupler2 power to dhpwr2 */

/* Presaturation Period */


 if(fsat[0] == 'y')
{
  txphase(zero);
  rgpulse(d1,zero,2.0e-6,2.0e-6);  /* presat */
  obspower(tpwr);                /* Set power for hard pulses  */

    if (fscuba[0] == 'y')            /* Scuba pulse sequence */
    {  
      hsdelay(hscuba);

      rgpulse(pw,zero,1.0e-6,0.0);	/* 90x180y90x */
      rgpulse(2*pw,one,1.0e-6,0.0);
      rgpulse(pw,zero,1.0e-6,0.0);
 
      txphase(zero);
      delay(hscuba);        
    }
}

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

status(B);

   obsoffset(tof);

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

  /* eliminate all magnetization originating from 15N */

  dec2rgpulse(pwx2,zero,0.0,0.0);

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

  rgpulse(pw,zero,0.0,0.0);

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

  delay(tauxh - gt2 - 4.0e-6);               /* delay=1/4J(XH)   */

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

  delay(tauxh - gt2 - 202.0e-6);             /* delay=1/4J(XH)   */

  txphase(one); dec2phase(t1);

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

  rgpulse(pw,one,0.0,0.0);       

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,two,2.0e-6,0.0);
  delay(2.0e-6);
  obspower(tpwr);
  /* shaped pulse */

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

  txphase(zero);

  dec2rgpulse(pwx2,t1,0.0,0.0);
  dec2phase(zero);

  if(N_flg[A] == 'n') 
  {
    if(tau2 + 5.0e-6 - 0.5*(WFG2_START_DELAY
                 + pwc_ad + WFG2_STOP_DELAY) < 0.2e-6)
     {
      rgradient('z',gzlvl0); /* use rgradient since shaping takes more time */
      delay(tau2 + 5.0e-6 - 0.5*(WFG_START_DELAY + 4.0*pw + WFG_STOP_DELAY));
      rgradient('z',0.0);
      delay(50.0e-6);

      shaped_pulse("composite",4.0*pw,zero,0.0,0.0);  /* 90x-180y-90x  */

      rgradient('z',-1.0*gzlvl0);
      delay(tau2 + 5.0e-6 - 0.5*(WFG_START_DELAY + 4.0*pw + WFG_STOP_DELAY));
      rgradient('z',0.0);
      delay(50.0e-6);

     }

     else

     {
      rgradient('z',gzlvl0); /* use rgradient since shaping takes more time */
      delay(tau2 + 5.0e-6 - 0.5*(WFG2_START_DELAY
              + pwc_ad + WFG2_STOP_DELAY));
      rgradient('z',0.0);
      delay(50.0e-6);

      simshaped_pulse("composite",sh_ad,4.0*pw,pwc_ad,zero,zero,0.0,0.0);

      rgradient('z',-1.0*gzlvl0); /* use rgradient since shaping takes more time */
      delay(tau2 + 5.0e-6 - 0.5*(WFG2_START_DELAY
              + pwc_ad + WFG2_STOP_DELAY));
      rgradient('z',0.0);
      delay(50.0e-6);

     }
  }   /* N_flg[A] == y */

  else
    sim3pulse(2.0*pw,0.0,2.0*pwx2,zero,zero,zero,4.0e-6,4.0e-6);

  dec2rgpulse(pwx2,zero,0.0,0.0);

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

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

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,t3,2.0e-6,0.0);
  delay(2.0e-6);
  obspower(tpwr);
  /* shaped pulse */

  rgpulse(pw,t2,2.0e-6,0.0);
  txphase(t9);

  delay(tau1 + tauxh + zeta1 - gt5 - 102.0e-6);

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

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

  delay(tau1);

  rgpulse(2.0*pw,t9,0.0,0.0); txphase(one);

  delay(tauxh - zeta1 - gt5 - 102.0e-6 + 2.0*pwx2);

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

  rgpulse(pw,one,0.0,0.0);

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,one,2.0e-6,0.0);
  delay(2.0e-6);
  obspower(tpwr);
  /* shaped pulse */

  delay(MIX - gt6 - gstab -2.0e-6); 

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

  }

  else {

  initval(1.0,v4);
  obsstepsize(45.0);
  xmtrphase(v4);

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,t3,2.0e-6,0.0);
  delay(2.0e-6);
  obspower(tpwr);
  /* shaped pulse */
/*
  xmtrphase(zero);
  delay(2.0e-6);

  initval(1.0,v4);
  obsstepsize(45.0);
  xmtrphase(v4);
*/
  
  rgpulse(pw,t2,2.0e-6,0.0);

  xmtrphase(zero);
  txphase(t9);

  delay(tau1 + 1.0/(8.0*93.39) + zeta1 - gt5 - 102.0e-6 - SAPS_DELAY);

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

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

  delay(tau1);

  rgpulse(2.0*pw,t9,0.0,0.0); txphase(one);

  delay(1.0/(8.0*93.39) - zeta1 - gt5 - 102.0e-6 + 2.0*pwx2);

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

  rgpulse(pw,one,0.0,0.0);

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,one,2.0e-6,0.0);
  delay(2.0e-6);
  obspower(tpwr);
  /* shaped pulse */

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

    delay(MIX - 1.5*gt6 - 2.0*(gstab+2.0e-6) - 2.0*pwx2); 

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

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

  }

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

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,zero,2.0e-6,0.0);
  delay(2.0e-6); txphase(zero);
  obspower(tpwr);
  /* shaped pulse */

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

  delay(tauxh  
      - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
      - pw_sl - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY 
      - gt7 - 4.0e-6);               /* delay=1/4J(XH)   */

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

  delay(tauxh 
      - gt7 - gstab -2.0e-6
      - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
      - pw_sl - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY); 

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

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,one,2.0e-6,0.0);
  obspower(tpwr);
  delay(2.0e-6); txphase(zero);
  /* shaped pulse */

  rgpulse(pw,one,0.0,0.0);

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

  txphase(t6);

  if(phase3 == 1)
    dec2rgpulse(pwx2,t4,4.0e-6,0.0);
  if(phase3 == 2)
    dec2rgpulse(pwx2,t5,4.0e-6,0.0);

  decphase(zero); 

  if(tau3 - 0.5*(WFG_START_DELAY
                 + pwc_ad + WFG_STOP_DELAY)
          < 0.2e-6) {

  delay(tau3);
  delay(tau3);

  }

  else {

  delay(tau3 - 0.5*(WFG_START_DELAY
               + pwc_ad + WFG_STOP_DELAY));

  decshaped_pulse(sh_ad,pwc_ad,zero,0.0,0.0); 

  delay(tau3 - 0.5*(WFG_START_DELAY
               + pwc_ad + WFG_STOP_DELAY));

  }

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

  delay(BigT - 4.0/PI*pwx2 + pw - 2.0*GRADIENT_DELAY - gt11
        - 102.0e-6);

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

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

  delay(BigT - 2.0*GRADIENT_DELAY - gt11
        - 102.0e-6);

  rgpulse(pw,t6,0.0,0.0);

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,t7,2.0e-6,0.0);
  delay(2.0e-6); txphase(zero);
  obspower(tpwr);
  /* shaped pulse */

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

  delay(tauxh 
      - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
      - pw_sl - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY 
      - gt9 - 102.0e-6);

  sim3pulse(2.0*pw,0.0,2.0*pwx2,zero,zero,zero,0.0,0.0);
  dec2phase(t8);

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

  delay(tauxh 
      - gt9 - 102.0e-6
      - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
      - pw_sl - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY); 

  /* shaped pulse */
  obspower(tpwrsl);
  shaped_pulse(shape,pw_sl,zero,2.0e-6,0.0);
  obspower(tpwr);
  delay(2.0e-6); txphase(zero);
  /* shaped pulse */

  sim3pulse(pw,0.0,pwx2,zero,zero,t8,0.0,0.0);

  dec2phase(zero);

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

  delay(tauxh - gt10 - 4.0e-6);

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

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

  delay(tauxh
        - gt10 - 102.0e-6
        + 2.0/PI*pw - pwx2 + 0.5*(pwx2-pw));

  dec2rgpulse(pwx2,zero,0.0,0.0);

  dec2power(dpwr2);  /* Very Important */
  decpower(dpwr);

  delay(BigT1 - 2.0*POWER_DELAY);

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

  delay(2.0e-6);
  zgradpulse(-1.0*icosel*gzlvl12,gt12);
  delay(50.0e-6);

  delay(BigT1 - 2.0*GRADIENT_DELAY - 52.0e-6 - gt12);

/* acquire data */

status(C);
     setreceiver(t10);
}
Пример #6
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
          SE_flg[MAXSTR];

   int    icosel = 0,
          t1_counter,
          phase;


   double d2_init=0.0,
          pwS4,pwS5,pwS6,pwS7,
          lambda = getval("lambda"),
          gzlvl1 = getval("gzlvl1"),
          gzlvl2 = getval("gzlvl2"), 
          gzlvl3 = getval("gzlvl3"), 
          gzlvl5 = getval("gzlvl5"), 
          gt1 = getval("gt1"),
          gt3 = getval("gt3"),
          gt5 = getval("gt5"),
          gstab = getval("gstab"),
          shpw1,shlvl1=getval("shlvl1"),
          pwClvl = getval("pwClvl"),
          pwNlvl = getval("pwNlvl"),
          pwN = getval("pwN"),
          ni = getval("ni"),
          d2 = getval("d2"),
          tau1 = getval("tau1");

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



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

/*   INITIALIZE VARIABLES   */

   shpw1 = getval("shpw1");
   pwS4 = h_shapedpw("eburp2",4.0,3.5,zero, 0.0, 0.0);  
   pwS5 = h_shapedpw("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);
   pwS6 = h_shapedpw("reburp",4.0,3.5,zero, 0.0, 0.0);
   pwS7 = c_shapedpw2("isnob5",40.0,-125.0,"isnob5",40.0,0.0 , two, 0.0, 0.0);

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

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

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



   status(A);
   decpower(pwClvl);
   dec2power(pwNlvl);
   set_c13offset("co");
   zgradpulse(gzlvl3, gt3);
   delay(d1-gt3);
   lk_hold();
   rcvroff();
        h_shapedpulse("pc9f",4.0,3.5,zero, 2.0e-6, 0.0);  

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

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

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

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


   obspower(shlvl1);
/**************************************************************************/ 
/** Sensitivity enhanced version                     **********************/
/**************************************************************************/ 
      if (SE_flg[0] == 'y')
      {
        shaped_pulse(shname1,shpw1,zero,0.0,0.0);
     dec2rgpulse(pwN,t3,0.0,0.0);
           delay(tau1*0.5);
        shaped_pulse(shname1,shpw1,two,0.0,0.0);
 c_shapedpulse2("isnob5",40.0,-125.0,"isnob5",40.0,0.0 , two, 0.0, 0.0);
           delay(tau1*0.5);
        zgradpulse(-gzlvl1, gt1);
           delay(pwS4-shpw1-pwS7-gt1);
     dec2rgpulse(pwN*2.0,zero,0.0,0.0);

        h_shapedpulse("eburp2",4.0,3.5,zero, 2.0e-6, 0.0); 
	dec2rgpulse(pwN, t10, 0.0, 0.0);
      }

/**************************************************************************/ 
/** standard INEPT-based version                     **********************/
/**************************************************************************/ 
      else
      {
      if (ni < 1.0)
      {
       dec2rgpulse(pwN,t3,0.0,0.0);
       dec2rgpulse(pwN*2.0, zero, 0.0, 0.0);
       dec2rgpulse(pwN, zero, 0.0, 0.0);
      }
      else
      {
           if (tau1 < shpw1)
           {
           shaped_pulse(shname1,shpw1,two,0.0,0.0);
           shaped_pulse(shname1,shpw1,zero,0.0,0.0);
           dec2rgpulse(pwN,t3,0.0,0.0);
           delay(tau1);
           dec2rgpulse(pwN*3.0, zero, 0.0, 0.0);
           }
           else
           {
             if  (tau1*0.5 < (pwS7+shpw1*0.5))
             {
             shaped_pulse(shname1,shpw1,two,0.0,0.0);
             dec2rgpulse(pwN,t3,0.0,0.0);
             delay(tau1*0.5-shpw1*0.5);
             shaped_pulse(shname1,shpw1,zero,0.0,0.0);
             delay(tau1*0.5-shpw1*0.5);
             dec2rgpulse(pwN*3.0, zero, 0.0, 0.0);
             }
             else
             {
             shaped_pulse(shname1,shpw1,two,0.0,0.0);
             dec2rgpulse(pwN,t3,0.0,0.0);
             delay(tau1*0.5-shpw1*0.5);
             shaped_pulse(shname1,shpw1,zero,0.0,0.0);
             c_shapedpulse2("isnob5",40.0,-125.0,"isnob5",40.0,0.0 , two, 0.0, 0.0);
             delay(tau1*0.5-shpw1*0.5-pwS7);
             dec2rgpulse(pwN*3.0, zero, 0.0, 0.0);
             }
           } 
      }
      }
/**************************************************************************/ 

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

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

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

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

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

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

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

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


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

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

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

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

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

}		 
Пример #7
0
pulsesequence()
{
 char       f1180[MAXSTR],   
            f2180[MAXSTR],  
            mag_flg[MAXSTR],
            flg_3919[MAXSTR],
            ref_flg[MAXSTR];

 int         phase, ni2,
             t1_counter,   
             t2_counter;   

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

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


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

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

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

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

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

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

/*  Phase incrementation for hypercomplex 2D data */

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

/*  Set up f1180  half_dwell time (1/sw1)/2.0           */
   
    tau1 = d2 - (4.0*pw/PI + 2.0*pwN);
    if(f1180[A] == 'y')
    {
        tau1 += (1.0/(2.0*sw1));
    }
    if(tau1 < 0.2e-6) tau1 = 0.0;
    tau1 = tau1/2.0;

/*  Set up f2180   half dwell time (1/sw2)/2.0              */

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


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

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

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


/* BEGIN ACTUAL PULSE SEQUENCE */

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

   delay(d1);

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

status(B);

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

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

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

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

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

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

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


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

status(C);
   setreceiver(t10);
   rcvron();
}
Пример #8
0
void pulsesequence()
{
   double          slpwr,
                   slpw,
                   mix,
                   hsglvl,
                   hsgt,
                   gzlvlz,
                   gtz,
		   zfpw,
		   zfpwr,
                   cycles;
   int             iphase;
   char            sspul[MAXSTR],
		   composit[MAXSTR],
		   compshape[MAXSTR],
		   zfilt[MAXSTR],
		   zfshp[MAXSTR];


/* LOAD AND INITIALIZE PARAMETERS */
   mix = getval("mix");
   iphase = (int) (getval("phase") + 0.5);
   slpwr = getval("slpwr");
   slpw = getval("slpw");
   getstr("sspul", sspul);
   hsglvl = getval("hsglvl");
   hsgt = getval("hsgt");
   gzlvlz = getval("gzlvlz");
   gtz = getval("gtz");
   zfpwr = getval("zfpwr");
   zfpw = getval("zfpw");
   getstr("zfshp",zfshp);
   getstr("zfilt",zfilt);
   getstr("composit",composit);
   getstr("compshape",compshape);

   sub(ct,ssctr,v7);

   settable(t1,4,ph1);	getelem(t1,v7,v1);
   settable(t2,8,ph2);	getelem(t2,v7,v2);	add(v2,two,v3);
   settable(t3,8,ph3);	getelem(t3,v7,oph);
   settable(t4,8,ph4);	getelem(t4,v7,v4);
   settable(t5,4,ph5);	getelem(t5,v7,v5);
   settable(t6,8,ph6);	getelem(t5,v7,v6);
   
   if (zfilt[0] == 'n') assign(v1,oph);

   if (iphase == 2)
      {incr(v1); incr(v6);}			/* hypercomplex method */

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

   cycles = mix / (4.0 * slpw);
   initval(cycles, v10);	/* mixing time cycles */


/* BEGIN ACTUAL PULSE SEQUENCE */
   status(A);
      obspower(tpwr);
      delay(5.0e-6);
   if (sspul[0] == 'y')
   {
         zgradpulse(hsglvl,hsgt);
         rgpulse(pw,zero,rof1,rof1);
         zgradpulse(hsglvl,hsgt);
   }

   delay(d1);

	if (getflag("wet"))
		wet4(zero,one);
   status(B);
      rgpulse(pw, v1, rof1, rof1);
      if (d2 > (POWER_DELAY + (2.0*pw/PI) + rof1))
       delay(d2 - POWER_DELAY - (2.0*pw/PI) - rof1);
      
      else {
	if (ix == 1)
	  dps_show("delay",d2);
	else if ((ix > 2) && (iphase < 2))
	  text_error("increment %d cannot be timed properly\n", (int) ix/2);
      }

      obspower(slpwr);

      if (cycles > 1.5000)
       {
	 obsunblank(); xmtron();
         starthardloop(v10);
		txphase(v2);
		delay(2*slpw);
		txphase(v3);
		delay(2*slpw);
         endhardloop();
	 xmtroff(); obsblank();
       }

       if (zfilt[0] == 'y')
        {
           obspower(tpwr);
           rgpulse(pw,v4,1.0e-6,rof1);
           zgradpulse(gzlvlz,gtz);
           delay(gtz/3);
           obspower(zfpwr);
           shaped_pulse(zfshp,zfpw,zero,2.0e-6,2.0e-6);
           zgradpulse(gzlvlz/4,gtz/3);
           obspower(tpwr);
           delay(gtz/8);
	   if (composit[0] == 'y')
    	   {
       		  if (rfwg[OBSch-1] == 'y')
       		   shaped_pulse(compshape,4.0*pw+0.8e-6,v5,rof1,rof2);
       		  else
       		   comp90pulse(pw,v5,rof1,rof2);
    	   }
           else
           	  rgpulse(pw,v5,rof1,rof2);
        }
       else
           delay(rof2);

   status(C);
}
Пример #9
0
pulsesequence()
{
   double	   slpwrT = getval("slpwrT"),
		   slpwT = getval("slpwT"),
		   mixT = getval("mixT"),
		   gzlvl1 = getval("gzlvl1"),
		   gt1 = getval("gt1"),
		   gzlvl2 = getval("gzlvl2"),
		   gt2 = getval("gt2"),
		   gstab = getval("gstab"),
                   selpwrA = getval("selpwrA"),
                   selpwA = getval("selpwA"),
                   gzlvlA = getval("gzlvlA"),
                   gtA = getval("gtA"),
                   selpwrB = getval("selpwrB"),
                   selpwB = getval("selpwB"),
                   gzlvlB = getval("gzlvlB"),
                   gtB = getval("gtB"),
		   selfrq = getval("selfrq"),
                   zqfpw1 = getval("zqfpw1"),
                   zqfpwr1 = getval("zqfpwr1"),
                   zqfpw2 = getval("zqfpw2"),
                   zqfpwr2 = getval("zqfpwr2"),
                   gzlvlzq1 = getval("gzlvlzq1"),
                   gzlvlzq2 = getval("gzlvlzq2"),
                   phincr1 = getval("phincr1");
   char		   slpatT[MAXSTR], selshapeA[MAXSTR], selshapeB[MAXSTR], zqfpat1[MAXSTR],
                   zqfpat2[MAXSTR], flipback[MAXSTR], alt_grd[MAXSTR];

//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gtA = syncGradTime("gtA","gzlvlA",1.0);
        gzlvlA = syncGradLvl("gtA","gzlvlA",1.0);
        gtB = syncGradTime("gtB","gzlvlB",1.0);
        gzlvlB = syncGradLvl("gtB","gzlvlB",1.0);

   getstr("slpatT",slpatT);
   getstr("selshapeA",selshapeA);
   getstr("selshapeB",selshapeB);
   getstr("zqfpat1",zqfpat1);
   getstr("zqfpat2",zqfpat2);
   getstr("flipback", flipback);
   getstr("alt_grd",alt_grd);
                     /* alternate gradient sign on every 2nd transient */

   if (strcmp(slpatT,"mlev17c") &&
        strcmp(slpatT,"dipsi2") &&
        strcmp(slpatT,"dipsi3") &&
        strcmp(slpatT,"mlev17") &&
        strcmp(slpatT,"mlev16"))
        abort_message("SpinLock pattern %s not supported!.\n", slpatT);

/* STEADY-STATE PHASECYCLING */
/* This section determines if the phase calculations trigger off of (SS - SSCTR) or off of CT */

   assign(ct,v17);

   ifzero(ssctr);
      assign(v17,v13);
   elsenz(ssctr);
        /* purge option does not adjust v13 during steady state*/
      sub(ssval, ssctr, v13); /* v13 = 0,...,ss-1 */
   endif(ssctr);

   mod4(v13,v1); /* v1 = 0 1 2 3 */
   hlv(v13,v13);
   hlv(v13,v13);
   mod4(v13,v11); /* v11 = 0000 1111 2222 3333 */
   dbl(v1,oph);
   add(v11,oph,oph);
   add(v11,oph,oph); /* oph = 2v1 + 2v11 */

/* CYCLOPS */
   hlv(v13,v13);
   hlv(v13,v14);
   add(v1,v14,v1);
   add(v11,v14,v11);
   add(oph,v14,oph);
   assign(v14,v21);
   add(one,v21,v21);
   add(two,v21,v12);

  if (phincr1 < 0.0) phincr1=360+phincr1;
  initval(phincr1,v5);

   mod2(ct,v2);    /* 01 01 */
   hlv(ct,v4); hlv(v4,v4); mod2(v4,v4); dbl(v4,v4); /* 0000 2222 */
   add(v4,v2,v4); mod4(v4,v4); /* 0101 2323  first echo in Excitation Sculpting */
   hlv(ct,v7); mod2(v7,v7);    /* 0011 */
   hlv(ct,v9); hlv(v9,v9); hlv(v9,v9); dbl(v9,v9); add(v9,v7,v9);
   mod4(v9,v9);   /* 0011 0011 2233 2233 second echo in Excitation Sculpting */

   dbl(v2,v2);    /* 0202 */
   dbl(v7,v7);    /* 0022 */
   add(v2,v7,v7); /* 0220 correct oph for Excitation Sculpting */
   add(oph,v7,oph); mod4(oph,oph);

  if (alt_grd[0] == 'y') mod2(ct,v10); /* alternate gradient sign on every 2nd transient */

/* BEGIN THE ACTUAL PULSE SEQUENCE */
status(A);

   if (getflag("lkgate_flg"))  lk_sample(); /* turn lock sampling on */

   obspower(tpwr);
   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

   delay(d1);

   if (getflag("lkgate_flg"))  lk_hold(); /* turn lock sampling off */

   status(B);

        rgpulse(pw, v14, rof1, rof1);

      if (selfrq != tof)
        obsoffset(selfrq);

        ifzero(v10); zgradpulse(gzlvlA,gtA);
        elsenz(v10); zgradpulse(-gzlvlA,gtA); endif(v10);
        delay(gstab);
        obspower(selpwrA);
        shaped_pulse(selshapeA,selpwA,v1,rof1,rof1);
        obspower(tpwr);
        ifzero(v10); zgradpulse(gzlvlA,gtA);
        elsenz(v10); zgradpulse(-gzlvlA,gtA); endif(v10);
        delay(gstab);

      if (selfrq != tof)
        delay(2*OFFSET_DELAY);

        ifzero(v10); zgradpulse(gzlvlB,gtB);
        elsenz(v10); zgradpulse(-gzlvlB,gtB); endif(v10);
        delay(gstab);
        obspower(selpwrB);
        shaped_pulse(selshapeB,selpwB,v11,rof1,rof1);
        obspower(tpwr);
        ifzero(v10); zgradpulse(gzlvlB,gtB);
        elsenz(v10); zgradpulse(-gzlvlB,gtB); endif(v10);
        delay(gstab);

      if (selfrq != tof)
        obsoffset(tof);

        rgpulse(pw, v14, rof1, rof1);
        if (getflag("Gzqfilt"))
        {
         obspower(zqfpwr1);
         ifzero(v10); rgradient('z',gzlvlzq1);
         elsenz(v10); rgradient('z',-gzlvlzq1); endif(v10);
         delay(100.0e-6);
         shaped_pulse(zqfpat1,zqfpw1,v14,rof1,rof1);
         delay(100.0e-6);
         rgradient('z',0.0);
         delay(gstab);
        }
        obspower(slpwrT);
        ifzero(v10); zgradpulse(gzlvl1,gt1);
        elsenz(v10); zgradpulse(-gzlvl1,gt1); endif(v10);
        delay(gstab);

	if (mixT > 0.0)
	{
          if (dps_flag)
          	rgpulse(mixT,v21,0.0,0.0);
          else
          	SpinLock(slpatT,mixT,slpwT,v21);
        }

        if (getflag("Gzqfilt"))
        {
         obspower(zqfpwr2);
         ifzero(v10); rgradient('z',gzlvlzq2);
         elsenz(v10); rgradient('z',-gzlvlzq2); endif(v10);
         delay(100.0e-6);
         shaped_pulse(zqfpat2,zqfpw2,v14,rof1,rof1);
         delay(100.0e-6);
         rgradient('z',0.0);
         delay(gstab);
        }
        obspower(tpwr);
        ifzero(v10); zgradpulse(gzlvl2,gt2);
        elsenz(v10); zgradpulse(-gzlvl2,gt2); endif(v10);
        delay(gstab);

      if (flipback[A] == 'y')
         FlipBack(v14,v5);

      rgpulse(pw,v14,rof1,2.0e-6);
      ExcitationSculpting(v4,v9,v10);
      delay(rof2);

   status(C);
}
Пример #10
0
void pulsesequence()

{
/* DECLARE VARIABLES */

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

 int	     phase,t1_counter;

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

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

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

/* LOAD VARIABLES */

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

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

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

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



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

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

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

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

/* check validity of parameter range */

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

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

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

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

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

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

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

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

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

/* LOAD VARIABLES */

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

/* Phase incrementation for hypercomplex 2D data */

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

/* Set up f1180  */

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

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

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

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


/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */

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

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

  obsoffset(tof);

status(B);

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

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

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

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

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

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

  txphase(zero);
  dec2phase(zero);

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

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

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

  txphase(one);
  dec2phase(t1);

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

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

  rgpulse(pw,one,0.0,0.0);

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

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

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

  dec2phase(zero);

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

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

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

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

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

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

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

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

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

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

  dec2phase(t3);

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

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

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

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

  rgpulse(pw,t4,0.0,0.0);

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

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

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

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

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

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

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

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

  txphase(zero);
  dec2phase(zero);

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

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

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

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

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

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

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

  dec2rgpulse(pwn,zero,0.0,0.0);

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

/* acquire data */

status(C);
     setreceiver(t7);
}
Пример #11
0
void pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
            mag_flg[MAXSTR],      /* magic-angle coherence transfer gradients */
 	    TROSY[MAXSTR];			    /* do TROSY on N15 and H1 */
 
int         icosel,          			  /* used to get n and p type */
            t1_counter=getval("t1_counter"),      /* used for states tppi in t1 */
            t2_counter=getval("t2_counter"),      /* used for states tppi in t2 */
	    nli = getval("nli"),
	    nli2 = getval("nli2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    kappa = 5.4e-3,
	    lambda = 2.4e-3,
            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	rf0,            	  /* maximum fine power when using pwC pulses */

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

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

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

   	pwHd,	    		        /* H1 90 degree pulse length at tpwrd */
   	tpwrd,                                     /* rf for WALTZ decoupling */
        waltzB1 = getval("waltzB1"),  /* waltz16 field strength (in Hz)     */

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

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

	gt1 = getval("gt1"),  		       /* coherence pathway gradients */
        gzcal  = getval("gzcal"),            /* g/cm to DAC conversion factor */
	gzlvl1 = getval("gzlvl1"),
	gzlvl2 = getval("gzlvl2"),

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

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



/*   LOAD PHASE TABLE    */

	settable(t3,2,phi3);
	settable(t4,1,phx);
	settable(t5,4,phi5);
   if (TROSY[A]=='y')
       {settable(t8,1,phy);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,4,recT);}
    else
       {settable(t8,1,phx);
	settable(t9,8,phi9);
	settable(t10,1,phx);
	settable(t11,1,phy);
	settable(t12,4,rec);}




/*   INITIALIZE VARIABLES   */

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

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

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

    /* the pwC3 pulse at the middle of t1  */
	if ((nli2 > 0.0) && (nli == 1.0)) nli = 0.0;
        if (pwC3a > 2.0*pwN) pwZ = pwC3a; else pwZ = 2.0*pwN;
        if ((pwC3==0.0) && (pwC3a>2.0*pwN)) pwZ1=pwC3a-2.0*pwN; else pwZ1=0.0;
	if ( nli > 1 )     pwC3 = pwC3a;
	if ( pwC3 > 0 )   phshift3 = 48.0;
	else              phshift3 = 0.0;

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

    /* 180 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */
	rf8 = (compC*4095.0*pwC*2.0*1.65)/pwC8;	/* needs 1.65 times more     */
	rf8 = (int) (rf8 + 0.5);		/* power than a square pulse */
	
    /* selective H20 one-lobe sinc pulse */
    tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69)); /* needs 1.69 times more */
    tpwrs = (int) (tpwrs);                       /* power than a square pulse */

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


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

    if ( dpwr2 > 46 )
       { printf("dpwr2 too large! recheck value  "); psg_abort(1);}

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



/* PHASES AND INCREMENTED TIMES */

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

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


/*  Set up f1180  */

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

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


/*  Set up f2180  */

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

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


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

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

   if(t2_counter % 2) 
	{ tsadd(t8,2,4); tsadd(t12,2,4); }


/* BEGIN PULSE SEQUENCE */

status(A);
   	delay(d1);
	rcvroff();
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rf0);
	obsoffset(tof);
	txphase(zero);
   	delay(1.0e-5);

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

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

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

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

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

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

    delay(0.5*kappa - 2.0*pw);

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

    decphase(zero);
    dec2phase(zero);
    decpwrf(rf8);
    delay(timeTN - 0.5*kappa - WFG3_START_DELAY);
   }
else
   {txphase(zero);
    shaped_pulse("H2Osinc", pwHs, zero, 5.0e-4, 0.0);
    obspower(tpwrd); obspwrf(4095.0);
    zgradpulse(gzlvl3, gt3);
    delay(2.0e-4);
    dec2rgpulse(pwN, zero, 0.0, 0.0);

    txphase(one);
    delay(kappa - pwHd - 2.0e-6 - PRG_START_DELAY);

    rgpulse(pwHd,one,0.0,0.0);
    txphase(zero);
    delay(2.0e-6);
    obsprgon("waltz16", pwHd, 90.0);	          /* PRG_START_DELAY */
    xmtron();
    decphase(zero);
    dec2phase(zero);
    decpwrf(rf8);
    delay(timeTN - kappa - WFG3_START_DELAY);
   }
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC8", "", 0.0, pwC8, 2.0*pwN, zero, zero, zero, 
								     0.0, 0.0);
	decphase(t3);
	decpwrf(rf6);
	delay(timeTN);

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

/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION        xxxxxxxxxxxxxxxxxx    */

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


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


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


else             /* 13CO evolution refocused for 1st increment, or when nli=0  */
   {
 	decpwrf(rf8);
	delay(12.0e-6);					   /* WFG_START_DELAY */
	decshaped_pulse("offC8", pwC8, zero, 0.0, 0.0);
	delay(10.0e-6);
   }
	decphase(t5);
	decpwrf(rf6);
	delay(2.0e-6);					   /* WFG_START_DELAY */
	decshaped_pulse("offC6", pwC6, t5, 0.0, 0.0);

/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

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

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

	dec2phase(t10);
        decpwrf(rf3);

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

    else if (tau2 > pwHs + 0.5e-4)
	{
	  txphase(three);
          delay(timeTN-pwC3a-WFG_START_DELAY-gt1-2.0*GRADIENT_DELAY-1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else  zgradpulse(icosel*gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
          obspower(tpwrs);
          if (tpwrsf<4095.0)
	   {obspwrf(tpwrsf);				       /* POWER_DELAY */
	    delay(1.0e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(1.0e-4 - POWER_DELAY);
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - pwHs - 0.5e-4);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
          obspower(tpwr);
          if (tpwrsf<4095.0)
	   {obspwrf(4095.0);				       /* POWER_DELAY */
	    delay(0.50e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(0.50e-4 - POWER_DELAY);
	}
    else
	{
	  txphase(three);
          delay(timeTN - pwC3a - WFG_START_DELAY - gt1 - 2.0*GRADIENT_DELAY
							    - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else  zgradpulse(icosel*gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
          obspower(tpwrs);
          if (tpwrsf<4095.0)
	   {obspwrf(tpwrsf);				       /* POWER_DELAY */
	    delay(1.0e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(1.0e-4 - POWER_DELAY);
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
	  txphase(t4);
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2);
          obspower(tpwr);
          if (tpwrsf<4095.0)
	   {obspwrf(4095.0);				       /* POWER_DELAY */
	    delay(0.50e-4 - POWER_DELAY - PWRF_DELAY);}
          else
	   delay(0.50e-4 - POWER_DELAY);
	 }
}
else
{
    if (tau2 > kappa)
	{
          delay(timeTN - pwC3a - WFG_START_DELAY);     	   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
          delay(kappa - gt1 - 2.0*GRADIENT_DELAY - 1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else if (tau2 > (kappa - pwC3a - WFG_START_DELAY))
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);                                     /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(kappa -pwC3a -WFG_START_DELAY -gt1 -2.0*GRADIENT_DELAY -1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
          delay(kappa - tau2 - pwC3a - WFG_START_DELAY);   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
	  obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
    	  delay(kappa-tau2-pwC3a-WFG_START_DELAY-gt1-2.0*GRADIENT_DELAY-1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(icosel*gzcal*gzlvl1, gt1);
          else    zgradpulse(icosel*gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                    /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2);
	}
}                                                          
/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */
	if (TROSY[A]=='y')  rgpulse(pw, t4, 0.0, 0.0);
	else                sim3pulse(pw, 0.0, pwN, t4, zero, t10, 0.0, 0.0);

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

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

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

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

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

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

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

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

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

	rgpulse(2.0*pw, zero, 0.0,0.0);
	dec2power(dpwr2);				       /* POWER_DELAY */
        if (mag_flg[A] == 'y')    magradpulse(gzcal*gzlvl2, gt1/10.0);
        else   zgradpulse(gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4 );

	setreceiver(t12);
}		 
Пример #12
0
pulsesequence()
{
 
char      N15edit[MAXSTR], C13edit[MAXSTR];	      /* C13 editing*/
	   
 double tpwrs,pwC,d2,tau,d3,d4,d5,d6,
 gt2,gt3,gt0,gzlvl0,gzlvl2,gzlvl3,phincr1,tpwrsf_u,tpwrsf_d,pwHs,compH,
 pwN,pwNlvl,ref_pwr,ref_pw90,pwZa,pwClvl,JXH;     
  


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

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

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

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

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

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


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

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

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



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




/* START THE PULSE SEQUENCE */

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

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

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

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

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

     setreceiver(t8);
   status(C);
}
Пример #13
0
void pulsesequence()
{
   double          mixN = getval("mixN"),
		   mixNcorr,
		   gzlvl1 = getval("gzlvl1"),
		   gt1 = getval("gt1"),
		   gstab = getval("gstab"),
                   zqfpw1 = getval("zqfpw1"),
                   zqfpwr1 = getval("zqfpwr1"),
                   gzlvlzq1 = getval("gzlvlzq1");
   char		   satmode[MAXSTR],
		   zqfpat1[MAXSTR],
		   wet[MAXSTR];
   int		   phase1 = (int)(getval("phase")+0.5);

/* LOAD VARIABLES */
   getstr("satmode",satmode);
   getstr("wet",wet);
   getstr("zqfpat1",zqfpat1);
   mixNcorr = 0.0;
   if (getflag("PFGflg"))
   {
	mixNcorr = gt1 + gstab;
	if (getflag("Gzqfilt"))
		mixNcorr += gstab + zqfpw1;
   	if (wet[1] == 'y')
		mixNcorr += 4*(getval("pwwet")+getval("gtw")+getval("gswet"));
   }

   if (mixNcorr > mixN)
	mixN=mixNcorr;

   settable(t1,16,phs1);
   settable(t2,32,phs2);
   settable(t3,16,phs3);
   settable(t5,16,phs5);
   settable(t4,32,phs4);
   
   getelem(t1,ct,v1);
   getelem(t4,ct,oph);
   assign(oph,v7);
   assign(zero,v6);
   getelem(t2,ct,v2);
   getelem(t3,ct,v3);
/*
   mod2(id2,v14);
   dbl(v14,v14);
*/
  initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v14);

   if (phase1 == 2)                                        /* hypercomplex */
      incr(v1);

   add(v1, v14, v1);
   add(oph,v14,oph);
    

/* BEGIN THE ACTUAL PULSE SEQUENCE */
   status(A);
   obspower(tpwr);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        satpulse(satdly,v6,rof1,rof1);
     }
   else
        delay(d1);

   if (wet[0] == 'y')
     wet4(zero,one);

   status(B);
      rgpulse(pw, v1, rof1, rof1);
      if (d2>0)
       delay(d2- 2*rof1 -(4*pw/PI));  /*corrected evolution time */
      else
       delay(d2);
      rgpulse(pw, v2, rof1, rof1);

      if (satmode[1] == 'y')
	satpulse((mixN-mixNcorr)*0.7,v7,rof1,rof1);
      else
	delay((mixN - mixNcorr)*0.7);

      if (getflag("PFGflg"))
      {
        if (getflag("Gzqfilt"))
        {
         obspower(zqfpwr1);
         rgradient('z',gzlvlzq1);
         delay(100.0e-6);
         shaped_pulse(zqfpat1,zqfpw1,zero,rof1,rof1);
         delay(100.0e-6);
         rgradient('z',0.0);
         delay(gstab);
	 obspower(tpwr);
        }
        zgradpulse(gzlvl1,gt1);
        delay(gstab);
      }
      if (satmode[1] == 'y')
        satpulse((mixN-mixNcorr)*0.3,v7,rof1,rof1);
      else
	delay((mixN - mixNcorr)*0.3);
      if (wet[1] == 'y')
	wet4(zero,one);
   status(C);
      rgpulse(pw, v3, rof1, rof2);
}
Пример #14
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);
}
Пример #15
0
pulsesequence()
{

    /* DECLARE AND LOAD VARIABLES */

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

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

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

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

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

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

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

                sw1 = getval("sw1"),

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

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

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

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



    /*   LOAD PHASE TABLE    */

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

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

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



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

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


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

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

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

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

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

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



    /* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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



    /*  RELAXATION TIMES AND FLAGS */

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


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




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

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


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


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

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


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


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


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


    /* PHASES AND INCREMENTED TIMES */

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

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


    /*  Set up f1180  */

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



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

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



    /*  Correct inverted signals for NH2 only spectra  */

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



    /* BEGIN PULSE SEQUENCE */

    status(A);

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

    delay(d1);


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

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

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

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

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

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

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

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

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

    /*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 RELAXATION    xxxxxxxxxxxxxxxxxxxx  */

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

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

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

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

            endloop(v5);
        }

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

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

        loop(v5,v6);

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

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

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

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

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

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

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

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

        delay(tau1);

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

    setreceiver(t12);
}
Пример #16
0
pulsesequence()

{

    /* DECLARE VARIABLES */

    char       autocal[MAXSTR],  /* auto-calibration flag */
               fsat[MAXSTR],
               fscuba[MAXSTR],
               f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
               f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
               fc180[MAXSTR],    /* Flag for checking sequence               */
               ddseq[MAXSTR],    /* deuterium decoupling sequence */
               spcosed[MAXSTR],  /* waveform Co seduce 180 */
               spcareb[MAXSTR],  /* waveform Ca reburp 180 */
               spca180[MAXSTR],  /* waveform Ca hard 180   */
               sel_flg[MAXSTR],
               shp_sl[MAXSTR],
               cacb_dec[MAXSTR],
               cacbdecseq[MAXSTR],
               nietl_flg[MAXSTR];

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

    double      tau1,         /*  t1 delay */
                tau2,         /*  t2 delay */
                taua,         /*  ~ 1/4JNH =  2.25 ms */
                taub,         /*  ~ 1/4JNH =  2.25 ms */
                tauc,         /*  ~ 1/4JNCa =  ~13 ms */
                taud,         /*  ~ 1/4JCaC' =  3~4.5 ms ms */
                bigTN,        /* nitrogen T period */
                pwc90,       /* PW90 for ca nucleus @ d_c90         */
                pwca180,      /* PW180 for ca nucleus @ d_c180         */
                pwca180dec,   /* pwca180+pad         */
                pwcareb,      /* pw180 at d_creb  ~ 1.6 ms at 600 MHz */
                pwcosed,      /* PW180 at d_csed  ~ 200us at 600 MHz  */
                tsatpwr,      /* low level 1H trans.power for presat  */
                d_c90,        /* power level for 13C pulses(pwc90=sqrt(15)/4delta
			      delta is the separation between Ca and Co */
                d_c180,	   /* power level for pwca180(sqrt(3)/2delta) */
                d_creb,	   /* power level for pwcareb */
                d_csed,       /* power level for pwcosed */
                sw1,          /* sweep width in f1                    */
                sw2,          /* sweep width in f2                    */
                pw_sl,        /* selective pulse on water      */
                tpwrsl,       /* power for pw_sl               */
                at,
                sphase,	   /* small angle phase shift  */
                sphase1,
                phase_sl,

                d_cacbdec,
                pwcacbdec,
                dres_dec,

                pwD,          /* PW90 for higher power (pwDlvl) deut 90 */
                pwDlvl,       /* high power for deut 90 hard pulse */

                compC,       /* C-13 RF calibration parameters */
                pwC,
                pwClvl,

                pwN,          /* PW90 for 15N pulse              */
                pwNlvl,       /* high dec2 pwr for 15N hard pulses    */

                gstab,

                gt1,
                gt2,
                gt3,
                gt4,
                gt5,
                gt6,
                gt7,
                gt8,
                gt9,
                gt10,

                gzlvl1,
                gzlvl2,
                gzlvl3,
                gzlvl4,
                gzlvl5,
                gzlvl6,
                gzlvl7,
                gzlvl8,
                gzlvl9,
                gzlvl10;

    /* LOAD VARIABLES */

    getstr("autocal",autocal);
    getstr("fsat",fsat);
    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("fc180",fc180);
    getstr("fscuba",fscuba);
    getstr("ddseq",ddseq);
    getstr("shp_sl",shp_sl);
    getstr("sel_flg",sel_flg);
    getstr("cacb_dec",cacb_dec);

    getstr("nietl_flg",nietl_flg);

    taua   = getval("taua");
    taub   = getval("taub");
    tauc   = getval("tauc");
    taud   = getval("taud");
    bigTN = getval("bigTN");
    pwN = getval("pwN");
    tpwr = getval("tpwr");
    tsatpwr = getval("tsatpwr");
    dpwr = getval("dpwr");
    pwNlvl = getval("pwNlvl");
    pwD = getval("pwD");
    pwDlvl = getval("pwDlvl");
    phase = (int) ( getval("phase") + 0.5);
    phase2 = (int) ( getval("phase2") + 0.5);
    sw1 = getval("sw1");
    sw2 = getval("sw2");
    ni = getval("ni");
    pw_sl = getval("pw_sl");
    tpwrsl = getval("tpwrsl");
    at = getval("at");
    sphase = getval("sphase");
    sphase1 = getval("sphase1");
    phase_sl = getval("phase_sl");

    gstab = getval("gstab");

    gt1 = getval("gt1");
    if (getval("gt2") > 0) gt2=getval("gt2");
    else gt2=gt1*0.1;
    gt3 = getval("gt3");
    gt4 = getval("gt4");
    gt5 = getval("gt5");
    gt6 = getval("gt6");
    gt7 = getval("gt7");
    gt8 = getval("gt8");
    gt9 = getval("gt9");
    gt10 = getval("gt10");

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


    if(autocal[0]=='n')
    {
        getstr("spcosed",spcosed);
        getstr("spcareb",spcareb);
        getstr("spca180",spca180);
        getstr("cacbdecseq",cacbdecseq);

        d_c90 = getval("d_c90");
        d_c180 = getval("d_c180");
        d_creb = getval("d_creb");
        d_csed = getval("d_csed");

        pwc90 = getval("pwc90");
        pwca180 = getval("pwca180");
        pwca180dec = getval("pwca180dec");
        pwcareb = getval("pwcareb");
        pwcosed = getval("pwcosed");

        d_cacbdec = getval("d_cacbdec");
        pwcacbdec = getval("pwcacbdec");
        dres_dec = getval("dres_dec");
    }
    else
    {
        strcpy(spcosed,"Phard_118p");
        strcpy(spcareb,"Preburp_-15p");
        strcpy(spca180,"Phard_-118p");
        strcpy(cacbdecseq,"Pcb_dec");
        if (FIRST_FID)
        {
            compC = getval("compC");
            pwC = getval("pwC");
            pwClvl = getval("pwClvl");
            co180 = pbox(spcosed, CO180, CA180ps, dfrq, compC*pwC, pwClvl);
            creb = pbox(spcareb, CREB180, CAB180ps, dfrq, compC*pwC, pwClvl);
            ca180 = pbox(spca180, CA180, CA180ps, dfrq, compC*pwC, pwClvl);
            cbdec = pbox(cacbdecseq, CBDEC,CBDECps, dfrq, compC*pwC, pwClvl);
            c90 = pbox("Phard90", C90, CA180ps, dfrq, compC*pwC, pwClvl);
        }
        d_c90 = c90.pwr;
        d_c180 = ca180.pwr;
        d_creb = creb.pwr;
        d_csed = co180.pwr;
        pwc90 = c90.pw;
        pwca180 = ca180.pw;
        pwca180dec = ca180.pw;
        pwcareb = creb.pw;
        pwcosed = co180.pw;

        d_cacbdec = cbdec.pwr;
        pwcacbdec = 1.0/cbdec.dmf;
        dres_dec = cbdec.dres;
    }

    /* LOAD PHASE TABLE */

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

    /* CHECK VALIDITY OF PARAMETER RANGES */

    if(ix==1)
        printf("Uses shared AT in the N dimension. Choose ni2 as desired\n");


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

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


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

    if( dpwr > -16 )
    {
        printf("DPWR too large!  ");
        psg_abort(1);
    }

    if( dpwr2 > -16 )
    {
        printf("DPWR2 too large!  ");
        psg_abort(1);
    }

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

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

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

    if(tpwrsl > 30) {
        printf("tpwrsl must be less than 25\n");
        psg_abort(1);
    }

    if( pwDlvl > 59) {
        printf("pwDlvl too high\n");
        psg_abort(1);
    }

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

    if( pw_sl > 10e-3) {
        printf("too long pw_sl\n");
        psg_abort(1);
    }

    if(d_cacbdec > 40) {
        printf("d_cacbdec is too high; < 41\n");
        psg_abort(1);
    }

    if(nietl_flg[A] == 'y' && sel_flg[A] == 'y') {
        printf("nietl_flg and sel_flg cannot both be y\n");
        psg_abort(1);
    }

    if (fc180[A] =='y' && ni > 1.0) {
        text_error("must set fc180='n' to allow C' evolution (ni>1)\n");
        psg_abort(1);
    }


    /*  Phase incrementation for hypercomplex 2D data */

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

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

    if (nietl_flg[A] == 'y') icosel = -1*icosel;

    /*  Set up f1180  tau2 = t1               */

    tau1 = d2;
    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1)
                  - 4.0/PI*pwc90 - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
                  - pwca180dec - WFG_STOP_DELAY - 2.0*pwN - POWER_DELAY
                  - 4.0e-6);
    }

    if(f1180[A] == 'n')
        tau1 = ( tau1
                 - 4.0/PI*pwc90 - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
                 - pwca180dec - WFG_STOP_DELAY - 2.0*pwN - POWER_DELAY
                 - 4.0e-6);

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

    /*  Set up f2180  tau2 = t2               */

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

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

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

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

    /* BEGIN ACTUAL PULSE SEQUENCE */

    status(A);
    obspower(tsatpwr);     /* Set transmitter power for 1H presaturation */
    decpower(d_c180);       /* Set Dec1 power to high power          */
    dec2power(pwNlvl);     /* Set Dec2 power for 15N hard pulses         */
    decoffset(dof);


    /* Presaturation Period */

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

    /* Begin Pulses */

    status(B);

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

    initval(1.0,v2);
    obsstepsize(phase_sl);
    xmtrphase(v2);

    /* shaped pulse */
    obspower(tpwrsl);
    shaped_pulse(shp_sl,pw_sl,one,4.0e-6,0.0);
    xmtrphase(zero);
    obspower(tpwr);
    txphase(zero);
    delay(4.0e-6);
    /* shaped pulse */

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

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

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

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

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

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

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

    if (sel_flg[A] == 'n')
    {
        rgpulse(pw,three,2.0e-6,0.0);

        decpower(d_c180);

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

        dec2rgpulse(pwN,zero,0.0,0.0);

        delay(tauc);

        dec2rgpulse(2*pwN,zero,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(one);

        delay(tauc - pwca180);

        dec2rgpulse(pwN,one,0.0,0.0);
    }
    else
    {
        rgpulse(pw,one,2.0e-6,0.0);

        decpower(d_c180);

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

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

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

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

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

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

        dec2rgpulse(2*pwN,zero,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(one);

        delay(tauc - pwca180);

        dec2rgpulse(pwN,one,0.0,0.0);
    }
    /* END sel_flg */

    decphase(t1);

    decpower(d_c90);

    delay(0.2e-6);
    zgradpulse(gzlvl8,gt8);
    delay(200.0e-6);

    /* Cay to CaxC'z  */
    dec2phase(zero);
    txphase(zero);

    /* Turn on D decoupling using the third decoupler */
    dec3phase(one);
    dec3power(pwDlvl);
    dec3rgpulse(pwD,one,4.0e-6,0.0);
    dec3phase(zero);
    dec3power(dpwr3);
    dec3unblank();
    setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
    /* Turn on D decoupling */

    if (cacb_dec[A] == 'n')
    {
        decrgpulse(pwc90,t1,2.0e-6,0.0);

        delay(taud -POWER_DELAY -4.0e-6 -WFG_START_DELAY);

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

        decpower(d_creb);
        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 2.0e-6);

        decpower(d_c90);
        decrgpulse(pwc90,one,2.0e-6,0.0);
    }
    else
    {
        decrgpulse(pwc90,t1,2.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

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

        decpower(d_creb);
        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY - 2.0e-6);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_c90);
        decrgpulse(pwc90,one,2.0e-6,0.0);
    }
    /* END cacb_dec */

    /* Turn off D decoupling */
    setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
    dec3blank();
    dec3phase(three);
    dec3power(pwDlvl);
    dec3rgpulse(pwD,three,4.0e-6,0.0);
    /* Turn off D decoupling */

    decoffset(dof+(174-56)*dfrq);   /* change Dec1 carrier to Co  */

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

    /*  t1 period for C' chemical shift evolution; Ca 180 and N 180 are used
        to decouple  */

    decrgpulse(pwc90,t2,2.0e-6,0.0);
    if (fc180[A]=='n')
    {
        decpower(d_c180);
        delay(tau1);
        decshaped_pulse(spca180,pwca180dec,zero,4.0e-6,0.0);
        dec2rgpulse(2*pwN,zero,0.0,0.0);
        delay(tau1);
        decpower(d_c90);
    }
    else
        decrgpulse(2*pwc90,zero,0.0,0.0);

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

    decoffset(dof);  /* set carrier to Ca */


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

    /*  Refocusing  CayC'z to Cax  */

    /* Turn on D decoupling using the third decoupler */
    dec3phase(one);
    dec3power(pwDlvl);
    dec3rgpulse(pwD,one,4.0e-6,0.0);
    dec3phase(zero);
    dec3power(dpwr3);
    dec3unblank();
    setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
    /* Turn on D decoupling */

    if (cacb_dec[A] == 'n')
    {
        decrgpulse(pwc90,zero,0.0e-6,0.0);

        delay(taud - POWER_DELAY
              - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        decpower(d_creb);
        initval(1.0,v4);
        decstepsize(sphase1);
        dcplrphase(v4);

        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6);

        decpower(d_c90);
        decrgpulse(pwc90,one,4.0e-6,0.0);
    }
    else
    {
        decrgpulse(pwc90,zero,0.0e-6,0.0);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6 - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY
              - POWER_DELAY - 4.0e-6 - WFG_START_DELAY);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_csed);
        decshaped_pulse(spcosed,pwcosed,zero,4.0e-6,0.0);

        decpower(d_creb);
        initval(1.0,v4);
        decstepsize(sphase1);
        dcplrphase(v4);

        decshaped_pulse(spcareb,pwcareb,zero,4.0e-6,0.0);
        dcplrphase(zero);

        /* CaCb dec on */
        decpower(d_cacbdec);
        decprgon(cacbdecseq,pwcacbdec,dres_dec);
        decon();
        /* CaCb dec on */

        delay(taud - WFG_STOP_DELAY
              - POWER_DELAY - PRG_START_DELAY
              - PRG_STOP_DELAY
              - POWER_DELAY
              - 4.0e-6);

        /* CaCb dec off */
        decoff();
        decprgoff();
        /* CaCb dec off */

        decpower(d_c90);
        decrgpulse(pwc90,one,4.0e-6,0.0);
    }
    /* END cacb_dec */

    /* Turn off D decoupling */
    setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
    dec3blank();
    dec3phase(three);
    dec3power(pwDlvl);
    dec3rgpulse(pwD,three,4.0e-6,0.0);
    /* Turn off D decoupling */

    decpower(d_c180);
    txphase(zero);

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

    /* Constant t2 period  */

    if (bigTN - tau2 >= 0.2e-6)
    {
        dec2rgpulse(pwN,t3,2.0e-6,0.0);

        dec2phase(t4);

        delay(bigTN - tau2 + pwca180);

        dec2rgpulse(2*pwN,t4,0.0,0.0);
        decrgpulse(pwca180,zero,0.0,0.0);
        dec2phase(t5);

        decpower(d_csed);

        delay(bigTN - gt1 - 502.0e-6 - 2.0*GRADIENT_DELAY - POWER_DELAY
              - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY);

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

        decshaped_pulse(spcosed,pwcosed,zero,0.0,0.0);

        delay(tau2);

        sim3pulse(pw,0.0e-6,pwN,zero,zero,t5,0.0,0.0);
    }
    else
    {
        dec2rgpulse(pwN,t3,2.0e-6,0.0);

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

        delay(tau2 - bigTN);
        decrgpulse(pwca180,zero,0.0,0.0);

        decpower(d_csed);

        delay(bigTN - pwca180 - POWER_DELAY
              - gt1 - 502.0e-6 - 2.0*GRADIENT_DELAY
              - WFG_START_DELAY - pwcosed - WFG_STOP_DELAY);

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

        decshaped_pulse(spcosed,pwcosed,zero,0.0,0.0);

        delay(tau2);

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

    if (nietl_flg[A] == 'n')
    {
        delay(0.2e-6);
        zgradpulse(gzlvl6,gt6);
        delay(2.0e-6);

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

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

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

        delay(taub - gt6 - 200.2e-6);
        txphase(one);
        dec2phase(one);

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

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

        txphase(zero);
        dec2phase(zero);

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

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

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

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

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

    }
    else
    {

        /* shaped pulse */
        obspower(tpwrsl);
        shaped_pulse(shp_sl,pw_sl,zero,4.0e-6,0.0);
        obspower(tpwr);
        txphase(zero);
        delay(4.0e-6);
        /* shaped pulse */

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

        dec2phase(zero);
        delay(taub - POWER_DELAY - 4.0e-6 - WFG_START_DELAY - pw_sl
              - WFG_STOP_DELAY - POWER_DELAY - 4.0e-6
              - gt6 - 2.2e-6);

        sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);
        txphase(one);
        dec2phase(zero);

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

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

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

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

        txphase(zero);
        dec2phase(zero);

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

        sim3pulse(2*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);
        txphase(one);
        dec2phase(one);

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

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

        sim3pulse(pw,0.0e-6,pwN,one,zero,one,0.0,0.0);
        txphase(zero);
    }

    delay(gt2 +gstab -0.5*(pwN -pw) -2.0*pw/PI);

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

    delay(2.0e-6);
    zgradpulse(icosel*gzlvl2, gt2);
    decpower(dpwr);
    dec2power(dpwr2);
    delay(gstab -2.0e-6 -2.0*GRADIENT_DELAY -2.0*POWER_DELAY);

    lk_sample();
    status(C);
    setreceiver(t6);

}
Пример #17
0
pulsesequence()
{

/* DECLARE VARIABLES */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  getstr("CChomodec",CChomodec);

  getstr("CCdseq",CCdseq);

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


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


/* INITIALIZE VARIABLES */

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

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

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

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

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

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

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

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

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




/* PHASES AND INCREMENTED TIMES */

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

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

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

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

/*  Set up f1180  */

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


        icosel=1;

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

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

        tau2 = tau2/2.0;

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGE */


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

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

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

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

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

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

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

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

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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

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

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

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

        delay(d1);
        rcvroff();

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

	delay(lambda);

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

	delay(lambda - SAPS_DELAY);

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

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

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

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


	decpwrf(4095.0);


	txphase(zero);
	decphase(zero);

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

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


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

        decphase(zero);
        decpwrf(rfd);

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

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

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

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


	decphase(t3);

        decpwrf(4095.0);

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

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


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

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

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

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

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


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

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

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

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

decphase(zero);
delay(tau2);

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

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

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

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

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


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

/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */

        decrgpulse(pwC, zero, 0.0, 0.0);

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

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

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

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

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

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

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

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

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

}

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

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

	decrgpulse(pwC,zero,0.0,0.0);

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

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

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

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

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

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

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

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

status(C);

 setreceiver(t11);
}
Пример #18
0
pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
            mag_flg[MAXSTR],      /* magic-angle coherence transfer gradients */
 	    TROSY[MAXSTR];			    /* To check for TROSY flag */
 
int         icosel,          			  /* used to get n and p type */
            t1_counter,  		        /* used for states tppi in t1 */
            t2_counter,  	 	        /* used for states tppi in t2 */
	    ni2 = getval("ni2");

double      p_d,
	    rfd,
	    ncyc,
	    COmix = getval("COmix"),
	    p_trim,
	    rftrim,
	    tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    kappa = 5.4e-3,
	    lambda = 2.4e-3,
            
	pwClvl = getval("pwClvl"), 	        /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
	rf0,            	  /* maximum fine power when using pwC pulses */
      bw, ofs, ppm,  /* bandwidth, offset, ppm - temporary Pbox parameters */

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

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

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

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

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

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

	gt1 = getval("gt1"),  		       /* coherence pathway gradients */
        gzcal  = getval("gzcal"),            /* g/cm to DAC conversion factor */
	gzlvl1 = getval("gzlvl1"),
	gzlvl2 = getval("gzlvl2"),

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

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



/*   LOAD PHASE TABLE    */

	settable(t3,2,phi3);
	settable(t4,1,phx);
	settable(t5,4,phi5);

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


/*   INITIALIZE VARIABLES   */

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

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

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

      if (autocal[0] == 'n') 
      {
    /* offC3 - 180 degree pulse on Ca, null at CO 118ppm away */
        pwC3a = getval("pwC3a");    
        rf3 = (compC*4095.0*pwC*2.0)/pwC3a;
	  rf3 = (int) (rf3 + 0.5);  
	
    /* 90 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */	
        pwC6 = getval("pwC6");    
	  rf6 = (compC*4095.0*pwC*1.69)/pwC6;	/* needs 1.69 times more     */
	  rf6 = (int) (rf6 + 0.5);		/* power than a square pulse */

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

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

    /* power level and pulse time for WALTZ 1H decoupling */
	  pwHd = 1/(4.0 * waltzB1) ;                          
	  tpwrd = tpwr - 20.0*log10(pwHd/(compH*pw));
	  tpwrd = (int) (tpwrd + 0.5);
      }
      else      /* if autocal = 'y'(yes), 'q'(quiet), 'r'(read) or 's'(semi) */
      {
        if(FIRST_FID)                                         /* make shapes */
        {
          ppm = getval("dfrq"); 
          bw = 118.0*ppm; ofs = -bw; 
          offC3 = pbox_make("offC3", "square180n", bw, ofs, compC*pwC, pwClvl);
          offC6 = pbox_make("offC6", "sinc90n", bw, 0.0, compC*pwC, pwClvl);
          offC8 = pbox_make("offC8", "sinc180n", bw, 0.0, compC*pwC, pwClvl);
          H2Osinc = pbox_Rsh("H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
          wz16 = pbox_Dcal("WALTZ16", 2.8*waltzB1, 0.0, compH*pw, tpwr);


          ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
        }
        pwC3a = offC3.pw; rf3 = offC3.pwrf;             /* set up parameters */
        pwC6 = offC6.pw; rf6 = offC6.pwrf; 
        pwC8 = offC8.pw; rf8 = offC8.pwrf;
        pwHs = H2Osinc.pw; tpwrs = H2Osinc.pwr-1.0;  /* 1dB correction applied */
        tpwrd = wz16.pwr; pwHd = 1.0/wz16.dmf;  
      }

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

    /* the pwC3 pulse at the middle of t1  */
	if ((ni2 > 0.0) && (ni == 1.0)) ni = 0.0;
        if (pwC3a > 2.0*pwN) pwZ = pwC3a; else pwZ = 2.0*pwN;
        if ((pwC3==0.0) && (pwC3a>2.0*pwN)) pwZ1=pwC3a-2.0*pwN; else pwZ1=0.0;
	if ( ni > 1 )     pwC3 = pwC3a;
	if ( pwC3 > 0 )   phshift3 = 48.0;
	else              phshift3 = 0.0;

 
   /* dipsi-3 decoupling on COCO */
        p_trim = 1/(4*5000*(sfrq/600.0));  /* 5 kHz trim pulse at 600MHz as per Bax */
        p_d = (5.0)/(9.0*4.0*2800.0*(sfrq/600.0)); /* 2.8 kHz DIPSI-3 at 600MHz as per Bax*/
        rftrim = (compC*4095.0*pwC)/p_trim;
        rftrim = (int)(rftrim+0.5);
        rfd = (compC*4095.0*pwC*5.0)/(p_d*9.0);
        rfd = (int) (rfd + 0.5);
        ncyc = ((COmix - 0.002)/51.8/4/p_d);
        ncyc = (int) (ncyc + 0.5);
        initval(ncyc,v9);


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

    if ( dpwr2 > 50 )
       { printf("dpwr2 too large! recheck value  "); psg_abort(1);}

    if ( pw > 50.0e-6 )
       { printf(" pw too long ! recheck value "); psg_abort(1);} 
  
    if ( (pwN > 100.0e-6) && (ni>1 || ni2>1))
       { printf(" pwN too long! recheck value "); psg_abort(1);} 
 
    if ( TROSY[A] == 'y')
      { printf(" TROSY option is not implemented"); psg_abort(1);}
      


/* PHASES AND INCREMENTED TIMES */

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

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


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


/*  Set up f2180  */

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


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

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

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



/* BEGIN PULSE SEQUENCE */

status(A);
   	delay(d1);
	rcvroff();
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rf0);
	obsoffset(tof);
	txphase(zero);
   	delay(1.0e-5);

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

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

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

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

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

 	rgpulse(pw, one, 0.0, 0.0);
    txphase(zero);
    
    obspower(tpwrs); 
    if (tpwrsf<4095.0) obspwrf(tpwrsf);
    shaped_pulse("H2Osinc", pwHs, zero, 5.0e-4, 0.0);
    obspower(tpwrd); 
    if (tpwrsf<4095.0) obspwrf(4095.0);
    zgradpulse(gzlvl3, gt3);
    delay(2.0e-4);
    dec2rgpulse(pwN, zero, 0.0, 0.0);

    txphase(one);
    delay(kappa - pwHd - 2.0e-6 - PRG_START_DELAY);

    rgpulse(pwHd,one,0.0,0.0);
    txphase(zero);
    delay(2.0e-6);
    obsprgon("waltz16", pwHd, 90.0);	          /* PRG_START_DELAY */
    xmtron();
    decphase(zero);
    dec2phase(zero);
    decpwrf(rf8);
    delay(timeTN - kappa - WFG3_START_DELAY);
   
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC8", "", 0.0, pwC8, 2.0*pwN, zero, zero, zero, 
								     0.0, 0.0);
	decphase(t3);
	decpwrf(rf6);
	delay(timeTN);

	dec2rgpulse(pwN, zero, 0.0, 0.0);

    xmtroff();
    obsprgoff();
    rgpulse(pwHd,three,2.0e-6,0.0);
	zgradpulse(gzlvl3, gt3);
 	delay(2.0e-4);
 /***************************************************************/
 /* The sequence is different from here with respect to ghn_co **/
 /***************************************************************/

    rgpulse(pwHd,one,2.0e-6,0.0);	/* H1 decoupler is turned on */
    txphase(zero);
    delay(2.0e-6);
    obsprgon("waltz16", pwHd, 90.0);	          
    xmtron();
    decshaped_pulse("offC6", pwC6, t3, 0.0, 0.0);
    decphase(zero);


	/* Refocus CO, evolve CO, spinlock CO and defocus CO  */


	delay(timeTN - tau1/2 - 0.6*pwC6 - WFG3_START_DELAY);
	decpwrf(rf8);
	sim3shaped_pulse("", "offC8","",0.0,pwC8, 2.0*pwN, zero,zero,zero,0.0,0.0);
	decpwrf(rf3);
	delay(timeTN - WFG3_STOP_DELAY - WFG_START_DELAY - pwC3a/2);
	decshaped_pulse("offC3",pwC3a,zero,0.0,0.0);
	if (tau1 > 0)
	delay(tau1/2 - WFG_STOP_DELAY - pwC3a/2 - 2.0e-6);
	else
	  delay(tau1/2);
	  
/*******DO SPINLOCK ********/

	decpwrf(rftrim);		
	decrgpulse(0.002,zero,2.0e-6,0.0);
	decpwrf(rfd);
	starthardloop(v9);
		decrgpulse(6.4*p_d,zero,0.0,0.0);
		decrgpulse(8.2*p_d,two,0.0,0.0);
		decrgpulse(5.8*p_d,zero,0.0,0.0);
		decrgpulse(5.7*p_d,two,0.0,0.0);
		decrgpulse(0.6*p_d,zero,0.0,0.0);
		decrgpulse(4.9*p_d,two,0.0,0.0);
		decrgpulse(7.5*p_d,zero,0.0,0.0);
		decrgpulse(5.3*p_d,two,0.0,0.0);
		decrgpulse(7.4*p_d,zero,0.0,0.0);
		
		decrgpulse(6.4*p_d,two,0.0,0.0);
		decrgpulse(8.2*p_d,zero,0.0,0.0);
		decrgpulse(5.8*p_d,two,0.0,0.0);
		decrgpulse(5.7*p_d,zero,0.0,0.0);
		decrgpulse(0.6*p_d,two,0.0,0.0);
		decrgpulse(4.9*p_d,zero,0.0,0.0);
		decrgpulse(7.5*p_d,two,0.0,0.0);
		decrgpulse(5.3*p_d,zero,0.0,0.0);
		decrgpulse(7.4*p_d,two,0.0,0.0);
		
		decrgpulse(6.4*p_d,two,0.0,0.0);
		decrgpulse(8.2*p_d,zero,0.0,0.0);
		decrgpulse(5.8*p_d,two,0.0,0.0);
		decrgpulse(5.7*p_d,zero,0.0,0.0);
		decrgpulse(0.6*p_d,two,0.0,0.0);
		decrgpulse(4.9*p_d,zero,0.0,0.0);
		decrgpulse(7.5*p_d,two,0.0,0.0);
		decrgpulse(5.3*p_d,zero,0.0,0.0);
		decrgpulse(7.4*p_d,two,0.0,0.0);
		
		decrgpulse(6.4*p_d,zero,0.0,0.0);
		decrgpulse(8.2*p_d,two,0.0,0.0);
		decrgpulse(5.8*p_d,zero,0.0,0.0);
		decrgpulse(5.7*p_d,two,0.0,0.0);
		decrgpulse(0.6*p_d,zero,0.0,0.0);
		decrgpulse(4.9*p_d,two,0.0,0.0);
		decrgpulse(7.5*p_d,zero,0.0,0.0);
		decrgpulse(5.3*p_d,two,0.0,0.0);
		decrgpulse(7.4*p_d,zero,0.0,0.0);
		
	endhardloop();
	decpwrf(4095.0);
	
/*   End of spinlock */

	delay(timeTN - WFG3_START_DELAY);
	decpwrf(rf8);
	sim3shaped_pulse("","offC8","",0.0,pwC8,2*pwN,zero,zero,zero,0.0,0.0);
	decpwrf(rf6);
	delay(timeTN - WFG3_STOP_DELAY);
	
 /***************************************************************/
 /*      The sequence is same as ghn_co from this point  ********/
 /***************************************************************/
 
	decshaped_pulse("offC6", pwC6, t5, 0.0, 0.0);


/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

	dec2phase(t8);
	zgradpulse(gzlvl4, gt4);
	txphase(one);
	dcplrphase(zero);
 	delay(2.0e-4);
	dec2rgpulse(pwN, t8, 0.0, 0.0);

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


    if (tau2 > kappa)
	{
          delay(timeTN - pwC3a - WFG_START_DELAY);     	   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
          delay(kappa - gt1 - 2.0*GRADIENT_DELAY - 1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else if (tau2 > (kappa - pwC3a - WFG_START_DELAY))
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);                                     /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(kappa -pwC3a -WFG_START_DELAY -gt1 -2.0*GRADIENT_DELAY -1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else if (tau2 > gt1 + 2.0*GRADIENT_DELAY + 1.0e-4)
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
          obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
          delay(kappa - tau2 - pwC3a - WFG_START_DELAY);   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
	}
    else
	{
          delay(timeTN + tau2 - kappa - PRG_STOP_DELAY - pwHd - 2.0e-6);
          xmtroff();
	  obsprgoff();					    /* PRG_STOP_DELAY */
	  rgpulse(pwHd,three,2.0e-6,0.0);
	  txphase(t4);
    	  delay(kappa-tau2-pwC3a-WFG_START_DELAY-gt1-2.0*GRADIENT_DELAY-1.0e-4);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else    zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwr);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                    /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3a, zero, 0.0, 0.0);
          delay(tau2);
	}
/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */
	sim3pulse(pw, 0.0, pwN, t4, zero, t10, 0.0, 0.0);

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

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

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

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

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

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

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

	rgpulse(pw, zero, 0.0, 0.0); 

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

	rgpulse(2.0*pw, zero, 0.0,0.0);
	dec2power(dpwr2);				       /* POWER_DELAY */
        if (mag_flg[A] == 'y')    magradpulse(icosel*gzcal*gzlvl2, gt1/10.0);
        else   zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */
        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4);

	setreceiver(t12);
}		 
Пример #19
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          SE_flg[MAXSTR];

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


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



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

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

/*   INITIALIZE VARIABLES   */

  Delta = timeTN-tauNCO;

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



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

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



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

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

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

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

  
    


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

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



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

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

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

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

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

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


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

           delay(timeTN);

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

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

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

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

           zgradpulse(gzlvl4, gt4);

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

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


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

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

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

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

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

           zgradpulse(gzlvl3, gt3*2.0);

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

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

/*      dcplrphase(v2); */

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

   obspower(shlvl1);

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

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


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

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

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

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

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

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

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

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

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


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

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

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

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

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

}		 
Пример #20
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          SE_flg[MAXSTR],
          href_flg[MAXSTR];    

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


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

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



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

/*   INITIALIZE VARIABLES   */

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


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



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

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

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

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

  
    


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

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



   status(A);
      rcvroff();  

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


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

       delay(d1-gt6);
lk_hold();

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

}		 
Пример #21
0
pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          n15_flg[MAXSTR],
          CT_flg[MAXSTR];


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


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



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



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


/*   INITIALIZE VARIABLES   */
   kappa = 5.4e-3;
   //shpw1 = pw*8.0;
   shlvl1 = tpwr;
   f1180[0] ='n'; 
   f2180[0] ='n'; 

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



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

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


/*  Set up f1180  */

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


/*  Set up f2180  */

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

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

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

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


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

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

/************************************************************/
   if (ni > 1)
   {
   halfT1 = 0.5*(ni-1)/sw1;
   t1b = (double) t1_counter*((halfT1 - timeTN1)/((double)(ni-1)));
    if(t1b < 0.0) t1b = 0.0;
    t1a = timeTN1 - tau1*0.5 + t1b;
    if(t1a < 0.2e-6)  t1a = 0.0;
    }
    else
    {
    t1b = 0.0;
    t1a = timeTN1 - tau1*0.5;
    }
/************************************************************/


   status(A);
      rcvroff();  

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


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

lk_sample();
       delay(d1-gt4);
lk_hold();
        h_shapedpulse("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);

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

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

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

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

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

           zgradpulse(2.3*gzlvl4, gt4);
           delay(1.0e-4);
/**************************************************************************/
/***         N -> CO transfer             *********************************/
/**************************************************************************/
      dec2rgpulse(pwN,t1,0.0,0.0);

           delay(tau1*0.5);
         c13pulse("ca", "co", "square", 180.0, zero, 0.0, 0.0);
         delay(taunh-pwS3);
         shaped_pulse(shname1,shpw1,two,0.0,0.0);
         delay(timeTN1-pwS2-taunh-shpw1);
        c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);
        delay (t1b);
        dec2rgpulse (2.0*pwN, zero, 0.0, 0.0);
        delay (t1a);

     dec2rgpulse(pwN,zero,0.0,0.0);
/**************************************************************************/
/***        CO -> CA transfer             *********************************/
/**************************************************************************/
        c13pulse("co", "ca", "sinc", 90.0, t2, 2.0e-6, 0.0);

        zgradpulse(-gzlvl4, gt4);
        decphase(zero);
        delay(tauC - gt4 - 0.5*10.933*pwC);

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

        zgradpulse(-gzlvl4, gt4);
        decphase(one);
        delay(tauC - gt4 - 0.5*10.933*pwC - WFG_START_DELAY - 2.0e-6);
        c13pulse("co", "ca", "sinc", 90.0, one, 0.0, 0.0);
/**************************************************************************/
/***        CA -> N transfer             *********************************/
/**************************************************************************/
        set_c13offset("ca");

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


/**************************************************************************/
/***        N -> CA back transfer         *********************************/
/**************************************************************************/
     dec2rgpulse(pwN,t4,0.0,0.0);

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

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

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

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

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

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

     dec2rgpulse(pwN,one,0.0,0.0);
        zgradpulse(gzlvl6, gt6);

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

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

        delay(lambda-pwS6*0.5-gt6);
     dec2rgpulse(pwN,t5,0.0,0.0);
/**************************************************************************/

        zgradpulse(-icosel*gzlvl2, gt1/10.0);
        dec2power(dpwr2);                                      /* POWER_DELAY */
lk_sample();
 if (n15_flg[0] =='y')
{
   setreceiver(t14);
}
else
{
   setreceiver(t24);
}

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

}		 
Пример #22
0
pulsesequence()
{

   double	   gtE = getval("gtE"),
		   gzlvlE=getval("gzlvlE"),
		   selpwrPS = getval("selpwrPS"),
		   selpwPS = getval("selpwPS"),
		   gzlvlPS = getval("gzlvlPS"),
		   droppts=getval("droppts"),
		   gstab = getval("gstab");
   char		   selshapePS[MAXSTR];

//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gtE = syncGradTime("gtE","gzlvlE",1.0);
        gzlvlE = syncGradLvl("gtE","gzlvlE",1.0);

   getstr("selshapePS",selshapePS);

   settable(t1,4,ph1);
   settable(t2,32,ph2);
   settable(t3,8,ph3);
   settable(t4,16,ph4);

   getelem(t1,ct,v1);
   getelem(t2,ct,v2);
   getelem(t3,ct,v3);
   getelem(t4,ct,v4);
   assign(v4,oph);

   assign(v1,v6);

/* BEGIN THE ACTUAL PULSE SEQUENCE */
   status(A);
      obspower(tpwr);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        satpulse(satdly,v6,rof1,rof1);
     }
   else
        delay(d1);

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


   status(B);
      obspower(tpwr);
      rgpulse(pw, v1, rof1, rof2);

	delay(d2/2.0);

	delay((0.25/sw1) - gtE - gstab - 2*pw/PI - rof2 - 2*GRADIENT_DELAY);
	zgradpulse(gzlvlE,gtE);
	delay(gstab);
	rgpulse(2*pw,v2,rof1,rof1);
	delay(0.25/sw1);

	delay(gstab);
	zgradpulse(-1.0*gzlvlE,gtE);
	delay(gstab);
	obspower(selpwrPS);
	rgradient('z',gzlvlPS);
	shaped_pulse(selshapePS,selpwPS,v3,rof1,rof1);
	rgradient('z',0.0);
	obspower(tpwr);
	delay(gstab);
	zgradpulse(-2.0*gzlvlE,gtE);
	delay(gstab - droppts/sw);

	delay(d2/2.0);

   status(C);
}
Пример #23
0
pulsesequence()

{

/* DECLARE VARIABLES */

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            ddseq[MAXSTR],    /* deuterium decoupling sequence */
            shp_sl[MAXSTR],

            shcreb[MAXSTR],  /* reburp shape for center of t1 period */
            shcgcob[MAXSTR], /* g3 inversion at 154 ppm (350 us) */
            shcgcoib[MAXSTR],  /* g3 time inversion at 154 ppm (350 us) */
            shca180[MAXSTR],   /* Ca 180 [D/sq(3)] during 15N CT */
            shco180[MAXSTR],   /* Co 180 [D/sq(15)] during 15N CT */
            sel_flg[MAXSTR],   /* active/passive purging of undesired 
                                  component  */ 
            fCT[MAXSTR],	       /* Flag for constant time C13 evolution */
            fc180[MAXSTR],
            cal_sphase[MAXSTR],
            shared_CT[MAXSTR],
            nietl_flg[MAXSTR];

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

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             del1,       /* time for C'-N to refocus set to 0.5*24.0 ms */
             bigTN,        /* nitrogen T period */
             bigTC,        /* carbon T period */
             zeta,         /* delay for transfer from ca to cb = 3.5 ms */
             tsatpwr,      /* low level 1H trans.power for presat  */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             tauf,         /* 1/2J NH value                     */
             pw_sl,        /* selective pulse on water      */
             phase_sl,     /* phase on water      */
             tpwrsl,       /* power for pw_sl               */
             at,

             d_cgcob,     /* power level for g3 pulses at 154 ppm */
             d_creb,      /* power level for reburp 180 at center of t1 */
             pwcgcob,     /* g3 ~ 35o us 180 pulse */
             pwcreb,      /* reburp ~ 400us 180 pulse */ 
 
             pwD,        /* 2H 90 pulse, about 125 us */
             pwDlvl,        /* 2H 90 pulse, about 125 us */

             pwca180,     /* Ca 180 during N CT at d_ca180 */
             pwco180,     /* Co 180 during N CT at d_co180 */

             d_ca180,
             d_co180,

             compC = getval("compC"),	/* C-13 RF calibration parameters */
             pwC = getval("pwC"),
             pwClvl = getval("pwClvl"),

             pwN,
             pwNlvl,

             sphase,

             pw_sl1,
             tpwrsl1,

             gstab,

             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gt9,
             gt11,
             gt13,
             gt14,

             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8,
             gzlvl9,
             gzlvl11,
             gzlvl13,
             gzlvl14;
            
/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */


  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("fscuba",fscuba);
  getstr("ddseq",ddseq);
  getstr("shp_sl",shp_sl);

  getstr("sel_flg",sel_flg);
  
  getstr("fCT",fCT);
  getstr("fc180",fc180);
  getstr("cal_sphase",cal_sphase);

  getstr("shared_CT",shared_CT);

  getstr("nietl_flg",nietl_flg);

  taua   = getval("taua"); 
  del1  = getval("del1");
  bigTN = getval("bigTN");
  bigTC = getval("bigTC");
  zeta = getval("zeta");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  pwD = getval("pwD");
  pwDlvl = getval("pwDlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni2 = getval("ni2");
  tauf = getval("tauf");
  pw_sl = getval("pw_sl");
  phase_sl = getval("phase_sl");
  tpwrsl = getval("tpwrsl");
  at = getval("at");

  sphase = getval("sphase");

  pw_sl1 = getval("pw_sl1");
  tpwrsl1 = getval("tpwrsl1");

  gstab = getval("gstab");

  gt1 = getval("gt1");
  if (getval("gt2") > 0) gt2=getval("gt2");
    else gt2=gt1*0.1;
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt8 = getval("gt8");
  gt9 = getval("gt9");
  gt11 = getval("gt11");
  gt13 = getval("gt13");
  gt14 = getval("gt14");

  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");
  gzlvl11 = getval("gzlvl11");
  gzlvl13 = getval("gzlvl13");
  gzlvl14 = getval("gzlvl14");

  if(autocal[0]=='n')
  {     
    getstr("shcgcob",shcgcob);
    getstr("shcgcoib",shcgcoib);
    getstr("shcreb",shcreb);
    getstr("shca180",shca180);
    getstr("shco180",shco180);
    
    d_ca180 = getval("d_ca180");
    d_co180 = getval("d_co180");
    d_cgcob = getval("d_cgcob");
    d_creb = getval("d_creb");
    pwca180 = getval("pwca180");
    pwco180 = getval("pwco180");
    pwcgcob = getval("pwcgcob");
    pwcreb = getval("pwcreb");
  }
  else
  {        
    strcpy(shcgcob,"Pg3_107p");    
    strcpy(shcgcoib,"Pg3i_107p");    
    strcpy(shcreb,"Preb_on");    
    strcpy(shca180,"Phard_15p");    
    strcpy(shco180,"Phard_133p");    
    if (FIRST_FID)  
    {
      cgcob = pbox(shcgcob, G3CGCOB, CAB180ps, dfrq, compC*pwC, pwClvl);
      cgcoib = pbox(shcgcoib, G3CGCOBi, CAB180ps, dfrq, compC*pwC, pwClvl);  
      creb = pbox(shcreb, CREB180, CAB180ps, dfrq, compC*pwC, pwClvl);      
      ca180 = pbox(shca180, CA180, CA180ps, dfrq, compC*pwC, pwClvl);        
      co180 = pbox(shco180, CO180, CA180ps, dfrq, compC*pwC, pwClvl);  
    }   
    d_ca180 = ca180.pwr;
    d_co180 = co180.pwr;
    d_cgcob = cgcob.pwr;
    d_creb = creb.pwr;
    pwca180 = ca180.pw;
    pwco180 = co180.pw;
    pwcgcob = cgcob.pw;
    pwcreb = creb.pw;
  }   

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

   if(shared_CT[A] == 'n')
    if(bigTN - 0.5*(ni2 -1)/sw2 - POWER_DELAY < 0.2e-6)
    {
        text_error(" ni2 is too big\n");
        text_error(" please set ni2 smaller or equal to %d\n",
    			(int) ((bigTN -POWER_DELAY)*sw2*2.0) +1 );
        psg_abort(1);
    }

   if(fCT[A] == 'y')
    if(bigTC - 0.5*(ni-1)/sw1 - WFG_STOP_DELAY - gt14 - 102.0e-6
        - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        - POWER_DELAY - WFG_START_DELAY - 4.0e-6 - pwcgcob - WFG_STOP_DELAY
        - POWER_DELAY - 4.0e-6 < 0.2e-6) {

          text_error("ni is too big\n");
          text_error(" please set ni smaller or equal to %d\n",
    			(int) ((bigTC - WFG_STOP_DELAY - gt14 - 102.0e-6
        			- POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        			- POWER_DELAY - WFG_START_DELAY - 4.0e-6 - pwcgcob - WFG_STOP_DELAY
        			- POWER_DELAY - 4.0e-6)*sw1*2.0) +1 );
          psg_abort(1);
    }

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

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

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

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

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

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

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

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

    if( f1180[A] != 'n' && f2180[A] != 'n' ) {
        text_error("flags may be set wrong: set f1180=n and f2180=n for 3d\n");
        psg_abort(1);
    }

    if(d_ca180 > 58) 
    {
        text_error("dont fry the probe, d_ca180 too high ! ");
        psg_abort(1);
    }

    if(d_co180 > 58) 
    {
        text_error("dont fry the probe, d_ca180 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 
        || gt11 > 15e-3 || gt13 > 15e-3  
        || gt14 > 15e-3)
    {
       text_error("gti values must be < 15e-3\n");
       psg_abort(1);
    } 

    if(tpwrsl > 25) {
       text_error("tpwrsl must be less than 25\n");
       psg_abort(1);
    }

    if(tpwrsl1 > 25) {
       text_error("tpwrsl1 must be less than 25\n");
       psg_abort(1);
    }

    if( dpwr3 > 50) {
       text_error("dpwr3 too high\n");
       psg_abort(1);
    }
    if( del1 > 0.1 ) {
       text_error("too long del1\n");
       psg_abort(1);
    }
    if( zeta > 0.1 ) {
       text_error("too long zeta\n");
       psg_abort(1);
    }
    if( bigTN > 0.1) {
       text_error("too long bigTN\n");
       psg_abort(1);
    }
    if( bigTC > 0.1) {
       text_error("too long bigTC\n");
       psg_abort(1);
    }
    if( pw_sl > 10e-3) {
       text_error("too long pw_sl\n");
       psg_abort(1);
    }
    if( pw_sl1 > 10e-3) {
       text_error("too long pw_sl1\n");
       psg_abort(1);
    }
    if( at > 0.1 && dm2[D] == 'y') {
       text_error("too long at with dec2\n");
       psg_abort(1);
    }

    if(pwDlvl > 59) {
        text_error("pwDlvl is too high; <= 59\n");
        psg_abort(1);
    }

    if(d_creb > 62) {
        text_error("d_creb is too high; <= 62\n");
        psg_abort(1);
    }

    if(d_cgcob > 60) {
        text_error("d_cgcob is too high; <=60\n");
        psg_abort(1);
    }

    if(cal_sphase[A] == 'y') {
      text_error("Use only to calibrate sphase\n");
      text_error("Set zeta to 600 us, gt11=gt13=0, fCT=y, fc180=n\n");
    }

    if(nietl_flg[A] == 'y' && sel_flg[A] == 'y') {
       text_error("Both nietl_flg and sel_flg cannot by y\n");
       psg_abort(1);
    }

    if (fCT[A] == 'n' && fc180[A] =='y' && ni > 1.0) {
       text_error("must set fc180='n' to allow Calfa/Cbeta evolution (ni>1)\n");
       psg_abort(1);
   }


/*  Phase incrementation for hypercomplex 2D data */

    /* changed from 1 to 3; spect. rev. not needed */
    if (phase == 2) { tsadd(t2,3,4); tsadd(t3,3,4); }

    if (shared_CT[A] == 'n') 
      {
       if (phase2 == 2) { tsadd(t7,2,4); icosel = 1; }
         else icosel = -1;
      }
     else 
      {
       if (phase2 == 2) { tsadd(t7,2,4); icosel = -1; }
         else icosel = 1;
      }

    if (nietl_flg[A] == 'y') icosel = -1*icosel;

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

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

/*  Set up f1180  tau1 = t1         */

      tau1 = d2;
      if(f1180[A] == 'y' && fCT[A] == 'y') 
          tau1 += ( 1.0 / (2.0*sw1) );

      if(f1180[A] == 'y' && fCT[A] == 'n') 
          tau1 += (1.0 / (2.0*sw1) - 4.0/PI*pwC - POWER_DELAY
                    - 4.0e-6);

      if(f1180[A] == 'n' && fCT[A] == 'n') 
          tau1 = (tau1 - 4.0/PI*pwC - POWER_DELAY
                    - 4.0e-6);

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

/*  Set up f2180  tau2 = t2         */

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tsatpwr);     /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);      /* Set Dec1 power to high power          */
   dec2power(pwNlvl);     /* Set Dec2 power for 15N hard pulses         */
   dec3power(pwDlvl);     /* Set Dec3 for 2H hard pulses */

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

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

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

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

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

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

   dec2phase(t1); decphase(zero); 

   delay(taua - gt5 - 200.2e-6); 

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

   if (sel_flg[A] == 'y') 
     {
      rgpulse(pw,one,4.0e-6,0.0);

      initval(1.0,v2);
      obsstepsize(phase_sl);
      xmtrphase(v2);

      /* shaped pulse */
      obspower(tpwrsl);
      shaped_pulse(shp_sl,pw_sl,two,2.0e-6,0.0);
      xmtrphase(zero);
      delay(2.0e-6);
      obspower(tpwr);
      /* shaped pulse */

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

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

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

      delay(1.34e-3 - SAPS_DELAY);
   
      rgpulse(pw,zero,0.0,0.0);
      rgpulse(2.0*pw,one,2.0e-6,0.0);
      rgpulse(pw,zero,2.0e-6,0.0);

      decpower(d_ca180);

        dec2phase(zero);
   
        delay(del1 - 1.34e-3 - 4.0*pw - 4.0e-6 
              - POWER_DELAY + WFG_START_DELAY + pwca180 + WFG_STOP_DELAY);
     }
    else  
     {
      rgpulse(pw,three,4.0e-6,0.0);

      initval(1.0,v2);
      obsstepsize(phase_sl);
      xmtrphase(v2);
   
      /* shaped pulse */
      obspower(tpwrsl);
      shaped_pulse(shp_sl,pw_sl,zero,2.0e-6,0.0);
      xmtrphase(zero);
      delay(2.0e-6);
      obspower(tpwr);
      /* shaped pulse */
   
      delay(0.2e-6);
      zgradpulse(gzlvl3,gt3);
      delay(200.0e-6);

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

      decpower(d_ca180);

      delay(del1 - POWER_DELAY + WFG_START_DELAY
      		+ pwca180 + WFG_STOP_DELAY);
     }

   decphase(zero);
   dec2rgpulse(2*pwN,zero,0.0,0.0);
   decshaped_pulse(shca180,pwca180,zero,0.0,0.0);

   dec2phase(one);

   delay(del1);

   dec2rgpulse(pwN,one,0.0,0.0);

   decpower(pwClvl);

   decphase(t2); 

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

   dec2phase(t5); 

   /* Turn on D decoupling using the third decoupler */
   dec3phase(one);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3power(dpwr3);
   dec3unblank();
   setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
   /* Turn on D decoupling */

   decrgpulse(pwC,t2,0.0,0.0);

   delay(zeta
	- PRG_STOP_DELAY - DELAY_BLANK - POWER_DELAY - 4.0e-6
        - pwD
        - gt11 - 102.0e-6 - POWER_DELAY - WFG_START_DELAY); 
      
   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank(); 
   dec3phase(three);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

    decphase(zero);

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

   if (cal_sphase[A] == 'y') 
     {
      decpower(pwClvl);
      decshaped_pulse("hard",2.0*pwC,zero,4.0e-6,4.0e-6);
     }
    else 
     {
      initval(1.0,v3);
      decstepsize(sphase);
      dcplrphase(v3);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
     }

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

   /* Turn on D decoupling using the third decoupler */
   dec3phase(one);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3power(dpwr3);
   dec3unblank();
   setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
   /* Turn on D decoupling */

   delay(zeta - WFG_STOP_DELAY - gt11 - 102.0e-6 
	- POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        - DELAY_BLANK - POWER_DELAY - 4.0e-6);

   decpower(pwClvl);
   decrgpulse(pwC,t3,4.0e-6,0.0);

   if (fCT[A] == 'y') 
     {
      delay(tau1);

      decpower(d_cgcob);
      decshaped_pulse(shcgcob,pwcgcob,zero,4.0e-6,0.0);

      delay(bigTC - POWER_DELAY - WFG_START_DELAY - 4.0e-6
            - pwcgcob - WFG_STOP_DELAY 
            - 102.0e-6 - gt14 
            - PRG_STOP_DELAY - DELAY_BLANK
            - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - WFG_START_DELAY);
 
      /* Turn off D decoupling */
      setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
      dec3blank();
      dec3phase(three);
      dec3power(pwDlvl);
      dec3rgpulse(pwD,three,4.0e-6,0.0);
      /* Turn off D decoupling */

      delay(2.0e-6);
      zgradpulse(gzlvl14,gt14);
      delay(100.0e-6);

      initval(1.0,v4);
      decstepsize(sphase);
      dcplrphase(v4);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
    
      delay(2.0e-6);
      zgradpulse(gzlvl14,gt14);
      delay(100.0e-6);

      /* Turn on D decoupling using the third decoupler */
      dec3phase(one);
      dec3power(pwDlvl);
      dec3rgpulse(pwD,one,4.0e-6,0.0);
      dec3phase(zero);
      dec3power(dpwr3);
      dec3unblank(); 
      setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
      /* Turn on D decoupling */


      delay(bigTC - tau1 - WFG_STOP_DELAY - gt14
            - 102.0e-6 - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY
            - PRG_START_DELAY - POWER_DELAY - WFG_START_DELAY
            - 4.0e-6 - pwcgcob - WFG_STOP_DELAY - POWER_DELAY 
            - 4.0e-6);

      decpower(d_cgcob);
      decshaped_pulse(shcgcoib,pwcgcob,zero,4.0e-6,0.0);
      decphase(t4);
     }
    else if(fCT[A] == 'n' && fc180[A] == 'n') 
     {
      delay(tau1);
      delay(tau1);
     }
    else if(fCT[A] == 'n' && fc180[A] == 'y') 
     {
      initval(1.0,v4);
      decstepsize(sphase);
      dcplrphase(v4);

      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,0.0);

      dcplrphase(zero);
     }

   decpower(pwClvl);
   decrgpulse(pwC,t4,4.0e-6,0.0);

   delay(zeta - POWER_DELAY - 4.0e-6
          - pwD - PRG_STOP_DELAY - DELAY_BLANK
          - gt13
          - 102.0e-6 - POWER_DELAY - WFG_START_DELAY); 

   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank(); 
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

   delay(2.0e-6);
   zgradpulse(gzlvl13,gt13);
   delay(100.0e-6);

   if (cal_sphase[A] == 'y') 
     {
      decpower(pwClvl);
      decshaped_pulse("hard",2.0*pwC,zero,4.0e-6,4.0e-6);
     }
    else 
     {
      initval(1.0,v5);
      decstepsize(sphase);
      dcplrphase(v5);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
     }

   delay(2.0e-6);
   zgradpulse(gzlvl13,gt13);
   delay(100.0e-6);

   /* Turn on D decoupling using the third decoupler */
   dec3phase(one);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,one,4.0e-6,0.0);
   dec3phase(zero);
   dec3power(dpwr3);
   dec3unblank();
   setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
   /* Turn on D decoupling */


   delay(zeta - WFG_STOP_DELAY - gt13 - 102.0e-6  
        - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY
        - PRG_START_DELAY - DELAY_BLANK
        - POWER_DELAY - 4.0e-6);

   decpower(pwClvl);
   decrgpulse(pwC,zero,4.0e-6,0.0);

   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank();
   dec3phase(three);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

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

   if (shared_CT[A] == 'n') 
     {
      dec2rgpulse(pwN,t5,2.0e-6,0.0);

      decpower(d_ca180);

      dec2phase(t6); 

      delay(bigTN - tau2 - POWER_DELAY);

      dec2rgpulse(2*pwN,t6,0.0,0.0);
      decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
      dec2phase(t7);

      delay(bigTN - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY
            - gt1 - 2.0*GRADIENT_DELAY - 500.2e-6 
            - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
            - pwco180 - WFG_STOP_DELAY);

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

      decpower(d_co180);
      decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);

      delay(tau2);
   
      sim3pulse(pw,0.0,pwN,zero,zero,t7,0.0,0.0);
     }
    else if (shared_CT[A] == 'y') 
     {
      dec2rgpulse(pwN,t5,2.0e-6,0.0);

      decpower(d_co180);
      dec2phase(t6); 

      if (bigTN - tau2 >= 0.2e-6) 
        {
         delay(tau2);

         decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);
         decpower(d_ca180);

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

         delay(bigTN - 4.0e-6 - WFG_START_DELAY - pwco180 - WFG_STOP_DELAY
               - POWER_DELAY - gt1 - 500.2e-6 - 2.0*GRADIENT_DELAY
               - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY);

         decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
         dec2rgpulse(2*pwN,t6,0.0,0.0);

         delay(bigTN - tau2);
        }
       else 
        {
         delay(tau2);
         decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);

         delay(0.2e-6);
         zgradpulse(gzlvl1,gt1);
         delay(500.0e-6);
     
         decpower(d_ca180);
         delay(bigTN - 4.0e-6 - WFG_START_DELAY - pwco180
               - WFG_STOP_DELAY - gt1 - 500.2e-6 - 2.0*GRADIENT_DELAY
               - POWER_DELAY - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY); 
   
         decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
    
         delay(tau2 - bigTN);
         dec2rgpulse(2.0*pwN,t6,0.0,0.0);
        }
      sim3pulse(pw,0.0,pwN,zero,zero,t7,0.0,0.0);
     }
/* end of shared_CT */

   if (nietl_flg[A] == 'n') 
     {
      decpower(pwClvl);
      decrgpulse(pwC,zero,4.0e-6,0.0);

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

      dec2phase(zero);
      delay(tauf - POWER_DELAY - 4.0e-6 
                 - pwC - gt6 - 2.2e-6);

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

      txphase(one);
      dec2phase(one);
   
      delay(tauf - gt6 - 200.2e-6);

      delay(0.2e-6);
      zgradpulse(gzlvl6,gt6);
      delay(200.0e-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(tauf - gt7 - 2.2e-6);

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

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

      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(200.0e-6);
   
      sim3pulse(pw,0.0e-6,pwN,zero,zero,zero,0.0,0.0);
     }
    else  
     {   /* nietl_flg == y */
      /* shaped pulse */
      obspower(tpwrsl1);
      shaped_pulse(shp_sl,pw_sl1,zero,2.0e-6,0.0);
      delay(2.0e-6);
      obspower(tpwr);
      /* shaped pulse */

      decpower(pwClvl);
      decrgpulse(pwC,zero,4.0e-6,0.0);

      delay(0.2e-6);
      zgradpulse(gzlvl6,gt6);
      delay(2.0e-6);
   
      dec2phase(zero);
      delay(tauf 
                 - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
                 - pw_sl1 - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY
                 - POWER_DELAY - 4.0e-6 
                 - pwC - gt6 - 2.2e-6);

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

      txphase(one);
      dec2phase(zero);

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

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

      sim3pulse(pw,0.0,pwN,one,zero,zero,0.0,0.0);
   
      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(2.0e-6);
 
      txphase(zero);
      dec2phase(zero);
      delay(tauf - gt7 - 2.2e-6);

      sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,0.0,0.0);
      txphase(one);
      dec2phase(one);
   
      delay(tauf - gt7 - 200.2e-6);

      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(200.0e-6);
   
      sim3pulse(pw,0.0e-6,pwN,one,zero,one,0.0,0.0);
      txphase(zero);
     }  /* end of nietl_flg == y  */

   delay(gt2 +gstab -0.5*(pwN-pw) -2.0*pw/PI);

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

   delay(2.0e-6);
   zgradpulse(icosel*gzlvl2,gt2);
   decpower(dpwr);    /* NO  13C decoupling */
   dec2power(dpwr2);  /* NO  15N decoupling */
   delay(gstab -2.0e-6 -2.0*GRADIENT_DELAY -2.0*POWER_DELAY);

   lk_sample();
/* BEGIN ACQUISITION */
status(C);
   setreceiver(t8);

}
Пример #24
0
pulsesequence ()
{
double  gstab = getval("gstab"),
	gt1 = getval("gt1"),
	gzlvl1 = getval("gzlvl1"),
        gt2 = getval("gt2"),
        gzlvl2 = getval("gzlvl2"),
        mix = getval("mix"),
        wrefpw = getval("wrefpw"),
        wrefpwr = getval("wrefpwr"),
        wrefpwrf = getval("wrefpwrf"),
        phincr1 = getval("phincr1"),
        flippwr = getval("flippwr"),
        flippwrf = getval("flippwrf"),
        flippw = getval("flippw"),
        trimpwr = getval("trimpwr"),
        gt0 = getval("gt0"),
        gzlvl0 = getval("gzlvl0"),
	trim = getval("trim"),
        h1freq_local = getval("h1freq_local"),
        gcal_local = getval("gcal_local"),
        coil_size = getval("coil_size"),
        zqpw=getval("zqpw"),
        zqpwr=getval("zqpwr"),
        swfactor = 9.0,    /* do the adiabatic sweep over 9.0*sw  */
        gzlvlzq,invsw;
	
int	iphase = (int) (getval("phase") + 0.5);
char    sspul[MAXSTR], trim_flg[MAXSTR], wrefshape[MAXSTR],flipback[MAXSTR], 
        zqshape[MAXSTR],
	zqflg[MAXSTR], alt_grd[MAXSTR],flipshape[MAXSTR];
        
  getstr("sspul", sspul);
  getstr("trim_flg", trim_flg);
  getstr("wrefshape", wrefshape);
  getstr("flipshape", flipshape);
  getstr("flipback", flipback);
  getstr("zqshape", zqshape);
  getstr("zqflg", zqflg);
  getstr("alt_grd",alt_grd);
  rof1 = getval("rof1"); if(rof1 > 2.0e-6) rof1=2.0e-6;
   if (phincr1 < 0.0) phincr1=360+phincr1;
   initval(phincr1,v13);

  if (coil_size == 0) coil_size=16;
  invsw = sw*swfactor;
  if (invsw > 60000.0) invsw = 60000.0; /* do not exceed 60 kHz */
  invsw = invsw/0.97;     /* correct for end effects of the cawurst-20 shape */

  if ((zqflg[0] == 'y') && (mix < 0.051))
   {
     printf("Mixing time should be more than 51 ms for zero quantum suppression\n");
     psg_abort(1);
   }

  gzlvlzq=(invsw*h1freq_local*2349)/(gcal_local*coil_size*sfrq*1e+6);

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

  sub(ct,ssctr,v12);

  getelem(t1,v12,v1);
  getelem(t2,v12,v2);
  getelem(t3,v12,v3);
  getelem(t4,v12,v4);
  getelem(t5,v12,v5);
  getelem(t6,v12,oph);
  getelem(t7,v12,v7);
  getelem(t8,v12,v8);
  getelem(t9,v12,v6);
  if (zqflg[0] == 'y') add(oph,two,oph);
  mod2(ct,v10);        /*changing gradient sign on even transitents */

  if (iphase == 2) 
   { incr(v1); incr(v6); }
/* HYPERCOMPLEX MODE USES REDFIELD TRICK TO MOVE AXIAL PEAKS TO EDGE */
   initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v9);
   if ((iphase == 1)||(iphase == 2)) {add(v1,v9,v1); add(oph,v9,oph), add(v6,v9,v6);}

status(A);
 obspower(tpwr); obspwrf(4095.0); decpower(dpwr);
   if (sspul[A] == 'y')
    {
       zgradpulse(gzlvl0,gt0);
       rgpulse(pw,zero,rof1,rof1);
       zgradpulse(gzlvl0,gt0);
    }
   delay(d1);

status(B);
   obsstepsize(45.0);
   initval(7.0,v11);
   xmtrphase(v11);

   rgpulse(pw,v1,rof1,rof1);
   if (trim_flg[0] == 'y')
	{ obspower(trimpwr);
          rgpulse(trim,v6,rof1,rof1);
          obspower(tpwr);
        }
   xmtrphase(zero);
   if (trim_flg[0] == 'y')
     {
      if (d2-2.0*pw/3.14 - 2.0*rof1 - SAPS_DELAY - POWER_DELAY> 0)
                 delay(d2-2.0*pw/3.14-2.0*rof1-SAPS_DELAY - POWER_DELAY);
      else
        delay(0.0);
     }
   else
     {
      if (d2-4.0*pw/3.14 - 2.0*rof1 - SAPS_DELAY> 0)
                 delay(d2-4.0*pw/3.14-2.0*rof1-SAPS_DELAY);
      else
        delay(0.0);
     }     
   rgpulse(pw,v7,rof1,rof1);
     if (zqflg[0] == 'y')
      {
            ifzero(v10); rgradient('z',gzlvlzq);
                 elsenz(v10); rgradient('z',-1.0*gzlvlzq); endif(v10);
          obspower(zqpwr); 
          shaped_pulse(zqshape,zqpw,zero,rof1,rof1);
          obspower(tpwr);
          rgradient('z',0.0);
          delay((mix-0.050-gt1)*0.7);
          if (alt_grd[0] == 'y')
           {
              ifzero(v10); zgradpulse(gzlvl1,gt1);
                    elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10);
           }
          else zgradpulse(gzlvl1,gt1);
          if (flipback[0] == 'n')
            delay((mix-0.05-gt1)*0.3);
          else     
            { delay((mix-0.05-gt1)*0.3 - flippw - rof1);
              obsstepsize(1.0);
              xmtrphase(v13);
              add(v8,two,v8);
              obspower(flippwr+6); obspwrf(flippwrf);
              shaped_pulse(flipshape,flippw,v8,rof1,rof1);
              xmtrphase(zero);
              add(v8,two,v8);
              obspower(tpwr); obspwrf(4095.0);
            }
      }
     else
      {
         delay(mix*0.7);
         if (alt_grd[0] == 'y')
          {
             ifzero(v10); zgradpulse(gzlvl1,gt1);
                    elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10);
          }
         else zgradpulse(gzlvl1,gt1);
         if (flipback[0] == 'n')
           delay(mix*0.3-gt2); 
          else    
            { delay(mix*0.3 - flippw - rof1);
              obsstepsize(1.0);
              xmtrphase(v13);
              add(v8,two,v8);
              obspower(flippwr+6); obspwrf(flippwrf);
              shaped_pulse(flipshape,flippw,v8,rof1,rof1);
              xmtrphase(zero);
              add(v8,two,v8);
              obspower(tpwr); obspwrf(4095.0);
            }
      }
   obspower(tpwr);
   rgpulse(pw,v8,rof1,rof1);
   if (alt_grd[0] == 'y')
    {
     ifzero(v10); zgradpulse(gzlvl2,gt2); 
		elsenz(v10); zgradpulse(-1.0*gzlvl2,gt2); endif(v10);
    }
    else zgradpulse(gzlvl2,gt2);
   delay(gstab);
   obspower(wrefpwr+6); obspwrf(wrefpwrf);
   shaped_pulse(wrefshape,wrefpw,v5,rof1,rof1);
   obspower(tpwr); obspwrf(4095.0);
   rgpulse(2.0*pw,v4,rof1,rof1);
   if (alt_grd[0] == 'y')
    {
     ifzero(v10); zgradpulse(gzlvl2,gt2);
                elsenz(v10); zgradpulse(-1.0*gzlvl2,gt2); endif(v10);
    }
    else zgradpulse(gzlvl2,gt2);
   delay(gstab);
   if (alt_grd[0] == 'y')
    {
     ifzero(v10); zgradpulse(1.2*gzlvl2,gt2);
                elsenz(v10); zgradpulse(-1.2*gzlvl2,gt2); endif(v10);
    }
    else zgradpulse(1.2*gzlvl2,gt2);
   delay(gstab);
   obspower(wrefpwr+6); obspwrf(wrefpwrf);
   shaped_pulse(wrefshape,wrefpw,v3,rof1,rof1);
   obspower(tpwr); obspwrf(4095.0);
   rgpulse(2.0*pw,v2,rof1,rof2);
   if (alt_grd[0] == 'y')
    {
     ifzero(v10); zgradpulse(1.2*gzlvl2,gt2);
                elsenz(v10); zgradpulse(-1.2*gzlvl2,gt2); endif(v10);
    }
    else zgradpulse(1.2*gzlvl2,gt2);
   delay(gstab);
   status(C);
}
Пример #25
0
pulsesequence()

{
/* DECLARE AND LOAD VARIABLES */

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


int	    t1_counter;

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

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

        sw1 = getval("sw1"),

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

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

/*   INITIALIZE VARIABLES   */

compN=compN;
compC=compC;

/* selective H20 one-lobe sinc pulse */
    tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));   /*needs 1.69 times more*/
    tpwrs = (int) (tpwrs);                        /*power than a square pulse */
    tpwrs = tpwrs+6;        /* increase attenuator setting so that
           	fine power control can be varied about the nominal 2048 value */



/* check validity of parameter range */

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

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

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

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

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

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

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

/* LOAD VARIABLES */

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


/* Set up f1180  */

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

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

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

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

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

        tau1 = tau1 - pw;

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

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

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

/* set up for complex FID */

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


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


/* BEGIN ACTUAL PULSE SEQUENCE */


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

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

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

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

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

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

   	txphase(zero);
	decphase(zero);

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

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

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

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

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

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

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

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

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

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

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

  	dec2rgpulse(pwN,zero,0.0,0.0);
	decpower(dpwr);
	dec2power(dpwr2);
	
/* acquire data */
status(C);
     	setreceiver(t6);
}
Пример #26
0
pulsesequence()
{
/* DECLARE VARIABLES */

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


 int	     t1_counter,icosel,first_FID;

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

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

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

             /* CONSTANTS */
             kappa,
   	     lambda = getval("lambda"),         /* scaling factor for JNCa */
 
	     /* GRADIENT DELAYS AND LEVELS */
             gt0 = getval("gt0"),               /* gradient time */
             gt1 = getval("gt1"),               /* gradient time */
             gt3 = getval("gt3"),               /* gradient time */
             gt5 = getval("gt5"),
             gstab = getval("gstab"),
             gzlvl0 = getval("gzlvl0"),         /* level of gradient */
             gzlvl1 = getval("gzlvl1"),
             gzlvl2 = getval("gzlvl2"),
             gzlvl3 = getval("gzlvl3"),
             gzlvl5 = getval("gzlvl5");

/* LOAD VARIABLES */

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

/* check validity of parameter range */

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

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

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

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

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

/* LOAD VARIABLES */

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

/* INITIALIZE VARIABLES AND POWER LEVELS FOR PULSES */

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


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

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

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

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

        pw180onco = sqrt(3.0)/(2.0*118.0*dfrq);
        rf180onco = (4095.0*pwC*compC*2.0)/pw180onco;
        rf180onco = (int) (rf180onco + 0.5);
        if(rf180onco > 4095.0)
        {
          if(first_FID)
            printf("insufficient power for pw180onco -> rf180onco (%.0f)\n", rf180onco);
          rf180onco = 4095.0;
          pw180onco = pwC*2.0;
        }
        pw180offca = pw180onco;        rf180offca = rf180onco;
      
/* Phase incrementation for hypercomplex data */
    
     kappa=(taunco - tauhn - gt1 - gstab)/(0.5*ni/sw1)-0.001;
      if (kappa > 1.0) 
     {  
	              kappa=1.0-0.01;
     }   

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

      if (t1_counter %2)  /* STATES-TPPI */
      {
        tsadd(t1,2,4);
        tsadd(t7,2,4);
      }

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

   tau1 = d2;
   if (f1180[A] == 'y')  tau1 += ( 1.0/(2.0*sw1));
   tau1 = tau1/2.0;


/* selective H20 one-lobe sinc pulse */
  tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));   /*needs 1.69 times more*/
  tpwrs = (int) (tpwrs);                   	  /*power than a square pulse */
  if (tpwrsf_d<4095.0) tpwrs=tpwrs+6.0; /* allow for fine power control via tpwrsf_d */

/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */


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

status(B);

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

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

  zgradpulse(gzlvl0*1.3,gt0);
  delay(gstab);
   
  delay(tauhn - gt0 - gstab);        /* 1/4JHN */
   
  sim3pulse(2.0*pw,0.0,2.0*pwN,zero,zero,zero,0.0,0.0);  /* 180 for 1H and 15N */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        }

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

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

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

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

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

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

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

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

        zgradpulse(gzlvl0*0.9,gt0);
        delay(gstab);


        decrgpulse(pw90onco,zero,0.0,0.0);  /* 90 for 13C' */

        /* Field crusher gradient */
           zgradpulse(gzlvl3*0.9,gt3);
           delay(gstab);
	/* Field crusher gradient */

      }  
 
     dec2rgpulse(pwN,t1,0.0,0.0); /* 90 15N */
  
     if (lambda>0.0)
      { 
        delay(lambda*tau1);  /* (lambda)t1/2 */
   
        decpwrf(rf180offca);   
        sim3shaped_pulse("","offC3","",0.0,pw180offca,2.0*pwN,zero,zero,zero,rof1,rof1);

        delay(lambda*tau1);  /* (lambda)t1/2 */
      }

     delay(tau1);                             /* t1/2 */
     delay(taunco - tauhn - pw180onco);  

     decpwrf(rf180onco);
     decrgpulse(pw180onco,zero,0.0,0.0);     /* 180 for 13C' */

     delay((1-kappa)*tau1);                  /* (1-k)t1/2 */

     dec2rgpulse(2.0*pwN,zero,0.0,0.0);     /* 180 for 15N */
   
     delay((taunco - tauhn - gt1 - gstab) - kappa*tau1);  /* 1/4J(NCO) - 1/4J(NH) - kt1/2 */
          
     zgradpulse(gzlvl1,gt1);
     delay(gstab);
   
   /* start TROSY transfer from N to HN */
      
         
     sim3pulse(pw,0.0,0.0,t2,zero,zero,rof1,rof1);

     zgradpulse(gzlvl5,gt5);
     delay(gstab);
 
     delay(tauhn - gt5 - gstab - POWER_DELAY);
   
      
     decpwrf(rf180onco);
     sim3pulse(2.0*pw,pw180onco,2*pwN,zero,zero,zero,rof1,rof1);
   
     delay(tauhn - gt5 - gstab - POWER_DELAY);
   
      
     zgradpulse(gzlvl5,gt5);
     delay(gstab);
   
     decpwrf(rf90onco);
     sim3pulse(pw,pw90onco,pwN,one,t6,zero,rof1,rof1);
   
      /* shaped pulse WATERGATE */
         obspower(tpwrs); obspwrf(tpwrsf_u);
         shaped_pulse("H2Osinc_u",pwHs,t2,rof1,0.0);
         obspower(tpwr); obspwrf(4095.0);
       /* shaped pulse */
   
     zgradpulse(gzlvl5*0.8,gt5);
     delay(gstab);
      
     delay(tauhn - gt5 - gstab - 2.0*POWER_DELAY - pwHs);
   
     sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,rof1,rof1);
   
      
     delay(tauhn - gt5 - gstab - 2.0*POWER_DELAY);
   
      decpower(dpwr);
      
     zgradpulse(gzlvl5*0.8,gt5);
     delay(gstab);
   
     dec2rgpulse(pwN,t3,0.0,0.0);  /* 90 for 15N */
      
     dec2power(dpwr2);
      
     delay((gt1/10.0) -pwN + gstab - POWER_DELAY);
      
     rgpulse(2.0*pw, zero, rof1, rof1);
      
     zgradpulse(gzlvl2*icosel,gt1/10.0);
     delay(gstab);
      
   status(C);
     setreceiver(t7);
}
Пример #27
0
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);
} 
Пример #28
0
pulsesequence()
{
double	gzlvl1  = getval("gzlvl1"),
	gt1     = getval("gt1"),
	gstab   = getval("gstab"),
	del     = getval("del"),
	tweek   = getval("tweek"),
	prgtime = getval("prgtime"),
        prgpwr  = getval("prgpwr"),
        satpwr = getval("satpwr"),
        satdly = getval("satdly"),
        gzlvl2 = getval("gzlvl2"),
        gt2 = getval("gt2"),
        gzlvlhs = getval("gzlvlhs"),
        hsgt = getval("hsgt"),
        wrefpwr = getval("wrefpwr"),
        wrefpw = getval("wrefpw"),
        wrefpwrf = getval("wrefpwrf"),
        dosytimecubed,dosyfrq,Ddelta;
char	delflag[MAXSTR],lkgate_flg[MAXSTR],alt_grd[MAXSTR],prg_flg[MAXSTR];
char	satmode[MAXSTR],sspul[MAXSTR],wrefshape[MAXSTR];

   getstr("delflag",delflag);
   getstr("lkgate_flg",lkgate_flg);
   getstr("alt_grd",alt_grd);
   getstr("prg_flg",prg_flg);
   getstr("satmode",satmode);
   getstr("sspul",sspul);
   getstr("wrefshape", wrefshape);

       //synchronize gradients to srate for probetype='nano'
       //   Preserve gradient "area"
          gt1 = syncGradTime("gt1","gzlvl1",1.0);
          gzlvl1 = syncGradLvl("gt1","gzlvl1",1.0);
          gt2 = syncGradTime("gt2","gzlvl2",1.0);
          gzlvl2 = syncGradLvl("gt2","gzlvl2",1.0);

   if (del<(3*gt1+3.0*gstab+2.0*rof1+pw*2.0))
   {  abort_message("DgcsteSL error: del is less than %f, too short!",
           (3*gt1+3.0*gstab+2.0*rof1+pw*2.0));
   }

   /* Safety check for the duration of the purge pulse */
   if (prgtime > 4.0e-2)
   {  text_error("prgtime has been reset to a maximum of 2 ms");
      prgtime = 2.0e-3;
   }
   dosyfrq=sfrq;
   Ddelta=gt1;             /* the diffusion-encoding pulse width is gt1 */
   dosytimecubed=Ddelta*Ddelta*(del-(Ddelta/3.0));
   putCmd("makedosyparams(%e,%e)\n",dosytimecubed,dosyfrq);

   /* phase cycling calculation */
   if (delflag[0]=='y')
   {  hlv(ct,v4);
      mod2(v4,v2);
      mod2(ct,v1);
      dbl(v1,v1);
      add(v2,v1,v1);
      mod4(v1,v1); 	/* 0 2 1 3 , 1st 90 */
      hlv(v4,v4);
      mod2(v4,v3);
      dbl(v3,v3);	/* (0)4 (2)4 */
      hlv(v4,v4);
      mod2(v4,v2);
      dbl(v2,v2);	/* (0)8 (2)8 */
      hlv(v4,v4);
      mod2(v4,v5);
      add(v5,v3,v3);
      mod4(v3,v3);	/* {(0)4 (2)4}2 {(1)4 (3)4}2, 3rd 90 */
      hlv(v4,v4);
      assign(v4,v6);
      mod2(v4,v4);
      add(v4,v2,v2);
      mod4(v2,v2);	/* {(0)8 (2)8}2 {(1)8 (3)8}2, 2nd 90 */
      mod2(ct,v10);	/* gradients change sign every increment */

      assign(v3,oph);
      add(oph,v2,oph);
      sub(oph,v1,oph);
      mod4(oph,oph);

      assign(oph,v5);
      add(one,v5,v5);
      mod2(ct,v7);
      dbl(v7,v7);
      hlv(v6,v6);
      mod2(v6,v6);
      dbl(v6,v6);
      add(v7,v5,v5);	/* the purge pulse is 90 deg. off the receiver phase */
      add(v6,v5,v5);	/* it is phase alternated every increment */
      mod4(v5,v5);	/* and also every 64 increments */
   }
   else
   {
      assign(ct,v4);
      assign(oph,v4);	/*v4 used only for normal s2pul- type sequence */
   }
   add(v3,two,v9);

   if (ni > 1.0)
   {  abort_message("DgcsteSL is a 2D, not a 3D dosy sequence:  please set ni to 0 or 1");
   }

   /* equilibrium period */
   status(A);
      obspower(tpwr);
      if (sspul[A] == 'y')
       {
         zgradpulse(gzlvlhs,hsgt);
         rgpulse(pw,zero,rof1,rof1);
         zgradpulse(gzlvlhs,hsgt);
       }
      if (satmode[0] == 'y')
       {
       if (d1 - satdly > 0)
         delay(d1 - satdly);
       else delay(0.02);
       obspower(satpwr);
       txphase(v1);
       rgpulse(satdly,zero,rof1,rof1);
       obspower(tpwr);
       delay(1.0e-5);
      }
     else
     {  delay(d1); }

   obspower(tpwr);

   status(B);
   /* first part of bppdel sequence */
   if(delflag[0] == 'y')
   {  rgpulse(pw, v1, rof1, 0.0);	/* first 90, v1 */

      if (lkgate_flg[0] == 'y') lk_hold();   /* turn lock sampling off */

      if (alt_grd[0] == 'y')
      {  ifzero(v10);
           zgradpulse(gzlvl1,gt1);
         elsenz(v10);
           zgradpulse(-1.0*gzlvl1,gt1);
	 endif(v10);
      }
      else
         zgradpulse(gzlvl1,gt1);
         delay(gstab);

      rgpulse(pw, v2, rof1, 0.0);	/* second 90, v2 */

      if (alt_grd[0] == 'y')
      {  ifzero(v10);			/* compensating AND CPS gradient */
   	   zgradpulse(-1.0*gzlvl1*(1.0-tweek),gt1);
	 elsenz(v10);
   	   zgradpulse(gzlvl1*(1.0-tweek),gt1);
	 endif(v10);
      }
      else  /* compensating AND CPS gradient */
	 zgradpulse(-1.0*gzlvl1*(1.0-tweek),gt1);

      delay(gstab);

      if (satmode[B] == 'y')
       { obspower(satpwr);
         rgpulse(del-3.0*(gt1+gstab)-2.0*rof1-pw*2.0,zero,rof1,rof1);
         obspower(tpwr);
       }
      else
          delay(del-3.0*(gt1+gstab)-2.0*rof1-pw*2.0); /* diffusion delay */

      if (alt_grd[0] == 'y')
      {
	 ifzero(v10);
   	   zgradpulse(-1.0*gzlvl1*(1.0+tweek),gt1);
	 elsenz(v10);
   	   zgradpulse(gzlvl1*(1.0+tweek),gt1);
	 endif(v10);
      }
      else
         zgradpulse(-1.0*gzlvl1*(1.0+tweek),gt1);
      delay(gstab);

      rgpulse(pw, v3, rof1, 0.0);	/* third 90, v3 */

      if (alt_grd[0] == 'y')
      {
	 ifzero(v10);
	   zgradpulse(gzlvl1,gt1);
	 elsenz(v10);
	   zgradpulse(-1.0*gzlvl1,gt1);
         endif(v10);
      }
      else
         zgradpulse(gzlvl1,gt1);
      delay(gstab);

     if (alt_grd[0] == 'y')
       { ifzero(v10); zgradpulse(gzlvl2,gt2);
              elsenz(v10); zgradpulse(-gzlvl2,gt2); endif(v10);}
     else zgradpulse(gzlvl2,gt2);
       obspower(wrefpwr+6); obspwrf(wrefpwrf);
       delay(gstab);
       shaped_pulse(wrefshape,wrefpw,v9,rof1,0.0);
       obspower(tpwr); obspwrf(4095.0);
       rgpulse(2.0*pw,v3,rof1,0.0);
     if (alt_grd[0] == 'y')
       { ifzero(v10); zgradpulse(gzlvl2,gt2);
              elsenz(v10); zgradpulse(-gzlvl2,gt2); endif(v10);}
     else zgradpulse(gzlvl2,gt2);
       obspower(wrefpwr+6); obspwrf(wrefpwrf);
       delay(gstab);
     if (alt_grd[0] == 'y')
       { ifzero(v10); zgradpulse(1.2*gzlvl2,gt2);
              elsenz(v10); zgradpulse(-1.2*gzlvl2,gt2); endif(v10); }
     else zgradpulse(1.2*gzlvl2,gt2);
       delay(gstab);
       shaped_pulse(wrefshape,wrefpw,v9,rof1,0.0);
       obspower(tpwr); obspwrf(4095.0);
       rgpulse(2.0*pw,v3,rof1,rof1);
     if (alt_grd[0] == 'y')
       { ifzero(v10); zgradpulse(1.2*gzlvl2,gt2);
              elsenz(v10); zgradpulse(-1.2*gzlvl2,gt2); endif(v10); }
     else zgradpulse(1.2*gzlvl2,gt2);
       delay(gstab+2.0*pw/3.14);
      if (lkgate_flg[0] == 'y') lk_sample(); /* turn lock sampling on */

      /* purge pulse to scramble any magnetisation that 
		is not in phase with the receiver */
      if (prg_flg[0] == 'y')
      {  obspower(prgpwr);
         rgpulse(prgtime, v5, rof1, 0.0);
      }
   }
   else
      rgpulse(pw, v4, rof1, rof2);	/* first 90, v1 */

   status(C);
}
Пример #29
0
void pulsesequence()

{

   double   gzlvlE = getval("gzlvlE"),
            gtE = getval("gtE"),
            EDratio = getval("EDratio"),
            gstab = getval("gstab"),
            mult = getval("mult"),
	    pwx180 = getval("pwx180"),
	    pwxlvl180 = getval("pwxlvl180"),
	    pwx180r = getval("pwx180r"),
	    pwxlvl180r = getval("pwxlvl180r"),
            tpwr180 = getval("tpwr180"),
            pw180 = getval("pw180"),
            hsglvl = getval("hsglvl"),
            hsgt = getval("hsgt"),
            gzlvl5 = getval("gzlvl5"),
            tau,
            taug;
   int      icosel,
	    phase1 = (int)(getval("phase")+0.5),
            prgcycle = (int)(getval("prgcycle")+0.5),
	    ZZgsign;
   char	    pwx180ad[MAXSTR],
	    pwx180ref[MAXSTR],
	    bipflg[MAXSTR],
	    pw180ad[MAXSTR];

//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gtE = syncGradTime("gtE","gzlvlE",0.5);
        gzlvlE = syncGradLvl("gtE","gzlvlE",0.5);

  getstr("pwx180ad", pwx180ad);
  getstr("pwx180ref", pwx180ref);
  getstr("pw180ad", pw180ad);
  getstr("bipflg",bipflg);
  if (bipflg[0] == 'y')
  {
        tpwr180=getval("tnbippwr");
        pw180=getval("tnbippw");
        getstr("tnbipshp",pw180ad);
  }
  if (bipflg[1] == 'y')
  {
        pwxlvl180=getval("dnbippwr");
        pwx180=getval("dnbippw");
        getstr("dnbipshp",pwx180ad);
  }

  tau = 1 / (4*(getval("j1xh")));

  if (mult > 0.5)
    taug = 2*tau + getval("tauC");
  else
    taug = gtE + gstab + 2 * GRADIENT_DELAY;
  ZZgsign=-1; 
  if (mult == 2) ZZgsign=1;
  icosel = 1;
 
  assign(ct,v17);
  assign(zero,v18);
  assign(zero,v19);

  if (getflag("prgflg") && (satmode[0] == 'y') && (prgcycle > 1.5))
    {
        hlv(ct,v17);
        mod2(ct,v18); dbl(v18,v18);
        if (prgcycle > 2.5)
           {
                hlv(v17,v17);
                hlv(ct,v19); mod2(v19,v19); dbl(v19,v19);
           }
     }

  settable(t1, 4, ph1);
  settable(t2, 2, ph2);
  settable(t3, 8, ph3);
  settable(t4, 16, ph4);
  settable(t5, 16, ph5);

  getelem(t1, v17, v1);
  getelem(t3, v17, v3);
  getelem(t4, v17, v4);
  getelem(t2, v17, v2);
  getelem(t5, v17, oph);

  assign(zero,v6);
  add(oph,v18,oph);
  add(oph,v19,oph);

  if ((phase1 == 2) || (phase1 == 5))
    icosel = -1;

  initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v14);
/*
  mod2(id2, v14);
  dbl(v14,v14);
*/
  add(v2, v14, v2);
  add(oph, v14, oph);

status(A);
   obspower(tpwr);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        if (getflag("slpsat"))
           {
                shaped_satpulse("relaxD",satdly,zero);
                if (getflag("prgflg"))
                   shaped_purge(v6,zero,v18,v19);
           }
        else
           {
                satpulse(satdly,zero,rof1,rof1);
                if (getflag("prgflg"))
                   purge(v6,zero,v18,v19);
           }
     }
   else
        delay(d1);

   if (getflag("wet"))
     wet4(zero,one);

   obspower(tpwr);
   decpower(pwxlvl180);

  status(B);

    if (getflag("nullflg"))
    {
      rgpulse(0.5 * pw, zero, rof1, rof1);
      obspower(tpwr180);
      delay(tau);
      simshaped_pulse(pw180ad,pwx180ad,pw180,pwx180,zero,zero,rof1,rof1);
      delay(tau+POWER_DELAY+rof1);
      delay(tau+POWER_DELAY+rof1);
      simshaped_pulse(pw180ad,pwx180ad,pw180,pwx180,zero,zero,rof1,rof1);
      obspower(tpwr);
      delay(tau);
      rgpulse(0.5 * pw, zero, rof1, rof1);
      zgradpulse(hsglvl, hsgt);
      delay(1e-3);
    }

    if (getflag("cpmgflg"))
    {
      rgpulse(pw, v6, rof1, 0.0);
      cpmg(v6, v15);
    }
    else
      rgpulse(pw, v6, rof1, rof1);
    obspower(tpwr180);
    shaped_pulse(pw180ad,pw180,zero,rof1,rof1);
    delay(tau+2.0*POWER_DELAY+2.0*rof1);
    simshaped_pulse(pw180ad,pwx180ad,pw180,pwx180,zero,zero,rof1,rof1);
    delay(tau);
    obspower(tpwr);
    rgpulse(pw, v1, rof1, rof1);
    zgradpulse(hsglvl, 2 * hsgt);
    decpower(pwxlvl);
    obspower(tpwr180);
    delay(1e-3);
    decrgpulse(pwx, v2, rof1, 2.0e-6);

    delay(d2 / 2);
    shaped_pulse(pw180ad,pw180,zero,rof1,rof1);
    delay(d2 / 2);

    delay(taug - POWER_DELAY);
    decpower(pwxlvl180r);
    decshaped_pulse(pwx180ref, pwx180r, zero, rof1, rof1);

    if(mult < 1.5)
      {
       obspower(tpwr);
       if (mult <0.5)
         delay(2*rof1);
       else
         rgpulse(mult*pw,zero,rof1,rof1);
      }
    else
      shaped_pulse(pw180ad,pw180,zero,rof1,rof1);

    if(mult < 1.5)
      delay(4*pwx/PI + 4.0e-6 + taug - gtE - gstab - 2 * GRADIENT_DELAY + WFG_START_DELAY + pw180 + WFG_STOP_DELAY - mult*pw);
    else
      delay(4*pwx/PI + 4.0e-6 + POWER_DELAY + taug  - gtE - gstab - 2 * GRADIENT_DELAY);

    zgradpulse(gzlvlE, gtE);
    delay(gstab);
    decshaped_pulse(pwx180ref, pwx180r, zero, rof1, rof1);
    decpower(pwxlvl);

    decrgpulse(pwx, v4, 2.0e-6, rof1);
    obspower(tpwr);
    decpower(pwxlvl180);
    zgradpulse(ZZgsign*0.6 * hsglvl, 1.2 * hsgt);
    delay(1e-3);

    rgpulse(pw, v3, rof1, rof1);
    obspower(tpwr180);
    shaped_pulse(pw180ad,pw180,zero,rof1,rof1);
    zgradpulse(gzlvl5,gtE/2.0);
    delay(tau-gtE/2.0+2.0*POWER_DELAY);
    simshaped_pulse(pw180ad,pwx180ad,pw180,pwx180,zero,zero,rof1,rof2);
    zgradpulse(gzlvl5+icosel * 2.0*gzlvlE/EDratio, gtE/2.0);
    delay(tau-gtE/2.0);
    decpower(dpwr);

  status(C);
}
Пример #30
0
pulsesequence()
{
  int       phase, t1_counter;

  char	    C13refoc[MAXSTR],		/* C13 sech/tanh pulse in middle of t1 */
            TROSY[MAXSTR],
            wtg3919[MAXSTR];
  double    tauxh, tau1,  gt2, gt1, 
            gztm, mix,  pw180, pw135, pw120, pw110, p1lvl, 
            gzlvl1,  cycles,  
            pwNt = 0.0,               /* pulse only active in the TROSY option */
            gsign = 1.0,
            gzlvl3=getval("gzlvl3"),
            gt3=getval("gt3"),
            JNH = getval("JNH"),
            pwN = getval("pwN"),
            pwNlvl = getval("pwNlvl"),  
            pwHs, tpwrs=0.0,           /* H1 90 degree pulse length at tpwrs */               
            compH = getval("compH"),
            sw1 = getval("sw1"),
            pwClvl = getval("pwClvl"), 	         /* coarse power for C13 pulse */
            pwC = getval("pwC"),       /* C13 90 degree pulse length at pwClvl */
            rfst = 4095.0,	            /* fine power for the stCall pulse */
                   /* temporary Pbox parameters */
            bw, pws, ofs, ppm, nst,  /* bandwidth, pulsewidth, offset, ppm, # steps */
            compC = getval("compC");   /* adjustment for C13 amplifier compr-n */

   gztm=getval("gztm");
   gt2=getval("gt2");
   gt1= getval("gt1");
   mix=getval("mix");
   phase = (int) (getval("phase") + 0.5);
   sw1 = getval("sw1");
   pw180 = getval("pw180");
   gzlvl1 = getval("gzlvl1");



/* INITIALIZE VARIABLES */

        pw135 = pw180 / 180.0 * 135.0 ;
        pw120 = pw180 / 180.0 * 120.0 ;
        pw110 = pw180 / 180.0 * 110.0 ;

        p1lvl = tpwr -20*log10(pw180/(compH*2.0*pw));
        p1lvl = (int)(p1lvl + 0.5);
         cycles = mix / (730.0/180.0 * pw180) - 8.0;

         initval(cycles, v10);        /* mixing time cycles */


    getstr("C13refoc",C13refoc);
    getstr("TROSY",TROSY);
    getstr("wtg3919",wtg3919);
    
    tauxh = ((JNH != 0.0) ? 1/(4*(JNH)) : 2.25e-3);

    setautocal();                        /* activate auto-calibration flags */ 
        
    if (autocal[0] == 'n') 
    {
      if (C13refoc[A]=='y') 
      {
        /* 180 degree adiabatic C13 pulse from 0 to 200 ppm */
        rfst = (compC*4095.0*pwC*4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)); 
        rfst = (int) (rfst + 0.5);
        if ( 1.0/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)) < pwC )
           { text_error( " Not enough C13 RF. pwC must be %f usec or less.\n", 
	     (1.0e6/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35))) ); psg_abort(1); }
      }
    }
    else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
    {
      if(FIRST_FID)                                            /* call Pbox */
      {
        if (C13refoc[A]=='y') 
        {
          ppm = getval("dfrq"); ofs = 0.0;   pws = 0.001;  /* 1 ms long pulse */
          bw = 200.0*ppm;       nst = 1000;          /* nst - number of steps */
          stC200 = pbox_makeA("stC200A", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
          C13ofs = 100.0;
        }
        ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
      }
      rfst = stC200.pwrf;
    }

                               /* selective H20 one-lobe sinc pulse needs 1.69  */
     pwHs = getval("pwHs");            /* times more power than a square pulse */
     if (pwHs > 1e-6) tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));  
     else tpwrs = 0.0;
     tpwrs = (int) (tpwrs); 

/* check validity of parameter range */

    if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y' ))
    { text_error("incorrect Dec1 decoupler flags!  "); psg_abort(1); } 

    if((dm2[A] == 'y' || dm2[B] == 'y') )
    { text_error("incorrect Dec2 decoupler flags!  "); psg_abort(1); } 

    if( dpwr > 0 )
    { text_error("don't fry the probe, dpwr too large!  "); psg_abort(1); }

    if( dpwr2 > 50 )
    { text_error("don't fry the probe, dpwr2 too large!  "); psg_abort(1); }

    if ((TROSY[A]=='y') && (dm2[C] == 'y'))
    { text_error("Choose either TROSY='n' or dm2='n' ! "); psg_abort(1); }

/* LOAD VARIABLES */

    if(ix == 1) d2_init = d2;
    t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5);
    
    tau1 = d2/2.0;

/* LOAD PHASE TABLES */

      settable(t6, 4, recT); 
    if (TROSY[A] == 'y')
    { gsign = -1.0;
      pwNt = pwN;
      assign(zero,v7); 
      assign(two,v8);
      settable(t1, 1, phT1);
      settable(t2, 4, phT2);
      settable(t3, 1, phT4); 
      settable(t4, 1, phT4);
      settable(t5, 4, recT); }
    else
    { assign(one,v7); 
      assign(three,v8);
      settable(t1, 4, phi1);
      settable(t2, 2, phi2);
      settable(t3, 8, phi3);
      settable(t4, 16, phi4);
      settable(t5, 8, rec); } 

      if ( phase1 == 2 )                  /* Hypercomplex in t1 */
      { if (TROSY[A] == 'y')          
        { tsadd(t3, 2, 4); tsadd(t5, 2, 4); }                      
        else tsadd(t2, 1, 4); }
                                   
    if(t1_counter %2)          /* calculate modification to phases based on */
    { tsadd(t2,2,4); tsadd(t5,2,4); tsadd(t6,2,4); }   /* current t1 values */

    if(wtg3919[0] != 'y') 
    { add(one,v7,v7); add(one,v8,v8); }
         
                           /* sequence starts!! */
   status(A);
     
     obspower(tpwr);
     dec2power(pwNlvl);
     decpower(pwClvl);
     decpwrf(rfst);
     delay(d1);
     
   status(B);

/* slective excitation of water */

     rgpulse(pw, zero, rof1, rof1);
     

     zgradpulse(gzlvl1,gt1);

     obspower(tpwrs+6);  /* make it a 180 inversion pulse */
     shaped_pulse("H2Osinc", pwHs, zero, rof1, 0.0);
     obspower(tpwr);

     zgradpulse(gzlvl1,gt1);

/*  CLEANEX-PM spin-lock   */

      if (cycles > 1.5000)
      {

       obspower(p1lvl);
       txphase(zero);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/2.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);


            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0*3.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm);

         starthardloop(v10);
            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);
         endhardloop();

       rgradient('z',gztm/4.0*3.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/2.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z', 0.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);


       obspower(tpwr);

      }


/* .......................................  */

     zgradpulse(0.3*gzlvl3,gt3);
     txphase(zero);
     dec2phase(zero);
     delay(tauxh-gt3);               /* delay=1/4J(XH)   */

     sim3pulse(2*pw,0.0,2*pwN,t4,zero,zero,rof1,rof1);

     zgradpulse(0.3*gzlvl3,gt3);
     dec2phase(t2);
     delay(tauxh-gt3 );               /* delay=1/4J(XH)   */
  
     rgpulse(pw, t1, rof1, rof1);

     zgradpulse(0.5*gsign*gzlvl3,gt3);
     delay(200.0e-6); 
     decphase(zero);
            
     if (TROSY[A] == 'y')
     { 
       txphase(t3);       
       if ( phase1 == 2 ) 
         dec2rgpulse(pwN, t6, rof1, 0.0);
       else 
         dec2rgpulse(pwN, t2, rof1, 0.0);              
       if ( (C13refoc[A]=='y') && (d2 > 1.0e-3 + 2.0*WFG2_START_DELAY) )
       {
         delay(d2/2.0 - 0.5e-3 - WFG2_START_DELAY);     
         decshaped_pulse("stC200A", 1.0e-3, zero, 0.0, 0.0);
         delay(d2/2.0 - 0.5e-3 - WFG2_STOP_DELAY);
       }
       else
         delay(d2);

       rgpulse(pw, t3, 0.0, rof1);         
       zgradpulse(0.3*gzlvl3,gt3);
       delay(tauxh-gt3 );
       
       sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,rof1,rof1);
       
       zgradpulse(0.3*gzlvl3,gt3);
       delay(tauxh-gt3 );       
       sim3pulse(pw,0.0,pwN,zero,zero,t3,rof1,rof1);
     }
     else
     {         
       txphase(t4);      
       dec2rgpulse(pwN, t2, rof1, 0.0);
        
       if ( (C13refoc[A]=='y') && (tau1 > 0.5e-3 + WFG2_START_DELAY) )
       {
         delay(tau1 - 0.5e-3 - WFG2_START_DELAY); 
         simshaped_pulse("", "stC200A", 2.0*pw, 1.0e-3, t4, zero, 0.0, 0.0);  
         dec2phase(t3);  
         delay(tau1 - 0.5e-3 - WFG2_STOP_DELAY);
       }
       else 
       {
	 tau1 -= pw;
	 if (tau1 < 0.0) tau1 = 0.0;
         delay(tau1);
         rgpulse(2.0*pw, t4, 0.0, 0.0);
         dec2phase(t3);
         delay(tau1);
       }
       
       dec2rgpulse(pwN, t3, 0.0, 0.0);
       
       zgradpulse(0.5*gzlvl3,gt3);
       delay(200.0e-6);
       rgpulse(pw, two, rof1, rof1);
     } 
     
     zgradpulse(gzlvl3,gt3);
     txphase(v7); dec2phase(zero);
     delay(tauxh-gt3-pwHs-rof1);
     
     if(wtg3919[0] == 'y')
     {     	
       rgpulse(pw*0.231,v7,rof1,rof1);     
       delay(d3);
       rgpulse(pw*0.692,v7,rof1,rof1);
       delay(d3);
       rgpulse(pw*1.462,v7,rof1,rof1);

       delay(d3/2-pwN);
       dec2rgpulse(2*pwN, zero, rof1, rof1);
       txphase(v8);
       delay(d3/2-pwN);

       rgpulse(pw*1.462,v8,rof1,rof1);
       delay(d3);
       rgpulse(pw*0.692,v8,rof1,rof1);
       delay(d3);
       rgpulse(pw*0.231,v8,rof1,rof1); 
     }
     else
     {
       obspower(tpwrs);  
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr);
       sim3pulse(2.0*pw, 0.0, 2.0*pwN, v8, zero, zero, 0.0, 0.0);
       obspower(tpwrs);
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr);
     } 
        
     zgradpulse(gzlvl3,gt3);   
     delay(tauxh-gt3-pwHs-rof1-pwNt-POWER_DELAY); 
     dec2rgpulse(pwNt, zero, rof1, rof1); 
     dec2power(dpwr2);

   status(C);
     setreceiver(t5);   
}