# 1 "/ssnmrpulprogs/HhNH.noe.mpibpc"
;invcpNHHrfdr.crmn

;basic cp experiment
;written by HF 1.3.2001
;changed by JOS 05/06/03
;comments added by STE 4.4.2006

;Avance II+ version
;parameters: 
;p1 : 13C 90 pulse for 180 in t1
;pl11 : 13C power for 180
;p3 : proton 90 at power level pl12
;p15 : contact time at pl1 (f1) and pl2 (f2)
;pl1 : X power level during contact
;sp0 : proton power level during contact
;pl2 : =120dB, not used
;pl7 : 15N hard pulse power level
;pl12 : decoupling power level (if not pl13)
;pl13 : water suprression power level
;pl20 : 15N CP power
;d1 : recycle delay
;cnst21 : on resonance, usually = 0
;pcpd2 : pulse length in decoupling sequence
;pcpd4 : pulse length for X dec during acq
;cpdprg2 : cw, tppm (at pl12), or lgs, cwlg. cwlgs (LG-decoupling 
;spnam0 : use e.g. ramp.100 for variable amplitude CP
;here pl13 is used instead of pl12)
;zgoptns : -Dfslg, -Dlacq, or blank
;d5 : NOE mixing time
;p30 : total water suppression time
# 32 "/ssnmrpulprogs/HhNH.noe.mpibpc"
;$COMMENT=basic cp experiment, arbitrary contact and decoupling schemes
;$CLASS=Solids
;$DIM=1D
;$TYPE=cross polarisation
;$SUBTYPE=simple 1D
;$OWNER=Bruker
prosol relations=<solids_cp>

# 1 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl" 1
;Avancesolids.incl
;   for TCU3
;
;version 1 28.2.2001, written by HF
;	   4.4.2006, complemented by Ste

;$CLASS=Solids INCL
;$COMMENT=definitions for setrtp and setnmr
# 10 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;switch between 1H or 19F output (H amplifier) 


# 14 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;gating pulse for RX, ADC and HPPR auto mode


# 18 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;explicit blanking of preamp, receiver, adc, not implemented yet


# 26 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;generate dwell clock


;turn dwell clock on/off
# 32 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;


# 36 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;define data sampling for WAHUHA type experiments, samples analogue or digitally for d9, closes receiver


# 40 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;explicit transmitter blanking, not supported yet

;NCO switching, to be implemented

;$id: $
# 40 "/ssnmrpulprogs/HhNH.noe.mpibpc" 2
# 42 "/ssnmrpulprogs/HhNH.noe.mpibpc"
;cnst20 : RF field achieved at pl13
;cnst21 : on resonance, usually = 0
;cnst22 : positive LG offset
;cnst23 : negative LG offset
;cnst24 : additional LG-offset
;cnst11 : to adjust t=0 for acquisition, if digmod = baseopt
"acqt0=1u*cnst11"
"in0=inf1"
"in30=inf1"
"in10=inf2"
"d10=0"
"d0=0"
aqseq 312 
;was 321
 
define delay mix
"mix=d5"


# 1 "mc_line 62 file /ssnmrpulprogs/HhNH.noe.mpibpc exp. def. part of mc cmd. before ze"
; dimension 3D; AQ_mode  (F2) States-TPPI (F1) States-TPPI
define delay MCWRK
define delay MCREST
define delay d0orig
"d0orig=d0"
define delay d10orig
"d10orig=d10"
define loopcounter t2loop
"t2loop=0"
define loopcounter t1loop
"t1loop=0"
define loopcounter ph1loop
"ph1loop=0"
define loopcounter ph2loop
"ph2loop=0"
define loopcounter ST1CNT
"ST1CNT = td2 / 2"
define loopcounter ST2CNT
"ST2CNT = td1 / 2"
"MCREST = d1 - 10m"
"MCWRK = 0.071429*10m"

    dccorr
# 62 "/ssnmrpulprogs/HhNH.noe.mpibpc"
# 62 "/ssnmrpulprogs/HhNH.noe.mpibpc"
1 ze
# 1 "mc_line 62 file /ssnmrpulprogs/HhNH.noe.mpibpc exp. def. of mc cmd. after ze"
LBLAV, MCWRK
      "d0=d0orig + t1loop * in0 "
      "phval2 = (ph1loop % 4) * 90"
      MCWRK ip2 + phval2
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 4) * 90"
      MCWRK ip9 + phval9
# 63 "/ssnmrpulprogs/HhNH.noe.mpibpc"
  mix
