Esempio n. 1
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values
   
   double tXzfselinit = getval("tXzfsel"); // Adjust the Z-filter Delay for the
   double tXzfsel = tXzfselinit - 2.0e-6;  // attenuator switch time.
   
   DSEQ dec = getdseq("H");
   strncpy(dec.t.ch,"dec",3);
   putCmd("chHtppm='dec'\n");
   strncpy(dec.s.ch,"dec",3);
   putCmd("chHspinal='dec'\n");

// Set Constant-time Period for d2. 

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

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

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

// Dutycycle Protection

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

// Set Phase Tables

   settable(ph1Xmqmas,14,table1);
   settable(phfXmqmas,7,table2);
   settable(ph2Xmqmas,14,table3);
   settable(phXzfsel,56,table4);
   settable(phRec,56,table5);

   if (phase1 == 2) {
      tsadd(ph1Xmqmas,1,4);
      tsadd(phRec,2,4);
   }
   setreceiver(phRec);

   double obsstep = 360.0/(PSD*8192);
   obsstepsize(obsstep);

// Begin Sequence

   xmtrphase(phfXmqmas); txphase(ph1Xmqmas); decphase(zero);
   obspower(getval("tpwr"));
   obspwrf(getval("aXmqmas"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1); 
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// H Decoupler on Before MQMAS

   _dseqon(dec);

// Two-Pulse MQMAS

   rgpulse(getval("pw1Xmqmas"),ph1Xmqmas,0.0,0.0);
   xmtrphase(zero); txphase(ph2Xmqmas);
   delay(d2);
   rgpulse(getval("pw2Xmqmas"),ph2Xmqmas,0.0,0.0);

// Selective Z-filter Pulse

   txphase(phXzfsel);
   obsblank();
   obspower(getval("dbXzfsel"));
   obspwrf(getval("aXzfsel"));
   delay(2.0e-6);
   obsunblank();
   delay(tXzfsel);
   rgpulse(getval("pwXzfsel"),phXzfsel,0.0,0.0);

// Begin Acquisition

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

// Set the Maximum Dynamic Table and v-var Numbers

   settablenumber(10);
   setvvarnumber(30);

// Define Variables and Objects and Get Parameter Values

   double aXprep = getval("aXprep");
   double pwXprep = getval("pwXprep");
   double phvXprep = getval("phXprep");

   WMPSEQ wpmlg = getwpmlgxmx1("wpmlgX");
   strncpy(wpmlg.wvsh.mpseq.ch,"obs",3); 
   putCmd("chXwpmlg='obs'\n");

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

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

// Dutycycle Protection

   DUTY d = init_dutycycle();
   d.dutyon = getval("pwXprep") + wpmlg.cycles*wpmlg.wvsh.mpseq.t;
   d.dutyoff = d1 + 4.0e-6 + 5.0e-6 + wpmlg.r1 + wpmlg.r2 +
               at - wpmlg.cycles*wpmlg.wvsh.mpseq.t;
   d = update_dutycycle(d);
   abort_dutycycle(d,10.0);

// Set Phase Tables

   settable(phXprep,4,table1);
   settable(phXwpmlg,4,table2);
   settable(phRec,4,table3);
   setreceiver(phRec);

// Set the Small-Angle Step

   double obsstep = 360.0/(PSD*8192);
   obsstepsize(obsstep);
   int phfXprep = initphase(phvXprep, obsstep);
   int phXzero = initphase(0.0, obsstep);

// Begin Sequence

   xmtrphase(phfXprep); txphase(phXprep);
   obspwrf(aXprep);
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// Standard 90-degree prepX pulse for PMLGxmx"

   startacq(5.0e-6);
   rcvroff();
   delay(wpmlg.r1);
   rgpulse(pwXprep, phXprep, 0.0, 0.0);
   xmtrphase(phXzero);
   delay(wpmlg.r2);

// Apply WPMLG Cycles

   decblank(); _blank34();
   _wpmlg1(wpmlg, phXwpmlg);
   endacq();
   obsunblank(); decunblank(); _unblank34();
}
Esempio n. 3
0
pulsesequence()

{

    /* DECLARE VARIABLES */

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

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

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

                d_cacbdec,
                pwcacbdec,
                dres_dec,

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

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

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

                gstab,

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

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

    /* LOAD VARIABLES */

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

    getstr("nietl_flg",nietl_flg);

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

    gstab = getval("gstab");

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

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


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

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

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

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

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

    /* LOAD PHASE TABLE */

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

    /* CHECK VALIDITY OF PARAMETER RANGES */

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


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

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


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

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

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

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

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

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

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

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

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

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

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

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

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


    /*  Phase incrementation for hypercomplex 2D data */

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

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

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

    /*  Set up f1180  tau2 = t1               */

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

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

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

    /*  Set up f2180  tau2 = t2               */

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

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

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

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

    /* BEGIN ACTUAL PULSE SEQUENCE */

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


    /* Presaturation Period */

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

    /* Begin Pulses */

    status(B);

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

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

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

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

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

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

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

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

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

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

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

        decpower(d_c180);

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

        dec2rgpulse(pwN,zero,0.0,0.0);

        delay(tauc);

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

        delay(tauc - pwca180);

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

        decpower(d_c180);

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

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

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

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

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

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

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

        delay(tauc - pwca180);

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

    decphase(t1);

    decpower(d_c90);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    /*  Refocusing  CayC'z to Cax  */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    decpower(d_c180);
    txphase(zero);

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

    /* Constant t2 period  */

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

        dec2phase(t4);

        delay(bigTN - tau2 + pwca180);

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

        decpower(d_csed);

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

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

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

        delay(tau2);

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

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

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

        decpower(d_csed);

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

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

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

        delay(tau2);

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

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

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

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

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

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

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

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

        txphase(zero);
        dec2phase(zero);

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

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

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

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

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

    }
    else
    {

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

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

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

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

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

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

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

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

        txphase(zero);
        dec2phase(zero);

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

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

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

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

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

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

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

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

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

}
Esempio n. 4
0
void pulsesequence()
{
    double	base,
            qlvl;
    char         sspul[MAXSTR];


    /* LOAD VARIABLES AND CHECK CONDITIONS */
    qlvl = getval("qlvl");
    getstr("sspul", sspul);

    base = 180.0 / qlvl;
    initval(2.0 * qlvl, v5);

    if ((rof1 < 9.9e-6) && (ix == 1))
        fprintf(stdout,"Warning:  ROF1 is less than 10 us\n");


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

    ifzero(ssctr);
    modn(ct, v5, v10);
    divn(ct, v5, v12);
    mod2(ct, v9);
    elsenz(ssctr);
    sub(ssval, ssctr, v14);	/* v14 = 0,...,ss-1 */
    modn(v14, v5, v10);
    divn(v14, v5, v12);
    mod2(v14, v9);
    endif(ssctr);


    /* CALCULATE PHASECYCLE */
    /* The phasecycle first performs a (2*Q)-step cycle on the third pulse in order
       to select for MQC.  The phasecycle is then adjusted so that the receiver
       goes +- in an alternating fashion.  Second, the 2-step QIS cycle is added
       in.  Third, a 2-step cycle for axial peak suppression is performed on the
       first pulse. */

    assign(v12, v1);
    mod2(v12, v12);		/* v12=quad. image suppression */
    hlv(v1, v1);
    mod2(v1, v1);
    dbl(v1, v1);
    add(v1, v12, v4);
    add(v12, v1, v1);
    assign(v12, v2);
    assign(v12, v3);
    dbl(v9, v9);
    add(v9, v4, v4);
    assign(v4, oph);
    if (phase1 == 2)
        incr(v1);
    if (phase1 == 3)
        add(id2, v1, v1);        /* TPPI increment */


    /* BEGIN ACTUAL PULSE SEQUENCE CODE */
    if (newtrans)
        obsstepsize(base);

    status(A);
    if (sspul[A] == 'y')
    {
        rgpulse(200*pw, zero, rof1,0.0e-6);
        rgpulse(200*pw, one, 0.0e-6, rof1);
    }
    if (satmode[A] == 'y')
    {
        obspower(satpwr);
        rgpulse(satdly,zero,rof1,rof1);
        obspower(tpwr);
    }
    status(B);
    if (newtrans)
        xmtrphase(v10);      /* hardware digital phaseshift */
    rgpulse(pw, v1, rof1, 1.0e-6);
    if (satmode[B] == 'y')
    {
        obspower(satpwr);
        if (d2>0.0) rgpulse(d2 -9.4e-6 -rof1 -(4*pw)/3.1416,zero,0.0,0.0);
        obspower(tpwr);
    }
    else
    {
        if (d2>0.0) delay(d2 -1.0e-6 -rof1 -(4*pw)/3.1416);
    }
    rcvroff();
    rgpulse(pw, v2, rof1, 0.0);
    if (newtrans)
    {
        xmtrphase(zero);       /* resets relative phase to absolute phase */
    }
    else
    {
        phaseshift(-base, v10, OBSch);   /* software small-angle phaseshift */
    }
    rgpulse(pw, v3, 1.0e-6, rof2);
    status(C);
}
Esempio n. 5
0
void pulsesequence()

