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_Moses_tester.cc 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 != 8) { // 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 << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
  23. cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
  24. cout << "int DIr \t\t shift of right sea as compared to its ground state position" << 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. int Nl = atoi(argv[5]);
  32. int DIl = atoi(argv[6]);
  33. int DIr = atoi(argv[7]);
  34. if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in LiebLin_Moses_tester");
  35. // Define the Moses state:
  36. LiebLin_Bethe_State MosesState (c_int, L, N);
  37. // Split the sea:
  38. for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] -= 2 * DIl;
  39. for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
  40. MosesState.Compute_All (true);
  41. LiebLin_Bethe_State estate = MosesState;
  42. cout << MosesState;
  43. int Ix2old, Ix2new;
  44. int again = 0;
  45. do {
  46. cout << "Substitute Ix2: which for which ?" << endl;
  47. cin >> Ix2old >> Ix2new;
  48. for (int i = 0; i < estate.N; ++i) if (estate.Ix2[i] == Ix2old) estate.Ix2[i] = Ix2new;
  49. estate.Compute_All(false);
  50. cout << estate;
  51. cout << setprecision(16) << "omega = " << estate.E - MosesState.E << "\t"
  52. << exp(real(ln_Density_ME(MosesState, estate))) << endl;
  53. cout << "Another try ? (0 == no)" << endl;
  54. cin >> again;
  55. } while (again != 0);
  56. }
  57. return(0);
  58. }