Skip to content

Phonon focusing fix#2343

Merged
willend merged 8 commits intomainfrom
phonon_focusing_fix
Mar 16, 2026
Merged

Phonon focusing fix#2343
willend merged 8 commits intomainfrom
phonon_focusing_fix

Conversation

@Lomholy
Copy link
Copy Markdown
Collaborator

@Lomholy Lomholy commented Feb 24, 2026

Free-form text area

Please describe what your PR is adding in terms of features or bugfixes:
Added in a conversion from Degrees to radians inside the initialize of Phonon_simple, such that it is consistent with its header.


Development OS / boundary conditions

Please describe what OS you developed and tested your additions on, and if any special dependencies are required:
MacOS Tahoe 26.3


PR Checklist for contributing to McStas/McXtrace

For a coherent and useful contribution to McStas/McXtrace, please fill in relevant parts of the checklist:

  • My contribution includes patches to an existing component file

    • I have used the mcdoc utility and rendered a reasonable documentation page for the component (please attach as screenshot in comments!)
    • I have ensured that basic use of the component is OK (e.g. an instrument using it compiles?)
    • I have used the mctest utility to test one or more instruments making use of the component (please attach mcviewtest report as screenshot in comments)
    • I have used the mccode-clangformat tool to apply the standard McCode component indentation scheme
    • I have used the mcrun --c-lint "linter" and followed advice to remove most / all warnings that are raised

@Lomholy
Copy link
Copy Markdown
Collaborator Author

Lomholy commented Mar 16, 2026

@willend I am quite sure this is ready to be pulled.

The test screenshot is missing, but as far as I understand, this has already been done by the CI correctly?

@willend
Copy link
Copy Markdown
Contributor

willend commented Mar 16, 2026

@Lomholy actually the best is to also run a local 'mcviewtest' e.g. on the outputs of the CI (e.g. https://github.com/mccode-dev/McCode/actions/runs/22348263409?pr=2343).

I am working toward a solution that will bring up the "result matrix" automatically but don't have that in place just yet.

@Lomholy
Copy link
Copy Markdown
Collaborator Author

Lomholy commented Mar 16, 2026

@willend Just tried, but when I am at the directory where the Samples_Phonon.instr is, and I run mctest --local=./ --instr=Samples_Phonon.instr, The output is this:

`loading system configuration
Output of test will be placed in: /Users/tqv636/Desktop/Phd/McCode/mcstas-comps/examples/Tests_samples/Samples_Phonon/mcstas-test_20260316_1729_28/
ncount is: 1e6
Testing: 3.6.8

Adding instruments from subfolders in: /Users/tqv636/Desktop/Phd/McCode/mcstas-comps/examples/Tests_samples/Samples_Phonon
Copying instruments to: /Users/tqv636/Desktop/Phd/McCode/mcstas-comps/examples/Tests_samples/Samples_Phonon/mcstas-test_20260316_1729_28/mcstas-3.6.8_Samples_Phonon.instr_Darwin_LOCAL

WARNING: Skipped Samples_Phonon test - did /Users/tqv636/Desktop/Phd/McCode/mcstas-comps/examples/Tests_samples/Samples_Phonon/mcstas-test_20260316_1729_28/mcstas-3.6.8_Samples_Phonon.instr_Darwin_LOCAL/Samples_Phonon exist already??

Compiling instruments [seconds]...

Running tests / getting status...
Overall test result:
SUCCESS`

After which i do mcviewtest inside the folder created, and it seems like no test was run:

image

What do you reckon might be the problem?

@willend
Copy link
Copy Markdown
Contributor

willend commented Mar 16, 2026

The trouble is that the --local and output directories can not overlap… And the “input” folder can not contain output datasets or other junk instr files….

So you can is either:

mctest --local ../some/where/else --testdir=output
mctest --local ./ --testidir=../some/where/else

BUT I do instead recommend rather rolling a full McStas install via e.g.
(mcstas-dev) hostname:McCode username$ ./devel/bin/mccode-build-conda

Then in a temporary folder e.g. mctest --testdir=output --mpi=10 -n1e7 --comp=Phonon_simple

On my mac this gives

Copying instruments to: output/mcstas-3.99.99_mpi_x_10_1e7_Phonon_simple_Darwin

Compiling instruments [seconds]...
RITA-II        :  12.57
Samples_Phonon :   1.75

Running tests / getting status...
RITA-II         :   NO TEST
Samples_Phonon  :  11.21    [val: 2.86255e-25 / 2.86265e-25 = 100 %]
Samples_Phonon_2:   9.60    [val: 2.77546e-25 / 2.86265e-25 = 97 %]
======================================
Overall test result:
SUCCESS

And this table:
Screenshot 2026-03-16 at 18 32 40

Also I’ve dug out ascii test tables from other platforms:
Screenshot 2026-03-16 at 18 45 43
Screenshot 2026-03-16 at 18 46 07

(But the main point is in fact - as you are contributing the best is if you double check ;-) - take note for next PR )

@willend
Copy link
Copy Markdown
Contributor

willend commented Mar 16, 2026

Will do final review of code and doc comments etc. tomorrow

@willend
Copy link
Copy Markdown
Contributor

willend commented Mar 16, 2026

@Lomholy just realised that this was the “smaller” contribution - so will just go ahead and merge now.

@willend willend merged commit 87a3cca into main Mar 16, 2026
36 checks passed
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

Successfully merging this pull request may close these issues.

2 participants