First attempt at making PowderN load NCMAT data directly via NCrystal#2371
First attempt at making PowderN load NCMAT data directly via NCrystal#2371tkittel wants to merge 8 commits intomccode-dev:mainfrom
Conversation
|
The “failed” test in I have a feeling this occurred in the context of a recent patch to the |
|
Nope. More like a dataset issue. Failed tests are numbers 17-24 with no simulation output and this stdout/stderr all relating to |
|
The AI explaining its commit ;-) Windows CI Workflow Improvements Problem: The mctest.bat executable was not being found or properly executed on Windows, resulting in exit code 127 (command not found). The build succeeded but the batch file generation or PATH configuration had issues. Solution: I've added comprehensive Windows-specific diagnostics and error handling to the workflow: Changes Made: Checks if mcstas and mctest executables exist after build completes Displays PATH and CONDA_PREFIX environment variables All mctest executions now include || { echo "..."; exit 1; } to prevent silent failures |
|
@tkittel the workaround to bypass |

Free-form text area
In consultation with @willend, this PR adds the capability for the PowderN component to accept NCrystal cfg-strings directly in the reflections parameter. When this is the case, NCrystal will be used during
INITIALIZEto load the reflection list (as well asV_0,sigma_a,sigma_i,at_nb, ...).So for instance, instead of
reflections="Al.laz", one can now writereflections="Al_sg225.ncmat", orreflections="Al_sg225.ncmat;temp=200K;dcutoff=0.5"or whatever else is supported in NCrystal cfg-strings. Note that the logic for detecting the reflections string as associated with NCrystal is that any string containing either the substring".ncmat"or the substring"::"is an NCrystal cfg-string. We might want to fine-tune this to e.g. allow a .laz file to be loaded with NCrystal for debugging. Although one could write"relpath::Al.laz"in this scheme to get that effect, it might be a bit too obscure.The idea is of course is that this makes it possible to leverage NCrystal as a source of materials also in cases where unique features of PowderN are needed (e.g. line broadening or GPU), and where features like the inelastic components of NCrystal are less important.
Other changes to the component:
double Epsilonfield from theline_datastruct, as it did not seem to do anything.ncrystal_ncmat2hklencoded values forsigma_iandsigma_ain barns/unitcell while PowderN interprets them as barns/atom. Ultimately this gives an error of a factor of natoms/unitcell. This will be fixed on the NCrystal side (see Wrong sigma_i/sigma_a in laz files from ncrystal_ncmat2hkl mctools/ncrystal#337), but the present PR also tries to make PowderN read such files correctly (irrespectively of whether the files were produced with the old or the futurencrystal_ncmat2hklversion).Development OS / boundary conditions
Please describe what OS you developed and tested your additions on, and if any special dependencies are required:
PR Checklist for contributing to McStas/McXtrace
For a coherent and useful contribution to McStas/McXtrace, please fill in relevant parts of the checklist:
My contribution includes patches to an existing component file
mcdocutility and rendered a reasonable documentation page for the component (please attach as screenshot in comments!)mctestutility to test one or more instruments making use of the component (please attachmcviewtestreport as screenshot in comments)mccode-clangformattool to apply the standard McCode component indentation schememcrun --c-lint"linter" and followed advice to remove most / all warnings that are raisedMy contribution includes patches to an existing instrument file
mcdocutility and rendered a reasonable documentation page for the instrument (please attach as screenshot in comments!)mctestutility to test the instrument (please attachmcviewtestreport as screenshot in comments)mcrun --c-lint"linter" and followed advice to remove most / all warnings that are raisedMy contribution includes a new component file
mcdocutility and rendered a reasonable documentation page for the component (please attach as screenshot in comments!)mccode-clangformattool to apply the standard McCode component indentation schemecontribcomponent categoryMy contribution includes a new instrument file
mcdocutility and rendered a reasonable documentation page for the instrument (please attach as screenshot in comments!)%Example:line to describe expected behaviourmcrun --c-lint"linter" and followed advice to remove most / all warnings that are raisedexampleshierarchy in a folder in the style ofexamples/ESS/New_stuff/New_stuff.instrexamplefolder, but if general use I have placed it in the globaldatafolder.My work touches the code-generator in mccode/src
My work touches / adds to the runtime lib code (.c,.h etc in multiple locations
My PR is meant to fix a specific, existing issue
My contribution contains something else