HPhi++  3.1.0
PairExSpin.cpp File Reference
#include "PairExSpin.hpp"
#include "bitcalc.hpp"
#include "wrapperMPI.hpp"
#include "mltplyMPISpinCore.hpp"
#include "mltplySpinCore.hpp"
#include "mltplyCommon.hpp"
#include "common/setmemory.hpp"

Go to the source code of this file.

Functions

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

Function Documentation

◆ GetPairExcitedStateGeneralSpin()

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

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 346 of file PairExSpin.cpp.

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

Referenced by GetPairExcitedStateSpin().

353 {
354  long int i, j;
355  long int org_isite1, org_isite2, org_sigma1, org_sigma2;
356  long int tmp_off = 0;
357  long int off = 0;
358  std::complex<double> tmp_trans = 0, dmv;
359  long int i_max;
360  int tmp_sgn, num1, one = 1;
361  i_max = X->Check.idim_maxOrg;
362 
363  for (i = 0; i < X->Def.NPairExcitationOperator[iEx]; i++) {
364  org_isite1 = X->Def.PairExcitationOperator[iEx][i][0] + 1;
365  org_isite2 = X->Def.PairExcitationOperator[iEx][i][2] + 1;
366  org_sigma1 = X->Def.PairExcitationOperator[iEx][i][1];
367  org_sigma2 = X->Def.PairExcitationOperator[iEx][i][3];
368  tmp_trans = X->Def.ParaPairExcitationOperator[iEx][i];
369  if (org_isite1 == org_isite2) {
370  if (org_isite1 > X->Def.Nsite) {
371  if (org_sigma1 == org_sigma2) {
372  // longitudinal magnetic field
373  num1 = BitCheckGeneral((long int) myrank,
374  org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
375  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
376  if (num1 == 0) {
377 #pragma omp parallel for default(none) private(j,dmv) \
378  firstprivate(i_max, tmp_trans) \
379  shared(tmp_v0, tmp_v1,one,nstate)
380  for (j = 1; j <= i_max; j++) {
381  dmv = -tmp_trans;
382  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
383  }
384  }
385  }
386  else {
387  if (num1 != 0) {
388 #pragma omp parallel for default(none) private(j) \
389  firstprivate(i_max, tmp_trans) shared(tmp_v0, tmp_v1,one,nstate)
390  for (j = 1; j <= i_max; j++) {
391  zaxpy_(&nstate, &tmp_trans, tmp_v1[j], &one, tmp_v0[j], &one);
392  }
393  }
394  }
395  }//org_sigma1=org_sigma2
396  else {//org_sigma1 != org_sigma2
397  X_child_CisAit_GeneralSpin_MPIdouble(org_isite1 - 1, org_sigma1, org_sigma2,
398  tmp_trans, X, nstate, tmp_v0, tmp_v1, i_max);
399  }
400  }
401  else {//org_isite1 <= X->Def.Nsite
402  if (org_sigma1 == org_sigma2) {
403  // longitudinal magnetic field
404  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
405 #pragma omp parallel for default(none) private(j, num1,dmv) \
406  firstprivate(i_max, org_isite1, org_sigma1, X, tmp_trans) \
407  shared(tmp_v0, tmp_v1, list_1,one,nstate)
408  for (j = 1; j <= i_max; j++) {
409  num1 = BitCheckGeneral(list_1[j], org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
410  dmv = -tmp_trans * (1.0 - num1);
411  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
412  }
413  }
414  else {
415 #pragma omp parallel for default(none) private(j, num1,dmv) \
416  firstprivate(i_max, org_isite1, org_sigma1, X, tmp_trans) \
417  shared(tmp_v0, tmp_v1, list_1,one,nstate)
418  for (j = 1; j <= i_max; j++) {
419  num1 = BitCheckGeneral(list_1[j], org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
420  dmv = tmp_trans * (std::complex<double>)num1;
421  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
422  }
423  }
424  }//org_sigma1=org_sigma2
425  else {//org_sigma1 != org_sigma2
426 #pragma omp parallel for default(none) private(j, tmp_sgn, tmp_off) \
427  firstprivate(i_max, org_isite1, org_sigma1, org_sigma2, X, off, tmp_trans, myrank) \
428  shared(tmp_v0, tmp_v1, list_1_org, list_1,one,nstate)
429  for (j = 1; j <= i_max; j++) {
430  tmp_sgn = GetOffCompGeneralSpin(list_1_org[j], org_isite1, org_sigma2, org_sigma1, &off,
431  X->Def.SiteToBit, X->Def.Tpow);
432  if (tmp_sgn != FALSE) {
433  ConvertToList1GeneralSpin(off, X->Large.ihfbit, &tmp_off);
434  zaxpy_(&nstate, &tmp_trans, tmp_v1[j], &one, tmp_v0[tmp_off], &one);
435  }
436  }
437  }
438  }
439  }
440  else {
441  fprintf(stdoutMPI, "ERROR: hopping is not allowed in localized spin system\n");
442  return FALSE;
443  }//org_isite1 != org_isite2
444  }
445 
446  return TRUE;
447 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int BitCheckGeneral(const long int org_bit, const int org_isite, const int target_ispin, const long int *SiteToBit, const long int *Tpow)
bit check function for general spin
Definition: bitcalc.cpp:392
void X_child_CisAit_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int idim_max)
Compute term in the canonical general spin system when both site is in the inter process region...
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
int ConvertToList1GeneralSpin(const long int org_ibit, const long int ihlfbit, long int *_ilist1Comp)
function of converting component to list_1
Definition: bitcalc.cpp:285
int * NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:190
long int * list_1_org
Definition: global.cpp:31
std::complex< double > ** ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:191
int GetOffCompGeneralSpin(const long int org_ibit, const int org_isite, const int org_ispin, const int off_ispin, long int *_ioffComp, const long int *SiteToBit, const long int *Tpow)
function of getting off-diagonal component for general spin
Definition: bitcalc.cpp:243
long int ihfbit
Used for Ogata-Lin ???
Definition: struct.hpp:346
int myrank
Process ID, defined in InitializeMPI()
Definition: global.cpp:73
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.hpp:94
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
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

◆ GetPairExcitedStateGeneralSpinGC()

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

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 125 of file PairExSpin.cpp.

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

Referenced by GetPairExcitedStateSpinGC().

131  {
132  long int i, j;
133  int num1;
134  long int org_isite1, org_isite2, org_sigma1, org_sigma2;
135  long int tmp_off = 0;
136  int one = 1;
137  std::complex<double> tmp_trans = 0, dmv;
138  long int i_max;
139  i_max = X->Check.idim_maxOrg;
140 
141  for (i = 0; i < X->Def.NPairExcitationOperator[iEx]; i++) {
142  org_isite1 = X->Def.PairExcitationOperator[iEx][i][0] + 1;
143  org_isite2 = X->Def.PairExcitationOperator[iEx][i][2] + 1;
144  org_sigma1 = X->Def.PairExcitationOperator[iEx][i][1];
145  org_sigma2 = X->Def.PairExcitationOperator[iEx][i][3];
146  tmp_trans = X->Def.ParaPairExcitationOperator[iEx][i];
147  if (org_isite1 == org_isite2) {
148  if (org_isite1 > X->Def.Nsite) {
149  if (org_sigma1 == org_sigma2) {
150  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
151  // longitudinal magnetic field
152  X_GC_child_AisCis_GeneralSpin_MPIdouble(org_isite1 - 1, org_sigma1, -tmp_trans, X, nstate, tmp_v0, tmp_v1);
153  }
154  else {
155  X_GC_child_CisAis_GeneralSpin_MPIdouble(org_isite1 - 1, org_sigma1, tmp_trans, X, nstate, tmp_v0, tmp_v1);
156  }
157  }
158  else {
159  // transverse magnetic field
160  X_GC_child_CisAit_GeneralSpin_MPIdouble(org_isite1 - 1, org_sigma1, org_sigma2, tmp_trans, X, nstate, tmp_v0, tmp_v1);
161  }
162  }
163  else {//org_isite1 <= X->Def.Nsite
164  if (org_sigma1 == org_sigma2) {
165  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
166  // longitudinal magnetic field
167 #pragma omp parallel for default(none) private(j,num1,dmv) \
168 firstprivate(i_max,org_isite1,org_sigma1,X,tmp_trans) shared(tmp_v0,tmp_v1,one,nstate)
169  for (j = 1; j <= i_max; j++) {
170  num1 = BitCheckGeneral(j - 1, org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
171  dmv = -tmp_trans * (1.0 - num1);
172  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
173  }
174  }
175  else {
176  // longitudinal magnetic field
177 #pragma omp parallel for default(none) private(j,num1,dmv) \
178  firstprivate(i_max,org_isite1,org_sigma1,X,tmp_trans) shared(tmp_v0,tmp_v1,one,nstate)
179  for (j = 1; j <= i_max; j++) {
180  num1 = BitCheckGeneral(j - 1, org_isite1, org_sigma1, X->Def.SiteToBit, X->Def.Tpow);
181  dmv = tmp_trans * (std::complex<double>)num1;
182  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
183  }
184  }
185  }
186  else {
187  // transverse magnetic field
188 #pragma omp parallel for default(none) private(j,num1,dmv) \
189 firstprivate(i_max,org_isite1,org_sigma1,org_sigma2,X,tmp_off,tmp_trans) \
190 shared(tmp_v0,tmp_v1,one,nstate)
191  for (j = 1; j <= i_max; j++) {
192  num1 = GetOffCompGeneralSpin(j - 1, org_isite1, org_sigma2, org_sigma1, &tmp_off, X->Def.SiteToBit, X->Def.Tpow);
193  if (num1 != 0) {
194  dmv = tmp_trans * (std::complex<double>)num1;
195  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[tmp_off + 1], &one);
196  }
197  }
198  }
199  }
200  }
201  else {
202  fprintf(stdoutMPI, "ERROR: hopping is not allowed in localized spin system\n");
203  return FALSE;
204  }
205  }
206  return TRUE;
207 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
void X_GC_child_AisCis_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
int BitCheckGeneral(const long int org_bit, const int org_isite, const int target_ispin, const long int *SiteToBit, const long int *Tpow)
bit check function for general spin
Definition: bitcalc.cpp:392
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 X_GC_child_CisAis_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
int * NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:190
void X_GC_child_CisAit_GeneralSpin_MPIdouble(int org_isite1, int org_ispin1, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Compute term in the grandcanonical general spin system when both site is in the inter process region...
std::complex< double > ** ParaPairExcitationOperator
[DefineList::NPairExcitationOperator] Coefficient of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:191
int GetOffCompGeneralSpin(const long int org_ibit, const int org_isite, const int org_ispin, const int off_ispin, long int *_ioffComp, const long int *SiteToBit, const long int *Tpow)
function of getting off-diagonal component for general spin
Definition: bitcalc.cpp:243
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
Definition: struct.hpp:94
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
int *** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:187

◆ GetPairExcitedStateHalfSpin()

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

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 240 of file PairExSpin.cpp.

References BindStruct::Check, BindStruct::Def, CheckList::idim_maxOrg, myrank, DefineList::NPairExcitationOperator, DefineList::Nsite, DefineList::PairExcitationOperator, DefineList::ParaPairExcitationOperator, stdoutMPI, DefineList::Tpow, X_child_CisAit_spin_MPIdouble(), X_Spin_CisAis(), X_Spin_CisAit(), and X_SpinGC_CisAis().

Referenced by GetPairExcitedStateSpin().

247 {
248  long int i, j;
249  long int isite1;
250  long int org_isite1, org_isite2, org_sigma1, org_sigma2;
251  long int tmp_off = 0;
252  std::complex<double> tmp_trans = 0, dmv;
253  long int i_max;
254  int num1, one = 1;
255  long int ibit1;
256  long int is1_up;
257 
258  i_max = X->Check.idim_maxOrg;
259 
260  for (i = 0; i < X->Def.NPairExcitationOperator[iEx]; i++) {
261  org_isite1 = X->Def.PairExcitationOperator[iEx][i][0] + 1;
262  org_isite2 = X->Def.PairExcitationOperator[iEx][i][2] + 1;
263  org_sigma1 = X->Def.PairExcitationOperator[iEx][i][1];
264  org_sigma2 = X->Def.PairExcitationOperator[iEx][i][3];
265  tmp_trans = X->Def.ParaPairExcitationOperator[iEx][i];
266  if (org_sigma1 == org_sigma2) {
267  if (org_isite1 == org_isite2) {
268  if (org_isite1 > X->Def.Nsite) {
269  is1_up = X->Def.Tpow[org_isite1 - 1];
270  ibit1 = X_SpinGC_CisAis((long int) myrank + 1, is1_up, org_sigma1);
271  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
272  if (ibit1 == 0) {
273  dmv = -tmp_trans;
274 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1,one,nstate,dmv) \
275  firstprivate(i_max, tmp_trans) private(j)
276  for (j = 1; j <= i_max; j++) {
277  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
278  }
279  }
280  }
281  else {
282  if (ibit1 != 0) {
283 #pragma omp parallel for default(none) shared(tmp_v0, tmp_v1,one,nstate) \
284  firstprivate(i_max, tmp_trans) private(j)
285  for (j = 1; j <= i_max; j++)
286  zaxpy_(&nstate, &tmp_trans, tmp_v1[j], &one, tmp_v0[j], &one);
287  }
288  }
289  }// org_isite1 > X->Def.Nsite
290  else {
291  isite1 = X->Def.Tpow[org_isite1 - 1];
292  if (org_isite1 == org_isite2 && org_sigma1 == org_sigma2 &&
293  X->Def.PairExcitationOperator[iEx][i][4] == 0) {
294 #pragma omp parallel for default(none) private(j,dmv) \
295 firstprivate(i_max,isite1,org_sigma1,X,tmp_trans) shared(tmp_v0,tmp_v1,one,nstate)
296  for (j = 1; j <= i_max; j++) {
297  dmv = (1.0 - X_Spin_CisAis(j, isite1, org_sigma1)) * (-tmp_trans);
298  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
299  }
300  }
301  else {
302 #pragma omp parallel for default(none) private(j,dmv) \
303 firstprivate(i_max,isite1,org_sigma1,X,tmp_trans) shared(tmp_v0,tmp_v1,one,nstate)
304  for (j = 1; j <= i_max; j++) {
305  dmv = (std::complex<double>)X_Spin_CisAis(j, isite1, org_sigma1) * tmp_trans;
306  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
307  }
308  }
309  }
310  }
311  else {
312  fprintf(stdoutMPI, "Error: isite1 must be equal to isite2 for Spin system. \n");
313  return FALSE;
314  }
315  }
316  else { //org_sigma1 != org_sigma2 // for the canonical case
317  if (org_isite1 > X->Def.Nsite) {//For MPI
318  X_child_CisAit_spin_MPIdouble(org_isite1 - 1, org_sigma2, tmp_trans,
319  X, nstate, tmp_v0, tmp_v1, i_max);
320  }
321  else {
322  isite1 = X->Def.Tpow[org_isite1 - 1];
323 #pragma omp parallel for default(none) private(j,tmp_off,num1,dmv) \
324 firstprivate(i_max,isite1,org_sigma2,X,tmp_trans,list_1_org,list_1,list_2_1,list_2_2) \
325 shared(tmp_v0,tmp_v1,one,nstate)
326  for (j = 1; j <= i_max; j++) {
327  num1 = X_Spin_CisAit(j, X, isite1, org_sigma2, &tmp_off);
328  if (num1 != 0) {
329  dmv = tmp_trans*(double)num1;
330  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[tmp_off], &one);
331  }
332  }
333  }
334  }
335  }
336  return TRUE;
337 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
int X_Spin_CisAis(long int j, long int is1_spin, long int sigma1)
Compute the spin state with bit mask is1_spin.
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
int X_SpinGC_CisAis(long int j, long int is1_spin, long int sigma1)
Compute the grandcanonical spin state with bit mask is1_spin.
int * NPairExcitationOperator
Number of pair excitaion operator for spectrum.
Definition: struct.hpp:190
void X_child_CisAit_spin_MPIdouble(int org_isite1, int org_ispin2, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, long int idim_max)
Hopping term in Spin + Canonical for CalcSpectrum When both site1 and site2 are in the inter process ...
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 X_Spin_CisAit(long int j, struct BindStruct *X, long int is1_spin, long int sigma2, long int *tmp_off)
Compute index of final wavefunction by term.
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
int *** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:187

