Skip to content

Commit 90f673a

Browse files
committed
Fix: nb2d default error with NSPIN=4
1 parent d02d5e4 commit 90f673a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

source/module_hamilt_lcao/hamilt_lcaodft/LCAO_init_basis.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ void init_basis_lcao(Parallel_Orbitals& pv,
7979
try_nb += pv.set_nloc_wfc_Eij(PARAM.inp.nbands, GlobalV::ofs_running, GlobalV::ofs_warning);
8080
if (try_nb != 0)
8181
{
82-
pv.set(nlocal, nlocal, 1, pv.blacs_ctxt);
82+
// fall back to the minimum size, 1 or 2 (nspin=4)
83+
const int min_size = (PARAM.inp.nspin == 4) ? 2 : 1;
84+
pv.set(nlocal, nlocal, min_size, pv.blacs_ctxt);
8385
try_nb = pv.set_nloc_wfc_Eij(PARAM.inp.nbands, GlobalV::ofs_running, GlobalV::ofs_warning);
8486
}
8587

source/module_hamilt_lcao/hamilt_lcaodft/operator_lcao/nonlocal_force_stress.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void NonlocalNew<OperatorLCAO<TK, TR>>::cal_force_stress(const bool cal_force,
3232
{
3333
// skip the atoms without plus-U
3434
auto tau0 = ucell->get_tau(iat0);
35-
int I0;
35+
int I0 = 0;
3636
ucell->iat2iait(iat0, &I0, &this->current_type);
3737

3838
// first step: find the adjacent atoms and filter the real adjacent atoms

0 commit comments

Comments
 (0)