ABACUS/src/EXECS/LiebLin_DSF_tester_Ix2.cc

90 lines
3.2 KiB
C++

/**********************************************************
This software is part of J.-S. Caux's ABACUS library.
Copyright (c) J.-S. Caux.
-----------------------------------------------------------
File: LiebLin_DSF_tester.cc
Purpose: allows for Ix2 manipulations (user-prompted) for LiebLin gas
***********************************************************/
#include "ABACUS.h"
using namespace std;
using namespace ABACUS;
int main(int argc, char* argv[])
{
if (argc != 6) { // provide some info
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
cout << endl << "Provide the following arguments:" << endl << endl;
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: "
"d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
cout << endl << "EXAMPLE: " << endl << endl;
cout << "LiebLin_DSF_tester d 1.0 100.0 100 0.56 " << endl << endl;
}
else { // (argc == 6), correct nr of arguments
char whichDSF = *argv[1];
DP c_int = atof(argv[2]);
DP L = atof(argv[3]);
int N = atoi(argv[4]);
DP kBT = atof(argv[5]);
// Construct the finite-size saddle-point state:
LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT);
spstate.Compute_All(true);
LiebLin_Bethe_State estate = spstate;
if (whichDSF == 'o') estate = Remove_Particle_at_Center (spstate);
else if (whichDSF == 'g') estate = Add_Particle_at_Center (spstate);
if (whichDSF != 'd') estate.Compute_All(true);
cout << estate << endl;
Vect<int> OriginIx2 = estate.Ix2;
int Ix2old, Ix2new;
int again = 0;
string label_req;
do {
cout << "Substitute Ix2: which for which ?" << endl;
cin >> Ix2old >> Ix2new;
for (int i = 0; i < estate.N; ++i) if (estate.Ix2[i] == Ix2old) estate.Ix2[i] = Ix2new;
estate.Ix2.QuickSort();
//cout << "Which label should the exc state be set to?" << endl;
//cin >> label_req;
//estate.Set_to_Label(label_req, OriginIx2);
estate.Compute_All(false);
cout << spstate << endl;
cout << estate;
if (whichDSF == 'd')
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E
<< "\tME = " << real(exp(ln_Density_ME(spstate, estate))) << endl;
else if (whichDSF == 'o')
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E
<< "\tME = " << real(exp(ln_Psi_ME(estate, spstate))) << endl;
else if (whichDSF == 'g')
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E
<< "\tME = " << real(exp(ln_Psi_ME(spstate, estate))) << endl;
cout << "Another try ? (1 == yes, 0 == no)" << endl;
again = 1;
cin >> again;
} while (again != 0);
}
return(0);
}