Skip to content

[Dependency] Data-structure layer source_cell depending back on higher layers #7598

Description

@Critsium-xy

Describe the Code Quality Issue

  • Symptom: cell reverse-includes
    • estate/read_orb.h, estate/cal_nelec_nband.h, estate/module_charge/charge.h (magnetism.cpp, read_atoms_helper.cpp);
    • hamilt/module_xc/exx_info.h (read_atom_species.cpp, bcast_cell.cpp);
    • pw/module_pwdft/soc.h, lcao/module_ri/serialization_cereal.h, io/module_unk/berryphase.h.
  • Root cause: cell carries responsibilities that do not belong to a data-structure layer — reading pseudopotentials / reading orbitals / computing electron counts (read_orb/read_pseudo logically belong to L3).
  • Fix: return cell to a pure "geometry + atoms + k-points" container; relocate read_orb/read_pseudo to upper layers and let them inject into cell after construction; pass exx_info, soc, serialization in from above.
  • Acceptance: source_cell retains only edges to source_base/module_parameter (Note: better not, but considering that PARAM may be hard to deal with, so this is an expedient measure).

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

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions