HPhi++  3.1.0
expec_cisajscktaltdc.cpp
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.hpp"
18 #include "mltplyCommon.hpp"
19 #include "FileIO.hpp"
20 #include "bitcalc.hpp"
21 #include "expec_cisajscktaltdc.hpp"
22 #include "mltplySpinCore.hpp"
23 #include "mltplyHubbardCore.hpp"
24 #include "wrapperMPI.hpp"
25 #include "mltplyMPISpin.hpp"
26 #include "mltplyMPISpinCore.hpp"
27 #include "mltplyMPIHubbardCore.hpp"
28 #include "common/setmemory.hpp"
58  int i,
59  long int *org_isite1,
60  long int *org_isite2,
61  long int *org_isite3,
62  long int *org_isite4,
63  long int *org_sigma1,
64  long int *org_sigma2,
65  long int *org_sigma3,
66  long int *org_sigma4,
67  std::complex<double> *tmp_V,
68  struct BindStruct *X
69  )
70 {
71  long int tmp_org_isite1,tmp_org_isite2,tmp_org_isite3,tmp_org_isite4;
72  long int tmp_org_sigma1,tmp_org_sigma2,tmp_org_sigma3,tmp_org_sigma4;
73 
74  tmp_org_isite1 = X->Def.CisAjtCkuAlvDC[i][0]+1;
75  tmp_org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
76  tmp_org_isite2 = X->Def.CisAjtCkuAlvDC[i][2]+1;
77  tmp_org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
78  tmp_org_isite3 = X->Def.CisAjtCkuAlvDC[i][4]+1;
79  tmp_org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
80  tmp_org_isite4 = X->Def.CisAjtCkuAlvDC[i][6]+1;
81  tmp_org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
82 
83  if(tmp_org_isite1==tmp_org_isite2 && tmp_org_isite3==tmp_org_isite4){
84  if(tmp_org_isite1 > tmp_org_isite3){
85  *org_isite1 = tmp_org_isite3;
86  *org_sigma1 = tmp_org_sigma3;
87  *org_isite2 = tmp_org_isite4;
88  *org_sigma2 = tmp_org_sigma4;
89  *org_isite3 = tmp_org_isite1;
90  *org_sigma3 = tmp_org_sigma1;
91  *org_isite4 = tmp_org_isite2;
92  *org_sigma4 = tmp_org_sigma2;
93  }
94  else{
95  *org_isite1 = tmp_org_isite1;
96  *org_sigma1 = tmp_org_sigma1;
97  *org_isite2 = tmp_org_isite2;
98  *org_sigma2 = tmp_org_sigma2;
99  *org_isite3 = tmp_org_isite3;
100  *org_sigma3 = tmp_org_sigma3;
101  *org_isite4 = tmp_org_isite4;
102  *org_sigma4 = tmp_org_sigma4;
103  }
104  *tmp_V = 1.0;
105 
106  }
107  else if(tmp_org_isite1==tmp_org_isite4 && tmp_org_isite3==tmp_org_isite2){
108  if(tmp_org_isite1 > tmp_org_isite3){
109  *org_isite1 = tmp_org_isite3;
110  *org_sigma1 = tmp_org_sigma3;
111  *org_isite2 = tmp_org_isite2;
112  *org_sigma2 = tmp_org_sigma2;
113  *org_isite3 = tmp_org_isite1;
114  *org_sigma3 = tmp_org_sigma1;
115  *org_isite4 = tmp_org_isite4;
116  *org_sigma4 = tmp_org_sigma4;
117  }
118  else{
119  *org_isite1 = tmp_org_isite1;
120  *org_sigma1 = tmp_org_sigma1;
121  *org_isite2 = tmp_org_isite4;
122  *org_sigma2 = tmp_org_sigma4;
123  *org_isite3 = tmp_org_isite3;
124  *org_sigma3 = tmp_org_sigma3;
125  *org_isite4 = tmp_org_isite2;
126  *org_sigma4 = tmp_org_sigma2;
127  }
128  *tmp_V =-1.0;
129  }
130  else{
131  return -1;
132  }
133  return 0;
134 }
146  struct BindStruct *X,
147  int nstate,
148  std::complex<double> **Xvec,
149  std::complex<double> **vec,
150  std::complex<double> **prod
151 ) {
152  long int i, j;
153  long int isite1, isite2, isite3, isite4;
154  long int org_isite1, org_isite2, org_isite3, org_isite4;
155  long int org_sigma1, org_sigma2, org_sigma3, org_sigma4;
156  long int Asum, Bsum, Adiff, Bdiff;
157  long int tmp_off = 0;
158  long int tmp_off_2 = 0;
159  std::complex<double> tmp_V = 1.0 + 0.0*I;
160  long int i_max;
161 
162  for (i = 0; i < X->Def.NCisAjtCkuAlvDC; i++) {
163  zclear(X->Large.i_max*nstate, &Xvec[1][0]);
164  org_isite1 = X->Def.CisAjtCkuAlvDC[i][0] + 1;
165  org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
166  org_isite2 = X->Def.CisAjtCkuAlvDC[i][2] + 1;
167  org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
168  org_isite3 = X->Def.CisAjtCkuAlvDC[i][4] + 1;
169  org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
170  org_isite4 = X->Def.CisAjtCkuAlvDC[i][6] + 1;
171  org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
172 
173  if (CheckPE(org_isite1 - 1, X) == TRUE || CheckPE(org_isite2 - 1, X) == TRUE ||
174  CheckPE(org_isite3 - 1, X) == TRUE || CheckPE(org_isite4 - 1, X) == TRUE) {
175  isite1 = X->Def.OrgTpow[2 * org_isite1 - 2 + org_sigma1];
176  isite2 = X->Def.OrgTpow[2 * org_isite2 - 2 + org_sigma2];
177  isite3 = X->Def.OrgTpow[2 * org_isite3 - 2 + org_sigma3];
178  isite4 = X->Def.OrgTpow[2 * org_isite4 - 2 + org_sigma4];
179  if (isite1 == isite2 && isite3 == isite4) {
180  X_GC_child_CisAisCjtAjt_Hubbard_MPI(org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3,
181  1.0, X, nstate, Xvec, vec);
182  }
183  else if (isite1 == isite2 && isite3 != isite4) {
185  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3, org_isite4 - 1, org_sigma4,
186  1.0, X, nstate, Xvec, vec);
187  }
188  else if (isite1 != isite2 && isite3 == isite4) {
189  X_GC_child_CisAjtCkuAku_Hubbard_MPI(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
190  org_isite3 - 1, org_sigma3, 1.0, X, nstate, Xvec, vec);
191  }
192  else if (isite1 != isite2 && isite3 != isite4) {
193  X_GC_child_CisAjtCkuAlv_Hubbard_MPI(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
194  org_isite3 - 1, org_sigma3, org_isite4 - 1, org_sigma4, 1.0, X, nstate, Xvec, vec);
195  }
196  }//InterPE
197  else {
198  child_general_int_GetInfo(X, org_isite1, org_isite2, org_isite3, org_isite4,
199  org_sigma1, org_sigma2, org_sigma3, org_sigma4, tmp_V);
200 
201  i_max = X->Large.i_max;
202  isite1 = X->Large.is1_spin;
203  isite2 = X->Large.is2_spin;
204  Asum = X->Large.isA_spin;
205  Adiff = X->Large.A_spin;
206 
207  isite3 = X->Large.is3_spin;
208  isite4 = X->Large.is4_spin;
209  Bsum = X->Large.isB_spin;
210  Bdiff = X->Large.B_spin;
211 
212  if (isite1 == isite2 && isite3 == isite4) {
213 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
214 firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2,tmp_V)
215  for (j = 1; j <= i_max; j++) {
216  GC_child_CisAisCisAis_element(j, isite1, isite3, tmp_V, nstate, Xvec, vec);
217  }
218  }
219  else if (isite1 == isite2 && isite3 != isite4) {
220 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
221 firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2,tmp_V)
222  for (j = 1; j <= i_max; j++) {
223  GC_child_CisAisCjtAku_element(j, isite1, isite3, isite4, Bsum, Bdiff,
224  tmp_V, nstate, Xvec, vec, &tmp_off);
225  }
226  }
227  else if (isite1 != isite2 && isite3 == isite4) {
228 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
229 firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2,tmp_V)
230  for (j = 1; j <= i_max; j++) {
231  GC_child_CisAjtCkuAku_element(j, isite1, isite2, isite3, Asum, Adiff,
232  tmp_V, nstate, Xvec, vec, &tmp_off);
233  }
234  }
235  else if (isite1 != isite2 && isite3 != isite4) {
236 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
237 firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2,tmp_V)
238  for (j = 1; j <= i_max; j++) {
239  GC_child_CisAjtCkuAlv_element(j, isite1, isite2, isite3, isite4, Asum, Adiff, Bsum, Bdiff,
240  tmp_V, nstate, Xvec, vec, &tmp_off_2);
241  }
242  }
243  }
244  MultiVecProdMPI(i_max, nstate, vec, Xvec, prod[i]);
245  }//Intra PE
246  return 0;
247 }
259  struct BindStruct *X,
260  int nstate,
261  std::complex<double> **Xvec,
262  std::complex<double> **vec,
263  std::complex<double> **prod
264 ){
265  long int i, j;
266  long int isite1, isite2, isite3, isite4;
267  long int org_isite1, org_isite2, org_isite3, org_isite4;
268  long int org_sigma1, org_sigma2, org_sigma3, org_sigma4;
269  long int Asum, Bsum, Adiff, Bdiff;
270  long int tmp_off = 0;
271  long int tmp_off_2 = 0;
272  std::complex<double> tmp_V;
273  long int i_max;
274 
275  for (i = 0; i < X->Def.NCisAjtCkuAlvDC; i++) {
276  zclear(X->Large.i_max*nstate, &Xvec[1][0]);
277  org_isite1 = X->Def.CisAjtCkuAlvDC[i][0] + 1;
278  org_sigma1 = X->Def.CisAjtCkuAlvDC[i][1];
279  org_isite2 = X->Def.CisAjtCkuAlvDC[i][2] + 1;
280  org_sigma2 = X->Def.CisAjtCkuAlvDC[i][3];
281  org_isite3 = X->Def.CisAjtCkuAlvDC[i][4] + 1;
282  org_sigma3 = X->Def.CisAjtCkuAlvDC[i][5];
283  org_isite4 = X->Def.CisAjtCkuAlvDC[i][6] + 1;
284  org_sigma4 = X->Def.CisAjtCkuAlvDC[i][7];
285  tmp_V = 1.0;
286 
287  if (X->Def.iFlgSzConserved == TRUE) {
288  if (org_sigma1 + org_sigma3 != org_sigma2 + org_sigma4) {
289  zclear(nstate, prod[i]);
290  continue;
291  }
292  }
293 
294  if (CheckPE(org_isite1 - 1, X) == TRUE || CheckPE(org_isite2 - 1, X) == TRUE ||
295  CheckPE(org_isite3 - 1, X) == TRUE || CheckPE(org_isite4 - 1, X) == TRUE) {
296  isite1 = X->Def.OrgTpow[2 * org_isite1 - 2 + org_sigma1];
297  isite2 = X->Def.OrgTpow[2 * org_isite2 - 2 + org_sigma2];
298  isite3 = X->Def.OrgTpow[2 * org_isite3 - 2 + org_sigma3];
299  isite4 = X->Def.OrgTpow[2 * org_isite4 - 2 + org_sigma4];
300  if (isite1 == isite2 && isite3 == isite4) {
301  X_child_CisAisCjtAjt_Hubbard_MPI(org_isite1 - 1, org_sigma1,
302  org_isite3 - 1, org_sigma3, 1.0, X, nstate, Xvec, vec);
303  }
304  else if (isite1 == isite2 && isite3 != isite4) {
305  //printf("org_isite1=%d, org_isite2=%d, org_isite3=%d, org_isite4=%d\n", org_isite1, org_isite2, org_isite3, org_isite4);
306  X_child_CisAisCjtAku_Hubbard_MPI(org_isite1 - 1, org_sigma1,
307  org_isite3 - 1, org_sigma3, org_isite4 - 1, org_sigma4, 1.0, X, nstate, Xvec, vec);
308  }
309  else if (isite1 != isite2 && isite3 == isite4) {
310  X_child_CisAjtCkuAku_Hubbard_MPI(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
311  org_isite3 - 1, org_sigma3, 1.0, X, nstate, Xvec, vec);
312 
313  }
314  else if (isite1 != isite2 && isite3 != isite4) {
315  X_child_CisAjtCkuAlv_Hubbard_MPI(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
316  org_isite3 - 1, org_sigma3, org_isite4 - 1, org_sigma4, 1.0, X, nstate, Xvec, vec);
317  }
318  }//InterPE
319  else {
321  X, org_isite1, org_isite2, org_isite3, org_isite4,
322  org_sigma1, org_sigma2, org_sigma3, org_sigma4, tmp_V
323  );
324 
325  i_max = X->Large.i_max;
326  isite1 = X->Large.is1_spin;
327  isite2 = X->Large.is2_spin;
328  Asum = X->Large.isA_spin;
329  Adiff = X->Large.A_spin;
330 
331  isite3 = X->Large.is3_spin;
332  isite4 = X->Large.is4_spin;
333  Bsum = X->Large.isB_spin;
334  Bdiff = X->Large.B_spin;
335 
336  tmp_V = 1.0;
337  if (isite1 == isite2 && isite3 == isite4) {
338 #pragma omp parallel for default(none) private(j) shared(vec,tmp_V,Xvec,nstate) \
339 firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2)
340  for (j = 1; j <= i_max; j++) {
341  child_CisAisCisAis_element(j, isite1, isite3, tmp_V, nstate, Xvec, vec);
342  }
343  }
344  else if (isite1 == isite2 && isite3 != isite4) {
345 #pragma omp parallel for default(none) private(j) shared(vec,tmp_V,Xvec,nstate) \
346 firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2)
347  for (j = 1; j <= i_max; j++) {
348  child_CisAisCjtAku_element(j, isite1, isite3, isite4, Bsum, Bdiff,
349  tmp_V, nstate, Xvec, vec, X, &tmp_off);
350  }
351  }
352  else if (isite1 != isite2 && isite3 == isite4) {
353 #pragma omp parallel for default(none) private(j) shared(vec,tmp_V,Xvec,nstate) \
354 firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2)
355  for (j = 1; j <= i_max; j++) {
356  child_CisAjtCkuAku_element(j, isite1, isite2, isite3, Asum, Adiff,
357  tmp_V, nstate, Xvec, vec, X, &tmp_off);
358  }
359  }
360  else if (isite1 != isite2 && isite3 != isite4) {
361 #pragma omp parallel for default(none) private(j) shared(vec,tmp_V,Xvec,nstate) \
362 firstprivate(i_max,X,isite1,isite2,isite4,isite3,Asum,Bsum,Adiff,Bdiff,tmp_off,tmp_off_2)
363  for (j = 1; j <= i_max; j++) {
364  child_CisAjtCkuAlv_element(j, isite1, isite2, isite3, isite4, Asum, Adiff, Bsum, Bdiff,
365  tmp_V, nstate, Xvec, vec, X, &tmp_off_2);
366  }
367  }
368  }
369  MultiVecProdMPI(i_max, nstate, vec, Xvec, prod[i]);
370  }
371  return 0;
372 }
384  struct BindStruct *X,
385  int nstate,
386  std::complex<double> **Xvec,
387  std::complex<double> **vec,
388  std::complex<double> **prod
389 ){
390  long int i, j;
391  long int org_isite1, org_isite2, org_isite3, org_isite4;
392  long int org_sigma1, org_sigma2, org_sigma3, org_sigma4;
393  long int isA_up, isB_up;
394  long int is1_up, is2_up;
395  long int tmp_off = 0;
396  int tmp_sgn, num1, num2, one = 1;
397  std::complex<double> tmp_V;
398  long int i_max;
399  std::complex<double> dmv;
400 
401  i_max = X->Check.idim_max;
402  X->Large.mode = M_CORR;
403 
404  for (i = 0; i < X->Def.NCisAjtCkuAlvDC; i++) {
405  zclear(i_max*nstate, &Xvec[1][0]);
406  if (Rearray_Interactions(i, &org_isite1, &org_isite2, &org_isite3, &org_isite4, &org_sigma1, &org_sigma2, &org_sigma3, &org_sigma4, &tmp_V, X) != 0) {
407  //error message will be added
408  zclear(nstate, prod[i]);
409  continue;
410  }
411 
412  if (org_isite1 > X->Def.Nsite && org_isite3 > X->Def.Nsite) {
413  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
414  is1_up = X->Def.Tpow[org_isite1 - 1];
415  is2_up = X->Def.Tpow[org_isite3 - 1];
416  num1 = X_SpinGC_CisAis((long int)myrank + 1, is1_up, org_sigma1);
417  num2 = X_SpinGC_CisAis((long int)myrank + 1, is2_up, org_sigma3);
418  zaxpy_long(i_max*nstate, tmp_V * (std::complex<double>)(num1*num2),
419  &vec[1][0], &Xvec[1][0]);
420  }
421  else if (org_isite1 == org_isite3 && org_sigma1 == org_sigma4 && org_sigma2 == org_sigma3) {
422  is1_up = X->Def.Tpow[org_isite1 - 1];
423  num1 = X_SpinGC_CisAis((long int)myrank + 1, is1_up, org_sigma1);
424  zaxpy_long(i_max*nstate, tmp_V * (std::complex<double>)num1, &vec[1][0], &Xvec[1][0]);
425  }
426  else if (org_sigma1 == org_sigma4 && org_sigma2 == org_sigma3) {//exchange
428  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3, org_sigma4,
429  tmp_V, X, nstate, Xvec, vec);
430  }
431  else { // other process is not allowed
432  // error message will be added
433  }
434  }
435  else if (org_isite1 > X->Def.Nsite || org_isite3 > X->Def.Nsite) {
436  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
437  is1_up = X->Def.Tpow[org_isite1 - 1];
438  is2_up = X->Def.Tpow[org_isite3 - 1];
439  num2 = X_SpinGC_CisAis((long int)myrank + 1, is2_up, org_sigma3);
440 #pragma omp parallel for default(none)shared(vec,Xvec,nstate,one) \
441  firstprivate(i_max, tmp_V, is1_up, org_sigma1, X, num2) private(j, num1,dmv)
442  for (j = 1; j <= i_max; j++) {
443  num1 = X_Spin_CisAis(j, is1_up, org_sigma1);
444  dmv = tmp_V * (std::complex<double>)(num1*num2);
445  zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[j][0], &one);
446  }
447  }
448  else if (org_sigma1 == org_sigma4 && org_sigma2 == org_sigma3) {//exchange
450  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3, org_sigma4,
451  tmp_V, X, nstate, Xvec, vec);
452  }
453  else { // other process is not allowed
454  // error message will be added
455  }
456  }
457  else {
458  isA_up = X->Def.Tpow[org_isite1 - 1];
459  isB_up = X->Def.Tpow[org_isite3 - 1];
460  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
461 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
462 firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off, tmp_V)
463  for (j = 1; j <= i_max; j++) {
464  child_CisAisCisAis_spin_element(j, isA_up, isB_up, org_sigma2, org_sigma4,
465  tmp_V, nstate, Xvec, vec);
466  }
467  }
468  else if (org_isite1 == org_isite3 && org_sigma1 == org_sigma4 && org_sigma3 == org_sigma2) {
469 #pragma omp parallel for default(none) private(j, dmv) \
470  firstprivate(i_max,X,isA_up,org_sigma1, tmp_V) shared(vec, list_1,Xvec,nstate,one)
471  for (j = 1; j <= i_max; j++) {
472  dmv = tmp_V * (std::complex<double>)X_Spin_CisAis(j, isA_up, org_sigma1);
473  zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[j][0], &one);
474  }
475  }
476  else if (org_sigma1 == org_sigma4 && org_sigma2 == org_sigma3) { // exchange
477 #pragma omp parallel for default(none) private(j, tmp_sgn, dmv) shared(vec,Xvec,nstate,one) \
478 firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V)
479  for (j = 1; j <= i_max; j++) {
480  tmp_sgn = X_child_exchange_spin_element(j, X, isA_up, isB_up, org_sigma2, org_sigma4, &tmp_off);
481  dmv = tmp_sgn;
482  zaxpy_(&nstate, &dmv, &vec[j][0], &one, &Xvec[tmp_off][0], &one);
483  }
484  }
485  else { // other process is not allowed
486  // error message will be added
487  }
488  }
489  MultiVecProdMPI(i_max, nstate, vec, Xvec, prod[i]);
490  }
491  return 0;
492 }
504  struct BindStruct *X,
505  int nstate,
506  std::complex<double> **Xvec,
507  std::complex<double> **vec,
508  std::complex<double> **prod
509 ){
510  long int i, j;
511  long int org_isite1, org_isite2, org_isite3, org_isite4;
512  long int org_sigma1, org_sigma2, org_sigma3, org_sigma4;
513  long int tmp_off = 0;
514  long int tmp_off_2 = 0;
515  long int list1_off = 0;
516  int num1, one = 1;
517  std::complex<double> tmp_V;
518  long int i_max;
519  int tmp_Sz;
520  long int tmp_org = 0;
521  i_max = X->Check.idim_max;
522  X->Large.mode = M_CORR;
523 
524  for (i = 0; i < X->Def.NCisAjtCkuAlvDC; i++) {
525  zclear(i_max*nstate, &Xvec[1][0]);
526 
527  if (Rearray_Interactions(i, &org_isite1, &org_isite2, &org_isite3, &org_isite4, &org_sigma1, &org_sigma2, &org_sigma3, &org_sigma4, &tmp_V, X) != 0) {
528  zclear(nstate, prod[i]);
529  continue;
530  }
531  tmp_Sz = 0;
532 
533  for (j = 0; j < 2; j++) {
534  tmp_org = X->Def.CisAjtCkuAlvDC[i][4 * j + 1] * X->Def.Tpow[X->Def.CisAjtCkuAlvDC[i][4 * j]];
535  tmp_Sz += GetLocal2Sz(X->Def.CisAjtCkuAlvDC[i][4 * j] + 1, tmp_org, X->Def.SiteToBit, X->Def.Tpow);
536  tmp_org = X->Def.CisAjtCkuAlvDC[i][4 * j + 3] * X->Def.Tpow[X->Def.CisAjtCkuAlvDC[i][4 * j + 2]];
537  tmp_Sz -= GetLocal2Sz(X->Def.CisAjtCkuAlvDC[i][4 * j + 2] + 1, tmp_org, X->Def.SiteToBit, X->Def.Tpow);
538  }
539  if (tmp_Sz != 0) { // not Sz conserved
540  zclear(nstate, prod[i]);
541  continue;
542  }
543 
544  if (org_isite1 > X->Def.Nsite && org_isite3 > X->Def.Nsite) {
545  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
547  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3,
548  tmp_V, X, nstate, Xvec, vec);
549  }
550  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
552  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3, org_sigma4,
553  tmp_V, X, nstate, Xvec, vec);
554  }
555  else {
556  }
557  }
558  else if (org_isite3 > X->Def.Nsite || org_isite1 > X->Def.Nsite) {
559  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
561  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3, tmp_V, X, nstate, Xvec, vec);
562  }
563  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
565  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3, org_sigma4,
566  tmp_V, X, nstate, Xvec, vec);
567  }
568  else {
569  }
570  }
571  else {
572  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
573 #pragma omp parallel for default(none) private(j, num1) shared(vec,list_1,Xvec,nstate,one) \
574 firstprivate(i_max,X,org_isite1, org_sigma1,org_isite3, org_sigma3, tmp_V)
575  for (j = 1; j <= i_max; j++) {
576  num1 = BitCheckGeneral(list_1[j], org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
577  if (num1 != FALSE) {
578  num1 = BitCheckGeneral(list_1[j], org_isite3, org_sigma3, X->Def.SiteToBit, X->Def.Tpow);
579  if (num1 != FALSE) {
580  zaxpy_(&nstate, &tmp_V, &vec[j][0], &one, &Xvec[j][0], &one);
581  }
582  }
583  }
584  }
585  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
586 #pragma omp parallel for default(none) private(j,num1) \
587 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) \
588  shared(vec,list_1,Xvec,nstate,one)
589  for (j = 1; j <= i_max; j++) {
590  num1 = GetOffCompGeneralSpin(list_1[j], org_isite3, org_sigma4, org_sigma3, &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
591  if (num1 != FALSE) {
592  num1 = GetOffCompGeneralSpin(tmp_off, org_isite1, org_sigma2, org_sigma1, &tmp_off_2,
593  X->Def.SiteToBit, X->Def.Tpow);
594  if (num1 != FALSE) {
595  ConvertToList1GeneralSpin(tmp_off_2, X->Check.sdim, &list1_off);
596  zaxpy_(&nstate, &tmp_V, &vec[j][0], &one, &Xvec[list1_off][0], &one);
597  }
598  }
599  }
600  }
601  }
602  MultiVecProdMPI(i_max, nstate, vec, Xvec, prod[i]);
603  }
604  return 0;
605 }
617  struct BindStruct *X,
618  int nstate,
619  std::complex<double> **Xvec,
620  std::complex<double> **vec,
621  std::complex<double> **prod
622 ){
623  long int i, j;
624  long int org_isite1, org_isite2, org_isite3, org_isite4;
625  long int org_sigma1, org_sigma2, org_sigma3, org_sigma4;
626  long int isA_up, isB_up;
627  long int tmp_off = 0;
628  std::complex<double> tmp_V;
629  long int i_max;
630  i_max = X->Check.idim_max;
631 
632  for (i = 0; i < X->Def.NCisAjtCkuAlvDC; i++) {
633  zclear(i_max*nstate, &Xvec[1][0]);
634 
635  if (Rearray_Interactions(i, &org_isite1, &org_isite2, &org_isite3, &org_isite4, &org_sigma1, &org_sigma2, &org_sigma3, &org_sigma4, &tmp_V, X) != 0) {
636  //error message will be added
637  zclear(nstate, prod[i]);
638  continue;
639  }
640 
641  if (org_isite1 > X->Def.Nsite && org_isite3 > X->Def.Nsite) { //org_isite3 >= org_isite1 > Nsite
642 
643  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
645  org_isite1 - 1, org_sigma1, (org_isite3 - 1), org_sigma3, tmp_V, X, nstate, Xvec, vec);
646 
647  }
648  else if (org_isite1 == org_isite3 && org_sigma1 == org_sigma4 && org_sigma2 == org_sigma3) { //diagonal (for spin: cuadcdau=cuau)
650  org_isite1 - 1, org_sigma1, tmp_V, X, nstate, Xvec, vec);
651  }
652  else if (org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4) {
654  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3, org_sigma4,
655  tmp_V, X, nstate, Xvec, vec);
656  }
657  else if (org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4) {
659  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3,
660  tmp_V, X, nstate, Xvec, vec);
661  }
662  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
664  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3, org_sigma4,
665  tmp_V, X, nstate, Xvec, vec);
666  }
667  }
668  else if (org_isite3 > X->Def.Nsite || org_isite1 > X->Def.Nsite) { //org_isite3 > Nsite >= org_isite1
669  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
671  org_isite1 - 1, org_sigma1, (org_isite3 - 1), org_sigma3, tmp_V, X, nstate, Xvec, vec);
672 
673  }
674  else if (org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4) {
676  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3, org_sigma4,
677  tmp_V, X, nstate, Xvec, vec);
678  }
679  else if (org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4) {
681  org_isite1 - 1, org_sigma2, org_isite3 - 1, org_sigma3,
682  tmp_V, X, nstate, Xvec, vec);
683  }
684  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
686  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3, org_sigma4,
687  tmp_V, X, nstate, Xvec, vec);
688  }
689  }
690  else {
691  if (org_isite1 == org_isite2 && org_isite3 == org_isite4) {
692  isA_up = X->Def.Tpow[org_isite2 - 1];
693  isB_up = X->Def.Tpow[org_isite4 - 1];
694  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
695 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
696 firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V)
697  for (j = 1; j <= i_max; j++) {
698  GC_child_CisAisCisAis_spin_element(j, isA_up, isB_up, org_sigma2, org_sigma4,
699  tmp_V, nstate, Xvec, vec);
700  }
701  }
702  else if (org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4) {
703 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
704 firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V)
705  for (j = 1; j <= i_max; j++) {
706  GC_child_CisAisCitAiu_spin_element(j, org_sigma2, org_sigma4, isA_up, isB_up,
707  tmp_V, nstate, Xvec, vec, &tmp_off);
708  }
709  }
710  else if (org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4) {
711 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
712 firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V)
713  for (j = 1; j <= i_max; j++) {
714  GC_child_CisAitCiuAiu_spin_element(j, org_sigma2, org_sigma4, isA_up, isB_up,
715  tmp_V, nstate, Xvec, vec, &tmp_off);
716  }
717  }
718  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
719 #pragma omp parallel for default(none) private(j) shared(vec,Xvec,nstate) \
720 firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V)
721  for (j = 1; j <= i_max; j++) {
722  GC_child_CisAitCiuAiv_spin_element(j, org_sigma2, org_sigma4, isA_up, isB_up,
723  tmp_V, nstate, Xvec, vec, &tmp_off);
724  }
725  }
726  }
727  }
728  MultiVecProdMPI(i_max, nstate, vec, Xvec, prod[i]);
729  }
730  return 0;
731 }
743  struct BindStruct *X,
744  int nstate,
745  std::complex<double> **Xvec,
746  std::complex<double> **vec,
747  std::complex<double> **prod
748 ){
749  long int i, j;
750  long int org_isite1, org_isite2, org_isite3, org_isite4;
751  long int org_sigma1, org_sigma2, org_sigma3, org_sigma4;
752  long int tmp_off = 0;
753  long int tmp_off_2 = 0;
754  int num1, one = 1;
755  std::complex<double> tmp_V;
756  long int i_max;
757  i_max = X->Check.idim_max;
758  X->Large.mode = M_CORR;
759 
760  for(i=0;i<X->Def.NCisAjtCkuAlvDC;i++){
761  zclear(i_max*nstate, &Xvec[1][0]);
762 
763  if (Rearray_Interactions(i, &org_isite1, &org_isite2, &org_isite3, &org_isite4, &org_sigma1, &org_sigma2, &org_sigma3, &org_sigma4, &tmp_V, X) != 0) {
764  //error message will be added
765  zclear(nstate, prod[i]);
766  continue;
767  }
768 
769  if (org_isite1 > X->Def.Nsite && org_isite3 > X->Def.Nsite) {
770  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
772  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3, tmp_V, X, nstate, Xvec, vec);
773  }
774  else if (org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4) {
776  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3, org_sigma4,
777  tmp_V, X, nstate, Xvec, vec);
778  }
779  else if (org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4) {
781  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3,
782  tmp_V, X, nstate, Xvec, vec);
783  }
784  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
786  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3, org_sigma4,
787  tmp_V, X, nstate, Xvec, vec);
788  }
789  }
790  else if (org_isite3 > X->Def.Nsite || org_isite1 > X->Def.Nsite) {
791  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
793  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3, tmp_V, X, nstate, Xvec, vec);
794  }
795  else if (org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4) {
797  org_isite1 - 1, org_sigma1, org_isite3 - 1, org_sigma3, org_sigma4,
798  tmp_V, X, nstate, Xvec, vec);
799  }
800  else if (org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4) {
802  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3,
803  tmp_V, X, nstate, Xvec, vec);
804  }
805  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
807  org_isite1 - 1, org_sigma1, org_sigma2, org_isite3 - 1, org_sigma3, org_sigma4,
808  tmp_V, X, nstate, Xvec, vec);
809  }
810  }
811  else {
812  if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) { //diagonal
813 #pragma omp parallel for default(none) private(j, num1) shared(vec,Xvec,nstate,one) \
814 firstprivate(i_max,X,org_isite1, org_sigma1,org_isite3, org_sigma3, tmp_V)
815  for (j = 1; j <= i_max; j++) {
816  num1 = BitCheckGeneral(j - 1, org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
817  if (num1 != FALSE) {
818  num1 = BitCheckGeneral(j - 1, org_isite3, org_sigma3, X->Def.SiteToBit, X->Def.Tpow);
819  if (num1 != FALSE) {
820  zaxpy_(&nstate, &tmp_V, &vec[j][0], &one, &Xvec[j][0], &one);
821  }
822  }
823  }
824  }
825  else if (org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4) {
826 #pragma omp parallel for default(none) private(j, num1) shared(vec,Xvec,nstate,one) \
827 firstprivate(i_max,X, org_isite1, org_isite3, org_sigma1,org_sigma3,org_sigma4, tmp_off, tmp_V)
828  for (j = 1; j <= i_max; j++) {
829  num1 = GetOffCompGeneralSpin(j - 1, org_isite3, org_sigma4, org_sigma3,
830  &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
831  if (num1 != FALSE) {
832  num1 = BitCheckGeneral(tmp_off, org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
833  if (num1 != FALSE) {
834  zaxpy_(&nstate, &tmp_V, &vec[j][0], &one, &Xvec[tmp_off + 1][0], &one);
835  }
836  }
837  }
838  }
839  else if (org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4) {
840 #pragma omp parallel for default(none) private(j, num1) shared(vec,Xvec,nstate,one) \
841 firstprivate(i_max,X, org_isite1, org_isite3, org_sigma1,org_sigma2, org_sigma3, tmp_off, tmp_V)
842  for (j = 1; j <= i_max; j++) {
843  num1 = BitCheckGeneral(j - 1, org_isite3, org_sigma3, X->Def.SiteToBit, X->Def.Tpow);
844  if (num1 != FALSE) {
845  num1 = GetOffCompGeneralSpin(j - 1, org_isite1, org_sigma2, org_sigma1,
846  &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
847  if (num1 != FALSE) {
848  zaxpy_(&nstate, &tmp_V, &vec[j][0], &one, &Xvec[tmp_off + 1][0], &one);
849  }
850  }
851  }
852  }
853  else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
854 #pragma omp parallel for default(none) private(j, num1) \
855 firstprivate(i_max,X,org_isite1,org_isite3,org_sigma1,org_sigma2,org_sigma3,org_sigma4,tmp_off,tmp_off_2,tmp_V) \
856  shared(vec,Xvec,nstate,one)
857  for (j = 1; j <= i_max; j++) {
858  num1 = GetOffCompGeneralSpin(j - 1, org_isite3, org_sigma4, org_sigma3,
859  &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
860  if (num1 != FALSE) {
861  num1 = GetOffCompGeneralSpin(tmp_off, org_isite1, org_sigma2, org_sigma1,
862  &tmp_off_2, X->Def.SiteToBit, X->Def.Tpow);
863  if (num1 != FALSE) {
864  zaxpy_(&nstate, &tmp_V, &vec[j][0], &one, &Xvec[tmp_off_2 + 1][0], &one);
865  }
866  }
867  }
868  }
869  }
870  MultiVecProdMPI(i_max, nstate, vec, Xvec, prod[i]);
871  }
872  return 0;
873 }
885  struct BindStruct *X,
886  int nstate,
887  std::complex<double> **Xvec,
888  std::complex<double> **vec,
889  std::complex<double> **prod
890 ) {
891  int info = 0;
892  if (X->Def.iFlgGeneralSpin == FALSE) {
893  info = expec_cisajscktalt_SpinHalf(X, nstate, Xvec, vec, prod);
894  }
895  else {
896  info = expec_cisajscktalt_SpinGeneral(X, nstate, Xvec, vec, prod);
897  }
898  return info;
899 }
911  struct BindStruct *X,
912  int nstate,
913  std::complex<double> **Xvec,
914  std::complex<double> **vec,
915  std::complex<double> **prod
916 ) {
917  int info = 0;
918  if (X->Def.iFlgGeneralSpin == FALSE) {
919  info = expec_cisajscktalt_SpinGCHalf(X, nstate, Xvec, vec, prod);
920  }
921  else {
922  info = expec_cisajscktalt_SpinGCGeneral(X, nstate, Xvec, vec, prod);
923  }
924  return info;
925 }
944 (
945  struct BindStruct *X,
946  int nstate,
947  std::complex<double> **Xvec,
948  std::complex<double> **vec
949 ) {
950  FILE *fp;
951  char sdt[D_FileNameMax];
952  long int irght, ilft, ihfbit, icaca;
953  std::complex<double> **prod;
954  //For TPQ
955  int step = 0, rand_i = 0, istate;
956 
957  if (X->Def.NCisAjtCkuAlvDC < 1) return 0;
958  X->Large.mode = M_CORR;
959 
960  if (GetSplitBitByModel(X->Def.Nsite, X->Def.iCalcModel, &irght, &ilft, &ihfbit) != 0) {
961  return -1;
962  }
963 
964  //Make File Name for output
965  prod = cd_2d_allocate(X->Def.NCisAjtCkuAlvDC, nstate);
966  switch (X->Def.iCalcType) {
967  case TPQCalc:
968  step = X->Def.istep;
969  TimeKeeperWithRandAndStep(X, "%s_TimeKeeper.dat", "set %d step %d:expec_cisajscktaltdc finishes: %s", "a", 0, step);
970  break;
971  case TimeEvolution:
972  step = X->Def.istep;
973  TimeKeeperWithStep(X, "%s_TimeKeeper.dat", "step %d:expec_cisajscktaltdc finishes: %s", "a", step);
974  break;
975  case FullDiag:
976  case CG:
977  break;
978  }
979 
980  switch (X->Def.iCalcModel) {
981  case HubbardGC:
982  if (expec_cisajscktalt_HubbardGC(X, nstate, Xvec, vec, prod) != 0) {
983  return -1;
984  }
985  break;
986 
987  case KondoGC:
988  case Hubbard:
989  case Kondo:
990  if (expec_cisajscktalt_Hubbard(X, nstate, Xvec, vec, prod) != 0) {
991  return -1;
992  }
993  break;
994 
995  case Spin:
996  if (expec_cisajscktalt_Spin(X, nstate, Xvec, vec, prod) != 0) {
997  return -1;
998  }
999  break;
1000 
1001  case SpinGC:
1002  if (expec_cisajscktalt_SpinGC(X, nstate, Xvec, vec, prod) != 0) {
1003  return -1;
1004  }
1005  break;
1006 
1007  default:
1008  return -1;
1009  }
1010 
1011  for (istate = 0; istate < nstate; istate++) {
1012  switch (X->Def.iCalcType) {
1013  case TPQCalc:
1014  step = X->Def.istep;
1015  sprintf(sdt, "%s_cisajscktalt_set%dstep%d.dat", X->Def.CDataFileHead, istate, step);
1016  break;
1017  case TimeEvolution:
1018  step = X->Def.istep;
1019  sprintf(sdt, "%s_cisajscktalt_step%d.dat", X->Def.CDataFileHead, step);
1020  break;
1021  case FullDiag:
1022  case CG:
1023  sprintf(sdt, "%s_cisajscktalt_eigen%d.dat", X->Def.CDataFileHead, istate);
1024  break;
1025  }
1026  if (childfopenMPI(sdt, "w", &fp) == 0) {
1027  for (icaca = 0; icaca < X->Def.NCisAjtCkuAlvDC; icaca++) {
1028  fprintf(fp, " %4d %4d %4d %4d %4d %4d %4d %4d %.10lf %.10lf\n",
1029  X->Def.CisAjtCkuAlvDC[icaca][0], X->Def.CisAjtCkuAlvDC[icaca][1],
1030  X->Def.CisAjtCkuAlvDC[icaca][2], X->Def.CisAjtCkuAlvDC[icaca][3],
1031  X->Def.CisAjtCkuAlvDC[icaca][4], X->Def.CisAjtCkuAlvDC[icaca][5],
1032  X->Def.CisAjtCkuAlvDC[icaca][6], X->Def.CisAjtCkuAlvDC[icaca][7],
1033  real(prod[icaca][istate]), imag(prod[icaca][istate]));
1034  }
1035  fclose(fp);
1036  }
1037  else return -1;
1038  }/*for (istate = 0; istate < nstate; istate++)*/
1039 
1040  if (X->Def.iCalcType == TPQCalc) {
1041  TimeKeeperWithRandAndStep(X, "%s_TimeKeeper.dat", "set %d step %d:expec_cisajscktaltdc finishes: %s", "a", rand_i, step);
1042  }
1043  else if (X->Def.iCalcType == TimeEvolution) {
1044  TimeKeeperWithStep(X, "%s_TimeKeeper.dat", "step %d:expec_cisajscktaltdc finishes: %s", "a", step);
1045  }
1046  //[s] this part will be added
1047  /* For FullDiag, it is convinient to calculate the total spin for each vector.
1048  Such functions will be added
1049  if(X->Def.iCalcType==FullDiag){
1050  if(X->Def.iCalcModel==Spin){
1051  expec_cisajscktaltdc_alldiag_spin(X,vec);
1052  }else if(X->Def.iCalcModel==Hubbard || X->Def.iCalcModel==Kondo){
1053  expec_cisajscktaltdc_alldiag(X,vec);
1054  }else{//
1055  X->Phys.s2=0.0;
1056  }
1057  }
1058  */
1059  //[e]
1060  free_cd_2d_allocate(prod);
1061  return 0;
1062 }
int expec_cisajscktalt_Hubbard(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
Child function to calculate two-body green&#39;s functions for Hubbard model.
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
int expec_cisajscktalt_SpinGC(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
Parent function to calculate two-body green&#39;s functions for Spin GC model.
void child_CisAjtCkuAku_element(long int j, long int isite1, long int isite2, long int isite3, long int Asum, long int Adiff, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, long int *tmp_off)
Compute term of canonical Hubbard system.
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.
Definition: bitcalc.cpp:78
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
Definition: bitcalc.cpp:392
void GC_child_CisAisCisAis_spin_element(long int j, long int isA_up, long int isB_up, long int org_sigma2, long int org_sigma4, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of grandcanonical spsin system.
long int is2_spin
Mask used in the bit oeration.
Definition: struct.hpp:334
int expec_cisajscktaltdc(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec)
Parent function to calculate two-body green&#39;s functions.
int X_Spin_CisAis(long int j, long int is1_spin, long int sigma1)
Compute the spin state with bit mask is1_spin.
void GC_child_CisAisCitAiu_spin_element(long int j, long int org_sigma2, long int org_sigma4, long int isA_up, long int isB_up, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int *tmp_off)
Compute term of grandcanonical spsin system.
long int * OrgTpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:92
int iFlgSzConserved
Flag whether Sz is conserved.
Definition: struct.hpp:87
void X_child_CisAisCjtAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, std::complex< double > tmp_V, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of canonical Hubbard system.
void X_GC_child_CisAisCjuAjv_spin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region.
int X_child_exchange_spin_element(long int j, struct BindStruct *X, long int isA_up, long int isB_up, long int sigmaA, long int sigmaB, long int *tmp_off)
Compute index of final wavefunction associated to spin-exchange term.
int expec_cisajscktalt_SpinGCGeneral(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
Child function to calculate two-body green&#39;s functions for General Spin GC model. ...
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
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
int expec_cisajscktalt_SpinGeneral(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
Child function to calculate two-body green&#39;s functions for General Spin model.
void X_GC_child_CisAisCjuAju_spin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
std::complex< double > I(0.0, 1.0)
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.cpp:78
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.
Definition: struct.hpp:397
void X_GC_child_CisAitCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
int ** CisAjtCkuAlvDC
[DefineList::NCisAjtCkuAlvDC][4] Indices of two-body correlation function. malloc in setmem_def()...
Definition: struct.hpp:177
void X_GC_child_CisAitCiuAiv_spin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Exchange and Pairlifting term in Spin model + GC When only site2 is in the inter process region...
void X_GC_child_CisAitCjuAju_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
int ConvertToList1GeneralSpin(const long int org_ibit, const long int ihlfbit, long int *_ilist1Comp)
function of converting component to list_1
Definition: bitcalc.cpp:285
void X_GC_child_CisAisCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
void 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, std::complex< double > tmp_V, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of canonical Hubbard system.
int mode
multiply or expectation value.
Definition: struct.hpp:331
void GC_child_CisAisCjtAku_element(long int j, long int isite1, long int isite3, long int isite4, long int Bsum, long int Bdiff, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int *tmp_off)
Compute term of grandcanonical Hubbard system.
long int is4_spin
Mask used in the bit oeration.
Definition: struct.hpp:336
void 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, std::complex< double > tmp_V, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of grandcanonical Hubbard system.
void X_child_general_int_spin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
int expec_cisajscktalt_SpinGCHalf(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
Child function to calculate two-body green&#39;s functions for 1/2 Spin GC model.
void X_child_CisAjtCkuAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_V, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of canonical Hubbard system.
long int A_spin
Mask used in the bit oeration.
Definition: struct.hpp:342
long int B_spin
Mask used in the bit oeration.
Definition: struct.hpp:343
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.cpp:117
Bind.
Definition: struct.hpp:394
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
Definition: bitcalc.cpp:243
void X_GC_child_CisAjtCkuAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_V, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of grandcanonical Hubbard system.
void child_CisAisCjtAku_element(long int j, long int isite1, long int isite3, long int isite4, long int Bsum, long int Bdiff, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, long int *tmp_off)
Compute term of canonical Hubbard system.
void zclear(long int n, std::complex< double > *x)
clear std::complex<double> array.
Definition: mltply.cpp:143
void X_GC_child_CisAitCiuAiv_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
term in Spin model + GC. When both site1 and site2 are in the inter process region.
int expec_cisajscktalt_SpinHalf(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
Child function to calculate two-body green&#39;s functions for 1/2 Spin model.
void X_GC_child_CisAisCjuAjv_spin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
void X_GC_child_CisAitCjuAju_spin_MPIsingle(int org_isite1, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region.
int expec_cisajscktalt_HubbardGC(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
Child function to calculate two-body green&#39;s functions for Hubbard GC model.
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.
Definition: struct.hpp:318
int expec_cisajscktalt_Spin(struct BindStruct *X, int nstate, std::complex< double > **Xvec, std::complex< double > **vec, std::complex< double > **prod)
Parent function to calculate two-body green&#39;s functions for Spin model.
void X_GC_child_CisAitCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
term in Spin model. When both site1 and site3 are in the inter process region.
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
void GC_child_CisAjtCkuAlv_element(long int j, long int isite1, long int isite2, long int isite3, long int isite4, long int Asum, long int Adiff, long int Bsum, long int Bdiff, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int *tmp_off_2)
Compute term of grandcanonical Hubbard system.
void X_child_CisAisCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the canonical general spin system when both sites are in the inter process region...
void X_GC_child_CisAisCjuAju_spin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
void X_GC_child_CisAitCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, 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...
void X_child_CisAisCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the canonical general spin system when one of these sites is in the inter process re...
int GetLocal2Sz(const int isite, const long int org_bit, const long int *SiteToBit, const long int *Tpow)
get 2sz at a site for general spin
Definition: bitcalc.cpp:448
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.hpp:86
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 .
Definition: wrapperMPI.cpp:401
void child_CisAjtCkuAlv_element(long int j, long int isite1, long int isite2, long int isite3, long int isite4, long int Asum, long int Adiff, long int Bsum, long int Bdiff, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, long int *tmp_off_2)
Compute term of canonical Hubbard system.
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.hpp:94
int istep
Index of TPQ step ???
Definition: struct.hpp:78
void X_GC_child_CisAitCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
void X_GC_child_CisAisCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
void child_CisAisCisAis_element(long int j, long int isite1, long int isite3, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of canonical Hubbard system.
int Rearray_Interactions(int i, long int *org_isite1, long int *org_isite2, long int *org_isite3, long int *org_isite4, long int *org_sigma1, long int *org_sigma2, long int *org_sigma3, long int *org_sigma4, std::complex< double > *tmp_V, struct BindStruct *X)
Rearray interactions.
int child_general_int_GetInfo(struct BindStruct *X, long int isite1, long int isite2, long int isite3, long int isite4, long int sigma1, long int sigma2, long int sigma3, long int sigma4, std::complex< double > tmp_V)
Compute mask for bit operation of general interaction term.
void X_GC_child_CisAisCjtAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, std::complex< double > tmp_V, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of grandcanonical Hubbard system.
void child_CisAisCisAis_spin_element(long int j, long int isA_up, long int isB_up, long int org_sigma2, long int org_sigma4, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of canonical spsin system.
void X_child_CisAitCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the canonical general spin system when both sites are in the inter process region...
long int is3_spin
Mask used in the bit oeration.
Definition: struct.hpp:335
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.hpp:200
long int is1_spin
Mask used in the bit oeration.
Definition: struct.hpp:333
void X_child_CisAisCjtAjt_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_V, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of canonical Hubbard system.
int CheckPE(int org_isite, struct BindStruct *X)
Check whether this site is in the inter process region or not.
void X_child_CisAitCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the canonical general spin system when one of these sites is in the inter process re...
long int isA_spin
Mask used in the bit oeration.
Definition: struct.hpp:347
void GC_child_CisAjtCkuAku_element(long int j, long int isite1, long int isite2, long int isite3, long int Asum, long int Adiff, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int *tmp_off)
Compute term of grandcanonical Hubbard system.
void X_child_general_int_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Exchange term in Spin model When both site1 and site2 are in the inter process region.
long int isB_spin
Mask used in the bit oeration.
Definition: struct.hpp:348
void GC_child_CisAitCiuAiu_spin_element(long int j, long int org_sigma2, long int org_sigma4, long int isA_up, long int isB_up, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int *tmp_off)
Compute term of grandcanonical spsin system.
void X_GC_child_CisAisCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
term in Spin model. When both site1 and site3 are in the inter process region.
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green&#39;s function.
Definition: struct.hpp:42
long int sdim
Dimension for Ogata-Lin ???
Definition: struct.hpp:309
int NCisAjtCkuAlvDC
Number of indices of two-body correlation function.
Definition: struct.hpp:178
void GC_child_CisAisCisAis_element(long int j, long int isite1, long int isite3, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of grandcanonical Hubbard system.
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 GC_child_CisAitCiuAiv_spin_element(long int j, long int org_sigma2, long int org_sigma4, long int isA_up, long int isB_up, std::complex< double > tmp_V, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int *tmp_off_2)
Compute term of grandcanonical spsin system.
void X_GC_child_CisAisCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, 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 iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
Definition: struct.hpp:194
void X_GC_child_CisAisCjtAjt_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_V, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term of grandcanonical Hubbard system.
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.cpp:27