 Procedures Details

# Expressions

General mathematical expressions can be used in several contexts, such as expressing constraints in least squares fitting, and Custom Population Functions, Custom Width Functions, Custom Transition Functions, Lineshape Functions or Custom Lineshape Functions. Each context has some specific variables introduced, but the same logic is otherwise used for all expressions:

• The function is held in the comment field for the object; in the constants window an enlarged text window replaces the normal comments window.
• Parameter names can be used to include parameter values in expressions, such as:

Species.LinearMolecule.Ground.v=0.B

To find the name of a parameter, right click on it in the constants window and select "Show Full Name". Depending on the context, parts of the parameter name can be omitted if no ambiguity is introduced as to the parameter concerned, so for the above:

Ground.v=0.B

or

v=0.B

would typically also work (though B on its own would only work if there was only one state).Quotes might be needed around the parameter name if it contains special characters, as in:
"NH3.NH3.s.<0-|J+-^6|0->.Value".
• Float, Increment and StdDev are all valid qualifiers to parameter names as in:

v=0.B.StdDev

v=0.B.Float

The later will have a value of 0 ir 1.
• Any unrecognised names are typically created as variables. To rename or delete created variables, right click on the variable and select rename or remove as required.
• The standard mathematical operators are available: + - * /, with power expressible as ^ or **.
• The standard functions sqrt, sqr, abs, sin, cos, tan, acos, asin, atan, arccos, arcsin, arctan, exp, ln, log10, ceil, floor, round, factorial, sinh, cosh, tanh are available. See also the special functions below.
• The comparison operators =, <>, !=, >, <, >= and <= evaluate to 1 for true, 0 for false. To express a conditional combine these with multiply and add, so for example (a>b)*a+(a<=b)*b would give the maximum of a and b.
• All arithmetic is done in double precision.
• Comments are # or // to end of line, or enclosed in {...} or /* ... */
• A simple test calculator is available from "View, Calculator".
The following special functions and operators are also available:
 int(a) Integer part of a; number is closer to zero than a (or equal to a). frac(a) a - int(a) % modulus operator: a % b = frac(a/b)*b mod(a,b) a % b except if a < 0 in which case b-frac(|a|/b)*b is used. a xor b bitwise exclusive or of a and b pi 3.14159... min(a,b,c...) The minimum value of all the arguments max(a,b,c...) The maximum value of all the arguments poly(x,a0,a1,a2...) a0+a1.x+a2.x2+... lor(x,w) Lorenztian function with FWHM w and unit area = w/[2π(x2+w2/4)] gau(x,g) Gaussian function with FWHM g and unit area = w/π½ exp(-w2x2) where w = 2ln(2)½/g voigt(x,l,g) Voigt profile at offset x from the line centre. l is the FWHM of the Lorenztian component, g of the Gaussian. The area is unity. air(s) Air wavelength/nm given vacuum wavenumber s/cm-1. The refractive index is taken from from B Edlen, Metrologia, 2, 71 (1966). vac(l) Vacuum wavenumber/cm-1 given air wavelength in nm. atan2(x,y) atan(x/y), but with a -π...π result range. threej(j1,m1,j2,m2,j3,m3) Wigner 3-j function cg(j1,m1,j2,m2,j3,m3) Clebsch-Gordan coefficient = (-1)j1-j2+m3(2j3+1)½threej(j1,m1,j2,m2,j3,-m3) sixj(j1,j2,j3,j4,j5,j6) Wigner 6-j function ninej(j11,j12,j13,j21,j22,j23,j31,j32,j33) Wigner 9-j function

Selected fundamental constants (in SI units) are available in many contexts, though not all to avoid confusion:
 a0 Bohr radius/m c Speed of light ee Charge on the electron ep Permittivity of a vacuum ge g value for an electron gg Gravitational Constant f Faraday Constant k Boltzmann Constant l Avogadro's Number r Gas Constant h Planck constant hc h/2π me mass of electron mn mass of neutron mp mass of proton mub Bohr magneton mun nuclear magneton rydberg Rydberg constant/m-1 u Atomic mass unit/kg