Skip to content

[mcstas-users] McStasScript and COPY and EXTEND keywords #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
willend opened this issue Apr 15, 2025 · 1 comment
Open

[mcstas-users] McStasScript and COPY and EXTEND keywords #92

willend opened this issue Apr 15, 2025 · 1 comment

Comments

@willend
Copy link
Contributor

willend commented Apr 15, 2025

The following bug-report was sent by Peter Konik (BNC) to mcstas-users:

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_native_mcstas.instr.txt
SPHERES_generated_mcstasscript.instr.txt

@mads-bertelsen
Copy link
Collaborator

This is a good point, the behavior of copy should mirror the one in McStas to align the use of the packages. I will reset the EXTEND, GROUP, JUMP, SPLIT etc at copy. In the meantime, you can reset EXTEND on a copied component with
comp.EXTEND=""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants