# 1 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
;hncocaTRv3.jlb
;updated 07-Apr-2011 
;15N evolution automatically extended past CT period if l3 > d0/in0
;Ca Constant Time option selectable - for perdeuterated samples
;see footer for NOTES 

;prosol relations=<triple.jlb>

# 1 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv" 1
;bits.jlb for datav500 console  (an AVIII console)
# 10 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
define pulse PG1
define pulse PG2
define pulse PG3
define pulse PG4
define pulse PG5
define pulse PG6
define pulse PG7
define pulse PG8
define pulse PG9
define pulse PG10
define pulse PG11
define pulse PG12
define pulse PG13
define pulse PG14
define pulse PG15
define pulse PG16
define pulse PG17
define pulse PG18
define pulse PG20
define pulse PG21
define pulse PG22
define pulse PG23
define pulse PG24
define pulse PG25
define pulse PG26
define pulse PG27
define pulse PG28
define pulse PG29
define pulse PG30
define pulse PG31


;Avance3.incl
;   for AV III
;
;avance-version (07/12/14)
;
;$CLASS=HighRes Incl
;$COMMENT=
# 206 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;$Id: Avance3.incl,v 1.6.2.2 2007/12/14 16:06:46 ber Exp $
;Delay.incl  -  include file for commonly used delays
;
;version 00/02/07
;
;$CLASS=HighRes Incl
;$COMMENT=


;general delays
# 217 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
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 TAU
define delay TAU1
define delay TAU2
define delay TAU3
define delay TAU4
define delay TAU5
# 240 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;delays for centering pulses

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

# 259 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;loop counters

define loopcounter COUNTER
define loopcounter SCALEF
define loopcounter FACTOR1
define loopcounter FACTOR2
define loopcounter FACTOR3

# 269 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;$Id: Delay.incl,v 1.12 2005/11/10 12:16:58 ber Exp $
;Grad2.incl  -  include file for Gradient Spectroscopy
;   for TCU3
;
;avance-version (07/01/17)
;
;$CLASS=HighRes Incl
;$COMMENT=


# 296 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
define list<gradient> EA=<EA>


# 300 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;$Id: Grad2.incl,v 1.12 2007/01/22 14:22:35 ber Exp $
;De2.incl
;   for AVi
;
;avance-version (08/02/15)
;
;$CLASS=HighRes Incl
;$COMMENT=


define delay rde1
# 313 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
"rde1=de-de1"


# 324 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;for multi receive


# 333 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;$Id: De2.incl,v 1.3.6.3 2008/02/15 15:18:53 ber Exp $
;Daz.incl
;
;Dante-Z
;version  00/02/07
;
;$CLASS=HighRes Incl
;$COMMENT=


define delay DZ_TAU
define delay DZ_TAU2
define delay DZ_TAU3
define delay DZ_DELT			; 1/Bandwidth (cnst8)
# 348 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
define pulse DZ_THET
define pulse DZ_THE2
define pulse DZ_THE3
define pulse DZ_180
define pulse DZ_180a
define pulse DZ_180b
define pulse DZ_180c

define loopcounter DZ_LC1
define loopcounter DZ_LC2
define loopcounter DZ_LC3
define loopcounter DZ_LC4
define loopcounter DZ_LC5

define pulse P_TOTAL
# 365 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
"DZ_THET=10u"
"DZ_THE2=10u*0.5"
"DZ_THE3=10u*0.25"

"DZ_DELT=1s/cnst8"

"DZ_LC1=DZ_DELT/(dw)"
"DZ_LC2=(DZ_DELT/(dw))/3"
"DZ_LC3=(DZ_DELT/(dw))*2/3"
"DZ_LC4=(DZ_DELT/(dw))*2/9"
"DZ_LC5=(DZ_DELT/(dw))*6/9"
# 377 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
"DZ_TAU=dw*0.5"
"DZ_TAU2=dw*0.5*(DZ_LC1/(DZ_LC2*2+DZ_LC3))"
"DZ_TAU3=dw*0.5*(DZ_LC1/(DZ_LC4*4+DZ_LC5))"

"DZ_180=DZ_THET*DZ_LC1*2"
"DZ_180a=DZ_THET*DZ_LC1*2"
"DZ_180b=DZ_THET*DZ_LC2*2+DZ_THET*DZ_LC3*2" 	
				;=DZ_THE2*DZ_LC2*4+DZ_THET*DZ_LC3*2
"DZ_180c=DZ_THET*DZ_LC4+DZ_THET*DZ_LC4*2+DZ_THET*DZ_LC5*2"
				;=DZ_THE3*DZ_LC4*4+DZ_THE2*DZ_LC4*4+DZ_THET*DZ_LC5*2

