mctools/ncrystal: NCrystal release 3.6.0
Description
This milestone release primarily brings a massive restructuring and update of the Python API of NCrystal. The changes should be backwards compatible in almost all cases, and the most user-visible changes should hopefully be the addition of several new big features, highlighted below.
Note that along with this release we are also publishing several Jupyter notebooks at https://github.com/mctools/ncrystal-notebooks which might be a more enjoyable (or at least useful) way to learn the Python API of NCrystal. These notebooks will also be used during the "HighNESS International School on Thermal Neutron Scattering Kernel Generation" hosted at the European Spallation Source in Lund (https://indico.esss.lu.se/event/3096/).
The new NCMATComposer helper class is added to the Python API. It can be used to create new materials in an object-oriented and pythonic manner, as opposed to hand-crafting the NCMAT data. It essentially supports all features of the underlying NCMAT format, but does so in a much more easily accessible manner, and handles a lot of the book-keeping that can arise in some complicated materials.
A new NCrystal.cifutils submodule brings a CIFLoader class, which behind the scene empowers the NCMATComposer class to adopt crystal structures from CIF files. Such files can reside both locally or in selected online databases. CIF files often contain incomplete information, so be sure to consult the Jupyter notebook tutorial linked above for examples of how to deal with these. Note that based on this CIF functionality, the NCMATComposer now also support ASE (https://wiki.fysik.dtu.dk/ase/) objects, or the loading of a variety of input formats via ASE.
A new PhononDOSAnalyser class can be used to investigate and cleanup phonon density of state (VDOS) curves, and then (with the help of the NCMATComposer class) add them to a material. In particular, one of the Jupyter notebooks linked above shows how one might go through the steps of converting phonon curves produced by Quantum Espresso (https://www.quantum-espresso.org/) to define high quality NCMAT data for a material.
A new NCrystal.plot submodule brings several new plotting utilities, that can either be used directly, or via various convenience plotting methods added to various classes in the API. In particular, note the plot_xsect(..) and plot_xsects(..) function in the submodule, which can be used to easily produce cross section plots from a range of inputs (NCrystal objects, NCMAT data, cfg-strings, etc.).
In general, many objects, both new and old, have been enriched with more convenience methods for plotting, dumping, or merely extracting data. Note for instance the new .findDynInfo and .findAtomInfo methods of the Info objects, or the various .plot_xxx() methods on the DynamicsInfo objects.
A new global .load() function can be used to load either cfg-strings or raw NCMAT data into LoadedMaterials objects. LoadedMaterials objects have .info, .scatter, and .absorption properties available for accessing all of these physics objects. Loading a material in such a unified manner might be more convenient for many use-cases (in particular interactive sessions) than the classic .createInfo(..), .createScatter(..), and .createAbsorption().
Note that while NCrystal in general does not have any required dependencies, several of the features above does depend on third-party python modules. All these modules are well-maintained open-source projects, available both on PyPI (for pip install xxx) and on conda-forge (for conda install -c conda-forge xxx). The optional dependencies are:
numpy: for various array-based functionality. Although not strictly needed, it is recommended to always install this.matplotlib: for usage of the plotting utilities.spglib: For producing crystalline materials withNCMATComposer, in order to verify (or refine) the structures.gemmi: For reading CIF data intoNCMATComposer.ase: For loading crystal structures from ASE objects or non-CIF files (like those produced by Quantum Espresso) intoNCMATComposer.pymatgen/mp_api: Only needed for loading CIF data from the online database at https://materialsproject.org intoNCMATComposer.
Since release 3.0.0 we have provided the alias nctool for the command named ncrystal_inspectfile, and while we will keep providing both aliases, we now swap their role and primarily mention the name nctool in our documentation. There are not immediate plans to remove the ncrystal_inspecfile command, but users are encouraged to migrate to use the nctool command instead.
We introduce a new ncrystal_cif2ncmat command which internally uses the new CIF and NCMAT tools from the Python API, and which supports both local CIF files or remote online databases. This also obsoletes the ncrystal_onlinedb2ncmat command.
For more details, list of bug fixes, and so on, as usual visit the CHANGELOG.
Files
mctools/ncrystal-v3.6.0.zip
Files
(2.1 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:0688fe0c5dbb3348265a4ee7a1d753e0
|
2.1 MB | Preview Download |
Additional details
Related works
- Is supplement to
- https://github.com/mctools/ncrystal/tree/v3.6.0 (URL)