Skip to content

Commit bf5bf41

Browse files
author
dyzheng
committed
Fix: stress error with nscf
1 parent 74304f8 commit bf5bf41

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_gamma.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ void Force_LCAO<double>::ftable(const bool isforce,
236236
PulayForceStress::cal_pulay_fs(ftvnl_dphi, stvnl_dphi, *dm, ucell, pv, dHx, dHxy, isforce, isstress);
237237

238238
// vl_dphi
239+
bool reset_dm_to_gint = PARAM.inp.calculation != "nscf" ? false : true;
239240
PulayForceStress::cal_pulay_fs(fvl_dphi,
240241
svl_dphi,
241242
*dm,
@@ -244,7 +245,7 @@ void Force_LCAO<double>::ftable(const bool isforce,
244245
gint,
245246
isforce,
246247
isstress,
247-
false /*reset dm to gint*/);
248+
reset_dm_to_gint);
248249

249250
#ifdef __DEEPKS
250251
const std::vector<std::vector<double>>& dm_gamma = dm->get_DMK_vector();

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_k.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ void Force_LCAO<std::complex<double>>::ftable(const bool isforce,
331331

332332
// doing on the real space grid.
333333
// vl_dphi
334+
bool reset_dm_to_gint = PARAM.inp.calculation != "nscf" ? false : true;
334335
PulayForceStress::cal_pulay_fs(fvl_dphi,
335336
svl_dphi,
336337
*dm,
@@ -339,7 +340,7 @@ void Force_LCAO<std::complex<double>>::ftable(const bool isforce,
339340
gint,
340341
isforce,
341342
isstress,
342-
false /*reset dm to gint*/);
343+
reset_dm_to_gint /*reset dm to gint*/);
343344

344345
#ifdef __DEEPKS
345346
if (PARAM.inp.deepks_scf)

0 commit comments

Comments
 (0)