McStasMcXtrace / McCode

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.
https://github.com/McStasMcXtrace/McCode/wiki
GNU General Public License v3.0
77 stars 54 forks source link

Algorithmic changes in Single_crystal between 2.7.1 and 2.7.2 cause loss of Bragg-points in "big unit cell" Laue. #1412

Open willend opened 1 year ago

willend commented 1 year ago

(This issue LIKELY also affects McStas 3 and potentially also both of the current McXtrace releases)

With the stock Single_crystal from 2.7.2 an ESS user found that the Single_crystal only produced incoherent scattering in his instrument (NMX). The datafile used was Rubredoxin.lau (~ 124K unique reflections) and output looks like this:

Screenshot 2023-02-16 at 16 10 43

When falling back to 2.7.1, Bragg spots appear as expected.

Error messages in the output indicate connection to length of the tau search list:

Single_crystal: Error: Illegal tau search (sum=2.33372, j=128, tau_count=128).
Single_crystal: Error: Illegal tau search (sum=3.94505, j=128, tau_count=128).
Single_crystal: Error: Illegal tau search (sum=3.15963, j=128, tau_count=128).
Single_crystal: Error: Illegal tau search (sum=4.74647, j=128, tau_count=128).
Single_crystal: Error: Illegal tau search (sum=2.29056, j=128, tau_count=128).

Reasonably so, the component suggests to heighten the number of reflections: Warning (Xtal): The reflection short list buffer was exhausted at least once. Please consider redefining MCSX_REFL_SLIST_SIZE > 128

The limited-length tau search list is in fact a McCode-3 related GPU invention, but seems to include unwanted side-effects.

For now, a fallback solution is to use the attached Single_crystal.comp which has been ported to work with 2.7.2 and produces Bragg-scattering as expected:

Screenshot 2023-02-16 at 16 02 45

Single_crystal.comp.txt

willend commented 1 year ago

It turns out that the issue occurs mostly ( only? ) in cases with

Below result is made with a model of the NMX instrument, dumping an MCPL file in front of the sample, which is picked up by a "backend" instrument: Screenshot 2023-02-21 at 11 35 21 Result on the left is made with repeat_count=999,E_smear=0.05,pos_smear=0.005,dir_smear=0.01 and on the right simply SPLIT 999 on the sample.

Interstingly, setting order=0 also seems to work! Screenshot 2023-02-21 at 11 54 37

willend commented 1 year ago

Workaround pointed out: Please use order=0

Postponing final resolution until post release of McStas 3.3