hmqcgpphpr_1HT2.cw: loop over whole experiment (times l0)

;methyl 1H T2 measurement
;option for (pseudo)1D measurement only (-DONE_D)
;L2 line (Tugarinov & Kay 2006)
;
;avance-version (07/04/04)
;HMQC
;2D H-1/X correlation via heteronuclear zero and double quantum
;   coherence
;phase sensitive
;with decoupling during acquisition
;
;A. Bax, R.H. Griffey & B.L. Hawkins, J. Magn. Reson. 55, 301 (1983)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

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

"p2=p1*2"
"p4=p3*2"
"d2=1s/(cnst2*2)"
"d3=1s/(cnst2*8)-p17-d16-larger(p1,p3)"
"d11=30m"
"d12=20u"
"d13=4u"

#ifndef ONE_D
"in0=inf2/2"
"d0=in0/2-0.63662*p3-2*p1"
#endif

"DELTA1=d2-p16-d16"
"DELTA2=d2-p16-d16-d12-4u-de+0.6366*p1"

define delay vdmin
"vdmin=4*(p1+p3+4u+p17+d16)"

"acqt0=de"
baseopt_echo

#ifndef ONE_D
aqseq 312
#endif

1 ze
  vdmin
  d11 pl12:f2
2 d11 do:f2
  4u BLKGRAD

  20u
  "TAU1=vd*0.25-4u-p17-d16-p3"
  "TAU2=vd*0.25-p3-p1"
  "TAU3=vd*0.25-p1-4u-p17-d16-p3"
  "TAU4=vd*0.25-p3"

# ifdef OFFRES_PRESAT
    30u fq=cnst21(bf hz):f1
# endif /*OFFRES_PRESAT*/

  ; relaxation period
  d12 pl9:f1
  d1 cw:f1 ph29
  d13 do:f1
  d12 pl1:f1 pl2:f2
  30u fq=0:f1
  50u UNBLKGRAD

  (p3 ph1):f2    ; crush eq'm 13C magnetisation
  d13
  p16:gp1
  d16

  ; start main sequence
  (p1 ph1):f1  ; INEPT
  DELTA1
  p16:gp2
  d16

  ; purge element
  (p3 ph11):f2
  d3
  p17:gp3
  d16
  (center (p2 ph1):f1 (p4 ph1):f2 )
  d3
  p17:gp3
  d16
  (p3 ph12):f2

  ; t1 evolution
#ifndef ONE_D
  d0
#endif
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
#ifndef ONE_D
  d0
#endif
  (p3 ph13):f2

  ; relaxation period
  4u
  p17:gp4
  d16
  TAU1
  (p4 ph1):f2
  TAU2
  (p2 ph1):f1
  4u
  p17:gp4
  d16
  TAU3
  (p4 ph1):f2
  TAU4

  ; back-transfer
  d12 pl12:f2
  p16:gp2
  d16
  4u BLKGRAD
  DELTA2

  ; acquisition
  go=2 ph31 cpd2:f2

#ifdef ONE_D
  d11 do:f2 mc #0 to 2
       F1QF(ivd)
#else
  d11 do:f2 mc #0 to 2
       F1QF(ivd)
       F2PH(ip13 & ip29, id0)
#endif /* ONE_D */

  ; repeat whole experiment
  lo to 2 times l0

  4u BLKGRAD
exit

ph1= 0
ph2= 1
ph11= 0 2
ph12= 1 1 3 3
ph13= 0
ph29=0
ph31=0 2

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;pl3 : f3 channel - power level for pulse (default)
;pl9 : f1 channel - power level for presaturation
;pl12: f2 channel - power level for CPD/BB decoupling
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p16: homospoil/gradient pulse
;p17: gradient pulse [300 usec]
;p22 : f3 channel - 180 degree high power pulse
;d0 : incremented delay (2D)                         [3 usec]
;d1 : relaxation delay; 1-5 * T1
;d2 : 1/(2J)CH
;d3 : 1/(8J)CH
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d13: short delay                                    [4 usec]
;d16: delay for homospoil/gradient recovery
;cnst2: = J(CH)
;cnst21: frequency in Hz for off-res presat
;inf1: 1/SW(X) = 2 * DW(X)
;in0: 1/(2 * SW(X)) = DW(X)
;nd0: 2
;l0: number of repeats for entire experiment
;NS: 4 * n
;DS: 16
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEQ
;cpd2: decoupling according to sequence defined by cpdprg2
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;for z-only gradients:
;gpz1: 31%
;gpz2: 7%
;gpz3: -40%
;gpz4: 29%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.32
;gpnam4: SMSQ10.32
                                          ;preprocessor-flags-start
;SINGLEDWELL: for initial sampling delay of one dwell-time with
;	    option -DSINGLEDWELL (eda: ZGOPTNS)
;OFFRES_PRESAT: for off-resonance presaturation, set cnst21=o1(water)
;	    option -DOFFRES_PRESAT (eda: ZGOPTNS)
                                          ;preprocessor-flags-end

;$Id: hmqcphpr,v 1.4 2007/04/11 13:34:30 ber Exp $

;methyl 1H T2 measurement
;option for (pseudo)1D measurement only (-DONE_D)
;L2 line (Tugarinov & Kay 2006)
;
;avance-version (07/04/04)
;HMQC
;2D H-1/X correlation via heteronuclear zero and double quantum
;   coherence
;phase sensitive
;with decoupling during acquisition
;
;A. Bax, R.H. Griffey & B.L. Hawkins, J. Magn. Reson. 55, 301 (1983)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

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

"p2=p1*2"
"p4=p3*2"
"d2=1s/(cnst2*2)"
"d3=1s/(cnst2*8)-p17-d16-larger(p1,p3)"
"d11=30m"
"d12=20u"
"d13=4u"

#ifndef ONE_D
"in0=inf2/2"
"d0=in0/2-0.63662*p3-2*p1"
#endif

"DELTA1=d2-p16-d16"
"DELTA2=d2-p16-d16-d12-4u-de+0.6366*p1"

define delay vdmin
"vdmin=4*(p1+p3+4u+p17+d16)"

"acqt0=de"
baseopt_echo

#ifndef ONE_D
aqseq 312
#endif

1 ze
  vdmin
  d11 pl12:f2
2 d11 do:f2
  4u BLKGRAD

  20u
  "TAU1=vd*0.25-4u-p17-d16-p3"
  "TAU2=vd*0.25-p3-p1"
  "TAU3=vd*0.25-p1-4u-p17-d16-p3"
  "TAU4=vd*0.25-p3"

# ifdef OFFRES_PRESAT
    30u fq=cnst21(bf hz):f1
# endif /*OFFRES_PRESAT*/

  ; relaxation period
  d12 pl9:f1
  d1 cw:f1 ph29
  d13 do:f1
  d12 pl1:f1 pl2:f2
  30u fq=0:f1
  50u UNBLKGRAD

  (p3 ph1):f2    ; crush eq'm 13C magnetisation
  d13
  p16:gp1
  d16

  ; start main sequence
  (p1 ph1):f1  ; INEPT
  DELTA1
  p16:gp2
  d16

  ; purge element
  (p3 ph11):f2
  d3
  p17:gp3
  d16
  (center (p2 ph1):f1 (p4 ph1):f2 )
  d3
  p17:gp3
  d16
  (p3 ph12):f2

  ; t1 evolution
#ifndef ONE_D
  d0
#endif
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
#ifndef ONE_D
  d0
#endif
  (p3 ph13):f2

  ; relaxation period
  4u
  p17:gp4
  d16
  TAU1
  (p4 ph1):f2
  TAU2
  (p2 ph1):f1
  4u
  p17:gp4
  d16
  TAU3
  (p4 ph1):f2
  TAU4

  ; back-transfer
  d12 pl12:f2
  p16:gp2
  d16
  4u BLKGRAD
  DELTA2

  ; acquisition
  go=2 ph31 cpd2:f2

#ifdef ONE_D
  d11 do:f2 mc #0 to 2
       F1QF(ivd)
#else
  d11 do:f2 mc #0 to 2
       F1QF(ivd)
       F2PH(ip13 & ip29, id0)
#endif /* ONE_D */
  4u BLKGRAD
exit

ph1= 0
ph2= 1
ph11= 0 2
ph12= 1 1 3 3
ph13= 0
ph29=0
ph31=0 2

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;pl3 : f3 channel - power level for pulse (default)
;pl9 : f1 channel - power level for presaturation
;pl12: f2 channel - power level for CPD/BB decoupling
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p16: homospoil/gradient pulse
;p17: gradient pulse [300 usec]
;p22 : f3 channel - 180 degree high power pulse
;d0 : incremented delay (2D)                         [3 usec]
;d1 : relaxation delay; 1-5 * T1
;d2 : 1/(2J)CH
;d3 : 1/(8J)CH
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d13: short delay                                    [4 usec]
;d16: delay for homospoil/gradient recovery
;cnst2: = J(CH)
;cnst21: frequency in Hz for off-res presat
;inf1: 1/SW(X) = 2 * DW(X)
;in0: 1/(2 * SW(X)) = DW(X)
;nd0: 2
;NS: 4 * n
;DS: 16
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEQ
;cpd2: decoupling according to sequence defined by cpdprg2
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;for z-only gradients:
;gpz1: 31%
;gpz2: 7%
;gpz3: -40%
;gpz4: 29%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.32
;gpnam4: SMSQ10.32
                                          ;preprocessor-flags-start
;SINGLEDWELL: for initial sampling delay of one dwell-time with
;	    option -DSINGLEDWELL (eda: ZGOPTNS)
;OFFRES_PRESAT: for off-resonance presaturation, set cnst21=o1(water)
;	    option -DOFFRES_PRESAT (eda: ZGOPTNS)
                                          ;preprocessor-flags-end

;$Id: hmqcphpr,v 1.4 2007/04/11 13:34:30 ber Exp $


add 13C 180 phase cycling to hmqcgpphpr_zqdqT2.cw

;methyl ZQ and DQ T2 measurement using HMQC with multiplet filter
;Chris Waudby, July 2020
;
;set td2 = 6 * desired td (3 step cycle for ZQ/DQ selection + 2 step cycle for multiplet suppression)
;
;avance-version (07/04/04)
;HMQC
;2D H-1/X correlation via heteronuclear zero and double quantum
;   coherence
;phase sensitive
;with decoupling during acquisition
;
;A. Bax, R.H. Griffey & B.L. Hawkins, J. Magn. Reson. 55, 301 (1983)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

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

"p2=p1*2"
"p4=p3*2"
"d2=1s/(cnst2*2)"
"d3=1s/(cnst2*8)"
"d11=30m"
"d12=20u"
"d13=4u"

"in0=inf2"
"d0=2*0.63662*p3 + in0/2"

; loop counter for ZQ/DQ and E/AE blocks
"l1 = 0"

"acqt0=0"
baseopt_echo

aqseq 321

1 ze
  d11 pl12:f2
2 d11 do:f2
  ; purge before d1
  20u pl6:f1
  (2mp ph1):f1
  (3mp ph2):f1

  4u BLKGRAD

  ; relaxation period, with off-res presat
  30u fq=cnst21(bf hz):f1
  d12 pl9:f1
  d1 cw:f1 ph29
  d13 do:f1
  d12 pl1:f1 pl2:f2
  30u fq=0:f1
  50u UNBLKGRAD

  (p3 ph1):f2    ; crush eq'm 13C magnetisation
  d13
  p16:gp1
  d16

  ; start main sequence
  (p1 ph1):f1  ; INEPT
  "DELTA1 = d2 - p1*0.6366"
  DELTA1

  if "l1 % 4 == 0"
    {
  (p3 ph11):f2
  "DELTA = d3 - p3"
  DELTA
  (p3*2 ph12):f2
  "DELTA = vd*0.5 + d0*0.5 - p3 - p1*2 - p19 - d16"
  DELTA
  p19:gp2
  d16
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
  "DELTA = d3 + d0*0.5 - p3 - p1*2"
  DELTA
  (p3*2 ph13):f2
  p19:gp2
  d16
  "DELTA = vd*0.5 - p3 - p19 - d16"
  DELTA
  (p3 ph1):f2
    }

  if "l1 % 4 == 1"
    {
  (p3 ph11):f2
  (p3*2 ph12):f2
  "DELTA = d3 - p3 + vd*0.5 + d0*0.5 - p3 - p1*2 - p19 - d16"
  DELTA
  p19:gp2
  d16
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
  "DELTA = d0*0.5 - p1*2"
  DELTA
  (p3*2 ph13):f2
  p19:gp2
  d16
  "DELTA = d3 - p3 + vd*0.5 - p3 - p19 - d16"
  DELTA
  (p3 ph1):f2
    }

  if "l1 % 4 == 2"
    {
  (p3 ph11):f2
  "DELTA = vd*0.5 - p3 - p19 - d16"
  DELTA
  p19:gp2
  d16
  (p3*2 ph12):f2
  "DELTA = d3 + d0*0.5 - p3 - p1*2"
  DELTA
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
  p19:gp2
  d16
  "DELTA = vd*0.5 + d0*0.5 - p3 - p1*2 - p19 - d16"
  DELTA
  (p3*2 ph13):f2
  "DELTA = d3 - p3"
  DELTA
  (p3 ph1):f2
    }

   if "l1 % 4 == 3"
    {
  (p3 ph11):f2
  "DELTA = vd*0.5 - p3 - p19 - d16 + d3 - p3"
  DELTA
  p19:gp2
  d16
  (p3*2 ph12):f2
  "DELTA = d0*0.5 - p1*2"
  DELTA
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
  p19:gp2
  d16
  "DELTA = vd*0.5 + d0*0.5 - p3 - p1*2 - p19 - d16 + d3 - p3"
  DELTA
  (p3*2 ph13):f2
  (p3 ph1):f2
    }

   ; back-transfer
  "DELTA2 = d2 - d12 - 4u"
  DELTA2
  d12 pl12:f2
  4u BLKGRAD

  ; acquisition
  go=2 ph31 cpd2:f2

  d11 do:f2 mc #0 to 2
    F2I(ip11, 3, iu1, 2)
    F2EA(iu1, id0)
    F1QF(rd0 & rp11 & ru1 & ivd)

  4u BLKGRAD
exit

ph1= 0
ph2= 1
ph11= (3) 0
ph12=0 2
ph13=0 2
ph29=0
ph31=0

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;pl3 : f3 channel - power level for pulse (default)
;pl9 : f1 channel - power level for presaturation
;pl12: f2 channel - power level for CPD/BB decoupling
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p16: homospoil/gradient pulse
;p19: gradient pulse [300 usec]
;d0 : incremented delay (2D)                         [3 usec]
;d1 : relaxation delay; 1-5 * T1
;d2 : 1/(2J)CH
;d3 : 1/(8J)CH
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d13: short delay                                    [4 usec]
;d16: delay for homospoil/gradient recovery
;cnst2: = J(CH)
;cnst21: frequency in Hz for off-res presat
;inf1: 1/SW(X) = 2 * DW(X)
;in0: 1/(2 * SW(X)) = DW(X)
;l0: number of repeats for entire experiment
;NS: 1 * n
;DS: 16
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEQ
;cpd2: decoupling according to sequence defined by cpdprg2
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;for z-only gradients:
;gpz1: 31%
;gpz2: 7%
;gpz3: -40%
;gpz4: 29%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.32
;gpnam4: SMSQ10.32

;methyl ZQ and DQ T2 measurement using HMQC with multiplet filter
;Chris Waudby, July 2020
;
;set td2 = 6 * desired td (3 step cycle for ZQ/DQ selection + 2 step cycle for multiplet suppression)
;
;avance-version (07/04/04)
;HMQC
;2D H-1/X correlation via heteronuclear zero and double quantum
;   coherence
;phase sensitive
;with decoupling during acquisition
;
;A. Bax, R.H. Griffey & B.L. Hawkins, J. Magn. Reson. 55, 301 (1983)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

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

"p2=p1*2"
"p4=p3*2"
"d2=1s/(cnst2*2)"
"d3=1s/(cnst2*8)"
"d11=30m"
"d12=20u"
"d13=4u"

"in0=inf2"
"d0=2*0.63662*p3 + in0/2"

; loop counter for ZQ/DQ and E/AE blocks
"l1 = 0"

"acqt0=0"
baseopt_echo

aqseq 321

1 ze
  d11 pl12:f2
2 d11 do:f2
  ; purge before d1
  20u pl6:f1
  (2mp ph1):f1
  (3mp ph2):f1

  4u BLKGRAD

  ; relaxation period, with off-res presat
  30u fq=cnst21(bf hz):f1
  d12 pl9:f1
  d1 cw:f1 ph29
  d13 do:f1
  d12 pl1:f1 pl2:f2
  30u fq=0:f1
  50u UNBLKGRAD

  (p3 ph1):f2    ; crush eq'm 13C magnetisation
  d13
  p16:gp1
  d16

  ; start main sequence
  (p1 ph1):f1  ; INEPT
  "DELTA1 = d2 - p1*0.6366"
  DELTA1

  if "l1 % 4 == 0"
    {
  (p3 ph11):f2
  "DELTA = d3 - p3"
  DELTA
  (p3*2 ph1):f2
  "DELTA = vd*0.5 + d0*0.5 - p3 - p1*2 - p19 - d16"
  DELTA
  p19:gp2
  d16
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
  "DELTA = d3 + d0*0.5 - p3 - p1*2"
  DELTA
  (p3*2 ph1):f2
  p19:gp2
  d16
  "DELTA = vd*0.5 - p3 - p19 - d16"
  DELTA
  (p3 ph1):f2
    }

  if "l1 % 4 == 1"
    {
  (p3 ph11):f2
  (p3*2 ph1):f2
  "DELTA = d3 - p3 + vd*0.5 + d0*0.5 - p3 - p1*2 - p19 - d16"
  DELTA
  p19:gp2
  d16
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
  "DELTA = d0*0.5 - p1*2"
  DELTA
  (p3*2 ph1):f2
  p19:gp2
  d16
  "DELTA = d3 - p3 + vd*0.5 - p3 - p19 - d16"
  DELTA
  (p3 ph1):f2
    }

  if "l1 % 4 == 2"
    {
  (p3 ph11):f2
  "DELTA = vd*0.5 - p3 - p19 - d16"
  DELTA
  p19:gp2
  d16
  (p3*2 ph1):f2
  "DELTA = d3 + d0*0.5 - p3 - p1*2"
  DELTA
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
  p19:gp2
  d16
  "DELTA = vd*0.5 + d0*0.5 - p3 - p1*2 - p19 - d16"
  DELTA
  (p3*2 ph1):f2
  "DELTA = d3 - p3"
  DELTA
  (p3 ph1):f2
    }

   if "l1 % 4 == 3"
    {
  (p3 ph11):f2
  "DELTA = vd*0.5 - p3 - p19 - d16 + d3 - p3"
  DELTA
  p19:gp2
  d16
  (p3*2 ph1):f2
  "DELTA = d0*0.5 - p1*2"
  DELTA
  (p1 ph2):f1
  (p2 ph1):f1
  (p1 ph2):f1
  p19:gp2
  d16
  "DELTA = vd*0.5 + d0*0.5 - p3 - p1*2 - p19 - d16 + d3 - p3"
  DELTA
  (p3*2 ph1):f2
  (p3 ph1):f2
    }

   ; back-transfer
  "DELTA2 = d2 - d12 - 4u"
  DELTA2
  d12 pl12:f2
  4u BLKGRAD

  ; acquisition
  go=2 ph31 cpd2:f2

  d11 do:f2 mc #0 to 2
    F2I(ip11, 3, iu1, 2)
    F2EA(iu1, id0)
    F1QF(rd0 & rp11 & ru1 & ivd)

  4u BLKGRAD
exit

ph1= 0
ph2= 1
ph11= (3) 0
ph29=0
ph31=0

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;pl3 : f3 channel - power level for pulse (default)
;pl9 : f1 channel - power level for presaturation
;pl12: f2 channel - power level for CPD/BB decoupling
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p16: homospoil/gradient pulse
;p19: gradient pulse [300 usec]
;d0 : incremented delay (2D)                         [3 usec]
;d1 : relaxation delay; 1-5 * T1
;d2 : 1/(2J)CH
;d3 : 1/(8J)CH
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d13: short delay                                    [4 usec]
;d16: delay for homospoil/gradient recovery
;cnst2: = J(CH)
;cnst21: frequency in Hz for off-res presat
;inf1: 1/SW(X) = 2 * DW(X)
;in0: 1/(2 * SW(X)) = DW(X)
;l0: number of repeats for entire experiment
;NS: 1 * n
;DS: 16
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEQ
;cpd2: decoupling according to sequence defined by cpdprg2
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;for z-only gradients:
;gpz1: 31%
;gpz2: 7%
;gpz3: -40%
;gpz4: 29%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.32
;gpnam4: SMSQ10.32


updating comments for sfhmqcf2gpph.nuws.cw

;sfhmqcf2gpph.nuws.cw
;1H,13C SOFAST HMQC
;switch on NUWS with -DNUWS
;option for first-increment only with -DONE_D
;with apodisation-weighted sampling
;with exorcycle on 1H 180
;phase sensitive
;with decoupling during acquisition
;
;set sampling schedule via vclist:
;  total number of scans = ns * c
;  add one to first point of vclist to allow for dummy scans
;
;modified Chris Waudby 10/10/16
;
;P.Schanda and B. Brutscher, J. Am. Chem. Soc. 127, 8014 (2005)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

prosol relations=<triple>

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

#ifdef NUWS
define loopcounter dsFlag
; dsFlag starts as 1, will be set to zero after first set of dummy scans is completed
"dsFlag=1"
#endif /* NUWS */

"d11=30m"
"d12=20u"
"d21=1s/(cnst2*2)"

"in0=inf1"

"d0=in0/2-p3*4/3.1415"

"DELTA1=d21-p16-d16-p39*cnst39"
"DELTA2=p39*cnst39-de-4u"
"acqt0=de"

"spoff23=bf1*(cnst19/1000000)-o1"
"spoff24=bf1*(cnst19/1000000)-o1"

1 ze
  d11 pl12:f2
2 d1 do:f2
3 d12 pl2:f2
  50u UNBLKGRAD

  ; purge equilibrium 13C
  (p3 ph1):f2
  4u
  p16:gp2
  d16

  (p39:sp23 ph1):f1
  p16:gp1
  d16

#ifdef ONE_D
  (center (p40:sp24 ph2):f1 (DELTA1 p3 ph3 0.1u p3 ph4 DELTA1):f2 )
#else
  (center (p40:sp24 ph2):f1 (DELTA1 p3 ph3 d0 p3 ph4 DELTA1):f2 )
#endif /* ONE_D */

  DELTA2
  p16:gp1
  d16 pl12:f2
  4u BLKGRAD
  go=2 ph31 cpd2:f2

#ifdef NUWS
  if "dsFlag==0" goto 10
  zd
  "dsFlag=0"
  goto 2
10 4u

  ; repeat acquisition block according to schedule in vclist
  lo to 2 times c
  30u ivc
#endif /* NUWS */

  d1 do:f2 mc #0 to 2
     F1PH(ip3, id0)
exit

ph1=0
ph2=0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3
ph3=0 2
ph4=0 0 2 2
ph31=0 2 2 0 2 0 0 2

;pl2 : f2 channel - power level for pulse (default)
;pl12: f2 channel - power level for CPD/BB decoupling (low power)
;sp23: f1 channel - shaped pulse 120 degree (Pc9_4_120.1000)
;sp24: f1 channel - shaped pulse 180 degree (Reburp.1000)
;p16: homospoil/gradient pulse                       [1 msec]
;p3:  f2 channel -  90 degree high power pulse
;p39: f1 channel - 120 degree shaped pulse for excitation
;                      Pc9_4_120.1000 (120o)
;p40: f1 channel - 180 degree shaped pulse for refocussing
;                      Reburp.1000
;d0 : incremented delay (2D) = in0/2-p3*4/3.1415
;d1 : relaxation delay
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d16: delay for homospoil/gradient recovery
;cnst2: = J(CH) [125 Hz for methyls]
;cnst19: H(met) chemical shift (offset, in ppm)
;cnst39: compensation of chemical shift evolution during p39
;           Pc9_4_120.1000: 0.529
;inf1: 1/SW(C) = 2 * DW(C)
;in0: 1/ SW(C) = 2 * DW(C)
;nd0: 1
;NS: 4 * n
;DS: 16
;aq: <= 50 msec
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEC
;cpd2: decoupling according to sequence defined by cpdprg2: garp4
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;use gradient ratio:	gp 1 : gp 2
;			  11 :    7

;for z-only gradients:
;gpz1: 11%
;gpz2:  7%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100

                                          ;preprocessor-flags-start
                                          ;preprocessor-flags-end

;Processing

;PHC0(F1): 90
;PHC1(F1): -180
;FCOR(F1): 1

;$Id: sfhmqcf3gpph,v 1.1.2.8 2009/11/18 11:19:58 ber Exp $

;sfhmqcf2gpph.nuws.cw
;1H,13C SOFAST HMQC
;switch on NUWS with -DNUWS
;option for first-increment only with -DONE_D
;with apodisation-weighted sampling
;with exorcycle on 1H 180
;phase sensitive
;with decoupling during acquisition
;
;set sampling schedule via vclist:
;  total number of scans = ns * c
;  add one to first point of vclist to allow for dummy scans
;
;modified Chris Waudby 10/10/16
;
;P.Schanda and B. Brutscher, J. Am. Chem. Soc. 127, 8014 (2005)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

prosol relations=<triple>

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

#ifdef NUWS
define loopcounter dsFlag
; dsFlag starts as 1, will be set to zero after first set of dummy scans is completed
"dsFlag=1"
#endif /* NUWS */

"d11=30m"
"d12=20u"
"d21=1s/(cnst2*2)"

"in0=inf1"

"d0=in0/2-p3*4/3.1415"

"DELTA1=d21-p16-d16-p39*cnst39"
"DELTA2=p39*cnst39-de-4u"
"acqt0=de"

"spoff23=bf1*(cnst19/1000000)-o1"
"spoff24=bf1*(cnst19/1000000)-o1"

1 ze
  d11 pl12:f2
2 d1 do:f2
3 d12 pl2:f2
  50u UNBLKGRAD

  ; purge equilibrium 13C
  (p3 ph1):f2
  4u
  p16:gp2
  d16

  (p39:sp23 ph1):f1
  p16:gp1
  d16

#ifdef ONE_D
  (center (p40:sp24 ph2):f1 (DELTA1 p3 ph3 0.1u p3 ph4 DELTA1):f2 )
#else
  (center (p40:sp24 ph2):f1 (DELTA1 p3 ph3 d0 p3 ph4 DELTA1):f2 )
#endif /* ONE_D */

  DELTA2
  p16:gp1
  d16 pl12:f2
  4u BLKGRAD
  go=2 ph31 cpd2:f2

#ifdef NUWS
  if "dsFlag==0" goto 10
  zd
  "dsFlag=0"
  goto 2
10 4u

  ; repeat acquisition block according to schedule in vclist
  lo to 2 times c
  30u ivc
#endif /* NUWS */

  d1 do:f2 mc #0 to 2
     F1PH(ip3, id0)
exit

ph1=0
ph2=0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3
ph3=0 2
ph4=0 0 2 2
ph31=0 2 2 0 2 0 0 2

;pl2 : f2 channel - power level for pulse (default)
;pl12: f2 channel - power level for CPD/BB decoupling (low power)
;sp23: f1 channel - shaped pulse 120 degree
;                   (Pc9_4_120.1000 or Q5.1000)
;sp24: f1 channel - shaped pulse 180 degree (Rsnob.1000)
;p16: homospoil/gradient pulse                       [1 msec]
;p3:  f2 channel -  90 degree high power pulse
;p39: f1 channel - 120 degree shaped pulse for excitation
;                      Pc9_4_120.1000 (120o)    (3.0ms at 600.13 MHz)
;                  (or Q5.1000 (90o)            (2.0ms at 600.13 MHz) )
;p40: f1 channel - 180 degree shaped pulse for refocussing
;                      Rsnob.1000               (1.0ms at 600.13 MHz)
;d0 : incremented delay (2D) = in0/2-p3*4/3.1415
;d1 : relaxation delay
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d16: delay for homospoil/gradient recovery
;d21 : 1/(2J)NH
;cnst2: = J(CH) [125 Hz for methyls]
;cnst19: H(N) chemical shift (offset, in ppm)
;cnst39: compensation of chemical shift evolution during p39
;           Pc9_4_120.1000: 0.529
;           Q5.1000: -0.07
;inf1: 1/SW(C) = 2 * DW(C)
;in0: 1/ SW(C) = 2 * DW(C)
;nd0: 1
;NS: 4 * n
;DS: 16
;aq: <= 50 msec
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEC
;cpd2: decoupling according to sequence defined by cpdprg2: garp4
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;use gradient ratio:	gp 1 : gp 2
;			  11 :    7

;for z-only gradients:
;gpz1: 11%
;gpz2:  7%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100

                                          ;preprocessor-flags-start
                                          ;preprocessor-flags-end

;Processing

;PHC0(F1): 90
;PHC1(F1): -180
;FCOR(F1): 1

;$Id: sfhmqcf3gpph,v 1.1.2.8 2009/11/18 11:19:58 ber Exp $


correcting prosol relations stebpgp1sprxc_dec.3.cw

;With 13C decoupling: check AQ < 140 ms
;
;With possibility for multiple acquisition blocks when NS > phase cycle
;  => set TD0 > 1 (total scans = TD0*NS)
;
;From stebpgp1s19xc.jk
;Using presaturation for water suppression
;Adiabatic inversion pulses on 13C during INEPT periods where proton magnetization transverse.
;Hard 180s on 13C during INEPT periods where carbon magnetization transverse.
;Moved water flipback into ZZ period during back transfer
;
;From MH_XSte
;Modified to use convention that d20 is equal to big delta
;Reduced time between gradient pulses in bipolar pairs (tau):
;    tau = d16 + p8
;
;H-1/X correlation via double refocused inept transfer
;ste during the transfer steps and storage of the magnetization on the X-nucleus during the diffusion delay
;watergate after the decoding gradients for use with z-only gradient probes
;1D version
;written by Fabien Ferrage, last modification November 22nd 2004
;
;Ferrage et al., JACS (2004) 126:5654

prosol relations=<triple>

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

define list<gradient> diff=<Difframp>

"p2=p1*2"
"p4=p3*2"
"d4=1s/(cnst4*4)-p30-d16-0.5*larger(p8,p2)"
"d5=1s/(cnst4*cnst12)-p19-d16-0.5*larger(p4,p2)"
"d11=30m"
"d13=4u"
"d12=20u"
"d15=50u"

"DELTA1=d20-8*d16-6*p19-4*p3-2*larger(p4,p2)-4*d5-2*d12-2*d13-2*d15-2*p30-2*p1-2*d4-p8"

1 ze
  d11
  d12 BLKGRAD
2 d11 do:f2
3 d11
4 d12
  d12 pl9:f1
  d1 cw:f1 ph29
  d13 do:f1
  d12 pl1:f1 pl2:f2
  (p3 ph4):f2
  d15 UNBLKGRAD
  p19:gp4                     		;Eqm Cz spoiler
  d16
  (p1 ph4):f1
  d4
  p30:gp6*diff                		;gradient encoding
  d16 pl0:f2
  (center (p2 ph4):f1 (p8:sp13 ph4):f2)
  p30:gp6*-1*diff                     ;gradient encoding
  d16 pl2:f2
  d4
  (p1 ph1):f1
  d15
  p19:gp2                     		;2HzCz spoiler
  d16
  (p3 ph4):f2
  d5
  p19:gp8                     		;spoiler (echo)
  d16
  (center (p2 ph2):f1 (p4 ph4):f2)
  d5
  p19:gp8                     		;spoiler (echo)
  d16
  (p3 ph5):f2
  d15
  p19:gp3                     		;Cz spoiler
  d16 BLKGRAD
  d12 pl9:f1
  DELTA1 cw:f1 ph29
  d13 do:f1
  d12 pl1:f1
  (p3 ph6):f2
  d5 UNBLKGRAD
  p19:gp9                     		;spoiler (echo)
  d16
  (center (p2 ph4):f1 (p4 ph4):f2)
  d5
  p19:gp9                     		;spoiler (echo)
  d16
  (p3 ph2):f2
  d13
  (p1 ph2):f1
  d4
  p30:gp6*diff                     	;gradient decoding
  d16 pl0:f2
  (center (p2 ph2):f1 (p8:sp13 ph4):f2)
  p30:gp6*-1*diff                     ;gradient decoding
  d16 pl12:f2
  d4 BLKGRAD
  go=2 ph31 cpd2:f2
  d11 do:f2 wr #0 if #0 zd igrad diff
  lo to 3 times td1
  d11 do:f2 rf #0
  lo to 4 times td0
exit

ph1= 1
ph2= 2
ph3= 3
ph4= 0
ph5= 1 3
ph6= 1 1 3 3
ph29=0
ph31=0 2 2 0

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p8 : f2 channel - adiabatic inversion pulse
;p30 : encode/decode gradient [small delta = 2*p30]
;p19 : spoiler gradient [500-900 us]
;sp13: f2 channel - power level for adiabatic inversion
;spnam13 : Crp60,0.5,20.1
;d1 : relaxation delay; 1-5 * T1
;d16 : gradient recovery delay [200usec]
;d20 : diffusion delay (big delta)
;cnst4: = J(CH) [125-145 Hz]
;cnst12: multiplicity selection - 4=CH,CH3; 8=CH2,CH3,(CH); 10=CH3,CH2,(CH)
;NS: 4 * n
;DS: 8
;td0: dimension of accumulation loop (no. of acqusition blocks)
;td1: number of experiments

;gpz2: 2HzCz crush [17 %]
;gpz3: Cz crush [13 %]
;gpz4: Eqm Cz crush [11 %]
;gpz6: Diffusion [100%]
;gpz8: 180 pair [9 %]
;gpz9: 180 pair [15 %]

;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.100
;gpnam4: SMSQ10.100
;gpnam6: SMSQ10.100
;gpnam8: SMSQ10.100
;gpnam9: SMSQ10.100

;With 13C decoupling: check AQ < 140 ms
;
;With possibility for multiple acquisition blocks when NS > phase cycle
;  => set TD0 > 1 (total scans = TD0*NS)
;
;From stebpgp1s19xc.jk
;Using presaturation for water suppression
;Adiabatic inversion pulses on 13C during INEPT periods where proton magnetization transverse.
;Hard 180s on 13C during INEPT periods where carbon magnetization transverse.
;Moved water flipback into ZZ period during back transfer
;
;From MH_XSte
;Modified to use convention that d20 is equal to big delta
;Reduced time between gradient pulses in bipolar pairs (tau):
;    tau = d16 + p8
;
;H-1/X correlation via double refocused inept transfer
;ste during the transfer steps and storage of the magnetization on the X-nucleus during the diffusion delay
;watergate after the decoding gradients for use with z-only gradient probes
;1D version
;written by Fabien Ferrage, last modification November 22nd 2004
;
;Ferrage et al., JACS (2004) 126:5654

prosol relations=<triple_d>

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

define list<gradient> diff=<Difframp>

"p2=p1*2"
"p4=p3*2"
"d4=1s/(cnst4*4)-p30-d16-0.5*larger(p8,p2)"
"d5=1s/(cnst4*cnst12)-p19-d16-0.5*larger(p4,p2)"
"d11=30m"
"d13=4u"
"d12=20u"
"d15=50u"

"DELTA1=d20-8*d16-6*p19-4*p3-2*larger(p4,p2)-4*d5-2*d12-2*d13-2*d15-2*p30-2*p1-2*d4-p8"

1 ze
  d11
  d12 BLKGRAD
2 d11 do:f2
3 d11
4 d12
  d12 pl9:f1
  d1 cw:f1 ph29
  d13 do:f1
  d12 pl1:f1 pl2:f2
  (p3 ph4):f2
  d15 UNBLKGRAD
  p19:gp4                     		;Eqm Cz spoiler
  d16
  (p1 ph4):f1
  d4
  p30:gp6*diff                		;gradient encoding
  d16 pl0:f2
  (center (p2 ph4):f1 (p8:sp13 ph4):f2)
  p30:gp6*-1*diff                     ;gradient encoding
  d16 pl2:f2
  d4
  (p1 ph1):f1
  d15
  p19:gp2                     		;2HzCz spoiler
  d16
  (p3 ph4):f2
  d5
  p19:gp8                     		;spoiler (echo)
  d16
  (center (p2 ph2):f1 (p4 ph4):f2)
  d5
  p19:gp8                     		;spoiler (echo)
  d16
  (p3 ph5):f2
  d15
  p19:gp3                     		;Cz spoiler
  d16 BLKGRAD
  d12 pl9:f1
  DELTA1 cw:f1 ph29
  d13 do:f1
  d12 pl1:f1
  (p3 ph6):f2
  d5 UNBLKGRAD
  p19:gp9                     		;spoiler (echo)
  d16
  (center (p2 ph4):f1 (p4 ph4):f2)
  d5
  p19:gp9                     		;spoiler (echo)
  d16
  (p3 ph2):f2
  d13
  (p1 ph2):f1
  d4
  p30:gp6*diff                     	;gradient decoding
  d16 pl0:f2
  (center (p2 ph2):f1 (p8:sp13 ph4):f2)
  p30:gp6*-1*diff                     ;gradient decoding
  d16 pl12:f2
  d4 BLKGRAD
  go=2 ph31 cpd2:f2
  d11 do:f2 wr #0 if #0 zd igrad diff
  lo to 3 times td1
  d11 do:f2 rf #0
  lo to 4 times td0
exit

ph1= 1
ph2= 2
ph3= 3
ph4= 0
ph5= 1 3
ph6= 1 1 3 3
ph29=0
ph31=0 2 2 0

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p8 : f2 channel - adiabatic inversion pulse
;p30 : encode/decode gradient [small delta = 2*p30]
;p19 : spoiler gradient [500-900 us]
;sp13: f2 channel - power level for adiabatic inversion
;spnam13 : Crp60,0.5,20.1
;d1 : relaxation delay; 1-5 * T1
;d16 : gradient recovery delay [200usec]
;d20 : diffusion delay (big delta)
;cnst4: = J(CH) [125-145 Hz]
;cnst12: multiplicity selection - 4=CH,CH3; 8=CH2,CH3,(CH); 10=CH3,CH2,(CH)
;NS: 4 * n
;DS: 8
;td0: dimension of accumulation loop (no. of acqusition blocks)
;td1: number of experiments

;gpz2: 2HzCz crush [17 %]
;gpz3: Cz crush [13 %]
;gpz4: Eqm Cz crush [11 %]
;gpz6: Diffusion [100%]
;gpz8: 180 pair [9 %]
;gpz9: 180 pair [15 %]

;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.100
;gpnam4: SMSQ10.100
;gpnam6: SMSQ10.100
;gpnam8: SMSQ10.100
;gpnam9: SMSQ10.100


hmqcnoesyhmqcccgpph.4d.2.cw tested

hmqcnoesyhmqcccgpph.4d.2.cw tested

;4D 13C HMQC-NOESY-13C HMQC
;gradient selection in second HMQC
;for methyl-methyl NOES
;NUS with random quadrature detection
; (thanks to Daniel Nietlispach)
;Chris W, Dec 2017
;
; uses vclist and vplist to set evolution times and phases
; vclist = t1
;          t2
;          t3
;          ...
; vplist = 1 (r)
;          2 (i)
;          1 (E/AE)
;          ...
;
;F1(H) -> F2(H[mq],t1,d30) -> F2(C[mq],t2,d0) ---NOE--> F1(H) -> F2(C[mq],t3,d10) -> F1(H,t4)
;
;MQ evolution for 1H (taking advantage of methyl trosy)
;Uses half-dwell first-point delay by default in all indirect dims
;Option for off-res presat
;Removal of 13C equilibrium magnetisation
;Delays adjusted for zero first-order phase correction in acqusition dim

;$CLASS=HighRes
;$DIM=4D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

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

;------------standard delays/pulses
"p2=p1*2"
"p4=p3*2"
"d2=1s/(cnst2*2)"
"d11=30m"

;------------summary
;               t1      t2      t3      t4
;nucleus        1H      13C     13C     1H
;               noe     noe     dir     dir
;axis           F1      F2      F3      F4
;delay          d0      d10     d20
;increments     id0     id10    id20
;initial dwell  1/2     1/2     1/2
;mode           states  states  E/AE    direct
;tppi?          tppi    tppi    tppi
;aqseq 4321

;------------increments
"in0=inf1/2"  ; t1 (1Hnoe)
"in10=inf2/2"  ; t2 (13Cnoe)
"in20=inf3/2"  ; t3 (13Cdir)

;------------initial evolution times
"d0=in0/2-p3"  ; t1 (1Hnoe)
"d10=in10/2-p2"  ; t2 (13Cnoe)
"d20=3u"  ; t3 (13Cdir)

;------------other delays
"TAU=d8-p16*2-d16*2-p3"
;"DELTA=p3*0.6366+p17+d17-p2-d20"
"DELTA=p3*0.6366+50u-p2-d20"
"DELTA1=d2-p16-d16"
"DELTA2=d2-0.6366*p1"
"DELTA3=d2-p17-d16-4u-de"

"acqt0=de"

;------------NUS preamble
; loop counters
"l5=1" ; t1
"l6=1" ; t2
"l7=1" ; t3
"l0=1" ; for gradient selection in t3

;set l1 = numner of NUS points to record

;------------loop for NUS points
ze
1 d11 pl12:f2

;------------calculate NUS stuff here
; 1. reset loop counters and phases
20u rp11
20u rp12
20u rp13
20u rp31
20u ru5
20u ru6
20u ru7

; 2. set l5,l6,l7 = vc
41 20u iu5
  lo to 41 times c
  20u ivc

51 20u iu6
  lo to 51 times c
  20u ivc

61 20u iu7
  lo to 61 times c
  20u ivc

"d31=20m-20u*(l5-1)-20u*(l6-1)-20u*(l7-1)"
d31 ; compensate for calculation time

; 3. states-tppi for phases p11,p12,p13
if "l5%2 == 1"
  {
  ip11*2
  ip31*2
  }
if "l6%2 == 1"
  {
  ip12*2
  ip31*2
  }
if "l7%2 == 1"
  {
  ip13*2
  ip31*2
  }

; 4. set phases for quadrature detection
if "vp > 1"  ; t1
  {
  ip11
  }
  20u ivp

if "vp > 1"  ; t2
  {
  20u ip12
  }
  20u ivp

if "vp == 1"  ; t3 (echo/anti-echo)
  {
  "l0=1"
  }
else
  {
  "l0=2"
  }
  20u ivp

; 5. calculate evolution times
20u rd0
20u rd10
20u rd20
"d0=d0+in0*(l5-2)"
"d10=d10+in10*(l6-2)"
"d20=d20+in20*(l7-2)"
20u

;------------ns loop
2 d11 do:f2
  4u BLKGRAD

# ifdef OFFRES_PRESAT
    30u fq=cnst21(bf hz):f1
# endif /*OFFRES_PRESAT*/
  4u pl9:f1
  d1 cw:f1 ph29
  4u do:f1
  4u pl1:f1 pl2:f2
  4u fq=0:f1
  4u UNBLKGRAD

;------------kill equm 13C magnetisation
  (p3 ph1):f2
  4u
  p16:gp1
  d16*2

;------------start first 13C HMQC element
  (p1 ph11):f1
  DELTA1
  p16:gp2
  d16

  (p3 ph12):f2
  ; t1 - 1H F1 indirect evolution (as MQ)
  d0
  (p4 ph4):f2
  d0
  ; t2 - 13C F2 evolution (MQ)
  d10
  (p1 ph1):f1
  (p2 ph2):f1
  (p1 ph1):f1
  d10
  (p3 ph1):f2

  p16:gp2
  d16
  DELTA1
  (p1 ph3):f1

;------------NOE mixing period
  TAU

  p16:gp3*0.71
  d16
  (p3 ph1):f2
  p16:gp3
  d16

;------------start second 13C HMQC element (gradient selected)
  (p1 ph1):f1
  DELTA2

  (p3 ph13):f2
  p17:gp4
  d17
  50u
  (p4 ph2):f2
  p17:gp4*-1
  d17
  DELTA
  d20
  (p1 ph1):f1
  (p2 ph2):f1
  (p1 ph1):f1
  d20
  DELTA
  p17:gp4*-1
  d17
  (p4 ph1):f2
  p17:gp4
  d17
  50u
  (p3 ph1):f2

  DELTA3 pl12:f2
  if "l0 % 2 == 1"
    {
    p17:gp5
    d16
    }
  else
    {
    p17:gp5*-1
    d16
    }
  4u BLKGRAD

;------------acquisition (ns)
  go=2 ph31 cpd2:f2

;------------loop back and calculate next NUS/RQC point
  d11 do:f2 wr #0 if #0 zd
  lo to 1 times l1

  20u BLKGRAD

exit

ph1= 0
ph2= 1
;ph3=(8) 1
ph3= 0
ph4= 0 0 1 1
ph11=0
ph12=0 2
ph13=0
ph29=0
ph31=0 2 2 0

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;pl3 : f3 channel - power level for pulse (default)
;pl9 : f1 channel - power level for presaturation
;pl12: f2 channel - power level for CPD/BB decoupling
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p16: homospoil/gradient pulse                       [1 msec]
;p17: second gradient pulse                          [250 usec]
;d0 : incremented delay (4D)
;d10: incremented delay (4D)
;d20: incremented delay (4D)
;d1 : relaxation delay; 1-5 * T1
;d2 : 1/(2J)CH
;d8 : mixing time
;d11: delay for disk I/O                             [30 msec]
;d16: delay for homospoil/gradient recovery [200 usec]
;d17: short delay for homospoil/gradient recovery [100 usec]
;l1: number of NUS points
;cnst2: = J(CH)
;cnst21: frequency in Hz for off-res presat
;inf1: 1/SW(H)
;inf2: 1/SW(C) = 2 * DW(C)
;inf3: 1/SW(C) = 2 * DW(C)
;in0: 1/(2 * SW(H)) = DW(H)
;in10: 1/(2 * SW(C)) = DW(C)
;in20: 1/(2 * SW(C)) = DW(C)
;nd0: 2
;nd10: 2
;nd20: 2
;NS: 2 * n
;DS: 16
;td1: number of experiments in F1
;td2: number of experiments in F2
;td3: number of experiments in F3
;FnMODE: States-TPPI (or States) in F1
;FnMODE: States-TPPI (or States) in F2
;FnMODE: States-TPPI (or States) in F3
;cpd2: decoupling according to sequence defined by cpdprg2
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;for z-only gradients:
;gpz1: 31%
;gpz2: 13%
;gpz3: 50%
;gpz4: 20%
;gpz5: 20.1%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.100
;gpnam4: SINE.20
;gpnam5: SINE.20

                                          ;preprocessor-flags-start
;OFFRES_PRESAT: for off-resonance presaturation, set cnst21=o1(water)
;F2_plane: for zero 13C phase evolution in F3
;F3_plane: for zero 13C phase evolution in F2
;NUS: for non-uniform sampling (Topspin 3)
                                          ;preprocessor-flags-end

;4D 13C HMQC-NOESY-13C HMQC
;gradient selection in second HMQC
;for methyl-methyl NOES
;NUS with random quadrature detection
; (thanks to Daniel Nietlispach)
;Chris W, Dec 2017
;
; uses vclist and vplist to set evolution times and phases
; vclist = t1
;          t2
;          t3
;          ...
; vplist = 1 (r)
;          2 (i)
;          1 (E/AE)
;          ...
;
;F1(H) -> F2(H[mq],t1,d30) -> F2(C[mq],t2,d0) ---NOE--> F1(H) -> F2(C[mq],t3,d10) -> F1(H,t4)
;
;MQ evolution for 1H (taking advantage of methyl trosy)
;Uses half-dwell first-point delay by default in all indirect dims
;Option for off-res presat
;Removal of 13C equilibrium magnetisation
;Delays adjusted for zero first-order phase correction in acqusition dim

;$CLASS=HighRes
;$DIM=4D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

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

;------------standard delays/pulses
"p2=p1*2"
"p4=p3*2"
"d2=1s/(cnst2*2)"
"d11=30m"

;------------summary
;               t1      t2      t3      t4
;nucleus        1H      13C     13C     1H
;               noe     noe     dir     dir
;axis           F1      F2      F3      F4
;delay          d0      d10     d20
;increments     id0     id10    id20
;initial dwell  1/2     1/2     1/2
;mode           states  states  E/AE    direct
;tppi?          tppi    tppi    tppi
;aqseq 4321

;------------increments
"in0=inf1/2"  ; t1 (1Hnoe)
"in10=inf2/2"  ; t2 (13Cnoe)
"in20=inf3/2"  ; t3 (13Cdir)

;------------initial evolution times
"d0=in0/2-p3"  ; t1 (1Hnoe)
"d10=in10/2-p2"  ; t2 (13Cnoe)
"d20=3u"  ; t3 (13Cdir)

;------------other delays
"TAU=d8-p16*2-d16*2-p3"
"DELTA=p3*0.6366+p17+d17-p2-d0"
"DELTA1=d2-p16-d16"
"DELTA2=d2-0.6366*p1"
"DELTA3=d2-p17-d16-4u-de"

"acqt0=de"

