diff --git a/cmake/Modules/OpenCLLoader.cmake b/cmake/Modules/OpenCLLoader.cmake index ecd9204d24..5ab121f841 100644 --- a/cmake/Modules/OpenCLLoader.cmake +++ b/cmake/Modules/OpenCLLoader.cmake @@ -1,11 +1,5 @@ message(STATUS "Downloading and building OpenCL loader library") -if(CMAKE_BUILD_TYPE STREQUAL Debug) - set(OPENCL_LOADER_LIB_POSTFIX d) -else() - set(OPENCL_LOADER_LIB_POSTFIX) -endif() - include(ExternalProject) set(OPENCL_LOADER_URL "https://download.lammps.org/thirdparty/opencl-loader-2020.12.18.tar.gz" CACHE STRING "URL for OpenCL loader tarball") mark_as_advanced(OPENCL_LOADER_URL) @@ -20,7 +14,7 @@ ExternalProject_Add(opencl_loader -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - BUILD_BYPRODUCTS /libOpenCL${OPENCL_LOADER_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + BUILD_BYPRODUCTS /libOpenCL${CMAKE_STATIC_LIBRARY_SUFFIX} LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON @@ -34,7 +28,7 @@ set(OPENCL_LOADER_INCLUDE_DIR ${SOURCE_DIR}/inc) file(MAKE_DIRECTORY ${OPENCL_LOADER_INCLUDE_DIR}) ExternalProject_Get_Property(opencl_loader BINARY_DIR) -set(OPENCL_LOADER_LIBRARY_PATH "${BINARY_DIR}/libOpenCL${OPENCL_LOADER_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") +set(OPENCL_LOADER_LIBRARY_PATH "${BINARY_DIR}/libOpenCL${CMAKE_STATIC_LIBRARY_SUFFIX}") find_package(Threads QUIET) if(NOT WIN32) diff --git a/doc/src/fix_wall_body_polygon.rst b/doc/src/fix_wall_body_polygon.rst index 6430317d43..079bd633ea 100644 --- a/doc/src/fix_wall_body_polygon.rst +++ b/doc/src/fix_wall_body_polygon.rst @@ -15,7 +15,7 @@ Syntax * k_n = normal repulsion strength (force/distance or pressure units) * c_n = normal damping coefficient (force/distance or pressure units) * c_t = tangential damping coefficient (force/distance or pressure units) -* wallstyle = *xplane* or *yplane* or *zplane* or *zcylinder* +* wallstyle = *xplane* or *yplane* or *zcylinder* * args = list of arguments for a particular style .. parsed-literal:: diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index bc59fd71a7..1eefc4aeae 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -199,11 +199,11 @@ the following table: | 1 | 1.0 if particle is in contact with wall, | | | | 0.0 otherwise | | +-------+----------------------------------------------------+----------------+ -| 2 | Force :math:`f_x` exerted on the wall | force units | +| 2 | Force :math:`f_x` exerted by the wall | force units | +-------+----------------------------------------------------+----------------+ -| 3 | Force :math:`f_y` exerted on the wall | force units | +| 3 | Force :math:`f_y` exerted by the wall | force units | +-------+----------------------------------------------------+----------------+ -| 4 | Force :math:`f_z` exerted on the wall | force units | +| 4 | Force :math:`f_z` exerted by the wall | force units | +-------+----------------------------------------------------+----------------+ | 5 | :math:`x`-coordinate of contact point on wall | distance units | +-------+----------------------------------------------------+----------------+ diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index bedf1165c1..9ed5bb7bcc 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -240,11 +240,11 @@ the following table: | 1 | 1.0 if particle is in contact with wall, | | | | 0.0 otherwise | | +-------+----------------------------------------------------+----------------+ -| 2 | Force :math:`f_x` exerted on the wall | force units | +| 2 | Force :math:`f_x` exerted by the wall | force units | +-------+----------------------------------------------------+----------------+ -| 3 | Force :math:`f_y` exerted on the wall | force units | +| 3 | Force :math:`f_y` exerted by the wall | force units | +-------+----------------------------------------------------+----------------+ -| 4 | Force :math:`f_z` exerted on the wall | force units | +| 4 | Force :math:`f_z` exerted by the wall | force units | +-------+----------------------------------------------------+----------------+ | 5 | :math:`x`-coordinate of contact point on wall | distance units | +-------+----------------------------------------------------+----------------+ diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index a43af733ed..63df8d2a5c 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -59,6 +59,7 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) : restart_peratom = 1; create_attribute = 1; + wallstyle = -1; // wall/particle coefficients @@ -96,7 +97,7 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) : lo = hi = 0.0; cylradius = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; - } + } else error->all(FLERR,fmt::format("Unknown wall style {}",arg[iarg])); // check for trailing keyword/values diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 8c9ea7a1fe..45edf28c98 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -enum{XPLANE=0,YPLANE=1,ZPLANE}; // XYZ PLANE need to be 0,1,2 +enum{XPLANE=0,YPLANE=1,ZPLANE=2}; // XYZ PLANE need to be 0,1,2 enum{HOOKE,HOOKE_HISTORY}; enum {INVALID=0,NONE=1,VERTEX=2}; @@ -59,6 +59,7 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg) restart_peratom = 1; create_attribute = 1; + wallstyle = -1; // wall/particle coefficients @@ -98,7 +99,7 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg) if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; - } + } else error->all(FLERR,fmt::format("Unknown wall style {}",arg[iarg])); // check for trailing keyword/values diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 6b18c603d9..fa8f7fed3e 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -569,6 +569,10 @@ void PairBodyRoundedPolygon::body2space(int i) memory->grow(edge,edmax,5,"pair:edge"); } + if ((body_num_edges > 0) && (edge_ends == nullptr)) + error->one(FLERR,fmt::format("Inconsistent edge data for body of atom {}", + atom->tag[i])); + for (int m = 0; m < body_num_edges; m++) { edge[nedge][0] = static_cast(edge_ends[2*m+0]); edge[nedge][1] = static_cast(edge_ends[2*m+1]); diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 1d531303f9..3dbca5be7a 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -556,6 +556,10 @@ void PairBodyRoundedPolyhedron::body2space(int i) memory->grow(edge,edmax,6,"pair:edge"); } + if ((body_num_edges > 0) && (edge_ends == nullptr)) + error->one(FLERR,fmt::format("Inconsistent edge data for body of atom {}", + atom->tag[i])); + for (int m = 0; m < body_num_edges; m++) { edge[nedge][0] = static_cast(edge_ends[2*m+0]); edge[nedge][1] = static_cast(edge_ends[2*m+1]); @@ -579,6 +583,10 @@ void PairBodyRoundedPolyhedron::body2space(int i) memory->grow(face,facmax,MAX_FACE_SIZE,"pair:face"); } + if ((body_num_faces > 0) && (face_pts == nullptr)) + error->one(FLERR,fmt::format("Inconsistent face data for body of atom {}", + atom->tag[i])); + for (int m = 0; m < body_num_faces; m++) { for (int k = 0; k < MAX_FACE_SIZE; k++) face[nface][k] = static_cast(face_pts[MAX_FACE_SIZE*m+k]); diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp index 73d1302694..f71ad922a0 100644 --- a/src/COLLOID/pair_colloid.cpp +++ b/src/COLLOID/pair_colloid.cpp @@ -473,6 +473,7 @@ double PairColloid::single(int /*i*/, int /*j*/, int itype, int jtype, double rs double K[9],h[4],g[4]; double r,r2inv,r6inv,forcelj,c1,c2,phi,fR,dUR,dUA; + phi = 0.0; switch (form[itype][jtype]) { case SMALL_SMALL: r2inv = 1.0/rsq; diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 8297c338a5..9fc3e67e5c 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -270,7 +270,7 @@ void FixGPU::init() // give a warning if no pair style is defined - if (!force->pair) + if (!force->pair && (comm->me == 0)) error->warning(FLERR,"Using package gpu without any pair style defined"); // make sure fdotr virial is not accumulated multiple times @@ -293,7 +293,7 @@ void FixGPU::init() void FixGPU::setup(int vflag) { if (_gpu_mode == GPU_NEIGH || _gpu_mode == GPU_HYB_NEIGH) - if (neighbor->exclude_setting()!=0) + if (neighbor->exclude_setting() != 0) error->all(FLERR, "Cannot use neigh_modify exclude with GPU neighbor builds"); diff --git a/src/MC/fix_tfmc.cpp b/src/MC/fix_tfmc.cpp index 5129f2d348..4d481e7d68 100644 --- a/src/MC/fix_tfmc.cpp +++ b/src/MC/fix_tfmc.cpp @@ -56,6 +56,7 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : comflag = 0; rotflag = 0; + xflag = yflag = zflag = 0; int iarg = 6; while (iarg < narg) { diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 58e054bda3..8887139ee2 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -49,6 +49,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : scaleflag = 1; spatflag=0; spatialid = nullptr; + size = 0.0; xloflag = xhiflag = yloflag = yhiflag = zloflag = zhiflag = 0; tempflag = 0; diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index 66c97bccda..0111214ae9 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -43,6 +43,7 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : tempflag = 0; scaleflag = 1; roughflag = 0; + roughdist = 0.0; rampflag = 0; rampNL1flag = 0; rampNL2flag = 0; diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 56b3e03190..91354506d1 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -1368,11 +1368,11 @@ void FixBondReact::superimpose_algorithm() } // reaction site found successfully! - if (status == ACCEPT) + if (status == ACCEPT) { if (fraction[rxnID] < 1.0 && random[rxnID]->uniform() >= fraction[rxnID]) status = REJECT; else glove_ghostcheck(); - + } hang_catch++; // let's go ahead and catch the simplest of hangs //if (hang_catch > onemol->natoms*4) diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index 057c6f02eb..2800c9129b 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -386,7 +386,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // apply scaling factors and cylinder dims orthogonal to axis if (binflag) { - double scale; + double scale = 1.0; if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D || which == ArgInfo::BIN3D || which == ArgInfo::BINCYLINDER) { if (which == ArgInfo::BIN1D || which == ArgInfo::BINCYLINDER) ndim = 1; diff --git a/src/compute_global_atom.cpp b/src/compute_global_atom.cpp index 8745ef82b4..e49ee69b07 100644 --- a/src/compute_global_atom.cpp +++ b/src/compute_global_atom.cpp @@ -50,7 +50,7 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : indexref = argi.get_index1(); idref = argi.copy_name(); - if ((whichref == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE) + if ((whichref == ArgInfo::UNKNOWN) || (whichref == ArgInfo::NONE) || (argi.get_dim() > 1)) error->all(FLERR,"Illegal compute global/atom command"); diff --git a/src/error.cpp b/src/error.cpp index 1ce9a0f3fe..0cbfa4c4a1 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -52,8 +52,11 @@ Error::Error(LAMMPS *lmp) : Pointers(lmp) { void Error::universe_all(const std::string &file, int line, const std::string &str) { MPI_Barrier(universe->uworld); - std::string mesg = fmt::format("ERROR: {} ({}:{})\n", - str,truncpath(file),line); + std::string mesg = "ERROR: " + str; + try { + mesg += fmt::format(" ({}:{})\n",truncpath(file),line); + } catch (fmt::format_error &e) { + } if (universe->me == 0) { if (universe->uscreen) fputs(mesg.c_str(),universe->uscreen); if (universe->ulogfile) fputs(mesg.c_str(),universe->ulogfile); @@ -135,9 +138,14 @@ void Error::all(const std::string &file, int line, const std::string &str) MPI_Comm_rank(world,&me); if (me == 0) { + std::string mesg = "ERROR: " + str; if (input && input->line) lastcmd = input->line; - utils::logmesg(lmp,fmt::format("ERROR: {} ({}:{})\nLast command: {}\n", - str,truncpath(file),line,lastcmd)); + try { + mesg += fmt::format(" ({}:{})\nLast command: {}\n", + truncpath(file),line,lastcmd); + } catch (fmt::format_error &e) { + } + utils::logmesg(lmp,mesg); } #ifdef LAMMPS_EXCEPTIONS diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index ae83d80845..27412cf9ef 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -51,7 +51,7 @@ FixAveHistoWeight::FixAveHistoWeight(LAMMPS *lmp, int narg, char **arg) : // check that length of 2 values is the same - int size[2]; + int size[2] = {0,0}; for (int i = 0; i < nvalues; i++) { if (which[i] == ArgInfo::X || which[i] == ArgInfo::V || which[i] == ArgInfo::F) { diff --git a/src/main.cpp b/src/main.cpp index 582de6999c..8e8e1ee3b0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,6 +58,10 @@ int main(int argc, char **argv) MPI_Barrier(MPI_COMM_WORLD); MPI_Finalize(); exit(1); + } catch(fmt::format_error &fe) { + fprintf(stderr,"fmt::format_error: %s\n", fe.what()); + MPI_Abort(MPI_COMM_WORLD, 1); + exit(1); } #else LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD); diff --git a/src/update.cpp b/src/update.cpp index d52e5a742f..7c4b6b888e 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -54,6 +54,7 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) eflag_atom = vflag_atom = 0; dt_default = 1; + dt = 0.0; unit_style = nullptr; set_units("lj");