Skip to content

Commit 9b23e4e

Browse files
committed
Fix: stress error with Dojo pseudopotential and LIBXC
1 parent 19a1b13 commit 9b23e4e

File tree

6 files changed

+80
-2
lines changed

6 files changed

+80
-2
lines changed

source/module_hamilt_general/module_xc/xc_functional_libxc_tools.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ std::pair<double,ModuleBase::matrix> XC_Functional_Libxc::convert_vtxc_v(
188188
{
189189
const double v_tmp = ModuleBase::e2 * vrho[ir*nspin+is] * sgn[ir*nspin+is];
190190
v(is,ir) += v_tmp;
191-
vtxc += v_tmp * rho[ir*nspin+is];
191+
vtxc += v_tmp * (rho[ir*nspin+is] - 1.0/nspin*chr->rho_core[ir]);
192192
}
193193
}
194194

@@ -204,7 +204,7 @@ std::pair<double,ModuleBase::matrix> XC_Functional_Libxc::convert_vtxc_v(
204204
{
205205
for( std::size_t ir=0; ir<nrxx; ++ir )
206206
{
207-
rvtxc += dh[is][ir] * rho[ir*nspin+is];
207+
rvtxc += dh[is][ir] * (rho[ir*nspin+is] - 1.0/nspin*chr->rho_core[ir]);
208208
v(is,ir) -= dh[is][ir];
209209
}
210210
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
INPUT_PARAMETERS
2+
#Parameters (1.General)
3+
suffix autotest
4+
calculation scf
5+
6+
symmetry 1
7+
pseudo_dir ../../PP_ORB
8+
9+
#Parameters (2.Iteration)
10+
ecutwfc 20
11+
scf_thr 1e-9
12+
scf_nmax 100
13+
#Parameters (3.Basis)
14+
basis_type pw
15+
ks_solver dav_subspace
16+
pw_diag_ndim 2
17+
18+
#Parameters (4.Smearing)
19+
smearing_method gauss
20+
smearing_sigma 0.002
21+
22+
#Parameters (5.Mixing)
23+
mixing_type broyden
24+
mixing_beta 0.7
25+
26+
dft_functional XC_GGA_X_PBE+XC_GGA_C_PBE
27+
28+
cal_force 1
29+
cal_stress 1
30+
31+
pw_seed 1

tests/integrate/110_PW_DOJO_SY/KPT

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K_POINTS
2+
0
3+
Gamma
4+
2 2 2 0 0 0
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
ATOMIC_SPECIES
2+
Si 14.000 Si_dojo_soc.upf
3+
4+
LATTICE_CONSTANT
5+
1.0
6+
7+
LATTICE_VECTORS
8+
10.20000 10.20000 0.00000
9+
10.20000 0.00000 10.20000
10+
0.00000 10.20000 10.20000
11+
12+
ATOMIC_POSITIONS
13+
Direct
14+
15+
Si
16+
0.0
17+
16
18+
0.0000000 0.0000000 0.0000000 1 1 1
19+
0.1250000 0.1250000 0.1250000 1 1 1
20+
0.0000000 0.0000000 0.5000000 1 1 1
21+
0.1250000 0.1250000 0.6250000 1 1 1
22+
0.0000000 0.5000000 0.0000000 1 1 1
23+
0.1250000 0.6250000 0.1250000 1 1 1
24+
0.0000000 0.5000000 0.5000000 1 1 1
25+
0.1250000 0.6250000 0.6250000 1 1 1
26+
0.5000000 0.0000000 0.0000000 1 1 1
27+
0.6250000 0.1250000 0.1250000 1 1 1
28+
0.5000000 0.0000000 0.5000000 1 1 1
29+
0.6250000 0.1250000 0.6250000 1 1 1
30+
0.5000000 0.5000000 0.0000000 1 1 1
31+
0.6250000 0.6250000 0.1250000 1 1 1
32+
0.5000000 0.5000000 0.5000000 1 1 1
33+
0.6250000 0.6250000 0.6250000 1 1 1
34+

tests/integrate/110_PW_DOJO_SY/jd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Aim to check stress/force/energy correctness with LIBXC and DOJO pseudopotential
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
etotref -1840.2800817366623960
2+
etotperatomref -115.0175051085
3+
totalforceref 0.000450
4+
totalstressref 124.874001
5+
pointgroupref T_d
6+
spacegroupref O_h
7+
nksibzref 3
8+
totaltimeref 3.44

0 commit comments

Comments
 (0)