18 #include "mltplyCommon.h" 20 #include "expec_energy_flct.h" 21 #include "wrapperMPI.h" 36 long unsigned int i,j;
37 long unsigned int irght,ilft,ihfbit;
38 double complex dam_pr,dam_pr1;
39 long unsigned int i_max;
125 #pragma omp parallel for default(none) private(i) shared(v1,v0) firstprivate(i_max) 126 for(i = 1; i <= i_max; i++){
148 #pragma omp parallel for default(none) reduction(+:dam_pr, dam_pr1) private(j) shared(v0, v1)firstprivate(i_max) 149 for(j=1;j<=i_max;j++){
150 dam_pr += conj(
v1[j])*
v0[j];
151 dam_pr1 += conj(
v0[j])*
v0[j];
187 long unsigned int isite1;
188 long unsigned int is1_up_a, is1_up_b;
189 long unsigned int is1_down_a, is1_down_b;
190 int bit_up, bit_down, bit_D;
191 long unsigned int ibit_up, ibit_down, ibit_D;
192 double D, tmp_D, tmp_D2;
193 double N, tmp_N, tmp_N2;
194 double Sz, tmp_Sz, tmp_Sz2;
196 long unsigned int i_max;
197 unsigned int l_ibit1, u_ibit1, i_32;
214 for (isite1 = 1; isite1 <= X->
Def.
NsiteMPI; isite1++) {
216 is1_up_a += X->
Def.
Tpow[2 * isite1 - 2];
217 is1_down_a += X->
Def.
Tpow[2 * isite1 - 1];
219 is1_up_b += X->
Def.
Tpow[2 * isite1 - 2];
220 is1_down_b += X->
Def.
Tpow[2 * isite1 - 1];
224 #pragma omp parallel for reduction(+:tmp_D,tmp_D2,tmp_N,tmp_N2,tmp_Sz,tmp_Sz2) default(none) shared(v0,list_1) \ 225 firstprivate(i_max, X,myrank,is1_up_a,is1_down_a,is1_up_b,is1_down_b,i_32) \ 226 private(j, tmp_v02,D,N,Sz,isite1,bit_up,bit_down,bit_D,u_ibit1,l_ibit1,ibit_up,ibit_down,ibit_D) 227 for (j = 1; j <= i_max; j++) {
228 tmp_v02 = conj(
v0[j]) *
v0[j];
233 ibit_up = (
unsigned long int)
myrank & is1_up_a;
234 u_ibit1 = ibit_up >> 32;
235 l_ibit1 = ibit_up & i_32;
236 bit_up +=
pop(u_ibit1);
237 bit_up +=
pop(l_ibit1);
239 ibit_down = (
unsigned long int)
myrank & is1_down_a;
240 u_ibit1 = ibit_down >> 32;
241 l_ibit1 = ibit_down & i_32;
242 bit_down +=
pop(u_ibit1);
243 bit_down +=
pop(l_ibit1);
245 ibit_D = (ibit_up) & (ibit_down >> 1);
246 u_ibit1 = ibit_D >> 32;
247 l_ibit1 = ibit_D & i_32;
248 bit_D +=
pop(u_ibit1);
249 bit_D +=
pop(l_ibit1);
252 ibit_up = (
unsigned long int) (j - 1) & is1_up_b;
253 u_ibit1 = ibit_up >> 32;
254 l_ibit1 = ibit_up & i_32;
255 bit_up +=
pop(u_ibit1);
256 bit_up +=
pop(l_ibit1);
258 ibit_down = (
unsigned long int) (j - 1) & is1_down_b;
259 u_ibit1 = ibit_down >> 32;
260 l_ibit1 = ibit_down & i_32;
261 bit_down +=
pop(u_ibit1);
262 bit_down +=
pop(l_ibit1);
264 ibit_D = (ibit_up) & (ibit_down >> 1);
265 u_ibit1 = ibit_D >> 32;
266 l_ibit1 = ibit_D & i_32;
267 bit_D +=
pop(u_ibit1);
268 bit_D +=
pop(l_ibit1);
271 N = bit_up + bit_down;
272 Sz = bit_up - bit_down;
274 tmp_D += tmp_v02 * D;
275 tmp_D2 += tmp_v02 * D * D;
276 tmp_N += tmp_v02 * N;
277 tmp_N2 += tmp_v02 * N * N;
278 tmp_Sz += tmp_v02 * Sz;
279 tmp_Sz2 += tmp_v02 * Sz * Sz;
307 long unsigned int isite1;
308 long unsigned int is1_up_a,is1_up_b;
309 long unsigned int is1_down_a,is1_down_b;
310 int bit_up,bit_down,bit_D;
312 long unsigned int ibit_up,ibit_down,ibit_D;
313 double D,tmp_D,tmp_D2;
314 double N,tmp_N,tmp_N2;
315 double Sz,tmp_Sz, tmp_Sz2;
317 long unsigned int i_max,tmp_list_1;
318 unsigned int l_ibit1,u_ibit1,i_32;
321 i_32 = (
unsigned int)(pow(2,32)-1);
337 is1_up_a += X->
Def.
Tpow[2*isite1 - 2];
338 is1_down_a += X->
Def.
Tpow[2*isite1 - 1];
340 is1_up_b += X->
Def.
Tpow[2*isite1 - 2];
341 is1_down_b += X->
Def.
Tpow[2*isite1 - 1];
345 #pragma omp parallel for reduction(+:tmp_D,tmp_D2,tmp_N,tmp_N2,tmp_Sz,tmp_Sz2) default(none) shared(v0,list_1) \ 346 firstprivate(i_max, X,myrank,is1_up_a,is1_down_a,is1_up_b,is1_down_b,i_32) \ 347 private(j, tmp_v02,D,N,Sz,isite1,tmp_list_1,bit_up,bit_down,bit_D,u_ibit1,l_ibit1,ibit_up,ibit_down,ibit_D) 348 for(j = 1; j <= i_max; j++) {
349 tmp_v02 = conj(
v0[j]) *
v0[j];
355 ibit_up = (
unsigned long int)
myrank & is1_up_a;
356 u_ibit1 = ibit_up >> 32;
357 l_ibit1 = ibit_up & i_32;
358 bit_up +=
pop(u_ibit1);
359 bit_up +=
pop(l_ibit1);
361 ibit_down = (
unsigned long int)
myrank & is1_down_a;
362 u_ibit1 = ibit_down >> 32;
363 l_ibit1 = ibit_down & i_32;
364 bit_down +=
pop(u_ibit1);
365 bit_down +=
pop(l_ibit1);
367 ibit_D = (ibit_up) & (ibit_down >> 1);
368 u_ibit1 = ibit_D >> 32;
369 l_ibit1 = ibit_D & i_32;
370 bit_D +=
pop(u_ibit1);
371 bit_D +=
pop(l_ibit1);
374 ibit_up = (
unsigned long int) tmp_list_1 & is1_up_b;
375 u_ibit1 = ibit_up >> 32;
376 l_ibit1 = ibit_up & i_32;
377 bit_up +=
pop(u_ibit1);
378 bit_up +=
pop(l_ibit1);
380 ibit_down = (
unsigned long int) tmp_list_1 & is1_down_b;
381 u_ibit1 = ibit_down >> 32;
382 l_ibit1 = ibit_down & i_32;
383 bit_down +=
pop(u_ibit1);
384 bit_down +=
pop(l_ibit1);
386 ibit_D = (ibit_up) & (ibit_down >> 1);
387 u_ibit1 = ibit_D >> 32;
388 l_ibit1 = ibit_D & i_32;
389 bit_D +=
pop(u_ibit1);
390 bit_D +=
pop(l_ibit1);
393 N = bit_up + bit_down;
394 Sz = bit_up - bit_down;
396 tmp_D += tmp_v02 * D;
397 tmp_D2 += tmp_v02 * D * D;
398 tmp_N += tmp_v02 * N;
399 tmp_N2 += tmp_v02 * N * N;
400 tmp_Sz += tmp_v02 * Sz;
401 tmp_Sz2 += tmp_v02 * Sz * Sz;
430 long unsigned int isite1;
431 long unsigned int is1_up_a,is1_up_b;
433 long unsigned int ibit1;
434 double Sz,tmp_Sz, tmp_Sz2;
436 long unsigned int i_max;
437 unsigned int l_ibit1,u_ibit1,i_32;
451 is1_up_a += X->
Def.
Tpow[isite1 - 1];
453 is1_up_b += X->
Def.
Tpow[isite1 - 1];
457 #pragma omp parallel for reduction(+:tmp_Sz,tmp_Sz2)default(none) shared(v0) \ 458 firstprivate(i_max,X,myrank,i_32,is1_up_a,is1_up_b) private(j,Sz,ibit1,isite1,tmp_v02,u_ibit1,l_ibit1) 459 for(j = 1; j <= i_max; j++){
460 tmp_v02 = conj(
v0[j])*
v0[j];
464 ibit1 = (
unsigned long int)
myrank & is1_up_a;
465 u_ibit1 = ibit1 >> 32;
466 l_ibit1 = ibit1 & i_32;
470 ibit1 = (
unsigned long int) (j-1)&is1_up_b;
471 u_ibit1 = ibit1 >> 32;
472 l_ibit1 = ibit1 & i_32;
477 tmp_Sz += Sz*tmp_v02;
478 tmp_Sz2 += Sz*Sz*tmp_v02;
502 long unsigned int isite1;
504 double Sz,tmp_Sz, tmp_Sz2;
506 long unsigned int i_max;
513 for(j = 1; j <= i_max; j++){
514 tmp_v02 = conj(
v0[j])*
v0[j];
524 tmp_Sz += Sz*tmp_v02;
525 tmp_Sz2 += Sz*Sz*tmp_v02;
550 long unsigned int isite1;
551 long unsigned int is1_up_a,is1_up_b;
553 long unsigned int ibit1;
554 double Sz,tmp_Sz, tmp_Sz2;
556 long unsigned int i_max, tmp_list_1;
557 unsigned int l_ibit1,u_ibit1,i_32;
571 is1_up_a += X->
Def.
Tpow[isite1 - 1];
573 is1_up_b += X->
Def.
Tpow[isite1 - 1];
577 #pragma omp parallel for reduction(+:tmp_Sz,tmp_Sz2)default(none) shared(v0, list_1) \ 578 firstprivate(i_max,X,myrank,i_32,is1_up_a,is1_up_b) private(j,Sz,ibit1,isite1,tmp_v02,u_ibit1,l_ibit1, tmp_list_1) 579 for(j = 1; j <= i_max; j++){
580 tmp_v02 = conj(
v0[j])*
v0[j];
585 ibit1 = (
unsigned long int)
myrank & is1_up_a;
586 u_ibit1 = ibit1 >> 32;
587 l_ibit1 = ibit1 & i_32;
591 ibit1 = (
unsigned long int) tmp_list_1 &is1_up_b;
592 u_ibit1 = ibit1 >> 32;
593 l_ibit1 = ibit1 & i_32;
598 tmp_Sz += Sz*tmp_v02;
599 tmp_Sz2 += Sz*Sz*tmp_v02;
623 long unsigned int isite1;
625 double Sz,tmp_Sz, tmp_Sz2;
627 long unsigned int i_max, tmp_list1;
634 #pragma omp parallel for reduction(+:tmp_Sz,tmp_Sz2)default(none) shared(v0, list_1) \ 635 firstprivate(i_max,X,myrank) private(j,Sz,isite1,tmp_v02, tmp_list1) 636 for(j = 1; j <= i_max; j++){
637 tmp_v02 = conj(
v0[j])*
v0[j];
648 tmp_Sz += Sz*tmp_v02;
649 tmp_Sz2 += Sz*Sz*tmp_v02;
struct DefineList Def
Definision of system (Hamiltonian) etc.
int mltply(struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1)
Parent function of multiplying the wavefunction by the Hamiltonian. . First, the calculation of diago...
void StartTimer(int n)
function for initializing elapse time [start]
const char * cTPQExpecEnd
double complex SumMPI_dc(double complex norm)
MPI wrapper function to obtain sum of Double complex across processes.
long unsigned int ihfbit
Used for Ogata-Lin ???
unsigned long int idim_max
The dimension of the Hilbert space of this process.
double num_up
Expectation value of the number of up-spin electtrons.
void StopTimer(int n)
function for calculating elapse time [elapse time=StartTimer-StopTimer]
const char * cTPQExpecStart
int expec_energy_flct_GeneralSpin(struct BindStruct *X)
Calculate expected values of energies and physical quantities for General-Spin model.
struct LargeList Large
Variables for Matrix-Vector product.
double SumMPI_d(double norm)
MPI wrapper function to obtain sum of Double across processes.
double num_down
Expectation value of the number of down-spin electtrons.
struct PhysList Phys
Physical quantities.
int expec_energy_flct_HubbardGC(struct BindStruct *X)
Calculate expected values of energies and physical quantities for Hubbard GC model.
double Sz2
Expectation value of the Square of total Sz.
int mode
multiply or expectation value.
int GetLocal2Sz(const unsigned int isite, const long unsigned int org_bit, const long int *SiteToBit, const long unsigned int *Tpow)
get 2sz at a site for general spin
double num
Expectation value of the Number of electrons.
unsigned int Nsite
Number of sites in the INTRA process region.
int pop(unsigned int x)
calculating number of 1-bits in x (32 bit) This method is introduced in S.H. Warren, Hacker$B!G(Bs Delight, second ed., Addison-Wesley, ISBN: 0321842685, 2012.
long unsigned int * Tpow
[2 * DefineList::NsiteMPI] malloc in setmem_def().
long unsigned int ilft
Used for Ogata-Lin ???
int GetSplitBitByModel(const int Nsite, const int iCalcModel, long unsigned int *irght, long unsigned int *ilft, long unsigned int *ihfbit)
function of splitting original bit into right and left spaces.
long int i_max
Length of eigenvector.
unsigned int NsiteMPI
Total number of sites, differ from DefineList::Nsite.
double var
Expectation value of the Energy variance.
int iFlgGeneralSpin
Flag for the general (Sz/=1/2) spin.
long unsigned int * list_1
int expec_energy_flct_GeneralSpinGC(struct BindStruct *X)
Calculate expected values of energies and physical quantities for General-SpinGC model.
const char * cLogExpecEnergyStart
long int * SiteToBit
[DefineList::NsiteMPI] Similar to DefineList::Tpow. For general spin.
const char * cFileNameTimeKeep
int expec_energy_flct_Hubbard(struct BindStruct *X)
Calculate expected values of energies and physical quantities for Hubbard model.
int expec_energy_flct_HalfSpin(struct BindStruct *X)
Calculate expected values of energies and physical quantities for Half-Spin model.
long unsigned int irght
Used for Ogata-Lin ???
double doublon
Expectation value of the Doublon.
int iCalcModel
Switch for model. 0:Hubbard, 1:Spin, 2:Kondo, 3:HubbardGC, 4:SpinGC, 5:KondoGC, 6:HubbardNConserved.
double Sz
Expectation value of the Total Sz.
int myrank
Process ID, defined in InitializeMPI()
int expec_energy_flct(struct BindStruct *X)
Parent function to calculate expected values of energy and physical quantities.
const char * cLogExpecEnergyEnd
double energy
Expectation value of the total energy.
int expec_energy_flct_HalfSpinGC(struct BindStruct *X)
Calculate expected values of energies and physical quantities for Half-SpinGC model.
struct CheckList Check
Size of the Hilbert space.
double num2
Expectation value of the quare of the number of electrons.
int TimeKeeperWithStep(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int istep)
Functions for writing a time log.
double doublon2
Expectation value of the Square of doublon.
int TimeKeeper(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType)
Functions for writing a time log.
int Total2SzMPI
Total across processes.
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()