Skip to content

fix(flapw/xps): two-lever within-cell O1s Madelung fix (Ti 3s valence LO + band-limited ρ_I mask) - #464

Merged
wladerer merged 3 commits into
mainfrom
fix/flapw-xps-two-lever
Sep 9, 2026
Merged

fix(flapw/xps): two-lever within-cell O1s Madelung fix (Ti 3s valence LO + band-limited ρ_I mask)#464
wladerer merged 3 commits into
mainfrom
fix/flapw-xps-two-lever

Conversation

@wladerer

@wladerer wladerer commented Sep 9, 2026

Copy link
Copy Markdown
Owner

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, env GRADWAVE_FLAPW_MASK_RHOI): masks the plane-wave interstitial
density to zero inside every muffin tin (Elk rhoir) before the Weinert pseudocharge
continuation, using a Fourier-truncated characteristic function (ball_ff_np) — a sharp
np.where mask 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)

O R_MT (Bohr) config Ti q ΔC0_ext raw Δ1s Elk ΔC0_ext
1.00 baseline 19.518 +0.736 −1.667 +2.90
1.00 (b) mask 19.515 +0.868 −1.667
1.00 (a) Ti 3s val 18.745 +2.712 +0.953
1.00 a+b 18.760 +3.086 +1.191
1.40 baseline 19.520 +2.814 −1.191 +4.79
1.40 (b) mask 19.519 +3.303 −1.429
1.40 (a) Ti 3s val 18.746 +4.455 +0.953
1.40 a+b 18.781 +5.073 +1.191

Invariant / EFG gate (all hold)

gate baseline after verdict
corundum ²⁷Al V_zz (torture) −6.9962 eV/Ų (18.5%, η 0) −6.9924 (mask on) 0.05% change — unchanged
rutile Ti EFG (lever a) Ti +29.8/η0.99, O +46.7 (wrong sign) Ti +26.5/η0.02, O −28.3 (correct sign) not regressed (unsolved case, no committed test)
atomic anchor, equiv-site null, cross-cell Si 2p pass pass (mask on) hold
Ne/Ar splittings, dilute anchor, BZ integration pass pass (mask on) hold
FLAPW fast tier (weinert/efg/basis/multi/newton/scf) pass pass 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_interstitial stays default-OFF (opt-in flag + env), applied explicitly in
    the 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 via los/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) — its
    own investigation, as diag(flapw/xps): stage-2a Madelung deficit attribution (report, no Coulomb-layer change) #463 said.
  • test_core_level_shift_inequivalent_oxygen now applies both levers and asserts the
    corrected positive shift (delta_eV +1.19, delta_madelung +4.26 ≈ Elk interp +4.4).
  • core_level_shifts docstring (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

wladerer and others added 3 commits September 9, 2026 15:11
… (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
@wladerer
wladerer enabled auto-merge (squash) September 9, 2026 23:14
@wladerer
wladerer merged commit 8999c61 into main Sep 9, 2026
15 checks passed
@wladerer
wladerer deleted the fix/flapw-xps-two-lever branch September 9, 2026 23:22
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.

1 participant