Merge pull request #2624 from rbberger/collected_small_changes

Collection of small changes
This commit is contained in:
Axel Kohlmeyer
2021-02-26 20:38:47 -05:00
committed by GitHub
20 changed files with 54 additions and 29 deletions

View File

@ -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 <BINARY_DIR>/libOpenCL${OPENCL_LOADER_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
BUILD_BYPRODUCTS <BINARY_DIR>/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)

View File

@ -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::

View File

@ -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 |
+-------+----------------------------------------------------+----------------+

View File

@ -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 |
+-------+----------------------------------------------------+----------------+

View File

@ -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

View File

@ -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

View File

@ -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<int>(edge_ends[2*m+0]);
edge[nedge][1] = static_cast<int>(edge_ends[2*m+1]);

View File

@ -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<int>(edge_ends[2*m+0]);
edge[nedge][1] = static_cast<int>(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<int>(face_pts[MAX_FACE_SIZE*m+k]);

View File

@ -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;

View File

@ -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");

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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");

View File

@ -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

View File

@ -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) {

View File

@ -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);

View File

@ -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");