Ncrystal

Latest version: v4.1.2

Safety actively analyzes 710644 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 13

4.1.2

* Improve support for FreeBSD by actually running builds and CTests in CI
on that platform, and fix the few issues uncovered by this.
* Avoid _POSIX_C_SOURCE and _XOPEN_SOURCE on FreeBSD.
* Explicitly link test apps and libraries against the backtrace library
found by CMake.
* Specify proper dependencies for tests/scripts/ncdevtoolchecks.py and
tests/scripts/ncmatparser.py.

4.1.0

* Added a new "virtual API", which allows NCrystal to be used as a runtime
plugin in downstream applications, through usage of relevant abstract C++
interfaces in a set of "virtual api" headers, which are guaranteed to
remain stable across all NCrystal versions. A factory function is
provided which can instantiate these interfaces, and it is available with
C-bindings so downstream application can invoke it at runtime via either
dlopen+dlsym or LoadLibrary+GetProcAddress, depending on a platform. For
now only one such "virtual api" header is provided, intended for usage in
the OpenMC project.
* An example project using NCrystal in this manner is provided in
examples/virtualapi_project.
* As an added bonus, applications desiring absolute ABI stability from
NCrystal, can use the new "virtual API" interfaces to obtain that. This
is true, even for applications with a more typical build-time dependency
on NCrystal, and do not wish to open the NCrystal library dynamically at
runtime. Currently the only actual example of such usage can be found in
tests/src/app_vapit1v1/main.cc.

4.0.2

* Retrieval of CIF files from the Crystallography Open Database now tries a
backup mirror location at https://qiserver.ugr.es/cod/ if the primary
server is down.
* Introduce new ncrystal-verify package at PyPI which when installed
provides a command ncrystal-verify, which can be used to more thoroughly
verify a particular NCrystal installation. This package is experimental
for now, and documentation will only refer to it once it matures a bit
more.
* The command "ncrystal-config --intversion" now correctly prints the
"intversion" (e.g. 4000002) and not the "version" (4.0.2). Note that
"ncrystal-config --show intversion" was not affected by the bug and
correctly printed the intversion also previously.
* Dependency management of the various packages in the ncrystal ecosystem
is now maintained via one central file, devel/dependency_database.yml,
with unit tests ensuring it is applied correctly in static files across
the repository.

4.0.0

