Merge branch 'master' into gran_attractive
This commit is contained in:
4
.github/workflows/unittest-macos.yml
vendored
4
.github/workflows/unittest-macos.yml
vendored
@ -24,7 +24,9 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
run: |
|
run: |
|
||||||
cmake -C $GITHUB_WORKSPACE/cmake/presets/most.cmake $GITHUB_WORKSPACE/cmake \
|
cmake -C $GITHUB_WORKSPACE/cmake/presets/clang.cmake \
|
||||||
|
-C $GITHUB_WORKSPACE/cmake/presets/most.cmake \
|
||||||
|
$GITHUB_WORKSPACE/cmake \
|
||||||
-DENABLE_TESTING=ON -DBUILD_SHARED_LIBS=ON -DLAMMPS_EXCEPTIONS=ON
|
-DENABLE_TESTING=ON -DBUILD_SHARED_LIBS=ON -DLAMMPS_EXCEPTIONS=ON
|
||||||
cmake --build . --parallel 2
|
cmake --build . --parallel 2
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,11 @@ set(LAMMPS_TOOLS_DIR ${LAMMPS_DIR}/tools)
|
|||||||
set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python)
|
set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python)
|
||||||
set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials)
|
set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials)
|
||||||
|
|
||||||
|
set(LAMMPS_DOWNLOADS_URL "https://download.lammps.org" CACHE STRING "Base URL for LAMMPS downloads")
|
||||||
|
set(LAMMPS_POTENTIALS_URL "${LAMMPS_DOWNLOADS_URL}/potentials")
|
||||||
|
set(LAMMPS_THIRDPARTY_URL "${LAMMPS_DOWNLOADS_URL}/thirdparty")
|
||||||
|
mark_as_advanced(LAMMPS_DOWNLOADS_URL)
|
||||||
|
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
|
|
||||||
# by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed
|
# by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed
|
||||||
|
|||||||
@ -55,11 +55,15 @@ if(BUILD_DOC)
|
|||||||
COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install -r ${DOC_BUILD_DIR}/requirements.txt --upgrade
|
COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install -r ${DOC_BUILD_DIR}/requirements.txt --upgrade
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.2.tar.gz" CACHE STRING "URL for MathJax tarball")
|
||||||
|
set(MATHJAX_MD5 "a4a6a093a89bc2ccab1452d766b98e53" CACHE STRING "MD5 checksum of MathJax tarball")
|
||||||
|
mark_as_advanced(MATHJAX_URL)
|
||||||
|
|
||||||
# download mathjax distribution and unpack to folder "mathjax"
|
# download mathjax distribution and unpack to folder "mathjax"
|
||||||
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
|
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
|
||||||
file(DOWNLOAD "https://github.com/mathjax/MathJax/archive/3.1.2.tar.gz"
|
file(DOWNLOAD ${MATHJAX_URL}
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz"
|
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz"
|
||||||
EXPECTED_MD5 a4a6a093a89bc2ccab1452d766b98e53)
|
EXPECTED_MD5 ${MATHJAX_MD5})
|
||||||
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 ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
file(GLOB MATHJAX_VERSION_DIR ${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)
|
||||||
|
|||||||
@ -8,10 +8,12 @@ endif()
|
|||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
set(GTEST_URL "https://github.com/google/googletest/archive/release-1.10.0.tar.gz" CACHE STRING "URL for GTest tarball")
|
set(GTEST_URL "https://github.com/google/googletest/archive/release-1.10.0.tar.gz" CACHE STRING "URL for GTest tarball")
|
||||||
|
set(GTEST_MD5 "ecd1fa65e7de707cd5c00bdac56022cd" CACHE STRING "MD5 checksum of GTest tarball")
|
||||||
mark_as_advanced(GTEST_URL)
|
mark_as_advanced(GTEST_URL)
|
||||||
|
mark_as_advanced(GTEST_MD5)
|
||||||
ExternalProject_Add(googletest
|
ExternalProject_Add(googletest
|
||||||
URL ${GTEST_URL}
|
URL ${GTEST_URL}
|
||||||
URL_MD5 ecd1fa65e7de707cd5c00bdac56022cd
|
URL_MD5 ${GTEST_MD5}
|
||||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src"
|
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src"
|
||||||
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build"
|
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build"
|
||||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_GTEST_OPTS}
|
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_GTEST_OPTS}
|
||||||
|
|||||||
@ -86,7 +86,6 @@ endfunction(GenerateBinaryHeader)
|
|||||||
# fetch missing potential files
|
# fetch missing potential files
|
||||||
function(FetchPotentials pkgfolder potfolder)
|
function(FetchPotentials pkgfolder potfolder)
|
||||||
if (EXISTS "${pkgfolder}/potentials.txt")
|
if (EXISTS "${pkgfolder}/potentials.txt")
|
||||||
set(LAMMPS_POTENTIALS_URL "https://download.lammps.org/potentials")
|
|
||||||
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
|
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
|
||||||
foreach(line ${linelist})
|
foreach(line ${linelist})
|
||||||
string(FIND ${line} " " blank)
|
string(FIND ${line} " " blank)
|
||||||
|
|||||||
@ -1,16 +1,25 @@
|
|||||||
# Download and configure custom MPICH files for Windows
|
# Download and configure custom MPICH files for Windows
|
||||||
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
||||||
|
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||||
|
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
|
||||||
|
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||||
|
set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball")
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||||
|
mark_as_advanced(MPICH2_WIN32_DEVEL_URL)
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||||
|
mark_as_advanced(MPICH2_WIN32_DEVEL_MD5)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
ExternalProject_Add(mpi4win_build
|
ExternalProject_Add(mpi4win_build
|
||||||
URL https://download.lammps.org/thirdparty/mpich2-win64-devel.tar.gz
|
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||||
URL_MD5 4939fdb59d13182fd5dd65211e469f14
|
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||||
else()
|
else()
|
||||||
ExternalProject_Add(mpi4win_build
|
ExternalProject_Add(mpi4win_build
|
||||||
URL https://download.lammps.org/thirdparty/mpich2-win32-devel.tar.gz
|
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||||
URL_MD5 a61d153500dce44e21b755ee7257e031
|
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
message(STATUS "Downloading and building OpenCL loader library")
|
message(STATUS "Downloading and building OpenCL loader library")
|
||||||
|
set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2020.12.18.tar.gz" CACHE STRING "URL for OpenCL loader tarball")
|
||||||
|
set(OPENCL_LOADER_MD5 "011cdcbd41030be94f3fced6d763a52a" CACHE STRING "MD5 checksum of OpenCL loader tarball")
|
||||||
|
mark_as_advanced(OPENCL_LOADER_URL)
|
||||||
|
mark_as_advanced(OPENCL_LOADER_MD5)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
set(OPENCL_LOADER_URL "https://download.lammps.org/thirdparty/opencl-loader-2020.12.18.tar.gz" CACHE STRING "URL for OpenCL loader tarball")
|
|
||||||
mark_as_advanced(OPENCL_LOADER_URL)
|
|
||||||
ExternalProject_Add(opencl_loader
|
ExternalProject_Add(opencl_loader
|
||||||
URL ${OPENCL_LOADER_URL}
|
URL ${OPENCL_LOADER_URL}
|
||||||
URL_MD5 011cdcbd41030be94f3fced6d763a52a
|
URL_MD5 ${OPENCL_LOADER_MD5}
|
||||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src"
|
SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src"
|
||||||
BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build"
|
BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build"
|
||||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS}
|
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS}
|
||||||
|
|||||||
@ -218,7 +218,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
if(NOT DEFINED HIP_PLATFORM)
|
if(NOT DEFINED HIP_PLATFORM)
|
||||||
if(NOT DEFINED ENV{HIP_PLATFORM})
|
if(NOT DEFINED ENV{HIP_PLATFORM})
|
||||||
set(HIP_PLATFORM "hcc" CACHE PATH "HIP Platform to be used during compilation")
|
set(HIP_PLATFORM "amd" CACHE PATH "HIP Platform to be used during compilation")
|
||||||
else()
|
else()
|
||||||
set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE PATH "HIP Platform used during compilation")
|
set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE PATH "HIP Platform used during compilation")
|
||||||
endif()
|
endif()
|
||||||
@ -226,7 +226,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
|
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "hcc")
|
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
||||||
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
||||||
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
find_package(CUDA REQUIRED)
|
find_package(CUDA REQUIRED)
|
||||||
@ -284,7 +284,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
|
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
|
||||||
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
|
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "hcc")
|
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
||||||
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
||||||
|
|
||||||
if(HIP_COMPILER STREQUAL "clang")
|
if(HIP_COMPILER STREQUAL "clang")
|
||||||
@ -338,11 +338,16 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
if(DOWNLOAD_CUB)
|
if(DOWNLOAD_CUB)
|
||||||
message(STATUS "CUB download requested")
|
message(STATUS "CUB download requested")
|
||||||
|
set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
||||||
|
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
|
||||||
|
mark_as_advanced(CUB_URL)
|
||||||
|
mark_as_advanced(CUB_MD5)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
ExternalProject_Add(CUB
|
ExternalProject_Add(CUB
|
||||||
GIT_REPOSITORY https://github.com/NVlabs/cub
|
URL ${CUB_URL}
|
||||||
TIMEOUT 5
|
URL_MD5 ${CUB_MD5}
|
||||||
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
@ -354,7 +359,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
else()
|
else()
|
||||||
find_package(CUB)
|
find_package(CUB)
|
||||||
if(NOT CUB_FOUND)
|
if(NOT CUB_FOUND)
|
||||||
message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it")
|
message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_CUB=ON to download it")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -381,6 +386,12 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
|
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
|
||||||
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
elseif(HIP_PLATFORM STREQUAL "amd")
|
||||||
|
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_AMD__)
|
||||||
|
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
|
||||||
|
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_AMD__)
|
||||||
|
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(lammps PRIVATE gpu)
|
target_link_libraries(lammps PRIVATE gpu)
|
||||||
|
|||||||
@ -35,9 +35,13 @@ if(DOWNLOAD_KIM)
|
|||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
enable_language(Fortran)
|
enable_language(Fortran)
|
||||||
|
set(KIM_URL "https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" CACHE STRING "URL for KIM tarball")
|
||||||
|
set(KIM_MD5 "ae1ddda2ef7017ea07934e519d023dca" CACHE STRING "MD5 checksum of KIM tarball")
|
||||||
|
mark_as_advanced(KIM_URL)
|
||||||
|
mark_as_advanced(KIM_MD5)
|
||||||
ExternalProject_Add(kim_build
|
ExternalProject_Add(kim_build
|
||||||
URL https://s3.openkim.org/kim-api/kim-api-2.2.1.txz
|
URL ${KIM_URL}
|
||||||
URL_MD5 ae1ddda2ef7017ea07934e519d023dca
|
URL_MD5 ${KIM_MD5}
|
||||||
BINARY_DIR build
|
BINARY_DIR build
|
||||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
|
|||||||
@ -37,9 +37,13 @@ if(DOWNLOAD_KOKKOS)
|
|||||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
|
||||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.3.01.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
||||||
|
set(KOKKOS_MD5 "08201d1c7cf5bc458ce0f5b44a629d5a" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||||
|
mark_as_advanced(KOKKOS_URL)
|
||||||
|
mark_as_advanced(KOKKOS_MD5)
|
||||||
ExternalProject_Add(kokkos_build
|
ExternalProject_Add(kokkos_build
|
||||||
URL https://github.com/kokkos/kokkos/archive/3.3.01.tar.gz
|
URL ${KOKKOS_URL}
|
||||||
URL_MD5 08201d1c7cf5bc458ce0f5b44a629d5a
|
URL_MD5 ${KOKKOS_MD5}
|
||||||
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
||||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a
|
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a
|
||||||
)
|
)
|
||||||
|
|||||||
@ -15,10 +15,14 @@ endif()
|
|||||||
option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
|
option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
|
||||||
if(DOWNLOAD_LATTE)
|
if(DOWNLOAD_LATTE)
|
||||||
message(STATUS "LATTE download requested - we will build our own")
|
message(STATUS "LATTE download requested - we will build our own")
|
||||||
|
set(LATTE_URL "https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" CACHE STRING "URL for LATTE tarball")
|
||||||
|
set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball")
|
||||||
|
mark_as_advanced(LATTE_URL)
|
||||||
|
mark_as_advanced(LATTE_MD5)
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(latte_build
|
ExternalProject_Add(latte_build
|
||||||
URL https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz
|
URL ${LATTE_URL}
|
||||||
URL_MD5 820e73a457ced178c08c71389a385de7
|
URL_MD5 ${LATTE_MD5}
|
||||||
SOURCE_SUBDIR cmake
|
SOURCE_SUBDIR cmake
|
||||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
|
||||||
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
||||||
|
|||||||
@ -7,10 +7,15 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
|
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
|
||||||
if(DOWNLOAD_MSCG)
|
if(DOWNLOAD_MSCG)
|
||||||
|
set(MSCG_URL "https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz" CACHE STRING "URL for MSCG tarball")
|
||||||
|
set(MSCG_MD5 "8c45e269ee13f60b303edd7823866a91" CACHE STRING "MD5 checksum of MSCG tarball")
|
||||||
|
mark_as_advanced(MSCG_URL)
|
||||||
|
mark_as_advanced(MSCG_MD5)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(mscg_build
|
ExternalProject_Add(mscg_build
|
||||||
URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz
|
URL ${MSCG_URL}
|
||||||
URL_MD5 8c45e269ee13f60b303edd7823866a91
|
URL_MD5 ${MSCG_MD5}
|
||||||
SOURCE_SUBDIR src/CMake
|
SOURCE_SUBDIR src/CMake
|
||||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS}
|
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
|
|||||||
@ -53,10 +53,16 @@ if(DOWNLOAD_PLUMED)
|
|||||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a")
|
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz" CACHE STRING "URL for PLUMED tarball")
|
||||||
|
set(PLUMED_MD5 "95f29dd0c067577f11972ff90dfc7d12" CACHE STRING "MD5 checksum of PLUMED tarball")
|
||||||
|
mark_as_advanced(PLUMED_URL)
|
||||||
|
mark_as_advanced(PLUMED_MD5)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(plumed_build
|
ExternalProject_Add(plumed_build
|
||||||
URL https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz
|
URL ${PLUMED_URL}
|
||||||
URL_MD5 95f29dd0c067577f11972ff90dfc7d12
|
URL_MD5 ${PLUMED_MD5}
|
||||||
BUILD_IN_SOURCE 1
|
BUILD_IN_SOURCE 1
|
||||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||||
${CONFIGURE_REQUEST_PIC}
|
${CONFIGURE_REQUEST_PIC}
|
||||||
|
|||||||
@ -14,15 +14,19 @@ endif()
|
|||||||
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
|
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
|
||||||
if(DOWNLOAD_SCAFACOS)
|
if(DOWNLOAD_SCAFACOS)
|
||||||
message(STATUS "ScaFaCoS download requested - we will build our own")
|
message(STATUS "ScaFaCoS download requested - we will build our own")
|
||||||
|
set(SCAFACOS_URL "https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz" CACHE STRING "URL for SCAFACOS tarball")
|
||||||
|
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
|
||||||
|
mark_as_advanced(SCAFACOS_URL)
|
||||||
|
mark_as_advanced(SCAFACOS_MD5)
|
||||||
|
|
||||||
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
||||||
file(DOWNLOAD https://download.lammps.org/thirdparty/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||||
EXPECTED_HASH MD5=4baa1333bb28fcce102d505e1992d032)
|
EXPECTED_HASH MD5=4baa1333bb28fcce102d505e1992d032)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(scafacos_build
|
ExternalProject_Add(scafacos_build
|
||||||
URL https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz
|
URL ${SCAFACOS_URL}
|
||||||
URL_MD5 bd46d74e3296bd8a444d731bb10c1738
|
URL_MD5 ${SCAFACOS_MD5}
|
||||||
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
||||||
--enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m
|
--enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m
|
||||||
|
|||||||
@ -7,10 +7,14 @@ endif()
|
|||||||
option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT})
|
option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT})
|
||||||
if(DOWNLOAD_EIGEN3)
|
if(DOWNLOAD_EIGEN3)
|
||||||
message(STATUS "Eigen3 download requested - we will build our own")
|
message(STATUS "Eigen3 download requested - we will build our own")
|
||||||
|
set(EIGEN3_URL "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz" CACHE STRING "URL for Eigen3 tarball")
|
||||||
|
set(EIGEN3_MD5 "9e30f67e8531477de4117506fe44669b" CACHE STRING "MD5 checksum of Eigen3 tarball")
|
||||||
|
mark_as_advanced(EIGEN3_URL)
|
||||||
|
mark_as_advanced(EIGEN3_MD5)
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(Eigen3_build
|
ExternalProject_Add(Eigen3_build
|
||||||
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
|
URL ${EIGEN3_URL}
|
||||||
URL_MD5 9e30f67e8531477de4117506fe44669b
|
URL_MD5 ${EIGEN3_MD5}
|
||||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(Eigen3_build SOURCE_DIR)
|
ExternalProject_get_property(Eigen3_build SOURCE_DIR)
|
||||||
|
|||||||
@ -7,6 +7,11 @@ endif()
|
|||||||
option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT})
|
option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT})
|
||||||
if(DOWNLOAD_VORO)
|
if(DOWNLOAD_VORO)
|
||||||
message(STATUS "Voro++ download requested - we will build our own")
|
message(STATUS "Voro++ download requested - we will build our own")
|
||||||
|
set(VORO_URL "${LAMMPS_THIRDPARTY_URL}/voro++-0.4.6.tar.gz" CACHE STRING "URL for Voro++ tarball")
|
||||||
|
set(VORO_MD5 "2338b824c3b7b25590e18e8df5d68af9" CACHE STRING "MD5 checksum for Voro++ tarball")
|
||||||
|
mark_as_advanced(VORO_URL)
|
||||||
|
mark_as_advanced(VORO_MD5)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
@ -22,8 +27,8 @@ if(DOWNLOAD_VORO)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
ExternalProject_Add(voro_build
|
ExternalProject_Add(voro_build
|
||||||
URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz
|
URL ${VORO_URL}
|
||||||
URL_MD5 2338b824c3b7b25590e18e8df5d68af9
|
URL_MD5 ${VORO_MD5}
|
||||||
PATCH_COMMAND patch -b -p0 < ${LAMMPS_LIB_SOURCE_DIR}/voronoi/voro-make.patch
|
PATCH_COMMAND patch -b -p0 < ${LAMMPS_LIB_SOURCE_DIR}/voronoi/voro-make.patch
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND make ${VORO_BUILD_OPTIONS}
|
BUILD_COMMAND make ${VORO_BUILD_OPTIONS}
|
||||||
|
|||||||
@ -2,10 +2,13 @@ message(STATUS "Downloading and building YAML library")
|
|||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
set(YAML_URL "https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz" CACHE STRING "URL for libyaml tarball")
|
set(YAML_URL "https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz" CACHE STRING "URL for libyaml tarball")
|
||||||
|
set(YAML_MD5 "bb15429d8fb787e7d3f1c83ae129a999" CACHE STRING "MD5 checksum of libyaml tarball")
|
||||||
mark_as_advanced(YAML_URL)
|
mark_as_advanced(YAML_URL)
|
||||||
|
mark_as_advanced(YAML_MD5)
|
||||||
|
|
||||||
ExternalProject_Add(libyaml
|
ExternalProject_Add(libyaml
|
||||||
URL ${YAML_URL}
|
URL ${YAML_URL}
|
||||||
URL_MD5 bb15429d8fb787e7d3f1c83ae129a999
|
URL_MD5 ${YAML_MD5}
|
||||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/yaml-src"
|
SOURCE_DIR "${CMAKE_BINARY_DIR}/yaml-src"
|
||||||
BINARY_DIR "${CMAKE_BINARY_DIR}/yaml-build"
|
BINARY_DIR "${CMAKE_BINARY_DIR}/yaml-build"
|
||||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure ${CONFIGURE_REQUEST_PIC}
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure ${CONFIGURE_REQUEST_PIC}
|
||||||
|
|||||||
@ -125,7 +125,7 @@ CMake build
|
|||||||
# default is sm_50
|
# default is sm_50
|
||||||
-D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip
|
-D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip
|
||||||
# value depends on selected HIP_PLATFORM
|
# value depends on selected HIP_PLATFORM
|
||||||
# default is 'gfx906' for HIP_PLATFORM=hcc and 'sm_50' for HIP_PLATFORM=nvcc
|
# default is 'gfx906' for HIP_PLATFORM=amd and 'sm_50' for HIP_PLATFORM=nvcc
|
||||||
-D HIP_USE_DEVICE_SORT=value # enables GPU sorting
|
-D HIP_USE_DEVICE_SORT=value # enables GPU sorting
|
||||||
# value = yes (default) or no
|
# value = yes (default) or no
|
||||||
-D CUDPP_OPT=value # use GPU binning on with CUDA (should be off for modern GPUs)
|
-D CUDPP_OPT=value # use GPU binning on with CUDA (should be off for modern GPUs)
|
||||||
@ -169,17 +169,24 @@ desired, you can set :code:`USE_STATIC_OPENCL_LOADER` to :code:`no`.
|
|||||||
|
|
||||||
If you are compiling with HIP, note that before running CMake you will have to
|
If you are compiling with HIP, note that before running CMake you will have to
|
||||||
set appropriate environment variables. Some variables such as
|
set appropriate environment variables. Some variables such as
|
||||||
:code:`HCC_AMDGPU_TARGET` or :code:`CUDA_PATH` are necessary for :code:`hipcc`
|
:code:`HCC_AMDGPU_TARGET` (for ROCm <= 4.0) or :code:`CUDA_PATH` are necessary for :code:`hipcc`
|
||||||
and the linker to work correctly.
|
and the linker to work correctly.
|
||||||
|
|
||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
# AMDGPU target
|
# AMDGPU target (ROCm <= 4.0)
|
||||||
export HIP_PLATFORM=hcc
|
export HIP_PLATFORM=hcc
|
||||||
export HCC_AMDGPU_TARGET=gfx906
|
export HCC_AMDGPU_TARGET=gfx906
|
||||||
cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc ..
|
cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc ..
|
||||||
make -j 4
|
make -j 4
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
# AMDGPU target (ROCm >= 4.1)
|
||||||
|
export HIP_PLATFORM=amd
|
||||||
|
cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc ..
|
||||||
|
make -j 4
|
||||||
|
|
||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
# CUDA target (not recommended, use GPU_ARCH=cuda)
|
# CUDA target (not recommended, use GPU_ARCH=cuda)
|
||||||
|
|||||||
@ -4,10 +4,10 @@ Adding tests for unit testing
|
|||||||
This section discusses adding or expanding tests for the unit test
|
This section discusses adding or expanding tests for the unit test
|
||||||
infrastructure included into the LAMMPS source code distribution.
|
infrastructure included into the LAMMPS source code distribution.
|
||||||
Unlike example inputs, unit tests focus on testing the "local" behavior
|
Unlike example inputs, unit tests focus on testing the "local" behavior
|
||||||
of individual features, tend to run very fast, and should be set up to
|
of individual features, tend to run fast, and should be set up to cover
|
||||||
cover as much of the added code as possible. When contributing code to
|
as much of the added code as possible. When contributing code to the
|
||||||
the distribution, the LAMMPS developers will appreciate if additions
|
distribution, the LAMMPS developers will appreciate if additions to the
|
||||||
to the integrated unit test facility are included.
|
integrated unit test facility are included.
|
||||||
|
|
||||||
Given the complex nature of MD simulations where many operations can
|
Given the complex nature of MD simulations where many operations can
|
||||||
only be performed when suitable "real" simulation environment has been
|
only be performed when suitable "real" simulation environment has been
|
||||||
@ -50,6 +50,9 @@ available:
|
|||||||
* - File name:
|
* - File name:
|
||||||
- Test name:
|
- Test name:
|
||||||
- Description:
|
- Description:
|
||||||
|
* - ``test_argutils.cpp``
|
||||||
|
- ArgInfo
|
||||||
|
- Tests for ``ArgInfo`` class used by LAMMPS
|
||||||
* - ``test_fmtlib.cpp``
|
* - ``test_fmtlib.cpp``
|
||||||
- FmtLib
|
- FmtLib
|
||||||
- Tests for ``fmtlib::`` functions used by LAMMPS
|
- Tests for ``fmtlib::`` functions used by LAMMPS
|
||||||
@ -155,23 +158,27 @@ have the desired effect:
|
|||||||
{
|
{
|
||||||
ASSERT_EQ(lmp->update->ntimestep, 0);
|
ASSERT_EQ(lmp->update->ntimestep, 0);
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
BEGIN_HIDE_OUTPUT();
|
||||||
lmp->input->one("reset_timestep 10");
|
command("reset_timestep 10");
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
END_HIDE_OUTPUT();
|
||||||
ASSERT_EQ(lmp->update->ntimestep, 10);
|
ASSERT_EQ(lmp->update->ntimestep, 10);
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
BEGIN_HIDE_OUTPUT();
|
||||||
lmp->input->one("reset_timestep 0");
|
command("reset_timestep 0");
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
END_HIDE_OUTPUT();
|
||||||
ASSERT_EQ(lmp->update->ntimestep, 0);
|
ASSERT_EQ(lmp->update->ntimestep, 0);
|
||||||
|
|
||||||
|
TEST_FAILURE(".*ERROR: Timestep must be >= 0.*", command("reset_timestep -10"););
|
||||||
|
TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep"););
|
||||||
|
TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep 10 10"););
|
||||||
|
TEST_FAILURE(".*ERROR: Expected integer .*", command("reset_timestep xxx"););
|
||||||
}
|
}
|
||||||
|
|
||||||
Please note the use of the (global) verbose variable to control whether
|
Please note the use of the ``BEGIN_HIDE_OUTPUT`` and ``END_HIDE_OUTPUT``
|
||||||
the LAMMPS command will be silent by capturing the output or not. In
|
functions that will capture output from running LAMMPS. This is normally
|
||||||
the default case, verbose == false, the test output will be compact and
|
discarded but by setting the verbose flag (via setting the ``TEST_ARGS``
|
||||||
not mixed with LAMMPS output. However setting the verbose flag (via
|
environment variable, ``TEST_ARGS=-v``) it can be printed and used to
|
||||||
setting the ``TEST_ARGS`` environment variable, ``TEST_ARGS=-v``) can be
|
understand why tests fail unexpectedly.
|
||||||
helpful to understand why tests fail unexpectedly.
|
|
||||||
|
|
||||||
Another complexity of these tests stems from the need to capture
|
Another complexity of these tests stems from the need to capture
|
||||||
situations where LAMMPS will stop with an error, i.e. handle so-called
|
situations where LAMMPS will stop with an error, i.e. handle so-called
|
||||||
@ -210,6 +217,12 @@ The following test programs are currently available:
|
|||||||
* - ``test_lattice_region.cpp``
|
* - ``test_lattice_region.cpp``
|
||||||
- LatticeRegion
|
- LatticeRegion
|
||||||
- Tests to validate the :doc:`lattice <lattice>` and :doc:`region <region>` commands
|
- Tests to validate the :doc:`lattice <lattice>` and :doc:`region <region>` commands
|
||||||
|
* - ``test_groups.cpp``
|
||||||
|
- GroupTest
|
||||||
|
- Tests to validate the :doc:`group <group>` command
|
||||||
|
* - ``test_variables.cpp``
|
||||||
|
- VariableTest
|
||||||
|
- Tests to validate the :doc:`variable <variable>` command
|
||||||
* - ``test_kim_commands.cpp``
|
* - ``test_kim_commands.cpp``
|
||||||
- KimCommands
|
- KimCommands
|
||||||
- Tests for several commands from the :ref:`KIM package <PKG-KIM>`
|
- Tests for several commands from the :ref:`KIM package <PKG-KIM>`
|
||||||
|
|||||||
@ -71,6 +71,8 @@ package:
|
|||||||
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
|
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
|
||||||
| :ref:`PERI <PKG-PERI>` | Peridynamics models | :doc:`pair_style peri <pair_peri>` | peri | no |
|
| :ref:`PERI <PKG-PERI>` | Peridynamics models | :doc:`pair_style peri <pair_peri>` | peri | no |
|
||||||
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
|
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
|
||||||
|
| :ref:`PLUGIN <PKG-PLUGIN>` | Plugin loader command | :doc:`plugin <plugin>` | plugins | no |
|
||||||
|
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
|
||||||
| :ref:`POEMS <PKG-POEMS>` | coupled rigid body motion | :doc:`fix poems <fix_poems>` | rigid | int |
|
| :ref:`POEMS <PKG-POEMS>` | coupled rigid body motion | :doc:`fix poems <fix_poems>` | rigid | int |
|
||||||
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
|
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
|
||||||
| :ref:`PYTHON <PKG-PYTHON>` | embed Python code in an input script | :doc:`python <python>` | python | sys |
|
| :ref:`PYTHON <PKG-PYTHON>` | embed Python code in an input script | :doc:`python <python>` | python | sys |
|
||||||
|
|||||||
@ -15,7 +15,7 @@ Syntax
|
|||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
keyword = *first* or *last* or *every* or *skip* or *start* or *stop* or *dump*
|
keyword = *first* or *last* or *every* or *skip* or *start* or *stop* or *post* or *dump*
|
||||||
*first* args = Nfirst
|
*first* args = Nfirst
|
||||||
Nfirst = dump timestep to start on
|
Nfirst = dump timestep to start on
|
||||||
*last* args = Nlast
|
*last* args = Nlast
|
||||||
@ -28,6 +28,7 @@ Syntax
|
|||||||
Nstart = timestep on which pseudo run will start
|
Nstart = timestep on which pseudo run will start
|
||||||
*stop* args = Nstop
|
*stop* args = Nstop
|
||||||
Nstop = timestep to which pseudo run will end
|
Nstop = timestep to which pseudo run will end
|
||||||
|
*post* value = *yes* or *no*
|
||||||
*dump* args = same as :doc:`read_dump <read_dump>` command starting with its field arguments
|
*dump* args = same as :doc:`read_dump <read_dump>` command starting with its field arguments
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
@ -154,6 +155,10 @@ Also note that an error will occur if you read a snapshot from the
|
|||||||
dump file with a timestep value larger than the *stop* setting you
|
dump file with a timestep value larger than the *stop* setting you
|
||||||
have specified.
|
have specified.
|
||||||
|
|
||||||
|
The *post* keyword can be used to minimize the output to the screen that
|
||||||
|
happens after a *rerun* command, similar to the post keyword of the
|
||||||
|
:doc:`run command <run>`. It is set to *no* by default.
|
||||||
|
|
||||||
The *dump* keyword is required and must be the last keyword specified.
|
The *dump* keyword is required and must be the last keyword specified.
|
||||||
Its arguments are passed internally to the :doc:`read_dump <read_dump>`
|
Its arguments are passed internally to the :doc:`read_dump <read_dump>`
|
||||||
command. The first argument following the *dump* keyword should be
|
command. The first argument following the *dump* keyword should be
|
||||||
@ -226,4 +231,4 @@ Default
|
|||||||
|
|
||||||
The option defaults are first = 0, last = a huge value (effectively
|
The option defaults are first = 0, last = a huge value (effectively
|
||||||
infinity), start = same as first, stop = same as last, every = 0, skip
|
infinity), start = same as first, stop = same as last, every = 0, skip
|
||||||
= 1;
|
= 1, post = no;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# /* ----------------------------------------------------------------------
|
# /* ----------------------------------------------------------------------
|
||||||
# Generic Linux Makefile for HIP
|
# Generic Linux Makefile for HIP
|
||||||
# - export HIP_PLATFORM=hcc (or nvcc) before execution
|
# - export HIP_PLATFORM=amd (or nvcc) before execution
|
||||||
# - change HIP_ARCH for your GPU
|
# - change HIP_ARCH for your GPU
|
||||||
# ------------------------------------------------------------------------- */
|
# ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -42,6 +42,10 @@ ifeq (hcc,$(HIP_PLATFORM))
|
|||||||
HIP_OPTS += -ffast-math
|
HIP_OPTS += -ffast-math
|
||||||
# possible values: gfx803,gfx900,gfx906
|
# possible values: gfx803,gfx900,gfx906
|
||||||
HIP_ARCH = gfx906
|
HIP_ARCH = gfx906
|
||||||
|
else ifeq (amd,$(HIP_PLATFORM))
|
||||||
|
HIP_OPTS += -ffast-math
|
||||||
|
# possible values: gfx803,gfx900,gfx906
|
||||||
|
HIP_ARCH = gfx906
|
||||||
else ifeq (nvcc,$(HIP_PLATFORM))
|
else ifeq (nvcc,$(HIP_PLATFORM))
|
||||||
HIP_OPTS += --use_fast_math
|
HIP_OPTS += --use_fast_math
|
||||||
HIP_ARCH = -gencode arch=compute_30,code=[sm_30,compute_30] -gencode arch=compute_32,code=[sm_32,compute_32] -gencode arch=compute_35,code=[sm_35,compute_35] \
|
HIP_ARCH = -gencode arch=compute_30,code=[sm_30,compute_30] -gencode arch=compute_32,code=[sm_32,compute_32] -gencode arch=compute_35,code=[sm_35,compute_35] \
|
||||||
|
|||||||
@ -212,8 +212,8 @@ additionally requires cub (https://nvlabs.github.io/cub). Download and
|
|||||||
extract the cub directory to lammps/lib/gpu/ or specify an appropriate
|
extract the cub directory to lammps/lib/gpu/ or specify an appropriate
|
||||||
path in lammps/lib/gpu/Makefile.hip.
|
path in lammps/lib/gpu/Makefile.hip.
|
||||||
2. In Makefile.hip it is possible to specify the target platform via
|
2. In Makefile.hip it is possible to specify the target platform via
|
||||||
export HIP_PLATFORM=hcc or HIP_PLATFORM=nvcc as well as the target
|
export HIP_PLATFORM=amd (ROCm >= 4.1), HIP_PLATFORM=hcc (ROCm <= 4.0)
|
||||||
architecture (gfx803, gfx900, gfx906 etc.)
|
or HIP_PLATFORM=nvcc as well as the target architecture (gfx803, gfx900, gfx906 etc.)
|
||||||
3. If your MPI implementation does not support `mpicxx --showme` command,
|
3. If your MPI implementation does not support `mpicxx --showme` command,
|
||||||
it is required to specify the corresponding MPI compiler and linker flags
|
it is required to specify the corresponding MPI compiler and linker flags
|
||||||
in lammps/lib/gpu/Makefile.hip and in lammps/src/MAKE/OPTIONS/Makefile.hip.
|
in lammps/lib/gpu/Makefile.hip and in lammps/src/MAKE/OPTIONS/Makefile.hip.
|
||||||
@ -278,4 +278,3 @@ and
|
|||||||
Brown, W.M., Masako, Y. Implementing Molecular Dynamics on Hybrid High
|
Brown, W.M., Masako, Y. Implementing Molecular Dynamics on Hybrid High
|
||||||
Performance Computers - Three-Body Potentials. Computer Physics Communications.
|
Performance Computers - Three-Body Potentials. Computer Physics Communications.
|
||||||
2013. 184: p. 2785–2793.
|
2013. 184: p. 2785–2793.
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#ifdef __HIP_PLATFORM_HCC__
|
#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)
|
||||||
#define CONFIG_ID 303
|
#define CONFIG_ID 303
|
||||||
#define SIMD_SIZE 64
|
#define SIMD_SIZE 64
|
||||||
#else
|
#else
|
||||||
@ -161,7 +161,7 @@
|
|||||||
// KERNEL MACROS - TEXTURES
|
// KERNEL MACROS - TEXTURES
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __HIP_PLATFORM_HCC__
|
#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)
|
||||||
#define _texture(name, type) __device__ type* name
|
#define _texture(name, type) __device__ type* name
|
||||||
#define _texture_2d(name, type) __device__ type* name
|
#define _texture_2d(name, type) __device__ type* name
|
||||||
#else
|
#else
|
||||||
@ -201,7 +201,7 @@
|
|||||||
#define mu_tex mu_
|
#define mu_tex mu_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __HIP_PLATFORM_HCC__
|
#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)
|
||||||
|
|
||||||
#undef fetch4
|
#undef fetch4
|
||||||
#undef fetch
|
#undef fetch
|
||||||
@ -266,7 +266,7 @@ typedef struct _double4 double4;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CUDA_PRE_NINE) || defined(__HIP_PLATFORM_HCC__)
|
#if defined(CUDA_PRE_NINE) || defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)
|
||||||
|
|
||||||
#ifdef _SINGLE_SINGLE
|
#ifdef _SINGLE_SINGLE
|
||||||
#define shfl_down __shfl_down
|
#define shfl_down __shfl_down
|
||||||
|
|||||||
@ -17,21 +17,21 @@
|
|||||||
|
|
||||||
#include "pair_lj_cut_coul_long.h"
|
#include "pair_lj_cut_coul_long.h"
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstring>
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
#include "error.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "kspace.h"
|
#include "kspace.h"
|
||||||
#include "update.h"
|
|
||||||
#include "respa.h"
|
|
||||||
#include "neighbor.h"
|
|
||||||
#include "neigh_list.h"
|
|
||||||
#include "neigh_request.h"
|
|
||||||
#include "math_const.h"
|
#include "math_const.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "neigh_list.h"
|
||||||
|
#include "neigh_request.h"
|
||||||
|
#include "neighbor.h"
|
||||||
|
#include "respa.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace MathConst;
|
using namespace MathConst;
|
||||||
|
|||||||
@ -25,10 +25,11 @@
|
|||||||
----------------------------------------------------------------------*/
|
----------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "reaxc_tool_box.h"
|
#include "reaxc_tool_box.h"
|
||||||
|
#include "reaxc_defs.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "reaxc_defs.h"
|
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
@ -49,62 +50,58 @@ int Tokenize( char* s, char*** tok )
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* safe malloc */
|
/* safe malloc */
|
||||||
void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name )
|
void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name )
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
char errmsg[256];
|
|
||||||
|
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
snprintf(errmsg, 256, "Trying to allocate %ld bytes for array %s. "
|
auto errmsg = fmt::format("Trying to allocate {} bytes for array {}. "
|
||||||
"returning NULL.", n, name);
|
"returning NULL.", n, name);
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
||||||
else fputs(errmsg,stderr);
|
else fputs(errmsg.c_str(),stderr);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = malloc( n );
|
ptr = malloc( n );
|
||||||
if (ptr == nullptr) {
|
if (ptr == nullptr) {
|
||||||
snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n, name);
|
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}",
|
||||||
|
n, name);
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
||||||
else fputs(errmsg,stderr);
|
else fputs(errmsg.c_str(),stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* safe calloc */
|
/* safe calloc */
|
||||||
void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name )
|
void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name )
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
char errmsg[256];
|
|
||||||
|
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
snprintf(errmsg, 256, "Trying to allocate %ld elements for array %s. "
|
auto errmsg = fmt::format("Trying to allocate {} elements for array {}. "
|
||||||
"returning NULL.\n", n, name );
|
"returning NULL.\n", n, name);
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
||||||
else fputs(errmsg,stderr);
|
else fputs(errmsg.c_str(),stderr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
snprintf(errmsg, 256, "Elements size for array %s is %ld. "
|
auto errmsg = fmt::format("Elements size for array {} is {}. "
|
||||||
"returning NULL", name, size );
|
"returning NULL", name, size);
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
||||||
else fputs(errmsg,stderr);
|
else fputs(errmsg.c_str(),stderr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = calloc( n, size );
|
ptr = calloc( n, size );
|
||||||
if (ptr == nullptr) {
|
if (ptr == nullptr) {
|
||||||
char errmsg[256];
|
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}",
|
||||||
snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n*size, name);
|
n*size, name);
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
||||||
else fputs(errmsg,stderr);
|
else fputs(errmsg.c_str(),stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
@ -115,14 +112,14 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c
|
|||||||
void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name )
|
void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name )
|
||||||
{
|
{
|
||||||
if (ptr == nullptr) {
|
if (ptr == nullptr) {
|
||||||
char errmsg[256];
|
auto errmsg = fmt::format("Trying to free the already free()'d pointer {}",
|
||||||
snprintf(errmsg, 256, "Trying to free the already NULL pointer %s", name );
|
name);
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
||||||
else fputs(errmsg,stderr);
|
else fputs(errmsg.c_str(),stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
free( ptr );
|
free(ptr);
|
||||||
ptr = nullptr;
|
ptr = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,14 +36,18 @@
|
|||||||
#define HEADER_LINE_LEN 62
|
#define HEADER_LINE_LEN 62
|
||||||
#define STR_LINE "%-37s%-24s\n"
|
#define STR_LINE "%-37s%-24s\n"
|
||||||
#define INT_LINE "%-37s%-24d\n"
|
#define INT_LINE "%-37s%-24d\n"
|
||||||
#define BIGINT_LINE "%-37s%-24ld\n"
|
#if defined(LAMMPS_SMALLSMALL)
|
||||||
|
#define BIGINT_LINE "%-37s%-24d\n"
|
||||||
|
#else
|
||||||
|
#define BIGINT_LINE "%-37s%-24lld\n"
|
||||||
|
#endif
|
||||||
#define INT2_LINE "%-36s%-12d,%-12d\n"
|
#define INT2_LINE "%-36s%-12d,%-12d\n"
|
||||||
#define REAL_LINE "%-37s%-24.3f\n"
|
#define REAL_LINE "%-37s%-24.3f\n"
|
||||||
#define SCI_LINE "%-37s%-24g\n"
|
#define SCI_LINE "%-37s%-24g\n"
|
||||||
#define REAL3_LINE "%-32s%9.3f,%9.3f,%9.3f\n"
|
#define REAL3_LINE "%-32s%9.3f,%9.3f,%9.3f\n"
|
||||||
|
|
||||||
#if defined(LAMMPS_BIGBIG)
|
#if defined(LAMMPS_BIGBIG)
|
||||||
#define INIT_DESC "%9ld%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass
|
#define INIT_DESC "%9lld%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass
|
||||||
#else
|
#else
|
||||||
#define INIT_DESC "%9d%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass
|
#define INIT_DESC "%9d%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass
|
||||||
#endif
|
#endif
|
||||||
@ -56,7 +60,7 @@
|
|||||||
#define SIZE_INFO_LEN3 31
|
#define SIZE_INFO_LEN3 31
|
||||||
|
|
||||||
#if defined(LAMMPS_BIGBIG)
|
#if defined(LAMMPS_BIGBIG)
|
||||||
#define ATOM_BASIC "%9ld%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge
|
#define ATOM_BASIC "%9lld%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge
|
||||||
#define ATOM_wV "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) Charge
|
#define ATOM_wV "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) Charge
|
||||||
#define ATOM_wF "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Fx Fy Fz) Charge
|
#define ATOM_wF "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Fx Fy Fz) Charge
|
||||||
#define ATOM_FULL "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) (Fx Fy Fz) Charge
|
#define ATOM_FULL "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) (Fx Fy Fz) Charge
|
||||||
@ -72,9 +76,9 @@
|
|||||||
#define ATOM_FULL_LEN 110
|
#define ATOM_FULL_LEN 110
|
||||||
|
|
||||||
#if defined(LAMMPS_BIGBIG)
|
#if defined(LAMMPS_BIGBIG)
|
||||||
#define BOND_BASIC "%9ld%9ld%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO
|
#define BOND_BASIC "%9lld%9lld%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO
|
||||||
#define BOND_FULL "%9ld%9ld%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2
|
#define BOND_FULL "%9lld%9lld%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2
|
||||||
#define ANGLE_BASIC "%9ld%9ld%9ld%10.3f\n" // Atom1 Atom2 Atom3 Theta
|
#define ANGLE_BASIC "%9lld%9lld%9lld%10.3f\n" // Atom1 Atom2 Atom3 Theta
|
||||||
#else
|
#else
|
||||||
#define BOND_BASIC "%9d%9d%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO
|
#define BOND_BASIC "%9d%9d%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO
|
||||||
#define BOND_FULL "%9d%9d%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2
|
#define BOND_FULL "%9d%9d%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2
|
||||||
|
|||||||
@ -106,6 +106,7 @@ void PairLJSwitch3CoulGaussLong::compute(int eflag, int vflag)
|
|||||||
firstneigh = list->firstneigh;
|
firstneigh = list->firstneigh;
|
||||||
|
|
||||||
// loop over neighbors of my atoms
|
// loop over neighbors of my atoms
|
||||||
|
|
||||||
for (ii = 0; ii < inum; ii++) {
|
for (ii = 0; ii < inum; ii++) {
|
||||||
i = ilist[ii];
|
i = ilist[ii];
|
||||||
qtmp = q[i];
|
qtmp = q[i];
|
||||||
@ -193,7 +194,7 @@ void PairLJSwitch3CoulGaussLong::compute(int eflag, int vflag)
|
|||||||
offset[itype][jtype];
|
offset[itype][jtype];
|
||||||
} else evdwl = 0.0;
|
} else evdwl = 0.0;
|
||||||
|
|
||||||
// Truncation, see Yaff Switch33
|
// Truncation, see Yaff Switch3
|
||||||
if (truncw>0) {
|
if (truncw>0) {
|
||||||
if (rsq < cut_ljsq[itype][jtype]) {
|
if (rsq < cut_ljsq[itype][jtype]) {
|
||||||
if (r>cut_lj[itype][jtype]-truncw) {
|
if (r>cut_lj[itype][jtype]-truncw) {
|
||||||
@ -262,19 +263,18 @@ void PairLJSwitch3CoulGaussLong::allocate()
|
|||||||
|
|
||||||
void PairLJSwitch3CoulGaussLong::settings(int narg, char **arg)
|
void PairLJSwitch3CoulGaussLong::settings(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command");
|
if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command");
|
||||||
|
|
||||||
cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp);
|
cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp);
|
||||||
|
|
||||||
if (narg == 2) {
|
if (narg == 2) {
|
||||||
cut_coul = cut_lj_global;
|
cut_coul = cut_lj_global;
|
||||||
truncw = utils::numeric(FLERR,arg[1],false,lmp);
|
truncw = utils::numeric(FLERR,arg[1],false,lmp);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cut_coul = utils::numeric(FLERR,arg[1],false,lmp);
|
cut_coul = utils::numeric(FLERR,arg[1],false,lmp);
|
||||||
truncw = utils::numeric(FLERR,arg[2],false,lmp);
|
truncw = utils::numeric(FLERR,arg[2],false,lmp);
|
||||||
}
|
}
|
||||||
if (truncw>0.0) truncwi = 1.0/truncw;
|
|
||||||
else truncwi = 0.0;
|
|
||||||
// reset cutoffs that have been explicitly set
|
// reset cutoffs that have been explicitly set
|
||||||
|
|
||||||
if (allocated) {
|
if (allocated) {
|
||||||
@ -332,6 +332,9 @@ void PairLJSwitch3CoulGaussLong::init_style()
|
|||||||
|
|
||||||
cut_coulsq = cut_coul * cut_coul;
|
cut_coulsq = cut_coul * cut_coul;
|
||||||
|
|
||||||
|
if (truncw>0.0) truncwi = 1.0/truncw;
|
||||||
|
else truncwi = 0.0;
|
||||||
|
|
||||||
// insure use of KSpace long-range solver, set g_ewald
|
// insure use of KSpace long-range solver, set g_ewald
|
||||||
|
|
||||||
if (force->kspace == nullptr)
|
if (force->kspace == nullptr)
|
||||||
@ -375,8 +378,7 @@ double PairLJSwitch3CoulGaussLong::init_one(int i, int j)
|
|||||||
double r6inv = r2inv*r2inv*r2inv;
|
double r6inv = r2inv*r2inv*r2inv;
|
||||||
double r12inv = r6inv*r6inv;
|
double r12inv = r6inv*r6inv;
|
||||||
offset[i][j] = lj3[i][j]*r12inv-lj4[i][j]*r6inv;
|
offset[i][j] = lj3[i][j]*r12inv-lj4[i][j]*r6inv;
|
||||||
}
|
} else {offset[i][j] = 0.0;}
|
||||||
else {offset[i][j] = 0.0;}
|
|
||||||
} else offset[i][j] = 0.0;
|
} else offset[i][j] = 0.0;
|
||||||
|
|
||||||
cut_ljsq[j][i] = cut_ljsq[i][j];
|
cut_ljsq[j][i] = cut_ljsq[i][j];
|
||||||
@ -431,8 +433,7 @@ double PairLJSwitch3CoulGaussLong::init_one(int i, int j)
|
|||||||
double t71 = -0.4e1 * cg * (0.2e1 * t10 * t11 - 0.2e1 * t10 * t14 + (cg5 - 0.2e1 * cg1) * t58 * cg5) * t26 / t4 / t41 / t9;
|
double t71 = -0.4e1 * cg * (0.2e1 * t10 * t11 - 0.2e1 * t10 * t14 + (cg5 - 0.2e1 * cg1) * t58 * cg5) * t26 / t4 / t41 / t9;
|
||||||
etail_ij = 2.0*MY_PI*all[0]*all[1]*t71;
|
etail_ij = 2.0*MY_PI*all[0]*all[1]*t71;
|
||||||
ptail_ij = 2.0*MY_PI*all[0]*all[1]*t71;
|
ptail_ij = 2.0*MY_PI*all[0]*all[1]*t71;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
double t1 = pow(cg3, 0.2e1);
|
double t1 = pow(cg3, 0.2e1);
|
||||||
double t2 = t1 * t1;
|
double t2 = t1 * t1;
|
||||||
double t3 = t2 * t1;
|
double t3 = t2 * t1;
|
||||||
@ -618,6 +619,7 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype,
|
|||||||
expn2 = 0.0;
|
expn2 = 0.0;
|
||||||
erfc2 = 0.0;
|
erfc2 = 0.0;
|
||||||
forcecoul2 = 0.0;
|
forcecoul2 = 0.0;
|
||||||
|
prefactor2 = 0.0;
|
||||||
} else {
|
} else {
|
||||||
r = sqrt(rsq);
|
r = sqrt(rsq);
|
||||||
rrij = lj2[itype][jtype]*r;
|
rrij = lj2[itype][jtype]*r;
|
||||||
|
|||||||
@ -106,6 +106,7 @@ void PairMM3Switch3CoulGaussLong::compute(int eflag, int vflag)
|
|||||||
firstneigh = list->firstneigh;
|
firstneigh = list->firstneigh;
|
||||||
|
|
||||||
// loop over neighbors of my atoms
|
// loop over neighbors of my atoms
|
||||||
|
|
||||||
for (ii = 0; ii < inum; ii++) {
|
for (ii = 0; ii < inum; ii++) {
|
||||||
i = ilist[ii];
|
i = ilist[ii];
|
||||||
qtmp = q[i];
|
qtmp = q[i];
|
||||||
@ -170,6 +171,7 @@ void PairMM3Switch3CoulGaussLong::compute(int eflag, int vflag)
|
|||||||
expn2 = 0.0;
|
expn2 = 0.0;
|
||||||
erfc2 = 0.0;
|
erfc2 = 0.0;
|
||||||
forcecoul2 = 0.0;
|
forcecoul2 = 0.0;
|
||||||
|
prefactor2 = 0.0;
|
||||||
} else {
|
} else {
|
||||||
rrij = lj2[itype][jtype]*r;
|
rrij = lj2[itype][jtype]*r;
|
||||||
expn2 = exp(-rrij*rrij);
|
expn2 = exp(-rrij*rrij);
|
||||||
@ -263,19 +265,18 @@ void PairMM3Switch3CoulGaussLong::allocate()
|
|||||||
|
|
||||||
void PairMM3Switch3CoulGaussLong::settings(int narg, char **arg)
|
void PairMM3Switch3CoulGaussLong::settings(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command");
|
if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command");
|
||||||
|
|
||||||
cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp);
|
cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp);
|
||||||
|
|
||||||
if (narg == 2) {
|
if (narg == 2) {
|
||||||
cut_coul = cut_lj_global;
|
cut_coul = cut_lj_global;
|
||||||
truncw = utils::numeric(FLERR,arg[1],false,lmp);
|
truncw = utils::numeric(FLERR,arg[1],false,lmp);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cut_coul = utils::numeric(FLERR,arg[1],false,lmp);
|
cut_coul = utils::numeric(FLERR,arg[1],false,lmp);
|
||||||
truncw = utils::numeric(FLERR,arg[2],false,lmp);
|
truncw = utils::numeric(FLERR,arg[2],false,lmp);
|
||||||
}
|
}
|
||||||
if (truncw>0.0) truncwi = 1.0/truncw;
|
|
||||||
else truncwi = 0.0;
|
|
||||||
// reset cutoffs that have been explicitly set
|
// reset cutoffs that have been explicitly set
|
||||||
|
|
||||||
if (allocated) {
|
if (allocated) {
|
||||||
@ -333,6 +334,9 @@ void PairMM3Switch3CoulGaussLong::init_style()
|
|||||||
|
|
||||||
cut_coulsq = cut_coul * cut_coul;
|
cut_coulsq = cut_coul * cut_coul;
|
||||||
|
|
||||||
|
if (truncw>0.0) truncwi = 1.0/truncw;
|
||||||
|
else truncwi = 0.0;
|
||||||
|
|
||||||
// insure use of KSpace long-range solver, set g_ewald
|
// insure use of KSpace long-range solver, set g_ewald
|
||||||
|
|
||||||
if (force->kspace == nullptr)
|
if (force->kspace == nullptr)
|
||||||
@ -375,8 +379,7 @@ double PairMM3Switch3CoulGaussLong::init_one(int i, int j)
|
|||||||
double r6inv = r2inv*r2inv*r2inv;
|
double r6inv = r2inv*r2inv*r2inv;
|
||||||
double expb = lj3[i][j]*exp(-lj1[i][j]*r);
|
double expb = lj3[i][j]*exp(-lj1[i][j]*r);
|
||||||
offset[i][j] = expb-lj4[i][j]*r6inv;
|
offset[i][j] = expb-lj4[i][j]*r6inv;
|
||||||
}
|
} else {offset[i][j] = 0.0;}
|
||||||
else {offset[i][j] = 0.0;}
|
|
||||||
} else offset[i][j] = 0.0;
|
} else offset[i][j] = 0.0;
|
||||||
|
|
||||||
cut_ljsq[j][i] = cut_ljsq[i][j];
|
cut_ljsq[j][i] = cut_ljsq[i][j];
|
||||||
@ -426,8 +429,7 @@ double PairMM3Switch3CoulGaussLong::init_one(int i, int j)
|
|||||||
double t64 = cg * (0.6388888889e3 * ((-t3 + (0.7e1 / 0.36e2 * cg5 - t5) * t1 - 0.2e1 / 0.3e1 * t8 * (cg5 - cg1 / 0.4e1) * cg3 + cg5 * t14) * t20 + t3 + (cg5 / 0.12e2 + t5) * t1 + (cg5 + cg1 / 0.3e1) * cg1 * cg3 / 0.2e1 + t30 * cg5) * t2 * t36 * t39 - 0.225e1 * (0.2e1 * t43 * t44 - 0.2e1 * t43 * t47 + cg5 * (cg5 - 0.2e1 * cg1)) * t54 * t1 / cg1 / t8 * t39);
|
double t64 = cg * (0.6388888889e3 * ((-t3 + (0.7e1 / 0.36e2 * cg5 - t5) * t1 - 0.2e1 / 0.3e1 * t8 * (cg5 - cg1 / 0.4e1) * cg3 + cg5 * t14) * t20 + t3 + (cg5 / 0.12e2 + t5) * t1 + (cg5 + cg1 / 0.3e1) * cg1 * cg3 / 0.2e1 + t30 * cg5) * t2 * t36 * t39 - 0.225e1 * (0.2e1 * t43 * t44 - 0.2e1 * t43 * t47 + cg5 * (cg5 - 0.2e1 * cg1)) * t54 * t1 / cg1 / t8 * t39);
|
||||||
etail_ij = 2.0*MY_PI*all[0]*all[1]*t64;
|
etail_ij = 2.0*MY_PI*all[0]*all[1]*t64;
|
||||||
ptail_ij = 2.0*MY_PI*all[0]*all[1]*t64;
|
ptail_ij = 2.0*MY_PI*all[0]*all[1]*t64;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
double t2 = pow(cg3, 0.2e1);
|
double t2 = pow(cg3, 0.2e1);
|
||||||
double t3 = t2 * t2;
|
double t3 = t2 * t2;
|
||||||
double t7 = 0.12e2 / cg3 * cg1;
|
double t7 = 0.12e2 / cg3 * cg1;
|
||||||
|
|||||||
@ -136,13 +136,16 @@ double RanMars::gaussian(double mu, double sigma)
|
|||||||
|
|
||||||
double RanMars::rayleigh(double sigma)
|
double RanMars::rayleigh(double sigma)
|
||||||
{
|
{
|
||||||
double first,v1;
|
double v1;
|
||||||
|
|
||||||
if (sigma <= 0) error->all(FLERR,"Invalid Rayleigh parameter");
|
if (sigma <= 0.0) error->all(FLERR,"Invalid Rayleigh parameter");
|
||||||
|
|
||||||
v1 = uniform();
|
v1 = uniform();
|
||||||
first = sigma*sqrt(-2.0*log(v1));
|
// avoid a floating point exception due to log(0.0)
|
||||||
return first;
|
// and just return a very big number
|
||||||
|
if (v1 == 0.0) return 1.0e300;
|
||||||
|
|
||||||
|
return sigma*sqrt(-2.0*log(v1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
@ -51,6 +51,7 @@ void Rerun::command(int narg, char **arg)
|
|||||||
if (strcmp(arg[iarg],"start") == 0) break;
|
if (strcmp(arg[iarg],"start") == 0) break;
|
||||||
if (strcmp(arg[iarg],"stop") == 0) break;
|
if (strcmp(arg[iarg],"stop") == 0) break;
|
||||||
if (strcmp(arg[iarg],"dump") == 0) break;
|
if (strcmp(arg[iarg],"dump") == 0) break;
|
||||||
|
if (strcmp(arg[iarg],"post") == 0) break;
|
||||||
iarg++;
|
iarg++;
|
||||||
}
|
}
|
||||||
int nfile = iarg;
|
int nfile = iarg;
|
||||||
@ -65,6 +66,7 @@ void Rerun::command(int narg, char **arg)
|
|||||||
int nskip = 1;
|
int nskip = 1;
|
||||||
int startflag = 0;
|
int startflag = 0;
|
||||||
int stopflag = 0;
|
int stopflag = 0;
|
||||||
|
int postflag = 0;
|
||||||
bigint start = -1;
|
bigint start = -1;
|
||||||
bigint stop = -1;
|
bigint stop = -1;
|
||||||
|
|
||||||
@ -101,6 +103,14 @@ void Rerun::command(int narg, char **arg)
|
|||||||
stop = utils::bnumeric(FLERR,arg[iarg+1],false,lmp);
|
stop = utils::bnumeric(FLERR,arg[iarg+1],false,lmp);
|
||||||
if (stop < 0) error->all(FLERR,"Illegal rerun command");
|
if (stop < 0) error->all(FLERR,"Illegal rerun command");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
} else if (strcmp(arg[iarg],"post") == 0) {
|
||||||
|
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
||||||
|
if (strcmp(arg[iarg+1],"yes") == 0) {
|
||||||
|
postflag = 1;
|
||||||
|
} else if (strcmp(arg[iarg+1],"no") == 0) {
|
||||||
|
postflag = 0;
|
||||||
|
} else error->all(FLERR,"Illegal rerun command");
|
||||||
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"dump") == 0) {
|
} else if (strcmp(arg[iarg],"dump") == 0) {
|
||||||
break;
|
break;
|
||||||
} else error->all(FLERR,"Illegal rerun command");
|
} else error->all(FLERR,"Illegal rerun command");
|
||||||
@ -182,7 +192,7 @@ void Rerun::command(int narg, char **arg)
|
|||||||
update->nsteps = ndump;
|
update->nsteps = ndump;
|
||||||
|
|
||||||
Finish finish(lmp);
|
Finish finish(lmp);
|
||||||
finish.end(1);
|
finish.end(postflag);
|
||||||
|
|
||||||
update->whichflag = 0;
|
update->whichflag = 0;
|
||||||
update->firststep = update->laststep = 0;
|
update->firststep = update->laststep = 0;
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public:
|
|||||||
Tokenizer& operator=(Tokenizer&&) = default;
|
Tokenizer& operator=(Tokenizer&&) = default;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void skip(int n);
|
void skip(int n=1);
|
||||||
bool has_next() const;
|
bool has_next() const;
|
||||||
bool contains(const std::string &str) const;
|
bool contains(const std::string &str) const;
|
||||||
std::string next();
|
std::string next();
|
||||||
@ -104,7 +104,7 @@ public:
|
|||||||
|
|
||||||
bool has_next() const;
|
bool has_next() const;
|
||||||
bool contains(const std::string &value) const;
|
bool contains(const std::string &value) const;
|
||||||
void skip(int ntokens);
|
void skip(int ntokens=1);
|
||||||
|
|
||||||
size_t count();
|
size_t count();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -108,7 +108,7 @@ void Velocity::command(int narg, char **arg)
|
|||||||
|
|
||||||
int initcomm = 0;
|
int initcomm = 0;
|
||||||
if (style == ZERO && rfix >= 0 &&
|
if (style == ZERO && rfix >= 0 &&
|
||||||
utils::strmatch(modify->fix[rfix]->style,"^rigid/small")) initcomm = 1;
|
utils::strmatch(modify->fix[rfix]->style,"^rigid.*/small.*")) initcomm = 1;
|
||||||
if ((style == CREATE || style == SET) && temperature &&
|
if ((style == CREATE || style == SET) && temperature &&
|
||||||
strcmp(temperature->style,"temp/cs") == 0) initcomm = 1;
|
strcmp(temperature->style,"temp/cs") == 0) initcomm = 1;
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ From: ubuntu:18.04
|
|||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
|
export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
|
||||||
git clone -b rocm-3.7.x https://github.com/ROCmSoftwarePlatform/hipCUB.git
|
git clone -b rocm-4.1.x https://github.com/ROCmSoftwarePlatform/hipCUB.git
|
||||||
mkdir hipCUB/build
|
mkdir hipCUB/build
|
||||||
cd hipCUB/build
|
cd hipCUB/build
|
||||||
CXX=hipcc cmake -D BUILD_TEST=off ..
|
CXX=hipcc cmake -D BUILD_TEST=off ..
|
||||||
|
|||||||
@ -2,7 +2,7 @@ BootStrap: docker
|
|||||||
From: ubuntu:20.04
|
From: ubuntu:20.04
|
||||||
|
|
||||||
%environment
|
%environment
|
||||||
export PATH=/usr/lib/ccache:/usr/local/cuda-11.0/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
|
export PATH=/usr/lib/ccache:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
|
||||||
%post
|
%post
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update
|
apt-get update
|
||||||
@ -90,7 +90,7 @@ From: ubuntu:20.04
|
|||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
|
export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
|
||||||
git clone -b rocm-3.7.x https://github.com/ROCmSoftwarePlatform/hipCUB.git
|
git clone -b rocm-4.1.x https://github.com/ROCmSoftwarePlatform/hipCUB.git
|
||||||
mkdir hipCUB/build
|
mkdir hipCUB/build
|
||||||
cd hipCUB/build
|
cd hipCUB/build
|
||||||
CXX=hipcc cmake -D BUILD_TEST=off ..
|
CXX=hipcc cmake -D BUILD_TEST=off ..
|
||||||
|
|||||||
@ -328,11 +328,7 @@ TEST_F(SimpleCommandsTest, Units)
|
|||||||
#if defined(LMP_PLUGIN)
|
#if defined(LMP_PLUGIN)
|
||||||
TEST_F(SimpleCommandsTest, Plugin)
|
TEST_F(SimpleCommandsTest, Plugin)
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__)
|
|
||||||
std::string loadfmt("plugin load {}plugin.dylib");
|
|
||||||
#else
|
|
||||||
std::string loadfmt("plugin load {}plugin.so");
|
std::string loadfmt("plugin load {}plugin.so");
|
||||||
#endif
|
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
lmp->input->one(fmt::format(loadfmt, "hello"));
|
lmp->input->one(fmt::format(loadfmt, "hello"));
|
||||||
auto text = ::testing::internal::GetCapturedStdout();
|
auto text = ::testing::internal::GetCapturedStdout();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
lammps_version: 10 Mar 2021
|
lammps_version: 10 Mar 2021
|
||||||
date_generated: Thu Mar 25 14:07:45 202
|
date_generated: Thu Mar 25 14:07:45 202
|
||||||
epsilon: 1e-14
|
epsilon: 5e-13
|
||||||
prerequisites: ! |
|
prerequisites: ! |
|
||||||
atom full
|
atom full
|
||||||
fix adapt
|
fix adapt
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
#include "../testing/systems/melt.h"
|
#include "../testing/systems/melt.h"
|
||||||
#include "../testing/utils.h"
|
#include "../testing/utils.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
#include "output.h"
|
||||||
|
#include "thermo.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@ -24,7 +26,7 @@
|
|||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
char *BINARY2TXT_BINARY = nullptr;
|
char *BINARY2TXT_BINARY = nullptr;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
class DumpAtomTest : public MeltTest {
|
class DumpAtomTest : public MeltTest {
|
||||||
std::string dump_style = "atom";
|
std::string dump_style = "atom";
|
||||||
@ -46,7 +48,14 @@ public:
|
|||||||
command(fmt::format("dump_modify id {}", dump_modify_options));
|
command(fmt::format("dump_modify id {}", dump_modify_options));
|
||||||
}
|
}
|
||||||
|
|
||||||
command(fmt::format("run {}", ntimesteps));
|
command(fmt::format("run {} post no", ntimesteps));
|
||||||
|
END_HIDE_OUTPUT();
|
||||||
|
}
|
||||||
|
|
||||||
|
void continue_dump(int ntimesteps)
|
||||||
|
{
|
||||||
|
BEGIN_HIDE_OUTPUT();
|
||||||
|
command(fmt::format("run {} pre no post no", ntimesteps));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +71,7 @@ public:
|
|||||||
command(fmt::format("dump_modify id1 {}", dump_modify_options));
|
command(fmt::format("dump_modify id1 {}", dump_modify_options));
|
||||||
}
|
}
|
||||||
|
|
||||||
command(fmt::format("run {}", ntimesteps));
|
command(fmt::format("run {} post no", ntimesteps));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,13 +455,16 @@ TEST_F(DumpAtomTest, binary_triclinic_with_image_run0)
|
|||||||
delete_file(converted_file);
|
delete_file(converted_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomTest, run1)
|
TEST_F(DumpAtomTest, run1plus1)
|
||||||
{
|
{
|
||||||
auto dump_file = "dump_run1.melt";
|
auto dump_file = "dump_run1plus1.melt";
|
||||||
generate_dump(dump_file, "", 1);
|
generate_dump(dump_file, "", 1);
|
||||||
|
|
||||||
ASSERT_FILE_EXISTS(dump_file);
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
ASSERT_EQ(count_lines(dump_file), 82);
|
ASSERT_EQ(count_lines(dump_file), 82);
|
||||||
|
continue_dump(1);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
ASSERT_EQ(count_lines(dump_file), 123);
|
||||||
delete_file(dump_file);
|
delete_file(dump_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,6 +478,34 @@ TEST_F(DumpAtomTest, run2)
|
|||||||
delete_file(dump_file);
|
delete_file(dump_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DumpAtomTest, rerun)
|
||||||
|
{
|
||||||
|
auto dump_file = "dump_rerun.melt";
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command("fix 1 all nve");
|
||||||
|
});
|
||||||
|
generate_dump(dump_file, "format line \"%d %d %20.15g %20.15g %20.15g\"", 1);
|
||||||
|
double pe_1, pe_2, pe_rerun;
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_1);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
ASSERT_EQ(count_lines(dump_file), 82);
|
||||||
|
continue_dump(1);
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_2);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
ASSERT_EQ(count_lines(dump_file), 123);
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file));
|
||||||
|
});
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
|
ASSERT_DOUBLE_EQ(pe_1, pe_rerun);
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
||||||
|
});
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
|
ASSERT_DOUBLE_EQ(pe_2, pe_rerun);
|
||||||
|
delete_file(dump_file);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomTest, multi_file_run1)
|
TEST_F(DumpAtomTest, multi_file_run1)
|
||||||
{
|
{
|
||||||
auto dump_file = "dump_run1_*.melt";
|
auto dump_file = "dump_run1_*.melt";
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
#include "../testing/systems/melt.h"
|
#include "../testing/systems/melt.h"
|
||||||
#include "../testing/utils.h"
|
#include "../testing/utils.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
#include "output.h"
|
||||||
|
#include "thermo.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@ -22,7 +24,7 @@
|
|||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
char *BINARY2TXT_BINARY = nullptr;
|
char *BINARY2TXT_BINARY = nullptr;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
class DumpCustomTest : public MeltTest {
|
class DumpCustomTest : public MeltTest {
|
||||||
std::string dump_style = "custom";
|
std::string dump_style = "custom";
|
||||||
@ -45,7 +47,14 @@ public:
|
|||||||
command(fmt::format("dump_modify id {}", dump_modify_options));
|
command(fmt::format("dump_modify id {}", dump_modify_options));
|
||||||
}
|
}
|
||||||
|
|
||||||
command(fmt::format("run {}", ntimesteps));
|
command(fmt::format("run {} post no", ntimesteps));
|
||||||
|
END_HIDE_OUTPUT();
|
||||||
|
}
|
||||||
|
|
||||||
|
void continue_dump(int ntimesteps)
|
||||||
|
{
|
||||||
|
BEGIN_HIDE_OUTPUT();
|
||||||
|
command(fmt::format("run {} pre no post no", ntimesteps));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +71,7 @@ public:
|
|||||||
command(fmt::format("dump_modify id1 {}", dump_modify_options));
|
command(fmt::format("dump_modify id1 {}", dump_modify_options));
|
||||||
}
|
}
|
||||||
|
|
||||||
command(fmt::format("run {}", ntimesteps));
|
command(fmt::format("run {} post no", ntimesteps));
|
||||||
END_HIDE_OUTPUT();
|
END_HIDE_OUTPUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,6 +271,64 @@ TEST_F(DumpCustomTest, with_variable_run1)
|
|||||||
delete_file(dump_file);
|
delete_file(dump_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DumpCustomTest, run1plus1)
|
||||||
|
{
|
||||||
|
auto dump_file = "dump_custom_run1plus1.melt";
|
||||||
|
auto fields = "id type x y z";
|
||||||
|
|
||||||
|
generate_dump(dump_file, fields, "units yes", 1);
|
||||||
|
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
auto lines = read_lines(dump_file);
|
||||||
|
ASSERT_EQ(lines.size(), 84);
|
||||||
|
continue_dump(1);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
lines = read_lines(dump_file);
|
||||||
|
ASSERT_EQ(lines.size(), 125);
|
||||||
|
delete_file(dump_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DumpCustomTest, run2)
|
||||||
|
{
|
||||||
|
auto dump_file = "dump_custom_run2.melt";
|
||||||
|
auto fields = "id type x y z";
|
||||||
|
generate_dump(dump_file, fields, "", 2);
|
||||||
|
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
ASSERT_EQ(count_lines(dump_file), 123);
|
||||||
|
delete_file(dump_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DumpCustomTest, rerun)
|
||||||
|
{
|
||||||
|
auto dump_file = "dump_rerun.melt";
|
||||||
|
auto fields = "id type xs ys zs";
|
||||||
|
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command("fix 1 all nve");
|
||||||
|
});
|
||||||
|
generate_dump(dump_file, fields, "format float %20.15g", 1);
|
||||||
|
double pe_1, pe_2, pe_rerun;
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_1);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
ASSERT_EQ(count_lines(dump_file), 82);
|
||||||
|
continue_dump(1);
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_2);
|
||||||
|
ASSERT_FILE_EXISTS(dump_file);
|
||||||
|
ASSERT_EQ(count_lines(dump_file), 123);
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file));
|
||||||
|
});
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
|
ASSERT_DOUBLE_EQ(pe_1, pe_rerun);
|
||||||
|
HIDE_OUTPUT([&] {
|
||||||
|
command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file));
|
||||||
|
});
|
||||||
|
lmp->output->thermo->evaluate_keyword("pe", &pe_rerun);
|
||||||
|
ASSERT_DOUBLE_EQ(pe_2, pe_rerun);
|
||||||
|
delete_file(dump_file);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
MPI_Init(&argc, &argv);
|
MPI_Init(&argc, &argv);
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
#include "potential_file_reader.h"
|
#include "potential_file_reader.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include "../testing/core.h"
|
#include "../testing/core.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -257,6 +258,67 @@ TEST_F(PotentialFileReaderTest, UnitConvert)
|
|||||||
delete reader;
|
delete reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class OpenPotentialTest : public LAMMPSTest {
|
||||||
|
};
|
||||||
|
|
||||||
|
// open for native units
|
||||||
|
TEST_F(OpenPotentialTest, Sw_native)
|
||||||
|
{
|
||||||
|
int convert_flag = utils::get_supported_conversions(utils::ENERGY);
|
||||||
|
BEGIN_CAPTURE_OUTPUT();
|
||||||
|
command("units metal");
|
||||||
|
FILE *fp = utils::open_potential("Si.sw", lmp, &convert_flag);
|
||||||
|
auto text = END_CAPTURE_OUTPUT();
|
||||||
|
double conv = utils::get_conversion_factor(utils::ENERGY, convert_flag);
|
||||||
|
|
||||||
|
ASSERT_NE(fp, nullptr);
|
||||||
|
ASSERT_DOUBLE_EQ(conv, 1.0);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// open with supported conversion enabled
|
||||||
|
TEST_F(OpenPotentialTest, Sw_conv)
|
||||||
|
{
|
||||||
|
int convert_flag = utils::get_supported_conversions(utils::ENERGY);
|
||||||
|
ASSERT_EQ(convert_flag, utils::METAL2REAL | utils::REAL2METAL);
|
||||||
|
BEGIN_HIDE_OUTPUT();
|
||||||
|
command("units real");
|
||||||
|
FILE *fp = utils::open_potential("Si.sw", lmp, &convert_flag);
|
||||||
|
auto text = END_CAPTURE_OUTPUT();
|
||||||
|
double conv = utils::get_conversion_factor(utils::ENERGY, convert_flag);
|
||||||
|
|
||||||
|
ASSERT_NE(fp, nullptr);
|
||||||
|
ASSERT_EQ(convert_flag, utils::METAL2REAL);
|
||||||
|
ASSERT_DOUBLE_EQ(conv, 23.060549);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// open with conversion disabled
|
||||||
|
TEST_F(OpenPotentialTest, Sw_noconv)
|
||||||
|
{
|
||||||
|
BEGIN_HIDE_OUTPUT();
|
||||||
|
command("units real");
|
||||||
|
END_HIDE_OUTPUT();
|
||||||
|
TEST_FAILURE(".*potential.*requires metal units but real.*",
|
||||||
|
utils::open_potential("Si.sw", lmp, nullptr););
|
||||||
|
BEGIN_HIDE_OUTPUT();
|
||||||
|
command("units lj");
|
||||||
|
END_HIDE_OUTPUT();
|
||||||
|
int convert_flag = utils::get_supported_conversions(utils::UNKNOWN);
|
||||||
|
ASSERT_EQ(convert_flag, utils::NOCONVERT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// open non-existing potential
|
||||||
|
TEST_F(OpenPotentialTest, No_file)
|
||||||
|
{
|
||||||
|
int convert_flag = utils::get_supported_conversions(utils::ENERGY);
|
||||||
|
BEGIN_HIDE_OUTPUT();
|
||||||
|
command("units metal");
|
||||||
|
FILE *fp = utils::open_potential("Unknown.sw", lmp, &convert_flag);
|
||||||
|
END_HIDE_OUTPUT();
|
||||||
|
ASSERT_EQ(fp,nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
MPI_Init(&argc, &argv);
|
MPI_Init(&argc, &argv);
|
||||||
|
|||||||
@ -43,6 +43,18 @@ TEST(Tokenizer, two_words)
|
|||||||
ASSERT_EQ(t.count(), 2);
|
ASSERT_EQ(t.count(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Tokenizer, skip)
|
||||||
|
{
|
||||||
|
Tokenizer t("test word", " ");
|
||||||
|
ASSERT_TRUE(t.has_next());
|
||||||
|
t.skip();
|
||||||
|
ASSERT_TRUE(t.has_next());
|
||||||
|
t.skip(1);
|
||||||
|
ASSERT_FALSE(t.has_next());
|
||||||
|
ASSERT_EQ(t.count(), 2);
|
||||||
|
ASSERT_THROW(t.skip(), TokenizerException);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Tokenizer, prefix_separators)
|
TEST(Tokenizer, prefix_separators)
|
||||||
{
|
{
|
||||||
Tokenizer t(" test word", " ");
|
Tokenizer t(" test word", " ");
|
||||||
@ -63,6 +75,18 @@ TEST(Tokenizer, iterate_words)
|
|||||||
ASSERT_EQ(t.count(), 2);
|
ASSERT_EQ(t.count(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Tokenizer, copy_constructor)
|
||||||
|
{
|
||||||
|
Tokenizer t(" test word ", " ");
|
||||||
|
ASSERT_THAT(t.next(), Eq("test"));
|
||||||
|
ASSERT_THAT(t.next(), Eq("word"));
|
||||||
|
ASSERT_EQ(t.count(), 2);
|
||||||
|
Tokenizer u(t);
|
||||||
|
ASSERT_THAT(u.next(), Eq("test"));
|
||||||
|
ASSERT_THAT(u.next(), Eq("word"));
|
||||||
|
ASSERT_EQ(u.count(), 2);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Tokenizer, no_separator_path)
|
TEST(Tokenizer, no_separator_path)
|
||||||
{
|
{
|
||||||
Tokenizer t("one", ":");
|
Tokenizer t("one", ":");
|
||||||
@ -139,6 +163,26 @@ TEST(ValueTokenizer, empty_string)
|
|||||||
ASSERT_FALSE(values.has_next());
|
ASSERT_FALSE(values.has_next());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(ValueTokenizer, two_words)
|
||||||
|
{
|
||||||
|
ValueTokenizer t("test word", " ");
|
||||||
|
ASSERT_THAT(t.next_string(), Eq("test"));
|
||||||
|
ASSERT_THAT(t.next_string(), Eq("word"));
|
||||||
|
ASSERT_THROW(t.next_string(), TokenizerException);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(ValueTokenizer, skip)
|
||||||
|
{
|
||||||
|
ValueTokenizer t("test word", " ");
|
||||||
|
ASSERT_TRUE(t.has_next());
|
||||||
|
t.skip();
|
||||||
|
ASSERT_TRUE(t.has_next());
|
||||||
|
t.skip(1);
|
||||||
|
ASSERT_FALSE(t.has_next());
|
||||||
|
ASSERT_EQ(t.count(), 2);
|
||||||
|
ASSERT_THROW(t.skip(), TokenizerException);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(ValueTokenizer, bad_integer)
|
TEST(ValueTokenizer, bad_integer)
|
||||||
{
|
{
|
||||||
ValueTokenizer values("f10");
|
ValueTokenizer values("f10");
|
||||||
|
|||||||
@ -331,6 +331,11 @@ TEST(Utils, valid_id7)
|
|||||||
ASSERT_TRUE(utils::is_id("___"));
|
ASSERT_TRUE(utils::is_id("___"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Utils, empty_id)
|
||||||
|
{
|
||||||
|
ASSERT_FALSE(utils::is_id(""));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Utils, invalid_id1)
|
TEST(Utils, invalid_id1)
|
||||||
{
|
{
|
||||||
ASSERT_FALSE(utils::is_id("+abc"));
|
ASSERT_FALSE(utils::is_id("+abc"));
|
||||||
@ -780,6 +785,11 @@ TEST(Utils, unit_conversion)
|
|||||||
ASSERT_DOUBLE_EQ(factor, 1.0 / 23.060549);
|
ASSERT_DOUBLE_EQ(factor, 1.0 / 23.060549);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Utils, timespec2seconds_off)
|
||||||
|
{
|
||||||
|
ASSERT_DOUBLE_EQ(utils::timespec2seconds("off"), -1.0);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Utils, timespec2seconds_ss)
|
TEST(Utils, timespec2seconds_ss)
|
||||||
{
|
{
|
||||||
ASSERT_DOUBLE_EQ(utils::timespec2seconds("45"), 45.0);
|
ASSERT_DOUBLE_EQ(utils::timespec2seconds("45"), 45.0);
|
||||||
@ -795,6 +805,11 @@ TEST(Utils, timespec2seconds_hhmmss)
|
|||||||
ASSERT_DOUBLE_EQ(utils::timespec2seconds("2:10:45"), 7845.0);
|
ASSERT_DOUBLE_EQ(utils::timespec2seconds("2:10:45"), 7845.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Utils, timespec2seconds_invalid)
|
||||||
|
{
|
||||||
|
ASSERT_DOUBLE_EQ(utils::timespec2seconds("2:aa:45"), -1.0);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Utils, date2num)
|
TEST(Utils, date2num)
|
||||||
{
|
{
|
||||||
ASSERT_EQ(utils::date2num("1Jan05"), 20050101);
|
ASSERT_EQ(utils::date2num("1Jan05"), 20050101);
|
||||||
@ -810,3 +825,32 @@ TEST(Utils, date2num)
|
|||||||
ASSERT_EQ(utils::date2num("30November 02"), 20021130);
|
ASSERT_EQ(utils::date2num("30November 02"), 20021130);
|
||||||
ASSERT_EQ(utils::date2num("31December100"), 1001231);
|
ASSERT_EQ(utils::date2num("31December100"), 1001231);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int compare(int a, int b, void *)
|
||||||
|
{
|
||||||
|
if (a < b)
|
||||||
|
return -1;
|
||||||
|
else if (a > b)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Utils, merge_sort)
|
||||||
|
{
|
||||||
|
int data[] = {773, 405, 490, 830, 632, 96, 428, 728, 912, 840, 878, 745, 213, 219, 249, 380,
|
||||||
|
894, 758, 575, 690, 61, 849, 19, 577, 338, 569, 898, 873, 448, 940, 431, 780,
|
||||||
|
472, 289, 65, 491, 641, 37, 367, 33, 407, 854, 594, 611, 845, 136, 107, 592,
|
||||||
|
275, 865, 158, 626, 399, 703, 686, 734, 188, 559, 781, 558, 737, 281, 638, 664,
|
||||||
|
533, 529, 62, 969, 595, 661, 837, 463, 624, 568, 615, 936, 206, 637, 91, 694,
|
||||||
|
214, 872, 468, 66, 775, 949, 486, 576, 255, 961, 480, 138, 177, 509, 333, 705,
|
||||||
|
10, 375, 321, 952, 210, 111, 475, 268, 708, 864, 244, 121, 988, 540, 942, 682,
|
||||||
|
750, 473, 478, 714, 955, 911, 482, 384, 144, 757, 697, 791, 420, 605, 447, 320};
|
||||||
|
|
||||||
|
const int num = sizeof(data) / sizeof(int);
|
||||||
|
utils::merge_sort(data, num, nullptr, &compare);
|
||||||
|
bool sorted = true;
|
||||||
|
for (int i = 1; i < num; ++i)
|
||||||
|
if (data[i - 1] > data[i]) sorted = false;
|
||||||
|
ASSERT_TRUE(sorted);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user