{
/* DECLARE VARIABLES */

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

 int	     phase,t1_counter;

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

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

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

/* LOAD VARIABLES */

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

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

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

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



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

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

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

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

/* check validity of parameter range */

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

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

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

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

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

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

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

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

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

/* LOAD VARIABLES */

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

/* Phase incrementation for hypercomplex 2D data */

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

/* Set up f1180  */

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

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

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

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


/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */

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

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

  obsoffset(tof);

status(B);

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

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

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

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

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

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

  txphase(zero);
  dec2phase(zero);

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

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

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

  txphase(one);
  dec2phase(t1);

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

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

  rgpulse(pw,one,0.0,0.0);

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

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

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

  dec2phase(zero);

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

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

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

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

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

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

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

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

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

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

  dec2phase(t3);

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

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

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

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

  rgpulse(pw,t4,0.0,0.0);

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

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

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

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

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

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

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

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

  txphase(zero);
  dec2phase(zero);

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

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

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

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

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

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

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

  dec2rgpulse(pwn,zero,0.0,0.0);

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

/* acquire data */

status(C);
     setreceiver(t7);
}
Esempio n. 6
0
pulsesequence() {

// Define Variables and Objects and Get Parameter Values

   double pw1Xstmas = getval("pw1Xstmas");  
   double pw2Xstmas = getval("pw2Xstmas");  

   double tXechselinit = getval("tXechsel");
   double tXechsel = tXechselinit - 3.0e-6; 
   if (tXechsel < 0.0) tXechsel = 0.0; 

   double d2init = getval("d2");
   double d2 = d2init - pw1Xstmas/2.0 - pw2Xstmas/2.0;
   if (d2 < 0.0) d2 = 0.0;

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

// Set Constant-time Period for d2. 

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

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

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

// Dutycycle Protection

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

// Set Phase Tables

   settable(ph1Xstmas,4,table1);
   settable(ph2Xstmas,8,table2);
   settable(ph2fXstmas,8,table3);
   settable(phXechsel,32,table4);
   settable(phRec,16,table5);

   if (phase1 == 2) {
      tsadd(ph1Xstmas,1,4);
   }
   setreceiver(phRec);
   obsstepsize(45.0);

// Begin Sequence

   txphase(ph1Xstmas); decphase(zero);
   obspower(getval("tpwr"));
   obspwrf(getval("aXstmas"));
   obsunblank(); decunblank(); _unblank34();
   delay(d1);
   sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6);

// H Decoupler on Before STMAS

   _dseqon(dec);

// Two-Pulse STMAS

   rgpulse(getval("pw1Xstmas"),ph1Xstmas,0.0,0.0);
   xmtrphase(ph2fXstmas);
   txphase(ph2Xstmas);
   delay(d2);
   rgpulse(getval("pw2Xstmas"),ph2Xstmas,0.0,0.0);
   xmtrphase(zero);

// Selective Echo Pulse

   txphase(phXechsel);
   obsblank();
   obspower(getval("dbXechsel"));
   obspwrf(getval("aXechsel"));
   delay(3.0e-6);
   obsunblank();
   delay(tXechsel);
   rgpulse(getval("pwXechsel"),phXechsel,0.0,0.0);

