123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- /**********************************************************
-
- This software is part of J.-S. Caux's ABACUS library.
-
- Copyright (c) J.-S. Caux.
-
- -----------------------------------------------------------
-
- File: LiebLin_Fourier_to_t_equal_x.cc
-
- Purpose: Fourier transform to static space correlator for LiebLin.
-
- ***********************************************************/
-
- #include "ABACUS.h"
-
- using namespace std;
- using namespace ABACUS;
-
-
- int main(int argc, char* argv[])
- {
- if (argc != 10) { // 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 << "DP kBT \t\t Temperature" << 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 == 10), 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]);
- DP kBT = atof(argv[7]);
- int Npts_t = atoi(argv[8]);
- DP t_max = atof(argv[9]);
-
- // Momentum business: use symmetry
- if (iKmin != 0) ABACUSerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
-
- stringstream filenameprefix;
- Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
- string prefix = filenameprefix.str();
-
- stringstream RAW_stringstream; string RAW_string;
- RAW_stringstream << prefix << ".raw";
- RAW_string = RAW_stringstream.str(); const char* RAW_Cstr = RAW_string.c_str();
- ifstream RAW_infile;
- RAW_infile.open(RAW_Cstr);
- if (RAW_infile.fail()) {
- cout << RAW_Cstr << endl;
- ABACUSerror("Could not open RAW_infile... ");
- }
-
- // We also read the f-sumrule file, to correct for missing intensity.
- stringstream FSR_stringstream; string FSR_string;
- FSR_stringstream << prefix << ".fsr";
- FSR_string = FSR_stringstream.str(); const char* FSR_Cstr = FSR_string.c_str();
- ifstream FSR_infile;
- FSR_infile.open(FSR_Cstr);
- if (FSR_infile.fail()) {
- cout << FSR_Cstr << endl;
- ABACUSerror("Could not open FSR_infile... ");
- }
-
- stringstream SFT_stringstream; string SFT_string;
- SFT_stringstream << prefix << ".tft";
- 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 TFT_outfile... ");
-
- // First compute the static structure factor from the RAW data:
-
- Vect_DP TSF(0.0, Npts_t);
-
- DP omega;
- int iK;
- DP FF;
- //int conv;
- DP dev;
- string label;
-
- // 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 + 0.5) * t_max/Npts_t;
-
- // Now the correlation at t:
- Vect<complex<DP> > FT(0.0, Npts_t);
- Vect_DP FTre(0.0, Npts_t);
- Vect_DP FTim(0.0, Npts_t);
-
- while (RAW_infile.peek() != EOF) {
- RAW_infile >> omega >> iK >> FF >> dev >> label;
- if (iK == 0)
- for (int it = 0; it < Npts_t; ++it)
- FT[it] += FF * FF * exp(II * omega * tlattice[it]);
- else
- for (int it = 0; it < Npts_t; ++it)
- FT[it] += 2.0 * FF * FF * exp(II * omega * tlattice[it]);
- }
- RAW_infile.close();
-
- // Reset proper normalization:
- for (int it = 0; it < Npts_t; ++it) {
- FTre[it] = real(FT[it]);
- FTim[it] = imag(FT[it]);
- }
-
- // Output to file:
- for (int it = 0; it < Npts_t; ++it) {
- if (it > 0) SFT_outfile << endl;
- SFT_outfile << tlattice[it] << "\t" << FTre[it] << "\t" << FTim[it];
- }
-
- SFT_outfile.close();
- }
-
- return(0);
-
- }
|