98 wiersze
4.0 KiB
C++
98 wiersze
4.0 KiB
C++
/**********************************************************
|
|
|
|
This software is part of J.-S. Caux's ABACUS library.
|
|
|
|
Copyright (c).
|
|
|
|
-----------------------------------------------------------
|
|
|
|
File: LiebLin_DSF_GeneralState.cc
|
|
|
|
Purpose: function for ABACUS++ for LiebLin gas, on general states
|
|
|
|
***********************************************************/
|
|
|
|
#include "JSC.h"
|
|
|
|
using namespace std;
|
|
using namespace JSC;
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
|
|
if (argc != 11) { // provide some info
|
|
|
|
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
|
cout << endl << "Usage of LiebLin_DSF_Tgt0 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 << "char* defaultScanStatename:\t\t file [].Ix2 contains the quantum numbers defining the AveragingState; used as defaultScanStatename" << endl;
|
|
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
|
//cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
|
|
cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << endl;
|
|
cout << "DP target_sumrule \t sumrule saturation you're satisfied with" << endl;
|
|
cout << "bool refine \t\t Is this a refinement of earlier calculations ? (0 == false, 1 == true)" << endl;
|
|
cout << endl << "EXAMPLE: " << endl << endl;
|
|
cout << "LiebLin_DSF d 1.0 100.0 100 0 200 0.56 600 1.0 0" << endl << endl;
|
|
}
|
|
|
|
else { // (argc == 10), correct nr of arguments
|
|
int n = 1;
|
|
char whichDSF = *argv[n++];
|
|
DP c_int = atof(argv[n++]);
|
|
DP L = atof(argv[n++]);
|
|
int N = atoi(argv[n++]);
|
|
char* Ix2filenameprefix = argv[n++];
|
|
int iKmin = atoi(argv[n++]);
|
|
int iKmax = atoi(argv[n++]);
|
|
//DP kBT = atof(argv[n++]);
|
|
int Max_Secs = atoi(argv[n++]);
|
|
DP target_sumrule = atof(argv[n++]);
|
|
bool refine = (atoi(argv[n++]) == 1);
|
|
|
|
// Read the Ix2 from the file:
|
|
Vect<int> Ix2_input(N);
|
|
ifstream Ix2_input_file;
|
|
stringstream filenamestrstream;
|
|
filenamestrstream << Ix2filenameprefix;
|
|
string defaultScanStatename = filenamestrstream.str();
|
|
filenamestrstream << ".Ix2";
|
|
string filenamestr = filenamestrstream.str();
|
|
const char* filename_Cstr = filenamestr.c_str();
|
|
Ix2_input_file.open(filename_Cstr);
|
|
if (Ix2_input_file.fail()) {
|
|
cout << filename_Cstr << endl;
|
|
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
|
}
|
|
for (int i = 0; i < N; ++i) {
|
|
Ix2_input_file >> Ix2_input[i];
|
|
//cout << i << "\t" << Ix2_input[i] << endl;
|
|
}
|
|
|
|
// Now define the AveragingState
|
|
LiebLin_Bethe_State AveragingState(c_int, L, N);
|
|
AveragingState.Ix2 = Ix2_input;
|
|
AveragingState.Compute_All(true);
|
|
|
|
//cout << "Averaging state: " << AveragingState << endl;
|
|
|
|
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine, 0, 1);
|
|
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine);
|
|
|
|
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
|
// int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors)
|
|
// Simplified function call of the above:
|
|
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
|
// int Max_Secs, DP target_sumrule, bool refine)
|
|
Scan_LiebLin (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine);
|
|
|
|
}
|
|
|
|
return(0);
|
|
}
|
|
|