16 #include "bitcalc.hpp" 17 #include "wrapperMPI.hpp" 52 fprintf(stderr,
"%s",
"Error: Total Site Number is incorrect.\n");
56 *ihfbit=(*ihfbit<<(
long int)((Nsite+1)/2));
59 *ilft = (*ilft<<(
long int)Nsite)-1;
60 *ilft= *ilft ^ *irght;
90 case HubbardNConserved:
99 fprintf(stderr,
"Error: CalcModel %d is incorrect.\n", iCalcModel);
127 const long int *SiteToBit
130 long int isqrtMaxDim=1;
134 fprintf(stderr,
"%s",
"Error: Total Site Number is incorrect.\n");
138 for(isite=1; isite<=Nsite ; isite++){
139 isqrtMaxDim *= SiteToBit[isite-1];
141 isqrtMaxDim =(
long int)sqrt(isqrtMaxDim);
143 for(isite=1; isite<=Nsite ; isite++){
144 tmpbit *= SiteToBit[isite-1];
145 if(tmpbit >= isqrtMaxDim)
break;
168 const long int irght,
170 const long int ihfbit,
171 long int *isplited_Bit_right,
172 long int *isplited_Bit_left
175 *isplited_Bit_right=ibit & irght;
176 *isplited_Bit_left=ibit & ilft;
177 *isplited_Bit_left=*isplited_Bit_left/ihfbit;
199 const long int _irght,
200 const long int _ilft,
201 const long int _ihfbit,
206 SplitBit(_ibit, _irght, _ilft, _ihfbit, &ia, &ib);
215 if(_list_2_1[ia]*_list_2_2[ib]==0){
219 *_ioffComp =_list_2_1[ia]-1;
220 *_ioffComp+=_list_2_2[ib]-1;
244 const long int org_ibit,
249 const long int *SiteToBit,
253 if(off_ispin>SiteToBit[org_isite-1]-1 ||
255 org_ispin>SiteToBit[org_isite-1]-1 ||
260 if(
BitCheckGeneral(org_ibit, org_isite, org_ispin, SiteToBit, Tpow) == FALSE){
267 tmp_off=(
long int)(off_ispin-org_ispin);
268 tmp_off *=Tpow[org_isite-1];
286 const long int org_ibit,
287 const long int ihlfbit,
288 long int *_ilist1Comp
313 const long int org_bit,
319 bit = org_bit^(org_bit>>1);
320 bit = (bit^(bit>>2) ) & 0x11111111;
321 bit = bit*0x11111111;
322 *sgn = 1-2*((bit>>28) & 1);
339 const long int org_bit,
345 bit = org_bit^(org_bit>>1);
351 *sgn = 1-2*(bit & 1);
367 const long int org_bit,
368 const long int target_bit
371 return (org_bit >> target_bit) &1;
393 const long int org_bit,
395 const int target_ispin,
396 const long int *SiteToBit,
401 if(
GetBitGeneral(org_isite, org_bit, SiteToBit, Tpow) !=target_ispin){
423 const long int org_bit,
424 const long int *SiteToBit,
428 long int tmp_bit=(org_bit/Tpow[isite-1])%SiteToBit[isite-1] ;
450 const long int org_bit,
451 const long int *SiteToBit,
459 TwiceSz=-(SiteToBit[isite-1]-1)+2*bitAtSite;
474 long int smallest, ripple, ones;
476 ripple = x+ smallest;
478 ones = (ones>>2)/smallest;
492 x = x - ((x>>1) & 0x55555555);
493 x = (x & 0x33333333)+ ((x>>2)& 0x33333333);
494 x = (x+(x>>4)) & 0x0F0F0F0F;
497 return x & 0x0000003F;
int pop(int x)
calculating number of 1-bits in x (32 bit) This method is introduced in S.H. Warren, Hacker’s Delight, second ed., Addison-Wesley, ISBN: 0321842685, 2012.
int GetSplitBitByModel(const int Nsite, const int iCalcModel, long int *irght, long int *ilft, long int *ihfbit)
function of splitting original bit into right and left spaces.
int BitCheckGeneral(const long int org_bit, const int org_isite, const int target_ispin, const long int *SiteToBit, const long int *Tpow)
bit check function for general spin
int GetSplitBit(const int Nsite, long int *irght, long int *ilft, long int *ihfbit)
function of getting right, left and half bits corresponding to a original Hilbert space...
int ConvertToList1GeneralSpin(const long int org_ibit, const long int ihlfbit, long int *_ilist1Comp)
function of converting component to list_1
int GetOffCompGeneralSpin(const long int org_ibit, const int org_isite, const int org_ispin, const int off_ispin, long int *_ioffComp, const long int *SiteToBit, const long int *Tpow)
function of getting off-diagonal component for general spin
int GetSplitBitForGeneralSpin(const int Nsite, long int *ihfbit, const long int *SiteToBit)
function of getting right, left and half bits corresponding to a original space.
int GetOffComp(long int *_list_2_1, long int *_list_2_2, long int _ibit, const long int _irght, const long int _ilft, const long int _ihfbit, long int *_ioffComp)
function of getting off-diagonal component
void SplitBit(const long int ibit, const long int irght, const long int ilft, const long int ihfbit, long int *isplited_Bit_right, long int *isplited_Bit_left)
function of splitting a original bit to right and left spaces
void SgnBit_old(const long int org_bit, int *sgn)
function of getting fermion signs (for 32bit)
int GetLocal2Sz(const int isite, const long int org_bit, const long int *SiteToBit, const long int *Tpow)
get 2sz at a site for general spin
long int snoob(long int x)
"finding the next higher number after a given number that has the same number of 1-bits" This method ...
int BitCheck(const long int org_bit, const long int target_bit)
bit check function
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)
int GetBitGeneral(const int isite, const long int org_bit, const long int *SiteToBit, const long int *Tpow)
get bit at a site for general spin