# 1 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"


# 1 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avance.incl" 1
;Avance3.incl
;   for AV III
;
;avance-version (13/06/17)
;
;$CLASS=HighRes Incl
;$COMMENT=


# 169 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avance.incl"
;$Id: Avance3.incl,v 1.10.2.2 2013/08/30 09:43:33 ber Exp $
# 25 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2" 2

# 1 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Grad.incl" 1
;Grad2.incl  -  include file for Gradient Spectroscopy
;   for TCU3
;
;avance-version (07/01/17)
;
;$CLASS=HighRes Incl
;$COMMENT=

# 27 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Grad.incl"
define list<gradient> EA=<EA>


# 31 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Grad.incl"
;$Id: Grad2.incl,v 1.14 2012/01/31 17:49:21 ber Exp $
# 26 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2" 2

# 1 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Delay.incl" 1
;Delay.incl  -  include file for commonly used delays
;
;version (13/08/07)
;
;$CLASS=HighRes Incl
;$COMMENT=

# 9 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/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 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/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 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/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 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/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 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Delay.incl"
;$Id: Delay.incl,v 1.14.2.1 2013/08/30 09:43:33 ber Exp $
# 27 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2" 2


;aqseq 321
# 31 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
;Define phases


# 37 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
;Define Pulses

define pulse dly_pg1            
               "dly_pg1=5m"
define pulse dly_pg2            
               "dly_pg2=dly_pg1/1.62"
define pulse pwh
       "pwh=p1"                 
define pulse pw_sl1
       "pw_sl1=p14"             
define pulse pwc_cp
       "pwc_cp=p2"              
                                
;Define delays

define delay  hscuba            
              "hscuba=25m"
# 55 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
define delay tau1

"in0=inf1/2"
"d11=30m"

define delay taua
       "taua=d2"   
# 63 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
define delay taub
       "taub=1.0s/(8*125.3)"  

define delay time_T2
       "time_T2=d13"         

define delay tauCPMG        
define delay tauCPMG1
define delay tauCPMG2
# 73 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
define list<loopcounter> ncyc_cp = <$VCLIST>

; define 1

# 78 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
"d0=(in0/2)"


# 85 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
   "cnst11=plw10" ; tsatpwr pl10 - set max at 0.00005W


# 93 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
   "cnst14=spw14" ; tpwrsl1 spw14 - set max at 1W for eburp1 pulse

   "cnst2=plw2"   ; dpwrcp pl2 - set max at 150.0W
   "cnst21=plw21" ; dpwr pl21 - set max at 2.0W

"l2=0"  ; pointer to the ncyc value
# 1 "mc_line 100 file /opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2 exp. def. part of mc cmd. before ze"
; dimension 3D; AQ_mode  (F2) QF (F1) States
define delay MCWRK
define delay MCREST
define delay d0orig
"d0orig=d0"
define loopcounter l2orig
"l2orig=l2"
define loopcounter t2loop
"t2loop=0"
define loopcounter t1loop
"t1loop=0"
define loopcounter ph1loop
"ph1loop=0"
define loopcounter ph2loop
"ph2loop=0"
define loopcounter ST1CNT
"ST1CNT = td1 / 2"
define loopcounter ST2CNT
"ST2CNT = td2 / 1"
"MCREST = d11 - d11"
"MCWRK = 0.071429*d11"

    dccorr
# 100 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
# 100 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
1 ze
# 1 "mc_line 100 file /opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2 exp. def. of mc cmd. after ze"
LBLAV, MCWRK
      "d0=d0orig + t1loop * in0 "
      "phval4 = (ph1loop % 2) * 90"
      "phval4 = (phval4 + t1loop * 180)%360"
      MCWRK ip4 + phval4
      "phval30 = (t1loop * 180)%360"
      MCWRK ip30 + phval30
      "phval31 = (t1loop * 180)%360"
      MCWRK ip31 + phval31
      "l2 = l2orig + t2loop * 1"

# 101 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"

; check validity of parameters

# 111 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  if " cnst10 > 0.00005"
  {
   2u
   print "error: tpwrmess pl11 too large"
   goto HaltAcqu
  }


# 129 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  if " cnst14 > 0.0085"
  {
   2u
   print "error: tpwrsl1 sp14 too large"
   goto HaltAcqu
  }


  if "time_T2 > 40m"
  {
   2u
   print "error: cpmg time time_T2 too long"
   goto HaltAcqu
  }
# 144 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  if "cnst2 > 150.0"
  {
   2u
   print "error: dpwrcp pl2 too large for CPMG"
   goto HaltAcqu
  }

  if " cnst21 > 2.8"
  {
   2u
   print "error: dpwr pl21 too large"
   goto HaltAcqu
  }

  if " pwc_cp < 14.0"
  {
   2u
   print "error: pwc_cp p2 too short (strong) for CPMG > 14u"
   goto HaltAcqu
  }
# 165 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  if " d1 < 1.5s"
  {
   2u
   print "error: d1 is too short"
   goto HaltAcqu
  }

# 1 "mc_line 172 file /opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2 exp. start label for mc cmd."
2 MCWRK  * 4 do:f2
LBLST2, MCWRK  * 5
LBLF1, MCWRK  * 4
LBLST1, MCWRK 
  MCREST
# 173 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"

; continue to check real time variables
# 176 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
"l5 = ncyc_cp[l2]"
"COUNTER = (trunc(l5 + 0.3))"   ; used subsequently for CPMG

if "COUNTER != 0"
  {
   "tauCPMG = time_T2*0.25/COUNTER - pwc_cp"
   "tauCPMG1=tauCPMG - pwc_cp*2.0/PI"
   "tauCPMG2=tauCPMG - pwh"
  }
else 
  {
   "tauCPMG = time_T2*0.25 - pwc_cp"
  }

if "tauCPMG + pwc_cp < 125.0u"
   {
     2u
     print "error: tauCPMG < 125u too short for CPMG"
     goto HaltAcqu
   }
# 197 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
if "COUNTER > 160"
{
     2u
     print "error: ncyc_cp value is too large"
     goto HaltAcqu
}

if "COUNTER !=0" {
  "tau1 = d0 - (pwh*4 + pwc_cp*2/PI)/2"
}
else {
  "tau1 = d0 - (pwh*2 + pwh*4 + pwc_cp*4/PI)/2"
}

if "tau1 < 0.2u" {
   "tau1 = 0.2u"
}
# 215 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  2u fq=cnst0:f1  ; set 1H freq on water cnst0=(tof_h2o - tof_me)*sfrq
  2u pl1:f1       ; set power pl1 for 1H hard pulses
  2u pl2:f2       ; set power pl2 for 13C hard pulses
  2u pl3:f3       ; set power pl3 for 15N hard pulses


# 229 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
 


  4u pl10:f1             ; dly 4u, set power tsatpwr pl10 for presat
  d1 cw:f1 ph=0.0          ; cw on for d1
  4u do:f1               ; dly 4u, cw off
  2u pl1:f1              ; set power tpwr pl1 for hard pulses
# 250 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
; destroy 13C magnetization

  (pwc_cp ph=0.0):f2        ; C90x

# 255 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
   
  (pw_sl1:sp14 ph=0.0):f1   ;shaped H90x on water 
  2u                      ;dly 2u
  2u pl1:f1               ;dly 2u, set pwr pl1 tpwr
  


  20u setnmr3|0 setnmr0|34|32|33 ctrlgrad 0           ; dly 20u, unblank gradients 
# 264 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  2u
  p51:gp1                 ; gradient1 gt1 @ gzlvl1
  d16                     ; dly d16 (200us)


# 277 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  2u fq=0:f1              ; set 1H freq on CH3 tof_me (sfo1) 

  2u
  p51:gp1*0.5             ; gradient1 gt1 @ gzlvl1
  d16                     ; dly d16 (200us)

; This is the real start.
# 287 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  2u pl1:f1               ;dly 2u, set pwr pl1 tpwr

  (pwh ph=0.0):f1                                    ; H90x

  2u    
  p52:gp2                                          ; gradient2
  d16  
# 295 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  "DELTA = taua*2.0  - pwh*2.0/PI - 2u - p52 - d16"
  DELTA                                            ; dly 1/(2*JCH)

  (pwc_cp ph1):f2                                  ; C90(PH1)

  2u                                        ; dly 2u
  p53:gp3                                   ; gradient 3
  d16                                       ; dly d16 (200u)
# 304 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  "DELTA = taub - 2u - p53 - d16"           ; dly 1/8JCH
  DELTA

  (center (pwh*2 ph26):f1 (pwc_cp*2 ph26):f2)  ; H180x,C180x

  2u                                        ; dly 2u
  p53:gp3                                   ; gradient 3
  d16                                       ; dly d16 (200u)
# 313 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  "DELTA = taub - 2u - p53 - d16"           ; dly 1/8JCH
   DELTA

  (pwc_cp ph2):f2                           ; C90(PH2)

# 320 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  if "COUNTER-1 == 0"
  {
   tauCPMG1
   (pwc_cp*2 ph=90.0):f2
   tauCPMG2
  }
  if "COUNTER-2 == 0"
  {
   tauCPMG1
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
   tauCPMG
   (pwc_cp*2 ph=90.0):f2
   tauCPMG2
  }
  if "COUNTER-2 > 0"
  {
   "l0=COUNTER-2"
   tauCPMG1
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
7  tauCPMG
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
   lo to 7 times l0
   tauCPMG
   (pwc_cp*2 ph=90.0):f2
   tauCPMG2
  }

  (pwh*2 ph3):f1                            ;H180(ph3)

  if "COUNTER-1 == 0"
  {
   tauCPMG2
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
  }
  if "COUNTER-2 == 0"
  {
   tauCPMG2
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
   tauCPMG
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
  }
  if "COUNTER-2 > 0"
  {
   "l0=COUNTER-2"
   tauCPMG2
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
8  tauCPMG
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
   lo to 8 times l0
   tauCPMG
   (pwc_cp*2 ph=90.0):f2
   tauCPMG
  }
