HΦ  3.2.0
output_list.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 "output_list.h"
17 #include "FileIO.h"
18 #include "wrapperMPI.h"
19 
40 int output_list(struct BindStruct *X){
41 
42  FILE *fp;
43  char sdt[D_FileNameMax];
44  int i,i_max;
45 
46  fprintf(stdoutMPI, "%s", cProStartOutputList);
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, cFileNameListModel, 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", cProEndOutputList);
71  return 0;
72 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
unsigned long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.h:303
const char * cProStartOutputList
#define D_FileNameMax
Definition: global.h:23
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.c:27
unsigned int Nup
Number of spin-up electrons in this process.
Definition: struct.h:58
const char * cProEndOutputList
const char * cFileNameListModel
Definition: global.c:48
unsigned int Ndown
Number of spin-down electrons in this process.
Definition: struct.h:59
Bind.
Definition: struct.h:409
unsigned int Nsite
Number of sites in the INTRA process region.
Definition: struct.h:56
long unsigned int * list_1
Definition: global.h:47
unsigned int Ne
Number of electrons in this process.
Definition: struct.h:71
struct EDMainCalStruct X
Definition: struct.h:432
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.h:198
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
int output_list(struct BindStruct *X)
Output list_1 for canonical ensembles.
Definition: output_list.c:40
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165