123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- /**********************************************************
-
- This software is part of J.-S. Caux's ABACUS library.
-
- Copyright (c) J.-S. Caux.
-
- -----------------------------------------------------------
-
- File: LiebLin_Fourier_to_x_t.cc
-
- Purpose: Fourier transform to spacetime correlator for LiebLin.
-
- ***********************************************************/
-
- #include "ABACUS.h"
-
- using namespace std;
- using namespace ABACUS;
-
-
- int main(int argc, char* argv[])
- {
- if (argc != 11) { // provide some info
-
- cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
- cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
- cout << endl << "Provide the following arguments:" << endl << endl;
- cout << "char whichDSF \t\t Which structure factor ? Options are: "
- "d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
- cout << "DP c_int \t\t Value of the interaction parameter" << endl;
- cout << "DP L \t\t\t Length of the system" << endl;
- cout << "int N \t\t\t Number of particles" << endl;
- cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers scanned over" << endl;
- cout << "RAW file name" << endl;
- cout << "int Npts_x Number of points in space for the Fourier transform" << endl;
- cout << "int Npts_t \t Number of points in time for the Fourier transform" << endl;
- cout << "DP t_max \t Max time to be used" << endl;
- }
-
- else { // (argc == 9), correct nr of arguments
- char whichDSF = *argv[1];
- DP c_int = atof(argv[2]);
- DP L = atof(argv[3]);
- int N = atoi(argv[4]);
- int iKmin = atoi(argv[5]);
- int iKmax = atoi(argv[6]);
- char* rawfilename = argv[7];
- int Npts_x = atoi(argv[8]);
- int Npts_t = atoi(argv[9]);
- DP t_max = atof(argv[10]);
-
- ifstream RAW_infile;
- RAW_infile.open(rawfilename);
- if (RAW_infile.fail()) {
- cout << rawfilename << endl;
- ABACUSerror("Could not open RAW_infile... ");
- }
-
- // Define the output file name: use the RAW file name but with different suffix
-
- stringstream SFT_stringstream; string SFT_string;
- SFT_stringstream << rawfilename << "_xtf_Nx_" << Npts_x << "_Nt_" << Npts_t << "_tmax_" << t_max;
- SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
- ofstream SFT_outfile;
- SFT_outfile.open(SFT_Cstr);
- if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
-
- DP omega;
- int iK;
- DP FF;
- DP dev;
- string label;
-
- // Define space coordinates: between 0 and L
- Vect_DP xlattice(Npts_x);
- for (int i = 0; i < Npts_x; ++i) xlattice[i] = i * L/Npts_x;
-
- // Now define time coordinates: between 0 and t_max
- Vect_DP tlattice(Npts_t);
- for (int i = 0; i < Npts_t; ++i) tlattice[i] = i * t_max/Npts_t;
-
- RecMat<complex<DP> > FT(0.0, Npts_x, Npts_t);
- DP twopioverL = twoPI/L;
- DP FFsq;
- complex<DP> exp_ik, exp_miomega;
- while (RAW_infile.peek() != EOF) {
- RAW_infile >> omega >> iK >> FF >> dev >> label;
- FFsq = FF * FF;
- exp_ik = exp(II * (iK * twopioverL));
- exp_miomega = exp(-II * omega);
- for (int ix = 0; ix < Npts_x; ++ix)
- for (int it = 0; it < Npts_t; ++it)
- //FT[ix][it] += FF * FF * exp(II * (iK * twopioverL * xlattice[ix] - omega * tlattice[it]));
- FT[ix][it] = FFsq * pow(exp_ik, xlattice[ix]) * pow(exp_miomega, tlattice[it]);
- }
- RAW_infile.close();
-
- // Reset proper normalization:
- // for (int ix = 0; ix < Npts_x; ++ix)
- // for (int it = 0; it < Npts_t; ++it)
- // FT[ix][it] *= twopioverL;
-
- // Output to file:
- for (int ix = 0; ix < Npts_x; ++ix) {
- if (ix > 0) SFT_outfile << endl;
- for (int it = 0; it < Npts_t; ++it)
- SFT_outfile << FT[ix][it] << "\t";
- }
-
- SFT_outfile.close();
- }
-
- return(0);
-
- }
|