Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: update assignment logic of ecutwfc and ecutrho #5907

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading