From 2388993def7d176a0e313bea5227f4bb160e252f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 22:01:34 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- gbasis/wrappers.py | 104 +++++++++++++++++++++++++++------- tests/h2o_hf_ccpv5z_cart.fchk | 16 +++--- tests/h2o_hf_ccpv5z_sph.fchk | 14 ++--- tests/test_libcint.py | 12 ++-- 4 files changed, 104 insertions(+), 42 deletions(-) diff --git a/gbasis/wrappers.py b/gbasis/wrappers.py index 8dde49aa..833f9a1a 100644 --- a/gbasis/wrappers.py +++ b/gbasis/wrappers.py @@ -4,27 +4,88 @@ CONVENTIONS_LIBCINT = { - (5, 'p'): ['s5','s4', 's3', 's2', 's1', 'c0', 'c1', 'c2', 'c3', 'c4','c5'], - (4, 'p'): ['s4','s3', 's2', 's1', 'c0', 'c1', 'c2', 'c3', 'c4'], - (3, 'p'): ['s3', 's2', 's1', 'c0', 'c1', 'c2', 'c3'], - (2, 'p'): ['s2', 's1', 'c0', 'c1', 'c2'], - (0, 'c'): ['1'], - (1, 'c'): ['x', 'y', 'z'], - (2, 'c'): ['xx', 'xy', 'xz', 'yy', 'yz', 'zz'], - (3, 'c'): ['xxx', 'xxy', 'xxz', 'xyy', 'xyz', 'xzz', 'yyy', 'yyz', 'yzz', 'zzz'], - (4, 'c'): ['xxxx', 'xxxy', 'xxxz', 'xxyy', 'xxyz', 'xxzz', 'xyyy', 'xyyz', 'xyzz', - 'xzzz', 'yyyy', 'yyyz', 'yyzz', 'yzzz', 'zzzz'], - (5, 'c'): ['xxxxx', 'xxxxy', 'xxxxz', 'xxxyy', 'xxxyz', 'xxxzz', 'xxyyy', 'xxyyz', 'xxyzz', - 'xxzzz', 'xyyyy', 'xyyyz', 'xyyzz', 'xyzzz', 'xzzzz', 'yyyyy', 'yyyyz', 'yyyzz', - 'yyzzz', 'yzzzz', 'zzzzz'], - (6, 'c'): ['xxxxxx', 'xxxxxy', 'xxxxxz', 'xxxxyy', 'xxxxyz', 'xxxxzz', 'xxxyyy', - 'xxxyyz', 'xxxyzz', 'xxxzzz', 'xxyyyy', 'xxyyyz', 'xxyyzz', 'xxyzzz', - 'xxzzzz', 'xyyyyy', 'xyyyyz', 'xyyyzz', 'xyyzzz', 'xyzzzz', 'xzzzzz', - 'yyyyyy', 'yyyyyz', 'yyyyzz', 'yyyzzz', 'yyzzzz', 'yzzzzz', 'zzzzzz'], + (5, "p"): ["s5", "s4", "s3", "s2", "s1", "c0", "c1", "c2", "c3", "c4", "c5"], + (4, "p"): ["s4", "s3", "s2", "s1", "c0", "c1", "c2", "c3", "c4"], + (3, "p"): ["s3", "s2", "s1", "c0", "c1", "c2", "c3"], + (2, "p"): ["s2", "s1", "c0", "c1", "c2"], + (0, "c"): ["1"], + (1, "c"): ["x", "y", "z"], + (2, "c"): ["xx", "xy", "xz", "yy", "yz", "zz"], + (3, "c"): ["xxx", "xxy", "xxz", "xyy", "xyz", "xzz", "yyy", "yyz", "yzz", "zzz"], + (4, "c"): [ + "xxxx", + "xxxy", + "xxxz", + "xxyy", + "xxyz", + "xxzz", + "xyyy", + "xyyz", + "xyzz", + "xzzz", + "yyyy", + "yyyz", + "yyzz", + "yzzz", + "zzzz", + ], + (5, "c"): [ + "xxxxx", + "xxxxy", + "xxxxz", + "xxxyy", + "xxxyz", + "xxxzz", + "xxyyy", + "xxyyz", + "xxyzz", + "xxzzz", + "xyyyy", + "xyyyz", + "xyyzz", + "xyzzz", + "xzzzz", + "yyyyy", + "yyyyz", + "yyyzz", + "yyzzz", + "yzzzz", + "zzzzz", + ], + (6, "c"): [ + "xxxxxx", + "xxxxxy", + "xxxxxz", + "xxxxyy", + "xxxxyz", + "xxxxzz", + "xxxyyy", + "xxxyyz", + "xxxyzz", + "xxxzzz", + "xxyyyy", + "xxyyyz", + "xxyyzz", + "xxyzzz", + "xxzzzz", + "xyyyyy", + "xyyyyz", + "xyyyzz", + "xyyzzz", + "xyzzzz", + "xzzzzz", + "yyyyyy", + "yyyyyz", + "yyyyzz", + "yyyzzz", + "yyzzzz", + "yzzzzz", + "zzzzzz", + ], } -def from_iodata(mol, tol=1e-20, overlap=False): +def from_iodata(mol, tol=1e-20, overlap=False): """Return basis set stored within the `IOData` instance in `iodata`. Parameters @@ -154,10 +215,10 @@ def permutation_libcint(self): angmom = self.angmom if self.coord_type == "cartesian": - coord_type = 'c' + coord_type = "c" iodata_shell_convention = cart_conventions[angmom] - elif self.coord_type == 'spherical': - coord_type = 'p' + elif self.coord_type == "spherical": + coord_type = "p" iodata_shell_convention = sph_conventions[angmom] # Get libcint convention @@ -167,7 +228,6 @@ def permutation_libcint(self): return permutation - if molbasis.primitive_normalization != "L2": # pragma: no cover raise ValueError( "Only L2 normalization scheme is supported in `gbasis`. Given `IOData` instance uses " diff --git a/tests/h2o_hf_ccpv5z_cart.fchk b/tests/h2o_hf_ccpv5z_cart.fchk index 58a419c5..ab935eb4 100644 --- a/tests/h2o_hf_ccpv5z_cart.fchk +++ b/tests/h2o_hf_ccpv5z_cart.fchk @@ -1,14 +1,14 @@ -0015_H2O/0015_q000_m01_k00_opt_hf_ccpv5z opt-stable -SP RHF CC-pV5Z +0015_H2O/0015_q000_m01_k00_opt_hf_ccpv5z opt-stable +SP RHF CC-pV5Z Number of atoms I 3 Info1-9 I N= 9 12 12 0 0 0 110 1 1 2 Full Title C N= 5 -0015_H2O/0015_q000_m01_k00_opt_hf_ccpv5z opt-stable +0015_H2O/0015_q000_m01_k00_opt_hf_ccpv5z opt-stable Route C N= 10 -#p hf/cc-pv5z 6d/10f scf=tight scf=(maxcycle=900,xqc,fermi) -integral=grid=ultrafine symmetry=None density=current +#p hf/cc-pv5z 6d/10f scf=tight scf=(maxcycle=900,xqc,fermi) +integral=grid=ultrafine symmetry=None density=current Charge I 0 Multiplicity I 1 Number of electrons I 10 @@ -30,7 +30,7 @@ Int Atom Types I N= 3 0 0 0 Force Field I 0 Atom Types C N= 3 - + MM charges R N= 3 0.00000000E+00 0.00000000E+00 0.00000000E+00 Integer atomic weights I N= 3 @@ -21541,7 +21541,7 @@ Int Atom Modified Types I N= 3 0 0 0 Force Field I 0 Atom Modified Types C N= 3 - + Link Atoms I N= 3 0 0 0 Atom Modified MM Charges R N= 3 @@ -22418,4 +22418,4 @@ ClPar Real Params R N= 3200 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 Gaussian Version C N= 2 -ES64L-G16RevC.01 +ES64L-G16RevC.01 diff --git a/tests/h2o_hf_ccpv5z_sph.fchk b/tests/h2o_hf_ccpv5z_sph.fchk index 254309f4..bcb1c3d9 100644 --- a/tests/h2o_hf_ccpv5z_sph.fchk +++ b/tests/h2o_hf_ccpv5z_sph.fchk @@ -1,15 +1,15 @@ -0015_H2O/0015_q000_m01_k00_opt_hf_ccpv5z opt-stable -Force RHF CC-pV5Z +0015_H2O/0015_q000_m01_k00_opt_hf_ccpv5z opt-stable +Force RHF CC-pV5Z Number of atoms I 3 Info1-9 I N= 9 13 9 0 0 0 100 5 1 2 Full Title C N= 5 -0015_H2O/0015_q000_m01_k00_opt_hf_ccpv5z opt-stable +0015_H2O/0015_q000_m01_k00_opt_hf_ccpv5z opt-stable Route C N= 15 #p hf/cc-pv5z 5d/7f force guess=read geom=check scf=(maxcycl e=900,verytightlineq,xqc) integral=grid=ultrafine symmetry=N -one density=current pop=(cm5,hlygat,mbs,npa) output=wfx +one density=current pop=(cm5,hlygat,mbs,npa) output=wfx Charge I 0 Multiplicity I 1 Number of electrons I 10 @@ -31,7 +31,7 @@ Int Atom Types I N= 3 0 0 0 Force Field I 0 Atom Types C N= 3 - + MM charges R N= 3 0.00000000E+00 0.00000000E+00 0.00000000E+00 Integer atomic weights I N= 3 @@ -20512,7 +20512,7 @@ Int Atom Modified Types I N= 3 0 0 0 Force Field I 0 Atom Modified Types C N= 3 - + Link Atoms I N= 3 0 0 0 Atom Modified MM Charges R N= 3 @@ -21389,4 +21389,4 @@ ClPar Real Params R N= 3200 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 Gaussian Version C N= 2 -ES64L-G16RevC.01 +ES64L-G16RevC.01 diff --git a/tests/test_libcint.py b/tests/test_libcint.py index d60670bf..d81db40c 100644 --- a/tests/test_libcint.py +++ b/tests/test_libcint.py @@ -159,11 +159,10 @@ def test_integral(basis, atsyms, atcoords, coord_type, integral): npt.assert_allclose(lc_int, py_int, atol=atol, rtol=rtol) - TEST_SYSTEMS_IODATA = [ pytest.param("h2o_hf_ccpv5z_cart.fchk", ["O", "H", "H"], "Cartesian", id="h2o_cart"), pytest.param("h2o_hf_ccpv5z_sph.fchk", ["O", "H", "H"], "Spherical", id="h2o_sph"), - ] +] TEST_INTEGRALS_IODATA = [ pytest.param("overlap", id="Overlap"), @@ -171,11 +170,14 @@ def test_integral(basis, atsyms, atcoords, coord_type, integral): pytest.param("nuclear_attraction", id="NuclearAttraction"), pytest.param("momentum", id="Momentum"), pytest.param("angular_momentum", id="AngularMomentum"), - pytest.param("electron_repulsion", marks=pytest.mark.skip(reason='TOO SLOW'), id="ElectronRepulsion"), + pytest.param( + "electron_repulsion", marks=pytest.mark.skip(reason="TOO SLOW"), id="ElectronRepulsion" + ), pytest.param("point_charge", id="PointCharge"), pytest.param("moment", id="Moment"), ] + @pytest.mark.parametrize("fname, elements, coord_type", TEST_SYSTEMS_IODATA) @pytest.mark.parametrize("integral", TEST_INTEGRALS_IODATA) def test_integral_iodata(fname, elements, coord_type, integral): @@ -184,8 +186,8 @@ def test_integral_iodata(fname, elements, coord_type, integral): atol, rtol = 1e-4, 1e-4 - mol=load_one(find_datafile(fname)) - py_basis=from_iodata(mol) + mol = load_one(find_datafile(fname)) + py_basis = from_iodata(mol) lc_basis = CBasis(py_basis, elements, mol.atcoords, coord_type=coord_type)