- MCTL
- General purpose commands
- Mössbauer tools
- Mössbauer fit commands
- Nuclear resonant scattering fit routine
MCTL
Reverse Polish notation
Reverse Polish notation (as used in EXE, FREL, MREL).Expressions consist of the following elements, separated by spaces:
- unsigned numbers
to form a negative number, use '0 <value> -'
- symbolic, predefined constants
cpi= 3.14159265358979323846 ce= 1.6021892e-19 (elementary charge) ck= 1.380662e-23 (Boltzmann's constant) cc= 2.99792458e8 (speed of light) ch= 6.626176e-34 (Planck's constant)
- functions
sin, cos, tan, asin, acos, atan, exp, ln, log, sqrt (ln is natural logarithm, log is logarithm base 10) (older forms are fsin, fcos, ... )
- operators
+ - / *
- parameter references
'p' followed by <index>, example: p0
- parameter input from keyboard (not in FREL, MREL)
'r' followed by <index>, optionally followed by 'q'<question>. Example: 'r1 qamplitude' will ask and set p[1] and dp[1]
Example: cpi 16 ln / sqrt p1 * is evaluated as: p1 * sqrt ( PI / log(16) )
General purpose commands
CReate
CReate <name> <length> Define a 'general purpose' data-space. It allocates four CIO arrays of type 'float' and size 'length'. You have to supply: name : data-space name (6 characters max) length : size of the data-space in channels The arrays allocated are: name+'d' (data) name+'e' (errors) name+'t' (fit) name+'v' (x coordinates)See also RM, PCREATE and PRM.
EXE
EXE <parameters> <expression> Calculates an expression in reverse Polish notation. If parameters are used in the expression, error estimates of the result are calculated, based on the covariance matrix (cov) if available and/or the error estimates (dp) of the parameters. You have to supply: parameters : parameter space to use. type <return> or ',,' if no parameters will be used expression : the expression, terminated by end-of-line or ';' parameters p0, p1 ... may be used in the expression Example: exe sp p1 p9 * cpi * will calculate: p1 * p9 * 3.1415926536For details of the syntax, give HELP RPN.
RM
RM <name> Deletes a 'general purpose' data-space. The four arrays become undefined. You have to supply: name : name as given with CREATESee also CREATE, PCREATE and PRM.
PCReate
PCReate <name> <nr_par> Defines a 'general purpose' parameter-space. You have to supply: name : parameter-space name (6 characters max.) nr_par : Size of the parameter-space It allocates the following CIO arrays, of type 'double': name+'p' name+'dp'See also PRM, CREATE and RM.
PRM
PRM <name> Deletes a 'general purpose' parameter-space. The two arrays become undefined. You have to supply: name : parameter-space name, given with PCREATE.See also PCREATE, CREATE and RM.
FIT
FIT <d_space> <p_space> <th_nr> <from> <to> [<np>] <init_val> ... Fits an array to one of a number of possible functions. You have to supply: d-space : the data space, as created by CREATE the data-, error-, and x-arrays of this data space should be filled with meaningful values p-space : the parameters to use in the fit, as created by PCREATE th-nr : an integer number determining the theory from,to : two integers giving the lower and upper channel number of the fitting region in the arrays of the data space np : number of parameters to be used; only asked if needed (in the polynomial this determines the rank) init-val : the initial values of the parameters A fit that converges too slowly may be interrupted by typing <CTRL-C> (press key 'CTRL' and key 'C' simultaneously) Theory 1 : polynomial y = p0 + p1*x + p2*x^2 .... Theory 2 : cosine y = p0*cos((x+p2)/p1) + p3 Theory 3 : exponential y = p0 + p1*exp(-x/p2) Theory 4 : double exponential y = p0 + p1*exp(-x/p2) + p3*exp(-x/p4) Theory 5 : trapezium function [ ??? not functional, debugging required ] fits position and width of channeling dips p0=shoulder height (in counts) p1=depth (relative to p0) p2=centre (in "channel numbers") p3=width at half depth (in "channel numbers") p4=width of the left slope (relative to total width) p5=width of the right slope(relative to total width) Theory 6 : A = f(t_a) for Mössbauer spectra p0=GAMMA_a*f_s/2 (either in mm/s or eV's) p1=Debye temperature (in K) p2=sigma_0 cross-section (in cm^-2) p3=GAMMA_N Heisenberg linewidth (same units as GAMMA_a!!!) p4=E_r/k_B recoil energy/k_Boltzman (E_e in eV's and k_B = 8.617 10^-5 eV/K) p5=N_a number Mössbauer atoms in the absorber (atoms/cm^2) p6=GAMMA_a linewidth of the absorption spectrum (the same units as GAMMA_N!!!) NOTE. Keep p2-6 fixed.
FIx
FIx <i> <j> <k> ... Prevents the parameters p[i],p[j],p[k],... in the 'general' fit routine, from being changed in the fit-routine.See also FREE, FREL and FLIST.
FList
FList Lists all parameters, in the 'general' fit routine, which are fixed and/or have a relation defined.See also FREE, FIX and FREL.
FRee
FRee <i> <j> <k> ...; Frees the parameters p[i],p[j],p[k],... in the 'general' fit routine, and releases constraints set by FIX or FREL.See also FIX, FREL and FLIST.
FREL
FREL <i> <relation for p[i]> Defines a relation between the parameters used in the 'general' fit routine. relation for p[i] : an expression in reverse Polish notation, whose value is to be assigned to p[i] Parameter p[i] is eliminated from the fit procedure, and instead equated to the given expression. Example: FREL 0 p1 p2 * 3.0 - This results in the relation: p0 = (p1 * p2) - 3.0For details of the syntax, give HELP RPN.
See also FREE, FIX and FLIST.
SFIT
SFIT <data> <theo> <sim> <from> <to> <init_val0> <init_val1> Fits an array to a simulated spectrum. You have to supply: data : the array containing the array to be fitted theo : the array in which the final result will be put sim : the array containing the simulation from,to : two integers giving the lower and upper channel number of the fitting region init-val0,init-val1 : the initial values of the parameters (2 reals giving the offset and multiplication of the simulation)
VERB
VERB <level> Sets the level of verbosity of mctl. The default level is 1. A higher level provides more detailed information. You have to supply: level : integer ranging from 0 to 3 Affects mainly the logfile. To write the covariance matrix of the fitted parameters set VERB to 2.
Mössbauer tools
MCHECK
MCHECK <unit> unit : a logical unit that has been associated with a Mössbauer data file The file is checked, and the runs in the file are listed.see OPEN.
MCReate
MCReate <name> <length> <np> Defines a Mössbauer spectrum. It allocates a data-space consisting of 4 arrays of float with dimension length, a parameter-space consisting of 2 arrays of double with dimension nr_par and an info-space. You have to supply: name : spectrum name (6 characters max!) length : size of the data-space in channels np : size of the parameter-space It allocates the following CIO arrays: name+'i' info space name+'d' \ name+'e' \ data-space (type 'float') name+'t' / name+'v' / name+'p' \ parameter-space (type 'double') name+'dp'/ name list of all names above (CIO varlist)see also MRM
MRM
MRM <name> Deletes a Mössbauer spectrum. You have to supply: name : spectrum name (as given with MCREATE) All arrays listed there become undefined.see also MCREATE.
REad
REad <spectrum <lu> <run> <replace?> Reads a Mössbauer spectrum from file. It also initializes the error array with the square root of the data. A logical unit for the file should be opened beforehand, see OPEN. You have to supply: spectrum : a Mössbauer spectrum (as defined with MCREATE) lu : logical unit attached to the data-file run : the requested run number replace? : replace the current contents? (y/n) The following data formats may be handled A. Ascii files as produced by Mössbauer equipment in the nvsf group. Each file may consist of one or more records. A record has a few header lines, followed by a series of integers. Variations on this theme: mcc file: header line 1 is comment, preceded by a '%' in column 1 header line 2 contains 3 integers: runnr, len, live dsp file: header line 1 contains 3 integers, 1 or 2 reals, and 1 string runnr, len, live, (cal1,) cal2, unit header line 2 is comment followed by "len" numbers in free format antique Mössbauer file: header line 1 contains 3 integers: runnr, len, live file of Unknown type: Any ascii file of "len" numbers preceded by "nskip" header lines. The user has to supply nskip,runnr,len from the keyboard. Distinction between the various ascii types is done automatically. B. Binary files, as made with the command PUT. Distinction between Ascii and Binary is made in the command OPEN. [In the OPEN command specify mode READ and type ASCII when the file is an ascii file (the usual case), or type SPECTRUM when the file is a binary file made with command PUT.]
FEcal
FEcal <spectrum> <T> Calibrates the velocity scale using a standard iron (alpha-Fe) calibration measurement. You have to supply: spectrum : a Mössbauer spectrum (as defined with MCREATE) T : temperature of calibration measurement The routine returns the (channel) position at which the expected isomer shift is found. It also supplies information about the zero crossing. It fits a linear velocity calibration and calculates the velocity scale, as in command VK, option -1. (Hence it is not necessary to follow FECAL by command VK). FECAL assumes that the spectrum was previously folded (see FOLD) and then fitted (see MFIT).
FOld
FOld <spectrum> <sum> Folds a Mössbauer spectrum. It reverses the second half of the spectrum shifts it as requested and adds the channel contents to those of the first half. It also recalculates the error array. The second half of the data- and error-array is reset. You have to supply: spectrum : a Mössbauer spectrum (as defined with MCREATE) sum : an integer number NOTE1: 'sum' is the average sum of the channel numbers of corresponding peaks in the original spectrum: channel[SUM - i] is added to channel[i]. NOTE2: In older versions of mctl a 'shift' was asked instead of 'sum'. Relation: SHIFT = spectrum_length + 1 - SUM
INfo
INfo <spectrum> Gives information about a spectrum, extracted from the spectrum's 'info space', such as the original data file and run number. If this was the last spectrum fitted, it will also give the results of the fit. You have to supply: spectrum : a Mössbauer spectrum (as defined with MCREATE)see also MLIST.
MOIre
MOIre <spectrum> <gc> <fm> <AT> <PM> <first> <last> <use> Utility for velocity calibration using the Moire method. spectrum : the spectrum containing the Moire data. gc : grating constant (in mu) (written on the grating) fm : frequency of motion (in Hz) determine by counting the number of start-pulses to the MCC in an interval of say 100 s at : acquisition time (in s) pm : steps in one period of movement (usually 512 or 1024) first : first positive velocity channel last : last positive velocity channel Moire counts do not account for positive or negative velocity the program assumes the channels between these borders are positive, the rest will be multiplied by -1 use : 0=all,1=1st half,2=2nd half,3=fold for a cosine you can use all, but for a polynomial you will either have to fold the spectrum or take the halves one at a time. The result of MOIRE is that the channels of the data-array are filled with velocities in mm/s. Now use FIT to get the parameters, using either a polynomial or a cosine, as appropriate.
VK
VK <spectrum> <func> <vc[i]> Defines the velocity scale of a Mössbauer spectrum. You have to supply: spectrum : a Mössbauer spectrum (as defined with MCREATE) func : -1, 0, or +1, determines the type of velocity function -1 : polynomial vc[1]..vc[4]: velocity coefficients. the velocity v = vc[1] + vc[2]*k + ... where k = the channel number (starting with k=0) 0 : no velocity scale, use channel numbers as coordinates 1 : cosine vc[1] : amplitude vc[2] : period vc[3] : phase Note1: the velocity relation may also be set by command FECAL Note2: command READ does not reset the velocity relation Note3: MCREATE resets the velocity function to type 0 Note4: the B,C,D parameter estimates for command MFIT are in velocity units, and may have to be changed after command VK
Mössbauer fit commands
DMATrix
Dmatrix <file?> { <nd[n]>, ((<dmat[k][i]>,i=1,nd[n]), k=1,nlines[n]), n=1,ncomp } Defines the Dmatrices for the Mössbauer fit-routine. DMATRIX is only necessary when theories 5 or 6 of MFIT will be used. It should be given after command MATRIX. You have to supply: file : read from file? (y/n) if yes : lu : logical unit to read from id : name of the wanted matrix in the file if no, for each component n: nd[n] : number of D-parameters in this component if defaults are available, no further input, otherwise: dmat[k][i] : nlines[n] times nd[n] matrix elements Defaults: ND[n]=Nlines[n] : all D-parameters freely variable ND[n]=ND[n-1] : same D-matrix as previous component !!!! No defaults are used if ND[n]=Nlines[n]=2 !!!! Note. The layout of a Dmatrix file is slightly different: id (one line, 8 significant characters) ncomp (must be the same as for ABC matrices) for each component: nd[n], nlines[n] (must be the same as for ABC matrices) further data as above.
MAtrix
MAtrix <nback> <file?> <ncomp> { <na[n]> <nb[n]> <nc[n]> <nlines[n]> <def[n]>, n=1..ncomp } Routine used to define the matrices for the Mössbauer fit-routine. You have to supply: nback : number of Background parameters (an integer) file? : read from file? (y/n) if yes: lu : logical unit to read from. id : name of the wanted matrix in the file if no : ncomp : number of components repeat ncomp times: na : number of A-parameters nb : number of B-parameters nc : number of C-parameters nlines : number of lines def : matrix definitions as needed MATRIX also releases all constraints set by MFIX or MREL.
CMATRIX
Lists the current A, B, C and D matrices.
MFit
MFit <spectrum> <theory> <from> <to> <init-val> Fit-routine of the Mössbauer-section of MCTL. Before MFIT, you should define the matrices (commands MAT, DMAT). You have to supply: spectrum : a Mössbauer spectrum (as defined with MCREATE) theory : an integer number determining the theory. Choice of 1 (Lorentz, amplitudes) 2 (Lorentz, areas) 3 (Gauss, amplitudes) 4 (Gauss, areas) 5 (Voigt, amplitudes) 6 (Voigt, areas) from,to : two integers giving the lower and upper channel number of the fitting region. init-val : the initial values of the parameters Theory 1: Lorentzian lineshape A=amplitude, B=position, C=FWHM y is background fb, plus sum over n of: - A[n]*fb*Lorentz(B,C,x) Lorentz(B,C,x)=1/(1 + u^2), where u=2(x-B[n])/C[n] Theory 2: Lorentzian lineshape A=peak area, B=position, C=FWHM y is background fb, plus sum over n of: -2/(PI*C[n])*A[n]*fb*Lorentz(B,C,x) Theory 3: Gaussian lineshape A=amplitude, B=position, C=FWHM (not sigma !!) y is background fb, plus sum over n of: - A[n]*fb* Gauss(B,C,x) Gauss(B,C,x)=exp( -0.5*u^2), where u=(x-B[n])/(C[n]/2.35) Theory 4: Gaussian lineshape A=peak area, B=position, C=FWHM (not sigma !!) y is background fb, plus sum over n of: -(1.06/C[n])*A[n]*fb*Gauss(B,C,x) Theory 5: Voigt Lorentzian × Gaussian lineshape A=amplitude, B=position, C=FWHM of Lorentzian, D=sigma of Gaussian y is background fb, plus sum over n of: - A[n]*fb*Voigt(B,C,D,x) Theory 6: Lorentzian × Gaussian lineshape A=peak area, B=position, C=FWHM of Lorentzian, D=sigma of Gaussian y is background fb, plus sum over n of: -2/(PI*C[n])*A[n]*fb*Voigt(B,C,D,x) A fit that converges too slowly may be interrupted by typing <CTRL-C> (press key 'CTRL' and key 'C' simultaneously)
MFIX
MFIX <i> <j> <k> ... Prevents the parameters p[i],p[j],p[k],... in the Mössbauer fit routine, from being changed in the fit-routine. Note: command MATrix releases all constraints set by MFIX or MREL.see also MFREE, MREL and MLIST
MDis
MDis <spectrum> <from> <to> <question?> <label> Displays a Mössbauer spectrum. You have to supply: spectrum : a Mössbauer spectrum (as defined with MCREATE). from,to : two integers giving the lower and upper channel number of the display region. possible questions : theo? : plot theoretical points (y/n) meas? : plot measured points (y/n) back? : divided by background (y/n) comp? : plot individual components (y/n) extd? : extended plot (y/n) label : plottext Note. If you select 'individual components', CIO arrays comp1, ... are also created.see also MXPORT.
MFRee
MFRee <i> <j> <k> ... Frees the parameters p[i],p[j],p[k],... in the Mössbauer fit routine, and releases constraints set by MFIX or MREL.see also MFIX, MREL, MLIST, and MATRIX.
MList
MList Lists the current parameters in the Mössbauer fit routine, and shows the correspondence between the parameters 'p' (as used in MFIX, MREL, and MFREE) and the actual Mössbauer parameters. For example, a line 'p7 (B[1])' indicates that parameter 7 corresponds to the first B-parameter. In addition MLIST list the constraints, set by MFIX and MREL.see also MFREE, MFIX and MREL.
MRel
MRel <i> <expression> Defines a constraint of the parameters used in the Mössbauer fit routine. i : parameter number expression : relation for parameter p[i] expression in reverse Polish notation Parameter p[i] is eliminated from the fit procedure, and instead equated to the given expression. Example: MREL 4 p1 p2 * 3.0 - This results in the relation: p4 = (p1 * p2) - 3.0 Note: command MATRIX releases all constraints set by MFIX or MREL.For details of the syntax, give HELP RPN
see also MFREE, MFIX and MLIST.
MXport
MXport <lu> <spectrum> <from> <to> <question?> Exports a fitted Mössbauer spectrum. You have to supply: lu : a LU opened for writing (ascii mode) spectrum : a Mössbauer spectrum from,to : two integers giving the lower and the upper channel number of the region to be exported possible questions : theo? : plot theoretical points (y/n) meas? : plot measured points (y/n) back? : divided by background (y/n) comp? : plot individual components (y/n) Export fitted Mössbauer spectra. The output is suitable as input for program XMOS, producing high quality stacked graphs of a number of fitted Mössbauer spectra. Note. If you select 'individual components', CIO arrays comp1, .. are also created.see also MDIS.
Nuclear resonant scattering fit routine
TDIS
TDIS <spectrum> <first> <last> <question?> <label> Displays a nuclear resonant scattering spectrum, together with the results of the last TFIT command. spectrum : spectrum name, as defined with MCREATE first, last : upper and lower channel number of the display region possible questions: theory? : plot theoretical points (y/n) measured? : plot measured points (y/n) extended? : extended plot (y/n) label : a text to be written above the plot To save the plot, use commands PLOT and/or GEPPOST.
TFIT
TFIT <spectrum> <theory> <first> <last> Nuclear Resonant Scattering Fit Routine spectrum : spectrum name, as defined with MCREATE theory : 10 = coherent response of hfi components 11 = incoherent response first,last : upper and lower channel number of the fit region Before giving command TFIT the spectrum should be defined with MCREATE and its data and error arrays should be filled. The 'velocity' array should be filled with times in ns. It is assumed that all time steps are equally spaced. Further command TFINPUT should be given to specify the layer structure. After TFINPUT, or in between TFIT commands, one may use TFIX, TFREE, TREL, and TVAR to make changes in the fit parameters and their constraints. Example of preparing the spectrum arrays for TFIT. If the data to be fitted are present in an ascii file in two colums, time and counts, respectively, then one might use the following scheme to input arrays spd, spe, and spv. open 1 <filename> read ascii rdas 1 2 177 spv spd # read 177 lines spv[i], spd[i] move spd spe; # copy data array to error array inc spe 0 176 1; # increment by 1 vsqrt spe spe; # set error = sqrt(data + 1) A fit that converges too slowly may be interrupted by typing <CTRL-C> (press key 'CTRL' and key 'C' simultaneously).
TFINPUT
Input for nuclear resonant scattering fit routine. Should be called before command TFIT. In the following 'variation' is the amount by which to vary a parameter for the calculation of derivatives in the fit procedure. If a variation is given the value 0, the corresponding parameter is kept fixed in the fit. Parameter constraints may also be given by TVAR, TFIX, TREL, and TFREE. You have to supply: spectrum : name of a spectrum structure as defined with MCREATE id : a line of text theta : grazing incidence angle (mrad) back : estimate of background time : estimate of time shift (ns) scale : scaling factor nblock : number of blocks (repetive structures) For each block: nrep : the number of times this block is repeated nlayer : the number of layers in this block For each layer: thickness, variation in thickness (nm) roughness, variation in roughness (nm) nel : number of elements in this layer For each element: z : atomic number n : atomic density (atoms/nm3) f1,f2 : nhfi : number of hfi components in this layer For each hfi component: isomer shift, variation in isomer shift (Mrad/s) hf field, variation in hf field (T) quadrupole coupling, variation in quadrupole coupling (Mrad/s) width sigma, variation in sigma (Mrad/s) recoilless fraction, variation in recoilless fraction weigth, variation in weight m=0 intensity ksi, variation in ksi
TFIX
TFIX <i> <j> <k> ... Prevents the parameters p[i],p[j],p[k],... in the fit routine TFIT from being changed in the fit. Note: command TFINPUT releases all constraints set by TFIX or TREL, but fixes all parameters for which a variation of 0 is given.see also TFREE, TREL and TLIST.
TFREE
TFREE <i> <j> <k> ... Frees the parameters p[i],p[j],p[k],... in the fit routine TFIT, and releases constraints set by TFIX or TREL. Take care not to free a parameter for which variation was set to 0 by TFINPUT or TVAR.
TLIST
Lists the constraints, set by TFINPUT, TVAR, TFIX, and TREL.
TREL
TREL <i> <expression> Defines a constraint of parameter p[i] used in the TFIT command. Parameter p[i] is eliminated from the fit procedure, and instead equated to the given expression. If the parameter was previously fixed (by TFINPUT, TVAR or TFIX) a warning is given.For further details in the syntax, give HELP RPN.
TVAR
TVAR <i> <new_value> <new_variation> May be used to vary the current value and variation of parameter p[i] in between commands TFIT. If the variation is set to 0, and the parameter was free, then it is now fixed, and vice versa. However if a parameter was eliminated (by TREL) it is not automatically fixed or freed.