HΦ  3.2.0
PairExHubbard.c File Reference
#include "bitcalc.h"
#include "wrapperMPI.h"
#include "mltplyCommon.h"
#include "mltplyHubbard.h"
#include "mltplyHubbardCore.h"
#include "mltplyMPIHubbard.h"
#include "mltplyMPIHubbardCore.h"
#include "common/setmemory.h"
+ Include dependency graph for PairExHubbard.c:

Go to the source code of this file.

Functions

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

Function Documentation

◆ GetPairExcitedStateHubbard()

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

Calculation of pair excited state for Hubbard canonical system

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

Definition at line 137 of file PairExHubbard.c.

References LargeList::A_spin, BindStruct::Check, child_general_hopp(), child_general_hopp_GetInfo(), BindStruct::Def, GetSplitBitByModel(), LargeList::i_max, DefineList::iCalcModel, CheckList::idim_maxOrg, DefineList::iFlagListModified, LargeList::ihfbit, LargeList::ilft, LargeList::irght, LargeList::isA_spin, BindStruct::Large, list_1, list_1_org, list_1buf_org, list_2_1, list_2_2, MaxMPI_li(), LargeList::mode, myrank, DefineList::NPairExcitationOperator, DefineList::Nsite, DefineList::OrgTpow, DefineList::PairExcitationOperator, DefineList::ParaPairExcitationOperator, DefineList::Tpow, TRUE, X_child_CisAjt_MPIdouble(), X_child_CisAjt_MPIsingle(), X_child_general_hopp_MPIdouble(), X_child_general_hopp_MPIsingle(), and X_CisAjt().

Referenced by GetPairExcitedState().

141  {
142  long unsigned int i,j, idim_maxMPI;
143  long unsigned int irght,ilft,ihfbit;
144  long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
145  long unsigned int tmp_off=0;
146 
147  double complex tmp_trans=0;
148  long int i_max;
149  int tmp_sgn, num1;
150  long int ibit;
151  long unsigned int is, Asum, Adiff;
152  long unsigned int ibitsite1, ibitsite2;
153 
154  // i_max = X->Check.idim_max;
155  i_max = X->Check.idim_maxOrg;
156  if(GetSplitBitByModel(X->Def.Nsite, X->Def.iCalcModel, &irght, &ilft, &ihfbit)!=0){
157  return -1;
158  }
159  X->Large.i_max = i_max;
160  X->Large.irght = irght;
161  X->Large.ilft = ilft;
162  X->Large.ihfbit = ihfbit;
163  X->Large.mode=M_CALCSPEC;
164 // X->Large.mode = M_MLTPLY;
165 
166  double complex *tmp_v1bufOrg;
167  //set size
168 #ifdef MPI
169  idim_maxMPI = MaxMPI_li(X->Check.idim_maxOrg);
170  tmp_v1bufOrg= cd_1d_allocate(idim_maxMPI + 1);
171 #endif // MPI
172 
173  for(i=0;i<X->Def.NPairExcitationOperator;i++){
174  org_isite1 = X->Def.PairExcitationOperator[i][0]+1;
175  org_isite2 = X->Def.PairExcitationOperator[i][2]+1;
176  org_sigma1 = X->Def.PairExcitationOperator[i][1];
177  org_sigma2 = X->Def.PairExcitationOperator[i][3];
178  tmp_trans = X->Def.ParaPairExcitationOperator[i];
179  ibitsite1 = X->Def.OrgTpow[2*org_isite1-2+org_sigma1] ;
180  ibitsite2 = X->Def.OrgTpow[2*org_isite2-2+org_sigma2] ;
181  child_general_hopp_GetInfo(X, org_isite1, org_isite2, org_sigma1, org_sigma2);
182  Asum = X->Large.isA_spin;
183  Adiff = X->Large.A_spin;
184 
185  if(X->Def.iFlagListModified == TRUE // Not to adopt HubbrdNConserved
186  && org_sigma1 != org_sigma2){
187  if (org_isite1 > X->Def.Nsite &&
188  org_isite2 > X->Def.Nsite)
189  {
190  X_child_CisAjt_MPIdouble(org_isite1-1, org_sigma1, org_isite2-1, org_sigma2, -tmp_trans, X, tmp_v0, tmp_v1, tmp_v1bufOrg, list_1_org, list_1buf_org, list_2_1, list_2_2);
191  }
192  else if (org_isite2 > X->Def.Nsite
193  || org_isite1 > X->Def.Nsite)
194  {
195  if(org_isite1 < org_isite2) {
196  X_child_CisAjt_MPIsingle(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2, -tmp_trans, X, tmp_v0,
197  tmp_v1, tmp_v1bufOrg, list_1_org, list_1buf_org, list_2_1, list_2_2);
198  } else{
199  X_child_CisAjt_MPIsingle(org_isite2 - 1, org_sigma2, org_isite1 - 1, org_sigma1, -conj(tmp_trans), X, tmp_v0,
200  tmp_v1, tmp_v1bufOrg, list_1_org, list_1buf_org, list_2_1, list_2_2); }
201  }
202  else{
203 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1,stdoutMPI) \
204  firstprivate(i_max, tmp_trans, Asum, Adiff, ibitsite1, ibitsite2, X, list_1_org, list_1, myrank) \
205  private(j, tmp_sgn, tmp_off)
206  for (j = 1; j <= i_max; j++){
207  tmp_sgn=X_CisAjt(list_1_org[j], X, ibitsite1, ibitsite2, Asum, Adiff, &tmp_off);
208  tmp_v0[tmp_off] += tmp_trans * tmp_sgn*tmp_v1[j];
209  }
210  }
211  }
212  else{
213  if (org_isite1 > X->Def.Nsite &&
214  org_isite2 > X->Def.Nsite) {
215  if(org_isite1==org_isite2 && org_sigma1==org_sigma2){//diagonal
216  is = X->Def.Tpow[2 * org_isite1 - 2 + org_sigma1];
217  ibit = (unsigned long int) myrank & is;
218  if( X->Def.PairExcitationOperator[i][4]==0) {
219  if (ibit != is) {
220 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1) \
221  firstprivate(i_max, tmp_trans) private(j)
222  for (j = 1; j <= i_max; j++) tmp_v0[j] += -tmp_trans * tmp_v1[j];
223  }
224  }
225  else{
226  if (ibit == is) {
227 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1) \
228  firstprivate(i_max, tmp_trans) private(j)
229  for (j = 1; j <= i_max; j++) tmp_v0[j] += tmp_trans * tmp_v1[j];
230  }
231  }
232  }
233  else{
234  X_child_general_hopp_MPIdouble(org_isite1-1, org_sigma1, org_isite2-1, org_sigma2, -tmp_trans, X, tmp_v0, tmp_v1);
235  }
236  }
237  else if (org_isite2 > X->Def.Nsite || org_isite1 > X->Def.Nsite){
238  if(org_isite1 < org_isite2){
239  X_child_general_hopp_MPIsingle(org_isite1-1, org_sigma1,org_isite2-1, org_sigma2, -tmp_trans, X, tmp_v0, tmp_v1);
240  }
241  else{
242  X_child_general_hopp_MPIsingle(org_isite2-1, org_sigma2, org_isite1-1, org_sigma1, -conj(tmp_trans), X, tmp_v0, tmp_v1);
243  }
244  }
245  else{
246  if(child_general_hopp_GetInfo( X,org_isite1,org_isite2,org_sigma1,org_sigma2)!=0){
247  return -1;
248  }
249  if(org_isite1==org_isite2 && org_sigma1==org_sigma2){
250  is = X->Def.Tpow[2 * org_isite1 - 2 + org_sigma1];
251  if( X->Def.PairExcitationOperator[i][4]==0) {
252 #pragma omp parallel for default(none) shared(list_1, tmp_v0, tmp_v1) firstprivate(i_max, is, tmp_trans) private(num1, ibit)
253  for (j = 1; j <= i_max; j++) {
254  ibit = list_1[j] & is;
255  num1 = (1-ibit / is);
256  tmp_v0[j] += -tmp_trans * num1 * tmp_v1[j];
257  }
258  }
259  else{
260 #pragma omp parallel for default(none) shared(list_1, tmp_v0, tmp_v1) firstprivate(i_max, is, tmp_trans) private(num1, ibit)
261  for (j = 1; j <= i_max; j++) {
262  ibit = list_1[j] & is;
263  num1 = ibit / is;
264  tmp_v0[j] += tmp_trans * num1 * tmp_v1[j];
265  }
266  }
267  }
268  else{
269  child_general_hopp(tmp_v0, tmp_v1,X,tmp_trans);
270  }
271  }
272  }
273  }
274 
275 #ifdef MPI
276  free_cd_1d_allocate(tmp_v1bufOrg);
277 #endif // MPI
278 
279  return TRUE;
280 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
long unsigned int ihfbit
Used for Ogata-Lin ???
Definition: struct.h:345
int X_CisAjt(long unsigned int list_1_j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int is2_spin, long unsigned int sum_spin, long unsigned int diff_spin, long unsigned int *tmp_off)
Compute index of wavefunction of final state.
int iFlagListModified
When the Hilbert space of excited state differs from the original one.
Definition: struct.h:217
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.h:412
int mode
multiply or expectation value.
Definition: struct.h:330
#define TRUE
Definition: global.h:26
long unsigned int * list_1buf_org
Definition: global.h:54
long unsigned int * OrgTpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:92
double complex X_child_CisAjt_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, double complex *v1buf, 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)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
double complex child_general_hopp(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, double complex trans)
Compute hopping (canonical)
long unsigned int A_spin
Mask used in the bit oeration.
Definition: struct.h:341
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
long unsigned int ilft
Used for Ogata-Lin ???
Definition: struct.h:344
double complex * ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:189
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.
Definition: bitcalc.c:78
long unsigned int * list_1_org
Definition: global.h:53
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_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...
long int i_max
Length of eigenvector.
Definition: struct.h:317
long unsigned int * list_1
Definition: global.h:47
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.
unsigned int NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.h:188
long unsigned int * list_2_2
Definition: global.h:50
double complex X_child_CisAjt_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, double complex *v1buf, 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)
Hopping term in Hubbard + MPI When both site1 and site2 are in the inter process region.
int ** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:186
long unsigned int isA_spin
Mask used in the bit oeration.
Definition: struct.h:346
long unsigned int irght
Used for Ogata-Lin ???
Definition: struct.h:343
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.h:198
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
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...
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:

