Skip to content

[PR-8] fix: tighten libcint ERI tolerance and use improved implementation (#208)#242

Closed
San1357 wants to merge 13 commits intotheochem:masterfrom
San1357:feat/libcint-tolerance-fix
Closed

[PR-8] fix: tighten libcint ERI tolerance and use improved implementation (#208)#242
San1357 wants to merge 13 commits intotheochem:masterfrom
San1357:feat/libcint-tolerance-fix

Conversation

@San1357
Copy link

@San1357 San1357 commented Mar 9, 2026

Summary

What Changed

File Lines What
tests/test_libcint.py +9/-4 Use electron_repulsion_integral_improved, tighten atol=rtol=1e-6, ERI specific atol=1e-4, rtol=1e-5

Why ERI has different tolerance?

ERI with cc-pVDZ basis (d-orbitals) produces near-zero integrals where relative error is large but absolute error is small (~1e-5). atol=1e-4 handles these near-zero values, while rtol=1e-5 ensures non-zero values are accurate to 10x better than before.

How To Test

python3 -m pytest tests/test_libcint.py -v
# Expected: 240 passed, 32 skipped

Proof That It Works

- All 240 libcint tests passing with tightened tolerance

image ... ... ... image

First Checklist

  • All 240 libcint tests pass
  • Tolerance tightened (rtol: 1e-4 → 1e-5 for ERI, 1e-6 for rest)
  • Uses improved OS+HGP implementation
  • Existing tests not broken

Scope Of this PR

  • Only tests/test_libcint.py modified
  • Fixes root cause of libcint/gbasis eri tolerance is 1e-4? #208 — old algorithm had round-off errors, new OS+HGP is accurate
  • ERI tolerance could not be tightened further without Numba/Cython (Pure Python limitation)

Second Checklist

  • Write a good description of what the PR does.
  • Add tests for each unit of code added (e.g. function, class)
  • Update documentation
  • Squash commits that can be grouped together
  • Rebase onto master

Type of Changes

Type Checked
🐛 Bug fix
✨ New feature
🔨 Refactoring
📜 Docs

@marco-2023
Copy link
Contributor

Superseeded by #245

@marco-2023 marco-2023 closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants