24 #include "wrapperMPI.h" 25 #include "mltplyCommon.h" 26 #include "mltplyMPIHubbard.h" 34 unsigned long int itrans,
36 double complex *tmp_v0,
37 double complex *tmp_v1
40 double complex dam_pr = 0;
59 double complex tmp_trans,
61 double complex *tmp_v0,
62 double complex *tmp_v1
65 int mask1, mask2, state1, state2, ierr, origin, bitdiff, Fsgn;
66 unsigned long int idim_max_buf, j;
68 double complex trans, dmv, dam_pr;
70 mask1 = (int)X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
71 mask2 = (
int)X->
Def.
Tpow[2 * org_isite2 + org_ispin2];
72 if (mask2 > mask1) bitdiff = mask2 - mask1 * 2;
73 else bitdiff = mask1 - mask2 * 2;
74 origin =
myrank ^ (mask1 + mask2);
76 state1 = origin & mask1;
77 state2 = origin & mask2;
79 SgnBit((
unsigned long int) (origin & bitdiff), &Fsgn);
81 if (state1 == 0 && state2 == mask2) {
82 trans = -(double)Fsgn * tmp_trans;
84 else if (state1 == mask1 && state2 == 0) {
85 trans = -(double)Fsgn * conj(tmp_trans);
90 ierr = MPI_Sendrecv(&X->
Check.
idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
91 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
92 MPI_COMM_WORLD, &statusMPI);
94 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
95 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
96 MPI_COMM_WORLD, &statusMPI);
100 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv) \ 101 firstprivate(idim_max_buf, trans, X) shared(v1buf, tmp_v1, tmp_v0) 105 for (j = 1; j <= idim_max_buf; j++) {
106 dmv = trans *
v1buf[j];
108 dam_pr += conj(tmp_v1[j]) * dmv;
113 for (j = 1; j <= idim_max_buf; j++) {
114 dmv = trans *
v1buf[j];
115 dam_pr += conj(tmp_v1[j]) * dmv;
135 double complex tmp_trans,
137 double complex *tmp_v0,
138 double complex *tmp_v1,
139 double complex *
v1buf,
142 long unsigned int *list_2_1_target,
143 long unsigned int *list_2_2_target
146 int mask1, mask2, state1, state2, ierr, origin, bitdiff, Fsgn;
147 unsigned long int idim_max_buf, j, ioff;
148 MPI_Status statusMPI;
149 double complex trans, dmv;
151 mask1 = (int) X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
152 mask2 = (
int) X->
Def.
Tpow[2 * org_isite2 + org_ispin2];
153 if (mask2 > mask1) bitdiff = mask2 - mask1 * 2;
154 else bitdiff = mask1 - mask2 * 2;
155 origin =
myrank ^ (mask1 + mask2);
157 state1 = origin & mask1;
158 state2 = origin & mask2;
160 SgnBit((
unsigned long int) (origin & bitdiff), &Fsgn);
162 if (state1 == 0 && state2 == mask2) {
163 trans = -(double) Fsgn * tmp_trans;
165 else if (state1 == mask1 && state2 == 0) {
166 trans = -(double) Fsgn * conj(tmp_trans);
174 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
175 MPI_COMM_WORLD, &statusMPI);
178 ierr = MPI_Sendrecv(list_1_org, X->
Check.
idim_maxOrg + 1, MPI_UNSIGNED_LONG, origin, 0,
179 list_1buf_org, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
180 MPI_COMM_WORLD, &statusMPI);
183 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_maxOrg + 1, MPI_DOUBLE_COMPLEX, origin, 0,
184 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
185 MPI_COMM_WORLD, &statusMPI);
189 #pragma omp parallel for default(none) private(j, dmv, ioff) \ 190 firstprivate(idim_max_buf, trans, X, list_2_1_target, list_2_2_target, list_1buf_org) \ 191 shared(v1buf, tmp_v0) 192 for (j = 1; j <= idim_max_buf; j++){
193 dmv = trans * v1buf[j];
194 GetOffComp(list_2_1_target, list_2_2_target, list_1buf_org[j],
212 unsigned long int itrans,
214 double complex *tmp_v0,
215 double complex *tmp_v1
218 double complex dam_pr=0;
238 double complex tmp_trans,
240 double complex *tmp_v0,
241 double complex *tmp_v1
244 int mask2, state1, state2, ierr, origin, bit2diff, Fsgn;
245 unsigned long int idim_max_buf, j, mask1, state1check, bit1diff, ioff;
246 MPI_Status statusMPI;
247 double complex trans, dmv, dam_pr;
251 mask2 = (int) X->
Def.
Tpow[2 * org_isite2 + org_ispin2];
252 bit2diff = mask2 - 1;
254 state2 = origin & mask2;
256 SgnBit((
unsigned long int) (origin & bit2diff), &Fsgn);
258 ierr = MPI_Sendrecv(&X->
Check.
idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
259 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
260 MPI_COMM_WORLD, &statusMPI);
263 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
264 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
265 MPI_COMM_WORLD, &statusMPI);
271 mask1 = X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
273 if (state2 == mask2) {
274 trans = -(double) Fsgn * tmp_trans;
277 else if (state2 == 0) {
279 trans = -(double) Fsgn * conj(tmp_trans);
287 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv, state1, Fsgn, ioff) \ 288 firstprivate(idim_max_buf, trans, X, mask1, state1check, bit1diff) shared(v1buf, tmp_v1, tmp_v0) 292 for (j = 0; j < idim_max_buf; j++) {
296 if (state1 == state1check) {
298 SgnBit(j & bit1diff, &Fsgn);
301 dmv = (double)Fsgn * trans *
v1buf[j + 1];
302 tmp_v0[ioff + 1] += dmv;
303 dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
309 for (j = 0; j < idim_max_buf; j++) {
313 if (state1 == state1check) {
315 SgnBit(j & bit1diff, &Fsgn);
318 dmv = (double)Fsgn * trans *
v1buf[j + 1];
319 dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
335 unsigned long int itrans,
337 double complex *tmp_v0,
338 double complex *tmp_v1
341 double complex dam_pr;
360 double complex tmp_trans,
362 double complex *tmp_v0,
363 double complex *tmp_v1
366 int mask1, mask2, state1, state2, ierr, origin, bitdiff, Fsgn;
367 unsigned long int idim_max_buf, j, ioff;
368 MPI_Status statusMPI;
369 double complex trans, dmv, dam_pr;
371 mask1 = (int) X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
372 mask2 = (
int) X->
Def.
Tpow[2 * org_isite2 + org_ispin2];
374 if (mask2 > mask1) bitdiff = mask2 - mask1 * 2;
375 else bitdiff = mask1 - mask2 * 2;
376 origin =
myrank ^ (mask1 + mask2);
378 state1 = origin & mask1;
379 state2 = origin & mask2;
381 SgnBit((
unsigned long int) (origin & bitdiff), &Fsgn);
383 if (state1 == 0 && state2 == mask2) {
384 trans = -(double) Fsgn * tmp_trans;
386 else if (state1 == mask1 && state2 == 0) {
387 trans = -(double) Fsgn * conj(tmp_trans);
392 ierr = MPI_Sendrecv(&X->
Check.
idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
393 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
394 MPI_COMM_WORLD, &statusMPI);
397 list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
398 MPI_COMM_WORLD, &statusMPI);
400 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
401 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
402 MPI_COMM_WORLD, &statusMPI);
406 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv, Fsgn, ioff) \ 407 firstprivate(idim_max_buf, trans, X) shared(list_2_1, list_2_2, list_1buf, v1buf, tmp_v1, tmp_v0) 411 for (j = 1; j <= idim_max_buf; j++) {
414 dmv = trans *
v1buf[j];
416 dam_pr += conj(tmp_v1[ioff]) * dmv;
421 for (j = 1; j <= idim_max_buf; j++) {
424 dmv = trans *
v1buf[j];
425 dam_pr += conj(tmp_v1[ioff]) * dmv;
440 unsigned long int itrans,
442 double complex *tmp_v0,
443 double complex *tmp_v1
446 double complex dam_pr;
465 double complex tmp_trans,
467 double complex *tmp_v0,
468 double complex *tmp_v1
471 int mask2, state2, ierr, origin, bit2diff, Fsgn;
472 unsigned long int mask1, state1, idim_max_buf, j, state1check, bit1diff, ioff, jreal;
473 MPI_Status statusMPI;
474 double complex trans, dmv, dam_pr;
478 mask2 = (int)X->
Def.
Tpow[2 * org_isite2+org_ispin2];
479 bit2diff = mask2 - 1;
482 state2 = origin & mask2;
484 SgnBit((
unsigned long int) (origin & bit2diff), &Fsgn);
486 ierr = MPI_Sendrecv(&X->
Check.
idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
487 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
488 MPI_COMM_WORLD, &statusMPI);
491 list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
492 MPI_COMM_WORLD, &statusMPI);
494 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
495 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
496 MPI_COMM_WORLD, &statusMPI);
501 mask1 = X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
502 if (state2 == mask2) {
503 trans = -(double) Fsgn * tmp_trans;
506 else if (state2 == 0) {
508 trans = -(double) Fsgn * conj(tmp_trans);
518 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv, Fsgn, ioff, jreal, state1) \ 519 firstprivate(idim_max_buf, trans, X, mask1, state1check, bit1diff, myrank) shared(list_1, list_2_1, list_2_2, list_1buf, v1buf, tmp_v1, tmp_v0) 523 for (j = 1; j <= idim_max_buf; j++) {
526 state1 = jreal & mask1;
528 if (state1 == state1check) {
529 SgnBit(jreal & bit1diff, &Fsgn);
533 dmv = (double)Fsgn * trans *
v1buf[j];
535 dam_pr += conj(tmp_v1[ioff]) * dmv;
541 for (j = 1; j <= idim_max_buf; j++) {
544 state1 = jreal & mask1;
546 if (state1 == state1check) {
547 SgnBit(jreal & bit1diff, &Fsgn);
555 dmv = (double)Fsgn * trans *
v1buf[j];
556 dam_pr += conj(tmp_v1[ioff]) * dmv;
577 double complex tmp_trans,
579 double complex *tmp_v0,
580 double complex *tmp_v1,
581 double complex *
v1buf,
584 long unsigned int *list_2_1_target,
585 long unsigned int *list_2_2_target
588 int mask2, state2, ierr, origin, bit2diff, Fsgn;
589 unsigned long int mask1, state1, idim_max_buf, j, state1check, bit1diff, ioff, jreal;
590 MPI_Status statusMPI;
591 double complex trans, dmv;
595 mask2 = (int)X->
Def.
Tpow[2 * org_isite2+org_ispin2];
596 bit2diff = mask2 - 1;
599 state2 = origin & mask2;
601 SgnBit((
unsigned long int) (origin & bit2diff), &Fsgn);
604 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
605 MPI_COMM_WORLD, &statusMPI);
607 ierr = MPI_Sendrecv(list_1_org, X->
Check.
idim_maxOrg + 1, MPI_UNSIGNED_LONG, origin, 0,
608 list_1buf_org, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
609 MPI_COMM_WORLD, &statusMPI);
611 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_maxOrg + 1, MPI_DOUBLE_COMPLEX, origin, 0,
612 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
613 MPI_COMM_WORLD, &statusMPI);
618 mask1 = X->
Def.
Tpow[2 * org_isite1 + org_ispin1];
619 if (state2 == mask2) {
620 trans = -(double) Fsgn * tmp_trans;
623 else if (state2 == 0) {
625 trans = -(double) Fsgn * conj(tmp_trans);
632 #pragma omp parallel for default(none) private(j, dmv, Fsgn, ioff, jreal, state1) \ 633 firstprivate(idim_max_buf, trans, X, mask1, state1check, bit1diff,list_2_1_target, list_2_2_target, list_1buf_org, list_1) shared(v1buf, tmp_v0) 634 for (j = 1; j <= idim_max_buf; j++) {
635 jreal = list_1buf_org[j];
636 state1 = jreal & mask1;
637 if (state1 == state1check) {
638 SgnBit(jreal & bit1diff, &Fsgn);
639 GetOffComp(list_2_1_target, list_2_2_target, jreal ^ mask1,
642 dmv = (double) Fsgn * trans * v1buf[j];
void exitMPI(int errorcode)
MPI Abortation wrapper.
struct DefineList Def
Definision of system (Hamiltonian) etc.
double complex X_GC_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard + GC When both site1 and site2 are in the inter process region.
long unsigned int ihfbit
Used for Ogata-Lin ???
unsigned long int idim_max
The dimension of the Hilbert space of this process.
double complex prdct
The expectation value of the energy.
long unsigned int * list_1buf
struct LargeList Large
Variables for Matrix-Vector product.
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
int mode
multiply or expectation value.
long unsigned int * list_1buf_org
double complex X_GC_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard + GC When only site2 is in the inter process region.
void GC_child_general_hopp_MPIdouble(unsigned long int itrans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard + GC When both site1 and site2 are in the inter process region.
double complex X_child_CisAjt_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1, double complex *v1buf, long unsigned int *list_1_org, long unsigned int *list_1buf_org, long unsigned int *list_2_1_target, long unsigned int *list_2_2_target)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
unsigned long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
unsigned int Nsite
Number of sites in the INTRA process region.
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
void child_general_hopp_MPIdouble(unsigned long int itrans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When both site1 and site2 are in the inter proce...
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
long unsigned int ilft
Used for Ogata-Lin ???
long unsigned int * list_1_org
long unsigned int * list_2_1
double complex X_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
int GetOffComp(long unsigned int *_list_2_1, long unsigned int *_list_2_2, long unsigned int _ibit, const long unsigned int _irght, const long unsigned int _ilft, const long unsigned int _ihfbit, long unsigned int *_ioffComp)
function of getting off-diagonal component
void GC_child_general_hopp_MPIsingle(unsigned long int itrans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard + GC When only site2 is in the inter process region.
long unsigned int * list_1
long unsigned int * list_2_2
double complex X_child_CisAjt_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1, double complex *v1buf, long unsigned int *list_1_org, long unsigned int *list_1buf_org, long unsigned int *list_2_1_target, long unsigned int *list_2_2_target)
Hopping term in Hubbard + MPI When both site1 and site2 are in the inter process region.
long unsigned int irght
Used for Ogata-Lin ???
int myrank
Process ID, defined in InitializeMPI()
void child_general_hopp_MPIsingle(unsigned long int itrans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
double complex X_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When both site1 and site2 are in the inter proce...
struct CheckList Check
Size of the Hilbert space.
void SgnBit(const long unsigned int org_bit, int *sgn)
function of getting fermion sign (64 bit)