# 1 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land"
;fixed inversion of 15N dim -lba 6/2017
;XHHY.crmn NHHC-type experiment with Y/X decoupling during t1/t2
;written by AL&GP&SL 9.12.2008
;modified by land from NHHC.ebm 6.2017
;p3 : proton 90 at power level pl2
;pl2 : proton Pi/2
;p15 : long contact time at pl1 (f3) and sp20 (f2)
;p16 : short contact time at pl1 (f3) and sp20 (f2)
;pl5 : X power level during contact
;sp20 : proton power level during first CP
;sp21 : proton power level during second CP
;p17 : short contact time at pl4 (f1) and sp0 (f2)
;pl4 : thrid CP (Y power level during contact)
;sp0 : proton power level during third CP
;pl12 : decoupling power level (if not pl13)
;pl13 : special decoupling power level
;pl16 WALTZ 15N decoupling power
;pl1 13C power level for pulses
;pl3 15N hard pulse
;p7  15N hard pulse
;p2 13C Pi/2
;d8 : mixing time
;d1 : recycle delay
;d21 : z filter time (no 1H power)
;cnst21 : on resonance, usually = 0
;pcpd2 : pulse length in decoupling sequence
;cpdprg2 : cw, tppm (at pl12), or lgs, cwlg. cwlgs (LG-decoupling 
;spnam0 : use e.g. ramp.100 for variable amplitude CP
;here pl13 is used instead of pl12)


# 1 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl" 1
;Avancesolids.incl
;   for TCU3
;
;version 1 28.2.2001, written by HF
;	   4.4.2006, complemented by Ste

;$CLASS=Solids INCL
;$COMMENT=definitions for setrtp and setnmr

;switch between 1H or 19F output (H amplifier) 
# 14 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;gating pulse for RX, ADC and HPPR auto mode


# 18 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;explicit blanking of preamp, receiver, adc, not implemented yet


# 26 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;generate dwell clock


;turn dwell clock on/off
# 32 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;


# 36 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;define data sampling for WAHUHA type experiments, samples analogue or digitally for d9, closes receiver


# 40 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;explicit transmitter blanking, not supported yet

;NCO switching, to be implemented

;$id: $
# 33 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land" 2
# 35 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land"
;#ifdef fslg
;#include <lgcalc.incl>
;cnst20 : RF field achieved at pl13
;cnst21 : on resonance, usually = 0
;cnst22 : positive LG offset
;cnst23 : negative LG offset
;cnst24 : additional LG-offset
;#endif 
;cnst11 : to adjust t=0 for acquisition, if digmod = baseopt

"acqt0=1u*cnst11"
"d0=0"
"in0=inf1"

# 1 "mc_line 49 file /opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land exp. def. part of mc cmd. before ze"
; dimension 2D; AQ_mode  (F1) States-TPPI
define delay MCWRK
define delay MCREST
define delay d0orig
"d0orig=d0"
define loopcounter t1loop
"t1loop=0"
define loopcounter ph1loop
"ph1loop=0"
define loopcounter ST1CNT
"ST1CNT = td1 / 2"
"MCREST = d1 - 100m"
"MCWRK = 0.200000*100m"

    dccorr
# 49 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land"
1 ze
# 1 "mc_line 49 file /opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land exp. def. of mc cmd. after ze"
LBLAV, MCWRK
      "d0=d0orig + t1loop * in0 "
      "phval12 = (ph1loop % 4) * -90"
      MCWRK ip12 + phval12
# 50 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land"
# 1 "mc_line 51 file /opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land exp. start label for mc cmd."
2 MCWRK  * 2 do:f2
LBLF1, MCWRK  * 2
LBLST1, MCWRK 
  MCREST
# 52 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land"
# 52 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land"
  ;1m do:f3
  1u pl1:f1 pl2:f2 pl3:f3
# 1 "/opt/topspin3.5pl6/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.5pl6/exp/stan/nmr/lists/pp/p15_prot.incl"
;$Id: p15_prot.incl,v 1.8 2013/01/29 15:40:14 ber Exp $
# 54 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land" 2

			;make sure p15 does not exceed 10 msec	
			;let supervisor change this pulseprogram if 
			;more is needed
;#ifndef 1		
			;disable protection file for long acquisition change decoupling power !!! or you risk probe damage
			;if you set the label 1 (ZGOPTNS -Dlacq), the protection is disabled

# 1 "/opt/topspin3.5pl6/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
# 6 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/aq_prot.incl"
;$CLASS=Solids INCL
;$COMMENT=protect against too long acquisition time

1m
if "aq < 50.1m" goto Passaq
2u 
print "acquisition time exceeds 50m limit!"
goto HaltAcqu
Passaq, 1m

;$Id: aq_prot.incl,v 1.8 2013/01/28 17:39:02 ber Exp $
# 62 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land" 2
# 63 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land"
			;allows max. 50 msec acquisition time, supervisor
			;may change  to max. 1s at less than 5 % duty cycle
			;and reduced decoupling field
;#endif

  1u fq=cnst21:f2
  (p3  ph1 pl2):f2  ;(ralign (p3 ph1 pl2):f2 (p7 ph13 pl3):f3)
  (p15 ph2 pl5):f3 (p15:sp20 ph10):f2 ;1H to 15N long contact pulse with square or ramp
  (p7 ph11 pl3):f3
  ;add shaped 180 pulse for selective seq.
  d21   ;z filter
  1u cpds2:f2
  (p7 ph12 pl3):f3
  ;(center (d0) (p2*2 pl1 ph0):f1) ;13C refocusing pulse during t1
	d0
  0.5u do:f2
  (p16 pl5 ph3):f3 (p16:sp21 ph4):f2 ;15N to 1H short contact pulse with square or ramp
  (p3 ph5 pl2):f2 ;1H flip-back pulse
  d8
;	1u fq=cnst22:f2              ; mixing time
  (p3 ph6 pl2):f2 ;1H 90 degree pulse
  (p17 pl4 ph7):f1 (p17:sp0 ph8):f2 ;1H to 13C short contact pulse with square or ramp
  
  1u cpds2:f2 ; 1u cpds3:f3 ;use cpdprg3=waltz16
  go=2 ph31  	
  1u do:f2 ; do:f3	
# 1 "mc_line 89 file /opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land exp. mc cmd. in line"
  MCWRK  wr #0 if #0 zd 

  "ph1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval12 = (ph1loop % 4) * -90"
      MCWRK ip12 + phval12
  lo to LBLF1 times 2
  MCWRK 

  "t1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval12 = (ph1loop % 4) * -90"
      MCWRK ip12 + phval12
  lo to LBLST1 times ST1CNT
  MCWRK 
  "t1loop=0"
  "ph1loop=0"
  MCWRK rf #0
  lo to LBLAV times tdav
# 90 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/NHHCzf.land"
HaltAcqu, 1m		;jump address for protection files
exit			;quit

ph0= 0
ph1= 1
ph2= 0
ph3=0 1
ph4={0}*4 {2}*4
ph5=1
ph6={0}*8 {2}*8
ph7={0}*16 {2}*16
ph8=1
ph10= 0
ph11= 1
ph12= 1 0 3 2
;ph13=1
ph31= 0 2 2 0 2 0 0 2
      2 0 0 2 0 2 2 0
      2 0 0 2 0 2 2 0
      0 2 2 0 2 0 0 2
