# 1 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
;doubcp

;version: 4.0/ TS3  / 6/25/2011

;basic double cross polarization experiment
;cross polarise from H to Y, then from Y to X
;written by HF 1.3.2001
;improved short phase cycle by JOS 10/10/2007
;updated for 1, revised and tested by JOS 05/10/2011
;prepared for release and checked by JOS 25/6/2011
;relations file added   GALT 170131
# 13 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
;Avance III version
;parameters:
;d1 : recycle delay
;p1 : X 90 degree pulse
;p2 : X 180 degree decoupling pulse during t1 CS evolution of Y nucleus
;p3 : H 90 degree pulse
;p15 : contact time; plw3 (rf-channel f3) and spw0 (rf-channel f2)
;plw11 : rf-power on X for 90 and 180 degree pulses
;plw12 : rf-power for 1H pi/2 pulse p3 and standard proton decoupling
;plw13 : rf=power for cw decoupling on 1H during Y-X CP transfer
;p16 : X-Y contact time, spw1 (spnam1 tan or ramp) (rf-channel f1) 
	;plw5 (rf-channel f3) contact pulse power
;spw1 : rf-power on f1-contact pulse (up to 20% ramp or tan amplitude modulation)
;spw0 : rf-power for proton contact pulse, 50 -20% ramped amplitude modulation
;spw3 : rf-power f3 ramp (for H to Y CP)
;plw5 : rf-power f3 (for Y to X CP)
;cnst10 : 13C carrier position for Y-X transfe, usually around 60 ppm or 170 ppm
;cnst9 : 13C carrier position for detection (around 100 (ppm) 
	;must be identical to chosen o1p)
;spnam0 : file name for variable amplitude CP
;spnam1 : file name for Y to X CP shape
;cpdprg2 : sequence used for decoupling (spinal64, tppm15, cw, etc.)
;pcpd2 : pulse length in decoupling sequence

;swh : in F1 chose multiple or integer fraction of rotation rate so that Spinning sidebands ovelap and do not fall into undesired signal regions
;FnMODE: TPPI, States or States-TPPI

;$CLASS=Solids
;$DIM=1D and 2D
;$TYPE=cross polarisation
;$SUBTYPE=1D or 2D
;$OWNER=Bruker
;$COMMENT=basic double cp experiment
# 47 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
prosol relations=<solids_cp>


# 1 "/opt/topspin/exp/stan/nmr/lists/pp/trigg.incl" 1
;version (13/08/19)
# 3 "/opt/topspin/exp/stan/nmr/lists/pp/trigg.incl"
;$COMMENT=definition of external trigger output, conn I pin 1
;$CLASS=Solids INCL


# 12 "/opt/topspin/exp/stan/nmr/lists/pp/trigg.incl"
;$Id: 6u setnmr3|28 \n 4u  setnmr3^28.incl,v 1.6.2.1 2013/08/29 14:03:54 ber Exp $
# 50 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp" 2

;10 usec trigger pulse at TCU connector I cable 6 
# 1 "/opt/topspin/exp/stan/nmr/lists/pp/lgcalc.incl" 1
;$CLASS=Solids INCL
;$COMMENT=calculation of FSLG parameters

# 5 "/opt/topspin/exp/stan/nmr/lists/pp/lgcalc.incl"
"cnst21=0"			;make sure cp ist done with proton freq.
				;set by O2
"cnst22=cnst20/sqrt(2)+cnst24"		;cnst20=desired RF field in Hz
"cnst23=-cnst20/sqrt(2)+cnst24"	;negative offset is cnst23

"p5=((294/360)/(cnst20))*1e6"		;calculate 294 degree pulse from cnst20

;$Id: lgcalc.incl,v 1.6.2.1 2017/02/22 17:02:21 ber Exp $
# 52 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp" 2
# 54 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
"d0=3u"
"in0=inf1"
"l0=0"				;book keeping 
"cnst21=0"
"acqt0=cnst11*1u"
"p2=2*p1"

