19 #include "bitcalc.hpp" 20 #include "wrapperMPI.hpp" 21 #include "mltplyHubbard.hpp" 22 #include "mltplyHubbardCore.hpp" 23 #include "mltplySpinCore.hpp" 24 #include "mltplyMPIHubbard.hpp" 25 #include "mltplyMPISpinCore.hpp" 26 #include "common/setmemory.hpp" 27 #include "mltplyCommon.hpp" 52 std::complex<double> **Xvec,
53 std::complex<double> **vec,
54 std::complex<double> **prod
57 long int org_isite1, org_isite2, org_sigma1, org_sigma2;
61 std::complex<double> tmp_OneGreen = 1.0;
62 int complex_conj, istate;
67 zclear(i_max*nstate, &Xvec[1][0]);
75 if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2) {
76 if (org_sigma1 == 0) {
77 is = X->
Def.
Tpow[2 * org_isite1 - 2];
80 is = X->
Def.
Tpow[2 * org_isite1 - 1];
82 ibit = (
long int)
myrank & is;
84 zaxpy_long(i_max*nstate, tmp_OneGreen, &vec[1][0], &Xvec[1][0]);
89 -tmp_OneGreen, X, nstate, Xvec, vec);
93 if (org_isite1 < org_isite2) {
95 -tmp_OneGreen, X, nstate, Xvec, vec);
99 -tmp_OneGreen, X, nstate, Xvec, vec);
111 if (complex_conj == 1)
112 for (istate = 0; istate < nstate; istate++) prod[i][istate] = conj(prod[i][istate]);
128 std::complex<double> **Xvec,
129 std::complex<double> **vec,
130 std::complex<double> **prod
133 long int org_isite1, org_isite2, org_sigma1, org_sigma2;
135 int num1, one = 1, complex_conj, istate;
138 std::complex<double> tmp_OneGreen = 1.0, dmv;
142 zclear(i_max*nstate, &Xvec[1][0]);
150 if (org_sigma1 != org_sigma2) {
168 if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2) {
169 is = X->
Def.
Tpow[2 * org_isite1 - 2 + org_sigma1];
170 ibit = (
long int)
myrank & is;
172 zaxpy_long(i_max*nstate, tmp_OneGreen, &vec[1][0], &Xvec[1][0]);
177 -tmp_OneGreen, X, nstate, Xvec, vec);
181 if (org_isite1 < org_isite2) {
183 -tmp_OneGreen, X, nstate, Xvec, vec);
187 -tmp_OneGreen, X, nstate, Xvec, vec);
195 if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2) {
196 is = X->
Def.
Tpow[2 * org_isite1 - 2 + org_sigma1];
198 #pragma omp parallel for default(none) shared(list_1, vec,Xvec,nstate,one,tmp_OneGreen) \ 199 firstprivate(i_max, is) private(num1, ibit, dmv) 200 for (j = 1; j <= i_max; j++) {
203 dmv = (std::complex<double>)num1;
204 zaxpy_(&nstate, &dmv, vec[j], &one, Xvec[j], &one);
212 if (complex_conj == 1)
213 for (istate = 0; istate < nstate; istate++) prod[i][istate] = conj(prod[i][istate]);
229 std::complex<double> **Xvec,
230 std::complex<double> **vec,
231 std::complex<double> **prod
235 long int org_isite1, org_isite2, org_sigma1, org_sigma2;
236 std::complex<double> dmv;
245 zclear(i_max*nstate, &Xvec[1][0]);
251 if (org_sigma1 == org_sigma2) {
252 if (org_isite1 == org_isite2) {
254 is1_up = X->
Def.
Tpow[org_isite1 - 1];
257 zaxpy_long(i_max*nstate, 1.0, &vec[1][0], &Xvec[1][0]);
261 isite1 = X->
Def.
Tpow[org_isite1 - 1];
262 #pragma omp parallel for default(none) private(j,dmv) \ 263 firstprivate(i_max, isite1, org_sigma1, X) shared(vec,Xvec,nstate,one) 264 for (j = 1; j <= i_max; j++) {
266 zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[j][0], &one);
287 std::complex<double> **Xvec,
288 std::complex<double> **vec,
289 std::complex<double> **prod
292 long int org_isite1, org_isite2, org_sigma1, org_sigma2;
293 std::complex<double> dmv;
299 zclear(i_max*nstate, &Xvec[1][0]);
305 if (org_isite1 == org_isite2) {
307 if (org_sigma1 == org_sigma2) {
312 zaxpy_long(i_max*nstate, 1.0, &vec[1][0], &Xvec[1][0]);
317 if (org_sigma1 == org_sigma2) {
319 #pragma omp parallel for default(none) private(j, num1,dmv) \ 320 firstprivate(i_max, org_isite1, org_sigma1, X) shared(vec,Xvec, list_1,nstate,one) 321 for (j = 1; j <= i_max; j++) {
323 zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[j][0], &one);
344 std::complex<double> **Xvec,
345 std::complex<double> **vec,
346 std::complex<double> **prod
350 long int org_isite1, org_isite2, org_sigma1, org_sigma2;
351 std::complex<double> dmv;
353 int tmp_sgn, one = 1;
354 long int tmp_off = 0;
359 zclear(i_max*nstate, &Xvec[1][0]);
365 if (org_isite1 == org_isite2) {
367 if (org_sigma1 == org_sigma2) {
375 isite1 = X->
Def.
Tpow[org_isite1 - 1];
377 if (org_sigma1 == org_sigma2) {
379 #pragma omp parallel for default(none) private(j, tmp_sgn,dmv) \ 380 firstprivate(i_max, isite1, org_sigma1, X) shared(vec,Xvec,nstate,one) 381 for (j = 1; j <= i_max; j++) {
383 zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[j][0], &one);
388 #pragma omp parallel for default(none) private(j, tmp_sgn, tmp_off,dmv) \ 389 firstprivate(i_max, isite1, org_sigma2, X) shared(vec,Xvec,nstate,one) 390 for (j = 1; j <= i_max; j++) {
393 dmv = (std::complex<double>)tmp_sgn;
394 zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[tmp_off + 1][0], &one);
416 std::complex<double> **Xvec,
417 std::complex<double> **vec,
418 std::complex<double> **prod
421 long int org_isite1, org_isite2, org_sigma1, org_sigma2;
422 std::complex<double> dmv;
424 long int tmp_off = 0;
430 zclear(i_max*nstate, &Xvec[1][0]);
435 if (org_isite1 == org_isite2) {
437 if (org_sigma1 == org_sigma2) {
440 1.0, X, nstate, Xvec, vec);
445 org_isite1 - 1, org_sigma1, org_sigma2, 1.0, X, nstate, Xvec, vec);
449 if (org_sigma1 == org_sigma2) {
451 #pragma omp parallel for default(none) private(j, num1,dmv) \ 452 firstprivate(i_max, org_isite1, org_sigma1, X) shared(vec,Xvec,nstate,one) 453 for (j = 1; j <= i_max; j++) {
455 dmv = (std::complex<double>)num1;
456 zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[j][0], &one);
461 #pragma omp parallel for default(none) private(j, num1,dmv) \ 462 firstprivate(i_max, org_isite1, org_sigma1, org_sigma2, X,tmp_off) shared(vec,Xvec,nstate,one) 463 for (j = 1; j <= i_max; j++) {
467 dmv = (std::complex<double>)num1;
468 zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[tmp_off + 1][0], &one);
490 std::complex<double> **Xvec,
491 std::complex<double> **vec,
492 std::complex<double> **prod
516 std::complex<double> **Xvec,
517 std::complex<double> **vec,
518 std::complex<double> **prod
547 std::complex<double> **Xvec,
548 std::complex<double> **vec
551 char sdt[D_FileNameMax];
552 std::complex<double> **prod;
553 long int irght, ilft, ihfbit, ica;
556 int step = 0, rand_i = 0, istate;
577 TimeKeeperWithStep(X,
"%s_TimeKeeper.dat",
"step %d:expec_cisajs begins: %s",
"a", step);
584 prod = cd_2d_allocate(X->
Def.
NCisAjt, nstate);
616 for (istate = 0; istate < nstate; istate++) {
620 sprintf(sdt,
"%s_cisajs_set%dstep%d.dat", X->
Def.
CDataFileHead, istate, step);
633 fprintf(fp,
" %4d %4d %4d %4d %.10lf %.10lf\n",
635 real(prod[ica][istate]), imag(prod[ica][istate]));
642 if (X->
Def.
St == 0) {
647 TimeKeeperWithStep(X,
"%s_TimeKeeper.dat",
"step %d:expec_cisajs finishes: %s",
"a", step);
650 else if (X->
Def.
St == 1) {
651 TimeKeeper(X,
"%s_TimeKeeper.dat",
"CG expec_cisajs finishes: %s",
"a");
652 fprintf(
stdoutMPI,
"%s",
" End : Calculate one body Green functions.\n\n");
654 free_cd_2d_allocate(prod);
struct DefineList Def
Definision of system (Hamiltonian) etc.
int St
0 or 1, but it affects nothing.
int expec_cisajs_SpinGC(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
function of calculation for one body green's function for SpinGC model.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
int GetSplitBitByModel(const int Nsite, const int iCalcModel, long int *irght, long int *ilft, long int *ihfbit)
function of splitting original bit into right and left spaces.
int BitCheckGeneral(const long int org_bit, const int org_isite, const int target_ispin, const long int *SiteToBit, const long int *Tpow)
bit check function for general spin
int X_Spin_CisAis(long int j, long int is1_spin, long int sigma1)
Compute the spin state with bit mask is1_spin.
void child_general_hopp(int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, std::complex< double > trans)
Compute hopping (canonical)
int iFlgSzConserved
Flag whether Sz is conserved.
int Nsite
Number of sites in the INTRA process region.
void zaxpy_long(long int n, std::complex< double > a, std::complex< double > *x, std::complex< double > *y)
Wrapper of zaxpy.
int TimeKeeperWithStep(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int istep)
Functions for writing a time log.
int X_SpinGC_CisAis(long int j, long int is1_spin, long int sigma1)
Compute the grandcanonical spin state with bit mask is1_spin.
struct LargeList Large
Variables for Matrix-Vector product.
int * LocSpn
[DefineList::NLocSpn] Flag (and size) of the local spin. malloc in setmem_def().
void X_GC_child_CisAis_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
int expec_cisajs_Spin(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
function of calculation for one body green's function for Spin model.
int expec_cisajs_HubbardGC(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
function of calculation for one body green's function for Hubbard GC model.
int mode
multiply or expectation value.
void X_GC_child_CisAit_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
long int irght
Used for Ogata-Lin ???
int expec_cisajs_SpinHalf(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
function of calculation for one body green's function for Half-Spin model.
int TimeKeeperWithRandAndStep(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int irand, const int istep)
Functions for writing a time log.
long int ilft
Used for Ogata-Lin ???
int NCisAjt
Number of indices of two-body correlation function.
int GetOffCompGeneralSpin(const long int org_ibit, const int org_isite, const int org_ispin, const int off_ispin, long int *_ioffComp, const long int *SiteToBit, const long int *Tpow)
function of getting off-diagonal component for general spin
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...
int expec_cisajs_SpinGeneral(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
function of calculation for one body green's function for General-Spin model.
void zclear(long int n, std::complex< double > *x)
clear std::complex<double> array.
long int ihfbit
Used for Ogata-Lin ???
void X_GC_child_CisAis_spin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
long int i_max
Length of eigenvector.
int myrank
Process ID, defined in InitializeMPI()
int expec_cisajs(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec)
function of calculation for one body green's function
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
void MultiVecProdMPI(long int ndim, int nstate, std::complex< double > **v1, std::complex< double > **v2, std::complex< double > *prod)
Compute conjugate scaler product of process-distributed vector .
void X_GC_child_CisAit_spin_MPIdouble(int org_isite1, int org_ispin1, 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 Spin + GC When both site1 and site2 are in the inter process region.
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
int istep
Index of TPQ step ???
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
int ** CisAjt
[DefineList::NCisAjt][4] Indices of one-body correlation function. malloc in setmem_def().
int expec_cisajs_SpinGCGeneral(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
function of calculation for one body green's function for General SpinGC model.
int child_general_hopp_GetInfo(struct BindStruct *X, long int isite1, long int isite2, long int sigma1, long int sigma2)
Compute mask for bit operation of hopping term.
int X_SpinGC_CisAit(long int j, long int is1_spin, long int sigma2, long int *tmp_off)
Compute index of final wavefunction by term (grandcanonical).
int TimeKeeper(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType)
Functions for writing a time log.
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
void GC_child_general_hopp(int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, std::complex< double > trans)
Commpute hopping term (grandcanonical)
struct CheckList Check
Size of the Hilbert space.
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green's function.
void X_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When both site1 and site2 are in the inter proce...
void X_GC_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + GC When both site1 and site2 are in the inter process region.
void X_GC_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + GC When only site2 is in the inter process region.
int expec_cisajs_SpinGCHalf(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
function of calculation for one body green's function for Half-SpinGC model.
long int idim_max
The dimension of the Hilbert space of this process.
int expec_cisajs_Hubbard(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
function of calculation for one body green's function for Hubbard model.
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.