HΦ  3.2.0
SingleExHubbard.c File Reference

Functions to compute singly excited state in Hubbard model. More...

#include "bitcalc.h"
#include "wrapperMPI.h"
#include "common/setmemory.h"
#include "mltplyHubbardCore.h"
#include "mltplyMPIHubbardCore.h"
#include "mpi.h"
+ Include dependency graph for SingleExHubbard.c:

Go to the source code of this file.

Functions

int GetSingleExcitedStateHubbard (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
 Calculation of Single excited state for Hubbard canonical system. More...
 
int GetSingleExcitedStateHubbardGC (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
 Calculation of Single excited state for Hubbard Grand canonical system. More...
 

Detailed Description

Functions to compute singly excited state in Hubbard model.

Definition in file SingleExHubbard.c.

Function Documentation

◆ GetSingleExcitedStateHubbard()

int GetSingleExcitedStateHubbard ( struct BindStruct X,
double complex *  tmp_v0,
double complex *  tmp_v1 
)

Calculation of Single excited state for Hubbard canonical system.

Returns
TRUE: Normally finished
FALSE: Abnormally finished
Author
Kazuyoshi Yoshimi
Version
1.2
Parameters
Xdefine list to get and put information of calculation
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 34 of file SingleExHubbard.c.

References BindStruct::Check, BindStruct::Def, CheckList::idim_maxOrg, LargeList::ihfbit, LargeList::ilft, LargeList::irght, BindStruct::Large, list_1_org, list_1buf_org, list_2_1, list_2_2, MaxMPI_li(), DefineList::NSingleExcitationOperator, DefineList::Nsite, DefineList::ParaSingleExcitationOperator, DefineList::SingleExcitationOperator, DefineList::Tpow, TRUE, X_Ajt(), X_Ajt_MPI(), X_Cis(), and X_Cis_MPI().

Referenced by GetSingleExcitedState().

38  {
39  long int idim_max, idim_maxMPI;
40  long unsigned int i, j;
41  long unsigned int org_isite, ispin, itype;
42  long unsigned int is1_spin;
43  int isgn = 1;
44  double complex tmpphi;
45  long unsigned int tmp_off = 0;
46  //tmp_v0
47  if (X->Def.NSingleExcitationOperator == 0) {
48  return TRUE;
49  }
50  double complex *tmp_v1bufOrg;
51  //set size
52 #ifdef MPI
53  idim_maxMPI = MaxMPI_li(X->Check.idim_maxOrg);
54  tmp_v1bufOrg=cd_1d_allocate(idim_maxMPI + 1);
55 #endif // MPI
56 
57  idim_max = X->Check.idim_maxOrg;
58  for (i = 0; i < X->Def.NSingleExcitationOperator; i++) {
59  org_isite = X->Def.SingleExcitationOperator[i][0];
60  ispin = X->Def.SingleExcitationOperator[i][1];
61  itype = X->Def.SingleExcitationOperator[i][2];
62  tmpphi = X->Def.ParaSingleExcitationOperator[i];
63  is1_spin = X->Def.Tpow[2 * org_isite + ispin];
64  if (itype == 1) {
65  if (org_isite >= X->Def.Nsite) {
66  X_Cis_MPI(org_isite, ispin, tmpphi, tmp_v0, tmp_v1, tmp_v1bufOrg, idim_max, \
68  X->Large.irght, X->Large.ilft, X->Large.ihfbit);
69  }
70  else {
71 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1, X, list_1_org) \
72  firstprivate(idim_max, tmpphi, org_isite, ispin, list_2_1, list_2_2, is1_spin) private(j, isgn,tmp_off)
73  for (j = 1; j <= idim_max; j++) {//idim_max -> original dimension
74  isgn = X_Cis(j, is1_spin, &tmp_off, list_1_org, list_2_1, list_2_2, X->Large.irght, X->Large.ilft, X->Large.ihfbit);
75  tmp_v0[tmp_off] += tmp_v1[j] * isgn*tmpphi;
76  }
77  }
78  }
79  else if (itype == 0) {
80  if (org_isite >= X->Def.Nsite) {
81  X_Ajt_MPI(org_isite, ispin, tmpphi, tmp_v0, tmp_v1, tmp_v1bufOrg, \
82  idim_max, X->Def.Tpow, list_1_org, list_1buf_org, \
84  }
85  else {
86 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1, X, list_1_org, list_1) \
87  firstprivate(idim_max, tmpphi, org_isite, ispin, list_2_1, list_2_2, is1_spin, myrank) private(j, isgn, tmp_off)
88  for (j = 1; j <= idim_max; j++) {//idim_max -> original dimension
89  isgn = X_Ajt(j, is1_spin, &tmp_off, list_1_org, list_2_1, list_2_2, X->Large.irght, X->Large.ilft, X->Large.ihfbit);
90  tmp_v0[tmp_off] += tmp_v1[j] * isgn*tmpphi;
91  }
92  }
93  }
94  }
95 #ifdef MPI
96  free_cd_1d_allocate(tmp_v1bufOrg);
97 #endif
98  return TRUE;
99 }/*int GetSingleExcitedStateHubbard*/
unsigned int NSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.h:182
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
long unsigned int ihfbit
Used for Ogata-Lin ???
Definition: struct.h:345
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
double complex X_Cis_MPI(int org_isite, unsigned int org_ispin, double complex tmp_trans, double complex *tmp_v0, double complex *tmp_v1, double complex *tmp_v1buf, unsigned long int idim_max, long unsigned int *Tpow, long unsigned int *list_1_org, long unsigned int *list_1buf_org, long unsigned int *list_2_1_target, long unsigned int *list_2_2_target, long unsigned int _irght, long unsigned int _ilft, long unsigned int _ihfbit)
Compute term of canonical Hubbard system.
#define TRUE
Definition: global.h:26
long unsigned int * list_1buf_org
Definition: global.h:54
double complex X_Ajt_MPI(int org_isite, unsigned int org_ispin, double complex tmp_trans, double complex *tmp_v0, double complex *tmp_v1, double complex *tmp_v1buf, unsigned long int idim_max, long unsigned int *Tpow, long unsigned int *list_1_org, long unsigned int *list_1buf_org, long unsigned int *list_2_1_target, long unsigned int *list_2_2_target, long unsigned int _irght, long unsigned int _ilft, long unsigned int _ihfbit)
Compute term of canonical Hubbard system.
unsigned long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.h:305
unsigned int Nsite
Number of sites in the INTRA process region.
Definition: struct.h:56
int X_Cis(long unsigned int j, long unsigned int is1_spin, long unsigned int *tmp_off, long unsigned int *list_1_org, long unsigned int *list_2_1_target, long unsigned int *list_2_2_target, long unsigned int _irght, long unsigned int _ilft, long unsigned int _ihfbit)
Compute index of final wavefunction associatesd to term of canonical Hubbard system.
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
long unsigned int ilft
Used for Ogata-Lin ???
Definition: struct.h:344
long unsigned int * list_1_org
Definition: global.h:53
int ** SingleExcitationOperator
[DefineList::NSingleExcitationOperator][3] Indices of single excitaion operator for spectrum...
Definition: struct.h:180
unsigned long int MaxMPI_li(unsigned long int idim)
MPI wrapper function to obtain maximum unsigned long integer across processes.
Definition: wrapperMPI.c:171
long unsigned int * list_2_1
Definition: global.h:49
double complex X_Ajt(long unsigned int j, long unsigned int is1_spin, long unsigned int *tmp_off, long unsigned int *list_1_org, long unsigned int *list_2_1_target, long unsigned int *list_2_2_target, long unsigned int _irght, long unsigned int _ilft, long unsigned int _ihfbit)
Compute index of final wavefunction associatesd to term of canonical Hubbard system.
long unsigned int * list_2_2
Definition: global.h:50
long unsigned int irght
Used for Ogata-Lin ???
Definition: struct.h:343
double complex * ParaSingleExcitationOperator
[DefineList::NSingleExcitationOperator] Coefficient of single excitaion operator for spectrum...
Definition: struct.h:183
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSingleExcitedStateHubbardGC()

int GetSingleExcitedStateHubbardGC ( struct BindStruct X,
double complex *  tmp_v0,
double complex *  tmp_v1 
)

Calculation of Single excited state for Hubbard Grand canonical system.

Returns
TRUE: Normally finished
FALSE: Abnormally finished
Author
Kazuyoshi Yoshimi
Version
1.2
Parameters
Xdefine list to get and put information of calculation
[out]tmp_v0Result v0 = H v1
[in]tmp_v1v0 = H v1

Definition at line 107 of file SingleExHubbard.c.

References BindStruct::Check, BindStruct::Def, GC_Ajt(), GC_Cis(), CheckList::idim_maxOrg, MaxMPI_li(), DefineList::NSingleExcitationOperator, DefineList::Nsite, DefineList::ParaSingleExcitationOperator, DefineList::SingleExcitationOperator, DefineList::Tpow, TRUE, X_GC_Ajt_MPI(), and X_GC_Cis_MPI().

Referenced by GetSingleExcitedState().

111  {
112  long int idim_max, idim_maxMPI;
113  long unsigned int i, j;
114  long unsigned int org_isite, ispin, itype;
115  long unsigned int is1_spin;
116  double complex tmpphi;
117  long unsigned int tmp_off = 0;
118  //idim_max = X->Check.idim_max;
119  idim_max = X->Check.idim_maxOrg;
120  //tmp_v0
121  if (X->Def.NSingleExcitationOperator == 0) {
122  return TRUE;
123  }
124  double complex *tmp_v1bufOrg;
125  //set size
126 #ifdef MPI
127  idim_maxMPI = MaxMPI_li(X->Check.idim_maxOrg);
128  tmp_v1bufOrg=cd_1d_allocate(idim_maxMPI + 1);
129 #endif // MPI
130 
131  // SingleEx
132  for (i = 0; i < X->Def.NSingleExcitationOperator; i++) {
133  org_isite = X->Def.SingleExcitationOperator[i][0];
134  ispin = X->Def.SingleExcitationOperator[i][1];
135  itype = X->Def.SingleExcitationOperator[i][2];
136  tmpphi = X->Def.ParaSingleExcitationOperator[i];
137  if (itype == 1) {
138  if (org_isite >= X->Def.Nsite) {
139  X_GC_Cis_MPI(org_isite, ispin, tmpphi, tmp_v0, tmp_v1, idim_max, tmp_v1bufOrg, X->Def.Tpow);
140  }
141  else {
142 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1, X) \
143  firstprivate(idim_max, tmpphi, org_isite, ispin) private(j, is1_spin, tmp_off)
144  for (j = 1; j <= idim_max; j++) {
145  is1_spin = X->Def.Tpow[2 * org_isite + ispin];
146  GC_Cis(j, tmp_v0, tmp_v1, is1_spin, tmpphi, &tmp_off);
147  }/*for (j = 1; j <= idim_max; j++)*/
148  }
149  }
150  else if (itype == 0) {
151  if (org_isite >= X->Def.Nsite) {
152  X_GC_Ajt_MPI(org_isite, ispin, tmpphi, tmp_v0, tmp_v1, idim_max, tmp_v1bufOrg, X->Def.Tpow);
153  }
154  else {
155 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1, X) \
156  firstprivate(idim_max, tmpphi, org_isite, ispin) private(j, is1_spin, tmp_off)
157  for (j = 1; j <= idim_max; j++) {
158  is1_spin = X->Def.Tpow[2 * org_isite + ispin];
159  GC_Ajt(j, tmp_v0, tmp_v1, is1_spin, tmpphi, &tmp_off);
160  }/*for (j = 1; j <= idim_max; j++)*/
161  }
162  }
163  }
164 #ifdef MPI
165  free_cd_1d_allocate(tmp_v1bufOrg);
166 #endif
167  return TRUE;
168 }/*int GetSingleExcitedStateHubbardGC*/
unsigned int NSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.h:182
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
double complex X_GC_Cis_MPI(int org_isite, int org_ispin, double complex tmp_trans, double complex *tmp_v0, double complex *tmp_v1, unsigned long int idim_max, double complex *tmp_v1buf, unsigned long int *Tpow)
Single creation/annihilation operator in the inter process region for HubbardGC.
#define TRUE
Definition: global.h:26
unsigned long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.h:305
unsigned int Nsite
Number of sites in the INTRA process region.
Definition: struct.h:56
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
double complex GC_Ajt(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, long unsigned int is1_spin, double complex tmp_V, long unsigned int *tmp_off)
Compute term of grandcanonical Hubbard system.
int ** SingleExcitationOperator
[DefineList::NSingleExcitationOperator][3] Indices of single excitaion operator for spectrum...
Definition: struct.h:180
unsigned long int MaxMPI_li(unsigned long int idim)
MPI wrapper function to obtain maximum unsigned long integer across processes.
Definition: wrapperMPI.c:171
double complex X_GC_Ajt_MPI(int org_isite, int org_ispin, double complex tmp_trans, double complex *tmp_v0, double complex *tmp_v1, unsigned long int idim_max, double complex *tmp_v1buf, unsigned long int *Tpow)
Single creation/annihilation operator in the inter process region for HubbardGC.
double complex GC_Cis(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, long unsigned int is1_spin, double complex tmp_V, long unsigned int *tmp_off)
Compute term of grandcanonical Hubbard system.
double complex * ParaSingleExcitationOperator
[DefineList::NSingleExcitationOperator] Coefficient of single excitaion operator for spectrum...
Definition: struct.h:183
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
+ Here is the call graph for this function:
+ Here is the caller graph for this function: