diff --git a/.gitattributes b/.gitattributes index f81d32a235..77eb7f93f3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ .github export-ignore .lgtm.yml export-ignore SECURITY.md export-ignore +CITATION.cff export-ignore * text=auto *.jpg -text *.pdf -text diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ba702784f4..4e8803fc5a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,20 +13,21 @@ lib/kim/* @ellio167 lib/mesont/* @iafoss # whole packages +src/AMOEBA/* @sjplimp src/COMPRESS/* @rbberger src/GPU/* @ndtrung81 src/KOKKOS/* @stanmoore1 src/KIM/* @ellio167 src/LATTE/* @cnegre -src/MESSAGE/* @sjplimp src/MLIAP/* @athomps src/SNAP/* @athomps src/SPIN/* @julient31 src/BROWNIAN/* @samueljmcameron src/CG-DNA/* @ohenrich -src/CG-SDK/* @akohlmey +src/CG-SPICA/* @yskmiyazaki src/COLVARS/* @giacomofiorin src/DIELECTRIC/* @ndtrung81 +src/ELECTRODE/* @ludwig-ahrens src/FEP/* @agiliopadua src/ML-HDNNP/* @singraber src/INTEL/* @wmbrownintel @@ -133,6 +134,7 @@ tools/coding_standard/* @rbberger tools/valgrind/* @akohlmey tools/swig/* @akohlmey tools/offline/* @rbberger +tools/vim/* @hammondkd # tests unittest/* @akohlmey @rbberger diff --git a/.github/codecov.yml b/.github/codecov.yml index 4645f52f7f..3c4ff888a4 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -7,7 +7,7 @@ coverage: threshold: 10% only_pulls: false branches: - - "master" + - "develop" flags: - "unit" paths: @@ -16,14 +16,14 @@ coverage: project: default: branches: - - "master" + - "develop" paths: - "src" informational: true patch: default: branches: - - "master" + - "develop" paths: - "src" informational: true diff --git a/.github/workflows/compile-msvc.yml b/.github/workflows/compile-msvc.yml index 7747be7b46..216f465568 100644 --- a/.github/workflows/compile-msvc.yml +++ b/.github/workflows/compile-msvc.yml @@ -3,7 +3,9 @@ name: "Native Windows Compilation and Unit Tests" on: push: - branches: [develop] + branches: [ develop ] + pull_request: + branches: [ $default-branch ] workflow_dispatch: diff --git a/.github/workflows/unittest-macos.yml b/.github/workflows/unittest-macos.yml index e6e5ccfdc8..4c7f1316c4 100644 --- a/.github/workflows/unittest-macos.yml +++ b/.github/workflows/unittest-macos.yml @@ -3,7 +3,9 @@ name: "Unittest for MacOS" on: push: - branches: [develop] + branches: [ develop ] + pull_request: + branches: [ $default-branch ] workflow_dispatch: diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000000..a8712ddcf2 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,91 @@ +# YAML 1.2 +--- +cff-version: 1.2.0 +title: "LAMMPS: Large-scale Atomic/Molecular Massively Parallel Simulator" +type: software +authors: + - family-names: "Plimpton" + given-names: "Steven J." + - family-names: "Kohlmeyer" + given-names: "Axel" + orcid: "https://orcid.org/0000-0001-6204-6475" + - family-names: "Thompson" + given-names: "Aidan P." + orcid: "https://orcid.org/0000-0002-0324-9114" + - family-names: "Moore" + given-names: "Stan G." + - family-names: "Berger" + given-names: "Richard" + orcid: "https://orcid.org/0000-0002-3044-8266" +doi: 10.5281/zenodo.3726416 +license: GPL-2.0-only +url: https://www.lammps.org +repository-code: https://github.com/lammps/lammps/ +keywords: + - "Molecular Dynamics" + - "Materials Modeling" +message: "If you are referencing LAMMPS in a publication, please cite the paper below." +preferred-citation: + type: article + doi: "10.1016/j.cpc.2021.108171" + url: "https://www.sciencedirect.com/science/article/pii/S0010465521002836" + authors: + - family-names: "Thompson" + given-names: "Aidan P." + orcid: "https://orcid.org/0000-0002-0324-9114" + - family-names: "Aktulga" + given-names: "H. Metin" + - family-names: "Berger" + given-names: "Richard" + orcid: "https://orcid.org/0000-0002-3044-8266" + - family-names: "Bolintineanu" + given-names: "Dan S." + - family-names: "Brown" + given-names: "W. Michael" + - family-names: "Crozier" + given-names: "Paul S." + - family-names: "in 't Veld" + given-names: "Pieter J." + - family-names: "Kohlmeyer" + given-names: "Axel" + orcid: "https://orcid.org/0000-0001-6204-6475" + - family-names: "Moore" + given-names: "Stan G." + - family-names: "Nguyen" + given-names: "Trung Dac" + - family-names: "Shan" + given-names: "Ray" + - family-names: "Stevens" + given-names: "Mark J." + - family-names: "Tranchida" + given-names: "Julien" + - family-names: "Trott" + given-names: "Christian" + - family-names: "Plimpton" + given-names: "Steven J." + title: "LAMMPS - a flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales" + journal: "Computer Physics Communications" + keywords: + - Molecular dynamics + - Materials modeling + - Parallel algorithms + - LAMMPS + month: 2 + volume: 271 + issn: 0010-4655 + pages: 108171 + year: 2022 +references: + - title: "Fast Parallel Algorithms for Short-Range Molecular Dynamics" + type: article + journal: Journal of Computational Physics + volume: 117 + number: 1 + pages: "1-19" + year: 1995 + issn: 0021-9991 + doi: 10.1006/jcph.1995.1039 + url: https://www.sciencedirect.com/science/article/pii/S002199918571039X + authors: + - family-names: "Plimpton" + given-names: "Steve" diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 669bff1533..aaa0885072 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -135,13 +135,11 @@ 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) - if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")) add_compile_options(/Zc:__cplusplus) add_compile_options(/wd4244) add_compile_options(/wd4267) - if(LAMMPS_EXCEPTIONS) - add_compile_options(/EHsc) - endif() + add_compile_options(/EHsc) endif() add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() @@ -154,6 +152,19 @@ endif() ######################################################################## # User input options # ######################################################################## +# set path to python interpreter and thus enforcing python version if +# when in a virtual environment and PYTHON_EXECUTABLE is not set on command line +if(DEFINED ENV{VIRTUAL_ENV} AND NOT PYTHON_EXECUTABLE) + if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + set(PYTHON_EXECUTABLE "$ENV{VIRTUAL_ENV}/Scripts/python.exe") + else() + set(PYTHON_EXECUTABLE "$ENV{VIRTUAL_ENV}/bin/python") + endif() + set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}") + message(STATUS "Running in virtual environment: $ENV{VIRTUAL_ENV}\n" + " Setting Python interpreter to: ${PYTHON_EXECUTABLE}") +endif() + set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically") mark_as_advanced(LAMMPS_MACHINE) if(LAMMPS_MACHINE) @@ -404,9 +415,11 @@ endif() if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE OR PKG_ELECTRODE) enable_language(C) - find_package(LAPACK) - find_package(BLAS) - if(NOT LAPACK_FOUND OR NOT BLAS_FOUND) + if (NOT USE_INTERNAL_LINALG) + find_package(LAPACK) + find_package(BLAS) + endif() + if(NOT LAPACK_FOUND OR NOT BLAS_FOUND OR USE_INTERNAL_LINALG) include(CheckGeneratorSupport) if(NOT CMAKE_GENERATOR_SUPPORT_FORTRAN) status(FATAL_ERROR "Cannot build internal linear algebra library as CMake build tool lacks Fortran support") @@ -635,7 +648,7 @@ endif() # packages which selectively include variants based on enabled styles # e.g. accelerator packages ###################################################################### -foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH PHONON QEQ OPENMP KOKKOS OPT INTEL GPU) +foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MISC PHONON QEQ OPENMP KOKKOS OPT INTEL GPU) if(PKG_${PKG_WITH_INCL}) include(Packages/${PKG_WITH_INCL}) endif() @@ -782,9 +795,13 @@ if(BUILD_SHARED_LIBS) set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6) find_package(PythonInterp) # Deprecated since version 3.12 if(PYTHONINTERP_FOUND) - set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) endif() else() + # backward compatibility + if(PYTHON_EXECUTABLE) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + endif() find_package(Python COMPONENTS Interpreter) endif() if(BUILD_IS_MULTI_CONFIG) @@ -817,11 +834,17 @@ endif() ############################################################################### if(BUILD_SHARED_LIBS OR PKG_PYTHON) if(CMAKE_VERSION VERSION_LESS 3.12) + # adjust so we find Python 3 versions before Python 2 on old systems with old CMake + set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6) find_package(PythonInterp) # Deprecated since version 3.12 if(PYTHONINTERP_FOUND) - set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) endif() else() + # backward compatibility + if(PYTHON_EXECUTABLE) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + endif() find_package(Python COMPONENTS Interpreter) endif() if(Python_EXECUTABLE) diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 75569aa55d..243b5111de 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -233,7 +233,8 @@ elseif(GPU_API STREQUAL "OPENCL") elseif(GPU_API STREQUAL "HIP") if(NOT DEFINED HIP_PATH) if(NOT DEFINED ENV{HIP_PATH}) - set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to HIP installation") + message(FATAL_ERROR "GPU_API=HIP requires HIP_PATH to be defined.\n" + "Either pass the HIP_PATH as a CMake option via -DHIP_PATH=... or set the HIP_PATH environment variable.") else() set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to HIP installation") endif() @@ -261,6 +262,8 @@ elseif(GPU_API STREQUAL "HIP") if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd") set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture") + elseif(HIP_PLATFORM STREQUAL "spirv") + set(HIP_ARCH "spirv" CACHE STRING "HIP target architecture") elseif(HIP_PLATFORM STREQUAL "nvcc") find_package(CUDA REQUIRED) set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)") @@ -340,7 +343,14 @@ elseif(GPU_API STREQUAL "HIP") VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE} DEPENDS ${CU_FILE} COMMENT "Generating ${CU_NAME}.cubin") - endif() + elseif(HIP_PLATFORM STREQUAL "spirv") + configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY) + + add_custom_command(OUTPUT ${CUBIN_FILE} + VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} -c -O3 -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_CPP_FILE} + DEPENDS ${CU_CPP_FILE} + COMMENT "Gerating ${CU_NAME}.cubin") + endif() add_custom_command(OUTPUT ${CUBIN_H_FILE} COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -D VARNAME=${CU_NAME} -D HEADER_FILE=${CUBIN_H_FILE} -D SOURCE_FILE=${CUBIN_FILE} -P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/GenerateBinaryHeader.cmake diff --git a/cmake/Modules/Packages/LATTE.cmake b/cmake/Modules/Packages/LATTE.cmake index a96e850f7e..d7793fa257 100644 --- a/cmake/Modules/Packages/LATTE.cmake +++ b/cmake/Modules/Packages/LATTE.cmake @@ -23,8 +23,9 @@ if(DOWNLOAD_LATTE) # CMake cannot pass BLAS or LAPACK library variable to external project if they are a list list(LENGTH BLAS_LIBRARIES} NUM_BLAS) list(LENGTH LAPACK_LIBRARIES NUM_LAPACK) - if((NUM_BLAS GREATER 1) OR (NUM_LAPACK GREATER 1)) - message(FATAL_ERROR "Cannot compile downloaded LATTE library due to a technical limitation") + if((NUM_BLAS GREATER 1) OR (NUM_LAPACK GREATER 1) AND NOT USE_INTERNAL_LINALG) + message(FATAL_ERROR "Cannot compile downloaded LATTE library due to a technical limitation. " + "Try to configure LAMMPS with '-D USE_INTERNAL_LINALG=on' added as a workaround.") endif() include(ExternalProject) diff --git a/cmake/Modules/Packages/MDI.cmake b/cmake/Modules/Packages/MDI.cmake index 1a14d5273a..d873c8f6d1 100644 --- a/cmake/Modules/Packages/MDI.cmake +++ b/cmake/Modules/Packages/MDI.cmake @@ -26,8 +26,21 @@ if(DOWNLOAD_MDI) # detect if we have python development support and thus can enable python plugins set(MDI_USE_PYTHON_PLUGINS OFF) if(CMAKE_VERSION VERSION_LESS 3.12) + if(NOT PYTHON_VERSION_STRING) + set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6) + # search for interpreter first, so we have a consistent library + find_package(PythonInterp) # Deprecated since version 3.12 + if(PYTHONINTERP_FOUND) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + endif() + endif() + # search for the library matching the selected interpreter + set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) find_package(PythonLibs QUIET) # Deprecated since version 3.12 if(PYTHONLIBS_FOUND) + if(NOT (PYTHON_VERSION_STRING STREQUAL PYTHONLIBS_VERSION_STRING)) + message(FATAL_ERROR "Python Library version ${PYTHONLIBS_VERSION_STRING} does not match Interpreter version ${PYTHON_VERSION_STRING}") + endif() set(MDI_USE_PYTHON_PLUGINS ON) endif() else() diff --git a/cmake/Modules/Packages/MISC.cmake b/cmake/Modules/Packages/MISC.cmake new file mode 100644 index 0000000000..38207835a0 --- /dev/null +++ b/cmake/Modules/Packages/MISC.cmake @@ -0,0 +1,13 @@ +# pair style and fix srp/react depend on the fixes bond/break and bond/create from the MC package +if(NOT PKG_MC) + get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX) + list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/MISC/fix_srp_react.h) + set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}") + get_property(LAMMPS_PAIR_HEADERS GLOBAL PROPERTY PAIR) + list(REMOVE_ITEM LAMMPS_PAIR_HEADERS ${LAMMPS_SOURCE_DIR}/MISC/pair_srp_react.h) + set_property(GLOBAL PROPERTY PAIR "${LAMMPS_PAIR_HEADERS}") + get_target_property(LAMMPS_SOURCES lammps SOURCES) + list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MISC/fix_srp_react.cpp) + list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MISC/pair_srp_react.cpp) + set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}") +endif() diff --git a/cmake/Modules/Packages/PYTHON.cmake b/cmake/Modules/Packages/PYTHON.cmake index c94db88073..4a2925fe31 100644 --- a/cmake/Modules/Packages/PYTHON.cmake +++ b/cmake/Modules/Packages/PYTHON.cmake @@ -1,8 +1,28 @@ if(CMAKE_VERSION VERSION_LESS 3.12) + if(NOT PYTHON_VERSION_STRING) + set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6) + # search for interpreter first, so we have a consistent library + find_package(PythonInterp) # Deprecated since version 3.12 + if(PYTHONINTERP_FOUND) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + endif() + endif() + # search for the library matching the selected interpreter + set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) find_package(PythonLibs REQUIRED) # Deprecated since version 3.12 + if(NOT (PYTHON_VERSION_STRING STREQUAL PYTHONLIBS_VERSION_STRING)) + message(FATAL_ERROR "Python Library version ${PYTHONLIBS_VERSION_STRING} does not match Interpreter version ${PYTHON_VERSION_STRING}") + endif() target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS}) target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES}) else() + if(NOT Python_INTERPRETER) + # backward compatibility + if(PYTHON_EXECUTABLE) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + endif() + find_package(Python COMPONENTS Interpreter) + endif() find_package(Python REQUIRED COMPONENTS Interpreter Development) target_link_libraries(lammps PRIVATE Python::Python) endif() diff --git a/doc/Makefile b/doc/Makefile index 8841ae4825..4bbc252fb6 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -242,7 +242,6 @@ $(MATHJAX): $(ANCHORCHECK): $(VENV) @( \ . $(VENV)/bin/activate; \ - (cd utils/converters;\ - python setup.py develop);\ + pip $(PIP_OPTIONS) install -e utils/converters;\ deactivate;\ ) diff --git a/doc/lammps.1 b/doc/lammps.1 index 5f1c25867e..f1a3d0f2f9 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,7 +1,7 @@ -.TH LAMMPS "1" "23 June 2022" "2022-6-23" +.TH LAMMPS "1" "3 August 2022" "2022-8-3" .SH NAME .B LAMMPS -\- Molecular Dynamics Simulator. Version 23 June 2022 +\- Molecular Dynamics Simulator. Version 3 August 2022 .SH SYNOPSIS .B lmp @@ -161,7 +161,7 @@ list references for specific cite-able features used during a run. .TP \fB\-pk