99 строки
3.6 KiB
C++
99 строки
3.6 KiB
C++
/**********************************************************
|
|
|
|
This software is part of J.-S. Caux's ABACUS library.
|
|
|
|
Copyright (c) J.-S. Caux.
|
|
|
|
-----------------------------------------------------------
|
|
|
|
File: Smoothen_LiebLin_DSF_over_Ensemble.cc
|
|
|
|
Purpose: produces .dsf and .ssf files from an ensemble of .raw files
|
|
|
|
***********************************************************/
|
|
|
|
#include "ABACUS.h"
|
|
|
|
using namespace std;
|
|
using namespace ABACUS;
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
if (argc != 13) { // Print out instructions
|
|
|
|
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
|
cout << endl << "Usage of Smoothen_LiebLin_DSF_over_Ensemble 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" << endl;
|
|
cout << "DP L \t\t\t Length of the system" << endl;
|
|
cout << "int N \t\t\t Number of particles" << endl;
|
|
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers" << endl;
|
|
cout << "DP kBT \t\t Temperature" << endl;
|
|
cout << "int DiK \t\t\t Window of iK over which DSF is averaged (DiK == 0 means a single iK is used; "
|
|
"DiK == 1 means 3 are used (iK-1, iK, iK+1), etc.)" << 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;
|
|
cout << endl << "EXAMPLE: " << endl << endl;
|
|
cout << "Smoothen_LiebLin_DSF_over_Ensemble d 1.0 100.0 100 0 200 5.0 1 0.0 10.0 500 2.0" << endl << endl;
|
|
|
|
}
|
|
|
|
else if (argc == 13) {
|
|
char whichDSF = *argv[1];
|
|
DP c_int = atof(argv[2]);
|
|
DP L = atof(argv[3]);
|
|
int N = atoi(argv[4]);
|
|
int iKmin = atoi(argv[5]);
|
|
int iKmax = atoi(argv[6]);
|
|
DP kBT = atof(argv[7]);
|
|
int DiK = atoi(argv[8]);
|
|
DP ommin = atof(argv[9]);
|
|
DP ommax = atof(argv[10]);
|
|
int Nom = atoi(argv[11]);
|
|
DP width = atof(argv[12]);
|
|
|
|
stringstream filenameprefix;
|
|
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
|
string prefix = filenameprefix.str();
|
|
|
|
DP normalization = twoPI * L;
|
|
DP denom_sum_K = L;
|
|
|
|
Write_K_File (L, iKmin, iKmax);
|
|
Write_Omega_File (Nom, ommin, ommax);
|
|
|
|
// Read the weights from the ensembles file:
|
|
LiebLin_Diagonal_State_Ensemble ensemble;
|
|
|
|
stringstream ensfilestrstream;
|
|
ensfilestrstream << "LiebLin_c_int_" << c_int << "_L_" << L << "_N_" << N << "_kBT_" << kBT << ".ens";
|
|
string ensfilestr = ensfilestrstream.str();
|
|
const char* ensfile_Cstr = ensfilestr.c_str();
|
|
|
|
ensemble.Load(c_int, L, N, ensfile_Cstr);
|
|
|
|
// Define the raw file names
|
|
Vect<string> rawfilename(ensemble.nstates);
|
|
|
|
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
|
// Define the raw input file name:
|
|
stringstream filenameprefix;
|
|
Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
|
string prefix = filenameprefix.str();
|
|
stringstream RAW_stringstream; string RAW_string;
|
|
RAW_stringstream << prefix << ".raw";
|
|
rawfilename[ns] = RAW_stringstream.str();
|
|
}
|
|
|
|
Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK, 0.0,
|
|
ommin, ommax, Nom, width, normalization, denom_sum_K);
|
|
|
|
}
|
|
|
|
return(0);
|
|
}
|