;"geoDQ" PULSE SEQUENCE FOR DOUBLE-QUANTUM EXCITATION IN STRONGLY-COUPLED 2-SPIN-1/2 SYSTEMS
;FROM "Spinor Double-Quantum Excitation in the Solution NMR of Near-Equivalent Spin-1/2 Pairs"
;for assistance, contact mohamed@sabba.me

#include <Avance.incl>
#include <Grad.incl>
#include <Delay.incl>

"d11=30m"

"acqt0=-p1*2/3.1416"

define delay tauR
"tauR = d2-p1*10"

"cnst21=90+asin(1/8)*DEG"
"cnst22=3*cnst21"
"cnst23=90+asin(1/4)*DEG"
"cnst24=3*cnst23"

"l2 = 0.5*l1"

1 ze
2 d1  pl1:f1 
1u rpp9

;BLOCK A: Iz to DQCs

	;STEP 1: 90(y) pulse to create transverse magnetization

		3 (p1*0.5 ph1):f1                 
      (p1*2 ph1+cnst21):f1                
      (p1*4 ph1+cnst22):f1                 ; BB1 90(+y) pulse
      (p1*2 ph1+cnst21):f1                
      (p1*0.5 ph1):f1    

	;STEP 2: Pi_y rotation in the ZQ subspace

		4 tauR
      (p1 ph9+ph2):f1                 
      (p1*2 ph9+ph3):f1           
      (p1*4 ph9+ph4):f1          ; 180(0)
      (p1*2 ph9+ph3):f1             
      (p1 ph9+ph2 ipp9):f1        
lo to 4 times l1

	;STEP 3: Pi_x rotation in the ZQ subspace

		5 tauR*0.5
      (p1 ph9+ph2):f1                 
      (p1*2 ph9+ph3):f1           
      (p1*4 ph9+ph4):f1          ; 180(0)
      (p1*2 ph9+ph3):f1             
      (p1 ph9+ph2):f1               
      tauR*0.5 ipp9
lo to 5 times l1

	;STEP 4: 90(y) pulse to create DQCs

    6 (p1*0.5 ph1):f1                 
      (p1*2 ph1+cnst21):f1                
      (p1*4 ph1+cnst22):f1                 ; BB1 90(+y) pulse
      (p1*2 ph1+cnst21):f1                
      (p1*0.5 ph1):f1    

;BLOCK B: DQCs to Iz
	;STEP 5: 90(y) pulse to create transverse magnetization

	 7  (p1*0.5 ph11):f1                 
      (p1*2 ph11+cnst21):f1                
      (p1*4 ph11+cnst22):f1                 ; BB1 90(+y) pulse
      (p1*2 ph11+cnst21):f1                
      (p1*0.5 ph11 rpp9):f1    

	;STEP 6: Pi_x rotation in the ZQ subspace

	 8  tauR
      (p1 ph9+ph12):f1                 
      (p1*2 ph9+ph13):f1           
      (p1*4 ph9+ph14):f1          ; BB1 180(+x) pulse with MLEV-4 supercycle
      (p1*2 ph9+ph13):f1             
      (p1 ph9+ph12 ipp9):f1     
lo to 8 times l1

	;STEP 7: Pi_y rotation in the ZQ subspace

		9 tauR*0.5
      (p1 ph9+ph12):f1                 
      (p1*2 ph9+ph13):f1           
      (p1*4 ph9+ph14):f1          ; BB1 180(+x) pulse with MLEV-4 supercycle
      (p1*2 ph9+ph13):f1             
      (p1 ph9+ph12):f1                  
      tauR*0.5 ipp9 
lo to 9 times l1
 

	;STEP 8: 90(y) pulse to create Iz

    10 (p1*0.5 ph11):f1                 
       (p1*2 ph11+cnst21):f1                
       (p1*4 ph11+cnst22):f1                 ; BB1 90(+y) pulse
       (p1*2 ph11+cnst21):f1                
       (p1*0.5 ph11):f1    

;READOUT BLOCK
  ;STEP 9: z-filter
    40u UNBLKGRAD
    p21:gp1                        ; gradient pulse
    2m
    40u BLKGRAD

    11 (p1*0.5 ph20):f1                 
       (p1*2 ph20+cnst21):f1                
       (p1*4 ph20+cnst22):f1                 ; BB1 90(+x) pulse
       (p1*2 ph20+cnst21):f1                
       (p1*0.5 ph20):f1    

  go=2 ph31
  30m mc #0 to 2 F0(zd)
exit

;BLOCK A PHASES
  ;PULSE 1
	ph1= 1 1 1 1
  ;180 PULSE BASE PHASE
  ph2= 0 0 0 0
  ;COMPENSATING PULSES (BB1 180)
  ph3=(65536) 19020 19020 19020 19020
  ph4=(65536) 57059 57059 57059 57059
;BLOCK B PHASES
  ;PHI_{B}
  ph10=0 1 2 3
  ;PULSE 1
	ph11=ph1+ph10
  ;180 PULSE BASE PHASE
  ph12=ph2+ph10
  ;COMPENSATING PULSES (BB1 180)
  ph13=ph3+ph10
  ph14=ph4+ph10
  ;READOUT PULSE 
  ph20=2 3 0 1
;COMPENSATING PULSES 
  ;MLEV 4 SUPERCYCLE
	ph9=0 2 2 0

;Receiver phases
ph31=0 3 2 1

;d2 : duration of an R element; set to approximately 1/(2J)
;p1 : high power 90 pulse duration
;l1 : total number of R elements for pi rotation (set to 1.57*J/Delta)
;plw1 : pulse power (hard pulses)
;p21 : gradient pulse duration