From 15799da868eedac47222092080cc2e79944f3947 Mon Sep 17 00:00:00 2001 From: aochuba Date: Mon, 26 Jan 2026 01:26:08 +0530 Subject: [PATCH 1/4] Filter out grid points with negligible weights in horton3 adapter --- src/denspart/adapters/horton3.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/denspart/adapters/horton3.py b/src/denspart/adapters/horton3.py index a47aeaa..a2d2937 100644 --- a/src/denspart/adapters/horton3.py +++ b/src/denspart/adapters/horton3.py @@ -42,6 +42,7 @@ from gbasis.evals.eval import evaluate_basis from gbasis.evals.eval_deriv import evaluate_deriv_basis from gbasis.wrappers import from_iodata +from grid.basegrid import Grid from grid.becke import BeckeWeights from grid.molgrid import MolGrid from grid.onedgrid import GaussChebyshev @@ -116,10 +117,15 @@ def _setup_grid(atnums, atcoords, nrad, nang, store_atgrids): oned = GaussChebyshev(nrad) rgrid = BeckeRTransform(1e-4, 1.5).transform_1d_grid(oned) grid = MolGrid.from_size(atnums, atcoords, nang, rgrid, becke, store=store_atgrids) + + # Remove grid points with zero weight + if not store_atgrids: + keep = grid.weights > 1e-15 + grid = Grid(grid.points[keep],grid.weights[keep]) assert np.isfinite(grid.points).all() assert np.isfinite(grid.weights).all() assert (grid.weights >= 0).all() - # TODO: remove grid points with zero weight + return grid From a85f4d719ca314e0f17d34e8fb20bd44608b3858 Mon Sep 17 00:00:00 2001 From: aochuba Date: Sun, 8 Feb 2026 01:14:01 +0530 Subject: [PATCH 2/4] Fix CI: Pin scipy<1.15 and update tests for compatibility in horton3 branch --- pyproject.toml | 2 +- tests/test_properties.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c4e391c..0a8a9c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", ] -dependencies = ["numpy>=1.0", "scipy"] +dependencies = ["numpy>=1.0", "scipy<1.15"] dynamic = ["version"] [project.urls] diff --git a/tests/test_properties.py b/tests/test_properties.py index 04d7aba..dd5e2df 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -21,7 +21,13 @@ import numpy as np import pytest from numpy.testing import assert_allclose -from scipy.special import sph_harm_y +try: + from scipy.special import sph_harm_y +except ImportError: + from scipy.special import sph_harm + + def sph_harm_y(n, m, theta, phi): + return sph_harm(m, n, phi, theta) from denspart.properties import spherical_harmonics From 5be88d893da644f0b745c72c90b623efe7d56343 Mon Sep 17 00:00:00 2001 From: aochuba Date: Mon, 9 Feb 2026 19:25:02 +0530 Subject: [PATCH 3/4] Revert scipy version pinning and compatibility wrapper (issue fixed upstream) --- pyproject.toml | 2 +- tests/test_properties.py | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0a8a9c1..c4e391c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", ] -dependencies = ["numpy>=1.0", "scipy<1.15"] +dependencies = ["numpy>=1.0", "scipy"] dynamic = ["version"] [project.urls] diff --git a/tests/test_properties.py b/tests/test_properties.py index dd5e2df..04d7aba 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -21,13 +21,7 @@ import numpy as np import pytest from numpy.testing import assert_allclose -try: - from scipy.special import sph_harm_y -except ImportError: - from scipy.special import sph_harm - - def sph_harm_y(n, m, theta, phi): - return sph_harm(m, n, phi, theta) +from scipy.special import sph_harm_y from denspart.properties import spherical_harmonics From 2c384a9019078573ba154f3de7e14e34535aba46 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 13:58:01 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/denspart/adapters/horton3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/denspart/adapters/horton3.py b/src/denspart/adapters/horton3.py index a2d2937..7c3c35c 100644 --- a/src/denspart/adapters/horton3.py +++ b/src/denspart/adapters/horton3.py @@ -117,15 +117,15 @@ def _setup_grid(atnums, atcoords, nrad, nang, store_atgrids): oned = GaussChebyshev(nrad) rgrid = BeckeRTransform(1e-4, 1.5).transform_1d_grid(oned) grid = MolGrid.from_size(atnums, atcoords, nang, rgrid, becke, store=store_atgrids) - + # Remove grid points with zero weight if not store_atgrids: keep = grid.weights > 1e-15 - grid = Grid(grid.points[keep],grid.weights[keep]) + grid = Grid(grid.points[keep], grid.weights[keep]) assert np.isfinite(grid.points).all() assert np.isfinite(grid.weights).all() assert (grid.weights >= 0).all() - + return grid