Skip to content

Commit 6059cf0

Browse files
committed
fix tests
1 parent 117f4e8 commit 6059cf0

File tree

6 files changed

+10
-2
lines changed

6 files changed

+10
-2
lines changed

source/module_elecstate/test/elecstate_base_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class MockElecState : public ElecState
128128
PARAM.input.nupdown = 0.0;
129129
PARAM.sys.two_fermi = false;
130130
PARAM.input.nbands = 6;
131+
PARAM.sys.nbands_l = 6;
131132
PARAM.sys.nlocal = 6;
132133
PARAM.input.esolver_type = "ksdft";
133134
PARAM.input.lspinorb = false;

source/module_elecstate/test/elecstate_print_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ TEST_F(ElecStatePrintTest, PrintBand)
164164
{
165165
PARAM.input.nspin = 1;
166166
PARAM.input.nbands = 2;
167+
PARAM.sys.nbands_l = 2;
167168
GlobalV::MY_RANK = 0;
168169
GlobalV::ofs_running.open("test.dat", std::ios::out);
169170
// print eigenvalue

source/module_hamilt_pw/hamilt_stodft/sto_iter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,10 @@ void Stochastic_Iter<T, Device>::cal_storho(const UnitCell& ucell,
673673
for (int is = 0; is < nspin; ++is)
674674
{
675675
pes->charge->reduce_diff_pools(sto_rho[is]);
676+
if (!PARAM.globalv.all_ks_run && PARAM.inp.bndpar > 1)
677+
{
678+
MPI_Allreduce(MPI_IN_PLACE, sto_rho[is], nrxx, MPI_DOUBLE, MPI_SUM, BP_WORLD);
679+
}
676680
}
677681
}
678682
#endif

source/module_hsolver/diago_bpcg.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "module_base/global_function.h"
1313
#include "module_base/kernels/math_kernel_op.h"
1414
#include "para_linear_transform.h"
15-
#include "module_parameter/parameter.h"
1615

1716
namespace hsolver {
1817

@@ -314,7 +313,7 @@ void DiagoBPCG<T, Device>::diag(const HPsiFunc& hpsi_func,
314313

315314
int start_nband = 0;
316315
#ifdef __MPI
317-
if (PARAM.inp.bndpar > 1)
316+
if (this->plintrans.nproc_col > 1)
318317
{
319318
start_nband = this->plintrans.start_colB[GlobalV::MY_BNDGROUP];
320319
}

source/module_hsolver/test/diago_bpcg_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ int main(int argc, char **argv)
283283
int nproc_in_pool, kpar=1, mypool, rank_in_pool;
284284
setupmpi(argc,argv,nproc, myrank);
285285
divide_pools(nproc, myrank, nproc_in_pool, kpar, mypool, rank_in_pool);
286+
MPI_Comm_split(MPI_COMM_WORLD,myrank,0,&BP_WORLD);
286287
GlobalV::NPROC_IN_POOL = nproc;
287288
#else
288289
MPI_Init(&argc, &argv);

source/module_io/test/write_istate_info_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ TEST_F(IstateInfoTest, OutIstateInfoS1)
4646
// preconditions
4747
GlobalV::KPAR = 1;
4848
PARAM.input.nbands = 4;
49+
PARAM.sys.nbands_l = 4;
4950
PARAM.input.nspin = 1;
5051
PARAM.sys.global_out_dir = "./";
5152
// mpi setting
@@ -96,6 +97,7 @@ TEST_F(IstateInfoTest, OutIstateInfoS2)
9697
// preconditions
9798
GlobalV::KPAR = 1;
9899
PARAM.input.nbands = 4;
100+
PARAM.sys.nbands_l = 4;
99101
PARAM.input.nspin = 2;
100102
PARAM.sys.global_out_dir = "./";
101103
// mpi setting

0 commit comments

Comments
 (0)