// Begin Acquisition

   obsblank(); _blank34();
   delay(getval("rd"));
   startacq(getval("ad"));
   acquire(np, 1/sw);
   endacq();
   _dseqoff(dec);
   obsunblank(); decunblank(); _unblank34();
}
Esempio n. 7
0
pulsesequence()
{
 
char      N15edit[MAXSTR], C13edit[MAXSTR];	      /* C13 editing*/
	   
 double tpwrs,pwC,d2,tau,d3,d4,d5,d6,
 gt2,gt3,gt0,gzlvl0,gzlvl2,gzlvl3,phincr1,tpwrsf_u,tpwrsf_d,pwHs,compH,
 pwN,pwNlvl,ref_pwr,ref_pw90,pwZa,pwClvl,JXH;     
  


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

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

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

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

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

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


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

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

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



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




/* START THE PULSE SEQUENCE */

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

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

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

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

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

     setreceiver(t8);
   status(C);
}
Esempio n. 8
0
pulsesequence()
{
 double
   	pwHs = getval("pwHs"),	        /* H1 90 degree pulse length at tpwrs */
       gt0= getval("gt0"),
       gzlvl0= getval("gzlvl0"),
       phincr=getval("phincr"),
       compH = getval("compH"),
   	tpwrs,	  	              /* power for the pwHs ("H2Osinc") pulse */
        tpwrsf = getval("tpwrsf");    /* fine power for pwHs pulse            */
                                      /* use to adjust for radiation-damping  */

 char   shape[MAXSTR];
     getstr("shape",shape);

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

   obsstepsize(1.0);
   if (phincr < 0.0) phincr=360+phincr;
   initval(phincr,v3);

   	delay(0.01);
        zgradpulse(1.5*gzlvl0,0.001);
        delay(d1);
        obspower(tpwr);
	rcvroff();
      if (satmode[A] == 'u')            /* calibrate flipback pulse following hard 90 */
       {
        obspwrf(4095.0);
        obspower(tpwr);	  				
 	rgpulse(pw, two, rof1, 0.0);
        obspwrf(tpwrsf);
        obspower(tpwrs);	  				
        xmtrphase(v3);
        shaped_pulse(shape, pwHs, zero, rof1, rof2);
       }
      if (satmode[A] == 'd')            /* calibrate flipdown pulse prior to hard 90 */
       {
        obspwrf(tpwrsf);
        obspower(tpwrs);	  				
        xmtrphase(v3);
        shaped_pulse(shape, pwHs, zero, rof1, 0.0);
        obspwrf(4095.0);
        obspower(tpwr);	  				
        xmtrphase(zero);
        delay(SAPS_DELAY);
 	rgpulse(pw, two, rof1, rof2);
       }
      if (satmode[A] == 'i')      /* calibrate flipback pulse following
                       INEPT ghn... non-TROSY mode */
       {
   	rgpulse(pw,zero,rof1,0.0);  
        zgradpulse(gzlvl0,gt0);
        delay(2.4e-3-gt0);
 	rgpulse(2.0*pw, zero, 0.0, 0.0);
	txphase(one);
        zgradpulse(gzlvl0,gt0);
        delay(2.4e-3-gt0);
 	rgpulse(pw, one, 0.0, 0.0);
        obspwrf(tpwrsf);
        obspower(tpwrs);	  				
        xmtrphase(v3);
        shaped_pulse(shape, pwHs, zero, rof1, rof2);
       }
      if (satmode[A] == 't')   /* calibrate flipback pulse following INEPT
                (gNhsqc non-Trosy, ghn..TROSY mode) */
       {
   	rgpulse(pw,zero,rof1,0.0);  
        zgradpulse(gzlvl0,gt0);
        delay(2.4e-3-gt0);
 	rgpulse(2.0*pw, zero, 0.0, 0.0);
	txphase(one);
        zgradpulse(gzlvl0,gt0);
        delay(2.4e-3-gt0);
 	rgpulse(pw, one, 0.0, 0.0);
        obspwrf(tpwrsf);
        obspower(tpwrs);	  				
        xmtrphase(v3);
        shaped_pulse(shape, pwHs, two, rof1, 0.0);
        obspower(tpwr); xmtrphase(zero); obspwrf(4095.0);
        rgpulse(2.0*pw,zero,rof1,rof2);
       }
      if (satmode[A] == 'n') /*calibrate flipback pulse following INEPT (gNhsqc TROSY mode) */
       {
   	rgpulse(pw,two,rof1,0.0);  
        zgradpulse(gzlvl0,gt0);
        delay(2.4e-3-gt0);
 	rgpulse(2.0*pw, zero, 0.0, 0.0);
	txphase(one);
        zgradpulse(gzlvl0,gt0);
        delay(2.4e-3-gt0);
 	rgpulse(pw, one, 0.0, 0.0);
        obspwrf(tpwrsf);
        obspower(tpwrs);	  				
        xmtrphase(v3);
        shaped_pulse(shape, pwHs, two, rof1, 0.0);
        obspower(tpwr); xmtrphase(zero); obspwrf(4095.0);
       }
}		 
Esempio n. 9
0
void pulsesequence()
{
  /* Internal variable declarations *************************/
  double  freqEx[MAXNSLICE];
  double  pespoil_amp,maxgradtime,spoilMoment,perTime,pe2_offsetamp,tau1,te_delay,tr_delay;
  double  te2=0.0,te3=0.0,te2min,te3min,tau2,tau3,te2_delay,te3_delay=0;
  char    minte2[MAXSTR],minte3[MAXSTR],spoilflag[MAXSTR],perName[MAXSTR];
  int     sepSliceRephase,sepReadRephase=0,readrev,table,shapeEx;
  int     i;

  /* Real-time variables used in this sequence **************/
  int  vpe_steps    = v1;      // Number of PE steps
  int  vpe_ctr      = v2;      // PE loop counter
  int  vms_slices   = v3;      // Number of slices
  int  vms_ctr      = v4;      // Slice loop counter
  int  vpe_offset   = v5;      // PE/2 for non-table offset
  int  vpe_mult     = v6;      // PE multiplier, ranges from -PE/2 to PE/2
  int  vper_mult    = v7;      // PE rewinder multiplier; turn off rewinder when 0
  int  vpe2_steps   = v8;      // Number of PE2 steps
  int  vpe2_ctr     = v9;      // PE2 loop counter
  int  vpe2_mult    = v10;     // PE2 multiplier
  int  vpe2_offset  = v11;     // PE2/2 for non-table offset
  int  vpe2r_mult   = v12;     // PE2 rewinder multiplier
  int  vssc         = v13;     // Compressed steady-states
  int  vacquire     = v14;     // Argument for setacqvar, to skip steady state acquires
  int  vrfspoil_ctr = v15;     // RF spoil counter
  int  vrfspoil     = v16;     // RF spoil multiplier
  int  vtrimage     = v17;     // Counts down from nt, trimage delay when 0
  int  vne          = v18;     // Number of echoes
  int  vne_ctr      = v19;     // Echo loop counter
  int  vneindex     = v20;     // Echo index, odd or even
  int  vnelast      = v21;     // Check for last echo
  int  vtrigblock   = v22;     // Number of slices per trigger block

  /* Initialize paramaters **********************************/
  init_mri();

  getstr("spoilflag",spoilflag);
  te2=getval("te2");
  te3=getval("te3");
  getstr("minte2",minte2);
  getstr("minte3",minte3);
  readrev=(int)getval("readrev");

  /*  Check for external PE table ***************************/
  table = 0;
  if (strcmp(petable,"n") && strcmp(petable,"N") && strcmp(petable,"")) {
    loadtable(petable);
    table = 1;
  }

  /* Set Rcvr/Xmtr phase increments for RF Spoiling ********/
  /* Ref:  Zur, Y., Magn. Res. Med., 21, 251, (1991) *******/
  if (rfspoil[0] == 'y') {
    rcvrstepsize(rfphase);
    obsstepsize(rfphase);
  }

  /* Initialize gradient structures *************************/
  shape_rf(&p1_rf,"p1",p1pat,p1,flip1,rof1,rof2 );   // excitation pulse
  init_slice(&ss_grad,"ss",thk);                     // slice select gradient
  init_slice_refocus(&ssr_grad,"ssr");               // slice refocus gradient
  init_readout(&ro_grad,"ro",lro,np,sw);             // readout gradient
  init_readout_refocus(&ror_grad,"ror");             // dephase gradient
  init_phase(&pe_grad,"pe",lpe,nv);                  // phase encode gradient
  init_phase(&pe2_grad,"pe2",lpe2,nv2);              // 2nd phase encode gradient
  init_dephase(&spoil_grad,"spoil");                 // optimized spoiler
  init_dephase(&ref_grad,"ref");                     // readout rephase

  /* RF Calculations ****************************************/
  calc_rf(&p1_rf,"tpwr1","tpwr1f");

  /* Gradient calculations **********************************/
  calc_slice(&ss_grad,&p1_rf,WRITE,"gss");
  calc_slice_refocus(&ssr_grad, &ss_grad, WRITE,"gssr");
  calc_readout(&ro_grad, WRITE,"gro","sw","at");
  calc_readout_refocus(&ror_grad,&ro_grad,NOWRITE,"gror");
  calc_phase(&pe_grad, NOWRITE,"gpe","tpe");
  calc_phase(&pe2_grad,NOWRITE,"gpe2","");
  calc_dephase(&ref_grad,WRITE,ro_grad.m0,"","");

  if (spoilflag[0] == 'y') {
    spoilMoment = ro_grad.acqTime*ro_grad.roamp;   // Optimal spoiling is at*gro for 2pi per pixel
    spoilMoment -= ro_grad.m0def;                  // Subtract partial spoiling from back half of readout
    if (perewind[0] == 'y') 
      calc_dephase(&spoil_grad,NOWRITE,spoilMoment,"gspoil","tspoil");
    else
      calc_dephase(&spoil_grad,WRITE,spoilMoment,"gspoil","tspoil");
  }

  /* Is TE long enough for separate slab refocus? *******/
  maxgradtime = MAX(ror_grad.duration,pe_grad.duration);
  if (spoilflag[0] == 'y')
    maxgradtime = MAX(maxgradtime,spoil_grad.duration);
  tau1 = ss_grad.rfCenterBack + ssr_grad.duration + maxgradtime + alfa + ro_grad.timeToEcho + 4e-6;
  if ((te >= tau1) && (minte[0] != 'y')) sepSliceRephase = 1; // Set flag for separate slice rephase
  else {
    sepSliceRephase = 0;
    pe2_grad.areaOffset = ss_grad.m0ref;                 // Add slab refocus on pe2 axis
    calc_phase(&pe2_grad,NOWRITE,"gpe2","");             // Recalculate pe2 to include slab refocus
  }

  /* Equalize refocus and PE gradient durations *************/
  pespoil_amp = 0.0;
  perTime = 0.0;
  if ((perewind[0] == 'y') && (spoilflag[0] == 'y')) {   // All four must be single shape
    if (ror_grad.duration > spoil_grad.duration) {       // calc_sim first with ror
      calc_sim_gradient(&pe_grad,&pe2_grad,&ror_grad,tpemin,WRITE);
      calc_sim_gradient(&ror_grad,&spoil_grad,&null_grad,tpemin,NOWRITE);
    } else {                                             // calc_sim first with spoil
      calc_sim_gradient(&pe_grad,&pe2_grad,&spoil_grad,tpemin,WRITE);
      calc_sim_gradient(&ror_grad,&spoil_grad,&null_grad,tpemin,WRITE);      
    }
    strcpy(perName,pe_grad.name);
    perTime = pe_grad.duration;
  } else {                      // post-acquire shape will be either pe or spoil, but not both
    calc_sim_gradient(&ror_grad,&pe_grad,&pe2_grad,tpemin,WRITE);
    if ((perewind[0] == 'y') && (spoilflag[0] == 'n')) {     // Rewinder, no spoiler
      strcpy(perName,pe_grad.name);
      perTime = pe_grad.duration;
      spoil_grad.amp = 0.0;
    } else if ((perewind[0] == 'n') && (spoilflag[0] == 'y')) {  // Spoiler, no rewinder
      strcpy(perName,spoil_grad.name);
      perTime = spoil_grad.duration;
      pespoil_amp = spoil_grad.amp;      // Apply spoiler on PE & PE2 axis if no rewinder
    }
  }
  pe2_offsetamp = sepSliceRephase ? 0.0 : pe2_grad.offsetamp;  // pe2 slab refocus

  /* Create optional prepulse events ************************/
  if (sat[0] == 'y')  create_satbands();
  if (fsat[0] == 'y') create_fatsat();
  if (mt[0] == 'y')   create_mtc();
  if (ir[0] == 'y')   create_inversion_recovery();

  /* Set up frequency offset pulse shape list ********/   	
  offsetlist(pss,ss_grad.ssamp,0,freqEx,ns,seqcon[1]);
  shapeEx = shapelist(p1_rf.pulseName,ss_grad.rfDuration,freqEx,ns,ss_grad.rfFraction,seqcon[1]);
  
  /* Check that all Gradient calculations are ok ************/
  sgl_error_check(sglerror);

  /* Min TE ******************************************/
  tau1 = ss_grad.rfCenterBack + pe_grad.duration + alfa + ro_grad.timeToEcho;
  tau1 += (sepSliceRephase) ? ssr_grad.duration : 0.0;   // Add slice refocusing if separate event

  temin = tau1 + 4e-6;  /* ensure that te_delay is at least 4us */
  if (minte[0] == 'y') {
    te = temin;
    putvalue("te",te);
  }
  if (te < temin) {
    abort_message("TE too short.  Minimum TE= %.2fms\n",temin*1000+0.005);   
  }
  te_delay = te - tau1;

  /* Min TE2 *****************************************/
  tau2 = (readrev) ? 2*ro_grad.timeFromEcho+alfa : ro_grad.duration+ref_grad.duration;
  te2min = tau2 + 4e-6;
  if (minte2[0] == 'y') {
    te2 = te2min;
    putvalue("te2",te2);
  }
  if (te2 < te2min) {
    abort_message("TE2 too short.  Minimum TE2= %.2fms\n",te2min*1000+0.005);
  }

  if (readrev) te2_delay = te2 - tau2;
  else {
    tau2 = ro_grad.duration + 2*ror_grad.duration;
    if (te2 >= tau2) {
      sepReadRephase = 1; // Set flag for separate read rephase
      te2_delay = te2 - ro_grad.duration - 2*ror_grad.duration;
    } else {
      sepReadRephase = 0;
      if (te2 > te2min+4e-6) {
        ref_grad.duration = granularity(te2-ro_grad.duration-8e-6,GRADIENT_RES);
        ref_grad.calcFlag = AMPLITUDE_FROM_MOMENT_DURATION;
        calc_dephase(&ref_grad,WRITE,ro_grad.m0,"","");
      }
      te2_delay = te2 - ro_grad.duration - ref_grad.duration;
    }
  }

  /* Min TE3 *****************************************/
  if (readrev) {  
    tau3 = 2*ro_grad.timeToEcho + alfa;
    te3min = tau3 + 4e-6;
    if (minte3[0] == 'y') {
      te3 = te3min;
      putvalue("te3",te3);
    }
    if (te3 < te3min) {
      abort_message("TE3 too short.  Minimum TE3= %.2fms\n",te3min*1000+0.005);
    }
    te3_delay = te3 - tau3;
  }

  /* Now set the TE array accordingly */
  putCmd("TE = 0"); /* Re-initialize TE */
  putCmd("TE[1] = %f",te*1000);
  if (readrev) {
    for (i=1;i<ne;i++) {
      if (i%2 == 0) putCmd("TE[%d] = TE[%d]+%f",i+1,i,te3*1000);
      else putCmd("TE[%d] = TE[%d]+%f",i+1,i,te2*1000);
    }
  } else {
    for (i=1;i<ne;i++) putCmd("TE[%d] = TE[%d]+%f",i+1,i,te2*1000);
  }

  /* Check nsblock, the number of slices blocked together
     (used for triggering and/or inversion recovery) */
  check_nsblock();

  /* Min TR ******************************************/
  trmin  = ss_grad.duration + te_delay + pe_grad.duration + ne*ro_grad.duration + perTime + 8e-6;
  trmin += (sepSliceRephase) ? ssr_grad.duration : 0.0;   // Add slice refocusing if separate event
  if (readrev) trmin += (ne/2)*te2_delay + ((ne-1)/2)*te3_delay;
  else trmin += (sepReadRephase) ? (ne-1)*(te2_delay+2*ror_grad.duration) : (ne-1)*(te2_delay+ref_grad.duration);

  /* Increase TR if any options are selected *********/
  if (sat[0] == 'y')  trmin += satTime;
  if (fsat[0] == 'y') trmin += fsatTime;
  if (mt[0] == 'y')   trmin += mtTime;
  if (ticks > 0) trmin += 4e-6;

  /* Adjust for all slices ***************************/
  trmin *= ns;

  /* Inversion recovery *********************************/
  if (ir[0] == 'y') {
    /* tiaddTime is the additional time beyond IR component to be included in ti */
    /* satTime, fsatTime and mtTime all included as those modules will be after IR */
    tiaddTime = satTime + fsatTime + mtTime + 4e-6 + ss_grad.rfCenterFront;
    /* calc_irTime checks ti and returns the time of all IR components */
    trmin += calc_irTime(tiaddTime,trmin,mintr[0],tr,&trtype);
  }

  if (mintr[0] == 'y') {
    tr = trmin;
    putvalue("tr",tr);
  }
  if (FP_LT(tr,trmin)) {
    abort_message("TR too short.  Minimum TR = %.2fms\n",trmin*1000+0.005);
  }

  /* Calculate tr delay */
  tr_delay = granularity((tr-trmin)/ns,GRADIENT_RES);

  /* Set pe_steps for profile or full image **********/   	
  pe_steps = prep_profile(profile[0],nv,&pe_grad,&per_grad);
  F_initval(pe_steps/2.0,vpe_offset);

  pe2_steps = prep_profile(profile[1],nv2,&pe2_grad,&null_grad);
  F_initval(pe2_steps/2.0,vpe2_offset);

  /* Shift DDR for pro *******************************/   	
  roff = -poffset(pro,ro_grad.roamp);

  /* Adjust experiment time for VnmrJ *******************/
  if (ssc<0) {
    if (seqcon[2]=='s') g_setExpTime(trmean*ntmean*pe_steps*pe2_steps*arraydim);
    else if (seqcon[3]=='s') g_setExpTime(trmean*pe2_steps*(ntmean*pe_steps*arraydim - ssc*arraydim));
    else g_setExpTime(trmean*(ntmean*pe_steps*pe2_steps*arraydim - ssc*arraydim));
  } else {
    if (seqcon[2]=='s') g_setExpTime(trmean*ntmean*pe_steps*pe2_steps*arraydim);
    else g_setExpTime(trmean*ntmean*pe_steps*pe2_steps*arraydim + tr*ssc);
  }

  /* Return parameters to VnmrJ */
  putvalue("tror",ror_grad.duration);  // ROR duration
  putvalue("gpe",pe_grad.peamp);       // PE max grad amp
  putvalue("gss",ss_grad.ssamp);       // Excitation slice grad
  putvalue("gro",ro_grad.roamp);       // RO grad

  /* PULSE SEQUENCE ***************************************/
  status(A);
  rotate();
  triggerSelect(trigger);       // Select trigger input 1/2/3
  obsoffset(resto);
  delay(4e-6);
  initval(fabs(ssc),vssc);      // Compressed steady-state counter
  if (seqcon[2]=='s') assign(zero,vssc); // Zero for standard peloop
  assign(zero,vrfspoil_ctr);    // RF spoil phase counter
  assign(zero,vrfspoil);        // RF spoil multiplier
  assign(one,vacquire);         // real-time acquire flag
  setacqvar(vacquire);          // Turn on acquire when vacquire is zero 

  /* trigger */
  if (ticks > 0) F_initval((double)nsblock,vtrigblock);

  /* Begin phase-encode loop ****************************/       
  peloop2(seqcon[3],pe2_steps,vpe2_steps,vpe2_ctr);

    /* Begin phase-encode loop ****************************/       
    peloop(seqcon[2],pe_steps,vpe_steps,vpe_ctr);

      if (trtype) delay(ns*tr_delay);   // relaxation delay

      /* Compressed steady-states: 
         1st array & transient, all arrays if ssc is negative */
      if ((ix > 1) && (ssc > 0))
        assign(zero,vssc);
      sub(vpe_ctr,vssc,vpe_ctr);  // vpe_ctr counts up from -ssc
      assign(zero,vssc);
      if (seqcon[2] == 's')
        assign(zero,vacquire);    // Always acquire for non-compressed loop
      else {
        ifzero(vpe_ctr);
          assign(zero,vacquire);  // Start acquiring when vpe_ctr reaches zero
        endif(vpe_ctr);
      }

      /* Use standard encoding order for 2nd PE dimension */
      ifzero(vacquire);
        sub(vpe2_ctr,vpe2_offset,vpe2_mult);
      elsenz(vacquire);
        sub(zero,vpe2_offset,vpe2_mult);
      endif(vacquire);

      /* Set rcvr/xmtr phase for RF spoiling *******************/
      if (rfspoil[0] == 'y') {
        incr(vrfspoil_ctr);                    // vrfspoil_ctr = 1  2  3  4  5  6
        add(vrfspoil,vrfspoil_ctr,vrfspoil);   // vrfspoil =     1  3  6 10 15 21
        xmtrphase(vrfspoil);
        rcvrphase(vrfspoil);
      }

      /* Read external kspace table if set ******************/       
      if (table)
        getelem(t1,vpe_ctr,vpe_mult);
      else {
        ifzero(vacquire);
          sub(vpe_ctr,vpe_offset,vpe_mult);
        elsenz(vacquire);
          sub(zero,vpe_offset,vpe_mult);  // Hold PE mult at initial value for steady states
        endif(vacquire);
      }

      /* PE rewinder follows PE table; zero if turned off ***/       
      if (perewind[0] == 'y') {
        assign(vpe_mult,vper_mult);
        assign(vpe2_mult,vpe2r_mult);
      }
      else {
        assign(zero,vper_mult);
        assign(zero,vpe2r_mult);
      }

      /* Begin multislice loop ******************************/       
      msloop(seqcon[1],ns,vms_slices,vms_ctr);

        if (!trtype) delay(tr_delay);   // Relaxation delay

        if (ticks > 0) {
          modn(vms_ctr,vtrigblock,vtest);
          ifzero(vtest);                // if the beginning of an trigger block
            xgate(ticks);
            grad_advance(gpropdelay);
            delay(4e-6);
          elsenz(vtest);
            delay(4e-6);
          endif(vtest);
        }

        /* TTL scope trigger **********************************/       
        sp1on(); delay(4e-6); sp1off();

        /* Prepulse options ***********************************/       
        if (ir[0] == 'y')   inversion_recovery();
        if (sat[0] == 'y')  satbands();
        if (fsat[0] == 'y') fatsat();
        if (mt[0] == 'y')   mtc();

        /* Slice select RF pulse ******************************/ 
        obspower(p1_rf.powerCoarse);
        obspwrf(p1_rf.powerFine);
        delay(4e-6);
        obl_shapedgradient(ss_grad.name,ss_grad.duration,0,0,ss_grad.amp,NOWAIT);
        delay(ss_grad.rfDelayFront);
        shapedpulselist(shapeEx,ss_grad.rfDuration,oph,rof1,rof2,seqcon[1],vms_ctr);
        delay(ss_grad.rfDelayBack);

       /* Phase encode, refocus, and dephase gradient ********/
        if (sepSliceRephase) {                // separate slice refocus gradient
          obl_shapedgradient(ssr_grad.name,ssr_grad.duration,0,0,-ssr_grad.amp,WAIT);
          delay(te_delay);                    // delay between slab refocus and pe
          pe2_shapedgradient(pe_grad.name,pe_grad.duration,-ror_grad.amp,0,-pe2_offsetamp,
            -pe_grad.increment,-pe2_grad.increment,vpe_mult,vpe2_mult,WAIT);
        } else {
	  pe2_shapedgradient(pe_grad.name,pe_grad.duration,-ror_grad.amp,0,-pe2_offsetamp,
            -pe_grad.increment,-pe2_grad.increment,vpe_mult,vpe2_mult,WAIT);
          delay(te_delay);                    // delay after refocus/pe
        }

        F_initval(ne,vne);
        loop(vne,vne_ctr);

          if (readrev) {
            mod2(vne_ctr,vneindex);
            ifzero(vneindex);
              /* Shift DDR for pro *******************************/
              roff = -poffset(pro,ro_grad.roamp);
              /* Readout gradient ********************************/
              obl_shapedgradient(ro_grad.name,ro_grad.duration,ro_grad.amp,0,0,NOWAIT);
              delay(ro_grad.atDelayFront);
              /* Acquisition ***************************************/
              startacq(alfa);
              acquire(np,1.0/sw);
              delay(ro_grad.atDelayBack);
              endacq();
              sub(vne,vne_ctr,vnelast);
              sub(vnelast,one,vnelast);
              ifzero(vnelast);
              elsenz(vnelast);
                delay(te2_delay);
              endif(vnelast);
            elsenz(vneindex);
              /* Shift DDR for pro *******************************/
              roff = -poffset(pro,-ro_grad.roamp);
              /* Readout gradient ********************************/
              obl_shapedgradient(ro_grad.name,ro_grad.duration,-ro_grad.amp,0,0,NOWAIT);
              delay(ro_grad.atDelayFront);
              /* Acquisition ***************************************/
              startacq(alfa);
              acquire(np,1.0/sw);
              delay(ro_grad.atDelayBack);
              endacq();
              sub(vne,vne_ctr,vnelast);
              sub(vnelast,one,vnelast);
              ifzero(vnelast);
              elsenz(vnelast);
                delay(te3_delay);
              endif(vnelast);
            endif(vneindex);
          } else {
            /* Shift DDR for pro *******************************/
            roff = -poffset(pro,ro_grad.roamp);
            /* Readout gradient ********************************/
            obl_shapedgradient(ro_grad.name,ro_grad.duration,ro_grad.amp,0,0,NOWAIT);
            delay(ro_grad.atDelayFront);
            /* Acquisition ***************************************/
            startacq(alfa);
            acquire(np,1.0/sw);
            delay(ro_grad.atDelayBack);
            endacq();
            sub(vne,vne_ctr,vnelast);
            sub(vnelast,one,vnelast);
            ifzero(vnelast);
            elsenz(vnelast);
              if (sepReadRephase) {
                obl_shapedgradient(ror_grad.name,ror_grad.duration,-ror_grad.amp,0,0,WAIT);
                delay(te2_delay);
                obl_shapedgradient(ror_grad.name,ror_grad.duration,-ror_grad.amp,0,0,WAIT);
              } else {
                obl_shapedgradient(ref_grad.name,ref_grad.duration,-ref_grad.amp,0,0,WAIT);
                delay(te2_delay);
              }
            endif(vnelast);
          }

        endloop(vne_ctr);

        /* Rewind / spoiler gradient **************************/
        if ((perewind[0] == 'y') || (spoilflag[0] == 'y')) {
          pe2_shapedgradient(perName,perTime,spoil_grad.amp,pespoil_amp,pespoil_amp,
            pe_grad.increment,pe2_grad.increment,vper_mult,vpe2r_mult,WAIT);
        }

      endmsloop(seqcon[1],vms_ctr);

    endpeloop(seqcon[2],vpe_ctr);

  endpeloop(seqcon[3],vpe2_ctr);

  /* Inter-image delay **********************************/
  sub(ntrt,ct,vtrimage);
  decr(vtrimage);
  ifzero(vtrimage);
    delay(trimage);
  endif(vtrimage);
}
Esempio n. 10
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       autocal[MAXSTR],
	    fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            spca180[MAXSTR],  /* string for the waveform 180 */
            fc180[MAXSTR], 
            shp_sl[MAXSTR],   /* string for shape of water pulse */
            sel_flg[MAXSTR];

 int         phase, phase2, ni2, icosel, /* icosel changes sign with gds  */ 
             t1_counter,   /* used for states tppi in t1           */ 
             t2_counter;   /* used for states tppi in t2           */ 

 double      pwC,
             pwClvl,
	     compC,
             compN,
	     tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             taub,         /*  ~ 1/4JNH =  2.25 ms */
             zeta,         /* time for C'-N to refocuss set to 0.5*24.0 ms */
             timeTN,        /* nitrogen T period */
             BigT1,        /* delay to compensate for gradient */
             pwN,          /* PW90 for 15N pulse              */
             pwco90,       /* PW90 for co nucleus @ dhpwr         */
             pwca180h,     /* PW180 for ca at dvhpwr               */
             pwco180,      /* PW180 for co at dhpwr180               */
             tsatpwr,      /* low level 1H trans.power for presat  */
             dhpwr,        /* power level for 13C pulses on dec1 - 64 us 
                              90 for part a of the sequence  */
             dhpwr180,     /* power level for 13C pulses on dec1 - 64 us 
                              180 for part a of the sequence  */
             dvhpwr,       /* power level for 180 13C pulses at 54 ppm
                                using a 55.6 us 180 so that get null in
                                co at 178 ppm */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             pw_sl,        /* pw90 for H selective pulse on water ~ 2ms */
             phase_sl,     /* pw90 for H selective pulse on water ~ 2ms */
             tpwrsl,       /* power level for square pw_sl       */
 	     Jf,	   /* scale factor for JNCo, set to 4-5 */
             gt0,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gstab,
             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7, 
             gzlvl8; 

