[mcstas-users] [McStas 2.7.1] JUMP-ITERATE problems

Peter Kjær Willendrup pkwi at fysik.dtu.dk
Sat Mar 5 07:52:29 CET 2022

Hello Abdel,

On 4 Mar 2022, at 12.04, abdel al-falou <abdel.al-falou at tum.de<mailto:abdel.al-falou at tum.de>> wrote:

my name is Abdel, I'm currently working with McStas 2.7.1 to simulate the SANS-1 beamline at FRM-II.

I'd like to use the handy ITERATE tool in McStas to slice one beam guide into 54 parts, but I still have some difficulties with that. I have tried running the template from E. Farhi, <Test_Jump_Iterate>, but it only sets/displays two guides instead of the intended 30.

I'd be glad if you could help me figure it out, ideally via the template file.

To be completely honest with you, JUMP + ITERATE is in fact a GOTO-mechanism - more or less a hack. :)
(see also https://xkcd.com/292/)

There is only one guide element in play, plus “magic teleportation” of the neutron from end to start of that guide element. This does in fact “work”, but will naturally display one guide element only.

My recommendation will always be to avoid JUMP since its implications can be misleading and hard to debug.

I suggest you in fact put all of the 54 guide elements in place, but make use of COPY to ease the copy-pasting. :)

(In McStas 2.7.1 and earlier this means actual c-code-duplication and longer compile-time, but in 3.1 the compilation-time in such cases is much improved, due to the use of TRACE-functions.)


Peter Kjær Willendrup
Forskningsingeniør, Specialkonsulent
Næstformand for DTU Fysik LSU

DTU Physics

[cid:b6339554-7f28-441d-9f31-5944f811397c at win.dtu.dk]

Technical University of Denmark

[cid:e108e480-fcab-46e2-9531-b38165079572 at win.dtu.dk]

Department of Physics
Building 307
DK-2800 Kongens Lyngby
Direct +45 2125 4612
Mobil +45 2125 4612
Fax +45 4593 2399
pkwi at fysik.dtu.dk<mailto:pkwi at fysik.dtu.dk>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20220305/bc477994/attachment-0001.html>
-------------- 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/20220305/bc477994/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/20220305/bc477994/attachment-0003.gif>

More information about the mcstas-users mailing list