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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: LiebLin_DSF_GeneralState.cc
  6. Purpose: function for ABACUS for LiebLin gas, on general states
  7. ***********************************************************/
  8. #include "ABACUS.h"
  9. using namespace std;
  10. using namespace ABACUS;
  11. int main(int argc, char* argv[])
  12. {
  13. if (argc != 11) { // provide some info
  14. cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
  15. cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
  16. cout << endl << "Provide the following arguments:" << endl << endl;
  17. 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;
  18. cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
  19. cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
  20. cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
  21. cout << "char* defaultScanStatename:\t\t file [].Ix2 contains the quantum numbers defining the AveragingState; used as defaultScanStatename" << endl;
  22. cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
  23. //cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
  24. cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << endl;
  25. cout << "DP target_sumrule \t sumrule saturation you're satisfied with" << endl;
  26. cout << "bool refine \t\t Is this a refinement of earlier calculations ? (0 == false, 1 == true)" << endl;
  27. cout << endl << "EXAMPLE: " << endl << endl;
  28. cout << "LiebLin_DSF d 1.0 100.0 100 0 200 0.56 600 1.0 0" << endl << endl;
  29. }
  30. else { // (argc == 10), correct nr of arguments
  31. int n = 1;
  32. char whichDSF = *argv[n++];
  33. DP c_int = atof(argv[n++]);
  34. DP L = atof(argv[n++]);
  35. int N = atoi(argv[n++]);
  36. char* Ix2filenameprefix = argv[n++];
  37. int iKmin = atoi(argv[n++]);
  38. int iKmax = atoi(argv[n++]);
  39. //DP kBT = atof(argv[n++]);
  40. int Max_Secs = atoi(argv[n++]);
  41. DP target_sumrule = atof(argv[n++]);
  42. bool refine = (atoi(argv[n++]) == 1);
  43. // Read the Ix2 from the file:
  44. Vect<int> Ix2_input(N);
  45. ifstream Ix2_input_file;
  46. stringstream filenamestrstream;
  47. filenamestrstream << Ix2filenameprefix;
  48. string defaultScanStatename = filenamestrstream.str();
  49. filenamestrstream << ".Ix2";
  50. string filenamestr = filenamestrstream.str();
  51. const char* filename_Cstr = filenamestr.c_str();
  52. Ix2_input_file.open(filename_Cstr);
  53. if (Ix2_input_file.fail()) {
  54. cout << filename_Cstr << endl;
  55. ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
  56. }
  57. for (int i = 0; i < N; ++i) {
  58. Ix2_input_file >> Ix2_input[i];
  59. //cout << i << "\t" << Ix2_input[i] << endl;
  60. }
  61. // Now define the AveragingState
  62. LiebLin_Bethe_State AveragingState(c_int, L, N);
  63. AveragingState.Ix2 = Ix2_input;
  64. AveragingState.Compute_All(true);
  65. //cout << "Averaging state: " << AveragingState << endl;
  66. //Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine, 0, 1);
  67. //Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine);
  68. //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
  69. // int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors)
  70. // Simplified function call of the above:
  71. //void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
  72. // int Max_Secs, DP target_sumrule, bool refine)
  73. Scan_LiebLin (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine);
  74. }
  75. return(0);
  76. }