Skip to content

[source_hsolver] source_hsolver should not depend on source_hamilt (Further discussion needed!!) #7679

Description

@Critsium-xy

Describe the Code Quality Issue

Description

source_hsolver pervasively depends on source_hamilt, primarily via the
hamilt::Hamilt base class (source_hamilt/hamilt.h). This is the most fundamental
coupling and needs an architectural decision, not a mechanical fix.

Locations (22 usages: 16 production, 6 test)

  • source_hamilt/hamilt.h — included by most diago_* and hsolver_* headers
    (diago_bpcg.h, diago_cusolver.h, diago_cusolvermp.h, diago_elpa.h,
    diago_elpa_native.h, diago_iter_assist.h, diago_lapack.h, diago_pexsi.h,
    diago_scalapack.h, hsolver_lcao.h, hsolver_lcaopw.h, hsolver_pw.{h,cpp},
    parallel_k2d.h)
  • source_hamilt/matrixblock.hdiago_scalapack.cpp, parallel_k2d.h
  • source_hamilt/module_xc/exx_info.hhsolver_lcaopw.cpp

Notes

hamilt::Hamilt is the core input interface to the solvers, so removing this
dependency requires a design choice: e.g. relocate the abstract Hamiltonian interface
into an allowed lower-level module, extract a minimal interface source_hsolver can
depend on, or explicitly whitelist source_hamilt as an accepted exception.

Acceptance criteria

  • A decision is recorded on how source_hsolver obtains its Hamiltonian abstraction.
  • Either the source_hamilt dependency is removed, or it is documented as an approved exception.

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Identify the specific code file or section with the code quality issue.
  • Investigate the issue and determine the root cause.
  • Research best practices and potential solutions for the identified issue.
  • Refactor the code to improve code quality, following the suggested solution.
  • Ensure the refactored code adheres to the project's coding standards.
  • Test the refactored code to ensure it functions as expected.
  • Update any relevant documentation, if necessary.
  • Submit a pull request with the refactored code and a description of the changes made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RefactorRefactor ABACUS codesThe Absolute ZeroReduce the "entropy" of the code to 0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions