Skip to content
Closed
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
18 changes: 17 additions & 1 deletion source/source_hsolver/module_genelpa/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,27 @@ void loadMatrix(const char FileName[], int nFull, double* a, int* desca, int bla
int nprows, npcols, myprow, mypcol;
Cblacs_gridinfo(blacs_ctxt, &nprows, &npcols, &myprow, &mypcol);
int myid = Cblacs_pnum(blacs_ctxt, myprow, mypcol);

const int ROOT_PROC = 0;

std::ifstream matrixFile;

if (myid == ROOT_PROC)
{
matrixFile.open(FileName);
if (!matrixFile.is_open())
{
#ifdef __MPI
std::cerr << "LoadError in opening '" << FileName << "'" << std::endl;
MPI_Abort(MPI_COMM_WORLD, 1);
#else
throw std::runtime_error(std::string("LoadError in opening '") + FileName + "'");
#endif
}
}
else
{
std::cout << "Process " << myid << ": Waiting for root process to load file..." << std::endl;
}

double* b = nullptr; // buffer
const int MAX_BUFFER_SIZE = 1e9; // max buffer size is 1GB
Expand Down
2 changes: 1 addition & 1 deletion source/source_pw/module_stodft/sto_wf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void Stochastic_WF<T, Device>::clean_chiallorder()
template <typename T, typename Device>
void Stochastic_WF<T, Device>::init_sto_orbitals(const int seed_in)
{
const unsigned int rank_seed_offset = 10000;
static const unsigned int rank_seed_offset = 10000;
if (seed_in == 0 || seed_in == -1)
{
srand(static_cast<unsigned int>(time(nullptr)) + GlobalV::MY_RANK * rank_seed_offset); // GlobalV global variables are reserved
Expand Down
Loading