#include "bits.nt"
;3D TROSY-HNCOJ
;3D interleaved TROSY-HNCO for measurement of J(NC') + D(NC')
;James Chou and Ad Bax July 12, 2000
;
;Citaion:
;  James Chou, Frank Delaglio and Ad Bax 
;  J. Biomol NMR, 18, 101-105, 2000.

;--RF Pulses---------------
;p1 = 90 deg (10us) 1H pulse @pl1
;p2 = 90 deg @pl2 1H; should be ~1ms
;p3 = 90 hard on C' 
;p6 = sp0 90 sinc1.0 on C' (~100 us at 800 MHz), center lobe sinx/x 
;p7 = 90 deg (~50us) 15N pulse @pl7
;p8 = sp3 sinc1.0 on CA (~100 us at 800 MHz) 
;p16= sp2 180 hsec.3 on C' (~600-1000 us at 800 MHz), hyperbolic secant 

;--Gradients---------------
;p21=1m, gp1=5%x       sine.50     ;sine bell shaped gradient
;p20=1m, gp0=30%y      sine.50
;p20=1m, gp2=30%x      sine.50
;p21=1m, gp3=30%z      sine.50

;--Options-----------------
#define NITRO
#define CARBON
#define INTERLEAVE

;--Evolutions--------------
define loopcounter NLOOP
define loopcounter CLOOP
"NLOOP=60"                         ;max = 62 for 500u increment in 15N dim
"CLOOP=32"                         ;number of complex C' increments 
;
;15N evolution    in20=in21=in22   Total evolution = 4*in20*NLOOP
;C' evolution     in0              Total evolution = 2*in0*CLOOP

;--Delays------------------
"d0=in0*0.5-p7-p6*0.54"            ;90,-180 phase correction in C' dim
"d3=2.5m-p21"
"d4=2.6m-p21-p2"
"d11=50m"
"d16=p16"             
"d19=in21*0.444"                   ;fudge delay for zero ph1 in 15N dim
"d20=7.5m+p16*0.5"
"d21=7.5m"
"d22=7.5m-p2-16u"
"d26=p7-p1"
;
1       ze
        1m RESET
2       d11 do:N
3       3m
7       5u do:C1
        10u pl3:C1
        d1 LOCK_ON
        1m LOCK_OFF
	(p3 ph0):C1                    ;kill C' boltzman magnetization 
        10u pl1:H
        10u pl7:N
;------- start 90-degree on 1HN -----------------------
        (p1 ph0):H                     ;the first 1H 90 
	3u
	p21:gp1                        ;1m @ 5%x
        d3
        (d26 p1*2 ph0):H (p7*2 ph0):N
	p21:gp1                        ;1m @ 5%x
	d3
        (p1 ph1):H             
	3u
;------- INEPT to 15N -----------------------
	(p7 ph0):N                     ;INEPT to 15N
	if "l2==2" goto 20             ;interleaving expt with 33 and 67msec J(NC') dephasing 
	16.6m pl6:C1                   
	(p16:sp2 ph0):C1               ;selective C' adiabatic 180
	16.6m
	goto 21
20	33.2m pl6:C1
	(p16:sp2 ph0):C1
21	(p7*2 ph0):N
	d16                            ;d16 = p16 
	33.2m
	(p7 ph1):N
	p20:gp0                        ;scrambler gradient 1m @ 30%y
	1m pl5:C2
	(p6:sp0 ph6):C1                ;selective C' 90 (sinc1.0)
;------ Start C' evolution-----------
        d0                             ;start C' evolution
        (p8:sp3 ph0):C1 (p7*2 ph0):N   ;CA and 15N refocusing 
        d0
;------ End C' evolution-------------
	(p6:sp0 ph0):C1                ;selective C' 90 (sinc1.0)
	6u
	p20:gp2                        ;scrambler gradient 1m @ 30%x
	1m
        if "l1==1" goto 88             ;select appropriate TROSY phase
	(p7 ph17):N                    ;ph17=1 2   --|
	goto 89                        ;             |
88	(p7 ph7):N                     ;ph7=1 0    --|
;------ Start CT 15N evolution-------
89	d20                            ;decrement d20 = 7.5m 
	(p8:sp3 ph0):C1         
	d20                            ;decrement d20 = 7.5m
	(p7*2 ph0):N
	(p16:sp2 ph0):C1
	d19                            ;fudge delay for zero ph1 in 15N dim 
	d21                            ;increment d21
	(p8:sp3 ph0):C1    
	d22                            ;increment d22
	5u pl2:H
	(p2 ph0):H                     ;1m water 90 pulse; ST2 transfer
	6u
	5u pl1:H
;------ End CT 15N evolution--------- 
	if "l1==1" goto 78             ;select appropriate TROSY phase
	(p1 ph12):H                    ;ph12 = 1  --|
	goto 79                        ;            |
78	(p1 ph2):H                     ;ph2 = 3   --|
79	5u
	p21:gp1                        ;1m @ 5%x 
	d3
        (d26 p1*2 ph0):H (p7*2 ph0):N
	5u
	p21:gp1                        ;1m @ 5%x
	d3
        if "l1==1" goto 98             ;select appropriate TROSY phase 
        (p1 ph0):H (p7 ph14):N         ;DOUBLE 90  ph14 = 1  --|
	goto 99                        ;                       |
98      (p1 ph0):H (p7 ph4):N          ;DOUBLE 90  ph4 = 3   --|
99	5u
	p21:gp3                        ;1m @ 30%z  
	d4 pl2:H
	(p2 ph15):H
	3u
	5u pl1:H
        (d26 p1*2 ph0):H (p7*2 ph0):N
	8u pl2:H
	(p2 ph15):H
	5u
	p21:gp3                        ;1m @ 30%z
	d4 pl30:C1
	(p7 ph0):N
        go=2 ph31 cpd1:C1              ; CPD for C' during acquisition
        10u do:C1
        1m LOCK_ON
        d11 wr #0 if #0 zd
;
#ifdef INTERLEAVE
        10u iu2                        ;increment loopcounter l2 
        lo to 3 times 2                ;reset loopcounter l2 to 1
        10u ru2
#endif
;
#ifdef NITRO
0.1m iu1                               ;increment loopcounter l1
lo to 3 times 2
10u dd20
10u id21
10u id22
10u ru2
10u ru1                                ;reset loopcounter l1 to 1
lo to 3 times NLOOP 
10u rd21
10u rd22
10u rd20
#endif
;
#ifdef CARBON
10u ip6
lo to 3 times 2
10u id0
10u ip31                     ;TPPI-States in C' dim
10u ip31
lo to 3 times CLOOP 
#endif
;
1m do:C1
1m do:N
1m RESET
1m
exit    
        
ph0=0
ph1=1
ph2=3
ph12=1
ph4=3
ph14=1
ph15=(360)178
ph6=0 0 2 2
ph7=1 0 
ph17=1 2 
ph10=(360)0
ph11=0 
ph31=1 2 3 0          ;receiver phase 
