Esempio n. 1
0
void dbox(int x,int y,int lx,int ly,int c)
{
	if (c>=0) setcolor(c);
	pbox(x,y,lx,1,-1);
	pbox(x,y+ly-1,lx,1,-1);
	pbox(x,y,1,ly,-1);
	pbox(x+lx-1,y,1,ly,-1);
}
Esempio n. 2
0
void cls(void)
{
	int t;

	xcur=ycur=0;
	t=nocolor;
	pbox(0,0,WIDTH,HEIGHT,0);
	setcolor(t);
}
Esempio n. 3
0
int initsystem(void)
{
#ifdef NOSYSCURSOR
	int i,j;
#endif

	setpalette(oldpal);

#ifdef NOSYSCURSOR
	SetCursor(invisible_cursor);
#else
	SetCursor(visible_cursor);
#endif

#ifdef NOSYSCURSOR
	pbox(0,0,16,16,FOND);
	pbox(16,0,16,16,FOND);
	for(i=0;i<16;i++)
		for(j=0;j<16;j++)
			switch(defaultmouse[i*16+j])
			{
				case 0x0001:
					plot(j,i,0);
                                        plot(j+16,i,MASK);
					break;
				case 0xffff:
					plot(j,i,SYSTEM_CURSOR_COLOR);
					plot(j+16,i,MASK);
                                        break;
                        }

	initbloc(&cursorbob);
	getbloc(&cursorbob,0,0,16,16);
	getmask(&cursorbob,16,0);          
	initbloc(&cursorbak);
	getbloc(&cursorbak,0,0,16,16);

	cls();
#endif
	setcolor(15);

	return 1;
}
Esempio n. 4
0
void BOX::popmsg(int x, int y, const string &msg, const string &st, const string &sf) const
{
    int w=(msg.size()%2==0)?msg.size()+4:msg.size()+5;
    int h=3;
    if(x==0) x=(80-w)/2; if(x%2==0) ++x;
    if(y==0) y=(25-3)/2;
    BOX pbox(x, y, w, h, color, bgcolor, st, sf);
    pbox.get_background();
    pbox.textbox(msg);
    getch();
    pbox.put_background();
}
Esempio n. 5
0
char BOX::popinput(int x, int y, const string &msg, const string &st, const string &sf)
{
    int w=(msg.size()%2==0)?msg.size()+6:msg.size()+7;
    int h=3;
    if(x==0) x=(80-w)/2; if(x%2==0) ++x;
    if(y==0) y=(25-3)/2;
    BOX pbox(x, y, w, h, color, bgcolor, st, sf);
    pbox.get_background();
    pbox.textbox(msg);
    char ch=getche();
    pbox.put_background();
    return ch;
}
Esempio n. 6
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            C_flg[MAXSTR],
            dtt_flg[MAXSTR];

 int         phase, phase2, ni, ni2, 
             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/4JHC =  1.6 ms */
             taub,         /*    1/6JCH =   1.1 ms  */
             BigTC,        /* Carbon constant time period = 1/4Jcc = 7.0 ms */ 
             BigTC1,       /* Carbon constant time period2 < 1/4Jcc to account for relaxation */ 
             pwN,          /* PW90 for 15N pulse @ pwNlvl           */
             pwC,          /* PW90 for c nucleus @ pwClvl         */
             pwcrb180,      /* PW180 for C 180 reburp @ rfrb */
             pwClvl,        /* power level for 13C pulses on dec1  */
             compC, compH,  /* compression factors for H1 and C13 amps */
	     rfrb,       /* power level for 13C reburp pulse     */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             tofps,        /* tof for presat                       */ 

	     gt0,
             gt1,
             gt2,
             gt3,
             gt4,

             gstab,
             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
        
             decstep1,
             bw, ofs, ppm,

             pwd1,
             dpwr3_D,
             pwd,
             tpwrs,
             pwHs, 
             dof_me,
             
             tof_dtt,
             tpwrs1,
             pwHs1,

             dpwrsed,
             pwsed,
             dressed,
              
             rfrb_cg,
             pwrb_cg; 
             
   
/* LOAD VARIABLES */

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

  getstr("C_flg",C_flg);
  getstr("dtt_flg",dtt_flg); 

  tofps  = getval("tofps");
  taua   = getval("taua"); 
  taub   = getval("taub"); 
  BigTC  = getval("BigTC");
  BigTC1 = getval("BigTC1");
  pwC = getval("pwC");
  pwcrb180 = getval("pwcrb180");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  pwClvl = getval("pwClvl");
  compC = getval("compC");
  compH = getval("compH");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni = getval("ni");
  ni2 = getval("ni2");

  gt0 = getval("gt0");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
 
  gstab = getval("gstab");
  gzlvl0 = getval("gzlvl0");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
 
  decstep1 = getval("decstep1");

  pwd1 = getval("pwd1");
  dpwr3_D = getval("dpwr3_D");
  pwd = getval("pwd");
  pwHs = getval("pwHs");
  dof_me = getval("dof_me");

  pwHs1 = pwHs; 
  tpwrs=-16.0; tpwrs1=tpwrs;
  tof_dtt = getval("tof_dtt");

  dpwrsed = -16;
  pwsed = 1000.0;
  dressed = 90.0;
  pwrb_cg = 0.0;  
  setautocal();                      /* activate auto-calibration */   

  if(FIRST_FID)                                         /* make shapes */
  {
    ppm = getval("dfrq"); 
    bw = 80.0*ppm;  
    rb180 = pbox_make("rb180P", "reburp", bw, 0.0, compC*pwC, pwClvl);
    bw = 8.125*ppm;  ofs = -24.0*ppm;
    rb180_cg = pbox_make("rb180_cgP", "reburp", bw, ofs, compC*pwC, pwClvl);
    bw = 20.0*ppm;  ofs = 136.0*ppm;
    cosed = pbox("COsedP", CODEC, CODECps, dfrq, compC*pwC, pwClvl);
    if(taua < (gt4+106e-6+pwHs)) printf("gt4 or pwHs may be too long! ");
    if(taub < rb180_cg.pw) printf("rb180_cgP pulse may be too long! ");
  }
  pwcrb180 = rb180.pw;   rfrb = rb180.pwrf;             /* set up parameters */
  pwrb_cg = rb180_cg.pw; rfrb_cg = rb180_cg.pwrf;       /* set up parameters */
  tpwrs = tpwr - 20.0*log10(pwHs/((compH*pw)*1.69));    /* sinc=1.69xrect */
  tpwrs = (int) (tpwrs); tpwrs1=tpwrs;              
  dpwrsed = cosed.pwr; pwsed = 1.0/cosed.dmf; dressed = cosed.dres;

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( BigTC - 0.5*(ni2-1)*1/(sw2) - WFG_STOP_DELAY - POWER_DELAY 
              - 4.0e-6
              < 0.2e-6 )
    {
        printf(" ni2 is too big\n");
        psg_abort(1);
    }


    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' || dm2[D] == 'y'))
    {
        printf("incorrect dec2 decoupler flags! Should be 'nnnn' ");
        psg_abort(1);
    }

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

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

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

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

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

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

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

    if(dpwr3 > 51)
    {
       printf("dpwr3 is too high; < 52\n");
       psg_abort(1);
    }

    if(dpwr3_D > 49)
    {
       printf("dpwr3_D is too high; < 50\n");
       psg_abort(1);
    }

   if(d1 < 1)
    {
       printf("d1 must be > 1\n");
       psg_abort(1);
    }

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

    if(  gt0 > 5.0e-3 || gt1 > 5.0e-3  || gt2 > 5.0e-3 ||
         gt3 > 5.0e-3 || gt4 > 5.0e-3  )
    {  printf(" all values of gti must be < 5.0e-3\n");
        psg_abort(1);
    }

   if(ix==1) {
     printf("make sure that BigTC1 is set properly for your application\n");
     printf("7 ms, neglecting relaxation \n");
   }

/*  Phase incrementation for hypercomplex 2D data */

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

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

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    tau1 = tau1 - 2.0*pw - 4.0/PI*pwC - POWER_DELAY - 2.0e-6 - PRG_START_DELAY
           - PRG_STOP_DELAY - POWER_DELAY - 2.0e-6;

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

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) ); 
        if(tau2 < 0.4e-6) tau2 = 4.0e-7;
    }
        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(t9,2,4);    
    }

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(satpwr);      /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 to low power       */

/* Presaturation Period */

status(B);
   if (fsat[0] == 'y')
   {
        obsoffset(tofps);
	delay(2.0e-5);
        rgpulse(d1,zero,2.0e-6,2.0e-6);  /* presat with transmitter */
   	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.0*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 */
   obsoffset(tof);
   txphase(t1);
   decphase(zero);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(C);

   decoffset(dof_me);

   lk_hold();

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

/* ensure that magnetization originates on 1H and not 13C */

   if(dtt_flg[A] == 'y') {
     obsoffset(tof_dtt);
     obspower(tpwrs1);
     shaped_pulse("H2Osinc",pwHs1,zero,10.0e-6,0.0);
     obspower(tpwr);

     obsoffset(tof); 
   }
 
   decrgpulse(pwC,zero,0.0,0.0);
 
   zgradpulse(gzlvl0,gt0);
   delay(gstab);

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

   zgradpulse(gzlvl1,gt1);
   delay(gstab);

   delay(taua - gt1 -gstab); 

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

   delay(taua - gt1 - gstab); 
   	
   zgradpulse(gzlvl1,gt1);
   delay(gstab);


   rgpulse(pw,one,0.0,0.0);

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,zero,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   decoffset(dof);  /* jump 13C to 40 ppm */

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

   decrgpulse(pwC,t1,4.0e-6,0.0); decphase(zero); 

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

   decpwrf(rfrb);
   delay(BigTC - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t2);

   decpwrf(4095.0);
   delay(BigTC - WFG_STOP_DELAY - POWER_DELAY);

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

   /* turn on 2H decoupling */
   dec3phase(one);
   dec3power(dpwr3); 
   dec3rgpulse(pwd1,one,4.0e-6,0.0); 
   dec3phase(zero);
   dec3unblank();
   dec3power(dpwr3_D);
   dec3prgon(dseq3,pwd,dres3);
   dec3on();
   /* turn on 2H decoupling */

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

   decpwrf(rfrb);

   delay(BigTC1 - POWER_DELAY - 4.0e-6 - pwd1
         - POWER_DELAY - PRG_START_DELAY - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t3);

   decpwrf(4095.0);
   delay(BigTC1 - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t3,0.0,0.0);
   decpwrf(rfrb_cg); decphase(zero);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - POWER_DELAY - WFG_START_DELAY);
   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(rfrb);
   
   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - POWER_DELAY - SAPS_DELAY
         - 2.0e-6 - WFG_START_DELAY);

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

   decshaped_pulse(rb180.name,pwcrb180,zero,2.0e-6,0.0);
   dcplrphase(zero);

   decpwrf(rfrb_cg); decphase(zero);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - SAPS_DELAY 
                  - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(4095.0); decphase(t4);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t4,0.0,0.0);

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

   decpower(dpwrsed); decunblank(); decphase(zero); delay(2.0e-6);
   decprgon(cosed.name,pwsed,dressed);
   decon();
  
   delay(tau1);
   rgpulse(2.0*pw,zero,0.0,0.0);
   delay(tau1);

   decoff();
   decprgoff();
   decblank();
   decpower(pwClvl);
   }

   else 
    simpulse(2.0*pw,2.0*pwC,zero,zero,4.0e-6,4.0e-6);

   decrgpulse(pwC,t5,2.0e-6,0.0);
   decpwrf(rfrb_cg); decphase(zero);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - POWER_DELAY - WFG_START_DELAY);
   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(rfrb);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - POWER_DELAY - SAPS_DELAY
         - 2.0e-6 - WFG_START_DELAY);

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

   decshaped_pulse(rb180.name,pwcrb180,zero,2.0e-6,0.0);
   dcplrphase(zero);

   decpwrf(rfrb_cg); decphase(zero);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - SAPS_DELAY 
                  - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180_cg.name,pwrb_cg,zero,0.0,0.0);
   decpwrf(4095.0); decphase(t6);

   if(taub > pwrb_cg)
     delay(taub/2.0 - pwrb_cg/2.0 - WFG_STOP_DELAY - POWER_DELAY);

   decrgpulse(pwC,t6,0.0,0.0);
   decphase(zero);

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

   decpwrf(rfrb);
   delay(BigTC1 - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t7);

   decpwrf(4095.0);
   delay(BigTC1 - WFG_STOP_DELAY - POWER_DELAY
          - PRG_STOP_DELAY - POWER_DELAY - 4.0e-6 - pwd1);

   /* 2H decoupling off */
   dec3off();
   dec3prgoff();
   dec3blank();
   dec3power(dpwr3);
   dec3rgpulse(pwd1,three,4.0e-6,0.0);
   /* 2H decoupling off */

   decrgpulse(pwC,t7,0.0,0.0);
   decphase(zero);

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

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

   decpwrf(rfrb);
   delay(BigTC - 2.0*pw - POWER_DELAY - WFG_START_DELAY);

   decshaped_pulse(rb180.name,pwcrb180,zero,0.0,0.0);
   dcplrphase(zero);
   decphase(t8);
   decpwrf(4095.0);

   delay(BigTC - tau2 - WFG_STOP_DELAY - POWER_DELAY - 4.0e-6);

   decrgpulse(pwC,t8,4.0e-6,0.0);


   decoffset(dof_me);

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

   lk_sample();

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,two,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

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

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

   delay(taua - gt4 -gstab 
         - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
         - pwHs - WFG_STOP_DELAY - POWER_DELAY - 2.0e-6);

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,two,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

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

   /* shaped_pulse */
   obspower(tpwrs);
   shaped_pulse("H2Osinc",pwHs,two,2.0e-6,0.0);
   obspower(tpwr);
   /* shaped_pulse */

   zgradpulse(gzlvl4,gt4);
   delay(gstab);
 
   delay(taua - POWER_DELAY - WFG_START_DELAY
         - pwHs - WFG_STOP_DELAY - POWER_DELAY 
         - gt4 - gstab - 2.0*POWER_DELAY);

   decpower(dpwr);  /* Set power for decoupling */
   dec2power(dpwr2);

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

/* BEGIN ACQUISITION */

