HPhi++  3.1.0
PairExHubbard.cpp File Reference
#include "bitcalc.hpp"
#include "wrapperMPI.hpp"
#include "mltplyCommon.hpp"
#include "mltplyHubbard.hpp"
#include "mltplyHubbardCore.hpp"
#include "mltplyMPIHubbard.hpp"
#include "mltplyMPIHubbardCore.hpp"
#include "common/setmemory.hpp"

Go to the source code of this file.

Functions

int GetPairExcitedStateHubbardGC (struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, int iEx)
 
int GetPairExcitedStateHubbard (struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, int iEx)
 

Function Documentation

◆ GetPairExcitedStateHubbard()

int GetPairExcitedStateHubbard ( struct BindStruct X,
int  nstate,
std::complex< double > **  tmp_v0,
std::complex< double > **  tmp_v1,
int  iEx 
)

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 133 of file PairExHubbard.cpp.

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, LargeList::mode, myrank, DefineList::NPairExcitationOperator, DefineList::Nsite, DefineList::OrgTpow, DefineList::PairExcitationOperator, DefineList::ParaPairExcitationOperator, DefineList::Tpow, X_child_CisAjt_MPIdouble(), X_child_CisAjt_MPIsingle(), X_child_general_hopp_MPIdouble(), X_child_general_hopp_MPIsingle(), X_CisAjt(), and zaxpy_long().

Referenced by GetPairExcitedState().

