HΦ  3.2.0
expec_cisajscktaltdc.c
Go to the documentation of this file.
1 /* HPhi - Quantum Lattice Model Simulator */
2 /* Copyright (C) 2015 The University of Tokyo */
3 
4 /* This program is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU General Public License as published by */
6 /* the Free Software Foundation, either version 3 of the License, or */
7 /* (at your option) any later version. */
8 
9 /* This program is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU General Public License for more details. */
13 
14 /* You should have received a copy of the GNU General Public License */
15 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 
17 #include "mltply.h"
18 #include "mltplyCommon.h"
19 #include "FileIO.h"
20 #include "bitcalc.h"
21 #include "expec_cisajscktaltdc.h"
22 #include "mltplySpinCore.h"
23 #include "mltplyHubbardCore.h"
24 #include "wrapperMPI.h"
25 #include "mltplyMPISpin.h"
26 #include "mltplyMPISpinCore.h"
27 #include "mltplyMPIHubbardCore.h"
28 
43 int expec_cisajscktalt_HubbardGC(struct BindStruct *X,double complex *vec, FILE **_fp);
44 int expec_cisajscktalt_Hubbard(struct BindStruct *X,double complex *vec, FILE **_fp);
45 
46 int expec_cisajscktalt_Spin(struct BindStruct *X,double complex *vec, FILE **_fp);
47 int expec_cisajscktalt_SpinHalf(struct BindStruct *X,double complex *vec, FILE **_fp);
48 int expec_cisajscktalt_SpinGeneral(struct BindStruct *X,double complex *vec, FILE **_fp);
49 
50 int expec_cisajscktalt_SpinGC(struct BindStruct *X,double complex *vec, FILE **_fp);
51 int expec_cisajscktalt_SpinGCHalf(struct BindStruct *X,double complex *vec, FILE **_fp);
52 int expec_cisajscktalt_SpinGCGeneral(struct BindStruct *X,double complex *vec, FILE **_fp);
53 
55  int i,
56  long unsigned int *org_isite1,
57  long unsigned int *org_isite2,
58  long unsigned int *org_isite3,
59  long unsigned int *org_isite4,
60  long unsigned int *org_sigma1,
61  long unsigned int *org_sigma2,
62  long unsigned int *org_sigma3,
63  long unsigned int *org_sigma4,
64  double complex *tmp_V,
65  struct BindStruct *X
66 );
85 (
86  struct BindStruct *X,
87  double complex *vec
88  )
89 {
90 
91  FILE *fp;
92  char sdt[D_FileNameMax];
93  long unsigned int irght,ilft,ihfbit;
94 
95  //For TPQ
96  int step=0;
97  int rand_i=0;
98 
99  if(X->Def.NCisAjtCkuAlvDC <1) return 0;
100  X->Large.mode=M_CORR;
101 
102  if(GetSplitBitByModel(X->Def.Nsite, X->Def.iCalcModel, &irght, &ilft, &ihfbit)!=0){
103  return -1;
104  }
105 
106  //Make File Name for output
107  switch (X->Def.iCalcType){
108  case Lanczos:
109  if(X->Def.St==0){
110  sprintf(sdt, cFileName2BGreen_Lanczos, X->Def.CDataFileHead);
113  }else if(X->Def.St==1){
114  sprintf(sdt, cFileName2BGreen_CG, X->Def.CDataFileHead);
117  }
118  break;
119 
120  case TPQCalc:
121  step=X->Def.istep;
122  rand_i=X->Def.irand;
124  sprintf(sdt, cFileName2BGreen_TPQ, X->Def.CDataFileHead, rand_i, step);
125  break;
126 
127  case TimeEvolution:
128  step=X->Def.istep;
130  sprintf(sdt, cFileName2BGreen_TE, X->Def.CDataFileHead, step);
131  break;
132 
133  case FullDiag:
134  case CG:
136  break;
137  }
138 
139  if(childfopenMPI(sdt, "w", &fp)!=0){
140  return -1;
141  }
142 
143  switch(X->Def.iCalcModel){
144  case HubbardGC:
145  if(expec_cisajscktalt_HubbardGC(X, vec, &fp)!=0){
146  return -1;
147  }
148  break;
149 
150  case KondoGC:
151  case Hubbard:
152  case Kondo:
153  if(expec_cisajscktalt_Hubbard(X, vec, &fp)!=0){
154  return -1;
155  }
156  break;
157 
158  case Spin:
159  if(expec_cisajscktalt_Spin(X, vec, &fp)!=0){
160  return -1;
161  }
162  break;
163 
164  case SpinGC:
165  if(expec_cisajscktalt_SpinGC(X, vec, &fp)!=0){
166  return -1;
167  }
168  break;
169 
170  default:
171  return -1;
172  }
173 
174  fclose(fp);
175 
176  if(X->Def.iCalcType==Lanczos){
177  if(X->Def.St==0){
180  }else if(X->Def.St==1){
182  fprintf(stdoutMPI, "%s", cLogCGExpecTwoBodyGFinish);
183  }
184  }
185  else if(X->Def.iCalcType==TPQCalc){
187  }
188  else if(X->Def.iCalcType==TimeEvolution){
190  }
191  //[s] this part will be added
192  /* For FullDiag, it is convinient to calculate the total spin for each vector.
193  Such functions will be added
194  if(X->Def.iCalcType==FullDiag){
195  if(X->Def.iCalcModel==Spin){
196  expec_cisajscktaltdc_alldiag_spin(X,vec);
197  }else if(X->Def.iCalcModel==Hubbard || X->Def.iCalcModel==Kondo){
198  expec_cisajscktaltdc_alldiag(X,vec);
199  }else{//
200  X->Phys.s2=0.0;
201  }
202  }
203  */
204  //[e]
205  return 0;
206 }
207 
224  int i,
225  long unsigned int *org_isite1,
226  long unsigned int *org_isite2,
227  long unsigned int *org_isite3,
228  long unsigned int *org_isite4,
229  long unsigned int *org_sigma1,
230  long unsigned int *org_sigma2,
231  long unsigned int *org_sigma3,
232  long unsigned int *org_sigma4,
233  double complex *tmp_V,
234  struct BindStruct *X
235  )
236 {
237  long unsigned int tmp_org_isite1,tmp_org_isite2,tmp_org_isite3,tmp_org_isite4;
238  long unsigned int tmp_org_sigma1,tmp_org_sigma2,tmp_org_sigma3,tmp_org_sigma4;
239 
240  tmp_org_isite1 = X->Def.CisAjtCkuAlvDC[i][0]+1;
241  tmp_org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
242  tmp_org_isite2 = X->Def.CisAjtCkuAlvDC[i][2]+1;
243  tmp_org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
244  tmp_org_isite3 = X->Def.CisAjtCkuAlvDC[i][4]+1;
245  tmp_org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
246  tmp_org_isite4 = X->Def.CisAjtCkuAlvDC[i][6]+1;
247  tmp_org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
248 
249  if(tmp_org_isite1==tmp_org_isite2 && tmp_org_isite3==tmp_org_isite4){
250  if(tmp_org_isite1 > tmp_org_isite3){
251  *org_isite1 = tmp_org_isite3;
252  *org_sigma1 = tmp_org_sigma3;
253  *org_isite2 = tmp_org_isite4;
254  *org_sigma2 = tmp_org_sigma4;
255  *org_isite3 = tmp_org_isite1;
256  *org_sigma3 = tmp_org_sigma1;
257  *org_isite4 = tmp_org_isite2;
258  *org_sigma4 = tmp_org_sigma2;
259  }
260  else{
261  *org_isite1 = tmp_org_isite1;
262  *org_sigma1 = tmp_org_sigma1;
263  *org_isite2 = tmp_org_isite2;
264  *org_sigma2 = tmp_org_sigma2;
265  *org_isite3 = tmp_org_isite3;
266  *org_sigma3 = tmp_org_sigma3;
267  *org_isite4 = tmp_org_isite4;
268  *org_sigma4 = tmp_org_sigma4;
269  }
270  *tmp_V = 1.0;
271 
272  }
273  else if(tmp_org_isite1==tmp_org_isite4 && tmp_org_isite3==tmp_org_isite2){
274  if(tmp_org_isite1 > tmp_org_isite3){
275  *org_isite1 = tmp_org_isite3;
276  *org_sigma1 = tmp_org_sigma3;
277  *org_isite2 = tmp_org_isite2;
278  *org_sigma2 = tmp_org_sigma2;
279  *org_isite3 = tmp_org_isite1;
280  *org_sigma3 = tmp_org_sigma1;
281  *org_isite4 = tmp_org_isite4;
282  *org_sigma4 = tmp_org_sigma4;
283  }
284  else{
285  *org_isite1 = tmp_org_isite1;
286  *org_sigma1 = tmp_org_sigma1;
287  *org_isite2 = tmp_org_isite4;
288  *org_sigma2 = tmp_org_sigma4;
289  *org_isite3 = tmp_org_isite3;
290  *org_sigma3 = tmp_org_sigma3;
291  *org_isite4 = tmp_org_isite2;
292  *org_sigma4 = tmp_org_sigma2;
293  }
294  *tmp_V =-1.0;
295  }
296  else{
297  return -1;
298  }
299  return 0;
300 }
301 
312 int expec_cisajscktalt_HubbardGC(struct BindStruct *X,double complex *vec, FILE **_fp){
313  long unsigned int i,j;
314  long unsigned int isite1,isite2,isite3,isite4;
315  long unsigned int org_isite1,org_isite2,org_isite3,org_isite4;
316  long unsigned int org_sigma1,org_sigma2,org_sigma3,org_sigma4;
317  long unsigned int Asum,Bsum,Adiff,Bdiff;
318  long unsigned int tmp_off=0;
319  long unsigned int tmp_off_2=0;
320  double complex tmp_V= 1.0+0.0*I;
321  ;
322  double complex dam_pr;
323  long int i_max;
324 
325  for(i=0;i<X->Def.NCisAjtCkuAlvDC;i++){
326  org_isite1 = X->Def.CisAjtCkuAlvDC[i][0]+1;
327  org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
328  org_isite2 = X->Def.CisAjtCkuAlvDC[i][2]+1;
329  org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
330  org_isite3 = X->Def.CisAjtCkuAlvDC[i][4]+1;
331  org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
332  org_isite4 = X->Def.CisAjtCkuAlvDC[i][6]+1;
333  org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
334  dam_pr=0.0;
335 
336  if(CheckPE(org_isite1-1, X)==TRUE || CheckPE(org_isite2-1, X)==TRUE ||
337  CheckPE(org_isite3-1, X)==TRUE || CheckPE(org_isite4-1, X)==TRUE){
338  isite1 = X->Def.OrgTpow[2*org_isite1-2+org_sigma1] ;
339  isite2 = X->Def.OrgTpow[2*org_isite2-2+org_sigma2] ;
340  isite3 = X->Def.OrgTpow[2*org_isite3-2+org_sigma3] ;
341  isite4 = X->Def.OrgTpow[2*org_isite4-2+org_sigma4] ;
342  if(isite1 == isite2 && isite3 == isite4){
343 
344  dam_pr = X_GC_child_CisAisCjtAjt_Hubbard_MPI(org_isite1-1, org_sigma1,
345  org_isite3-1, org_sigma3,
346  1.0, X, vec, vec);
347  }
348  else if(isite1 == isite2 && isite3 != isite4){
349 
350  dam_pr = X_GC_child_CisAisCjtAku_Hubbard_MPI(org_isite1-1, org_sigma1,
351  org_isite3-1, org_sigma3, org_isite4-1, org_sigma4,
352  1.0, X, vec, vec);
353 
354  }
355  else if(isite1 != isite2 && isite3 == isite4){
356 
357  dam_pr = X_GC_child_CisAjtCkuAku_Hubbard_MPI(org_isite1-1, org_sigma1, org_isite2-1, org_sigma2,
358  org_isite3-1, org_sigma3,
359  1.0, X, vec, vec);
360 
361  }
362  else if(isite1 != isite2 && isite3 != isite4){
363  dam_pr = X_GC_child_CisAjtCkuAlv_Hubbard_MPI(org_isite1-1, org_sigma1, org_isite2-1, org_sigma2,
364  org_isite3-1, org_sigma3, org_isite4-1, org_sigma4,
365  1.0, X, vec, vec);
366  }
367 
368  }//InterPE
369  else{
371  (i, X, org_isite1, org_isite2, org_isite3, org_isite4,
372  org_sigma1, org_sigma2, org_sigma3, org_sigma4, tmp_V
373  );
374 
375  i_max = X->Large.i_max;
376  isite1 = X->Large.is1_spin;
377  isite2 = X->Large.is2_spin;
378  Asum = X->Large.isA_spin;
379  Adiff = X->Large.A_spin;
380 
381  isite3 = X->Large.is3_spin;
382  isite4 = X->Large.is4_spin;
383  Bsum = X->Large.isB_spin;
384  Bdiff = X->Large.B_spin;
385 
386  if(isite1 == isite2 && isite3 == isite4){
387  dam_pr = 0.0;
388 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2,tmp_V) shared(vec)
389  for(j=1;j<=i_max;j++){
390  dam_pr += GC_child_CisAisCisAis_element(j, isite1, isite3, tmp_V, vec, vec, X, &tmp_off);
391  }
392  }else if(isite1 == isite2 && isite3 != isite4){
393  dam_pr = 0.0;
394 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2,tmp_V) shared(vec)
395  for(j=1;j<=i_max;j++){
396  dam_pr += GC_child_CisAisCjtAku_element(j, isite1, isite3, isite4, Bsum, Bdiff, tmp_V, vec, vec, X, &tmp_off);
397  }
398  }else if(isite1 != isite2 && isite3 == isite4){
399  dam_pr = 0.0;
400 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2,tmp_V) shared(vec)
401  for(j=1;j<=i_max;j++){
402  dam_pr +=GC_child_CisAjtCkuAku_element(j, isite1, isite2, isite3, Asum, Adiff, tmp_V, vec, vec, X, &tmp_off);
403  }
404 
405  }else if(isite1 != isite2 && isite3 != isite4){
406  dam_pr = 0.0;
407 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2,tmp_V) shared(vec)
408  for(j=1;j<=i_max;j++){
409  dam_pr +=GC_child_CisAjtCkuAlv_element(j, isite1, isite2, isite3, isite4, Asum, Adiff, Bsum, Bdiff, tmp_V, vec, vec, X, &tmp_off_2);
410  }
411  }
412  }
413  dam_pr = SumMPI_dc(dam_pr);
414  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1,org_sigma1, org_isite2-1,org_sigma2, org_isite3-1, org_sigma3, org_isite4-1,org_sigma4, creal(dam_pr), cimag(dam_pr));
415 
416  }//Intra PE
417  return 0;
418 }
419 
430 int expec_cisajscktalt_Hubbard(struct BindStruct *X,double complex *vec, FILE **_fp){
431  long unsigned int i,j;
432  long unsigned int isite1,isite2,isite3,isite4;
433  long unsigned int org_isite1,org_isite2,org_isite3,org_isite4;
434  long unsigned int org_sigma1,org_sigma2,org_sigma3,org_sigma4;
435  long unsigned int Asum,Bsum,Adiff,Bdiff;
436  long unsigned int tmp_off=0;
437  long unsigned int tmp_off_2=0;
438  double complex tmp_V;
439  double complex dam_pr;
440  long int i_max;
441 
442  for(i=0;i<X->Def.NCisAjtCkuAlvDC;i++){
443  org_isite1 = X->Def.CisAjtCkuAlvDC[i][0]+1;
444  org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
445  org_isite2 = X->Def.CisAjtCkuAlvDC[i][2]+1;
446  org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
447  org_isite3 = X->Def.CisAjtCkuAlvDC[i][4]+1;
448  org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
449  org_isite4 = X->Def.CisAjtCkuAlvDC[i][6]+1;
450  org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
451  tmp_V = 1.0;
452 
453  dam_pr=0.0;
454  if(X->Def.iFlgSzConserved ==TRUE){
455  if(org_sigma1+org_sigma3 != org_sigma2+org_sigma4){
456  dam_pr=SumMPI_dc(dam_pr);
457  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",org_isite1-1, org_sigma1, org_isite2-1, org_sigma2, org_isite3-1, org_sigma3, org_isite4-1, org_sigma4, creal(dam_pr), cimag(dam_pr));
458  continue;
459  }
460  }
461 
462  if(CheckPE(org_isite1-1, X)==TRUE || CheckPE(org_isite2-1, X)==TRUE ||
463  CheckPE(org_isite3-1, X)==TRUE || CheckPE(org_isite4-1, X)==TRUE){
464  isite1 = X->Def.OrgTpow[2*org_isite1-2+org_sigma1] ;
465  isite2 = X->Def.OrgTpow[2*org_isite2-2+org_sigma2] ;
466  isite3 = X->Def.OrgTpow[2*org_isite3-2+org_sigma3] ;
467  isite4 = X->Def.OrgTpow[2*org_isite4-2+org_sigma4] ;
468  if(isite1 == isite2 && isite3 == isite4){
469  dam_pr = X_child_CisAisCjtAjt_Hubbard_MPI(org_isite1-1, org_sigma1,
470  org_isite3-1, org_sigma3,
471  1.0, X, vec, vec);
472  }
473  else if(isite1 == isite2 && isite3 != isite4){
474  //printf("org_isite1=%d, org_isite2=%d, org_isite3=%d, org_isite4=%d\n", org_isite1, org_isite2, org_isite3, org_isite4);
475  dam_pr = X_child_CisAisCjtAku_Hubbard_MPI(org_isite1-1, org_sigma1,
476  org_isite3-1, org_sigma3, org_isite4-1, org_sigma4,
477  1.0, X, vec, vec);
478  }
479  else if(isite1 != isite2 && isite3 == isite4){
480  dam_pr = X_child_CisAjtCkuAku_Hubbard_MPI(org_isite1-1, org_sigma1, org_isite2-1, org_sigma2,
481  org_isite3-1, org_sigma3,
482  1.0, X, vec, vec);
483 
484  }
485  else if(isite1 != isite2 && isite3 != isite4){
486  dam_pr = X_child_CisAjtCkuAlv_Hubbard_MPI(org_isite1-1, org_sigma1, org_isite2-1, org_sigma2,
487  org_isite3-1, org_sigma3, org_isite4-1, org_sigma4,
488  1.0, X, vec, vec);
489  }
490 
491  }//InterPE
492  else{
494  i, X, org_isite1, org_isite2, org_isite3, org_isite4,
495  org_sigma1, org_sigma2, org_sigma3, org_sigma4, tmp_V
496  );
497 
498  i_max = X->Large.i_max;
499  isite1 = X->Large.is1_spin;
500  isite2 = X->Large.is2_spin;
501  Asum = X->Large.isA_spin;
502  Adiff = X->Large.A_spin;
503 
504  isite3 = X->Large.is3_spin;
505  isite4 = X->Large.is4_spin;
506  Bsum = X->Large.isB_spin;
507  Bdiff = X->Large.B_spin;
508 
509  tmp_V = 1.0;
510  dam_pr = 0.0;
511  if(isite1 == isite2 && isite3 == isite4){
512 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2) shared(vec,tmp_V)
513  for(j=1;j<=i_max;j++){
514  dam_pr += child_CisAisCisAis_element(j, isite1, isite3, tmp_V, vec, vec, X, &tmp_off);
515  }
516  }else if(isite1 == isite2 && isite3 != isite4){
517 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2) shared(vec,tmp_V)
518  for(j=1;j<=i_max;j++){
519  dam_pr += child_CisAisCjtAku_element(j, isite1, isite3, isite4, Bsum, Bdiff, tmp_V, vec, vec, X, &tmp_off);
520  }
521  }else if(isite1 != isite2 && isite3 == isite4){
522 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2) shared(vec,tmp_V)
523  for(j=1;j<=i_max;j++){
524  dam_pr +=child_CisAjtCkuAku_element(j, isite1, isite2, isite3, Asum, Adiff, tmp_V, vec, vec, X, &tmp_off);
525  }
526  }else if(isite1 != isite2 && isite3 != isite4){
527 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2) shared(vec,tmp_V)
528  for(j=1;j<=i_max;j++){
529  dam_pr +=child_CisAjtCkuAlv_element(j, isite1, isite2, isite3, isite4, Asum, Adiff, Bsum, Bdiff, tmp_V, vec, vec, X, &tmp_off_2);
530 
531  }
532  }
533  }
534  dam_pr = SumMPI_dc(dam_pr);
535  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1,org_sigma1, org_isite2-1,org_sigma2, org_isite3-1, org_sigma3, org_isite4-1,org_sigma4, creal(dam_pr), cimag(dam_pr));
536  }
537 
538  return 0;
539 }
540 
551 int expec_cisajscktalt_Spin(struct BindStruct *X,double complex *vec, FILE **_fp) {
552  int info=0;
553  if (X->Def.iFlgGeneralSpin == FALSE) {
554  info=expec_cisajscktalt_SpinHalf(X,vec, _fp);
555  } else {
556  info=expec_cisajscktalt_SpinGeneral(X,vec, _fp);
557  }
558  return info;
559 }
560 
571 int expec_cisajscktalt_SpinHalf(struct BindStruct *X,double complex *vec, FILE **_fp){
572  long unsigned int i,j;
573  long unsigned int org_isite1,org_isite2,org_isite3,org_isite4;
574  long unsigned int org_sigma1,org_sigma2,org_sigma3,org_sigma4;
575  long unsigned int tmp_org_isite1,tmp_org_isite2,tmp_org_isite3,tmp_org_isite4;
576  long unsigned int tmp_org_sigma1,tmp_org_sigma2,tmp_org_sigma3,tmp_org_sigma4;
577  long unsigned int isA_up, isB_up;
578  long unsigned int is1_up, is2_up;
579  long unsigned int tmp_off=0;
580  int tmp_sgn, num1, num2;
581  double complex tmp_V;
582  double complex dam_pr;
583  long int i_max;
584  double complex dmv;
585 
586  i_max=X->Check.idim_max;
587  X->Large.mode=M_CORR;
588 
589 
590  for(i=0;i<X->Def.NCisAjtCkuAlvDC;i++){
591  tmp_org_isite1 = X->Def.CisAjtCkuAlvDC[i][0]+1;
592  tmp_org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
593  tmp_org_isite2 = X->Def.CisAjtCkuAlvDC[i][2]+1;
594  tmp_org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
595  tmp_org_isite3 = X->Def.CisAjtCkuAlvDC[i][4]+1;
596  tmp_org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
597  tmp_org_isite4 = X->Def.CisAjtCkuAlvDC[i][6]+1;
598  tmp_org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
599  if(Rearray_Interactions(i, &org_isite1, &org_isite2, &org_isite3, &org_isite4, &org_sigma1, &org_sigma2, &org_sigma3, &org_sigma4, &tmp_V, X)!=0){
600  //error message will be added
601  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1,tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4,0.0,0.0);
602  continue;
603  }
604 
605  dam_pr = 0.0;
606  if(org_isite1 >X->Def.Nsite && org_isite3>X->Def.Nsite){
607  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
608  is1_up = X->Def.Tpow[org_isite1 - 1];
609  is2_up = X->Def.Tpow[org_isite3 - 1];
610  num1 = X_SpinGC_CisAis((unsigned long int)myrank + 1, X, is1_up, org_sigma1);
611  num2 = X_SpinGC_CisAis((unsigned long int)myrank + 1, X, is2_up, org_sigma3);
612 #pragma omp parallel for default(none) reduction (+:dam_pr) shared(vec) \
613  firstprivate(i_max, num1, num2, tmp_V) private(j)
614  for (j = 1; j <= i_max; j++) {
615  dam_pr += tmp_V*num1*num2*vec[j]*conj(vec[j]);
616  }
617  }
618  else if(org_isite1==org_isite3 && org_sigma1==org_sigma4 && org_sigma2==org_sigma3){
619  is1_up = X->Def.Tpow[org_isite1 - 1];
620  num1 = X_SpinGC_CisAis((unsigned long int)myrank + 1, X, is1_up, org_sigma1);
621 #pragma omp parallel for default(none) reduction (+:dam_pr) shared(vec) \
622  firstprivate(i_max, num1, num2, tmp_V) private(j)
623  for (j = 1; j <= i_max; j++) {
624  dam_pr += tmp_V*num1*vec[j]*conj(vec[j]);
625  }
626  }
627  else if(org_sigma1==org_sigma4 && org_sigma2==org_sigma3){//exchange
628  dam_pr += X_child_general_int_spin_MPIdouble(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, org_sigma4, tmp_V, X, vec, vec);
629  }
630  else{ // other process is not allowed
631  // error message will be added
632  }
633  }
634  else if(org_isite1 > X->Def.Nsite || org_isite3>X->Def.Nsite){
635  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
636  is1_up = X->Def.Tpow[org_isite1 - 1];
637  is2_up = X->Def.Tpow[org_isite3 - 1];
638  num2 = X_SpinGC_CisAis((unsigned long int)myrank + 1, X, is2_up, org_sigma3);
639  dam_pr=0.0;
640 #pragma omp parallel for default(none) reduction(+:dam_pr)shared(vec) \
641  firstprivate(i_max, tmp_V, is1_up, org_sigma1, X, num2) private(j, num1)
642  for (j = 1; j <= i_max; j++) {
643  num1 = X_Spin_CisAis(j, X, is1_up, org_sigma1);
644  dam_pr += tmp_V*num1*num2*conj(vec[j])*vec[j];
645  }
646  }
647  else if(org_sigma1==org_sigma4 && org_sigma2==org_sigma3){//exchange
648  dam_pr += X_child_general_int_spin_MPIsingle(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, org_sigma4, tmp_V, X, vec, vec);
649  }
650  else{ // other process is not allowed
651  // error message will be added
652  dam_pr=0.0;
653  }
654  }
655  else{
656  isA_up = X->Def.Tpow[org_isite1-1];
657  isB_up = X->Def.Tpow[org_isite3-1];
658  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
659  dam_pr = 0.0;
660 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off, tmp_V) shared(vec)
661  for(j=1;j<=i_max;j++){
662  dam_pr +=child_CisAisCisAis_spin_element(j, isA_up, isB_up, org_sigma2, org_sigma4, tmp_V, vec, vec, X);
663  }
664  }else if(org_isite1==org_isite3 && org_sigma1==org_sigma4 && org_sigma3==org_sigma2){
665  dam_pr = 0.0;
666 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv) firstprivate(i_max,X,isA_up,org_sigma1, tmp_V) shared(vec, list_1)
667  for(j=1;j<=i_max;j++){
668  dmv = X_Spin_CisAis(j, X, isA_up, org_sigma1);
669  dam_pr += vec[j]*tmp_V*dmv*conj(vec[j]);
670  }
671  }
672  else if(org_sigma1==org_sigma4 && org_sigma2==org_sigma3){ // exchange
673  dam_pr = 0.0;
674 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, tmp_sgn, dmv) firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V) shared(vec)
675  for(j=1;j<=i_max;j++){
676  tmp_sgn = X_child_exchange_spin_element(j,X,isA_up,isB_up,org_sigma2,org_sigma4,&tmp_off);
677  dmv = vec[j]*tmp_sgn;
678  dam_pr += conj(vec[tmp_off])*dmv;
679  }
680  }else{ // other process is not allowed
681  // error message will be added
682  dam_pr=0.0;
683  }
684  }
685  dam_pr = SumMPI_dc(dam_pr);
686  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1, tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4,creal(dam_pr),cimag(dam_pr));
687 
688  }
689 
690  return 0;
691 }
692 
703 int expec_cisajscktalt_SpinGeneral(struct BindStruct *X,double complex *vec, FILE **_fp){
704  long unsigned int i,j;
705  long unsigned int org_isite1,org_isite2,org_isite3,org_isite4;
706  long unsigned int org_sigma1,org_sigma2,org_sigma3,org_sigma4;
707  long unsigned int tmp_org_isite1,tmp_org_isite2,tmp_org_isite3,tmp_org_isite4;
708  long unsigned int tmp_org_sigma1,tmp_org_sigma2,tmp_org_sigma3,tmp_org_sigma4;
709  long unsigned int tmp_off=0;
710  long unsigned int tmp_off_2=0;
711  long unsigned int list1_off=0;
712  int num1;
713  double complex tmp_V;
714  double complex dam_pr;
715  long int i_max;
716  int tmp_Sz;
717  long unsigned int tmp_org=0;
718  vec[0]=0;
719  i_max=X->Check.idim_max;
720  X->Large.mode=M_CORR;
721 
722  for(i=0;i<X->Def.NCisAjtCkuAlvDC;i++){
723  tmp_org_isite1 = X->Def.CisAjtCkuAlvDC[i][0]+1;
724  tmp_org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
725  tmp_org_isite2 = X->Def.CisAjtCkuAlvDC[i][2]+1;
726  tmp_org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
727  tmp_org_isite3 = X->Def.CisAjtCkuAlvDC[i][4]+1;
728  tmp_org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
729  tmp_org_isite4 = X->Def.CisAjtCkuAlvDC[i][6]+1;
730  tmp_org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
731 
732  if(Rearray_Interactions(i, &org_isite1, &org_isite2, &org_isite3, &org_isite4, &org_sigma1, &org_sigma2, &org_sigma3, &org_sigma4, &tmp_V, X)!=0){
733  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1,tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4,0.0,0.0);
734  continue;
735  }
736  tmp_Sz=0;
737 
738  for(j=0;j<2; j++) {
739  tmp_org = X->Def.CisAjtCkuAlvDC[i][4*j+1]*X->Def.Tpow[X->Def.CisAjtCkuAlvDC[i][4 * j]];
740  tmp_Sz += GetLocal2Sz(X->Def.CisAjtCkuAlvDC[i][4 * j] + 1, tmp_org, X->Def.SiteToBit, X->Def.Tpow);
741  tmp_org = X->Def.CisAjtCkuAlvDC[i][4*j+3]*X->Def.Tpow[X->Def.CisAjtCkuAlvDC[i][4 * j+2]];
742  tmp_Sz -= GetLocal2Sz(X->Def.CisAjtCkuAlvDC[i][4 * j+2] + 1, tmp_org, X->Def.SiteToBit, X->Def.Tpow);
743  }
744  if(tmp_Sz !=0){ // not Sz conserved
745  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1,tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4,0.0,0.0);
746  continue;
747  }
748 
749  dam_pr = 0.0;
750  if(org_isite1 >X->Def.Nsite && org_isite3>X->Def.Nsite){
751  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
752  dam_pr=X_child_CisAisCjuAju_GeneralSpin_MPIdouble(org_isite1-1, org_sigma1, org_isite3-1, org_sigma3, tmp_V, X, vec, vec);
753  }
754  else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
755  dam_pr=X_child_CisAitCjuAjv_GeneralSpin_MPIdouble(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, org_sigma4,tmp_V, X, vec, vec);
756  }
757  else{
758  dam_pr=0.0;
759  }
760  }
761  else if(org_isite3 > X->Def.Nsite || org_isite1 > X->Def.Nsite){
762  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
763  dam_pr=X_child_CisAisCjuAju_GeneralSpin_MPIsingle(org_isite1-1, org_sigma1, org_isite3-1, org_sigma3, tmp_V, X, vec, vec);
764  }
765  else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
766  dam_pr=X_child_CisAitCjuAjv_GeneralSpin_MPIsingle(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, org_sigma4,tmp_V, X, vec, vec);
767  }
768  else{
769  dam_pr=0.0;
770  }
771  }
772  else{
773  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
774 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max,X,org_isite1, org_sigma1,org_isite3, org_sigma3, tmp_V) shared(vec,list_1)
775  for(j=1;j<=i_max;j++){
776  num1=BitCheckGeneral(list_1[j], org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
777  if(num1 != FALSE){
778  num1=BitCheckGeneral(list_1[j], org_isite3, org_sigma3, X->Def.SiteToBit, X->Def.Tpow);
779  if(num1 != FALSE){
780  dam_pr += tmp_V*conj(vec[j])*vec[j];
781  }
782  }
783  }
784  }
785  else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
786 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max,X, org_isite1, org_isite3, org_sigma1, org_sigma2, org_sigma3, org_sigma4, tmp_off, tmp_off_2, list1_off, myrank, tmp_V) shared(vec, list_1)
787  for(j=1;j<=i_max;j++){
788  num1 = GetOffCompGeneralSpin(list_1[j], org_isite3, org_sigma4, org_sigma3, &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
789  if(num1 != FALSE) {
790  num1 = GetOffCompGeneralSpin(tmp_off, org_isite1, org_sigma2, org_sigma1, &tmp_off_2,
791  X->Def.SiteToBit, X->Def.Tpow);
792  if (num1 != FALSE) {
793  ConvertToList1GeneralSpin(tmp_off_2, X->Check.sdim, &list1_off);
794  dam_pr += tmp_V * conj(vec[list1_off]) * vec[j];
795  }
796  }
797  }
798  //printf("DEBUG: rank=%d, dam_pr=%lf\n", myrank, creal(dam_pr));
799  }
800  else{
801  dam_pr=0.0;
802  }
803  }
804  dam_pr = SumMPI_dc(dam_pr);
805  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1, tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4, creal(dam_pr),cimag(dam_pr));
806  }
807  return 0;
808 }
809 
820 int expec_cisajscktalt_SpinGC(struct BindStruct *X,double complex *vec, FILE **_fp){
821  int info=0;
822  if (X->Def.iFlgGeneralSpin == FALSE) {
823  info=expec_cisajscktalt_SpinGCHalf(X,vec, _fp);
824  } else {
825  info=expec_cisajscktalt_SpinGCGeneral(X,vec, _fp);
826  }
827  return info;
828 }
829 
840 int expec_cisajscktalt_SpinGCHalf(struct BindStruct *X,double complex *vec, FILE **_fp){
841  long unsigned int i,j;
842  long unsigned int org_isite1,org_isite2,org_isite3,org_isite4;
843  long unsigned int org_sigma1,org_sigma2,org_sigma3,org_sigma4;
844  long unsigned int tmp_org_isite1,tmp_org_isite2,tmp_org_isite3,tmp_org_isite4;
845  long unsigned int tmp_org_sigma1,tmp_org_sigma2,tmp_org_sigma3,tmp_org_sigma4;
846  long unsigned int isA_up, isB_up;
847  long unsigned int tmp_off=0;
848  double complex tmp_V;
849  double complex dam_pr;
850  long int i_max;
851  i_max=X->Check.idim_max;
852 
853  for(i=0;i<X->Def.NCisAjtCkuAlvDC;i++){
854  tmp_org_isite1 = X->Def.CisAjtCkuAlvDC[i][0]+1;
855  tmp_org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
856  tmp_org_isite2 = X->Def.CisAjtCkuAlvDC[i][2]+1;
857  tmp_org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
858  tmp_org_isite3 = X->Def.CisAjtCkuAlvDC[i][4]+1;
859  tmp_org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
860  tmp_org_isite4 = X->Def.CisAjtCkuAlvDC[i][6]+1;
861  tmp_org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
862 
863  if(Rearray_Interactions(i, &org_isite1, &org_isite2, &org_isite3, &org_isite4, &org_sigma1, &org_sigma2, &org_sigma3, &org_sigma4, &tmp_V, X)!=0){
864  //error message will be added
865  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1,tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4,0.0,0.0);
866  continue;
867  }
868 
869  dam_pr=0.0;
870  if(org_isite1>X->Def.Nsite && org_isite3>X->Def.Nsite){ //org_isite3 >= org_isite1 > Nsite
871 
872  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
873  dam_pr += X_GC_child_CisAisCjuAju_spin_MPIdouble( (org_isite1-1), org_sigma1, (org_isite3-1), org_sigma3, tmp_V, X, vec, vec);
874 
875  }
876  else if(org_isite1 ==org_isite3 && org_sigma1 ==org_sigma4 && org_sigma2 ==org_sigma3){ //diagonal (for spin: cuadcdau=cuau)
877  dam_pr += X_GC_child_CisAis_spin_MPIdouble((org_isite1-1), org_sigma1, tmp_V, X, vec, vec);
878  }
879  else if(org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4){
880  dam_pr += X_GC_child_CisAisCjuAjv_spin_MPIdouble(org_isite1-1, org_sigma1, org_isite3-1, org_sigma3, org_sigma4, tmp_V, X, vec, vec);
881  }
882  else if(org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4){
883  dam_pr += X_GC_child_CisAitCjuAju_spin_MPIdouble(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, tmp_V, X, vec, vec);
884  }
885  else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
886  dam_pr += X_GC_child_CisAitCiuAiv_spin_MPIdouble(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, org_sigma4, tmp_V, X, vec, vec);
887  }
888  }
889  else if(org_isite3>X->Def.Nsite || org_isite1>X->Def.Nsite){ //org_isite3 > Nsite >= org_isite1
890  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
891  dam_pr += X_GC_child_CisAisCjuAju_spin_MPIsingle( (org_isite1-1), org_sigma1, (org_isite3-1), org_sigma3, tmp_V, X, vec, vec);
892 
893  }
894  else if(org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4){
895  dam_pr += X_GC_child_CisAisCjuAjv_spin_MPIsingle(org_isite1-1, org_sigma1, org_isite3-1, org_sigma3, org_sigma4, tmp_V, X, vec, vec);
896  }
897  else if(org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4){
898  dam_pr += X_GC_child_CisAitCjuAju_spin_MPIsingle(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, tmp_V, X, vec, vec);
899  }
900  else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
901  dam_pr += X_GC_child_CisAitCiuAiv_spin_MPIsingle(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, org_sigma4, tmp_V, X, vec, vec);
902  }
903  }
904  else{
905  if(org_isite1==org_isite2 && org_isite3==org_isite4){
906  isA_up = X->Def.Tpow[org_isite2-1];
907  isB_up = X->Def.Tpow[org_isite4-1];
908  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
909  dam_pr = 0.0;
910 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V) shared(vec)
911  for(j=1;j<=i_max;j++){
912  dam_pr +=GC_child_CisAisCisAis_spin_element(j, isA_up, isB_up, org_sigma2, org_sigma4, tmp_V, vec, vec, X);
913  }
914  }else if(org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4){
915  dam_pr = 0.0;
916 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V) shared(vec)
917  for(j=1;j<=i_max;j++){
918  dam_pr += GC_child_CisAisCitAiu_spin_element(j, org_sigma2, org_sigma4, isA_up, isB_up, tmp_V, vec, vec, X, &tmp_off);
919  }
920  }else if(org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4){
921  dam_pr = 0.0;
922 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V) shared(vec)
923  for(j=1;j<=i_max;j++){
924  dam_pr += GC_child_CisAitCiuAiu_spin_element(j, org_sigma2, org_sigma4, isA_up, isB_up, tmp_V, vec, vec, X, &tmp_off);
925  }
926  }else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
927  dam_pr = 0.0;
928 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V) shared(vec)
929  for(j=1;j<=i_max;j++){
930  dam_pr += GC_child_CisAitCiuAiv_spin_element(j, org_sigma2, org_sigma4, isA_up, isB_up, tmp_V, vec, vec, X, &tmp_off);
931  }
932  }
933  }
934  }
935  dam_pr = SumMPI_dc(dam_pr);
936  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1, tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4,creal(dam_pr),cimag(dam_pr));
937  }
938  return 0;
939 }
940 
951 int expec_cisajscktalt_SpinGCGeneral(struct BindStruct *X,double complex *vec, FILE **_fp){
952  long unsigned int i,j;
953  long unsigned int org_isite1,org_isite2,org_isite3,org_isite4;
954  long unsigned int org_sigma1,org_sigma2,org_sigma3,org_sigma4;
955  long unsigned int tmp_org_isite1,tmp_org_isite2,tmp_org_isite3,tmp_org_isite4;
956  long unsigned int tmp_org_sigma1,tmp_org_sigma2,tmp_org_sigma3,tmp_org_sigma4;
957  long unsigned int tmp_off=0;
958  long unsigned int tmp_off_2=0;
959  int num1;
960  double complex tmp_V;
961  double complex dam_pr;
962  long int i_max;
963  i_max=X->Check.idim_max;
964  X->Large.mode=M_CORR;
965 
966 
967  for(i=0;i<X->Def.NCisAjtCkuAlvDC;i++){
968  tmp_org_isite1 = X->Def.CisAjtCkuAlvDC[i][0]+1;
969  tmp_org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
970  tmp_org_isite2 = X->Def.CisAjtCkuAlvDC[i][2]+1;
971  tmp_org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
972  tmp_org_isite3 = X->Def.CisAjtCkuAlvDC[i][4]+1;
973  tmp_org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
974  tmp_org_isite4 = X->Def.CisAjtCkuAlvDC[i][6]+1;
975  tmp_org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
976  dam_pr = 0.0;
977 
978  if(Rearray_Interactions(i, &org_isite1, &org_isite2, &org_isite3, &org_isite4, &org_sigma1, &org_sigma2, &org_sigma3, &org_sigma4, &tmp_V, X)!=0){
979  //error message will be added
980  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1,tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4,0.0,0.0);
981  continue;
982  }
983 
984  if(org_isite1 > X->Def.Nsite && org_isite3 > X->Def.Nsite){
985  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
986  dam_pr=X_GC_child_CisAisCjuAju_GeneralSpin_MPIdouble(org_isite1-1, org_sigma1, org_isite3-1, org_sigma3, tmp_V, X, vec, vec);
987  }
988  else if(org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4){
989  dam_pr=X_GC_child_CisAisCjuAjv_GeneralSpin_MPIdouble(org_isite1-1, org_sigma1, org_isite3-1, org_sigma3, org_sigma4, tmp_V, X, vec, vec);
990  }
991  else if(org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4){
992  dam_pr=X_GC_child_CisAitCjuAju_GeneralSpin_MPIdouble(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, tmp_V, X, vec, vec);
993  }
994  else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
995  dam_pr=X_GC_child_CisAitCjuAjv_GeneralSpin_MPIdouble(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, org_sigma4,tmp_V, X, vec, vec);
996  }
997  }
998  else if(org_isite3 > X->Def.Nsite || org_isite1 > X->Def.Nsite){
999  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
1000  dam_pr=X_GC_child_CisAisCjuAju_GeneralSpin_MPIsingle(org_isite1-1, org_sigma1, org_isite3-1, org_sigma3, tmp_V, X, vec, vec);
1001  }
1002  else if(org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4){
1003  dam_pr=X_GC_child_CisAisCjuAjv_GeneralSpin_MPIsingle(org_isite1-1, org_sigma1, org_isite3-1, org_sigma3, org_sigma4, tmp_V, X, vec, vec);
1004  }
1005  else if(org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4){
1006  dam_pr=X_GC_child_CisAitCjuAju_GeneralSpin_MPIsingle(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, tmp_V, X, vec, vec);
1007  }
1008  else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
1009  dam_pr=X_GC_child_CisAitCjuAjv_GeneralSpin_MPIsingle(org_isite1-1, org_sigma1, org_sigma2, org_isite3-1, org_sigma3, org_sigma4,tmp_V, X, vec, vec);
1010  }
1011  }
1012  else{
1013  if(org_sigma1==org_sigma2 && org_sigma3==org_sigma4 ){ //diagonal
1014 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max,X,org_isite1, org_sigma1,org_isite3, org_sigma3, tmp_V) shared(vec)
1015  for(j=1;j<=i_max;j++){
1016  num1=BitCheckGeneral(j-1, org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
1017  if(num1 != FALSE){
1018  num1=BitCheckGeneral(j-1, org_isite3, org_sigma3, X->Def.SiteToBit, X->Def.Tpow);
1019  if(num1 != FALSE){
1020  dam_pr += tmp_V*conj(vec[j])*vec[j];
1021  }
1022  }
1023  }
1024  }else if(org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4){
1025 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max,X, org_isite1, org_isite3, org_sigma1,org_sigma3,org_sigma4, tmp_off, tmp_V) shared(vec)
1026  for(j=1;j<=i_max;j++){
1027  num1 = GetOffCompGeneralSpin(j-1, org_isite3, org_sigma4, org_sigma3, &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
1028  if(num1 != FALSE){
1029  num1=BitCheckGeneral(tmp_off, org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
1030  if(num1 != FALSE){
1031  dam_pr += tmp_V*conj(vec[tmp_off+1])*vec[j];
1032  }
1033  }
1034  }
1035  }else if(org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4){
1036 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max,X, org_isite1, org_isite3, org_sigma1,org_sigma2, org_sigma3, tmp_off, tmp_V) shared(vec)
1037  for(j=1;j<=i_max;j++){
1038  num1 = BitCheckGeneral(j-1, org_isite3, org_sigma3, X->Def.SiteToBit, X->Def.Tpow);
1039  if(num1 != FALSE){
1040  num1 = GetOffCompGeneralSpin(j-1, org_isite1, org_sigma2, org_sigma1, &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
1041  if(num1 != FALSE){
1042  dam_pr += tmp_V*conj(vec[tmp_off+1])*vec[j];
1043  }
1044  }
1045  }
1046  }else if(org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4){
1047 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max,X, org_isite1, org_isite3, org_sigma1, org_sigma2, org_sigma3, org_sigma4, tmp_off, tmp_off_2, tmp_V) shared(vec)
1048  for(j=1;j<=i_max;j++){
1049  num1 = GetOffCompGeneralSpin(j-1, org_isite3, org_sigma4, org_sigma3, &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
1050  if(num1 != FALSE){
1051  num1 = GetOffCompGeneralSpin(tmp_off, org_isite1, org_sigma2, org_sigma1, &tmp_off_2, X->Def.SiteToBit, X->Def.Tpow);
1052  if(num1 != FALSE){
1053  dam_pr += tmp_V*conj(vec[tmp_off_2+1])*vec[j];
1054  }
1055  }
1056 
1057  }
1058  }
1059  }
1060  dam_pr = SumMPI_dc(dam_pr);
1061  fprintf(*_fp," %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %.10lf %.10lf \n",tmp_org_isite1-1, tmp_org_sigma1, tmp_org_isite2-1, tmp_org_sigma2, tmp_org_isite3-1, tmp_org_sigma3, tmp_org_isite4-1, tmp_org_sigma4, creal(dam_pr),cimag(dam_pr));
1062  }
1063  return 0;
1064 }
int irand
Input keyword TargetTPQRand ???
Definition: struct.h:79
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
long unsigned int B_spin
Mask used in the bit oeration.
Definition: struct.h:342
int expec_cisajscktaltdc(struct BindStruct *X, double complex *vec)
Parent function to calculate two-body green&#39;s functions.
int St
0 or 1, but it affects nothing.
Definition: struct.h:80
double complex X_child_CisAitCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the canonical general spin system when one of these sites is in the inter process re...
double complex X_GC_child_CisAisCjuAju_spin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
const char * cLogLanczosExpecTwoBodyGStart
Definition: LogMessage.c:124
double complex X_GC_child_CisAitCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
int iFlgSzConserved
Flag whether Sz is conserved.
Definition: struct.h:87
double complex X_GC_child_CisAisCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
term in Spin model. When both site1 and site3 are in the inter process region.
int CheckPE(int org_isite, struct BindStruct *X)
Check whether this site is in the inter process region or not.
double complex SumMPI_dc(double complex norm)
MPI wrapper function to obtain sum of Double complex across processes.
Definition: wrapperMPI.c:205
unsigned long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.h:303
double complex X_GC_child_CisAis_spin_MPIdouble(int org_isite1, int org_ispin1, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
double complex GC_child_CisAitCiuAiu_spin_element(long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of grandcanonical spsin system.
double complex GC_child_CisAisCitAiu_spin_element(long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of grandcanonical spsin system.
long unsigned int is4_spin
Mask used in the bit oeration.
Definition: struct.h:335
const char * cTPQExpecTwoBodyGFinish
Definition: LogMessage.c:132
const char * cTEExpecTwoBodyGFinish
Definition: LogMessage.c:134
int X_child_exchange_spin_element(long unsigned int j, struct BindStruct *X, long unsigned int isA_up, long unsigned int isB_up, long unsigned int sigmaA, long unsigned int sigmaB, long unsigned int *tmp_off)
Compute index of final wavefunction associated to spin-exchange term.
double complex X_GC_child_CisAitCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
double complex X_GC_child_CisAitCiuAiv_spin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Exchange and Pairlifting term in Spin model + GC When only site2 is in the inter process region...
long unsigned int isB_spin
Mask used in the bit oeration.
Definition: struct.h:347
int child_general_int_GetInfo(int iInterAll, struct BindStruct *X, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int isite4, long unsigned int sigma1, long unsigned int sigma2, long unsigned int sigma3, long unsigned int sigma4, double complex tmp_V)
Compute mask for bit operation of general interaction term.
double complex X_child_CisAisCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the canonical general spin system when one of these sites is in the inter process re...
const char * cFileName2BGreen_TPQ
Definition: global.c:61
double complex X_GC_child_CisAisCjtAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of grandcanonical Hubbard system.
double complex child_CisAjtCkuAku_element(long unsigned int j, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int Asum, long unsigned int Adiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of canonical Hubbard system.
#define D_FileNameMax
Definition: global.h:23
int X_SpinGC_CisAis(long unsigned int j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int sigma1)
Compute the grandcanonical spin state with bit mask is1_spin.
double complex ** vec
Definition: global.h:45
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
double complex X_child_CisAisCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the canonical general spin system when both sites are in the inter process region...
long unsigned int is1_spin
Mask used in the bit oeration.
Definition: struct.h:332
int ConvertToList1GeneralSpin(const long unsigned int org_ibit, const long unsigned int ihlfbit, long unsigned int *_ilist1Comp)
function of converting component to list_1
Definition: bitcalc.c:285
double complex X_child_CisAisCjtAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of canonical Hubbard system.
int ** CisAjtCkuAlvDC
[DefineList::NCisAjtCkuAlvDC][4] Indices of two-body correlation function. malloc in setmem_def()...
Definition: struct.h:177
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.c:27
double complex GC_child_CisAitCiuAiv_spin_element(long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off_2)
Compute term of grandcanonical spsin system.
struct PhysList Phys
Physical quantities.
Definition: struct.h:413
int X_Spin_CisAis(long unsigned int j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int sigma1)
Compute the spin state with bit mask is1_spin.
int expec_cisajscktalt_SpinGeneral(struct BindStruct *X, double complex *vec, FILE **_fp)
Child function to calculate two-body green&#39;s functions for General Spin model.
double complex X_child_CisAisCjtAjt_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of canonical Hubbard system.
double complex X_child_CisAitCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the canonical general spin system when both sites are in the inter process region...
int mode
multiply or expectation value.
Definition: struct.h:330
int Rearray_Interactions(int i, long unsigned int *org_isite1, long unsigned int *org_isite2, long unsigned int *org_isite3, long unsigned int *org_isite4, long unsigned int *org_sigma1, long unsigned int *org_sigma2, long unsigned int *org_sigma3, long unsigned int *org_sigma4, double complex *tmp_V, struct BindStruct *X)
Rearray interactions.
double complex X_GC_child_CisAisCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
double complex X_GC_child_CisAisCjuAju_spin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
double complex X_GC_child_CisAitCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
int expec_cisajscktalt_SpinGC(struct BindStruct *X, double complex *vec, FILE **_fp)
Parent function to calculate two-body green&#39;s functions for Spin GC model.
#define TRUE
Definition: global.h:26
double complex X_GC_child_CisAitCjuAju_spin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region.
double complex X_GC_child_CisAisCjuAjv_spin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
long unsigned int is3_spin
Mask used in the bit oeration.
Definition: struct.h:334
unsigned long int sdim
Dimension for Ogata-Lin ???
Definition: struct.h:307
int GetLocal2Sz(const unsigned int isite, const long unsigned int org_bit, const long int *SiteToBit, const long unsigned int *Tpow)
get 2sz at a site for general spin
Definition: bitcalc.c:449
long unsigned int * OrgTpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:92
double complex X_GC_child_CisAisCjtAjt_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of grandcanonical Hubbard system.
long unsigned int A_spin
Mask used in the bit oeration.
Definition: struct.h:341
Bind.
Definition: struct.h:409
unsigned int Nsite
Number of sites in the INTRA process region.
Definition: struct.h:56
double complex GC_child_CisAisCisAis_spin_element(long unsigned int j, long unsigned int isA_up, long unsigned int isB_up, long unsigned int org_sigma2, long unsigned int org_sigma4, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute term of grandcanonical spsin system.
const char * cLogCGExpecTwoBodyGFinish
Definition: LogMessage.c:126
const char * cLanczosExpecTwoBodyGFinish
Definition: LogMessage.c:128
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
int GetSplitBitByModel(const int Nsite, const int iCalcModel, long unsigned int *irght, long unsigned int *ilft, long unsigned int *ihfbit)
function of splitting original bit into right and left spaces.
Definition: bitcalc.c:78
double complex X_child_CisAjtCkuAlv_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of canonical Hubbard system.
const char * cTEExpecTwoBodyGStart
Definition: LogMessage.c:133
double complex X_child_CisAjtCkuAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of canonical Hubbard system.
long int i_max
Length of eigenvector.
Definition: struct.h:317
const char * cLogLanczosExpecTwoBodyGFinish
Definition: LogMessage.c:125
double complex GC_child_CisAisCisAis_element(long unsigned int j, long unsigned int isite1, long unsigned int isite3, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of grandcanonical Hubbard system.
double complex child_CisAisCisAis_spin_element(long unsigned int j, long unsigned int isA_up, long unsigned int isB_up, long unsigned int org_sigma2, long unsigned int org_sigma4, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute term of canonical spsin system.
int expec_cisajscktalt_HubbardGC(struct BindStruct *X, double complex *vec, FILE **_fp)
Child function to calculate two-body green&#39;s functions for Hubbard GC model.
int expec_cisajscktalt_SpinHalf(struct BindStruct *X, double complex *vec, FILE **_fp)
Child function to calculate two-body green&#39;s functions for 1/2 Spin model.
const char * cLanczosExpecTwoBodyGStart
Definition: LogMessage.c:127
double complex X_GC_child_CisAjtCkuAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of grandcanonical Hubbard system.
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.h:86
const char * cCGExpecTwoBodyGFinish
Definition: LogMessage.c:130
#define FALSE
Definition: global.h:25
long unsigned int * list_1
Definition: global.h:47
const char * cFileName2BGreen_CG
Definition: global.c:46
unsigned int NCisAjtCkuAlvDC
Number of indices of two-body correlation function.
Definition: struct.h:178
long unsigned int is2_spin
Mask used in the bit oeration.
Definition: struct.h:333
double complex child_CisAisCisAis_element(long unsigned int j, long unsigned int isite1, long unsigned int isite3, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of canonical Hubbard system.
const char * cFileName2BGreen_Lanczos
Definition: global.c:45
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.h:94
int istep
Index of TPQ step ???
Definition: struct.h:78
const char * cCGExpecTwoBodyGStart
Definition: LogMessage.c:129
const char * cFileNameTimeKeep
Definition: global.c:23
const char * cTPQExpecTwoBodyGStart
Definition: LogMessage.c:131
int BitCheckGeneral(const long unsigned int org_bit, const unsigned int org_isite, const unsigned int target_ispin, const long int *SiteToBit, const long unsigned int *Tpow)
bit check function for general spin
Definition: bitcalc.c:393
const char * cFileName2BGreen_TE
Definition: global.c:63
int expec_cisajscktalt_SpinGCHalf(struct BindStruct *X, double complex *vec, FILE **_fp)
Child function to calculate two-body green&#39;s functions for 1/2 Spin GC model.
double complex X_GC_child_CisAitCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
term in Spin model. When both site1 and site3 are in the inter process region.
long unsigned int isA_spin
Mask used in the bit oeration.
Definition: struct.h:346
double complex X_child_general_int_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Exchange term in Spin model When both site1 and site2 are in the inter process region.
Definition: mltplyMPISpin.c:61
double complex X_GC_child_CisAjtCkuAlv_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of grandcanonical Hubbard system.
struct EDMainCalStruct X
Definition: struct.h:432
int expec_cisajscktalt_SpinGCGeneral(struct BindStruct *X, double complex *vec, FILE **_fp)
Child function to calculate two-body green&#39;s functions for General Spin GC model. ...
double complex X_GC_child_CisAisCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
int expec_cisajscktalt_Spin(struct BindStruct *X, double complex *vec, FILE **_fp)
Parent function to calculate two-body green&#39;s functions for Spin model.
double complex X_GC_child_CisAisCjuAjv_spin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region.
double complex X_child_general_int_spin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.h:198
int GetOffCompGeneralSpin(const long unsigned int org_ibit, const int org_isite, const int org_ispin, const int off_ispin, long unsigned int *_ioffComp, const long int *SiteToBit, const long unsigned int *Tpow)
function of getting off-diagonal component for general spin
Definition: bitcalc.c:243
const char * cFileName2BGreen_FullDiag
Definition: global.c:77
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
double complex X_GC_child_CisAitCiuAiv_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
term in Spin model + GC. When both site1 and site2 are in the inter process region.
int eigen_num
Index of eigenstate used for the file name of the correlation function.
Definition: struct.h:367
double complex GC_child_CisAisCjtAku_element(long unsigned int j, long unsigned int isite1, long unsigned int isite3, long unsigned int isite4, long unsigned int Bsum, long unsigned int Bdiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of grandcanonical Hubbard system.
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
double complex X_GC_child_CisAitCjuAju_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green&#39;s function.
Definition: struct.h:42
int TimeKeeperWithStep(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int istep)
Functions for writing a time log.
Definition: log.c:78
double complex X_GC_child_CisAisCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
double complex GC_child_CisAjtCkuAku_element(long unsigned int j, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int Asum, long unsigned int Adiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of grandcanonical Hubbard system.
double complex child_CisAjtCkuAlv_element(long unsigned int j, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int isite4, long unsigned int Asum, long unsigned int Adiff, long unsigned int Bsum, long unsigned int Bdiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off_2)
Compute term of canonical Hubbard system.
int expec_cisajscktalt_Hubbard(struct BindStruct *X, double complex *vec, FILE **_fp)
Child function to calculate two-body green&#39;s functions for Hubbard model.
double complex GC_child_CisAjtCkuAlv_element(long unsigned int j, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int isite4, long unsigned int Asum, long unsigned int Adiff, long unsigned int Bsum, long unsigned int Bdiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off_2)
Compute term of grandcanonical Hubbard system.
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.
Definition: log.c:117
int TimeKeeper(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType)
Functions for writing a time log.
Definition: log.c:42
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
Definition: struct.h:192
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165
double complex child_CisAisCjtAku_element(long unsigned int j, long unsigned int isite1, long unsigned int isite3, long unsigned int isite4, long unsigned int Bsum, long unsigned int Bdiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of canonical Hubbard system.