16 #include "CalcSpectrumByTPQ.h" 17 #include "Lanczos_EigenValue.h" 19 #include "wrapperMPI.h" 21 #include "common/setmemory.h" 50 double dene, dHvar, dn, ddoublon;
55 fprintf(stderr,
" Error: SS_rand%d.dat does not exist.\n", X->
Bind.
Def.
irand);
60 while(
fgetsMPI(ctmp2, 256, fp) != NULL) {
61 sscanf(ctmp2,
"%lf %lf %lf %lf %lf %d\n",
74 *temp = 1.0/dinv_temp;
75 *specificHeat = (dHvar-dene*dene)*(dinv_temp*dinv_temp);
93 double ene,
double *tmp_E,
int Nsite,
int idim_max,
double complex * dc_tmpSpec)
97 double factor, pre_factor;
98 pre_factor=2.0*dtemp*dtemp*dspecificheat;
99 factor=M_PI*pre_factor;
100 factor=1.0/sqrt(factor);
103 if(cimag(dcomega)>0) {
104 for (l = 1; l <= idim_max; l++) {
107 tmp_dcSpec += (double)(
vec[l][1] * conj(
vec[l][1])) * exp(-pow((creal(dcomega) - tmp_E[l] + ene),2)/(pre_factor));
111 fprintf(stderr,
" an imarginary part of omega must be positive.\n");
115 *dc_tmpSpec = tmp_dcSpec;
132 double complex *tmp_v1,
135 double complex *dcSpectrum,
136 double complex *dcomega
140 unsigned long int i, i_max;
144 unsigned long int liLanczosStp_vec=0;
145 double dene, dtemp, dspecificHeat;
147 double complex dctmp_Spectrum;
158 fprintf(
stdoutMPI,
" Start: Input vectors for recalculation.\n");
165 byte_size = fread(&liLanczosStp_vec,
sizeof(liLanczosStp_vec),1,fp);
166 byte_size = fread(&i_max,
sizeof(
long int), 1, fp);
168 fprintf(stderr,
"Error: A size of Inputvector is incorrect.\n");
174 fprintf(
stdoutMPI,
" End: Input vectors for recalculation.\n");
176 if (byte_size == 0) printf(
"byte_size: %d \n", (
int)byte_size);
195 fprintf(
stdoutMPI,
" Error: Fail to read TMcomponents\n");
204 if(liLanczosStp_vec !=liLanczosStp){
205 fprintf(
stdoutMPI,
" Error: Input files for vector and TMcomponents are incoorect.\n");
206 fprintf(
stdoutMPI,
" Error: Input vector %ld th stps, TMcomponents %ld th stps.\n", liLanczosStp_vec, liLanczosStp);
221 fprintf(
stdoutMPI,
" Start: Calculate tridiagonal matrix components.\n");
229 fprintf(
stdoutMPI,
" End: Calculate tridiagonal matrix components.\n\n");
235 tmp_E = d_1d_allocate(stp + 1);
238 fprintf(
stdoutMPI,
" Start: Caclulate spectrum from tridiagonal matrix components.\n");
240 for( i = 0 ; i < Nomega; i++) {
247 dcSpectrum[i] = dnorm * dctmp_Spectrum;
249 fprintf(
stdoutMPI,
" End: Caclulate spectrum from tridiagonal matrix components.\n\n");
252 free_d_1d_allocate(tmp_E);
256 fprintf(
stdoutMPI,
" Start: Output vectors for recalculation.\n");
263 fwrite(&liLanczosStp,
sizeof(liLanczosStp),1,fp);
269 fprintf(
stdoutMPI,
" End: Output vectors for recalculation.\n");
int childfopenALL(const char *_cPathChild, const char *_cmode, FILE **_fp)
All processes open file in output/ directory.
int irand
Input keyword TargetTPQRand ???
void exitMPI(int errorcode)
MPI Abortation wrapper.
struct DefineList Def
Definision of system (Hamiltonian) etc.
unsigned long int idim_max
The dimension of the Hilbert space of this process.
int ReadTPQData(struct EDMainCalStruct *X, double *ene, double *temp, double *specificHeat)
Read TPQ data at "X->Bind.Large.itr" step in SS_rand file.
struct LargeList Large
Variables for Matrix-Vector product.
int Lanczos_GetTridiagonalMatrixComponents(struct BindStruct *X, double *_alpha, double *_beta, double complex *tmp_v1, unsigned long int *liLanczos_step)
Calculate tridiagonal matrix components by Lanczos method.
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
const char * cFileNameOutputRestartVec
unsigned int nvec
Read from Calcmod in readdef.h.
const char * c_OutputSpectrumRecalcvecEnd
unsigned int Nsite
Number of sites in the INTRA process region.
int CalcSpectrumByTPQ(struct EDMainCalStruct *X, double complex *tmp_v1, double dnorm, int Nomega, double complex *dcSpectrum, double complex *dcomega)
A main function to calculate spectrum by TPQ (Note: This method is trial)
int Lanczos_restart
Number of iterations performed in the restart computation.
const char * c_InputSpectrumRecalcvecStart
const char * c_GetTridiagonalStart
const char * c_CalcSpectrumFromTridiagonalEnd
int GetCalcSpectrumTPQ(double complex dcomega, double dtemp, double dspecificheat, double ene, double *tmp_E, int Nsite, int idim_max, double complex *dc_tmpSpec)
Calculate spectrum function from the TPQ state.
const char * cFileNameTimeKeep
const char * c_InputSpectrumRecalcvecEnd
void vec12(double alpha[], double beta[], unsigned int ndim, double tmp_E[], struct BindStruct *X)
Diagonalize a tri-diagonal matrix and store eigenvectors into vec.
int OutputTMComponents(struct BindStruct *X, double *_alpha, double *_beta, double _dnorm, int liLanczosStp)
Output tridiagonal matrix components obtained by the Lanczos method.
int myrank
Process ID, defined in InitializeMPI()
int iFlgCalcSpec
Input parameter CalcSpec in teh CalcMod file.
const char * cFileNameSSRand
const char * c_CalcSpectrumFromTridiagonalStart
const char * c_GetTridiagonalEnd
char * fgetsMPI(char *InputString, int maxcount, FILE *fp)
MPI file I/O (get a line, fgets) wrapper. Only the root node (myrank = 0) reads and broadcast string...
int ReadTMComponents(struct BindStruct *X, double *_dnorm, unsigned long int *_i_max, int iFlg)
Read tridiagonal matrix components obtained by the Lanczos method. .
const char * c_OutputSpectrumRecalcvecStart
struct CheckList Check
Size of the Hilbert space.
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green's function.
struct BindStruct Bind
Binded struct.
int TimeKeeper(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType)
Functions for writing a time log.
unsigned int Lanczos_max
Maximum number of iterations.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()