HΦ  3.2.0
PairExSpin.c File Reference
#include "PairExSpin.h"
#include "bitcalc.h"
#include "wrapperMPI.h"
#include "mltplyMPISpinCore.h"
#include "mltplySpinCore.h"
#include "common/setmemory.h"
+ Include dependency graph for PairExSpin.c:

Go to the source code of this file.

Functions

int GetPairExcitedStateSpinGC (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
 Calculation of pair excited state for Spin Grand canonical system. More...
 
int GetPairExcitedStateHalfSpinGC (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
 
int GetPairExcitedStateGeneralSpinGC (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
 
int GetPairExcitedStateSpin (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
 
int GetPairExcitedStateHalfSpin (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
 
int GetPairExcitedStateGeneralSpin (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
 

Function Documentation

◆ GetPairExcitedStateGeneralSpin()

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

Calculation of pair excited state for general Spin 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 353 of file PairExSpin.c.

References BitCheckGeneral(), BindStruct::Check, ConvertToList1GeneralSpin(), BindStruct::Def, FALSE, GetOffCompGeneralSpin(), CheckList::idim_maxOrg, LargeList::ihfbit, BindStruct::Large, list_1, list_1_org, list_1buf_org, MaxMPI_li(), myrank, DefineList::NPairExcitationOperator, DefineList::Nsite, DefineList::PairExcitationOperator, DefineList::ParaPairExcitationOperator, DefineList::SiteToBit, stdoutMPI, DefineList::Tpow, TRUE, and X_child_CisAit_GeneralSpin_MPIdouble().

Referenced by GetPairExcitedStateSpin().

359 {
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;
364 
365  double complex tmp_trans=0;
366  long int i_max;
367  int tmp_sgn, num1;
368  i_max = X->Check.idim_maxOrg;
369 
370  double complex *tmp_v1bufOrg;
371  //set size
372 #ifdef MPI
373  idim_maxMPI = MaxMPI_li(X->Check.idim_maxOrg);
374  tmp_v1bufOrg = cd_1d_allocate(idim_maxMPI + 1);
375 #endif // MPI
376 
377  for(i=0;i<X->Def.NPairExcitationOperator;i++) {
378  org_isite1 = X->Def.PairExcitationOperator[i][0] + 1;
379  org_isite2 = X->Def.PairExcitationOperator[i][2] + 1;
380  org_sigma1 = X->Def.PairExcitationOperator[i][1];
381  org_sigma2 = X->Def.PairExcitationOperator[i][3];
382  tmp_trans = X->Def.ParaPairExcitationOperator[i];
383  if (org_isite1 == org_isite2) {
384  if (org_isite1 > X->Def.Nsite) {
385  if (org_sigma1 == org_sigma2) {
386  // longitudinal magnetic field
387  num1 = BitCheckGeneral((unsigned long int) myrank,
388  org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
389  if (X->Def.PairExcitationOperator[i][4] == 0) {
390  if (num1 == 0) {
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];
394  }
395  }
396  } else {
397  if (num1 != 0) {
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];
401  }
402  }
403  }
404  }//org_sigma1=org_sigma2
405  else {//org_sigma1 != org_sigma2
406  X_child_CisAit_GeneralSpin_MPIdouble(org_isite1 - 1, org_sigma1, org_sigma2, tmp_trans, X, tmp_v0,
407  tmp_v1, tmp_v1bufOrg, i_max, list_1_org, list_1buf_org,
408  X->Large.ihfbit);
409  }
410  } else {//org_isite1 <= X->Def.Nsite
411  if (org_sigma1 == org_sigma2) {
412  // longitudinal magnetic field
413  if (X->Def.PairExcitationOperator[i][4] == 0) {
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++) {
416  num1 = BitCheckGeneral(list_1[j], org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
417  tmp_v0[j] += -tmp_trans * tmp_v1[j] * (1.0 - num1);
418  }
419  } else {
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++) {
422  num1 = BitCheckGeneral(list_1[j], org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
423  tmp_v0[j] += tmp_trans * tmp_v1[j] * num1;
424  }
425  }
426  }//org_sigma1=org_sigma2
427  else {//org_sigma1 != org_sigma2
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++) {
432  tmp_sgn = GetOffCompGeneralSpin(list_1_org[j], org_isite1, org_sigma2, org_sigma1, &off,
433  X->Def.SiteToBit, X->Def.Tpow);
434  if (tmp_sgn != FALSE) {
435  ConvertToList1GeneralSpin(off, X->Large.ihfbit, &tmp_off);
436 #ifdef _DEBUG
437  printf("rank=%d, org=%ld, tmp_off=%ld, list_1=%ld, ihfbit=%ld\n",myrank, list_1_org[j], off, list_1[tmp_off], X->Large.ihfbit);
438 #endif
439  tmp_v0[tmp_off] += tmp_v1[j] * tmp_trans;
440  }
441  }
442 
443  }
444  }
445  } else {
446  fprintf(stdoutMPI, "ERROR: hopping is not allowed in localized spin system\n");
447  return FALSE;
448  }//org_isite1 != org_isite2
449  }
450 #ifdef MPI
451  free_cd_1d_allocate(tmp_v1bufOrg);
452 #endif // MPI
453 
454  return TRUE;
455 }
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
int ConvertToList1GeneralSpin(const long unsigned int org_ibit, const long unsigned int ihlfbit, long unsigned int *_ilist1Comp)
function of converting component to list_1
Definition: bitcalc.c:285
#define TRUE
Definition: global.h:26
long unsigned int * list_1buf_org
Definition: global.h:54
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 * ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:189
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
#define FALSE
Definition: global.h:25
long unsigned int * list_1
Definition: global.h:47
unsigned int NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.h:188
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.h:94
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
Definition: bitcalc.c:393
int ** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:186
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...
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
Definition: bitcalc.c:243
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPairExcitedStateGeneralSpinGC()

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

Calculation of pair excited state for general Spin 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 144 of file PairExSpin.c.

References BitCheckGeneral(), BindStruct::Check, BindStruct::Def, FALSE, GetOffCompGeneralSpin(), CheckList::idim_maxOrg, DefineList::NPairExcitationOperator, DefineList::Nsite, DefineList::PairExcitationOperator, DefineList::ParaPairExcitationOperator, DefineList::SiteToBit, stdoutMPI, DefineList::Tpow, TRUE, X_GC_child_AisCis_GeneralSpin_MPIdouble(), X_GC_child_CisAis_GeneralSpin_MPIdouble(), and X_GC_child_CisAit_GeneralSpin_MPIdouble().

Referenced by GetPairExcitedStateSpinGC().

149  {
150  long unsigned int i, j;
151  int num1;
152  long unsigned int org_isite1, org_isite2, org_sigma1, org_sigma2;
153  long unsigned int tmp_off = 0;
154 
155  double complex tmp_trans = 0;
156  long int i_max;
157  i_max = X->Check.idim_maxOrg;
158 
159  for(i=0;i<X->Def.NPairExcitationOperator;i++){
160  org_isite1 = X->Def.PairExcitationOperator[i][0]+1;
161  org_isite2 = X->Def.PairExcitationOperator[i][2]+1;
162  org_sigma1 = X->Def.PairExcitationOperator[i][1];
163  org_sigma2 = X->Def.PairExcitationOperator[i][3];
164  tmp_trans = X->Def.ParaPairExcitationOperator[i];
165  if(org_isite1 == org_isite2){
166  if(org_isite1 > X->Def.Nsite){
167  if(org_sigma1==org_sigma2){
168  if(X->Def.PairExcitationOperator[i][4]==0) {
169  // longitudinal magnetic field
170  X_GC_child_AisCis_GeneralSpin_MPIdouble(org_isite1 - 1, org_sigma1, -tmp_trans, X, tmp_v0, tmp_v1);
171  }
172  else{
173  X_GC_child_CisAis_GeneralSpin_MPIdouble(org_isite1 - 1, org_sigma1, tmp_trans, X, tmp_v0, tmp_v1);
174  }
175  }else{
176  // transverse magnetic field
177  X_GC_child_CisAit_GeneralSpin_MPIdouble(org_isite1-1, org_sigma1, org_sigma2, tmp_trans, X, tmp_v0, tmp_v1);
178  }
179  }
180  else{//org_isite1 <= X->Def.Nsite
181  if(org_sigma1==org_sigma2){
182  if(X->Def.PairExcitationOperator[i][4]==0) {
183  // longitudinal magnetic field
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++) {
186  num1 = BitCheckGeneral(j - 1, org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
187  tmp_v0[j] += -tmp_trans * tmp_v1[j] * (1.0-num1);
188  }
189  }
190  else{
191  // longitudinal magnetic field
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++) {
194  num1 = BitCheckGeneral(j - 1, org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
195  tmp_v0[j] += tmp_trans * tmp_v1[j] * num1;
196  }
197  }
198  }else{
199  // transverse magnetic field
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++){
202  num1 = GetOffCompGeneralSpin(j-1, org_isite1, org_sigma2, org_sigma1, &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
203  if(num1 !=0){
204  tmp_v0[tmp_off+1] += tmp_trans*tmp_v1[j]*num1;
205  }
206  }
207  }
208  }
209  }else{
210  fprintf(stdoutMPI, "ERROR: hopping is not allowed in localized spin system\n");
211  return FALSE;
212  }
213  }
214  return TRUE;
215 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
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...
#define TRUE
Definition: global.h:26
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...
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 * ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:189
#define FALSE
Definition: global.h:25
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.
Definition: struct.h:188
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.h:94
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
Definition: bitcalc.c:393
int ** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:186
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
Definition: bitcalc.c:243
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPairExcitedStateHalfSpin()

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

Calculation of pair excited state for Half Spin 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 251 of file PairExSpin.c.

References BindStruct::Check, BindStruct::Def, FALSE, 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(), myrank, DefineList::NPairExcitationOperator, DefineList::Nsite, DefineList::PairExcitationOperator, DefineList::ParaPairExcitationOperator, stdoutMPI, DefineList::Tpow, TRUE, X_child_CisAit_spin_MPIdouble(), X_Spin_CisAis(), X_Spin_CisAit(), and X_SpinGC_CisAis().

Referenced by GetPairExcitedStateSpin().

257 {
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;
262 
263  double complex tmp_trans=0;
264  long int i_max;
265  int num1;
266  long int ibit1;
267  long unsigned int is1_up;
268 
269  i_max = X->Check.idim_maxOrg;
270 
271  double complex *tmp_v1bufOrg;
272  //set size
273 #ifdef MPI
274  idim_maxMPI = MaxMPI_li(X->Check.idim_maxOrg);
275  tmp_v1bufOrg=cd_1d_allocate(idim_maxMPI + 1);
276 #endif // MPI
277 
278  for (i = 0; i < X->Def.NPairExcitationOperator; i++) {
279  org_isite1 = X->Def.PairExcitationOperator[i][0] + 1;
280  org_isite2 = X->Def.PairExcitationOperator[i][2] + 1;
281  org_sigma1 = X->Def.PairExcitationOperator[i][1];
282  org_sigma2 = X->Def.PairExcitationOperator[i][3];
283  tmp_trans = X->Def.ParaPairExcitationOperator[i];
284  if (org_sigma1 == org_sigma2) {
285  if (org_isite1 == org_isite2) {
286  if (org_isite1 > X->Def.Nsite) {
287  is1_up = X->Def.Tpow[org_isite1 - 1];
288  ibit1 = X_SpinGC_CisAis((unsigned long int) myrank + 1, X, is1_up, org_sigma1);
289  if (X->Def.PairExcitationOperator[i][4] == 0) {
290  if (ibit1 == 0) {
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];
294  }
295  } else {
296  if (ibit1 != 0) {
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];
300  }
301  }
302  }// org_isite1 > X->Def.Nsite
303  else {
304  isite1 = X->Def.Tpow[org_isite1 - 1];
305  if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2 &&
306  X->Def.PairExcitationOperator[i][4] == 0) {
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);
310  }
311  } else {
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;
315  }
316  }
317  }
318  } else {
319  fprintf(stdoutMPI, "Error: isite1 must be equal to isite2 for Spin system. \n");
320  return FALSE;
321  }
322  } else { //org_sigma1 != org_sigma2 // for the canonical case
323  if (org_isite1 > X->Def.Nsite) {//For MPI
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);
325 
326  } else {
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++) {
331  num1=X_Spin_CisAit(j, X, isite1, org_sigma2, list_1_org, list_2_1, list_2_2, &tmp_off);
332  if (num1 != 0) tmp_v0[tmp_off] += tmp_v1[j] * tmp_trans*(double)num1;
333  }
334  }
335  }
336  }
337 #ifdef MPI
338  free_cd_1d_allocate(tmp_v1bufOrg);
339 #endif
340  return TRUE;
341 }
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_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.
Definition: struct.h:412
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.
#define TRUE
Definition: global.h:26
long unsigned int * list_1buf_org
Definition: global.h:54
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.
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
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
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.
#define FALSE
Definition: global.h:25
unsigned int NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.h:188
long unsigned int * list_2_2
Definition: global.h:50
int ** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:186
long unsigned int irght
Used for Ogata-Lin ???
Definition: struct.h:343
int myrank
Process ID, defined in InitializeMPI()
Definition: global.h:163
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPairExcitedStateHalfSpinGC()

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

Calculation of pair excited state for Half Spin 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 62 of file PairExSpin.c.

References BindStruct::Check, BindStruct::Def, FALSE, CheckList::idim_maxOrg, DefineList::NPairExcitationOperator, DefineList::Nsite, DefineList::PairExcitationOperator, DefineList::ParaPairExcitationOperator, stdoutMPI, DefineList::Tpow, TRUE, X_GC_child_AisCis_spin_MPIdouble(), X_GC_child_CisAis_spin_MPIdouble(), X_GC_child_CisAit_spin_MPIdouble(), X_SpinGC_CisAis(), and X_SpinGC_CisAit().

Referenced by GetPairExcitedStateSpinGC().

67  {
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;
72 
73  double complex tmp_trans=0;
74  long int i_max;
75  int tmp_sgn;
76  i_max = X->Check.idim_maxOrg;
77 
78  for(i=0;i<X->Def.NPairExcitationOperator;i++){
79  org_isite1 = X->Def.PairExcitationOperator[i][0]+1;
80  org_isite2 = X->Def.PairExcitationOperator[i][2]+1;
81  org_sigma1 = X->Def.PairExcitationOperator[i][1];
82  org_sigma2 = X->Def.PairExcitationOperator[i][3];
83  tmp_trans = X->Def.ParaPairExcitationOperator[i];
84  if(org_isite1 == org_isite2){
85  if(org_isite1 > X->Def.Nsite){
86  if(org_sigma1==org_sigma2){ // longitudinal magnetic field
87  if(X->Def.PairExcitationOperator[i][4]==0) {
88  X_GC_child_AisCis_spin_MPIdouble(org_isite1 - 1, org_sigma1, -tmp_trans, X, tmp_v0, tmp_v1);
89  }
90  else{
91  X_GC_child_CisAis_spin_MPIdouble(org_isite1 - 1, org_sigma1, tmp_trans, X, tmp_v0, tmp_v1);
92  }
93  }
94  else{ // transverse magnetic field
95  //fprintf(stdoutMPI, "Debug: test, org_isite1=%d, org_sigma1=%d, orgsima_2=%d\n", org_isite1, org_sigma1, org_sigma2);
96  X_GC_child_CisAit_spin_MPIdouble(org_isite1-1, org_sigma1, org_sigma2, tmp_trans, X, tmp_v0, tmp_v1);
97  }
98  }else{
99  isite1 = X->Def.Tpow[org_isite1-1];
100  if(org_sigma1==org_sigma2) {
101  if (X->Def.PairExcitationOperator[i][4] == 0) {
102  // longitudinal magnetic field
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);
106  }
107  }
108  else {
109  // longitudinal magnetic field
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;
113  }
114  }
115  }else{
116  // transverse magnetic field
117  // fprintf(stdoutMPI, "Debug: isite1=%d, org_sigma2=%d\n", isite1, org_sigma2);
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++){
120  tmp_sgn = X_SpinGC_CisAit(j,X, isite1,org_sigma2,&tmp_off);
121  if(tmp_sgn !=0){
122  tmp_v0[tmp_off+1]+= tmp_sgn*tmp_v1[j]*tmp_trans;
123  }
124  }
125  }
126  }
127  }else{
128  fprintf(stdoutMPI, "ERROR: hopping is not allowed in localized spin system\n");
129  return FALSE;
130  }
131  }
132  return TRUE;
133 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
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.
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.
#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 * ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.h:189
#define FALSE
Definition: global.h:25
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 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 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).
struct CheckList Check
Size of the Hilbert space.
Definition: struct.h:411
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPairExcitedStateSpin()

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

