Skip to content

An user-friendly way to support "flexible default value" is needed for some parameters #2508

Description

@maki49

Background

Currently, ABACUS set the default value of a parameter twice:

    this->Default();    // before reading all parameters, set a fixed default value
    bool success = this->Read(fn);
    this->Default_2();    // after reading all parameters, force changing the value

Such logic cannot support a "flexible default value" like this:

  • Usually, the default value of symmetry is 1.
  • If calculation=nscf/istate/ienvelope, the default value of symmetry should be 0.
  • However, if it is set by user to 1, the final value should be 1.

That is, if read in, set by user; if not read in, set the default value depending on some other parameters.

Current Solution

Set a string-type variable to "default", if(=="default”)modify it in Default_2(), then use stod, stoi... to convert it later.

Future Solution

There may be a common and user-friendly (int-is-int, double-is-double) solution rather than using string with stoi/stod.
Since most of such parameters are exx-related, I will discuss it with @PeizeLin ;-)

Metadata

Metadata

Assignees

Labels

Feature DiscussedThe features will be discussed first but will not be implemented soon

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions