HΦ  3.2.0
mltplyMPISpinCore.c
Go to the documentation of this file.
1 /* HPhi - Quantum Lattice Model Simulator */
2 /* Copyright (C) 2015 The University of Tokyo */
3 
4 /* This program is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU General Public License as published by */
6 /* the Free Software Foundation, either version 3 of the License, or */
7 /* (at your option) any later version. */
8 
9 /* This program is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU General Public License for more details. */
13 
14 /* You should have received a copy of the GNU General Public License */
15 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
65 #ifdef MPI
66 #include "mpi.h"
67 #endif
68 #include "Common.h"
69 #include "mltplyCommon.h"
70 #include "mltplySpinCore.h"
71 #include "mltplyMPISpinCore.h"
72 #include "bitcalc.h"
73 #include "wrapperMPI.h"
80  unsigned long int i_int ,
81  struct BindStruct *X ,
82  double complex *tmp_v0 ,
83  double complex *tmp_v1 )
84 {
85 #ifdef MPI
86  double complex dam_pr;
88  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
89  X->Def.InterAll_OffDiagonal[i_int][3], X->Def.InterAll_OffDiagonal[i_int][4],
90  X->Def.InterAll_OffDiagonal[i_int][5], X->Def.InterAll_OffDiagonal[i_int][7],
91  X->Def.ParaInterAll_OffDiagonal[i_int],X, tmp_v0, tmp_v1);
92  X->Large.prdct += dam_pr;
93 #endif
94 }/*void GC_child_CisAitCiuAiv_spin_MPIdouble*/
104  int org_isite1,
105  int org_ispin1,
106  int org_ispin2,
107  int org_isite3,
108  int org_ispin3,
109  int org_ispin4,
110  double complex tmp_J,
111  struct BindStruct *X,
112  double complex *tmp_v0,
113  double complex *tmp_v1
114 ) {
115 #ifdef MPI
116  int mask1, mask2, state1, state2, ierr, origin;
117  unsigned long int idim_max_buf, j;
118  MPI_Status statusMPI;
119  double complex Jint, dmv, dam_pr;
120 
121  mask1 = (int)X->Def.Tpow[org_isite1];
122  mask2 = (int)X->Def.Tpow[org_isite3];
123  if (org_isite1 != org_isite3) {
124  origin = myrank ^ (mask1 + mask2);
125  }
126  else {
127  if (org_ispin1 == org_ispin4 && org_ispin2 == org_ispin3) { //CisAitCitAis=CisAis
128  dam_pr = X_GC_child_CisAis_spin_MPIdouble(org_isite1, org_ispin1, tmp_J, X, tmp_v0, tmp_v1);
129  return (dam_pr);
130  }
131  else { //CisAitCisAit=0
132  return 0.0;
133  }
134  }
135 
136  state1 = (origin & mask1) / mask1;
137  state2 = (origin & mask2) / mask2;
138 
139  if (state1 == org_ispin2 && state2 == org_ispin4) {
140  Jint = tmp_J;
141  }
142  else if (state1 == org_ispin1 && state2 == org_ispin3) {
143  Jint = conj(tmp_J);
144  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
145  Jint = 0;
146  }
147  }
148  else {
149  return 0;
150  }
151 
152  ierr = MPI_Sendrecv(&X->Check.idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
153  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
154  MPI_COMM_WORLD, &statusMPI);
155  if (ierr != 0) exitMPI(-1);
156  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
157  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
158  MPI_COMM_WORLD, &statusMPI);
159  if (ierr != 0) exitMPI(-1);
160 
161  dam_pr = 0.0;
162 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv) \
163  firstprivate(idim_max_buf, Jint, X) shared(v1buf, tmp_v1, tmp_v0)
164  {
165  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
166 #pragma omp for
167  for (j = 1; j <= idim_max_buf; j++) {
168  dmv = Jint * v1buf[j];
169  tmp_v0[j] += dmv;
170  dam_pr += conj(tmp_v1[j]) * dmv;
171  }/*for (j = 1; j <= idim_max_buf; j++)*/
172  }
173  else {
174 #pragma omp for
175  for (j = 1; j <= idim_max_buf; j++) {
176  dmv = Jint * v1buf[j];
177  dam_pr += conj(tmp_v1[j]) * dmv;
178  }/*for (j = 1; j <= idim_max_buf; j++)*/
179  }
180  }/*End of parallel region*/
181  return dam_pr;
182 #else
183  return 0.0;
184 #endif
185 }/*void GC_child_CisAitCiuAiv_spin_MPIdouble*/
192  unsigned long int i_int ,
193  struct BindStruct *X ,
194  double complex *tmp_v0 ,
195  double complex *tmp_v1
196 ){
197 #ifdef MPI
198  double complex dam_pr;
200  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
201  X->Def.InterAll_OffDiagonal[i_int][4], X->Def.InterAll_OffDiagonal[i_int][5],
202  X->Def.InterAll_OffDiagonal[i_int][7], X->Def.ParaInterAll_OffDiagonal[i_int], X, tmp_v0, tmp_v1);
203  X->Large.prdct += dam_pr;
204 #endif
205 }/*void GC_child_CisAitCiuAiv_spin_MPIdouble*/
213  int org_isite1,
214  int org_ispin1,
215  int org_isite3,
216  int org_ispin3,
217  int org_ispin4,
218  double complex tmp_J,
219  struct BindStruct *X,
220  double complex *tmp_v0,
221  double complex *tmp_v1
222 ) {
223 #ifdef MPI
224  int mask1, mask2, state2, ierr;
225  long int origin, num1;
226  unsigned long int idim_max_buf, j;
227  MPI_Status statusMPI;
228  double complex Jint, dmv, dam_pr;
229 
230  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin4) {//CisAisCitAis
231  return 0.0;
232  }
233 
234  mask1 = (int)X->Def.Tpow[org_isite1];
235  mask2 = (int)X->Def.Tpow[org_isite3];
236  origin = myrank ^ mask2;
237  state2 = (origin & mask2) / mask2;
238  num1 = X_SpinGC_CisAis((unsigned long int) myrank + 1, X, mask1, org_ispin1);
239  if (num1 != 0 && state2 == org_ispin4) {
240  Jint = tmp_J;
241  }
242  else if (X_SpinGC_CisAis(origin + 1, X, mask1, org_ispin1) == TRUE && state2 == org_ispin3) {
243  Jint = conj(tmp_J);
244  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) Jint = 0;
245  }
246  else {
247  return 0.0;
248  }
249 
250  ierr = MPI_Sendrecv(&X->Check.idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
251  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
252  MPI_COMM_WORLD, &statusMPI);
253  if (ierr != 0) exitMPI(-1);
254  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
255  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
256  MPI_COMM_WORLD, &statusMPI);
257  if (ierr != 0) exitMPI(-1);
258 
259  dam_pr = 0.0;
260  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
261 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv) \
262  firstprivate(idim_max_buf, Jint, X) shared(v1buf, tmp_v1, tmp_v0)
263  for (j = 1; j <= idim_max_buf; j++) {
264  dmv = Jint * v1buf[j];
265  tmp_v0[j] += dmv;
266  dam_pr += conj(tmp_v1[j]) * dmv;
267  }
268  }
269  else {
270 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv) \
271  firstprivate(idim_max_buf, Jint, X) shared(v1buf, tmp_v1, tmp_v0)
272  for (j = 1; j <= idim_max_buf; j++) {
273  dmv = Jint * v1buf[j];
274  dam_pr += conj(tmp_v1[j]) * dmv;
275  }
276  }
277  return (dam_pr);
278 #else
279  return 0.0;
280 #endif
281 }/*double complex X_GC_child_CisAisCjuAjv_spin_MPIdouble*/
288  unsigned long int i_int,
289  struct BindStruct *X,
290  double complex *tmp_v0,
291  double complex *tmp_v1
292 )
293 {
294 #ifdef MPI
295  double complex dam_pr;
297  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
298  X->Def.InterAll_OffDiagonal[i_int][3], X->Def.InterAll_OffDiagonal[i_int][4],
299  X->Def.InterAll_OffDiagonal[i_int][5], X->Def.ParaInterAll_OffDiagonal[i_int], X, tmp_v0, tmp_v1);
300  X->Large.prdct += dam_pr;
301 #endif
302 }/*void GC_child_CisAitCiuAiv_spin_MPIdouble*/
310  int org_isite1,
311  int org_ispin1,
312  int org_ispin2,
313  int org_isite3,
314  int org_ispin3,
315  double complex tmp_J,
316  struct BindStruct *X,
317  double complex *tmp_v0,
318  double complex *tmp_v1
319 ) {
320 #ifdef MPI
321  int mask1, mask2, state1, ierr, num1;
322  long int origin;
323  unsigned long int idim_max_buf, j;
324  MPI_Status statusMPI;
325  double complex Jint, dmv, dam_pr;
326 
327  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin3) {//cisaitcisais
328  return 0.0;
329  }
330 
331  mask1 = (int)X->Def.Tpow[org_isite1];
332  origin = myrank ^ mask1;
333  state1 = (origin & mask1) / mask1;
334  mask2 = (int)X->Def.Tpow[org_isite3];
335  num1 = X_SpinGC_CisAis(origin + 1, X, mask2, org_ispin3);
336  if (state1 == org_ispin2) {
337  if (num1 != 0) {
338  Jint = tmp_J;
339  }
340  else {
341  return 0.0;
342  }
343  }/*if (state1 == org_ispin2)*/
344  else {//state1 = org_ispin1
345  num1 = X_SpinGC_CisAis((unsigned long int) myrank + 1, X, mask2, org_ispin3);
346  if (num1 != 0) {
347  Jint = conj(tmp_J);
348  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
349  Jint = 0;
350  }
351  }
352  else {
353  return 0.0;
354  }
355  }
356 
357  ierr = MPI_Sendrecv(&X->Check.idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
358  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
359  MPI_COMM_WORLD, &statusMPI);
360  if (ierr != 0) exitMPI(-1);
361  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
362  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
363  MPI_COMM_WORLD, &statusMPI);
364  if (ierr != 0) exitMPI(-1);
365 
366  dam_pr = 0.0;
367 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv) \
368  firstprivate(idim_max_buf, Jint, X) shared(v1buf, tmp_v1, tmp_v0)
369  {
370  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
371 #pragma omp for
372  for (j = 1; j <= idim_max_buf; j++) {
373  dmv = Jint * v1buf[j];
374  tmp_v0[j] += dmv;
375  dam_pr += conj(tmp_v1[j]) * dmv;
376  }/*for (j = 1; j <= idim_max_buf; j++)*/
377  }
378  else {
379 #pragma omp for
380  for (j = 1; j <= idim_max_buf; j++) {
381  dmv = Jint * v1buf[j];
382  dam_pr += conj(tmp_v1[j]) * dmv;
383  }/*for (j = 1; j <= idim_max_buf; j++)*/
384  }
385  }/*End of parallel region*/
386  return (dam_pr);
387 #else
388  return 0.0;
389 #endif
390 }/*double complex X_GC_child_CisAisCjuAjv_spin_MPIdouble*/
398  int org_isite1,
399  int org_ispin1,
400  int org_isite3,
401  int org_ispin3,
402  double complex tmp_J,
403  struct BindStruct *X,
404  double complex *tmp_v0,
405  double complex *tmp_v1
406 ){
407 #ifdef MPI
408  long unsigned int mask1, mask2, num1,num2;
409  unsigned long int j;
410 // MPI_Status statusMPI;
411  double complex dmv, dam_pr;
412  mask1 = (int)X->Def.Tpow[org_isite1];
413  mask2 = (int)X->Def.Tpow[org_isite3];
414  num1 = X_SpinGC_CisAis((unsigned long int)myrank + 1, X, mask1, org_ispin1);
415  num2 = X_SpinGC_CisAis((unsigned long int)myrank + 1, X, mask2, org_ispin3);
416 
417  dam_pr = 0.0;
418 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv) \
419  firstprivate(tmp_J, X, num1, num2) shared(tmp_v1, tmp_v0)
420  {
421  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
422 #pragma omp for
423  for (j = 1; j <= X->Check.idim_max; j++) {
424  dmv = num1*num2*tmp_v1[j] * tmp_J;
425  tmp_v0[j] += dmv;
426  dam_pr += conj(tmp_v1[j]) * dmv;
427  }/*for (j = 1; j <= X->Check.idim_max; j++) */
428  }
429  else {
430 #pragma omp for
431  for (j = 1; j <= X->Check.idim_max; j++) {
432  dmv = num1 * num2 * tmp_v1[j] * tmp_J;
433  dam_pr += conj(tmp_v1[j]) * dmv;
434  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
435  }
436  }/*End of parallel region*/
437  return(dam_pr);
438 #else
439  return 0.0;
440 #endif
441 }/*double complex X_GC_child_CisAisCjuAju_spin_MPIdouble*/
449  int org_isite1,
450  int org_ispin1,
451  int org_isite3,
452  int org_ispin3,
453  double complex tmp_J,
454  struct BindStruct *X,
455  double complex *tmp_v0,
456  double complex *tmp_v1
457 ) {
458 #ifdef MPI
459  long unsigned int mask1, mask2, num1, num2;
460  unsigned long int j;
461 // MPI_Status statusMPI;
462  double complex Jint, dmv, dam_pr;
463  Jint = tmp_J;
464  mask1 = (int)X->Def.Tpow[org_isite1];
465  mask2 = (int)X->Def.Tpow[org_isite3];
466  num2 = X_SpinGC_CisAis((unsigned long int) myrank + 1, X, mask2, org_ispin3);
467 
468  dam_pr = 0.0;
469 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv, num1) \
470  firstprivate(Jint, X, num2, mask1, org_ispin1) shared(tmp_v1, tmp_v0)
471  {
472  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
473 #pragma omp for
474  for (j = 1; j <= X->Check.idim_max; j++) {
475  num1 = X_SpinGC_CisAis(j, X, mask1, org_ispin1);
476  dmv = Jint * num1 * num2 * tmp_v1[j];
477  tmp_v0[j] += dmv;
478  dam_pr += conj(tmp_v1[j]) * dmv;
479  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
480  }
481  else {
482 #pragma omp for
483  for (j = 1; j <= X->Check.idim_max; j++) {
484  num1 = X_SpinGC_CisAis(j, X, mask1, org_ispin1);
485  dmv = Jint * num1 * num2 * tmp_v1[j];
486  dam_pr += conj(tmp_v1[j]) * dmv;
487  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
488  }
489  }/*End of parallel region*/
490  return (dam_pr);
491 #else
492  return 0.0;
493 #endif
494 }/*double complex X_GC_child_CisAisCjuAju_spin_MPIdouble*/
501  unsigned long int i_int,
502  struct BindStruct *X,
503  double complex *tmp_v0,
504  double complex *tmp_v1
505 ){
506 #ifdef MPI
507  double complex dam_pr;
509  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
510  X->Def.InterAll_OffDiagonal[i_int][3], X->Def.InterAll_OffDiagonal[i_int][4],
511  X->Def.InterAll_OffDiagonal[i_int][5], X->Def.InterAll_OffDiagonal[i_int][7],
512  X->Def.ParaInterAll_OffDiagonal[i_int], X, tmp_v0, tmp_v1);
513  X->Large.prdct += dam_pr;
514 #endif
515 }/*void GC_child_CisAitCiuAiv_spin_MPIsingle*/
523  int org_isite1,
524  int org_ispin1,
525  int org_ispin2,
526  int org_isite3,
527  int org_ispin3,
528  int org_ispin4,
529  double complex tmp_J,
530  struct BindStruct *X,
531  double complex *tmp_v0,
532  double complex *tmp_v1
533 ) {
534 #ifdef MPI
535  int mask2, state2, ierr, origin;
536  unsigned long int mask1, idim_max_buf, j, ioff, state1, state1check;
537  MPI_Status statusMPI;
538  double complex Jint, dmv, dam_pr;
539  /*
540  Prepare index in the inter PE
541  */
542  mask2 = (int)X->Def.Tpow[org_isite3];
543  origin = myrank ^ mask2;
544  state2 = (origin & mask2) / mask2;
545 
546  if (state2 == org_ispin4) {
547  state1check = (unsigned long int) org_ispin2;
548  Jint = tmp_J;
549  }
550  else if (state2 == org_ispin3) {
551  state1check = (unsigned long int) org_ispin1;
552  Jint = conj(tmp_J);
553  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
554  Jint = 0;
555  }
556  }
557  else return 0.0;
558 
559  ierr = MPI_Sendrecv(&X->Check.idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
560  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
561  MPI_COMM_WORLD, &statusMPI);
562  if (ierr != 0) exitMPI(-1);
563  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
564  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
565  MPI_COMM_WORLD, &statusMPI);
566  if (ierr != 0) exitMPI(-1);
567  /*
568  Index in the intra PE
569  */
570  mask1 = X->Def.Tpow[org_isite1];
571 
572  dam_pr = 0.0;
573 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv, state1, ioff) \
574  firstprivate(idim_max_buf, Jint, X, state1check, mask1) shared(v1buf, tmp_v1, tmp_v0)
575  {
576  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
577 #pragma omp for
578  for (j = 0; j < idim_max_buf; j++) {
579  state1 = X_SpinGC_CisAit(j + 1, X, mask1, state1check, &ioff);
580  if (state1 != 0) {
581  dmv = Jint * v1buf[j + 1];
582  tmp_v0[ioff + 1] += dmv;
583  dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
584  }/*if (state1 != 0)*/
585  }/*for (j = 0; j < idim_max_buf; j++)*/
586  }
587  else {
588 #pragma omp for
589  for (j = 0; j < idim_max_buf; j++) {
590  state1 = X_SpinGC_CisAit(j + 1, X, mask1, state1check, &ioff);
591  if (state1 != 0) {
592  dmv = Jint * v1buf[j + 1];
593  dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
594  }/*if (state1 != 0)*/
595  }/*for (j = 0; j < idim_max_buf; j++)*/
596  }
597  }/*End of parallel region*/
598  return (dam_pr);
599 #else
600  return 0.0;
601 #endif
602 }/*void GC_child_CisAitCiuAiv_spin_MPIsingle*/
609  unsigned long int i_int,
610  struct BindStruct *X,
611  double complex *tmp_v0,
612  double complex *tmp_v1
613 ){
614 #ifdef MPI
615  double complex dam_pr;
617  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
618  X->Def.InterAll_OffDiagonal[i_int][4], X->Def.InterAll_OffDiagonal[i_int][5],
619  X->Def.InterAll_OffDiagonal[i_int][7], X->Def.ParaInterAll_OffDiagonal[i_int], X, tmp_v0, tmp_v1);
620  X->Large.prdct += dam_pr;
621 #endif
622 }/*void GC_child_CisAisCjuAjv_spin_MPIsingle*/
630  int org_isite1,
631  int org_ispin1,
632  int org_isite3,
633  int org_ispin3,
634  int org_ispin4,
635  double complex tmp_J,
636  struct BindStruct *X,
637  double complex *tmp_v0,
638  double complex *tmp_v1
639 ) {
640 #ifdef MPI
641  int mask2, state2, ierr, origin;
642  unsigned long int mask1, idim_max_buf, j, state1, state1check;
643  MPI_Status statusMPI;
644  double complex Jint, dmv, dam_pr;
645  /*
646  Prepare index in the inter PE
647  */
648  mask2 = (int)X->Def.Tpow[org_isite3];
649  origin = myrank ^ mask2;
650  state2 = (origin & mask2) / mask2;
651  if (state2 == org_ispin4) {
652  state1check = (unsigned long int) org_ispin1;
653  Jint = tmp_J;
654  }
655  else if (state2 == org_ispin3) {
656  state1check = (unsigned long int) org_ispin1;
657  Jint = conj(tmp_J);
658  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
659  Jint = 0;
660  }
661  }
662  else return 0.0;
663 
664  ierr = MPI_Sendrecv(&X->Check.idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
665  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
666  MPI_COMM_WORLD, &statusMPI);
667  if (ierr != 0) exitMPI(-1);
668  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
669  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
670  MPI_COMM_WORLD, &statusMPI);
671  if (ierr != 0) exitMPI(-1);
672  /*
673  Index in the intra PE
674  */
675  mask1 = X->Def.Tpow[org_isite1];
676 
677  dam_pr = 0.0;
678 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv, state1) \
679  firstprivate(idim_max_buf, Jint, X, state1check, mask1) shared(v1buf, tmp_v1, tmp_v0)
680  {
681  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
682 #pragma omp for
683  for (j = 0; j < idim_max_buf; j++) {
684  state1 = (j & mask1) / mask1;
685  if (state1 == state1check) {
686  dmv = Jint * v1buf[j + 1];
687  tmp_v0[j + 1] += dmv;
688  dam_pr += conj(tmp_v1[j + 1]) * dmv;
689  }/*if (state1 == state1check)*/
690  }/*for (j = 0; j < idim_max_buf; j++)*/
691  }
692  else {
693 #pragma omp for
694  for (j = 0; j < idim_max_buf; j++) {
695  state1 = (j & mask1) / mask1;
696  if (state1 == state1check) {
697  dmv = Jint * v1buf[j + 1];
698  dam_pr += conj(tmp_v1[j + 1]) * dmv;
699  }/*if (state1 == state1check)*/
700  }/*for (j = 0; j < idim_max_buf; j++)*/
701  }
702  }/*End of parallel region*/
703  return (dam_pr);
704 #else
705  return 0.0;
706 #endif
707 }/*void GC_child_CisAitCiuAiv_spin_MPIsingle*/
714  unsigned long int i_int,
715  struct BindStruct *X,
716  double complex *tmp_v0,
717  double complex *tmp_v1
718 ){
719 #ifdef MPI
720  double complex dam_pr;
722  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
723  X->Def.InterAll_OffDiagonal[i_int][3], X->Def.InterAll_OffDiagonal[i_int][4],
724  X->Def.InterAll_OffDiagonal[i_int][5], X->Def.ParaInterAll_OffDiagonal[i_int], X, tmp_v0, tmp_v1);
725  X->Large.prdct += dam_pr;
726 #endif
727 }/*void GC_child_CisAisCjuAjv_spin_MPIsingle*/
735  int org_isite1,
736  int org_ispin1,
737  int org_ispin2,
738  int org_isite3,
739  int org_ispin3,
740  double complex tmp_J,
741  struct BindStruct *X,
742  double complex *tmp_v0,
743  double complex *tmp_v1
744 ) {
745 #ifdef MPI
746  int mask2, state2;
747  unsigned long int mask1, j, ioff, state1, state1check;
748  //MPI_Status statusMPI;
749  double complex Jint, dmv, dam_pr;
750  /*
751  Prepare index in the inter PE
752  */
753  mask2 = (int)X->Def.Tpow[org_isite3];
754  state2 = (myrank & mask2) / mask2;
755 
756  if (state2 == org_ispin3) {
757  state1check = org_ispin2;
758  Jint = tmp_J;
759  }
760  else {
761  return 0.0;
762  }
763 
764  mask1 = (int)X->Def.Tpow[org_isite1];
765 
766  dam_pr = 0.0;
767 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv, state1, ioff) \
768  firstprivate(Jint, X, state1check, mask1) shared(tmp_v1, tmp_v0)
769  {
770  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
771 #pragma omp for
772  for (j = 0; j < X->Check.idim_max; j++) {
773 
774  state1 = (j & mask1) / mask1;
775  ioff = j ^ mask1;
776  if (state1 == state1check) {
777  dmv = Jint * tmp_v1[j + 1];
778  }
779  else {
780  dmv = conj(Jint) * tmp_v1[j + 1];
781  }
782  tmp_v0[ioff + 1] += dmv;
783  dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
784  }/*for (j = 0; j < X->Check.idim_max; j++)*/
785  }
786  else if (X->Large.mode == M_CORR) {
787 #pragma omp for
788  for (j = 0; j < X->Check.idim_max; j++) {
789 
790  state1 = (j & mask1) / mask1;
791  ioff = j ^ mask1;
792  if (state1 == state1check) {
793  dmv = Jint * tmp_v1[j + 1];
794  }
795  else {
796  dmv = 0.0;
797  }
798  dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
799  }/*for (j = 0; j < X->Check.idim_max; j++)*/
800  }
801  else {
802 #pragma omp for
803  for (j = 0; j < X->Check.idim_max; j++) {
804  state1 = (j & mask1) / mask1;
805  ioff = j ^ mask1;
806  if (state1 == state1check) {
807  dmv = Jint * tmp_v1[j + 1];
808  }
809  else {
810  dmv = conj(Jint) * tmp_v1[j + 1];
811  }
812  dam_pr += conj(tmp_v1[ioff + 1]) * dmv;
813  }/*for (j = 0; j < X->Check.idim_max; j++)*/
814  }
815  }/*End of parallel region*/
816  return (dam_pr);
817 #else
818  return 0.0;
819 #endif
820 }/*void GC_child_CisAitCiuAiv_spin_MPIsingle*/
827  int org_isite1,
828  int org_ispin1,
829  int org_isite3,
830  int org_ispin3,
831  int org_ispin4,
832  double complex tmp_J,
833  struct BindStruct *X,
834  double complex *tmp_v0,
835  double complex *tmp_v1
836 ) {
837 #ifdef MPI
838  unsigned long int off, j;
839  int origin, ierr;
840  double complex tmp_V, dmv, dam_pr;
841  MPI_Status statusMPI;
842  int ihermite = TRUE;
843  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin4) {//cisaisciuais=0 && cisaiucisais=0
844  return 0.0;
845  }
846 
847  if (BitCheckGeneral(myrank, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow) == TRUE
848  && GetOffCompGeneralSpin((unsigned long int) myrank, org_isite3 + 1, org_ispin3, org_ispin4,
849  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
850  tmp_V = tmp_J;
851  else {
852  if (GetOffCompGeneralSpin((unsigned long int) myrank, org_isite3 + 1, org_ispin4, org_ispin3,
853  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
854  {
855  if (BitCheckGeneral((unsigned long int)off, org_isite1 + 1, org_ispin1, X->Def.SiteToBit,
856  X->Def.Tpow) == TRUE)
857  {
858  tmp_V = conj(tmp_J);
859  if(X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
860  }/*BitCheckGeneral(off, org_isite1 + 1, org_ispin1)*/
861  else return 0.0;
862  }/*GetOffCompGeneralSpin(myrank, org_isite3 + 1, org_ispin4, org_ispin3, &off)*/
863  else return 0.0;
864  }
865  origin = (int)off;
866  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
867  v1buf, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
868  MPI_COMM_WORLD, &statusMPI);
869  if (ierr != 0) exitMPI(-1);
870 
871  dam_pr = 0.0;
872 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V) \
873 private(j, dmv) shared (tmp_v0, tmp_v1, v1buf)
874  {
875  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
876 #pragma omp for
877  for (j = 1; j <= X->Check.idim_max; j++) {
878  dmv = v1buf[j] * tmp_V;
879  tmp_v0[j] += dmv;
880  dam_pr += conj(tmp_v1[j]) * dmv;
881  }
882  }
883  else {
884 #pragma omp for
885  for (j = 1; j <= X->Check.idim_max; j++) {
886  dmv = v1buf[j] * tmp_V;
887  dam_pr += conj(tmp_v1[j]) * dmv;
888  }
889  }
890  }/*End of parallel region*/
891  return dam_pr;
892 #else
893  return 0.0;
894 #endif
895 }/*double complex X_GC_child_CisAisCjuAjv_GeneralSpin_MPIdouble*/
902  int org_isite1,
903  int org_ispin1,
904  int org_ispin2,
905  int org_isite3,
906  int org_ispin3,
907  double complex tmp_J,
908  struct BindStruct *X,
909  double complex *tmp_v0,
910  double complex *tmp_v1
911 ) {
912 #ifdef MPI
913  unsigned long int j, off;
914  int origin, ierr;
915  double complex tmp_V, dmv, dam_pr;
916  MPI_Status statusMPI;
917 
918  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin3) {//cisaitcisais=0 && cisaiscitais=0
919  return 0.0;
920  }
921 
922  if (BitCheckGeneral(myrank, org_isite3 + 1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow) == TRUE
923  && GetOffCompGeneralSpin((unsigned long int) myrank, org_isite1 + 1, org_ispin2, org_ispin1, &off,
924  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
925  {
926  tmp_V = conj(tmp_J);
927  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
928  }
929  else if (GetOffCompGeneralSpin((unsigned long int) myrank, org_isite1 + 1, org_ispin1, org_ispin2,
930  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
931  {
932  if (BitCheckGeneral((unsigned long int)off, org_isite3 + 1, org_ispin3,
933  X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
934  tmp_V = tmp_J;
935  }
936  else return 0.0;
937  }
938  else return 0.0;
939 
940  origin = (int)off;
941 
942  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
943  v1buf, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
944  MPI_COMM_WORLD, &statusMPI);
945  if (ierr != 0) exitMPI(-1);
946 
947  dam_pr = 0.0;
948 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V) private(j, dmv) \
949 shared (tmp_v0, tmp_v1, v1buf)
950  {
951  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
952 #pragma omp for
953  for (j = 1; j <= X->Check.idim_max; j++) {
954  dmv = v1buf[j] * tmp_V;
955  tmp_v0[j] += dmv;
956  dam_pr += conj(tmp_v1[j]) * dmv;
957  }
958  }
959  else {
960 #pragma omp for
961  for (j = 1; j <= X->Check.idim_max; j++) {
962  dmv = v1buf[j] * tmp_V;
963  dam_pr += conj(tmp_v1[j]) * dmv;
964  }
965  }
966  }/*End of parallel region*/
967  return dam_pr;
968 #else
969  return 0.0;
970 #endif
971 }/*double complex X_GC_child_CisAitCjuAju_GeneralSpin_MPIdouble*/
978  int org_isite1,
979  int org_ispin1,
980  int org_ispin2,
981  int org_isite3,
982  int org_ispin3,
983  int org_ispin4,
984  double complex tmp_J,
985  struct BindStruct *X,
986  double complex *tmp_v0,
987  double complex *tmp_v1
988 ) {
989 #ifdef MPI
990  unsigned long int tmp_off, off, j;
991  int origin, ierr, ihermite;
992  double complex tmp_V, dmv, dam_pr;
993  MPI_Status statusMPI;
994 
995  ihermite = TRUE;
996 
997  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin4 &&
998  org_ispin2 == org_ispin3) { //cisaitcitais=cisais && cisaitcitais =cisais
999  dam_pr = X_GC_child_CisAis_GeneralSpin_MPIdouble(org_isite1, org_ispin1, tmp_J, X, tmp_v0, tmp_v1);
1000  return (dam_pr);
1001  }
1002  //cisaitcisait
1003  if (GetOffCompGeneralSpin((unsigned long int) myrank, org_isite1 + 1, org_ispin1, org_ispin2,
1004  &tmp_off, X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
1005 
1006  if (GetOffCompGeneralSpin(tmp_off, org_isite3 + 1, org_ispin3, org_ispin4,
1007  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
1008 
1009  tmp_V = tmp_J;
1010  }
1011  else ihermite = FALSE;
1012  }
1013  else {
1014  ihermite = FALSE;
1015  }
1016 
1017  if (ihermite == FALSE) {
1018  if (GetOffCompGeneralSpin((unsigned long int) myrank, org_isite3 + 1, org_ispin4, org_ispin3, &tmp_off,
1019  X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
1020 
1021  if (GetOffCompGeneralSpin(tmp_off, org_isite1 + 1, org_ispin2, org_ispin1, &off, X->Def.SiteToBit,
1022  X->Def.Tpow) == TRUE) {
1023  tmp_V = conj(tmp_J);
1024  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
1025  }
1026  else return 0.0;
1027  }
1028  else return 0.0;
1029  }
1030 
1031  origin = (int)off;
1032 
1033  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1034  v1buf, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1035  MPI_COMM_WORLD, &statusMPI);
1036  if (ierr != 0) exitMPI(-1);
1037 
1038  dam_pr = 0.0;
1039 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V) private(j, dmv) \
1040  shared (tmp_v0, tmp_v1, v1buf)
1041  {
1042  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1043 #pragma omp for
1044  for (j = 1; j <= X->Check.idim_max; j++) {
1045  dmv = v1buf[j] * tmp_V;
1046  tmp_v0[j] += dmv;
1047  dam_pr += conj(tmp_v1[j]) * dmv;
1048  }
1049  }
1050  else {
1051 #pragma omp for
1052  for (j = 1; j <= X->Check.idim_max; j++) {
1053  dmv = v1buf[j] * tmp_V;
1054  dam_pr += conj(tmp_v1[j]) * dmv;
1055  }
1056  }
1057  }/*End of parallel region*/
1058  return dam_pr;
1059 #else
1060  return 0.0;
1061 #endif
1062 }/*double complex X_GC_child_CisAitCjuAjv_GeneralSpin_MPIdouble*/
1069  int org_isite1,
1070  int org_ispin1,
1071  int org_isite3,
1072  int org_ispin3,
1073  double complex tmp_J,
1074  struct BindStruct *X,
1075  double complex *tmp_v0,
1076  double complex *tmp_v1
1077 ) {
1078 #ifdef MPI
1079  unsigned long int j, num1;
1080  double complex tmp_V, dmv, dam_pr;
1081  //MPI_Status statusMPI;
1082 
1083  num1 = BitCheckGeneral((unsigned long int) myrank, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1084 
1085  if (num1 == TRUE) {
1086  num1 = BitCheckGeneral((unsigned long int) myrank, org_isite3 + 1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow);
1087  if (num1 == TRUE) {
1088  tmp_V = tmp_J;
1089  }
1090  else return 0.0;
1091  }
1092  else return 0.0;
1093 
1094  dam_pr = 0.0;
1095 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V) private(j, dmv) \
1096 shared (tmp_v0, tmp_v1)
1097  {
1098  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1099 #pragma omp for
1100  for (j = 1; j <= X->Check.idim_max; j++) {
1101  dmv = tmp_v1[j] * tmp_V;
1102  tmp_v0[j] += dmv;
1103  dam_pr += conj(tmp_v1[j]) * dmv;
1104  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1105  }
1106  else {
1107 #pragma omp for
1108  for (j = 1; j <= X->Check.idim_max; j++) {
1109  dmv = tmp_v1[j] * tmp_V;
1110  dam_pr += conj(tmp_v1[j]) * dmv;
1111  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1112  }
1113  }/*End of parallel region*/
1114  return dam_pr;
1115 #else
1116  return 0.0;
1117 #endif
1118 }/*double complex X_GC_child_CisAisCjuAju_GeneralSpin_MPIdouble*/
1125  int org_isite1,
1126  int org_ispin1,
1127  int org_ispin2,
1128  double complex tmp_trans,
1129  struct BindStruct *X,
1130  double complex *tmp_v0,
1131  double complex *tmp_v1
1132 ) {
1133 #ifdef MPI
1134  unsigned long int off, j;
1135  int origin, ierr;
1136  double complex tmp_V, dmv, dam_pr;
1137  MPI_Status statusMPI;
1138 
1139  if (GetOffCompGeneralSpin((unsigned long int) myrank, org_isite1 + 1, org_ispin1, org_ispin2,
1140  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
1141  tmp_V = tmp_trans;
1142  }
1143  else if (GetOffCompGeneralSpin((unsigned long int) myrank,
1144  org_isite1 + 1, org_ispin2, org_ispin1, &off,
1145  X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
1146  tmp_V = conj(tmp_trans);
1147  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
1148  }
1149  else return 0.0;
1150 
1151  origin = (int)off;
1152 
1153  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1154  v1buf, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1155  MPI_COMM_WORLD, &statusMPI);
1156  if (ierr != 0) exitMPI(-1);
1157 
1158  dam_pr = 0.0;
1159 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V) private(j, dmv) \
1160 shared (tmp_v0, tmp_v1, v1buf)
1161  {
1162  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1163 #pragma omp for
1164  for (j = 1; j <= X->Check.idim_max; j++) {
1165  dmv = v1buf[j] * tmp_V;
1166  tmp_v0[j] += dmv;
1167  dam_pr += conj(tmp_v1[j]) * dmv;
1168  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1169  }
1170  else {
1171 #pragma omp for
1172  for (j = 1; j <= X->Check.idim_max; j++) {
1173  dmv = v1buf[j] * tmp_V;
1174  dam_pr += conj(tmp_v1[j]) * dmv;
1175  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1176  }
1177  }/*End of parallel region*/
1178  return dam_pr;
1179 #else
1180  return 0.0;
1181 #endif
1182 }/*double complex X_GC_child_CisAit_GeneralSpin_MPIdouble*/
1189  int org_isite1,
1190  int org_ispin1,
1191  double complex tmp_trans,
1192  struct BindStruct *X,
1193  double complex *tmp_v0,
1194  double complex *tmp_v1
1195 ) {
1196 #ifdef MPI
1197  unsigned long int j, num1;
1198  double complex tmp_V, dmv, dam_pr;
1199  //MPI_Status statusMPI;
1200 
1201  num1 = BitCheckGeneral((unsigned long int) myrank,
1202  org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1203  if (num1 != 0) {
1204  tmp_V = tmp_trans;
1205  }
1206  else return 0.0;
1207 
1208  dam_pr = 0.0;
1209 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V) private(j, dmv) \
1210 shared (tmp_v0, tmp_v1)
1211  {
1212  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1213 #pragma omp for
1214  for (j = 1; j <= X->Check.idim_max; j++) {
1215  dmv = tmp_v1[j] * tmp_V;
1216  tmp_v0[j] += dmv;
1217  dam_pr += conj(tmp_v1[j]) * dmv;
1218  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1219  }
1220  else {
1221 #pragma omp for
1222  for (j = 1; j <= X->Check.idim_max; j++) {
1223  dmv = tmp_v1[j] * tmp_V;
1224  dam_pr += conj(tmp_v1[j]) * dmv;
1225  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1226  }
1227  }/*End of parallel region*/
1228  return dam_pr;
1229 #else
1230  return 0.0;
1231 #endif
1232 }/*double complex X_GC_child_CisAis_GeneralSpin_MPIdouble*/
1239  int org_isite1,
1240  int org_ispin1,
1241  double complex tmp_trans,
1242  struct BindStruct *X,
1243  double complex *tmp_v0,
1244  double complex *tmp_v1
1245 ) {
1246 #ifdef MPI
1247  unsigned long int j, num1;
1248  double complex tmp_V, dmv, dam_pr;
1249  //MPI_Status statusMPI;
1250 
1251  num1 = BitCheckGeneral((unsigned long int) myrank,
1252  org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1253  if (num1 == 0) {
1254  tmp_V = tmp_trans;
1255  }
1256  else return 0.0;
1257 
1258  dam_pr = 0.0;
1259 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V) private(j, dmv) \
1260 shared (tmp_v0, tmp_v1)
1261  {
1262  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1263 #pragma omp for
1264  for (j = 1; j <= X->Check.idim_max; j++) {
1265  dmv = tmp_v1[j] * tmp_V;
1266  tmp_v0[j] += dmv;
1267  dam_pr += conj(tmp_v1[j]) * dmv;
1268  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1269  }
1270  else {
1271 #pragma omp for
1272  for (j = 1; j <= X->Check.idim_max; j++) {
1273  dmv = tmp_v1[j] * tmp_V;
1274  dam_pr += conj(tmp_v1[j]) * dmv;
1275  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1276  }
1277  }/*End of Parallel region*/
1278  return dam_pr;
1279 #else
1280  return 0.0;
1281 #endif
1282 }/*double complex X_GC_child_AisCis_GeneralSpin_MPIdouble*/
1289  int org_isite1,
1290  int org_ispin1,
1291  int org_ispin2,
1292  double complex tmp_trans,
1293  struct BindStruct *X,
1294  double complex *tmp_v0,
1295  double complex *tmp_v1,
1296  double complex *tmp_v1buf,
1297  unsigned long int idim_max,
1298  long unsigned int *list_1_org,
1299  long unsigned int *list_1buf_org,
1300  long unsigned int _ihfbit
1301 )
1302 {
1303 #ifdef MPI
1304  unsigned long int off, j, tmp_off,idim_max_buf;
1305  int origin, ierr;
1306  double complex tmp_V, dmv;
1307  MPI_Status statusMPI;
1308 
1309  if (GetOffCompGeneralSpin((unsigned long int) myrank, org_isite1 + 1, org_ispin1, org_ispin2,
1310  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
1311  tmp_V = tmp_trans;
1312  }
1313  else if (GetOffCompGeneralSpin((unsigned long int) myrank,
1314  org_isite1 + 1, org_ispin2, org_ispin1, &off,
1315  X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
1316  tmp_V = conj(tmp_trans);
1317  if (X->Large.mode == M_CORR || X->Large.mode ==M_CALCSPEC) tmp_V = 0.0;
1318  }
1319  else return 0.0;
1320 
1321  origin = (int) off;
1322 
1323  ierr = MPI_Sendrecv(&idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
1324  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
1325  MPI_COMM_WORLD, &statusMPI);
1326  if(ierr != 0) exitMPI(-1);
1327 
1328  ierr = MPI_Sendrecv(list_1_org, idim_max + 1, MPI_UNSIGNED_LONG, origin, 0,
1329  list_1buf_org, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
1330  MPI_COMM_WORLD, &statusMPI);
1331  if (ierr != 0) exitMPI(-1);
1332 
1333  ierr = MPI_Sendrecv(tmp_v1, idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1334  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1335  MPI_COMM_WORLD, &statusMPI);
1336  if (ierr != 0) exitMPI(-1);
1337 
1338  if (X->Large.mode == M_MLTPLY || X->Large.mode ==M_CALCSPEC) {
1339 #pragma omp parallel for default(none)\
1340 firstprivate(X, tmp_V, idim_max_buf, list_1buf_org) private(j, dmv, tmp_off) \
1341 shared (tmp_v0, tmp_v1, v1buf)
1342  for (j = 1; j <= idim_max_buf; j++) {
1343  ConvertToList1GeneralSpin(list_1buf_org[j], X->Large.ihfbit, &tmp_off);
1344  dmv = v1buf[j] * tmp_V;
1345  tmp_v0[tmp_off] += dmv;
1346  }/*for (j = 1; j <= idim_max_buf; j++)*/
1347  }
1348  else {
1349  tmp_off = 0;
1350  return 0;
1351  }
1352  return 1;
1353 #else
1354  return 0.0;
1355 #endif
1356 }/*double complex X_child_CisAit_GeneralSpin_MPIdouble*/
1363  int org_isite1,
1364  int org_ispin1,
1365  int org_isite3,
1366  int org_ispin3,
1367  int org_ispin4,
1368  double complex tmp_J,
1369  struct BindStruct *X,
1370  double complex *tmp_v0,
1371  double complex *tmp_v1
1372 ){
1373 #ifdef MPI
1374  unsigned long int off, j, num1;
1375  int origin, ierr, isite, IniSpin;
1376  double complex tmp_V, dmv, dam_pr;
1377  MPI_Status statusMPI;
1378 
1379  if (GetOffCompGeneralSpin((unsigned long int)myrank,
1380  org_isite3 + 1, org_ispin3, org_ispin4, &off,
1381  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1382  {
1383  tmp_V = tmp_J;
1384  isite = org_isite1 + 1;
1385  IniSpin = org_ispin1;
1386  }
1387  else if (GetOffCompGeneralSpin((unsigned long int)myrank,
1388  org_isite3 + 1, org_ispin4, org_ispin3, &off,
1389  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1390  {
1391  tmp_V = conj(tmp_J);
1392  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
1393  isite = org_isite1 + 1;
1394  IniSpin = org_ispin1;
1395  }
1396  else return 0.0;
1397 
1398  origin = (int)off;
1399 
1400  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1401  v1buf, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1402  MPI_COMM_WORLD, &statusMPI);
1403  if (ierr != 0) exitMPI(-1);
1404 
1405  dam_pr = 0.0;
1406 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V, isite, IniSpin) \
1407 private(j, dmv, num1) shared (tmp_v0, tmp_v1, v1buf)
1408  {
1409  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1410 #pragma omp for
1411  for (j = 1; j <= X->Check.idim_max; j++) {
1412  num1 = BitCheckGeneral(j - 1, isite, IniSpin, X->Def.SiteToBit, X->Def.Tpow);
1413  if (num1 != 0) {
1414  dmv = v1buf[j] * tmp_V;
1415  tmp_v0[j] += dmv;
1416  dam_pr += conj(tmp_v1[j]) * dmv;
1417  }/*if (num1 != 0)*/
1418  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1419  }
1420  else {
1421 #pragma omp for
1422  for (j = 1; j <= X->Check.idim_max; j++) {
1423  num1 = BitCheckGeneral(j - 1, isite, IniSpin, X->Def.SiteToBit, X->Def.Tpow);
1424  if (num1 != 0) {
1425  dmv = v1buf[j] * tmp_V;
1426  dam_pr += conj(tmp_v1[j]) * dmv;
1427  }/*if (num1 != 0)*/
1428  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1429  }
1430  }/*End of parallel region*/
1431  return dam_pr;
1432 #else
1433  return 0.0;
1434 #endif
1435 }/*double complex X_GC_child_CisAisCjuAjv_GeneralSpin_MPIsingle*/
1442  int org_isite1,
1443  int org_ispin1,
1444  int org_ispin2,
1445  int org_isite3,
1446  int org_ispin3,
1447  double complex tmp_J,
1448  struct BindStruct *X,
1449  double complex *tmp_v0,
1450  double complex *tmp_v1
1451 ){
1452 #ifdef MPI
1453  unsigned long int num1, j, off;
1454  int isite, IniSpin, FinSpin;
1455  double complex tmp_V, dmv, dam_pr;
1456  //MPI_Status statusMPI;
1457 
1458  num1 = BitCheckGeneral((unsigned long int)myrank,
1459  org_isite3+1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow);
1460  if(num1 != 0){
1461  tmp_V = tmp_J;
1462  isite = org_isite1 + 1;
1463  IniSpin = org_ispin2;
1464  FinSpin = org_ispin1;
1465  }
1466  else return 0.0;
1467 
1468  dam_pr = 0.0;
1469 #pragma omp parallel default(none) reduction(+:dam_pr) \
1470 firstprivate(X, tmp_V, isite, IniSpin, FinSpin) private(j, dmv, num1, off) \
1471 shared (tmp_v0, tmp_v1, v1buf)
1472  {
1473  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1474 #pragma omp for
1475  for (j = 1; j <= X->Check.idim_max; j++) {
1476  if (GetOffCompGeneralSpin(j - 1, isite, IniSpin, FinSpin, &off,
1477  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1478  {
1479  dmv = tmp_v1[j] * tmp_V;
1480  tmp_v0[off + 1] += dmv;
1481  dam_pr += conj(tmp_v1[off + 1]) * dmv;
1482  }
1483  else if (GetOffCompGeneralSpin(j - 1, isite, FinSpin, IniSpin, &off,
1484  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1485  {
1486  dmv = tmp_v1[j] * conj(tmp_V);
1487  tmp_v0[off + 1] += dmv;
1488  dam_pr += conj(tmp_v1[off + 1]) * dmv;
1489  }
1490  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1491  }
1492  else {
1493 #pragma omp for
1494  for (j = 1; j <= X->Check.idim_max; j++) {
1495  if (GetOffCompGeneralSpin(j - 1, isite, IniSpin, FinSpin, &off,
1496  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1497  {
1498  dmv = tmp_v1[j] * tmp_V;
1499  dam_pr += conj(tmp_v1[off + 1]) * dmv;
1500  }
1501  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1502  }
1503  }/*End of parallel region*/
1504  return dam_pr;
1505 #else
1506  return 0.0;
1507 #endif
1508 }/*double complex X_GC_child_CisAitCjuAju_GeneralSpin_MPIsingle*/
1515  int org_isite1,
1516  int org_ispin1,
1517  int org_ispin2,
1518  int org_isite3,
1519  int org_ispin3,
1520  int org_ispin4,
1521  double complex tmp_J,
1522  struct BindStruct *X,
1523  double complex *tmp_v0,
1524  double complex *tmp_v1
1525 ){
1526 #ifdef MPI
1527  unsigned long int off, j;
1528  int origin, ierr, isite, IniSpin, FinSpin;
1529  double complex tmp_V, dmv, dam_pr;
1530  MPI_Status statusMPI;
1531 
1532  if (GetOffCompGeneralSpin((unsigned long int)myrank,
1533  org_isite3 + 1, org_ispin3, org_ispin4, &off,
1534  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1535  {
1536  tmp_V = tmp_J;
1537  isite = org_isite1 + 1;
1538  IniSpin = org_ispin2;
1539  FinSpin = org_ispin1;
1540  }
1541  else if (GetOffCompGeneralSpin((unsigned long int)myrank,
1542  org_isite3 + 1, org_ispin4, org_ispin3, &off,
1543  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1544  {
1545  tmp_V = conj(tmp_J);
1546  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
1547  isite = org_isite1 + 1;
1548  IniSpin = org_ispin1;
1549  FinSpin = org_ispin2;
1550  }
1551  else return 0.0;
1552 
1553  origin = (int)off;
1554 
1555  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1556  v1buf, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1557  MPI_COMM_WORLD, &statusMPI);
1558  if (ierr != 0) exitMPI(-1);
1559 
1560  dam_pr = 0.0;
1561 #pragma omp parallel default(none) reduction(+:dam_pr) \
1562 firstprivate(X, tmp_V, isite, IniSpin, FinSpin) private(j, dmv, off) shared (tmp_v0, tmp_v1, v1buf)
1563  {
1564  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1565 #pragma omp for
1566  for (j = 1; j <= X->Check.idim_max; j++) {
1567  if (GetOffCompGeneralSpin(j - 1, isite, IniSpin, FinSpin, &off,
1568  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1569  {
1570  dmv = v1buf[j] * tmp_V;
1571  tmp_v0[off + 1] += dmv;
1572  dam_pr += conj(tmp_v1[off + 1]) * dmv;
1573  }
1574  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1575  }
1576  else {
1577 #pragma omp for
1578  for (j = 1; j <= X->Check.idim_max; j++) {
1579  if (GetOffCompGeneralSpin(j - 1, isite, IniSpin, FinSpin, &off,
1580  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1581  {
1582  dmv = v1buf[j] * tmp_V;
1583  dam_pr += conj(tmp_v1[off + 1]) * dmv;
1584  }
1585  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1586  }
1587  }/*End of parallel region*/
1588  return dam_pr;
1589 #else
1590  return 0.0;
1591 #endif
1592 }/*double complex X_GC_child_CisAitCjuAjv_GeneralSpin_MPIsingle*/
1599  int org_isite1,
1600  int org_ispin1,
1601  int org_isite3,
1602  int org_ispin3,
1603  double complex tmp_J,
1604  struct BindStruct *X,
1605  double complex *tmp_v0,
1606  double complex *tmp_v1
1607 ){
1608 #ifdef MPI
1609  unsigned long int j, num1;
1610  double complex tmp_V, dmv, dam_pr;
1611  //MPI_Status statusMPI;
1612 
1613  num1 = BitCheckGeneral((unsigned long int)myrank, org_isite3+1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow);
1614  if (num1 != FALSE) {
1615  tmp_V = tmp_J;
1616  }
1617  else return 0.0;
1618 
1619  dam_pr = 0.0;
1620 #pragma omp parallel default(none) reduction(+:dam_pr) \
1621 firstprivate(X, tmp_V, org_isite1, org_ispin1) private(j, dmv, num1) shared (tmp_v0, tmp_v1)
1622  {
1623  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1624 #pragma omp for
1625  for (j = 1; j <= X->Check.idim_max; j++) {
1626  num1 = BitCheckGeneral(j - 1, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1627 
1628  dmv = tmp_v1[j] * tmp_V * num1;
1629  tmp_v0[j] += dmv;
1630  dam_pr += conj(tmp_v1[j]) * dmv;
1631  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1632  }
1633  else {
1634 #pragma omp for
1635  for (j = 1; j <= X->Check.idim_max; j++) {
1636  num1 = BitCheckGeneral(j - 1, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1637  dmv = tmp_v1[j] * tmp_V * num1;
1638  dam_pr += conj(tmp_v1[j]) * dmv;
1639  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1640  }
1641  }/*End of parallel region*/
1642  return dam_pr;
1643 #else
1644  return 0.0;
1645 #endif
1646 }/*double complex X_GC_child_CisAisCjuAju_GeneralSpin_MPIsingle*/
1653  int org_isite1,
1654  int org_ispin1,
1655  int org_ispin2,
1656  int org_isite3,
1657  int org_ispin3,
1658  int org_ispin4,
1659  double complex tmp_J,
1660  struct BindStruct *X,
1661  double complex *tmp_v0,
1662  double complex *tmp_v1
1663 ){
1664 #ifdef MPI
1665  unsigned long int tmp_off, off, j, idim_max_buf;
1666  int origin, ierr;
1667  double complex tmp_V, dmv, dam_pr;
1668  MPI_Status statusMPI;
1669  int ihermite=TRUE;
1670 
1671  if (GetOffCompGeneralSpin((unsigned long int)myrank, org_isite1 + 1, org_ispin1, org_ispin2, &tmp_off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1672  {
1673  if (GetOffCompGeneralSpin(tmp_off, org_isite3 + 1, org_ispin3, org_ispin4, &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1674  {
1675  tmp_V = tmp_J;
1676  }
1677  else{
1678  ihermite =FALSE;
1679  }
1680  }
1681  else{
1682  ihermite=FALSE;
1683  }
1684 
1685  if(ihermite==FALSE){
1686  if(GetOffCompGeneralSpin((unsigned long int)myrank, org_isite3 + 1, org_ispin4, org_ispin3, &tmp_off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1687  {
1688  if (GetOffCompGeneralSpin(tmp_off, org_isite1 + 1, org_ispin2, org_ispin1, &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1689  {
1690  tmp_V = conj(tmp_J);
1691  if(X->Large.mode == M_CORR|| X->Large.mode == M_CALCSPEC){
1692  tmp_V=0.0;
1693  }
1694  }
1695  else return 0.0;
1696  }
1697  else return 0.0;
1698  }
1699 
1700 
1701  origin = (int)off;
1702 
1703  ierr = MPI_Sendrecv(&X->Check.idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
1704  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
1705  MPI_COMM_WORLD, &statusMPI);
1706  if (ierr != 0) exitMPI(-1);
1707  ierr = MPI_Sendrecv(list_1, X->Check.idim_max + 1, MPI_UNSIGNED_LONG, origin, 0,
1708  list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
1709  MPI_COMM_WORLD, &statusMPI);
1710  if (ierr != 0) exitMPI(-1);
1711  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1712  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1713  MPI_COMM_WORLD, &statusMPI);
1714  if (ierr != 0) exitMPI(-1);
1715 
1716  dam_pr = 0.0;
1717 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V, idim_max_buf) \
1718 private(j, dmv, off) shared (tmp_v0, tmp_v1, list_1buf, v1buf)
1719  {
1720  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1721 #pragma omp for
1722  for (j = 1; j <= idim_max_buf; j++) {
1724  dmv = v1buf[j] * tmp_V;
1725  tmp_v0[off] += dmv;
1726  dam_pr += conj(tmp_v1[off]) * dmv;
1727  }/*for (j = 1; j <= idim_max_buf; j++)*/
1728  }
1729  else {
1730 #pragma omp for
1731  for (j = 1; j <= idim_max_buf; j++) {
1733  dmv = v1buf[j] * tmp_V;
1734  dam_pr += conj(tmp_v1[off]) * dmv;
1735  }/*for (j = 1; j <= idim_max_buf; j++)*/
1736  }
1737  }/*End of parallel region*/
1738  return dam_pr;
1739 #else
1740  return 0.0;
1741 #endif
1742 }/*double complex X_child_CisAitCjuAjv_GeneralSpin_MPIdouble*/
1749  int org_isite1,
1750  int org_ispin1,
1751  int org_isite3,
1752  int org_ispin3,
1753  double complex tmp_J,
1754  struct BindStruct *X,
1755  double complex *tmp_v0,
1756  double complex *tmp_v1
1757 ) {
1758 #ifdef MPI
1759  unsigned long int j, num1;
1760  double complex tmp_V, dmv, dam_pr;
1761 
1762  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin3) {
1763  num1 = BitCheckGeneral((unsigned long int) myrank, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1764  if (num1 != FALSE) {
1765  tmp_V = tmp_J;
1766  }
1767  else {
1768  return 0.0;
1769  }
1770  }
1771  else {
1772  num1 = BitCheckGeneral((unsigned long int) myrank, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1773  if (num1 != FALSE) {
1774  num1 = BitCheckGeneral((unsigned long int) myrank, org_isite3 + 1, org_ispin3, X->Def.SiteToBit,
1775  X->Def.Tpow);
1776  if (num1 != FALSE) {
1777  tmp_V = tmp_J;
1778  }
1779  else {
1780  return 0.0;
1781  }
1782  }
1783  else {
1784  return 0.0;
1785  }
1786  }
1787  dam_pr = 0.0;
1788 #pragma omp parallel default(none) reduction(+:dam_pr) firstprivate(X, tmp_V) private(j, dmv) \
1789 shared (tmp_v0, tmp_v1)
1790  {
1791  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1792 #pragma omp for
1793  for (j = 1; j <= X->Check.idim_max; j++) {
1794  dmv = tmp_v1[j] * tmp_V;
1795  tmp_v0[j] += dmv;
1796  dam_pr += conj(tmp_v1[j]) * dmv;
1797  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1798  }
1799  else {
1800 #pragma omp for
1801  for (j = 1; j <= X->Check.idim_max; j++) {
1802  dmv = tmp_v1[j] * tmp_V;
1803  dam_pr += conj(tmp_v1[j]) * dmv;
1804  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1805  }
1806  }/*End of parallel region*/
1807  return dam_pr;
1808 #else
1809  return 0.0;
1810 #endif
1811 }/*double complex X_child_CisAisCjuAju_GeneralSpin_MPIdouble*/
1818  int org_isite1,
1819  int org_ispin1,
1820  int org_isite3,
1821  int org_ispin3,
1822  double complex tmp_J,
1823  struct BindStruct *X,
1824  double complex *tmp_v0,
1825  double complex *tmp_v1
1826 )
1827 {
1828 #ifdef MPI
1829  unsigned long int j, num1;
1830  double complex tmp_V, dmv, dam_pr;
1831  //MPI_Status statusMPI;
1832 
1833  num1 = BitCheckGeneral((unsigned long int) myrank, org_isite3 + 1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow);
1834  if (num1 != FALSE) {
1835  tmp_V = tmp_J;
1836  }
1837  else return 0.0;
1838 
1839  dam_pr = 0.0;
1840 #pragma omp parallel default(none) reduction(+:dam_pr) \
1841 firstprivate(X, tmp_V, org_isite1, org_ispin1) private(j, dmv, num1) shared (tmp_v0, tmp_v1, list_1)
1842  {
1843  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1844 #pragma omp for
1845  for (j = 1; j <= X->Check.idim_max; j++) {
1846  num1 = BitCheckGeneral(list_1[j], org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1847 
1848  dmv = tmp_v1[j] * tmp_V * num1;
1849  tmp_v0[j] += dmv;
1850  dam_pr += conj(tmp_v1[j]) * dmv;
1851  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1852  }
1853  else {
1854 #pragma omp for
1855  for (j = 1; j <= X->Check.idim_max; j++) {
1856  num1 = BitCheckGeneral(list_1[j], org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1857 
1858  dmv = tmp_v1[j] * tmp_V * num1;
1859  dam_pr += conj(tmp_v1[j]) * dmv;
1860  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1861  }
1862  }/*End of parallel region*/
1863  return dam_pr;
1864 #else
1865  return 0.0;
1866 #endif
1867 }/*double complex X_child_CisAisCjuAju_GeneralSpin_MPIsingle*/
1874  int org_isite1,
1875  int org_ispin1,
1876  int org_ispin2,
1877  int org_isite3,
1878  int org_ispin3,
1879  int org_ispin4,
1880  double complex tmp_J,
1881  struct BindStruct *X,
1882  double complex *tmp_v0,
1883  double complex *tmp_v1
1884 ){
1885 #ifdef MPI
1886  unsigned long int tmp_off, off, j, idim_max_buf;
1887  int origin, ierr, isite, IniSpin, FinSpin;
1888  double complex tmp_V, dmv, dam_pr;
1889  MPI_Status statusMPI;
1890 
1891  if (GetOffCompGeneralSpin((unsigned long int)myrank,
1892  org_isite3 + 1, org_ispin3, org_ispin4, &off,
1893  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1894  {
1895  tmp_V = tmp_J;
1896  isite = org_isite1 + 1;
1897  IniSpin = org_ispin2;
1898  FinSpin = org_ispin1;
1899  }
1900  else if (GetOffCompGeneralSpin((unsigned long int)myrank,
1901  org_isite3 + 1, org_ispin4, org_ispin3, &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1902  {
1903  tmp_V = conj(tmp_J);
1904  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
1905  isite = org_isite1 + 1;
1906  IniSpin = org_ispin1;
1907  FinSpin = org_ispin2;
1908  }
1909  else return 0.0;
1910 
1911  origin = (int)off;
1912 
1913  ierr = MPI_Sendrecv(&X->Check.idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
1914  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
1915  MPI_COMM_WORLD, &statusMPI);
1916  if (ierr != 0) exitMPI(-1);
1917  ierr = MPI_Sendrecv(list_1, X->Check.idim_max + 1, MPI_UNSIGNED_LONG, origin, 0,
1918  list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
1919  MPI_COMM_WORLD, &statusMPI);
1920  if (ierr != 0) exitMPI(-1);
1921  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1922  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
1923  MPI_COMM_WORLD, &statusMPI);
1924  if (ierr != 0) exitMPI(-1);
1925 
1926  dam_pr = 0.0;
1927 #pragma omp parallel default(none) reduction(+:dam_pr) \
1928 firstprivate(X, tmp_V, idim_max_buf, IniSpin, FinSpin, isite) \
1929 private(j, dmv, off, tmp_off) shared (tmp_v0, tmp_v1, list_1buf, v1buf)
1930  {
1931  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
1932 #pragma omp for
1933  for (j = 1; j <= idim_max_buf; j++) {
1934 
1935  if (GetOffCompGeneralSpin(list_1buf[j], isite, IniSpin, FinSpin, &tmp_off,
1936  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1937  {
1938  ConvertToList1GeneralSpin(tmp_off, X->Check.sdim, &off);
1939  dmv = v1buf[j] * tmp_V;
1940  tmp_v0[off] += dmv;
1941  dam_pr += conj(tmp_v1[off]) * dmv;
1942  }
1943  }/*for (j = 1; j <= idim_max_buf; j++)*/
1944  }
1945  else {
1946 #pragma omp for
1947  for (j = 1; j <= idim_max_buf; j++) {
1948 
1949  if (GetOffCompGeneralSpin(list_1buf[j], isite, IniSpin, FinSpin, &tmp_off,
1950  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1951  {
1952  ConvertToList1GeneralSpin(tmp_off, X->Check.sdim, &off);
1953  dmv = v1buf[j] * tmp_V;
1954  dam_pr += conj(tmp_v1[off]) * dmv;
1955  }
1956  }/*for (j = 1; j <= idim_max_buf; j++)*/
1957  }
1958  }/*End of parallel region*/
1959  return dam_pr;
1960 #else
1961  return 0.0;
1962 #endif
1963 }/*double complex X_child_CisAitCjuAjv_GeneralSpin_MPIsingle*/
1971  int org_isite1,
1972  int org_ispin1,
1973  int org_ispin2,
1974  double complex tmp_trans,
1975  struct BindStruct *X ,
1976  double complex *tmp_v0 ,
1977  double complex *tmp_v1 )
1978 {
1979 #ifdef MPI
1980  int mask1, state1, ierr, origin;
1981  unsigned long int idim_max_buf, j;
1982  MPI_Status statusMPI;
1983  double complex trans, dmv, dam_pr;
1984 
1985  mask1 = (int)X->Def.Tpow[org_isite1];
1986  origin = myrank ^ mask1;
1987  state1 = (origin & mask1)/mask1;
1988 
1989  //fprintf(stdout, "Debug: myrank=%d, origin=%d, state1=%d\n", myrank, origin, state1);
1990 
1991  if(state1 == org_ispin2){
1992  trans = tmp_trans;
1993  }
1994  else if(state1 == org_ispin1) {
1995  trans = conj(tmp_trans);
1996  if(X->Large.mode == M_CORR|| X->Large.mode ==M_CALCSPEC){
1997  trans = 0.0;
1998  }
1999  }
2000  else{
2001  return 0.0;
2002  }
2003 
2004  ierr = MPI_Sendrecv(&X->Check.idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
2005  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
2006  MPI_COMM_WORLD, &statusMPI);
2007  if (ierr != 0) exitMPI(-1);
2008  ierr = MPI_Sendrecv(tmp_v1, X->Check.idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
2009  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
2010  MPI_COMM_WORLD, &statusMPI);
2011  if (ierr != 0) exitMPI(-1);
2012 
2013  dam_pr = 0.0;
2014 #pragma omp parallel default(none) reduction(+:dam_pr) private(j, dmv) \
2015 firstprivate(idim_max_buf, trans, X) shared(v1buf, tmp_v1, tmp_v0)
2016  {
2017  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
2018 #pragma omp for
2019  for (j = 1; j <= X->Check.idim_max; j++) {
2020  dmv = trans * v1buf[j];
2021  tmp_v0[j] += dmv;
2022  dam_pr += conj(tmp_v1[j]) * dmv;
2023  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
2024  }
2025  else {
2026 #pragma omp for
2027  for (j = 1; j <= X->Check.idim_max; j++) {
2028  dmv = trans * v1buf[j];
2029  dam_pr += conj(tmp_v1[j]) * dmv;
2030  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
2031  }
2032  }/*End of parallel region*/
2033  return (dam_pr);
2034 #else
2035  return 0.0;
2036 #endif
2037 }/*double complex X_GC_child_CisAit_spin_MPIdouble*/
2045  int org_isite1,
2046  int org_ispin2,
2047  double complex tmp_trans,
2048  struct BindStruct *X ,
2049  double complex *tmp_v0 ,
2050  double complex *tmp_v1,
2051  double complex *tmp_v1buf,
2052  unsigned long int idim_max,
2053  long unsigned int *Tpow,
2054  long unsigned int *list_1_org,
2055  long unsigned int *list_1buf_org,
2056  long unsigned int *list_2_1_target,
2057  long unsigned int *list_2_2_target,
2058  long unsigned int _irght,
2059  long unsigned int _ilft,
2060  long unsigned int _ihfbit
2061 ){
2062 #ifdef MPI
2063  int mask1, state1, ierr, origin;
2064  unsigned long int idim_max_buf, j;
2065  unsigned long int tmp_off;
2066  MPI_Status statusMPI;
2067  double complex trans, dmv;
2068 
2069  mask1 = (int)X->Def.Tpow[org_isite1];
2070  origin = myrank ^ mask1;
2071  state1 = (origin & mask1)/mask1;
2072 
2073  if(state1 == org_ispin2){
2074  trans = tmp_trans;
2075  }
2076  else{
2077  trans =0.0;
2078  }
2079 
2080  // fprintf(stdout, "Debug: myrank=%d, origin=%d, trans=%lf\n", myrank, origin, trans);
2081 
2082  ierr = MPI_Sendrecv(&idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
2083  &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
2084  MPI_COMM_WORLD, &statusMPI);
2085  if (ierr != 0) exitMPI(-1);
2086 
2087  ierr = MPI_Sendrecv(list_1_org, idim_max + 1, MPI_UNSIGNED_LONG, origin, 0,
2088  list_1buf_org, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
2089  MPI_COMM_WORLD, &statusMPI);
2090  if (ierr != 0) exitMPI(-1);
2091 
2092  ierr = MPI_Sendrecv(tmp_v1, idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
2093  v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
2094  MPI_COMM_WORLD, &statusMPI);
2095  if (ierr != 0) exitMPI(-1);
2096 
2097  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) {
2098 #pragma omp parallel for default(none) private(j, dmv, tmp_off) \
2099 firstprivate(idim_max_buf, trans, X, list_1buf_org, list_2_1_target, list_2_2_target) \
2100 shared(v1buf, tmp_v0)
2101  for (j = 1; j <= idim_max_buf; j++) {
2102  GetOffComp(list_2_1_target, list_2_2_target, list_1buf_org[j], X->Large.irght, X->Large.ilft, X->Large.ihfbit, &tmp_off);
2103  dmv = trans * v1buf[j];
2104  tmp_v0[tmp_off] += dmv;
2105  }
2106  }
2107  else {
2108  tmp_off = 0;
2109  return 0;
2110  }
2111  return 1;
2112 #else
2113  return 0.0;
2114 #endif
2115 }/*double complex X_child_CisAit_spin_MPIdouble*/
2123  int org_isite1,
2124  int org_ispin1,
2125  double complex tmp_trans,
2126  struct BindStruct *X ,
2127  double complex *tmp_v0 ,
2128  double complex *tmp_v1
2129 ){
2130 #ifdef MPI
2131  long unsigned int j;
2132  int mask1;
2133  int ibit1;
2134  double complex dam_pr;
2135  mask1 = (int)X->Def.Tpow[org_isite1];
2136  ibit1 = (((unsigned long int)myrank& mask1)/mask1)^(1-org_ispin1);
2137 
2138  dam_pr = 0.0;
2139 #pragma omp parallel reduction(+:dam_pr)default(none) shared(tmp_v1, tmp_v0, ibit1) \
2140  firstprivate(X, tmp_trans) private(j)
2141  {
2142  if (ibit1 != 0) {
2143  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) { // for multply
2144 #pragma omp for
2145  for (j = 1; j <= X->Check.idim_max; j++) {
2146  tmp_v0[j] += tmp_v1[j] * tmp_trans;
2147  dam_pr += tmp_trans * conj(tmp_v1[j]) * tmp_v1[j];
2148  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
2149  }
2150  else {
2151 #pragma omp for
2152  for (j = 1; j <= X->Check.idim_max; j++) {
2153  dam_pr += tmp_trans * conj(tmp_v1[j]) * tmp_v1[j];
2154  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
2155  }
2156  }/*if (ibit1 != 0)*/
2157  }/*End of parallel region*/
2158  return dam_pr;
2159 #else
2160  return 0.0;
2161 #endif
2162 }/*double complex X_GC_child_CisAis_spin_MPIdouble*/
2170  int org_isite1,
2171  int org_ispin1,
2172  double complex tmp_trans,
2173  struct BindStruct *X ,
2174  double complex *tmp_v0 ,
2175  double complex *tmp_v1
2176 ){
2177 #ifdef MPI
2178  long unsigned int j;
2179  int mask1;
2180  int ibit1;
2181  double complex dam_pr;
2182  mask1 = (int)X->Def.Tpow[org_isite1];
2183  ibit1 = (((unsigned long int)myrank& mask1) / mask1) ^ (1 - org_ispin1);
2184 
2185  dam_pr = 0.0;
2186 #pragma omp parallel reduction(+:dam_pr)default(none) shared(tmp_v1, tmp_v0, ibit1) \
2187  firstprivate(X, tmp_trans) private(j)
2188  {
2189  if (ibit1 == 0) {
2190  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) { // for multply
2191 #pragma omp for
2192  for (j = 1; j <= X->Check.idim_max; j++) {
2193  tmp_v0[j] += tmp_v1[j] * tmp_trans;
2194  dam_pr += tmp_trans * conj(tmp_v1[j]) * tmp_v1[j];
2195  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
2196  }
2197  else {
2198 #pragma omp for
2199  for (j = 1; j <= X->Check.idim_max; j++) {
2200  dam_pr += tmp_trans * conj(tmp_v1[j]) * tmp_v1[j];
2201  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
2202  }
2203  }/*if (ibit1 == 0)*/
2204  }/*End of parallel region*/
2205  return dam_pr;
2206 #else
2207  return 0.0;
2208 #endif
2209 }/*double complex X_GC_child_AisCis_spin_MPIdouble*/
void GC_child_CisAitCiuAiv_spin_MPIdouble(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Exchange and Pairlifting term in Spin model + GC When both site1 and site2 are in the inter process r...
void exitMPI(int errorcode)
MPI Abortation wrapper.
Definition: wrapperMPI.c:86
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
double complex X_child_CisAitCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the canonical general spin system when one of these sites is in the inter process re...
double complex X_GC_child_CisAisCjuAju_spin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
double complex X_GC_child_CisAitCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
double complex X_GC_child_CisAisCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
term in Spin model. When both site1 and site3 are in the inter process region.
void GC_child_CisAitCiuAiv_spin_MPIsingle(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Exchange and Pairlifting term in Spin model + GC When only site2 is in the inter process region...
double complex X_GC_child_CisAis_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
long unsigned int ihfbit
Used for Ogata-Lin ???
Definition: struct.h:345
unsigned long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.h:303
double complex X_GC_child_CisAis_spin_MPIdouble(int org_isite1, int org_ispin1, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
double complex X_GC_child_CisAitCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
double complex X_GC_child_CisAitCiuAiv_spin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Exchange and Pairlifting term in Spin model + GC When only site2 is in the inter process region...
double complex X_GC_child_CisAit_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
double complex X_child_CisAisCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the canonical general spin system when one of these sites is in the inter process re...
double complex prdct
The expectation value of the energy.
Definition: struct.h:314
int X_SpinGC_CisAis(long unsigned int j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int sigma1)
Compute the grandcanonical spin state with bit mask is1_spin.
long unsigned int * list_1buf
Definition: global.h:48
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
double complex X_child_CisAisCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the canonical general spin system when both sites are in the inter process region...
void GC_child_CisAisCjuAjv_spin_MPIsingle(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Wrapper for CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region...
int ConvertToList1GeneralSpin(const long unsigned int org_ibit, const long unsigned int ihlfbit, long unsigned int *_ilist1Comp)
function of converting component to list_1
Definition: bitcalc.c:285
void GC_child_CisAisCjuAjv_spin_MPIdouble(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Wrapper for calculating CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the int...
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_CisAitCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the canonical general spin system when both sites are in the inter process region...
int mode
multiply or expectation value.
Definition: struct.h:330
double complex X_GC_child_CisAisCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
double complex X_GC_child_CisAisCjuAju_spin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
double complex X_GC_child_CisAitCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
#define TRUE
Definition: global.h:26
long unsigned int * list_1buf_org
Definition: global.h:54
double complex X_GC_child_CisAitCjuAju_spin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region.
double complex X_GC_child_CisAisCjuAjv_spin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
double complex X_GC_child_CisAit_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
unsigned long int sdim
Dimension for Ogata-Lin ???
Definition: struct.h:307
int ** InterAll_OffDiagonal
[DefineList::NinterAll_OffDiagonal][8] Interacted quartet
Definition: struct.h:161
double complex X_child_CisAit_spin_MPIdouble(int org_isite1, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1, double complex *tmp_v1buf, unsigned long int idim_max, long unsigned int *Tpow, long unsigned int *list_1_org, long unsigned int *list_1buf_org, long unsigned int *list_2_1_target, long unsigned int *list_2_2_target, long unsigned int _irght, long unsigned int _ilft, long unsigned int _ihfbit)
Hopping term in Spin + Canonical for CalcSpectrum When both site1 and site2 are in the inter process ...
Bind.
Definition: struct.h:409
void GC_child_CisAitCjuAju_spin_MPIsingle(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Wrapper for CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region...
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
long unsigned int ilft
Used for Ogata-Lin ???
Definition: struct.h:344
long unsigned int * list_1_org
Definition: global.h:53
int GetOffComp(long unsigned int *_list_2_1, long unsigned int *_list_2_2, long unsigned int _ibit, const long unsigned int _irght, const long unsigned int _ilft, const long unsigned int _ihfbit, long unsigned int *_ioffComp)
function of getting off-diagonal component
Definition: bitcalc.c:195
#define FALSE
Definition: global.h:25
long unsigned int * list_1
Definition: global.h:47
void GC_child_CisAitCjuAju_spin_MPIdouble(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Wrapper for calculating CisAitCjuAju term in Spin model + GC When both site1 and site2 are in the int...
double complex X_GC_child_AisCis_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.h:94
int BitCheckGeneral(const long unsigned int org_bit, const unsigned int org_isite, const unsigned int target_ispin, const long int *SiteToBit, const long unsigned int *Tpow)
bit check function for general spin
Definition: bitcalc.c:393
double complex X_GC_child_AisCis_spin_MPIdouble(int org_isite1, int org_ispin1, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
double complex X_GC_child_CisAitCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
term in Spin model. When both site1 and site3 are in the inter process region.
double complex X_child_CisAit_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1, double complex *tmp_v1buf, unsigned long int idim_max, long unsigned int *list_1_org, long unsigned int *list_1buf_org, long unsigned int _ihfbit)
Compute term in the canonical general spin system when both site is in the inter process region...
struct EDMainCalStruct X
Definition: struct.h:432
long unsigned int irght
Used for Ogata-Lin ???
Definition: struct.h:343
double complex X_GC_child_CisAisCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
double complex X_GC_child_CisAisCjuAjv_spin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region.
int GetOffCompGeneralSpin(const long unsigned int org_ibit, const int org_isite, const int org_ispin, const int off_ispin, long unsigned int *_ioffComp, const long int *SiteToBit, const long unsigned int *Tpow)
function of getting off-diagonal component for general spin
Definition: bitcalc.c:243
int X_SpinGC_CisAit(long unsigned int j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int sigma2, long unsigned int *tmp_off)
Compute index of final wavefunction by term (grandcanonical).
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
double complex X_GC_child_CisAitCiuAiv_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
term in Spin model + GC. When both site1 and site2 are in the inter process region.
double complex * v1buf
Definition: global.h:37
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
double complex X_GC_child_CisAitCjuAju_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
double complex X_GC_child_CisAisCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, double complex tmp_J, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...