Conversation
44 tasks
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the core QEq (Charge Equilibration) solver engine that computes atomic partial charges through an iterative self-consistent field approach. The implementation uses the high-performance faer linear algebra library and handles both linear systems (non-hydrogen atoms) and non-linear systems (hydrogen-containing molecules with charge-dependent hardness).
Key Changes:
- Implemented
QEqSolverwith iterative SCF convergence for charge-dependent hydrogen hardness - Built dynamic linear system construction with Gaussian-shielded Coulomb interactions and charge constraints
- Integrated
faercrate for robust LU-decomposition-based linear system solving
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/solver/options.rs |
Defines configurable solver parameters (tolerance, max iterations, lambda scale) |
src/solver/mod.rs |
Module declaration exposing QEqSolver and SolverOptions |
src/solver/implementation.rs |
Core solver implementation with system builder, SCF loop, and comprehensive test suite |
src/lib.rs |
Adds solver module to library public API |
Cargo.toml |
Adds faer dependency for linear algebra operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Introduces the core computational engine of the
cheqlibrary: a robust, self-consistent Charge Equilibration (QEq) solver. A newsolvermodule has been created, featuring aQEqSolverthat constructs and iteratively solves the QEq linear system to determine atomic partial charges. The implementation handles both linear (non-H) and non-linear (H-containing) systems, incorporates a flexible options structure, and uses the high-performancefaercrate for all linear algebra operations.Changes:
Implemented the
QEqSolver:QEqSolverstruct responsible for orchestrating the entire charge calculation process.solvemethod, which takes a slice of atoms and a total charge, and returns aCalculationResult.Developed the Linear System Builder:
build_systemmethod, which dynamically constructs the QEq matrix (A) and vector (b) for each SCF iteration.J_ii), including the special non-linear term for hydrogen.gaussian_coulomb_integralfunction to calculate the shielded Coulomb interaction (J_ij).sum(q_i) = Q_total).Integrated a High-Performance Linear Algebra Backend:
faercrate as a dependency for fast and robust linear algebra operations.faer's partial-pivoting LU decomposition (partial_piv_lu) to solve the linear system in each iteration.solvecall to gracefully manage potential linear algebra failures (e.g., singular matrices).Added Solver Configuration Options:
SolverOptionsstruct to allow users to configure the solver's behavior, includingtolerance,max_iterations, and the shielding scale factorlambda_scale.QEqSolvercan be instantiated with custom options via thewith_optionsbuilder method.Included Comprehensive Solver Tests: