Ejemplo n.º 1
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);
}
Ejemplo n.º 2
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); 
     }       
}
Ejemplo n.º 3
0
void pulsesequence()
{
 char   codec[MAXSTR], codecseq[MAXSTR];

 int	icosel,  t1_counter;

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

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

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

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

        gstab = getval("gstab"),

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

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

/* Load phase cycling variables */

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

   angle_N=0.0; cos_N=0.0;

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

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

/* check validity of parameter range */

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

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

/* set up angles for PR42 experiments */

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

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

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

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

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

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


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

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

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

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


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


/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

      delay(d1);

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

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

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

status(B);

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

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

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

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

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

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

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

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

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

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

      delay(tau1);

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

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

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

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

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

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

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

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

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

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

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

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

      txphase(two);
      obspower(tpwrs);

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

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

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

      dec2phase(t4);
      delay(tau3); 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      zgradpulse(icosel*gzlvl2, gt1/10.0);    

      dec2power(dpwr2);	
      delay(gstab);

status(C);
      setreceiver(t11);
} 
Ejemplo n.º 4
0
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
            RELAY[MAXSTR],                         /* Insert HCCH-relay delay */
            ribose[MAXSTR],                         /* ribose CHn groups only */
            aromatic[MAXSTR],                     /* aromatic CHn groups only */
            rna_stCshape[MAXSTR],     /* calls sech/tanh pulses from shapelib */
            rna_stCdec[MAXSTR],        /* calls STUD+ waveforms from shapelib */
	    mag_flg[MAXSTR],             /* Flag to use magic-angle gradients */
	    H2O_flg[MAXSTR],
	    sspul[MAXSTR],
            SHAPE[MAXSTR],
	    STUD[MAXSTR];   /* apply automatically calculated STUD decoupling */
 
int         t1_counter,  		        /* used for states tppi in t1 */
            t2_counter,  	 	        /* used for states tppi in t2 */
            ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
            delta1,delta2,
               ni = getval("ni"),
            lambda = 0.94/(4*getval("JCH")),       /* 1/4J H1 evolution delay */
            tCH = 1/(6.0*getval("JCH")),          /* 1/4J C13 evolution delay */
            tCC = 1/(8*getval("JCC")),

        pwClvl = getval("pwClvl"),              /* coarse power for C13 pulse */
        pwC = getval("pwC"),          /* C13 90 degree pulse length at pwClvl */
   rfC,                           /* maximum fine power when using pwC pulses */
   compC = getval("compC"),       /* adjustment for C13 amplifier compression */
                               /* temporary Pbox parameters */
   bw, pws, ofs, ppm, nst,     /* bandwidth, pulsewidth, offset, ppm, # steps */

/* Sech/tanh inversion pulses automatically calculated by macro "rna_cal"     */
/* and string parameter rna_stCshape calls them from your shapelib.           */
   rfst = 0.0,          /* fine power for the rna_stCshape pulse, initialised */
   dofa,        /* dof shifted to 80 or 120ppm for ribose or aromatic spectra */

/* string parameter stCdec calls stud decoupling waveform from your shapelib.*/
   studlvl,	                         /* coarse power for STUD+ decoupling */
            stdmf = getval("dmf80"),     /* dmf for 80 ppm of STUD decoupling */
            rf80 = getval("rf80"),                /* rf in Hz for 80ppm STUD+ */

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

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

	gt3 = getval("gt3"),
	gt4 = getval("gt4"),
	gt5 = getval("gt5"),
	gt7 = getval("gt7"),
	gt8 = getval("gt8"),
	gt9 = getval("gt9"),
        gzcal = getval("gzcal"),
	grecov = getval("grecov"),
	gzlvl0 = getval("gzlvl0"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),

	gzlvl7 = getval("gzlvl7"),		/* triax option */
	gzlvl8 = getval("gzlvl8"),
	gzlvl9 = getval("gzlvl9");

    getstr("f1180",f1180);
    getstr("mag_flg",mag_flg);
    getstr("f2180",f2180);
    getstr("RELAY",RELAY);
    getstr("ribose",ribose);
    getstr("aromatic",aromatic);
    getstr("H2O_flg",H2O_flg);
    getstr("sspul",sspul);
    getstr("SHAPE",SHAPE);
    getstr("STUD",STUD);


