Feature/robust poisson split2 - #320
Conversation
|
@PaulWAyers @marco-2023 , here's the split2 pr . ones split1 pr gets merged this should get merged too as it goes hand in hand. (in this PR approx 100 new lines has been added on top of the #319 PR) |
There was a problem hiding this comment.
Pull request overview
Implements Split 2 of the robust Poisson (“Double-Split-Plus-Solve”) pipeline by adding an optional NNLS-based Gaussian fit on the post–Split 1 residual density, further smoothing the numerical residual passed to the BVP solver.
Changes:
- Add
solve_poisson_robust(...)implementing Split 1 core subtraction, optional Split 2 NNLS residual fitting, and BVP solve on the final residual. - Add comprehensive tests covering correctness against an analytic Gaussian potential, stability for sharp/negative densities, input validation, and Split 2 execution.
- Export the robust solver from the package top-level
gridnamespace.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/grid/robust_poisson.py | Adds robust Poisson solver with optional Split 2 NNLS Gaussian fit and analytical+numerical potential composition. |
| src/grid/tests/test_robust_poisson.py | Adds tests validating accuracy, stability, error handling, and Split 2 behavior. |
| src/grid/init.py | Re-exports robust_poisson symbols at package top level. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
PR has been updated as per taking in valid suggestions from co pilot |
This PR implements Split 2 of the Double-Split-Plus-Solve architecture, completing the robust Poisson solver pipeline.
This PR depends on #319 (Split 1) and currently includes its commits as this branch was branched off PR (split1).
While Split 1 (#319) successfully subtracts the extremely sharp promolecular atomic cores, the remaining residual density can still contain sharp multi center features (bonding density/polarization) or negative lobes. This PR implements a second split to analytically fit and extract this remaining density.
By utilizing
scipy.optimize.nnlswith a geometric progression of Gaussian basis exponents, we perform a nnls fit to capture the multi center bonding density. Because Gaussians have exact analytical potentials, this leaves only a tiny, perfectly smooth numerical residual for the BVP solver to integrate, meaning it converges without any risk of crashing or instability.once pr(split1) #319 gets updated (if required ) after review and gets merged to master, ill rebase this PR then the git diff (amount of new lines added or deleted ) will reduce accordingly.