/* LOAD VARIABLES */

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

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  zeta  = getval("zeta");
  timeTN = getval("timeTN");
  BigT1 = getval("BigT1");
  pwca180h = getval("pwca180h");
  pwco180 = getval("pwco180");
  pwco90 = getval("pwco90");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dhpwr = getval("dhpwr");
  dhpwr180 = getval("dhpwr180");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  dvhpwr = getval("dvhpwr");
  ni = getval("ni");
  ni2 = getval("ni2");
  pw_sl = getval("pw_sl");
  phase_sl = getval("phase_sl");
  tpwrsl = getval("tpwrsl");
  Jf = getval("Jf");

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

  gzlvl0 = getval("gzlvl0");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl8 = getval("gzlvl8");
 
  if (autocal[0] == 'y')
   {
    strcpy(spca180,"Phard_-118p");
    if (FIRST_FID)
    {
      compC = getval("compC");
      pwC = getval("pwC");
      pwClvl = getval("pwClvl");
      ca180 = pbox(spca180, CA180, CA180ps, dfrq, compC*pwC, pwClvl);
      co90 = pbox("Phard90", CO90, CA180ps, dfrq, compC*pwC, pwClvl);
      co180 = pbox("Phard180",CO180,CA180ps, dfrq, compC*pwC, pwClvl);
      pwN = getval("pwN"); compN = getval("compN"); pwNlvl = getval("pwNlvl");
    }

    pwca180h = ca180.pw;
    dvhpwr = ca180.pwr;
    pwco90 = co90.pw;
    dhpwr = co90.pwr;
    pwco180 = co180.pw;
    dhpwr180 = co180.pwr;
   }


/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */


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

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


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

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

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

    if( dhpwr > 62 )
    {
        printf("don't fry the probe, DHPWR 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( pwco90 > 200.0e-6 )
    {
        printf("dont fry the probe, pwco90 too high ! ");
        psg_abort(1);
    } 
    if( pwca180h > 200.0e-6 )
    {
        printf("dont fry the probe, pwca180h too high ! ");
        psg_abort(1);
    } 

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

/*  Phase incrementation for hypercomplex 2D data */

    if (phase == 2)
      tsadd(t1,1,4);
    if (phase2 == 2) {
       tsadd(t4, 2, 4);
       icosel = 1; 
       }               /* change sign of gradient */
    else icosel = -1;

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1) - 2*pwN - pwca180h - 4.0/PI*pwco90 - 2*POWER_DELAY
		  - WFG_START_DELAY - 8.0e-6 - WFG_STOP_DELAY );
        if(tau1 < 0.2e-6) tau1 = 0.4e-6;
    }
        tau1 = tau1/2.0;

/*  Set up f2180  tau2 = t2               */

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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
   decpower(dvhpwr);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

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

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

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

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

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

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

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

   dec2phase(zero); decphase(zero); 

   delay(taua -gt5 -gstab -4.0e-6); 

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


   if(sel_flg[A] == 'y') {    /* active suppression of one of 
                                 the two components */

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

   /* shaped pulse  */
   initval(1.0,v3);
   obsstepsize(45.0);
   dcplr2phase(v3);

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

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

   delay( 1.34e-3 - SAPS_DELAY - 2.0*pw);
   rgpulse(pw,one,0.0,0.0);
   rgpulse(2*pw,zero,0.0,0.0);
   rgpulse(pw,one,0.0,0.0);

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


   }

   else {

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

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

   dec2rgpulse(pwN,zero,0.0,0.0);

   delay( zeta + pwco180 );

   }
  
   dec2rgpulse(2*pwN,zero,0.0,0.0);
   decpower(dhpwr180);
   decrgpulse(pwco180,zero,0.0,0.0);

   delay(zeta - 2.0e-6);

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

   dec2phase(zero); decphase(t1);
   decpower(dhpwr);

   delay(0.2e-6);
   zgradpulse(gzlvl7,gt7);
   delay(gstab);
   decpower(dhpwr);
   decrgpulse(pwco90,t1,2.0e-6,0.0);

   if( fc180[A] == 'n' ) {
      decphase(zero);
      delay(tau1);

      dec2rgpulse(2*pwN,zero,0.0,0.0);
      decpower(dvhpwr);
      decshaped_pulse(spca180,pwca180h,zero,4.0e-6,0.0);
      decpower(dhpwr);

      delay(tau1);
   }

   else
     decrgpulse(2*pwco90,zero,2.0e-7,2.0e-7);

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

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


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

   delay(tau2);
      decshaped_pulse(spca180,pwca180h,zero,0.0,0.0);
   delay(tau2);
   decpower(dhpwr180);
   delay(tau2*Jf);
   decrgpulse(pwco180,zero,0.0,0.0);

   delay(0.2e-6); 
   zgradpulse(-icosel*gzlvl1,gt1/2.0);
   delay(50.0e-6);

   delay(timeTN - 50.0e-6 -0.2e-6 - 2.0*GRADIENT_DELAY - gt1/2.0);

   dec2rgpulse(2*pwN,t3,0.0,0.0);
   delay(0.2e-6); 
   zgradpulse(icosel*gzlvl1,gt1/2.0);
   delay(50.0e-6);

   delay(tau2*Jf + timeTN - 50.0e-6 -0.2e-6 - 2.0*GRADIENT_DELAY - gt1/2.0
	 + WFG_START_DELAY + pwca180h + WFG_STOP_DELAY + pwco180 );

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

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

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

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

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

   delay(taub - gt6 - gstab -0.2e-6);

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

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

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

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

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

   delay(taub - gt5 - gstab -0.2e-6);

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

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

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

   dec2power(dpwr2);
   decpower(dpwr);
   zgradpulse(gzlvl2,gt2);
   delay(gstab);

status(C);
         setreceiver(t6);

}
Esempio n. 11
0
pulsesequence()
{

  /* DECLARE AND LOAD VARIABLES */

  char f1180[MAXSTR],		/* Flag to start t1 @ halfdwell */
       f2180[MAXSTR],		/* Flag to start t2 @ halfdwell */
       mag_flg[MAXSTR],		/* Flag to use magic-angle gradients */
       H2O_flg[MAXSTR], stCdec[MAXSTR],		/* calls STUD+ waveforms from shapelib */
       STUD[MAXSTR];		/* apply automatically calculated STUD decoupling */

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

  double tau1,			/*  t1 delay */
         tau2,			/*  t2 delay */
         delta1, delta2, TC = getval("TC"),	/*  3.5 ms  */
         ni = getval("ni"), ni2 = getval("ni2"),
	 stdmf = getval("dmf80"),	/* dmf for 80 ppm of STUD decoupling */
         rf80 = getval("rf80"),	/* rf in Hz for 80ppm STUD+ */
         taua = getval("taua"),	/* time delays for CH coupling evolution */
         taub = getval("taub"), tauc = getval("tauc"),
	 /* string parameter stCdec calls stud decoupling waveform from your shapelib. */
         studlvl,		/* coarse power for STUD+ decoupling */
         bw, ofs, ppm,		/* temporary Pbox parameters */
         pwClvl = getval("pwClvl"),	/* coarse power for C13 pulse */
         pwC = getval("pwC"),	/* C13 90 degree pulse length at pwClvl */
  /* the following pulse length for the SLP pulse is automatically calculated   */
  /* by the macro "hcch_cosy".  The SLP pulse shape,"offC10" is called          */
  /* directly from your shapelib.                                               */
         pwC10,			/* 180 degree selective sinc pulse on CO(174ppm) */
         rf7,			/* fine power for the pwC10 ("offC10") pulse */
         compC = getval("compC"),	/* adjustment for C13 amplifier compression */
         pwmax, pwNlvl = getval("pwNlvl"),	/* power for N15 pulses */
         pwN = getval("pwN"),	/* N15 90 degree pulse length at pwNlvl */
         sw1 = getval("sw1"), sw2 = getval("sw2"), gt1 = getval("gt1"),
         gt2 = getval("gt2"), gt3 = getval("gt3"), gt4 = getval("gt4"),
         gt5 = getval("gt5"), gt7 = getval("gt7"), gt8 = getval("gt8"),
         gt9 = getval("gt9"), gzcal = getval("gzcal"), gzlvl1 = getval("gzlvl1"),
         gzlvl2 = getval("gzlvl2"), gzlvl3 = getval("gzlvl3"), gzlvl4 = getval("gzlvl4"),
         gzlvl5 = getval("gzlvl5"), gzlvl7 = getval("gzlvl7"), gzlvl8 = getval("gzlvl8"),
         gzlvl9 = getval("gzlvl9");

  getstr("f1180", f1180);
  getstr("f2180", f2180);
  getstr("H2O_flg", H2O_flg);
  getstr("STUD", STUD);
  /* 80 ppm STUD+ decoupling */
  strcpy(stCdec, "stCdec80");
  studlvl = pwClvl + 20.0 * log10(compC * pwC * 4.0 * rf80);
  studlvl = (int) (studlvl + 0.5);


  /*   INITIALIZE VARIABLES   */

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

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

  if (autocal[0] == 'n')
  {
    /* "offC10": 180 degree one-lobe sinc pulse on CO, null at Ca 139ppm away */
    pwC10 = getval("pwC10");
    rf7 = (compC * 4095.0 * pwC * 2.0 * 1.65) / pwC10;	/* needs 1.65 times more     */
    rf7 = (int) (rf7 + 0.5);	/* power than a square pulse */

    if (pwC > (24.0e-6 * 600.0 / sfrq))
    {
      printf("Increase pwClvl so that pwC < 24*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;
      offC10 = pbox_make("offC10", "sinc180n", bw, ofs, compC * pwC, pwClvl);
      if (dm3[B] == 'y')
	H2ofs = 3.2;
      ofs_check(H1ofs, C13ofs, N15ofs, H2ofs);
    }
    rf7 = offC10.pwrf;
    pwC10 = offC10.pw;
  }

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


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

  pwmax = 2.0 * pwN;
  if (pwC10 > pwmax)
    pwmax = pwC10;

  /* check validity of parameter range */

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

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

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

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

  /* LOAD VARIABLES */

  settable(t1, 2, phi1);
  settable(t2, 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 * (taua - gt2 - 0.2e-3)) / ((double) (ni - 1));
  else
    delta1 = 0.0;
  if (ni2 > 1)
    delta2 = (double) (t2_counter * (TC - 0.6e-3)) / ((double) (ni2 - 1));
  else
    delta2 = 0.0;

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

  /* BEGIN ACTUAL PULSE SEQUENCE */

  status(A);
  delay(10.0e-6);
  obspower(tpwr);
  decpower(pwClvl);
  decpwrf(4095.0);
  dec2power(pwNlvl);
  decphase(zero);
  dec2phase(zero);
  xmtrphase(v1);
  txphase(t1);
  if (dm3[B] == 'y')
    lk_sample();
  delay(d1);
  if (dm3[B] == 'y')
  {
    lk_hold();
    lk_sampling_off();
  }				/*freezes z0 correction, stops lock pulsing */
  rcvroff();

  if (gt1 > 0.2e-6)
  {
    decrgpulse(pwC, zero, rof1, rof1);
    delay(2.0e-6);
    zgradpulse(gzlvl1, gt1);
    delay(1.0e-3);
  }

  if (dm3[B] == 'y')		/* begins optional 2H decoupling */
  {
    dec3rgpulse(1 / dmf3, one, 10.0e-6, 2.0e-6);
    dec3unblank();
    dec3phase(zero);
    delay(2.0e-6);
    setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3);
  }

  status(B);
  rgpulse(pw, t1, 1.0e-4, 2.0e-6);
  xmtrphase(zero);
  zgradpulse(gzlvl2, gt2);
  delay(taua - gt2 - 2.0 * pwC - 2.0e-6 - SAPS_DELAY);
  txphase(zero);
  delay(tau1);
  decrgpulse(2.0 * pwC, zero, 0.0, 0.0);
  delay(tau1 - delta1);
  rgpulse(2.0 * pw, zero, 0.0, 2.0e-6);
  zgradpulse(gzlvl2, gt2);
  txphase(one);
  delay(taua - delta1 - gt2 - 2.0e-6);
  rgpulse(pw, one, 0.0, 2.0e-6);

  if (mag_flg[A] == 'y')
  {
    magradpulse(gzcal * gzlvl3, gt3);
  }
  else
  {
    zgradpulse(gzlvl3, gt3);
  }
  decphase(t2);
  txphase(zero);
  delay(200.0e-6);

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

  decphase(zero);
  decpwrf(rf7);
  delay(tau2);
  sim3shaped_pulse("", "offC10", "", 0.0, pwC10, 2.0 * pwN, zero, zero, zero, 0.0, 0.0);
  delay(taub - pwmax - WFG_START_DELAY - WFG_STOP_DELAY - POWER_DELAY);
  rgpulse(2.0 * pw, zero, 0.0, 0.0);

  decphase(t3);
  decpwrf(4095.0);
  delay(TC - taub + tau2 - delta2 - 2.0 * pw - POWER_DELAY);
  decrgpulse(2.0 * pwC, t3, 0.0, 0.0);
  decphase(t4);
  delay(TC - delta2 - POWER_DELAY);

  decrgpulse(pwC, t4, 0.0, 2.0e-6);
  zgradpulse(gzlvl4, gt4);
  txphase(zero);
  decphase(zero);
  delay(tauc - gt4);
  decrgpulse(2.0 * pwC, zero, 0.0, 2.0e-6);

  if (H2O_flg[A] == 'y')
  {
    delay(tauc - gt4 - 500.0e-6 - POWER_DELAY);
    zgradpulse(gzlvl4, gt4);
    decphase(one);
    obspwrf(1000.0);
    delay(500.0e-6);
    decrgpulse(pwC, one, 0.0, 1.0e-6);
    rgpulse(900 * pw, one, rof1, 0.0);
    txphase(zero);
    rgpulse(500 * pw, zero, 2.0e-6, 2.0e-6);
    obspwrf(4095.0);
    if (mag_flg[A] == 'y')
    {
      magradpulse(gzcal * gzlvl5, gt5);
    }
    else
    {
      zgradpulse(gzlvl5, gt5);
    }
    decphase(one);
    delay(200.0e-6);
    simpulse(pw, pwC, zero, one, 0.0, 2.0e-6);
    zgradpulse(gzlvl7, gt7);
    decphase(zero);
    delay(taub - gt7);
    simpulse(2.0 * pw, 2.0 * pwC, zero, zero, 0.0, 2.0e-6);
    zgradpulse(gzlvl7, gt7);
    delay(taub - gt7);
  }
  else
  {
    delay(tauc - taub - 2.0 * pw - POWER_DELAY);
    rgpulse(2.0 * pw, zero, 0.0, 2.0e-6);
    zgradpulse(gzlvl4, gt4);
    delay(taub - gt4 - 2.0e-6);
  }

  decrgpulse(pwC, zero, 0.0, 2.0e-6);
  if (mag_flg[A] == 'y')
  {
    magradpulse(gzcal * gzlvl8, gt8);
  }
  else
  {
    zgradpulse(gzlvl8, gt8);
  }
  txphase(zero);
  delay(200.0e-6);
  if (dm3[B] == 'y')		/* turns off 2H decoupling  */
  {
    setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
    dec3rgpulse(1 / dmf3, three, 2.0e-6, 2.0e-6);
    dec3blank();
    lk_autotrig();		/* resumes lock pulsing */
  }
  rgpulse(pw, zero, 0.0, 2.0e-6);
  if (mag_flg[A] == 'y')
  {
    magradpulse(gzcal * gzlvl9, gt9);
  }
  else
  {
    zgradpulse(gzlvl9, gt9);
  }
  delay(taua - gt9);
  simpulse(2.0 * pw, 2.0 * pwC, zero, zero, 0.0, 2.0e-6);
  if (mag_flg[A] == 'y')
  {
    magradpulse(gzcal * gzlvl9, gt9);
  }
  else
  {
    zgradpulse(gzlvl9, gt9);
  }

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

  delay(taua - gt9 - rof1 - 0.5 * pw - 2.0 * POWER_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(stCdec,1/stdmf, 1.0);
        startacq(alfa);
        acquire(np, 1.0/sw);
        decprgoff();
        decoff();
        decblank();
    if (dm2[C] == 'y')
    {
      setstatus(DEC2ch, TRUE, dmm2[C], FALSE, dmf2);
    }
  }
  else
    status(C);
  setreceiver(t11);
}
Esempio n. 12
0
pulsesequence ()
{
double  gstab = getval("gstab"),
	gt1 = getval("gt1"),
	gzlvl1 = getval("gzlvl1"),
        gt2 = getval("gt2"),
        gzlvl2 = getval("gzlvl2"),
        mix = getval("mix"),
        wrefpw = getval("wrefpw"),
        wrefpwr = getval("wrefpwr"),
        wrefpwrf = getval("wrefpwrf"),
        phincr1 = getval("phincr1"),
        flippwr = getval("flippwr"),
        flippwrf = getval("flippwrf"),
        flippw = getval("flippw"),
        trimpwr = getval("trimpwr"),
        gt0 = getval("gt0"),
        gzlvl0 = getval("gzlvl0"),
	trim = getval("trim"),
        satpwr = getval("satpwr"),
        satfrq = getval("satfrq"),
        satfrqref = getval("satfrqref"),
        satpw = getval("satpw"),
        d3 = getval("d3"),
        xferdly = getval("xferdly"),
        h1freq_local = getval("h1freq_local"),
        gcal_local = getval("gcal_local"),
        coil_size = getval("coil_size"),
        swfactor = 9.0,    /* do the adiabatic sweep over 9.0*sw  */
        zqpwr=getval("zqpwr"), zqpw=getval("zqpw"),
        gzlvlzq,invsw,cycles;
	
int	iphase = (int) (getval("phase") + 0.5);
char    sspul[MAXSTR], trim_flg[MAXSTR], wrefshape[MAXSTR],flipback[MAXSTR], 
        zqshape[MAXSTR],
	zqflg[MAXSTR], alt_grd[MAXSTR],flipshape[MAXSTR],satshape[MAXSTR];
        
  getstr("sspul", sspul);
  getstr("trim_flg", trim_flg);
  getstr("wrefshape", wrefshape);
  getstr("flipshape", flipshape);
  getstr("flipback", flipback);
  getstr("zqflg", zqflg);
  getstr("zqshape", zqshape);
  getstr("alt_grd",alt_grd);
  getstr("satshape",satshape);
  rof1 = getval("rof1"); if(rof1 > 2.0e-6) rof1=2.0e-6;
  if (phincr1 < 0.0) phincr1=360+phincr1;
  initval(phincr1,v13);
  cycles = xferdly/(d3+satpw) + 0.5;
     initval(cycles,v14);

  if (coil_size == 0) coil_size=16;
  invsw = sw*swfactor;
  if (invsw > 60000.0) invsw = 60000.0; /* do not exceed 60 kHz */
  invsw = invsw/0.97;     /* correct for end effects of the cawurst-20 shape */

  if ((zqflg[0] == 'y') && (mix < 0.051))
   {
     printf("Mixing time should be more than 51 ms for zero quantum suppression\n");
     psg_abort(1);
   }

  gzlvlzq=(invsw*h1freq_local*2349)/(gcal_local*coil_size*sfrq*1e+6);

  sub(ct,ssctr,v12);
  settable(t1,32,phi1);		  getelem(t1,v12,v1);
  settable(t2,32,phi2);		  getelem(t2,v12,v2);
  settable(t3,32,phi3);		  getelem(t3,v12,v3);	
  settable(t4,32,phi4);		  getelem(t4,v12,v4);
  settable(t5,32,phi5);		  getelem(t5,v12,v5);
  settable(t7,32,phi7);		  getelem(t7,v12,v7);
/*  settable(t8,32,phi8);		  getelem(t8,v12,v8); */
  settable(t6,32,rec);		  getelem(t6,v12,oph);
  settable(t9,32,phi9);		  getelem(t9,v12,v6);

  if (zqflg[0] == 'y') add(oph,two,oph);
  hlv(ct,v10); mod2(v10,v10);        /*changing gradient sign between sanc1-2 and 3-4 etc. */

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

status(A);
 obspower(tpwr); obspwrf(4095.0); decpower(dpwr);
   if (sspul[A] == 'y')
    {
       zgradpulse(gzlvl0,gt0);
       rgpulse(pw,zero,rof1,rof1);
       zgradpulse(gzlvl0,gt0);
    }
   if (d1 > xferdly) delay(d1-xferdly);

             /* set saturation frequencies */
   mod2(ct,v8);                /*  0 1 0 1 0 1 0 1 ..frequency  switch
                                  on every second transient */
   ifzero(v8); obsoffset(satfrq);
   elsenz(v8); obsoffset(satfrqref);
   endif(v8);

 /*  Start the selective saturation of protein */

    obspower(satpwr);
    if (cycles > 0.0)
   {
    starthardloop(v14);
      delay(d3);
      shaped_pulse(satshape,satpw,zero,rof1,rof1);
      endhardloop();
   }
   obspower(tpwr); obsoffset(tof);

status(B);
   settable(t8,32,phi8);           getelem(t8,v12,v8);
   obsstepsize(45.0);
   initval(7.0,v11);
   xmtrphase(v11);

   rgpulse(pw,v1,rof1,rof1);
   if (trim_flg[0] == 'y')
	{ obspower(trimpwr);
          rgpulse(trim,v6,rof1,rof1);
          obspower(tpwr);
        }
   xmtrphase(zero);
   if (trim_flg[0] == 'y')
     {
      if (d2-2.0*pw/3.14 - 2.0*rof1 - SAPS_DELAY - 2.0*POWER_DELAY> 0)
                 delay(d2-2.0*pw/3.14-2.0*rof1-SAPS_DELAY - 2.0*POWER_DELAY);
      else
        delay(0.0);
     }
   else
     {
      if (d2-4.0*pw/3.14 - 2.0*rof1 - SAPS_DELAY> 0)
                 delay(d2-4.0*pw/3.14-2.0*rof1-SAPS_DELAY);
      else
        delay(0.0);
     }     
   rgpulse(pw,v7,rof1,rof1);
     if (zqflg[0] == 'y')
      {
            ifzero(v10); rgradient('z',gzlvlzq);
                 elsenz(v10); rgradient('z',-1.0*gzlvlzq); endif(v10);
          obspower(zqpwr);
          shaped_pulse(zqshape,zqpw,zero,rof1,rof1);
          obspower(tpwr);
          rgradient('z',0.0);
          delay((mix-0.050-gt1)*0.7);
          if (alt_grd[0] == 'y')
           {
              ifzero(v10); zgradpulse(gzlvl1,gt1);
                    elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10);
           }
          else zgradpulse(gzlvl1,gt1);
          if (flipback[0] == 'n')
            delay((mix-0.05-gt1)*0.3);
          else     
            { delay((mix-0.05-gt1)*0.3 - flippw - rof1);
              obsstepsize(1.0);
              xmtrphase(v13);
              add(v8,two,v8);
              obspower(flippwr+6); obspwrf(flippwrf);
              shaped_pulse(flipshape,flippw,v8,rof1,rof1);
              xmtrphase(zero);
              add(v8,two,v8);
              obspower(tpwr); obspwrf(4095.0);
            }
      }
     else
      {
         delay(mix*0.7);
         if (alt_grd[0] == 'y')
           {
             ifzero(v10); zgradpulse(gzlvl1,gt1);
                    elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10);
           }
         else zgradpulse(gzlvl1,gt1);
         if (flipback[0] == 'n')
           delay(mix*0.3-gt2); 
          else    
            { delay(mix*0.3 - flippw - rof1);
              obsstepsize(1.0);
              xmtrphase(v13);
              add(v8,two,v8);
              obspower(flippwr+6); obspwrf(flippwrf);
              shaped_pulse(flipshape,flippw,v8,rof1,rof1);
              xmtrphase(zero);
              add(v8,two,v8);
              obspower(tpwr); obspwrf(4095.0);
            }
      }
   obspower(tpwr);
   rgpulse(pw,v8,rof1,rof1);
   if (alt_grd[0] == 'y')
    {
     ifzero(v10); zgradpulse(gzlvl2,gt2); 
		elsenz(v10); zgradpulse(-1.0*gzlvl2,gt2); endif(v10);
    }
    else zgradpulse(gzlvl2,gt2);
   delay(gstab);
   obspower(wrefpwr+6); obspwrf(wrefpwrf);
   shaped_pulse(wrefshape,wrefpw,v5,rof1,rof1);
   obspower(tpwr); obspwrf(4095.0);
   rgpulse(2.0*pw,v4,rof1,rof1);
   if (alt_grd[0] == 'y')
    {
     ifzero(v10); zgradpulse(gzlvl2,gt2);
                elsenz(v10); zgradpulse(-1.0*gzlvl2,gt2); endif(v10);
    }
    else zgradpulse(gzlvl2,gt2);
   delay(gstab);
   if (alt_grd[0] == 'y')
    {
     ifzero(v10); zgradpulse(1.2*gzlvl2,gt2);
                elsenz(v10); zgradpulse(-1.2*gzlvl2,gt2); endif(v10);
    }
    else zgradpulse(1.2*gzlvl2,gt2);
   delay(gstab);
   obspower(wrefpwr+6); obspwrf(wrefpwrf);
   shaped_pulse(wrefshape,wrefpw,v3,rof1,rof1);
   obspower(tpwr); obspwrf(4095.0);
   rgpulse(2.0*pw,v2,rof1,rof2);
   if (alt_grd[0] == 'y')
    {
     ifzero(v10); zgradpulse(1.2*gzlvl2,gt2);
                elsenz(v10); zgradpulse(-1.2*gzlvl2,gt2); endif(v10);
    }
    else zgradpulse(1.2*gzlvl2,gt2);
   delay(gstab);
   status(C);
}
Esempio n. 13
0
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */

void        makeHHdec(), makeCdec(); 	                /* utility functions */

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 */
	    T1[MAXSTR],				/* insert T1 relaxation delay */
	    T1rho[MAXSTR],		     /* insert T1rho relaxation delay */
	    T2[MAXSTR],				/* insert T2 relaxation delay */
	    TROSY[MAXSTR],			    /* do TROSY on N15 and H1 */
	    Hdecflg[MAXSTR],                       /* HH-h**o decoupling flag */
	    Cdecflg[MAXSTR];                /* low power C-13 decoupling flag */
 
int         icosel,          			  /* used to get n and p type */
            ihh=1,       /* used in HH decouling to improve water suppression */
            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 */
            pwr_dly,                 /* power delay */
        
/* the sech/tanh pulse is automatically calculated by the macro "proteincal", */  
/* and is called directly from your shapelib.                  		      */
   pwClvl = getval("pwClvl"), 	  	        /* coarse power for C13 pulse */
   pwC = getval("pwC"),     	      /* C13 90 degree pulse length at pwClvl */
   rf0,            	          /* maximum fine power when using pwC pulses */
   rfst,	                           /* fine power for the stCall pulse */

   compH = getval("compH"),        /* adjustment for H1 amplifier compression */
   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 */
   	tpwrsf = getval("tpwrsf"),    /* fine power adustment for soft pulse  */
   	pwHs = getval("pwHs"),	        /* H1 90 degree pulse length at tpwrs */
   	pwHH = 0.0,                     /* pwHH = pwHs for HH h**o-decoupling */
   	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 */

	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"),
	gstab = getval("gstab"),
	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("TROSY",TROSY);
    getstr("Hdecflg", Hdecflg);
    getstr("Cdecflg", Cdecflg);

/*   LOAD PHASE TABLE    */
	
        settable(t3,2,phi3);
	settable(t4,1,phx);
   if (TROSY[A]=='y')
       {settable(t1,1,ph_x);
	settable(t9,1,phx);
 	settable(t10,1,phy);
	settable(t11,1,phx);
	settable(t12,2,recT);}
    else
       {settable(t1,1,phx);
	settable(t9,8,phi9);
 	settable(t10,1,phx);
	settable(t11,1,phy);
	settable(t12,4,rec);}



/*   INITIALIZE VARIABLES   */

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

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

