/* gNhsqc.c */ #include #include "Pbox_bio.h" /* Pbox Bio Pack Pulse Shaping Utilities */ static int phx[1]={0}, phy[1]={1}, ph_x[1]={2}, ph_y[1]={3}, phi1[2] = {0,2}, phi2[4] = {0,0,2,2}, phi3[1] = {0}, phi9[8] = {0,0,0,0, 1,1,1,1}, rec[8] = {0,2,2,0, 2,0,0,2}; static double d2_init=0.0, d3_init=0.0; static shape rN180; pulsesequence() { /* DECLARE AND LOAD VARIABLES */ char f1180[MAXSTR], /* Flag to start t1 @ halfdwell */ f2180[MAXSTR], /* Flag to start t2 @ halfdwell */ C13refoc[MAXSTR], /* C13 sech/tanh pulse in middle of t1*/ shp_rN180[MAXSTR], waveN[MAXSTR]; int icosel, /* used to get n and p type */ t1_counter, /* used for states tppi in t1 */ t2_counter, /* used for states tppi in t2 */ ni2=getval("ni2"); double tau1, /* t1 delay */ tau2, /* t2 delay */ corr=0.0, mix = getval("mix"), /* NOESY mix time */ lambda = 0.91/(4.0*getval("JNH")), /* 1/4J H1 evolution delay */ tNH = 1.0/(4.0*getval("JNH")), /* 1/4J N15 evolution delay */ /* the sech/tanh pulse is automatically calculated by the macro "proteincal", */ /* and is called directly from your shapelib. */ pwClvl = getval("pwClvl"), /* coarse power for C13 pulse */ pwC = getval("pwC"), /* C13 90 degree pulse length at pwClvl */ rf0, /* maximum fine power when using pwC pulses */ rfst, /* fine power for the stCall pulse */ compH = getval("compH"), /* adjustment for H1 amplifier compression */ compN = getval("compN"), /* adjustment for N15 amplifier compression */ compC = getval("compC"), /* adjustment for C13 amplifier compression */ pwClw=getval("pwClw"), pwNlw=getval("pwNlw"), pwZlw = 0.0, /* largest of pwNlw and 2*pwClw */ bw, pws, ofs, ppm, nst, /* bandwidth, pulsewidth, offset, ppm, # steps */ pwr_rN180, pw_rN180, phshN180=getval("phshN180"), calH = getval("calH"), /* multiplier on a pw pulse for H1 calibration */ pwHs = getval("pwHs"), /* H1 90 degree pulse length at tpwrs */ tpwrs, /* power for the pwHs ("H2Osinc") pulse */ tpwrsf = getval("tpwrsf"), tpwrsf90 = getval("tpwrsf90"), phincr90 = getval("phincr90"), tpwrsf270 = getval("tpwrsf270"), phincr270 = getval("phincr270"), tpwrs180, tpwrsf180 = getval("tpwrsf180"), pwNlvl = getval("pwNlvl"), /* power for N15 pulses */ pwN = getval("pwN"), /* N15 90 degree pulse length at pwNlvl */ calN = getval("calN"), /* multiplier on a pwN pulse for calibration */ sw1 = getval("sw1"), gt1 = getval("gt1"), /* coherence pathway gradients */ gt2, /* coherence pathway gradients */ gzcal = getval("gzcal"), /* dac to G/cm conversion */ gzlvl1 = getval("gzlvl1"), gzlvl2 = getval("gzlvl2"), gt0 = getval("gt0"), /* other gradients */ gt3 = getval("gt3"), gt4 = getval("gt4"), gt5 = getval("gt5"), gstab = getval("gstab"), gstab1 = getval("gstab1"), gzlvl0 = getval("gzlvl0"), gzlvl3 = getval("gzlvl3"), gzlvl4 = getval("gzlvl4"), gzlvl5 = getval("gzlvl5"); getstr("f1180",f1180); getstr("f2180",f2180); getstr("C13refoc",C13refoc); getstr("waveN",waveN); /* LOAD PHASE TABLE */ settable(t1,2,phi1); settable(t2,4,phi2); settable(t3,1,phi3); settable(t4,1,phx); settable(t9,8,phi9); settable(t10,1,phx); settable(t11,1,phy); settable(t12,8,rec); /* INITIALIZE VARIABLES */ /* make sure phshN180 is always positive */ if (phshN180<0.0) phshN180=phshN180+360.0; /* allow the possibility of gt2 not being defined in the parameters */ if (find("gt2")>0) gt2=getval("gt2"); else gt2=0.1*gt1; /* maximum fine power for pwC pulses (and initialize rfst) */ rf0 = 4095.0; rfst=0.0; /* 180 degree adiabatic C13 pulse from 0 to 200 ppm */ if (C13refoc[A]=='y') {rfst = (compC*4095.0*pwC*4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)); rfst = (int) (rfst + 0.5); if ( 1.0/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35)) < pwC ) { text_error( " Not enough C13 RF. pwC must be %f usec or less.\n", (1.0e6/(4000.0*sqrt((30.0*sfrq/600.0+7.0)/0.35))) ); psg_abort(1); }} /* selective H20 one-lobe sinc pulse */ tpwrs = tpwr - 20.0*log10(pwHs/(compH*pw*1.69)); /*needs 1.69 times more*/ tpwrs = (int) (tpwrs); /*power than a square pulse */ tpwrs180 = (int) (tpwrs+6.0); /*double power for 180 flipback pulse */ /* reset calH and calN for 2D if inadvertently left at 2.0 */ if (ni>1.0) {calH=1.0; calN=1.0;} /* make small angle phase correction always positive */ if (phincr90<0.0) phincr90=phincr90+360.0; if (phincr270<0.0) phincr270=phincr270+360.0; setautocal(); /* activate auto-calibration flags */ if (autocal[0] == 'n') { } else /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */ { strcpy(shp_rN180,"rN180"); if(FIRST_FID) /* call Pbox */ { /* 180 inversion pulse on N15 */ bw=0.0; if (find("bwN")>0.0) bw=getval("bwN"); if (bw==0.0) bw=40.0*getval("dfrq2"); ofs==0.0; if (find("ofsN")>0.0) ofs=getval("ofsN"); rN180 = pbox_Rsh(shp_rN180, waveN, bw, ofs, compN*pwN, pwNlvl); } pwr_rN180 = rN180.pwr; pw_rN180 = rN180.pw; } /* CHECK VALIDITY OF PARAMETER RANGES */ if((dm[A] == 'y' || dm[B] == 'y' || dm[C] == 'y' )) { text_error("incorrect dec1 decoupler flags! Should be 'nnn' "); psg_abort(1); } if((dm2[A] == 'y' || dm2[B] == 'y')) { text_error("incorrect dec2 decoupler flags! Should be 'nny' "); psg_abort(1); } if( dpwr2 > 46 ) { text_error("don't fry the probe, DPWR2 too large! "); psg_abort(1); } if( pw > 50.0e-6 ) { text_error("dont fry the probe, pw too high ! "); psg_abort(1); } if (pwHs > (gt1 +gstab1 -WFG_START_DELAY -2.0*SAPS_DELAY -2.0*POWER_DELAY -2.0*PWRF_DELAY)) { text_error("pwHs is too long. Make pwHs shorter than %.1f microseconds", (gt1 +gstab1 -WFG_START_DELAY -2.0*SAPS_DELAY -2.0*POWER_DELAY -2.0*PWRF_DELAY)*1.0e6); psg_abort(1);} /* if( pwN > 100.0e-6 ) { text_error("dont fry the probe, pwN too high ! "); psg_abort(1); } */ /* calculate 3db lower power hard pulses for simultaneous CN decoupling during indirect H1 evoluion */ if (C13refoc[A] == 'y') { if (pwNlw==0.0) pwNlw = pwN*exp(3.0*2.303/20.0); if (pwClw==0.0) pwClw = pwC*exp(3.0*2.303/20.0); if (pwNlw > 2.0*pwClw) pwZlw=pwNlw; else pwZlw=2.0*pwClw; if (d2==0.0 && d3==0.0) printf(" pwClw = %.2f ; pwNlw = %.2f\n", pwClw*1e6,pwNlw*1e6); } /* LOAD VARIABLES */ if(ix == 1) d2_init = d2; t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5); if(ix == 1) d3_init = d3; t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5); /* Set up f1180 */ tau1 = d2; if((f1180[A] == 'y') && (ni > 1.0)) { tau1 += ( 1.0 / (2.0*sw1) ); if(tau1 < 0.2e-6) tau1 = 0.0; } tau1 = tau1/2.0; /* Set up f2180 */ tau2 = d3; if((f2180[A] == 'y') && (ni2 > 1.0)) { tau2 += ( 1.0 / (2.0*sw2) ); if(tau2 < 0.2e-6) tau2 = 0.0; } tau2 = tau2/2.0; /* Phase incrementation for hypercomplex 2D data, States-Haberkorn element */ if ( phase1 == 2 ) tsadd(t1, 1, 4); /* Hypercomplex in t1 */ if (phase2 == 1) {tsadd(t10,2,4); icosel = +1;} else icosel = -1; if(t1_counter %2) /* calculate modification to phases based on */ { tsadd(t1,2,4); tsadd(t12,2,4); } /* current t1 values */ if(t2_counter %2) /* calculate modification to phases based on */ { tsadd(t3,2,4); tsadd(t12,2,4); } /* current t2 values */ /* BEGIN PULSE SEQUENCE */ status(A); obspower(tpwr); obspwrf(4095.0); decpower(pwClvl); decpwrf(rf0); dec2power(pwNlvl); decoffset(dof-30*dfrq); /* move to center of all CH Carbon region */ txphase(zero); decphase(zero); dec2phase(zero); obsstepsize(1.0); initval(phincr90,v11); initval(phincr270,v12); txphase(t1); initval(135.0,v1); obsstepsize(1.0); xmtrphase(v1); delay(d1); rcvroff(); dec2rgpulse(pwN, zero, 0.0, 0.0); /*destroy N15 magnetization*/ zgradpulse(gzlvl0, 0.5e-3); delay(1.0e-4); zgradpulse(0.7*gzlvl0, 0.5e-3); decpwrf(rfst); delay(5.0e-4); rgpulse(pw, t1, rof1, rof1); /* H1 EVOLUTION BEGINS */ txphase(t2); xmtrphase(zero); if ((C13refoc[A]=='y') && (tau1 > pwZlw +2.0*pw/PI +3.0*SAPS_DELAY +2.0*POWER_DELAY +2.0*rof1)) { decpower(pwClvl-3.0); dec2power(pwNlvl-3.0); corr = pwZlw +2.0*pw/PI +SAPS_DELAY +2.0*POWER_DELAY +2.0*rof1; delay(tau1 -corr -2.0*SAPS_DELAY); if (pwNlw > 2.0*pwClw) { dec2rgpulse(pwNlw -2.0*pwClw,zero,rof1,0.0); sim3pulse(0.0,pwClw,pwClw,zero,zero,zero,0.0,0.0); decphase(one); sim3pulse(0.0,2*pwClw,2*pwClw,zero,one,zero,0.0,0.0); decphase(zero); sim3pulse(0.0,pwClw,pwClw,zero,zero,zero,0.0,0.0); dec2rgpulse(pwNlw -2.0*pwClw,zero,0.0,rof1); } else { decrgpulse(2.0*pwClw-pwNlw,zero,rof1,0.0); sim3pulse(0.0,pwNlw-pwClw,pwNlw-pwClw,zero,zero,zero,0.0,0.0); decphase(one); sim3pulse(0.0,2.0*pwClw,2.0*pwClw,zero,one,zero,0.0,0.0); decphase(zero); sim3pulse(0.0,pwNlw-pwClw,pwNlw-pwClw,zero,zero,zero,0.0,0.0); decrgpulse(2.0*pwClw-pwNlw,zero,0.0,rof1); } decpower(pwClvl); dec2power(pwNlvl); delay(tau1 -corr); } else if (tau1 > (pwN +2.0*pw/PI +2.0*SAPS_DELAY +2.0*rof1)) { corr = pwN +2.0*pw/PI +2.0*rof1; delay(tau1 -corr -2.0*SAPS_DELAY); dec2rgpulse(2.0*pwN, zero, rof1, rof1); delay(tau1 -corr); } else if (tau1 > 2.0*pw/PI +SAPS_DELAY) delay(2.0*tau1 -2.0*rof1 -4.0*pw/PI -2.0*SAPS_DELAY); /* H1 EVOLUTION ENDS */ rgpulse(pw, t2, rof1, rof1); txphase(zero); decpwrf(rfst); decoffset(dof); /* restore dof to 100ppm for CO/CA 180 */ delay(mix -gt0 -gstab); dec2rgpulse(2.0*pwN, zero, rof1, rof1); zgradpulse(gzlvl0,gt0); delay(gstab); /***********/ rgpulse(pw,zero,0.0,0.0); /* 1H pulse excitation */ txphase(zero); dec2phase(zero); zgradpulse(gzlvl4, gt4); delay(lambda -gt4); sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0); txphase(one); zgradpulse(gzlvl4, gt4); delay(lambda - gt4); rgpulse(pw, one, 0.0, 0.0); /***********/ xmtrphase(v11); txphase(zero); if (tpwrsf90<4095.0) { obspower(tpwrs+6.0); obspwrf(tpwrsf90); } else obspower(tpwrs); shaped_pulse("H2Osinc", pwHs, zero, 0.0, 0.0); if (tpwrsf90<4095.0) obspwrf(4095.0); obspower(tpwr); xmtrphase(zero); txphase(zero); zgradpulse(gzlvl3, gt3); dec2phase(t3); delay(gstab); dec2rgpulse(pwN, t3, 0.0, 0.0); decphase(zero); txphase(zero); dec2phase(t9); /* REGULAR HSQC EXPERIMENT */ if ( (C13refoc[A]=='y') && (tau2 > 0.5e-3 + WFG2_START_DELAY) ) { delay(tau2 - 0.5e-3 - WFG2_START_DELAY); /* WFG2_START_DELAY */ simshaped_pulse("", "stC200", 2.0*pw, 1.0e-3, zero, zero, 0.0, 0.0); /* for 180 flipback pulse use tpwrsf180 fine power and add 6db to coarse power */ if (tpwrsf180<4095.0) { txphase(two); obspower(tpwrs180+6.0); obspwrf(tpwrsf180); shaped_pulse("H2Osinc", pwHs, two, 0.0, 0.0); txphase(zero); obspower(tpwr); obspwrf(4095.0); delay(gt1 +gstab1 -pwHs -WFG_START_DELAY -2.0*SAPS_DELAY -2.0*POWER_DELAY -2.0*PWRF_DELAY); } else { txphase(two); obspower(tpwrs180); shaped_pulse("H2Osinc", pwHs, two, 0.0, 0.0); txphase(zero); obspower(tpwr); delay(gt1 +gstab1 -pwHs -WFG_START_DELAY -2.0*SAPS_DELAY -2.0*POWER_DELAY); } delay(tau2 - 0.5e-3); } else { delay(tau2); rgpulse(2.0*pw, zero, 0.0, 0.0); /* for 180 flipback pulse use same fine power and add 6db to coarse power */ if (tpwrsf<4095.0) { txphase(two); obspower(tpwrs+12.0); obspwrf(tpwrsf180); shaped_pulse("H2Osinc", pwHs, two, 0.0, 0.0); txphase(zero); obspower(tpwr); obspwrf(4095.0); delay(gt1 +gstab1 -2.0*pw -pwHs -WFG_START_DELAY -2.0*SAPS_DELAY -2.0*POWER_DELAY -2.0*PWRF_DELAY); } else { txphase(two); obspower(tpwrs+6.0); shaped_pulse("H2Osinc", pwHs, two, 0.0, 0.0); txphase(zero); obspower(tpwr); delay(gt1 +gstab1 -2.0*pw -pwHs -WFG_START_DELAY -2.0*SAPS_DELAY -2.0*POWER_DELAY); } delay(tau2); } /* dec2rgpulse(2.0*pwN, t9, 0.0, 0.0); */ dec2power(pwr_rN180); initval(phshN180, v3); dec2stepsize(1.0); dcplr2phase(v3); dec2shaped_pulse(shp_rN180,pw_rN180,t9,2.0e-6,2.0e-6); dec2phase(t10); dcplr2phase(zero); dec2power(pwNlvl); zgradpulse(gzlvl1, gt1); /* 2.0*GRADIENT_DELAY */ txphase(t4); delay(gstab1 - 2.0*GRADIENT_DELAY); /* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */ sim3pulse(pw, 0.0, pwN, t4, zero, t10, 0.0, 0.0); txphase(zero); dec2phase(zero); zgradpulse(gzlvl5, gt5); delay(lambda - 1.3*pwN - gt5); sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0); zgradpulse(gzlvl5, gt5); txphase(one); dec2phase(t11); delay(lambda - 1.3*pwN - gt5); sim3pulse(pw, 0.0, pwN, one, zero, t11, 0.0, 0.0); txphase(zero); dec2phase(zero); zgradpulse(1.5*gzlvl5, gt5); delay(lambda - 1.3*pwN - gt5); sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0); dec2phase(t10); zgradpulse(1.5*gzlvl5, gt5); delay(lambda - 0.65*pwN - gt5); rgpulse(pw, zero, 0.0, 0.0); delay(gt2 +gstab - 0.65*pw + 2.0*GRADIENT_DELAY + POWER_DELAY); rgpulse(2.0*pw, zero, 0.0, 0.0); dec2power(dpwr2); /* POWER_DELAY */ zgradpulse(icosel*gzlvl2, gt2); /* 2.0*GRADIENT_DELAY */ delay(0.5*gstab); rcvron(); statusdelay(C,0.5*gstab); setreceiver(t12); }