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_tester.cc 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: LiebLin_DSF_tester.cc
  6. Purpose: allows for Ix2 manipulations (user-prompted) for LiebLin gas
  7. ***********************************************************/
  8. #include "ABACUS.h"
  9. using namespace std;
  10. using namespace ABACUS;
  11. int main(int argc, char* argv[])
  12. {
  13. if (argc != 6) { // provide some info
  14. cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
  15. cout << endl << "Usage of LiebLin_DSF_tester 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 << "DP kBT \t\t Temperature (positive only of course)" << endl;
  23. cout << endl << "EXAMPLE: " << endl << endl;
  24. cout << "LiebLin_DSF_tester d 1.0 100.0 100 0.56 " << endl << endl;
  25. }
  26. else { // (argc == 6), correct nr of arguments
  27. char whichDSF = *argv[1];
  28. DP c_int = atof(argv[2]);
  29. DP L = atof(argv[3]);
  30. int N = atoi(argv[4]);
  31. DP kBT = atof(argv[5]);
  32. // Construct the finite-size saddle-point state:
  33. LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT);
  34. spstate.Compute_All(true);
  35. LiebLin_Bethe_State estate = spstate;
  36. if (whichDSF == 'o') estate = Remove_Particle_at_Center (spstate);
  37. else if (whichDSF == 'g') estate = Add_Particle_at_Center (spstate);
  38. if (whichDSF != 'd') estate.Compute_All(true);
  39. cout << estate << endl;
  40. Vect<int> OriginIx2 = estate.Ix2;
  41. int Ix2old, Ix2new;
  42. int again = 0;
  43. string label_req;
  44. do {
  45. //cout << "Substitute Ix2: which for which ?" << endl;
  46. //cin >> Ix2old >> Ix2new;
  47. //for (int i = 0; i < estate.N; ++i) if (estate.Ix2[i] == Ix2old) estate.Ix2[i] = Ix2new;
  48. //estate.Ix2.QuickSort();
  49. cout << "Which label should the exc state be set to?" << endl;
  50. cin >> label_req;
  51. estate.Set_to_Label(label_req, OriginIx2);
  52. estate.Compute_All(false);
  53. cout << spstate << endl;
  54. cout << estate;
  55. if (whichDSF == 'd')
  56. cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E
  57. << "\tME = " << real(exp(ln_Density_ME(spstate, estate))) << endl;
  58. else if (whichDSF == 'o')
  59. cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E
  60. << "\tME = " << real(exp(ln_Psi_ME(estate, spstate))) << endl;
  61. else if (whichDSF == 'g')
  62. cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E
  63. << "\tME = " << real(exp(ln_Psi_ME(spstate, estate))) << endl;
  64. cout << "Another try ? (1 == yes, 0 == no)" << endl;
  65. again = 1;
  66. cin >> again;
  67. } while (again != 0);
  68. }
  69. return(0);
  70. }