* This milestone release primarily brings new supported user platforms and
a huge restructuring of the environment in which NCrystal is developed
and tested. In addition, it also brings many minor fixes, and an updated
and improved infrastructure for NCrystal plugins.
* As the perhaps biggest user-visible feature, NCrystal now also supports
usage on Windows! This support is NOT considered experimental, and
Windows users can now install the "ncrystal" package via tools like pip
and conda and expect the same features on both the command-line and in
the Python/C/C++ APIs as Unix users have had in the past. Of course,
there might be bugs or issues to iron out, so please help us test out the
new release on Windows and file issues at
https://github.com/mctools/ncrystal/issues as appropriate!
* As another user-visible feature, it is now possible to install optional
NCrystal plugins via a simple "pip install", and have NCrystal
automatically and seamlessly pick up and load the plugin. We are
currently putting together a curated list of known plugins, and in the
near future we will provide an overview of these on the Wiki. As a quick
preview teaser, try to do "pip install ncrystal-plugin-WaterData" and
notice how "nctool --browse" suddenly shows a large list of NCMAT data
files for light and heavy water at different temperatures. These files
were in the past deemed too large for the NCrystal standard data library,
but can now be easily made, without the need for manual download.
* In addition to Windows support, the NCrystal code-base has also been
updated to support a variety of other compilers and other
dependencies. This notably includes support for the Intel OneAPI
compilers, but also latest gcc and clang, C++20, Python 3.13, Numpy 2,
and of course Microsoft VisualStudio. Drop support for Python 3.6 and
3.7.
* As part of the efforts to make NCrystal command-line tools easily work on
Windows, the various commandline tools of NCrystal (nctool,
ncrystal_cif2ncmat, ncrystal_hfg2ncmat, etc.), are now better integrated
into the NCrystal Python API. As a result they can be invoked directly in
the Python API (i.e. without the need for subprocess calls invoking a
shell command), via the new NCrystal.cli Python module. For instance,
NCrystal.cli.run('nctool','--dump','Al_sg225.ncmat') will have the same
effect as invoking "nctool --dump Al_sg225.ncmat" at the command
line. One notable difference is that the code will run in the same
process, meaning that any virtual files registed in memory will also be
available to these tools.
* NCrystal packaging was updated. Users should still simply install a
package from PyPI or conda-forge named "ncrystal", but behind the scenes,
the formerly monolithic package named "ncrystal" has been split into
three packages: "ncrystal-core", "ncrystal-python", and a metapackage
called "ncrystal". The ncrystal-core package contains everything needed
for those only needing C/C++ APIs: The binary file library (named
libNCrystal.so, libNCrystal.dylib, or NCrystal.dll+NCrystal.lib depending
on your platform), the NCrystal C++/C header files, the ncrystal-config
command, and the CMake configuration files. Included in ncrystal-core
(actually embedded in the binary library) is also the standard data
library of NCMAT files. The "ncrystal-python" package contains the
NCrystal python module, and all the many command-line tools (except for
ncrystal-config). Finally, the package named "ncrystal" is simply a
meta-package which depends on both "ncrystal-core" and "ncrystal-python",
and ensures that they will be installed in compatible versions.
* The ncrystal repository at https://github.com/mctools/ncrystal is now
finally maintained like any other open source project, with good CI and
testing coverage, ready to accept PRs, and so on. This actually marks a
VERY large change in the NCrystal project since the code has until now,
and for historical reasons, actually been developed and tested in an
in-house repository at the European Spallation Source's DMSC, nested in a
Unix-only build and testing framework
(https://mctools.github.io/simplebuild/). The code was then exported to
the ncrystal repository at github when ready for a new release, through
the usage automated scripting which reformatted the code as
appropriate. Although this was a useful mode of development in the early
days of the project, it is needless to say that this has long been a
burdensome way of working, precluding meaningful usage of pull requests
and other open source workflows at GitHub. From now on, the ncrystal
repo at GitHub is the true upstream source of NCrystal code, and it also
includes a large number of tests which can be invoked via CTest or the
simple-build-system.
* The Python and cmdline API should be mostly unchanged by this release,
and likewise the C++ and C APIs are mostly the same, although a few
container classes were modified to support Microsoft and Intel
compilers. Notably, many header file locations were modified, but code
sticking to including "NCrystal/NCrystal.hh" and "NCrystal/ncrystal.h"
should be safe (it is henceforth recommended to only include those files,
since the location of other files might change. The C++ interface of
NCrystal4 is NOT ABI compatible with earlier versions of NCrystal, and
will require recompilation of downstream code. Code only using the C-API
in "NCrystal/ncrystal.h" would on the other hand be ABI compatible.
* The new "ncrystal" PyPI package now comes with optional dependencies
listed. At the time of writing this is: "plot" which installs
dependencies required by various plotting functions in the NCrystal
cmdline tools or Python API (currently this is just matplotlib),
"composer" which installs dependencies required for usage of the
NCMATComposer (currently this is just spglib), "cif" which installs
dependencies required for reading and processing CIF files (currently
this is gemmi, spglib and ase), Finally, the "all" dependencies combines
all of the above, so doing `pip install "ncrystal[all]"` should ensure
that users will not encounter missing dependencies when using the
NCrystal Python or cmdline APIs. Another category, "devel", is intended
for NCrystal developers and CI pipelines, and adds additional packages
needed for such work.
* Keeping in line with general trends at github, the default branch of the
ncrystal repository is named main rather than master, from this point
on. For a little while we will try to keep the master branch alive, in
case of any hardwired usage of the branch name "master" somewhere, but
this will not be the case for long. This change does not, however, change
the fact that we will in general try to keep default branch (now: main),
synchronised with the main release (apart possibly from minor
documentation and CI fixes), and keep the "develop" branch as the main
branch to target with pull requests between releases. NOTE: Any local
clones of the ncrystal code repository should be updated to reflect this
change. If there is no local interesting content in the clone, one option
is to remove the local clone and get a fresh one from github. Otherwise,
GitHub advices the following four commands to "repair" your local clones
(experts only):
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
* Added a new ncrystal_mcstasunion command-line script which is to be used
instead of calling 'python -mNCrystal.mcstasutils --union'.
* The NCrystal-Geant4 bindings are moved out of the NCrystal repository and
into https://github.com/mctools/ncrystal-geant4 . Note that at the time
of this release, this migration is still work in progress and not
complete yet. Anyone needing NCrystal and Geant4 are recommended to use
NCrystal release 3.9.7 as a short term workaround.
* The rest of this changelog will list a range of other improvements and
bug fixes that are also a part of this release, but which might be of
less general interest.
* As part of the update, NCrystal now uses modern pyproject.toml files
where appropriate, and scikit-build-core as opposed to scikit-build. One
side-effect of all of this is also that the NCrystal PyPI wheels are now
"abi3" compatible, meaning that they will work with any Python version
3.8 or later. This not only means that the older wheels are expected to
be forward-compatible with newer Python releases, but also prevents an
explosion in the number of NCrystal packages which has until now been
(number-of-binary-platforms)*(number-of-python-versions), with a
corresponding strain on resources at GitHub, PyPI and conda-forge.
* This release introduces the "ncdevtool" command-line utility for usage by
NCrystal developers. It is technically an executable python script
residing in the <root>/devel/bin folder, which should be added to the
PATH to make the command available (on Unix, one can source
<root>/devel/setup.sh to do just that). It is actually developed in the
python module residing in <root>/devel/pypath/ncrystal_repo_tools/, and
supports many different options. Notably "ncdevtool cmake" or "ncdevtool
sb -t" can be used to build and test everything with CMake+CTest or
simple-build-system respectively, and "ncdevtool check" runs a series of
very fast static checks on the repository (including notably static
checking of all python files with ruff).
* Although many tests have been ported from the historical repository at
ESS-DMSC, many still remain due to having dependencies on
simple-build-dgcode, or because they need to be reviewed for license
issues. For that reason, the CI at GitHub will for now also exercise the
remaining tests in the ESS-DMSC repository.
* As described in a previous item, plugin support was updated. This means
that all existing plugins must be migrated to follow the new layout as
indicated by the examples in in <root>/examples/plugin (for compiled
plugin modifying algorithms and possibly NCMAT files) or
<root>/examples/plugin_dataonly (for static plugins merely providing more
NCMAT files). After a plugin has been installed, it can be tested with
the command "ncrystal-pluginmanager NameOfPlugin".
* For users wishing to ensure that their installation of NCrystal can NOT
load any plugins, they can either set the environment variable
NCRYSTAL_DISABLE_DYNLOAD=1 (for enforcing this at runtime), or configure
and build ncrystal-core with the CMake option
-DNCRYSTAL_ENABLE_DYNLOAD=OFF (for enforcing this at build time).
* Now that the plugin system has matured, we have removed the
NCRYSTAL_BUILTIN_PLUGINS CMake option, which could previously be used to
build a plugin into the NCrystal library itself. From now on, only
dynamical runtime loading of plugins are supported.
* Fixed code bug where Stirling's formula was used too early when expanding
VDOS to kernels. The relative error in SAB values due to this bug was
fortunately minor since our implementation of Stirling's formula used
many higher-order corrections and had an error of 4.670e-04 for n=1,
4.755e-07 for n=2, 6.882e-09 n=3. Still, due to S(alpha,beta) phase-space
constraints, some inelastic cross sections can change by as much as 0.5%
at very low energies due to this, although such large changes are
fortunately rare with most changes being 0.1% or less.
* Removed SOVERSION from produced libraries (due to github issue 186).
* Removed several long-obsolete CMake options for ncrystal-core. Also
removed any options related to Python code, since ncrystal-core now does
not contain any Python modules or scripts.
* FactImpl::registerFactory function will now always raise an error
in case of name clashes with an existing registed factory.
* The NCrystal SmallVector C++ class was written to to be never implicitly
copyable and instead SmallVector_IC was introduced, which is implicitly
copyable. This was needed for MS VisualStudio support. The resize methods
on the class were made unavailable for non-noexcept copy types.
* The NCrystal Optional class was redesigned to support VisualStudio
compilation.
* Explictly added a few methods in NCTypes.hh which should otherwise be
implicitly available through the base class. This was needed for MS
VisualStudio support.
* Replaced std::vector with SmallVector in HKLList to work around
VisualStudio issues.
* Reimplement ScatterRequest and Absorption request without using CRTP,
which was confusing to VisualStudio.
* Various other minor fixes of code to appease both VisualStudio and Intel
OneAPI compilers.
* Disable MiniMC verbose output messages also in Debug builds.
* Prefer numpy.trapezoid over the deprecated numpy.trapz, to support Numpy
version 2.
* Return tuple of int rather than numpy.int32 objects for hkl_labels
provided by Info.hklObjects(), to support Numpy 2.
* Normalise newlines in TextData.rawData results, so the loaded string data
is identical irrespective of whether the files contain DOS or UNIX-like
line endings. As an added safety, any lone \r will also be converted to a
newline. Note that upon checkout, tools like Git might modify the line
endings of tracked .ncmat files, so NCrystal will be able to accept both
kinds of files (as for the case of NCMAT, this is also specified as being
supported by the format).
* ncrystal_ncmat2cpp --full option no longer supported (will now always
include comments when embedding unless new --compact flag is given).
* Moving the cfgstr_detect_components from the NCrystal.mcstasutils to the
NCrystal.misc module.
* Users of obsolete methods in the Python API will now receive warning
messages.
* Completely drop previously obsoleted commands ncrystal_inspectfile and
ncrystal_onlinedb2ncmat, in favour of nctool and ncrystal_cif2ncmat
respectively.
* Minimum CMake version is now 3.16 (was 3.10).
* The PCBragg algorithm was renamed to PowderBragg, to better reflect the
physics involved.
* The NCrystal._mcc Python module was renamed to NCrystal.mmc, to better
reflect its non-internal nature. For the time being, the NCrystal._mcc
will also be kept around for backwards compatibility.
* Fix bug where line numbers in error messages from the NCMAT parser could
be off by one.

3.9.7

* Fix bug in LoadedMaterial.xsect/.macroscopic_xsect methods.

3.9.6

* Add several new convenience methods to MiniMC results and histograms.
* Fix bug in MiniMC histogram error propagation.
* NCMATComposer gets new expert-only methods for adding CUSTOM_ sections
or raw text to NCMAT data.
* NCMATComposer.from_hfg sets plotlabel from title.

Page 1 of 13

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.