24 #include "mltplyCommon.h" 26 #include "wrapperMPI.h" 27 #include "mltplyMPISpin.h" 28 #include "mltplyMPISpinCore.h" 36 unsigned long int i_int,
38 double complex *tmp_v0,
39 double complex *tmp_v1
42 double complex dam_pr = 0;
70 double complex *tmp_v0,
71 double complex *tmp_v1
74 int mask1, mask2, state1, state2, ierr, origin;
75 unsigned long int idim_max_buf, j, ioff;
77 double complex Jint, dmv, dam_pr;
79 mask1 = (int)X->
Def.
Tpow[org_isite1];
80 mask2 = (
int)X->
Def.
Tpow[org_isite3];
81 origin =
myrank ^ (mask1 + mask2);
83 state1 = (origin & mask1) / mask1;
84 state2 = (origin & mask2) / mask2;
86 if (state1 == org_ispin2 && state2 == org_ispin4) {
89 else if (state1 == org_ispin1 && state2 == org_ispin3) {
97 ierr = MPI_Sendrecv(&X->
Check.
idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
98 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0, MPI_COMM_WORLD, &statusMPI);
101 list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0, MPI_COMM_WORLD, &statusMPI);
103 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
104 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0, MPI_COMM_WORLD, &statusMPI);
109 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv, ioff) \ 110 firstprivate(idim_max_buf, Jint, X) shared(list_2_1, list_2_2, list_1buf, v1buf, tmp_v1, tmp_v0) 111 for (j = 1; j <= idim_max_buf; j++) {
114 dmv = Jint *
v1buf[j];
116 dam_pr += conj(tmp_v1[ioff]) * dmv;
120 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv, ioff) \ 121 firstprivate(idim_max_buf, Jint, X) shared(list_2_1, list_2_2, list_1buf, v1buf, tmp_v1, tmp_v0) 122 for (j = 1; j <= idim_max_buf; j++) {
125 dmv = Jint *
v1buf[j];
126 dam_pr += conj(tmp_v1[ioff]) * dmv;
144 double complex *tmp_v0,
145 double complex *tmp_v1
148 int mask1, mask2, num1_up, num2_up, ierr, origin;
149 unsigned long int idim_max_buf, j, ioff, ibit_tmp;
150 MPI_Status statusMPI;
151 double complex dmv, dam_pr;
153 mask1 = (int)X->
Def.
Tpow[org_isite1];
154 mask2 = (
int)X->
Def.
Tpow[org_isite3];
155 if (mask1 == mask2) origin =
myrank ^ mask1;
156 else origin =
myrank ^ (mask1 + mask2);
157 num1_up = (origin & mask1) / mask1;
158 num2_up = (origin & mask2) / mask2;
160 ibit_tmp = (num1_up) ^ (num2_up);
161 if (ibit_tmp == 0)
return 0;
163 ierr = MPI_Sendrecv(&X->
Check.
idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
164 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
165 MPI_COMM_WORLD, &statusMPI);
168 list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
169 MPI_COMM_WORLD, &statusMPI);
171 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
172 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
173 MPI_COMM_WORLD, &statusMPI);
177 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv, ioff) \ 178 firstprivate(idim_max_buf, X) shared(list_2_1, list_2_2, list_1buf, v1buf, tmp_v1, tmp_v0) 179 for (j = 1; j <= idim_max_buf; j++) {
182 dmv = 0.5 *
v1buf[j];
183 dam_pr += conj(tmp_v1[ioff]) * dmv;
197 unsigned long int i_int,
199 double complex *tmp_v0,
200 double complex *tmp_v1
203 double complex dam_pr = 0;
229 double complex tmp_J,
231 double complex *tmp_v0,
232 double complex *tmp_v1
235 int mask2, state2, ierr, origin;
236 unsigned long int mask1, idim_max_buf, j, ioff, state1, jreal, state1check;
237 MPI_Status statusMPI;
238 double complex Jint, dmv, dam_pr;
242 mask2 = (int)X->
Def.
Tpow[org_isite3];
244 state2 = (origin & mask2) / mask2;
246 if (state2 == org_ispin4) {
247 state1check = (
unsigned long int) org_ispin2;
250 else if (state2 == org_ispin3) {
251 state1check = (
unsigned long int) org_ispin1;
259 ierr = MPI_Sendrecv(&X->
Check.
idim_max, 1, MPI_UNSIGNED_LONG, origin, 0,
260 &idim_max_buf, 1, MPI_UNSIGNED_LONG, origin, 0,
261 MPI_COMM_WORLD, &statusMPI);
264 list_1buf, idim_max_buf + 1, MPI_UNSIGNED_LONG, origin, 0,
265 MPI_COMM_WORLD, &statusMPI);
267 ierr = MPI_Sendrecv(tmp_v1, X->
Check.
idim_max + 1, MPI_DOUBLE_COMPLEX, origin, 0,
268 v1buf, idim_max_buf + 1, MPI_DOUBLE_COMPLEX, origin, 0,
269 MPI_COMM_WORLD, &statusMPI);
274 mask1 = X->
Def.
Tpow[org_isite1];
278 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv, ioff, jreal, state1) \ 279 firstprivate(idim_max_buf, Jint, X, mask1, state1check, org_isite1) \ 280 shared(list_2_1, list_2_2, list_1buf, v1buf, tmp_v1, tmp_v0) 281 for (j = 1; j <= idim_max_buf; j++) {
285 state1 = (jreal & mask1) / mask1;
286 if (state1 == state1check) {
290 dmv = Jint *
v1buf[j];
292 dam_pr += conj(tmp_v1[ioff]) * dmv;
297 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv, ioff, jreal, state1) \ 298 firstprivate(idim_max_buf, Jint, X, mask1, state1check, org_isite1) \ 299 shared(list_2_1, list_2_2, list_1buf, v1buf, tmp_v1, tmp_v0) 300 for (j = 1; j <= idim_max_buf; j++) {
304 state1 = (jreal & mask1) / mask1;
305 if (state1 == state1check) {
309 dmv = Jint *
v1buf[j];
310 dmv = 0.5 * v1buf[j];
311 dam_pr += conj(tmp_v1[ioff]) * dmv;
316 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, dmv, ioff, jreal, state1) \ 317 firstprivate(idim_max_buf, Jint, X, mask1, state1check, org_isite1) \ 318 shared(list_2_1, list_2_2, list_1buf, v1buf, tmp_v1, tmp_v0) 319 for (j = 1; j <= idim_max_buf; j++) {
323 state1 = (jreal & mask1) / mask1;
324 if (state1 == state1check) {
327 dmv = Jint *
v1buf[j];
328 dam_pr += conj(tmp_v1[ioff]) * dmv;
343 unsigned long int i_int,
345 double complex *tmp_v0,
346 double complex *tmp_v1
366 unsigned long int i_int,
368 double complex *tmp_v0,
369 double complex *tmp_v1
389 unsigned long int i_int,
391 double complex *tmp_v0,
392 double complex *tmp_v1
395 double complex dam_pr;
428 unsigned long int i_int,
430 double complex *tmp_v0,
431 double complex *tmp_v1
434 double complex dam_pr;
467 unsigned long int i_int,
469 double complex *tmp_v0,
470 double complex *tmp_v1
472 double complex dam_pr;
487 unsigned long int i_int,
489 double complex *tmp_v0,
490 double complex *tmp_v1
492 double complex dam_pr;
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.
struct DefineList Def
Definision of system (Hamiltonian) etc.
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...
void GC_child_general_int_spin_MPIsingle(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
General interaction term in the Spin model + GC When both site1 and site2 are in the inter process re...
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...
long unsigned int ihfbit
Used for Ogata-Lin ???
unsigned long int idim_max
The dimension of the Hilbert space of this process.
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 prdct
The expectation value of the energy.
long unsigned int * list_1buf
struct LargeList Large
Variables for Matrix-Vector product.
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...
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().
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.
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...
int ** InterAll_OffDiagonal
[DefineList::NinterAll_OffDiagonal][8] Interacted quartet
void child_general_int_GeneralSpin_MPIdouble(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
General interaction term in the Spin model + GC When both site1 and site2 are in the inter process re...
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().
long unsigned int ilft
Used for Ogata-Lin ???
long unsigned int * list_2_1
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
void GC_child_general_int_spin_MPIdouble(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
General interaction term in the Spin model + GC When both site1 and site2 are in the inter process re...
void child_general_int_spin_MPIdouble(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Exchange term in Spin model When both site1 and site2 are in the inter process region.
double complex X_child_general_int_spin_TotalS_MPIdouble(int org_isite1, int org_isite3, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Exchange term in Spin model When both site1 and site2 are in the inter process region.
long unsigned int * list_1
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...
void GC_child_general_int_GeneralSpin_MPIsingle(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
General interaction term in the Spin model + GC When both site1 and site2 are in the inter process re...
long unsigned int * list_2_2
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_general_int_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)
Exchange term in Spin model When both site1 and site2 are in the inter process region.
long unsigned int irght
Used for Ogata-Lin ???
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_child_general_int_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)
void child_general_int_spin_MPIsingle(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Exchange term in Spin model When only site2 is in the inter process region.
int myrank
Process ID, defined in InitializeMPI()
struct CheckList Check
Size of the Hilbert space.
void child_general_int_GeneralSpin_MPIsingle(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
General interaction term in the Spin model + GC When both site1 and site2 are in the inter process re...
void GC_child_general_int_GeneralSpin_MPIdouble(unsigned long int i_int, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
General interaction term in the Spin model + GC When both site1 and site2 are in the inter process re...