Repository navigation
McXtrace Single_crystal: absorption from mu/rho times mass density - #2938
Merged
Merged
Conversation
The absorption cross-section was the per-atom value (atomic weight from e.g. Si.txt A[r]) divided by the full unit cell volume, so multi-atom cells absorbed too little: Si.lau (8 atoms/cell) gave an attenuation length of 360 um at 6.9 keV instead of 45 um. Use the textbook linear attenuation mu/rho [cm^2/g] * density [g/cm^3], with the density from the reflections file header, else the nominal density of the material_datafile. Keep the old expression only as a fallback when no density is known. Numerical change: unchanged for cif2hkl output where weight is per formula unit (LaB6 Test_PowderN/Test_FluoPowder identical); stronger absorption for Si.lau (SSRL_bl_11_2_*, Test_Mono Mono=6). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… absorption Example targets: inverse-variance weighted mean of 3x 1e6 (seeds 1001, 2002, 3003) and 1x 1e7 (seed 4004). Scan references: weighted mean of two 1e7-ray scans (seeds 11, 22), seeds agree within 6%. 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.
Follows the open question in #2880. Stacked on #2937 (same lines); merge that first, then retarget this to
main.Problem. The absorption cross-section is per atom (atomic weight from
material_datafile, e.g.Si.txtA[r] = 28.09 g/mol) but was divided by the volume of the whole unit cell (V0). ForSi.lau(8 atoms per cell, noweightheader) this makes absorption 8× too weak: the attenuation length at 6.9 keV came out as 360 µm, against the textbook 45 µm.cif2hkl output is not affected: its
weightheader is per formula unit, consistent with V0 (LaB6: 203.77 g/mol, Z=1).Fix. Use the textbook linear attenuation, (μ/ρ) [cm²/g] × density [g/cm³] → 1/cm, ×100 → 1/m. This needs no atomic weight, atom count or barns/fm² conversion. The density comes from the reflections file header (
density, written by cif2hkl and present inSi.lau), else from the nominalrhoof thematerial_datafile(all 110 files inmcxtrace-comps/datahave one). The old expression is kept only as a fallback when no density is known, marked with aponytail:comment.Numerical change (1e6 rays, seed 1001, vs #2937):
Test_PowderNindex=2,Test_FluoPowderindex=2 (LaB6 from CIF)SSRL_bl_11_2_white_srcEnergyMonitor_firstSSRL_bl_11_2_not_white_srcEnergyMonitor_firstTest_MonoMono=6 (Si.lau)Updated references (same recipe as in #2880):
SSRL_bl_11_2_white_src%Example: 1.65837e+10 → 3.74674e+09 ± 1.6e7 (3 runs at 1e6 rays, seeds 1001, 2002, 3003, plus 1 run at 1e7 rays, seed 4004, inverse-variance weighted)SSRL_bl_11_2_not_white_srcExample(still disabled): 4.17271e+11 → 1.94915e+11%Scanarrays regenerated from two 1e7-ray scans (seeds 11, 22), weighted; seeds agree within 6% per point. New ranges:white_src5.0e8 to 1.9e9,not_white_src1.7e11 to 2.4e11.Not touched: the unused
delta_prefactor, which mixeshkl_info.rho(atoms/ų) with the material file's mass density. It is computed but never read.Tested on macOS arm64 (clang) only.
🤖 Generated with Claude Code