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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: LiebLin_Fourier_to_t_equal_x.cc
  6. Purpose: Fourier transform to static space correlator for LiebLin.
  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_Fourier_to_x_equal_t executable: " << endl;
  16. cout << endl << "Provide the following arguments:" << endl << endl;
  17. cout << "char whichDSF \t\t Which structure factor ? 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" << endl;
  20. cout << "DP L \t\t\t Length of the system" << endl;
  21. cout << "int N \t\t\t Number of particles" << endl;
  22. cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers scanned over" << endl;
  23. cout << "RAW file name" << endl;
  24. cout << "int Npts_t \t Number of points in time for the Fourier transform" << endl;
  25. cout << "DP t_max \t Max time to be used" << endl;
  26. }
  27. else { // (argc == 10), correct nr of arguments
  28. char whichDSF = *argv[1];
  29. DP c_int = atof(argv[2]);
  30. DP L = atof(argv[3]);
  31. int N = atoi(argv[4]);
  32. int iKmin = atoi(argv[5]);
  33. int iKmax = atoi(argv[6]);
  34. char* rawfilename = argv[7];
  35. int Npts_t = atoi(argv[8]);
  36. DP t_max = atof(argv[9]);
  37. // Momentum business: use symmetry
  38. if (iKmin != 0) ABACUSerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
  39. ifstream RAW_infile;
  40. RAW_infile.open(rawfilename);
  41. if (RAW_infile.fail()) {
  42. cout << rawfilename << endl;
  43. ABACUSerror("Could not open RAW_infile... ");
  44. }
  45. stringstream SFT_stringstream; string SFT_string;
  46. SFT_stringstream << rawfilename << "_tft";
  47. SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
  48. ofstream SFT_outfile;
  49. SFT_outfile.open(SFT_Cstr);
  50. if (SFT_outfile.fail()) ABACUSerror("Could not open TFT_outfile... ");
  51. DP omega;
  52. int iK;
  53. DP FF;
  54. DP dev;
  55. string label;
  56. // Now define time coordinates: between 0 and t_max
  57. Vect_DP tlattice(Npts_t);
  58. for (int i = 0; i < Npts_t; ++i) tlattice[i] = (i + 0.5) * t_max/Npts_t;
  59. // Now the correlation at t:
  60. Vect<complex<DP> > FT(0.0, Npts_t);
  61. Vect_DP FTre(0.0, Npts_t);
  62. Vect_DP FTim(0.0, Npts_t);
  63. while (RAW_infile.peek() != EOF) {
  64. RAW_infile >> omega >> iK >> FF >> dev >> label;
  65. if (iK == 0)
  66. for (int it = 0; it < Npts_t; ++it)
  67. FT[it] += FF * FF * exp(II * omega * tlattice[it]);
  68. else
  69. for (int it = 0; it < Npts_t; ++it)
  70. FT[it] += 2.0 * FF * FF * exp(II * omega * tlattice[it]);
  71. }
  72. RAW_infile.close();
  73. // Reset proper normalization:
  74. for (int it = 0; it < Npts_t; ++it) {
  75. FTre[it] = real(FT[it]);
  76. FTim[it] = imag(FT[it]);
  77. }
  78. // Output to file:
  79. for (int it = 0; it < Npts_t; ++it) {
  80. if (it > 0) SFT_outfile << endl;
  81. SFT_outfile << tlattice[it] << "\t" << FTre[it] << "\t" << FTim[it];
  82. }
  83. SFT_outfile.close();
  84. }
  85. return(0);
  86. }