diff --git a/source/source_hsolver/module_genelpa/utils.cpp b/source/source_hsolver/module_genelpa/utils.cpp index d9e6e74c59..f77247f1c8 100644 --- a/source/source_hsolver/module_genelpa/utils.cpp +++ b/source/source_hsolver/module_genelpa/utils.cpp @@ -92,7 +92,15 @@ void loadMatrix(const char FileName[], int nFull, double* a, int* desca, int bla const int ROOT_PROC = 0; std::ifstream matrixFile; if (myid == ROOT_PROC) + { matrixFile.open(FileName); + if (!matrixFile.is_open()) + { + std::cerr << "Error: failed to open matrix file '" << FileName + << "' in loadMatrix()." << std::endl; + MPI_Abort(MPI_COMM_WORLD, 1); + } + } double* b; // buffer const int MAX_BUFFER_SIZE = 1e9; // max buffer size is 1GB