Skip to content

Commit ffd91ff

Browse files
committed
Fix: nspin2/4 mismatch with nspin1 with PBE
1 parent 9b23e4e commit ffd91ff

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

source/module_hamilt_general/module_xc/xc_funct_corr_gga.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ void XC_Functional::pbec_spin(double rho, double zeta, double grho, const int &i
382382
// real(kind=DP) :: rho, zeta, grho, sc, v1cup, v1cdw, v2c
383383
double ga, be[3];//mohan add
384384
// parameter :
385-
ga = 0.0310910;
385+
ga = 0.0310906908696548950;
386386
be[1] = 0.06672455060314922;//zhengdy add 2019-09-12, ensure same parameter with another dft code.
387387
be[2] = 0.0460000;//mohan add 2012-05-28
388388
double third, pi34, xkf, xks;

source/module_hamilt_general/module_xc/xc_functional_libxc_tools.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ std::vector<double> XC_Functional_Libxc::cal_sgn(
127127
const std::vector<double> &sigma)
128128
{
129129
std::vector<double> sgn(nrxx*nspin, 1.0);
130+
const double grho_threshold2 = grho_threshold*grho_threshold;
130131
// in the case of GGA correlation for polarized case,
131132
// a cutoff for grho is required to ensure that libxc gives reasonable results
132133
if(nspin==2 && func.info->family != XC_FAMILY_LDA && func.info->kind==XC_CORRELATION)
@@ -136,9 +137,9 @@ std::vector<double> XC_Functional_Libxc::cal_sgn(
136137
#endif
137138
for( int ir=0; ir<nrxx; ++ir )
138139
{
139-
if ( rho[ir*2]<rho_threshold || std::sqrt(std::abs(sigma[ir*3]))<grho_threshold )
140+
if ( rho[ir*2]<rho_threshold || std::abs(sigma[ir*3])<grho_threshold2 )
140141
sgn[ir*2] = 0.0;
141-
if ( rho[ir*2+1]<rho_threshold || std::sqrt(std::abs(sigma[ir*3+2]))<grho_threshold )
142+
if ( rho[ir*2+1]<rho_threshold || std::abs(sigma[ir*3+2])<grho_threshold2 )
142143
sgn[ir*2+1] = 0.0;
143144
}
144145
}

0 commit comments

Comments
 (0)