This commit is contained in:
J.-S. Caux 2019-12-02 11:42:43 +01:00
rodzic 7e56ef6a6c
commit 8793035aa1
8 zmienionych plików z 41 dodań i 39 usunięć

Wyświetl plik

@ -150,9 +150,9 @@ namespace ABACUS {
void Sort_RAW_File (const char ffsq_file[], char optionchar, char whichDSF);
// Functions for data interpretation:
DP Smoothen_RAW_into_SF (std::string prefix, int iKmin, int iKmax, int DiK,
DP Smoothen_RAW_into_SF (std::string prefix, int iKmin, int iKmax, int DiK, DP devmax,
DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K);
DP Smoothen_RAW_into_SF (std::string prefix, Vect<std::string> rawfilename, Vect<DP> weight, int iKmin, int iKmax, int DiK,
DP Smoothen_RAW_into_SF (std::string prefix, Vect<std::string> rawfilename, Vect<DP> weight, int iKmin, int iKmax, int DiK, DP devmax,
DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K);
void Write_K_File (DP Length, int iKmin, int iKmax);
void Write_Omega_File (int Nout_omega, DP omegamin, DP omegamax);

Wyświetl plik

@ -23,23 +23,25 @@ int main(int argc, char* argv[])
if (argc != 13 && argc != 14) { // Print out instructions
cout << "Usage of Smoothen_Heis_DSF executable: " << endl << endl;
cout << "Provide arguments using one of the following options:" << endl << endl;
cout << "1) (for general momenta) whichDSF Delta N M iKmin iKmax DiK kBT ommin ommax Nom gwidth" << endl << endl;
cout << "2) (for fixed momentum) whichDSF Delta N M iKneeded ommin ommax Nom gwidth" << endl << endl;
cout << "1) (for general momenta) whichDSF Delta N M iKmin iKmax DiK devmax kBT ommin ommax Nom gwidth" << endl << endl;
cout << "2) (for fixed momentum) whichDSF Delta N M iKneeded devmax ommin ommax Nom gwidth" << endl << endl;
}
else if (argc == 13) { // !fixed_iK
char whichDSF = *argv[1];
DP Delta = atof(argv[2]);
int N = atoi(argv[3]);
int M = atoi(argv[4]);
int iKmin = atoi(argv[5]);
int iKmax = atoi(argv[6]);
int DiK = atoi(argv[7]);
DP kBT = atof(argv[8]);
DP ommin = atof(argv[9]);
DP ommax = atof(argv[10]);
int Nom = atoi(argv[11]);
DP gwidth = atof(argv[12]);
else if (argc == 14) { // !fixed_iK
int index = 1;
char whichDSF = *argv[index++];
DP Delta = atof(argv[index++]);
int N = atoi(argv[index++]);
int M = atoi(argv[index++]);
int iKmin = atoi(argv[index++]);
int iKmax = atoi(argv[index++]);
int DiK = atoi(argv[index++]);
DP devmax = atof(argv[index++]);
DP kBT = atof(argv[index++]);
DP ommin = atof(argv[index++]);
DP ommax = atof(argv[index++]);
int Nom = atoi(argv[index++]);
DP gwidth = atof(argv[index++]);
stringstream filenameprefix;
Data_File_Name (filenameprefix, whichDSF, Delta, N, M, iKmin, iKmax, kBT, 0, "");
@ -52,7 +54,7 @@ int main(int argc, char* argv[])
Write_Omega_File (Nom, ommin, ommax);
DP sumcheck;
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, gwidth, normalization, denom_sum_K);
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, devmax, ommin, ommax, Nom, gwidth, normalization, denom_sum_K);
}

Wyświetl plik

@ -69,7 +69,7 @@ int main(int argc, char* argv[])
// We use the scaled width function as default:
DP sumcheck;
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, 0.0, ommin, ommax, Nom, width, normalization, denom_sum_K);
}
/*
@ -97,7 +97,7 @@ int main(int argc, char* argv[])
int iKmin = iKneeded;
int iKmax = iKneeded;
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, gwidth, normalization) << endl;
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, 0.0, ommin, ommax, Nom, gwidth, normalization) << endl;
}
*/

Wyświetl plik

@ -76,7 +76,7 @@ int main(int argc, char* argv[])
// We use the scaled width function as default:
DP sumcheck;
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, 0.0, ommin, ommax, Nom, width, normalization, denom_sum_K);
}
/*
@ -104,7 +104,7 @@ int main(int argc, char* argv[])
int iKmin = iKneeded;
int iKmax = iKneeded;
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, gwidth, normalization) << endl;
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, 0.0, ommin, ommax, Nom, gwidth, normalization) << endl;
}
*/

Wyświetl plik

@ -81,7 +81,7 @@ int main(int argc, char* argv[])
// We use the scaled width function as default:
DP sumcheck;
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, 0.0, ommin, ommax, Nom, width, normalization, denom_sum_K);
}
return(0);

Wyświetl plik

@ -89,7 +89,7 @@ int main(int argc, char* argv[])
rawfilename[ns] = RAW_stringstream.str();
}
Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK,
Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK, 0.0,
ommin, ommax, Nom, width, normalization, denom_sum_K);
}

Wyświetl plik

@ -45,7 +45,7 @@ int main(int argc, char* argv[])
DP normalization = twoPI;
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax,
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, 0.0, ommin, ommax,
Nom, gwidth, normalization) << endl;
Write_K_File (N, iKmin, iKmax);
@ -74,7 +74,7 @@ int main(int argc, char* argv[])
int iKmin = iKneeded;
int iKmax = iKneeded;
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax,
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, 0.0, ommin, ommax,
Nom, gwidth, normalization) << endl;
}

Wyświetl plik

@ -19,7 +19,7 @@ using namespace ABACUS;
namespace ABACUS {
DP Smoothen_RAW_into_SF (string prefix, int iKmin, int iKmax, int DiK,
DP Smoothen_RAW_into_SF (string prefix, int iKmin, int iKmax, int DiK, DP devmax,
DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K)
{
// ommax is omega max for .dsf file, Nom is the number of omega slots used.
@ -69,7 +69,7 @@ namespace ABACUS {
while (RAW_infile.peek() != EOF) {
RAW_infile >> omega >> iK >> FF >> dev >> label;
if (iK >= iKmin && iK <= iKmax && fabs(omega) > 1.0e-8) { // remove connected part of DSF
if (iK >= iKmin && iK <= iKmax && dev < devmax && fabs(omega) > 1.0e-8) { // remove connected part of DSF
for (int deltaiK = -DiK; deltaiK <= DiK; ++deltaiK)
if (iK + deltaiK >= iKmin && iK + deltaiK <= iKmax)
SSF[iK + deltaiK - iKmin] += Kweight[abs(deltaiK)] * FF * FF;
@ -104,7 +104,7 @@ namespace ABACUS {
stringstream DSF_stringstream; string DSF_string;
DSF_stringstream << prefix;
if (DiK > 0) DSF_stringstream << "_DiK_" << DiK;
DSF_stringstream << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".dsf";
DSF_stringstream << "_devmax_" << devmax << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".dsf";
DSF_string = DSF_stringstream.str(); const char* DSF_Cstr = DSF_string.c_str();
ofstream DSF_outfile;
@ -121,7 +121,7 @@ namespace ABACUS {
stringstream SSF_stringstream; string SSF_string;
SSF_stringstream << prefix;
if (DiK > 0) SSF_stringstream << "_DiK_" << DiK;
SSF_stringstream << ".ssf";
SSF_stringstream << "_devmax_" << devmax << ".ssf";
SSF_string = SSF_stringstream.str(); const char* SSF_Cstr = SSF_string.c_str();
ofstream SSF_outfile;
@ -136,7 +136,7 @@ namespace ABACUS {
stringstream ASF_stringstream; string ASF_string;
ASF_stringstream << prefix;
ASF_stringstream << prefix << "_devmax_" << devmax;
ASF_stringstream << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".asf";
ASF_string = ASF_stringstream.str(); const char* ASF_Cstr = ASF_string.c_str();
@ -167,7 +167,7 @@ namespace ABACUS {
}
// This is the same function as above, but now using data for a diagonal ensemble of states
DP Smoothen_RAW_into_SF (string prefix, Vect<string> rawfilename, Vect<DP> weight, int iKmin, int iKmax, int DiK,
DP Smoothen_RAW_into_SF (string prefix, Vect<string> rawfilename, Vect<DP> weight, int iKmin, int iKmax, int DiK, DP devmax,
DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K)
{
// ommax is omega max for .dsf file, Nom is the number of omega slots used.
@ -217,7 +217,7 @@ namespace ABACUS {
while (RAW_infile.peek() != EOF) {
RAW_infile >> omega >> iK >> FF >> dev >> label;
if (iK >= iKmin && iK <= iKmax && fabs(omega) > 1.0e-8) { // remove connected part of DSF)
if (iK >= iKmin && iK <= iKmax && dev < devmax && fabs(omega) > 1.0e-8) { // remove connected part of DSF)
SSF[iK - iKmin] += weight[ns] * FF * FF;
for (int iomega = 0; iomega < Nom; ++iomega)
if (big_gwidth_used > (d_omega = fabs(omegaout[iomega] - omega))) {
@ -252,7 +252,7 @@ namespace ABACUS {
DSF_stringstream << prefix;
DSF_stringstream << "_ns_" << weight.size();
if (DiK > 0) DSF_stringstream << "_DiK_" << DiK;
DSF_stringstream << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".dsf";
DSF_stringstream << "_devmax_" << devmax << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".dsf";
DSF_string = DSF_stringstream.str(); const char* DSF_Cstr = DSF_string.c_str();
ofstream DSF_outfile;
@ -269,7 +269,7 @@ namespace ABACUS {
stringstream SSF_stringstream; string SSF_string;
SSF_stringstream << prefix;
SSF_stringstream << "_ns_" << weight.size();
SSF_stringstream << ".ssf";
SSF_stringstream << "_devmax_" << devmax << ".ssf";
SSF_string = SSF_stringstream.str(); const char* SSF_Cstr = SSF_string.c_str();
ofstream SSF_outfile;
@ -286,7 +286,7 @@ namespace ABACUS {
stringstream ASF_stringstream; string ASF_string;
ASF_stringstream << prefix;
ASF_stringstream << "_ns_" << weight.size();
ASF_stringstream << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".asf";
ASF_stringstream << "_devmax_" << devmax << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".asf";
ASF_string = ASF_stringstream.str(); const char* ASF_Cstr = ASF_string.c_str();
ofstream ASF_outfile;
@ -317,7 +317,7 @@ namespace ABACUS {
DP Smoothen_RAW_into_ASF (string prefix, int iKmin, int iKmax, DP ommin, DP ommax, int Nom, DP gwidth,
DP Smoothen_RAW_into_ASF (string prefix, int iKmin, int iKmax, DP devmax, DP ommin, DP ommax, int Nom, DP gwidth,
DP normalization, DP denom_sum_K)
{
// ommax is omega max for .asf file, Nom is the number of omega slots used.
@ -355,7 +355,7 @@ namespace ABACUS {
while (RAW_infile.peek() != EOF) {
RAW_infile >> omega >> iK >> FF >> dev >> label;
if (iK >= iKmin && iK <= iKmax && fabs(omega) > 1.0e-8) { // remove connected part of DSF)
if (iK >= iKmin && iK <= iKmax && dev < devmax && fabs(omega) > 1.0e-8) { // remove connected part of DSF)
for (int iomega = 0; iomega < Nom; ++iomega)
if (big_gwidth_used > (d_omega = fabs(omegaout[iomega] - omega)))
ASF[iomega] += FF * FF * exp(-d_omega*d_omega * oneovertwowidthsq);
@ -373,7 +373,7 @@ namespace ABACUS {
stringstream ASF_stringstream; string ASF_string;
ASF_stringstream << prefix;
//if (iKmax != iKmin) DSF_stringstream << "_iKmin_" << iKmin << "_iKmax_" << iKmax;
ASF_stringstream << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".asf";
ASF_stringstream << "_devmax_" << devmax << "_ommin_"<< ommin << "_ommax_" << ommax << "_Nom_" << Nom << "_w_" << gwidth << ".asf";
ASF_string = ASF_stringstream.str(); const char* ASF_Cstr = ASF_string.c_str();
ofstream ASF_outfile;