Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/source_pw/module_stodft/sto_elecond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ void Sto_EleCond<FPTYPE, Device>::cal_jmatrix(StoHamiltPW<std::complex<lowTYPE>,
#ifdef __MPI
info_gatherv* ks_fact = static_cast<info_gatherv*>(gatherinfo_ks);
info_gatherv* sto_npwx = static_cast<info_gatherv*>(gatherinfo_sto);
rightchi_all = gatherchi_op<lowTYPE, Device>()(rightchi, chi_all, npwx, sto_npwx->nrecv, sto_npwx->displs, perbands_sto);
righthchi_all = gatherchi_op<lowTYPE, Device>()(right_hchi, hchi_all, npwx, sto_npwx->nrecv, sto_npwx->displs, perbands_sto);
rightchi_all = gatherchi_op<lowTYPE, Device>()(rightchi, chi_all, npwx, sto_npwx->nrecv.data(), sto_npwx->displs.data(), perbands_sto);
righthchi_all = gatherchi_op<lowTYPE, Device>()(right_hchi, hchi_all, npwx, sto_npwx->nrecv.data(), sto_npwx->displs.data(), perbands_sto);
if (PARAM.inp.bndpar > 1 && rightfact != nullptr)
{
vec_rightf_all.resize(allbands_ks);
rightf_all = vec_rightf_all.data();
Parallel_Common::gatherv_data(rightfact, perbands_ks, rightf_all, ks_fact->nrecv, ks_fact->displs, BP_WORLD);
Parallel_Common::gatherv_data(rightfact, perbands_ks, rightf_all, ks_fact->nrecv.data(), ks_fact->displs.data(), BP_WORLD);
}
#endif

Expand Down
17 changes: 7 additions & 10 deletions source/source_pw/module_stodft/sto_tool.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#ifndef STO_TOOL_H
#define STO_TOOL_H

#include <vector>

#include "source_cell/klist.h"
#include "source_pw/module_stodft/sto_hamilt_pw.h"
#include "source_pw/module_stodft/sto_wf.h"
Expand Down Expand Up @@ -65,10 +68,9 @@ struct parallel_distribution
struct info_gatherv
{
info_gatherv(const int& ngroup_per, const int& np, const int& num_in_group, MPI_Comm comm_world)
: nrecv(np), displs(np)
Comment thread
mohanchen marked this conversation as resolved.
{
nrecv = new int[np];
displs = new int[np];
MPI_Allgather(&ngroup_per, 1, MPI_INT, nrecv, 1, MPI_INT, comm_world);
MPI_Allgather(&ngroup_per, 1, MPI_INT, nrecv.data(), 1, MPI_INT, comm_world);
displs[0] = 0;
for (int i = 1; i < np; ++i)
{
Expand All @@ -80,13 +82,8 @@ struct info_gatherv
displs[i] *= num_in_group;
}
}
~info_gatherv()
{
delete[] nrecv;
delete[] displs;
}
int* nrecv = nullptr;
int* displs = nullptr;
std::vector<int> nrecv;
std::vector<int> displs;
};
#endif

Expand Down
Loading