Skip to content

Commit

Permalink
Parallelized FT calculation
Browse files Browse the repository at this point in the history
Also removed progress bar from FT calculation
  • Loading branch information
alejandrojuria committed Nov 24, 2023
1 parent e5c92b0 commit ebbbe3b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions src/Exciton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,8 @@ void Exciton::initializeResultsH0(bool triangular){
this->ftMotifQ = arma::cx_mat(natoms, natoms);

vec auxEigVal(basisdim);
cx_mat auxEigvec(basisdim, basisdim);
cx_mat h;
arma::cx_mat auxEigvec(basisdim, basisdim);
arma::cx_mat h;

// Progress bar variables
int step = 1;
Expand Down Expand Up @@ -944,17 +944,20 @@ void Exciton::initializeResultsH0(bool triangular){

if(this->mode == "realspace"){
std::cout << "Computing lattice Fourier transform..." << std::endl;
#pragma omp parallel for
for (unsigned int i = 0; i < meshBZ_.n_rows; i++){
// BIGGEST BOTTLENECK OF THE CODE
initializeMotifFT(i, cells);

percent = (100 * (i + 1)) / meshBZ_.n_rows ;
if (percent >= displayNext){
cout << "\r" << "[" << std::string(percent / 5, '|') << std::string(100 / 5 - percent / 5, ' ') << "]";
cout << percent << "%";
std::cout.flush();
displayNext += step;
}
/* AJU 24-11-23: Progress bar does not work properly with parallel for
Fix it or remove it direcly? */
// percent = (100 * (i + 1)) / meshBZ_.n_rows ;
// if (percent >= displayNext){
// cout << "\r" << "[" << std::string(percent / 5, '|') << std::string(100 / 5 - percent / 5, ' ') << "]";
// cout << percent << "%";
// std::cout.flush();
// displayNext += step;
// }
}
std::cout << "\nDone" << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void printHeader(){
std::cout << "+---------------------------------------------------------------------------+" << std::endl;
std::cout << "| |" << std::endl;
std::cout << "| Xatu |" << std::endl;
std::cout << "| v1.0 - 01/07/2023 |" << std::endl;
std::cout << "| v1.1 - 24/11/2023 |" << std::endl;
std::cout << "| https://github.com/alejandrojuria/xatu |" << std::endl;
std::cout << "| |" << std::endl;
std::cout << "| [Authors] |" << std::endl;
Expand Down

0 comments on commit ebbbe3b

Please sign in to comment.