From fe063b27c73d7b82c0b3993fe502d1d6608e2687 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 23 Apr 2021 15:51:16 -0400 Subject: [PATCH] silence compiler warnings --- src/dump_image.cpp | 2 +- src/fix_adapt.cpp | 2 +- src/fix_ave_time.cpp | 1 - src/fix_deform.cpp | 2 +- src/fix_heat.cpp | 2 +- src/fix_momentum.cpp | 9 +++------ src/fix_nh.cpp | 12 ++++++------ src/group.cpp | 2 +- src/improper_hybrid.cpp | 6 +++--- src/input.cpp | 4 ++-- src/library.cpp | 5 ++--- 11 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 4b7c6e3cf8..c5dd7b455a 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -1244,7 +1244,7 @@ int DumpImage::modify_param(int narg, char **arg) else error->all(FLERR,"Illegal dump_modify command"); int nentry = utils::inumeric(FLERR,arg[5],false,lmp); if (nentry < 1) error->all(FLERR,"Illegal dump_modify command"); - int n = 6 + factor*nentry; + n = 6 + factor*nentry; if (narg < n) error->all(FLERR,"Illegal dump_modify command"); int flag = image->map_reset(0,n-1,&arg[1]); if (flag) error->all(FLERR,"Illegal dump_modify command"); diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 51fdb16d5d..7db16badc9 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -302,7 +302,7 @@ void FixAdapt::init() // allow a dynamic group only if ATOM attribute not used if (group->dynamic[igroup]) - for (int i = 0; i < nadapt; i++) + for (i = 0; i < nadapt; i++) if (adapt[i].which == ATOM) error->all(FLERR,"Cannot use dynamic group with fix adapt atom"); diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 7ecb88ddab..5e640aa37a 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -723,7 +723,6 @@ void FixAveTime::invoke_vector(bigint ntimestep) allocate_arrays(); } - bigint ntimestep = update->ntimestep; int lockforever_flag = 0; for (i = 0; i < nvalues; i++) { if (!varlen[i] || which[i] != ArgInfo::COMPUTE) continue; diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index b3e5722ee1..2624b30181 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -714,7 +714,7 @@ void FixDeform::end_of_step() // set new box size for VOLUME dims that are linked to other dims // NOTE: still need to set h_rate for these dims - for (int i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) { if (set[i].style != VOLUME) continue; if (set[i].substyle == ONE_FROM_ONE) { diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index 920d06dc49..14f2cceca2 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -213,7 +213,7 @@ void FixHeat::end_of_step() v[i][2] = scale*v[i][2] - vsub[2]; } } else { - for (int i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { v[i][0] = scale*v[i][0] - vsub[0]; v[i][1] = scale*v[i][1] - vsub[1]; diff --git a/src/fix_momentum.cpp b/src/fix_momentum.cpp index da86473e61..509da7d0fd 100644 --- a/src/fix_momentum.cpp +++ b/src/fix_momentum.cpp @@ -95,8 +95,11 @@ void FixMomentum::init() void FixMomentum::end_of_step() { + double **x = atom->x; double **v = atom->v; int *mask = atom->mask; + imageint *image = atom->image; + const int nlocal = atom->nlocal; double ekin_old,ekin_new; ekin_old = ekin_new = 0.0; @@ -157,12 +160,6 @@ void FixMomentum::end_of_step() // vnew_i = v_i - w x r_i // must use unwrapped coords to compute r_i correctly - double **x = atom->x; - double **v = atom->v; - int *mask = atom->mask; - imageint *image = atom->image; - int nlocal = atom->nlocal; - double dx,dy,dz; double unwrap[3]; diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index d95763f06b..e8b58a6152 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -1092,7 +1092,7 @@ void FixNH::remap() // omega is not used, except for book-keeping - for (int i = 0; i < 6; i++) omega[i] += dto*omega_dot[i]; + for (i = 0; i < 6; i++) omega[i] += dto*omega_dot[i]; // convert pertinent atoms and rigid bodies to lamda coords @@ -1781,7 +1781,7 @@ void FixNH::nhc_temp_integrate() if (eta_mass_flag) { eta_mass[0] = tdof * boltz * t_target / (t_freq*t_freq); - for (int ich = 1; ich < mtchain; ich++) + for (ich = 1; ich < mtchain; ich++) eta_mass[ich] = boltz * t_target / (t_freq*t_freq); } @@ -1853,12 +1853,12 @@ void FixNH::nhc_press_integrate() if (omega_mass_flag) { double nkt = (atom->natoms + 1) * kt; - for (int i = 0; i < 3; i++) + for (i = 0; i < 3; i++) if (p_flag[i]) omega_mass[i] = nkt/(p_freq[i]*p_freq[i]); if (pstyle == TRICLINIC) { - for (int i = 3; i < 6; i++) + for (i = 3; i < 6; i++) if (p_flag[i]) omega_mass[i] = nkt/(p_freq[i]*p_freq[i]); } } @@ -1866,9 +1866,9 @@ void FixNH::nhc_press_integrate() if (etap_mass_flag) { if (mpchain) { etap_mass[0] = boltz * t_target / (p_freq_max*p_freq_max); - for (int ich = 1; ich < mpchain; ich++) + for (ich = 1; ich < mpchain; ich++) etap_mass[ich] = boltz * t_target / (p_freq_max*p_freq_max); - for (int ich = 1; ich < mpchain; ich++) + for (ich = 1; ich < mpchain; ich++) etap_dotdot[ich] = (etap_mass[ich-1]*etap_dot[ich-1]*etap_dot[ich-1] - boltz * t_target) / etap_mass[ich]; diff --git a/src/group.cpp b/src/group.cpp index 9e140779ef..0f46e17152 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -494,7 +494,7 @@ void Group::assign(int narg, char **arg) std::string fixcmd = "GROUP_"; fixcmd += fmt::format("{} {} GROUP",names[igroup],arg[2]); - for (int i = 3; i < narg; i++) fixcmd += std::string(" ") + arg[i]; + for (i = 3; i < narg; i++) fixcmd += std::string(" ") + arg[i]; modify->add_fix(fixcmd); // style = static diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index fd5d76049b..23f6633ef2 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -185,9 +185,9 @@ void ImproperHybrid::settings(int narg, char **arg) // delete old lists, since cannot just change settings if (nstyles) { - for (int i = 0; i < nstyles; i++) delete styles[i]; + for (i = 0; i < nstyles; i++) delete styles[i]; delete [] styles; - for (int i = 0; i < nstyles; i++) delete [] keywords[i]; + for (i = 0; i < nstyles; i++) delete [] keywords[i]; delete [] keywords; } @@ -196,7 +196,7 @@ void ImproperHybrid::settings(int narg, char **arg) memory->destroy(map); delete [] nimproperlist; delete [] maximproper; - for (int i = 0; i < nstyles; i++) + for (i = 0; i < nstyles; i++) memory->destroy(improperlist[i]); delete [] improperlist; } diff --git a/src/input.cpp b/src/input.cpp index d3352b380a..f71dffbf54 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -887,7 +887,7 @@ void Input::ifthenelse() char **commands = new char*[ncommands]; ncommands = 0; for (int i = first; i <= last; i++) { - int n = strlen(arg[i]) + 1; + n = strlen(arg[i]) + 1; if (n == 1) error->all(FLERR,"Illegal if command"); commands[ncommands] = new char[n]; strcpy(commands[ncommands],arg[i]); @@ -940,7 +940,7 @@ void Input::ifthenelse() char **commands = new char*[ncommands]; ncommands = 0; for (int i = first; i <= last; i++) { - int n = strlen(arg[i]) + 1; + n = strlen(arg[i]) + 1; if (n == 1) error->all(FLERR,"Illegal if command"); commands[ncommands] = new char[n]; strcpy(commands[ncommands],arg[i]); diff --git a/src/library.cpp b/src/library.cpp index c51006f8d8..b85abe6bad 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -1952,8 +1952,9 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) } } END_CAPTURE - +#if defined(LAMMPS_EXCEPTIONS) return nullptr; +#endif } /* ---------------------------------------------------------------------- */ @@ -2207,7 +2208,6 @@ void lammps_gather_atoms_concat(void *handle, char *name, int type, int count, v MPI_INT,lmp->world); } else if (imgunpack) { - int *copy; lmp->memory->create(copy,count*nlocal,"lib/gather:copy"); offset = 0; for (i = 0; i < nlocal; i++) { @@ -3057,7 +3057,6 @@ void lammps_gather_concat(void *handle, char *name, int type, int count, void *d MPI_INT,lmp->world); } else if (imgunpack) { - int *copy; lmp->memory->create(copy,count*nlocal,"lib/gather:copy"); offset = 0; for (i = 0; i < nlocal; i++) {