diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f99a336dbb..1b4cae3aaa 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -61,6 +61,7 @@ src/GPU/pair_vashishta_gpu.* @andeplane src/KOKKOS/pair_vashishta_kokkos.* @andeplane src/MANYBODY/pair_vashishta_table.* @andeplane src/MANYBODY/pair_atm.* @sergeylishchuk +src/MANYBODY/pair_nb3b_screened.* @flodesani src/REPLICA/*_grem.* @dstelter92 src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel src/EXTRA-COMPUTE/compute_born_matrix.* @Bibobu @athomps @@ -135,6 +136,7 @@ src/timer.* @akohlmey src/utils.* @akohlmey @rbberger src/verlet.* @sjplimp @stanmoore1 src/math_eigen_impl.h @jewettaij +src/fix_press_langevin.* @Bibobu # tools tools/coding_standard/* @akohlmey @rbberger @@ -151,12 +153,12 @@ tools/vim/* @hammondkd unittest/* @akohlmey # cmake -cmake/* @rbberger +cmake/* @akohlmey cmake/Modules/LAMMPSInterfacePlugin.cmake @akohlmey cmake/Modules/MPI4WIN.cmake @akohlmey cmake/Modules/OpenCLLoader.cmake @akohlmey -cmake/Modules/Packages/COLVARS.cmake @rbberger @giacomofiorin -cmake/Modules/Packages/KIM.cmake @rbberger @ellio167 +cmake/Modules/Packages/COLVARS.cmake @giacomofiorin +cmake/Modules/Packages/KIM.cmake @ellio167 cmake/presets/*.cmake @akohlmey # python diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c7abfebf3a..891d1ad5e5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -5,9 +5,9 @@ Thank you for considering to contribute to the LAMMPS software project. The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project. Thus please also have a look at: -* [The guide for submitting new features in the LAMMPS manual](https://www.lammps.org/doc/Modify_contribute.html) -* [The guide on programming style and requirement in the LAMMPS manual](https://www.lammps.org/doc/Modify_style.html) -* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html) +* [The guide for submitting new features in the LAMMPS manual](https://docs.lammps.org/Modify_contribute.html) +* [The guide on programming style and requirement in the LAMMPS manual](https://docs.lammps.org/Modify_requirements.html) +* [The GitHub tutorial in the LAMMPS manual](http://docs.lammps.org/Howto_github.html) ## Table of Contents @@ -27,17 +27,17 @@ __ ## I don't want to read this whole thing I just have a question! -> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to either the ['lammps-users' mailing list](https://lammps.sandia.gov/mail.html) or the [LAMMPS Material Science Discourse forum](https://matsci.org/lammps). You do not need to be subscribed to post to the list (but a mailing list subscription avoids having your post delayed until it is approved by a mailing list moderator). Most posts to the mailing list receive a response within less than 24 hours. Before posting to the mailing list, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html). Following those guidelines will help greatly to get a helpful response. Always mention which LAMMPS version you are using. The LAMMPS forum was recently created as part of a larger effort to build a materials science community and have discussions not just about using LAMMPS. Thus the forum may be also used for discussions that would be off-topic for the mailing list. Those will just have to be posted to a more general category. +> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to the [LAMMPS Material Science Discourse forum](https://matsci.org/lammps). Before posting to the forum, please read the general [guidelines](https://www.lammps.org/guidelines.html) and the forum specific [suggestions](https://matsci.org/t/please-read-this-first-guidelines-and-suggestions-for-posting-lammps-questions/49913). Following those guidelines and suggestions will help greatly to get a helpful response. *Always* mention which LAMMPS version you are using. The MatSci website may be also used for discussions that would be off-topic for the LAMMPS categories. Those will just have to be posted to a different category. ## How Can I Contribute? There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list or the forum, you can report bugs or suggest enhancements by creating issues on GitHub (or posting them to the lammps-users mailing list or posting in the LAMMPS Materials Science Discourse forum), and you can contribute by submitting pull requests on GitHub or e-mail your code -to one of the [LAMMPS core developers](https://lammps.sandia.gov/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers. +to one of the [LAMMPS core developers](https://www.lammps.org/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers. ### Discussing How To Use LAMMPS The LAMMPS mailing list is hosted at SourceForge. The mailing list began in 2005, and now includes tens of thousands of messages in thousands of threads. LAMMPS developers try to respond to posted questions in a timely manner, but there are no guarantees. Please consider that people live in different timezone and may not have time to answer e-mails outside of their work hours. -You can post to list by sending your email to lammps-users at lists.sourceforge.net (no subscription required), but before posting, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html) to maximize your chances to receive a helpful response. +You can post to list by sending your email to lammps-users at lists.sourceforge.net (no subscription required), but before posting, please read the [mailing list guidelines](https://www.lammps.org/guidelines.html) to maximize your chances to receive a helpful response. Anyone can browse/search previous questions/answers in the archives. You do not have to subscribe to the list to post questions, receive answers (to your questions), or browse/search the archives. You **do** need to subscribe to the list if you want emails for **all** the posts (as individual messages or in digest form), or to answer questions yourself. Feel free to sign up and help us out! Answering questions from fellow LAMMPS users is a great way to pay back the community for providing you a useful tool for free, and to pass on the advice you have received yourself to others. It improves your karma and helps you understand your own research better. @@ -47,7 +47,7 @@ The LAMMPS Materials Science Discourse forum was created recently to facilitate ### Reporting Bugs -While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://lammps.sandia.gov/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version. +While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://www.lammps.org/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version. When you click on the green "New Issue" button, you will be provided with a text field, where you can enter your message. That text field with contain a template with several headlines and some descriptions. Keep the headlines that are relevant to your reported potential bug and replace the descriptions with the information as suggested by the descriptions. You can also attach small text files (please add the file name extension `.txt` or it will be rejected), images, or small compressed text files (using gzip, do not use RAR or 7-ZIP or similar tools that are uncommon outside of Windows machines). In many cases, bugs are best illustrated by providing a small input deck (do **not** attach your entire production input, but remove everything that is not required to reproduce the issue, and scale down your system size, that the resulting calculation runs fast and can be run on small desktop quickly). @@ -65,9 +65,9 @@ To be able to submit an issue on GitHub, you have to register for an account (fo We encourage users to submit new features or modifications for LAMMPS. Instructions, guidelines, requirements, and recommendations are in the following sections of the LAMMPS manual: -* [The guide for submitting new features in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html) -* [The guide on programming style and requirement in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html) -* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html) +* [The guide for submitting new features in the LAMMPS manual](https://docs.lammps.org/Modify_contribute.html) +* [The guide on programming style and requirement in the LAMMPS manual](https://docs.lammps.org/Modify_requirements.html) +* [The GitHub tutorial in the LAMMPS manual](http://docs.lammps.org/Howto_github.html) ## GitHub Workflows @@ -85,7 +85,7 @@ For bug reports, the next step is that one of the core LAMMPS developers will se ### Pull Requests Pull requests are the **only** way that changes get made to the LAMMPS distribution. So also the LAMMPS core developers will submit pull requests for their own changes and discuss them on GitHub. Thus if you submit a pull request it will be treated in a similar fashion. When you submit a pull request you may opt to submit a "Draft" pull request. That means your changes are visible and will be subject to testing, but reviewers will not be (auto-)assigned and comments will take into account that this is not complete. On the other hand, this is a perfect way to ask the LAMMPS developers for comments on non-obvious changes and get feedback and possible suggestions for improvements or recommendations about what to avoid. -Immediately after the submission, the LAMMPS continuing integration server at ci.lammps.org will download your submitted branch and perform a number of tests: it will tests whether it compiles cleanly under various conditions, it will also do a check on whether your included documentation translates cleanly and run some unit tests and other checks. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each time the pull request is updated with a push to the remote branch on GitHub. If you are unsure about what you need to change, ask a question in the discussion area of the pull request. +Immediately after the submission, the LAMMPS continuing integration server at https://ci.lammps.org will download your submitted branch and perform a number of tests: it will tests whether it compiles cleanly under various conditions, it will also do a check on whether your included documentation translates cleanly and run some unit tests and other checks. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each time the pull request is updated with a push to the remote branch on GitHub. If you are unsure about what you need to change, ask a question in the discussion area of the pull request. Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you submitted a draft pull request, this will not happen unless you mark it "ready for review". If you are not yet invited as a LAMMPS collaborator, and your contribution seems significant, you may also receive an invitation for collaboration on the LAMMPS repository. As part of the assessment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit). You may also receive comments and suggestions on the overall submission or specific details and on occasion specific requests for changes as part of the review. If permitted, also additional changes may be pushed into your pull request branch or a pull request may be filed in your LAMMPS fork on GitHub to include those changes. The LAMMPS developer may then decide to assign the pull request to another developer (e.g. when that developer is more knowledgeable about the submitted feature or enhancement or has written the modified code). It may also happen, that additional developers are requested to provide a review and approve the changes. For submissions, that may change the general behavior of LAMMPS, or where a possibility of unwanted side effects exists, additional tests may be requested by the assigned developer. diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c33628ac04..00c0e8642d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,12 +25,12 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/.github/workflows/compile-msvc.yml b/.github/workflows/compile-msvc.yml index 5ae0654ee0..1a0f1ea62f 100644 --- a/.github/workflows/compile-msvc.yml +++ b/.github/workflows/compile-msvc.yml @@ -19,12 +19,12 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 - name: Select Python version - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 7bda3a071f..00a4596cc8 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 @@ -59,16 +59,13 @@ jobs: -D BUILD_SHARED_LIBS=on \ -D LAMMPS_SIZES=SMALLBIG \ -D LAMMPS_EXCEPTIONS=off \ - -D PKG_MESSAGE=on \ - -D PKG_MPIIO=on \ -D PKG_ATC=on \ -D PKG_AWPMD=on \ - -D PKG_BOCS=on \ - -D PKG_EFF=on \ -D PKG_H5MD=on \ -D PKG_INTEL=on \ -D PKG_LATBOLTZ=on \ -D PKG_MANIFOLD=on \ + -D PKG_MDI=on \ -D PKG_MGPT=on \ -D PKG_ML-PACE=on \ -D PKG_ML-RANN=on \ @@ -77,7 +74,6 @@ jobs: -D PKG_PTM=on \ -D PKG_QTB=on \ -D PKG_SMTBQ=on \ - -D PKG_TALLY=on \ ../cmake - name: Run Coverity Scan diff --git a/.github/workflows/unittest-macos.yml b/.github/workflows/unittest-macos.yml index ea979ca94f..6970faceaa 100644 --- a/.github/workflows/unittest-macos.yml +++ b/.github/workflows/unittest-macos.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index dfa5277715..f7e9b314bd 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1,8 +1,8 @@ +# -*- CMake -*- master configuration file for building LAMMPS ######################################## # CMake build system # This file is part of LAMMPS -# Created by Christoph Junghans and Richard Berger -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.16) ######################################## # set policy to silence warnings about ignoring _ROOT but use it if(POLICY CMP0074) @@ -12,22 +12,11 @@ endif() if(POLICY CMP0075) cmake_policy(SET CMP0075 NEW) endif() -# set policy to silence warnings about missing executable permissions in -# pythonx.y-config when cross-compiling. review occasionally if it may be set to NEW -if(POLICY CMP0109) - cmake_policy(SET CMP0109 OLD) -endif() # set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW if(POLICY CMP0135) cmake_policy(SET CMP0135 OLD) endif() -######################################## -# Use CONFIGURE_DEPENDS as option for file(GLOB...) when available -if(CMAKE_VERSION VERSION_LESS 3.12) - unset(CONFIGURE_DEPENDS) -else() - set(CONFIGURE_DEPENDS CONFIGURE_DEPENDS) -endif() + ######################################## project(lammps CXX) @@ -116,7 +105,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4) set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512") else() - set(CMAKE_TUNE_DEFAULT "-xHost -fp-model fast=2 -no-prec-div -qoverride-limits -diag-disable=10441 -diag-disable=2196") + set(CMAKE_TUNE_DEFAULT "-xHost -fp-model fast=2 -no-prec-div -qoverride-limits -diag-disable=10441 -diag-disable=11074 -diag-disable=11076 -diag-disable=2196") endif() endif() endif() @@ -155,6 +144,7 @@ if(MSVC) add_compile_options(/Zc:__cplusplus) add_compile_options(/wd4244) add_compile_options(/wd4267) + add_compile_options(/wd4250) add_compile_options(/EHsc) endif() add_compile_definitions(_CRT_SECURE_NO_WARNINGS) @@ -168,17 +158,20 @@ endif() ######################################################################## # User input options # ######################################################################## -# set path to python interpreter and thus enforcing python version 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() +# backward compatibility with CMake before 3.12 and older LAMMPS documentation +if (PYTHON_EXECUTABLE) set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}") +endif() +# set path to python interpreter and thus enforcing python version 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() message(STATUS "Running in virtual environment: $ENV{VIRTUAL_ENV}\n" - " Setting Python interpreter to: ${PYTHON_EXECUTABLE}") + " Setting Python interpreter to: ${Python_EXECUTABLE}") endif() set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically") @@ -203,8 +196,8 @@ else() endif() include(GNUInstallDirs) -file(GLOB ALL_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_SOURCE_DIR}/[^.]*.cpp) -file(GLOB MAIN_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_SOURCE_DIR}/main.cpp) +file(GLOB ALL_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/[^.]*.cpp) +file(GLOB MAIN_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/main.cpp) list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES}) add_library(lammps ${ALL_SOURCES}) @@ -278,7 +271,6 @@ set(STANDARD_PACKAGES MOFFF MOLECULE MOLFILE - MPIIO NETCDF ORIENT PERI @@ -387,7 +379,6 @@ endif() # "hard" dependencies between packages resulting # in an error instead of skipping over files pkg_depends(ML-IAP ML-SNAP) -pkg_depends(MPIIO MPI) pkg_depends(ATC MANYBODY) pkg_depends(LATBOLTZ MPI) pkg_depends(SCAFACOS MPI) @@ -398,6 +389,7 @@ pkg_depends(CG-DNA MOLECULE) pkg_depends(CG-DNA ASPHERE) pkg_depends(ELECTRODE KSPACE) pkg_depends(EXTRA-MOLECULE MOLECULE) +pkg_depends(MESONT MOLECULE) # detect if we may enable OpenMP support by default set(BUILD_OMP_DEFAULT OFF) @@ -435,6 +427,18 @@ if(BUILD_OMP) target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX) endif() +# lower C++ standard for fmtlib sources when using Intel classic compiler +if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_STANDARD GREATER_EQUAL 17) + AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2021.10)) + message(STATUS "Lowering C++ standard for compiling fmtlib sources with Intel Classic compiler") + get_filename_component(LMP_UTILS_SRC "${LAMMPS_SOURCE_DIR}/utils.cpp" ABSOLUTE) + get_filename_component(LMP_VARIABLE_SRC "${LAMMPS_SOURCE_DIR}/variable.cpp" ABSOLUTE) + get_filename_component(FMT_FORMAT_SRC "${LAMMPS_SOURCE_DIR}/fmtlib_format.cpp" ABSOLUTE) + get_filename_component(FMT_OS_SRC "${LAMMPS_SOURCE_DIR}/fmtlib_os.cpp" ABSOLUTE) + set_source_files_properties("${FMT_FORMAT_SRC}" "${FMT_OS_SRC}" "${LMP_VARIABLE_SRC}" "${LMP_UTILS_SRC}" + PROPERTIES COMPILE_OPTIONS "-std=c++14") +endif() + if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_TOOLS) enable_language(C) if (NOT USE_INTERNAL_LINALG) @@ -442,7 +446,7 @@ if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_T find_package(BLAS) endif() if(NOT LAPACK_FOUND OR NOT BLAS_FOUND OR USE_INTERNAL_LINALG) - file(GLOB LINALG_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.cpp) + file(GLOB LINALG_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.cpp) add_library(linalg STATIC ${LINALG_SOURCES}) set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE}) set(BLAS_LIBRARIES "$") @@ -460,12 +464,7 @@ option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND}) if(WITH_JPEG) find_package(JPEG REQUIRED) target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG) - if(CMAKE_VERSION VERSION_LESS 3.12) - target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS}) - target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES}) - else() - target_link_libraries(lammps PRIVATE JPEG::JPEG) - endif() + target_link_libraries(lammps PRIVATE JPEG::JPEG) endif() find_package(PNG QUIET) @@ -577,8 +576,8 @@ endforeach() foreach(PKG ${STANDARD_PACKAGES}) set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) - file(GLOB ${PKG}_SOURCES ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.cpp) - file(GLOB ${PKG}_HEADERS ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.h) + file(GLOB ${PKG}_SOURCES CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.cpp) + file(GLOB ${PKG}_HEADERS CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.h) # check for package files in src directory due to old make system DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS}) @@ -594,19 +593,12 @@ foreach(PKG ${STANDARD_PACKAGES}) RegisterPackages(${${PKG}_SOURCES_DIR}) endforeach() -# packages that need defines set -foreach(PKG MPIIO) - if(PKG_${PKG}) - target_compile_definitions(lammps PRIVATE -DLMP_${PKG}) - endif() -endforeach() - # dedicated check for entire contents of accelerator packages foreach(PKG ${SUFFIX_PACKAGES}) set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) - file(GLOB ${PKG}_SOURCES ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.cpp) - file(GLOB ${PKG}_HEADERS ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.h) + file(GLOB ${PKG}_SOURCES CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.cpp) + file(GLOB ${PKG}_HEADERS CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.h) # check for package files in src directory due to old make system DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS}) @@ -620,7 +612,7 @@ endforeach() foreach(PKG_LIB POEMS ATC AWPMD H5MD) if(PKG_${PKG_LIB}) string(TOLOWER "${PKG_LIB}" PKG_LIB) - file(GLOB_RECURSE ${PKG_LIB}_SOURCES ${CONFIGURE_DEPENDS} + file(GLOB_RECURSE ${PKG_LIB}_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp) add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES}) set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE}) @@ -815,20 +807,8 @@ install( # This is primarily for people that only want to use the Python wrapper. ############################################################################### if(BUILD_SHARED_LIBS) - 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}) - endif() - else() - # backward compatibility - if(PYTHON_EXECUTABLE) - set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) - endif() - find_package(Python COMPONENTS Interpreter) - endif() + # backward compatibility + find_package(Python COMPONENTS Interpreter) if(BUILD_IS_MULTI_CONFIG) set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$) else() @@ -887,13 +867,23 @@ else() endif() include(FeatureSummary) feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND) +if(GIT_FOUND AND EXISTS ${LAMMPS_DIR}/.git) + execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified --always + OUTPUT_VARIABLE GIT_DESCRIBE + ERROR_QUIET + WORKING_DIRECTORY ${LAMMPS_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() message(STATUS "<<< Build configuration >>> - LAMMPS Version: ${PROJECT_VERSION} + LAMMPS Version: ${PROJECT_VERSION} ${GIT_DESCRIBE} Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION} CMake Version: ${CMAKE_VERSION} Build type: ${LAMMPS_BUILD_TYPE} Install path: ${CMAKE_INSTALL_PREFIX} Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}") +if(CMAKE_CROSSCOMPILING) + message(STATUS "Cross compiling on ${CMAKE_HOST_SYSTEM}") +endif() ############################################################################### # Print package summary ############################################################################### @@ -937,11 +927,9 @@ if(_index GREATER -1) endif() message(STATUS "<<< Linker flags: >>>") message(STATUS "Executable name: ${LAMMPS_BINARY}") -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - get_target_property(OPTIONS lammps LINK_OPTIONS) - if(OPTIONS) - message(STATUS "Linker options: ${OPTIONS}") - endif() +get_target_property(OPTIONS lammps LINK_OPTIONS) +if(OPTIONS) + message(STATUS "Linker options: ${OPTIONS}") endif() if(CMAKE_EXE_LINKER_FLAGS) message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}") @@ -983,33 +971,53 @@ if(PKG_KOKKOS) endif() endif() if(PKG_KSPACE) - message(STATUS "<<< FFT settings >>> --- Primary FFT lib: ${FFT}") - if(FFT_SINGLE) - message(STATUS "Using single precision FFTs") - else() - message(STATUS "Using double precision FFTs") - endif() - if(FFT_FFTW_THREADS OR FFT_MKL_THREADS) - message(STATUS "Using threaded FFTs") - else() - message(STATUS "Using non-threaded FFTs") - endif() - if(PKG_KOKKOS) - if(Kokkos_ENABLE_CUDA) - if(FFT STREQUAL "KISS") - message(STATUS "Kokkos FFT: KISS") - else() - message(STATUS "Kokkos FFT: cuFFT") - endif() - elseif(Kokkos_ENABLE_HIP) - if(FFT STREQUAL "KISS") - message(STATUS "Kokkos FFT: KISS") - else() - message(STATUS "Kokkos FFT: hipFFT") - endif() + if (LMP_HEFFTE) + message(STATUS "<<< FFT settings >>> +-- Primary FFT lib: heFFTe") + if (HEFFTE_BACKEND) + message(STATUS "heFFTe backend: ${HEFFTE_BACKEND}") else() - message(STATUS "Kokkos FFT: ${FFT}") + message(STATUS "heFFTe backend: stock (builtin FFT implementation, tested for corrected but not optimized for production)") + endif() + if(FFT_SINGLE) + message(STATUS "Using single precision FFTs") + else() + message(STATUS "Using double precision FFTs") + endif() + else() + message(STATUS "<<< FFT settings >>> +-- Primary FFT lib: ${FFT}") + if(FFT_SINGLE) + message(STATUS "Using single precision FFTs") + else() + message(STATUS "Using double precision FFTs") + endif() + if(FFT_FFTW_THREADS OR FFT_MKL_THREADS) + message(STATUS "Using threaded FFTs") + else() + message(STATUS "Using non-threaded FFTs") + endif() + if (FFT_HEFFTE) + message(STATUS "Using distributed algorithms from heFTTe") + else() + message(STATUS "Using builtin distributed algorithms") + endif() + if(PKG_KOKKOS) + if(Kokkos_ENABLE_CUDA) + if(FFT STREQUAL "KISS") + message(STATUS "Kokkos FFT: KISS") + else() + message(STATUS "Kokkos FFT: cuFFT") + endif() + elseif(Kokkos_ENABLE_HIP) + if(FFT STREQUAL "KISS") + message(STATUS "Kokkos FFT: KISS") + else() + message(STATUS "Kokkos FFT: hipFFT") + endif() + else() + message(STATUS "Kokkos FFT: ${FFT}") + endif() endif() endif() endif() @@ -1022,6 +1030,14 @@ endif() if(BUILD_LAMMPS_SHELL) message(STATUS "<<< Building LAMMPS Shell >>>") endif() +if(BUILD_LAMMPS_GUI) + message(STATUS "<<< Building LAMMPS GUI >>>") + if(LAMMPS_GUI_USE_PLUGIN) + message(STATUS "Loading LAMMPS library as plugin at run time") + else() + message(STATUS "Linking LAMMPS library at compile time") + endif() +endif() if(ENABLE_TESTING) message(STATUS "<<< Building Unit Tests >>>") if(ENABLE_COVERAGE) diff --git a/cmake/Modules/CodingStandard.cmake b/cmake/Modules/CodingStandard.cmake index 4efd373d22..94639c7771 100644 --- a/cmake/Modules/CodingStandard.cmake +++ b/cmake/Modules/CodingStandard.cmake @@ -1,19 +1,11 @@ -if(CMAKE_VERSION VERSION_LESS 3.12) - find_package(PythonInterp 3.5 QUIET) # Deprecated since version 3.12 - if(PYTHONINTERP_FOUND) - set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) - set(Python3_VERSION ${PYTHON_VERSION_STRING}) - endif() -else() - # use default (or custom) Python executable, if version is sufficient - if(Python_VERSION VERSION_GREATER_EQUAL 3.5) - set(Python3_EXECUTABLE ${Python_EXECUTABLE}) - endif() - find_package(Python3 COMPONENTS Interpreter QUIET) +# use default (or custom) Python executable, if version is sufficient +if(Python_VERSION VERSION_GREATER_EQUAL 3.6) + set(Python3_EXECUTABLE ${Python_EXECUTABLE}) endif() +find_package(Python3 COMPONENTS Interpreter) if(Python3_EXECUTABLE) - if(Python3_VERSION VERSION_GREATER_EQUAL 3.5) + if(Python3_VERSION VERSION_GREATER_EQUAL 3.6) add_custom_target( check-whitespace ${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py . diff --git a/cmake/Modules/Documentation.cmake b/cmake/Modules/Documentation.cmake index 0b01407cd9..400109067f 100644 --- a/cmake/Modules/Documentation.cmake +++ b/cmake/Modules/Documentation.cmake @@ -5,24 +5,18 @@ option(BUILD_DOC "Build LAMMPS HTML documentation" OFF) if(BUILD_DOC) # Current Sphinx versions require at least Python 3.8 - if(CMAKE_VERSION VERSION_LESS 3.12) - find_package(PythonInterp 3.8 REQUIRED) - set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv) - else() - # use default (or custom) Python executable, if version is sufficient - if(Python_VERSION VERSION_GREATER_EQUAL 3.8) - set(Python3_EXECUTABLE ${Python_EXECUTABLE}) - endif() - find_package(Python3 REQUIRED COMPONENTS Interpreter) - if(Python3_VERSION VERSION_LESS 3.8) - message(FATAL_ERROR "Python 3.8 and up is required to build the HTML documentation") - endif() - set(VIRTUALENV ${Python3_EXECUTABLE} -m venv) + # use default (or custom) Python executable, if version is sufficient + if(Python_VERSION VERSION_GREATER_EQUAL 3.8) + set(Python3_EXECUTABLE ${Python_EXECUTABLE}) endif() + find_package(Python3 REQUIRED COMPONENTS Interpreter) + if(Python3_VERSION VERSION_LESS 3.8) + message(FATAL_ERROR "Python 3.8 and up is required to build the HTML documentation") + endif() + set(VIRTUALENV ${Python3_EXECUTABLE} -m venv) + find_package(Doxygen 1.8.10 REQUIRED) - - file(GLOB DOC_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_DOC_DIR}/src/[^.]*.rst) - + file(GLOB DOC_SOURCES CONFIGURE_DEPENDS ${LAMMPS_DOC_DIR}/src/[^.]*.rst) add_custom_command( OUTPUT docenv @@ -80,7 +74,7 @@ if(BUILD_DOC) message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz") endif() execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - file(GLOB MATHJAX_VERSION_DIR ${CONFIGURE_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*) + file(GLOB MATHJAX_VERSION_DIR CONFIGURE_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*) execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax) endif() diff --git a/cmake/Modules/FindClangFormat.cmake b/cmake/Modules/FindClangFormat.cmake index 80c3b0d0ae..3f0257f34f 100644 --- a/cmake/Modules/FindClangFormat.cmake +++ b/cmake/Modules/FindClangFormat.cmake @@ -1,5 +1,7 @@ # Find clang-format find_program(ClangFormat_EXECUTABLE NAMES clang-format + clang-format-17.0 + clang-format-16.0 clang-format-15.0 clang-format-14.0 clang-format-13.0 @@ -19,7 +21,7 @@ if(ClangFormat_EXECUTABLE) OUTPUT_VARIABLE clang_format_version ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(clang_format_version MATCHES "^(Ubuntu |)clang-format version .*") + if(clang_format_version MATCHES "^(Ubuntu |Debian |)clang-format version .*") # Arch Linux output: # clang-format version 10.0.0 # @@ -32,9 +34,15 @@ if(ClangFormat_EXECUTABLE) # Ubuntu 22.04 LTS output: # Ubuntu clang-format version 14.0.0-1ubuntu1 # + # Debian 11 output: + # Debian clang-format version 11.0.1-2 + # + # Debian 12 output: + # Debian clang-format version 14.0.6 + # # Fedora 36 output: # clang-format version 14.0.5 (Fedora 14.0.5-1.fc36) - string(REGEX REPLACE "^(Ubuntu |)clang-format version ([0-9.]+).*" + string(REGEX REPLACE "^(Ubuntu |Debian |)clang-format version ([0-9.]+).*" "\\2" ClangFormat_VERSION "${clang_format_version}") diff --git a/cmake/Modules/FindCythonize.cmake b/cmake/Modules/FindCythonize.cmake index 97f0304279..fe436aef28 100644 --- a/cmake/Modules/FindCythonize.cmake +++ b/cmake/Modules/FindCythonize.cmake @@ -7,15 +7,7 @@ # adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake #============================================================================= -if(CMAKE_VERSION VERSION_LESS 3.12) - set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6) - find_package(PythonInterp 3.6 QUIET) # Deprecated since version 3.12 - if(PYTHONINTERP_FOUND) - set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) - endif() -else() - find_package(Python 3.6 COMPONENTS Interpreter QUIET) -endif() +find_package(Python 3.6 COMPONENTS Interpreter QUIET) # Use the Cython executable that lives next to the Python executable # if it is a local installation. diff --git a/cmake/Modules/LAMMPSInterfacePlugin.cmake b/cmake/Modules/LAMMPSInterfacePlugin.cmake index 024dc571b3..151e0a04f7 100644 --- a/cmake/Modules/LAMMPSInterfacePlugin.cmake +++ b/cmake/Modules/LAMMPSInterfacePlugin.cmake @@ -28,6 +28,7 @@ if(MSVC) add_compile_options(/Zc:__cplusplus) add_compile_options(/wd4244) add_compile_options(/wd4267) + add_compile_options(/wd4250) add_compile_options(/EHsc) endif() add_compile_definitions(_CRT_SECURE_NO_WARNINGS) @@ -63,7 +64,7 @@ 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 ${CONFIGURE_DEPENDS} ${path}) + file(GLOB _dirs CONFIGURE_DEPENDS ${path}) set(_besttime 2000-01-01T00:00:00) set(_bestfile "") foreach(_dir ${_dirs}) diff --git a/cmake/Modules/LAMMPSUtils.cmake b/cmake/Modules/LAMMPSUtils.cmake index 1ceec7e06e..2ec9d1b706 100644 --- a/cmake/Modules/LAMMPSUtils.cmake +++ b/cmake/Modules/LAMMPSUtils.cmake @@ -41,7 +41,7 @@ endfunction() # helper function for getting the most recently modified file or folder from a glob pattern function(get_newest_file path variable) - file(GLOB _dirs ${CONFIGURE_DEPENDS} ${path}) + file(GLOB _dirs CONFIGURE_DEPENDS ${path}) set(_besttime 2000-01-01T00:00:00) set(_bestfile "") foreach(_dir ${_dirs}) @@ -80,20 +80,20 @@ endfunction() function(check_for_autogen_files source_dir) message(STATUS "Running check for auto-generated files from make-based build system") - file(GLOB SRC_AUTOGEN_FILES ${CONFIGURE_DEPENDS} ${source_dir}/style_*.h) - file(GLOB SRC_AUTOGEN_PACKAGES ${CONFIGURE_DEPENDS} ${source_dir}/packages_*.h) + file(GLOB SRC_AUTOGEN_FILES CONFIGURE_DEPENDS ${source_dir}/style_*.h) + file(GLOB SRC_AUTOGEN_PACKAGES CONFIGURE_DEPENDS ${source_dir}/packages_*.h) list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h) - list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp) + list(APPEND SRC_AUTOGEN_FILES ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp) foreach(_SRC ${SRC_AUTOGEN_FILES}) get_filename_component(FILENAME "${_SRC}" NAME) if(EXISTS ${source_dir}/${FILENAME}) message(FATAL_ERROR "\n########################################################################\n" - "Found header file(s) generated by the make-based build system\n" - "\n" - "Please run\n" - "make -C ${source_dir} purge\n" - "to remove\n" - "########################################################################") + "Found header file ${source_dir}/${FILENAME} generated by the make-based build system\n" + "\n" + "Please run\n" + "make -C ${source_dir} purge\n" + "to remove\n" + "########################################################################") endif() endforeach() endfunction() diff --git a/cmake/Modules/Packages/COLVARS.cmake b/cmake/Modules/Packages/COLVARS.cmake index 325e0e205e..745c1de026 100644 --- a/cmake/Modules/Packages/COLVARS.cmake +++ b/cmake/Modules/Packages/COLVARS.cmake @@ -1,6 +1,6 @@ set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars) -file(GLOB COLVARS_SOURCES ${CONFIGURE_DEPENDS} ${COLVARS_SOURCE_DIR}/[^.]*.cpp) +file(GLOB COLVARS_SOURCES CONFIGURE_DEPENDS ${COLVARS_SOURCE_DIR}/[^.]*.cpp) option(COLVARS_DEBUG "Enable debugging messages for Colvars (quite verbose)" OFF) diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 99321fce9f..4c3288df84 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -39,7 +39,7 @@ if (PKG_AMOEBA) ${GPU_SOURCES_DIR}/amoeba_convolution_gpu.cpp) endif() -file(GLOB GPU_LIB_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp) +file(GLOB GPU_LIB_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp) file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) if(GPU_API STREQUAL "CUDA") @@ -70,7 +70,7 @@ if(GPU_API STREQUAL "CUDA") set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)") # ensure that no *cubin.h files exist from a compile in the lib/gpu folder - file(GLOB GPU_LIB_OLD_CUBIN_HEADERS ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h) + file(GLOB GPU_LIB_OLD_CUBIN_HEADERS CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h) if(GPU_LIB_OLD_CUBIN_HEADERS) message(FATAL_ERROR "########################################################################\n" "Found file(s) generated by the make-based build system in lib/gpu\n" @@ -80,15 +80,15 @@ if(GPU_API STREQUAL "CUDA") "########################################################################") endif() - file(GLOB GPU_LIB_CU ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu) + file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu) list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu) if(CUDPP_OPT) cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini) - file(GLOB GPU_LIB_CUDPP_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp) - file(GLOB GPU_LIB_CUDPP_CU ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu) + file(GLOB GPU_LIB_CUDPP_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp) + file(GLOB GPU_LIB_CUDPP_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu) endif() # build arch/gencode commands for nvcc based on CUDA toolkit version and use choice @@ -151,10 +151,10 @@ if(GPU_API STREQUAL "CUDA") endif() cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC} - -DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES}) + -DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -allow-unsupported-compiler -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES}) cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC} - -DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES}) + -DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -allow-unsupported-compiler -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES}) foreach(CU_OBJ ${GPU_GEN_OBJS}) get_filename_component(CU_NAME ${CU_OBJ} NAME_WE) @@ -205,7 +205,7 @@ elseif(GPU_API STREQUAL "OPENCL") include(OpenCLUtils) set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h) - file(GLOB GPU_LIB_CU ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu) + file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu) list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu @@ -335,7 +335,7 @@ elseif(GPU_API STREQUAL "HIP") endif() endif() - file(GLOB GPU_LIB_CU ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu) + file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu) list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) set(GPU_LIB_CU_HIP "") diff --git a/cmake/Modules/Packages/KIM.cmake b/cmake/Modules/Packages/KIM.cmake index 995d2d9490..d724ec18fc 100644 --- a/cmake/Modules/Packages/KIM.cmake +++ b/cmake/Modules/Packages/KIM.cmake @@ -1,12 +1,7 @@ set(KIM-API_MIN_VERSION 2.1.3) find_package(CURL) if(CURL_FOUND) - if(CMAKE_VERSION VERSION_LESS 3.12) - target_include_directories(lammps PRIVATE ${CURL_INCLUDE_DIRS}) - target_link_libraries(lammps PRIVATE ${CURL_LIBRARIES}) - else() - target_link_libraries(lammps PRIVATE CURL::libcurl) - endif() + target_link_libraries(lammps PRIVATE CURL::libcurl) target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL) set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.") mark_as_advanced(LMP_DEBUG_CURL) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index 931bc0fa53..0edd9a3baa 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -50,8 +50,8 @@ if(DOWNLOAD_KOKKOS) list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") include(ExternalProject) - set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/4.1.00.tar.gz" CACHE STRING "URL for KOKKOS tarball") - set(KOKKOS_MD5 "a5f096bd8ad01b97fdc7a32583b17a33" CACHE STRING "MD5 checksum of KOKKOS tarball") + set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/4.2.00.tar.gz" CACHE STRING "URL for KOKKOS tarball") + set(KOKKOS_MD5 "731647b61a4233f568d583702e9cd6d1" CACHE STRING "MD5 checksum of KOKKOS tarball") mark_as_advanced(KOKKOS_URL) mark_as_advanced(KOKKOS_MD5) GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK) @@ -76,7 +76,7 @@ if(DOWNLOAD_KOKKOS) add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) elseif(EXTERNAL_KOKKOS) - find_package(Kokkos 4.1.00 REQUIRED CONFIG) + find_package(Kokkos 4.2.00 REQUIRED CONFIG) target_link_libraries(lammps PRIVATE Kokkos::kokkos) else() set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) @@ -156,7 +156,7 @@ if(PKG_ML-IAP) # Add KOKKOS version of ML-IAP Python coupling if non-KOKKOS version is included if(MLIAP_ENABLE_PYTHON AND Cythonize_EXECUTABLE) - file(GLOB MLIAP_KOKKOS_CYTHON_SRC ${CONFIGURE_DEPENDS} ${LAMMPS_SOURCE_DIR}/KOKKOS/*.pyx) + file(GLOB MLIAP_KOKKOS_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/KOKKOS/*.pyx) foreach(MLIAP_CYTHON_FILE ${MLIAP_KOKKOS_CYTHON_SRC}) get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE) add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h diff --git a/cmake/Modules/Packages/KSPACE.cmake b/cmake/Modules/Packages/KSPACE.cmake index de7e7e5b20..9c9c879cd4 100644 --- a/cmake/Modules/Packages/KSPACE.cmake +++ b/cmake/Modules/Packages/KSPACE.cmake @@ -46,6 +46,42 @@ else() target_compile_definitions(lammps PRIVATE -DFFT_KISS) endif() +option(FFT_USE_HEFFTE "Use heFFTe as the distributed FFT engine, overrides the FFT option." OFF) +if(FFT_USE_HEFFTE) + # if FFT_HEFFTE is enabled, switch the builtin FFT engine with Heffte + set(FFT_HEFFTE_BACKEND_VALUES FFTW MKL) + set(FFT_HEFFTE_BACKEND "" CACHE STRING "Select heFFTe backend, e.g., FFTW or MKL") + set_property(CACHE FFT_HEFFTE_BACKEND PROPERTY STRINGS ${FFT_HEFFTE_BACKEND_VALUES}) + + if(FFT_HEFFTE_BACKEND STREQUAL "FFTW") # respect the backend choice, FFTW or MKL + set(HEFFTE_COMPONENTS "FFTW") + set(Heffte_ENABLE_FFTW "ON" CACHE BOOL "Enables FFTW backend for heFFTe") + elseif(FFT_HEFFTE_BACKEND STREQUAL "MKL") + set(HEFFTE_COMPONENTS "MKL") + set(Heffte_ENABLE_MKL "ON" CACHE BOOL "Enables MKL backend for heFFTe") + else() + message(WARNING "FFT_HEFFTE_BACKEND not selected, defaulting to the builtin 'stock' backend, which is intended for testing and is not optimized for production runs") + endif() + + find_package(Heffte 2.4.0 QUIET COMPONENTS ${HEFFTE_COMPONENTS}) + if (NOT Heffte_FOUND) # download and build + include(FetchContent) + FetchContent_Declare(HEFFTE_PROJECT # using v2.4.0 + URL "https://github.com/icl-utk-edu/heffte/archive/refs/tags/v2.4.0.tar.gz" + URL_HASH SHA256=02310fb4f9688df02f7181667e61c3adb7e38baf79611d80919d47452ff7881d + ) + FetchContent_Populate(HEFFTE_PROJECT) + add_subdirectory(${heffte_project_SOURCE_DIR} ${heffte_project_BINARY_DIR}) + set_target_properties(lmp PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + set_target_properties(lammps PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + add_library(Heffte::Heffte INTERFACE IMPORTED GLOBAL) + target_link_libraries(Heffte::Heffte INTERFACE Heffte) + endif() + + target_compile_definitions(lammps PRIVATE -DFFT_HEFFTE "-DFFT_HEFFTE_${FFT_HEFFTE_BACKEND}") + target_link_libraries(lammps PRIVATE Heffte::Heffte) +endif() + set(FFT_PACK "array" CACHE STRING "Optimization for FFT") set(FFT_PACK_VALUES array pointer memcpy) set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES}) diff --git a/cmake/Modules/Packages/LEPTON.cmake b/cmake/Modules/Packages/LEPTON.cmake index 33e14d092c..b1944c2400 100644 --- a/cmake/Modules/Packages/LEPTON.cmake +++ b/cmake/Modules/Packages/LEPTON.cmake @@ -4,7 +4,7 @@ if(LEPTON_SOURCE_DIR) endif() set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton) -file(GLOB LEPTON_SOURCES ${CONFIGURE_DEPENDS} ${LEPTON_SOURCE_DIR}/src/[^.]*.cpp) +file(GLOB LEPTON_SOURCES CONFIGURE_DEPENDS ${LEPTON_SOURCE_DIR}/src/[^.]*.cpp) if((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64") OR (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") OR @@ -15,7 +15,7 @@ else() endif() if(LEPTON_ENABLE_JIT) - file(GLOB ASMJIT_SOURCES ${CONFIGURE_DEPENDS} ${LEPTON_SOURCE_DIR}/asmjit/*/[^.]*.cpp) + file(GLOB ASMJIT_SOURCES CONFIGURE_DEPENDS ${LEPTON_SOURCE_DIR}/asmjit/*/[^.]*.cpp) endif() add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES}) diff --git a/cmake/Modules/Packages/MDI.cmake b/cmake/Modules/Packages/MDI.cmake index dc3af94a0a..447b941d99 100644 --- a/cmake/Modules/Packages/MDI.cmake +++ b/cmake/Modules/Packages/MDI.cmake @@ -26,29 +26,9 @@ 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() - find_package(Python QUIET COMPONENTS Development) - if(Python_Development_FOUND) - set(MDI_USE_PYTHON_PLUGINS ON) - endif() + find_package(Python QUIET COMPONENTS Development) + if(Python_Development_FOUND) + set(MDI_USE_PYTHON_PLUGINS ON) endif() # python plugins are not supported and thus must be always off on Windows if(CMAKE_SYSTEM_NAME STREQUAL "Windows") @@ -102,13 +82,9 @@ if(DOWNLOAD_MDI) # if compiling with python plugins we need # to add python libraries as dependency. if(MDI_USE_PYTHON_PLUGINS) - if(CMAKE_VERSION VERSION_LESS 3.12) - list(APPEND MDI_DEP_LIBS ${PYTHON_LIBRARIES}) - else() - list(APPEND MDI_DEP_LIBS Python::Python) - endif() - + list(APPEND MDI_DEP_LIBS Python::Python) endif() + # need to add support for dlopen/dlsym, except when compiling for Windows. if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows")) list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}") diff --git a/cmake/Modules/Packages/ML-IAP.cmake b/cmake/Modules/Packages/ML-IAP.cmake index f8439be538..d6059c44b8 100644 --- a/cmake/Modules/Packages/ML-IAP.cmake +++ b/cmake/Modules/Packages/ML-IAP.cmake @@ -2,12 +2,7 @@ set(MLIAP_ENABLE_PYTHON_DEFAULT OFF) if(PKG_PYTHON) find_package(Cythonize QUIET) - if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14) - find_package(Python COMPONENTS NumPy QUIET) - else() - # assume we have NumPy - set(Python_NumPy_FOUND ON) - endif() + find_package(Python COMPONENTS NumPy QUIET) if(Cythonize_FOUND AND Python_NumPy_FOUND) set(MLIAP_ENABLE_PYTHON_DEFAULT ON) endif() @@ -17,24 +12,16 @@ option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_EN if(MLIAP_ENABLE_PYTHON) find_package(Cythonize REQUIRED) - if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14) - find_package(Python COMPONENTS NumPy REQUIRED) - endif() + find_package(Python COMPONENTS NumPy REQUIRED) if(NOT PKG_PYTHON) message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP") endif() - if(CMAKE_VERSION VERSION_LESS 3.12) - if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6) - message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later") - endif() - else() - if(Python_VERSION VERSION_LESS 3.6) - message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later") - endif() + if(Python_VERSION VERSION_LESS 3.6) + message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later") endif() set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython) - file(GLOB MLIAP_CYTHON_SRC ${CONFIGURE_DEPENDS} ${LAMMPS_SOURCE_DIR}/ML-IAP/*.pyx) + file(GLOB MLIAP_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/ML-IAP/*.pyx) file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR}) foreach(MLIAP_CYTHON_FILE ${MLIAP_CYTHON_SRC}) get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index 6cdb751617..248b8eea76 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,33 +1,40 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.01.3.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "4f0b3b5b14456fe9a73b447de3765caa" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_MD5 "b45de9a633f42ed65422567e3ce56f9f" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) GetFallbackURL(PACELIB_URL PACELIB_FALLBACK) -# download library sources to build folder -if(EXISTS ${CMAKE_BINARY_DIR}/libpace.tar.gz) - file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5) -endif() -if(NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}") - message(STATUS "Downloading ${PACELIB_URL}") - file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz STATUS DL_STATUS SHOW_PROGRESS) - file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5) - if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}")) - message(WARNING "Download from primary URL ${PACELIB_URL} failed\nTrying fallback URL ${PACELIB_FALLBACK}") - file(DOWNLOAD ${PACELIB_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5} SHOW_PROGRESS) - endif() +# LOCAL_ML-PACE points to top-level dir with local lammps-user-pace repo, +# to make it easier to check local build without going through the public github releases +if(LOCAL_ML-PACE) + set(lib-pace "${LOCAL_ML-PACE}") else() - message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz") -endif() + # download library sources to build folder + if(EXISTS ${CMAKE_BINARY_DIR}/libpace.tar.gz) + file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5) + endif() + if(NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}") + message(STATUS "Downloading ${PACELIB_URL}") + file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz STATUS DL_STATUS SHOW_PROGRESS) + file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5) + if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}")) + message(WARNING "Download from primary URL ${PACELIB_URL} failed\nTrying fallback URL ${PACELIB_FALLBACK}") + file(DOWNLOAD ${PACELIB_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5} SHOW_PROGRESS) + endif() + else() + message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz") + endif() -# 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} -) -get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace) + + # 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} + ) + get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace) +endif() add_subdirectory(${lib-pace} build-pace) set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) diff --git a/cmake/Modules/Packages/PYTHON.cmake b/cmake/Modules/Packages/PYTHON.cmake index 4a2925fe31..e05edadbf3 100644 --- a/cmake/Modules/Packages/PYTHON.cmake +++ b/cmake/Modules/Packages/PYTHON.cmake @@ -1,29 +1,11 @@ -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() + +if(NOT Python_INTERPRETER) + # backward compatibility with CMake before 3.12 and older LAMMPS documentation + if(PYTHON_EXECUTABLE) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) 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) + find_package(Python COMPONENTS Interpreter) endif() +find_package(Python REQUIRED COMPONENTS Interpreter Development) +target_link_libraries(lammps PRIVATE Python::Python) target_compile_definitions(lammps PRIVATE -DLMP_PYTHON) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index 2a0a91e843..d4644bd042 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -1,5 +1,5 @@ function(FindStyleHeaders path style_class file_pattern headers) - file(GLOB files ${CONFIGURE_DEPENDS} "${path}/${file_pattern}*.h") + file(GLOB files CONFIGURE_DEPENDS "${path}/${file_pattern}*.h") get_property(hlist GLOBAL PROPERTY ${headers}) foreach(file_name ${files}) @@ -187,7 +187,7 @@ endfunction(DetectBuildSystemConflict) function(FindPackagesHeaders path style_class file_pattern headers) - file(GLOB files ${CONFIGURE_DEPENDS} "${path}/${file_pattern}*.h") + file(GLOB files CONFIGURE_DEPENDS "${path}/${file_pattern}*.h") get_property(plist GLOBAL PROPERTY ${headers}) foreach(file_name ${files}) diff --git a/cmake/Modules/Testing.cmake b/cmake/Modules/Testing.cmake index 5345211178..ff595d3c8f 100644 --- a/cmake/Modules/Testing.cmake +++ b/cmake/Modules/Testing.cmake @@ -6,7 +6,7 @@ if(ENABLE_TESTING) find_program(VALGRIND_BINARY NAMES valgrind) # generate custom suppression file file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "\n") - file(GLOB VALGRIND_SUPPRESSION_FILES ${CONFIGURE_DEPENDS} ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp) + file(GLOB VALGRIND_SUPPRESSION_FILES CONFIGURE_DEPENDS ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp) foreach(SUPP ${VALGRIND_SUPPRESSION_FILES}) file(READ ${SUPP} SUPPRESSIONS) file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "${SUPPRESSIONS}") @@ -19,7 +19,7 @@ if(ENABLE_TESTING) # we need to build and link a LOT of tester executables, so it is worth checking if # a faster linker is available. requires GNU or Clang compiler, newer CMake. # also only verified with Fedora Linux > 30 and Ubuntu 18.04 or 22.04+(Ubuntu 20.04 fails) - if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) + if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))) if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND ((CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04) OR (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04))) @@ -66,16 +66,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF) mark_as_advanced(ENABLE_COVERAGE) if(ENABLE_COVERAGE) - if(CMAKE_VERSION VERSION_LESS 3.13) - if(CMAKE_CXX_FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage") - endif() - else() - target_compile_options(lammps PUBLIC --coverage) - target_link_options(lammps PUBLIC --coverage) - endif() + target_compile_options(lammps PUBLIC --coverage) + target_link_options(lammps PUBLIC --coverage) endif() endif() @@ -118,16 +110,8 @@ validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES) string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER) if(NOT ENABLE_SANITIZER STREQUAL "none") if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")) - if(CMAKE_VERSION VERSION_LESS 3.13) - if(CMAKE_CXX_FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}") - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}") - endif() - else() - target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER}) - target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER}) - endif() + target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER}) + target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER}) else() message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.") set(ENABLE_SANITIZER "none") diff --git a/cmake/Modules/Tools.cmake b/cmake/Modules/Tools.cmake index b9ead04e45..133301c3d4 100644 --- a/cmake/Modules/Tools.cmake +++ b/cmake/Modules/Tools.cmake @@ -26,7 +26,7 @@ if(BUILD_TOOLS) enable_language(C) get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE) - file(GLOB MSI2LMP_SOURCES ${CONFIGURE_DEPENDS} ${MSI2LMP_SOURCE_DIR}/[^.]*.c) + file(GLOB MSI2LMP_SOURCES CONFIGURE_DEPENDS ${MSI2LMP_SOURCE_DIR}/[^.]*.c) add_executable(msi2lmp ${MSI2LMP_SOURCES}) if(STANDARD_MATH_LIB) target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB}) diff --git a/cmake/packaging/LAMMPS_DMG_Background.png b/cmake/packaging/LAMMPS_DMG_Background.png index 5ceb55c5e7..978b7d1987 100644 Binary files a/cmake/packaging/LAMMPS_DMG_Background.png and b/cmake/packaging/LAMMPS_DMG_Background.png differ diff --git a/cmake/packaging/MacOSXBundleInfo.plist.in b/cmake/packaging/MacOSXBundleInfo.plist.in index 33ce5a602b..bc08591e97 100644 --- a/cmake/packaging/MacOSXBundleInfo.plist.in +++ b/cmake/packaging/MacOSXBundleInfo.plist.in @@ -17,7 +17,7 @@ CFBundleLongVersionString ${MACOSX_BUNDLE_LONG_VERSION_STRING} CFBundleName - LAMMPS + LAMMPS_GUI CFBundlePackageType APPL CFBundleShortVersionString diff --git a/cmake/packaging/README.macos b/cmake/packaging/README.macos index 0325045983..d7583e7034 100644 --- a/cmake/packaging/README.macos +++ b/cmake/packaging/README.macos @@ -9,7 +9,7 @@ of the available packages. The following individual commands are included: binary2txt lammps-gui lmp msi2lmp phana stl_bin2txt -After copying the lammps-gui folder into your Applications folder, please follow +After copying the LAMMPS_GUI folder into your Applications folder, please follow these steps: 1. Open the Terminal app @@ -23,7 +23,7 @@ these steps: 3. Add the following lines to the end of the file, save it, and close the editor - LAMMPS_INSTALL_DIR=/Applications/LAMMPS.app/Contents + LAMMPS_INSTALL_DIR=/Applications/LAMMPS_GUI.app/Contents LAMMPS_POTENTIALS=${LAMMPS_INSTALL_DIR}/share/lammps/potentials LAMMPS_BENCH_DIR=${LAMMPS_INSTALL_DIR}/share/lammps/bench MSI2LMP_LIBRARY=${LAMMPS_INSTALL_DIR}/share/lammps/frc_files @@ -38,9 +38,9 @@ these steps: the changes from .zprofile automatically. Note: the above assumes you use the default shell (zsh) that comes with - MacOS. If you customized MacOS to use a different shell, you'll need to modify - that shell's init file (.cshrc, .bashrc, etc.) instead with appropiate commands - to modify the same environment variables. + MacOS. If you customized MacOS to use a different shell, you'll need to + modify that shell's init file (.cshrc, .bashrc, etc.) instead with + appropiate commands to modify the same environment variables. 5. Try running LAMMPS (which might fail, see step 7) @@ -50,10 +50,10 @@ these steps: lammps-gui ${LAMMPS_BENCH_DIR}/in.rhodo - Depending on the size and resolution of your screen, the fonts may - be too small to read. This can be adjusted by setting the environment - variable QT_FONT_DPI. The default value would be 72, so to increase - the fonts by a third one can add to the .zprofile file the line + Depending on the size and resolution of your screen, the fonts may be too + small to read. This can be adjusted by setting the environment variable + QT_FONT_DPI. The default value would be 72, so to increase the fonts by a + third, one can add to the .zprofile file the line export QT_FONT_DPI=96 @@ -61,9 +61,9 @@ these steps: 7. Give permission to execute the commands (lmp, lammps-gui, msi2lmp, binary2txt, phana, stl_bin2txt) - MacOS will likely block the initial run of the executables, since they - were downloaded from the internet and are missing a known signature from an - identified developer. Go to "Settings" and search for "Security settings". It - should display a message that an executable like "lmp" was blocked. Press + MacOS will likely block the initial run of the executables, since they were + downloaded from the internet and are missing a known signature from an + identified developer. Go to "Settings" and search for "Security settings". + It should display a message that an executable like "lmp" was blocked. Press "Open anyway", which might prompt you for your admin credentials. Afterwards "lmp" and the other executables should work as expected. diff --git a/cmake/packaging/build_linux_tgz.sh b/cmake/packaging/build_linux_tgz.sh index e0222858ce..48e3017f61 100755 --- a/cmake/packaging/build_linux_tgz.sh +++ b/cmake/packaging/build_linux_tgz.sh @@ -4,7 +4,7 @@ APP_NAME=lammps-gui DESTDIR=${PWD}/../LAMMPS_GUI echo "Delete old files, if they exist" -rm -rf ${DESTDIR} ../LAMMPS-Linux-amd64.tar.gz +rm -rf ${DESTDIR} ../LAMMPS_GUI-Linux-amd64.tar.gz echo "Create staging area for deployment and populate" DESTDIR=${DESTDIR} cmake --install . --prefix "/" @@ -69,7 +69,7 @@ do \ done pushd .. -tar -czvvf LAMMPS-Linux-amd64.tar.gz LAMMPS_GUI +tar -czvvf LAMMPS_GUI-Linux-amd64.tar.gz LAMMPS_GUI popd echo "Cleanup dir" diff --git a/cmake/packaging/build_macos_dmg.sh b/cmake/packaging/build_macos_dmg.sh index 5204e519c2..4da3e40eaf 100755 --- a/cmake/packaging/build_macos_dmg.sh +++ b/cmake/packaging/build_macos_dmg.sh @@ -3,7 +3,7 @@ APP_NAME=lammps-gui echo "Delete old files, if they exist" -rm -f ${APP_NAME}.dmg ${APP_NAME}-rw.dmg LAMMPS-macOS-multiarch.dmg +rm -f ${APP_NAME}.dmg ${APP_NAME}-rw.dmg LAMMPS_GUI-macOS-multiarch.dmg echo "Create initial dmg file with macdeployqt" macdeployqt lammps-gui.app -dmg @@ -22,8 +22,8 @@ ln -s /Applications . mv ${APP_NAME}.app/Contents/Resources/README.txt . mkdir .background mv ${APP_NAME}.app/Contents/Resources/LAMMPS_DMG_Background.png .background/background.png -mv ${APP_NAME}.app LAMMPS.app -cd LAMMPS.app/Contents +mv ${APP_NAME}.app LAMMPS_GUI.app +cd LAMMPS_GUI.app/Contents echo "Attach icons to LAMMPS console and GUI executables" echo "read 'icns' (-16455) \"Resources/lammps.icns\";" > icon.rsrc @@ -75,7 +75,7 @@ echo ' set statusbar visible to false set toolbar visible to false set the bounds to { 100, 40, 868, 640 } - set position of item "'LAMMPS'.app" to { 190, 216 } + set position of item "'LAMMPS_GUI'.app" to { 190, 216 } set position of item "Applications" to { 576, 216 } set position of item "README.txt" to { 190, 400 } end tell @@ -96,12 +96,12 @@ sync echo "Unmount modified disk image and convert to compressed read-only image" hdiutil detach "${DEVICE}" -hdiutil convert "${APP_NAME}-rw.dmg" -format UDZO -o "LAMMPS-macOS-multiarch.dmg" +hdiutil convert "${APP_NAME}-rw.dmg" -format UDZO -o "LAMMPS_GUI-macOS-multiarch.dmg" echo "Attach icon to .dmg file" echo "read 'icns' (-16455) \"lammps-gui.app/Contents/Resources/lammps.icns\";" > icon.rsrc -Rez -a icon.rsrc -o LAMMPS-macOS-multiarch.dmg -SetFile -a C LAMMPS-macOS-multiarch.dmg +Rez -a icon.rsrc -o LAMMPS_GUI-macOS-multiarch.dmg +SetFile -a C LAMMPS_GUI-macOS-multiarch.dmg rm icon.rsrc echo "Delete temporary disk images" diff --git a/cmake/packaging/build_windows_cross_zip.sh b/cmake/packaging/build_windows_cross_zip.sh index 5659b84f74..d02b9cf761 100755 --- a/cmake/packaging/build_windows_cross_zip.sh +++ b/cmake/packaging/build_windows_cross_zip.sh @@ -1,26 +1,64 @@ -#!/bin/bash -vx +#!/bin/bash APP_NAME=lammps-gui -DESTDIR=${PWD}/../LAMMPS_GUI +DESTDIR=${PWD}/LAMMPS_GUI +SYSROOT="$1" echo "Delete old files, if they exist" -rm -rvf ${DESTDIR} LAMMPS-Win10-amd64.zip +rm -rvf ${DESTDIR}/LAMMPS_GUI ${DESTDIR}/LAMMPS-Win10-amd64.zip echo "Create staging area for deployment and populate" DESTDIR=${DESTDIR} cmake --install . --prefix "/" -echo "Add required dependencies for Qt" -for dll in Qt5Core.dll Qt5Gui.dll Qt5Widgets.dll +# no static libs needed +rm -rvf ${DESTDIR}/lib +# but the LAMMPS lib + +echo "Copying required DLL files" +for dll in $(objdump -p *.exe *.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq) do \ - cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/${dll} ${DESTDIR}/bin/ -done -for dir in styles platforms imageformats -do \ - mkdir -p ${DESTDIR}/${dir} - cp -r /usr/x86_64-w64-mingw32/sys-root/mingw/lib/qt5/plugins/${dir}/*.dll ${DESTDIR}/${dir} + doskip=0 + for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32 + do \ + test ${dll} = ${skip}.dll && doskip=1 + done + test ${doskip} -eq 1 && continue + test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin done -pushd .. -zip -9rv LAMMPS-Win10-amd64.zip LAMMPS_GUI -popd -exit 0 +echo "Copy required Qt plugins" +mkdir -p ${DESTDIR}/qt5plugins +for plugin in imageformats platforms styles +do \ + cp -r ${SYSROOT}/lib/qt5/plugins/${plugin} ${DESTDIR}/qt5plugins/ +done + +echo "Check dependencies of DLL files" +for dll in $(objdump -p ${DESTDIR}/bin/*.dll ${DESTDIR}/qt5plugins/*/*.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq) +do \ + doskip=0 + for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32 + do \ + test ${dll} = ${skip}.dll && doskip=1 + done + test ${doskip} -eq 1 && continue + test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin +done + +for dll in $(objdump -p ${DESTDIR}/bin/*.dll ${DESTDIR}/qt5plugins/*/*.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq) +do \ + doskip=0 + for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32 + do \ + test ${dll} = ${skip}.dll && doskip=1 + done + test ${doskip} -eq 1 && continue + test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin +done + +cat > ${DESTDIR}/bin/qt.conf <`_ + **(Lamoureux and Roux)** G.\ Lamoureux, B. Roux, J. Chem. Phys 119, 3025 (2003) diff --git a/doc/src/Build_basics.rst b/doc/src/Build_basics.rst index 0a0d4919a0..233b825d01 100644 --- a/doc/src/Build_basics.rst +++ b/doc/src/Build_basics.rst @@ -90,7 +90,7 @@ standard. A more detailed discussion of that is below. directory, or ``make`` from the ``src/STUBS`` dir. If the build fails, you may need to edit the ``STUBS/Makefile`` for your platform. The stubs library does not provide MPI/IO functions - required by some LAMMPS packages, e.g. ``MPIIO`` or ``LATBOLTZ``, + required by some LAMMPS packages, e.g. ``LATBOLTZ``, and thus is not compatible with those packages. .. note:: @@ -128,14 +128,13 @@ and adds vectorization support when compiled with compatible compilers, in particular the Intel compilers on top of OpenMP. Also, the ``KOKKOS`` package can be compiled to include OpenMP threading. -In addition, there are a few commands in LAMMPS that have native -OpenMP support included as well. These are commands in the ``MPIIO``, -``ML-SNAP``, ``DIFFRACTION``, and ``DPD-REACT`` packages. -Furthermore, some packages support OpenMP threading indirectly through -the libraries they interface to: e.g. ``KSPACE``, and ``COLVARS``. -See the :doc:`Packages details ` page for more info -on these packages, and the pages for their respective commands for -OpenMP threading info. +In addition, there are a few commands in LAMMPS that have native OpenMP +support included as well. These are commands in the ``ML-SNAP``, +``DIFFRACTION``, and ``DPD-REACT`` packages. Furthermore, some packages +support OpenMP threading indirectly through the libraries they interface +to: e.g. ``KSPACE``, and ``COLVARS``. See the :doc:`Packages details +` page for more info on these packages, and the pages +for their respective commands for OpenMP threading info. For CMake, if you use ``BUILD_OMP=yes``, you can use these packages and turn on their native OpenMP support and turn on their native OpenMP @@ -489,8 +488,9 @@ using CMake or Make. .. code-block:: bash - -D BUILD_TOOLS=value # yes or no (default) - -D BUILD_LAMMPS_SHELL=value # yes or no (default) + -D BUILD_TOOLS=value # yes or no (default). Build binary2txt, chain.x, micelle2d.x, msi2lmp, phana, stl_bin2txt + -D BUILD_LAMMPS_SHELL=value # yes or no (default). Build lammps-shell + -D BUILD_LAMMPS_GUI=value # yes or no (default). Build lammps-gui The generated binaries will also become part of the LAMMPS installation (see below). @@ -504,7 +504,6 @@ using CMake or Make. make binary2txt # build only binary2txt tool make chain # build only chain tool make micelle2d # build only micelle2d tool - make thermo_extract # build only thermo_extract tool cd lammps/tools/lammps-shell make # build LAMMPS shell diff --git a/doc/src/Build_cmake.rst b/doc/src/Build_cmake.rst index 9be2c33165..e622f9f208 100644 --- a/doc/src/Build_cmake.rst +++ b/doc/src/Build_cmake.rst @@ -16,8 +16,7 @@ environments is on a :doc:`separate page `. .. note:: - LAMMPS currently requires that CMake version 3.10 or later is available; - version 3.12 or later is preferred. + LAMMPS currently requires that CMake version 3.16 or later is available. .. warning:: @@ -34,19 +33,18 @@ Advantages of using CMake ^^^^^^^^^^^^^^^^^^^^^^^^^ CMake is an alternative to compiling LAMMPS in the traditional way -through :doc:`(manually customized) makefiles ` and a recent -addition to LAMMPS thanks to the efforts of Christoph Junghans (LANL) -and Richard Berger (Temple U). Using CMake has multiple advantages that -are specifically helpful for people with limited experience in compiling -software or for people that want to modify or extend LAMMPS. +through :doc:`(manually customized) makefiles `. Using +CMake has multiple advantages that are specifically helpful for +people with limited experience in compiling software or for people +that want to modify or extend LAMMPS. - CMake can detect available hardware, tools, features, and libraries and adapt the LAMMPS default build configuration accordingly. - CMake can generate files for different build tools and integrated development environments (IDE). - CMake supports customization of settings with a command line, text - mode, or graphical user interface. No knowledge of file formats or - complex command line syntax is required. + mode, or graphical user interface. No manual editing of files, + knowledge of file formats or complex command line syntax is required. - All enabled components are compiled in a single build operation. - Automated dependency tracking for all files and configuration options. - Support for true out-of-source compilation. Multiple configurations @@ -179,13 +177,13 @@ configuration is selected with the *-C* flag: ctest -C Debug -The CMake scripts in LAMMPS have basic support for being compiled using a -multi-config build system, but not all of it has been ported. This is in -particular applicable to compiling packages that require additional libraries -that would be downloaded and compiled by CMake. The "windows" preset file -tries to keep track of which packages can be compiled natively with the -MSVC compilers out-of-the box. Not all of those external libraries are -portable to Windows, either. +The CMake scripts in LAMMPS have basic support for being compiled using +a multi-config build system, but not all of it has been ported. This is +in particular applicable to compiling packages that require additional +libraries that would be downloaded and compiled by CMake. The +``windows.cmake`` preset file tries to keep track of which packages can +be compiled natively with the MSVC compilers out-of-the box. Not all of +the external libraries are portable to Windows, either. Installing CMake diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index c75c7a6a41..d30a433d62 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -518,6 +518,8 @@ The following options are available. make fix-errordocs # remove error docs in header files make check-permissions # search for files with permissions issues make fix-permissions # correct permissions issues in files + make check-docs # search for several issues in the manual + make check-version # list files with pending release version tags make check # run all check targets from above These should help to make source and documentation files conforming diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 6e2069c0ec..1f643a9d14 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -626,22 +626,22 @@ They must be specified in uppercase. * - HOPPER90 - GPU - NVIDIA Hopper generation CC 9.0 GPU - * - VEGA900 + * - AMD_GFX906 - GPU - - AMD GPU MI25 GFX900 - * - VEGA906 + - AMD GPU MI50/MI60 + * - AMD_GFX908 - GPU - - AMD GPU MI50/MI60 GFX906 - * - VEGA908 + - AMD GPU MI100 + * - AMD_GFX90A - GPU - - AMD GPU MI100 GFX908 - * - VEGA90A + - AMD GPU MI200 + * - AMD_GFX942 - GPU - - AMD GPU MI200 GFX90A - * - NAVI1030 + - AMD GPU MI300 + * - AMD_GFX1030 - GPU - AMD GPU V620/W6800 - * - NAVI1100 + * - AMD_GFX1100 - GPU - AMD GPU RX7900XTX * - INTEL_GEN @@ -666,7 +666,7 @@ They must be specified in uppercase. - GPU - Intel GPU Ponte Vecchio -This list was last updated for version 4.0.1 of the Kokkos library. +This list was last updated for version 4.2 of the Kokkos library. .. tabs:: @@ -722,9 +722,10 @@ This list was last updated for version 4.0.1 of the Kokkos library. ``cmake/presets`` folder, ``kokkos-serial.cmake``, ``kokkos-openmp.cmake``, ``kokkos-cuda.cmake``, ``kokkos-hip.cmake``, and ``kokkos-sycl.cmake``. They will enable - the KOKKOS package and enable some hardware choice. So to compile - with CUDA device parallelization (for GPUs with CC 5.0 and up) - with some common packages enabled, you can do the following: + the KOKKOS package and enable some hardware choices. For GPU + support those preset files must be customized to match the + hardware used. So to compile with CUDA device parallelization with + some common packages enabled, you can do the following: .. code-block:: bash @@ -886,6 +887,50 @@ included in the LAMMPS source distribution in the ``lib/lepton`` folder. ---------- +.. _machdyn: + +MACHDYN package +------------------------------- + +To build with this package, you must download the Eigen3 library. +Eigen3 is a template library, so you do not need to build it. + +.. tabs:: + + .. tab:: CMake build + + .. code-block:: bash + + -D DOWNLOAD_EIGEN3 # download Eigen3, value = no (default) or yes + -D EIGEN3_INCLUDE_DIR=path # path to Eigen library (only needed if a custom location) + + If ``DOWNLOAD_EIGEN3`` is set, the Eigen3 library will be + downloaded and inside the CMake build directory. If the Eigen3 + library is already on your system (in a location where CMake + cannot find it), set ``EIGEN3_INCLUDE_DIR`` to the directory the + ``Eigen3`` include file is in. + + .. tab:: Traditional make + + You can download the Eigen3 library manually if you prefer; follow + the instructions in ``lib/machdyn/README``. You can also do it in one + step from the ``lammps/src`` dir, using a command like these, + which simply invokes the ``lib/machdyn/Install.py`` script with the + specified args: + + .. code-block:: bash + + make lib-machdyn # print help message + make lib-machdyn args="-b" # download to lib/machdyn/eigen3 + make lib-machdyn args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 + + Note that a symbolic (soft) link named ``includelink`` is created + in ``lib/machdyn`` to point to the Eigen dir. When LAMMPS builds it + will use this link. You should not need to edit the + ``lib/machdyn/Makefile.lammps`` file. + +---------- + .. _mliap: ML-IAP package @@ -1011,12 +1056,12 @@ additional details. .. code-block:: bash - -D PYTHON_EXECUTABLE=path # path to Python executable to use + -D Python_EXECUTABLE=path # path to Python executable to use Without this setting, CMake will guess the default Python version on your system. To use a different Python version, you can either create a virtualenv, activate it and then run cmake. Or you can - set the PYTHON_EXECUTABLE variable to specify which Python + set the Python_EXECUTABLE variable to specify which Python interpreter should be used. Note note that you will also need to have the development headers installed for this version, e.g. python2-devel. @@ -1431,6 +1476,55 @@ ML-POD package ---------- +.. _ml-quip: + +ML-QUIP package +--------------------------------- + +To build with this package, you must download and build the QUIP +library. It can be obtained from GitHub. For support of GAP +potentials, additional files with specific licensing conditions need +to be downloaded and configured. The automatic download will from +within CMake will download the non-commercial use version. + +.. tabs:: + + .. tab:: CMake build + + .. code-block:: bash + + -D DOWNLOAD_QUIP=value # download QUIP library for build, value = no (default) or yes + -D QUIP_LIBRARY=path # path to libquip.a (only needed if a custom location) + -D USE_INTERNAL_LINALG=value # Use the internal linear algebra library instead of LAPACK + # value = no (default) or yes + + CMake will try to download and build the QUIP library from GitHub, + if it is not found on the local machine. This requires to have git + installed. It will use the same compilers and flags as used for + compiling LAMMPS. Currently this is only supported for the GNU + and the Intel compilers. Set the ``QUIP_LIBRARY`` variable if you + want to use a previously compiled and installed QUIP library and + CMake cannot find it. + + The QUIP library requires LAPACK (and BLAS) and CMake can identify + their locations and pass that info to the QUIP build script. But + on some systems this triggers a (current) limitation of CMake and + the configuration will fail. Try enabling ``USE_INTERNAL_LINALG`` in + those cases to use the bundled linear algebra library and work around + the limitation. + + .. tab:: Traditional make + + The download/build procedure for the QUIP library, described in + ``lib/quip/README`` file requires setting two environment + variables, ``QUIP_ROOT`` and ``QUIP_ARCH``. These are accessed by + the ``lib/quip/Makefile.lammps`` file which is used when you + compile and link LAMMPS with this package. You should only need + to edit ``Makefile.lammps`` if the LAMMPS build can not use its + settings to successfully build on your system. + +---------- + .. _plumed: PLUMED package @@ -1952,55 +2046,6 @@ verified to work in February 2020 with Quantum Espresso versions 6.3 to ---------- -.. _ml-quip: - -ML-QUIP package ---------------------------------- - -To build with this package, you must download and build the QUIP -library. It can be obtained from GitHub. For support of GAP -potentials, additional files with specific licensing conditions need -to be downloaded and configured. The automatic download will from -within CMake will download the non-commercial use version. - -.. tabs:: - - .. tab:: CMake build - - .. code-block:: bash - - -D DOWNLOAD_QUIP=value # download QUIP library for build, value = no (default) or yes - -D QUIP_LIBRARY=path # path to libquip.a (only needed if a custom location) - -D USE_INTERNAL_LINALG=value # Use the internal linear algebra library instead of LAPACK - # value = no (default) or yes - - CMake will try to download and build the QUIP library from GitHub, - if it is not found on the local machine. This requires to have git - installed. It will use the same compilers and flags as used for - compiling LAMMPS. Currently this is only supported for the GNU - and the Intel compilers. Set the ``QUIP_LIBRARY`` variable if you - want to use a previously compiled and installed QUIP library and - CMake cannot find it. - - The QUIP library requires LAPACK (and BLAS) and CMake can identify - their locations and pass that info to the QUIP build script. But - on some systems this triggers a (current) limitation of CMake and - the configuration will fail. Try enabling ``USE_INTERNAL_LINALG`` in - those cases to use the bundled linear algebra library and work around - the limitation. - - .. tab:: Traditional make - - The download/build procedure for the QUIP library, described in - ``lib/quip/README`` file requires setting two environment - variables, ``QUIP_ROOT`` and ``QUIP_ARCH``. These are accessed by - the ``lib/quip/Makefile.lammps`` file which is used when you - compile and link LAMMPS with this package. You should only need - to edit ``Makefile.lammps`` if the LAMMPS build can not use its - settings to successfully build on your system. - ----------- - .. _scafacos: SCAFACOS package @@ -2048,50 +2093,6 @@ To build with this package, you must download and build the ---------- -.. _machdyn: - -MACHDYN package -------------------------------- - -To build with this package, you must download the Eigen3 library. -Eigen3 is a template library, so you do not need to build it. - -.. tabs:: - - .. tab:: CMake build - - .. code-block:: bash - - -D DOWNLOAD_EIGEN3 # download Eigen3, value = no (default) or yes - -D EIGEN3_INCLUDE_DIR=path # path to Eigen library (only needed if a custom location) - - If ``DOWNLOAD_EIGEN3`` is set, the Eigen3 library will be - downloaded and inside the CMake build directory. If the Eigen3 - library is already on your system (in a location where CMake - cannot find it), set ``EIGEN3_INCLUDE_DIR`` to the directory the - ``Eigen3`` include file is in. - - .. tab:: Traditional make - - You can download the Eigen3 library manually if you prefer; follow - the instructions in ``lib/smd/README``. You can also do it in one - step from the ``lammps/src`` dir, using a command like these, - which simply invokes the ``lib/smd/Install.py`` script with the - specified args: - - .. code-block:: bash - - make lib-smd # print help message - make lib-smd args="-b" # download to lib/smd/eigen3 - make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 - - Note that a symbolic (soft) link named ``includelink`` is created - in ``lib/smd`` to point to the Eigen dir. When LAMMPS builds it - will use this link. You should not need to edit the - ``lib/smd/Makefile.lammps`` file. - ----------- - .. _vtk: VTK package diff --git a/doc/src/Build_package.rst b/doc/src/Build_package.rst index bc6445f813..63ccac534d 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -182,6 +182,7 @@ make a copy of one of them and modify it to suit your needs. cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross-compilers + cmake -C ../cmake/presets/macos-multiarch.cmake [OPTIONS] ../cmake # compile serial multi-arch binaries on macOS Presets that have names starting with "windows" are specifically for compiling LAMMPS :doc:`natively on Windows ` and diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index 7576cae3eb..7fb7539506 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -44,6 +44,14 @@ require use of an FFT library to compute 1d FFTs. The KISS FFT library is included with LAMMPS, but other libraries can be faster. LAMMPS can use them if they are available on your system. +.. versionadded:: TBD + +Alternatively, LAMMPS can use the `heFFTe +`_ library for the MPI +communication algorithms, which comes with many optimizations for +special cases, e.g. leveraging available 2D and 3D FFTs in the back end +libraries and better pipelining for packing and communication. + .. tabs:: .. tab:: CMake build @@ -53,6 +61,7 @@ LAMMPS can use them if they are available on your system. -D FFT=value # FFTW3 or MKL or KISS, default is FFTW3 if found, else KISS -D FFT_SINGLE=value # yes or no (default), no = double precision -D FFT_PACK=value # array (default) or pointer or memcpy + -D FFT_USE_HEFFTE=value # yes or no (default), yes links to heFFTe .. note:: @@ -76,6 +85,16 @@ LAMMPS can use them if they are available on your system. -D MKL_INCLUDE_DIR=path # ditto for Intel MKL library -D FFT_MKL_THREADS=on # enable using threaded FFTs with MKL libraries -D MKL_LIBRARY=path # path to MKL libraries + -D FFT_HEFFTE_BACKEND=value # FFTW or MKL or empty/undefined for the stock heFFTe back end + -D Heffte_ROOT=path # path to an existing heFFTe installation + + .. note:: + + heFFTe comes with a builtin (= stock) back end for FFTs, i.e. a + default internal FFT implementation; however, this stock back + end is intended for testing purposes only and is not optimized + for production runs. + .. tab:: Traditional make @@ -111,6 +130,24 @@ LAMMPS can use them if they are available on your system. files in its default search path. You must specify ``FFT_LIB`` with the appropriate FFT libraries to include in the link. + Traditional make can also link to heFFTe using an existing installation + + .. code-block:: make + + include /share/heffte/HeffteMakefile.in + FFT_INC = -DFFT_HEFFTE -DFFT_HEFFTE_FFTW $(heffte_include) + FFT_PATH = + FFT_LIB = $(heffte_link) $(heffte_libs) + + The heFFTe install path will contain `HeffteMakefile.in`. + which will define the `heffte_` include variables needed to link to heFFTe from + an external project using traditional make. + The `-DFFT_HEFFTE` is required to switch to using heFFTe, while the optional `-DFFT_HEFFTE_FFTW` + selects the desired heFFTe back end, e.g., `-DFFT_HEFFTE_FFTW` or `-DFFT_HEFFTE_MKL`, + omitting the variable will default to the `stock` back end. + The heFFTe `stock` back end is intended to be used for testing and debugging, + but is not performance optimized for large scale production runs. + The `KISS FFT library `_ is included in the LAMMPS distribution. It is portable across all platforms. Depending on the size of the FFTs and the number of @@ -170,6 +207,16 @@ Depending on the machine, the size of the FFT grid, the number of processors used, one option may be slightly faster. The default is ARRAY mode. +When using ``-DFFT_HEFFTE`` CMake will first look for an existing +install with hints provided by ``-DHeffte_ROOT``, as recommended by the +CMake standard and note that the name is case sensitive. If CMake cannot +find a heFFTe installation with the correct back end (e.g., FFTW or +MKL), it will attempt to download and build the library automatically. +In this case, LAMMPS CMake will also accept all heFFTe specific +variables listed in the `heFFTe documentation +`_ +and those variables will be passed into the heFFTe build. + ---------- .. _size: @@ -463,8 +510,8 @@ Exception handling when using LAMMPS as a library LAMMPS errors do not kill the calling code, but throw an exception. In the C-library interface, the call stack is unwound and control returns -to the caller, e.g. to Python or a code that is coupled to LAMMPS and -the error status can be queried. When using C++ directly, the calling +to the caller, e.g. to Python or a code that is coupled to LAMMPS. The +error status can then be queried. When using C++ directly, the calling code has to be set up to *catch* exceptions thrown from within LAMMPS. .. note:: diff --git a/doc/src/Commands_compute.rst b/doc/src/Commands_compute.rst index 9066531459..0352ad5374 100644 --- a/doc/src/Commands_compute.rst +++ b/doc/src/Commands_compute.rst @@ -91,6 +91,7 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`ke/atom/eff ` * :doc:`ke/eff ` * :doc:`ke/rigid ` + * :doc:`composition/atom (k) ` * :doc:`mliap ` * :doc:`momentum ` * :doc:`msd ` @@ -99,6 +100,7 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`nbond/atom ` * :doc:`omega/chunk ` * :doc:`orientorder/atom (k) ` + * :doc:`pace ` * :doc:`pair ` * :doc:`pair/local ` * :doc:`pe ` @@ -114,12 +116,15 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`property/grid ` * :doc:`property/local ` * :doc:`ptm/atom ` + * :doc:`rattlers/atom ` * :doc:`rdf ` + * :doc:`reaxff/atom (k) ` * :doc:`reduce ` * :doc:`reduce/chunk ` * :doc:`reduce/region ` * :doc:`rigid/local ` * :doc:`saed ` + * :doc:`slcsa/atom ` * :doc:`slice ` * :doc:`smd/contact/radius ` * :doc:`smd/damage ` diff --git a/doc/src/Commands_dump.rst b/doc/src/Commands_dump.rst index 870cb168ef..d7c8e73b58 100644 --- a/doc/src/Commands_dump.rst +++ b/doc/src/Commands_dump.rst @@ -23,17 +23,14 @@ An alphabetic list of all LAMMPS :doc:`dump ` commands. * :doc:`atom ` * :doc:`atom/adios ` * :doc:`atom/gz ` - * :doc:`atom/mpiio ` * :doc:`atom/zstd ` * :doc:`cfg ` * :doc:`cfg/gz ` - * :doc:`cfg/mpiio ` * :doc:`cfg/uef ` * :doc:`cfg/zstd ` * :doc:`custom ` * :doc:`custom/adios ` * :doc:`custom/gz ` - * :doc:`custom/mpiio ` * :doc:`custom/zstd ` * :doc:`dcd ` * :doc:`grid ` @@ -51,7 +48,6 @@ An alphabetic list of all LAMMPS :doc:`dump ` commands. * :doc:`xtc ` * :doc:`xyz ` * :doc:`xyz/gz ` - * :doc:`xyz/mpiio ` * :doc:`xyz/zstd ` * :doc:`yaml ` diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 5aabb7967c..e89e302673 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -69,7 +69,7 @@ OPT. * :doc:`drude/transform/inverse ` * :doc:`dt/reset (k) ` * :doc:`edpd/source ` - * :doc:`efield ` + * :doc:`efield (k) ` * :doc:`efield/tip4p ` * :doc:`ehex ` * :doc:`electrode/conp (i) ` @@ -122,6 +122,7 @@ OPT. * :doc:`mvv/tdpd ` * :doc:`neb ` * :doc:`neb/spin ` + * :doc:`nonaffine/displacement ` * :doc:`nph (ko) ` * :doc:`nph/asphere (o) ` * :doc:`nph/body ` @@ -181,6 +182,7 @@ OPT. * :doc:`pour ` * :doc:`precession/spin ` * :doc:`press/berendsen ` + * :doc:`press/langevin ` * :doc:`print ` * :doc:`propel/self ` * :doc:`property/atom (k) ` @@ -232,15 +234,15 @@ OPT. * :doc:`spring ` * :doc:`spring/chunk ` * :doc:`spring/rg ` - * :doc:`spring/self ` + * :doc:`spring/self (k) ` * :doc:`srd ` * :doc:`store/force ` * :doc:`store/state ` * :doc:`tdpd/source ` - * :doc:`temp/berendsen ` + * :doc:`temp/berendsen (k) ` * :doc:`temp/csld ` * :doc:`temp/csvr ` - * :doc:`temp/rescale ` + * :doc:`temp/rescale (k) ` * :doc:`temp/rescale/eff ` * :doc:`tfmc ` * :doc:`tgnpt/drude ` diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index c45a1d778c..e7761e7bee 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -87,7 +87,7 @@ OPT. * :doc:`coul/long/soft (o) ` * :doc:`coul/msm (o) ` * :doc:`coul/slater/cut ` - * :doc:`coul/slater/long ` + * :doc:`coul/slater/long (g) ` * :doc:`coul/shield ` * :doc:`coul/streitz ` * :doc:`coul/tt ` @@ -110,7 +110,7 @@ OPT. * :doc:`eam/he ` * :doc:`edip (o) ` * :doc:`edip/multi ` - * :doc:`edpd ` + * :doc:`edpd (g) ` * :doc:`eff/cut ` * :doc:`eim (o) ` * :doc:`exp6/rx (k) ` @@ -158,14 +158,14 @@ OPT. * :doc:`lj/cut (gikot) ` * :doc:`lj/cut/coul/cut (gko) ` * :doc:`lj/cut/coul/cut/dielectric (o) ` - * :doc:`lj/cut/coul/cut/soft (o) ` + * :doc:`lj/cut/coul/cut/soft (go) ` * :doc:`lj/cut/coul/debye (gko) ` * :doc:`lj/cut/coul/debye/dielectric (o) ` * :doc:`lj/cut/coul/dsf (gko) ` * :doc:`lj/cut/coul/long (gikot) ` * :doc:`lj/cut/coul/long/cs ` * :doc:`lj/cut/coul/long/dielectric (o) ` - * :doc:`lj/cut/coul/long/soft (o) ` + * :doc:`lj/cut/coul/long/soft (go) ` * :doc:`lj/cut/coul/msm (go) ` * :doc:`lj/cut/coul/msm/dielectric ` * :doc:`lj/cut/coul/wolf (o) ` @@ -202,7 +202,7 @@ OPT. * :doc:`lubricate/poly (o) ` * :doc:`lubricateU ` * :doc:`lubricateU/poly ` - * :doc:`mdpd ` + * :doc:`mdpd (g) ` * :doc:`mdpd/rhosum ` * :doc:`meam (k) ` * :doc:`meam/ms (k) ` @@ -220,7 +220,8 @@ OPT. * :doc:`morse/soft ` * :doc:`multi/lucy ` * :doc:`multi/lucy/rx (k) ` - * :doc:`nb3b/harmonic ` + * :doc:`nb3b/harmonic ` + * :doc:`nb3b/screened ` * :doc:`nm/cut (o) ` * :doc:`nm/cut/coul/cut (o) ` * :doc:`nm/cut/coul/long (o) ` @@ -265,13 +266,13 @@ OPT. * :doc:`smd/tri_surface ` * :doc:`smd/ulsph ` * :doc:`smtbq ` - * :doc:`snap (k) ` + * :doc:`snap (ik) ` * :doc:`soft (go) ` - * :doc:`sph/heatconduction ` + * :doc:`sph/heatconduction (g) ` * :doc:`sph/idealgas ` - * :doc:`sph/lj ` + * :doc:`sph/lj (g) ` * :doc:`sph/rhosum ` - * :doc:`sph/taitwater ` + * :doc:`sph/taitwater (g) ` * :doc:`sph/taitwater/morris ` * :doc:`spin/dipole/cut ` * :doc:`spin/dipole/long ` @@ -305,5 +306,5 @@ OPT. * :doc:`wf/cut ` * :doc:`ylz ` * :doc:`yukawa (gko) ` - * :doc:`yukawa/colloid (go) ` + * :doc:`yukawa/colloid (gko) ` * :doc:`zbl (gko) ` diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index f33d8f4988..98a52fc2d7 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -85,10 +85,29 @@ The same functionality is available through :doc:`bond style mesocnt ` and :doc:`angle style mesocnt `. +MPIIO package +------------- + +.. deprecated:: 21Nov2023 + +The MPIIO package has been removed from LAMMPS since it was unmaintained +for many years and thus not updated to incorporate required changes that +had been applied to the corresponding non-MPIIO commands. As a +consequence the MPIIO commands had become unreliable and sometimes +crashing LAMMPS or corrupting data. Similar functionality is available +through the :ref:`ADIOS package ` and the :ref:`NETCDF +package `. Also, the :doc:`dump_modify nfile or dump_modify +fileper ` keywords may be used for an efficient way of +writing out dump files when running on large numbers of processors. +Similarly, the "nfile" and "fileper" keywords exist for restarts: +see :doc:`restart `, :doc:`read_restart `, +:doc:`write_restart `. + + MSCG package ------------ -.. deprecated:: TBD +.. deprecated:: 21Nov2023 The MSCG package has been removed from LAMMPS since it was unmaintained for many years and instead superseded by the `OpenMSCG software @@ -107,6 +126,17 @@ syntax compatible with the removed reax pair style, so input files will have to be adapted. The REAXFF package was originally called USER-REAXC. +USER-REAXC package +------------------ + +.. deprecated:: TBD + +The USER-REAXC package has been renamed to :ref:`REAXFF `. +In the process also the pair style and related fixes were renamed to use +the "reaxff" string instead of "reax/c". For a while LAMMPS was maintaining +backward compatibility by providing aliases for the styles. These have +been removed, so using "reaxff" is now *required*. + USER-CUDA package ----------------- diff --git a/doc/src/Developer_unittest.rst b/doc/src/Developer_unittest.rst index 9886e9e4b4..e311fcdfc5 100644 --- a/doc/src/Developer_unittest.rst +++ b/doc/src/Developer_unittest.rst @@ -180,19 +180,11 @@ discarded but by setting the verbose flag (via setting the ``TEST_ARGS`` environment variable, ``TEST_ARGS=-v``) it can be printed and used to understand why tests fail unexpectedly. -Another complexity of these tests stems from the need to capture -situations where LAMMPS will stop with an error, i.e. handle so-called -"death tests". Here the LAMMPS code will operate differently depending -on whether it was configured to throw C++ exceptions on errors or call -either ``exit()`` or ``MPI_Abort()``. In the latter case, the test code -also needs to detect whether LAMMPS was compiled with the OpenMPI -library, as OpenMPI is **only** compatible the death test options of the -GoogleTest library when C++ exceptions are enabled; otherwise those -"death tests" must be skipped to avoid reporting bogus failures. The -specifics of this step are implemented in the ``TEST_FAILURE()`` -macro. These tests operate by capturing the screen output when executing -the failing command and then comparing that with a provided regular -expression string pattern. Example: +The specifics of so-called "death tests", i.e. conditions where LAMMPS +should fail and throw an exception, are implemented in the +``TEST_FAILURE()`` macro. These tests operate by capturing the screen +output when executing the failing command and then comparing that with a +provided regular expression string pattern. Example: .. code-block:: c++ @@ -282,9 +274,7 @@ Tests for using the Fortran module are in the ``unittest/fortran`` folder. Since they are also using the GoogleTest library, they require to also implement test wrappers in C++ that will call fortran functions which provide a C function interface through ISO_C_BINDINGS that will in -turn call the functions in the LAMMPS Fortran module. This part of the -unit tests is incomplete since the Fortran module it is based on is -incomplete as well. +turn call the functions in the LAMMPS Fortran module. Tests for the C++-style library interface ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -405,10 +395,10 @@ compare with the reference and also start from the data file. A final check will use multi-cutoff r-RESPA (if supported by the pair style) at a 1:1 split and compare to the Verlet results. These sets of tests are run with multiple test fixtures for accelerated styles (OPT, OPENMP, -INTEL) and for the latter two with 4 OpenMP threads enabled. For -these tests the relative error (epsilon) is lowered by a common factor -due to the additional numerical noise, but the tests are still comparing -to the same reference data. +INTEL, KOKKOS (OpenMP only)) and for the latter three with 4 OpenMP +threads enabled. For these tests the relative error (epsilon) is lowered +by a common factor due to the additional numerical noise, but the tests +are still comparing to the same reference data. Additional tests will check whether all listed extract keywords are supported and have the correct dimensionality and the final set of tests @@ -442,17 +432,19 @@ The ``test_pair_style`` tester is used with 4 categories of test inputs: pair style is defined, but the computation of the pair style contributions is disabled. -The ``test_bond_style`` and ``test_angle_style`` are set up in a similar -fashion and share support functions with the pair style tester. The final -group of tests in this section is for fix styles that add/manipulate forces -and velocities, e.g. for time integration, thermostats and more. +The ``test_bond_style``, ``test_angle_style``, ``test_dihedral_style``, and +``test_improper_style`` tester programs are set up in a similar fashion and +share support functions with the pair style tester. The final group of +tests in this section is for fix styles that add/manipulate forces and +velocities, e.g. for time integration, thermostats and more. -Adding a new test is easiest done by copying and modifying an existing test -for a style that is similar to one to be tested. The file name should follow -the naming conventions described above and after copying the file, the first -step is to replace the style names where needed. The coefficient values -do not have to be meaningful, just in a reasonable range for the given system. -It does not matter if some forces are large, for as long as they do not diverge. +Adding a new test is easiest done by copying and modifying an existing YAML +file for a style that is similar to one to be tested. The file name should +follow the naming conventions described above and after copying the file, +the first step is to replace the style names where needed. The coefficient +values do not have to be meaningful, just in a reasonable range for the +given system. It does not matter if some forces are large, for as long as +they do not diverge. The template input files define a large number of index variables at the top that can be modified inside the YAML file to control the behavior. For example, @@ -480,7 +472,7 @@ Note that this disables computing the kspace contribution, but still will run the setup. The "gewald" parameter should be set explicitly to speed up the run. For styles with long-range electrostatics, typically two tests are added one using the (slower) analytic approximation of the erfc() function and the other using -the tabulated coulomb, to test both code paths. The reference results in the YAML +the tabulated coulomb, to test both code paths. The reference results in the YAML files then should be compared manually, if they agree well enough within the limits of those two approximations. diff --git a/doc/src/Errors_messages.rst b/doc/src/Errors_messages.rst index 293cf6ab53..bfdba4f6a1 100644 --- a/doc/src/Errors_messages.rst +++ b/doc/src/Errors_messages.rst @@ -7148,9 +7148,6 @@ keyword to allow for additional bonds to be formed *Read_dump xyz fields do not have consistent scaling/wrapping* Self-explanatory. -*Reading from MPI-IO filename when MPIIO package is not installed* - Self-explanatory. - *Reax_defs.h setting for NATDEF is too small* Edit the setting in the ReaxFF library and re-compile the library and re-build LAMMPS. @@ -8489,9 +8486,6 @@ keyword to allow for additional bonds to be formed The write_restart command cannot be used before a read_data, read_restart, or create_box command. -*Writing to MPI-IO filename when MPIIO package is not installed* - Self-explanatory. - *Zero length rotation vector with displace_atoms* Self-explanatory. diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst index 913c31842e..76fdff753a 100644 --- a/doc/src/Fortran.rst +++ b/doc/src/Fortran.rst @@ -3038,14 +3038,6 @@ Procedures Bound to the :f:type:`lammps` Derived Type This function can be used to query if an error inside of LAMMPS has thrown a :ref:`C++ exception `. - .. note:: - - This function will always report "no error" when the LAMMPS library - has been compiled without ``-DLAMMPS_EXCEPTIONS``, which turns fatal - errors aborting LAMMPS into C++ exceptions. You can use the library - function :cpp:func:`lammps_config_has_exceptions` to check if this is - the case. - :to: :cpp:func:`lammps_has_error` :r has_error: ``.TRUE.`` if there is an error. :rtype has_error: logical @@ -3068,13 +3060,6 @@ Procedures Bound to the :f:type:`lammps` Derived Type would happen only in a single MPI rank and thus may not be recoverable, as other MPI ranks may be waiting on the failing MPI rank(s) to send messages. - .. note:: - - This function will do nothing when the LAMMPS library has been - compiled without ``-DLAMMPS_EXCEPTIONS``, which turns errors aborting - LAMMPS into C++ exceptions. You can use the function - :f:func:`config_has_exceptions` to check whether this is the case. - :p character(len=\*) buffer: string buffer to copy the error message into :o integer(c_int) status [optional]: 1 when all ranks had the error, 2 on a single-rank error. diff --git a/doc/src/Howto.rst b/doc/src/Howto.rst index 4752cf6aea..85c98bd6de 100644 --- a/doc/src/Howto.rst +++ b/doc/src/Howto.rst @@ -100,6 +100,8 @@ Tutorials howto Howto_cmake Howto_github + Howto_lammps_gui + Howto_moltemplate Howto_pylammps Howto_wsl diff --git a/doc/src/Howto_body.rst b/doc/src/Howto_body.rst index 88fa2d9c97..968e10edd8 100644 --- a/doc/src/Howto_body.rst +++ b/doc/src/Howto_body.rst @@ -170,9 +170,9 @@ with this body style to compute body/body and body/non-body interactions. The *rounded/polygon* body style represents body particles as a 2d polygon with a variable number of N vertices. This style can only be used for 2d models; see the :doc:`boundary ` command. See the -"pair_style body/rounded/polygon" page for a diagram of two -squares with rounded circles at the vertices. Special cases for N = 1 -(circle) and N = 2 (rod with rounded ends) can also be specified. +:doc:`pair_style body/rounded/polygon ` page for +a diagram of two squares with rounded circles at the vertices. Special cases +for N = 1 (circle) and N = 2 (rod with rounded ends) can also be specified. One use of this body style is for 2d discrete element models, as described in :ref:`Fraige `. @@ -335,7 +335,7 @@ faces are listed, so that M = 6 + 3\*N + 1. The integer line has three values: number of vertices (N), number of edges (E) and number of faces (F). The floating point line(s) list 6 moments of inertia followed by the coordinates of the N vertices (x1 -to zN) as 3N values, followed by 2N vertex indices corresponding to +to zN) as 3N values, followed by 2E vertex indices corresponding to the end points of the E edges, then 4\*F vertex indices defining F faces. The last value is the diameter value = the rounded diameter of the sphere that surrounds each vertex. The diameter value can be diff --git a/doc/src/Howto_cmake.rst b/doc/src/Howto_cmake.rst index 627f9e458c..42324cf2f1 100644 --- a/doc/src/Howto_cmake.rst +++ b/doc/src/Howto_cmake.rst @@ -1,11 +1,11 @@ -Using CMake with LAMMPS tutorial -================================ +Using CMake with LAMMPS +======================= The support for building LAMMPS with CMake is a recent addition to LAMMPS thanks to the efforts of Christoph Junghans (LANL) and Richard -Berger (Temple U). One of the key strengths of CMake is that it is not -tied to a specific platform or build system and thus generate the files -necessary to build and develop for different build systems and on +Berger (LANL). One of the key strengths of CMake is that it is not +tied to a specific platform or build system. Instead it generates the +files necessary to build and develop for different build systems and on different platforms. Note, that this applies to the build system itself not the LAMMPS code. In other words, without additional porting effort, it is not possible - for example - to compile LAMMPS with Visual C++ on @@ -14,7 +14,7 @@ necessary to program LAMMPS as a project in integrated development environments (IDE) like Eclipse, Visual Studio, QtCreator, Xcode, CodeBlocks, Kate and others. -A second important feature of CMake is, that it can detect and validate +A second important feature of CMake is that it can detect and validate available libraries, optimal settings, available support tools and so on, so that by default LAMMPS will take advantage of available tools without requiring to provide the details about how to enable/integrate @@ -32,8 +32,8 @@ program ``cmake`` (or ``cmake3``), a text mode interactive user interface (TUI) program ``ccmake`` (or ``ccmake3``), or a graphical user interface (GUI) program ``cmake-gui``. All of them are portable software available on all supported platforms and can be used -interchangeably. The minimum supported CMake version is 3.10 (3.12 or -later is recommended). +interchangeably. As of LAMMPS version 2 August 2023, the minimum +required CMake version is 3.16. All details about features and settings for CMake are in the `CMake online documentation `_. We focus @@ -43,11 +43,20 @@ Prerequisites ------------- This tutorial assumes that you are operating in a command-line environment -using a shell like Bash. +using a shell like Bash or Zsh. -- Linux: any Terminal window will work -- macOS: launch the Terminal application. -- Windows 10: install and run the :doc:`Windows Subsystem for Linux ` +- Linux: any Terminal window will work or text console +- macOS: launch the Terminal application +- Windows 10 or 11: install and run the :doc:`Windows Subsystem for Linux ` +- other Unix-like operating systems like FreeBSD + +.. note:: + + It is also possible to use CMake on Windows 10 or 11 through either the Microsoft + Visual Studio IDE with the bundled CMake or from the Windows command prompt using + a separately installed CMake package, both using the native Microsoft Visual C++ + compilers and (optionally) the Microsoft MPI SDK. This tutorial, however, only + covers unix-like command line interfaces. We also assume that you have downloaded and unpacked a recent LAMMPS source code package or used Git to create a clone of the LAMMPS sources on your compilation machine. diff --git a/doc/src/Howto_lammps_gui.rst b/doc/src/Howto_lammps_gui.rst new file mode 100644 index 0000000000..165ed84d95 --- /dev/null +++ b/doc/src/Howto_lammps_gui.rst @@ -0,0 +1,700 @@ +Using the LAMMPS GUI +==================== + +This document describes **LAMMPS GUI version 1.5**. + +----- + +LAMMPS GUI is a graphical text editor customized for editing LAMMPS +input files that is linked to the :ref:`LAMMPS library ` +and thus can run LAMMPS directly using the contents of the editor's text +buffer as input. It can retrieve and display information from LAMMPS +while it is running, display visualizations created with the :doc:`dump +image command `, and is adapted specifically for editing +LAMMPS input files through text completion and reformatting, and linking +to the online LAMMPS documentation for known LAMMPS commands and styles. + +.. note:: + + Pre-compiled, ready-to-use LAMMPS GUI executables for Linux (Ubuntu + 20.04LTS or later and compatible), macOS (version 11 aka Big Sur or + later), and Windows (version 10 or later) :ref:`are available + ` for download. They may be linked to a + development version of LAMMPS in case they need features not yet + available in a released version. Serial LAMMPS executables of the + same LAMMPS version are included as well. The source code for the + LAMMPS GUI is included in the LAMMPS source code and can be found in + the ``tools/lammps-gui`` folder. It can be compiled alongside LAMMPS + when :doc:`compiling with CMake `. + +LAMMPS GUI tries to provide an experience similar to what people +traditionally would do to run LAMMPS using a command line window: + +- editing inputs with a text editor +- run LAMMPS on the input with selected command line flags +- and then use or extract data from the created files and visualize it + +That procedure is quite effective for people proficient in using the +command line, as that allows them to use tools for the individual steps +which they are most comfortable with. It is often required when running +LAMMPS on high-performance computing facilities. + +The main benefit of using the LAMMPS GUI application instead is that +many basic tasks can be done directly from the GUI without switching to +a text console window or using external programs, let alone writing +scripts to extract data from the generated output. It also integrates +well with graphical desktop environments. + +LAMMPS GUI thus makes it easier for beginners to get started running +simple LAMMPS simulations. It is very suitable for tutorials on LAMMPS +since you only need to learn how to use a single program for most tasks +and thus time can be saved and people can focus on learning LAMMPS. It +is also designed to keep the barrier low when you decide to switch to a +full featured, standalone programming editor and more sophisticated +visualization and analysis tools and run LAMMPS from a command line. + +The following text provides a detailed tour of the features and +functionality of the LAMMPS GUI. + +Suggestions for new features and reports of bugs are always welcome. +You can use the :doc:`the same channels as for LAMMPS itself +` for that purpose. + +----- + +Main window +----------- + +When LAMMPS GUI starts, it will show a main window with either an +empty buffer or the contents of a loaded file. In the latter case it +may look like the following: + +.. image:: JPG/lammps-gui-main.png + :align: center + :scale: 50% + +There is the typical menu bar at the top, then the main editor buffer, +and a status bar at the bottom. The input file contents are shown +with line numbers on the left and the input is colored according to +the LAMMPS input file syntax. The status bar shows the status of +LAMMPS execution on the left (e.g. "Ready." when idle) and the current +working directory on the right. The name of the current file in the +buffer is shown in the window title; the word `*modified*` is added if +the buffer edits have not yet saved to a file. The size of the main +window will be stored when exiting and restored when starting again. + +Opening Files +^^^^^^^^^^^^^ + +The LAMMPS GUI application will try to open the first command line +argument as a LAMMPS input script, further arguments are ignored. +When no argument is given, LAMMPS GUI will start with an empty buffer. +Files can also be opened via the ``File`` menu or by drag-and-drop of +a file from a graphical file manager into the editor window. Only one +file can be open at a time, so opening a new file with a filled buffer +will close the buffer. If the buffer has unsaved modifications, you +will be asked to either cancel the operation, discard the changes, or +save them. + +Running LAMMPS +^^^^^^^^^^^^^^ + +From within the LAMMPS GUI main window LAMMPS can be started either from +the ``Run`` menu using the ``Run LAMMPS from Editor Buffer`` entry, by +the keyboard shortcut `Ctrl-Enter` (`Command-Enter` on macOS), or by +clicking on the green "Run" button in the status bar. All of these +operations will cause LAMMPS to process the entire input script, which +may contain multiple :doc:`run ` or :doc:`minimize ` +commands. + +LAMMPS runs in a separate thread, so the GUI stays responsive and is +able to interact with the running calculation and access data it +produces. It is important to note that running LAMMPS this way is +using the contents of the input buffer for the run (via the +:cpp:func:`lammps_commands_string()` function of the LAMMPS C-library +interface), and **not** the original file it was read from. Thus, if +there are unsaved changes in the buffer, they *will* be used. As an +alternative, it is also possible to run LAMMPS by reading the contents +of a file from the ``Run LAMMPS from File`` menu entry or with +`Ctrl-Shift-Enter`. This option may be required in some rare cases +where the input uses some functionality that is not compatible with +running LAMMPS from a string buffer. For consistency, any unsaved +changes in the buffer must be either saved to the file or undone +before LAMMPS can be run from a file. + +.. image:: JPG/lammps-gui-running.png + :align: center + :scale: 75% + +While LAMMPS is running, the contents of the status bar change. On +the left side there is a text indicating that LAMMPS is running, which +will also show the number of active threads, if thread-parallel +acceleration was selected in the ``Preferences`` dialog. On the right +side, a progress bar is shown that displays the estimated progress for +the current :doc:`run command `. + +Also, the line number of the currently executed command will be +highlighted in green. + +.. image:: JPG/lammps-gui-run-highlight.png + :align: center + :scale: 75% + +If an error occurs (in the example below the command :doc:`label +