# 1 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi"
;lghetfqpi (TopSpin 2.1)
;
;HETCOR with FLSG during t1
;B.-J. van Rossum, H. Foerster, and H.J.M. deGroot, J. Magn. Reson. 124 (2003) 516-519
;A. Lesage, and L. Emsley, J. Magn. Reson. 148, 449-454 (2001)
;HF and JOS Oct. 2003
;
;Avance III version
;parameters:
;d1 : recycle delay
;pl1 : for X contact pulse
;pl2 : for 1H ramped contact pulse 
;pl11 : for X 180 degree pulse
;pl12 : for decoupling and excitation 1H
;pl13 : for homonuclear decoupling
;p2 : X 180 degre pulse
;p3 : 90 degree 1H pulse excitation
;p15 : contact pulse - short 50 - 200 us
;pcpd2 : pulse length in decoupling sequence
;cpdprg2 : cw, tppm15, SPINAL64
;cnst20 : LG-RF field as adjusted, in Hz used to calculate cnst22 and cnst23 +and - LG frequency
;cnst22 : +LG frequency offset 
;cnst23 : -LG frequency offset
;cnst24 : offset for proton evolution under LG, usually 0 - -2000
;spnam0 : shape for contact pulse: ramp.100 
;l3 : for dwell in t1 = 4*p5*l3*0.578
;ns : 2, n*4
;FnMODE: undefined
;mc2  : STATES-TPPI
;nd0  : 1
;WDW  : QSINE 
;SSB  : 3 
;zgoptns : -Dlacq, -Dlcp15
;
;
;$COMMENT=HETCOR (CP based), FLSG during t1, 180-degree pulse on X after t1/2
;$CLASS=Solids
;$DIM=2D
;$TYPE=cross polarisation
;$SUBTYPE=heteronuclear correlation


define loopcounter count
"count=td1/2"
# 1 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lgcalc.incl" 1
;$CLASS=Solids INCL
;$COMMENT=calculation of FSLG parameters
# 5 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lgcalc.incl"
"cnst21=0"			;make sure cp ist done with proton freq.
				;set by O2
"cnst22=cnst20/sqrt(2)+cnst24"		;cnst20=desired RF field in Hz
"cnst23=-cnst20/sqrt(2)+cnst24"	;negative offset is cnst23

"p5=((294/360)/(cnst20))*1e6"		;calculate 294 degree pulse from cnst20

;$id: $
# 45 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi" 2
# 46 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi"
			;calculate p5 and frequency offsets cnst22 and 23
define pulse pma
"pma=(p3*547)/900"

define delay t1incr
"in0=(0.578*l3*4*294/360)/cnst20"
"t1incr=in0"
"inf1=in0"
"l0=0"
;cnst11 : to adjust t=0 for acquisition, if digmod = baseopt
"acqt0=1u*cnst11"

# 1 "mc_line 58 file /opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi dc-measurement inserted automatically"

    dccorr
# 58 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi"
1 ze                             ; zero data
  t1incr
2 d1 do:f2                       ; recycle time, decoupler off
# 1 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/p15_prot.incl" 1
;p15_prot.incl
;avance-version (13/01/29)
;Test the rf on-time and duty cycle
;protect against too long contact time
;Test the rf on-time and duty cycle 
;
;$CLASS=Solids INCL
;$COMMENT=protect against too long contact time


1m
if "p15 < 10.1m" goto Passp15
2u
print "contact time exceeds 10msec limit!"
goto HaltAcqu
Passp15, 1m
# 20 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/p15_prot.incl"
;$Id: p15_prot.incl,v 1.2.18.4 2013/01/29 15:40:51 ber Exp $
# 62 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi" 2

			;make sure p15 does not exceed 10 msec 
			;let supervisor change this pulseprogram if 
			;more is needed

# 68 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi"
			;disable protection file for long acquisition change decoupling power !!! or you risk probe damage
			;if you set the label lacq (ZGOPTNS -Dlacq), the protection is disabled

# 1 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/aq_prot.incl" 1
;aq_prot.incl
;avance-version (13/01/28)
;Test the rf on-time and duty cycle
;protect against too long acquisition time

;$CLASS=Solids INCL
;$COMMENT=protect against too long acquisition time
# 9 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/aq_prot.incl"
1m
if "aq < 50.1m" goto Passaq
2u 
print "acquisition time exceeds 50m limit!"
goto HaltAcqu
Passaq, 1m

;$Id: aq_prot.incl,v 1.2.18.4 2013/01/28 17:40:19 ber Exp $
# 71 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi" 2

			;allows max. 50 msec acquisition time, supervisor
			;may change  to max. 1s at less than 5 % duty cycle
			;and reduced decoupling field
# 76 "/opt/topspin3.2.6/exp/stan/nmr/lists/pp/lghetfqpi"
20 d20
  (p1 pl1 ph20^):f1
  lo to 20 times l20
  1u fq=cnst23:f2 
  1u fq=cnst22:f2 
  1u fq=cnst21:f2                    ; set power level of f2
  (p3 pl12 ph0):f2
  (pma ph1):f2
3 (p5 ph3 fq=cnst22 pl13):f2	;fslg loop at pl13, LG frequ. 1
  (p5 ph4 fq=cnst23):f2		;fslg loop at pl13, LG frequ. 2
  lo to 3 times l0
  (center (p2 ph8 pl1):f1 (p5 ph3 fq=cnst22 p5 ph4 fq=cnst23):f2 )
4 (p5 ph3 fq=cnst22):f2 		;fslg loop at pl13, LG frequ. 1
  (p5 ph4 fq=cnst23):f2		;2 LG periods total
  lo to 4 times l0	
  (pma pl12 fq=cnst21 ph7):f2   ;minus magic angle pulse, flip back to xy plane
  (p15 ph2):f1 (p15:sp0 ph10):f2  ; cross polarisation,
				;use short contact times 
				;for direct connectivities only, 50-200 usec
  1u cpds2:f2                   ;start decoupling with tppm at pl12
  go=2 ph31
  1m                  
  10u do:f2
  100m wr #0 if #0 zd
  1m ip0
  lo to 2 times 2
5 1m iu0
  lo to 5 times l3
  ;1m rp0 			; for STATES method
  lo to 2 times count
HaltAcqu, 1m
exit

ph0=1 3
ph1=1
ph2=0 0 0 0 2 2 2 2 1 1 1 1 3 3 3 3  
ph3=0
ph4=2
ph7=3 
ph8=0 0 2 2
ph10=0
ph20=0 1 2 3
ph31=0 2 0 2 2 0 2 0 1 3 1 3 3 1 3 1

;$id: $
