ABACUS/src/UTILS/K_and_Omega_Files.cc

92 lines
2.1 KiB
C++

/**********************************************************
This software is part of J.-S. Caux's ABACUS library.
Copyright (c) J.-S. Caux.
-----------------------------------------------------------
File: K_and_Omega_Files.cc
Purpose: Utilities: momentum and frequency files.
***********************************************************/
#include "ABACUS.h"
using namespace std;
namespace ABACUS {
void Write_K_File (DP Length, int iKmin, int iKmax)
{
stringstream K_file;
string K_file_string;
K_file << "K_Length_" << Length << "_iKmin_" << iKmin << "_iKmax_" << iKmax << ".dat";
K_file_string = K_file.str();
const char* K_file_Cstr = K_file_string.c_str();
ofstream outfile_K;
outfile_K.open(K_file_Cstr);
outfile_K.setf(ios::fixed);
outfile_K.setf(ios::showpoint);
outfile_K.precision(16);
for (int iK = iKmin; iK <= iKmax; ++iK) outfile_K << 2.0*PI * iK/Length << endl;
outfile_K.close();
return;
}
void Write_Omega_File (int Nout_omega, DP omegamin, DP omegamax)
{
stringstream w_file;
string w_file_string;
w_file << "Omega_ommin_" << omegamin << "_ommax_" << omegamax << "_Nom_" << Nout_omega << ".dat";
w_file_string = w_file.str();
const char* w_file_Cstr = w_file_string.c_str();
ofstream outfile_w;
outfile_w.open(w_file_Cstr);
outfile_w.setf(ios::fixed);
outfile_w.setf(ios::showpoint);
outfile_w.precision(16);
for (int iw = 0; iw < Nout_omega; ++iw) outfile_w << omegamin + (iw + 0.5) * (omegamax - omegamin)/Nout_omega << endl;
outfile_w.close();
return;
}
void Write_Time_File (int Nt, DP tmin, DP tmax)
{
stringstream t_file;
string t_file_string;
t_file << "t_tmin_" << tmin << "_tmax_" << tmax << "_Nt_" << Nt << ".dat";
t_file_string = t_file.str();
const char* t_file_Cstr = t_file_string.c_str();
ofstream outfile_t;
outfile_t.open(t_file_Cstr);
outfile_t.setf(ios::fixed);
outfile_t.setf(ios::showpoint);
outfile_t.precision(16);
for (int it = 0; it <= Nt; ++it) outfile_t << tmin + it * (tmax - tmin)/Nt << endl;
outfile_t.close();
return;
}
} // namespace ABACUS