Skip to content
Thomas Kittelmann edited this page Jul 31, 2023 · 35 revisions

NCrystal : a library for thermal neutron transport in crystals and other materials

NCrystal is a library and associated tools which enables calculations for Monte Carlo simulations of thermal neutrons in crystals and other materials, supporting a range of physics including both coherent, incoherent, elastic and inelastic scatterings in a wide range of materials, including crystal powders, mosaic single crystals, layered single crystals, amorphous solids, liquids, and gasses. Multiphase materials or isotopically enriched materials are supported as well, and the framework furthermore supports phase-contrast (SANS) physics.

Written in C++, interfaces and infrastructure facilitate integration into existing simulation frameworks such as OpenMC, Geant4, or McStas, as well as allowing direct usage from C++, C or Python code or via command-line tools. While the C++ library is designed with a high degree of flexibility in mind for developers, typical end-user configuration is deliberately kept simple and uniform across various applications and APIs, based on a single so-called cfg-string. This allows tuning and validation of a particular crystal setup to be performed in one tool before it is then deployed in another, or it allows simulations in multiple frameworks to easily include the same materials.

NCrystal comes with a set of validated data files, including many materials important at neutron scattering facilities. For more information, visit the data library.

Supporting compilation with C++11 or later standards, the code has no third-party dependencies and is available under a highly liberal open source license (Apache 2.0).1 It was developed in close collaboration by Xiao Xiao Cai (formerly DTU and ESS, now CSNS) and Thomas Kittelmann (ESS) and was supported in part by the European Union’s Horizon 2020 research and innovation programme under grant agreement No 676548 (the BrightnESS project) and 951782 (the HighNESS project).

More details about the NCrystal library and framework can be found in the detailed Open Access publications (for citing details, see the About page):

Note that the first publication above concerns NCrystal v1.0.0. The NCrystal v2.0.0 release brought changes to inelastic physics and configuration strings, which are discussed on the Announcement-Release2.0.0 page. After that, NCrystal v2.1.0 brought additional features including flexible atomic definitions, discussed on the Announcement-Release2.1.0 page. Next, the most notable feature of the NCrystal v2.2.0 release, was the introduction of plugin support as discussed on the Plugins page. After that, the NCrystal v2.5.0 release brought a major technical upgrade concerning modern C++, multi-thread safety, and more as discussed on the Announcement-Release2.5.0 page. Then, NCrystal v2.6.0 essentially obsoleted usage of Debye temperatures for materials with phonon density curves, and also saw the addition of such curves to almost all crystalline materials in the standard data library. After that, the NCrystal v2.7.0 release introduced support for amorphous materials and greatly increased the size of the materials data library as discussed on the Announcement-Release2.7.0 page. The NCrystal v3.0.0 release introduced support for multiphase materials and SANS physics, and many other features and technical improvements, as discussed on the Announcement-Release3.0.0 page. The v3.1.0 release improved support for UCN/VCN moderator studies. The v3.2.0 release added support for easy creation of gas-mixtures. Releases v3.3, v3.4, and v3.5 mostly brought a lot of improvements to improve deployment (via CMake or conda) and integrations (with OpenMC, Geant4, and McStas). The v3.6.0 release brought huge improvements to the Python API, including utilities for easier construction of new high quality materials. The v3.7.0 release made it possible to build NCrystal via Python-centric build tools, and allowed NCrystal to be released on PyPI (for pip install ncrystal).

[1]: For details refer to the files NOTICE and LICENSE.