/********************************************************** This software is part of J.-S. Caux's ABACUS. library. Copyright (c) J.-S. Caux. ----------------------------------------------------------- File: ABACUS_TBA.h Purpose: Thermodynamic Bethe Ansatz general functions ***********************************************************/ #ifndef ABACUS_TBA_H #define ABACUS_TBA_H #include "ABACUS.h" namespace ABACUS { struct Root_Density { int Npts; // how many points are used to describe each function DP lambdamax; // what the largest rapidity is Vect_DP lambda; // rapidity vector Vect_DP dlambda; // differential element Vect_DP value; // the root density itself Vect_DP prev_value; // results of previous iteration DP diff; // relative differences with previous iteration bool value_infty_set; // boolean, true if asymptotic value set DP value_infty; // asymptotic value, computed analytically Root_Density (); Root_Density (int Npts_ref, DP lambdamax_ref); Root_Density& operator= (const Root_Density& RefDensity); void Save (const char* outfile_Cstr); DP Return_Value (DP lambda_ref); // evaluates the function for any argument using linear interpolation void Set_Asymptotics (DP value_infty_ref); // sets value for lambda >= lambdamax Root_Density Compress_and_Match_Densities (DP comp_factor); // returns a Root_Density with fewer points }; struct Root_Density_Set { int ntypes; Vect epsilon; int Npts_total; // sum of all Npts of epsilon's DP diff; // sum of diff's of the epsilon's Root_Density_Set (); Root_Density_Set (int ntypes_ref, int Npts_ref, DP lambdamax_ref); Root_Density_Set (int ntypes_ref, Vect_INT Npts_ref, Vect_DP lambdamax_ref); Root_Density_Set& operator= (const Root_Density_Set& RefSet); void Insert_new_function (DP asymptotic_value); void Extend_limits (Vect need_to_extend_limit); void Insert_new_points (Vect > need_new_point_around); DP Return_Value (int n_ref, DP lambda_ref); // returns a value, no matter what. Root_Density_Set Return_Compressed_and_Matched_Set (DP comp_factor); void Match_Densities (Root_Density_Set& RefSet); void Save (const char* outfile_Cstr); }; struct LiebLin_TBA_Solution { DP c_int; DP mu; DP kBT; DP nbar; DP ebar; // mean energy, \int d\lambda \lambda^2 \rho (\lambda) DP sbar; // entropy per unit length Root_Density epsilon; Root_Density depsilon_dmu; Root_Density rho; Root_Density rhoh; LiebLin_TBA_Solution (DP c_int_ref, DP mu_ref, DP kBT_ref, DP req_diff, int Max_Secs); }; // Functions defined in TBA_LiebLin.cc Root_Density LiebLin_rho_GS (DP c_int, DP k_F, DP lambdamax, int Npts, DP req_prec); DP Density_GS (Root_Density& rho_GS); DP k_F_given_n (DP c_int, DP n, DP lambdamax, int Npts, DP req_prec); Root_Density LiebLin_Z_GS (DP c_int, DP k_F, DP lambdamax, int Npts, DP req_prec); Root_Density LiebLin_Fbackflow_GS (DP c_int, DP k_F, DP lambdamax, DP lambda, int Npts, DP req_prec); // epsilon for a given mu: Root_Density LiebLin_epsilon_TBA (DP c_int, DP mu, DP kBT, DP req_diff, int Max_Secs); // depsilon/dmu for a given mu: Root_Density LiebLin_depsilon_dmu_TBA (DP c_int, DP mu, DP kBT, DP req_diff, int Max_Secs, const Root_Density& epsilon); Root_Density LiebLin_rho_TBA (DP kBT, const Root_Density& epsilon, const Root_Density& depsilon_dmu); Root_Density LiebLin_rhoh_TBA (DP kBT, const Root_Density& epsilon, const Root_Density& depsilon_dmu); DP LiebLin_nbar_TBA (const Root_Density& rho); DP LiebLin_ebar_TBA (const Root_Density& rho); DP LiebLin_sbar_TBA (const Root_Density& rho, const Root_Density& rhoh); LiebLin_TBA_Solution LiebLin_TBA_Solution_fixed_nbar (DP c_int, DP nbar_required, DP kBT, DP req_diff, int Max_Secs); LiebLin_TBA_Solution LiebLin_TBA_Solution_fixed_nbar_ebar (DP c_int, DP nbar_required, DP ebar_required, DP req_diff, int Max_Secs); LiebLin_Bethe_State Discretized_LiebLin_Bethe_State (DP c_int, DP L, int N, const Root_Density& rho); // Functions defined in TBA_XXZ.cc DP XXZ_phi1_kernel (DP zeta, DP lambda); DP XXZ_phi2_kernel (DP zeta, DP lambda); DP XXZ_a1_kernel (DP sinzeta, DP coszeta, DP lambda); DP XXZ_da1dlambda_kernel (DP sinzeta, DP coszeta, DP lambda); DP XXZ_a2_kernel (DP sin2zeta, DP cos2zeta, DP lambda); Root_Density XXZ_rhotot_GS (DP Delta, DP B, DP lambdamax, int Npts, DP req_prec); DP Return_GS_Sz_tot_value (DP B, Root_Density& rhotot_GS); Root_Density XXZ_eps_GS (DP Delta, DP Hz, DP lambdamax, int Npts, DP req_prec); Root_Density XXZ_depsdlambda_GS (DP Delta, DP B, DP lambdamax, int Npts, DP req_prec); Root_Density XXZ_b2BB_lambda_B (DP Delta, DP B, DP lambdamax, int Npts, DP req_prec); Root_Density XXZ_b2BB_lambda_lambdap (DP Delta, DP B, DP lambdap, DP lambdamax, int Npts, DP req_prec); Root_Density XXZ_Kbackflow_GS (DP Delta, DP B, DP lambdamax, DP lambda_p, DP lambda_h, int Npts, DP req_prec); Root_Density XXZ_Fbackflow_GS (DP Delta, DP B, DP lambdamax, DP lambda_p, DP lambda_h, int Npts, DP req_prec); Root_Density XXZ_Z_GS (DP Delta, DP B, DP lambdamax, int Npts, DP req_prec); // Defined in TBA_2CBG.cc: struct TBA_Data_2CBG { DP c_int; DP mu; DP Omega; DP kBT; DP f; // Gibbs free energy DP n1; // first population DP n2; // second population }; // Defined in src/TBA_2CBG.cc: TBA_Data_2CBG Solve_2CBG_TBAE_via_refinements (DP c_int, DP mu, DP Omega, DP kBT, int Max_Secs, bool Save_data); // Defined in src/TBA_2CBG.cc: void Scan_2CBG_TBAE (DP c_int, DP mu_min, DP mu_max, int Nmu, DP Omega_min, DP Omega_max, int NOmega, DP kBT_min, DP kBT_max, int NkBT, int Max_Secs); } // namespace ABACUS #endif