Merge branch 'develop' into collected-small-changes
This commit is contained in:
@ -1,8 +1,9 @@
|
|||||||
|
# -*- CMake -*- master configuration file for building LAMMPS
|
||||||
########################################
|
########################################
|
||||||
# CMake build system
|
# CMake build system
|
||||||
# This file is part of LAMMPS
|
# This file is part of LAMMPS
|
||||||
# Created by Christoph Junghans and Richard Berger
|
# 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 <PackageName>_ROOT but use it
|
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
||||||
if(POLICY CMP0074)
|
if(POLICY CMP0074)
|
||||||
@ -12,22 +13,11 @@ endif()
|
|||||||
if(POLICY CMP0075)
|
if(POLICY CMP0075)
|
||||||
cmake_policy(SET CMP0075 NEW)
|
cmake_policy(SET CMP0075 NEW)
|
||||||
endif()
|
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
|
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
|
||||||
if(POLICY CMP0135)
|
if(POLICY CMP0135)
|
||||||
cmake_policy(SET CMP0135 OLD)
|
cmake_policy(SET CMP0135 OLD)
|
||||||
endif()
|
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)
|
project(lammps CXX)
|
||||||
@ -203,8 +193,8 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
file(GLOB ALL_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
file(GLOB ALL_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||||
file(GLOB MAIN_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_SOURCE_DIR}/main.cpp)
|
file(GLOB MAIN_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||||
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
||||||
add_library(lammps ${ALL_SOURCES})
|
add_library(lammps ${ALL_SOURCES})
|
||||||
|
|
||||||
@ -442,7 +432,7 @@ if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_T
|
|||||||
find_package(BLAS)
|
find_package(BLAS)
|
||||||
endif()
|
endif()
|
||||||
if(NOT LAPACK_FOUND OR NOT BLAS_FOUND OR USE_INTERNAL_LINALG)
|
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})
|
add_library(linalg STATIC ${LINALG_SOURCES})
|
||||||
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
||||||
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||||
@ -460,12 +450,7 @@ option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
|||||||
if(WITH_JPEG)
|
if(WITH_JPEG)
|
||||||
find_package(JPEG REQUIRED)
|
find_package(JPEG REQUIRED)
|
||||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
||||||
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES})
|
|
||||||
else()
|
|
||||||
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(PNG QUIET)
|
find_package(PNG QUIET)
|
||||||
@ -577,8 +562,8 @@ endforeach()
|
|||||||
foreach(PKG ${STANDARD_PACKAGES})
|
foreach(PKG ${STANDARD_PACKAGES})
|
||||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
|
|
||||||
file(GLOB ${PKG}_SOURCES ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
file(GLOB ${PKG}_SOURCES CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||||
file(GLOB ${PKG}_HEADERS ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
file(GLOB ${PKG}_HEADERS CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||||
|
|
||||||
# check for package files in src directory due to old make system
|
# check for package files in src directory due to old make system
|
||||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||||
@ -605,8 +590,8 @@ endforeach()
|
|||||||
foreach(PKG ${SUFFIX_PACKAGES})
|
foreach(PKG ${SUFFIX_PACKAGES})
|
||||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
|
|
||||||
file(GLOB ${PKG}_SOURCES ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
file(GLOB ${PKG}_SOURCES CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||||
file(GLOB ${PKG}_HEADERS ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
file(GLOB ${PKG}_HEADERS CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||||
|
|
||||||
# check for package files in src directory due to old make system
|
# check for package files in src directory due to old make system
|
||||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||||
@ -620,7 +605,7 @@ endforeach()
|
|||||||
foreach(PKG_LIB POEMS ATC AWPMD H5MD)
|
foreach(PKG_LIB POEMS ATC AWPMD H5MD)
|
||||||
if(PKG_${PKG_LIB})
|
if(PKG_${PKG_LIB})
|
||||||
string(TOLOWER "${PKG_LIB}" 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)
|
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
||||||
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
||||||
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
||||||
@ -815,20 +800,11 @@ install(
|
|||||||
# This is primarily for people that only want to use the Python wrapper.
|
# This is primarily for people that only want to use the Python wrapper.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
# backward compatibility
|
||||||
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
if(PYTHON_EXECUTABLE)
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
# backward compatibility
|
|
||||||
if(PYTHON_EXECUTABLE)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
find_package(Python COMPONENTS Interpreter)
|
|
||||||
endif()
|
endif()
|
||||||
|
find_package(Python COMPONENTS Interpreter)
|
||||||
if(BUILD_IS_MULTI_CONFIG)
|
if(BUILD_IS_MULTI_CONFIG)
|
||||||
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||||
else()
|
else()
|
||||||
@ -887,13 +863,23 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
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 >>>
|
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}
|
Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
|
||||||
CMake Version: ${CMAKE_VERSION}
|
CMake Version: ${CMAKE_VERSION}
|
||||||
Build type: ${LAMMPS_BUILD_TYPE}
|
Build type: ${LAMMPS_BUILD_TYPE}
|
||||||
Install path: ${CMAKE_INSTALL_PREFIX}
|
Install path: ${CMAKE_INSTALL_PREFIX}
|
||||||
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
||||||
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
message(STATUS "Cross compiling on ${CMAKE_HOST_SYSTEM}")
|
||||||
|
endif()
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Print package summary
|
# Print package summary
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -937,11 +923,9 @@ if(_index GREATER -1)
|
|||||||
endif()
|
endif()
|
||||||
message(STATUS "<<< Linker flags: >>>")
|
message(STATUS "<<< Linker flags: >>>")
|
||||||
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
||||||
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
if(OPTIONS)
|
||||||
if(OPTIONS)
|
message(STATUS "Linker options: ${OPTIONS}")
|
||||||
message(STATUS "Linker options: ${OPTIONS}")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_EXE_LINKER_FLAGS)
|
if(CMAKE_EXE_LINKER_FLAGS)
|
||||||
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
|
|||||||
@ -1,19 +1,11 @@
|
|||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
# use default (or custom) Python executable, if version is sufficient
|
||||||
find_package(PythonInterp 3.5 QUIET) # Deprecated since version 3.12
|
if(Python_VERSION VERSION_GREATER_EQUAL 3.6)
|
||||||
if(PYTHONINTERP_FOUND)
|
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
||||||
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)
|
|
||||||
endif()
|
endif()
|
||||||
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
|
|
||||||
if(Python3_EXECUTABLE)
|
if(Python3_EXECUTABLE)
|
||||||
if(Python3_VERSION VERSION_GREATER_EQUAL 3.5)
|
if(Python3_VERSION VERSION_GREATER_EQUAL 3.6)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
check-whitespace
|
check-whitespace
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
||||||
|
|||||||
@ -5,24 +5,18 @@ option(BUILD_DOC "Build LAMMPS HTML documentation" OFF)
|
|||||||
|
|
||||||
if(BUILD_DOC)
|
if(BUILD_DOC)
|
||||||
# Current Sphinx versions require at least Python 3.8
|
# Current Sphinx versions require at least Python 3.8
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
# use default (or custom) Python executable, if version is sufficient
|
||||||
find_package(PythonInterp 3.8 REQUIRED)
|
if(Python_VERSION VERSION_GREATER_EQUAL 3.8)
|
||||||
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv)
|
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
||||||
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)
|
|
||||||
endif()
|
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)
|
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(
|
add_custom_command(
|
||||||
OUTPUT docenv
|
OUTPUT docenv
|
||||||
@ -80,7 +74,7 @@ if(BUILD_DOC)
|
|||||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
||||||
endif()
|
endif()
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
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)
|
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -7,15 +7,7 @@
|
|||||||
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
|
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
find_package(Python 3.6 COMPONENTS Interpreter QUIET)
|
||||||
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()
|
|
||||||
|
|
||||||
# Use the Cython executable that lives next to the Python executable
|
# Use the Cython executable that lives next to the Python executable
|
||||||
# if it is a local installation.
|
# if it is a local installation.
|
||||||
|
|||||||
@ -63,7 +63,7 @@ endfunction(validate_option)
|
|||||||
|
|
||||||
# helper function for getting the most recently modified file or folder from a glob pattern
|
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||||
function(get_newest_file path variable)
|
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(_besttime 2000-01-01T00:00:00)
|
||||||
set(_bestfile "<unknown>")
|
set(_bestfile "<unknown>")
|
||||||
foreach(_dir ${_dirs})
|
foreach(_dir ${_dirs})
|
||||||
|
|||||||
@ -41,7 +41,7 @@ endfunction()
|
|||||||
|
|
||||||
# helper function for getting the most recently modified file or folder from a glob pattern
|
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||||
function(get_newest_file path variable)
|
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(_besttime 2000-01-01T00:00:00)
|
||||||
set(_bestfile "<unknown>")
|
set(_bestfile "<unknown>")
|
||||||
foreach(_dir ${_dirs})
|
foreach(_dir ${_dirs})
|
||||||
@ -80,8 +80,8 @@ endfunction()
|
|||||||
|
|
||||||
function(check_for_autogen_files source_dir)
|
function(check_for_autogen_files source_dir)
|
||||||
message(STATUS "Running check for auto-generated files from make-based build system")
|
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_FILES CONFIGURE_DEPENDS ${source_dir}/style_*.h)
|
||||||
file(GLOB SRC_AUTOGEN_PACKAGES ${CONFIGURE_DEPENDS} ${source_dir}/packages_*.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}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h)
|
||||||
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
|
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
|
||||||
foreach(_SRC ${SRC_AUTOGEN_FILES})
|
foreach(_SRC ${SRC_AUTOGEN_FILES})
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
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)
|
option(COLVARS_DEBUG "Enable debugging messages for Colvars (quite verbose)" OFF)
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ if (PKG_AMOEBA)
|
|||||||
${GPU_SOURCES_DIR}/amoeba_convolution_gpu.cpp)
|
${GPU_SOURCES_DIR}/amoeba_convolution_gpu.cpp)
|
||||||
endif()
|
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)
|
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
|
|
||||||
if(GPU_API STREQUAL "CUDA")
|
if(GPU_API STREQUAL "CUDA")
|
||||||
@ -70,7 +70,7 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
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
|
# 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)
|
if(GPU_LIB_OLD_CUBIN_HEADERS)
|
||||||
message(FATAL_ERROR "########################################################################\n"
|
message(FATAL_ERROR "########################################################################\n"
|
||||||
"Found file(s) generated by the make-based build system in lib/gpu\n"
|
"Found file(s) generated by the make-based build system in lib/gpu\n"
|
||||||
@ -80,15 +80,15 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
"########################################################################")
|
"########################################################################")
|
||||||
endif()
|
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)
|
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)
|
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
|
|
||||||
if(CUDPP_OPT)
|
if(CUDPP_OPT)
|
||||||
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
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_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_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
||||||
@ -205,7 +205,7 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
include(OpenCLUtils)
|
include(OpenCLUtils)
|
||||||
set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h)
|
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
|
list(REMOVE_ITEM GPU_LIB_CU
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu
|
||||||
@ -335,7 +335,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
endif()
|
endif()
|
||||||
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)
|
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||||
|
|
||||||
set(GPU_LIB_CU_HIP "")
|
set(GPU_LIB_CU_HIP "")
|
||||||
|
|||||||
@ -1,12 +1,7 @@
|
|||||||
set(KIM-API_MIN_VERSION 2.1.3)
|
set(KIM-API_MIN_VERSION 2.1.3)
|
||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
if(CURL_FOUND)
|
if(CURL_FOUND)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
||||||
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_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
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.")
|
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)
|
mark_as_advanced(LMP_DEBUG_CURL)
|
||||||
|
|||||||
@ -156,7 +156,7 @@ if(PKG_ML-IAP)
|
|||||||
|
|
||||||
# Add KOKKOS version of ML-IAP Python coupling if non-KOKKOS version is included
|
# Add KOKKOS version of ML-IAP Python coupling if non-KOKKOS version is included
|
||||||
if(MLIAP_ENABLE_PYTHON AND Cythonize_EXECUTABLE)
|
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})
|
foreach(MLIAP_CYTHON_FILE ${MLIAP_KOKKOS_CYTHON_SRC})
|
||||||
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE)
|
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
|
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
||||||
|
|||||||
@ -4,7 +4,7 @@ if(LEPTON_SOURCE_DIR)
|
|||||||
endif()
|
endif()
|
||||||
set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton)
|
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
|
if((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64") OR
|
||||||
(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") OR
|
(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") OR
|
||||||
@ -15,7 +15,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LEPTON_ENABLE_JIT)
|
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()
|
endif()
|
||||||
|
|
||||||
add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES})
|
add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES})
|
||||||
|
|||||||
@ -26,29 +26,9 @@ if(DOWNLOAD_MDI)
|
|||||||
|
|
||||||
# detect if we have python development support and thus can enable python plugins
|
# detect if we have python development support and thus can enable python plugins
|
||||||
set(MDI_USE_PYTHON_PLUGINS OFF)
|
set(MDI_USE_PYTHON_PLUGINS OFF)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
find_package(Python QUIET COMPONENTS Development)
|
||||||
if(NOT PYTHON_VERSION_STRING)
|
if(Python_Development_FOUND)
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
set(MDI_USE_PYTHON_PLUGINS ON)
|
||||||
# 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()
|
|
||||||
endif()
|
endif()
|
||||||
# python plugins are not supported and thus must be always off on Windows
|
# python plugins are not supported and thus must be always off on Windows
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
@ -102,13 +82,9 @@ if(DOWNLOAD_MDI)
|
|||||||
# if compiling with python plugins we need
|
# if compiling with python plugins we need
|
||||||
# to add python libraries as dependency.
|
# to add python libraries as dependency.
|
||||||
if(MDI_USE_PYTHON_PLUGINS)
|
if(MDI_USE_PYTHON_PLUGINS)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
list(APPEND MDI_DEP_LIBS Python::Python)
|
||||||
list(APPEND MDI_DEP_LIBS ${PYTHON_LIBRARIES})
|
|
||||||
else()
|
|
||||||
list(APPEND MDI_DEP_LIBS Python::Python)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
||||||
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
||||||
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
||||||
|
|||||||
@ -2,12 +2,7 @@
|
|||||||
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
||||||
if(PKG_PYTHON)
|
if(PKG_PYTHON)
|
||||||
find_package(Cythonize QUIET)
|
find_package(Cythonize QUIET)
|
||||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
|
find_package(Python COMPONENTS NumPy QUIET)
|
||||||
find_package(Python COMPONENTS NumPy QUIET)
|
|
||||||
else()
|
|
||||||
# assume we have NumPy
|
|
||||||
set(Python_NumPy_FOUND ON)
|
|
||||||
endif()
|
|
||||||
if(Cythonize_FOUND AND Python_NumPy_FOUND)
|
if(Cythonize_FOUND AND Python_NumPy_FOUND)
|
||||||
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
@ -17,24 +12,16 @@ option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_EN
|
|||||||
|
|
||||||
if(MLIAP_ENABLE_PYTHON)
|
if(MLIAP_ENABLE_PYTHON)
|
||||||
find_package(Cythonize REQUIRED)
|
find_package(Cythonize REQUIRED)
|
||||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
|
find_package(Python COMPONENTS NumPy REQUIRED)
|
||||||
find_package(Python COMPONENTS NumPy REQUIRED)
|
|
||||||
endif()
|
|
||||||
if(NOT PKG_PYTHON)
|
if(NOT PKG_PYTHON)
|
||||||
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
if(Python_VERSION VERSION_LESS 3.6)
|
||||||
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6)
|
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
||||||
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()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
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})
|
file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR})
|
||||||
foreach(MLIAP_CYTHON_FILE ${MLIAP_CYTHON_SRC})
|
foreach(MLIAP_CYTHON_FILE ${MLIAP_CYTHON_SRC})
|
||||||
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE)
|
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE)
|
||||||
|
|||||||
@ -1,29 +1,11 @@
|
|||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
if(NOT PYTHON_VERSION_STRING)
|
if(NOT Python_INTERPRETER)
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
# backward compatibility
|
||||||
# search for interpreter first, so we have a consistent library
|
if(PYTHON_EXECUTABLE)
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
# search for the library matching the selected interpreter
|
find_package(Python COMPONENTS Interpreter)
|
||||||
set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
|
|
||||||
find_package(PythonLibs REQUIRED) # Deprecated since version 3.12
|
|
||||||
if(NOT (PYTHON_VERSION_STRING STREQUAL PYTHONLIBS_VERSION_STRING))
|
|
||||||
message(FATAL_ERROR "Python Library version ${PYTHONLIBS_VERSION_STRING} does not match Interpreter version ${PYTHON_VERSION_STRING}")
|
|
||||||
endif()
|
|
||||||
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES})
|
|
||||||
else()
|
|
||||||
if(NOT Python_INTERPRETER)
|
|
||||||
# backward compatibility
|
|
||||||
if(PYTHON_EXECUTABLE)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
find_package(Python COMPONENTS Interpreter)
|
|
||||||
endif()
|
|
||||||
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
|
||||||
target_link_libraries(lammps PRIVATE Python::Python)
|
|
||||||
endif()
|
endif()
|
||||||
|
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
||||||
|
target_link_libraries(lammps PRIVATE Python::Python)
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
function(FindStyleHeaders path style_class file_pattern headers)
|
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})
|
get_property(hlist GLOBAL PROPERTY ${headers})
|
||||||
|
|
||||||
foreach(file_name ${files})
|
foreach(file_name ${files})
|
||||||
@ -187,7 +187,7 @@ endfunction(DetectBuildSystemConflict)
|
|||||||
|
|
||||||
|
|
||||||
function(FindPackagesHeaders path style_class file_pattern headers)
|
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})
|
get_property(plist GLOBAL PROPERTY ${headers})
|
||||||
|
|
||||||
foreach(file_name ${files})
|
foreach(file_name ${files})
|
||||||
|
|||||||
@ -6,7 +6,7 @@ if(ENABLE_TESTING)
|
|||||||
find_program(VALGRIND_BINARY NAMES valgrind)
|
find_program(VALGRIND_BINARY NAMES valgrind)
|
||||||
# generate custom suppression file
|
# generate custom suppression file
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "\n")
|
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})
|
foreach(SUPP ${VALGRIND_SUPPRESSION_FILES})
|
||||||
file(READ ${SUPP} SUPPRESSIONS)
|
file(READ ${SUPP} SUPPRESSIONS)
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/lammps.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
|
# 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.
|
# 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)
|
# 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")))
|
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
||||||
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND
|
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND
|
||||||
((CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04) OR (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04)))
|
((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)
|
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
||||||
mark_as_advanced(ENABLE_COVERAGE)
|
mark_as_advanced(ENABLE_COVERAGE)
|
||||||
if(ENABLE_COVERAGE)
|
if(ENABLE_COVERAGE)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
target_compile_options(lammps PUBLIC --coverage)
|
||||||
if(CMAKE_CXX_FLAGS)
|
target_link_options(lammps PUBLIC --coverage)
|
||||||
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()
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -118,16 +110,8 @@ validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
|
|||||||
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
||||||
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
||||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
if(CMAKE_CXX_FLAGS)
|
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
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()
|
|
||||||
else()
|
else()
|
||||||
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
||||||
set(ENABLE_SANITIZER "none")
|
set(ENABLE_SANITIZER "none")
|
||||||
|
|||||||
@ -26,7 +26,7 @@ if(BUILD_TOOLS)
|
|||||||
|
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
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})
|
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
||||||
if(STANDARD_MATH_LIB)
|
if(STANDARD_MATH_LIB)
|
||||||
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
||||||
|
|||||||
@ -16,8 +16,7 @@ environments is on a :doc:`separate page <Howto_cmake>`.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
LAMMPS currently requires that CMake version 3.10 or later is available;
|
LAMMPS currently requires that CMake version 3.16 or later is available.
|
||||||
version 3.12 or later is preferred.
|
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
@ -34,19 +33,18 @@ Advantages of using CMake
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
CMake is an alternative to compiling LAMMPS in the traditional way
|
CMake is an alternative to compiling LAMMPS in the traditional way
|
||||||
through :doc:`(manually customized) makefiles <Build_make>` and a recent
|
through :doc:`(manually customized) makefiles <Build_make>`. Using
|
||||||
addition to LAMMPS thanks to the efforts of Christoph Junghans (LANL)
|
CMake has multiple advantages that are specifically helpful for
|
||||||
and Richard Berger (Temple U). Using CMake has multiple advantages that
|
people with limited experience in compiling software or for people
|
||||||
are specifically helpful for people with limited experience in compiling
|
that want to modify or extend LAMMPS.
|
||||||
software or for people that want to modify or extend LAMMPS.
|
|
||||||
|
|
||||||
- CMake can detect available hardware, tools, features, and libraries
|
- CMake can detect available hardware, tools, features, and libraries
|
||||||
and adapt the LAMMPS default build configuration accordingly.
|
and adapt the LAMMPS default build configuration accordingly.
|
||||||
- CMake can generate files for different build tools and integrated
|
- CMake can generate files for different build tools and integrated
|
||||||
development environments (IDE).
|
development environments (IDE).
|
||||||
- CMake supports customization of settings with a command line, text
|
- CMake supports customization of settings with a command line, text
|
||||||
mode, or graphical user interface. No knowledge of file formats or
|
mode, or graphical user interface. No manual editing of files,
|
||||||
complex command line syntax is required.
|
knowledge of file formats or complex command line syntax is required.
|
||||||
- All enabled components are compiled in a single build operation.
|
- All enabled components are compiled in a single build operation.
|
||||||
- Automated dependency tracking for all files and configuration options.
|
- Automated dependency tracking for all files and configuration options.
|
||||||
- Support for true out-of-source compilation. Multiple configurations
|
- Support for true out-of-source compilation. Multiple configurations
|
||||||
|
|||||||
@ -91,6 +91,7 @@ KOKKOS, o = OPENMP, t = OPT.
|
|||||||
* :doc:`ke/atom/eff <compute_ke_atom_eff>`
|
* :doc:`ke/atom/eff <compute_ke_atom_eff>`
|
||||||
* :doc:`ke/eff <compute_ke_eff>`
|
* :doc:`ke/eff <compute_ke_eff>`
|
||||||
* :doc:`ke/rigid <compute_ke_rigid>`
|
* :doc:`ke/rigid <compute_ke_rigid>`
|
||||||
|
* :doc:`local/comp/atom (k) <compute_local_comp_atom>`
|
||||||
* :doc:`mliap <compute_mliap>`
|
* :doc:`mliap <compute_mliap>`
|
||||||
* :doc:`momentum <compute_momentum>`
|
* :doc:`momentum <compute_momentum>`
|
||||||
* :doc:`msd <compute_msd>`
|
* :doc:`msd <compute_msd>`
|
||||||
|
|||||||
@ -3,9 +3,9 @@ Using CMake with LAMMPS tutorial
|
|||||||
|
|
||||||
The support for building LAMMPS with CMake is a recent addition to
|
The support for building LAMMPS with CMake is a recent addition to
|
||||||
LAMMPS thanks to the efforts of Christoph Junghans (LANL) and Richard
|
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
|
Berger (LANL). 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
|
tied to a specific platform or build system and thus it generates the
|
||||||
necessary to build and develop for different build systems and on
|
files necessary to build and develop for different build systems and on
|
||||||
different platforms. Note, that this applies to the build system itself
|
different platforms. Note, that this applies to the build system itself
|
||||||
not the LAMMPS code. In other words, without additional porting effort,
|
not the LAMMPS code. In other words, without additional porting effort,
|
||||||
it is not possible - for example - to compile LAMMPS with Visual C++ on
|
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,
|
environments (IDE) like Eclipse, Visual Studio, QtCreator, Xcode,
|
||||||
CodeBlocks, Kate and others.
|
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
|
available libraries, optimal settings, available support tools and so
|
||||||
on, so that by default LAMMPS will take advantage of available tools
|
on, so that by default LAMMPS will take advantage of available tools
|
||||||
without requiring to provide the details about how to enable/integrate
|
without requiring to provide the details about how to enable/integrate
|
||||||
@ -32,8 +32,7 @@ program ``cmake`` (or ``cmake3``), a text mode interactive user
|
|||||||
interface (TUI) program ``ccmake`` (or ``ccmake3``), or a graphical user
|
interface (TUI) program ``ccmake`` (or ``ccmake3``), or a graphical user
|
||||||
interface (GUI) program ``cmake-gui``. All of them are portable
|
interface (GUI) program ``cmake-gui``. All of them are portable
|
||||||
software available on all supported platforms and can be used
|
software available on all supported platforms and can be used
|
||||||
interchangeably. The minimum supported CMake version is 3.10 (3.12 or
|
interchangeably. The minimum required CMake version is 3.16.
|
||||||
later is recommended).
|
|
||||||
|
|
||||||
All details about features and settings for CMake are in the `CMake
|
All details about features and settings for CMake are in the `CMake
|
||||||
online documentation <https://cmake.org/documentation/>`_. We focus
|
online documentation <https://cmake.org/documentation/>`_. We focus
|
||||||
@ -43,11 +42,20 @@ Prerequisites
|
|||||||
-------------
|
-------------
|
||||||
|
|
||||||
This tutorial assumes that you are operating in a command-line environment
|
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
|
- Linux: any Terminal window will work or text console
|
||||||
- macOS: launch the Terminal application.
|
- macOS: launch the Terminal application
|
||||||
- Windows 10: install and run the :doc:`Windows Subsystem for Linux <Howto_wsl>`
|
- Windows 10 or 11: install and run the :doc:`Windows Subsystem for Linux <Howto_wsl>`
|
||||||
|
- 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
|
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.
|
or used Git to create a clone of the LAMMPS sources on your compilation machine.
|
||||||
|
|||||||
@ -25,7 +25,7 @@ LAMMPS can be compiled from source code using a (traditional) build
|
|||||||
system based on shell scripts, a few shell utilities (grep, sed, cat,
|
system based on shell scripts, a few shell utilities (grep, sed, cat,
|
||||||
tr) and the GNU make program. This requires running within a Bourne
|
tr) and the GNU make program. This requires running within a Bourne
|
||||||
shell (``/bin/sh``). Alternatively, a build system with different back ends
|
shell (``/bin/sh``). Alternatively, a build system with different back ends
|
||||||
can be created using CMake. CMake must be at least version 3.10.
|
can be created using CMake. CMake must be at least version 3.16.
|
||||||
|
|
||||||
Operating systems
|
Operating systems
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
@ -62,9 +62,9 @@ regularly tested.
|
|||||||
Portability compliance
|
Portability compliance
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Only a subset of the LAMMPS source code is fully compliant to all of the
|
Only a subset of the LAMMPS source code is *fully* compliant to *all*
|
||||||
above mentioned standards. This is rather typical for projects like
|
of the above mentioned standards. This is rather typical for projects
|
||||||
LAMMPS that largely depend on contributions from the user community.
|
like LAMMPS that largely depend on contributions from the user community.
|
||||||
Not all contributors are trained as programmers and not all of them have
|
Not all contributors are trained as programmers and not all of them have
|
||||||
access to multiple platforms for testing. As part of the continuous
|
access to multiple platforms for testing. As part of the continuous
|
||||||
integration process, however, all contributions are automatically tested
|
integration process, however, all contributions are automatically tested
|
||||||
|
|||||||
@ -245,6 +245,7 @@ The individual style names on the :doc:`Commands compute <Commands_compute>` pag
|
|||||||
* :doc:`ke/atom/eff <compute_ke_atom_eff>` - per-atom translational and radial kinetic energy in the electron force field model
|
* :doc:`ke/atom/eff <compute_ke_atom_eff>` - per-atom translational and radial kinetic energy in the electron force field model
|
||||||
* :doc:`ke/eff <compute_ke_eff>` - kinetic energy of a group of nuclei and electrons in the electron force field model
|
* :doc:`ke/eff <compute_ke_eff>` - kinetic energy of a group of nuclei and electrons in the electron force field model
|
||||||
* :doc:`ke/rigid <compute_ke_rigid>` - translational kinetic energy of rigid bodies
|
* :doc:`ke/rigid <compute_ke_rigid>` - translational kinetic energy of rigid bodies
|
||||||
|
* :doc:`local/comp/atom <compute_local_comp_atom>` - local composition for each atom
|
||||||
* :doc:`mliap <compute_mliap>` - gradients of energy and forces with respect to model parameters and related quantities for training machine learning interatomic potentials
|
* :doc:`mliap <compute_mliap>` - gradients of energy and forces with respect to model parameters and related quantities for training machine learning interatomic potentials
|
||||||
* :doc:`momentum <compute_momentum>` - translational momentum
|
* :doc:`momentum <compute_momentum>` - translational momentum
|
||||||
* :doc:`msd <compute_msd>` - mean-squared displacement of group of atoms
|
* :doc:`msd <compute_msd>` - mean-squared displacement of group of atoms
|
||||||
|
|||||||
118
doc/src/compute_local_comp_atom.rst
Normal file
118
doc/src/compute_local_comp_atom.rst
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
.. index:: compute local/comp/atom
|
||||||
|
.. index:: compute local/comp/atom/kk
|
||||||
|
|
||||||
|
compute local/comp/atom command
|
||||||
|
===============================
|
||||||
|
|
||||||
|
Accelerator Variants: *local/comp/atom/kk*
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
""""""
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
compute ID group-ID local/comp/atom keyword values ...
|
||||||
|
|
||||||
|
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||||
|
* local/comp/atom = style name of this compute command
|
||||||
|
* one or more keyword/value pairs may be appended
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
keyword = *cutoff*
|
||||||
|
*cutoff* value = distance cutoff
|
||||||
|
|
||||||
|
Examples
|
||||||
|
""""""""
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
compute 1 all local/comp/atom
|
||||||
|
|
||||||
|
compute 1 all local/comp/atom cutoff 9.0
|
||||||
|
comm_modify cutoff 9.0
|
||||||
|
|
||||||
|
|
||||||
|
Description
|
||||||
|
"""""""""""
|
||||||
|
|
||||||
|
.. versionadded:: TBD
|
||||||
|
|
||||||
|
Define a computation that calculates a local composition vector for each
|
||||||
|
atom. For a central atom with :math:`M` neighbors within the neighbor cutoff sphere,
|
||||||
|
composition is defined as the number of atoms of a given type
|
||||||
|
(including the central atom) divided by (:math:`M+1`). For a given central atom,
|
||||||
|
the sum of all compositions equals one.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This compute uses the number of atom types, not chemical species, assigned in
|
||||||
|
:doc:`pair_coeff <pair_coeff>` command. If an interatomic potential has two
|
||||||
|
species (i.e., Cu and Ni) assigned to four different atom types in
|
||||||
|
:doc:`pair_coeff <pair_coeff>` (i.e., 'Cu Cu Ni Ni'), the compute will
|
||||||
|
output four fractional values. In those cases, the user may desire an extra
|
||||||
|
calculation step to consolidate per-type fractions into per-species fractions.
|
||||||
|
This calculation can be conducted within LAMMPS using another compute such as
|
||||||
|
:doc:`compute reduce <compute_reduce>`, an atom-style :doc:`variable`, or as a
|
||||||
|
post-processing step.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
The optional keyword *cutoff* defines the distance cutoff used when
|
||||||
|
searching for neighbors. The default value is the cutoff specified by
|
||||||
|
the pair style. If no pair style is defined, then a cutoff must be
|
||||||
|
defined using this keyword. If the specified cutoff is larger than
|
||||||
|
that of the pair_style plus neighbor skin (or no pair style is
|
||||||
|
defined), the *comm_modify cutoff* option must also be set to match
|
||||||
|
that of the *cutoff* keyword.
|
||||||
|
|
||||||
|
The neighbor list needed to compute this quantity is constructed each
|
||||||
|
time the calculation is performed (i.e. each time a snapshot of atoms
|
||||||
|
is dumped). Thus it can be inefficient to compute/dump this quantity
|
||||||
|
too frequently.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If you have a bonded system, then the settings of
|
||||||
|
:doc:`special_bonds <special_bonds>` command can remove pairwise
|
||||||
|
interactions between atoms in the same bond, angle, or dihedral.
|
||||||
|
This is the default setting for the :doc:`special_bonds
|
||||||
|
<special_bonds>` command, and means those pairwise interactions do
|
||||||
|
not appear in the neighbor list. Because this compute uses the
|
||||||
|
neighbor list, it also means those pairs will not be included in
|
||||||
|
the order parameter. This difficulty can be circumvented by
|
||||||
|
writing a dump file, and using the :doc:`rerun <rerun>` command to
|
||||||
|
compute the order parameter for snapshots in the dump file. The
|
||||||
|
rerun script can use a :doc:`special_bonds <special_bonds>` command
|
||||||
|
that includes all pairs in the neighbor list.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
Output info
|
||||||
|
"""""""""""
|
||||||
|
|
||||||
|
This compute calculates a per-atom array with :math:`1 + N` columns, where :math:`N`
|
||||||
|
is the number of atom types. The first column is a count of the number of atoms
|
||||||
|
used to calculate composition (including the central atom), and each subsequent
|
||||||
|
column indicates the fraction of that atom type within the cutoff sphere.
|
||||||
|
|
||||||
|
These values can be accessed by any command that uses per-atom values
|
||||||
|
from a compute as input. See the :doc:`Howto output <Howto_output>`
|
||||||
|
doc page for an overview of LAMMPS output options.
|
||||||
|
|
||||||
|
Restrictions
|
||||||
|
""""""""""""
|
||||||
|
|
||||||
|
This compute is part of the EXTRA-COMPUTE package. It is only enabled
|
||||||
|
if LAMMPS was built with that package. See the :doc:`Build package
|
||||||
|
<Build_package>` page for more info.
|
||||||
|
|
||||||
|
Related commands
|
||||||
|
""""""""""""""""
|
||||||
|
|
||||||
|
:doc:`comm_modify <comm_modify>`
|
||||||
|
|
||||||
|
Default
|
||||||
|
"""""""
|
||||||
|
|
||||||
|
The option defaults are *cutoff* = pair style cutoff.
|
||||||
@ -3621,6 +3621,7 @@ Tk
|
|||||||
Tkin
|
Tkin
|
||||||
tloop
|
tloop
|
||||||
tlsph
|
tlsph
|
||||||
|
tm
|
||||||
tmax
|
tmax
|
||||||
Tmax
|
Tmax
|
||||||
tmd
|
tmd
|
||||||
@ -4093,6 +4094,7 @@ zmq
|
|||||||
zN
|
zN
|
||||||
zs
|
zs
|
||||||
zsc
|
zsc
|
||||||
|
Zsh
|
||||||
zst
|
zst
|
||||||
Zstandard
|
Zstandard
|
||||||
zstd
|
zstd
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
##########################################
|
# -*- CMake -*- file for example programs that use the LAMMPS library
|
||||||
# CMake build system for coupling to the LAMMPS library
|
|
||||||
# where the library is loaded dynamically at runtime.
|
# where the library is loaded dynamically at runtime.
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
# enforce out-of-source build
|
# enforce out-of-source build
|
||||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
# -*- CMake -*- file for simple examples using the LAMMPS library interface
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
# enforce out-of-source build
|
# enforce out-of-source build
|
||||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
##########################################
|
# -*- CMake -*- build system for plugin examples.
|
||||||
# CMake build system for plugin examples.
|
|
||||||
# The is meant to be used as a template for plugins that are
|
# The is meant to be used as a template for plugins that are
|
||||||
# distributed independent from the LAMMPS package.
|
# distributed independent from the LAMMPS package.
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(paceplugin VERSION 1.0 LANGUAGES CXX)
|
project(paceplugin VERSION 1.0 LANGUAGES CXX)
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
##########################################
|
# -*- CMake -*- file for building plugins.
|
||||||
# CMake build system for plugin examples.
|
|
||||||
# The is meant to be used as a template for plugins that are
|
# The is meant to be used as a template for plugins that are
|
||||||
# distributed independent from the LAMMPS package.
|
# distributed independent from the LAMMPS package.
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(kimplugin VERSION 1.0 LANGUAGES CXX)
|
project(kimplugin VERSION 1.0 LANGUAGES CXX)
|
||||||
|
|
||||||
@ -31,12 +30,7 @@ target_link_libraries(kimplugin PRIVATE KIM-API::kim-api)
|
|||||||
# need libcurl
|
# need libcurl
|
||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
if(CURL_FOUND)
|
if(CURL_FOUND)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
target_link_libraries(kimplugin PRIVATE CURL::libcurl)
|
||||||
target_include_directories(kimplugin PRIVATE ${CURL_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(kimplugin PRIVATE ${CURL_LIBRARIES})
|
|
||||||
else()
|
|
||||||
target_link_libraries(kimplugin PRIVATE CURL::libcurl)
|
|
||||||
endif()
|
|
||||||
target_compile_definitions(kimplugin PRIVATE -DLMP_KIM_CURL)
|
target_compile_definitions(kimplugin 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.")
|
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)
|
mark_as_advanced(LMP_DEBUG_CURL)
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
##########################################
|
# -*- CMake -*- file for plugin examples.
|
||||||
# CMake build system for plugin examples.
|
|
||||||
# The is meant to be used as a template for plugins that are
|
# The is meant to be used as a template for plugins that are
|
||||||
# distributed independent from the LAMMPS package.
|
# distributed independent from the LAMMPS package.
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
# enforce out-of-source build
|
# enforce out-of-source build
|
||||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
|||||||
2
src/.gitignore
vendored
2
src/.gitignore
vendored
@ -580,6 +580,8 @@
|
|||||||
/compute_ke_eff.h
|
/compute_ke_eff.h
|
||||||
/compute_ke_rigid.cpp
|
/compute_ke_rigid.cpp
|
||||||
/compute_ke_rigid.h
|
/compute_ke_rigid.h
|
||||||
|
/compute_local_comp_atom.cpp
|
||||||
|
/compute_local_comp_atom.h
|
||||||
/compute_meso_e_atom.cpp
|
/compute_meso_e_atom.cpp
|
||||||
/compute_meso_e_atom.h
|
/compute_meso_e_atom.h
|
||||||
/compute_meso_rho_atom.cpp
|
/compute_meso_rho_atom.cpp
|
||||||
|
|||||||
214
src/EXTRA-COMPUTE/compute_local_comp_atom.cpp
Normal file
214
src/EXTRA-COMPUTE/compute_local_comp_atom.cpp
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
|
LAMMPS development team: developers@lammps.org
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Megan McCarthy (SNL)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "compute_local_comp_atom.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "domain.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "math_const.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "neigh_list.h"
|
||||||
|
#include "neigh_request.h"
|
||||||
|
#include "neighbor.h"
|
||||||
|
#include "pair.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
using namespace MathConst;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ComputeLocalCompAtom::ComputeLocalCompAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
Compute(lmp, narg, arg), result(nullptr)
|
||||||
|
{
|
||||||
|
if (narg < 3 || narg > 5) error->all(FLERR, "Illegal compute local/comp/atom command");
|
||||||
|
|
||||||
|
cutoff = 0.0;
|
||||||
|
|
||||||
|
int iarg = 3;
|
||||||
|
while (iarg < narg) {
|
||||||
|
if (strcmp(arg[iarg], "cutoff") == 0) {
|
||||||
|
if (iarg + 2 > narg) error->all(FLERR, "Illegal compute local/comp/atom command");
|
||||||
|
cutoff = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
||||||
|
if (cutoff <= 0.0) error->all(FLERR, "Illegal compute local/comp/atom command");
|
||||||
|
iarg += 2;
|
||||||
|
} else
|
||||||
|
error->all(FLERR, "Illegal compute local/comp/atom command");
|
||||||
|
}
|
||||||
|
|
||||||
|
peratom_flag = 1;
|
||||||
|
|
||||||
|
ntypes = atom->ntypes;
|
||||||
|
size_peratom_cols = 1 + ntypes;
|
||||||
|
|
||||||
|
nmax = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ComputeLocalCompAtom::~ComputeLocalCompAtom()
|
||||||
|
{
|
||||||
|
if (copymode) return;
|
||||||
|
|
||||||
|
memory->destroy(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ComputeLocalCompAtom::init()
|
||||||
|
{
|
||||||
|
if (!force->pair && cutoff == 0.0)
|
||||||
|
error->all(FLERR,
|
||||||
|
"Compute local/comp/atom requires a cutoff be specified "
|
||||||
|
"or a pair style be defined");
|
||||||
|
|
||||||
|
double skin = neighbor->skin;
|
||||||
|
if (cutoff != 0.0) {
|
||||||
|
double cutghost; // as computed by Neighbor and Comm
|
||||||
|
if (force->pair)
|
||||||
|
cutghost = MAX(force->pair->cutforce + skin, comm->cutghostuser);
|
||||||
|
else
|
||||||
|
cutghost = comm->cutghostuser;
|
||||||
|
|
||||||
|
if (cutoff > cutghost)
|
||||||
|
error->all(FLERR,
|
||||||
|
"Compute local/comp/atom cutoff exceeds ghost atom range - "
|
||||||
|
"use comm_modify cutoff command");
|
||||||
|
}
|
||||||
|
|
||||||
|
int cutflag = 1;
|
||||||
|
if (force->pair) {
|
||||||
|
if (cutoff == 0.0) { cutoff = force->pair->cutforce; }
|
||||||
|
if (cutoff <= force->pair->cutforce + skin) cutflag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
cutsq = cutoff * cutoff;
|
||||||
|
|
||||||
|
// need an occasional full neighbor list
|
||||||
|
|
||||||
|
auto req = neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||||
|
if (cutflag) req->set_cutoff(cutoff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ComputeLocalCompAtom::init_list(int /*id*/, NeighList *ptr)
|
||||||
|
{
|
||||||
|
list = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ComputeLocalCompAtom::compute_peratom()
|
||||||
|
{
|
||||||
|
int i, j, ii, jj, inum, jnum;
|
||||||
|
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
|
||||||
|
int *ilist, *jlist, *numneigh, **firstneigh;
|
||||||
|
int count, itype, jtype;
|
||||||
|
|
||||||
|
invoked_peratom = update->ntimestep;
|
||||||
|
|
||||||
|
// grow result array if necessary
|
||||||
|
|
||||||
|
if (atom->nmax > nmax) {
|
||||||
|
memory->destroy(result);
|
||||||
|
nmax = atom->nmax;
|
||||||
|
memory->create(result, nmax, size_peratom_cols, "local/comp/atom:result");
|
||||||
|
array_atom = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// invoke full neighbor list (will copy or build if necessary)
|
||||||
|
|
||||||
|
neighbor->build_one(list);
|
||||||
|
|
||||||
|
inum = list->inum;
|
||||||
|
ilist = list->ilist;
|
||||||
|
numneigh = list->numneigh;
|
||||||
|
firstneigh = list->firstneigh;
|
||||||
|
|
||||||
|
// compute properties for each atom in group
|
||||||
|
// use full neighbor list to count atoms less than cutoff
|
||||||
|
|
||||||
|
double **x = atom->x;
|
||||||
|
int *type = atom->type;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
|
||||||
|
// get per-atom local compositions
|
||||||
|
|
||||||
|
for (ii = 0; ii < inum; ii++) {
|
||||||
|
|
||||||
|
i = ilist[ii];
|
||||||
|
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
|
||||||
|
xtmp = x[i][0];
|
||||||
|
ytmp = x[i][1];
|
||||||
|
ztmp = x[i][2];
|
||||||
|
jlist = firstneigh[i];
|
||||||
|
jnum = numneigh[i];
|
||||||
|
|
||||||
|
// i atom contribution
|
||||||
|
|
||||||
|
count = 1;
|
||||||
|
|
||||||
|
itype = type[i];
|
||||||
|
result[i][itype]++;
|
||||||
|
|
||||||
|
for (jj = 0; jj < jnum; jj++) {
|
||||||
|
j = jlist[jj];
|
||||||
|
j &= NEIGHMASK;
|
||||||
|
|
||||||
|
jtype = type[j];
|
||||||
|
|
||||||
|
delx = xtmp - x[j][0];
|
||||||
|
dely = ytmp - x[j][1];
|
||||||
|
delz = ztmp - x[j][2];
|
||||||
|
rsq = delx * delx + dely * dely + delz * delz;
|
||||||
|
if (rsq < cutsq) {
|
||||||
|
count++;
|
||||||
|
result[i][jtype]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// total count of atoms found in sampled radius range
|
||||||
|
|
||||||
|
result[i][0] = count;
|
||||||
|
|
||||||
|
// local comp fractions per element
|
||||||
|
|
||||||
|
double lfac = 1.0 / count;
|
||||||
|
for (int n = 1; n < size_peratom_cols; n++)
|
||||||
|
result[i][n+1] *= lfac;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
memory usage of local atom-based array
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double ComputeLocalCompAtom::memory_usage()
|
||||||
|
{
|
||||||
|
double bytes = (double) 2 * nmax * sizeof(double);
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
47
src/EXTRA-COMPUTE/compute_local_comp_atom.h
Normal file
47
src/EXTRA-COMPUTE/compute_local_comp_atom.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
|
LAMMPS development team: developers@lammps.org
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef COMPUTE_CLASS
|
||||||
|
// clang-format off
|
||||||
|
ComputeStyle(local/comp/atom,ComputeLocalCompAtom);
|
||||||
|
// clang-format on
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef LMP_COMPUTE_LOCAL_COMP_ATOM_H
|
||||||
|
#define LMP_COMPUTE_LOCAL_COMP_ATOM_H
|
||||||
|
|
||||||
|
#include "compute.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class ComputeLocalCompAtom : public Compute {
|
||||||
|
public:
|
||||||
|
ComputeLocalCompAtom(class LAMMPS *, int, char **);
|
||||||
|
~ComputeLocalCompAtom() override;
|
||||||
|
void init() override;
|
||||||
|
void init_list(int, class NeighList *) override;
|
||||||
|
void compute_peratom() override;
|
||||||
|
double memory_usage() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int nmax, ntypes;
|
||||||
|
double cutoff; // global cutoff distance
|
||||||
|
double cutsq; // cutoff**2
|
||||||
|
class NeighList *list; // neighbor list
|
||||||
|
double **result; // peratom array of local compositions
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace LAMMPS_NS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@ -96,6 +96,8 @@ action compute_coord_atom_kokkos.cpp
|
|||||||
action compute_coord_atom_kokkos.h
|
action compute_coord_atom_kokkos.h
|
||||||
action compute_erotate_sphere_kokkos.cpp
|
action compute_erotate_sphere_kokkos.cpp
|
||||||
action compute_erotate_sphere_kokkos.h
|
action compute_erotate_sphere_kokkos.h
|
||||||
|
action compute_local_comp_atom_kokkos.cpp compute_local_comp_atom.cpp
|
||||||
|
action compute_local_comp_atom_kokkos.h compute_local_comp_atom.h
|
||||||
action compute_orientorder_atom_kokkos.cpp
|
action compute_orientorder_atom_kokkos.cpp
|
||||||
action compute_orientorder_atom_kokkos.h
|
action compute_orientorder_atom_kokkos.h
|
||||||
action compute_temp_deform_kokkos.cpp
|
action compute_temp_deform_kokkos.cpp
|
||||||
|
|||||||
180
src/KOKKOS/compute_local_comp_atom_kokkos.cpp
Normal file
180
src/KOKKOS/compute_local_comp_atom_kokkos.cpp
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
|
LAMMPS development team: developers@lammps.org
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU Gdirectoryeneral Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Megan McCarthy (SNL)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "compute_local_comp_atom_kokkos.h"
|
||||||
|
|
||||||
|
#include "atom_kokkos.h"
|
||||||
|
#include "atom_masks.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "domain.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "memory_kokkos.h"
|
||||||
|
#include "modify.h"
|
||||||
|
#include "neigh_list.h"
|
||||||
|
#include "neigh_request.h"
|
||||||
|
#include "neighbor_kokkos.h"
|
||||||
|
#include "pair.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template<class DeviceType>
|
||||||
|
ComputeLocalCompAtomKokkos<DeviceType>::ComputeLocalCompAtomKokkos(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
ComputeLocalCompAtom(lmp, narg, arg)
|
||||||
|
{
|
||||||
|
kokkosable = 1;
|
||||||
|
atomKK = (AtomKokkos *) atom;
|
||||||
|
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
||||||
|
datamask_read = EMPTY_MASK;
|
||||||
|
datamask_modify = EMPTY_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template<class DeviceType>
|
||||||
|
ComputeLocalCompAtomKokkos<DeviceType>::~ComputeLocalCompAtomKokkos()
|
||||||
|
{
|
||||||
|
if (copymode) return;
|
||||||
|
|
||||||
|
memoryKK->destroy_kokkos(k_result,result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template<class DeviceType>
|
||||||
|
void ComputeLocalCompAtomKokkos<DeviceType>::init()
|
||||||
|
{
|
||||||
|
ComputeLocalCompAtom::init();
|
||||||
|
|
||||||
|
// adjust neighbor list request for KOKKOS
|
||||||
|
|
||||||
|
auto request = neighbor->find_request(this);
|
||||||
|
request->set_kokkos_host(std::is_same<DeviceType,LMPHostType>::value &&
|
||||||
|
!std::is_same<DeviceType,LMPDeviceType>::value);
|
||||||
|
request->set_kokkos_device(std::is_same<DeviceType,LMPDeviceType>::value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
template<class DeviceType>
|
||||||
|
void ComputeLocalCompAtomKokkos<DeviceType>::compute_peratom()
|
||||||
|
{
|
||||||
|
invoked_peratom = update->ntimestep;
|
||||||
|
|
||||||
|
// grow result array if necessary
|
||||||
|
|
||||||
|
int size_peratom_cols = 1 + atom->ntypes;
|
||||||
|
if (atom->nmax > nmax) {
|
||||||
|
memoryKK->destroy_kokkos(k_result,result);
|
||||||
|
nmax = atom->nmax;
|
||||||
|
memoryKK->create_kokkos(k_result,result,nmax,size_peratom_cols,"local/comp/atom:result");
|
||||||
|
d_result = k_result.view<DeviceType>();
|
||||||
|
array_atom = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// invoke full neighbor list (will copy or build if necessary)
|
||||||
|
|
||||||
|
neighbor->build_one(list);
|
||||||
|
int inum = list->inum;
|
||||||
|
|
||||||
|
NeighListKokkos<DeviceType>* k_list = static_cast<NeighListKokkos<DeviceType>*>(list);
|
||||||
|
d_numneigh = k_list->d_numneigh;
|
||||||
|
d_neighbors = k_list->d_neighbors;
|
||||||
|
d_ilist = k_list->d_ilist;
|
||||||
|
|
||||||
|
// compute properties for each atom in group
|
||||||
|
// use full neighbor list to count atoms less than cutoff
|
||||||
|
|
||||||
|
atomKK->sync(execution_space,X_MASK|TYPE_MASK|MASK_MASK);
|
||||||
|
x = atomKK->k_x.view<DeviceType>();
|
||||||
|
type = atomKK->k_type.view<DeviceType>();
|
||||||
|
mask = atomKK->k_mask.view<DeviceType>();
|
||||||
|
ntypes = atom->ntypes;
|
||||||
|
|
||||||
|
Kokkos::deep_copy(d_result,0.0);
|
||||||
|
|
||||||
|
copymode = 1;
|
||||||
|
typename Kokkos::RangePolicy<DeviceType, TagComputeLocalCompAtom> policy(0,inum);
|
||||||
|
Kokkos::parallel_for("ComputeLocalComp",policy,*this);
|
||||||
|
copymode = 0;
|
||||||
|
|
||||||
|
k_result.modify<DeviceType>();
|
||||||
|
k_result.sync_host();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class DeviceType>
|
||||||
|
KOKKOS_INLINE_FUNCTION
|
||||||
|
void ComputeLocalCompAtomKokkos<DeviceType>::operator()(TagComputeLocalCompAtom, const int &ii) const
|
||||||
|
{
|
||||||
|
const int i = d_ilist[ii];
|
||||||
|
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
|
||||||
|
const X_FLOAT xtmp = x(i,0);
|
||||||
|
const X_FLOAT ytmp = x(i,1);
|
||||||
|
const X_FLOAT ztmp = x(i,2);
|
||||||
|
const int jnum = d_numneigh[i];
|
||||||
|
|
||||||
|
// i atom contribution
|
||||||
|
|
||||||
|
int count = 1.0;
|
||||||
|
int itype = type[i];
|
||||||
|
d_result(i,itype)++;
|
||||||
|
|
||||||
|
for (int jj = 0; jj < jnum; jj++) {
|
||||||
|
|
||||||
|
int j = d_neighbors(i,jj);
|
||||||
|
j &= NEIGHMASK;
|
||||||
|
|
||||||
|
int jtype = type[j];
|
||||||
|
|
||||||
|
const F_FLOAT delx = x(j,0) - xtmp;
|
||||||
|
const F_FLOAT dely = x(j,1) - ytmp;
|
||||||
|
const F_FLOAT delz = x(j,2) - ztmp;
|
||||||
|
const F_FLOAT rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
if (rsq < cutsq) {
|
||||||
|
count++;
|
||||||
|
d_result(i,jtype) += 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// total count of atoms found in sampled radius range
|
||||||
|
|
||||||
|
d_result(i,0) = count;
|
||||||
|
|
||||||
|
// local comp fractions per atom type
|
||||||
|
|
||||||
|
double lfac = 1.0 / count;
|
||||||
|
|
||||||
|
for (int n = 1; n < size_peratom_cols; n++) {
|
||||||
|
d_result(i,n) *= lfac;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
template class ComputeLocalCompAtomKokkos<LMPDeviceType>;
|
||||||
|
#ifdef LMP_KOKKOS_GPU
|
||||||
|
template class ComputeLocalCompAtomKokkos<LMPHostType>;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
64
src/KOKKOS/compute_local_comp_atom_kokkos.h
Normal file
64
src/KOKKOS/compute_local_comp_atom_kokkos.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
|
LAMMPS development team: developers@lammps.org
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef COMPUTE_CLASS
|
||||||
|
// clang-format off
|
||||||
|
ComputeStyle(local/comp/atom/kk,ComputeLocalCompAtomKokkos<LMPDeviceType>);
|
||||||
|
ComputeStyle(local/comp/atom/kk/device,ComputeLocalCompAtomKokkos<LMPDeviceType>);
|
||||||
|
ComputeStyle(local/comp/atom/kk/host,ComputeLocalCompAtomKokkos<LMPHostType>);
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef LMP_COMPUTE_LOCAL_COMP_ATOM_KOKKOS_H
|
||||||
|
#define LMP_COMPUTE_LOCAL_COMP_ATOM_KOKKOS_H
|
||||||
|
|
||||||
|
#include "compute_local_comp_atom.h"
|
||||||
|
#include "kokkos_type.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
struct TagComputeLocalCompAtom {};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
template <class DeviceType> class ComputeLocalCompAtomKokkos : public ComputeLocalCompAtom {
|
||||||
|
public:
|
||||||
|
typedef DeviceType device_type;
|
||||||
|
typedef ArrayTypes<DeviceType> AT;
|
||||||
|
|
||||||
|
ComputeLocalCompAtomKokkos(class LAMMPS *, int, char **);
|
||||||
|
~ComputeLocalCompAtomKokkos() override;
|
||||||
|
void init() override;
|
||||||
|
void compute_peratom() override;
|
||||||
|
|
||||||
|
KOKKOS_INLINE_FUNCTION
|
||||||
|
void operator()(TagComputeLocalCompAtom, const int &) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
typename AT::t_x_array x;
|
||||||
|
typename ArrayTypes<DeviceType>::t_int_1d type;
|
||||||
|
typename ArrayTypes<DeviceType>::t_int_1d mask;
|
||||||
|
|
||||||
|
typename AT::t_neighbors_2d d_neighbors;
|
||||||
|
typename AT::t_int_1d d_ilist;
|
||||||
|
typename AT::t_int_1d d_numneigh;
|
||||||
|
DAT::tdual_float_2d k_result;
|
||||||
|
typename AT::t_float_2d d_result;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace LAMMPS_NS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@ -1,4 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
# -*- CMake -*- file for building spglib for phana
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(spglib C)
|
project(spglib C)
|
||||||
set(CMAKE_MACOSX_RPATH 1)
|
set(CMAKE_MACOSX_RPATH 1)
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2")
|
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2")
|
||||||
@ -10,7 +11,6 @@ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
|||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
|
||||||
# Version numbers
|
# Version numbers
|
||||||
file(READ ${PROJECT_SOURCE_DIR}/src/version.h version_file)
|
file(READ ${PROJECT_SOURCE_DIR}/src/version.h version_file)
|
||||||
string(REGEX MATCH "SPGLIB_MAJOR_VERSION ([0-9]+)" spglib_major_version ${version_file})
|
string(REGEX MATCH "SPGLIB_MAJOR_VERSION ([0-9]+)" spglib_major_version ${version_file})
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# -*- CMake -*- configuration for building the PHONON package analysis tool: phana
|
||||||
|
|
||||||
# Support Linux from Ubuntu 20.04LTS onward, CentOS 7.x (with EPEL),
|
# Support Linux from Ubuntu 20.04LTS onward, CentOS 7.x (with EPEL),
|
||||||
# macOS, MSVC 2019 (=Version 16)
|
# macOS, MSVC 2019 (=Version 16)
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
|
# -*- CMake -*- configuration for building the tricubic library
|
||||||
|
|
||||||
# Support Linux from Ubuntu 20.04LTS onward, CentOS 7.x (with EPEL),
|
# Support Linux from Ubuntu 20.04LTS onward, CentOS 7.x (with EPEL),
|
||||||
# macOS, MSVC 2019 (=Version 16)
|
# macOS, MSVC 2019 (=Version 16)
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
# set up project
|
# set up project
|
||||||
project(tricubic VERSION 1.1 DESCRIPTION "Tricubic library" LANGUAGES CXX)
|
project(tricubic VERSION 1.1 DESCRIPTION "Tricubic library" LANGUAGES CXX)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# CMake configuration for generating script language interfaces with SWIG
|
# -*- CMake -*- configuration for generating LAMMPS script language wrappers with SWIG
|
||||||
|
|
||||||
# set minimum CMake version required and switch to new policies for SWIG
|
# set minimum CMake version required and switch to new policies for SWIG
|
||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
if(POLICY CMP0078)
|
if(POLICY CMP0078)
|
||||||
cmake_policy(SET CMP0078 NEW)
|
cmake_policy(SET CMP0078 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
########################################
|
# -*- CMake -*- build file for automated testing
|
||||||
# CMake build for automated testing
|
|
||||||
# This file is part of LAMMPS
|
# This file is part of LAMMPS
|
||||||
# Created by Axel Kohlmeyer and Richard Berger
|
# Created by Axel Kohlmeyer and Richard Berger
|
||||||
########################################
|
########################################
|
||||||
# download and build googletest framework
|
|
||||||
|
|
||||||
|
# download and build googletest framework
|
||||||
# cannot compile googletest anymore with the default GCC on RHEL 7.x
|
# cannot compile googletest anymore with the default GCC on RHEL 7.x
|
||||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0))
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0))
|
||||||
message(FATAL_ERROR "Need GNU C++ compiler version 6.x or later for unit testing")
|
message(FATAL_ERROR "Need GNU C++ compiler version 6.x or later for unit testing")
|
||||||
@ -36,11 +35,7 @@ endforeach()
|
|||||||
|
|
||||||
# must repeat handling coverage for older CMake
|
# must repeat handling coverage for older CMake
|
||||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND ENABLE_COVERAGE)
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND ENABLE_COVERAGE)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# -*- CMake -*- file for testing the c-library interface
|
||||||
|
|
||||||
add_executable(test_library_open test_library_open.cpp test_main.cpp)
|
add_executable(test_library_open test_library_open.cpp test_main.cpp)
|
||||||
target_link_libraries(test_library_open PRIVATE lammps GTest::GMock)
|
target_link_libraries(test_library_open PRIVATE lammps GTest::GMock)
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# -*- CMake -*- file for testing LAMMPS commands
|
||||||
|
|
||||||
add_executable(test_simple_commands test_simple_commands.cpp)
|
add_executable(test_simple_commands test_simple_commands.cpp)
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# -*- CMake -*- file for testing the direct calls to individual C++ classes
|
||||||
|
|
||||||
add_executable(test_lammps_class test_lammps_class.cpp)
|
add_executable(test_lammps_class test_lammps_class.cpp)
|
||||||
target_link_libraries(test_lammps_class PRIVATE lammps GTest::GMockMain)
|
target_link_libraries(test_lammps_class PRIVATE lammps GTest::GMockMain)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# Custom minimal -*- CMake -*- file for libyaml
|
# Custom minimal -*- CMake -*- file for libyaml
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(libyaml VERSION 0.2.5
|
project(libyaml VERSION 0.2.5
|
||||||
DESCRIPTION "LibYAML a YAML parser and emitter library"
|
DESCRIPTION "LibYAML a YAML parser and emitter library"
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# -*- CMake -*- file for tests of classes computing or modifying forces
|
||||||
|
|
||||||
find_package(YAML)
|
find_package(YAML)
|
||||||
if(NOT YAML_FOUND)
|
if(NOT YAML_FOUND)
|
||||||
@ -19,16 +20,7 @@ function(extract_tags out yaml_file)
|
|||||||
set(${out} "${TAGS}" PARENT_SCOPE)
|
set(${out} "${TAGS}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
find_package(Python COMPONENTS Interpreter)
|
||||||
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 3.5)
|
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python COMPONENTS Interpreter)
|
|
||||||
endif()
|
|
||||||
if(Python_EXECUTABLE)
|
if(Python_EXECUTABLE)
|
||||||
add_custom_target(check-tests
|
add_custom_target(check-tests
|
||||||
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_tests.py
|
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_tests.py
|
||||||
@ -53,10 +45,8 @@ target_link_libraries(style_tests PUBLIC GTest::GMock Yaml::Yaml lammps)
|
|||||||
|
|
||||||
# propagate sanitizer options to test tools
|
# propagate sanitizer options to test tools
|
||||||
if(ENABLE_SANITIZER AND (NOT (ENABLE_SANITIZER STREQUAL "none")))
|
if(ENABLE_SANITIZER AND (NOT (ENABLE_SANITIZER STREQUAL "none")))
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
target_compile_options(style_tests PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
target_compile_options(style_tests PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
target_link_options(style_tests PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
target_link_options(style_tests PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# unit test for error stats class
|
# unit test for error stats class
|
||||||
@ -97,7 +87,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# tests for molecular systems and related pair styles
|
# tests for molecular systems and related pair styles
|
||||||
file(GLOB MOL_PAIR_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/mol-pair-*.yaml)
|
file(GLOB MOL_PAIR_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/mol-pair-*.yaml)
|
||||||
# cannot test MSM with single precision data
|
# cannot test MSM with single precision data
|
||||||
if(FFT_SINGLE)
|
if(FFT_SINGLE)
|
||||||
list(FILTER MOL_PAIR_TESTS EXCLUDE REGEX "msm")
|
list(FILTER MOL_PAIR_TESTS EXCLUDE REGEX "msm")
|
||||||
@ -115,7 +105,7 @@ foreach(TEST ${MOL_PAIR_TESTS})
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# tests for metal-like atomic systems and related pair styles
|
# tests for metal-like atomic systems and related pair styles
|
||||||
file(GLOB ATOMIC_PAIR_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/atomic-pair-*.yaml)
|
file(GLOB ATOMIC_PAIR_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/atomic-pair-*.yaml)
|
||||||
foreach(TEST ${ATOMIC_PAIR_TESTS})
|
foreach(TEST ${ATOMIC_PAIR_TESTS})
|
||||||
string(REGEX REPLACE "^.*atomic-pair-(.*)\.yaml" "AtomicPairStyle:\\1" TNAME ${TEST})
|
string(REGEX REPLACE "^.*atomic-pair-(.*)\.yaml" "AtomicPairStyle:\\1" TNAME ${TEST})
|
||||||
extract_tags(TEST_TAGS ${TEST})
|
extract_tags(TEST_TAGS ${TEST})
|
||||||
@ -129,7 +119,7 @@ foreach(TEST ${ATOMIC_PAIR_TESTS})
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# tests for Si-like manybody systems and related pair styles
|
# tests for Si-like manybody systems and related pair styles
|
||||||
file(GLOB MANYBODY_PAIR_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/manybody-pair-*.yaml)
|
file(GLOB MANYBODY_PAIR_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/manybody-pair-*.yaml)
|
||||||
foreach(TEST ${MANYBODY_PAIR_TESTS})
|
foreach(TEST ${MANYBODY_PAIR_TESTS})
|
||||||
string(REGEX REPLACE "^.*manybody-pair-(.*)\.yaml" "ManybodyPairStyle:\\1" TNAME ${TEST})
|
string(REGEX REPLACE "^.*manybody-pair-(.*)\.yaml" "ManybodyPairStyle:\\1" TNAME ${TEST})
|
||||||
extract_tags(TEST_TAGS ${TEST})
|
extract_tags(TEST_TAGS ${TEST})
|
||||||
@ -146,7 +136,7 @@ endforeach()
|
|||||||
add_executable(test_bond_style test_bond_style.cpp)
|
add_executable(test_bond_style test_bond_style.cpp)
|
||||||
target_link_libraries(test_bond_style PRIVATE lammps style_tests)
|
target_link_libraries(test_bond_style PRIVATE lammps style_tests)
|
||||||
|
|
||||||
file(GLOB BOND_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/bond-*.yaml)
|
file(GLOB BOND_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/bond-*.yaml)
|
||||||
foreach(TEST ${BOND_TESTS})
|
foreach(TEST ${BOND_TESTS})
|
||||||
string(REGEX REPLACE "^.*bond-(.*)\.yaml" "BondStyle:\\1" TNAME ${TEST})
|
string(REGEX REPLACE "^.*bond-(.*)\.yaml" "BondStyle:\\1" TNAME ${TEST})
|
||||||
extract_tags(TEST_TAGS ${TEST})
|
extract_tags(TEST_TAGS ${TEST})
|
||||||
@ -163,7 +153,7 @@ endforeach()
|
|||||||
add_executable(test_angle_style test_angle_style.cpp)
|
add_executable(test_angle_style test_angle_style.cpp)
|
||||||
target_link_libraries(test_angle_style PRIVATE lammps style_tests)
|
target_link_libraries(test_angle_style PRIVATE lammps style_tests)
|
||||||
|
|
||||||
file(GLOB ANGLE_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/angle-*.yaml)
|
file(GLOB ANGLE_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/angle-*.yaml)
|
||||||
foreach(TEST ${ANGLE_TESTS})
|
foreach(TEST ${ANGLE_TESTS})
|
||||||
string(REGEX REPLACE "^.*angle-(.*)\.yaml" "AngleStyle:\\1" TNAME ${TEST})
|
string(REGEX REPLACE "^.*angle-(.*)\.yaml" "AngleStyle:\\1" TNAME ${TEST})
|
||||||
extract_tags(TEST_TAGS ${TEST})
|
extract_tags(TEST_TAGS ${TEST})
|
||||||
@ -177,7 +167,7 @@ foreach(TEST ${ANGLE_TESTS})
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# kspace style tester, currently uses the pair style tool
|
# kspace style tester, currently uses the pair style tool
|
||||||
file(GLOB KSPACE_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/kspace-*.yaml)
|
file(GLOB KSPACE_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/kspace-*.yaml)
|
||||||
# cannot test MSM with single precision data
|
# cannot test MSM with single precision data
|
||||||
if(FFT_SINGLE)
|
if(FFT_SINGLE)
|
||||||
list(FILTER KSPACE_TESTS EXCLUDE REGEX "msm")
|
list(FILTER KSPACE_TESTS EXCLUDE REGEX "msm")
|
||||||
@ -205,7 +195,7 @@ endif()
|
|||||||
target_link_libraries(test_fix_timestep PRIVATE lammps style_tests)
|
target_link_libraries(test_fix_timestep PRIVATE lammps style_tests)
|
||||||
|
|
||||||
# tests for timestep related fixes (time integration, thermostat, force manipulation, constraints/restraints)
|
# tests for timestep related fixes (time integration, thermostat, force manipulation, constraints/restraints)
|
||||||
file(GLOB FIX_TIMESTEP_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/fix-timestep-*.yaml)
|
file(GLOB FIX_TIMESTEP_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/fix-timestep-*.yaml)
|
||||||
foreach(TEST ${FIX_TIMESTEP_TESTS})
|
foreach(TEST ${FIX_TIMESTEP_TESTS})
|
||||||
string(REGEX REPLACE "^.*fix-timestep-(.*)\.yaml" "FixTimestep:\\1" TNAME ${TEST})
|
string(REGEX REPLACE "^.*fix-timestep-(.*)\.yaml" "FixTimestep:\\1" TNAME ${TEST})
|
||||||
extract_tags(TEST_TAGS ${TEST})
|
extract_tags(TEST_TAGS ${TEST})
|
||||||
@ -226,7 +216,7 @@ endforeach()
|
|||||||
add_executable(test_dihedral_style test_dihedral_style.cpp)
|
add_executable(test_dihedral_style test_dihedral_style.cpp)
|
||||||
target_link_libraries(test_dihedral_style PRIVATE lammps style_tests)
|
target_link_libraries(test_dihedral_style PRIVATE lammps style_tests)
|
||||||
|
|
||||||
file(GLOB DIHEDRAL_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/dihedral-*.yaml)
|
file(GLOB DIHEDRAL_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/dihedral-*.yaml)
|
||||||
foreach(TEST ${DIHEDRAL_TESTS})
|
foreach(TEST ${DIHEDRAL_TESTS})
|
||||||
string(REGEX REPLACE "^.*dihedral-(.*)\.yaml" "DihedralStyle:\\1" TNAME ${TEST})
|
string(REGEX REPLACE "^.*dihedral-(.*)\.yaml" "DihedralStyle:\\1" TNAME ${TEST})
|
||||||
extract_tags(TEST_TAGS ${TEST})
|
extract_tags(TEST_TAGS ${TEST})
|
||||||
@ -243,7 +233,7 @@ endforeach()
|
|||||||
add_executable(test_improper_style test_improper_style.cpp)
|
add_executable(test_improper_style test_improper_style.cpp)
|
||||||
target_link_libraries(test_improper_style PRIVATE lammps style_tests)
|
target_link_libraries(test_improper_style PRIVATE lammps style_tests)
|
||||||
|
|
||||||
file(GLOB IMPROPER_TESTS LIST_DIRECTORIES false ${CONFIGURE_DEPENDS} ${TEST_INPUT_FOLDER}/improper-*.yaml)
|
file(GLOB IMPROPER_TESTS LIST_DIRECTORIES false CONFIGURE_DEPENDS ${TEST_INPUT_FOLDER}/improper-*.yaml)
|
||||||
foreach(TEST ${IMPROPER_TESTS})
|
foreach(TEST ${IMPROPER_TESTS})
|
||||||
string(REGEX REPLACE "^.*improper-(.*)\.yaml" "ImproperStyle:\\1" TNAME ${TEST})
|
string(REGEX REPLACE "^.*improper-(.*)\.yaml" "ImproperStyle:\\1" TNAME ${TEST})
|
||||||
extract_tags(TEST_TAGS ${TEST})
|
extract_tags(TEST_TAGS ${TEST})
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# -*- CMake -*- file for tests of file reading or writing classes and functions in LAMMPS
|
||||||
|
|
||||||
add_executable(test_atom_styles test_atom_styles.cpp)
|
add_executable(test_atom_styles test_atom_styles.cpp)
|
||||||
target_link_libraries(test_atom_styles PRIVATE lammps GTest::GMock)
|
target_link_libraries(test_atom_styles PRIVATE lammps GTest::GMock)
|
||||||
|
|||||||
@ -612,6 +612,10 @@ TEST_F(FileOperationsTest, read_data_fix)
|
|||||||
EXPECT_EQ(lmp->atom->tag[GETIDX(8)], 8);
|
EXPECT_EQ(lmp->atom->tag[GETIDX(8)], 8);
|
||||||
EXPECT_EQ(lmp->atom->tag[GETIDX(9)], 9);
|
EXPECT_EQ(lmp->atom->tag[GETIDX(9)], 9);
|
||||||
EXPECT_EQ(lmp->atom->tag[GETIDX(10)], 10);
|
EXPECT_EQ(lmp->atom->tag[GETIDX(10)], 10);
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
delete_file("test_mol_id_merge.data");
|
||||||
|
delete_file("test_mol_id.data");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
# -*- CMake -*- file for testing the Fortran interface to LAMMPS
|
||||||
|
|
||||||
include(CheckGeneratorSupport)
|
include(CheckGeneratorSupport)
|
||||||
if(NOT CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
if(NOT CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
||||||
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no Fortran support in build tool")
|
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no Fortran support in build tool")
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
# Test calling Python from LAMMPS (and importing the LAMMPS module
|
# -*- CMake -*- file for tests calling Python from LAMMPS (and importing
|
||||||
# inside those functions). This can do an "anonymous" import of symbols
|
# the LAMMPS module inside those functions). This can do an "anonymous"
|
||||||
# from the executable, so the shared library is not needed. The
|
# import of symbols from the executable, so the shared library is not
|
||||||
# availability of the PYTHON package is tested for inside the tester.
|
# needed. The availability of the PYTHON package is tested for inside
|
||||||
|
# the tester.
|
||||||
|
|
||||||
set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
|
set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
@ -11,20 +12,12 @@ if(NOT BUILD_SHARED_LIBS)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
find_package(Python 3.6 COMPONENTS Interpreter Development)
|
||||||
find_package(PythonInterp 3.6) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python COMPONENTS Interpreter Development)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PKG_PYTHON)
|
if(PKG_PYTHON)
|
||||||
add_executable(test_python_package test_python_package.cpp)
|
add_executable(test_python_package test_python_package.cpp)
|
||||||
target_link_libraries(test_python_package PRIVATE lammps GTest::GMock)
|
target_link_libraries(test_python_package PRIVATE lammps GTest::GMock)
|
||||||
target_compile_definitions(test_python_package PRIVATE -DTEST_INPUT_FOLDER=${TEST_INPUT_FOLDER})
|
target_compile_definitions(test_python_package PRIVATE -DTEST_INPUT_FOLDER=${TEST_INPUT_FOLDER})
|
||||||
# this requires CMake 3.12. don't care to add backward compatibility for this.
|
|
||||||
if(Python_Development_FOUND)
|
if(Python_Development_FOUND)
|
||||||
target_compile_definitions(test_python_package PRIVATE -DTEST_HAVE_PYTHON_DEVELOPMENT=1)
|
target_compile_definitions(test_python_package PRIVATE -DTEST_HAVE_PYTHON_DEVELOPMENT=1)
|
||||||
target_link_libraries(test_python_package PRIVATE Python::Python)
|
target_link_libraries(test_python_package PRIVATE Python::Python)
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
|
# -*- CMake -*- file for tests of utily functions and classes in LAMMPS
|
||||||
|
|
||||||
# we use python 3's subprocess module to run the tools and check the output
|
# we use python 3's subprocess module to run the tools and check the output
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
find_package(Python 3.6 COMPONENTS Interpreter)
|
||||||
find_package(PythonInterp 3.5) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python 3.5 COMPONENTS Interpreter)
|
|
||||||
endif()
|
|
||||||
get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
if(BUILD_IS_MULTI_CONFIG)
|
if(BUILD_IS_MULTI_CONFIG)
|
||||||
set(LAMMPS_SHELL_EXE_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
set(LAMMPS_SHELL_EXE_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# -*- CMake -*- file for tests of utily functions and classes in LAMMPS
|
||||||
|
|
||||||
add_executable(test_tokenizer test_tokenizer.cpp)
|
add_executable(test_tokenizer test_tokenizer.cpp)
|
||||||
target_link_libraries(test_tokenizer PRIVATE lammps GTest::GMockMain)
|
target_link_libraries(test_tokenizer PRIVATE lammps GTest::GMockMain)
|
||||||
|
|||||||
Reference in New Issue
Block a user