-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Description:
This task covers the implementation of the mathematical core for charge interaction in the cheq library, located in the math::shielding module. The chosen model is a numerically robust, Gaussian-screened Coulomb potential, which faithfully approximates the behavior of Slater-Type Orbitals (STOs) while avoiding the complexity of direct STO integration. This is effectively an STO-1G (Slater-Type Orbital approximated by 1 Gaussian) approach.
The primary function, gaussian_coulomb_integral, takes fundamental atomic parameters (n, r_cov_bohr, lambda) and the inter-atomic distance in Bohr as input. It returns the shielded electrostatic interaction energy (J_AB) in Hartree atomic units. This function is the cornerstone for building the off-diagonal elements of the QEq matrix.
The implementation is self-contained within the math::shielding module, deriving all necessary intermediate parameters (like Slater ζ and equivalent Gaussian α exponents) internally. It correctly handles the R → 0 limit case to ensure physical behavior and numerical stability.
Tasks:
-
Phase 1: Module and Function Scaffolding
- Create the file
src/math/shielding.rs. - Define the public function signature:
pub fn gaussian_coulomb_integral(distance_bohr: f64, n1: u8, r_cov1_bohr: f64, n2: u8, r_cov2_bohr: f64, lambda: f64) -> f64. - Document the function, specifying that all inputs are in atomic units (Bohr) and the output is in Hartree.
- Define necessary private helper functions:
slater_exponent,equivalent_gaussian_exponent,get_c_n_fit_coeff, andscreened_potential. - Define required physical constants in
src/math/constants.rs(BOHR_TO_ANGSTROM,HARTREE_TO_EV).
- Create the file
-
Phase 2: Implement the Gaussian Screening Algorithm
- Inside
gaussian_coulomb_integral:- Step 1: Calculate Slater Exponents (ζ)
- Call
slater_exponentfor both atoms, using theirn,r_cov_bohr, and the globallambda. The formulaζ = λ * (2n + 1) / (2 * R_bohr)is implemented.
- Call
- Step 2: Calculate Equivalent Gaussian Exponents (α)
- Call
equivalent_gaussian_exponentfor both atoms, using theirnand calculatedζ. The formulaα = c(n) * ζ² / nis implemented, withc(n)values fromget_c_n_fit_coeff.
- Call
- Step 3: Calculate the Screened Potential
- Call the
screened_potentialhelper function. - Internally, it calculates the screening parameter
β = sqrt(2 * α_1 * α_2 / (α_1 + α_2)). - It then calculates the shielded interaction in Hartree atomic units:
J_hartree = erf(β * R_bohr) / R_bohr. This includes the special handling for theR → 0limit using the Taylor expansion oferf.
- Call the
- Step 4: Return Result
- Return the calculated
J_hartree. The conversion to eV is handled by the caller (thesolver) to keep the math module in pure atomic units.
- Return the calculated
- Step 1: Calculate Slater Exponents (ζ)
- Inside
-
Phase 3: Rigorous Unit Testing
- In
src/math/shielding.rs, create atestssubmodule. - Test the
R → ∞asymptotic behavior:- A test
test_integral_at_large_distance_asymptoteasserts that for a large distance (R = 1000.0Bohr), the result is very close to the point-charge Coulomb law1.0 / R_bohr.
- A test
- Test specific known values:
- A test
test_integral_with_known_valuesverifies calculatedJ_ABvalues for H₂ and a C-O pair against pre-computed benchmarks to ensure correctness.
- A test
- Test numerical stability near
R → 0:- A test
test_integral_at_zero_distance_limitasserts that the function returns a finite, positive value atR = 0and that the value is consistent with the limit asRapproaches zero, confirming theerfexpansion is working correctly.
- A test
- Test symmetry:
- A test
test_integral_symmetry_propertyasserts thatJ(A, B)is identical toJ(B, A).
- A test
- Test chemical and physical trends:
- A test
test_integral_chemical_trendsconfirms that the interaction decreases with distance and that interactions between more diffuse orbitals (e.g., Na-Na) are weaker than between more compact orbitals (e.g., H-H) at the same separation. - A test
test_integral_scaling_with_lambdaconfirms the physical expectation that a smallerlambdaleads to stronger screening (smallerJ_AB).
- A test
- In
Metadata
Metadata
Assignees
Labels
Type
Projects
Status