status(D);
   setreceiver(t9);

}
Esempio n. 7
0
void EditView::DrawView( Box const& viewbox, Box* affectedview )
{
    // note: viewbox can be outside the project boundary

//    Colour checkerboard[2] = { Colour(192,192,192), Colour(224,224,224) }; 

    Box vb(viewbox);
    vb.ClipAgainst(m_ViewBox);

    Img const& img = Proj().GetAnim().GetFrame(Frame());
    // get project bounds in view coords (unclipped)
    Box pbox(ProjToView(img.Bounds()));

    // step x,y through view coords of the area to draw
    int y;
//    int xmin = std::min(pbox.XMin(), vb.XMax()+1);
    int xbegin = std::min(pbox.x, vb.x + vb.w);
    int xend = std::min(pbox.x + pbox.w, vb.x + vb.w);
    for(y=vb.YMin(); y<=vb.YMax(); ++y) {
        RGBX8* dest = m_Canvas->Ptr_RGBX8(vb.x,y);
        int x=vb.XMin();

        // scanline intersects canvas?
        if(y<pbox.YMin() || y>pbox.YMax()) {
            // line is above or below the project
            while(x<=vb.XMax()) {
                *dest++ = checker2(x,y);
                ++x;
            }
            continue;
        }

        // left of project canvas
        while(x<xbegin) {
            *dest++ = checker2(x,y);
            ++x;
        }

        if(x<xend) {
            // on the project canvas
            Point p( ViewToProj(Point(x,y)) );
            switch( img.Fmt() ) {

            case FMT_I8:
                {
                    /*
                    if( p.x<0) {
                        printf("POOP:\n");
                        printf("pbox: %d %d %d %d\n", pbox.x, pbox.y, pbox.w, pbox.h);
                        printf("vb  : %d %d %d %d\n", vb.x, vb.y, vb.w, vb.h);
                        printf("x,y : %d %d\n", x,y);
                        printf("p.x,p.y : %d %d\n", p.x,p.y);
                        printf("xbegin,xend : %d %d\n", xbegin,xend);
                    }
                    assert( p.x >=0);
                    assert( p.x < img.W());
                    assert( p.y < img.H());
                    assert( p.y >=0);
                    */
                    //printf("%d\n",y);
                    I8 const* src = img.PtrConst_I8( p.x,p.y );
                    while(x<xend) {
                        int cx = x + (m_Offset.x*m_XZoom);
                        int pixstop = x + (m_XZoom-(cx%m_XZoom));
                        if(pixstop>xend)
                            pixstop=xend;
                        RGBA8 c = Proj().PaletteConst().GetColour(*src++);
                        while(x<pixstop)
                        {
                            //*dest++ = c;
                            *dest++ = Blend(c,checker(x,y));
                            ++x;
                        }
                    }
                }
                break;
            case FMT_RGBX8:
                {
                    RGBX8 const* src = img.PtrConst_RGBX8( p.x,p.y );
                    while(x<xend) {
                        int cx = x + (m_Offset.x*m_XZoom);
                        int pixstop = x + (m_XZoom-(cx%m_XZoom));
                        if(pixstop>xend)
                            pixstop=xend;
                        RGBX8 c = *src++;
                        while(x<pixstop) {
                            *dest++ = c;
                            ++x;
                        }
                    }
                }
                break;
            case FMT_RGBA8:
                {
                    RGBA8 const* src = img.PtrConst_RGBA8( p.x,p.y );
                    while(x<xend) {
                        int cx = x + (m_Offset.x*m_XZoom);
                        int pixstop = x + (m_XZoom-(cx%m_XZoom));
                        if(pixstop>xend)
                            pixstop=xend;
                        RGBA8 c = *src++;
                        while(x<pixstop) {
                            *dest++ = Blend(c,checker(x,y));
                            ++x;
                        }
                    }
                }
                break;
            default:
                assert(false);
                break;
            }
        }
        // right of canvas
        while(x < vb.x+vb.w)
        {
            *dest++ = checker2(x,y);
            ++x;
        }
    }

    if(affectedview)
        *affectedview = vb;
}
pulsesequence()
{
/* DECLARE VARIABLES */

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

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

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

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

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

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

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

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

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


/* LOAD VARIABLES */


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

  getstr("sel_flg",sel_flg);

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

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

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

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

    getstr("cbdecseq", cbdecseq);

/* LOAD PHASE TABLE */

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

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


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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */


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

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


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

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

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

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

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

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


/* PHASES AND INCREMENTED TIMES */


   /* Set up angles and phases */

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

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

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

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

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

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

/* Set up hyper complex */

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

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

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

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

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

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


/* CHECK VALIDITY OF PARAMETER RANGES */

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


/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  }

  else {

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

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

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

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

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

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

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

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

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

   }

   dec2phase(zero); decphase(t1);

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

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

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

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

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

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

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

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

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

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

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

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

      decoff();
      decprgoff();

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

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

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

      decoff();
      decprgoff();

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

     decpower(pwClvl);

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

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


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

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

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

   txphase(zero);
   dec2phase(t4);

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

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

   delay(tau3);

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

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


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

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

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

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

   delay(taub - gt6 - gstab);

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

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

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

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

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

   delay(taub - gt7 - gstab);

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

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

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

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

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

lk_sample();

status(C);
         setreceiver(t6);

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

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            mess_flg[MAXSTR], /* water purging */
            ar180a[MAXSTR],   /* waveform shape for aromatic 180 pulse 
                                   with C transmitter at dof  */
            cb180b[MAXSTR],   /* waveform shape for aliphatic 180 pulse 
                                   with C transmitter at dofar   */
            ar180b[MAXSTR];   /* waveform shape for aromatic 180 pulse
                                   with C transmitter at dofar   */
 int         phase, ni, 
             t1_counter;   /* used for states tppi in t1           */ 

 double      tau1,         /*  t1 delay */
             taua,         /*  ~ 1/4JCbHb =  1.7 ms */
             taub,         /*  ~ 1/4JCgCd =  2.7 ms */
             tauc,         /*  ~ 1/4JCgCd =  2.1 ms */
             taud,         /*  ~ 1/4JCdHd =  1.5 ms */
             taue,         /*  = 1/4JCbHb =  1.8 ms */
             tauf,         /*  2(tauc-tauf) ~ 1/2JCdHd =  3.1 ms */
             TCb,          /* carbon constant time period 
                              for recording the Cb chemical shifts    */
             dly_pg1,      /* delay for water purging */
             pwar180a,     /* 180 aro pulse at d_ar180a and dof  */
             pwcb180b,     /* 180 cb pulse at d_cb180b and dofar   */ 
             pwC,          /* 90 c pulse at pwClvl            */
             pwsel90,       /* 90 c pulse at d_sel90 */
             pwar180b,     /* 180 c pulse at d_ar180b */
             compC,        /* C-13 RF calibration parameters */
             compH,
             d_ar180a,
             d_cb180b,
             d_sel90,
             d_ar180b,     
             dofar, 
             tsatpwr,      /* low level 1H trans.power for presat  */
             tpwrmess,     /* power level for water purging */
             tpwrml,       /* power level for 1H decoupling */
             pwmlev,       /* 90 pulse at tpwrml */
             pwClvl,        /* power level for high power 13C pulses on dec1 */ 
             sw1,          /* sweep width in f1                    */
             at,
             gp11,         /* gap between 90-90 for selective 180 of Cb */
             fab,          /* chemical shift difference of Ca-Cb (Hz) */
             gt0,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gstab,
             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7;


/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */


  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("fscuba",fscuba);
  getstr("mess_flg",mess_flg);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  tauc   = getval("tauc"); 
  taud   = getval("taud"); 
  taue   = getval("taue"); 
  tauf   = getval("tauf"); 
  TCb = getval("TCb");
  pwC = getval("pwC");
  dofar = getval("dofar");
  dly_pg1 = getval("dly_pg1");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  tpwrmess = getval("tpwrmess");
  tpwrml = getval("tpwrml");
  pwClvl = getval("pwClvl");
  dpwr = getval("dpwr");
  phase = (int) ( getval("phase") + 0.5);
  sw1 = getval("sw1");
  ni = getval("ni");
  at = getval("at");
  fab = getval("fab");

  if(autocal[0]=='n')
  {     
    getstr("ar180a",ar180a);
    getstr("ar180b",ar180b);
    getstr("cb180b",cb180b);
    pwar180a = getval("pwar180a");
    pwar180b = getval("pwar180b");
    pwcb180b = getval("pwcb180b");
    pwsel90 = getval("pwsel90");
    d_ar180a = getval("d_ar180a");
    d_cb180b = getval("d_cb180b");
    d_ar180b  = getval("d_ar180b");
    d_sel90  = getval("d_sel90");
    pwmlev = getval("pwmlev");
  }
  else
  {    
    strcpy(ar180a,"Pg3_off_cb180a");
    strcpy(ar180b,"Pg3_off_cb180b");    
    strcpy(cb180b,"Pg3_on");
    if (FIRST_FID)
    {
      compC = getval("compC");
      compH = getval("compH");
      sel90 = pbox("cal", SEL90, "", dfrq, compC*pwC, pwClvl);
      ar_180a = pbox(ar180a, AR180a, CB180ps, dfrq, compC*pwC, pwClvl);
      ar_180b = pbox(ar180b, AR180b, CB180ps, dfrq, compC*pwC, pwClvl);
      cb_180b = pbox(cb180b, CB180b, CB180ps, dfrq, compC*pwC, pwClvl);
      w16 = pbox_dec("cal", "WALTZ16", tpwrml, sfrq, compH*pw, tpwr);
    }
    pwsel90 = sel90.pw;      d_sel90 = sel90.pwr;
    pwar180a = ar_180a.pw;   d_ar180a = ar_180a.pwr;
    pwar180b = ar_180b.pw;   d_ar180b = ar_180b.pwr;       
    pwcb180b = cb_180b.pw;   d_cb180b = cb_180b.pwr;  
    pwmlev = 1.0/w16.dmf;
  }   

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

  gzlvl0 = getval("gzlvl0");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( 0.5*ni*1/(sw1) > TCb - 2*POWER_DELAY 
        - WFG_START_DELAY - pwar180a  - WFG_STOP_DELAY)
    {
        printf(" ni is too big\n");
        psg_abort(1);
    }

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

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

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

    if( tpwrml > 53 )
    {
        printf("tpwrml too large !!!  ");
        psg_abort(1);
    }

    if( tpwrmess > 56 )
    {
        printf("tpwrmess too large !!!  ");
        psg_abort(1);
    }

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

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

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

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

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

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

    if (pwar180b > 500.0e-6)
    {
        printf("dont fry the probe, pwar180b too long !");
        psg_abort(1);
    }

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

    if(d_ar180a > 60)
    {
        printf("dont fry the probe, d_ar180a too high !");
        psg_abort(1);
    }

    if(d_cb180b > 60)
    {
        printf("dont fry the probe, d_cb180b too high !");
        psg_abort(1);
    }

    if (d_ar180b > 60)
    {
        printf("dont fry the probe, d_ar180b too high ! ");
        psg_abort(1);
    }

    if (d_sel90 > 50)
    {
        printf("dont fry the probe, d_sel90 too high ! ");
        psg_abort(1);
    }

    if( gt0 > 15e-3 || gt1 > 15e-3 || gt2 > 15e-3 || gt3 > 15e-3 
       || gt4 > 15e-3 || gt5 > 15e-3 || gt6 > 15e-3 || gt7 > 15e-3)
    {
        printf("gradients on for too long. Must be < 15e-3 \n");
        psg_abort(1);
    }

    if( fabs(gzlvl0) > 30000 || fabs(gzlvl1) > 30000 || fabs(gzlvl2) > 30000
      ||fabs(gzlvl3) > 30000 || fabs(gzlvl4) > 30000 || fabs(gzlvl5) > 30000
      ||fabs(gzlvl6) > 30000 || fabs(gzlvl7) > 30000)
    {
        printf("too strong gradient");
        psg_abort(1);
    }


    if( 2*TCb - taue > 0.1 )
    {
        printf("dont fry the probe, too long TCb");
        psg_abort(1);
    }

    if( at > 0.1 && (dm[C]=='y' || dm2[C]=='y'))
    {
        printf("dont fry the probe, too long at with decoupling");
        psg_abort(1);
    }

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

    if( dly_pg1 > 10.0e-3)
    {
        printf("dont fry the probe, too long dly_pg1");
        psg_abort(1);
    }

    


/*  Phase incrementation for hypercomplex 2D data */

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

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

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

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

/*  90-90 pulse for selective 180 of Cb but not Ca */

    gp11 = 1/(2*fab) - 4/PI*pwsel90;
    if (gp11 < 0.0) {
        printf("gap of 90-90 negative, check fab and pwsel90");
        psg_abort(1);
    }


/* BEGIN ACTUAL PULSE SEQUENCE */

/* Receiver off time */

status(A);
   decoffset(dof);
   obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(dpwr2);      /* Set Dec2 power for 15N decoupling       */

