Skip to content

Commit 07f9ac4

Browse files
authored
Refactor: update assignment logic of ecutwfc and ecutrho (#5907)
1 parent e2e3d75 commit 07f9ac4

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ These variables are used to control the plane wave related parameters.
771771

772772
- **Type**: Real
773773
- **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.
774+
> `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.
774775
- **Default**: 50 Ry (PW basis), 100 Ry (LCAO basis)
775776

776777
### ecutrho

source/module_io/read_input_item_system.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,13 @@ void ReadInput::item_system()
285285
item.annotation = "energy cutoff for wave functions";
286286
read_sync_double(input.ecutwfc);
287287
item.reset_value = [](const Input_Item& item, Parameter& para) {
288-
if (para.input.ecutwfc == 0){ // 0 means no input value
289-
if (para.input.basis_type == "lcao")
288+
if (para.input.ecutwfc == 0)
289+
{ // 0 means no input value
290+
if (para.input.ecutrho > 0)
291+
{
292+
para.input.ecutwfc = para.input.ecutrho / 4.0;
293+
}
294+
else if (para.input.basis_type == "lcao")
290295
{
291296
para.input.ecutwfc = 100;
292297
}
@@ -324,6 +329,10 @@ void ReadInput::item_system()
324329
{
325330
ModuleBase::WARNING_QUIT("ReadInput", "ecutrho/ecutwfc must >= 4");
326331
}
332+
if (para.sys.double_grid == true && para.input.basis_type == "lcao")
333+
{
334+
ModuleBase::WARNING_QUIT("ReadInput", "ecutrho/ecutwfc must = 4 for lcao calculation");
335+
}
327336
};
328337
this->add_item(item);
329338
}

0 commit comments

Comments
 (0)