# 1 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
; ccctocsy_nnh_pfg_lek_600_cp
; Avance version - 26 November 2013


# 47 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
# 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 $
# 49 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp" 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 $
# 50 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp" 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 $
# 51 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp" 2

;Define phases

# 58 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
;Define Pulses
define pulse pwh
       "pwh=p1"
define pulse pwmlev
       "pwmlev=p12"
define pulse pwn
       "pwn=p3"
;Carbon pulses when 13C carrier is at 43ppm:
define pulse pwc
       "pwc=p2"
define pulse pwcdip
       "pwcdip=p22"
define pulse pwcodec
       "pwcodec=p23"
;Carbon pulses when 13C carrier is at 58ppm/176ppm:
define pulse pwca90b
       "pwca90b=p24"
define pulse pwco180b
       "pwco180b=p25"
define pulse pwca180b
       "pwca180b=p25"
define pulse pwco90c
       "pwco90c=p24"
define pulse pwco180c
       "pwco180c=p25"
define pulse pwca180c
       "pwca180c=p25"
define pulse pwcadec  ; seduce90 for Ca dec
       "pwcadec=p26"
define pulse pwcbdec  ; wurst for selective Cb dec
       "pwcbdec=p27"
define pulse pwd
       "pwd=p4"
define pulse pwddec
       "pwddec=p41"

;Define delays
"d11=30m"
"in0=inf1/2"
"in10=inf2/2"

define delay taua
       "taua = d20"      ; < 1/4JCH ~ 1.8 ms
# 102 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
define delay taub
       "taub = d21"     ; ~ 0.3/JCH * 0.5,  1.05 ms

define delay tauc
       "tauc = d22"       ; < 1/4JCaCO ~ 3.6 ms ARRAY with Cb dec

define delay taud
       "taud = d23"       ; 1/4JCaCO, 4.9 ms
# 111 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
define delay taue
       "taue = d24"      ; < 1/4JNCO , ~ 12.4 ms

define delay bigTN
       "bigTN = d25"     ; < 1/4JNCO delay, N constant time period

define delay tauf
       "tauf = d26"       ; < 1/4JNH, ~ 2.2 ms
# 120 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
define delay zeta
define delay zeta1
       "zeta1=0.1u"
 
define delay bigT1
     "bigT1 = d14"  ; 650 us

define delay hscuba
      "hscuba = 30m"

;Define flags
;define f1180  ; set zgoptns -Df1180
# 135 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
 "d0=0.2u"


;define f2180  ; set zgoptns -Df2180
# 142 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
 "d10=0.2u"


;"acqt0=0"
;aqseq 321     ; Determines the order of acquisition when 'mc' macro is used.
# 148 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
define loopcounter ncyc
   "ncyc = l7"


# 153 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
define loopcounter ni
       " ni = td1/2"
define loopcounter zetacount
       "zetacount=1"
define loopcounter ni2
       "ni2 = td2/2"


# 165 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "cnst12=plw12" ; tpwrml - set max at 0.8W
  "cnst22=plw22" ; dpwrdip - set max at 65W
  "cnst23=plw23" ; dpwrcodec - set max at 10.0W
  "cnst24=plw24" ; dpwrcob - set max at 11.0W
  "cnst25=plw25" ; dhpwrcob - set max at 52.0W
  "cnst26=plw26" ; dpwrcadec - set max at 2.0W
  "cnst27=plw27" ; dpwrcbdec - set max at 2.0W
  "cnst28=spw25" ; dhpwrcob - set max at 52.0W
  "cnst29=spw30" ; dhdpwrcob - set max at 52.0W
  "cnst31=plw31" ; dpwr2 - set max at 6W

  "cnst4=plw4" ; dpwr3 pl4 - set max at 10.5W for 2H pulses
  "cnst41=plw41" ; dpwr3dec pl41 - set max at 1.5W

# 1 "mc_line 182 file /root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp exp. def. part of mc cmd. before ze"
; dimension 3D; AQ_mode  (F2) Echo-Antiecho (F1) States
define delay MCWRK
define delay MCREST
define delay d0orig
"d0orig=d0"
define delay d10orig
"d10orig=d10"
define loopcounter t2loop
"t2loop=0"
define loopcounter t1loop
"t1loop=0"
define loopcounter ph1loop
"ph1loop=0"
define loopcounter ph2loop
"ph2loop=0"
define loopcounter ST1CNT
"ST1CNT = trunc(td1 / 2)"
define loopcounter ST2CNT
"ST2CNT = trunc(td2 / 2)"
"MCREST = d11 - d11"
"MCWRK = 0.033333*d11"
# 182 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
# 182 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
1 ze
# 1 "mc_line 182 file /root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp exp. def. of mc cmd. after ze"
LBLAV, MCWRK
      "d0=d0orig + t1loop * in0 "
      "phval1 = (ph1loop % 2) * 90"
      "phval1 = (phval1 + t1loop * 180)%360"
      MCWRK ip1 + phval1
      "phval31 = (t1loop * 180)%360"
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 2) * 180"
      MCWRK ip9 + phval9
      "phval7 = (t2loop * 180)%360"
      MCWRK ip7 + phval7
      "phval31 = (phval31 + t2loop * 180)%360"
      MCWRK ip31 + phval31
      MCWRK
      "phval0 = ph2loop * 1"
      MCWRK setgrad EA
# 183 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"

; check validity of parameters

  if "d0 < 0.2u "
  {
   "d0=0.2u"
  }
# 191 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "d10 < 0.2u "
  {
   "d10=0.2u"
  }

# 204 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"

  if "p22 < 24u" 
  {
   2u
   print "error: pwcdip p22 incorrect"
   goto HaltAcqu
  }
# 212 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "cnst12 > 1.25"
  {
   2u
   print "error: tpwrml pl12 incorrect"
   goto HaltAcqu
  }

  if "cnst22 > 37.0"
  {
   2u
   print "error: dpwrdip pl22 incorrect"
   goto HaltAcqu
  }

  if "cnst23 > 10.0"
  {
   2u
   print "error: dpwrcodec pl23/spw23 for CO seduce dec incorrect"
   goto HaltAcqu
  }
# 233 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "cnst24 > 12.0"
  {
   2u
   print "error: dhpwrb pl24 incorrect"
   goto HaltAcqu
  }

  if "cnst25 > 60.0"
  {
   2u
   print "error: dvhpwrb pl25 incorrect"
   goto HaltAcqu
  }

  if "cnst28 > 60.0"
  {
   2u
   print "error: spw25 incorrect"
   goto HaltAcqu
  }
# 254 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "cnst29 > 60.0"
  {
   2u
   print "error: spw30 incorrect"
   goto HaltAcqu
  }

  if "cnst26 > 8.0"
  {
   2u
   print "error: dpwrcadec pl26/spw26 for Ca seduce(90) dec incorrect"
   goto HaltAcqu
  }

  if "cnst27 > 2.0"
  {
   2u
   print "error: dpwrcbdec pl27/spw27 for Cb wurst(90) dec incorrect"
   goto HaltAcqu
  }
# 275 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "cnst31 > 6.0"
  {
   2u
   print "error: dpwr2 pl31 incorrect"
   goto HaltAcqu
  }

  if "ncyc > 9"
  {
   2u
   print "error: ncyc is too large"
   goto HaltAcqu
  }

  if "pwcdip*94.22*ncyc > 30m"
  {
   2u
   print "error: dipsi time is too large"
   goto HaltAcqu
  }
# 299 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
if "in0*2*(ni-1) > 8.2m"
  {
   2u
   print "error: acq time in t1 is too large"
   goto HaltAcqu
  }


# 308 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "cnst4 > 10.5"
  {
   2u
   print "error: dpwr3 pl4 too large"
   goto HaltAcqu
  }

  if "cnst41 > 2.0"
  {
   2u
   print "error: dpwr3dec pl41 too large"
   goto HaltAcqu
  }

  if "pwd < 100.0u"
  {
   2u
   print "error: pwd is too short > 100 us"
   goto HaltAcqu
  }
# 329 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "pwddec < 300.0u"
  {
   2u
   print "error: pwddec is too short > 300 us"
   goto HaltAcqu
 }

;  d11  
  50u setrtp0|0    ; turn on lock hold
  d11 h2pulse       ;SEL_2H plus interleave_incr    ; put lock to pulse mode
  2u pl41:f4

# 1 "mc_line 342 file /root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp exp. start label for mc cmd."
2 MCWRK  * 7 do:f3
LBLF2, MCWRK  * 7
LBLST2, MCWRK  * 8
LBLF1, MCWRK  * 7
LBLST1, MCWRK 
  MCREST
# 343 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
# 345 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
d11 h2lock         ;SEL_2H plus interleave_incr    ; put lock channel in lock mode
6m setrtp0^0   ; turn off lock hold

# 363 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
 2u pl1:f1                        ; power(tpwr)
 d1                               ; delay(d1)

# 367 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
50u  setrtp0|0
15u h2pulse       ;SEL_2H plus interleave_incr

# 392 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"

  2u pl3:f3
  2u fq=0:f2                             ;13C SFO2 @ 43ppm
  2u pl2:f2                              ;power for C90
  2u pl1:f1   
# 398 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
; ensure magnetization originates on 1H not on C or N
  (pwc ph=0.0):f2  
  2u
  (pwn ph=0.0):f3  


  20u ctrlgrad 0 ; this unblanks the gradients, lock is already in hold mode from above
# 409 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u
  (p50:gp0)                      
  d16

; This is the real start

  (pwh ph=0.0):f1                                 ; H90x
# 417 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u
  p51:gp1                                       ; gradient 1
  d16 

  "DELTA = taua - 2.0u - p51 - d16"
   DELTA                                         ; dly 1/4JCH

  (center (pwh*2 ph26):f1 (pwc*2 ph26):f2)        ; H180xC180x
# 426 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
   DELTA                                         ; dly 1/4JCH

  2u
  p51:gp1                                       ; gradient 1
  d16

  (pwh ph=90.0):f1                                  ; H90y
# 438 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u pl4:f4
  (pwd ph=90.0):f4
  2u pl41:f4
  (2u ph=0.0):f4
  (2u cpds4 ph=0.0):f4                          ;2H dec ON


2u
# 454 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "ni > 1" {
      "zeta = (taub - 18.0u - p52 - d16 - pwd - 5u)/(ni - 1)"
    }
   else {
      "zeta = 0.1u"
  }

# 469 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"

  if " zeta < 0.1u "
  {
   2u
   print "error: problem with zeta"
   goto HaltAcqu
  }
# 482 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
   "zetacount = trunc(d0/in0 + 0.4)"
   "zeta1 = zeta*zetacount"


if "zeta > in0" {
     "zeta1 = 0.2u"
}
# 493 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  (pwc ph1):f2                                  ; C90(ph1)

  2u
  p52:gp2                                       ; Gradient 2
  d16 pl23:f2                                   ; power for CO dec 

  
  (2u cpds5 ph=0.0):f2                            ; CO dec ON (off res seduce)
# 502 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  d0                                                ; t1/2

  (pwn*2 ph=0.0):f3                                    ; N180x

# 507 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = taub - 2u - p52 - d16 - 2u - pwn*2 - pwh*2 - 6u - pwd - 2u"   
   DELTA


# 514 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  (pwh*2 ph=0.0):f1                                    ; H180x
  
  "DELTA = d0 - zeta1"
   DELTA


  2u do:f2                                      ; CO dec off     
# 523 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u do:f4                                      ; 2H dec OFF
  2u pl4:f4
  (pwd ph=270.0):f4


  2u pl2:f2                                          ; power for C 180
  (pwc*2 ph=0.0):f2                                    ; C 180x
# 531 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u pl23:f2                                         ; power for CO seduce dec
  
  2u
  p52:gp2                                             ; gradient 2
  d16


  2u pl4:f4
  (pwd ph=90.0):f4
  2u pl41:f4
  (2u ph=0.0):f4
  (2u cpds4 ph=0.0):f4                          ;2H dec ON
