ABACUS/examples/ABACUS_Usage_Example_LiebLi...

109 řádky
3.2 KiB
C++

/**********************************************************
This software is part of J.-S. Caux's ABACUS library.
Copyright (c) J.-S. Caux.
-----------------------------------------------------------
File: ABACUS_Usage_Example_LiebLin.cc
Purpose: examples of calculations for Lieb-Liniger
***********************************************************/
#include "ABACUS.h"
using namespace std;
using namespace ABACUS;
int main()
{
clock_t StartTime = clock();
DP c_int = 25.0;
DP L = 50.0;
int N = 10;
DP nbar_required = 1.0;
DP kBT = 4.0;
int Npts = 4*N;
DP req_diff = 1.0e-4;
int Max_Secs = 60;
if (true) { // State-by-state checks
DP c_int = 25.0;
DP L = 50.0;
int N = 10;
LiebLin_Bethe_State gstate (c_int, L, N);
gstate.Compute_All(true);
cout << setprecision(16) << gstate << endl;
LiebLin_Bethe_State estate (c_int, L, N-1);
//estate.Set_to_ids (1LL, 1LL, 2LL, 0LL);
//estate.Set_to_Label ("64_2_028ysn1", gstate.Ix2);
//for (int i = 0; i < N; ++i) estate.Ix2[i] += 2;
// estate.Ix2[0] -= 8;
// estate.Ix2[1] -= 4;
// estate.Ix2[N-3] += 2;
// estate.Ix2[N-2] += 4;
// estate.Ix2[N-1] += 6;
// estate.Set_Label_from_Ix2(gstate.Ix2);
estate.Compute_All(true);
cout << setprecision(16) << estate << endl;
//Scan_LiebLin ('o', estate, "28_3_i3y55yf3", -2*N, 2*N, 60, 1.0e+6, 0, 0, 1);
//stringstream filenameprefix;
//Data_File_Name (filenameprefix, 'd', -2*N, 2*N, 0.0, estate, estate, "28_3_i3y55yf3");
//string prefix = filenameprefix.str();
DP ommin = 0.0; DP ommax = 10.0; DP gwidth = 1.0;// meaningless
int Nom = 10;
DP normalization = twoPI * L;
//Smoothen_RAW_into_SF (filenameprefix.str(), -2*N, 2*N, 0, ommin, ommax, Nom, gwidth, normalization, L);
//Density-density matrix elements:
// cout << setprecision(16) << "omega = " << estate.E - gstate.E << "\t"
// << exp(real(ln_Density_ME(gstate, estate))) << "\t" << exp(real(ln_Density_ME(estate, gstate))) << endl;
//Field operator matrix elements:
// cout << "omega\tiK\t< estate | Psi | gstate > matrix element:" << endl;
// cout << setprecision(16) << estate.E - gstate.E << "\t" << estate.iK - gstate.iK << "\t"
// << exp(ln_Psi_ME(estate, gstate)) << endl;
//LiebLin_Bethe_State flipstate = estate;
//flipstate.Parity_Flip();
//cout << "Flipping: " << endl;
//cout << "omega = " << flipstate.E - gstate.E << "\t" << exp(real(ln_Density_ME(gstate, flipstate))) << endl;
// Finite T checks:
DP kBT = 1.0;
// Delta is the number of sites involved in the smoothing of the entropy
//int Delta = int(sqrt(N))/2;//6;//N/20;
//DP epsilon = log(L)/L;
DP epsilon = log(L)/L;
// Construct the finite-size saddle-point state:
//LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT, Delta);
//LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT, epsilon);
//spstate.Compute_All(true);
//cout << spstate << endl;
}
clock_t StopTime = clock();
//cout << "Total time: " << (StopTime - StartTime)/*/CLOCKS_PER_SEC*/ << " hundreths of a second."
cout << "Total time: " << DP(StopTime - StartTime)/CLOCKS_PER_SEC << " seconds."
<< endl;
return(0);
}