;PulsePol R431 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*12"

"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 


;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: R431 sequence which generates an Ix12 Hamiltonian

		4 (p1 ph2):f1                 ; 90(+135)
      tauR*0.5
      (p1 ph3):f1                 
      (p1*2 ph3+cnst23):f1           
      (p1*4 ph3+cnst24):f1          ; 180(+45)
      (p1*2 ph3+cnst23):f1             
      (p1 ph3):f1               
      tauR*0.5
      (p1 ph2):f1                 ; 90(+135)

      (p1 ph4):f1                 ; 90(-135)
      tauR*0.5
      (p1 ph2):f1                 
      (p1*2 ph2+cnst23):f1           
      (p1*4 ph2+cnst24):f1          ; 180(-45+135)
      (p1*2 ph2+cnst23):f1             
      (p1 ph2):f1               
      tauR*0.5
      (p1 ph4):f1                  ; 90(-135)

lo to 4 times l2

	;STEP 3: 90(x) pulse to create DQCs

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

;BLOCK B: DQCs to Iz

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

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

	;STEP 5: R431 sequence which generates an Ix12 Hamiltonian

		7 (p1 ph12):f1                 ; 90(+135)
      tauR*0.5
      (p1 ph13):f1                 
      (p1*2 ph13+cnst23):f1           
      (p1*4 ph13+cnst24):f1          ; 180(+45)
      (p1*2 ph13+cnst23):f1             
      (p1 ph13):f1               
      tauR*0.5
      (p1 ph12):f1                 ; 90(+135)

      (p1 ph14):f1                 ; 90(-135)
      tauR*0.5
      (p1 ph12):f1                 
      (p1*2 ph12+cnst23):f1           
      (p1*4 ph12+cnst24):f1          ; 180(-45+135)
      (p1*2 ph12+cnst23):f1             
      (p1 ph12):f1               
      tauR*0.5
      (p1 ph14):f1                  ; 90(-135)

lo to 7 times l2
 

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

    8 (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 7: z-filter
    40u UNBLKGRAD
    p21:gp1                        ; gradient pulse
    2m
    40u BLKGRAD

    9 (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
  ;PULSEPOL R431
	ph2=(360) 135 135 135 135
	ph3=(360) 45 45 45 45
	ph4=(360) -135 -135 -135 -135
  ;PULSE 2
	ph5=0 0 0 0
;BLOCK B PHASES
  ;PHI_{B}
  ph10=0 1 2 3
  ;PULSE 1
	ph11=ph1+ph10
  ;PULSEPOL R431
	ph12=ph2+ph10
	ph13=ph3+ph10
	ph14=ph4+ph10
  ;PULSE 2
	ph15=ph5+ph10

;READOUT PULSE
  ph20=2 3 0 1

;Receiver phases
ph31=2 1 0 3

;d2 : duration of an R element; set to approximately 3/(4J)
;p1 : high power 90 pulse duration
;l1 : total number of R elements (set to 2.6026*J/Delta)
;l2 : total number of R element pairs (set to 1.3013*J/Delta)
;plw1 : pulse power (hard pulses)
;p21 : gradient pulse duration