From 32049c34846cdf5d46dad5b2d78f459064d73c82 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Wed, 29 Sep 2021 16:04:09 +0200 Subject: [PATCH 01/44] adopt for new multispecies PACE implementation --- cmake/Modules/Packages/ML-PACE.cmake | 18 ++++++++++++------ lib/pace/Install.py | 3 ++- lib/pace/Makefile | 18 ++++++++++++++---- lib/pace/Makefile.lammps | 4 ++-- src/ML-PACE/pair_pace.cpp | 7 +++---- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index ccc7423355..998ef22191 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,6 +1,6 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.4.9.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "4db54962fbd6adcf8c18d46e1798ceb5" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.9.28.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_MD5 "f98363bb98adc7295ea63974738c2a1b" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) @@ -14,12 +14,18 @@ execute_process( WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PACE) -file(GLOB PACE_EVALUATOR_SOURCES ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PACE/*.cpp) +file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*) +add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) +set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) + +file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE) +file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp) list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp) add_library(pace STATIC ${PACE_EVALUATOR_SOURCES}) set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) -target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) -target_link_libraries(lammps PRIVATE pace) +target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR}) + +target_link_libraries(lammps PRIVATE pace) +target_link_libraries(lammps PRIVATE yaml-cpp) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index e90ae8c312..946c29676a 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -15,12 +15,13 @@ from install_helpers import fullpath, geturl, checkmd5sum # settings thisdir = fullpath('.') -version = 'v.2021.4.9' +version = 'v.2021.9.28' # known checksums for different PACE versions. used to validate the download. checksums = { \ 'v.2021.2.3.upd2' : '8fd1162724d349b930e474927197f20d', 'v.2021.4.9' : '4db54962fbd6adcf8c18d46e1798ceb5', + 'v.2021.9.28' : 'f98363bb98adc7295ea63974738c2a1b', } diff --git a/lib/pace/Makefile b/lib/pace/Makefile index c2e1892ddd..81f7c9db95 100644 --- a/lib/pace/Makefile +++ b/lib/pace/Makefile @@ -2,8 +2,11 @@ SHELL = /bin/sh # ------ FILES ------ -SRC_FILES = $(wildcard src/USER-PACE/*.cpp) -SRC = $(filter-out src/USER-PACE/pair_pace.cpp, $(SRC_FILES)) +YAML_CPP_PATH = src/yaml-cpp +YAML_CPP_INC = $(YAML_CPP_PATH)/include + +SRC_FILES = $(wildcard src/ML-PACE/*.cpp) +SRC = $(filter-out src/ML-PACE/pair_pace.cpp, $(SRC_FILES)) # ------ DEFINITIONS ------ @@ -12,7 +15,7 @@ OBJ = $(SRC:.cpp=.o) # ------ SETTINGS ------ -CXXFLAGS = -O3 -fPIC -Isrc/USER-PACE +CXXFLAGS = -O3 -fPIC -Isrc/ML-PACE -I$(YAML_CPP_INC) ARCHIVE = ar ARCHFLAG = -rc @@ -21,9 +24,13 @@ SYSLIB = # ------ MAKE PROCEDURE ------ -lib: $(OBJ) +lib: $(OBJ) lib-yaml-cpp $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) + +lib-yaml-cpp: + cd $(YAML_CPP_PATH) && $(MAKE) lib + # ------ COMPILE RULES ------ %.o: %.cpp @@ -32,6 +39,9 @@ lib: $(OBJ) # ------ CLEAN ------ clean-all: -rm -f *~ $(OBJ) $(LIB) + cd $(YAML_CPP_PATH) && $(MAKE) clean-all clean-build: -rm -f *~ $(OBJ) + cd $(YAML_CPP_PATH) && $(MAKE) clean-build + diff --git a/lib/pace/Makefile.lammps b/lib/pace/Makefile.lammps index 17820716df..f4cbeb8ffd 100644 --- a/lib/pace/Makefile.lammps +++ b/lib/pace/Makefile.lammps @@ -1,3 +1,3 @@ -pace_SYSINC =-I../../lib/pace/src/USER-PACE -pace_SYSLIB = -L../../lib/pace/ -lpace +pace_SYSINC =-I../../lib/pace/src/ML-PACE -I../../lib/pace/src/yaml-cpp/include +pace_SYSLIB = -L../../lib/pace/ -lpace -L../../lib/pace/src/yaml-cpp/ -lyaml-cpp pace_SYSPATH = diff --git a/src/ML-PACE/pair_pace.cpp b/src/ML-PACE/pair_pace.cpp index f0d6547083..4a8f7d9512 100644 --- a/src/ML-PACE/pair_pace.cpp +++ b/src/ML-PACE/pair_pace.cpp @@ -296,10 +296,9 @@ void PairPACE::coeff(int narg, char **arg) { //load potential file delete aceimpl->basis_set; - aceimpl->basis_set = new ACECTildeBasisSet(); - if (comm->me == 0) - utils::logmesg(lmp,"Loading {}\n", potential_file_name); - aceimpl->basis_set->load(potential_file_name); + if (comm->me == 0) + utils::logmesg(lmp,"Loading {}\n", potential_file_name); + aceimpl->basis_set = new ACECTildeBasisSet(potential_file_name); if (comm->me == 0) { utils::logmesg(lmp,"Total number of basis functions\n"); From a3e59082bfabedc922c7c101279f667190946deb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 11 Oct 2021 08:13:44 -0400 Subject: [PATCH 02/44] small adjustments and apply clang-format --- src/ML-PACE/pair_pace.cpp | 171 ++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 88 deletions(-) diff --git a/src/ML-PACE/pair_pace.cpp b/src/ML-PACE/pair_pace.cpp index 4a8f7d9512..e3131a8193 100644 --- a/src/ML-PACE/pair_pace.cpp +++ b/src/ML-PACE/pair_pace.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -43,52 +42,47 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, #include #include +#include "ace_c_basis.h" #include "ace_evaluator.h" #include "ace_recursive.h" -#include "ace_c_basis.h" #include "ace_version.h" namespace LAMMPS_NS { - struct ACEImpl { - ACEImpl() : basis_set(nullptr), ace(nullptr){} - ~ACEImpl() {delete basis_set; delete ace;} - ACECTildeBasisSet *basis_set; - ACERecursiveEvaluator *ace; - }; -} +struct ACEImpl { + ACEImpl() : basis_set(nullptr), ace(nullptr) {} + ~ACEImpl() + { + delete basis_set; + delete ace; + } + ACECTildeBasisSet *basis_set; + ACERecursiveEvaluator *ace; +}; +} // namespace LAMMPS_NS using namespace LAMMPS_NS; using namespace MathConst; -#define MAXLINE 1024 -#define DELTA 4 +static char const *const elements_pace[] = { + "X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", + "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", + "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", + "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", + "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", + "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", + "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr"}; +static constexpr int elements_num_pace = sizeof(elements_pace) / sizeof(const char *); -//added YL - -//keywords for ACE evaluator style -#define RECURSIVE_KEYWORD "recursive" -#define PRODUCT_KEYWORD "product" - -static int elements_num_pace = 104; -static char const *const elements_pace[104] = {"X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", - "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", - "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", - "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", - "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", - "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", - "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", - "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr" -}; - -static int AtomicNumberByName_pace(char *elname) { +static int AtomicNumberByName_pace(char *elname) +{ for (int i = 1; i < elements_num_pace; i++) - if (strcmp(elname, elements_pace[i]) == 0) - return i; + if (strcmp(elname, elements_pace[i]) == 0) return i; return -1; } /* ---------------------------------------------------------------------- */ -PairPACE::PairPACE(LAMMPS *lmp) : Pair(lmp) { +PairPACE::PairPACE(LAMMPS *lmp) : Pair(lmp) +{ single_enable = 0; restartinfo = 0; one_coeff = 1; @@ -104,7 +98,8 @@ PairPACE::PairPACE(LAMMPS *lmp) : Pair(lmp) { check if allocated, since class can be destructed when incomplete ------------------------------------------------------------------------- */ -PairPACE::~PairPACE() { +PairPACE::~PairPACE() +{ if (copymode) return; delete aceimpl; @@ -118,7 +113,8 @@ PairPACE::~PairPACE() { /* ---------------------------------------------------------------------- */ -void PairPACE::compute(int eflag, int vflag) { +void PairPACE::compute(int eflag, int vflag) +{ int i, j, ii, jj, inum, jnum; double delx, dely, delz, evdwl; double fij[3]; @@ -149,8 +145,7 @@ void PairPACE::compute(int eflag, int vflag) { // the pointer to the list of neighbors of "i" firstneigh = list->firstneigh; - if (inum != nlocal) - error->all(FLERR,"inum: {} nlocal: {} are different",inum, nlocal); + if (inum != nlocal) error->all(FLERR, "inum: {} nlocal: {} are different", inum, nlocal); // Aidan Thompson told RD (26 July 2019) that practically always holds: // inum = nlocal @@ -160,7 +155,6 @@ void PairPACE::compute(int eflag, int vflag) { // skin atoms can be removed by setting skin to zero but here // they are disregarded anyway - //determine the maximum number of neighbours int max_jnum = -1; int nei = 0; @@ -168,8 +162,7 @@ void PairPACE::compute(int eflag, int vflag) { i = ilist[ii]; jnum = numneigh[i]; nei = nei + jnum; - if (jnum > max_jnum) - max_jnum = jnum; + if (jnum > max_jnum) max_jnum = jnum; } aceimpl->ace->resize_neighbours_cache(max_jnum); @@ -199,6 +192,7 @@ void PairPACE::compute(int eflag, int vflag) { } catch (exception &e) { error->one(FLERR, e.what()); } + // 'compute_atom' will update the `aceimpl->ace->e_atom` and `aceimpl->ace->neighbours_forces(jj, alpha)` arrays for (jj = 0; jj < jnum; jj++) { @@ -209,9 +203,9 @@ void PairPACE::compute(int eflag, int vflag) { dely = x[j][1] - ytmp; delz = x[j][2] - ztmp; - fij[0] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 0); - fij[1] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 1); - fij[2] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 2); + fij[0] = scale[itype][jtype] * aceimpl->ace->neighbours_forces(jj, 0); + fij[1] = scale[itype][jtype] * aceimpl->ace->neighbours_forces(jj, 1); + fij[2] = scale[itype][jtype] * aceimpl->ace->neighbours_forces(jj, 2); f[i][0] += fij[0]; f[i][1] += fij[1]; @@ -222,15 +216,14 @@ void PairPACE::compute(int eflag, int vflag) { // tally per-atom virial contribution if (vflag) - ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, - fij[0], fij[1], fij[2], - -delx, -dely, -delz); + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, fij[0], fij[1], fij[2], -delx, -dely, + -delz); } // tally energy contribution if (eflag) { // evdwl = energy of atom I - evdwl = scale[1][1]*aceimpl->ace->e_atom; + evdwl = scale[1][1] * aceimpl->ace->e_atom; ev_tally_full(i, 2.0 * evdwl, 0.0, 0.0, 0.0, 0.0, 0.0); } } @@ -242,42 +235,45 @@ void PairPACE::compute(int eflag, int vflag) { /* ---------------------------------------------------------------------- */ -void PairPACE::allocate() { +void PairPACE::allocate() +{ allocated = 1; - int n = atom->ntypes; + int n = atom->ntypes + 1; - memory->create(setflag, n + 1, n + 1, "pair:setflag"); - memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); - memory->create(scale, n + 1, n + 1,"pair:scale"); - map = new int[n+1]; + memory->create(setflag, n, n, "pair:setflag"); + memory->create(cutsq, n, n, "pair:cutsq"); + memory->create(scale, n, n, "pair:scale"); + map = new int[n]; } /* ---------------------------------------------------------------------- global settings ------------------------------------------------------------------------- */ -void PairPACE::settings(int narg, char **arg) { - if (narg > 1) - error->all(FLERR,"Illegal pair_style command."); +void PairPACE::settings(int narg, char **arg) +{ + if (narg > 1) error->all(FLERR, "Illegal pair_style command."); // ACE potentials are parameterized in metal units - if (strcmp("metal",update->unit_style) != 0) - error->all(FLERR,"ACE potentials require 'metal' units"); + if (strcmp("metal", update->unit_style) != 0) + error->all(FLERR, "ACE potentials require 'metal' units"); - recursive = true; // default evaluator style: RECURSIVE + recursive = true; // default evaluator style: RECURSIVE if (narg > 0) { - if (strcmp(arg[0], RECURSIVE_KEYWORD) == 0) + if (strcmp(arg[0], "recursive") == 0) recursive = true; - else if (strcmp(arg[0], PRODUCT_KEYWORD) == 0) { + else if (strcmp(arg[0], "product") == 0) { recursive = false; - } else error->all(FLERR,"Illegal pair_style command"); + } else + error->all(FLERR, "Illegal pair_style command"); } if (comm->me == 0) { - utils::logmesg(lmp,"ACE version: {}.{}.{}\n", - VERSION_YEAR, VERSION_MONTH, VERSION_DAY); - if (recursive) utils::logmesg(lmp,"Recursive evaluator is used\n"); - else utils::logmesg(lmp,"Product evaluator is used\n"); + utils::logmesg(lmp, "ACE version: {}.{}.{}\n", VERSION_YEAR, VERSION_MONTH, VERSION_DAY); + if (recursive) + utils::logmesg(lmp, "Recursive evaluator is used\n"); + else + utils::logmesg(lmp, "Product evaluator is used\n"); } } @@ -285,28 +281,29 @@ void PairPACE::settings(int narg, char **arg) { set coeffs for one or more type pairs ------------------------------------------------------------------------- */ -void PairPACE::coeff(int narg, char **arg) { +void PairPACE::coeff(int narg, char **arg) +{ if (!allocated) allocate(); - map_element2type(narg-3,arg+3); + map_element2type(narg - 3, arg + 3); auto potential_file_name = utils::get_potential_file_path(arg[2]); char **elemtypes = &arg[3]; //load potential file delete aceimpl->basis_set; - if (comm->me == 0) - utils::logmesg(lmp,"Loading {}\n", potential_file_name); + if (comm->me == 0) utils::logmesg(lmp, "Loading {}\n", potential_file_name); aceimpl->basis_set = new ACECTildeBasisSet(potential_file_name); if (comm->me == 0) { - utils::logmesg(lmp,"Total number of basis functions\n"); + utils::logmesg(lmp, "Total number of basis functions\n"); for (SPECIES_TYPE mu = 0; mu < aceimpl->basis_set->nelements; mu++) { int n_r1 = aceimpl->basis_set->total_basis_size_rank1[mu]; int n = aceimpl->basis_set->total_basis_size[mu]; - utils::logmesg(lmp,"\t{}: {} (r=1) {} (r>1)\n", aceimpl->basis_set->elements_name[mu], n_r1, n); + utils::logmesg(lmp, "\t{}: {} (r=1) {} (r>1)\n", aceimpl->basis_set->elements_name[mu], n_r1, + n); } } @@ -323,26 +320,25 @@ void PairPACE::coeff(int narg, char **arg) { for (int i = 1; i <= n; i++) { char *elemname = elemtypes[i - 1]; int atomic_number = AtomicNumberByName_pace(elemname); - if (atomic_number == -1) - error->all(FLERR,"'{}' is not a valid element\n", elemname); + if (atomic_number == -1) error->all(FLERR, "'{}' is not a valid element\n", elemname); SPECIES_TYPE mu = aceimpl->basis_set->get_species_index_by_name(elemname); if (mu != -1) { if (comm->me == 0) - utils::logmesg(lmp,"Mapping LAMMPS atom type #{}({}) -> " - "ACE species type #{}\n", i, elemname, mu); + utils::logmesg(lmp, "Mapping LAMMPS atom type #{}({}) -> ACE species type #{}\n", i, + elemname, mu); map[i] = mu; - aceimpl->ace->element_type_mapping(i) = mu; // set up LAMMPS atom type to ACE species mapping for ace evaluator + // set up LAMMPS atom type to ACE species mapping for ace evaluator + aceimpl->ace->element_type_mapping(i) = mu; } else { - error->all(FLERR,"Element {} is not supported by ACE-potential from file {}", elemname,potential_file_name); + error->all(FLERR, "Element {} is not supported by ACE-potential from file {}", elemname, + potential_file_name); } } // initialize scale factor for (int i = 1; i <= n; i++) { - for (int j = i; j <= n; j++) { - scale[i][j] = 1.0; - } + for (int j = i; j <= n; j++) { scale[i][j] = 1.0; } } aceimpl->ace->set_basis(*aceimpl->basis_set, 1); @@ -352,11 +348,10 @@ void PairPACE::coeff(int narg, char **arg) { init specific to this pair style ------------------------------------------------------------------------- */ -void PairPACE::init_style() { - if (atom->tag_enable == 0) - error->all(FLERR, "Pair style pACE requires atom IDs"); - if (force->newton_pair == 0) - error->all(FLERR, "Pair style pACE requires newton pair on"); +void PairPACE::init_style() +{ + if (atom->tag_enable == 0) error->all(FLERR, "Pair style pACE requires atom IDs"); + if (force->newton_pair == 0) error->all(FLERR, "Pair style pACE requires newton pair on"); // request a full neighbor list int irequest = neighbor->request(this, instance_me); @@ -368,7 +363,8 @@ void PairPACE::init_style() { init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ -double PairPACE::init_one(int i, int j) { +double PairPACE::init_one(int i, int j) +{ if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); //cutoff from the basis set's radial functions settings scale[j][i] = scale[i][j]; @@ -381,7 +377,6 @@ double PairPACE::init_one(int i, int j) { void *PairPACE::extract(const char *str, int &dim) { dim = 2; - if (strcmp(str,"scale") == 0) return (void *) scale; + if (strcmp(str, "scale") == 0) return (void *) scale; return nullptr; } - From 77d830bf3a5a7553019f73708a26b40384c9effe Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Tue, 12 Oct 2021 18:15:31 +0200 Subject: [PATCH 03/44] update YAML-CPP library target name to yaml-cpp-pace --- cmake/Modules/Packages/ML-PACE.cmake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index 998ef22191..f7ec16d370 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,18 +1,18 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.9.28.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "f98363bb98adc7295ea63974738c2a1b" CACHE STRING "MD5 checksum of PACE evaluator library tarball") -mark_as_advanced(PACELIB_URL) -mark_as_advanced(PACELIB_MD5) +#set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.9.28.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +#set(PACELIB_MD5 "f98363bb98adc7295ea63974738c2a1b" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +#mark_as_advanced(PACELIB_URL) +#mark_as_advanced(PACELIB_MD5) # download library sources to build folder -file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) +#file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) # uncompress downloaded sources -execute_process( - COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace* - COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -) +#execute_process( +# COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace* +# COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +#) file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*) add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) @@ -27,5 +27,5 @@ set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace$ target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR}) target_link_libraries(lammps PRIVATE pace) -target_link_libraries(lammps PRIVATE yaml-cpp) +target_link_libraries(lammps PRIVATE yaml-cpp-pace) From 1f9ce77c85eb1b3bd1d4bb1eae85939abda074e9 Mon Sep 17 00:00:00 2001 From: srmnitc Date: Wed, 13 Oct 2021 16:34:33 +0200 Subject: [PATCH 04/44] Use only itype for scale variable in both forces and energy --- src/ML-PACE/pair_pace.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ML-PACE/pair_pace.cpp b/src/ML-PACE/pair_pace.cpp index f0d6547083..21f35876a7 100644 --- a/src/ML-PACE/pair_pace.cpp +++ b/src/ML-PACE/pair_pace.cpp @@ -209,9 +209,9 @@ void PairPACE::compute(int eflag, int vflag) { dely = x[j][1] - ytmp; delz = x[j][2] - ztmp; - fij[0] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 0); - fij[1] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 1); - fij[2] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 2); + fij[0] = scale[itype][itype]*aceimpl->ace->neighbours_forces(jj, 0); + fij[1] = scale[itype][itype]*aceimpl->ace->neighbours_forces(jj, 1); + fij[2] = scale[itype][itype]*aceimpl->ace->neighbours_forces(jj, 2); f[i][0] += fij[0]; f[i][1] += fij[1]; @@ -230,7 +230,7 @@ void PairPACE::compute(int eflag, int vflag) { // tally energy contribution if (eflag) { // evdwl = energy of atom I - evdwl = scale[1][1]*aceimpl->ace->e_atom; + evdwl = scale[itype][itype]*aceimpl->ace->e_atom; ev_tally_full(i, 2.0 * evdwl, 0.0, 0.0, 0.0, 0.0, 0.0); } } From cd526ad54ca2e09cbface17a566fd1a5f76a67ff Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Thu, 14 Oct 2021 15:16:48 +0200 Subject: [PATCH 05/44] try to find system libyaml-cpp v.0.6.3 library, otherwise use downloaded one --- cmake/Modules/Packages/ML-PACE.cmake | 48 +++++++++++++++++++--------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index f7ec16d370..6a5d07553d 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,22 +1,40 @@ -#set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.9.28.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -#set(PACELIB_MD5 "f98363bb98adc7295ea63974738c2a1b" CACHE STRING "MD5 checksum of PACE evaluator library tarball") -#mark_as_advanced(PACELIB_URL) -#mark_as_advanced(PACELIB_MD5) +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.9.28.upd1.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_MD5 "ec75bc491edd75e10560cdbf129d91a7" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +mark_as_advanced(PACELIB_URL) +mark_as_advanced(PACELIB_MD5) # download library sources to build folder -#file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) +file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) # uncompress downloaded sources -#execute_process( -# COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace* -# COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -#) +execute_process( + COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace* + COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +) file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*) -add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) -set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) + +# try to find system libyaml-cpp v.0.6.3 library +find_package(yaml-cpp 0.6.3 QUIET) + +find_path(YAML_CPP_INCLUDE_DIR + NAMES yaml.h + PATHS ${YAML_CPP_INCLUDE_DIRS}) + +find_library(YAML_CPP_LIBRARY + NAMES yaml-cpp + PATHS ${YAML_CPP_LIBRARY_DIRS}) + +# if system library not found - using downloaded +if(${YAML_CPP_LIBRARY} STREQUAL "" OR ${YAML_CPP_INCLUDE_DIR} STREQUAL "" OR + ${YAML_CPP_INCLUDE_DIR} STREQUAL "YAML_CPP_INCLUDE_DIR-NOTFOUND") + message("-- Library yaml-fcc v0.6.3 not found, using downloaded copy") + add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) + set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) + set(YAML_CPP_LIBRARY yaml-cpp-pace) +endif() file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE) file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp) @@ -24,8 +42,8 @@ list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp) add_library(pace STATIC ${PACE_EVALUATOR_SOURCES}) set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) -target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR}) +target_include_directories(pace PRIVATE ${YAML_CPP_INCLUDE_DIR}) +target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) target_link_libraries(lammps PRIVATE pace) -target_link_libraries(lammps PRIVATE yaml-cpp-pace) - +target_link_libraries(lammps PRIVATE ${YAML_CPP_LIBRARY}) \ No newline at end of file From 222063e5cfc7f07cf1e28a21d3a5ad5de053121a Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 15 Oct 2021 17:32:37 -0600 Subject: [PATCH 06/44] Add preliminary support for Kokkos OpenMPTarget backend --- src/KOKKOS/kokkos.cpp | 10 +++++----- src/KOKKOS/kokkos.h | 10 +++++----- src/KOKKOS/kokkos_type.h | 15 ++++++++++++++- src/KOKKOS/npair_kokkos.cpp | 20 ++++++++++++-------- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 63a18ec387..e26513a122 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -44,7 +44,7 @@ #define GPU_AWARE_UNKNOWN static int have_gpu_aware = -1; // TODO HIP: implement HIP-aware MPI support (UCX) detection -#if defined(KOKKOS_ENABLE_HIP) || defined(KOKKOS_ENABLE_SYCL) +#if defined(KOKKOS_ENABLE_HIP) || defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) GPU_AWARE_UNKNOWN #elif defined(KOKKOS_ENABLE_CUDA) @@ -121,7 +121,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) } else if (strcmp(arg[iarg],"g") == 0 || strcmp(arg[iarg],"gpus") == 0) { #ifndef LMP_KOKKOS_GPU - error->all(FLERR,"GPUs are requested but Kokkos has not been compiled for CUDA, HIP, or SYCL"); + error->all(FLERR,"GPUs are requested but Kokkos has not been compiled using a GPU-enabled backend"); #endif if (iarg+2 > narg) error->all(FLERR,"Invalid Kokkos command-line args"); ngpus = atoi(arg[iarg+1]); @@ -162,7 +162,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) if (ngpus > 1 && !set_flag) error->all(FLERR,"Could not determine local MPI rank for multiple " - "GPUs with Kokkos CUDA, HIP, or SYCL because MPI library not recognized"); + "GPUs with Kokkos because MPI library not recognized"); } else if (strcmp(arg[iarg],"t") == 0 || strcmp(arg[iarg],"threads") == 0) { @@ -204,7 +204,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) #ifdef LMP_KOKKOS_GPU if (ngpus <= 0) - error->all(FLERR,"Kokkos has been compiled for CUDA, HIP, or SYCL but no GPUs are requested"); + error->all(FLERR,"Kokkos has been compiled with GPU-enabled backend but no GPUs are requested"); #endif #ifndef KOKKOS_ENABLE_SERIAL @@ -311,7 +311,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) error->warning(FLERR,"Detected MPICH. Disabling GPU-aware MPI"); #else if (me == 0) - error->warning(FLERR,"Kokkos with CUDA, HIP, or SYCL assumes CUDA-aware MPI is available," + error->warning(FLERR,"Kokkos with GPU-enabled backend assumes GPU-aware MPI is available," " but cannot determine if this is the case\n try" " '-pk kokkos gpu/aware off' if getting segmentation faults"); diff --git a/src/KOKKOS/kokkos.h b/src/KOKKOS/kokkos.h index fa5ff42a44..af35d95b9e 100644 --- a/src/KOKKOS/kokkos.h +++ b/src/KOKKOS/kokkos.h @@ -87,7 +87,7 @@ E: Invalid Kokkos command-line args Self-explanatory. See Section 2.7 of the manual for details. -E: Could not determine local MPI rank for multiple GPUs with Kokkos CUDA +E: Could not determine local MPI rank for multiple GPUs with Kokkos because MPI library not recognized The local MPI rank was not found in one of four supported environment variables. @@ -96,13 +96,13 @@ E: Invalid number of threads requested for Kokkos: must be 1 or greater Self-explanatory. -E: GPUs are requested but Kokkos has not been compiled for CUDA +E: GPUs are requested but Kokkos has not been compiled using GPU-enabled backend -Recompile Kokkos with CUDA support to use GPUs. +Recompile Kokkos with GPU-enabled backend to use GPUs. -E: Kokkos has been compiled for CUDA, HIP, or SYCL but no GPUs are requested +E: Kokkos has been compiled with GPU-enabled backend but no GPUs are requested -One or more GPUs must be used when Kokkos is compiled for CUDA/HIP/SYCL. +One or more GPUs must be used when Kokkos is compiled for CUDA/HIP/SYCL/OpenMPTarget. W: Kokkos package already initalized, cannot reinitialize with different parameters diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index cd829ec3e4..248435ba03 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -34,7 +34,7 @@ constexpr int HALF = 4; #define ISFINITE(x) std::isfinite(x) #endif -#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || defined(KOKKOS_ENABLE_SYCL) +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) #define LMP_KOKKOS_GPU #endif @@ -222,6 +222,10 @@ struct ExecutionSpaceFromDevice { template<> struct ExecutionSpaceFromDevice { static const LAMMPS_NS::ExecutionSpace space = LAMMPS_NS::Device; +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) +template<> +struct ExecutionSpaceFromDevice { + static const LAMMPS_NS::ExecutionSpace space = LAMMPS_NS::Device; }; #endif @@ -232,6 +236,8 @@ typedef Kokkos::CudaHostPinnedSpace LMPPinnedHostType; typedef Kokkos::Experimental::HIPHostPinnedSpace LMPPinnedHostType; #elif defined(KOKKOS_ENABLE_SYCL) typedef Kokkos::Experimental::SYCLSharedUSMSpace LMPPinnedHostType; +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) +typedef Kokkos::Serial LMPPinnedHostType; #endif // create simple LMPDeviceSpace typedef for non CUDA-, HIP-, or SYCL-specific @@ -242,6 +248,8 @@ typedef Kokkos::Cuda LMPDeviceSpace; typedef Kokkos::Experimental::HIP LMPDeviceSpace; #elif defined(KOKKOS_ENABLE_SYCL) typedef Kokkos::Experimental::SYCL LMPDeviceSpace; +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) +typedef Kokkos::Experimental::OpenMPTarget LMPDeviceSpace; #endif @@ -280,6 +288,11 @@ template<> struct AtomicDup { using value = Kokkos::Experimental::ScatterAtomic; }; +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) +template<> +struct AtomicDup { + using value = Kokkos::Experimental::ScatterAtomic; +}; #endif #ifdef LMP_KOKKOS_USE_ATOMICS diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 1110aef4a6..2ca16e7a60 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -240,7 +240,7 @@ void NPairKokkos::build(NeighList *list_) if (newton_pair) { if (SIZE) { NPairKokkosBuildFunctorSize f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#ifdef LMP_KOKKOS_GPU +#if defined(LMP_KOKKOS_GPU) && !defined(KOKKOS_ENABLE_OPENMPTARGET) if (ExecutionSpaceFromDevice::space == Device) { int team_size = atoms_per_bin*factor; int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); @@ -258,7 +258,7 @@ void NPairKokkos::build(NeighList *list_) #endif } else { NPairKokkosBuildFunctor f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#ifdef LMP_KOKKOS_GPU +#if defined(LMP_KOKKOS_GPU) && !defined(KOKKOS_ENABLE_OPENMPTARGET) if (ExecutionSpaceFromDevice::space == Device) { int team_size = atoms_per_bin*factor; int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); @@ -278,7 +278,7 @@ void NPairKokkos::build(NeighList *list_) } else { if (SIZE) { NPairKokkosBuildFunctorSize f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#ifdef LMP_KOKKOS_GPU +#if defined(LMP_KOKKOS_GPU) && !defined(KOKKOS_ENABLE_OPENMPTARGET) if (ExecutionSpaceFromDevice::space == Device) { int team_size = atoms_per_bin*factor; int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); @@ -296,7 +296,7 @@ void NPairKokkos::build(NeighList *list_) #endif } else { NPairKokkosBuildFunctor f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#ifdef LMP_KOKKOS_GPU +#if defined(LMP_KOKKOS_GPU) && !defined(KOKKOS_ENABLE_OPENMPTARGET) if (ExecutionSpaceFromDevice::space == Device) { int team_size = atoms_per_bin*factor; int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); @@ -605,14 +605,16 @@ void NeighborKokkosExecute::build_ItemGPU(typename Kokkos::TeamPolic other_x[MY_II + 3 * atoms_per_bin] = itype; } other_id[MY_II] = i; -#ifndef KOKKOS_ENABLE_SYCL +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) int test = (__syncthreads_count(i >= 0 && i <= nlocal) == 0); if (test) return; -#else +#elif defined(KOKKOS_ENABLE_SYCL) int not_done = (i >= 0 && i <= nlocal); dev.team_reduce(Kokkos::Max(not_done)); if(not_done == 0) return; +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) + dev.team_barrier(); #endif if (i >= 0 && i < nlocal) { @@ -1055,14 +1057,16 @@ void NeighborKokkosExecute::build_ItemSizeGPU(typename Kokkos::TeamP other_x[MY_II + 4 * atoms_per_bin] = radi; } other_id[MY_II] = i; -#ifndef KOKKOS_ENABLE_SYCL +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) int test = (__syncthreads_count(i >= 0 && i <= nlocal) == 0); if (test) return; -#else +#elif defined(KOKKOS_ENABLE_SYCL) int not_done = (i >= 0 && i <= nlocal); dev.team_reduce(Kokkos::Max(not_done)); if(not_done == 0) return; +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) + dev.team_barrier(); #endif if (i >= 0 && i < nlocal) { From 5e102e1bfe884a9fdb39d2084da5e0dbf3c5cff2 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Mon, 18 Oct 2021 18:43:38 +0200 Subject: [PATCH 07/44] ML-PACE.cmake: find_package(yaml-cpp 0.6.3 EXACT QUITE) first, otherwise dowload from github/yaml-cpp tag 0.6.3 --- cmake/Modules/Packages/ML-PACE.cmake | 73 ++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 20 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index 6a5d07553d..5ab56de62b 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,3 +1,53 @@ +# try to find system libyaml-cpp v.0.6.3 library +find_package(yaml-cpp 0.6.3 EXACT QUIET) + + +if(yaml-cpp_FOUND) + message(STATUS "Library yaml-cpp(v0.6.3) found") + #message(STATUS "YAML_CPP_LIBRARY_DIRS=${YAML_CPP_LIBRARY_DIRS}") + +# get_cmake_property(_variableNames VARIABLES) +# list (SORT _variableNames) +# foreach (_variableName ${_variableNames}) +# message(STATUS "${_variableName}=${${_variableName}}") +# endforeach() + + find_path(YAML_CPP_INCLUDE_DIR + NAMES yaml.h + PATHS ${YAML_CPP_INCLUDE_DIRS}) + + if(NOT YAML_CPP_LIBRARIES) + find_library(YAML_CPP_LIBRARY + NAMES yaml-cpp + PATHS ${YAML_CPP_LIBRARY_DIRS}) + else() + set(YAML_CPP_LIBRARY ${YAML_CPP_LIBRARIES}) + endif() +else() + message(STATUS "Library yaml-cpp(v0.6.3) not found, downloading") + + set(YAML_063_URL "https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.tar.gz" CACHE STRING "URL for yaml-cpp (v.0.6.3) library sources") + set(YAML_063_MD5 "b45bf1089a382e81f6b661062c10d0c2" CACHE STRING "MD5 checksum of yaml-cpp (v.0.6.3) library tarball") + mark_as_advanced(YAML_063_URL) + mark_as_advanced(YAML_063_MD5) + + # download library sources to build folder + file(DOWNLOAD ${YAML_063_URL} ${CMAKE_BINARY_DIR}/yaml-cpp-0.6.3.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${YAML_063_MD5}) + + execute_process( + COMMAND ${CMAKE_COMMAND} -E remove_directory yaml-cpp-yaml-cpp-0.6.3* + COMMAND ${CMAKE_COMMAND} -E tar xzf yaml-cpp-0.6.3.tar.gz + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + + set(YAML_DIR ${CMAKE_BINARY_DIR}/yaml-cpp-yaml-cpp-0.6.3) + + add_subdirectory(${YAML_DIR} build-yaml-cpp EXCLUDE_FROM_ALL) + set(YAML_CPP_INCLUDE_DIR ${YAML_DIR}/include) + set(YAML_CPP_LIBRARY yaml-cpp) +endif() + + set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.9.28.upd1.tar.gz" CACHE STRING "URL for PACE evaluator library sources") set(PACELIB_MD5 "ec75bc491edd75e10560cdbf129d91a7" CACHE STRING "MD5 checksum of PACE evaluator library tarball") @@ -16,25 +66,8 @@ execute_process( file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*) -# try to find system libyaml-cpp v.0.6.3 library -find_package(yaml-cpp 0.6.3 QUIET) - -find_path(YAML_CPP_INCLUDE_DIR - NAMES yaml.h - PATHS ${YAML_CPP_INCLUDE_DIRS}) - -find_library(YAML_CPP_LIBRARY - NAMES yaml-cpp - PATHS ${YAML_CPP_LIBRARY_DIRS}) - -# if system library not found - using downloaded -if(${YAML_CPP_LIBRARY} STREQUAL "" OR ${YAML_CPP_INCLUDE_DIR} STREQUAL "" OR - ${YAML_CPP_INCLUDE_DIR} STREQUAL "YAML_CPP_INCLUDE_DIR-NOTFOUND") - message("-- Library yaml-fcc v0.6.3 not found, using downloaded copy") - add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) - set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) - set(YAML_CPP_LIBRARY yaml-cpp-pace) -endif() +message(STATUS "YAML_CPP_INCLUDE_DIR=${YAML_CPP_INCLUDE_DIR}") +message(STATUS "YAML_CPP_LIBRARY=${YAML_CPP_LIBRARY}") file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE) file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp) @@ -46,4 +79,4 @@ target_include_directories(pace PRIVATE ${YAML_CPP_INCLUDE_DIR}) target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) target_link_libraries(lammps PRIVATE pace) -target_link_libraries(lammps PRIVATE ${YAML_CPP_LIBRARY}) \ No newline at end of file +target_link_libraries(lammps PRIVATE ${YAML_CPP_LIBRARY}) From 85433e8bd180d4e5ddc4020748b11bc7de98d794 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 20 Oct 2021 12:41:02 -0400 Subject: [PATCH 08/44] use true/false instead of 1/0 detected and changed by clang-tidy --- src/DPD-REACT/fix_eos_table.cpp | 2 +- src/DPD-REACT/fix_eos_table_rx.cpp | 4 +-- src/DPD-REACT/fix_rx.cpp | 12 ++++---- src/DPD-REACT/pair_exp6_rx.cpp | 4 +-- src/DPD-REACT/pair_multi_lucy.cpp | 2 +- src/DPD-REACT/pair_multi_lucy_rx.cpp | 2 +- src/EXTRA-FIX/fix_gle.cpp | 4 +-- src/GRANULAR/fix_pour.cpp | 2 +- src/KIM/kim_interactions.cpp | 2 +- src/KSPACE/pppm.cpp | 2 +- src/KSPACE/pppm_dipole.cpp | 2 +- src/KSPACE/pppm_disp.cpp | 6 ++-- src/MANIFOLD/fix_nve_manifold_rattle.cpp | 2 +- src/MANYBODY/pair_edip.cpp | 2 +- src/MANYBODY/pair_edip_multi.cpp | 2 +- src/MANYBODY/pair_extep.cpp | 4 +-- src/MANYBODY/pair_lcbop.cpp | 6 ++-- src/MDI/mdi_engine.cpp | 4 +-- src/MEAM/pair_meam.cpp | 2 +- src/MESONT/pair_mesont_tpm.cpp | 2 +- src/MGPT/mgpt_readpot.cpp | 10 +++---- src/MGPT/mgpt_splinetab.cpp | 2 +- src/MGPT/pair_mgpt.cpp | 14 ++++----- src/ML-IAP/mliap_descriptor_snap.cpp | 2 +- src/ML-IAP/mliap_descriptor_so3.cpp | 2 +- src/ML-IAP/mliap_model_nn.cpp | 2 +- src/ML-RANN/pair_rann.cpp | 30 ++++++++++---------- src/ML-SNAP/pair_snap.cpp | 2 +- src/POEMS/fix_poems.cpp | 6 ++-- src/PTM/ptm_convex_hull_incremental.cpp | 2 +- src/QEQ/fix_qeq.cpp | 2 +- src/REACTION/fix_bond_react.cpp | 2 +- src/REAXFF/fix_reaxff_species.cpp | 4 +-- src/REAXFF/reaxff_allocate.cpp | 6 ++-- src/REAXFF/reaxff_control.cpp | 2 +- src/REPLICA/fix_hyper_local.cpp | 2 +- src/REPLICA/neb.cpp | 4 +-- src/RIGID/fix_rigid.cpp | 2 +- src/RIGID/fix_rigid_small.cpp | 2 +- src/SPIN/neb_spin.cpp | 4 +-- src/SRD/fix_srd.cpp | 8 +++--- src/atom.cpp | 2 +- src/atom_vec_body.cpp | 2 +- src/balance.cpp | 2 +- src/comm_tiled.cpp | 2 +- src/compute_aggregate_atom.cpp | 4 +-- src/compute_cluster_atom.cpp | 4 +-- src/compute_fragment_atom.cpp | 2 +- src/create_atoms.cpp | 2 +- src/input.cpp | 4 +-- src/min_linesearch.cpp | 6 ++-- src/molecule.cpp | 2 +- src/platform.cpp | 2 +- src/procmap.cpp | 2 +- src/rcb.cpp | 4 +-- src/read_data.cpp | 4 +-- src/read_dump.cpp | 10 +++---- src/rerun.cpp | 2 +- src/universe.cpp | 2 +- src/utils.cpp | 2 +- src/variable.cpp | 12 ++++---- src/write_coeff.cpp | 2 +- src/write_dump.cpp | 2 +- tools/binary2txt.cpp | 2 +- unittest/force-styles/test_config_reader.cpp | 4 +-- 65 files changed, 130 insertions(+), 130 deletions(-) diff --git a/src/DPD-REACT/fix_eos_table.cpp b/src/DPD-REACT/fix_eos_table.cpp index c9c23b51f8..61b4e7501a 100644 --- a/src/DPD-REACT/fix_eos_table.cpp +++ b/src/DPD-REACT/fix_eos_table.cpp @@ -207,7 +207,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword - while (1) { + while (true) { if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line diff --git a/src/DPD-REACT/fix_eos_table_rx.cpp b/src/DPD-REACT/fix_eos_table_rx.cpp index b39e029c3e..5e950642d3 100644 --- a/src/DPD-REACT/fix_eos_table_rx.cpp +++ b/src/DPD-REACT/fix_eos_table_rx.cpp @@ -321,7 +321,7 @@ void FixEOStableRX::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -427,7 +427,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword - while (1) { + while (true) { if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line diff --git a/src/DPD-REACT/fix_rx.cpp b/src/DPD-REACT/fix_rx.cpp index f21914e2d5..165a3a6dbf 100644 --- a/src/DPD-REACT/fix_rx.cpp +++ b/src/DPD-REACT/fix_rx.cpp @@ -255,7 +255,7 @@ void FixRX::post_constructor() int eof = 0; char * word; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -804,7 +804,7 @@ void FixRX::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -858,7 +858,7 @@ void FixRX::read_file(char *file) nreactions=0; sign = -1.0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -1155,7 +1155,7 @@ int FixRX::rkf45_h0 (const int neq, const double t, const double /*t_stop*/, // compute ydot at t=t0 rhs (t, y, ydot, v_params); - while (1) + while (true) { // Estimate y'' with finite-difference ... @@ -1254,7 +1254,7 @@ void FixRX::odeDiagnostics() double max_per_proc[numCounters]; double min_per_proc[numCounters]; - if (1) + if (true) { static bool firstStep = true; @@ -1285,7 +1285,7 @@ void FixRX::odeDiagnostics() printf("me= %d nst= %g nfc= %g time= %g nlocal= %g lmpnst= %g weight_idx= %d 1st= %d aveNeigh= %g\n", comm->me, this->diagnosticCounter[0], this->diagnosticCounter[1], this->diagnosticCounter[2], this->diagnosticCounter[3], this->diagnosticCounter[4], rx_weight_index, firstStep, averageNumNeighbors); - if (rx_weight_index != -1 && !firstStep && 0) + if (rx_weight_index != -1 && !firstStep && false) { double *rx_weight = atom->dvector[rx_weight_index]; diff --git a/src/DPD-REACT/pair_exp6_rx.cpp b/src/DPD-REACT/pair_exp6_rx.cpp index b0b9f97ca2..313e9f2583 100644 --- a/src/DPD-REACT/pair_exp6_rx.cpp +++ b/src/DPD-REACT/pair_exp6_rx.cpp @@ -731,7 +731,7 @@ void PairExp6rx::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -838,7 +838,7 @@ void PairExp6rx::read_file2(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { diff --git a/src/DPD-REACT/pair_multi_lucy.cpp b/src/DPD-REACT/pair_multi_lucy.cpp index 9f5e494991..4aaea3f81b 100644 --- a/src/DPD-REACT/pair_multi_lucy.cpp +++ b/src/DPD-REACT/pair_multi_lucy.cpp @@ -356,7 +356,7 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword - while (1) { + while (true) { if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line diff --git a/src/DPD-REACT/pair_multi_lucy_rx.cpp b/src/DPD-REACT/pair_multi_lucy_rx.cpp index c386abded4..eac047d9f7 100644 --- a/src/DPD-REACT/pair_multi_lucy_rx.cpp +++ b/src/DPD-REACT/pair_multi_lucy_rx.cpp @@ -496,7 +496,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword - while (1) { + while (true) { if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line diff --git a/src/EXTRA-FIX/fix_gle.cpp b/src/EXTRA-FIX/fix_gle.cpp index 8f31613188..de225c6980 100644 --- a/src/EXTRA-FIX/fix_gle.cpp +++ b/src/EXTRA-FIX/fix_gle.cpp @@ -234,7 +234,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : char line[MAXLINE],*ptr; int n,nwords,ndone=0,eof=0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); if (ptr == nullptr) { @@ -300,7 +300,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ndone = eof = 0; const double cfac = force->boltz / force->mvv2e; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); if (ptr == nullptr) { diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index b73593b1d7..4c83e13a7b 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -851,7 +851,7 @@ void FixPour::xyz_random(double h, double *coord) coord[2] = h; } else { double r1,r2; - while (1) { + while (true) { r1 = random->uniform() - 0.5; r2 = random->uniform() - 0.5; if (r1*r1 + r2*r2 < 0.25) break; diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 9a3aee87c0..74ac40198c 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -293,7 +293,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con char line[MAXLINE], *ptr; int n, eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line, MAXLINE,fp); if (ptr == nullptr) { diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 9d3a06f18e..06d90e5d0e 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -983,7 +983,7 @@ void PPPM::set_grid_global() h = h_x = h_y = h_z = 4.0/g_ewald; int count = 0; - while (1) { + while (true) { // set grid dimensions diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 16e06ed13e..abadcc52be 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -783,7 +783,7 @@ void PPPMDipole::set_grid_global() h = h_x = h_y = h_z = 4.0/g_ewald; int count = 0; - while (1) { + while (true) { // set grid dimension diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index fa14cb23f0..85aceb8500 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -1471,7 +1471,7 @@ int PPPMDisp::qr_alg(double **A, double **Q, int n) // start loop for the matrix factorization int count = 0; int countmax = 100000; - while (1) { + while (true) { // make a Wilkinson shift an1 = A[n-2][n-2]; an = A[n-1][n-1]; @@ -2645,7 +2645,7 @@ void PPPMDisp::set_grid() if (!gridflag) { h = h_x = h_y = h_z = 4.0/g_ewald; int count = 0; - while (1) { + while (true) { // set grid dimension @@ -3663,7 +3663,7 @@ void PPPMDisp::set_n_pppm_6() // decrease grid spacing until required precision is obtained int count = 0; - while (1) { + while (true) { // set grid dimension nx_pppm_6 = static_cast (xprd/h_x); diff --git a/src/MANIFOLD/fix_nve_manifold_rattle.cpp b/src/MANIFOLD/fix_nve_manifold_rattle.cpp index b4644a1350..8c3a9205e9 100644 --- a/src/MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/MANIFOLD/fix_nve_manifold_rattle.cpp @@ -498,7 +498,7 @@ void FixNVEManifoldRattle::rattle_manifold_x(double *x, double *v, const double c_inv = 1.0 / c; - while (1) { + while (true) { v[0] = vt[0] - l*no_dt[0]; v[1] = vt[1] - l*no_dt[1]; v[2] = vt[2] - l*no_dt[2]; diff --git a/src/MANYBODY/pair_edip.cpp b/src/MANYBODY/pair_edip.cpp index 51b38037ab..af2314b8b9 100644 --- a/src/MANYBODY/pair_edip.cpp +++ b/src/MANYBODY/pair_edip.cpp @@ -789,7 +789,7 @@ void PairEDIP::read_file(char *file) char line[MAXLINE], *ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line, MAXLINE, fp); if (ptr == nullptr) { diff --git a/src/MANYBODY/pair_edip_multi.cpp b/src/MANYBODY/pair_edip_multi.cpp index 3cabec4505..8017fa4f8e 100644 --- a/src/MANYBODY/pair_edip_multi.cpp +++ b/src/MANYBODY/pair_edip_multi.cpp @@ -602,7 +602,7 @@ void PairEDIPMulti::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { diff --git a/src/MANYBODY/pair_extep.cpp b/src/MANYBODY/pair_extep.cpp index bc96a40c57..68db444f31 100644 --- a/src/MANYBODY/pair_extep.cpp +++ b/src/MANYBODY/pair_extep.cpp @@ -540,7 +540,7 @@ void PairExTeP::read_file(char *file) char line[MAXLINE],*ptr; int eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); if (ptr == nullptr) { @@ -669,7 +669,7 @@ void PairExTeP::read_file(char *file) F_corr_data[iel][jel][in][jn][ivar]=0; // loop until EOF - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); //fputs(line,stdout); diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index 3c6f08a7e7..547fc75154 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -935,7 +935,7 @@ void PairLCBOP::read_file(char *filename) // skip initial comment lines - while (1) { + while (true) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; } @@ -971,7 +971,7 @@ void PairLCBOP::read_file(char *filename) utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&eps); utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); sscanf(s,"%lg",&delta); - while (1) { + while (true) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; } @@ -988,7 +988,7 @@ void PairLCBOP::read_file(char *filename) &F_conj_data[i][2][k][l], &F_conj_data[i][3][k][l]); } - while (1) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; } + while (true) { utils::sfgets(FLERR,s,MAXLINE,fp,filename,error); if (s[0] != '#') break; } } } diff --git a/src/MDI/mdi_engine.cpp b/src/MDI/mdi_engine.cpp index 4be739d187..5194c44189 100644 --- a/src/MDI/mdi_engine.cpp +++ b/src/MDI/mdi_engine.cpp @@ -200,7 +200,7 @@ void MDIEngine::command(int narg, char ** /*arg*/) char *command; - while (1) { + while (true) { // mdi/engine command only recognizes three nodes // DEFAULT, INIT_MD, INIT_OPTG @@ -265,7 +265,7 @@ char *MDIEngine::mdi_md() // run MD one step at a time - while (1) { + while (true) { update->whichflag = 1; timer->init_timeout(); update->nsteps += 1; diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index b69d17f0a9..e8c6c942a4 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -517,7 +517,7 @@ void PairMEAM::read_user_meam_file(const std::string &userfile) char * line = nullptr; char buffer[MAXLINE]; - while (1) { + while (true) { int which; int nindex, index[3]; double value; diff --git a/src/MESONT/pair_mesont_tpm.cpp b/src/MESONT/pair_mesont_tpm.cpp index 425722a569..293e9d02f5 100644 --- a/src/MESONT/pair_mesont_tpm.cpp +++ b/src/MESONT/pair_mesont_tpm.cpp @@ -197,7 +197,7 @@ MESONTList::MESONTList(const Atom* atom, const NeighList* nblist) { index_list.push_back(i); index_list_b[i] = index_list.size() - 1; int idx = i; - while (1) { + while (true) { idx = chain_list[idx][1]; if (idx == cnt_end || idx == domain_end) break; else index_list.push_back(idx); diff --git a/src/MGPT/mgpt_readpot.cpp b/src/MGPT/mgpt_readpot.cpp index df62bf735d..dd196142f5 100644 --- a/src/MGPT/mgpt_readpot.cpp +++ b/src/MGPT/mgpt_readpot.cpp @@ -131,7 +131,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub exit(1); } - if (0) { + if (false) { printf("Before sort:\n"); for (int i = 0; i nvol = %d, vol0 = %.6f, x0= %.6f, x1 = %.6f, dx = %.6f\n", nvol,vol0,x0,x1,dx); } @@ -408,7 +408,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl double vpair_tmp = vpairtab[i*nr+j]; vpairtab[i*nr+j] = vpairtab[i*nr+j]*fscr + v2a - v2b; - if (0) if (fabs(vol-ivol) < 0.01) { + if (false) if (fabs(vol-ivol) < 0.01) { static FILE *xfile = nullptr; if (j == 0) { xfile = fopen("mgpt5-pot.dat","w"); @@ -487,7 +487,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl evalspline(nx-1,x0,x1,C,x,&evol0,&devol0,&unused); devol0 *= dxdv; - if (1) { + if (true) { printf("%% READPOT PARAMETERS:\n"); printf("%% ddl = %15.5e %15.5e %15.5e %15.5e\n",ddl[1],ddl[2],ddl[3],ddl[4]); diff --git a/src/MGPT/mgpt_splinetab.cpp b/src/MGPT/mgpt_splinetab.cpp index e31572fe50..fd6d4541c2 100644 --- a/src/MGPT/mgpt_splinetab.cpp +++ b/src/MGPT/mgpt_splinetab.cpp @@ -105,7 +105,7 @@ void evalspline(int n,double x0,double x1,double C[][4], xhat = xhat - idx; p = C[idx]; - if (0) { + if (false) { *y = p[0] + xhat*(p[1] + xhat*(p[2] + xhat*p[3])); *dy = p[1] + xhat*(2*p[2] + xhat*3*p[3]); diff --git a/src/MGPT/pair_mgpt.cpp b/src/MGPT/pair_mgpt.cpp index 2bea1273c6..fde6fc7084 100644 --- a/src/MGPT/pair_mgpt.cpp +++ b/src/MGPT/pair_mgpt.cpp @@ -191,7 +191,7 @@ static inline double mtrace(int n,double A[8][8],double B[8][8]) { void PairMGPT::make_triplet(bond_data *ij_bond,bond_data *ik_bond, triplet_data *triptr) { - if (1) { + if (true) { const trmul_fun tr_mul = linalg.tr_mul; tr_mul(&(ij_bond->H.m[1][0]), &(ik_bond->H.m[1][0]) ,&(triptr->H1H2.m[1][0]) ); tr_mul(&(ij_bond->Hx.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1xH2.m[1][0])); @@ -289,7 +289,7 @@ double PairMGPT::numderiv3t(double xx[][3],int i,int j,int k,int p) { xx[i][p] = xsave - delta; make_bond(xx,i,j,&Bij); - if (0) { /* This bond doesn't change when i is perturbed */ + if (false) { /* This bond doesn't change when i is perturbed */ make_bond(xx,j,k,&Bjk); } make_bond(xx,k,i,&Bki); @@ -341,7 +341,7 @@ double PairMGPT::numderiv4(double xx[][3],int i,int j,int k,int m,int p) { xx[i][p] = xsave - delta; make_bond(xx,i,j,&Bij); - if (0) { /* Only the i coordinates changed... */ + if (false) { /* Only the i coordinates changed... */ make_bond(xx,j,k,&Bjk); make_bond(xx,k,m,&Bkm); } @@ -438,7 +438,7 @@ void PairMGPT::force_debug_4(double xx[][3], for (int p = 0; p<3; p++) { /* Compute numerical derivatives by displacing atoms i,j,k,m */ double ndfi,ndfj,ndfk,ndfm; - if (1) { + if (true) { double ndf[] = {0.0,0.0,0.0,0.0}; for (int s = 0; s<4; s++) for (int t = 0; t<4; t++) @@ -765,7 +765,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, int c_p = 0, c_t = 0, c_q = 0; - if (0) + if (false) if (domain->triclinic) { if (comm->me == 0) printf("Can not handle triclinic box yet\n"); @@ -1690,7 +1690,7 @@ void PairMGPT::compute(int eflag, int vflag) compute_x(listfull->numneigh,listfull->firstneigh,&e_s,&e_p,&e_t,&e_q,evflag,newton_pair); - if (0) { // Stupid force calculation / verification + if (false) { // Stupid force calculation / verification int ii,nmax=-1; for (ii = 0; iiinum + listfull->gnum; ii++) { int i = listfull->ilist[ii]; @@ -1768,7 +1768,7 @@ void PairMGPT::compute(int eflag, int vflag) } - if (0) { + if (false) { printf("\nForces MGPT:\n"); const int iimax = (listfull->inum < 10) ? listfull->inum : 10; for (int ii = 0; iime == 0) { ptr = fgets(line,MAXLINE,fpparam); if (ptr == nullptr) { diff --git a/src/ML-IAP/mliap_descriptor_so3.cpp b/src/ML-IAP/mliap_descriptor_so3.cpp index d816bd0638..e8bedea377 100644 --- a/src/ML-IAP/mliap_descriptor_so3.cpp +++ b/src/ML-IAP/mliap_descriptor_so3.cpp @@ -93,7 +93,7 @@ void MLIAPDescriptorSO3::read_paramfile(char *paramfilename) int eof = 0; int n, nwords; - while (1) { + while (true) { if (comm->me == 0) { ptr = utils::fgets_trunc(line, MAXLINE, fpparam); if (ptr == nullptr) { diff --git a/src/ML-IAP/mliap_model_nn.cpp b/src/ML-IAP/mliap_model_nn.cpp index 10ef97300e..853f1d9c6c 100644 --- a/src/ML-IAP/mliap_model_nn.cpp +++ b/src/ML-IAP/mliap_model_nn.cpp @@ -125,7 +125,7 @@ void MLIAPModelNN::read_coeffs(char *coefffilename) int ielem = 0; int l = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); if (ptr == nullptr) { diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index fbc54e745f..3e97b638dc 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -440,7 +440,7 @@ void PairRANN::read_mass(const std::vector &line1, const std::vecto if (nelements == -1)error->one(filename,linenum-1,"atom types must be defined before mass in potential file."); for (int i=0;i line,std::vector l if (nelements == -1)error->one(filename,linenum-1,"atom types must be defined before fingerprints per element in potential file."); for (i=0;i line,std::vectorn_body_type!=nwords-1) {error->one(filename,linenum,"invalid fingerprint for element combination");} k++; - fingerprints[i][i1]->init(atomtypes,utils::inumeric(filename,linenum,line1[k++].c_str(),1,lmp)); + fingerprints[i][i1]->init(atomtypes,utils::inumeric(filename,linenum,line1[k++].c_str(),true,lmp)); fingerprintcount[i]++; } delete[] atomtypes; @@ -523,7 +523,7 @@ void PairRANN::read_fingerprint_constants(std::vector line,std::vec for (j=0;jatomtypes[j]!=atomtypes[j]) {break;} if (j==n_body_type-1) { - if (line[nwords-3].compare(fingerprints[i][k]->style)==0 && utils::inumeric(filename,linenum,line[nwords-2].c_str(),1,lmp)==fingerprints[i][k]->id) { + if (line[nwords-3].compare(fingerprints[i][k]->style)==0 && utils::inumeric(filename,linenum,line[nwords-2].c_str(),true,lmp)==fingerprints[i][k]->id) { found=true; i1 = k; break; @@ -542,7 +542,7 @@ void PairRANN::read_network_layers(std::vector line,std::vectorone(filename,linenum-1,"atom types must be defined before network layers in potential file."); for (i=0;ione(filename,linenum,"invalid number of network layers"); delete[] net[i].dimensions; weightdefined[i] = new bool [net[i].layers]; @@ -570,9 +570,9 @@ void PairRANN::read_layer_size(std::vector line,std::vectorone(filename,linenum-1,"networklayers for each atom type must be defined before the corresponding layer sizes."); - int j = utils::inumeric(filename,linenum,line[2].c_str(),1,lmp); + int j = utils::inumeric(filename,linenum,line[2].c_str(),true,lmp); if (j>=net[i].layers || j<0) {error->one(filename,linenum,"invalid layer in layer size definition");}; - net[i].dimensions[j]= utils::inumeric(filename,linenum,line1[0].c_str(),1,lmp); + net[i].dimensions[j]= utils::inumeric(filename,linenum,line1[0].c_str(),true,lmp); return; } } @@ -587,7 +587,7 @@ void PairRANN::read_weight(std::vector line,std::vectorone(filename,*linenum-1,"networklayers must be defined before weights."); - i=utils::inumeric(filename,*linenum,line[2].c_str(),1,lmp); + i=utils::inumeric(filename,*linenum,line[2].c_str(),true,lmp); if (i>=net[l].layers || i<0)error->one(filename,*linenum-1,"invalid weight layer"); if (net[l].dimensions[i]==0 || net[l].dimensions[i+1]==0) error->one(filename,*linenum-1,"network layer sizes must be defined before corresponding weight"); net[l].Weights[i] = new double[net[l].dimensions[i]*net[l].dimensions[i+1]]; @@ -595,7 +595,7 @@ void PairRANN::read_weight(std::vector line,std::vectorone(filename,*linenum,"invalid weights per line"); for (k=0;k line,std::vectorone(filename,*linenum,"invalid weights per line"); for (k=0;k line,std::vector for (l=0;lone(filename,*linenum-1,"networklayers must be defined before biases."); - i=utils::inumeric(filename,*linenum,line[2].c_str(),1,lmp); + i=utils::inumeric(filename,*linenum,line[2].c_str(),true,lmp); if (i>=net[l].layers || i<0)error->one(filename,*linenum-1,"invalid bias layer"); if (net[l].dimensions[i]==0) error->one(filename,*linenum-1,"network layer sizes must be defined before corresponding bias"); biasdefined[l][i] = true; net[l].Biases[i] = new double[net[l].dimensions[i+1]]; - net[l].Biases[i][0] = utils::numeric(filename,*linenum,line1[0].c_str(),1,lmp); + net[l].Biases[i][0] = utils::numeric(filename,*linenum,line1[0].c_str(),true,lmp); for (j=1;jone(filename,*linenum,"unexpected end of potential file!"); (*linenum)++; Tokenizer values1 = Tokenizer(linetemp,": ,\t_\n"); line1 = values1.as_vector(); - net[l].Biases[i][j] = utils::numeric(filename,*linenum,line1[0].c_str(),1,lmp); + net[l].Biases[i][j] = utils::numeric(filename,*linenum,line1[0].c_str(),true,lmp); } return; } @@ -680,10 +680,10 @@ void PairRANN::read_screening(std::vector line,std::vectorone(filename,linenum-1,"unrecognized screening keyword"); delete[] atomtypes; diff --git a/src/ML-SNAP/pair_snap.cpp b/src/ML-SNAP/pair_snap.cpp index d6da639734..1eb078bc61 100644 --- a/src/ML-SNAP/pair_snap.cpp +++ b/src/ML-SNAP/pair_snap.cpp @@ -640,7 +640,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) } eof = 0; - while (1) { + while (true) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); if (ptr == nullptr) { diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index fdd8ef7a18..201e40b5b8 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -954,7 +954,7 @@ void FixPOEMS::readfile(char *file) int nlocal = atom->nlocal; int i,id,nlen; - while (1) { + while (true) { if (me == 0) nlen = readline(fp,&line,&maxline); MPI_Bcast(&nlen,1,MPI_INT,0,world); if (nlen == 0) break; @@ -986,7 +986,7 @@ int FixPOEMS::readline(FILE *fp, char **pline, int *pmaxline) char *line = *pline; int maxline = *pmaxline; - while (1) { + while (true) { if (n+1 >= maxline) { maxline += DELTA; memory->grow(line,maxline,"fix_poems:line"); @@ -1246,7 +1246,7 @@ int FixPOEMS::loopcheck(int nvert, int nedge, tagint **elist) int *stack = new int[nvert]; ncluster = 0; - while (1) { + while (true) { for (i = 0; i < nvert; i++) if (mark[i] == 0) break; if (i == nvert) break; diff --git a/src/PTM/ptm_convex_hull_incremental.cpp b/src/PTM/ptm_convex_hull_incremental.cpp index 580d88c578..23b8e3a89d 100644 --- a/src/PTM/ptm_convex_hull_incremental.cpp +++ b/src/PTM/ptm_convex_hull_incremental.cpp @@ -263,7 +263,7 @@ int get_convex_hull(int num_points, const double (*points)[3], convexhull_t* ch, int ret = 0; int num_prev = ch->num_prev; ch->num_prev = num_points; - if (!ch->ok || 0) + if (!ch->ok || false) { ret = initialize_convex_hull(num_points, points, ch->facets, ch->plane_normal, ch->processed, ch->initial_vertices, ch->barycentre); if (ret != 0) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 79205f7c81..51262d7dc7 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -763,7 +763,7 @@ void FixQEq::read_file(char *file) " {}", file,utils::getsyserror())); TextFileReader reader(fp, "qeq parameter"); - while (1) { + while (true) { auto values = reader.next_values(0); if (values.count() == 0) continue; diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index bddeb330e4..d106c858b4 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -3763,7 +3763,7 @@ void FixBondReact::read(int myrxn) // stop when read an unrecognized line ncreate = 0; - while (1) { + while (true) { readline(line); diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 3c8e808f93..a839469d35 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -416,12 +416,12 @@ void FixReaxFFSpecies::FindMolecule () } loop = 0; - while (1) { + while (true) { comm->forward_comm_fix(this); loop ++; change = 0; - while (1) { + while (true) { done = 1; for (ii = 0; ii < inum; ii++) { diff --git a/src/REAXFF/reaxff_allocate.cpp b/src/REAXFF/reaxff_allocate.cpp index cbb53420ba..b81b8ed222 100644 --- a/src/REAXFF/reaxff_allocate.cpp +++ b/src/REAXFF/reaxff_allocate.cpp @@ -232,13 +232,13 @@ namespace ReaxFF { reallocate_data *wsr = &(workspace->realloc); if (system->n >= DANGER_ZONE * system->local_cap || - (0 && system->n <= LOOSE_ZONE * system->local_cap)) { + (false && system->n <= LOOSE_ZONE * system->local_cap)) { system->local_cap = MAX((int)(system->n * safezone), mincap); } int Nflag = 0; if (system->N >= DANGER_ZONE * system->total_cap || - (0 && system->N <= LOOSE_ZONE * system->total_cap)) { + (false && system->N <= LOOSE_ZONE * system->total_cap)) { Nflag = 1; system->total_cap = MAX((int)(system->N * safezone), mincap); } @@ -272,7 +272,7 @@ namespace ReaxFF { if (control->hbond_cut > 0) { Hflag = 0; if (system->numH >= DANGER_ZONE * system->Hcap || - (0 && system->numH <= LOOSE_ZONE * system->Hcap)) { + (false && system->numH <= LOOSE_ZONE * system->Hcap)) { Hflag = 1; system->Hcap = int(MAX(system->numH * saferzone, mincap)); } diff --git a/src/REAXFF/reaxff_control.cpp b/src/REAXFF/reaxff_control.cpp index 2020e8a5c3..3ee7614366 100644 --- a/src/REAXFF/reaxff_control.cpp +++ b/src/REAXFF/reaxff_control.cpp @@ -81,7 +81,7 @@ namespace ReaxFF { LAMMPS_NS::TextFileReader reader(control_file, "ReaxFF control"); reader.ignore_comments = false; - while (1) { + while (true) { auto values = reader.next_values(0); // empty line diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index ba91644c53..b506ef4f4a 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -980,7 +980,7 @@ void FixHyperLocal::build_bond_list(int natom) "hyper/local:clist"); } - while (1) { + while (true) { if (firstflag) break; for (i = 0; i < nall; i++) numcoeff[i] = 0; for (i = 0; i < nall; i++) clist[i] = nullptr; diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 8cfc4b5c24..e730aac351 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -392,7 +392,7 @@ void NEB::readfile(char *file, int flag) if (flag == 0) { if (me_universe == 0) { open(file); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; @@ -408,7 +408,7 @@ void NEB::readfile(char *file, int flag) if (me == 0) { if (ireplica) { open(file); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index db9767d01e..9c39518508 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -2281,7 +2281,7 @@ void FixRigid::readfile(int which, double *vec, if (fp == nullptr) error->one(FLERR,"Cannot open fix rigid file {}: {}", inpfile,utils::getsyserror()); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid file"); start = &line[strspn(line," \t\n\v\f\r")]; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 0ef05d926c..5db24a96d5 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -2451,7 +2451,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (fp == nullptr) error->one(FLERR,"Cannot open fix rigid/small file {}: {}", inpfile,utils::getsyserror()); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid/small file"); diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index 1c987f8e7e..0ed3ad28c3 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -387,7 +387,7 @@ void NEBSpin::readfile(char *file, int flag) if (flag == 0) { if (me_universe == 0) { open(file); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; @@ -401,7 +401,7 @@ void NEBSpin::readfile(char *file, int flag) if (me == 0) { if (ireplica) { open(file); - while (1) { + while (true) { eof = fgets(line,MAXLINE,fp); if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index f1e17eaa24..48d7d55663 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -1433,7 +1433,7 @@ void FixSRD::collisions_multi() jlast = -1; dt = dt_big; - while (1) { + while (true) { nbig = nbinbig[ibin]; if (ibounce == 0) ncheck += nbig; @@ -2263,7 +2263,7 @@ void FixSRD::slip(double *vs, double *vb, double *xb, Big *big, double *xsurf, d double tangent[3], vsurf[3]; double *omega = big->omega; - while (1) { + while (true) { r1 = sigma * random->gaussian(); r2 = sigma * random->gaussian(); vnmag = sqrt(r1 * r1 + r2 * r2); @@ -2319,7 +2319,7 @@ void FixSRD::slip_wall(double *vs, int iwall, double *norm, double *vsnew) tangent2[1] = norm[2] * tangent1[0] - norm[0] * tangent1[2]; tangent2[2] = norm[0] * tangent1[1] - norm[1] * tangent1[0]; - while (1) { + while (true) { r1 = sigma * random->gaussian(); r2 = sigma * random->gaussian(); vnmag = sqrt(r1 * r1 + r2 * r2); @@ -2370,7 +2370,7 @@ void FixSRD::noslip(double *vs, double *vb, double *xb, Big *big, int iwall, dou tangent2[1] = norm[2] * tangent1[0] - norm[0] * tangent1[2]; tangent2[2] = norm[0] * tangent1[1] - norm[1] * tangent1[0]; - while (1) { + while (true) { r1 = sigma * random->gaussian(); r2 = sigma * random->gaussian(); vnmag = sqrt(r1 * r1 + r2 * r2); diff --git a/src/atom.cpp b/src/atom.cpp index 796c0ba156..8bf361ab95 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1904,7 +1904,7 @@ void Atom::add_molecule(int narg, char **arg) int ifile = 1; int index = 1; - while (1) { + while (true) { molecules = (Molecule **) memory->srealloc(molecules,(nmolecule+1)*sizeof(Molecule *), "atom::molecules"); diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index a1ef126069..6308153be6 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -105,7 +105,7 @@ void AtomVecBody::process_args(int narg, char **arg) if (narg < 1) error->all(FLERR,"Invalid atom_style body command"); - if (0) { + if (false) { bptr = nullptr; #define BODY_CLASS diff --git a/src/balance.cpp b/src/balance.cpp index bd3ba007ef..3f325dffe6 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -930,7 +930,7 @@ int Balance::shift() // else add split I-1 or J+1 to set and try again // delta = size of expanded split set that will satisy criterion - while (1) { + while (true) { delta = (j-i) * close; midpt = 0.5 * (split[i]+split[j]); start = midpt - 0.5*delta; diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 482b90c4c2..28ef37b008 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -1884,7 +1884,7 @@ void CommTiled::box_drop_brick(int idim, double *lo, double *hi, int &indexme) if (index < 0 || index > procgrid[idim]) error->one(FLERR,"Comm tiled invalid index in box drop brick"); - while (1) { + while (true) { lower = boxlo[idim] + prd[idim]*split[index]; if (index < procgrid[idim]-1) upper = boxlo[idim] + prd[idim]*split[index+1]; diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 818d8657b8..cb39f61ce0 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -166,7 +166,7 @@ void ComputeAggregateAtom::compute_peratom() int change,done,anychange; - while (1) { + while (true) { comm->forward_comm_compute(this); // reverse communication when bonds are not stored on every processor @@ -175,7 +175,7 @@ void ComputeAggregateAtom::compute_peratom() comm->reverse_comm_compute(this); change = 0; - while (1) { + while (true) { done = 1; for (i = 0; i < nlocal; i++) { if (!(mask[i] & groupbit)) continue; diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 476af0bfa2..ca3fe1f453 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -164,11 +164,11 @@ void ComputeClusterAtom::compute_peratom() int change,done,anychange; - while (1) { + while (true) { comm->forward_comm_compute(this); change = 0; - while (1) { + while (true) { done = 1; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index 9ed57fef60..d361e29d41 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -150,7 +150,7 @@ void ComputeFragmentAtom::compute_peratom() int iteration = 0; - while (1) { + while (true) { iteration++; comm->forward_comm_compute(this); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index e82be7d331..f21d1fc23d 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -693,7 +693,7 @@ void CreateAtoms::add_random() int valid; for (int i = 0; i < nrandom; i++) { - while (1) { + while (true) { xone[0] = xlo + random->uniform() * (xhi-xlo); xone[1] = ylo + random->uniform() * (yhi-ylo); xone[2] = zlo + random->uniform() * (zhi-zlo); diff --git a/src/input.cpp b/src/input.cpp index 21c092f356..08f62bdb42 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -180,7 +180,7 @@ void Input::file() { int m,n; - while (1) { + while (true) { // read a line from input script // n = length of line including str terminator, 0 if end of file @@ -189,7 +189,7 @@ void Input::file() if (me == 0) { m = 0; - while (1) { + while (true) { if (infile == nullptr) { n = 0; diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index a5d0aa326c..c4c10d8a1f 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -253,7 +253,7 @@ int MinLineSearch::linemin_backtrack(double eoriginal, double &alpha) // backtrack with alpha until energy decrease is sufficient - while (1) { + while (true) { ecurrent = alpha_step(alpha,1); // if energy change is better than ideal, exit with success @@ -412,7 +412,7 @@ int MinLineSearch::linemin_quadratic(double eoriginal, double &alpha) // etmp-eoriginal+alphatmp*fdothall); // alpha_step(0.0,1); - while (1) { + while (true) { ecurrent = alpha_step(alpha,1); // compute new fh, alpha, delfh @@ -708,7 +708,7 @@ int MinLineSearch::linemin_forcezero(double eoriginal, double &alpha) // main linesearch loop - while (1) { + while (true) { backtrack = false; fhPrev = fhCurr; engPrev = engCurr; diff --git a/src/molecule.cpp b/src/molecule.cpp index 2c9b03337d..40ca218ecc 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -412,7 +412,7 @@ void Molecule::read(int flag) // skip blank lines or lines that start with "#" // stop when read an unrecognized line - while (1) { + while (true) { readline(line); diff --git a/src/platform.cpp b/src/platform.cpp index 555026b2ac..f589efc318 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -231,7 +231,7 @@ std::string platform::os_info() if (platform::file_is_readable("/etc/os-release")) { try { TextFileReader reader("/etc/os-release",""); - while (1) { + while (true) { auto words = reader.next_values(0,"="); if ((words.count() > 1) && (words.next_string() == "PRETTY_NAME")) { buf += " " + utils::trim(words.next_string()); diff --git a/src/procmap.cpp b/src/procmap.cpp index ed3839fe7b..3fc8a2263e 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -294,7 +294,7 @@ void ProcMap::custom_grid(char *cfile, int nprocs, char *ptr; if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of custom file"); - while (1) { + while (true) { if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") != strlen(line)) break; if (!fgets(line,MAXLINE,fp)) diff --git a/src/rcb.cpp b/src/rcb.cpp index b4d1c135ec..92eafebc28 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -285,7 +285,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, first_iteration = 1; indexlo = indexhi = 0; - while (1) { + while (true) { // choose bisector value // use old value on 1st iteration if old cut dimension is the same @@ -814,7 +814,7 @@ void RCB::compute_old(int dimension, int n, double **x, double *wt, first_iteration = 1; indexlo = indexhi = 0; - while (1) { + while (true) { // choose bisector value // use old value on 1st iteration if old cut dimension is the same diff --git a/src/read_data.cpp b/src/read_data.cpp index edbfc16696..0c7af243ac 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -430,7 +430,7 @@ void ReadData::command(int narg, char **arg) nlocal_previous = atom->nlocal; int firstpass = 1; - while (1) { + while (true) { // open file on proc 0 @@ -965,7 +965,7 @@ void ReadData::header(int firstpass) if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); } - while (1) { + while (true) { // read a line and bcast length diff --git a/src/read_dump.cpp b/src/read_dump.cpp index c09bd38c87..71d302c4f1 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -233,7 +233,7 @@ void ReadDump::setup_reader(int narg, char **arg) // create Nreader reader classes per reader // match readerstyle to options in style_reader.h - if (0) { + if (false) { return; // dummy line to enable else-if macro expansion #define READER_CLASS @@ -289,7 +289,7 @@ bigint ReadDump::seek(bigint nrequest, int exact) readers[0]->open_file(multiname.c_str()); } else readers[0]->open_file(files[ifile]); - while (1) { + while (true) { eofflag = readers[0]->read_time(ntimestep); if (eofflag) break; if (ntimestep >= nrequest) break; @@ -333,7 +333,7 @@ bigint ReadDump::seek(bigint nrequest, int exact) readers[i]->open_file(multiname.c_str()); bigint step; - while (1) { + while (true) { eofflag = readers[i]->read_time(step); if (eofflag) break; if (step == ntimestep) break; @@ -382,7 +382,7 @@ bigint ReadDump::next(bigint ncurrent, bigint nlast, int nevery, int nskip) } else readers[0]->open_file(files[ifile]); } - while (1) { + while (true) { eofflag = readers[0]->read_time(ntimestep); if (eofflag) break; if (ntimestep > nlast) break; @@ -435,7 +435,7 @@ bigint ReadDump::next(bigint ncurrent, bigint nlast, int nevery, int nskip) readers[i]->open_file(multiname.c_str()); bigint step; - while (1) { + while (true) { eofflag = readers[i]->read_time(step); if (eofflag) break; if (step == ntimestep) break; diff --git a/src/rerun.cpp b/src/rerun.cpp index ce21fbc2b8..78b1a28cb6 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -156,7 +156,7 @@ void Rerun::command(int narg, char **arg) if (ntimestep < 0) error->all(FLERR,"Rerun dump file does not contain requested snapshot"); - while (1) { + while (true) { ndump++; rd->header(firstflag); update->reset_timestep(ntimestep); diff --git a/src/universe.cpp b/src/universe.cpp index 005a91fc6b..bd06300d12 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -98,7 +98,7 @@ void Universe::reorder(char *style, char *arg) char *ptr; if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of -reorder file"); - while (1) { + while (true) { if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") != strlen(line)) break; if (!fgets(line,MAXLINE,fp)) diff --git a/src/utils.cpp b/src/utils.cpp index 507500f116..b6c0908934 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -957,7 +957,7 @@ std::vector utils::split_words(const std::string &text) } // unquoted - while (1) { + while (true) { if ((c == '\'') || (c == '"')) goto quoted; // skip escaped quote if ((c == '\\') && ((buf[1] == '\'') || (buf[1] == '"'))) { diff --git a/src/variable.cpp b/src/variable.cpp index 22f792b5ec..0add581c48 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -692,7 +692,7 @@ int Variable::next(int narg, char **arg) if (!random) random = new RanMars(lmp,seed); int delay = (int) (1000000*random->uniform()); platform::usleep(delay); - while (1) { + while (true) { if (!rename("tmp.lammps.variable","tmp.lammps.variable.lock")) break; delay = (int) (1000000*random->uniform()); platform::usleep(delay); @@ -1234,7 +1234,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (str == nullptr) print_var_error(FLERR,"Invalid syntax in variable formula",ivar); - while (1) { + while (true) { onechar = str[i]; // whitespace: just skip @@ -3214,7 +3214,7 @@ int Variable::find_matching_paren(char *str, int i, char *&contents, int ivar) int istart = i; int ilevel = 0; - while (1) { + while (true) { i++; if (!str[i]) break; if (str[i] == '(') ilevel++; @@ -4722,7 +4722,7 @@ double Variable::evaluate_boolean(char *str) int i = 0; int expect = ARG; - while (1) { + while (true) { onechar = str[i]; // whitespace: just skip @@ -5016,7 +5016,7 @@ int VarReader::read_scalar(char *str) // read one string from file if (me == 0) { - while (1) { + while (true) { ptr = fgets(str,MAXLINE,fp); if (!ptr) { n=0; break; } // end of file ptr[strcspn(ptr,"#")] = '\0'; // strip comment @@ -5059,7 +5059,7 @@ int VarReader::read_peratom() char str[MAXLINE]; if (me == 0) { - while (1) { + while (true) { ptr = fgets(str,MAXLINE,fp); if (!ptr) { n=0; break; } // end of file ptr[strcspn(ptr,"#")] = '\0'; // strip comment diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 6f53a97e8f..a21a2634fc 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -92,7 +92,7 @@ void WriteCoeff::command(int narg, char **arg) fprintf(two,"# LAMMPS coeff file via write_coeff, version %s\n", lmp->version); - while (1) { + while (true) { int coeff_mode = REGULAR_MODE; if (fgets(str,256,one) == nullptr) break; diff --git a/src/write_dump.cpp b/src/write_dump.cpp index 89c976fe09..53ab80149a 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -57,7 +57,7 @@ void WriteDump::command(int narg, char **arg) for (int i = 2; i < modindex; ++i) dumpargs[i+2] = arg[i]; - if (0) { + if (false) { return; // dummy line to enable else-if macro expansion #define DUMP_CLASS diff --git a/tools/binary2txt.cpp b/tools/binary2txt.cpp index a7724ffbd2..dfa81e8a6e 100644 --- a/tools/binary2txt.cpp +++ b/tools/binary2txt.cpp @@ -97,7 +97,7 @@ int main(int narg, char **arg) // loop over snapshots in file - while (1) { + while (true) { int endian = 0x0001; int revision = 0x0001; diff --git a/unittest/force-styles/test_config_reader.cpp b/unittest/force-styles/test_config_reader.cpp index 945c16c649..65e9e4b0f6 100644 --- a/unittest/force-styles/test_config_reader.cpp +++ b/unittest/force-styles/test_config_reader.cpp @@ -83,7 +83,7 @@ void TestConfigReader::prerequisites(const yaml_event_t &event) std::stringstream data((char *)event.data.scalar.value); std::string key, value; - while (1) { + while (true) { data >> key >> value; if (data.eof()) break; config.prerequisites.emplace_back(key, value); @@ -138,7 +138,7 @@ void TestConfigReader::extract(const yaml_event_t &event) std::stringstream data((char *)event.data.scalar.value); std::string name; int value; - while (1) { + while (true) { data >> name >> value; if (data.eof()) break; config.extract.emplace_back(name, value); From a0b25acf351422838dbab0e4a1c2d30336b63b1e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 20 Oct 2021 21:58:31 -0400 Subject: [PATCH 09/44] refactor loops using (auto var : container) syntax --- src/AWPMD/pair_awpmd_cut.cpp | 4 +-- src/EXTRA-FIX/fix_wall_ees.cpp | 6 +++-- src/EXTRA-FIX/fix_wall_region_ees.cpp | 14 ++++++---- src/KIM/kim_init.cpp | 10 +++---- src/MANIFOLD/manifold_thylakoid.cpp | 12 ++++----- src/MANYBODY/pair_airebo.cpp | 4 +-- src/PLUGIN/plugin.cpp | 4 +-- src/REACTION/fix_bond_react.cpp | 3 +-- unittest/c-library/test_library_commands.cpp | 28 ++++++++++---------- unittest/cplusplus/test_input_class.cpp | 12 ++++----- 10 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/AWPMD/pair_awpmd_cut.cpp b/src/AWPMD/pair_awpmd_cut.cpp index 682a0dd3d6..15cd316f12 100644 --- a/src/AWPMD/pair_awpmd_cut.cpp +++ b/src/AWPMD/pair_awpmd_cut.cpp @@ -246,8 +246,8 @@ void PairAWPMDCut::compute(int eflag, int vflag) fi= new Vector_3[wpmd->ni]; // adding electrons - for (std::map >::iterator it=etmap.begin(); it!= etmap.end(); ++it) { - std::vector &el=it->second; + for (auto & it : etmap) { + std::vector &el=it.second; if (!el.size()) // should not happen continue; int s=spin[el[0]] >0 ? 0 : 1; diff --git a/src/EXTRA-FIX/fix_wall_ees.cpp b/src/EXTRA-FIX/fix_wall_ees.cpp index c224e59d12..26ed4f52f1 100644 --- a/src/EXTRA-FIX/fix_wall_ees.cpp +++ b/src/EXTRA-FIX/fix_wall_ees.cpp @@ -121,8 +121,10 @@ void FixWallEES::wall_particle(int m, int which, double coord) double* shape = bonus[ellipsoid[i]].shape;; MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A); MathExtra::transpose_matvec(A,nhat,tempvec); - for (int k = 0; k<3; k++) tempvec[k] *= shape[k]; - for (int k = 0; k<3 ; k++) sigman2 += tempvec[k]*tempvec[k]; + for (int k = 0; k<3; k++) { + tempvec[k] *= shape[k]; + sigman2 += tempvec[k]*tempvec[k]; + } sigman = sqrt(sigman2); if (delta <= sigman) { diff --git a/src/EXTRA-FIX/fix_wall_region_ees.cpp b/src/EXTRA-FIX/fix_wall_region_ees.cpp index 81a67e8e58..261036333e 100644 --- a/src/EXTRA-FIX/fix_wall_region_ees.cpp +++ b/src/EXTRA-FIX/fix_wall_region_ees.cpp @@ -194,8 +194,10 @@ void FixWallRegionEES::post_force(int /*vflag*/) nhat[(which+2)%3] = 0 ; sn2 = 0 ; MathExtra::transpose_matvec(A,nhat,tempvec); - for (int k = 0; k<3; k++) tempvec[k] *= shape[k]; - for (int k = 0; k<3 ; k++) sn2 += tempvec[k]*tempvec[k]; + for (int k = 0; k<3; k++) { + tempvec[k] *= shape[k]; + sn2 += tempvec[k]*tempvec[k]; + } sn = sqrt(sn2); tooclose[which] = sn; } @@ -321,9 +323,11 @@ void FixWallRegionEES::ees(int m, int i) sigman2 = 0.0; MathExtra::transpose_matvec(A,nhat,tempvec); - for (int k = 0; k<3; k++) tempvec[k] *= shape[k]; - for (int k = 0; k<3; k++) sigman2 += tempvec[k]*tempvec[k]; - for (int k = 0; k<3; k++) SAn[k] = tempvec[k]; + for (int k = 0; k<3; k++) { + tempvec[k] *= shape[k]; + sigman2 += tempvec[k]*tempvec[k]; + SAn[k] = tempvec[k]; + } sigman = sqrt(sigman2); delta = fabs(region->contact[m].r); diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index a4003b7510..2c8a19251f 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -251,17 +251,15 @@ void KimInit::determine_model_type_and_units(char *model_name, char *user_units, return; } else if (unit_conversion_mode) { KIM_Model_Destroy(&pkim); - int const num_systems = 5; - char const *const systems[num_systems] = {"metal", "real", "si", "cgs", "electron"}; - for (int i = 0; i < num_systems; ++i) { - get_kim_unit_names(systems[i], lengthUnit, energyUnit, chargeUnit, temperatureUnit, - timeUnit, error); + const char * unit_systems[] = {"metal", "real", "si", "cgs", "electron"}; + for (auto units : unit_systems) { + get_kim_unit_names(units, lengthUnit, energyUnit, chargeUnit, temperatureUnit, timeUnit, error); kim_error = KIM_Model_Create(KIM_NUMBERING_zeroBased, lengthUnit, energyUnit, chargeUnit, temperatureUnit, timeUnit, model_name, &units_accepted, &pkim); if (units_accepted) { logID = fmt::format("{}_Model", comm->me); KIM_Model_SetLogID(pkim, logID.c_str()); - *model_units = utils::strdup(systems[i]); + *model_units = utils::strdup(units); return; } KIM_Model_Destroy(&pkim); diff --git a/src/MANIFOLD/manifold_thylakoid.cpp b/src/MANIFOLD/manifold_thylakoid.cpp index b7004cac3a..63bd26a800 100644 --- a/src/MANIFOLD/manifold_thylakoid.cpp +++ b/src/MANIFOLD/manifold_thylakoid.cpp @@ -38,8 +38,8 @@ manifold_thylakoid::manifold_thylakoid( LAMMPS *lmp, int /*narg*/, char ** /*arg manifold_thylakoid::~manifold_thylakoid() { - for (std::size_t i = 0; i < parts.size(); ++i) { - delete parts[i]; + for (auto & part : parts) { + delete part; } } @@ -73,11 +73,11 @@ void manifold_thylakoid::checkup() if (comm->me == 0) { fprintf(screen,"This is checkup of thylakoid %p\n", this); fprintf(screen,"I have %ld parts. They are:\n", parts.size()); - for (int i = 0; i < (int)parts.size(); ++i) { + for (auto & part : parts) { fprintf(screen, "[%f, %f] x [%f, %f] x [%f, %f]\n", - parts[i]->xlo, parts[i]->xhi, - parts[i]->ylo, parts[i]->yhi, - parts[i]->zlo, parts[i]->zhi ); + part->xlo, part->xhi, + part->ylo, part->yhi, + part->zlo, part->zhi ); } fprintf(screen,"My params are:\n"); for (int i = 0; i < NPARAMS; ++i) { diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index a02a5718ff..29d2121f1f 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -3485,8 +3485,8 @@ void PairAIREBO::read_file(char *filename) // global parameters current_section = "global parameters"; - for (int i = 0; i < (int)params.size(); i++) { - *params[i] = reader.next_double(); + for (auto & param : params) { + *param = reader.next_double(); } diff --git a/src/PLUGIN/plugin.cpp b/src/PLUGIN/plugin.cpp index 443fecc99f..4c20ff6fdd 100644 --- a/src/PLUGIN/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -464,8 +464,8 @@ namespace LAMMPS_NS const lammpsplugin_t *plugin_get_info(int idx) { int i=0; - for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { - if (i == idx) return &(*p); + for (auto & p : pluginlist) { + if (i == idx) return &p; ++i; } return nullptr; diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index d106c858b4..dbee51e034 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -2239,8 +2239,7 @@ double FixBondReact::custom_constraint(std::string varstr) } evlstr.push_back(varstr.substr(prev3+1)); - for (int i = 0; i < evlstr.size(); i++) - evlcat += evlstr[i]; + for (auto & evl : evlstr) evlcat += evl; char *cstr = utils::strdup(evlcat); val = input->variable->compute_equal(cstr); diff --git a/unittest/c-library/test_library_commands.cpp b/unittest/c-library/test_library_commands.cpp index 267ee6108e..b16dc6e9dd 100644 --- a/unittest/c-library/test_library_commands.cpp +++ b/unittest/c-library/test_library_commands.cpp @@ -54,14 +54,14 @@ TEST_F(LibraryCommands, from_file) const char cont_file[] = "in.cont"; fp = fopen(demo_file, "w"); - for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) { - fputs(demo_input[i], fp); + for (auto & inp : demo_input) { + fputs(inp, fp); fputc('\n', fp); } fclose(fp); fp = fopen(cont_file, "w"); - for (unsigned int i = 0; i < sizeof(cont_input) / sizeof(char *); ++i) { - fputs(cont_input[i], fp); + for (auto & inp : cont_input) { + fputs(inp, fp); fputc('\n', fp); } fclose(fp); @@ -84,8 +84,8 @@ TEST_F(LibraryCommands, from_line) { EXPECT_EQ(lammps_get_natoms(lmp), 0); if (!verbose) ::testing::internal::CaptureStdout(); - for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) { - lammps_command(lmp, demo_input[i]); + for (auto & inp : demo_input) { + lammps_command(lmp, inp); } if (!verbose) ::testing::internal::GetCapturedStdout(); EXPECT_EQ(lammps_get_natoms(lmp), 1); @@ -105,12 +105,12 @@ TEST_F(LibraryCommands, from_string) { std::string cmds(""); - for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) { - cmds += demo_input[i]; + for (auto & inp : demo_input) { + cmds += inp; cmds += "\n"; } - for (unsigned int i = 0; i < sizeof(cont_input) / sizeof(char *); ++i) { - cmds += cont_input[i]; + for (auto & inp : cont_input) { + cmds += inp; cmds += "\n"; } EXPECT_EQ(lammps_get_natoms(lmp), 0); @@ -125,12 +125,12 @@ TEST_F(LibraryCommands, from_string) if (!verbose) ::testing::internal::GetCapturedStdout(); cmds.clear(); - for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) { - cmds += demo_input[i]; + for (auto & inp : demo_input) { + cmds += inp; cmds += "\r\n"; } - for (unsigned int i = 0; i < sizeof(cont_input) / sizeof(char *); ++i) { - cmds += cont_input[i]; + for (auto & inp : cont_input) { + cmds += inp; cmds += "\r\n"; } EXPECT_EQ(lammps_get_natoms(lmp), 0); diff --git a/unittest/cplusplus/test_input_class.cpp b/unittest/cplusplus/test_input_class.cpp index 4af7450ed8..87bea36081 100644 --- a/unittest/cplusplus/test_input_class.cpp +++ b/unittest/cplusplus/test_input_class.cpp @@ -60,14 +60,14 @@ TEST_F(Input_commands, from_file) const char cont_file[] = "in.cont"; fp = fopen(demo_file, "w"); - for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) { - fputs(demo_input[i], fp); + for (auto & inp : demo_input) { + fputs(inp, fp); fputc('\n', fp); } fclose(fp); fp = fopen(cont_file, "w"); - for (unsigned int i = 0; i < sizeof(cont_input) / sizeof(char *); ++i) { - fputs(cont_input[i], fp); + for (auto & inp : cont_input) { + fputs(inp, fp); fputc('\n', fp); } fclose(fp); @@ -84,8 +84,8 @@ TEST_F(Input_commands, from_file) TEST_F(Input_commands, from_line) { EXPECT_EQ(lmp->atom->natoms, 0); - for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) { - lmp->input->one(demo_input[i]); + for (auto & inp : demo_input) { + lmp->input->one(inp); } EXPECT_EQ(lmp->atom->natoms, 1); }; From ede188652b357cbe2172f9641a3a7844491004b4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Oct 2021 07:33:00 -0400 Subject: [PATCH 10/44] update a few GPU kernels so they can be compiled on GPUs without double precisions support --- lib/gpu/lal_atom.cu | 2 +- lib/gpu/lal_atom.h | 2 +- lib/gpu/lal_zbl.cu | 12 ++++++------ lib/gpu/lal_zbl.h | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/gpu/lal_atom.cu b/lib/gpu/lal_atom.cu index 1418459301..287d72803c 100644 --- a/lib/gpu/lal_atom.cu +++ b/lib/gpu/lal_atom.cu @@ -18,7 +18,7 @@ #endif __kernel void kernel_cast_x(__global numtyp4 *restrict x_type, - const __global double *restrict x, + const __global numtyp *restrict x, const __global int *restrict type, const int nall) { int ii=GLOBAL_ID_X; diff --git a/lib/gpu/lal_atom.h b/lib/gpu/lal_atom.h index 3cf97d94a0..77c1faa784 100644 --- a/lib/gpu/lal_atom.h +++ b/lib/gpu/lal_atom.h @@ -475,7 +475,7 @@ class Atom { UCL_Vector v; #ifdef GPU_CAST - UCL_Vector x_cast; + UCL_Vector x_cast; UCL_Vector type_cast; #endif diff --git a/lib/gpu/lal_zbl.cu b/lib/gpu/lal_zbl.cu index 09e1b4f6bb..2a7d4795da 100644 --- a/lib/gpu/lal_zbl.cu +++ b/lib/gpu/lal_zbl.cu @@ -82,9 +82,9 @@ __kernel void k_zbl(const __global numtyp4 *restrict x_, const __global numtyp4 *restrict coeff1, const __global numtyp4 *restrict coeff2, const __global numtyp4 *restrict coeff3, - const double cut_globalsq, - const double cut_innersq, - const double cut_inner, + const numtyp cut_globalsq, + const numtyp cut_innersq, + const numtyp cut_inner, const int lj_types, const __global int *dev_nbor, const __global int *dev_packed, @@ -174,9 +174,9 @@ __kernel void k_zbl_fast(const __global numtyp4 *restrict x_, const __global numtyp4 *restrict coeff1_in, const __global numtyp4 *restrict coeff2_in, const __global numtyp4 *restrict coeff3_in, - const double cut_globalsq, - const double cut_innersq, - const double cut_inner, + const numtyp cut_globalsq, + const numtyp cut_innersq, + const numtyp cut_inner, const __global int *dev_nbor, const __global int *dev_packed, __global acctyp4 *restrict ans, diff --git a/lib/gpu/lal_zbl.h b/lib/gpu/lal_zbl.h index af4f1b2eac..b7b525661c 100644 --- a/lib/gpu/lal_zbl.h +++ b/lib/gpu/lal_zbl.h @@ -67,9 +67,9 @@ class ZBL : public BaseAtomic { /// If atom type constants fit in shared memory, use fast kernels bool shared_types; - double _cut_globalsq; - double _cut_innersq; - double _cut_inner; + numtyp _cut_globalsq; + numtyp _cut_innersq; + numtyp _cut_inner; /// Number of atom types int _lj_types; From 614b751f5f52fa6f731acde3fd7c5d896e64cdfe Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Fri, 22 Oct 2021 16:09:46 +0000 Subject: [PATCH 11/44] Add missing brace --- src/KOKKOS/kokkos_type.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index 248435ba03..15af1397bd 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -222,6 +222,7 @@ struct ExecutionSpaceFromDevice { template<> struct ExecutionSpaceFromDevice { static const LAMMPS_NS::ExecutionSpace space = LAMMPS_NS::Device; +}; #elif defined(KOKKOS_ENABLE_OPENMPTARGET) template<> struct ExecutionSpaceFromDevice { From 3cce6b46e20f3ef4602554337f0e8d67a5771bb4 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Fri, 22 Oct 2021 16:20:37 +0000 Subject: [PATCH 12/44] Fix thread divergence issue when not using CUDA/HIP --- src/KOKKOS/npair_kokkos.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 2ca16e7a60..42ecedd78a 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -226,7 +226,8 @@ void NPairKokkos::build(NeighList *list_) data.h_resize() = 0; Kokkos::deep_copy(d_scalars, h_scalars); -#ifdef LMP_KOKKOS_GPU + +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) #define BINS_PER_BLOCK 2 const int factor = atoms_per_bin<64?2:1; #else @@ -240,7 +241,7 @@ void NPairKokkos::build(NeighList *list_) if (newton_pair) { if (SIZE) { NPairKokkosBuildFunctorSize f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#if defined(LMP_KOKKOS_GPU) && !defined(KOKKOS_ENABLE_OPENMPTARGET) +#ifdef LMP_KOKKOS_GPU if (ExecutionSpaceFromDevice::space == Device) { int team_size = atoms_per_bin*factor; int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); @@ -258,7 +259,7 @@ void NPairKokkos::build(NeighList *list_) #endif } else { NPairKokkosBuildFunctor f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#if defined(LMP_KOKKOS_GPU) && !defined(KOKKOS_ENABLE_OPENMPTARGET) +#ifdef LMP_KOKKOS_GPU if (ExecutionSpaceFromDevice::space == Device) { int team_size = atoms_per_bin*factor; int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); @@ -278,7 +279,7 @@ void NPairKokkos::build(NeighList *list_) } else { if (SIZE) { NPairKokkosBuildFunctorSize f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#if defined(LMP_KOKKOS_GPU) && !defined(KOKKOS_ENABLE_OPENMPTARGET) +#ifdef LMP_KOKKOS_GPU if (ExecutionSpaceFromDevice::space == Device) { int team_size = atoms_per_bin*factor; int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); @@ -296,7 +297,7 @@ void NPairKokkos::build(NeighList *list_) #endif } else { NPairKokkosBuildFunctor f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#if defined(LMP_KOKKOS_GPU) && !defined(KOKKOS_ENABLE_OPENMPTARGET) +#ifdef LMP_KOKKOS_GPU if (ExecutionSpaceFromDevice::space == Device) { int team_size = atoms_per_bin*factor; int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); @@ -607,7 +608,6 @@ void NeighborKokkosExecute::build_ItemGPU(typename Kokkos::TeamPolic other_id[MY_II] = i; #if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) int test = (__syncthreads_count(i >= 0 && i <= nlocal) == 0); - if (test) return; #elif defined(KOKKOS_ENABLE_SYCL) int not_done = (i >= 0 && i <= nlocal); @@ -1059,7 +1059,6 @@ void NeighborKokkosExecute::build_ItemSizeGPU(typename Kokkos::TeamP other_id[MY_II] = i; #if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) int test = (__syncthreads_count(i >= 0 && i <= nlocal) == 0); - if (test) return; #elif defined(KOKKOS_ENABLE_SYCL) int not_done = (i >= 0 && i <= nlocal); From 0901540fdadc2242566c01daa2aa006cf04c5936 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Fri, 22 Oct 2021 16:41:26 +0000 Subject: [PATCH 13/44] Remove deprecated Kokkos code --- src/KOKKOS/kokkos_type.h | 2 +- src/KOKKOS/verlet_kokkos.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index 15af1397bd..4c0dea819c 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp index 5e9ab757c6..14540c9ace 100644 --- a/src/KOKKOS/verlet_kokkos.cpp +++ b/src/KOKKOS/verlet_kokkos.cpp @@ -283,7 +283,7 @@ void VerletKokkos::run(int n) atomKK->sync(Device,ALL_MASK); //static double time = 0.0; - //Kokkos::Impl::Timer ktimer; + //Kokkos::Timer ktimer; timer->init_timeout(); for (int i = 0; i < n; i++) { @@ -445,7 +445,7 @@ void VerletKokkos::run(int n) if (pair_compute_flag) { atomKK->sync(force->pair->execution_space,force->pair->datamask_read); atomKK->sync(force->pair->execution_space,~(~force->pair->datamask_read|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); - Kokkos::Impl::Timer ktimer; + Kokkos::Timer ktimer; force->pair->compute(eflag,vflag); atomKK->modified(force->pair->execution_space,force->pair->datamask_modify); atomKK->modified(force->pair->execution_space,~(~force->pair->datamask_modify|(F_MASK | ENERGY_MASK | VIRIAL_MASK))); From 7960a2d7d2c51cb80c5db30ad22f66ea6fd08067 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Fri, 22 Oct 2021 19:13:31 +0000 Subject: [PATCH 14/44] Fix link error with fix_acks2_reaxff_kokkos --- src/KOKKOS/fix_acks2_reaxff_kokkos.cpp | 2 +- src/KOKKOS/fix_acks2_reaxff_kokkos.h | 4 ++-- src/KOKKOS/fix_qeq_reaxff_kokkos.h | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp index 63fb1e7a53..8379dc8f46 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp @@ -1966,7 +1966,7 @@ void FixACKS2ReaxFFKokkos::get_chi_field() namespace LAMMPS_NS { template class FixACKS2ReaxFFKokkos; -#ifdef KOKKOS_ENABLE_CUDA +#ifdef LMP_KOKKOS_GPU template class FixACKS2ReaxFFKokkos; #endif } diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.h b/src/KOKKOS/fix_acks2_reaxff_kokkos.h index 67c737498f..bce90e97a3 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.h +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.h @@ -299,7 +299,7 @@ struct FixACKS2ReaxFFKokkosComputeHFunctor { c.template compute_h_team(team, atoms_per_team, vector_length); } - size_t team_shmem_size(int team_size) const { + size_t team_shmem_size(int /*team_size*/) const { size_t shmem_size = Kokkos::View::shmem_size( atoms_per_team) + // s_ilist @@ -347,7 +347,7 @@ struct FixACKS2ReaxFFKokkosComputeXFunctor { c.template compute_x_team(team, atoms_per_team, vector_length); } - size_t team_shmem_size(int team_size) const { + size_t team_shmem_size(int /*team_size*/) const { size_t shmem_size = Kokkos::View::shmem_size( atoms_per_team) + // s_ilist diff --git a/src/KOKKOS/fix_qeq_reaxff_kokkos.h b/src/KOKKOS/fix_qeq_reaxff_kokkos.h index 3256e56aef..fc4f4bafd5 100644 --- a/src/KOKKOS/fix_qeq_reaxff_kokkos.h +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.h @@ -30,7 +30,6 @@ FixStyle(qeq/reax/kk/host,FixQEqReaxFFKokkos); #include "kokkos_type.h" #include "neigh_list.h" #include "neigh_list_kokkos.h" -#include "kokkos_base.h" namespace LAMMPS_NS { @@ -42,7 +41,7 @@ struct TagFixQEqReaxFFPackForwardComm {}; struct TagFixQEqReaxFFUnpackForwardComm {}; template -class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { +class FixQEqReaxFFKokkos : public FixQEqReaxFF { public: typedef DeviceType device_type; typedef ArrayTypes AT; From c08093f768e6b92c386fa13854c3f40b01bec311 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 22 Oct 2021 16:00:01 -0400 Subject: [PATCH 15/44] modernize, avoid static buffers, use utility functions, remove debug code --- src/MANIFOLD/fix_nve_manifold_rattle.cpp | 14 ++-- src/MANIFOLD/fix_nvt_manifold_rattle.cpp | 28 +++----- src/MANIFOLD/manifold_gaussian_bump.cpp | 34 +-------- src/MANIFOLD/manifold_gaussian_bump.h | 2 - src/MANIFOLD/manifold_thylakoid.cpp | 88 +++++------------------- src/MANIFOLD/manifold_thylakoid.h | 1 - 6 files changed, 35 insertions(+), 132 deletions(-) diff --git a/src/MANIFOLD/fix_nve_manifold_rattle.cpp b/src/MANIFOLD/fix_nve_manifold_rattle.cpp index b4644a1350..1f0cc95b94 100644 --- a/src/MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/MANIFOLD/fix_nve_manifold_rattle.cpp @@ -140,10 +140,8 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, if (strcmp(arg[argi], "every") == 0) { nevery = utils::inumeric(FLERR,arg[argi+1],false,lmp); next_output = update->ntimestep + nevery; - if (comm->me == 0) { - fprintf(screen,"Outputting every %d steps, next is %d\n", - nevery, next_output); - } + if (comm->me == 0) + utils::logmesg(lmp,"Outputting every {} steps, next is {}\n",nevery, next_output); argi += 2; } else if (error_on_unknown_keyword) { error->all(FLERR,"Error parsing arg \"{}\".\n",arg[argi]); @@ -211,11 +209,9 @@ void FixNVEManifoldRattle::print_stats( const char *header ) double inv_tdiff = 1.0/( static_cast(ntimestep) - stats.last_out ); stats.last_out = ntimestep; - fprintf(screen, "%s stats for time step " BIGINT_FORMAT " on %d atoms:\n", - header, ntimestep, stats.natoms); - fprintf(screen, " iters/atom: x = %f, v = %f, dofs removed %d", - x_iters * inv_tdiff, v_iters * inv_tdiff, stats.dofs_removed); - fprintf(screen,"\n"); + utils::logmesg(lmp, "{} stats for time step {} on {} atoms:\n", header, ntimestep, stats.natoms); + utils::logmesg(lmp, " iters/atom: x = {}, v = {}, dofs removed = {}\n", + x_iters * inv_tdiff, v_iters * inv_tdiff, stats.dofs_removed); } stats.x_iters_per_atom = 0; diff --git a/src/MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/MANIFOLD/fix_nvt_manifold_rattle.cpp index f675cdff73..0dcc233b54 100644 --- a/src/MANIFOLD/fix_nvt_manifold_rattle.cpp +++ b/src/MANIFOLD/fix_nvt_manifold_rattle.cpp @@ -32,21 +32,21 @@ ------------------------------------------------------------------------- */ - #include "fix_nvt_manifold_rattle.h" -#include -#include + #include "atom.h" -#include "force.h" -#include "update.h" -#include "error.h" -#include "group.h" #include "citeme.h" -#include "modify.h" #include "compute.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "modify.h" +#include "update.h" #include "manifold.h" +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -115,9 +115,7 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, mtchain = utils::inumeric(FLERR, arg[argi+1],false,lmp); argi += 2; } else if (error_on_unknown_keyword) { - char msg[2048]; - sprintf(msg,"Error parsing arg \"%s\".\n", arg[argi]); - error->all(FLERR, msg); + error->all(FLERR, "Error parsing arg \"{}\".\n", arg[argi]); } else { argi += 1; } @@ -271,12 +269,8 @@ void FixNVTManifoldRattle::nhc_temp_integrate() factor_eta = exp(-dthalf*eta_dot[0]); - if (factor_eta == 0) { - char msg[2048]; - sprintf(msg, "WTF, factor_eta is 0! dthalf = %f, eta_dot[0] = %f", - dthalf, eta_dot[0]); - error->all(FLERR,msg); - } + if (factor_eta == 0) + error->all(FLERR, "factor_eta is 0! dthalf = {}, eta_dot[0] = {}", dthalf, eta_dot[0]); nh_v_temp(); diff --git a/src/MANIFOLD/manifold_gaussian_bump.cpp b/src/MANIFOLD/manifold_gaussian_bump.cpp index 5eb2b08504..1483ff7489 100644 --- a/src/MANIFOLD/manifold_gaussian_bump.cpp +++ b/src/MANIFOLD/manifold_gaussian_bump.cpp @@ -67,9 +67,7 @@ public: double get_t_from_x( double xx ) const { if (xx < x0 || xx > x1) { - char msg[2048]; - sprintf(msg, "x ( %g ) out of bounds [%g, %g]", xx, x0, x1 ); - err->one(FLERR, msg); + err->one(FLERR,"x ( {} ) out of bounds [{}, {}]", xx, x0, x1 ); } // Newton iterate to get right t. @@ -271,8 +269,6 @@ void manifold_gaussian_bump::post_param_init() make_lut(); - - // test_lut(); } @@ -360,31 +356,3 @@ void manifold_gaussian_bump::lut_get_z_and_zp( double rr, double &zz, zz = zleft * fmin + zright * frac; zzp = zpleft * fmin + zpright * frac; } - - -void manifold_gaussian_bump::test_lut() -{ - double x[3], nn[3]; - if (comm->me != 0) return; - - FILE *fp = fopen( "test_lut_gaussian.dat", "w" ); - double dx = 0.1; - for (double xx = 0; xx < 20; xx += dx) { - x[0] = xx; - x[1] = 0.0; - x[2] = 0.0; - double gg = g( x ); - n( x, nn ); - double taper_z; - if (xx <= rc1) { - taper_z = gaussian_bump(xx); - } else if (xx < rc2) { - taper_z = lut_get_z( xx ); - } else { - taper_z = 0.0; - } - fprintf( fp, "%g %g %g %g %g %g %g\n", xx, gaussian_bump(xx), taper_z, - gg, nn[0], nn[1], nn[2] ); - } - fclose(fp); -} diff --git a/src/MANIFOLD/manifold_gaussian_bump.h b/src/MANIFOLD/manifold_gaussian_bump.h index 8c72db080f..4671b189df 100644 --- a/src/MANIFOLD/manifold_gaussian_bump.h +++ b/src/MANIFOLD/manifold_gaussian_bump.h @@ -86,8 +86,6 @@ namespace user_manifold { double lut_get_zp(double rr) const; void lut_get_z_and_zp(double rr, double &zz, double &zzp) const; - void test_lut(); - double taper(double); double taper_der(double); }; diff --git a/src/MANIFOLD/manifold_thylakoid.cpp b/src/MANIFOLD/manifold_thylakoid.cpp index b7004cac3a..5ab90ce08e 100644 --- a/src/MANIFOLD/manifold_thylakoid.cpp +++ b/src/MANIFOLD/manifold_thylakoid.cpp @@ -34,8 +34,6 @@ manifold_thylakoid::manifold_thylakoid( LAMMPS *lmp, int /*narg*/, char ** /*arg // fix should call post_param_init(); } - - manifold_thylakoid::~manifold_thylakoid() { for (std::size_t i = 0; i < parts.size(); ++i) { @@ -43,8 +41,6 @@ manifold_thylakoid::~manifold_thylakoid() } } - - void manifold_thylakoid::post_param_init() { // Set coefficients: @@ -59,52 +55,21 @@ void manifold_thylakoid::post_param_init() LB = params[1]; lB = params[2]; - if (comm->me == 0) { - fprintf(screen,"My params are now: lT = %f, LT = %f, pad = %f, " - "wB = %f, LB = %f, lB = %f\n", lT, LT, pad, wB, LB, lB ); - fprintf(screen,"Calling init_domains() from post_param_init().\n"); - } init_domains(); - checkup(); } -void manifold_thylakoid::checkup() -{ - if (comm->me == 0) { - fprintf(screen,"This is checkup of thylakoid %p\n", this); - fprintf(screen,"I have %ld parts. They are:\n", parts.size()); - for (int i = 0; i < (int)parts.size(); ++i) { - fprintf(screen, "[%f, %f] x [%f, %f] x [%f, %f]\n", - parts[i]->xlo, parts[i]->xhi, - parts[i]->ylo, parts[i]->yhi, - parts[i]->zlo, parts[i]->zhi ); - } - fprintf(screen,"My params are:\n"); - for (int i = 0; i < NPARAMS; ++i) { - fprintf(screen,"%f\n", params[i]); - } - } -} - - double manifold_thylakoid::g( const double *x ) { int err = 0; std::size_t idx; thyla_part *p = get_thyla_part(x,&err,&idx); - if (err) { - char msg[2048]; - sprintf(msg,"Error getting thyla_part for x = (%f, %f, %f)",x[0],x[1],x[2]); - error->one(FLERR,msg); - } + if (err) error->one(FLERR,"Error getting thyla_part for x = ({}, {}, {})",x[0],x[1],x[2]); + double con_val = p->g(x); if (std::isfinite(con_val)) { return con_val; } else { - char msg[2048]; - sprintf(msg,"Error, thyla_part of type %d returned %f as constraint val!", - p->type, con_val); - error->one(FLERR,msg); + error->one(FLERR,"Error, thyla_part of type {} returned {} as constraint val!", p->type, con_val); return 0; } } @@ -114,20 +79,14 @@ void manifold_thylakoid::n( const double *x, double *n ) int err = 0; std::size_t idx; thyla_part *p = get_thyla_part(x,&err,&idx); - if (err) { - char msg[2048]; - sprintf(msg,"Error getting thyla_part for x = (%f, %f, %f)",x[0],x[1],x[2]); - error->one(FLERR,msg); - } + if (err) + error->one(FLERR,"Error getting thyla_part for x = ({}, {}, {})",x[0],x[1],x[2]); p->n(x,n); if (std::isfinite(n[0]) && std::isfinite(n[1]) && std::isfinite(n[2])) { return; - } else { - char msg[2048]; - sprintf(msg,"Error, thyla_part of type %d returned (%f,%f,%f) as gradient!", - p->type, n[0], n[1], n[2]); - error->one(FLERR,msg); - } + } else + error->one(FLERR,"thyla_part of type {} returned ({},{},{}) as gradient!", + p->type, n[0], n[1], n[2]); } thyla_part *manifold_thylakoid::get_thyla_part( const double *x, int * /*err_flag*/, std::size_t *idx ) @@ -140,9 +99,7 @@ thyla_part *manifold_thylakoid::get_thyla_part( const double *x, int * /*err_fla return p; } } - char msg[2048]; - sprintf(msg,"Could not find thyla_part for x = (%f,%f,%f)", x[0],x[1],x[2]); - error->one(FLERR,msg); + error->one(FLERR,"Could not find thyla_part for x = ({},{},{})", x[0],x[1],x[2]); return nullptr; } @@ -153,12 +110,9 @@ thyla_part *manifold_thylakoid::get_thyla_part( const double *x, int * /*err_fla void manifold_thylakoid::init_domains() { - if (wB + 2*lB > LT) { - char msg[2048]; - sprintf(msg,"LT = %f not large enough to accommodate bridge with " - "wB = %f and lB = %f! %f > %f\n", LT, wB, lB, wB + 2*lB, LT); - error->one(FLERR,msg); - } + if (wB + 2*lB > LT) + error->one(FLERR,"LT = {} not large enough to accommodate bridge with " + "wB = {} and lB = {}! {} > {}\n", LT, wB, lB, wB + 2*lB, LT); // Determine some constant coordinates: x0 = -( 0.5*LB + lB + lT + LT + lT + pad); @@ -375,12 +329,9 @@ void manifold_thylakoid::init_domains() parts.push_back(p); // Check if this plane lines up with bl: - if (fabs(plr.pt[0] - bl.pt[0] + lB) > 1e-8) { - char msg[2048]; - sprintf(msg,"Origins of plane left right and bridge left misaligned! %f != %f!\n", - plr.pt[0], bl.pt[0] - lB ); - error->one(FLERR,msg); - } + if (fabs(plr.pt[0] - bl.pt[0] + lB) > 1e-8) + error->one(FLERR,"Origins of plane left right and bridge left misaligned! {} != {}!\n", + plr.pt[0], bl.pt[0] - lB ); // Now, for the right stack, you can mirror the other... // To mirror them you need to invert lo[0] and hi[0] and flip their sign. @@ -428,12 +379,9 @@ void manifold_thylakoid::init_domains() set_domain(p, prr.lo, prr.hi); parts.push_back(p); - if (fabs(prr.pt[0] - br.pt[0] - lB) > 1e-8) { - char msg[2048]; - sprintf(msg,"Origins of plane left right and bridge left misaligned! %f != %f!\n", - prr.pt[0], br.pt[0] + lB); - error->one(FLERR,msg); - } + if (fabs(prr.pt[0] - br.pt[0] - lB) > 1e-8) + error->one(FLERR,"Origins of plane left right and bridge left misaligned! {} != {}!\n", + prr.pt[0], br.pt[0] + lB); } diff --git a/src/MANIFOLD/manifold_thylakoid.h b/src/MANIFOLD/manifold_thylakoid.h index 5470d722f9..0236c3bf54 100644 --- a/src/MANIFOLD/manifold_thylakoid.h +++ b/src/MANIFOLD/manifold_thylakoid.h @@ -37,7 +37,6 @@ namespace user_manifold { virtual int nparams() { return NPARAMS; } virtual void post_param_init(); - virtual void checkup(); // Some diagnostics... private: void init_domains(); From 47eab736bb96c9feffccdade870da7c0a2e98846 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 22 Oct 2021 16:14:06 -0400 Subject: [PATCH 16/44] use anonymous namespace to manage visibility of multiple copies of parse_error class --- src/EXTRA-FIX/fix_ttm.cpp | 12 ++++++++++++ src/EXTRA-FIX/fix_ttm.h | 8 -------- src/EXTRA-FIX/fix_ttm_grid.cpp | 12 ++++++++++++ src/EXTRA-FIX/fix_ttm_mod.cpp | 12 ++++++++++++ src/EXTRA-FIX/fix_ttm_mod.h | 8 -------- src/QEQ/fix_qeq.cpp | 14 ++++++++------ src/REAXFF/fix_acks2_reaxff.cpp | 14 ++++++++------ src/REAXFF/fix_qeq_reaxff.cpp | 14 ++++++++------ src/REAXFF/reaxff_control.cpp | 16 +++++++++------- src/REAXFF/reaxff_ffield.cpp | 6 ++++-- 10 files changed, 73 insertions(+), 43 deletions(-) diff --git a/src/EXTRA-FIX/fix_ttm.cpp b/src/EXTRA-FIX/fix_ttm.cpp index 13fbd4aff4..4c0d2e9cd5 100644 --- a/src/EXTRA-FIX/fix_ttm.cpp +++ b/src/EXTRA-FIX/fix_ttm.cpp @@ -46,6 +46,18 @@ using namespace FixConst; static constexpr int OFFSET = 16384; static constexpr double SHIFT = 0.0; +// helper class + +namespace { + class parser_error : public std::exception { + std::string message; + + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; +} + /* ---------------------------------------------------------------------- */ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : diff --git a/src/EXTRA-FIX/fix_ttm.h b/src/EXTRA-FIX/fix_ttm.h index 1a2e9fb24a..da782b1f5a 100644 --- a/src/EXTRA-FIX/fix_ttm.h +++ b/src/EXTRA-FIX/fix_ttm.h @@ -77,14 +77,6 @@ class FixTTM : public Fix { virtual void deallocate_grid(); virtual void read_electron_temperatures(const std::string &); virtual void write_electron_temperatures(const std::string &); - - class parser_error : public std::exception { - std::string message; - - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index 7b3f434907..b42b876a3b 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -41,6 +41,18 @@ static constexpr int MAXLINE = 256; static constexpr int CHUNK = 1024; static constexpr int OFFSET = 16384; +// helper class + +namespace { + class parser_error : public std::exception { + std::string message; + + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; +} + /* ---------------------------------------------------------------------- */ FixTTMGrid::FixTTMGrid(LAMMPS *lmp, int narg, char **arg) : diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index 0aef2ec4ff..d39d50c9e5 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -41,6 +41,18 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; +// helper class + +namespace { + class parser_error : public std::exception { + std::string message; + + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; +} + // OFFSET avoids outside-of-box atoms being rounded to grid pts incorrectly // SHIFT = 0.0 assigns atoms to lower-left grid pt // SHIFT = 0.5 assigns atoms to nearest grid pt diff --git a/src/EXTRA-FIX/fix_ttm_mod.h b/src/EXTRA-FIX/fix_ttm_mod.h index f26f270e7a..21eb0efcaa 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.h +++ b/src/EXTRA-FIX/fix_ttm_mod.h @@ -87,14 +87,6 @@ class FixTTMMod : public Fix { void read_parameters(const std::string &); void read_electron_temperatures(const std::string &); void write_electron_temperatures(const std::string &); - - class parser_error : public std::exception { - std::string message; - - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; }; } // namespace LAMMPS_NS diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 79205f7c81..b43afb00d6 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -42,12 +42,14 @@ using namespace FixConst; #define MAXLINE 1024 -class parser_error : public std::exception { - std::string message; -public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } -}; +namespace { + class parser_error : public std::exception { + std::string message; + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; +} /* ---------------------------------------------------------------------- */ diff --git a/src/REAXFF/fix_acks2_reaxff.cpp b/src/REAXFF/fix_acks2_reaxff.cpp index f19b31f9ed..ec14ed72b2 100644 --- a/src/REAXFF/fix_acks2_reaxff.cpp +++ b/src/REAXFF/fix_acks2_reaxff.cpp @@ -43,12 +43,14 @@ using namespace LAMMPS_NS; using namespace FixConst; -class parser_error : public std::exception { - std::string message; -public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } -}; +namespace { + class parser_error : public std::exception { + std::string message; + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; +} static const char cite_fix_acks2_reax[] = "fix acks2/reaxff command:\n\n" diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index f0ba651a26..89ee3f338f 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -49,12 +49,14 @@ using namespace LAMMPS_NS; using namespace FixConst; -class parser_error : public std::exception { - std::string message; -public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } -}; +namespace { + class parser_error : public std::exception { + std::string message; + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; +} static constexpr double EV_TO_KCAL_PER_MOL = 14.4; static constexpr double SMALL = 1.0e-14; diff --git a/src/REAXFF/reaxff_control.cpp b/src/REAXFF/reaxff_control.cpp index 2020e8a5c3..90f12b2031 100644 --- a/src/REAXFF/reaxff_control.cpp +++ b/src/REAXFF/reaxff_control.cpp @@ -40,6 +40,15 @@ using LAMMPS_NS::utils::sfgets; using LAMMPS_NS::utils::logmesg; using LAMMPS_NS::ValueTokenizer; +namespace { + class parser_error : public std::exception { + std::string message; + public: + parser_error(const std::string &mesg) { message = mesg; } + const char *what() const noexcept { return message.c_str(); } + }; +} + namespace ReaxFF { static std::unordered_set inactive_keywords = { "ensemble_type", "nsteps", "dt", "proc_by_dim", "random_vel", @@ -54,13 +63,6 @@ namespace ReaxFF { "energy_update_freq", "atom_info", "atom_velocities", "atom_forces", "bond_info", "angle_info" }; - class parser_error : public std::exception { - std::string message; - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; - // NOTE: this function is run on MPI rank 0 only void Read_Control_File(const char *control_file, control_params *control) diff --git a/src/REAXFF/reaxff_ffield.cpp b/src/REAXFF/reaxff_ffield.cpp index 605e077724..db4a63972e 100644 --- a/src/REAXFF/reaxff_ffield.cpp +++ b/src/REAXFF/reaxff_ffield.cpp @@ -41,14 +41,16 @@ using LAMMPS_NS::utils::open_potential; using LAMMPS_NS::utils::getsyserror; using LAMMPS_NS::utils::uppercase; -namespace ReaxFF { - +namespace { class parser_error : public std::exception { std::string message; public: parser_error(const std::string &mesg) { message = mesg; } const char *what() const noexcept { return message.c_str(); } }; +} + +namespace ReaxFF { void Read_Force_Field(const char *filename, reax_interaction *reax, control_params *control, MPI_Comm world) From 71a24580b8eadcff62d11c88630d4e173941dd19 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 23 Oct 2021 04:24:54 -0400 Subject: [PATCH 17/44] remove parser_error exception class ambiguity completely --- src/EXTRA-FIX/fix_ttm.cpp | 17 ++--------------- src/EXTRA-FIX/fix_ttm_grid.cpp | 16 ++-------------- src/EXTRA-FIX/fix_ttm_mod.cpp | 16 ++-------------- src/QEQ/fix_qeq.cpp | 12 ++++++------ src/REAXFF/fix_acks2_reaxff.cpp | 20 ++++++-------------- src/REAXFF/fix_qeq_reaxff.cpp | 17 +++++------------ src/REAXFF/reaxff_control.cpp | 23 +++++++++++------------ src/REAXFF/reaxff_ffield.cpp | 14 ++++++-------- src/tokenizer.h | 6 +++--- 9 files changed, 43 insertions(+), 98 deletions(-) diff --git a/src/EXTRA-FIX/fix_ttm.cpp b/src/EXTRA-FIX/fix_ttm.cpp index 4c0d2e9cd5..de4b0a4c7e 100644 --- a/src/EXTRA-FIX/fix_ttm.cpp +++ b/src/EXTRA-FIX/fix_ttm.cpp @@ -28,7 +28,6 @@ #include "random_mars.h" #include "respa.h" #include "potential_file_reader.h" -#include "tokenizer.h" #include "update.h" #include @@ -46,18 +45,6 @@ using namespace FixConst; static constexpr int OFFSET = 16384; static constexpr double SHIFT = 0.0; -// helper class - -namespace { - class parser_error : public std::exception { - std::string message; - - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; -} - /* ---------------------------------------------------------------------- */ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : @@ -503,10 +490,10 @@ void FixTTM::read_electron_temperatures(const std::string &filename) // check correctness of input data if ((ix < 0) || (ix >= nxgrid) || (iy < 0) || (iy >= nygrid) || (iz < 0) || (iz >= nzgrid)) - throw parser_error("Fix ttm invalid grid index in fix ttm grid file"); + throw TokenizerException("Fix ttm invalid grid index in fix ttm grid file",""); if (T_tmp < 0.0) - throw parser_error("Fix ttm electron temperatures must be > 0.0"); + throw TokenizerException("Fix ttm electron temperatures must be > 0.0",""); T_electron[iz][iy][ix] = T_tmp; T_initial_set[iz][iy][ix] = 1; diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index b42b876a3b..8890750818 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -41,18 +41,6 @@ static constexpr int MAXLINE = 256; static constexpr int CHUNK = 1024; static constexpr int OFFSET = 16384; -// helper class - -namespace { - class parser_error : public std::exception { - std::string message; - - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; -} - /* ---------------------------------------------------------------------- */ FixTTMGrid::FixTTMGrid(LAMMPS *lmp, int narg, char **arg) : @@ -318,7 +306,7 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename) int iz = values.next_int(); if (ix < 0 || ix >= nxgrid || iy < 0 || iy >= nygrid || iz < 0 || iz >= nzgrid) - throw parser_error("Fix ttm/grid invalid grid index in input"); + throw TokenizerException("Fix ttm/grid invalid grid index in input",""); if (ix >= nxlo_in && ix <= nxhi_in && iy >= nylo_in && iy <= nyhi_in && iz >= nzlo_in && iz <= nzhi_in) { @@ -326,7 +314,7 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename) T_initial_set[iz][iy][ix] = 1; } } else { - throw parser_error("Incorrect format in fix ttm electron grid file"); + throw TokenizerException("Incorrect format in fix ttm electron grid file",""); } } catch (std::exception &e) { error->one(FLERR,e.what()); diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index d39d50c9e5..233f877e8c 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -41,18 +41,6 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -// helper class - -namespace { - class parser_error : public std::exception { - std::string message; - - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; -} - // OFFSET avoids outside-of-box atoms being rounded to grid pts incorrectly // SHIFT = 0.0 assigns atoms to lower-left grid pt // SHIFT = 0.5 assigns atoms to nearest grid pt @@ -596,10 +584,10 @@ void FixTTMMod::read_electron_temperatures(const std::string &filename) // check correctness of input data if ((ix < 0) || (ix >= nxgrid) || (iy < 0) || (iy >= nygrid) || (iz < 0) || (iz >= nzgrid)) - throw parser_error("Fix ttm invalid grid index in fix ttm/mod grid file"); + throw TokenizerException("Fix ttm invalid grid index in fix ttm/mod grid file",""); if (T_tmp < 0.0) - throw parser_error("Fix ttm electron temperatures must be > 0.0"); + throw TokenizerException("Fix ttm electron temperatures must be > 0.0",""); T_electron[iz][iy][ix] = T_tmp; T_initial_set[iz][iy][ix] = 1; diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index b43afb00d6..5a4e4e4e7d 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -43,10 +43,10 @@ using namespace FixConst; #define MAXLINE 1024 namespace { - class parser_error : public std::exception { + class qeq_parser_error : public std::exception { std::string message; public: - parser_error(const std::string &mesg) { message = mesg; } + explicit qeq_parser_error(const std::string &mesg) { message = mesg; } const char *what() const noexcept { return message.c_str(); } }; } @@ -761,8 +761,8 @@ void FixQEq::read_file(char *file) FILE *fp = utils::open_potential(file,lmp,nullptr); if (fp == nullptr) - throw parser_error(fmt::format("Cannot open fix qeq parameter file {}:" - " {}", file,utils::getsyserror())); + throw qeq_parser_error(fmt::format("Cannot open fix qeq parameter file {}: {}", + file,utils::getsyserror())); TextFileReader reader(fp, "qeq parameter"); while (1) { @@ -770,12 +770,12 @@ void FixQEq::read_file(char *file) if (values.count() == 0) continue; if (values.count() < 6) - throw parser_error("Invalid qeq parameter file"); + throw qeq_parser_error("Invalid qeq parameter file"); auto word = values.next_string(); utils::bounds(FLERR,word,1,ntypes,nlo,nhi,nullptr); if ((nlo < 0) || (nhi < 0)) - throw parser_error("Invalid atom type range"); + throw qeq_parser_error(fmt::format("Invalid atom type range: {}",word)); val = values.next_double(); for (int n=nlo; n <= nhi; ++n) chi[n] = val; diff --git a/src/REAXFF/fix_acks2_reaxff.cpp b/src/REAXFF/fix_acks2_reaxff.cpp index ec14ed72b2..b6789b1b2e 100644 --- a/src/REAXFF/fix_acks2_reaxff.cpp +++ b/src/REAXFF/fix_acks2_reaxff.cpp @@ -43,15 +43,6 @@ using namespace LAMMPS_NS; using namespace FixConst; -namespace { - class parser_error : public std::exception { - std::string message; - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; -} - static const char cite_fix_acks2_reax[] = "fix acks2/reaxff command:\n\n" "@Article{O'Hearn2020,\n" @@ -175,26 +166,27 @@ void FixACKS2ReaxFF::pertype_parameters(char *arg) const char *line = reader.next_line(); if (!line) - throw parser_error("Invalid parameter file for fix acks2/reaxff"); + throw TokenizerException("Invalid parameter file for fix acks2/reaxff",""); ValueTokenizer values(line); if (values.count() != 1) - throw parser_error("Fix acks2/reaxff: Incorrect format of parameter file"); + throw TokenizerException("Fix acks2/reaxff: Incorrect parameter file format",""); bond_softness = values.next_double(); for (int i = 1; i <= ntypes; i++) { const char *line = reader.next_line(); if (!line) - throw parser_error("Invalid parameter file for fix acks2/reaxff"); + throw TokenizerException("Fix acks2/reaxff: Incorrect parameter file format",""); ValueTokenizer values(line); if (values.count() != 5) - throw parser_error("Fix acks2/reaxff: Incorrect format of parameter file"); + throw TokenizerException("Fix acks2/reaxff: Incorrect parameter file format",""); int itype = values.next_int(); if ((itype < 1) || (itype > ntypes)) - throw parser_error("Fix acks2/reaxff: invalid atom type in parameter file"); + throw TokenizerException("Fix acks2/reaxff: invalid atom type in parameter file", + std::to_string(itype)); chi[itype] = values.next_double(); eta[itype] = values.next_double(); diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index 89ee3f338f..874a10bbae 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -45,19 +45,11 @@ #include #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; -namespace { - class parser_error : public std::exception { - std::string message; - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; -} - static constexpr double EV_TO_KCAL_PER_MOL = 14.4; static constexpr double SMALL = 1.0e-14; @@ -243,15 +235,16 @@ void FixQEqReaxFF::pertype_parameters(char *arg) for (int i = 1; i <= ntypes; i++) { const char *line = reader.next_line(); if (!line) - throw parser_error("Invalid param file for fix qeq/reaxff"); + throw TokenizerException("Fix qeq/reaxff: Invalid param file format",""); ValueTokenizer values(line); if (values.count() != 4) - throw parser_error("Fix qeq/reaxff: Incorrect format of param file"); + throw TokenizerException("Fix qeq/reaxff: Incorrect format of param file",""); int itype = values.next_int(); if ((itype < 1) || (itype > ntypes)) - throw parser_error("Fix qeq/reaxff: invalid atom type in param file"); + throw TokenizerException("Fix qeq/reaxff: invalid atom type in param file", + std::to_string(itype)); chi[itype] = values.next_double(); eta[itype] = values.next_double(); diff --git a/src/REAXFF/reaxff_control.cpp b/src/REAXFF/reaxff_control.cpp index 90f12b2031..a95ec1d4ac 100644 --- a/src/REAXFF/reaxff_control.cpp +++ b/src/REAXFF/reaxff_control.cpp @@ -40,15 +40,6 @@ using LAMMPS_NS::utils::sfgets; using LAMMPS_NS::utils::logmesg; using LAMMPS_NS::ValueTokenizer; -namespace { - class parser_error : public std::exception { - std::string message; - public: - parser_error(const std::string &mesg) { message = mesg; } - const char *what() const noexcept { return message.c_str(); } - }; -} - namespace ReaxFF { static std::unordered_set inactive_keywords = { "ensemble_type", "nsteps", "dt", "proc_by_dim", "random_vel", @@ -63,6 +54,15 @@ namespace ReaxFF { "energy_update_freq", "atom_info", "atom_velocities", "atom_forces", "bond_info", "angle_info" }; + class control_parser_error : public std::exception { + std::string message; + public: + explicit control_parser_error(const std::string &format, const std::string &keyword) { + message = fmt::format(format, keyword); + } + const char *what() const noexcept { return message.c_str(); } + }; + // NOTE: this function is run on MPI rank 0 only void Read_Control_File(const char *control_file, control_params *control) @@ -92,7 +92,7 @@ namespace ReaxFF { auto keyword = values.next_string(); if (!values.has_next()) - throw parser_error(fmt::format("No value(s) for control parameter: {}\n",keyword)); + throw control_parser_error("No value(s) for control parameter: {}\n", keyword); if (inactive_keywords.find(keyword) != inactive_keywords.end()) { error->warning(FLERR,fmt::format("Ignoring inactive control " @@ -114,8 +114,7 @@ namespace ReaxFF { error->warning(FLERR,"Support for writing native trajectories has " "been removed after LAMMPS version 8 April 2021"); } else { - throw parser_error(fmt::format("Unknown parameter {} in " - "control file", keyword)); + throw control_parser_error("Unknown parameter {} in control file", keyword); } } } catch (LAMMPS_NS::EOFException &) { diff --git a/src/REAXFF/reaxff_ffield.cpp b/src/REAXFF/reaxff_ffield.cpp index db4a63972e..34db1c232d 100644 --- a/src/REAXFF/reaxff_ffield.cpp +++ b/src/REAXFF/reaxff_ffield.cpp @@ -41,16 +41,14 @@ using LAMMPS_NS::utils::open_potential; using LAMMPS_NS::utils::getsyserror; using LAMMPS_NS::utils::uppercase; -namespace { - class parser_error : public std::exception { +namespace ReaxFF { + + class ffield_parser_error : public std::exception { std::string message; public: - parser_error(const std::string &mesg) { message = mesg; } + explicit ffield_parser_error(const std::string &mesg) { message = mesg; } const char *what() const noexcept { return message.c_str(); } }; -} - -namespace ReaxFF { void Read_Force_Field(const char *filename, reax_interaction *reax, control_params *control, MPI_Comm world) @@ -63,7 +61,7 @@ namespace ReaxFF { // read and parse the force field only on rank 0 #define THROW_ERROR(txt) \ - throw parser_error(fmt::format("{}:{}: {}",filename,lineno,txt)) + throw ffield_parser_error(fmt::format("{}:{}: {}",filename,lineno,txt)) if (control->me == 0) { FILE *fp = LAMMPS_NS::utils::open_potential(filename, lmp, nullptr); @@ -165,7 +163,7 @@ namespace ReaxFF { // copy element symbol in uppercase and truncate stored element symbol if necessary auto element = uppercase(values.next_string()); - strncpy(sbp[i].name,element.c_str(),4); + strncpy(sbp[i].name,element.c_str(),3); sbp[i].name[3] = '\0'; sbp[i].r_s = values.next_double(); diff --git a/src/tokenizer.h b/src/tokenizer.h index 247afd0240..060e1bf6e3 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -60,7 +60,7 @@ class TokenizerException : public std::exception { * * \param msg String with error message * \param token String of the token/word that caused the error */ - TokenizerException(const std::string &msg, const std::string &token); + explicit TokenizerException(const std::string &msg, const std::string &token); ~TokenizerException() noexcept {} @@ -74,7 +74,7 @@ class InvalidIntegerException : public TokenizerException { /** Thrown during converting string to integer number * * \param token String of the token/word that caused the error */ - InvalidIntegerException(const std::string &token) : + explicit InvalidIntegerException(const std::string &token) : TokenizerException("Not a valid integer number", token) { } @@ -85,7 +85,7 @@ class InvalidFloatException : public TokenizerException { /** Thrown during converting string to floating point number * * \param token String of the token/word that caused the error */ - InvalidFloatException(const std::string &token) : + explicit InvalidFloatException(const std::string &token) : TokenizerException("Not a valid floating-point number", token) { } From 52d99700ec36ee4cfcd797cac983fe71e1ea6a42 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Mon, 25 Oct 2021 17:34:08 +0200 Subject: [PATCH 18/44] Download and compile modified YAML-cpp 0.6.3 in namespace YAML_PACE --- cmake/Modules/Packages/ML-PACE.cmake | 69 ++++------------------------ lib/pace/Install.py | 3 +- 2 files changed, 11 insertions(+), 61 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index 5ab56de62b..263df9f24d 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,61 +1,10 @@ -# try to find system libyaml-cpp v.0.6.3 library -find_package(yaml-cpp 0.6.3 EXACT QUIET) - - -if(yaml-cpp_FOUND) - message(STATUS "Library yaml-cpp(v0.6.3) found") - #message(STATUS "YAML_CPP_LIBRARY_DIRS=${YAML_CPP_LIBRARY_DIRS}") - -# get_cmake_property(_variableNames VARIABLES) -# list (SORT _variableNames) -# foreach (_variableName ${_variableNames}) -# message(STATUS "${_variableName}=${${_variableName}}") -# endforeach() - - find_path(YAML_CPP_INCLUDE_DIR - NAMES yaml.h - PATHS ${YAML_CPP_INCLUDE_DIRS}) - - if(NOT YAML_CPP_LIBRARIES) - find_library(YAML_CPP_LIBRARY - NAMES yaml-cpp - PATHS ${YAML_CPP_LIBRARY_DIRS}) - else() - set(YAML_CPP_LIBRARY ${YAML_CPP_LIBRARIES}) - endif() -else() - message(STATUS "Library yaml-cpp(v0.6.3) not found, downloading") - - set(YAML_063_URL "https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.tar.gz" CACHE STRING "URL for yaml-cpp (v.0.6.3) library sources") - set(YAML_063_MD5 "b45bf1089a382e81f6b661062c10d0c2" CACHE STRING "MD5 checksum of yaml-cpp (v.0.6.3) library tarball") - mark_as_advanced(YAML_063_URL) - mark_as_advanced(YAML_063_MD5) - - # download library sources to build folder - file(DOWNLOAD ${YAML_063_URL} ${CMAKE_BINARY_DIR}/yaml-cpp-0.6.3.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${YAML_063_MD5}) - - execute_process( - COMMAND ${CMAKE_COMMAND} -E remove_directory yaml-cpp-yaml-cpp-0.6.3* - COMMAND ${CMAKE_COMMAND} -E tar xzf yaml-cpp-0.6.3.tar.gz - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - - set(YAML_DIR ${CMAKE_BINARY_DIR}/yaml-cpp-yaml-cpp-0.6.3) - - add_subdirectory(${YAML_DIR} build-yaml-cpp EXCLUDE_FROM_ALL) - set(YAML_CPP_INCLUDE_DIR ${YAML_DIR}/include) - set(YAML_CPP_LIBRARY yaml-cpp) -endif() - - - -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.9.28.upd1.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "ec75bc491edd75e10560cdbf129d91a7" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.yaml_pace.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_MD5 "4c84c1cb1e2d8c690e3f797433ed2886" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) # download library sources to build folder -file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) +file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS # uncompress downloaded sources execute_process( @@ -65,9 +14,8 @@ execute_process( ) file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*) - -message(STATUS "YAML_CPP_INCLUDE_DIR=${YAML_CPP_INCLUDE_DIR}") -message(STATUS "YAML_CPP_LIBRARY=${YAML_CPP_LIBRARY}") +add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) +set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE) file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp) @@ -75,8 +23,9 @@ list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp) add_library(pace STATIC ${PACE_EVALUATOR_SOURCES}) set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) -target_include_directories(pace PRIVATE ${YAML_CPP_INCLUDE_DIR}) -target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) +target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR}) + + +target_link_libraries(pace PRIVATE yaml-cpp-pace) target_link_libraries(lammps PRIVATE pace) -target_link_libraries(lammps PRIVATE ${YAML_CPP_LIBRARY}) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index 946c29676a..1c243c0446 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -15,13 +15,14 @@ from install_helpers import fullpath, geturl, checkmd5sum # settings thisdir = fullpath('.') -version = 'v.2021.9.28' +version = 'v.2021.10.25.yaml_pace' # known checksums for different PACE versions. used to validate the download. checksums = { \ 'v.2021.2.3.upd2' : '8fd1162724d349b930e474927197f20d', 'v.2021.4.9' : '4db54962fbd6adcf8c18d46e1798ceb5', 'v.2021.9.28' : 'f98363bb98adc7295ea63974738c2a1b', + 'v.2021.10.25.yaml_pace' : '4c84c1cb1e2d8c690e3f797433ed2886' } From 4551bf4bc0ea31a255b9536a0ee9e1ed044640ba Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Tue, 26 Oct 2021 10:19:11 +0200 Subject: [PATCH 19/44] yaml-cpp-pace: bugfix in CMakeLists.txt --- cmake/Modules/Packages/ML-PACE.cmake | 5 +++-- lib/pace/Install.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index 263df9f24d..0086475354 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,5 +1,6 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.yaml_pace.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "4c84c1cb1e2d8c690e3f797433ed2886" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.yaml_pace.upd2.tar.gz" CACHE STRING "URL for PACE evaluator library sources") + +set(PACELIB_MD5 "6ba037a6149bd5c9472ead6356288a6a" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index 1c243c0446..7c2c798146 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -15,7 +15,7 @@ from install_helpers import fullpath, geturl, checkmd5sum # settings thisdir = fullpath('.') -version = 'v.2021.10.25.yaml_pace' +version = 'v.2021.10.25.yaml_pace.upd2' # known checksums for different PACE versions. used to validate the download. checksums = { \ @@ -23,6 +23,7 @@ checksums = { \ 'v.2021.4.9' : '4db54962fbd6adcf8c18d46e1798ceb5', 'v.2021.9.28' : 'f98363bb98adc7295ea63974738c2a1b', 'v.2021.10.25.yaml_pace' : '4c84c1cb1e2d8c690e3f797433ed2886' + 'v.2021.10.25.yaml_pace.upd2': '6ba037a6149bd5c9472ead6356288a6a' } From 30001f2698dc29e03617a41380cd0962d4d38109 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 06:37:59 -0400 Subject: [PATCH 20/44] use preprocessor --- src/MGPT/pair_mgpt.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/MGPT/pair_mgpt.cpp b/src/MGPT/pair_mgpt.cpp index fde6fc7084..4744693b0f 100644 --- a/src/MGPT/pair_mgpt.cpp +++ b/src/MGPT/pair_mgpt.cpp @@ -191,24 +191,24 @@ static inline double mtrace(int n,double A[8][8],double B[8][8]) { void PairMGPT::make_triplet(bond_data *ij_bond,bond_data *ik_bond, triplet_data *triptr) { - if (true) { - const trmul_fun tr_mul = linalg.tr_mul; - tr_mul(&(ij_bond->H.m[1][0]), &(ik_bond->H.m[1][0]) ,&(triptr->H1H2.m[1][0]) ); - tr_mul(&(ij_bond->Hx.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1xH2.m[1][0])); - tr_mul(&(ij_bond->Hy.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1yH2.m[1][0])); - tr_mul(&(ij_bond->Hz.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1zH2.m[1][0])); - tr_mul(&(ij_bond->H.m[1][0]) ,&(ik_bond->Hx.m[1][0]),&(triptr->H1H2x.m[1][0])); - tr_mul(&(ij_bond->H.m[1][0]) ,&(ik_bond->Hy.m[1][0]),&(triptr->H1H2y.m[1][0])); - tr_mul(&(ij_bond->H.m[1][0]) ,&(ik_bond->Hz.m[1][0]),&(triptr->H1H2z.m[1][0])); - } else { - transprod(ij_bond->H, ik_bond->H ,triptr->H1H2 ); - transprod(ij_bond->Hx,ik_bond->H ,triptr->H1xH2); - transprod(ij_bond->Hy,ik_bond->H ,triptr->H1yH2); - transprod(ij_bond->Hz,ik_bond->H ,triptr->H1zH2); - transprod(ij_bond->H ,ik_bond->Hx,triptr->H1H2x); - transprod(ij_bond->H ,ik_bond->Hy,triptr->H1H2y); - transprod(ij_bond->H ,ik_bond->Hz,triptr->H1H2z); - } +#if 1 + const trmul_fun tr_mul = linalg.tr_mul; + tr_mul(&(ij_bond->H.m[1][0]), &(ik_bond->H.m[1][0]) ,&(triptr->H1H2.m[1][0]) ); + tr_mul(&(ij_bond->Hx.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1xH2.m[1][0])); + tr_mul(&(ij_bond->Hy.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1yH2.m[1][0])); + tr_mul(&(ij_bond->Hz.m[1][0]),&(ik_bond->H.m[1][0]) ,&(triptr->H1zH2.m[1][0])); + tr_mul(&(ij_bond->H.m[1][0]) ,&(ik_bond->Hx.m[1][0]),&(triptr->H1H2x.m[1][0])); + tr_mul(&(ij_bond->H.m[1][0]) ,&(ik_bond->Hy.m[1][0]),&(triptr->H1H2y.m[1][0])); + tr_mul(&(ij_bond->H.m[1][0]) ,&(ik_bond->Hz.m[1][0]),&(triptr->H1H2z.m[1][0])); +#else + transprod(ij_bond->H, ik_bond->H ,triptr->H1H2 ); + transprod(ij_bond->Hx,ik_bond->H ,triptr->H1xH2); + transprod(ij_bond->Hy,ik_bond->H ,triptr->H1yH2); + transprod(ij_bond->Hz,ik_bond->H ,triptr->H1zH2); + transprod(ij_bond->H ,ik_bond->Hx,triptr->H1H2x); + transprod(ij_bond->H ,ik_bond->Hy,triptr->H1H2y); + transprod(ij_bond->H ,ik_bond->Hz,triptr->H1H2z); +#endif } static double t_make_t = 0.0,t_make_b = 0.0,n_make = 0.0; From 5141a8014272c5e6af68d595220be3c133789674 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 06:38:35 -0400 Subject: [PATCH 21/44] remove useless logical --- src/PTM/ptm_convex_hull_incremental.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/PTM/ptm_convex_hull_incremental.cpp b/src/PTM/ptm_convex_hull_incremental.cpp index 23b8e3a89d..304b1f9d2d 100644 --- a/src/PTM/ptm_convex_hull_incremental.cpp +++ b/src/PTM/ptm_convex_hull_incremental.cpp @@ -8,12 +8,13 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "ptm_convex_hull_incremental.h" +#include "ptm_constants.h" + #include #include #include #include -#include "ptm_convex_hull_incremental.h" -#include "ptm_constants.h" namespace ptm { @@ -252,19 +253,18 @@ static int initialize_convex_hull(int num_points, const double (*points)[3], int int get_convex_hull(int num_points, const double (*points)[3], convexhull_t* ch, int8_t simplex[][3]) { - assert( num_points == PTM_NUM_POINTS_FCC - || num_points == PTM_NUM_POINTS_HCP - || num_points == PTM_NUM_POINTS_BCC - || num_points == PTM_NUM_POINTS_ICO - || num_points == PTM_NUM_POINTS_SC - || num_points == PTM_NUM_POINTS_DCUB - || num_points == PTM_NUM_POINTS_DHEX); + assert(num_points == PTM_NUM_POINTS_FCC + || num_points == PTM_NUM_POINTS_HCP + || num_points == PTM_NUM_POINTS_BCC + || num_points == PTM_NUM_POINTS_ICO + || num_points == PTM_NUM_POINTS_SC + || num_points == PTM_NUM_POINTS_DCUB + || num_points == PTM_NUM_POINTS_DHEX); int ret = 0; int num_prev = ch->num_prev; ch->num_prev = num_points; - if (!ch->ok || false) - { + if (!ch->ok) { ret = initialize_convex_hull(num_points, points, ch->facets, ch->plane_normal, ch->processed, ch->initial_vertices, ch->barycentre); if (ret != 0) return ret; @@ -273,8 +273,7 @@ int get_convex_hull(int num_points, const double (*points)[3], convexhull_t* ch, num_prev = 0; } - for (int i = num_prev;iprocessed[i]) continue; ch->processed[i] = true; From 886d6702c40f6b69f3a82a3b910db5eba32681d3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 06:38:47 -0400 Subject: [PATCH 22/44] remove dead code --- src/REAXFF/reaxff_allocate.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/REAXFF/reaxff_allocate.cpp b/src/REAXFF/reaxff_allocate.cpp index b81b8ed222..16b71d041c 100644 --- a/src/REAXFF/reaxff_allocate.cpp +++ b/src/REAXFF/reaxff_allocate.cpp @@ -231,14 +231,11 @@ namespace ReaxFF { auto error = system->error_ptr; reallocate_data *wsr = &(workspace->realloc); - if (system->n >= DANGER_ZONE * system->local_cap || - (false && system->n <= LOOSE_ZONE * system->local_cap)) { + if (system->n >= DANGER_ZONE * system->local_cap) system->local_cap = MAX((int)(system->n * safezone), mincap); - } int Nflag = 0; - if (system->N >= DANGER_ZONE * system->total_cap || - (false && system->N <= LOOSE_ZONE * system->total_cap)) { + if (system->N >= DANGER_ZONE * system->total_cap) { Nflag = 1; system->total_cap = MAX((int)(system->N * safezone), mincap); } @@ -271,8 +268,7 @@ namespace ReaxFF { /* hydrogen bonds list */ if (control->hbond_cut > 0) { Hflag = 0; - if (system->numH >= DANGER_ZONE * system->Hcap || - (false && system->numH <= LOOSE_ZONE * system->Hcap)) { + if (system->numH >= DANGER_ZONE * system->Hcap) { Hflag = 1; system->Hcap = int(MAX(system->numH * saferzone, mincap)); } From 2a9a8adfc0c2ded77a735bbfee963796da6cd6c9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 06:41:00 -0400 Subject: [PATCH 23/44] apply clang-format --- src/PTM/ptm_convex_hull_incremental.cpp | 511 +++++++++++------------- 1 file changed, 241 insertions(+), 270 deletions(-) diff --git a/src/PTM/ptm_convex_hull_incremental.cpp b/src/PTM/ptm_convex_hull_incremental.cpp index 304b1f9d2d..25ff54c787 100644 --- a/src/PTM/ptm_convex_hull_incremental.cpp +++ b/src/PTM/ptm_convex_hull_incremental.cpp @@ -1,4 +1,3 @@ -// clang-format off /*Copyright (c) 2016 PM Larsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -11,10 +10,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #include "ptm_convex_hull_incremental.h" #include "ptm_constants.h" -#include -#include -#include #include +#include +#include +#include namespace ptm { @@ -23,352 +22,324 @@ namespace ptm { #define BOTH 3 #define TOLERANCE 1E-8 -static double norm_squared(double* p) +static double norm_squared(double *p) { - double x = p[0]; - double y = p[1]; - double z = p[2]; + double x = p[0]; + double y = p[1]; + double z = p[2]; - return x*x + y*y + z*z; + return x * x + y * y + z * z; } -static double dot_product(const double* a, const double* b) +static double dot_product(const double *a, const double *b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } -static void cross_product(double* a, double* b, double* c) +static void cross_product(double *a, double *b, double *c) { - c[0] = a[1] * b[2] - a[2] * b[1]; - c[1] = a[2] * b[0] - a[0] * b[2]; - c[2] = a[0] * b[1] - a[1] * b[0]; + c[0] = a[1] * b[2] - a[2] * b[1]; + c[1] = a[2] * b[0] - a[0] * b[2]; + c[2] = a[0] * b[1] - a[1] * b[0]; } -static void calculate_plane_normal(const double (*points)[3], int a, int b, int c, double* plane_normal) +static void calculate_plane_normal(const double (*points)[3], int a, int b, int c, + double *plane_normal) { - double u[3] = { points[b][0] - points[a][0], - points[b][1] - points[a][1], - points[b][2] - points[a][2] }; + double u[3] = {points[b][0] - points[a][0], points[b][1] - points[a][1], + points[b][2] - points[a][2]}; - double v[3] = { points[c][0] - points[a][0], - points[c][1] - points[a][1], - points[c][2] - points[a][2] }; + double v[3] = {points[c][0] - points[a][0], points[c][1] - points[a][1], + points[c][2] - points[a][2]}; - cross_product(u, v, plane_normal); - double norm = sqrt(norm_squared(plane_normal)); - plane_normal[0] /= norm; - plane_normal[1] /= norm; - plane_normal[2] /= norm; + cross_product(u, v, plane_normal); + double norm = sqrt(norm_squared(plane_normal)); + plane_normal[0] /= norm; + plane_normal[1] /= norm; + plane_normal[2] /= norm; } -static double point_plane_distance(const double* w, const double* plane_point, const double* plane_cross) +static double point_plane_distance(const double *w, const double *plane_point, + const double *plane_cross) { - return plane_cross[0] * (plane_point[0] - w[0]) - + plane_cross[1] * (plane_point[1] - w[1]) - + plane_cross[2] * (plane_point[2] - w[2]); + return plane_cross[0] * (plane_point[0] - w[0]) + plane_cross[1] * (plane_point[1] - w[1]) + + plane_cross[2] * (plane_point[2] - w[2]); } -static bool calc_max_extent(int num_points, const double (*points)[3], int* min_index, int* max_index) +static bool calc_max_extent(int num_points, const double (*points)[3], int *min_index, + int *max_index) { - for (int j=0;j<3;j++) - { - double dmin = DBL_MAX, dmax = -DBL_MAX; - int imin = 0, imax = 0; + for (int j = 0; j < 3; j++) { + double dmin = DBL_MAX, dmax = -DBL_MAX; + int imin = 0, imax = 0; - for (int i = 0;i dmax) - { - dmax = d; - imax = i; - } - } + for (int i = 0; i < num_points; i++) { + double d = points[i][j]; + if (d < dmin) { + dmin = d; + imin = i; + } + if (d > dmax) { + dmax = d; + imax = i; + } + } - if (imin == imax) - return false; //degenerate point set + if (imin == imax) return false; //degenerate point set - min_index[j] = imin; - max_index[j] = imax; - } + min_index[j] = imin; + max_index[j] = imax; + } - return true; + return true; } -static bool find_third_point(int num_points, const double (*points)[3], int a, int b, int* p_c) +static bool find_third_point(int num_points, const double (*points)[3], int a, int b, int *p_c) { - const double* x1 = points[a]; - const double* x2 = points[b]; + const double *x1 = points[a]; + const double *x2 = points[b]; - double x2x1[3] = {x2[0] - x1[0], x2[1] - x1[1], x2[2] - x1[2]}; - double ns_x2x1 = norm_squared(x2x1); + double x2x1[3] = {x2[0] - x1[0], x2[1] - x1[1], x2[2] - x1[2]}; + double ns_x2x1 = norm_squared(x2x1); - int bi = -1; - double max_dist = 0.0; - for (int i = 0;i max_dist) - { - max_dist = dist; - bi = i; - } - } + if (dist > max_dist) { + max_dist = dist; + bi = i; + } + } - *p_c = bi; - return max_dist > TOLERANCE; + *p_c = bi; + return max_dist > TOLERANCE; } -static bool find_fourth_point(int num_points, const double (*points)[3], int a, int b, int c, int* p_d) +static bool find_fourth_point(int num_points, const double (*points)[3], int a, int b, int c, + int *p_d) { - double plane_normal[3]; - calculate_plane_normal(points, a, b, c, plane_normal); + double plane_normal[3]; + calculate_plane_normal(points, a, b, c, plane_normal); + int bi = -1; + double max_dist = 0.0; + for (int i = 0; i < num_points; i++) { + if (i == a || i == b || i == c) continue; - int bi = -1; - double max_dist = 0.0; - for (int i = 0;i max_dist) { + max_dist = dist; + bi = i; + } + } - const double* x0 = points[i]; - double dist = fabs(point_plane_distance(x0, points[a], plane_normal)); - if (dist > max_dist) - { - max_dist = dist; - bi = i; - } - } - - *p_d = bi; - return max_dist > TOLERANCE; + *p_d = bi; + return max_dist > TOLERANCE; } -static int initial_simplex(int num_points, const double (*points)[3], int* initial_vertices) +static int initial_simplex(int num_points, const double (*points)[3], int *initial_vertices) { - int min_index[3] = {0}; - int max_index[3] = {0}; - if (!calc_max_extent(num_points, points, min_index, max_index)) - return -1; + int min_index[3] = {0}; + int max_index[3] = {0}; + if (!calc_max_extent(num_points, points, min_index, max_index)) return -1; - int bi = -1; - double max_dist = 0.0; - for (int i = 0;i<3;i++) - { - int a = min_index[i], b = max_index[i]; - double delta[3] = { points[a][0] - points[b][0], - points[a][1] - points[b][1], - points[a][2] - points[b][2] }; - double dist = norm_squared(delta); - if (dist > max_dist) - { - bi = i; - max_dist = dist; - } - } + int bi = -1; + double max_dist = 0.0; + for (int i = 0; i < 3; i++) { + int a = min_index[i], b = max_index[i]; + double delta[3] = {points[a][0] - points[b][0], points[a][1] - points[b][1], + points[a][2] - points[b][2]}; + double dist = norm_squared(delta); + if (dist > max_dist) { + bi = i; + max_dist = dist; + } + } - //first two points are (a, b) - int a = min_index[bi], b = max_index[bi], c = -1, d = -1; + //first two points are (a, b) + int a = min_index[bi], b = max_index[bi], c = -1, d = -1; - if (!find_third_point(num_points, points, a, b, &c)) - return -2; + if (!find_third_point(num_points, points, a, b, &c)) return -2; - if (!find_fourth_point(num_points, points, a, b, c, &d)) - return -3; + if (!find_fourth_point(num_points, points, a, b, c, &d)) return -3; - initial_vertices[0] = a; - initial_vertices[1] = b; - initial_vertices[2] = c; - initial_vertices[3] = d; - return 0; + initial_vertices[0] = a; + initial_vertices[1] = b; + initial_vertices[2] = c; + initial_vertices[3] = d; + return 0; } -static bool visible(const double* w, const double* plane_point, const double* plane_normal) +static bool visible(const double *w, const double *plane_point, const double *plane_normal) { - return point_plane_distance(w, plane_point, plane_normal) > 0; + return point_plane_distance(w, plane_point, plane_normal) > 0; } -void add_facet(const double (*points)[3], int a, int b, int c, int8_t* facet, double* plane_normal, double* barycentre) +void add_facet(const double (*points)[3], int a, int b, int c, int8_t *facet, double *plane_normal, + double *barycentre) { - calculate_plane_normal(points, a, b, c, plane_normal); - if (visible(barycentre, points[a], plane_normal)) - { - plane_normal[0] = -plane_normal[0]; - plane_normal[1] = -plane_normal[1]; - plane_normal[2] = -plane_normal[2]; + calculate_plane_normal(points, a, b, c, plane_normal); + if (visible(barycentre, points[a], plane_normal)) { + plane_normal[0] = -plane_normal[0]; + plane_normal[1] = -plane_normal[1]; + plane_normal[2] = -plane_normal[2]; - facet[0] = b; - facet[1] = a; - facet[2] = c; - } - else - { - facet[0] = a; - facet[1] = b; - facet[2] = c; - } + facet[0] = b; + facet[1] = a; + facet[2] = c; + } else { + facet[0] = a; + facet[1] = b; + facet[2] = c; + } } -static int initialize_convex_hull(int num_points, const double (*points)[3], int8_t facets[][3], double plane_normal[][3], bool* processed, int* initial_vertices, double* barycentre) +static int initialize_convex_hull(int num_points, const double (*points)[3], int8_t facets[][3], + double plane_normal[][3], bool *processed, int *initial_vertices, + double *barycentre) { - memset(processed, 0, PTM_MAX_POINTS * sizeof(bool)); - memset(barycentre, 0, 3 * sizeof(double)); - int ret = initial_simplex(num_points, points, initial_vertices); - if (ret != 0) - return ret; + memset(processed, 0, PTM_MAX_POINTS * sizeof(bool)); + memset(barycentre, 0, 3 * sizeof(double)); + int ret = initial_simplex(num_points, points, initial_vertices); + if (ret != 0) return ret; - for (int i = 0;i<4;i++) - { - int a = initial_vertices[i]; - processed[a] = true; + for (int i = 0; i < 4; i++) { + int a = initial_vertices[i]; + processed[a] = true; - barycentre[0] += points[a][0]; - barycentre[1] += points[a][1]; - barycentre[2] += points[a][2]; - } - barycentre[0] /= 4; - barycentre[1] /= 4; - barycentre[2] /= 4; + barycentre[0] += points[a][0]; + barycentre[1] += points[a][1]; + barycentre[2] += points[a][2]; + } + barycentre[0] /= 4; + barycentre[1] /= 4; + barycentre[2] /= 4; - add_facet(points, initial_vertices[0], initial_vertices[1], initial_vertices[2], facets[0], plane_normal[0], barycentre); - add_facet(points, initial_vertices[0], initial_vertices[1], initial_vertices[3], facets[1], plane_normal[1], barycentre); - add_facet(points, initial_vertices[0], initial_vertices[2], initial_vertices[3], facets[2], plane_normal[2], barycentre); - add_facet(points, initial_vertices[1], initial_vertices[2], initial_vertices[3], facets[3], plane_normal[3], barycentre); - return 0; + add_facet(points, initial_vertices[0], initial_vertices[1], initial_vertices[2], facets[0], + plane_normal[0], barycentre); + add_facet(points, initial_vertices[0], initial_vertices[1], initial_vertices[3], facets[1], + plane_normal[1], barycentre); + add_facet(points, initial_vertices[0], initial_vertices[2], initial_vertices[3], facets[2], + plane_normal[2], barycentre); + add_facet(points, initial_vertices[1], initial_vertices[2], initial_vertices[3], facets[3], + plane_normal[3], barycentre); + return 0; } -int get_convex_hull(int num_points, const double (*points)[3], convexhull_t* ch, int8_t simplex[][3]) +int get_convex_hull(int num_points, const double (*points)[3], convexhull_t *ch, + int8_t simplex[][3]) { - assert(num_points == PTM_NUM_POINTS_FCC - || num_points == PTM_NUM_POINTS_HCP - || num_points == PTM_NUM_POINTS_BCC - || num_points == PTM_NUM_POINTS_ICO - || num_points == PTM_NUM_POINTS_SC - || num_points == PTM_NUM_POINTS_DCUB - || num_points == PTM_NUM_POINTS_DHEX); + assert(num_points == PTM_NUM_POINTS_FCC || num_points == PTM_NUM_POINTS_HCP || + num_points == PTM_NUM_POINTS_BCC || num_points == PTM_NUM_POINTS_ICO || + num_points == PTM_NUM_POINTS_SC || num_points == PTM_NUM_POINTS_DCUB || + num_points == PTM_NUM_POINTS_DHEX); - int ret = 0; - int num_prev = ch->num_prev; - ch->num_prev = num_points; - if (!ch->ok) { - ret = initialize_convex_hull(num_points, points, ch->facets, ch->plane_normal, ch->processed, ch->initial_vertices, ch->barycentre); - if (ret != 0) - return ret; + int ret = 0; + int num_prev = ch->num_prev; + ch->num_prev = num_points; + if (!ch->ok) { + ret = initialize_convex_hull(num_points, points, ch->facets, ch->plane_normal, ch->processed, + ch->initial_vertices, ch->barycentre); + if (ret != 0) return ret; - ch->num_facets = 4; - num_prev = 0; - } + ch->num_facets = 4; + num_prev = 0; + } - for (int i = num_prev;iprocessed[i]) - continue; - ch->processed[i] = true; + for (int i = num_prev; i < num_points; i++) { + if (ch->processed[i]) continue; + ch->processed[i] = true; - int num_to_add = 0; - int8_t to_add[PTM_MAX_FACETS][3]; - int8_t edge_visible[PTM_MAX_POINTS][PTM_MAX_POINTS]; - memset(edge_visible, 0, sizeof(int8_t) * PTM_MAX_POINTS * PTM_MAX_POINTS); - for (int j = 0;jnum_facets;j++) - { - int a = ch->facets[j][0]; - int b = ch->facets[j][1]; - int c = ch->facets[j][2]; + int num_to_add = 0; + int8_t to_add[PTM_MAX_FACETS][3]; + int8_t edge_visible[PTM_MAX_POINTS][PTM_MAX_POINTS]; + memset(edge_visible, 0, sizeof(int8_t) * PTM_MAX_POINTS * PTM_MAX_POINTS); + for (int j = 0; j < ch->num_facets; j++) { + int a = ch->facets[j][0]; + int b = ch->facets[j][1]; + int c = ch->facets[j][2]; - int u = 0, v = 0, w = 0; + int u = 0, v = 0, w = 0; - double distance = point_plane_distance(points[i], points[a], ch->plane_normal[j]); - bool vis = distance > TOLERANCE; - if (vis) - { - u = edge_visible[a][b] |= VISIBLE; - edge_visible[b][a] |= VISIBLE; + double distance = point_plane_distance(points[i], points[a], ch->plane_normal[j]); + bool vis = distance > TOLERANCE; + if (vis) { + u = edge_visible[a][b] |= VISIBLE; + edge_visible[b][a] |= VISIBLE; - v = edge_visible[b][c] |= VISIBLE; - edge_visible[c][b] |= VISIBLE; + v = edge_visible[b][c] |= VISIBLE; + edge_visible[c][b] |= VISIBLE; - w = edge_visible[c][a] |= VISIBLE; - edge_visible[a][c] |= VISIBLE; + w = edge_visible[c][a] |= VISIBLE; + edge_visible[a][c] |= VISIBLE; - memcpy(ch->facets[j], ch->facets[ch->num_facets-1], 3 * sizeof(int8_t)); - memcpy(ch->plane_normal[j], ch->plane_normal[ch->num_facets-1], 3 * sizeof(double)); - ch->num_facets--; - j--; - } - else - { - u = edge_visible[a][b] |= INVISIBLE; - edge_visible[b][a] |= INVISIBLE; + memcpy(ch->facets[j], ch->facets[ch->num_facets - 1], 3 * sizeof(int8_t)); + memcpy(ch->plane_normal[j], ch->plane_normal[ch->num_facets - 1], 3 * sizeof(double)); + ch->num_facets--; + j--; + } else { + u = edge_visible[a][b] |= INVISIBLE; + edge_visible[b][a] |= INVISIBLE; - v = edge_visible[b][c] |= INVISIBLE; - edge_visible[c][b] |= INVISIBLE; + v = edge_visible[b][c] |= INVISIBLE; + edge_visible[c][b] |= INVISIBLE; - w = edge_visible[c][a] |= INVISIBLE; - edge_visible[a][c] |= INVISIBLE; - } + w = edge_visible[c][a] |= INVISIBLE; + edge_visible[a][c] |= INVISIBLE; + } - if (u == BOTH) - { - to_add[num_to_add][0] = i; - to_add[num_to_add][1] = a; - to_add[num_to_add][2] = b; - num_to_add++; - } + if (u == BOTH) { + to_add[num_to_add][0] = i; + to_add[num_to_add][1] = a; + to_add[num_to_add][2] = b; + num_to_add++; + } - if (v == BOTH) - { - to_add[num_to_add][0] = i; - to_add[num_to_add][1] = b; - to_add[num_to_add][2] = c; - num_to_add++; - } + if (v == BOTH) { + to_add[num_to_add][0] = i; + to_add[num_to_add][1] = b; + to_add[num_to_add][2] = c; + num_to_add++; + } - if (w == BOTH) - { - to_add[num_to_add][0] = i; - to_add[num_to_add][1] = c; - to_add[num_to_add][2] = a; - num_to_add++; - } - } + if (w == BOTH) { + to_add[num_to_add][0] = i; + to_add[num_to_add][1] = c; + to_add[num_to_add][2] = a; + num_to_add++; + } + } - for (int j = 0;jnum_facets >= PTM_MAX_FACETS) - return -4; + for (int j = 0; j < num_to_add; j++) { + if (ch->num_facets >= PTM_MAX_FACETS) return -4; - add_facet(points, to_add[j][0], to_add[j][1], to_add[j][2], ch->facets[ch->num_facets], ch->plane_normal[ch->num_facets], ch->barycentre); ch->num_facets++; - } - } + add_facet(points, to_add[j][0], to_add[j][1], to_add[j][2], ch->facets[ch->num_facets], + ch->plane_normal[ch->num_facets], ch->barycentre); + ch->num_facets++; + } + } - for (int i=0;inum_facets;i++) - { - int a = ch->facets[i][0]; - int b = ch->facets[i][1]; - int c = ch->facets[i][2]; - if (a == 0 || b == 0 || c == 0) - return 1; //central atom contained in convex hull + for (int i = 0; i < ch->num_facets; i++) { + int a = ch->facets[i][0]; + int b = ch->facets[i][1]; + int c = ch->facets[i][2]; + if (a == 0 || b == 0 || c == 0) return 1; //central atom contained in convex hull - simplex[i][0] = a - 1; - simplex[i][1] = b - 1; - simplex[i][2] = c - 1; - } - - return ret; -} + simplex[i][0] = a - 1; + simplex[i][1] = b - 1; + simplex[i][2] = c - 1; + } + return ret; } +} // namespace ptm From f783958e39948d48ce9b2714e1fa8477809fd380 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 12:11:28 -0400 Subject: [PATCH 24/44] add test for create_atoms() --- unittest/python/python-commands.py | 41 ++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index f3526d6d4b..bd8512894f 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -1,6 +1,6 @@ -import sys,os,unittest -from lammps import lammps, LMP_VAR_ATOM, LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR +import sys,os,unittest,ctypes +from lammps import lammps, LMP_VAR_ATOM, LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, LAMMPS_DOUBLE_2D, LAMMPS_AUTODETECT has_manybody=False try: @@ -494,6 +494,43 @@ create_atoms 1 single & self.assertEqual(self.lmp.extract_global("sublo_lambda"), [0.0, 0.0, 0.0]) self.assertEqual(self.lmp.extract_global("subhi_lambda"), [1.0, 1.0, 1.0]) + def test_create_atoms(self): + self.lmp.command("boundary f p m") + self.lmp.command("region box block 0 10 0 10 0 10") + self.lmp.command("create_box 2 box") + # second atom is outside the box -> dropped + self.lmp.create_atoms(2, [1,2], [1,1], [1.0, 1.0, 3.0, 5.0, 8.0, 12.0]) + self.assertEqual(self.lmp.get_natoms(),1) + # non-zero velocities + self.lmp.create_atoms(2, None, [2,2], [2.0, 2.0, 1.0, 3.0, 4.0, 6.0], v=[0.1, 0.2, 0.3, -0.1, -0.2, -0.3]) + self.assertEqual(self.lmp.get_natoms(),3) + # first atom is dropped, extend shrinkwrapped box for second atom, third atoms is wrapped around PBC. + self.lmp.create_atoms(3, [5,8,10], [1,2,1], [-1.0, 1.0, 3.0, 5.0, 8.0, 12.0, 1.0, -1.0, 1.0], shrinkexceed=True) + self.assertEqual(self.lmp.get_natoms(),5) + # set image flags + self.lmp.create_atoms(1, None, [2], [5.0, 8.0, 1.0], image=[self.lmp.encode_image_flags(1,0,-1)]) + self.assertEqual(self.lmp.get_natoms(),6) + tag = self.lmp.extract_atom("id") + typ = self.lmp.extract_atom("type") + pos = self.lmp.extract_atom("x",LAMMPS_DOUBLE_2D) + vel = self.lmp.extract_atom("v",LAMMPS_DOUBLE_2D) + img = self.lmp.extract_atom("image",LAMMPS_AUTODETECT) + # expected results: tag, type, x, v, image + result = [ [ 1, 1, [1.0, 1.0, 3.0], [ 0.0, 0.0, 0.0], [0, 0, 0]],\ + [ 2, 2, [2.0, 2.0, 1.0], [ 0.1, 0.2, 0.3], [0, 0, 0]],\ + [ 3, 2, [3.0, 4.0, 6.0], [-0.1, -0.2, -0.3], [0, 0, 0]],\ + [ 8, 2, [5.0, 8.0, 12.0], [ 0.0, 0.0, 0.0], [0, 0, 0]],\ + [10, 1, [1.0, 9.0, 1.0], [ 0.0, 0.0, 0.0], [0, 0, 0]],\ + [11, 2, [5.0, 8.0, 1.0], [ 0.0, 0.0, 0.0], [1, 0, -1]] ] + for i in range(len(result)): + self.assertEqual(tag[i],result[i][0]) + self.assertEqual(typ[i],result[i][1]) + for j in range(3): + self.assertEqual(pos[i][0:3],result[i][2]) + self.assertEqual(vel[i][0:3],result[i][3]) + self.assertEqual(self.lmp.decode_image_flags(img[i]), result[i][4]) + + ############################## if __name__ == "__main__": unittest.main() From 3044923cbfff0a857c03bc18413a418d2d1d3479 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 12:12:21 -0400 Subject: [PATCH 25/44] less ambiguous tests for arguments being not None --- python/lammps/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 7dea6e5e6e..1588709d92 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1361,7 +1361,7 @@ class lammps(object): This function is a wrapper around the :cpp:func:`lammps_create_atoms` function of the C-library interface, and the behavior is similar except that the *v*, *image*, and *shrinkexceed* arguments are optional and - default to *None*, *None*, and *False*, respectively. With none being + default to *None*, *None*, and *False*, respectively. With *None* being equivalent to a ``NULL`` pointer in C. The lists of coordinates, types, atom IDs, velocities, image flags can @@ -1389,7 +1389,7 @@ class lammps(object): :return: number of atoms created. 0 if insufficient or invalid data :rtype: int """ - if id: + if id != None: id_lmp = (self.c_tagint*n)() try: id_lmp[:] = id[0:n] @@ -1411,7 +1411,7 @@ class lammps(object): except ValueError: return 0 - if v: + if v != None: v_lmp = (c_double*(three_n))() try: v_lmp[:] = v[0:three_n] @@ -1420,7 +1420,7 @@ class lammps(object): else: v_lmp = None - if image: + if image != None: img_lmp = (self.c_imageint*n)() try: img_lmp[:] = image[0:n] From 3d9e4638a73db69849b306d44c3e61a7d0d6ada2 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 26 Oct 2021 13:08:03 -0400 Subject: [PATCH 26/44] Don't use -restrict for icpx --- cmake/CMakeLists.txt | 2 +- examples/plugins/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ec4a9c2eb7..449a9b3141 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -81,7 +81,7 @@ check_for_autogen_files(${LAMMPS_SOURCE_DIR}) include(CheckIncludeFileCXX) # set required compiler flags and compiler/CPU arch specific optimizations -if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qrestrict") diff --git a/examples/plugins/CMakeLists.txt b/examples/plugins/CMakeLists.txt index c61454870a..0ca2c025e2 100644 --- a/examples/plugins/CMakeLists.txt +++ b/examples/plugins/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Need -restrict with Intel compilers -if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict") endif() From fe9dfc60957e49d6908f25b95947a065057fc36f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 14:17:31 -0400 Subject: [PATCH 27/44] follow Python style guidelines --- python/lammps/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 1588709d92..5e51a7bba0 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1389,7 +1389,7 @@ class lammps(object): :return: number of atoms created. 0 if insufficient or invalid data :rtype: int """ - if id != None: + if id is not None: id_lmp = (self.c_tagint*n)() try: id_lmp[:] = id[0:n] @@ -1411,7 +1411,7 @@ class lammps(object): except ValueError: return 0 - if v != None: + if v is not None: v_lmp = (c_double*(three_n))() try: v_lmp[:] = v[0:three_n] @@ -1420,7 +1420,7 @@ class lammps(object): else: v_lmp = None - if image != None: + if image is not None: img_lmp = (self.c_imageint*n)() try: img_lmp[:] = image[0:n] From 008013ddfbf58e9698ec504bbdeb59783ae3dd57 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 26 Oct 2021 15:00:12 -0400 Subject: [PATCH 28/44] Explicitly check for None --- python/lammps/core.py | 10 +++++----- python/lammps/pylammps.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 5e51a7bba0..fcd5c76ad5 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -99,7 +99,7 @@ class lammps(object): # load a shared object. try: - if ptr: self.lib = CDLL("",RTLD_GLOBAL) + if ptr is not None: self.lib = CDLL("",RTLD_GLOBAL) except OSError: self.lib = None @@ -329,7 +329,7 @@ class lammps(object): # ptr is the desired instance of LAMMPS # just convert it to ctypes ptr and store in self.lmp - if not ptr: + if ptr is None: # with mpi4py v2+, we can pass MPI communicators to LAMMPS # need to adjust for type of MPI communicator object @@ -338,7 +338,7 @@ class lammps(object): from mpi4py import MPI self.MPI = MPI - if comm: + if comm is not None: if not self.has_mpi_support: raise Exception('LAMMPS not compiled with real MPI library') if not self.has_mpi4py: @@ -354,7 +354,7 @@ class lammps(object): narg = 0 cargs = None - if cmdargs: + if cmdargs is not None: cmdargs.insert(0,"lammps") narg = len(cmdargs) for i in range(narg): @@ -376,7 +376,7 @@ class lammps(object): if self.has_mpi4py and self.has_mpi_support: self.comm = self.MPI.COMM_WORLD self.opened = 1 - if cmdargs: + if cmdargs is not None: cmdargs.insert(0,"lammps") narg = len(cmdargs) for i in range(narg): diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index a6e3578aef..abd4d6da98 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -854,30 +854,30 @@ class IPyLammps(PyLammps): """ cmd_args = [group, "image", filename, color, diameter] - if size: + if size is not None: width = size[0] height = size[1] cmd_args += ["size", width, height] - if view: + if view is not None: theta = view[0] phi = view[1] cmd_args += ["view", theta, phi] - if center: + if center is not None: flag = center[0] Cx = center[1] Cy = center[2] Cz = center[3] cmd_args += ["center", flag, Cx, Cy, Cz] - if up: + if up is not None: Ux = up[0] Uy = up[1] Uz = up[2] cmd_args += ["up", Ux, Uy, Uz] - if zoom: + if zoom is not None: cmd_args += ["zoom", zoom] cmd_args.append("modify backcolor " + background_color) From 3376f3daa8c41b0510d4ea9a85975d34f89bef47 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 26 Oct 2021 16:45:57 -0400 Subject: [PATCH 29/44] Remove unused import --- python/examples/matplotlib_plot.py | 1 - python/examples/simple.py | 1 - 2 files changed, 2 deletions(-) diff --git a/python/examples/matplotlib_plot.py b/python/examples/matplotlib_plot.py index b85d40c4c4..0c918507ad 100755 --- a/python/examples/matplotlib_plot.py +++ b/python/examples/matplotlib_plot.py @@ -62,7 +62,6 @@ if me == 0: plt.show(block=False) # run nfreq steps at a time w/out pre/post, query compute, refresh plot -import time while ntimestep < nsteps: lmp.command("run %d pre no post no" % nfreq) diff --git a/python/examples/simple.py b/python/examples/simple.py index 861a208895..8925ce48c0 100755 --- a/python/examples/simple.py +++ b/python/examples/simple.py @@ -13,7 +13,6 @@ from __future__ import print_function import sys -import numpy as np import ctypes # parse command line From f0318fb87429b5439c1f5494edd4ad35384c8666 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 19:16:13 -0400 Subject: [PATCH 30/44] try to make changing LMP_INC settings less confusing to inexperienced people --- doc/src/Build_settings.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index 01bd8e2c80..b68313aaed 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -321,9 +321,7 @@ following settings: .. code-block:: make - LMP_INC = -DLAMMPS_JPEG - LMP_INC = -DLAMMPS_PNG - LMP_INC = -DLAMMPS_FFMPEG + LMP_INC = -DLAMMPS_JPEG -DLAMMPS_PNG -DLAMMPS_FFMPEG JPG_INC = -I/usr/local/include # path to jpeglib.h, png.h, zlib.h header files if make cannot find them JPG_PATH = -L/usr/lib # paths to libjpeg.a, libpng.a, libz.a (.so) files if make cannot find them @@ -372,7 +370,7 @@ including :doc:`read_data `, :doc:`rerun `, and .. code-block:: make - LMP_INC = -DLAMMPS_GZIP + LMP_INC = -DLAMMPS_GZIP This option requires that your operating system fully supports the "popen()" function in the standard runtime library and that a ``gzip`` @@ -454,7 +452,7 @@ those systems: .. code-block:: make - LMP_INC = -DLAMMPS_LONGLONG_TO_LONG + LMP_INC = -DLAMMPS_LONGLONG_TO_LONG ---------- @@ -481,7 +479,7 @@ e.g. to Python. Of course, the calling code has to be set up to .. code-block:: make - LMP_INC = -DLAMMPS_EXCEPTIONS + LMP_INC = -DLAMMPS_EXCEPTIONS .. note:: @@ -522,7 +520,7 @@ executable, not the library. .. code-block:: make - LMP_INC = -DLAMMPS_TRAP_FPE + LMP_INC = -DLAMMPS_TRAP_FPE After compilation with this flag set, the LAMMPS executable will stop and produce a core dump when a division by zero, overflow, illegal math From 1247f4d67b96a2d34b881a025b5173e9fba5ec8d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 Oct 2021 19:54:09 -0400 Subject: [PATCH 31/44] add function to print information about available compressions tools --- doc/src/Developer_platform.rst | 3 +++ src/info.cpp | 1 + src/lammps.cpp | 2 ++ src/platform.cpp | 24 +++++++++++++++++++++--- src/platform.h | 9 +++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/doc/src/Developer_platform.rst b/doc/src/Developer_platform.rst index 4cea36f94c..c9ecd30cec 100644 --- a/doc/src/Developer_platform.rst +++ b/doc/src/Developer_platform.rst @@ -42,6 +42,9 @@ Platform information functions .. doxygenfunction:: mpi_info :project: progguide +.. doxygenfunction:: compress_info + :project: progguide + File and path functions and global constants ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/info.cpp b/src/info.cpp index bbc94fbccb..a726b2f00b 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -309,6 +309,7 @@ void Info::command(int narg, char **arg) #else // defined(LAMMPS_SMALLSMALL) fputs("-DLAMMPS_SMALLSMALL\n",out); #endif + if (has_gzip_support()) fmt::print(out,"\n{}\n",platform::compress_info()); int ncword, ncline = 0; fputs("\nInstalled packages:\n\n",out); diff --git a/src/lammps.cpp b/src/lammps.cpp index 5d571b88dd..0829c4fdbd 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -1379,6 +1379,8 @@ void LAMMPS::print_config(FILE *fp) sizeof(smallint)*8, sizeof(imageint)*8, sizeof(tagint)*8, sizeof(bigint)*8); + if (Info::has_gzip_support()) fmt::print(fp,"\n{}\n",platform::compress_info()); + fputs("\nInstalled packages:\n\n",fp); for (int i = 0; nullptr != (pkg = installed_packages[i]); ++i) { ncword = strlen(pkg); diff --git a/src/platform.cpp b/src/platform.cpp index 555026b2ac..bd0fcd9dfe 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -418,6 +418,24 @@ std::string platform::mpi_info(int &major, int &minor) return {version}; } +/* ---------------------------------------------------------------------- + collect available compression tool info +------------------------------------------------------------------------- */ + +std::string platform::compress_info() +{ + std::string buf = "Available compression formats:\n\n"; + bool none_found = true; + for (const auto &cmpi : compress_styles) { + if (cmpi.style == ::compress_info::NONE) continue; + if (find_exe_path(cmpi.command).size()) { + none_found = false; + buf += fmt::format("Extension: .{:6} Command: {}\n", cmpi.extension, cmpi.command); + } + } + if (none_found) buf += "None\n"; + return buf; +} /* ---------------------------------------------------------------------- set environment variable ------------------------------------------------------------------------- */ @@ -930,7 +948,7 @@ bool platform::file_is_readable(const std::string &path) bool platform::has_compress_extension(const std::string &file) { - return find_compress_type(file).style != compress_info::NONE; + return find_compress_type(file).style != ::compress_info::NONE; } /* ---------------------------------------------------------------------- @@ -943,7 +961,7 @@ FILE *platform::compressed_read(const std::string &file) #if defined(LAMMPS_GZIP) auto compress = find_compress_type(file); - if (compress.style == compress_info::NONE) return nullptr; + if (compress.style == ::compress_info::NONE) return nullptr; if (find_exe_path(compress.command).size()) // put quotes around file name so that they may contain blanks @@ -962,7 +980,7 @@ FILE *platform::compressed_write(const std::string &file) #if defined(LAMMPS_GZIP) auto compress = find_compress_type(file); - if (compress.style == compress_info::NONE) return nullptr; + if (compress.style == ::compress_info::NONE) return nullptr; if (find_exe_path(compress.command).size()) // put quotes around file name so that they may contain blanks diff --git a/src/platform.h b/src/platform.h index de8ecce016..95a0c3cc35 100644 --- a/src/platform.h +++ b/src/platform.h @@ -109,6 +109,15 @@ namespace platform { std::string mpi_info(int &major, int &minor); + /*! Return string with list of available compression types and executables + * + * This function tests which of the supported compression executables + * are available for reading or writing compressed files where supported. + * + * \return string with list of available compression tools */ + + std::string compress_info(); + /*! Add variable to the environment * * \param vardef variable name or variable definition (NAME=value) From 11ee3759dfdd85a015a983547656e33e00a2f9a0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Oct 2021 08:22:18 -0400 Subject: [PATCH 32/44] use consistent formatting --- cmake/CMakeLists.txt | 2 +- cmake/Modules/LAMMPSUtils.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 449a9b3141..00a254197d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -83,7 +83,7 @@ include(CheckIncludeFileCXX) # set required compiler flags and compiler/CPU arch specific optimizations if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qrestrict") endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4) diff --git a/cmake/Modules/LAMMPSUtils.cmake b/cmake/Modules/LAMMPSUtils.cmake index 74102ab244..28ad99fa31 100644 --- a/cmake/Modules/LAMMPSUtils.cmake +++ b/cmake/Modules/LAMMPSUtils.cmake @@ -85,7 +85,7 @@ endfunction(GenerateBinaryHeader) # fetch missing potential files function(FetchPotentials pkgfolder potfolder) - if (EXISTS "${pkgfolder}/potentials.txt") + if(EXISTS "${pkgfolder}/potentials.txt") file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].") foreach(line ${linelist}) string(FIND ${line} " " blank) From c911cd52bbf1406eb8aa5c17cedd75ffdd1df434 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Oct 2021 08:24:07 -0400 Subject: [PATCH 33/44] whitespace --- cmake/Modules/Packages/ML-PACE.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index 0086475354..ec3fa23f4c 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -5,7 +5,7 @@ mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) # download library sources to build folder -file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS +file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS # uncompress downloaded sources execute_process( From a063209b2bd13389f235a2f51c3ad202176bb1e6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Oct 2021 08:31:36 -0400 Subject: [PATCH 34/44] update URL and filename for offline scripts --- tools/offline/scripts/init_http_cache.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/offline/scripts/init_http_cache.sh b/tools/offline/scripts/init_http_cache.sh index 44a07da35a..ea234c8fbb 100755 --- a/tools/offline/scripts/init_http_cache.sh +++ b/tools/offline/scripts/init_http_cache.sh @@ -51,7 +51,7 @@ KOKKOS_URL="https://github.com/kokkos/kokkos/archive/3.4.01.tar.gz" KIM_URL="https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" MSCG_URL="https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz" PLUMED_URL="https://github.com/plumed/plumed2/releases/download/v2.7.2/plumed-src-2.7.2.tgz" -PACELIB_URL="https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.4.9.tar.gz" +PACELIB_URL="https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.yaml_pace.upd2.tar.gz" LATTE_URL="https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" SCAFACOS_URL="https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz" MDI_URL="https://github.com/MolSSI-MDI/MDI_Library/archive/v1.2.9.tar.gz" @@ -62,7 +62,7 @@ CUB_FILENAME="cub-1.12.0.tar.gz" KOKKOS_FILENAME="kokkos-3.4.01.tar.gz" MSCG_FILENAME="mscg-1.7.3.1.tar.gz" LATTE_FILENAME="latte-1.2.2.tar.gz" -PACELIB_FILENAME="pacelib-2021.4.9.tar.gz" +PACELIB_FILENAME="v.2021.10.25.yaml_pace.upd2.tar.gz" TARBALLS=( MPICH2_WIN64_DEVEL_URL From 9895d8436ab4327b5067d71802907e9c304ffa6d Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Wed, 27 Oct 2021 16:03:44 +0200 Subject: [PATCH 35/44] update/clean downloading the ML-PACE/v.2021.10.25.tar.gz --- cmake/Modules/Packages/ML-PACE.cmake | 4 ++-- lib/pace/Install.py | 5 ++--- tools/offline/scripts/init_http_cache.sh | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index ec3fa23f4c..6b7c13eafe 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,6 +1,6 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.yaml_pace.upd2.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "6ba037a6149bd5c9472ead6356288a6a" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_MD5 "9cb2ad286abacdc86faf5a9e3a8abd71" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index 7c2c798146..7825207f6c 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -15,15 +15,14 @@ from install_helpers import fullpath, geturl, checkmd5sum # settings thisdir = fullpath('.') -version = 'v.2021.10.25.yaml_pace.upd2' +version = 'v.2021.10.25' # known checksums for different PACE versions. used to validate the download. checksums = { \ 'v.2021.2.3.upd2' : '8fd1162724d349b930e474927197f20d', 'v.2021.4.9' : '4db54962fbd6adcf8c18d46e1798ceb5', 'v.2021.9.28' : 'f98363bb98adc7295ea63974738c2a1b', - 'v.2021.10.25.yaml_pace' : '4c84c1cb1e2d8c690e3f797433ed2886' - 'v.2021.10.25.yaml_pace.upd2': '6ba037a6149bd5c9472ead6356288a6a' + 'v.2021.10.25' : '9cb2ad286abacdc86faf5a9e3a8abd71' } diff --git a/tools/offline/scripts/init_http_cache.sh b/tools/offline/scripts/init_http_cache.sh index ea234c8fbb..8633120d05 100755 --- a/tools/offline/scripts/init_http_cache.sh +++ b/tools/offline/scripts/init_http_cache.sh @@ -51,7 +51,7 @@ KOKKOS_URL="https://github.com/kokkos/kokkos/archive/3.4.01.tar.gz" KIM_URL="https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" MSCG_URL="https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz" PLUMED_URL="https://github.com/plumed/plumed2/releases/download/v2.7.2/plumed-src-2.7.2.tgz" -PACELIB_URL="https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.yaml_pace.upd2.tar.gz" +PACELIB_URL="https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.tar.gz" LATTE_URL="https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" SCAFACOS_URL="https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz" MDI_URL="https://github.com/MolSSI-MDI/MDI_Library/archive/v1.2.9.tar.gz" @@ -62,7 +62,7 @@ CUB_FILENAME="cub-1.12.0.tar.gz" KOKKOS_FILENAME="kokkos-3.4.01.tar.gz" MSCG_FILENAME="mscg-1.7.3.1.tar.gz" LATTE_FILENAME="latte-1.2.2.tar.gz" -PACELIB_FILENAME="v.2021.10.25.yaml_pace.upd2.tar.gz" +PACELIB_FILENAME="v.2021.10.25.tar.gz" TARBALLS=( MPICH2_WIN64_DEVEL_URL From c0c45be357537b88cbe977f90ce33e78998961e7 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Wed, 27 Oct 2021 17:19:18 +0200 Subject: [PATCH 36/44] bugfix Fedora CMake compilation --- cmake/Modules/Packages/ML-PACE.cmake | 2 +- lib/pace/Install.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index 6b7c13eafe..d46197114d 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,6 +1,6 @@ set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "9cb2ad286abacdc86faf5a9e3a8abd71" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_MD5 "a2ac3315c41a1a4a5c912bcb1bc9c5cc" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index 7825207f6c..5b968732c9 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -22,7 +22,7 @@ checksums = { \ 'v.2021.2.3.upd2' : '8fd1162724d349b930e474927197f20d', 'v.2021.4.9' : '4db54962fbd6adcf8c18d46e1798ceb5', 'v.2021.9.28' : 'f98363bb98adc7295ea63974738c2a1b', - 'v.2021.10.25' : '9cb2ad286abacdc86faf5a9e3a8abd71' + 'v.2021.10.25' : 'a2ac3315c41a1a4a5c912bcb1bc9c5cc' } From b5e3d69c82ce73641af48532ee2daaaae4bbbb64 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Oct 2021 14:23:53 -0400 Subject: [PATCH 37/44] change downloaded archive name to more closely follow the confvention --- tools/offline/scripts/init_http_cache.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/offline/scripts/init_http_cache.sh b/tools/offline/scripts/init_http_cache.sh index 8633120d05..d18105ad96 100755 --- a/tools/offline/scripts/init_http_cache.sh +++ b/tools/offline/scripts/init_http_cache.sh @@ -62,7 +62,7 @@ CUB_FILENAME="cub-1.12.0.tar.gz" KOKKOS_FILENAME="kokkos-3.4.01.tar.gz" MSCG_FILENAME="mscg-1.7.3.1.tar.gz" LATTE_FILENAME="latte-1.2.2.tar.gz" -PACELIB_FILENAME="v.2021.10.25.tar.gz" +PACELIB_FILENAME="pacelib-2021.10.25.tar.gz" TARBALLS=( MPICH2_WIN64_DEVEL_URL From 28d86578a3dbc5968304a24d09aabf187f84a457 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Oct 2021 15:26:58 -0400 Subject: [PATCH 38/44] update version strings for next patch release --- doc/lammps.1 | 2 +- src/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/lammps.1 b/doc/lammps.1 index 0e2831f5ca..78b6c9fd67 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "1" "29 September 2021" "2021-09-29" +.TH LAMMPS "1" "27 October 2021" "2021-10-27" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. diff --git a/src/version.h b/src/version.h index c1b2b627a8..21f49398e0 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "29 Sep 2021" +#define LAMMPS_VERSION "27 Oct 2021" From a329de81bf864b7267f840d3d5a18949e21a4ba8 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 27 Oct 2021 15:56:28 -0400 Subject: [PATCH 39/44] Update source URLs for offline compilation tool --- tools/offline/scripts/init_http_cache.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/offline/scripts/init_http_cache.sh b/tools/offline/scripts/init_http_cache.sh index 44a07da35a..3c8f5cc715 100755 --- a/tools/offline/scripts/init_http_cache.sh +++ b/tools/offline/scripts/init_http_cache.sh @@ -40,12 +40,12 @@ echo "Dowloading thirdparty tarballs..." MPICH2_WIN64_DEVEL_URL="${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" MPICH2_WIN32_DEVEL_URL="${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" VORO_URL="${LAMMPS_THIRDPARTY_URL}/voro++-0.4.6.tar.gz" -OPENCL_LOADER_URL="${LAMMPS_THIRDPARTY_URL}/opencl-loader-2021.06.30.tar.gz" +OPENCL_LOADER_URL="${LAMMPS_THIRDPARTY_URL}/opencl-loader-2021.09.18.tar.gz" SCAFACOS_FIX_URL="${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff" -GTEST_URL="https://github.com/google/googletest/archive/release-1.10.0.tar.gz" +GTEST_URL="https://github.com/google/googletest/archive/release-1.11.0.tar.gz" YAML_URL="https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz" MATHJAX_URL="https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" -EIGEN3_URL="https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz" +EIGEN3_URL="https://download.lammps.org/thirdparty/eigen-3.4.0.tar.gz" CUB_URL="https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" KOKKOS_URL="https://github.com/kokkos/kokkos/archive/3.4.01.tar.gz" KIM_URL="https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" @@ -55,14 +55,16 @@ PACELIB_URL="https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021. LATTE_URL="https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" SCAFACOS_URL="https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz" MDI_URL="https://github.com/MolSSI-MDI/MDI_Library/archive/v1.2.9.tar.gz" +N2P2_URL="https://github.com/CompPhysVienna/n2p2/archive/v2.1.4.tar.gz" -GTEST_FILENAME="gtest-1.10.0.tar.gz" +GTEST_FILENAME="gtest-1.11.0.tar.gz" MATHJAX_FILENAME="mathjax-3.1.3.tar.gz" CUB_FILENAME="cub-1.12.0.tar.gz" KOKKOS_FILENAME="kokkos-3.4.01.tar.gz" MSCG_FILENAME="mscg-1.7.3.1.tar.gz" LATTE_FILENAME="latte-1.2.2.tar.gz" PACELIB_FILENAME="pacelib-2021.4.9.tar.gz" +N2P2_FILENAME="n2p2-2.1.4.tar.gz" TARBALLS=( MPICH2_WIN64_DEVEL_URL @@ -83,6 +85,7 @@ TARBALLS=( LATTE_URL SCAFACOS_URL MDI_URL + N2P2_URL ) ############################################################################### From 51bd05bb77fafb959d2dcb2b8d44ed44cf019759 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 27 Oct 2021 16:20:47 -0400 Subject: [PATCH 40/44] Make update_downloads.sh detect new URLs and report error --- tools/offline/scripts/update_downloads.sh | 34 +++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/tools/offline/scripts/update_downloads.sh b/tools/offline/scripts/update_downloads.sh index 247b92e562..28cd267c27 100755 --- a/tools/offline/scripts/update_downloads.sh +++ b/tools/offline/scripts/update_downloads.sh @@ -14,11 +14,41 @@ function update_setting() sed -i "/^$1=/c$1=\"$2\"" init_http_cache.sh } +DETECTED_URLS=$(grep -PoRh "\w+_URL" ../../../cmake/ | sort | uniq | grep -v ^LAMMPS) +KNOWN_URLS=$(grep -Rh "_URL=" init_http_cache.sh | grep -v ^LAMMPS | grep -v SCAFACOS_FIX | cut -d= -f1) -URLS=$(grep -Rh "_URL=" init_http_cache.sh | grep -v ^LAMMPS | grep -v SCAFACOS_FIX | cut -d= -f1) +# check if init_http_cache.sh contains all URLs +for URL in $DETECTED_URLS +do + grep -q ^$URL= init_http_cache.sh + if [ $? -ne 0 ] + then + FILENAME_VAR="${URL/_URL/_FILENAME}" + echo $URL is not known. Please update 'init_http_cache.sh' as follows: + echo + echo 1. add the following line: + echo + echo $URL="" + echo + echo 2. Define a new $FILENAME_VAR if necessary + echo + echo $FILENAME_VAR="pkgname-0.0.0.tar.gz" + echo + echo 3. extend TARBALLS with $URL + echo + echo TARBALLS=\( + echo " ..." + echo " $URL" + echo \) + echo + echo 4. Rerun this script + echo + exit 1 + fi +done # update URLs by grabbing the latest ones from cmake files -for URL in $URLS +for URL in $KNOWN_URLS do extract_setting "$URL" update_setting "$URL" ${!URL} From 153e77864dc95e53f9b8e3ca8b65336faecf92d1 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 27 Oct 2021 16:44:40 -0400 Subject: [PATCH 41/44] Use LAMMPS_THIRDPARTY_URL variable for EIGEN3_URL --- cmake/Modules/Packages/MACHDYN.cmake | 2 +- tools/offline/scripts/init_http_cache.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/MACHDYN.cmake b/cmake/Modules/Packages/MACHDYN.cmake index 8729d80dbf..d90ca8146c 100644 --- a/cmake/Modules/Packages/MACHDYN.cmake +++ b/cmake/Modules/Packages/MACHDYN.cmake @@ -8,7 +8,7 @@ option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed on if(DOWNLOAD_EIGEN3) message(STATUS "Eigen3 download requested - we will build our own") - set(EIGEN3_URL "https://download.lammps.org/thirdparty/eigen-3.4.0.tar.gz" CACHE STRING "URL for Eigen3 tarball") + set(EIGEN3_URL "${LAMMPS_THIRDPARTY_URL}/eigen-3.4.0.tar.gz" CACHE STRING "URL for Eigen3 tarball") set(EIGEN3_MD5 "4c527a9171d71a72a9d4186e65bea559" CACHE STRING "MD5 checksum of Eigen3 tarball") mark_as_advanced(EIGEN3_URL) mark_as_advanced(EIGEN3_MD5) diff --git a/tools/offline/scripts/init_http_cache.sh b/tools/offline/scripts/init_http_cache.sh index b003aa08b3..926a74f499 100755 --- a/tools/offline/scripts/init_http_cache.sh +++ b/tools/offline/scripts/init_http_cache.sh @@ -45,7 +45,7 @@ SCAFACOS_FIX_URL="${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff" GTEST_URL="https://github.com/google/googletest/archive/release-1.11.0.tar.gz" YAML_URL="https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz" MATHJAX_URL="https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" -EIGEN3_URL="https://download.lammps.org/thirdparty/eigen-3.4.0.tar.gz" +EIGEN3_URL="${LAMMPS_THIRDPARTY_URL}/eigen-3.4.0.tar.gz" CUB_URL="https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" KOKKOS_URL="https://github.com/kokkos/kokkos/archive/3.4.01.tar.gz" KIM_URL="https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" From 9424571ce2582ea81403e3590f792e16ddb66f3a Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 27 Oct 2021 17:00:31 -0400 Subject: [PATCH 42/44] Use correct sizeof in memset --- src/write_restart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 4333fa5416..e9be7f9c36 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -269,7 +269,7 @@ void WriteRestart::write(const std::string &file) double *buf; memory->create(buf,max_size,"write_restart:buf"); - memset(buf,0,max_size*sizeof(buf)); + memset(buf,0,max_size*sizeof(double)); // all procs write file layout info which may include per-proc sizes From 18a7c1544159f96d18899761ff2dc002ace87283 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Oct 2021 17:21:38 -0400 Subject: [PATCH 43/44] forward DYN_LIB variable to Makefile.mpi --- src/MAKE/Makefile.mpi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MAKE/Makefile.mpi b/src/MAKE/Makefile.mpi index cf796be69b..933da9663e 100644 --- a/src/MAKE/Makefile.mpi +++ b/src/MAKE/Makefile.mpi @@ -65,7 +65,7 @@ JPG_INC = JPG_PATH = JPG_LIB = -# library for loading shared objects (defaults to -ldl) +# library for loading shared objects (defaults to -ldl, should be empty on Windows) # uncomment to change the default # override DYN_LIB = @@ -79,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) From 95d08c6667a282f3266802bdc7d0a51bec8b1386 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Oct 2021 17:41:16 -0400 Subject: [PATCH 44/44] update all makefiles to use DYN_LIB variable from master makefile --- src/MAKE/MACHINES/Makefile.aarch64_arm_openmpi_armpl | 7 ++++++- src/MAKE/MACHINES/Makefile.aarch64_arm_serial_armpl | 7 ++++++- src/MAKE/MACHINES/Makefile.aarch64_g++_openmpi_armpl | 7 ++++++- src/MAKE/MACHINES/Makefile.aarch64_g++_serial_armpl | 7 ++++++- src/MAKE/MACHINES/Makefile.astra_arm | 7 ++++++- src/MAKE/MACHINES/Makefile.bgq | 2 +- src/MAKE/MACHINES/Makefile.cori2 | 7 ++++++- src/MAKE/MACHINES/Makefile.cygwin | 5 +++-- src/MAKE/MACHINES/Makefile.mac | 7 ++++++- src/MAKE/MACHINES/Makefile.mac_mpi | 7 ++++++- src/MAKE/MACHINES/Makefile.power | 7 ++++++- src/MAKE/MACHINES/Makefile.summit_kokkos | 7 ++++++- src/MAKE/MACHINES/Makefile.theta | 7 ++++++- src/MAKE/MACHINES/Makefile.ubuntu | 7 ++++++- src/MAKE/MACHINES/Makefile.ubuntu_simple | 7 ++++++- src/MAKE/MACHINES/Makefile.white | 7 ++++++- src/MAKE/MACHINES/Makefile.xe6 | 7 ++++++- src/MAKE/OPTIONS/Makefile.big | 7 ++++++- src/MAKE/OPTIONS/Makefile.fftw | 7 ++++++- src/MAKE/OPTIONS/Makefile.g++_mpich | 7 ++++++- src/MAKE/OPTIONS/Makefile.g++_mpich_link | 7 ++++++- src/MAKE/OPTIONS/Makefile.g++_openmpi | 7 ++++++- src/MAKE/OPTIONS/Makefile.g++_openmpi_link | 7 ++++++- src/MAKE/OPTIONS/Makefile.g++_serial | 7 ++++++- src/MAKE/OPTIONS/Makefile.gpu | 7 ++++++- src/MAKE/OPTIONS/Makefile.hip | 7 ++++++- src/MAKE/OPTIONS/Makefile.icc_mpich | 7 ++++++- src/MAKE/OPTIONS/Makefile.icc_mpich_link | 7 ++++++- src/MAKE/OPTIONS/Makefile.icc_openmpi | 7 ++++++- src/MAKE/OPTIONS/Makefile.icc_openmpi_link | 7 ++++++- src/MAKE/OPTIONS/Makefile.icc_serial | 7 ++++++- src/MAKE/OPTIONS/Makefile.intel_coprocessor | 7 ++++++- src/MAKE/OPTIONS/Makefile.intel_cpu_intelmpi | 7 ++++++- src/MAKE/OPTIONS/Makefile.intel_cpu_mpich | 7 ++++++- src/MAKE/OPTIONS/Makefile.intel_cpu_openmpi | 7 ++++++- src/MAKE/OPTIONS/Makefile.jpeg | 7 ++++++- src/MAKE/OPTIONS/Makefile.knl | 7 ++++++- src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi | 7 ++++++- src/MAKE/OPTIONS/Makefile.kokkos_mpi_only | 7 ++++++- src/MAKE/OPTIONS/Makefile.kokkos_omp | 7 ++++++- src/MAKE/OPTIONS/Makefile.kokkos_phi | 7 ++++++- src/MAKE/OPTIONS/Makefile.mgptfast | 7 ++++++- src/MAKE/OPTIONS/Makefile.omp | 7 ++++++- src/MAKE/OPTIONS/Makefile.oneapi | 7 ++++++- src/MAKE/OPTIONS/Makefile.opt | 7 ++++++- src/MAKE/OPTIONS/Makefile.pgi_mpich_link | 7 ++++++- src/MAKE/OPTIONS/Makefile.png | 7 ++++++- 47 files changed, 274 insertions(+), 48 deletions(-) diff --git a/src/MAKE/MACHINES/Makefile.aarch64_arm_openmpi_armpl b/src/MAKE/MACHINES/Makefile.aarch64_arm_openmpi_armpl index ead00277c6..050670804e 100644 --- a/src/MAKE/MACHINES/Makefile.aarch64_arm_openmpi_armpl +++ b/src/MAKE/MACHINES/Makefile.aarch64_arm_openmpi_armpl @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.aarch64_arm_serial_armpl b/src/MAKE/MACHINES/Makefile.aarch64_arm_serial_armpl index 44c83ff1e0..2ad14ab258 100644 --- a/src/MAKE/MACHINES/Makefile.aarch64_arm_serial_armpl +++ b/src/MAKE/MACHINES/Makefile.aarch64_arm_serial_armpl @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.aarch64_g++_openmpi_armpl b/src/MAKE/MACHINES/Makefile.aarch64_g++_openmpi_armpl index 2ebd2ac744..efe91aed43 100644 --- a/src/MAKE/MACHINES/Makefile.aarch64_g++_openmpi_armpl +++ b/src/MAKE/MACHINES/Makefile.aarch64_g++_openmpi_armpl @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.aarch64_g++_serial_armpl b/src/MAKE/MACHINES/Makefile.aarch64_g++_serial_armpl index 054b530bc8..3c5a552b1b 100644 --- a/src/MAKE/MACHINES/Makefile.aarch64_g++_serial_armpl +++ b/src/MAKE/MACHINES/Makefile.aarch64_g++_serial_armpl @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.astra_arm b/src/MAKE/MACHINES/Makefile.astra_arm index f64f4da891..79461626e9 100644 --- a/src/MAKE/MACHINES/Makefile.astra_arm +++ b/src/MAKE/MACHINES/Makefile.astra_arm @@ -64,6 +64,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -73,7 +78,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.bgq b/src/MAKE/MACHINES/Makefile.bgq index f0401e0758..4baecb9fc3 100644 --- a/src/MAKE/MACHINES/Makefile.bgq +++ b/src/MAKE/MACHINES/Makefile.bgq @@ -15,7 +15,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.cori2 b/src/MAKE/MACHINES/Makefile.cori2 index ca902617fd..8421aedc78 100644 --- a/src/MAKE/MACHINES/Makefile.cori2 +++ b/src/MAKE/MACHINES/Makefile.cori2 @@ -75,6 +75,11 @@ JPG_INC = JPG_PATH = JPG_LIB = #-ljpeg +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -84,7 +89,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.cygwin b/src/MAKE/MACHINES/Makefile.cygwin index 1af9cfe802..153ae1e6c0 100644 --- a/src/MAKE/MACHINES/Makefile.cygwin +++ b/src/MAKE/MACHINES/Makefile.cygwin @@ -65,9 +65,10 @@ JPG_INC = JPG_PATH = JPG_LIB = -# library for loading shared objects (defaults to -ldl, but should be empty on Windows) +# library for loading shared objects (defaults to -ldl but must be empty on Windows) override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -77,7 +78,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.mac b/src/MAKE/MACHINES/Makefile.mac index fb749b5759..e2a78325a1 100644 --- a/src/MAKE/MACHINES/Makefile.mac +++ b/src/MAKE/MACHINES/Makefile.mac @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.mac_mpi b/src/MAKE/MACHINES/Makefile.mac_mpi index 4718c94e51..87f961e12e 100644 --- a/src/MAKE/MACHINES/Makefile.mac_mpi +++ b/src/MAKE/MACHINES/Makefile.mac_mpi @@ -66,6 +66,11 @@ JPG_INC = -I/opt/local/include JPG_PATH = -L/opt/local/lib JPG_LIB = -ljpeg +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.power b/src/MAKE/MACHINES/Makefile.power index 1671fd6273..9c8448abc3 100644 --- a/src/MAKE/MACHINES/Makefile.power +++ b/src/MAKE/MACHINES/Makefile.power @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.summit_kokkos b/src/MAKE/MACHINES/Makefile.summit_kokkos index 95ee7e39a8..87f8c75da2 100644 --- a/src/MAKE/MACHINES/Makefile.summit_kokkos +++ b/src/MAKE/MACHINES/Makefile.summit_kokkos @@ -72,6 +72,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -81,7 +86,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.theta b/src/MAKE/MACHINES/Makefile.theta index 62e125152d..8d04d25ac7 100644 --- a/src/MAKE/MACHINES/Makefile.theta +++ b/src/MAKE/MACHINES/Makefile.theta @@ -70,6 +70,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -79,7 +84,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.ubuntu b/src/MAKE/MACHINES/Makefile.ubuntu index f030ce64df..ed479d8969 100644 --- a/src/MAKE/MACHINES/Makefile.ubuntu +++ b/src/MAKE/MACHINES/Makefile.ubuntu @@ -69,6 +69,11 @@ JPG_INC = JPG_PATH = JPG_LIB = -ljpeg -lpng +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -78,7 +83,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.ubuntu_simple b/src/MAKE/MACHINES/Makefile.ubuntu_simple index e8b58fc804..3926777f03 100644 --- a/src/MAKE/MACHINES/Makefile.ubuntu_simple +++ b/src/MAKE/MACHINES/Makefile.ubuntu_simple @@ -68,6 +68,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -77,7 +82,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.white b/src/MAKE/MACHINES/Makefile.white index ff2103008c..cb101998b3 100644 --- a/src/MAKE/MACHINES/Makefile.white +++ b/src/MAKE/MACHINES/Makefile.white @@ -69,6 +69,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -78,7 +83,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/MACHINES/Makefile.xe6 b/src/MAKE/MACHINES/Makefile.xe6 index a6db78a053..9dbe0ba73e 100644 --- a/src/MAKE/MACHINES/Makefile.xe6 +++ b/src/MAKE/MACHINES/Makefile.xe6 @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.big b/src/MAKE/OPTIONS/Makefile.big index bdc093c6ae..d2cbf8a73e 100644 --- a/src/MAKE/OPTIONS/Makefile.big +++ b/src/MAKE/OPTIONS/Makefile.big @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.fftw b/src/MAKE/OPTIONS/Makefile.fftw index dd539fb5dc..65b568d3d2 100644 --- a/src/MAKE/OPTIONS/Makefile.fftw +++ b/src/MAKE/OPTIONS/Makefile.fftw @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.g++_mpich b/src/MAKE/OPTIONS/Makefile.g++_mpich index e0c77437f5..15257a9a45 100644 --- a/src/MAKE/OPTIONS/Makefile.g++_mpich +++ b/src/MAKE/OPTIONS/Makefile.g++_mpich @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.g++_mpich_link b/src/MAKE/OPTIONS/Makefile.g++_mpich_link index 4f2855a9cc..3498842be4 100644 --- a/src/MAKE/OPTIONS/Makefile.g++_mpich_link +++ b/src/MAKE/OPTIONS/Makefile.g++_mpich_link @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.g++_openmpi b/src/MAKE/OPTIONS/Makefile.g++_openmpi index 75c12f9b38..a619beefcc 100644 --- a/src/MAKE/OPTIONS/Makefile.g++_openmpi +++ b/src/MAKE/OPTIONS/Makefile.g++_openmpi @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.g++_openmpi_link b/src/MAKE/OPTIONS/Makefile.g++_openmpi_link index 0c9997dbb0..7d1743fec7 100644 --- a/src/MAKE/OPTIONS/Makefile.g++_openmpi_link +++ b/src/MAKE/OPTIONS/Makefile.g++_openmpi_link @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.g++_serial b/src/MAKE/OPTIONS/Makefile.g++_serial index d6b9bf3221..397a977ead 100644 --- a/src/MAKE/OPTIONS/Makefile.g++_serial +++ b/src/MAKE/OPTIONS/Makefile.g++_serial @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.gpu b/src/MAKE/OPTIONS/Makefile.gpu index 9ad5cf477c..2e183ef746 100644 --- a/src/MAKE/OPTIONS/Makefile.gpu +++ b/src/MAKE/OPTIONS/Makefile.gpu @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.hip b/src/MAKE/OPTIONS/Makefile.hip index 8be9e7260f..ed9f832a42 100644 --- a/src/MAKE/OPTIONS/Makefile.hip +++ b/src/MAKE/OPTIONS/Makefile.hip @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -80,7 +85,7 @@ endif EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.icc_mpich b/src/MAKE/OPTIONS/Makefile.icc_mpich index c630c42c26..30d7b3da81 100644 --- a/src/MAKE/OPTIONS/Makefile.icc_mpich +++ b/src/MAKE/OPTIONS/Makefile.icc_mpich @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.icc_mpich_link b/src/MAKE/OPTIONS/Makefile.icc_mpich_link index 8b89d2509a..232475f2e3 100644 --- a/src/MAKE/OPTIONS/Makefile.icc_mpich_link +++ b/src/MAKE/OPTIONS/Makefile.icc_mpich_link @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.icc_openmpi b/src/MAKE/OPTIONS/Makefile.icc_openmpi index 0a2c9598a6..5f3281c021 100644 --- a/src/MAKE/OPTIONS/Makefile.icc_openmpi +++ b/src/MAKE/OPTIONS/Makefile.icc_openmpi @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.icc_openmpi_link b/src/MAKE/OPTIONS/Makefile.icc_openmpi_link index 825d4cdff0..ab3909fd1e 100644 --- a/src/MAKE/OPTIONS/Makefile.icc_openmpi_link +++ b/src/MAKE/OPTIONS/Makefile.icc_openmpi_link @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.icc_serial b/src/MAKE/OPTIONS/Makefile.icc_serial index 2d2da54c68..5ec920c9ef 100644 --- a/src/MAKE/OPTIONS/Makefile.icc_serial +++ b/src/MAKE/OPTIONS/Makefile.icc_serial @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.intel_coprocessor b/src/MAKE/OPTIONS/Makefile.intel_coprocessor index 2b66c20f4a..99e8d22d82 100644 --- a/src/MAKE/OPTIONS/Makefile.intel_coprocessor +++ b/src/MAKE/OPTIONS/Makefile.intel_coprocessor @@ -70,6 +70,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -79,7 +84,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.intel_cpu_intelmpi b/src/MAKE/OPTIONS/Makefile.intel_cpu_intelmpi index 04ec1fdc64..0371078bd2 100644 --- a/src/MAKE/OPTIONS/Makefile.intel_cpu_intelmpi +++ b/src/MAKE/OPTIONS/Makefile.intel_cpu_intelmpi @@ -69,6 +69,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -78,7 +83,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.intel_cpu_mpich b/src/MAKE/OPTIONS/Makefile.intel_cpu_mpich index dece0092f1..04a60f8f61 100644 --- a/src/MAKE/OPTIONS/Makefile.intel_cpu_mpich +++ b/src/MAKE/OPTIONS/Makefile.intel_cpu_mpich @@ -69,6 +69,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -78,7 +83,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.intel_cpu_openmpi b/src/MAKE/OPTIONS/Makefile.intel_cpu_openmpi index 0053aef20a..9041dc797e 100644 --- a/src/MAKE/OPTIONS/Makefile.intel_cpu_openmpi +++ b/src/MAKE/OPTIONS/Makefile.intel_cpu_openmpi @@ -70,6 +70,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -79,7 +84,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.jpeg b/src/MAKE/OPTIONS/Makefile.jpeg index 268e7b94e8..c2b7ab6a49 100644 --- a/src/MAKE/OPTIONS/Makefile.jpeg +++ b/src/MAKE/OPTIONS/Makefile.jpeg @@ -65,6 +65,11 @@ JPG_INC = -I/usr/include JPG_PATH = -L/usr/lib JPG_LIB = -ljpeg +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.knl b/src/MAKE/OPTIONS/Makefile.knl index 091fd7558f..c6cf783331 100644 --- a/src/MAKE/OPTIONS/Makefile.knl +++ b/src/MAKE/OPTIONS/Makefile.knl @@ -68,6 +68,11 @@ JPG_INC = JPG_PATH = JPG_LIB = -ljpeg +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -77,7 +82,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi b/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi index c6071cf747..cb3ef0e442 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi +++ b/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi @@ -70,6 +70,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -79,7 +84,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_mpi_only b/src/MAKE/OPTIONS/Makefile.kokkos_mpi_only index 0b2e42487f..6d5e8d779e 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_mpi_only +++ b/src/MAKE/OPTIONS/Makefile.kokkos_mpi_only @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_omp b/src/MAKE/OPTIONS/Makefile.kokkos_omp index 3e8f7ba634..e505da8ae2 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_omp +++ b/src/MAKE/OPTIONS/Makefile.kokkos_omp @@ -66,6 +66,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -75,7 +80,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_phi b/src/MAKE/OPTIONS/Makefile.kokkos_phi index 0e2bec0a5a..b825ad691a 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_phi +++ b/src/MAKE/OPTIONS/Makefile.kokkos_phi @@ -67,6 +67,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -76,7 +81,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.mgptfast b/src/MAKE/OPTIONS/Makefile.mgptfast index da10701a9a..e7fd82a39c 100644 --- a/src/MAKE/OPTIONS/Makefile.mgptfast +++ b/src/MAKE/OPTIONS/Makefile.mgptfast @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.omp b/src/MAKE/OPTIONS/Makefile.omp index 573c2d826b..7a59d7f10d 100644 --- a/src/MAKE/OPTIONS/Makefile.omp +++ b/src/MAKE/OPTIONS/Makefile.omp @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.oneapi b/src/MAKE/OPTIONS/Makefile.oneapi index 2524773a76..d34f0900c6 100644 --- a/src/MAKE/OPTIONS/Makefile.oneapi +++ b/src/MAKE/OPTIONS/Makefile.oneapi @@ -68,6 +68,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -77,7 +82,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.opt b/src/MAKE/OPTIONS/Makefile.opt index 2cb5540fd4..acfd802c44 100644 --- a/src/MAKE/OPTIONS/Makefile.opt +++ b/src/MAKE/OPTIONS/Makefile.opt @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.pgi_mpich_link b/src/MAKE/OPTIONS/Makefile.pgi_mpich_link index daa8a79166..b09efd6fa0 100644 --- a/src/MAKE/OPTIONS/Makefile.pgi_mpich_link +++ b/src/MAKE/OPTIONS/Makefile.pgi_mpich_link @@ -65,6 +65,11 @@ JPG_INC = JPG_PATH = JPG_LIB = +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS) diff --git a/src/MAKE/OPTIONS/Makefile.png b/src/MAKE/OPTIONS/Makefile.png index 40ebe43d32..8eff543af6 100644 --- a/src/MAKE/OPTIONS/Makefile.png +++ b/src/MAKE/OPTIONS/Makefile.png @@ -65,6 +65,11 @@ JPG_INC = -I/usr/include JPG_PATH = -L/usr/lib JPG_LIB = -lpng +# library for loading shared objects (defaults to -ldl, should be empty on Windows) +# uncomment to change the default + +# override DYN_LIB = + # --------------------------------------------------------------------- # build rules and dependencies # do not edit this section @@ -74,7 +79,7 @@ include Makefile.package EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) -EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB) EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS) EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS)