diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 44a5ced761..c7abfebf3a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing to LAMMPS via GitHub -Thank your for considering to contribute to the LAMMPS software project. +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. diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c33628ac04..58b001be24 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,7 +25,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 diff --git a/.github/workflows/compile-msvc.yml b/.github/workflows/compile-msvc.yml index 5ae0654ee0..5c6ceeefb4 100644 --- a/.github/workflows/compile-msvc.yml +++ b/.github/workflows/compile-msvc.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 7bda3a071f..b1c23e1f6a 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 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/.gitignore b/.gitignore index a89f75cc9a..4faef4b8db 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,6 @@ out/x86 out/x64 src/Makefile.package-e src/Makefile.package.settings-e +/cmake/build/x64-Debug-Clang +/install/x64-GUI-MSVC +/install diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 88b7ec422e..b075fc8f8d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1,8 +1,9 @@ +# -*- 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 +13,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) @@ -136,15 +126,15 @@ if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma") endif() -# we require C++11 without extensions. Kokkos requires at least C++14 (currently) +# we require C++11 without extensions. Kokkos requires at least C++17 (currently) if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) endif() if(CMAKE_CXX_STANDARD LESS 11) message(FATAL_ERROR "C++ standard must be set to at least 11") endif() -if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14)) - set(CMAKE_CXX_STANDARD 14) +if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 17)) + set(CMAKE_CXX_STANDARD 17) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions") @@ -155,6 +145,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) @@ -192,6 +183,7 @@ option(BUILD_SHARED_LIBS "Build shared library" OFF) option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared libraries" ON) option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF) option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF) +option(BUILD_LAMMPS_GUI "Build and install the LAMMPS GUI" OFF) # Support using clang-tidy for C++ files with selected options set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling") @@ -202,8 +194,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}) @@ -277,8 +269,6 @@ set(STANDARD_PACKAGES MOFFF MOLECULE MOLFILE - MPIIO - MSCG NETCDF ORIENT PERI @@ -384,15 +374,9 @@ if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0") target_compile_definitions(lammps PRIVATE -DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) endif() -option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" ${ENABLE_TESTING}) -if(LAMMPS_EXCEPTIONS) - target_compile_definitions(lammps PUBLIC -DLAMMPS_EXCEPTIONS) -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) @@ -403,6 +387,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) @@ -440,14 +425,14 @@ if(BUILD_OMP) target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX) endif() -if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_TOOLS) +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) find_package(LAPACK) 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 "$") @@ -465,12 +450,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) @@ -520,7 +500,7 @@ else() endif() foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF - PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM MSCG COMPRESS ML-PACE LEPTON) + PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM COMPRESS ML-PACE LEPTON) if(PKG_${PKG_WITH_INCL}) include(Packages/${PKG_WITH_INCL}) endif() @@ -582,8 +562,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}) @@ -599,19 +579,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}) @@ -625,7 +598,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}) @@ -795,9 +768,11 @@ include(Tools) include(Documentation) ############################################################################### -# Install potential and force field files in data directory +# Install bench, potential and force field files in data directory ############################################################################### -set(LAMMPS_INSTALL_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps) +set(LAMMPS_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/lammps) + +install(DIRECTORY ${LAMMPS_DIR}/bench DESTINATION ${LAMMPS_INSTALL_DATADIR}) install(DIRECTORY ${LAMMPS_POTENTIALS_DIR} DESTINATION ${LAMMPS_INSTALL_DATADIR}) if(BUILD_TOOLS) install(DIRECTORY ${LAMMPS_TOOLS_DIR}/msi2lmp/frc_files DESTINATION ${LAMMPS_INSTALL_DATADIR}) @@ -818,20 +793,11 @@ 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) + # backward compatibility + if(PYTHON_EXECUTABLE) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) endif() + find_package(Python COMPONENTS Interpreter) if(BUILD_IS_MULTI_CONFIG) set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$) else() @@ -890,13 +856,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 ############################################################################### @@ -940,11 +916,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}") @@ -1025,6 +999,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/CMakeSettings.json b/cmake/CMakeSettings.json index 205b443bf1..c880962535 100644 --- a/cmake/CMakeSettings.json +++ b/cmake/CMakeSettings.json @@ -63,6 +63,11 @@ "name": "ENABLE_TESTING", "value": "True", "type": "BOOL" + }, + { + "name": "BUILD_LAMMPS_GUI", + "value": "False", + "type": "BOOL" } ] }, @@ -303,6 +308,54 @@ "type": "STRING" } ] + }, + { + "name": "x64-GUI-MSVC", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${workspaceRoot}\\build\\${name}", + "installRoot": "${workspaceRoot}\\install\\${name}", + "cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -D QT_DIR=C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5 -D Qt5_DIR=C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5", + "buildCommandArgs": "", + "ctestCommandArgs": "-V", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [ + { + "name": "BUILD_SHARED_LIBS", + "value": "True", + "type": "BOOL" + }, + { + "name": "BUILD_TOOLS", + "value": "True", + "type": "BOOL" + }, + { + "name": "LAMMPS_EXCEPTIONS", + "value": "True", + "type": "BOOL" + }, + { + "name": "ENABLE_TESTING", + "value": "False", + "type": "BOOL" + }, + { + "name": "BUILD_MPI", + "value": "False", + "type": "BOOL" + }, + { + "name": "WITH_PNG", + "value": "False", + "type": "BOOL" + }, + { + "name": "BUILD_LAMMPS_GUI", + "value": "True", + "type": "BOOL" + } + ] } ] } \ No newline at end of file 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 c1cc613496..151e0a04f7 100644 --- a/cmake/Modules/LAMMPSInterfacePlugin.cmake +++ b/cmake/Modules/LAMMPSInterfacePlugin.cmake @@ -28,9 +28,8 @@ if(MSVC) add_compile_options(/Zc:__cplusplus) add_compile_options(/wd4244) add_compile_options(/wd4267) - if(LAMMPS_EXCEPTIONS) - add_compile_options(/EHsc) - endif() + add_compile_options(/wd4250) + add_compile_options(/EHsc) endif() add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() @@ -65,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..bb5ea07609 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,8 +80,8 @@ 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) foreach(_SRC ${SRC_AUTOGEN_FILES}) 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 4a70eb7a1e..47be8b8538 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") @@ -64,11 +64,13 @@ if(GPU_API STREQUAL "CUDA") endif() set(GPU_CUDA_MPS_FLAGS "-DCUDA_MPS_SUPPORT") endif() + option(CUDA_BUILD_MULTIARCH "Enable building CUDA kernels for all supported GPU architectures" ON) + mark_as_advanced(GPU_BUILD_MULTIARCH) 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" @@ -78,71 +80,73 @@ 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 # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}") - # apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0 - # only the Kepler achitecture and beyond is supported - # comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported - if(CUDA_VERSION VERSION_LESS 8.0) - message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required") - elseif(CUDA_VERSION VERSION_GREATER_EQUAL "13.0") - message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk") - set(GPU_CUDA_GENCODE "-arch=all") - elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") - set(GPU_CUDA_GENCODE "-arch=all") - else() - # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 - if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30] ") - endif() - # Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11 - if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0")) - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_35,code=[sm_35,compute_35]") - endif() - # Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "6.0") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52]") - endif() - # Pascal (GPU Arch 6.x) is supported by CUDA 8 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61]") - endif() - # Volta (GPU Arch 7.0) is supported by CUDA 9 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_70,code=[sm_70,compute_70]") - endif() - # Turing (GPU Arch 7.5) is supported by CUDA 10 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_75,code=[sm_75,compute_75]") - endif() - # Ampere (GPU Arch 8.0) is supported by CUDA 11 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]") - endif() - # Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]") - endif() - # Lovelace (GPU Arch 8.9) is supported by CUDA 11.8 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") - endif() - # Hopper (GPU Arch 9.0) is supported by CUDA 12.0 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + if(CUDA_BUILD_MULTIARCH) + # apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0 + # only the Kepler achitecture and beyond is supported + # comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported + if(CUDA_VERSION VERSION_LESS 8.0) + message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required") + elseif(CUDA_VERSION VERSION_GREATER_EQUAL "13.0") + message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk") + set(GPU_CUDA_GENCODE "-arch=all") + elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + set(GPU_CUDA_GENCODE "-arch=all") + else() + # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 + if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30] ") + endif() + # Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11 + if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0")) + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_35,code=[sm_35,compute_35]") + endif() + # Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "6.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52]") + endif() + # Pascal (GPU Arch 6.x) is supported by CUDA 8 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61]") + endif() + # Volta (GPU Arch 7.0) is supported by CUDA 9 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_70,code=[sm_70,compute_70]") + endif() + # Turing (GPU Arch 7.5) is supported by CUDA 10 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_75,code=[sm_75,compute_75]") + endif() + # Ampere (GPU Arch 8.0) is supported by CUDA 11 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]") + endif() + # Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]") + endif() + # Lovelace (GPU Arch 8.9) is supported by CUDA 11.8 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + endif() + # Hopper (GPU Arch 9.0) is supported by CUDA 12.0 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + endif() endif() endif() @@ -201,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 @@ -331,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 795b087bcb..6359d9e615 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -1,7 +1,8 @@ ######################################################################## -# As of version 3.3.0 Kokkos requires C++14 -if(CMAKE_CXX_STANDARD LESS 14) - message(FATAL_ERROR "The KOKKOS package requires the C++ standard to be set to at least C++14") +# As of version 4.0.0 Kokkos requires C++17 +if(CMAKE_CXX_STANDARD LESS 17) + message(FATAL_ERROR "The KOKKOS package requires the C++ standard to +be set to at least C++17") endif() ######################################################################## @@ -49,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/3.7.02.tar.gz" CACHE STRING "URL for KOKKOS tarball") - set(KOKKOS_MD5 "34d7860d548c06a4040236d959c9f99a" CACHE STRING "MD5 checksum of KOKKOS tarball") + 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") mark_as_advanced(KOKKOS_URL) mark_as_advanced(KOKKOS_MD5) GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK) @@ -75,7 +76,7 @@ if(DOWNLOAD_KOKKOS) add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) elseif(EXTERNAL_KOKKOS) - find_package(Kokkos 3.7.02 REQUIRED CONFIG) + find_package(Kokkos 4.1.00 REQUIRED CONFIG) target_link_libraries(lammps PRIVATE Kokkos::kokkos) else() set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) @@ -155,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/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/MSCG.cmake b/cmake/Modules/Packages/MSCG.cmake deleted file mode 100644 index 2b8e8eda06..0000000000 --- a/cmake/Modules/Packages/MSCG.cmake +++ /dev/null @@ -1,28 +0,0 @@ -find_package(GSL REQUIRED) -find_package(MSCG QUIET) -if(MSGC_FOUND) - set(DOWNLOAD_MSCG_DEFAULT OFF) -else() - set(DOWNLOAD_MSCG_DEFAULT ON) -endif() -option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT}) -if(DOWNLOAD_MSCG) - set(MSCG_URL "https://github.com/uchicago-voth/MSCG-release/archive/491270a73539e3f6951e76f7dbe84e258b3ebb45.tar.gz" CACHE STRING "URL for MSCG tarball") - set(MSCG_MD5 "7ea50748fba5c3a372e0266bd31d2f11" CACHE STRING "MD5 checksum of MSCG tarball") - mark_as_advanced(MSCG_URL) - mark_as_advanced(MSCG_MD5) - - include(ExternalCMakeProject) - ExternalCMakeProject(mscg ${MSCG_URL} ${MSCG_MD5} MSCG-release src/CMake "") - - # set include and link library - target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/mscg-src/src") - target_link_libraries(lammps PRIVATE mscg) -else() - find_package(MSCG) - if(NOT MSCG_FOUND) - message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIR, or set DOWNLOAD_MSCG=ON to download it") - endif() - target_link_libraries(lammps PRIVATE MSCG::MSCG) -endif() -target_link_libraries(lammps PRIVATE GSL::gsl ${LAPACK_LIBRARIES}) diff --git a/cmake/Modules/Packages/PYTHON.cmake b/cmake/Modules/Packages/PYTHON.cmake index 4a2925fe31..59260e39d5 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 + 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 285c5f2405..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}) @@ -37,12 +37,13 @@ if(BUILD_TOOLS) add_subdirectory(${LAMMPS_TOOLS_DIR}/phonon ${CMAKE_BINARY_DIR}/phana_build) endif() +find_package(PkgConfig QUIET) if(BUILD_LAMMPS_SHELL) + if(NOT PkgConfig_FOUND) + message(FATAL_ERROR "Must have pkg-config installed for building LAMMPS shell") + endif() find_package(PkgConfig REQUIRED) pkg_check_modules(READLINE IMPORTED_TARGET REQUIRED readline) - if(NOT LAMMPS_EXCEPTIONS) - message(WARNING "The LAMMPS shell needs LAMMPS_EXCEPTIONS enabled for full functionality") - endif() # include resource compiler to embed icons into the executable on Windows if(CMAKE_SYSTEM_NAME STREQUAL "Windows") @@ -67,4 +68,8 @@ if(BUILD_LAMMPS_SHELL) install(FILES ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/) endif() - +if(BUILD_LAMMPS_GUI) + get_filename_component(LAMMPS_GUI_DIR ${LAMMPS_SOURCE_DIR}/../tools/lammps-gui ABSOLUTE) + get_filename_component(LAMMPS_GUI_BIN ${CMAKE_BINARY_DIR}/lammps-gui-build ABSOLUTE) + add_subdirectory(${LAMMPS_GUI_DIR} ${LAMMPS_GUI_BIN}) +endif() diff --git a/cmake/packaging/LAMMPS_DMG_Background.png b/cmake/packaging/LAMMPS_DMG_Background.png new file mode 100644 index 0000000000..978b7d1987 Binary files /dev/null and b/cmake/packaging/LAMMPS_DMG_Background.png differ diff --git a/cmake/packaging/MacOSXBundleInfo.plist.in b/cmake/packaging/MacOSXBundleInfo.plist.in new file mode 100644 index 0000000000..bc08591e97 --- /dev/null +++ b/cmake/packaging/MacOSXBundleInfo.plist.in @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + en-US + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleDisplayName + The LAMMPS Molecular Dynamics Software + CFBundleIconFile + lammps + CFBundleIdentifier + org.lammps.gui + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + ${MACOSX_BUNDLE_LONG_VERSION_STRING} + CFBundleName + LAMMPS_GUI + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CSResourcesFileMapped + + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + + diff --git a/cmake/packaging/README.macos b/cmake/packaging/README.macos new file mode 100644 index 0000000000..d7583e7034 --- /dev/null +++ b/cmake/packaging/README.macos @@ -0,0 +1,69 @@ +LAMMPS and LAMMPS GUI universal binaries for macOS (arm64/x86_64) +================================================================= + +This package provides universal binaries of LAMMPS and LAMMPS GUI that should +run on macOS systems running running macOS version 11 (Big Sur) or newer. Note +the binaries are compiled without MPI support and contain a compatible subset +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 +these steps: + +1. Open the Terminal app + +2. Type the following command and press ENTER: + + open ~/.zprofile + + This will open a text editor for modifying the .zprofile file in your home + directory. + +3. Add the following lines to the end of the file, save it, and close the editor + + 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 + PATH=${LAMMPS_INSTALL_DIR}/bin:$PATH + export LAMMPS_POTENTIALS LAMMPS_BENCH_DIR PATH + +4. In your existing terminal, type the following command make the settings active + + source ~/.zprofile + + Note, you don't have to type this in new terminals, since they will apply + 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. + +5. Try running LAMMPS (which might fail, see step 7) + + lmp -in ${LAMMPS_BENCH_DIR}/in.lj + +6. Try running the LAMMPS GUI + + 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 + + export QT_FONT_DPI=96 + + and reload as shown above. + +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 + "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 new file mode 100755 index 0000000000..48e3017f61 --- /dev/null +++ b/cmake/packaging/build_linux_tgz.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +APP_NAME=lammps-gui +DESTDIR=${PWD}/../LAMMPS_GUI + +echo "Delete old files, if they exist" +rm -rf ${DESTDIR} ../LAMMPS_GUI-Linux-amd64.tar.gz + +echo "Create staging area for deployment and populate" +DESTDIR=${DESTDIR} cmake --install . --prefix "/" + +echo "Remove debug info" +for s in ${DESTDIR}/bin/* ${DESTDIR}/lib/liblammps* +do \ + test -f $s && strip --strip-debug $s +done + +echo "Remove libc, gcc, and X11 related shared libs" +rm -f ${DESTDIR}/lib/ld*.so ${DESTDIR}/lib/ld*.so.[0-9] +rm -f ${DESTDIR}/lib/lib{c,dl,rt,m,pthread}.so.? +rm -f ${DESTDIR}/lib/lib{c,dl,rt,m,pthread}-[0-9].[0-9]*.so +rm -f ${DESTDIR}/lib/libX* ${DESTDIR}/lib/libxcb* +rm -f ${DESTDIR}/lib/libgcc_s* +rm -f ${DESTDIR}/lib/libstdc++* + +# get qt dir +QTDIR=$(ldd ${DESTDIR}/bin/lammps-gui | grep libQt5Core | sed -e 's/^.*=> *//' -e 's/libQt5Core.so.*$/qt5/') +cat > ${DESTDIR}/bin/qt.conf < *//' -e 's/\(libQt5.*.so.*\) .*$/\1/') +for dep in ${QTDEPS} +do \ + cp ${dep} ${DESTDIR}/lib +done + +echo "Add additional plugins for Qt" +for dir in styles imageformats +do \ + cp -r ${QTDIR}/plugins/${dir} ${DESTDIR}/qt5plugins/ +done + +# get imageplugin dependencies +for s in ${DESTDIR}/qt5plugins/imageformats/*.so +do \ + QTDEPS=$(LD_LIBRARY_PATH=${DESTDIR}/lib ldd $s | grep -v ${DESTDIR} | grep -E '(libQt5|jpeg)' | sed -e 's/^.*=> *//' -e 's/\(lib.*.so.*\) .*$/\1/') + for dep in ${QTDEPS} + do \ + cp ${dep} ${DESTDIR}/lib + done +done + +echo "Set up wrapper script" +MYDIR=$(dirname "$0") +cp ${MYDIR}/linux_wrapper.sh ${DESTDIR}/bin +for s in ${DESTDIR}/bin/* +do \ + EXE=$(basename $s) + test ${EXE} = linux_wrapper.sh && continue + test ${EXE} = qt.conf && continue + ln -s bin/linux_wrapper.sh ${DESTDIR}/${EXE} +done + +pushd .. +tar -czvvf LAMMPS_GUI-Linux-amd64.tar.gz LAMMPS_GUI +popd + +echo "Cleanup dir" +rm -r ${DESTDIR} +exit 0 diff --git a/cmake/packaging/build_macos_dmg.sh b/cmake/packaging/build_macos_dmg.sh new file mode 100755 index 0000000000..4da3e40eaf --- /dev/null +++ b/cmake/packaging/build_macos_dmg.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +APP_NAME=lammps-gui + +echo "Delete old files, if they exist" +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 +echo "Create writable dmg file" +hdiutil convert ${APP_NAME}.dmg -format UDRW -o ${APP_NAME}-rw.dmg + +echo "Mount writeable DMG file in read-write mode. Keep track of device and volume names" +DEVICE=$(hdiutil attach -readwrite -noverify ${APP_NAME}-rw.dmg | grep '^/dev/' | sed 1q | awk '{print $1}') +VOLUME=$(df | grep ${DEVICE} | sed -e 's/^.*\(\/Volumes\/\)/\1/') +sleep 2 + +echo "Create link to Application folder and move README and background image files" + +pushd "${VOLUME}" +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_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 +Rez -a icon.rsrc -o bin/lmp +SetFile -a C bin/lmp +Rez -a icon.rsrc -o MacOS/lammps-gui +SetFile -a C MacOS/lammps-gui +rm icon.rsrc +popd + +echo 'Tell the Finder to resize the window, set the background,' +echo 'change the icon size, place the icons in the right position, etc.' +echo ' + tell application "Finder" + tell disk "'${APP_NAME}'" + + -- wait for the image to finish mounting + set open_attempts to 0 + repeat while open_attempts < 4 + try + open + delay 1 + set open_attempts to 5 + close + on error errStr number errorNumber + set open_attempts to open_attempts + 1 + delay 10 + end try + end repeat + delay 5 + + -- open the image the first time and save a .DS_Store + -- just the background and icon setup + open + set current view of container window to icon view + set theViewOptions to the icon view options of container window + set background picture of theViewOptions to file ".background:background.png" + set arrangement of theViewOptions to not arranged + set icon size of theViewOptions to 64 + delay 5 + close + + -- next set up the position of the app and Applications symlink + -- plus hide all window decorations + open + update without registering applications + tell container window + set sidebar width to 0 + set statusbar visible to false + set toolbar visible to false + set the bounds to { 100, 40, 868, 640 } + 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 + update without registering applications + delay 5 + close + + -- one last open and close to check the results + open + delay 5 + close + end tell + delay 1 + end tell +' | osascript + +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_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_GUI-macOS-multiarch.dmg +SetFile -a C LAMMPS_GUI-macOS-multiarch.dmg +rm icon.rsrc + +echo "Delete temporary disk images" +rm -f "${APP_NAME}-rw.dmg" +rm -f "${APP_NAME}.dmg" + +exit 0 diff --git a/cmake/packaging/build_windows_cross_zip.sh b/cmake/packaging/build_windows_cross_zip.sh new file mode 100755 index 0000000000..d02b9cf761 --- /dev/null +++ b/cmake/packaging/build_windows_cross_zip.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +APP_NAME=lammps-gui +DESTDIR=${PWD}/LAMMPS_GUI +SYSROOT="$1" + +echo "Delete old files, if they exist" +rm -rvf ${DESTDIR}/LAMMPS_GUI ${DESTDIR}/LAMMPS-Win10-amd64.zip + +echo "Create staging area for deployment and populate" +DESTDIR=${DESTDIR} cmake --install . --prefix "/" + +# 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 \ + 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 + +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 < " + exit 1 +fi + +png="$1" +ico="$2" + +if [ ! -f ${png} ] +then + echo "PNG Image $1 not found" +fi + +rm -rf ${ico}.iconset +mkdir ${ico}.iconset +sips -z 16 16 ${png} --out ${ico}.iconset/icon_16x16.png +sips -z 32 32 ${png} --out ${ico}.iconset/icon_16x16@2x.png +sips -z 32 32 ${png} --out ${ico}.iconset/icon_32x32.png +sips -z 64 64 ${png} --out ${ico}.iconset/icon_32x32@2x.png +sips -z 128 128 ${png} --out ${ico}.iconset/icon_128x128.png +sips -z 256 256 ${png} --out ${ico}.iconset/icon_128x128@2x.png +sips -z 256 256 ${png} --out ${ico}.iconset/icon_256x256.png +sips -z 512 512 ${png} --out ${ico}.iconset/icon_256x256@2x.png +sips -z 512 512 ${png} --out ${ico}.iconset/icon_512x512.png +sips -z 1024 1024 ${png} --out ${ico}.iconset/icon_512x512@2x.png +iconutil -c icns ${ico}.iconset +rm -rf ${ico}.iconset diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index 2db615f533..e078879f70 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -63,8 +63,6 @@ set(ALL_PACKAGES MOFFF MOLECULE MOLFILE - MPIIO - MSCG NETCDF OPENMP OPT diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 79444f96aa..3f44a863f7 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -65,8 +65,6 @@ set(ALL_PACKAGES MOFFF MOLECULE MOLFILE - MPIIO - MSCG NETCDF OPENMP OPT diff --git a/cmake/presets/download.cmake b/cmake/presets/download.cmake index 13b93569f9..d10214ca65 100644 --- a/cmake/presets/download.cmake +++ b/cmake/presets/download.cmake @@ -9,7 +9,6 @@ endforeach() set(DOWNLOAD_KIM ON CACHE BOOL "" FORCE) set(DOWNLOAD_MDI ON CACHE BOOL "" FORCE) -set(DOWNLOAD_MSCG ON CACHE BOOL "" FORCE) set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) set(DOWNLOAD_PACE ON CACHE BOOL "" FORCE) diff --git a/cmake/presets/macos-multiarch.cmake b/cmake/presets/macos-multiarch.cmake new file mode 100644 index 0000000000..58ef013f68 --- /dev/null +++ b/cmake/presets/macos-multiarch.cmake @@ -0,0 +1,14 @@ +# preset that will build portable multi-arch binaries on macOS without MPI + +set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) +set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0 CACHE STRING "" FORCE) +set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE) + +set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE) +set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) + +set(BUILD_MPI FALSE CACHE BOOL "" FORCE) +set(BUILD_SHARED_LIBS FALSE CACHE BOOL "" FORCE) +set(LAMMPS_EXCEPTIONS TRUE CACHE BOOL "" FORCE) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 85f61be95b..f3565668b2 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -83,7 +83,6 @@ endforeach() # these two packages require a full MPI implementation if(BUILD_MPI) - set(PKG_MPIIO ON CACHE BOOL "" FORCE) set(PKG_LATBOLTZ ON CACHE BOOL "" FORCE) endif() diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index 00c74c81b8..2356e24764 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -24,8 +24,8 @@ set(ALL_PACKAGES DPD-REACT DPD-SMOOTH DRUDE - ELECTRODE EFF + ELECTRODE EXTRA-COMPUTE EXTRA-DUMP EXTRA-FIX diff --git a/cmake/presets/nolib.cmake b/cmake/presets/nolib.cmake index 0e1b09b6cc..4a4a557505 100644 --- a/cmake/presets/nolib.cmake +++ b/cmake/presets/nolib.cmake @@ -19,8 +19,6 @@ set(PACKAGES_WITH_LIB ML-PACE ML-QUIP MOLFILE - MPIIO - MSCG NETCDF PLUMED PYTHON diff --git a/cmake/presets/windows.cmake b/cmake/presets/windows.cmake index aa9a4656af..9655134e7f 100644 --- a/cmake/presets/windows.cmake +++ b/cmake/presets/windows.cmake @@ -32,6 +32,7 @@ set(WIN_PACKAGES INTERLAYER KSPACE LEPTON + MACHDYN MANIFOLD MANYBODY MC @@ -45,6 +46,7 @@ set(WIN_PACKAGES MOLECULE MOLFILE OPENMP + OPT ORIENT PERI PHONON diff --git a/doc/lammps.1 b/doc/lammps.1 index 9bc107624f..79964d1680 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,7 +1,7 @@ -.TH LAMMPS "1" "15 June 2023" "2023-06-15" +.TH LAMMPS "1" "2 August 2023" "2023-08-2" .SH NAME .B LAMMPS -\- Molecular Dynamics Simulator. Version 15 June 2023 +\- Molecular Dynamics Simulator. Version 2 August 2023 .SH SYNOPSIS .B lmp diff --git a/doc/src/Bibliography.rst b/doc/src/Bibliography.rst index 2d27d2e6f9..e9ea8b0925 100644 --- a/doc/src/Bibliography.rst +++ b/doc/src/Bibliography.rst @@ -203,7 +203,7 @@ Bibliography A Caro, DA Crowson, M Caro; Phys Rev Lett, 95, 075702 (2005) **(CasP)** - CasP webpage: https://www.helmholtz-berlin.de/people/gregor-schiwietz/casp_en.html + CasP webpage: http://www.casp-program.org/ **(Cawkwell2012)** A.\ M. N. Niklasson, M. J. Cawkwell, Phys. Rev. B, 86 (17), 174308 (2012). 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..6c46f6d672 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 diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 0ecf54f744..117af4b3a3 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -52,7 +52,6 @@ This is the list of packages that may require additional steps. * :ref:`ML-POD ` * :ref:`ML-QUIP ` * :ref:`MOLFILE ` - * :ref:`MSCG ` * :ref:`NETCDF ` * :ref:`OPENMP ` * :ref:`OPT ` @@ -140,6 +139,8 @@ CMake build # value = yes or no (default) -D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active nvidia-cuda-mps daemon # value = yes or no (default) + -D CUDA_BUILD_MULTIARCH=value # enables building CUDA kernels for all supported GPU architectures + # value = yes (default) or no -D USE_STATIC_OPENCL_LOADER=value # downloads/includes OpenCL ICD loader library, no local OpenCL headers/libs needed # value = yes (default) or no @@ -158,41 +159,49 @@ CMake build A more detailed list can be found, for example, at `Wikipedia's CUDA article `_ -CMake can detect which version of the CUDA toolkit is used and thus will try -to include support for **all** major GPU architectures supported by this toolkit. -Thus the GPU_ARCH setting is merely an optimization, to have code for -the preferred GPU architecture directly included rather than having to wait -for the JIT compiler of the CUDA driver to translate it. +CMake can detect which version of the CUDA toolkit is used and thus will +try to include support for **all** major GPU architectures supported by +this toolkit. Thus the GPU_ARCH setting is merely an optimization, to +have code for the preferred GPU architecture directly included rather +than having to wait for the JIT compiler of the CUDA driver to translate +it. This behavior can be turned off (e.g. to speed up compilation) by +setting :code:`CUDA_ENABLE_MULTIARCH` to :code:`no`. -When compiling for CUDA or HIP with CUDA, version 8.0 or later of the CUDA toolkit -is required and a GPU architecture of Kepler or later, which must *also* be -supported by the CUDA toolkit in use **and** the CUDA driver in use. -When compiling for OpenCL, OpenCL version 1.2 or later is required and the -GPU must be supported by the GPU driver and OpenCL runtime bundled with the driver. +When compiling for CUDA or HIP with CUDA, version 8.0 or later of the +CUDA toolkit is required and a GPU architecture of Kepler or later, +which must *also* be supported by the CUDA toolkit in use **and** the +CUDA driver in use. When compiling for OpenCL, OpenCL version 1.2 or +later is required and the GPU must be supported by the GPU driver and +OpenCL runtime bundled with the driver. -When building with CMake, you **must NOT** build the GPU library in ``lib/gpu`` -using the traditional build procedure. CMake will detect files generated by that -process and will terminate with an error and a suggestion for how to remove them. +When building with CMake, you **must NOT** build the GPU library in +``lib/gpu`` using the traditional build procedure. CMake will detect +files generated by that process and will terminate with an error and a +suggestion for how to remove them. -If you are compiling for OpenCL, the default setting is to download, build, and -link with a static OpenCL ICD loader library and standard OpenCL headers. This -way no local OpenCL development headers or library needs to be present and only -OpenCL compatible drivers need to be installed to use OpenCL. If this is not -desired, you can set :code:`USE_STATIC_OPENCL_LOADER` to :code:`no`. +If you are compiling for OpenCL, the default setting is to download, +build, and link with a static OpenCL ICD loader library and standard +OpenCL headers. This way no local OpenCL development headers or library +needs to be present and only OpenCL compatible drivers need to be +installed to use OpenCL. If this is not desired, you can set +:code:`USE_STATIC_OPENCL_LOADER` to :code:`no`. -The GPU library has some multi-thread support using OpenMP. If LAMMPS is built -with ``-D BUILD_OMP=on`` this will also be enabled. +The GPU library has some multi-thread support using OpenMP. If LAMMPS +is built with ``-D BUILD_OMP=on`` this will also be enabled. -If you are compiling with HIP, note that before running CMake you will have to -set appropriate environment variables. Some variables such as -:code:`HCC_AMDGPU_TARGET` (for ROCm <= 4.0) or :code:`CUDA_PATH` are necessary for :code:`hipcc` -and the linker to work correctly. +If you are compiling with HIP, note that before running CMake you will +have to set appropriate environment variables. Some variables such as +:code:`HCC_AMDGPU_TARGET` (for ROCm <= 4.0) or :code:`CUDA_PATH` are +necessary for :code:`hipcc` and the linker to work correctly. -Using CHIP-SPV implementation of HIP is now supported. It allows one to run HIP -code on Intel GPUs via the OpenCL or Level Zero backends. To use CHIP-SPV, you must -set :code:`-DHIP_USE_DEVICE_SORT=OFF` in your CMake command line as CHIP-SPV does not -yet support hipCUB. The use of HIP for Intel GPUs is still experimental so you -should only use this option in preparations to run on Aurora system at ANL. +.. versionadded:: 3Aug2022 + +Using the CHIP-SPV implementation of HIP is supported. It allows one to +run HIP code on Intel GPUs via the OpenCL or Level Zero backends. To use +CHIP-SPV, you must set :code:`-DHIP_USE_DEVICE_SORT=OFF` in your CMake +command line as CHIP-SPV does not yet support hipCUB. As of Summer 2022, +the use of HIP for Intel GPUs is experimental. You should only use this +option in preparations to run on Aurora system at Argonne. .. code:: bash @@ -629,6 +638,12 @@ They must be specified in uppercase. * - VEGA90A - GPU - AMD GPU MI200 GFX90A + * - NAVI1030 + - GPU + - AMD GPU V620/W6800 + * - NAVI1100 + - GPU + - AMD GPU RX7900XTX * - INTEL_GEN - GPU - SPIR64-based devices, e.g. Intel GPUs, using JIT @@ -651,7 +666,7 @@ They must be specified in uppercase. - GPU - Intel GPU Ponte Vecchio -This list was last updated for version 3.7.1 of the Kokkos library. +This list was last updated for version 4.0.1 of the Kokkos library. .. tabs:: @@ -871,6 +886,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 @@ -921,59 +980,6 @@ Python version 3.6 or later. ---------- -.. _mscg: - -MSCG package ------------------------ - -To build with this package, you must download and build the MS-CG -library. Building the MS-CG library requires that the GSL -(GNU Scientific Library) headers and libraries are installed on your -machine. See the ``lib/mscg/README`` and ``MSCG/Install`` files for -more details. - -.. tabs:: - - .. tab:: CMake build - - .. code-block:: bash - - -D DOWNLOAD_MSCG=value # download MSCG for build, value = no (default) or yes - -D MSCG_LIBRARY=path # MSCG library file (only needed if a custom location) - -D MSCG_INCLUDE_DIR=path # MSCG include directory (only needed if a custom location) - - If ``DOWNLOAD_MSCG`` is set, the MSCG library will be downloaded - and built inside the CMake build directory. If the MSCG library - is already on your system (in a location CMake cannot find it), - ``MSCG_LIBRARY`` is the filename (plus path) of the MSCG library - file, not the directory the library file is in. - ``MSCG_INCLUDE_DIR`` is the directory the MSCG include file is in. - - .. tab:: Traditional make - - You can download and build the MS-CG library manually if you - prefer; follow the instructions in ``lib/mscg/README``\ . You can - also do it in one step from the ``lammps/src`` dir, using a - command like these, which simply invokes the - ``lib/mscg/Install.py`` script with the specified args: - - .. code-block:: bash - - make lib-mscg # print help message - make lib-mscg args="-b -m serial" # download and build in lib/mscg/MSCG-release-master - # with the settings compatible with "make serial" - make lib-mscg args="-b -m mpi" # download and build in lib/mscg/MSCG-release-master - # with the settings compatible with "make mpi" - make lib-mscg args="-p /usr/local/mscg-release" # use the existing MS-CG installation in /usr/local/mscg-release - - Note that 2 symbolic (soft) links, ``includelink`` and ``liblink``, - will be created in ``lib/mscg`` to point to the MS-CG - ``src/installation`` dir. When LAMMPS is built in src it will use - these links. You should not need to edit the - ``lib/mscg/Makefile.lammps`` file. - ----------- - .. _opt: OPT package @@ -1469,6 +1475,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 @@ -1990,55 +2045,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 @@ -2086,50 +2092,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 2328e4d1e5..bc6445f813 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -55,7 +55,6 @@ packages: * :ref:`ML-POD ` * :ref:`ML-QUIP ` * :ref:`MOLFILE ` - * :ref:`MSCG ` * :ref:`NETCDF ` * :ref:`OPENMP ` * :ref:`OPT ` diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index c2e7b94b0e..7576cae3eb 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -459,27 +459,13 @@ those systems: .. _exceptions: Exception handling when using LAMMPS as a library ------------------------------------------------------------------- +------------------------------------------------- -This setting is useful when external codes drive LAMMPS as a library. -With this option enabled, LAMMPS errors do not kill the calling code. -Instead, the call stack is unwound and control returns to the caller, -e.g. to Python. Of course, the calling code has to be set up to -*catch* exceptions thrown from within LAMMPS. - -.. tabs:: - - .. tab:: CMake build - - .. code-block:: bash - - -D LAMMPS_EXCEPTIONS=value # yes or no (default) - - .. tab:: Traditional make - - .. code-block:: make - - LMP_INC = -DLAMMPS_EXCEPTIONS +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 +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..dbd6b58ce7 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 ` 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 6fe321e3c9..5aabb7967c 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -116,7 +116,6 @@ OPT. * :doc:`momentum (k) ` * :doc:`momentum/chunk ` * :doc:`move ` - * :doc:`mscg ` * :doc:`msst ` * :doc:`mvv/dpd ` * :doc:`mvv/edpd ` diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index 1848a28024..84cc534304 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -85,6 +85,35 @@ The same functionality is available through :doc:`bond style mesocnt ` and :doc:`angle style mesocnt `. +MPIIO package +------------- + +.. deprecated:: TBD + +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 + +The MSCG package has been removed from LAMMPS since it was unmaintained +for many years and instead superseded by the `OpenMSCG software +`_ of the Voth group at the +University of Chicago, which can be used independent from LAMMPS. + REAX package ------------ diff --git a/doc/src/Developer_grid.rst b/doc/src/Developer_grid.rst index cd6d8d12ab..22eadd5da8 100644 --- a/doc/src/Developer_grid.rst +++ b/doc/src/Developer_grid.rst @@ -92,8 +92,8 @@ Arguments for these methods can be values returned by the *setup_grid()* method (described below), which define the extent of the grid cells (owned+ghost) the processor owns. These 4 methods allocate memory for 2d (first two) and 3d (second two) grid data. The -two methods that end in "_one" allocate an array which stores a single -value per grid cell. The two that end in "_multi" allocate an array +two methods that end in "_offset" allocate an array which stores a single +value per grid cell. The two that end in "_last" allocate an array which stores *Nvalues* per grid cell. .. code-block:: c++ 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/Examples.rst b/doc/src/Examples.rst index f2ca9a43ce..c5da4a498b 100644 --- a/doc/src/Examples.rst +++ b/doc/src/Examples.rst @@ -104,8 +104,6 @@ Lowercase directories +-------------+------------------------------------------------------------------+ | min | energy minimization of 2d LJ melt | +-------------+------------------------------------------------------------------+ -| mscg | parameterize a multi-scale coarse-graining (MSCG) model | -+-------------+------------------------------------------------------------------+ | msst | MSST shock dynamics | +-------------+------------------------------------------------------------------+ | multi | multi neighboring for systems with large interaction disparities | diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst index 3b9ad9d1ff..913c31842e 100644 --- a/doc/src/Fortran.rst +++ b/doc/src/Fortran.rst @@ -2278,19 +2278,13 @@ Procedures Bound to the :f:type:`lammps` Derived Type .. versionadded:: 3Nov2022 - In case of an error, LAMMPS will either abort or throw a C++ exception. - The latter has to be :ref:`enabled at compile time `. - This function checks if exceptions were enabled. - - When using the library interface with C++ exceptions enabled, the library - interface functions will "catch" them, and the error status can then be - checked by calling :f:func:`has_error`. The most recent error message can be - retrieved via :f:func:`get_last_error_message`. - This can allow one to restart a calculation or delete and recreate - the LAMMPS instance when a C++ exception occurs. One application - of using exceptions this way is the :ref:`lammps_shell`. If C++ - exceptions are disabled and an error happens during a call to - LAMMPS or the Fortran API, the application will terminate. + When using the library interface, the library interface functions + will "catch" exceptions, and then the error status can be checked by + calling :f:func:`has_error`. The most recent error message can be + retrieved via :f:func:`get_last_error_message`. This allows to + restart a calculation or delete and recreate the LAMMPS instance when + a C++ exception occurs. One application of using exceptions this way + is the :ref:`lammps_shell`. :to: :cpp:func:`lammps_config_has_exceptions` :r has_exceptions: diff --git a/doc/src/Howto.rst b/doc/src/Howto.rst index 4752cf6aea..b1f5da8abc 100644 --- a/doc/src/Howto.rst +++ b/doc/src/Howto.rst @@ -100,6 +100,7 @@ Tutorials howto Howto_cmake Howto_github + Howto_lammps_gui Howto_pylammps Howto_wsl diff --git a/doc/src/Howto_2d.rst b/doc/src/Howto_2d.rst index be223c076a..ae58711063 100644 --- a/doc/src/Howto_2d.rst +++ b/doc/src/Howto_2d.rst @@ -13,9 +13,9 @@ box with a single z plane of atoms - e.g. .. code-block:: LAMMPS - create box 1 -10 10 -10 10 -0.25 0.25 + create_box 1 -10 10 -10 10 -0.25 0.25 -If using the :doc:`read data ` command to read in a file of +If using the :doc:`read_data ` command to read in a file of atom coordinates, set the "zlo zhi" values to be finite but narrow, similar to the create_box command settings just described. For each atom in the file, assign a z coordinate so it falls inside the diff --git a/doc/src/Howto_bpm.rst b/doc/src/Howto_bpm.rst index 8b84e96b99..0ca4e85fbb 100644 --- a/doc/src/Howto_bpm.rst +++ b/doc/src/Howto_bpm.rst @@ -79,9 +79,9 @@ As bonds can be broken between neighbor list builds, the bond styles. There are two possible settings which determine how pair interactions work between bonded particles. First, one can overlay pair forces with bond forces such that all bonded particles also -feel pair interactions. This can be accomplished by using the *overlay/pair* -keyword present in all bpm bond styles and by using the following special -bond settings +feel pair interactions. This can be accomplished by setting the *overlay/pair* +keyword present in all bpm bond styles to *yes* and requires using the +following special bond settings .. code-block:: LAMMPS @@ -107,7 +107,17 @@ bond lists is expensive. By setting the lj weight for 1-2 bonds to zero, this turns off pairwise interactions. Even though there are no charges in BPM models, setting a nonzero coul weight for 1-2 bonds ensures all bonded neighbors are still included in the neighbor list -in case bonds break between neighbor list builds. +in case bonds break between neighbor list builds. If bond breakage is +disabled during a simulation run by setting the *break* keyword to *no*, +a zero coul weight for 1-2 bonds can be used to exclude bonded atoms +from the neighbor list builds + + .. code-block:: LAMMPS + + special_bonds lj 0 1 1 coul 0 1 1 + +This can be useful for post-processing, or to determine pair interaction +properties between distinct bonded particles. To monitor the fracture of bonds in the system, all BPM bond styles have the ability to record instances of bond breakage to output using diff --git a/doc/src/Howto_cmake.rst b/doc/src/Howto_cmake.rst index c997aa52bf..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. @@ -338,8 +347,6 @@ Some common LAMMPS specific variables - common compiler flags, for optimization or instrumentation (default:) * - ``LAMMPS_MACHINE`` - when set to ``name`` the LAMMPS executable and library will be called ``lmp_name`` and ``liblammps_name.a`` - * - ``LAMMPS_EXCEPTIONS`` - - when set to ``on`` errors will throw a C++ exception instead of aborting (default: ``off``) * - ``FFT`` - select which FFT library to use: ``FFTW3``, ``MKL``, ``KISS`` (default, unless FFTW3 is found) * - ``FFT_SINGLE`` @@ -412,9 +419,9 @@ interface (``ccmake`` or ``cmake-gui``). Using a preset to select a compiler package (``clang.cmake``, ``gcc.cmake``, ``intel.cmake``, ``oneapi.cmake``, or ``pgi.cmake``) - are an exception to the mechanism of updating the configuration incrementally, - as they will trigger a reset of cached internal CMake settings and thus - reset settings to their default values. + are an exception to the mechanism of updating the configuration + incrementally, as they will trigger a reset of cached internal CMake + settings and thus reset settings to their default values. Compilation and build targets ----------------------------- diff --git a/doc/src/Howto_lammps_gui.rst b/doc/src/Howto_lammps_gui.rst new file mode 100644 index 0000000000..ee190b540e --- /dev/null +++ b/doc/src/Howto_lammps_gui.rst @@ -0,0 +1,655 @@ +Using the LAMMPS GUI +==================== + +This document describes **LAMMPS GUI version 1.5**. + +----- + +LAMMPS GUI is a simple graphical text editor 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 and is +adapted in multiple ways specifically for editing LAMMPS input files. + +.. 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. The executables are linked to + a current version of LAMMPS as well. The source code for the + LAMMPS GUI is included in the ``tools/lammps-gui`` folder of the + LAMMPS distribution and it can be compiled alongside LAMMPS with + CMake. + +LAMMPS GUI tries to be 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 extract data from the created files and view them. That +procedure is quite effective and often required when running LAMMPS on +high-performance computing facilities, or 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. + +The main benefit of a GUI application is that many basic tasks can be +done directly from the GUI without switching to a text console or +requiring external programs, let alone 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. 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. + +----- + +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 hotkey `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 +