Skip to content

Refactor: remove dead cross module includes#7574

Draft
Critsium-xy wants to merge 3 commits into
deepmodeling:developfrom
Critsium-xy:refactor/remove-dead-cross-module-includes
Draft

Refactor: remove dead cross module includes#7574
Critsium-xy wants to merge 3 commits into
deepmodeling:developfrom
Critsium-xy:refactor/remove-dead-cross-module-includes

Conversation

@Critsium-xy

Copy link
Copy Markdown
Collaborator

No description provided.

Critsium-xy and others added 3 commits July 1, 2026 13:28
Drop two dead includes that create needless reverse dependencies from
source_cell onto higher layers:
  - source_estate/read_orb.h  (elecstate::read_orb_file not used here;
    the real user is read_atoms_helper.cpp)
  - source_basis/module_ao/ORB_read.h  (ORB / LCAO_Orbitals not used here)

Verified by compiling the `cell` target with ENABLE_LCAO=ON so the
former `#ifdef __LCAO` block was actually exercised.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Static scan + per-target compile verification identified 9 unused
includes that create reverse/lateral dependency edges between modules.
Removing them weakens the coupling without any behavior change:

  io   -> md    input_conv.cpp        (md_func.h)
  estate -> lcao  elecstate_energy_terms.cpp, elecstate_print.cpp
                                       (module_deepks/LCAO_deepks.h)
  lcao -> pw    rdmft_tools.cpp (structure_factor.h),
                wavefunc_in_pw.cpp (soc.h)
  lcao -> io    FORCE_gamma.cpp, FORCE_k.cpp (module_hs/write_HS.h)
  pw   -> io    forces_cc.cpp, forces_scc.cpp (module_output/output_log.h)

Verified by building io_basic, elecstate, rdmft, hamilt_lcao and
module_pwdft (ENABLE_LCAO=ON) after removal; all link targets compile.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Remove unused source_io includes across the esolver drivers. These are
on the allowed esolver->io direction, so this is include hygiene rather
than decoupling, but it trims 29 needless includes.

Verified three ways:
  1. `make esolver` (ENABLE_LCAO=ON) recompiles all 21 TUs, 0 errors.
  2. Feature-guarded headers checked explicitly since __RAPIDJSON,
     __EXX/__LIBRI and __MLALGO are OFF in this build: the json
     (init_info.h/output_info.h) and restart_exx_csr.h symbols are
     unused in their consumers (Json::add_output_scf_mag in
     esolver_ks.cpp comes from output_info.h, which is kept).
  3. Whole-file precise-symbol sweep (incl. all #ifdef blocks) finds
     no specific symbol of any removed header in its consumer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant