Commit 0ee6b28
Refactor the relax module (#7456)
* format update
* replace new with vector
* format update
* update
* update
* update
* move bfgs.h to ions_move_bfgs2.h
* fix
* add relax_data
* update
* update
* update
* fix
* fix test of relax module
* remove ZEROS function
* remove GlobalC, phase 1
* fix bug
* remove GlobalV::ofs_running
* fix bugs
* update
* remove esolver_ks.h
* fix a bug
* delete useless variable
* refactor(relax_driver): 重构弛豫驱动模块
主要修改:
1. 移除了 relax_driver.h 中未使用的 Ions_Move_BFGS2 bfgs_trad 成员变量及其头文件包含
2. 将 relax_driver.cpp 中 while 循环内的逻辑拆分为多个独立函数:
- init_relax(): 初始化弛豫方法
- iter_info(): 打印迭代信息
- esolve(): 电子结构计算
- relax_step(): 执行单次弛豫步骤
- stru_out(): 输出结构文件
- json_out(): 输出 JSON 结果
- stop_cond(): 检查停止条件
- final_out(): 最终输出
3. 添加了成员变量用于缓存计算结果:force_, stress_, force_step, stress_step
4. 优化了 final_out() 函数,将重复的条件判断合并为早期返回
5. 所有成员变量和成员函数调用都添加了 this-> 前缀,提高代码可读性
* update
* change name
* update
* optimize
* update
* improve the logic
* update
* change istep starting from 0
* update istep, should be starting from 0, when output, should be istep+1
* remove class variables
* update
* update
* update
* update
* update
* move istep in ions_move_basic.h
* remove converged variable in ions_move_basic
* fix test
* remove a parameter update_iter in ions_move_basic
* remove some variables abot etot and etot_p
* update, remove variables
* update
* remove relax_methods
* delete useless variables
* update move_cg method
* remove static members in lattice_change_cg files
---------
Co-authored-by: abacus_fixer <mohanchen@pku.eud.cn>1 parent 2cdb1f6 commit 0ee6b28
53 files changed
Lines changed: 2386 additions & 2552 deletions
File tree
- python/pyabacus/src/ModuleDriver
- source
- source_io
- module_parameter
- test
- source_main
- source_relax
- test
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 | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
464 | 466 | | |
465 | 467 | | |
466 | 468 | | |
| 469 | + | |
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
| |||
472 | 475 | | |
473 | 476 | | |
474 | 477 | | |
475 | | - | |
476 | | - | |
| 478 | + | |
477 | 479 | | |
478 | 480 | | |
479 | 481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | | - | |
195 | 193 | | |
196 | 194 | | |
197 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
0 commit comments