Takashi IDA / Original Software / Igor Macro

[ Japanese Page is HERE. ]


Original software written in Igor Pro macro language is supplied in plane-text format. The procedures can be used by copying & pasting to the procedre window of Igor.


1. Special functions

1-1 Inverse of complementary error function

[ erfci.txt ]
The inverse function x=erfci(y) for the complementary error function y=erfc(x).

1-2 Voigt function and Faddeeva function

[ VoigtPoppeWijers.txt ]
The "scaled complex complementary error function" (Faddeeva function) :
wofz(z)=exp(-z*z)*erfc(-i*z)

is calculated by the algorithm of Poppw & Wijers.
i=sqrt(-1) is the imaginary unit, erfc(x) is the complemntary error function.
The variable "z" can be complex number.
The Voigt function, defined by the convolution of Lorentzian and Gaussian function, is calculated by using the Faddeeva function.

The Voigt function:
fVoigtPoppeWijers(x,GamL,GamG)

where "GamL" and "GamG" are the full widths at half maximum (FWHM) of the Lorentzian and Gaussian function.

Faddeeva function:
wofz(z)

can be used.

Refer to [G.P.M.Poppe & C.M.J.Wijers, ACM Trans.Math.Software, 16, 38-46 (1990)].


2. Numerical Integral

2-1 Gauss-Legendre integral

[ GaussLegendre.txt ]

The macro creates the abscissa and weights of Gauss-Legendre integral with arbitrary number of sampling points.

The waves for the abscissa: xGL[0..n0*(n0+1)/2-1] and weights: wGL[0..n0*(n0+1)/2-1] are created by executing the macro GauLegInit(n0).

The i-th element from the n sampling points (n <= n0) is referred as
xGL[n*(n-1)/2+i-1] and wGL[n*(n-1)/2+i-1]

Example: n-point Gauss-Legendre integral of a function f(x) from alpha to beta is calculated by

ans = 0;

i = 0;

do

x = alpha + (beta-alpha) * xGL[n*(n-1)/2+i];

ans = ans + wGL[n*(n-1)/2+i] * f(x);

i = i + 1;

while (i < n);

ans = (beta - alpha) * ans;

2-2 Gauss-Hermite integral

[ GaussHermite.txt ]
The macro creates the abscissa and weights of the Gauss-Hermite integral with arbitrary number of sampling points.

The waves for the abscissa: xGH[0..n0*(n0+1)/2-1] and weights: wGH[0..n0*(n0+1)/2-1] are created by executing the macro GauHerInit(n0).


3. Optimization

3-1 Downhill simplex method

[ DownHillSimplex.txt ]


4. For Powder X-ray diffraction

4-1 Absorption correction for cylinder

[ Thorkildsen.txt ]
Rapid alghorithm to evaluate transmittance (reciproal of absorption correction factor) of cylinder, applying Gauss-Legendre quadrature to the formula of Thorkildsen & Larsen. Over 1,000 times faster than the method described in “International Tables for Crystallography”.

4-2 Absorption correction for cylinder and sphere

[ AbsorptionCorrection.txt ]
Collection of macros to calculate transmittance (reciprocal of absorption correction factor) of cylinder and sphere.

4-3 Dispersion correction

[ PanelCromerLiberman.txt ]
GUI inteface (control panel) for using the macro:
Cromer Liberman macros for Igor Pro for atomic form factors” developed by Jan Ilavsky.
Mass attenuation coefficient μ / ρ and dispersion corrections Δf1, Δf2 are displayed by entering the wavelength or photon energy of the x-ray.
Note: the name of the procedure window should be different from “PanelCromerLiberman”.
(Updated May 13, 2012).


5. Utilities

5-1 Expressions of errors

[ niceNum2Str.txt ]

String function, creates a string of valid figures with the error expressed as integer in parenthesis, from input numerical value and error.

Example:
Descriptions in Igor macroresults
niceNum2Str(15345.5413,235.1543)15300(200)
niceNum2Str(15345.5413,134.1543)15350(130)
niceNum2Str(15345.5413,1.1543)15345.5(12)
niceNum2Str(15345.5413,0.0543)15345.54(5)
niceNum2Str(15345.5413,0.0143)15345.541(14)


Updated: May 13, 2012