HPhi++  3.1.0
mltplyMPIHubbard.cpp File Reference

Functions for Hubbard Hamiltonian + MPI. More...

#include "Common.hpp"
#include "bitcalc.hpp"
#include "wrapperMPI.hpp"
#include "mltplyCommon.hpp"
#include "mltplyMPIHubbard.hpp"

Go to the source code of this file.

Functions

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

Detailed Description

Functions for Hubbard Hamiltonian + MPI.

Definition in file mltplyMPIHubbard.cpp.

Function Documentation

◆ child_general_hopp_MPIdouble()

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 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 236 of file mltplyMPIHubbard.cpp.

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

Referenced by mltplyHubbard().

241  {
243  X->Def.EDGeneralTransfer[itrans][0], X->Def.EDGeneralTransfer[itrans][1],
244  X->Def.EDGeneralTransfer[itrans][2], X->Def.EDGeneralTransfer[itrans][3],
245  X->Def.EDParaGeneralTransfer[itrans], X, nstate, tmp_v0, tmp_v1);
246 }/*void child_general_hopp_MPIdouble*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
std::complex< double > * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:116
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.hpp:110
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...

◆ child_general_hopp_MPIsingle()

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.

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 309 of file mltplyMPIHubbard.cpp.

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

Referenced by mltplyHubbard().

314  {
316  X->Def.EDGeneralTransfer[itrans][0], X->Def.EDGeneralTransfer[itrans][1],
317  X->Def.EDGeneralTransfer[itrans][2], X->Def.EDGeneralTransfer[itrans][3],
318  X->Def.EDParaGeneralTransfer[itrans], X, nstate, tmp_v0, tmp_v1);
319 }/*void child_general_hopp_MPIsingle*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
std::complex< double > * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:116
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.hpp:110
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...

◆ GC_child_general_hopp_MPIdouble()

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.

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 30 of file mltplyMPIHubbard.cpp.

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

Referenced by mltplyHubbardGC().

35  {
37  X->Def.EDGeneralTransfer[itrans][0], X->Def.EDGeneralTransfer[itrans][1],
38  X->Def.EDGeneralTransfer[itrans][2], X->Def.EDGeneralTransfer[itrans][3],
39  X->Def.EDParaGeneralTransfer[itrans], X, nstate, tmp_v0, tmp_v1);
40 }/*void GC_child_general_hopp_MPIdouble*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
std::complex< double > * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:116
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.hpp:110
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.

◆ GC_child_general_hopp_MPIsingle()

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.

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 147 of file mltplyMPIHubbard.cpp.

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

Referenced by mltplyHubbardGC().

152  {
154  X->Def.EDGeneralTransfer[itrans][0], X->Def.EDGeneralTransfer[itrans][1],
155  X->Def.EDGeneralTransfer[itrans][2], X->Def.EDGeneralTransfer[itrans][3],
156  X->Def.EDParaGeneralTransfer[itrans], X, nstate, tmp_v0, tmp_v1 );
157 }/*void GC_child_general_hopp_MPIsingle*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
std::complex< double > * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.hpp:116
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.hpp:110
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.

◆ X_child_CisAjt_MPIdouble()

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.

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 92 of file mltplyMPIHubbard.cpp.

References BindStruct::Check, BindStruct::Def, GetOffComp(), CheckList::idim_maxOrg, LargeList::ihfbit, LargeList::ilft, LargeList::irght, BindStruct::Large, list_1_org, list_1buf_org, list_2_1, list_2_2, LargeList::mode, myrank, SendRecv_cv(), SendRecv_i(), SendRecv_iv(), SgnBit(), DefineList::Tpow, and v1buf.

Referenced by GetPairExcitedStateHubbard().

101  {
102  int mask1, mask2, state1, state2, origin, bitdiff, Fsgn;
103  long int idim_max_buf, j, ioff;
104  std::complex<double> trans;
105  int one = 1;
106 
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);
112 
113  state1 = origin & mask1;
114  state2 = origin & mask2;
115 
116  SgnBit((long int) (origin & bitdiff), &Fsgn); // Fermion sign
117 
118  if (state1 == 0 && state2 == mask2) {
119  trans = -(double) Fsgn * tmp_trans;
120  }/*if (state1 == 0 && state2 == mask2)*/
121  else if (state1 == mask1 && state2 == 0) {
122  trans = -(double) Fsgn * conj(tmp_trans);
123  if (X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC) {
124  trans = 0;
125  }
126  }/*if (state1 == mask1 && state2 == 0)*/
127  else return;
128 
129  idim_max_buf = SendRecv_i(origin, X->Check.idim_maxOrg);
130  SendRecv_iv(origin, X->Check.idim_maxOrg + 1, idim_max_buf + 1, list_1_org, list_1buf_org);
131  SendRecv_cv(origin, X->Check.idim_maxOrg*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
132 
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++) {
138  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
139  zaxpy_(&nstate, &trans, &v1buf[j][0], &one, &tmp_v0[ioff][0], &one);
140  }/*for (j = 1; j <= idim_max_buf; j++)*/
141 }/*void child_CisAjt_MPIdouble*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
long int * list_2_1
Definition: global.cpp:27
long int * list_2_2
Definition: global.cpp:28
std::complex< double > ** v1buf
Definition: global.cpp:22
long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.hpp:307
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
long int * list_1_org
Definition: global.cpp:31
int mode
multiply or expectation value.
Definition: struct.hpp:331
long int irght
Used for Ogata-Lin ???
Definition: struct.hpp:344
long int SendRecv_i(int origin, long int isend)
Wrapper of MPI_Sendrecv for long integer number.
Definition: wrapperMPI.cpp:504
long int ilft
Used for Ogata-Lin ???
Definition: struct.hpp:345
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
Definition: bitcalc.cpp:195
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
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...
Definition: wrapperMPI.cpp:424
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
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...
Definition: wrapperMPI.cpp:465
long int * list_1buf_org
Definition: global.cpp:32
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.cpp:338

◆ X_child_CisAjt_MPIsingle()

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.

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 398 of file mltplyMPIHubbard.cpp.

References BindStruct::Check, BindStruct::Def, GetOffComp(), CheckList::idim_maxOrg, LargeList::ihfbit, LargeList::ilft, LargeList::irght, BindStruct::Large, list_1_org, list_1buf_org, list_2_1, list_2_2, myrank, DefineList::Nsite, SendRecv_cv(), SendRecv_i(), SendRecv_iv(), SgnBit(), DefineList::Tpow, and v1buf.

Referenced by GetPairExcitedStateHubbard().

408  {
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;
412  int one = 1;
413  /*
414  Prepare index in the inter PE
415  */
416  mask2 = (int)X->Def.Tpow[2 * org_isite2+org_ispin2];
417  bit2diff = mask2 - 1;
418  origin = myrank ^ mask2;
419 
420  state2 = origin & mask2;
421 
422  SgnBit((long int) (origin & bit2diff), &Fsgn); // Fermion sign
423 
424  idim_max_buf = SendRecv_i(origin, X->Check.idim_maxOrg);
425  SendRecv_iv(origin, X->Check.idim_maxOrg + 1, idim_max_buf + 1, list_1_org, list_1buf_org);
426  SendRecv_cv(origin, X->Check.idim_maxOrg*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
427  /*
428  Index in the intra PE
429  */
430  mask1 = X->Def.Tpow[2 * org_isite1 + org_ispin1];
431  if (state2 == mask2) {
432  trans = -(double) Fsgn * tmp_trans;
433  state1check = 0;
434  }
435  else if (state2 == 0) {
436  state1check = mask1;
437  trans = -(double) Fsgn * conj(tmp_trans);
438  }
439  else return;
440 
441  bit1diff = X->Def.Tpow[2 * X->Def.Nsite - 1] * 2 - mask1 * 2;
442 
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++) {
447  jreal = list_1buf_org[j];
448  state1 = jreal & mask1;
449  if (state1 == state1check) {
450  SgnBit(jreal & bit1diff, &Fsgn);
451  GetOffComp(list_2_1, list_2_2, jreal ^ mask1,
452  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
453  if (ioff != 0) {
454  dmv = (double)Fsgn * trans;
455  zaxpy_(&nstate, &dmv, &v1buf[j][0], &one, &tmp_v0[ioff][0], &one);
456  }/*if(ioff !=0)*/
457  }/*if (state1 == state1check)*/
458  }/*for (j = 1; j <= idim_max_buf; j++)*/
459 }/*std::complex<double> child_general_hopp_MPIsingle*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
long int * list_2_1
Definition: global.cpp:27
long int * list_2_2
Definition: global.cpp:28
std::complex< double > ** v1buf
Definition: global.cpp:22
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.hpp:307
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
long int * list_1_org
Definition: global.cpp:31
long int irght
Used for Ogata-Lin ???
Definition: struct.hpp:344
long int SendRecv_i(int origin, long int isend)
Wrapper of MPI_Sendrecv for long integer number.
Definition: wrapperMPI.cpp:504
long int ilft
Used for Ogata-Lin ???
Definition: struct.hpp:345
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
Definition: bitcalc.cpp:195
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
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...
Definition: wrapperMPI.cpp:424
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
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...
Definition: wrapperMPI.cpp:465
long int * list_1buf_org
Definition: global.cpp:32
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.cpp:338

◆ X_child_general_hopp_MPIdouble()

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

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 252 of file mltplyMPIHubbard.cpp.

References BindStruct::Check, BindStruct::Def, 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, SendRecv_cv(), SendRecv_i(), SendRecv_iv(), SgnBit(), DefineList::Tpow, and v1buf.

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

261  {
262  int mask1, mask2, state1, state2, origin, bitdiff, Fsgn;
263  long int idim_max_buf, j, ioff;
264  std::complex<double> trans;
265  int one = 1;
266 
267  mask1 = (int) X->Def.Tpow[2 * org_isite1 + org_ispin1];
268  mask2 = (int) X->Def.Tpow[2 * org_isite2 + org_ispin2];
269 
270  if (mask2 > mask1) bitdiff = mask2 - mask1 * 2;
271  else bitdiff = mask1 - mask2 * 2;
272  origin = myrank ^ (mask1 + mask2);
273 
274  state1 = origin & mask1;
275  state2 = origin & mask2;
276 
277  SgnBit((long int) (origin & bitdiff), &Fsgn); // Fermion sign
278 
279  if (state1 == 0 && state2 == mask2) {
280  trans = -(double) Fsgn * tmp_trans;
281  }
282  else if (state1 == mask1 && state2 == 0) {
283  trans = -(double) Fsgn * conj(tmp_trans);
284  if (X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC) trans = 0;
285  }
286  else return;
287 
288  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
289  SendRecv_iv(origin, X->Check.idim_max + 1, idim_max_buf + 1, list_1, list_1buf);
290  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
291 
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)
295  {
296 #pragma omp for
297  for (j = 1; j <= idim_max_buf; j++) {
299  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
300  zaxpy_(&nstate, &trans, &v1buf[j][0], &one, &tmp_v0[ioff][0], &one);
301  }/*for (j = 1; j <= idim_max_buf; j++)*/
302  }/*End of parallel region*/
303 }/*void child_general_hopp_MPIdouble*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
long int * list_2_1
Definition: global.cpp:27
long int * list_2_2
Definition: global.cpp:28
std::complex< double > ** v1buf
Definition: global.cpp:22
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
int mode
multiply or expectation value.
Definition: struct.hpp:331
long int irght
Used for Ogata-Lin ???
Definition: struct.hpp:344
long int SendRecv_i(int origin, long int isend)
Wrapper of MPI_Sendrecv for long integer number.
Definition: wrapperMPI.cpp:504
long int * list_1buf
Definition: global.cpp:26
long int ilft
Used for Ogata-Lin ???
Definition: struct.hpp:345
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
Definition: bitcalc.cpp:195
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
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...
Definition: wrapperMPI.cpp:424
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
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...
Definition: wrapperMPI.cpp:465
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
long int * list_1
Definition: global.cpp:25
long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.hpp:305
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.cpp:338

◆ X_child_general_hopp_MPIsingle()

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.

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 325 of file mltplyMPIHubbard.cpp.

References BindStruct::Check, BindStruct::Def, 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, SendRecv_cv(), SendRecv_i(), SendRecv_iv(), SgnBit(), DefineList::Tpow, and v1buf.

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

334  {
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;
338  int one = 1;
339  /*
340  Prepare index in the inter PE
341  */
342  mask2 = (int)X->Def.Tpow[2 * org_isite2+org_ispin2];
343  bit2diff = mask2 - 1;
344  origin = myrank ^ mask2;
345 
346  state2 = origin & mask2;
347 
348  SgnBit((long int) (origin & bit2diff), &Fsgn); // Fermion sign
349 
350  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
351  SendRecv_iv(origin, X->Check.idim_max + 1, idim_max_buf + 1, list_1, list_1buf);
352  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
353  /*
354  Index in the intra PE
355  */
356  mask1 = X->Def.Tpow[2 * org_isite1 + org_ispin1];
357  if (state2 == mask2) {
358  trans = -(double) Fsgn * tmp_trans;
359  state1check = 0;
360  }
361  else if (state2 == 0) {
362  state1check = mask1;
363  trans = -(double) Fsgn * conj(tmp_trans);
364  if (X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC) {
365  trans = 0;
366  }
367  }
368  else return;
369 
370  bit1diff = X->Def.Tpow[2 * X->Def.Nsite - 1] * 2 - mask1 * 2;
371 
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)
375  {
376 #pragma omp for
377  for (j = 1; j <= idim_max_buf; j++) {
378 
379  jreal = list_1buf[j];
380  state1 = jreal & mask1;
381 
382  if (state1 == state1check) {
383  SgnBit(jreal & bit1diff,&Fsgn);
384  GetOffComp(list_2_1, list_2_2, jreal ^ mask1,
385  X->Large.irght, X->Large.ilft, X->Large.ihfbit, &ioff);
386 
387  dmv = (double)Fsgn * trans;
388  zaxpy_(&nstate, &dmv, &v1buf[j][0], &one, &tmp_v0[ioff][0], &one);
389  }/*if (state1 == state1check)*/
390  }/*for (j = 1; j <= idim_max_buf; j++)*/
391  }/*End of parallel region*/
392 }/*std::complex<double> child_general_hopp_MPIsingle*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
long int * list_2_1
Definition: global.cpp:27
long int * list_2_2
Definition: global.cpp:28
std::complex< double > ** v1buf
Definition: global.cpp:22
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
int mode
multiply or expectation value.
Definition: struct.hpp:331
long int irght
Used for Ogata-Lin ???
Definition: struct.hpp:344
long int SendRecv_i(int origin, long int isend)
Wrapper of MPI_Sendrecv for long integer number.
Definition: wrapperMPI.cpp:504
long int * list_1buf
Definition: global.cpp:26
long int ilft
Used for Ogata-Lin ???
Definition: struct.hpp:345
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
Definition: bitcalc.cpp:195
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
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...
Definition: wrapperMPI.cpp:424
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
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...
Definition: wrapperMPI.cpp:465
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
long int * list_1
Definition: global.cpp:25
long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.hpp:305
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.cpp:338

◆ X_GC_child_general_hopp_MPIdouble()

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.

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 47 of file mltplyMPIHubbard.cpp.

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

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

56  {
57  int mask1, mask2, state1, state2, origin, bitdiff, Fsgn;
58  long int idim_max_buf;
59  std::complex<double> trans;
60 
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);
66 
67  state1 = origin & mask1;
68  state2 = origin & mask2;
69 
70  SgnBit((long int) (origin & bitdiff), &Fsgn); // Fermion sign
71 
72  if (state1 == 0 && state2 == mask2) {
73  trans = -(double)Fsgn * tmp_trans;
74  }/*if (state1 == 0 && state2 == mask2)*/
75  else if (state1 == mask1 && state2 == 0) {
76  trans = -(double)Fsgn * conj(tmp_trans);
77  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) trans = 0.0;
78  }/*if (state1 == mask1 && state2 == 0)*/
79  else return;
80 
81  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
82  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
83 
84  zaxpy_long(X->Check.idim_max*nstate, trans, &v1buf[1][0], &tmp_v0[1][0]);
85 }/*void GC_child_general_hopp_MPIdouble*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
std::complex< double > ** v1buf
Definition: global.cpp:22
void zaxpy_long(long int n, std::complex< double > a, std::complex< double > *x, std::complex< double > *y)
Wrapper of zaxpy.
Definition: mltply.cpp:128
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
int mode
multiply or expectation value.
Definition: struct.hpp:331
long int SendRecv_i(int origin, long int isend)
Wrapper of MPI_Sendrecv for long integer number.
Definition: wrapperMPI.cpp:504
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
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...
Definition: wrapperMPI.cpp:424
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.hpp:305
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.cpp:338

◆ X_GC_child_general_hopp_MPIsingle()

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.

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 164 of file mltplyMPIHubbard.cpp.

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

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

173  {
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;
177  int one = 1;
178  /*
179  Prepare index in the inter PE
180  */
181  mask2 = (int) X->Def.Tpow[2 * org_isite2 + org_ispin2];
182  bit2diff = mask2 - 1;
183  origin = myrank ^ mask2;
184  state2 = origin & mask2;
185 
186  SgnBit((long int) (origin & bit2diff), &Fsgn); // Fermion sign
187 
188  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
189 
190  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
191 
192  /*
193  Index in the intra PE
194  */
195  mask1 = X->Def.Tpow[2 * org_isite1 + org_ispin1];
196 
197  if (state2 == mask2) {
198  trans = -(double) Fsgn * tmp_trans;
199  state1check = 0;
200  }/*if (state2 == mask2)*/
201  else if (state2 == 0) {
202  state1check = mask1;
203  trans = -(double) Fsgn * conj(tmp_trans);
204  if (X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC) trans = 0;
205  }/*if (state2 != mask2)*/
206  else return;
207 
208  bit1diff = X->Def.Tpow[2 * X->Def.Nsite - 1] * 2 - mask1 * 2;
209 
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)
213  {
214 #pragma omp for
215  for (j = 0; j < idim_max_buf; j++) {
216 
217  state1 = j & mask1;
218 
219  if (state1 == state1check) {
220 
221  SgnBit(j & bit1diff, &Fsgn);
222  ioff = j ^ mask1;
223 
224  dmv = (double)Fsgn * trans;
225  zaxpy_(&nstate, &dmv, &v1buf[j + 1][0], &one, &tmp_v0[ioff + 1][0], &one);
226  }/*if (state1 == state1check)*/
227  }/*for (j = 0; j < idim_max_buf; j++)*/
228 
229  }/*End of parallel region*/
230 }/*void GC_child_general_hopp_MPIsingle*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
std::complex< double > ** v1buf
Definition: global.cpp:22
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
int mode
multiply or expectation value.
Definition: struct.hpp:331
long int SendRecv_i(int origin, long int isend)
Wrapper of MPI_Sendrecv for long integer number.
Definition: wrapperMPI.cpp:504
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
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...
Definition: wrapperMPI.cpp:424
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.hpp:305
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.cpp:338