17 #include "PairExSpin.h" 19 #include "wrapperMPI.h" 20 #include "mltplyMPISpinCore.h" 21 #include "mltplySpinCore.h" 23 #include "common/setmemory.h" 37 double complex *tmp_v0,
38 double complex *tmp_v1
64 double complex *tmp_v0,
65 double complex *tmp_v1
68 long unsigned int i,j;
69 long unsigned int isite1;
70 long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
71 long unsigned int tmp_off=0;
73 double complex tmp_trans=0;
84 if(org_isite1 == org_isite2){
86 if(org_sigma1==org_sigma2){
99 isite1 = X->
Def.
Tpow[org_isite1-1];
100 if(org_sigma1==org_sigma2) {
103 #pragma omp parallel for default(none) private(j, tmp_sgn) firstprivate(i_max, isite1, org_sigma1, X,tmp_trans) shared(tmp_v0, tmp_v1) 104 for (j = 1; j <= i_max; j++) {
105 tmp_v0[j] += (1.0-
X_SpinGC_CisAis(j, X, isite1, org_sigma1)) * tmp_v1[j] * (-tmp_trans);
110 #pragma omp parallel for default(none) private(j, tmp_sgn) firstprivate(i_max, isite1, org_sigma1, X,tmp_trans) shared(tmp_v0, tmp_v1) 111 for (j = 1; j <= i_max; j++) {
112 tmp_v0[j] +=
X_SpinGC_CisAis(j, X, isite1, org_sigma1) * tmp_v1[j] * tmp_trans;
118 #pragma omp parallel for default(none) private(j, tmp_sgn, tmp_off) firstprivate(i_max, isite1, org_sigma2, X, tmp_trans) shared(tmp_v0, tmp_v1) 119 for(j=1;j<=i_max;j++){
122 tmp_v0[tmp_off+1]+= tmp_sgn*tmp_v1[j]*tmp_trans;
128 fprintf(
stdoutMPI,
"ERROR: hopping is not allowed in localized spin system\n");
146 double complex *tmp_v0,
147 double complex *tmp_v1
150 long unsigned int i, j;
152 long unsigned int org_isite1, org_isite2, org_sigma1, org_sigma2;
153 long unsigned int tmp_off = 0;
155 double complex tmp_trans = 0;
165 if(org_isite1 == org_isite2){
167 if(org_sigma1==org_sigma2){
181 if(org_sigma1==org_sigma2){
184 #pragma omp parallel for default(none) private(j, num1) firstprivate(i_max, org_isite1, org_sigma1, X, tmp_trans) shared(tmp_v0, tmp_v1) 185 for (j = 1; j <= i_max; j++) {
187 tmp_v0[j] += -tmp_trans * tmp_v1[j] * (1.0-num1);
192 #pragma omp parallel for default(none) private(j, num1) firstprivate(i_max, org_isite1, org_sigma1, X, tmp_trans) shared(tmp_v0, tmp_v1) 193 for (j = 1; j <= i_max; j++) {
195 tmp_v0[j] += tmp_trans * tmp_v1[j] * num1;
200 #pragma omp parallel for default(none) private(j, num1) firstprivate(i_max, org_isite1, org_sigma1, org_sigma2, X,tmp_off, tmp_trans) shared(tmp_v0, tmp_v1) 201 for(j=1;j<=i_max;j++){
204 tmp_v0[tmp_off+1] += tmp_trans*tmp_v1[j]*num1;
210 fprintf(
stdoutMPI,
"ERROR: hopping is not allowed in localized spin system\n");
228 double complex *tmp_v0,
229 double complex *tmp_v1
253 double complex *tmp_v0,
254 double complex *tmp_v1
258 long unsigned int i,j, idim_maxMPI;
259 long unsigned int isite1;
260 long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
261 long unsigned int tmp_off=0;
263 double complex tmp_trans=0;
267 long unsigned int is1_up;
271 double complex *tmp_v1bufOrg;
275 tmp_v1bufOrg=cd_1d_allocate(idim_maxMPI + 1);
284 if (org_sigma1 == org_sigma2) {
285 if (org_isite1 == org_isite2) {
287 is1_up = X->
Def.
Tpow[org_isite1 - 1];
291 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1) \ 292 firstprivate(i_max, tmp_trans) private(j) 293 for (j = 1; j <= i_max; j++) tmp_v0[j] += -tmp_trans * tmp_v1[j];
297 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1) \ 298 firstprivate(i_max, tmp_trans) private(j) 299 for (j = 1; j <= i_max; j++) tmp_v0[j] += tmp_trans * tmp_v1[j];
304 isite1 = X->
Def.
Tpow[org_isite1 - 1];
305 if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2 &&
307 #pragma omp parallel for default(none) private(j) firstprivate(i_max, isite1, org_sigma1, X, tmp_trans) shared(tmp_v0, tmp_v1) 308 for (j = 1; j <= i_max; j++) {
309 tmp_v0[j] += (1.0 -
X_Spin_CisAis(j, X, isite1, org_sigma1)) * tmp_v1[j] * (-tmp_trans);
312 #pragma omp parallel for default(none) private(j) firstprivate(i_max, isite1, org_sigma1, X, tmp_trans) shared(tmp_v0, tmp_v1) 313 for (j = 1; j <= i_max; j++) {
314 tmp_v0[j] +=
X_Spin_CisAis(j, X, isite1, org_sigma1) * tmp_v1[j] * tmp_trans;
319 fprintf(
stdoutMPI,
"Error: isite1 must be equal to isite2 for Spin system. \n");
324 X_child_CisAit_spin_MPIdouble(org_isite1-1, org_sigma2, tmp_trans, X, tmp_v0, tmp_v1, tmp_v1bufOrg, i_max, X->
Def.
Tpow,
list_1_org,
list_1buf_org,
list_2_1,
list_2_2, X->
Large.
irght, X->
Large.
ilft,X->
Large.
ihfbit);
327 isite1 = X->
Def.
Tpow[org_isite1 - 1];
328 #pragma omp parallel for default(none) private(j, tmp_off, num1) \ 329 firstprivate(i_max, isite1, org_sigma2, X, tmp_trans, list_1_org, list_1, list_2_1, list_2_2) shared(tmp_v0, tmp_v1) 330 for (j = 1; j <= i_max; j++) {
332 if (num1 != 0) tmp_v0[tmp_off] += tmp_v1[j] * tmp_trans*(double)num1;
338 free_cd_1d_allocate(tmp_v1bufOrg);
355 double complex *tmp_v0,
356 double complex *tmp_v1
360 long unsigned int i,j, idim_maxMPI;
361 long unsigned int org_isite1,org_isite2,org_sigma1,org_sigma2;
362 long unsigned int tmp_off=0;
363 long unsigned int off=0;
365 double complex tmp_trans=0;
370 double complex *tmp_v1bufOrg;
374 tmp_v1bufOrg = cd_1d_allocate(idim_maxMPI + 1);
383 if (org_isite1 == org_isite2) {
385 if (org_sigma1 == org_sigma2) {
391 #pragma omp parallel for default(none) private(j) firstprivate(i_max, tmp_trans) shared(tmp_v0, tmp_v1) 392 for (j = 1; j <= i_max; j++) {
393 tmp_v0[j] += -tmp_trans * tmp_v1[j];
398 #pragma omp parallel for default(none) private(j) firstprivate(i_max, tmp_trans) shared(tmp_v0, tmp_v1) 399 for (j = 1; j <= i_max; j++) {
400 tmp_v0[j] += tmp_trans * tmp_v1[j];
411 if (org_sigma1 == org_sigma2) {
414 #pragma omp parallel for default(none) private(j, num1) firstprivate(i_max, org_isite1, org_sigma1, X, tmp_trans) shared(tmp_v0, tmp_v1, list_1) 415 for (j = 1; j <= i_max; j++) {
417 tmp_v0[j] += -tmp_trans * tmp_v1[j] * (1.0 - num1);
420 #pragma omp parallel for default(none) private(j, num1) firstprivate(i_max, org_isite1, org_sigma1, X, tmp_trans) shared(tmp_v0, tmp_v1, list_1) 421 for (j = 1; j <= i_max; j++) {
423 tmp_v0[j] += tmp_trans * tmp_v1[j] * num1;
428 #pragma omp parallel for default(none) private(j, tmp_sgn, tmp_off) \ 429 firstprivate(i_max, org_isite1, org_sigma1, org_sigma2, X, off, tmp_trans, myrank) \ 430 shared(tmp_v0, tmp_v1, list_1_org, list_1) 431 for (j = 1; j <= i_max; j++) {
434 if (tmp_sgn !=
FALSE) {
439 tmp_v0[tmp_off] += tmp_v1[j] * tmp_trans;
446 fprintf(
stdoutMPI,
"ERROR: hopping is not allowed in localized spin system\n");
451 free_cd_1d_allocate(tmp_v1bufOrg);
struct DefineList Def
Definision of system (Hamiltonian) etc.
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...
long unsigned int ihfbit
Used for Ogata-Lin ???
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.
int GetPairExcitedStateHalfSpinGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
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 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.
struct LargeList Large
Variables for Matrix-Vector product.
int ConvertToList1GeneralSpin(const long unsigned int org_ibit, const long unsigned int ihlfbit, long unsigned int *_ilist1Comp)
function of converting component to list_1
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.
int GetPairExcitedStateSpinGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Calculation of pair excited state for Spin Grand canonical system.
long unsigned int * list_1buf_org
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_child_CisAit_spin_MPIdouble(int org_isite1, int org_ispin2, double complex tmp_trans, struct BindStruct *X, 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)
Hopping term in Spin + Canonical for CalcSpectrum When both site1 and site2 are in the inter process ...
unsigned long int idim_maxOrg
The local Hilbert-space dimention of original state for the spectrum.
unsigned int Nsite
Number of sites in the INTRA process region.
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
int GetPairExcitedStateSpin(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
long unsigned int ilft
Used for Ogata-Lin ???
double complex * ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
long unsigned int * list_1_org
unsigned long int MaxMPI_li(unsigned long int idim)
MPI wrapper function to obtain maximum unsigned long integer across processes.
long unsigned int * list_2_1
int X_Spin_CisAit(long unsigned int j, struct BindStruct *X, long unsigned int is1_spin, long unsigned int sigma2, long unsigned int *list_1_Org_, long unsigned int *list_2_1_, long unsigned int *list_2_2_, long unsigned int *tmp_off)
Compute index of final wavefunction by term.
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
long unsigned int * list_1
double complex X_GC_child_AisCis_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...
unsigned int NPairExcitationOperator
Number of pair excitaion operator for spectrum.
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
long unsigned int * list_2_2
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 ** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
double complex X_GC_child_AisCis_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.
int GetPairExcitedStateGeneralSpin(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
int GetPairExcitedStateHalfSpin(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
double complex X_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, double complex *tmp_v1buf, unsigned long int idim_max, long unsigned int *list_1_org, long unsigned int *list_1buf_org, long unsigned int _ihfbit)
Compute term in the canonical general spin system when both site is in the inter process region...
long unsigned int irght
Used for Ogata-Lin ???
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()
struct CheckList Check
Size of the Hilbert space.
int GetPairExcitedStateGeneralSpinGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()