/*   INITIALIZE VARIABLES   */

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

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

  if (autocal[0] == 'n') 
  {
      /* 50ppm sech/tanh inversion */
      rfst = (compC*4095.0*pwC*4000.0*sqrt((7.5*sfrq/600+3.85)/0.41));
      rfst = (int) (rfst + 0.5);
  }
  else        /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */
  {
    if(FIRST_FID)                                            /* call Pbox */
    {
      ppm = getval("dfrq"); 
      bw = 50.0*ppm; pws = 0.001; ofs = 0.0; nst = 500.0; 
      stC50 = pbox_makeA("rna_stC50", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
      if (dm3[B] == 'y') H2ofs = 3.2;
      ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
    }
    rfst = stC50.pwrf; 
  }
        strcpy(rna_stCshape, "rna_stC50");
        strcpy(rna_stCdec, "wurst80");
        studlvl = pwClvl + 20.0*log10(compC*pwC*4.0*rf80);
        studlvl = (int) (studlvl + 0.5);

/*  RIBOSE spectrum only, centered on 80ppm. */
  if (ribose[A]=='y')
        dofa = dof - 30.0*dfrq;

/*  AROMATIC spectrum only, centered on 120ppm */
  else
        dofa = dof + 10*dfrq;


/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

  if((dm3[A] == 'y' || dm3[C] == 'y' ))
	{printf("incorrect dec1 decoupler flags! Should be 'nyn' or 'nnn' ");
								psg_abort(1); }
  if ((dm3[B] == 'y'  &&   dpwr3 > 44 ))
	{ printf("Deuterium decoupling power too high ! "); psg_abort(1);}

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

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


/*  CHOICE OF PULSE SEQUENCE */

  if ( ((ribose[A]=='y') && (aromatic[A]=='y')) )
   { text_error("Choose  ONE  of  ribose='y'  OR  aromatic='y' ! ");
        psg_abort(1); }

  if ( ((aromatic[A]=='y') && (RELAY[A]=='y')) )
   { text_error("No RELAY with aromatic='y' ! ");
        psg_abort(1); }


/* LOAD VARIABLES */

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


/* INITIALIZE VARIABLES */

/* Phase incrementation for hypercomplex data */

   if ( phase1 == 2 )     /* Hypercomplex in t1 */
     tsadd(t1,1,4);

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

/* calculate modification to phases based on current t1 values
   to achieve States-TPPI acquisition */

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

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

   if(ix == 1) d3_init = d3;
   t2_counter = (int)((d3-d3_init)*sw2 + 0.5);
   if(t2_counter % 2)     
   {
       tsadd(t2,2,4);
       tsadd(t11,2,4);
   }
 
/* set up so that get (90, -180) phase corrects in F1 if f1180 flag is y */

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

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

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

   if (ni > 1)
      delta1 = (double)(t1_counter*(lambda - gt5 - 0.2e-3))/((double)(ni-1));
   else delta1 = 0.0;
   if (ni2 > 1)
      delta2 = (double)(t2_counter*(tCC - 0.6e-3))/((double)(ni2-1));
   else delta2 = 0.0;

   initval(7.0, v1);
   obsstepsize (45.0);

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obsoffset(tof);
   decoffset(dofa);
   dec2offset(dof2);
   obspower(tpwr-12);                   
   decpower(pwClvl);
   decpwrf(rfC);
   dec2power(pwNlvl);                  
   decphase(zero);
   dec2phase(zero);
   if (sspul[0] == 'y')
   {
      rgpulse(200*pw, one, 10.0e-6, 0.0e-6);
      rgpulse(200*pw, zero, 0.0e-6, 1.0e-6);
   }
   obspower(tpwr);                   
   xmtrphase(v1);
   txphase(t1);
   if (dm3[B] == 'y') lk_sample();
   delay(d1);
   if (dm3[B] == 'y') lk_hold();
   rcvroff();

       decrgpulse(pwC, zero, rof1, rof1);
       delay(rof1);
       zgradpulse(gzlvl0,0.5e-3); 
       delay(grecov);

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

status(B);
	rgpulse(pw, t1, 1.0e-4, rof1);
	xmtrphase(zero);
	txphase(zero);

	zgradpulse(gzlvl5,gt5); 

/*
        decpwrf(rfst);
        delay(lambda - gt5 - rof1 - SAPS_DELAY - GRADIENT_DELAY - POWER_DELAY -
                        WFG2_START_DELAY - 0.5e-3 + 70.0e-6 + tau1);

        decshaped_pulse(rna_stCshape, 1.0e-3, zero, 0.0, 0.0);

        delay(tau1 - delta1);

        rgpulse(2.0*pw, zero, 0.0, rof1);
        txphase(one);
        decpwrf(rfC);

        zgradpulse(gzlvl5,gt5);
        delay(lambda - delta1 - gt5 - rof1 - GRADIENT_DELAY - POWER_DELAY - 0.5e-3 + 70.0e-6);
*/


        delay(lambda - gt5 - rof1 - SAPS_DELAY - GRADIENT_DELAY + tau1);

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

        delay(tau1 - delta1);

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

        zgradpulse(gzlvl5,gt5);
        delay(lambda - delta1 - gt5 - rof1 - GRADIENT_DELAY);

	rgpulse(pw, one, 0.0, rof1);
	decphase(t2);
	txphase(zero);

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

	delay(grecov);

	decrgpulse(pwC, t2, rof1, 0.0);
	decphase(zero);

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

	delay(tCH - 2*pwN);

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

	delay(tCC - tCH + tau2 - delta2 - 2.0*pw);
	
	decrgpulse(2.0*pwC, t3, 0.0, 0.0);
	decphase(t4);

	delay(tCC - delta2);

	decrgpulse(pwC, t4, 0.0, rof1);
	txphase(zero);
	decphase(zero);

  if(RELAY[A] == 'y')
   {
        zgradpulse(gzlvl4, gt4);
        delay(tCC - gt4 - GRADIENT_DELAY - pwC);

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

        zgradpulse(gzlvl4, gt4);
        delay(tCC - gt4 - GRADIENT_DELAY - pwC);

        decrgpulse(pwC, zero, 0.0, 0.0);
   }

	zgradpulse(gzlvl4,gt4); 
   	delay(tCC - gt4);

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

   if (H2O_flg[A] == 'y')
   {
      delay(tCC - gt4 - grecov - POWER_DELAY);

      zgradpulse(gzlvl4,gt4); 

      txphase(one);
      decphase(one);
      delay(grecov);

      decrgpulse(pwC, one, 0.0, rof1);
      rgpulse(900*pw, one, 0.0, rof1);
      txphase(zero);

      rgpulse(500*pw, zero, rof1, rof1);
      decphase(one);

      if(mag_flg[A] == 'y')
         magradpulse(gzcal*gzlvl7,gt7);
      else
         zgradpulse(gzlvl7,gt7);
      delay(200.0e-6);

      simpulse(pw, pwC, zero, one, 0.0, rof1);
      decphase(zero);

      zgradpulse(gzlvl4,gt4); 
      delay(tCH - gt4);

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

      zgradpulse(gzlvl4,gt4); 
      delay(tCH - gt4);
   }
   else
   {
      delay(tCC - tCH - 2.0*pw - POWER_DELAY);
      rgpulse(2.0*pw, zero, 0.0, rof1);

      zgradpulse(gzlvl4,gt4); 
      delay(tCH - gt4 - rof1);
   }
   
	decrgpulse(pwC, zero, 0.0, rof1);
	txphase(zero);

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

	delay(grecov);

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

	rgpulse(pw, zero, 0.0, rof1);

  if (SHAPE[A] =='y')
   {
	decpwrf(rfst);

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

	delay(lambda - gt9 - GRADIENT_DELAY - POWER_DELAY - WFG2_START_DELAY - 0.5e-3 + 70.0e-6);

        simshaped_pulse("",rna_stCshape,2*pw, 1.0e-3, zero, zero, 0.0, rof1);
        decphase(zero);

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

	decpwrf(rfC);

if (STUD[A]=='y') decpower(studlvl); else decpower(dpwr);

	delay(lambda - gt9 -rof1 -0.5*pw - 2*POWER_DELAY - GRADIENT_DELAY - 0.5e-3 + 70.0e-6);
   }
  else
   {
   if(mag_flg[A] == 'y')
      magradpulse(gzcal*gzlvl9,gt9);
   else
      zgradpulse(gzlvl9,gt9);

        delay(lambda - gt9 - GRADIENT_DELAY);

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

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

if (STUD[A]=='y') decpower(studlvl); else decpower(dpwr);

        delay(lambda - gt9 -rof1 -0.5*pw - POWER_DELAY - GRADIENT_DELAY);
     } 

	rgpulse(pw, zero, rof1, rof2);
	rcvron();
if (dm3[B] == 'y') lk_sample();
	setreceiver(t11);

if ((STUD[A]=='y') && (dm[C] == 'y'))
	{
        decunblank();
        decon();
        decprgon(rna_stCdec,1/stdmf, 1.0);
        startacq(alfa);
        acquire(np, 1.0/sw);
        decprgoff();
        decoff();
        decblank();
        }
   else	
	 status(C);
setreceiver(t11);
}
Ejemplo n.º 5
0
pulsesequence()
{
char    f1180[MAXSTR],
        f2180[MAXSTR],
	f3180[MAXSTR],
        mag_flg[MAXSTR];

 int	phase, icosel,
	t1_counter,
	t2_counter,
	t3_counter;

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

	pwNlvl,
	pwN,

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

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

/* LOAD VARIABLES */

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

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

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

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

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

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

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

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

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

/* check validity of parameter range */

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

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

/* Load phase cycling variables */

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

   settable(t11, 8, rec_1);

/* Phase incrementation for hypercomplex data */

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

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

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

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

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

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

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

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

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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

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

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

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

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

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

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

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

   dec2rgpulse(pwN,t3,0.0,0.0);

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

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

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

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

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

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

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

   rgpulse(pw, zero, 0.0, 0.0);

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

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

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

status(C);
   setreceiver(t11);
}		 
Ejemplo n.º 6
0
pulsesequence()
{
/* DECLARE VARIABLES */

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

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

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

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

             BigT,
             BigT1,

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

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

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

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

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

  ni = getval("ni"); 

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

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

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

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

  getstr("N_flg",N_flg);

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

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

/* check validity of parameter range */

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

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

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

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

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

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

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


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


/* LOAD VARIABLES */

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

/* INITIALIZE VARIABLES */

  tauxh = 1/(4*jxh);

/* Phase incrementation for hypercomplex data */

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

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

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

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

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

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

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

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

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

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

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

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

   tau2 = tau2/2.0;

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

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

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

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

/* Now include Bax/Logan trick */

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

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

   }

   else
      zeta = 0.0;

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

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



/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */


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

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

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

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

status(B);

   obsoffset(tof);

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

  /* eliminate all magnetization originating from 15N */

  dec2rgpulse(pwx2,zero,0.0,0.0);

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

  rgpulse(pw,zero,0.0,0.0);

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

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

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

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

  txphase(one); dec2phase(t1);

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

  rgpulse(pw,one,0.0,0.0);       

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

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

  txphase(zero);

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

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

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

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

     }

     else

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

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

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

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

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

  dec2rgpulse(pwx2,zero,0.0,0.0);

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

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

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

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

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

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

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

  delay(tau1);

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

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

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

  rgpulse(pw,one,0.0,0.0);

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

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

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

  }

  else {

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

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

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

  xmtrphase(zero);
  txphase(t9);

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

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

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

  delay(tau1);

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

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

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

  rgpulse(pw,one,0.0,0.0);

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

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

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

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

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

  }

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

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

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

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

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

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

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

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

  rgpulse(pw,one,0.0,0.0);

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

  txphase(t6);

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

  decphase(zero); 

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

  delay(tau3);
  delay(tau3);

  }

  else {

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

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

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

  }

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

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

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

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

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

  rgpulse(pw,t6,0.0,0.0);

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

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

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

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

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

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

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

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

  dec2phase(zero);

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

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

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

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

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

  dec2rgpulse(pwx2,zero,0.0,0.0);

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

  delay(BigT1 - 2.0*POWER_DELAY);

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

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

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

/* acquire data */

status(C);
     setreceiver(t10);
}
Ejemplo n.º 7
0
void pulsesequence()
{
/* DECLARE VARIABLES */

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

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

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

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

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

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

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

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

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

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

/* LOAD VARIABLES */

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

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


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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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

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

   if( gzlvl3*gzlvl4 > 0.0 ) 

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */


status(A);

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   rgpulse(pw,zero,0.0,0.0);  

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

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

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

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

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

    /* DECLARE AND LOAD VARIABLES */

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

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

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

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

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

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

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

                sw1 = getval("sw1"),

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

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

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

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



    /*   LOAD PHASE TABLE    */

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

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

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



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

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


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

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

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

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

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

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



    /* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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



    /*  RELAXATION TIMES AND FLAGS */

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


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




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

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


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


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

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


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


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


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


    /* PHASES AND INCREMENTED TIMES */

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

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


    /*  Set up f1180  */

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



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

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



    /*  Correct inverted signals for NH2 only spectra  */

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



    /* BEGIN PULSE SEQUENCE */

    status(A);

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

    delay(d1);


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

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

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

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

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

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

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

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

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

    /*  xxxxxxxxxxxxxxxxxx    OPTIONS FOR N15 RELAXATION    xxxxxxxxxxxxxxxxxxxx  */

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

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

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

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

            endloop(v5);
        }

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

    /*   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    */

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

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

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

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

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

        loop(v5,v6);

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

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

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

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

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

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

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

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

        delay(tau1);

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

    setreceiver(t12);
}
Ejemplo n.º 9
0
pulsesequence()
{



/* DECLARE AND LOAD VARIABLES */

char        f1180[MAXSTR],   		      /* Flag to start t1 @ halfdwell */
            mag_flg[MAXSTR],                            /*magic angle gradient*/
            f2180[MAXSTR],    		      /* Flag to start t2 @ halfdwell */
            codecseq[MAXSTR];       /* sequence for 13C' decoupling */
 
int         icosel1,          			  /* used to get n and p type */
            icosel2,
	    t1_counter,  		        /* used for states tppi in t1 */
	    ni2 = getval("ni2");

double      tau1,         				         /*  t1 delay */
            tau2,        				         /*  t2 delay */
	    del = getval("del"),     /* time delays for CH coupling evolution */
	    del1 = getval("del1"),
	    del2 = getval("del2"),
            del3 = getval("del3"),
            del4 = getval("del4"),
            TC = getval("TC"),
            satpwr = getval("satpwr"),
            waltzB1 = getval("waltzB1"),
            spinlock = getval("spinlock"),
            pwco,copwr, cores,codmf,
            kappa,

	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-2 at rfd  */
        rfd,                    /* fine power for 7 kHz rf for 500MHz magnet  */
	ncyc = getval("ncyc"), 			  /* no. of cycles of DIPSI-3 */


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


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

        pwHd,                           /* H1 90 degree pulse length at tpwrd */
        tpwrd,                             /*rf for WALTZ decoupling */

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

	gt1 = getval("gt1"),  		       /* coherence pathway gradients */
	gzcal = getval("gzcal"),               /* G/cm to DAC coversion factor*/
        gstab = getval("gstab"),
        gzlvl1 = getval("gzlvl1"),
	gzlvl2 = getval("gzlvl2"),

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

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

/*   LOAD PHASE TABLE    */

	settable(t1,2,phi1);
	settable(t2,1,phi2);
	settable(t3,1,phi3);
	settable(t4,1,phi4);
	settable(t11,2,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;

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


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

/* activate auto-calibration flags */
setautocal();
  if (autocal[0] == 'n')
  {
    codmf= getval("codmf");
    pwco = 1.0/codmf; /* pw for 13C' decoupling field */
    copwr = getval("copwr"); /* power level for 13C' decoupling */
    cores = getval("cores"); /* power level for 13C' decoupling */
  }
  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=20.0*ppm; ofs=154*ppm;
      Pdec_154p = pbox_Dsh("Pdec_154p", "WURST2", bw, ofs, compC*pwC, pwClvl);
      bw=30*ppm; ofs=0.0*ppm; nst = 1000; pws = 0.001;
      me180 = pbox_makeA("me180", "sech", bw, pws, ofs, compC*pwC, pwClvl, nst);
    }

    copwr = Pdec_154p.pwr; pwco = 1.0/Pdec_154p.dmf;
    cores = Pdec_154p.dres;
    pwme180 = me180.pw; me180pwr= me180.pwr; me180pwrf = me180.pwrf;

  }
/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

    if( pw > 50.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 */

    icosel1 = 1; icosel2 = 1;
    if (phase1 == 2) 
	{ tsadd(t2,2,4); icosel1 = -1;}
    if (phase2 == 2) 
	{ tsadd(t4,2,4); icosel2 = -1; tsadd(t2,2,4);}

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


/*  Set up f2180  */

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


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

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

   
   if(ni > 1)
           kappa = (double)(t1_counter*(del2)) / ( (double) (ni-1) );
      else kappa = 0.0;   

/*   BEGIN PULSE SEQUENCE   */

status(A);

        decoffset(dof-140*dfrq);
	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(rf0);
	obsoffset(tof);
	txphase(zero);
	delay(1.0e-5);

  if (satmode[A] == 'y')
    {
      obspower(satpwr);
      txphase(zero);
      rgpulse(d1,zero,20.0e-6,20.0e-6);
      obspower(tpwr);            /* Set power for hard pulses  */
    }
  else  
    {
      obspower(tpwr); /* Set power for hard pulses  */ 
      delay(d1);
    }

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

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

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

	zgradpulse(gzlvl3, gt3);
        txphase(one);
        decphase(t1);
	delay(0.5*del - gt3);

        rgpulse(pw,one,0.0,0.0);
        zgradpulse(1.8*gzlvl3, gt3);
        txphase(zero);
        delay(150e-6);
	decrgpulse(pwC, t1, 0.0, 0.0);
        
      /* decoupling on for carbonyl carbon */
         decpwrf(4095.0);
         decpower(copwr);
         decprgon(codecseq,pwco,cores);
         decon();
      /* decoupling on for carbonyl carbon */

        delay(tau1);

        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
 
        zgradpulse(icosel1*gzlvl4, gt1);

	delay(0.5*del2 - 2.0*pwN - gt1 - 2.0*pw);

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

        delay(tau1 - (kappa*tau1));

      /* co-decoupling off */
         decoff();
         decprgoff();
      /* co-decoupling off */
         decpower(pwClvl);

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

      /* decoupling on for carbonyl carbon */
         decpwrf(4095.0);
         decpower(copwr);
         decprgon(codecseq,pwco,cores);
         decon();
      /* decoupling on for carbonyl carbon */

	delay(0.5*del2 - kappa*tau1);

      /* co-decoupling off */
         decoff();
         decprgoff();
      /* co-decoupling off */
         decpower(pwClvl);

        decphase(t2);

	decrgpulse(pwC, t2, 0.0, 0.0);

	decpwrf(rfd);
	delay(2.0e-6);
	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();

        txphase(one);
	decpwrf(rf0);
        decphase(t3);
        obspower(tpwrd);
        decrgpulse(pwC,t3,0.0,0.0);
        decoffset(dof - 155*dfrq);
        rgpulse(pwHd,one,0.0,2.0e-6);
        txphase(zero);
        obsunblank();
        obsprgon("waltz16", pwHd, 90.0);              /* PRG_START_DELAY */
        xmtron();

	delay(TC - OFFSET_DELAY - POWER_DELAY - PRG_START_DELAY - tau2);

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

        delay(TC + tau2 - POWER_DELAY - PRG_STOP_DELAY - 2*gt1 - gstab - 2.0*pw);

        xmtroff();
        obsprgoff();
        obsblank();
        rgpulse(pwHd,three,2.0e-6,0.0);
        obspower(tpwr);

    if (mag_flg[A] =='y')
        magradpulse(gzcal*icosel2*gzlvl2, gt1);
    else
        zgradpulse(icosel2*gzlvl2, gt1);
        delay(gstab/2.0);
        rgpulse(2.0*pw,zero,0.0,0.0);
    if (mag_flg[A] =='y')
        magradpulse(gzcal*icosel2*gzlvl2, gt1);
    else
        zgradpulse(icosel2*gzlvl2, gt1);
        delay(gstab/2.0);

        decphase(zero);
        simpulse(0.0,pwC, two, zero, 0.0, 0.0);

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

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

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

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

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

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

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

	simpulse(pw,pwC,zero,zero,0.0,0.0);
        zgradpulse(2.3*gzlvl6, gt1);

   if (autocal[A] == 'y')
       {
        decpower(me180pwr); decpwrf(me180pwrf);
	delay(0.5*del3 - gt1 - 0.0005 -2.0*POWER_DELAY- WFG2_START_DELAY);
	simshaped_pulse("","me180",2.0*pw,0.001, zero, zero, 0.0, 0.0);
        decpwrf(rf0);
        decphase(zero);

       }
   else
       {
	delay(0.5*del3 - 0.5*pwC - gt1);
	simpulse(2.0*pw,2.0*pwC, zero, zero, 0.0, 0.0);
       }


   decpower(dpwr);
        if (mag_flg[A] == 'y')
            magradpulse(gzcal*((2.3*gzlvl6)+gzlvl1), gt1);
        else
            zgradpulse(((2.3*gzlvl6)+gzlvl1), gt1);

   if (autocal[A] == 'y')
   {
     if(dm3[B] == 'y')
       delay(0.5*del3 - 0.0005 -gt1 -1/dmf3 - 2.0*GRADIENT_DELAY - 2.0*POWER_DELAY);
        else
       delay(0.5*del3 -  0.0005 -gt1 - 2.0*GRADIENT_DELAY - 2.0*POWER_DELAY);
   }
   else
   {
     if(dm3[B] == 'y') 
      delay(0.5*del3  - gt1 -1/dmf3 - 2.0*GRADIENT_DELAY - POWER_DELAY);
         else
      delay(0.5*del3  - gt1 - 2.0*GRADIENT_DELAY - POWER_DELAY);
   }

   if(dm3[B] == 'y')			         /*optional 2H decoupling off */
        {
          dec3rgpulse(1/dmf3, three, 0.0, 0.0); 
          setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);
          dec3blank();
        }
 if (dm3[B]=='y') lk_sample();
status(C); 
 setreceiver(t11);
}
Ejemplo n.º 10
0
void pulsesequence()
{
/* DECLARE VARIABLES */

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

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

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

double    

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


/* LOAD VARIABLES */

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

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

  getstr("auto_dof",auto_dof);

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

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

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

/* CHECK VALIDITY OF PARAMETER RANGES */

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

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

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

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

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

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

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

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

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

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

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

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

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

/*  Set up f2180  tau2 = t2               */

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

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

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

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

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

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


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


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


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

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

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

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

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

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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);

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

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

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


   delay(d1);

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

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


status(B);

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

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

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

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

      decrgpulse(pwC, zero, 0.0, 0.0);

      delay(taud -taue -pwC);

/* CN FILTER ENDS */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

status(C);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   rgpulse(pw,zero,0.0,0.0);  

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

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

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

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

  char	    C13refoc[MAXSTR],		/* C13 sech/tanh pulse in middle of t1 */
            TROSY[MAXSTR],
            wtg3919[MAXSTR];
  double    tauxh, tau1,  gt2, gt1, 
            gztm, mix,  pw180, pw135, pw120, pw110, p1lvl, 
            gzlvl1,  cycles,  
            pwNt = 0.0,               /* pulse only active in the TROSY option */
            gsign = 1.0,
            gzlvl3=getval("gzlvl3"),
            gt3=getval("gt3"),
            JNH = getval("JNH"),
            pwN = getval("pwN"),
            pwNlvl = getval("pwNlvl"),  
            pwHs, tpwrs=0.0,           /* H1 90 degree pulse length at tpwrs */               
            compH = getval("compH"),
            sw1 = getval("sw1"),
            pwClvl = getval("pwClvl"), 	         /* coarse power for C13 pulse */
            pwC = getval("pwC"),       /* C13 90 degree pulse length at pwClvl */
            rfst = 4095.0,	            /* fine power for the stCall pulse */
                   /* temporary Pbox parameters */
            bw, pws, ofs, ppm, nst,  /* bandwidth, pulsewidth, offset, ppm, # steps */
            compC = getval("compC");   /* adjustment for C13 amplifier compr-n */

   gztm=getval("gztm");
   gt2=getval("gt2");
   gt1= getval("gt1");
   mix=getval("mix");
   phase = (int) (getval("phase") + 0.5);
   sw1 = getval("sw1");
   pw180 = getval("pw180");
   gzlvl1 = getval("gzlvl1");



/* INITIALIZE VARIABLES */

        pw135 = pw180 / 180.0 * 135.0 ;
        pw120 = pw180 / 180.0 * 120.0 ;
        pw110 = pw180 / 180.0 * 110.0 ;

        p1lvl = tpwr -20*log10(pw180/(compH*2.0*pw));
        p1lvl = (int)(p1lvl + 0.5);
         cycles = mix / (730.0/180.0 * pw180) - 8.0;

         initval(cycles, v10);        /* mixing time cycles */


    getstr("C13refoc",C13refoc);
    getstr("TROSY",TROSY);
    getstr("wtg3919",wtg3919);
    
    tauxh = ((JNH != 0.0) ? 1/(4*(JNH)) : 2.25e-3);

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

                               /* selective H20 one-lobe sinc pulse needs 1.69  */
     pwHs = getval("pwHs");            /* times more power than a square pulse */
     if (pwHs > 1e-6) tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));  
     else tpwrs = 0.0;
     tpwrs = (int) (tpwrs); 

/* check validity of parameter range */

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

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

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

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

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

/* LOAD VARIABLES */

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

/* LOAD PHASE TABLES */

      settable(t6, 4, recT); 
    if (TROSY[A] == 'y')
    { gsign = -1.0;
      pwNt = pwN;
      assign(zero,v7); 
      assign(two,v8);
      settable(t1, 1, phT1);
      settable(t2, 4, phT2);
      settable(t3, 1, phT4); 
      settable(t4, 1, phT4);
      settable(t5, 4, recT); }
    else
    { assign(one,v7); 
      assign(three,v8);
      settable(t1, 4, phi1);
      settable(t2, 2, phi2);
      settable(t3, 8, phi3);
      settable(t4, 16, phi4);
      settable(t5, 8, rec); } 

      if ( phase1 == 2 )                  /* Hypercomplex in t1 */
      { if (TROSY[A] == 'y')          
        { tsadd(t3, 2, 4); tsadd(t5, 2, 4); }                      
        else tsadd(t2, 1, 4); }
                                   
    if(t1_counter %2)          /* calculate modification to phases based on */
    { tsadd(t2,2,4); tsadd(t5,2,4); tsadd(t6,2,4); }   /* current t1 values */

    if(wtg3919[0] != 'y') 
    { add(one,v7,v7); add(one,v8,v8); }
         
                           /* sequence starts!! */
   status(A);
     
     obspower(tpwr);
     dec2power(pwNlvl);
     decpower(pwClvl);
     decpwrf(rfst);
     delay(d1);
     
   status(B);

/* slective excitation of water */

     rgpulse(pw, zero, rof1, rof1);
     

     zgradpulse(gzlvl1,gt1);

     obspower(tpwrs+6);  /* make it a 180 inversion pulse */
     shaped_pulse("H2Osinc", pwHs, zero, rof1, 0.0);
     obspower(tpwr);

     zgradpulse(gzlvl1,gt1);

/*  CLEANEX-PM spin-lock   */

      if (cycles > 1.5000)
      {

       obspower(p1lvl);
       txphase(zero);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/2.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);


            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0*3.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm);

         starthardloop(v10);
            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);
         endhardloop();

       rgradient('z',gztm/4.0*3.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/2.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z',gztm/4.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);

       rgradient('z', 0.0);

            rgpulse(pw135, zero, 0.0, 0.0);
            rgpulse(pw120, two,  0.0, 0.0);
            rgpulse(pw110, zero, 0.0, 0.0);
            rgpulse(pw110, two,  0.0, 0.0);
            rgpulse(pw120, zero, 0.0, 0.0);
            rgpulse(pw135, two,  0.0, 0.0);


       obspower(tpwr);

      }


/* .......................................  */

     zgradpulse(0.3*gzlvl3,gt3);
     txphase(zero);
     dec2phase(zero);
     delay(tauxh-gt3);               /* delay=1/4J(XH)   */

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

     zgradpulse(0.3*gzlvl3,gt3);
     dec2phase(t2);
     delay(tauxh-gt3 );               /* delay=1/4J(XH)   */
  
     rgpulse(pw, t1, rof1, rof1);

     zgradpulse(0.5*gsign*gzlvl3,gt3);
     delay(200.0e-6); 
     decphase(zero);
            
     if (TROSY[A] == 'y')
     { 
       txphase(t3);       
       if ( phase1 == 2 ) 
         dec2rgpulse(pwN, t6, rof1, 0.0);
       else 
         dec2rgpulse(pwN, t2, rof1, 0.0);              
       if ( (C13refoc[A]=='y') && (d2 > 1.0e-3 + 2.0*WFG2_START_DELAY) )
       {
         delay(d2/2.0 - 0.5e-3 - WFG2_START_DELAY);     
         decshaped_pulse("stC200A", 1.0e-3, zero, 0.0, 0.0);
         delay(d2/2.0 - 0.5e-3 - WFG2_STOP_DELAY);
       }
       else
         delay(d2);

       rgpulse(pw, t3, 0.0, rof1);         
       zgradpulse(0.3*gzlvl3,gt3);
       delay(tauxh-gt3 );
       
       sim3pulse(2*pw,0.0,2*pwN,zero,zero,zero,rof1,rof1);
       
       zgradpulse(0.3*gzlvl3,gt3);
       delay(tauxh-gt3 );       
       sim3pulse(pw,0.0,pwN,zero,zero,t3,rof1,rof1);
     }
     else
     {         
       txphase(t4);      
       dec2rgpulse(pwN, t2, rof1, 0.0);
        
       if ( (C13refoc[A]=='y') && (tau1 > 0.5e-3 + WFG2_START_DELAY) )
       {
         delay(tau1 - 0.5e-3 - WFG2_START_DELAY); 
         simshaped_pulse("", "stC200A", 2.0*pw, 1.0e-3, t4, zero, 0.0, 0.0);  
         dec2phase(t3);  
         delay(tau1 - 0.5e-3 - WFG2_STOP_DELAY);
       }
       else 
       {
	 tau1 -= pw;
	 if (tau1 < 0.0) tau1 = 0.0;
         delay(tau1);
         rgpulse(2.0*pw, t4, 0.0, 0.0);
         dec2phase(t3);
         delay(tau1);
       }
       
       dec2rgpulse(pwN, t3, 0.0, 0.0);
       
       zgradpulse(0.5*gzlvl3,gt3);
       delay(200.0e-6);
       rgpulse(pw, two, rof1, rof1);
     } 
     
     zgradpulse(gzlvl3,gt3);
     txphase(v7); dec2phase(zero);
     delay(tauxh-gt3-pwHs-rof1);
     
     if(wtg3919[0] == 'y')
     {     	
       rgpulse(pw*0.231,v7,rof1,rof1);     
       delay(d3);
       rgpulse(pw*0.692,v7,rof1,rof1);
       delay(d3);
       rgpulse(pw*1.462,v7,rof1,rof1);

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

       rgpulse(pw*1.462,v8,rof1,rof1);
       delay(d3);
       rgpulse(pw*0.692,v8,rof1,rof1);
       delay(d3);
       rgpulse(pw*0.231,v8,rof1,rof1); 
     }
     else
     {
       obspower(tpwrs);  
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr);
       sim3pulse(2.0*pw, 0.0, 2.0*pwN, v8, zero, zero, 0.0, 0.0);
       obspower(tpwrs);
       shaped_pulse("H2Osinc", pwHs, v7, rof1, 0.0);
       obspower(tpwr);
     } 
        
     zgradpulse(gzlvl3,gt3);   
     delay(tauxh-gt3-pwHs-rof1-pwNt-POWER_DELAY); 
     dec2rgpulse(pwNt, zero, rof1, rof1); 
     dec2power(dpwr2);

   status(C);
     setreceiver(t5);   
}
Ejemplo n.º 12
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 */
              wudec[MAXSTR],	 /* automatic low power C-13 WURST decoupling */
              C13refoc[MAXSTR],	       /* adiabatic C13  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      csa, sna, tau1, tau2,	                 /*  t1 and t2 delays */ 
              bw, ofs, ppm, nst,        /* bandwidth, offset, ppm, # of steps */
	      mix = getval("mix"),		 	    /* NOESY mix time */
	      tNH = 1.0/(4.0*getval("JNH")),	  /* 1/4J N15 evolution delay */
              pra = M_PI*getval("pra")/180.0,             /* projection angle */
              pwClvl = getval("pwClvl"), 	/* coarse power for C13 pulse */
              pwC = getval("pwC"),    /* C13 90 degree pulse length at pwClvl */
              compC = getval("compC"), /* adjust for C13 amplifier compression */
              pwC180 = 0.001,   /* duration of C13 180 degree adiabatic pulse */ 
              compH = getval("compH"), /* adjust for H1 amplifier compression */

   	tpwrsf = getval("tpwrsf"), /* fine power adjustment for flipback pulse */
   	pwHs = getval("pwHs"),	         /* H1 90 degree pulse length at tpwrs */
   	tpwrs = 0.0,	  	       /* power for the pwHs ("H2Osinc") pulse */
   	xdel = 2.0*GRADIENT_DELAY + POWER_DELAY,                /* xtra delay */

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

/*   LOAD PHASE TABLE    */

	settable(t1,2,phi1);
	settable(t3,4,phi3);
	settable(t9,16,phi9);
	settable(t10,1,phi10);
	settable(t11,8,rec);

/*   MAKE PBOX SHAPES   */

   if((FIRST_FID) && ((C13refoc[A]=='y') || (wudec[A]=='y')))   /* call Pbox */
   {
     ppm = getval("dfrq"); ofs = 0.0; nst = 1000;   /* nst - number of steps */ 
     bw = pwC*compC;
     if(bw > 0.0) 
     {
       bw = 0.1/bw;                                     /* maximum bandwidth */
       bw = pwC180*bw*bw; 
     }
     else
       bw = 200.0*ppm; 
       
     if(C13refoc[A]=='y')
       adC180 = pbox_makeA("adC180", "wurst2i", bw, pwC180, ofs, compC*pwC, pwClvl, nst);
     if(wudec[A]=='y') 
       wuCdec_lr = pbox_Adec("wurstC_lr", "CAWURST", bw, 0.01, ofs, compC*pwC, pwClvl);
   }      
    
   if(pwHs > 1.0e-5)                /* selective H20 one-lobe sinc pulse */
   {
     if(FIRST_FID) 
       H2Osinc = pbox_Rsh("H2Osinc", "sinc90", pwHs, 0.0, compH*pw, tpwr);
     tpwrs = H2Osinc.pwr;
     pwHs = H2Osinc.pw;
   }

/* 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 Projection-Reconstruction experiment */
   
    PRexp = 0;      
    if((pra > 0.0) && (pra < 90.0)) PRexp = 1;

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

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

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

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

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

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

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

/*  Correct inverted signals for NH2 only spectra  */

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

   if(wudec[A]=='y') xdel = xdel + POWER_DELAY + PWRF_DELAY + PRG_START_DELAY;

/* BEGIN PULSE SEQUENCE */

status(A);

	obspower(tpwr);
	decpower(pwClvl);
 	dec2power(pwNlvl);
	decpwrf(4095.0);
	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);
	delay(5.0e-4);
	rcvroff();

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

   	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(tNH - gt0);

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

   	txphase(one);
	zgradpulse(gzlvl0, gt0);
	delay(tNH - 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(adC180.pwrf);
	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("adC180", pwC180, 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("", "adC180", 2.0*pw, pwC180, 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(tNH - 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(tNH  - 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(tNH - 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(tNH - pwN - 0.5*pw - gt5);

	rgpulse(pw, zero, 0.0, 0.0);

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

	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 + rof2);
        
	setreceiver(t11);
        rcvron();
        statusdelay(C,1.0e-4-rof1);		
        if(wudec[A]=='y') 
        {
          decpwrf(4095.0);
          decpower(wuCdec_lr.pwr+3.0);
          decprgon("wurstC_lr", 1.0/wuCdec_lr.dmf, wuCdec_lr.dres);
          decon();
        }	
}