Enhancement: Report projected gradient norm during MBIS optimization#38
Enhancement: Report projected gradient norm during MBIS optimization#38Ao-chuba wants to merge 4 commits intotheochem:mainfrom
Conversation
|
Hi @tovrstra ,
To fix this i have I have pinned |
There was a problem hiding this comment.
Pull request overview
Updates MBIS optimization progress reporting so the logged grad.rms reflects the projected gradient norm under bound constraints, making convergence diagnostics meaningful when parameters sit on active bounds.
Changes:
- Exposes parameter bounds inside the
trust-constrcallback and computes a masked (“projected”) gradient for reporting. - Adjusts spherical-harmonics test imports to work across SciPy variants (
sph_harm_yvssph_harm). - Pins SciPy to
<1.15inpyproject.toml.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/denspart/vh.py |
Computes and reports projected gradient norm in the optimization callback. |
tests/test_properties.py |
Adds SciPy import fallback for spherical harmonics used in tests. |
pyproject.toml |
Introduces an upper bound on the SciPy dependency version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3e92f5e to
f900082
Compare
92f8cca to
9f91dd6
Compare
for more information, see https://pre-commit.ci
|
@tovrstra @PaulWAyers
|
|
@tovrstra, I’ve updated the PR. When you have some time, could you please review it? I’d really appreciate your feedback. Thank you |
The generic
optimize_pro_modelpreviously reported the standard Euclidean norm of the gradient. However, MBIS optimization serves as a constrained problem (non negative populations and exponents). When parameters are at their bounds, the raw gradient may be non zero (pointing out of the feasible region) even at the solution. This made the reported "grad.rms" a potentially misleading metric for checking convergence.I have modified
src/denspart/vh.pyto correctly calculate and report the projected gradient norm:grad_projinstead of the raw gradient.Verified using the standard
horton3water molecule example. The optimization converged successfully, and the reportedgrad.rmsnow consistently reports the true distance to the constrained solution, dropping to~1e-9at convergencecloses #37