Skip to content

[source_hsolver] source_hsolver should not depend on source_pw #7678

Description

@Critsium-xy

Describe the Code Quality Issue

Description

source_hsolver includes concrete plane-wave Hamiltonian implementations from
source_pw, violating the target dependency boundary.

Locations

Production code (2 files):

  • hsolver_lcaopw.cppsource_pw/module_pwdft/hamilt_pw.h, source_pw/module_pwdft/hamilt_lcaopw.h
  • hsolver_pw_sdft.hsource_pw/module_stodft/hamilt_sdft_pw.h, source_pw/module_stodft/sto_iter.h

Test code (bulk of usages): test/diago_*_test.cpp, test/diago_mock.h,
test/hsolver_supplementary_mock.h reference structure_factor.h, hamilt_pw.h,
op_pw.h, sto_wf.h.

Notes

The solver should operate against the abstract Hamiltonian interface rather than
concrete PW implementations. Tests likely need mocks/fixtures to avoid pulling in
source_pw, or should be moved to the owning module.

Acceptance criteria

  • No #include "source_pw/..." remains in source_hsolver production code.
  • Test dependencies on source_pw are removed or replaced with mocks.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions