Skip to content

Commit 5b37f29

Browse files
authored
Refactor: remove the INPUTw input script and transfer parameters to INPUT (SIAB refactor 1/3) (#6475)
* Refactor: remove the INPUTw input script and transfer parameters to INPUT * update docs and remove the parameter wannier_card * update makefiles * totally remove the wannier_card
1 parent 79ccdb4 commit 5b37f29

File tree

24 files changed

+36
-1072
lines changed

24 files changed

+36
-1072
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
- [orbital\_dir](#orbital_dir)
3131
- [read\_file\_dir](#read_file_dir)
3232
- [restart\_load](#restart_load)
33-
- [wannier\_card](#wannier_card)
33+
- [spillage\_outdir](#spillage_outdir)
3434
- [Plane Wave](#plane-wave-related-variables)
3535
- [ecutwfc](#ecutwfc)
3636
- [ecutrho](#ecutrho)
@@ -172,6 +172,7 @@
172172
- [out\_wfc_re_im](#out_wfc_re_im)
173173
- [if\_separate\_k](#if_separate_k)
174174
- [out\_elf](#out_elf)
175+
- [out\_spillage](#out_spillage)
175176
- [Density of States](#density-of-states)
176177
- [dos\_edelta\_ev](#dos_edelta_ev)
177178
- [dos\_sigma](#dos_sigma)
@@ -773,12 +774,12 @@ These variables are used to control parameters related to input files.
773774
If EXX(exact exchange) is calculated (i.e. *[dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0* or *[rpa](#rpa)==True*), the Hexx(R) files in the same folder for each processor will also be read.
774775
- **Default**: False
775776

776-
### wannier_card
777+
### spillage_outdir
777778

778779
- **Type**: String
779-
- **Availability**: Using ABACUS with Wannier90.
780-
- **Description**: The name of the input file related to Wannier90.
781-
- **Default**: "none"
780+
- **Availability**: Used only for plane wave basis set.
781+
- **Description**: The directory to save the spillage files.
782+
- **Default**: "./"
782783

783784
[back to top](#full-list-of-input-keywords)
784785

@@ -2026,6 +2027,13 @@ These variables are used to control the output of properties.
20262027
In molecular dynamics calculations, the output frequency is controlled by [out_interval](#out_interval).
20272028
- **Default**: 0 3
20282029

2030+
### out_spillage
2031+
2032+
- **Type**: Integer
2033+
- **Availability**: Only for Kohn-Sham DFT with plane-wave basis.
2034+
- **Description**: This output is only intentively needed by the ABACUS numerical atomic orbital generation workflow. This parameter is used to control whether to output the overlap integrals between truncated spherical Bessel functions (TSBFs) and plane-wave basis expanded wavefunctions (named as `OVERLAP_Q`), and between TSBFs (named as `OVERLAP_Sq`), also their first order derivatives. The output files are named starting with `orb_matrix`. A value of `2` would enable the output.
2035+
- **Default**: 0
2036+
20292037
[back to top](#full-list-of-input-keywords)
20302038

20312039
## Density of states

source/Makefile.Objects

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ OBJS_IO=input_conv.o\
563563
unk_overlap_pw.o\
564564
write_pao.o\
565565
write_wfc_pw.o\
566-
winput.o\
567566
write_cube.o\
568567
write_elecstat_pot.o\
569568
write_elf.o\

source/source_esolver/esolver_ks_lcaopw.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "source_io/numerical_basis.h"
3030
#include "source_io/numerical_descriptor.h"
3131
#include "source_io/to_wannier90_pw.h"
32-
#include "source_io/winput.h"
3332
#include "source_io/write_elecstat_pot.h"
3433
#include "source_io/module_parameter/parameter.h"
3534

source/source_esolver/esolver_ks_pw.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "source_io/numerical_basis.h"
2323
#include "source_io/numerical_descriptor.h"
2424
#include "source_io/to_wannier90_pw.h"
25-
#include "source_io/winput.h"
2625
#include "source_io/write_dos_pw.h"
2726
#include "source_io/write_wfc_pw.h"
2827
#include "source_lcao/module_deltaspin/spin_constrain.h"
@@ -931,10 +930,10 @@ void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell)
931930
//! 4) Calculate the spillage value,
932931
//! which are used to generate numerical atomic orbitals
933932
//----------------------------------------------------------
934-
if (PARAM.inp.basis_type == "pw" && winput::out_spillage)
933+
if (PARAM.inp.basis_type == "pw" && PARAM.inp.out_spillage)
935934
{
936935
// ! Print out overlap matrices
937-
if (winput::out_spillage <= 2)
936+
if (PARAM.inp.out_spillage <= 2)
938937
{
939938
for (int i = 0; i < PARAM.inp.bessel_nao_rcuts.size(); i++)
940939
{

source/source_esolver/pw_others.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "source_io/numerical_basis.h"
3232
#include "source_io/numerical_descriptor.h"
3333
#include "source_io/to_wannier90_pw.h"
34-
#include "source_io/winput.h"
3534
#include "source_io/write_elecstat_pot.h"
3635
#include "source_io/module_parameter/parameter.h"
3736

source/source_io/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ list(APPEND objects_advanced
4646
to_wannier90_lcao_in_pw.cpp
4747
to_wannier90_lcao.cpp
4848
fR_overlap.cpp
49-
winput.cpp
5049
)
5150

5251
if(ENABLE_LCAO)

source/source_io/module_parameter/input_parameter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct Input_para
5959
std::string orbital_dir = ""; ///< directory of orbital file
6060
std::string read_file_dir = "auto"; ///< directory of files for reading
6161
bool restart_load = false;
62-
std::string wannier_card = "none"; ///< input card for wannier functions.
6362
int mem_saver = 0; ///< 1: save psi when nscf calculation.
6463
int diago_proc = 0; ///< the number of procs used to diag. mohan add 2012-01-13
6564
int nbspline = -1; ///< the order of B-spline basis(>=0) if it is -1 (default)
@@ -408,6 +407,8 @@ struct Input_para
408407
bool if_separate_k = false; ///< whether to write partial charge for all k-points to individual files or merge them
409408
std::vector<int> out_elf = {0, 3}; ///< output the electron localization function (ELF). 0: no; 1: yes
410409
std::vector<int> cal_symm_repr = {0, 3}; ///< output the symmetry representation matrix
410+
int out_spillage = 0; ///< output the spillage of the wave function
411+
std::string spillage_outdir = "./"; ///< output directory for spillage
411412

412413
// ============== #Parameters (12.Postprocess) ===========================
413414
double dos_emin_ev = -15.0;

source/source_io/numerical_basis.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "source_cell/module_symmetry/symmetry.h"
1212
#include "source_pw/module_pwdft/global.h"
1313
#include "source_io/numerical_basis_jyjy.h"
14-
#include "winput.h"
1514

1615
#include <algorithm>
1716
#include <cstring>
@@ -82,13 +81,12 @@ void Numerical_Basis::output_overlap(const psi::Psi<std::complex<double>>& psi,
8281
this->mu_index = this->init_mu_index(ucell);
8382
this->init_label = true;
8483
}
85-
ModuleBase::GlobalFunc::MAKE_DIR(winput::spillage_outdir);
84+
ModuleBase::GlobalFunc::MAKE_DIR(PARAM.inp.spillage_outdir);
8685
for (int derivative_order = 0; derivative_order <= 1; ++derivative_order) // Peize Lin add 2020.04.23
8786
{
8887
std::ofstream ofs;
8988
std::stringstream ss;
90-
// the parameter 'winput::spillage_outdir' is read from INPUTw.
91-
ss << winput::spillage_outdir << "/";
89+
ss << PARAM.inp.spillage_outdir << "/";
9290

9391
if (PARAM.inp.bessel_nao_rcuts.size() > 1)
9492
{
@@ -134,7 +132,7 @@ void Numerical_Basis::output_overlap(const psi::Psi<std::complex<double>>& psi,
134132
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "cal_overlap_Q");
135133

136134
// (2) generate Sq matrix if necessary.
137-
if (winput::out_spillage == 2)
135+
if (PARAM.inp.out_spillage == 2)
138136
{
139137
#ifndef __LCAO
140138
// compute <jY|jY> in plane-wave basis
@@ -197,7 +195,7 @@ void Numerical_Basis::output_overlap(const psi::Psi<std::complex<double>>& psi,
197195
ModuleBase::WARNING_QUIT("Numerical_Basis", "Failed to write overlap Q to file.");
198196
}
199197
// because one stage of file io complete, re-check the file status.
200-
if (winput::out_spillage == 2)
198+
if (PARAM.inp.out_spillage == 2)
201199
{
202200
// caution: this is the largest matrix to be output, always flush
203201
if (ofs.good()) {

source/source_io/numerical_descriptor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "source_pw/module_pwdft/global.h"
33
#include "source_io/module_parameter/parameter.h"
44
#include "source_cell/module_symmetry/symmetry.h"
5-
#include "winput.h"
65
#include "source_base/math_ylmreal.h"
76
#include "source_base/parallel_reduce.h"
87
#include "source_base/timer.h"
@@ -75,8 +74,7 @@ void Numerical_Descriptor::output_descriptor(const UnitCell& ucell, const psi::P
7574
//-----------------------------------
7675
std::ofstream ofs;
7776
std::stringstream ss;
78-
// the parameter 'winput::spillage_outdir' is read from INPUTw.
79-
ss << winput::spillage_outdir << "/" << "descriptor.dat";
77+
ss << PARAM.inp.spillage_outdir << "/" << "descriptor.dat";
8078
if (GlobalV::MY_RANK==0)
8179
{
8280
ofs.open(ss.str().c_str());

source/source_io/read_input_item_output.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,5 +572,19 @@ void ReadInput::item_output()
572572
sync_intvec(input.cal_symm_repr, 2, 0);
573573
this->add_item(item);
574574
}
575+
{
576+
// refactored from the removal of wannier input file, ISSUE 6469
577+
Input_Item item("out_spillage");
578+
item.annotation = "output spillage of wavefunctions. This parameter only accepts 0 or 2.";
579+
read_sync_int(input.out_spillage);
580+
this->add_item(item);
581+
}
582+
{
583+
// refactored from the removal of wannier input file, ISSUE 6469
584+
Input_Item item("spillage_outdir");
585+
item.annotation = "output directory for spillage of wavefunctions.";
586+
read_sync_string(input.spillage_outdir);
587+
this->add_item(item);
588+
}
575589
}
576590
} // namespace ModuleIO

0 commit comments

Comments
 (0)