diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 2566497c0e..6af33cd5b3 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -135,11 +135,13 @@ set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions") # ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro # and prints lots of pointless warnings about "unsafe" functions if(MSVC) - add_compile_options(/Zc:__cplusplus) - add_compile_options(/wd4244) - add_compile_options(/wd4267) - if(LAMMPS_EXCEPTIONS) - add_compile_options(/EHsc) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_options(/Zc:__cplusplus) + add_compile_options(/wd4244) + add_compile_options(/wd4267) + if(LAMMPS_EXCEPTIONS) + add_compile_options(/EHsc) + endif() endif() add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() diff --git a/cmake/Modules/LAMMPSInterfacePlugin.cmake b/cmake/Modules/LAMMPSInterfacePlugin.cmake new file mode 100644 index 0000000000..ec7a739785 --- /dev/null +++ b/cmake/Modules/LAMMPSInterfacePlugin.cmake @@ -0,0 +1,197 @@ +# CMake script code to define LAMMPS settings required for building LAMMPS plugins + +# enforce out-of-source build +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds are not allowed. You must create and use a build directory. " + "Please remove CMakeCache.txt and CMakeFiles first.") +endif() + +# global LAMMPS/plugin build settings +set(LAMMPS_SOURCE_DIR "" CACHE PATH "Location of LAMMPS sources folder") +if(NOT LAMMPS_SOURCE_DIR) + message(FATAL_ERROR "Must set LAMMPS_SOURCE_DIR") +endif() + +# by default, install into $HOME/.local (not /usr/local), +# so that no root access (and sudo) is needed +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE) +endif() + +# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro +# and prints lots of pointless warnings about "unsafe" functions +if(MSVC) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_options(/Zc:__cplusplus) + add_compile_options(/wd4244) + add_compile_options(/wd4267) + if(LAMMPS_EXCEPTIONS) + add_compile_options(/EHsc) + endif() + endif() + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) +endif() + +# C++11 is required +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Need -restrict with Intel compilers +if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict") +endif() +set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + +####### +# helper functions from LAMMPSUtils.cmake +function(validate_option name values) + string(TOLOWER ${${name}} needle_lower) + string(TOUPPER ${${name}} needle_upper) + list(FIND ${values} ${needle_lower} IDX_LOWER) + list(FIND ${values} ${needle_upper} IDX_UPPER) + if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0) + list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}}) + message(FATAL_ERROR "\n########################################################################\n" + "Invalid value '${${name}}' for option ${name}\n" + "\n" + "Possible values are:\n" + "${POSSIBLE_VALUE_LIST}" + "########################################################################") + endif() +endfunction(validate_option) + +# helper function for getting the most recently modified file or folder from a glob pattern +function(get_newest_file path variable) + file(GLOB _dirs ${path}) + set(_besttime 2000-01-01T00:00:00) + set(_bestfile "") + foreach(_dir ${_dirs}) + file(TIMESTAMP ${_dir} _newtime) + if(_newtime IS_NEWER_THAN _besttime) + set(_bestfile ${_dir}) + set(_besttime ${_newtime}) + endif() + endforeach() + if(_bestfile STREQUAL "") + message(FATAL_ERROR "Could not find valid path at: ${path}") + endif() + set(${variable} ${_bestfile} PARENT_SCOPE) +endfunction() + +################################################################################# +# LAMMPS C++ interface. We only need the header related parts except on windows. +add_library(lammps INTERFACE) +target_include_directories(lammps INTERFACE ${LAMMPS_SOURCE_DIR}) +if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING) + target_link_libraries(lammps INTERFACE ${CMAKE_BINARY_DIR}/../liblammps.dll.a) +endif() + +################################################################################ +# MPI configuration +if(NOT CMAKE_CROSSCOMPILING) + find_package(MPI QUIET) + option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) +else() + option(BUILD_MPI "Build MPI version" OFF) +endif() + +if(BUILD_MPI) + # do not include the (obsolete) MPI C++ bindings which makes + # for leaner object files and avoids namespace conflicts + set(MPI_CXX_SKIP_MPICXX TRUE) + # We use a non-standard procedure to cross-compile with MPI on Windows + if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING) + # Download and configure custom MPICH files for Windows + message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows") + set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball") + set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball") + set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball") + set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball") + mark_as_advanced(MPICH2_WIN64_DEVEL_URL) + mark_as_advanced(MPICH2_WIN32_DEVEL_URL) + mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) + mark_as_advanced(MPICH2_WIN32_DEVEL_MD5) + + include(ExternalProject) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + ExternalProject_Add(mpi4win_build + URL ${MPICH2_WIN64_DEVEL_URL} + URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} + CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" + BUILD_BYPRODUCTS /lib/libmpi.a) + else() + ExternalProject_Add(mpi4win_build + URL ${MPICH2_WIN32_DEVEL_URL} + URL_MD5 ${MPICH2_WIN32_DEVEL_MD5} + CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" + BUILD_BYPRODUCTS /lib/libmpi.a) + endif() + + ExternalProject_get_property(mpi4win_build SOURCE_DIR) + file(MAKE_DIRECTORY "${SOURCE_DIR}/include") + add_library(MPI::MPI_CXX UNKNOWN IMPORTED) + set_target_properties(MPI::MPI_CXX PROPERTIES + IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a" + INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" + INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") + add_dependencies(MPI::MPI_CXX mpi4win_build) + + # set variables for status reporting at the end of CMake run + set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") + set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") + set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a") + else() + find_package(MPI REQUIRED) + option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF) + if(LAMMPS_LONGLONG_TO_LONG) + target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG) + endif() + endif() + target_link_libraries(lammps INTERFACE MPI::MPI_CXX) +else() + add_library(mpi_stubs INTERFACE) + target_include_directories(mpi_stubs INTERFACE $) + target_link_libraries(lammps INTERFACE mpi_stubs) +endif() + +################################################################################ +# detect if we may enable OpenMP support by default +set(BUILD_OMP_DEFAULT OFF) +find_package(OpenMP QUIET) +if(OpenMP_FOUND) + check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE) + if(HAVE_OMP_H_INCLUDE) + set(BUILD_OMP_DEFAULT ON) + endif() +endif() + +option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT}) + +if(BUILD_OMP) + find_package(OpenMP REQUIRED) + check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE) + if(NOT HAVE_OMP_H_INCLUDE) + message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support") + endif() + + if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0))) + # GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts. + # Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe. + target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=4) + else() + target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=3) + endif() + target_link_libraries(lammps INTERFACE OpenMP::OpenMP_CXX) +endif() + +################ +# integer size selection +set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)") +set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall) +set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES}) +validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES) +string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES) +target_compile_definitions(lammps INTERFACE -DLAMMPS_${LAMMPS_SIZES}) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index c647c8873a..c553809ff1 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -32,5 +32,6 @@ target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_ target_link_libraries(pace PRIVATE yaml-cpp-pace) - -target_link_libraries(lammps PRIVATE pace) +if(CMAKE_PROJECT_NAME STREQUAL "lammps") + target_link_libraries(lammps PRIVATE pace) +endif() diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 81db71729a..13cfee9018 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -46,8 +46,8 @@ set(WIN_PACKAGES MISC ML-HDNNP ML-IAP - ML-SNAP ML-RANN + ML-SNAP MOFFF MOLECULE MOLFILE @@ -56,6 +56,7 @@ set(WIN_PACKAGES ORIENT PERI PHONON + PLUGIN POEMS PTM QEQ diff --git a/doc/Makefile b/doc/Makefile index 07b201b07e..8841ae4825 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -13,7 +13,7 @@ VENV = $(BUILDDIR)/docenv ANCHORCHECK = $(VENV)/bin/rst_anchor_check SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config MATHJAX = $(SPHINXCONFIG)/_static/mathjax -MATHJAXTAG = 3.2.1 +MATHJAXTAG = 3.2.2 PYTHON = $(word 3,$(shell type python3)) DOXYGEN = $(word 3,$(shell type doxygen)) diff --git a/doc/src/Developer_plugins.rst b/doc/src/Developer_plugins.rst index 9bf52801a7..36fdd010b3 100644 --- a/doc/src/Developer_plugins.rst +++ b/doc/src/Developer_plugins.rst @@ -276,10 +276,27 @@ Compilation of the plugin can be managed via both, CMake or traditional GNU makefiles. Some examples that can be used as a template are in the ``examples/plugins`` folder. The CMake script code has some small adjustments to allow building the plugins for running unit tests with -them. Another example that converts the KIM package into a plugin can be -found in the ``examples/kim/plugin`` folder. No changes to the sources -of the KIM package themselves are needed; only the plugin interface and -loader code needs to be added. This example only supports building with -CMake, but is probably a more typical example. To compile you need to -run CMake with -DLAMMPS_SOURCE_DIR=. Other +them. + +Another example that converts the KIM package into a plugin can be found +in the ``examples/kim/plugin`` folder. No changes to the sources of the +KIM package themselves are needed; only the plugin interface and loader +code needs to be added. This example only supports building with CMake, +but is probably a more typical example. To compile you need to run CMake +with -DLAMMPS_SOURCE_DIR=. Other configuration setting are identical to those for compiling LAMMPS. + +A second example for a plugin from a package is in the +``examples/PACKAGES/pace/plugin`` folder that will create a plugin from +the ML-PACE package. In this case the bulk of the code is in a static +external library that is being downloaded and compiled first and then +combined with the pair style wrapper and the plugin loader. This +example also contains a NSIS script that can be used to create an +Installer package for Windows (the mutual licensing terms of the +external library and LAMMPS conflict when distributing binaries, so the +ML-PACE package cannot be linked statically, but the LAMMPS headers +required to build the plugin are also available under a less restrictive +license). This will automatically set the required environment variable +and launching a (compatible) LAMMPS binary will load and register the +plugin and the ML-PACE package can then be used as it was linked into +LAMMPS. diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index ef403daa84..b57c91ffee 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -95,7 +95,7 @@ Miscellaneous tools * :ref:`LAMMPS shell ` * :ref:`LAMMPS magic patterns for file(1) ` * :ref:`Offline build tool ` - * :ref:`singularity ` + * :ref:`singularity/apptainer ` * :ref:`SWIG interface ` * :ref:`vim ` @@ -1007,14 +1007,15 @@ Ivanov, at University of Iceland (ali5 at hi.is). .. _singularity_tool: -singularity tool ----------------------------------------- +singularity/apptainer tool +-------------------------- -The singularity sub-directory contains container definitions files -that can be used to build container images for building and testing -LAMMPS on specific OS variants using the `Singularity `_ -container software. Contributions for additional variants are welcome. -For more details please see the README.md file in that folder. +The singularity sub-directory contains container definitions files that +can be used to build container images for building and testing LAMMPS on +specific OS variants using the `Apptainer `_ or +`Singularity `_ container software. Contributions for +additional variants are welcome. For more details please see the +README.md file in that folder. ---------- diff --git a/doc/src/pair_e3b.rst b/doc/src/pair_e3b.rst index b75fb8450c..8ae6d10b82 100644 --- a/doc/src/pair_e3b.rst +++ b/doc/src/pair_e3b.rst @@ -50,6 +50,12 @@ Examples pair_style hybrid/overlay e3b 1 lj/cut/tip4p/long 1 2 1 1 0.15 8.5 pair_coeff * * e3b preset 2011 +Used in example input script: + +.. parsed-literal:: + + examples/PACKAGES/e3b/in.e3b-tip4p2005 + Description """"""""""" @@ -68,21 +74,27 @@ The *e3b* style computes an \"explicit three-body\" (E3B) potential for water :r 0 & r>R_f\\ \end{cases} -This potential was developed as a water model that includes the three-body cooperativity of hydrogen bonding explicitly. -To use it in this way, it must be applied in conjunction with a conventional two-body water model, through *pair_style hybrid/overlay*. -The three body interactions are split into three types: A, B, and C. -Type A corresponds to anti-cooperative double hydrogen bond donor interactions. -Type B corresponds to the cooperative interaction of molecules that both donate and accept a hydrogen bond. -Type C corresponds to anti-cooperative double hydrogen bond acceptor interactions. -The three-body interactions are smoothly cutoff by the switching function s(r) between Rs and Rc3. -The two-body interactions are designed to correct for the effective many-body interactions implicitly included in the conventional two-body potential. -The two-body interactions are cut off sharply at Rc2, because K3 is typically significantly smaller than K2. -See :ref:`(Kumar 2008) ` for more details. +This potential was developed as a water model that includes the +three-body cooperativity of hydrogen bonding explicitly. To use it in +this way, it must be applied in conjunction with a conventional two-body +water model, through pair style :doc:`hybrid/overlay `. The +three body interactions are split into three types: A, B, and C. Type A +corresponds to anti-cooperative double hydrogen bond donor interactions. +Type B corresponds to the cooperative interaction of molecules that both +donate and accept a hydrogen bond. Type C corresponds to +anti-cooperative double hydrogen bond acceptor interactions. The +three-body interactions are smoothly cutoff by the switching function +s(r) between Rs and Rc3. The two-body interactions are designed to +correct for the effective many-body interactions implicitly included in +the conventional two-body potential. The two-body interactions are cut +off sharply at Rc2, because K3 is typically significantly smaller than +K2. See :ref:`(Kumar 2008) ` for more details. -Only a single *pair_coeff* command is used with the *e3b* style. -The first two arguments must be \* \*. -The oxygen atom type for the pair style is passed as the only argument to the *pair_style* command, not in the *pair_coeff* command. -The hydrogen atom type is inferred by the ordering of the atoms. +Only a single :doc:`pair_coeff ` command is used with the +*e3b* style and the first two arguments must be \* \*. The oxygen atom +type for the pair style is passed as the only argument to the +*pair_style* command, not in the *pair_coeff* command. The hydrogen +atom type is inferred from the ordering of the atoms. .. note:: @@ -90,26 +102,41 @@ The hydrogen atom type is inferred by the ordering of the atoms. Each water molecule must have consecutive IDs with the oxygen first. This pair style does not test that this criteria is met. -The *pair_coeff* command must have at least one keyword/value pair, as described above. -The *preset* keyword sets the potential parameters to the values used in :ref:`(Tainter 2011) ` or :ref:`(Tainter 2015) `. -To use the water models defined in those references, the *e3b* style should always be used in conjunction with an *lj/cut/tip4p/long* style through *pair_style hybrid/overlay*, as demonstrated in the second example above. -The *preset 2011* option should be used with the :doc:`TIP4P water model `. -The *preset 2015* option should be used with the :doc:`TIP4P/2005 water model `. -If the *preset* keyword is used, no other keyword is needed. -Changes to the preset parameters can be made by specifying the *preset* keyword followed by the specific parameter to change, like *Ea*\ . -Note that the other keywords must come after *preset* in the pair_style command. -The *e3b* style can also be used to implement any three-body potential of the same form by specifying all the keywords except *neigh*\ : *Ea*, *Eb*, *Ec*, *E2*, *K3*, *K2*, *Rc3*, *Rc2*, *Rs*, and *bondL*\ . -The keyword *bondL* specifies the intramolecular OH bond length of the water model being used. -This is needed to include H atoms that are within the cutoff even when the attached oxygen atom is not. +The *pair_coeff* command must have at least one keyword/value pair, as +described above. The *preset* keyword sets the potential parameters to +the values used in :ref:`(Tainter 2011) ` or +:ref:`(Tainter 2015) `. To use the water models defined in +those references, the *e3b* style should always be used in conjunction +with an *lj/cut/tip4p/long* style through *pair_style hybrid/overlay*, +as demonstrated in the second example above. The *preset 2011* option +should be used with the :doc:`TIP4P water model `. The +*preset 2015* option should be used with the :doc:`TIP4P/2005 water +model `. If the *preset* keyword is used, no other keyword +is needed. Changes to the preset parameters can be made by specifying +the *preset* keyword followed by the specific parameter to change, like +*Ea*\ . Note that the other keywords must come after *preset* in the +pair_style command. The *e3b* style can also be used to implement any +three-body potential of the same form by specifying all the keywords +except *neigh*\ : *Ea*, *Eb*, *Ec*, *E2*, *K3*, *K2*, *Rc3*, *Rc2*, +*Rs*, and *bondL*\ . The keyword *bondL* specifies the intramolecular +OH bond length of the water model being used. This is needed to include +H atoms that are within the cutoff even when the attached oxygen atom is +not. -This pair style allocates arrays sized according to the number of pairwise interactions within Rc3. -To do this it needs an estimate for the number of water molecules within Rc3 of an oxygen atom. -This estimate defaults to 10 and can be changed using the *neigh* keyword, which takes an integer as an argument. -If the neigh setting is too small, the simulation will fail with the error "neigh is too small". -If the neigh setting is too large, the pair style will use more memory than necessary. +This pair style allocates arrays sized according to the number of +pairwise interactions within Rc3. To do this it needs an estimate for +the number of water molecules within Rc3 of an oxygen atom. This +estimate defaults to 10 and can be changed using the *neigh* keyword, +which takes an integer as an argument. If the neigh setting is too +small, the simulation will fail with the error "neigh is too small". If +the neigh setting is too large, the pair style will use more memory than +necessary. -This pair style tallies a breakdown of the total E3B potential energy into sub-categories, which can be accessed via the :doc:`compute pair ` command as a vector of values of length 4. -The 4 values correspond to the terms in the first equation above: the E2 term, the Ea term, the Eb term, and the Ec term. +This pair style tallies a breakdown of the total E3B potential energy +into sub-categories, which can be accessed via the :doc:`compute pair +` command as a vector of values of length 4. The 4 values +correspond to the terms in the first equation above: the E2 term, the Ea +term, the Eb term, and the Ec term. See the examples/PACKAGES/e3b directory for a complete example script. diff --git a/doc/src/pair_sw_angle_table.rst b/doc/src/pair_sw_angle_table.rst index 6431917d67..ff88711d7a 100644 --- a/doc/src/pair_sw_angle_table.rst +++ b/doc/src/pair_sw_angle_table.rst @@ -23,9 +23,9 @@ Examples Used in example input script: - .. parsed-literal:: +.. parsed-literal:: - examples/PACKAGES/manybody_table/in.spce_sw + examples/PACKAGES/manybody_table/in.spce_sw Description diff --git a/doc/src/pair_threebody_table.rst b/doc/src/pair_threebody_table.rst index 68661270c9..19c90feccd 100644 --- a/doc/src/pair_threebody_table.rst +++ b/doc/src/pair_threebody_table.rst @@ -27,10 +27,10 @@ Examples Used in example input scripts: - .. parsed-literal:: +.. parsed-literal:: - examples/PACKAGES/manybody_table/in.spce - examples/PACKAGES/manybody_table/in.spce2 + examples/PACKAGES/manybody_table/in.spce + examples/PACKAGES/manybody_table/in.spce2 Description """"""""""" diff --git a/doc/src/read_data.rst b/doc/src/read_data.rst index 68e1efc496..853d86785e 100644 --- a/doc/src/read_data.rst +++ b/doc/src/read_data.rst @@ -56,7 +56,7 @@ Examples read_data ../run7/data.polymer.gz read_data data.protein fix mycmap crossterm CMAP read_data data.water add append offset 3 1 1 1 1 shift 0.0 0.0 50.0 - read_data data.water add merge 1 group solvent + read_data data.water add merge group solvent Description """"""""""" @@ -622,6 +622,8 @@ of analysis. - atom-ID molecule-ID atom-type x y z * - charge - atom-ID atom-type q x y z + * - dielectric + - atom-ID atom-type q x y z normx normy normz area ed em epsilon curvature * - dipole - atom-ID atom-type q x y z mux muy muz * - dpd diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 836dc4efa8..b42cff262a 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -120,6 +120,7 @@ Antonelli api Apoorva Appl +apptainer Apu arallel arccos @@ -2369,6 +2370,9 @@ Nord norder Nordlund normals +normx +normy +normz Noskov noslip noticable diff --git a/examples/PACKAGES/pace/plugin/CMakeLists.txt b/examples/PACKAGES/pace/plugin/CMakeLists.txt new file mode 100644 index 0000000000..f4068a03c9 --- /dev/null +++ b/examples/PACKAGES/pace/plugin/CMakeLists.txt @@ -0,0 +1,36 @@ +########################################## +# CMake build system for plugin examples. +# The is meant to be used as a template for plugins that are +# distributed independent from the LAMMPS package. +########################################## + +cmake_minimum_required(VERSION 3.10) + +project(paceplugin VERSION 1.0 LANGUAGES CXX) + +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +include(CheckIncludeFileCXX) +include(LAMMPSInterfacePlugin) +include(ML-PACE) + +########################## +# building the plugins + +add_library(paceplugin MODULE paceplugin.cpp ${LAMMPS_SOURCE_DIR}/ML-PACE/pair_pace.cpp) +target_link_libraries(paceplugin PRIVATE pace) +target_link_libraries(paceplugin PRIVATE lammps) +target_include_directories(paceplugin PRIVATE ${LAMMPS_SOURCE_DIR}/ML-PACE) +set_target_properties(paceplugin PROPERTIES PREFIX "" SUFFIX ".so") + +# MacOS seems to need this +if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set_target_properties(paceplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") +# tell CMake to export all symbols to a .dll on Windows with special case for MinGW cross-compilers + set_target_properties(paceplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + if(CMAKE_CROSSCOMPILING) + set_target_properties(paceplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") + endif() +else() + set_target_properties(paceplugin PROPERTIES LINK_FLAGS "-rdynamic") +endif() diff --git a/examples/PACKAGES/pace/plugin/LAMMPSInterfacePlugin.cmake b/examples/PACKAGES/pace/plugin/LAMMPSInterfacePlugin.cmake new file mode 120000 index 0000000000..2ac6d20a54 --- /dev/null +++ b/examples/PACKAGES/pace/plugin/LAMMPSInterfacePlugin.cmake @@ -0,0 +1 @@ +../../../../cmake/Modules/LAMMPSInterfacePlugin.cmake \ No newline at end of file diff --git a/examples/PACKAGES/pace/plugin/ML-PACE.cmake b/examples/PACKAGES/pace/plugin/ML-PACE.cmake new file mode 120000 index 0000000000..3990c0d334 --- /dev/null +++ b/examples/PACKAGES/pace/plugin/ML-PACE.cmake @@ -0,0 +1 @@ +../../../../cmake/Modules/Packages/ML-PACE.cmake \ No newline at end of file diff --git a/examples/PACKAGES/pace/plugin/README.txt b/examples/PACKAGES/pace/plugin/README.txt new file mode 100644 index 0000000000..85490c3f6c --- /dev/null +++ b/examples/PACKAGES/pace/plugin/README.txt @@ -0,0 +1,2 @@ +This folder contains a loader and support files to build the ML-PACE package as plugin. +For more information please see: https://docs.lammps.org/Developer_plugins.html diff --git a/examples/PACKAGES/pace/plugin/lammps-text-logo-wide.bmp b/examples/PACKAGES/pace/plugin/lammps-text-logo-wide.bmp new file mode 100644 index 0000000000..b9ec4c35f2 Binary files /dev/null and b/examples/PACKAGES/pace/plugin/lammps-text-logo-wide.bmp differ diff --git a/examples/PACKAGES/pace/plugin/lammps.ico b/examples/PACKAGES/pace/plugin/lammps.ico new file mode 100644 index 0000000000..cce156bf79 Binary files /dev/null and b/examples/PACKAGES/pace/plugin/lammps.ico differ diff --git a/examples/PACKAGES/pace/plugin/paceplugin.cpp b/examples/PACKAGES/pace/plugin/paceplugin.cpp new file mode 100644 index 0000000000..adf1c168f9 --- /dev/null +++ b/examples/PACKAGES/pace/plugin/paceplugin.cpp @@ -0,0 +1,28 @@ + +#include "lammpsplugin.h" +#include "version.h" + +#include "pair_pace.h" + +using namespace LAMMPS_NS; + +static Pair *pair_pace_creator(LAMMPS *lmp) +{ + return new PairPACE(lmp); +} + +extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) +{ + lammpsplugin_t plugin; + lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; + + // register pace pair style + plugin.version = LAMMPS_VERSION; + plugin.style = "pair"; + plugin.name = "pace"; + plugin.info = "PACE plugin pair style v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator.v1 = (lammpsplugin_factory1 *) &pair_pace_creator; + plugin.handle = handle; + (*register_plugin)(&plugin, lmp); +} diff --git a/examples/PACKAGES/pace/plugin/paceplugin.nsis b/examples/PACKAGES/pace/plugin/paceplugin.nsis new file mode 100644 index 0000000000..de8d1d8478 --- /dev/null +++ b/examples/PACKAGES/pace/plugin/paceplugin.nsis @@ -0,0 +1,157 @@ +#!Nsis Installer Command Script +# +# The following external defines are recognized: +# ${VERSION} = YYYYMMDD + +!include "MUI2.nsh" +!include "FileFunc.nsh" + +!define MUI_ICON "lammps.ico" +!define MUI_UNICON "lammps.ico" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_BITMAP "lammps-text-logo-wide.bmp" +!define MUI_HEADERIMAGE_RIGHT + +Unicode true +XPStyle on + +!include "LogicLib.nsh" +!addplugindir "envvar/Plugins/x86-unicode" +!include "x64.nsh" + +RequestExecutionLevel user + +!macro VerifyUserIsAdmin +UserInfo::GetAccountType +pop $0 +${If} $0 != "admin" + messageBox mb_iconstop "Administrator rights required!" + setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED + quit +${EndIf} +!macroend + +!define PACEPLUGIN "LAMMPS ML-PACE Plugin ${VERSION}" +OutFile "LAMMPS-ML-PACE-plugin-${VERSION}.exe" + +Name "${PACEPLUGIN}" +InstallDir "$LOCALAPPDATA\${PACEPLUGIN}" + +ShowInstDetails show +ShowUninstDetails show +SetCompressor lzma + +!define MUI_ABORTWARNING + +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +!insertmacro MUI_LANGUAGE "English" + +function .onInit + # Determine if LAMMPS was already installed and check whether it was in 32-bit + # or 64-bit. Then look up path to uninstaller and offer to uninstall or quit + SetRegView 32 + ReadRegDWORD $0 HKCU "Software\LAMMPS-ML-PACE" "Bits" + SetRegView LastUsed + ${If} $0 == "32" + SetRegView 32 + ${ElseIf} $0 == "64" + SetRegView 64 + ${Else} + SetRegView 64 + ${EndIf} + ClearErrors + ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" "UninstallString" + SetRegView LastUsed + ${If} ${Errors} + DetailPrint "LAMMPS ML-PACE plugin not (yet) installed" + ${Else} + MessageBox MB_YESNO "LAMMPS ML-PACE plugin ($0 bit) is already installed. Uninstall existing version?" /SD IDYES IDNO Quit + Pop $R1 + StrCmp $R1 2 Quit +1 + Exec $R0 + Quit: + Quit + ${EndIf} + setShellVarContext all +functionEnd + +Section "${PACEPLUGIN}" SecPaceplugin + SectionIn RO + # Write LAMMPS installation bitness marker. Always use 32-bit registry view + SetRegView 32 + IntFmt $0 "0x%08X" 64 + WriteRegDWORD HKCU "Software\LAMMPS-ML-PACE" "Bits" $0 + + # Switch to "native" registry view + SetRegView 64 + SetShellVarContext current + + SetOutPath "$INSTDIR" + File lammps.ico + File paceplugin.so + + # Register Application and its uninstaller + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "DisplayName" "${PACEPLUGIN}" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "Publisher" "The LAMMPS and PACE Developers" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "URLInfoAbout" "lammps.org" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "DisplayIcon" "$INSTDIR\lammps.ico" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "DisplayVersion" "${VERSION}" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "InstallLocation" "$INSTDIR" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" + + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 + IntFmt $0 "0x%08X" $0 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" \ + "EstimatedSize" "$0" + + # update path variables + EnVar::SetHKCU + # add to LAMMPS plugin search path + EnVar::AddValue "LAMMPS_PLUGIN_PATH" "$INSTDIR" + + WriteUninstaller "$INSTDIR\Uninstall.exe" +SectionEnd + +function un.onInit + SetShellVarContext current +functionEnd + +Section "Uninstall" + # remove LAMMPS bitness/installation indicator always in 32-bit registry view + SetRegView 32 + DeleteRegKey HKCU "Software\LAMMPS-ML-PACE" + + # unregister extension, and uninstall info + SetRegView 64 + SetShellVarContext current + # unregister installation + DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-ML-PACE" + + # update path variables + EnVar::SetHKCU + # remove entry from LAMMPS plugin search path + EnVar::DeleteValue "LAMMPS_PLUGIN_PATH" "$INSTDIR" + + Delete /REBOOTOK "$INSTDIR\paceplugin.so" + Delete /REBOOTOK "$INSTDIR\Uninstall.exe" + Delete /REBOOTOK "$INSTDIR\lammps.ico" + RMDir /REBOOTOK "$INSTDIR" +SectionEnd + +# Local Variables: +# mode: sh +# End: diff --git a/examples/kim/plugin/CMakeLists.txt b/examples/kim/plugin/CMakeLists.txt index f4cb5f598d..78d117469d 100644 --- a/examples/kim/plugin/CMakeLists.txt +++ b/examples/kim/plugin/CMakeLists.txt @@ -6,46 +6,11 @@ cmake_minimum_required(VERSION 3.10) -# enforce out-of-source build -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source builds are not allowed. You must create and use a build directory. " - "Please remove CMakeCache.txt and CMakeFiles first.") -endif() - project(kimplugin VERSION 1.0 LANGUAGES CXX) -set(LAMMPS_SOURCE_DIR "" CACHE PATH "Location of LAMMPS sources folder") -if(NOT LAMMPS_SOURCE_DIR) - message(FATAL_ERROR "Must set LAMMPS_SOURCE_DIR") -endif() - -# by default, install into $HOME/.local (not /usr/local), -# so that no root access (and sudo) is needed -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE) -endif() - -# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro -# and prints lots of pointless warnings about "unsafe" functions -if(MSVC) - add_compile_options(/Zc:__cplusplus) - add_compile_options(/wd4244) - add_compile_options(/wd4267) - add_compile_definitions(_CRT_SECURE_NO_WARNINGS) -endif() - -# C++11 is required -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -# Need -restrict with Intel compilers -if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict") -endif() - set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) include(CheckIncludeFileCXX) -include(LAMMPSInterfaceCXX) +include(LAMMPSInterfacePlugin) ########################## # building the plugins @@ -90,9 +55,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin) set_target_properties(kimplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup") elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") # tell CMake to export all symbols to a .dll on Windows with special case for MinGW cross-compilers - set_target_properties(kimplugin.so PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + set_target_properties(kimplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) if(CMAKE_CROSSCOMPILING) - set_target_properties(kimplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") + set_target_properties(kimplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") endif() else() set_target_properties(kimplugin PROPERTIES LINK_FLAGS "-rdynamic") diff --git a/examples/kim/plugin/LAMMPSInterfaceCXX.cmake b/examples/kim/plugin/LAMMPSInterfaceCXX.cmake deleted file mode 100644 index dfbd77e28a..0000000000 --- a/examples/kim/plugin/LAMMPSInterfaceCXX.cmake +++ /dev/null @@ -1,88 +0,0 @@ -# Cmake script code to define the LAMMPS C++ interface -# settings required for building LAMMPS plugins - -################################################################################ -# helper function -function(validate_option name values) - string(TOLOWER ${${name}} needle_lower) - string(TOUPPER ${${name}} needle_upper) - list(FIND ${values} ${needle_lower} IDX_LOWER) - list(FIND ${values} ${needle_upper} IDX_UPPER) - if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0) - list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}}) - message(FATAL_ERROR "\n########################################################################\n" - "Invalid value '${${name}}' for option ${name}\n" - "\n" - "Possible values are:\n" - "${POSSIBLE_VALUE_LIST}" - "########################################################################") - endif() -endfunction(validate_option) - -################################################################################# -# LAMMPS C++ interface. We only need the header related parts. -add_library(lammps INTERFACE) -target_include_directories(lammps INTERFACE ${LAMMPS_SOURCE_DIR}) -if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING) - target_link_libraries(lammps INTERFACE ${CMAKE_BINARY_DIR}/../liblammps.dll.a) -endif() -################################################################################ -# MPI configuration -if(NOT CMAKE_CROSSCOMPILING) - set(MPI_CXX_SKIP_MPICXX TRUE) - find_package(MPI QUIET) - option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) -else() - option(BUILD_MPI "Build MPI version" OFF) -endif() - -if(BUILD_MPI) - find_package(MPI REQUIRED) - option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF) - if(LAMMPS_LONGLONG_TO_LONG) - target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG) - endif() - target_link_libraries(lammps INTERFACE MPI::MPI_CXX) -else() - target_include_directories(lammps INTERFACE "${LAMMPS_SOURCE_DIR}/STUBS") -endif() - -set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)") -set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall) -set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES}) -validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES) -string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES) -target_compile_definitions(lammps INTERFACE -DLAMMPS_${LAMMPS_SIZES}) - -################################################################################ -# detect if we may enable OpenMP support by default -set(BUILD_OMP_DEFAULT OFF) -find_package(OpenMP QUIET) -if(OpenMP_FOUND) - check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE) - if(HAVE_OMP_H_INCLUDE) - set(BUILD_OMP_DEFAULT ON) - endif() -endif() - -option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT}) - -if(BUILD_OMP) - find_package(OpenMP REQUIRED) - check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE) - if(NOT HAVE_OMP_H_INCLUDE) - message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support") - endif() - - if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR - (CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR - ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR - ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0))) - # GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts. - # Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe. - target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=4) - else() - target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=3) - endif() - target_link_libraries(lammps INTERFACE OpenMP::OpenMP_CXX) -endif() diff --git a/examples/kim/plugin/LAMMPSInterfacePlugin.cmake b/examples/kim/plugin/LAMMPSInterfacePlugin.cmake new file mode 120000 index 0000000000..2b78a6ebcc --- /dev/null +++ b/examples/kim/plugin/LAMMPSInterfacePlugin.cmake @@ -0,0 +1 @@ +../../../cmake/Modules/LAMMPSInterfacePlugin.cmake \ No newline at end of file diff --git a/examples/kim/plugin/README.txt b/examples/kim/plugin/README.txt new file mode 100644 index 0000000000..eecc6cc7b4 --- /dev/null +++ b/examples/kim/plugin/README.txt @@ -0,0 +1,2 @@ +This folder contains a loader and support files to build the KIM package as plugin. +For more information please see: https://docs.lammps.org/Developer_plugins.html diff --git a/examples/plugins/CMakeLists.txt b/examples/plugins/CMakeLists.txt index 8bef055ad3..688835de56 100644 --- a/examples/plugins/CMakeLists.txt +++ b/examples/plugins/CMakeLists.txt @@ -32,9 +32,14 @@ else() # ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro # and prints lots of pointless warnings about "unsafe" functions if(MSVC) - add_compile_options(/Zc:__cplusplus) - add_compile_options(/wd4244) - add_compile_options(/wd4267) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_options(/Zc:__cplusplus) + add_compile_options(/wd4244) + add_compile_options(/wd4267) + if(LAMMPS_EXCEPTIONS) + add_compile_options(/EHsc) + endif() + endif() add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() endif() diff --git a/src/DIELECTRIC/atom_vec_dielectric.cpp b/src/DIELECTRIC/atom_vec_dielectric.cpp index b15b233991..67bb9f7dc3 100644 --- a/src/DIELECTRIC/atom_vec_dielectric.cpp +++ b/src/DIELECTRIC/atom_vec_dielectric.cpp @@ -78,9 +78,9 @@ AtomVecDielectric::AtomVecDielectric(LAMMPS *_lmp) : AtomVec(_lmp) "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; fields_create = {"q", "molecule", "num_bond", "num_angle", "num_dihedral", "num_improper", "nspecial", "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; - fields_data_atom = { "id", "molecule", "type", "q", "x", "mu3", "area", "ed", "em", "epsilon", + fields_data_atom = {"id", "molecule", "type", "q", "x", "mu3", "area", "ed", "em", "epsilon", "curvature"}; - fields_data_vel = {"id v"}; + fields_data_vel = {"id", "v"}; // clang-format on setup_fields(); diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 25c3117b0f..f873c70bae 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -318,7 +318,7 @@ void ComputeStressCartesian::compute_array() // Check if inside cut-off if (rsq >= cutsq[itype][jtype]) continue; pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - compute_pressure(fpair, xi1, xi2, xj1, xj2, delx, dely, delz); + compute_pressure(fpair, xi1, xi2, delx, dely, delz); } } @@ -356,8 +356,8 @@ void ComputeStressCartesian::compute_array() } } -void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi, double xj, - double yj, double delx, double dely, double delz) +void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi, double delx, + double dely, double delz) { int bin1, bin2, next_bin1, next_bin2; double la = 0.0, lb = 0.0, l_sum = 0.0; diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.h b/src/EXTRA-COMPUTE/compute_stress_cartesian.h index 63e33a5407..d4505a1e8e 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.h +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.h @@ -41,7 +41,7 @@ class ComputeStressCartesian : public Compute { double *dens, *pkxx, *pkyy, *pkzz, *pcxx, *pcyy, *pczz; double *tdens, *tpkxx, *tpkyy, *tpkzz, *tpcxx, *tpcyy, *tpczz; class NeighList *list; - void compute_pressure(double, double, double, double, double, double, double, double); + void compute_pressure(double, double, double, double, double, double); }; } // namespace LAMMPS_NS diff --git a/src/EXTRA-DUMP/dump_xtc.cpp b/src/EXTRA-DUMP/dump_xtc.cpp index 3c5be6b9be..8e0bb4a0d7 100644 --- a/src/EXTRA-DUMP/dump_xtc.cpp +++ b/src/EXTRA-DUMP/dump_xtc.cpp @@ -433,10 +433,10 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) return 0; } if (*type == 'w' || *type == 'W') { - type = (char *) "w+"; + type = (char *) "wb+"; lmode = XDR_ENCODE; } else { - type = (char *) "r"; + type = (char *) "rb"; lmode = XDR_DECODE; } xdrfiles[xdrid] = fopen(filename, type); diff --git a/src/KOKKOS/pair_reaxff_kokkos.cpp b/src/KOKKOS/pair_reaxff_kokkos.cpp index 7f2477adba..bb6ee0c1f1 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.cpp +++ b/src/KOKKOS/pair_reaxff_kokkos.cpp @@ -2628,7 +2628,7 @@ int PairReaxFFKokkos::preprocess_angular(int i, int itype, int j_sta template template KOKKOS_INLINE_FUNCTION -int PairReaxFFKokkos::preprocess_torsion(int i, int /*itype*/, int itag, +int PairReaxFFKokkos::preprocess_torsion(int i, int /*itype*/, tagint itag, F_FLOAT xtmp, F_FLOAT ytmp, F_FLOAT ztmp, int j_start, int j_end, int location_torsion) const { // in reaxff_torsion_angles: j = i, k = j, i = k; diff --git a/src/KOKKOS/pair_reaxff_kokkos.h b/src/KOKKOS/pair_reaxff_kokkos.h index 39b323a0fe..836a2de731 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.h +++ b/src/KOKKOS/pair_reaxff_kokkos.h @@ -257,7 +257,7 @@ class PairReaxFFKokkos : public PairReaxFF { // Abstraction for counting and populating torsion intermediated template KOKKOS_INLINE_FUNCTION - int preprocess_torsion(int, int, int, F_FLOAT, F_FLOAT, F_FLOAT, int, int, int) const; + int preprocess_torsion(int, int, tagint, F_FLOAT, F_FLOAT, F_FLOAT, int, int, int) const; template KOKKOS_INLINE_FUNCTION diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index 0adabe5eae..0a20e7adf3 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -273,7 +273,7 @@ void FixWidom::init() triclinic = domain->triclinic; - ave_widom_chemical_potential = 0; + ave_widom_chemical_potential = 0.0; if (region) volume = region_volume; else volume = domain->xprd * domain->yprd * domain->zprd; diff --git a/src/fmt/core.h b/src/fmt/core.h index 8444cd9546..2fafa777ba 100644 --- a/src/fmt/core.h +++ b/src/fmt/core.h @@ -315,7 +315,9 @@ // Enable minimal optimizations for more compact code in debug mode. FMT_GCC_PRAGMA("GCC push_options") -#ifndef __OPTIMIZE__ +// LAMMPS CUSTOMIZATION: suppress warning about pragma with KOKKOS +#if !defined(__OPTIMIZE__) && !defined(LMP_KOKKOS) +// END LAMMPS CUSTOMIZATION FMT_GCC_PRAGMA("GCC optimize(\"Og\")") #endif diff --git a/tools/singularity/README.md b/tools/singularity/README.md index db7aa9e3b0..4700dac6ec 100644 --- a/tools/singularity/README.md +++ b/tools/singularity/README.md @@ -1,17 +1,19 @@ -# Singularity container definitions for compiling/testing LAMMPS +# Apptainer (aka Singularity) container definitions for compiling/testing LAMMPS The *.def files in this folder can be used to build container images -for [Singularity](https://sylabs.io), suitable for compiling and testing +for [Apptainer](https://apptainer.org) (previously called +[Singularity](https://sylabs.io)), suitable for compiling and testing LAMMPS on a variety of OS variants with support for most standard packages and - for some of them - also building/spellchecking the manual -in all supported formats. This allows to test and debug LAMMPS code on +in all supported formats. This allows to test and debug LAMMPS code on different OS variants without doing a full installation on your development workstation, e.g. when bugs are reported that can only be reproduced on a specific OS or with specific (mostly older) versions of tools, compilers, or libraries. Here is a workflow for testing a compilation of LAMMPS with a locally -built CentOS 7.x singularity container. +built CentOS 7.x Singularity container. For Apptainer replace the +`singularity` command with `apptainer`. ``` cd some/work/directory diff --git a/tools/singularity/ubuntu18.04_amd_rocm.def b/tools/singularity/ubuntu18.04_amd_rocm.def index ceedfd8144..febdf1172e 100644 --- a/tools/singularity/ubuntu18.04_amd_rocm.def +++ b/tools/singularity/ubuntu18.04_amd_rocm.def @@ -3,7 +3,7 @@ From: ubuntu:18.04 %environment export PATH=/usr/lib/ccache:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm-5.1.2/llvm/lib + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm-5.1.3/llvm/lib %post export DEBIAN_FRONTEND=noninteractive apt-get update @@ -22,10 +22,10 @@ From: ubuntu:18.04 apt install -y cmake ########################################################################### - # ROCm 5.1.2 + # ROCm 5.1.3 ########################################################################### - wget https://repo.radeon.com/amdgpu-install/22.10.2/ubuntu/bionic/amdgpu-install_22.10.2.50102-1_all.deb - apt-get install -y ./amdgpu-install_22.10.2.50102-1_all.deb + wget https://repo.radeon.com/amdgpu-install/22.10.3/ubuntu/bionic/amdgpu-install_22.10.3.50103-1_all.deb + apt-get install -y ./amdgpu-install_22.10.3.50103-1_all.deb apt-get update apt-get install --no-install-recommends -y \ diff --git a/tools/singularity/ubuntu18.04_gpu.def b/tools/singularity/ubuntu18.04_gpu.def index 6aa37ccf84..90034285ff 100644 --- a/tools/singularity/ubuntu18.04_gpu.def +++ b/tools/singularity/ubuntu18.04_gpu.def @@ -2,11 +2,11 @@ BootStrap: docker From: ubuntu:18.04 %environment - export PATH=/usr/lib/ccache:/usr/local/cuda-11.5/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 - export CUDADIR=/usr/local/cuda-11.5 - export CUDA_PATH=/usr/local/cuda-11.5 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.5/lib64:/opt/rocm/lib:/opt/rocm-4.5.0/llvm/lib - export LIBRARY_PATH=/usr/local/cuda-11.5/lib64/stubs + export PATH=/usr/lib/ccache:/usr/local/cuda-11.7/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 + export CUDADIR=/usr/local/cuda-11.7 + export CUDA_PATH=/usr/local/cuda-11.7 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.7/lib64:/opt/rocm/lib:/opt/rocm-5.1.3/llvm/lib + export LIBRARY_PATH=/usr/local/cuda-11.7/lib64/stubs %post export DEBIAN_FRONTEND=noninteractive apt-get update @@ -27,8 +27,8 @@ From: ubuntu:18.04 ########################################################################### # ROCm 4.5 ########################################################################### - wget https://repo.radeon.com/amdgpu-install/21.40/ubuntu/focal/amdgpu-install-21.40.40500-1_all.deb - apt-get install -y ./amdgpu-install-21.40.40500-1_all.deb + wget https://repo.radeon.com/amdgpu-install/22.10.3/ubuntu/focal/amdgpu-install_22.10.3.50103-1_all.deb + apt-get install -y ./amdgpu-install_22.10.3.50103-1_all.deb apt-get update apt-get install --no-install-recommends -y \ @@ -122,11 +122,11 @@ From: ubuntu:18.04 wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 - apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub + apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" apt-get update - export CUDA_PKG_VERSION=11.5 + export CUDA_PKG_VERSION=11.7 apt-get install -y --no-install-recommends \ cuda-libraries-${CUDA_PKG_VERSION} \ diff --git a/tools/singularity/ubuntu20.04_amd_rocm.def b/tools/singularity/ubuntu20.04_amd_rocm.def index 5e351e49a8..6034014370 100644 --- a/tools/singularity/ubuntu20.04_amd_rocm.def +++ b/tools/singularity/ubuntu20.04_amd_rocm.def @@ -3,7 +3,7 @@ From: ubuntu:20.04 %environment export PATH=/usr/lib/ccache:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm-5.1.2/llvm/lib + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm-5.1.3/llvm/lib %post export DEBIAN_FRONTEND=noninteractive apt-get update @@ -13,10 +13,10 @@ From: ubuntu:20.04 apt-get install --no-install-recommends -y software-properties-common ########################################################################### - # ROCm 5.1.2 + # ROCm 5.1.3 ########################################################################### - wget https://repo.radeon.com/amdgpu-install/22.10.2/ubuntu/focal/amdgpu-install_22.10.2.50102-1_all.deb - apt-get install -y ./amdgpu-install_22.10.2.50102-1_all.deb + wget https://repo.radeon.com/amdgpu-install/22.10.3/ubuntu/focal/amdgpu-install_22.10.3.50103-1_all.deb + apt-get install -y ./amdgpu-install_22.10.3.50103-1_all.deb apt-get update apt-get install --no-install-recommends -y \ diff --git a/tools/singularity/ubuntu20.04_gpu.def b/tools/singularity/ubuntu20.04_gpu.def index 23bddeb14f..f7bab1ee9d 100644 --- a/tools/singularity/ubuntu20.04_gpu.def +++ b/tools/singularity/ubuntu20.04_gpu.def @@ -2,11 +2,11 @@ BootStrap: docker From: ubuntu:20.04 %environment - export PATH=/usr/lib/ccache:/usr/local/cuda-11.5/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 - export CUDADIR=/usr/local/cuda-11.5 - export CUDA_PATH=/usr/local/cuda-11.5 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.5/lib64:/opt/rocm/lib:/opt/rocm-4.5.0/llvm/lib - export LIBRARY_PATH=/usr/local/cuda-11.5/lib64/stubs + export PATH=/usr/lib/ccache:/usr/local/cuda-11.7/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 + export CUDADIR=/usr/local/cuda-11.7 + export CUDA_PATH=/usr/local/cuda-11.7 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.7/lib64:/opt/rocm/lib:/opt/rocm-5.1.3/llvm/lib + export LIBRARY_PATH=/usr/local/cuda-11.7/lib64/stubs %post export DEBIAN_FRONTEND=noninteractive apt-get update @@ -15,10 +15,10 @@ From: ubuntu:20.04 apt-get install -y --no-install-recommends curl wget libnuma-dev gnupg ca-certificates ########################################################################### - # ROCm 4.5 + # ROCm 5.1.3 ########################################################################### - wget https://repo.radeon.com/amdgpu-install/21.40/ubuntu/focal/amdgpu-install-21.40.40500-1_all.deb - apt-get install -y ./amdgpu-install-21.40.40500-1_all.deb + wget https://repo.radeon.com/amdgpu-install/22.10.3/ubuntu/focal/amdgpu-install_22.10.3.50103-1_all.deb + apt-get install -y ./amdgpu-install_22.10.3.50103-1_all.deb apt-get update apt-get install --no-install-recommends -y \ @@ -109,7 +109,7 @@ From: ubuntu:20.04 wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 - apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub + apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" apt-get update diff --git a/tools/valgrind/OpenMP.supp b/tools/valgrind/OpenMP.supp index e1870e668c..15531fa8ec 100644 --- a/tools/valgrind/OpenMP.supp +++ b/tools/valgrind/OpenMP.supp @@ -134,3 +134,31 @@ fun:GOMP_parallel obj:* } +{ + OpnMP_open_part1 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + ... + fun:openaux + ... + fun:dl_open_worker_begin + ... + fun:dl_open_worker + ... + fun:_dl_open +} +{ + OpnMP_open_part2 + Memcheck:Leak + match-leak-kinds: reachable + fun:calloc + ... + fun:openaux + ... + fun:dl_open_worker_begin + ... + fun:dl_open_worker + ... + fun:_dl_open +} diff --git a/unittest/force-styles/tests/atomic-pair-sw_angle_table.yaml b/unittest/force-styles/tests/atomic-pair-sw_angle_table.yaml index b8eae7848b..7229a3cd26 100644 --- a/unittest/force-styles/tests/atomic-pair-sw_angle_table.yaml +++ b/unittest/force-styles/tests/atomic-pair-sw_angle_table.yaml @@ -1,6 +1,5 @@ --- lammps_version: 4 May 2022 -tags: generated date_generated: Wed Jun 1 15:17:22 2022 epsilon: 1e-12 skip_tests: single diff --git a/unittest/force-styles/tests/atomic-pair-threebody_table.yaml b/unittest/force-styles/tests/atomic-pair-threebody_table.yaml index 605f18a9a6..bb3c8c1c1b 100644 --- a/unittest/force-styles/tests/atomic-pair-threebody_table.yaml +++ b/unittest/force-styles/tests/atomic-pair-threebody_table.yaml @@ -1,6 +1,5 @@ --- lammps_version: 4 May 2022 -tags: generated date_generated: Wed Jun 1 15:28:13 2022 epsilon: 1e-05 skip_tests: single diff --git a/unittest/force-styles/tests/manybody-pair-pace_product.yaml b/unittest/force-styles/tests/manybody-pair-pace_product.yaml index 9aac9ddcae..1e82029777 100644 --- a/unittest/force-styles/tests/manybody-pair-pace_product.yaml +++ b/unittest/force-styles/tests/manybody-pair-pace_product.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:48 2022 -epsilon: 5e-13 +epsilon: 1e-12 skip_tests: prerequisites: ! | pair pace diff --git a/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml b/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml index eef7509606..f20440c85d 100644 --- a/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml +++ b/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Wed Apr 7 19:30:07 2021 -epsilon: 5e-13 +epsilon: 1e-12 prerequisites: ! | pair pace pre_commands: ! |