Skip to content

Releases: mctools/ncrystal

NCrystal release 3.9.7

24 Sep 12:12
Compare
Choose a tag to compare

Fix bug in LoadedMaterial.xsect/.macroscopic_xsect methods.

NCrystal release 3.9.6

30 Aug 11:47
Compare
Choose a tag to compare

This releases adds several new convenience methods to MiniMC results and histograms and fixes a bug in MiniMC histogram error propagation.

Additionally, the NCMATComposer gets new expert-only methods for adding @CUSTOM_ sections or raw text to NCMAT data.

NCrystal release 3.9.5

30 Aug 11:46
Compare
Choose a tag to compare

Make ncrystal_hfg2ncmat functionality available in Python API as well in the new NCrystal.hfg2ncmat module. Also add NCMATComposer.from_hfg(..) factory function to access the functionality.

NCrystal release 3.9.4

30 Aug 11:45
Compare
Choose a tag to compare

A few fixes for the PhononDOSAnalyser (github issue #187).

NCrystal release 3.9.3

30 Aug 11:45
Compare
Choose a tag to compare

Minor fixes for NCrystal.cifutils and MiniMC plotting.

NCrystal release 3.9.2

19 Aug 11:15
Compare
Choose a tag to compare

Minor tweaks and fixes for the new MiniMC code.

NCrystal release 3.9.1

16 Aug 15:38
Compare
Choose a tag to compare

This is a minor release fixing the newly introduced info.hklObjects() method in the Python API (see #164).

NCrystal release 3.9.0

14 Aug 12:12
Compare
Choose a tag to compare

After half a year of dedicated work, NCrystal 3.9.0 is finally available! This release brings both general improvements and new features, as well as a slew of maintenance updates and bug fixes. For those wishing all the gory details refer to the CHANGELOG, but in short the highlights are:

  • General speedup in a lot of the code. In particular the Fast Fourier Transform code, used when expanding phonon density of states to full scattering kernels for inelastic modelling, was improved by as much as 40%. This will make a noticeable difference when initialising many materials, and is an improvement independent from the multi-threading option mentioned in the next item.

  • If requested, NCrystal can now initialise materials even faster, by performing the initialisation calculations in multiple threads. This can for instance be enabled by setting the environment variable NCRYSTAL_FACTORY_THREADS to the number of threads you wish to use (e.g. 8 if you have 8 CPU cores available, or 9999 to have NCrystal pick a number suitable for your machine). Alternatively, you can call functions in the Python, C, or C++ APIs to enable this:

    NC.enableFactoryThreads() # Python
    NC::FactoryThreadPool::enable(); //C++
    ncrystal_enable_factory_threadpool(9999); // C
    export NCRYSTAL_FACTORY_THREADS=9999 # BASH
    
  • NCrystal now includes the first iteration of a "Mini Monte Carlo" framework (for lack of a better word), which makes it possible to insert an NCrystal material into a simple geometric "sample" shape, subject it to a source of neutrons, and obtain a spectrum or pattern of the outgoing neutrons. Thus, one can easily produce a simplistic diffraction pattern, including effects of multiple scattering and both elastic and inelastic physics. For now, the focus has been on developing the framework itself, rather than preparing a library of interesting shapes, sources, and tallies. Thus, the only readily available setup in this release is that of a monochromatic pencil beam impinging on a sphere, tallying the outgoing angle of the neutrons as they leave that sphere. Nonetheless, the results provides a very convenient view of how NCrystal modelling translates into a particular pattern -- without the need for an additional software package like McStas, Geant4, or OpenMC. Here is an example showing such a result:

    nctool --mc '2Aa' '5mm' 'AgBr_sg225_SilverBromide.ncmat;temp=350K'
    
    nctool MiniMC plot

    It works for single crystal materials as well:

    nctool --mc '3.8Aa' '5mm' 'C_sg194_pyrolytic_graphite.ncmat;mos=1deg;dir1=@crys_hkl:0,0,2@lab:0,3,1;dir2=@crys_hkl:1,0,0@lab:0,1,0;dirtol=180deg'
    
    nctool MiniMC plot

    The scope of this "Mini Monte Carlo" framework is of course not to try to rival existing applications in terms of ability to simulate complicated geometries or beamlines, but rather to provide another convenient way to quickly investigate NCrystal materials, as well as potentially serve as a way for NCrystal to be used in a regression-loop while analysing actual neutron scattering data. For that reason, speed has been a major concern, and both multithreading and vectorisation has been utilised to bring the time it takes to go from defined NCMAT data to having a high-statistics diffraction pattern available, down to the sub-second scale.

  • Internally NCrystal code no longer uses raw std::cout or printf statements. Rather, all messages are now emitted via a centralised infrastructure. This most importantly fixes an issue where output from the Python and C++ layers could occasionally be emitted in incorrect order - now, when using the NCrystal Python API, all output will be emitted through Python's own print buffer. Secondly, several NCrystal objects now gets a .dump_str() method, meaning for instance that material dumps can be captured in strings rather than emitted on std-output. Finally, this new feature could in principle be used for various output redirection purposes (e.g. a GUI application might wish to show all output from NCrystal in some dedicated text box).

  • NCrystal has been updated to work with latest versions of Numpy, Clang, GCC, Python, Gemmi, and Spglib. Additionally work has started to support Intel OneAPI compilers and Microsoft VisualStudio, although more work is needed to finalise this for the case of VisualStudio. As part of these efforts, the ABI had to be broken in some places, since for instance VisualStudio did not support all the data structures used previously (for instance, its std::vector does not accept move-only objects like std::unique_ptr).

  • Info objects gets a new .hklObjects() method which returns HKL list information in a more object oriented and convenient format than the existing .hklList(). See issue #164 for more details.

NCrystal release 3.8.0

03 Dec 13:30
Compare
Choose a tag to compare

Release 3.8.0 brings several changes of a technical nature, and mostly to how one builds and configures NCrystal. People using NCrystal installed via conda or pip will most likely only notice that the command previously available under the two names ncrystal_inspectfile and nctool, no longer is available as ncrystal_inspectfile. From this point on, the command is only available via the name nctool.

We also would like to point out that in addition to conda-forge and PyPI, NCrystal packages are now also available in Debian stable (thanks to the team lead by Emmanuel Farhi from the Synchrotron SOLEIL) and FreeBSD (thanks to efforts by Yuri Victorovich).

For people manually building NCrystal or downstream C++/C code, the primary changes to be aware of are (as usual, the CHANGELOG has more details):

  • NCrystal libraries now are installed with SOVERSION, and optionally with a custom namespace for both library symbols and library name. Thus, compiling downstream projects (without CMake) with -L/some/where -lNCrystal is no longer recommended (see the CHANGELOG for the recommended alternative).
  • Files like /setup.sh are no longer installed by default. If you need them, please set -DNCRYSTAL_ENABLE_SETUPSH=ON and note that the files are additionally renamed like <PREFIX>/ncrystal_setup.sh.
  • NCrystal-related McStas (mcstas.org) components and instruments are no longer provided as part of NCrystal. Rather, they are now provided as part of the McStas project.

NCrystal release 3.7.1

03 Aug 11:15
Compare
Choose a tag to compare

Minor maintenance release with various small fixes for C++, Python, and CMake code. For full details refer to the
CHANGELOG or the full diff.