seqfil = 'jmasnca2d'

//------------------------------
// Spin Rate
//------------------------------

exists('srate','parameter'):$e
if $e < 0.5 then
   create('srate','frequency')
endif 

exists('hsrotor','parameter'):$e
if $e < 0.5 then
   create('hsrotor','flag') 
endif

//------------------------------
// Receiver Delays
//------------------------------

exists('rd','parameter'):$e
if $e < 0.5 then
   create('rd','pulse')
   setlimit('rd',8192,0,0.0125)  
endif 

exists('ad','parameter'):$e
if $e < 0.5 then
   create('ad','pulse')
   setlimit('ad',8192,0,0.0125)  
endif

exists('ddrtc','parameter'):$e
if $e < 0.5 then
   create('ddrtc','pulse')
   setlimit('ddrtc',8192,0,0.0125)  
endif

//------------------------------
// Basic Transmitter Properties
//------------------------------

exists('aX90','parameter'):$e
if $e < 0.5 then
   create('aX90','real')
   setlimit('aX90',4095,0,0)  
endif 

exists('aH90','parameter'):$e
if $e < 0.5 then
   create('aH90','real')
   setlimit('aH90',4095,0,0)  
endif 

exists('aY90','parameter'):$e
if $e < 0.5 then
   create('aY90','real')
   setlimit('aY90',4095,0,0)  
endif

exists('aZ90','parameter'):$e
if $e < 0.5 then
   create('aZ90','real')
   setlimit('aZ90',4095,0,0)  
endif

exists('pwX90','parameter'):$e
if $e < 0.5 then
   create('pwX90','pulse')
   setlimit('pwX90',8192,0,0.0125)
endif 

exists('pwH90','parameter'):$e
if $e < 0.5 then
   create('pwH90','pulse')
   setlimit('pwH90',8192,0,0.0125)
endif 

exists('pwY90','parameter'):$e
if $e < 0.5 then
   create('pwY90','pulse')
   setlimit('pwY90',8192,0,0.0125)
endif

exists('pwZ90','parameter'):$e
if $e < 0.5 then
   create('pwZ90','pulse')
   setlimit('pwZ90',8192,0,0.0125)
endif

//---------------
// cpHX elements
//---------------

exists('shHX','parameter'):$e
if $e < 0.5 then
    create('shHX','flag')
endif

exists('toHX','parameter'):$e
if $e < 0.5 then
   create('toHX','flag')
endif 
setvalue('toHX','obs')

exists('frHX','parameter'):$e
if $e < 0.5 then
   create('frHX','flag')
endif
setvalue('frHX','dec')  

exists('chHX','parameter'):$e
if $e < 0.5 then
   create('chHX','flag')
endif 

exists('aHhx','parameter'):$e
if $e < 0.5 then
   create('aHhx','real')
   setlimit('aHhx',4095,0,0)
endif 

exists('aXhx','parameter'):$e
if $e < 0.5 then
   create('aXhx','real')
   setlimit('aXhx',4095,0,0)
endif 

exists('bHX','parameter'):$e
if $e < 0.5 then
   create('bHX','real')
   setlimit('bHX',1000000,0,1.0e-6)
endif 

exists('dHX','parameter'):$e
if $e < 0.5 then
   create('dHX','real')
   setlimit('dHX',4095,-4095,1)
endif 

exists('tHX','parameter'):$e
if $e < 0.5 then
   create('tHX','pulse')
   setlimit('tHX',50000,0,0.0125)
endif

exists('ofHX','parameter'):$e
if $e < 0.5 then
    create('ofHX','frequency')
endif  

//=====================
// decoupling options
//======================

exists('Hseq','parameter'):$e
if $e < 0.5 then
    create('Hseq','flag')
endif

//-----------
// tppm
//-----------

exists('aHtppm','parameter'):$e
if $e < 0.5 then
    create('aHtppm','real')
    setlimit('aHtppm',4095,0,0)
endif

exists('pwHtppm','parameter'):$e
if $e < 0.5 then
    create('pwHtppm','pulse')
    setlimit('pwHtppm',8192,0,0.0125)
endif

exists('phHtppm','parameter'):$e
if $e < 0.5 then
    create('phHtppm','real')
    setlimit('phHtppm',180,-180,0.0)
endif

exists('chHtppm','parameter'):$e
if $e < 0.5 then
   create('chHtppm','flag')
endif 
setvalue('chHtppm','dec')

//------------------------------
//  spinal 
//------------------------------

exists('aHspinal','parameter'):$e
if $e < 0.5 then
    create('aHspinal','real')
    setlimit('aHspinal',4095,0,0)
endif

