Add WFN-history backend for Gamma-only NAO calculations#7442
Open
Growl1234 wants to merge 15 commits into
Open
Add WFN-history backend for Gamma-only NAO calculations#7442Growl1234 wants to merge 15 commits into
Growl1234 wants to merge 15 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Gamma-only LCAO wavefunction-history extrapolation (use_prev_wf) by snapshotting the previous step’s coefficients and reorthonormalizing them against the current overlap matrix before SCF.
Changes:
- Introduces LCAO wavefunction snapshot/history helpers and a Gamma-only reorthonormalization routine.
- Wires extrapolation into the LCAO ESolver flow and adds
wfc_extrapinput validation/handling (including skipping charge extrapolation when enabled). - Updates CMake to enforce a minimum C++ standard and adds a new
module_extrapsubdirectory target.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| source/source_lcao/module_extrap/wf_snapshot_lcao.h | Stores/restores full Psi coefficient snapshots plus occupations. |
| source/source_lcao/module_extrap/wf_orthonormalize_lcao.h | Declares Gamma-only reorthonormalization API + diagnostic result struct. |
| source/source_lcao/module_extrap/wf_orthonormalize_lcao.cpp | Implements MPI-aware assembly + Cholesky-based reorthonormalization. |
| source/source_lcao/module_extrap/wf_history_lcao.h | Defines wavefunction history class and apply-result diagnostics. |
| source/source_lcao/module_extrap/wf_history_lcao.cpp | Implements history management and use_prev_wf apply path. |
| source/source_lcao/module_extrap/wf_extrap_method.h | Adds extrapolation method/status enums and string conversions. |
| source/source_lcao/module_extrap/CMakeLists.txt | Adds lcao_extrap object library target for new module sources. |
| source/source_lcao/CMakeLists.txt | Enables module_extrap subdir and adds new sources to LCAO objects list. |
| source/source_io/module_parameter/read_input_item_system.cpp | Adds wfc_extrap input item, docs, and validation checks. |
| source/source_io/module_parameter/input_parameter.h | Adds wfc_extrap parameter with default "none". |
| source/source_esolver/esolver_ks_lcao.h | Adds wf_history_lcao_ member to ESolver. |
| source/source_esolver/esolver_ks_lcao.cpp | Initializes history, prepares overlap early, applies extrapolation, rebuilds density, updates history after SCF. |
| source/source_esolver/esolver_fp.cpp | Skips charge extrapolation when wfc_extrap is enabled (LCAO, istep>0). |
| CMakeLists.txt | Enforces a minimum C++ standard globally (now 14). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ddc1a25 to
375f25c
Compare
385f96e to
ac4fac1
Compare
003587a to
1fe84e8
Compare
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.
This PR introduces an optional WFN-based initialization path for NAO calculations.
A new
wfc_extrap use_prev_wfpath is added. It stores the converged wavefunction from the previous ionic step, rebuilds the current overlap matrix, reorthonormalizes the previous wavefunction with the current overlap matrix, and then reconstructs the density matrix and charge density before entering the normal SCF cycle. When this path is enabled, the existing charge-density extrapolation is skipped, so the initial density is generated from the WFN-history backend instead of being extrapolated directly in real space.The implementation currently focuses on the Gamma-only backend, including MPI-distributed matrices. This is intended as a common backend for future improvements and more WFN-based predictors such as ASPC and GExt_PROJ.
Here's a simple test that shows the accuracy and effectiveness of the WFN-based path: test.zip. The regtesting is left for a next commit.
What's planned to resolve in the future PRs: