Skip to content

Commit 8170924

Browse files
committed
fix bug in the bcast
1 parent 3b80fab commit 8170924

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

source/module_cell/atom_spec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void Atom::bcast_atom()
146146
return;
147147
}
148148

149-
void Atom::bcast_atom_()
149+
void Atom::bcast_atom2()
150150
{
151151
this->ncpp.bcast_atom_pseudo();
152152
}

source/module_cell/bcast_cell.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ namespace unitcell
2121
void bcast_atoms_pseudo(Atom* atoms,
2222
const int ntype)
2323
{
24-
#ifndef __MPI
24+
#ifdef __MPI
25+
MPI_Barrier(MPI_COMM_WORLD);
2526
for (int i = 0; i < ntype; i++)
2627
{
2728
atoms[i].bcast_atom2();
@@ -32,6 +33,7 @@ namespace unitcell
3233
void bcast_Lattice(Lattice& lat)
3334
{
3435
#ifdef __MPI
36+
MPI_Barrier(MPI_COMM_WORLD);
3537
// distribute lattice parameters.
3638
ModuleBase::Matrix3& latvec = lat.latvec;
3739
ModuleBase::Matrix3& latvec_supercell = lat.latvec_supercell;
@@ -82,6 +84,7 @@ namespace unitcell
8284
void bcast_magnetism(Magnetism& magnet, const int ntype)
8385
{
8486
#ifdef __MPI
87+
MPI_Barrier(MPI_COMM_WORLD);
8588
Parallel_Common::bcast_double(magnet.start_magnetization, ntype);
8689
if (PARAM.inp.nspin == 4)
8790
{

source/module_cell/bcast_cell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace unitcell
1212
*/
1313
void bcast_atoms_tau(Atom* atoms,
1414
const int ntype);
15+
1516
/**
1617
* @brief broadcast the pseduo of the atoms
1718
*

source/module_elecstate/read_pseudo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void read_pseudo(std::ofstream& ofs, UnitCell& ucell) {
136136
}
137137

138138
#ifdef __MPI
139-
unitcell::bcast_atoms_pseduo(ucell.atoms,ucell.ntype);
139+
unitcell::bcast_atoms_pseudo(ucell.atoms,ucell.ntype);
140140
#endif
141141

142142
for (int it = 0; it < ucell.ntype; it++) {

0 commit comments

Comments
 (0)