◆ GetPairExcitedStateHalfSpinGC()

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

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 34 of file PairExSpin.cpp.

Referenced by GetPairExcitedStateSpinGC().

40  {
41  long int i, j;
42  long int isite1;
43  long int org_isite1, org_isite2, org_sigma1, org_sigma2;
44  long int tmp_off = 0;
45 
46  std::complex<double> tmp_trans = 0, dmv;
47  long int i_max;
48  int tmp_sgn, one = 1;
49 
50  i_max = X->Check.idim_maxOrg;
51 
52  for (i = 0; i < X->Def.NPairExcitationOperator[iEx]; i++) {
53  org_isite1 = X->Def.PairExcitationOperator[iEx][i][0] + 1;
54  org_isite2 = X->Def.PairExcitationOperator[iEx][i][2] + 1;
55  org_sigma1 = X->Def.PairExcitationOperator[iEx][i][1];
56  org_sigma2 = X->Def.PairExcitationOperator[iEx][i][3];
57  tmp_trans = X->Def.ParaPairExcitationOperator[iEx][i];
58  if (org_isite1 == org_isite2) {
59  if (org_isite1 > X->Def.Nsite) {
60  if (org_sigma1 == org_sigma2) { // longitudinal magnetic field
61  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
62  X_GC_child_AisCis_spin_MPIdouble(org_isite1 - 1, org_sigma1, -tmp_trans, X, nstate, tmp_v0, tmp_v1);
63  }
64  else {
65  X_GC_child_CisAis_spin_MPIdouble(org_isite1 - 1, org_sigma1, tmp_trans, X, nstate, tmp_v0, tmp_v1);
66  }
67  }
68  else { // transverse magnetic field
69  //fprintf(stdoutMPI, "Debug: test, org_isite1=%d, org_sigma1=%d, orgsima_2=%d\n", org_isite1, org_sigma1, org_sigma2);
70  X_GC_child_CisAit_spin_MPIdouble(org_isite1 - 1, org_sigma1, org_sigma2, tmp_trans, X, nstate, tmp_v0, tmp_v1);
71  }
72  }
73  else {
74  isite1 = X->Def.Tpow[org_isite1 - 1];
75  if (org_sigma1 == org_sigma2) {
76  if (X->Def.PairExcitationOperator[iEx][i][4] == 0) {
77  // longitudinal magnetic field
78 #pragma omp parallel for default(none) private(j, tmp_sgn,dmv) \
79  firstprivate(i_max, isite1, org_sigma1, X,tmp_trans) shared(one,nstate,tmp_v0, tmp_v1)
80  for (j = 1; j <= i_max; j++) {
81  dmv = (1.0 - X_SpinGC_CisAis(j, isite1, org_sigma1))* (-tmp_trans);
82  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
83  }
84  }
85  else {
86  // longitudinal magnetic field
87 #pragma omp parallel for default(none) private(j, tmp_sgn,dmv) \
88  firstprivate(i_max, isite1, org_sigma1, X,tmp_trans) shared(tmp_v0, tmp_v1,one,nstate)
89  for (j = 1; j <= i_max; j++) {
90  dmv = (std::complex<double>)X_SpinGC_CisAis(j, isite1, org_sigma1)* tmp_trans;
91  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[j], &one);
92  }
93  }
94  }
95  else {
96  // transverse magnetic field
97  // fprintf(stdoutMPI, "Debug: isite1=%d, org_sigma2=%d\n", isite1, org_sigma2);
98 #pragma omp parallel for default(none) private(j, tmp_sgn, tmp_off,dmv) \
99  firstprivate(i_max, isite1, org_sigma2, X, tmp_trans) shared(tmp_v0, tmp_v1,one,nstate)
100  for (j = 1; j <= i_max; j++) {
101  tmp_sgn = X_SpinGC_CisAit(j, isite1, org_sigma2, &tmp_off);
102  if (tmp_sgn != 0) {
103  dmv = (std::complex<double>)tmp_sgn * tmp_trans;
104  zaxpy_(&nstate, &dmv, tmp_v1[j], &one, tmp_v0[tmp_off + 1], &one);
105  }
106  }
107  }
108  }
109  }
110  else {
111  fprintf(stdoutMPI, "ERROR: hopping is not allowed in localized spin system\n");
112  return FALSE;
113  }
114  }
115  return TRUE;
116 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.cpp:75
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
int X_SpinGC_CisAis(long int j, long int is1_spin, long int sigma1)
Compute the grandcanonical spin state with bit mask is1_spin.
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
void X_GC_child_CisAis_spin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
void X_GC_child_CisAit_spin_MPIdouble(int org_isite1, int org_ispin1, 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 Spin + GC When both site1 and site2 are in the inter process region.
long int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
Definition: struct.hpp:90
int X_SpinGC_CisAit(long int j, long int is1_spin, long int sigma2, long int *tmp_off)
Compute index of final wavefunction by term (grandcanonical).
void X_GC_child_AisCis_spin_MPIdouble(int org_isite1, int org_ispin1, std::complex< double > tmp_trans, struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Hopping term in Spin + GC When both site1 and site2 are in the inter process region.
struct CheckList Check
Size of the Hilbert space.
Definition: struct.hpp:396
int *** PairExcitationOperator
[DefineList::NPairExcitationOperator][5] Indices of pair excitaion operator for spectrum. malloc in setmem_def().
Definition: struct.hpp:187

◆ GetPairExcitedStateSpin()

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

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 456 of file PairExSpin.cpp.

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

Referenced by GetPairExcitedState().

462  {
463  int iret = 0;
464  if (X->Def.iFlgGeneralSpin == FALSE) {
465  iret = GetPairExcitedStateHalfSpin(X, nstate, tmp_v0, tmp_v1, iEx);
466  }
467  else {
468  iret = GetPairExcitedStateGeneralSpin(X, nstate, tmp_v0, tmp_v1, iEx);
469  }
470  return iret;
471 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
int GetPairExcitedStateGeneralSpin(struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, int iEx)
Definition: PairExSpin.cpp:346
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.hpp:86
int GetPairExcitedStateHalfSpin(struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, int iEx)
Definition: PairExSpin.cpp:240

◆ GetPairExcitedStateSpinGC()

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

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 216 of file PairExSpin.cpp.

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

Referenced by GetPairExcitedState().

221  {
222 
223  int iret = 0;
224  if (X->Def.iFlgGeneralSpin == FALSE) {
225  iret = GetPairExcitedStateHalfSpinGC(X, nstate, tmp_v0, tmp_v1, iEx);
226  }
227  else {
228  iret = GetPairExcitedStateGeneralSpinGC(X, nstate, tmp_v0, tmp_v1, iEx);
229  }
230  return iret;
231 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.hpp:395
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
Definition: struct.hpp:86
int GetPairExcitedStateHalfSpinGC(struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, int iEx)
Definition: PairExSpin.cpp:34
int GetPairExcitedStateGeneralSpinGC(struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1, int iEx)
Definition: PairExSpin.cpp:125