/* Presaturation Period */

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

     obspower(tpwrmess);
     rgpulse(dly_pg1,zero,20.0e-6,20.0e-6);
     rgpulse(dly_pg1/1.62,one,20.0e-6,20.0e-6);
     obspower(tsatpwr);

  }

   if (fsat[0] == 'y')
   {
	delay(2.0e-5);
        rgpulse(d1,zero,20.0e-6,20.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);
   decphase(zero);
   delay(1.0e-5);

/* Begin Pulses */

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

/* first ensure that magnetization does infact start on H and not C */

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

   delay(2.0e-6);
   zgradpulse(gzlvl0,gt0);
   delay(gstab);


/* this is the real start */

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

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

   delay(taua - gt1 - 4.0e-6);   /* taua <= 1/4JCH */                          

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

   txphase(t1);

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

   delay(taua - gt1 - 4.0e-6); 

   rgpulse(pw,t1,0.0,0.0);

   txphase(zero);

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

   decphase(t2);
   decpower(d_sel90);
   decrgpulse(pwsel90,t2,2.0e-6,0.0);

   decphase(zero);
   decpower(d_ar180a);
   decshaped_pulse(ar180a,pwar180a,zero,2.0e-6,0.0);  /* bs effect */

   delay(taue 
     - POWER_DELAY - 2.0e-6 - WFG_START_DELAY - pwar180a - WFG_STOP_DELAY
     - POWER_DELAY - PRG_START_DELAY);

   /* H decoupling on */
   obspower(tpwrml);
   obsprgon("waltz16",pwmlev,90.0);
   xmtron();    /* TURN ME OFF  DONT FORGET  */
   /* Hldecoupling on */
   
   delay(TCb + tau1 - taue - POWER_DELAY - 2.0e-6);

   decphase(t3);

   decpower(d_sel90);
   decrgpulse(pwsel90,t3,2.0e-6,0.0);
   delay(gp11);
   decrgpulse(pwsel90,t3,0.0,0.0);

   decphase(zero);
   decpower(d_ar180a);
   decshaped_pulse(ar180a,pwar180a,zero,2.0e-6,0.0); 

   delay(TCb - tau1
     - POWER_DELAY - WFG_START_DELAY - 2.0e-6 - pwar180a - WFG_STOP_DELAY
     - POWER_DELAY - 2.0e-6);
   
   decphase(zero);
   decpower(d_sel90);
   decrgpulse(pwsel90,zero,2.0e-6,0.0);

   /* H decoupling off */
   xmtroff();
   obsprgoff();
   obspower(tpwr);
   /* H decoupling off */

   decoffset(dofar);

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

   decphase(t4);
   decpower(d_sel90); 
   decrgpulse(pwsel90,t4,2.0e-6,0.0);

   decphase(zero);
   decpower(d_cb180b);
   decshaped_pulse(cb180b,pwcb180b,zero,2.0e-6,0.0);   /* B.S. */

   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(2.0e-6);
   
   delay(taub 
     - POWER_DELAY - WFG_START_DELAY - 2.0e-6 - pwcb180b - WFG_STOP_DELAY
     - gt4 - 4.0e-6
     - POWER_DELAY - WFG_START_DELAY - 2.0e-6);

   decphase(zero);
   decpower(d_ar180b);
   decshaped_pulse(ar180b,pwar180b,zero,2.0e-6,0.0);
 
   decpower(d_cb180b);
   decshaped_pulse(cb180b,pwcb180b,zero,2.0e-6,0.0);
   
   delay(2.0e-6);
   zgradpulse(gzlvl4,gt4);
   delay(2.0e-6);

   delay(taub
     - WFG_STOP_DELAY
     - POWER_DELAY - WFG_START_DELAY - 2.0e-6 - pwcb180b - WFG_STOP_DELAY
     - gt4 - 4.0e-6
     - POWER_DELAY - 2.0e-6);

   decpower(d_sel90);
   decrgpulse(pwsel90,zero,2.0e-6,0.0);

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

   decphase(t5);
   decpower(pwClvl);
   decrgpulse(2*pwC,t5,2.0e-6,0.0);

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

   txphase(zero);
   delay(tauf - gt5 - 102.0e-6);

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

   delay(tauc - tauf - 2*pw
     - POWER_DELAY - 2.0e-6);

   decphase(zero);
   decpower(d_sel90); 
   decrgpulse(pwsel90,zero,2.0e-6,0.0);

   txphase(zero);
   delay(2.0e-6);
   zgradpulse(gzlvl6,gt6);
   delay(gstab);
   
   rgpulse(pw,zero,0.0,0.0);

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

   delay(taud 
     - gt7 - 4.0e-6
     - POWER_DELAY - 2.0e-6);

   decphase(zero);
   decpower(pwClvl);
   simpulse(2*pw,2*pwC,zero,zero,2.0e-6,0.0);

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

   delay(taud 
     - gt7 - 4.0e-6
     - 2*POWER_DELAY);

   decpower(dpwr);  /* Set power for decoupling */
   dec2power(dpwr2);  /* Set power for decoupling */

   rgpulse(pw,zero,0.0,0.0);  
    
/*   rcvron();  */          /* Turn on receiver to warm up before acq */ 

/* BEGIN ACQUISITION */

status(C);
setreceiver(t6);

}
Esempio n. 10
0
void p_grafik(void)
	{
	deftext( 1,24,0,32);
	text( 174,200,-1,"4. DEMO: GRAFIK");
	p_s_top();
	printf("\33E");
	deftext( -1,1,0,13);
	for(h_long=1;h_long<=2;h_long++)
		{
		for(j_long=4;j_long<=24 ;j_long+= 4)
			{
			for(i_long=0;i_long<=5;i_long++)
				{
				deftext( -1,pow(2,i_long),-1,-1);
				text( 320,50+i_long*(16+j_long*2),-1,"B_NACH_C");
				}
			pause( 10);
			printf("\33E");
			deftext( -1,-1,-1,j_long);
			}
		deftext( -1,-1,h_long*1800,-1);
		}
	deftext( -1,1,-1,13);
	for(h_long=1;h_long<=4;h_long++)
		{
		for(i_long=2;i_long<=3;i_long++)
			{
			for(j_long=0;j_long<=2;j_long++)
				{
				defline( h_long,i_long,j_long,j_long);
				draw(100+50*j_long,50+25*j_long , 539-50*j_long,50+25*j_long);
				box( 50+50*j_long,150,320-50*j_long,350);
				circle( 480,250,20+40*j_long);
				}
			pause( 10);
			printf("\33E");
			}
		}
	defline( 1,2,1,1);
	deffill( 1,1,1);
	for(i_long=2;i_long<=3;i_long++)
		{
		for(j_long=1;j_long<=20;j_long++)
			{
			deffill( 1,i_long,j_long);
			pbox( 16*j_long-16,10,655-16*j_long,190);
			pcircle( 160,299,105-5*j_long);
			pellipse( 480,299,5*j_long,105-5*j_long);
			}
		if(j_long>20 &  i_long==2)
			{
			bild_char = sget(bild_char);
			}
		}
	pause( 50);
	s_adr_long=(long)(bild_char);
	d_adr_long=xbios(2);
	for(i_long=1;i_long<=1000;i_long++)
		{
		rc_copy(s_adr_long,(int)((double)rand()*(10)/32767)*64,(int)((double)rand()*(10)/32767)*40,64,40 ,d_adr_long,(int)((double)rand()*(10)/32767)*64,(int)((double)rand()*(10)/32767)*40,
	-1);
		}
	pause( 100);
	printf("\33E");
	sput( bild_char);
	deffill( 1,1,1);
Esempio n. 11
0
void 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             */
            mess_flg[MAXSTR], /* water purging */
            c180_flg[MAXSTR],
            spco90a[MAXSTR],
            spco180a[MAXSTR],
            spco90b[MAXSTR],
            spco180b[MAXSTR];

 int         phase, phase2, ni, 
             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/4JCH =  1.7 ms */
             tauc1,         /* ca/cb refocus and ca/c' defocus = 4.5 ms */
             tauc2,         /* ca/cb stay and ca/c' refocus = 2.7 ms */
             taud,         /* ca-ha refocus; 1.8 ms   */
             BigTC,        /* carbon constant time period */
             dly_pg1,      /* delay for water purging */
             pwN,          /* PW90 for 15N pulse              */
             pwca90a,       /* PW90 for ca nucleus @ pwClvl         */
             pwca180a,      /* PW180 for ca at dvhpwra               */
             pwco180a,      /* PW180 for c' using seduce shape  */
             pwca90b,       /* PW90 for ca nucleus @ dhpwrb         */
             pwca180b,      /* PW180 for ca nucleus @ dvhpwrb         */
             pwco180b,      /* PW180 for c' using rectang. pulse     */
             pwco90b,      /* PW90 for co nucleus @ dhpwrb         */
             tsatpwr,      /* low level 1H trans.power for presat  */
             tpwrml,       /* power level for h decoupling  */
             tpwrmess,     /* power level for water purging */
             pwmlev,       /* h 90 pulse at tpwrml            */
             pwClvl,        /* power level for 13C pulses on dec1  
                              90 for part a of the sequence at 43 ppm */
             dvhpwra,        /* power level for 180 13C pulses at 43 ppm */
             dpwr_coa,      /* power level for C' 180 pulses at 43 ppm */
             dhpwrb,        /* power level for 13C pulses on dec1 - 54 ppm
                               90  for part b of the sequence */
             dvhpwrb,        /* power level for 13C pulses on dec1 - 54 ppm
                               180 for part b of the sequence     */
             pwNlvl,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             dofcacb,      /* dof for dipsi part, 43  ppm            */      
             cln_dly,    /* so that get rid of crap from hb etc with
                              zero tocsy transfer   */
             sphase,
             pwC, compC,      /* C-13 RF calibration parameters */
             compH,
             waltzB1,gstab,
             ni2=getval("ni2"),
             gt0,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gzlvl0,
             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7;


/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */

  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("fscuba",fscuba);
  getstr("mess_flg",mess_flg);
  getstr("c180_flg",c180_flg);

  taua   = getval("taua"); 
  tauc1   = getval("tauc1"); 
  tauc2   = getval("tauc2"); 
  taud   = getval("taud"); 
  BigTC  = getval("BigTC");
  dly_pg1 = getval("dly_pg1");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  tpwrml  = getval("tpwrml");
  tpwrmess = getval("tpwrmess");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  dofcacb = getval("dofcacb");
  cln_dly = getval("cln_dly");
  ni = getval("ni");

  sphase = getval("sphase");

  gt0 = getval("gt0");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  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");

  if(autocal[0]=='n')
  {     
    getstr("spco90a",spco90a);
    getstr("spco180a",spco180a);
    getstr("spco90b",spco90b);
    getstr("spco180b",spco180b);
    pwmlev = getval("pwmlev");
    pwca90a = getval("pwca90a");
    pwca180a = getval("pwca180a");
    pwco180a = getval("pwco180a");
    pwca90b = getval("pwca90b");
    pwca180b = getval("pwca180b");
    pwco90b = getval("pwco90b");
    pwco180b = getval("pwco180b"); 
    pwClvl = getval("pwClvl");
    dvhpwra = getval("dvhpwra");
    dpwr_coa = getval("dpwr_coa"); 
    dhpwrb = getval("dhpwrb");
    dvhpwrb = getval("dvhpwrb");
  }
  else
  {
    waltzB1=getval("waltzB1");
    pwmlev=1/(4.0*waltzB1);
    compH = getval("compH");
    tpwrml= tpwr - 20.0*log10(pwmlev/(compH*pw));
    tpwrml= (int) (tpwrml + 0.5);
    strcpy(spco90a,"Psed180_133p");
    strcpy(spco180a,"Psed180_133p");
    strcpy(spco90b,"Phard90co_118p");
    strcpy(spco180b,"Phard180co_118p");
    if (FIRST_FID)
    {
      pwC = getval("pwC");
      pwClvl = getval("pwClvl");
      compC = getval("compC");
      ca90 = pbox("cal", CA90, "", dfrq, compC*pwC, pwClvl);
      ca180 = pbox("cal", CA180, "", dfrq, compC*pwC, pwClvl);      
      co180 = pbox(spco180a, CO180, CO180ps, dfrq, compC*pwC, pwClvl);
      ca90b = pbox("cal", CA90b, "", dfrq, compC*pwC, pwClvl);
      ca180b = pbox("cal", CA180b, "", dfrq, compC*pwC, pwClvl);          
      co90b = pbox(spco90b, CO90b, CA180ps, dfrq, compC*pwC, pwClvl);
      co180b = pbox(spco180b, CO180b, CA180ps, dfrq, compC*pwC, pwClvl);
      w16 = pbox_dec("cal", "WALTZ16", tpwrml, sfrq, compH*pw, tpwr);
    }
    pwca90a = ca90.pw;       pwClvl = ca90.pwr;    
    pwca180a = ca180.pw;     dvhpwra = ca180.pwr;
    pwco180a = co180.pw;     dpwr_coa = co180.pwr;
    pwco90b = co90b.pw;      dhpwrb = co90b.pwr;
    pwco180b = co180b.pw;    
    pwca90b = ca90b.pw;          
    pwca180b = ca180b.pw;    dvhpwrb = ca180b.pwr;    
    pwmlev = 1.0/w16.dmf;
  }   

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( ni*1/(sw1) > 2.0*BigTC )
    {
        printf(" ni is too big\n");
        psg_abort(1);
    }

    if((c180_flg[A] == 'y') && (ni2>1))
    {
        printf("set c180_flg=n for C=O evolution");
        psg_abort(1);
    }

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

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

    if( pwmlev < 30.0e-6 ) 
    {
        printf("too much power during proton mlev sequence\n");
        psg_abort(1);
     }

    if( tpwrml > 53 )
     {
        printf("tpwrml is too high\n");
        psg_abort(1);
     }

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

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

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

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

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

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

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

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

    if( gt0 > 15e-3 || gt1 > 15e-3 || gt2 > 15e-3 || gt3 > 15e-3 || gt4 > 15e-3 || gt5 > 15e-3 || gt6 > 15e-3 || gt7 > 15e-3 )
    {
        printf("gradients on for too long. Must be < 15e-3 \n");
        psg_abort(1);
    }


/*  Phase incrementation for hypercomplex 2D data */

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

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

/*  Set up f2180  tau2 = t2               */

    tau2 = d3;
    if(f2180[A] == 'y') {
        tau2 += ( 1.0 / (2.0*sw2) - pwca180b - 2.0*pwN - (4.0/PI)*pwco90b - 2*POWER_DELAY - WFG_START_DELAY - WFG_STOP_DELAY - 2.0e-6 ); 
        if(tau2 < 0.2e-6) tau2 = 0.0;
    }
        tau2 = tau2/2.0;

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

/* Receiver off time */

status(A);
   decoffset(dofcacb);       /* initially pulse at 43 ppm */
   obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(pwNlvl);      /* Set Dec2 power for 15N hard pulses         */

/* Presaturation Period */
   if (fsat[0] == 'y')
   {
	delay(2.0e-5);
        rgpulse(d1,zero,2.0e-6,2.0e-6);
   	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);

/* first ensure that magnetization does infact start on H and not C */

   decrgpulse(pwca90a,zero,2.0e-6,2.0e-6);

   delay(2.0e-6);
   zgradpulse(gzlvl0,gt0);
   delay(gstab);

/* this is the real start */

   rgpulse(pw,zero,0.0,0.0);                    /* 90 deg 1H pulse */
   decphase(t1);
   decpower(dvhpwra);
 
   delay(2.0e-6);
   zgradpulse(gzlvl1,gt1);
   delay(2.0e-6);

   delay(taua - POWER_DELAY - gt1 - 4.0e-6);   /* taua <= 1/4JCH */                          
   simpulse(2*pw,pwca180a,zero,t1,0.0,0.0);

   decpower(pwClvl);
   txphase(t2); decphase(t3);

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

   delay(taua - POWER_DELAY - gt1 - 4.0e-6); 

   rgpulse(pw,t2,0.0,0.0);

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

   decrgpulse(pwca90a,t3,0.0,2.0e-6);

   delay(tau1);

   decpower(dpwr_coa);
   decshaped_pulse(spco180a,pwco180a,zero,2.0e-6,0.0);

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

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

   decpower(dvhpwra);

   delay(0.8e-3 - gt7 - 4.0e-6 - 2*POWER_DELAY);
   delay(0.2e-6);
     
   rgpulse(2*pw,zero,0.0,0.0);

   decphase(t4);
   delay(BigTC - 0.8e-3);

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

   decrgpulse(pwca180a,t4,2.0e-6,2.0e-6);
   dcplrphase(zero);

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

   delay(BigTC - tau1 + 2*pwN + 2*pw - 2.0*POWER_DELAY - gt7 - 4.0e-6);
   delay(0.2e-6);

   decpower(dpwr_coa);
   decshaped_pulse(spco180a,pwco180a,zero,2.0e-6,0.0); /* bloch seigert */
   decpower(pwClvl);

   decrgpulse(pwca90a,t9,2.0e-6,0.0);

   /* H decoupling on */
   obspower(tpwrml);
   obsprgon("waltz16",pwmlev,90.0);
   xmtron();    /* TURN ME OFF  DONT FORGET  */
   /* H decoupling on */

   decpower(dpwr_coa);
   decshaped_pulse(spco180a,pwco180a,zero,2.0e-6,0.0);   /* bloch seigert */
   decpower(pwClvl);
   delay(tauc1 - 4.0*POWER_DELAY - PRG_START_DELAY - 2.0e-6);

   decpower(dvhpwra);
   decrgpulse(pwca180a,t5,2.0e-6,0.0);
   decpower(dpwr_coa);
   decshaped_pulse(spco180a,pwco180a,zero,2.0e-6,0.0);
   decpower(pwClvl);
   delay(tauc1 - 2.0*POWER_DELAY - 2.0e-6);
   decrgpulse(pwca90a,t6,2.0e-6,0.0);

   delay(2.0e-6);
   decphase(t7);

     /* H decoupling off */
     xmtroff();
     obsprgoff();
     /* H decoupling off */

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

   decoffset(dof);
   hsdelay(cln_dly);
   decpower(dhpwrb);

     /* H decoupling on */
     obspower(tpwrml);
     obsprgon("waltz16",pwmlev,90.0);
     xmtron();    /* TURN ME OFF  DONT FORGET  */
     /* H decoupling on */

   delay(2.0e-6);

   decshaped_pulse(spco90b,pwco90b,t7,0.0,0.0);

   delay(tau2);
  
   if(c180_flg[A] == 'y') {
       delay(4.0e-6);
       decshaped_pulse(spco180b,pwco180b,zero,0.0,0.0);
       delay(4.0e-6);
   }
   else
   {
       decpower(dvhpwrb);
       decrgpulse(pwca180b,zero,2.0e-6,0.0);
       decpower(dhpwrb);
      
       dec2rgpulse(2*pwN,zero,0.0,0.0);
    }

   delay(tau2);

   decshaped_pulse(spco90b,pwco90b,zero,0.0,0.0);

   delay(0.2e-6);

     /* H decoupling off */
     xmtroff();
     obsprgoff();
     /* H decoupling off */

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

     obspower(tpwrmess);
     rgpulse(dly_pg1,zero,2.0e-6,2.0e-6);
     rgpulse(dly_pg1/1.62,one,2.0e-6,2.0e-6);

  }


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

   obspower(tpwr);

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

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

  decrgpulse(pwca90b,zero,0.0,0.0);

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

  delay(taud - gt5 - 4.0e-6);

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

  delay(tauc2 - taud - POWER_DELAY - 2*pw - 2.0e-6 - 2.0e-6);

  decshaped_pulse(spco180b,pwco180b,zero,2.0e-6,0.0);   
  decpower(dvhpwrb);
  decrgpulse(pwca180b,zero,2.0e-6,0.0);
  decpower(dhpwrb);

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

  delay(tauc2 - gt5 - 6.0e-6 - POWER_DELAY); 

  decshaped_pulse(spco180b,pwco180b,zero,0.0,0.0); /* bloch seigert */   
  simpulse(pw,pwca90b,zero,zero,2.0e-6,0.0);

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

  delay(taua - POWER_DELAY - gt6 - 4.0e-6 - 2.0e-6);

  decpower(dvhpwrb);
  simpulse(2*pw,pwca180b,zero,zero,2.0e-6,0.0);

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

   delay(taua - POWER_DELAY - gt6 - 4.0e-6);

   decpower(dpwr);  /* Set power for decoupling */

   rgpulse(pw,zero,0.0,0.0);  
    
/*   rcvron();  */          /* Turn on receiver to warm up before acq */ 

/* BEGIN ACQUISITION */

status(C);
setreceiver(t8);

}
Esempio n. 12
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             */
            spco180a[MAXSTR],
            spco90b[MAXSTR],
            spco180b[MAXSTR],
            cadecseq[MAXSTR];


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

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JCH =  1.7 ms */
             tauc,         /* ~ 1/4JCAC' = 3.6 ms  */
             taud,         /* ~ 1/4JC'CA = 4.3, 4.4 ms */
             taue,         /* 1/4JC'N = 12.4 ms    */
             tauf,         /* 1/4JNH = 2.25 ms */
             BigTC,        /* carbon constant time period */
             BigTN,        /* nitrogen constant time period */
             pwn,          /* PW90 for 15N pulse              */
             pwca90a,      /* PW90 for 13C at dvhpwr    */
             pwca180a,     /* PW180 for 13C at dvhpwra  */
             pwco180a,
             pwca180b,      /* PW180 for ca nucleus @ dvhpwrb         */
             pwco180b,
             pwco90b,      /* PW90 for co nucleus @ dhpwrb         */
             tsatpwr,      /* low level 1H trans.power for presat  */
             tpwrml,       /* power level for h decoupling  */
             pwmlev,       /* h 90 pulse at tpwrml            */
             dhpwr,        /* power level for 13C pulses on dec1  
                              90 for part a of the sequence at 43 ppm */
             dvhpwra,        /* power level for 180 13C pulses at 43 ppm */
             dhpwrb,        /* power level for 13C pulses on dec1 - 54 ppm
                               90  for part b of the sequence*/
             dvhpwrb,        /* power level for 13C pulses on dec1 - 54 ppm
                               180 for part b of the sequence     */
             dhpwr2,       /* high dec2 pwr for 15N hard pulses    */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             dofcacb,      /* dof for dipsi part, 43  ppm            */      
             pwcadec,     /* seduce ca decoupling at dpwrsed        */
             dpwrsed,     /* power level for seduce ca decoupling   */
             dressed,     /* resoln for seduce decoupling  = 2      */
             dhpwrcoa,    /* power level for pwco180a, 180 shaped C'  */
             sphase1,     /* phase shift for off resonance C' 180  */
             pwN, pwNlvl,      /* N-15 RF calibration parameters */
             pwC, compC, pwClvl,      /* C-13 RF calibration parameters */
             compH,waltzB1,
             BigT1,     
             gt1,
             gt2,
             gt4,
             gt5,
             gt6,
             gt7,
             gt9,
             gt10,
             gstab,
             gzlvl1,
             gzlvl2,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl9,
             gzlvl10;
           


/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */


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

  taua   = getval("taua"); 
  tauc   = getval("tauc"); 
  taud   = getval("taud");
  taue   = getval("taue");
  tauf   = getval("tauf");
  BigTC  = getval("BigTC");
  BigTN  = getval("BigTN");
  pwN = getval("pwN");
  pwNlvl = getval("pwNlvl");
  pwn = getval("pwn");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  tpwrml  = getval("tpwrml");
  dpwr = getval("dpwr");
  dhpwr2 = getval("dhpwr2");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  dofcacb = getval("dofcacb");
  ni = getval("ni");
  ni2 = getval("ni2");
  BigT1 = getval("BigT1");
  sphase1 = getval("sphase1");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt6 = getval("gt6");
  gt7 = getval("gt7");
  gt9 = getval("gt9");
  gt10 = getval("gt10");
  gstab = getval("gstab");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl9 = getval("gzlvl9");
  gzlvl10 = getval("gzlvl10");


  if(autocal[0]=='n')
  {
    getstr("spco180a",spco180a);
    getstr("spco90b",spco90b);
    getstr("spco180b",spco180b);
    getstr("cadecseq",cadecseq);    
    pwca90a = getval("pwca90a");
    pwca180a = getval("pwca180a");
    pwco180a = getval("pwco180a");
    pwca180b = getval("pwca180b");
    pwco90b = getval("pwco90b");
    pwco180b = getval("pwco180b"); 
    dhpwr = getval("dhpwr");
    dvhpwra = getval("dvhpwra");
    dhpwrb = getval("dhpwrb");
    dvhpwrb = getval("dvhpwrb");    
    dhpwrcoa = getval("dhpwrcoa");
    dpwrsed = getval("dpwrsed"); 
    dressed = getval("dressed");
    pwcadec = getval("pwcadec");    
    pwmlev = getval("pwmlev");
  }
  else
  {
    waltzB1=getval("waltzB1");
    pwmlev=1/(4.0*waltzB1);
    compH = getval("compH");
    tpwrml= tpwr - 20.0*log10(pwmlev/(compH*pw));
    tpwrml= (int) (tpwrml + 0.5);
    strcpy(spco180a,"Psed180_133p");
    strcpy(spco90b,"Phard90co_118p");
    strcpy(spco180b,"Phard180co_118p");
    strcpy(cadecseq,"Pseduce1_lek");
    if (FIRST_FID)
    {
      pwN = getval("pwN");
      pwNlvl = getval("pwNlvl");
      pwC = getval("pwC");
      pwClvl = getval("pwClvl");
      compC = getval("compC");
      ca90 = pbox("cal", CA90, "", dfrq, compC*pwC, pwClvl);
      ca180 = pbox("cal", CA180, "", dfrq, compC*pwC, pwClvl);      
      co180 = pbox(spco180a, CO180, CO180ps, dfrq, compC*pwC, pwClvl);
      co90b = pbox(spco90b, CO90b, CA180ps, dfrq, compC*pwC, pwClvl);
      co180b = pbox(spco180b, CO180b, CA180ps, dfrq, compC*pwC, pwClvl);
      ca180b = pbox("cal", CA180b, "", dfrq, compC*pwC, pwClvl);          
      cadec = pbox(cadecseq, CADEC, CADECps, dfrq, compC*pwC, pwClvl);
      w16 = pbox_dec("cal", "WALTZ16", tpwrml, sfrq, compH*pw, tpwr);
    }
    pwca90a = ca90.pw;       dhpwr = ca90.pwr;    
    pwca180a = ca180.pw;     dvhpwra = ca180.pwr;
    pwco180a = co180.pw;     dhpwrcoa = co180.pwr;
    pwco90b = co90b.pw;      dhpwrb = co90b.pwr;
    pwco180b = co180b.pw;    
    pwca180b = ca180b.pw;    dvhpwrb = ca180b.pwr;    
    pwcadec = 1.0/cadec.dmf; dpwrsed = cadec.pwr; dressed = cadec.dres;
    pwmlev = 1.0/w16.dmf;
    pwn=pwN; dhpwr2=pwNlvl;
  }   



/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

    if( 0.5*ni*1/(sw1) > BigTC - gt10 )
    {
        printf(" ni is too big\n");
        psg_abort(1);
    }

    if( ni2*1/(sw2) > 2.0*BigTN )
    {
        printf(" ni2 is too big\n");
        psg_abort(1);
    }

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

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

    if( pwmlev < 30.0e-6 ) 
    {
        printf("too much power during proton mlev sequence\n");
        psg_abort(1);
     }

    if( tpwrml > 53 )
     {
        printf("tpwrml is too high\n");
        psg_abort(1);
     }

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

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

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

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

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

    if( dvhpwrb > 62 )   /* pwr level for dipsi  */
    {
        printf("don't fry the probe, DVHPWRB too large!  ");
        psg_abort(1);
    }

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

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


    if( pwcadec > 500.0e-6 || pwcadec < 200.0e-6 )
    {
        printf("pwcadec outside reasonable limits: < 500e-6 > 200e-6 \n");
        psg_abort(1);
    }

    if( dpwrsed > 45 )
    {
        printf("dpwrsed is too high\n");
        psg_abort(1);
    }

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

    if(gt10 > 250.0e-6) {
        printf("gt10 must be 250e-6\n");
        psg_abort(1);
    }


/*  Phase incrementation for hypercomplex 2D data */

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

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

/*  Set up f2180  tau2 = t2               */

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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */


status(A);
   decoffset(dofcacb);       /* initially pulse at 43 ppm */
   decpower(dhpwr);        /* Set Dec1 power for hard 13C pulses         */
   dec2power(dhpwr2);      /* Set Dec2 power for 15N hard pulses         */