# 545 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  
  (2u cpds5 ph=0.0):f2                            ; CO dec ON (off res seduce)


  "DELTA = taub - zeta1 - 18u - p52 - d16 - pwd"
# 553 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  DELTA


  2u do:f2                                      ; CO dec off     
# 558 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u pl2:f2                                     ; power for C90
  (pwc ph=90.0):f2                                  ; C 90y


# 563 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u do:f4                                      ; 2H dec OFF
  2u pl4:f4
  (pwd ph=270.0):f4


  (pwh ph=180.0):f1                                    ; H90(-x)
# 570 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u
  p53:gp3                                             ; gradient 3
  d16 pl22:f2                                        ; power for 13C tocsy


# 576 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  if "ncyc >= 1" 
  {
    "DELTA = pwcdip*94.22*ncyc"
    (DELTA cpds2 ph=0.0):f2                                ; cpds2="flopsy8" on
     2u do:f2                                          ; tocsy off 
   }


 
  2u fq=cnst2:f2                           ; 13C SFO2+cnst2(Hz) @ 58ppm
# 587 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u
  p53:gp3                                             ; gradient 3
  d16 pl24:f2                                        ; power for 13Ca90b 

  "DELTA = 3.4m - 6u - p53 - d16 "
   DELTA

# 596 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
   2u pl12:f1                                       ; power for 1H dec
   (pwmlev ph=90.0):f1                                  ; H90y @ powe pl12
   (2u cpds1 ph=0.0):f1                               ; waltz16x ON


  2u pl4:f4
  (pwd ph=90.0):f4
  2u pl41:f4
  (2u ph=0.0):f4
  (2u cpds4 ph=0.0):f4                          ;2H dec ON
# 608 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  (pwca90b ph2):f2                            ; Ca90b(PH2)

  2u                                         
  (pwco180b:sp25 ph=0.0):f2                            ; shaped CO180x Bloch Seigert

  
  2u pl27:f2                                         ; power for Cb decoupling
  (2u cpds7 ph=0.0):f2                                 ;  Cb dec ON
# 617 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = tauc - 2u - pwco180b - 2u - 2u - 2u - 2u" 
   DELTA                                              ; dly 1/4JCaCO


  2u do:f2                                            ; Cb dec off
  2u pl25:f2                                         ; power for Ca/CO 180b
# 624 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  (pwca180b ph3):f2                                  ; Ca180(PH3)
  2u
  (pwco180b:sp25 ph=0.0):f2                            ; shaped CO180x 


  2u pl27:f2                                         ; power for Cb decoupling
  (2u cpds7 ph=0.0):f2                                 ; Cb dec ON
# 632 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = tauc - 2u - pwco180b - 2u -2u - 2u - 2u"
   DELTA                                               ; dly 1/4JCaCO

  2u do:f2                                            ; Cb dec off
  2u pl24:f2                                         ; power for Ca 90b
  (pwca90b ph=90.0):f2                                   ; Ca90y

  
  2u do:f1                                           ; 1H dec OFF
  
  (pwmlev ph=270.0):f1                                  ; H90-y at pl12
# 647 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u do:f4                                      ; 2H dec OFF
  2u pl4:f4
  (pwd ph=270.0):f4
  2u pl41:f4


  2u
  p54:gp4                                             ; gradient4 
  d16 
# 659 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
;  2u fq=0:f2   ; jump back to 43 ppm 
  10u
  2u fq=cnst3:f2   ; jump from 43 to 176 ppm 

  2u pl24:f2                                          ; power for CO90b
  (pwco90c ph4):f2                              ;  CO90(PH4) 

  2u pl25:f2
  "DELTA = taud - pwca180c -2u" 
   DELTA
                                                ; dly 1/4JCaCO
  (pwca180c:sp30 ph=0.0):f2                                  ; Ca180x
