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.

ODSLF_Matrix_Element_Contrib.cc 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**********************************************************
  2. This software is part of J.-S. Caux's ABACUS library.
  3. Copyright (c) J.-S. Caux.
  4. -----------------------------------------------------------
  5. File: src/ODSLF/ODSLF_Matrix_Element_Contrib.cc
  6. Purpose: handles the generic call for a matrix element.
  7. ***********************************************************/
  8. #include "ABACUS.h"
  9. using namespace std;
  10. using namespace ABACUS;
  11. namespace ABACUS {
  12. DP Compute_Matrix_Element_Contrib (char whichDSF, int iKmin, int iKmax, ODSLF_XXZ_Bethe_State& LeftState,
  13. ODSLF_XXZ_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile)
  14. {
  15. // This function prints the matrix element information to the fstream,
  16. // and returns a weighed `data_value' to be multiplied by sumrule_factor,
  17. // to determine if scanning along this thread should be continued.
  18. // Identify which matrix is needed from the number of particles in Left and Right states:
  19. bool fixed_iK = (iKmin == iKmax);
  20. DP ME = 0.0;
  21. if (whichDSF == 'Z')
  22. ME = LeftState.E - RefState.E;
  23. else if (whichDSF == 'm')
  24. ME = exp(real(ln_Smin_ME (RefState, LeftState)));
  25. else if (whichDSF == 'z') {
  26. if (LeftState.base_id == RefState.base_id && LeftState.type_id == RefState.type_id && LeftState.id == RefState.id)
  27. ME = sqrt(RefState.chain.Nsites * 0.25) * (1.0 - 2.0*RefState.base.Mdown/RefState.chain.Nsites);
  28. else ME = exp(real(ln_Sz_ME (RefState, LeftState)));
  29. }
  30. else if (whichDSF == 'p')
  31. ME = exp(real(ln_Smin_ME (LeftState, RefState)));
  32. else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
  33. if (is_nan(ME)) ME = 0.0;
  34. // Do the momentum business:
  35. int iKout = LeftState.iK - RefState.iK;
  36. while(iKout < 0) iKout += RefState.chain.Nsites;
  37. while(iKout >= RefState.chain.Nsites) iKout -= RefState.chain.Nsites;
  38. DAT_outfile << setprecision(16);
  39. // Print information to fstream:
  40. if (iKout >= iKmin && iKout <= iKmax) {
  41. if (whichDSF == 'Z') {
  42. DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.base.Mdown - RefState.base.Mdown) * Chem_Pot << "\t"
  43. << iKout << "\t"
  44. << LeftState.base_id << "\t" << LeftState.type_id << "\t" << LeftState.id;
  45. }
  46. else {
  47. DAT_outfile << endl << LeftState.E - RefState.E - (LeftState.base.Mdown - RefState.base.Mdown) * Chem_Pot << "\t"
  48. << iKout << "\t"
  49. << ME << "\t"
  50. << LeftState.base_id << "\t" << LeftState.type_id << "\t" << LeftState.id;
  51. }
  52. } // if iKmin <= iKout <= iKmax
  53. // Calculate and return the data_value:
  54. DP data_value = ME * ME;
  55. if (whichDSF == 'Z') // use 1/(1 + omega)
  56. data_value = 1.0/(1.0 + LeftState.E - RefState.E - (LeftState.base.Mdown - RefState.base.Mdown) * Chem_Pot);
  57. else if (fixed_iK) // data value is MEsq * omega:
  58. data_value = ME * ME * (LeftState.E - RefState.E - (LeftState.base.Mdown - RefState.base.Mdown) * Chem_Pot);
  59. return(data_value);
  60. }
  61. } // namespace ABACUS