diff --git a/source/module_lr/esolver_lrtd_lcao.cpp b/source/module_lr/esolver_lrtd_lcao.cpp index b9e2a9b16e..46697710ea 100644 --- a/source/module_lr/esolver_lrtd_lcao.cpp +++ b/source/module_lr/esolver_lrtd_lcao.cpp @@ -181,7 +181,7 @@ LR::ESolver_LR::ESolver_LR(ModuleESolver::ESolver_KS_LCAO&& ks_sol { this->psi_ks = new psi::Psi(this->kv.get_nks(), this->paraC_.get_col_size(), this->paraC_.get_row_size()); this->eig_ks.create(this->kv.get_nks(), this->nbands); - const int start_band = this->nocc_max - std::max(nocc[0], nocc[1]); + const int start_band = this->nocc_max - *std::max_element(nocc.begin(), nocc.end()); for (int ik = 0;ik < this->kv.get_nks();++ik) { Cpxgemr2d(this->nbasis, this->nbands, &(*ks_sol.psi)(ik, 0, 0), 1, start_band + 1, ks_sol.pv.desc_wfc,