Skip to content

Commit af4bcad

Browse files
committed
fix: turn on kpar in tests; add guard for EXX+kpar
1 parent ae96015 commit af4bcad

5 files changed

Lines changed: 14 additions & 1 deletion

File tree

source/source_io/module_parameter/input_conv.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,14 @@ void Input_Conv::Convert()
256256
ModuleBase::WARNING_QUIT("Input_Conv", "EXX stress is not supported for basis_type = lcao_in_pw");
257257
}
258258

259+
if (cal_exx && inp.basis_type == "lcao" && inp.kpar != 1)
260+
{
261+
// module_ri's real-space D(R)/Ds construction (RI_2D_Comm::split_m2D_ktoR_k) only
262+
// sums each pool's local k-points, with no reduce_pool/reduce_all afterwards, so
263+
// E_exx/H_exx(R)/forces would silently be built from a single pool's k-points.
264+
ModuleBase::WARNING_QUIT("Input_Conv", "EXX (basis_type = lcao) does not support k-point parallelism (kpar > 1)");
265+
}
266+
259267
//----------------------------------------------------------
260268
// reset symmetry flag to avoid error
261269
//----------------------------------------------------------

source/source_lcao/module_dftu/dftu_nao_occ.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ void DFTU_LCAO::cal_occ_mat_k(const Parallel_Orbitals* pv,
101101
// (symmetry) when crystal symmetry reduces the k-mesh, each ik below is only
102102
// the irreducible representative; build the AO rotation machinery once so
103103
// its k-star can be correctly re-expanded (see accumulate_occ_over_kstar).
104+
// Symmetry is analyzed once at the beginning and preserved by symmetrization.
105+
// Accordingly, symrot_, dftu_occ_symrot, and the cached Ms_ remain valid and
106+
// do not need to be rebuilt each ionic step.
104107
const bool dftu_spacegroup_symmetry = (ModuleSymmetry::Symmetry::symm_flag == 1) && !kv.kstars.empty();
105108
if (dftu_spacegroup_symmetry && !dftu_occ_symrot_built)
106109
{

tests/17_DS_DFTU/03_LCAO_DFTU_S2_Z/INPUT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mixing_type broyden
1616
mixing_beta 0.4
1717
ks_solver genelpa
1818
symmetry 1
19+
kpar 4
1920

2021
# DFT+U parameters
2122
dft_plus_u 1

tests/17_DS_DFTU/03_LCAO_DFTU_S2_Z/result.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
etotref -6771.6902262248895568
1+
etotref -6771.6902262248995612
22
etotperatomref -3385.8451131124
33
pointgroupref C_3v
44
spacegroupref C_3v

tests/17_DS_DFTU/04_LCAO_DFTU_S4_XY/INPUT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ mixing_type broyden
1717
mixing_beta 0.4
1818
ks_solver genelpa
1919
symmetry 1
20+
kpar 4
2021

2122
# DFT+U parameters
2223
dft_plus_u 1

0 commit comments

Comments
 (0)