HΦ  3.2.0
CalcByFullDiag.c
Go to the documentation of this file.
1 /* HPhi - Quantum Lattice Model Simulator */
2 /* Copyright (C) 2015 The University of Tokyo */
3 
4 /* This program is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU General Public License as published by */
6 /* the Free Software Foundation, either version 3 of the License, or */
7 /* (at your option) any later version. */
8 
9 /* This program is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU General Public License for more details. */
13 
14 /* You should have received a copy of the GNU General Public License */
15 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 #include "CalcByFullDiag.h"
17 #include "input.h"
18 #include "wrapperMPI.h"
19 #include "CalcTime.h"
20 
25 
27  struct EDMainCalStruct *X
28  )
29 {
30  int iret=0;
31  fprintf(stdoutMPI, "%s", cLogFullDiag_SetHam_Start);
32  StartTimer(5100);
33  if(X->Bind.Def.iInputHam==FALSE){
34  makeHam(&(X->Bind));
35  }
36  else if(X->Bind.Def.iInputHam==TRUE){
37  fprintf(stdoutMPI, "%s", cLogFullDiag_InputHam_Start);
38  inputHam(&(X->Bind));
39  fprintf(stdoutMPI, "%s", cLogFullDiag_InputHam_End);
40  }
41  StopTimer(5100);
42  fprintf(stdoutMPI, "%s", cLogFullDiag_SetHam_End);
43  if(iret != 0) return FALSE;
44 
45 
46  if(X->Bind.Def.iOutputHam == TRUE){
48  StartTimer(5500);
49  iret=outputHam(&(X->Bind));
50  StopTimer(5500);
51  fprintf(stdoutMPI, "%s", cLogFullDiag_OutputHam_End);
52  if(iret != 0) return FALSE;
53  return TRUE;
54  }
55 
56  fprintf(stdoutMPI, "%s", cLogFullDiag_Start);
57  StartTimer(5200);
58  iret=lapack_diag(&(X->Bind));
59  StopTimer(5200);
60  fprintf(stdoutMPI, "%s", cLogFullDiag_End);
61  if(iret != 0) return FALSE;
62 
63  X->Bind.Def.St=0;
65  StartTimer(5300);
66  phys(&(X->Bind), X->Bind.Check.idim_max);
67  StopTimer(5300);
68  fprintf(stdoutMPI, "%s", cLogFullDiag_ExpecValue_End);
69 
70  StartTimer(5400);
71  iret=output(&(X->Bind));
72  StopTimer(5400);
73  fprintf(stdoutMPI, "%s", cLogFinish);
74  if(iret != 0) return FALSE;
75 
76  return TRUE;
77 }
int iInputHam
Definition: struct.h:205
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
int St
0 or 1, but it affects nothing.
Definition: struct.h:80
void StartTimer(int n)
function for initializing elapse time [start]
Definition: time.c:71
const char * cLogFullDiag_Start
unsigned long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.h:303
int output(struct BindStruct *X)
output function for FullDiag mode
Definition: output.c:27
void StopTimer(int n)
function for calculating elapse time [elapse time=StartTimer-StopTimer]
Definition: time.c:83
const char * cLogFullDiag_ExpecValue_Start
int lapack_diag(struct BindStruct *X)
performing full diagonalization using lapack
Definition: lapack_diag.c:35
void phys(struct BindStruct *X, unsigned long int neig)
A main function to calculate physical quantities by full diagonalization method.
Definition: phys.c:48
const char * cLogFullDiag_SetHam_Start
const char * cLogFullDiag_SetHam_End
int makeHam(struct BindStruct *X)
Making Hamiltonian for the full diagonalization method. The Hamiltonian is stored in the two dimensio...
Definition: makeHam.c:55
#define TRUE
Definition: global.h:26
Bind.
Definition: struct.h:419
const char * cLogFullDiag_End
const char * cLogFullDiag_ExpecValue_End
int inputHam(struct BindStruct *X)
Definition: input.c:20
int CalcByFullDiag(struct EDMainCalStruct *X)
Parent function for FullDiag mode.
const char * cLogFullDiag_InputHam_Start
const char * cLogFullDiag_OutputHam_End
int outputHam(struct BindStruct *X)
output Hamiltonian only used for FullDiag mode
Definition: output.c:73
#define FALSE
Definition: global.h:25
const char * cLogFinish
struct EDMainCalStruct X
Definition: struct.h:432
const char * cLogFullDiag_OutputHam_Start
int iOutputHam
Definition: struct.h:204
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
const char * cLogFullDiag_InputHam_End
struct BindStruct Bind
Binded struct.
Definition: struct.h:420
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165