diff --git a/src/BPM/bond_bpm_spring_plastic.cpp b/src/BPM/bond_bpm_spring_plastic.cpp index 35df659992..5f22fb41b8 100644 --- a/src/BPM/bond_bpm_spring_plastic.cpp +++ b/src/BPM/bond_bpm_spring_plastic.cpp @@ -440,7 +440,7 @@ double BondBPMSpringPlastic::single(int type, double rsq, int i, int j, double & double r = sqrt(rsq); double rinv = 1.0 / r; - double e = (r - r0) / r0; + double e = (r0 != 0.0) ? (r - r0) / r0 : 0.0; if (normalize_flag) fforce = -k[type] * (e - ep); @@ -460,7 +460,7 @@ double BondBPMSpringPlastic::single(int type, double rsq, int i, int j, double & fforce *= rinv; if (smooth_flag) { - double smooth = (r - r0) / (r0 * ecrit[type]); + double smooth = (r0 != 0.0) ? (r - r0) / (r0 * ecrit[type]) : 0.0; smooth *= smooth; smooth *= smooth; smooth *= smooth; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 4dcab3e322..6f96debd40 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -882,7 +882,7 @@ void ComputeStressMop::compute_dihedrals() double x_atom_4[3] = {0.0, 0.0, 0.0}; // initialization - for (int i = 0; i < nvalues; i++) { dihedral_local[i] = 0.0; } + for (int i = 0; i < nvalues; i++) dihedral_local[i] = 0.0; double local_contribution[3] = {0.0, 0.0, 0.0}; for (atom2 = 0; atom2 < nlocal; atom2++) { @@ -1118,10 +1118,6 @@ void ComputeStressMop::compute_dihedrals() df[2] = sgn * (f1[2] + f3[2]); } - // no if matches - else { - df[0] = df[1] = df[2] = 0.0; - } local_contribution[0] += df[0] / area * nktv2p; local_contribution[1] += df[1] / area * nktv2p; local_contribution[2] += df[2] / area * nktv2p; diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index 2139242169..a1cd921cd4 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -294,6 +294,7 @@ void FixHalt::end_of_step() for (int i = 0; i < universe->nworlds; ++i) { if (universe->me == universe->root_proc[i]) continue; MPI_Wait(req + i, MPI_STATUS_IGNORE); + MPI_Request_free(req + i); } } diff --git a/src/utils.cpp b/src/utils.cpp index 8ab757ac44..3ed67e59c6 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -281,7 +281,13 @@ void utils::fmtargs_print(FILE *fp, fmt::string_view format, fmt::format_args ar std::string utils::errorurl(int errorcode) { - return fmt::format("\nFor more information see https://docs.lammps.org/err{:04d}", errorcode); + std::string url; + try { + url = fmt::format("\nFor more information see https://docs.lammps.org/err{:04d}", errorcode); + } catch (std::exception &) { + url = std::string("\nFor more information see https://docs.lammps.org/Errors_details.html"); + } + return url; } void utils::flush_buffers(LAMMPS *lmp)