Skip to content

feat(shielding): Implement Exact STO Integrals and Accuracy Benchmarks#18

Merged
TKanX merged 39 commits intomainfrom
feature/17-implement-exact-sto-integrals-precision-benchmarks
Dec 22, 2025
Merged

feat(shielding): Implement Exact STO Integrals and Accuracy Benchmarks#18
TKanX merged 39 commits intomainfrom
feature/17-implement-exact-sto-integrals-precision-benchmarks

Conversation

@TKanX
Copy link
Member

@TKanX TKanX commented Dec 22, 2025

Summary:

Significantly enhances the accuracy of the cheq library by integrating an exact Slater-Type Orbital (STO) Coulomb integral implementation, replacing the previous Gaussian-Type Orbital (GTO) approximation as the default method. This is achieved by leveraging the sto-ns crate. To validate this improvement and rigorously benchmark the library's precision, a comprehensive integration test suite has been developed. These tests compare cheq's results against reference values from the original Rappé & Goddard QEq paper, demonstrating a dramatic reduction in error compared to GTO-based methods like that of OpenBabel.

Changes:

  • Integrated Exact STO Coulomb Integrals:

    • Added the sto-ns crate as a dependency to provide a high-performance, exact implementation of two-center Coulomb integrals for ns-type Slater orbitals.
    • Refactored the solver to create a unified shielding module with distinct sto and gto submodules.
    • The solver now defaults to using the sto implementation for maximum accuracy, while retaining the gto approximation as a configurable option (--basis gto).
  • Implemented Advanced Solver Control Options:

    • Added a BasisType enum to SolverOptions to allow users to switch between Sto and Gto basis sets.
    • Introduced a DampingStrategy enum with Auto, Fixed, and None options to provide fine-grained control over the SCF convergence behavior.
    • Exposed these new options through the CLI (--basis, --damping, --damping-factor), with updated documentation in USAGE.md.
  • Developed a Comprehensive Accuracy Benchmark Suite:

    • Created a new BENCHMARKS.md file to document and present accuracy comparisons against the original QEq paper.
    • Added a suite of integration tests (tests/) covering various chemical systems from the paper:
      • alkali.rs: Alkali halides and other small molecules.
      • clusters.rs: Ionic clusters like (NaCl)₂.
      • hydrogen.rs: A wide range of hydrogen-containing molecules.
      • polymers.rs: Polymer fragments (PE, PVDF) and a tripeptide (Ala-His-Ala).
    • The benchmark results show that the new STO implementation reduces the mean absolute error by an order of magnitude compared to GTO approximations.
  • Refined Solver Algorithm:

    • Implemented an adaptive damping strategy (DampingStrategy::Auto) that adjusts the mixing factor during the SCF cycle to improve convergence stability and speed.
    • Removed previous "lossy" optimization flags (--cutoff, --hydrogen-inner-iters) in favor of the more fundamental and impactful sto vs gto choice.

TKanX added 30 commits December 20, 2025 16:09
@TKanX TKanX self-assigned this Dec 22, 2025
Copilot AI review requested due to automatic review settings December 22, 2025 01:37
@TKanX TKanX added the enhancement ✨ New feature or request label Dec 22, 2025
@TKanX TKanX linked an issue Dec 22, 2025 that may be closed by this pull request
11 tasks
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request significantly enhances the accuracy of the cheq library by implementing exact Slater-Type Orbital (STO) Coulomb integrals via the sto-ns crate, replacing the previous Gaussian-Type Orbital (GTO) approximation as the default method. The PR also introduces a comprehensive benchmark suite demonstrating dramatic accuracy improvements compared to GTO-based methods.

Key Changes:

  • Integrated exact STO integrals for maximum accuracy with optional GTO fallback
  • Added adaptive damping strategy with auto-adjustment based on SCF convergence behavior
  • Developed comprehensive integration tests covering alkali halides, clusters, hydrogen compounds, and polymers
  • Refactored shielding calculations into dedicated sto and gto submodules
  • Enhanced solver control with BasisType and DampingStrategy enums

Reviewed changes

Copilot reviewed 20 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/polymers.rs New integration tests for polymer fragments (PE, PVDF) and tripeptides using turtle graphics geometry builder
tests/hydrogen.rs Comprehensive test suite for hydrogen-containing molecules with geometry construction helpers
tests/common/mod.rs Shared test infrastructure for running grouped benchmark tests with error reporting
tests/clusters.rs Tests for ionic clusters (NaCl monomers/dimers/tetramers)
tests/alkali.rs Extensive alkali halide tests plus CO2 and ketene molecules
src/solver/options.rs New BasisType and DampingStrategy enums with comprehensive documentation
src/solver/implementation.rs Major refactoring: adaptive damping, parallel matrix filling, hydrogen clamping
src/solver/mod.rs Updated exports to include new enum types
src/shielding/sto.rs New exact STO integral implementation delegating to sto-ns crate
src/shielding/gto.rs Moved GTO approximation code from math module with identical functionality
src/shielding/constants.rs Minor documentation update
src/shielding/mod.rs New module structure for shielding calculations
src/bin/modules/cli.rs New CLI options for basis type and damping strategy
src/bin/modules/app.rs Mapping logic for new CLI options to solver configuration
USAGE.md Updated documentation for new CLI options and argument reference table
README.md Version bump to 0.4.0, added benchmark summary table
BENCHMARKS.md New comprehensive benchmark documentation comparing STO vs GTO vs OpenBabel
Cargo.toml Version update, added sto-ns dependency, updated toml version
resources/qeq.data.toml Updated Li radius parameter from 1.28 to 1.557 Å
src/lib.rs Module reorganization: mathshielding, new exports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TKanX TKanX merged commit f9c45bc into main Dec 22, 2025
2 checks passed
@TKanX TKanX deleted the feature/17-implement-exact-sto-integrals-precision-benchmarks branch December 22, 2025 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Exact STO Integrals & Precision Benchmarks

2 participants