# 391 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;next four lines commented out by BF 10/07/19
;#define DAZ11(phase1,phase2)                    \n\
;        1001 (DZ_TAU) (DZ_THET phase1):f1     \n\
;             (DZ_TAU) (DZ_THET phase2):f1     \n\
;             lo to 1001 times DZ_LC1            


;#define DAZ363(phase1,phase2)                  \n\
;        1011 (DZ_TAU2) (DZ_THE2 phase1):f1     \n\
;             (DZ_TAU2) (DZ_THE2 phase2):f1     \n\
;             lo to 1011 times DZ_LC2           \n\ 
;        1012 (DZ_TAU2) (DZ_THET phase1):f1     \n\
;             (DZ_TAU2) (DZ_THET phase2):f1     \n\
;             lo to 1012 times DZ_LC3           \n\ 
;        1013 (DZ_TAU2) (DZ_THE2 phase1):f1     \n\
;             (DZ_TAU2) (DZ_THE2 phase2):f1     \n\
;             lo to 1013 times DZ_LC2            
# 410 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;#define DAZ22622(phase1,phase2)                \n\
;        1021 (DZ_TAU3) (DZ_THE3 phase1):f1     \n\
;             (DZ_TAU3) (DZ_THE3 phase2):f1     \n\
;             lo to 1021 times DZ_LC4           \n\ 
;        1022 (DZ_TAU3) (DZ_THE2 phase1):f1     \n\
;             (DZ_TAU3) (DZ_THE2 phase2):f1     \n\
;             lo to 1022 times DZ_LC4           \n\ 
;        1023 (DZ_TAU3) (DZ_THET phase1):f1     \n\
;             (DZ_TAU3) (DZ_THET phase2):f1     \n\
;             lo to 1023 times DZ_LC5           \n\ 
;        1024 (DZ_TAU3) (DZ_THE2 phase1):f1     \n\
;             (DZ_TAU3) (DZ_THE2 phase2):f1     \n\
;             lo to 1024 times DZ_LC4           \n\ 
;        1025 (DZ_TAU3) (DZ_THE3 phase1):f1     \n\
;             (DZ_TAU3) (DZ_THE3 phase2):f1     \n\
;             lo to 1025 times DZ_LC4            
;


# 430 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/bits.vv"
;$Id: Daz.incl,v 1.12 2005/11/10 12:16:58 ber Exp $
# 9 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr" 2


;--- SWITCHES ------
# 15 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
;#define DEUT_DEC
;#define CA_CT  ; selects Const. Time for Ca evolution


;Gradient Pulses
"PG1=1.8m"
"PG2=250u"
"PG3=800u"
"PG4=101u"   ;decoding
"PG5=500u"   ;half-encoding
"PG9=2m"
"PG10=2.4m"
"PG20=500u"
"PG21=500u"
"PG22=1m"
"PG23=500u"
"PG24=500u"
# 34 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
"l5=1"

"p2=p1*2"
"p22=p21*2"

"in10=in0"
"in9=in0"
# 42 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
"in19=in20"

"d7=p14*0.5-p1"
"d11=30m"
"d12=200u"
"d16=190u"  ;Grad Recovery
"d6=2.35m"
"d26=2.7m"
"d27=12m"
"d5=13m"   ;CT period for CA_CT
"d28=p27+5u+p1-p21"

"d0=12.5m-PG5-200u-larger(p14,p22)*0.5"
"d10=10u"
"d9=3u"
"d8=p14*0.5-p21-d9"
"d7=p14*0.5+d9-p21"
# 62 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
"d20=5u"
"d19=(d5-p14-4u)*0.5"

"DELTA=d6-PG1-3u-d16"
"DELTA2=2.35m-PG2-p29-d16"  ;adjust 2.35m to minimize 15n anti-tr, limited by pw's
"DELTA3=d26-PG3-p27-205u"
"DELTA4=d0-p24-d10+d9"

"DELTA5=d20*4+p2*2+larger(p14,p22)-p14-4u"
# 74 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
"DELTA6=p21*1.274-p1"
"DELTA7=d5-larger(p14,p22)-d20*2"
"DELTA8=300u-PG4-15u-de"  ;if PG4 is increased, make sure this Grad. Recovery is adequate
"DELTA9=4.1m-PG9-p24-d16"
"DELTA10=4.1m-PG10-p24-d16"
"DELTA11=p2"

; --- set C13 frequencies, set o2p=56ppm from command line -----
"cnst21=173.4"  ; 176 - 2.6
"cnst22=53.4"   ; 56 - 2.6

"spoff2=0"
"spoff4=bf2*((cnst21-cnst22)/1000000)"
"spoff5=bf2*((cnst21-cnst22)/1000000)"
"spoff8=0"
"spoff9=0"
"spoff15=0"
# 1 "mc_line 92 file /opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr dc-measurement inserted automatically"

    dccorr
# 92 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
# 92 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
1       ze
        1m


# 100 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
2       10u do:f2
        d11
        d12*5
3       d12*6
4       d12*4
5       d12*2
6       10u


# 110 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
        10m setnmr3^0
        d1 
        1m setnmr3|0 setnmr0|34|32|33 ctrlgrad 0


# 116 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
        10u fq=cnst22(bf ppm):f2
        10u pl0:f1 
        10u pl3:f3
        10u pl0:f2
        10u pl0:f2
;------- start 90-degree on hn -----------------------
        (p29:sp21 ph11:r):f1
        3u 
        2u pl1:f1
        (p1 ph0):f1
        3u
        PG1:gp1
        DELTA 
        d16
        (center (p2 ph0):f1 (p22 ph0):f3)
        3u
        DELTA 
        PG1:gp1
        d16 
        (p1 ph1):f1
         5u
;goto 100    ;sp21 and phcor11     ;WARNING - make sure pl12 is set to C' dec PL and 
;                                  that AQ is short (<80ms) or turn off AQ cpd
;                                  before using this statement. Ditto for all
;                                   'goto 100's'.
;----------- inept to f3 => C'  ---------------
        (p21 ph0):f3
        d27
        (center (p22 ph0):f3 (p14:sp5 ph0):f2)
        d27
        (p21 ph1):f3
        3u
        PG20:gp20
        d16
;------------ inept C' => Ca ------------------
        (p13:sp4 ph0):f2
        3u
        (p24:sp9 ph0):f2
        3u
        PG9:gp9
        DELTA9
        d16
        (p14:sp5 ph0):f2
        3u
        (p24:sp9 ph0):f2
        3u
        DELTA9
        PG9:gp9
        d16
        (p13:sp4 ph1):f2
        5u
        PG21:gp21
        d16


# 174 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
; ------------------- CT Ca evolution ----------------------------
# 205 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"

;----------- non-CT Ca evolution ----------------
        (p13:sp2 ph5):f2
        d20

        (p2 ph0):f1
# 212 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
        d20
        (center (p22 ph0):f3 (p14:sp5 ph0):f2)
        d20

        (p2 ph0):f1

        d20
;        (p50:sp15 ph9):f2
        (p24:sp9 ph9):f2
        DELTA5
        (p14:sp5 ph0):f2    ;BS pulse
        4u
        (p13:sp8 ph6 ):f2
; ---------- Ca evolution ended ---------------
# 227 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
        3u
        4u do:f4
        3u
        PG22:gp22
        d16
;-------- inept Ca => C' ----------------------
       (p13:sp4 ph1):f2
       3u
       PG10:gp10
       DELTA10
       d16
       (p24:sp9 ph0):f2
       3u
       (p14:sp5 ph0):f2
       3u
       DELTA10
       PG10:gp10
       d16
       (p24:sp9 ph0):f2
       3u
       (p13:sp4 ph0):f2
       5u
       PG23:gp23
       d16
;----------  CT C'=>N, N-evolution --------------
  if "l5==1"
      {
      (p21 ph17):f3
      }
  else
      {
      (p21 ph7):f3
      }
      d10
      (p24:sp9 ph0):f2
      DELTA4 
   if "l5==1"
     {
      PG5:gp6
      200u
      (center (d8 d9 p22 ph17 d7):f3 (p14:sp5 ph0 d9):f2)
      5u
      PG5:gp5
      }
  else
      {
      PG5:gp6*-1
      200u
      (center (d8 d9 p22 ph7 d7):f3 (p14:sp5 ph0 d9):f2)
      5u
      PG5:gp5*-1
      }
        10u
        180u fq=cnst21(bf ppm):f2
        DELTA6
        d0
        5u pl1:f1
        (p1 ph12):f1
        3u 
        2u pl0:f1
        (ralign (p29:sp1 ph21:r):f1 (p13:sp2 ph0):f2)
;goto 100   ;sp1 and phcor21
        5u 
        PG2:gp2
        DELTA2
        d16 pl1:f1
        (center (p2 ph0):f1 (p22 ph0):f3)
        5u
        DELTA2 
        PG2:gp2
        d16 pl0:f1
        (p29:sp11 ph22:r):f1
        3u 
        2u pl1:f1
        (p1 ph0):f1 (p21 ph14):f3
        5u
;goto 100    ;sp11 and phcor22
        PG3:gp3           
        195u pl18:f1
        DELTA3
;----- WaterGate -------------------------------------------
    (150u p27 ph10:r 3u 2u pl1 p2 ph0 3u 2u pl18 p27 ph10:r):f1 (d28 p22 ph0):f3 
        3u 
;goto 100      ;pl18 and phcor10
        2u pl1:f1
        PG3:gp3
        DELTA3
        45u
        (p21 ph0):f3
        PG4:gp4               ;decoding gradient
        DELTA8
100     10u setnmr0^34^32^33 ctrlgrad 7
        5u pl12:f2
       go=2 ph31 cpd2:f2
        10u do:f2
        d11 wr #0 if #0 zd


        d12
        d12 ip12*2
        d12 ip21*2
        d12 ip14*2
        d12 iu5
        lo to 3 times 2
        d12 id10
        if "d0 < in0 + 3u"
        {
         d12 id9
        }
        else
        {
        d12 dd0
        }
        d12 ip7*2
        d12 ip17*2
        d12 ip31*2
        d12 ru5
        lo to 4 times l3
# 350 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
        d12 rd0
        d12 rd9
        d12 rd10
        d12 ip5
        lo to 5 times 2
        d12 ip31*2


# 360 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
        d12 id20

        lo to 6 times l4

# 365 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
1m do:f4
1m do:f2


# 372 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
  d11 setnmr3^0

exit    
        
ph0=0
ph1=1  ;original setting = 1     ;check right phase for Boltzmann !!!!!
ph2=2
ph5=1 1 3 3
ph6=3
ph7=1 3 1 3 0 2 0 2
ph8=0 2
ph9=1 3
ph10=2
ph11=3  ;make sure this is 180deg different from ph1
ph12=3
ph14=3
ph17=1 3 1 3 2 0 2 0
ph21=1
ph22=0
ph23=2
ph31=1 3 3 1 2 0 0 2

;--- NOTES ---------------------------
# 396 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
;CT for N15

;tested on AVIII TS2-PL3 consoles
;   (must modify when using 2 13C channels)

;pulse program archived with 'go' cpd commented out
# 403 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
;     NOTE WELL!!!  f2=f2=f2 in bits.jlb for AVIII consoles; different
;                   designations are for ease of reading

;   (turn on C' cpd during AQ for c13 labeled samples)
; f2=f2(56ppm)  f2=f2(176ppm)   f3=f3 (119ppm)  f1=f1   f4=f5

;1H pulses:
;p1 = 90 deg (10us) hard 1H pulse @ pl1
;p27 = 1.2m soft 90 deg pulse @ pl18
;p29 = 1.9m @ sp1, sp11, and sp21  (spnam-1, -11, -21 = sinc1.0)
;p26 = 50u @ pl19
;pcpd1 = 50u @ pl19
;cpdprg1 = waltz64
# 417 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
;15N pules:
;p21 = 90 deg (50us) 15N pulse @pl3

;13C pulses:
;p13=sel. 90 Rectangle pulse (sp2, sp4, sp8)
;p14=sel. C' 180 (150u sinc1 @ 600 MHz) spnam5=Sinc1.1000
;p24=sel. Ca 180 deg (spnam9=G3.1000)
;p50=sel. Ca 180 Rectangle (spnam15=180Squa100.1000)
;CPDPRG2 = garp  (aq C' dec program)
;pcpd2 = pw for C' aq dec (140u @ 600 MHz) @ pl12

;2H pulse:
;pl17 = PL for Deut. Waltz64 Dec. by cpd5
;pcpd5 = pw for 2H dec.
# 432 "/opt/topspin3.1/exp/stan/nmr/lists/pp/user/hncocaTRv3.jr"
;f3  SW = 1/(2*in0)
;echo-antiecho in N15
; CT evolution period
;l3 = number of CT steps

;Ca SW = 1/(4*in20)
;States
;l4 = number of increments for Ca. Make sure total time not more thant 10-12ms
;     or will see Cb couplings resolving.

;paired RECT pulses do not work well on AVIII consoles
;gpz1 = 0%  sine.50
;gpz2 = +50% sine.20
;gpz3 = +70% sine.100   
;gpz4 = +70% sine.20    Decoding gradient
;gpz5 = -70% sine.20    half-Encoding gradient
;gpz6 = +70% sine.20    half-Encoding gradient
;gpz9 = +10% sine.100
;gpz10 = +15% sine.100
;gpz20 = +50% sine.100
;gpz21 = +30% sine.100
;gpz22 = +40% sine.100
;gpz23 = +45% sine.100
