ABACUS/src/EXECS/LiebLin_Moses_tester.cc

80 lines
2.6 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 != 8) { // 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 << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << 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]);
int Nl = atoi(argv[5]);
int DIl = atoi(argv[6]);
int DIr = atoi(argv[7]);
if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in LiebLin_Moses_tester");
// Define the Moses state:
LiebLin_Bethe_State MosesState (c_int, L, N);
// Split the sea:
for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] -= 2 * DIl;
for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
MosesState.Compute_All (true);
LiebLin_Bethe_State estate = MosesState;
cout << MosesState;
int Ix2old, Ix2new;
int again = 0;
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.Compute_All(false);
cout << estate;
cout << setprecision(16) << "omega = " << estate.E - MosesState.E << "\t"
<< exp(real(ln_Density_ME(MosesState, estate))) << endl;
cout << "Another try ? (0 == no)" << endl;
cin >> again;
} while (again != 0);
}
return(0);
}