test(surface_energy): physical bonded-slab γ gate (Al(100)) - #462
Merged
Conversation
The existing surface_energy task test guards only the plumbing on a non-physical stack of isolated Si atoms (γ correctly comes out negative for non-interacting atoms). That leaves the intercept→γ physics unguarded: a sign flip in the Fiorentini-Methfessel intercept or a wrong n_surfaces divisor would still pass. Add a @slow integration gate that runs the task on a genuinely bonded Al(100) slab thickness sweep (3/4/5 layers, Al PAW = 3 valence e⁻ to keep it cheap) and asserts γ is physical: γ > 0 and within a broad ±50% band around the known PBE Al(100) value (≈0.056–0.062 eV/Ų / 0.9–1.0 J/m²). Keeps the FM-vs-direct-subtraction identity check and a fit-consistency check against the returned sweep. Measured γ ≈ 0.070 eV/Ų (1.12 J/m²) — positive, right magnitude; no driver sign/factor bug. New file (does not touch test_surface_energy_task.py, concurrently edited by PR #455). 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
Adds
tests/integration/test_surface_energy_physical.py— a@slowintegration gate that validates the physics of thesurface_energytask on a genuinely bonded metal slab, closing a gap left by the existingtest_surface_energy_task.py(which guards only the plumbing on a non-physical stack of isolated Si atoms, whose γ is correctly negative).Why
The isolated-atom toy sweep never exercises the sign/magnitude of the intercept→γ map: a sign flip in the Fiorentini-Methfessel intercept, or a wrong
n_surfacesdivisor, would still pass every existing test. This gate runs the task on an Al(100) slab thickness sweep (3/4/5 layers, vacuum, standard periodic boundary) and asserts:[0.030, 0.100]eV/Ų around the known PBE Al(100) value (≈ 0.056–0.062 eV/Ų / 0.9–1.0 J/m²; Da Silva et al. PRB 73, 205409 (2006); Tran et al. Sci. Data 3, 160080 (2016)),Al PAW (3 valence e⁻) is used rather than the Al ONCV fixture (11 e⁻, 2s2p semicore) to keep the sweep cheap.
Result
Measured γ ≈ 0.070 eV/Ų (1.12 J/m²) on asus — positive and the right magnitude. The driver's sign and
n_surfacesfactor are correct; no bug exposed. Test passes on asus.New file only — does not touch
test_surface_energy_task.py(concurrently edited by #455).🤖 Generated with Claude Code
https://claude.ai/code/session_018j6BBnPtBSjkrnASSc52mT