Skip to content

feat(math): Implement Shielded Coulomb Integral Calculation#6

Merged
TKanX merged 11 commits intomainfrom
feature/5-implement-core-math-for-shielded-coulomb-integral
Oct 21, 2025
Merged

feat(math): Implement Shielded Coulomb Integral Calculation#6
TKanX merged 11 commits intomainfrom
feature/5-implement-core-math-for-shielded-coulomb-integral

Conversation

@TKanX
Copy link
Member

@TKanX TKanX commented Oct 21, 2025

Summary:

Introduces the core mathematical engine for the cheq library by implementing the shielded Coulomb integral (J_AB) calculation, a cornerstone of the Charge Equilibration (QEq) method. This involves creating a new math module that includes physical constants and a shielding submodule. The implementation accurately models the interaction between Slater-type orbitals (STOs) using a robust Gaussian approximation, which is essential for calculating the off-diagonal elements of the QEq matrix.

Changes:

  • Implemented Shielded Coulomb Integral (gaussian_coulomb_integral):

    • Created a gaussian_coulomb_integral function that calculates the interaction energy between two atoms based on their distance, principal quantum number, and covalent radius.
    • The calculation follows the methodology including:
      • Slater Exponent Calculation: Implemented slater_exponent to determine the orbital exponent (zeta).
      • Gaussian Approximation: Implemented equivalent_gaussian_exponent using fitted coefficients (c_n) to approximate STOs with Gaussian functions.
      • Screened Potential: Implemented screened_potential using the error function (erf) to compute the final integral, correctly handling the R -> 0 limit to avoid singularities.
  • Established Math Module (math):

    • Created a new math module to house all mathematical and physical logic.
    • Added a constants submodule to define key physical constants (BOHR_TO_ANGSTROM, HARTREE_TO_EV).
    • Added a shielding submodule to contain the integral logic.
  • Added Comprehensive Unit and Integration Tests:

    • Developed a thorough test suite for the shielding module.
    • Tests validate the calculation against known values from reference implementations (e.g., for H₂ and CO).
    • Tests verify the correct physical behavior, such as the asymptotic limit (J_AB -> 1/R), symmetry (J_AB = J_BA), and behavior at zero distance.
  • Added Dependencies:

    • Introduced the libm crate for access to a high-quality erf implementation.
    • Added approx to the dev-dependencies for robust floating-point comparisons in tests.

@TKanX TKanX self-assigned this Oct 21, 2025
Copilot AI review requested due to automatic review settings October 21, 2025 11:31
@TKanX TKanX added the enhancement ✨ New feature or request label Oct 21, 2025
@TKanX TKanX linked an issue Oct 21, 2025 that may be closed by this pull request
19 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 PR implements the mathematical foundation for the Charge Equilibration (QEq) method by introducing shielded Coulomb integral calculations. The implementation uses Gaussian approximations of Slater-type orbitals to compute atomic interactions, which form the off-diagonal elements of the QEq matrix.

Key Changes:

  • Implements gaussian_coulomb_integral function with supporting mathematical primitives (Slater exponents, Gaussian approximations, screened potentials)
  • Creates new math module structure with constants and shielding submodules
  • Adds comprehensive test coverage validating against known reference values and physical properties

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/math/shielding.rs Core implementation of shielded Coulomb integral calculation with Slater-to-Gaussian conversion and comprehensive test suite
src/math/mod.rs Module declaration for new math package
src/math/constants.rs Physical constants (Bohr-to-Angstrom, Hartree-to-eV conversions, distance threshold)
src/lib.rs Exposes new math module in library public API
resources/qeq.data.toml Updated documentation comments to clarify QEq framework context
Cargo.toml Added libm dependency for erf function and approx for floating-point test assertions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@TKanX TKanX merged commit 1367239 into main Oct 21, 2025
2 checks passed
@TKanX TKanX deleted the feature/5-implement-core-math-for-shielded-coulomb-integral branch October 21, 2025 11:32
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 Core Math for Shielded Coulomb Integral

2 participants