# 672 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = taue - taud"
   DELTA  pl25:f2                                           ; dly 1/4JNCO (-1/4JCaCO) 

  (pwco180c ph5):f2                                   ;  CO180 (PH5) 
  2u                                           
  (pwn*2 ph6):f3                                      ; N180 (PH6)

  "DELTA = taue - 2u - pwn*2 - pwca180c - 2u"
   DELTA                                                ; dly 1/4JNCO
# 682 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  (pwca180c:sp30 ph=0.0):f2                                  ; Ca180x Bloch Seigert

  2u pl24:f2                                          ; power for CO90b
  (pwco90c ph=0.0):f2                                  ; CO90x

  2u
  p55:gp5                                             ; Gradient 5
  d16 
# 691 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  (pwmlev ph=90.0):f1                              ; H90y at power pl12
  
  (2u cpds1 ph=0.0):f1                             ; 1H dec ON (waltz16x)

  
  2u pl26:f2                                    ; power forCa dec
  (2u cpds6 ph=0.0):f2                            ; Ca dec ON (on res seduce)

if "bigTN - d10 > 0.2u" {
# 701 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  (pwn ph7):f3                                  ; N90(PH7)

  "DELTA = bigTN - d10"                         ; dly 1/(4JNCO) - t2/2
  DELTA

# 707 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u do:f2                                      ; Ca dec off 
  2u pl25:f2                                    ; power for CO180b

  (pwn*2 ph8):f3                                ; N180(PH8)
   1u
  (pwco180c ph=0.0):f2                       ; CO180x

  
  2u pl26:f2                                    ; power forCa dec
  (2u cpds6 ph=0.0):f2                            ; Ca dec ON (on res seduce)
# 718 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = bigTN + 2u + 2u - 1u - pwco180c -2u -2u + d10 - 5.5m"   
  DELTA
}
else {
  (pwn ph7):f3                                  ; N90(PH7)
  1u
  (pwn*2 ph8):f3

  "DELTA = d10 - bigTN"                         ; dly 1/(4JNCO) - t2/2
  DELTA

# 730 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u do:f2                                      ; Ca dec off 
  2u pl25:f2                                    ; power for CO180b

  (pwco180c ph=0.0):f2                       ; CO180x

  
  2u pl26:f2                                    ; power forCa dec
  (2u cpds6 ph=0.0):f2                            ; Ca dec ON (on res seduce)
# 739 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = bigTN + 1u - 2u - 2u - pwco180c -2u -2u + d10 - 5.5m"   
   DELTA
}
0.2u

  
  2u do:f1                                      ; H dec off
  (pwmlev ph=270.0):f1                               ; H90-x at pl12

  "DELTA = 5.5m - 0.2u - 2u - pwmlev - 2u - 2u - 2u - p56 - 1.0m - 2u"
   DELTA
# 751 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  
  2u do:f2                                    ; Ca dec off
  2u pl21:f2                                  ; lower C power

  2u
  p56:gp6                      ; gradient6 coherence selection 
  1m
  
  2u pl1:f1                                ; power for pwh

  (center (pwh ph26):f1 (pwn ph9):f3)        ; H90x,N90(ph9)
# 763 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u pl24:f2
  (pwco90c ph=0.0):f2

  2u
  p57:gp7                                    ; gradient 7
  d16

  "DELTA = tauf - 2u - pwco90c - 2.0u - p57 - d16"            ; dly 1/4JNH
  DELTA
 
  (center (pwh*2 ph26):f1 (pwn*2 ph26):f3)   ; H180x,N180x
# 775 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = tauf - 2.0u - p57 - d16"            ; dly 1/4JNH
  DELTA

  2u
  p57:gp7                                    ; gradient 7
  d16

  (center (pwh ph27):f1 (pwn ph29):f3)         ; H90y,N90y
# 784 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = tauf - 2.0u - p58 - d16 - (pwn - pwh)*0.5"            ; dly 1/4JNH
  DELTA

  2u
  p58:gp8                                    ; gradient 8
  d16
 
  (center (pwh*2 ph26):f1 (pwn*2 ph26):f3)   ; H180x,N180x

  2u
  p58:gp8                                    ; gradient 8
  d16
