Skip to content

Commit

Permalink
delete unused variables and set initialze value
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yoshimi committed Jul 18, 2019
1 parent 6e67cc9 commit 50865df
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 76 deletions.
5 changes: 2 additions & 3 deletions src/CalcByTEM.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions src/CalcSpectrumByBiCG.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
/**
Expand Down
44 changes: 2 additions & 42 deletions src/HPhiTrans.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Lanczos_EigenValue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 5 additions & 6 deletions src/StdFace/StdFace_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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) {

Expand Down
1 change: 0 additions & 1 deletion src/bitcalc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
3 changes: 1 addition & 2 deletions src/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/eigenIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/mltplyMPIHubbardCore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
1 change: 0 additions & 1 deletion src/mltplyMPISpinCore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 2 additions & 6 deletions src/readdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions src/xsetmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 50865df

Please sign in to comment.