public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Susi Lehtola <jussilehtola@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/python-pyscf] rawhide: Patch to fix the test failures
Date: Sat, 01 Aug 2026 11:35:07 GMT	[thread overview]
Message-ID: <178558410787.1.5932764934732861711.rpms-python-pyscf-3c84e6052590@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/python-pyscf
Branch : rawhide
Commit : 3c84e6052590d16c02f495bc057658d3679ad216
Author : Susi Lehtola <jussilehtola@fedoraproject.org>
Date   : 2026-08-01T11:35:00+00:00
Stats  : +205/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-pyscf/c/3c84e6052590d16c02f495bc057658d3679ad216?branch=rawhide

Log:
Patch to fix the test failures

---
diff --git a/pyscf-2.14.0-tests.patch b/pyscf-2.14.0-tests.patch
new file mode 100644
index 0000000..955da3e
--- /dev/null
+++ b/pyscf-2.14.0-tests.patch
@@ -0,0 +1,200 @@
+diff -urN pyscf-2.14.0.orig/pyscf/df/test/test_df.py pyscf-2.14.0/pyscf/df/test/test_df.py
+--- a/pyscf/df/test/test_df.py	2026-07-18 22:19:34.000000000 +0000
++++ b/pyscf/df/test/test_df.py	2026-08-01 11:19:08.787572884 +0000
+@@ -104,8 +104,13 @@
+         dm = numpy.random.random((2,nao,nao))
+         dfobj = df.DF(mol)
+         vj, vk = dfobj.get_jk(dm, hermi=0, omega=1.1)
+-        self.assertAlmostEqual(lib.fp(vj), -181.5033531437091, 4)
+-        self.assertAlmostEqual(lib.fp(vk), -37.78854217974532, 4)
++        # The long-range Coulomb metric of the JK-fit auxiliary basis is
++        # severely linearly dependent (condition number ~1e19) and has
++        # eigenvalues straddling the 1e-7 linear dependency threshold used by
++        # DF, so these fingerprints are only reproducible to about 1e-4 across
++        # LAPACK implementations.
++        self.assertAlmostEqual(lib.fp(vj), -181.5033531437091, 3)
++        self.assertAlmostEqual(lib.fp(vk), -37.78854217974532, 3)
+ 
+         vj1, vk1 = scf.hf.get_jk(mol, dm, hermi=0, omega=1.1)
+         self.assertAlmostEqual(abs(vj-vj1).max(), 0, 2)
+diff -urN pyscf-2.14.0.orig/pyscf/grad/test/test_rhf.py pyscf-2.14.0/pyscf/grad/test/test_rhf.py
+--- a/pyscf/grad/test/test_rhf.py	2026-07-18 22:19:34.000000000 +0000
++++ b/pyscf/grad/test/test_rhf.py	2026-08-01 11:18:20.394533343 +0000
+@@ -23,6 +23,15 @@
+ except (ImportError, OSError):
+     dftd3 = dftd4 = None
+ 
++# qcint, which is used in place of libcint on some architectures, does not
++# implement the derivative integrals needed for the GTH pseudopotential
++# gradients.  Skip the affected tests instead of dying on an undefined symbol.
++from pyscf.gto.moleintor import libcgto
++HAVE_GTH_PP_GRAD_INTS = all(
++    hasattr(libcgto, intor + '_optimizer') for intor in
++    ('int1e_r2_origi_ip2', 'int1e_r4_origi_ip2', 'int3c1e_ip1_r2_origk',
++     'int3c1e_ip1_r4_origk', 'int3c1e_ip1_r6_origk'))
++
+ def setUpModule():
+     global mol
+     mol = gto.Mole()
+@@ -241,6 +250,8 @@
+         self.assertAlmostEqual(abs(gs - ref).max(), 0, 9)
+ 
+     # issue #3198
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_gth_pp_grad(self):
+         mol = gto.M(
+             atom    = 'F 0 0 0; H 0 0 1.76',
+@@ -255,6 +266,8 @@
+         e2 = mf_scan('F 0 0 0; H 0 0 1.759')
+         self.assertAlmostEqual(g[1, 2], (e1 - e2)/2e-3, delta=3e-6)
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_gth_pp_hcore_grad(self):
+         from pyscf.df import incore
+         from pyscf.gto import pp_int
+diff -urN pyscf-2.14.0.orig/pyscf/grad/test/test_uhf.py pyscf-2.14.0/pyscf/grad/test/test_uhf.py
+--- a/pyscf/grad/test/test_uhf.py	2026-07-18 22:19:34.000000000 +0000
++++ b/pyscf/grad/test/test_uhf.py	2026-08-01 11:18:31.677309413 +0000
+@@ -22,6 +22,15 @@
+ except (ImportError, OSError):
+     dftd3 = dftd4 = None
+ 
++# qcint, which is used in place of libcint on some architectures, does not
++# implement the derivative integrals needed for the GTH pseudopotential
++# gradients.  Skip the affected tests instead of dying on an undefined symbol.
++from pyscf.gto.moleintor import libcgto
++HAVE_GTH_PP_GRAD_INTS = all(
++    hasattr(libcgto, intor + '_optimizer') for intor in
++    ('int1e_r2_origi_ip2', 'int1e_r4_origi_ip2', 'int3c1e_ip1_r2_origk',
++     'int3c1e_ip1_r4_origk', 'int3c1e_ip1_r6_origk'))
++
+ 
+ def setUpModule():
+     global mol, mol1
+@@ -276,6 +285,8 @@
+ # [ 0  -4.31591309e-02  -1.63887474e-03]]
+         self.assertAlmostEqual(lib.fp(g1), -0.062338912126, 6)
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_gth_pp_grad(self):
+         mol = gto.M(
+             atom = '''
+diff -urN pyscf-2.14.0.orig/pyscf/pbc/dft/test/test_multigrid2.py pyscf-2.14.0/pyscf/pbc/dft/test/test_multigrid2.py
+--- a/pyscf/pbc/dft/test/test_multigrid2.py	2026-07-18 22:19:34.000000000 +0000
++++ b/pyscf/pbc/dft/test/test_multigrid2.py	2026-08-01 11:18:45.228823203 +0000
+@@ -25,6 +25,15 @@
+ from pyscf.pbc.grad import uks as uks_grad
+ from pyscf.pbc.grad import krks as krks_grad
+ 
++# qcint, which is used in place of libcint on some architectures, does not
++# implement the derivative integrals needed for the GTH pseudopotential
++# gradients.  Skip the affected tests instead of dying on an undefined symbol.
++from pyscf.gto.moleintor import libcgto
++HAVE_GTH_PP_GRAD_INTS = all(
++    hasattr(libcgto, intor + '_optimizer') for intor in
++    ('int1e_r2_origi_ip2', 'int1e_r4_origi_ip2', 'int3c1e_ip1_r2_origk',
++     'int3c1e_ip1_r4_origk', 'int3c1e_ip1_r6_origk'))
++
+ def setUpModule():
+     global He_orth, He_nonorth, cell_orth, cell_nonorth, dm, dm1, mol
+     global cell_he, kpts, he_nao, dm_he
+@@ -201,6 +210,8 @@
+         _test_veff(cell_nonorth, xc, dm, spin=0)
+         _test_veff(cell_nonorth, xc, dm1, spin=1)
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_orth_lda_dft(self):
+         xc = 'lda, vwn'
+         e0, g0 = _fftdf_energy_grad(He_orth, xc)
+@@ -211,6 +222,8 @@
+         assert abs(g-g0).max() < 1e-6
+         assert abs(g1-g0).max() < 1e-6
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_orth_gga_dft(self):
+         xc = 'pbe, pbe'
+         e0, g0 = _fftdf_energy_grad(He_orth, xc)
+@@ -221,6 +234,8 @@
+         assert abs(g-g0).max() < 1e-6
+         assert abs(g1-g0).max() < 1e-6
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_nonorth_lda_dft(self):
+         xc = 'lda, vwn'
+         e0, g0 = _fftdf_energy_grad(He_nonorth, xc)
+@@ -231,6 +246,8 @@
+         assert abs(g-g0).max() < 1e-7
+         assert abs(g1-g0).max() < 1e-7
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_nonorth_gga_dft(self):
+         xc = 'pbe, pbe'
+         e0, g0 = _fftdf_energy_grad(He_nonorth, xc)
+@@ -241,6 +258,8 @@
+         assert abs(g-g0).max() < 1e-7
+         assert abs(g1-g0).max() < 1e-7
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_orth_j_dft(self):
+         xc = ''
+         e0, g0 = _fftdf_energy_grad(He_orth, xc)
+@@ -251,6 +270,8 @@
+         assert abs(g-g0).max() < 1e-7
+         assert abs(g1-g0).max() < 1e-7
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_nonorth_j_dft(self):
+         xc = ''
+         e0, g0 = _fftdf_energy_grad(He_nonorth, xc)
+diff -urN pyscf-2.14.0.orig/pyscf/pbc/gto/pseudo/test/test_pp.py pyscf-2.14.0/pyscf/pbc/gto/pseudo/test/test_pp.py
+--- a/pyscf/pbc/gto/pseudo/test/test_pp.py	2026-07-18 22:19:34.000000000 +0000
++++ b/pyscf/pbc/gto/pseudo/test/test_pp.py	2026-08-01 11:18:57.490797093 +0000
+@@ -24,6 +24,15 @@
+ from pyscf.pbc.gto.pseudo import pp_int
+ from pyscf.data.nist import BOHR
+ 
++# qcint, which is used in place of libcint on some architectures, does not
++# implement the derivative integrals needed for the GTH pseudopotential
++# gradients.  Skip the affected tests instead of dying on an undefined symbol.
++from pyscf.gto.moleintor import libcgto
++HAVE_GTH_PP_GRAD_INTS = all(
++    hasattr(libcgto, intor + '_optimizer') for intor in
++    ('int1e_r2_origi_ip2', 'int1e_r4_origi_ip2', 'int3c1e_ip1_r2_origk',
++     'int3c1e_ip1_r4_origk', 'int3c1e_ip1_r6_origk'))
++
+ 
+ def get_pp_loc_part2(cell, kpt=np.zeros(3)):
+     coords = gen_grid.gen_uniform_grids(cell)
+@@ -245,6 +254,8 @@
+         v1 = pseudo.get_pp(cell, k)
+         self.assertAlmostEqual(abs(v0-v1).max(), 0, 6)
+ 
++    @unittest.skipIf(not HAVE_GTH_PP_GRAD_INTS,
++                     'GTH pseudopotential gradient integrals not in libcint')
+     def test_pp_nuc_grad(self):
+         cell = pbcgto.Cell()
+         cell.atom = 'H 0 0 0; Na 0 0 0.8'
+diff -urN pyscf-2.14.0.orig/pyscf/sgx/test/test_dm_screening.py pyscf-2.14.0/pyscf/sgx/test/test_dm_screening.py
+--- a/pyscf/sgx/test/test_dm_screening.py	2026-07-18 22:19:34.000000000 +0000
++++ b/pyscf/sgx/test/test_dm_screening.py	2026-08-01 11:19:02.322701194 +0000
+@@ -74,7 +74,10 @@
+         e2 = mf_scanner(mol1.set_geom_(atomm))
+         t3 = logger.perf_counter()
+         self.assertAlmostEqual(g[2,2], (e1-e2)/(2*delta)*lib.param.BOHR, 6)
+-        self.assertAlmostEqual(numpy.abs(g.sum(axis=0)).sum(), 0, 13)
++        # The translational invariance of the gradient only holds up to the
++        # numerical noise of the SGX semi-numerical integration, which depends
++        # on the BLAS implementation; 13 decimals is beyond what is achievable.
++        self.assertAlmostEqual(numpy.abs(g.sum(axis=0)).sum(), 0, 9)
+         return mf.e_tot, (t3 - t2) + (t1 - t0), t2 - t1, mf.cycles
+ 
+     def test_rhf_dm_screening(self):

diff --git a/python-pyscf.spec b/python-pyscf.spec
index cf15bdf..d65be07 100644
--- a/python-pyscf.spec
+++ b/python-pyscf.spec
@@ -27,6 +27,9 @@ Source0:        https://github.com/pyscf/pyscf/archive/v%{version}/pyscf-%{versi
 Patch1:         pyscf-2.14.0-rpath.patch
 # Need to load libpbc before libdft, https://github.com/pyscf/pyscf/pull/2273
 Patch2:         2273.patch
+# Skip tests that need integrals qcint does not implement, and relax two
+# tolerances that are tighter than the numerics of the tests allow
+Patch3:         pyscf-2.14.0-tests.patch
 
 # i686 disabled since this is a leaf package; see
 # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
@@ -95,6 +98,7 @@ chemistry programs.
 %setup -q -n pyscf-%{version}
 %patch 1 -p1 -b .rpath
 %patch 2 -p1 -b .2273
+%patch 3 -p1 -b .tests
 
 # Remove shebangs
 find pyscf -name \*.py -exec sed -i '/#!\/usr\/bin\/env /d' '{}' \;
@@ -134,7 +138,7 @@ bash .github/workflows/run_tests.sh
 
 %changelog
 * Sat Aug 01 2026 Susi Lehtola <jussilehtola@fedoraproject.org> - 2.14.0-2
-- Enable tests.
+- Enable tests, patching the suite to pass with qcint and FlexiBLAS.
 
 * Thu Jul 30 2026 Susi Lehtola <jussilehtola@fedoraproject.org> - 2.14.0-1
 - Update to 2.14.0.

                 reply	other threads:[~2026-08-01 11:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178558410787.1.5932764934732861711.rpms-python-pyscf-3c84e6052590@fedoraproject.org \
    --to=jussilehtola@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox