115 linhas
3.5 KiB
C++
115 linhas
3.5 KiB
C++
/**********************************************************
|
|
|
|
This software is part of J.-S. Caux's ABACUS library.
|
|
|
|
Copyright (c) J.-S. Caux.
|
|
|
|
-----------------------------------------------------------
|
|
|
|
File: LiebLin_Catalogue_Fixed_c_k_Nscaling.cc
|
|
|
|
Purpose: Produces sets of data files for correlations, increasing system size at fixed c and momentum.
|
|
|
|
***********************************************************/
|
|
|
|
#include <omp.h>
|
|
#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_Catalogue_Fixed_c_k_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 kfact \t\t momentum factor: momemntum will be set to kfact * kF/4" << 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 Hrs \t\t Allowed computational time (hours)" << endl;
|
|
cout << "int Mns \t\t Allowed computational time (minutes)" << endl;
|
|
}
|
|
|
|
else { // correct nr of arguments
|
|
int ia = 1;
|
|
char whichDSF = *argv[ia++];
|
|
DP c_int = atof(argv[ia++]);
|
|
int kfact = atoi(argv[ia++]);
|
|
DP kBT = atof(argv[ia++]);
|
|
DP target_sumrule = atof(argv[ia++]);
|
|
int Max_Secs = 3600*atoi(argv[ia++]) + 60*atoi(argv[ia++]);
|
|
|
|
double StartTime = omp_get_wtime();
|
|
|
|
double ActualTime = omp_get_wtime();
|
|
|
|
int Secs_left = Max_Secs;
|
|
|
|
int iN = 0;
|
|
|
|
int nN = 16;
|
|
Vect<int> Nv(nN);
|
|
// Multiples of 32 up to 256
|
|
for (int i = 1; i <= 8; ++i) Nv[i-1] = 32*i;
|
|
// Then steps of 64 up to 512
|
|
for (int i = 1; i <= 4; ++i) Nv[7+i] = 256 + 64*i;
|
|
// Then steps of 128 up to 1024
|
|
for (int i = 1; i <= 4; ++i) Nv[11+i] = 512 + 128*i;
|
|
|
|
for (int iN = 0; iN < nN; ++iN) {
|
|
|
|
int N = Nv[iN];
|
|
DP L = N;
|
|
int iKmin = (kfact * N)/8;
|
|
int iKmax = iKmin;
|
|
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();
|
|
|
|
ActualTime = omp_get_wtime();
|
|
Secs_left = int(Max_Secs - (ActualTime - StartTime));
|
|
|
|
if (srsat < target_sumrule && Secs_left > Max_Secs/2)
|
|
// Improve the icmin calculation by one chunk:
|
|
Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Secs_left, target_sumrule, refine);
|
|
|
|
ActualTime = omp_get_wtime();
|
|
|
|
Secs_left = int(Max_Secs - (ActualTime - StartTime));
|
|
cout << "Done with N = " << N << ". Time left = " << Secs_left << " seconds." << endl;
|
|
|
|
if (Secs_left < 60) {
|
|
cout << "Breaking out after N = " << N << " since time left = " << Secs_left << endl;
|
|
break;
|
|
}
|
|
|
|
} // while there is time
|
|
|
|
} // else if arguments given OK
|
|
|
|
return(0);
|
|
}
|