Repository navigation
McXtrace Single_crystal: compute absorption length directly, use runtime NA - #2937
Merged
Merged
Conversation
…ime NA Follow-up to #2880. The absorption cross-section was converted from cm^2 to barns or fm^2 depending on the barns flag, then scaled by 100 again for barns: a round trip whose result never depends on the flag, and where the swapped exponents fixed in #2880 hid. Compute abs_xlen [1/m] in one expression via fm^2, and use the runtime NA instead of a hand-typed Avogadro literal (the 10E23 typo). NA differs from the old literal by 2e-7 relative; results are otherwise unchanged (identical to 7 digits on Test_PowderN, Test_FluoPowder, SSRL_bl_11_2_* and Test_Mono with fixed seeds). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
@antoinepado and @farhi I think everything is better like this. Agree? |
Collaborator
|
@willend Agreed it is simpler this way. Thank you. |
Contributor
|
Thanks all, nice fix. |
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.
Follow-up to #2880, prompted by @antoinepado's point there that the
10Etypo itself cancelled out.In the old code the absorption cross-section went cm² → barns or fm² (depending on
barns) →/V0→×100again for barns. That round trip never changes the result in m⁻¹, and the swapped 1e24/1e26 exponents fixed in #2880 were hiding inside it. This PR:abs_xlen[1/m] in one expression via fm², independent of thebarnsflag (inc_xlenkeeps its×100for barns)NAinstead of a hand-typed Avogadro literal (the source of the10E23typo)abs_xsectNumerical behaviour: unchanged. The runtime
NA(6.02214179e23) differs from the old literal (6.02214076e23) by 2e-7 relative. With fixed seeds (1e6 rays, seed 1001), every monitor inTest_PowderNindex=2,Test_FluoPowderindex=2,SSRL_bl_11_2_white_src,SSRL_bl_11_2_not_white_srcandTest_MonoMono=6 matches main to 7 digits, with the same warnings as main.Tested on macOS arm64 (clang) only.
🤖 Generated with Claude Code