Skip to content

Commit eadb2e0

Browse files
authored
Update the output filenames when out_wfc_lcao turns on (#6205)
* change the output of wave functions * add nspin==4 case for write_wfc_nao.cpp * update the readin wave functions in 02_NAO_Gamma/013_NO_GO_get_wf test * update wave function in 014 examples * update 016_NO_GO_wfc_out * update 015_NO_GO_wfc_get_pchg example * update output information for nspin=4 when gamma only using LCAO basis * update 02_NAO_Gamma * update 32 and 33 examples in 03_NAO_multik * update CASES in 03_NAO_multik * add OW test in 02_NAO_Gamma 023_NO_GO_NVT_OW * add an output wave function test in TDDFT * change the name of read_wfc_to_rho.cpp to read_wf2rho_pw.cpp * update the function in charge_init.cpp * remove PARAM.inp.out_app_flag in write_wfc_nao * update the tests for read_wfc_nao and write_wfc_nao * fix makefile * update CMakeLists * update read_wf2rho_pw * fix error in rt-TDDFT version on GPU * change file name * update examples * update 02_NO_CH_OW_TDDFT example * update example * update according to suggestions
1 parent e1b87cd commit eadb2e0

File tree

159 files changed

+762
-390
lines changed

Some content is hidden

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

159 files changed

+762
-390
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,14 +1681,14 @@ These variables are used to control the output of properties.
16811681

16821682
- **Type**: Integer
16831683
- **Availability**: Numerical atomic orbital basis
1684-
- **Description**: Whether to output the wavefunction coefficients into files in the folder `OUT.${suffix}`. The files are named as `WFC_{GAMMA|K}{index of K point}`, and if [out_app_flag](#out_app_flag) is false, the file name will also contains `_ION{ION step}`, where `ION step` is the index of ionic step:
1684+
- **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder `OUT.${suffix}`. The files are named as `wf{s}{spin index}{k(optinal)}{k-point index}{g(optional)}{geometry index1}{_nao} + {".txt"/".dat"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and 's12' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. In addition, if 'gamma_only' is set to 0, then the optinoal k-point sampling index appears with the k-point index attached to the electronic wave function file names. Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optinal 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the wave functions accumulate during ionic steps.
16851685
- 0: no output
16861686
- 1: (txt format)
1687-
- gamma-only: `WFC_NAO_GAMMA1_ION1.txt` or `WFC_NAO_GAMMA1.txt`, ...;
1688-
- non-gamma-only: `WFC_NAO_K1_ION1.txt` or `WFC_NAO_K1.txt`, ...;
1687+
- gamma-only: `wfs1_nao.txt` or `wfs2_nao.txt`, ...;
1688+
- non-gamma-only: `wfs1k1_nao.txt` or `wfs1k2_nao.txt`, ...;
16891689
- 2: (binary format)
1690-
- gamma-only: `WFC_NAO_GAMMA1_ION1.dat` or `WFC_NAO_GAMMA1.dat`, ...;
1691-
- non-gamma-only: `WFC_NAO_K1_ION1.dat` or `WFC_NAO_K1.dat`, ....
1690+
- gamma-only: `wfs1_nao.dat` or `wfs2_nao.dat`, ...;
1691+
- non-gamma-only: `wfs1k1_nao.dat` or `wfs1k2_nao.dat`, ....
16921692

16931693
The corresponding sequence of the orbitals can be seen in [Basis Set](../pp_orb.md#basis-set).
16941694

source/Makefile.Objects

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ OBJS_IO=input_conv.o\
514514
rhog_io.o\
515515
read_exit_file.o\
516516
read_wfc_pw.o\
517-
read_wfc_to_rho.o\
517+
read_wf2rho_pw.o\
518518
restart.o\
519519
binstream.o\
520520
to_wannier90.o\

source/module_elecstate/module_charge/charge_init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "module_hamilt_pw/hamilt_pwdft/parallel_grid.h"
1717
#include "module_io/cube_io.h"
1818
#include "module_io/rhog_io.h"
19-
#include "module_io/read_wfc_to_rho.h"
19+
#include "module_io/read_wf2rho_pw.h"
2020
#ifdef USE_PAW
2121
#include "module_cell/module_paw/paw_cell.h"
2222
#endif
@@ -247,7 +247,7 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
247247
const K_Vectors* kv = reinterpret_cast<const K_Vectors*>(klist);
248248
const int nkstot = kv->get_nkstot();
249249
const std::vector<int>& isk = kv->isk;
250-
ModuleIO::read_wfc_to_rho(pw_wfc, symm, kv->ik2iktot.data(), nkstot, isk, *this);
250+
ModuleIO::read_wf2rho_pw(pw_wfc, symm, kv->ik2iktot.data(), nkstot, isk, *this);
251251
}
252252
}
253253

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "module_io/write_elecstat_pot.h"
3131
#include "module_io/write_istate_info.h"
3232
#include "module_io/write_proj_band_lcao.h"
33-
#include "module_io/write_wfc_nao.h"
3433
#include "module_parameter/parameter.h"
3534

3635
// be careful of hpp, there may be multiple definitions of functions, 20250302, mohan
@@ -167,8 +166,14 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
167166

168167
// 5) read psi from file
169168
if (PARAM.inp.init_wfc == "file")
170-
{
171-
if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, this->pv, *(this->psi), this->pelec))
169+
{
170+
if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir,
171+
this->pv,
172+
*(this->psi),
173+
this->pelec,
174+
this->pelec->klist->ik2iktot,
175+
this->pelec->klist->get_nkstot(),
176+
PARAM.inp.nspin))
172177
{
173178
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed");
174179
}

source/module_esolver/esolver_ks_lcao_tddft.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "module_io/td_current_io.h"
66
#include "module_io/write_HS.h"
77
#include "module_io/write_HS_R.h"
8-
#include "module_io/write_wfc_nao.h"
98
#include "module_elecstate/elecstate_tools.h"
109

1110
//--------------temporary----------------------------

source/module_esolver/lcao_after_scf.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,18 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep, const
178178
//------------------------------------------------------------------
179179
if (elecstate::ElecStateLCAO<TK>::out_wfc_lcao && (istep % PARAM.inp.out_interval == 0))
180180
{
181-
ModuleIO::write_wfc_nao(elecstate::ElecStateLCAO<TK>::out_wfc_lcao,
182-
this->psi[0],
183-
this->pelec->ekb,
184-
this->pelec->wg,
185-
this->pelec->klist->kvec_c,
186-
this->pv,
187-
istep);
188-
}
181+
ModuleIO::write_wfc_nao(elecstate::ElecStateLCAO<TK>::out_wfc_lcao,
182+
PARAM.inp.out_app_flag,
183+
this->psi[0],
184+
this->pelec->ekb,
185+
this->pelec->wg,
186+
this->pelec->klist->kvec_c,
187+
this->pelec->klist->ik2iktot,
188+
this->pelec->klist->get_nkstot(),
189+
this->pv,
190+
PARAM.inp.nspin,
191+
istep);
192+
}
189193

190194
//------------------------------------------------------------------
191195
//! 7) write DeePKS information in LCAO basis

source/module_esolver/lcao_before_scf.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "module_hamilt_lcao/module_deltaspin/spin_constrain.h"
2929
#include "module_io/cube_io.h"
3030
#include "module_io/write_elecstat_pot.h"
31-
#include "module_io/write_wfc_nao.h"
3231
#ifdef __EXX
3332
#include "module_io/restart_exx_csr.h"
3433
#endif

source/module_esolver/lcao_others.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
#include "module_io/read_wfc_nao.h"
3131
#include "module_io/write_elecstat_pot.h"
32-
#include "module_io/write_wfc_nao.h"
3332

3433
#ifdef __EXX
3534
#include "module_io/restart_exx_csr.h"
@@ -175,9 +174,15 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
175174
// init wfc from file
176175
if (istep == 0 && PARAM.inp.init_wfc == "file")
177176
{
178-
if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, this->pv, *(this->psi), this->pelec))
177+
if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir,
178+
this->pv,
179+
*(this->psi),
180+
this->pelec,
181+
this->pelec->klist->ik2iktot,
182+
this->pelec->klist->get_nkstot(),
183+
PARAM.inp.nspin))
179184
{
180-
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO<TK, TR>::others", "read wfc nao failed");
185+
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO::others", "read wfc nao failed");
181186
}
182187
}
183188

source/module_io/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ list(APPEND objects
1818
rhog_io.cpp
1919
read_exit_file.cpp
2020
read_wfc_pw.cpp
21-
read_wfc_to_rho.cpp
21+
read_wf2rho_pw.cpp
2222
restart.cpp
2323
binstream.cpp
2424
write_wfc_pw.cpp

source/module_io/read_input_item_elec_stru.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ void ReadInput::item_elec_stru()
528528
{
529529
if (para.input.nspin == 4)
530530
{
531-
ModuleBase::WARNING_QUIT("NOTICE", "nspin=4(soc or noncollinear-spin) does not support gamma only calculation");
531+
ModuleBase::WARNING_QUIT("NOTICE", "nspin=4 (soc or noncollinear-spin) does not support gamma\n only calculation");
532532
}
533533
}
534534
};

0 commit comments

Comments
 (0)