# 1 "mc_line 61 file /opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp exp. def. part of mc cmd. before ze"
; dimension 2D; AQ_mode  (F1) States-TPPI
define delay MCWRK
define delay MCREST
define loopcounter ST1CNT
"ST1CNT = trunc(td1 / 2)"
"MCREST = 10m - 10m"
"MCWRK = 0.250000*10m"

    dccorr
# 61 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
1 ze
# 1 "mc_line 61 file /opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp exp. def. of mc cmd. after ze"
LBLAV, MCWRK
# 62 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
# 1 "mc_line 62 file /opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp exp. start label for mc cmd."
2 MCWRK  do:f2
LBLSTS1, MCWRK  * 2
LBLF1, MCWRK 
  MCREST
# 63 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
  d1 do:f2
# 1 "/opt/topspin/exp/stan/nmr/lists/pp/p15_prot.incl" 1
;p15_prot.incl
;avance-version (13/01/29)
;Test the rf on-time and duty cycle
;protect against too long contact time
;Test the rf on-time and duty cycle 
;
;$CLASS=Solids INCL
;$COMMENT=protect against too long contact time

# 11 "/opt/topspin/exp/stan/nmr/lists/pp/p15_prot.incl"
1m
if "p15 < 10.1m" goto Passp15
2u
print "contact time exceeds 10msec limit!"
goto HaltAcqu
Passp15, 1m


# 20 "/opt/topspin/exp/stan/nmr/lists/pp/p15_prot.incl"
;$Id: p15_prot.incl,v 1.8 2013/01/29 15:40:14 ber Exp $
# 64 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp" 2

				;make sure p15 does not exceed 10 msec 
				;let supervisor change this pulseprogram if 
				;more is needed
# 1 "/opt/topspin/exp/stan/nmr/lists/pp/aq_prot.incl" 1
;aq_prot.incl
;avance-version (13/01/28)
;Test the rf on-time and duty cycle
;protect against too long acquisition time

;$CLASS=Solids INCL
;$COMMENT=protect against too long acquisition time
# 9 "/opt/topspin/exp/stan/nmr/lists/pp/aq_prot.incl"
1m
if "aq < 50.1m" goto Passaq
2u 
print "acquisition time exceeds 50m limit!"
goto HaltAcqu
Passaq, 1m

;$Id: aq_prot.incl,v 1.8 2013/01/28 17:39:02 ber Exp $
# 68 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp" 2

				;allows max. 50 msec acquisition time, supervisor
				;may change  to max. 1s at less than 5 % duty cycle
				;and reduced decoupling field
  10u pl12:f2 pl1:f1 pl3:f3 	
  6u setnmr3|28 \n 4u  setnmr3^28
  1u fq=cnst21:f2
  p3:f2 ph1
  0.3u
  (p15:sp3 ph2):f3 (p15:sp0 ph10):f2
# 79 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
if "l0==1"{
"d0=in0-2u"
}
if "l0>0"{
  1u cpds2:f2
  (center (d0) (p2 pl11 ph5):f1)
  1u do:f2
}
 1u fq=cnst10(bf ppm):f1
  (p16:sp1 ph4):f1 (p16 pl5 ph3):f3 (p16 pl13 fq=cnst24 ph0):f2
  1u fq=cnst9(bf ppm):f1
   1u cpds2:f2
  go=2 ph31
  1m do:f2 
# 1 "mc_line 93 file /opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp exp. mc cmd. in line"
  MCWRK  wr #0 if #0 zd ip2
  lo to LBLSTS1 times 2
  MCWRK id0  MCWRK  iu0
  lo to LBLF1 times ST1CNT
  MCWRK rf #0
  lo to LBLAV times tdav
# 94 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
HaltAcqu, 1m
exit

ph0= 0
ph1= 1 3 
ph2= 0 
ph3= 0 0 2 2
ph4= 0 0 1 1 2 2 3 3
ph5=0 1
ph10= 0
ph31= 0 2 3 1 2 0 1 3

# 108 "/opt/topspin/exp/stan/nmr/lists/pp/user/ts_Xramp_doubcp"
;$Id: doubcp,v 1.9.2.3 2017/02/22 17:02:01 ber Exp $
