Replies: 2 comments 3 replies
-
|
Hi @nviolini , The cfg-strings should certainly work in any environment, so I can't really help you without further details. At the very least describe the process and provide a log file or screen shot of the error messages you get. |
Beta Was this translation helpful? Give feedback.
3 replies
-
|
Hi Thomas,
I could find this old email exchange and just replied to the last message.
Please find attached the ncrystal module code in vitess.
If you have questions, let me know and we can most likely meet today in the lobby.
Cheers

--
…-------------------
Nicolò Violini
-------------------
Jülich Centre for Neutron Science,
Jülich Forschungszentrum GmbH
Leo Brandt Strasse
52425 - Jülich Germany
-------------------
***@***.***
-------------------
phone: +49 02461 614036
fax: +49 02461 612610
cell: +49 (0)176 70785617
On 10. Dec 2024, at 19:03, Thomas Kittelmann ***@***.***> wrote:
@nviolini <https://github.com/nviolini> I am a bit confused about the way you are going about things. Adding NCrystal support to Vitess should hopefully not in general involve composing cfg-strings inside the new Vitess component itself. Rather, it is the general philosophy of NCrystal that the same cfg-strings can be used in a multitude of applications (e.g McStas, OpenMC, Geant4, standalone, etc.) to provide the same physics. Also, the ncrystal_samplescatterisotropic function is only for isotropic materials, which is not what you get when you use parameters like dir1, dir2, or mos. This is probably the difference between your C and Python cases, that you are using a C function which only accepts isotropic materials and a Python function which is also OK for anisotropic materials (since you failed to provide actual code samples, I am mainly guessing here).
In any case, all you should expose to the users concerning the NCrystal materials should be a string parameter, for the NCrystal cfg-string. Other parameters concerning geometric layout of your volumes etc. is something to be handled on your side, since NCrystal does not provide any sort of geometry tools.
Second, after you have initialised a material, during simulations you will need mainly the ncrystal_crosssection function to get the cross section (barns/atom) of both scattering and absorption, and then once you have determined that a scattering occurred you can use ncrystal_samplescatter to sample an outgoing neutron state. These functions handle both isotropic and anisotropic materials like single crystals.
I invite you to take a close look at how we have implemented the NCrystal_sample.comp McStas component, since it will probably give you a good idea of how you could approach this in Vitess:
https://raw.githubusercontent.com/McStasMcXtrace/McCode/refs/heads/main/mcstas-comps/contrib/NCrystal_sample.comp
Note that the NCrystal_sample.comp component only supports cylinder/box/sphere geometries. For more advanced geometries in McStas, one uses the
I am going on holidays today, but if you wish we could set up a zoom meeting in January to discuss this in more detail. We could perhaps also invite @willend <https://github.com/willend> and Klaus L. Additionally, be aware that at Julich you have Jose R. which could probably help you with advice on a lot of this :-)
Cheers,
Thomas
—
Reply to this email directly, view it on GitHub <#212 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BKGPEFUR7IOZ5NYUFV2GRND2E4UGNAVCNFSM6AAAAABTJALMWSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNJSGQZTINY>.
You are receiving this because you were mentioned.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Trying to integrate NCrystal into the Vitess codebase.
At the moment, the main issue is the following:
This string:
Ge_sg227.ncmat;temp=1C;dcutoff=0.5;mos=0.2deg;dir1=@crys_hkl:5,1,1@lab:0,0,1;dir2=@crys_hkl:0,-1,1@lab:0,1,0
works in python but fails in the Vitess C-environment.
When I cut it like this:
Ge_sg227.ncmat;temp=1C;dcutoff=0.5
it works in both envs.
Adding mos or dir options make it fail in C.
Is there a way to get from Ncrystal any errors checking, return errors or logs information?
This could help debug this situation.
Beta Was this translation helpful? Give feedback.
All reactions