You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LiebLin_DSF_GeneralState_par_Wrapup.cc 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: LiebLin_DSF_par_Prepare.cc
  6. Purpose: Parallel version of ABACUS using MPICH.
  7. ***********************************************************/
  8. #include "ABACUS.h"
  9. //#include "mpi.h" // not needed for Prepare
  10. using namespace ABACUS;
  11. int main(int argc, char *argv[])
  12. {
  13. char whichDSF;
  14. DP c_int, L, kBT;
  15. int N, iKmin, iKmax, paralevel, nr_processors_at_newlevel;
  16. DP target_sumrule = 1.0e+6; // effectively deactivated here
  17. bool refine = true; // always true for parallel mode
  18. char* Ix2filenameprefix;
  19. if (argc < 10) { // provide some info
  20. cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
  21. cout << endl << "Usage of LiebLin_DSF_par_Wrapup executable: " << endl;
  22. cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
  23. cout << endl << "Provide the following arguments:" << endl << endl;
  24. cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
  25. cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
  26. cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
  27. cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
  28. cout << "char* defaultScanStatename:\t\t file [].Ix2 contains the quantum numbers defining the AveragingState; used as defaultScanStatename" << endl;
  29. cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
  30. //cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
  31. cout << "int paralevel" << endl;
  32. cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
  33. cout << "int nr_processors_at_new_level \t for this latest parallelization level." << endl;
  34. return(0);
  35. }
  36. else { // correct nr of arguments
  37. int n = 1;
  38. whichDSF = *argv[n++];
  39. c_int = atof(argv[n++]);
  40. L = atof(argv[n++]);
  41. N = atoi(argv[n++]);
  42. Ix2filenameprefix = argv[n++];
  43. iKmin = atoi(argv[n++]);
  44. iKmax = atoi(argv[n++]);
  45. //kBT = atof(argv[n++]);
  46. paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
  47. if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
  48. Vect<int> rank_lower_paralevels(paralevel - 1);
  49. Vect<int> nr_processors_lower_paralevels(paralevel - 1);
  50. for (int i = 0; i < paralevel - 1; ++i) {
  51. rank_lower_paralevels[i] = atoi(argv[n++]);
  52. nr_processors_lower_paralevels[i] = atoi(argv[n++]);
  53. }
  54. nr_processors_at_newlevel = atoi(argv[n++]);
  55. // Read the Ix2 from the file:
  56. Vect<int> Ix2_input(N);
  57. ifstream Ix2_input_file;
  58. stringstream filenamestrstream;
  59. filenamestrstream << Ix2filenameprefix;
  60. string defaultScanStatename = filenamestrstream.str();
  61. /*
  62. filenamestrstream << ".Ix2";
  63. string filenamestr = filenamestrstream.str();
  64. const char* filename_Cstr = filenamestr.c_str();
  65. Ix2_input_file.open(filename_Cstr);
  66. if (Ix2_input_file.fail()) {
  67. cout << filename_Cstr << endl;
  68. ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
  69. }
  70. for (int i = 0; i < N; ++i) {
  71. Ix2_input_file >> Ix2_input[i];
  72. //cout << i << "\t" << Ix2_input[i] << endl;
  73. }
  74. // Define the AveragingState
  75. LiebLin_Bethe_State AveragingState(c_int, L, N);
  76. AveragingState.Ix2 = Ix2_input;
  77. //AveragingState.Compute_All(true);
  78. */
  79. // Digest files into a unique one for the latest paralevel:
  80. Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
  81. }
  82. return(0);
  83. }