Calculation of pair excited state for Spin 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 226 of file PairExSpin.c.

References BindStruct::Def, FALSE, GetPairExcitedStateGeneralSpin(), GetPairExcitedStateHalfSpin(), and DefineList::iFlgGeneralSpin.

Referenced by GetPairExcitedState().

231  {
232  int iret=0;
233  if (X->Def.iFlgGeneralSpin == FALSE) {
234  iret=GetPairExcitedStateHalfSpin(X, tmp_v0, tmp_v1);
235  }
236  else{
237  iret=GetPairExcitedStateGeneralSpin(X, tmp_v0, tmp_v1);
238  }
239  return iret;
240 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.h:86
#define FALSE
Definition: global.h:25
int GetPairExcitedStateGeneralSpin(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Definition: PairExSpin.c:353
int GetPairExcitedStateHalfSpin(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Definition: PairExSpin.c:251
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPairExcitedStateSpinGC()

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

Calculation of pair excited state for Spin 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 35 of file PairExSpin.c.

References BindStruct::Def, FALSE, GetPairExcitedStateGeneralSpinGC(), GetPairExcitedStateHalfSpinGC(), and DefineList::iFlgGeneralSpin.

Referenced by GetPairExcitedState().

40  {
41 
42  int iret=0;
43  if (X->Def.iFlgGeneralSpin == FALSE) {
44  iret=GetPairExcitedStateHalfSpinGC(X, tmp_v0, tmp_v1);
45  }
46  else{
47  iret=GetPairExcitedStateGeneralSpinGC(X, tmp_v0, tmp_v1);
48  }
49  return iret;
50 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
int GetPairExcitedStateHalfSpinGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Definition: PairExSpin.c:62
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.h:86
#define FALSE
Definition: global.h:25
int GetPairExcitedStateGeneralSpinGC(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Definition: PairExSpin.c:144
+ Here is the call graph for this function:
+ Here is the caller graph for this function: