Skip to content

Conversation

@BariumOxide13716
Copy link
Collaborator

Reminder

  • Have you linked an issue with this pull request?
  • Have you added adequate unit tests and/or case tests for your pull request?
  • Have you noticed possible changes of behavior below or in the linked issue?
  • Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)

Linked Issue

Fix #5594

Unit Tests and/or Case Tests for my changes

  • A unit test is added for each new feature or bug fix.

What's changed?

This PR adds a new input keyword to set the thresholds of DFT ingredients.
This is a work in progress as the unit tests are not checked yet. I will finalize this PR after all necessary unit tests are done.

Any changes of core modules? (ignore if not applicable)

  • Example: I have added a new virtual function in the esolver base class in order to ...

Comment on lines 22 to 25
double XC_Functional::dens_threshold = 1.0e-10;
double XC_Functional::zeta_threshold = dens_threshold;
double XC_Functional::grho_threshold = dens_threshold;
double XC_Functional::tau_threshold = dens_threshold;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, I have on major and two minor comments here.
the major one is, your change indicate all these four thresholds are correlated. Is this always true? if not, you can use the "dens_threshold" as default for the latter three.
the other two minor are:

  1. for you abbreviate the "density" as "dens", you can also use "thr" instead of the full name "threshold". The use of "thr" can refer to QE, like conv_thr, force_thr, etc.
  2. you name variables with some inconsistency. You denote the density as "dens" but use physical symbol name like "tau", "zeta", "grho" in the following. For it is under the context of "XC", so it is okay to use "rho" instead, say, "rho_thr", "grho_thr", "zeta_thr" and "tau_thr".

Comment on lines 32 to 34
void XC_Functional::set_xc_ingred_thrs(double _thr_in)
{
hybrid_alpha = alpha_in;
XC_Functional::dens_threshold = _thr_in;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void XC_Functional::set_xc_ingred_thrs(double _thr_in)
{
hybrid_alpha = alpha_in;
XC_Functional::dens_threshold = _thr_in;
void XC_Functional::set_xc_ingred_thrs(const double& thr)
{
XC_Functional::dens_threshold = thr;

this->add_item(item);
}
{
Input_Item item("xc_dens_thr");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool gamma_only = false; ///< for plane wave.
int scf_nmax = 100; ///< number of max elec iter
double scf_thr = -1.0; ///< \sum |rhog_out - rhog_in |^2
double xc_dens_thr = 1.0e-10; ///< threshold for density and other DFT ingredients to toss away in DFT calculation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will xc_rho_thr be better?

@mohanchen mohanchen added the Refactor Refactor ABACUS codes label Dec 2, 2024
@BariumOxide13716 BariumOxide13716 marked this pull request as draft December 4, 2024 08:55
@BariumOxide13716 BariumOxide13716 changed the title Work in Progress: Adding an input keyword to set density thresholds in DFT calculations Adding an input keyword to set density thresholds in DFT calculations Dec 4, 2024
@mohanchen
Copy link
Collaborator

Reopen it if needed

@mohanchen mohanchen closed this Dec 11, 2024
@BariumOxide13716 BariumOxide13716 deleted the prbranch2 branch March 31, 2025 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hard-coded variables in DFT code

3 participants