# 1 "mc_line 64 file /ssnmrpulprogs/HhNH.noe.mpibpc exp. start label for mc cmd."
2 MCWRK  * 3 do:f2  do:f3
LBLF2, MCWRK  * 3
LBLST2, MCWRK  * 4
LBLF1, MCWRK  * 3
LBLST1, MCWRK 
  MCREST
# 65 "/ssnmrpulprogs/HhNH.noe.mpibpc"
# 1 "/opt/topspin3.5pl6/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


1m
if "p15 < 12.1m" goto Passp15
2u
print "contact time exceeds 10msec limit!"
goto HaltAcqu
Passp15, 1m
# 20 "/opt/topspin3.5pl6/exp/stan/nmr/lists/pp/p15_prot.incl"
;$Id: p15_prot.incl,v 1.8 2013/01/29 15:40:14 ber Exp $
# 65 "/ssnmrpulprogs/HhNH.noe.mpibpc" 2

# 1 "/opt/topspin3.5pl6/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/topspin3.5pl6/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 $
# 66 "/ssnmrpulprogs/HhNH.noe.mpibpc" 2

  ;1u pl2:f1
  (p1  pl1 ph9):f1 
  
  1u cpds2:f2 cpds3:f3
  d10
  (p1  pl1 ph3):f1 (1u do):f2  (1u do):f3
# 74 "/ssnmrpulprogs/HhNH.noe.mpibpc"
5  d5

  (p1  pl1 ph0):f1 

  (p15 pl20 ph2):f2 (p15:sp0 ph10):f1
# 81 "/ssnmrpulprogs/HhNH.noe.mpibpc"
  1u cpds1:f1

if "p3*2 > d0" goto RAWEVOL
   (center (d0) (p3*2 ph0 pl11):f3)
if "p3*2 <= d0" goto DECOFF

RAWEVOL, 1u
  d0
DECOFF,  1u do:f1 
# 91 "/ssnmrpulprogs/HhNH.noe.mpibpc"
  (p7 pl7 ph5):f2 

  (p30*0.25 pl13 ph0):f1
  (p30*0.25
 pl13 ph1):f1
  (p30*0.25
 pl13 ph0):f1
  (p30*0.25
 pl13 ph1):f1

  (p7 pl7 ph6):f2
  (p17 pl20 ph7):f2 (p17:sp10 ph11):f1
# 101 "/ssnmrpulprogs/HhNH.noe.mpibpc"
  1u cpds2:f2 cpds3:f3
  go=2 ph31  
  1m do:f2	 do:f3
# 1 "mc_line 104 file /ssnmrpulprogs/HhNH.noe.mpibpc exp. mc cmd. in line"
  MCWRK  wr #0 if #0 zd 

  "ph1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval2 = (ph1loop % 4) * 90"
      MCWRK ip2 + phval2
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 4) * 90"
      MCWRK ip9 + phval9
  lo to LBLF2 times 2
  MCWRK 

  "t1loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval2 = (ph1loop % 4) * 90"
      MCWRK ip2 + phval2
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 4) * 90"
      MCWRK ip9 + phval9
  lo to LBLST2 times ST2CNT
  MCWRK 
  "t1loop=0"
  "ph1loop=0"
  MCWRK 

  "ph2loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval2 = (ph1loop % 4) * 90"
      MCWRK ip2 + phval2
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 4) * 90"
      MCWRK ip9 + phval9
  lo to LBLF1 times 2
  MCWRK 

  "t2loop+=1"
      "d0=d0orig + t1loop * in0 "
      "phval2 = (ph1loop % 4) * 90"
      MCWRK ip2 + phval2
      "d10=d10orig + t2loop * in10 "
      "phval9 = (ph2loop % 4) * 90"
      MCWRK ip9 + phval9
  lo to LBLST1 times ST1CNT
  MCWRK 
  "t2loop=0"
  "ph2loop=0"
  MCWRK rf #0
  lo to LBLAV times tdav
# 107 "/ssnmrpulprogs/HhNH.noe.mpibpc"


HaltAcqu, 1m  	;jump address for protection files
exit						;quit
# 112 "/ssnmrpulprogs/HhNH.noe.mpibpc"
ph0=0
ph1 = 1
ph10 = 1
ph2 =  1
ph3 =  1
ph5 =  0 
ph6 =  0 2
ph12 = 1
ph7 =  1
ph8 = 2
ph9  = 1 1 3 3
;ph16 = 0 1 0 1 1 0 1 0
ph11 = 1 
ph31 = 0 2 2 0


