HPhi++  3.1.0
SingleExHubbard.cpp File Reference

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

#include "bitcalc.hpp"
#include "wrapperMPI.hpp"
#include "common/setmemory.hpp"
#include "mltplyHubbardCore.hpp"
#include "mltplyMPIHubbardCore.hpp"
#include "mltplyCommon.hpp"
#include "mpi.h"

Go to the source code of this file.

Functions

int GetSingleExcitedStateHubbard (struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, int iEx)
 Calculation of Single excited state for Hubbard canonical system. More...
 
int GetSingleExcitedStateHubbardGC (struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, int iEx)
 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.cpp.

Function Documentation

◆ GetSingleExcitedStateHubbard()

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

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 35 of file SingleExHubbard.cpp.

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

Referenced by GetSingleExcitedState().

41  {
42  long int idim_max;
43  long int i, j;
44  long int org_isite, ispin, itype;
45  long int is1_spin;
46  int isgn = 1, one = 1;
47  std::complex<double> tmpphi, dmv;
48  long int tmp_off = 0;
49  //tmp_v0
50  if (X->Def.NSingleExcitationOperator[iEx] == 0) {
51  return TRUE;
52  }
53 
54  idim_max = X->Check.idim_maxOrg;
55  for (i = 0; i < X->Def.NSingleExcitationOperator[iEx]; i++) {
56  org_isite = X->Def.SingleExcitationOperator[iEx][i][0];
57  ispin = X->Def.SingleExcitationOperator[iEx][i][1];
58  itype = X->Def.SingleExcitationOperator[iEx][i][2];
59  tmpphi = X->Def.ParaSingleExcitationOperator[iEx][i];
60  is1_spin = X->Def.Tpow[2 * org_isite + ispin];
61  if (itype == 1) {
62  if (org_isite >= X->Def.Nsite) {
63  X_Cis_MPI(org_isite, ispin, tmpphi, nstate, tmp_v0, tmp_v1, idim_max,
64  X->Def.Tpow,
65  X->Large.irght, X->Large.ilft, X->Large.ihfbit);
66  }
67  else {
68 #pragma omp parallel for default(none) shared(nstate,tmp_v0, tmp_v1, X, list_1_org,one) \
69 firstprivate(idim_max, tmpphi, org_isite, ispin, list_2_1, list_2_2, is1_spin) \
70 private(j, isgn,tmp_off,dmv)
71  for (j = 1; j <= idim_max; j++) {//idim_max -> original dimension
72  isgn = X_Cis(j, is1_spin, &tmp_off, list_1_org, list_2_1, list_2_2,
73  X->Large.irght, X->Large.ilft, X->Large.ihfbit);
74  dmv = (std::complex<double>)isgn * tmpphi;
75  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[tmp_off], &one);
76  }
77  }
78  }
79  else if (itype == 0) {
80  if (org_isite >= X->Def.Nsite) {
81  X_Ajt_MPI(org_isite, ispin, tmpphi, nstate, tmp_v0, tmp_v1,
82  idim_max, X->Def.Tpow, X->Large.irght, X->Large.ilft, X->Large.ihfbit);
83  }
84  else {
85 #pragma omp parallel for default(none) shared(tmp_v0,tmp_v1,X,list_1_org,list_1,one,nstate) \
86 firstprivate(idim_max,tmpphi,org_isite,ispin,list_2_1,list_2_2,is1_spin,myrank) \
87 private(j, isgn, tmp_off,dmv)
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,
90  X->Large.irght, X->Large.ilft, X->Large.ihfbit);
91  dmv = (std::complex<double>)isgn * tmpphi;
92  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[tmp_off], &one);
93  }
94  }
95  }
96  }
97  return TRUE;
98 }/*int GetSingleExcitedStateHubbard*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
long int * list_2_1
Definition: global.cpp:27
long int * list_2_2
Definition: global.cpp:28
void X_Cis_MPI(int org_isite, int org_ispin, std::complex< double > tmp_trans, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int idim_max, long int *Tpow, long int _irght, long int _ilft, long int _ihfbit)
Compute term of canonical Hubbard system.
std::complex< double > ** ParaSingleExcitationOperator
[DefineList::NSingleExcitationOperator] Coefficient of single excitaion operator for spectrum...
Definition: struct.hpp:184
int * NSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.hpp:183
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
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
long int * list_1_org
Definition: global.cpp:31
long int irght
Used for Ogata-Lin ???
Definition: struct.hpp:344
int X_Cis(long int j, long int is1_spin, long int *tmp_off, long int *list_1_org, long int *list_2_1_target, long int *list_2_2_target, long int _irght, long int _ilft, long int _ihfbit)
Compute index of final wavefunction associatesd to term of canonical Hubbard system.
long int ilft
Used for Ogata-Lin ???
Definition: struct.hpp:345
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
int X_Ajt(long int j, long int is1_spin, long int *tmp_off, long int *list_1_org, long int *list_2_1_target, long int *list_2_2_target, long int _irght, long int _ilft, long int _ihfbit)
Compute index of final wavefunction associatesd to term of canonical Hubbard system.
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
void X_Ajt_MPI(int org_isite, int org_ispin, std::complex< double > tmp_trans, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int idim_max, long int *Tpow, long int _irght, long int _ilft, long int _ihfbit)
Compute term of canonical Hubbard system.
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
int *** SingleExcitationOperator
[DefineList::NSingleExcitationOperator][3] Indices of single excitaion operator for spectrum...
Definition: struct.hpp:180

◆ GetSingleExcitedStateHubbardGC()

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

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 106 of file SingleExHubbard.cpp.

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

Referenced by GetSingleExcitedState().

112  {
113  long int idim_max;
114  long int i, j;
115  long int org_isite, ispin, itype;
116  long int is1_spin;
117  std::complex<double> tmpphi;
118  long int tmp_off = 0;
119  //idim_max = X->Check.idim_max;
120  idim_max = X->Check.idim_maxOrg;
121  //tmp_v0
122  if (X->Def.NSingleExcitationOperator[iEx] == 0) {
123  return TRUE;
124  }
125 
126  // SingleEx
127  for (i = 0; i < X->Def.NSingleExcitationOperator[iEx]; i++) {
128  org_isite = X->Def.SingleExcitationOperator[iEx][i][0];
129  ispin = X->Def.SingleExcitationOperator[iEx][i][1];
130  itype = X->Def.SingleExcitationOperator[iEx][i][2];
131  tmpphi = X->Def.ParaSingleExcitationOperator[iEx][i];
132  if (itype == 1) {
133  if (org_isite >= X->Def.Nsite) {
134  X_GC_Cis_MPI(org_isite, ispin, tmpphi, nstate, tmp_v0, tmp_v1,
135  idim_max, X->Def.Tpow);
136  }
137  else {
138 #pragma omp parallel for default(none) shared(tmp_v0,tmp_v1,X,nstate) \
139 firstprivate(idim_max, tmpphi, org_isite, ispin) private(j, is1_spin, tmp_off)
140  for (j = 1; j <= idim_max; j++) {
141  is1_spin = X->Def.Tpow[2 * org_isite + ispin];
142  GC_Cis(j, nstate, tmp_v0, tmp_v1, is1_spin, tmpphi, &tmp_off);
143  }/*for (j = 1; j <= idim_max; j++)*/
144  }
145  }
146  else if (itype == 0) {
147  if (org_isite >= X->Def.Nsite) {
148  X_GC_Ajt_MPI(org_isite, ispin, tmpphi, nstate, tmp_v0, tmp_v1,
149  idim_max, X->Def.Tpow);
150  }
151  else {
152 #pragma omp parallel for default(none) shared(tmp_v0,tmp_v1,X,nstate) \
153 firstprivate(idim_max, tmpphi, org_isite, ispin) private(j, is1_spin, tmp_off)
154  for (j = 1; j <= idim_max; j++) {
155  is1_spin = X->Def.Tpow[2 * org_isite + ispin];
156  GC_Ajt(j, nstate, tmp_v0, tmp_v1, is1_spin, tmpphi, &tmp_off);
157  }/*for (j = 1; j <= idim_max; j++)*/
158  }
159  }
160  }
161  return TRUE;
162 }/*int GetSingleExcitedStateHubbardGC*/
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
void X_GC_Ajt_MPI(int org_isite, int org_ispin, std::complex< double > tmp_trans, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int idim_max, long int *Tpow)
Single creation/annihilation operator in the inter process region for HubbardGC.
std::complex< double > ** ParaSingleExcitationOperator
[DefineList::NSingleExcitationOperator] Coefficient of single excitaion operator for spectrum...
Definition: struct.hpp:184
int * NSingleExcitationOperator
Number of single excitaion operator for spectrum.
Definition: struct.hpp:183
int Nsite
Number of sites in the INTRA process region.
Definition: struct.hpp:56
long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
Definition: struct.hpp:307
void GC_Ajt(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int is1_spin, std::complex< double > tmp_V, long int *tmp_off)
Compute term of grandcanonical Hubbard system.
void X_GC_Cis_MPI(int org_isite, int org_ispin, std::complex< double > tmp_trans, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int idim_max, long int *Tpow)
Single creation/annihilation operator in the inter process region for HubbardGC.
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
void GC_Cis(long int j, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int is1_spin, std::complex< double > tmp_V, long int *tmp_off)
Compute term of grandcanonical Hubbard system.
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
int *** SingleExcitationOperator
[DefineList::NSingleExcitationOperator][3] Indices of single excitaion operator for spectrum...
Definition: struct.hpp:180