From 50865dfd3519efc445dd0922efc5a9ac6150141f Mon Sep 17 00:00:00 2001 From: k-yoshimi Date: Fri, 19 Jul 2019 07:27:32 +0900 Subject: [PATCH] delete unused variables and set initialze value --- src/CalcByTEM.c | 5 ++--- src/CalcSpectrumByBiCG.c | 8 +++++-- src/HPhiTrans.c | 44 ++------------------------------------ src/Lanczos_EigenValue.c | 2 +- src/StdFace/StdFace_main.c | 11 +++++----- src/bitcalc.c | 1 - src/check.c | 3 +-- src/eigenIO.c | 2 -- src/mltplyMPIHubbardCore.c | 4 +--- src/mltplyMPISpinCore.c | 1 - src/readdef.c | 8 ++----- src/xsetmem.c | 7 ------ 12 files changed, 20 insertions(+), 76 deletions(-) diff --git a/src/CalcByTEM.c b/src/CalcByTEM.c index 28d289327..17ccf143e 100644 --- a/src/CalcByTEM.c +++ b/src/CalcByTEM.c @@ -54,7 +54,6 @@ int CalcByTEM( const int ExpecInterval, struct EDMainCalStruct *X ) { - size_t byte_size; char *defname; char sdt[D_FileNameMax]; char sdt_phys[D_FileNameMax]; @@ -90,8 +89,8 @@ int CalcByTEM( fclose(fp); exitMPI(-1); } - byte_size = fread(&step_initial, sizeof(int), 1, fp); - byte_size = fread(&i_max, sizeof(long int), 1, fp); + fread(&step_initial, sizeof(int), 1, fp); + fread(&i_max, sizeof(long int), 1, fp); if (i_max != X->Bind.Check.idim_max) { fprintf(stderr, "Error: A file of Inputvector is incorrect.\n"); fclose(fp); diff --git a/src/CalcSpectrumByBiCG.c b/src/CalcSpectrumByBiCG.c index 06226a480..c6bdac3a3 100644 --- a/src/CalcSpectrumByBiCG.c +++ b/src/CalcSpectrumByBiCG.c @@ -217,10 +217,10 @@ int CalcSpectrumByBiCG( unsigned long int idim, i_max; FILE *fp; size_t byte_size; - int iret, max_step; + int iret; unsigned long int liLanczosStp_vec = 0; double complex *v12, *v14, res_proj; - int stp, one = 1, status[3], iomega; + int stp, status[3], iomega; double *resz; fprintf(stdoutMPI, "##### Spectrum calculation with BiCG #####\n\n"); @@ -302,7 +302,11 @@ int CalcSpectrumByBiCG( v14[idim] = 0.0; } iret = mltply(&X->Bind, v12, v2); + if (iret == -1){ + return FALSE; + } iret = mltply(&X->Bind, v14, v4); + if (iret == -1) return FALSE; res_proj = VecProdMPI(X->Bind.Check.idim_max, vrhs, v2); /** diff --git a/src/HPhiTrans.c b/src/HPhiTrans.c index 9ee50236b..897a239ab 100644 --- a/src/HPhiTrans.c +++ b/src/HPhiTrans.c @@ -90,16 +90,9 @@ int HPhiTrans(struct BindStruct *X) { * @author Kota Ido (The University of Tokyo) */ int TransferWithPeierls(struct BindStruct *X, const double time) { - FILE *fp_err; - char sdt_err[D_FileNameMax]; - - int i, k; - int cnt_trans; - + int i; int ri_x, rj_x; int ri_y, rj_y; - int isite1, isite2; - int isigma1, isigma2; double complex dir; const int Mode = (int) (X->Def.ParaLaser[0]); const double Avp = X->Def.ParaLaser[1]; @@ -177,31 +170,14 @@ int TransferWithPeierls(struct BindStruct *X, const double time) { * @author Kota Ido (The University of Tokyo) */ int TransferForQuench(struct BindStruct *X, const double time) { - FILE *fp_err; - char sdt_err[D_FileNameMax]; - - int i, k; - int cnt_trans; - - int ri_x, rj_x; - int ri_y, rj_y; - int isite1, isite2; - int isigma1, isigma2; - double complex dir; + int i; const int Mode = (int) (X->Def.ParaLaser[0]); const double Avp = X->Def.ParaLaser[1]; - const double omega = X->Def.ParaLaser[2]; const double time_d = X->Def.ParaLaser[3]; const double time_c = X->Def.ParaLaser[4]; - const int Lx = (int) (X->Def.ParaLaser[5]); - const int Ly = (int) (X->Def.ParaLaser[6]); - const double dirX = X->Def.ParaLaser[7]; - const double dirY = X->Def.ParaLaser[8]; const double dt = time - time_c; double Bessel = 0.0; - //printf("Make Trasfer with Pierles factor"); - if (Mode == 0) {//Gaussian Wave if (dt <= 0.0) { Bessel = 0.0; @@ -213,22 +189,6 @@ int TransferForQuench(struct BindStruct *X, const double time) { } for (i = 0; i < X->Def.EDNTransfer; i++) { - ri_x = X->Def.EDGeneralTransfer[i][0] % Lx; - rj_x = X->Def.EDGeneralTransfer[i][2] % Lx; - ri_y = X->Def.EDGeneralTransfer[i][0] / Lx; - rj_y = X->Def.EDGeneralTransfer[i][2] / Lx; - if (ri_x - rj_x > 1) { - rj_x += Lx; - } else if (ri_x - rj_x < -1) { - rj_x -= Lx; - } - if (ri_y - rj_y > 1) { - rj_y += Ly; - } else if (ri_y - rj_y < -1) { - rj_y -= Ly; - } - dir = dirX * (ri_x - rj_x) + dirY * (ri_y - rj_y); - X->Def.EDParaGeneralTransfer[i] = X->Def.ParaGeneralTransfer[i] * Bessel; } diff --git a/src/Lanczos_EigenValue.c b/src/Lanczos_EigenValue.c index cdad2f793..9d59a79b4 100644 --- a/src/Lanczos_EigenValue.c +++ b/src/Lanczos_EigenValue.c @@ -67,7 +67,7 @@ int Lanczos_EigenValue(struct BindStruct *X) { double **tmp_mat; double *tmp_E; - int int_i, int_j, mfint[7]; + int int_i, int_j; int iret=0; sprintf(sdt_2, cFileNameLanczosStep, X->Def.CDataFileHead); diff --git a/src/StdFace/StdFace_main.c b/src/StdFace/StdFace_main.c index 59b860119..0f2672d70 100644 --- a/src/StdFace/StdFace_main.c +++ b/src/StdFace/StdFace_main.c @@ -274,7 +274,7 @@ static void PrintCalcMod(struct StdIntList *StdI) static void PrintExcitation(struct StdIntList *StdI) { FILE *fp; int NumOp, **spin, isite, ispin, icell, itau; - double *coef, pi, Cphase, S, Sz; + double *coef, Cphase, S, Sz; double *fourier_r, *fourier_i; if (strcmp(StdI->model, "spin") == 0 && StdI->S2 > 1) { @@ -364,7 +364,7 @@ static void PrintExcitation(struct StdIntList *StdI) { } else if (strcmp(StdI->SpectrumType, "density") == 0) { NumOp = 2; - coef[0] = 1,0; + coef[0] = 1.0; coef[1] = 1.0; spin[0][0] = 0; spin[0][1] = 0; @@ -468,10 +468,9 @@ static void PrintExcitation(struct StdIntList *StdI) { */ static void VectorPotential(struct StdIntList *StdI) { FILE *fp; - int it, ii, isite, icell, itau, itrans, jsite, jcell, jtau, ntrans0; - double Cphase, time, dR[3]; + int it, ii; + double time; double **Et; - double complex coef; fprintf(stdout, "\n @ Time-evolution\n\n"); @@ -565,7 +564,7 @@ static void VectorPotential(struct StdIntList *StdI) { */ static void PrintPump(struct StdIntList *StdI) { FILE *fp; - int it, ii, isite, ipump, jpump, npump0; + int it, isite, ipump, jpump, npump0; if (StdI->PumpBody == 1) { diff --git a/src/bitcalc.c b/src/bitcalc.c index 82ab6d050..3183aea05 100644 --- a/src/bitcalc.c +++ b/src/bitcalc.c @@ -289,7 +289,6 @@ int ConvertToList1GeneralSpin( ) { long unsigned int ia, ib; - long unsigned int tmp_list; ia=org_ibit%ihlfbit; ib=org_ibit/ihlfbit; if(list_2_1[ia]*list_2_2[ib]==0){ diff --git a/src/check.c b/src/check.c index 39a572d56..a33722d40 100644 --- a/src/check.c +++ b/src/check.c @@ -57,8 +57,7 @@ int check(struct BindStruct *X){ long unsigned int tmp; long unsigned int Ns,comb_1,comb_2,comb_3,comb_sum, comb_up, comb_down; int u_loc; - int mfint[7]; - long int **comb; + long int **comb; long unsigned int idimmax=0; long unsigned int idim=0; long unsigned int isite=0; diff --git a/src/eigenIO.c b/src/eigenIO.c index 2b14b4199..68510b785 100644 --- a/src/eigenIO.c +++ b/src/eigenIO.c @@ -117,8 +117,6 @@ int InputRealEigenValue(int xNsize, double *ene, char *filename) { int InputCmpEigenValue(int xNsize, complex double *ene, char *filename) { FILE *fp = NULL; - int i = 0; - fp = fopen(filename, "rb+"); if(fp == NULL) { return -1; diff --git a/src/mltplyMPIHubbardCore.c b/src/mltplyMPIHubbardCore.c index 601117a80..87dd3d942 100644 --- a/src/mltplyMPIHubbardCore.c +++ b/src/mltplyMPIHubbardCore.c @@ -1141,11 +1141,9 @@ double complex X_child_CisAjtCkuAku_Hubbard_MPI( unsigned long int j, Asum, Adiff; double complex dmv; unsigned long int origin, tmp_off; - unsigned long int org_rankbit; + unsigned long int org_rankbit = 0; MPI_Status statusMPI; - //printf("Deubg0-0: org_isite1=%d, org_ispin1=%d, org_isite2=%d, org_ispin2=%d, org_isite3=%d, org_ispin3=%d\n", org_isite1, org_ispin1,org_isite2, org_ispin2,org_isite3, org_ispin3); iCheck = CheckBit_InterAllPE(org_isite1, org_ispin1, org_isite2, org_ispin2, org_isite3, org_ispin3, org_isite3, org_ispin3, X, (long unsigned int) myrank, &origin); - //printf("iCheck=%d, myrank=%d, origin=%d\n", iCheck, myrank, origin); isite1 = X->Def.Tpow[2 * org_isite1 + org_ispin1]; isite2 = X->Def.Tpow[2 * org_isite2 + org_ispin2]; diff --git a/src/mltplyMPISpinCore.c b/src/mltplyMPISpinCore.c index 053e8c9cd..d3cbf5b05 100644 --- a/src/mltplyMPISpinCore.c +++ b/src/mltplyMPISpinCore.c @@ -839,7 +839,6 @@ double complex X_GC_child_CisAisCjuAjv_GeneralSpin_MPIdouble( int origin, ierr; double complex tmp_V, dmv, dam_pr; MPI_Status statusMPI; - int ihermite = TRUE; if (org_isite1 == org_isite3 && org_ispin1 == org_ispin4) {//cisaisciuais=0 && cisaiucisais=0 return 0.0; } diff --git a/src/readdef.c b/src/readdef.c index 607470e25..d4582d3b3 100644 --- a/src/readdef.c +++ b/src/readdef.c @@ -986,7 +986,7 @@ int ReadDefFileIdxPara( char defname[D_FileNameMaxReadDef]; char ctmp[D_CharTmpReadDef], ctmp2[256]; - unsigned int i,j, idx, itype; + unsigned int i, idx, itype; int xitmp[8]; int iKWidx=0; int iboolLoc=0; @@ -1004,7 +1004,6 @@ int ReadDefFileIdxPara( int icnt_trans=0; int iflg_trans=0; int icnt_interall=0; - int iflg_interall=0; unsigned int iloop=0; @@ -1503,7 +1502,7 @@ int ReadDefFileIdxPara( if(X->NLaser>0){ //printf("Read Start\n"); while(fgetsMPI(ctmp2, 256, fp) != NULL){ - sscanf(ctmp2, "%s %lf\n", &(ctmp), &(X->ParaLaser[idx])); + sscanf(ctmp2, "%s %lf\n", &(ctmp[0]), &(X->ParaLaser[idx])); //printf("[%d]:%f\n",idx,X->ParaLaser[idx]); idx++; } @@ -2450,10 +2449,7 @@ void SetConvergenceFactor //In future, convergence facator can be set by a def file. int neps = -8; int nepsCG =-8; - int nbisec =-14; int nEnergy = -12; - int nShiftBeta=8; - int nepsvec12=-14; eps=pow(10.0, neps); eps_CG=pow(10.0, nepsCG); eps_Lanczos = pow(10,-X->LanczosEps); diff --git a/src/xsetmem.c b/src/xsetmem.c index 22e75762e..935b64511 100644 --- a/src/xsetmem.c +++ b/src/xsetmem.c @@ -29,9 +29,6 @@ * @author Kazuyoshi Yoshimi (The University of Tokyo) */ - -static unsigned long int mfint[7];/*for malloc*/ - /// /// \brief Set size of memories headers of output files. /// \param X [out] BindStruct to get headers of files.\n @@ -56,9 +53,6 @@ void setmem_def struct BindStruct *X, struct BoostList *xBoost ) { - unsigned long int i = 0; - unsigned long int j = 0; - unsigned long int k = 0; X->Def.Tpow = lui_1d_allocate(2 * X->Def.Nsite + 2); X->Def.OrgTpow = lui_1d_allocate(2 * X->Def.Nsite + 2); X->Def.SiteToBit = li_1d_allocate(X->Def.Nsite + 1); @@ -107,7 +101,6 @@ void setmem_def X->Def.ParaLaser = d_1d_allocate(X->Def.NLaser); - unsigned int ipivot, iarrayJ, ispin; xBoost->list_6spin_star = i_2d_allocate(xBoost->R0 * xBoost->num_pivot, 7); xBoost->list_6spin_pair = i_3d_allocate(xBoost->R0 * xBoost->num_pivot, 7, 15); xBoost->arrayJ = cd_3d_allocate(xBoost->NumarrayJ, 3, 3);