/* Presaturation Period */
   if (fsat[A] == 'y')
   {
        obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
	delay(2.0e-5);
        rgpulse(d1,zero,rof1,rof1);
   	obspower(tpwr);      /* Set transmitter power for hard 1H pulses */
	delay(2.0e-5);
	if(fscuba[A] == '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
   obspower(tpwr);           /* Set transmitter power for hard 1H pulses */
   delay(d1);
   txphase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

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


/* ensure that magnetization originates on H and not 13C  */
   decrgpulse(pwca90a,zero,0.0,0.0);

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

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

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

   decpower(dvhpwra);
   delay(taua - POWER_DELAY - gt2 - 2.2e-6);   /* taua <= 1/4JCH */                          
   simpulse(2*pw,pwca180a,zero,t1,0.0,0.0);
   decpower(dhpwr);

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

   txphase(t2); decphase(t3);
   delay(taua - POWER_DELAY - gt2 - 2.2e-6); 

   rgpulse(pw,t2,0.0,0.0);

   decrgpulse(pwca90a,t3,2.0e-6,0.0);

   delay(2.0e-6);

     delay(tau1);

     decpower(dhpwrcoa);
     decshaped_pulse(spco180a,pwco180a,zero,4.0e-6,0.0);

     dec2rgpulse(2*pwn,zero,0.0,0.0);

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

     decpower(dvhpwra);

     delay(0.80e-3 - gt10 - 4.0e-6 - 2*POWER_DELAY);
     delay(0.2e-6);
     
     rgpulse(2*pw,zero,0.0,0.0);

     decphase(t4);

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

     delay(BigTC - 0.80e-3);

     decrgpulse(pwca180a,t4,0.0,0.0);

     dcplrphase(zero);

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

     delay(BigTC - tau1 + 2*pwn + 2*pw - 2*POWER_DELAY - gt10 - 4.0e-6);
     delay(0.2e-6);

     decpower(dhpwrcoa);
     decshaped_pulse(spco180a,pwco180a,zero,4.0e-6,0.0); /* bloch seigert */
     decpower(dhpwr);

   decrgpulse(pwca90a,zero,2.0e-6,0.0);

     txphase(one); delay(2.0e-6);

     /* H decoupling on */
     obspower(tpwrml);
     obsprgon("waltz16",pwmlev,90.0);
     xmtron();    /* TURN ME OFF  DONT FORGET  */
     /* H decoupling on */

   decpower(dhpwrcoa);
   decshaped_pulse(spco180a,pwco180a,zero,4.0e-6,0.0); /* bloch seigert */
   decphase(t5);

   initval(1.0,v3);
   decstepsize(0.0);
   dcplrphase(v3);
 
   delay(tauc - 3*POWER_DELAY - PRG_START_DELAY);
   
   decpower(dvhpwra);
   decrgpulse(pwca180a,t5,0.0,0.0);

   dcplrphase(zero);

   decpower(dhpwrcoa);
   decshaped_pulse(spco180a,pwco180a,zero,4.0e-6,0.0); 
   decphase(zero);
   decpower(dhpwr);
   delay(tauc - 2*POWER_DELAY);

   decrgpulse(pwca90a,zero,0.0,0.0);

   /* H decoupling off */
   xmtroff();
   obsprgoff();
   /* H decoupling off */

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

   delay(0.2e-6);
   decoffset(dof);
   decpower(dhpwrb);

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

   rgpulse(pwmlev,zero,2.0e-6,0.0);
   txphase(one); delay(2.0e-6);

   /* H decoupling on */
   obspower(tpwrml);
   obsprgon("waltz16",pwmlev,90.0);
   xmtron();
   /* H decoupling on */

   decphase(t6);
   delay(2.0e-6);
   decshaped_pulse(spco90b,pwco90b,t6,0.0,0.0);

   decphase(zero);
   delay(taud - POWER_DELAY - 4.0e-6);

   decpower(dvhpwrb);
   decrgpulse(pwca180b,zero,4.0e-6,0.0);
   decpower(dhpwrb);
   delay(taue - taud - POWER_DELAY + 2*pwn);

   /* adjust phase */
   initval(1.0,v2);
   decstepsize(sphase1);
   dcplrphase(v2);
   /* adjust phase */
    
   decshaped_pulse(spco180b,pwco180b,zero,0.0,0.0);
   dcplrphase(zero);
   
   dec2rgpulse(2*pwn,zero,0.0,0.0);
   delay(taue - 2*POWER_DELAY - 4.0e-6 - 4.0e-6);    

   decpower(dvhpwrb);
   decrgpulse(pwca180b,zero,4.0e-6,0.0); /* bloch seigert */
   decpower(dhpwrb);

   decshaped_pulse(spco90b,pwco90b,t7,4.0e-6,0.0);

   /* H decoupling off */
   xmtroff();
   obsprgoff();
   /* H decoupling off */

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

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

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

   txphase(one); delay(2.0e-6);

   /* H decoupling on */
   obspower(tpwrml);
   obsprgon("waltz16",pwmlev,90.0);
   xmtron();
   /* H decoupling on */

   dec2rgpulse(pwn,t8,2.0e-6,0.0);
   dec2phase(t9); decphase(zero);

   /* seduce on */

   decpower(dpwrsed);
   decprgon(cadecseq,pwcadec,dressed);
   decon();
   /* seduce on */

   delay(BigTN - tau2 + WFG_START_DELAY + WFG_STOP_DELAY + pwco180b);


  /* seduce off */
  decoff();
  decprgoff();
  
  decpower(dhpwrb);
  /* seduce off */

  dec2rgpulse(2*pwn,t9,0.0,0.0);
  decshaped_pulse(spco180b,pwco180b,zero,0.0,0.0);

  dec2phase(t11);

   /* seduce on */

   decpower(dpwrsed);
   decprgon(cadecseq,pwcadec,dressed);
   decon();
   /* seduce on */

  delay(BigTN + tau2 - 5.5e-3 - POWER_DELAY - PRG_STOP_DELAY - pwmlev - 2.0e-6);

   /* H decoupling off */ 
   xmtroff();
   obsprgoff();
   /* H decoupling off */

   rgpulse(pwmlev,two,2.0e-6,0.0);    
   obspower(tpwr);

   delay(2.5e-3);

  /* seduce off */
  decoff();
  decprgoff();
  decpower(dhpwrb);
  /* seduce off */

   delay(0.2e-6);
   zgradpulse(gzlvl1,gt1);
   delay(2.0e-6);
   
   txphase(zero);
   dec2phase(t11);
   delay(3.0e-3 - gt1 - 2.2e-6 - 2.0*GRADIENT_DELAY);
  
   sim3pulse(pw,0.0,pwn,zero,zero,t11,0.0,0.0);

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

   dec2phase(zero);
   delay(tauf - gt7 - 2.2e-6);

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

   delay(0.2e-6);
   zgradpulse(gzlvl7,gt7);
   delay(2.0e-6);
   
   txphase(t12);
   dec2phase(t13);
   delay(tauf - gt7 - 2.2e-6);

   sim3pulse(pw,0.0,pwn,t12,zero,t13,0.0,0.0);
   
   delay(0.2e-6);
   zgradpulse(gzlvl7,gt7);
   delay(2.0e-6);
 
   txphase(zero);
   dec2phase(zero);
   delay(tauf - gt7 - 2.2e-6);
   sim3pulse(2*pw,0.0,2*pwn,zero,zero,zero,0.0,0.0);

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

   txphase(zero);
   delay(tauf - gt7 - 2.2e-6);
   
   rgpulse(pw,zero,0.0,0.0);

   txphase(zero);

   delay(BigT1);

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

   delay(2.0e-6);
   zgradpulse(icosel*gzlvl2,gt1/10);
   delay(2.0e-6);

   delay(BigT1 - gt1/10 - POWER_DELAY - 4.0e-6 - 2*GRADIENT_DELAY);

   dec2power(dpwr2);  /* set power for 15N decoupling */
    

/* BEGIN ACQUISITION */

status(C);
         setreceiver(t10);

}
Esempio n. 13
0
pulsesequence()

{

/* DECLARE VARIABLES */

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            ddseq[MAXSTR],    /* deuterium decoupling sequence */
            shp_sl[MAXSTR],

            shcreb[MAXSTR],  /* reburp shape for center of t1 period */
            shcgcob[MAXSTR], /* g3 inversion at 154 ppm (350 us) */
            shcgcoib[MAXSTR],  /* g3 time inversion at 154 ppm (350 us) */
            shca180[MAXSTR],   /* Ca 180 [D/sq(3)] during 15N CT */
            shco180[MAXSTR],   /* Co 180 [D/sq(15)] during 15N CT */
            sel_flg[MAXSTR],   /* active/passive purging of undesired 
                                  component  */ 
            fCT[MAXSTR],	       /* Flag for constant time C13 evolution */
            fc180[MAXSTR],
            cal_sphase[MAXSTR],
            shared_CT[MAXSTR],
            nietl_flg[MAXSTR];

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

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             taua,         /*  ~ 1/4JNH =  2.25 ms */
             del1,       /* time for C'-N to refocus set to 0.5*24.0 ms */
             bigTN,        /* nitrogen T period */
             bigTC,        /* carbon T period */
             zeta,         /* delay for transfer from ca to cb = 3.5 ms */
             tsatpwr,      /* low level 1H trans.power for presat  */
             sw1,          /* sweep width in f1                    */             
             sw2,          /* sweep width in f2                    */             
             tauf,         /* 1/2J NH value                     */
             pw_sl,        /* selective pulse on water      */
             phase_sl,     /* phase on water      */
             tpwrsl,       /* power for pw_sl               */
             at,

             d_cgcob,     /* power level for g3 pulses at 154 ppm */
             d_creb,      /* power level for reburp 180 at center of t1 */
             pwcgcob,     /* g3 ~ 35o us 180 pulse */
             pwcreb,      /* reburp ~ 400us 180 pulse */ 
 
             pwD,        /* 2H 90 pulse, about 125 us */
             pwDlvl,        /* 2H 90 pulse, about 125 us */

             pwca180,     /* Ca 180 during N CT at d_ca180 */
             pwco180,     /* Co 180 during N CT at d_co180 */

             d_ca180,
             d_co180,

             compC = getval("compC"),	/* C-13 RF calibration parameters */
             pwC = getval("pwC"),
             pwClvl = getval("pwClvl"),

             pwN,
             pwNlvl,

             sphase,

             pw_sl1,
             tpwrsl1,

             gstab,

             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt6,
             gt7,
             gt8,
             gt9,
             gt11,
             gt13,
             gt14,

             gzlvl1,
             gzlvl2,
             gzlvl3,
             gzlvl4,
             gzlvl5,
             gzlvl6,
             gzlvl7,
             gzlvl8,
             gzlvl9,
             gzlvl11,
             gzlvl13,
             gzlvl14;
            
/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */


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

  getstr("sel_flg",sel_flg);
  
  getstr("fCT",fCT);
  getstr("fc180",fc180);
  getstr("cal_sphase",cal_sphase);

  getstr("shared_CT",shared_CT);

  getstr("nietl_flg",nietl_flg);

  taua   = getval("taua"); 
  del1  = getval("del1");
  bigTN = getval("bigTN");
  bigTC = getval("bigTC");
  zeta = getval("zeta");
  pwN = getval("pwN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  pwNlvl = getval("pwNlvl");
  pwD = getval("pwD");
  pwDlvl = getval("pwDlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni2 = getval("ni2");
  tauf = getval("tauf");
  pw_sl = getval("pw_sl");
  phase_sl = getval("phase_sl");
  tpwrsl = getval("tpwrsl");
  at = getval("at");

  sphase = getval("sphase");

  pw_sl1 = getval("pw_sl1");
  tpwrsl1 = getval("tpwrsl1");

  gstab = getval("gstab");

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

  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl6 = getval("gzlvl6");
  gzlvl7 = getval("gzlvl7");
  gzlvl8 = getval("gzlvl8");
  gzlvl9 = getval("gzlvl9");
  gzlvl11 = getval("gzlvl11");
  gzlvl13 = getval("gzlvl13");
  gzlvl14 = getval("gzlvl14");

  if(autocal[0]=='n')
  {     
    getstr("shcgcob",shcgcob);
    getstr("shcgcoib",shcgcoib);
    getstr("shcreb",shcreb);
    getstr("shca180",shca180);
    getstr("shco180",shco180);
    
    d_ca180 = getval("d_ca180");
    d_co180 = getval("d_co180");
    d_cgcob = getval("d_cgcob");
    d_creb = getval("d_creb");
    pwca180 = getval("pwca180");
    pwco180 = getval("pwco180");
    pwcgcob = getval("pwcgcob");
    pwcreb = getval("pwcreb");
  }
  else
  {        
    strcpy(shcgcob,"Pg3_107p");    
    strcpy(shcgcoib,"Pg3i_107p");    
    strcpy(shcreb,"Preb_on");    
    strcpy(shca180,"Phard_15p");    
    strcpy(shco180,"Phard_133p");    
    if (FIRST_FID)  
    {
      cgcob = pbox(shcgcob, G3CGCOB, CAB180ps, dfrq, compC*pwC, pwClvl);
      cgcoib = pbox(shcgcoib, G3CGCOBi, CAB180ps, dfrq, compC*pwC, pwClvl);  
      creb = pbox(shcreb, CREB180, CAB180ps, dfrq, compC*pwC, pwClvl);      
      ca180 = pbox(shca180, CA180, CA180ps, dfrq, compC*pwC, pwClvl);        
      co180 = pbox(shco180, CO180, CA180ps, dfrq, compC*pwC, pwClvl);  
    }   
    d_ca180 = ca180.pwr;
    d_co180 = co180.pwr;
    d_cgcob = cgcob.pwr;
    d_creb = creb.pwr;
    pwca180 = ca180.pw;
    pwco180 = co180.pw;
    pwcgcob = cgcob.pw;
    pwcreb = creb.pw;
  }   

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */

   if(shared_CT[A] == 'n')
    if(bigTN - 0.5*(ni2 -1)/sw2 - POWER_DELAY < 0.2e-6)
    {
        text_error(" ni2 is too big\n");
        text_error(" please set ni2 smaller or equal to %d\n",
    			(int) ((bigTN -POWER_DELAY)*sw2*2.0) +1 );
        psg_abort(1);
    }

   if(fCT[A] == 'y')
    if(bigTC - 0.5*(ni-1)/sw1 - WFG_STOP_DELAY - gt14 - 102.0e-6
        - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        - POWER_DELAY - WFG_START_DELAY - 4.0e-6 - pwcgcob - WFG_STOP_DELAY
        - POWER_DELAY - 4.0e-6 < 0.2e-6) {

          text_error("ni is too big\n");
          text_error(" please set ni smaller or equal to %d\n",
    			(int) ((bigTC - WFG_STOP_DELAY - gt14 - 102.0e-6
        			- POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        			- POWER_DELAY - WFG_START_DELAY - 4.0e-6 - pwcgcob - WFG_STOP_DELAY
        			- POWER_DELAY - 4.0e-6)*sw1*2.0) +1 );
          psg_abort(1);
    }

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

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

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

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

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

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

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

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

    if( f1180[A] != 'n' && f2180[A] != 'n' ) {
        text_error("flags may be set wrong: set f1180=n and f2180=n for 3d\n");
        psg_abort(1);
    }

    if(d_ca180 > 58) 
    {
        text_error("dont fry the probe, d_ca180 too high ! ");
        psg_abort(1);
    }

    if(d_co180 > 58) 
    {
        text_error("dont fry the probe, d_ca180 too high ! ");
        psg_abort(1);
    }

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

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

    if(tpwrsl1 > 25) {
       text_error("tpwrsl1 must be less than 25\n");
       psg_abort(1);
    }

    if( dpwr3 > 50) {
       text_error("dpwr3 too high\n");
       psg_abort(1);
    }
    if( del1 > 0.1 ) {
       text_error("too long del1\n");
       psg_abort(1);
    }
    if( zeta > 0.1 ) {
       text_error("too long zeta\n");
       psg_abort(1);
    }
    if( bigTN > 0.1) {
       text_error("too long bigTN\n");
       psg_abort(1);
    }
    if( bigTC > 0.1) {
       text_error("too long bigTC\n");
       psg_abort(1);
    }
    if( pw_sl > 10e-3) {
       text_error("too long pw_sl\n");
       psg_abort(1);
    }
    if( pw_sl1 > 10e-3) {
       text_error("too long pw_sl1\n");
       psg_abort(1);
    }
    if( at > 0.1 && dm2[D] == 'y') {
       text_error("too long at with dec2\n");
       psg_abort(1);
    }

    if(pwDlvl > 59) {
        text_error("pwDlvl is too high; <= 59\n");
        psg_abort(1);
    }

    if(d_creb > 62) {
        text_error("d_creb is too high; <= 62\n");
        psg_abort(1);
    }

    if(d_cgcob > 60) {
        text_error("d_cgcob is too high; <=60\n");
        psg_abort(1);
    }

    if(cal_sphase[A] == 'y') {
      text_error("Use only to calibrate sphase\n");
      text_error("Set zeta to 600 us, gt11=gt13=0, fCT=y, fc180=n\n");
    }

    if(nietl_flg[A] == 'y' && sel_flg[A] == 'y') {
       text_error("Both nietl_flg and sel_flg cannot by y\n");
       psg_abort(1);
    }

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


/*  Phase incrementation for hypercomplex 2D data */

    /* changed from 1 to 3; spect. rev. not needed */
    if (phase == 2) { tsadd(t2,3,4); tsadd(t3,3,4); }

    if (shared_CT[A] == 'n') 
      {
       if (phase2 == 2) { tsadd(t7,2,4); icosel = 1; }
         else icosel = -1;
      }
     else 
      {
       if (phase2 == 2) { tsadd(t7,2,4); icosel = -1; }
         else icosel = 1;
      }

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

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

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

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

/*  Set up f1180  tau1 = t1         */

      tau1 = d2;
      if(f1180[A] == 'y' && fCT[A] == 'y') 
          tau1 += ( 1.0 / (2.0*sw1) );

      if(f1180[A] == 'y' && fCT[A] == 'n') 
          tau1 += (1.0 / (2.0*sw1) - 4.0/PI*pwC - POWER_DELAY
                    - 4.0e-6);

      if(f1180[A] == 'n' && fCT[A] == 'n') 
          tau1 = (tau1 - 4.0/PI*pwC - POWER_DELAY
                    - 4.0e-6);

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

/*  Set up f2180  tau2 = t2         */

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

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   obspower(tsatpwr);     /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);      /* Set Dec1 power to high power          */
   dec2power(pwNlvl);     /* Set Dec2 power for 15N hard pulses         */
   dec3power(pwDlvl);     /* Set Dec3 for 2H hard pulses */

/* Presaturation Period */

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

/* Begin Pulses */

status(B);

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

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

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

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

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

   dec2phase(t1); decphase(zero); 

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

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

   if (sel_flg[A] == 'y') 
     {
      rgpulse(pw,one,4.0e-6,0.0);

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

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

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

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

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

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

      decpower(d_ca180);

        dec2phase(zero);
   
        delay(del1 - 1.34e-3 - 4.0*pw - 4.0e-6 
              - POWER_DELAY + WFG_START_DELAY + pwca180 + WFG_STOP_DELAY);
     }
    else  
     {
      rgpulse(pw,three,4.0e-6,0.0);

      initval(1.0,v2);
      obsstepsize(phase_sl);
      xmtrphase(v2);
   
      /* shaped pulse */
      obspower(tpwrsl);
      shaped_pulse(shp_sl,pw_sl,zero,2.0e-6,0.0);
      xmtrphase(zero);
      delay(2.0e-6);
      obspower(tpwr);
      /* shaped pulse */
   
      delay(0.2e-6);
      zgradpulse(gzlvl3,gt3);
      delay(200.0e-6);

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

      decpower(d_ca180);

      delay(del1 - POWER_DELAY + WFG_START_DELAY
      		+ pwca180 + WFG_STOP_DELAY);
     }

   decphase(zero);
   dec2rgpulse(2*pwN,zero,0.0,0.0);
   decshaped_pulse(shca180,pwca180,zero,0.0,0.0);

   dec2phase(one);

   delay(del1);

   dec2rgpulse(pwN,one,0.0,0.0);

   decpower(pwClvl);

   decphase(t2); 

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

   dec2phase(t5); 

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

   decrgpulse(pwC,t2,0.0,0.0);

   delay(zeta
	- PRG_STOP_DELAY - DELAY_BLANK - POWER_DELAY - 4.0e-6
        - pwD
        - gt11 - 102.0e-6 - POWER_DELAY - WFG_START_DELAY); 
      
   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank(); 
   dec3phase(three);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

    decphase(zero);

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

   if (cal_sphase[A] == 'y') 
     {
      decpower(pwClvl);
      decshaped_pulse("hard",2.0*pwC,zero,4.0e-6,4.0e-6);
     }
    else 
     {
      initval(1.0,v3);
      decstepsize(sphase);
      dcplrphase(v3);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
     }

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

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

   delay(zeta - WFG_STOP_DELAY - gt11 - 102.0e-6 
	- POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - PRG_START_DELAY
        - DELAY_BLANK - POWER_DELAY - 4.0e-6);

   decpower(pwClvl);
   decrgpulse(pwC,t3,4.0e-6,0.0);

   if (fCT[A] == 'y') 
     {
      delay(tau1);

      decpower(d_cgcob);
      decshaped_pulse(shcgcob,pwcgcob,zero,4.0e-6,0.0);

      delay(bigTC - POWER_DELAY - WFG_START_DELAY - 4.0e-6
            - pwcgcob - WFG_STOP_DELAY 
            - 102.0e-6 - gt14 
            - PRG_STOP_DELAY - DELAY_BLANK
            - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY - WFG_START_DELAY);
 
      /* Turn off D decoupling */
      setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
      dec3blank();
      dec3phase(three);
      dec3power(pwDlvl);
      dec3rgpulse(pwD,three,4.0e-6,0.0);
      /* Turn off D decoupling */

      delay(2.0e-6);
      zgradpulse(gzlvl14,gt14);
      delay(100.0e-6);

      initval(1.0,v4);
      decstepsize(sphase);
      dcplrphase(v4);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
    
      delay(2.0e-6);
      zgradpulse(gzlvl14,gt14);
      delay(100.0e-6);

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


      delay(bigTC - tau1 - WFG_STOP_DELAY - gt14
            - 102.0e-6 - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY
            - PRG_START_DELAY - POWER_DELAY - WFG_START_DELAY
            - 4.0e-6 - pwcgcob - WFG_STOP_DELAY - POWER_DELAY 
            - 4.0e-6);

      decpower(d_cgcob);
      decshaped_pulse(shcgcoib,pwcgcob,zero,4.0e-6,0.0);
      decphase(t4);
     }
    else if(fCT[A] == 'n' && fc180[A] == 'n') 
     {
      delay(tau1);
      delay(tau1);
     }
    else if(fCT[A] == 'n' && fc180[A] == 'y') 
     {
      initval(1.0,v4);
      decstepsize(sphase);
      dcplrphase(v4);

      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,0.0);

      dcplrphase(zero);
     }

   decpower(pwClvl);
   decrgpulse(pwC,t4,4.0e-6,0.0);

   delay(zeta - POWER_DELAY - 4.0e-6
          - pwD - PRG_STOP_DELAY - DELAY_BLANK
          - gt13
          - 102.0e-6 - POWER_DELAY - WFG_START_DELAY); 

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

   delay(2.0e-6);
   zgradpulse(gzlvl13,gt13);
   delay(100.0e-6);

   if (cal_sphase[A] == 'y') 
     {
      decpower(pwClvl);
      decshaped_pulse("hard",2.0*pwC,zero,4.0e-6,4.0e-6);
     }
    else 
     {
      initval(1.0,v5);
      decstepsize(sphase);
      dcplrphase(v5);
      decpower(d_creb);
      decshaped_pulse(shcreb,pwcreb,zero,4.0e-6,4.0e-6);
      dcplrphase(zero);
     }

   delay(2.0e-6);
   zgradpulse(gzlvl13,gt13);
   delay(100.0e-6);

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


   delay(zeta - WFG_STOP_DELAY - gt13 - 102.0e-6  
        - POWER_DELAY - 4.0e-6 - pwD - POWER_DELAY
        - PRG_START_DELAY - DELAY_BLANK
        - POWER_DELAY - 4.0e-6);

   decpower(pwClvl);
   decrgpulse(pwC,zero,4.0e-6,0.0);

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

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

   if (shared_CT[A] == 'n') 
     {
      dec2rgpulse(pwN,t5,2.0e-6,0.0);

      decpower(d_ca180);

      dec2phase(t6); 

      delay(bigTN - tau2 - POWER_DELAY);

      dec2rgpulse(2*pwN,t6,0.0,0.0);
      decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
      dec2phase(t7);

      delay(bigTN - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY
            - gt1 - 2.0*GRADIENT_DELAY - 500.2e-6 
            - POWER_DELAY - 4.0e-6 - WFG_START_DELAY
            - pwco180 - WFG_STOP_DELAY);

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

      decpower(d_co180);
      decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);

      delay(tau2);
   
      sim3pulse(pw,0.0,pwN,zero,zero,t7,0.0,0.0);
     }
    else if (shared_CT[A] == 'y') 
     {
      dec2rgpulse(pwN,t5,2.0e-6,0.0);

      decpower(d_co180);
      dec2phase(t6); 

      if (bigTN - tau2 >= 0.2e-6) 
        {
         delay(tau2);

         decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);
         decpower(d_ca180);

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

         delay(bigTN - 4.0e-6 - WFG_START_DELAY - pwco180 - WFG_STOP_DELAY
               - POWER_DELAY - gt1 - 500.2e-6 - 2.0*GRADIENT_DELAY
               - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY);

         decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
         dec2rgpulse(2*pwN,t6,0.0,0.0);

         delay(bigTN - tau2);
        }
       else 
        {
         delay(tau2);
         decshaped_pulse(shco180,pwco180,zero,4.0e-6,0.0);

         delay(0.2e-6);
         zgradpulse(gzlvl1,gt1);
         delay(500.0e-6);
     
         decpower(d_ca180);
         delay(bigTN - 4.0e-6 - WFG_START_DELAY - pwco180
               - WFG_STOP_DELAY - gt1 - 500.2e-6 - 2.0*GRADIENT_DELAY
               - POWER_DELAY - WFG_START_DELAY - pwca180 - WFG_STOP_DELAY); 
   
         decshaped_pulse(shca180,pwca180,zero,0.0,0.0);
    
         delay(tau2 - bigTN);
         dec2rgpulse(2.0*pwN,t6,0.0,0.0);
        }
      sim3pulse(pw,0.0,pwN,zero,zero,t7,0.0,0.0);
     }
/* end of shared_CT */

   if (nietl_flg[A] == 'n') 
     {
      decpower(pwClvl);
      decrgpulse(pwC,zero,4.0e-6,0.0);

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

      dec2phase(zero);
      delay(tauf - POWER_DELAY - 4.0e-6 
                 - pwC - gt6 - 2.2e-6);

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

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

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

      sim3pulse(pw,0.0,pwN,one,zero,one,0.0,0.0);
      
      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(2.0e-6);
 
      txphase(zero);
      dec2phase(zero);
      delay(tauf - gt7 - 2.2e-6);

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

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

      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(200.0e-6);
   
      sim3pulse(pw,0.0e-6,pwN,zero,zero,zero,0.0,0.0);
     }
    else  
     {   /* nietl_flg == y */
      /* shaped pulse */
      obspower(tpwrsl1);
      shaped_pulse(shp_sl,pw_sl1,zero,2.0e-6,0.0);
      delay(2.0e-6);
      obspower(tpwr);
      /* shaped pulse */

      decpower(pwClvl);
      decrgpulse(pwC,zero,4.0e-6,0.0);

      delay(0.2e-6);
      zgradpulse(gzlvl6,gt6);
      delay(2.0e-6);
   
      dec2phase(zero);
      delay(tauf 
                 - POWER_DELAY - 2.0e-6 - WFG_START_DELAY
                 - pw_sl1 - WFG_STOP_DELAY - 2.0e-6 - POWER_DELAY
                 - POWER_DELAY - 4.0e-6 
                 - pwC - gt6 - 2.2e-6);

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

      txphase(one);
      dec2phase(zero);

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

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

      sim3pulse(pw,0.0,pwN,one,zero,zero,0.0,0.0);
   
      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(2.0e-6);
 
      txphase(zero);
      dec2phase(zero);
      delay(tauf - gt7 - 2.2e-6);

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

      delay(0.2e-6);
      zgradpulse(gzlvl7,gt7);
      delay(200.0e-6);
   
      sim3pulse(pw,0.0e-6,pwN,one,zero,one,0.0,0.0);
      txphase(zero);
     }  /* end of nietl_flg == y  */

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

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

   delay(2.0e-6);
   zgradpulse(icosel*gzlvl2,gt2);
   decpower(dpwr);    /* NO  13C decoupling */
   dec2power(dpwr2);  /* NO  15N decoupling */
   delay(gstab -2.0e-6 -2.0*GRADIENT_DELAY -2.0*POWER_DELAY);

   lk_sample();
/* BEGIN ACQUISITION */
status(C);
   setreceiver(t8);

}
Esempio n. 14
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. 15
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. 16
0
pulsesequence()
{
/* DECLARE VARIABLES */

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            c180_flg[MAXSTR],
            codecseq[MAXSTR],
            mess_flg[MAXSTR],
            ch_shp1[MAXSTR], /* shape for the 1st purge CHIRP */
            ch_shp2[MAXSTR], /* shape for the 2nd purge CHIRP */
            chshpi[MAXSTR]; /* shape for the INEPT CHIRPs */

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

 double      tau1,         /*  t1 delay */
             tau2,         /*  t2 delay */
             ni2,
             mix,         /* mixing time in seconds */
             pwC,          /* PW90 for c nucleus @ pwClvl         */
             pwcodec,      /* PW for C' nucleus @ dpwrco seduce dec  */
             tsatpwr,      /* low level 1H trans.power for presat  */
             pwClvl,        /* power level for 13C pulses on dec1  */
             dpwrco,       /* power level for C' seduce decoupling  */
             sw1,          /* sweep width in f1                    */
             sw2,          /* sweep width in f2                    */
             tofps,        /* tof for presat                       */ 
             dressed,      /* decoupler resolution for seduce decoupling */
             tpwrmess,    /* power level for Messerlie purge */
             dly_pg1,     /* duration of first part of purge */
             dly_wt,
             taua1,       /* Delay for the first purge CHIRP */
             taua2,       /* Delay for the  second purge CHIRP */
                 
             pwchirp1,	/* duration of the 1st purge CHIRP */
             pwchirp2,	/* duration of the 2nd purge CHIRP */
             d_me1,     /* time difference between 
			start of the sweep and the 
			excitation of the methyl region
			automatically calculated by the program
		 	necessary parameter diff (see below) */
             d_me2,     /* time difference between 
			start of the sweep and the 
			excitation of the methyl region
			automatically calculated by the program
		 	necessary parameter diff (see below) */
             dchrp1,	/* power for the 1st purge CHIRP pulse, only lower
			limit is important (see above!) */
             dchrp2,	/* power for the 2nd purge CHIRP pulse, only lower
			limit is important (see above!) */
             dmfchp1,	/* dmf (1/90) for the 1st purge CHIRP pulse
			dmfchp1 = 1/time_step of chirp-pulse
			[time_step = pwchirp1/no. of points in
			the .DEC-shape] */
             dmfchp2,	/* dmf (1/90) for the 1st purge CHIRP pulse
			dmfchp2 = 1/time_step of chirp-pulse
			[time_step = pwchirp2/no. of points in
			the .DEC-shape] */
             dres_chp,	/* dres for the chirp pulse 
			(must be set to 90, otherwise
			timing errors! ) */
             diff1,	/* shift differences between 
			methyl region and start of sweep */
             diff2,	/* shift differences between 
			methyl region and start of sweep */
             rate1,	/* sweep rate of the 1st purge CHIRP pulse
			frequency sweep/pwchirp1   */
             rate2,	/* sweep rate of the 2nd purge CHIRP pulse
			frequency sweep/pwchirp2   */
             dchrpi,
             dmfchpi,
             pwchirpi,    /* INEPT CHIRP duration */
             ratei,
             diffi,
             tauf,
             d_mei,  
             compC,        /* C-13 RF calibration parameters */

             gt0,
             gt1,
             gt2,
             gt3,
             gt4,
             gt5,
             gt8,
             gt9,
             gt10,
             gt11,
             gstab,
             gzlvl0, 
             gzlvl1, 
             gzlvl2, 
             gzlvl3, 
             gzlvl4, 
             gzlvl5,
             gzlvl8, 
             gzlvl9,
             gzlvl10,
             gzlvl11;

/*  variables commented out are already defined by the system      */


/* LOAD VARIABLES */


  getstr("autocal",autocal);
  getstr("fsat",fsat);
  getstr("f1180",f1180);
  getstr("f2180",f2180);
  getstr("fscuba",fscuba);
  getstr("c180_flg",c180_flg);
  getstr("mess_flg",mess_flg);


  tofps  = getval("tofps");
  mix = getval("mix");
  pwC = getval("pwC");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  pwClvl = getval("pwClvl");
  dpwr = getval("dpwr");
  dpwr2 = getval("dpwr2");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  ni2 = getval("ni2");
  tpwrmess = getval("tpwrmess");
  dly_pg1 = getval("dly_pg1");
  dly_wt = getval("dly_wt");
  taua1 = getval("taua1");
  taua2 = getval("taua2");
  
  rate1 = getval("rate1");
  rate2 = getval("rate2");
  diff1 = getval("diff1");
  diff2 = getval("diff2");
  diffi = getval("diffi");
  ratei = getval("ratei");

  tauf = getval("tauf");

  gt0 = getval("gt0");
  gt1 = getval("gt1");
  gt2 = getval("gt2");
  gt3 = getval("gt3");
  gt4 = getval("gt4");
  gt5 = getval("gt5");
  gt8 = getval("gt8");
  gt9 = getval("gt9");
  gt10 = getval("gt10");
  gt11 = getval("gt11");
  gstab = getval("gstab");
  gzlvl0 = getval("gzlvl0");
  gzlvl1 = getval("gzlvl1");
  gzlvl2 = getval("gzlvl2");
  gzlvl3 = getval("gzlvl3");
  gzlvl4 = getval("gzlvl4");
  gzlvl5 = getval("gzlvl5");
  gzlvl8 = getval("gzlvl8");
  gzlvl9 = getval("gzlvl9");
  gzlvl10 = getval("gzlvl10");
  gzlvl11 = getval("gzlvl11");

  if(autocal[0]=='n')
  {     
    getstr("codecseq",codecseq);
    dressed = getval("dressed");
    pwcodec = getval("pwcodec");
    dpwrco = getval("dpwrco");
    getstr("ch_shp1",ch_shp1);
    getstr("ch_shp2",ch_shp2);
    pwchirp1 = getval("pwchirp1");
    pwchirp2 = getval("pwchirp2");
    dchrp1 = getval("dchrp1");
    dchrp2 = getval("dchrp2");
    dmfchp1 = getval("dmfchp1");
    dmfchp2 = getval("dmfchp2");
    dres_chp = getval("dres_chp");
    getstr("chshpi",chshpi);
    dchrpi = getval("dchrpi");
    dmfchpi = getval("dmfchpi");
    pwchirpi = getval("pwchirpi");
  }
  else
  {    
    strcpy(codecseq,"Psed_108p");
    strcpy(ch_shp1,"Pwurst180_1");
    strcpy(ch_shp2,"Pwurst180_2");
    strcpy(chshpi,"Pwurst180i");
    if (FIRST_FID)
    {
      compC = getval("compC"); 
      codec = pbox(codecseq, CODEC, CODECps, dfrq, compC*pwC, pwClvl);
      chirp1 = pbox(ch_shp1, CHIRP1, CHIRPps, dfrq, compC*pwC, pwClvl);
      chirp2 = pbox(ch_shp2, CHIRP2, CHIRPps, dfrq, compC*pwC, pwClvl);
      chirpi = pbox(chshpi, CHIRPi, CHIRPps, dfrq, compC*pwC, pwClvl);
    }
    dpwrco = codec.pwr;      pwcodec = 1.0/codec.dmf;  dressed = codec.dres;
    dchrp1 = chirp1.pwr;     dmfchp1 = chirp1.dmf;
    pwchirp1 = chirp1.pw;    dres_chp = chirp1.dres;       
    dchrp2 = chirp1.pwr;     dmfchp2 = chirp2.dmf;
    pwchirp2 = chirp2.pw;     
    dchrpi = chirpi.pwr;     dmfchpi = chirpi.dmf;
    pwchirpi = chirpi.pw;     
  }   
  
/* LOAD PHASE TABLE */

  settable(t1,8,phi1);
  settable(t2,16,phi2);
  settable(t4,16,rec);
  settable(t5,4,phi5);
  settable(t6,2,phi6);
  settable(t7,4,phi7);

/* CHECK VALIDITY OF PARAMETER RANGES */


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

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

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

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

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

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

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

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

    if( pwcodec < 300.0e-6 )
    {
        printf("dont fry the probe, pwcodec too high ! ");
        psg_abort(1);
    } 
    if ( tpwrmess > 56 )
    {
        printf("dont fry the probe, tpwrmess too high ! ");
        psg_abort(1);
    }
    if ( dly_pg1 > 0.010)
    {
        printf("dont fry the probe, dly_pg1 too long ! ");
        psg_abort(1);
    }

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

   if( gzlvl3*gzlvl4 > 0.0 ) 
    {
        printf("gt3 and gt4 must be of opposite sign \n");
        printf("for optimal water suppression\n");
        psg_abort(1);
     }

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

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

    if( pwchirp1 > 10.e-03 )
    {
        printf("don't fry the probe, pwchirp1 too large!  ");
        psg_abort(1);
    }

    if( pwchirp2 > 10.e-03 )
    {
        printf("don't fry the probe, pwchirp2 too large!  ");
        psg_abort(1);
    }

	d_me1 = diff1/rate1 ;
	d_me2 = diff2/rate2 ;

    if( d_me1 > 10.e-03 )
    {
        printf("don't fry the probe, d_me1 too large \n");
	printf("	(must be less than 10 msec)!  ");
        psg_abort(1);
    }
    if( d_me2 > 10.e-03 )
    {
        printf("don't fry the probe, d_me2 too large \n");
	printf("	(must be less than 10 msec)!  ");
        psg_abort(1);
    }

    if( d_me1 > pwchirp1 )
    {
        printf("impossible; d_me1 > pwchirp1 !  ");
        psg_abort(1);
    }

    if( d_me2 > pwchirp2 )
    {
        printf("impossible; d_me2 > pwchirp2 !  ");
        psg_abort(1);
    }


    if( dchrpi > 60 )
    {
       printf("dont fry the probe, dchrpi too large\n");
       psg_abort(1);
    }

    if(pwchirpi > 10.0e-3)
    {
        printf("don't fry the probe, pwchirpi too large!  ");
        psg_abort(1);
    }

    d_mei = diffi/ratei;

/*  Phase incrementation for hypercomplex 2D data */

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

/*  Set up f1180  tau1 = t1               */
   
    tau1 = d2;
    if(f1180[A] == 'y') {
        tau1 += ( 1.0 / (2.0*sw1) - 4.0/PI*pw - 2.0e-6 );
    }

    else
        tau1 = tau1 - 4.0/PI*pw - 2.0e-6;

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

/*  Set up f2180  tau2 = t2               */

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

    else tau2 = tau2 - ((4.0/PI)*pwC + 2.0*pw 
               + PRG_START_DELAY + PRG_STOP_DELAY 
               + 2.0*POWER_DELAY + 4.0e-6); 

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

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

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

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

   
   

/* BEGIN ACTUAL PULSE SEQUENCE */

status(A);
   delay(5.0e-6);
   obspower(tsatpwr);      /* Set transmitter power for 1H presaturation */
   decpower(pwClvl);        /* Set Dec1 power for hard 13C pulses         */
   delay(5.0e-6);

/* Presaturation Period */

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

      obsoffset(tofps);
      obspower(tpwrmess);
      txphase(zero);
      rgpulse(dly_pg1,zero,2.0e-6,2.0e-6);
      txphase(one);
      rgpulse(dly_pg1/1.62,one,2.0e-6,2.0e-6);

      obspower(tsatpwr);
   }

   if (fsat[0] == 'y')
   {
        obsoffset(tofps);
	delay(2.0e-5);
    	rgpulse(d1,zero,2.0e-6,2.0e-6); /* presat */
   	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 */
   obsoffset(tof);
   decphase(zero);

/* Begin Pulses */

status(B);

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

   rgpulse(pw,t6,4.0e-6,0.0);            /* 90 deg 1H pulse */

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

   delay(taua1 - gt8 - gstab -2.0e-6 - POWER_DELAY - 4.0e-6 
         - PRG_START_DELAY - d_me1); 

         
   /* 1st purge CHIRP inversion  on */

   decpower(dchrp1);  /* Set power for 1st purge CHIRP inversion */
   delay(4.0e-6);

   decprgon(ch_shp1,1.0/dmfchp1,dres_chp);
   decon();

   delay(d_me1);
   
   rgpulse(2*pw,zero,0.0,0.0);       /* 1H  inversion pulse */

   delay(pwchirp1 - d_me1 - 2*pw);
   decoff();
   decprgoff();

   /* chirp inversion  off */

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

   delay(taua1 + 2*pw - (pwchirp1 - d_me1) 
          - PRG_STOP_DELAY  - gt8 - gstab -2.0e-6); 
 
   rgpulse(pw,zero,0.0,0.0);

   txphase(t7);

   delay(2.0e-6);
   zgradpulse(gzlvl9,gt9);
   delay(2.0*gstab); 
  
   rgpulse(pw,t7,0.0,0.0); 		/* PHASE t7 = 2(x),2(-x)*/

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

   decphase(zero); txphase(zero);

   delay(taua2 - gt11 - gstab -2.0e-6 - POWER_DELAY 
        - 4.0e-6 - PRG_START_DELAY - d_me2);

   /* Second chirp inversion  on */

   decpower(dchrp2);  /* Set power for chirp inversion */
   delay(4.0e-6);
   decprgon(ch_shp2,1.0/dmfchp2,dres_chp);
   decon();

   delay(d_me2);

   rgpulse(2*pw,zero,0.0,0.0);        /* 1H inversion pulse */
   
   delay(pwchirp2 - d_me2 - 2*pw);
   decoff();
   decprgoff();

   /* Second purge CHIRP off */

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

   txphase(zero);

   delay(taua2 + 2*pw - (pwchirp2 - d_me2) 
         - PRG_STOP_DELAY - gt11 - gstab -2.0e-6 );

   rgpulse(pw,zero,0.0,0.0);  

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

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

   delay(tau1);

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

   delay(mix - 10.0e-3);

   delay(2.0e-6);
   zgradpulse(gzlvl0,gt0);

   decpower(pwClvl);  /* Set power for hard pulses */

   delay(4.0e-6);

   decrgpulse(pwC,zero,0.0,0.0); 

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

   delay(10.0e-3 - gt1 - gt0 - 8.0e-6);
   
   rgpulse(pw,zero,0.0,0.0);

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

  decphase(zero);
  delay(tauf - gt2 - gstab -2.0e-6 - POWER_DELAY - 4.0e-6 
       - PRG_START_DELAY - d_mei);

   /* INEPT CHIRP inversion  on */

   decpower(dchrpi);  /* Set power for chirp inversion */
   delay(4.0e-6);
   decprgon(chshpi,1.0/dmfchpi,dres_chp);
   decon();

   delay(d_mei);

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

   delay(pwchirpi - d_mei - 2*pw);
   decoff();
   decprgoff();

   /* chirp inversion  off */

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

   txphase(one); 

   delay(tauf + 2*pw - (pwchirpi - d_mei) 
       - PRG_STOP_DELAY - gt2 - gstab -2.0e-6 );

  rgpulse(pw,one,0.0,0.0);

  txphase(zero); decphase(t2);

   decpower(pwClvl);  /* Set power for C13 hard pulse */
  

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

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

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

   delay(2.0e-6);

   /* CO decoupling on */
   decpower(dpwrco);
   decprgon(codecseq,pwcodec,dressed);
   decon();
   /* CO decoupling on */

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

   delay(tau2);

   /* CO decoupling off */
   decoff();
   decprgoff();
   decpower(pwClvl);
   /* CO decoupling off */

   delay(2.0e-6);

  }

  else
   simpulse(2*pw,2*pwC,zero,zero,2.0e-6,2.0e-6);

  decrgpulse(pwC,zero,0.0,0.0);  

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

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

   txphase(zero);

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

  decphase(zero);
  delay(tauf - gt5 - gstab -2.0e-6 - POWER_DELAY 
       - 4.0e-6 - PRG_START_DELAY - d_mei);

   /* 2nd INEPT CHIRP inversion  on */

   decpower(dchrpi);  /* Set power for chirp inversion */
   delay(4.0e-6);
   decprgon(chshpi,1.0/dmfchpi,dres_chp);
   decon();

   delay(d_mei);

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

   delay(pwchirpi - d_mei - 2*pw);
   decoff();
   decprgoff();

   /* chirp inversion  off */

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

   decpower(dpwr);  /* Set power for decoupling */

   txphase(t5); 

   delay(tauf + 2*pw - (pwchirpi - d_mei) - PRG_STOP_DELAY 
          - gt5 - gstab -2.0e-6 - 2*POWER_DELAY);

   rgpulse(pw,t5,0.0,0.0);
    

/* BEGIN ACQUISITION */

status(C);
   setreceiver(t4);

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

 char       autocal[MAXSTR],  /* auto-calibration flag */
            fsat[MAXSTR],
	    fscuba[MAXSTR],
            f1180[MAXSTR],    /* Flag to start t1 @ halfdwell             */
            f2180[MAXSTR],    /* Flag to start t2 @ halfdwell             */
            f3180[MAXSTR],    /* Flag to start t3 @ halfdwell             */
            fco180[MAXSTR],    /* Flag for checking sequence              */
            fca180[MAXSTR],    /* Flag for checking sequence              */
            spca180[MAXSTR],  /* string for the waveform Ca 180 */
            spco180[MAXSTR],  /* string for the waveform Co 180 */
            spchirp[MAXSTR],  /* string for the waveform reburp 180 */
            ddseq[MAXSTR],    /* 2H decoupling seqfile */
            shp_sl[MAXSTR],   /* string for seduce shape */
            sel_flg[MAXSTR];

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

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

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

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

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

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

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

/* LOAD VARIABLES */


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

  getstr("sel_flg",sel_flg);

  taua   = getval("taua"); 
  taub   = getval("taub"); 
  zeta  = getval("zeta");
  bigTN = getval("bigTN");
  tpwr = getval("tpwr");
  tsatpwr = getval("tsatpwr");
  dpwr = getval("dpwr");
  pwN = getval("pwN");
  pwNlvl = getval("pwNlvl");
  pwD = getval("pwD");
  pwDlvl = getval("pwDlvl");
  phase = (int) ( getval("phase") + 0.5);
  phase2 = (int) ( getval("phase2") + 0.5);
  phase3 = (int) ( getval("phase3") + 0.5);
  sw1 = getval("sw1");
  sw2 = getval("sw2");
  sw3 = getval("sw3");
  ni2 = getval("ni2");
  ni3 = getval("ni3");
  pw_sl = getval("pw_sl");
  phase_sl = getval("phase_sl");
  tpwrsl = getval("tpwrsl");

  gstab = getval("gstab");

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

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

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

/* LOAD PHASE TABLE */

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

/* CHECK VALIDITY OF PARAMETER RANGES */


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


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

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


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

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

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

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

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

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

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

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

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


/*  Phase incrementation for hypercomplex 2D data */

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

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

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

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

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

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

        tau1 = tau1/2.0;

/*  Set up f2180  tau2 = t2               */

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

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

        tau2 = tau2/2.0;

/*  Set up f3180  tau3 = t3               */
 
    tau3 = d4;
    if ((f3180[A] == 'y') && (ni3 > 1)) {
        tau3 += ( 1.0 / (2.0*sw3) );
        if(tau3 < 0.2e-6) tau3 = 0.4e-6;
    }
        tau3 = tau3/2.0;

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

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

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

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

/* BEGIN ACTUAL PULSE SEQUENCE */

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

/* Presaturation Period */

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

   obspower(tpwr);           /* Set transmitter power for hard 1H pulses */
   txphase(zero);
   dec2phase(zero);
   delay(1.0e-5);

/* Begin Pulses */

status(B);

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

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

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

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

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

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

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

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

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

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

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

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

      dec2rgpulse(pwN,zero,0.0,0.0);

      delay( zeta );
  
      dec2rgpulse(2.0*pwN,zero,0.0,0.0);
      decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

      delay(zeta -WFG_START_DELAY -pwchirp -WFG_STOP_DELAY -2.0e-6);

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

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

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

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

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

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

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

     delay( zeta - 1.34e-3 - 2.0*pw);
  
     dec2rgpulse(2.0*pwN,zero,0.0,0.0);
     decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

     delay(zeta -WFG_START_DELAY -pwchirp -WFG_STOP_DELAY -2.0e-6);

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

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

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

   decrgpulse(pwc90,t1,2.0e-6,0.0);
/* t1 period for Co evolution begins */
   if (fco180[A]=='n')  
     {
      decpower(d_c180);

      delay(tau1);
      sim3shaped_pulse("",spca180,"",0.0,pwc180off,2.0*pwN,zero,zero,zero,4.0e-6,0.0);

      decpower(d_c90);

       delay(tau1);
     }
   else /* for checking sequence */
     {
      decpower(d_c180);
      decrgpulse(pwc180on,zero,4.0e-6,0.0);
      decpower(d_c90);
     }
/* t1 period for Co evolution ends */
   decrgpulse(pwc90,zero,4.0e-6,0.0);

   decoffset(dof-(174-56)*dfrq);   /* change Dec1 carrier to Ca (55 ppm) */
   delay(0.2e-6);
   zgradpulse(gzlvl4,gt4);
   delay(150.0e-6);

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

   decrgpulse(pwc90,t5,2.0e-6,0.0);
/* t2 period  for Ca evolution begins */
  if (fca180[A]=='n')
    {
     decphase(zero); dec2phase(zero);
     decpower(d_c180); 
     delay(tau2);
     sim3shaped_pulse("",spco180,"",0.0,pwc180off,2.0*pwN,zero,zero,zero,4.0e-6,0.0);
     decpower(d_c90); 
     delay(tau2);
    }
   else /* for checking sequence */
    {
     decpower(d_c180);
     decrgpulse(pwc180on,zero,4.0e-6,0.0);
     decpower(d_c90);
    }
/* t2 period  for Ca evolution ends */
   decrgpulse(pwc90,zero,4.0e-6,0.0);
 
   /* Turn off D decoupling */
   setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3);
   dec3blank();
   dec3phase(three);
   dec3power(pwDlvl);
   dec3rgpulse(pwD,three,4.0e-6,0.0);
   /* Turn off D decoupling */

   decoffset(dof);   /* set carrier back to Co */
   decpower(d_chirp);

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

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

   dec2phase(t3);

   delay(bigTN - tau3);

   dec2rgpulse(2.0*pwN,t3,0.0,0.0);
   decshaped_pulse(spchirp,pwchirp,zero,0.0,0.0);

   txphase(zero);
   dec2phase(t4);

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

   delay(bigTN - WFG_START_DELAY - pwchirp - WFG_STOP_DELAY
         -gt1 -500.2e-6 -2.0*GRADIENT_DELAY);

   delay(tau3);

   sim3pulse(pw,0.0e-6,pwN,zero,zero,t4,0.0,0.0);
/* t3 period ends */

   decpower(d_c90);
   decrgpulse(pwc90,zero,4.0e-6,0.0);
   decoffset(dof-(174-56)*dfrq);
   decrgpulse(pwc90,zero,20.0e-6,0.0);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   lk_sample();
/* BEGIN ACQUISITION */
status(C);
   setreceiver(t6);

}
Esempio n. 18
0
void vline(int x,int y,int y2,int c)
{
	if (y2>y) pbox(x,y,1,y2-y+1,c); else pbox(x,y2,1,y-y2+1,c);
}
Esempio n. 19
0
pulsesequence()
{

/* DECLARE AND LOAD VARIABLES */

char    	 
        CA90_in_str[MAXSTR],     
  	CA180_in_str[MAXSTR],  CA180n_in_str[MAXSTR],       
        CO180offCA_in_str[MAXSTR],   
        RFpars[MAXSTR],       
        exp_mode[MAXSTR],         /* flag to run 3D, or 2D time-shared 15N TROSY /13C HSQC-SE*/   

	f1180[MAXSTR],   		                     /* Flag to start t1 @ halfdwell */
	f2180[MAXSTR],
	f3180[MAXSTR];			                           /* do TROSY on N15 and H1 */
 
int     icosel=1.0;      			                 /* used to get n and p type */
     

double  x,y,z, t2max, t1max, tpwrs,

        tpwrsf_d = getval("tpwrsf_d"), /* fine power adustment for first soft pulse(down)*/
        tpwrsf_u = getval("tpwrsf_u"), /* fine power adustment for second soft pulse(up) */
        pwHs = getval("pwHs"),                     /* H1 90 degree pulse length at tpwrs */
        compH =getval("compH"),

        tau1, tau2,                                 /*evolution times in indirect dimensions */
        ni2=getval("ni2"),

        tauNH=getval("tauNH"),                                     /* 1/(4Jhn), INEPTs, 2.4ms*/
        tauNH1=getval("tauNH1"),                           /* 1/(4Jhn), TROSY in CN CT, 2.7ms*/
        timeTN1=getval("timeTN1"),                   /* CT time for (first) N->CA*N transfer */
        timeTN=getval("timeTN"),                                /* CT time for last SE TROSY */ 
        timeCN=getval("timeCN"),                     /* CT time for CA -> N transfer, middle */
 
	pwClvl = getval("pwClvl"), 	       	               /* coarse power for C13 pulse */
	pwC = getval("pwC"),     	             /* C13 90 degree pulse length at pwClvl */
        compC = getval("compC"),
        dfrq = getval("dfrq"),
   	              
	pwNlvl = getval("pwNlvl"),	                            /* power for N15 pulses */
        pwN = getval("pwN"),                        /* N15 90 degree pulse length at pwNlvl */
        
	gstab = getval("gstab"),
	g6bal= getval("g6bal"),  
	                         /* balance of the decoding gradient around last 180 pulse on 1H
			        g6bal=1.0 : full g6 is on the right side of the last pw180 on 1H
			        g6bal=0.0:  full g6 is on the left side*/

  	gt0 = getval("gt0"),     
        gt1 = getval("gt1"),
        gt2 = getval("gt2"),
 	gt3 = getval("gt3"),
	gt4 = getval("gt4"),
	gt5 = getval("gt5"),
        gt6 = getval("gt6"),
 	gt7 = getval("gt7"),

	gzlvl0 = getval("gzlvl0"),
	gzlvl1 = getval("gzlvl1"),
	gzlvl2 = getval("gzlvl2"),
	gzlvl3 = getval("gzlvl3"),
	gzlvl4 = getval("gzlvl4"),
	gzlvl5 = getval("gzlvl5"),	
        gzlvl6 = getval("gzlvl6"),
	gzlvl7 = getval("gzlvl7"),
        gzlvl11 = getval("gzlvl11");

    getstr("f1180",f1180);
    getstr("f2180",f2180);
    getstr("exp_mode",exp_mode);
        
    tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69));          /*needs 1.69 times more*/
    tpwrs = (int) (tpwrs);                               /*power than a square pulse */
    if (tpwrsf_d<4095.0)
        tpwrs=tpwrs+6.0;  /* add 6dB to let tpwrsf_d control fine power ~2048*/

/*   LOAD PHASE TABLE    */
	
        
        settable(t1,1,phi1);

        settable(t2,4,phi2);                                        /* default double trosy */
	  if (exp_mode[A] == 'h') {settable(t2,4,phi2h);};      /*option for regular hNcaNH */
                
        settable(t3,4,phi3);
        settable(t4,8,phi4);
        settable(t5,2,phi5);
        settable(t6,4,phi6);
        settable(t7,4,phi7);
        settable(t8,4,phi8);
	settable(t21,1,psi1);                          /*trosy and SE hsqc in reverse INPET */
	settable(t22,1,psi2);
        settable(t23,1,psi2c);  
        settable(t31,8,rec); 

/* some checks */

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

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

    if ( (dm3[B] == 'y' )  && (timeCN*2.0 > 60.0e-3) )
       { printf("too lond time for 2H decoupling, SOL ");psg_abort(1);}


/*   INITIALIZE VARIABLES   */
  if(FIRST_FID)                                                          /* call Pbox */
    {
     getstr("CA180_in_str",CA180_in_str);  getstr("CA180n_in_str",CA180n_in_str);
     getstr("CA90_in_str",CA90_in_str);    getstr("CO180offCA_in_str",CO180offCA_in_str);

     strcpy(RFpars,             "-stepsize 0.5 -attn i");

     CA180 =  pbox("et_CA180_auto", CA180_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CA180n = pbox("et_CA180n_auto", CA180n_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CA90  =  pbox("et_CA90_auto", CA90_in_str, RFpars, dfrq, compC*pwC, pwClvl);
     CO180offCA = pbox("et_CO180offCA_auto", CO180offCA_in_str, RFpars, dfrq, compC*pwC, pwClvl);
    };


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

   /* t1 , N15 */
    if (phase1 == 2)  {tsadd(t2 ,1,4);}
    if(d2_index % 2)  {tsadd(t2,2,4); tsadd(t31,2,4); }  
   
   
/* setting up semi-CT on t1 (ni) dimension */
    tau1  = d2; 
    t1max=(ni-1.0)/sw1;
  
    if((f1180[A] == 'y') && (ni > 0.0)) 
          {tau1 +=  0.5/sw1 ; t1max+= 0.5/sw1; }  

    if( t1max < timeTN1*2.0) {t1max=2.0*timeTN1;}; 
                            /* if not enough  ni increments, then just regular CT in t1/ni CN */
   /* t2, CA  */

      if  (phase2 == 2)    { tsadd(t3,1,4); }	 
      if (d3_index % 2)    { tsadd(t3,2,4);  tsadd(t31,2,4); }   

/* setup  constant time in t2 (ni2) */
    tau2 = d3;  
    t2max=2.0*(timeCN - CO180offCA.pw);

    if((f2180[A] == 'y') && (ni2 > 0.0)) 
          {tau2 +=  0.5/sw2 ; t2max +=  0.5/sw2 ;}

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


    if ( (ni2-1.0)/sw2 > t2max) 
       { text_error("too  many ni2 increments in t2 !  "); psg_abort(1); }
     
  if(FIRST_FID)                                            
        {
             printf("t1max is %f\n",t1max);
	     printf("t2max is %f\n",t2max);
        };
   

/* BEGIN PULSE SEQUENCE */

status(A);

	obspower(tpwr);
	decpower(pwClvl);
	dec2power(pwNlvl);

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

        delay(d1);
        zgradpulse(gzlvl2, gt2);
	delay(gstab*3.0);

 if (exp_mode[B]=='n') dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);     /* test for steady-state 15N */
		
       /* Hz -> HzXz INEPT */

   	rgpulse(pw,zero,rof1,rof1);                              /* 1H pulse excitation */
 
        zgradpulse(gzlvl0, gt0);
	delay(tauNH -gt0);

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

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

 	rgpulse(pw, t6, rof1, rof1);

       /* on HzNz now */
      /* water flipback*/

        obspower(tpwrs); obspwrf(tpwrsf_u);
 	shaped_pulse("H2Osinc",pwHs,zero,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0);

       /* purge */
       
	zgradpulse(gzlvl3, gt3);
        dec2phase(t2);
	
	delay(gstab*2.0);
        
/*  HzNz -> NzCAz  +t1 evolution*/

	dec2rgpulse(pwN, t2, 0.0, 0.0);

      /* double-trosy hNcaNH */
	
	delay(tauNH1  -pwHs-4.0*rof1 -pw  
               -2.0*POWER_DELAY -WFG_STOP_DELAY-WFG_START_DELAY);            
        obspower(tpwrs); obspwrf(tpwrsf_d);
 	shaped_pulse("H2Osinc",pwHs,two,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0); 
        rgpulse(pw, zero, rof1, rof1);   
        rgpulse(pw, t7, rof1, rof1);
        obspower(tpwrs); obspwrf(tpwrsf_u);
 	shaped_pulse("H2Osinc",pwHs,t8,rof1,rof1);
	obspower(tpwr);  obspwrf(4095.0);         		
        dec_c13_shpulse(CO180offCA,zero);  
        delay(tau1*0.5);
	dec_c13_shpulse(CO180offCA,zero); dec2phase(zero);

       	delay( timeTN1 -tauNH1 -pwHs  -4.0*rof1 -pw  -2.0*POWER_DELAY
               -WFG_STOP_DELAY -WFG_START_DELAY -CA180.pw -2.0*CO180offCA.pw 
               -3.0*(2.0*POWER_DELAY +WFG_STOP_DELAY +WFG_START_DELAY)); 
                       
	dec_c13_shpulse(CA180,zero);
	delay(tau1*0.5 -timeTN1*tau1/t1max); 
        dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);      
	delay( timeTN1 -tau1*timeTN1/t1max);
       	dec2rgpulse(pwN, zero, 0.0, 0.0);

/*   on CAzNz now */

/* purge */
       zgradpulse(gzlvl7, gt7);
       delay(gstab);	

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

	/* dec_c13_shpulse(CA90,t3);*/
        
        /* t2 time, CA evolution */
	decrgpulse(pwC,t3,0.0,0.0);
	decphase(zero);
        delay(0.5*(timeCN+tau2*0.5-CO180offCA.pw)  );
        dec_c13_shpulse(CO180offCA,zero);  
        delay(0.5*(timeCN+tau2*0.5-CO180offCA.pw)  -pwN*2.0 + WFG_STOP_DELAY);

        if (exp_mode[A]=='R')  /* test CA.N relaxation rate  */
           {
	    delay(2.0*pwN);
           } 
        else
           dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);
	
	dec_c13_shpulse(CA180n,zero);
        delay(0.5*(timeCN-tau2*0.5-CO180offCA.pw)  );
        dec_c13_shpulse(CO180offCA,zero);  
        delay(0.5*(timeCN-tau2*0.5-CO180offCA.pw) + WFG_START_DELAY);

	/*dec_c13_shpulse(CA90,zero);*/

	decrgpulse(pwC,zero,0.0,0.0);
 

 	if(dm3[B] == 'y') 
         {                     
	  setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3);                  
	  if(1.0/dmf3>900.0e-6)
           {
	    dec3power(dpwr3+6.0);
	    dec3rgpulse(0.5/dmf3, three, 1.0e-6, 0.0e-6);
	    dec3power(dpwr3);
	   }
	  else 
           dec3rgpulse(1.0/dmf3, three, 1.0e-6, 0.0e-6);
           dec3blank();
           delay(PRG_START_DELAY);
         }

       zgradpulse(gzlvl5, gt5);
	dec2phase(t4);
       delay(gstab);	

       /*    CaN->N + back to NH */

   	dec2rgpulse(pwN, t4, 0.0, 0.0);
        dec2phase(zero);
        delay(timeTN);
	dec2rgpulse(2.0*pwN, zero, 0.0, 0.0);     
        dec_c13_shpulse(CA180,zero);
        delay(timeTN - CA180.pw   -gt4-gstab -pwHs-3.0*rof1
             -4.0*POWER_DELAY -2.0*WFG_STOP_DELAY-2.0*WFG_START_DELAY
             -2.0*GRADIENT_DELAY
             +4.0*pwN/3.1415-pw);
       zgradpulse(gzlvl4, gt4);
       delay(gstab);	  
    
       /*Water flipback (flipdown actually ) */
        obspower(tpwrs); obspwrf(tpwrsf_d);                         
 	shaped_pulse("H2Osinc",pwHs,three,rof1,rof1);
	obspower(tpwr); obspwrf(4095.0);  
 
/* reverse double INEPT */


/* 90 */  
   rgpulse(pw, t21, rof1, rof1);  
   zgradpulse(gzlvl11, gt1);		       
   delay(tauNH  -gt1 -rof1 
        -CA180.pw -2.0*POWER_DELAY - WFG_STOP_DELAY- WFG_START_DELAY );        
   dec_c13_shpulse(CA180,zero);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   delay(tauNH  - gt1 -gstab);
   zgradpulse(gzlvl11, gt1);		 
   delay(gstab);

 /* 90 */ 

   sim3pulse(pw, 0.0, pwN, one, zero, zero, 0.0, 0.0);
   zgradpulse(gzlvl1, gt1);		 
   delay(tauNH  -gt1);
   sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0);
   delay(tauNH -POWER_DELAY  -gt1- gstab);
   zgradpulse(gzlvl1, gt1);
   dec2phase(t22);		 
   delay(gstab);      
   sim3pulse(0.0,0.0, pwN, one, zero, t22, 0.0, 0.0);  
   zgradpulse(-(1.0-g6bal)*gzlvl6*icosel, gt6);                 /* 2.0*GRADIENT_DELAY */
   delay( gstab   -pwN*0.5 +pw*(2.0/3.1415-0.5) );
   rgpulse(2.0*pw, zero, rof1, rof1);
   dec2power(dpwr2); decpower(dpwr);			      
   zgradpulse(g6bal*gzlvl6*icosel, gt6);		        /* 2.0*GRADIENT_DELAY */
   delay(gstab +2.0*POWER_DELAY );
   status(C);
	setreceiver(t31);
}	 
Esempio n. 20
0
void hline(int x,int y,int x2,int c)
{
	if (x2>x) pbox(x,y,x2-x+1,1,c); else pbox(x2,y,x-x2+1,1,c);
}