HPhi++  3.1.0
output_list.cpp File Reference

Output list_1 for canonical ensembles obtained in sz.cpp. More...

#include "output_list.hpp"
#include "FileIO.hpp"
#include "wrapperMPI.hpp"

Go to the source code of this file.

Functions

int output_list (struct BindStruct *X)
 Output list_1 for canonical ensembles. More...
 

Detailed Description

Output list_1 for canonical ensembles obtained in sz.cpp.

Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition in file output_list.cpp.

Function Documentation

◆ output_list()

int output_list ( struct BindStruct X)

Output list_1 for canonical ensembles.

Parameters
X[in] Struct to get the dimension of the target Hilbert space and the information for making the output file name.
Return values
-1fail to output the list.
0success to output the list.
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 40 of file output_list.cpp.

References BindStruct::Check, childfopenMPI(), BindStruct::Def, DefineList::iCalcModel, CheckList::idim_max, list_1, DefineList::Ndown, DefineList::Ne, DefineList::Nsite, DefineList::Nup, and stdoutMPI.

Referenced by main().

40  {
41 
42  FILE *fp;
43  char sdt[D_FileNameMax];
44  int i,i_max;
45 
46  fprintf(stdoutMPI, "%s", " Start: output list. \n");
47  i_max=X->Check.idim_max;
48  switch(X->Def.iCalcModel){
49  case HubbardGC:
50  case Hubbard:
51  case Spin:
52  case SpinGC:
53  sprintf(sdt, "ListForModel_Ns%d_Nup%dNdown%d.dat", X->Def.Nsite,X->Def.Nup,X->Def.Ndown);
54  break;
55  case Kondo:
56  case KondoGC:
57  sprintf(sdt, "ListForKondo_Ns%d_Ncond%d", X->Def.Nsite,X->Def.Ne);
58  break;
59  default:
60  return -1;
61  }
62  if(childfopenMPI(sdt,"w",&fp)!=0){
63  return -1;
64  }
65  for(i=1;i<=i_max;i++){
66  fprintf(fp," %lu \n",list_1[i]);
67  }
68  fclose(fp);
69 
70  fprintf(stdoutMPI, "%s", " End : output list. \n");
71  return 0;
72 }
int Nup
Number of spin-up electrons in this process.
Definition: struct.hpp:58
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
int Ne
Number of electrons in this process.
Definition: struct.hpp:71
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.hpp:200
int Ndown
Number of spin-down electrons in this process.
Definition: struct.hpp:59
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
long int * list_1
Definition: global.cpp:25
long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.hpp:305
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.cpp:27