Skip to content

Commit 78700d3

Browse files
author
abacus_fixer
committed
update add a function to get hse_omega
2 parents 230f0b6 + 5dc1f12 commit 78700d3

11 files changed

Lines changed: 30 additions & 37 deletions

File tree

source/source_estate/module_pot/pot_xc.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
#include "source_hamilt/module_xc/libxc_abacus.h"
99
#endif
1010

11-
#ifdef __EXX
12-
#include "source_hamilt/module_xc/exx_info.h"
13-
#endif
14-
1511
namespace elecstate
1612
{
1713

@@ -30,7 +26,7 @@ void PotXC::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Module
3026
#ifdef USE_LIBXC
3127
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
3228
#ifdef __EXX
33-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
29+
const double hse_omega = XC_Functional::get_hse_omega();
3430
#else
3531
const double hse_omega = 0.0;
3632
#endif
@@ -49,7 +45,7 @@ void PotXC::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Module
4945
{
5046
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
5147
#ifdef __EXX
52-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
48+
const double hse_omega = XC_Functional::get_hse_omega();
5349
#else
5450
const double hse_omega = 0.0;
5551
#endif

source/source_estate/module_pot/pot_xc_fdm.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
#include "source_hamilt/module_xc/xc_functional.h"
88
#include "source_io/module_parameter/parameter.h"
99

10-
#ifdef __EXX
11-
#include "source_hamilt/module_xc/exx_info.h"
12-
#endif
13-
1410
namespace elecstate
1511
{
1612

@@ -26,7 +22,7 @@ PotXC_FDM::PotXC_FDM(
2622

2723
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
2824
#ifdef __EXX
29-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
25+
const double hse_omega = XC_Functional::get_hse_omega();
3026
#else
3127
const double hse_omega = 0.0;
3228
#endif
@@ -64,7 +60,7 @@ void PotXC_FDM::cal_v_eff(
6460

6561
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
6662
#ifdef __EXX
67-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
63+
const double hse_omega = XC_Functional::get_hse_omega();
6864
#else
6965
const double hse_omega = 0.0;
7066
#endif

source/source_hamilt/module_xc/test/test_xc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ class XCTest_PBE_LibXC : public XCTest
882882
std::vector<double> grho = {0.81E-11, 0.17E+01, 0.36E+02, 0.87E-01, 0.55E+00};
883883

884884
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
885-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
885+
const double hse_omega = XC_Functional::get_hse_omega();
886886
for(int i=0;i<5;i++)
887887
{
888888
double e,v,v1,v2;

source/source_hamilt/module_xc/test/test_xc2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ class XCTest_PZ_SPN_LibXC : public XCTest
495495
std::vector<double> zeta = {0.0, 0.0, 0.2, 0.5, 0.8, 1.0};
496496

497497
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
498-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
498+
const double hse_omega = XC_Functional::get_hse_omega();
499499
for(int i=0;i<5;i++)
500500
{
501501
double e,v1,v2;

source/source_hamilt/module_xc/test/test_xc5.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "../libxc_abacus.h"
33
#include "gtest/gtest.h"
44
#include "xctest.h"
5-
#include "../exx_info.h"
65
#include "xc3_mock.h"
76
#include "source_base/matrix.h"
87
#include "../../../source_base/parallel_reduce.h"
@@ -79,7 +78,7 @@ class XCTest_VXC : public XCTest
7978
XC_Functional::set_xc_type("PBE");
8079

8180
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
82-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
81+
const double hse_omega = XC_Functional::get_hse_omega();
8382
std::tuple<double, double, ModuleBase::matrix> etxc_vtxc_v
8483
= XC_Functional::v_xc(rhopw.nrxx,&chr,&ucell,nspin1,domag,domag_z, hybrid_alpha, hse_omega);
8584
et1 = std::get<0>(etxc_vtxc_v);
@@ -183,7 +182,7 @@ class XCTest_VXC_Libxc : public XCTest
183182
XC_Functional::set_xc_type("GGA_X_PBE+GGA_C_PBE");
184183

185184
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
186-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
185+
const double hse_omega = XC_Functional::get_hse_omega();
187186
std::tuple<double, double, ModuleBase::matrix> etxc_vtxc_v
188187
= XC_Functional::v_xc(rhopw.nrxx,&chr,&ucell,nspin1,domag,domag_z, hybrid_alpha, hse_omega);
189188
et1 = std::get<0>(etxc_vtxc_v);
@@ -295,7 +294,7 @@ class XCTest_VXC_meta : public XCTest
295294
XC_Functional::set_xc_type("SCAN");
296295

297296
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
298-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
297+
const double hse_omega = XC_Functional::get_hse_omega();
299298
std::tuple<double, double, ModuleBase::matrix, ModuleBase::matrix> etxc_vtxc_v
300299
= XC_Functional_Libxc::v_xc_meta(XC_Functional::get_func_id(), rhopw.nrxx,ucell.omega,ucell.tpiba,&chr,nspin1, hybrid_alpha, hse_omega);
301300
et1 = std::get<0>(etxc_vtxc_v);

source/source_hamilt/module_xc/xc_functional.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ int XC_Functional::func_type = 0;
1616
bool XC_Functional::ked_flag = false;
1717
bool XC_Functional::use_libxc = true;
1818
double XC_Functional::hybrid_alpha = 0.25;
19+
double XC_Functional::hse_omega = 0.0;
1920
std::map<int, double> XC_Functional::scaling_factor_xc = { {1, 1.0} }; // added by jghan, 2024-10-10
2021

2122
void XC_Functional::set_hybrid_alpha(const double alpha_in)
2223
{
2324
hybrid_alpha = alpha_in;
2425
}
2526

27+
void XC_Functional::set_hse_omega(const double omega_in)
28+
{
29+
hse_omega = omega_in;
30+
}
31+
2632
void XC_Functional::set_xc_first_loop(const UnitCell& ucell)
2733
{
2834
ModuleBase::TITLE("XC_Functional", "set_xc_first_loop");

source/source_hamilt/module_xc/xc_functional.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ class XC_Functional
8282
return hybrid_alpha;
8383
};
8484

85+
static void set_hse_omega(const double omega_in);
86+
87+
static double get_hse_omega()
88+
{
89+
return hse_omega;
90+
};
91+
8592
static bool get_ked_flag()
8693
{
8794
return ked_flag;
@@ -102,6 +109,9 @@ class XC_Functional
102109
// exx_hybrid_alpha for mixing exx in hybrid functional:
103110
static double hybrid_alpha;
104111

112+
// hse_omega for HSE functional:
113+
static double hse_omega;
114+
105115
// added by jghan, 2024-07-07
106116
// as a scaling factor for different xc-functionals
107117
static std::map<int, double> scaling_factor_xc;

source/source_io/module_parameter/input_conv.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ void Input_Conv::Convert()
480480
XC_Functional::set_hybrid_alpha(GlobalC::exx_info.info_global.hybrid_alpha);
481481
if(!PARAM.inp.exx_erfc_omega.empty())
482482
{ GlobalC::exx_info.info_global.hse_omega = std::stod(PARAM.inp.exx_erfc_omega[0]); }
483+
XC_Functional::set_hse_omega(GlobalC::exx_info.info_global.hse_omega);
483484
if(!PARAM.inp.exx_fock_lambda.empty())
484485
{ GlobalC::exx_info.info_lip.lambda = std::stod(PARAM.inp.exx_fock_lambda[0]); }
485486
GlobalC::exx_info.info_global.separate_loop = PARAM.inp.exx_separate_loop;

source/source_pw/module_pwdft/forces_cc.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
#include "source_hamilt/module_xc/libxc_abacus.h"
2828
#endif
2929

30-
#ifdef __EXX
31-
#include "source_hamilt/module_xc/exx_info.h"
32-
#endif
33-
3430

3531
template <typename FPTYPE, typename Device>
3632
void Forces<FPTYPE, Device>::cal_force_cc(ModuleBase::matrix& forcecc,
@@ -62,7 +58,7 @@ void Forces<FPTYPE, Device>::cal_force_cc(ModuleBase::matrix& forcecc,
6258

6359
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
6460
#ifdef __EXX
65-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
61+
const double hse_omega = XC_Functional::get_hse_omega();
6662
#else
6763
const double hse_omega = 0.0;
6864
#endif

source/source_pw/module_pwdft/stress_cc.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
#include "source_hamilt/module_xc/libxc_abacus.h"
1111
#endif
1212

13-
#ifdef __EXX
14-
#include "source_hamilt/module_xc/exx_info.h"
15-
#endif
16-
1713

1814
//NLCC term, need to be tested
1915
template <typename FPTYPE, typename Device>
@@ -57,7 +53,7 @@ void Stress_Func<FPTYPE, Device>::stress_cc(ModuleBase::matrix& sigma,
5753
ModuleBase::matrix vxc;
5854
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
5955
#ifdef __EXX
60-
const double hse_omega = GlobalC::exx_info.info_global.hse_omega;
56+
const double hse_omega = XC_Functional::get_hse_omega();
6157
#else
6258
const double hse_omega = 0.0;
6359
#endif

0 commit comments

Comments
 (0)