HPhi++  3.1.0
mltplyHubbardCore.cpp
Go to the documentation of this file.
1 /* HPhi - Quantum Lattice Model Simulator */
2 /* Copyright (C) 2015 The University of Tokyo */
3 /* This program is free software: you can redistribute it and/or modify */
4 /* it under the terms of the GNU General Public License as published by */
5 /* the Free Software Foundation, either version 3 of the License, or */
6 /* (at your option) any later version. */
7 
8 /* This program is distributed in the hope that it will be useful, */
9 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
10 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
11 /* GNU General Public License for more details. */
12 
13 /* You should have received a copy of the GNU General Public License */
14 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 #include <bitcalc.hpp>
19 #include "xsetmem.hpp"
20 #include "wrapperMPI.hpp"
21 #include "mltplyCommon.hpp"
22 #include "mltplyHubbardCore.hpp"
23 
24 /******************************************************************************/
25 //[s] GetInfo functions
26 /******************************************************************************/
27 
35  struct BindStruct *X,
36  long int isite1,
37  long int isite2,
38  long int sigma1,
39  long int sigma2
40 ) {
45  X->Large.is1_spin = X->Def.Tpow[2 * isite1 - 2 + sigma1];
46  X->Large.is2_spin = X->Def.Tpow[2 * isite2 - 2 + sigma2];
50  if (isite1 > isite2) {
51  X->Large.A_spin = (X->Def.Tpow[2 * isite1 - 2 + sigma1] - X->Def.Tpow[2 * isite2 - 1 + sigma2]);
52  }
53  else if (isite1 < isite2) {
54  X->Large.A_spin = (X->Def.Tpow[2 * isite2 - 2 + sigma2] - X->Def.Tpow[2 * isite1 - 1 + sigma1]);
55  }
56  else {
57  if (sigma1 > sigma2) {
58  X->Large.A_spin = (X->Def.Tpow[2 * isite1 - 2 + sigma1] - X->Def.Tpow[2 * isite2 - 1 + sigma2]);
59  }
60  else {
61  X->Large.A_spin = (X->Def.Tpow[2 * isite2 - 2 + sigma2] - X->Def.Tpow[2 * isite1 - 1 + sigma1]);
62  }
63  }
68  return 0;
69 }/*int child_general_hopp_GetInfo*/
77  struct BindStruct *X,
78  long int isite1,
79  long int isite2,
80  long int isite3,
81  long int isite4,
82  long int sigma1,
83  long int sigma2,
84  long int sigma3,
85  long int sigma4,
86  std::complex<double> tmp_V
87 ) {
88  long int is1_spin, is2_spin, is3_spin, is4_spin;
89  long int A_spin, B_spin;
90  long int isA_spin, isB_spin;
95  is1_spin = X->Def.Tpow[2 * isite1 - 2 + sigma1];
96  is2_spin = X->Def.Tpow[2 * isite2 - 2 + sigma2];
100  if (isite1 > isite2) {
101  A_spin = (X->Def.Tpow[2 * isite1 - 2 + sigma1] - X->Def.Tpow[2 * isite2 - 1 + sigma2]);
102  }
103  else if (isite2 > isite1) {
104  A_spin = (X->Def.Tpow[2 * isite2 - 2 + sigma2] - X->Def.Tpow[2 * isite1 - 1 + sigma1]);
105  }
106  else {//isite1=isite2
107  if (sigma1 > sigma2) {
108  A_spin = (X->Def.Tpow[2 * isite1 - 2 + sigma1] - X->Def.Tpow[2 * isite2 - 1 + sigma2]);
109  }
110  else {
111  A_spin = (X->Def.Tpow[2 * isite2 - 2 + sigma2] - X->Def.Tpow[2 * isite1 - 1 + sigma1]);
112  }
113  }
118  is3_spin = X->Def.Tpow[2 * isite3 - 2 + sigma3];
119  is4_spin = X->Def.Tpow[2 * isite4 - 2 + sigma4];
123  if (isite3 > isite4) {
124  B_spin = (X->Def.Tpow[2 * isite3 - 2 + sigma3] - X->Def.Tpow[2 * isite4 - 1 + sigma4]);
125  }
126  else if (isite3 < isite4) {
127  B_spin = (X->Def.Tpow[2 * isite4 - 2 + sigma4] - X->Def.Tpow[2 * isite3 - 1 + sigma3]);
128  }
129  else {//isite3=isite4
130  if (sigma3 > sigma4) {
131  B_spin = (X->Def.Tpow[2 * isite3 - 2 + sigma3] - X->Def.Tpow[2 * isite4 - 1 + sigma4]);
132  }
133  else {
134  B_spin = (X->Def.Tpow[2 * isite4 - 2 + sigma4] - X->Def.Tpow[2 * isite3 - 1 + sigma3]);
135  }
136  }
140  isA_spin = is1_spin + is2_spin;
141  isB_spin = is3_spin + is4_spin;
142 
143  X->Large.is1_spin = is1_spin;
144  X->Large.is2_spin = is2_spin;
145  X->Large.is3_spin = is3_spin;
146  X->Large.is4_spin = is4_spin;
147  X->Large.isA_spin = isA_spin;
148  X->Large.isB_spin = isB_spin;
149  X->Large.A_spin = A_spin;
150  X->Large.B_spin = B_spin;
154  X->Large.tmp_V = tmp_V;
155  X->Large.isite1 = isite1;
156  X->Large.isite2 = isite2;
157  X->Large.isite3 = isite3;
158  X->Large.isite4 = isite4;
159 
160  return 0;
161 }/*int child_general_int_GetInfo*/
169  int iPairHopp,
170  struct BindStruct *X
171 ) {
172  int isite1 = X->Def.PairHopping[iPairHopp][0] + 1;
173  int isite2 = X->Def.PairHopping[iPairHopp][1] + 1;
177  X->Large.tmp_J = X->Def.ParaPairHopping[iPairHopp];
183  X->Large.is1_up = X->Def.Tpow[2 * isite1 - 2];
184  X->Large.is1_down = X->Def.Tpow[2 * isite1 - 1];
185  X->Large.is2_up = X->Def.Tpow[2 * isite2 - 2];
186  X->Large.is2_down = X->Def.Tpow[2 * isite2 - 1];
187 
188  return 0;
189 }/*int child_pairhopp_GetInfo*/
197  int iExchange,
198  struct BindStruct *X
199 ) {
200  int isite1 = X->Def.ExchangeCoupling[iExchange][0] + 1;
201  int isite2 = X->Def.ExchangeCoupling[iExchange][1] + 1;
205  X->Large.tmp_J = -X->Def.ParaExchangeCoupling[iExchange];
211  X->Large.is1_up = X->Def.Tpow[2 * isite1 - 2];
212  X->Large.is1_down = X->Def.Tpow[2 * isite1 - 1];
213  X->Large.is2_up = X->Def.Tpow[2 * isite2 - 2];
214  X->Large.is2_down = X->Def.Tpow[2 * isite2 - 1];
215 
216  return 0;
217 }/*int child_exchange_GetInfo*/
218 
219 /******************************************************************************/
220 //[e] GetInfo functions
221 /******************************************************************************/
222 
223 /******************************************************************************/
224 //[s] core routines
225 /******************************************************************************/
232  long int j,
233  int nstate,
234  std::complex<double> **tmp_v0,
235  std::complex<double> **tmp_v1,
236  long int is1_spin,
237  std::complex<double> tmp_trans
238 ) {
239  long int A_ibit_tmp;
240  long int list_1_j;
241  std::complex<double> dmv;
242  int one = 1;
243 
244  list_1_j = j - 1;
245  A_ibit_tmp = (list_1_j & is1_spin) / is1_spin;
246  dmv = tmp_trans * (std::complex<double>)A_ibit_tmp;
247  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[j][0], &one);
248 }/*std::complex<double> GC_CisAis*/
254  long int j,
255  int nstate, std::complex<double> **tmp_v0,
256  std::complex<double> **tmp_v1,
257  long int is1_spin,
258  std::complex<double> tmp_trans
259 ) {
260  long int A_ibit_tmp;
261  long int list_1_j;
262  std::complex<double> dmv;
263  int one = 1;
264 
265  list_1_j = j - 1;
266  A_ibit_tmp = (list_1_j & is1_spin) / is1_spin;
267  dmv = tmp_trans * (std::complex<double>)(1 - A_ibit_tmp);
268  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[j][0], &one);
269 }/*std::complex<double> GC_AisCis*/
277  long int list_1_j,
278  long int is1_spin
279 ) {
280  int A_ibit_tmp;
281 
282  // off = j
283  A_ibit_tmp = (list_1_j & is1_spin) / is1_spin;
284  return A_ibit_tmp;
285 }
291 void CisAjt(
292  long int j,
293  int nstate, std::complex<double> **tmp_v0,
294  std::complex<double> **tmp_v1,
295  struct BindStruct *X,
296  long int is1_spin,
297  long int is2_spin,
298  long int sum_spin,
299  long int diff_spin,
300  std::complex<double> tmp_V
301 ) {
302  long int ibit_tmp_1, ibit_tmp_2;
303  long int bit, iexchg, off;
304  int sgn;
305  std::complex<double> dmv;
306  int one = 1;
307 
308  ibit_tmp_1 = (list_1[j] & is1_spin);
309  ibit_tmp_2 = (list_1[j] & is2_spin);
310  if (ibit_tmp_1 == 0 && ibit_tmp_2 != 0) {
311  bit = list_1[j] & diff_spin;
312  SgnBit(bit, &sgn); // Fermion sign
313  iexchg = list_1[j] ^ sum_spin;
314 
315  if(GetOffComp(list_2_1, list_2_2, iexchg, X->Large.irght, X->Large.ilft, X->Large.ihfbit, &off)==FALSE){
316  return;
317  }
318  dmv = (std::complex<double>)sgn * tmp_V;
319  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[off][0], &one);
320  }
321  else {
322  return;
323  }
324 }
331  long int j,
332  int nstate, std::complex<double> **tmp_v0,
333  std::complex<double> **tmp_v1,
334  long int is1_spin,
335  long int is2_spin,
336  long int sum_spin,
337  long int diff_spin,
338  std::complex<double> tmp_V,
339  long int *tmp_off
340 ) {
341  long int list_1_j, list_1_off;
342  long int ibit_tmp_1, ibit_tmp_2;
343  long int bit;
344  int sgn;
345  std::complex<double> dmv;
346 
347  list_1_j = j - 1;
348  ibit_tmp_1 = (list_1_j & is1_spin);
349  ibit_tmp_2 = (list_1_j & is2_spin);
350  *tmp_off = 0;
351  int one = 1;
352 
353  if (ibit_tmp_1 == 0 && ibit_tmp_2 != 0) {
354  bit = list_1_j & diff_spin;
355  SgnBit(bit, &sgn); // Fermion sign
356  list_1_off = list_1_j ^ sum_spin;
357  *tmp_off = list_1_off;
358  dmv = (std::complex<double>)sgn * tmp_V;
359  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[list_1_off + 1][0], &one);
360  }
361  else {
362  return;
363  }
364 }/*std::complex<double> GC_CisAjt*/
372  long int list_1_j,
373  struct BindStruct *X,
374  long int is1_spin,
375  long int is2_spin,
376  long int sum_spin,
377  long int diff_spin,
378  long int *tmp_off
379 ) {
380  long int off;
381  int sgn = 1;
382 
383  sgn = X_GC_CisAjt(list_1_j, is1_spin, is2_spin, sum_spin, diff_spin, tmp_off);
384  if (sgn != 0) {
385  if(GetOffComp(list_2_1, list_2_2, *tmp_off, X->Large.irght, X->Large.ilft, X->Large.ihfbit, &off)!=TRUE){
386  *tmp_off = 0;
387  return 0;
388  }
389  *tmp_off = off;
390  return sgn;
391  }
392  else {
393  *tmp_off = 0;
394  return 0;
395  }
396 }/*int X_CisAjt*/
404  long int list_1_j,
405  long int is1_spin,
406  long int is2_spin,
407  long int sum_spin,
408  long int diff_spin,
409  long int *tmp_off
410 ) {
411  long int ibit_tmp_1, ibit_tmp_2;
412  long int bit, off;
413  int sgn = 1;
414 
415  ibit_tmp_1 = (list_1_j & is1_spin);
416  ibit_tmp_2 = (list_1_j & is2_spin);
417 
418  if (ibit_tmp_1 == 0 && ibit_tmp_2 != 0) {
419  bit = list_1_j & diff_spin;
420  SgnBit(bit, &sgn); // Fermion sign
421  off = list_1_j ^ sum_spin;
422  *tmp_off = off;
423  return sgn; // pm 1
424  }
425  else {
426  *tmp_off = 0;
427  return 0;
428  }
429 }
430 /******************************************************************************/
431 //[e] core routines
432 /******************************************************************************/
433 
434 /******************************************************************************/
435 //[s] child element functions
436 /******************************************************************************/
443  long int j,
444  int nstate, std::complex<double> **tmp_v0,
445  std::complex<double> **tmp_v1,
446  struct BindStruct *X,
447  long int *tmp_off
448 ) {
449  long int off;
450  long int ibit1_up, ibit2_up, ibit1_down, ibit2_down;
451  std::complex<double> dmv;
452  long int iexchg;
453  long int is1_up = X->Large.is1_up;
454  long int is2_up = X->Large.is2_up;
455  long int is1_down = X->Large.is1_down;
456  long int is2_down = X->Large.is2_down;
457  long int irght = X->Large.irght;
458  long int ilft = X->Large.ilft;
459  long int ihfbit = X->Large.ihfbit;
460  std::complex<double> tmp_J = X->Large.tmp_J;
461  int one = 1;
462 
463  ibit1_up = list_1[j] & is1_up;
464  ibit2_up = list_1[j] & is2_up;
465  ibit1_down = list_1[j] & is1_down;
466  ibit2_down = list_1[j] & is2_down;
467 
468  if (ibit1_up == 0 && ibit1_down != 0 && ibit2_up != 0 && ibit2_down == 0) {
469  iexchg = list_1[j] - (is1_down + is2_up);
470  iexchg += (is1_up + is2_down);
471  if(GetOffComp(list_2_1, list_2_2, iexchg, irght, ilft, ihfbit, &off)!=TRUE){
472  return;
473  }
474  *tmp_off = off;
475  dmv = tmp_J;
476  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[off][0], &one);
477  }
478  else if (ibit1_up != 0 && ibit1_down == 0 && ibit2_up == 0 && ibit2_down != 0) {
479  iexchg = list_1[j] - (is1_up + is2_down);
480  iexchg += (is1_down + is2_up);
481  if(GetOffComp(list_2_1, list_2_2, iexchg, irght, ilft, ihfbit, &off)!=TRUE){
482  return;
483  }
484  *tmp_off = off;
485  dmv = tmp_J;
486  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[off][0], &one);
487  }
488 }/*std::complex<double> child_exchange_element*/
495  long int j,
496  int nstate, std::complex<double> **tmp_v0,
497  std::complex<double> **tmp_v1,
498  struct BindStruct *X,
499  long int *tmp_off
500 ) {
501  long int off;
502  long int ibit1_up, ibit2_up, ibit1_down, ibit2_down;
503  std::complex<double> dmv;
504  long int iexchg;
505  long int is1_up = X->Large.is1_up;
506  long int is2_up = X->Large.is2_up;
507  long int is1_down = X->Large.is1_down;
508  long int is2_down = X->Large.is2_down;
509  long int irght = X->Large.irght;
510  long int ilft = X->Large.ilft;
511  long int ihfbit = X->Large.ihfbit;
512  std::complex<double> tmp_J = X->Large.tmp_J;
513  int one = 1;
514 
515  ibit1_up = list_1[j] & is1_up;
516  ibit2_up = list_1[j] & is2_up;
517  ibit1_down = list_1[j] & is1_down;
518  ibit2_down = list_1[j] & is2_down;
519 
520  if (ibit1_up == 0 && ibit1_down == 0 && ibit2_up != 0 && ibit2_down != 0) {
521  iexchg = list_1[j] - (is2_up + is2_down);
522  iexchg += (is1_up + is1_down);
523 
524  if(GetOffComp(list_2_1, list_2_2, iexchg, irght, ilft, ihfbit, &off)!=TRUE){
525  return;
526  }
527  *tmp_off = off;
528  dmv = tmp_J;
529  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[off][0], &one);
530  }
531 }/*std::complex<double> child_pairhopp_element*/
538  long int j,
539  int nstate, std::complex<double> **tmp_v0,
540  std::complex<double> **tmp_v1,
541  struct BindStruct *X,
542  long int *tmp_off
543 ) {
544  long int ibit1_up, ibit2_up, ibit1_down, ibit2_down;
545  std::complex<double> dmv;
546  long int iexchg;
547  long int is1_up = X->Large.is1_up;
548  long int is2_up = X->Large.is2_up;
549  long int is1_down = X->Large.is1_down;
550  long int is2_down = X->Large.is2_down;
551  long int list_1_j, list_1_off;
552  std::complex<double> tmp_J = X->Large.tmp_J;
553  int one = 1;
554 
555  list_1_j = j - 1;
556  ibit1_up = list_1_j & is1_up;
557  ibit2_up = list_1_j & is2_up;
558  ibit1_down = list_1_j & is1_down;
559  ibit2_down = list_1_j & is2_down;
560 
561  if (ibit1_up == 0 && ibit1_down != 0 && ibit2_up != 0 && ibit2_down == 0) {
562 
563  iexchg = list_1_j - (is1_down + is2_up);
564  iexchg += (is1_up + is2_down);
565  list_1_off = iexchg;
566  *tmp_off = list_1_off;
567 
568  dmv = tmp_J;
569  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[list_1_off + 1][0], &one);
570  }
571  else if (ibit1_up != 0 && ibit1_down == 0 && ibit2_up == 0 && ibit2_down != 0) {
572  iexchg = list_1_j - (is1_up + is2_down);
573  iexchg += (is1_down + is2_up);
574  list_1_off = iexchg;
575  *tmp_off = list_1_off;
576 
577  dmv = tmp_J;
578  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[list_1_off + 1][0], &one);
579  }
580 }/*std::complex<double> GC_child_exchange_element*/
587  long int j,
588  int nstate, std::complex<double> **tmp_v0,
589  std::complex<double> **tmp_v1,
590  struct BindStruct *X,
591  long int *tmp_off
592 ) {
593  long int ibit1_up, ibit2_up, ibit1_down, ibit2_down;
594  std::complex<double> dmv;
595  long int iexchg;
596  long int is1_up = X->Large.is1_up;
597  long int is2_up = X->Large.is2_up;
598  long int is1_down = X->Large.is1_down;
599  long int is2_down = X->Large.is2_down;
600  long int list_1_j, list_1_off;
601  std::complex<double> tmp_J = X->Large.tmp_J;
602  int one = 1;
603 
604  list_1_j = j - 1;
605 
606  ibit1_up = list_1_j & is1_up;
607 
608  ibit2_up = list_1_j & is2_up;
609 
610  ibit1_down = list_1_j & is1_down;
611 
612  ibit2_down = list_1_j & is2_down;
613 
614  if (ibit1_up == 0 && ibit1_down == 0 && ibit2_up != 0 && ibit2_down != 0) {
615  iexchg = list_1_j - (is2_up + is2_down);
616  iexchg += (is1_up + is1_down);
617  list_1_off = iexchg;
618  *tmp_off = list_1_off;
619  dmv = tmp_J;
620  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[list_1_off + 1][0], &one);
621  }
622 }
630  long int j,
631  long int isite1,
632  long int isite3,
633  std::complex<double> tmp_V,
634  int nstate, std::complex<double> **tmp_v0,
635  std::complex<double> **tmp_v1
636 ) {
637  int tmp_sgn;
638  std::complex<double> dmv;
639  int one = 1;
640  tmp_sgn = X_CisAis(list_1[j], isite3);
641  tmp_sgn *= X_CisAis(list_1[j], isite1);
642  dmv = tmp_V * (std::complex<double>)tmp_sgn;
643  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[j][0], &one);
644 }/*std::complex<double> child_CisAisCisAis_element*/
652  long int j,
653  long int isite1,
654  long int isite3,
655  long int isite4,
656  long int Bsum,
657  long int Bdiff,
658  std::complex<double> tmp_V,
659  int nstate, std::complex<double> **tmp_v0,
660  std::complex<double> **tmp_v1,
661  struct BindStruct *X,
662  long int *tmp_off
663 ) {
664  int tmp_sgn;
665  std::complex<double> dmv;
666  int one = 1;
667  tmp_sgn = X_CisAjt(list_1[j], X, isite3, isite4, Bsum, Bdiff, tmp_off);
668  if (tmp_sgn != 0) {
669  tmp_sgn *= X_CisAis(list_1[*tmp_off], isite1);
670  if (tmp_sgn != 0) {
671  dmv = tmp_V * (std::complex<double>)tmp_sgn;
672  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[*tmp_off][0], &one);
673  }
674  }
675 }/*std::complex<double> child_CisAisCjtAku_element*/
683  long int j,
684  long int isite1,
685  long int isite2,
686  long int isite3,
687  long int Asum,
688  long int Adiff,
689  std::complex<double> tmp_V,
690  int nstate, std::complex<double> **tmp_v0,
691  std::complex<double> **tmp_v1,
692  struct BindStruct *X,
693  long int *tmp_off
694 ) {
695  int tmp_sgn;
696  std::complex<double> dmv;
697  int one = 1;
698  tmp_sgn = X_CisAis(list_1[j], isite3);
699  if (tmp_sgn != 0) {
700  tmp_sgn *= X_CisAjt(list_1[j], X, isite1, isite2, Asum, Adiff, tmp_off);
701  if (tmp_sgn != 0) {
702  dmv = tmp_V * (std::complex<double>)tmp_sgn;
703  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[*tmp_off][0], &one);
704  }
705  }
706 }/*std::complex<double> child_CisAjtCkuAku_element*/
714  long int j,
715  long int isite1,
716  long int isite2,
717  long int isite3,
718  long int isite4,
719  long int Asum,
720  long int Adiff,
721  long int Bsum,
722  long int Bdiff,
723  std::complex<double> tmp_V,
724  int nstate, std::complex<double> **tmp_v0,
725  std::complex<double> **tmp_v1,
726  struct BindStruct *X,
727  long int *tmp_off_2
728 ) {
729  int tmp_sgn;
730  long int tmp_off_1;
731  int one = 1;
732 
733  std::complex<double> dmv;
734  tmp_sgn = X_GC_CisAjt(list_1[j], isite3, isite4, Bsum, Bdiff, &tmp_off_1);
735 
736  if (tmp_sgn != 0) {
737  tmp_sgn *= X_CisAjt(tmp_off_1, X, isite1, isite2, Asum, Adiff, tmp_off_2);
738  if (tmp_sgn != 0) {
739  dmv = tmp_V * (std::complex<double>)tmp_sgn;
740  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[*tmp_off_2][0], &one);
741  }
742  }
743 }/*std::complex<double> child_CisAjtCkuAlv_element*/
744 //[s] Grand Canonical
752  long int j,
753  long int isite1,
754  long int isite3,
755  std::complex<double> tmp_V,
756  int nstate, std::complex<double> **tmp_v0,
757  std::complex<double> **tmp_v1
758 ) {
759  int tmp_sgn;
760  std::complex<double> dmv;
761  int one = 1;
762  tmp_sgn = X_CisAis(j - 1, isite3);
763  tmp_sgn *= X_CisAis(j - 1, isite1);
764  if (tmp_sgn != 0) {
765  dmv = tmp_V * (std::complex<double>)tmp_sgn;
766  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[j][0], &one);
767  }
768 }/*std::complex<double> GC_child_CisAisCisAis_element*/
776  long int j,
777  long int isite1,
778  long int isite3,
779  long int isite4,
780  long int Bsum,
781  long int Bdiff,
782  std::complex<double> tmp_V,
783  int nstate, std::complex<double> **tmp_v0,
784  std::complex<double> **tmp_v1,
785  long int *tmp_off
786 ) {
787  int tmp_sgn;
788  std::complex<double> dmv;
789  int one = 1;
790  tmp_sgn = X_GC_CisAjt((j - 1), isite3, isite4, Bsum, Bdiff, tmp_off);
791  if (tmp_sgn != 0) {
792  tmp_sgn *= X_CisAis(*tmp_off, isite1);
793  if (tmp_sgn != 0) {
794  dmv = tmp_V * (std::complex<double>)tmp_sgn;
795  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[*tmp_off + 1][0], &one);
796  }
797  }
798 }/*std::complex<double> GC_child_CisAisCjtAku_element*/
806  long int j,
807  long int isite1,
808  long int isite2,
809  long int isite3,
810  long int Asum,
811  long int Adiff,
812  std::complex<double> tmp_V,
813  int nstate, std::complex<double> **tmp_v0,
814  std::complex<double> **tmp_v1,
815  long int *tmp_off
816 ) {
817  int tmp_sgn;
818  std::complex<double> dmv;
819  int one = 1;
820  tmp_sgn = X_CisAis(j - 1, isite3);
821  if (tmp_sgn != 0) {
822  tmp_sgn *= X_GC_CisAjt(j - 1, isite1, isite2, Asum, Adiff, tmp_off);
823  if (tmp_sgn != 0) {
824  dmv = tmp_V * (std::complex<double>)tmp_sgn;
825  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[*tmp_off + 1][0], &one);
826  }/*if (tmp_sgn != 0)*/
827  }/*if (tmp_sgn != 0)*/
828 }/*std::complex<double> GC_child_CisAjtCkuAku_element*/
836  long int j,
837  long int isite1,
838  long int isite2,
839  long int isite3,
840  long int isite4,
841  long int Asum,
842  long int Adiff,
843  long int Bsum,
844  long int Bdiff,
845  std::complex<double> tmp_V,
846  int nstate, std::complex<double> **tmp_v0,
847  std::complex<double> **tmp_v1,
848  long int *tmp_off_2
849 ) {
850  int tmp_sgn;
851  long int tmp_off_1;
852  std::complex<double> dmv;
853  int one = 1;
854 
855  tmp_sgn = X_GC_CisAjt(j - 1, isite3, isite4, Bsum, Bdiff, &tmp_off_1);
856  if (tmp_sgn != 0) {
857  tmp_sgn *= X_GC_CisAjt(tmp_off_1, isite1, isite2, Asum, Adiff, tmp_off_2);
858  if (tmp_sgn != 0) {
859  dmv = tmp_V * (std::complex<double>)tmp_sgn;
860  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[*tmp_off_2 + 1][0], &one);
861  }
862  }
863 }/*std::complex<double> GC_child_CisAjtCkuAlv_element*/
864 //[e] Grand Canonical
872 void GC_Cis(
873  long int j,
874  int nstate, std::complex<double> **tmp_v0,
875  std::complex<double> **tmp_v1,
876  long int is1_spin,
877  std::complex<double> tmp_V,
878  long int *tmp_off
879 ) {
880  long int list_1_j, list_1_off;
881  long int ibit_tmp_1;
882  long int bit;
883  int sgn, ipsgn;
884  std::complex<double> dmv;
885  int one = 1;
886 
887  list_1_j = j - 1;
888 
889  ibit_tmp_1 = (list_1_j & is1_spin);
890  // is1_spin >= 1
891  // is1_spin = Tpow[2*isite + ispin]
892 
893  *tmp_off = 0;
894 
895  if (ibit_tmp_1 == 0) {
896  // able to create an electron at the is1_spin state
897  bit = list_1_j - (list_1_j & (2 * is1_spin - 1));
898  SgnBit(bit, &sgn); // Fermion sign
899  ipsgn = 1;
900 #ifdef __MPI
901  SgnBit(myrank, &ipsgn); // Fermion sign
902 #endif
903  list_1_off = list_1_j | is1_spin; // OR
904  *tmp_off = list_1_off;
905  dmv = (std::complex<double>)(ipsgn * sgn) * tmp_V;
906  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[list_1_off + 1][0], &one);
907  }
908  else {
909  return;
910  }
911 }/*std::complex<double> GC_Cis*/
919 void GC_Ajt(
920  long int j,
921  int nstate, std::complex<double> **tmp_v0,
922  std::complex<double> **tmp_v1,
923  long int is1_spin,
924  std::complex<double> tmp_V,
925  long int *tmp_off
926 ) {
927  long int list_1_j, list_1_off;
928  long int ibit_tmp_1;
929  long int bit;
930  int sgn, ipsgn;
931  std::complex<double> dmv;
932  int one = 1;
933 
934  list_1_j = j - 1;
935 
936  ibit_tmp_1 = (list_1_j & is1_spin);
937  // is1_spin >= 1
938 
939  *tmp_off = 0;
940 
941  if (ibit_tmp_1 == is1_spin) {
942  // able to create an electron at the is1_spin state
943  bit = list_1_j - (list_1_j & (2 * is1_spin - 1));
944  SgnBit(bit, &sgn); // Fermion sign
945  ipsgn = 1;
946 #ifdef __MPI
947  SgnBit(myrank, &ipsgn); // Fermion sign
948 #endif
949  list_1_off = list_1_j ^ is1_spin;
950  *tmp_off = list_1_off;
951  dmv = (std::complex<double>)(ipsgn * sgn) * tmp_V;
952  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[list_1_off + 1][0], &one);
953  }
954  else {
955  return;
956  }
957 }/*std::complex<double> GC_Ajt*/
966 int X_Cis(
967  long int j,
968  long int is1_spin,
969  long int *tmp_off,
970  long int *list_1_org,
971  long int *list_2_1_target,
972  long int *list_2_2_target,
973  long int _irght,
974  long int _ilft,
975  long int _ihfbit
976 ) {
977  long int list_1_j, list_1_off;
978  long int ibit_tmp_1;
979  long int bit;
980  int sgn, ipsgn;
981 
982  list_1_j = list_1_org[j];
983 
984  ibit_tmp_1 = (list_1_j & is1_spin);
985  // is1_spin >= 1
986  // is1_spin = Tpow[2*isite + ispin]
987 
988  *tmp_off = 0;
989 
990  if (ibit_tmp_1 == 0) {
991  // able to create an electron at the is1_spin state
992  bit = list_1_j - (list_1_j & (2 * is1_spin - 1));
993  SgnBit(bit, &sgn); // Fermion sign
994  ipsgn = 1;
995 #ifdef __MPI
996  SgnBit(myrank, &ipsgn); // Fermion sign
997 #endif
998  list_1_off = list_1_j | is1_spin; // OR
999 
1000  if(GetOffComp(list_2_1_target, list_2_2_target, list_1_off, _irght, _ilft, _ihfbit, tmp_off)!=TRUE){
1001  *tmp_off=0;
1002  return 0;
1003  }
1004  sgn *= ipsgn;
1005  return (sgn);
1006  }
1007  else {
1008  *tmp_off = 0;
1009  return 0;
1010  }
1011 }/*int X_Cis*/
1020 int X_Ajt(
1021  long int j,
1022  long int is1_spin,
1023  long int *tmp_off,
1024  long int *list_1_org,
1025  long int *list_2_1_target,
1026  long int *list_2_2_target,
1027  long int _irght,
1028  long int _ilft,
1029  long int _ihfbit
1030 ) {
1031  long int list_1_j, list_1_off;
1032  long int ibit_tmp_1;
1033  long int bit;
1034  int sgn, ipsgn;
1035 
1036  list_1_j = list_1_org[j];
1037 
1038  ibit_tmp_1 = (list_1_j & is1_spin);
1039 // is1_spin >= 1
1040 // is1_spin = Tpow[2*isite + ispin]
1041 
1042  *tmp_off = 0;
1043  if (ibit_tmp_1 != 0) {
1044  // able to delete an electron at the is1_spin state
1045  bit = list_1_j - (list_1_j & (2 * is1_spin - 1));
1046  SgnBit(bit, &sgn); // Fermion sign
1047  ipsgn = 1;
1048 #ifdef __MPI
1049  SgnBit(myrank, &ipsgn); // Fermion sign
1050 #endif
1051  list_1_off = list_1_j ^ is1_spin;
1052  if(GetOffComp(list_2_1_target, list_2_2_target, list_1_off, _irght, _ilft, _ihfbit, tmp_off)!=TRUE){
1053  *tmp_off=0;
1054  return 0;
1055  }
1056  sgn *= ipsgn;
1057  return(sgn);
1058  }
1059  else {
1060  *tmp_off = 0;
1061  return 0;
1062  }
1063 }/*std::complex<double> X_Ajt*/
1064 
1065 /******************************************************************************/
1066 //[e] child element functions
1067 /******************************************************************************/
int child_exchange_GetInfo(int iExchange, struct BindStruct *X)
Compute mask for bit operation of exchange term.
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
long int is1_down
Mask used in the bit oeration.
Definition: struct.hpp:327
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.
void GC_AisCis(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int is1_spin, std::complex< double > tmp_trans)
Operation of (Grandcanonical)
long int is2_spin
Mask used in the bit oeration.
Definition: struct.hpp:334
long int * list_2_1
Definition: global.cpp:27
long int * list_2_2
Definition: global.cpp:28
void GC_CisAjt(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int is1_spin, long int is2_spin, long int sum_spin, long int diff_spin, std::complex< double > tmp_V, long int *tmp_off)
term for grandcanonical Hubbard
int ** ExchangeCoupling
[DefineList::NExchangeCoupling][2] Index of exchange term. malloc in setmem_def().
Definition: struct.hpp:146
void child_exchange_element(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, long int *tmp_off)
Compute exchange term of canonical-Hubbard.
long int is1_up
Mask used in the bit oeration.
Definition: struct.hpp:326
void GC_child_exchange_element(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, long int *tmp_off)
Compute exchange term of grandcanonical Hubbard system.
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
std::complex< double > tmp_J
Coupling constant.
Definition: struct.hpp:324
long int * list_1_org
Definition: global.cpp:31
int isite2
Is it realy used ???
Definition: struct.hpp:338
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
long int irght
Used for Ogata-Lin ???
Definition: struct.hpp:344
int X_GC_CisAjt(long int list_1_j, long int is1_spin, long int is2_spin, long int sum_spin, long int diff_spin, long int *tmp_off)
Compute index of wavefunction of final state.
int isite3
Is it realy used ???
Definition: struct.hpp:339
long int A_spin
Mask used in the bit oeration.
Definition: struct.hpp:342
int ** PairHopping
[DefineList::NPairHopping][2] Index of pair-hopping. malloc in setmem_def().
Definition: struct.hpp:140
void GC_Ajt(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int is1_spin, std::complex< double > tmp_V, long int *tmp_off)
Compute term of grandcanonical Hubbard system.
int X_Cis(long int j, long int is1_spin, long int *tmp_off, long int *list_1_org, long int *list_2_1_target, long int *list_2_2_target, long int _irght, long int _ilft, long int _ihfbit)
Compute index of final wavefunction associatesd to term of canonical Hubbard system.
void GC_CisAis(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int is1_spin, std::complex< double > tmp_trans)
Operation of (Grandcanonical)
long int B_spin
Mask used in the bit oeration.
Definition: struct.hpp:343
int child_pairhopp_GetInfo(int iPairHopp, struct BindStruct *X)
Compute mask for bit operation of pairhop term.
long int ilft
Used for Ogata-Lin ???
Definition: struct.hpp:345
Bind.
Definition: struct.hpp:394
double * ParaExchangeCoupling
[DefineList::NExchangeCoupling] Coupling constant of exchange term. malloc in setmem_def().
Definition: struct.hpp:148
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.
int GetOffComp(long int *_list_2_1, long int *_list_2_2, long int _ibit, const long int _irght, const long int _ilft, const long int _ihfbit, long int *_ioffComp)
function of getting off-diagonal component
Definition: bitcalc.cpp:195
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
void GC_child_pairhopp_element(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, long int *tmp_off)
Compute pairhopp term of grandcanonical Hubbard system.
int X_Ajt(long int j, long int is1_spin, long int *tmp_off, long int *list_1_org, long int *list_2_1_target, long int *list_2_2_target, long int _irght, long int _ilft, long int _ihfbit)
Compute index of final wavefunction associatesd to term of canonical Hubbard system.
int X_CisAis(long int list_1_j, long int is1_spin)
term in Hubbard (canonical)
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.
int X_CisAjt(long int list_1_j, struct BindStruct *X, long int is1_spin, long int is2_spin, long int sum_spin, long int diff_spin, long int *tmp_off)
Compute index of wavefunction of final state.
void child_pairhopp_element(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, long int *tmp_off)
Compute pairhopp term of canonical Hubbard system.
int isite4
Is it realy used ???
Definition: struct.hpp:340
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 * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
void GC_Cis(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int is1_spin, std::complex< double > tmp_V, long int *tmp_off)
Compute term of grandcanonical Hubbard system.
double * ParaPairHopping
[DefineList::NPairHopping] Coupling constant of pair-hopping term. malloc in setmem_def().
Definition: struct.hpp:142
int child_general_hopp_GetInfo(struct BindStruct *X, long int isite1, long int isite2, long int sigma1, long int sigma2)
Compute mask for bit operation of hopping term.
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 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.
long int is3_spin
Mask used in the bit oeration.
Definition: struct.hpp:335
long int is1_spin
Mask used in the bit oeration.
Definition: struct.hpp:333
long int isA_spin
Mask used in the bit oeration.
Definition: struct.hpp:347
void CisAjt(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, long int is1_spin, long int is2_spin, long int sum_spin, long int diff_spin, std::complex< double > tmp_V)
term for canonical Hubbard
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.
long int isB_spin
Mask used in the bit oeration.
Definition: struct.hpp:348
long int is2_down
Mask used in the bit oeration.
Definition: struct.hpp:329
int isite1
Is it realy used ???
Definition: struct.hpp:337
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 is2_up
Mask used in the bit oeration.
Definition: struct.hpp:328
void SgnBit(const long int org_bit, int *sgn)
function of getting fermion sign (64 bit)
Definition: bitcalc.cpp:338
std::complex< double > tmp_V
Coupling constant.
Definition: struct.hpp:349