◆ GetPairExcitedStateHubbardGC()

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

Calculation of pair excited state for Hubbard Grand canonical system

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

Definition at line 37 of file PairExHubbard.c.

References BindStruct::Check, child_general_hopp_GetInfo(), BindStruct::Def, GC_AisCis(), GC_child_general_hopp(), CheckList::idim_maxOrg, myrank, DefineList::NPairExcitationOperator, DefineList::Nsite, DefineList::PairExcitationOperator, DefineList::ParaPairExcitationOperator, DefineList::Tpow, TRUE, X_GC_child_general_hopp_MPIdouble(), and X_GC_child_general_hopp_MPIsingle().

Referenced by GetPairExcitedState().

42  {
43 
44  long unsigned int i,j;
45  long unsigned int isite1;
46  long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
47 
48  double complex tmp_trans=0;
49  long int i_max;
50  long int ibit;
51  long unsigned int is;
52  i_max = X->Check.idim_maxOrg;
53  for(i=0;i<X->Def.NPairExcitationOperator;i++) {
54  org_isite1 = X->Def.PairExcitationOperator[i][0] + 1;
55  org_isite2 = X->Def.PairExcitationOperator[i][2] + 1;
56  org_sigma1 = X->Def.PairExcitationOperator[i][1];
57  org_sigma2 = X->Def.PairExcitationOperator[i][3];
58  tmp_trans = X->Def.ParaPairExcitationOperator[i];
59 
60  if (org_isite1 > X->Def.Nsite &&
61  org_isite2 > X->Def.Nsite) {
62  if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2) {
63  if (X->Def.PairExcitationOperator[i][4] == 0) {
64  if (org_sigma1 == 0) {
65  is = X->Def.Tpow[2 * org_isite1 - 2];
66  }
67  else {
68  is = X->Def.Tpow[2 * org_isite1 - 1];
69  }
70  ibit = (unsigned long int) myrank & is;
71  if (ibit != is) {
72  //minus sign comes from negative tmp_trans due to readdef
73 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1) \
74  firstprivate(i_max, tmp_trans) private(j)
75  for (j = 1; j <= i_max; j++) tmp_v0[j] += -tmp_trans * tmp_v1[j];
76  }
77  }
78  else {//X->Def.PairExcitationOperator[i][4]==1
79  if (org_sigma1 == 0) {
80  is = X->Def.Tpow[2 * org_isite1 - 2];
81  }
82  else {
83  is = X->Def.Tpow[2 * org_isite1 - 1];
84  }
85  ibit = (unsigned long int) myrank & is;
86  if (ibit == is) {
87 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1) \
88  firstprivate(i_max, tmp_trans) private(j)
89  for (j = 1; j <= i_max; j++) tmp_v0[j] += tmp_trans * tmp_v1[j];
90  }
91  }
92  }
93  else {
94  X_GC_child_general_hopp_MPIdouble(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2, -tmp_trans, X,
95  tmp_v0, tmp_v1);
96  }
97  }
98  else if (org_isite2 > X->Def.Nsite || org_isite1 > X->Def.Nsite) {
99  if (org_isite1 < org_isite2) {
100  X_GC_child_general_hopp_MPIsingle(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2, -tmp_trans, X,
101  tmp_v0, tmp_v1);
102  }
103  else {
104  X_GC_child_general_hopp_MPIsingle(org_isite2 - 1, org_sigma2, org_isite1 - 1, org_sigma1,
105  -conj(tmp_trans), X, tmp_v0, tmp_v1);
106  }
107  }
108  else {
109 
110  if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2 && X->Def.PairExcitationOperator[i][4] == 0) {
111  isite1=X->Def.Tpow[2 * org_isite1 - 2 + org_sigma1];
112 #pragma omp parallel for default(none) private(j) firstprivate(i_max,X,isite1, tmp_trans) shared(tmp_v0, tmp_v1)
113  for(j=1;j<=i_max;j++){
114  GC_AisCis(j, tmp_v0, tmp_v1, X, isite1, -tmp_trans);
115  }
116  }
117  else {
118  if (child_general_hopp_GetInfo(X, org_isite1, org_isite2, org_sigma1, org_sigma2) != 0) {
119  return -1;
120  }
121  GC_child_general_hopp(tmp_v0, tmp_v1, X, tmp_trans);
122  }
123  }
124  }
125  return TRUE;
126 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
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.
#define TRUE
Definition: global.h:26
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.
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
double complex GC_AisCis(long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int is1_spin, double complex tmp_trans)
Operation of (Grandcanonical)
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.h:90
double complex * ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:189
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.
unsigned int NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.h:188
int ** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:186
double complex GC_child_general_hopp(double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, double complex trans)
Commpute hopping term (grandcanonical)
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
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: