HΦ  3.1.0
mltplySpinCore.c File Reference

Functions for spin Hamiltonian (Core) More...

#include <bitcalc.h>
#include "mfmemory.h"
#include "xsetmem.h"
#include "wrapperMPI.h"
#include "mltplyCommon.h"
#include "mltplySpinCore.h"

Go to the source code of this file.

Functions

int child_exchange_spin_GetInfo (int iExchange, struct BindStruct *X)
 Set parameters for the bit operation of spin-exchange term. More...
 
int child_pairlift_spin_GetInfo (int iPairLift, struct BindStruct *X)
 Set parameters for the bit operation of spin-pairlift term. More...
 
int child_general_int_spin_GetInfo (struct BindStruct *X, long unsigned int isite1, long unsigned int isite2, long unsigned int sigma1, long unsigned int sigma2, long unsigned int sigma3, long unsigned int sigma4, double complex tmp_V)
 Set parameters for the bit operation of spin-general interaction term. More...
 
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 \(c_{is}^\dagger c_{it}\) term. More...
 
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. More...
 
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. More...
 
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 \(c_{is}^\dagger c_{it}\) term (grandcanonical). More...
 
int X_child_exchange_spin_element (long unsigned int j, struct BindStruct *X, long unsigned int isA_up, long unsigned int isB_up, long unsigned int sigmaA, long unsigned int sigmaB, long unsigned int *tmp_off)
 Compute index of final wavefunction associated to spin-exchange term. More...
 
double complex child_exchange_spin_element (long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
 Multiply Hamiltonian of exchange term of canonical spin system. More...
 
double complex GC_child_exchange_spin_element (long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
 Multiply Hamiltonian of exchange term of grandcanonical spin system. More...
 
double complex GC_child_pairlift_spin_element (long unsigned int j, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
 Multiply Hamiltonian of pairlift term of grandcanonical spin system. More...
 
double complex child_CisAisCisAis_spin_element (long unsigned int j, long unsigned int isA_up, long unsigned int isB_up, long unsigned int org_sigma2, long unsigned int org_sigma4, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
 Compute \(c_{is}^\dagger c_{is} c_{is}^\dagger c_{is}\) term of canonical spsin system. More...
 
double complex GC_child_CisAisCisAis_spin_element (long unsigned int j, long unsigned int isA_up, long unsigned int isB_up, long unsigned int org_sigma2, long unsigned int org_sigma4, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X)
 Compute \(c_{is}^\dagger c_{is} c_{is}^\dagger c_{is}\) term of grandcanonical spsin system. More...
 
double complex GC_child_CisAisCitAiu_spin_element (long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
 Compute \(c_{is}^\dagger c_{is} c_{it}^\dagger c_{iu}\) term of grandcanonical spsin system. More...
 
double complex GC_child_CisAitCiuAiu_spin_element (long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off)
 Compute \(c_{is}^\dagger c_{it} c_{iu}^\dagger c_{iu}\) term of grandcanonical spsin system. More...
 
double complex GC_child_CisAitCiuAiv_spin_element (long unsigned int j, long unsigned int org_sigma2, long unsigned int org_sigma4, long unsigned int isA_up, long unsigned int isB_up, double complex tmp_V, double complex *tmp_v0, double complex *tmp_v1, struct BindStruct *X, long unsigned int *tmp_off_2)
 Compute \(c_{is}^\dagger c_{it} c_{iu}^\dagger c_{iv}\) term of grandcanonical spsin system. More...
 

Detailed Description

Functions for spin Hamiltonian (Core)

Definition in file mltplySpinCore.c.

Function Documentation

◆ child_CisAisCisAis_spin_element()

double complex child_CisAisCisAis_spin_element ( long unsigned int  j,
long unsigned int  isA_up,
long unsigned int  isB_up,
long unsigned int  org_sigma2,
long unsigned int  org_sigma4,
double complex  tmp_V,
double complex *  tmp_v0,
double complex *  tmp_v1,
struct BindStruct X 
)

Compute \(c_{is}^\dagger c_{is} c_{is}^\dagger c_{is}\) term of canonical spsin system.

Returns
Fragment of \(\langle v_1 | H_{\rm this}|v_1 \rangle\)
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[in]isA_upBit mask for spin 1
[in]isB_upBit mask for spin 2
[in]org_sigma2Target for spin 1
[in]org_sigma4Target for spin 2
[in]tmp_VCoupling constatnt
[in]tmp_v0Resulting wavefunction
[in]tmp_v1Wavefunction to be multiplied
[in,out]X

Definition at line 392 of file mltplySpinCore.c.

References X, and X_Spin_CisAis().

Referenced by expec_cisajscktalt_SpinHalf().

402  {
403  int tmp_sgn;
404  double complex dmv;
405  double complex dam_pr = 0;
406 
407  tmp_sgn = X_Spin_CisAis(j, X, isB_up, org_sigma4);
408  tmp_sgn *= X_Spin_CisAis(j, X, isA_up, org_sigma2);
409  dmv = tmp_v1[j] * tmp_sgn * tmp_V;
410  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) { // for multply
411  tmp_v0[j] += dmv;
412  }
413  dam_pr = conj(tmp_v1[j]) * dmv;
414  return dam_pr;
415 }/*double complex child_CisAisCisAis_spin_element*/
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.
struct EDMainCalStruct X
Definition: struct.h:431

◆ child_exchange_spin_element()

double complex child_exchange_spin_element ( long unsigned int  j,
double complex *  tmp_v0,
double complex *  tmp_v1,
struct BindStruct X,
long unsigned int *  tmp_off 
)

Multiply Hamiltonian of exchange term of canonical spin system.

Returns
\(\langle v_1 | H_{\rm this}| v_1 \rangle\)
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[out]tmp_v0Resulting wavefunction
[in]tmp_v1Wavefunction to be multiplied
[in,out]X
[out]tmp_offIndex of final wavefunction

Definition at line 274 of file mltplySpinCore.c.

References GetOffComp(), list_1, list_2_1, list_2_2, and X.

Referenced by child_exchange_spin(), and makeHam().

280  {
281  long unsigned int off;
282  double complex dmv;
283  long unsigned int iexchg;
284  long unsigned int is_up = X->Large.isA_spin;
285  long unsigned int irght = X->Large.irght;
286  long unsigned int ilft = X->Large.ilft;
287  long unsigned int ihfbit = X->Large.ihfbit;
288  double complex tmp_J = X->Large.tmp_J;
289  int mode = X->Large.mode;
290  double complex dam_pr = 0;
291  long unsigned int ibit_tmp;
292 
293  ibit_tmp = (list_1[j] & is_up);
294  if (ibit_tmp == 0 || ibit_tmp == is_up) {
295  return dam_pr;
296  }
297  else {
298  iexchg = list_1[j] ^ is_up;
299  GetOffComp(list_2_1, list_2_2, iexchg, irght, ilft, ihfbit, &off);
300  *tmp_off = off;
301  dmv = tmp_J * tmp_v1[j];
302  if (mode == M_MLTPLY) {
303  tmp_v0[off] += dmv;
304  }
305  dam_pr += dmv * conj(tmp_v1[off]);
306  return dam_pr;
307  }
308 }/*double complex child_exchange_spin_element*/
long unsigned int * list_2_1
Definition: global.h:49
int GetOffComp(long unsigned int *_list_2_1, long unsigned int *_list_2_2, long unsigned int _ibit, const long unsigned int _irght, const long unsigned int _ilft, const long unsigned int _ihfbit, long unsigned int *_ioffComp)
function of getting off-diagonal component
Definition: bitcalc.c:195
long unsigned int * list_1
Definition: global.h:47
long unsigned int * list_2_2
Definition: global.h:50
struct EDMainCalStruct X
Definition: struct.h:431

◆ child_exchange_spin_GetInfo()

int child_exchange_spin_GetInfo ( int  iExchange,
struct BindStruct X 
)

Set parameters for the bit operation of spin-exchange term.

Returns
Always return 0
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)




Set the exchange coupling constant (LargeList::tmp_J)



Set the bit mask for computing spin state of both site (LargeList::is1_up, LargeList::is2_up)


Set the bit mask for exchange 2 spins (LargeList::isA_spin)

Parameters
[in]iExchangeCounter of exchange interaction
[in,out]X

Definition at line 36 of file mltplySpinCore.c.

References X.

Referenced by makeHam(), mltplyHalfSpin(), and mltplyHalfSpinGC().

39  {
40  int isite1 = X->Def.ExchangeCoupling[iExchange][0] + 1;
41  int isite2 = X->Def.ExchangeCoupling[iExchange][1] + 1;
45  X->Large.tmp_J = X->Def.ParaExchangeCoupling[iExchange];
50  X->Large.is1_up = X->Def.Tpow[isite1 - 1];
51  X->Large.is2_up = X->Def.Tpow[isite2 - 1];
55  X->Large.isA_spin = X->Large.is1_up + X->Large.is2_up;
56  return 0;
57 }/*int child_exchange_spin_GetInfo*/
struct EDMainCalStruct X
Definition: struct.h:431

◆ child_general_int_spin_GetInfo()

int child_general_int_spin_GetInfo ( struct BindStruct X,
long unsigned int  isite1,
long unsigned int  isite2,
long unsigned int  sigma1,
long unsigned int  sigma2,
long unsigned int  sigma3,
long unsigned int  sigma4,
double complex  tmp_V 
)

Set parameters for the bit operation of spin-general interaction term.

Returns
Always return 0
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)




Set the pairlift coupling constant (LargeList::tmp_J)



Set the bit mask for computing spin state of both site (LargeList::is1_up, LargeList::is2_up)


Set the bit mask for general interaction (LargeList::is1_spin, LargeList::is2_spin, LargeList::is3_spin, LargeList::is4_spin)

Parameters
[in,out]X
[in]isite1Site 1
[in]isite2Site 2
[in]sigma1Sigma 1, final state of site 1
[in]sigma2Sigma 3, initial state of site 1
[in]sigma3Sigma 3, final state of site 2
[in]sigma4Sigma 4, initial state of site 2
[in]tmp_VGeneral interaction constatnt

Definition at line 92 of file mltplySpinCore.c.

References X.

Referenced by makeHam(), mltplyHalfSpin(), and mltplyHalfSpinGC().

101  {
105  X->Large.tmp_V = tmp_V;
106  X->Large.isite1 = isite1;
107  X->Large.isite2 = isite2;
112  X->Large.is1_up = X->Def.Tpow[isite1 - 1];
113  X->Large.is2_up = X->Def.Tpow[isite2 - 1];
118  X->Large.is1_spin = sigma1;
119  X->Large.is2_spin = sigma2;
120  X->Large.is3_spin = sigma3;
121  X->Large.is4_spin = sigma4;
122  return 0;
123 }/*int child_general_int_spin_GetInfo*/
struct EDMainCalStruct X
Definition: struct.h:431

◆ child_pairlift_spin_GetInfo()

int child_pairlift_spin_GetInfo ( int  iPairLift,
struct BindStruct X 
)

Set parameters for the bit operation of spin-pairlift term.

Returns
Always return 0
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)




Set the pairlift coupling constant (LargeList::tmp_J)



Set the bit mask for computing spin state of both site (LargeList::is1_up, LargeList::is2_up)


Set the bit mask for exchange 2 spins (LargeList::isA_spin)

Definition at line 64 of file mltplySpinCore.c.

References X.

Referenced by makeHam(), and mltplyHalfSpinGC().

67  {
68  int isite1 = X->Def.PairLiftCoupling[iPairLift][0] + 1;
69  int isite2 = X->Def.PairLiftCoupling[iPairLift][1] + 1;
73  X->Large.tmp_J = X->Def.ParaPairLiftCoupling[iPairLift];
78  X->Large.is1_up = X->Def.Tpow[isite1 - 1];
79  X->Large.is2_up = X->Def.Tpow[isite2 - 1];
83  X->Large.isA_spin = X->Large.is1_up + X->Large.is2_up;
84  return 0;
85 }/*int child_pairlift_spin_GetInfo*/
struct EDMainCalStruct X
Definition: struct.h:431

◆ GC_child_CisAisCisAis_spin_element()

double complex GC_child_CisAisCisAis_spin_element ( long unsigned int  j,
long unsigned int  isA_up,
long unsigned int  isB_up,
long unsigned int  org_sigma2,
long unsigned int  org_sigma4,
double complex  tmp_V,
double complex *  tmp_v0,
double complex *  tmp_v1,
struct BindStruct X 
)

Compute \(c_{is}^\dagger c_{is} c_{is}^\dagger c_{is}\) term of grandcanonical spsin system.

Returns
Fragment of \(\langle v_1 | H_{\rm this}|v_1 \rangle\)
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[in]isA_upBit mask for spin 1
[in]isB_upBit mask for spin 2
[in]org_sigma2Target for spin 1
[in]org_sigma4Target for spin 2
[in]tmp_VCoupling constatnt
[in]tmp_v0Resulting wavefunction
[in]tmp_v1Wavefunction to be multiplied
[in,out]X

Definition at line 427 of file mltplySpinCore.c.

References X, and X_SpinGC_CisAis().

Referenced by expec_cisajscktalt_SpinGCHalf(), GC_child_general_int_spin(), and makeHam().

437  {
438  int tmp_sgn;
439  double complex dmv = 0;
440  double complex dam_pr = 0;
441 
442  tmp_sgn = X_SpinGC_CisAis(j, X, isB_up, org_sigma4);
443  tmp_sgn *= X_SpinGC_CisAis(j, X, isA_up, org_sigma2);
444  if (tmp_sgn != 0) {
445  dmv = tmp_v1[j] * tmp_sgn * tmp_V;
446  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) { // for multply
447  tmp_v0[j] += dmv;
448  }
449  dam_pr = conj(tmp_v1[j]) * dmv;
450  }
451  return dam_pr;
452 }/*double complex GC_child_CisAisCisAis_spin_element*/
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 EDMainCalStruct X
Definition: struct.h:431

◆ GC_child_CisAisCitAiu_spin_element()

double complex GC_child_CisAisCitAiu_spin_element ( long unsigned int  j,
long unsigned int  org_sigma2,
long unsigned int  org_sigma4,
long unsigned int  isA_up,
long unsigned int  isB_up,
double complex  tmp_V,
double complex *  tmp_v0,
double complex *  tmp_v1,
struct BindStruct X,
long unsigned int *  tmp_off 
)

Compute \(c_{is}^\dagger c_{is} c_{it}^\dagger c_{iu}\) term of grandcanonical spsin system.

Returns
Fragment of \(\langle v_1 | H_{\rm this}|v_1 \rangle\)
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[in]org_sigma2Target for spin 1
[in]org_sigma4Target for spin 2
[in]isA_upBit mask for spin 1
[in]isB_upBit mask for spin 2
[in]tmp_VCoupling constatnt
[in]tmp_v0Resulting wavefunction
[in]tmp_v1Wavefunction to be multiplied
[in,out]X
[out]tmp_offIndex of final wavefunction

Definition at line 460 of file mltplySpinCore.c.

References X, X_SpinGC_CisAis(), and X_SpinGC_CisAit().

Referenced by expec_cisajscktalt_SpinGCHalf(), GC_child_general_int_spin(), and makeHam().

471  {
472  int tmp_sgn;
473  double complex dmv;
474  double complex dam_pr = 0 + 0 * I;
475  tmp_sgn = X_SpinGC_CisAit(j, X, isB_up, org_sigma4, tmp_off);
476  if (tmp_sgn != 0) {
477  tmp_sgn *= X_SpinGC_CisAis((*tmp_off + 1), X, isA_up, org_sigma2);
478  if (tmp_sgn != 0) {
479  dmv = tmp_v1[j] * tmp_sgn * tmp_V;
480  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) { // for multply
481  tmp_v0[*tmp_off + 1] += dmv;
482  }
483  dam_pr = conj(tmp_v1[*tmp_off + 1]) * dmv;
484  }/*if (tmp_sgn != 0)*/
485  }/*if (tmp_sgn != 0)*/
486  return dam_pr;
487 }/*double complex GC_child_CisAisCitAiu_spin_element*/
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 EDMainCalStruct X
Definition: struct.h:431
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).

◆ GC_child_CisAitCiuAiu_spin_element()

double complex GC_child_CisAitCiuAiu_spin_element ( long unsigned int  j,
long unsigned int  org_sigma2,
long unsigned int  org_sigma4,
long unsigned int  isA_up,
long unsigned int  isB_up,
double complex  tmp_V,
double complex *  tmp_v0,
double complex *  tmp_v1,
struct BindStruct X,
long unsigned int *  tmp_off 
)

Compute \(c_{is}^\dagger c_{it} c_{iu}^\dagger c_{iu}\) term of grandcanonical spsin system.

Returns
Fragment of \(\langle v_1 | H_{\rm this}|v_1 \rangle\)
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[in]org_sigma2Target for spin 1
[in]org_sigma4Target for spin 2
[in]isA_upBit mask for spin 1
[in]isB_upBit mask for spin 2
[in]tmp_VCoupling constatnt
[in]tmp_v0Resulting wavefunction
[in]tmp_v1Wavefunction to be multiplied
[in,out]X
[out]tmp_offIndex of final wavefunction

Definition at line 495 of file mltplySpinCore.c.

References X, X_SpinGC_CisAis(), and X_SpinGC_CisAit().

Referenced by expec_cisajscktalt_SpinGCHalf(), GC_child_general_int_spin(), and makeHam().

506  {
507  int tmp_sgn;
508  double complex dmv;
509  double complex dam_pr = 0 + 0 * I;
510  tmp_sgn = X_SpinGC_CisAis(j, X, isB_up, org_sigma4);
511  if (tmp_sgn != 0) {
512  tmp_sgn *= X_SpinGC_CisAit(j, X, isA_up, org_sigma2, tmp_off);
513  if (tmp_sgn != 0) {
514  dmv = tmp_v1[j] * tmp_sgn * tmp_V;
515  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) { // for multply
516  tmp_v0[*tmp_off + 1] += dmv;
517  }
518  dam_pr = conj(tmp_v1[*tmp_off + 1]) * dmv;
519  }/*if (tmp_sgn != 0)*/
520  }/*if (tmp_sgn != 0)*/
521  return dam_pr;
522 }/*double complex GC_child_CisAitCiuAiu_spin_element*/
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 EDMainCalStruct X
Definition: struct.h:431
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).

◆ GC_child_CisAitCiuAiv_spin_element()

double complex GC_child_CisAitCiuAiv_spin_element ( long unsigned int  j,
long unsigned int  org_sigma2,
long unsigned int  org_sigma4,
long unsigned int  isA_up,
long unsigned int  isB_up,
double complex  tmp_V,
double complex *  tmp_v0,
double complex *  tmp_v1,
struct BindStruct X,
long unsigned int *  tmp_off_2 
)

Compute \(c_{is}^\dagger c_{it} c_{iu}^\dagger c_{iv}\) term of grandcanonical spsin system.

Returns
Fragment of \(\langle v_1 | H_{\rm this}|v_1 \rangle\)
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[in]org_sigma2Target for spin 1
[in]org_sigma4Target for spin 2
[in]isA_upBit mask for spin 1
[in]isB_upBit mask for spin 2
[in]tmp_VCoupling constatnt
[in]tmp_v0Resulting wavefunction
[in]tmp_v1Wavefunction to be multiplied
[in,out]X
[out]tmp_off_2Index of final wavefunction

Definition at line 530 of file mltplySpinCore.c.

References X, and X_SpinGC_CisAit().

Referenced by expec_cisajscktalt_SpinGCHalf(), GC_child_general_int_spin(), and makeHam().

541  {
542  int tmp_sgn;
543  long unsigned int tmp_off_1;
544  double complex dmv;
545  double complex dam_pr = 0 + 0 * I;
546  tmp_sgn = X_SpinGC_CisAit(j, X, isB_up, org_sigma4, &tmp_off_1);
547  if (tmp_sgn != 0) {
548  tmp_sgn *= X_SpinGC_CisAit((tmp_off_1 + 1), X, isA_up, org_sigma2, tmp_off_2);
549  if (tmp_sgn != 0) {
550  dmv = tmp_v1[j] * tmp_sgn * tmp_V;
551  if (X->Large.mode == M_MLTPLY || X->Large.mode == M_CALCSPEC) { // for multply
552  tmp_v0[*tmp_off_2 + 1] += dmv;
553  }
554  dam_pr = conj(tmp_v1[*tmp_off_2 + 1]) * dmv;
555  }/*if (tmp_sgn != 0)*/
556  }/*if (tmp_sgn != 0)*/
557  return dam_pr;
558 }/*double complex GC_child_CisAitCiuAiv_spin_element*/
struct EDMainCalStruct X
Definition: struct.h:431
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).

◆ GC_child_exchange_spin_element()

double complex GC_child_exchange_spin_element ( long unsigned int  j,
double complex *  tmp_v0,
double complex *  tmp_v1,
struct BindStruct X,
long unsigned int *  tmp_off 
)

Multiply Hamiltonian of exchange term of grandcanonical spin system.

Returns
\(\langle v_1 | H_{\rm this}| v_1 \rangle\)
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[out]tmp_v0Resulting wavefunction
[in]tmp_v1Wavefunction to be multiplied
[in,out]X
[out]tmp_offIndex of final wavefunction

Definition at line 315 of file mltplySpinCore.c.

References X.

Referenced by GC_child_exchange_spin(), and makeHam().

321  {
322  double complex dmv;
323  long unsigned int is_up = X->Large.isA_spin;
324  double complex tmp_J = X->Large.tmp_J;
325  int mode = X->Large.mode;
326  long unsigned int list_1_j, list_1_off;
327 
328  double complex dam_pr = 0;
329  list_1_j = j - 1;
330 
331  long unsigned int ibit_tmp;
332  ibit_tmp = (list_1_j & is_up);
333  if (ibit_tmp == 0 || ibit_tmp == is_up) {
334  return dam_pr;
335  }
336  else {
337  list_1_off = list_1_j ^ is_up;
338  *tmp_off = list_1_off;
339  dmv = tmp_J * tmp_v1[j];
340  if (mode == M_MLTPLY) {
341  tmp_v0[list_1_off + 1] += dmv;
342  }
343  dam_pr += dmv * conj(tmp_v1[list_1_off + 1]);
344  return dam_pr;
345  }
346 }/*double complex GC_child_exchange_spin_element*/
struct EDMainCalStruct X
Definition: struct.h:431

◆ GC_child_pairlift_spin_element()

double complex GC_child_pairlift_spin_element ( long unsigned int  j,
double complex *  tmp_v0,
double complex *  tmp_v1,
struct BindStruct X,
long unsigned int *  tmp_off 
)

Multiply Hamiltonian of pairlift term of grandcanonical spin system.

Returns
\(\langle v_1 | H_{\rm this}| v_1 \rangle\)
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[out]tmp_v0Resulting wavefunction
[in]tmp_v1Wavefunction to be multiplied
[in,out]X
[out]tmp_offIndex of final wavefunction

Definition at line 353 of file mltplySpinCore.c.

References X.

Referenced by GC_child_pairlift_spin(), and makeHam().

359  {
360  double complex dmv;
361  long unsigned int is_up = X->Large.isA_spin;
362  double complex tmp_J = X->Large.tmp_J;
363  int mode = X->Large.mode;
364  double complex dam_pr = 0;
365  long unsigned int list_1_off;
366  long unsigned int list_1_j = j - 1;
367  long unsigned int ibit_tmp;
368  //ibit_tmp = ((list_1_j & is1_up) / is1_up) ^ ((list_1_j & is2_up) / is2_up);
369  ibit_tmp = (list_1_j & is_up);
370  if (ibit_tmp == 0 || ibit_tmp == is_up) {
371  list_1_off = list_1_j ^ is_up; //Change: ++ -> -- or -- -> ++
372  *tmp_off = list_1_off;
373  dmv = tmp_J * tmp_v1[j];//* ibit_tmp;
374  if (mode == M_MLTPLY) {
375  tmp_v0[list_1_off + 1] += dmv;
376  }
377  dam_pr += dmv * conj(tmp_v1[list_1_off + 1]);
378  return dam_pr;
379  }
380  else {
381  return dam_pr;
382  }
383 }/*double complex GC_child_pairlift_spin_element*/
struct EDMainCalStruct X
Definition: struct.h:431

◆ X_child_exchange_spin_element()

int X_child_exchange_spin_element ( long unsigned int  j,
struct BindStruct X,
long unsigned int  isA_up,
long unsigned int  isB_up,
long unsigned int  sigmaA,
long unsigned int  sigmaB,
long unsigned int *  tmp_off 
)

Compute index of final wavefunction associated to spin-exchange term.

Returns
1 if spin of site 1 is sigmaA and spin of site 2 is sigmaB. 0 if not.
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[in,out]X
[in]isA_upBit mask for spin 1
[in]isB_upBit mask for spin 2
[in]sigmaATarget of spin 1
[in]sigmaBTarget of spin 2
[out]tmp_offIndex of final wavefunction

Definition at line 240 of file mltplySpinCore.c.

References GetOffComp(), list_1, list_2_1, list_2_2, and X.

Referenced by child_general_int_spin(), expec_cisajscktalt_SpinHalf(), and makeHam().

248  {
249  long unsigned int iexchg, off;
250  long unsigned int irght = X->Large.irght;
251  long unsigned int ilft = X->Large.ilft;
252  long unsigned int ihfbit = X->Large.ihfbit;
253  long unsigned int ibit_tmp_A, ibit_tmp_B;
254 
255  ibit_tmp_A = ((list_1[j] & isA_up) / isA_up);
256  ibit_tmp_B = ((list_1[j] & isB_up) / isB_up);
257  if (ibit_tmp_A == sigmaA && ibit_tmp_B == sigmaB) {
258  iexchg = list_1[j] ^ (isA_up + isB_up);
259  GetOffComp(list_2_1, list_2_2, iexchg, irght, ilft, ihfbit, &off);
260  *tmp_off = off;
261  return 1;
262  }
263  else {
264  *tmp_off = 0; // just tentative
265  return 0;
266  }
267 }/*int X_child_exchange_spin_element*/
long unsigned int * list_2_1
Definition: global.h:49
int GetOffComp(long unsigned int *_list_2_1, long unsigned int *_list_2_2, long unsigned int _ibit, const long unsigned int _irght, const long unsigned int _ilft, const long unsigned int _ihfbit, long unsigned int *_ioffComp)
function of getting off-diagonal component
Definition: bitcalc.c:195
long unsigned int * list_1
Definition: global.h:47
long unsigned int * list_2_2
Definition: global.h:50
struct EDMainCalStruct X
Definition: struct.h:431

◆ X_Spin_CisAis()

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.

Returns
1 if the spin state with bit mask is1_spin is sigma1, 0 for the other.
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of wavefunction
[in,out]X
[in]is1_spinBit mask
[in]sigma1Target spin state

Definition at line 167 of file mltplySpinCore.c.

References list_1.

Referenced by child_CisAisCisAis_spin_element(), expec_cisajs_SpinHalf(), expec_cisajscktalt_SpinHalf(), GetPairExcitedStateHalfSpin(), makeHam(), SetDiagonalInterAll(), and SetDiagonalTEInterAll().

172  {
173  int A_ibit_tmp;
174  // off = j
175  A_ibit_tmp = ((list_1[j] & is1_spin) / is1_spin) ^ (1 - sigma1);
176  return A_ibit_tmp;
177 }/*int X_Spin_CisAis*/
long unsigned int * list_1
Definition: global.h:47

◆ X_Spin_CisAit()

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 \(c_{is}^\dagger c_{it}\) term.

Returns
1 if bit-mask is1_spin is sigma2, 0 for the other
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of initial wavefunction
[in,out]X
[in]is1_spinBit mask for computing spin state
[in]sigma2Spin state at site 2
[in]list_1_Org_Similar to list_1
[in]list_2_1_Similar to list_2_1
[in]list_2_2_Similar to list_2_2
[out]tmp_offIndex of final wavefunction

