;jsRoesy
;symmetrized CW-ROESY, program for DMX hardware, tested on DMX 500i and DMX750
;of NMRFAM; AMX version run on AMX400 and AMX600 spectrometers
;by J. Schleucher, J. Quant, S.J. Glaser, C. Griesinger, University of Frankfurt 1993
;js@nmrfam.wisc.edu
;BMRB Pulse Sequence Accession Number: 65

1 ze
2 d1 
3 20u 
  20u pl9:f1
  p18 ph29		;presat
  3u
  20u pl1:f1
  p1 ph1
  d0                       
  p1 ph2		;"flanking pulse", see C. Griesinger & R.R. Ernst
  2u			;JMR 75 (1987), 261-271
  3u pl3:f1 		;switching power level for spin-lock
5 (p11:sp1 ph3):f1    	;shaped pulse for downfield spin-lock
  lo to 5 times l1	;loop for downfield spin-lock
  2u
  3u pl2:f1		;switching power level for 180 deg. pulses
  p6 ph4		;1. 180 deg. pulse for realignment
  3u
  p6 ph5		;2. 180 deg. pulse for realignment
  2u
  3u pl3:f1		;not absolutely necessary to switch back to tl0, 
6 (p11:sp2 ph6):f1	;since tp2 will be used anyway, highfield spin-lock
  lo to 6 times l2	;loop for highfield spin-lock
  2u
  3u pl1:f1		;switching back to high power for
  2u
  p1 ph2		;2. flanking pulse
  go=2 ph31
  d1 wr #0 if #0 id0 ip1 zd
  lo to 3 times td1
exit

ph1 =  0 2 2 0 1 3 3 1
ph2 =  0 0 2 2 1 1 3 3
;ph3 =  0 0 2 2 1 1 3 3
ph3 = (360) 6 6 186 186 96 96 276 276
ph4 = 0 0 2 2 1 1 3 3
;ph4 =  (360) 160 160 340 340 250 250 70 70 
ph5 = 2 2 0 0 3 3 1 1
;ph5 =  (360) 340 340 160 160 70 70 250 250 
;ph6 =  2 2 0 0 3 3 1 1
ph6 = (360) 186 186 6 6 276 276 96 96
ph29=0
ph31=  0 2 2 0 1 3 3 1

;Comments: 

;As standard parameters, I use a spin-lock field strength of gamma B1/(2*pi)=
;5 kHz (=tp1=tp2= 24 dB) and a lock angle of 63 deg (on resonance, measured 
;from the z-axis). The off-resonant spin-lock is implemented using phase-
;modulated shaped pulses of constant amplitude. The shape I use consists of 720 
;real points, a phase increment of 5 deg. per step is applied (use the utilities-
;submenue of the program "shape" on AMX hardware to add a phase-gradient to a 
;rectangular shaped pulse). This phase increment results in a total phase of 10 
;revolutions per shape. Therefore, the length of a shape is given by p11=
;(10*tan(63)/gamma B1). Alternatively, the phase- gradient can be generated 
;using the parameter "tpoffset". In this case the length of p11 will have to be
;chosen such that the phase of p11 will make an integer number of revolutions,
;that is, p11 has to be a multiple of (1/offset frequency). The mixing time is
;adjusted using the loop counters l1, l2. l2 is chosen somewhat larger than l1.
;This prevents anwanted magnetisation to be refocused at the end of the second 
;spin-lock.
;The field strength required for the 180 deg. pulses is given by 
;2(gamma B1)/(sin(63 deg)^2)=12.6 kHz for a 5 kHz spin-lock.
;In the phase programs given above,the theoretical phases of the pulses are
;given as comments. Since the phase of the output of an amplifier is in general 
;dependent on the amplitude of the output, the phases need to be corrected. The 
;correction needed depends on the particular hardware, so you'll have to 
;determine these phases once for the set of parameters you want to use. To 
;determine the required phase correction of the low-power pulses, record a spectrum 
;with a low-power pulse of the power chosen and apply the phase correction of a
;spectrum acquired using a hard pulse. The additional zero-order phase correction 
;needed to phase the low-power spectrum to pure absorption on-resonance is the 
;phase correction needed. Using AMX hardware, you can also use the parameter 
;"phcor" instead of editing the phase-cycle. In the above program, the durations
;of delays used to switch power levels have been chosen minimal. The values proved 
;sufficient on our hardware.