22 #include "wrapperMPI.h"    23 #include "mltplyCommon.h"    24 #include "mltplySpinCore.h"    40   int isite1 = 
X->Def.ExchangeCoupling[iExchange][0] + 1;
    41   int isite2 = 
X->Def.ExchangeCoupling[iExchange][1] + 1;
    45   X->Large.tmp_J = 
X->Def.ParaExchangeCoupling[iExchange];
    50   X->Large.is1_up = 
X->Def.Tpow[isite1 - 1];
    51   X->Large.is2_up = 
X->Def.Tpow[isite2 - 1];
    55   X->Large.isA_spin = 
X->Large.is1_up + 
X->Large.is2_up;
    68   int isite1 = 
X->Def.PairLiftCoupling[iPairLift][0] + 1;
    69   int isite2 = 
X->Def.PairLiftCoupling[iPairLift][1] + 1;
    73   X->Large.tmp_J = 
X->Def.ParaPairLiftCoupling[iPairLift];
    78   X->Large.is1_up = 
X->Def.Tpow[isite1 - 1];
    79   X->Large.is2_up = 
X->Def.Tpow[isite2 - 1];
    83   X->Large.isA_spin = 
X->Large.is1_up + 
X->Large.is2_up;
    94   long unsigned int isite1,
    95   long unsigned int isite2,
    96   long unsigned int sigma1,
    97   long unsigned int sigma2,
    98   long unsigned int sigma3,
    99   long unsigned int sigma4,
   105   X->Large.tmp_V = tmp_V;
   106   X->Large.isite1 = isite1;
   107   X->Large.isite2 = isite2;
   112   X->Large.is1_up = 
X->Def.Tpow[isite1 - 1];
   113   X->Large.is2_up = 
X->Def.Tpow[isite2 - 1];
   118   X->Large.is1_spin = sigma1;
   119   X->Large.is2_spin = sigma2;
   120   X->Large.is3_spin = sigma3;
   121   X->Large.is4_spin = sigma4;
   142   long unsigned int is1_spin,
   143   long unsigned int sigma2,
   144   long unsigned int *list_1_Org_,
   145   long unsigned int *list_2_1_,
   146   long unsigned int *list_2_2_,
   147   long unsigned int *tmp_off
   149   long unsigned int list_1_j;
   150   long unsigned int off;
   151   list_1_j = list_1_Org_[j];
   153     GetOffComp(list_2_1_, list_2_2_, off, 
X->Large.irght, 
X->Large.ilft, 
X->Large.ihfbit, tmp_off);
   170   long unsigned int is1_spin,
   171   long unsigned int sigma1
   175   A_ibit_tmp = ((
list_1[j] & is1_spin) / is1_spin) ^ (1 - sigma1);
   187   long unsigned int is1_spin,
   188   long unsigned int sigma1
   191   long unsigned int list_1_j;
   194   A_ibit_tmp = ((list_1_j & is1_spin) / is1_spin) ^ (1 - sigma1);
   207   long unsigned int is1_spin,
   208   long unsigned int sigma2,
   209   long unsigned int *tmp_off
   211   long unsigned int list_1_j, ibit_tmp_1;
   215   ibit_tmp_1 = list_1_j & is1_spin;
   216   if (ibit_tmp_1 == 0 && sigma2 == 0) {    
   217     *tmp_off = list_1_j + is1_spin;
   220   else if (ibit_tmp_1 != 0 && sigma2 == 1) { 
   221     *tmp_off = list_1_j - is1_spin;
   243   long unsigned int isA_up,
   244   long unsigned int isB_up,
   245   long unsigned int sigmaA,
   246   long unsigned int sigmaB,
   247   long unsigned int *tmp_off
   249   long unsigned int iexchg, off;
   250   long unsigned int irght = 
X->Large.irght;
   251   long unsigned int ilft = 
X->Large.ilft;
   252   long unsigned int ihfbit = 
X->Large.ihfbit;
   253   long unsigned int ibit_tmp_A, ibit_tmp_B;
   255   ibit_tmp_A = ((
list_1[j] & isA_up) / isA_up);
   256   ibit_tmp_B = ((
list_1[j] & isB_up) / isB_up);
   257   if (ibit_tmp_A == sigmaA && ibit_tmp_B == sigmaB) {
   258     iexchg = 
list_1[j] ^ (isA_up + isB_up);
   276   double complex *tmp_v0,
   277   double complex *tmp_v1,
   279   long unsigned int *tmp_off
   281   long unsigned int off;
   283   long unsigned int iexchg;
   284   long unsigned int is_up = 
X->Large.isA_spin;
   285   long unsigned int irght = 
X->Large.irght;
   286   long unsigned int ilft = 
X->Large.ilft;
   287   long unsigned int ihfbit = 
X->Large.ihfbit;
   288   double complex tmp_J = 
X->Large.tmp_J;
   289   int mode = 
X->Large.mode;
   290   double complex dam_pr = 0;
   291   long unsigned int ibit_tmp;
   293   ibit_tmp = (
list_1[j] & is_up);
   294   if (ibit_tmp == 0 || ibit_tmp == is_up) {
   298     iexchg = 
list_1[j] ^ is_up;
   301     dmv = tmp_J * tmp_v1[j];
   302     if (mode == M_MLTPLY) {
   305     dam_pr += dmv * conj(tmp_v1[off]);
   317   double complex *tmp_v0,
   318   double complex *tmp_v1,
   320   long unsigned int *tmp_off
   323   long unsigned int is_up = 
X->Large.isA_spin;
   324   double complex tmp_J = 
X->Large.tmp_J;
   325   int mode = 
X->Large.mode;
   326   long unsigned int list_1_j, list_1_off;
   328   double complex dam_pr = 0;
   331   long unsigned int ibit_tmp;
   332   ibit_tmp = (list_1_j & is_up);
   333   if (ibit_tmp == 0 || ibit_tmp == is_up) {
   337     list_1_off = list_1_j ^ is_up;
   338     *tmp_off = list_1_off;
   339     dmv = tmp_J * tmp_v1[j];
   340     if (mode == M_MLTPLY) {
   341       tmp_v0[list_1_off + 1] += dmv;
   343     dam_pr += dmv * conj(tmp_v1[list_1_off + 1]);
   355   double complex *tmp_v0,
   356   double complex *tmp_v1,
   358   long unsigned int *tmp_off
   361   long unsigned int is_up = 
X->Large.isA_spin;
   362   double complex tmp_J = 
X->Large.tmp_J;
   363   int mode = 
X->Large.mode;
   364   double complex dam_pr = 0;
   365   long unsigned int list_1_off;
   366   long unsigned int list_1_j = j - 1;
   367   long unsigned int ibit_tmp;
   369   ibit_tmp = (list_1_j & is_up);
   370   if (ibit_tmp == 0 || ibit_tmp == is_up) {
   371     list_1_off = list_1_j ^ is_up; 
   372     *tmp_off = list_1_off;
   373     dmv = tmp_J * tmp_v1[j];
   374     if (mode == M_MLTPLY) {
   375       tmp_v0[list_1_off + 1] += dmv;
   377     dam_pr += dmv * conj(tmp_v1[list_1_off + 1]);
   394   long unsigned int isA_up,
   395   long unsigned int isB_up,
   396   long unsigned int org_sigma2,
   397   long unsigned int org_sigma4,
   398   double complex tmp_V,
   399   double complex *tmp_v0,
   400   double complex *tmp_v1,
   405   double complex dam_pr = 0;
   409   dmv = tmp_v1[j] * tmp_sgn * tmp_V;
   410   if (
X->Large.mode == M_MLTPLY || 
X->Large.mode == M_CALCSPEC) { 
   413   dam_pr = conj(tmp_v1[j]) * dmv;
   429   long unsigned int isA_up,
   430   long unsigned int isB_up,
   431   long unsigned int org_sigma2,
   432   long unsigned int org_sigma4,
   433   double complex tmp_V,
   434   double complex *tmp_v0,
   435   double complex *tmp_v1,
   439   double complex dmv = 0;
   440   double complex dam_pr = 0;
   445     dmv = tmp_v1[j] * tmp_sgn * tmp_V;
   446     if (
X->Large.mode == M_MLTPLY || 
X->Large.mode == M_CALCSPEC) { 
   449     dam_pr = conj(tmp_v1[j]) * dmv;
   462   long unsigned int org_sigma2,
   463   long unsigned int org_sigma4,
   464   long unsigned int isA_up,
   465   long unsigned int isB_up,
   466   double complex tmp_V,
   467   double complex *tmp_v0,
   468   double complex *tmp_v1,
   470   long unsigned int *tmp_off
   474   double complex dam_pr = 0 + 0 * I;
   479       dmv = tmp_v1[j] * tmp_sgn * tmp_V;
   480       if (
X->Large.mode == M_MLTPLY || 
X->Large.mode == M_CALCSPEC) { 
   481         tmp_v0[*tmp_off + 1] += dmv;
   483       dam_pr = conj(tmp_v1[*tmp_off + 1]) * dmv;
   497   long unsigned int org_sigma2,
   498   long unsigned int org_sigma4,
   499   long unsigned int isA_up,
   500   long unsigned int isB_up,
   501   double complex tmp_V,
   502   double complex *tmp_v0,
   503   double complex *tmp_v1,
   505   long unsigned int *tmp_off
   509   double complex dam_pr = 0 + 0 * I;
   514       dmv = tmp_v1[j] * tmp_sgn * tmp_V;
   515       if (
X->Large.mode == M_MLTPLY || 
X->Large.mode == M_CALCSPEC) { 
   516         tmp_v0[*tmp_off + 1] += dmv;
   518       dam_pr = conj(tmp_v1[*tmp_off + 1]) * dmv;
   532   long unsigned int org_sigma2,
   533   long unsigned int org_sigma4,
   534   long unsigned int isA_up,
   535   long unsigned int isB_up,
   536   double complex tmp_V,
   537   double complex *tmp_v0,
   538   double complex *tmp_v1,
   540   long unsigned int *tmp_off_2
   543   long unsigned int tmp_off_1;
   545   double complex dam_pr = 0 + 0 * I;
   548     tmp_sgn *= 
X_SpinGC_CisAit((tmp_off_1 + 1), 
X, isA_up, org_sigma2, tmp_off_2);
   550       dmv = tmp_v1[j] * tmp_sgn * tmp_V;
   551       if (
X->Large.mode == M_MLTPLY || 
X->Large.mode == M_CALCSPEC) { 
   552         tmp_v0[*tmp_off_2 + 1] += dmv;
   554       dam_pr = conj(tmp_v1[*tmp_off_2 + 1]) * dmv;
 double complex GC_child_exchange_spin_element(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Multiply Hamiltonian of exchange term of grandcanonical spin system. 
double complex GC_child_CisAitCiuAiu_spin_element(long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute  term of grandcanonical spsin system. 
double complex GC_child_CisAisCitAiu_spin_element(long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Compute  term of grandcanonical spsin system. 
int X_child_exchange_spin_element(long unsigned int j, struct BindStruct *X, long unsigned int isA_up, long unsigned int isB_up, long unsigned int sigmaA, long unsigned int sigmaB, long unsigned int *tmp_off)
Compute index of final wavefunction associated to spin-exchange term. 
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. 
double complex GC_child_CisAitCiuAiv_spin_element(long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off_2)
Compute  term of grandcanonical spsin system. 
int X_Spin_CisAis(long unsigned int j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int sigma1)
Compute the spin state with bit mask is1_spin. 
int child_general_int_spin_GetInfo(struct BindStruct *X, long unsigned int isite1, long unsigned int isite2, long unsigned int sigma1, long unsigned int sigma2, long unsigned int sigma3, long unsigned int sigma4, double complex tmp_V)
Set parameters for the bit operation of spin-general interaction term. 
int child_pairlift_spin_GetInfo(int iPairLift, struct BindStruct *X)
Set parameters for the bit operation of spin-pairlift term. 
double complex GC_child_CisAisCisAis_spin_element(long unsigned int j, long unsigned int isA_up, long unsigned int isB_up, long unsigned int org_sigma2, long unsigned int org_sigma4, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute  term of grandcanonical spsin system. 
int child_exchange_spin_GetInfo(int iExchange, struct BindStruct *X)
Set parameters for the bit operation of spin-exchange term. 
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 
double complex child_CisAisCisAis_spin_element(long unsigned int j, long unsigned int isA_up, long unsigned int isB_up, long unsigned int org_sigma2, long unsigned int org_sigma4, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute  term of canonical spsin system. 
int X_Spin_CisAit(long unsigned int j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int sigma2, long unsigned int *list_1_Org_, long unsigned int *list_2_1_, long unsigned int *list_2_2_, long unsigned int *tmp_off)
Compute index of final wavefunction by  term. 
long unsigned int * list_1
long unsigned int * list_2_2
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). 
double complex GC_child_pairlift_spin_element(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Multiply Hamiltonian of pairlift term of grandcanonical spin system. 
double complex child_exchange_spin_element(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
Multiply Hamiltonian of exchange term of canonical spin system.