fix(flapw/xps): two-lever within-cell O1s Madelung fix (Ti 3s valence LO + band-limited ρ_I mask) - #464
Merged
Merged
Conversation
… (lever b) Mask the plane-wave interstitial density to zero inside every muffin tin (band-limited, Elk rhoir) before the Weinert pseudocharge continuation, off by default behind mask_interstitial (env GRADWAVE_FLAPW_MASK_RHOI). Removes the small-sphere catastrophic cancellation (+25..+32 e continuation -> -27 e deficit pseudocharge) that corrupts the interstitial Coulomb grid and gives the wrong within-cell O1s Madelung shift. See xps_madelung_stage2a.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018j6BBnPtBSjkrnASSc52mT
…O + masked ρ_I Applies both stage-2 levers to the inequivalent-oxygen core-level test and documents the corrected behavior: - Lever (a), DOMINANT: treat Ti 3s as a valence semicore local orbital (los/val_e/core) instead of frozen core. Reproduces Elk's Ti in-sphere charge exactly (18.75 vs Elk 18.751, was 19.52), which is the dominant source of the inter-site Madelung field. - Lever (b): mask_interstitial=True (band-limited interstitial ρ_I mask, Elk rhoir), from the previous commit. Measured (Ti+2O demo, ecut 200, ΔC0_ext long-short vs Elk): O R_MT 1.00 Bohr: baseline +0.74 -> a +2.71 -> a+b +3.09 (Elk +2.90) O R_MT 1.40 Bohr: baseline +2.81 -> a +4.46 -> a+b +5.07 (Elk +4.79) Raw O1s delta_eV flips -1.19 -> +1.19 (a+b, R_MT 1.40); target test (O R_MT 0.70 A) now asserts the POSITIVE shift (delta_eV +1.19, delta_madelung +4.26). Invariant gate (all hold): corundum 27Al V_zz EFG unchanged by masking (-6.996 -> -6.992 eV/A^2, 18.5%, eta 0); atomic anchor, equivalent-site null, cross-cell Si 2p, Ne/Ar splittings, dilute anchor all pass with masking on. Rutile Ti EFG (documented unsolved hard case, no committed test) is not regressed by lever (a) — the O V_zz sign actually improves. mask_interstitial stays default-off (opt-in); _CORE["Ti"] default unchanged (a broad Ti-semicore flip belongs to the Ti-EFG core-Sternheimer work). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018j6BBnPtBSjkrnASSc52mT
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018j6BBnPtBSjkrnASSc52mT
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.
What
Implements the two-lever fix diagnosed in #463 for the wrong-signed within-cell O1s
core-level (XPS) shift on the Ti+2O demo, EFG-gated at every step. Fully measured
on asus (Elk 11.0.2 matched-basis decks), nothing forced.
Lever (b) — band-limited interstitial ρ_I mask (
_weinert_multi,mask_interstitial, envGRADWAVE_FLAPW_MASK_RHOI): masks the plane-wave interstitialdensity to zero inside every muffin tin (Elk
rhoir) before the Weinert pseudochargecontinuation, using a Fourier-truncated characteristic function (
ball_ff_np) — a sharpnp.wheremask aliases. Removes the small-Ti-sphere catastrophic cancellation(+25..+32 e continuation → −27 e deficit pseudocharge) that corrupts
v_hart.Lever (a) — Ti 3s as a valence semicore local orbital (
los/val_e/core,opt-in). The LAPW+LO infrastructure already exists (
_build_lo, confined semicore LO),so this needed no new infrastructure. Reproduces Elk's Ti in-sphere charge exactly
(18.75 e vs Elk 18.751, was 19.52), which is the DOMINANT source of the inter-site
Madelung field.
Results — ΔC0_ext(long−short) and raw O1s Δ, ecut 200 (vs Elk)
increment. a+b brackets Elk and lands raw O1s ≈ +1.19 (Elk ~+1.2).
charge toward Elk (stays 19.52) — lever (a) is required. Masking-only recovers ~+0.5 eV,
matching the post-hoc estimate.
Invariant / EFG gate (all hold)
Corundum being unchanged confirms Weinert's theorem: the potential outside the spheres
is identical masked vs unmasked; masking only removes the numerical corruption.
What ships
mask_interstitialstays default-OFF (opt-in flag + env), applied explicitly inthe corrected core-level test. It is validated benign on the corundum EFG and all
invariants; I did not unilaterally flip the global default on a core subsystem under
review (the NMR shielding fleet was not re-validated). Recommend flipping to default-on
after a broader (NMR fleet) pass — the evidence supports it.
_CORE["Ti"]default unchanged. Lever (a) is applied opt-in vialos/val_e/core.A global Ti-semicore flip would change every Ti FLAPW result and needs an auto-default-LO
mechanism plus a Ti-EFG gate (the unsolved core-Sternheimer work,
TIO2_NMR.md) — itsown investigation, as diag(flapw/xps): stage-2a Madelung deficit attribution (report, no Coulomb-layer change) #463 said.
test_core_level_shift_inequivalent_oxygennow applies both levers and asserts thecorrected positive shift (delta_eV +1.19, delta_madelung +4.26 ≈ Elk interp +4.4).
core_level_shiftsdocstring (fix(flapw): report on-site Madelung C0_ext for within-cell core-level shifts #450) updated to describe the corrected behavior.Verdict: SUCCESS (a+b). Sign flips, ΔC0_ext ≈ Elk at both radii, all invariants hold.
🤖 Generated with Claude Code
https://claude.ai/code/session_018j6BBnPtBSjkrnASSc52mT