Skip to content

Commit 6a53fb1

Browse files
committed
update output file names of command out_wfc_pw
1 parent ce03241 commit 6a53fb1

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,8 @@ These variables are used to control the output of properties.
16401640

16411641
- **Type**: Integer
16421642
- **Description**: After self-consistent-field calculations, control the interval of ionic movements for printing properties. These properties cover charge density, local potential, electrostatic potential, Hamiltonian matrix, overlap matrix, density matrix, Mulliken population analysis and so on.
1643-
- **Default**: 1
1643+
- **Default**: 0
1644+
- **Note**: If you want to use out_freq_elec, please set out_freq_ion to 1, otherwise out_freq_elec is useless
16441645

16451646
### out_freq_elec
16461647

@@ -1722,12 +1723,16 @@ These variables are used to control the output of properties.
17221723

17231724
- **Type**: Integer
17241725
- **Availability**: Output electronic wave functions in plane wave basis, or transform the real-space electronic wave function into plane wave basis (see get_wf option in [calculation](#calculation) with NAO basis)
1725-
- **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}{k-point index}{_pw} + {".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.
1726+
- **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder `OUT.${suffix}`. The files are named as `wf{k}{k-point index}{s}{spin index}{g}{geometry index}{e}{electronic iteration index}{_pw} + {".txt"/".dat"}`. Here, 's' refers to spin but the label will not show up for non-spin-polarized calculations, where s1 means spin up channel while s2 means spin down channel, and 's4' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled.
17261727
- 0: no output
17271728
- 1: (txt format)
1728-
- non-gamma-only: `wfs1k1_pw.txt` or `wfs1k2_pw.txt`, ...;
1729+
- non-gamma-only with nspin=1: `wfk1_pw.txt`, `wfk2_pw.txt`, ...;
1730+
- non-gamma-only with nspin=2: `wfk1s1_pw.txt`, `wfk1s2_pw.txt`, `wfk2s1_pw.txt`, `wfk2s2_pw.txt`, ...;
1731+
- non-gamma-only with nspin=4: `wfk1s4_pw.txt`, `wfk2s4_pw.txt`, ...;
17291732
- 2: (binary format)
1730-
- non-gamma-only: `wfs1k1_pw.dat` or `wfs1k2_pw.dat`, ....
1733+
- non-gamma-only with nspin=1: `wfk1_pw.dat`, `wfk2_pw.dat`, ...;
1734+
- non-gamma-only with nspin=2: `wfk1s1_pw.dat`, `wfk1s2_pw.dat`, `wfk2s1_pw.dat`, `wfk2s2_pw.dat`, ...;
1735+
- non-gamma-only with nspin=4: `wfk1s4_pw.dat`, `wfk2s4_pw.dat`, ...;
17311736
- **Default**: 0
17321737
- **Note**: In the 3.10-LTS version, the file names are WAVEFUNC1.dat, WAVEFUNC2.dat, etc.
17331738

source/source_esolver/esolver_ks_pw.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,14 +622,20 @@ void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int
622622
{
623623
if (iter % PARAM.inp.out_freq_elec == 0 || iter == PARAM.inp.scf_nmax || conv_esolver)
624624
{
625-
// if iter_in = -1, iter will not appera in file name
625+
// if iter_in = -1, iter will not appear in file name
626626
int iter_in = -1;
627627
if(iter % PARAM.inp.out_freq_elec == 0)
628628
{
629629
iter_in = iter;
630630
}
631631

632-
ModuleIO::write_wfc_pw(istep, iter_in,
632+
int istep_in = istep;
633+
if(PARAM.inp.calculation == "scf" || PARAM.inp.calculation == "nscf")
634+
{
635+
istep_in = -1;
636+
}
637+
638+
ModuleIO::write_wfc_pw(istep_in, iter_in,
633639
GlobalV::KPAR,
634640
GlobalV::MY_POOL,
635641
GlobalV::MY_RANK,

source/source_io/test/support/INPUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ lspinorb 0 #consider the spin-orbit interaction
3030
kpar 1 #devide all processors into kpar groups and k points will be distributed among each group
3131
bndpar 1 #devide all processors into bndpar groups and bands will be distributed among each group
3232
out_freq_elec 0 #the frequency ( >= 0) of electronic iter to output charge density and wavefunction. 0: output only when converged
33+
out_freq_ion 0 #the frequency ( >= 0 ) of ionic step to output charge density and wavefunction. 0: output only when ion steps are finished
3334
dft_plus_dmft 0 #true:DFT+DMFT; false: standard DFT calcullation(default)
3435
rpa 0 #true:generate output files used in rpa calculation; false:(default)
3536
mem_saver 0 #Only for nscf calculations. if set to 1, then a memory saving technique will be used for many k point calculations.
3637
diago_proc 4 #the number of procs used to do diagonalization
3738
nbspline -1 #the order of B-spline basis
3839
soc_lambda 1 #The fraction of SOC based on scalar relativity (SR) of the pseudopotential
3940
cal_force 0 #if calculate the force at the end of the electronic iteration
40-
out_freq_ion 0 #the frequency ( >= 0 ) of ionic step to output charge density and wavefunction. 0: output only when ion steps are finished
4141
device cpu #the computing device for ABACUS
4242

4343
#Parameters (2.PW)

source/source_io/test/write_wfc_nao_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ TEST(GenWfcLcaoFnameTest, OutType1GammaOnlyOutAppFlagTrue)
3535
nkstot, out_type, out_app_flag, gamma_only, istep);
3636

3737
// output .txt file when out_type=1
38-
std::string expected_output = "wfs1_nao.txt";
38+
std::string expected_output = "wf_nao.txt";
3939

4040
EXPECT_EQ(result, expected_output);
4141
}
@@ -88,7 +88,7 @@ TEST(GenWfcLcaoFnameTest, OutTypeInvalid)
8888
std::string output = testing::internal::GetCapturedStdout();
8989

9090
// a .txt is chosen if out_type is not 1 or 2
91-
std::string expected_output = "wfs1k3_nao.txt";
91+
std::string expected_output = "wfk3_nao.txt";
9292
EXPECT_EQ(result, expected_output);
9393
}
9494

source/source_io/test_serial/read_input_item_test.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -968,14 +968,6 @@ TEST_F(InputTest, Item_test2)
968968
output = testing::internal::GetCapturedStdout();
969969
EXPECT_THAT(output, testing::HasSubstr("NOTICE"));
970970
}
971-
{ // out_freq_ion
972-
auto it = find_label("out_freq_ion", readinput.input_lists);
973-
param.input.out_freq_ion = 0;
974-
testing::internal::CaptureStdout();
975-
EXPECT_EXIT(it->second.check_value(it->second, param), ::testing::ExitedWithCode(1), "");
976-
output = testing::internal::GetCapturedStdout();
977-
EXPECT_THAT(output, testing::HasSubstr("NOTICE"));
978-
}
979971
{ // dm_to_rho
980972
auto it = find_label("dm_to_rho", readinput.input_lists);
981973
param.input.dm_to_rho = true;

0 commit comments

Comments
 (0)