24 double dnorm, dnorm_inv;
25 double complex dam_pr1,dam_pr2a,dam_pr2b,dam_pr3,dam_pr4;
26 double E1,E2a,E2b,E3,E4;
27 double alpha_p,alpha_m;
29 double Lz_Ene_p,Lz_Ene_m;
30 double Lz_Var_p,Lz_Var_m;
38 for(i_Lz=0;i_Lz<50;i_Lz++){
42 #pragma omp parallel for default(none) private(i) shared(v0) firstprivate(i_max) 43 for(i = 1; i <= i_max; i++){
50 #pragma omp parallel for default(none) reduction(+:dam_pr1,dam_pr2a) private(j) shared(v0, v1)firstprivate(i_max) 51 for(j=1;j<=i_max;j++){
52 dam_pr1 += conj(
v1[j])*
v0[j];
53 dam_pr2a += conj(
v0[j])*
v0[j];
59 E2a = creal(dam_pr2a);
61 #pragma omp parallel for default(none) private(i) shared(vg) firstprivate(i_max) 62 for(i = 1; i <= i_max; i++){
70 #pragma omp parallel for default(none) reduction(+:dam_pr2b,dam_pr3, dam_pr4) private(j) shared(v0,v1, vg)firstprivate(i_max) 71 for(j=1;j<=i_max;j++){
72 dam_pr2b += conj(
vg[j])*
v1[j];
73 dam_pr3 += conj(
vg[j])*
v0[j];
74 dam_pr4 += conj(
vg[j])*
vg[j];
81 E2b = creal(dam_pr2b) ;
86 fprintf(
stdoutMPI,
"Power Lanczos break \n");
91 Lz(X,alpha_p,&Lz_Ene_p,&Lz_Var_p,E1,E2a,E3,E4);
92 Lz(X,alpha_m,&Lz_Ene_m,&Lz_Var_m,E1,E2a,E3,E4);
94 if(Lz_Ene_p < Lz_Ene_m){
96 fprintf(
stdoutMPI,
"Power Lanczos (P): %.16lf %.16lf \n",Lz_Ene_p,Lz_Var_p);
97 #pragma omp parallel for default(none) private(j) shared(v0, v1) firstprivate(i_max,alpha_p) 98 for(j=1;j<=i_max;j++){
99 v1[j] =
v1[j]+alpha_p*
v0[j];
103 fprintf(
stdoutMPI,
"Power Lanczos (M): %.16lf %.16lf \n",Lz_Ene_m,Lz_Var_m);
104 #pragma omp parallel for default(none) private(j) shared(v0, v1)firstprivate(i_max,alpha_m) 105 for(j=1;j<=i_max;j++){
106 v1[j] =
v1[j]+alpha_m*
v0[j];
111 #pragma omp parallel for default(none) reduction(+:dnorm) private(j) shared(v1) firstprivate(i_max) 112 for(j=1;j<=i_max;j++){
113 dnorm += conj(
v1[j])*
v1[j];
118 #pragma omp parallel for default(none) private(j) shared(v1) firstprivate(i_max, dnorm_inv) 119 for(j=1;j<=i_max;j++){
120 v1[j] =
v1[j]*dnorm_inv;
123 fprintf(
stdoutMPI,
"Power Lanczos break \n");
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...
double complex SumMPI_dc(double complex norm)
MPI wrapper function to obtain sum of Double complex across processes.
unsigned long int idim_max
The dimension of the Hilbert space of this process.
double SumMPI_d(double norm)
MPI wrapper function to obtain sum of Double across processes.
void Lz(struct BindStruct *X, double alpha, double *Lz_Ene, double *Lz_Var, double E1, double E2, double E3, double E4)
int solve_2ndPolinomial(struct BindStruct *X, double *alpha_p, double *alpha_m, double E1, double E2a, double E2b, double E3, double E4)
struct CheckList Check
Size of the Hilbert space.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()