-
Notifications
You must be signed in to change notification settings - Fork 145
Adding an input keyword to set density thresholds in DFT calculations #5659
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
Changes from 3 commits
4234b0f
408e349
1b0f451
de06cf4
1e29a36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,21 +14,59 @@ XC_Functional::XC_Functional(){} | |||||||||||||||
|
|
||||||||||||||||
| XC_Functional::~XC_Functional(){} | ||||||||||||||||
|
|
||||||||||||||||
| //double XC_Functional::dens_threshold; | ||||||||||||||||
| //double XC_Functional::zeta_threshold; | ||||||||||||||||
| //double XC_Functional::grho_threshold; | ||||||||||||||||
| //double XC_Functional::tau_threshold; | ||||||||||||||||
|
|
||||||||||||||||
| 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; | ||||||||||||||||
|
|
||||||||||||||||
| std::vector<int> XC_Functional::func_id(1); | ||||||||||||||||
| int XC_Functional::func_type = 0; | ||||||||||||||||
| bool XC_Functional::use_libxc = true; | ||||||||||||||||
| double XC_Functional::hybrid_alpha = 0.25; | ||||||||||||||||
|
|
||||||||||||||||
| void XC_Functional::set_hybrid_alpha(const double alpha_in) | ||||||||||||||||
| 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(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; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,4 +121,4 @@ void XC_Functional::xc_spin(const double &rho, const double &zeta, | |
| vxcdw += vdw; | ||
| } | ||
| return; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -541,6 +541,19 @@ void ReadInput::item_elec_stru() | |
| }; | ||
| this->add_item(item); | ||
| } | ||
| { | ||
| Input_Item item("xc_dens_thr"); | ||
|
||
| item.annotation = "threshold for density and other dft functional ingredients"; | ||
| read_sync_double(input.xc_dens_thr); | ||
| item.check_value = [] (const Input_Item& item, const Parameter& para){ | ||
| if (para.input.xc_dens_thr <= 0.0) | ||
| { | ||
| ModuleBase::WARNING_QUIT("ReadInput", "xc_dens_thr should be positive"); | ||
| } | ||
| std::cout<< "resetting xc_dens_thr " << para.input.xc_dens_thr<< std::endl; | ||
| }; | ||
| this->add_item(item); | ||
| } | ||
| { | ||
| Input_Item item("scf_ene_thr"); | ||
| item.annotation = "total energy error threshold"; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,7 @@ struct Input_para | |
| 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. | ||
|
||
| double scf_ene_thr = -1.0; ///< energy threshold for scf convergence, in eV | ||
| int scf_thr_type = -1; ///< type of the criterion of scf_thr, 1: reci drho, 2: real drho | ||
| bool final_scf = false; ///< whether to do final scf | ||
|
|
||
There was a problem hiding this comment.
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: