Refactor LCAO workflows to use SimulationContext#7668
Open
goodchong wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I plan to refactor the global variable implementation of this project using a new approach.
The new and old global variable mechanisms will currently operate in parallel. The new global variables should contain all the contents of the old global variables, not just those used by the module hs. Variables will be passed to the module hs code as parameters, rather than being copied separately.
Summary
Motivation
This change reduces lower-level reads from GlobalV, GlobalC, and PARAM while keeping legacy globals authoritative at the orchestration boundary. Runtime-derived fields are captured after pseudopotential and basis initialization, and the KS-to-LR transition remains inside the context lifetime.
The staged governance check reports a net reduction of 120 GlobalV, GlobalC, and PARAM references at PR scope.
flowchart TB ROOT["ABACUS 项目"] subgraph S0["L0 装配与配置入口层"] direction LR MAIN["source_main<br/>Main、Driver"] CONTEXT["source_context<br/>Builder、Adapter、Context"] INPUT["module_parameter<br/>INPUT 解析"] end subgraph S1["L1 工作流编排层"] direction LR ESOLVER["source_esolver"] CTRL["module_ctrl"] MDCTRL["MD 编排<br/>run_md、md_base、md_func"] RELAXCTRL["Relax 编排<br/>relax_driver"] LREX["LR ESolver<br/>临时目录例外"] end subgraph S2["L2 计算方法与领域层"] direction LR LCAO["source_lcao<br/>LCAO、Gint、RI、DeepKS、DFT+U、RT、LR"] PW["source_pw<br/>PWDFT、OFDFT、SDFT、DFPT"] MDALG["MD 算法<br/>FIRE、Verlet、Langevin、MSST、NHChain"] RELAXALG["Relax 算法<br/>CG、BFGS、LBFGS、SD"] end subgraph S3["L3 通用科学计算组件层"] direction LR HAMILT["source_hamilt<br/>Hamiltonian、Ewald、XC、vdW"] HSOLVER["source_hsolver<br/>CG、Davidson、BPCG、ELPA、PEXSI"] ESTATE["source_estate<br/>ElecState、Charge、Potential、DM"] end subgraph S4["L4 数据模型与外部边界层"] direction LR CELL["source_cell<br/>UnitCell、Symmetry、Neighbor"] BASIS["source_basis<br/>AO、NAO、PW"] PSI["source_psi<br/>波函数数据"] IO["source_io 叶子模块<br/>HS、WF、DOS、Restart、Output"] end subgraph S5["L5 基础设施与 Kernel 层"] direction LR BASE["source_base<br/>Container、FFT、Grid、Mixing、Libm"] DEVICE["module_device<br/>CPU、CUDA、ROCm、DSP"] KERNEL["各模块 Kernels<br/>POD、Buffer、数值计算"] end ROOT ==> MAIN MAIN ==> ESOLVER ESOLVER ==> LCAO LCAO ==> HAMILT HAMILT ==> CELL CELL ==> BASE classDef l0 fill:#f6c85f,stroke:#7a5b00,color:#111 classDef l1 fill:#6fbbd3,stroke:#24566b,color:#111 classDef l2 fill:#91cf60,stroke:#3d6d24,color:#111 classDef l3 fill:#b39ddb,stroke:#5e4d83,color:#111 classDef l4 fill:#ffab91,stroke:#8b4c39,color:#111 classDef l5 fill:#b0bec5,stroke:#455a64,color:#111 class MAIN,CONTEXT,INPUT l0 class ESOLVER,CTRL,MDCTRL,RELAXCTRL,LREX l1 class LCAO,PW,MDALG,RELAXALG l2 class HAMILT,HSOLVER,ESTATE l3 class CELL,BASIS,PSI,IO l4 class BASE,DEVICE,KERNEL l5