# 1 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
; WSN_test17.go was WSN_test13A.go, now just adding full rad damping supp gradients
; Was WSN_test9.go, but now cycling ph13=0 2 instead of fixed phase = 0.
; WAS fhsqcf3gpph_WSNOESY_SelNOfb6.go  was fhsqcf3gpph_WSNOESY_SelNOfb2.go           adapting from fhsqcf3gpph_WSNOESY_Selfb3.go 
; was fhsqcf3gpph_waterSelROESY5d.go, now SL on +y not -x...
;fhsqcf2gpph
;avance-version (12/01/11)
;2D H-1/X correlation via double inept transfer
;phase sensitive
;with decoupling during acquisition
;
;S. Mori, C. Abeygunawardana, M. O'Neil-Johnson & P.C.M. van Zijl,
;   J. Magn. Reson. B 108, 94-98 (1995)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=


# 1 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl" 1
;Avance4.incl
;   for AV 4
;
;avance-version (16/08/18)
;
;$CLASS=HighRes Incl
;$COMMENT=
# 19 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl"
;setrtp0 denotes TimingController


# 50 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl"
# 51 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl"


# 63 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl"
# 89 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl"
# 90 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl"


# 123 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl"
;#define LOWQ
;#define HIGHQ


;#define MIX_UP
;#define MIX_DOWN
# 136 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Avance.incl"
;$Id: Avance4.incl,v 1.11 2016/11/11 13:43:39 ber Exp $
# 21 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk" 2

# 1 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Grad.incl" 1
;Grad4.incl  -  include file for Gradient Spectroscopy
;   for AV 4
;
;avance-version (16/05/23)
;
;$CLASS=HighRes Incl
;$COMMENT=

# 26 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Grad.incl"
define list<gradient> EA=<EA>


# 30 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Grad.incl"
;$Id: Grad4.incl,v 1.6 2016/11/11 13:43:39 ber Exp $
# 22 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk" 2

# 1 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Delay.incl" 1
;Delay.incl  -  include file for commonly used delays
;
;version (13/08/07)
;
;$CLASS=HighRes Incl
;$COMMENT=

# 9 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Delay.incl"
;general delays

define delay DELTA
define delay DELTA1
define delay DELTA2
define delay DELTA3
define delay DELTA4
define delay DELTA5
define delay DELTA6
define delay DELTA7
define delay DELTA8
define delay DELTA9
define delay DELTA10
define delay DELTA11
define delay DELTA12
define delay DELTA13
define delay DELTA14
define delay DELTA15
define delay DELTA16

define delay TAU
define delay TAU1
define delay TAU2
define delay TAU3
define delay TAU4
define delay TAU5
define delay TAU6
define delay TAU7
define delay TAU8
define delay TAU9
# 40 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Delay.incl"
define delay INCR1
define delay INCR2
define delay INCR3
define delay INCR4
define delay INCR5
define delay INCR6


;delays for centering pulses
# 50 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Delay.incl"
define delay CEN_HN1
define delay CEN_HN2
define delay CEN_HN3
define delay CEN_HC1
define delay CEN_HC2
define delay CEN_HC3
define delay CEN_HC4
define delay CEN_HP1
define delay CEN_HP2
define delay CEN_CN1
define delay CEN_CN2
define delay CEN_CN3
define delay CEN_CN4
define delay CEN_CP1
define delay CEN_CP2


;loop counters
# 69 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Delay.incl"
define loopcounter COUNTER
define loopcounter SCALEF
define loopcounter FACTOR1
define loopcounter FACTOR2
define loopcounter FACTOR3
define loopcounter FACTOR4
define loopcounter FACTOR5
define loopcounter FACTOR6


# 80 "/root/.topspin-BladeEpu/local_acqu/ppDirs/Delay.incl"
;$Id: Delay.incl,v 1.15 2013/08/30 09:42:06 ber Exp $
# 23 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk" 2

"p2=p1*2"
"p22=p21*2"
"d11=30m"
"d12=20u"
"d13=4u"
"d26=1s/(cnst4*4)"

; Shaped pulse calculations use params extracted from the following shape files:
# 33 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
; Shape file: sinc1.1000
; ##TITLE= Sinc: 1 cycle     
; ##$SHAPE_PARAMETERS= Type: Sinc ; Number of Cycles 1.0
; ##$SHAPE_EXMODE= Universal
; ##$SHAPE_TOTROT= 9.000000E01
; ##$SHAPE_TYPE= Excitation
; ##$SHAPE_BWFAC= 1.606000E00
; ##$SHAPE_INTEGFAC= 5.889000E-01


; Shape file: gaus1_90.1000
; ##TITLE= 90o pulse
; ##$SHAPE_PARAMETERS= Type: Gauss ; Truncation Level [%] 1.0
; ##$SHAPE_EXMODE= Universal
; ##$SHAPE_TOTROT= 9.000000E01
; ##$SHAPE_TYPE= Excitation
; ##$SHAPE_BWFAC= 2.122000E00
; ##$SHAPE_INTEGFAC= 4.115776E-01
# 54 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
; CNST2 is selective pulse BW in Hz. 
; CNST19 is selective pulse target offset in PPM. 
; CNST12 is selective 180 BW in Hz. 
; CNST20 is selective 180 target offset in PPM.

; ==== Calc for sinc ==== 
"p50=1.6060/(cnst2/1000000)"                             ; sinc "BW_FAC" is 1.606000E00
"spw50=plw1*(pow((90.0/90.0)*(p1/p50)/0.5889,2))"        ; sinc "INTEG_FAC" is 5.889000E-01
"spoff50=bf1*(cnst19/1000000)-o1"                        ; sinc offset. n.b. Need to use "spoff" not "spoffs" in these calcs!
;"spoal50=0"
;"spnam50=sinc1.1000"

; ==== Calc for sinc #2 ==== 
"p52=1.6060/(cnst2/1000000)"                             ; sinc "BW_FAC" is 1.606000E00
"spw52=plw1*(pow((90.0/90.0)*(p1/p52)/0.5889,2))"        ; sinc "INTEG_FAC" is 5.889000E-01
"spoff52=bf1*(cnst19/1000000)-o1"                        ; sinc offset. n.b. Need to use "spoff" not "spoffs" in these calcs!
;"spoal52=1"
;"spnam52=sinc1.1000"
# 73 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
; ==== Calc for PC9 ==== 
;;;;;"p50=7.512/(cnst2/1000000)"                             ; Standard PC9 "BW_FAC" is 7.512 (Brutscher BW_FAC is 7.2)
;;;;;"spw50=plw1*(pow((90.0/90.0)*(p1/p50)/0.125,2))"           ; PC9 "INTEG_FAC" is 0.1250034
;;;;;"spoff50=bf1*(cnst19/1000000)-o1"                           ; PC9 offset. n.b. Need to use "spoff" not "spoffs" in these calcs!
;"spoal50=0.5"
;"spnam50=Pc9_4_120.1000"


; ==== Calc for Gaus1_180r.1000 ==== 
"p51=0.8820/(cnst12/1000000)"                             ; Standard Gaus1_180r.1000 "BW_FAC" is 8.820000E-01
; "p51=0.8820/(cnst2*bf1/1000000)"                             ; Standard Gaus1_180r.1000 "BW_FAC" is 8.820000E-01
"spw51=plw1*(pow((p1*2/p51)/0.4115776,2))"                   ; Gaus1_180r.1000 "INTEG_FAC" is 4.115776E-01
"spoff51=bf1*(cnst20/1000000)-o1"                            ; Gaus1_180r.1000 offset.
;"spoal51=0.5" ;!!!! 1?? -- why not 0.5 ?????
;"spnam51=Gaus1_180r.1000"
# 90 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
"in0=inf1/2"

"d0=3u"

; OLD "d20=d21*0.50-p16-d16" ; D21 is exchange/NOE buildup delay
"d22=d21*0.50-d17-d18-p2-d17-d18" ; D22 is exchange/NOE buildup delay
# 97 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
"DELTA=d19-p22/2"
"DELTA1=d26-p16-d16-p27*3-d19*5-p1*2/PI"
"DELTA2=d26-p16-d16-p27*2-p0-d19*5-de-8u"
"DELTA4=p21*2/3.1416"

"DELTA3=d0+p2/2"

# 105 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
"TAU=d26-p16-4u"

"acqt0=0"
baseopt_echo

# 111 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
"l4=p15/(p25*2)"

# 1 "mc_line 113 file /root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk 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 = trunc(td1 / 2)"
"MCREST = d1 - d1"
"MCWRK = 0.142857*d1"
# 113 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
1 ze 
# 1 "mc_line 113 file /root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk exp. def. of mc cmd. after ze"
LBLAV, MCWRK
      "d0=d0orig + t1loop * in0 "
      "phval3 = (ph1loop % 4) * 90"
      MCWRK ip3 + phval3
      "phval6 = (ph1loop % 4) * 90"
      MCWRK ip6 + phval6
# 114 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
  d11 pl16:f2
# 1 "mc_line 115 file /root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk exp. start label for mc cmd."
2 MCWRK  * 3 do:f2
LBLF1, MCWRK  * 3
LBLST1, MCWRK 
  MCREST
# 116 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
3 d12 pl1:f1
  50u setrtp0|0 ctrlgrad 0

; ----- Start water selection echo block -----
;  (p1 ph11):f1   ; ph11=0 0 0 0  0 0 0 0  2 2 2 2  2 2 2 2
;  d16 pl0:f1
;  p16:gp10
;  d16
                      ;;;;;=====  (center (p2 ph1) (p22 ph6):f2 )
;(p51:sp51 ph12:r):f1  ;  (p51:sp51 ph12):f1    ; ORIGINAL MANUAL SHAPE SETUP  p12:sp2:f1 ph12:r  ; ph12=0 0 0 0  0 0 0 0  0 0 0 0  0 0 0 0
# 127 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
 ; d16 pl1:f1           ; Restore hard pulse power
;  p16:gp10
;  d16
;  (p1 ph13):f1
; ----- end of water selection echo block -----


; ----- Non-selective refocusing 180 -----
;  (p2 ph12) 
; or with x-channel 180 as well: (center (p2 ph12) (p22 ph6):f2 )
# 139 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
; ----- Start NOE block -----
; OLD  d20
; OLD  p16:gp20
; OLD  d16
; OLD  (p2 ph14):f1
; OLD  d16
; OLD  p16:gp20*-1
; OLD  d20

;d17 gron22
;d22
;d18 groff
;(p2 ph14):f1
;d17 gron23 ;gpz23 == gpz22*-1
;d22
;d18 groff

# 157 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
; ----- Start HSQC -----
  (p1 ph1)
  5u
  p16:gp1
  TAU pl3:f2
  (center (p2 ph10) (p22 ph6):f2 ) ;  (center (p2 ph1) (p22 ph6):f2 )
  5u
  p16:gp1
  TAU
  (p1 ph2) 


; ----- First flipback. Meant to put H2O on +Iz -----
;  25u pl0:f1 ; Zero the f1 power before shaped pulse
;  (p50:sp50 ph18):f1 
;  25u pl1:f1 ; Restore f1 power after shaped pulse
# 174 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
  4u
  p16:gp2
  d16 

  (p21 ph3):f2
  DELTA3
  (p22 ph3):f2
  DELTA4
  d0

  (p2 ph5)   ; (180 puts H2O on -Iz)
# 186 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
  d0
  DELTA4
  (p22 ph4):f2
  DELTA3
  (p21 ph4):f2

  4u
  p16:gp2
  d16

# 197 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
; ----- Second flipback. Meant to put H2O on -Iy -----
;  25u pl0:f1 ; Zero the f1 power before shaped pulse
;  (p52:sp52 ph19):f1 
;  25u pl1:f1 ; Restore f1 power after shaped pulse


  (p1 ph7) ; (Finally takes H2O from -Iy to +Iz. H2O remains on +Iz until next scan)
  DELTA1
  p16:gp3
  d16 pl18:f1
  p27*0.231 ph8
  d19*2
  p27*0.692 ph8
  d19*2
  p27*1.462 ph8
  DELTA
  (p22 ph1):f2
  DELTA
  p27*1.462 ph9
  d19*2
  p27*0.692 ph9
  d19*2
  p0*0.231 ph9
  4u
  p16:gp3
  d16
  4u setrtp0^0 ctrlgrad 4047
  DELTA2 pl16:f2
  go=2 ph31 cpd2:f2
# 1 "mc_line 226 file /root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk exp. mc cmd. in line"
  MCWRK  do:f2 wr #0 if #0 zd 

  "ph1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval3 = (ph1loop % 4) * 90"
      MCWRK ip3 + phval3
      "phval6 = (ph1loop % 4) * 90"
      MCWRK ip6 + phval6
  lo to LBLF1 times 2
  MCWRK 

  "t1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval3 = (ph1loop % 4) * 90"
      MCWRK ip3 + phval3
      "phval6 = (ph1loop % 4) * 90"
      MCWRK ip6 + phval6
  lo to LBLST1 times ST1CNT
  MCWRK 
  "t1loop=0"
  "ph1loop=0"
  MCWRK rf #0
  lo to LBLAV times tdav
