HΦ  3.2.0
mltplyMPIHubbard.c File Reference

Functions for Hubbard Hamiltonian + MPI. More...

#include "mpi.h"
#include "Common.h"
#include "bitcalc.h"
#include "wrapperMPI.h"
#include "mltplyCommon.h"
#include "mltplyMPIHubbard.h"
+ Include dependency graph for mltplyMPIHubbard.c:

Go to the source code of this file.

Functions

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 process region. More...
 
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 process region. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

Functions for Hubbard Hamiltonian + MPI.

Definition in file mltplyMPIHubbard.c.

Function Documentation

◆ child_general_hopp_MPIdouble()

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 process region.

Author
Mitsuaki Kawamura (The University of Tokyo)
Parameters
[in]itransTransfer ID
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 334 of file mltplyMPIHubbard.c.

References BindStruct::Def, DefineList::EDGeneralTransfer, DefineList::EDParaGeneralTransfer, BindStruct::Large, LargeList::prdct, and X_child_general_hopp_MPIdouble().

Referenced by mltplyHubbard().

339  {
340 #ifdef MPI
341  double complex dam_pr;
343  X->Def.EDGeneralTransfer[itrans][0], X->Def.EDGeneralTransfer[itrans][1],
344  X->Def.EDGeneralTransfer[itrans][2], X->Def.EDGeneralTransfer[itrans][3],
345  X->Def.EDParaGeneralTransfer[itrans], X, tmp_v0, tmp_v1);
346  X->Large.prdct += dam_pr;
347 #endif
348 }/*void child_general_hopp_MPIdouble*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
double complex prdct
The expectation value of the energy.
Definition: struct.h:314
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.h:110
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 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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ child_general_hopp_MPIsingle()

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.

Author
Mitsuaki Kawamura (The University of Tokyo)
Parameters
[in]itransTransfer ID
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 439 of file mltplyMPIHubbard.c.

References BindStruct::Def, DefineList::EDGeneralTransfer, DefineList::EDParaGeneralTransfer, BindStruct::Large, LargeList::prdct, and X_child_general_hopp_MPIsingle().

Referenced by mltplyHubbard().

444  {
445 #ifdef MPI
446  double complex dam_pr;
448  X->Def.EDGeneralTransfer[itrans][0], X->Def.EDGeneralTransfer[itrans][1],
449  X->Def.EDGeneralTransfer[itrans][2], X->Def.EDGeneralTransfer[itrans][3],
450  X->Def.EDParaGeneralTransfer[itrans], X, tmp_v0, tmp_v1);
451  X->Large.prdct += dam_pr;
452 #endif
453 }/*void child_general_hopp_MPIsingle*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
double complex prdct
The expectation value of the energy.
Definition: struct.h:314
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.h:110
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 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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GC_child_general_hopp_MPIdouble()

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.

Author
Mitsuaki Kawamura (The University of Tokyo)
Parameters
[in]itransTransfer ID
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 33 of file mltplyMPIHubbard.c.

References BindStruct::Def, DefineList::EDGeneralTransfer, DefineList::EDParaGeneralTransfer, BindStruct::Large, LargeList::prdct, and X_GC_child_general_hopp_MPIdouble().

Referenced by mltplyHubbardGC().

38  {
39 #ifdef MPI
40  double complex dam_pr = 0;
42  X->Def.EDGeneralTransfer[itrans][0], X->Def.EDGeneralTransfer[itrans][1],
43  X->Def.EDGeneralTransfer[itrans][2], X->Def.EDGeneralTransfer[itrans][3],
44  X->Def.EDParaGeneralTransfer[itrans], X, tmp_v0, tmp_v1);
45  X->Large.prdct += dam_pr;
46 #endif
47 }/*void GC_child_general_hopp_MPIdouble*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
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.
double complex prdct
The expectation value of the energy.
Definition: struct.h:314
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.h:110
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GC_child_general_hopp_MPIsingle()

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.

Author
Mitsuaki Kawamura (The University of Tokyo)
Parameters
[in]itransTransfer ID
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 211 of file mltplyMPIHubbard.c.

References BindStruct::Def, DefineList::EDGeneralTransfer, DefineList::EDParaGeneralTransfer, BindStruct::Large, LargeList::prdct, and X_GC_child_general_hopp_MPIsingle().

Referenced by mltplyHubbardGC().

216  {
217 #ifdef MPI
218  double complex dam_pr=0;
220  X->Def.EDGeneralTransfer[itrans][0], X->Def.EDGeneralTransfer[itrans][1],
221  X->Def.EDGeneralTransfer[itrans][2], X->Def.EDGeneralTransfer[itrans][3],
222  X->Def.EDParaGeneralTransfer[itrans], X, tmp_v0, tmp_v1 );
223  X->Large.prdct += dam_pr;
224 #endif
225 }/*void GC_child_general_hopp_MPIsingle*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
double complex prdct
The expectation value of the energy.
Definition: struct.h:314
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.h:110
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.
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ X_child_CisAjt_MPIdouble()

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.

Author
Mitsuaki Kawamura (The University of Tokyo)
Returns
fragment of \(\langle v_1|{\hat H}|v_1\rangle\)
Parameters
[in]org_isite1\(i_1\) of \(c_{i_1 \sigma_1}^\dagger c_{i_2 \sigma_2}\)
[in]org_ispin1\(\sigma_1\) of \(c_{i_1 \sigma_1}^\dagger c_{i_2 \sigma_2}\)
[in]org_isite2\(i_2\) of \(c_{i_1 \sigma_1}^\dagger c_{i_2 \sigma_2}\)
[in]org_ispin2\(\sigma_2\) of \(c_{i_1 \sigma_1}^\dagger c_{i_2 \sigma_2}\)
[in]tmp_transTransfer \(t\)
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1
[in]v1buf
[in]list_1_org
[in]list_1buf_org
[in]list_2_1_target
[in]list_2_2_target

Definition at line 130 of file mltplyMPIHubbard.c.

References BindStruct::Check, BindStruct::Def, exitMPI(), GetOffComp(), CheckList::idim_maxOrg, LargeList::ihfbit, LargeList::ilft, LargeList::irght, BindStruct::Large, LargeList::mode, myrank, SgnBit(), and DefineList::Tpow.

Referenced by GetPairExcitedStateHubbard().

144  {
145 #ifdef MPI
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;
150 
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);
156 
157  state1 = origin & mask1;
158  state2 = origin & mask2;
159 
160  SgnBit((unsigned long int) (origin & bitdiff), &Fsgn); // Fermion sign
161 
162  if (state1 == 0 && state2 == mask2) {
163  trans = -(double) Fsgn * tmp_trans;
164  }/*if (state1 == 0 && state2 == mask2)*/
165  else if (state1 == mask1 && state2 == 0) {
166  trans = -(double) Fsgn * conj(tmp_trans);
167  if (X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC) {
168  trans = 0;
169  }
170  }/*if (state1 == mask1 && state2 == 0)*/
171  else return 0;
172 
173  ierr = MPI_Sendrecv(&X->Check.idim_maxOrg, 1, MPI_UNSIGNED_LONG, origin, 0,
174  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
175  MPI_COMM_WORLD, &statusMPI);
176  if (ierr != 0) exitMPI(-1);
177 
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);
181  if (ierr != 0) exitMPI(-1);
182 
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);
186  if (ierr != 0) exitMPI(-1);
187 
188  if (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC) {
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],
195  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
196  tmp_v0[ioff] += dmv;
197  }/*for (j = 1; j <= idim_max_buf; j++)*/
198  }/*if (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC)*/
199  else return 0.0;
200 
201  return 1.0;
202 #else
203  return 0.0;
204 #endif
205 }/*void child_CisAjt_MPIdouble*/
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.c:86
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
long unsigned int ihfbit
Used for Ogata-Lin ???
Definition: struct.h:345
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int mode
multiply or expectation value.
Definition: struct.h:330
long unsigned int * list_1buf_org
Definition: global.h:54
unsigned long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.h:305
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
long unsigned int ilft
Used for Ogata-Lin ???
Definition: struct.h:344
long unsigned int * list_1_org
Definition: global.h:53
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
Definition: bitcalc.c:195
long unsigned int irght
Used for Ogata-Lin ???
Definition: struct.h:343
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
double complex * v1buf
Definition: global.h:37
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
void SgnBit(const long unsigned int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.c:339
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ X_child_CisAjt_MPIsingle()

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.

Returns
\(\langle v_1|{\hat H}_{\rm this}|v_1\rangle\)
Author
Mitsuaki Kawamura (The University of Tokyo)
Parameters
[in]org_isite1Site 1
[in]org_ispin1Spin 1
[in]org_isite2Site 2
[in]org_ispin2Spin 2
[in]tmp_transHopping integral
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1
[in]v1bufBuffer for sendrecv of wavefunction
[in]list_1_orgSimiller to list_1
[in]list_1buf_orgSimiller to list_1buf
[in]list_2_1_target???
[in]list_2_2_target???

Definition at line 572 of file mltplyMPIHubbard.c.

References BindStruct::Check, BindStruct::Def, exitMPI(), GetOffComp(), CheckList::idim_maxOrg, LargeList::ihfbit, LargeList::ilft, LargeList::irght, BindStruct::Large, LargeList::mode, myrank, DefineList::Nsite, SgnBit(), and DefineList::Tpow.

Referenced by GetPairExcitedStateHubbard().

586  {
587 #ifdef MPI
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;
592  /*
593  Prepare index in the inter PE
594  */
595  mask2 = (int)X->Def.Tpow[2 * org_isite2+org_ispin2];
596  bit2diff = mask2 - 1;
597  origin = myrank ^ mask2;
598 
599  state2 = origin & mask2;
600 
601  SgnBit((unsigned long int) (origin & bit2diff), &Fsgn); // Fermion sign
602 
603  ierr = MPI_Sendrecv(&X->Check.idim_maxOrg, 1, MPI_UNSIGNED_LONG, origin, 0,
604  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
605  MPI_COMM_WORLD, &statusMPI);
606  if (ierr != 0) exitMPI(-1);
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);
610  if (ierr != 0) exitMPI(-1);
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);
614  if (ierr != 0) exitMPI(-1);
615  /*
616  Index in the intra PE
617  */
618  mask1 = X->Def.Tpow[2 * org_isite1 + org_ispin1];
619  if (state2 == mask2) {
620  trans = -(double) Fsgn * tmp_trans;
621  state1check = 0;
622  }
623  else if (state2 == 0) {
624  state1check = mask1;
625  trans = -(double) Fsgn * conj(tmp_trans);
626  }
627  else return 0;
628 
629  bit1diff = X->Def.Tpow[2 * X->Def.Nsite - 1] * 2 - mask1 * 2;
630 
631  if (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC) {
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,
640  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
641  if(ioff !=0){
642  dmv = (double) Fsgn * trans * v1buf[j];
643  tmp_v0[ioff] += dmv;
644  }/*if(ioff !=0)*/
645  }/*if (state1 == state1check)*/
646  }/*for (j = 1; j <= idim_max_buf; j++)*/
647  }/*if (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC)*/
648  else return 0;
649 
650  return 1;
651 #else
652  return 0.0;
653 #endif
654 }/*double complex child_general_hopp_MPIsingle*/
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.c:86
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
long unsigned int ihfbit
Used for Ogata-Lin ???
Definition: struct.h:345
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int mode
multiply or expectation value.
Definition: struct.h:330
long unsigned int * list_1buf_org
Definition: global.h:54
unsigned long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.h:305
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
long unsigned int ilft
Used for Ogata-Lin ???
Definition: struct.h:344
long unsigned int * list_1_org
Definition: global.h:53
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
Definition: bitcalc.c:195
long unsigned int irght
Used for Ogata-Lin ???
Definition: struct.h:343
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
double complex * v1buf
Definition: global.h:37
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
void SgnBit(const long unsigned int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.c:339
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ X_child_general_hopp_MPIdouble()

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 process region.

Returns
\(\langle v_1|{\hat H}_{\rm this}|v_1\rangle\)
Author
Mitsuaki Kawamura (The University of Tokyo)
Parameters
[in]org_isite1Site 1
[in]org_ispin1Spin 1
[in]org_isite2Site 2
[in]org_ispin2Spin 2
[in]tmp_transHopping integral
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 355 of file mltplyMPIHubbard.c.

References BindStruct::Check, BindStruct::Def, exitMPI(), GetOffComp(), CheckList::idim_max, LargeList::ihfbit, LargeList::ilft, LargeList::irght, BindStruct::Large, list_1, list_1buf, list_2_1, list_2_2, LargeList::mode, myrank, SgnBit(), DefineList::Tpow, and v1buf.

Referenced by child_general_hopp_MPIdouble(), expec_cisajs_Hubbard(), and GetPairExcitedStateHubbard().

364  {
365 #ifdef MPI
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;
370 
371  mask1 = (int) X->Def.Tpow[2 * org_isite1 + org_ispin1];
372  mask2 = (int) X->Def.Tpow[2 * org_isite2 + org_ispin2];
373 
374  if (mask2 > mask1) bitdiff = mask2 - mask1 * 2;
375  else bitdiff = mask1 - mask2 * 2;
376  origin = myrank ^ (mask1 + mask2);
377 
378  state1 = origin & mask1;
379  state2 = origin & mask2;
380 
381  SgnBit((unsigned long int) (origin & bitdiff), &Fsgn); // Fermion sign
382 
383  if (state1 == 0 && state2 == mask2) {
384  trans = -(double) Fsgn * tmp_trans;
385  }
386  else if (state1 == mask1 && state2 == 0) {
387  trans = -(double) Fsgn * conj(tmp_trans);
388  if (X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC) trans = 0;
389  }
390  else return 0;
391 
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);
395  if (ierr != 0) exitMPI(-1);
396  ierr = MPI_Sendrecv(list_1, X->Check.idim_max + 1, MPI_UNSIGNED_LONG, origin, 0,
397  list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
398  MPI_COMM_WORLD, &statusMPI);
399  if (ierr != 0) exitMPI(-1);
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);
403  if (ierr != 0) exitMPI(-1);
404 
405  dam_pr = 0.0;
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)
408  {
409  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
410 #pragma omp for
411  for (j = 1; j <= idim_max_buf; j++) {
413  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
414  dmv = trans * v1buf[j];
415  tmp_v0[ioff] += dmv;
416  dam_pr += conj(tmp_v1[ioff]) * dmv;
417  }/*for (j = 1; j <= idim_max_buf; j++)*/
418  }/*if (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC)*/
419  else {
420 #pragma omp for
421  for (j = 1; j <= idim_max_buf; j++) {
423  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
424  dmv = trans * v1buf[j];
425  dam_pr += conj(tmp_v1[ioff]) * dmv;
426  }/*for (j = 1; j <= idim_max_buf; j++)*/
427  }/*for (j = 1; j <= idim_max_buf; j++)*/
428  }/*End of parallel region*/
429  return (dam_pr);
430 #else
431  return 0.0;
432 #endif
433 }/*void child_general_hopp_MPIdouble*/
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.c:86
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
long unsigned int ihfbit
Used for Ogata-Lin ???
Definition: struct.h:345
unsigned long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.h:303
long unsigned int * list_1buf
Definition: global.h:48
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int mode
multiply or expectation value.
Definition: struct.h:330
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
long unsigned int ilft
Used for Ogata-Lin ???
Definition: struct.h:344
long unsigned int * list_2_1
Definition: global.h:49
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
Definition: bitcalc.c:195
long unsigned int * list_1
Definition: global.h:47
long unsigned int * list_2_2
Definition: global.h:50
long unsigned int irght
Used for Ogata-Lin ???
Definition: struct.h:343
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
double complex * v1buf
Definition: global.h:37
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
void SgnBit(const long unsigned int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.c:339
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ X_child_general_hopp_MPIsingle()

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.

Returns
\(\langle v_1|{\hat H}_{\rm this}|v_1\rangle\)
Author
Mitsuaki Kawamura (The University of Tokyo)
Parameters
[in]org_isite1Site 1
[in]org_ispin1Spin 1
[in]org_isite2Site 2
[in]org_ispin2Spin 2
[in]tmp_transHopping integral
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 460 of file mltplyMPIHubbard.c.

References BindStruct::Check, BindStruct::Def, exitMPI(), GetOffComp(), CheckList::idim_max, LargeList::ihfbit, LargeList::ilft, LargeList::irght, BindStruct::Large, list_1, list_1buf, list_2_1, list_2_2, LargeList::mode, myrank, DefineList::Nsite, SgnBit(), DefineList::Tpow, and v1buf.

Referenced by child_general_hopp_MPIsingle(), expec_cisajs_Hubbard(), and GetPairExcitedStateHubbard().

469  {
470 #ifdef MPI
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;
475  /*
476  Prepare index in the inter PE
477  */
478  mask2 = (int)X->Def.Tpow[2 * org_isite2+org_ispin2];
479  bit2diff = mask2 - 1;
480  origin = myrank ^ mask2;
481 
482  state2 = origin & mask2;
483 
484  SgnBit((unsigned long int) (origin & bit2diff), &Fsgn); // Fermion sign
485 
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);
489  if (ierr != 0) exitMPI(-1);
490  ierr = MPI_Sendrecv(list_1, X->Check.idim_max + 1, MPI_UNSIGNED_LONG, origin, 0,
491  list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
492  MPI_COMM_WORLD, &statusMPI);
493  if (ierr != 0) exitMPI(-1);
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);
497  if (ierr != 0) exitMPI(-1);
498  /*
499  Index in the intra PE
500  */
501  mask1 = X->Def.Tpow[2 * org_isite1 + org_ispin1];
502  if (state2 == mask2) {
503  trans = -(double) Fsgn * tmp_trans;
504  state1check = 0;
505  }
506  else if (state2 == 0) {
507  state1check = mask1;
508  trans = -(double) Fsgn * conj(tmp_trans);
509  if (X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC) {
510  trans = 0;
511  }
512  }
513  else return 0;
514 
515  bit1diff = X->Def.Tpow[2 * X->Def.Nsite - 1] * 2 - mask1 * 2;
516 
517  dam_pr = 0.0;
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)
520  {
521  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
522 #pragma omp for
523  for (j = 1; j <= idim_max_buf; j++) {
524 
525  jreal = list_1buf[j];
526  state1 = jreal & mask1;
527 
528  if (state1 == state1check) {
529  SgnBit(jreal & bit1diff, &Fsgn);
530  GetOffComp(list_2_1, list_2_2, jreal ^ mask1,
531  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
532 
533  dmv = (double)Fsgn * trans * v1buf[j];
534  tmp_v0[ioff] += dmv;
535  dam_pr += conj(tmp_v1[ioff]) * dmv;
536  }/*if (state1 == state1check)*/
537  }/*for (j = 1; j <= idim_max_buf; j++)*/
538  }/*if (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC)*/
539  else {
540 #pragma omp for
541  for (j = 1; j <= idim_max_buf; j++) {
542 
543  jreal = list_1buf[j];
544  state1 = jreal & mask1;
545 
546  if (state1 == state1check) {
547  SgnBit(jreal & bit1diff, &Fsgn);
548  GetOffComp(list_2_1, list_2_2, jreal ^ mask1,
549  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
550 /*
551  if(X->Large.mode==M_CORR){
552  printf("DEBUG: myrank=%d, org=%d, bit=%d, iexchg=%d, ioff=%d, list_1=%d\n", myrank, jreal, state1, jreal ^ mask1, ioff, list_1[ioff]);
553  }
554 */
555  dmv = (double)Fsgn * trans * v1buf[j];
556  dam_pr += conj(tmp_v1[ioff]) * dmv;
557  }/*if (state1 == state1check)*/
558  }/*for (j = 1; j <= idim_max_buf; j++)*/
559  }/*if (! (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC))*/
560  }/*End of parallel region*/
561  return (dam_pr);
562 #else
563  return 0.0;
564 #endif
565 }/*double complex child_general_hopp_MPIsingle*/
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.c:86
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
long unsigned int ihfbit
Used for Ogata-Lin ???
Definition: struct.h:345
unsigned long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.h:303
long unsigned int * list_1buf
Definition: global.h:48
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int mode
multiply or expectation value.
Definition: struct.h:330
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
long unsigned int ilft
Used for Ogata-Lin ???
Definition: struct.h:344
long unsigned int * list_2_1
Definition: global.h:49
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
Definition: bitcalc.c:195
long unsigned int * list_1
Definition: global.h:47
long unsigned int * list_2_2
Definition: global.h:50
long unsigned int irght
Used for Ogata-Lin ???
Definition: struct.h:343
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
double complex * v1buf
Definition: global.h:37
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
void SgnBit(const long unsigned int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.c:339
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ X_GC_child_general_hopp_MPIdouble()

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.

Author
Mitsuaki Kawamura (The University of Tokyo)
Returns
fragment of \(\langle v_1|{\hat H}|v_1\rangle\)
Parameters
[in]org_isite1\(i_1\) of \(c_{i_1 \sigma_1}^\dagger c_{i_2 \sigma_2}\)
[in]org_ispin1\(\sigma_1\) of \(c_{i_1 \sigma_1}^\dagger c_{i_2 \sigma_2}\)
[in]org_isite2\(i_2\) of \(c_{i_1 \sigma_1}^\dagger c_{i_2 \sigma_2}\)
[in]org_ispin2\(\sigma_2\) of \(c_{i_1 \sigma_1}^\dagger c_{i_2 \sigma_2}\)
[in]tmp_transTransfer \(t\)
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 54 of file mltplyMPIHubbard.c.

References BindStruct::Check, BindStruct::Def, exitMPI(), CheckList::idim_max, BindStruct::Large, LargeList::mode, myrank, SgnBit(), DefineList::Tpow, and v1buf.

Referenced by expec_cisajs_HubbardGC(), GC_child_general_hopp_MPIdouble(), GetPairExcitedStateHubbardGC(), and X_GC_child_CisAjt_Hubbard_MPI().

63  {
64 #ifdef MPI
65  int mask1, mask2, state1, state2, ierr, origin, bitdiff, Fsgn;
66  unsigned long int idim_max_buf, j;
67  MPI_Status statusMPI;
68  double complex trans, dmv, dam_pr;
69 
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);
75 
76  state1 = origin & mask1;
77  state2 = origin & mask2;
78 
79  SgnBit((unsigned long int) (origin & bitdiff), &Fsgn); // Fermion sign
80 
81  if (state1 == 0 && state2 == mask2) {
82  trans = -(double)Fsgn * tmp_trans;
83  }/*if (state1 == 0 && state2 == mask2)*/
84  else if (state1 == mask1 && state2 == 0) {
85  trans = -(double)Fsgn * conj(tmp_trans);
86  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) trans = 0.0;
87  }/*if (state1 == mask1 && state2 == 0)*/
88  else return 0.0;
89 
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);
93  if (ierr != 0) exitMPI(-1);
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);
97  if (ierr != 0) exitMPI(-1);
98 
99  dam_pr = 0.0;
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)
102  {
103  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
104 #pragma omp for
105  for (j = 1; j <= idim_max_buf; j++) {
106  dmv = trans * v1buf[j];
107  tmp_v0[j] += dmv;
108  dam_pr += conj(tmp_v1[j]) * dmv;
109  }/*for (j = 1; j <= idim_max_buf; j++)*/
110  }/*if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC)*/
111  else {
112 #pragma omp for
113  for (j = 1; j <= idim_max_buf; j++) {
114  dmv = trans * v1buf[j];
115  dam_pr += conj(tmp_v1[j]) * dmv;
116  }/*for (j = 1; j <= idim_max_buf; j++)*/
117  }
118  }/*End of parallel region*/
119  return (dam_pr);
120 #else
121  return 0.0;
122 #endif
123 }/*void GC_child_general_hopp_MPIdouble*/
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.c:86
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
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int mode
multiply or expectation value.
Definition: struct.h:330
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
double complex * v1buf
Definition: global.h:37
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
void SgnBit(const long unsigned int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.c:339
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ X_GC_child_general_hopp_MPIsingle()

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.

Returns
\(\langle v_1|{\hat H}_{\rm this}|v_1\rangle\)
Author
Mitsuaki Kawamura (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]org_isite1Site 1
[in]org_ispin1Spin 1
[in]org_isite2Site 2
[in]org_ispin2Spin 2
[in]tmp_transHopping integral
[in,out]X
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 233 of file mltplyMPIHubbard.c.

References BindStruct::Check, BindStruct::Def, exitMPI(), CheckList::idim_max, BindStruct::Large, LargeList::mode, myrank, DefineList::Nsite, SgnBit(), DefineList::Tpow, and v1buf.

Referenced by expec_cisajs_HubbardGC(), GC_child_general_hopp_MPIsingle(), GetPairExcitedStateHubbardGC(), and X_GC_child_CisAjt_Hubbard_MPI().

242  {
243 #ifdef MPI
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;
248  /*
249  Prepare index in the inter PE
250  */
251  mask2 = (int) X->Def.Tpow[2 * org_isite2 + org_ispin2];
252  bit2diff = mask2 - 1;
253  origin = myrank ^ mask2;
254  state2 = origin & mask2;
255 
256  SgnBit((unsigned long int) (origin & bit2diff), &Fsgn); // Fermion sign
257 
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);
261  if (ierr != 0) exitMPI(-1);
262 
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);
266  if (ierr != 0) exitMPI(-1);
267 
268  /*
269  Index in the intra PE
270  */
271  mask1 = X->Def.Tpow[2 * org_isite1 + org_ispin1];
272 
273  if (state2 == mask2) {
274  trans = -(double) Fsgn * tmp_trans;
275  state1check = 0;
276  }/*if (state2 == mask2)*/
277  else if (state2 == 0) {
278  state1check = mask1;
279  trans = -(double) Fsgn * conj(tmp_trans);
280  if (X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC) trans = 0;
281  }/*if (state2 != mask2)*/
282  else return 0;
283 
284  bit1diff = X->Def.Tpow[2 * X->Def.Nsite - 1] * 2 - mask1 * 2;
285 
286  dam_pr = 0.0;
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)
289  {
290  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
291 #pragma omp for
292  for (j = 0; j < idim_max_buf; j++) {
293 
294  state1 = j & mask1;
295 
296  if (state1 == state1check) {
297 
298  SgnBit(j & bit1diff, &Fsgn);
299  ioff = j ^ mask1;
300 
301  dmv = (double)Fsgn * trans * v1buf[j + 1];
302  tmp_v0[ioff + 1] += dmv;
303  dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
304  }/*if (state1 == state1check)*/
305  }/*for (j = 0; j < idim_max_buf; j++)*/
306  }/*if (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC)*/
307  else {
308 #pragma omp for
309  for (j = 0; j < idim_max_buf; j++) {
310 
311  state1 = j & mask1;
312 
313  if (state1 == state1check) {
314 
315  SgnBit(j & bit1diff, &Fsgn);
316  ioff = j ^ mask1;
317 
318  dmv = (double)Fsgn * trans * v1buf[j + 1];
319  dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
320  }/*for (j = 0; j < idim_max_buf; j++)*/
321  }/*for (j = 0; j < idim_max_buf; j++)*/
322  }/*if (! (X->Large.mode == M_MLTPLY|| X->Large.mode == M_CALCSPEC))*/
323  }/*End of parallel region*/
324  return (dam_pr);
325 #else
326  return 0.0;
327 #endif
328 }/*void GC_child_general_hopp_MPIsingle*/
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.c:86
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
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int mode
multiply or expectation value.
Definition: struct.h:330
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 myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
double complex * v1buf
Definition: global.h:37
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
void SgnBit(const long unsigned int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.c:339
+ Here is the call graph for this function:
+ Here is the caller graph for this function: