Skip to content

Commit

Permalink
Feature: change the default value of ecutwfc based on basis_type (#…
Browse files Browse the repository at this point in the history
…5390)

* revalue ecutwfc by basis_type and add a check

* add some comments

* update the docs
  • Loading branch information
WHUweiqingzhou authored Nov 2, 2024
1 parent 0f44046 commit 18df359
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ These variables are used to control the plane wave related parameters.

- **Type**: Real
- **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.
- **Default**: 50
- **Default**: 50 Ry (PW basis), 100 Ry (LCAO basis)

### ecutrho

Expand Down
18 changes: 18 additions & 0 deletions source/module_io/read_input_item_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,24 @@ void ReadInput::item_system()
Input_Item item("ecutwfc");
item.annotation = "energy cutoff for wave functions";
read_sync_double(input.ecutwfc);
item.reset_value = [](const Input_Item& item, Parameter& para) {
if (para.input.ecutwfc == 0){ // 0 means no input value
if (para.input.basis_type == "lcao")
{
para.input.ecutwfc = 100;
}
else
{
para.input.ecutwfc = 50;
}
}
};
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.ecutwfc <= 0)
{
ModuleBase::WARNING_QUIT("ReadInput", "ecutwfc should be positive");
}
};
this->add_item(item);
}
{
Expand Down
2 changes: 1 addition & 1 deletion source/module_parameter/input_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct Input_para
int kpar = 1; ///< ecch pool is for one k point
int bndpar = 1; ///< parallel for stochastic/deterministic bands
std::string latname = "none"; ///< lattice name
double ecutwfc = 50; ///< energy cutoff for wavefunctions
double ecutwfc = 0; ///< energy cutoff for wavefunctions
double ecutrho = 0; ///< energy cutoff for charge/potential

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

0 comments on commit 18df359

Please sign in to comment.