138  {
139  long int i, j;
140  long int irght, ilft, ihfbit;
141  long int org_isite1, org_isite2, org_sigma1, org_sigma2;
142  long int tmp_off = 0;
143 
144  std::complex<double> tmp_trans = 0, dmv;
145  long int i_max;
146  int tmp_sgn, num1, one = 1;
147  long int ibit;
148  long int is, Asum, Adiff;
149  long int ibitsite1, ibitsite2;
150 
151  // i_max = X->Check.idim_max;
152  i_max = X->Check.idim_maxOrg;
153  if (GetSplitBitByModel(X->Def.Nsite, X->Def.iCalcModel, &irght, &ilft, &ihfbit) != 0) {
154  return -1;
155  }
156  X->Large.i_max = i_max;
157  X->Large.irght = irght;
158  X->Large.ilft = ilft;
159  X->Large.ihfbit = ihfbit;
160  X->Large.mode = M_CALCSPEC;
161 
162  for (i = 0; i < X->Def.NPairExcitationOperator[iEx]; i++) {
163  org_isite1 = X->Def.PairExcitationOperator[iEx][i][0] + 1;
164  org_isite2 = X->Def.PairExcitationOperator[iEx][i][2] + 1;
165  org_sigma1 = X->Def.PairExcitationOperator[iEx][i][1];
166  org_sigma2 = X->Def.PairExcitationOperator[iEx][i][3];
167  tmp_trans = X->Def.ParaPairExcitationOperator[iEx][i];
168  ibitsite1 = X->Def.OrgTpow[2 * org_isite1 - 2 + org_sigma1];
169  ibitsite2 = X->Def.OrgTpow[2 * org_isite2 - 2 + org_sigma2];
170  child_general_hopp_GetInfo(X, org_isite1, org_isite2, org_sigma1, org_sigma2);
171  Asum = X->Large.isA_spin;
172  Adiff = X->Large.A_spin;
173 
174  if (X->Def.iFlagListModified == TRUE // Not to adopt HubbrdNConserved
175  && org_sigma1 != org_sigma2) {
176  if (org_isite1 > X->Def.Nsite &&
177  org_isite2 > X->Def.Nsite)
178  {
179  X_child_CisAjt_MPIdouble(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
180  -tmp_trans, X, nstate, tmp_v0, tmp_v1);
181  }
182  else if (org_isite2 > X->Def.Nsite
183  || org_isite1 > X->Def.Nsite)
184  {
185  if (org_isite1 < org_isite2) {
186  X_child_CisAjt_MPIsingle(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
187  -tmp_trans, X, nstate, tmp_v0, tmp_v1);
188  }
189  else {
190  X_child_CisAjt_MPIsingle(org_isite2 - 1, org_sigma2, org_isite1 - 1, org_sigma1,
191  -conj(tmp_trans), X, nstate, tmp_v0, tmp_v1);
192  }
193  }
194  else {
195 #pragma omp parallel for default(none) shared(tmp_v0,tmp_v1,one,nstate) \
196 firstprivate(i_max,tmp_trans,Asum,Adiff,ibitsite1,ibitsite2,X,list_1_org,list_1,myrank) \
197  private(j,tmp_sgn,tmp_off,dmv)
198  for (j = 1; j <= i_max; j++) {
199  tmp_sgn = X_CisAjt(list_1_org[j], X, ibitsite1, ibitsite2, Asum, Adiff, &tmp_off);
200  dmv = tmp_trans * (std::complex<double>)tmp_sgn;
201  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[tmp_off], &one);
202  }
203  }
204  }
205  else {
206  if (org_isite1 > X->Def.Nsite &&
207  org_isite2 > X->Def.Nsite) {
208  if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2) {//diagonal
209  is = X->Def.Tpow[2 * org_isite1 - 2 + org_sigma1];
210  ibit = (long int) myrank & is;
211  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
212  if (ibit != is) {
213  dmv = -tmp_trans;
214 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1,one,dmv,nstate) \
215 firstprivate(i_max, tmp_trans) private(j)
216  for (j = 1; j <= i_max; j++) {
217  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
218  }
219  }
220  }
221  else {
222  if (ibit == is) {
223  zaxpy_long(i_max*nstate, tmp_trans, &tmp_v1[1][0], &tmp_v0[1][0]);
224  }
225  }
226  }
227  else {
228  X_child_general_hopp_MPIdouble(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
229  -tmp_trans, X, nstate, tmp_v0, tmp_v1);
230  }
231  }
232  else if (org_isite2 > X->Def.Nsite || org_isite1 > X->Def.Nsite) {
233  if (org_isite1 < org_isite2) {
234  X_child_general_hopp_MPIsingle(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
235  -tmp_trans, X, nstate, tmp_v0, tmp_v1);
236  }
237  else {
238  X_child_general_hopp_MPIsingle(org_isite2 - 1, org_sigma2, org_isite1 - 1, org_sigma1,
239  -conj(tmp_trans), X, nstate, tmp_v0, tmp_v1);
240  }
241  }
242  else {
243  if (child_general_hopp_GetInfo(X, org_isite1, org_isite2, org_sigma1, org_sigma2) != 0) {
244  return -1;
245  }
246  if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2) {
247  is = X->Def.Tpow[2 * org_isite1 - 2 + org_sigma1];
248  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
249 #pragma omp parallel for default(none) shared(list_1,nstate,tmp_v0,tmp_v1,one) \
250 firstprivate(i_max,is,tmp_trans) private(num1,ibit,dmv)
251  for (j = 1; j <= i_max; j++) {
252  ibit = list_1[j] & is;
253  num1 = (1 - ibit / is);
254  dmv = -tmp_trans * (std::complex<double>)num1;
255  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
256  }
257  }
258  else {
259 #pragma omp parallel for default(none) shared(list_1,nstate,tmp_v0,tmp_v1,one) \
260  firstprivate(i_max,is,tmp_trans) private(num1,ibit,dmv)
261  for (j = 1; j <= i_max; j++) {
262  ibit = list_1[j] & is;
263  num1 = ibit / is;
264  dmv = tmp_trans * (std::complex<double>)num1;
265  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
266  }
267  }
268  }
269  else {
270  child_general_hopp(nstate, tmp_v0, tmp_v1, X, tmp_trans);
271  }
272  }
273  }
274  }
275  return TRUE;
276 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
int GetSplitBitByModel(const int Nsite, const int iCalcModel, long int *irght, long int *ilft, long int *ihfbit)
function of splitting original bit into right and left spaces.
Definition: bitcalc.cpp:78
void child_general_hopp(int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, std::complex< double > trans)
Compute hopping (canonical)
long int * OrgTpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:92
int iFlagListModified
When the Hilbert space of excited state differs from the original one.
Definition: struct.hpp:219
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
void zaxpy_long(long int n, std::complex< double > a, std::complex< double > *x, std::complex< double > *y)
Wrapper of zaxpy.
Definition: mltply.cpp:128
long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.hpp:307
struct LargeList Large
Variables for Matrix-Vector product.
Definition: struct.hpp:397
void X_child_CisAjt_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + MPI When both site1 and site2 are in the inter process region.
int * NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:190
long int * list_1_org
Definition: global.cpp:31
int mode
multiply or expectation value.
Definition: struct.hpp:331
long int irght
Used for Ogata-Lin ???
Definition: struct.hpp:344
std::complex< double > ** ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:191
long int A_spin
Mask used in the bit oeration.
Definition: struct.hpp:342
long int ilft
Used for Ogata-Lin ???
Definition: struct.hpp:345
void X_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
long int i_max
Length of eigenvector.
Definition: struct.hpp:318
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
int X_CisAjt(long int list_1_j, struct BindStruct *X, long int is1_spin, long int is2_spin, long int sum_spin, long int diff_spin, long int *tmp_off)
Compute index of wavefunction of final state.
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
int child_general_hopp_GetInfo(struct BindStruct *X, long int isite1, long int isite2, long int sigma1, long int sigma2)
Compute mask for bit operation of hopping term.
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
Definition: struct.hpp:200
long int isA_spin
Mask used in the bit oeration.
Definition: struct.hpp:347
void X_child_CisAjt_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When only site2 is in the inter process region...
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
void X_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard (Kondo) + Canonical ensemble When both site1 and site2 are in the inter proce...
long int * list_1
Definition: global.cpp:25
int *** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:187

