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_MosesState_par_Prepare.cc 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 std;
  11. using namespace ABACUS;
  12. int main(int argc, char *argv[])
  13. {
  14. char whichDSF;
  15. DP c_int, L;
  16. int N, Nl, DIl, DIr, iKmin, iKmax, paralevel, nr_processors_at_newlevel;
  17. DP target_sumrule = 1.0e+6; // effectively deactivated here
  18. bool refine = true; // always true for parallel mode
  19. DP kBT = 0.0; // dummy
  20. if (argc < 12) { // provide some info
  21. cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
  22. cout << endl << "Usage of LiebLin_DSF_MosesState_par_Prepare executable: " << endl;
  23. cout << endl << "This function prepares an ABACUS parallel mode run, starting from a preexisting "
  24. "serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
  25. cout << endl << "Provide the following arguments:" << endl << endl;
  26. cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: "
  27. "d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
  28. cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
  29. cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
  30. cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
  31. cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
  32. cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
  33. cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
  34. cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: "
  35. "recommended values: -2*N and 2*N" << endl;
  36. cout << "int paralevel" << endl;
  37. cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
  38. cout << "int nr_processors_at_new_level \t for this new parallelization level." << endl;
  39. return(0);
  40. }
  41. else { // correct nr of arguments
  42. int n = 1;
  43. whichDSF = *argv[n++];
  44. c_int = atof(argv[n++]);
  45. L = atof(argv[n++]);
  46. N = atoi(argv[n++]);
  47. Nl = atoi(argv[n++]);
  48. DIl = atoi(argv[n++]);
  49. DIr = atoi(argv[n++]);
  50. iKmin = atoi(argv[n++]);
  51. iKmax = atoi(argv[n++]);
  52. paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
  53. if (argc != 12 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
  54. Vect<int> rank_lower_paralevels(paralevel - 1);
  55. Vect<int> nr_processors_lower_paralevels(paralevel - 1);
  56. for (int i = 0; i < paralevel - 1; ++i) {
  57. rank_lower_paralevels[i] = atoi(argv[n++]);
  58. nr_processors_lower_paralevels[i] = atoi(argv[n++]);
  59. }
  60. nr_processors_at_newlevel = atoi(argv[n++]);
  61. // Define the Moses state:
  62. LiebLin_Bethe_State MosesState (c_int, L, N);
  63. // Split the sea:
  64. for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
  65. for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
  66. MosesState.Compute_All (true);
  67. // Handy default name:
  68. stringstream defaultScanStatename_strstream;
  69. defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
  70. string defaultScanStatename = defaultScanStatename_strstream.str();
  71. // Split up thread list into chunks, one per processor
  72. Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename,
  73. paralevel, rank_lower_paralevels, nr_processors_lower_paralevels,
  74. nr_processors_at_newlevel);
  75. }
  76. return(0);
  77. }