HΦ  3.2.0
mltplyHubbard.c
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/>. */
137 #include <bitcalc.h>
138 #include "mltplyCommon.h"
139 #include "mltplyHubbard.h"
140 #include "mltplyMPIHubbard.h"
141 #include "CalcTime.h"
142 #include "mltplyHubbardCore.h"
143 #include "mltplyMPIHubbardCore.h"
151  struct BindStruct *X,
152  double complex *tmp_v0,
153  double complex *tmp_v1
154 ){
155  long unsigned int i;
156  long unsigned int isite1, isite2, sigma1, sigma2;
157  long unsigned int isite3, isite4, sigma3, sigma4;
158  long unsigned int ibitsite1, ibitsite2, ibitsite3, ibitsite4;
159 
160  double complex dam_pr;
161  double complex tmp_trans;
162  /*[s] For InterAll */
163  double complex tmp_V;
164  /*[e] For InterAll */
165 
166  int ihermite=0;
167  int idx=0;
168 
169  StartTimer(300);
173  StartTimer(310);
174  for (i = 0; i < X->Def.EDNTransfer; i+=2) {
175  if (X->Def.EDGeneralTransfer[i][0] + 1 > X->Def.Nsite &&
176  X->Def.EDGeneralTransfer[i][2] + 1 > X->Def.Nsite) {
177  StartTimer(311);
178  child_general_hopp_MPIdouble(i, X, tmp_v0, tmp_v1);
179  StopTimer(311);
180  }
181  else if (X->Def.EDGeneralTransfer[i][2] + 1 > X->Def.Nsite) {
182  StartTimer(312);
183  child_general_hopp_MPIsingle(i, X, tmp_v0, tmp_v1);
184  StopTimer(312);
185  }
186  else if (X->Def.EDGeneralTransfer[i][0] + 1 > X->Def.Nsite) {
187  StartTimer(312);
188  child_general_hopp_MPIsingle(i + 1, X, tmp_v0, tmp_v1);
189  StopTimer(312);
190  }
191  else {
192  StartTimer(313);
193  for (ihermite = 0; ihermite<2; ihermite++) {
194  idx = i + ihermite;
195  isite1 = X->Def.EDGeneralTransfer[idx][0] + 1;
196  isite2 = X->Def.EDGeneralTransfer[idx][2] + 1;
197  sigma1 = X->Def.EDGeneralTransfer[idx][1];
198  sigma2 = X->Def.EDGeneralTransfer[idx][3];
199  if (child_general_hopp_GetInfo(X, isite1, isite2, sigma1, sigma2) != 0) {
200  return -1;
201  }
202  tmp_trans = -X->Def.EDParaGeneralTransfer[idx];
203  X->Large.tmp_trans = tmp_trans;
204  dam_pr = child_general_hopp(tmp_v0, tmp_v1, X, tmp_trans);
205  X->Large.prdct += dam_pr;
206  }
207  StopTimer(313);
208  }
209  }/*for (i = 0; i < X->Def.EDNTransfer; i+=2)*/
210  StopTimer(310);
214  StartTimer(320);
215  for (i = 0; i < X->Def.NInterAll_OffDiagonal; i+=2) {
216 
217  isite1 = X->Def.InterAll_OffDiagonal[i][0] + 1;
218  isite2 = X->Def.InterAll_OffDiagonal[i][2] + 1;
219  isite3 = X->Def.InterAll_OffDiagonal[i][4] + 1;
220  isite4 = X->Def.InterAll_OffDiagonal[i][6] + 1;
221  sigma1 = X->Def.InterAll_OffDiagonal[i][1];
222  sigma2 = X->Def.InterAll_OffDiagonal[i][3];
223  sigma3 = X->Def.InterAll_OffDiagonal[i][5];
224  sigma4 = X->Def.InterAll_OffDiagonal[i][7];
225  tmp_V = X->Def.ParaInterAll_OffDiagonal[i];
226 
227  dam_pr = 0.0;
228  if (CheckPE(isite1 - 1, X) == TRUE || CheckPE(isite2 - 1, X) == TRUE ||
229  CheckPE(isite3 - 1, X) == TRUE || CheckPE(isite4 - 1, X) == TRUE) {
230  StartTimer(321);
231  ibitsite1 = X->Def.OrgTpow[2*isite1-2+sigma1] ;
232  ibitsite2 = X->Def.OrgTpow[2 * isite2 - 2 + sigma2];
233  ibitsite3 = X->Def.OrgTpow[2 * isite3 - 2 + sigma3];
234  ibitsite4 = X->Def.OrgTpow[2 * isite4 - 2 + sigma4];
235  if (ibitsite1 == ibitsite2 && ibitsite3 == ibitsite4) {
236  dam_pr += X_child_CisAisCjtAjt_Hubbard_MPI(isite1 - 1, sigma1,
237  isite3 - 1, sigma3,
238  tmp_V, X, tmp_v0, tmp_v1);
239  }
240  else if (ibitsite1 == ibitsite2 && ibitsite3 != ibitsite4) {
241  dam_pr += X_child_CisAisCjtAku_Hubbard_MPI(isite1 - 1, sigma1,
242  isite3 - 1, sigma3, isite4 - 1, sigma4,
243  tmp_V, X, tmp_v0, tmp_v1);
244  }
245  else if (ibitsite1 != ibitsite2 && ibitsite3 == ibitsite4) {
246  dam_pr += X_child_CisAjtCkuAku_Hubbard_MPI(isite1 - 1, sigma1, isite2 - 1, sigma2,
247  isite3 - 1, sigma3, tmp_V, X, tmp_v0, tmp_v1);
248  }
249  else if (ibitsite1 != ibitsite2 && ibitsite3 != ibitsite4) {
250  dam_pr += X_child_CisAjtCkuAlv_Hubbard_MPI(isite1 - 1, sigma1, isite2 - 1, sigma2,
251  isite3 - 1, sigma3, isite4 - 1, sigma4, tmp_V, X, tmp_v0, tmp_v1);
252  }
253  StopTimer(321);
254  }
255  else {
256  StartTimer(322);
257  for (ihermite = 0; ihermite < 2; ihermite++) {
258  idx = i + ihermite;
259  isite1 = X->Def.InterAll_OffDiagonal[idx][0] + 1;
260  isite2 = X->Def.InterAll_OffDiagonal[idx][2] + 1;
261  isite3 = X->Def.InterAll_OffDiagonal[idx][4] + 1;
262  isite4 = X->Def.InterAll_OffDiagonal[idx][6] + 1;
263  sigma1 = X->Def.InterAll_OffDiagonal[idx][1];
264  sigma2 = X->Def.InterAll_OffDiagonal[idx][3];
265  sigma3 = X->Def.InterAll_OffDiagonal[idx][5];
266  sigma4 = X->Def.InterAll_OffDiagonal[idx][7];
267  tmp_V = X->Def.ParaInterAll_OffDiagonal[idx];
268 
269  child_general_int_GetInfo(i, X, isite1, isite2, isite3, isite4,
270  sigma1, sigma2, sigma3, sigma4, tmp_V);
271 
272  dam_pr += child_general_int(tmp_v0, tmp_v1, X);
273  }/*for (ihermite = 0; ihermite < 2; ihermite++)*/
274  StopTimer(322);
275  }
276  X->Large.prdct += dam_pr;
277  }/*for (i = 0; i < X->Def.NInterAll_OffDiagonal; i+=2)*/
278  StopTimer(320);
282  StartTimer(330);
283  for (i = 0; i < X->Def.NPairHopping; i +=2) {
284  sigma1=0;
285  sigma2=1;
286  dam_pr = 0.0;
287 
288  if ( X->Def.PairHopping[i][0] + 1 > X->Def.Nsite
289  || X->Def.PairHopping[i][1] + 1 > X->Def.Nsite)
290  {
291  StartTimer(331);
293  X->Def.PairHopping[i][0], sigma1, X->Def.PairHopping[i][1], sigma1,
294  X->Def.PairHopping[i][0], sigma2, X->Def.PairHopping[i][1], sigma2,
295  X->Def.ParaPairHopping[i], X, tmp_v0, tmp_v1);
296  StopTimer(331);
297  }
298  else {
299  StartTimer(332);
300  for (ihermite = 0; ihermite<2; ihermite++) {
301  idx = i + ihermite;
302  child_pairhopp_GetInfo(idx, X);
303  dam_pr += child_pairhopp(tmp_v0, tmp_v1, X);
304  }/*for (ihermite = 0; ihermite<2; ihermite++)*/
305  StopTimer(332);
306  }
307  X->Large.prdct += dam_pr;
308  }/*for (i = 0; i < X->Def.NPairHopping; i += 2)*/
309  StopTimer(330);
313  StartTimer(340);
314  for (i = 0; i < X->Def.NExchangeCoupling; i ++) {
315  sigma1 = 0;
316  sigma2 = 1;
317  dam_pr=0.0;
318  if (X->Def.ExchangeCoupling[i][0] + 1 > X->Def.Nsite ||
319  X->Def.ExchangeCoupling[i][1] + 1 > X->Def.Nsite)
320  {
321  StartTimer(341);
323  X->Def.ExchangeCoupling[i][0], sigma1, X->Def.ExchangeCoupling[i][1], sigma1,
324  X->Def.ExchangeCoupling[i][1], sigma2, X->Def.ExchangeCoupling[i][0], sigma2,
325  X->Def.ParaExchangeCoupling[i], X, tmp_v0, tmp_v1);
326  StopTimer(341);
327  }
328  else {
329  StartTimer(342);
331  dam_pr = child_exchange(tmp_v0, tmp_v1, X);
332  StopTimer(342);
333  }
334  X->Large.prdct += dam_pr;
335  }/*for (i = 0; i < X->Def.NExchangeCoupling; i ++)*/
336  StopTimer(340);
337 
338  StopTimer(300);
339  return 0;
340 }/*int mltplyHubbard*/
348  struct BindStruct *X,
349  double complex *tmp_v0,
350  double complex *tmp_v1
351 ){
352  long unsigned int i;
353  long unsigned int isite1, isite2, sigma1, sigma2;
354  long unsigned int isite3, isite4, sigma3, sigma4;
355  long unsigned int ibitsite1, ibitsite2, ibitsite3, ibitsite4;
356 
357  double complex dam_pr;
358  double complex tmp_trans;
359  /*[s] For InterAll */
360  double complex tmp_V;
361  /*[e] For InterAll */
362 
363  int ihermite=0;
364  int idx=0;
365 
366  StartTimer(200);
370  StartTimer(210);
371  for (i = 0; i < X->Def.EDNTransfer; i += 2) {
372  if (X->Def.EDGeneralTransfer[i][0] + 1 > X->Def.Nsite &&
373  X->Def.EDGeneralTransfer[i][2] + 1 > X->Def.Nsite) {
374  StartTimer(211);
375  GC_child_general_hopp_MPIdouble(i, X, tmp_v0, tmp_v1);
376  StopTimer(211);
377  }
378  else if (X->Def.EDGeneralTransfer[i][2] + 1 > X->Def.Nsite){
379  StartTimer(212);
380  GC_child_general_hopp_MPIsingle(i, X, tmp_v0, tmp_v1);
381  StopTimer(212);
382  }
383  else if (X->Def.EDGeneralTransfer[i][0] + 1 > X->Def.Nsite) {
384  StartTimer(212);
385  GC_child_general_hopp_MPIsingle(i+1, X, tmp_v0, tmp_v1);
386  StopTimer(212);
387  }
388  else {
389  StartTimer(213);
390  for (ihermite = 0; ihermite<2; ihermite++) {
391  idx = i + ihermite;
392  isite1 = X->Def.EDGeneralTransfer[idx][0] + 1;
393  isite2 = X->Def.EDGeneralTransfer[idx][2] + 1;
394  sigma1 = X->Def.EDGeneralTransfer[idx][1];
395  sigma2 = X->Def.EDGeneralTransfer[idx][3];
396  if (child_general_hopp_GetInfo(X, isite1, isite2, sigma1, sigma2) != 0) {
397  return -1;
398  }
399  tmp_trans = -X->Def.EDParaGeneralTransfer[idx];
400  dam_pr = GC_child_general_hopp(tmp_v0, tmp_v1, X, tmp_trans);
401  X->Large.prdct += dam_pr;
402  }
403  StopTimer(213);
404  }
405  }/*for (i = 0; i < X->Def.EDNTransfer; i += 2)*/
406  StopTimer(210);
410  StartTimer(220);
411  for (i = 0; i < X->Def.NInterAll_OffDiagonal; i+=2) {
412  isite1 = X->Def.InterAll_OffDiagonal[i][0] + 1;
413  isite2 = X->Def.InterAll_OffDiagonal[i][2] + 1;
414  isite3 = X->Def.InterAll_OffDiagonal[i][4] + 1;
415  isite4 = X->Def.InterAll_OffDiagonal[i][6] + 1;
416  sigma1 = X->Def.InterAll_OffDiagonal[i][1];
417  sigma2 = X->Def.InterAll_OffDiagonal[i][3];
418  sigma3 = X->Def.InterAll_OffDiagonal[i][5];
419  sigma4 = X->Def.InterAll_OffDiagonal[i][7];
420  tmp_V = X->Def.ParaInterAll_OffDiagonal[i];
421 
422  if ( CheckPE(isite1 - 1, X) == TRUE || CheckPE(isite2 - 1, X) == TRUE
423  || CheckPE(isite3 - 1, X) == TRUE || CheckPE(isite4 - 1, X) == TRUE)
424  {
425  StartTimer(221);
426  ibitsite1 = X->Def.OrgTpow[2 * isite1 - 2 + sigma1];
427  ibitsite2 = X->Def.OrgTpow[2 * isite2 - 2 + sigma2];
428  ibitsite3 = X->Def.OrgTpow[2 * isite3 - 2 + sigma3];
429  ibitsite4 = X->Def.OrgTpow[2 * isite4 - 2 + sigma4];
430  if (ibitsite1 == ibitsite2 && ibitsite3 == ibitsite4)
432  isite1 - 1, sigma1, isite3 - 1, sigma3, tmp_V, X, tmp_v0, tmp_v1);
433  else if (ibitsite1 == ibitsite2 && ibitsite3 != ibitsite4)
435  isite1 - 1, sigma1, isite3 - 1, sigma3, isite4 - 1, sigma4, tmp_V, X, tmp_v0, tmp_v1);
436  else if (ibitsite1 != ibitsite2 && ibitsite3 == ibitsite4)
438  isite1 - 1, sigma1, isite2 - 1, sigma2, isite3 - 1, sigma3, tmp_V, X, tmp_v0, tmp_v1);
439  else if (ibitsite1 != ibitsite2 && ibitsite3 != ibitsite4)
441  isite1 - 1, sigma1, isite2 - 1, sigma2, isite3 - 1, sigma3, isite4 - 1, sigma4, tmp_V, X, tmp_v0, tmp_v1);
442  StopTimer(221);
443  }//InterPE
444  else{
445  StartTimer(222);
446  dam_pr=0.0;
447  for(ihermite=0; ihermite<2; ihermite++){
448  idx=i+ihermite;
449  isite1 = X->Def.InterAll_OffDiagonal[idx][0] + 1;
450  isite2 = X->Def.InterAll_OffDiagonal[idx][2] + 1;
451  isite3 = X->Def.InterAll_OffDiagonal[idx][4] + 1;
452  isite4 = X->Def.InterAll_OffDiagonal[idx][6] + 1;
453  sigma1 = X->Def.InterAll_OffDiagonal[idx][1];
454  sigma2 = X->Def.InterAll_OffDiagonal[idx][3];
455  sigma3 = X->Def.InterAll_OffDiagonal[idx][5];
456  sigma4 = X->Def.InterAll_OffDiagonal[idx][7];
457  tmp_V = X->Def.ParaInterAll_OffDiagonal[idx];
458 
459  child_general_int_GetInfo(i, X, isite1, isite2, isite3, isite4,
460  sigma1, sigma2, sigma3, sigma4, tmp_V);
461  dam_pr += GC_child_general_int(tmp_v0, tmp_v1, X);
462  }/*for(ihermite=0; ihermite<2; ihermite++)*/
463  StopTimer(222);
464  }
465  X->Large.prdct += dam_pr;
466  }/*for (i = 0; i < X->Def.NInterAll_OffDiagonal; i+=2)*/
467  StopTimer(220);
471  StartTimer(230);
472  for (i = 0; i < X->Def.NPairHopping; i +=2) {
473  sigma1 = 0;
474  sigma2 = 1;
475  dam_pr = 0.0;
476  if ( X->Def.PairHopping[i][0] + 1 > X->Def.Nsite
477  || X->Def.PairHopping[i][1] + 1 > X->Def.Nsite)
478  {
479  StartTimer(231);
481  X->Def.PairHopping[i][0], sigma1, X->Def.PairHopping[i][1], sigma1,
482  X->Def.PairHopping[i][0], sigma2, X->Def.PairHopping[i][1], sigma2,
483  X->Def.ParaPairHopping[i], X, tmp_v0, tmp_v1);
484  StopTimer(231);
485  }
486  else {
487  StartTimer(232);
488  for (ihermite = 0; ihermite<2; ihermite++) {
489  idx = i + ihermite;
490  child_pairhopp_GetInfo(idx, X);
491  dam_pr += GC_child_pairhopp(tmp_v0, tmp_v1, X);
492  }/*for (ihermite = 0; ihermite<2; ihermite++)*/
493  StopTimer(232);
494  }
495  X->Large.prdct += dam_pr;
496  }/*for (i = 0; i < X->Def.NPairHopping; i += 2)*/
497  StopTimer(230);
501  StartTimer(240);
502  for (i = 0; i < X->Def.NExchangeCoupling; i++) {
503  sigma1=0;
504  sigma2=1;
505  dam_pr=0.0;
506  if ( X->Def.ExchangeCoupling[i][0] + 1 > X->Def.Nsite
507  || X->Def.ExchangeCoupling[i][1] + 1 > X->Def.Nsite)
508  {
509  StartTimer(241);
511  X->Def.ExchangeCoupling[i][0], sigma1, X->Def.ExchangeCoupling[i][1], sigma1,
512  X->Def.ExchangeCoupling[i][1], sigma2, X->Def.ExchangeCoupling[i][0], sigma2,
513  X->Def.ParaExchangeCoupling[i], X, tmp_v0, tmp_v1);
514  StopTimer(241);
515  }
516  else {
517  StartTimer(242);
519  dam_pr = GC_child_exchange(tmp_v0, tmp_v1, X);
520  StopTimer(242);
521  }
522  X->Large.prdct += dam_pr;
523  }/*for (i = 0; i < X->Def.NExchangeCoupling; i++)*/
524  StopTimer(240);
525 
526  StopTimer(200);
527  return 0;
528 }/*int mltplyHubbardGC*/
529 
530 /******************************************************************************/
531 //[s] child functions
532 /******************************************************************************/
533 
540 double complex child_pairhopp(
541  double complex *tmp_v0,
542  double complex *tmp_v1,
543  struct BindStruct *X
544 ) {
545  long int j;
546  long unsigned int i_max = X->Large.i_max;
547  long unsigned int off = 0;
548  double complex dam_pr = 0.0;
549 
550 #pragma omp parallel for default(none) reduction(+:dam_pr) firstprivate(i_max, X,off) private(j) shared(tmp_v0, tmp_v1)
551  for (j = 1; j <= i_max; j++)
552  dam_pr += child_pairhopp_element(j, tmp_v0, tmp_v1, X, &off);
553  return dam_pr;
554 }/*double complex child_pairhopp*/
561 double complex child_exchange(
562  double complex *tmp_v0,
563  double complex *tmp_v1,
564  struct BindStruct *X
565 ) {
566  long int j;
567  long unsigned int i_max = X->Large.i_max;
568  long unsigned int off = 0;
569  double complex dam_pr = 0;
570 
571 #pragma omp parallel for default(none) reduction(+:dam_pr) firstprivate(i_max, X,off) private(j) shared(tmp_v0, tmp_v1)
572  for (j = 1; j <= i_max; j++)
573  dam_pr += child_exchange_element(j, tmp_v0, tmp_v1, X, &off);
574  return dam_pr;
575 }/*double complex child_exchange*/
582 double complex child_general_hopp(
583  double complex *tmp_v0,
584  double complex *tmp_v1,
585  struct BindStruct *X,
586  double complex trans
587 ) {
588  long unsigned int j, isite1, isite2, Asum, Adiff;
589  long unsigned int i_max = X->Large.i_max;
590  double complex dam_pr = 0;
591 
592  isite1 = X->Large.is1_spin;
593  isite2 = X->Large.is2_spin;
594  Asum = X->Large.isA_spin;
595  Adiff = X->Large.A_spin;
596  //fprintf(stdout, "DEBUG, isite1=%ld, isite2=%ld, Asum=%ld, Adiff=%ld \n", isite1, isite2, Asum, Adiff);
597 #pragma omp parallel for default(none) reduction(+:dam_pr) \
598 firstprivate(i_max,X,Asum,Adiff,isite1,isite2,trans) private(j) shared(tmp_v0, tmp_v1)
599  for (j = 1; j <= i_max; j++)
600  dam_pr += CisAjt(j, tmp_v0, tmp_v1, X, isite1, isite2, Asum, Adiff, trans) * trans;
601  return dam_pr;
602 }/*double complex child_general_hopp*/
609 double complex GC_child_general_hopp(
610  double complex *tmp_v0,
611  double complex *tmp_v1,
612  struct BindStruct *X,
613  double complex trans
614 ) {
615  long unsigned int j, isite1, isite2, Asum, Adiff;
616  long unsigned int tmp_off;
617  long unsigned int i_max = X->Large.i_max;
618  double complex dam_pr = 0;
619 
620  isite1 = X->Large.is1_spin;
621  isite2 = X->Large.is2_spin;
622  Asum = X->Large.isA_spin;
623  Adiff = X->Large.A_spin;
624 
625  if (isite1 == isite2) {
626 #pragma omp parallel for default(none) reduction(+:dam_pr) \
627 private(j) firstprivate(i_max,X,isite1, trans) shared(tmp_v0, tmp_v1)
628  for (j = 1; j <= i_max; j++)
629  dam_pr += GC_CisAis(j, tmp_v0, tmp_v1, X, isite1, trans) * trans;
630  }/*if (isite1 == isite2)*/
631  else {
632 #pragma omp parallel for default(none) reduction(+:dam_pr) \
633 firstprivate(i_max,X,Asum,Adiff,isite1,isite2,trans) private(j,tmp_off) shared(tmp_v0, tmp_v1)
634  for (j = 1; j <= i_max; j++)
635  dam_pr += GC_CisAjt(j, tmp_v0, tmp_v1, X, isite1, isite2, Asum, Adiff, trans, &tmp_off) * trans;
636  }
637  return dam_pr;
638 }/*double complex GC_child_general_hopp*/
645 double complex child_general_int(
646  double complex *tmp_v0,
647  double complex *tmp_v1,
648  struct BindStruct *X
649 ) {
650  double complex dam_pr, tmp_V;
651  long unsigned int j, i_max;
652  long unsigned int isite1, isite2, isite3, isite4;
653  long unsigned int Asum, Bsum, Adiff, Bdiff;
654  long unsigned int tmp_off = 0;
655  long unsigned int tmp_off_2 = 0;
656 
657  //note: this site is labeled for not only site but site with spin.
658  i_max = X->Large.i_max;
659  isite1 = X->Large.is1_spin;
660  isite2 = X->Large.is2_spin;
661  Asum = X->Large.isA_spin;
662  Adiff = X->Large.A_spin;
663 
664  isite3 = X->Large.is3_spin;
665  isite4 = X->Large.is4_spin;
666  Bsum = X->Large.isB_spin;
667  Bdiff = X->Large.B_spin;
668 
669  tmp_V = X->Large.tmp_V;
670  dam_pr = 0.0;
671 
672 #pragma omp parallel default(none) reduction(+:dam_pr) \
673 private(j, tmp_off, tmp_off_2) \
674 firstprivate(i_max, X, isite1, isite2, isite3, isite4, Asum, Bsum, Adiff, Bdiff, tmp_V) \
675 shared(tmp_v0, tmp_v1)
676  {
677  if (isite1 == isite2 && isite3 == isite4) {
678 #pragma omp for
679  for (j = 1; j <= i_max; j++)
680  dam_pr += child_CisAisCisAis_element(j, isite1, isite3, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
681  }/*if (isite1 == isite2 && isite3 == isite4)*/
682  else if (isite1 == isite2 && isite3 != isite4) {
683 #pragma omp for
684  for (j = 1; j <= i_max; j++)
685  dam_pr += child_CisAisCjtAku_element(
686  j, isite1, isite3, isite4, Bsum, Bdiff, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
687  }/*if (isite1 == isite2 && isite3 != isite4)*/
688  else if (isite1 != isite2 && isite3 == isite4) {
689 #pragma omp for
690  for (j = 1; j <= i_max; j++)
691  dam_pr += child_CisAjtCkuAku_element(j, isite1, isite2, isite3, Asum, Adiff, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
692  }/*if (isite1 != isite2 && isite3 == isite4)*/
693  else if (isite1 != isite2 && isite3 != isite4) {
694 #pragma omp for
695  for (j = 1; j <= i_max; j++)
696  dam_pr += child_CisAjtCkuAlv_element(
697  j, isite1, isite2, isite3, isite4, Asum, Adiff, Bsum, Bdiff, tmp_V, tmp_v0, tmp_v1, X, &tmp_off_2);
698  }/*if (isite1 != isite2 && isite3 != isite4)*/
699  }/*End of parallel region*/
700  return dam_pr;
701 }/*double complex child_general_int*/
708 double complex GC_child_general_int(
709  double complex *tmp_v0,
710  double complex *tmp_v1,
711  struct BindStruct *X
712 ) {
713  double complex dam_pr, tmp_V;
714  long unsigned int j, i_max;
715  long unsigned int isite1, isite2, isite3, isite4;
716  long unsigned int Asum, Bsum, Adiff, Bdiff;
717  long unsigned int tmp_off = 0;
718  long unsigned int tmp_off_2 = 0;
719 
720  i_max = X->Large.i_max;
721  isite1 = X->Large.is1_spin;
722  isite2 = X->Large.is2_spin;
723  Asum = X->Large.isA_spin;
724  Adiff = X->Large.A_spin;
725 
726  isite3 = X->Large.is3_spin;
727  isite4 = X->Large.is4_spin;
728  Bsum = X->Large.isB_spin;
729  Bdiff = X->Large.B_spin;
730 
731  tmp_V = X->Large.tmp_V;
732  dam_pr = 0.0;
733 
734 #pragma omp parallel default(none) reduction(+:dam_pr) private(j) \
735 firstprivate(i_max, X, isite1, isite2, isite4, isite3, Asum, Bsum, Adiff, Bdiff, tmp_off, tmp_off_2, tmp_V) \
736 shared(tmp_v0, tmp_v1)
737  {
738  if (isite1 == isite2 && isite3 == isite4) {
739 #pragma omp for
740  for (j = 1; j <= i_max; j++)
741  dam_pr += GC_child_CisAisCisAis_element(j, isite1, isite3, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
742  }/*if (isite1 == isite2 && isite3 == isite4)*/
743  else if (isite1 == isite2 && isite3 != isite4) {
744 #pragma omp for
745  for (j = 1; j <= i_max; j++)
746  dam_pr += GC_child_CisAisCjtAku_element(j, isite1, isite3, isite4, Bsum, Bdiff, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
747  }/*if (isite1 == isite2 && isite3 != isite4)*/
748  else if (isite1 != isite2 && isite3 == isite4) {
749 #pragma omp for
750  for (j = 1; j <= i_max; j++)
752  j, isite1, isite2, isite3, Asum, Adiff, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
753  }/*if (isite1 != isite2 && isite3 == isite4)*/
754  else if (isite1 != isite2 && isite3 != isite4) {
755 #pragma omp for
756  for (j = 1; j <= i_max; j++)
758  j, isite1, isite2, isite3, isite4, Asum, Adiff, Bsum, Bdiff, tmp_V, tmp_v0, tmp_v1, X, &tmp_off_2);
759  }/*if (isite1 != isite2 && isite3 != isite4)*/
760  }/*End of parallel region*/
761  return dam_pr;
762 }/*double complex GC_child_general_int*/
769 double complex GC_child_pairhopp(
770  double complex *tmp_v0,
771  double complex *tmp_v1,
772  struct BindStruct *X
773 ) {
774  long int j;
775  long unsigned int i_max = X->Large.i_max;
776  long unsigned int off = 0;
777  double complex dam_pr = 0.0;
778 
779 #pragma omp parallel for default(none) reduction(+:dam_pr) firstprivate(i_max,X,off) private(j) shared(tmp_v0, tmp_v1)
780  for (j = 1; j <= i_max; j++)
781  dam_pr += GC_child_pairhopp_element(j, tmp_v0, tmp_v1, X, &off);
782 
783  return dam_pr;
784 }/*double complex GC_child_pairhopp*/
791 double complex GC_child_exchange(
792  double complex *tmp_v0,
793  double complex *tmp_v1,
794  struct BindStruct *X
795 ) {
796  long int j;
797  long unsigned int i_max = X->Large.i_max;
798  long unsigned int off = 0;
799  double complex dam_pr = 0.0;
800 
801 #pragma omp parallel for default(none) \
802 reduction(+:dam_pr) firstprivate(i_max, X,off) private(j) shared(tmp_v0, tmp_v1)
803  for (j = 1; j <= i_max; j++)
804  dam_pr += GC_child_exchange_element(j, tmp_v0, tmp_v1, X, &off);
805  return dam_pr;
806 }/*double complex GC_child_exchange*/
807 /******************************************************************************/
808 //[e] child functions
809 /******************************************************************************/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
long unsigned int B_spin
Mask used in the bit oeration.
Definition: struct.h:342
double complex GC_child_exchange(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute Exchange term (grandcanonical) in single process.
void StartTimer(int n)
function for initializing elapse time [start]
Definition: time.c:71
int CheckPE(int org_isite, struct BindStruct *X)
Check whether this site is in the inter process region or not.
int ** ExchangeCoupling
[DefineList::NExchangeCoupling][2] Index of exchange term. malloc in setmem_def().
Definition: struct.h:146
long unsigned int is4_spin
Mask used in the bit oeration.
Definition: struct.h:335
void StopTimer(int n)
function for calculating elapse time [elapse time=StartTimer-StopTimer]
Definition: time.c:83
long unsigned int isB_spin
Mask used in the bit oeration.
Definition: struct.h:347
int child_general_int_GetInfo(int iInterAll, struct BindStruct *X, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int isite4, long unsigned int sigma1, long unsigned int sigma2, long unsigned int sigma3, long unsigned int sigma4, double complex tmp_V)
Compute mask for bit operation of general interaction term.
double complex X_GC_child_CisAisCjtAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of grandcanonical Hubbard system.
double complex prdct
The expectation value of the energy.
Definition: struct.h:314
double complex child_CisAjtCkuAku_element(long unsigned int j, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int Asum, long unsigned int Adiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of canonical Hubbard system.
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
double complex child_pairhopp_element(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute pairhopp term of canonical Hubbard system.
long unsigned int is1_spin
Mask used in the bit oeration.
Definition: struct.h:332
double complex X_child_CisAisCjtAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of canonical Hubbard system.
double complex CisAjt(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int is1_spin, long unsigned int is2_spin, long unsigned int sum_spin, long unsigned int diff_spin, double complex tmp_V)
term for canonical Hubbard
int ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
Definition: struct.h:110
double complex * ParaInterAll_OffDiagonal
[DefineList::NInterAll_OffDiagonal] Coupling constant of off-diagonal inter-all term. malloc in setmem_def().
Definition: struct.h:170
double complex X_child_CisAisCjtAjt_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of canonical Hubbard system.
double complex GC_child_pairhopp_element(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute pairhopp term of grandcanonical Hubbard system.
#define TRUE
Definition: global.h:26
unsigned int NInterAll_OffDiagonal
Number of interall term (off-diagonal)
Definition: struct.h:165
long unsigned int is3_spin
Mask used in the bit oeration.
Definition: struct.h:334
double complex GC_CisAjt(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int is1_spin, long unsigned int is2_spin, long unsigned int sum_spin, long unsigned int diff_spin, double complex tmp_V, long unsigned int *tmp_off)
term for grandcanonical Hubbard
int ** InterAll_OffDiagonal
[DefineList::NinterAll_OffDiagonal][8] Interacted quartet
Definition: struct.h:161
double complex child_exchange_element(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute exchange term of canonical-Hubbard.
long unsigned int * OrgTpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:92
void GC_child_general_hopp_MPIdouble(unsigned long int itrans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard + GC When both site1 and site2 are in the inter process region.
int ** PairHopping
[DefineList::NPairHopping][2] Index of pair-hopping. malloc in setmem_def().
Definition: struct.h:140
double complex X_GC_child_CisAisCjtAjt_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of grandcanonical Hubbard system.
double complex GC_child_exchange_element(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute exchange term of grandcanonical Hubbard system.
double complex child_general_hopp(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, double complex trans)
Compute hopping (canonical)
double complex tmp_trans
Hopping parameter.
Definition: struct.h:322
long unsigned int A_spin
Mask used in the bit oeration.
Definition: struct.h:341
Bind.
Definition: struct.h:409
double * ParaExchangeCoupling
[DefineList::NExchangeCoupling] Coupling constant of exchange term. malloc in setmem_def().
Definition: struct.h:148
unsigned int Nsite
Number of sites in the INTRA process region.
Definition: struct.h:56
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
Definition: struct.h:116
void child_general_hopp_MPIdouble(unsigned long int itrans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When both site1 and site2 are in the inter proce...
int child_pairhopp_GetInfo(int iPairHopp, struct BindStruct *X)
Compute mask for bit operation of pairhop term.
double complex X_child_CisAjtCkuAlv_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of canonical Hubbard system.
double complex GC_child_general_int(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute inter-all term (canonical)
double complex X_child_CisAjtCkuAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of canonical Hubbard system.
long int i_max
Length of eigenvector.
Definition: struct.h:317
double complex GC_child_pairhopp(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute pairhopp term (grandcanonical)
double complex GC_child_CisAisCisAis_element(long unsigned int j, long unsigned int isite1, long unsigned int isite3, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of grandcanonical Hubbard system.
void GC_child_general_hopp_MPIsingle(unsigned long int itrans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard + GC When only site2 is in the inter process region.
double complex child_general_int(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute inter-all term (canonical)
unsigned int NExchangeCoupling
Number of exchange term.
Definition: struct.h:145
double complex X_GC_child_CisAjtCkuAku_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of grandcanonical Hubbard system.
double complex child_pairhopp(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute pairhopp term (canonical)
unsigned int NPairHopping
Number of pair-hopping term.
Definition: struct.h:139
long unsigned int is2_spin
Mask used in the bit oeration.
Definition: struct.h:333
int child_general_hopp_GetInfo(struct BindStruct *X, unsigned long int isite1, unsigned long int isite2, unsigned long int sigma1, unsigned long int sigma2)
Compute mask for bit operation of hopping term.
double complex child_CisAisCisAis_element(long unsigned int j, long unsigned int isite1, long unsigned int isite3, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of canonical Hubbard system.
double complex tmp_V
Coupling constant.
Definition: struct.h:348
double * ParaPairHopping
[DefineList::NPairHopping] Coupling constant of pair-hopping term. malloc in setmem_def().
Definition: struct.h:142
int mltplyHubbardGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
perform Hamiltonian vector product for (extended) Hubbard type model (Grandcanonical).
unsigned int EDNTransfer
Number of transfer integrals for calculation.
Definition: struct.h:105
long unsigned int isA_spin
Mask used in the bit oeration.
Definition: struct.h:346
double complex X_GC_child_CisAjtCkuAlv_Hubbard_MPI(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, int org_isite3, int org_ispin3, int org_isite4, int org_ispin4, double complex tmp_V, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term of grandcanonical Hubbard system.
struct EDMainCalStruct X
Definition: struct.h:432
double complex GC_child_general_hopp(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, double complex trans)
Commpute hopping term (grandcanonical)
double complex child_exchange(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute Exchange term (canonical) in single process.
void child_general_hopp_MPIsingle(unsigned long int itrans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
int child_exchange_GetInfo(int iExchange, struct BindStruct *X)
Compute mask for bit operation of exchange term.
double complex GC_child_CisAisCjtAku_element(long unsigned int j, long unsigned int isite1, long unsigned int isite3, long unsigned int isite4, long unsigned int Bsum, long unsigned int Bdiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of grandcanonical Hubbard system.
double complex GC_child_CisAjtCkuAku_element(long unsigned int j, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int Asum, long unsigned int Adiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of grandcanonical Hubbard system.
double complex child_CisAjtCkuAlv_element(long unsigned int j, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int isite4, long unsigned int Asum, long unsigned int Adiff, long unsigned int Bsum, long unsigned int Bdiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off_2)
Compute term of canonical Hubbard system.
double complex GC_CisAis(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int is1_spin, double complex tmp_trans)
Operation of (Grandcanonical)
double complex GC_child_CisAjtCkuAlv_element(long unsigned int j, long unsigned int isite1, long unsigned int isite2, long unsigned int isite3, long unsigned int isite4, long unsigned int Asum, long unsigned int Adiff, long unsigned int Bsum, long unsigned int Bdiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off_2)
Compute term of grandcanonical Hubbard system.
int mltplyHubbard(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
perform Hamiltonian vector product for (extended) Hubbard type model.
double complex child_CisAisCjtAku_element(long unsigned int j, long unsigned int isite1, long unsigned int isite3, long unsigned int isite4, long unsigned int Bsum, long unsigned int Bdiff, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute term of canonical Hubbard system.