Esempio n. 1
0
pulsesequence()

{
      delay(d1);
      rcvroff();
      if (d3>4.5)
       dec4rgpulse(pw, oph, rof1, rof2);
      else
       {
        if (d3>3.5)
          dec3rgpulse(pw, oph, rof1, rof2);
        else
          dec2rgpulse(pw, oph, rof1, rof2);
       }        
}
Esempio n. 2
0
pulsesequence()
{
   double  gzlvl1 = getval("gzlvl1"),
           gzlvl2 = getval("gzlvl2"),
              gt1 = getval("gt1"),
              gt2 = getval("gt2"),
           satdly = getval("satdly"),
              mix = getval("mix"),
              pwNlvl = getval("pwNlvl"),
              pwN = getval("pwN"),
              pwClvl = getval("pwClvl"),
              pwC = getval("pwC"),
           scubad = getval("scubad");
   int     iphase = (int) (getval("phase") + 0.5);
   char    sspul[MAXSTR],mfsat[MAXSTR],scuba[MAXSTR],
           C13refoc[MAXSTR],N15refoc[MAXSTR],CNrefoc[MAXSTR];
   
   getstr("C13refoc",C13refoc);
   getstr("N15refoc",N15refoc);
   getstr("CNrefoc",CNrefoc);
   getstr("mfsat",mfsat);
   getstr("sspul", sspul);
   getstr("scuba",scuba);

   loadtable("tnnoesy");
   sub(ct,ssctr,v12);
   getelem(t1,v12,v1);
   getelem(t2,v12,v2);
   getelem(t3,v12,v5);
   getelem(t4,v12,v8);
   getelem(t5,v12,v9);
   getelem(t6,v12,oph);
   assign(zero,v3);
   assign(one,v4);
   if (iphase == 2)
      {incr(v1); incr(v2); incr(v3); incr(v4);}

/* HYPERCOMPLEX MODE USES REDFIELD TRICK TO MOVE AXIAL PEAKS TO EDGE */
   initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v6);
   if ((iphase==1)||(iphase==2))
      {add(v1,v6,v1); add(v2,v6,v2); add(oph,v6,oph);
       add(v3,v6,v3); add(v4,v6,v4);}  

/* CHECK CONDITIONS */
   if ((dm[A]=='y') || (dm[B] == 'y') || (dm[C] == 'y'))
     {
      abort_message("Set dm to be nnnn or nnny");
     }
   if ((dm2[A]=='y') || (dm2[B] == 'y') || (dm2[C] == 'y'))
     {
      abort_message("Set dm2 to be nnnn or nnny");
     }

/* BEGIN THE ACTUAL PULSE SEQUENCE */

     decpower(pwClvl); dec2power(pwNlvl);  
     if (CNrefoc[A] == 'y')
      {
       decpower(pwClvl-3.0); pwC=1.4*pwC;
       dec2power(pwNlvl-3.0); pwN=1.4*pwN;
      }

      if (sspul[A] == 'y')
      {
         zgradpulse(gzlvl1,gt1);
         delay(1.0e-4);
         rgpulse(pw,zero,rof1,rof1);
         zgradpulse(gzlvl1,gt1);
         delay(1.0e-4);
      }
   status(A);
      if (satmode[A] == 'y')
      {
      if (d1 > satdly) delay(d1 - satdly);
       if (mfsat[A] == 'y')
        {obsunblank(); mfpresat_on(); delay(satdly); mfpresat_off(); obsblank();}
       else
        {
         obspower(satpwr);
         rgpulse(satdly,v1,rof1,rof1); 
        }
         obspower(tpwr);
         if (scuba[0] == 'y')
            {
            rgpulse(pw,v3,2.0e-6,0.0);
            rgpulse(2.0*pw,v4,2.0e-6,0.0);
            rgpulse(pw,v3,2.0e-6,0.0);
            delay(scubad/2.0);
            rgpulse(pw,v3,2.0e-6,0.0); 
            rgpulse(2.0*pw,v4,2.0e-6,0.0); 
            rgpulse(pw,v3,2.0e-6,0.0); 
            delay(scubad/2.0); 
            }
      }
      else delay(d1);
      obsstepsize(45.0);
      initval(7.0,v7);
      xmtrphase(v7);
   status(B);
      rgpulse(pw,v2,rof1,0.0);
      xmtrphase(zero);
      if (d2>0.0)
      {
      if ((C13refoc[A] == 'n') &&  (N15refoc[A] == 'n') && (CNrefoc[A] == 'n'))
       {
         delay(d2-4.0*pw/PI-SAPS_DELAY-rof1);
       }

      else if ((C13refoc[A] == 'n') && (N15refoc[A] == 'n') && (CNrefoc[A] == 'y'))
       {
        if (pwN > 2.0*pwC)
         {
          if (d2/2.0 > (pwN +0.64*pw+rof1))
            {
             delay(d2/2.0-pwN-0.64*pw-SAPS_DELAY);
             dec2rgpulse(pwN-2.0*pwC,zero,0.0,0.0);
             sim3pulse(0.0,pwC,pwC, zero,zero,zero, 0.0, 0.0);
             sim3pulse(0.0,2.0*pwC,2.0*pwC, zero,one,zero, 0.0, 0.0);
             sim3pulse(0.0,pwC,pwC, zero,zero,zero, 0.0, 0.0);
             dec2rgpulse(pwN-2.0*pwC,zero,0.0,0.0);
             delay(d2/2.0-pwN-0.64*pw-rof1);
            }
          else
            delay(d2-4.0*pw/PI-SAPS_DELAY-rof1);
         }
        else
         {
           if (d2/2.0 > (pwN +pwC+ 0.64*pw+rof1))
            {
             delay(d2/2.0-pwN-pwC-0.64*pw-SAPS_DELAY);
             decrgpulse(pwC,zero,0.0,0.0);
             sim3pulse(0.0,2.0*pwC,2.0*pwN, zero,one,zero, 0.0, 0.0);
             decrgpulse(pwC,zero,0.0,0.0);
             delay(d2/2.0-pwN-pwC-0.64*pw-rof1);
            }
           else
            delay(d2-4.0*pw/PI-SAPS_DELAY-rof1);
         }
       }
      else if ((C13refoc[A] == 'n') && (N15refoc[A] == 'y') && (CNrefoc[A] == 'n'))
       {
       if (d2/2.0 > (pwN + 0.64*pw+rof1))  
        {
           delay(d2/2.0-pwN-0.64*pw-SAPS_DELAY);
           dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
           delay(d2/2.0-pwN-0.64*pw-rof1);
        }
       else
           delay(d2-1.28*pw-SAPS_DELAY-rof1);
       }

      else if ((C13refoc[A] == 'y') &&  (N15refoc[A] == 'n') && (CNrefoc[A] == 'n'))
       {
        if (d2/2.0 > (2.0*pwC + 0.64*pw +rof1))  
         {
           delay(d2/2.0-2.0*pwC-0.64*pw-SAPS_DELAY);
           decrgpulse(pwC,zero,0.0,0.0);
           decrgpulse(2.0*pwC, one, 0.0, 0.0);
           decrgpulse(pwC,zero,0.0,0.0);
           delay(d2/2.0-2.0*pwC-0.64*pw-rof1);
         }
        else
           delay(d2-1.28*pw-SAPS_DELAY -rof1);
       }
      else
       {
          abort_message("C13refoc, N15refoc, and CNrefoc must be nnn, nny, nyn, or ynn");
       }
      }
      rgpulse(pw,v5,rof1,1.0e-6);
   status(C);
      decpower(dpwr); dec2power(dpwr2);  
      if (satmode[C] == 'y')
      {
       if (mfsat[C] == 'y')
        {obsunblank(); mfpresat_on(); delay(mix*0.7); mfpresat_off(); obsblank();
         zgradpulse(gzlvl2,gt2);
         obsunblank(); mfpresat_on(); delay(mix*0.3-gt2); mfpresat_off(); obsblank();}
       else
        {
         obspower(satpwr);
         rgpulse(mix*0.7,v8,rof1,rof1);   
         zgradpulse(gzlvl2,gt2);
         rgpulse(mix*0.3-gt2,v8,rof1,rof1);  
        }
       obspower(tpwr);
      }
      else
      {
         delay(mix*0.7);
         zgradpulse(gzlvl2,gt2);
         delay(mix*0.3-gt2);
      }
   status(D);
      rgpulse(pw,v9,rof1,rof2);

/*  Phase cycle: .satdly(t1)..pw(t2)..d2..pw(t3)..mix(t4)..pw(t5)..at(t6)
    (for phase=1; for phase=2 incr t1 + t2; for TPPI add two to t1,t2,t6)

    t1 = 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3
    t2 = 2 0 2 0 2 0 2 0 3 1 3 1 3 1 3 1 2 0 2 0 2 0 2 0 3 1 3 1 3 1 3 1
    t3 = 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3
    t4 = 3 3 1 1 0 0 2 2 0 0 2 2 1 1 3 3 3 3 1 1 0 0 2 2 0 0 2 2 1 1 3 3 
    t5 = 0 0 2 2 1 1 3 3 1 1 3 3 2 2 0 0 0 0 2 2 1 1 3 3 1 1 3 3 2 2 0 0
    t6 = 0 2 2 0 1 3 3 1 1 3 3 1 2 0 0 2 2 0 0 2 3 1 1 3 3 1 1 3 0 2 2 0  */
}
Esempio n. 3
0
pulsesequence()
{



    /* DECLARE AND LOAD VARIABLES */

    char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
                mag_flg[MAXSTR],       /*magic-angle coherence transfer gradients */
                f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
                C13refoc[MAXSTR],		/* C13 sech/tanh pulse in middle of t1*/
                NH2only[MAXSTR];		       /* spectrum of only NH2 groups */


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

    double      tau1,         				         /*  t1 delay */
                mix = getval("mix"),		 	    /* NOESY mix time */
                tau2,        				         /*  t2 delay */
                lambda = 0.94/(4.0*getval("JNH")),	    /* 1/4J H1 evolution delay */
                tNH = 1.0/(4.0*getval("JNH")),	  /* 1/4J N15 evolution delay */
                csa, sna,
                pra = M_PI*getval("pra")/180.0,
                /* temporary Pbox parameters */
                bw, pws, ofs, ppm, nst,  /* bandwidth, pulsewidth, offset, ppm, # steps */
                /* the sech/tanh pulse is automatically calculated by the macro "biocal", */
                /* and is called directly from your shapelib.                  		      */
                pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
                pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
                rf0,            	          /* maximum fine power when using pwC pulses */
                rfst,	                           /* fine power for the stCall pulse */
                compH = getval("compH"),         /* adjustment for H1 amplifier compression */
                compC = getval("compC"),         /* adjustment for C13 amplifier compression */
                dof100,	      /* C13 frequency at 100ppm for both aliphatic & aromatic*/

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

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

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

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

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

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

    csa = cos(pra);
    sna = sin(pra);


    /*   LOAD PHASE TABLE    */

    settable(t1,2,phi1);
    settable(t3,4,phi3);

    settable(t9,16,phi9);
    settable(t10,1,phi10);
    settable(t11,8,rec);




    /*   INITIALIZE VARIABLES   */

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

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

    if (autocal[0] == 'n')
    {
        /* 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);
            }
        }
    }
    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("stC200", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
            }
            ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
        }
        if (C13refoc[A]=='y') rfst = stC200.pwrf;
    }

    /* 180 degree adiabatic C13 pulse from 0 to 200 ppm */
    dof100 = dof + 65.0*dfrq;

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




    /* CHECK VALIDITY OF PARAMETER RANGES */

    if ( (mix - gt4 - gt5) < 0.0 )
    {   text_error("mix is too small. Make mix equal to %f or more.\n",(gt4 + gt5));
        psg_abort(1);
    }

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

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

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

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

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



    /* PHASES AND INCREMENTED TIMES */

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

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


    /*  Set up f1180  */

    PRexp = 0;
    if((pra > 0.0) && (pra < 90.0)) PRexp = 1;

    if(PRexp)                /* set up Projection-Reconstruction experiment */
        tau1 = d2*csa;
    else
        tau1 = d2;
    if((f1180[A] == 'y') && (ni > 1.0))
    {
        tau1 += ( 1.0 / (2.0*sw1) );
        if(tau1 < 0.2e-6) tau1 = 0.0;
    }
    tau1 = tau1/2.0;


    /*  Set up f2180  */

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


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

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

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



    /*  Correct inverted signals for NH2 only spectra  */

    if (NH2only[A]=='y')
    {
        tsadd(t3,2,4);
    }



    /* BEGIN PULSE SEQUENCE */

    status(A);
    obspower(tpwr);
    decpower(pwClvl);
    dec2power(pwNlvl);
    decoffset(dof);
    decpwrf(rf0);
    txphase(zero);
    dec2phase(zero);

    delay(d1);

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

    txphase(t1);
    decphase(zero);
    dec2phase(zero);
    initval(135.0,v1);
    obsstepsize(1.0);
    xmtrphase(v1);
    delay(5.0e-4);
    rcvroff();


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

    xmtrphase(zero);					/* SAPS_DELAY */
    txphase(zero);


    if (tau1 > (2.0*GRADIENT_DELAY + pwN + 0.64*pw + 5.0*SAPS_DELAY))
    {
        if (tau1>0.002)
        {
            zgradpulse(gzlvl6, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
            delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw) - SAPS_DELAY);
        }
        else
        {
            delay(tau1-pwN-0.64*pw);
        }
        if (C13refoc[A]=='y')
            sim3pulse(0.0, 2.0*pwC, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
        else
            dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
        if (tau1>0.002)
        {
            zgradpulse(-1.0*gzlvl6, 0.8*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw));
            delay(0.2*(tau1 - 2.0*GRADIENT_DELAY - pwN - 0.64*pw) - SAPS_DELAY);
        }
        else
        {
            delay(tau1-pwN-0.64*pw);
        }
    }
    else if (tau1 > (0.64*pw + 0.5*SAPS_DELAY))
        delay(2.0*tau1 - 2.0*0.64*pw - SAPS_DELAY );

    rgpulse(pw, zero, 0.0, 0.0);

    delay(mix - gt4 - gt5 -gstab -200.0e-6);
    dec2rgpulse(pwN, zero, 0.0, 0.0);
    zgradpulse(gzlvl4, gt4);
    delay(gstab);

    rgpulse(pw, zero, 200.0e-6,0.0);			       /* HSQC begins */

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

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

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

    rgpulse(pw, one, 0.0, 0.0);
    txphase(two);
    if (tpwrsf<4095.0)
    {
        obspower(tpwrs+6.0);
        obspwrf(tpwrsf);
        shaped_pulse("H2Osinc", pwHs, two, 5.0e-4, 0.0);
        obspower(tpwr);
        obspwrf(4095.0);
    }
    else
    {
        obspower(tpwrs);
        shaped_pulse("H2Osinc", pwHs, two, 5.0e-4, 0.0);
        obspower(tpwr);
    }
    zgradpulse(gzlvl3, gt3);
    dec2phase(t3);
    decpwrf(rfst);
    decoffset(dof100);
    delay(2.0e-4);
    dec2rgpulse(pwN, t3, 0.0, 0.0);
    decphase(zero);


    /*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

    txphase(zero);
    dec2phase(t9);

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

        delay(tau2);

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

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

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

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

    /*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */

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

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

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

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

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

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

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

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

    rgpulse(pw, zero, 0.0, 0.0);

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

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

    setreceiver(t11);
}
Esempio n. 4
0
void pulsesequence()
{
/* DECLARE VARIABLES */

 char        shape_ss[MAXSTR];
             
 int	     t1_counter;

 double   
             tau1,                  /* t1/2  */
  	     taua = getval("taua"),     /* 2.25ms  */
  	     taub = getval("taub"),     /* 2.75ms  */
             time_T1,
             pwN,                   /* PW90 for N-nuc            */
             pwNlvl,                /* power level for N hard pulses */
        ncyc = getval("ncyc"),
   	compH= getval("compH"),
   	pwHs = getval("pwHs"),	        /* H1 90 degree pulse length at tpwrs */
   	tpwrs ,                    /* power for the pwHs ("H2Osinc") pulse */
   	tpwrsf ,                   /* fine power for the pwHs ("H2Osinc") pulse */
        shss_pwr,             /* power for cos modulated NH pulses */
        pw_shpss=getval("pw_shpss"),
        waterdly,              /* pw for water pulse  */
        waterpwrf,             /* fine power for water pulse  */
        waterpwr,              /* power for water pulse  */
  gt0,
  gt1 = getval("gt1"),
  gt2 = getval("gt2"),
  gt3 = getval("gt3"),
  gt4 = getval("gt4"),
  gt5 = getval("gt5"),
  gt6 = getval("gt6"),
  gzlvl0 = getval("gzlvl0"),
  gzlvl1 = getval("gzlvl1"),
  gzlvl2 = getval("gzlvl2"),
  gzlvl3 = getval("gzlvl3"),
  gzlvl4 = getval("gzlvl4"),
  gzlvl5 = getval("gzlvl5"),
  gzlvl6 = getval("gzlvl6");

/* LOAD VARIABLES */

  pwN = getval("pwN");
  pwNlvl = getval("pwNlvl"); 
  tpwrsf = getval("tpwrsf");
  waterpwrf = getval("waterpwrf");
  waterdly = getval("waterdly");


  getstr("shape_ss",shape_ss);
  
  time_T1=ncyc*(2.0*2.5e-3+pw_shpss);
  
  if (ix==1) printf(" ncyc= %f,   time_T1= %f \n", ncyc,time_T1);    


    /* 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 watergate pulse */
        waterpwr = tpwr - 20.0*log10(waterdly/(compH*pw));  
	waterpwr = (int) (waterpwr);        

    /* selective cos modulated NH 180 degree pulse */
        shss_pwr = tpwr - 20.0*log10(pw_shpss/((compH*2*pw)*2));   /* needs 2 times more */
	shss_pwr = (int) (shss_pwr);                   /* power than a square pulse */




/* check validity of parameter range */

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

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

    if (dmm2[A] == 'g' || dmm2[B] == 'g' || dmm2[C] == 'g')
	{
	printf("incorrect Dec2 decoupler flag! dmm2 should be 'ccc' ");
	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(gt1 > 15.0e-3 || gt2 > 15.0e-3 || gt3 > 15.0e-3 || gt4 > 15.0e-3)
    {
        printf("gti must be less than 15 ms \n");
        psg_abort(1);
    }


/* LOAD VARIABLES */

  settable(t1, 8, phi1);
  settable(t2, 4, phi2);
  settable(t3, 1, phi3);
  settable(t10, 8, phi10);

  settable(t14, 8, rec);
  
  

/* Phase incrementation for hypercomplex data */

   if ( phase1 == 2 )     /* Hypercomplex in t1 */
   {     ttadd(t14,t10,4);
         tsadd(t3,2,4); 
    }

       
/* calculate modification to phases based on current t1 values
   to achieve States-TPPI acquisition */
 
 
   if(ix == 1)
      d2_init = d2;
      t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5);

      tau1=0.5*d2;	
	
      if(t1_counter %2) {
        tsadd(t2,2,4);
        tsadd(t14,2,4);
      }
      
 
/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tpwr);               /* Set power for pulses  */
   dec2power(pwNlvl);            /* Set decoupler2 power to pwNlvl */

   initval(ncyc+0.1,v10);  /* for DIPSI-2 */

 delay(d1);

status(B);
  rcvroff();

/*destroy N15  magnetization*/	

   	dec2rgpulse(pwN, zero, 0.0, 0.0);

	zgradpulse(gzlvl1, gt1);
	delay(9.0e-5);

/*  1H-15N INEPT  */

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

  txphase(zero);  dec2phase(zero);
  zgradpulse(gzlvl2,gt2);
  delay(taua -pwN-0.5*pw  -gt2 );               /* delay=1/4J(NH)   */

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

  txphase(one);  dec2phase(t1);
  zgradpulse(gzlvl2,gt2);
  delay(taua -1.5*pwN  -gt2);               /* delay=1/4J(NH)   */

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


  if (tpwrsf < 4095.0)
     {obspwrf(tpwrsf); tpwrs=tpwrs+6.0;}

	obspower(tpwrs); 
   	shaped_pulse("H2Osinc", pwHs, two, 2.0e-6, 0.0);   
	obspower(tpwr); obspwrf(4095.0); tpwrs=tpwrs-6.0; 
 
  txphase(zero);  dec2phase(zero);
  zgradpulse(gzlvl3,gt3);
  delay(taub -1.5*pwN  -gt3 -pwHs-2.0e-6-2.0*POWER_DELAY-WFG_START_DELAY);               /* delay=1/4J(NH)   */

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

  dec2phase(one);
  zgradpulse(gzlvl3,gt3);
  delay(taub -1.5*pwN  -gt3 );               /* delay=1/4J(NH)   */
  dec2phase(one);

  dec2rgpulse(pwN,one,0.0,0.0);
  
/* relaxation recovery */

      if (ncyc>0.6)
      {
         obspower(shss_pwr); 
         
         starthardloop(v10);
	    delay(2.5e-3);
	    shaped_pulse(shape_ss,pw_shpss,zero,0.0,0.0);
	    delay(2.5e-3);
         endhardloop();  
      
         obspower(tpwr);
      } 

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


  dec2rgpulse(pwN,t2,0.0,0.0);
 
  txphase(t3); dec2phase(zero);
  
/*  evolution of t1  */

  if(d2>0.001)
  {  
     zgradpulse( gzlvl0,(d2/2.0-0.0003-2.0*GRADIENT_DELAY));
     delay(300.0e-6);
     zgradpulse(-gzlvl0,(d2/2.0-0.0003-2.0*GRADIENT_DELAY));
     delay(300.0e-6);
  }
  else
     delay(d2);

  
/* ST2   */

  rgpulse(pw,t3,0.0,0.0);

  txphase(t3);
  if (waterpwrf < 4095.0)
     {obspwrf(waterpwrf); waterpwr=waterpwr+6.0;}
  obspower(waterpwr);

  rgpulse(waterdly,t3,0.0,rof1);
  if (waterpwrf < 4095.0)
     {obspwrf(4095.0); waterpwr=waterpwr-6.0;}

  obspower(tpwr); 
  txphase(zero); 

  zgradpulse(gzlvl4,gt4);
  delay(taua -pwN -0.5*pw -gt4-waterdly-rof1);           

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

  dec2phase(t3);
  zgradpulse(gzlvl4,gt4);
  delay(taua -1.5*pwN  -gt4  -waterdly-rof1);               /* delay=1/4J(NH)   */

  if (waterpwrf < 4095.0)
     {obspwrf(waterpwrf); waterpwr=waterpwr+6.0;}
  obspower(waterpwr);
  txphase(two);

  rgpulse(waterdly,two,rof1,0.0);  
  if (waterpwrf < 4095.0)
     {obspwrf(4095.0); waterpwr=waterpwr-6.0;}

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

/*  watergate   */

  zgradpulse(gzlvl5,gt5);
 
  delay(taua-1.5*pwN-waterdly-gt5);
  txphase(two);
  if (waterpwrf < 4095.0)
     {obspwrf(waterpwrf); waterpwr=waterpwr+6.0;}
  obspower(waterpwr);
  dec2phase(zero);     

  rgpulse(waterdly,two,0.0,rof1);
  if (waterpwrf < 4095.0)
     {obspwrf(4095.0); waterpwr=waterpwr-6.0;}
  
  obspower(tpwr);
  txphase(zero); 
 
  sim3pulse(2.0*pw,0.0e-6,2*pwN,zero,zero,zero,0.0,0.0);

  if (waterpwrf < 4095.0)
     {obspwrf(waterpwrf); waterpwr=waterpwr+6.0;}
  obspower(waterpwr);
  txphase(two);

  rgpulse(waterdly,two,rof1,0.0);  
  if (waterpwrf < 4095.0)
     {obspwrf(4095.0); waterpwr=waterpwr-6.0;}

  zgradpulse(gzlvl5,gt5);
  obspwrf(4095.0); obspower(tpwr);
  delay(taua-1.5*pwN-waterdly-gt5);       

  dec2rgpulse(pwN,zero,0.0,0.0);

  
/* acquire data */

status(C);
     setreceiver(t14);
}
Esempio n. 5
0
void pulsesequence()
{
/* DECLARE VARIABLES */

 char      
 	     f1180[MAXSTR],f2180[MAXSTR],satmode[MAXSTR];

 int	     icosel,t1_counter,t2_counter,first_FID;

 double      /* DELAYS */
             tau1,                                 /* t1/2 */
             tau2,                                 /* t2/2 */

             /* COUPLINGS */
             jhn = getval("jhn"), tauhn,
             jnco = getval("jnco"), taunco,
             jcoca = getval("jcoca"), taucoca,
             jnca = getval("jnca"), taunca,
             jhaca = getval("jhaca"), tauhaca,
             jcaha = getval("jcaha"), taucaha,
             jcacb = getval("jcacb"), taucacb,
   
             /* PULSES */
             pwN = getval("pwN"),               /* PW90 for N-nuc */
             pwC = getval("pwC"),               /* PW90 for C-nuc */
             pwHs = getval("pwHs"),           /* pw for water selective pulse at twprsl */

             /* POWER LEVELS */
             satpwr = getval("satpwr"),       /* low power level for presat */
             tpwrsf_d = getval("tpwrsf_d"),   /* fine power level "down" flipback pulse*/
             tpwrsf_u = getval("tpwrsf_u"),   /* fine power level "up" flipback pulse*/
	     tpwrs,                          /* power level for selective pulse for water */
             tpwrd,pwHd,                     /* power/pulse width for decoupling */
             pwClvl = getval("pwClvl"),         /* power level for C hard pulses */ 
             compH = getval("compH"),           /* compression factor   */
             compC = getval("compC"),           /* compression factor   */
             pwNlvl = getval("pwNlvl"),         /* power level for N hard pulses */
             rf90onco, pw90onco,          /* power level/width for CO 90 pulses */ 
             rf180onco, pw180onco,        /* power level/width for CO 180 pulses */
             rf180offca, pw180offca,      /* power level/width for off-res Ca 180 pulses */

             /* CONSTANTS */
             lambda = getval("lambda"),     /* J scaling factor */
             kappa,                         /* semi constant-time factor */
             ni2=getval("ni2"),
             waltzB1 = getval("waltzB1"),  /* waltz16 field strength (in Hz)     */

             /* GRADIENT DELAYS AND LEVES */
             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");

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

/* LOAD VARIABLES */

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

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

/* INITIALIZE VARIABLES */

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

   if (phase1 == 2)     	/* Hypercomplex in t1 */
      {
        tsadd(t4, 1, 4);
      }  
   
  if (phase1 == 4)           /* Hypercomplex in t1 */
     {
        tsadd(t4, 1, 4);
     }
   
     kappa=(taunco - tauhn)/(0.5*ni2/sw2)-0.001;
         if (kappa > 1.0) 
     {  
	                      kappa=1.0-0.01;
     }   
   
          if (phase2 == 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(t4,2,4);
        tsadd(t7,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(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;
   
/* 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) );
   tau2 = tau2/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;   /* nominal tpwrsf_d ~ 2048 */
         /* tpwrsf_d,tpwrsf_u can be used to correct for radiation damping  */

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

status(B);

   rcvroff();

   decpwrf(rf90onco);   /* Set decoupler1 power to rf90onco */
   sim3pulse(0.0,pw90onco,pwN,zero,zero,zero,rof1,rof1);  /* 90 for 15N and 13C' */

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

  /* transfer from HN to N by INEPT */
   
  /* shaped pulse for water flip-back */
         obspower(tpwrs); obspwrf(tpwrsf_d);
         shaped_pulse("H2Osinc_d",pwHs,one,2.0e-6,0.0);
         obspower(tpwr); obspwrf(4095.0);
  /* shaped pulse */

  rgpulse(pw,zero,rof1,0.0);

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

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

  rgpulse(pw,three,rof1,0.0);   /* 90 1H */
   
  zgradpulse(gzlvl3,gt3);
  delay(gstab);
   
  decpwrf(rf180onco);   /* Set decoupler power to rf180onco */
  dec2rgpulse(pwN,zero,0.0,0.0);   /* 90 15N */

/* start transfer from N to CO */

  delay(5.5e-3 - pwHd - POWER_DELAY - PRG_START_DELAY); /* 1/(2JHN) */
  
  obspower(tpwrd);
  rgpulse(pwHd,one,rof1,0.0);
  txphase(zero);
  obsprgon("waltz16", pwHd, 90.0);
  xmtron();

   
   delay(taunco - 5.5e-3 - 0.5*pw180onco);  /* 1/(4JNCO) - 1/(2JHN) */

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

   delay(taunco - 5.5e-3 - 0.5*pw180onco); /* 1/(4JNCO) - 1/(2JHN) */

 /* turn proton decoupling off */ 
      xmtroff();
      obsprgoff();
      rgpulse(pwHd,three,rof1,0.0);
      obspower(tpwr);
 /* turned proton decoupling off */
   
   delay(5.5e-3 - PRG_STOP_DELAY - pwHd - POWER_DELAY); /* 1/(2JHN) */
   
/* Start in-phase filter */

   if (( phase1 == 1 || phase1 == 2))
      {

       dec2rgpulse(pwN,one,0.0,0.0);   /* 90 15N */

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

        /* shaped pulse WATER-FLIP-back */
             obspower(tpwrs); obspwrf(tpwrsf_d);
             shaped_pulse("H2Osinc_d",pwHs,one,rof1,0.0);
             obspower(tpwr); obspwrf(4095.0);
        /* shaped pulse */

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

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

	delay(0.5*tauhn - gt0 - gstab);  /* 1/(8JNH) */
        dec2rgpulse(2.0*pwN,zero,0.0,0.0); /* 180 15N */
	delay(0.5*tauhn - gt0 - gstab);  /* 1/(8JNH) */

        zgradpulse(gzlvl0*1.1,gt0);
        delay(gstab);
	
        rgpulse(2.0*pw,zero,rof1,rof1); /* 180 1H */

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

	delay(0.5*tauhn - gt0 -gstab); /* 1/(8JNH) */
        dec2rgpulse(2.0*pwN,zero,0.0,0.0); /* 180 15N */
        delay(0.5*tauhn - gt0 -gstab); /* 1/(8JNH) */


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

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

        /* shaped pulse WATER-FLIP-back */
             obspower(tpwrs); obspwrf(tpwrsf_u);
             shaped_pulse("H2Osinc_u",pwHs,three,rof1,0.0);
             obspower(tpwr); obspwrf(4095.0);
        /* shaped pulse */

      }

/* start antiphase filter */

    if (( phase1 == 3 || phase1 == 4 ))
      {

        dec2rgpulse(pwN,one,0.0,0.0);  /* 90 15N */

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

        /* shaped pulse WATER-FLIP-back */
             obspower(tpwrs); obspwrf(tpwrsf_d);
             shaped_pulse("H2Osinc_d",pwHs,zero,rof1,0.0);
             obspower(tpwr); obspwrf(4095.0);
        /* shaped pulse */

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


        zgradpulse(gzlvl0*0.9,gt0);
        delay(gstab);
	
	delay(tauhn - gt0 - gstab - 2.0*pwN); /* 1/(4JNH) */
        sim3pulse(2.0*pw,0.0,2.0*pwN,zero,zero,zero,rof1,rof1); /* 180 1H and 15N */
	delay(tauhn - gt0 - gstab - 2.0*pwN); /* 1/(4JNH) */
	

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

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

        /* shaped pulse WATER-FLIP-back */
             obspower(tpwrs); obspwrf(tpwrsf_u);
             shaped_pulse("H2Osinc_u",pwHs,three,rof1,0.0);
             obspower(tpwr); obspwrf(4095.0);
        /* shaped pulse */
      }

/* End of filter section */

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

	rgpulse(2.0*pw,zero,rof1,0.0);
        decpwrf(rf90onco);      /* Set decoupler power to rf90onco */
        decrgpulse(pw90onco,t4,0.0,0.0);   /* 90 for 13C */

/* record 13C' frequences and 13C'-15N coupling */

      delay(tau1);
      decpwrf(rf180offca);      /* Set decoupler power to rf180offca */
      simshaped_pulse("","offC3",2.0*pw,pw180offca,zero,zero,rof1,rof1); /* 180 for 1H and 13CA */
      decphase(zero);
      decpwrf(rf180onco);   
      delay(tau1);
      if (lambda>0.0)
      {
       delay(lambda*tau1);
       sim3pulse(0.0,pw180onco,2.0*pwN,zero,t5,zero,0.0,0.0);
       delay(lambda*tau1);
      } 
      else decrgpulse(pw180onco,t5,0.0,0.0);
   
      decpwrf(rf180offca); /* Set decoupler power to rf180offca */
      simshaped_pulse("","offC3",0.0,pw180offca,zero,zero,0.0,0.0); /* 180 CA */  
      decphase(zero);
      decpwrf(rf90onco); 
   
/* start reverse transfer from CO to N by INEPT */

       decrgpulse(pw90onco,zero,0.0,0.0); /* 90 for 13C' */
   
       zgradpulse(gzlvl3*0.7,gt3);
       delay(gstab);
     
       dec2rgpulse(pwN,t1,0.0,0.0);  	  /* 90 for 15N */
   
       delay((taunco - tauhn) - kappa*tau2);  /* 1/4J(NCO) - 1/4J(NH) - kt2/2 */
         
       dec2rgpulse(2.0*pwN,zero,0.0,0.0);     /* 180 for 15N */
             
       delay((1-kappa)*tau2);        /* (1-k)t2/2 */
      
       decpwrf(rf180onco);
       decrgpulse(pw180onco,zero,0.0,0.0);     /* 180 for 13C' */
       decpwrf(rf180offca);
   
       delay(taunco - tauhn - gt1 - gstab - pw180onco - pw180offca - 3.0*POWER_DELAY);
         
       zgradpulse(gzlvl1,gt1);
       delay(gstab);
   
       decshaped_pulse("offC3",pw180offca,zero,0.0,0.0);
         
       delay(tau2);                            /* t2/2 */
   
      /* start TROSY transfer from N to HN */
         
        rgpulse(pw,t2,rof1,0.0); /* 180 for 1H */
             
        zgradpulse(gzlvl5,gt5);
        delay(gstab);
    
        delay(tauhn - gt5 - gstab );
   
        decpwrf(rf180onco);
        sim3pulse(2.0*pw,pw180onco,2.0*pwN,zero,zero,zero,rof1,rof1);
      
        delay(tauhn - gt5 - gstab );
               
        zgradpulse(gzlvl5,gt5);
        delay(gstab);
   
        decpwrf(rf90onco);
        sim3pulse(pw,pw90onco,pwN,one,t6,zero,rof1,0.0);
   
      /* shaped pulse for water flip-back */
         obspower(tpwrs); obspwrf(tpwrsf_u);
         shaped_pulse("H2Osinc_u",pwHs,t2,rof1,0.0);
         obspwrf(4095.0);
         obspower(tpwr);
      /* shaped pulse */
   
        zgradpulse(gzlvl5*0.9,gt5);
        delay(gstab);
         
        delay(tauhn - gt5 - gstab - POWER_DELAY - pwHs);
      
        sim3pulse(2.0*pw,0.0,2.0*pwN,zero,zero,zero,rof1,rof1);
   
        delay(tauhn - gt5 - gstab );
      
        decpower(dpwr);
         
        zgradpulse(gzlvl5*0.9,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);
         
     /* acquire data */
         
      status(C);
        setreceiver(t7);
}
Esempio n. 6
0
pulsesequence()
{
  double gzlvl1,
         gt1,
         gzlvl3,
         gt3,
         gstab,
	 pwx2lvl,
	 pwx2,
	 tau,
	 gtau,
	 hsglvl,
	 hsgt;
  char   nullflg[MAXSTR],
	 sspul[MAXSTR];
  int    iphase,
         icosel;

  gzlvl1 = getval("gzlvl1");
  gt1 = getval("gt1");
  gzlvl3 = getval("gzlvl3");
  gt3 = getval("gt3");
  pwx2lvl = getval("pwx2lvl");
  pwx2 = getval("pwx2");
  hsglvl = getval("hsglvl");
  hsgt = getval("hsgt");
  gstab = getval("gstab");
  getstr("nullflg",nullflg);
  getstr("sspul",sspul);
  iphase = (int)(getval("phase")+0.5);
  icosel = 1;
  tau = 1/(2*(getval("j1xh")));
  gtau =  2*gstab + GRADIENT_DELAY;

  if (tau < (gt3+gstab))
  {
    text_error("tau must be greater than gt3+gstab\n");
    psg_abort(1);
  }

  settable(t1,2,ph1);
  settable(t2,4,ph2);
  settable(t3,4,ph3);

  assign(zero,v4);
  getelem(t1,ct,v1);
  getelem(t3,ct,oph);

  if (iphase == 2)
	icosel = -1;

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

  status(A);
     dec2power(pwx2lvl);

     if (sspul[0] == 'y')
     {
        zgradpulse(hsglvl,hsgt);
        rgpulse(pw,zero,rof1,rof1);
        zgradpulse(hsglvl,hsgt);
     }

     delay(d1);

  status(B);

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

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

     dec2rgpulse(pwx2,v1,rof1,1.0e-6);
     delay(gt1+gtau - (2*pwx2/PI) - pwx2 - 1.0e-6 - rof1);
     dec2rgpulse(2*pwx2,v4,rof1,1.0e-6);
     delay(gstab - pwx2 - 1.0e-6);
     zgradpulse(gzlvl1,gt1);
     delay(gstab - rof1 - pw);
     delay(d2/2);
     rgpulse(2.0*pw,zero,rof1,rof1);
     delay(d2/2);

     delay(gstab - rof1 - pw);
     zgradpulse(gzlvl1,gt1);
     delay(gstab - pwx2 - rof1);
     dec2rgpulse(2*pwx2,zero,rof1,1.0e-6);
     delay(gt1+gtau - (2*pwx2/PI) - pwx2 - 1.0e-6 - rof1);
     dec2rgpulse(pwx2,t2,rof1,rof1);

     delay(gstab - rof1);
     zgradpulse(icosel*gzlvl3,gt3);
     delay(tau - gt3 - gstab - GRADIENT_DELAY);
     dec2power(dpwr2);
     delay(rof2 - POWER_DELAY);
     rcvron();

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

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

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

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

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

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

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

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

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

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

/* LOAD VARIABLES */


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

  getstr("sel_flg",sel_flg);

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

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

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

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

     getstr("cbdecseq", cbdecseq);

/* LOAD PHASE TABLE */

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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


/* PHASES AND INCREMENTED TIMES */


   /* Set up angles and phases */

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

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

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

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

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

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

/* Set up hyper complex */

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

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

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

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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


/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

   rcvroff();
   lk_hold();

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


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

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

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

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

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

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

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

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

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

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

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

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

   dec2rgpulse(pwN,zero,0.0,0.0);

   delay( zeta + pwS4 );

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

   delay(zeta - 2.0e-6);

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

  }

   else {

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

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


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

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

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

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

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

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

   delay(zeta - 2.0e-6);

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

  }

   dec2phase(zero); decphase(zero);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   decoff();
   decprgoff();
}

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

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

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

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

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

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

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

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

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

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

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

   delay(0.2e-6);

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


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

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

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

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

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

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

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

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

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

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

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

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

   dec2phase(t3);

   delay(bigTN - tau3 + pwS4);

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

   txphase(zero);
   dec2phase(t4);

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

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

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

   delay(tau3);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* BEGIN ACQUISITION */

status(C);
         setreceiver(t6);

}
Esempio n. 8
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values

   GP inept = getinept("ineptYX");
   strncpy(inept.ch1,"dec2",4);
   strncpy(inept.ch2,"obs",3);
   putCmd("ch1YXinept='dec2'\n");
   putCmd("ch2YXinept='obs'\n");

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

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

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

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

// Dutycycle Protection

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

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

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

// Set Phase Tables

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

// Begin Sequence

   txphase(ph1Xyxinept); decphase(zero); dec2phase(phY90);
   obspwrf(getval("aXyxinept")); dec2pwrf(getval("aY90"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// Y Direct Polarization

   _dseqon(mix);
   dec2rgpulse(getval("pwY90"),phY90,0.0,0.0);

// INEPT Transfer from Y to X

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

// Begin Acquisition

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

/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
             Cfilter[MAXSTR];     /*do C' Cfilter */
 
int         icosel,          			  /* used to get n and p type */
            t1_counter;  		        /* used for states tppi in t1 */

double tCN = getval("tCN"), 
		kappa, /*semi-constant time scale factor*/
		tau1,         				         /*  t1 delay */
	    lambda = 0.91/(4.0*getval("JNH")), 	   /* 1/4J H1 evolution delay */
        

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

	pwC3 = getval("pwC3"), /* 180 selective Ca null on C' */
	pwC8 = getval("pwC8"), /* 180 selective C' null on Ca */
	pwC6 = getval("pwC6"), /* 90 selective C' null on Ca */
	rf3,
	rf8,
	rf6,

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


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

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

	sw1 = getval("sw1"),

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

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

    getstr("f1180",f1180);
	getstr("Cfilter",Cfilter);

/*   LOAD PHASE TABLE    */

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


/*   INITIALIZE VARIABLES   */

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

    /* 180 degree square pulse on Ca, null at CO 118ppm away */
    rf3 = (1/compC*compC*4095.0*pwC*2.0)/pwC3; /* no need for compC at high power level*/
	rf3 = (int) (rf3 + 0.5);

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

  if((dm2[A] == 'y' || dm2[B] == 'y'))
  { 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 )
  { text_error("dont fry the probe, pwN too high ! ");              psg_abort(1); }



/* PHASES AND INCREMENTED TIMES */

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

	if (phase1 == 1)   	 icosel = -1;
        else 	  {  tsadd(t3,2,4);  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(t1,2,4); tsadd(t4,2,4); }

	kappa = tCN>ni/sw1? 1:tCN/(ni/sw1);
	kappa = ((double)((int)(kappa*1000)))/1000; 
       /* 3 digits after the point, may cause a small decrease in value for safe boundary */

	printf("kappa = %f\n", kappa);

/* BEGIN PULSE SEQUENCE */

status(A);

	obspower(tpwr);
	decpower(pwClvl);
	decpwrf(rf0);
 	dec2power(pwNlvl);
	txphase(zero);
        decphase(zero);
        dec2phase(zero);

	delay(d1);

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

 

/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */
    rcvroff();

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

	/*dec2rgpulse(pwN, one, 0.0, 0.0); */
	zgradpulse(0.7*gzlvl0, 0.5e-3);
	txphase(t1);
	delay(5.0e-4);

 
   	rgpulse(pw,zero,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, three, 0.0, 0.0);
	txphase(two);

         obspower(tpwrs+6.0);
           obspwrf(tpwrsf_n);
   	   shaped_pulse("H2Osinc_n", pwHs, zero, 5.0e-5, 0.0);
	 obspower(tpwr); obspwrf(4095.0);

	zgradpulse(gzlvl3, gt3);
	dec2phase(t1);
	delay(gstab);
	decpwrf(rf8);   
   	dec2rgpulse(pwN, t1, 0.0, 0.0);
	txphase(zero);
	decphase(zero);


/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

	txphase(zero);
	dec2phase(zero);

/* shared CT for C' Cfilter and N15 chem shift evolution */
	delay(tCN/2.0 - kappa*tau1 - gt5 -gstab);
	zgradpulse(gzlvl5,gt5);
	delay(gstab);
	if(Cfilter[A] == 'y' && (1-kappa)*tau1 < pwC8/2) {
		sim3shaped_pulse("", "offC8", "", 0.0, pwC8, 2.0*pwN, zero, zero, zero,0.0,0.0);
		zgradpulse(gzlvl5,gt5);
	    delay(tCN/2.0 + (1-kappa)*tau1 -gt5 - pwC3 - pwC8);
	}
	else if (Cfilter[A] == 'y' && (1-kappa)*tau1 >= pwC8/2){
		dec2rgpulse(2.0*pwN,zero,(pwC8-2.0*pwN)/2.0,(pwC8-2.0*pwN)/2.0);
		if( (1-kappa)*tau1 >= gt5 +gstab + pwC8/2){
			zgradpulse(gzlvl5,gt5);
			delay((1-kappa)*tau1 -pwC8/2.0 - gt5);
			decshaped_pulse("offC8", pwC8,zero,0.0,0.0); 
			delay(tCN/2.0 - pwC3 - 1.5*pwC8);
		}
		else{
			delay((1-kappa)*tau1 -pwC8/2.0);
			decshaped_pulse("offC8", pwC8,zero,0.0,0.0);
			zgradpulse(gzlvl5,gt5); 
			delay(tCN/2.0 -gt5 - pwC3 - 1.5*pwC8);
		}			
	}
	else{
		dec2rgpulse(2.0*pwN,zero,(pwC8-2.0*pwN)/2.0,(pwC8-2.0*pwN)/2.0);
		zgradpulse(gzlvl5,gt5);
	   delay(tCN/2.0 + (1-kappa)*tau1 -gt5 - pwC3 - pwC8);
	}
	

	decpwrf(rf3);
	decshaped_pulse("offC3", pwC3, zero,0.0, 0.0);
	decpwrf(rf8);
	if(Cfilter[A] == 'y'){
		delay(pwC8);
	}
	else {
		decshaped_pulse("offC8", pwC8,zero,0.0,0.0); 
	}

	delay(tau1);
	
	/* gradient for coherence selection and H(z)N(x/y)C(x/y) destruction  */
	decpwrf(rf6);
	if(Cfilter[A] == 'y' ){
		decshaped_pulse("offC6", pwC6, zero, 0.0, 0.0);
	}
	else{
		decshaped_pulse("offC6", pwC6, zero, 0.0, 0.0); /*delay(pwC6);*/
	}
	zgradpulse(gzlvl1, gt1);   	
	dec2phase(t2);
	delay(gstab - 2.0*GRADIENT_DELAY);
	dec2rgpulse(2.0*pwN, t2, 0.0, 0.0);
	delay(gt1+gstab + pwC6);


	txphase(three);
	txphase(t4);



/*  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  */
	sim3pulse(pw,0.0,pwN, zero,zero, t3, 0.0, 0.0);

        if (tpwrsf_d<4095.0)
        {
         obspwrf(tpwrsf_d); obspower(tpwrs+6.0);
   	 shaped_pulse("H2Osinc_d", pwHs, zero, 5.0e-5, 0.0);
	 obspower(tpwr); obspwrf(4095.0);
        }
        else
        {   
         obspower(tpwrs);
   	 shaped_pulse("H2Osinc_d", pwHs, zero, 5.0e-5, 0.0);
	 obspower(tpwr);
        }	

	txphase(zero);
	dec2phase(zero);
	zgradpulse(gzlvl5, gt5);
	delay(lambda - 0.65*(pw + pwN) - gt5 - pwHs - 2.0*POWER_DELAY -2.0*PWRF_DELAY -50.0e-6);

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

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

	sim3pulse(pw, 0.0, pwN, one, zero, zero, 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(one);
	zgradpulse(1.5*gzlvl5, gt5);
	delay(lambda - 1.6*pwN - gt5);

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

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

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

	dec2power(dpwr2);				       /* POWER_DELAY */
        
      zgradpulse(icosel*gzlvl2, 0.1*gt1);		/* 2.0*GRADIENT_DELAY */
        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4);		

	setreceiver(t4);
}		 
Esempio n. 10
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values

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

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

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

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

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

// Dutycycle Protection

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

// Set Phase Tables

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

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

// Begin Sequence

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

// X Single Pulse

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

// xy8Y Period One

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

// X Refocussing Pulse

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

// xy8Y Period Two

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

// Begin Acquisition

   _dseqon(dec);
   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Esempio n. 11
0
void pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          n15_flg[MAXSTR];


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


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



   getstr("shname1", shname1);
   getstr("n15_flg",n15_flg);



  phase = (int) (getval("phase") + 0.5);
   
   settable(t1,4,phi1);
   settable(t2,4,phi2);
   settable(t3,1,phi3);
   settable(t5,1,phi5);
   settable(t14,4,phi14);
   settable(t15,4,phi15);
   settable(t24,4,phi24);
   settable(t25,4,phi25);


/*   INITIALIZE VARIABLES   */
   kappa = 5.4e-3;
   //shpw1 = pw*8.0;
   shlvl1 = tpwr;
   f1180[0] ='n'; 
   f2180[0] ='n'; 

   pwS1 = c13pulsepw("co", "ca", "sinc", 90.0);
   pwS2 = c13pulsepw("co", "ca", "sinc", 180.0);
   pwS3 = c13pulsepw("ca", "co", "square", 180.0);
   pwS4 = h_shapedpw("eburp2",shbw,shofs,zero, 0.0, 0.0);
   pwS6 = h_shapedpw("reburp",shbw,shofs,zero, 0.0, 0.0);
   pwS5 = h_shapedpw("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);
   if(ix==1) printf("pwS2 %g   pwS3 %g GRADIENT_DELAY %g POWER_DELAY %g PWRF_DELAY %g\n",
   pwS2,pwS3,2*GRADIENT_DELAY,4*POWER_DELAY,4*PWRF_DELAY);



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

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


/*  Set up f1180  */

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


/*  Set up f2180  */

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

/************************************************************/
/* modification for phase-cycling in consecutive experiments*/
/*  for kinetic measurements                                */
/************************************************************/

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

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


/* Set up CONSTANT/SEMI-CONSTANT time evolution in N15 */

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



   status(A);
      rcvroff();  

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


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

lk_sample();
       delay(d1-gt4);
lk_hold();
        h_shapedpulse("pc9f",shbw,shofs,zero, 2.0e-6, 0.0);

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

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

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

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


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

           zgradpulse(gzlvl4, gt4);
           delay(timeTN-pwS2*0.5-gt4);

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

           zgradpulse(gzlvl4, gt4);
           delay(timeTN-pwS2*0.5-gt4);
     dec2rgpulse(pwN,one,0.0,0.0);
/**************************************************************************/
/*   xxxxxxxxxxxxxxxxxxxxxx       13CO EVOLUTION        xxxxxxxxxxxxxxxxxx    */
   
        obspower(tpwr);
	c13pulse("co", "ca", "sinc", 90.0, t1, 2.0e-6, 0.0);       
        delay(tau1*0.5);
        sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 2.0*pwN,
                                                  zero, zero, zero, 2.0e-6, 0.0);
        delay(tau1*0.5);
	c13pulse("co", "ca", "sinc", 180.0, zero, 2.0e-6, 0.0);      
        sim3_c13pulse("", "ca", "co", "square", "", 0.0, 180.0, 0.0,
                                                  one, zero, zero, 2.0e-6, 0.0);
        if  (pwN*2.0 > pwS3) delay(pwN*2.0-pwS3);
	c13pulse("co", "ca", "sinc", 90.0, zero, 2.0e-6, 0.0);       

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

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

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

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

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

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

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

     dec2rgpulse(pwN,one,0.0,0.0);
        zgradpulse(gzlvl6, gt6);

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

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

        delay(lambda-pwS6*0.5-gt6);
     dec2rgpulse(pwN,t5,0.0,0.0);
/**************************************************************************/

        zgradpulse(-icosel*gzlvl2, gt1/10.0);
        dec2power(dpwr2);                                      /* POWER_DELAY */
lk_sample();
 if (n15_flg[0] =='y')
{
   if (phase2==1) setreceiver(t14);
   else setreceiver(t15);
}
else
{
   if (phase2==1) setreceiver(t24);
   else setreceiver(t25);
}

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

}		 
Esempio n. 12
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char        f1180[MAXSTR],f2180[MAXSTR],f3180[MAXSTR],
             mag_flg[MAXSTR], flipback[MAXSTR];

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

 double      
             tofhn,              /* adjust carrier to the center of amide protons   */
             tauxh,              /* 1 / 4J(NH)                */
             pwN,                /* PW90 for N-nuc            */
             pwNlvl,             /* power level for N hard pulses */
             jnh,                /* coupling for NH           */
             gzcal = getval("gzcal"),
             compH = getval("compH"),
	     tau1,	     
             tau2,
             tau3,
	     sw1,
             sw2,
             sw3,
             flippw,             /* pw for selective pulse at flippwr  */
             flippwr,
             fliphase,
             mix,

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


/* LOAD VARIABLES */

  tofhn = getval("tofhn");
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  sw3 = getval("sw3");
  ni = getval("ni");
  ni2 = getval("ni2");
  ni3 = getval("ni3");
  phase = (int)(getval("phase") + 0.5);
  phase2 = (int)(getval("phase2") + 0.5);
  phase3 = (int)(getval("phase3") + 0.5);
  jnh = getval("jnh");
  pwN = getval("pwN");
  pwNlvl = getval("pwNlvl"); 
  gstab = getval("gstab");
  flippw = getval("flippw");
  fliphase = getval("fliphase");
  mix = getval("mix");

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

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

/* check validity of parameter range */


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

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

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

    if(gt0 > 15.0e-3 || gt1 > 15.0e-3 || gt7 > 15.0e-3 || gt3 > 15.0e-3 || gt4 > 15.0e-3 || gt5 > 15.0e-3)
    {
        printf("gti must be less than 15 ms \n");
        psg_abort(1);
    }


/* LOAD VARIABLES */

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

  settable(t6, 8, rec);

/* INITIALIZE VARIABLES */

  tauxh = ((jnh != 0.0) ? 1/(4*(jnh)) : 2.35e-3);

/* Phase incrementation for hypercomplex data */

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

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

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


/* calculate modification to phases based on current t1 values
   to achieve States-TPPI acquisition */
 
 
   if(ix == 1) d2_init = d2;
   t1_counter = (int)((d2-d2_init)*sw1 + 0.5);

   if(t1_counter %2) 
   {
      tsadd(t1,2,4);
      tsadd(t6,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(t6,2,4);
   }

   if(ix == 1) d4_init = d4;
   t3_counter = (int)((d4-d4_init)*sw3 + 0.5);

   if(t3_counter %2) 
   {
      tsadd(t3,2,4);
      tsadd(t6,2,4);
   }


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

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

   tau2 = d3 - 2.0*pw - 4.0*pwN/PI;
   if(f2180[A] == 'y') 
   {
       tau2 += (1.0/(2.0*sw2));
   }
   if (tau2 < 0.2e-6) tau2 = 0.0;
   tau2 = tau2/2.0;
   
   tau3 = d4;
   if(f3180[A] == 'y') 
   {
       tau3 += (1.0/(2.0*sw3));
   }
   tau3 = tau3/2.0;
   
   flippwr = tpwr - 20.0*log10(flippw/(compH*pw*1.69));
   flippwr = (int)(flippwr + 0.4);

   if (fliphase < 0.2e-6) fliphase = fliphase + 360.0;
   initval(fliphase, v10);
   initval(7.0, v9);
   obsstepsize(45.0);

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tpwr);            
   decpower(dpwr);        
   dec2power(pwNlvl);     
   obsoffset(tofhn);
   xmtrphase(v9);
   delay(d1);

status(B);   /* for 13C decoupling during t2, use dm='nynn' or 'nyyn' */

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

   rgpulse(pw,t1,1.0e-6,2.0e-6);    
   zgradpulse(gzlvl6,gt6);
   delay(1.9*tauxh - gt1 - 2.0e-6);

   dec2rgpulse(pwN, t2, 0.0, 0.0);
 
   delay(tau2);
   rgpulse(2.0*pw, t1, 0.0, 0.0);
   dec2phase(zero);
   delay(tau2);
  
   dec2rgpulse(pwN, zero, 0.0, 0.0);
   xmtrphase(zero);

   delay(1.9*tauxh - gt6 - 600.0e-6 - SAPS_DELAY);
   txphase(zero);

   zgradpulse(gzlvl6,gt6);
   txphase(zero);
   delay(0.6e-3);

   if (tau1 > pwN)
   {
      delay(tau1 - pwN);
      dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
      delay(tau1 - pwN);
   }
   else
   {
      delay(2.0*tau1);
   }
   rgpulse(pw, zero, 0.0, 1.0e-6);

status(A);             /* no decoupling during mix period */

   delay(mix - pwN - 1.5*gt7 - 2.0e-3);
   zgradpulse(gzlvl7,gt7);
   delay(1.0e-3);
   dec2rgpulse(pwN, zero, 0.0, 2.0e-6);
   zgradpulse(gzlvl7,gt7/2.0);
   delay(1.0e-3 - 2.0e-6);

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

   zgradpulse(gzlvl3,gt3);

   delay(tauxh - gt3 - 2.0e-6);               /* delay=1/4J(NH)   */

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

   txphase(one);
   delay(tauxh - gt3 - 500.0e-6);               /* delay=1/4J(NH)   */
   zgradpulse(gzlvl3,gt3);
   delay(500.0e-6);

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

   if (flipback[A]=='y')
   {
      xmtrphase(v10);
      obspower(flippwr);
      shaped_pulse("H2Osinc",flippw,two,2.0e-6,2.0e-6);
      obspower(tpwr);
      xmtrphase(zero);
   }

   zgradpulse(gzlvl4,gt4);
   dec2phase(t3);
   txphase(zero); 
status(C);        /* for 13C decoupling during t3 set dm='nnyn' or 'nyyn'  */
   delay(250.0e-6);

   dec2rgpulse(pwN,t3,0.0,0.0);
   dec2phase(t4);

   delay(tau3);
   rgpulse(2.0*pw, zero,0.0,0.0);
   delay(tau3);
status(A);          /* no decoupling  */
   if (mag_flg[A] == 'y')
   {
      delay(4.0*GRADIENT_DELAY);
   }
   delay(gstab + gt6 + 2.0*GRADIENT_DELAY - 2.0*pw - PRG_STOP_DELAY);

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

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

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

   txphase(zero);
   dec2phase(zero);

   if (gt5 > 0.2e-6)
   {
      zgradpulse(gzlvl5, 1.3*gt5);
   }

   delay(tauxh - 1.3*gt5);       

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

   txphase(one); dec2phase(one);

   delay(tauxh - 1.3*gt5 - 500.0e-6);     

   if (gt5 > 0.2e-6)
   {
      zgradpulse(gzlvl5, 1.3*gt5);
   }
   delay(500.0e-6);

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

   dec2phase(zero); txphase(zero);

   if (gt5 > 0.2e-6)
   {
      zgradpulse(gzlvl5,gt5);
   }

   delay(tauxh - gt5);          

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

   dec2power(dpwr2);  

   delay(tauxh - 3.0*POWER_DELAY - gt5 - 500.0e-6); 

   if (gt5 > 0.2e-6)
   {
      zgradpulse(gzlvl5,gt5);
   }
   delay(500.0e-6);

   rgpulse(pw,zero,0.0,0.0);

   if(mag_flg[A] == 'y')
   {
      delay(4.0*GRADIENT_DELAY);
   }

   delay(gstab + gt1/10.0 + 2.0*GRADIENT_DELAY);

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

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

   delay(gstab);

status(D);
   setreceiver(t6);
}
Esempio n. 13
0
pulsesequence()
{

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

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

double      d2_init=0.0,  		        /* used for states tppi in t1 */
	    d3_init=0.0,  	 	        /* used for states tppi in t2 */
	    tau1,         				         /*  t1 delay */
	    tauCH = getval("tauCH"), 		         /* 1/4J delay for CH */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
            timeNCA = getval("timeNCA"),
            timeC = getval("timeC"),      /* other delays */
            tauCC = getval("tauCC"),
	    zeta = getval("zeta"),

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

   widthHd,
   pwS1,					/* length of square 90 on Cab */
   pwS2,					/* length of square 180 on Ca */
   phi7cal = getval("phi7cal"),  /* phase in degrees of the last C13 90 pulse */
   phshift = getval("phshift"),        /*  phase shift induced on CO by 180 on CA in middle of t1 */

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

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

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

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

/*   LOAD PHASE TABLE    */

	settable(t1,2,phi1);
	settable(t2,4,phi2);
        settable(t4,1,phx);
   if (TROSY[A]=='y')
       {settable(t8,1,phy);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,4,recT);}
    else
       {settable(t8,1,phx);
	settable(t9,16,phi9);
	settable(t10,1,phx);
	settable(t11,1,phy);
	settable(t12,8,rec);}

        

/*   INITIALIZE VARIABLES   */

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

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

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



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

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

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

/* PHASES AND INCREMENTED TIMES */

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

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



/*  C13 TIME INCREMENTATION and set up f1180  */

/*  Set up f1180  */

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


/*  Set up f2180  */

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


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

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

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



/*   BEGIN PULSE SEQUENCE   */

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

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

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

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

	rgpulse(pw, zero, 0.0, 0.0);                  /* 1H pulse excitation */
                          
        txphase(zero);
        decphase(zero);
	zgradpulse(gzlvl0, gt0);			/* 2.0*GRADIENT_DELAY */

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

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

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

        decpwrf(rf0);

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

        set_c13offset("co");

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

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

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

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

        set_c13offset("ca");

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

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

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

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

   int   
          t1_counter,
          phase;


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

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

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

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

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



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

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

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


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

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

}

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

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

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

    


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



   status(A);

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


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

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

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

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

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

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

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


}
Esempio n. 15
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char        f1180[MAXSTR],C13refoc[MAXSTR], C13filter[MAXSTR];
             
 int	     t1_counter;

 double 
	tau1,	      	    /* t1/2 */
	JNH = getval("JNH"),
  	tauNH  = 1/(4*JNH),         /* delay for 1H-15N INEPT   1/4JNH  */
  	tauNH1 = getval("tauNH1"),   /* 1/2JNH  */
  	tauNH2 = getval("tauNH2"),   /* 1/2JNH  */
  	tauCH1 = getval("tauCH1"),   /* 1/2JCH  */
  	tauCH2 = getval("tauCH2"),   /* 1/2JCH   tauCH2=2tauNH1-2tauCH1 */
  	fact = getval("fact"),       /* scale factor for spin-echo  */
  	pwN = getval("pwN"),
  	pwNlvl = getval("pwNlvl"), 	      	  	              
   pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
   pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
   compC = getval("compC"),
   rf0,            	          /* maximum fine power when using pwC pulses */
   rfst,	                           /* fine power for the stCall pulse */
   mix = getval("mix"),           /* mixing time for H2O - NH  */
        dofCHn = getval("dofCHn"),
        gt1 = getval("gt1"),
        gt2 = getval("gt2"),
        gt3 = getval("gt3"),
        gt4 = getval("gt4"),
        gt5 = getval("gt5"),
        gstab=getval("gstab"),
        gzlvl1 = getval("gzlvl1"),
        gzlvl2 = getval("gzlvl2"),
        gzlvl3 = getval("gzlvl3"),
        gzlvl4 = getval("gzlvl4"),
        gzlvl5 = getval("gzlvl5"),
 gzlvld1 = getval("gzlvld1"), /* remove radiation damping in spin-echo filter */ 
 gzlvld2 = getval("gzlvld2"); /* remove radiation damping in mixing time */

/* LOAD VARIABLES */

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

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

   initval(3.0,v2);
   initval(1.0,v3);          
             
/* check validity of parameter range */

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

    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'n'))
	{
	printf("incorrect Dec2 decoupler flags!  dm2 Should be 'nny' ");
	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((gt1 > 5.0e-3) || (gt2 > 5.0e-3) || (gt3 > 5.0e-3))
    {
        printf("gti must be less than 5 ms \n");
        psg_abort(1);
    }
   
    if((gt4 > 5.0e-3) || (gt5 > 5.0e-3))
    {
        printf("gti must be less than 5 ms \n");
        psg_abort(1);
    }

  if(gzlvld1>200 || gzlvld2>200 )
    {
        printf("gzlvldi should not be larger than 200 DAC \n");
        psg_abort(1);
    }

/* LOAD VARIABLES */

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

/* Phase incrementation for hypercomplex data */

   if ( phase1 == 2 )     /* Hypercomplex in t1 */
    {    
    tsadd(t2,1,4);
    }    
    
/* calculate modification to phases based on current t1 values
   to achieve States-TPPI acquisition */
 
   if(ix == 1)
    {
      d2_init = d2;
    }

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

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

    tau1=d2;
    if( (f1180[A] == 'y') && (ni >1.0) )  tau1 += (1.0/(2.0*sw1));
    tau1 = tau1/2.0 -pw -2*pwN/PI;
    if (tau1 < 0.0) tau1=0.0;
    

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

   obspower(tpwr);               /* Set power for pulses  */
   dec2power(pwNlvl);            /* Set decoupler2 power to pwNlvl */
   decpower(pwClvl);
   decpwrf(rf0);
   obsoffset(tof); 
   decoffset(dofCHn);   
   delay(d1);
   
status(B);

   rcvroff();
  
   txphase(t1);
   delay(9.0e-5);

/* spin-echo filter and 15N/13C double filters */

  rgpulse(pw,t1,0.0,0.0);  

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

{   
  decphase(t5);
  zgradpulse(gzlvl5,gt5); 
  delay(tauCH1-gt5); 
  decrgpulse(pwC,t5,0.0,0.0);
 
  txphase(t3); dec2phase(t5);
  delay(tauNH1-tauCH1-pwN*0.5);
  sim3pulse(2.0*pw,2*pwC,pwN,t3,zero,t5,0.0,0.0);
 
  decphase(t6);
  delay(tauCH2+tauCH1-tauNH1-pwN*0.5);
  decrgpulse(pwC,t6,0.0,0.0);
  
  delay(tauNH1+tauNH2-tauCH1-tauCH2-gt5-gstab);
  zgradpulse(gzlvl5,gt5);
  delay(gstab);     
}
 
 else
  
{  
 if (gzlvld1>0.0)
 {
  txphase(t3); dec2phase(t5); 
  delay(2.0e-6);
  zgradpulse(gzlvld1,0.5*fact*tauNH1-pwN*0.25-11.0e-6);
  delay(2.0e-5);
  zgradpulse(-gzlvld1,0.5*fact*tauNH1-pwN*0.25-11.0e-6);
  delay(2.0e-6);

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

  delay(2.0e-6);
  zgradpulse(gzlvld1,0.5*fact*tauNH2-pwN*0.25-11.0e-6);
  delay(2.0e-5);
  zgradpulse(-gzlvld1,0.5*fact*tauNH2-pwN*0.25-11.0e-6);
  delay(2.0e-6);
 }
 else
 {
  txphase(t3); dec2phase(t5); 
  delay(fact*tauNH1-pwN*0.5);

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

  delay(2.0e-6);
  delay(0.5*fact*tauNH2-pwN*0.25-3.0e-6);
  delay(2.0e-6);
  delay(0.5*fact*tauNH2-pwN*0.25-3.0e-6);
  delay(2.0e-6);
 }
}

  txphase(zero); dec2phase(t6);

  sim3pulse(pw,0.0e-6,pwN,zero,zero,t6,0.0,0.0);
  
  decoffset(dof);
  decpwrf(rfst);
 
/* mixing time */ 
  
   zgradpulse(gzlvl4,gt4);    
   delay(gstab); 
   if(mix - 4.0e-6 - 4.0*GRADIENT_DELAY - gt4> 0.0)
    {
     if (gzlvld2>0.0)
      {
        zgradpulse(gzlvld2,mix-gt4-gstab);
      }
     else
      delay(mix-gt4-gstab);
    }

/* H1-N15 INEPT */

  rgpulse(pw, zero, 0.0, 0.0);

  zgradpulse(gzlvl1,gt1);

  dec2phase(zero); decphase(zero);

  delay(tauNH-gt1);               /* delay=1/4J(XH)   */

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

  zgradpulse(gzlvl1,gt1);

  txphase(one);
  dec2phase(t2);
  delay(tauNH-gt1 );               /* delay=1/4J(XH)   */
 
  rgpulse(pw, one, rof1, rof1);

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

  dec2rgpulse(pwN, t2, 0.0, 0.0);

  txphase(zero); dec2phase(t4);

/* t1 evolution period  */

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

  dec2rgpulse(pwN, t4, 0.0, 0.0);

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

  rgpulse(pw, t1, rof1, rof1);

  dec2phase(zero);

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

   delay(tauNH-gt3-gstab-pw*2.385-6.0*rof1 -d3*2.5);
 
   rgpulse(pw*0.231,v2,rof1,rof1);
   delay(d3);
   rgpulse(pw*0.692,v2,rof1,rof1);
   delay(d3);
   rgpulse(pw*1.462,v2,rof1,rof1);

   delay(d3/2-pwN);
   dec2rgpulse(2*pwN, zero, rof1, rof1);
   delay(d3/2-pwN);

   rgpulse(pw*1.462,v3,rof1,rof1);
   delay(d3);
   rgpulse(pw*0.692,v3,rof1,rof1);
   delay(d3);
   rgpulse(pw*0.231,v3,rof1,rof1);
   delay(tauNH-gt3-gstab-pw*2.385-6.0*rof1 -d3*2.5);
   dec2power(dpwr2);
   zgradpulse(gzlvl3,gt3);
   
   delay(gstab); 

/* acquire data */  

status(C);
   setreceiver(t14);

}
Esempio n. 16
0
void pulsesequence()
{
   char   
          shname1[MAXSTR],
	  f1180[MAXSTR],
	  f2180[MAXSTR],
          CT_flg[MAXSTR],
          n15_flg[MAXSTR];

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


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



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



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


/*   INITIALIZE VARIABLES   */

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

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

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



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

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

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


/*  Set up f1180  */

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

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

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

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

   status(A);
      rcvroff();  

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


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

       delay(d1-gt4);
lk_hold();

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

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

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

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

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

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

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

           delay(timeTN1);

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

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

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

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

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

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

        set_c13offset("co");

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

     dec2rgpulse(pwN,t4,0.0,0.0);

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

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

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

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

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

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

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

        dec2rgpulse(pwN,one,0.0,0.0);

        zgradpulse(gzlvl6, gt6);

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

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

        delay(lambda-pwS6*0.5-gt6);

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

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

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

}		 
void pulsesequence()
{
 char   codec[MAXSTR], codecseq[MAXSTR];

 int	icosel,  t1_counter;

 double	d2_init = 0.0, 
        rf0 = 4095, rf200, pw200,
        copwr, codmf, cores, copwrf,

        tpwrs,   
        pwHs = getval("pwHs"), 
        compH = getval("compH"),
	pwClvl = getval("pwClvl"), 
        pwC = getval("pwC"), 
        compC = getval("compC"), 
        pwNlvl = getval("pwNlvl"), 
        pwN = getval("pwN"),

        sw1 = getval("sw1"), 
        swH = getval("swH"),
        swC = getval("swC"), 
        swN = getval("swN"), 
        swTilt,
        angle_H = getval("angle_H"), 
        angle_C = getval("angle_C"),
        angle_N, 
        cos_H, 
        cos_C,
        cos_N,

        mix = getval("mix"),
        tauCH = getval("tauCH"),                                                /* 1/4JCH  */
        tauNH = getval("tauNH"),                                                /* 1/4JNH  */
	tau1, tau2, tau3,
        tofali =getval("tofali"),                             /* aliphatic protons offset  */
        dofcaco =getval("dofcaco"),               /* offset for caco decoupling, ~120 ppm  */
        dof = getval("dof"),

        gstab = getval("gstab"),

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

/* LOAD VARIABLES */
   copwr = getval("copwr");        copwrf = getval("copwrf");
   codmf = getval("codmf");        cores = getval("cores");
   getstr("codecseq", codecseq);   getstr("codec", codec);

/* Load phase cycling variables */

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

   angle_N=0.0; cos_N=0.0;

/* activate auto-calibration flags */
setautocal();
  if (autocal[0] == 'n')
  {
    /* 180 degree adiabatic C13 pulse from 0 to 200 ppm */
    pw200 = getval("pw200");
    rf200 = (compC*4095.0*pwC*4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35));
    rf200 = (int) (rf200 + 0.5);
                             
    if (1.0/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)) < pwC )
    { text_error( " Not enough C13 RF. pwC must be %f usec or less.\n",
                    (1.0e6/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35))) );
      psg_abort(1); }
  }
  else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
  {
    strcpy(codecseq,"Pdec_154p");
    if(FIRST_FID)                                            /* call Pbox */
    {
      ppm = getval("dfrq");
      bw = 200.0*ppm; pws = 0.001; ofs = 0.0; nst = 1000; 
                                 /* 1 ms long pulse, nst: number of steps */
      stC200 = pbox_makeA("stC200", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);

      bw=20.0*ppm; ofs=154*ppm;
      Pdec_154p = pbox_Dsh("Pdec_154p", "WURST2", bw, ofs, compC*pwC, pwClvl);
    }
    rf200 = stC200.pwrf;  pw200 = stC200.pw;
  }
/* selective H20 one-lobe sinc pulse */
   tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));
   tpwrs = (int)(tpwrs+0.5);

/* check validity of parameter range */

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

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

/* set up angles for PR42 experiments */

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

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

   cos_H = cos (PI*angle_H/180);  cos_C = cos (PI*angle_C/180);
   if ( (cos_H*cos_H + cos_C*cos_C) > 1.0) { printf ("Impossible angle combinations.\n"); psg_abort(1); }
   else { cos_N = sqrt(1 - (cos_H*cos_H + cos_C*cos_C) );  angle_N = acos(cos_N)*180/PI;  }

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

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

   swTilt = swH*cos_H + swC*cos_C + swN*cos_N;


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

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

   tau1 = 1.0 * t1_counter * cos_H / swTilt;
   tau2 = 1.0 * t1_counter * cos_C / swTilt;
   tau3 = 1.0 * t1_counter * cos_N / swTilt;

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


   if (ix ==1 )
   {
      printf ("Current Spectral Width:\t\t%5.2f\n", swTilt);
      printf ("Angle_H: %5.2f \n", angle_H);
      printf ("Angle_C: %5.2f \n", angle_C);
      printf ("Angle_N: %5.2f \n", angle_N);
      printf ("\n\n\n\n\n");
   }


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

      delay(d1);

      rcvroff();
      obsoffset(tofali);  obspower(tpwr);     obspwrf(4095.0);
      decoffset(dof);     decpower(pwClvl);   decpwrf(rf0);
      dec2offset(dof2);   dec2power(pwNlvl);  dec2pwrf(4095.0);

      if (gt0 > 0.2e-6)
      {
         decrgpulse(pwC,zero,10.0e-6,0.0);
         dec2rgpulse(pwN,zero,2.0e-6,2.0e-6);
         zgradpulse(gzlvl0,gt0); 
         delay(gstab);
      }

      txphase(t1);   decphase(t2);   dec2phase(zero);

status(B);

   rgpulse(pw,t1,4.0e-6,2.0e-6);                     

      zgradpulse(gzlvl3,gt3);
      delay(2.0*tauCH - gt3 - 2.0*GRADIENT_DELAY -4.0e-6);

   decrgpulse(pwC,t2,2.0e-6,2.0e-6);	                        
      decphase(zero);   

   /*=======  Start of c13 evolution ==========*/

      if ( ((tau2 -PRG_START_DELAY - POWER_DELAY -pwN - 2.0*pwC/PI -2.0e-6)> 0) 
           && ((tau2 -PRG_STOP_DELAY - POWER_DELAY - pwN - 2.0*pwC/PI -2.0e-6)>0)
           && (codec[A] == 'y') )
      {
         decpower(copwr);  decpwrf(copwrf);
         decprgon(codecseq,1/codmf,cores);
         decon();

         delay(tau2 -PRG_START_DELAY - POWER_DELAY -pwN - 2.0*pwC/PI -2.0e-6);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, t1, zero, zero, 0.0, 0.0);
         delay(tau2 -PRG_STOP_DELAY - POWER_DELAY - pwN - 2.0*pwC/PI -2.0e-6);

         decoff();
         decprgoff();
      }
      else if ( (tau2 -pwN - 2.0*pwC/PI -2.0e-6) > 0)
      {
         delay(tau2 -pwN - 2.0*pwC/PI -2.0e-6);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, t1, zero, zero, 0.0, 0.0);
         delay(tau2 -pwN - 2.0*pwC/PI -2.0e-6);
      }
      else
      {
         delay(2.0*tau2);
         decphase(t14);  
         delay(4.0e-6);
   sim3pulse(2.0*pw, 2.0*pwC, 2.0*pwN, t1, t14, zero, 0.0, 0.0);
         delay(4.0e-6);
      }

      decpower(pwClvl);
      decpwrf(rf0);
      decphase(zero);
   /*======= End of  c13 evolution ==========*/
   decrgpulse(pwC,zero, 2.0e-6,2.0e-6);                       

      txphase(zero);
      delay(2.0*tauCH + tau1 - gt3 - 4.0*pwC
                    - gstab -4.0e-6 - 2.0*GRADIENT_DELAY);	
      zgradpulse(gzlvl3,gt3);
      delay(gstab);

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

      delay(tau1);

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

  /* ===========Beginning of NOE transfer ======= */

      delay(mix - gt4 - gt5 - pwN -pwC - 2.0*gstab);		
      obsoffset(tof);

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

   decrgpulse(pwC, zero, 2.0e-6, 2.0e-6);
   dec2rgpulse(pwN, zero, 2.0e-6, 2.0e-6);

      zgradpulse(gzlvl5,gt5);
      delay(gstab);	
                                            /* H2O relaxes back to +z */

  /* ===========   End of NOE transfer ======= */

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

      zgradpulse(gzlvl6,gt6);
      delay(tauNH - gt6 - 4.0e-6 - 2.0*GRADIENT_DELAY);

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

      delay(tauNH - gt6 - gstab -4.0e-6 - 2.0*GRADIENT_DELAY);
      zgradpulse(gzlvl6,gt6);
      txphase(one);
      delay(gstab);

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

      txphase(two);
      obspower(tpwrs);

      shaped_pulse("H2Osinc", pwHs, two, 2.0e-6, 2.0e-6);

      obspower(tpwr);
      zgradpulse(gzlvl7,gt7);
      dec2phase(t3);
      decoffset(dofcaco);          /* offset on 120ppm for CaCO decoupling */
      decpwrf(rf200);                             /* fine power for stC200 */
      delay(gstab);			

   dec2rgpulse(pwN,t3,2.0e-6,2.0e-6);

      dec2phase(t4);
      delay(tau3); 

   rgpulse(2.0*pw, zero, 2.0e-6, 2.0e-6);
   decshaped_pulse("stC200", 1.0e-3, zero, 2.0e-6, 2.0e-6);

      delay(tau3);
      delay(gt1 +gstab +8.0e-6 - 1.0e-3 - 2.0*pw);

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

      dec2phase(t5);
      zgradpulse(gzlvl1, gt1);       
      delay(gstab + WFG_START_DELAY + WFG_STOP_DELAY - 2.0*GRADIENT_DELAY);

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

      dec2phase(zero);
      zgradpulse(gzlvl8, gt8);
      delay(tauNH - gt8 - 2.0*GRADIENT_DELAY -4.0e-6);

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

      delay(tauNH  - gt8 - gstab -4.0e-6 - 2.0*GRADIENT_DELAY);
      zgradpulse(gzlvl8, gt8);
      txphase(one);    dec2phase(one);
      delay(gstab);

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

      txphase(zero);   dec2phase(zero);
      zgradpulse(gzlvl9, gt9);
      delay(tauNH - gt9 - 2.0*GRADIENT_DELAY -4.0e-6);

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

      delay(tauNH - gt9 - 2.0*GRADIENT_DELAY -gstab -4.0e-6);
      zgradpulse(gzlvl9, gt9);
      delay(gstab);

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

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

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

      zgradpulse(icosel*gzlvl2, gt1/10.0);    

      dec2power(dpwr2);	
      delay(gstab);

