Skip to content

Commit 18df359

Browse files
Feature: change the default value of ecutwfc based on basis_type (#5390)
* revalue ecutwfc by basis_type and add a check * add some comments * update the docs
1 parent 0f44046 commit 18df359

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ These variables are used to control the plane wave related parameters.
728728

729729
- **Type**: Real
730730
- **Description**: Energy cutoff for plane wave functions, the unit is **Rydberg**. Note that even for localized orbitals basis, you still need to setup an energy cutoff for this system. Because our local pseudopotential parts and the related force are calculated from plane wave basis set, etc. Also, because our orbitals are generated by matching localized orbitals to a chosen set of wave functions from a certain energy cutoff, this set of localize orbitals is most accurate under this same plane wave energy cutoff.
731-
- **Default**: 50
731+
- **Default**: 50 Ry (PW basis), 100 Ry (LCAO basis)
732732

733733
### ecutrho
734734

source/module_io/read_input_item_system.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,24 @@ void ReadInput::item_system()
262262
Input_Item item("ecutwfc");
263263
item.annotation = "energy cutoff for wave functions";
264264
read_sync_double(input.ecutwfc);
265+
item.reset_value = [](const Input_Item& item, Parameter& para) {
266+
if (para.input.ecutwfc == 0){ // 0 means no input value
267+
if (para.input.basis_type == "lcao")
268+
{
269+
para.input.ecutwfc = 100;
270+
}
271+
else
272+
{
273+
para.input.ecutwfc = 50;
274+
}
275+
}
276+
};
277+
item.check_value = [](const Input_Item& item, const Parameter& para) {
278+
if (para.input.ecutwfc <= 0)
279+
{
280+
ModuleBase::WARNING_QUIT("ReadInput", "ecutwfc should be positive");
281+
}
282+
};
265283
this->add_item(item);
266284
}
267285
{

source/module_parameter/input_parameter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct Input_para
3333
int kpar = 1; ///< ecch pool is for one k point
3434
int bndpar = 1; ///< parallel for stochastic/deterministic bands
3535
std::string latname = "none"; ///< lattice name
36-
double ecutwfc = 50; ///< energy cutoff for wavefunctions
36+
double ecutwfc = 0; ///< energy cutoff for wavefunctions
3737
double ecutrho = 0; ///< energy cutoff for charge/potential
3838

3939
int nx = 0, ny = 0, nz = 0; ///< three dimension of FFT wavefunc

0 commit comments

Comments
 (0)