Browse Source

Add S(q,t) executable for Heis

master
J.-S. Caux 4 years ago
parent
commit
aec7c206da
4 changed files with 142 additions and 1 deletions
  1. 2
    1
      Makefile
  2. 1
    0
      include/ABACUS_Scan.h
  3. 116
    0
      src/EXECS/Heis_Fourier_to_Sqt.cc
  4. 23
    0
      src/UTILS/K_and_Omega_Files.cc

+ 2
- 1
Makefile View File

@@ -25,7 +25,7 @@ BINDIR = $(BASEDIR)bin/
25 25
 # Set the compiler choice
26 26
 #CXX = g++
27 27
 #CXX = /usr/local/bin/g++
28
-CXX = /usr/local/Cellar/gcc@7/7.4.0/bin/g++-7
28
+CXX = /usr/local/Cellar/gcc@7/7.5.0/bin/g++-7
29 29
 # On OS X, using a separate installation of llvm tools:
30 30
 # CXX = /usr/local/opt/llvm/bin/clang++ -Xpreprocessor -fopenmp -lomp -L/usr/local/opt/llvm/lib:lib/ -I/usr/local/opt/llvm/include
31 31
 # CXX = clang++ -Weverything -ferror-limit=1
@@ -143,6 +143,7 @@ lib$(VERSION).a : $(Objects_ALL)
143 143
 	$(COMPILE) $(EXECSDIR)Heis_DSF.cc -o $(BINDIR)Heis_DSF -l$(VERSION)
144 144
 	$(COMPILE) $(EXECSDIR)Heis_DSF_GeneralState.cc -o $(BINDIR)Heis_DSF_GeneralState -l$(VERSION)
145 145
 	$(COMPILE) $(EXECSDIR)Smoothen_Heis_DSF.cc -o $(BINDIR)Smoothen_Heis_DSF -l$(VERSION)
146
+	$(COMPILE) $(EXECSDIR)Heis_Fourier_to_Sqt.cc -o $(BINDIR)Heis_Fourier_to_Sqt -l$(VERSION)
146 147
 	$(COMPILE) $(EXECSDIR)XXZ_gpd_StagSz_h0.cc -o $(BINDIR)XXZ_gpd_StagSz_h0 -l$(VERSION)
147 148
 #	$(COMPILE) $(EXECSDIR)ODSLF_DSF.cc -o $(BINDIR)ODSLF_DSF -l$(VERSION)
148 149
 #	$(COMPILE) $(EXECSDIR)Smoothen_ODSLF_DSF.cc -o $(BINDIR)Smoothen_ODSLF_DSF -l$(VERSION)

+ 1
- 0
include/ABACUS_Scan.h View File

@@ -156,6 +156,7 @@ namespace ABACUS {
156 156
 			   DP ommin, DP ommax, int Nom, DP gwidth, DP normalization, DP denom_sum_K);
157 157
   void Write_K_File (DP Length, int iKmin, int iKmax);
158 158
   void Write_Omega_File (int Nout_omega, DP omegamin, DP omegamax);
159
+  void Write_Time_File (int Nt, DP tmin, DP tmax);
159 160
   // Smoothen with gaussian width scaled with two-particle bandwidth
160 161
   DP Smoothen_RAW_into_SF_LiebLin_Scaled (std::string prefix, DP L, int N, int iKmin, int iKmax, int DiK, DP ommin, DP ommax, int Nom, DP width, DP normalization);
161 162
 

+ 116
- 0
src/EXECS/Heis_Fourier_to_Sqt.cc View File

@@ -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
+}

+ 23
- 0
src/UTILS/K_and_Omega_Files.cc View File

@@ -65,4 +65,27 @@ namespace ABACUS {
65 65
     return;
66 66
   }
67 67
 
68
+  void Write_Time_File (int Nt, DP tmin, DP tmax)
69
+  {
70
+    stringstream t_file;
71
+    string t_file_string;
72
+    t_file << "t_tmin_" << tmin << "_tmax_" << tmax << "_Nt_" << Nt <<  ".dat";
73
+    t_file_string = t_file.str();
74
+    const char* t_file_Cstr = t_file_string.c_str();
75
+
76
+    ofstream outfile_t;
77
+
78
+    outfile_t.open(t_file_Cstr);
79
+
80
+    outfile_t.setf(ios::fixed);
81
+    outfile_t.setf(ios::showpoint);
82
+    outfile_t.precision(16);
83
+
84
+    for (int it = 0; it <= Nt; ++it) outfile_t << tmin + it * (tmax - tmin)/Nt << endl;
85
+
86
+    outfile_t.close();
87
+
88
+    return;
89
+  }
90
+
68 91
 } // namespace ABACUS

Loading…
Cancel
Save