status(C);
      setreceiver(t11);
} 
Esempio n. 18
0
pulsesequence()
{
/* DECLARE VARIABLES */
  char        fsat[MAXSTR],
              fscuba[MAXSTR],
              f1180[MAXSTR],      /* Flag to start t1 @ halfdwell           */
              sh_reb[MAXSTR],
              codec[MAXSTR],
              MQ_flg[MAXSTR],
              filter_flg[MAXSTR];
  int          phase,
               t1_counter;    /* used for states tppi in t1          */
  double       tau1,          /* t1 delay */
               taua,          /* set to exactly 1/4JCH */
               tsatpwr,       /* low level 1H trans.power for presat */
               sw1,           /* sweep width in f1                   */
               tpwr_cp,       /* power level for 1H CPMG     */
               pw_cp,         /* 1H pw for CPMG      */
               ncyc_cp,       /* number of CPMG cycles */
               time_T2,       /* total time for CPMG trains   */
               tau_cpmg,
               dhpwr,
               pwc,
               dmf_co,
               dpwr_co,
               dresco,
              gt0,
              gt1,
              gt2,
              gt3,
              gt4,
              gt5,
              gt6,
              gzlvl0,
              gzlvl1,
              gzlvl2,
              gzlvl3,
              gzlvl4,
              gzlvl5,
              gzlvl6,
              tpwr,
              pw,
              d_reb,
              pwc_reb,
              dpwr3_D,
              pwd,
              pwd1,
              tau_eq,
              pwn,
              dhpwr2;
/* LOAD VARIABLES */
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("fscuba",fscuba);
  getstr("sh_reb",sh_reb);
  getstr("codec",codec);
  getstr("MQ_flg",MQ_flg);
  getstr("filter_flg",filter_flg);
  taua    = getval("taua");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  phase = (int) ( getval("phase") + 0.5);
  sw1 = getval("sw1");
  tpwr_cp  = getval("tpwr_cp");
  pw_cp =  getval("pw_cp");
  ncyc_cp  = getval("ncyc_cp");
  time_T2  = getval("time_T2");
  dhpwr = getval("dhpwr");
  pwc = getval("pwc");
  pwn = getval("pwn");
  dhpwr2 = getval("dhpwr2");
  dmf_co = getval("dmf_co");
  dpwr_co = getval("dpwr_co");
  dresco = getval("dresco");
  gt0  = getval("gt0");
  gt1  = getval("gt1");
  gt2  = getval("gt2");
  gt3  = getval("gt3");
  gt4  = getval("gt4");
  gt5  = getval("gt5");
  gt6 = getval("gt6");
  gzlvl0  = getval("gzlvl0");
  gzlvl1  = getval("gzlvl1");
  gzlvl2  = getval("gzlvl2");
  gzlvl3  = getval("gzlvl3");
  gzlvl4  = getval("gzlvl4");
  gzlvl5  = getval("gzlvl5");
  gzlvl6  = getval("gzlvl6");
  tpwr = getval("tpwr");
  pw = getval("pw");
  d_reb = getval("d_reb");
  pwc_reb = getval("pwc_reb");
  dpwr3_D = getval("dpwr3_D");
  pwd = getval("pwd");
  pwd1 = getval("pwd1");
  tau_eq = getval("tau_eq");
/* LOAD PHASE TABLE */
  settable(t1,4,phi1);
  settable(t2,2,phi2);
  settable(t4,8,phi4);
  settable(t5,4,rec);
/* CHECK VALIDITY OF PARAMETER RANGES */
    if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y' ))
    {
         printf("incorrect dec1 decoupler flags! ");
         abort(1);
    }
    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y' || dm2[D] == 'y'))
    {
         printf("incorrect dec2 decoupler flags! ");
         abort(1);
    }
    if( tsatpwr > 6 )
    {
         printf("TSATPWR too large !!!  ");
         abort(1);
    }
    if( dpwr > 48 )
    {
         printf("don't fry the probe, DPWR too large!  ");
         abort(1);
    }
    if(tpwr_cp > 62)
    {
         printf("don't fry the probe, tpwr_cp too large: < 62! ");
         abort(1);
    }
    if(pw_cp < 9.5e-6) {
         printf("pw_cp is too low; > 9.5us\n");
         abort(1);
    }
    if( dpwr2 > -16 )
    {
         printf("don't fry the probe, DPWR2 too large!  ");
         abort(1);
    }
      if( pw > 20.0e-6 )
      {
            printf("dont fry the probe, pw too high ! ");
            abort(1);
      }
      if(gt1 > 3e-3 || gt2 > 3e-3 || gt3 > 3e-3 || gt4 > 3e-3
             || gt5 > 3e-3 || gt6 > 3e-3)
      {
            printf("gradients on for too long. Must be < 3e-3 \n");
            abort(1);
      }
      if(ncyc_cp > 80) {
            printf("ncyc_cp is too large; must be less than 81\n");
            abort(1);
      }
      if(time_T2 > .080) {
            printf("time_T2 is too large; must be less than 80 ms\n");
            abort(1);
      }
      if(ncyc_cp > 0) {
            tau_cpmg = time_T2/(4.0*ncyc_cp) - pw_cp;
            if(ix==1)
              printf("nuCPMG for curent experiment is (Hz): %5.3f\n",1/(4.0*(tau_cpmg+pw_cp)));
        }
        else {
            tau_cpmg = time_T2/(4.0) - pw_cp;
            if(ix==1)
              printf("nuCPMG for curent experiment is (Hz): not applicable");
        }
      if(tau_cpmg + pw_cp < 125e-6) {
           printf("tau_cpmg is too small; decrease ncyc_cp\n");
           abort(1);
      }
      if(dpwr_co > 42) {
           printf("dpwr_co is too high; < 42\n");
           abort(1);
    }
      if(dpwr3_D > 51) {
           printf("dpwr3_D is too high; < 52\n");
           abort(1);
      }
      if(dpwr3 > 59) {
           printf("dpwr3 is too high; < 60\n");
           abort(1);
    }
    if(ix==1)
        printf("If at 800 turn dpwr3=-16, pwd1=0\n");
/*    Phase incrementation for hypercomplex 2D data */
      if (phase == 2)
          tsadd(t1,1,4);
/*    Set up f1180    tau1 = t1               */
      tau1 = d2;
   if(MQ_flg[A] == 'n')
      tau1 = tau1 - 4.0/PI*pwc - POWER_DELAY - PRG_START_DELAY
                - 2.0*pw - 2.0*pwn - PRG_STOP_DELAY - POWER_DELAY
                - 4.0e-6;
    else
      tau1 = tau1 - 4.0/PI*pwc - POWER_DELAY - PRG_START_DELAY
              - 2.0*pw - 2.0*pwn - PRG_STOP_DELAY - POWER_DELAY
              - 4.0e-6;
     if(f1180[A] == 'y') {
          tau1 += ( 1.0 / (2.0*sw1));
          if(tau1 < 0.4e-6) tau1 = 0.4e-6;
     }
     if(tau1 < 0.4e-6)
          tau1 = 0.4e-6;
       tau1 = tau1/2.0;
/* Calculate modifications to phases for States-TPPI acquisition              */
   if( ix == 1) d2_init = d2 ;
   t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
   if(t1_counter % 2) {
        tsadd(t1,2,4);
        tsadd(t5,2,4);
     }
/* BEGIN ACTUAL PULSE SEQUENCE */
status(A);
   rlpower(tsatpwr,TODEV);       /* Set transmitter power for 1H presaturation */
   rlpower(dhpwr,DODEV);         /* Set Dec1 power for 13C pulses          */
   rlpower(dhpwr2,DO2DEV);       /* Set Dec2 power for 15N pulses       */
   obsoffset(tof);
/* Presaturation Period */
status(B);
   if (fsat[0] == 'y')
   {
          delay(2.0e-5);
          rgpulse(d1,zero,2.0e-6,2.0e-6); /* presaturation */
          rlpower(tpwr,TODEV);    /* 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);
   }
   rlpower(tpwr,TODEV);               /* Set transmitter power for 1H CPMG pulses */
   txphase(zero);
   dec2phase(zero);
   decphase(zero);
   delay(1.0e-5);
/* Begin Pulses */
status(C);
   rcvroff();
   delay(20.0e-6);
   decrgpulse(pwc,zero,4.0e-6,0.0);
delay(2.0e-6);
rgradient('z',gzlvl1);
delay(gt1);
rgradient('z',0.0);
delay(250.0e-6);
rgpulse(pw,zero,0.0,0.0);
decpower(d_reb);
delay(2.0e-6);
rgradient('z',gzlvl2);
delay(gt2);
rgradient('z',0.0);
delay(150.0e-6);
if(filter_flg[A] == 'y')
   delay(taua - POWER_DELAY - gt2 - 152e-6
     - WFG2_START_DELAY - 0.5*pwc_reb - 4.0/PI*pw);
else
   delay(taua - POWER_DELAY - gt2 - 152e-6
     - WFG2_START_DELAY - 0.5*pwc_reb);
simshaped_pulse("hard",sh_reb,2.0*pw,pwc_reb,zero,zero,0.0,0.0);
txphase(one);
decpower(dhpwr);
decphase(t4);
delay(taua - 0.5*pwc_reb - WFG2_STOP_DELAY - POWER_DELAY - gt2 - 152e-6 );
delay(2.0e-6);
rgradient('z',gzlvl2);
delay(gt2);
rgradient('z',0.0);
delay(150.0e-6);
if(filter_flg[A] == 'n')
  rgpulse(pw,one,0.0,0.0);
if(filter_flg[A] == 'y') {
decrgpulse(pwc,t4,0.,0.);
decpower(d_reb);
decphase(zero);
delay(2.0e-6);
rgradient('z',gzlvl0);
delay(gt0);
rgradient('z',0.0);
delay(150.0e-6);
delay(taua - POWER_DELAY - gt0 - 152e-6
     - WFG2_START_DELAY - 0.5*pwc_reb);
simshaped_pulse("hard",sh_reb,2.0*pw,pwc_reb,zero,zero,0.0,0.0);
txphase(one);
decpower(dhpwr);
decphase(t4);
delay(taua - 0.5*pwc_reb - WFG2_STOP_DELAY - POWER_DELAY - gt0 - 152e-6 );
delay(2.0e-6);
rgradient('z',gzlvl0);
delay(gt0);
rgradient('z',0.0);
delay(150.0e-6);
decrgpulse(pwc,t4,0.0,0.0);
rgpulse(pw,one,0.0,0.0);
}
  decphase(t1);
  delay(2.0e-6);
  rgradient('z',gzlvl3);
  delay(gt3);
  rgradient('z',0.0);
  delay(250.0e-6);
  /* turn on 2H decoupling */
  dec3phase(one);
  dec3power(dpwr3);
  dec3rgpulse(pwd1,one,4.0e-6,0.0);
  dec3phase(zero);
  dec3unblank();
  dec3power(dpwr3_D);
  dec3prgon(dseq3,pwd,dres3);
  dec3on();
  /* turn on 2H decoupling */
  if(MQ_flg[A] == 'y') {
     rgpulse(pw,zero,2.0e-6,0.0);
     delay(2.0*pwn - PRG_START_DELAY - PRG_STOP_DELAY);
  }
  decrgpulse(pwc,t1,4.0e-6,0.0);
  decphase(zero);
  /* 13CO decoupling on */
  decpower(dpwr_co);
  decprgon(codec,1.0/dmf_co,dresco);
  decon();
  /* 13CO decoupling on */
  delay(tau1);
  rgpulse(2.0*pw,zero,0.0,0.0);
  dec2rgpulse(2.0*pwn,zero,0.0,0.0);
  delay(tau1);
  /* 13CO decoupling off */
  decoff();
  decprgoff();
  /* 13CO decoupling off */
  decpower(dhpwr);
  decrgpulse(pwc,zero,4.0e-6,0.0);
  if(MQ_flg[A] == 'y')
    rgpulse(pw,zero,0.0,0.0);
  /* turn off decoupling */
  dec3off();
  dec3prgoff();
  dec3blank();
  dec3phase(three);
  dec3power(dpwr3);
  dec3rgpulse(pwd1,three,4.0e-6,0.0);
  /* turn off decoupling */
  obspower(tpwr_cp);
  if(MQ_flg[A] == 'n') {
    delay(2.0e-6);
    rgradient('z',gzlvl4);
    delay(gt4);
    rgradient('z',0.0);
    delay(250.0e-6);
  }
  else {
    delay(2.0e-6);
    rgradient('z',-1.0*gzlvl4);
    delay(gt4);
    rgradient('z',0.0);
    delay(250.0e-6);
}
    /* now include a delay to allow the spin system to equilibrate */
    delay(tau_eq);
    rgpulse(pw_cp,t2,4.0e-6,0.0);
    txphase(one);
    /* start of the CPMG period 1    */
    if(ncyc_cp == 1) {
        delay(tau_cpmg - (2.0/PI)*pw_cp);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
    }
    if(ncyc_cp == 2) {
        delay(tau_cpmg - (2.0/PI)*pw_cp);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
        delay(tau_cpmg);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
    }
    if(ncyc_cp > 2) {
        delay(tau_cpmg - (2.0/PI)*pw_cp);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
        initval(ncyc_cp-2,v4);
        loop(v4,v5);
          delay(tau_cpmg);
          rgpulse(2.0*pw_cp,one,0.0,0.0);
          delay(tau_cpmg);
         endloop(v5);
        delay(tau_cpmg);
        rgpulse(2.0*pw_cp,one,0.0,0.0);
        delay(tau_cpmg);
      }
    txphase(t4); decphase(zero);
    rgpulse(2.0*pw_cp,t4,2.0e-6,2.0e-6);
    txphase(one);
    if(ncyc_cp == 1) {
        delay(tau_cpmg);
        rgpulse(2.0*pw_cp,one,0.0,0.0); txphase(one);
        delay(tau_cpmg - 2.0/PI*pw_cp);
    }
    if(ncyc_cp == 2) {
        delay(tau_cpmg);
       rgpulse(2.0*pw_cp,one,0.0,0.0);
       delay(tau_cpmg);
       delay(tau_cpmg);
       rgpulse(2.0*pw_cp,one,0.0,0.0); txphase(one);
       delay(tau_cpmg - 2.0/PI*pw_cp);
   }
   if(ncyc_cp > 2) {
       delay(tau_cpmg);
       rgpulse(2.0*pw_cp,one,0.0,0.0);
       delay(tau_cpmg);
       initval(ncyc_cp-2,v4);
       loop(v4,v5);
         delay(tau_cpmg);
         rgpulse(2.0*pw_cp,one,0.0,0.0);
         delay(tau_cpmg);
        endloop(v5);
       delay(tau_cpmg);
       rgpulse(2.0*pw_cp,one,0.0,0.0); txphase(one);
       delay(tau_cpmg - 2.0/PI*pw_cp);
     }
     rgpulse(pw_cp,zero,0.0,0.0);
     delay(2.0e-6);
     rgradient('z',gzlvl5);
     delay(gt5);
     rgradient('z',0.0);
     delay(250.0e-6);
     obspower(tpwr);
     rgpulse(pw,zero,4.0e-6,0.0);
     decpower(d_reb);
   delay(2.0e-6);
   rgradient('z',gzlvl6);
   delay(gt6);
   rgradient('z',0.0);
   delay(150.0e-6);
   delay(taua - POWER_DELAY - gt6 - 152e-6
          - WFG2_START_DELAY - 0.5*pwc_reb);
   simshaped_pulse("hard",sh_reb,2.0*pw,pwc_reb,zero,zero,0.0,0.0);
   delay(taua - 0.5*pwc_reb - WFG2_STOP_DELAY - 2.0*POWER_DELAY - gt6 - 152e-6);
     rlpower(dpwr,DODEV); /* Set power for decoupling */
     rlpower(dpwr2,DO2DEV); /* Set power for decoupling */
     delay(2.0e-6);
     rgradient('z',gzlvl6);
     delay(gt6);
     rgradient('z',0.0);
     delay(150.0e-6);
     rgpulse(pw,zero,0.0,0.0);
/*     rcvron();  */          /* Turn on receiver to warm up before acq */
/* BEGIN ACQUISITION */
status(D);
     setreceiver(t5);
}
Esempio n. 19
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 */
 	    SCT[MAXSTR],    /* Semi-constant time flag for N-15 evolution */
	    CT_c[MAXSTR],            /* Constant time flag for C-13 evolution */
 	    TROSY[MAXSTR];			    /* do TROSY on N15 and H1 */
 
int         icosel,          			  /* used to get n and p type */
            t1_counter,  		        /* used for states tppi in t1 */
            t2_counter,  	 	        /* used for states tppi in t2 */
            PRexp,                          /* projection-reconstruction flag */
	    ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
	    tauC = getval("tauC"), 	      /* delay for CO to Ca evolution */
            timeTN = getval("timeTN"),     /* constant time for 15N evolution */
	    timeTC = getval("timeTC"),     /* constant time for 13C evolution */
	    t2a=0.0, t2b=0.0, halfT2=0.0, CTdelay=0.0,
	    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 */

/* 90 degree pulse at Ca (56ppm), first off-resonance null at CO (174ppm)     */
        pwC1,		              /* 90 degree pulse length on C13 at rf1 */
        rf1,		       /* fine power for 4.7 kHz rf for 600MHz magnet */

/* 180 degree pulse at Ca (56ppm), first off-resonance null at CO(174ppm)     */
        pwC2,		                    /* 180 degree pulse length at rf2 */
        rf2,		      /* fine power for 10.5 kHz rf for 600MHz magnet */

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

   dofCO,			       /* channel 2 offset for most CO pulses */
	
   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 */

        csa, sna,
        pra = M_PI*getval("pra")/180.0,
   	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"),
	gt7 = getval("gt7"),
	gt9 = getval("gt9"),
	gt10 = getval("gt10"),
	gstab = getval("gstab"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),
	gzlvl6 = getval("gzlvl6"),
	gzlvl7 = getval("gzlvl7"),
	gzlvl8 = getval("gzlvl8"),
	gzlvl9 = getval("gzlvl9"),
	gzlvl10 = getval("gzlvl10");

    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("mag_flg",mag_flg);
    getstr("SCT",SCT);
    getstr("CT_c",CT_c);
    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); }

    /* offset during CO pulses, except for t1 evolution period */	
	dofCO = dof + 118.0*dfrq;

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

     /* 90 degree pulse on Ca, null at CO 118ppm away */
       pwC1 = sqrt(15.0)/(4.0*118.0*dfrq);
        rf1 = 4095.0*(compC*pwC)/pwC1;
        rf1 = (int) (rf1 + 0.5);

    /* 180 degree pulse on Ca, null at CO 118ppm away */
        pwC2 = sqrt(3.0)/(2.0*118.0*dfrq);
	rf2 = (compC*4095.0*pwC*2.0)/pwC2;
        rf2 = (int) (rf2 + 0.5);
        if( rf2 > 4095.0 )
       { printf("increase pwClvl so that C13 90 < 24us*(600/sfrq)"); psg_abort(1);}

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

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

    /* 180 degree one-lobe sinc pulse on CO, null at Ca 118ppm away */
	rf9 = (compC*4095.0*pwC*2.0*1.65)/pwC8;	/* needs 1.65 times more     */
	rf9 = (int) (rf9 + 0.5);		/* power than a square pulse */

    /* the pwC9 pulse at the middle of t1  */
        if ((ni2 > 0.0) && (ni == 1.0)) ni = 0.0;
        if (pwC8 > 2.0*pwN) pwZ = pwC8; else pwZ = 2.0*pwN;
        if ((pwC9==0.0) && (pwC8>2.0*pwN)) pwZ1=pwC8-2.0*pwN; else pwZ1=0.0;
	if ( ni > 1 )     pwC9 = pwC8;
	if ( pwC9 > 0 )   phshift9 = 140.0;
	else              phshift9 = 0.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 */

    /* power level and pulse time for WALTZ 1H decoupling */
	pwHd = 1/(4.0 * waltzB1) ;                              /* 7.5 kHz rf   */
	tpwrd = tpwr - 20.0*log10(pwHd/(compH*pw));
	tpwrd = (int) (tpwrd + 0.5);
 
/* set up Projection-Reconstruction experiment */
 
    tau1 = d2; tau2 = d3; 
    PRexp=0; csa = 1.0; sna = 0.0;   
    if((pra > 0.0) && (pra < 90.0)) /* PR experiments */
    {
      PRexp = 1;
      csa = cos(pra); 
      sna = sin(pra);
      tau1 = d2*csa;  
      tau2 = d2*sna;
    }

/* CHECK VALIDITY OF PARAMETER RANGES */

    if(SCT[A] == 'n')
    {
      if (PRexp) 
      {
        if( 0.5*ni*sna/sw1 > timeTN - WFG3_START_DELAY)
          { printf(" ni is too big. Make ni equal to %d or less.\n",
          ((int)((timeTN - WFG3_START_DELAY)*2.0*sw1/sna)));         psg_abort(1);}
      }
      else 
      {
        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(CT_c[A] == 'y')
    {
      if ( 0.5*ni*csa/sw1 > timeTC)
       { printf(" ni is too big. Make ni less than %d or less.\n", 
         ((int)(timeTC*2.0*sw1/csa - 4e-6 - SAPS_DELAY)));           psg_abort(1);} 	 	                                  
    }

    if ( tauC < (gt7+1.0e-4+0.5*10.933*pwC))  gt7=(tauC-1.0e-4-0.5*10.933*pwC);

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

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

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

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



/* PHASES AND INCREMENTED TIMES */

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

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

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

/* Set up CONSTANT/SEMI-CONSTANT time evolution in N15 */

    halfT2 = 0.0;  
    CTdelay = timeTN + pwC8 + WFG_START_DELAY - SAPS_DELAY;

    if(ni>1)                
    {
      if(f1180[A] == 'y')     /*  Set up f1180 */
        tau1 += 0.5*csa/sw1;  /* if not PRexp then csa = 1.0 */
      if(PRexp)
      {
        halfT2 = 0.5*(ni-1)/sw1;  /* ni2 is not defined */
        if(f1180[A] == 'y') 
        { tau2 += 0.5*sna/sw1; halfT2 += 0.25*sna/sw1; }
        t2b = (double) t1_counter*((halfT2 - CTdelay)/((double)(ni-1)));
      }
    }
    if (ni2>1)
    {
      halfT2 = 0.5*(ni2-1)/sw2;
      if(f2180[A] == 'y')        /*  Set up f2180  */
      { tau2 += 0.5/sw2; halfT2 += 0.25/sw2; }
      t2b = (double) t2_counter*((halfT2 - CTdelay)/((double)(ni2-1)));
    }
    tau1 = tau1/2.0;
    tau2 = tau2/2.0;
    if(tau1 < 0.2e-6) tau1 = 0.0; 
    if(tau2 < 0.2e-6) tau2 = 0.0; 

    if(t2b < 0.0) t2b = 0.0;
    t2a = CTdelay - tau2 + t2b;
    if(t2a < 0.2e-6)  t2a = 0.0;

/* uncomment these lines to check t2a and t2b 
    printf("%d: t2a = %.12f", t2_counter,t2a);
    printf(" ; t2b = %.12f\n", t2b);
*/


/* BEGIN PULSE SEQUENCE */

status(A);
   	delay(d1);
        if ( dm3[B] == 'y' )
          { lk_hold(); lk_sampling_off();}  /*freezes z0 correction, stops lock pulsing*/
 
	rcvroff();
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rf0);
	obsoffset(tof);
	decoffset(dofCO);
	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);
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */

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

    obspower(tpwrd);	  				       /* POWER_DELAY */
    decphase(zero);
    dec2phase(zero);
    decpwrf(rf8);
    delay(timeTN -0.5*kappa - POWER_DELAY - WFG3_START_DELAY);
   }
