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.

Heis_DSF_GeneralState.cc 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: Heis_DSF_GeneralState.cc
  6. Purpose: main function for ABACUS for Heisenberg spin-1/2 chain
  7. ***********************************************************/
  8. #include "ABACUS.h"
  9. using namespace std;
  10. using namespace ABACUS;
  11. int main(int argc, char* argv[])
  12. {
  13. if (argc != 9) { // provide some info
  14. cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
  15. cout << endl << "Usage of Heis_DSF 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: m for S- S+, z for Sz Sz, p for S+ S-." << endl;
  18. cout << "DP Delta \t\t Value of the anisotropy: use positive real values only" << endl;
  19. cout << "int N \t\t\t Length (number of sites) of the system: use positive even integer values only" << endl;
  20. cout << "int M \t\t\t Number of down spins: use positive integer values between 1 and N/2" << 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: 0 and N" << endl;
  23. cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << endl;
  24. cout << "DP target_sumrule \t sumrule saturation you're satisfied with" << endl;
  25. cout << "bool refine \t\t Is this a refinement of a earlier calculations ? (0 == false, 1 == true)" << endl;
  26. cout << endl << "EXAMPLE: " << endl << endl;
  27. }
  28. else if (argc == 9) { // !fixed_iK
  29. int ctr = 1;
  30. char whichDSF = *argv[ctr++];
  31. DP Delta = atof(argv[ctr++]);
  32. int N = atoi(argv[ctr++]);
  33. int M = atoi(argv[ctr++]);
  34. char* Ix2filenameprefix = argv[ctr++];
  35. //int iKmin = atoi(argv[5]);
  36. //int iKmax = atoi(argv[6]);
  37. int Max_Secs = atoi(argv[ctr++]);
  38. DP target_sumrule = atof(argv[ctr++]);
  39. bool refine = (atoi(argv[ctr++]) == 1);
  40. // We systematically scan over all momentum integers (to avoid problems with Brillouin folding
  41. int iKmin = -1000*N;
  42. int iKmax = 1000*N;
  43. // Read the Ix2 from the file:
  44. // Format is:
  45. // base_level, Nrap[base_level], \endl Ix2[base_level], repeat for all occupied base_levels...
  46. ifstream Ix2_input_file;
  47. stringstream filenamestrstream;
  48. filenamestrstream << Ix2filenameprefix;
  49. string defaultScanStatename = filenamestrstream.str();
  50. filenamestrstream << ".Ix2";
  51. string filenamestr = filenamestrstream.str();
  52. const char* filename_Cstr = filenamestr.c_str();
  53. Ix2_input_file.open(filename_Cstr);
  54. if (Ix2_input_file.fail()) {
  55. cout << filename_Cstr << endl;
  56. ABACUSerror("Could not open Ix2 input file in Heis_DSF_GeneralState");
  57. }
  58. Heis_Chain chain(1.0, Delta, 0.0, N);
  59. Vect<int> Nrap_read (0, chain.Nstrings);
  60. int level = 0;
  61. Vect<Vect<int> > Ix2_read (chain.Nstrings);
  62. do {
  63. Ix2_input_file >> level;
  64. Ix2_input_file >> Nrap_read[level];
  65. Ix2_read[level] = Vect<int> (Nrap_read[level]);
  66. for (int alpha = 0; alpha < Nrap_read[level]; ++alpha) Ix2_input_file >> Ix2_read[level][alpha];
  67. //cout << "Read level = " << level << "\tNrap_read[level] = " << Nrap_read[level] << endl;
  68. //cout << "\tIx2_read[level] = " << Ix2_read[level] << endl;
  69. } while (Ix2_input_file.peek() != EOF);
  70. // Construct the Averaging State:
  71. Heis_Base base (chain, Nrap_read);
  72. int paralevel = 0;
  73. Vect<int> rank; // dummy
  74. Vect<int> nr_processors; // dummy
  75. if (Delta > 0.0 && Delta < 1.0) {
  76. XXZ_Bethe_State AveragingState (chain, base);
  77. for (int il = 0; il < chain.Nstrings; ++il) {
  78. if (Nrap_read[il] > 0) for (int alpha = 0; alpha < Nrap_read[il]; ++alpha) AveragingState.Ix2[il][alpha] = Ix2_read[il][alpha];
  79. }
  80. AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
  81. AveragingState.Compute_All(true);
  82. //cout << "AveragingState read from file: " << AveragingState << endl;
  83. // Perform the scan:
  84. Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
  85. }
  86. else if (Delta == 1.0) {
  87. XXX_Bethe_State AveragingState (chain, base);
  88. for (int il = 0; il < chain.Nstrings; ++il) {
  89. for (int alpha = 0; alpha < Nrap_read[il]; ++alpha) AveragingState.Ix2[il][alpha] = Ix2_read[il][alpha];
  90. }
  91. AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
  92. AveragingState.Compute_All(true);
  93. // Perform the scan:
  94. Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
  95. }
  96. else if (Delta > 1.0) {
  97. XXZ_gpd_Bethe_State AveragingState (chain, base);
  98. for (int il = 0; il < chain.Nstrings; ++il) {
  99. for (int alpha = 0; alpha < Nrap_read[il]; ++alpha) AveragingState.Ix2[il][alpha] = Ix2_read[il][alpha];
  100. }
  101. AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
  102. AveragingState.Compute_All(true);
  103. // Perform the scan:
  104. Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
  105. }
  106. }
  107. return(0);
  108. }