◆ GetPairExcitedStateHubbardGC()

int GetPairExcitedStateHubbardGC ( struct BindStruct X,
int  nstate,
std::complex< double > **  tmp_v0,
std::complex< double > **  tmp_v1,
int  iEx 
)

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.cpp.

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, X_GC_child_general_hopp_MPIdouble(), X_GC_child_general_hopp_MPIsingle(), and zaxpy_long().

Referenced by GetPairExcitedState().

43  {
44  long int i, j;
45  long int isite1;
46  long int org_isite1, org_isite2, org_sigma1, org_sigma2;
47 
48  std::complex<double> tmp_trans = 0;
49  long int i_max;
50  long int ibit;
51  long int is;
52  i_max = X->Check.idim_maxOrg;
53  for (i = 0; i < X->Def.NPairExcitationOperator[iEx]; i++) {
54  org_isite1 = X->Def.PairExcitationOperator[iEx][i][0] + 1;
55  org_isite2 = X->Def.PairExcitationOperator[iEx][i][2] + 1;
56  org_sigma1 = X->Def.PairExcitationOperator[iEx][i][1];
57  org_sigma2 = X->Def.PairExcitationOperator[iEx][i][3];
58  tmp_trans = X->Def.ParaPairExcitationOperator[iEx][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[iEx][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 = (long int) myrank & is;
71  if (ibit != is) {
72  //minus sign comes from negative tmp_trans due to readdef
73  zaxpy_long(i_max*nstate, -tmp_trans, &tmp_v1[1][0], &tmp_v0[1][0]);
74  }
75  }
76  else {//X->Def.PairExcitationOperator[iEx][i][4]==1
77  if (org_sigma1 == 0) {
78  is = X->Def.Tpow[2 * org_isite1 - 2];
79  }
80  else {
81  is = X->Def.Tpow[2 * org_isite1 - 1];
82  }
83  ibit = (long int) myrank & is;
84  if (ibit == is) {
85  zaxpy_long(i_max*nstate, tmp_trans, &tmp_v1[1][0], &tmp_v0[1][0]);
86  }
87  }
88  }
89  else {
90  X_GC_child_general_hopp_MPIdouble(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
91  -tmp_trans, X, nstate, tmp_v0, tmp_v1);
92  }
93  }
94  else if (org_isite2 > X->Def.Nsite || org_isite1 > X->Def.Nsite) {
95  if (org_isite1 < org_isite2) {
96  X_GC_child_general_hopp_MPIsingle(org_isite1 - 1, org_sigma1, org_isite2 - 1, org_sigma2,
97  -tmp_trans, X, nstate, tmp_v0, tmp_v1);
98  }
99  else {
100  X_GC_child_general_hopp_MPIsingle(org_isite2 - 1, org_sigma2, org_isite1 - 1, org_sigma1,
101  -conj(tmp_trans), X, nstate, tmp_v0, tmp_v1);
102  }
103  }
104  else {
105 
106  if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2 && X->Def.PairExcitationOperator[iEx][i][4] == 0) {
107  isite1 = X->Def.Tpow[2 * org_isite1 - 2 + org_sigma1];
108 #pragma omp parallel for default(none) private(j) \
109 firstprivate(i_max,X,isite1, tmp_trans) shared(tmp_v0,tmp_v1,nstate)
110  for (j = 1; j <= i_max; j++) {
111  GC_AisCis(j, nstate, tmp_v0, tmp_v1, isite1, -tmp_trans);
112  }
113  }
114  else {
115  if (child_general_hopp_GetInfo(X, org_isite1, org_isite2, org_sigma1, org_sigma2) != 0) {
116  return -1;
117  }
118  GC_child_general_hopp(nstate, tmp_v0, tmp_v1, X, tmp_trans);
119  }
120  }
121  }
122  return TRUE;
123 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
void GC_AisCis(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int is1_spin, std::complex< double > tmp_trans)
Operation of (Grandcanonical)
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
void zaxpy_long(long int n, std::complex< double > a, std::complex< double > *x, std::complex< double > *y)
Wrapper of zaxpy.
Definition: mltply.cpp:128
long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.hpp:307
int * NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:190
std::complex< double > ** ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:191
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
int child_general_hopp_GetInfo(struct BindStruct *X, long int isite1, long int isite2, long int sigma1, long int sigma2)
Compute mask for bit operation of hopping term.
void GC_child_general_hopp(int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, struct BindStruct *X, std::complex< double > trans)
Commpute hopping term (grandcanonical)
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
void X_GC_child_general_hopp_MPIdouble(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + GC When both site1 and site2 are in the inter process region.
void X_GC_child_general_hopp_MPIsingle(int org_isite1, int org_ispin1, int org_isite2, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Hubbard + GC When only site2 is in the inter process region.
int *** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:187