HPhi++  3.1.0
output_list.cpp
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.hpp"
17 #include "FileIO.hpp"
18 #include "wrapperMPI.hpp"
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", " 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 output_list(struct BindStruct *X)
Output list_1 for canonical ensembles.
Definition: output_list.cpp:40
int Ne
Number of electrons in this process.
Definition: struct.hpp:71
Bind.
Definition: struct.hpp:394
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