Add fixed-basis QSGW workflow and regression tests - #7
Open
bhjia-phys wants to merge 11 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an experimental fixed-basis QSGW / QSGW-band workflow to LibRPA, including a new src/qsgw/ module, driver/task wiring, and regression gates (H2O + Si head-only) while keeping the existing GW/EXX/RPA core paths unchanged except for a small PBC remap helper.
Changes:
- Add
src/qsgw/implementation building blocks (input contract + hashing, occupations, mixing, correlation potential, effective Hamiltonian assembly, tracing, and distributed-matrix helpers). - Wire new
task = qsgwandtask = qsgw_banddriver paths plus inputfile parsing/validation and backend comparator/wiring tests. - Add unit/MPI tests and two committed regression testcases + reference traces for iteration summary/eigenvalue trajectories.
Reviewed changes
Copilot reviewed 77 out of 80 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/test_qsgw_sha256.cpp | Unit test for QSGW SHA256 helpers. |
| src/test/test_qsgw_projection_target.cpp | Unit test for projection target validation. |
| src/test/test_qsgw_occupation.cpp | Unit test for QSGW occupation analysis/update logic. |
| src/test/test_qsgw_mixing.cpp | Unit test for linear Hamiltonian mixer behavior and validation. |
| src/test/test_qsgw_input_contract.cpp | Unit test for QSGW input-contract parsing/binding/hash checking. |
| src/test/test_qsgw_hamiltonian_cut.cpp | Unit test for Hamiltonian cut modes/options. |
| src/test/test_qsgw_fixed_basis_mpi.cpp | MPI test for distributed velocity alignment to reference WFC. |
| src/test/test_qsgw_effective_hamiltonian.cpp | Unit test for effective Hamiltonian assembly + reference build. |
| src/test/test_qsgw_distributed_matrix.cpp | MPI test for BLACS collection + Spin/K map broadcast. |
| src/test/test_qsgw_convergence.cpp | Unit test for convergence snapshot/change computation. |
| src/test/test_qsgw_band_output.cpp | Unit test for legacy-format band table output + validation. |
| src/test/test_qsgw_band_bvk_remap.cpp | Unit test for legacy BvK remap behavior vs upstream mapping. |
| src/test/CMakeLists.txt | Registers new QSGW unit and MPI tests. |
| src/qsgw/vxc_io.h | Declares Vxc manifest + readers/projection helpers for QSGW. |
| src/qsgw/sha256.h | Declares SHA256 helper API for QSGW inputs/contracts. |
| src/qsgw/sha256.cpp | Implements SHA256 digest + hex validation. |
| src/qsgw/projection_target.h | Declares projection target validation API. |
| src/qsgw/projection_target.cpp | Implements projection target layout/finiteness validation. |
| src/qsgw/occupation.h | Declares QSGW occupation settings/results and update functions. |
| src/qsgw/occupation.cpp | Implements fixed-reference global filling + invariants/validation. |
| src/qsgw/mixing.h | Declares linear Hamiltonian mixing API + decision/result structs. |
| src/qsgw/mixing.cpp | Implements linear mixing with residual measurement + validation. |
| src/qsgw/matrix_map.h | Defines Spin/K and related matrix map aliases. |
| src/qsgw/iteration_trace.h | Declares iteration/eigenvalue/matrix trace writers. |
| src/qsgw/input_contract.h | Declares QSGW input contract parser + binding helpers. |
| src/qsgw/Hamiltonian.h | Removes obsolete/unbuilt legacy QSGW draft header. |
| src/qsgw/hamiltonian_mixing.h | Declares Spin/K Hamiltonian packing + mixing wrapper. |
| src/qsgw/hamiltonian_mixing.cpp | Implements packing/unpacking + layout validation and mixing wrapper. |
| src/qsgw/hamiltonian_cut.h | Declares Hamiltonian cut API (modes/options). |
| src/qsgw/hamiltonian_cut.cpp | Implements Hamiltonian cut behavior + validation. |
| src/qsgw/fixed_basis.h | Declares fixed-basis diagonalization + velocity alignment APIs. |
| src/qsgw/fermi_energy_occupation.h | Removes obsolete/unbuilt legacy Fermi/occupation implementation header. |
| src/qsgw/fermi_energy_occupation.cpp | Removes obsolete/unbuilt legacy Fermi/occupation implementation. |
| src/qsgw/effective_hamiltonian.h | Declares reference/effective Hamiltonian builders. |
| src/qsgw/effective_hamiltonian.cpp | Implements reference build + assembled effective Hamiltonian. |
| src/qsgw/distributed_matrix.h | Declares BLACS collection + Spin/K map broadcast helpers. |
| src/qsgw/distributed_matrix.cpp | Implements BLACS collection + metadata-driven broadcast w/ validation. |
| src/qsgw/correlation_potential.h | Declares analytic-continuation-based correlation potential builder. |
| src/qsgw/correlation_potential.cpp | Implements ModeA/ModeB correlation potential build with validation. |
| src/qsgw/convergence.h | Declares eigenvalue snapshot/change + iteration convergence gate. |
| src/qsgw/convergence.cpp | Implements snapshot capture and max-change computation with checks. |
| src/qsgw/CMakeLists.txt | Adds QSGW sources to rpa_lib. |
| src/qsgw/band_output.h | Declares legacy-format QSGW/KS/EXX band-table writer. |
| src/qsgw/band_output.cpp | Implements band-table output with layout/stream/matrix validation. |
| src/qsgw/band_bvk_remap.h | Declares legacy BvK remap builder used by QSGW band path. |
| src/qsgw/band_bvk_remap.cpp | Implements legacy remap override using new PBC erase helper. |
| src/core/pbc.h | Adds AtomPairBvKRemap::erase_mapping() helper used by QSGW band remap. |
| src/CMakeLists.txt | Integrates src/qsgw subdirectory into core build. |
| driver/tasks/qsgw.cpp | Adds QSGW/QSGW-band stage-one driver workflow implementation. |
| regression_tests/testsuite.xml | Registers new H2O + Si head-only QSGW regression testcases. |
| regression_tests/testcases/qsgw_aims_Si_k333_headonly_libri/librpa/librpa.in | Adds Si head-only QSGW regression input (no mixing). |
| regression_tests/testcases/qsgw_aims_mole_H2O_libri/librpa/librpa.in | Adds molecular QSGW regression input (linear mixing beta=0.2). |
| regression_tests/refs/qsgw_aims_Si_k333_headonly_libri/librpa/librpa.d/qsgw_iterations.dat | Adds reference iteration-summary trace for Si head-only regression. |
| regression_tests/refs/qsgw_aims_mole_H2O_libri/librpa/librpa.d/qsgw_iterations.dat | Adds reference iteration-summary trace for H2O regression. |
| regression_tests/backend/test_qsgw_driver_wiring.py | Adds Python wiring tests asserting key QSGW driver invariants. |
| regression_tests/backend/comparisons/test_cmp_qsgw.py | Adds unit tests for QSGW trace comparators/contracts. |
| driver/test/test_qsgw_inputfile.cpp | Adds driver inputfile parsing/validation tests for QSGW parameters. |
| driver/test/CMakeLists.txt | Registers new test_qsgw_inputfile target/test. |
| driver/task.h | Exposes task_qsgw / task_qsgw_band task entry points. |
| driver/task.cpp | Registers QSGW tasks in task dispatch map. |
| driver/inputfile.cpp | Adds QSGW-specific parsing + validation for new driver parameters. |
| driver/driver.h | Adds QSGW driver parameters to DriverParams. |
| driver/driver.cpp | Initializes and formats new QSGW driver parameters. |
| driver/CMakeLists.txt | Adds tasks/qsgw.cpp to driver build. |
| docs/user_guide/runtime_parameters.yml | Documents the new experimental QSGW runtime parameters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+112
to
+114
| const double occupation_scale = static_cast<double>( | ||
| live_band.get_n_kpoints() * live_band.get_n_spins()); | ||
| for (int kpoint = 0; kpoint < live_band.get_n_kpoints(); ++kpoint) |
Comment on lines
+145
to
+147
| int provided = 0; | ||
| MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); | ||
| assert(provided >= MPI_THREAD_MULTIPLE); |
Comment on lines
+110
to
+127
| if (task == "qsgw" || task == "qsgw_band") | ||
| { | ||
| ss << "qsgw_input_contract = " << qsgw_input_contract << std::endl; | ||
| ss << "qsgw_mixer = " << qsgw_mixer << std::endl; | ||
| ss << "qsgw_mixing_beta = " << qsgw_mixing_beta << std::endl; | ||
| ss << "qsgw_min_iter = " << qsgw_min_iter << std::endl; | ||
| ss << "qsgw_max_iter = " << qsgw_max_iter << std::endl; | ||
| ss << "qsgw_band0_unoccupied_keep = " | ||
| << qsgw_band0_unoccupied_keep << std::endl; | ||
| ss << "qsgw_band0_cut_mode = " << qsgw_band0_cut_mode | ||
| << std::endl; | ||
| ss << "qsgw_band0_cut_shift_ha = " | ||
| << qsgw_band0_cut_shift_ha << std::endl; | ||
| ss << "qsgw_convergence_tolerance_ev = " | ||
| << qsgw_convergence_tolerance_ev << std::endl; | ||
| ss << "qsgw_write_iteration_matrices = " << std::boolalpha | ||
| << qsgw_write_iteration_matrices << std::endl; | ||
| } |
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
qsgwandqsgw_banddriver tasks on top of the current LibRPAmasterarchitecture.src/qsgw/anddriver/tasks/qsgw.cpp, while reusing the existing EXX, GW, RPA, symmetry, and distributed-matrix paths.mf0) for self-energy construction, update the live eigenpairs after each fixed-basis diagonalization, and support same-grid analytic head-only updates.qsgw_bandoutput helpers.beta = 0.2) and bulk Si k333 with head-only correction and no solid-state mixing.src/qsgw/.This does not change the numerical implementation in
src/core/gw.*,src/core/exx.*, or the existing G0W0 tasks. The only shared-core helper added isPeriodicMapping::erase_mapping()insrc/core/pbc.h, used by the QSGW band BvK remapping path.Deliberate scope limits
qsgw_mixer = none; linear mixing is covered only by the molecular H2O regression.Regression footprint
Validation
Validated at
7fc613eb2c043292a7dbf2f2b249b3761b553df8with a Release+LibRI build on Fisherd:ctest --output-on-failure -j 4: 57/57 passed.python3 utilities/check_librpa_options.py: passed.1.253e-14 Ha.1.588e-13 Ha, maximum gap difference1.007e-12 eV.2.082e-15.0.1.0e-11, below the existing1.0e-4tolerance.git diff --check: passed.This supersedes the closed, conflicting #6 with a clean rebase, a narrower head-only scope, and committed molecular and solid regression coverage.