/* selective H20 one-lobe sinc pulse */
    if(pwHs > 1e-6)
      tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));  /* needs 1.69 times more */
    else                    	                    /* power than a square pulse */
      tpwrs = 0.0;
    tpwrs = (int) (tpwrs);    
    if (tpwrsf<4095.0) tpwrs = tpwrs + 6.0;
    if (tpwrsf < 4095.0) 
    {
      tpwrs = tpwrs + 6.0;   
      pwr_dly = POWER_DELAY + PWRF_DELAY;
    }
    else pwr_dly = POWER_DELAY;

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

/* make shapes and set up parameters for HH h**o-decoupling */
    if(Cdecflg[0] == 'y') makeCdec();
    if(Hdecflg[0] == 'y') makeHHdec();
    if(Hdecflg[0] != 'n')
    { 
      pwHH = pwHs; 
      pwHs = 0.0; 
    }


/* CHECK VALIDITY OF PARAMETER RANGES */

  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 )
  { 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 will result 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='n' ! ");              psg_abort(1); }
/* PHASES AND INCREMENTED TIMES */

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

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

    if(Hdecflg[0] != 'n') ihh = icosel;

/*  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(rf0);
 	dec2power(pwNlvl);
	txphase(zero);
        decphase(zero);
        dec2phase(zero);
        if(Hdecflg[0] != 'n')
        {
          delay(5.0e-5);
          rgpulse(pw,zero,rof1,0.0);                 
          rgpulse(pw,one,0.0,rof1);                 
          zgradpulse(1.5*gzlvl0, 0.5e-3);
          delay(5.0e-4);
          rgpulse(pw,zero,rof1,0.0);                 
          rgpulse(pw,one,0.0,rof1);                 
          zgradpulse(-gzlvl0, 0.5e-3);
        }
        
	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);   /*destroy N15 magnetization*/
	zgradpulse(gzlvl0, 0.5e-3);
	delay(1.0e-4);
	if (TROSY[A]=='n')    dec2rgpulse(pwN, one, 0.0, 0.0);
	zgradpulse(0.7*gzlvl0, 0.5e-3);
	decpwrf(rfst);
	txphase(t1);
	delay(5.0e-4);

      if ( dm3[B] == 'y' )     /* begins optional 2H decoupling */
        {
          lk_hold();
          dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6);
          dec3unblank();
          dec3phase(zero);
          delay(2.0e-6);
          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 - pwHH);
	
	if(Hdecflg[0] != 'n')
	{
	  obspower(tpwrs);
          if (tpwrsf<4095.0) obspwrf(tpwrsf); 
	  shaped_pulse("H2Osinc", pwHH, two, 5.0e-5, 0.0);
	  obspower(tpwr);
          if (tpwrsf<4095.0) obspwrf(4095.0);
   	  sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   	  obspower(tpwrs);
          if (tpwrsf<4095.0) obspwrf(tpwrsf);
   	  shaped_pulse("H2Osinc", pwHH, two, 5.0e-5, 0.0);
   	  obspower(tpwr);
          if (tpwrsf<4095.0) obspwrf(4095.0); 
   	}
   	else 
   	  sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   	
   	txphase(one);
	zgradpulse(gzlvl0, gt0);
	delay(lambda - gt0 - pwHH);        
 	rgpulse(pw, one, 0.0, 0.0);
	txphase(two);
        obspower(tpwrs);
        if (tpwrsf<4095.0) obspwrf(tpwrsf);
        shaped_pulse("H2Osinc", pwHs, two, 5.0e-5, 0.0);
	obspower(tpwr);
	if (tpwrsf<4095.0) obspwrf(4095.0);

        if (TROSY[A]=='y')
	  zgradpulse(ihh*gzlvl3, gt3);           
	else
	  zgradpulse(-ihh*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("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(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("stC200", 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);

	txphase(three);

        delay(gt1 + 2.0e-4 - pwHs - 1.0e-4 - 2.0*pwr_dly);
        obspower(tpwrs);
	if (tpwrsf<4095.0) obspwrf(tpwrsf);
        shaped_pulse("H2Osinc", pwHs, three, 5.0e-5, 0.0);
        obspower(tpwr);
	if (tpwrsf<4095.0) obspwrf(4095.0);

	txphase(t4);
	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("", "stC200", 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);} 
 
	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 +gstab - 0.65*pw + 2.0*GRADIENT_DELAY + POWER_DELAY);

        if ( dm3[B] == 'y' )   /* turns off 2H decoupling  */
           {
           setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
           dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6);
           dec3blank();
           lk_autotrig();   /* resumes lock pulsing */
           }

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

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

        if(Cdecflg[0] == 'y')
        {
          delay(gstab-2.0*POWER_DELAY-PRG_START_DELAY+rof2);
          rcvron();
                           
          statusdelay(C,1.0e-4);		

          if (dm3[B] == 'y') 
          {
            delay(1/dmf3); 
            lk_sample();
          }
	  setreceiver(t12);
          pbox_decon(&Cdseq);
          
          if(Hdecflg[0] == 'y')
            homodec(&HHdseq);  
        }
        else
        {
          delay(gstab+rof2);
          rcvron();
                             
          statusdelay(C,1.0e-4);		

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

          if(Hdecflg[0] == 'y')
            homodec(&HHdseq);        
        }
}		 
Esempio n. 14
0
pulsesequence() 
{ 
   double          gzlvl2 = getval("gzlvl2"), 
                   gt2 = getval("gt2"), 
                   gzlvl0 = getval("gzlvl0"), 
                   gt0 = getval("gt0"), 
                   gstab = getval("gstab"), 
                   phincr1 = getval("phincr1"), 
                   trim = getval("trim"),
                   trimpwr = getval("trimpwr"),
                   flippwr = getval("flippwr"),
                   flippwrf = getval("flippwrf"),
                   flippw = getval("flippw"),
		   wrefpwr = getval("wrefpwr"),
                   wrefpw = getval("wrefpw"),
                   wrefpwrf = getval("wrefpwrf");
 
   char  sspul[MAXSTR],wrefshape[MAXSTR],flipshape[MAXSTR],flipback[MAXSTR],
	 trim_flg[MAXSTR],alt_grd[MAXSTR]; 
 
/* LOAD VARIABLES */ 
 
   rof1 = getval("rof1"); if (rof1 > 2.0e-6) rof1=2.0e-6;
   getstr("sspul",sspul); 
   getstr("wrefshape", wrefshape);
   getstr("flipshape", flipshape);
   getstr("flipback", flipback);
   getstr("trim_flg", trim_flg);
   getstr("alt_grd",alt_grd);
   if (phincr1 < 0.0) phincr1=360+phincr1;
   initval(phincr1,v9);
 
/* CALCULATE PHASECYCLE */ 
         
   settable(t1,1,ph1); 
   settable(t2,16,ph2); 
   settable(t3,16,ph3); 
   settable(t4,4,ph4);
   settable(t5,4,ph5);
   settable(t6,16,phr); 
 
   sub(ct,ssctr,v12); 
   getelem(t1,v12,v1); 
   getelem(t2,v12,v2); 
   getelem(t3,v12,v3); 
   getelem(t4,v12,v4);
   getelem(t5,v12,v5);
   getelem(t6,v12,oph); 
 
   if (alt_grd[0] == 'y') mod2(ct,v6);
               /* alternate gradient sign on every 2nd transient */
 
/* BEGIN THE ACTUAL PULSE SEQUENCE */ 
 status(A); 
      obspower(tpwr); 
      if (sspul[A] == 'y') 
      { 
       zgradpulse(gzlvl0,gt0); 
       rgpulse(pw,zero,rof1,rof1); 
       zgradpulse(gzlvl0,gt0); 
      } 
      if (satmode[A] == 'y') 
       { 
        if (d1>satdly) delay(d1-satdly);
        if (fabs(tof-satfrq)>0.0) obsoffset(satfrq); 
        obspower(satpwr); 
        rgpulse(satdly,zero,rof1,rof1); 
        if (fabs(tof-satfrq)>0.0) obsoffset(tof); 
        obspower(tpwr); 
       } 
      else 
       delay(d1); 

     status(B); 
      if (flipback[A] == 'y') 
      { 
      obsstepsize(1.0);
      xmtrphase(v9);
      add(v1,two,v8);
      obspower(flippwr+6); obspwrf(flippwrf);
      shaped_pulse(flipshape,flippw,v8,rof1,rof1); 
      xmtrphase(zero);
      obspower(tpwr); obspwrf(4095.0);
      } 
      rgpulse(pw, v1, rof1, rof1); 
 
       ifzero(v6); zgradpulse(gzlvl2,gt2);
              elsenz(v6); zgradpulse(-gzlvl2,gt2); endif(v6);
       obspower(wrefpwr+6); obspwrf(wrefpwrf);
       delay(gstab);
       shaped_pulse(wrefshape,wrefpw,v2,rof1,rof1);
       obspower(tpwr); obspwrf(4095.0);
       rgpulse(2.0*pw,v3,rof1,rof1);
       ifzero(v6); zgradpulse(gzlvl2,gt2);
              elsenz(v6); zgradpulse(-gzlvl2,gt2); endif(v6);
       obspower(wrefpwr+6); obspwrf(wrefpwrf);
       delay(gstab);
       ifzero(v6); zgradpulse(1.2*gzlvl2,gt2);
              elsenz(v6); zgradpulse(-1.2*gzlvl2,gt2); endif(v6);
       delay(gstab);
       shaped_pulse(wrefshape,wrefpw,v4,rof1,rof1);
       obspower(tpwr); obspwrf(4095.0);
       if (trim_flg[A] == 'y') rgpulse(2.0*pw,v5,rof1,0.0);
       else        rgpulse(2.0*pw,v5,rof1,rof2);
       ifzero(v6); zgradpulse(1.2*gzlvl2,gt2);
              elsenz(v6); zgradpulse(-1.2*gzlvl2,gt2); endif(v6);
       delay(gstab);
       if (trim_flg[A] == 'y')
           { obspower(trimpwr);
             add(v1,one,v10);
            rgpulse(trim,v10,rof1,rof2);
           }
     status(C);
}