HΦ  3.2.0
xsetmem.c File Reference

Set size of memories to be needed for calculation. More...

#include "Common.h"
#include "common/setmemory.h"
#include "xsetmem.h"
#include "wrapperMPI.h"
+ Include dependency graph for xsetmem.c:

Go to the source code of this file.

Functions

void setmem_HEAD (struct BindStruct *X)
 Set size of memories headers of output files. More...
 
void setmem_def (struct BindStruct *X, struct BoostList *xBoost)
 Set size of memories for Def and Phys in BindStruct. More...
 
int setmem_large (struct BindStruct *X)
 Set size of memories for Hamiltonian (Ham, L_vec), vectors(vg, v0, v1, v2, vec, alpha, beta), lists (list_1, list_2_1, list_2_2, list_Diagonal) and Phys(BindStruct.PhysList) struct in the case of Full Diag mode. More...
 
void setmem_IntAll_Diagonal (int **InterAllOffDiagonal, double complex *ParaInterAllOffDiagonal, int **InterAllDiagonal, double *ParaInterAllDiagonal, const int NInterAll)
 Set the size of memories for InterAllDiagonal and InterAllOffDiagonal arrays. More...
 
int GetlistSize (struct BindStruct *X)
 Set size of lists for the canonical ensemble. More...
 

Variables

static unsigned long int mfint [7]
 

Detailed Description

Set size of memories to be needed for calculation.

Version
2.0
1.2
0.1
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition in file xsetmem.c.

Function Documentation

◆ GetlistSize()

int GetlistSize ( struct BindStruct X)

Set size of lists for the canonical ensemble.

Parameters
X[in,out] Give the information for getting the list size and get the lists.
Input: DefineList.iFlgGeneralSpin, DefineList.iCalcModel, DefineList.Nsite, CheckList.sdim, DefineList.Tpow, DefineList.SiteToBit
Output: LargeList.SizeOflist_2_1, LargeList.SizeOflist_2_2, LargeList.SizeOflistjb
Return values
TRUENormally finished
FALSEUnnormally finished
Author
Kazuyoshi Yoshimi
Version
1.2

Definition at line 288 of file xsetmem.c.

References BindStruct::Check, BindStruct::Def, FALSE, DefineList::iCalcModel, DefineList::iFlgGeneralSpin, BindStruct::Large, DefineList::Nsite, CheckList::sdim, DefineList::SiteToBit, LargeList::SizeOflist_2_1, LargeList::SizeOflist_2_2, LargeList::SizeOflistjb, DefineList::Tpow, and TRUE.

Referenced by MakeExcitedList(), setmem_IntAll_Diagonal(), and setmem_large().

290  {
291  // unsigned int idim_maxMPI;
292 
293 // idim_maxMPI = MaxMPI_li(X->Check.idim_max);
294 
295  switch (X->Def.iCalcModel) {
296  case Spin:
297  case Hubbard:
298  case HubbardNConserved:
299  case Kondo:
300  case KondoGC:
301  if (X->Def.iFlgGeneralSpin == FALSE) {
302  if (X->Def.iCalcModel == Spin && X->Def.Nsite % 2 == 1) {
303  X->Large.SizeOflist_2_1 = X->Check.sdim * 2 + 2;
304  } else {
305  X->Large.SizeOflist_2_1 = X->Check.sdim + 2;
306  }
307  X->Large.SizeOflist_2_2 = X->Check.sdim + 2;
308  X->Large.SizeOflistjb = X->Check.sdim + 2;
309  } else {//for spin-canonical general spin
310  X->Large.SizeOflist_2_1 = X->Check.sdim + 2;
311  X->Large.SizeOflist_2_2 =
312  X->Def.Tpow[X->Def.Nsite - 1] * X->Def.SiteToBit[X->Def.Nsite - 1] / X->Check.sdim + 2;
313  X->Large.SizeOflistjb =
314  X->Def.Tpow[X->Def.Nsite - 1] * X->Def.SiteToBit[X->Def.Nsite - 1] / X->Check.sdim + 2;
315  }
316  break;
317  default:
318  return FALSE;
319  }
320  return TRUE;
321 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
long int SizeOflist_2_1
Size of list_2_1.
Definition: struct.h:318
#define TRUE
Definition: global.h:26
unsigned long int sdim
Dimension for Ogata-Lin ???
Definition: struct.h:307
unsigned int Nsite
Number of sites in the INTRA process region.
Definition: struct.h:56
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.h:86
#define FALSE
Definition: global.h:25
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.h:94
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.h:198
long int SizeOflistjb
Used for computing Sz.
Definition: struct.h:320
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
long int SizeOflist_2_2
Size of list_2_2.
Definition: struct.h:319
+ Here is the caller graph for this function:

◆ setmem_def()

void setmem_def ( struct BindStruct X,
struct BoostList xBoost 
)

Set size of memories for Def and Phys in BindStruct.

Parameters
X[in,out] BindStruct to get information of Def and Phys structs.
xBoost[in,out] Struct for Boost mode.
Version
0.1

Definition at line 55 of file xsetmem.c.

References BoostList::arrayJ, PhysList::charge_real_cor, DefineList::CisAjt, DefineList::CisAjtCkuAlvDC, DefineList::CoulombInter, DefineList::CoulombIntra, BindStruct::Def, DefineList::EDChemi, DefineList::EDGeneralTransfer, DefineList::EDNChemi, DefineList::EDParaChemi, DefineList::EDParaGeneralTransfer, DefineList::EDSpinChemi, DefineList::ExchangeCoupling, DefineList::GeneralTransfer, DefineList::HundCoupling, DefineList::iCalcType, DefineList::InterAll, DefineList::InterAll_Diagonal, DefineList::InterAll_OffDiagonal, BoostList::list_6spin_pair, BoostList::list_6spin_star, PhysList::loc_spin_z, DefineList::LocSpn, DefineList::NCisAjt, DefineList::NCisAjtCkuAlvDC, DefineList::NCoulombInter, DefineList::NCoulombIntra, DefineList::NExchangeCoupling, DefineList::NHundCoupling, DefineList::NInterAll, DefineList::NIsingCoupling, DefineList::NLaser, DefineList::NPairExcitationOperator, DefineList::NPairHopping, DefineList::NPairLiftCoupling, DefineList::NSingleExcitationOperator, DefineList::Nsite, DefineList::NTEChemi, DefineList::NTEInterAll, DefineList::NTEInterAllDiagonal, DefineList::NTEInterAllMax, DefineList::NTEInterAllOffDiagonal, DefineList::NTETimeSteps, DefineList::NTETransfer, DefineList::NTETransferDiagonal, DefineList::NTETransferMax, DefineList::NTransfer, BoostList::num_pivot, BoostList::NumarrayJ, DefineList::OrgTpow, DefineList::PairExcitationOperator, DefineList::PairHopping, DefineList::PairLiftCoupling, DefineList::ParaCoulombInter, DefineList::ParaCoulombIntra, DefineList::ParaExchangeCoupling, DefineList::ParaGeneralTransfer, DefineList::ParaHundCoupling, DefineList::ParaInterAll, DefineList::ParaInterAll_Diagonal, DefineList::ParaInterAll_OffDiagonal, DefineList::ParaLaser, DefineList::ParaPairExcitationOperator, DefineList::ParaPairHopping, DefineList::ParaPairLiftCoupling, DefineList::ParaSingleExcitationOperator, DefineList::ParaTEChemi, DefineList::ParaTEInterAll, DefineList::ParaTEInterAllDiagonal, DefineList::ParaTEInterAllOffDiagonal, DefineList::ParaTETransfer, DefineList::ParaTETransferDiagonal, BindStruct::Phys, BoostList::R0, setmem_large(), DefineList::SingleExcitationOperator, DefineList::SiteToBit, PhysList::spin_real_cor, DefineList::SpinTEChemi, DefineList::TEChemi, DefineList::TEInterAll, DefineList::TEInterAllDiagonal, DefineList::TEInterAllOffDiagonal, DefineList::TETime, DefineList::TETransfer, DefineList::TETransferDiagonal, and DefineList::Tpow.

Referenced by main(), and setmem_HEAD().

58  {
59  unsigned long int i = 0;
60  unsigned long int j = 0;
61  unsigned long int k = 0;
62  X->Def.Tpow = lui_1d_allocate(2 * X->Def.Nsite + 2);
63  X->Def.OrgTpow = lui_1d_allocate(2 * X->Def.Nsite + 2);
64  X->Def.SiteToBit = li_1d_allocate(X->Def.Nsite + 1);
65  X->Def.LocSpn = i_1d_allocate(X->Def.Nsite);
66  X->Phys.spin_real_cor = d_1d_allocate(X->Def.Nsite * X->Def.Nsite);
67  X->Phys.charge_real_cor = d_1d_allocate(X->Def.Nsite * X->Def.Nsite);
68  X->Phys.loc_spin_z = d_1d_allocate(X->Def.Nsite * X->Def.Nsite);
69 
70  X->Def.EDChemi = i_1d_allocate(X->Def.EDNChemi + X->Def.NInterAll + X->Def.NTransfer);
71  X->Def.EDSpinChemi = i_1d_allocate(X->Def.EDNChemi + X->Def.NInterAll + X->Def.NTransfer);
72  X->Def.EDParaChemi = d_1d_allocate(X->Def.EDNChemi + X->Def.NInterAll + X->Def.NTransfer);
73  X->Def.GeneralTransfer = i_2d_allocate(X->Def.NTransfer, 4);
74  X->Def.ParaGeneralTransfer = cd_1d_allocate(X->Def.NTransfer);
75 
76  if (X->Def.iCalcType == TimeEvolution) {
77  X->Def.EDGeneralTransfer = i_2d_allocate(X->Def.NTransfer + X->Def.NTETransferMax, 4);
78  X->Def.EDParaGeneralTransfer = cd_1d_allocate(X->Def.NTransfer + X->Def.NTETransferMax);
79  } else {
80  X->Def.EDGeneralTransfer = i_2d_allocate(X->Def.NTransfer, 4);
81  X->Def.EDParaGeneralTransfer = cd_1d_allocate(X->Def.NTransfer);
82  }
83 
84  X->Def.CoulombIntra = i_2d_allocate(X->Def.NCoulombIntra, 1);
85  X->Def.ParaCoulombIntra = d_1d_allocate(X->Def.NCoulombIntra);
86  X->Def.CoulombInter = i_2d_allocate(X->Def.NCoulombInter + X->Def.NIsingCoupling, 2);
87  X->Def.ParaCoulombInter = d_1d_allocate(X->Def.NCoulombInter + X->Def.NIsingCoupling);
88  X->Def.HundCoupling = i_2d_allocate(X->Def.NHundCoupling + X->Def.NIsingCoupling, 2);
89  X->Def.ParaHundCoupling = d_1d_allocate(X->Def.NHundCoupling + X->Def.NIsingCoupling);
90  X->Def.PairHopping = i_2d_allocate(X->Def.NPairHopping, 2);
91  X->Def.ParaPairHopping = d_1d_allocate(X->Def.NPairHopping);
92  X->Def.ExchangeCoupling = i_2d_allocate(X->Def.NExchangeCoupling, 2);
93  X->Def.ParaExchangeCoupling = d_1d_allocate(X->Def.NExchangeCoupling);
94  X->Def.PairLiftCoupling = i_2d_allocate(X->Def.NPairLiftCoupling, 2);
95  X->Def.ParaPairLiftCoupling = d_1d_allocate(X->Def.NPairLiftCoupling);
96 
97  X->Def.InterAll = i_2d_allocate(X->Def.NInterAll, 8);
98  X->Def.ParaInterAll = cd_1d_allocate(X->Def.NInterAll);
99 
100  X->Def.CisAjt = i_2d_allocate(X->Def.NCisAjt, 4);
101  X->Def.CisAjtCkuAlvDC = i_2d_allocate(X->Def.NCisAjtCkuAlvDC, 8);
102 
103  X->Def.SingleExcitationOperator = i_2d_allocate(X->Def.NSingleExcitationOperator, 3);
105  X->Def.PairExcitationOperator = i_2d_allocate(X->Def.NPairExcitationOperator, 5);
107 
108  X->Def.ParaLaser = d_1d_allocate(X->Def.NLaser);
109 
110  unsigned int ipivot, iarrayJ, ispin;
111  xBoost->list_6spin_star = i_2d_allocate(xBoost->R0 * xBoost->num_pivot, 7);
112  xBoost->list_6spin_pair = i_3d_allocate(xBoost->R0 * xBoost->num_pivot, 7, 15);
113  xBoost->arrayJ = cd_3d_allocate(xBoost->NumarrayJ, 3, 3);
114 
115  int NInterAllSet;
116  NInterAllSet = (X->Def.iCalcType == TimeEvolution) ? X->Def.NInterAll + X->Def.NTEInterAllMax : X->Def.NInterAll;
117  X->Def.InterAll_OffDiagonal = i_2d_allocate(NInterAllSet, 8);
118  X->Def.ParaInterAll_OffDiagonal = cd_1d_allocate(NInterAllSet);
119  X->Def.InterAll_Diagonal = i_2d_allocate(NInterAllSet, 4);
120  X->Def.ParaInterAll_Diagonal = d_1d_allocate(NInterAllSet);
121 
122  if (X->Def.iCalcType == TimeEvolution) {
123  X->Def.TETime = d_1d_allocate(X->Def.NTETimeSteps);
124  //Time-dependent Transfer
125  X->Def.NTETransfer = ui_1d_allocate(X->Def.NTETimeSteps);
126  X->Def.NTETransferDiagonal = ui_1d_allocate(X->Def.NTETimeSteps);
127  X->Def.TETransfer = i_3d_allocate(X->Def.NTETimeSteps, X->Def.NTETransferMax, 4);
128  X->Def.TETransferDiagonal = i_3d_allocate(X->Def.NTETimeSteps, X->Def.NTETransferMax, 2);
129  X->Def.ParaTETransfer = cd_2d_allocate(X->Def.NTETimeSteps, X->Def.NTETransferMax);
130  X->Def.ParaTETransferDiagonal = d_2d_allocate(X->Def.NTETimeSteps, X->Def.NTETransferMax);
131  //Time-dependent InterAll
132  X->Def.NTEInterAll = ui_1d_allocate(X->Def.NTETimeSteps);
133  X->Def.NTEInterAllDiagonal = ui_1d_allocate(X->Def.NTETimeSteps);
134  X->Def.TEInterAll = i_3d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax, 8);
135  X->Def.TEInterAllDiagonal = i_3d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax, 4);
136  X->Def.ParaTEInterAll = cd_2d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax);
137  X->Def.ParaTEInterAllDiagonal = d_2d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax);
138  X->Def.NTEInterAllOffDiagonal = ui_1d_allocate(X->Def.NTETimeSteps);
139  X->Def.TEInterAllOffDiagonal = i_3d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax, 8);
140  X->Def.ParaTEInterAllOffDiagonal = cd_2d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax);
141  //Time-dependent Chemi generated by InterAll diagonal components
142  X->Def.NTEChemi = ui_1d_allocate(X->Def.NTETimeSteps);
143  X->Def.TEChemi = i_2d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax);
144  X->Def.SpinTEChemi = i_2d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax);
145  X->Def.ParaTEChemi = d_2d_allocate(X->Def.NTETimeSteps, X->Def.NTEInterAllMax);
146  }
147 }
unsigned int NTETimeSteps
Definition: struct.h:246
unsigned int NSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.h:182
unsigned int * NTEInterAllOffDiagonal
Definition: struct.h:273
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
unsigned int NHundCoupling
Number of Hund coupling.
Definition: struct.h:133
int *** TEInterAll
Definition: struct.h:278
int * EDSpinChemi
[DefineList::Nsite]
Definition: struct.h:99
int ** list_6spin_star
Definition: struct.h:403
int ** SpinTEChemi
Definition: struct.h:295
unsigned int NTEInterAllMax
Definition: struct.h:270
int ** ExchangeCoupling
[DefineList::NExchangeCoupling][2] Index of exchange term. malloc in setmem_def().
Definition: struct.h:146
double * ParaInterAll_Diagonal
[DefineList::NInterAll_Diagonal] Coupling constant of diagonal inter-all term. malloc in setmem_def()...
Definition: struct.h:168
unsigned int NLaser
Definition: struct.h:250
int *** TETransferDiagonal
Definition: struct.h:262
double * TETime
Definition: struct.h:247
int ** TEChemi
Definition: struct.h:293
int * LocSpn
[DefineList::NLocSpn] Flag (and size) of the local spin. malloc in setmem_def().
Definition: struct.h:82
int ** CisAjtCkuAlvDC
[DefineList::NCisAjtCkuAlvDC][4] Indices of two-body correlation function. malloc in setmem_def()...
Definition: struct.h:177
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.h:110
long unsigned int num_pivot
Definition: struct.h:398
struct PhysList Phys
Physical quantities.
Definition: struct.h:413
double complex * ParaInterAll_OffDiagonal
[DefineList::NInterAll_OffDiagonal] Coupling constant of off-diagonal inter-all term. malloc in setmem_def().
Definition: struct.h:170
unsigned int NPairLiftCoupling
Number of pair-lift term.
Definition: struct.h:153
int *** list_6spin_pair
Definition: struct.h:404
double * ParaLaser
Definition: struct.h:251
double complex ** ParaTETransfer
Definition: struct.h:264
double ** ParaTEChemi
Definition: struct.h:296
unsigned int * NTETransfer
Definition: struct.h:256
unsigned int * NTEChemi
Definition: struct.h:294
int ** InterAll_OffDiagonal
[DefineList::NinterAll_OffDiagonal][8] Interacted quartet
Definition: struct.h:161
int ** InterAll_Diagonal
[DefineList::NinterAll_Diagonal][4] Interacted quartet
Definition: struct.h:162
double * loc_spin_z
Malloc, but Not used ???
Definition: struct.h:387
int ** GeneralTransfer
Index of transfer integrals obtained by a def file. malloc in setmem_def(). Data Format [DefineList::...
Definition: struct.h:106
long unsigned int * OrgTpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:92
int ** PairHopping
[DefineList::NPairHopping][2] Index of pair-hopping. malloc in setmem_def().
Definition: struct.h:140
double ** ParaTETransferDiagonal
Definition: struct.h:266
int ** PairLiftCoupling
[DefineList::NPairHopping][2] Index of pair-lift term. malloc in setmem_def().
Definition: struct.h:154
int ** HundCoupling
[DefineList::NHundCoupling][2] Index of Hund coupling. malloc in setmem_def().
Definition: struct.h:134
double complex ** ParaTEInterAll
Definition: struct.h:286
double complex * ParaInterAll
[DefineList::NInterAll] Coupling constant of inter-all term. malloc in setmem_def().
Definition: struct.h:166
double complex * ParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:113
double * ParaExchangeCoupling
[DefineList::NExchangeCoupling] Coupling constant of exchange term. malloc in setmem_def().
Definition: struct.h:148
unsigned int Nsite
Number of sites in the INTRA process region.
Definition: struct.h:56
double * ParaCoulombInter
[DefineList::NCoulombInter]Coupling constant of off-site Coulomb interaction. malloc in setmem_def()...
Definition: struct.h:130
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:116
double * ParaPairLiftCoupling
[DefineList::NPairHopping] Coupling constant of pair-lift term. malloc in setmem_def().
Definition: struct.h:156
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
double complex * ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:189
int ** CoulombInter
Definition: struct.h:128
unsigned int NCoulombIntra
Definition: struct.h:121
double complex *** arrayJ
Definition: struct.h:401
double complex ** ParaTEInterAllOffDiagonal
Definition: struct.h:288
unsigned int NIsingCoupling
Number of Ising term.
Definition: struct.h:151
int ** SingleExcitationOperator
[DefineList::NSingleExcitationOperator][3] Indices of single excitaion operator for spectrum...
Definition: struct.h:180
double * EDParaChemi
[DefineList::Nsite] On-site potential parameter. malloc in setmem_def().
Definition: struct.h:100
long unsigned int R0
Definition: struct.h:396
int *** TETransfer
Definition: struct.h:260
unsigned int NExchangeCoupling
Number of exchange term.
Definition: struct.h:145
unsigned int NCisAjtCkuAlvDC
Number of indices of two-body correlation function.
Definition: struct.h:178
unsigned int NPairHopping
Number of pair-hopping term.
Definition: struct.h:139
unsigned int NCisAjt
Number of indices of two-body correlation function.
Definition: struct.h:175
unsigned int NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.h:188
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.h:94
unsigned int * NTEInterAllDiagonal
Definition: struct.h:276
int ** CisAjt
[DefineList::NCisAjt][4] Indices of one-body correlation function. malloc in setmem_def().
Definition: struct.h:174
double ** ParaTEInterAllDiagonal
Definition: struct.h:291
int ** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:186
double * ParaPairHopping
[DefineList::NPairHopping] Coupling constant of pair-hopping term. malloc in setmem_def().
Definition: struct.h:142
unsigned int NInterAll
Total Number of Interacted quartet.
Definition: struct.h:163
int ** CoulombIntra
Definition: struct.h:122
unsigned int NTransfer
Number of transfer integrals obtained by a def file.
Definition: struct.h:104
double * charge_real_cor
Malloc, but Not used ???
Definition: struct.h:386
double * ParaHundCoupling
[DefineList::NHundCoupling] Hund coupling constant. malloc in setmem_def().
Definition: struct.h:136
double * spin_real_cor
Malloc, but Not used ???
Definition: struct.h:385
int *** TEInterAllOffDiagonal
Definition: struct.h:281
unsigned int NCoulombInter
Number of off-site Coulomb interaction.
Definition: struct.h:127
double * ParaCoulombIntra
Definition: struct.h:124
unsigned int EDNChemi
Number of on-site term.
Definition: struct.h:97
int *** TEInterAllDiagonal
Definition: struct.h:284
double complex * ParaSingleExcitationOperator
[DefineList::NSingleExcitationOperator] Coefficient of single excitaion operator for spectrum...
Definition: struct.h:183
int ** InterAll
[DefineList::NinterAll][8] Interacted quartet
Definition: struct.h:160
unsigned int NumarrayJ
Definition: struct.h:400
int * EDChemi
[DefineList::Nsite] Chemical potential. malloc in setmem_def().
Definition: struct.h:98
unsigned int NTETransferMax
Definition: struct.h:255
unsigned int * NTEInterAll
Definition: struct.h:271
unsigned int * NTETransferDiagonal
Definition: struct.h:258
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
Definition: struct.h:192
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setmem_HEAD()

void setmem_HEAD ( struct BindStruct X)

Set size of memories headers of output files.

Parameters
X[out] BindStruct to get headers of files.
Output: CDataFileHead, CParaFileHead
Version
0.1

Definition at line 41 of file xsetmem.c.

References DefineList::CDataFileHead, DefineList::CParaFileHead, D_FileNameMax, BindStruct::Def, and setmem_def().

Referenced by main().

44 {
45  X->Def.CDataFileHead = (char*)malloc(D_FileNameMax*sizeof(char));
46  X->Def.CParaFileHead = (char*)malloc(D_FileNameMax*sizeof(char));
47 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
#define D_FileNameMax
Definition: global.h:23
char * CParaFileHead
Read from Calcmod in readdef.h. It is not used. Just for the compatibility to mVMC.
Definition: struct.h:44
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green's function.
Definition: struct.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setmem_IntAll_Diagonal()

void setmem_IntAll_Diagonal ( int **  InterAllOffDiagonal,
double complex *  ParaInterAllOffDiagonal,
int **  InterAllDiagonal,
double *  ParaInterAllDiagonal,
const int  NInterAll 
)

Set the size of memories for InterAllDiagonal and InterAllOffDiagonal arrays.

Parameters
InterAllOffDiagonal[in,out] Arrays of cites and spin indexes of off-diagonal parts of InterAll interactions.
ParaInterAllOffDiagonal[in,out] Arrays of parameters of off-diagonal parts of InterAll interactions.
InterAllDiagonal[in,out] Arrays of cites and spin indexes of diagonal parts of InterAll interactions.
ParaInterAllDiagonal[in,out] Arrays of parameters of diagonal parts of InterAll interactions.
NInterAll[in] Total number of InterAll interactions.
Author
Kazuyoshi Yoshimi
Version
1.2

Definition at line 264 of file xsetmem.c.

References GetlistSize().

Referenced by setmem_large().

270  {
271  InterAllOffDiagonal = i_2d_allocate(NInterAll, 8);
272  ParaInterAllOffDiagonal = cd_1d_allocate(NInterAll);
273  InterAllDiagonal = i_2d_allocate(NInterAll, 4);
274  ParaInterAllDiagonal = d_1d_allocate(NInterAll);
275  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setmem_large()

int setmem_large ( struct BindStruct X)

Set size of memories for Hamiltonian (Ham, L_vec), vectors(vg, v0, v1, v2, vec, alpha, beta), lists (list_1, list_2_1, list_2_2, list_Diagonal) and Phys(BindStruct.PhysList) struct in the case of Full Diag mode.

Parameters
X[in,out] BindStruct to give information and give size of memories for Hamiltonian, vectors, lists and Phys struct in the case of Full Diag mode.
Return values
-1Fail to set memories.
0Normal to set memories.
Version
0.1

Definition at line 157 of file xsetmem.c.

References PhysList::all_doublon, PhysList::all_energy, PhysList::all_num_down, PhysList::all_num_up, PhysList::all_s2, PhysList::all_sz, alpha, beta, BindStruct::Check, cProFinishAlloc, BindStruct::Def, GetlistSize(), Ham, DefineList::iCalcType, CheckList::idim_max, DefineList::iFlgCalcSpec, DefineList::k_exct, L_vec, DefineList::Lanczos_max, DefineList::LanczosTarget, BindStruct::Large, list_1, list_1buf, list_2_1, list_2_2, list_Diagonal, MaxMPI_li(), DefineList::nvec, BindStruct::Phys, setmem_IntAll_Diagonal(), LargeList::SizeOflist_2_1, LargeList::SizeOflist_2_2, stdoutMPI, TRUE, v0, v1, v1buf, v2, vec, and vg.

Referenced by main(), MakeExcitedList(), and setmem_def().

159  {
160 
161  unsigned long int j = 0;
162  unsigned long int idim_maxMPI;
163 
164  idim_maxMPI = MaxMPI_li(X->Check.idim_max);
165 
166  if (GetlistSize(X) == TRUE) {
167  list_1 = lui_1d_allocate(X->Check.idim_max + 1);
168 #ifdef MPI
169  list_1buf = lui_1d_allocate(idim_maxMPI + 1);
170 #endif // MPI
171  list_2_1 = lui_1d_allocate(X->Large.SizeOflist_2_1);
172  list_2_2 = lui_1d_allocate(X->Large.SizeOflist_2_2);
173  if (list_1 == NULL
174  || list_2_1 == NULL
175  || list_2_2 == NULL
176  ) {
177  return -1;
178  }
179  }
180 
181  list_Diagonal = d_1d_allocate(X->Check.idim_max + 1);
182  v0 = cd_1d_allocate(X->Check.idim_max + 1);
183  v1 = cd_1d_allocate(X->Check.idim_max + 1);
184  if (X->Def.iCalcType == TimeEvolution) {
185  v2 = cd_1d_allocate(X->Check.idim_max + 1);
186  } else {
187  v2 = cd_1d_allocate(1);
188  }
189 #ifdef MPI
190  v1buf = cd_1d_allocate(idim_maxMPI + 1);
191 #endif // MPI
192  if (X->Def.iCalcType == TPQCalc) {
193  vg = cd_1d_allocate(1);
194  } else {
195  vg = cd_1d_allocate(X->Check.idim_max + 1);
196  }
197  alpha = d_1d_allocate(X->Def.Lanczos_max + 1);
198  beta = d_1d_allocate(X->Def.Lanczos_max + 1);
199 
200  if (
201  list_Diagonal == NULL
202  || v0 == NULL
203  || v1 == NULL
204  || vg == NULL
205  ) {
206  return -1;
207  }
208 
209  if (X->Def.iCalcType == TPQCalc || X->Def.iFlgCalcSpec != CALCSPEC_NOT) {
210  vec = cd_2d_allocate(X->Def.Lanczos_max + 1, X->Def.Lanczos_max + 1);
211  } else if (X->Def.iCalcType == Lanczos || X->Def.iCalcType == CG) {
212  if (X->Def.LanczosTarget > X->Def.nvec) {
213  vec = cd_2d_allocate(X->Def.LanczosTarget + 1, X->Def.Lanczos_max + 1);
214  } else {
215  vec = cd_2d_allocate(X->Def.nvec + 1, X->Def.Lanczos_max + 1);
216  }
217  }
218 
219  if (X->Def.iCalcType == FullDiag) {
220  X->Phys.all_num_down = d_1d_allocate(X->Check.idim_max + 1);
221  X->Phys.all_num_up = d_1d_allocate( X->Check.idim_max + 1);
222  X->Phys.all_energy = d_1d_allocate(X->Check.idim_max + 1);
223  X->Phys.all_doublon = d_1d_allocate(X->Check.idim_max + 1);
224  X->Phys.all_sz = d_1d_allocate(X->Check.idim_max + 1);
225  X->Phys.all_s2 = d_1d_allocate(X->Check.idim_max + 1);
226  Ham = cd_2d_allocate(X->Check.idim_max + 1, X->Check.idim_max + 1);
227  L_vec = cd_2d_allocate(X->Check.idim_max + 1, X->Check.idim_max + 1);
228 
229  if (X->Phys.all_num_down == NULL
230  || X->Phys.all_num_up == NULL
231  || X->Phys.all_energy == NULL
232  || X->Phys.all_doublon == NULL
233  || X->Phys.all_s2 == NULL
234  ) {
235  return -1;
236  }
237  for (j = 0; j < X->Check.idim_max + 1; j++) {
238  if (Ham[j] == NULL || L_vec[j] == NULL) {
239  return -1;
240  }
241  }
242  } else if (X->Def.iCalcType == CG) {
243  X->Phys.all_num_down = d_1d_allocate(X->Def.k_exct);
244  X->Phys.all_num_up = d_1d_allocate(X->Def.k_exct);
245  X->Phys.all_energy = d_1d_allocate(X->Def.k_exct);
246  X->Phys.all_doublon = d_1d_allocate(X->Def.k_exct);
247  X->Phys.all_sz = d_1d_allocate(X->Def.k_exct);
248  X->Phys.all_s2 = d_1d_allocate( X->Def.k_exct);
249  }
250  fprintf(stdoutMPI, "%s", cProFinishAlloc);
251  return 0;
252 }
double * all_num_down
[CheckList::idim_max+1] Number of spin-down electrons for FullDiag and LOBPCG. malloc in setmem_large...
Definition: struct.h:381
double * all_s2
[CheckList::idim_max+1] for FullDiag and LOBPCG. malloc in setmem_large().
Definition: struct.h:377
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
double complex * v1
Definition: global.h:35
double complex * v2
Definition: global.h:36
double complex ** vec
Definition: global.h:45
long unsigned int * list_1buf
Definition: global.h:48
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
struct PhysList Phys
Physical quantities.
Definition: struct.h:413
long int SizeOflist_2_1
Size of list_2_1.
Definition: struct.h:318
unsigned int nvec
Read from Calcmod in readdef.h.
Definition: struct.h:46
#define TRUE
Definition: global.h:26
double complex ** Ham
Definition: global.h:73
const char * cProFinishAlloc
unsigned long int MaxMPI_li(unsigned long int idim)
MPI wrapper function to obtain maximum unsigned long integer across processes.
Definition: wrapperMPI.c:171
long unsigned int * list_2_1
Definition: global.h:49
double * all_doublon
[CheckList::idim_max+1] Doublon for FullDiag and LOBPCG. malloc in setmem_large().
Definition: struct.h:373
int GetlistSize(struct BindStruct *X)
Set size of lists for the canonical ensemble.
Definition: xsetmem.c:288
double complex ** L_vec
Definition: global.h:74
double * alpha
Definition: global.h:44
long unsigned int * list_1
Definition: global.h:47
double complex * vg
Definition: global.h:41
long unsigned int * list_2_2
Definition: global.h:50
double * beta
Definition: global.h:44
int LanczosTarget
Which eigenstate is used to check convergence. Read from Calcmod in readdef.h.
Definition: struct.h:50
double * list_Diagonal
Definition: global.h:46
double * all_sz
[CheckList::idim_max+1] for FullDiag and LOBPCG. malloc in setmem_large().
Definition: struct.h:375
int iFlgCalcSpec
Input parameter CalcSpec in teh CalcMod file.
Definition: struct.h:216
double complex * v0
Definition: global.h:34
double complex * v1buf
Definition: global.h:37
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
long int SizeOflist_2_2
Size of list_2_2.
Definition: struct.h:319
double * all_num_up
[CheckList::idim_max+1] Number of spin-up electrons for FullDiag and LOBPCG. malloc in setmem_large()...
Definition: struct.h:379
unsigned int Lanczos_max
Maximum number of iterations.
Definition: struct.h:74
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
Definition: struct.h:192
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165
double * all_energy
[CheckList::idim_max+1] Energy for FullDiag and LOBPCG. malloc in setmem_large(). ...
Definition: struct.h:371
unsigned int k_exct
Read from Calcmod in readdef.h.
Definition: struct.h:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ mfint

unsigned long int mfint[7]
static

Definition at line 33 of file xsetmem.c.

Referenced by check(), and Lanczos_EigenValue().