Repository navigation
refactor(estate): decouple constraint energy and TDDFT matrix inputs - #8376
Critsium-xy wants to merge 4 commits into
Conversation
…rgy-matrix-decoupling
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
No new correctness defect was identified in the constraint-energy handoff or TDDFT EDM refactor at ac3b1f5. Two test coverage suggestions are inline.
Static review only; no builds or runtime tests were run.
| TEST(EdmTddft, ComplexMatricesInSuppliedLayout) | ||
| { | ||
| Parallel_Blkcyclic layout; | ||
| const int info = layout.init(4, 4, 1, MPI_COMM_WORLD, false); |
There was a problem hiding this comment.
Non-blocking: Please add a case using a split or reordered communicator whose BLACS (0,0) is not world rank 0. The direct and four-rank runs both initialize MPI_COMM_WORLD here, so they cannot distinguish the supplied-layout root/context logic from world-based selection. Keep the result and input-preservation checks for both kernels.
| h[index] = std::complex<double>(real, imag); | ||
| if (i == j) | ||
| { | ||
| s[index] = 2.0; |
There was a problem hiding this comment.
Non-blocking: Please add a complex positive-definite overlap matrix that does not commute with H, and a non-diagonal DMK, with an independently constructed EDM reference for both kernels. With S=2I, exchanging HS^-1 and S^-1H leaves the test unchanged, so operand-order regressions are not covered.
What's changed?
Estate no longer obtains spin-constraint energy through PW/LCAO virtual callbacks or asks a Hamiltonian/controller to prepare TDDFT energy-density matrices.
f_en.esconfield; no duplicate state or new workflow flags.propagator.h.Parallel_Blkcycliclayout for one k point. KeepupdateHk, matrix retrieval and the k-point loop in the existing TDDFT endpoint workflow. Reuse the landed Base matrix/ScaLAPACK interfaces, without depending on unmerged feat(base): add self-contained Matrix2d storage and math #8317.(0,0)dense descriptor. Preserve the serial/ScaLAPACK/Tensor formulas, ordinary transpose operations, global dimensions, host/device transfers and accepted/restart endpoint conditions.Direct production include counts at base
503be43f4b36bc74fa607d4abe23431486f7c29bversus this branch:The remaining Estate → LCAO include is
rho_tau_lcao.h; density construction and broader Gint/Potential ownership are outside this PR. Psi, IO and the agreedversion.hplacement are unchanged.Linked Issue
No separate issue: this is the next scoped step of the module-decoupling work following merged #8333.
Unit Tests and/or Case Tests for my changes
MODULE_ESTATE_elecstate_energyto check nonzero constraint energy in Harris/KS totals, replacement on the next state, and disabling the contribution.MODULE_ESTATE_edm_tddftand its four-rank unit-test variant: a four-orbital complex matrix checks the supplied-layout contract, transpose convention, unchanged inputs and both ScaLAPACK and CPU Tensor/LAPACK paths. These are unit tests, not new integration drivers.scf_deltaspin2/scf_deltaspin4and TDDFT MD/restart endpoints.07_NO_EDM_TDDFTusestd_edm=1and is not claimed as coverage of this EDM branch.Commands run locally:
git diff --cached --checkafter each step, andgit diff --check upstream/develop...HEAD: passed.python tools/03_code_analysis/agent_governance_check.py --stagedafter each step andpython tools/03_code_analysis/agent_governance_check.py --base upstream/develop --head HEAD --format text: no blocking findings; warning rationales below.python tools/03_code_analysis/code_quality_score.py <changed .cpp/.h files>: report generated, 13/19 files at or above 60; all six files below 60 were also below 60 at the base revision (12/18 passing). New EDM unit test scores 92, EDM implementations 95/99.No local builds, unit tests, integration runs or GPU tests were run. The user explicitly requested static implementation and submission followed by CI, because the remote test machine is unavailable. WSL was not installed. The initial head passed the full build matrix (including CUDA, non-MPI, non-LCAO and Makefile), Pyabacus, ASE and pre-commit. Its CUDA runtime check stopped at the shared upstream
scf_out_wffailure, while the CPU test run was still in progress. The branch now includes the upstream fix; the new head requires fresh CI results.Independent static review accepted the original implementation. Independent static integration review also accepted merge commit
ac3b1f5d486510f308c4c0124f2b128d589e79e0with no confirmed integration defects. Nonblocking limitation: GPU handles now initialize/destroy per k-point call; setup overhead has not been measured.Governance Notes
unittests/CMakeLists.txt.PARAM.inp.sc_mag_switchread is named once and reused for producing and consuming constraint energy; no new global control is introduced.Upstream integration
Merge commit
ac3b1f5d486510f308c4c0124f2b128d589e79e0incorporatesupstream/developat503be43f4b36bc74fa607d4abe23431486f7c29b, including #8372 and #8326. The merge had no conflicts.git diff --binaryconfirms the Estate patch against the updated base is byte-for-byte identical to the original patch against its former base.git diff --check upstream/develop...HEADand the diff-scoped governance check passed without blockers; existing warning rationales above remain applicable. No local builds or runtime tests were run for this merge; normal PR CI verifies the new head.