;------------NUS preamble
; loop counters
"l5=1" ; t1
"l6=1" ; t2
"l7=1" ; t3
"l0=1" ; for gradient selection in t3

;set l1 = numner of NUS points to record

;------------loop for NUS points
ze
1 d11 pl12:f2

;------------calculate NUS stuff here
; 1. reset loop counters and phases
20u rp11
20u rp12
20u rp13
20u rp31
20u ru5
20u ru6
20u ru7

; 2. set l5,l6,l7 = vc
41 20u iu5
  lo to 41 times c
  20u ivc

51 20u iu6
  lo to 51 times c
  20u ivc

61 20u iu7
  lo to 61 times c
  20u ivc

"d31=20m-20u*(l5-1)-20u*(l6-1)-20u*(l7-1)"
d31 ; compensate for calculation time

; 3. states-tppi for phases p11,p12,p13
if "l5%2 == 1"
  {
  ip11*2
  ip31*2
  }
if "l6%2 == 1"
  {
  ip12*2
  ip31*2
  }
if "l7%2 == 1"
  {
  ip13*2
  ip31*2
  }

; 4. set phases for quadrature detection
if "vp > 1"  ; t1
  {
  ip11
  }
  20u ivp

if "vp > 1"  ; t2
  {
  20u ip12
  }
  20u ivp

if "vp == 1"  ; t3 (echo/anti-echo)
  {
  "l0=1"
  }
else
  {
  "l0=2"
  }
  20u ivp

; 5. calculate evolution times
20u rd0
20u rd10
20u rd20
"d0=d0+in0*(l5-2)"
"d10=d10+in10*(l6-2)"
"d20=d20+in20*(l7-2)"
20u

;------------ns loop
2 d11 do:f2
  4u BLKGRAD

# ifdef OFFRES_PRESAT
    30u fq=cnst21(bf hz):f1
# endif /*OFFRES_PRESAT*/
  4u pl9:f1
  d1 cw:f1 ph29
  4u do:f1
  4u pl1:f1 pl2:f2
  4u fq=0:f1
  4u UNBLKGRAD

;------------kill equm 13C magnetisation
  (p3 ph1):f2
  4u
  p16:gp1
  d16*2

;------------start first 13C HMQC element
  (p1 ph11):f1
  DELTA1
  p16:gp2
  d16

  (p3 ph12):f2
  ; t1 - 1H F1 indirect evolution (as MQ)
  d0
  (p4 ph2):f2
  d0
  ; t2 - 13C F2 evolution (MQ)
  d10
  (p1 ph1):f1
  (p2 ph2):f1
  (p1 ph1):f1
  d10
  (p3 ph1):f2

  p16:gp2
  d16
  DELTA1
  (p1 ph3):f1

;------------NOE mixing period
  TAU

  p16:gp3*0.71
  d16
  (p3 ph1):f2
  p16:gp3
  d16

;------------start second 13C HMQC element (gradient selected)
  (p1 ph1):f1
  DELTA2

  (p3 ph13):f2
  p17:gp4
  d17
  (p4 ph2):f2
  DELTA
  d20
  (p1 ph1):f1
  (p2 ph2):f1
  (p1 ph1):f1
  d20
  DELTA
  (p4 ph1):f2
  p17:gp4
  d17
  (p3 ph4):f2

  DELTA3 pl12:f2
  if "l0 % 2 == 1"
    {
    p17:gp5
    d16
    }
  else
    {
    p17:gp5*-1
    d16
    }
  4u BLKGRAD

;------------acquisition (ns)
  go=2 ph31 cpd2:f2

;------------loop back and calculate next NUS/RQC point
  d11 do:f2 wr #0 if #0 zd
  lo to 1 times l1

  20u BLKGRAD

exit

ph1= 0
ph2= 1
;ph3=(8) 1
ph3= 0
ph11=0
ph12=0 2
ph13=0
ph29=0
ph31=0 2

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;pl3 : f3 channel - power level for pulse (default)
;pl9 : f1 channel - power level for presaturation
;pl12: f2 channel - power level for CPD/BB decoupling
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p16: homospoil/gradient pulse                       [1 msec]
;p17: second gradient pulse                          [250 usec]
;d0 : incremented delay (4D)
;d10: incremented delay (4D)
;d20: incremented delay (4D)
;d1 : relaxation delay; 1-5 * T1
;d2 : 1/(2J)CH
;d8 : mixing time
;d11: delay for disk I/O                             [30 msec]
;d16: delay for homospoil/gradient recovery [200 usec]
;d17: short delay for homospoil/gradient recovery [100 usec]
;l1: number of NUS points
;cnst2: = J(CH)
;cnst21: frequency in Hz for off-res presat
;inf1: 1/SW(H)
;inf2: 1/SW(C) = 2 * DW(C)
;inf3: 1/SW(C) = 2 * DW(C)
;in0: 1/(2 * SW(H)) = DW(H)
;in10: 1/(2 * SW(C)) = DW(C)
;in20: 1/(2 * SW(C)) = DW(C)
;nd0: 2
;nd10: 2
;nd20: 2
;NS: 2 * n
;DS: 16
;td1: number of experiments in F1
;td2: number of experiments in F2
;td3: number of experiments in F3
;FnMODE: States-TPPI (or States) in F1
;FnMODE: States-TPPI (or States) in F2
;FnMODE: States-TPPI (or States) in F3
;cpd2: decoupling according to sequence defined by cpdprg2
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;for z-only gradients:
;gpz1: 31%
;gpz2: 13%
;gpz3: 50%
;gpz4: 40%
;gpz5: 20.1%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.100
;gpnam4: SINE.20
;gpnam5: SINE.20

                                          ;preprocessor-flags-start
;OFFRES_PRESAT: for off-resonance presaturation, set cnst21=o1(water)
;F2_plane: for zero 13C phase evolution in F3
;F3_plane: for zero 13C phase evolution in F2
;NUS: for non-uniform sampling (Topspin 3)
                                          ;preprocessor-flags-end


correcting phase cycling

correcting phase cycling

; multiplet-resolved 13C T1p measurement
;   based on hsqcphpr_1Hcoupled.3.cw
; run as pseudo-3D
; set td1 = 4 * number of relaxation times
;
; to separate into sub-components:
;   aaa = A + 2B + 2C + D
;   aab = A +  B -  C - D
;   abb = A -  B -  C + D
;   bbb = A - 2B + 2C - D
;
; May 2017
;
; with off-resonance presat
; ZZ/crusher periods, clean-up gradient pairs
; (90,-180) phase correction
; use baseopt
;
;hsqcphpr
;avance-version (07/04/04)
;HSQC
;2D H-1/X correlation via double inept transfer
;phase sensitive
;with decoupling during acquisition
;
;G. Bodenhausen & D.J. Ruben, Chem. Phys. Lett. 69, 185 (1980)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

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

define list<delay> Trelax = <$VDLIST>

"p2=p1*2"
"d2=p2"
"p4=p3*2"
"p22=p21*2"
"d4=1s/(cnst2*4)"
"d11=30m"
"d12=20u"
"d13=4u"

"TAU1=0.1u"
"TAU2=1s/(cnst2*12)-0.6366*p3-larger(p1,p3)"
"TAU3=1s/(cnst2*6)-0.6366*p3-larger(p1,p3)"
"TAU4=1s/(cnst2*4)-0.6366*p3-larger(p1,p3)"

"in0=inf2"
"d0=in0/2-2*0.6366*p3"

"DELTA=d4-p16-d16-larger(p1,p3)-0.6366*p1"
"DELTA1=d4-p19-d16-p10-p1-4u-0.6366*p1"
"DELTA2=d4-p19-d16-p10-p1-12u"
"acqt0=0"

; calculate offset for WFB
"spoff1=cnst21-o1"

; loop counter for interleaving
"l0=0"

; loop counters for acquisition
"l1 = td1 / 4"
"l2 = td2 / 2"

aqseq 312

1 ze
  d11 pl12:f2
2 d11 do:f2
3 4u
4 4u
5 4u
6 4u

  ; off-resonance presat
  30u pl9:f1
  30u fq=cnst21(bf hz):f1
  d1 cw:f1 ph1
  30u do:f1
  30u fq=0:f1

  ; purge equilibrium 13C
  30u UNBLKGRAD
  4u pl1:f1 pl2:f2
  (p3 ph1):f2
  p16:gp0
  d16

  ; begin main sequence
  (p1 ph1)
  p16:gp1
  d16
  DELTA
  (center (p2 ph1) (p4 ph1):f2 )
  DELTA
  p16:gp1
  d16
  (p1 ph11)

  ; zz purge
  p16:gp2
  d16

  ; multiplet filter
  if "l0 % 4 == 0"
  {
  (p3 ph1):f2
  (center (p1 ph2 p2 ph1 p1 ph2):f1 (TAU1 p4 ph1 TAU1):f2 )
  (p3 ph1):f2
  }

  if "l0 % 4 == 1"
  {
  (p3 ph1):f2
  (center (p1 ph2 p2 ph1 p1 ph2):f1 (TAU2 p4 ph1 TAU2):f2 )
  (p3 ph2):f2
  }

  if "l0 % 4 == 2"
  {
  (p3 ph1):f2
  (center (p1 ph2 p2 ph1 p1 ph2):f1 (TAU3 p4 ph1 TAU3):f2 )
  (p3 ph3):f2
  }

  if "l0 % 4 == 3"
  {
  (p3 ph1):f2
  (center (p1 ph2 p2 ph1 p1 ph2):f1 (TAU4 p4 ph1 TAU4):f2 )
  (p3 ph4):f2
  }

  ; 13C spin-lock and t1
  (p3 ph13):f2
  0.1u pl8:f2
  Trelax cw:f2 ph2
  0.1u do:f2
  d0 pl2:f2
  (p3 ph14):f2

  ; zz purge
  p16:gp3
  d16

  ; final inept
  (p1 ph1)
  p19:gp4
  d16
  DELTA1
  (p10:sp1 ph3):f1
  4u pl1:f1
  (center (p2 ph1) (p4 ph1):f2 )
  4u
  (p10:sp1 ph3):f1
  DELTA2
  p19:gp4
  d16
  4u BLKGRAD
  4u pl12:f2

  go=2 ph31 cpd2:f2
  d11 do:f2 wr #0 if #0 zd

  4u Trelax.inc
  lo to 3 times l1

  4u iu0
  lo to 4 times 4

  4u ip14
  lo to 5 times 2

  4u id0
  lo to 6 times l2

exit

ph1=0
ph2=1
ph3=2
ph4=3
ph11=1 1 1 1 3 3 3 3
ph13=0 2
ph14=0 0 2 2
ph31=0 2 2 0 2 0 0 2

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;pl9 : f1 channel - power level for presaturation
;pl12: f2 channel - power level for CPD/BB decoupling
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p10 : f1 channel - 90 degree selective pulse [1000 usec]
;sp1 : f1 channel - 90 degree WFB (p10)
;d0 : incremented delay (2D)
;d1 : relaxation delay; 1-5 * T1
;d4 : 1/(4J)XH
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d13: short delay                                    [4 usec]
;cnst2: = J(XH)
;cnst21: off-resonance presaturation frequency (bf hz)
;inf1: 1/SW(X) = DW(X)
;in0: 1/SW(X) = DW(X)
;nd0: 1
;NS: 8 * n
;DS: 16
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEQ
;cpd2: decoupling according to sequence defined by cpdprg2
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;for z-only gradients:
;gpz0: 46 %
;gpz1: 13 %
;gpz2: 17 %
;gpz3: 33 %
;gpz4: 29 %

;gradients
;p16: 1000u
;p19: 300u

;use gradient files:
;gpnam0: SMSQ10.100
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.100
;gpnam4: SINE.10

; multiplet-resolved 13C T1p measurement
;   based on hsqcphpr_1Hcoupled.3.cw
; run as pseudo-3D
; set td1 = 4 * number of relaxation times
;
; to separate into sub-components:
;   aaa = A + 2B + 2C + D
;   aab = A +  B -  C - D
;   abb = A -  B -  C + D
;   bbb = A - 2B + 2C - D
;
; May 2017
;
; with off-resonance presat
; ZZ/crusher periods, clean-up gradient pairs
; (90,-180) phase correction
; use baseopt
;
;hsqcphpr
;avance-version (07/04/04)
;HSQC
;2D H-1/X correlation via double inept transfer
;phase sensitive
;with decoupling during acquisition
;
;G. Bodenhausen & D.J. Ruben, Chem. Phys. Lett. 69, 185 (1980)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

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

define list<delay> Trelax = <$VDLIST>

"p2=p1*2"
"d2=p2"
"p4=p3*2"
"p22=p21*2"
"d4=1s/(cnst2*4)"
"d11=30m"
"d12=20u"
"d13=4u"

"TAU1=0.1u"
"TAU2=1s/(cnst2*12)-0.6366*p3-larger(p1,p3)"
"TAU3=1s/(cnst2*6)-0.6366*p3-larger(p1,p3)"
"TAU4=1s/(cnst2*4)-0.6366*p3-larger(p1,p3)"

"in0=inf2"
"d0=in0/2-2*0.6366*p3"

"DELTA=d4-p16-d16-larger(p1,p3)-0.6366*p1"
"DELTA1=d4-p19-d16-p10-p1-4u-0.6366*p1"
"DELTA2=d4-p19-d16-p10-p1-12u"
"acqt0=0"

; calculate offset for WFB
"spoff1=cnst21-o1"

; loop counter for interleaving
"l0=0"

; loop counters for acquisition
"l1 = td1 / 4"
"l2 = td2 / 2"

aqseq 312

1 ze
  d11 pl12:f2
2 d11 do:f2
3 4u
4 4u
5 4u
6 4u

  ; off-resonance presat
  30u pl9:f1
  30u fq=cnst21(bf hz):f1
  d1 cw:f1 ph1
  30u do:f1
  30u fq=0:f1

  ; purge equilibrium 13C
  30u UNBLKGRAD
  4u pl1:f1 pl2:f2
  (p3 ph1):f2
  p16:gp0
  d16

  ; begin main sequence
  (p1 ph1)
  p16:gp1
  d16
  DELTA
  (center (p2 ph1) (p4 ph1):f2 )
  DELTA
  p16:gp1
  d16
  (p1 ph11)

  ; zz purge
  p16:gp2
  d16

  ; multiplet filter
  if "l0 % 4 == 0"
  {
  (p3 ph1):f2
  (center (p1 ph2 p2 ph1 p1 ph2):f1 (TAU1 p4 ph1 TAU1):f2 )
  (p3 ph1):f2
  }

  if "l0 % 4 == 1"
  {
  (p3 ph1):f2
  (center (p1 ph2 p2 ph1 p1 ph2):f1 (TAU2 p4 ph1 TAU2):f2 )
  (p3 ph2):f2
  }

  if "l0 % 4 == 2"
  {
  (p3 ph1):f2
  (center (p1 ph2 p2 ph1 p1 ph2):f1 (TAU3 p4 ph1 TAU3):f2 )
  (p3 ph3):f2
  }

  if "l0 % 4 == 3"
  {
  (p3 ph1):f2
  (center (p1 ph2 p2 ph1 p1 ph2):f1 (TAU4 p4 ph1 TAU4):f2 )
  (p3 ph4):f2
  }

  ; 13C spin-lock and t1
  (p3 ph13):f2
  0.1u pl8:f2
  Trelax cw:f2 ph2
  0.1u do:f2
  d0 pl2:f2
  (p3 ph14):f2

  ; zz purge
  p16:gp3
  d16

  ; final inept
  (p1 ph1)
  p19:gp4
  d16
  DELTA1
  (p10:sp1 ph3):f1
  4u pl1:f1
  (center (p2 ph1) (p4 ph1):f2 )
  4u
  (p10:sp1 ph3):f1
  DELTA2
  p19:gp4
  d16
  4u BLKGRAD
  4u pl12:f2

  go=2 ph31 cpd2:f2
  d11 do:f2 wr #0 if #0 zd

  4u Trelax.inc
  lo to 3 times l1

  4u iu0
  lo to 4 times 4

  4u ip13
  lo to 5 times 2

  4u id0
  lo to 6 times l2

exit

ph1=0
ph2=1
ph3=2
ph4=3
ph11=1 1 1 1 3 3 3 3
ph13=0 2
ph14=0 0 2 2
ph31=0 2 2 0 2 0 0 2

;pl1 : f1 channel - power level for pulse (default)
;pl2 : f2 channel - power level for pulse (default)
;pl9 : f1 channel - power level for presaturation
;pl12: f2 channel - power level for CPD/BB decoupling
;p1 : f1 channel -  90 degree high power pulse
;p2 : f1 channel - 180 degree high power pulse
;p3 : f2 channel -  90 degree high power pulse
;p4 : f2 channel - 180 degree high power pulse
;p10 : f1 channel - 90 degree selective pulse [1000 usec]
;sp1 : f1 channel - 90 degree WFB (p10)
;d0 : incremented delay (2D)
;d1 : relaxation delay; 1-5 * T1
;d4 : 1/(4J)XH
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d13: short delay                                    [4 usec]
;cnst2: = J(XH)
;cnst21: off-resonance presaturation frequency (bf hz)
;inf1: 1/SW(X) = DW(X)
;in0: 1/SW(X) = DW(X)
;nd0: 1
;NS: 8 * n
;DS: 16
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEQ
;cpd2: decoupling according to sequence defined by cpdprg2
;pcpd2: f2 channel - 90 degree pulse for decoupling sequence

;for z-only gradients:
;gpz0: 46 %
;gpz1: 13 %
;gpz2: 17 %
;gpz3: 33 %
;gpz4: 29 %

;gradients
;p16: 1000u
;p19: 300u

;use gradient files:
;gpnam0: SMSQ10.100
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.100
;gpnam4: SINE.10


testing b_trosy_hzdqc.cw, still water suppression problems

;BEST-TROSY-H(Z/D)QC
;Chris Waudby, June 2018
;
;options:
; -DDQ = HDQC (otherwise runs HZQC)
; -DONE_D = first-row
; -DOFFRES_PRESAT = presat, pl9 on cnst21 (Hz bf)

prosol relations=<triple>

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

"d11=30m"
"d12=20u"
"d13=4u"
"d21=1s/(cnst4*4)"

"p22=p21*2"

"in0=inf1"
# ifdef ONE_D
"d0=2u"
#else
"d0=in0/2-p21*4/3.1415"
# endif /*ONE_D*/

"d2=p39-p39*cnst39-0.3633*p21"
"d3=0.5*p40-0.3633*p21"
"DELTA1=d21-p39*cnst39-p40*0.5-p16-d16-4u"
"DELTA2=d21-0.3633*p21-p16-d16-4u-0.5*p40"
"DELTA3=d21-p40-p16-d16-4u"
"DELTA4=d21-0.5*p40-p16-d16-4u-p21-de"
"acqt0=de"

# ifdef OFFRES_PRESAT
  "TAU=d1-d11-60u-d12*2-d13-d12-50u-p21-p16-d16-4u"
# else
  "TAU=d1-d11-d12-50u-p21-p16-d16-4u"
# endif /*OFFRES_PRESAT*/

"spoff23=bf1*(cnst19/1000000)-o1"
"spoff24=bf1*(cnst19/1000000)-o1"

"l0=1"  ; loop counter for shifting 1H 180 pulse between echo/anti-echoes

1 ze
  d11
2 d11

# ifdef OFFRES_PRESAT
  30u fq=cnst21(bf hz):f1
  d12 pl9:f1
  TAU cw:f1 ph29
  d13 do:f1
  d12 pl1:f1
  30u fq=0:f1
# else
  TAU
# endif /*OFFRES_PRESAT*/

3 d12 pl3:f3
  50u UNBLKGRAD

  ; purge Nz
  (p21 ph1):f3
  4u
  p16:gp0
  d16

  ; begin main sequence
  if "l0 %2 == 1"
     {
  (lalign (p39:sp23 ph1) (d2 p21 ph11):f3 )
     }
  else
     {
  (lalign (p39:sp23 ph1) (d2 p21 ph21):f3 )
     }

  DELTA1
  4u
  p16:gp1
  d16
  (center (p40:sp24 ph1) (p22 ph12):f3 )
  4u
  p16:gp1
  d16

  if "l0 %2 == 1"
     {
  (ralign (p40:sp24 ph1) (DELTA2 p21 ph13 d0 p21 ph1 d3):f3 )
  DELTA3
     }
  else
     {
  DELTA3
  (lalign (p40:sp24 ph1) (d3 p21 ph23 d0 p21 ph1 DELTA2):f3 )
     }
  4u
  p16:gp2
  d16
  (center (p40:sp24 ph1) (p22 ph1):f3 )
  4u
  p16:gp2
  d16
  DELTA4 BLKGRAD
  (p21 ph14):f3

  go=2 ph31
  d11 mc #0 to 2
     F1EA(iu0 & ip13*2 & ip14*2, id0)

exit

ph1=0
ph11=2 0 3 1
ph21=2 0 1 3
ph12=0
#ifdef DQ
ph13=1 3 2 0
ph23=1 3 0 2
ph14=3
#else /* ZQ */
ph13=1 3 0 2
ph23=1 3 2 0
ph14=1
#endif
ph31=0 2 3 1

;pl3 : f3 channel - power level for pulse (default)
;pl26: f3 channel - power level for CPD/BB decoupling (low power)
;sp23: f1 channel - shaped pulse 120 degree
;                   (Pc9_4_120.1000 or Q5.1000)
;sp24: f1 channel - shaped pulse 180 degree (Rsnob.1000)
;p16: homospoil/gradient pulse                       [1 msec]
;p21: f3 channel -  90 degree high power pulse
;p39: f1 channel - 120 degree shaped pulse for excitation
;                      Pc9_4_120.1000 (120o)    (3.0ms at 600.13 MHz)
;                  (or Q5.1000 (90o)            (2.0ms at 600.13 MHz) )
;p40: f1 channel - 180 degree shaped pulse for refocussing
;                      Rsnob.1000               (1.0ms at 600.13 MHz)
;d0 : incremented delay (2D) = in0/2-p21*4/3.1415
;d1 : relaxation delay
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d16: delay for homospoil/gradient recovery
;d21 : 1/(4J)NH
;cnst4: = J(NH)
;cnst19: H(N) chemical shift (offset, in ppm)
;cnst39: compensation of chemical shift evolution during p39
;           Pc9_4_90.1000: 0.514
;           Pc9_4_120.1000: 0.529
;inf1: 1/SW(N) = 2 * DW(N)
;in0: 1/ SW(N) = 2 * DW(N)
;nd0: 1
;NS: 4 * n
;DS: 16
;td1: number of experiments
;FnMODE: Echo-AntiEcho

;use gradient ratio:	gp 0 : gp 1 : gp 2
;			-16 :  11 :    7

;for z-only gradients:
;gpz0: -16%
;gpz1: 11%
;gpz2:  7%

;use gradient files:
;gpnam0: SMSQ10.100
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100

;Processing

;PHC0(F1): 90
;PHC1(F1): -180
;FCOR(F1): 1

;BEST-TROSY-H(Z/D)QC
;Chris Waudby, June 2018
;
;options:
; -DDQ = HDQC (otherwise runs HZQC)
; -DONE_D = first-row
; -DOFFRES_PRESAT = presat, pl9 on cnst21 (Hz bf)

prosol relations=<triple>

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

"d11=30m"
"d12=20u"
"d13=4u"
"d21=1s/(cnst4*2)"

"in0=inf1"
# ifdef ONE_D
"d0=2u"
#else
"d0=in0/2-p21*4/3.1415"
# endif /*ONE_D*/

"d2=p39-p39*cnst39-0.3633*p21"
"d3=0.5*p40-0.3633*p21"
"DELTA1=d21-p39*cnst39-p40*0.5-p16-d16"
"DELTA2=d21-0.3633*p21-p16-d16-0.5*p40"
"DELTA3=d21-p40-p16-d16"
"DELTA4=d21-0.5*p40-p16-d16-p21-de"
"acqt0=de"

# ifdef OFFRES_PRESAT
  "TAU=d1-d11-60u-d12*2-d13-d12-50u-p21-p16-d16"
# else
  "TAU=d1-d11-d12-50u-p21-p16-d16"
# endif /*OFFRES_PRESAT*/

"spoff23=bf1*(cnst19/1000000)-o1"
"spoff24=bf1*(cnst19/1000000)-o1"

"l0=1"  ; loop counter for shifting 1H 180 pulse between echo/anti-echoes

1 ze
  d11
2 d11

# ifdef OFFRES_PRESAT
  30u fq=cnst21(bf hz):f1
  d12 pl9:f1
  TAU cw:f1 ph29
  d13 do:f1
  d12 pl1:f1
  30u fq=0:f1
# else
  TAU
# endif /*OFFRES_PRESAT*/

3 d12 pl3:f3
  50u UNBLKGRAD

  ; purge Nz
  (p21 ph1):f3
  p16:gp0
  d16

  ; begin main sequence
  (lalign (p39:sp23 ph1) (d2 p21 ph11):f3 )
  DELTA1
  p16:gp1
  d16
  (center (p40:sp24 ph1) (p22 ph12):f3 )
  p16:gp1
  d16

  if "l0 %2 == 1"
     {
  (ralign (p40:sp24 ph1) (DELTA2 p21 ph13 d0 p21 ph1 d3):f3 )
  DELTA3
     }
  else
     {
  DELTA3
  (lalign (p40:sp24 ph1) (d3 p21 ph13 d0 p21 ph1 DELTA2):f3 )
     }

  p16:gp2
  d16
  (center (p40:sp24 ph1) (p22 ph1):f3 )
  p16:gp2
  d16
  DELTA4 BLKGRAD
  (p21 ph14):f3

  go=2 ph31
  d11 mc #0 to 2
     F1EA(iu0 & ip14*2 & ip31*2, id0)

exit

ph1=0
ph11=0 2 1 3
ph12=0 0 1 1
ph31=0 2 1 3
#ifdef DQ
ph13=1 3 2 0
ph14=3
#else /* ZQ */
ph13=3 1 0 2
ph14=1
#endif

;pl3 : f3 channel - power level for pulse (default)
;pl26: f3 channel - power level for CPD/BB decoupling (low power)
;sp23: f1 channel - shaped pulse 120 degree
;                   (Pc9_4_120.1000 or Q5.1000)
;sp24: f1 channel - shaped pulse 180 degree (Rsnob.1000)
;p16: homospoil/gradient pulse                       [1 msec]
;p21: f3 channel -  90 degree high power pulse
;p39: f1 channel - 120 degree shaped pulse for excitation
;                      Pc9_4_120.1000 (120o)    (3.0ms at 600.13 MHz)
;                  (or Q5.1000 (90o)            (2.0ms at 600.13 MHz) )
;p40: f1 channel - 180 degree shaped pulse for refocussing
;                      Rsnob.1000               (1.0ms at 600.13 MHz)
;d0 : incremented delay (2D) = in0/2-p21*4/3.1415
;d1 : relaxation delay
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d16: delay for homospoil/gradient recovery
;d21 : 1/(2J)NH
;cnst4: = J(NH)
;cnst19: H(N) chemical shift (offset, in ppm)
;cnst39: compensation of chemical shift evolution during p39
;           Pc9_4_90.1000: 0.514
;           Pc9_4_120.1000: 0.529
;inf1: 1/SW(N) = 2 * DW(N)
;in0: 1/ SW(N) = 2 * DW(N)
;nd0: 1
;NS: 4 * n
;DS: 16
;td1: number of experiments
;FnMODE: Echo-AntiEcho

;use gradient ratio:	gp 0 : gp 1 : gp 2
;			-16 :  11 :    7

;for z-only gradients:
;gpz0: -16%
;gpz1: 11%
;gpz2:  7%

;use gradient files:
;gpnam0: SMSQ10.100
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100

;Processing

;PHC0(F1): 90
;PHC1(F1): -180
;FCOR(F1): 1


fixing decoupling in cosyetgp_decoupled.cw


adding purge gradient to B-ZQ-TROSY

adding purge gradient to B-ZQ-TROSY

;BEST-TROSY-H(Z/D)QC
;Chris Waudby, June 2018
;
;options:
; -DDQ = HDQC (otherwise runs HZQC)
; -DONE_D = first-row
; -DOFFRES_PRESAT = presat, pl9 on cnst21 (Hz bf)

prosol relations=<triple>

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

"d11=30m"
"d12=20u"
"d13=4u"
"d21=1s/(cnst4*4)"

"p22=p21*2"

"in0=inf1"
# ifdef ONE_D
"d0=2u"
#else
"d0=in0/2-p21*4/3.1415"
# endif /*ONE_D*/

"d2=p39-p39*cnst39-0.3633*p21"
"d3=0.5*p40-0.3633*p21"
"DELTA1=d21-p39*cnst39-p40*0.5-p16-d16-4u"
"DELTA2=d21-0.3633*p21-p16-d16-4u-0.5*p40"
"DELTA3=d21-p40-p16-d16-4u"
"DELTA4=d21-0.5*p40-p16-d16-4u-p21-de"
"acqt0=de"

# ifdef OFFRES_PRESAT
  "TAU=d1-d11-60u-d12*2-d13-d12-50u-p21-2*p16-2*d16-12u"
# else
  "TAU=d1-d11-d12-50u-p21-2*p16-2*d16-12u"
# endif /*OFFRES_PRESAT*/

;"spoff23=bf1*(cnst19/1000000)-o1"
;"spoff24=bf1*(cnst19/1000000)-o1"
"spoff23=0" ; for amides on-resonance (recommended)
"spoff24=0"

"l0=1"  ; loop counter for shifting 1H 180 pulse between echo/anti-echoes

1 ze
  d11
2 d11

  4u UNBLKGRAD
  p16:gp3
  d16
  4u BLKGRAD

# ifdef OFFRES_PRESAT
  30u fq=cnst21(bf hz):f1
  d12 pl9:f1
  TAU cw:f1 ph1
  d13 do:f1
  d12 pl1:f1
  30u fq=0:f1
# else
  TAU
# endif /*OFFRES_PRESAT*/

3 d12 pl3:f3
  50u UNBLKGRAD

  ; purge Nz
  (p21 ph1):f3
  4u
  p16:gp0
  d16

  ; begin main sequence
  if "l0 %2 == 1"
     {
  ;(lalign (p39:sp23 ph10) (d2 p21 ph11):f3 )
  (p39:sp23 ph10) (d2 p21 ph11):f3
     }
  else
     {
  ;(lalign (p39:sp23 ph10) (d2 p21 ph21):f3 )
  (p39:sp23 ph10) (d2 p21 ph21):f3
     }

  DELTA1
  4u
  p16:gp1
  d16
  (center (p40:sp24 ph1) (p22 ph12):f3 )
  4u
  p16:gp1
  d16

  if "l0 %2 == 1"
     {
  (ralign (p40:sp24 ph16) (DELTA2 p21 ph13 d0 p21 ph1 d3):f3 )
  DELTA3
     }
  else
     {
  DELTA3
  ;(lalign (p40:sp24 ph16) (d3 p21 ph23 d0 p21 ph1 DELTA2):f3 )
  (p40:sp24 ph16) (d3 p21 ph23 d0 p21 ph1 DELTA2):f3
     }
  4u
  p16:gp2
  d16
  (center (p40:sp24 ph1) (p22 ph1):f3 )
  4u
  p16:gp2
  d16
  DELTA4 BLKGRAD
  (p21 ph14):f3

  go=2 ph31
  d11 mc #0 to 2
     F1EA(iu0 & ip13*2 & ip14*2, id0 & ip10*2 & ip31*2)

exit

ph1=0
ph10=0
ph11=2 0 3 1
ph21=2 0 1 3
ph12=0
#ifdef DQ
ph13=1 3 2 0
ph23=1 3 0 2
ph14=3
#else /* ZQ */
ph13=1 3 0 2
ph23=1 3 2 0
ph14=1
#endif
ph16=0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3
ph31=0 2 3 1 2 0 1 3

;pl3 : f3 channel - power level for pulse (default)
;pl26: f3 channel - power level for CPD/BB decoupling (low power)
;sp23: f1 channel - shaped pulse 120 degree
;                   (Pc9_4_120.1000 or Q5.1000)
;sp24: f1 channel - shaped pulse 180 degree (Rsnob.1000)
;p16: homospoil/gradient pulse                       [1 msec]
;p21: f3 channel -  90 degree high power pulse
;p39: f1 channel - 120 degree shaped pulse for excitation
;                      Pc9_4_120.1000 (120o)    (3.0ms at 600.13 MHz)
;                  (or Q5.1000 (90o)            (2.0ms at 600.13 MHz) )
;p40: f1 channel - 180 degree shaped pulse for refocussing
;                      Rsnob.1000               (1.0ms at 600.13 MHz)
;d0 : incremented delay (2D) = in0/2-p21*4/3.1415
;d1 : relaxation delay
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d16: delay for homospoil/gradient recovery
;d21 : 1/(4J)NH
;cnst4: = J(NH)
;cnst19: H(N) chemical shift (offset, in ppm)
;cnst39: compensation of chemical shift evolution during p39
;           Pc9_4_90.1000: 0.514
;           Pc9_4_120.1000: 0.529
;inf1: 1/SW(N) = 2 * DW(N)
;in0: 1/ SW(N) = 2 * DW(N)
;nd0: 1
;NS: 4 * n
;DS: 16
;td1: number of experiments
;FnMODE: Echo-AntiEcho

;use gradient ratio:	gp 0 : gp 1 : gp 2
;			-16 :  11 :    7

;for z-only gradients:
;gpz0: -16%
;gpz1: 11%
;gpz2:  7%
;gpz3: -23%

;use gradient files:
;gpnam0: SMSQ10.100
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100
;gpnam3: SMSQ10.100

;Processing

;PHC0(F1): 90
;PHC1(F1): -180
;FCOR(F1): 1

;BEST-TROSY-H(Z/D)QC
;Chris Waudby, June 2018
;
;options:
; -DDQ = HDQC (otherwise runs HZQC)
; -DONE_D = first-row
; -DOFFRES_PRESAT = presat, pl9 on cnst21 (Hz bf)

prosol relations=<triple>

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

"d11=30m"
"d12=20u"
"d13=4u"
"d21=1s/(cnst4*4)"

"p22=p21*2"

"in0=inf1"
# ifdef ONE_D
"d0=2u"
#else
"d0=in0/2-p21*4/3.1415"
# endif /*ONE_D*/

"d2=p39-p39*cnst39-0.3633*p21"
"d3=0.5*p40-0.3633*p21"
"DELTA1=d21-p39*cnst39-p40*0.5-p16-d16-4u"
"DELTA2=d21-0.3633*p21-p16-d16-4u-0.5*p40"
"DELTA3=d21-p40-p16-d16-4u"
"DELTA4=d21-0.5*p40-p16-d16-4u-p21-de"
"acqt0=de"

# ifdef OFFRES_PRESAT
  "TAU=d1-d11-60u-d12*2-d13-d12-50u-p21-p16-d16-4u"
# else
  "TAU=d1-d11-d12-50u-p21-p16-d16-4u"
# endif /*OFFRES_PRESAT*/

"spoff23=bf1*(cnst19/1000000)-o1"
"spoff24=bf1*(cnst19/1000000)-o1"

"l0=1"  ; loop counter for shifting 1H 180 pulse between echo/anti-echoes

1 ze
  d11
2 d11

# ifdef OFFRES_PRESAT
  30u fq=cnst21(bf hz):f1
  d12 pl9:f1
  TAU cw:f1 ph1
  d13 do:f1
  d12 pl1:f1
  30u fq=0:f1
# else
  TAU
# endif /*OFFRES_PRESAT*/

3 d12 pl3:f3
  50u UNBLKGRAD

  ; purge Nz
  (p21 ph1):f3
  4u
  p16:gp0
  d16

  ; begin main sequence
  if "l0 %2 == 1"
     {
  ;(lalign (p39:sp23 ph10) (d2 p21 ph11):f3 )
  (p39:sp23 ph10) (d2 p21 ph11):f3
     }
  else
     {
  ;(lalign (p39:sp23 ph10) (d2 p21 ph21):f3 )
  (p39:sp23 ph10) (d2 p21 ph21):f3
     }

  DELTA1
  4u
  p16:gp1
  d16
  (center (p40:sp24 ph1) (p22 ph12):f3 )
  4u
  p16:gp1
  d16

  if "l0 %2 == 1"
     {
  (ralign (p40:sp24 ph16) (DELTA2 p21 ph13 d0 p21 ph1 d3):f3 )
  DELTA3
     }
  else
     {
  DELTA3
  ;(lalign (p40:sp24 ph16) (d3 p21 ph23 d0 p21 ph1 DELTA2):f3 )
  (p40:sp24 ph16) (d3 p21 ph23 d0 p21 ph1 DELTA2):f3
     }
  4u
  p16:gp2
  d16
  (center (p40:sp24 ph1) (p22 ph1):f3 )
  4u
  p16:gp2
  d16
  DELTA4 BLKGRAD
  (p21 ph14):f3

  go=2 ph31
  d11 mc #0 to 2
     F1EA(iu0 & ip13*2 & ip14*2, id0 & ip10*2 & ip31*2)

exit

ph1=0
ph10=0
ph11=2 0 3 1
ph21=2 0 1 3
ph12=0
#ifdef DQ
ph13=1 3 2 0
ph23=1 3 0 2
ph14=3
#else /* ZQ */
ph13=1 3 0 2
ph23=1 3 2 0
ph14=1
#endif
ph16=0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3
ph31=0 2 3 1 2 0 1 3

;pl3 : f3 channel - power level for pulse (default)
;pl26: f3 channel - power level for CPD/BB decoupling (low power)
;sp23: f1 channel - shaped pulse 120 degree
;                   (Pc9_4_120.1000 or Q5.1000)
;sp24: f1 channel - shaped pulse 180 degree (Rsnob.1000)
;p16: homospoil/gradient pulse                       [1 msec]
;p21: f3 channel -  90 degree high power pulse
;p39: f1 channel - 120 degree shaped pulse for excitation
;                      Pc9_4_120.1000 (120o)    (3.0ms at 600.13 MHz)
;                  (or Q5.1000 (90o)            (2.0ms at 600.13 MHz) )
;p40: f1 channel - 180 degree shaped pulse for refocussing
;                      Rsnob.1000               (1.0ms at 600.13 MHz)
;d0 : incremented delay (2D) = in0/2-p21*4/3.1415
;d1 : relaxation delay
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d16: delay for homospoil/gradient recovery
;d21 : 1/(4J)NH
;cnst4: = J(NH)
;cnst19: H(N) chemical shift (offset, in ppm)
;cnst39: compensation of chemical shift evolution during p39
;           Pc9_4_90.1000: 0.514
;           Pc9_4_120.1000: 0.529
;inf1: 1/SW(N) = 2 * DW(N)
;in0: 1/ SW(N) = 2 * DW(N)
;nd0: 1
;NS: 4 * n
;DS: 16
;td1: number of experiments
;FnMODE: Echo-AntiEcho

;use gradient ratio:	gp 0 : gp 1 : gp 2
;			-16 :  11 :    7

;for z-only gradients:
;gpz0: -16%
;gpz1: 11%
;gpz2:  7%

;use gradient files:
;gpnam0: SMSQ10.100
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100

;Processing

;PHC0(F1): 90
;PHC1(F1): -180
;FCOR(F1): 1


fixing B_HNCA.cw

fixing B_HNCA.cw


baseopt for sfhmqcf3gpph.3d.cw

baseopt for sfhmqcf3gpph.3d.cw

;Pseudo-3D
;
;sfhmqcf3gpph
;avance-version (09/11/18)
;SOFAST HMQC
;2D H-1/X correlation via heteronuclear zero and double quantum
;   coherence
;phase sensitive
;with decoupling during acquisition
;
;P.Schanda and B. Brutscher, J. Am. Chem. Soc. 127, 8014 (2005)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

prosol relations=<triple>

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

"d11=30m"
"d12=20u"
"d21=1s/(cnst4*2)"

"in0=inf2"

"d0=in0/2-p21*4/3.1415"

"DELTA1=d21-p16-d16-p39*cnst39"
"DELTA2=p39*cnst39-de-4u"
"acqt0=de"

"spoff23=bf1*(cnst19/1000000)-o1"
"spoff24=bf1*(cnst19/1000000)-o1"

aqseq 321

1 ze
  d11 pl26:f3
2 d1 do:f3
3 d12 pl3:f3
  50u UNBLKGRAD

  p16:gp2
  d16

  (p39:sp23 ph1):f1
  p16:gp1
  d16

#   ifdef LABEL_CN
  (center (p40:sp24 ph2):f1 (p8:sp13 ph1):f2 (DELTA1 p21 ph3 d0 p21 ph4 DELTA1):f3 )
#   else
  (center (p40:sp24 ph2):f1 (DELTA1 p21 ph3 d0 p21 ph4 DELTA1):f3 )
#   endif /*LABEL_CN*/

  DELTA2
  p16:gp1
  d16 pl26:f3
  4u BLKGRAD
  go=2 ph31 cpd3:f3
  d1 do:f3 mc #0 to 2
     F1QF(rp3, rd0)
     F2PH(ip3, id0)
exit

ph1=0
ph2=0
ph3=0 2
ph4=0 0 2 2
ph31=0 2 2 0

;pl3 : f3 channel - power level for pulse (default)
;pl26: f3 channel - power level for CPD/BB decoupling (low power)
;sp13: f2 channel - shaped pulse 180 degree (adiabatic)
;sp23: f1 channel - shaped pulse 120 degree
;                   (Pc9_4_120.1000 or Q5.1000)
;sp24: f1 channel - shaped pulse 180 degree (Rsnob.1000)
;p8 : f2 channel - 180 degree shaped pulse for inversion (adiabatic)
;p16: homospoil/gradient pulse                       [1 msec]
;p21: f3 channel -  90 degree high power pulse
;p39: f1 channel - 120 degree shaped pulse for excitation
;                      Pc9_4_120.1000 (120o)    (3.0ms at 600.13 MHz)
;                  (or Q5.1000 (90o)            (2.0ms at 600.13 MHz) )
;p40: f1 channel - 180 degree shaped pulse for refocussing
;                      Rsnob.1000               (1.0ms at 600.13 MHz)
;d0 : incremented delay (2D) = in0/2-p21*4/3.1415
;d1 : relaxation delay
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d16: delay for homospoil/gradient recovery
;d21 : 1/(2J)NH
;cnst4: = J(NH)
;cnst19: H(N) chemical shift (offset, in ppm)
;cnst39: compensation of chemical shift evolution during p39
;           Pc9_4_120.1000: 0.529
;           Q5.1000: -0.07
;inf1: 1/SW(N) = 2 * DW(N)
;in0: 1/ SW(N) = 2 * DW(N)
;nd0: 1
;NS: 2 * n
;DS: 16
;aq: <= 50 msec
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEC
;cpd3: decoupling according to sequence defined by cpdprg3: garp4.p62
;pcpd3: f3 channel - 90 degree pulse for decoupling sequence
;          use pulse of >= 350 usec

;use gradient ratio:	gp 1 : gp 2
;			  11 :    7

;for z-only gradients:
;gpz1: 11%
;gpz2:  7%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100

                                          ;preprocessor-flags-start
;LABEL_CN: for C-13 and N-15 labeled samples start experiment with
;             option -DLABEL_CN (eda: ZGOPTNS)
                                          ;preprocessor-flags-end

;Processing

;PHC0(F1): 90
;PHC1(F1): -180
;FCOR(F1): 1

;$Id: sfhmqcf3gpph,v 1.1.2.8 2009/11/18 11:19:58 ber Exp $

;Pseudo-3D
;
;sfhmqcf3gpph
;avance-version (09/11/18)
;SOFAST HMQC
;2D H-1/X correlation via heteronuclear zero and double quantum
;   coherence
;phase sensitive
;with decoupling during acquisition
;
;P.Schanda and B. Brutscher, J. Am. Chem. Soc. 127, 8014 (2005)
;
;$CLASS=HighRes
;$DIM=2D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

prosol relations=<triple>

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

"d11=30m"
"d12=20u"
"d21=1s/(cnst4*2)"

"in0=inf2"

"d0=in0/2-p21*4/3.1415"

"DELTA1=d21-p16-d16-p39*cnst39"
"DELTA2=p39*cnst39-de-4u"

"spoff23=bf1*(cnst19/1000000)-o1"
"spoff24=bf1*(cnst19/1000000)-o1"

aqseq 321

1 ze
  d11 pl26:f3
2 d1 do:f3
3 d12 pl3:f3
  50u UNBLKGRAD

  p16:gp2
  d16

  (p39:sp23 ph1):f1
  p16:gp1
  d16

#   ifdef LABEL_CN
  (center (p40:sp24 ph2):f1 (p8:sp13 ph1):f2 (DELTA1 p21 ph3 d0 p21 ph4 DELTA1):f3 )
#   else
  (center (p40:sp24 ph2):f1 (DELTA1 p21 ph3 d0 p21 ph4 DELTA1):f3 )
#   endif /*LABEL_CN*/

  DELTA2
  p16:gp1
  d16 pl26:f3
  4u BLKGRAD
  go=2 ph31 cpd3:f3
  d1 do:f3 mc #0 to 2
     F1QF(rp3, rd0)
     F2PH(ip3, id0)
exit

ph1=0
ph2=0
ph3=0 2
ph4=0 0 2 2
ph31=0 2 2 0

;pl3 : f3 channel - power level for pulse (default)
;pl26: f3 channel - power level for CPD/BB decoupling (low power)
;sp13: f2 channel - shaped pulse 180 degree (adiabatic)
;sp23: f1 channel - shaped pulse 120 degree
;                   (Pc9_4_120.1000 or Q5.1000)
;sp24: f1 channel - shaped pulse 180 degree (Rsnob.1000)
;p8 : f2 channel - 180 degree shaped pulse for inversion (adiabatic)
;p16: homospoil/gradient pulse                       [1 msec]
;p21: f3 channel -  90 degree high power pulse
;p39: f1 channel - 120 degree shaped pulse for excitation
;                      Pc9_4_120.1000 (120o)    (3.0ms at 600.13 MHz)
;                  (or Q5.1000 (90o)            (2.0ms at 600.13 MHz) )
;p40: f1 channel - 180 degree shaped pulse for refocussing
;                      Rsnob.1000               (1.0ms at 600.13 MHz)
;d0 : incremented delay (2D) = in0/2-p21*4/3.1415
;d1 : relaxation delay
;d11: delay for disk I/O                             [30 msec]
;d12: delay for power switching                      [20 usec]
;d16: delay for homospoil/gradient recovery
;d21 : 1/(2J)NH
;cnst4: = J(NH)
;cnst19: H(N) chemical shift (offset, in ppm)
;cnst39: compensation of chemical shift evolution during p39
;           Pc9_4_120.1000: 0.529
;           Q5.1000: -0.07
;inf1: 1/SW(N) = 2 * DW(N)
;in0: 1/ SW(N) = 2 * DW(N)
;nd0: 1
;NS: 2 * n
;DS: 16
;aq: <= 50 msec
;td1: number of experiments
;FnMODE: States-TPPI, TPPI, States or QSEC
;cpd3: decoupling according to sequence defined by cpdprg3: garp4.p62
;pcpd3: f3 channel - 90 degree pulse for decoupling sequence
;          use pulse of >= 350 usec

;use gradient ratio:	gp 1 : gp 2
;			  11 :    7

;for z-only gradients:
;gpz1: 11%
;gpz2:  7%

;use gradient files:
;gpnam1: SMSQ10.100
;gpnam2: SMSQ10.100

                                          ;preprocessor-flags-start
;LABEL_CN: for C-13 and N-15 labeled samples start experiment with
;             option -DLABEL_CN (eda: ZGOPTNS)
                                          ;preprocessor-flags-end

;Processing

;PHC0(F1): 90
;PHC1(F1): -180
;FCOR(F1): 1

;$Id: sfhmqcf3gpph,v 1.1.2.8 2009/11/18 11:19:58 ber Exp $


correcting and testing 13CH3_1H_SQ_CPMG.cw (on 950)

/* 13CH3_1H_SQ_CPMG_lek_800_cp

This pulse sequence will allow one to perform the following experiment:

2D 1H/13C to measure exchange using 1H SQ magnetization from methyl groups

      (tau 180 tau)ncyc C 180y C (tau 180 tau)ncyc

where C refers to compensation 1H 180o pulses that compensate for the fact that
  starting from SQ coherence, different coherences are created during the
  evolution of the pulse

Assumes that sample is specifically 13CH3 labeled

    1H: O1 on methyl groups (~1.0ppm)
        pwh = p1 1H pw90 @ power level pl1 highest power
        pwh_cp = p15 1H pw90 @ power level pl15 for CPMG pulses

   13C: O2 centre at 20 ppm
        pwc = p2 13C pw90 @ power level pl2 highest power
        power level pl21 is used for 13C decoupling.

Pulse sequence has the option to use regular 180o 1H pulses or 90x240y90x
  (-Dcomp180_flg); the composite pulses are recommended

Pulse sequence has the option to begin the CPMG with equal amounts of inphase
  and antiphase (-Dipap_flg) so as to minimize the effects of different
  relaxation between the two that results from Cz. Recommend to use it - there
  is no penalty in terms of extra delays

Recommend: use -Dipap_flg -Dcomp180_flg -Dwater_flg -Df1180

This method compensates so that the number of 1H 180os is fixed. Does not
  include any 180o in the reference plane. The alternative is to set -Dref_flg
  that then includes the full number of 1H 180 in the reference plane (gives
  lower R2,eff) - not recommended

Sequence has option for reburp flag in the center of the CPMG period - not used.

The sequence uses a fixed time_T2 that is independent of the number of 1H 180o
  pulses

Sequence uses xy4 based phase cycle as simulations so that this is preferred
  over xy16

Use ncyc_max = 4*k
*/

