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.

ABACUS_LiebLin.h 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: ABACUS_LiebLin.h
  6. Purpose: Declares LiebLin gas-related classes and functions.
  7. ***********************************************************/
  8. #ifndef ABACUS_LIEBLIN_H
  9. #define ABACUS_LIEBLIN_H
  10. #include "ABACUS.h"
  11. namespace ABACUS {
  12. // First, some global constants...
  13. const DP ITER_REQ_PREC_LIEBLIN = 1.0e+4 * MACHINE_EPS_SQ;
  14. const int LIEBLIN_Ix2_MIN = -1000000; // Like a UV cutoff. Assumption: never reached in scanning.
  15. const int LIEBLIN_Ix2_MAX = -LIEBLIN_Ix2_MIN;
  16. //***********************************************************************
  17. /**
  18. Eigenstates of the Lieb-Liniger model in the repulsive \f$(c > 0)\f$ regime.
  19. For numerical convenience, rapidities are rescaled by the interaction parameter \f$c\f$.
  20. In equations throughout this documentation, \f$\tilde{\lambda} \equiv \lambda/c\f$.
  21. In the code, these rescaled rapidities are denoted `lambdaoc` (read: "lambda over c").
  22. */
  23. class LiebLin_Bethe_State {
  24. public:
  25. DP c_int; // interaction parameter
  26. DP L;
  27. DP cxL;
  28. int N;
  29. std::string label;
  30. Vect<int> Ix2_available; // quantum numbers which are allowable but not occupied
  31. Vect<int> index_first_hole_to_right;
  32. Vect<int> displacement;
  33. Vect<int> Ix2;
  34. Vect<DP> lambdaoc;
  35. Vect<DP> S; // scattering sum
  36. Vect<DP> dSdlambdaoc; // its derivative
  37. DP diffsq;
  38. DP prec;
  39. int conv;
  40. int iter_Newton;
  41. DP E;
  42. int iK;
  43. DP K;
  44. DP lnnorm;
  45. public:
  46. LiebLin_Bethe_State ();
  47. LiebLin_Bethe_State (DP c_int_ref, DP L_ref, int N_ref);
  48. LiebLin_Bethe_State& operator= (const LiebLin_Bethe_State& RefState);
  49. public:
  50. int Charge () { return(N); };
  51. void Set_to_Label (std::string label_ref, const Vect<int>& OriginStateIx2);
  52. void Set_to_Label (std::string label_ref); // assumes OriginState == GroundState
  53. void Set_Label_from_Ix2 (const Vect<int>& OriginStateIx2);
  54. void Set_Label_Internals_from_Ix2 (const Vect<int>& OriginStateIx2);
  55. bool Check_Admissibility(char whichDSF); // always returns true
  56. void Find_Rapidities (bool reset_rapidities);
  57. bool Check_Rapidities(); // checks that all rapidities are not nan
  58. DP String_delta(); // trivially returns 0; exists to mirror spin chain function
  59. bool Check_Symmetry (); // checks whether set of quantum numbers obeys { I } = { -I }
  60. void Compute_lnnorm ();
  61. void Compute_All (bool reset_rapidities); // solves BAE, computes E, K and lnnorm
  62. void Set_Free_lambdaocs();
  63. void Iterate_BAE(DP damping);
  64. void Iterate_BAE_S(DP damping);
  65. void Iterate_BAE_Newton (DP damping, Vect_DP& RHSBAE, Vect_DP& dlambdaoc, SQMat_DP& Gaudin, Vect_INT& indx);
  66. void Compute_Energy ();
  67. void Compute_Momentum ();
  68. DP Kernel (int a, int b);
  69. DP Kernel (DP lambdaoc_ref);
  70. void Build_Reduced_Gaudin_Matrix (SQMat<DP>& Gaudin_Red);
  71. void Build_Reduced_BEC_Quench_Gaudin_Matrix (SQMat<DP>& Gaudin_Red);
  72. void Annihilate_ph_pair (int ipart, int ihole, const Vect<int>& OriginStateIx2);
  73. void Parity_Flip (); // takes all lambdaoc to -lambdaoc
  74. inline bool Set_to_Inner_Skeleton (int iKneeded, const Vect<int>& OriginIx2)
  75. {
  76. if (N < 3) ABACUSerror("N<3 incompatible with fixed momentum scanning");
  77. Ix2[0] = Ix2[1] - 2;
  78. Ix2[N-1] = Ix2[N-2] + 2;
  79. (*this).Compute_Momentum();
  80. if (iKneeded >= iK) Ix2[N-1] += 2*(iKneeded - iK);
  81. else Ix2[0] += 2*(iKneeded - iK);
  82. if (Ix2[0] < LIEBLIN_Ix2_MIN || Ix2[N-1] > LIEBLIN_Ix2_MAX) return(false);
  83. (*this).Set_Label_from_Ix2 (OriginIx2);
  84. return(true);
  85. }
  86. void Set_to_Outer_Skeleton (const Vect<int>& OriginIx2)
  87. {
  88. Ix2[0] = LIEBLIN_Ix2_MIN + (N % 2) + 1;
  89. Ix2[N-1] = LIEBLIN_Ix2_MAX - (N % 2) - 1;
  90. (*this).Set_Label_from_Ix2 (OriginIx2);
  91. };
  92. };
  93. inline bool Is_Inner_Skeleton (LiebLin_Bethe_State& State) {
  94. return (State.N >= 2 && (State.Ix2[0] == State.Ix2[1] - 2
  95. || State.Ix2[State.N-1] == State.Ix2[State.N-2] + 2));
  96. };
  97. inline bool Is_Outer_Skeleton (LiebLin_Bethe_State& State) {
  98. return (State.N >= 2 && State.Ix2[0] == LIEBLIN_Ix2_MIN + (State.N % 2) + 1
  99. && State.Ix2[State.N-1] == LIEBLIN_Ix2_MAX - (State.N % 2) - 1);
  100. };
  101. inline bool Is_Outer_Skeleton (const LiebLin_Bethe_State& State) {
  102. return (State.N >= 2 && State.Ix2[0] == LIEBLIN_Ix2_MIN + (State.N % 2) + 1
  103. && State.Ix2[State.N-1] == LIEBLIN_Ix2_MAX - (State.N % 2) - 1);
  104. };
  105. inline bool Force_Descent (char whichDSF, LiebLin_Bethe_State& ScanState,
  106. LiebLin_Bethe_State& RefState,
  107. int desc_type_required, int iKmod, DP Chem_Pot)
  108. {
  109. bool forcedesc = false;
  110. // Force descent if we're computing density-density, we're at zero momentum
  111. // and we're descending with momentum preserved:
  112. if (whichDSF == 'd' && ScanState.iK == RefState.iK && desc_type_required > 8) forcedesc = true;
  113. // For BEC to c > 0 quench, g2(x=0): force first step
  114. else if (whichDSF == 'B' && ScanState.label == RefState.label) forcedesc = true;
  115. else if (whichDSF == 'C' && ScanState.label == RefState.label) forcedesc = true;
  116. return(forcedesc);
  117. }
  118. std::ostream& operator<< (std::ostream& s, const LiebLin_Bethe_State& state);
  119. // FUNCTION DECLARATIONS:
  120. DP Chemical_Potential (LiebLin_Bethe_State& RefState);
  121. DP Sumrule_Factor (char whichDSF, LiebLin_Bethe_State& RefState, DP Chem_Pot,
  122. int iKmin, int iKmax);
  123. void Evaluate_F_Sumrule (char whichDSF, const LiebLin_Bethe_State& RefState, DP Chem_Pot,
  124. int iKmin, int iKmax, const char* RAW_Cstr, const char* FSR_Cstr);
  125. void Evaluate_F_Sumrule (std::string prefix, char whichDSF, const LiebLin_Bethe_State& RefState,
  126. DP Chem_Pot, int iKmin, int iKmax);
  127. void Evaluate_F_Sumrule (char whichDSF, DP c_int, DP L, int N, DP kBT, int nstates_req,
  128. DP Chem_Pot, int iKmin, int iKmax, const char* FSR_Cstr);
  129. // in LiebLin_Utils.cc
  130. DP LiebLin_dE0_dc (DP c_int, DP L, int N);
  131. DP LiebLin_vs (DP c_int, DP L, int N);
  132. DP LiebLin_Dressed_Charge_N (DP c_int, DP L, int N);
  133. int Momentum_Right_Excitations (LiebLin_Bethe_State& ScanState);
  134. int Momentum_Left_Excitations (LiebLin_Bethe_State& ScanState);
  135. DP ln_Overlap_with_BEC (LiebLin_Bethe_State& lambda);
  136. DP Particle_Hole_Excitation_Cost (char whichDSF, LiebLin_Bethe_State& AveragingState);
  137. std::complex<DP> ln_Density_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
  138. std::complex<DP> ln_Psi_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate);
  139. std::complex<DP> ln_g2_ME (LiebLin_Bethe_State& mu, LiebLin_Bethe_State& lambda);
  140. DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax,
  141. LiebLin_Bethe_State& LeftState,
  142. LiebLin_Bethe_State& RefState, DP Chem_Pot,
  143. std::stringstream& DAT_outfile);
  144. DP LiebLin_Twisted_lnnorm (Vect<std::complex<DP> >& lambdaoc, double cxL);
  145. std::complex<DP> LiebLin_Twisted_ln_Overlap (DP expbeta, Vect<DP> lstate_lambdaoc,
  146. DP lstate_lnnorm,
  147. LiebLin_Bethe_State& rstate);
  148. std::complex<DP> LiebLin_Twisted_ln_Overlap (std::complex<DP> expbeta,
  149. Vect<std::complex<DP> > lstate_lambdaoc,
  150. DP lstate_lnnorm,
  151. LiebLin_Bethe_State& rstate);
  152. std::complex<DP> LiebLin_ln_Overlap (Vect<DP> lstate_lambdaoc, DP lstate_lnnorm,
  153. LiebLin_Bethe_State& rstate);
  154. std::complex<DP> LiebLin_ln_Overlap (Vect<std::complex<DP> > lstate_lambdaoc, DP lstate_lnnorm,
  155. LiebLin_Bethe_State& rstate);
  156. // In src/LiebLin_Tgt0.cc:
  157. DP Entropy (LiebLin_Bethe_State& RefState);
  158. DP Canonical_Free_Energy (LiebLin_Bethe_State& RefState, DP kBT);
  159. LiebLin_Bethe_State Canonical_Saddle_Point_State (DP c_int, DP L, int N, DP kBT);
  160. LiebLin_Bethe_State Add_Particle_at_Center (const LiebLin_Bethe_State& RefState);
  161. LiebLin_Bethe_State Remove_Particle_at_Center (const LiebLin_Bethe_State& RefState);
  162. DP rho_of_lambdaoc_1 (LiebLin_Bethe_State& RefState, DP lambdaoc, DP delta);
  163. DP rho_of_lambdaoc_2 (LiebLin_Bethe_State& RefState, DP lambdaoc, DP delta);
  164. } // namespace ABACUS
  165. #endif