else
   {txphase(zero);
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf); 
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */
    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(zero);
	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, zero, 0.0, 0.0);

	zgradpulse(-gzlvl7, gt7);
	decpwrf(rf0);
	decphase(zero);
	delay(tauC - gt7 - 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(-gzlvl7, gt7);
	decpwrf(rf6);
	decphase(one);
	txphase(one);
        delay(tauC - gt7 - 0.5*10.933*pwC - WFG_START_DELAY);
							   /* WFG_START_DELAY */
	decshaped_pulse("offC6", pwC6, one, 0.0, 0.0);
	decoffset(dof);
	zgradpulse(-gzlvl9, gt9);
	decpwrf(rf1);
	decphase(t3);
	delay(2.0e-4);
      if ( dm3[B] == 'y' )     /* begins optional 2H decoupling */
        {
          dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
          dec3unblank();
          dec3phase(zero);
          delay(2.0e-6);
          setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
        }
        rgpulse(pwHd,one,0.0,0.0);
	txphase(zero);
 	delay(2.0e-6);
	obsprgon("waltz16", pwHd, 90.0);
	xmtron();

	decrgpulse(pwC1, t3, 0.0, 0.0);
	decphase(zero);

/*   xxxxxxxxxxxxxxxxxxxxxx       13Ca EVOLUTION        xxxxxxxxxxxxxxxxxx    */

  if (ni==1.0)         /* special 1D check of pwC9 phase enabled when ni=1 */
  {
        decpwrf(rf9);
	delay(10.0e-6 + SAPS_DELAY + 0.5*pwZ1);
							  /* WFG3_START_DELAY */
	sim3shaped_pulse("", "offC9", "", 0.0, pwC9, 2.0*pwN, zero, zero, zero,
							          2.0e-6, 0.0);
	initval(phshift9, v9);
	decstepsize(1.0);
	dcplrphase(v9);  					/* SAPS_DELAY */
	delay(10.0e-6 + WFG3_START_DELAY + 0.5*pwZ1);
  }
  else if(CT_c[A] == 'y')           /* xxxxxxx 13Ca Constant Time EVOLUTION xxxxxxxx */
  {
    decpwrf(rf9);
    if(tau1 - 2.0*pwC1/PI - WFG_START_DELAY -POWER_DELAY > 0.0) {
       delay(tau1 -2.0*pwC1/PI -POWER_DELAY -WFG_START_DELAY);
       sim3shaped_pulse("","offC9","",0.0,pwC8, 2.0*pwN, zero, zero, zero, 
								0.0, 0.0);
    }
    else
       sim3shaped_pulse("","offC9","",0.0,pwC8, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
    
    delay(timeTC- 2.0e-6 -WFG_STOP_DELAY-POWER_DELAY); 

    decpwrf(rf2);
    decrgpulse(pwC2, zero, 2.0e-6, 2.0e-6); 	             /* 13Ca 180 degree pulse */ 

    delay(timeTC-tau1- 4.0e-6 -SAPS_DELAY);
    
    phshift9 = 230.0;  /* = 320-90 - correction for -90 degree phase shift in F1 */
    initval(phshift9, v9);
    decstepsize(1.0);
    dcplrphase(v9);                                         /* SAPS_DELAY */
  }
  else                         /* xxxxxxx 13Ca Conventional EVOLUTION xxxxxxxxx */
  {
    if ((ni>1.0) && (tau1>0.0))          /* total 13C evolution equals d2 exactly */
    {         /* 2.0*pwC1/PI compensates for evolution at 64% rate during pwC1 */
       decpwrf(rf9);
       if(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 0.5*pwZ > 0.0)
       {	   
	   delay(tau1 - 2.0*pwC1/PI - WFG3_START_DELAY - 0.5*pwZ);
							  
	   sim3shaped_pulse("", "offC9", "", 0.0, pwC8, 2.0*pwN, zero, zero, zero,
								      0.0, 0.0);
	   initval(phshift9, v9);
	   decstepsize(1.0);
	   dcplrphase(v9);  				        /* SAPS_DELAY */
	   delay(tau1 - 2.0*pwC1/PI  - SAPS_DELAY - 0.5*pwZ - 2.0e-6);
       }
       else
       {
	 initval(180.0, v9);
	 decstepsize(1.0);
	 dcplrphase(v9);  				        /* SAPS_DELAY */
	 delay(2.0*tau1 - 4.0*pwC1/PI - SAPS_DELAY - 2.0e-6);
       }
    }
    else		       /* 13Ca evolution refocused for 1st increment  */
    {
	decpwrf(rf2);
	delay(10.0e-6);	
	decrgpulse(pwC2, zero, 2.0e-6, 0.0);
	delay(10.0e-6);	
    }
  }
        decphase(t5);
	decpwrf(rf1);
	decrgpulse(pwC1, t5, 2.0e-6, 0.0);


/*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

	xmtroff();
	obsprgoff();
        rgpulse(pwHd,three,2.0e-6,0.0);
	decoffset(dofCO);
	decpwrf(rf6);
	decphase(one);
        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           lk_autotrig();   /* resumes lock pulsing */
           }
	zgradpulse(gzlvl10, gt10);
 	delay(2.0e-4);
	decshaped_pulse("offC6", pwC6, one, 0.0, 0.0);

	zgradpulse(gzlvl8, gt7);
	decpwrf(rf0);
	decphase(zero);
	delay(tauC - gt7 - 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(gzlvl8, gt7);
	decpwrf(rf6);
	decphase(zero);
	delay(tauC - gt7 - 0.5*10.933*pwC - WFG_START_DELAY);
							   /* WFG_START_DELAY */
	decshaped_pulse("offC6", pwC6, zero, 0.0, 0.0);

/*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 EVOLUTION    xxxxxxxxxxxxxxxxxxxxx  */

	zgradpulse(gzlvl4, gt4);
	txphase(one);
	decphase(zero);
	decpwrf(rf8);
	dcplrphase(zero);
	dec2phase(t8);
 	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); /* N15 EVOLUTION BEGINS HERE */
	dec2phase(t9);

        if(SCT[A] == 'y')
        {
	  delay(t2a);
          dec2rgpulse(2.0*pwN, t9, 0.0, 0.0);
	  delay(t2b);
          decshaped_pulse("offC8", pwC8, zero, 0.0, 0.0); /* WFG_START_DELAY  */
        }
        else
        {	
	  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 - pwC3 - WFG_START_DELAY);         /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3, zero, 0.0, 0.0);
          delay(tau2 - gt1 - 2.0*GRADIENT_DELAY - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')  magradpulse(gzcal*gzlvl1, gt1);
          else  zgradpulse(gzlvl1, gt1);   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf); 
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
          obspower(tpwr); obspwrf(4095.0);
	  txphase(t4);
	  delay(0.5e-4 - POWER_DELAY);
	}

    else if (tau2 > pwHs + 0.5e-4)
	{
	  txphase(three);
          delay(timeTN-pwC3-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(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                     /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3, zero, 0.0, 0.0);
          delay(tau2 - pwHs - 0.5e-4);
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf); 
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
          obspower(tpwr); obspwrf(4095.0);
	  txphase(t4);
	  delay(0.5e-4 - POWER_DELAY);
	}
    else
	{
	  txphase(three);
          delay(timeTN - pwC3 - WFG_START_DELAY - gt1 - 2.0*GRADIENT_DELAY
							    - 1.5e-4 - pwHs);
          if (mag_flg[A]=='y')    magradpulse(gzcal*gzlvl1, gt1);
          else  zgradpulse(gzlvl1, gt1);	   	/* 2.0*GRADIENT_DELAY */
	  obspower(tpwrs);				       /* POWER_DELAY */
	  delay(1.0e-4 - POWER_DELAY);                     /* WFG_START_DELAY */
    if (tpwrsf < 4095.0) 
     {obspwrf(tpwrsf); 
        obspower(tpwrs+6.0);}                 /* increases tpwrs by 6dB, now need */
     else
        obspower(tpwrs);
                                          /* tpwrsf to be ~ 2048 for equivalence */
   	  shaped_pulse("H2Osinc", pwHs, three, 0.0, 0.0);
          obspower(tpwr); obspwrf(4095.0);
	  txphase(t4);
	  delay(0.5e-4 - POWER_DELAY);
          decshaped_pulse("offC3", pwC3, zero, 0.0, 0.0);
          delay(tau2);
	}
}
else
{
    if (tau2 > kappa)
	{
          delay(timeTN - pwC3 - WFG_START_DELAY);     	   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3, 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 - pwC3 - 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", pwC3, zero, 0.0, 0.0);
          delay(kappa -pwC3 -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 - pwC3 - WFG_START_DELAY);   /* WFG_START_DELAY */
          decshaped_pulse("offC3", pwC3, 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-pwC3-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", pwC3, 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,rof1);
	dec2power(dpwr2);				       /* POWER_DELAY */
        if (mag_flg[A] == 'y')    magradpulse(icosel*gzcal*gzlvl2, gt1/10.0);
        else   zgradpulse(icosel*gzlvl2, gt1/10.0);            /* 2.0*GRADIENT_DELAY */

        delay(gstab);
        rcvron();
statusdelay(C,1.0e-4 - rof1);
   if (dm3[B]=='y') lk_sample();

	setreceiver(t12);
}		 
Esempio n. 20
0
pulsesequence()
{

/*	Declare variables	*/

int
	t1_counter,                     /* used for states tppi in t1 */
	psi2	= getval("psi2"),	/* collection of inphase and antiphase components */
	phase	= getval("phase");	/* collection of indirect with states method */

char    f1180[MAXSTR];                  /* half-dwell time in t1 */

double
	d0	= getval("d0"),
        corr    = getval("corr"),       /* adjustable correction */
	tau1,				/*  t1 delay */
	pwN	= getval("pwN"),	/* hard 15N 90deg pulse length */
	pwNlvl	= getval("pwNlvl"),	/* power level for hard 15N pulses */
	pwC	= getval("pwC"),	/* hard 13C 90deg pulse length */
	pwClvl	= getval("pwClvl"),	/* power level for hard 15N pulses */
	tauT	= getval("tauT"),	/* optimal transfer delay in seconds */

	gt0	= getval("gt0"),
	gt1	= getval("gt1"),	/* coherence pathway gradients */
	gstab   = getval("gstab"),	/* field stabilization delay   */
	gzlvl0	= getval("gzlvl0"),
	gzlvl1	= getval("gzlvl1"),

        pwHs	= getval("pwHs"),      /* H1 90 degree pulse length at tpwrs */ 
        compH	= getval("compH"),      /* H1 amplifier compression factor */ 
        tpwrs	= getval("tpwrs"),    /* power for the pwHs ("H2Osinc") pulse */
       tpwrsf_d	= getval("tpwrsf_d"),    /*fine power for the pwHs ("H2Osinc") pulse */
       phincr_d = getval("phincr_d");    /* small-angle phase adjust for flipback pulse */ 
                                     /* set phincr_d to zero if shape has phase correction 
                                        already built-in (such as H2Osinc_d.RF) */
   if (phincr_d < 0.0) phincr_d=360+phincr_d; 
   initval(phincr_d,v8); 

getstr("f1180",f1180);
tau1 = d2;
if ( ni > 0 )
  {
   if (f1180[A] == 'y')
    tau1 = d2 + 1./(2.*sw1) - 4*pwN/PI - rof1 - 1.0e-6;
   else
    tau1 = d2  - 4*pwN/PI - rof1 - 1.0e-6;
  }
 

/*	Check the gradient parameters.	*/

  if ( fabs(gzlvl0) > 30000 )
        {
        printf( "gzlvl0 is too high !!!\n" );
        psg_abort(1);
        }
  if ( fabs(gzlvl1) > 30000 )
        {
        printf( "gzlvl1 is too high !!!\n" );
        psg_abort(1);
        }

/*	Check other parameters	*/

  if ( pw > 20e-6 )
	{
	printf( "your pw seems too long !!!  ");
	printf( "  pw must be <= 20 usec \n");
	psg_abort(1);
	}
  if ( pwN > 50e-6 )
	{
	printf( "your pwN seems too long !!!  ");
	printf( "  pwN must be <= 50 usec \n");
	psg_abort(1);
	}
  if ( pwC > 20e-6 )
	{
	printf( "your pwC seems too long !!!  ");
	printf( "  pwC must be <= 20 usec \n");
	psg_abort(1);
	}
  if ( ( dm2[A] == 'y' ) || ( dm2[B] == 'y' ) || ( dm2[C] == 'y' ) )
	{
	printf( "no decoupling should be done during experiment !!!\n" );
	psg_abort(1);
	}

  if ( ( dm[A] == 'y' ) || ( dm[B] == 'y' ) || ( dm[C] == 'y' ) )
	{
	printf( "no decoupling should be done on channel 2 !!!\n" );
	psg_abort(1);
	}

/*	Set variables		*/

	settable(t1,    2,	phi1);
	settable(t2,	1,	phi2);
	settable(t3,    2,	rec);

/* PHASES AND INCREMENTED TIMES */

/*  Phase incrementation for two fids to add */

	if (psi2 == 2)    tsadd(t2,2,4);

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

        if (phase == 2)    tsadd(t1,1,4);                           
         
/* Calculate modifications to phases for States-TPPI acquisition          */

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


status(A);
	delay(d0);
	obsoffset(tof);
	obspower(tpwrs);
	txphase(zero);
	decphase(zero);
	decpower(pwClvl);
	dec2phase(zero);
	dec2power(pwNlvl);

	delay(d1);


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


status(B);
	dec2rgpulse(pwN,zero,rof1,rof1);

	zgradpulse(gzlvl0,gt0);
	delay(gstab);
        obsstepsize(1.0); 
        xmtrphase(v8); 

        if (tpwrsf_d<4095.0)
        {
         obspower(tpwrs+6.0);
         obspwrf(tpwrsf_d);
   	 shaped_pulse("H2Osinc_d", pwHs, two, rof1, 0.0);
        }
         else
        {
         obspower(tpwrs);
   	 shaped_pulse("H2Osinc_d", pwHs, two, rof1, 0.0);
        }
        xmtrphase(zero);
	obspower(tpwr); obspwrf(4095.0);


        rgpulse(pw, zero, rof1, 1.0e-6);

	zgradpulse(gzlvl1,gt1);
	obspower(tpwrs);
        delay(tauT-gt1-pwHs-4*pw/PI-2*GRADIENT_DELAY-2*POWER_DELAY
		-2.0*SAPS_DELAY-WFG_START_DELAY-7.0e-5);
        obsstepsize(1.0); 
        xmtrphase(v8); 

        if (tpwrsf_d<4095.0)
        {
         obspower(tpwrs+6.0);
         obspwrf(tpwrsf_d);
   	 shaped_pulse("H2Osinc_d", pwHs, three, rof1, 0.0);
        }
         else
        {
         obspower(tpwrs);
   	 shaped_pulse("H2Osinc_d", pwHs, three, rof1, 0.0);
        }
        xmtrphase(zero); obspower(tpwr); obspwrf(4095.0);
        rgpulse(pw, one, rof1, 1.0e-6);

	dec2rgpulse(pwN,t1,rof1,1.0e-6);
	dec2phase(zero);
        if ((tau1-pwC/2.0)>0)
         {
	 delay((tau1-pwC)/2);
	 sim3pulse(0.,2.0*pwC,0.,zero,zero,zero,rof1,1.0e-6);
	 delay((tau1-pwC)/2);
         }
	dec2rgpulse(pwN,zero,rof1,1.0e-6);

	obspower(tpwrs);
        delay(tauT-gt1-pwHs-2*pwN-0.5*pw-2*pw/PI-2*POWER_DELAY
		-2*GRADIENT_DELAY-2.0*SAPS_DELAY-rof1-gstab-7.0e-6);

	zgradpulse(gzlvl1,gt1);
	delay(gstab);
        obsstepsize(1.0); 
        xmtrphase(v8); 

        if (tpwrsf_d<4095.0)
        {
         obspower(tpwrs+6.0);
         obspwrf(tpwrsf_d);
   	 shaped_pulse("H2Osinc_d", pwHs, two, rof1, 0.0);
        }
         else
        {
         obspower(tpwrs);
   	 shaped_pulse("H2Osinc_d", pwHs, two, rof1, 0.0);
        }
	xmtrphase(zero); obspower(tpwr); obspwrf(4095.0);

	sim3pulse(pw,0.,2*pwN,zero,zero,zero,rof1,1.0e-6);

	zgradpulse(gzlvl1,gt1);
	delay(tauT-corr-gt1-2*pwN-2*pw/PI-0.5*pw-2.0*SAPS_DELAY-2*GRADIENT_DELAY-rof1-1.0e-6);
                            /* set corr to a value to obtain lp=0  */

	dec2rgpulse(pwN,t2,rof1,0.0);

status(C);
	setreceiver(t3);
}
Esempio n. 21
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             */
            f3180[MAXSTR],    /* Flag to start t3 @ halfdwell             */
            fco180[MAXSTR],    /* Flag for checking sequence              */
            fca180[MAXSTR],    /* Flag for checking sequence              */
            spca180[MAXSTR],  /* string for the waveform Ca 180 */
            spco180[MAXSTR],  /* string for the waveform Co 180 */
            spchirp[MAXSTR],  /* string for the waveform reburp 180 */
            ddseq[MAXSTR],    /* 2H decoupling seqfile */
            shp_sl[MAXSTR],   /* string for seduce shape */
            sel_flg[MAXSTR];

 int         phase, phase2, phase3, ni2, ni3, icosel,
             t1_counter,   /* used for states tppi in t1           */ 
             t2_counter,   /* used for states tppi in t2           */ 
             t3_counter;   /* used for states tppi in t3           */ 

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             tau3,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             taub,         /*  ~ 1/4JNH =  2.25 ms */
             zeta,        /* time for C'-N to refocuss set to 0.5*24.0 ms */
             bigTN,       /* nitrogen T period */
             pwc90,       /* PW90 for c nucleus @ d_c90         */
             pwc180on,    /* PW180 at @ d_c180         */
             pwchirp,     /* PW180 for ca nucleus @ d_creb         */
             pwc180off,     /* PW180 at d_c180 + pad              */
             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 180 13C pulses
				(pwc180on=sqrt(3)/2delta   */
	     d_chirp,
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             sw3,          /* sweep width in f3                    */             
             pw_sl,        /* pw90 for H selective pulse on water ~ 2ms */
             phase_sl,     /* phase for pw_sl */
             tpwrsl,       /* power level for square pw_sl       */

	     pwDlvl,	   /* Power for D decoupling */
	     pwD,	   /* pw90 at pwDlvl  */

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

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

             gstab,       /* delay to compensate for gradient gt5 */

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

/* LOAD VARIABLES */


  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("fco180",fco180);
  getstr("fca180",fca180);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("f3180",f3180);
  getstr("fscuba",fscuba);
  getstr("ddseq",ddseq);
  getstr("shp_sl",shp_sl);

  getstr("sel_flg",sel_flg);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  zeta  = getval("zeta");
  bigTN = getval("bigTN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  pwN = getval("pwN");
  pwNlvl = getval("pwNlvl");
  pwD = getval("pwD");
  pwDlvl = getval("pwDlvl");
  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");
  ni2 = getval("ni2");
  ni3 = getval("ni3");
  pw_sl = getval("pw_sl");
  phase_sl = getval("phase_sl");
  tpwrsl = getval("tpwrsl");

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

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

  if(autocal[0]=='n')
  {     
    getstr("spca180",spca180);
    getstr("spco180",spco180);
    getstr("spchirp",spchirp);
    pwc90 = getval("pwc90");
    pwc180on = getval("pwc180on");
    pwc180off = getval("pwc180off");
    d_c90 = getval("d_c90");
    d_c180 = getval("d_c180");
    pwchirp = getval("pwchirp");
    d_chirp = getval("d_chirp");    
  }
  else
  {    
    strcpy(spca180,"Phard180ca");
    strcpy(spco180,"Phard180co");    
    strcpy(spchirp,"Pchirp180");    
    
    if (FIRST_FID)
    {
      pwC = getval("pwC");
      compC = getval("compC");
      pwClvl = getval("pwClvl");
      co90 = pbox("cal", CO90, CO180ps, dfrq, pwC*compC, pwClvl);          
      co180 = pbox("cal", CO180, CO180ps, dfrq, pwC*compC, pwClvl);          
      ca180 = pbox(spca180, CA180, CA180ps, dfrq, pwC*compC, pwClvl);  
      co180a = pbox(spco180, CO180a, CA180ps, dfrq, pwC*compC, pwClvl);                        
      chirp = pbox(spchirp, CHIRP, CHIRPps, dfrq, pwC*compC, pwClvl);
    }
    pwc90 = co90.pw;         d_c90 = co90.pwr;
    pwc180on = co180.pw;     d_c180 = co180.pwr;    
    pwc180off = ca180.pw;            
    pwchirp = chirp.pw;      d_chirp = chirp.pwr;    
  }   

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */


    if( bigTN - (ni3-1)*0.5/sw3 - WFG3_START_DELAY < 0.2e-6 )
    {
        text_error(" ni3 is too big\n");
        text_error(" please set ni3 smaller or equal to %d\n",
			(int) ((bigTN -WFG3_START_DELAY)*sw3*2.0) +1 );
        psg_abort(1);
    }


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

    if((dm2[A] == 'y' || dm2[B] == 'y' || dm2[C] == 'y' || dm2[D] == 'y'))
    {
        text_error("incorrect dec2 decoupler flags! Should be 'nnnn' ");
        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 > 46 )
    {
        text_error("don't fry the probe, DPWR2 too large!  ");
        psg_abort(1);
    }

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

    if( d_c90 > 62 )
    {
        text_error("don't fry the probe, DHPWR 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( pwc90 > 200.0e-6 )
    {
        text_error("dont fry the probe, pwc90 too high ! ");
        psg_abort(1);
    } 
    if( pwc180off > 200.0e-6 )
    {
        text_error("dont fry the probe, pwc180 too high ! ");
        psg_abort(1);
    } 

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

    if((fca180[A] == 'y') && (ni2 > 1))
    {
        text_error("must set fca180='n' to allow Calfa evolution (ni2>1)\n");
        psg_abort(1);
    } 

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


/*  Phase incrementation for hypercomplex 2D data */

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

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

    if (phase3 == 2) { tsadd(t4, 2, 4); icosel = 1; }
      else icosel = -1;

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    if((f1180[A] == 'y') && (ni > 1)) {
      if (pwc180off > 2.0*pwN) 
        tau1 += (1.0/(2.0*sw1) - 4.0*pwc90/PI - pwc180off 
	      - WFG3_START_DELAY - WFG3_STOP_DELAY - 4.0e-6 - 2.0*POWER_DELAY - 4.0e-6);
      else 
        tau1 += (1.0/(2.0*sw1) - 4.0*pwc90/PI - 2.0*pwN 
              - WFG3_START_DELAY - WFG3_STOP_DELAY - 4.0e-6 - 2.0*POWER_DELAY - 4.0e-6);

        if(tau1 < 0.2e-6) {
         tau1 = 0.4e-6;
	 text_error("tau1 could be negative");
	}
    }
    else
    {

      if (pwc180off > 2.0*pwN)
        tau1 = tau1 - 4.0*pwc90/PI - pwc180off
              - WFG3_START_DELAY - WFG3_STOP_DELAY - 4.0e-6 - 2.0*POWER_DELAY - 4.0e-6;
      else
        tau1 = tau1 - 4.0*pwc90/PI - 2.0*pwN 
              - WFG3_START_DELAY - WFG3_STOP_DELAY - 4.0e-6 - 2.0*POWER_DELAY - 4.0e-6;
 
        if(tau1 < 0.2e-6) tau1 = 0.4e-6;
     }

        tau1 = tau1/2.0;

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if((f2180[A] == 'y') && (ni2 > 1)) {
	if (pwc180off > 2.0*pwN)
          tau2 += ( 1.0 / (2.0*sw2) - 4.0*pwc90/PI - 4.0e-6
		 - 2.0*POWER_DELAY
		 - WFG3_START_DELAY - pwc180off - WFG3_STOP_DELAY - 4.0e-6);
	else
          tau2 += ( 1.0 / (2.0*sw2) - 4.0*pwc90/PI - 4.0e-6
                 - 2.0*POWER_DELAY
                 - WFG3_START_DELAY - 2.0*pwN - WFG3_STOP_DELAY - 4.0e-6);
        if(tau2 < 0.2e-6) {
	  tau2 = 0.4e-6;
	  text_error("tau2 could be negative");
 	} 

    }
    else
    {
        if (pwc180off > 2.0*pwN)
          tau2 = tau2 - 4.0*pwc90/PI - 4.0e-6
                 - 2.0*POWER_DELAY
                 - WFG3_START_DELAY - pwc180off - WFG3_STOP_DELAY - 4.0e-6;
        else
          tau2 = tau2 - 4.0*pwc90/PI - 4.0e-6
                 - 2.0*POWER_DELAY
                 - WFG3_START_DELAY - 2.0*pwN - WFG3_STOP_DELAY - 4.0e-6;
        if(tau2 < 0.2e-6) tau2 = 0.4e-6;
    }

        tau2 = tau2/2.0;

/*  Set up f3180  tau3 = t3               */
 
    tau3 = d4;
    if ((f3180[A] == 'y') && (ni3 > 1)) {
        tau3 += ( 1.0 / (2.0*sw3) );
        if(tau3 < 0.2e-6) tau3 = 0.4e-6;
    }
        tau3 = tau3/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(t6,2,4);    
    }

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obsoffset(tof);
   decoffset(dof);		/* set Dec1 carrier at Co		      */
   obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
   decpower(d_chirp);      /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */

/* Presaturation Period */

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

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

/* Begin Pulses */

status(B);

   rcvroff();
   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.0e-6,2*pwN,zero,zero,zero,0.0,0.0);

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

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

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

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

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

      dec2rgpulse(pwN,zero,0.0,0.0);

      delay( zeta );
  
      dec2rgpulse(2.0*pwN,zero,0.0,0.0);
      decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

      delay(zeta -WFG_START_DELAY -pwchirp -WFG_STOP_DELAY -2.0e-6);

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

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

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

     delay(0.2e-6);
     zgradpulse(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( zeta - 1.34e-3 - 2.0*pw);
  
     dec2rgpulse(2.0*pwN,zero,0.0,0.0);
     decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

     delay(zeta -WFG_START_DELAY -pwchirp -WFG_STOP_DELAY -2.0e-6);

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

   dec2phase(zero); decphase(t1);
   decpower(d_c90);

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

   decrgpulse(pwc90,t1,2.0e-6,0.0);
/* t1 period for Co evolution begins */
   if (fco180[A]=='n')  
     {
      decpower(d_c180);

      delay(tau1);
      sim3shaped_pulse("",spca180,"",0.0,pwc180off,2.0*pwN,zero,zero,zero,4.0e-6,0.0);

      decpower(d_c90);

       delay(tau1);
     }
   else /* for checking sequence */
     {
      decpower(d_c180);
      decrgpulse(pwc180on,zero,4.0e-6,0.0);
      decpower(d_c90);
     }
/* t1 period for Co evolution ends */
   decrgpulse(pwc90,zero,4.0e-6,0.0);

   decoffset(dof-(174-56)*dfrq);   /* change Dec1 carrier to Ca (55 ppm) */
   delay(0.2e-6);
   zgradpulse(gzlvl4,gt4);
   delay(150.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 */

   decrgpulse(pwc90,t5,2.0e-6,0.0);
/* t2 period  for Ca evolution begins */
  if (fca180[A]=='n')
    {
     decphase(zero); dec2phase(zero);
     decpower(d_c180); 
     delay(tau2);
     sim3shaped_pulse("",spco180,"",0.0,pwc180off,2.0*pwN,zero,zero,zero,4.0e-6,0.0);
     decpower(d_c90); 
     delay(tau2);
    }
   else /* for checking sequence */
    {
     decpower(d_c180);
     decrgpulse(pwc180on,zero,4.0e-6,0.0);
     decpower(d_c90);
    }
/* t2 period  for Ca evolution ends */
   decrgpulse(pwc90,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 */

   decoffset(dof);   /* set carrier back to Co */
   decpower(d_chirp);

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

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

   dec2phase(t3);

   delay(bigTN - tau3);

   dec2rgpulse(2.0*pwN,t3,0.0,0.0);
   decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

   txphase(zero);
   dec2phase(t4);

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

   delay(bigTN - WFG_START_DELAY - pwchirp - WFG_STOP_DELAY
         -gt1 -500.2e-6 -2.0*GRADIENT_DELAY);

   delay(tau3);

   sim3pulse(pw,0.0e-6,pwN,zero,zero,t4,0.0,0.0);
/* t3 period ends */

   decpower(d_c90);
   decrgpulse(pwc90,zero,4.0e-6,0.0);
   decoffset(dof-(174-56)*dfrq);
   decrgpulse(pwc90,zero,20.0e-6,0.0);

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

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

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

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

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

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

   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();
/* BEGIN ACQUISITION */
status(C);
   setreceiver(t6);

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

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

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

            dofa,

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

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


	    sw1 = getval("sw1"),

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

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

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

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



/*   LOAD PHASE TABLE    */

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

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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

/* PHASES AND INCREMENTED TIMES */

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

	icosel=1;

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

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

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

	tau1 = tau1/2.0;

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

	tau2 = tau2/2.0;

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

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

  if(t1_counter % 2) 
   {
	tsadd(t1,2,4);
	tsadd(t4,2,4);
	tsadd(t5,2,4);
	tsadd(t11,2,4);
   }

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

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

/* BEGIN PULSE SEQUENCE */

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

	delay(d1);
        rcvroff();

status(B);

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

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

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

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

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

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

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

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

        dofa = dof - 17.5*dfrq; /*change to C1' */
	decoffset(dofa);
/*  ffffffffffffffffffff   BEGIN SENSITIVITY ENHANCE   fffffffffffffffffffff  */
        decrgpulse(pwC, zero, 0.0, 0.0);

if (CChomodec[A]=='y')
 {
	delay(delta_cc);
    	decrgpulse(2.0*pwC, zero, 0.0, 0.0);
	delay(delta_cc);
        decpower(CCdpwr); decphase(zero);
        decprgon(CCdseq,1.0/CCdmf,CCdres);
        decon();  /* CC decoupling on */
	delay(tau2);
    	dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
	delay(tau2);

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

        zgradpulse(icosel*gzlvl1, gt1/2.0);       	/* 2.0*GRADIENT_DELAY */
        delay(gstab);
        decshaped_pulse(pwC_Sel_Shape, pwC_Sel_pw, t9, 0.0, 0.0);
        zgradpulse(-1.0*icosel*gzlvl1, gt1/2.0);       	/* 2.0*GRADIENT_DELAY */
	decphase(t6);
        decpower(pwClvl);
        delay(gstab);
		
 }
else
 {
	decphase(zero);
        zgradpulse(icosel*gzlvl1, gt1/2.0);       	/* 2.0*GRADIENT_DELAY */
	delay(delta_cc + tau2);
    	decrgpulse(2.0*pwC, t9, 0.0, 0.0);
        zgradpulse(-1.0*icosel*gzlvl1, gt1/2.0);       	/* 2.0*GRADIENT_DELAY */
	decphase(t6);
	delay(delta_cc - tau2);
 }		
	simpulse(pw, pwC, zero, t6, 0.0, 0.0);
	decpower(pwC_Sel_lvl);
	decphase(two);
	zgradpulse(gzlvl5, gt5);
	delay(lambda - pwC_Sel_pw/2.0 - gt5);
        simshaped_pulse("",pwC_Sel_Shape, 2.0*pw,pwC_Sel_pw, zero, two, 0.0, 0.0);
	decpower(pwClvl);
	zgradpulse(gzlvl5, gt5);
	txphase(one);
	decphase(one);
	delay(lambda - pwC_Sel_pw/2.0 - gt5);
	simpulse(pw, pwC, one, one, 0.0, 0.0);
	decpower(pwC_Sel_lvl);
	txphase(zero);
	decphase(zero);
	zgradpulse(gzlvl6, gt5);
	delay(lambda - pwC_Sel_pw/2.0 - gt5);
        simshaped_pulse("",pwC_Sel_Shape, 2.0*pw,pwC_Sel_pw, zero, zero, 0.0, 0.0);
	zgradpulse(gzlvl6, gt5);
	delay(lambda - pwC_Sel_pw/2.0 - gt5);
	rgpulse(pw, zero, 0.0, 0.0);
        zgradpulse(gzlvl2, gt1/8.0);         		/* 2.0*GRADIENT_DELAY */
	delay(gstab/2-2.0*GRADIENT_DELAY);		
	rgpulse(2.0*pw, zero, 0.0, 0.0);
	decpower(dpwr);					       /* POWER_DELAY */
	dec2power(dpwr2);				      /* POWER_DELAY */
        zgradpulse(-1.0*gzlvl2, gt1/8.0);         		/* 2.0*GRADIENT_DELAY */
	delay(gstab/2 -2.0*POWER_DELAY-2.0*GRADIENT_DELAY);		
status(C);
		 
	setreceiver(t11);
}		 
Esempio n. 23
0
void pulsesequence()
{

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

char        f2180[MAXSTR],   		      /* Flag to start t2 @ halfdwell */
            fil_flg1[MAXSTR],
            had_flg[MAXSTR],
            shname1[MAXSTR],
	    shname2[MAXSTR],
	    ala_flg[MAXSTR],	    
            ser_flg[MAXSTR],
	    SE_flg[MAXSTR],			    /* SE_flg */
  	    TROSY[MAXSTR];			    /* do TROSY on N15 and H1 */

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

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

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

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

	sw2 = getval("sw2"),

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

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


/*   LOAD PHASE TABLE    */

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

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




/*   INITIALIZE VARIABLES   */

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

        ala_flg[0]='n';

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


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

    /* get calculated pulse lengths of shaped C13 pulses */
	pwS1 = c13pulsepw("cab", "co", "square", 90.0); 
	pwS2 = c13pulsepw("ca", "co", "square", 180.0); 
	pwS3 = c13pulsepw("co", "ca", "sinc", 180.0); 
        pwS4 = c_shapedpw("isnob5",80.0,0.0,zero, 2.0e-6, 2.0e-6);

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

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

/* CHECK VALIDITY OF PARAMETER RANGES */


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

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

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

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

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



/* PHASES AND INCREMENTED TIMES */

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

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



/*  Set up f2180  */

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

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



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

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




/* BEGIN PULSE SEQUENCE */

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

	rcvroff();
        set_c13offset("cab");
	obsoffset(tof);
	obspower(tpwr);
 	obspwrf(4095.0);
	decpower(pwClvl);
	decpwrf(4095.0);
 	dec2power(pwNlvl);
	txphase(one);
	delay(1.0e-5);
        if (TROSY[A] == 'n')
	dec2rgpulse(pwN, zero, 0.0, 0.0);  /*destroy N15 and C13 magnetization*/
	decrgpulse(pwC, zero, 0.0, 0.0);
	zgradpulse(gzlvl0, 0.5e-3);
	delay(gstab);
      if (TROSY[A] == 'n')
	dec2rgpulse(pwN, one, 0.0, 0.0);
	decrgpulse(pwC, zero, 0.0, 0.0);
	zgradpulse(0.7*gzlvl0, 0.5e-3);
	delay(gstab);

      if(dm3[B] == 'y')			  /*optional 2H decoupling on */
         {dec3unblank(); dec3rgpulse(1/dmf3, one, 0.0, 0.0); 
          dec3unblank(); setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);} 
        rgpulse(pw, zero, 2.0e-6, 0.0);
        zgradpulse(gzlvl5, gt5);
        delay(tauCH - gt5 - WFG2_START_DELAY - 0.5e-3 + 68.0e-6 );

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

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

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

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

        decrgpulse(pwC, t3, 0.0, 0.0);

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

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

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

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

/*********************************** 2nd transfer  CB->CA +DEPT CAH ***********/
          decrgpulse(pwC, zero, 0.0, 0.0);
	  c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);  
          delay(tauC1-pwS3-pwS4*0.5);
          c_shapedpulse("reburp",80.0,0.0,zero, 2.0e-6, 2.0e-6);  
          delay(tauC1-tauC2-pwS3-pwS4*0.5);
	  c13pulse("co", "ca", "sinc", 180.0, zero, 0.0, 0.0);  
          delay(tauC2-pw*8.0-had1);
          shaped_pulse(shname1,shpw1,two,0.0,0.0);
          delay(had1);
	  c13pulse("cab", "co", "square", 90.0, zero, 0.0, 0.0);  
/******************************************************************************/
        if(dm3[B] == 'y')		         /*optional 2H decoupling off */
           {dec3rgpulse(1/dmf3, three, 0.0, 0.0); dec3blank();
            setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3); dec3blank();}
  	  zgradpulse(gzlvl3, gt3);
	  delay(2.0e-4);
	  h1decon("DIPSI2", 27.0, 0.0);/*POWER_DELAY+PWRF_DELAY+PRG_START_DELAY */
	  c13pulse("co", "ca", "sinc", 90.0, t5, 2.0e-6, 0.0);          /* point e */
 	  decphase(zero);
	  delay(eta - 2.0*POWER_DELAY - 2.0*PWRF_DELAY);
					        /* 2*POWER_DELAY+2*PWRF_DELAY */
	  c13pulse("ca", "co", "square", 180.0, zero, 2.0e-6, 0.0);     /* pwS2 */
	  dec2phase(zero);
	  delay(theta - eta - pwS2 - WFG3_START_DELAY);
							  /* WFG3_START_DELAY */
	  sim3_c13pulse("", "co", "ca", "sinc", "", 0.0, 180.0, 2.0*pwN,
					     zero, zero, zero, 2.0e-6, 2.0e-6);
  	  initval(phi7cal, v7);
	  decstepsize(1.0);
	  dcplrphase(v7);					        /* SAPS_DELAY */
	  dec2phase(t8);
	  delay(theta - SAPS_DELAY);
      if (SE_flg[0]=='y')                                               /* point f */
	{
 	  nh_evol_se_train("co", "ca"); /* common part of sequence in bionmr.h  */
          if (dm3[B]=='y') lk_sample();
	}
	else
	{
	  nh_evol_train("co", "ca"); /* common part of sequence in bionmr.h  */
          if (dm3[B]=='y') lk_sample();
	}
}		 
Esempio n. 24
0
pulsesequence()
{
  /* DECLARE AND LOAD VARIABLES */

  char f1180[MAXSTR],		/* Flag to start t1 @ halfdwell */
       f2180[MAXSTR],		/* Flag to start t2 @ halfdwell */
       H2Opurge[MAXSTR], stCdec[MAXSTR],	/* calls STUD+ waveforms from shapelib */
       STUD[MAXSTR];		/* apply automatically calculated STUD decoupling */

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

  double tau1,			/*  t1 delay */
         BPdpwrspinlock,        /*  user-defined upper limit for spinlock(Hz) */
         BPpwrlimits,           /*  =0 for no limit, =1 for limit             */
         tau2,			/*  t2 delay */
         ni = getval("ni"), ni2 = getval("ni2"),
	 stdmf = getval("dmf80"),	/* dmf for 80 ppm of STUD decoupling */
         rf80 = getval("rf80"),	/* rf in Hz for 80ppm STUD+ */
         taua = getval("taua"),	/* time delays for CH coupling evolution */
         taub = getval("taub"), tauc = getval("tauc"),
	 /* string parameter stCdec calls stud decoupling waveform from your shapelib. */
         studlvl,		/* coarse power for STUD+ decoupling */
         pwClvl = getval("pwClvl"),	/* coarse power for C13 pulse */
         pwC = getval("pwC"),	/* C13 90 degree pulse length at pwClvl */
         rf0,			/* maximum fine power when using pwC pulses */
	 /* p_d is used to calculate the isotropic mixing on the Cab region            */
         p_d,			/* 50 degree pulse for DIPSI-3 at rfd  */
         rfd,			/* fine power for 9.0 kHz rf at 600MHz         */
         ncyc = getval("ncyc"),	/* no. of cycles of DIPSI-3 */
         spinlock = getval("spinlock"),		/* DIPSI-3 Field Strength in Hz */
	 /* the following pulse length for the SLP pulse is automatically calculated   */
	 /* by the macro "hcch_tocsy".  The SLP pulse shape,"offC10" is called         */
	 /* directly from your shapelib.                                               */
         pwC10 = getval("pwC10"),	/* 180 degree selective sinc pulse on CO(174ppm) */
         rf7,			/* fine power for the pwC10 ("offC10") pulse */
         compC = getval("compC"),	/* adjustment for C13 amplifier compression */
         pwNlvl = getval("pwNlvl"),	/* power for N15 pulses */
         pwN = getval("pwN"),	/* N15 90 degree pulse length at pwNlvl */
         sw1 = getval("sw1"), sw2 = getval("sw2"),
	 gt0 = getval("gt0"),	/* other gradients */
         gt3 = getval("gt3"), gt4 = getval("gt4"), gt5 = getval("gt5"),
         gt7 = getval("gt7"), gzlvl0 = getval("gzlvl0"), gzlvl3 = getval("gzlvl3"),
         gzlvl4 = getval("gzlvl4"), gzlvl5 = getval("gzlvl5"), gzlvl6 = getval("gzlvl6"),
         gzlvl7 = getval("gzlvl7");

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

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

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


  /*   INITIALIZE VARIABLES   */
  if (BPpwrlimits > 0.5)
  {
   if (spinlock > BPdpwrspinlock)
    {
     spinlock = BPdpwrspinlock;  
     printf("spinlock too large, reset to user-defined limit (BPdpwrspinlock)");
     psg_abort(1);
    }
  }

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

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

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

  /* 180 degree one-lobe sinc pulse on CO, null at Ca 139ppm away */
  rf7 = (compC * 4095.0 * pwC * 2.0 * 1.65) / pwC10;	/* needs 1.65 times more     */
  rf7 = (int) (rf7 + 0.5);	/* power than a square pulse */

  if (spinlock < 1000.0)
  {
    printf("Spinlock seems too low. Please check spinlock value ! ");
    psg_abort(1);
  }

  /* dipsi-3 spinlock on CbCa */
  p_d = (5.0) / (9.0 * 4.0 * spinlock);		/* DIPSI-3 */
  rfd = (compC * 4095.0 * pwC * 5.0) / (p_d * 9.0);
  rfd = (int) (rfd + 0.5);
  ncyc = (int) (ncyc + 0.5);
/*************************For Ultra-High Field Probes***************************/
if (sfrq>590.0)
{
 if (ncyc>2)
  {
    if (pwC>15)
     {
      if (rfd > 2000)
       {
        printf("spinlock too large. Lower value for probe protection");
        psg_abort(1);
       }
     }
    else
     {
      if (pwC>14)
       {
        if (rfd > 1800)
         {
          printf("spinlock too large. Lower value for probe protection");
          psg_abort(1);
         }
       }
      else
       {
        if (pwC>13)
         {
          if (rfd > 1600)
           {
            printf("spinlock too large. Lower value for probe protection");
            psg_abort(1);
           }
         }
        else
         {
          if (pwC>12)
           {
            if (rfd > 1400)
             {
               printf("spinlock too large. Lower value for probe protection");
               psg_abort(1);
             }
           }
          else
           {
            if (pwC>11)
             {
              if (rfd > 1200)
               {
                printf("spinlock too large. Lower value for probe protection");
                psg_abort(1);
               }
             }
            else
             {
                if (rfd > 1000)
                 {
                  printf("spinlock too large. Lower value for probe protection");
                  psg_abort(1);
                 }
             }
           }
         }    
       }
     }
  }
 else 
  {
   if (ncyc == 2)
    {
     if (pwC>15)
      {
       if (rfd > 2200)
        {
         printf("spinlock too large. Lower value for probe protection");
         psg_abort(1);
        }
      }
     else
      {
       if (pwC>14)
        {
         if (rfd > 2000)
          {
           printf("spinlock too large. Lower value for probe protection");
           psg_abort(1);
          }
        }
       else
        {
         if (pwC>13)
          {
           if (rfd > 1800)
            {
             printf("spinlock too large. Lower value for probe protection");
             psg_abort(1);
            }
          }
         else
          {
           if (pwC>12)
            {
             if (rfd > 1600)
              {
                printf("spinlock too large. Lower value for probe protection");
                psg_abort(1);
              }
            }
           else
            {
             if (pwC>11)
              {
               if (rfd > 1400)
                {
                 printf("spinlock too large. Lower value for probe protection");
                 psg_abort(1);
                }
              }
             else
              {
                 if (rfd > 1200)
                  {
                   printf("spinlock too large. Lower value for probe protection");
                   psg_abort(1);
                  }
              }
            }
          }    
        }
      }
     }
   else
    {
     if (ncyc == 1)
      {
       if (pwC>15)
        {
         if (rfd > 2400)
          {
           printf("spinlock too large. Lower value for probe protection");
           psg_abort(1);
          }
        }
       else
        {
         if (pwC>14)
          {
           if (rfd > 2200)
            {
             printf("spinlock too large. Lower value for probe protection");
             psg_abort(1);
            }
          }
         else
          {
           if (pwC>13)
            {
             if (rfd > 2000)
              {
               printf("spinlock too large. Lower value for probe protection");
               psg_abort(1);
              }
            }
           else
            {
             if (pwC>12)
              {
               if (rfd > 1800)
                {
                  printf("spinlock too large. Lower value for probe protection");
                  psg_abort(1);
                }
              }
             else
              {
               if (pwC>11)
                {
                 if (rfd > 1600)
                  {
                   printf("spinlock too large. Lower value for probe protection");
                   psg_abort(1);
                  }
                }
               else
                {
                   if (rfd > 1400)
                    {
                     printf("spinlock too large. Lower value for probe protection");
                     psg_abort(1);
                    }
                }
              }
            }       
          }
        }
      }
    }

  }


}
/*********************End: For Ultra-High Field Probes***************************/

  /* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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


  /* PHASES AND INCREMENTED TIMES */
  /*  Phase incrementation for hypercomplex 2D data, States-Haberkorn element */
  if (phase1 == 2)
    tsadd(t3, 1, 4);
  if (phase2 == 2)
    tsadd(t5, 1, 4);

  /*  C13 TIME INCREMENTATION and set up f1180  */

  /*  Set up f1180  */
  tau1 = d2;

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

  tau1 = tau1 / 2.0;


  /*  Set up f2180  */

  tau2 = d3;

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

  tau2 = tau2 / 2.0;



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

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

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



  /*   BEGIN PULSE SEQUENCE   */

  status(A);
  if (dm3[B] == 'y')
    lk_sample();
  if ((ni / sw1 - d2) > 0)
    delay(ni / sw1 - d2);	/*decreases as t1 increases for const.heating */
  if ((ni2 / sw2 - d3) > 0)
    delay(ni2 / sw2 - d3);	/*decreases as t2 increases for const.heating */
  delay(d1);
  if (dm3[B] == 'y')
  {
    lk_hold();
    lk_sampling_off();
  }				/*freezes z0 correction, stops lock pulsing */
  rcvroff();

  obspower(tpwr);
  decpower(pwClvl);
  dec2power(pwNlvl);
  decpwrf(rf0);
  obsoffset(tof);
  txphase(t3);
  delay(1.0e-5);

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

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

  rgpulse(pw, t3, 0.0, 0.0);	/* 1H pulse excitation */
  zgradpulse(gzlvl0, gt0);	/* 2.0*GRADIENT_DELAY */
  decphase(zero);
  delay(taua + tau1 - gt0 - 2.0 * GRADIENT_DELAY - 2.0 * pwC);
  decrgpulse(2.0 * pwC, zero, 0.0, 0.0);
  txphase(zero);
  delay(tau1);
  rgpulse(2.0 * pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl0, gt0);
  txphase(one);
  decphase(t5);
  delay(taua - gt0);
  rgpulse(pw, one, 0.0, 0.0);
  zgradpulse(gzlvl3, gt3);
  delay(2.0e-4);
  decrgpulse(pwC, t5, 0.0, 0.0);
  delay(tau2);
  dec2rgpulse(2.0 * pwN, zero, 0.0, 0.0);
  zgradpulse(gzlvl4, gt4);	/* 2.0*GRADIENT_DELAY */
  decphase(zero);
  decpwrf(rf7);
  delay(taub - 2.0 * pwN - gt4 - 2.0 * GRADIENT_DELAY);
  decshaped_pulse("offC10", pwC10, zero, 0.0, 0.0);
  txphase(zero);
  decpwrf(rf0);
  delay(taub - 2.0 * pw);
  rgpulse(2.0 * pw, zero, 0.0, 0.0);
  delay(tau2);
  decrgpulse(2.0 * pwC, zero, 0.0, 0.0);
  decpwrf(rf7);
  delay(taub);
  decshaped_pulse("offC10", pwC10, zero, 0.0, 0.0);
  zgradpulse(gzlvl4, gt4);	/* 2.0*GRADIENT_DELAY */
  delay(taub - gt4 - 2.0 * GRADIENT_DELAY);
  decpwrf(rfd);
  decrgpulse(1.0e-3, zero, 0.0, 0.0);
  if (ncyc>0)
  {
  initval(ncyc, v2);
  starthardloop(v2);
  decrgpulse(4.9 * p_d, one, 0.0, 0.0);
  decrgpulse(7.9 * p_d, three, 0.0, 0.0);
  decrgpulse(5.0 * p_d, one, 0.0, 0.0);
  decrgpulse(5.5 * p_d, three, 0.0, 0.0);
  decrgpulse(0.6 * p_d, one, 0.0, 0.0);
  decrgpulse(4.6 * p_d, three, 0.0, 0.0);
  decrgpulse(7.2 * p_d, one, 0.0, 0.0);
  decrgpulse(4.9 * p_d, three, 0.0, 0.0);
  decrgpulse(7.4 * p_d, one, 0.0, 0.0);
  decrgpulse(6.8 * p_d, three, 0.0, 0.0);
  decrgpulse(7.0 * p_d, one, 0.0, 0.0);
  decrgpulse(5.2 * p_d, three, 0.0, 0.0);
  decrgpulse(5.4 * p_d, one, 0.0, 0.0);
  decrgpulse(0.6 * p_d, three, 0.0, 0.0);
  decrgpulse(4.5 * p_d, one, 0.0, 0.0);
  decrgpulse(7.3 * p_d, three, 0.0, 0.0);
  decrgpulse(5.1 * p_d, one, 0.0, 0.0);
  decrgpulse(7.9 * p_d, three, 0.0, 0.0);

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

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

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

  endhardloop();
  }
  decrgpulse(9.0 * p_d / 5.0, t9, 2.0e-6, 0.0);
  if (H2Opurge[A] == 'y')
  {
    obspwrf(1000);
    rgpulse(900 * pw, zero, 0.0, 0.0);
    rgpulse(500 * pw, one, 0.0, 0.0);
    obspwrf(4095.0);
  }
  zgradpulse(gzlvl7, gt7);
  decpwrf(rf0);
  delay(50.0e-6);
  rgpulse(pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl7, gt7 / 1.6);
  decrgpulse(pwC, three, 100.0e-6, 0.0);
  zgradpulse(gzlvl5, gt5);
  decphase(zero);
  delay(tauc - gt5);
  simpulse(2.0 * pw, 2.0 * pwC, zero, zero, 0.0, 0.0);
  zgradpulse(gzlvl5, gt5);
  delay(tauc - gt5);
  decrgpulse(pwC, zero, 0.0, 0.0);
  zgradpulse(gzlvl3, gt3);
  if (dm3[B] == 'y')		/* turns off 2H decoupling  */
  {
    setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
    dec3rgpulse(1 / dmf3, three, 2.0e-6, 2.0e-6);
    dec3blank();
    lk_autotrig();		/* resumes lock pulsing */
  }
  delay(2.0e-4);
  rgpulse(pw, zero, 0.0, 0.0);
  zgradpulse(gzlvl6, gt5);
  delay(taua - gt5 + rof1);
  simpulse(2.0 * pw, 2.0 * pwC, zero, zero, 0.0, rof1);
  zgradpulse(gzlvl6, gt5);
  if (STUD[A] == 'y')
    decpower(studlvl);
  else
    decpower(dpwr);
  dec2power(dpwr2);
  delay(taua - gt5 - 2.0 * POWER_DELAY);
  rgpulse(pw, zero, 0.0, rof2);
  rcvron();
  if (dm3[B] == 'y')
    lk_sample();
  setreceiver(t11);
  if ((STUD[A] == 'y') && (dm[C] == 'y'))
  {
    decprgon(stCdec, 1.0 / stdmf, 1.0);
    decon();
    if (dm2[C] == 'y')
    {
      setstatus(DEC2ch, TRUE, dmm2[C], FALSE, dmf2);
    }
  }
  else
    status(C);
}
Esempio n. 25
0
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */

char    	 
        CA90_in_str[MAXSTR],     
  	CA180_in_str[MAXSTR],  CA180n_in_str[MAXSTR],       
        CO180offCA_in_str[MAXSTR],   
        RFpars[MAXSTR],       
        exp_mode[MAXSTR],         /* flag to run 3D, or 2D time-shared 15N TROSY /13C HSQC-SE*/   

	f1180[MAXSTR],   		                     /* Flag to start t1 @ halfdwell */
	f2180[MAXSTR],
	f3180[MAXSTR];			                           /* do TROSY on N15 and H1 */
 
int     icosel=1.0;      			                 /* used to get n and p type */
     

double  x,y,z, t2max, t1max, tpwrs,

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

        tau1, tau2,                                 /*evolution times in indirect dimensions */
        ni2=getval("ni2"),

        tauNH=getval("tauNH"),                                     /* 1/(4Jhn), INEPTs, 2.4ms*/
        tauNH1=getval("tauNH1"),                           /* 1/(4Jhn), TROSY in CN CT, 2.7ms*/
        timeTN1=getval("timeTN1"),                   /* CT time for (first) N->CA*N transfer */
        timeTN=getval("timeTN"),                                /* CT time for last SE TROSY */ 
        timeCN=getval("timeCN"),                     /* CT time for CA -> N transfer, middle */
 
	pwClvl = getval("pwClvl"), 	       	               /* coarse power for C13 pulse */
	pwC = getval("pwC"),     	             /* C13 90 degree pulse length at pwClvl */
        compC = getval("compC"),
        dfrq = getval("dfrq"),
   	              
	pwNlvl = getval("pwNlvl"),	                            /* power for N15 pulses */
        pwN = getval("pwN"),                        /* N15 90 degree pulse length at pwNlvl */
        
	gstab = getval("gstab"),
	g6bal= getval("g6bal"),  
	                         /* balance of the decoding gradient around last 180 pulse on 1H
			        g6bal=1.0 : full g6 is on the right side of the last pw180 on 1H
			        g6bal=0.0:  full g6 is on the left side*/

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

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

    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("exp_mode",exp_mode);
        
    tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));          /*needs 1.69 times more*/
    tpwrs = (int) (tpwrs);                               /*power than a square pulse */
    if (tpwrsf_d<4095.0)
        tpwrs=tpwrs+6.0;  /* add 6dB to let tpwrsf_d control fine power ~2048*/

/*   LOAD PHASE TABLE    */
	
        
        settable(t1,1,phi1);

        settable(t2,4,phi2);                                        /* default double trosy */
	  if (exp_mode[A] == 'h') {settable(t2,4,phi2h);};      /*option for regular hNcaNH */
                
        settable(t3,4,phi3);
        settable(t4,8,phi4);
        settable(t5,2,phi5);
        settable(t6,4,phi6);
        settable(t7,4,phi7);
        settable(t8,4,phi8);
	settable(t21,1,psi1);                          /*trosy and SE hsqc in reverse INPET */
	settable(t22,1,psi2);
        settable(t23,1,psi2c);  
        settable(t31,8,rec); 

/* some checks */

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

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

    if ( (dm3[B] == 'y' )  && (timeCN*2.0 > 60.0e-3) )
       { printf("too lond time for 2H decoupling, SOL ");psg_abort(1);}


/*   INITIALIZE VARIABLES   */
  if(FIRST_FID)                                                          /* call Pbox */
    {
     getstr("CA180_in_str",CA180_in_str);  getstr("CA180n_in_str",CA180n_in_str);
     getstr("CA90_in_str",CA90_in_str);    getstr("CO180offCA_in_str",CO180offCA_in_str);

     strcpy(RFpars,             "-stepsize 0.5 -attn i");

     CA180 =  pbox("et_CA180_auto", CA180_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CA180n = pbox("et_CA180n_auto", CA180n_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CA90  =  pbox("et_CA90_auto", CA90_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CO180offCA = pbox("et_CO180offCA_auto", CO180offCA_in_str, RFpars, dfrq, compC*pwC, pwClvl);
    };


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

   /* t1 , N15 */
    if (phase1 == 2)  {tsadd(t2 ,1,4);}
    if(d2_index % 2)  {tsadd(t2,2,4); tsadd(t31,2,4); }  
   
   
/* setting up semi-CT on t1 (ni) dimension */
    tau1  = d2; 
    t1max=(ni-1.0)/sw1;
  
    if((f1180[A] == 'y') && (ni > 0.0)) 
          {tau1 +=  0.5/sw1 ; t1max+= 0.5/sw1; }  

    if( t1max < timeTN1*2.0) {t1max=2.0*timeTN1;}; 
                            /* if not enough  ni increments, then just regular CT in t1/ni CN */
   /* t2, CA  */

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

/* setup  constant time in t2 (ni2) */
    tau2 = d3;  
    t2max=2.0*(timeCN - CO180offCA.pw);

    if((f2180[A] == 'y') && (ni2 > 0.0)) 
          {tau2 +=  0.5/sw2 ; t2max +=  0.5/sw2 ;}

    if(tau2 < 0.2e-6) {tau2 = 0.0;}


    if ( (ni2-1.0)/sw2 > t2max) 
       { text_error("too  many ni2 increments in t2 !  "); psg_abort(1); }
     
  if(FIRST_FID)                                            
        {
             printf("t1max is %f\n",t1max);
	     printf("t2max is %f\n",t2max);
        };
   

/* BEGIN PULSE SEQUENCE */

status(A);

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

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

        delay(d1);
        zgradpulse(gzlvl2, gt2);
	delay(gstab*3.0);

 if (exp_mode[B]=='n') dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);     /* test for steady-state 15N */
		
       /* Hz -> HzXz INEPT */

   	rgpulse(pw,zero,rof1,rof1);                              /* 1H pulse excitation */
 
        zgradpulse(gzlvl0, gt0);
	delay(tauNH -gt0);

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

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

 	rgpulse(pw, t6, rof1, rof1);

       /* on HzNz now */
      /* water flipback*/

        obspower(tpwrs); obspwrf(tpwrsf_u);
 	shaped_pulse("H2Osinc",pwHs,zero,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0);

       /* purge */
       
	zgradpulse(gzlvl3, gt3);
        dec2phase(t2);
	
	delay(gstab*2.0);
        
/*  HzNz -> NzCAz  +t1 evolution*/

	dec2rgpulse(pwN, t2, 0.0, 0.0);

      /* double-trosy hNcaNH */
	
	delay(tauNH1  -pwHs-4.0*rof1 -pw  
               -2.0*POWER_DELAY -WFG_STOP_DELAY-WFG_START_DELAY);            
        obspower(tpwrs); obspwrf(tpwrsf_d);
 	shaped_pulse("H2Osinc",pwHs,two,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0); 
        rgpulse(pw, zero, rof1, rof1);   
        rgpulse(pw, t7, rof1, rof1);
        obspower(tpwrs); obspwrf(tpwrsf_u);
 	shaped_pulse("H2Osinc",pwHs,t8,rof1,rof1);
	obspower(tpwr);  obspwrf(4095.0);         		
        dec_c13_shpulse(CO180offCA,zero);  
        delay(tau1*0.5);
	dec_c13_shpulse(CO180offCA,zero); dec2phase(zero);

       	delay( timeTN1 -tauNH1 -pwHs  -4.0*rof1 -pw  -2.0*POWER_DELAY
               -WFG_STOP_DELAY -WFG_START_DELAY -CA180.pw -2.0*CO180offCA.pw 
               -3.0*(2.0*POWER_DELAY +WFG_STOP_DELAY +WFG_START_DELAY)); 
                       
	dec_c13_shpulse(CA180,zero);
	delay(tau1*0.5 -timeTN1*tau1/t1max); 
        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);      
	delay( timeTN1 -tau1*timeTN1/t1max);
       	dec2rgpulse(pwN, zero, 0.0, 0.0);

/*   on CAzNz now */

/* purge */
       zgradpulse(gzlvl7, gt7);
       delay(gstab);	

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

	/* dec_c13_shpulse(CA90,t3);*/
        
        /* t2 time, CA evolution */
	decrgpulse(pwC,t3,0.0,0.0);
	decphase(zero);
        delay(0.5*(timeCN+tau2*0.5-CO180offCA.pw)  );
        dec_c13_shpulse(CO180offCA,zero);  
        delay(0.5*(timeCN+tau2*0.5-CO180offCA.pw)  -pwN*2.0 + WFG_STOP_DELAY);

        if (exp_mode[A]=='R')  /* test CA.N relaxation rate  */
           {
	    delay(2.0*pwN);
           } 
        else
           dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
	
	dec_c13_shpulse(CA180n,zero);
        delay(0.5*(timeCN-tau2*0.5-CO180offCA.pw)  );
        dec_c13_shpulse(CO180offCA,zero);  
        delay(0.5*(timeCN-tau2*0.5-CO180offCA.pw) + WFG_START_DELAY);

	/*dec_c13_shpulse(CA90,zero);*/

	decrgpulse(pwC,zero,0.0,0.0);
 

 	if(dm3[B] == 'y') 
         {                     
	  setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);                  
	  if(1.0/dmf3>900.0e-6)
           {
	    dec3power(dpwr3+6.0);
	    dec3rgpulse(0.5/dmf3, three, 1.0e-6, 0.0e-6);
	    dec3power(dpwr3);
	   }
	  else 
           dec3rgpulse(1.0/dmf3, three, 1.0e-6, 0.0e-6);
           dec3blank();
           delay(PRG_START_DELAY);
         }

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

       /*    CaN->N + back to NH */

   	dec2rgpulse(pwN, t4, 0.0, 0.0);
        dec2phase(zero);
        delay(timeTN);
	dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);     
        dec_c13_shpulse(CA180,zero);
        delay(timeTN - CA180.pw   -gt4-gstab -pwHs-3.0*rof1
             -4.0*POWER_DELAY -2.0*WFG_STOP_DELAY-2.0*WFG_START_DELAY
             -2.0*GRADIENT_DELAY
             +4.0*pwN/3.1415-pw);
       zgradpulse(gzlvl4, gt4);
       delay(gstab);	  
    
       /*Water flipback (flipdown actually ) */
        obspower(tpwrs); obspwrf(tpwrsf_d);                         
 	shaped_pulse("H2Osinc",pwHs,three,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0);  
 
