Repository navigation
PhononSimple_process, Phonon_simple: scale the one-phonon cross-section to Squires 3.120 - #2806
Open
henrikjacobsenfys wants to merge 3 commits into
Open
henrikjacobsenfys wants to merge 3 commits into
henrikjacobsenfys wants to merge 3 commits into
Conversation
…on to Squires 3.120 Both components traced 1/(4 pi x 1.00866) of the one-phonon cross-section they implement (Squires Eq. 3.120), see mccode-dev#2792: - 1/4pi: PhononSimple_process returned mu = rho b^2 X where Union expects mu = 4 pi rho dsigma/dOmega; Phonon_simple divided its weight by 4 pi. - m_n/u: the recoil hbar^2 kappa^2/2m_n was divided by M as if M were in neutron masses, while both headers document M as an atomic mass. The test targets that recorded the old scale are updated: the Phonon_simple based ones (Samples_Phonon, Test_Dispersion_relation_TAS examples and scan) scale by exactly 4 pi x 1.00866 at a fixed seed, and the Union one (Test_inhomogenous_process, sample=phonon) moves by +4.6%. The TAS test's dispersion generator mirrors Phonon_simple's cross-section, so it gets the same two factors. Fixes mccode-dev#2792 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@henrikjacobsenfys thanks! As I remember @Lomholy recently looked into benchmarking of multiple inelastic comps, so I've requested him to review. |
Collaborator
|
@willend thank you for putting me on this. I will see when I have mental bandwidth to see if the factor 4 pi is supposed to be there or not, but i expect that it might be some time before i get to it! |
Contributor
|
@henrikjacobsenfys current failures are a result of a not completely succesful merge with new content on main. I will fix that. |
… 1.00866 The merge of main brought in the new scan mesh (h=0.8..1.2, l=1.1..1.3) with references recorded before the Phonon_simple fix, so test 6 failed at ~13x. The references (mean of 16 seeds) are scaled by the exact factor 12.6752 the fix applies at fixed seed. mctest with this branch (macOS arm64, seed 1000): 25/25 points within 20% without MPI (worst 106%) and with 2 MPI ranks (worst 105%). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2792.
PhononSimple_process(Union) andPhonon_simple(samples) traced 1/(4π × 1.00866) ≈ 0.0789 of the one-phonon cross-section they implement (Squires Eq. 3.120). Two factors, one line each:PhononSimple_processnow returns μ = 4πρ dσ/dΩ, which is what Union's ΔΩ/4π direction weighting expects.Phonon_simpledrops the/ (4 * PI)from its focusing factorp2.Mas if it were in neutron masses. Both headers documentMas an atomic mass, so the constant gains1.00866(m_n/u). The%Punit ofMnow reads[amu]in both components.bstays the scattering length in fm, so existing instruments need no parameter change. Their phonon intensity goes up by 12.675.Test targets
The test targets recorded at the old scale are updated, along with the generated READMEs that repeat them:
Samples_Phonon, both%Examplelines.Test_Dispersion_relation_TAS, the three phonon%Examplelines and the phonon%Scan.generate_phonon_dispersion.pydeliberately reproducesPhonon_simple's cross-section, so it gets the same two factors. OtherwiseDispersion_relationandPhonon_simplewould no longer agree..mdare updated to match.Test_inhomogenous_process,sample=phonon.For
Phonon_simple, the fix rescales every ray's weight by a constant without touching the random number sequence. So at a fixed seed each result scales by exactly 4π × 1.00866 = 12.6752. I ran every affected example at mctest's settings (seed 1000, 1e6 rays, no MPI), before and after:Samples_Phononlines, the three TAS examples, and all 25 points of the TAS%Scan. The same 17 points are zero before and after.The Union test is not a pure rescaling, because μ also changes which process Union picks. Its target moves by the measured ratio, +4.6% (0.00505839 → 0.00529178).
The magnon examples (
sample_choice=2, 3) are unaffected.Absolute check
A monochromatic 100 meV beam on a thin fcc Ni sample, with four 0.2 × 0.4 m detector elements 6 m away at 2θ = 20°, 35°, 50° and 65°. dσ/dΩ per atom from the monitors, compared with Squires 3.120:
PhononSimple_process(Union box, 4 seeds × 5e4)Phonon_simple(cylinder, 2θ = 50°, 20 seeds × 1e6)Tested, and not
main's Union library files. In that setup the unpatched runs reproduce the committed targets (e.g.lin_det_I0.00507 against 0.00506), which suggests the mix is sound.mainitself.andPhonon_simple` scatter 1/(4π × 1.00866) of the one-phonon cross-section they implement #2792 (the line-349 metric, the missing 2π/a, the uninitialised slot, the printf, the root search, theintfunction that returns nothing).hk_scan.pngin the TAS docs, whose shared colour scale is now 12.7× too small.🤖 Generated with Claude Code