Definition at line 139 of file mltplySpinCore.c.

References GetOffComp(), X, and X_SpinGC_CisAit().

Referenced by GetPairExcitedStateHalfSpin().

148  {
149  long unsigned int list_1_j;
150  long unsigned int off;
151  list_1_j = list_1_Org_[j];
152  if (X_SpinGC_CisAit(list_1_j + 1, X, is1_spin, sigma2, &off) != 0) {
153  GetOffComp(list_2_1_, list_2_2_, off, X->Large.irght, X->Large.ilft, X->Large.ihfbit, tmp_off);
154  return 1;
155  }
156  else {
157  *tmp_off = 0;
158  return 0;
159  }
160 }/*int X_Spin_CisAit*/
int GetOffComp(long unsigned int *_list_2_1, long unsigned int *_list_2_2, long unsigned int _ibit, const long unsigned int _irght, const long unsigned int _ilft, const long unsigned int _ihfbit, long unsigned int *_ioffComp)
function of getting off-diagonal component
Definition: bitcalc.c:195
struct EDMainCalStruct X
Definition: struct.h:431
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).

◆ X_SpinGC_CisAis()

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.

Returns
1 if the spin state with bit mask is1_spin is sigma1, 0 for the other.
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of wavefunction
[in,out]X
[in]is1_spinBit mask
[in]sigma1Target spin state

Definition at line 184 of file mltplySpinCore.c.

Referenced by expec_cisajs_SpinGCHalf(), expec_cisajs_SpinHalf(), expec_cisajscktalt_SpinHalf(), GC_child_CisAisCisAis_spin_element(), GC_child_CisAisCitAiu_spin_element(), GC_child_CisAitCiuAiu_spin_element(), GetPairExcitedStateHalfSpin(), GetPairExcitedStateHalfSpinGC(), SetDiagonalInterAll(), SetDiagonalTEInterAll(), totalspin_Spin(), totalspin_SpinGC(), X_GC_child_CisAisCjuAju_spin_MPIdouble(), X_GC_child_CisAisCjuAju_spin_MPIsingle(), X_GC_child_CisAisCjuAjv_spin_MPIdouble(), and X_GC_child_CisAitCjuAju_spin_MPIdouble().

189  {
190  int A_ibit_tmp;
191  long unsigned int list_1_j;
192  // off = j
193  list_1_j = j - 1;
194  A_ibit_tmp = ((list_1_j & is1_spin) / is1_spin) ^ (1 - sigma1);
195  return A_ibit_tmp;
196 }/*int X_SpinGC_CisAis*/

◆ X_SpinGC_CisAit()

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 \(c_{is}^\dagger c_{it}\) term (grandcanonical).

Returns
1 if bit-mask is1_spin is sigma2, 0 for the other
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Parameters
[in]jIndex of wavefunction
[in,out]X
[in]is1_spinBit mask for computing spin state
[in]sigma2Spin state at site 2
[out]tmp_offIndex of final wavefunction

Definition at line 204 of file mltplySpinCore.c.

Referenced by expec_cisajs_SpinGCHalf(), GC_child_CisAisCitAiu_spin_element(), GC_child_CisAitCiuAiu_spin_element(), GC_child_CisAitCiuAiv_spin_element(), GetPairExcitedStateHalfSpinGC(), makeHam(), mltplyHalfSpinGC(), X_GC_child_CisAitCiuAiv_spin_MPIsingle(), and X_Spin_CisAit().

210  {
211  long unsigned int list_1_j, ibit_tmp_1;
212 
213  list_1_j = j - 1;
214 
215  ibit_tmp_1 = list_1_j & is1_spin;
216  if (ibit_tmp_1 == 0 && sigma2 == 0) { // down -> up
217  *tmp_off = list_1_j + is1_spin;
218  return 1;
219  }
220  else if (ibit_tmp_1 != 0 && sigma2 == 1) { // up -> down
221  *tmp_off = list_1_j - is1_spin;
222  return 1;
223  }
224  else {
225  *tmp_off = 0;
226  return 0;
227  }
228 }/*int X_SpinGC_CisAit*/