/* reverse double INEPT */


/* 90 */  
   rgpulse(pw, t21, rof1, rof1);  
   zgradpulse(gzlvl11, gt1);		       
   delay(tauNH  -gt1 -rof1 
        -CA180.pw -2.0*POWER_DELAY - WFG_STOP_DELAY- WFG_START_DELAY );        
   dec_c13_shpulse(CA180,zero);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   delay(tauNH  - gt1 -gstab);
   zgradpulse(gzlvl11, gt1);		 
   delay(gstab);

 /* 90 */ 

   sim3pulse(pw, 0.0, pwN, one, zero, zero, 0.0, 0.0);
   zgradpulse(gzlvl1, gt1);		 
   delay(tauNH  -gt1);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   delay(tauNH -POWER_DELAY  -gt1- gstab);
   zgradpulse(gzlvl1, gt1);
   dec2phase(t22);		 
   delay(gstab);      
   sim3pulse(0.0,0.0, pwN, one, zero, t22, 0.0, 0.0);  
   zgradpulse(-(1.0-g6bal)*gzlvl6*icosel, gt6);                 /* 2.0*GRADIENT_DELAY */
   delay( gstab   -pwN*0.5 +pw*(2.0/3.1415-0.5) );
   rgpulse(2.0*pw, zero, rof1, rof1);
   dec2power(dpwr2); decpower(dpwr);			      
   zgradpulse(g6bal*gzlvl6*icosel, gt6);		        /* 2.0*GRADIENT_DELAY */
   delay(gstab +2.0*POWER_DELAY );
   status(C);
	setreceiver(t31);
}	 
Esempio n. 26
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];			    /* 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 */

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

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

    /* 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);
 
   /* 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);
    
    if (tpwrsf<4095.0) {obspower(tpwrs+6.0); obspwrf(tpwrsf);}
     else obspower(tpwrs);
    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);

    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);
}		 
Esempio n. 27
0
pulsesequence()
{
 char    
    f1180[MAXSTR],    
    f2180[MAXSTR],
    mag_flg[MAXSTR];  /* y for magic angle, n for z-gradient only  */

 int        
    icosel,
    t1_counter,   
    t2_counter;   

 double      
    ni2,  
    ratio,        /* used to adjust t1 semi-constant time increment */
    tau1,       
    tau2,       
    taua,         /*  ~ 1/4JCH =  1.5 ms - 1.7 ms]        */
    taub,         /*  ~ 3.3 ms          */
    bigTC,        /*  ~ 8 ms            */
    bigTCO,       /*  ~ 6 ms           */
    bigTN,        /*  ~ 12 ms           */
    tauc,         /*  ~ 5.4 ms          */
    taud,         /*  ~ 2.3 ms          */
    gstab,         /*  ~0.2 ms, gradient recovery time     */

    pwClvl,   /* High power level for carbon on channel 2 */
    pwC,      /* C13 90 degree pulse length at pwClvl     */

    compH,     /* Compression factor for H1 on channel 1  */
    compC,     /* Compression factor for C13 on channel 2  */
    pwNlvl,   /* Power level for Nitrogen on channel 3    */
    pwN,      /* N15 90 degree pulse lenght at pwNlvl     */
    maxpwCN,
    bw, ofs, ppm, /* bandwidth, offset, ppm - temporary Pbox parameters */
    pwCa90,   /*90 "offC13" pulse at Ca(56ppm) xmtr at CO(174ppm) */
    pwCa180,  /*180 "offC17" pulse at Ca(56ppm) xmtr at CO(174ppm) */
    pwCO90,   /* 90 "offC6" pulse at CO(174ppm) xmtr at CO(174ppm)*/
    pwCO180,  /* 180 "offC8" pulse at CO(174ppm) xmtr at CO(174ppm)*/
    pwCab180, /* 180 "offC27" pulse at Cab(46ppm) xmtr at CO(174ppm)*/

    tpwrHd,   /* Power level for proton decoupling on channel 1  */
    pwHd,     /* H1 90 degree pulse lenth at tpwrHd.             */
    waltzB1 = getval("waltzB1"),  /* waltz16 field strength (in Hz)     */

    phi_CO,   /* phase correction for Bloch-Siegert effect on CO */
    phi_Ca,   /* phase correction for Bloch-Siegert effect on Ca */

    gt1,
    gt2,
    gt3,
    gt4, 
    gt5,
    gt6,
    gt7,
    gt0,

    gzlvl1,  
    gzlvl2,   
    gzlvl3,
    gzlvl4, 
    gzlvl5,
    gzlvl6,   /* N15 selection gradient level in DAC units */
    gzlvl7,
    gzlvl0,   /* H1 gradient level in DAC units            */
    gzcal,    /* gradient calibration (gcal)               */
    dfCa180,
    dfCab180,
    dfC90,
    dfCa90,
    dfCO180;
 
         