prosol relations=<triple>

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

/***********************/
/* Define phases */
/***********************/
#define zero ph=0.0
#define one ph=90.0
#define two ph=180.0
#define three ph=270.0

/***********************/
/* Define pulses */
/***********************/
define pulse dly_pg1 /* Messerle purge pulse */
  "dly_pg1=5m"
define pulse dly_pg2 /* Messerle purge pulse */
  "dly_pg2=dly_pg1/1.62"
define pulse pwh
  "pwh=p1" /* 1H hard pulse at power level p1 (tpwr) */
define pulse pwc
  "pwc=p2" /* 13C pulse at power level pl2 (dhpwr) */
define pulse pwh_cp /* 1H CPMG pulse power level */
  "pwh_cp=p15"

#ifdef water_flg
  define pulse pw_sl1
    "pw_sl1=p14" /* Eburp1 pulse, ~7000 us */
#endif

#ifdef reb_flg
  define pulse pwh_reb
  "pwh_reb=4.875/(cnst8*bf1/1e6)" /* REBURP pulse length */
  "spw8=plw15*(pow((p15*2.0/pwh_reb)/0.07981,2))" /* REBURP power level */
#endif /*reb_flg*/

/************************/
/* Define delays */
/************************/
define delay hscuba /* length of 1/2 scuba delay */
  "hscuba=30m"
define delay taua
  "taua=d3" /* d3 = 1/4JHC exactly */
define delay time_T2
  "time_T2=d6" /* CPMG duration <= 40 ms */

"in0=inf1/2"
"d11=30m"
"TAU2=0.2u"

/************************/
/* Define f1180 */
/************************/
#ifdef f1180
  "d0=(in0/2)"
#else
  "d0=(0.2u/2)"
#endif

/*************************************/
/* Define parameters related to CPMG */
/*************************************/
define delay tauCPMG
define delay tauCPMG1
define list<loopcounter> ncyc_cp=<$VCLIST>

/******************************************************/
/* Assign cnsts to check validity of parameter ranges */
/******************************************************/
#ifdef fsat
  "cnst10=plw10" /* tsatpwr pl10 - set max at 0.00005W */
#endif

#ifdef mess_flg
  "cnst11=plw11" /* tpwrmess pl11 - set max at 1.0W */
#endif

#ifdef water_flg
  "cnst14=spw14" /* power level for eburp1 pulse preeceding start of sequenc e */
#endif

"cnst15=plw15" /* tpwrcp - power level for 1H CPMG pulses */
"cnst21=plw21" /* dpwr pl21 - set max at 2.0W */

/**********************/
/* Define CPMG pulses */
/**********************/
#ifdef comp180_flg
#define cpmg_11 (pwh_cp ph12 pwh_cp*2.66667 ph11 pwh_cp ph12):f1
#define cpmg_13 (pwh_cp ph14 pwh_cp*2.66667 ph13 pwh_cp ph14):f1
#define cpmg_21 (pwh_cp ph22 pwh_cp*2.66667 ph21 pwh_cp ph22):f1
#define cpmg_23 (pwh_cp ph24 pwh_cp*2.66667 ph23 pwh_cp ph24):f1
"cnst51=2.333335"
#else
#define cpmg_11 (pwh_cp*2.0 ph11):f1
#define cpmg_13 (pwh_cp*2.0 ph13):f1
#define cpmg_21 (pwh_cp*2.0 ph21):f1
#define cpmg_23 (pwh_cp*2.0 ph23):f1
"cnst51=1.0"
#endif

#define cpmg_F if "(nsdone+2)%8 < 4" {\n cpmg_11 \n}\n else {\n cpmg_13 \n}
#define cpmg_R if "(nsdone+2)%8 < 4" {\n cpmg_21 \n}\n else {\n cpmg_23 \n}

#ifndef no_compensate
  define loopcounter ncyc_max /* max value of ncyc used */
    "ncyc_max=l8"
  "DELTA8 = pwh_cp*2.0*cnst51*ncyc_max*2.0"
#endif

/************************/
/* Initialize variables */
/************************/
"l1=0"
"l2=0"
"l3=0"
"spoal8=0.5"
"spoff8=0"
"spoal14=1"
"spoff14=0"

aqseq 321

"acqt0=0"
baseopt_echo

1 ze
/******************************************************************/
/* Check validity of parameters and assign values to some of them */
/******************************************************************/
#ifdef fsat
  if "cnst10 > 0.00005" {
    2u
    print "error: tpwrmess pl10 too large; < 0.00005W !!!"
    goto HaltAcqu
  }
#endif
#ifdef mess_flg
  if "cnst11 > 1" {
    2u
    print "error: tpwrmess pl11 too large; < 1W !!!"
    goto HaltAcqu
  }
#endif
#ifdef water_flg
  if "cnst14 > 0.01" {
    2u
    print "error: power level for eburp1 pulse is too large; < 0.01W !!!"
    goto HaltAcqu
  }
#endif
if "cnst15 > 15" {
  2u
  print "error: 1H CPMG power pl15 too large; < 15W !!!"
  goto HaltAcqu
}
if "time_T2 > 40.1m" {
  2u
  print "error: time_T2 too long; < 41ms !!!"
  goto HaltAcqu
}
#ifndef no_compensate
  if "ncyc_max > 80" {
    2u
    print "error: ncyc_max too large; < 80 !!!"
    goto HaltAcqu
  }
  if "DELTA8 > 11m" {
    2u
    print "error: CPMG pulse duration too long; < 10ms !!!"
    goto HaltAcqu
  }
#endif
if "cnst21 > 6.0" {
  2u
  print "error: dpwr pl21 too large; < 2.0W !!!"
  goto HaltAcqu
}
if "aq > 64m" {
  2u
  print "error: aq is too long; < 64ms !!!"
  goto HaltAcqu
}

2 d11 do:f2
/************************/
/* Update list pointers */
/************************/
2u
"ncyc_cp.idx=l1"
2u rpp11 rpp12 rpp13 rpp14 rpp21 rpp22 rpp23 rpp24

/****************************************/
/* Continue to check run time variables */
/****************************************/
"l2 = (trunc(ncyc_cp + 0.3))"
2u
#ifdef no_compensate
  "l3 = 0"
#else /*no_compensate*/
#ifdef ref_flg
  "l3 = (trunc(ncyc_max - l2 + 0.3))"
#else /*ref_flg*/
  if "l2 > 0 " {
    "l3 = (trunc(ncyc_max - l2 + 0.3))"
  }
  else {
    "l3 = 0"
  }
#endif /*ref_flg*/
#endif /*no_compensate*/
if "l2 > 80" {
  2u
  print "error: ncyc_cp must be < 81 !!!"
  goto HaltAcqu
}
if "l2 > 0" {
  "tauCPMG = (time_T2*0.25)/l2"
#ifdef no_compensate
  "tauCPMG1 = tauCPMG - pwh_cp*cnst51"
#else
  "tauCPMG1 = tauCPMG - (DELTA8*0.25 + 0.2u*l3)/l2"
#endif
}
else {
  "tauCPMG = time_T2*0.25"
  "tauCPMG1 = 2u"
}

/**********************************/
/* 1H heating compensation period */
/**********************************/
4u pl15:f1

#if defined(ref_flg) || defined(no_compensate)
  "DELTA = 20u"
#else
  if "l2 == 0" {
    "DELTA = DELTA8 + 20u"
  }
  else {
    "DELTA = 20u"
  }
#endif

DELTA cw:f1 ph26
2u do:f1

/*************************************************/
/* Destroy residual 1H magnetization prior to d1 */
/*************************************************/
20u UNBLKGRAD

10u fq=cnst1(sfo hz):f1 /* 1H SFO1 @ tof(water) */
4u pl1:f1 /* power pl1 for 1H pulses */
(pwh ph26):f1

2u
p50:gp0*0.5
d16

(pwh ph27):f1

2u
p50:gp0
d16

4u BLKGRAD

/******************/
/* Messerle purge */
/******************/
#ifdef mess_flg
  4u pl11:f1
  (dly_pg1 ph26):f1
  2u
  (dly_pg2 ph27):f1
#endif

/*****************/
/* Presaturation */
/*****************/
#ifdef fsat
  4u pl10:f1
  d1 cw:f1 ph26
  2u do:f1
  4u pl1:f1
#ifdef fscuba
  hscuba
  (pwh ph26 pwh*2.0 ph27 pwh ph26):f1
  hscuba
#endif /*fscuba*/
#else /*fsat*/
  4u pl1:f1
  d1
#endif /*fsat*/
20u UNBLKGRAD

/**************************/
/* Water selective Eburp1 */
/**************************/
#ifdef water_flg
  2u
  (pw_sl1:sp14 ph26):f1
  2u
  2u
  p50:gp0
  d16
#endif

/****************************************/
/* Destroy 13C equlibrium magnetization */
/****************************************/
4u pl2:f2
(pwc ph26):f2

2u
p50:gp0
d16

/**************************/
/* This is the real start */
/**************************/
10u fq=0(sfo hz):f1
4u pl1:f1

(pwh ph26):f1

2u
p51:gp1
d16

"DELTA = taua*2.0 - 2u - p51 - d16 - pwh*2.0/PI"
DELTA

/*******************/
/* t1 period */
/*******************/
(pwc ph1):f2

"TAU1=larger(d0-pwh*2.0-pwc*2.0/PI,TAU2)"
TAU1

(pwh ph26 pwh*2.0 ph27 pwh ph26):f1

TAU1

(pwc ph26):f2

/************************************************/
/* Option to create 50%/50% IP/AP prior to CPMG */
/************************************************/
#ifdef ipap_flg
  if "nsdone%4 < 2" {
    "DELTA = taua + 4u"
    DELTA
    (pwh ph26 pwh*2.0 ph27 pwh ph26):f1
  }
  else {
    "DELTA = taua - 4u"
    DELTA
  }
#else
  4u
  (pwh ph26 pwh*2.0 ph27 pwh ph26):f1
#endif
4u pl15:f1

/*********************************/
/* The first half of CPMG period */
/*********************************/
  if "l2 > 0" {
3   tauCPMG1
    cpmg_F
    tauCPMG1 ipp11 ipp12 ipp13 ipp14 ipp21 ipp22 ipp23 ipp24
    lo to 3 times l2

  }

  if "l3 > 0" {
4   0.2u
    cpmg_F
    0.2u ipp11 ipp12 ipp13 ipp14 ipp21 ipp22 ipp23 ipp24
    lo to 4 times l3

}

/*****************************/
/* The central 180o 1H pulse */
/*****************************/
#ifdef reb_flg
  4u
  (pwh_reb:sp8 ph2):f1
  4u pl15:f1
#else /*reb_flg*/
  (pwh_cp*2.0 ph2):f1
#endif /*reb_flg*/

/**********************************/
/* The second half of CPMG period */
/**********************************/
  if "l3 > 0" {
5   0.2u dpp11 dpp12 dpp13 dpp14 dpp21 dpp22 dpp23 dpp24
    cpmg_R
    0.2u
    lo to 5 times l3

  }

  if "l2 > 0" {
6   tauCPMG1 dpp11 dpp12 dpp13 dpp14 dpp21 dpp22 dpp23 dpp24
    cpmg_R
    tauCPMG1
    lo to 6 times l2

  }

/**********************/
/* C->H back transfer */
/**********************/
#ifdef ipap_flg
  if "nsdone%4 >= 2" {
    4u pl1:f1
    (pwh ph26 pwh*2.0 ph29 pwh ph26):f1
    4u
  }
#endif
#ifdef ipap_flg
  "DELTA = taua - 2u - p51 - d16 - 4u - 4u - de"
#else
  "DELTA = taua*2.0 - 2u - p51 - d16 - 4u - 4u - de"
#endif
DELTA

2u
p51:gp1
d16

/************************************************************/
/* Option for 3-9-19 Watergate for better water suppression */
/************************************************************/
#ifdef wgate_flg
  4u pl1:f1
  "DELTA = 4u + 4u + de + 4u + de"
  DELTA

  2u
  p52:gp2
  d17

  (pwh*0.231 ph27):f1
  d19*2.0
  (pwh*0.692 ph29):f1
  d19*2.0
  (pwh*1.462 ph27):f1
  d19*2.0
  (pwh*1.462 ph27):f1
  d19*2.0
  (pwh*0.692 ph29):f1
  d19*2.0
  (pwh*0.231 ph27):f1

  2u
  p52:gp2
  d17
#endif

4u BLKGRAD
4u pl21:f2 /* lower power for 13C decoupling */

/********************************/
/* Signal detection and looping */
/********************************/
go=2 ph31 cpds2:f2
  d11 do:f2 mc #0 to 2
  F2QF(calclc(l1, 1))
  F1PH(calph(ph1, +90), caldel(d0, +in0) & calph(ph1, +180) & calph(ph31, +180))

HaltAcqu, 1m
exit

ph0=1
ph1=0 2
ph2=1 1 3 3 1 1 3 3 3 3 1 1 3 3 1 1
ph11=0 1 0 1
ph12=ph11-ph0
ph13=1 0 1 0
ph14=ph13-ph0
ph21=0 3 0 3
ph22=ph21+ph0
ph23=3 0 3 0
ph24=ph23+ph0
ph26=0
ph27=1
ph28=2
ph29=3
ph31=0 2

;d1: Repetition delay D1
;d3: taua - set to 1/4JHC = 2.0 ms
;d6: time_T2 CPMG duration <= 40ms
;d11: delay for disk i/o, 30ms
;d16: gradient recovery delay, 200us
;d17: gradient recovery delay for 3-9-19 watergate, 200us
;d19: delay for binomial water suppression, ~1/(4*|cnst1|)
;pl1: tpwr - power level for pwh
;pl2: dhpwr - power level for 13C pulse pwc (p2)
;pl10: tsatpwr - power level for presat
;pl11: tpwrmess - power level for Messerle purge
;pl15: power level for 1H CPMG pulses pwh_cp
;pl21: dpwr - power level for 13C decoupling cpd2
;sp14: power level for eburp1 pulse
;spnam8: Reburp.1000
;spnam14: eburp1 pulse on water
;p1: pwh
;p2: pwc
;p14: eburp1 pulse width, typically 7000us
;p15: 1H pw for CPMG pulses
;p50: gradient pulse 50 [1000 usec]
;p51: gradient pulse 51 [500 usec]
;p52: gradient pulse 52 [800 usec]
;cpdprg2: 13C decoupling program during t2 [waltz16]
;pcpd2: 13C pulse width for 13C decoupling
;cnst1: offset of water from methyls (Hz)
;cnst8: methyl H excitation bandwidth (ppm)
;vclist: variable counter list for ncyc_cp
;l8: ncyc_max (MUST BE SET PROPERLY!)
;delta8: total duration of 1H CPMG pulses
;inf1: 1/SW(X) = 2*DW(X)
;in0: 1/(2*SW(x))=DW(X)
;nd0: 2
;ns: 4*n
;FnMODE: States in F1
;FnMODE: QF in F2

;for z-only gradients:
;gpz0: 20%
;gpz1: 30%
;gpy2: 0% (Z-gradient) or 80% (XYZ-gradient)
;gpz2: 80% (Z-gradient) or 0% (XYZ-gradient)

;use gradient files:
;gpnam0: SMSQ10.32
;gpnam1: SMSQ10.32
;gpnam2: SMSQ10.32

;zgoptns: Dfsat, Dmess_flg, Dfscuba, Dwater_flg, Dwgate_flg, Df1180, Dcomp180_flg, D ipap_flg, Dreb_flg, Dref_flg, Dno_compensate

/* 13CH3_1H_SQ_CPMG_lek_800_cp

This pulse sequence will allow one to perform the following experiment:

2D 1H/13C to measure exchange using 1H SQ magnetization from methyl groups

      (tau 180 tau)ncyc C 180y C (tau 180 tau)ncyc

where C refers to compensation 1H 180o pulses that compensate for the fact that
  starting from SQ coherence, different coherences are created during the
  evolution of the pulse

Assumes that sample is specifically 13CH3 labeled

    1H: O1 on methyl groups (~1.0ppm)
        pwh = p1 1H pw90 @ power level pl1 highest power
        pwh_cp = p15 1H pw90 @ power level pl15 for CPMG pulses

   13C: O2 centre at 20 ppm
        pwc = p2 13C pw90 @ power level pl2 highest power
        power level pl21 is used for 13C decoupling.

Pulse sequence has the option to use regular 180o 1H pulses or 90x240y90x
  (-Dcomp180_flg); the composite pulses are recommended

Pulse sequence has the option to begin the CPMG with equal amounts of inphase
  and antiphase (-Dipap_flg) so as to minimize the effects of different
  relaxation between the two that results from Cz. Recommend to use it - there
  is no penalty in terms of extra delays

Recommend: use -Dipap_flg -Dcomp180_flg -Dwater_flg -Df1180

This method compensates so that the number of 1H 180os is fixed. Does not
  include any 180o in the reference plane. The alternative is to set -Dref_flg
  that then includes the full number of 1H 180 in the reference plane (gives
  lower R2,eff) - not recommended

Sequence has option for reburp flag in the center of the CPMG period - not used.

The sequence uses a fixed time_T2 that is independent of the number of 1H 180o
  pulses

Sequence uses xy4 based phase cycle as simulations so that this is preferred
  over xy16

Use ncyc_max = 4*k
*/

prosol relations=<triple>

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

/***********************/
/* Define phases */
/***********************/
#define zero ph=0.0
#define one ph=90.0
#define two ph=180.0
#define three ph=270.0

/***********************/
/* Define pulses */
/***********************/
define pulse dly_pg1 /* Messerle purge pulse */
  "dly_pg1=5m"
define pulse dly_pg2 /* Messerle purge pulse */
  "dly_pg2=dly_pg1/1.62"
define pulse pwh
  "pwh=p1" /* 1H hard pulse at power level p1 (tpwr) */
define pulse pwc
  "pwc=p2" /* 13C pulse at power level pl2 (dhpwr) */
define pulse pwh_cp /* 1H CPMG pulse power level */
  "pwh_cp=p15"

#ifdef water_flg
  define pulse pw_sl1
    "pw_sl1=p14" /* Eburp1 pulse, ~7000 us */
#endif

#ifdef reb_flg
  define pulse pwh_reb
  "pwh_reb=4.875/(cnst8*bf1/1e6)" /* REBURP pulse length */
  "spw8=plw15*(pow((p15*2.0/pwh_reb)/0.07981,2))" /* REBURP power level */
#endif /*reb_flg*/

/************************/
/* Define delays */
/************************/
define delay hscuba /* length of 1/2 scuba delay */
  "hscuba=30m"
define delay taua
  "taua=d3" /* d3 = 1/4JHC exactly */
define delay time_T2
  "time_T2=d6" /* CPMG duration <= 40 ms */

"in0=inf1/2"
"d11=30m"
"TAU2=0.2u"

/************************/
/* Define f1180 */
/************************/
#ifdef f1180
  "d0=(in0/2)"
#else
  "d0=(0.2u/2)"
#endif

/*************************************/
/* Define parameters related to CPMG */
/*************************************/
define delay tauCPMG
define delay tauCPMG1
define list<loopcounter> ncyc_cp=<$VCLIST>

/******************************************************/
/* Assign cnsts to check validity of parameter ranges */
/******************************************************/
#ifdef fsat
  "cnst10=plw10" /* tsatpwr pl10 - set max at 0.00005W */
#endif

#ifdef mess_flg
  "cnst11=plw11" /* tpwrmess pl11 - set max at 1.0W */
#endif

#ifdef water_flg
  "cnst14=spw14" /* power level for eburp1 pulse preeceding start of sequenc e */
#endif

"cnst15=plw15" /* tpwrcp - power level for 1H CPMG pulses */
"cnst21=plw21" /* dpwr pl21 - set max at 2.0W */

/**********************/
/* Define CPMG pulses */
/**********************/
#ifdef comp180_flg
#define cpmg_11 (pwh_cp ph12 pwh_cp*2.66667 ph11 pwh_cp ph12):f1
#define cpmg_13 (pwh_cp ph14 pwh_cp*2.66667 ph13 pwh_cp ph14):f1
#define cpmg_21 (pwh_cp ph22 pwh_cp*2.66667 ph21 pwh_cp ph22):f1
#define cpmg_23 (pwh_cp ph24 pwh_cp*2.66667 ph23 pwh_cp ph24):f1
"cnst51=2.333335"
#else
#define cpmg_11 (pwh_cp*2.0 ph11):f1
#define cpmg_13 (pwh_cp*2.0 ph13):f1
#define cpmg_21 (pwh_cp*2.0 ph21):f1
#define cpmg_23 (pwh_cp*2.0 ph23):f1
"cnst51=1.0"
#endif

#define cpmg_F if "(nsdone+2)%8 < 4" {\n cpmg_11 \n}\n else {\n cpmg_13 \n}
#define cpmg_R if "(nsdone+2)%8 < 4" {\n cpmg_21 \n}\n else {\n cpmg_23 \n}

#ifndef no_compensate
  define loopcounter ncyc_max /* max value of ncyc used */
    "ncyc_max=l8"
  "DELTA8 = pwh_cp*2.0*cnst51*ncyc_max*2.0"
#endif

/************************/
/* Initialize variables */
/************************/
"l1=0"
"l2=0"
"l3=0"
"spoal8=0.5"
"spoff8=0"
"spoal14=1"
"spoff14=0"

aqseq 321

"acqt0=0"
baseopt_echo

1 ze
/******************************************************************/
/* Check validity of parameters and assign values to some of them */
/******************************************************************/
#ifdef fsat
  if "cnst10 > 0.00005" {
    2u
    print "error: tpwrmess pl10 too large; < 0.00005W !!!"
    goto HaltAcqu
  }
#endif
#ifdef mess_flg
  if "cnst11 > 1" {
    2u
    print "error: tpwrmess pl11 too large; < 1W !!!"
    goto HaltAcqu
  }
#endif
#ifdef water_flg
  if "cnst14 > 0.01" {
    2u
    print "error: power level for eburp1 pulse is too large; < 0.01W !!!"
    goto HaltAcqu
  }
#endif
if "cnst15 > 15" {
  2u
  print "error: 1H CPMG power pl15 too large; < 15W !!!"
  goto HaltAcqu
}
if "time_T2 > 40.1m" {
  2u
  print "error: time_T2 too long; < 41ms !!!"
  goto HaltAcqu
}
#ifndef no_compensate
  if "ncyc_max > 80" {
    2u
    print "error: ncyc_max too large; < 80 !!!"
    goto HaltAcqu
  }
  if "DELTA8 > 10m" {
    2u
    print "error: CPMG pulse duration too long; < 10ms !!!"
    goto HaltAcqu
  }
#endif
if "cnst21 > 2.0" {
  2u
  print "error: dpwr pl21 too large; < 2.0W !!!"
  goto HaltAcqu
}
if "aq > 64m" {
  2u
  print "error: aq is too long; < 64ms !!!"
  goto HaltAcqu
}

2 d11 do:f2
/************************/
/* Update list pointers */
/************************/
2u
"ncyc_cp.idx=l1"
2u rpp11 rpp12 rpp13 rpp14 rpp21 rpp22 rpp23 rpp24

/****************************************/
/* Continue to check run time variables */
/****************************************/
"l2 = (trunc(ncyc_cp + 0.3))"
2u
#ifdef no_compensate
  "l3 = 0"
#else /*no_compensate*/
#ifdef ref_flg
  "l3 = (trunc(ncyc_max - l2 + 0.3))"
#else /*ref_flg*/
  if "l2 > 0 " {
    "l3 = (trunc(ncyc_max - l2 + 0.3))"
  }
  else {
    "l3 = 0"
  }
#endif /*ref_flg*/
#endif /*no_compensate*/
if "l2 > 80" {
  2u
  print "error: ncyc_cp must be < 81 !!!"
  goto HaltAcqu
}
if "l2 > 0" {
  "tauCPMG = (time_T2*0.25)/l2"
  #ifdef no_compensate
  "tauCPMG1 = tauCPMG - pwh_cp*cnst51"
  #else
  "tauCPMG1 = tauCPMG - (DELTA8*0.25 + 0.2u*l3)/l2"
  #endif
}
else {
  "tauCPMG = time_T2*0.25"
  "tauCPMG1 = 2u"
}

/**********************************/
/* 1H heating compensation period */
/**********************************/
4u pl15:f1

#if defined(ref_flg) || defined(no_compensate)
  "DELTA = 20u"
#else
  if "l2 == 0" {
    "DELTA = DELTA8 + 20u"
  }
  else {
    "DELTA = 20u"
  }
#endif

DELTA cw:f1 ph26
2u do:f1

/*************************************************/
/* Destroy residual 1H magnetization prior to d1 */
/*************************************************/
20u UNBLKGRAD

10u fq=cnst1(sfo hz):f1 /* 1H SFO1 @ tof(water) */
4u pl1:f1 /* power pl1 for 1H pulses */
(pwh ph26):f1

2u
p50:gp0*0.5
d16

(pwh ph27):f1

2u
p50:gp0
d16

4u BLKGRAD

/******************/
/* Messerle purge */
/******************/
#ifdef mess_flg
  4u pl11:f1
  (dly_pg1 ph26):f1
  2u
  (dly_pg2 ph27):f1
#endif

/*****************/
/* Presaturation */
/*****************/
#ifdef fsat
  4u pl10:f1
  d1 cw:f1 ph26
  2u do:f1
  4u pl1:f1
#ifdef fscuba
  hscuba
  (pwh ph26 pwh*2.0 ph27 pwh ph26):f1
  hscuba
#endif /*fscuba*/
#else /*fsat*/
  4u pl1:f1
  d1
#endif /*fsat*/
20u UNBLKGRAD

/**************************/
/* Water selective Eburp1 */
/**************************/
#ifdef water_flg
  2u
  (pw_sl1:sp14 ph26):f1
  2u
  2u
  p50:gp0
  d16
#endif

/****************************************/
/* Destroy 13C equlibrium magnetization */
/****************************************/
4u pl2:f2
(pwc ph26):f2

2u
p50:gp0
d16

/**************************/
/* This is the real start */
/**************************/
10u fq=0(sfo hz):f1
4u pl1:f1

(pwh ph26):f1

2u
p51:gp1
d16

"DELTA = taua*2.0 - 2u - p51 - d16 - pwh*2.0/PI"
DELTA

/*******************/
/* t1 period */
/*******************/
(pwc ph1):f2

"TAU1=larger(d0-pwh*2.0-pwc*2.0/PI,TAU2)"
TAU1

(pwh ph26 pwh*2.0 ph27 pwh ph26):f1

TAU1

(pwc ph26):f2

/************************************************/
/* Option to create 50%/50% IP/AP prior to CPMG */
/************************************************/
#ifdef ipap_flg
  if "nsdone%4 < 2" {
    "DELTA = taua + 4u"
    DELTA
    (pwh ph26 pwh*2.0 ph27 pwh ph26):f1
  }
  else {
    "DELTA = taua - 4u"
    DELTA
  }
#else
  4u
  (pwh ph26 pwh*2.0 ph27 pwh ph26):f1
#endif
4u pl15:f1

/*********************************/
/* The first half of CPMG period */
/*********************************/
  if "l2 > 0" {
3   tauCPMG1
    cpmg_F
    tauCPMG1 ipp11 ipp12 ipp13 ipp14 ipp21 ipp22 ipp23 ipp24
    lo to 3 times l2

  }

  if "l3 > 0" {
4   0.2u
    cpmg_F
    0.2u ipp11 ipp12 ipp13 ipp14 ipp21 ipp22 ipp23 ipp24
    lo to 4 times l3

}

/*****************************/
/* The central 180o 1H pulse */
/*****************************/
#ifdef reb_flg
  4u
  (pwh_reb:sp8 ph2):f1
  4u pl15:f1
#else /*reb_flg*/
  (pwh_cp*2.0 ph2):f1
#endif /*reb_flg*/

/**********************************/
/* The second half of CPMG period */
/**********************************/
  if "l3 > 0" {
5   0.2u dpp11 dpp12 dpp13 dpp14 dpp21 dpp22 dpp23 dpp24
    cpmg_R
    0.2u
    lo to 5 times l3

  }

  if "l2 > 0" {
6   tauCPMG1 dpp11 dpp12 dpp13 dpp14 dpp21 dpp22 dpp23 dpp24
    cpmg_R
    tauCPMG1
    lo to 6 times l2

  }

/**********************/
/* C->H back transfer */
/**********************/
#ifdef ipap_flg
  if "nsdone%4 >= 2" {
    4u pl1:f1
    (pwh ph26 pwh*2.0 ph29 pwh ph26):f1
    4u
  }
#endif
#ifdef ipap_flg
  "DELTA = taua - 2u - p51 - d16 - 4u - 4u - de"
#else
  "DELTA = taua*2.0 - 2u - p51 - d16 - 4u - 4u - de"
#endif
DELTA

2u
p51:gp1
d16

/************************************************************/
/* Option for 3-9-19 Watergate for better water suppression */
/************************************************************/
#ifdef wgate_flg
  4u pl1:f1
  "DELTA = 4u + 4u + de + 4u + de"
  DELTA

  2u
  p52:gp2
  d17

  (pwh*0.231 ph27):f1
  d19*2.0
  (pwh*0.692 ph29):f1
  d19*2.0
  (pwh*1.462 ph27):f1
  d19*2.0
  (pwh*1.462 ph27):f1
  d19*2.0
  (pwh*0.692 ph29):f1
  d19*2.0
  (pwh*0.231 ph27):f1

  2u
  p52:gp2
  d17
#endif

4u BLKGRAD
4u pl21:f2 /* lower power for 13C decoupling */

/********************************/
/* Signal detection and looping */
/********************************/
go=2 ph31 cpds2:f2
  d11 do:f2 mc #0 to 2
  F2QF(calclc(l1, 1))
  F1PH(calph(ph1, +90), caldel(d0, +in0) & calph(ph1, +180) & calph(ph31, +180))

HaltAcqu, 1m
exit

ph0=1
ph1=0 2
ph2=1 1 3 3 1 1 3 3 3 3 1 1 3 3 1 1
ph11=0 1 0 1
ph12=ph11-ph0
ph13=1 0 1 0
ph14=ph13-ph0
ph21=0 3 0 3
ph22=ph21+ph0
ph23=3 0 3 0
ph24=ph23+ph0
ph26=0
ph27=1
ph28=2
ph29=3
ph31=0 2

;d1: Repetition delay D1
;d3: taua - set to 1/4JHC = 2.0 ms
;d6: time_T2 CPMG duration <= 40ms
;d11: delay for disk i/o, 30ms
;d16: gradient recovery delay, 200us
;d17: gradient recovery delay for 3-9-19 watergate, 200us
;d19: delay for binomial water suppression, ~1/(4*|cnst1|)
;pl1: tpwr - power level for pwh
;pl2: dhpwr - power level for 13C pulse pwc (p2)
;pl10: tsatpwr - power level for presat
;pl11: tpwrmess - power level for Messerle purge
;pl15: power level for 1H CPMG pulses pwh_cp
;pl21: dpwr - power level for 13C decoupling cpd2
;sp14: power level for eburp1 pulse
;spnam8: Reburp.1000
;spnam14: eburp1 pulse on water
;p1: pwh
;p2: pwc
;p14: eburp1 pulse width, typically 7000us
;p15: 1H pw for CPMG pulses
;p50: gradient pulse 50 [1000 usec]
;p51: gradient pulse 51 [500 usec]
;p52: gradient pulse 52 [800 usec]
;cpdprg2: 13C decoupling program during t2 [waltz16]
;pcpd2: 13C pulse width for 13C decoupling
;cnst1: offset of water from methyls (Hz)
;cnst8: methyl H excitation bandwidth (ppm)
;vclist: variable counter list for ncyc_cp
;l8: ncyc_max (MUST BE SET PROPERLY!)
;delta8: total duration of 1H CPMG pulses
;inf1: 1/SW(X) = 2*DW(X)
;in0: 1/(2*SW(x))=DW(X)
;nd0: 2
;ns: 4*n
;FnMODE: States in F1
;FnMODE: QF in F2

;for z-only gradients:
;gpz0: 20%
;gpz1: 30%
;gpy2: 0% (Z-gradient) or 80% (XYZ-gradient)
;gpz2: 80% (Z-gradient) or 0% (XYZ-gradient)

;use gradient files:
;gpnam0: SMSQ10.32
;gpnam1: SMSQ10.32
;gpnam2: SMSQ10.32

;zgoptns: Dfsat, Dmess_flg, Dfscuba, Dwater_flg, Dwgate_flg, Df1180, Dcomp180_flg, D ipap_flg, Dreb_flg, Dref_flg, Dno_compensate


B_HNCA.cw minor comment

B_HNCA.cw minor comment