17 #include "mltplyCommon.h" 21 #include "wrapperMPI.h" 22 #include "mltplyHubbard.h" 23 #include "mltplyHubbardCore.h" 24 #include "mltplySpinCore.h" 25 #include "mltplyMPIHubbard.h" 26 #include "mltplyMPISpinCore.h" 74 long unsigned int irght,ilft,ihfbit;
80 if(
X->Def.NCisAjt <1)
return 0;
82 i_max =
X->Check.idim_max;
86 X->Large.i_max = i_max;
87 X->Large.irght = irght;
89 X->Large.ihfbit = ihfbit;
90 X->Large.mode = M_CORR;
92 switch(
X->Def.iCalcType){
98 }
else if(
X->Def.St==1){
128 switch(
X->Def.iCalcModel){
161 if(
X->Def.iCalcType==Lanczos){
166 else if(
X->Def.iCalcType==TPQCalc){
169 else if(
X->Def.iCalcType==TimeEvolution){
172 }
else if(
X->Def.St==1){
189 long unsigned int i,j;
190 long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
191 double complex dam_pr=0;
194 long unsigned int is;
195 double complex tmp_OneGreen=1.0;
197 i_max =
X->Check.idim_max;
199 for(i=0;i<
X->Def.NCisAjt;i++){
200 org_isite1 =
X->Def.CisAjt[i][0]+1;
201 org_isite2 =
X->Def.CisAjt[i][2]+1;
202 org_sigma1 =
X->Def.CisAjt[i][1];
203 org_sigma2 =
X->Def.CisAjt[i][3];
205 if (org_isite1 >
X->Def.Nsite &&
206 org_isite2 >
X->Def.Nsite) {
207 if(org_isite1==org_isite2 && org_sigma1==org_sigma2){
209 is =
X->Def.Tpow[2 * org_isite1 - 2];
212 is =
X->Def.Tpow[2 * org_isite1 - 1];
214 ibit = (
unsigned long int)
myrank & is;
216 #pragma omp parallel for default(none) reduction(+:dam_pr) shared(vec) \ 217 firstprivate(i_max) private(j) 218 for (j = 1; j <= i_max; j++) dam_pr +=
vec[j]*conj(
vec[j]);
225 else if (org_isite2 >
X->Def.Nsite || org_isite1 >
X->Def.Nsite){
226 if(org_isite1<org_isite2){
231 dam_pr = conj(dam_pr);
242 fprintf(*_fp,
" %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1,org_sigma1,org_isite2-1,org_sigma2,creal(dam_pr),cimag(dam_pr));
258 long unsigned int i,j;
259 long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
260 double complex dam_pr=0;
264 long unsigned int is;
265 double complex tmp_OneGreen=1.0;
267 i_max =
X->Check.idim_max;
268 for(i=0;i<
X->Def.NCisAjt;i++){
269 org_isite1 =
X->Def.CisAjt[i][0]+1;
270 org_isite2 =
X->Def.CisAjt[i][2]+1;
271 org_sigma1 =
X->Def.CisAjt[i][1];
272 org_sigma2 =
X->Def.CisAjt[i][3];
275 if(
X->Def.iFlgSzConserved ==
TRUE){
276 if(org_sigma1 != org_sigma2){
278 fprintf(*_fp,
" %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1,org_sigma1,org_isite2-1,org_sigma2,creal(dam_pr),cimag(dam_pr));
283 if(
X->Def.iCalcModel==Kondo ||
X->Def.iCalcModel==KondoGC) {
284 if( (
X->Def.LocSpn[org_isite1 - 1] == 1 &&
X->Def.LocSpn[org_isite2 - 1] == 0) ||
285 (
X->Def.LocSpn[org_isite1 - 1] == 0 &&
X->Def.LocSpn[org_isite2 - 1] == 1)
289 fprintf(*_fp,
" %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1,org_sigma1,org_isite2-1,org_sigma2,creal(dam_pr),cimag(dam_pr));
294 if (org_isite1 >
X->Def.Nsite &&
295 org_isite2 >
X->Def.Nsite) {
296 if(org_isite1==org_isite2 && org_sigma1==org_sigma2){
298 is =
X->Def.Tpow[2 * org_isite1 - 2+org_sigma1];
299 ibit = (
unsigned long int)
myrank & is;
301 #pragma omp parallel for default(none) reduction(+:dam_pr) shared(vec) \ 302 firstprivate(i_max) private(j) 303 for (j = 1; j <= i_max; j++) dam_pr +=
vec[j]*conj(
vec[j]);
311 else if (org_isite2 >
X->Def.Nsite || org_isite1 >
X->Def.Nsite){
312 if(org_isite1 < org_isite2){
317 dam_pr = conj(dam_pr);
324 if(org_isite1==org_isite2 && org_sigma1==org_sigma2){
326 is =
X->Def.Tpow[2 * org_isite1 - 2 + org_sigma1];
328 #pragma omp parallel for default(none) shared(list_1, vec) reduction(+:dam_pr) firstprivate(i_max, is) private(num1, ibit) 329 for(j = 1;j <= i_max;j++){
332 dam_pr += num1*conj(
vec[j])*
vec[j];
341 fprintf(*_fp,
" %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1,org_sigma1,org_isite2-1,org_sigma2,creal(dam_pr),cimag(dam_pr));
357 if (
X->Def.iFlgGeneralSpin ==
FALSE) {
375 long unsigned int i,j;
376 long unsigned int isite1;
377 long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
378 double complex dam_pr=0;
381 long unsigned int is1_up;
383 i_max =
X->Check.idim_max;
385 for(i=0;i<
X->Def.NCisAjt;i++){
386 org_isite1 =
X->Def.CisAjt[i][0]+1;
387 org_isite2 =
X->Def.CisAjt[i][2]+1;
388 org_sigma1 =
X->Def.CisAjt[i][1];
389 org_sigma2 =
X->Def.CisAjt[i][3];
391 if(org_sigma1 == org_sigma2){
392 if(org_isite1==org_isite2){
393 if(org_isite1 >
X->Def.Nsite){
394 is1_up =
X->Def.Tpow[org_isite1 - 1];
398 #pragma omp parallel for reduction(+:dam_pr)default(none) shared(vec) \ 399 firstprivate(i_max) private(j) 400 for (j = 1; j <= i_max; j++) dam_pr += conj(
vec[j])*
vec[j];
404 isite1 =
X->Def.Tpow[org_isite1-1];
406 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max, isite1, org_sigma1, X) shared(vec) 407 for(j=1;j<=i_max;j++){
420 fprintf(*_fp,
" %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1, org_sigma1, org_isite2-1, org_sigma2, creal(dam_pr), cimag(dam_pr));
435 long unsigned int i,j;
436 long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
437 double complex dam_pr=0;
440 i_max =
X->Check.idim_max;
442 for(i=0;i<
X->Def.NCisAjt;i++){
443 org_isite1 =
X->Def.CisAjt[i][0]+1;
444 org_isite2 =
X->Def.CisAjt[i][2]+1;
445 org_sigma1 =
X->Def.CisAjt[i][1];
446 org_sigma2 =
X->Def.CisAjt[i][3];
448 if(org_isite1 == org_isite2){
449 if(org_isite1 >
X->Def.Nsite){
450 if(org_sigma1==org_sigma2){
453 org_isite1, org_sigma1,
X->Def.SiteToBit,
X->Def.Tpow);
456 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j) firstprivate(i_max, org_isite1, org_sigma1, X) shared(vec) 457 for(j=1;j<=i_max;j++){
458 dam_pr+=conj(
vec[j])*
vec[j];
466 if(org_sigma1==org_sigma2){
469 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max, org_isite1, org_sigma1, X) shared(vec, list_1) 470 for(j=1;j<=i_max;j++){
472 dam_pr+=conj(
vec[j])*
vec[j]*num1;
484 fprintf(*_fp,
" %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1, org_sigma1, org_isite2-1, org_sigma2,creal(dam_pr),cimag(dam_pr));
501 if (
X->Def.iFlgGeneralSpin ==
FALSE) {
519 long unsigned int i,j;
520 long unsigned int isite1;
521 long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
522 double complex dam_pr=0;
525 long unsigned int tmp_off=0;
527 i_max =
X->Check.idim_max;
529 for(i=0;i<
X->Def.NCisAjt;i++){
530 org_isite1 =
X->Def.CisAjt[i][0]+1;
531 org_isite2 =
X->Def.CisAjt[i][2]+1;
532 org_sigma1 =
X->Def.CisAjt[i][1];
533 org_sigma2 =
X->Def.CisAjt[i][3];
536 if(org_isite1 == org_isite2){
537 if(org_isite1 >
X->Def.Nsite){
538 if(org_sigma1==org_sigma2){
545 isite1 =
X->Def.Tpow[org_isite1-1];
547 if(org_sigma1==org_sigma2){
549 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, tmp_sgn) firstprivate(i_max, isite1, org_sigma1, X) shared(vec) 550 for(j=1;j<=i_max;j++){
555 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, tmp_sgn, tmp_off) firstprivate(i_max, isite1, org_sigma2, X) shared(vec) 556 for(j=1;j<=i_max;j++){
559 dam_pr += tmp_sgn*conj(
vec[tmp_off+1])*
vec[j];
570 fprintf(*_fp,
" %4ld %4ld %4ld %4ld %.10lf %.10lf\n",org_isite1-1, org_sigma1, org_isite2-1, org_sigma2,creal(dam_pr),cimag(dam_pr));
585 long unsigned int i, j;
586 long unsigned int org_isite1, org_isite2, org_sigma1, org_sigma2;
587 double complex dam_pr = 0;
589 long unsigned int tmp_off = 0;
592 i_max =
X->Check.idim_max;
594 for (i = 0; i <
X->Def.NCisAjt; i++) {
595 org_isite1 =
X->Def.CisAjt[i][0] + 1;
596 org_isite2 =
X->Def.CisAjt[i][2] + 1;
597 org_sigma1 =
X->Def.CisAjt[i][1];
598 org_sigma2 =
X->Def.CisAjt[i][3];
599 if (org_isite1 == org_isite2) {
600 if (org_isite1 >
X->Def.Nsite) {
601 if (org_sigma1 == org_sigma2) {
610 if (org_sigma1 == org_sigma2) {
613 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max, org_isite1, org_sigma1, X) shared(vec) 614 for (j = 1; j <= i_max; j++) {
615 num1 =
BitCheckGeneral(j - 1, org_isite1, org_sigma1,
X->Def.SiteToBit,
X->Def.Tpow);
616 dam_pr += conj(
vec[j]) *
vec[j] * num1;
621 #pragma omp parallel for default(none) reduction(+:dam_pr) private(j, num1) firstprivate(i_max, org_isite1, org_sigma1, org_sigma2, X,tmp_off) shared(vec) 622 for (j = 1; j <= i_max; j++) {
624 X->Def.SiteToBit,
X->Def.Tpow);
626 dam_pr += conj(
vec[tmp_off + 1]) *
vec[j] * num1;
636 fprintf(*_fp,
" %4ld %4ld %4ld %4ld %.10lf %.10lf\n", org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
637 creal(dam_pr), cimag(dam_pr));
const char * cFileName1BGreen_FullDiag
double complex X_GC_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard + GC When both site1 and site2 are in the inter process region.
int expec_cisajs_Hubbard(struct BindStruct *X, double complex *vec, FILE **_fp)
function of calculation for one body green's function for Hubbard model.
double complex X_GC_child_CisAis_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
double complex SumMPI_dc(double complex norm)
MPI wrapper function to obtain sum of Double complex across processes.
const char * cTPQExpecOneBodyGFinish
double complex X_GC_child_CisAis_spin_MPIdouble(int org_isite1, int org_ispin1, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
const char * cTEExpecOneBodyGFinish
const char * cLogLanczosExpecOneBodyGEnd
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 expec_cisajs_Spin(struct BindStruct *X, double complex *vec, FILE **_fp)
function of calculation for one body green's function for Spin model.
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.
int expec_cisajs_HubbardGC(struct BindStruct *X, double complex *vec, FILE **_fp)
function of calculation for one body green's function for Hubbard GC model.
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
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.
const char * cTPQExpecOneBodyGStart
const char * cCGExpecOneBodyGStart
const char * cLanczosExpecOneBodyGFinish
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...
double complex X_GC_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard + GC When only site2 is in the inter process region.
const char * cFileName1BGreen_TE
const char * cFileName1BGreen_TPQ
int expec_cisajs_SpinHalf(struct BindStruct *X, double complex *vec, FILE **_fp)
function of calculation for one body green's function for Half-Spin model.
int expec_cisajs_SpinGCHalf(struct BindStruct *X, double complex *vec, FILE **_fp)
function of calculation for one body green's function for Half-SpinGC model.
double complex child_general_hopp(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, double complex trans)
Compute hopping (canonical)
const char * cTEExpecOneBodyGStart
const char * cFileName1BGreen_CG
const char * cLanczosExpecOneBodyGStart
int expec_cisajs(struct BindStruct *X, double complex *vec)
function of calculation for one body green's function
const char * cLogLanczosExpecOneBodyGStart
int GetSplitBitByModel(const int Nsite, const int iCalcModel, long unsigned int *irght, long unsigned int *ilft, long unsigned int *ihfbit)
function of splitting original bit into right and left spaces.
double complex X_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
int expec_cisajs_SpinGCGeneral(struct BindStruct *X, double complex *vec, FILE **_fp)
function of calculation for one body green's function for General SpinGC model.
long unsigned int * list_1
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.
const char * cLogCGExpecOneBodyGEnd
const char * cFileNameTimeKeep
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
int expec_cisajs_SpinGC(struct BindStruct *X, double complex *vec, FILE **_fp)
function of calculation for one body green's function for SpinGC model.
int expec_cisajs_SpinGeneral(struct BindStruct *X, double complex *vec, FILE **_fp)
function of calculation for one body green's function for General-Spin model.
double complex GC_child_general_hopp(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, double complex trans)
Commpute hopping term (grandcanonical)
const char * cLogCGExpecOneBodyGStart
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
int X_SpinGC_CisAit(long unsigned int j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int sigma2, long unsigned int *tmp_off)
Compute index of final wavefunction by term (grandcanonical).
int myrank
Process ID, defined in InitializeMPI()
const char * cFileName1BGreen_Lanczos
double complex X_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, double complex tmp_trans, struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When both site1 and site2 are in the inter proce...
int TimeKeeperWithStep(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int istep)
Functions for writing a time log.
const char * cCGExpecOneBodyGFinish
int TimeKeeperWithRandAndStep(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int irand, const int istep)
Functions for writing a time log.
int TimeKeeper(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType)
Functions for writing a time log.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()