Skip to content

Commit 706836c

Browse files
authored
Merge pull request #1163 from wenfei-li/develop
fix: memory leak in LCAO calculations
2 parents 2a8400b + 2a8288d commit 706836c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,11 @@ void ESolver_KS_LCAO::afterscf()
941941
{
942942
this->output_HS_R(); // LiuXh add 2019-07-15
943943
}
944+
945+
if(!GlobalV::CAL_FORCE && !GlobalV::CAL_STRESS)
946+
{
947+
RA.delete_grid();
948+
}
944949
}
945950

946951
bool ESolver_KS_LCAO::do_after_converge(int& iter)

source/module_orbital/ORB_table_phi.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ void ORB_table_phi::cal_ST_Phi12_R
178178

179179
double* integrated_func = new double[kmesh];
180180

181-
const std::vector<std::vector<double>> &jlm1 = pSB->get_jlx()[l-1];
181+
int ll;
182+
if(l==0) ll=0;
183+
else ll=l-1;
184+
185+
const std::vector<std::vector<double>> &jlm1 = pSB->get_jlx()[ll];
182186
const std::vector<std::vector<double>> &jl = pSB->get_jlx()[l];
183187
const std::vector<std::vector<double>> &jlp1 = pSB->get_jlx()[l+1];
184188

0 commit comments

Comments
 (0)