# 227 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
exit 
  
# 230 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
ph1=0
ph2=1
ph3=0 2
ph4=0 0 0 0 2 2 2 2  ;ph4=0 0 ;;; 0 0 0 0 2 2 2 2
ph5=0 0 ;;; 0 0 2 2
ph6=0
ph7=2
ph8=1
ph9=3

ph10=0 0 2 2

# 243 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
ph11=0 ;;;;; ph11=0 0 0 0  0 0 0 0  2 2 2 2  2 2 2 2 
ph12=0 ;;;;; ph12=0 0 0 0  0 0 0 0  0 0 0 0  0 0 0 0  1 1 1 1  1 1 1 1   1 1 1 1  1 1 1 1 
ph13=2
ph14=0
ph15=0

ph18=2 ;First flipback, -X
ph19=2 ;Second flipback, -x

ph31=0 2 0 2 2 0 2 0  ;ph31=0 2 ;;; 0 2 0 2 2 0 2 0   2 0 2 0  0 2 0 2   2 0 2 0  0 2 0 2    0 2 0 2 2 0 2 0
# 255 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
;pl1 : f1 channel - power level for pulse (default)
;pl3 : f2 channel - power level for pulse (default)
;pl16: f2 channel - power level for CPD/BB decoupling
;pl18: f1 channel - power level for 3-9-19-pulse (watergate)
;sp3: f2 channel - shaped pulse 180 degree (adiabatic)
;p0 : f1 channel -  90 degree pulse at pl18
;                      use for fine adjustment
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p14: f2 channel - 180 degree shaped pulse for inversion (adiabatic)
;p16: homospoil/gradient pulse
;p21: f2 channel -  90 degree high power pulse
;p22: f2 channel - 180 degree high power pulse
;p27: f1 channel -  90 degree pulse at pl18
;d0 : incremented delay (2D)                         [3 usec]
;d1 : relaxation delay; 1-5 * T1
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d13: short delay                                    [4 usec]
;d16: delay for homospoil/gradient recovery
;d19: delay for binomial water suppression
;     d19 = (1/(2*d)), d = distance of next null (in Hz)
;d26 : 1/(4J(YH))
;cnst4: = J(YH)

;cnst2: Flipback BW in Hz. 
;cnst12: Selective 180 BW in Hz. 
;cnst19: Flipback target offset in PPM. 
;cnst20: Selective 180 target offset in PPM. 
;p51: Selective 180 pulse length
;spnam51: Default currently is Gaus1_180r.1000
;spoal51: Use 0.5 (but Dennis sees nice results with 1.0)

;d21: Exchange/NOE buildup delay
# 290 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
;gpz3: gradients during watergate 3919 (e.g. 60%)
;gpz10: gradients during water-selection block (e.g. 50%)
;gpz20: gradients during NOE block (e.g. 5-10%)

;spoal50: 0
;spnam50: sinc1.1000
;spoal52: 1
;spnam52: sinc1.1000

# 300 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
;inf1: 1/SW(X) = 2 * DW(X)
;in0: 1/(2 * SW(X)) = DW(X)
;nd0: 2
;ns: 8 * n
;ds: 16
;td1: number of experiments
;FnMODE: States-TPPI (or TPPI)
;cpd3: decoupling according to sequence defined by cpdprg3
;pcpd3: f2 channel - 90 degree pulse for decoupling sequence


;use gradient ratio:          gp 1 : gp 2 : gp 3
;                               50 :   80 :   30
# 314 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
;for z-only gradients:
;gpz1: 50%
;gpz2: 80%
;gpz3: 30%


;for magic angle gradients (MAG) with xyz-gradientsystem use instead:
# 322 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
;gpx1: 20%
;gpx2: 10%
;gpx3: 15%*k

;gpy1: 40%
;gpy2: 0%
;gpy3: 15%*k

;gpz1: 20%
;gpz2: 0%
;gpz3: 15%
# 334 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
;   with k = calibration constant from 1D magic angle gradient
;      calibration

;use gradient files:   
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.100

# 343 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
                                          ;preprocessor-flags-start
;LABEL_CN: for C-13 and N-15 labeled samples start experiment with 
;             option -DLABEL_CN (eda: ZGOPTNS)
                                          ;preprocessor-flags-end


# 350 "/root/.topspin-BladeEpu/local_acqu/ppDirs/WSN_test17_refhsqc.dk"
;$Id: fhsqcf2gpph,v 1.8.6.1 2012/01/31 17:56:22 ber Exp $
