[mcstas-users] Multiple sources - potential bug
Peter Kjær Willendrup
pkwi at dtu.dk
Sat Mar 21 20:04:58 CET 2026
Hi Peter,
On 21 Mar 2026, at 16.10, Петр Коник via mcstas-users <mcstas-users at mcstas.org> wrote:
Wanted to report (maybe not so) strange behavior with calculating beam intensities when several sources are used. The way I do it is to put EXTEND to the very first origin arm, where I flip a coin to choose which of two sources to use (e.g. for bi-spectral extraction) with WHEN condition.
The problem is that it looks like while each source now generates only half of the total number of trajectories, they still use the full number of them to estimate the flux “carried” by each of them. My solution is to artificially double the flux of the sources (given I generate 50/50 trajectories on each of two sources).
Don’t know if it’s intended behavior or not.
This is in fact to be expected, but admittedly not written down explicitly anywhere (I think). The Source-components each normalise the later produced particle weights with respect to the --ncount ( mcget_ncount() ) at INITIALIZE time, whereas the EXTEND rand01() and the WHEN condition both happen at TRACE time. At INITIALIZE time there is (currently) no way of telling the sources that they are “not alone”.
This in fact the same for any set of classical McStas components - each of them work under the assumption that they will see “all” of the neutrons. So if you e.g. to combine Single_crystal and Phonon_simple for an elastic-inelastic sample, the same type of weight-renormalisation must be made.
Best,
Peter
Peter Kjær Willendrup
Forskningsingeniør, Specialkonsulent
DTU Physics
[image001.gif]
Technical University of Denmark
[image002.gif]
Department of Physics
Fysikvej
Building 307
DK-2800 Kongens Lyngby
Main office at
ESS DMSC
Building 305
DK-2800 Kongens Lyngby
Direct +45 2125 4612
Mobil +45 2125 4612
Fax +45 4593 2399
pkwi at fysik.dtu.dk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20260321/58e305f0/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 58 bytes
Desc: image001.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20260321/58e305f0/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 1055 bytes
Desc: image002.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20260321/58e305f0/attachment-0003.gif>
More information about the mcstas-users
mailing list