|
@@ -0,0 +1,116 @@
|
|
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: Heis_Fourier_to_Sqt.cc
|
|
10
|
+
|
|
11
|
+Purpose: Fourier transform to q and t-dependent correlator for Heis
|
|
12
|
+
|
|
13
|
+***********************************************************/
|
|
14
|
+
|
|
15
|
+#include "ABACUS.h"
|
|
16
|
+
|
|
17
|
+using namespace std;
|
|
18
|
+using namespace ABACUS;
|
|
19
|
+
|
|
20
|
+int main(int argc, char* argv[])
|
|
21
|
+{
|
|
22
|
+ if (argc != 10) { // Print out instructions
|
|
23
|
+ cout << "Usage of Heis_Fourier_to_Sqt executable: " << endl << endl;
|
|
24
|
+ cout << "Provide arguments using one of the following options:" << endl << endl;
|
|
25
|
+ cout << "whichDSF Delta N M iKmin iKmax devmax Npts_t tmax" << endl << endl;
|
|
26
|
+ }
|
|
27
|
+
|
|
28
|
+ else {
|
|
29
|
+ int index = 1;
|
|
30
|
+ char whichDSF = *argv[index++];
|
|
31
|
+ DP Delta = atof(argv[index++]);
|
|
32
|
+ int N = atoi(argv[index++]);
|
|
33
|
+ int M = atoi(argv[index++]);
|
|
34
|
+ int iKmin = atoi(argv[index++]);
|
|
35
|
+ int iKmax = atoi(argv[index++]);
|
|
36
|
+ DP devmax = atof(argv[index++]);
|
|
37
|
+ int Npts_t = atoi(argv[index++]);
|
|
38
|
+ DP tmax = atof(argv[index++]);
|
|
39
|
+
|
|
40
|
+ stringstream filenameprefix;
|
|
41
|
+ Data_File_Name (filenameprefix, whichDSF, Delta, N, M, iKmin, iKmax, 0.0, 0, "");
|
|
42
|
+ string prefix = filenameprefix.str();
|
|
43
|
+
|
|
44
|
+ stringstream RAW_stringstream; string RAW_string;
|
|
45
|
+ RAW_stringstream << prefix << ".raw";
|
|
46
|
+ RAW_string = RAW_stringstream.str(); const char* RAW_Cstr = RAW_string.c_str();
|
|
47
|
+
|
|
48
|
+ ifstream RAW_infile;
|
|
49
|
+ RAW_infile.open(RAW_Cstr);
|
|
50
|
+ if (RAW_infile.fail()) {
|
|
51
|
+ cout << RAW_Cstr << endl;
|
|
52
|
+ ABACUSerror("Could not open RAW_infile... ");
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ RecMat<complex<DP> > FT(Npts_t + 1, iKmax - iKmin + 1);
|
|
56
|
+
|
|
57
|
+ DP omega;
|
|
58
|
+ int iK;
|
|
59
|
+ DP FF;
|
|
60
|
+ DP dev;
|
|
61
|
+ string label;
|
|
62
|
+
|
|
63
|
+ // Now define time coordinates: between 0 and tmax
|
|
64
|
+ Vect_DP tlattice(Npts_t + 1);
|
|
65
|
+ for (int i = 0; i <= Npts_t; ++i) tlattice[i] = i * tmax/Npts_t;
|
|
66
|
+
|
|
67
|
+ while (RAW_infile.peek() != EOF) {
|
|
68
|
+ RAW_infile >> omega >> iK >> FF >> dev >> label;
|
|
69
|
+ for (int it = 0; it < Npts_t; ++it)
|
|
70
|
+ FT[it][iK] += FF * FF * exp(II * omega * tlattice[it]);
|
|
71
|
+ }
|
|
72
|
+ RAW_infile.close();
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+ // Output to files:
|
|
76
|
+
|
|
77
|
+ Write_K_File (N, iKmin, iKmax);
|
|
78
|
+ Write_Time_File (Npts_t + 1, 0.0, tmax);
|
|
79
|
+
|
|
80
|
+ stringstream FTre_stringstream; string FTre_string;
|
|
81
|
+ FTre_stringstream << prefix << "_Sqt_tmin_" << 0 << "_tmax_" << tmax << "_Nt_" << Npts_t << ".dat_re";
|
|
82
|
+ FTre_string = FTre_stringstream.str(); const char* FTre_Cstr = FTre_string.c_str();
|
|
83
|
+ ofstream FTre_outfile;
|
|
84
|
+ FTre_outfile.open(FTre_Cstr);
|
|
85
|
+ if (FTre_outfile.fail()) ABACUSerror("Could not open FTre_outfile... ");
|
|
86
|
+
|
|
87
|
+ stringstream FTim_stringstream; string FTim_string;
|
|
88
|
+ FTim_stringstream << prefix << "_Sqt_tmin_" << 0 << "_tmax_" << tmax << "_Nt_" << Npts_t << ".dat_im";
|
|
89
|
+ FTim_string = FTim_stringstream.str(); const char* FTim_Cstr = FTim_string.c_str();
|
|
90
|
+ ofstream FTim_outfile;
|
|
91
|
+ FTim_outfile.open(FTim_Cstr);
|
|
92
|
+ if (FTim_outfile.fail()) ABACUSerror("Could not open FTim_outfile... ");
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+ for (int iK = iKmin; iK <= iKmax; ++iK) {
|
|
96
|
+ FTre_outfile << setprecision(16);
|
|
97
|
+ FTim_outfile << setprecision(16);
|
|
98
|
+ if (iK > iKmin) {
|
|
99
|
+ FTre_outfile << endl;
|
|
100
|
+ FTim_outfile << endl;
|
|
101
|
+ }
|
|
102
|
+ FTre_outfile << real(FT[0][iK]);
|
|
103
|
+ FTim_outfile << real(FT[0][iK]);
|
|
104
|
+ for (int it = 1; it <= Npts_t; ++it) {
|
|
105
|
+ FTre_outfile << "\t" << real(FT[it][iK]);
|
|
106
|
+ FTim_outfile << "\t" << imag(FT[it][iK]);
|
|
107
|
+ }
|
|
108
|
+ }
|
|
109
|
+
|
|
110
|
+ FTre_outfile.close();
|
|
111
|
+ FTim_outfile.close();
|
|
112
|
+
|
|
113
|
+ }
|
|
114
|
+
|
|
115
|
+ return(0);
|
|
116
|
+}
|