exists('pwHspinal','parameter'):$e
if $e < 0.5 then
    create('pwHspinal','pulse')
    setlimit('pwHspinal',8192,0,0.0125)
endif

exists('phHspinal','parameter'):$e
if $e < 0.5 then
    create('phHspinal','real')
    setlimit('phHspinal',180,-180,0.0)
endif

exists('chHspinal','parameter'):$e
if $e < 0.5 then
   create('chHspinal','flag')
endif 
setvalue('chHspinal','dec')

//---------------
// cpHY elements
//---------------

exists('shHY','parameter'):$e
if $e < 0.5 then
    create('shHY','flag')
endif

exists('toHY','parameter'):$e
if $e < 0.5 then
   create('toHY','flag')
endif 
setvalue('toHY','obs')

exists('frHY','parameter'):$e
if $e < 0.5 then
   create('frHY','flag')
endif
setvalue('frHY','dec')  

exists('chHY','parameter'):$e
if $e < 0.5 then
   create('chHY','flag')
endif 

exists('aHhy','parameter'):$e
if $e < 0.5 then
   create('aHhy','real')
   setlimit('aHhy',4095,0,0)
endif 

exists('aYhy','parameter'):$e
if $e < 0.5 then
   create('aYhy','real')
   setlimit('aYhy',4095,0,0)
endif 

exists('bHY','parameter'):$e
if $e < 0.5 then
   create('bHY','real')
   setlimit('bHY',1000000,0,1.0e-6)
endif 

exists('dHY','parameter'):$e
if $e < 0.5 then
   create('dHY','real')
   setlimit('dHY',4095,-4095,1)
endif 

exists('tHY','parameter'):$e
if $e < 0.5 then
   create('tHY','pulse')
   setlimit('tHY',50000,0,0.0125)
endif

exists('ofHY','parameter'):$e
if $e < 0.5 then
    create('ofHY','frequency')
endif  

//=============================
// F1 INEPT decoupling options
//=============================

exists('Hmixseq','parameter'):$e
if $e < 0.5 then
    create('Hmixseq','flag')
endif
//-----------
// mix tppm
//-----------

exists('aHmixtppm','parameter'):$e
if $e < 0.5 then
    create('aHmixtppm','real')
    setlimit('aHmixtppm',4095,0,0)
endif

exists('pwHmixtppm','parameter'):$e
if $e < 0.5 then
    create('pwHmixtppm','pulse')
    setlimit('pwHmixtppm',8192,0,0.0125)
endif

exists('phHmixtppm','parameter'):$e
if $e < 0.5 then
    create('phHmixtppm','real')
    setlimit('phHmixtppm',180,-180,0.0)
endif

exists('chHmixtppm','parameter'):$e
if $e < 0.5 then
   create('chHmixtppm','flag')
endif 
setvalue('chHmixtppm','dec')

//------------------------------
//  mix spinal 
//------------------------------

exists('aHmixspinal','parameter'):$e
if $e < 0.5 then
    create('aHmixspinal','real')
    setlimit('aHmixspinal',4095,0,0)
endif

exists('pwHmixspinal','parameter'):$e
if $e < 0.5 then
    create('pwHmixspinal','pulse')
    setlimit('pwHmixspinal',8192,0,0.0125)
endif

exists('phHmixspinal','parameter'):$e
if $e < 0.5 then
    create('phHmixspinal','real')
    setlimit('phHmixspinal',180,-180,0.0)
endif

exists('chHmixspinal','parameter'):$e
if $e < 0.5 then
   create('chHmixspinal','flag')
endif 
setvalue('chHmixspinal','dec')
exists('Hseq','parameter'):$e
if $e < 0.5 then
    create('Hseq','flag')
endif

//===========================
// PBOX X shca Inversion Pulse
//===========================

exists('chXshca','parameter'):$e
if $e < 0.5 then
   create('chXshca','flag')
endif 
setvalue('chXshca','obs')

exists('wvXshca','parameter'):$e
if $e < 0.5 then
   create('wvXshca','flag')
endif 
setvalue('wvXshca','gaus180')

exists('ofXshca','parameter'):$e
if $e < 0.5 then
   create('ofXshca','frequency')
endif 

exists('aXshca','parameter'):$e
if $e < 0.5 then
   create('aXshca','real')
   setlimit('aXshca',4095,0,0)
endif 

exists('dbXshca','parameter'):$e
if $e < 0.5 then
   create('dbXshca','real')
   dbsetlimit('dbXshca',63,-37,0.5)
endif 

exists('stXshca','parameter'):$e
if $e < 0.5 then
   create('stXshca','real')
endif 

