[mcstas-users] McStasScript and COPY and EXTEND keywords

Peter Kjær Willendrup pkwi at dtu.dk
Tue Apr 15 11:27:36 CEST 2025


Dear Peter,


Thank you for reporting this issue!

I agree that the desired behaviour should probably be to NOT copy the EXTEND block when copying an earlier component.

I will copy-paste your report and instrument files to the McStasScript list of issues - Mads and I will then have a closer look after easter. :-)


Best and thanks again,

Peter Willendrup


On 15 Apr 2025, at 10.28, Петр Коник via mcstas-users <mcstas-users at mcstas.org> wrote:

Dear colleagues,

I’m writing to report probably undesired behavior of McStasScript we discovered together with Chuyi Huang from JCNS.

In McStas if I make a COPY of a component, which also used EXTEND block, this additional code is not copied as well. I believe this is the correct approach since it allows e.g. to put different SCATTERED flags on each of the copied components separately, which comes handy.

However when McStasScript generates an instrument based on the same code, it will copy EXTEND block as well. In more complex situations where WHEN conditions are used this could lead to unexpected behavior.

Please find attached two files. Compare lines 255-286 in the native one and lines 268-307 in the generated one.

Best regards,
Peter Konik

<SPHERES_generated_mcstasscript.instr><SPHERES_native_mcstas.instr>


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/20250415/a3e1b9c7/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/20250415/a3e1b9c7/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/20250415/a3e1b9c7/attachment-0003.gif>


More information about the mcstas-users mailing list