/* LOAD VARIABLES */

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

    gzcal  = getval("gzcal");
      ni2  = getval("ni2");
    taua   = getval("taua"); 
    taub   = getval("taub");
    tauc = getval("tauc");
    bigTC = getval("bigTC");
    bigTCO = getval("bigTCO");
    bigTN = getval("bigTN");
    taud = getval("taud");
    gstab = getval("gstab");
  
    pwClvl = getval("pwClvl");
    pwC = getval("pwC");
    compH = getval("compH");
    compC = getval("compC");

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

    phi_CO = getval("phi_CO");
    phi_Ca = getval("phi_Ca");

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

    setautocal();                        /* activate auto-calibration flags */ 
        
    if (autocal[0] == 'n') 
    { 
      pwCa90 = getval("pwCa90");
      pwCa180 = getval("pwCa180");
      pwCab180 = getval("pwCab180");
      pwCO90 = getval("pwCO90");
      pwCO180 = getval("pwCO180");

      dfCa180 = (compC*4095.0*pwC*2.0*1.69)/pwCa180;           /*power for "offC17" pulse*/
      dfCab180 = (compC*4095.0*pwC*2.0*1.69)/pwCab180;       /*power for "offC27" pulse*/
      dfC90  = (compC*4095.0*pwC*1.69)/pwCO90;                  /*power for "offC6" pulse */
      dfCa90  = (compC*4095.0*pwC)/pwCa90;                     /*power for "offC13" pulse*/
      dfCO180  = (compC*4095.0*pwC*2.0*1.65)/pwCO180;          /*power for "offC8" pulse */

      dfCa90 = (int) (dfCa90 + 0.5);
      dfCa180 = (int) (dfCa180 + 0.5);
      dfC90 = (int) (dfC90 + 0.5);
      dfCO180 = (int) (dfCO180 + 0.5);	
      dfCab180 = (int) (dfCab180 +0.5);

    /* power level and pulse time for WALTZ 1H decoupling */
	pwHd = 1/(4.0 * waltzB1) ;                          
	tpwrHd = tpwr - 20.0*log10(pwHd/(compH*pw));
	tpwrHd = (int) (tpwrHd + 0.5);
    }
    else
    {
      if(FIRST_FID)                                            /* call Pbox */
      {
        ppm = getval("dfrq"); bw = 118.0*ppm; ofs = -118.0*ppm;
        offC6 = pbox_make("offC6", "sinc90n", bw, 0.0, compC*pwC, pwClvl);
        offC8 = pbox_make("offC8", "sinc180n", bw, 0.0, compC*pwC, pwClvl);
        offC17 = pbox_make("offC17", "sinc180n", bw, ofs, compC*pwC, pwClvl);
        bw = 128.0*ppm;
        offC13 = pbox_make("offC13", "square90n", bw, ofs, compC*pwC, pwClvl);
        ofs = -128.0*ppm;
        offC27 = pbox_make("offC27", "sinc180n", bw, ofs, compC*pwC, pwClvl);
        bw = 2.8*7500.0;
        wz16 = pbox_Dcal("WALTZ16", 2.8*waltzB1, 0.0, compH*pw, tpwr);

        ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
      } 
      dfC90 = offC6.pwrf;      pwCO90 = offC6.pw;
      dfCO180 = offC8.pwrf;    pwCO180 = offC8.pw;
      dfCa90 = offC13.pwrf;    pwCa90 = offC13.pw;
      dfCa180 = offC17.pwrf;   pwCa180 = offC17.pw;
      dfCab180 = offC27.pwrf;  pwCab180 = offC27.pw;
      tpwrHd = wz16.pwr;       pwHd = 1.0/wz16.dmf;
    }

    maxpwCN = 2.0*pwN;
    if (pwCab180 > pwN) maxpwCN = pwCab180;

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */
   
    if(ni > 64)
    {
       printf("ni is out of range. Should be: 14 to 64 ! \n");
       psg_abort(1);
    }
