From f14d792ce3bff29be451abd0e1fe12144f1741c2 Mon Sep 17 00:00:00 2001 From: Moritz Gubler Date: Fri, 12 Jul 2024 22:35:16 +0200 Subject: [PATCH] test for valid input --- pyqint/cgf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyqint/cgf.py b/pyqint/cgf.py index e8fbcc1..3765c3c 100644 --- a/pyqint/cgf.py +++ b/pyqint/cgf.py @@ -55,6 +55,8 @@ def add_spherical_gto(self, c, alpha, l, m): l and m are the coefficients of the requested spherical harmonic function. l must be <= 6 and -l <= m <= l. """ + if not l <= 6 or not abs(m) <=l: + raise ValueError("l must be <= 6 and -l <= m <= l") for gto in sh.spherical_harmonics[l][m]: self.add_gto(gto[0] * c, alpha, gto[1][0], gto[1][1], gto[1][2])