Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ include LICENSE
include grid.data/*.*
include grid.data.lebedev/*.npz
include grid.data.spherical_design/*.npz
include grid.data.maxdet/*.npz
include grid.data.prune_grid/*.npz
include grid.data.proatoms/*.npz
39 changes: 31 additions & 8 deletions src/grid/angular.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,18 @@
52328: 323,
52978: 325,
}
MAX_DET_NPOINTS = {(degree + 1) ** 2: degree for degree in range(1, 200)}


# Lebedev/Spherical dictionary of grid's degrees (keys) and numbers of points (values)
LEBEDEV_DEGREES = dict([(v, k) for k, v in LEBEDEV_NPOINTS.items()])
SPHERICAL_DEGREES = dict([(v, k) for k, v in SPHERICAL_NPOINTS.items()])
MAX_DET_DEGREES = dict([(v, k) for k, v in MAX_DET_NPOINTS.items()])

# Cache is used to store the angular grid
LEBEDEV_CACHE = {}
SPHERICAL_CACHE = {}
MAX_DET_CACHE = {}


class AngularGrid(Grid):
Expand Down Expand Up @@ -332,8 +336,9 @@ def __init__(
If True, then store the points and weights of the AngularGrid in cache
to avoid duplicate grids that have the same `degree`\.
method: str, optional, keyword-only
Method for constructing the angular grid. Options are "lebedev" (for Lebedev-Laikov)
and "spherical" (for symmetric spherical t-design).
Method for constructing the angular grid. Options are "lebedev" (for Lebedev-Laikov),
"spherical" (for symmetric spherical t-design), and "maxdet" (for maximum determinant
grids).

Returns
-------
Expand All @@ -353,8 +358,12 @@ def __init__(
cache_dict = LEBEDEV_CACHE
elif method == "spherical":
cache_dict = SPHERICAL_CACHE
elif method == "maxdet":
cache_dict = MAX_DET_CACHE
else:
raise ValueError(f"Method {method} is not supported, choose 'lebedev' or 'spherical'")
raise ValueError(
f"Method {method} is not supported, choose 'lebedev', 'spherical' or 'maxdet'"
)

# allow only one of degree or size to be given
if size is not None:
Expand Down Expand Up @@ -382,7 +391,11 @@ def __init__(
self._degree = degree
# Multiply weights by 4 pi, so that the spherical harmonics are orthonormal,
# etc. \int Y_l1 Y_l2 = \delta_{l1, l2}
super().__init__(points, weights * 4 * np.pi)
# (not necessary for maxdet, already normalized to 4 pi / N)
if method == "maxdet":
super().__init__(points, weights)
else:
super().__init__(points, weights * 4 * np.pi)

if method == "lebedev" and np.any(weights < 0.0):
# Lebedev degrees 13, 25, 27 have negative weights. Symmetric spherical t-design
Expand Down Expand Up @@ -448,8 +461,9 @@ def _get_degree_and_size(degree: int | None, size: int | None, method: str):
degree is used for constructing the grid. Use None, if `degree` is given. If both
`degree` and `size` are given `degree` is used for constructing the grid.
method: str
Method for constructing the angular grid. Options are "lebedev" (for Lebedev-Laikov)
and "spherical" (for symmetric spherical t-design).
Method for constructing the angular grid. Options are "lebedev" (for Lebedev-Laikov),
"spherical" (for symmetric spherical t-design), and "maxdet" (for maximum determinant
grids).

Returns
-------
Expand All @@ -464,8 +478,12 @@ def _get_degree_and_size(degree: int | None, size: int | None, method: str):
dict_degrees, dict_npoints = LEBEDEV_DEGREES, LEBEDEV_NPOINTS
elif method == "spherical":
dict_degrees, dict_npoints = SPHERICAL_DEGREES, SPHERICAL_NPOINTS
elif method == "maxdet":
dict_degrees, dict_npoints = MAX_DET_DEGREES, MAX_DET_NPOINTS
else:
raise ValueError(f"Method {method} is not supported, choose 'lebedev' or 'spherical'")
raise ValueError(
f"Method {method} is not supported, choose 'lebedev', 'spherical' or 'maxdet'"
)

# check whether degree and size are valid
if not (degree is None or (isinstance(degree, (int, np.integer)) and degree >= 0)):
Expand Down Expand Up @@ -535,8 +553,13 @@ def _load_precomputed_angular_grid(degree: int, size: int, method: str):
elif method == "spherical":
dict_degrees, dict_npoints = SPHERICAL_DEGREES, SPHERICAL_NPOINTS
file_path = "grid.data.spherical_design"
elif method == "maxdet":
dict_degrees, dict_npoints = MAX_DET_DEGREES, MAX_DET_NPOINTS
file_path = "grid.data.maxdet"
Comment thread
marco-2023 marked this conversation as resolved.
else:
raise ValueError(f"Method {method} is not supported, choose 'lebedev' or 'spherical'")
raise ValueError(
f"Method {method} is not supported, choose 'lebedev', 'spherical', or 'maxdet'"
)

# check whether degree and size are valid
if not (degree is None or (isinstance(degree, (int, np.integer)) and degree >= 0)):
Expand Down
23 changes: 23 additions & 0 deletions src/grid/data/maxdet/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
r"""
Maximum Determinant points on the sphere.

These were obtained from `https://web.maths.unsw.edu.au/~rsw/Sphere/MaxDet/MaxDet1.html`.

The weights are the ones in the data files. For this, the sum of the weights is 4*pi.

References
----------
.. [1] I. H. Sloan and R. S. Womersley, "How good can polynomial interpolation on the sphere
be?", Advances in Computational Mathematics 14 (2001), 195-226.

.. [2] I. H. Sloan and R. S. Womersley, "Extremal systems of points and numerical
integration on the sphere", Advances in Computational Mathematics 21 (2004), 107-125.

.. [3] J. Marzo and J. Ortega-Cerda, "Equidistribution of Fekete Points on the Sphere",
Constructive Approximation 32 (2010), 513-521.
https://link.springer.com/article/10.1007/s00365-009-9051-5

.. [4] S. V. Borodachov, D. P. Hardin, and E. B. Saff, Discrete Energy on Rectifiable Sets,
Springer Monographs in Mathematics, Springer, 2019.
https://www.springer.com/gp/book/9780387848075
"""
Binary file added src/grid/data/maxdet/maxdet_100_10201.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_101_10404.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_102_10609.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_103_10816.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_104_11025.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_105_11236.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_106_11449.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_107_11664.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_108_11881.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_109_12100.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_10_121.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_110_12321.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_111_12544.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_112_12769.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_113_12996.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_114_13225.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_115_13456.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_116_13689.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_117_13924.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_118_14161.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_119_14400.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_11_144.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_120_14641.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_121_14884.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_122_15129.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_123_15376.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_124_15625.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_125_15876.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_126_16129.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_127_16384.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_128_16641.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_129_16900.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_12_169.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_130_17161.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_131_17424.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_132_17689.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_133_17956.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_134_18225.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_135_18496.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_136_18769.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_137_19044.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_138_19321.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_139_19600.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_13_196.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_140_19881.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_141_20164.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_142_20449.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_143_20736.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_144_21025.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_145_21316.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_146_21609.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_147_21904.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_148_22201.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_149_22500.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_14_225.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_150_22801.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_151_23104.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_152_23409.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_153_23716.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_154_24025.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_155_24336.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_156_24649.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_157_24964.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_158_25281.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_159_25600.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_15_256.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_160_25921.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_161_26244.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_162_26569.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_163_26896.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_164_27225.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_165_27556.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_166_27889.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_167_28224.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_168_28561.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_169_28900.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_16_289.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_170_29241.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_171_29584.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_172_29929.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_173_30276.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_174_30625.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_175_30976.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_176_31329.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_177_31684.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_178_32041.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_179_32400.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_17_324.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_180_32761.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_181_33124.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_182_33489.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_183_33856.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_184_34225.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_185_34596.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_186_34969.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_187_35344.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_188_35721.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_189_36100.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_18_361.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_190_36481.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_191_36864.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_192_37249.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_193_37636.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_194_38025.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_195_38416.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_196_38809.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_197_39204.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_198_39601.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_199_40000.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_19_400.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_1_4.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_200_40401.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_20_441.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_21_484.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_22_529.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_23_576.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_24_625.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_25_676.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_26_729.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_27_784.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_28_841.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_29_900.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_2_9.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_30_961.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_31_1024.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_32_1089.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_33_1156.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_34_1225.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_35_1296.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_36_1369.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_37_1444.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_38_1521.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_39_1600.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_3_16.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_40_1681.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_41_1764.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_42_1849.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_43_1936.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_44_2025.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_45_2116.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_46_2209.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_47_2304.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_48_2401.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_49_2500.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_4_25.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_50_2601.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_51_2704.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_52_2809.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_53_2916.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_54_3025.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_55_3136.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_56_3249.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_57_3364.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_58_3481.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_59_3600.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_5_36.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_60_3721.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_61_3844.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_62_3969.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_63_4096.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_64_4225.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_65_4356.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_66_4489.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_67_4624.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_68_4761.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_69_4900.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_6_49.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_70_5041.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_71_5184.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_72_5329.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_73_5476.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_74_5625.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_75_5776.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_76_5929.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_77_6084.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_78_6241.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_79_6400.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_7_64.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_80_6561.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_81_6724.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_82_6889.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_83_7056.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_84_7225.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_85_7396.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_86_7569.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_87_7744.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_88_7921.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_89_8100.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_8_81.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_90_8281.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_91_8464.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_92_8649.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_93_8836.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_94_9025.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_95_9216.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_96_9409.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_97_9604.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_98_9801.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_99_10000.npz
Binary file not shown.
Binary file added src/grid/data/maxdet/maxdet_9_100.npz
Binary file not shown.
7 changes: 3 additions & 4 deletions src/grid/tests/test_angular.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# --
"""Test lebedev grid."""


from unittest import TestCase

import numpy as np
Expand Down Expand Up @@ -127,7 +126,7 @@ def test_errors_and_warnings(self):


@pytest.mark.parametrize("degree", [5, 10, 100])
@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_integration_of_spherical_harmonic_up_to_degree(degree, method):
r"""Test integration of spherical harmonic is accurate."""
grid = AngularGrid(degree=degree, method=method)
Comment thread
marco-2023 marked this conversation as resolved.
Expand All @@ -148,7 +147,7 @@ def test_integration_of_spherical_harmonic_up_to_degree(degree, method):
assert_almost_equal(0.0, grid.integrate(sph_harm_one[m_ord, :]))


@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_integration_of_spherical_harmonic_not_accurate_beyond_degree(method):
r"""Test integration of spherical harmonic of degree higher than grid is not accurate."""
grid = AngularGrid(degree=3, method=method)
Expand All @@ -163,7 +162,7 @@ def test_integration_of_spherical_harmonic_not_accurate_beyond_degree(method):
assert np.abs(grid.integrate(sph_harm[(6) ** 2, :])) > 1e-8


@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_orthogonality_of_spherical_harmonic_up_to_degree_three(method):
r"""Test orthogonality of spherical harmonic up to degree 3 is accurate."""
degree = 3
Expand Down
34 changes: 20 additions & 14 deletions src/grid/tests/test_atomgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from scipy.spatial.transform import Rotation as R
from scipy.integrate import trapezoid

from grid.angular import LEBEDEV_DEGREES, AngularGrid
from grid.angular import LEBEDEV_DEGREES, SPHERICAL_DEGREES, MAX_DET_DEGREES, AngularGrid
from grid.atomgrid import AtomGrid, _get_rgrid_size
from grid.basegrid import Grid, OneDGrid
from grid.onedgrid import GaussLaguerre, GaussLegendre, UniformInteger
Expand Down Expand Up @@ -280,7 +280,7 @@ def test_atomic_rotate(self):
rot_mt = R.random(random_state=atgrid2.rotate + i).as_matrix()
assert_allclose(rot_shell, non_rot_shell @ rot_mt)

@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_get_shell_grid(self, method):
"""Test angular grid get from get_shell_grid function."""
rad_pts = np.array([0.1, 0.5, 1])
Expand Down Expand Up @@ -334,22 +334,28 @@ def test_convert_points_to_sph(self):
assert_allclose(np.array([r, theta, phi]).reshape(-1, 3), calc_sph)

@pytest.mark.filterwarnings("ignore:Lebedev weights are negative which can*")
@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_spherical_complete(self, method):
"""Test atomic grid consistence for spherical integral."""
num_pts = len(LEBEDEV_DEGREES)
pts = UniformInteger(num_pts)
degree_maps = {
"lebedev": LEBEDEV_DEGREES,
"spherical": SPHERICAL_DEGREES,
"maxdet": MAX_DET_DEGREES,
}
degree_map = degree_maps[method]
num_shells = len(degree_map)
pts = UniformInteger(num_shells)
for _ in range(10):
start = np.random.rand() * 1e-5
end = np.random.rand() * 10 + 10
tf = PowerRTransform(start, end)
rad_grid = tf.transform_1d_grid(pts)
atgrid = AtomGrid(
rad_grid,
degrees=list(LEBEDEV_DEGREES.keys()),
degrees=list(degree_map.keys()),
method=method,
)
values = np.random.rand(len(LEBEDEV_DEGREES))
values = np.random.rand(len(degree_map))
pt_val = np.zeros(atgrid.size)
for index, value in enumerate(values):
pt_val[atgrid._indices[index] : atgrid._indices[index + 1]] = value
Expand Down Expand Up @@ -391,7 +397,7 @@ def helper_func_power_deriv(self, points):
dzf = 8 * points[:, 2] * points[:, 2] / r
return dxf + dyf + dzf

@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_integrating_angular_components_spherical(self, method):
"""Test integrating angular components of a spherical harmonics of maximum degree 3."""
odg = OneDGrid(np.array([0.0, 1e-16, 1e-8, 1e-4, 1e-2]), np.ones(5), (0, np.inf))
Expand Down Expand Up @@ -463,7 +469,7 @@ def test_integrating_angular_components_with_offcentered_gaussian(self, numb_rad
assert np.all(integrals[2, :] < 1e-5) # px, py-orbital should be zero
assert np.all(integrals[3, :] < 1e-5)

@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_fitting_spherical_harmonics(self, method):
r"""Test fitting the radial components of spherical harmonics is just a one, rest zeros."""
max_degree = 10 # Maximum degree
Expand Down Expand Up @@ -496,7 +502,7 @@ def test_fitting_spherical_harmonics(self, method):
assert_almost_equal(radial_comp(radial_pts), 0.0, decimal=8)
i += 1

@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_fitting_product_of_spherical_harmonic(self, method):
r"""Test fitting the radial components of r**2 times spherical harmonic."""
max_degree = 7 # Maximum degree
Expand Down Expand Up @@ -567,7 +573,7 @@ def func(sph_points):
assert_almost_equal(fit[counter](radial_pts, 2), 0.0)
counter += 1

@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_value_fitting(self, method):
"""Test spline projection the same as spherical harmonics."""
odg = OneDGrid(np.arange(10) + 1, np.ones(10), (0, np.inf))
Expand Down Expand Up @@ -618,7 +624,7 @@ def test_interpolation_of_gaussian(self, centers):
self.helper_func_gauss(input_points, centers), interfunc(input_points), atol=1e-3
)

@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_cubicspline_and_interp_mol(self, method):
"""Test cubicspline interpolation values."""
odg = OneDGrid(np.arange(10) + 1, np.ones(10), (0, np.inf))
Expand Down Expand Up @@ -662,7 +668,7 @@ def test_cubicspline_and_interp(self):
interp_func = atgrid.interpolate(values)
assert_allclose(interp_func(xyz), ref_value)

@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_spherical_average_of_gaussian(self, method):
r"""Test spherical average of a Gaussian (radial) function is itself and its integral."""

Expand Down Expand Up @@ -728,7 +734,7 @@ def func(sph_points):
assert_allclose(spherical_avg2, 0.0, atol=1e-4)

@pytest.mark.filterwarnings("ignore:Lebedev weights are negative which can*")
@pytest.mark.parametrize("method", ["lebedev", "spherical"])
@pytest.mark.parametrize("method", ["lebedev", "spherical", "maxdet"])
def test_interpolate_and_its_derivatives_on_polynomial(self, method):
"""Test interpolation of derivative of polynomial function."""
odg = OneDGrid(np.linspace(0.01, 10, num=50), np.ones(50), (0, np.inf))
Expand Down
Loading