# 797 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  "DELTA = tauf - 2.0u - p58 - d16"            ; dly 1/4JNH
  DELTA

  (pwh ph=0.0):f1                              ; H90x

  "DELTA = bigT1 - pwh*2/PI"
  DELTA                                     ; dly DELTA
# 805 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  (pwh*2 ph=0.0):f1

  2u
  p59:gp9*EA                                    ; gradient 9 coherence selection
  d16                                 

# 812 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  4u ctrlgrad 4047                                ; Blank gradients


# 817 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
  2u pl31:f3

  "DELTA = bigT1 - 2u - p59 - d16 - 4u - 2u - de"
  DELTA                                     ; dly DELTA

  go=2 ph31 cpd3:f3
# 1 "mc_line 823 file /root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp exp. mc cmd. in line"
  MCWRK  do:f3 wr #0 if #0 zd 

  "ph2loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval1 = (ph1loop % 2) * 90"
      "phval1 = (phval1 + t1loop * 180)%360"
      MCWRK ip1 + phval1
      "phval31 = (t1loop * 180)%360"
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 2) * 180"
      MCWRK ip9 + phval9
      "phval7 = (t2loop * 180)%360"
      MCWRK ip7 + phval7
      "phval31 = (phval31 + t2loop * 180)%360"
      MCWRK ip31 + phval31
      MCWRK
      "phval0 = ph2loop * 1"
      MCWRK setgrad EA
  lo to LBLF2 times 2
  MCWRK 

  "t2loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval1 = (ph1loop % 2) * 90"
      "phval1 = (phval1 + t1loop * 180)%360"
      MCWRK ip1 + phval1
      "phval31 = (t1loop * 180)%360"
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 2) * 180"
      MCWRK ip9 + phval9
      "phval7 = (t2loop * 180)%360"
      MCWRK ip7 + phval7
      "phval31 = (phval31 + t2loop * 180)%360"
      MCWRK ip31 + phval31
      MCWRK
      "phval0 = ph2loop * 1"
      MCWRK setgrad EA
  lo to LBLST2 times ST2CNT
  MCWRK 
  "t2loop=0"
  "ph2loop=0"
  MCWRK 

  "ph1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval1 = (ph1loop % 2) * 90"
      "phval1 = (phval1 + t1loop * 180)%360"
      MCWRK ip1 + phval1
      "phval31 = (t1loop * 180)%360"
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 2) * 180"
      MCWRK ip9 + phval9
      "phval7 = (t2loop * 180)%360"
      MCWRK ip7 + phval7
      "phval31 = (phval31 + t2loop * 180)%360"
      MCWRK ip31 + phval31
      MCWRK
      "phval0 = ph2loop * 1"
      MCWRK setgrad EA
  lo to LBLF1 times 2
  MCWRK 

  "t1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval1 = (ph1loop % 2) * 90"
      "phval1 = (phval1 + t1loop * 180)%360"
      MCWRK ip1 + phval1
      "phval31 = (t1loop * 180)%360"
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 2) * 180"
      MCWRK ip9 + phval9
      "phval7 = (t2loop * 180)%360"
      MCWRK ip7 + phval7
      "phval31 = (phval31 + t2loop * 180)%360"
      MCWRK ip31 + phval31
      MCWRK
      "phval0 = ph2loop * 1"
      MCWRK setgrad EA
  lo to LBLST1 times ST1CNT
  MCWRK 
  "t1loop=0"
  "ph1loop=0"
  MCWRK rf #0
  lo to LBLAV times tdav
# 826 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
# 828 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
d11 h2lock         ;SEL_2H plus interleave_incr
d11 setrtp0^0
; d11 


HaltAcqu, 1m
exit
# 836 "/root/.topspin-BladeEpu/local_acqu/ppDirs/ccctocsy_nnh_pfg_lek_600_cp"
ph1=0 2      
ph2=0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2         
ph3=0 0 2 2
ph4=0 0 2 2
ph5=0
ph6=0 2
ph7=0
ph8=0 0 0 0 2 2 2 2
ph9=0
ph31=0 2 2 0 0 2 2 0 2 0 0 2 2 0 0 2 
ph26=0
ph27=1
ph28=2
ph29=3

