Skip to content

Commit 4234b0f

Browse files
wip: fixing threshold inconsistencies in module_xc
1 parent 8b048f4 commit 4234b0f

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

source/module_hamilt_general/module_xc/xc_functional.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,37 @@ std::vector<int> XC_Functional::func_id(1);
1818
int XC_Functional::func_type = 0;
1919
bool XC_Functional::use_libxc = true;
2020
double XC_Functional::hybrid_alpha = 0.25;
21+
double static XC_Functional::default_dft_threshold=1.0e-10;
22+
23+
void XC_Functional::set_dft_ingred_thrs(const double d_thr=default_dft_threshold,
24+
const double z_thr=default_dft_threshold,
25+
const double g_thr=default_dft_threshold,
26+
const double t_thr=default_dft_threshold)
27+
{ dens_threshold = d_thr;
28+
zeta_threshold = z_thr;
29+
grho_threshold = g_thr;
30+
tau_threshold = t_thr;
31+
}
32+
33+
double XC_Functional::get_dens_threshold()
34+
{
35+
return dens_threshold;
36+
}
37+
38+
double XC_Functional::get_grho_threshold()
39+
{
40+
return grho_threshold;
41+
}
42+
43+
double XC_Functional::get_zeta_threshold()
44+
{
45+
return zeta_threshold;
46+
}
47+
48+
double XC_Functional::get_tau_threshold()
49+
{
50+
return tau_threshold;
51+
}
2152

2253
void XC_Functional::set_hybrid_alpha(const double alpha_in)
2354
{
@@ -29,6 +60,11 @@ double XC_Functional::get_hybrid_alpha()
2960
return hybrid_alpha;
3061
}
3162

63+
void XC_Functional::set_hybrid_alpha(const double alpha_in)
64+
{
65+
hybrid_alpha = alpha_in;
66+
}
67+
3268
int XC_Functional::get_func_type()
3369
{
3470
return func_type;
@@ -39,6 +75,7 @@ void XC_Functional::set_xc_first_loop(const UnitCell& ucell)
3975
the first scf iteration only calculate the functional without exact
4076
exchange. but in "nscf" calculation, there is no need of "two-level"
4177
method. */
78+
XC_Functional::set_dft_ingred_thrs();
4279
if (ucell.atoms[0].ncpp.xc_func == "HF"
4380
|| ucell.atoms[0].ncpp.xc_func == "PBE0"
4481
|| ucell.atoms[0].ncpp.xc_func == "HSE") {

source/module_hamilt_general/module_xc/xc_functional.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ class XC_Functional
7979

8080
//exx_hybrid_alpha for mixing exx in hybrid functional:
8181
static double hybrid_alpha;
82+
static double dens_threshold, zeta_threshold, grho_threshold, tau_threshold;
83+
static double default_dft_threshold;
8284

8385
public:
8486
static std::vector<int> get_func_id() { return func_id; }

0 commit comments

Comments
 (0)