63 lines
1.4 KiB
C++
63 lines
1.4 KiB
C++
/**********************************************************
|
|
|
|
This software is part of J.-S. Caux's ABACUS library.
|
|
|
|
Copyright (c) J.-S. Caux.
|
|
|
|
-----------------------------------------------------------
|
|
|
|
File: Filter_RAW_File_for_iK.cc
|
|
|
|
Purpose: for a given RAW file, keep only the momentum iK entries
|
|
|
|
***********************************************************/
|
|
|
|
#include "ABACUS.h"
|
|
|
|
using namespace std;
|
|
|
|
|
|
namespace ABACUS {
|
|
|
|
void Filter_RAW_File_for_iK (const char ff_file[], int iKneeded)
|
|
{
|
|
DP omega;
|
|
int iK;
|
|
DP ff;
|
|
DP dev;
|
|
string label;
|
|
|
|
ifstream infile;
|
|
infile.open(ff_file);
|
|
|
|
if (infile.fail()) ABACUSerror("The input file was not opened successfully in Sort_RAW_File. ");
|
|
|
|
stringstream outfilename;
|
|
string outfilename_string;
|
|
outfilename << ff_file << "_iK_" << iKneeded;
|
|
outfilename_string = outfilename.str();
|
|
const char* outfilename_c_str = outfilename_string.c_str();
|
|
|
|
ofstream outfile;
|
|
outfile.open(outfilename_c_str);
|
|
outfile.precision(16);
|
|
|
|
int Ndata = 0;
|
|
while ((infile.peek()) != EOF) {
|
|
|
|
infile >> omega;
|
|
infile >> iK;
|
|
infile >> ff;
|
|
infile >> dev;
|
|
infile >> label;
|
|
|
|
if (iK == iKneeded) outfile << endl << omega << "\t" << iK << "\t" << ff << "\t" << dev << "\t" << label;
|
|
}
|
|
infile.close();
|
|
outfile.close();
|
|
|
|
return;
|
|
}
|
|
|
|
} // namespace ABACUS
|