Commit 707f092
Formatting files in /source/source_hamilt/module_xc, try to remove GlobalC::exx_info (deepmodeling#7399)
* Refactor: Improve code style in xc_functional_libxc files
- Add tau_xc overload with hybrid_alpha parameter
- Add ElecState::set_exx overload with cal_exx and hybrid_alpha parameters
- Format code: one parameter per line, align code, initialize variables, one variable per line, add braces to single-line for/if
* update
* Refactor XC functional files for code style compliance
- Format function parameters to one per line
- Initialize all variables when declared
- Separate variable declarations onto individual lines
- Add braces for single-line if/for statements
- Improve code alignment and readability
* modify
* update
* update
* update xc
* update
* fix bug
* change libxc.h to libxc_abacus.h
* format libxc_setup.cpp
* update libxc_setup.cpp
* refactor: split Exx_Info struct into independent header files
This is the first step of removing GlobalC::exx_info global variable.
## Changes
- Split Exx_Info into 4 independent header files:
- exx_info_global.h: Exx_Info_Global (core global settings)
- exx_info_lip.h: Exx_Info_Lip (LIP method parameters)
- exx_info_ri.h: Exx_Info_RI (RI method parameters)
- exx_info_opt_abfs.h: Exx_Info_Opt_ABFs (optimized ABF parameters)
- Modified exx_info.h to include the 4 new headers
- Updated all references from Exx_Info::Exx_Info_* to Exx_Info_*
## Benefits
1. Reduced coupling: modules can now include only needed headers
2. Types are now independent, preparing for parameter passing
3. GlobalC::exx_info remains unchanged, fully backward compatible
## Next Steps (Phase 2-3)
Phase 2: Replace references with value copies in Exx_Info_Lip/RI
- Exx_Info_Lip: ccp_type& and hse_omega& -> value copies
- Exx_Info_RI: coulomb_param& -> value copy
- This removes dependency on Exx_Info_Global lifetime
Phase 3: Remove GlobalC::exx_info global variable
- Pass Exx_Info_* as parameters instead of global access
- Update ~60 files that use GlobalC::exx_info
- Modules: module_xc, module_ri, source_lcao, source_esolver, source_pw
* update
* update
* fix
* refactor: phase2 - replace references with value copies in Exx_Info_Lip/RI
## Changes
### 1. Modified struct definitions
**`exx_info_lip.h`**: Changed references to value copies
- `const Ccp_Type& ccp_type` → `Ccp_Type ccp_type`
- `const double& hse_omega` → `double hse_omega = 0.11`
- Removed constructor dependency on Exx_Info_Global
**`exx_info_ri.h`**: Changed reference to value copy
- `const std::map<...>& coulomb_param` → `std::map<...> coulomb_param`
- Removed constructor dependency on Exx_Info_Global
### 2. Added sync method in exx_info.h
```cpp
void sync_from_global()
{
info_lip.ccp_type = info_global.ccp_type;
info_lip.hse_omega = info_global.hse_omega;
info_ri.coulomb_param = info_global.coulomb_param;
}
```
### 3. Added sync calls
| File | Location | Purpose |
|------|----------|----------|
| `input_conv.cpp` | Line 520 | After EXX parameter initialization |
| `esolver_lrtd_lcao.cpp` | Lines 266, 404 | After setting ccp_type |
| `RPA_LRI.hpp` | Line 148 | After setting ccp_type |
## Benefits
1. **Eliminated lifetime dependency**: Exx_Info_Lip and Exx_Info_RI are now independent
2. **Safe to copy/move**: No dangling reference risks
3. **Ready for parameter passing**: Structs can be safely passed as function parameters
4. **Fully backward compatible**: GlobalC::exx_info still exists and works unchanged
## Next Steps (Phase 3)
Remove GlobalC::exx_info global variable by:
- Passing Exx_Info_* structs as parameters
- Updating ~60 files that access GlobalC::exx_info
- Modules: module_xc, module_ri, source_lcao, source_esolver, source_pw
* update
---------
Co-authored-by: abacus_fixer <mohanchen@pku.eud.cn>
Co-authored-by: Erjie Wu <110683255+ErjieWu@users.noreply.github.com>1 parent 33cedb4 commit 707f092
58 files changed
Lines changed: 3575 additions & 2866 deletions
File tree
- source
- source_estate/module_pot
- source_hamilt
- module_surchem/test
- module_xc
- test
- source_io
- module_chgpot
- module_parameter
- source_lcao
- module_lr
- potentials
- module_ri
- source_pw/module_pwdft
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 11 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 12 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 13 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 14 | | |
101 | 15 | | |
102 | | - | |
| 16 | + | |
103 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
104 | 21 | | |
105 | 22 | | |
106 | 23 | | |
| |||
109 | 26 | | |
110 | 27 | | |
111 | 28 | | |
112 | | - | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments