20 #include "common/setmemory.h" 22 #include "wrapperMPI.h" 54 long unsigned int i,tmp_sdim;
55 int NLocSpn,NCond,Nup,Ndown;
56 long unsigned int u_tmp;
57 long unsigned int tmp;
58 long unsigned int Ns,comb_1,comb_2,comb_3,comb_sum, comb_up, comb_down;
62 long unsigned int idimmax=0;
63 long unsigned int idim=0;
64 long unsigned int isite=0;
89 comb = li_2d_allocate(Ns+1,Ns+1);
105 comb_sum= 2*comb_sum;
118 comb_sum=comb_up*comb_down;
121 case HubbardNConserved:
128 for(i=iMinup; i<= iAllup; i++){
131 comb_sum +=comb_up*comb_down;
154 for(u_loc=0;u_loc<=X->
Def.
Nup;u_loc++){
155 comb_1 =
Binomial(NLocSpn,u_loc,comb,Ns);
156 comb_2 =
Binomial(NCond,Nup-u_loc,comb,Ns);
157 comb_3 =
Binomial(NCond,Ndown+u_loc-NLocSpn,comb,Ns);
158 comb_sum += comb_1*comb_2*comb_3;
166 for(i=0;i<(2*NCond+NLocSpn);i++){
167 comb_sum= 2*comb_sum;
174 fprintf(stderr,
" 2Sz is incorrect.\n");
183 for(isite=0; isite<X->
Def.
Nsite;isite++){
188 #pragma omp parallel for default(none) reduction(+:comb_sum) private(tmp_sz, isite) firstprivate(idimmax, X) 189 for(idim=0; idim<idimmax; idim++){
191 for(isite=0; isite<X->
Def.
Nsite;isite++){
204 free_li_2d_allocate(comb);
215 case HubbardNConserved:
230 case HubbardNConserved:
245 case HubbardNConserved:
279 fprintf(
stdoutMPI,
" MAX DIMENSION idim_max=%ld \n",li_dim_max);
281 fprintf(
stdoutMPI,
" APPROXIMATE REQUIRED MEMORY max_mem=%lf GB \n",dmax_mem);
283 free_li_2d_allocate(comb);
286 fprintf(fp,
" MAX DIMENSION idim_max=%ld \n", li_dim_max);
287 fprintf(fp,
" APPROXIMATE REQUIRED MEMORY max_mem=%lf GB \n", dmax_mem);
303 case HubbardNConserved:
306 while(tmp <= X->Def.Nsite){
314 while(tmp <= X->Def.Nsite/2){
325 free_li_2d_allocate(comb);
331 free_li_2d_allocate(comb);
338 case HubbardNConserved:
355 free_li_2d_allocate(comb);
365 fprintf(fp,
"%ld %ld \n",i,u_tmp);
368 case HubbardNConserved:
374 fprintf(fp,
"%ld %ld \n",i,u_tmp);
382 fprintf(fp,
"%ld %ld \n",i,u_tmp);
387 fprintf(fp,
"%d %ld \n", 0, u_tmp);
391 fprintf(fp,
"%ld %ld \n",i,u_tmp);
400 fprintf(fp,
"%ld %ld \n",i,u_tmp);
405 fprintf(fp,
"%ld %ld \n",i,X->
Def.
Tpow[i]);
411 free_li_2d_allocate(comb);
struct DefineList Def
Definision of system (Hamiltonian) etc.
int GetSplitBitForGeneralSpin(const int Nsite, long unsigned int *ihfbit, const long int *SiteToBit)
function of getting right, left and half bits corresponding to a original space.
unsigned int NLocSpn
Number of local spins.
unsigned long int idim_max
The dimension of the Hilbert space of this process.
int Total2Sz
Total in this process.
double MaxMPI_d(double dvalue)
MPI wrapper function to obtain maximum Double across processes.
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
unsigned int Nup
Number of spin-up electrons in this process.
void CheckMPI_Summary(struct BindStruct *X)
Print infomation of MPI parallelization Modify Definelist::Tpow in the inter process region...
int iFlgScaLAPACK
ScaLAPACK mode ( only for FullDiag )
int check(struct BindStruct *X)
A program to check size of dimension for Hilbert-space.
int CheckMPI(struct BindStruct *X)
Define the number of sites in each PE (DefineList.Nsite). Reduce the number of electrons (DefineList...
unsigned long int sdim
Dimension for Ogata-Lin ???
int GetLocal2Sz(const unsigned int isite, const long unsigned int org_bit, const long int *SiteToBit, const long unsigned int *Tpow)
get 2sz at a site for general spin
long int Binomial(int n, int k, long int **comb, int Nsite)
unsigned int Ndown
Number of spin-down electrons in this process.
unsigned int Nsite
Number of sites in the INTRA process region.
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
unsigned long int MaxMPI_li(unsigned long int idim)
MPI wrapper function to obtain maximum unsigned long integer across processes.
static unsigned long int mfint[7]
unsigned int NsiteMPI
Total number of sites, differ from DefineList::Nsite.
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
char * cErrNoModel
Error Message in diagonal calc.c.
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
unsigned int Ne
Number of electrons in this process.
const char * cFileNameCheckMemory
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
int iFlgCalcSpec
Input parameter CalcSpec in teh CalcMod file.
const char * cFileNameCheckSdim
double max_mem
Estimated memory size.
struct CheckList Check
Size of the Hilbert space.
int Total2SzMPI
Total across processes.
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
unsigned int k_exct
Read from Calcmod in readdef.h.