Skip to content

Commit 9e9c5e8

Browse files
committed
move hybrid_alpha into ccp settings
1 parent 3494a3a commit 9e9c5e8

39 files changed

+199
-230
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,21 +2729,20 @@ Support for hybrid functionals in the *pw [basis_type](#basis_type)* is under ac
27292729
|lrc_wpbe|1|-1|0.3|
27302730
|lrc_wpbeh|1|-0.8|0.2|
27312731
|pbe0|0.25|0|0|
2732-
|hse([exx_use_ewald](#exx_use_ewald)=0)|0.25|0|0.11|
2733-
|hse([exx_use_ewald](#exx_use_ewald)=1)|0.0|0.25|0.11|
2732+
|hse|0.0|0.25|0.11|
27342733
|scan0|0.25|0|0|
27352734
|cam_pbeh|0.2|0.8|0.7|
27362735

27372736
### exx_hybrid_alpha
27382737

27392738
- **Type**: Real
2740-
- **Description**: fraction of Fock exchange in hybrid functionals, so that $E_{X}=\alpha E_{X}+(1-\alpha)E_{X,\text{LDA/GGA}}$
2739+
- **Description**: fraction of Fock exchange in range-separated hybrid funtionals, so that $E_{X} = \alpha E_{X}^\text{HF-LR}+(\alpha+\beta) E_{X}^\text{HF-SR}+(1-\alpha)E_{X}^\text{KS-LR}+[1-(\alpha+\beta)]E_{X}^\text{KS-SR}$.
27412740
- **Default**: see [hybrid_func_params](#hybrid_func_params)
27422741

27432742
### exx_hybrid_beta
27442743

27452744
- **Type**: Real
2746-
- **Description**: another fraction of Fock exchange in range-separated hybrid funtionals, so that $E_{X} = \alpha E_{X}^\text{HF-LR}+(\alpha+\beta) E_{X}^\text{HF-SR}+(1-\alpha)E_{X}^\text{KS-LR}+[1-(\alpha+\beta)]E_{X}^\text{KS-SR}$.
2745+
- **Description**: fraction of Fock exchange in range-separated hybrid funtionals, so that $E_{X} = \alpha E_{X}^\text{HF-LR}+(\alpha+\beta) E_{X}^\text{HF-SR}+(1-\alpha)E_{X}^\text{KS-LR}+[1-(\alpha+\beta)]E_{X}^\text{KS-SR}$.
27472746
- **Default**: see [hybrid_func_params](#hybrid_func_params)
27482747

27492748
### exx_hse_omega

examples/hse/pw_Si2/INPUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pseudo_rcut 10
2626
# out_wfc_pw 1
2727
# out_chg 1
2828

29-
exx_hybrid_alpha 0.25
29+
exx_hybrid_beta 0.25
3030

3131
cal_stress 1
3232
# cal_force 1

source/module_elecstate/elecstate_exx.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ void ElecState::set_exx(const double& Eexx)
1111

1212
if (GlobalC::exx_info.info_global.cal_exx)
1313
{
14-
const double coeff = (GlobalC::exx_info.info_global.ccp_type == Conv_Coulomb_Pot_K::Ccp_Type::Cam
15-
|| GlobalC::exx_info.info_global.ccp_type == Conv_Coulomb_Pot_K::Ccp_Type::Ccp)
16-
? 1.0
17-
: GlobalC::exx_info.info_global.hybrid_alpha;
18-
this->f_en.exx = coeff * Eexx;
14+
this->f_en.exx = Eexx;
1915
}
2016
return;
2117
}

source/module_hamilt_general/module_xc/exx_info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct Exx_Info
1212
bool cal_exx = false;
1313

1414
Conv_Coulomb_Pot_K::Ccp_Type ccp_type;
15-
double hybrid_alpha = 0.25;
15+
double hybrid_alpha = 0.0;
1616
double hybrid_beta = 0.0;
1717
double hse_omega = 0.11;
1818
double mixing_beta_for_loop1 = 1.0;
@@ -46,7 +46,7 @@ struct Exx_Info
4646
bool real_number = false;
4747
int Rcut_type = 1;
4848
Singular_Value::Fq_type fq_type;
49-
const bool& use_ewald;
49+
bool use_ewald - false;
5050

5151
double pca_threshold = 0;
5252
std::vector<std::string> files_abfs;

source/module_hamilt_general/module_xc/test/test_xc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ class XCTest_PBE0 : public XCTest
830830
void SetUp()
831831
{
832832
XC_Functional::set_xc_type("PBE0");
833-
XC_Functional::set_hybrid_alpha(0.5, 0.0);
833+
XC_Functional::set_hybrid_param(0.5, 0.0);
834834
std::vector<double> rho = {0.17E+01, 0.17E+01, 0.15E+01, 0.88E-01, 0.18E+04};
835835
std::vector<double> grho = {0.81E-11, 0.17E+01, 0.36E+02, 0.87E-01, 0.55E+00};
836836

source/module_hamilt_general/module_xc/test/test_xc1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class XCTest_HSE : public XCTest
3838
void SetUp()
3939
{
4040
XC_Functional::set_xc_type("HSE");
41-
XC_Functional::set_hybrid_alpha(0.5, 0.0);
41+
XC_Functional::set_hybrid_param(0.0, 0.5);
4242
}
4343
};
4444

@@ -53,7 +53,7 @@ class XCTest_SCAN0 : public XCTest
5353
void SetUp()
5454
{
5555
XC_Functional::set_xc_type("SCAN0");
56-
XC_Functional::set_hybrid_alpha(0.5, 0.0);
56+
XC_Functional::set_hybrid_param(0.5, 0.0);
5757
}
5858
};
5959

source/module_hamilt_general/module_xc/xc_functional.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ double XC_Functional::hybrid_alpha = 0.25;
1919
double XC_Functional::hybrid_beta = 0.0;
2020
std::map<int, double> XC_Functional::scaling_factor_xc = { {1, 1.0} }; // added by jghan, 2024-10-10
2121

22-
void XC_Functional::set_hybrid_alpha(const double alpha_in, const double beta_in)
22+
void XC_Functional::set_hybrid_param(const double alpha_in, const double beta_in)
2323
{
2424
hybrid_alpha = alpha_in;
2525
hybrid_beta = beta_in;

source/module_hamilt_general/module_xc/xc_functional.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ class XC_Functional
7171
static void set_xc_type(const std::string xc_func_in);
7272

7373
// For hybrid functional
74-
static void set_hybrid_alpha(const double alpha_in, const double beta_in);
74+
static void set_hybrid_param(const double alpha_in, const double beta_in);
7575
static double get_hybrid_alpha()
7676
{
7777
return hybrid_alpha;
78+
};
79+
static double get_hybrid_beta()
80+
{
81+
return hybrid_beta;
7882
};
7983
static bool get_ked_flag()
8084
{

source/module_hamilt_general/module_xc/xc_functional_libxc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ std::vector<xc_func_type> XC_Functional_Libxc::init_func(const std::vector<int>
144144
else if( id == XC_HYB_GGA_XC_HSE06 ) // HSE06 hybrid functional
145145
{
146146
add_func( XC_HYB_GGA_XC_HSE06 );
147-
double parameter_hse[3] = { std::stod(PARAM.inp.exx_hybrid_alpha),
147+
double parameter_hse[3] = { std::stod(PARAM.inp.exx_hybrid_beta),
148148
std::stod(PARAM.inp.exx_hse_omega),
149149
std::stod(PARAM.inp.exx_hse_omega)};
150150
xc_func_set_ext_params(&funcs.back(), parameter_hse);

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -373,34 +373,30 @@ void Force_Stress_LCAO<T>::getForceStress(UnitCell& ucell,
373373
ModuleBase::matrix stress_exx;
374374
if (GlobalC::exx_info.info_global.cal_exx)
375375
{
376-
const double coeff = (GlobalC::exx_info.info_global.ccp_type == Conv_Coulomb_Pot_K::Ccp_Type::Cam
377-
|| GlobalC::exx_info.info_global.ccp_type == Conv_Coulomb_Pot_K::Ccp_Type::Ccp)
378-
? 1.0
379-
: GlobalC::exx_info.info_global.hybrid_alpha;
380376
if (isforce)
381377
{
382378
if (GlobalC::exx_info.info_ri.real_number)
383379
{
384380
exd.cal_exx_force(ucell.nat);
385-
force_exx = coeff * exd.get_force();
381+
force_exx = exd.get_force();
386382
}
387383
else
388384
{
389385
exc.cal_exx_force(ucell.nat);
390-
force_exx = coeff * exc.get_force();
386+
force_exx = exc.get_force();
391387
}
392388
}
393389
if (isstress)
394390
{
395391
if (GlobalC::exx_info.info_ri.real_number)
396392
{
397393
exd.cal_exx_stress(ucell.omega, ucell.lat0);
398-
stress_exx = coeff * exd.get_stress();
394+
stress_exx = exd.get_stress();
399395
}
400396
else
401397
{
402398
exc.cal_exx_stress(ucell.omega, ucell.lat0);
403-
stress_exx = coeff * exc.get_stress();
399+
stress_exx = exc.get_stress();
404400
}
405401
}
406402
}

0 commit comments

Comments
 (0)