107 lines
3.4 KiB
C++
107 lines
3.4 KiB
C++
/**********************************************************
|
|
|
|
This software is part of J.-S. Caux's ABACUS library.
|
|
|
|
Copyright (c) J.-S. Caux.
|
|
|
|
-----------------------------------------------------------
|
|
|
|
File: LiebLin_Data_Daemon_Nscaling.cc
|
|
|
|
Purpose: Produces sets of data files for correlations, increasing system size at fixed c and momentum window.
|
|
|
|
***********************************************************/
|
|
|
|
#include <omp.h>
|
|
#include "ABACUS.h"
|
|
|
|
using namespace std;
|
|
using namespace ABACUS;
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
|
|
if (argc != 9) { // provide some info
|
|
|
|
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
|
cout << endl << "Usage of LiebLin_Data_Daemon_Nscaling 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 << "int Nstep \t\t\t Steps to be taken in number of particles: use positive integer "
|
|
"values only. Filling will be set to 1 (L == N)" << endl;
|
|
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over "
|
|
"(in units of N == Nstep): recommended values: 0 and 2*N" << endl;
|
|
cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
|
|
cout << "DP target_sumrule \t sumrule saturation you're satisfied with" << endl;
|
|
cout << "int Max_minutes \t\t Allowed computational time: (in minutes)" << endl;
|
|
}
|
|
|
|
else { // (argc == 10), correct nr of arguments
|
|
int ia = 1;
|
|
char whichDSF = *argv[ia++];
|
|
DP c_int = atof(argv[ia++]);
|
|
int Nstep = atoi(argv[ia++]);
|
|
int iKmin_Nstep = atoi(argv[ia++]);
|
|
int iKmax_Nstep = atoi(argv[ia++]);
|
|
DP kBT = atof(argv[ia++]);
|
|
DP target_sumrule = atof(argv[ia++]);
|
|
int Max_minutes = atoi(argv[ia++]);
|
|
|
|
double StartTime = omp_get_wtime();
|
|
|
|
double ActualTime = omp_get_wtime();
|
|
|
|
int Secs_left = 60* Max_minutes;
|
|
|
|
int iN = 0;
|
|
|
|
while (Secs_left > 0) {
|
|
|
|
cout << "StartTime = " << StartTime << endl;
|
|
cout << "ActualTime = " << ActualTime << endl;
|
|
cout << "Secs_left = " << Secs_left << endl;
|
|
|
|
iN += 1;
|
|
int N = Nstep * iN;
|
|
DP L = N;
|
|
int iKmin = iKmin_Nstep * iN;
|
|
int iKmax = iKmax_Nstep * iN;
|
|
DP srsat = 0.0;
|
|
bool refine = false;
|
|
|
|
stringstream SRC_stringstream; string SRC_string;
|
|
Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
|
SRC_stringstream << ".src";
|
|
SRC_string = SRC_stringstream.str(); const char* SRC_Cstr = SRC_string.c_str();
|
|
|
|
fstream srcfile;
|
|
srcfile.open(SRC_Cstr, fstream::in);
|
|
if (srcfile.fail()) {
|
|
srsat = 0.0;
|
|
refine = false;
|
|
}
|
|
else {
|
|
srcfile >> srsat;
|
|
refine = true;
|
|
}
|
|
srcfile.close();
|
|
|
|
// Improve the icmin calculation by one chunk:
|
|
Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Secs_left, target_sumrule, refine);
|
|
|
|
ActualTime = clock();
|
|
|
|
Secs_left = int(60*Max_minutes - (ActualTime - StartTime));
|
|
|
|
cout << "Done with N = " << N << ". Time left = " << Secs_left << " seconds." << endl;
|
|
|
|
} // while there is time
|
|
|
|
} // else if arguments given OK
|
|
|
|
return(0);
|
|
}
|