Refactor: read EXX ABFS/JLE file lists via UnitCell, fully decouple source_cell (#7598) - #7667
Merged
mohanchen merged 1 commit intoJul 22, 2026
Conversation
…cell (deepmodeling#7598) read_atom_species.cpp (source_cell) parsed the STRU ABFS_ORBITAL / ABFS_JLES_ORBITAL sections directly into GlobalC::exx_info, making the source_cell data-structure layer depend on source_hamilt/module_xc. This was the last remaining reverse dependency in source_cell. Route the lists through UnitCell instead — the same place STRU orbital-file names already live (orbital_fn, descriptor_file): - UnitCell gains neutral members abfs_orbital_files / jle_orbital_files. - read_atom_species parses the sections into those members; the exx_info.h include and the cal_exx guard are removed (absent sections are no-ops). - bcast_cell broadcasts the two members as part of bcast_unitcell. - Exx_NAO::init(ucell) copies them into GlobalC::exx_info before Exx_LRI copies info_ri, keeping the EXX-specific routing in the LCAO EXX layer. Because the lists now travel inside the (already broadcast) UnitCell, the dedicated bcast_exx_file_lists() added in deepmodeling#7635 is redundant and removed. After this, source_cell (non-test) includes only source_base and itself. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
Source_cell should be a clean module after this PR. |
8 tasks
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.
Background
Related to #7598 (source_cell should not depend back on higher layers).
After the earlier cleanups (#7633/#7636/#7637 relocations, #7635 broadcast move), the only remaining reverse dependency in non-test
source_cellwas:read_atom_speciesparsed the STRUABFS_ORBITAL/ABFS_JLES_ORBITALsections and pushed the filenames straight intoGlobalC::exx_info.info_ri/info_opt_abfs— the STRU parser (geometry layer) writing into the XC module's global state.Change
Route the lists through
UnitCell, where STRU orbital-file names already live (orbital_fn,descriptor_file):UnitCellgains neutral membersabfs_orbital_files/jle_orbital_files.read_atom_speciesparses the sections into those members; theexx_info.hinclude and thecal_exx || rpaguard are removed (an absent section is a no-op viaSCAN_LINE_BEGIN).bcast_cellbroadcasts the two members as part ofbcast_unitcell.Exx_NAO::init(ucell)copies them intoGlobalC::exx_infobeforeExx_LRIcopiesinfo_ri, keeping the EXX-specific routing (which list feedsinfo_rivsinfo_opt_abfs) in the LCAO EXX layer.Data flow:
Because the lists now travel inside the already-broadcast
UnitCell, the dedicatedbcast_exx_file_lists()added in #7635 is redundant and removed.Result
source_cell(non-test) now#includes onlysource_baseand itself — the reverse-dependency goal of #7598 is met. (Test files still cross layers to build fixtures, which is conventional.)Timing / correctness
init(ucell)runs inESolver_KS_LCAO::before_all_runners(reused by TDDFT / DM2rho / DoubleXC; LR reuses the movedExx_LRI), on all ranks, afterdriver_runhas calledsetup_cell(which reads STRU on rank 0 and broadcastsUnitCell), and before every consumer:Exx_LRIcopiesinfo_ri.generate_matrixruns later in the samebefore_all_runners.RPA_LRI(GlobalC::exx_info.info_ri)is built during SCF, later still.Behaviour is preserved. The
cal_exxguard removal is a no-op in practice: when EXX/RPA is off the ABFS lists are simply unused (Exx_LRI is constructed but not run).Verification
source_cellhas no remainingexx_info/GlobalC::exxreference; no danglingbcast_exx_file_lists.g++ -std=c++14 -fsyntax-onlypasses onread_atom_species.cpp(with__LCAO),bcast_cell.cpp(with__MPI, stubbedmpi.h), and theinit()copy logic compiled against the realexx_info+UnitCellstructs.setup_exx.cpp/esolver pull LibRI and are exercised by CI.Minor note
The now-unused
rpaparameter ofread_atom_speciesis left in place to avoid rippling thesetup_cellsignature; it can be dropped in a follow-up.