ABACUS/src/EXECS/LiebLin_Catalogue_Fixed_c_k...

110 строки
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_Smoothen_DSF.cc
Purpose: Produces smoothened DSF for output from LiebLin_Catalogue_Fixed_c_k_Nscaling.cc
***********************************************************/
#include <omp.h>
#include "ABACUS.h"
using namespace std;
using namespace ABACUS;
int main(int argc, char* argv[])
{
if (argc != 10) { // provide some info
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
cout << endl << "Usage of LiebLin_Catalogue_Fixed_c_k_Nscaling_Smoothen_DSF 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 << "DP ommin" << endl << "DP ommax \t\t Min and max frequencies to cover in smoothened DSF" << endl;
cout << "Nom \t\t\t Number of frequency points used for discretization" << endl;
cout << "DP width \t\t Gaussian width used in smoothing, in units of two-particle level spacing" << 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 DiK = 1; // only do fixed momentum
DP ommin = atof(argv[ia++]);
DP ommax = atof(argv[ia++]);
int Nom = atoi(argv[ia++]);
DP width = atof(argv[ia++]);
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;
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;
}
else {
srcfile >> srsat;
}
srcfile.close();
if (srsat > target_sumrule) {
// Compute the DSF
stringstream filenameprefix;
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
string prefix = filenameprefix.str();
DP normalization = twoPI * L;
Write_K_File (L, iKmin, iKmax);
Write_Omega_File (Nom, ommin, ommax);
// We use the scaled width function as default:
DP sumcheck;
sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
}
} // for N
} // else if arguments given OK
return(0);
}