Skip to content

Commit 15835bd

Browse files
Fix : fix the segment fault of md/relax of deepks by changing location of ld.init_DMR to before_scf (#6170)
Co-authored-by: Mohan Chen <mohanchen@pku.edu.cn>
1 parent 6664393 commit 15835bd

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -690,11 +690,11 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
690690
{
691691
this->p_hamilt->refresh();
692692
}
693-
if (iter == 1 && istep == 0)
694-
{
695-
// initialize DMR
696-
this->ld.init_DMR(ucell, orb_, this->pv, this->gd);
697-
}
693+
// if (iter == 1 && istep == 0)
694+
// {
695+
// // initialize DMR
696+
// this->ld.init_DMR(ucell, orb_, this->pv, this->gd);
697+
// }
698698
#endif
699699

700700
if (PARAM.inp.vl_in_h)

source/module_esolver/lcao_before_scf.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
243243
->get_DM()
244244
->init_DMR(*(dynamic_cast<hamilt::HamiltLCAO<TK, TR>*>(this->p_hamilt)->getHR()));
245245

246+
#ifdef __DEEPKS
247+
// initialize DMR of DeePKS
248+
this->ld.init_DMR(ucell, orb_, this->pv, this->gd);
249+
#endif
250+
246251
// 15) two cases are considered:
247252
// 1. DMK in DensityMatrix is not empty (istep > 0), then DMR is initialized by DMK
248253
// 2. DMK in DensityMatrix is empty (istep == 0), then DMR is initialized by zeros
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
etotref -465.9986233931722
2-
etotperatomref -155.3328744644
3-
totalforceref 5.535484
4-
totalstressref 1.522431
5-
totaldes 2.163702
6-
deepks_e_dm -23.732952255916025
7-
deepks_f_label 18.900703238483914
8-
deepks_s_label 19.098530764442412
9-
totaltimeref 14.90
1+
etotref -465.9986230250963
2+
etotperatomref -155.3328743417
3+
totalforceref 5.535378
4+
totalstressref 1.522437
5+
totaldes 2.163700
6+
deepks_e_dm -23.732952988652137
7+
deepks_f_label 18.900698754990074
8+
deepks_s_label 19.098532433749547
9+
totaltimeref 16.55

0 commit comments

Comments
 (0)