161 #include "common/setmemory.h" 162 #include "mltplyCommon.h" 163 #include "mltplySpin.h" 164 #include "CalcTime.h" 165 #include "mltplySpinCore.h" 166 #include "mltplyHubbardCore.h" 167 #include "mltplyMPISpin.h" 168 #include "mltplyMPISpinCore.h" 169 #include "mltplyMPIBoost.h" 177 double complex *tmp_v0,
178 double complex *tmp_v1
194 double complex *tmp_v0,
195 double complex *tmp_v1
198 long unsigned int isite1, isite2, sigma1, sigma2;
199 long unsigned int sigma3, sigma4;
201 double complex dam_pr;
203 double complex tmp_V;
233 for (ihermite = 0; ihermite<2; ihermite++) {
301 double complex *tmp_v0,
302 double complex *tmp_v1
306 long unsigned int off = 0;
307 long unsigned int tmp_off = 0;
308 long unsigned int tmp_off2 = 0;
309 long unsigned int ihfbit=0;
310 long unsigned int isite1, isite2, sigma1, sigma2;
311 long unsigned int sigma3, sigma4;
313 double complex dam_pr;
316 double complex tmp_V;
317 double complex dmv=0;
320 long unsigned int i_max;
351 for (ihermite = 0; ihermite < 2; ihermite++) {
361 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 362 private(j, tmp_sgn, dmv, off, tmp_off, tmp_off2) \ 363 firstprivate(i_max, isite1, isite2, sigma1, sigma2, sigma3, sigma4, X, tmp_V, ihfbit) \ 364 shared(tmp_v0, tmp_v1, list_1, list_2_1, list_2_2) 365 for (j = 1; j <= i_max; j++) {
367 if (tmp_sgn ==
TRUE) {
369 if (tmp_sgn ==
TRUE) {
371 dmv = tmp_v1[j] * tmp_V;
375 dam_pr += conj(tmp_v1[off]) * dmv;
395 double complex *tmp_v0,
396 double complex *tmp_v1
404 if(iret != 0)
return iret;
418 double complex *tmp_v0,
419 double complex *tmp_v1
423 long unsigned int off = 0;
424 long unsigned int is1_spin = 0;
425 long unsigned int isite1, isite2, sigma1, sigma2;
426 long unsigned int sigma3, sigma4;
427 double complex dam_pr;
428 double complex tmp_trans;
431 double complex tmp_V;
434 long unsigned int i_max;
447 fprintf(stderr,
"Transverse_OffDiagonal component is illegal.\n");
461 for(ihermite=0; ihermite<2; ihermite++){
473 fprintf(stderr,
"Transverse_OffDiagonal component is illegal.\n");
478 is1_spin = X->
Def.
Tpow[isite1 - 1];
479 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 480 private(j, tmp_sgn) firstprivate(i_max, is1_spin, sigma2, X,off, tmp_trans) \ 481 shared(tmp_v0, tmp_v1) 482 for (j = 1; j <= i_max; j++) {
485 tmp_v0[off+1] += tmp_v1[j]*tmp_trans;
486 dam_pr += tmp_trans * conj(tmp_v1[off + 1]) * tmp_v1[j];
519 for (ihermite = 0; ihermite < 2; ihermite++) {
627 double complex *tmp_v0,
628 double complex *tmp_v1
632 long unsigned int off = 0;
633 long unsigned int tmp_off = 0;
634 long unsigned int isite1, isite2, sigma1, sigma2;
635 long unsigned int sigma3, sigma4;
636 double complex dam_pr;
637 double complex tmp_trans;
641 double complex tmp_V;
642 double complex dmv=0;
645 long unsigned int i_max;
661 if (isite1 == isite2) {
662 if (sigma1 != sigma2) {
665 isite1 - 1, sigma1, sigma2, tmp_trans, X, tmp_v0, tmp_v1);
669 for (ihermite = 0; ihermite<2; ihermite++) {
679 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 680 private(j, tmp_sgn, num1) firstprivate(i_max, isite1, sigma1, sigma2, X, off, tmp_trans) \ 681 shared(tmp_v0, tmp_v1) 682 for (j = 1; j <= i_max; j++) {
686 tmp_v0[off + 1] += tmp_v1[j] * tmp_trans;
687 dam_pr += conj(tmp_v1[off + 1]) * tmp_v1[j] * tmp_trans;
695 fprintf(stderr,
"Error: Transverse_Diagonal component must be absorbed !");
727 for (ihermite = 0; ihermite < 2; ihermite++) {
738 if (sigma1 == sigma2) {
739 if (sigma3 == sigma4) {
740 fprintf(stderr,
"InterAll_OffDiagonal component is illegal.\n");
745 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 746 private(j, tmp_sgn, dmv, off) \ 747 firstprivate(i_max, isite1, isite2, sigma1, sigma3, sigma4, X, tmp_V) \ 748 shared(tmp_v0, tmp_v1) 749 for (j = 1; j <= i_max; j++) {
752 if (tmp_sgn ==
TRUE) {
754 if (tmp_sgn ==
TRUE) {
755 dmv = tmp_v1[j] * tmp_V;
757 tmp_v0[off + 1] += dmv;
759 dam_pr += conj(tmp_v1[off + 1]) * dmv;
765 else if (sigma3 == sigma4) {
767 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 768 private(j, tmp_sgn, dmv, off, tmp_off) \ 769 firstprivate(i_max, isite1, isite2, sigma1, sigma2, sigma3, sigma4, X, tmp_V) \ 770 shared(tmp_v0, tmp_v1) 771 for (j = 1; j <= i_max; j++) {
773 if (tmp_sgn ==
TRUE) {
776 if (tmp_sgn ==
TRUE) {
777 dmv = tmp_v1[j] * tmp_V;
779 tmp_v0[off + 1] += dmv;
781 dam_pr += conj(tmp_v1[off + 1]) * dmv;
787 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 788 private(j, tmp_sgn, dmv, off, tmp_off) \ 789 firstprivate(i_max, isite1, isite2, sigma1, sigma2, sigma3, sigma4, X, tmp_V) \ 790 shared(tmp_v0, tmp_v1) 791 for (j = 1; j <= i_max; j++) {
794 if (tmp_sgn ==
TRUE) {
797 if (tmp_sgn ==
TRUE) {
798 dmv = tmp_v1[j] * tmp_V;
800 tmp_v0[off + 1] += dmv;
802 dam_pr += conj(tmp_v1[off + 1]) * dmv;
824 double complex *tmp_v0,
825 double complex *tmp_v1
830 double complex dam_pr;
833 double complex* tmp_v2;
834 double complex* tmp_v3;
837 long unsigned int i_max;
841 tmp_v2 = cd_1d_allocate(i_max+1);
842 tmp_v3 = cd_1d_allocate(i_max+1);
846 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 847 private(j) shared(tmp_v1,tmp_v0) firstprivate(i_max) 848 for(j=1;j<=i_max;j++)
849 dam_pr += conj(tmp_v1[j])*tmp_v0[j];
853 free_cd_1d_allocate(tmp_v2);
854 free_cd_1d_allocate(tmp_v3);
871 double complex *tmp_v0,
872 double complex *tmp_v1,
877 long unsigned int off = 0;
878 double complex dam_pr = 0;
880 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 881 firstprivate(i_max, X,off) private(j) shared(tmp_v0, tmp_v1) 882 for (j = 1; j <= i_max; j++)
893 double complex *tmp_v0,
894 double complex *tmp_v1,
899 long unsigned int off = 0;
900 double complex dam_pr = 0;
902 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 903 firstprivate(i_max, X,off) private(j) shared(tmp_v0, tmp_v1) 904 for (j = 1; j <= i_max; j++)
915 double complex *tmp_v0,
916 double complex *tmp_v1,
921 long unsigned int off = 0;
922 double complex dam_pr = 0;
924 #pragma omp parallel for default(none) reduction(+:dam_pr) \ 925 firstprivate(i_max, X,off) private(j) shared(tmp_v0, tmp_v1) 926 for (j = 1; j <= i_max; j++)
937 double complex *tmp_v0,
938 double complex *tmp_v1,
941 double complex dam_pr, tmp_V, dmv;
942 long unsigned int j, i_max;
943 long unsigned int org_sigma2, org_sigma4;
944 long unsigned int isA_up, isB_up;
945 long unsigned int tmp_off = 0;
956 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, tmp_sgn, dmv) \ 957 firstprivate(i_max,X,isA_up,isB_up,org_sigma2,org_sigma4,tmp_off,tmp_V) shared(tmp_v1, tmp_v0) 958 for (j = 1; j <= i_max; j++) {
961 dmv = tmp_v1[j] * tmp_sgn * tmp_V;
962 tmp_v0[tmp_off] += dmv;
963 dam_pr += conj(tmp_v1[tmp_off]) * dmv;
975 double complex *tmp_v0,
976 double complex *tmp_v1,
979 double complex dam_pr, tmp_V;
980 long unsigned int j, i_max;
981 long unsigned int org_isite1, org_isite2;
982 long unsigned int org_sigma1, org_sigma2, org_sigma3, org_sigma4;
983 long unsigned int isA_up, isB_up;
984 long unsigned int tmp_off = 0;
995 isA_up = X->
Def.
Tpow[org_isite1 - 1];
996 isB_up = X->
Def.
Tpow[org_isite2 - 1];
998 #pragma omp parallel default(none) reduction(+:dam_pr) \ 999 private(j) shared(tmp_v0, tmp_v1) \ 1000 firstprivate(i_max,X,isA_up,isB_up,org_sigma1,org_sigma2,org_sigma3,org_sigma4,tmp_off, tmp_V) 1002 if (org_sigma1 == org_sigma2 && org_sigma3 == org_sigma4) {
1004 for (j = 1; j <= i_max; j++)
1006 j, isA_up, isB_up, org_sigma2, org_sigma4, tmp_V, tmp_v0, tmp_v1, X);
1008 else if (org_sigma1 == org_sigma2 && org_sigma3 != org_sigma4) {
1010 for (j = 1; j <= i_max; j++)
1012 j, org_sigma2, org_sigma4, isA_up, isB_up, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
1014 else if (org_sigma1 != org_sigma2 && org_sigma3 == org_sigma4) {
1016 for (j = 1; j <= i_max; j++)
1018 j, org_sigma2, org_sigma4, isA_up, isB_up, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
1020 else if (org_sigma1 != org_sigma2 && org_sigma3 != org_sigma4) {
1022 for (j = 1; j <= i_max; j++)
1024 j, org_sigma2, org_sigma4, isA_up, isB_up, tmp_V, tmp_v0, tmp_v1, X, &tmp_off);
struct DefineList Def
Definision of system (Hamiltonian) etc.
void StartTimer(int n)
function for initializing elapse time [start]
double complex GC_child_exchange_spin(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute exchange term of spin Hamiltonian (grandcanonical)
int mltplyGeneralSpin(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Driver function for General Spin hamiltonian.
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 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_pairlift_spin(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute pair-lift term of spin Hamiltonian (grandcanonical)
unsigned long int idim_max
The dimension of the Hilbert space of this process.
int ** ExchangeCoupling
[DefineList::NExchangeCoupling][2] Index of exchange term. malloc in setmem_def().
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.
long unsigned int is2_up
Mask used in the bit oeration.
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.
double complex child_exchange_spin(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute exchange term of spin Hamiltonian (canonical)
long unsigned int is4_spin
Mask used in the bit oeration.
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.
void StopTimer(int n)
function for calculating elapse time [elapse time=StartTimer-StopTimer]
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.
int mltplySpinGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Driver function for Spin hamiltonian.
double complex prdct
The expectation value of the energy.
struct LargeList Large
Variables for Matrix-Vector product.
long unsigned int is1_spin
Mask used in the bit oeration.
int ConvertToList1GeneralSpin(const long unsigned int org_ibit, const long unsigned int ihlfbit, long unsigned int *_ilist1Comp)
function of converting component to list_1
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 ** EDGeneralTransfer
Index of transfer integrals for calculation. malloc in setmem_def(). Data Format [DefineList::NTransf...
double complex * ParaInterAll_OffDiagonal
[DefineList::NInterAll_OffDiagonal] Coupling constant of off-diagonal inter-all term. malloc in setmem_def().
unsigned int NPairLiftCoupling
Number of pair-lift term.
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 isite2
Is it realy used ???
int mode
multiply or expectation value.
unsigned int NInterAll_OffDiagonal
Number of interall term (off-diagonal)
void child_general_int_spin_MPIBoost(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1, double complex *tmp_v2, double complex *tmp_v3)
long unsigned int is3_spin
Mask used in the bit oeration.
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 ???
int child_pairlift_spin_GetInfo(int iPairLift, struct BindStruct *X)
Set parameters for the bit operation of spin-pairlift term.
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...
int mltplyHalfSpin(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Driver function for Spin 1/2 hamiltonian.
int mltplyHalfSpinGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Driver function for Spin 1/2 Hamiltonian (grandcanonical)
int ** PairLiftCoupling
[DefineList::NPairHopping][2] Index of pair-lift term. malloc in setmem_def().
double * ParaExchangeCoupling
[DefineList::NExchangeCoupling] Coupling constant of exchange term. malloc in setmem_def().
unsigned int Nsite
Number of sites in the INTRA process region.
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.
struct BoostList Boost
For Boost.
int child_exchange_spin_GetInfo(int iExchange, struct BindStruct *X)
Set parameters for the bit operation of spin-exchange term.
long unsigned int is1_up
Mask used in the bit oeration.
double complex * EDParaGeneralTransfer
Value of general transfer integrals by a def file. malloc in setmem_def(). Data Format [DefineList::N...
double * ParaPairLiftCoupling
[DefineList::NPairHopping] Coupling constant of pair-lift term. malloc in setmem_def().
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
long int i_max
Length of eigenvector.
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.
int mltplyGeneralSpinGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Driver function for General Spin hamiltonian (grandcanonical)
unsigned int NExchangeCoupling
Number of exchange term.
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
long unsigned int * list_1
double complex child_general_int_spin(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute Inter-All term of spin Hamiltonian (canonical)
int mltplySpinGCBoost(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Driver function for Spin hamiltonian (Boost)
long unsigned int is2_spin
Mask used in the bit oeration.
int child_general_hopp_GetInfo(struct BindStruct *X, unsigned long int isite1, unsigned long int isite2, unsigned long int sigma1, unsigned long int sigma2)
Compute mask for bit operation of hopping term.
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
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...
double complex tmp_V
Coupling constant.
double complex GC_child_general_int_spin(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
Compute Inter-All term of spin Hamiltonian (grandcanonical)
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
unsigned int EDNTransfer
Number of transfer integrals for calculation.
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.
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)
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
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 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 flgBoost
Flag whether use CMA algorithm.
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 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.
int mltplySpin(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Driver function for Spin hamiltonian.
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.
struct CheckList Check
Size of the Hilbert space.
int isite1
Is it realy used ???
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...