Skip to content

Commit 8ef9cba

Browse files
authored
fix a segfault in LR-TDDFT when nspin=1 (#5652)
1 parent 8b4d10f commit 8ef9cba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

source/module_lr/esolver_lrtd_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ LR::ESolver_LR<T, TR>::ESolver_LR(ModuleESolver::ESolver_KS_LCAO<T, TR>&& ks_sol
181181
{
182182
this->psi_ks = new psi::Psi<T>(this->kv.get_nks(), this->paraC_.get_col_size(), this->paraC_.get_row_size());
183183
this->eig_ks.create(this->kv.get_nks(), this->nbands);
184-
const int start_band = this->nocc_max - std::max(nocc[0], nocc[1]);
184+
const int start_band = this->nocc_max - *std::max_element(nocc.begin(), nocc.end());
185185
for (int ik = 0;ik < this->kv.get_nks();++ik)
186186
{
187187
Cpxgemr2d(this->nbasis, this->nbands, &(*ks_sol.psi)(ik, 0, 0), 1, start_band + 1, ks_sol.pv.desc_wfc,

0 commit comments

Comments
 (0)