The Cartesian basis DF-J gradient disagrees from the PySCF on CPU
Nobody has claimed this yet.
- Dominant language
- Cuda
- Stars
- 351
- Forks
- 84
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 35
Description
For a Cartesian AO/auxiliary basis, the default gpu4pyscf DF-RHF nuclear gradient differs from PySCF’s CPU-based one, evaluated on the same converged wavefunction. In the case of H2O/cc-pvdz evaluated with cart=True the difference is 2.4e-7 a.u., while for the spherical basis it is 4.5e-12 a.u. For larger molecules like taxol, the discrepancy increases significantly, exceeding 1e-4. A detailed analysis (computing gradient contributions from integrals and finite differences checks) shows that the source of the error is the Coulomb 2e gradient contribution in gpu4pyscf.
Environment
- gpu4pyscf-cuda12x 1.7.1 (latest PyPI release, 2026-05-28), pyscf 2.13.1
- CUDA 12.x, NVIDIA A100 80GB
- Basis cc-pvdz, auxiliary cc-pvdz-jkfit
Minimal example
import numpy as np
import cupy
from pyscf import gto, scf
H2O = "O 0.000 0.000 0.117; H 0.000 0.757 -0.467; H 0.000 -0.757 -0.467"
for cart in (True, False):
mol = gto.M(atom=H2O, unit="angstrom", basis="cc-pvdz", cart=cart, verbose=0)
mf = scf.RHF(mol).density_fit(auxbasis="cc-pvdz-jkfit").run()
de_cpu = mf.nuc_grad_method().kernel()
de_gpu = cupy.asnumpy(mf.to_gpu().nuc_grad_method().kernel())
print(f"{'CARTESIAN' if cart else 'SPHERICAL'}: "
f"max|pyscf - gpu4pyscf| = {np.abs(de_cpu - de_gpu).max():.2e}")
Output:
CARTESIAN: max|pyscf - gpu4pyscf| = 2.42e-07
SPHERICAL: max|pyscf - gpu4pyscf| = 4.79e-12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal Python example and reproduce the Cartesian-versus-spherical gradient comparison on the stated PySCF and gpu4pyscf versions. Trace the Coulomb 2e gradient contribution identified in the analysis, then verify that Cartesian results agree with PySCF while the spherical comparison remains consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- hpc
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100