Skip to content

Commit 71f3524

Browse files
mohanchenabacus_fixer
andauthored
Update out_chg 2 and out_pot 3, and elf (#7379)
* update 18_md examples * update out_chg 2 * update out_pot function * feat(module_io): 优化初始电荷密度/势能输出,支持 out_freq_ion 控制和动态文件名 - 添加 gen_ini_filename() 辅助函数,统一生成初始电荷密度/势能文件名 - out_freq_ion=0 时输出单个固定名称文件(不带 g#) - out_freq_ion>0 时每个几何步输出独立文件(带 g#) - 更新文档,说明两种模式的区别 修改文件: - docs/advanced/output_files/output-specification.md - source/source_io/module_chgpot/write_init.cpp - source/source_io/module_chgpot/write_init.h - source/source_io/module_parameter/read_input_item_output.cpp * fix(module_io): 修正 out_freq_ion=0 时初始电荷密度/势能输出逻辑 - out_freq_ion=0 时,每个几何步都输出(覆盖同一个文件) - out_freq_ion>0 时,只在 istep 是 out_freq_ion 倍数时输出 - 更新所有相关文档和注释 修改文件: - docs/advanced/output_files/output-specification.md - source/source_io/module_chgpot/write_init.cpp - source/source_io/module_chgpot/write_init.h - source/source_io/module_parameter/read_input_item_output.cpp * fix a bug about out_pot * fix bugs * update * update ELF and add openmp parallel * update elf * update elf * update example reference data * enable elf for rt-tddft, but results are wrong * fix elf test * fix elf test in 03_NAO_multik * fix output of write_elf * fix bug * update potential file, fix bug * fix elf test in ofdft * fix: Move write_pot_init to ElecState::init_scf for correct timing The write_pot_init was being called in ESolver_FP::before_scf before the effective potential was computed. This caused pot_ini.cube to contain: - All zeros for calculation=scf / first ionic step (istep=0) - Converged potential from previous ionic step for relax/md with istep>0 The fix moves write_pot_init to ElecState::init_scf, which is called after pot->init_pot(charge) computes the effective potential from the initial charge density. This ensures pot_ini.cube correctly contains the effective potential corresponding to the initial charge density. Changes: - Modified ElecState::init_scf signature to accept istep, out_dir, inp parameters - Added write_pot_init call after pot->init_pot() in init_scf - Updated pw::setup_pot to pass through the new parameters - Updated all callers (LCAO and PW) to provide the new parameters - Removed the premature write_pot_init call from ESolver_FP::before_scf * Remove unused parameters from ElecState::init_scf - Removed unused 'symm' and 'wfcpw' parameters from init_scf function - Updated all call sites to match the new signature - Simplified function interface by removing parameters not used in implementation * Fix missing io_basic library link in elecstate tests - Added io_basic library dependency to MODULE_ESTATE_elecstate_base test - Added io_basic library dependency to MODULE_ESTATE_elecstate_pw test - Fixes undefined reference to ModuleIO::write_pot_init * update init_scf * fix * fix bug * remove dependence of parameter for write_cube.cpp * fix bugs * fix bug * add a new file init_scf * update estate tests * delete useless inclusion --------- Co-authored-by: abacus_fixer <mohanchen@pku.eud.cn>
1 parent 29d37f4 commit 71f3524

57 files changed

Lines changed: 565 additions & 306 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/advanced/output_files/output-specification.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,18 @@ All output file naming conventions can be found in the online documentation (wit
4949
| `s12` | Non-collinear spin calculation |
5050
| `k#` | k-point index (e.g., `k1`, `k2`) |
5151
| `g#` | Ionic step index for relax/md (e.g., `g1`, `g2`) |
52+
| `ini` | Initial state (before electronic iteration), used before or after `g#` |
5253

5354
**Important:**
5455
- All index numbers start from 1 (not 0)
5556
- For Gamma-only algorithm in LCAO, no `k` index is included
5657
- Overlap matrix `s` does not distinguish spin, so only one matrix is output
58+
- For initial charge density output (`out_chg = 2`):
59+
- `out_freq_ion = 0`: `chg_ini.cube` (nspin=1) or `chgs{#}_ini.cube` (nspin=2/4) - output at every step (overwrite same file)
60+
- `out_freq_ion > 0`: `chgg{#}_ini.cube` (nspin=1) or `chgs{#}g{#}_ini.cube` (nspin=2/4) - output every out_freq_ion steps
61+
- For initial potential output (`out_pot = 3`):
62+
- `out_freq_ion = 0`: `pot_ini.cube` (nspin=1) or `pots{#}_ini.cube` (nspin=2/4) - output at every step (overwrite same file)
63+
- `out_freq_ion > 0`: `potg{#}_ini.cube` (nspin=1) or `pots{#}g{#}_ini.cube` (nspin=2/4) - output every out_freq_ion steps
5764

5865
### 2.2 Examples
5966

@@ -62,7 +69,22 @@ All output file naming conventions can be found in the online documentation (wit
6269
| `chgs1.cube` | Charge density, spin 1 |
6370
| `chgs2.cube` | Charge density, spin 2 |
6471
| `chgs3.cube` | Charge density, spin 3 (non-collinear with SOC) |
72+
| `chg_ini.cube` | Initial charge density (out_freq_ion=0, nspin=1) |
73+
| `chgs1_ini.cube` | Initial charge density (out_freq_ion=0, spin 1, nspin=2/4) |
74+
| `chgg1_ini.cube` | Initial charge density, geometry step 1 (nspin=1) |
75+
| `chgs1g1_ini.cube` | Initial charge density, spin 1, geometry step 1 (nspin=2/4) |
76+
| `pot_ini.cube` | Initial potential (out_freq_ion=0, nspin=1) |
77+
| `pots1_ini.cube` | Initial potential (out_freq_ion=0, spin 1, nspin=2/4) |
78+
| `potg1_ini.cube` | Initial potential, geometry step 1 (nspin=1) |
79+
| `pots1g1_ini.cube` | Initial potential, spin 1, geometry step 1 (nspin=2/4) |
6580
| `pots1.cube` | Local potential, spin 1 |
81+
| `elftot.cube` | ELF, total (nspin=1/4) |
82+
| `elfs1.cube` | ELF, spin 1 (nspin=2) |
83+
| `elfs2.cube` | ELF, spin 2 (nspin=2) |
84+
| `elftot.cube` | ELF, total (nspin=2) |
85+
| `elftotg1.cube` | ELF, total, geometry step 1 (nspin=1/4) |
86+
| `elfs1g1.cube` | ELF, spin 1, geometry step 1 (nspin=2) |
87+
| `elftotg1.cube` | ELF, total, geometry step 1 (nspin=2) |
6688
| `eig_occ.txt` | Eigenvalues and occupations |
6789
| `doss1g1_nao.txt` | DOS, spin 1, geometry step 1, NAO basis |
6890
| `wf_pw.dat` | Wavefunction, plane wave basis |
@@ -79,8 +101,25 @@ All output file naming conventions can be found in the online documentation (wit
79101
| `band.txt` | Band structure |
80102
| `chgs1.cube`, `chgs2.cube` | Charge density (spin 1, spin 2) |
81103
| `chg.cube` | Total charge density |
104+
| Initial charge density (out_chg=2) | |
105+
| `chg_ini.cube` | Initial charge density (out_freq_ion=0, nspin=1) |
106+
| `chgs{#}_ini.cube` | Initial charge density (out_freq_ion=0, spin {#}, nspin=2/4) |
107+
| `chgg{#}_ini.cube` | Initial charge density (out_freq_ion>0, geometry step {#}, nspin=1) |
108+
| `chgs{#}g{#}_ini.cube` | Initial charge density (out_freq_ion>0, spin {#}, geometry step {#}, nspin=2/4) |
109+
| Initial potential (out_pot=3) | |
110+
| `pot_ini.cube` | Initial potential (out_freq_ion=0, nspin=1) |
111+
| `pots{#}_ini.cube` | Initial potential (out_freq_ion=0, spin {#}, nspin=2/4) |
112+
| `potg{#}_ini.cube` | Initial potential (out_freq_ion>0, geometry step {#}, nspin=1) |
113+
| `pots{#}g{#}_ini.cube` | Initial potential (out_freq_ion>0, spin {#}, geometry step {#}, nspin=2/4) |
82114
| `taus1.cube`, `taus2.cube` | Kinetic energy density (tau) |
83115
| `pots1.cube`, `pots2.cube` | Local potential |
116+
| ELF (out_elf) | |
117+
| `elftot.cube` | ELF, total (nspin=1/4) |
118+
| `elfs1.cube`, `elfs2.cube` | ELF, spin 1/2 (nspin=2) |
119+
| `elftot.cube` | ELF, total (nspin=2) |
120+
| `elftotg{#}.cube` | ELF, total, geometry step {#} (nspin=1/4) |
121+
| `elfs{#}g{#}.cube` | ELF, spin {#}, geometry step {#} (nspin=2) |
122+
| `elftotg{#}.cube` | ELF, total, geometry step {#} (nspin=2) |
84123

85124
## 3. File Format Standards
86125

0 commit comments

Comments
 (0)