exists('pwXshca','parameter'):$e
if $e < 0.5 then
   create('pwXshca','pulse')
   setlimit('pwXshca',8192,0,0.0125)
endif 

exists('phXshca','parameter'):$e
if $e < 0.5 then
    create('phXshca','real')
    setlimit('phXshca',180,-180,0.0)
endif

//===========================
// PBOX Y sh Inversion Pulse
//===========================

exists('chYsh','parameter'):$e
if $e < 0.5 then
   create('chYsh','flag')
endif 
setvalue('chYsh','obs')

exists('wvYsh','parameter'):$e
if $e < 0.5 then
   create('wvYsh','flag')
endif 
setvalue('wvYsh','gaus180')

exists('ofYsh','parameter'):$e
if $e < 0.5 then
   create('ofYsh','frequency')
endif 

exists('aYsh','parameter'):$e
if $e < 0.5 then
   create('aYsh','real')
   setlimit('aYsh',4095,0,0)
endif 

exists('dbYsh','parameter'):$e
if $e < 0.5 then
   create('dbYsh','real')
   dbsetlimit('dbYsh',63,-37,0.5)
endif 

exists('stYsh','parameter'):$e
if $e < 0.5 then
   create('stYsh','real')
endif 

exists('pwYsh','parameter'):$e
if $e < 0.5 then
   create('pwYsh','pulse')
   setlimit('pwYsh',8192,0,0.0125)
endif 

exists('phYsh','parameter'):$e
if $e < 0.5 then
    create('phYsh','real')
    setlimit('phYsh',180,-180,0.0)
endif

//===========================
// PBOX X shco Inversion Pulse
//===========================

exists('chXshco','parameter'):$e
if $e < 0.5 then
   create('chXshco','flag')
endif 
setvalue('chXshco','obs')

exists('wvXshco','parameter'):$e
if $e < 0.5 then
   create('wvXshco','flag')
endif 
setvalue('wvXshco','gaus180')

exists('ofXshco','parameter'):$e
if $e < 0.5 then
   create('ofXshco','frequency')
endif 

exists('aXshco','parameter'):$e
if $e < 0.5 then
   create('aXshco','real')
   setlimit('aXshco',4095,0,0)
endif 

exists('dbXshco','parameter'):$e
if $e < 0.5 then
   create('dbXshco','real')
   dbsetlimit('dbXshco',63,-37,0.5)
endif 

exists('stXshco','parameter'):$e
if $e < 0.5 then
   create('stXshco','real')
endif 

exists('pwXshco','parameter'):$e
if $e < 0.5 then
   create('pwXshco','pulse')
   setlimit('pwXshco',8192,0,0.0125)
endif 

exists('phXshco','parameter'):$e
if $e < 0.5 then
    create('phXshco','real')
    setlimit('phXshco',180,-180,0.0)
endif

//===================================
// Delays for J evolution 
//===================================

exists('taua','parameter'):$e
if $e < 0.5 then
   create('taua','pulse')
   setlimit('taua',50000,0,0.0125)
endif

exists('taub','parameter'):$e
if $e < 0.5 then
   create('taub','pulse')
   setlimit('taub',50000,0,0.0125)
endif

//------------------------------------------------
//  Set Bit 14 for new parameters of the .par file 
//------------------------------------------------

$params = 'frHY toHY chHspinal chHtppm chXshca chYsh chXshco '
$params = $params + 'shHY chHY aHhy aYhy bHY dHY tHY ofHY '
$params = $params + 'aHmixtppm pwHmixtppm phHmixtppm chHmixtppm '
$params = $params + 'aHmixspinal pwHmixspinal phHmixspinal chHmixspinal Hmixseq '
$params = $params + 'wvXshca ofXshca aXshca dbXshca stXshca pwXshca phXshca '
$params = $params + 'wvYsh ofYsh aYsh dbYsh stYsh pwYsh phYsh '
$params = $params + 'wvXshco ofXshco aXshco dbXshco stXshco pwXshco phXshco '
$params = $params + 'taua taub' 
setprotect('','clear',16384)
setprotect($params,'on',16384)

//--------------------------------------------------------
//  Clear parameters in 'clearparams' in the apptype macro
//--------------------------------------------------------

exists('clearparams','parameter'):$e
if $e < 0.5 then
   create('clearparams','string')
endif
setprotect('clearparams','on',16384)
$clearparams = 'frHY toHY chHspinal chHtppm chXshca chYsh chXshco '
setvalue('clearparams',$clearparams)

//------------------------------------------------
//  Set the parameter templates
//------------------------------------------------

setprotect('dg','clear',4)
$dg = '1:ACQUISITION:sw:1,at:6,np:0,d1:6,nt:0,ct:0,bs:0,'
$dg = $dg + 'ss:0,rd:1,ad:1,ddrtc:1,rof3(rof3):1,gain:0,temp:0,srate:1,taua:1,taub:1;'
$dg = $dg + '2:cpHY:shHY,chHY,aHhy:0,aYhy:0,bHY:6,dHY:6,tHY:1,ofHY:3;'
$dg = $dg + '2(Hseq=\'tppm\'):TPPM:aHtppm:0,pwHtppm:1,phHtppm:2;'
$dg = $dg + '2(Hseq=\'spinal\'):SPINAL:aHspinal:0,pwHspinal:1,phHspinal:2;'
$dg = $dg + '2(Hmixseq=\'tppm\'):TPPM:aHmixtppm:0,pwHmixtppm:1,phHmixtppm:2;'
$dg = $dg + '2(Hmixseq=\'spinal\'):SPINAL:aHmixspinal:0,pwHmixspinal:1,phHmixspinal:2;'
$dg = $dg + '3:shcaX:chXshca,wvXshca,ofXshca:3,aXshca:0,dbXshca:0,pwXshca:1,phXshca:3;'
$dg = $dg + '4:shY:chYsh,wvYsh,ofYsh:3,aYsh:0,dbYsh:0,pwYsh:1,phYsh:3;'
$dg = $dg + '4:shcoX:chXshco,wvXshco,ofXshco:3,aXshco:0,dbXshco:0,pwXshco:1,phXshco:3;'

dg = $dg
setprotect('dg','on',4)

setprotect('dg2','clear',4)
$dg2 = '1:OBSERVE:tn,sfrq:6,tof:1,tpwr:0,aX90:0,pwX90:1;'
$dg2=$dg2+'2:DECOUPLE:dn,dfrq:6,dof:1,dpwr:0,aH90:0,pwH90:1;'
$dg2=$dg2+'3:DECOUPLE2:dn2,dfrq2:6,dof2:1,dpwr2:0,aY90:0,pwY90:1;'
$dg2=$dg2+'4:DECOUPLE3:dn3,dfrq3:6,dof3:1,dpwr3:0,aZ90:0,pwZ90:1;'
dg2 = $dg2
setprotect('dg2','on',4)

setprotect('ap','clear',4)
$ap = '1:SAMPLE:date,temp:1,srate:1,file;'
$ap = $ap + '1:ACQUISITION:tn,sfrq:6,tof:1,tpwr:0,sw:1,at:6,np:0,d1:6,nt:0,ct:0,ss:0,rd:1,ad:1,aX90:0,pwX90:1'
$ap = $ap + 'taua:1,taub:1;'
$ap = $ap + '1(ni):2D ACQUISITION:d2:6,sw1:1,ni:0,phase:0;'
$ap = $ap + '1:DECOUPLE:dn,dfrq:6,dof:1,dpwr:0,aH90:0,pwH90:1;'
$ap = $ap + '1(dfrq2>0):DECOUPLE2:dn2,dfrq2:6,dof2:1,dpwr2:0,aY90:0,pwY90:1;'
$ap = $ap + '1(dfrq3>0):DECOUPLE3:dn3,dfrq3:6,dof3:1,dpwr3:0,aZ90:0,pwZ90:1;'
$ap = $ap + '1:cpHY:shHY,chHY,aHhy:0,aYhy:0,bHY:6,dHY:6,tHY:1,ofHY:3;'
$ap = $ap + '1(Hseq=\'tppm\'):TPPM:aHtppm:0,pwHtppm:1,phHtppm:2;'
$ap = $ap + '1(Hseq=\'spinal\'):SPINAL:aHspinal:0,pwHspinal:1,phHspinal:2;'
$ap = $ap + '2(Hmixseq=\'tppm\'):TPPM:aHmixtppm:0,pwHmixtppm:1,phHmixtppm:2;'
$ap = $ap + '2(Hmixseq=\'spinal\'):SPINAL:aHmixspinal:0,pwHmixspinal:1,phHmixspinal:2;'
$ap = $ap + '2:shcaX:chXshca,wvXshca,ofXshca:3,aXshca:0,dbXshca:0,pwXshca:1,phXshca:3;'
$ap = $ap + '2:shY:chYsh,wvYsh,ofYsh:3,aYsh:0,dbYsh:0,pwYsh:1,phYsh:3;'
$ap = $ap + '2:shcoX:chXshco,wvXshco,ofXshco:3,aXshco:0,dbXshco:0,pwXshco:1,phXshco:3;'
ap = $ap
setvalue('ap',$ap,'processed')
setprotect('ap','on',4)
