Skip to content

Commit 98f8ae9

Browse files
authored
Fix: No warning is given if KPT is ill set (#4134)
* throw warning when kpoints is non-standard * modified
1 parent 2f1e062 commit 98f8ae9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

source/module_cell/klist.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,15 @@ bool K_Vectors::read_kpoints(const std::string &fn)
307307
}
308308

309309
ifk >> nmp[0] >> nmp[1] >> nmp[2];
310+
311+
koffset[0] = 0;
312+
koffset[1] = 0;
313+
koffset[2] = 0;
314+
if (!(ifk >> koffset[0] >> koffset[1] >> koffset[2]))
315+
{
316+
ModuleBase::WARNING("K_Vectors::read_kpoints", "Missing k-point offsets in the k-points file.");
317+
}
310318

311-
ifk >> koffset[0] >> koffset[1] >> koffset[2];
312319
this->Monkhorst_Pack(nmp, koffset, k_type);
313320
}
314321
else if (nkstot > 0)

0 commit comments

Comments
 (0)