# 382 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  tau1                                       ; t1/2

  (pwh ph=90.0):f1                              ; H90y
  (pwh*2 ph=0.0):f1                           ; H180x
  (pwh ph=90.0):f1                              ; H180y

  tau1
# 390 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  (pwc_cp ph4):f2                           ; C90(PH4)

  2u     
  p52:gp2                                   ; gradient2
  d16 

  20u setnmr3^0 setnmr0^34^32^33 ctrlgrad 7
# 398 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
if "COUNTER != 0"
  {
   "DELTA = taua*2.0 - 2u - p52 - d16 - 24u - pwc_cp + pwc_cp*2.0/PI"
    DELTA                                        ; dly 1/(2*JCH)
}
  else
  {
   "DELTA = taua*2.0 - 2u - p52 - d16 - pwc_cp - 24u "
    DELTA                                        ; dly 1/(2*JCH)
  }

# 515 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"

# 517 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
  4u pl21:f2                         ; lower power for 13C decoupling

   go=2 ph30 cpd2:f2

# 523 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
                       ; acquire fid with 13C decoupling during aq
# 1 "mc_line 524 file /opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2 exp. mc cmd. in line"
  MCWRK  do:f2 wr #0 if #0 zd 

  "t2loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval4 = (ph1loop % 2) * 90"
      "phval4 = (phval4 + t1loop * 180)%360"
      MCWRK ip4 + phval4
      "phval30 = (t1loop * 180)%360"
      MCWRK ip30 + phval30
      "phval31 = (t1loop * 180)%360"
      MCWRK ip31 + phval31
      "l2 = l2orig + t2loop * 1"

  lo to LBLST2 times ST2CNT
  MCWRK 
  "t2loop=0"
  MCWRK 

  "ph1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval4 = (ph1loop % 2) * 90"
      "phval4 = (phval4 + t1loop * 180)%360"
      MCWRK ip4 + phval4
      "phval30 = (t1loop * 180)%360"
      MCWRK ip30 + phval30
      "phval31 = (t1loop * 180)%360"
      MCWRK ip31 + phval31
      "l2 = l2orig + t2loop * 1"

  lo to LBLF1 times 2
  MCWRK 

  "t1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval4 = (ph1loop % 2) * 90"
      "phval4 = (phval4 + t1loop * 180)%360"
      MCWRK ip4 + phval4
      "phval30 = (t1loop * 180)%360"
      MCWRK ip30 + phval30
      "phval31 = (t1loop * 180)%360"
      MCWRK ip31 + phval31
      "l2 = l2orig + t2loop * 1"

  lo to LBLST1 times ST1CNT
  MCWRK 
  "t1loop=0"
  "ph1loop=0"
  MCWRK rf #0
  lo to LBLAV times tdav
# 528 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"

HaltAcqu, 1m
exit

ph1=0 2
ph2=1 1 3 3 
ph3=0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 
ph13=0 0 1 1 2 2 3 3
ph4=0
ph30=0 2 0 2 2 0 2 0                 ; small_protein 'y'
ph31=0 2 2 0
ph26=0
ph27=1
ph28=2
ph29=3
# 544 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/user/hmqc_c13exch_bigprot_600_lek_v2"
;pl1 : tpwr - power level for pwh
;pl10 : tsatpwr - power level for presat
;pl11 : tpwrmess - power level for Messerle purge
;pl14 : tpwrsl1 - power level for pw_sl1
;pl2 : dhpwr/dpwrcp - power level for 13C pulse pwc_cp (p2)
;pl21 : dpwr - power level for  13C decoupling cpd2
;p1 : pwh
;p14 : pw_sl1
;p2 : pwc_cp
;p21 : pwc90 at power dpwr=pl21 for decoupling
;sp14 : shape for pw_sl1
;d11 : delay for disk i/o, 30ms
;d13 : time_T2 CPMG relaxation period ~40ms
;d16 : gradient recovery delay, 200us
;cpd2 : 13C decoupling according to program defined by cpdprg2
;pcpd2: 1/dmf - 90 degree pulse for cpd2
;inf1 : 1/SW(X) = 2*DW(X)
;in0:1/(2*SW(x))=DW(X)
;nd0=2
;d1 : relaxation delay >= 1.5s
;d2 : taua set to approx 1/(4JCH) = 2 ms
;cnst0 : water (Hz) -  o1 (Hz)
;cnst1 : dtt (Hz) -  o1 (Hz)
;cnst2 : power in w for 13C cpmg pulses
;cnst21 : power in w for 13C decoupling
;cnst14 : power in w for eburp1 1H pulse to eliminate water
;d20 : internal delay , dont worry about setting; set in pulse sequence
;l0 : set internally , dont worry about
;l2 : internal loop used as pointer to ncyc_cp value - ignore
;l5 : internal loop counter used to set ncyc_cp - ignore
;zgoptns : Dwater_flg,Df1180,Dsmallp,Ddtt_flg,Dfsat,Dfscuba,Dmess_flg
