A main function to calculate physical quqntities by TPQ method.
53 char sdt[D_FileNameMax];
54 char **sdt_phys, **sdt_norm, **sdt_flct;
63 tstruct.
tstart = time(NULL);
64 inv_temp = d_1d_allocate(
NumAve);
68 fprintf(
stdoutMPI,
"%s",
"###### Start: TPQCalculation. ######\n\n");
73 sdt_phys = (
char**)malloc(
sizeof(
char*)*
NumAve);
74 sdt_norm = (
char**)malloc(
sizeof(
char*)*
NumAve);
75 sdt_flct = (
char**)malloc(
sizeof(
char*)*
NumAve);
76 for (rand_i = 0; rand_i <
NumAve; rand_i++) {
77 sdt_phys[rand_i] = (
char*)malloc(
sizeof(
char)*D_FileNameMax);
78 sdt_norm[rand_i] = (
char*)malloc(
sizeof(
char)*D_FileNameMax);
79 sdt_flct[rand_i] = (
char*)malloc(
sizeof(
char)*D_FileNameMax);
80 sprintf(sdt_phys[rand_i],
"SS_rand%d.dat", rand_i);
81 sprintf(sdt_norm[rand_i],
"Norm_rand%d.dat", rand_i);
82 sprintf(sdt_flct[rand_i],
"Flct_rand%d.dat", rand_i);
85 fprintf(
stdoutMPI,
" rand_i / rand_max = %d / %d\n", 1, NumAve);
92 fprintf(
stdoutMPI,
"%s",
" Start: Input vector.\n");
93 sprintf(sdt,
"tmpvec_set%d_rank_%d.dat", rand_i,
myrank);
96 fprintf(stdout,
"A file of Inputvector does not exist.\n");
97 fprintf(stdout,
"Start to calculate in normal procedure.\n");
101 byte_size = fread(&i_max,
sizeof(
long int), 1, fp);
103 fprintf(stderr,
"Error: A file of Inputvector is incorrect.\n");
106 byte_size = fread(
v0,
sizeof(std::complex<double>), (X->
Bind.
Check.
idim_max + 1)*NumAve, fp);
108 fprintf(
stdoutMPI,
"%s",
" End : Input vector.\n");
115 if (iret != 0)
return -1;
118 if (byte_size == 0) printf(
"byte_size: %d \n", (
int)byte_size);
123 for (rand_i = 0; rand_i <
NumAve; rand_i++) {
125 fprintf(fp,
"%s",
" # inv_tmp, energy, phys_var, phys_doublon, phys_num, step_i\n");
131 fprintf(fp,
"%s",
" # inv_temp, global_norm, global_1st_norm, step_i \n");
137 fprintf(fp,
"%s",
" # inv_temp, N, N^2, D, D^2, Sz, Sz^2, step_i \n");
158 for (rand_i = 0; rand_i <
NumAve; rand_i++) {
159 inv_temp[rand_i] = 0.0;
161 fprintf(fp,
"%.16lf %.16lf %.16lf %.16lf %.16lf %d\n",
169 fprintf(fp,
"%.16lf %.16lf %.16lf %d\n",
181 if (iret != 0)
return -1;
184 for (rand_i = 0; rand_i <
NumAve; rand_i++) {
187 fprintf(fp,
"%.16lf %.16lf %.16lf %.16lf %.16lf %d\n",
195 fprintf(fp,
"%.16lf %.16lf %.16lf %d\n",
202 fprintf(fp,
"%.16lf %.16lf %.16lf %.16lf %.16lf %.16lf %.16lf %d\n",
233 if (iret != 0)
return -1;
238 if (iret != 0)
return -1;
244 if (iret != 0)
return -1;
247 for (rand_i = 0; rand_i <
NumAve; rand_i++) {
250 fprintf(fp,
"%.16lf %.16lf %.16lf %.16lf %.16lf %d\n",
259 fprintf(fp,
"%.16lf %.16lf %.16lf %d\n",
267 fprintf(fp,
"%.16lf %.16lf %.16lf %.16lf %.16lf %.16lf %.16lf %d\n",
280 fprintf(
stdoutMPI,
"%s",
" Start: Output vector.\n");
281 sprintf(sdt,
"tmpvec_set%d_rank_%d.dat", 0,
myrank);
290 fprintf(
stdoutMPI,
"%s",
" End : Output vector.\n");
293 fprintf(
stdoutMPI,
"%s",
"###### End : TPQCalculation. ######\n\n");
295 tstruct.tend = time(NULL);
296 fprintf(
stdoutMPI,
"Finish: Elapsed time is %d [s].\n", (
int)(tstruct.tend - tstruct.tstart));
297 free_d_1d_allocate(inv_temp);
299 for (rand_i = 0; rand_i <
NumAve; rand_i++) {
300 free(sdt_phys[rand_i]);
301 free(sdt_norm[rand_i]);
302 free(sdt_flct[rand_i]);
double * doublon
Expectation value of the Doublon.
void exitMPI(int errorcode)
MPI Abortation wrapper.
struct DefineList Def
Definision of system (Hamiltonian) etc.
double * var
Expectation value of the Energy variance.
int St
0 or 1, but it affects nothing.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
int expec_cisajscktaltdc(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec)
Parent function to calculate two-body green's functions.
int childfopenALL(const char *_cPathChild, const char *_cmode, FILE **_fp)
All processes open file in output/ directory.
int expec_energy_flct(struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Parent function to calculate expected values of energy and physical quantities.
int Multiply(struct BindStruct *X)
Function of calculating the i-th step norm as and update the i+1-th wave vector as for TPQ calculat...
std::complex< double > ** v0
double * num2
Expectation value of the quare of the number of electrons.
struct PhysList Phys
Physical quantities.
double * Sz2
Expectation value of the Square of total Sz.
std::complex< double > ** v1
double * Sz
Expectation value of the Total Sz.
int NsiteMPI
Total number of sites, differ from DefineList::Nsite.
int TimeKeeperWithRandAndStep(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int irand, const int istep)
Functions for writing a time log.
double * num
Expectation value of the Number of electrons.
int Lanczos_max
Maximum number of iterations.
double * energy
Expectation value of the total energy.
int FirstMultiply(struct BindStruct *X)
Multiplication at the first step for TPQ mode ( is the random or inputted vector).
int myrank
Process ID, defined in InitializeMPI()
int expec_cisajs(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec)
function of calculation for one body green's function
void StopTimer(int n)
function for calculating elapse time [elapse time=StartTimer-StopTimer]
int istep
Index of TPQ step ???
double * doublon2
Expectation value of the Square of doublon.
struct CheckList Check
Size of the Hilbert space.
long int idim_max
The dimension of the Hilbert space of this process.
struct BindStruct Bind
Binded struct.
void StartTimer(int n)
function for initializing elapse time [start]
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.