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_Data_Daemon_Nscaling.cc 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: LiebLin_Data_Daemon_Nscaling.cc
  6. Purpose: Produces sets of data files for correlations, increasing system size at fixed c and momentum window.
  7. ***********************************************************/
  8. #include <omp.h>
  9. #include "ABACUS.h"
  10. using namespace std;
  11. using namespace ABACUS;
  12. int main(int argc, char* argv[])
  13. {
  14. if (argc != 9) { // provide some info
  15. cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
  16. cout << endl << "Usage of LiebLin_Data_Daemon_Nscaling executable: " << endl;
  17. cout << endl << "Provide the following arguments:" << endl << endl;
  18. cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: "
  19. "d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
  20. cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
  21. cout << "int Nstep \t\t\t Steps to be taken in number of particles: use positive integer "
  22. "values only. Filling will be set to 1 (L == N)" << endl;
  23. cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over "
  24. "(in units of N == Nstep): recommended values: 0 and 2*N" << endl;
  25. cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
  26. cout << "DP target_sumrule \t sumrule saturation you're satisfied with" << endl;
  27. cout << "int Max_minutes \t\t Allowed computational time: (in minutes)" << endl;
  28. }
  29. else { // (argc == 10), correct nr of arguments
  30. int ia = 1;
  31. char whichDSF = *argv[ia++];
  32. DP c_int = atof(argv[ia++]);
  33. int Nstep = atoi(argv[ia++]);
  34. int iKmin_Nstep = atoi(argv[ia++]);
  35. int iKmax_Nstep = atoi(argv[ia++]);
  36. DP kBT = atof(argv[ia++]);
  37. DP target_sumrule = atof(argv[ia++]);
  38. int Max_minutes = atoi(argv[ia++]);
  39. double StartTime = omp_get_wtime();
  40. double ActualTime = omp_get_wtime();
  41. int Secs_left = 60* Max_minutes;
  42. int iN = 0;
  43. while (Secs_left > 0) {
  44. cout << "StartTime = " << StartTime << endl;
  45. cout << "ActualTime = " << ActualTime << endl;
  46. cout << "Secs_left = " << Secs_left << endl;
  47. iN += 1;
  48. int N = Nstep * iN;
  49. DP L = N;
  50. int iKmin = iKmin_Nstep * iN;
  51. int iKmax = iKmax_Nstep * iN;
  52. DP srsat = 0.0;
  53. bool refine = false;
  54. stringstream SRC_stringstream; string SRC_string;
  55. Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
  56. SRC_stringstream << ".src";
  57. SRC_string = SRC_stringstream.str(); const char* SRC_Cstr = SRC_string.c_str();
  58. fstream srcfile;
  59. srcfile.open(SRC_Cstr, fstream::in);
  60. if (srcfile.fail()) {
  61. srsat = 0.0;
  62. refine = false;
  63. }
  64. else {
  65. srcfile >> srsat;
  66. refine = true;
  67. }
  68. srcfile.close();
  69. // Improve the icmin calculation by one chunk:
  70. Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Secs_left, target_sumrule, refine);
  71. ActualTime = clock();
  72. Secs_left = int(60*Max_minutes - (ActualTime - StartTime));
  73. cout << "Done with N = " << N << ". Time left = " << Secs_left << " seconds." << endl;
  74. } // while there is time
  75. } // else if arguments given OK
  76. return(0);
  77. }