/*
    if(ni/sw1 > 2.0*(bigTCO))
    {
       printf("ni is too big, should be < %f\n", sw1*2.0*(bigTCO));
       psg_abort(1);
    }
*/

    if(ni2/sw2 > 2.0*(bigTN - pwCO180))
    {
       printf("ni2 is too big, should be < %f\n",2.0*sw2*(bigTN-pwCO180));
       psg_abort(1);
    }

    if((dm[A] == 'y' || dm[B] == '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( dpwr > 50 )
    {
        printf("don't fry the probe, DPWR too large!  ");
        psg_abort(1);
    }

/*  Phase incrementation for hypercomplex 2D data */

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

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

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

    ratio = 2.0*bigTCO*sw1/((double) ni);
    ratio = (double)((int)(ratio*100.0))/100.0;
    if (ratio > 1.0) ratio = 1.0;
    if((dps_flag) && (ni > 1)) 
        printf("ratio = %f => %f\n",2.0*bigTCO*sw1/((double) ni), ratio);

/*  Set up f2180  tau2 = t2               */
    tau2 = d3;
    if ((f2180[A] == 'y') && (ni2 > 1))
      { tau2 += (1.0/(2.0*sw2)); }
    if(tau2 < 0.2e-6) tau2 = 0.0;
    tau2 = tau2/4.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(t16,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(t16,2,4);    
    }

    decstepsize(1.0);
    initval(phi_CO, v1);
    initval(phi_Ca, v2);

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   	delay(d1-1.0e-3);
    obsoffset(tof);
    decoffset(dof);
    obspower(tpwr);        
    decpower(pwClvl);
    decpwrf(4095.0);
    dec2power(pwNlvl);
    txphase(zero);
    decphase(zero);
    dec2phase(zero);
    rcvroff();

    if(gt6 > 0.2e-6)
    {
       delay(10.0e-6);
       decrgpulse(pwC, zero, 1.0e-6, 1.0e-6);
       delay(0.2e-6);
       zgradpulse(gzlvl6, gt6);
    }  
    decpwrf(dfCa180); 
    delay(1.0e-3);

    rgpulse(pw,zero,1.0e-6,1.0e-6);            
    delay(2.0e-6);
    zgradpulse(gzlvl0,gt0);  
    delay(taua - gt0 - 2.0e-6 - WFG_START_DELAY);

    simshaped_pulse("","offC17",2.0*pw,pwCa180,zero,zero,1.0e-6,1.0e-6);
      /* c13 offset on CO, slp 180 on Ca */
    delay(taua - gt0 - 500.0e-6 - WFG_STOP_DELAY);
    zgradpulse(gzlvl0,gt0); 
    txphase(one);
    delay(500.0e-6);
    rgpulse(pw, one, 1.0e-6, 1.0e-6);
    decphase(zero);
  
    delay(2.0e-6);
    zgradpulse(gzlvl3,gt3);

    obspower(tpwrHd);
    decpwrf(dfCa90);
    delay(200.0e-6);
   

/* c13 offset on CO, slp 90 on Ca */
    decshaped_pulse("offC13", pwCa90, zero, 0.0, 0.0);
    delay(taub -PRG_START_DELAY);

    obsprgon("waltz16", pwHd, 180.0);
    xmtron();

    decpwrf(dfC90);
    decphase(t1);
    delay(bigTC -taub -SAPS_DELAY -PWRF_DELAY);

/* c13 offset on CO, on-res 90 on CO */
    decshaped_pulse("offC6", pwCO90, t1, 0.0, 0.0);
/* CO EVOLUTION BEGINS */

    decpwrf(dfCO180);
    decphase(zero);
    delay(bigTCO/2.0 +maxpwCN/2.0 +WFG_STOP_DELAY -2.0*pwCO90/PI -ratio*tau1);

/* c13 offset on CO, on-res 180 on CO */
    decshaped_pulse("offC8", pwCO180, zero, 0.0, 0.0);

    decpwrf(dfCab180);
    delay(bigTCO/2.0 +(2.0 -ratio)*tau1 -PRG_STOP_DELAY);
    xmtroff();
    obsprgoff();

/* c13 offset on CO, slp 180 at Cab */
    sim3shaped_pulse("","offC27","",0.0,pwCab180,2.0*pwN,zero,zero,zero,0.0,0.0); 

    obsprgon("waltz16", pwHd, 180.0);
    xmtron();
    decpwrf(dfCO180);
    delay(bigTCO/2.0 +(2.0 -ratio)*tau1 -PRG_START_DELAY);

/* c13 offset on CO, on-res 180 on CO */
    decshaped_pulse("offC8", pwCO180, zero, 0.0, 0.0);

    decpwrf(dfC90);
    dcplrphase(v1);  
    delay(bigTCO/2.0 +maxpwCN/2.0 +WFG_STOP_DELAY -2.0*pwCO90/PI -ratio*tau1 -SAPS_DELAY);

/* CO EVOLUTION ENDS */
    decshaped_pulse("offC6", pwCO90, zero, 0.0, 0.0);
/* c13 offset on CO, on-res 90 on CO */

    decpwrf(dfCa90);
    decphase(t3); dcplrphase(v2);
    delay(bigTC -2.0*SAPS_DELAY -PWRF_DELAY);

/* c13 offset on CO, slp 90 at Ca */
    decshaped_pulse("offC13", pwCa90, t3, 0.0, 0.0);

    xmtroff();

    decpwrf(dfCO180);
    decphase(zero); dcplrphase(zero);
    dec2phase(t2);   

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

    obsprgon("waltz16", pwHd, 180.0);
    xmtron();
    txphase(zero);
    delay(150.0e-6);

    dec2rgpulse(pwN, t2, 0.0, 0.0);
/* N15 EVOLUTION BEGINS HERE */

    delay(bigTN/2.0 -tau2);

    decshaped_pulse("offC8", pwCO180, zero, 0.0, 0.0); /* c13 offset on CO, on-res 180 on CO */

    decpwrf(dfCa180);
    dec2phase(t4);
    delay(bigTN/2.0 -tau2);
 
    dec2rgpulse(2.0*pwN, t4, 0.0, 0.0);
    decshaped_pulse("offC17", pwCa180, zero, 0.0, 0.0); /* c13 offset on CO, slp 180 at Ca */

    decpwrf(dfCO180);
    delay(bigTN/2.0 +tau2 -pwCa180 -WFG_START_DELAY -WFG_STOP_DELAY);

    decshaped_pulse("offC8", pwCO180, zero, 0.0, 0.0);
       /* c13 offset on CO, on-res 180 on CO */

    delay(bigTN/2.0 +tau2 -tauc -PRG_STOP_DELAY);
    dec2phase(t5);
    xmtroff();
    obsprgoff();
    obspower(tpwr);

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

    delay(tauc -gt1 -2.0*GRADIENT_DELAY);
  
/* N15 EVOLUTION ENDS HERE */
    sim3pulse(pw,0.0, pwN, zero,zero, t5, 0.0, 0.0);

    dec2phase(zero);
    delay(2.0e-6);
    zgradpulse(0.8*gzlvl5, gt5);
    delay(taud - gt5 - 2.0e-6);

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

    delay(taud - gt5 - 500.0e-6);
    zgradpulse(0.8*gzlvl5, gt5);
    txphase(one);
    decphase(one);
    delay(500.0e-6);

    sim3pulse(pw,0.0, pwN, one,zero, one, 0.0, 0.0);
    
    delay(2.0e-6);
    txphase(zero);
    decphase(zero);
    zgradpulse(gzlvl5, gt5);
    delay(taud - gt5 - 2.0e-6);
    sim3pulse(2.0*pw,0.0, 2.0*pwN, zero,zero, zero, 0.0, 0.0);
  
    delay(taud - gt5 - 2.0*POWER_DELAY - 500.0e-6);
    zgradpulse(gzlvl5, gt5);
    decpower(dpwr);
    dec2power(dpwr2);
    delay(500.0e-6);

    rgpulse(pw, zero, 0.0, 0.0);

    delay(gstab +gt2 +2.0*GRADIENT_DELAY);

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

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

    delay(0.5*gstab);    

    rcvron();
statusdelay(C, 0.5*gstab);
    setreceiver(t16);
}
Esempio n. 28
0
pulsesequence()
{
  void      makeHHdec(), makeCdec(); 	                  /* utility functions */
  int       ihh=1,        /* used in HH decoupling to improve water suppression */
            t1_counter;
  char	    C13refoc[MAXSTR],		/* C13 sech/tanh pulse in middle of t1 */
	    Hdecflg[MAXSTR],                        /* HH-h**o decoupling flag */
	    Cdecflg[MAXSTR],                 /* low power C-13 decoupling flag */
            TROSY[MAXSTR],
            wtg3919[MAXSTR];
  double    tauxh, tau1,
            pwNt = 0.0,               /* pulse only active in the TROSY option */
            gsign = 1.0,
                               /* temporary Pbox parameters */
            bw, pws, ofs, ppm, nst,  /* bandwidth, pulsewidth, offset, ppm, # steps */
            gzlvl3=getval("gzlvl3"),
            gt3=getval("gt3"),
            JNH = getval("JNH"),
            pwN = getval("pwN"),
            pwNlvl = getval("pwNlvl"),  
            pwHs, tpwrs=0.0, compH=1.0,  /* H1 90 degree pulse length at tpwrs */               
            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 */
            compC = getval("compC"),   /* adjustment for C13 amplifier compr-n */
            tpwrsf = getval("tpwrsf");   /* adjustment for soft pulse power*/


/* INITIALIZE VARIABLES */

    getstr("C13refoc",C13refoc);
    getstr("TROSY",TROSY);
    getstr("wtg3919",wtg3919);
    getstr("Hdecflg", Hdecflg);
    getstr("Cdecflg", Cdecflg);

    if(wtg3919[0] != 'y')      /* selective H20 one-lobe sinc pulse needs 1.69  */
    {                                   /* times more power than a square pulse */
      pwHs = getval("pwHs");            
      compH = getval("compH");
    }
    else 
      pwHs = pw*2.385+7.0*rof1+d3*2.5; 

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

      if(wtg3919[0] != 'y')      /* selective H20 one-lobe sinc pulse needs 1.69  */
      {                                   /* 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); 
      }	  
    }
    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("stC200", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
          C13ofs = 100.0;
        }
        if(wtg3919[0] != 'y')
          H2Osinc = pbox_Rsh("H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
        ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
      }
      if (C13refoc[A]=='y') rfst = stC200.pwrf;
      if (wtg3919[0] != 'y') 
      { 
        pwHs = H2Osinc.pw; tpwrs = H2Osinc.pwr-1.0;  /* 1dB correction applied */ 
      }
    }
    if (tpwrsf<4095.0) tpwrs = tpwrs + 6.0;

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

    if(Cdecflg[0] == 'y') makeCdec();     /* make shapes for HH h**o-decoupling */
    if(Hdecflg[0] == 'y') makeHHdec();
    if(Hdecflg[0] != 'n') ihh = -3;

/* 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 - pw;
    if(tau1 < 0.0) tau1 = 0.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, 1, 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);
     if(Hdecflg[0] != 'n')
     {
       delay(5.0e-5);
       rgpulse(pw,zero,rof1,0.0);                 
       rgpulse(pw,one,0.0,rof1);                 
       zgradpulse(1.5*gzlvl3, 0.5e-3);
       delay(5.0e-4);
       rgpulse(pw,zero,rof1,0.0);                 
       rgpulse(pw,one,0.0,rof1);                 
       zgradpulse(-gzlvl3, 0.5e-3);
     }
     
     delay(d1);
     rcvroff();
     
   status(B);

     rgpulse(pw, zero, rof1, rof1);
     
     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*ihh*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("stC200", 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.65*gzlvl3,gt3);
       delay(tauxh-gt3 );
       
       sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,rof1,rof1);
       
       zgradpulse(0.65*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("", "stC200", 2.0*pw, 1.0e-3, t4, zero, 0.0, 0.0);  
         dec2phase(t3);  
         delay(tau1 - 0.5e-3 - WFG2_STOP_DELAY);
       }
       else 
       {
         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+5.0e-5);
     
     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); if (tpwrsf<4095.0) obspwrf(tpwrsf);  
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr); if (tpwrsf<4095.0) obspwrf(4095.0);
       sim3pulse(2.0*pw, 0.0, 2.0*pwN, v8, zero, zero, 0.0, 0.0);
       obspower(tpwrs); if (tpwrsf<4095.0)obspwrf(tpwrsf);
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr); if (tpwrsf<4095.0)obspwrf(4095.0);
     } 
        
     zgradpulse(gzlvl3,gt3);   

     if(Cdecflg[0] == 'y')
     {
       delay(tauxh-gt3-pwHs-rof1-pwNt-3.0*POWER_DELAY-PRG_START_DELAY); 
       dec2rgpulse(pwNt, zero, rof1, rof1); 
       dec2power(dpwr2);
       rcvron();

     statusdelay(C,5.0e-5);
       setreceiver(t5);  
       pbox_decon(&Cdseq);
      
       if(Hdecflg[0] == 'y')
         homodec(&HHdseq); 
     }
     else
     {
       delay(tauxh-gt3-pwHs-rof1-pwNt-POWER_DELAY); 
       dec2rgpulse(pwNt, zero, rof1, rof1); 
       dec2power(dpwr2);
       rcvron();

     statusdelay(C,5.0e-5);
       setreceiver(t5);  
      
       if(Hdecflg[0] == 'y')
         homodec(&HHdseq); 
     }       
}
Esempio n. 29
0
void pulsesequence()
{
/* DECLARE AND LOAD VARIABLES */
char
	ch90shape[MAXSTR],
	ch180shape[MAXSTR],
        exp_mode[MAXSTR],   /* flag to run 3D, or 2D time-shared 15N TROSY /13C HSQC-SE*/    
        decCACO[MAXSTR],    
        caco180shape[MAXSTR],
	f1180[MAXSTR],   		              /* Flag to start t1 @ halfdwell */
	f2180[MAXSTR],
	f3180[MAXSTR],
	f4180[MAXSTR];			                    /* do TROSY on N15 and H1 */
 
int         icosel, max_pcyc;      			  /* used to get n and p type */
     
double  
        tpwrs,
        ni2=getval("ni2"),
        ni3=getval("ni3"),
        tau1, tau1p,tau2,tau3,tau3p,         /*evolution times in indirect dimensions */
        tauNH=getval("tauNH"),                                             /* 1/(4Jhn)*/
        tauCH=getval("tauCH"),                                            /* 1/(4Jch) */
        tauCH1= getval("tauCH1"),     /* tauCH/2.0+tauNH/2.0,*/ /* 1/(8Jch) +1/(8Jnh) */
        tauCH2= getval("tauCH2"),
        swC = getval("swC"),                        /* spectral widths in 13C methyls */
	pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
	pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
        swN = getval("swN"),                                /* spectral widths in 15N */  	              
	pwNlvl = getval("pwNlvl"),	                      /* power for N15 pulses */
        pwN = getval("pwN"),                  /* N15 90 degree pulse length at pwNlvl */   
        ch90pwr=getval("ch90pwr"),
        ch90pw=getval("ch90pw"),
	ch90corr=getval("ch90corr"),
        ch90dres=getval("ch90dres"),
        ch90dmf=getval("ch90dmf"),
 	ch180pw=getval("ch180pw"),
	ch180pwr=getval("ch180pwr"),
        caco180pw=getval("caco180pw"),
        caco180pwr=getval("caco180pwr"),
        mix=getval("mix"),
        tpwrsf_d = getval("tpwrsf_d"), /* fine power adustment for first soft pulse(down)*/
        tpwrsf_u = getval("tpwrsf_u"), /* fine power adustment for second soft pulse(up) */
        pwHs = getval("pwHs"),                     /* H1 90 degree pulse length at tpwrs */
        compH =getval("compH"),

	gstab = getval("gstab"),
	
  	gt0 = getval("gt0"),     
        gt1 = getval("gt1"),
        gt2 = getval("gt2"),
 	gt3 = getval("gt3"),
	gt4 = getval("gt4"),
	gt5 = getval("gt5"),
        gt6 = getval("gt6"),
 	gt7 = getval("gt7"),
	gt8 = getval("gt8"),
	gt9 = getval("gt9"),
	gt10 = getval("gt10"),

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

        getstr("f1180",f1180);
        getstr("f2180",f2180);
        getstr("ch180shape",ch180shape);
        getstr("ch90shape",ch90shape);
        getstr("decCACO",decCACO);
        getstr("caco180shape",caco180shape);
        getstr("exp_mode",exp_mode);

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

        if (tpwrsf_d<4095.0)
         tpwrs=tpwrs+6.0;  /* add 6dB to let tpwrsf_d control fine power ~2048*/

      if( (exp_mode[A]!='2') && (exp_mode[A]!='3') && (exp_mode[A]!='4') )
          {text_error("invalid exp_mode, Should be either 2D or 3D or 4D\n "); psg_abort(1); }

/*   LOAD PHASE TABLE    */
	
        
        settable(t1,1,phi1);
        settable(t2,4,phi2);
	settable(t12,4,phi2); {tsadd(t12,2,4);}

        settable(t3,1,phi3);
        settable(t4,2,phi4);
        settable(t5,2,phi5);
        settable(t6,4,phi6);
        
        settable(t7,8,phi7);
        settable(t8,8,phi8);
 
        /* changing sign */

         if( (exp_mode[A]=='4') && (exp_mode[C]=='a') )
              {tsadd(t7,2,4); tsadd(t5,2,4); }
      

	settable(t21,1,psi1);                          /*trosy and SE hsqc in reverse INPET */
	settable(t22,1,psi2);
        settable(t23,1,psi2c);

        if(exp_mode[A]=='2') {settable(t31,2,rec);}
        if(exp_mode[A]=='3') {settable(t31,4,rec);}
	if(exp_mode[A]=='4') {settable(t31,8,rec);}

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


/* special case for  swapping t2 and t3 for test purposes */

if( (exp_mode[A]=='4') && (exp_mode[B]=='x') && (ni3=1) )
	{	
	 text_error("Acquiring t3 axis in ni2 dimension (instead of t2), set nt to 8! "); 
         tau3  = 0.5*(d3_index/swC+0.5/swC)-pw-rof1 -pwC*2.0/M_PI ;  /* increment corresponds to 13C increment */
	 tau3p = 0.5*(d3_index/swN+0.5/swN) -pw-rof1  -pwC -pwN*2.0/M_PI -tau3; 
         if(d3_index % 2)    { tsadd(t7,2,4); tsadd(t8,2,4); tsadd(t31,2,4); }
    	 if (phase2 == 2)  {tsadd(t7 ,1,4); tsadd(t8 ,1,4);}
         tau2=0.0;
        }
else    {    
         if (phase2 == 2)  {tsadd(t2 ,1,4); tsadd(t12,1,4);}
         if (phase3 == 2)  {tsadd(t7 ,1,4); tsadd(t8 ,1,4);}
         if(d3_index % 2)    { tsadd(t2,2,4);  tsadd(t12,2,4); tsadd(t31,2,4); }    
         tau3  = 0.5*(d4_index/swC+0.5/swC)-pw -rof1 -pwC*2.0/M_PI ;  /* increment corresponds to 13C increment */
         tau3p = 0.5*(d4_index/swN+0.5/swN) -pw -rof1 -pwC -pwN*2.0/M_PI -tau3; 
         if(d4_index % 2)    { tsadd(t7,2,4); tsadd(t8,2,4); tsadd(t31,2,4); }
         tau2 = d3;
         tau2 += 0.0*(-pw*4.0/M_PI-rof1*2.0);
         if((f2180[A] == 'y') && (ni2 > 0.0)) {tau2 += ( 1.0 / (2.0*sw2) );  }
         if(tau2 < 0.2e-6) {tau2 = 0.0;}
         tau2 = tau2/2.0;
        }

 
/* simultaneous Ntrosy-ChsqcSE, last part */
/*  Phase incrementation for hypercomplex 2D data, States-Haberkorn element */

       if (phase1 == 1)    {icosel =  1;  }
            else 	  {  tsadd(t21,2,4);  tsadd(t22,2,4); tsadd(t23,2,4); icosel = -1;  }

       if(d2_index % 2)   { tsadd(t4,2,4); tsadd(t5,2,4); tsadd(t31,2,4); }  
          /* ECHO-ANTIECHO + STATES-TPPI t1, t1' in TROSY/HSQC last step */

       tau1  = 1.0*d2_index/swC;  /* increment corresponds to 13C increment */
       tau1p = 1.0*d2_index*(1.0/swN-1.0/swC); 
    
/* BEGIN PULSE SEQUENCE */

status(A);

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

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

        delay(d1); 

  
/* Destroy 13C magnetization*/

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

       /* NOESY */

if(exp_mode[A]!='2')
{  /* 3-4D */

     if(exp_mode[A]=='4')
	{ /* full 4D */
          /* t3 evolution, the very first HSQC */

 	      /* Hz -> HzXz INEPT */

	   	rgpulse(pw,two,rof1,rof1);                         /* 1H pulse excitation */
 	        zgradpulse(gzlvl7, gt0);      delay(tauCH-gt0);
	        decrgpulse(pwC*2.0, zero, 0.0, 0.0); delay(tauNH -tauCH -pwC*2.0 );
	   	sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
 	  	delay(tauNH - gt0 -gstab); zgradpulse(gzlvl7, gt0); delay(gstab);
 		rgpulse(pw, one, rof1, rof1);

             /* water defoc-refoc */
               delay(gstab); zgradpulse(gzlvl8, gt8); delay(gstab);

              /* t3 time */

               if((ni3==0))
                {
		 dec2rgpulse(pwN,t7,0.0,0.0);
     		 dec2rgpulse(pwN,two,0.0,0.0);   
		 decrgpulse(pwC, t8, 0.0, 0.0);
		 decrgpulse(pwC, two, 0.0, 0.0);
		 rgpulse(pw*2.0, zero, rof1, rof1);
                 delay(pwN*2.0+pwC*2.0);
                }
               else
                {
	      	 dec2rgpulse(pwN,t7,0.0,0.0);
                 delay(tau3p);
		 decrgpulse(pwC, t8, 0.0, 0.0);
                 delay(tau3);
		 rgpulse(pw*2.0, zero, rof1, rof1);
                 delay(tau3);
		 decrgpulse(pwC, two, 0.0, 0.0);
		 delay(tau3p);
		 dec2rgpulse(pwN,two,0.0,0.0);
                }

		/* water defoc-refoc */
               delay(gstab); zgradpulse(gzlvl8, gt8); delay(gstab);

	   	/* back inept, water to +Z */
 
		rgpulse(pw,one,rof1,rof1);                  
 	        zgradpulse(gzlvl9, gt0);      delay(tauCH-gt0);
	        decrgpulse(pwC*2.0, zero, 0.0, 0.0); delay(tauNH -tauCH -pwC*2.0 );
	   	sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
 	  	delay(tauNH - gt0 -gstab); zgradpulse(gzlvl9, gt0); delay(gstab);
 		rgpulse(pw,  two, rof1, rof1);

              /* purge */

		zgradpulse(gzlvl10, gt10); delay(2.0*gstab);


        }     /*end of full 4D */


  /************************* t2 evolution, 1H and NOE****************************** */
		/* for the case of no flipbacks in NOE part of the experiment, shift first pulse
                   in t2 time by 45 deg and let water bring itself back at the end
                   of mixing time by radiation dumping */

 		if(   (exp_mode[D]=='t') ) 
                 { initval(1.0, v10);
	           obsstepsize(45.0);
	           xmtrphase(v10);       
 		 } 
                else 
                 {
		   xmtrphase(zero);
		   obspower(tpwrs); obspwrf(tpwrsf_d);                         
		   shaped_pulse("H2Osinc",pwHs,t12,rof1,rof1);
		   obspower(tpwr); obspwrf(4095.0);
	         }
             
	        rgpulse(pw,t2,rof1,rof1);    
	        xmtrphase(zero);   /* SAPS_DELAY */
	        delay(tau2);

 	        decrgpulse(2.0*pwC,zero,0.0,0.0);  dec2rgpulse(2.0*pwN,zero,0.0,0.0);
	         
	        delay(tau2);

	        rgpulse(pw*2.0,zero,rof1,rof1);
	        delay(pwN*2.0+pwC*2.0 + SAPS_DELAY);
	        rgpulse(pw,zero,rof1,rof1);
               
		if(   (exp_mode[D]!='t') )
		{
		  obspower(tpwrs); obspwrf(tpwrsf_u);                         
		  shaped_pulse("H2Osinc",pwHs,zero,rof1,rof1);
		  obspower(tpwr);  obspwrf(4095.0);
 		}

	      /* NOESY period */

 	        delay(mix-gt2-4.0*gstab );     
		zgradpulse(gzlvl2, gt2);
		delay(4.0*gstab);
              
} /* end 3-4 D acquisition */


/* N-TROSY/C-HSQCse   */

       /* Hz -> HzXz INEPT */

   	rgpulse(pw,two,rof1,rof1);                 /* 1H pulse excitation */
        zgradpulse(gzlvl0, gt0);
        delay(tauCH-gt0);
        decrgpulse(pwC*2.0, zero, 0.0, 0.0); 	
	delay(tauNH -tauCH -pwC*2.0 );
   	sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   	delay(tauNH - gt0 -gstab);
	zgradpulse(gzlvl0, gt0);
	delay(gstab);
 	rgpulse(pw, one, rof1, rof1);

       /* on HzXz now */
      /* water flipback*/
        obspower(tpwrs); obspwrf(tpwrsf_u);
 	shaped_pulse("H2Osinc",pwHs,two,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0);

       /* purge */
	zgradpulse(gzlvl3, gt3);
	dec2phase(t4);
	delay(gstab*2.0);

       /* t1 (C) and  t1+t1'(N) evolution */

   	dec2rgpulse(pwN, t4, 0.0, 0.0);
        delay(gt4+gstab  + gt4+gstab + pwC*3.0 
			+2.0*(pwHs +2.0*rof1));
	if(decCACO[A]=='y'){ delay(2.0*caco180pw);}
	dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);  
 	delay(tau1p);   /* t1 */        
        decrgpulse(pwC,t5,0.0,0.0);
        delay(tau1*0.5);
	if(decCACO[A]=='y')
	 {
          decpower(caco180pwr);
          decshaped_pulse(caco180shape,caco180pw,zero, 0.0, 0.0);
          decpower(pwClvl);
         }
	obspower(ch180pwr);                           /*180 on methyls*/
        shaped_pulse(ch180shape,ch180pw,zero,rof1,rof1);
	obspower(tpwr);
        delay(tau1*0.5);             
       	zgradpulse(gzlvl4, gt4);        /*coding */
	delay(gstab + pwHs -ch180pw -2.0*GRADIENT_DELAY -2.0*POWER_DELAY -WFG_START_DELAY- WFG_STOP_DELAY);
        decrgpulse(2.0*pwC,zero,0.0,0.0);
	if(decCACO[A]=='y')
	 {
          decpower(caco180pwr);
          decshaped_pulse(caco180shape,caco180pw,zero, 0.0, 0.0);
          decpower(pwClvl);
         }
        /* delay(ch180pw+2.0*rof1);*/
       	zgradpulse(gzlvl5, gt4);
        delay(gstab - rof1 -2.0*GRADIENT_DELAY -2.0*POWER_DELAY -WFG_START_DELAY- WFG_STOP_DELAY);
       
       /*Water flipback (flipdown actually ) */
         obspower(tpwrs); obspwrf(tpwrsf_d);                         
 	shaped_pulse("H2Osinc",pwHs,three,rof1,rof1);
	obspower(tpwr);  obspwrf(4095.0); 
     
/* reverse double INEPT */


        sim3pulse(pw, pwC, 0.0, t21, t23, zero, rof1, rof1);
        /* rgpulse(pw, t21, rof1, rof1); */
        zgradpulse(gzlvl11, gt1);		 
        delay(gstab);
        delay(tauCH1 -gt1 -gstab -2.0*pwC 
	+     (-2.0/M_PI*pwC-0.5*(pwN-pwC) +pwN)); 
        decrgpulse(2.0*pwC,zero,0.0,0.0);
        delay(tauNH -tauCH1 - 0.65*(pw + pwN)-rof1 -(pwC-pw) 
	-(-2.0/M_PI*pwC-0.5*(pwN-pwC) +pwN) );
        sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
        zgradpulse(gzlvl11, gt1);		 
        delay(gstab);
        delay(tauCH1-gt1 -gstab-2.0*pwC); 
        decrgpulse(2.0*pwC,zero,0.0,0.0);
        delay(tauNH -1.3*pwN -tauCH1);    
        sim3pulse(pw, pwC, pwN, one, zero, zero, 0.0, 0.0);
        zgradpulse(gzlvl1, gt1);		 
        delay(gstab);
        delay(tauCH2-2.0*pwC-gt1-gstab); 
        decrgpulse(2.0*pwC,zero,0.0,0.0);
        delay(tauNH -1.3*pwN-tauCH2);
        sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0); 
        zgradpulse(gzlvl1, gt1);		 
        delay(gstab);
        delay(tauNH-1.6*pwN -POWER_DELAY -ch90pw*ch90corr -gt1-gstab +pwN*0.5 -PRG_START_DELAY);
  
        /* delay(ch90pw*0.5);
           sim3pulse(0.0,0.0, pwN, one, zero, t22, 0.0, 0.0);  
           delay(ch90pw*0.5);*/
        /* sim3shaped_pulse(ch90shape,"hard","hard",ch90pw,0.0, pwN, zero,zero, t22,0.0,0.0);*/

        /*  ch90corr is a fraction of ch90pw to correct for a 1H phase rollcaused by shaped 90 on
            CH3 protons for a sinc pulse ch90corr=0.41 seems to be good. */ 

        obspower(ch90pwr);
        txphase(one);
        obsunblank();    xmtron();
        obsprgon(ch90shape,1.0/ch90dmf,ch90dres);                          /*PRG_START_DELAY */
        delay(ch90pw*ch90corr-pwN*0.5);
        dec2rgpulse(pwN, t22, 0.0, 0.0);
        delay(ch90pw*(1.0-ch90corr)-pwN*0.5);
        obsprgoff();  xmtroff();    obsblank();                             /*PRG_STOP_DELAY */
        obspower(tpwr);                                                        /*POWER_DEALY */	 
        delay( gstab +gt6 +2.0*GRADIENT_DELAY 
               +2.0*POWER_DELAY -0.65*pw -POWER_DELAY
		+pwN*0.5 -ch90pw*(1.0-ch90corr) 
                -PRG_STOP_DELAY);
        rgpulse(2.0*pw, zero, rof1, rof1);
	dec2power(dpwr2); decpower(dpwr);	                            /* 2.0*POWER_DELAY */

        zgradpulse(gzlvl6*icosel, gt6);		                         /* 2.0*GRADIENT_DELAY */
        delay(gstab);
   status(C);

	setreceiver(t31);
}		 
Esempio n. 30
0
pulsesequence()
{
  int       t1_counter;
  char	    CCLS[MAXSTR],	      /* C13 refocussing pulse in middle of t1 */
            wtg3919[MAXSTR],
	    f1180[MAXSTR];   		       /* Flag to start t1 @ halfdwell */

  double    timeCT=getval("timeCT"),
 	    tauxh, tau1,
            gzlvl3=getval("gzlvl3"),
            gzlvl4=getval("gzlvl4"),
            gt3=getval("gt3"),
            gt4=getval("gt4"),
            gstab=getval("gstab"),			/* gradient recovery delay */
            JNH = getval("JNH"),
            pwN = getval("pwN"),
            pwNlvl = getval("pwNlvl"),  
            pwHs, tpwrs=0.0, compH=1.0,          /* H1 90 degree pulse length at tpwrs */               
            sw1 = getval("sw1"),
                               /* temporary Pbox parameters */
            pwClvl = getval("pwClvl"), 	         /* coarse power for C13 pulse */
            pwC = getval("pwC");       /* C13 90 degree pulse length at pwClvl */

    getstr("CCLS",CCLS);
    getstr("wtg3919",wtg3919);
    getstr("f1180",f1180);
    
/* 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( dpwr2 > 50 )
    { text_error("don't fry the probe, dpwr2 too large!  "); psg_abort(1); }

/* INITIALIZE VARIABLES */
    
    if(wtg3919[0] != 'y')      /* selective H20 one-lobe sinc pulse needs 1.69  */
    {                                   /* times more power than a square pulse */
      pwHs = getval("pwHs");            
      compH = getval("compH");
    }
    else 
      pwHs = pw*2.385+7.0*rof1+d3*2.5; 

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

    setautocal();                        /* activate auto-calibration flags */ 
        
    if (autocal[0] == 'n') 
    {
      if(wtg3919[0] != 'y')      /* selective H20 one-lobe sinc pulse needs 1.69  */
      {                                   /* 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); 
      }	  
    }
    else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
    {
      if(FIRST_FID)                                            /* call Pbox */
      {
        if(wtg3919[0] != 'y')
          H2Osinc = pbox_Rsh("H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
      }
      if (wtg3919[0] != 'y') 
        { pwHs = H2Osinc.pw; tpwrs = H2Osinc.pwr-1.0; } /* 1dB correction applied */ 
    }

/* LOAD VARIABLES */

    if(ix == 1) d2_init = d2;
    t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5);
    
/*  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;


/* LOAD PHASE TABLES */

      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 ) tsadd(t2, 1, 4); 
                                   
    if(t1_counter %2)          /* calculate modification to phases based on */
    { tsadd(t2,2,4); tsadd(t5,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(4095.0);
     delay(d1);
     
   status(B);

     rgpulse(pw, zero, rof1, rof1);
     
     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);

     decphase(zero);
     txphase(t4);      
     zgradpulse(gzlvl3,gt3);
     delay(gstab); 

       dec2rgpulse(pwN, t2, rof1, rof1);
/* CT EVOLUTION BEGINS */
       dec2phase(t3);

       delay(timeCT -SAPS_DELAY -tau1);
       if (CCLS[A]=='y')
         {
          sim3pulse(0.0, 2.0*pwC, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
 
          delay(timeCT -2.0*pw); 

          rgpulse(2.0*pw, t4, 0.0, 0.0);  
         }
        else
         {
          dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
 
          delay(timeCT -2.0*pwC); 

          simpulse(2.0*pw, 2.0*pwC, t4, zero, 0.0, 0.0);
         }
       delay(tau1);
/* CT EVOLUTION ENDS */
       dec2rgpulse(pwN, t3, rof1, rof1);
       
       zgradpulse(gzlvl3,gt3);
       delay(gstab);

       rgpulse(pw, two, rof1, rof1);
       decrgpulse(pwC, zero, rof1, rof1);  

     zgradpulse(gzlvl4,gt4);
     txphase(v7); dec2phase(zero);
     delay(tauxh -gt4 -pwHs -rof1 -2.0*pwC -2.0*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(gzlvl4,gt4);   
     delay(tauxh -gt4 -pwHs -rof1 -POWER_DELAY); 
     dec2power(dpwr2);

   status(C);
     setreceiver(t5);   
}