v3.4.1 2022-10-19 * Expose utility for completely flattening a material composition to Python interface, as a new info.getFlattenedComposition() method. This is intended to better support materials with non-natural compositions in the OpenMC bindings. Internally, the new method is using the same machinery as what is already in place to provide the same functionality for the Geant4 bindings. * ncrystal_onlinedb2ncmat was not using new unified cmdline script machinery introduced in v3.4.0, which has now been corrected. v3.4.0 2022-10-12 * Modify location of CMake config files provided by an NCrystal installation, to hopefully make it easier for downstream projects to locate an existing NCrystal installation (more details on this MCPL issue: https://github.com/mctools/mcpl/issues/58). * Modify manner in which Geant4 bindings must be activated in downstream CMake code. Previously they were enabled via a dedicated "find_package(G4NCrystal)" call, but now they are instead provided as an optional COMPONENT when requesting the NCrystal package: "find_package(NCrystal COMPONENTS GEANT4BINDINGS )" and if succesful the downstream binaries must be configured to depend on the G4NCrystal interface by adding the NCrystal::G4NCrystal target as a dependency, i.e. "target_link_libraries( mybinary NCrystal::G4NCrystal )". The Geant4 bindings will not be enabled unless the GEANT4BINDINGS component is explicitly requested. * Unify manner in which shipped cmdline scripts look for NCrystal python module. v3.3.1 2022-10-06 * Fix info.getComposition() for multiphase materials in the Python interface. This issue is not believed to have affected many users, but a fix is crucial in order to support multiphase materials in OpenMC hooks which are currently being prepared (github issue #102). * Minor fix to make Geant4 hooks work with Geant4 release 11. Note that this is still not the long awaited major update which makes the hooks work with Geant4 in multithreaded mode. * Rewrote internal code in NCIter.hh to avoid usage of deprecated std::iterator. This avoids compilation warnings on newer platforms (github issue #100). * Reduce precision from %.15g to %.14g in output of ncrystal_ncmat2hkl to get reproducible results across platforms. v3.3.0 2022-08-23 * Updates to CMake code which is needed to support creation of NCrystal conda packages. * ncrystal_inspectfile now has --version and --versionnum arguments. v3.2.0 2022-08-11 * Introduce a new quick TextData factory for gas mixtures, supporting on-the-fly gas mixtures through cfg-strings like "gasmix::0.7xCO2+0.3xAr/2bar/30C". The format is rather flexible, and supports both mass and molar fractions, relative humidity, and has an alias for normal air ("gasmix::air"). See more details on the wiki: https://github.com/mctools/ncrystal/wiki/Announcement-Release3.2.0 * Introduce NCMAT v7 which adds a new optional @TEMPERATURE section to the format, allowing the default temperature value to be modified from the normal 293.15K, or even of locking the value at a certain value (attempts at modifying it via cfg variables will then fail). This is used by the new gasmix factory to error on the flawed but correct-looking "gasmix::CO2/2bar;temp=200K" (which is not the same as the correct "gasmix::CO2/2bar/200K"). Future developments might move the gas mixture support to the NCMAT format itself (rather than just in the pre-processing as now), which would solve the issue in a nicer way. * At the C++ level, a new fmt_frac function allows easy printing of floating point values which might be simple fractions, a dedicated Pressure type was added, and a minor issue with confusing error messages from NCMAT data from quick factories was addressed. v3.1.0 2022-06-29 * Introduce cfg parameter named "ucnmode" which can be used to enable a new dedicated modelling of UCN-production processes. Thus, appending ";comp=inelas;ucnmode=only" to a given cfg-string, will result in a scattering process which ONLY contains UCN-production events. Conversely, appending ";ucnmode=remove" will provide a process which contains everything EXCEPT UCN-production events. This splitup is intended to facilitate usage of biasing and variance reduction tricks when designing VCN or UCN moderators. The UCN threshold defaults to 300neV, but this can of course be modified. In addition to just facilitating a process splitup, the UCN-production process resulting from "ucnmode=only" is more precise (essentially exact) than the usual S(alpha,beta) treatment - which is rather precise in general, but currently contains some flaws when sampling events where the neutron loose almost all energy (see also next item). * Improve general (i.e. also when not running with special ucnmode) scattering-kernel based inelastic physics for the case where the neutron looses almost all energy. Specifically, the sampling of S(alpha,beta) near the kinematic endpoint is greatly improved. We still have additional plans for how to completely remove any artifacts related to the numerical processing, if manpower allows at some point in the future. * Add internal utilities for evaluating S(alpha,beta) kernels at any (alpha,beta) point, and add utilities for what is essentially exact sampling or integration for cross sections. These utilities are useful as they allow us to validate scattering kernel models better, and are used directly in the new UCN-production models. * Add notice to the ncrystal_preparemcstasdir for how to make it work when using NCrystal with the McStas-Union geometry system. * CMake now actually installs the "nctool" alias of "ncrystal_inspectfile". * S(alpha,beta) kernels hardcoded in .ncmat files will now have any null-edges discarded upon loading. This is often needed for kernels converted from ENDF files, where the alpha/beta grid is often larger than needed. * Add PiecewiseLinearFct1D utility class (for some reason we had utilities for cubic splines and sampling of piece-wise linear functions, but not for simple evaluations of them!). * Fix bug when accessing DynInfo of directly specified scattering kernels with the Python interface (the DI_ScatKnlDirect was missing a required initialisation). * The process summaries printed via ncrystal_inspectfile or accessed via the Python interface, now supports multiple layers of nested processes. This was required to support the new ExcludeUCNScatter process, which is implemented as a wrapper of two other processes. * Adding experimental and incomplete support for converting raw parsed NCMAT data to JSON. This is intended to help avoid the need for resorting to custom parsing code, but is clearly an expert-only feature as the data is presented as-is, without additional loading. v3.0.0 2022-04-24 * The NCrystal v3.0.0 release brings both major new features and technical improvements "under the hood", with around 19.000 lines of code changed in more than 300 files! The list of specific changes is too long to document here, but the following bullet points mention a few highlights as well as a select number of very specific technical details. For a more detailed and hopefully readable overview, please refer to the following page in the wiki: https://github.com/mctools/ncrystal/wiki/Announcement-Release3.0.0 Furthermore, we would like to encourage users to post questions concerning the new release (or anything else NCrystal related obviously) to the forum at: https://github.com/mctools/ncrystal/discussions * Support for multiphase materials. These can be defined in terms of phase volume-fractions, either in cfg-strings ("phases<0.9*Al_sg225.ncmat&0.1*Be_sg.ncmat>"), in NCMAT data, or a combination of those. All interfaces and tools have been updated to properly integrate multiphase materials, in a manner which is believed to not add complications when working with single-phase materials. * Framework-level support for Small Angle Neutron Scattering (SANS) physics. The release includes resources to facilitate future development of advanced SANS models, and already include a hard-sphere SANS model (useful both by itself, and as proof-of-concept for other models). * Material densities can now be easily modified. This can be done by either specifying a relative scaling, "Polyethylene_CH2.ncmat;density=0.9x", or an absolute one: "Polyethylene_CH2.ncmat;density=0.88gcm3" (g/cm^3) or "Polyethylene_CH2.ncmat;density=0.1perAa3" (atoms/Aa^3). * Support for quickly setting up unstructured materials with just a cfg-string and without a data file for such simple materials. For instance, a He3 gas might be defined via the cfg-string "freegas::He/0.17kgm3/He_is_He3". This makes it easy to add materials for which the structure is not deemed important (e.g. in a strong absorber). * The various new features can be combined for quickly settting up advanced materials. For instance, here is how to define a low-density polyethylene with enriched B4C pellets, even without a dedicated data file for B4C: "phases<0.99*Polyethylene_CH2.ncmat;density=0.8x&0.01*solid::B4C/2.5gcm3/B_is_0.95_B10_0.05_B11>" * Improve documentation of cfg-string parameters, with the code now able to provide dynamic documentation, which can be accessed either programatically (with the Python/C/C++ API or by running ncrystal_inspectfile --doc), or on the new wiki page: https://github.com/mctools/ncrystal/wiki/CfgRefDoc * Introduce for convenience a new cfg-string parameter "comp", which can be used to easily pick out one or more of the components contributing to the scattering cross section. For instance, appending ";comp=inelas" to any cfg-string (i.e. "Al_sg225.ncmat;comp=inelas"), will disable all components *except* inelastic models. * Reflection (hkl) planes provided by NCrystal are now grouped according to the symmetry-equivalency indicated by the space group. This has the benefit of drastically improving both the initialisation time and memory usage needed for hkl lists, and additionally makes it easier to use reflection lists from NCrystal with other software which often depends on such symmetry groupings. Additionally, ondemand loading for quicker inspection (e.g. --dump will be almost instantaneous even for the most complicated crystal structures), and by default only the 10 planes with largest dspacing is shown. * Improve and update McStas support: - Make NCrystal work with both the McStas v2.7 and McStas v3.0 branches. - Add ncrystal_ncmat2hkl cmd-line utility for converting NCMAT files to the .laz and .lau files needed by the McStas PowderN and Single_crystal components (note that this only includes Bragg diffraction, not inelastic/incoherent/SANS/multiphase physics for which direct NCrystal usage in the NCrystal_sample component or McStas-Union system is needed). - Utilities for better/easier integration between NCrystal and the McStas-Union system for complex geometries. * Remove the few optional files which were not copyrighted by the NCrystal developers, ensuring that the entire NCrystal release now has a single well-defined license (Apache 2.0). The removed files were used to support the semi-obsolete .nxs file format, and will still be available as a separately distributed plugin if really needed. * Stop supporting Python 3.5. Oldest supported Python version is now Python 3.6. * Introduce NCMAT v6 which adds a new optional @OTHERPHASES section to the format, allowing secondary phases to be defined via volume fractions and cfg-strings. * Remove NCMatCfg::isPolyCrystal which used to return the opposite of isSingleCrystal(). This was obviously misleading for non-crystalline materials. * Vector::normalise() now does nothing if the squared magnitude is already within 2 ULP's of unity. This is to avoid repeated calls to this function from inducing slight changes due to numerical inaccuracies in the normalisation process. * Add cyclical dependency detection in NCrystal factories to exit with clear error instead of deadlocking. This is in particular needed to handle cyclic dependencies in multiphase materials in which a phase is wrongly defined by recursively referring back to the top level material. * Type safe AtomData::captureXS in C++. * Add utilities for encoding data in JSON format, which for now is used to enable conversion of MatCfg objects as JSON objects. On the python side this means that a cfg-string can be decoded into a Python dictionary using the new decodeCfg function (a new encodeCfg function re-encodes this into a cfg-string). * Fix bug where scattering kernels generated on-the-fly from VDOS curves with vdoslux values less than 3 (the default) were subsequently treated to the "beta-thickening" procedure introduced in release v2.6.1. This procedure is now, as intended, only applied to externally provided kernels, since the on-the-fly generated ones already have an optimised grid layout. * ncrystal_inspectfile gets --energy/--liny/--logy/--xrange options to control more aspects of the generated plots. * Introduce an alias, nctool, for the ncrystal_inspectfile command (this is done in anticipation of a future actual renaming of the command). * Fix misleading @ATOMDB examples in NCMAT documentation where cohSL numbers for Si and Al were a factor of 10 off from realistic numbers, which might confuse users to think they have to use a unit of 0.1fm rather than fm for such numbers (github issue #77). v2.9.93 2022-04-21 * Release candidate #3 for release 3.0.0. * Detailed ChangeLog to come. v2.9.92 2022-04-10 * Release candidate #2 for release 3.0.0. * Detailed ChangeLog to come. v2.9.91 2022-03-02 * Release candidate #1 for release 3.0.0. * Detailed ChangeLog to come. v2.7.3 2021-09-09 * Add missing import statement in ncrystal_hfg2ncmat (github issue #71). * C++ API gets ekin2ksq and ksq2ekin utility functions. * Cleanup the PointwiseDist utility class and add new sampleBelow and commulIntegral utility functions * Add new internal IofQHelper utility class which can be used to implement elastic physics described via an I(Q) curve * Fix some obscure -Wshadow warnings on some rare platforms when some local variable named s or m clashes with global variables of the same name from Geant4. v2.7.2 2021-07-08 * Various compilation fixes, affecting only users of Geant4-hooks with the most recent Geant4 release (10.07.p02) or users with the rather outdated gcc 4.8.5 (github issue #69). v2.7.1 2021-06-17 * Fix single crystal alignment bug which was inadvertantly introduced among the many technical changes in release v2.5.0, essentially swapping the meaning of @crys: and @crys_hkl: in the parts of the cfg strings defining the crystal orientation. v2.7.0 2021-05-31 * Introduce NCMAT v5 which two updates for the format, both meant to facilitate modelling of amorphous (i.e. non-crystalline) solids. Firstly, Debye temperatures can now be specified directly in @DYNINFO sections of vdosdebye type, meaning that such sections can now also be used in non-crystalline materials where @DEBYETEMPERATURE sections are disallowed. Secondly, a new optional @STATEOFMATTER section can be used to explicitly indicate the state of matter if needed. If @STATEOFMATTER is not specified, materials with crystal structure or vdos curves are assumed to be solids, otherwise the state will be undefined. Amorphous solids will currently get both inelastic and elastic physics determined from the VDOS curves - with coherent components approximated via the incoherent approximation. * Improve HKL plane initialisation code to make it 200% faster (i.e. a factor of 3 speedup)! This was mostly achieved by using our own custom sin+cos implementations, which are much faster than the standard ones, but with no impact on precision. As a result, the heuristics picking a default dcutoff value were updated so that structures with more than 40 atoms per unit cell now defaults to dcutoff=0.2Aa, as opposed to dcutoff=0.25Aa before (the default value for other materials remain dcutoff=0.1Aa). * Add ncrystal_hfg2ncmat script for convenient production of NCMAT files for hydrogen rich amorphous materials, based on concept and data from Romanelli et. al. (2021), https://dx.doi.org/10.1088/1361-648X/abfc13 * Add ncrystal_onlinedb2ncmat script for creating materials with crystal structure taken from online databases (materialprojects.org or Crystallography Open Database). The script also has options for copying material dynamics from existing .ncmat files, and for verifying that NCMAT files containing comments containing specific links to entries in these databases, actually contain those structure (by overlaying Bragg cross section curves). Internally the script uses the Python Materials Genomics (pymatgen) Python module to access the online databases. * Add ncrystal_verifyatompos script for verifying that the list of @ATOMPOSITIONS in an .ncmat file is consistent with the indicated @SPACEGROUP number. Internally the script uses the Atomic Simulation Environment (ASE) Python module to handle the symmetries. * Add 16 new amorphous materials. Most are created with the ncrystal_hfg2ncmat script: Epoxy_Araldite506_C18H20O3 Kapton_C22H10N2O5 Nylon11_C11H21NO Nylon12_C12H23NO Nylon610_C16H30N2O2 Nylon66or6_C12H22N2O2 PEEK_C19H12O3 Polycarbonate_C16O3H14 Polyester_C10H8O4 Polylactide_C3H4O2 Polypropylene_C3H6 Polystyrene_C8H8 PVC_C2H3Cl Rubber_C5H8. The material Polyethylene_CH2.ncmat is not created with the ncrystal_hfg2ncmat script (although it could have been), but is instead based on phonon DOS curves provided by Kemal Ramic from the ESS Spallation Physics group, (based on modelling with Phonopy, VASP and OCLIMAX software). Finally, AcrylicGlass_C5O2H8.ncmat (a.k.a. "Plexiglass" or "Lucite"), is based on a VDOS curve used in ENDF/B-VIII.0 due to Petersen, et. al. (NCSU)., as it gave a slightly better fit to experimental data. * Add CaSiO3_sg2_Wollastonite.ncmat. The main motivation for adding this is that our library should contain at least one triclinic material, to make sure we exercise all code paths. For now, the material does not have VDOS curves and the dynamics are described via the Debye model. * Thanks to work by K. Ramic and J. I. Marquez Damian from the ESS Spallation Physics group under the HighNESS EU project, a massive number (64) of new crystalline materials are added to the data library, which along with the 16 new amorphous materials brings the number of material files shipped with NCrystal to a whooping total of 131! Additionally, VDOS curves were added for 4 existing materials so that now only two crystalline materials (gamma-calcium and wollastonite) in the entire library have dynamics based purely on the less accurate Debye model. The 64 new crystalline materials are mostly polyatomic materials of interest to the wider community of nuclear scientists, neutronics, and neutron scattering instrumentation. All these materials come fully described with both crystal structures and phonon VDOS curves, and have been carefully validated. Crystal structures are mostly taken from the Crystallography Open Database and the Materials Project, with most structures verified by verification against multiple DB entries (using the ncrystal_onlinedb2ncmat script). The VDOS curves are mostly based on calculations with Phonopy and OCLIMAX software with input files from the Phonon database at Kyoto university (http://phonondb.mtl.kyoto-u.ac.jp/). VDOS curves for two materials, magnesium hydride (MgH2) and magnesium deuteride (MgD2), were provided by Davide Campi and Marco Bernasconi from University of Milano-Bicocca, based on DFPT calculations with the Quantum-ESPRESSO package. All materials were validated against total cross section curves where available, VDOS curves were verified to be in agreement with experimentally measured heat capacity curves, predicted material densities were verified to be in accordance with known densities, and crystal symmetries were verified with the ncrystal_verifyatompos script. * Files for a few existing materials (SiLu2O5, UO2, SiO2) were renamed for consistency, and Crystallography Open Database reference numbers were added for all existing crystalline files. * Fixed bug where some hkl planes slightly above the d-spacing cutoff were left out of the final calculated list. Cubic, tetragonal, and orthorombic space groups were not affected by this bug, and since our default d-spacing cut off value is rather low, the effect was in any case unlikely to have affected many users. * Fixed bug where some hkl planes could very rarely be left out in crystals containing elements with negative coherent scattering lengths. It is not believed to be likely that this bug has affected any users, but a few of the new materials would have been affected. * Updated calcium scattering lengths due to improved measurements, Palomino et al. (2019), DOI:10.1016/j.nima.2019.02.072. This was implemented as a modification of b_coh for natural Ca and the dominant isotope Ca40, increasing the values of both b_coh parameters by roughly 23%. * NCrystal.directMultiCreate now works with NCrystal.TextData objects. * Improve wrapping and indentation in code produced by the Python formatVectorForNCMAT utility function. * Add --stdout option to ncrystal_vdos2ncmat for easier usage in scripts. * Small fix for NCMAT parser which previously allowed multiple entries in @DENSITY section. * Add unofficial mechanism for removing certain contributions when expanding a VDOS to a scattering kernel. This is primarily intended to allow people working on plugins with detailed coherent physics to avoid double-counting by making it possible to exclude components otherwise created based on the incoherent approximation. The mechanism is implemented via the @CUSTOM_ support in NCMAT data, and it should be understood that files with such sections are always considered "under development", and unlikely to be suitable for general usage. * Expose VDOS analysis utilities from NCVDOSEval.hh to Python and C interfaces. In Python this is available both as a global analyseVDOS function, and as a member function in DI_VDOS objects. Return value is a dictionary with quantities derived from the VDOS curve: Debye temperature, mean-squared-displacements, effective temperature, etc. * Rename Python crossSectionNonOriented method to crossSectionIsotropic for consistency, keeping crossSectionNonOriented as a backwards compatible alias. * Fix python NCrystal.atomDB method where some situations of querying for unknown isotopes would always result in an exception even when called with throwOnErrors=False (github issue #65). * Type safe VDOSEval::elementMassAMU in C++. * Conversion from shared_obj to pointer T* in C++ is made explicit to avoid footgun "const Info* info = NC::createInfo(..)". The footgun is still available for references (const Info& info = ...), but that is a necessary tradeoff since the implicit conversion to a reference is so useful when passing shared objects to functions taking reference parameters. v2.6.1 2021-05-03 * Workaround for numerical artifacts in inelastic cross sections arising from low-granularity beta-grids. In practice this affected materials which either used hard-coded low-granularity scattering kernel, or those with phonon VDOS curves that had large empty regions (often the case for hydrogen VDOS curves in materials with C-H bounds). The workaround for external low-granularity kernels consists of a simple "thickening" of the beta-grid, while the workaround for VDOS-based kernels consists in modifying the beta-grid generation code to ensure points are inserted into any large gaps in the single-phonon region. v2.6.0 2021-04-05 * Introduce NCMAT v4 which introduces a few new features, as described in detail in the ncmat_doc.md file. The most important new feature relies on the fact that it is possible to estimate atomic mean-squared-displacements directly from a phonon density of state distribution (VDOS), meaning that it is now allowed (and actually recommended) to skip @DEBYETEMPERATURE's for crystalline materials where atoms have VDOS curves available). This is not only useful, but improves low-temperature reliability of the Debye-Waller factors used in the elastic scattering components. This development was helped by Kemal Ramic and Jose Ignacio Marquez Damian from the ESS Spallation Physics group, and more details are available in the ncrystal GitHub issue #58. The other new feature in NCMAT v4 is a new optional syntax for the @CELL section, which allows more compact specification for certain crystal systems (in particular cubic systems). * The vast majority of crystalline materials in the NCrystal data library were updated to take advantage of the new features, and in addition the number of VDOS curves was increased dramatically, meaning that the dynamics in almost all crystalline materials are now described using actual VDOS curves rather than just Debye temperatures. * Missing VDOS curves for all elements in beryllium-fluoride (BeF2), aragonite (CaCO3), cuprite (Cu2O), periclase (MgO), and quartz (SiO2) were provided by Kemal Ramic from the ESS Spallation Physics group, based on modelling with Phonopy, VASP and OCLIMAX software. * Missing VDOS curves for 14 mono-atomic materials were added (fixing github issue #39): Au, Ba, Cr, Mg, Mo, Na, Nb, Pd, Pt, Rb, Sc, Sn, Y, and Zn. Refer to comments in the individual NCMAT files for references concerning the origin of these curves. * Missing VDOS curves were added to uranium oxide (UO2), taken from DOI:10.1103/PhysRevB.102.134312. Note that UO2 NCMAT files with VDOS tuned for specific temperatures are available (refer to comments in the UO2 NCMAT file for details). * All existing files with VDOS have been update to NCMAT v4, and had @DEBYETEMPERATURE sections removed in order to benefit from the better performance of getting the atomic displacements from the VDOS. * Added new material: gamma-Iron (Fe_sg225_Iron-gamma.ncmat) with VDOS curve. At the same time, the not particularly useful beta-Iron file was removed, so the NCrystal data library now contains both alpha- and gamma-iron, both with VDOS curves. * Expose debyeIsotropicMSD and debyeTempFromIsotropicMSD functions from NCDebyeMSD.hh header to C and Python, allowing conversions between atomic mean-squared-displacement and Debye temperature. * Improve robustness of the function debyeTempFromIsotropicMSD. Previously the internally deployed root-finding algorithm could fail under some scenarios (e.g. non-ultra cold rubidium). * Various improvements for ncrystal_vdos2ncmat. * Compilation fix for pre-Catalina OSX where the aligned_alloc function is apparently missing. * Fix bug where early calls to removeAllDataSources could get reverted by subsequent plugin loading. * Before defining macros in public headers, check if present already and if so undefine. v2.5.81 2021-04-01 * RC2 for incoming release v2.6.0. v2.5.80 2021-03-25 * RC1 for incoming release v2.6.0. v2.5.0 2021-03-21 * The NCrystal v2.5.0 release brings major technical improvements to NCrystal "under the hood", with around 15.000 lines of code changed in more than 200 files! Although massive, the changes are mostly technical in nature and mainly affects the C++ API, so people using NCrystal in another way (e.g. through Python, C, Geant4, McStas, ANTS2, ...), should still find that everything keeps working as before - although perhaps with slightly improved performance and with a few new useful function having been added to the Python/C API's. * The list of specific changes is too long to document here, but we have tried to provide a high-level overview of the developments in the wiki, so please find additional information at: https://github.com/mctools/ncrystal/wiki/Announcement-Release2.5.0 v2.4.81 2021-03-16 * RC2 for incoming release v2.5.0. v2.4.80 2021-03-15 * RC1 for incoming release v2.5.0. v2.4.0 2020-12-17 * Properly support delivery of NCMAT data files from plugins. For clarity, and to avoid name clashes, such data files must follow a clear naming scheme "ncplugin-_*.ncmat". The mechanism for making the data files available will depend on how the plugin is used, and is of course automatic. For a static plugin, built into a given NCrystal installation, the data file will be installed along with all of NCrystal's own data files (either as physical files or compiled into the NCrystal library, depending on the NCrystal configuration). For a dynamic plugin, built separately and later loaded by adding the plugin's shared library to NCRYSTAL_PLUGIN_LIST, the data file will be compiled into the plugin library. Finally, for plugin developers, the data files will be made available via a symlink, ensuring that it is possible to directly edit the data file during development. * Support (on unix) relative paths in NCRYSTAL_PLUGIN_LIST. * Add option to ncrystal_ncmat2cpp for injecting include statements in generated code. * Plugin developers can now also see their test .ncmat files in the list provided by ncrystal_inspectfile --browse. * Export more information to client cmake projects. v2.3.1 2020-12-17 * Small bugfix fixing the loading of dynamic plugins. * Ensure plugins are loaded before file searching is carried out. This allows plugins to register in-memory files. v2.3.0 2020-12-11 * Replace span class with a fully home-grown solution. This means that all core NCrystal code is once more fully available under the primary license (the Apache 2.0 license). * Cfg parameters scatfactory and absnfactory now supports exclusion of specific named factories. This is used to (by default) exclude current factory from consideration when globalCreateScatter/Absorption is invoked from a factory (github issue #51). * Replace the '$(ncrystal-config --setup)' idiom with one which works also when entries in PATH contains spaces: 'eval $(ncrystal-config --setup)' (github isse #52). * Rename internal radius variable in McStas sample, to avoid clashes with component parameter (apparently this gave issues for McStas 3.0). v2.2.2 2020-12-11 * Bugfix for system-wide installations. Input files were accidentally opened in RW mode rather than just readonly, causing permission errors when user invoking NCrystal did not have write-permission to the input file. Thanks to the McStas crew for noticing this. v2.2.1 2020-12-02 * Bugfix restoring support for .nxs/.laz/.lau files which was accidentally disabled in v2.2.0. * Modify CMake code slightly to avoid warnings or unset CMAKE_BUILD_TYPE under certain conditions where NCrystal is included as a sub-project. v2.2.0 2020-12-02 * Support plugins (github issue #50)! Such plugins can be externally developed (for instance on GitHub), and either loaded dynamically at run-time by NCrystal or statically compiled into the NCrystal library (see the next item). How to use or develop plugins is described in more detail at https://github.com/mctools/ncrystal/wiki/Plugins . * Major revamp and modernisation of CMake configuration code. Client code can now find NCrystal via find_package statements (github issue #45), which makes an NCrystal::NCrystal library target available. Geant4-code needing the Geant4-NCrystal hooks must instead search for G4NCrystal with find_package and add a dependency on the G4NCrystal::G4NCrystal target. The new CMake code also facilitates static inclusion of externally developed plugins (if for some reason this is preferred to dynamic loading of the plugins). NCrystal now requires CMake 3.10. A side-effect of the modernised CMake code is that installation directories are affected somewhat. * Add ncrystal-config script which can be queried for details about a given installationn, or even used to setup the user environment by typing $(./path/to/ncrystal/installation/bin/ncrystal-config --setup) in a shell. The installed setup.sh file now simply wraps such a call. A side-effect of the work on ncrystal-config and CMake is that NCrystal installations are in general more relocatable and should continue to function even if the installation directory is moved. * Officially stop support of Python2 (github issue #48). Python2 (and many major Python projects) had EOL January 2020, and PyPI (aka pip install) has announced end of support for Python2 by January 2021. Users needing to use NCrystal with Python2 will have to stick with NCrystal release v2.1.1. * Add support for NCRYSTAL_DATA_PATH variable, checked after NCRYSTAL_DATADIR env. var and NCRYSTAL_DATADIR preprocessor definition (github issue #49). * Add ability to browse a list of available .ncmat files (of course only those in the current working directory or search path). Can for instance be accessed via "ncrystal_inspectfile --browse" (github issue #5). The same tool can also --extract content of available files, and display available plugins with --plugins. * Fix Python interface cleanup-order bug where __del__ method could refer to an already removed ctypes module at programme shutdown. * Fix silly bug where W was left out of the alphabet in a few places. * Fix big affecting printing of MatCfg objects with in-memory datafiles. * Remove obsolete functions naturalElementDB and naturalElementDBByName from Python interface (use the atomDB function instead), and update the ncrystal_endf2ncmat script to work with new atomDB interface. * Modernise C++ code, preventing raw new/delete usage and associated memory management woes. RCHolder objects can be automatically converted when possible (to const ptr or base class ptr), and add makeRC / castRC / static_castRC functions, similar to std::make_unique and std::make_shared, but for instantiating classes derived from RCBase directly into an RCHolder object. Apply new features throughout codebase, and fix a slew of compilation warnings (mostly for clang12 or gcc 4.8). * Add DynLoader utility class for dynamic loading of shared libraries and access to contained functions (used for dynamic plugin loading). * Add common utilities for reading environment variables. * Add ncglob function for file globbing. * Add FactoryBase::combineScatterObjects helper method to encapsulate the workarounds still needed in custom scatter factories. v2.1.1 2020-11-07 * Reverse minor change in NCDefs.hh, which meant that client code which was including public NCrystal C++ headers was prevented from using constants like M_PI and friends (of course, usage of such constants is not portable, and thus not really recommended). Release 2.1.1 is otherwise completely identical to release 2.1.0. v2.1.0 2020-11-06 * Introduce the NCMAT v3 format, which supports @ATOMDB (github issue #21) and @CUSTOM_ sections (github issue #42). As usual, the file docs/ncmat_doc.md documents the new format in detail. * With the @ATOMDB section (and the related configuration parameter named atomdb, documented in NCMatCfg.hh), it is now possible to configure atomic compositions in a highly flexible manner. Thus, both enriched elements and impurities/dopants are now supported, and physics constants such as neutron scattering lengths can be overridden from the data file -- but most users will likely find plenty of materials in the internal database. This internal database has now been expanded with 261 isotopes in addition to the natural elements previously included (note that the constants for some natural elements have received slight tweaks for consistency). * The @CUSTOM sections provides a way to embed custom data in NCMAT files and having it end up on the Info object (accessible from C/C++/Python). This is mainly intended for people working on extending NCrystal with custom or experimental physics models, who need a mechanism for providing the extra data. Note that by default NCrystal emits warnings when loading NCMAT files with @CUSTOM_ sections. This is because files with such sections are by their very nature associated with custom code development, and therefore can not be expected to provide consistent physics if shared with a wider community. It is possible to silence these warnings, via the C++ API or an environment variable. * Support for using in-memory NCMAT data (github issue #20). This makes it possible to initialise materials from dynamic string-data in C++/Python/C, rather than needing on-disk files. * Add script ncrystal_ncmat2cpp which can be used to convert NCMAT files to C++ code which embeds the data directly in a binary, using the the new feature for in-memory NCMAT data. * Add CMake installation option for embedding the shipped .ncmat data files into the NCrystal shared library. Enable via CMake configuration flag -DEMBED_DATA=ON. The files are still accessible via their usual names in NCrystal cfg strings, e.g. createScatter("Al_sg225.ncmat") will still work, even if there will be no physical Al_sg225.ncmat file installed. * Added advanced C++ example which shows how it is possible to customize NCrystal and add a new physics model. The example also use the new features for in-memory files and @CUSTOM_ section in .ncmat files. The example is in the file examples/ncrystal_example_customphysics.cc (which compiles to the executable bin/ncrystal_example_customphysics when installing via CMake). * The internal database of elements and isotopes is now accessible also in the C and Python interfaces. In Python, one can iterate through all entries using the new module-level function named iterateAtomDB, or extract specific entries using the new module-level function named atomDB. The latter accepts either Z and A values, or strings such as "Al", "He3", etc. * The Python-API is made slightly more convenient, by equipping the Process and Scatter classes with new methods named xsect and genscat. These methods optionally accepts neutron wavelengths (by the wl parameter), and will delegate the calls to oriented and non-oriented functions depending on whether the parameter named direction was provided. * Various other improvements were done for the Python interface as well: AtomInfo, Compositions, and all Debye temperature methods are now accessible as well, there are now functionality for efficiently generating large amount of oriented scatterings, and finally all classes and methods now have proper doc-strings. * Various improvements were carried out in the C++ code: removed obsolete __cplusplus >= 201103L precompiler checks, added more string utility functions, made wl2ekin and ekin2wl constexpr, made createInfo(..) multi-thread safe, added NCRYSTAL_API macro to new classes and functions (including those introduced in v2.0.0). Remove custom UniquePtr class in favour of std::unique_ptr from C++11. Improve RCHolder class (*,-> overloading, move semantics). * Fix radian->degree conversion in the plot of scatter angles versus wavelength provided by ncrystal_inspectfile (it was multiplying by 57 instead of 180/pi which is 0.5% off). * Support the rare use-case of wanting HKL structure factors calculated with Debye-Waller factors forced to unity (github issue #22). Setting the NCRYSTAL_FILLHKL_FORCEUNITDEBYEWALLERFACTOR environment variable will now result in just this. * Parsing of NCMAT v1 files now more strictly adheres to the specification, and does not allow comments except as full-line comments before the first data section. * Info dumps will now detect and display simple fractions in atomic positions (e.g. "1/3" instead of "0.666667"). This only happens for denominators <=64 and for exact matches at full double-precision. * Internal NCrystal header files are now exposed in the internal sub- directory (github issue #46) with include statements like #include "NCrystal/internal/NCMath.hh" . These are meant to facilitate experimental development of new features, and are not guaranteed to present a stable API. They also do not in general contain NCRYSTAL_API statements needed for symbol visibility in certain builds. v2.0.0 2020-08-13 * Milestone 2.0.0 release! * The main feature of this release is that it finally brings proper state-of-the-art inelastic physics to NCrystal. Additionally, also incoherent-elastic scattering was cleaned up and made self-consistent, so NCrystal v2.0.0 can truly be said to be the release in which NCrystal finally moves beyond its former focus on Bragg diffraction. Additionally and also for the first time, NCrystal can now support the modelling of certain non-crystalline materials (e.g. liquids). * The actual changes between NCrystal v1.0.0 and v2.0.0 took place in ~500 commits touching several hundreds of files, and are far too vast to list here in detail. However, the release announcement page for NCrystal 2.0.0 attempts to provide a short summary of user-facing changes concerning physics capabilities, the materials data library, and the syntax of NCrystal configuration strings: https://github.com/mctools/ncrystal/wiki/Announcement-Release2.0.0 * A few technical details warrent highlighting here though as they potentially impact deployment: Firstly, NCrystal now requires C++11 or later for compilation, the older standards C++98 and C++03 are no longer supported. Secondly, in order to support C++11, the standard NCrystal CMakeLists.txt file now requires CMake 3.1.0 or later (as opposed to the previous requirement of CMake 3.0.0). Finally, in order to backport std::span from C++20 for internal usage in NCrystal code, a single file (NCSpan.hh) is for now covered under the Boost Software License (the license text is included in the file NCSpan.hh itself). This license is even more permissive than the Apache 2.0 license which still covers the rest of the core NCrystal code, and as such this should not add any new licensing burdens to users. v1.99.1 2020-08-11 * Release candidate number 1 for the new major release v2.0.0. The only difference between this release and the release v2.0.0 is in a few pieces of documentation and changed wording in an error message. Thus, for all practical purposes it is identical to release v2.0.0. v1.0.0 2019-07-05 * Milestone 1.0.0 release! * Introduce new optional modelling of more realistic energy transfers in inelastic scattering which can be enabled by setting bkgd=phonondebye:modeldeltae. This feature is still to be considered highly experimental and unvalidated. * C-buffer length fixes for gcc 8.2.0. * Prefer importlib.import_module rather than exec in ncrystal_inspectfile v0.9.19 2019-02-19 * Default value of sccutoff parameter is moved slightly down, from 0.5Aa to 0.4Aa and to make the effect less complicated, fsquared values are no longer taken into account. The effect of the change is very small, influencing the single crystal mosaicity distributions slightly for neutrons with wavelengths below 1Aa. v0.9.18 2019-01-24 * SPACEGROUP field is now optional in .ncmat files (but is always provided in all official ones). * The loadNCMAT function now accepts std::string for convenience. v0.9.17 2019-01-11 * Change source for Quartz data file (results in small numerical changes only). * Add new datafile for Sodalite. * Updated year in copyright notice in all files. v0.9.16 2018-12-18 * Fix small mistake preventing compilation of McStas component. v0.9.15 2018-12-18 * Add three new materials, expanding coverage of data library: Uraninite, Aragonite and SiLu2O5. * Lower default dcutoff value for most .ncmat files to 0.1Aa, in response to validation plots of Uraninite. * Updated year in copyright notice in all files. * Laz/Lau file loader now deals correctly with missing lattice_b/lattice_c parameters, and performs sanity checks in all cases. * Provide convenience functions/methods to Info objects, providing d-spacing of a given hkl value. * FillHKL use numerically stable summation when calculating structure factors. * Add NCrystal version printout from the NCrystal_sample component in McStas. Also sanity check the header file and library versions found. * Add NCDebyeMSD utilities for getting mean squared atomic displacements in the Debye model and use in .ncmat factory (to replace isotropic Debye/Glauber model everywhere for consistency). * For cosmetic reasons, avoid signed negative zero in atomic positions. * Minor updates to .ncmat files (mostly cosmetic or rounding of numbers). v0.9.14 2018-10-17 * Minor change in Geant4 interface to support Geant4 10.4 and later releases. v0.9.13 2018-09-27 * Stop shipping hand-written .nxs files. Instead, attempt to auto-generate .nxs files from all shipped .ncmat files, and where possible ship those. This is done in order to ensure greater consistency and a lower burden of maintenance moving forward. During this process a few issues were found with Wyckoff positions in a few .nxs files, which should now be fixed by the new procedure. * Changed dcutoff for crystals with complex unit cells (like yttrium oxide) from 0.4Aa to 0.25Aa when loading from .ncmat. For all other .ncmat files in our data library, the value stays at 0.15Aa. * Fix LCBragg error in case of the double degenerate case where both neutron and lcaxis are parallel to (0,0,1). * Faster fillHKL function, in particular for very small dcutoff values. * The fillHKL function now supports the NCRYSTAL_FILLHKL_IGNOREFSQCUT environment variable, which can be used to disable the fsquarecut entirely. * Increased numerical stability in structure factor summation during PCBragg initialisation. * Phase out usage of non-standard constants like M_PI. * Increase MC overlay safety factor slightly for LCBragg scatter generation. * Improve colors and linestyles in ncrystal_inspectfile script. * LCBraggRef models use numerically stable summation. v0.9.12 2018-08-28 * Fix GaussMos cache-polution bug, where planes with similar d-spacing but different Fsquared could get wrong Q-factor in single crystals with large mosaicity. * Fix uninitialised variable in NCMatCfg.cc, affecting only floating point parameters not supporting units. * Allow re-seeding of the RandXRSR fallback RNG. * Add McStas example instrument file. * More checks for invalid geometry parameters in the McStas component. v0.9.11 2018-08-18 * Mark API functions and classes in an attempt to support Windows DLL builds and UNIX builds with -fvisibility=hidden (see github issue #17). * Add missing include in NCPCBragg.cc. v0.9.10 2018-08-15 * This release represents a large amount of work in many areas, and in particular focusing on aspects of Bragg diffraction in single crystals. * The Gaussian mosaicity modelling code was completely reimplemented, going back to the fundamental equations and making sure everything is carried out in a consistent and precise manner. Cross-section evaluation automatically selects between efficient numerical Romberg integrations and evaluation of new improved closed-form expressions, which takes the relevant spherically geometric into account. The code thus now gracefully handles everything from backscattering to forward scattering scenarios, and a large dynamic range of mosaicities, covering at least a range of 0.01arcseconds to tens of degrees. Despite this, computational speed is also improved, thanks to various enhancements and in particular faster code for searching through the available plane normals. A new parameter, mosprec, can be used to tune the tradeoff between precision and speed. The default value of 1e-3 is likely adequate for almost all users. * Introducing a completely new and precise modelling of layered crystals, with the LCBragg class. This class, primarily intended to be used for modelling of Pyrolythic Graphite, by default takes the rotational aspects of such crystal into account using an from-first-principles approach to figuring out which sets of normals will contribute to the scattering cross-sections, and then finding the exact contribution through efficient numerical integrals. A crystal is considered to be a layered crystal if it has the lcaxis vector parameter set. Additionally, the lcmode parameter can be used to select slower reference parameters, which simply sample an SCBragg single-crystal instance many times, in different rotated systems. * Huge speedup when modelling low-wavelength (<1Aa) neutrons in single crystals: Approximate the very large number of very weak and uninteresting scatter planes at 2*d-spacings < 1Aa with an isotropic mosaicity distribution, which is a rather appropriate approximation due to the very large number of very weak planes involved. The cutoff value of dspacing=0.5Aa can be modified with the new sccutoff parameter. * Bragg diffraction in powders and polycrystals was never slow, but the PCbragg class was nonetheless rewritten to become even faster by working on energies directly, avoiding internal conversions to wavelength at each call. * Embedded an NCRYSTALMATCFG[lcaxis=0,0,1] statement in the data file C_sg194_pyrolytic_graphite.ncmat, so that it will by default be modelled as a layered crystal with the correct rotation axis, which is likely what almost all users will want. * Calling generateScattering where cross-sections are vanishing now generally leads to nothing happening (i.e. scatter_angle = 0 and delta_ekin=0) rather than the previous fallback of isotropic elastic scattering. * Retire RandSimple and introduce instead RandXRSR implementing the xoroshiro128+ generator. This means that the fall-back RNG option shipped with NCrystal is now not only fast, but also fully suitable for scientific work. * Fix bug in the NCrystal McStas component which resulted in wrong attenuation factors being calculated for the default absorption mode. * Changed the conversion constants used in the McStas component in order to make unit conversion issues in the NCrystal-McStas interface less likely to produce undesired imprecision. Further discussions with McStas devs will be needed in order to completely address the issue. * Code creating lattice rotation matrices was updated in order to avoid small rounding errors in the generated normals in most cases. * More sanity checks and input pruning of atomic positions and lattice structure loaded from input files. Also improved robustness of .nxs file loading. * Remove spurious ref-count increase in CalcBase::setRandomGenerator (thanks to A. Morozov for the report). * Fix windows builds (see github issue #17). Many thanks to A. Morozov for a detailed report. * Many general infrastructure improvements: Refactor random sampling algorithms from CalcBase objects (a necessary step for future enhanced MT support). Refactor orientation code from SCBragg (now used by both SCBragg and LCBragg). Refactor .ncmat loading code to disentangle the parsing code from the code. Lots of new utilities: Cubic splines, Romberg integration, root finding, derivative estimation. Single header NCDefs.hh providing all ubiquitous definitions and infrastructure related to memory handling and error reporting, and also handles includes which must get special treatment due to differences between platforms or C++ versions. Add UniquePtr (similar to C++11's unique_ptr). Add PlaneProvider (supported in PCBragg, SCBragg, LCBragg), for customizing which planes goes in which process. Avoid bind1st usage as it is removed in C++17. Custom functions for evaluating sine and cosine of angles in various ranges - between 5-10 times faster than the standard functions at 15 significant digits. Also add fast approximations for atan and exp. Performed careful changes to ncmin and ncmax functions with large performance implications (surprisingly, std::fmax generates very inefficient machine code: https://godbolt.org/g/Dxy52A ). Add helper class for efficiently generating sine and cosine values for all grid-points in a grid. PCBragg supports more custom constructors. v0.9.9 2018-03-26 * Expose loadNCMAT function to client C++ code, making it possible to work with .ncmat files completely independent from the factory infrastructure. * Cleanup internal .ncmat loading code, splitting out fillHKL to a new utility file and renaming old loader code to be purely a parser. * Allow Wyckoff positions and mean-squared-displacement parameters on NCInfo. * Rename standard factories to stdnxs, stdncmat, stdlaz, stdscat and stdabs respectively. * Allow factory-specific parameters to be passed along to info factories. Thus, expandhkl which was until now a global NCMatCfg parameter, is now a parameter specific to the stdncmat factory. The stdnxs factory gets two flags: mcstaslike and fixpolyatom. The former makes nxs-provided bkgd curves use same composition as in the McStas nxs component (the default is to compose as in NXSG4). * Remove polyatom fix in wrapped nxslib code, so bkgd=external xs curves for .nxs files are now completely as in NXSG4, apart from the fact that our version contains fixes for crashes (reported upstream). * Rename NonOrientedScatter to IsotropicScatter. * Fix compilation error under some compilers in NCRCBase.hh. v0.9.8 2018-03-19 * Decouple PhononDebye background cross-section code from .ncmat format, making it the new default also for .nxs files. For .nxs files, it is still possible to select the old behaviour of using curves provided by nxslib itself by configuring those files with "bkgd=external". A side benefit of this splitout can in some cases result in significant faster initialisation times when working with .ncmat files. * Major cleanup and renaming of configuration variables, in preparation of the 1.0.0 release milestone. The renames are: "mosaicity"->"mos", "orientationprimary"->"dir1", "orientationsecondary"->"dir2", "orientationtolerance"->"dirtol", "packingfactor"->"packfact", "dcutoffupper"->"dcutoffup", "scatterbkgdmodel"->"bkgd", "scatterfactory"->"scatfactory, "absorptionfactory"->"absnfactory" and "skippbragg" becomes "bragg" but with opposite logic, e.g. "bragg=0" disables Bragg diffraction. Removed entirely was the variables braggonly (use "bkgd=none" or "bkgd=0" instead now) and "nphonon". Experts can now instead tune parameters for specific background models by embedding them in the "bkgd" parameter value itself, e.g. "bkgd=phonondebye:nphonon@20". * Temporarily disable single-crystal speedup code while we investigate further, due to concerns that it is too aggresive (see github issue #13). v0.9.7 2018-03-06 * Don't produce floating point exception when loading .ncmat files with H, Li, Ti, V or Mn (github issue #8). * McStas component now actually applies requested packingfactor for powder materials (github issue #9). v0.9.6 2018-02-07 * Fix visualisation of box-shaped sample in McStas component. * Rename McStas component parameter multscatt to multscat. v0.9.5 2018-02-05 * Add support for python3 (github issue #6). v0.9.4 2018-01-31 * Correct version numbers. v0.9.3 2018-01-31 * NCrystal_sample.comp (McStas interface): Fix link flags on OSX (github issue #3) and compilation warnings (github issue #4). v0.9.2 2018-01-23 * Fix cross-section and material composition bugs in Geant4 interface. Only affects Geant4 users. * CMakeLists.txt: Always use absolute rpath (needed on OSX). * Fix gcc7 compilation. v0.9.1 2017-08-30 * Proper behaviour of python interface if Numpy is absent. v0.9.0 2017-08-30 * First github based public release of NCrystal.