HPhi++  3.1.0
mltplyMPISpinCore.cpp
Go to the documentation of this file.
1 /* HPhi - Quantum Lattice Model Simulator */
2 /* Copyright (C) 2015 The University of Tokyo */
3 
4 /* This program is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU General Public License as published by */
6 /* the Free Software Foundation, either version 3 of the License, or */
7 /* (at your option) any later version. */
8 
9 /* This program is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU General Public License for more details. */
13 
14 /* You should have received a copy of the GNU General Public License */
15 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
65 #include "Common.hpp"
66 #include "mltplyCommon.hpp"
67 #include "mltplySpinCore.hpp"
68 #include "mltplyMPISpinCore.hpp"
69 #include "bitcalc.hpp"
70 #include "wrapperMPI.hpp"
77  long int i_int ,
78  struct BindStruct *X ,
79  int nstate, std::complex<double> **tmp_v0 ,
80  std::complex<double> **tmp_v1 )
81 {
83  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
84  X->Def.InterAll_OffDiagonal[i_int][3], X->Def.InterAll_OffDiagonal[i_int][4],
85  X->Def.InterAll_OffDiagonal[i_int][5], X->Def.InterAll_OffDiagonal[i_int][7],
86  X->Def.ParaInterAll_OffDiagonal[i_int],X, nstate, tmp_v0, tmp_v1);
87 }/*void GC_child_CisAitCiuAiv_spin_MPIdouble*/
96  int org_isite1,
97  int org_ispin1,
98  int org_ispin2,
99  int org_isite3,
100  int org_ispin3,
101  int org_ispin4,
102  std::complex<double> tmp_J,
103  struct BindStruct *X,
104  int nstate, std::complex<double> **tmp_v0,
105  std::complex<double> **tmp_v1
106 ) {
107  int mask1, mask2, state1, state2, origin;
108  long int idim_max_buf;
109  std::complex<double> Jint;
110 
111  mask1 = (int)X->Def.Tpow[org_isite1];
112  mask2 = (int)X->Def.Tpow[org_isite3];
113  if (org_isite1 != org_isite3) {
114  origin = myrank ^ (mask1 + mask2);
115  }
116  else {
117  if (org_ispin1 == org_ispin4 && org_ispin2 == org_ispin3) { //CisAitCitAis=CisAis
118  X_GC_child_CisAis_spin_MPIdouble(org_isite1, org_ispin1, tmp_J, X, nstate, tmp_v0, tmp_v1);
119  return;
120  }
121  else { //CisAitCisAit=0
122  return;
123  }
124  }
125 
126  state1 = (origin & mask1) / mask1;
127  state2 = (origin & mask2) / mask2;
128 
129  if (state1 == org_ispin2 && state2 == org_ispin4) {
130  Jint = tmp_J;
131  }
132  else if (state1 == org_ispin1 && state2 == org_ispin3) {
133  Jint = conj(tmp_J);
134  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
135  Jint = 0;
136  }
137  }
138  else {
139  return;
140  }
141 
142  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
143  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
144 
145  zaxpy_long(nstate * idim_max_buf, Jint, &v1buf[1][0], &tmp_v0[1][0]);
146 }/*void GC_child_CisAitCiuAiv_spin_MPIdouble*/
153  long int i_int ,
154  struct BindStruct *X ,
155  int nstate, std::complex<double> **tmp_v0 ,
156  std::complex<double> **tmp_v1
157 ){
159  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
160  X->Def.InterAll_OffDiagonal[i_int][4], X->Def.InterAll_OffDiagonal[i_int][5],
161  X->Def.InterAll_OffDiagonal[i_int][7], X->Def.ParaInterAll_OffDiagonal[i_int], X, nstate, tmp_v0, tmp_v1);
162 }/*void GC_child_CisAitCiuAiv_spin_MPIdouble*/
169  int org_isite1,
170  int org_ispin1,
171  int org_isite3,
172  int org_ispin3,
173  int org_ispin4,
174  std::complex<double> tmp_J,
175  struct BindStruct *X,
176  int nstate, std::complex<double> **tmp_v0,
177  std::complex<double> **tmp_v1
178 ) {
179  int mask1, mask2, state2;
180  long int origin, num1;
181  long int idim_max_buf;
182  std::complex<double> Jint;
183 
184  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin4) {//CisAisCitAis
185  return;
186  }
187 
188  mask1 = (int)X->Def.Tpow[org_isite1];
189  mask2 = (int)X->Def.Tpow[org_isite3];
190  origin = myrank ^ mask2;
191  state2 = (origin & mask2) / mask2;
192  num1 = X_SpinGC_CisAis((long int) myrank + 1, mask1, org_ispin1);
193  if (num1 != 0 && state2 == org_ispin4) {
194  Jint = tmp_J;
195  }
196  else if (X_SpinGC_CisAis(origin + 1, mask1, org_ispin1) == TRUE && state2 == org_ispin3) {
197  Jint = conj(tmp_J);
198  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) Jint = 0;
199  }
200  else {
201  return;
202  }
203 
204  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
205  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
206 
207  zaxpy_long(X->Check.idim_max*nstate, Jint, &v1buf[1][0], &tmp_v0[1][0]);
208 }/*std::complex<double> X_GC_child_CisAisCjuAjv_spin_MPIdouble*/
215  long int i_int,
216  struct BindStruct *X,
217  int nstate, std::complex<double> **tmp_v0,
218  std::complex<double> **tmp_v1
219 )
220 {
222  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
223  X->Def.InterAll_OffDiagonal[i_int][3], X->Def.InterAll_OffDiagonal[i_int][4],
224  X->Def.InterAll_OffDiagonal[i_int][5], X->Def.ParaInterAll_OffDiagonal[i_int], X, nstate, tmp_v0, tmp_v1);
225 }/*void GC_child_CisAitCiuAiv_spin_MPIdouble*/
232  int org_isite1,
233  int org_ispin1,
234  int org_ispin2,
235  int org_isite3,
236  int org_ispin3,
237  std::complex<double> tmp_J,
238  struct BindStruct *X,
239  int nstate, std::complex<double> **tmp_v0,
240  std::complex<double> **tmp_v1
241 ) {
242  int mask1, mask2, state1, num1;
243  long int origin;
244  long int idim_max_buf;
245  std::complex<double> Jint;
246 
247  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin3) {//cisaitcisais
248  return;
249  }
250 
251  mask1 = (int)X->Def.Tpow[org_isite1];
252  origin = myrank ^ mask1;
253  state1 = (origin & mask1) / mask1;
254  mask2 = (int)X->Def.Tpow[org_isite3];
255  num1 = X_SpinGC_CisAis(origin + 1, mask2, org_ispin3);
256  if (state1 == org_ispin2) {
257  if (num1 != 0) {
258  Jint = tmp_J;
259  }
260  else {
261  return;
262  }
263  }/*if (state1 == org_ispin2)*/
264  else {//state1 = org_ispin1
265  num1 = X_SpinGC_CisAis((long int) myrank + 1, mask2, org_ispin3);
266  if (num1 != 0) {
267  Jint = conj(tmp_J);
268  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
269  Jint = 0;
270  }
271  }
272  else {
273  return;
274  }
275  }
276 
277  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
278  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
279 
280  zaxpy_long(X->Check.idim_max*nstate, Jint, &v1buf[1][0], &tmp_v0[1][0]);
281 }/*std::complex<double> X_GC_child_CisAisCjuAjv_spin_MPIdouble*/
288  int org_isite1,
289  int org_ispin1,
290  int org_isite3,
291  int org_ispin3,
292  std::complex<double> tmp_J,
293  struct BindStruct *X,
294  int nstate, std::complex<double> **tmp_v0,
295  std::complex<double> **tmp_v1
296 ){
297  long int mask1, mask2, num1,num2;
298  long int j;
299  std::complex<double> dmv;
300  int one = 1;
301  mask1 = (int)X->Def.Tpow[org_isite1];
302  mask2 = (int)X->Def.Tpow[org_isite3];
303  num1 = X_SpinGC_CisAis((long int)myrank + 1, mask1, org_ispin1);
304  num2 = X_SpinGC_CisAis((long int)myrank + 1, mask2, org_ispin3);
305 
306 #pragma omp parallel default(none) private(j, dmv) \
307  firstprivate(tmp_J, X, num1, num2) shared(tmp_v1, tmp_v0,nstate,one)
308  {
309 #pragma omp for
310  for (j = 1; j <= X->Check.idim_max; j++) {
311  dmv = (std::complex<double>)(num1 * num2) * tmp_J;
312  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[j][0], &one);
313  }/*for (j = 1; j <= X->Check.idim_max; j++) */
314  }/*End of parallel region*/
315 }/*std::complex<double> X_GC_child_CisAisCjuAju_spin_MPIdouble*/
322  int org_isite1,
323  int org_ispin1,
324  int org_isite3,
325  int org_ispin3,
326  std::complex<double> tmp_J,
327  struct BindStruct *X,
328  int nstate, std::complex<double> **tmp_v0,
329  std::complex<double> **tmp_v1
330 ) {
331  long int mask1, mask2, num1, num2;
332  long int j;
333  std::complex<double> Jint, dmv;
334  int one = 1;
335  Jint = tmp_J;
336  mask1 = (int)X->Def.Tpow[org_isite1];
337  mask2 = (int)X->Def.Tpow[org_isite3];
338  num2 = X_SpinGC_CisAis((long int) myrank + 1, mask2, org_ispin3);
339 
340 #pragma omp parallel default(none) private(j, dmv, num1) \
341  firstprivate(Jint, X, num2, mask1, org_ispin1) shared(tmp_v1, tmp_v0,nstate,one)
342  {
343 #pragma omp for
344  for (j = 1; j <= X->Check.idim_max; j++) {
345  num1 = X_SpinGC_CisAis(j, mask1, org_ispin1);
346  dmv = Jint * (std::complex<double>)(num1 * num2);
347  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[j][0], &one);
348  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
349  }/*End of parallel region*/
350 }/*std::complex<double> X_GC_child_CisAisCjuAju_spin_MPIdouble*/
357  long int i_int,
358  struct BindStruct *X,
359  int nstate, std::complex<double> **tmp_v0,
360  std::complex<double> **tmp_v1
361 ){
363  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
364  X->Def.InterAll_OffDiagonal[i_int][3], X->Def.InterAll_OffDiagonal[i_int][4],
365  X->Def.InterAll_OffDiagonal[i_int][5], X->Def.InterAll_OffDiagonal[i_int][7],
366  X->Def.ParaInterAll_OffDiagonal[i_int], X, nstate, tmp_v0, tmp_v1);
367 }/*void GC_child_CisAitCiuAiv_spin_MPIsingle*/
374  int org_isite1,
375  int org_ispin1,
376  int org_ispin2,
377  int org_isite3,
378  int org_ispin3,
379  int org_ispin4,
380  std::complex<double> tmp_J,
381  struct BindStruct *X,
382  int nstate, std::complex<double> **tmp_v0,
383  std::complex<double> **tmp_v1
384 ) {
385  int mask2, state2, origin;
386  long int mask1, idim_max_buf, j, ioff, state1, state1check;
387  std::complex<double> Jint;
388  int one = 1;
389  /*
390  Prepare index in the inter PE
391  */
392  mask2 = (int)X->Def.Tpow[org_isite3];
393  origin = myrank ^ mask2;
394  state2 = (origin & mask2) / mask2;
395 
396  if (state2 == org_ispin4) {
397  state1check = (long int) org_ispin2;
398  Jint = tmp_J;
399  }
400  else if (state2 == org_ispin3) {
401  state1check = (long int) org_ispin1;
402  Jint = conj(tmp_J);
403  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
404  Jint = 0;
405  }
406  }
407  else return;
408 
409  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
410  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
411  /*
412  Index in the intra PE
413  */
414  mask1 = X->Def.Tpow[org_isite1];
415 
416 #pragma omp parallel default(none) private(j, state1, ioff) \
417  firstprivate(idim_max_buf, Jint, X, state1check, mask1) \
418  shared(v1buf, tmp_v1, tmp_v0,nstate,one)
419  {
420 #pragma omp for
421  for (j = 0; j < idim_max_buf; j++) {
422  state1 = X_SpinGC_CisAit(j + 1, mask1, state1check, &ioff);
423  if (state1 != 0) {
424  zaxpy_(&nstate, &Jint, &v1buf[j + 1][0], &one, &tmp_v0[ioff + 1][0], &one);
425  }/*if (state1 != 0)*/
426  }/*for (j = 0; j < idim_max_buf; j++)*/
427  }/*End of parallel region*/
428 }/*void GC_child_CisAitCiuAiv_spin_MPIsingle*/
435  long int i_int,
436  struct BindStruct *X,
437  int nstate, std::complex<double> **tmp_v0,
438  std::complex<double> **tmp_v1
439 ){
441  X->Def.InterAll_OffDiagonal[i_int][0], X->Def.InterAll_OffDiagonal[i_int][1],
442  X->Def.InterAll_OffDiagonal[i_int][4], X->Def.InterAll_OffDiagonal[i_int][5],
443  X->Def.InterAll_OffDiagonal[i_int][7], X->Def.ParaInterAll_OffDiagonal[i_int], X, nstate, tmp_v0, tmp_v1);
444 }/*void GC_child_CisAisCjuAjv_spin_MPIsingle*/
451  int org_isite1,
452  int org_ispin1,
453  int org_isite3,
454  int org_ispin3,
455  int org_ispin4,
456  std::complex<double> tmp_J,
457  struct BindStruct *X,
458  int nstate, std::complex<double> **tmp_v0,
459  std::complex<double> **tmp_v1
460 ) {
461  int mask2, state2, origin;
462  long int mask1, idim_max_buf, j, state1, state1check;
463  std::complex<double> Jint;
464  int one = 1;
465  /*
466  Prepare index in the inter PE
467  */
468  mask2 = (int)X->Def.Tpow[org_isite3];
469  origin = myrank ^ mask2;
470  state2 = (origin & mask2) / mask2;
471  if (state2 == org_ispin4) {
472  state1check = (long int) org_ispin1;
473  Jint = tmp_J;
474  }
475  else if (state2 == org_ispin3) {
476  state1check = (long int) org_ispin1;
477  Jint = conj(tmp_J);
478  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
479  Jint = 0;
480  }
481  }
482  else return;
483 
484  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
485  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
486  /*
487  Index in the intra PE
488  */
489  mask1 = X->Def.Tpow[org_isite1];
490 
491 #pragma omp parallel default(none) private(j, state1) \
492  firstprivate(idim_max_buf, Jint, X, state1check, mask1) \
493  shared(v1buf, tmp_v1, tmp_v0,nstate,one)
494  {
495 #pragma omp for
496  for (j = 0; j < idim_max_buf; j++) {
497  state1 = (j & mask1) / mask1;
498  if (state1 == state1check) {
499  zaxpy_(&nstate, &Jint, &v1buf[j + 1][0], &one, &tmp_v0[j + 1][0], &one);
500  }/*if (state1 == state1check)*/
501  }/*for (j = 0; j < idim_max_buf; j++)*/
502  }/*End of parallel region*/
503 }/*void GC_child_CisAitCiuAiv_spin_MPIsingle*/
510  long int i_int,
511  struct BindStruct *X,
512  int nstate, std::complex<double> **tmp_v0,
513  std::complex<double> **tmp_v1
514 ){
516  X->Def.InterAll_OffDiagonal[i_int][0],
517  X->Def.InterAll_OffDiagonal[i_int][3], X->Def.InterAll_OffDiagonal[i_int][4],
518  X->Def.InterAll_OffDiagonal[i_int][5], X->Def.ParaInterAll_OffDiagonal[i_int], X, nstate, tmp_v0, tmp_v1);
519 }/*void GC_child_CisAisCjuAjv_spin_MPIsingle*/
526  int org_isite1,
527  int org_ispin2,
528  int org_isite3,
529  int org_ispin3,
530  std::complex<double> tmp_J,
531  struct BindStruct *X,
532  int nstate, std::complex<double> **tmp_v0,
533  std::complex<double> **tmp_v1
534 ) {
535  int mask2, state2;
536  long int mask1, j, ioff, state1, state1check;
537  std::complex<double> Jint, dmv;
538  int one = 1;
539  /*
540  Prepare index in the inter PE
541  */
542  mask2 = (int)X->Def.Tpow[org_isite3];
543  state2 = (myrank & mask2) / mask2;
544 
545  if (state2 == org_ispin3) {
546  state1check = org_ispin2;
547  Jint = tmp_J;
548  }
549  else {
550  return;
551  }
552 
553  mask1 = (int)X->Def.Tpow[org_isite1];
554 
555 #pragma omp parallel default(none) private(j, dmv, state1, ioff) \
556  firstprivate(Jint, X, state1check, mask1) shared(tmp_v1, tmp_v0,nstate,one)
557  {
558 #pragma omp for
559  for (j = 0; j < X->Check.idim_max; j++) {
560 
561  state1 = (j & mask1) / mask1;
562  ioff = j ^ mask1;
563  if (state1 == state1check) {
564  dmv = Jint;
565  }
566  else {
567  dmv = conj(Jint);
568  }
569  zaxpy_(&nstate, &dmv, &tmp_v1[j + 1][0], &one, &tmp_v0[ioff + 1][0], &one);
570  }/*for (j = 0; j < X->Check.idim_max; j++)*/
571  }/*End of parallel region*/
572 }/*void GC_child_CisAitCiuAiv_spin_MPIsingle*/
578  int org_isite1,
579  int org_ispin1,
580  int org_isite3,
581  int org_ispin3,
582  int org_ispin4,
583  std::complex<double> tmp_J,
584  struct BindStruct *X,
585  int nstate, std::complex<double> **tmp_v0,
586  std::complex<double> **tmp_v1
587 ) {
588  long int off;
589  int origin;
590  std::complex<double> tmp_V;
591  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin4) {//cisaisciuais=0 && cisaiucisais=0
592  return;
593  }
594 
595  if (BitCheckGeneral(myrank, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow) == TRUE
596  && GetOffCompGeneralSpin((long int) myrank, org_isite3 + 1, org_ispin3, org_ispin4,
597  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
598  tmp_V = tmp_J;
599  else {
600  if (GetOffCompGeneralSpin((long int) myrank, org_isite3 + 1, org_ispin4, org_ispin3,
601  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
602  {
603  if (BitCheckGeneral((long int)off, org_isite1 + 1, org_ispin1, X->Def.SiteToBit,
604  X->Def.Tpow) == TRUE)
605  {
606  tmp_V = conj(tmp_J);
607  if(X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
608  }/*BitCheckGeneral(off, org_isite1 + 1, org_ispin1)*/
609  else return;
610  }/*GetOffCompGeneralSpin(myrank, org_isite3 + 1, org_ispin4, org_ispin3, &off)*/
611  else return;
612  }
613  origin = (int)off;
614  SendRecv_cv(origin, X->Check.idim_max*nstate, X->Check.idim_max*nstate, &tmp_v1[1][0], &v1buf[1][0]);
615 
616  zaxpy_long(X->Check.idim_max*nstate, tmp_V, &v1buf[1][0], &tmp_v0[1][0]);
617 }/*std::complex<double> X_GC_child_CisAisCjuAjv_GeneralSpin_MPIdouble*/
623  int org_isite1,
624  int org_ispin1,
625  int org_ispin2,
626  int org_isite3,
627  int org_ispin3,
628  std::complex<double> tmp_J,
629  struct BindStruct *X,
630  int nstate, std::complex<double> **tmp_v0,
631  std::complex<double> **tmp_v1
632 ) {
633  long int off;
634  int origin;
635  std::complex<double> tmp_V;
636 
637  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin3) {//cisaitcisais=0 && cisaiscitais=0
638  return;
639  }
640 
641  if (BitCheckGeneral(myrank, org_isite3 + 1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow) == TRUE
642  && GetOffCompGeneralSpin((long int) myrank, org_isite1 + 1, org_ispin2, org_ispin1, &off,
643  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
644  {
645  tmp_V = conj(tmp_J);
646  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
647  }
648  else if (GetOffCompGeneralSpin((long int) myrank, org_isite1 + 1, org_ispin1, org_ispin2,
649  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
650  {
651  if (BitCheckGeneral((long int)off, org_isite3 + 1, org_ispin3,
652  X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
653  tmp_V = tmp_J;
654  }
655  else return;
656  }
657  else return;
658 
659  origin = (int)off;
660 
661  SendRecv_cv(origin, X->Check.idim_max*nstate, X->Check.idim_max*nstate, &tmp_v1[1][0], &v1buf[1][0]);
662 
663  zaxpy_long(X->Check.idim_max*nstate, tmp_V, &v1buf[1][0], &tmp_v0[1][0]);
664 }/*std::complex<double> X_GC_child_CisAitCjuAju_GeneralSpin_MPIdouble*/
670  int org_isite1,
671  int org_ispin1,
672  int org_ispin2,
673  int org_isite3,
674  int org_ispin3,
675  int org_ispin4,
676  std::complex<double> tmp_J,
677  struct BindStruct *X,
678  int nstate, std::complex<double> **tmp_v0,
679  std::complex<double> **tmp_v1
680 ) {
681  long int tmp_off, off;
682  int origin, ihermite;
683  std::complex<double> tmp_V;
684 
685  ihermite = TRUE;
686 
687  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin4 &&
688  org_ispin2 == org_ispin3) { //cisaitcitais=cisais && cisaitcitais =cisais
689  X_GC_child_CisAis_GeneralSpin_MPIdouble(org_isite1, org_ispin1, tmp_J, X, nstate, tmp_v0, tmp_v1);
690  return;
691  }
692  //cisaitcisait
693  if (GetOffCompGeneralSpin((long int) myrank, org_isite1 + 1, org_ispin1, org_ispin2,
694  &tmp_off, X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
695 
696  if (GetOffCompGeneralSpin(tmp_off, org_isite3 + 1, org_ispin3, org_ispin4,
697  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
698 
699  tmp_V = tmp_J;
700  }
701  else ihermite = FALSE;
702  }
703  else {
704  ihermite = FALSE;
705  }
706 
707  if (ihermite == FALSE) {
708  if (GetOffCompGeneralSpin((long int) myrank, org_isite3 + 1, org_ispin4, org_ispin3, &tmp_off,
709  X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
710 
711  if (GetOffCompGeneralSpin(tmp_off, org_isite1 + 1, org_ispin2, org_ispin1, &off, X->Def.SiteToBit,
712  X->Def.Tpow) == TRUE) {
713  tmp_V = conj(tmp_J);
714  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
715  }
716  else return;
717  }
718  else return;
719  }
720 
721  origin = (int)off;
722 
723  SendRecv_cv(origin, X->Check.idim_max*nstate, X->Check.idim_max*nstate, &tmp_v1[1][0], &v1buf[1][0]);
724 
725  zaxpy_long(X->Check.idim_max*nstate, tmp_V, &v1buf[1][0], &tmp_v0[1][0]);
726 }/*std::complex<double> X_GC_child_CisAitCjuAjv_GeneralSpin_MPIdouble*/
732  int org_isite1,
733  int org_ispin1,
734  int org_isite3,
735  int org_ispin3,
736  std::complex<double> tmp_J,
737  struct BindStruct *X,
738  int nstate, std::complex<double> **tmp_v0,
739  std::complex<double> **tmp_v1
740 ) {
741  long int num1;
742  std::complex<double> tmp_V;
743 
744  num1 = BitCheckGeneral((long int) myrank, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
745 
746  if (num1 == TRUE) {
747  num1 = BitCheckGeneral((long int) myrank, org_isite3 + 1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow);
748  if (num1 == TRUE) {
749  tmp_V = tmp_J;
750  }
751  else return;
752  }
753  else return;
754 
755  zaxpy_long(X->Check.idim_max*nstate, tmp_V, &tmp_v1[1][0], &tmp_v0[1][0]);
756 }/*std::complex<double> X_GC_child_CisAisCjuAju_GeneralSpin_MPIdouble*/
762  int org_isite1,
763  int org_ispin1,
764  int org_ispin2,
765  std::complex<double> tmp_trans,
766  struct BindStruct *X,
767  int nstate, std::complex<double> **tmp_v0,
768  std::complex<double> **tmp_v1
769 ) {
770  long int off;
771  int origin;
772  std::complex<double> tmp_V;
773 
774  if (GetOffCompGeneralSpin((long int) myrank, org_isite1 + 1, org_ispin1, org_ispin2,
775  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
776  tmp_V = tmp_trans;
777  }
778  else if (GetOffCompGeneralSpin((long int) myrank,
779  org_isite1 + 1, org_ispin2, org_ispin1, &off,
780  X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
781  tmp_V = conj(tmp_trans);
782  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
783  }
784  else return;
785 
786  origin = (int)off;
787 
788  SendRecv_cv(origin, X->Check.idim_max*nstate, X->Check.idim_max*nstate, &tmp_v1[1][0], &v1buf[1][0]);
789 
790  zaxpy_long(X->Check.idim_max*nstate, tmp_V, &v1buf[1][0], &tmp_v0[1][0]);
791 }/*std::complex<double> X_GC_child_CisAit_GeneralSpin_MPIdouble*/
797  int org_isite1,
798  int org_ispin1,
799  std::complex<double> tmp_trans,
800  struct BindStruct *X,
801  int nstate, std::complex<double> **tmp_v0,
802  std::complex<double> **tmp_v1
803 ) {
804  long int num1;
805  std::complex<double> tmp_V;
806 
807  num1 = BitCheckGeneral((long int) myrank,
808  org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
809  if (num1 != 0) {
810  tmp_V = tmp_trans;
811  }
812  else return;
813 
814  zaxpy_long(X->Check.idim_max*nstate, tmp_V, &tmp_v1[1][0], &tmp_v0[1][0]);
815 }/*std::complex<double> X_GC_child_CisAis_GeneralSpin_MPIdouble*/
821  int org_isite1,
822  int org_ispin1,
823  std::complex<double> tmp_trans,
824  struct BindStruct *X,
825  int nstate, std::complex<double> **tmp_v0,
826  std::complex<double> **tmp_v1
827 ) {
828  long int num1;
829  std::complex<double> tmp_V;
830 
831  num1 = BitCheckGeneral((long int) myrank,
832  org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
833  if (num1 == 0) {
834  tmp_V = tmp_trans;
835  }
836  else return;
837 
838  zaxpy_long(X->Check.idim_max*nstate, tmp_V, &tmp_v1[1][0], &tmp_v0[1][0]);
839 }/*std::complex<double> X_GC_child_AisCis_GeneralSpin_MPIdouble*/
845  int org_isite1,
846  int org_ispin1,
847  int org_ispin2,
848  std::complex<double> tmp_trans,
849  struct BindStruct *X,
850  int nstate,
851  std::complex<double> **tmp_v0,
852  std::complex<double> **tmp_v1,
853  long int idim_max
854 )
855 {
856  long int off, j, tmp_off,idim_max_buf;
857  int origin, one = 1;
858  std::complex<double> tmp_V;
859 
860  if (GetOffCompGeneralSpin((long int) myrank, org_isite1 + 1, org_ispin1, org_ispin2,
861  &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
862  tmp_V = tmp_trans;
863  }
864  else if (GetOffCompGeneralSpin((long int) myrank,
865  org_isite1 + 1, org_ispin2, org_ispin1, &off,
866  X->Def.SiteToBit, X->Def.Tpow) == TRUE) {
867  tmp_V = conj(tmp_trans);
868  if (X->Large.mode == M_CORR || X->Large.mode ==M_CALCSPEC) tmp_V = 0.0;
869  }
870  else return;
871 
872  origin = (int) off;
873 
874  idim_max_buf = SendRecv_i(origin, idim_max);
875  SendRecv_iv(origin, idim_max + 1, idim_max_buf + 1, list_1_org, list_1buf_org);
876  SendRecv_cv(origin, idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
877 
878 #pragma omp parallel for default(none)\
879 firstprivate(X, tmp_V, idim_max_buf, list_1buf_org) private(j, tmp_off) \
880 shared (tmp_v0, tmp_v1, v1buf,nstate,one)
881  for (j = 1; j <= idim_max_buf; j++) {
883  zaxpy_(&nstate, &tmp_V, &v1buf[j][0], &one, &tmp_v0[tmp_off][0], &one);
884  }/*for (j = 1; j <= idim_max_buf; j++)*/
885 }/*std::complex<double> X_child_CisAit_GeneralSpin_MPIdouble*/
891  int org_isite1,
892  int org_ispin1,
893  int org_isite3,
894  int org_ispin3,
895  int org_ispin4,
896  std::complex<double> tmp_J,
897  struct BindStruct *X,
898  int nstate, std::complex<double> **tmp_v0,
899  std::complex<double> **tmp_v1
900 ){
901  long int off, j, num1;
902  int origin, isite, IniSpin, one = 1;
903  std::complex<double> tmp_V;
904 
905  if (GetOffCompGeneralSpin((long int)myrank,
906  org_isite3 + 1, org_ispin3, org_ispin4, &off,
907  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
908  {
909  tmp_V = tmp_J;
910  isite = org_isite1 + 1;
911  IniSpin = org_ispin1;
912  }
913  else if (GetOffCompGeneralSpin((long int)myrank,
914  org_isite3 + 1, org_ispin4, org_ispin3, &off,
915  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
916  {
917  tmp_V = conj(tmp_J);
918  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
919  isite = org_isite1 + 1;
920  IniSpin = org_ispin1;
921  }
922  else return;
923 
924  origin = (int)off;
925 
926  SendRecv_cv(origin, X->Check.idim_max*nstate, X->Check.idim_max*nstate, &tmp_v1[1][0], &v1buf[1][0]);
927 
928 #pragma omp parallel default(none) firstprivate(X, tmp_V, isite, IniSpin) \
929 private(j, num1) shared (tmp_v0, tmp_v1, v1buf,nstate,one)
930  {
931 #pragma omp for
932  for (j = 1; j <= X->Check.idim_max; j++) {
933  num1 = BitCheckGeneral(j - 1, isite, IniSpin, X->Def.SiteToBit, X->Def.Tpow);
934  if (num1 != 0) zaxpy_(&nstate, &tmp_V, &v1buf[j][0], &one, &tmp_v0[j][0], &one);
935  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
936  }/*End of parallel region*/
937 }/*std::complex<double> X_GC_child_CisAisCjuAjv_GeneralSpin_MPIsingle*/
943  int org_isite1,
944  int org_ispin1,
945  int org_ispin2,
946  int org_isite3,
947  int org_ispin3,
948  std::complex<double> tmp_J,
949  struct BindStruct *X,
950  int nstate, std::complex<double> **tmp_v0,
951  std::complex<double> **tmp_v1
952 ){
953  long int num1, j, off;
954  int isite, IniSpin, FinSpin, one = 1;
955  std::complex<double> tmp_V, dmv;
956 
957  num1 = BitCheckGeneral((long int)myrank,
958  org_isite3+1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow);
959  if(num1 != 0){
960  tmp_V = tmp_J;
961  isite = org_isite1 + 1;
962  IniSpin = org_ispin2;
963  FinSpin = org_ispin1;
964  }
965  else return;
966 
967 #pragma omp parallel default(none) \
968 firstprivate(X, tmp_V, isite, IniSpin, FinSpin) private(j, dmv, num1, off) \
969 shared (tmp_v0, tmp_v1, v1buf,nstate,one)
970  {
971 #pragma omp for
972  for (j = 1; j <= X->Check.idim_max; j++) {
973  if (GetOffCompGeneralSpin(j - 1, isite, IniSpin, FinSpin, &off,
974  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
975  {
976  dmv = tmp_V;
977  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[off + 1][0], &one);
978  }
979  else if (GetOffCompGeneralSpin(j - 1, isite, FinSpin, IniSpin, &off,
980  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
981  {
982  dmv = conj(tmp_V);
983  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[off + 1][0], &one);
984  }
985  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
986  }/*End of parallel region*/
987 }/*std::complex<double> X_GC_child_CisAitCjuAju_GeneralSpin_MPIsingle*/
993  int org_isite1,
994  int org_ispin1,
995  int org_ispin2,
996  int org_isite3,
997  int org_ispin3,
998  int org_ispin4,
999  std::complex<double> tmp_J,
1000  struct BindStruct *X,
1001  int nstate, std::complex<double> **tmp_v0,
1002  std::complex<double> **tmp_v1
1003 ){
1004  long int off, j;
1005  int origin, isite, IniSpin, FinSpin, one = 1;
1006  std::complex<double> tmp_V;
1007 
1008  if (GetOffCompGeneralSpin((long int)myrank,
1009  org_isite3 + 1, org_ispin3, org_ispin4, &off,
1010  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1011  {
1012  tmp_V = tmp_J;
1013  isite = org_isite1 + 1;
1014  IniSpin = org_ispin2;
1015  FinSpin = org_ispin1;
1016  }
1017  else if (GetOffCompGeneralSpin((long int)myrank,
1018  org_isite3 + 1, org_ispin4, org_ispin3, &off,
1019  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1020  {
1021  tmp_V = conj(tmp_J);
1022  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
1023  isite = org_isite1 + 1;
1024  IniSpin = org_ispin1;
1025  FinSpin = org_ispin2;
1026  }
1027  else return;
1028 
1029  origin = (int)off;
1030 
1031  SendRecv_cv(origin, X->Check.idim_max*nstate, X->Check.idim_max*nstate, &tmp_v1[1][0], &v1buf[1][0]);
1032 
1033 #pragma omp parallel default(none) \
1034 firstprivate(X, tmp_V, isite, IniSpin, FinSpin) private(j, off) \
1035  shared (tmp_v0, tmp_v1, v1buf,nstate,one)
1036  {
1037 #pragma omp for
1038  for (j = 1; j <= X->Check.idim_max; j++) {
1039  if (GetOffCompGeneralSpin(j - 1, isite, IniSpin, FinSpin, &off,
1040  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1041  {
1042  zaxpy_(&nstate, &tmp_V, &v1buf[j][0], &one, &tmp_v0[off + 1][0], &one);
1043  }
1044  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1045  }/*End of parallel region*/
1046 }/*std::complex<double> X_GC_child_CisAitCjuAjv_GeneralSpin_MPIsingle*/
1052  int org_isite1,
1053  int org_ispin1,
1054  int org_isite3,
1055  int org_ispin3,
1056  std::complex<double> tmp_J,
1057  struct BindStruct *X,
1058  int nstate, std::complex<double> **tmp_v0,
1059  std::complex<double> **tmp_v1
1060 ){
1061  long int j, num1;
1062  std::complex<double> tmp_V, dmv;
1063  int one = 1;
1064 
1065  num1 = BitCheckGeneral((long int)myrank, org_isite3+1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow);
1066  if (num1 != FALSE) {
1067  tmp_V = tmp_J;
1068  }
1069  else return;
1070 
1071 #pragma omp parallel default(none) \
1072 firstprivate(X, tmp_V, org_isite1, org_ispin1) private(j, dmv, num1) \
1073  shared (tmp_v0, tmp_v1,nstate,one)
1074  {
1075 #pragma omp for
1076  for (j = 1; j <= X->Check.idim_max; j++) {
1077  num1 = BitCheckGeneral(j - 1, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1078 
1079  dmv = tmp_V * (std::complex<double>)num1;
1080  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[j][0], &one);
1081  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1082  }/*End of parallel region*/
1083 }/*std::complex<double> X_GC_child_CisAisCjuAju_GeneralSpin_MPIsingle*/
1089  int org_isite1,
1090  int org_ispin1,
1091  int org_ispin2,
1092  int org_isite3,
1093  int org_ispin3,
1094  int org_ispin4,
1095  std::complex<double> tmp_J,
1096  struct BindStruct *X,
1097  int nstate, std::complex<double> **tmp_v0,
1098  std::complex<double> **tmp_v1
1099 ){
1100  long int tmp_off, off, j, idim_max_buf;
1101  int origin, one = 1;
1102  std::complex<double> tmp_V;
1103  int ihermite=TRUE;
1104 
1105  if (GetOffCompGeneralSpin((long int)myrank, org_isite1 + 1, org_ispin1, org_ispin2, &tmp_off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1106  {
1107  if (GetOffCompGeneralSpin(tmp_off, org_isite3 + 1, org_ispin3, org_ispin4, &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1108  {
1109  tmp_V = tmp_J;
1110  }
1111  else{
1112  ihermite =FALSE;
1113  }
1114  }
1115  else{
1116  ihermite=FALSE;
1117  }
1118 
1119  if (ihermite == FALSE) {
1120  if (GetOffCompGeneralSpin((long int)myrank, org_isite3 + 1, org_ispin4, org_ispin3, &tmp_off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1121  {
1122  if (GetOffCompGeneralSpin(tmp_off, org_isite1 + 1, org_ispin2, org_ispin1, &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1123  {
1124  tmp_V = conj(tmp_J);
1125  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) {
1126  tmp_V = 0.0;
1127  }
1128  }
1129  else return;
1130  }
1131  else return;
1132  }
1133 
1134  origin = (int)off;
1135 
1136  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
1137  SendRecv_iv(origin, X->Check.idim_max + 1, idim_max_buf + 1, list_1, list_1buf);
1138  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
1139 
1140 #pragma omp parallel default(none) firstprivate(X, tmp_V, idim_max_buf) \
1141 private(j, off) shared (tmp_v0, tmp_v1, list_1buf, v1buf,nstate,one)
1142  {
1143 #pragma omp for
1144  for (j = 1; j <= idim_max_buf; j++) {
1146  zaxpy_(&nstate, &tmp_V, &v1buf[j][0], &one, &tmp_v0[off][0], &one);
1147  }/*for (j = 1; j <= idim_max_buf; j++)*/
1148  }/*End of parallel region*/
1149 }/*std::complex<double> X_child_CisAitCjuAjv_GeneralSpin_MPIdouble*/
1155  int org_isite1,
1156  int org_ispin1,
1157  int org_isite3,
1158  int org_ispin3,
1159  std::complex<double> tmp_J,
1160  struct BindStruct *X,
1161  int nstate, std::complex<double> **tmp_v0,
1162  std::complex<double> **tmp_v1
1163 ) {
1164  long int num1;
1165  std::complex<double> tmp_V;
1166 
1167  if (org_isite1 == org_isite3 && org_ispin1 == org_ispin3) {
1168  num1 = BitCheckGeneral((long int) myrank, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1169  if (num1 != FALSE) {
1170  tmp_V = tmp_J;
1171  }
1172  else {
1173  return;
1174  }
1175  }
1176  else {
1177  num1 = BitCheckGeneral((long int) myrank, org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1178  if (num1 != FALSE) {
1179  num1 = BitCheckGeneral((long int) myrank, org_isite3 + 1, org_ispin3, X->Def.SiteToBit,
1180  X->Def.Tpow);
1181  if (num1 != FALSE) {
1182  tmp_V = tmp_J;
1183  }
1184  else {
1185  return;
1186  }
1187  }
1188  else {
1189  return;
1190  }
1191  }
1192 
1193  zaxpy_long(X->Check.idim_max*nstate, tmp_V, &tmp_v1[1][0], &tmp_v0[1][0]);
1194 }/*std::complex<double> X_child_CisAisCjuAju_GeneralSpin_MPIdouble*/
1200  int org_isite1,
1201  int org_ispin1,
1202  int org_isite3,
1203  int org_ispin3,
1204  std::complex<double> tmp_J,
1205  struct BindStruct *X,
1206  int nstate, std::complex<double> **tmp_v0,
1207  std::complex<double> **tmp_v1
1208 )
1209 {
1210  long int j, num1;
1211  std::complex<double> tmp_V, dmv;
1212  int one = 1;
1213 
1214  num1 = BitCheckGeneral((long int) myrank, org_isite3 + 1, org_ispin3, X->Def.SiteToBit, X->Def.Tpow);
1215  if (num1 != FALSE) {
1216  tmp_V = tmp_J;
1217  }
1218  else return;
1219 
1220 #pragma omp parallel default(none) \
1221 firstprivate(X, tmp_V, org_isite1, org_ispin1) private(j, dmv, num1) \
1222  shared (tmp_v0, tmp_v1, list_1,nstate,one)
1223  {
1224 #pragma omp for
1225  for (j = 1; j <= X->Check.idim_max; j++) {
1226  num1 = BitCheckGeneral(list_1[j], org_isite1 + 1, org_ispin1, X->Def.SiteToBit, X->Def.Tpow);
1227 
1228  dmv = tmp_V * (std::complex<double>)num1;
1229  zaxpy_(&nstate, &dmv, &tmp_v1[j][0], &one, &tmp_v0[j][0], &one);
1230  }/*for (j = 1; j <= X->Check.idim_max; j++)*/
1231  }/*End of parallel region*/
1232 }/*std::complex<double> X_child_CisAisCjuAju_GeneralSpin_MPIsingle*/
1238  int org_isite1,
1239  int org_ispin1,
1240  int org_ispin2,
1241  int org_isite3,
1242  int org_ispin3,
1243  int org_ispin4,
1244  std::complex<double> tmp_J,
1245  struct BindStruct *X,
1246  int nstate, std::complex<double> **tmp_v0,
1247  std::complex<double> **tmp_v1
1248 ){
1249  long int tmp_off, off, j, idim_max_buf;
1250  int origin, isite, IniSpin, FinSpin, one = 1;
1251  std::complex<double> tmp_V;
1252 
1253  if (GetOffCompGeneralSpin((long int)myrank,
1254  org_isite3 + 1, org_ispin3, org_ispin4, &off,
1255  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1256  {
1257  tmp_V = tmp_J;
1258  isite = org_isite1 + 1;
1259  IniSpin = org_ispin2;
1260  FinSpin = org_ispin1;
1261  }
1262  else if (GetOffCompGeneralSpin((long int)myrank,
1263  org_isite3 + 1, org_ispin4, org_ispin3, &off, X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1264  {
1265  tmp_V = conj(tmp_J);
1266  if (X->Large.mode == M_CORR || X->Large.mode == M_CALCSPEC) tmp_V = 0.0;
1267  isite = org_isite1 + 1;
1268  IniSpin = org_ispin1;
1269  FinSpin = org_ispin2;
1270  }
1271  else return;
1272 
1273  origin = (int)off;
1274 
1275  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
1276  SendRecv_iv(origin, X->Check.idim_max + 1, idim_max_buf + 1, list_1, list_1buf);
1277  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
1278 
1279 #pragma omp parallel default(none) \
1280 firstprivate(X, tmp_V, idim_max_buf, IniSpin, FinSpin, isite) \
1281 private(j, off, tmp_off) shared (tmp_v0, tmp_v1, list_1buf, v1buf,nstate,one)
1282  {
1283 #pragma omp for
1284  for (j = 1; j <= idim_max_buf; j++) {
1285 
1286  if (GetOffCompGeneralSpin(list_1buf[j], isite, IniSpin, FinSpin, &tmp_off,
1287  X->Def.SiteToBit, X->Def.Tpow) == TRUE)
1288  {
1289  ConvertToList1GeneralSpin(tmp_off, X->Check.sdim, &off);
1290  zaxpy_(&nstate, &tmp_V, &v1buf[j][0], &one, &tmp_v0[off][0], &one);
1291  }
1292  }/*for (j = 1; j <= idim_max_buf; j++)*/
1293  }/*End of parallel region*/
1294 }/*std::complex<double> X_child_CisAitCjuAjv_GeneralSpin_MPIsingle*/
1301  int org_isite1,
1302  int org_ispin1,
1303  int org_ispin2,
1304  std::complex<double> tmp_trans,
1305  struct BindStruct *X ,
1306  int nstate, std::complex<double> **tmp_v0 ,
1307  std::complex<double> **tmp_v1 )
1308 {
1309  int mask1, state1, origin;
1310  long int idim_max_buf;
1311  std::complex<double> trans;
1312 
1313  mask1 = (int)X->Def.Tpow[org_isite1];
1314  origin = myrank ^ mask1;
1315  state1 = (origin & mask1)/mask1;
1316 
1317  if(state1 == org_ispin2){
1318  trans = tmp_trans;
1319  }
1320  else if(state1 == org_ispin1) {
1321  trans = conj(tmp_trans);
1322  if(X->Large.mode == M_CORR|| X->Large.mode ==M_CALCSPEC){
1323  trans = 0.0;
1324  }
1325  }
1326  else{
1327  return;
1328  }
1329 
1330  idim_max_buf = SendRecv_i(origin, X->Check.idim_max);
1331  SendRecv_cv(origin, X->Check.idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
1332 
1333  zaxpy_long(X->Check.idim_max*nstate, trans, &v1buf[1][0], &tmp_v0[1][0]);
1334 }/*std::complex<double> X_GC_child_CisAit_spin_MPIdouble*/
1341  int org_isite1,
1342  int org_ispin2,
1343  std::complex<double> tmp_trans,
1344  struct BindStruct *X ,
1345  int nstate,
1346  std::complex<double> **tmp_v0 ,
1347  std::complex<double> **tmp_v1,
1348  long int idim_max
1349 ){
1350  int mask1, state1, origin, one = 1;
1351  long int idim_max_buf, j;
1352  long int tmp_off;
1353  std::complex<double> trans;
1354 
1355  mask1 = (int)X->Def.Tpow[org_isite1];
1356  origin = myrank ^ mask1;
1357  state1 = (origin & mask1)/mask1;
1358 
1359  if(state1 == org_ispin2){
1360  trans = tmp_trans;
1361  }
1362  else{
1363  trans =0.0;
1364  }
1365 
1366  // fprintf(stdout, "Debug: myrank=%d, origin=%d, trans=%lf\n", myrank, origin, trans);
1367 
1368  idim_max_buf = SendRecv_i(origin, idim_max);
1369  SendRecv_iv(origin, idim_max + 1, idim_max_buf + 1, list_1_org, list_1buf_org);
1370  SendRecv_cv(origin, idim_max*nstate, idim_max_buf*nstate, &tmp_v1[1][0], &v1buf[1][0]);
1371 
1372 #pragma omp parallel for default(none) private(j, tmp_off) \
1373 firstprivate(idim_max_buf, trans, X, list_1buf_org, list_2_1, list_2_2) \
1374 shared(v1buf, tmp_v0,nstate,one)
1375  for (j = 1; j <= idim_max_buf; j++) {
1376  GetOffComp(list_2_1, list_2_2, list_1buf_org[j], X->Large.irght, X->Large.ilft, X->Large.ihfbit, &tmp_off);
1377  zaxpy_(&nstate, &trans, &v1buf[j][0], &one, &tmp_v0[tmp_off][0], &one);
1378  }
1379 }/*std::complex<double> X_child_CisAit_spin_MPIdouble*/
1386  int org_isite1,
1387  int org_ispin1,
1388  std::complex<double> tmp_trans,
1389  struct BindStruct *X ,
1390  int nstate, std::complex<double> **tmp_v0 ,
1391  std::complex<double> **tmp_v1
1392 ){
1393  int mask1, ibit1;
1394  mask1 = (int)X->Def.Tpow[org_isite1];
1395  ibit1 = (((long int)myrank& mask1)/mask1)^(1-org_ispin1);
1396  if (ibit1 != 0)
1397  zaxpy_long(X->Check.idim_max*nstate, tmp_trans, &tmp_v1[1][0], &tmp_v0[1][0]);
1398 }/*std::complex<double> X_GC_child_CisAis_spin_MPIdouble*/
1405  int org_isite1,
1406  int org_ispin1,
1407  std::complex<double> tmp_trans,
1408  struct BindStruct *X ,
1409  int nstate, std::complex<double> **tmp_v0 ,
1410  std::complex<double> **tmp_v1
1411 ){
1412  int mask1;
1413  int ibit1;
1414  mask1 = (int)X->Def.Tpow[org_isite1];
1415  ibit1 = (((long int)myrank& mask1) / mask1) ^ (1 - org_ispin1);
1416 
1417  if (ibit1 == 0) {
1418  zaxpy_long(X->Check.idim_max*nstate, tmp_trans, &tmp_v1[1][0], &tmp_v0[1][0]);
1419  }/*if (ibit1 == 0)*/
1420 }/*std::complex<double> X_GC_child_AisCis_spin_MPIdouble*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
void X_GC_child_AisCis_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
int BitCheckGeneral(const long int org_bit, const int org_isite, const int target_ispin, const long int *SiteToBit, const long int *Tpow)
bit check function for general spin
Definition: bitcalc.cpp:392
long int * list_2_1
Definition: global.cpp:27
void X_child_CisAit_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int idim_max)
Compute term in the canonical general spin system when both site is in the inter process region...
long int * list_2_2
Definition: global.cpp:28
std::complex< double > ** v1buf
Definition: global.cpp:22
void X_GC_child_CisAisCjuAjv_spin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region.
void zaxpy_long(long int n, std::complex< double > a, std::complex< double > *x, std::complex< double > *y)
Wrapper of zaxpy.
Definition: mltply.cpp:128
void X_GC_child_CisAisCjuAju_spin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
int X_SpinGC_CisAis(long int j, long int is1_spin, long int sigma1)
Compute the grandcanonical spin state with bit mask is1_spin.
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
void X_GC_child_CisAitCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
void X_GC_child_CisAis_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
void X_GC_child_CisAitCiuAiv_spin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Exchange and Pairlifting term in Spin model + GC When only site2 is in the inter process region...
void X_GC_child_CisAitCjuAju_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
int ConvertToList1GeneralSpin(const long int org_ibit, const long int ihlfbit, long int *_ilist1Comp)
function of converting component to list_1
Definition: bitcalc.cpp:285
long int * list_1_org
Definition: global.cpp:31
void X_GC_child_CisAisCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
int mode
multiply or expectation value.
Definition: struct.hpp:331
void X_GC_child_CisAit_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
long int irght
Used for Ogata-Lin ???
Definition: struct.hpp:344
void X_child_CisAit_spin_MPIdouble(int org_isite1, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int idim_max)
Hopping term in Spin + Canonical for CalcSpectrum When both site1 and site2 are in the inter process ...
int ** InterAll_OffDiagonal
[DefineList::NinterAll_OffDiagonal][8] Interacted quartet
Definition: struct.hpp:161
long int SendRecv_i(int origin, long int isend)
Wrapper of MPI_Sendrecv for long integer number.
Definition: wrapperMPI.cpp:504
void GC_child_CisAitCjuAju_spin_MPIdouble(long int i_int, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Wrapper for calculating CisAitCjuAju term in Spin model + GC When both site1 and site2 are in the int...
void GC_child_CisAitCiuAiv_spin_MPIsingle(long int i_int, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Exchange and Pairlifting term in Spin model + GC When only site2 is in the inter process region...
long int * list_1buf
Definition: global.cpp:26
long int ilft
Used for Ogata-Lin ???
Definition: struct.hpp:345
Bind.
Definition: struct.hpp:394
int GetOffCompGeneralSpin(const long int org_ibit, const int org_isite, const int org_ispin, const int off_ispin, long int *_ioffComp, const long int *SiteToBit, const long int *Tpow)
function of getting off-diagonal component for general spin
Definition: bitcalc.cpp:243
void GC_child_CisAisCjuAjv_spin_MPIsingle(long int i_int, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Wrapper for CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region...
void X_GC_child_CisAitCiuAiv_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
term in Spin model + GC. When both site1 and site2 are in the inter process region.
int GetOffComp(long int *_list_2_1, long int *_list_2_2, long int _ibit, const long int _irght, const long int _ilft, const long int _ihfbit, long int *_ioffComp)
function of getting off-diagonal component
Definition: bitcalc.cpp:195
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
void X_GC_child_CisAisCjuAjv_spin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
void X_GC_child_CisAitCjuAju_spin_MPIsingle(int org_isite1, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region.
void X_GC_child_CisAis_spin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
void X_GC_child_CisAitCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
term in Spin model. When both site1 and site3 are in the inter process region.
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
void SendRecv_cv(int origin, long int nMsgS, long int nMsgR, std::complex< double > *vecs, std::complex< double > *vecr)
Wrapper of MPI_Sendrecv for std::complex<double> number. When we pass a message longer than 2^31-1 (m...
Definition: wrapperMPI.cpp:424
void GC_child_CisAitCiuAiv_spin_MPIdouble(long int i_int, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Exchange and Pairlifting term in Spin model + GC When both site1 and site2 are in the inter process r...
void X_child_CisAisCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the canonical general spin system when both sites are in the inter process region...
void X_GC_child_CisAisCjuAju_spin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the inter process region...
void X_GC_child_CisAitCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
void X_child_CisAisCjuAju_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the canonical general spin system when one of these sites is in the inter process re...
void GC_child_CisAitCjuAju_spin_MPIsingle(long int i_int, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Wrapper for CisAisCjuAjv term in Spin model + GC When only site2 is in the inter process region...
std::complex< double > * ParaInterAll_OffDiagonal
[DefineList::NInterAll_OffDiagonal] Coupling constant of off-diagonal inter-all term. malloc in setmem_def().
Definition: struct.hpp:170
void X_GC_child_CisAit_spin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.hpp:94
void X_GC_child_CisAitCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
void X_GC_child_CisAisCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when one of these site is in the inter proces...
int X_SpinGC_CisAit(long int j, long int is1_spin, long int sigma2, long int *tmp_off)
Compute index of final wavefunction by term (grandcanonical).
void SendRecv_iv(int origin, long int nMsgS, long int nMsgR, long int *vecs, long int *vecr)
Wrapper of MPI_Sendrecv for long integer number. When we pass a message longer than 2^31-1 (max of in...
Definition: wrapperMPI.cpp:465
void X_child_CisAitCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the canonical general spin system when both sites are in the inter process region...
long int * list_1buf_org
Definition: global.cpp:32
void X_GC_child_AisCis_spin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
void GC_child_CisAisCjuAjv_spin_MPIdouble(long int i_int, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Wrapper for calculating CisAisCjuAjv term in Spin model + GC When both site1 and site2 are in the int...
void X_child_CisAitCjuAjv_GeneralSpin_MPIsingle(int org_isite1, int org_ispin1, int org_ispin2, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the canonical general spin system when one of these sites is in the inter process re...
void X_GC_child_CisAisCjuAjv_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, int org_ispin4, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
term in Spin model. When both site1 and site3 are in the inter process region.
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
long int sdim
Dimension for Ogata-Lin ???
Definition: struct.hpp:309
long int * list_1
Definition: global.cpp:25
long int idim_max
The dimension of the Hilbert space of this process.
Definition: struct.hpp:305
void X_GC_child_CisAisCjuAju_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_isite3, int org_ispin3, std::complex< double > tmp_J, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...