nxs - a library for neutron cross section calculations

A collection/library of routines, written in C, for the computation of neutron scattering and absorption cross sections for polycrystalline/powder materials based on the composition of a crystallographic unit cell.

Author: Mirko Boin, boin@helmholtz-berlin.de

p.s.: nxs is not nexus, here! ;-)


The nxs library for computing neutron scattering and absorption cross sections provides a number of C structs and functions to calculate wavelength-dependent cross section values for polycrystalline/powder-like materials. The definition of a material is represented by the composition of a unit cell (NXS_UnitCell). A unit cell is created from the specification of a space group and its unit cell parameters. The SgInfo routines from Ralf W. Grosse-Kunstleve is included here for such purposes. Monoatomic materials as well as multi-atomic compounds are created by adding NXS_AtomInfo atom information/properties. The library also provides a reading and saving routines to compose unit cells from nxs parameter files.


The below example shows howto quickly use the library routines to initialise a unit cell and calculate some cross sections.

NXS_UnitCell uc = nxs_newUnitCell();
int numAtoms = nxs_readParameterFile( nxsFileName, &uc, &atomInfoList);
if( numAtoms > 0 )
  int i=0;
  for( i=0; i<numAtoms; i++ )
  nxs_addAtomInfo( &uc, atomInfoList[i] );
  nxs_initHKL( &uc );
  double lambda=0.1;
  for( lambda=0.1; lambda<4.0; lambda+=0.1 )
    printf("%f\n",nxs_Absorption(lambda, &uc ) );

Parameter files

Currently, nxs provides routines to read and save nxs parameter files of one particular kind. It is a human-readable, INI-like, file format to store the necessary information for the compositon of a crystallographic unit cell. An example of NaCl is given below:

# This is an nxs parameter file

# define the unit cell parameters:
#   space_group                      - the space group number or Hermann or Hall symbol [string]
#   lattice_a, ...b, ...c            - the lattice spacings a,b,c [angstrom]
#   lattice_alpha, ...beta, ...gamma - the lattice angles alpha,beta,gamma [degree]
#   debye_temp                       - the Debye temperature [K]

# add atoms to the unit cell:
# notation is "atom_number = name b_coh sigma_inc sigma_abs_2200 molar_mass x y z"
#   name           - labels the current atom/isotope  [string]
#   b_coh          - the coherent scattering length [fm]
#   sigma_inc      - the incoherent scattering cross section [barns]
#   sigma_abs_2200 - the absorption cross sect. at 2200 m/s [barns]
#   molar_mass     - the Molar mass [g/mol]
#   x y z          - the Wyckoff postion of the atom inside the unit cell
# e.g.: add_atom = Fe 9.45 0.4 2.56 55.85 0.0 0.0 0.0

add_atom=Na 3.63 1.62 0.53 22.99 0.0 0.0 0.0
add_atom=Cl 9.577 5.3 33.5 35.45 0.5 0.5 0.5


nxs - neutron cross sections (c) 2010-2014 Mirko Boin

The nxs library includes the SgInfo library, whose free usage is granted by the following notice:

Space Group Info (c) 1994-96 Ralf W. Grosse-Kunstleve Permission to use and distribute this software and its documentation for noncommercial use and without fee is hereby granted, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in the supporting documentation. It is not allowed to sell this software in any way. This software is not in the public domain.


Main reference:

Applications of nxs:

  • "Validation of Bragg edge experiments by Monte Carlo simulations for quantitative texture analysis"
    Boin, M.; Hilger, A.; Kardjilov, N.; Zhang, S.Y., Oliver, E.C.; James, J.A., Randau, C. & Wimpory, R.C. (2011). J. Appl. Cryst. 44, 1040-1046, doi: 10.1107/S0021889811025970
  • "Time-of-flight neutron imaging at a continuous source: Proof of principle using a scintillator CCD imaging detector"
    Strobl, M.; Hilger, A.; Boin, M.; Kardjilov, N.; Wimpory, R.; Clemens, D.; Mühlbauer, M.; Schillinger, B.; Wilpert, T.; Schulz, C.; Rolfs, K.; Davies, C. M.; O'Dowd, N.; Tiernan, P. & Manke, I. (2011). Nucl. Instrum. Methods Phys. Res., Sect. A 651, 149-155, doi: 10.1016/j.nima.2010.12.121
  • "Monte Carlo simulations for the analysis of texture and strain measured with Bragg edge neutron transmission"
    Boin, M.; Wimpory, R.C.; Hilger, A.; Kardjilov, N.; Zhang, S.Y. & Strobl, M. (2011). J. Phys.: Conf. Ser. 340, 012022/1-12, doi: 10.1088/1742-6596/340/1/012022
  • "Geant4 based simulations for novel neutron detector development"
    Kittelmann, T.; Stefanescu, I.; Kanaki, K.; Boin, M.; Hall-Wilton, R. & Zeitelhack, K. (2014). J. Phys.: Conf. Ser. 513, 022017, doi: 10.1088/1742-6596/513/2/022017
  • "A new transmission based monochromator for energy-selective neutron imaging at the ICON beamline"
    Peetermans, S.; Tamaki, M.; Hartmann, S.; Kaestner, A.; Morgano, M. & Lehmann, E. H. (2014). Nucl. Instrum. Methods Phys. Res., Sect. A 757, 28-32, doi: 10.1016/j.nima.2014.04.033