diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index 142a265b691f0223eff5e8b048d612fbaab0de43..94fbe62a99154323062721e6417e83e415484e7e 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -913,10 +913,6 @@ void PairBOP::gneigh() if(i12>=npairs) { error->one(FLERR,"Too many atom pairs for pair bop"); } - ps=rij[temp_ij]; - ps=rdr[i12]; - ps=pBetaS1[i12][ks-1]; - ps=pBetaS[i12][ks-1]; ps=rij[temp_ij]*rdr[i12]+1.0; ks=(int)ps; if(nr-1<ks) @@ -1052,10 +1048,6 @@ void PairBOP::theta() neigh_flag3[temp_ij]=1; else neigh_flag3[temp_ij]=0; - ps=rij[temp_ij]; - ps=rdr[i12]; - ps=pBetaS1[i12][ks-1]; - ps=pBetaS[i12][ks-1]; ps=rij[temp_ij]*rdr[i12]+1.0; ks=(int)ps; if(nr-1<ks) @@ -4966,8 +4958,8 @@ double PairBOP::PiBo(int itmp, int jtmp) } } } - return(piB); destroy_pi(); + return(piB); } /* ---------------------------------------------------------------------- @@ -5403,14 +5395,8 @@ void PairBOP::read_table(char *filename) gfunc6[j][i][k][n]=gfunc6[k][i][j][n]; } } else { - if(nws==3) { - for(n=0;n<npower+1;n++) { - gpara[j][i][k][n]=gpara[k][i][j][n]; - } - } else { - for(n=0;n<npower+1;n++) { - gpara[j][i][k][n]=gpara[k][i][j][n]; - } + for(n=0;n<npower+1;n++) { + gpara[j][i][k][n]=gpara[k][i][j][n]; } } } @@ -5762,11 +5748,8 @@ double PairBOP::memory_usage() void PairBOP::memory_theta_create() { - if(maxneigh<8) - neigh_ct=(maxneigh-1)*(maxneigh-1)*(maxneigh-1); - else - neigh_ct=(maxneigh-1)*(maxneigh-1)*(maxneigh-1); - if(neigh_ct<0) neigh_ct=0; + neigh_ct=(maxneigh-1)*(maxneigh-1)*(maxneigh-1); + if(neigh_ct<1) neigh_ct=1; memory->create(itypeSigBk,neigh_ct,"itypeSigBk"); memory->create(itypePiBk,neigh_ct,"itypePiBk"); memory->create(neigh_flag,neigh_total,"neigh_flag"); @@ -5792,11 +5775,8 @@ void PairBOP::memory_theta_create() void PairBOP::memory_theta_grow() { - if(maxneigh<8) - neigh_ct=(maxneigh-1)*(maxneigh-1)*(maxneigh-1); - else - neigh_ct=(maxneigh-1)*(maxneigh-1)*(maxneigh-1); - if(neigh_ct<0) neigh_ct=0; + neigh_ct=(maxneigh-1)*(maxneigh-1)*(maxneigh-1); + if(neigh_ct<1) neigh_ct=1; memory->grow(itypeSigBk,neigh_ct,"itypeSigBk"); memory->grow(itypePiBk,neigh_ct,"itypePiBk"); memory->grow(neigh_flag,neigh_total,"neigh_flag"); diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index 43c8f16a2bfbc5957265f6090396802cd4308c37..95e6239bce10876a7978e7730690ee748014c832 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -3292,9 +3292,10 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) qf = qf_fix; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (mask[i] & groupbit) + if (mask[i] & groupbit) { qf[i] = 0.0; dpl[i][0] = dpl[i][1] = dpl[i][2] = 0.0; + } } // communicating charge force to all nodes, first forward then reverse diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index b636af290d927ca7f9fbf97ecc15a587b6448e36..efcffdd1e566b3e2590c710801074fd81ddc584d 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -435,7 +435,7 @@ void FixOrientFCC::post_force(int vflag) if (nstats && update->ntimestep % nstats == 0) { int total; MPI_Allreduce(&count,&total,1,MPI_INT,MPI_SUM,world); - double ave = total/atom->natoms; + double ave = static_cast<double>(total)/atom->natoms; int min,max; MPI_Allreduce(&mincount,&min,1,MPI_INT,MPI_MIN,world); diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index 51b0d5842a4cc3bc653053f813fe89fced7850d1..5b5d4728edff5ea07b93ea2be92046a1520715c1 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -85,8 +85,8 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"rmin0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute snad/atom command"); - rmin0 = atof(arg[iarg+1]); - iarg += 2; + rmin0 = atof(arg[iarg+1]); + iarg += 2; } else if (strcmp(arg[iarg],"switchflag") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute snad/atom command"); diff --git a/src/USER-CG-CMM/angle_sdk.cpp b/src/USER-CG-CMM/angle_sdk.cpp index 9b76fcacdd6da0655d39ecb307ca99f4a46049f0..87fd7f5439727c91e18a1d3e54e978367fea9d3c 100644 --- a/src/USER-CG-CMM/angle_sdk.cpp +++ b/src/USER-CG-CMM/angle_sdk.cpp @@ -374,7 +374,7 @@ void AngleSDK::ev_tally13(int i, int j, int nlocal, int newton_bond, } if (eflag_atom) { if (newton_bond || i < nlocal) eatom[i] += 0.5*evdwl; - if (newton_bond || j < nlocal) eatom[i] += 0.5*evdwl; + if (newton_bond || j < nlocal) eatom[j] += 0.5*evdwl; } } diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index 6dc46cd84115b67a2902eaad8ae6e9ec53d19bba..e275b5eb1a502864897c760886ec561f5018f774 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -249,10 +249,11 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : } if (me == 0) { - if (screen && echo) + if (screen && echo) { fprintf(screen,"-----\nCompute SAED id:%s, # of atoms:%d, # of relp:%d\n",id,natoms,n); fprintf(screen,"Reciprocal point spacing in k1,k2,k3 = %g %g %g\n-----\n", dK[0], dK[1], dK[2]); + } } nRows = n; diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index 3650e59629e28e4bf66b57b43092d1c3995aa754..ffd1f1c9dd78bcd99679712c26bf2c3fc96228a3 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -230,10 +230,11 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : size_array_cols = 2; if (me == 0) { - if (screen && echo) + if (screen && echo) { fprintf(screen,"-----\nCompute XRD id:%s, # of atoms:%d, # of relp:%d\n",id,natoms,nRows); fprintf(screen,"Reciprocal point spacing in k1,k2,k3 = %g %g %g\n-----\n", dK[0], dK[1], dK[2]); + } } memory->create(array,size_array_rows,size_array_cols,"xrd:array"); @@ -343,10 +344,11 @@ void ComputeXRD::compute_array() #endif if (me == 0 && echo) { - if (screen) + if (screen) { fprintf(screen,"\n"); if (LP == 1) fprintf(screen,"Applying Lorentz-Polarization Factor During XRD Calculation 2\n"); + } } int m = 0; double frac = 0.1; diff --git a/src/USER-OMP/thr_data.cpp b/src/USER-OMP/thr_data.cpp index 1984fd71c49e62ec8666dbc2aed0969405572846..cc184d9d6745c8a2d0922808e457deca32b69b0f 100644 --- a/src/USER-OMP/thr_data.cpp +++ b/src/USER-OMP/thr_data.cpp @@ -156,9 +156,10 @@ void ThrData::init_eim(int nall, double *rho, double *fp) { init_eam(nall, rho); - if (nall >= 0 && fp) + if (nall >= 0 && fp) { _fp = fp + _tid*nall; memset(_fp,0,nall*sizeof(double)); + } } /* ---------------------------------------------------------------------- diff --git a/src/USER-OMP/thr_omp.cpp b/src/USER-OMP/thr_omp.cpp index 713e7fdf5dbab2163afaf00e51671a1febf53a70..7e03cdff970b5669235ee57e582fac8e4e5d2a2c 100644 --- a/src/USER-OMP/thr_omp.cpp +++ b/src/USER-OMP/thr_omp.cpp @@ -782,7 +782,7 @@ void ThrOMP::ev_tally_thr(Bond * const bond, const int i, const int j, const int v_tally(thr->vatom_bond[i],v); v_tally(thr->vatom_bond[j],v); } else { - if (j < nlocal) + if (i < nlocal) v_tally(thr->vatom_bond[i],v); if (j < nlocal) v_tally(thr->vatom_bond[j],v); @@ -862,7 +862,7 @@ void ThrOMP::ev_tally_thr(Angle * const angle, const int i, const int j, const i v_tally(thr->vatom_angle[j],v); v_tally(thr->vatom_angle[k],v); } else { - if (j < nlocal) v_tally(thr->vatom_angle[i],v); + if (i < nlocal) v_tally(thr->vatom_angle[i],v); if (j < nlocal) v_tally(thr->vatom_angle[j],v); if (k < nlocal) v_tally(thr->vatom_angle[k],v); } diff --git a/src/info.cpp b/src/info.cpp index 0c2e6b9d41fad8cbb0d1c518f7bb030c007ab7d2..7b6117acb8d8f3bef15e11c43b7b1370560d9e48 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -544,13 +544,13 @@ bool Info::is_available(const char *category, const char *name) { if ((category == NULL) || (name == NULL)) return false; const int len = strlen(name); + int match = 0; if (strcmp(category,"command") == 0) { - int match = 0; - return (input->command_map->find(name) != input->command_map->end()); + if (input->command_map->find(name) != input->command_map->end()); + match = 1; } else if (strcmp(category,"compute") == 0) { - int match = 0; if (modify->compute_map->find(name) != modify->compute_map->end()) match = 1; @@ -570,10 +570,7 @@ bool Info::is_available(const char *category, const char *name) delete[] name_w_suffix; } } - return match ? true : false; - } else if (strcmp(category,"fix") == 0) { - int match = 0; if (modify->fix_map->find(name) != modify->fix_map->end()) match = 1; @@ -593,10 +590,7 @@ bool Info::is_available(const char *category, const char *name) delete[] name_w_suffix; } } - return match ? true : false; - } else if (strcmp(category,"pair_style") == 0) { - int match = 0; if (force->pair_map->find(name) != force->pair_map->end()) match = 1; @@ -616,9 +610,9 @@ bool Info::is_available(const char *category, const char *name) delete[] name_w_suffix; } } - return match ? true : false; - } else error->all(FLERR,"Unknown category for is_available()"); + + return match ? true : false; } /* ---------------------------------------------------------------------- */ @@ -639,7 +633,6 @@ bool Info::is_defined(const char *category, const char *name) if (strcmp(compute[i]->id,name) == 0) return true; } - return false; } else if (strcmp(category,"dump") == 0) { int ndump = output->ndump; Dump **dump = output->dump; @@ -647,7 +640,6 @@ bool Info::is_defined(const char *category, const char *name) if (strcmp(dump[i]->id,name) == 0) return true; } - return false; } else if (strcmp(category,"fix") == 0) { int nfix = modify->nfix; Fix **fix = modify->fix; @@ -655,7 +647,6 @@ bool Info::is_defined(const char *category, const char *name) if (strcmp(fix[i]->id,name) == 0) return true; } - return false; } else if (strcmp(category,"group") == 0) { int ngroup = group->ngroup; char **names = group->names; @@ -663,7 +654,6 @@ bool Info::is_defined(const char *category, const char *name) if (strcmp(names[i],name) == 0) return true; } - return false; } else if (strcmp(category,"region") == 0) { int nreg = domain->nregion; Region **regs = domain->regions; @@ -671,7 +661,6 @@ bool Info::is_defined(const char *category, const char *name) if (strcmp(regs[i]->id,name) == 0) return true; } - return false; } else if (strcmp(category,"variable") == 0) { int nvar = input->variable->nvar; char **names = input->variable->names; @@ -679,6 +668,7 @@ bool Info::is_defined(const char *category, const char *name) if (strcmp(names[i],name) == 0) return true; } - return false; } else error->all(FLERR,"Unknown category for is_defined()"); + + return false; } diff --git a/src/min.cpp b/src/min.cpp index b06ccfc638bed25b27e0c28b65cf8e5bf481fc1e..7588211a8c9f9b10bd736542c8ffc6ce861a8159 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -211,7 +211,7 @@ void Min::setup() // ndoftotal = total dof for entire minimization problem // dof for atoms, extra per-atom, extra global - bigint ndofme = 3*atom->nlocal; + bigint ndofme = 3 * static_cast<bigint>(atom->nlocal); for (int m = 0; m < nextra_atom; m++) ndofme += extra_peratom[m]*atom->nlocal; MPI_Allreduce(&ndofme,&ndoftotal,1,MPI_LMP_BIGINT,MPI_SUM,world); diff --git a/src/minimize.cpp b/src/minimize.cpp index b927ee92709e6002911c93073e439a8c5a974030..6483e100bfc10faf4e9f3b897c6a2fcee7ae2031 100644 --- a/src/minimize.cpp +++ b/src/minimize.cpp @@ -47,7 +47,7 @@ void Minimize::command(int narg, char **arg) update->whichflag = 2; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + update->nsteps; - if (update->laststep < 0 || update->laststep > MAXBIGINT) + if (update->laststep < 0) error->all(FLERR,"Too many iterations"); lmp->init(); diff --git a/src/update.cpp b/src/update.cpp index e012449b9c73afba6f3eb1217cd01d17c7afbfc7..78f4fe73a325ad0c259fa58c409e104bb1dd0831 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -421,7 +421,6 @@ void Update::reset_timestep(bigint newstep) { ntimestep = newstep; if (ntimestep < 0) error->all(FLERR,"Timestep must be >= 0"); - if (ntimestep > MAXBIGINT) error->all(FLERR,"Too big a timestep"); // set atimestep to new timestep // so future update_time() calls will be correct