From 890e94fec34a2e9420a19d8059f923c3b867715a Mon Sep 17 00:00:00 2001 From: aochuba Date: Thu, 11 Jun 2026 18:30:09 +0530 Subject: [PATCH 1/8] Add pre-fitted atomic Gaussian parameter loader and data --- MANIFEST.in | 1 + src/grid/__init__.py | 2 + src/grid/coulomb.py | 78 +++++++++- src/grid/data/atomic_gauss_params.json | 194 +++++++++++++++++++++++++ src/grid/tests/test_coulomb.py | 33 ++++- 5 files changed, 306 insertions(+), 2 deletions(-) create mode 100644 src/grid/data/atomic_gauss_params.json diff --git a/MANIFEST.in b/MANIFEST.in index c715c9e4..090d795a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,3 +6,4 @@ include grid.data.spherical_design/*.npz include grid.data.maxdet/*.npz include grid.data.prune_grid/*.npz include grid.data.proatoms/*.npz +include grid.data/atomic_gauss_params.json diff --git a/src/grid/__init__.py b/src/grid/__init__.py index c3ef5790..1a572ea2 100644 --- a/src/grid/__init__.py +++ b/src/grid/__init__.py @@ -35,3 +35,5 @@ from grid.periodicgrid import * from grid.rtransform import * from grid.ngrid import * +from grid.coulomb import * + diff --git a/src/grid/coulomb.py b/src/grid/coulomb.py index e3f83226..1034d5b8 100644 --- a/src/grid/coulomb.py +++ b/src/grid/coulomb.py @@ -26,10 +26,18 @@ from __future__ import annotations +import json +from importlib.resources import files import numpy as np from scipy.special import erf -__all__ = ["coulomb_gaussian_p", "coulomb_gaussian_s", "coulomb_potential"] + +__all__ = [ + "coulomb_gaussian_p", + "coulomb_gaussian_s", + "coulomb_potential", + "load_atomic_gaussian_params", +] # Distance threshold below which the r->0 analytical limit is used # instead of erf(x)/x to avoid division by zero at atomic nuclei. @@ -238,3 +246,71 @@ def coulomb_potential( V += c * coulomb_gaussian_p(r, alpha, normalized=normalized) return V + + +_ATNUM_TO_JSON_KEY = { + 1: "H", + 6: "C", + 7: "N", + 8: "O", + 17: "Cl" +} +_ATOMIC_GAUSS_PARAMS_CACHE: dict | None = None + + +def load_atomic_gaussian_params(element: str | int) -> tuple[np.ndarray, np.ndarray]: + """Load pre-fitted s-type Gaussian parameters for a given element. + + Parameters + ---------- + element : str or int + Element symbol (case-insensitive, e.g., "H", "C") or atomic number (e.g., 1, 6). + + Returns + ------- + coeffs_s : np.ndarray + Coefficients of the normalized s-type Gaussians. + alphas_s : np.ndarray + Exponents of the s-type Gaussians. + + Raises + ------ + ValueError + If pre-fitted parameters are not available for the element. + TypeError + If the element parameter has an invalid type. + """ + if isinstance(element, str): + # title() maps e.g. "cl" -> "Cl", "H" -> "H" — matching JSON key casing exactly + json_symbol = element.strip().title() + if json_symbol not in _ATNUM_TO_JSON_KEY.values(): + raise ValueError( + f"Pre-fitted Gaussian parameters are not available for element symbol: '{element}'" + ) + + elif isinstance(element, (int, np.integer)): + atnum = int(element) + json_symbol = _ATNUM_TO_JSON_KEY.get(atnum) + if json_symbol is None: + raise ValueError( + f"Pre-fitted Gaussian parameters are not available for atomic number: {atnum}" + ) + else: + raise TypeError(f"element must be a string or integer; got {type(element)}") + + global _ATOMIC_GAUSS_PARAMS_CACHE + if _ATOMIC_GAUSS_PARAMS_CACHE is None: + try: + path = files("grid.data").joinpath("atomic_gauss_params.json") + with path.open("r", encoding="utf-8") as f: + _ATOMIC_GAUSS_PARAMS_CACHE = json.load(f) + except Exception as e: + raise ValueError( + f"Could not load pre-fitted Gaussian parameters from data: {e}" + ) from e + + data = _ATOMIC_GAUSS_PARAMS_CACHE[json_symbol] + coeffs_s = np.asarray(data["coeffs_s"], dtype=float) + alphas_s = np.asarray(data["alphas_s"], dtype=float) + + return coeffs_s, alphas_s diff --git a/src/grid/data/atomic_gauss_params.json b/src/grid/data/atomic_gauss_params.json new file mode 100644 index 00000000..d7e6f595 --- /dev/null +++ b/src/grid/data/atomic_gauss_params.json @@ -0,0 +1,194 @@ +{ + "H": { + "coeffs_s": [ + 2.00748526502357e-08, + 3.314086085258354e-07, + 6.414728908403625e-07, + 2.910120019422806e-06, + 1.169435093185597e-05, + 4.1850680933381154e-05, + 0.00016631725407837694, + 0.0006132764002116911, + 0.0023124173488736103, + 0.008312797303960385, + 0.028567320400773935, + 0.08757483702030483, + 0.21788912723883622, + 0.3566371897730248, + 0.2598257779286926, + 0.03697311221759376, + 0.0012855905887847435 + ], + "alphas_s": [ + 13739.0854166734, + 1829.8696247655, + 934.48913472921, + 477.230689612032, + 243.715119463182, + 124.461944187287, + 63.5609952513411, + 32.4597220758638, + 16.5767315800501, + 8.46550778330153, + 4.32321786011102, + 2.20780762884063, + 1.12749685157938, + 0.575797063890464, + 0.294051604951678, + 0.150168091845475, + 0.07668876968794858 + ] + }, + "C": { + "coeffs_s": [ + 5.894723103300583e-06, + 2.0635070043091174e-05, + 0.00018715066301433259, + 0.00036029859600310104, + 0.001988795020955914, + 0.0060704473135859685, + 0.0245314953150802, + 0.07338393107647316, + 0.23203826850409184, + 0.4702171969739957, + 0.7968878189081399, + 0.2697305408775165, + 0.24553524504245708, + 3.5153129058837447, + 0.27863778573369447 + ], + "alphas_s": [ + 26903.1860742976, + 13739.0854166734, + 3583.15866840946, + 1829.8696247655, + 934.489134729211, + 477.230689612032, + 243.715119463182, + 124.461944187287, + 63.5609952513412, + 32.4597220758638, + 16.5767315800501, + 8.46550778330153, + 1.12749685157938, + 0.575797063890465, + 0.0766887696879486 + ] + }, + "N": { + "coeffs_s": [ + 8.197232108001016e-07, + 9.997368964801968e-05, + 0.00019434755305028855, + 0.0009258494859595727, + 0.0032365377469431036, + 0.012145317606417624, + 0.04122202653070691, + 0.13128460644333742, + 0.3400527411876631, + 0.6475026339991764, + 0.6675682196705341, + 2.993596943657288, + 1.0821003670657379, + 1.12031828185087, + 0.0030724785923507457 + ], + "alphas_s": [ + 201995.358823884, + 7016.361094383, + 3583.15866840946, + 1829.8696247655, + 934.489134729211, + 477.230689612032, + 243.715119463182, + 124.461944187287, + 63.5609952513412, + 32.4597220758638, + 16.5767315800501, + 1.12749685157938, + 0.575797063890465, + 0.294051604951678, + 0.150168091845475 + ] + }, + "O": { + "coeffs_s": [ + 5.009541670630619e-06, + 1.7553971507812904e-05, + 0.00015918253361386784, + 0.0003080424448463953, + 0.001694236412541336, + 0.005216001888759684, + 0.02115298710403933, + 0.06453933153335781, + 0.20850144407008608, + 0.4454735348098692, + 0.786412336281571, + 0.3153416859276515, + 0.8815501738100202, + 4.238787122136956, + 0.261215531613026, + 1.3436858672806462 + ], + "alphas_s": [ + 52680.4659115021, + 26903.1860742975, + 7016.36109438299, + 3583.15866840945, + 1829.8696247655, + 934.48913472921, + 477.230689612032, + 243.715119463182, + 124.461944187287, + 63.5609952513411, + 32.4597220758638, + 16.5767315800501, + 2.20780762884063, + 1.12749685157938, + 0.294051604951678, + 0.150168091845475 + ] + }, + "Cl": { + "coeffs_s": [ + 6.664702268984005e-08, + 8.917187590865874e-07, + 4.64609925513115e-06, + 2.592823074586147e-06, + 6.471232236659015e-05, + 0.00010097326217239535, + 0.0007372237647551631, + 0.001892144459242878, + 0.009297899882357784, + 0.026647792671694457, + 0.10329057994254036, + 0.26096677847075644, + 0.6120984545408865, + 0.6900141284561521, + 1.3652433276964213, + 6.231393701987117, + 3.71510313011454, + 5.198668137511898 + ], + "alphas_s": [ + 2969784.65079438, + 395537.152566831, + 201995.358823884, + 103156.238855453, + 52680.4659115022, + 26903.1860742976, + 13739.0854166734, + 7016.361094383, + 3583.15866840946, + 1829.8696247655, + 934.489134729211, + 477.230689612032, + 243.715119463182, + 124.461944187287, + 16.5767315800501, + 8.46550778330153, + 0.575797063890465, + 0.294051604951678 + ] + } +} \ No newline at end of file diff --git a/src/grid/tests/test_coulomb.py b/src/grid/tests/test_coulomb.py index 9c041eca..3c8d718a 100644 --- a/src/grid/tests/test_coulomb.py +++ b/src/grid/tests/test_coulomb.py @@ -23,7 +23,12 @@ from numpy.testing import assert_allclose from scipy.special import erf -from grid.coulomb import coulomb_gaussian_p, coulomb_gaussian_s, coulomb_potential +from grid.coulomb import ( + coulomb_gaussian_p, + coulomb_gaussian_s, + coulomb_potential, + load_atomic_gaussian_params, +) def test_coulomb_gaussian_s(): @@ -99,3 +104,29 @@ def test_coulomb_potential(): v_expected += c * val assert_allclose(v_s, v_expected) + + +def test_load_atomic_gaussian_params(): + + # Helper func to check array shapes and non-negativity + def _check_params(coeffs, alphas): + assert isinstance(coeffs, np.ndarray) + assert isinstance(alphas, np.ndarray) + assert len(coeffs) == len(alphas) > 0 + assert np.all(coeffs >= 0) + assert np.all(alphas > 0) + + # Test valid elements using symbols (case-insensitive and with spaces) + for symbol in ("H", " C ", "cl", "N", "O"): + _check_params(*load_atomic_gaussian_params(symbol)) + + # Test valid elements using atomic numbers + for atnum in (1, 6, 7, 8, 17): + _check_params(*load_atomic_gaussian_params(atnum)) + + # Symbol and atomic number must resolve to identical arrays + c1, a1 = load_atomic_gaussian_params("Cl") + c2, a2 = load_atomic_gaussian_params(17) + assert_allclose(c1, c2) + assert_allclose(a1, a2) + From 552576e5b1d5c762a3a6c1411ad855bbfed0f553 Mon Sep 17 00:00:00 2001 From: Aochuba S Aier Date: Fri, 19 Jun 2026 00:46:53 +0530 Subject: [PATCH 2/8] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/grid/coulomb.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/grid/coulomb.py b/src/grid/coulomb.py index 1034d5b8..ef07afe0 100644 --- a/src/grid/coulomb.py +++ b/src/grid/coulomb.py @@ -309,7 +309,12 @@ def load_atomic_gaussian_params(element: str | int) -> tuple[np.ndarray, np.ndar f"Could not load pre-fitted Gaussian parameters from data: {e}" ) from e - data = _ATOMIC_GAUSS_PARAMS_CACHE[json_symbol] + try: + data = _ATOMIC_GAUSS_PARAMS_CACHE[json_symbol] + except KeyError as e: + raise ValueError( + f"Pre-fitted Gaussian parameters are not available for element: {json_symbol}" + ) from e coeffs_s = np.asarray(data["coeffs_s"], dtype=float) alphas_s = np.asarray(data["alphas_s"], dtype=float) From c5a32a3edb3aab495aa8f181235aa00c7baa352b Mon Sep 17 00:00:00 2001 From: aochuba Date: Fri, 19 Jun 2026 01:02:48 +0530 Subject: [PATCH 3/8] Add exception handling tests for load_atomic_gaussian_params --- src/grid/tests/test_coulomb.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/grid/tests/test_coulomb.py b/src/grid/tests/test_coulomb.py index 3c8d718a..20ee8fba 100644 --- a/src/grid/tests/test_coulomb.py +++ b/src/grid/tests/test_coulomb.py @@ -20,6 +20,7 @@ """Tests for analytical Coulomb potentials of Gaussians.""" import numpy as np +import pytest from numpy.testing import assert_allclose from scipy.special import erf @@ -130,3 +131,14 @@ def _check_params(coeffs, alphas): assert_allclose(c1, c2) assert_allclose(a1, a2) + # Error cases + with pytest.raises(ValueError, match="Pre-fitted Gaussian parameters are not available"): + load_atomic_gaussian_params("Xe") + + with pytest.raises(ValueError, match="Pre-fitted Gaussian parameters are not available"): + load_atomic_gaussian_params(2) + + with pytest.raises(TypeError, match="element must be a string or integer"): + load_atomic_gaussian_params(1.0) + + From 20ed3bbd73754225b7b765e7e009ae5204ff8c4c Mon Sep 17 00:00:00 2001 From: aochuba Date: Sat, 4 Jul 2026 00:52:33 +0530 Subject: [PATCH 4/8] Replace hardcoded _ATNUM_TO_JSON_KEY with num2sym/sym2num from utils.py --- src/grid/coulomb.py | 20 ++++++++------------ src/grid/utils.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/grid/coulomb.py b/src/grid/coulomb.py index ef07afe0..73469d0c 100644 --- a/src/grid/coulomb.py +++ b/src/grid/coulomb.py @@ -31,6 +31,8 @@ import numpy as np from scipy.special import erf +from grid.utils import num2sym, sym2num + __all__ = [ "coulomb_gaussian_p", @@ -248,13 +250,6 @@ def coulomb_potential( return V -_ATNUM_TO_JSON_KEY = { - 1: "H", - 6: "C", - 7: "N", - 8: "O", - 17: "Cl" -} _ATOMIC_GAUSS_PARAMS_CACHE: dict | None = None @@ -281,19 +276,20 @@ def load_atomic_gaussian_params(element: str | int) -> tuple[np.ndarray, np.ndar If the element parameter has an invalid type. """ if isinstance(element, str): - # title() maps e.g. "cl" -> "Cl", "H" -> "H" — matching JSON key casing exactly json_symbol = element.strip().title() - if json_symbol not in _ATNUM_TO_JSON_KEY.values(): + if json_symbol not in sym2num: raise ValueError( - f"Pre-fitted Gaussian parameters are not available for element symbol: '{element}'" + f"Unknown element symbol: '{element}'. " + f"Use a valid symbol such as 'H', 'C', 'N', 'O', 'Cl'." ) elif isinstance(element, (int, np.integer)): atnum = int(element) - json_symbol = _ATNUM_TO_JSON_KEY.get(atnum) + json_symbol = num2sym.get(atnum) if json_symbol is None: raise ValueError( - f"Pre-fitted Gaussian parameters are not available for atomic number: {atnum}" + f"Unknown atomic number: {atnum}. " + f"Must be between 1 and 118." ) else: raise TypeError(f"element must be a string or integer; got {type(element)}") diff --git a/src/grid/utils.py b/src/grid/utils.py index 956a556c..3a043ada 100644 --- a/src/grid/utils.py +++ b/src/grid/utils.py @@ -1056,3 +1056,39 @@ def dipole_moment_of_molecule(grid, density: np.ndarray, coords: np.ndarray, cha result = (result - integrals.T).flatten()[1:] return result + + +# --------------------------------------------------------------------------- +# Periodic table lookups — copied from iodata/periodic.py (theochem/iodata) +# --------------------------------------------------------------------------- + +num2sym: dict[int, str] = { + 1: "H", 2: "He", 3: "Li", 4: "Be", 5: "B", + 6: "C", 7: "N", 8: "O", 9: "F", 10: "Ne", + 11: "Na", 12: "Mg", 13: "Al", 14: "Si", 15: "P", + 16: "S", 17: "Cl", 18: "Ar", 19: "K", 20: "Ca", + 21: "Sc", 22: "Ti", 23: "V", 24: "Cr", 25: "Mn", + 26: "Fe", 27: "Co", 28: "Ni", 29: "Cu", 30: "Zn", + 31: "Ga", 32: "Ge", 33: "As", 34: "Se", 35: "Br", + 36: "Kr", 37: "Rb", 38: "Sr", 39: "Y", 40: "Zr", + 41: "Nb", 42: "Mo", 43: "Tc", 44: "Ru", 45: "Rh", + 46: "Pd", 47: "Ag", 48: "Cd", 49: "In", 50: "Sn", + 51: "Sb", 52: "Te", 53: "I", 54: "Xe", 55: "Cs", + 56: "Ba", 57: "La", 58: "Ce", 59: "Pr", 60: "Nd", + 61: "Pm", 62: "Sm", 63: "Eu", 64: "Gd", 65: "Tb", + 66: "Dy", 67: "Ho", 68: "Er", 69: "Tm", 70: "Yb", + 71: "Lu", 72: "Hf", 73: "Ta", 74: "W", 75: "Re", + 76: "Os", 77: "Ir", 78: "Pt", 79: "Au", 80: "Hg", + 81: "Tl", 82: "Pb", 83: "Bi", 84: "Po", 85: "At", + 86: "Rn", 87: "Fr", 88: "Ra", 89: "Ac", 90: "Th", + 91: "Pa", 92: "U", 93: "Np", 94: "Pu", 95: "Am", + 96: "Cm", 97: "Bk", 98: "Cf", 99: "Es", 100: "Fm", + 101: "Md", 102: "No", 103: "Lr", 104: "Rf", 105: "Db", + 106: "Sg", 107: "Bh", 108: "Hs", 109: "Mt", 110: "Ds", + 111: "Rg", 112: "Cn", 113: "Nh", 114: "Fl", 115: "Mc", + 116: "Lv", 117: "Ts", 118: "Og", +} +"""Mapping from atomic number (int) to element symbol (str).""" + +sym2num: dict[str, int] = {v: k for k, v in num2sym.items()} +"""Mapping from element symbol (str) to atomic number (int).""" From c0060e6cd56d39071adcbb27cb49404094d25e76 Mon Sep 17 00:00:00 2001 From: Aochuba S Aier Date: Sat, 4 Jul 2026 00:57:23 +0530 Subject: [PATCH 5/8] Refactor periodic table lookups for clarity Updated the periodic table lookups --- src/grid/utils.py | 151 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 121 insertions(+), 30 deletions(-) diff --git a/src/grid/utils.py b/src/grid/utils.py index 3a043ada..e947647c 100644 --- a/src/grid/utils.py +++ b/src/grid/utils.py @@ -1058,37 +1058,128 @@ def dipole_moment_of_molecule(grid, density: np.ndarray, coords: np.ndarray, cha return result -# --------------------------------------------------------------------------- -# Periodic table lookups — copied from iodata/periodic.py (theochem/iodata) -# --------------------------------------------------------------------------- +# Periodic table lookups +# Periodic table lookups num2sym: dict[int, str] = { - 1: "H", 2: "He", 3: "Li", 4: "Be", 5: "B", - 6: "C", 7: "N", 8: "O", 9: "F", 10: "Ne", - 11: "Na", 12: "Mg", 13: "Al", 14: "Si", 15: "P", - 16: "S", 17: "Cl", 18: "Ar", 19: "K", 20: "Ca", - 21: "Sc", 22: "Ti", 23: "V", 24: "Cr", 25: "Mn", - 26: "Fe", 27: "Co", 28: "Ni", 29: "Cu", 30: "Zn", - 31: "Ga", 32: "Ge", 33: "As", 34: "Se", 35: "Br", - 36: "Kr", 37: "Rb", 38: "Sr", 39: "Y", 40: "Zr", - 41: "Nb", 42: "Mo", 43: "Tc", 44: "Ru", 45: "Rh", - 46: "Pd", 47: "Ag", 48: "Cd", 49: "In", 50: "Sn", - 51: "Sb", 52: "Te", 53: "I", 54: "Xe", 55: "Cs", - 56: "Ba", 57: "La", 58: "Ce", 59: "Pr", 60: "Nd", - 61: "Pm", 62: "Sm", 63: "Eu", 64: "Gd", 65: "Tb", - 66: "Dy", 67: "Ho", 68: "Er", 69: "Tm", 70: "Yb", - 71: "Lu", 72: "Hf", 73: "Ta", 74: "W", 75: "Re", - 76: "Os", 77: "Ir", 78: "Pt", 79: "Au", 80: "Hg", - 81: "Tl", 82: "Pb", 83: "Bi", 84: "Po", 85: "At", - 86: "Rn", 87: "Fr", 88: "Ra", 89: "Ac", 90: "Th", - 91: "Pa", 92: "U", 93: "Np", 94: "Pu", 95: "Am", - 96: "Cm", 97: "Bk", 98: "Cf", 99: "Es", 100: "Fm", - 101: "Md", 102: "No", 103: "Lr", 104: "Rf", 105: "Db", - 106: "Sg", 107: "Bh", 108: "Hs", 109: "Mt", 110: "Ds", - 111: "Rg", 112: "Cn", 113: "Nh", 114: "Fl", 115: "Mc", - 116: "Lv", 117: "Ts", 118: "Og", + 1: "H", + 2: "He", + 3: "Li", + 4: "Be", + 5: "B", + 6: "C", + 7: "N", + 8: "O", + 9: "F", + 10: "Ne", + 11: "Na", + 12: "Mg", + 13: "Al", + 14: "Si", + 15: "P", + 16: "S", + 17: "Cl", + 18: "Ar", + 19: "K", + 20: "Ca", + 21: "Sc", + 22: "Ti", + 23: "V", + 24: "Cr", + 25: "Mn", + 26: "Fe", + 27: "Co", + 28: "Ni", + 29: "Cu", + 30: "Zn", + 31: "Ga", + 32: "Ge", + 33: "As", + 34: "Se", + 35: "Br", + 36: "Kr", + 37: "Rb", + 38: "Sr", + 39: "Y", + 40: "Zr", + 41: "Nb", + 42: "Mo", + 43: "Tc", + 44: "Ru", + 45: "Rh", + 46: "Pd", + 47: "Ag", + 48: "Cd", + 49: "In", + 50: "Sn", + 51: "Sb", + 52: "Te", + 53: "I", + 54: "Xe", + 55: "Cs", + 56: "Ba", + 57: "La", + 58: "Ce", + 59: "Pr", + 60: "Nd", + 61: "Pm", + 62: "Sm", + 63: "Eu", + 64: "Gd", + 65: "Tb", + 66: "Dy", + 67: "Ho", + 68: "Er", + 69: "Tm", + 70: "Yb", + 71: "Lu", + 72: "Hf", + 73: "Ta", + 74: "W", + 75: "Re", + 76: "Os", + 77: "Ir", + 78: "Pt", + 79: "Au", + 80: "Hg", + 81: "Tl", + 82: "Pb", + 83: "Bi", + 84: "Po", + 85: "At", + 86: "Rn", + 87: "Fr", + 88: "Ra", + 89: "Ac", + 90: "Th", + 91: "Pa", + 92: "U", + 93: "Np", + 94: "Pu", + 95: "Am", + 96: "Cm", + 97: "Bk", + 98: "Cf", + 99: "Es", + 100: "Fm", + 101: "Md", + 102: "No", + 103: "Lr", + 104: "Rf", + 105: "Db", + 106: "Sg", + 107: "Bh", + 108: "Hs", + 109: "Mt", + 110: "Ds", + 111: "Rg", + 112: "Cn", + 113: "Nh", + 114: "Fl", + 115: "Mc", + 116: "Lv", + 117: "Ts", + 118: "Og", } -"""Mapping from atomic number (int) to element symbol (str).""" -sym2num: dict[str, int] = {v: k for k, v in num2sym.items()} -"""Mapping from element symbol (str) to atomic number (int).""" +sym2num: dict[str, int] = {value: key for key, value in num2sym.items()} From ffa87e9758beef6d57a4114352cca80fd107f938 Mon Sep 17 00:00:00 2001 From: Aochuba S Aier Date: Sat, 4 Jul 2026 00:58:48 +0530 Subject: [PATCH 6/8] Update utils.py extra comment --- src/grid/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/grid/utils.py b/src/grid/utils.py index e947647c..3f4ddd95 100644 --- a/src/grid/utils.py +++ b/src/grid/utils.py @@ -1058,8 +1058,6 @@ def dipole_moment_of_molecule(grid, density: np.ndarray, coords: np.ndarray, cha return result - -# Periodic table lookups # Periodic table lookups num2sym: dict[int, str] = { 1: "H", From b52f4274ec8dfe152c18fd1c2cb2b468803e920a Mon Sep 17 00:00:00 2001 From: Aochuba S Aier Date: Wed, 8 Jul 2026 10:05:27 +0530 Subject: [PATCH 7/8] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/grid/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grid/utils.py b/src/grid/utils.py index 3f4ddd95..15e99431 100644 --- a/src/grid/utils.py +++ b/src/grid/utils.py @@ -1058,7 +1058,7 @@ def dipole_moment_of_molecule(grid, density: np.ndarray, coords: np.ndarray, cha return result -# Periodic table lookups +# Periodic table lookups num2sym: dict[int, str] = { 1: "H", 2: "He", From e5ea34f5a59d1e4cd8235b7fab7312e70a847467 Mon Sep 17 00:00:00 2001 From: aochuba Date: Wed, 8 Jul 2026 10:23:39 +0530 Subject: [PATCH 8/8] white spacing fix --- src/grid/tests/test_coulomb.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/grid/tests/test_coulomb.py b/src/grid/tests/test_coulomb.py index 8fccb624..815ddcae 100644 --- a/src/grid/tests/test_coulomb.py +++ b/src/grid/tests/test_coulomb.py @@ -115,7 +115,7 @@ def _check_params(coeffs, alphas): assert len(coeffs) == len(alphas) > 0 assert np.all(coeffs >= 0) assert np.all(alphas > 0) - + # Test valid elements using symbols (case-insensitive and with spaces) for symbol in ("H", " C ", "cl", "N", "O"): _check_params(*load_atomic_gaussian_params(symbol)) @@ -133,11 +133,9 @@ def _check_params(coeffs, alphas): # Error cases with pytest.raises(ValueError, match="Pre-fitted Gaussian parameters are not available"): load_atomic_gaussian_params("Xe") - + with pytest.raises(ValueError, match="Pre-fitted Gaussian parameters are not available"): load_atomic_gaussian_params(2) - + with pytest.raises(TypeError, match="element must be a string or integer"): load_atomic_gaussian_params(1.0) - -