[PR-6] feat: implement Schwarz screening for two-electron integral optimization#240
Draft
San1357 wants to merge 11 commits intotheochem:masterfrom
Draft
[PR-6] feat: implement Schwarz screening for two-electron integral optimization#240San1357 wants to merge 11 commits intotheochem:masterfrom
San1357 wants to merge 11 commits intotheochem:masterfrom
Conversation
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.
Summary
SchwarzScreenerclass — uses Schwarz inequality to skip negligible two-electron integrals before computing themexp(-a*b/(a+b) * |A-B|^2)to skip distant shell pairselectron_repulsion_integral_improved()viaschwarz_thresholdparameter (default0.0= disabled)What Changed
gbasis/integrals/_schwarz_screening.pycompute_schwarz_bound_shell_pair,compute_schwarz_bounds,shell_pair_significant,SchwarzScreenerclass withis_significant()andget_statistics()gbasis/integrals/electron_repulsion.py_screenerand_contraction_index_mapclass attributes toElectronRepulsionIntegralImproved, Schwarz screening block inconstruct_array_contraction,schwarz_thresholdparameter inelectron_repulsion_integral_improved()tests/test_schwarz_screening.pyTestShellPairPrescreening,TestSchwarzBounds,TestSchwarzScreener,TestScreeningCorrectness,TestBenchmarkImprovedAlgorithmtests/test_two_elec_int_improved.pyTestSchwarzScreeningclass:test_schwarz_no_effect,test_schwarz_screening_tight,test_schwarz_statisticsMathematical Reference
The Schwarz inequality for electron repulsion integrals:
If$\sqrt{(\mu\nu|\mu\nu)} \cdot \sqrt{(\lambda\sigma|\lambda\sigma)} < \tau$ , the quartet $(\mu\nu|\lambda\sigma)$ is skipped.
Shell-pair prescreening uses the Gaussian product decay factor:
References:
How To Test
Proof That It Works
Unit tests (SchwarzScreener)
Integration tests (screening inside ERI computation)
All 44 tests
Coverage
black & ruff
First Checklist
Scope Of this PR
electron_repulsion_integral_improved()SchwarzScreenerclass with precomputed bounds matrix and statistics trackingelectron_repulsion_integral()— only improved version gets screeningschwarz_thresholdparameter — default0.0disables it (backward compatible)Second Checklist
Type of Changes