Add Hirshfeld partitioning to weights generation#209
Open
awvwgk wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new molecular partitioning scheme (XCWeightAlg::Hirshfeld) to GauXC’s host weight generation pipeline (Reference/Default host LWD), including analytical first-derivative support and C-API exposure, with new/updated tests to validate correctness and enum correspondence.
Changes:
- Introduce
XCWeightAlg::Hirshfeldin both C++ and C enums and wire it through the host reference local work driver. - Implement Hirshfeld partition weights and first-derivative (direct + contracted) reference routines on host.
- Extend unit tests and C-API tests to cover Hirshfeld weight generation and factory usage.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/weights.cxx | Adds Hirshfeld reference-data generation hook and new unit tests validating Hirshfeld invariants (normalization, translation, permutation). |
| tests/weights_host.hpp | Extends host weight test switch to call the Hirshfeld reference implementation. |
| tests/weights_generate.hpp | Extends reference-data generator to support Hirshfeld. |
| tests/weight_derivative_test.cxx | Adds Hirshfeld to analytical derivative test dispatch and adds fdiff sections for it. |
| tests/c_api_test.cxx | Verifies C/C++ enum correspondence for Hirshfeld; adds factory creation and modify-weights coverage for Hirshfeld in C-API. |
| src/xc_integrator/local_work_driver/host/reference/weights.hpp | Declares Hirshfeld host reference routines (weights + derivatives + contraction). |
| src/xc_integrator/local_work_driver/host/reference/weights.cxx | Implements Hirshfeld weights and derivative routines on host. |
| src/xc_integrator/local_work_driver/host/reference_local_host_work_driver.cxx | Wires Hirshfeld into host “Reference/Default” local work driver switches. |
| include/gauxc/enums.hpp | Adds XCWeightAlg::Hirshfeld to the public C++ enum. |
| include/gauxc/c/enums.h | Adds GauXC_XCWeightAlg_Hirshfeld to the public C enum. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+404
to
+408
| struct hirshfeld_atom_data { | ||
| double x; | ||
| double y; | ||
| double z; | ||
| double alpha; |
Comment on lines
+768
to
+774
| struct hirshfeld_atom_data { | ||
| double x; | ||
| double y; | ||
| double z; | ||
| double alpha; | ||
| double scale; | ||
| }; |
Comment on lines
+1146
to
+1152
| struct hirshfeld_atom_data { | ||
| double x; | ||
| double y; | ||
| double z; | ||
| double alpha; | ||
| double scale; | ||
| }; |
| == static_cast<int>(GauXC_XCWeightAlg_SSF)); | ||
| CHECK(static_cast<int>(XCWeightAlg::LKO) | ||
| == static_cast<int>(GauXC_XCWeightAlg_LKO)); | ||
| CHECK(static_cast<int>(XCWeightAlg::Hirshfeld) |
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.
Add
XCWeightAlg::Hirshfeldas a host molecular-weight partitioning scheme for host (OMP/MPI).Use a Gaussian shape-function where each atom contributes a normalized Gaussian shape and the normalization function is the sum of reference charges multiplied with the shape.
Timings for some toy systems: