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_over_Ensemble.cc 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: LiebLin_DSF_over_Ensemble.cc
  6. Purpose: main function for ABACUS for LiebLin gas, averaging over an Ensemble.
  7. ***********************************************************/
  8. #include "ABACUS.h"
  9. using namespace std;
  10. using namespace ABACUS;
  11. int main(int argc, char* argv[])
  12. {
  13. if (argc != 10) { // 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: "
  18. "d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
  19. cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
  20. cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
  21. cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
  22. cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: "
  23. "recommended values: -2*N and 2*N" << endl;
  24. cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
  25. cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << 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_over_Ensemble d 1.0 100.0 100 0 200 0.56 10 600 0" << endl << endl;
  29. }
  30. else { // (argc == 10), correct nr of arguments
  31. char whichDSF = *argv[1];
  32. DP c_int = atof(argv[2]);
  33. DP L = atof(argv[3]);
  34. int N = atoi(argv[4]);
  35. int iKmin = atoi(argv[5]);
  36. int iKmax = atoi(argv[6]);
  37. DP kBT = atof(argv[7]);
  38. int Max_Secs = atoi(argv[8]);
  39. bool refine = (atoi(argv[9]) == 1);
  40. // Start by constructing (or loading) the state ensemble.
  41. LiebLin_Diagonal_State_Ensemble ensemble;
  42. stringstream ensfilestrstream;
  43. ensfilestrstream << "LiebLin_c_int_" << c_int << "_L_" << L << "_N_" << N << "_kBT_" << kBT << ".ens";
  44. string ensfilestr = ensfilestrstream.str();
  45. const char* ensfile_Cstr = ensfilestr.c_str();
  46. if (!refine) { // Construct the state ensemble
  47. ensemble = LiebLin_Thermal_Saddle_Point_Ensemble (c_int, L, N, kBT);
  48. ensemble.Save(ensfile_Cstr); // Save the ensemble
  49. }
  50. else { // load the ensemble data
  51. ensemble.Load(c_int, L, N, ensfile_Cstr);
  52. }
  53. // Now perform the DSF calculation over each state in the ensemble, distributing the time according to the weight
  54. for (int ns = 0; ns < ensemble.nstates; ++ns) {
  55. Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax,
  56. int(Max_Secs * ensemble.weight[ns]), 1.0e+6, refine);
  57. }
  58. // Evaluate the f-sumrule
  59. stringstream FSR_stringstream; string FSR_string;
  60. Data_File_Name (FSR_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
  61. FSR_stringstream << "_ns_" << ensemble.nstates << ".fsr";
  62. FSR_string = FSR_stringstream.str(); const char* FSR_Cstr = FSR_string.c_str();
  63. DP Chem_Pot = 0.0;
  64. Evaluate_F_Sumrule (whichDSF, c_int, L, N, kBT, ensemble.nstates, Chem_Pot, iKmin, iKmax, FSR_Cstr);
  65. } // correct nr of arguments
  66. return(0);
  67. }