20 #include "bitcalc.hpp" 21 #include "wrapperMPI.hpp" 22 #include "mltplyCommon.hpp" 23 #include "mltplyMPIHubbard.hpp" 33 int nstate, std::complex<double> **tmp_v0,
34 std::complex<double> **tmp_v1
52 std::complex<double> tmp_trans,
54 int nstate, std::complex<double> **tmp_v0,
55 std::complex<double> **tmp_v1
57 int mask1, mask2, state1, state2, origin, bitdiff, Fsgn;
58 long int idim_max_buf;
59 std::complex<double> trans;
61 mask1 = (int)X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
62 mask2 = (
int)X->
Def.
Tpow[2 * org_isite2 + org_ispin2];
63 if (mask2 > mask1) bitdiff = mask2 - mask1 * 2;
64 else bitdiff = mask1 - mask2 * 2;
65 origin =
myrank ^ (mask1 + mask2);
67 state1 = origin & mask1;
68 state2 = origin & mask2;
70 SgnBit((
long int) (origin & bitdiff), &Fsgn);
72 if (state1 == 0 && state2 == mask2) {
73 trans = -(double)Fsgn * tmp_trans;
75 else if (state1 == mask1 && state2 == 0) {
76 trans = -(double)Fsgn * conj(tmp_trans);
97 std::complex<double> tmp_trans,
99 int nstate, std::complex<double> **tmp_v0,
100 std::complex<double> **tmp_v1
102 int mask1, mask2, state1, state2, origin, bitdiff, Fsgn;
103 long int idim_max_buf, j, ioff;
104 std::complex<double> trans;
107 mask1 = (int) X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
108 mask2 = (
int) X->
Def.
Tpow[2 * org_isite2 + org_ispin2];
109 if (mask2 > mask1) bitdiff = mask2 - mask1 * 2;
110 else bitdiff = mask1 - mask2 * 2;
111 origin =
myrank ^ (mask1 + mask2);
113 state1 = origin & mask1;
114 state2 = origin & mask2;
116 SgnBit((
long int) (origin & bitdiff), &Fsgn);
118 if (state1 == 0 && state2 == mask2) {
119 trans = -(double) Fsgn * tmp_trans;
121 else if (state1 == mask1 && state2 == 0) {
122 trans = -(double) Fsgn * conj(tmp_trans);
133 #pragma omp parallel for default(none) private(j, ioff) \ 134 firstprivate(idim_max_buf, trans, X, list_2_1, list_2_2, list_1buf_org) \ 135 shared(v1buf, tmp_v0,nstate,one) 136 for (j = 1; j <= idim_max_buf; j++) {
139 zaxpy_(&nstate, &trans, &
v1buf[j][0], &one, &tmp_v0[ioff][0], &one);
150 int nstate, std::complex<double> **tmp_v0,
151 std::complex<double> **tmp_v1
169 std::complex<double> tmp_trans,
171 int nstate, std::complex<double> **tmp_v0,
172 std::complex<double> **tmp_v1
174 int mask2, state1, state2, origin, bit2diff, Fsgn;
175 long int idim_max_buf, j, mask1, state1check, bit1diff, ioff;
176 std::complex<double> trans, dmv;
181 mask2 = (int) X->
Def.
Tpow[2 * org_isite2 + org_ispin2];
182 bit2diff = mask2 - 1;
184 state2 = origin & mask2;
186 SgnBit((
long int) (origin & bit2diff), &Fsgn);
195 mask1 = X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
197 if (state2 == mask2) {
198 trans = -(double) Fsgn * tmp_trans;
201 else if (state2 == 0) {
203 trans = -(double) Fsgn * conj(tmp_trans);
210 #pragma omp parallel default(none) private(j,dmv,state1,Fsgn,ioff) \ 211 firstprivate(idim_max_buf,trans,X,mask1,state1check,bit1diff) \ 212 shared(v1buf,tmp_v1,tmp_v0,nstate,one) 215 for (j = 0; j < idim_max_buf; j++) {
219 if (state1 == state1check) {
221 SgnBit(j & bit1diff, &Fsgn);
224 dmv = (double)Fsgn * trans;
225 zaxpy_(&nstate, &dmv, &
v1buf[j + 1][0], &one, &tmp_v0[ioff + 1][0], &one);
239 int nstate, std::complex<double> **tmp_v0,
240 std::complex<double> **tmp_v1
257 std::complex<double> tmp_trans,
259 int nstate, std::complex<double> **tmp_v0,
260 std::complex<double> **tmp_v1
262 int mask1, mask2, state1, state2, origin, bitdiff, Fsgn;
263 long int idim_max_buf, j, ioff;
264 std::complex<double> trans;
267 mask1 = (int) X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
268 mask2 = (
int) X->
Def.
Tpow[2 * org_isite2 + org_ispin2];
270 if (mask2 > mask1) bitdiff = mask2 - mask1 * 2;
271 else bitdiff = mask1 - mask2 * 2;
272 origin =
myrank ^ (mask1 + mask2);
274 state1 = origin & mask1;
275 state2 = origin & mask2;
277 SgnBit((
long int) (origin & bitdiff), &Fsgn);
279 if (state1 == 0 && state2 == mask2) {
280 trans = -(double) Fsgn * tmp_trans;
282 else if (state1 == mask1 && state2 == 0) {
283 trans = -(double) Fsgn * conj(tmp_trans);
292 #pragma omp parallel default(none) private(j,Fsgn,ioff) \ 293 firstprivate(idim_max_buf,trans,X) \ 294 shared(list_2_1,list_2_2,list_1buf,v1buf,tmp_v1,tmp_v0,nstate,one) 297 for (j = 1; j <= idim_max_buf; j++) {
300 zaxpy_(&nstate, &trans, &
v1buf[j][0], &one, &tmp_v0[ioff][0], &one);
312 int nstate, std::complex<double> **tmp_v0,
313 std::complex<double> **tmp_v1
330 std::complex<double> tmp_trans,
332 int nstate, std::complex<double> **tmp_v0,
333 std::complex<double> **tmp_v1
335 int mask2, state2, origin, bit2diff, Fsgn;
336 long int mask1, state1, idim_max_buf, j, state1check, bit1diff, ioff, jreal;
337 std::complex<double> trans, dmv;
342 mask2 = (int)X->
Def.
Tpow[2 * org_isite2+org_ispin2];
343 bit2diff = mask2 - 1;
346 state2 = origin & mask2;
348 SgnBit((
long int) (origin & bit2diff), &Fsgn);
356 mask1 = X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
357 if (state2 == mask2) {
358 trans = -(double) Fsgn * tmp_trans;
361 else if (state2 == 0) {
363 trans = -(double) Fsgn * conj(tmp_trans);
372 #pragma omp parallel default(none) private(j,dmv,Fsgn,ioff,jreal,state1) \ 373 firstprivate(idim_max_buf,trans,X,mask1,state1check,bit1diff,myrank) \ 374 shared(list_1,list_2_1,list_2_2,list_1buf,v1buf,tmp_v1,tmp_v0,nstate,one) 377 for (j = 1; j <= idim_max_buf; j++) {
380 state1 = jreal & mask1;
382 if (state1 == state1check) {
383 SgnBit(jreal & bit1diff,&Fsgn);
387 dmv = (double)Fsgn * trans;
388 zaxpy_(&nstate, &dmv, &
v1buf[j][0], &one, &tmp_v0[ioff][0], &one);
403 std::complex<double> tmp_trans,
406 std::complex<double> **tmp_v0,
407 std::complex<double> **tmp_v1
409 int mask2, state2, origin, bit2diff, Fsgn;
410 long int mask1, state1, idim_max_buf, j, state1check, bit1diff, ioff, jreal;
411 std::complex<double> trans, dmv;
416 mask2 = (int)X->
Def.
Tpow[2 * org_isite2+org_ispin2];
417 bit2diff = mask2 - 1;
420 state2 = origin & mask2;
422 SgnBit((
long int) (origin & bit2diff), &Fsgn);
430 mask1 = X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
431 if (state2 == mask2) {
432 trans = -(double) Fsgn * tmp_trans;
435 else if (state2 == 0) {
437 trans = -(double) Fsgn * conj(tmp_trans);
443 #pragma omp parallel for default(none) private(j,dmv,Fsgn,ioff,jreal,state1) \ 444 firstprivate(idim_max_buf,trans,X,mask1,state1check,bit1diff,list_2_1,list_2_2,list_1buf_org,list_1) \ 445 shared(v1buf, tmp_v0,nstate,one) 446 for (j = 1; j <= idim_max_buf; j++) {
448 state1 = jreal & mask1;
449 if (state1 == state1check) {
450 SgnBit(jreal & bit1diff, &Fsgn);
454 dmv = (double)Fsgn * trans;
455 zaxpy_(&nstate, &dmv, &
v1buf[j][0], &one, &tmp_v0[ioff][0], &one);
struct DefineList Def
Definision of system (Hamiltonian) etc.
std::complex< double > * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
void GC_child_general_hopp_MPIsingle(long int itrans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + GC When only site2 is in the inter process region.
void GC_child_general_hopp_MPIdouble(long int itrans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + GC When both site1 and site2 are in the inter process region.
std::complex< double > ** v1buf
int Nsite
Number of sites in the INTRA process region.
void zaxpy_long(long int n, std::complex< double > a, std::complex< double > *x, std::complex< double > *y)
Wrapper of zaxpy.
long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
struct LargeList Large
Variables for Matrix-Vector product.
void X_child_CisAjt_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + MPI When both site1 and site2 are in the inter process region.
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
int mode
multiply or expectation value.
long int irght
Used for Ogata-Lin ???
long int SendRecv_i(int origin, long int isend)
Wrapper of MPI_Sendrecv for long integer number.
long int ilft
Used for Ogata-Lin ???
void X_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
void child_general_hopp_MPIsingle(long int itrans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
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
long int ihfbit
Used for Ogata-Lin ???
int myrank
Process ID, defined in InitializeMPI()
void SendRecv_cv(int origin, long int nMsgS, long int nMsgR, std::complex< double > *vecs, std::complex< double > *vecr)
Wrapper of MPI_Sendrecv for std::complex<double> number. When we pass a message longer than 2^31-1 (m...
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
void SendRecv_iv(int origin, long int nMsgS, long int nMsgR, long int *vecs, long int *vecr)
Wrapper of MPI_Sendrecv for long integer number. When we pass a message longer than 2^31-1 (max of in...
void child_general_hopp_MPIdouble(long int itrans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When both site1 and site2 are in the inter proce...
void X_child_CisAjt_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
struct CheckList Check
Size of the Hilbert space.
void X_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When both site1 and site2 are in the inter proce...
void X_GC_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + GC When both site1 and site2 are in the inter process region.
void X_GC_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + GC When only site2 is in the inter process region.
long int idim_max
The dimension of the Hilbert space of this process.
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)