Skip to content

Revert the dependency between unitcell in source_cell and ORB files in source_basis#7644

Open
mohanchen wants to merge 7 commits into
deepmodeling:developfrom
mohanchen:20260715
Open

Revert the dependency between unitcell in source_cell and ORB files in source_basis#7644
mohanchen wants to merge 7 commits into
deepmodeling:developfrom
mohanchen:20260715

Conversation

@mohanchen

Copy link
Copy Markdown
Collaborator

Revert the dependency between unitcell in source_cell and ORB files in source_basis

abacus_fixer added 3 commits July 15, 2026 22:27
This commit implements dependency inversion to decouple source_cell from
source_basis ORB files. The key changes are:

1. Created abstract base class NonlocalInfoBase in source_cell/nonlocal_info_base.h
   - Provides pure virtual interface for non-local pseudopotential data access
   - Eliminates source_cell's direct dependency on ORB headers

2. Implemented adapter class LCAONonlocalInfo in source_lcao/LCAO_nonlocal_info.h
   - Inherits from NonlocalInfoBase
   - Wraps the existing InfoNonlocal class
   - Provides type-safe access to underlying LCAO-specific non-local data

3. Modified UnitCell to use NonlocalInfoBase* instead of InfoNonlocal
   - Changed from value member to pointer
   - Added proper cleanup in destructor

4. Moved setup_nonlocal.h/cpp from source_cell to source_lcao
   - Consolidates LCAO-specific code in the appropriate module
   - Updated include paths in dependent files

5. Updated all call sites to use the new abstract interface
   - Replaced direct member access with getter methods
   - Ensured const-correctness throughout

This design follows the Dependency Inversion Principle:
- High-level module (source_cell) now depends on abstraction (NonlocalInfoBase)
- Low-level module (source_lcao) implements the abstraction
- source_cell no longer depends on source_basis ORB headers
@mohanchen mohanchen requested a review from Critsium-xy July 15, 2026 15:37
@mohanchen mohanchen added Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0 labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant