Conversation
…electrostatic embedding
…or clarity and reuse
12 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces comprehensive support for external electrostatic fields in charge equilibration calculations, enabling hybrid QEq/MM simulations. The implementation allows a quantum-mechanically treated molecular fragment (e.g., a ligand) to polarize in response to a classical environment (e.g., protein residues), without including environment atoms in the expensive QEq matrix diagonalization.
- Adds
PointChargeandExternalPotentialdata structures with a builder-style API for representing external electrostatic environments - Implements a new
solve_in_fieldsolver method that modifies the effective electronegativity of QEq atoms based on external potential contributions - Refactors core SCF iteration logic into a shared
run_scf_iterationsmethod to avoid code duplication betweensolveandsolve_in_field
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/types.rs | Adds PointCharge struct and ExternalPotential struct with builder pattern API, plus comprehensive unit tests |
| src/solver/implementation.rs | Implements solve_in_field method, compute_external_potential helper with parallelization, refactors SCF logic, and adds integration tests |
| src/lib.rs | Exports new types (ExternalPotential, PointCharge) and adds documentation example for hybrid QEq/MM usage |
| README.md | Updates feature list to mention external field support |
💡 Add Copilot custom instructions for smarter, more guided reviews. 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 a major new feature to the
cheqlibrary: the ability to perform charge equilibration in the presence of an external electrostatic potential. This enables hybrid QEq/MM simulations, where a quantum-mechanically treated region (the QEq system) polarizes in response to a classical environment (the external field). The implementation supports contributions from both discrete point charges and a uniform electric field, which are incorporated into the QEq equations by modifying the effective electronegativity of each atom.Changes:
Implemented
ExternalPotentialandPointChargeData Structures:PointChargestruct to represent a fixed charge in the classical environment (e.g., an atom from a protein).ExternalPotentialstruct to aggregate contributions from multiplePointCharges and/or auniform_field.ExternalPotential(with_point_charges,with_uniform_field) for ergonomic construction.Introduced a New
solve_in_fieldSolver Method:QEqSolver::solve_in_field, which accepts anExternalPotentialas an argument.V_extat each QEq atom's position, using the same STO/GTO shielded Coulomb formalism for consistency with internal interactions.χ_i* = χ_i + V_ext_i), effectively polarizing the QEq system.Parallelized External Potential Calculation:
rayonfor optimal performance.Added Comprehensive Documentation and Tests:
ExternalPotentialandPointChargetypes, explaining their purpose and usage in hybrid QEq/MM contexts.README.mdandlib.rsdocumentation demonstrating how to usesolve_in_field.Architectural Refinements:
run_scf_iterationsmethod, shared by bothsolveandsolve_in_fieldto reduce code duplication.