Neutron data analysis
Perhaps the most important aspect of analyzing inelastic neutron scattering data measured on a 3-axis spectrometer is properly taking into account the experimental resolution. The instrument never probes a single point in energy-momentum space, but rather a small four-dimensional volume around it: the measured intensity is a convolution of the true scattering cross section with the so-called resolution function. Ignoring this smearing, or treating it carelessly, has on many occasions led to seriously wrong conclusions in the literature. Fortunately, the resolution function need not be measured each time: it can be computed analytically, and the Gaussian form predicted by the classic Cooper-Nathans and Popovici approximations is, thanks to the Central Limit Theorem, excellent in practice. To analyze experimental scans using a parameterized model cross section S(Q, ω), one then needs to 1) calculate the resolution function at each data point, given the spectrometer configuration and sample parameters; 2) numerically convolve ("fold") the model cross section with it; and 3) fit the convolved model to the data. Over the years we have written two generations of software that accomplish exactly these tasks.
ResLib.jl for Julia
ResLib.jl (2026) is a complete from-scratch rewrite of the original MATLAB library in Julia, and is the version we use and recommend today. The biggest news is its integration with Sunny.jl: a spin-wave model built in Sunny can be resolution-convolved and fit directly to measured scans, with the exchange constants as fitting parameters. There is no need to write down the cross section by hand, which for most real materials is impossible anyway.
What can ResLib.jl do?
- Cooper-Nathans, Popovici and Eckold resolution-matrix calculations
- Numerical convolution of user-supplied cross sections, via general 4D integration or the fast single-mode approximation with Voigt line shapes
- Direct fitting of Sunny.jl SU(N) linear spin wave theory and classical spin-dynamics models to data
- Levenberg-Marquardt least-squares fitting of any resolution-convolved model
- Multithreaded: the convolution parallelizes over data points
- Three worked tutorial examples with real experimental data from the ThALES and CAMEA spectrometers
Getting ResLib.jl
The code, the reference manual (PDF) and the worked examples are on GitHub: github.com/zhelud-eth/ResLib.jl (MIT license). Feedback, bug reports and questions by email to zhelud@ethz.ch.
ResLib for MATLAB
The original ResLib is a MATLAB library developed by Andrey Zheludev at Brookhaven National Laboratory, Oak Ridge National Laboratory and ETH Zurich in 1999–2009. It implements the same core program: resolution calculation, convolution and least-squares fitting. It has been used in hundreds of published studies over more than two decades, remains fully functional, and we keep it available here. New projects, though, are better served by ResLib.jl.
What can ResLib do?
- Popovici and Cooper-Nathans resolution matrix calculations
- Numerical folding of user-supplied cross sections with the resolution function
- Support for the single-mode approximation and Voigt profiles
- Built-in least-squares fitting routines
- 2D and 3D graphics
- 3-axis and crystallographic utilities
- Spectrometer motion simulation
Manual
Download the manual (PDF, 376 KB) — a detailed description of all ResLib functions and a discussion of the actual formulas and approximations used in the calculations.
The latest version is ResLib 3.4c (October 2009)
This version is identical to ResLib 3.4 except for a few bug fixes. As pointed out by Sibel Bayrakci and several others, there was a mistake in the formula used for the calculation of the effective collimations provided by neutron guides in ResMat.m. Additional corrections were made in the calculation of the scattering direction and sample orientation.
Download ResLib 3.4c (ZIP, 375 KB)
Check out ResLibCal, a third-party frontend to ResLib, ResCal5, Res3ax and ResCal: http://ifit.mccode.org/Applications/ResLibCal/doc/ResLibCal.html
