|
@@ -0,0 +1,62 @@
|
|
1
|
+/**********************************************************
|
|
2
|
+
|
|
3
|
+This software is part of J.-S. Caux's ABACUS library.
|
|
4
|
+
|
|
5
|
+Copyright (c) J.-S. Caux.
|
|
6
|
+
|
|
7
|
+-----------------------------------------------------------
|
|
8
|
+
|
|
9
|
+File: Filter_RAW_File_for_iK.cc
|
|
10
|
+
|
|
11
|
+Purpose: for a given RAW file, keep only the momentum iK entries
|
|
12
|
+
|
|
13
|
+***********************************************************/
|
|
14
|
+
|
|
15
|
+#include "ABACUS.h"
|
|
16
|
+
|
|
17
|
+using namespace std;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+namespace ABACUS {
|
|
21
|
+
|
|
22
|
+ void Filter_RAW_File_for_iK (const char ff_file[], int iKneeded)
|
|
23
|
+ {
|
|
24
|
+ DP omega;
|
|
25
|
+ int iK;
|
|
26
|
+ DP ff;
|
|
27
|
+ DP dev;
|
|
28
|
+ string label;
|
|
29
|
+
|
|
30
|
+ ifstream infile;
|
|
31
|
+ infile.open(ff_file);
|
|
32
|
+
|
|
33
|
+ if (infile.fail()) ABACUSerror("The input file was not opened successfully in Sort_RAW_File. ");
|
|
34
|
+
|
|
35
|
+ stringstream outfilename;
|
|
36
|
+ string outfilename_string;
|
|
37
|
+ outfilename << ff_file << "_iK_" << iKneeded;
|
|
38
|
+ outfilename_string = outfilename.str();
|
|
39
|
+ const char* outfilename_c_str = outfilename_string.c_str();
|
|
40
|
+
|
|
41
|
+ ofstream outfile;
|
|
42
|
+ outfile.open(outfilename_c_str);
|
|
43
|
+ outfile.precision(16);
|
|
44
|
+
|
|
45
|
+ int Ndata = 0;
|
|
46
|
+ while ((infile.peek()) != EOF) {
|
|
47
|
+
|
|
48
|
+ infile >> omega;
|
|
49
|
+ infile >> iK;
|
|
50
|
+ infile >> ff;
|
|
51
|
+ infile >> dev;
|
|
52
|
+ infile >> label;
|
|
53
|
+
|
|
54
|
+ if (iK == iKneeded) outfile << endl << omega << "\t" << iK << "\t" << ff << "\t" << dev << "\t" << label;
|
|
55
|
+ }
|
|
56
|
+ infile.close();
|
|
57
|
+ outfile.close();
|
|
58
|
+
|
|
59
|
+ return;
|
|
60
|
+ }
|
|
61
|
+
|
|
62
|
+} // namespace ABACUS
|