Skip to content

Commit 2bdedf0

Browse files
committed
revert the call in rho_sym to fix SDFT failure
1 parent e29cf06 commit 2bdedf0

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

source/module_elecstate/module_charge/symmetry_rho.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,24 @@ void Symmetry_rho::psymm(double* rho_part,
127127
}
128128

129129
// (3)
130-
Pgrid.bcast(rhotot.data(), rho_part);
131-
130+
const int ncxy = rho_basis->nx * rho_basis->ny;
131+
std::vector<double> zpiece(ncxy);
132+
for (int iz = 0; iz < rho_basis->nz; iz++)
133+
{
134+
ModuleBase::GlobalFunc::ZEROS(zpiece.data(), ncxy);
135+
if (GlobalV::MY_RANK == 0)
136+
{
137+
for (int ix = 0; ix < rho_basis->nx; ix++)
138+
{
139+
for (int iy = 0; iy < rho_basis->ny; iy++)
140+
{
141+
const int ir = ix * rho_basis->ny + iy;
142+
zpiece[ir] = rhotot[ix * rho_basis->ny * rho_basis->nz + iy * rho_basis->nz + iz];
143+
}
144+
}
145+
}
146+
Pgrid.zpiece_to_all(zpiece.data(), iz, rho_part);
147+
}
132148
#endif
133149
return;
134150
}

source/module_hamilt_pw/hamilt_pwdft/parallel_grid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class Parallel_Grid
2727
const int &nczp, const int &nrxx, const int &nbz, const int &bz); //LiuXh add 20180606
2828

2929
#ifdef __MPI
30-
void zpiece_to_stogroup(double* zpiece, const int& iz, double* rho) const; //qainrui add for sto-dft 2021-7-21
3130
void zpiece_to_all(double* zpiece, const int& iz, double* rho) const;
31+
void zpiece_to_stogroup(double* zpiece, const int& iz, double* rho) const; //qainrui add for sto-dft 2021-7-21
3232

3333
/// @brief Broadcast data from root to all processors. The index order is [x][y][z].
3434
void bcast(const double* const data_global, double* data_local)const;

0 commit comments

Comments
 (0)