;cnst2 : (58-43)ppm offset in Hz
;cnst3 : (176-43)ppm offset in Hz
;pl1 : tpwr - power level for pwh
;pl10 : tsatpwr - power level for 1H presat
;pl12 : tpwrml - power level for 1H waltz16
;pl2 : dhpwr - power level for C 90 and 180
;pl21 : dpwr - low power level for C (dec)
;pl22 : dpwrdip - power level for C tocsy
;pl23 : dpwrcodec - power level for CO seduce decoupling
;pl24 : dhpwrb - power level for Ca90b/CO90b
;pl25 : dvhpwrb - power level for CO180b/Ca180b
;pl26 : dpwrcadec - power level for Ca seduce decoupling
;pl27 : dpwrcbdec - power level for sel Cb decoupling
;pl3 : dhpwr2 - power level for pwn
;pl31 : dpwr2 - power level for 15N cpd
;pl4  : power level for 2H pulses
;pl41 : power level for 2H decoupling
;sp25 : power level for pwco180b (shaped pulse) when carrier is on Ca
;sp30 : power level for pwca180c (shaped pulse) when carrier is on CO
;p1 : pwh
;p12 : pwmlev - 1H 90 for waltz16dec at power pl12
;p2 : pwc
;p22 : pwcdip - 13C 90 at pl22 for C tocsy about 30 ms
;p23 : pwCOdec - pattern length us @ spw23 
;p24 : pwCO90c, pwca90b
;p25 : pwCO180b,pwCa180b,pwCO180c,pwCa180c
;p26 : pwCadec - pattern length us @ spw26
;p27 : pwCbdec - pattern length us @ spw27
;p3 : pwn
;p31 : pwn at dpwr2 for decoupling
;p4 : 2H high power pulse, 90
;p41 : 2H decoupling
;d1 : relaxation delay
;d11 : delay for disk i/o, 30ms
;d16 : gradient recovery delay, 200us
;d14 : bigT1, 650 us
;d20 : taua, H to C, 1.8ms
;d21 : taub, refocus JHC for 13C mag
;d22 : tauc, Ca to CO transfer, 3.6 ms 
;d23 : taud, Ca-CO J refocus, 4.9 ms 
;d24 : taue, N-CO J evolve, 12.4 ms
;d25 : bigTN, t2 evolv, N-CO refocus, 12.4 ms
;d26 : tauf, 1/4JNH, ~ 2.4 ms
;d30 : dummy variable - do not adjust
;cpds1: 1H decoupling according to program defined by cpdprg1 (waltz16)
;cpds2: C decoupling for tocsy according to program defined by cpdprg2 (flopsy8)
;cpd3 : 15N decoupling according to program defined by cpdprg3 (waltz16)
;cpds4 : 2H decoupling according to program defined by cpdprg4 (waltz16)
;cpds5: CO decoupling according to program defined by cpdprg3 (onepulse.sp23 off res seduce)
;cpds6: Ca decoupling according to program defined by cpdprg4 (seduce1)
;cpds7: Cb decoupling according to program defined by cpdprg7 (wurst2)
;pcpd3: 1/dmf2 - 90 degree pulse for cpd3
;l7 : ncyc, number of times flopsy is repeated; total_time = pwcdip*94.22*ncyc
;spnam23 : File name for CO decoupling sitting at 43 ppm
;spnam25 : File name for D/sq(3), +118p
;spnam26 : File name for Ca decoupling during 15N t2
;spnam27 : File name for Cb decoupling during Ca to Co transfer
;spnam30 : File name for Ca D/sq(3), -118p
;cpdprg2 : flopsy transfer
;cpdprg5 : CO decoupling while sit at 43 ppm
;cpdprg6 : Ca decoupling while carbon carrier at 176 ppm (mag is 15N)
;cpdprg7 : Cb decoupling while sit at 58 ppm
;zgoptns : Df1180,Df2180,DDdec, DoneDarray 

