Skip to content

Commit

Permalink
Refactor: update assignment logic of ecutwfc and ecutrho (#5907)
Browse files Browse the repository at this point in the history
  • Loading branch information
YuLiu98 authored Feb 18, 2025
1 parent e2e3d75 commit 07f9ac4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,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.
> `ecutwfc` and `ecutrho` can be set simultaneously. Besides, if only one parameter is set, abacus will automatically set another parameter based on the 4-time relationship. If both parameters are not set, the default values will be employed.
- **Default**: 50 Ry (PW basis), 100 Ry (LCAO basis)

### ecutrho
Expand Down
13 changes: 11 additions & 2 deletions source/module_io/read_input_item_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,13 @@ void ReadInput::item_system()
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")
if (para.input.ecutwfc == 0)
{ // 0 means no input value
if (para.input.ecutrho > 0)
{
para.input.ecutwfc = para.input.ecutrho / 4.0;
}
else if (para.input.basis_type == "lcao")
{
para.input.ecutwfc = 100;
}
Expand Down Expand Up @@ -324,6 +329,10 @@ void ReadInput::item_system()
{
ModuleBase::WARNING_QUIT("ReadInput", "ecutrho/ecutwfc must >= 4");
}
if (para.sys.double_grid == true && para.input.basis_type == "lcao")
{
ModuleBase::WARNING_QUIT("ReadInput", "ecutrho/ecutwfc must = 4 for lcao calculation");
}
};
this->add_item(item);
}
Expand Down

0 comments on commit 07f9ac4

Please sign in to comment.