forked from lijiext/lammps
Merge branch 'master' into gpu-unittest
# Conflicts: # unittest/force-styles/test_pair_style.cpp # unittest/force-styles/tests/angle-cosine_periodic.yaml # unittest/force-styles/tests/mol-pair-born.yaml # unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml # unittest/force-styles/tests/mol-pair-born_coul_long.yaml # unittest/force-styles/tests/mol-pair-born_coul_msm.yaml # unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml # unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml # unittest/force-styles/tests/mol-pair-morse.yaml # unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml
This commit is contained in:
commit
190a689354
|
@ -24,7 +24,9 @@ jobs:
|
|||
shell: bash
|
||||
working-directory: ${{github.workspace}}/build
|
||||
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
|
||||
cmake --build . --parallel 2
|
||||
|
||||
|
|
|
@ -22,6 +22,11 @@ set(LAMMPS_TOOLS_DIR ${LAMMPS_DIR}/tools)
|
|||
set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python)
|
||||
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)
|
||||
|
||||
# by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed
|
||||
|
@ -31,7 +36,7 @@ endif()
|
|||
|
||||
# If enabled, no need to use LD_LIBRARY_PATH / DYLD_LIBRARY_PATH when installed
|
||||
option(LAMMPS_INSTALL_RPATH "Set runtime path for shared libraries linked to LAMMPS binaries" OFF)
|
||||
if (LAMMPS_INSTALL_RPATH)
|
||||
if(LAMMPS_INSTALL_RPATH)
|
||||
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
endif()
|
||||
|
@ -113,7 +118,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
|||
|
||||
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE
|
||||
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS
|
||||
QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
|
||||
PLUGIN QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
|
||||
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK
|
||||
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
|
||||
USER-LB USER-MANIFOLD USER-MEAMC USER-MESONT USER-MGPT USER-MISC USER-MOFFF
|
||||
|
@ -533,6 +538,18 @@ foreach(PKG_WITH_INCL CORESHELL QEQ USER-OMP USER-SDPD KOKKOS OPT USER-INTEL GPU
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
if(PKG_PLUGIN)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
|
||||
else()
|
||||
message(WARNING "Plugin loading will not work unless BUILD_SHARED_LIBS is enabled")
|
||||
endif()
|
||||
# link with -ldl or equivalent for plugin loading; except on Windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
# the windows version of LAMMPS requires a couple extra libraries
|
||||
# and the MPI library - if use - has to be linked right before those
|
||||
|
|
|
@ -55,11 +55,15 @@ if(BUILD_DOC)
|
|||
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"
|
||||
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"
|
||||
EXPECTED_MD5 a4a6a093a89bc2ccab1452d766b98e53)
|
||||
EXPECTED_MD5 ${MATHJAX_MD5})
|
||||
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-*)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)
|
||||
|
|
|
@ -8,10 +8,12 @@ endif()
|
|||
|
||||
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_MD5 "ecd1fa65e7de707cd5c00bdac56022cd" CACHE STRING "MD5 checksum of GTest tarball")
|
||||
mark_as_advanced(GTEST_URL)
|
||||
mark_as_advanced(GTEST_MD5)
|
||||
ExternalProject_Add(googletest
|
||||
URL ${GTEST_URL}
|
||||
URL_MD5 ecd1fa65e7de707cd5c00bdac56022cd
|
||||
URL ${GTEST_URL}
|
||||
URL_MD5 ${GTEST_MD5}
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build"
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_GTEST_OPTS}
|
||||
|
|
|
@ -86,7 +86,6 @@ endfunction(GenerateBinaryHeader)
|
|||
# fetch missing potential files
|
||||
function(FetchPotentials pkgfolder potfolder)
|
||||
if (EXISTS "${pkgfolder}/potentials.txt")
|
||||
set(LAMMPS_POTENTIALS_URL "https://download.lammps.org/potentials")
|
||||
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
|
||||
foreach(line ${linelist})
|
||||
string(FIND ${line} " " blank)
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
# Download and configure custom MPICH files 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)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL https://download.lammps.org/thirdparty/mpich2-win64-devel.tar.gz
|
||||
URL_MD5 4939fdb59d13182fd5dd65211e469f14
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
else()
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL https://download.lammps.org/thirdparty/mpich2-win32-devel.tar.gz
|
||||
URL_MD5 a61d153500dce44e21b755ee7257e031
|
||||
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
endif()
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
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)
|
||||
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
|
||||
URL ${OPENCL_LOADER_URL}
|
||||
URL_MD5 011cdcbd41030be94f3fced6d763a52a
|
||||
URL ${OPENCL_LOADER_URL}
|
||||
URL_MD5 ${OPENCL_LOADER_MD5}
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build"
|
||||
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 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()
|
||||
set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE PATH "HIP Platform used during compilation")
|
||||
endif()
|
||||
|
@ -226,7 +226,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
|
||||
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")
|
||||
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||
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_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)
|
||||
|
||||
if(HIP_COMPILER STREQUAL "clang")
|
||||
|
@ -338,11 +338,16 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
|
||||
if(DOWNLOAD_CUB)
|
||||
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)
|
||||
|
||||
ExternalProject_Add(CUB
|
||||
GIT_REPOSITORY https://github.com/NVlabs/cub
|
||||
TIMEOUT 5
|
||||
URL ${CUB_URL}
|
||||
URL_MD5 ${CUB_MD5}
|
||||
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
@ -354,7 +359,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
else()
|
||||
find_package(CUB)
|
||||
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()
|
||||
|
||||
|
@ -381,6 +386,12 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
|
||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
|
||||
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()
|
||||
|
||||
target_link_libraries(lammps PRIVATE gpu)
|
||||
|
|
|
@ -35,9 +35,13 @@ if(DOWNLOAD_KIM)
|
|||
include(ExternalProject)
|
||||
enable_language(C)
|
||||
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
|
||||
URL https://s3.openkim.org/kim-api/kim-api-2.2.1.txz
|
||||
URL_MD5 ae1ddda2ef7017ea07934e519d023dca
|
||||
URL ${KIM_URL}
|
||||
URL_MD5 ${KIM_MD5}
|
||||
BINARY_DIR build
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
||||
-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_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||
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
|
||||
URL https://github.com/kokkos/kokkos/archive/3.3.01.tar.gz
|
||||
URL_MD5 08201d1c7cf5bc458ce0f5b44a629d5a
|
||||
URL ${KOKKOS_URL}
|
||||
URL_MD5 ${KOKKOS_MD5}
|
||||
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
||||
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})
|
||||
if(DOWNLOAD_LATTE)
|
||||
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)
|
||||
ExternalProject_Add(latte_build
|
||||
URL https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz
|
||||
URL_MD5 820e73a457ced178c08c71389a385de7
|
||||
URL ${LATTE_URL}
|
||||
URL_MD5 ${LATTE_MD5}
|
||||
SOURCE_SUBDIR cmake
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
|
||||
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
||||
|
|
|
@ -7,10 +7,15 @@ else()
|
|||
endif()
|
||||
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
|
||||
if(DOWNLOAD_MSCG)
|
||||
set(MSCG_URL "https://github.com/uchicago-voth/MSCG-release/archive/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)
|
||||
ExternalProject_Add(mscg_build
|
||||
URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz
|
||||
URL_MD5 8c45e269ee13f60b303edd7823866a91
|
||||
URL ${MSCG_URL}
|
||||
URL_MD5 ${MSCG_MD5}
|
||||
SOURCE_SUBDIR src/CMake
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
|
|
|
@ -30,7 +30,12 @@ if(INTEL_LRT_MODE STREQUAL "THREADS")
|
|||
endif()
|
||||
endif()
|
||||
if(INTEL_LRT_MODE STREQUAL "C++11")
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT -DLMP_INTEL_LRT11)
|
||||
if(Threads_FOUND)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT -DLMP_INTEL_LRT11)
|
||||
target_link_libraries(lammps PRIVATE Threads::Threads)
|
||||
else()
|
||||
message(FATAL_ERROR "Must have working threads library for Long-range thread support")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
|
|
|
@ -2,8 +2,4 @@ set(MOLFILE_INCLUDE_DIR "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to
|
|||
set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}")
|
||||
add_library(molfile INTERFACE)
|
||||
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
|
||||
# no need to link with -ldl on windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE molfile)
|
||||
|
|
|
@ -53,10 +53,16 @@ if(DOWNLOAD_PLUMED)
|
|||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a")
|
||||
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)
|
||||
ExternalProject_Add(plumed_build
|
||||
URL https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz
|
||||
URL_MD5 95f29dd0c067577f11972ff90dfc7d12
|
||||
URL ${PLUMED_URL}
|
||||
URL_MD5 ${PLUMED_MD5}
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
${CONFIGURE_REQUEST_PIC}
|
||||
|
|
|
@ -14,15 +14,19 @@ endif()
|
|||
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
|
||||
if(DOWNLOAD_SCAFACOS)
|
||||
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.
|
||||
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)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(scafacos_build
|
||||
URL https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz
|
||||
URL_MD5 bd46d74e3296bd8a444d731bb10c1738
|
||||
URL ${SCAFACOS_URL}
|
||||
URL_MD5 ${SCAFACOS_MD5}
|
||||
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
||||
--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})
|
||||
if(DOWNLOAD_EIGEN3)
|
||||
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)
|
||||
ExternalProject_Add(Eigen3_build
|
||||
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
|
||||
URL_MD5 9e30f67e8531477de4117506fe44669b
|
||||
URL ${EIGEN3_URL}
|
||||
URL_MD5 ${EIGEN3_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
)
|
||||
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})
|
||||
if(DOWNLOAD_VORO)
|
||||
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)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
|
@ -22,8 +27,8 @@ if(DOWNLOAD_VORO)
|
|||
endif()
|
||||
|
||||
ExternalProject_Add(voro_build
|
||||
URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz
|
||||
URL_MD5 2338b824c3b7b25590e18e8df5d68af9
|
||||
URL ${VORO_URL}
|
||||
URL_MD5 ${VORO_MD5}
|
||||
PATCH_COMMAND patch -b -p0 < ${LAMMPS_LIB_SOURCE_DIR}/voronoi/voro-make.patch
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND make ${VORO_BUILD_OPTIONS}
|
||||
|
|
|
@ -2,10 +2,13 @@ message(STATUS "Downloading and building YAML library")
|
|||
|
||||
include(ExternalProject)
|
||||
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_MD5)
|
||||
|
||||
ExternalProject_Add(libyaml
|
||||
URL ${YAML_URL}
|
||||
URL_MD5 bb15429d8fb787e7d3f1c83ae129a999
|
||||
URL_MD5 ${YAML_MD5}
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/yaml-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/yaml-build"
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure ${CONFIGURE_REQUEST_PIC}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
|
||||
GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI
|
||||
POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
|
||||
PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
|
||||
USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
||||
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-MESODPD
|
||||
USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Basic build options
|
||||
===================
|
||||
|
||||
The following topics are covered on this page, for building both with
|
||||
The following topics are covered on this page, for building with both
|
||||
CMake and make:
|
||||
|
||||
* :ref:`Serial vs parallel build <serial>`
|
||||
|
|
|
@ -125,7 +125,7 @@ CMake build
|
|||
# default is sm_50
|
||||
-D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip
|
||||
# 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
|
||||
# value = yes (default) or no
|
||||
-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
|
||||
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.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
# AMDGPU target
|
||||
# AMDGPU target (ROCm <= 4.0)
|
||||
export HIP_PLATFORM=hcc
|
||||
export HCC_AMDGPU_TARGET=gfx906
|
||||
cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc ..
|
||||
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
|
||||
|
||||
# CUDA target (not recommended, use GPU_ARCH=cuda)
|
||||
|
|
|
@ -86,6 +86,7 @@ An alphabetic list of all general LAMMPS commands.
|
|||
* :doc:`pair_style <pair_style>`
|
||||
* :doc:`pair_write <pair_write>`
|
||||
* :doc:`partition <partition>`
|
||||
* :doc:`plugin <plugin>`
|
||||
* :doc:`prd <prd>`
|
||||
* :doc:`print <print>`
|
||||
* :doc:`processors <processors>`
|
||||
|
|
|
@ -126,7 +126,7 @@ OPT.
|
|||
* :doc:`quadratic (o) <dihedral_quadratic>`
|
||||
* :doc:`spherical <dihedral_spherical>`
|
||||
* :doc:`table (o) <dihedral_table>`
|
||||
* :doc:`table/cut <dihedral_table_cut>`
|
||||
* :doc:`table/cut <dihedral_table>`
|
||||
|
||||
.. _improper:
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ OPT.
|
|||
* :doc:`mgpt <pair_mgpt>`
|
||||
* :doc:`mie/cut (g) <pair_mie>`
|
||||
* :doc:`mliap <pair_mliap>`
|
||||
* :doc:`mm3/switch3/coulgauss/long <pair_mm3_switch3_coulgauss_long>`
|
||||
* :doc:`mm3/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
|
||||
* :doc:`momb <pair_momb>`
|
||||
* :doc:`morse (gkot) <pair_morse>`
|
||||
* :doc:`morse/smooth/linear (o) <pair_morse>`
|
||||
|
|
|
@ -14,6 +14,7 @@ of time and requests from the LAMMPS user community.
|
|||
Developer_flow
|
||||
Developer_write
|
||||
Developer_notes
|
||||
Developer_plugins
|
||||
Developer_unittest
|
||||
Classes
|
||||
Developer_utils
|
||||
|
|
|
@ -0,0 +1,258 @@
|
|||
Writing plugins
|
||||
---------------
|
||||
|
||||
Plugins provide a mechanism to add functionality to a LAMMPS executable
|
||||
without recompiling LAMMPS. The functionality for this and the
|
||||
:doc:`plugin command <plugin>` are implemented in the
|
||||
:ref:`PLUGIN package <PKG-PLUGIN>` which must be installed to use plugins.
|
||||
|
||||
Plugins use the operating system's capability to load dynamic shared
|
||||
object (DSO) files in a way similar shared libraries and then reference
|
||||
specific functions in those DSOs. Any DSO file with plugins has to include
|
||||
an initialization function with a specific name, "lammpsplugin_init", that
|
||||
has to follow specific rules described below. When loading the DSO with
|
||||
the "plugin" command, this function is looked up and called and will then
|
||||
register the contained plugin(s) with LAMMPS.
|
||||
|
||||
From the programmer perspective this can work because of the object
|
||||
oriented design of LAMMPS where all pair style commands are derived from
|
||||
the class Pair, all fix style commands from the class Fix and so on and
|
||||
usually only functions present in those base classes are called
|
||||
directly. When a :doc:`pair_style` command or :doc:`fix` command is
|
||||
issued a new instance of such a derived class is created. This is done
|
||||
by a so-called factory function which is mapped to the style name. Thus
|
||||
when, for example, the LAMMPS processes the command ``pair_style lj/cut
|
||||
2.5``, LAMMPS will look up the factory function for creating the
|
||||
``PairLJCut`` class and then execute it. The return value of that
|
||||
function is a ``Pair *`` pointer and the pointer will be assigned to the
|
||||
location for the currently active pair style.
|
||||
|
||||
A DSO file with a plugin thus has to implement such a factory function
|
||||
and register it with LAMMPS so that it gets added to the map of available
|
||||
styles of the given category. To register a plugin with LAMMPS an
|
||||
initialization function has to be present in the DSO file called
|
||||
``lammpsplugin_init`` which is called with three ``void *`` arguments:
|
||||
a pointer to the current LAMMPS instance, a pointer to the opened DSO
|
||||
handle, and a pointer to the registration function. The registration
|
||||
function takes two arguments: a pointer to a ``lammpsplugin_t`` struct
|
||||
with information about the plugin and a pointer to the current LAMMPS
|
||||
instance. Please see below for an example of how the registration is
|
||||
done.
|
||||
|
||||
Members of ``lammpsplugin_t``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: auto
|
||||
|
||||
* - Member
|
||||
- Description
|
||||
* - version
|
||||
- LAMMPS Version string the plugin was compiled for
|
||||
* - style
|
||||
- Style of the plugin (pair, bond, fix, command, etc.)
|
||||
* - name
|
||||
- Name of the plugin style
|
||||
* - info
|
||||
- String with information about the plugin
|
||||
* - author
|
||||
- String with the name and email of the author
|
||||
* - creator.v1
|
||||
- Pointer to factory function for pair, bond, angle, dihedral, or improper styles
|
||||
* - creator.v2
|
||||
- Pointer to factory function for compute, fix, or region styles
|
||||
* - creator.v3
|
||||
- Pointer to factory function for command styles
|
||||
* - handle
|
||||
- Pointer to the open DSO file handle
|
||||
|
||||
Only one of the three alternate creator entries can be used at a time
|
||||
and which of those is determined by the style of plugin. The "creator.v1"
|
||||
element is for factory functions of supported styles computing forces (i.e.
|
||||
pair, bond, angle, dihedral, or improper styles) and the function takes
|
||||
as single argument the pointer to the LAMMPS instance. The factory function
|
||||
is cast to the ``lammpsplugin_factory1`` type before assignment. The
|
||||
"creator.v2" element is for factory functions creating an instance of
|
||||
a fix, compute, or region style and takes three arguments: a pointer to
|
||||
the LAMMPS instance, an integer with the length of the argument list and
|
||||
a ``char **`` pointer to the list of arguments. The factory function pointer
|
||||
needs to be cast to the ``lammpsplugin_factory2`` type before assignment.
|
||||
The "creator.v3" element takes the same arguments as "creator.v3" but is
|
||||
specific to creating command styles: the factory function has to instantiate
|
||||
the command style locally passing the LAMMPS pointer as argument and then
|
||||
call its "command" member function with the number and list of arguments.
|
||||
The factory function pointer needs to be cast to the
|
||||
``lammpsplugin_factory3`` type before assignment.
|
||||
|
||||
Pair style example
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
As an example, a hypothetical pair style plugin "morse2" implemented in
|
||||
a class ``PairMorse2`` in the files ``pair_morse2.h`` and
|
||||
``pair_morse2.cpp`` with the factory function and initialization
|
||||
function would look like this:
|
||||
|
||||
.. code-block:: C++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
#include "version.h"
|
||||
#include "pair_morse2.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
static Pair *morse2creator(LAMMPS *lmp)
|
||||
{
|
||||
return new PairMorse2(lmp);
|
||||
}
|
||||
|
||||
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||
{
|
||||
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||
lammpsplugin_t plugin;
|
||||
|
||||
plugin.version = LAMMPS_VERSION;
|
||||
plugin.style = "pair";
|
||||
plugin.name = "morse2";
|
||||
plugin.info = "Morse2 variant pair style v1.0";
|
||||
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2creator;
|
||||
plugin.handle = handle;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
}
|
||||
|
||||
The factory function in this example is called ``morse2creator()``. It
|
||||
receives a pointer to the LAMMPS class as only argument and thus has to
|
||||
be assigned to the *creator.v1* member of the plugin struct and cast to the
|
||||
``lammpsplugin_factory1`` pointer type. It returns a
|
||||
pointer to the allocated class instance derived from the ``Pair`` class.
|
||||
This function may be declared static to avoid clashes with other plugins.
|
||||
The name of the derived class, ``PairMorse2``, must be unique inside
|
||||
the entire LAMMPS executable.
|
||||
|
||||
Fix style example
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
If the factory function would be for a fix or compute, which take three
|
||||
arguments (a pointer to the LAMMPS class, the number of arguments and the
|
||||
list of argument strings), then the pointer type is ``lammpsplugin_factory2``
|
||||
and it must be assigned to the *creator.v2* member of the plugin struct.
|
||||
Below is an example for that:
|
||||
|
||||
.. code-block:: C++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
#include "version.h"
|
||||
#include "fix_nve2.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
static Fix *nve2creator(LAMMPS *lmp, int argc, char **argv)
|
||||
{
|
||||
return new FixNVE2(lmp,argc,argv);
|
||||
}
|
||||
|
||||
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||
{
|
||||
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||
lammpsplugin_t plugin;
|
||||
|
||||
plugin.version = LAMMPS_VERSION;
|
||||
plugin.style = "fix";
|
||||
plugin.name = "nve2";
|
||||
plugin.info = "NVE2 variant fix style v1.0";
|
||||
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||
plugin.creator.v2 = (lammpsplugin_factory2 *) &nve2creator;
|
||||
plugin.handle = handle;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
}
|
||||
|
||||
Command style example
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
For command styles there is a third variant of factory function as
|
||||
demonstrated in the following example, which also shows that the
|
||||
implementation of the plugin class may also be within the same
|
||||
file as the plugin interface code:
|
||||
|
||||
.. code-block:: C++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "pointers.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
class Hello : protected Pointers {
|
||||
public:
|
||||
Hello(class LAMMPS *lmp) : Pointers(lmp) {};
|
||||
void command(int, char **);
|
||||
};
|
||||
}
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
void Hello::command(int argc, char **argv)
|
||||
{
|
||||
if (argc != 1) error->all(FLERR,"Illegal hello command");
|
||||
if (comm->me == 0)
|
||||
utils::logmesg(lmp,fmt::format("Hello, {}!\n",argv[0]));
|
||||
}
|
||||
|
||||
static void hellocreator(LAMMPS *lmp, int argc, char **argv)
|
||||
{
|
||||
Hello hello(lmp);
|
||||
hello.command(argc,argv);
|
||||
}
|
||||
|
||||
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||
{
|
||||
lammpsplugin_t plugin;
|
||||
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||
|
||||
plugin.version = LAMMPS_VERSION;
|
||||
plugin.style = "command";
|
||||
plugin.name = "hello";
|
||||
plugin.info = "Hello world command v1.0";
|
||||
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||
plugin.creator.v3 = (lammpsplugin_factory3 *) &hellocreator;
|
||||
plugin.handle = handle;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
}
|
||||
|
||||
Additional Details
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The initialization function **must** be called ``lammpsplugin_init``, it
|
||||
**must** have C bindings and it takes three void pointers as arguments.
|
||||
The first is a pointer to the LAMMPS class that calls it and it needs to
|
||||
be passed to the registration function. The second argument is a
|
||||
pointer to the internal handle of the DSO file, this needs to be added
|
||||
to the plugin info struct, so that the DSO can be closed and unloaded
|
||||
when all its contained plugins are unloaded. The third argument is a
|
||||
function pointer to the registration function and needs to be stored
|
||||
in a variable of ``lammpsplugin_regfunc`` type and then called with a
|
||||
pointer to the ``lammpsplugin_t`` struct and the pointer to the LAMMPS
|
||||
instance as arguments to register a single plugin. There may be multiple
|
||||
calls to multiple plugins in the same initialization function.
|
||||
|
||||
To register a plugin a struct of the ``lammpsplugin_t`` needs to be filled
|
||||
with relevant info: current LAMMPS version string, kind of style, name of
|
||||
style, info string, author string, pointer to factory function, and the
|
||||
DSO handle. The registration function is called with a pointer to the address
|
||||
of this struct and the pointer of the LAMMPS class. The registration function
|
||||
will then add the factory function of the plugin style to the respective
|
||||
style map under the provided name. It will also make a copy of the struct
|
||||
in a list of all loaded plugins and update the reference counter for loaded
|
||||
plugins from this specific DSO file.
|
||||
|
||||
The pair style itself (i.e. the PairMorse2 class in this example) can be
|
||||
written just like any other pair style that is included in LAMMPS. For
|
||||
a plugin, the use of the ``PairStyle`` macro in the section encapsulated
|
||||
by ``#ifdef PAIR_CLASS`` is not needed, since the mapping of the class
|
||||
name to the style name is done by the plugin registration function with
|
||||
the information from the ``lammpsplugin_t`` struct. It may be included
|
||||
in case the new code is intended to be later included in LAMMPS directly.
|
|
@ -4,10 +4,10 @@ Adding tests for unit testing
|
|||
This section discusses adding or expanding tests for the unit test
|
||||
infrastructure included into the LAMMPS source code distribution.
|
||||
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
|
||||
cover as much of the added code as possible. When contributing code to
|
||||
the distribution, the LAMMPS developers will appreciate if additions
|
||||
to the integrated unit test facility are included.
|
||||
of individual features, tend to run fast, and should be set up to cover
|
||||
as much of the added code as possible. When contributing code to the
|
||||
distribution, the LAMMPS developers will appreciate if additions to the
|
||||
integrated unit test facility are included.
|
||||
|
||||
Given the complex nature of MD simulations where many operations can
|
||||
only be performed when suitable "real" simulation environment has been
|
||||
|
@ -50,6 +50,9 @@ available:
|
|||
* - File name:
|
||||
- Test name:
|
||||
- Description:
|
||||
* - ``test_argutils.cpp``
|
||||
- ArgInfo
|
||||
- Tests for ``ArgInfo`` class used by LAMMPS
|
||||
* - ``test_fmtlib.cpp``
|
||||
- FmtLib
|
||||
- Tests for ``fmtlib::`` functions used by LAMMPS
|
||||
|
@ -155,23 +158,27 @@ have the desired effect:
|
|||
{
|
||||
ASSERT_EQ(lmp->update->ntimestep, 0);
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lmp->input->one("reset_timestep 10");
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_timestep 10");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->update->ntimestep, 10);
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lmp->input->one("reset_timestep 0");
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_timestep 0");
|
||||
END_HIDE_OUTPUT();
|
||||
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
|
||||
the LAMMPS command will be silent by capturing the output or not. In
|
||||
the default case, verbose == false, the test output will be compact and
|
||||
not mixed with LAMMPS output. However setting the verbose flag (via
|
||||
setting the ``TEST_ARGS`` environment variable, ``TEST_ARGS=-v``) can be
|
||||
helpful to understand why tests fail unexpectedly.
|
||||
Please note the use of the ``BEGIN_HIDE_OUTPUT`` and ``END_HIDE_OUTPUT``
|
||||
functions that will capture output from running LAMMPS. This is normally
|
||||
discarded but by setting the verbose flag (via setting the ``TEST_ARGS``
|
||||
environment variable, ``TEST_ARGS=-v``) it can be printed and used to
|
||||
understand why tests fail unexpectedly.
|
||||
|
||||
Another complexity of these tests stems from the need to capture
|
||||
situations where LAMMPS will stop with an error, i.e. handle so-called
|
||||
|
@ -210,6 +217,12 @@ The following test programs are currently available:
|
|||
* - ``test_lattice_region.cpp``
|
||||
- LatticeRegion
|
||||
- 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``
|
||||
- KimCommands
|
||||
- Tests for several commands from the :ref:`KIM package <PKG-KIM>`
|
||||
|
|
|
@ -101,6 +101,9 @@ and parsing files or arguments.
|
|||
.. doxygenfunction:: split_words
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: split_lines
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: strmatch
|
||||
:project: progguide
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ documentation for the formula it computes.
|
|||
* :doc:`bond_style <bond_harmonic>` harmonic
|
||||
* :doc:`bond_style <bond_morse>` morse
|
||||
|
||||
* :doc:`angle_style <angle_cosine_squared>` cosine/squared
|
||||
* :doc:`angle_style <angle_harmonic>` harmonic
|
||||
* :doc:`angle_style <angle_cosine>` cosine
|
||||
* :doc:`angle_style <angle_cosine_periodic>` cosine/periodic
|
||||
|
|
|
@ -18,12 +18,13 @@ This compute
|
|||
|
||||
calculates rotational kinetic energy which can be :doc:`output with thermodynamic info <Howto_output>`.
|
||||
|
||||
Use one of these 3 pair potentials, which compute forces and torques
|
||||
Use one of these 4 pair potentials, which compute forces and torques
|
||||
between interacting pairs of particles:
|
||||
|
||||
* :doc:`pair_style <pair_style>` gran/history
|
||||
* :doc:`pair_style <pair_style>` gran/no_history
|
||||
* :doc:`pair_style <pair_style>` gran/hertzian
|
||||
* :doc:`pair_style gran/history <pair_gran>`
|
||||
* :doc:`pair_style gran/no_history <pair_gran>`
|
||||
* :doc:`pair_style gran/hertzian <pair_gran>`
|
||||
* :doc:`pair_style granular <pair_granular>`
|
||||
|
||||
These commands implement fix options specific to granular systems:
|
||||
|
||||
|
@ -31,6 +32,7 @@ These commands implement fix options specific to granular systems:
|
|||
* :doc:`fix pour <fix_pour>`
|
||||
* :doc:`fix viscous <fix_viscous>`
|
||||
* :doc:`fix wall/gran <fix_wall_gran>`
|
||||
* :doc:`fix wall/gran/region <fix_wall_gran_region>`
|
||||
|
||||
The fix style *freeze* zeroes both the force and torque of frozen
|
||||
atoms, and should be used for granular system instead of the fix style
|
||||
|
|
|
@ -86,33 +86,59 @@ check out any other desired branch) first.
|
|||
|
||||
Once you have updated your local files with a ``git pull`` (or ``git
|
||||
checkout``), you still need to re-build LAMMPS if any source files have
|
||||
changed. To do this, you should cd to the src directory and type:
|
||||
changed. How to do this depends on the build system you are using.
|
||||
|
||||
.. code-block:: bash
|
||||
.. tabs::
|
||||
|
||||
$ make purge # remove any deprecated src files
|
||||
$ make package-update # sync package files with src files
|
||||
$ make foo # re-build for your machine (mpi, serial, etc)
|
||||
.. tab:: CMake build
|
||||
|
||||
just as described on the :doc:`Apply patch <Install_patch>` page,
|
||||
after a patch has been installed.
|
||||
Change to your build folder and type:
|
||||
|
||||
.. warning::
|
||||
.. code-block:: bash
|
||||
|
||||
If you wish to edit/change a src file that is from a
|
||||
package, you should edit the version of the file inside the package
|
||||
sub-directory with src, then re-install the package. The version in
|
||||
the source directory is merely a copy and will be wiped out if you type "make
|
||||
package-update".
|
||||
cmake . --build
|
||||
|
||||
.. warning::
|
||||
CMake should auto-detect whether it needs to re-run the CMake
|
||||
configuration step and otherwise redo the build for all files
|
||||
that have been changed or files that depend on changed files.
|
||||
In case some build options have been changed or renamed, you
|
||||
may have to update those by running:
|
||||
|
||||
The GitHub servers support both the "git://" and
|
||||
"https://" access protocols for anonymous read-only access. If you
|
||||
have a correspondingly configured GitHub account, you may also use
|
||||
SSH access with the URL "git@github.com:lammps/lammps.git".
|
||||
.. code-block:: bash
|
||||
|
||||
The LAMMPS GitHub project is managed by Christoph Junghans (LANL,
|
||||
junghans at lanl.gov), Axel Kohlmeyer (Temple U, akohlmey at
|
||||
gmail.com) and Richard Berger (Temple U, richard.berger at
|
||||
temple.edu).
|
||||
cmake .
|
||||
|
||||
and then rebuild.
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
Switch to the src directory and type:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make purge # remove any deprecated src files
|
||||
$ make package-update # sync package files with src files
|
||||
$ make foo # re-build for your machine (mpi, serial, etc)
|
||||
|
||||
Just as described on the :doc:`Apply patch <Install_patch>` page,
|
||||
after a patch has been installed.
|
||||
|
||||
.. warning::
|
||||
|
||||
If you wish to edit/change a src file that is from a package,
|
||||
you should edit the version of the file inside the package
|
||||
sub-directory with src, then re-install the package. The
|
||||
version in the source directory is merely a copy and will be
|
||||
wiped out if you type "make package-update".
|
||||
|
||||
.. admonition:: Git protocols
|
||||
:class: note
|
||||
|
||||
The servers at github.com support the "git://" and "https://" access
|
||||
protocols for anonymous, read-only access. If you have a suitably
|
||||
configured GitHub account, you may also use SSH protocol with the
|
||||
URL "git@github.com:lammps/lammps.git".
|
||||
|
||||
The LAMMPS GitHub project is currently managed by Axel Kohlmeyer
|
||||
(Temple U, akohlmey at gmail.com) and Richard Berger (Temple U,
|
||||
richard.berger at temple.edu).
|
||||
|
|
|
@ -43,24 +43,54 @@ up to date.
|
|||
* A list of updated files print out to the screen. The -b switch
|
||||
creates backup files of your originals (e.g. src/force.cpp.orig), so
|
||||
you can manually undo the patch if something goes wrong.
|
||||
* Type the following from the src directory, to enforce consistency
|
||||
between the src and package directories. This is OK to do even if you
|
||||
don't use one or more packages. If you are applying several patches
|
||||
successively, you only need to type this once at the end. The purge
|
||||
command removes deprecated src files if any were removed by the patch
|
||||
from package sub-directories.
|
||||
|
||||
.. code-block:: bash
|
||||
* Once you have updated your local files you need to re-build LAMMPS.
|
||||
If you are applying several patches successively, you only need to
|
||||
do the rebuild once at the end. How to do it depends on the build
|
||||
system you are using.
|
||||
|
||||
$ make purge
|
||||
$ make package-update
|
||||
.. tabs::
|
||||
|
||||
* Re-build LAMMPS via the "make" command.
|
||||
.. tab:: CMake build
|
||||
|
||||
.. warning::
|
||||
Change to your build folder and type:
|
||||
|
||||
If you wish to edit/change a source file that is part of a package,
|
||||
you should edit the version of the file inside the package folder in
|
||||
src, and then re-install or update the package. The version in the
|
||||
src directory is merely a copy and will be wiped out when you type
|
||||
"make package-update".
|
||||
.. code-block:: bash
|
||||
|
||||
cmake . --build
|
||||
|
||||
CMake should auto-detect whether it needs to re-run the CMake
|
||||
configuration step and otherwise redo the build for all files
|
||||
that have been changed or files that depend on changed files.
|
||||
In case some build options have been changed or renamed, you
|
||||
may have to update those by running:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cmake .
|
||||
|
||||
and then rebuild.
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
Switch to the src directory and type:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make purge # remove any deprecated src files
|
||||
$ make package-update # sync package files with src files
|
||||
$ make foo # re-build for your machine (mpi, serial, etc)
|
||||
|
||||
to enforce consistency of the source between the src folder
|
||||
and package directories. This is OK to do even if you don't
|
||||
use any packages. The "make purge" command removes any deprecated
|
||||
src files if they were removed by the patch from a package
|
||||
sub-directory.
|
||||
|
||||
.. warning::
|
||||
|
||||
If you wish to edit/change a src file that is from a package,
|
||||
you should edit the version of the file inside the package
|
||||
sub-directory with src, then re-install the package. The
|
||||
version in the source directory is merely a copy and will be
|
||||
wiped out if you type "make package-update".
|
||||
|
|
|
@ -50,6 +50,7 @@ page gives those details.
|
|||
* :ref:`MSCG <PKG-MSCG>`
|
||||
* :ref:`OPT <PKG-OPT>`
|
||||
* :ref:`PERI <PKG-PERI>`
|
||||
* :ref:`PLUGIN <PKG-PLUGIN>`
|
||||
* :ref:`POEMS <PKG-POEMS>`
|
||||
* :ref:`PYTHON <PKG-PYTHON>`
|
||||
* :ref:`QEQ <PKG-QEQ>`
|
||||
|
@ -843,6 +844,28 @@ Foster (UTSA).
|
|||
|
||||
----------
|
||||
|
||||
.. _PKG-PLUGIN:
|
||||
|
||||
PLUGIN package
|
||||
--------------
|
||||
|
||||
**Contents:**
|
||||
|
||||
A :doc:`plugin <plugin>` command that can load and unload several
|
||||
kind of styles in LAMMPS from shared object files at runtime without
|
||||
having to recompile and relink LAMMPS.
|
||||
|
||||
**Authors:** Axel Kohlmeyer (Temple U)
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
* src/PLUGIN: filenames -> commands
|
||||
* :doc:`plugin command <plugin>`
|
||||
* :doc:`Information on writing plugins <Developer_plugins>`
|
||||
* examples/plugin
|
||||
|
||||
----------
|
||||
|
||||
.. _PKG-POEMS:
|
||||
|
||||
POEMS package
|
||||
|
@ -2456,6 +2479,6 @@ which discuss the `QuickFF <quickff_>`_ methodology.
|
|||
* :doc:`bond_style mm3 <bond_mm3>`
|
||||
* :doc:`improper_style distharm <improper_distharm>`
|
||||
* :doc:`improper_style sqdistharm <improper_sqdistharm>`
|
||||
* :doc:`pair_style mm3/switch3/coulgauss/long <pair_mm3_switch3_coulgauss_long>`
|
||||
* :doc:`pair_style mm3/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
|
||||
* :doc:`pair_style lj/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
|
||||
* examples/USER/yaff
|
||||
|
|
|
@ -71,6 +71,8 @@ package:
|
|||
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
|
||||
| :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:`PYTHON <PKG-PYTHON>` | embed Python code in an input script | :doc:`python <python>` | python | sys |
|
||||
|
|
|
@ -24,20 +24,17 @@ Examples
|
|||
Description
|
||||
"""""""""""
|
||||
|
||||
The *cosine/periodic* angle style uses the following potential, which
|
||||
is commonly used in the :doc:`DREIDING <Howto_bioFF>` force field,
|
||||
particularly for organometallic systems where :math:`n` = 4 might be used
|
||||
The *cosine/periodic* angle style uses the following potential, which may be
|
||||
particularly used for organometallic systems where :math:`n` = 4 might be used
|
||||
for an octahedral complex and :math:`n` = 3 might be used for a trigonal
|
||||
center:
|
||||
|
||||
.. math::
|
||||
|
||||
E = C \left[ 1 - B(-1)^n\cos\left( n\theta\right) \right]
|
||||
E = \frac{2.0}{n^2} * C \left[ 1 - B(-1)^n\cos\left( n\theta\right) \right]
|
||||
|
||||
where :math:`C`, :math:`B` and :math:`n` are coefficients defined for each angle type.
|
||||
|
||||
See :ref:`(Mayo) <cosine-Mayo>` for a description of the DREIDING force field
|
||||
|
||||
The following coefficients must be defined for each angle type via the
|
||||
:doc:`angle_coeff <angle_coeff>` command as in the example above, or in
|
||||
the data file or restart files read by the :doc:`read_data <read_data>`
|
||||
|
@ -47,10 +44,9 @@ or :doc:`read_restart <read_restart>` commands:
|
|||
* :math:`B` = 1 or -1
|
||||
* :math:`n` = 1, 2, 3, 4, 5 or 6 for periodicity
|
||||
|
||||
Note that the prefactor :math:`C` is specified and not the overall force
|
||||
constant :math:`K = \frac{C}{n^2}`. When :math:`B = 1`, it leads to a minimum for the
|
||||
linear geometry. When :math:`B = -1`, it leads to a maximum for the linear
|
||||
geometry.
|
||||
Note that the prefactor :math:`C` is specified as coefficient and not the overall force
|
||||
constant :math:`K = \frac{2 C}{n^2}`. When :math:`B = 1`, it leads to a minimum for the
|
||||
linear geometry. When :math:`B = -1`, it leads to a maximum for the linear geometry.
|
||||
|
||||
----------
|
||||
|
||||
|
@ -75,9 +71,3 @@ Default
|
|||
|
||||
none
|
||||
|
||||
----------
|
||||
|
||||
.. _cosine-Mayo:
|
||||
|
||||
**(Mayo)** Mayo, Olfason, Goddard III, J Phys Chem, 94, 8897-8909
|
||||
(1990).
|
||||
|
|
|
@ -30,8 +30,11 @@ The *cosine/squared* angle style uses the potential
|
|||
|
||||
E = K [\cos(\theta) - \cos(\theta_0)]^2
|
||||
|
||||
where :math:`\theta_0` is the equilibrium value of the angle, and :math:`K` is a
|
||||
prefactor. Note that the usual 1/2 factor is included in :math:`K`.
|
||||
, which is commonly used in the :doc:`DREIDING <Howto_bioFF>` force field,
|
||||
where :math:`\theta_0` is the equilibrium value of the angle, and :math:`K`
|
||||
is a prefactor. Note that the usual 1/2 factor is included in :math:`K`.
|
||||
|
||||
See :ref:`(Mayo) <cosine-Mayo>` for a description of the DREIDING force field.
|
||||
|
||||
The following coefficients must be defined for each angle type via the
|
||||
:doc:`angle_coeff <angle_coeff>` command as in the example above, or in
|
||||
|
@ -66,3 +69,10 @@ Default
|
|||
"""""""
|
||||
|
||||
none
|
||||
|
||||
----------
|
||||
|
||||
.. _cosine-Mayo:
|
||||
|
||||
**(Mayo)** Mayo, Olfason, Goddard III, J Phys Chem, 94, 8897-8909
|
||||
(1990).
|
||||
|
|
|
@ -77,6 +77,7 @@ Commands
|
|||
pair_style
|
||||
pair_write
|
||||
partition
|
||||
plugin
|
||||
prd
|
||||
print
|
||||
processors
|
||||
|
|
|
@ -113,7 +113,7 @@ more of (g,i,k,o,t) to indicate which accelerated styles exist.
|
|||
* :doc:`quadratic <dihedral_quadratic>` - dihedral with quadratic term in angle
|
||||
* :doc:`spherical <dihedral_spherical>` - dihedral which includes angle terms to avoid singularities
|
||||
* :doc:`table <dihedral_table>` - tabulated dihedral
|
||||
* :doc:`table/cut <dihedral_table_cut>` - tabulated dihedral with analytic cutoff
|
||||
* :doc:`table/cut <dihedral_table>` - tabulated dihedral with analytic cutoff
|
||||
|
||||
----------
|
||||
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
.. index:: dihedral_style table
|
||||
.. index:: dihedral_style table/omp
|
||||
.. index:: dihedral_style table/cut
|
||||
|
||||
dihedral_style table command
|
||||
============================
|
||||
|
||||
Accelerator Variants: *table/omp*
|
||||
|
||||
dihedral_style table/cut command
|
||||
================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
dihedral_style table style Ntable
|
||||
dihedral_style style interpolation Ntable
|
||||
|
||||
* style = *linear* or *spline* = method of interpolation
|
||||
* style = *table* or *table/cut*
|
||||
* interpolation = *linear* or *spline* = method of interpolation
|
||||
* Ntable = size of the internal lookup table
|
||||
|
||||
Examples
|
||||
|
@ -26,13 +31,21 @@ Examples
|
|||
dihedral_coeff 1 file.table DIH_TABLE1
|
||||
dihedral_coeff 2 file.table DIH_TABLE2
|
||||
|
||||
dihedral_style table/cut spline 400
|
||||
dihedral_style table/cut linear 1000
|
||||
dihedral_coeff 1 aat 1.0 177 180 file.table DIH_TABLE1
|
||||
dihedral_coeff 2 aat 0.5 170 180 file.table DIH_TABLE2
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
The *table* dihedral style creates interpolation tables of length
|
||||
*Ntable* from dihedral potential and derivative values listed in a
|
||||
file(s) as a function of the dihedral angle "phi". The files are read
|
||||
by the :doc:`dihedral_coeff <dihedral_coeff>` command.
|
||||
The *table* and *table/cut* dihedral styles create interpolation tables
|
||||
of length *Ntable* from dihedral potential and derivative values listed
|
||||
in a file(s) as a function of the dihedral angle "phi". The files are
|
||||
read by the :doc:`dihedral_coeff <dihedral_coeff>` command. For
|
||||
dihedral style *table/cut* additionally an analytic cutoff that is
|
||||
quadratic in the bond-angle (theta) is applied in order to regularize
|
||||
the dihedral interaction.
|
||||
|
||||
The interpolation tables are created by fitting cubic splines to the
|
||||
file values and interpolating energy and derivative values at each of
|
||||
|
@ -51,16 +64,53 @@ interpolated table. For a given dihedral angle (phi), the appropriate
|
|||
coefficients are chosen from this list, and a cubic polynomial is used
|
||||
to compute the energy and the derivative at this angle.
|
||||
|
||||
The following coefficients must be defined for each dihedral type via
|
||||
the :doc:`dihedral_coeff <dihedral_coeff>` command as in the example
|
||||
above.
|
||||
For dihedral style *table* the following coefficients must be defined
|
||||
for each dihedral type via the :doc:`dihedral_coeff <dihedral_coeff>`
|
||||
command as in the example above.
|
||||
|
||||
* filename
|
||||
* keyword
|
||||
|
||||
The filename specifies a file containing tabulated energy and
|
||||
derivative values. The keyword specifies a section of the file. The
|
||||
format of this file is described below.
|
||||
The filename specifies a file containing tabulated energy and derivative
|
||||
values. The keyword specifies which section of the file to read. The
|
||||
format of this file is the same for both dihedral styles and described
|
||||
below.
|
||||
|
||||
For dihedral style *table/cut* the following coefficients must be
|
||||
defined for each dihedral type via the :doc:`dihedral_coeff
|
||||
<dihedral_coeff>` command as in the example above.
|
||||
|
||||
* style (aat)
|
||||
* cutoff prefactor
|
||||
* cutoff angle1
|
||||
* cutoff angle2
|
||||
* filename
|
||||
* keyword
|
||||
|
||||
The cutoff dihedral style uses a tabulated dihedral interaction with a
|
||||
cutoff function:
|
||||
|
||||
.. math::
|
||||
|
||||
f(\theta) & = K \qquad\qquad\qquad\qquad\qquad\qquad \theta < \theta_1 \\
|
||||
f(\theta) & = K \left(1-\frac{(\theta - \theta_1)^2}{(\theta_2 - \theta_1)^2}\right) \qquad \theta_1 < \theta < \theta_2
|
||||
|
||||
The cutoff specifies an prefactor to the cutoff function. While this
|
||||
value would ordinarily equal 1 there may be situations where the value
|
||||
should change.
|
||||
|
||||
The cutoff :math:`\theta_1` specifies the angle (in degrees) below which
|
||||
the dihedral interaction is unmodified, i.e. the cutoff function is 1.
|
||||
|
||||
The cutoff function is applied between :math:`\theta_1` and
|
||||
:math:`\theta_2`, which is the angle at which the cutoff function drops
|
||||
to zero. The value of zero effectively "turns off" the dihedral
|
||||
interaction.
|
||||
|
||||
The filename specifies a file containing tabulated energy and derivative
|
||||
values. The keyword specifies which section of the file to read. The
|
||||
format of this file is the same for both dihedral styles and described
|
||||
below.
|
||||
|
||||
----------
|
||||
|
||||
|
@ -182,18 +232,19 @@ that matches the specified keyword.
|
|||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This dihedral style writes the settings for the "dihedral_style table"
|
||||
command to :doc:`binary restart files <restart>`, so a dihedral_style
|
||||
command does not need to specified in an input script that reads a
|
||||
restart file. However, the coefficient information is not stored in
|
||||
the restart file, since it is tabulated in the potential files. Thus,
|
||||
These dihedral styles write the settings for the "dihedral_style table"
|
||||
or "dihedral_style table/cut" command to :doc:`binary restart files
|
||||
<restart>`, so a dihedral_style command does not need to specified in an
|
||||
input script that reads a restart file. However, the coefficient
|
||||
information loaded from the table file(s) is not stored in the restart
|
||||
file, since it is tabulated in the potential files. Thus, suitable
|
||||
dihedral_coeff commands do need to be specified in the restart input
|
||||
script.
|
||||
script after reading the restart file.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This dihedral style can only be used if LAMMPS was built with the
|
||||
These dihedral styles can only be used if LAMMPS was built with the
|
||||
USER-MISC package. See the :doc:`Build package <Build_package>` doc
|
||||
page for more info.
|
||||
|
||||
|
|
|
@ -1,229 +0,0 @@
|
|||
.. index:: dihedral_style table/cut
|
||||
|
||||
dihedral_style table/cut command
|
||||
================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
dihedral_style table/cut style Ntable
|
||||
|
||||
* style = *linear* or *spline* = method of interpolation
|
||||
* Ntable = size of the internal lookup table
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
dihedral_style table/cut spline 400
|
||||
dihedral_style table/cut linear 1000
|
||||
dihedral_coeff 1 aat 1.0 177 180 file.table DIH_TABLE1
|
||||
dihedral_coeff 2 aat 0.5 170 180 file.table DIH_TABLE2
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
The *table/cut* dihedral style creates interpolation tables of length
|
||||
*Ntable* from dihedral potential and derivative values listed in a
|
||||
file(s) as a function of the dihedral angle "phi". In addition, an
|
||||
analytic cutoff that is quadratic in the bond-angle (theta) is applied
|
||||
in order to regularize the dihedral interaction. The dihedral table
|
||||
files are read by the :doc:`dihedral_coeff <dihedral_coeff>` command.
|
||||
|
||||
The interpolation tables are created by fitting cubic splines to the
|
||||
file values and interpolating energy and derivative values at each of
|
||||
*Ntable* dihedral angles. During a simulation, these tables are used
|
||||
to interpolate energy and force values on individual atoms as
|
||||
needed. The interpolation is done in one of 2 styles: *linear* or
|
||||
*spline*\ .
|
||||
|
||||
For the *linear* style, the dihedral angle (phi) is used to find 2
|
||||
surrounding table values from which an energy or its derivative is
|
||||
computed by linear interpolation.
|
||||
|
||||
For the *spline* style, cubic spline coefficients are computed and
|
||||
stored at each of the *Ntable* evenly-spaced values in the
|
||||
interpolated table. For a given dihedral angle (phi), the appropriate
|
||||
coefficients are chosen from this list, and a cubic polynomial is used
|
||||
to compute the energy and the derivative at this angle.
|
||||
|
||||
The following coefficients must be defined for each dihedral type via
|
||||
the :doc:`dihedral_coeff <dihedral_coeff>` command as in the example
|
||||
above.
|
||||
|
||||
* style (aat)
|
||||
* cutoff prefactor
|
||||
* cutoff angle1
|
||||
* cutoff angle2
|
||||
* filename
|
||||
* keyword
|
||||
|
||||
The cutoff dihedral style uses a tabulated dihedral interaction with a
|
||||
cutoff function:
|
||||
|
||||
.. math::
|
||||
|
||||
f(\theta) & = K \qquad\qquad\qquad\qquad\qquad\qquad \theta < \theta_1 \\
|
||||
f(\theta) & = K \left(1-\frac{(\theta - \theta_1)^2}{(\theta_2 - \theta_1)^2}\right) \qquad \theta_1 < \theta < \theta_2
|
||||
|
||||
The cutoff specifies an prefactor to the cutoff function. While this value
|
||||
would ordinarily equal 1 there may be situations where the value should change.
|
||||
|
||||
The cutoff :math:`\theta_1` specifies the angle (in degrees) below which the dihedral
|
||||
interaction is unmodified, i.e. the cutoff function is 1.
|
||||
|
||||
The cutoff function is applied between :math:`\theta_1` and :math:`\theta_2`, which is
|
||||
the angle at which the cutoff function drops to zero. The value of zero effectively
|
||||
"turns off" the dihedral interaction.
|
||||
|
||||
The filename specifies a file containing tabulated energy and
|
||||
derivative values. The keyword specifies a section of the file. The
|
||||
format of this file is described below.
|
||||
|
||||
----------
|
||||
|
||||
The format of a tabulated file is as follows (without the
|
||||
parenthesized comments). It can begin with one or more comment
|
||||
or blank lines.
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
# Table of the potential and its negative derivative
|
||||
|
||||
DIH_TABLE1 (keyword is the first text on line)
|
||||
N 30 DEGREES (N, NOF, DEGREES, RADIANS, CHECKU/F)
|
||||
(blank line)
|
||||
1 -168.0 -1.40351172223 0.0423346818422
|
||||
2 -156.0 -1.70447981034 0.00811786522531
|
||||
3 -144.0 -1.62956100432 -0.0184129719987
|
||||
...
|
||||
30 180.0 -0.707106781187 0.0719306095245
|
||||
|
||||
# Example 2: table of the potential. Forces omitted
|
||||
|
||||
DIH_TABLE2
|
||||
N 30 NOF CHECKU testU.dat CHECKF testF.dat
|
||||
|
||||
1 -168.0 -1.40351172223
|
||||
2 -156.0 -1.70447981034
|
||||
3 -144.0 -1.62956100432
|
||||
...
|
||||
30 180.0 -0.707106781187
|
||||
|
||||
A section begins with a non-blank line whose first character is not a
|
||||
"#"; blank lines or lines starting with "#" can be used as comments
|
||||
between sections. The first line begins with a keyword which
|
||||
identifies the section. The line can contain additional text, but the
|
||||
initial text must match the argument specified in the
|
||||
:doc:`dihedral_coeff <dihedral_coeff>` command. The next line lists (in
|
||||
any order) one or more parameters for the table. Each parameter is a
|
||||
keyword followed by one or more numeric values.
|
||||
|
||||
Following a blank line, the next N lines list the tabulated values. On
|
||||
each line, the first value is the index from 1 to N, the second value is
|
||||
the angle value, the third value is the energy (in energy units), and
|
||||
the fourth is -dE/d(phi) also in energy units). The third term is the
|
||||
energy of the 4-atom configuration for the specified angle. The fourth
|
||||
term (when present) is the negative derivative of the energy with
|
||||
respect to the angle (in degrees, or radians depending on whether the
|
||||
user selected DEGREES or RADIANS). Thus the units of the last term
|
||||
are still energy, not force. The dihedral angle values must increase
|
||||
from one line to the next.
|
||||
|
||||
Dihedral table splines are cyclic. There is no discontinuity at 180
|
||||
degrees (or at any other angle). Although in the examples above, the
|
||||
angles range from -180 to 180 degrees, in general, the first angle in
|
||||
the list can have any value (positive, zero, or negative). However
|
||||
the *range* of angles represented in the table must be *strictly* less
|
||||
than 360 degrees (2pi radians) to avoid angle overlap. (You may not
|
||||
supply entries in the table for both 180 and -180, for example.) If
|
||||
the user's table covers only a narrow range of dihedral angles,
|
||||
strange numerical behavior can occur in the large remaining gap.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
The parameter "N" is required and its value is the number of table
|
||||
entries that follow. Note that this may be different than the N
|
||||
specified in the :doc:`dihedral_style table <dihedral_style>` command.
|
||||
Let *Ntable* is the number of table entries requested dihedral_style
|
||||
command, and let *Nfile* be the parameter following "N" in the
|
||||
tabulated file ("30" in the sparse example above). What LAMMPS does
|
||||
is a preliminary interpolation by creating splines using the *Nfile*
|
||||
tabulated values as nodal points. It uses these to interpolate as
|
||||
needed to generate energy and derivative values at *Ntable* different
|
||||
points (which are evenly spaced over a 360 degree range, even if the
|
||||
angles in the file are not). The resulting tables of length *Ntable*
|
||||
are then used as described above, when computing energy and force for
|
||||
individual dihedral angles and their atoms. This means that if you
|
||||
want the interpolation tables of length *Ntable* to match exactly what
|
||||
is in the tabulated file (with effectively nopreliminary
|
||||
interpolation), you should set *Ntable* = *Nfile*\ . To insure the
|
||||
nodal points in the user's file are aligned with the interpolated
|
||||
table entries, the angles in the table should be integer multiples of
|
||||
360/\ *Ntable* degrees, or 2\*PI/\ *Ntable* radians (depending on your
|
||||
choice of angle units).
|
||||
|
||||
The optional "NOF" keyword allows the user to omit the forces
|
||||
(negative energy derivatives) from the table file (normally located in
|
||||
the fourth column). In their place, forces will be calculated
|
||||
automatically by differentiating the potential energy function
|
||||
indicated by the third column of the table (using either linear or
|
||||
spline interpolation).
|
||||
|
||||
The optional "DEGREES" keyword allows the user to specify angles in
|
||||
degrees instead of radians (default).
|
||||
|
||||
The optional "RADIANS" keyword allows the user to specify angles in
|
||||
radians instead of degrees. (Note: This changes the way the forces
|
||||
are scaled in the fourth column of the data file.)
|
||||
|
||||
The optional "CHECKU" keyword is followed by a filename. This allows
|
||||
the user to save all of the *Ntable* different entries in the
|
||||
interpolated energy table to a file to make sure that the interpolated
|
||||
function agrees with the user's expectations. (Note: You can
|
||||
temporarily increase the *Ntable* parameter to a high value for this
|
||||
purpose. "\ *Ntable*\ " is explained above.)
|
||||
|
||||
The optional "CHECKF" keyword is analogous to the "CHECKU" keyword.
|
||||
It is followed by a filename, and it allows the user to check the
|
||||
interpolated force table. This option is available even if the user
|
||||
selected the "NOF" option.
|
||||
|
||||
Note that one file can contain many sections, each with a tabulated
|
||||
potential. LAMMPS reads the file section by section until it finds one
|
||||
that matches the specified keyword.
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This dihedral style writes the settings for the "dihedral_style table/cut"
|
||||
command to :doc:`binary restart files <restart>`, so a dihedral_style
|
||||
command does not need to specified in an input script that reads a
|
||||
restart file. However, the coefficient information is not stored in
|
||||
the restart file, since it is tabulated in the potential files. Thus,
|
||||
dihedral_coeff commands do need to be specified in the restart input
|
||||
script.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This dihedral style can only be used if LAMMPS was built with the
|
||||
USER-MISC package. See the :doc:`Build package <Build_package>` doc
|
||||
page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`dihedral_coeff <dihedral_coeff>`, :doc:`dihedral_style table <dihedral_table>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
|
||||
.. _dihedralcut-Salerno:
|
||||
|
||||
**(Salerno)** Salerno, Bernstein, J Chem Theory Comput, --, ---- (2018).
|
|
@ -349,7 +349,7 @@ the box size stored with the snapshot.
|
|||
|
||||
The *xtc* style writes XTC files, a compressed trajectory format used
|
||||
by the GROMACS molecular dynamics package, and described
|
||||
`here <http://manual.gromacs.org/current/online/xtc.html>`_.
|
||||
`here <https://manual.gromacs.org/current/reference-manual/file-formats.html#xtc>`_.
|
||||
The precision used in XTC files can be adjusted via the
|
||||
:doc:`dump_modify <dump_modify>` command. The default value of 1000
|
||||
means that coordinates are stored to 1/1000 nanometer accuracy. XTC
|
||||
|
|
|
@ -307,7 +307,9 @@ atoms in the chunk. The averaged output value for the chunk on the
|
|||
average over atoms across the entire *Nfreq* timescale. For the
|
||||
*density/number* and *density/mass* values, the volume (bin volume or
|
||||
system volume) used in the final normalization will be the volume at
|
||||
the final *Nfreq* timestep.
|
||||
the final *Nfreq* timestep. For the *temp* values, degrees of freedom and
|
||||
kinetic energy are summed separately across the entire *Nfreq* timescale, and
|
||||
the output value is calculated by dividing those two sums.
|
||||
|
||||
If the *norm* setting is *sample*\ , the chunk value is summed over
|
||||
atoms for each sample, as is the count, and an "average sample value"
|
||||
|
|
|
@ -127,6 +127,11 @@ the :doc:`run <run>` command.
|
|||
The forces due to this fix are imposed during an energy minimization,
|
||||
invoked by the :doc:`minimize <minimize>` command.
|
||||
|
||||
The :doc:`fix_modify <fix_modify>` *respa* option is supported by this
|
||||
fix. This allows to set at which level of the :doc:`r-RESPA
|
||||
<run_style>` integrator the fix is adding its forces. Default is the
|
||||
outermost level.
|
||||
|
||||
.. note::
|
||||
|
||||
If you want the potential energy associated with the CMAP terms
|
||||
|
|
|
@ -115,6 +115,18 @@ The version with "bondmax" will just run somewhat faster, due to less
|
|||
overhead in computing bond lengths and not storing them in a separate
|
||||
compute.
|
||||
|
||||
A variable can be used to implement a large variety of conditions,
|
||||
including to stop when a specific file exists. Example:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable exit equal is_file(EXIT)
|
||||
fix 10 all halt 100 v_exit != 0 error soft
|
||||
|
||||
Will stop the current run command when a file ``EXIT`` is created
|
||||
in the current working directory. The condition can be cleared
|
||||
by removing the file through the :doc:`shell <shell>` command.
|
||||
|
||||
The choice of operators listed above are the usual comparison
|
||||
operators. The XOR operation (exclusive or) is also included as "\|\^".
|
||||
In this context, XOR means that if either the attribute or avalue is
|
||||
|
|
|
@ -48,8 +48,8 @@ Examples
|
|||
fix 1 ellipsoid rigid/meso single
|
||||
fix 1 rods rigid/meso molecule
|
||||
fix 1 spheres rigid/meso single force 1 off off on
|
||||
fix 1 particles rigid/meso molecule force 1\*5 off off off force 6\*10 off off on
|
||||
fix 2 spheres rigid/meso group 3 sphere1 sphere2 sphere3 torque \* off off off
|
||||
fix 1 particles rigid/meso molecule force 1*5 off off off force 6*10 off off on
|
||||
fix 2 spheres rigid/meso group 3 sphere1 sphere2 sphere3 torque * off off off
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
|
|
@ -120,12 +120,12 @@ specified atom types, atom IDs, or molecule IDs into the group. These
|
|||
The first format is a list of values (types or IDs). For example, the
|
||||
second command in the examples above puts all atoms of type 3 or 4 into
|
||||
the group named *water*\ . Each entry in the list can be a
|
||||
colon-separated sequence A:B or A:B:C, as in two of the examples
|
||||
colon-separated sequence ``A:B`` or ``A:B:C``, as in two of the examples
|
||||
above. A "sequence" generates a sequence of values (types or IDs),
|
||||
with an optional increment. The first example with 500:1000 has the
|
||||
with an optional increment. The first example with ``500:1000`` has the
|
||||
default increment of 1 and would add all atom IDs from 500 to 1000
|
||||
(inclusive) to the group sub, along with 10,25,50 since they also
|
||||
appear in the list of values. The second example with 100:10000:10
|
||||
appear in the list of values. The second example with ``100:10000:10``
|
||||
uses an increment of 10 and would thus would add atoms IDs
|
||||
100,110,120, ... 9990,10000 to the group sub.
|
||||
|
||||
|
@ -269,7 +269,7 @@ group and running further.
|
|||
.. code-block:: LAMMPS
|
||||
|
||||
variable nsteps equal 5000
|
||||
variable rad equal 18-(step/v_nsteps)\*(18-5)
|
||||
variable rad equal 18-(step/v_nsteps)*(18-5)
|
||||
region ss sphere 20 20 0 v_rad
|
||||
group mobile dynamic all region ss
|
||||
fix 1 mobile nve
|
||||
|
|
|
@ -1205,7 +1205,7 @@ coordinates of atoms in the unit cell of the cubic crystal. In the case of,
|
|||
e.g. a conventional fcc unit cell, the "source-value" key in the map associated
|
||||
with this key should be assigned the following value:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
.. code-block:: text
|
||||
|
||||
[[0.0, 0.0, 0.0],
|
||||
[0.5, 0.5, 0.0],
|
||||
|
|
|
@ -150,7 +150,7 @@ shifted to be 0.0 at the cutoff distance Rc.
|
|||
The :doc:`pair_modify <pair_modify>` table option is not relevant
|
||||
for these pair styles.
|
||||
|
||||
These pair style do not support the :doc:`pair_modify <pair_modify>`
|
||||
These pair styles do not support the :doc:`pair_modify <pair_modify>`
|
||||
tail option for adding long-range tail corrections to energy and
|
||||
pressure.
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ Mixing, shift, table, tail correction, restart, rRESPA info
|
|||
|
||||
The different versions of the *lj/cut/soft* pair styles support mixing. For
|
||||
atom type pairs I,J and I != J, the :math:`\epsilon` and :math:`\sigma`
|
||||
coefficients and cutoff distance for these pair style can be mixed. The default
|
||||
coefficients and cutoff distance for these pair styles can be mixed. The default
|
||||
mix value is *geometric* for 12-6 styles.
|
||||
|
||||
The mixing rule for epsilon and sigma for *lj/class2/soft* 9-6 potentials is to
|
||||
|
|
|
@ -188,7 +188,7 @@ Restrictions
|
|||
The *gayberne* style is part of the ASPHERE package. It is only
|
||||
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
||||
|
||||
These pair style require that atoms store torque and a quaternion to
|
||||
These pair styles require that atoms store torque and a quaternion to
|
||||
represent their orientation, as defined by the
|
||||
:doc:`atom_style <atom_style>`. It also require they store a per-type
|
||||
:doc:`shape <set>`. The particles cannot store a per-particle
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
.. index:: pair_style lj/switch3/coulgauss/long
|
||||
.. index:: pair_style mm3/switch3/coulgauss/long
|
||||
|
||||
pair_style lj/switch3/coulgauss/long command
|
||||
============================================
|
||||
|
||||
pair_style mm3/switch3/coulgauss/long command
|
||||
=============================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
|
@ -10,7 +14,7 @@ Syntax
|
|||
|
||||
pair_style style args
|
||||
|
||||
* style = *lj/switch3/coulgauss/long*
|
||||
* style = *lj/switch3/coulgauss/long* or *mm3/switch3/coulgauss/long*
|
||||
* args = list of arguments for a particular style
|
||||
|
||||
.. parsed-literal::
|
||||
|
@ -20,6 +24,11 @@ Syntax
|
|||
cutoff2 = global cutoff for Coulombic (optional) (distance units)
|
||||
width = width parameter of the smoothing function (distance units)
|
||||
|
||||
*mm3/switch3/coulgauss/long* args = cutoff (cutoff2) width
|
||||
cutoff = global cutoff for MM3 (and Coulombic if only 1 arg) (distance units)
|
||||
cutoff2 = global cutoff for Coulombic (optional) (distance units)
|
||||
width = width parameter of the smoothing function (distance units)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
|
@ -31,6 +40,12 @@ Examples
|
|||
pair_style lj/switch3/coulgauss/long 12.0 10.0 3.0
|
||||
pair_coeff 1 0.2 2.5 1.2
|
||||
|
||||
pair_style mm3/switch3/coulgauss/long 12.0 3.0
|
||||
pair_coeff 1 0.2 2.5 1.2
|
||||
|
||||
pair_style mm3/switch3/coulgauss/long 12.0 10.0 3.0
|
||||
pair_coeff 1 0.2 2.5 1.2
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
|
@ -41,8 +56,17 @@ vdW potential
|
|||
|
||||
E = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12}-\left(\frac{\sigma}{r}\right)^{6} \right]
|
||||
|
||||
, which goes smoothly to zero at the cutoff r_c as defined
|
||||
by the switching function
|
||||
The *mm3/switch3/coulgauss/long* style evaluates the MM3
|
||||
vdW potential :ref:`(Allinger) <mm3-allinger1989>`
|
||||
|
||||
.. math::
|
||||
|
||||
E & = \epsilon_{ij} \left[ -2.25 \left(\frac{r_{v,ij}}{r_{ij}}\right)^6 + 1.84(10)^5 \exp\left[-12.0 r_{ij}/r_{v,ij}\right] \right] S_3(r_{ij}) \\
|
||||
r_{v,ij} & = r_{v,i} + r_{v,j} \\
|
||||
\epsilon_{ij} & = \sqrt{\epsilon_i \epsilon_j}
|
||||
|
||||
Both potentials go smoothly to zero at the cutoff r_c as defined by the
|
||||
switching function
|
||||
|
||||
.. math::
|
||||
|
||||
|
@ -85,14 +109,35 @@ commands:
|
|||
Mixing, shift, table, tail correction, restart, rRESPA info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
For atom type pairs I,J and I != J, the epsilon and sigma coefficients
|
||||
and cutoff distance for all of the lj/long pair styles can be mixed.
|
||||
The default mix value is *geometric*\ . See the "pair_modify" command
|
||||
for details.
|
||||
|
||||
Shifting the potential energy is not necessary because the switching
|
||||
function ensures that the potential is zero at the cut-off.
|
||||
|
||||
These pair styles support the :doc:`pair_modify <pair_modify>` table and
|
||||
options since they can tabulate the short-range portion of the
|
||||
long-range Coulombic interactions.
|
||||
|
||||
Thes pair styles do not support the :doc:`pair_modify <pair_modify>`
|
||||
tail option for adding a long-range tail correction to the
|
||||
Lennard-Jones portion of the energy and pressure.
|
||||
|
||||
These pair styles write their information to :doc:`binary restart files <restart>`, so pair_style and pair_coeff commands do not need
|
||||
to be specified in an input script that reads a restart file.
|
||||
|
||||
These pair styles can only be used via the *pair* keyword of the
|
||||
:doc:`run_style respa <run_style>` command. They do not support the
|
||||
*inner*\ , *middle*\ , *outer* keywords.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
These styles are part of the USER-YAFF package. They are only
|
||||
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
||||
These styles are part of the USER-YAFF package. They are only enabled
|
||||
if LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` doc page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
.. index:: pair_style mm3/switch3/coulgauss/long
|
||||
|
||||
pair_style mm3/switch3/coulgauss/long command
|
||||
=============================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style style args
|
||||
|
||||
* style = *mm3/switch3/coulgauss/long*
|
||||
* args = list of arguments for a particular style
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*mm3/switch3/coulgauss/long* args = cutoff (cutoff2) width
|
||||
cutoff = global cutoff for MM3 (and Coulombic if only 1 arg) (distance units)
|
||||
cutoff2 = global cutoff for Coulombic (optional) (distance units)
|
||||
width = width parameter of the smoothing function (distance units)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style mm3/switch3/coulgauss/long 12.0 3.0
|
||||
pair_coeff 1 0.2 2.5 1.2
|
||||
|
||||
pair_style mm3/switch3/coulgauss/long 12.0 10.0 3.0
|
||||
pair_coeff 1 0.2 2.5 1.2
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
The *mm3/switch3/coulgauss/long* style evaluates the MM3
|
||||
vdW potential :ref:`(Allinger) <mm3-allinger1989>`
|
||||
|
||||
.. math::
|
||||
|
||||
E & = \epsilon_{ij} \left[ -2.25 \left(\frac{r_{v,ij}}{r_{ij}}\right)^6 + 1.84(10)^5 \exp\left[-12.0 r_{ij}/r_{v,ij}\right] \right] S_3(r_{ij}) \\
|
||||
r_{v,ij} & = r_{v,i} + r_{v,j} \\
|
||||
\epsilon_{ij} & = \sqrt{\epsilon_i \epsilon_j}
|
||||
|
||||
, which goes smoothly to zero at the cutoff r_c as defined
|
||||
by the switching function
|
||||
|
||||
.. math::
|
||||
|
||||
S_3(r) = \left\lbrace \begin{array}{ll}
|
||||
1 & \quad\mathrm{if}\quad r < r_\mathrm{c} - w \\
|
||||
3x^2 - 2x^3 & \quad\mathrm{if}\quad r < r_\mathrm{c} \quad\mathrm{with\quad} x=\frac{r_\mathrm{c} - r}{w} \\
|
||||
0 & \quad\mathrm{if}\quad r >= r_\mathrm{c}
|
||||
\end{array} \right.
|
||||
|
||||
where w is the width defined in the arguments. This potential
|
||||
is combined with Coulomb interaction between Gaussian charge densities:
|
||||
|
||||
.. math::
|
||||
|
||||
E = \frac{q_i q_j \mathrm{erf}\left( r/\sqrt{\gamma_1^2+\gamma_2^2} \right) }{\epsilon r_{ij}}
|
||||
|
||||
where :math:`q_i` and :math:`q_j` are the charges on the 2 atoms,
|
||||
epsilon is the dielectric constant which can be set by the
|
||||
:doc:`dielectric <dielectric>` command, ::math:`\gamma_i` and
|
||||
:math:`\gamma_j` are the widths of the Gaussian charge distribution and
|
||||
erf() is the error-function. This style has to be used in conjunction
|
||||
with the :doc:`kspace_style <kspace_style>` command
|
||||
|
||||
If one cutoff is specified it is used for both the vdW and Coulomb
|
||||
terms. If two cutoffs are specified, the first is used as the cutoff
|
||||
for the vdW terms, and the second is the cutoff for the Coulombic term.
|
||||
|
||||
The following coefficients must be defined for each pair of atoms
|
||||
types via the :doc:`pair_coeff <pair_coeff>` command as in the examples
|
||||
above, or in the data file or restart files read by the
|
||||
:doc:`read_data <read_data>` or :doc:`read_restart <read_restart>`
|
||||
commands:
|
||||
|
||||
* :math:`\epsilon` (energy)
|
||||
* :math:`r_v` (distance)
|
||||
* :math:`\gamma` (distance)
|
||||
|
||||
----------
|
||||
|
||||
Mixing, shift, table, tail correction, restart, rRESPA info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Mixing rules are fixed for this style as defined above.
|
||||
|
||||
Shifting the potential energy is not necessary because the switching
|
||||
function ensures that the potential is zero at the cut-off.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
These styles are part of the USER-YAFF package. They are only
|
||||
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`pair_coeff <pair_coeff>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
|
@ -319,7 +319,7 @@ This pair style is part of the MANYBODY package. It is only enabled if
|
|||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` doc page for more info.
|
||||
|
||||
This pair potential requires the :doc:`newtion <newton>` setting to be
|
||||
This pair potential requires the :doc:`newton <newton>` setting to be
|
||||
"on" for pair interactions.
|
||||
|
||||
The potential files provided with LAMMPS (see the potentials directory)
|
||||
|
|
|
@ -250,7 +250,7 @@ accelerated styles exist.
|
|||
* :doc:`mgpt <pair_mgpt>` - simplified model generalized pseudopotential theory (MGPT) potential
|
||||
* :doc:`mesont/tpm <pair_mesont_tpm>` - nanotubes mesoscopic force field
|
||||
* :doc:`mie/cut <pair_mie>` - Mie potential
|
||||
* :doc:`mm3/switch3/coulgauss/long <pair_mm3_switch3_coulgauss_long>` - smoothed MM3 vdW potential with Gaussian electrostatics
|
||||
* :doc:`mm3/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>` - smoothed MM3 vdW potential with Gaussian electrostatics
|
||||
* :doc:`momb <pair_momb>` - Many-Body Metal-Organic (MOMB) force field
|
||||
* :doc:`morse <pair_morse>` - Morse potential
|
||||
* :doc:`morse/smooth/linear <pair_morse>` - linear smoothed Morse potential
|
||||
|
|
|
@ -217,7 +217,7 @@ This pair style can only be used via the *pair* keyword of the
|
|||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
These pair style are part of the MANYBODY package. They is only
|
||||
These pair styles are part of the MANYBODY package. They are only
|
||||
enabled if LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
||||
|
||||
These pair styles requires the :doc:`newton <newton>` setting to be "on"
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
.. index:: plugin
|
||||
|
||||
plugin command
|
||||
==============
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
plugin command args
|
||||
|
||||
* command = *load* or *unload* or *list* or *clear*
|
||||
* args = list of arguments for a particular plugin command
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*load* file = load plugin(s) from shared object in *file*
|
||||
*unload* style name = unload plugin *name* of style *style*
|
||||
*style* = *pair* or *bond* or *angle* or *dihedral* or *improper* or *compute* or *fix* or *region* or *command*
|
||||
*list* = print a list of currently loaded plugins
|
||||
*clear* = unload all currently loaded plugins
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
plugin load morse2plugin.so
|
||||
plugin unload pair morse2/omp
|
||||
plugin unload command hello
|
||||
plugin list
|
||||
plugin clear
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
The plugin command allows to load (and unload) additional styles and
|
||||
commands into a LAMMPS binary from so-called dynamic shared object (DSO)
|
||||
files. This enables to add new functionality to an existing LAMMPS
|
||||
binary without having to recompile and link the entire executable.
|
||||
|
||||
The *load* command will load and initialize all plugins contained in the
|
||||
plugin DSO with the given filename. A message with information the
|
||||
plugin style and name and more will be printed. Individual DSO files
|
||||
may contain multiple plugins. More details about how to write and
|
||||
compile the plugin DSO is given in programmer's guide part of the manual
|
||||
under :doc:`Developer_plugins`.
|
||||
|
||||
The *unload* command will remove the given style or the given name from
|
||||
the list of available styles. If the plugin style is currently in use,
|
||||
that style instance will be deleted.
|
||||
|
||||
The *list* command will print a list of the loaded plugins and their
|
||||
styles and names.
|
||||
|
||||
The *clear* command will unload all currently loaded plugins.
|
||||
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
The *plugin* command is part of the PLUGIN package. It is
|
||||
only enabled if LAMMPS was built with that package.
|
||||
See the :doc:`Build package <Build_package>` doc page for
|
||||
more info. Plugins are not available on Windows.
|
||||
|
||||
For the loading of plugins to work the LAMMPS library must be
|
||||
:ref:`compiled as a shared library <library>`. If plugins
|
||||
access functions or classes from a package, LAMMPS must have
|
||||
been compiled with that package included.
|
||||
|
||||
Plugins are dependent on the LAMMPS binary interface (ABI)
|
||||
and particularly the MPI library used. So they are not guaranteed
|
||||
to work when the plugin was compiled with a different MPI library
|
||||
or different compilation settings or a different LAMMPS version.
|
||||
There are no checks, so if there is a mismatch the plugin object
|
||||
will either not load or data corruption and crashes may happen.
|
||||
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
none
|
||||
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
|
@ -15,7 +15,7 @@ Syntax
|
|||
|
||||
.. 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
|
||||
Nfirst = dump timestep to start on
|
||||
*last* args = Nlast
|
||||
|
@ -28,6 +28,7 @@ Syntax
|
|||
Nstart = timestep on which pseudo run will start
|
||||
*stop* args = Nstop
|
||||
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
|
||||
|
||||
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
|
||||
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.
|
||||
Its arguments are passed internally to the :doc:`read_dump <read_dump>`
|
||||
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
|
||||
infinity), start = same as first, stop = same as last, every = 0, skip
|
||||
= 1;
|
||||
= 1, post = no;
|
||||
|
|
|
@ -87,7 +87,7 @@ energy is a derived unit (in SI units you equivalently have the relation
|
|||
* charge = reduced LJ charge, where :math:`q^* = q \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon}}`
|
||||
* dipole = reduced LJ dipole, moment where :math:`\mu^* = \mu \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma^3 \epsilon}}`
|
||||
* electric field = force/charge, where :math:`E^* = E \frac{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon} \sigma}{\epsilon}`
|
||||
* density = mass/volume, where :math:`\rho^* = \rho \sigma^{dim}`
|
||||
* density = mass/volume, where :math:`\rho^* = \rho \frac{\sigma^{dim}}{m}`
|
||||
|
||||
Note that for LJ units, the default mode of thermodynamic output via
|
||||
the :doc:`thermo_style <thermo_style>` command is to normalize all
|
||||
|
|
|
@ -65,8 +65,8 @@ Syntax
|
|||
bound(group,dir,region), gyration(group,region), ke(group,reigon),
|
||||
angmom(group,dim,region), torque(group,dim,region),
|
||||
inertia(group,dimdim,region), omega(group,dim,region)
|
||||
special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x)
|
||||
feature functions = is_active(category,feature,exact), is_defined(category,id,exact)
|
||||
special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name)
|
||||
feature functions = is_available(category,feature), is_active(category,feature), is_defined(category,id)
|
||||
atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i]
|
||||
atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q
|
||||
compute references = c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i]
|
||||
|
@ -429,7 +429,7 @@ argument. For *equal*\ -style variables the formula computes a scalar
|
|||
quantity, which becomes the value of the variable whenever it is
|
||||
evaluated. For *vector*\ -style variables the formula must compute a
|
||||
vector of quantities, which becomes the value of the variable whenever
|
||||
it is evaluated. The calculated vector can be on length one, but it
|
||||
it is evaluated. The calculated vector can be of length one, but it
|
||||
cannot be a simple scalar value like that produced by an equal-style
|
||||
compute. I.e. the formula for a vector-style variable must have at
|
||||
least one quantity in it that refers to a global vector produced by a
|
||||
|
@ -821,6 +821,10 @@ Special Functions
|
|||
Special functions take specific kinds of arguments, meaning their
|
||||
arguments cannot be formulas themselves.
|
||||
|
||||
The is_file(x) function is a test whether 'x' is a (readable) file
|
||||
and returns 1 in this case, otherwise it returns 0. For that 'x'
|
||||
is taken as a literal string and must not have any blanks in it.
|
||||
|
||||
The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions
|
||||
each take 1 argument which is of the form "c_ID" or "c_ID[N]" or
|
||||
"f_ID" or "f_ID[N]" or "v_name". The first two are computes and the
|
||||
|
|
|
@ -40,7 +40,7 @@ class LAMMPSLexer(RegexLexer):
|
|||
(r'compute\s+', Keyword, 'compute'),
|
||||
(r'dump\s+', Keyword, 'dump'),
|
||||
(r'region\s+', Keyword, 'region'),
|
||||
(r'variable\s+', Keyword, 'variable'),
|
||||
(r'^\s*variable\s+', Keyword, 'variable_cmd'),
|
||||
(r'group\s+', Keyword, 'group'),
|
||||
(r'change_box\s+', Keyword, 'change_box'),
|
||||
(r'uncompute\s+', Keyword, 'uncompute'),
|
||||
|
@ -51,6 +51,7 @@ class LAMMPSLexer(RegexLexer):
|
|||
(r'#.*?\n', Comment),
|
||||
('"', String, 'string'),
|
||||
('\'', String, 'single_quote_string'),
|
||||
(r'[0-9]+:[0-9]+(:[0-9]+)?', Number),
|
||||
(r'[0-9]+(\.[0-9]+)?([eE]\-?[0-9]+)?', Number),
|
||||
('\$?\(', Name.Variable, 'expression'),
|
||||
('\$\{', Name.Variable, 'variable'),
|
||||
|
@ -58,6 +59,7 @@ class LAMMPSLexer(RegexLexer):
|
|||
(r'\$[\w_]+', Name.Variable),
|
||||
(r'\s+', Whitespace),
|
||||
(r'[\+\-\*\^\|\/\!%&=<>]', Operator),
|
||||
(r'[\~\.\w_:,@\-\/\\0-9]+', Text),
|
||||
],
|
||||
'keywords' : [
|
||||
(words(LAMMPS_COMMANDS, suffix=r'\b', prefix=r'^'), Keyword)
|
||||
|
@ -99,7 +101,7 @@ class LAMMPSLexer(RegexLexer):
|
|||
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
||||
default('#pop')
|
||||
],
|
||||
'variable' : [
|
||||
'variable_cmd' : [
|
||||
(r'[\w_\-\.\[\]]+', Name.Variable.Identifier),
|
||||
default('#pop')
|
||||
],
|
||||
|
|
|
@ -1588,6 +1588,7 @@ lammps
|
|||
Lammps
|
||||
LAMMPS
|
||||
lammpsplot
|
||||
lammpsplugin
|
||||
Lampis
|
||||
Lamoureux
|
||||
Lanczos
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
# sample surface deposition script for molecules
|
||||
|
||||
units lj
|
||||
atom_style bond
|
||||
boundary p p f
|
||||
|
||||
lattice fcc 1.0
|
||||
region box block 0 5 0 5 0 10
|
||||
create_box 3 box bond/types 1 extra/bond/per/atom 1
|
||||
|
||||
region substrate block INF INF INF INF INF 3
|
||||
create_atoms 1 region substrate
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0
|
||||
pair_coeff 1 2 1.0 1.0 5.0
|
||||
mass * 1.0
|
||||
|
||||
bond_style harmonic
|
||||
bond_coeff 1 5.0 1.0
|
||||
|
||||
neigh_modify delay 0
|
||||
|
||||
molecule dimer molecule.dimer
|
||||
region slab block 0 5 0 5 8 9
|
||||
|
||||
group addatoms empty
|
||||
region mobile block 0 5 0 5 2 INF
|
||||
group mobile region mobile
|
||||
|
||||
compute add addatoms temp
|
||||
compute_modify add dynamic/dof yes extra/dof 0
|
||||
|
||||
fix 1 addatoms rigid/small molecule mol dimer
|
||||
fix 2 mobile langevin 0.1 0.1 0.1 587283
|
||||
fix 3 mobile nve
|
||||
|
||||
fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 &
|
||||
mol dimer vz -1.0 -1.0 rigid 1
|
||||
fix 5 addatoms wall/reflect zhi EDGE
|
||||
|
||||
thermo_style custom step atoms temp epair etotal press
|
||||
thermo 100
|
||||
thermo_modify temp add lost/bond ignore lost warn
|
||||
|
||||
#dump 1 all atom 50 dump.deposit.atom
|
||||
|
||||
#dump 2 all image 50 image.*.jpg type type &
|
||||
# axes yes 0.8 0.02 view 80 -30
|
||||
#dump_modify 2 pad 5
|
||||
|
||||
#dump 3 all movie 50 tmp.mpg type type &
|
||||
# axes yes 0.8 0.02 view 80 -30
|
||||
#dump_modify 3 pad 5
|
||||
|
||||
run 10000
|
|
@ -21,11 +21,11 @@ bond_coeff 1 5.0 1.0
|
|||
|
||||
neigh_modify delay 0
|
||||
|
||||
group addatoms type 2
|
||||
group addatoms empty
|
||||
region mobile block 0 5 0 5 2 INF
|
||||
group mobile region mobile
|
||||
|
||||
compute add addatoms temp
|
||||
compute add addatoms temp
|
||||
compute_modify add dynamic/dof yes extra/dof 0
|
||||
|
||||
fix 1 addatoms nve
|
||||
|
|
|
@ -0,0 +1,218 @@
|
|||
LAMMPS (10 Mar 2021)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
# sample surface deposition script for molecules
|
||||
|
||||
units lj
|
||||
atom_style bond
|
||||
boundary p p f
|
||||
|
||||
lattice fcc 1.0
|
||||
Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011
|
||||
region box block 0 5 0 5 0 10
|
||||
create_box 3 box bond/types 1 extra/bond/per/atom 1
|
||||
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
|
||||
region substrate block INF INF INF INF INF 3
|
||||
create_atoms 1 region substrate
|
||||
Created 350 atoms
|
||||
create_atoms CPU = 0.001 seconds
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0
|
||||
pair_coeff 1 2 1.0 1.0 5.0
|
||||
mass * 1.0
|
||||
|
||||
bond_style harmonic
|
||||
bond_coeff 1 5.0 1.0
|
||||
|
||||
neigh_modify delay 0
|
||||
|
||||
molecule dimer molecule.dimer
|
||||
Read molecule template dimer:
|
||||
1 molecules
|
||||
2 atoms with max type 3
|
||||
1 bonds with max type 1
|
||||
0 angles with max type 0
|
||||
0 dihedrals with max type 0
|
||||
0 impropers with max type 0
|
||||
region slab block 0 5 0 5 8 9
|
||||
|
||||
group addatoms empty
|
||||
0 atoms in group addatoms
|
||||
region mobile block 0 5 0 5 2 INF
|
||||
group mobile region mobile
|
||||
150 atoms in group mobile
|
||||
|
||||
compute add addatoms temp
|
||||
compute_modify add dynamic/dof yes extra/dof 0
|
||||
|
||||
fix 1 addatoms rigid/small molecule mol dimer
|
||||
create bodies CPU = 0.000 seconds
|
||||
0 rigid bodies with 0 atoms
|
||||
1.0000000 = max distance from body owner to body atom
|
||||
fix 2 mobile langevin 0.1 0.1 0.1 587283
|
||||
fix 3 mobile nve
|
||||
|
||||
fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1
|
||||
fix 5 addatoms wall/reflect zhi EDGE
|
||||
|
||||
thermo_style custom step atoms temp epair etotal press
|
||||
thermo 100
|
||||
thermo_modify temp add lost/bond ignore lost warn
|
||||
WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468)
|
||||
|
||||
#dump 1 all atom 50 dump.deposit.atom
|
||||
|
||||
#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30
|
||||
#dump_modify 2 pad 5
|
||||
|
||||
#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30
|
||||
#dump_modify 3 pad 5
|
||||
|
||||
run 10000
|
||||
WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182)
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5.3
|
||||
ghost atom cutoff = 5.3
|
||||
binsize = 2.65, bins = 3 3 6
|
||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||
(1) pair lj/cut, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/newton
|
||||
stencil: half/bin/3d/newton
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 5.929 | 5.929 | 5.929 Mbytes
|
||||
Step Atoms Temp E_pair TotEng Press
|
||||
0 350 0 -6.9215833 -6.9215833 -1.0052629
|
||||
100 352 1.0079368 -6.8875167 -6.8803581 -0.73353914
|
||||
200 354 1.0081552 -6.8594643 -6.8452248 -0.70421276
|
||||
300 356 1.0085803 -6.8171524 -6.7959042 -0.6917826
|
||||
400 358 1.0099188 -6.7852701 -6.7570601 -0.70371699
|
||||
500 360 1.0140221 -6.7493429 -6.7141338 -0.68415307
|
||||
600 362 1.026148 -6.7105231 -6.6680032 -0.68314418
|
||||
700 364 1.0683344 -6.6725162 -6.621154 -0.65747369
|
||||
800 366 1.0958952 -6.6412275 -6.5813425 -0.68789614
|
||||
900 368 1.1250033 -6.6101882 -6.541404 -0.66674346
|
||||
1000 370 1.2326373 -6.5993719 -6.5160856 -0.6968868
|
||||
1100 372 1.1397426 -6.5912861 -6.5070309 -0.63330356
|
||||
1200 374 1.0514292 -6.5905747 -6.5062354 -0.71020362
|
||||
1300 376 1.003296 -6.5747765 -6.4880555 -0.65459732
|
||||
1400 378 0.82999289 -6.5681797 -6.4913285 -0.60438126
|
||||
1500 380 0.90239175 -6.575298 -6.4862461 -0.66528725
|
||||
1600 382 0.86399799 -6.5692206 -6.4787496 -0.65027781
|
||||
1700 384 0.64747231 -6.5644237 -6.4927634 -0.6304614
|
||||
1800 386 0.74288971 -6.5515735 -6.4649672 -0.67772325
|
||||
1900 388 0.7257202 -6.5565091 -6.4676644 -0.66173549
|
||||
2000 390 0.73381036 -6.5631515 -6.4690733 -0.64685916
|
||||
2100 392 0.76476562 -6.5574124 -6.4549885 -0.68866192
|
||||
2200 394 0.65932468 -6.5511557 -6.459118 -0.71728829
|
||||
2300 396 0.70269509 -6.5728146 -6.4707819 -0.64362081
|
||||
2400 398 0.60528919 -6.5845991 -6.4933494 -0.63956327
|
||||
2500 400 0.51025744 -6.5812452 -6.5015175 -0.68706961
|
||||
2600 402 0.5245131 -6.6003894 -6.5155801 -0.68972215
|
||||
2700 404 0.46330251 -6.5659175 -6.4885092 -0.72870942
|
||||
2800 406 0.48039778 -6.5715192 -6.488692 -0.753758
|
||||
2900 408 0.53698616 -6.5813154 -6.4858951 -0.67117541
|
||||
3000 410 0.50231419 -6.5886963 -6.4968096 -0.71905351
|
||||
3100 412 0.49420225 -6.596733 -6.5037702 -0.65947518
|
||||
3200 414 0.42703699 -6.5879338 -6.5054146 -0.80033546
|
||||
3300 416 0.44306009 -6.580249 -6.4923825 -0.76503083
|
||||
3400 418 0.55620672 -6.5923388 -6.4792346 -0.69367877
|
||||
3500 420 0.39815033 -6.5911154 -6.5081674 -0.65569211
|
||||
3600 422 0.44197847 -6.6026382 -6.5083774 -0.73299102
|
||||
3700 424 0.45049389 -6.6060616 -6.5077817 -0.7552914
|
||||
3800 426 0.43047295 -6.6079275 -6.51193 -0.71501328
|
||||
3900 428 0.43779129 -6.6099306 -6.5102001 -0.71539515
|
||||
4000 430 0.41113503 -6.6123009 -6.5166881 -0.74177096
|
||||
4100 432 0.32800011 -6.5983566 -6.5205325 -0.71688103
|
||||
4200 434 0.39168203 -6.6110342 -6.5162724 -0.78927697
|
||||
4300 436 0.48151013 -6.6183315 -6.4996106 -0.70523035
|
||||
4400 438 0.45391027 -6.6331732 -6.5191775 -0.7270855
|
||||
4500 440 0.349126 -6.6091657 -6.5199006 -0.76974115
|
||||
4600 442 0.43375023 -6.6219188 -6.5090653 -0.74576212
|
||||
4700 444 0.40071749 -6.6184164 -6.5123707 -0.71919052
|
||||
4800 446 0.414292 -6.6298132 -6.5183445 -0.76237313
|
||||
4900 448 0.44210681 -6.6364174 -6.5155288 -0.78753121
|
||||
5000 450 0.36101771 -6.6232703 -6.5229876 -0.73927083
|
||||
5100 452 0.41481171 -6.6442404 -6.5272305 -0.76316209
|
||||
5200 454 0.40283527 -6.6512252 -6.5358759 -0.79645689
|
||||
5300 456 0.3642061 -6.6530346 -6.5472072 -0.77458364
|
||||
5400 458 0.38449826 -6.6514864 -6.5381518 -0.73083784
|
||||
5500 460 0.42559408 -6.6769326 -6.5497169 -0.78932279
|
||||
5600 462 0.38905756 -6.6698705 -6.5519743 -0.77118812
|
||||
5700 464 0.38354955 -6.6706904 -6.5528977 -0.75067129
|
||||
5800 466 0.36760943 -6.6942519 -6.5798669 -0.685487
|
||||
5900 468 0.30783118 -6.6838159 -6.5867965 -0.79233808
|
||||
6000 470 0.33145368 -6.6733504 -6.5675673 -0.84390449
|
||||
6100 472 0.39252324 -6.6912189 -6.5643973 -0.83342022
|
||||
6200 474 0.32342144 -6.6906083 -6.5848481 -0.71262158
|
||||
6300 476 0.34445238 -6.7008453 -6.5868721 -0.76650756
|
||||
6400 478 0.38152782 -6.7017838 -6.5740758 -0.77113022
|
||||
6500 480 0.37540166 -6.7119996 -6.5849105 -0.79907635
|
||||
6600 482 0.3579419 -6.7034721 -6.5809401 -0.8141269
|
||||
6700 484 0.33538235 -6.6916682 -6.575601 -0.83265486
|
||||
6800 486 0.34081871 -6.6931924 -6.573976 -0.80582583
|
||||
6900 488 0.3555283 -6.6939997 -6.5683263 -0.74771423
|
||||
7000 490 0.3543769 -6.7093364 -6.5827732 -0.77643516
|
||||
7100 492 0.31263107 -6.698361 -6.5855723 -0.73108333
|
||||
7200 494 0.32107 -6.6959056 -6.5789166 -0.7575478
|
||||
7300 496 0.32908165 -6.7137605 -6.592677 -0.86538023
|
||||
7400 498 0.32539571 -6.7030353 -6.5821554 -0.79337428
|
||||
7500 500 0.33902577 -6.7078178 -6.5806832 -0.85408988
|
||||
7600 502 0.35530921 -6.707507 -6.5730274 -0.79914613
|
||||
7700 504 0.32391812 -6.6978823 -6.5741635 -0.78603595
|
||||
7800 506 0.36390015 -6.7151325 -6.5748943 -0.83164222
|
||||
7900 508 0.3372561 -6.7086718 -6.5775535 -0.7949992
|
||||
8000 510 0.36612946 -6.7225238 -6.5789437 -0.80322866
|
||||
8100 512 0.34622305 -6.7229825 -6.5860486 -0.70478659
|
||||
8200 514 0.3212233 -6.7202524 -6.5921381 -0.91836713
|
||||
8300 516 0.3402461 -6.721488 -6.5846642 -0.88273592
|
||||
8400 518 0.34070258 -6.7268378 -6.5887152 -0.76057264
|
||||
8500 520 0.36267747 -6.744602 -6.5963924 -0.81051317
|
||||
8600 522 0.3439948 -6.7376267 -6.595943 -0.84600203
|
||||
8700 524 0.30960289 -6.7276471 -6.5991382 -0.90965986
|
||||
8800 526 0.28868972 -6.7159628 -6.595218 -0.876093
|
||||
8900 528 0.31020216 -6.7162903 -6.5855707 -0.83193125
|
||||
9000 530 0.31836275 -6.7171479 -6.5819939 -0.82093897
|
||||
9100 532 0.32543293 -6.724167 -6.5850016 -0.7690143
|
||||
9200 534 0.32644265 -6.7139575 -6.5733549 -0.86903096
|
||||
9300 536 0.33050759 -6.7254715 -6.5821077 -0.94504522
|
||||
9400 538 0.30372582 -6.7139931 -6.5813247 -0.91128612
|
||||
9500 540 0.32943659 -6.7206223 -6.5757312 -0.87818439
|
||||
9600 542 0.30911968 -6.708091 -6.5712114 -0.79092372
|
||||
9700 544 0.33909826 -6.7222948 -6.5711342 -0.80266151
|
||||
9800 546 0.29015141 -6.7086869 -6.5784908 -0.87763769
|
||||
9900 548 0.33838474 -6.7384955 -6.5856667 -0.85630604
|
||||
10000 550 0.30213198 -6.7338924 -6.5965597 -0.75738882
|
||||
Loop time of 17.2852 on 1 procs for 10000 steps with 550 atoms
|
||||
|
||||
Performance: 249924.414 tau/day, 578.529 timesteps/s
|
||||
99.7% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 9.637 | 9.637 | 9.637 | 0.0 | 55.75
|
||||
Bond | 0.025444 | 0.025444 | 0.025444 | 0.0 | 0.15
|
||||
Neigh | 4.6852 | 4.6852 | 4.6852 | 0.0 | 27.11
|
||||
Comm | 0.65556 | 0.65556 | 0.65556 | 0.0 | 3.79
|
||||
Output | 0.0099883 | 0.0099883 | 0.0099883 | 0.0 | 0.06
|
||||
Modify | 2.1895 | 2.1895 | 2.1895 | 0.0 | 12.67
|
||||
Other | | 0.08248 | | | 0.48
|
||||
|
||||
Nlocal: 550.000 ave 550 max 550 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 2367.00 ave 2367 max 2367 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 36781.0 ave 36781 max 36781 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 36781
|
||||
Ave neighs/atom = 66.874545
|
||||
Ave special neighs/atom = 0.36363636
|
||||
Neighbor list builds = 840
|
||||
Dangerous builds = 0
|
||||
Total wall time: 0:00:17
|
|
@ -0,0 +1,218 @@
|
|||
LAMMPS (10 Mar 2021)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
# sample surface deposition script for molecules
|
||||
|
||||
units lj
|
||||
atom_style bond
|
||||
boundary p p f
|
||||
|
||||
lattice fcc 1.0
|
||||
Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011
|
||||
region box block 0 5 0 5 0 10
|
||||
create_box 3 box bond/types 1 extra/bond/per/atom 1
|
||||
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011)
|
||||
1 by 1 by 4 MPI processor grid
|
||||
|
||||
region substrate block INF INF INF INF INF 3
|
||||
create_atoms 1 region substrate
|
||||
Created 350 atoms
|
||||
create_atoms CPU = 0.139 seconds
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0
|
||||
pair_coeff 1 2 1.0 1.0 5.0
|
||||
mass * 1.0
|
||||
|
||||
bond_style harmonic
|
||||
bond_coeff 1 5.0 1.0
|
||||
|
||||
neigh_modify delay 0
|
||||
|
||||
molecule dimer molecule.dimer
|
||||
Read molecule template dimer:
|
||||
1 molecules
|
||||
2 atoms with max type 3
|
||||
1 bonds with max type 1
|
||||
0 angles with max type 0
|
||||
0 dihedrals with max type 0
|
||||
0 impropers with max type 0
|
||||
region slab block 0 5 0 5 8 9
|
||||
|
||||
group addatoms empty
|
||||
0 atoms in group addatoms
|
||||
region mobile block 0 5 0 5 2 INF
|
||||
group mobile region mobile
|
||||
150 atoms in group mobile
|
||||
|
||||
compute add addatoms temp
|
||||
compute_modify add dynamic/dof yes extra/dof 0
|
||||
|
||||
fix 1 addatoms rigid/small molecule mol dimer
|
||||
create bodies CPU = 0.006 seconds
|
||||
0 rigid bodies with 0 atoms
|
||||
1.0000000 = max distance from body owner to body atom
|
||||
fix 2 mobile langevin 0.1 0.1 0.1 587283
|
||||
fix 3 mobile nve
|
||||
|
||||
fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1
|
||||
fix 5 addatoms wall/reflect zhi EDGE
|
||||
|
||||
thermo_style custom step atoms temp epair etotal press
|
||||
thermo 100
|
||||
thermo_modify temp add lost/bond ignore lost warn
|
||||
WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468)
|
||||
|
||||
#dump 1 all atom 50 dump.deposit.atom
|
||||
|
||||
#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30
|
||||
#dump_modify 2 pad 5
|
||||
|
||||
#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30
|
||||
#dump_modify 3 pad 5
|
||||
|
||||
run 10000
|
||||
WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182)
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5.3
|
||||
ghost atom cutoff = 5.3
|
||||
binsize = 2.65, bins = 3 3 6
|
||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||
(1) pair lj/cut, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/newton
|
||||
stencil: half/bin/3d/newton
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 5.255 | 5.852 | 6.302 Mbytes
|
||||
Step Atoms Temp E_pair TotEng Press
|
||||
0 350 0 -6.9215833 -6.9215833 -1.0052629
|
||||
100 352 1.0079368 -6.8946578 -6.8874992 -0.73775337
|
||||
200 354 1.0081552 -6.8645575 -6.850318 -0.69629729
|
||||
300 356 1.0085803 -6.821677 -6.8004288 -0.69532657
|
||||
400 358 1.0099188 -6.7837923 -6.7555822 -0.68879568
|
||||
500 360 1.0140221 -6.7446709 -6.7094618 -0.72991641
|
||||
600 362 1.026146 -6.7129201 -6.6704003 -0.67063836
|
||||
700 364 1.0683193 -6.6776523 -6.6262908 -0.65572472
|
||||
800 366 1.0958893 -6.6402029 -6.5803182 -0.66307281
|
||||
900 368 1.1231768 -6.6050912 -6.5364187 -0.64076928
|
||||
1000 370 1.1976283 -6.5942507 -6.5133299 -0.69249019
|
||||
1100 372 1.0506263 -6.5772313 -6.499564 -0.63072939
|
||||
1200 374 0.93724351 -6.5732957 -6.4981157 -0.64963897
|
||||
1300 376 0.93899686 -6.5578406 -6.4766773 -0.65096289
|
||||
1400 378 0.8704974 -6.5468498 -6.4662482 -0.67613931
|
||||
1500 380 0.84490693 -6.5401094 -6.4567304 -0.64385968
|
||||
1600 382 0.9243154 -6.5611604 -6.4643734 -0.62096869
|
||||
1700 384 0.67202953 -6.5590557 -6.4846775 -0.67807465
|
||||
1800 386 0.8712464 -6.5654953 -6.4639251 -0.65860236
|
||||
1900 388 0.70011668 -6.5808612 -6.495151 -0.65146463
|
||||
2000 390 0.64019295 -6.5652168 -6.4831408 -0.70291888
|
||||
2100 392 0.67578277 -6.5596196 -6.469113 -0.63315981
|
||||
2200 394 0.60785287 -6.558941 -6.4740885 -0.7133822
|
||||
2300 396 0.8155086 -6.5756022 -6.4571887 -0.69176417
|
||||
2400 398 0.69028748 -6.5875474 -6.483484 -0.63743938
|
||||
2500 400 0.5013913 -6.5871851 -6.5088427 -0.65872179
|
||||
2600 402 0.51268385 -6.5782356 -6.495339 -0.74289067
|
||||
2700 404 0.57745388 -6.5815718 -6.4850912 -0.67922914
|
||||
2800 406 0.47317895 -6.5974978 -6.5159152 -0.64657562
|
||||
2900 408 0.50593124 -6.6019054 -6.5120034 -0.64211427
|
||||
3000 410 0.44423233 -6.5956684 -6.5144064 -0.66526127
|
||||
3100 412 0.40808865 -6.5949863 -6.5182221 -0.62722445
|
||||
3200 414 0.40692632 -6.5866689 -6.5080358 -0.76440608
|
||||
3300 416 0.43908529 -6.5851721 -6.4980939 -0.69345883
|
||||
3400 418 0.53825907 -6.5880076 -6.478553 -0.69726204
|
||||
3500 420 0.46363057 -6.6135193 -6.5169296 -0.58015901
|
||||
3600 422 0.39262699 -6.621857 -6.5381213 -0.74921264
|
||||
3700 424 0.42679205 -6.6146579 -6.5215488 -0.69040431
|
||||
3800 426 0.38997492 -6.6139725 -6.5270063 -0.78237667
|
||||
3900 428 0.5222531 -6.6403886 -6.5214174 -0.78298122
|
||||
4000 430 0.47841128 -6.6502681 -6.5390097 -0.68125967
|
||||
4100 432 0.44609186 -6.6610827 -6.5552392 -0.81157037
|
||||
4200 434 0.4591431 -6.6858064 -6.5747234 -0.79000753
|
||||
4300 436 0.40690573 -6.6800195 -6.579693 -0.6781696
|
||||
4400 438 0.43023944 -6.6849804 -6.5769294 -0.7620548
|
||||
4500 440 0.40889421 -6.6783124 -6.5737656 -0.8577593
|
||||
4600 442 0.41452051 -6.6968565 -6.5890061 -0.70427746
|
||||
4700 444 0.36740394 -6.6920933 -6.5948636 -0.69303162
|
||||
4800 446 0.40112316 -6.6869413 -6.5790158 -0.84792822
|
||||
4900 448 0.42437165 -6.6789835 -6.5629444 -0.82278531
|
||||
5000 450 0.41822898 -6.6770254 -6.5608507 -0.72224472
|
||||
5100 452 0.38445688 -6.6738997 -6.5654522 -0.7022418
|
||||
5200 454 0.39998238 -6.6670536 -6.5525212 -0.73639959
|
||||
5300 456 0.39471029 -6.6728592 -6.5581681 -0.70419927
|
||||
5400 458 0.35817807 -6.6702423 -6.5646658 -0.81657219
|
||||
5500 460 0.37151428 -6.6690855 -6.558035 -0.78076653
|
||||
5600 462 0.32642513 -6.6622352 -6.5633185 -0.69118644
|
||||
5700 464 0.43665879 -6.6811227 -6.5470195 -0.77500043
|
||||
5800 466 0.40704721 -6.6858874 -6.5592311 -0.72683597
|
||||
5900 468 0.3861903 -6.6896953 -6.5679794 -0.78001958
|
||||
6000 470 0.34073346 -6.6833717 -6.574627 -0.78170837
|
||||
6100 472 0.39953874 -6.7083668 -6.5792785 -0.81791744
|
||||
6200 474 0.36685189 -6.7114648 -6.5915027 -0.80545451
|
||||
6300 476 0.35851799 -6.7261023 -6.607475 -0.77350495
|
||||
6400 478 0.41771823 -6.7427425 -6.6029205 -0.85319003
|
||||
6500 480 0.36519478 -6.732662 -6.6090284 -0.78712805
|
||||
6600 482 0.30669571 -6.7269784 -6.6219892 -0.76698134
|
||||
6700 484 0.3384344 -6.7261448 -6.6090213 -0.79935239
|
||||
6800 486 0.36420902 -6.7320259 -6.6046277 -0.84650552
|
||||
6900 488 0.40181215 -6.7490619 -6.6070279 -0.75753238
|
||||
7000 490 0.30536068 -6.7398924 -6.6308351 -0.73210162
|
||||
7100 492 0.28813004 -6.7257287 -6.6217794 -0.92178435
|
||||
7200 494 0.30956277 -6.7342688 -6.6214727 -0.77532949
|
||||
7300 496 0.36625115 -6.7528159 -6.6180561 -0.76247835
|
||||
7400 498 0.30935271 -6.7401433 -6.6252231 -0.82809158
|
||||
7500 500 0.33222282 -6.7410421 -6.6164585 -0.81948236
|
||||
7600 502 0.33318693 -6.7488106 -6.622704 -0.82395904
|
||||
7700 504 0.34570598 -6.7547394 -6.6226989 -0.85644369
|
||||
7800 506 0.34587242 -6.7446006 -6.6113099 -0.82476511
|
||||
7900 508 0.2969166 -6.7305429 -6.6151078 -0.8210214
|
||||
8000 510 0.32355758 -6.7437629 -6.6168776 -0.81719054
|
||||
8100 512 0.33784479 -6.7545537 -6.6209335 -0.78082067
|
||||
8200 514 0.32351289 -6.7525032 -6.6234757 -0.87093587
|
||||
8300 516 0.31900134 -6.7550972 -6.6268166 -0.79928704
|
||||
8400 518 0.3338521 -6.7588757 -6.6235302 -0.81699503
|
||||
8500 520 0.33115184 -6.7614854 -6.6261589 -0.79958489
|
||||
8600 522 0.29478929 -6.7490188 -6.6276018 -0.81954456
|
||||
8700 524 0.267993 -6.7467764 -6.6355389 -0.76642994
|
||||
8800 526 0.28792085 -6.7527118 -6.6322887 -0.86911619
|
||||
8900 528 0.32430992 -6.75901 -6.6223453 -0.87087898
|
||||
9000 530 0.33151321 -6.7534845 -6.6127478 -0.79309499
|
||||
9100 532 0.32760982 -6.7599992 -6.6199028 -0.7506309
|
||||
9200 534 0.32579101 -6.7671489 -6.6268269 -0.94238755
|
||||
9300 536 0.35144354 -6.7782581 -6.625813 -0.77952234
|
||||
9400 538 0.33689976 -6.7804455 -6.6332867 -0.75768501
|
||||
9500 540 0.3052486 -6.7745436 -6.6402908 -0.89621525
|
||||
9600 542 0.30617581 -6.7648172 -6.6292412 -0.90623541
|
||||
9700 544 0.30097715 -6.7714379 -6.6372707 -0.85534149
|
||||
9800 546 0.31297479 -6.7814978 -6.6410604 -0.88651064
|
||||
9900 548 0.31832347 -6.790661 -6.6468926 -1.006
|
||||
10000 550 0.29239559 -6.7823137 -6.6494066 -1.0337518
|
||||
Loop time of 34.7661 on 4 procs for 10000 steps with 550 atoms
|
||||
|
||||
Performance: 124259.065 tau/day, 287.637 timesteps/s
|
||||
73.4% CPU use with 4 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.0076709 | 3.1286 | 9.1834 | 211.7 | 9.00
|
||||
Bond | 0.0040276 | 0.010416 | 0.022169 | 7.0 | 0.03
|
||||
Neigh | 0.052413 | 1.5948 | 4.885 | 155.3 | 4.59
|
||||
Comm | 4.9736 | 12.242 | 20.073 | 166.2 | 35.21
|
||||
Output | 0.053549 | 0.10104 | 0.21642 | 21.0 | 0.29
|
||||
Modify | 13.435 | 16.191 | 23.851 | 110.0 | 46.57
|
||||
Other | | 1.499 | | | 4.31
|
||||
|
||||
Nlocal: 137.500 ave 299 max 2 min
|
||||
Histogram: 2 0 0 0 0 0 0 1 0 1
|
||||
Nghost: 1898.75 ave 2679 max 524 min
|
||||
Histogram: 1 0 0 0 0 0 1 0 0 2
|
||||
Neighs: 9204.00 ave 23014 max 0 min
|
||||
Histogram: 2 0 0 0 0 1 0 0 0 1
|
||||
|
||||
Total # of neighbors = 36816
|
||||
Ave neighs/atom = 66.938182
|
||||
Ave special neighs/atom = 0.36363636
|
||||
Neighbor list builds = 832
|
||||
Dangerous builds = 0
|
||||
Total wall time: 0:00:34
|
|
@ -1,4 +1,4 @@
|
|||
# GCMC for CO2 molecular fluid, rigid/small/nvt dynamics
|
||||
# GCMC for CO2 molecular fluid, rigid/small dynamics
|
||||
# Rigid CO2 TraPPE model
|
||||
# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of
|
||||
# mixtures containing alkanes, carbon dioxide and
|
||||
|
@ -7,7 +7,7 @@
|
|||
# variables available on command line
|
||||
|
||||
variable mu index -8.1
|
||||
variable disp index 0.5
|
||||
variable disp index 0.5
|
||||
variable temp index 338.0
|
||||
variable lbox index 10.0
|
||||
variable spacing index 5.0
|
||||
|
@ -17,7 +17,7 @@ variable spacing index 5.0
|
|||
units real
|
||||
atom_style full
|
||||
boundary p p p
|
||||
pair_style lj/cut/coul/long 14
|
||||
pair_style lj/cut/coul/long 14
|
||||
pair_modify mix arithmetic tail yes
|
||||
kspace_style ewald 0.0001
|
||||
bond_style harmonic
|
||||
|
@ -25,7 +25,7 @@ angle_style harmonic
|
|||
|
||||
# box, start molecules on simple cubic lattice
|
||||
|
||||
lattice sc ${spacing}
|
||||
lattice sc ${spacing}
|
||||
region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} units box
|
||||
create_box 2 box &
|
||||
bond/types 1 &
|
||||
|
@ -34,56 +34,56 @@ create_box 2 box &
|
|||
extra/angle/per/atom 1 &
|
||||
extra/special/per/atom 2
|
||||
molecule co2mol CO2.txt
|
||||
create_atoms 0 box mol co2mol 464563 units box
|
||||
|
||||
# rigid CO2 TraPPE model
|
||||
create_atoms 0 box mol co2mol 464563 units box
|
||||
|
||||
# rigid CO2 TraPPE model
|
||||
|
||||
pair_coeff 1 1 0.053649 2.8
|
||||
pair_coeff 2 2 0.156973 3.05
|
||||
bond_coeff 1 0 1.16
|
||||
angle_coeff 1 0 180
|
||||
pair_coeff 2 2 0.156973 3.05
|
||||
bond_coeff 1 0 1.16
|
||||
angle_coeff 1 0 180
|
||||
|
||||
# masses
|
||||
|
||||
mass 1 12.0107
|
||||
mass 2 15.9994
|
||||
mass 1 12.0107
|
||||
mass 2 15.9994
|
||||
|
||||
# MD settings
|
||||
|
||||
group co2 type 1 2
|
||||
neighbor 2.0 bin
|
||||
neigh_modify every 1 delay 10 check yes
|
||||
velocity all create ${temp} 54654
|
||||
velocity all create ${temp} 54654
|
||||
timestep 1.0
|
||||
|
||||
# rigid constraints with thermostat
|
||||
# rigid constraints with thermostat
|
||||
|
||||
fix myrigidnvt co2 rigid/nvt/small molecule temp ${temp} ${temp} 100 mol co2mol
|
||||
fix myrigid co2 rigid/small molecule mol co2mol
|
||||
|
||||
# dynamically update fix rigid/nvt/small temperature ndof
|
||||
fix_modify myrigidnvt dynamic/dof yes
|
||||
fix_modify myrigid dynamic/dof yes
|
||||
|
||||
# gcmc
|
||||
|
||||
variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans)
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol &
|
||||
co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
||||
co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||
|
||||
# atom counts
|
||||
|
||||
variable carbon atom "type==1"
|
||||
variable carbon atom "type==1"
|
||||
variable oxygen atom "type==2"
|
||||
group carbon dynamic co2 var carbon
|
||||
group oxygen dynamic co2 var oxygen
|
||||
group carbon dynamic co2 var carbon
|
||||
group oxygen dynamic co2 var oxygen
|
||||
variable nC equal count(carbon)
|
||||
variable nO equal count(oxygen)
|
||||
|
||||
# output
|
||||
|
||||
variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1)
|
||||
variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1)
|
||||
variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1)
|
||||
variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1)
|
||||
variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1)
|
||||
variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1)
|
||||
variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1)
|
||||
variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1)
|
||||
|
||||
# dynamically update default temperature ndof
|
||||
compute_modify thermo_temp dynamic/dof yes
|
||||
|
|
|
@ -1,196 +0,0 @@
|
|||
LAMMPS (27 Nov 2018)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
# GCMC for CO2 molecular fluid, rigid/small/nvt dynamics
|
||||
# Rigid CO2 TraPPE model
|
||||
# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of
|
||||
# mixtures containing alkanes, carbon dioxide and
|
||||
# nitrogen AIChE J., 47,1676-1682 (2001)].
|
||||
|
||||
# variables available on command line
|
||||
|
||||
variable mu index -8.1
|
||||
variable disp index 0.5
|
||||
variable temp index 338.0
|
||||
variable lbox index 10.0
|
||||
variable spacing index 5.0
|
||||
|
||||
# global model settings
|
||||
|
||||
units real
|
||||
atom_style full
|
||||
boundary p p p
|
||||
pair_style lj/cut/coul/long 14
|
||||
pair_modify mix arithmetic tail yes
|
||||
kspace_style ewald 0.0001
|
||||
bond_style harmonic
|
||||
angle_style harmonic
|
||||
|
||||
# box, start molecules on simple cubic lattice
|
||||
|
||||
lattice sc ${spacing}
|
||||
lattice sc 5.0
|
||||
Lattice spacing in x,y,z = 5 5 5
|
||||
region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} units box
|
||||
region box block 0 10.0 0 ${lbox} 0 ${lbox} units box
|
||||
region box block 0 10.0 0 10.0 0 ${lbox} units box
|
||||
region box block 0 10.0 0 10.0 0 10.0 units box
|
||||
create_box 2 box bond/types 1 angle/types 1 extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2
|
||||
Created orthogonal box = (0 0 0) to (10 10 10)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
molecule co2mol CO2.txt
|
||||
Read molecule co2mol:
|
||||
3 atoms with max type 2
|
||||
2 bonds with max type 1
|
||||
1 angles with max type 1
|
||||
0 dihedrals with max type 0
|
||||
0 impropers with max type 0
|
||||
create_atoms 0 box mol co2mol 464563 units box
|
||||
Created 24 atoms
|
||||
Time spent = 0.00134993 secs
|
||||
|
||||
# rigid CO2 TraPPE model
|
||||
|
||||
pair_coeff 1 1 0.053649 2.8
|
||||
pair_coeff 2 2 0.156973 3.05
|
||||
bond_coeff 1 0 1.16
|
||||
angle_coeff 1 0 180
|
||||
|
||||
# masses
|
||||
|
||||
mass 1 12.0107
|
||||
mass 2 15.9994
|
||||
|
||||
# MD settings
|
||||
|
||||
group co2 type 1 2
|
||||
24 atoms in group co2
|
||||
neighbor 2.0 bin
|
||||
neigh_modify every 1 delay 10 check yes
|
||||
velocity all create ${temp} 54654
|
||||
velocity all create 338.0 54654
|
||||
timestep 1.0
|
||||
|
||||
# rigid constraints with thermostat
|
||||
|
||||
fix myrigidnvt co2 rigid/nvt/small molecule temp ${temp} ${temp} 100 mol co2mol
|
||||
fix myrigidnvt co2 rigid/nvt/small molecule temp 338.0 ${temp} 100 mol co2mol
|
||||
fix myrigidnvt co2 rigid/nvt/small molecule temp 338.0 338.0 100 mol co2mol
|
||||
8 rigid bodies with 24 atoms
|
||||
1.16 = max distance from body owner to body atom
|
||||
|
||||
# dynamically update fix rigid/nvt/small temperature ndof
|
||||
fix_modify myrigidnvt dynamic/dof yes
|
||||
|
||||
# gcmc
|
||||
|
||||
variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans)
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert 1.66666666666667 group co2 rigid myrigidnvt
|
||||
|
||||
# atom counts
|
||||
|
||||
variable carbon atom "type==1"
|
||||
variable oxygen atom "type==2"
|
||||
group carbon dynamic co2 var carbon
|
||||
dynamic group carbon defined
|
||||
group oxygen dynamic co2 var oxygen
|
||||
dynamic group oxygen defined
|
||||
variable nC equal count(carbon)
|
||||
variable nO equal count(oxygen)
|
||||
|
||||
# output
|
||||
|
||||
variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1)
|
||||
variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1)
|
||||
variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1)
|
||||
variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1)
|
||||
|
||||
# dynamically update default temperature ndof
|
||||
compute_modify thermo_temp dynamic/dof yes
|
||||
|
||||
thermo_style custom step temp press pe ke density atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO
|
||||
thermo 1000
|
||||
|
||||
# run
|
||||
|
||||
run 20000
|
||||
Ewald initialization ...
|
||||
using 12-bit tables for long-range coulomb (src/kspace.cpp:321)
|
||||
G vector (1/distance) = 0.164636
|
||||
estimated absolute RMS force accuracy = 0.0332064
|
||||
estimated relative force accuracy = 0.0001
|
||||
KSpace vectors: actual max1d max3d = 16 2 62
|
||||
kxmax kymax kzmax = 2 2 2
|
||||
WARNING: Fix gcmc using full_energy option (src/MC/fix_gcmc.cpp:487)
|
||||
0 atoms in group FixGCMC:gcmc_exclusion_group:mygcmc
|
||||
0 atoms in group FixGCMC:rotation_gas_atoms:mygcmc
|
||||
WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:471)
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 10 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 16
|
||||
ghost atom cutoff = 16
|
||||
binsize = 8, bins = 2 2 2
|
||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||
(1) pair lj/cut/coul/long, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/newton
|
||||
stencil: half/bin/3d/newton
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 15.62 | 15.62 | 15.62 Mbytes
|
||||
Step Temp Press PotEng KinEng Density Atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO
|
||||
0 364.27579 4238.8631 -9.6809388 13.391989 0.5846359 24 0 0 0 0 8 16
|
||||
1000 267.9799 -73.919548 -3.6735999 5.8578459 0.36539744 15 0.23663972 0.2494423 0 0 5 10
|
||||
2000 409.06596 -98.033864 -6.7570039 10.974131 0.43847693 18 0.29379544 0.29816284 0 0 6 12
|
||||
3000 279.3225 -836.47758 -26.434976 15.819539 0.87695385 36 0.23798567 0.24203908 0 0 12 24
|
||||
4000 333.6181 606.63478 -30.35312 18.894592 0.87695385 36 0.19121778 0.19481508 0 0 12 24
|
||||
5000 405.98741 -103.97582 -14.180277 16.942399 0.65771539 27 0.15272841 0.15982952 0 0 9 18
|
||||
6000 283.5835 -240.01076 -6.7198093 7.607777 0.43847693 18 0.1606796 0.16536735 0 0 6 12
|
||||
7000 142.00717 154.95914 -0.74192319 0.98769159 0.14615898 6 0.19501993 0.20103405 0 0 2 4
|
||||
8000 376.67702 -118.12474 -10.774631 13.847899 0.5846359 24 0.20133396 0.20468352 0 0 8 16
|
||||
9000 305.43166 -1095.8633 -10.388279 9.7112935 0.51155641 21 0.19445239 0.19869334 0 0 7 14
|
||||
10000 244.08225 -179.31274 -12.974988 8.9732748 0.5846359 24 0.19098971 0.19586397 0 0 8 16
|
||||
11000 305.03389 -568.94714 -21.745425 14.244887 0.73079488 30 0.18517522 0.18978828 0 0 10 20
|
||||
12000 318.29735 767.76579 -37.184231 21.189508 1.0231128 42 0.17256426 0.17580267 0 0 14 28
|
||||
13000 411.21707 433.01125 -4.5149215 8.9889065 0.36539744 15 0.16329385 0.16767604 0 0 5 10
|
||||
14000 304.29535 148.28607 -2.3505844 6.6516754 0.36539744 15 0.17435868 0.17897674 0 0 5 10
|
||||
15000 338.00555 2384.1424 -21.438264 17.463859 0.80387436 33 0.17237066 0.17634112 0 0 11 22
|
||||
16000 613.56062 610.93867 -0.057364228 1.2192718 0.073079488 3 0.17128158 0.1758886 0 0 1 2
|
||||
17000 432.63323 -980.52384 -15.79844 18.054365 0.65771539 27 0.17145651 0.17504846 0 0 9 18
|
||||
18000 181.74572 -352.81765 -1.8617959 2.1669979 0.21923846 9 0.17292463 0.17654774 0 0 3 6
|
||||
19000 208.55292 -248.38735 -4.2287767 4.5588154 0.36539744 15 0.18168324 0.18454331 0 0 5 10
|
||||
20000 304.73317 -649.9896 -16.532405 12.716924 0.65771539 27 0.18085983 0.18345574 0 0 9 18
|
||||
Loop time of 21.0434 on 1 procs for 20000 steps with 27 atoms
|
||||
|
||||
Performance: 82.116 ns/day, 0.292 hours/ns, 950.415 timesteps/s
|
||||
98.5% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 2.2373 | 2.2373 | 2.2373 | 0.0 | 10.63
|
||||
Bond | 0.022895 | 0.022895 | 0.022895 | 0.0 | 0.11
|
||||
Kspace | 0.16756 | 0.16756 | 0.16756 | 0.0 | 0.80
|
||||
Neigh | 0.11436 | 0.11436 | 0.11436 | 0.0 | 0.54
|
||||
Comm | 0.26988 | 0.26988 | 0.26988 | 0.0 | 1.28
|
||||
Output | 0.0014684 | 0.0014684 | 0.0014684 | 0.0 | 0.01
|
||||
Modify | 18.193 | 18.193 | 18.193 | 0.0 | 86.45
|
||||
Other | | 0.03692 | | | 0.18
|
||||
|
||||
Nlocal: 27 ave 27 max 27 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 2081 ave 2081 max 2081 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 6264 ave 6264 max 6264 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 6264
|
||||
Ave neighs/atom = 232
|
||||
Ave special neighs/atom = 2
|
||||
Neighbor list builds = 20177
|
||||
Dangerous builds = 0
|
||||
|
||||
Total wall time: 0:00:21
|
|
@ -0,0 +1,196 @@
|
|||
LAMMPS (10 Mar 2021)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
# GCMC for CO2 molecular fluid, rigid/small dynamics
|
||||
# Rigid CO2 TraPPE model
|
||||
# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of
|
||||
# mixtures containing alkanes, carbon dioxide and
|
||||
# nitrogen AIChE J., 47,1676-1682 (2001)].
|
||||
|
||||
# variables available on command line
|
||||
|
||||
variable mu index -8.1
|
||||
variable disp index 0.5
|
||||
variable temp index 338.0
|
||||
variable lbox index 10.0
|
||||
variable spacing index 5.0
|
||||
|
||||
# global model settings
|
||||
|
||||
units real
|
||||
atom_style full
|
||||
boundary p p p
|
||||
pair_style lj/cut/coul/long 14
|
||||
pair_modify mix arithmetic tail yes
|
||||
kspace_style ewald 0.0001
|
||||
bond_style harmonic
|
||||
angle_style harmonic
|
||||
|
||||
# box, start molecules on simple cubic lattice
|
||||
|
||||
lattice sc ${spacing}
|
||||
lattice sc 5.0
|
||||
Lattice spacing in x,y,z = 5.0000000 5.0000000 5.0000000
|
||||
region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} units box
|
||||
region box block 0 10.0 0 ${lbox} 0 ${lbox} units box
|
||||
region box block 0 10.0 0 10.0 0 ${lbox} units box
|
||||
region box block 0 10.0 0 10.0 0 10.0 units box
|
||||
create_box 2 box bond/types 1 angle/types 1 extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2
|
||||
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (10.000000 10.000000 10.000000)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
molecule co2mol CO2.txt
|
||||
Read molecule template co2mol:
|
||||
1 molecules
|
||||
3 atoms with max type 2
|
||||
2 bonds with max type 1
|
||||
1 angles with max type 1
|
||||
0 dihedrals with max type 0
|
||||
0 impropers with max type 0
|
||||
create_atoms 0 box mol co2mol 464563 units box
|
||||
Created 24 atoms
|
||||
create_atoms CPU = 0.002 seconds
|
||||
|
||||
# rigid CO2 TraPPE model
|
||||
|
||||
pair_coeff 1 1 0.053649 2.8
|
||||
pair_coeff 2 2 0.156973 3.05
|
||||
bond_coeff 1 0 1.16
|
||||
angle_coeff 1 0 180
|
||||
|
||||
# masses
|
||||
|
||||
mass 1 12.0107
|
||||
mass 2 15.9994
|
||||
|
||||
# MD settings
|
||||
|
||||
group co2 type 1 2
|
||||
24 atoms in group co2
|
||||
neighbor 2.0 bin
|
||||
neigh_modify every 1 delay 10 check yes
|
||||
velocity all create ${temp} 54654
|
||||
velocity all create 338.0 54654
|
||||
timestep 1.0
|
||||
|
||||
# rigid constraints with thermostat
|
||||
|
||||
fix myrigid co2 rigid/small molecule mol co2mol
|
||||
create bodies CPU = 0.000 seconds
|
||||
8 rigid bodies with 24 atoms
|
||||
1.1600000 = max distance from body owner to body atom
|
||||
|
||||
# dynamically update fix rigid/nvt/small temperature ndof
|
||||
fix_modify myrigid dynamic/dof yes
|
||||
|
||||
# gcmc
|
||||
|
||||
variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans)
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert ${tfac} group co2 rigid myrigid
|
||||
fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert 1.66666666666667 group co2 rigid myrigid
|
||||
|
||||
# atom counts
|
||||
|
||||
variable carbon atom "type==1"
|
||||
variable oxygen atom "type==2"
|
||||
group carbon dynamic co2 var carbon
|
||||
dynamic group carbon defined
|
||||
group oxygen dynamic co2 var oxygen
|
||||
dynamic group oxygen defined
|
||||
variable nC equal count(carbon)
|
||||
variable nO equal count(oxygen)
|
||||
|
||||
# output
|
||||
|
||||
variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1)
|
||||
variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1)
|
||||
variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1)
|
||||
variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1)
|
||||
|
||||
# dynamically update default temperature ndof
|
||||
compute_modify thermo_temp dynamic/dof yes
|
||||
|
||||
thermo_style custom step temp press pe ke density atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO
|
||||
thermo 1000
|
||||
|
||||
# run
|
||||
|
||||
run 20000
|
||||
Ewald initialization ...
|
||||
using 12-bit tables for long-range coulomb (src/kspace.cpp:339)
|
||||
G vector (1/distance) = 0.16463644
|
||||
estimated absolute RMS force accuracy = 0.033206372
|
||||
estimated relative force accuracy = 0.0001
|
||||
KSpace vectors: actual max1d max3d = 16 2 62
|
||||
kxmax kymax kzmax = 2 2 2
|
||||
WARNING: Fix gcmc using full_energy option (src/MC/fix_gcmc.cpp:482)
|
||||
0 atoms in group FixGCMC:gcmc_exclusion_group:mygcmc
|
||||
0 atoms in group FixGCMC:rotation_gas_atoms:mygcmc
|
||||
WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:486)
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 10 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 16
|
||||
ghost atom cutoff = 16
|
||||
binsize = 8, bins = 2 2 2
|
||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||
(1) pair lj/cut/coul/long, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/newton
|
||||
stencil: half/bin/3d/newton
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 15.62 | 15.62 | 15.62 Mbytes
|
||||
Step Temp Press PotEng KinEng Density Atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO
|
||||
0 364.27579 4238.8631 -9.6809388 13.391989 0.5846359 24 0 0 0 0 8 16
|
||||
1000 261.50949 -204.60974 -9.6459249 8.3147747 0.51155641 21 0.096366192 0.097590121 0 0 7 14
|
||||
2000 479.39697 231.28436 -7.0089345 10.47927 0.36539744 15 0.085531005 0.085453295 0 0 5 10
|
||||
3000 318.31766 -433.17133 -7.3680951 8.5396005 0.43847693 18 0.078556687 0.080101462 0 0 6 12
|
||||
4000 357.40776 -186.78 -16.453111 14.915105 0.65771539 27 0.082003877 0.08249082 0 0 9 18
|
||||
5000 399.94731 1524.2909 -16.624678 18.677282 0.73079488 30 0.071285101 0.072731705 0 0 10 20
|
||||
6000 354.71736 60.134827 -18.988979 16.565073 0.73079488 30 0.071615663 0.071713414 0 0 10 20
|
||||
7000 483.32057 966.32174 -5.7393251 10.565037 0.36539744 15 0.087027775 0.089855826 0 0 5 10
|
||||
8000 547.68562 494.96891 -4.125626 11.97201 0.36539744 15 0.11738082 0.11937373 0 0 5 10
|
||||
9000 433.76488 390.91467 -0.85312985 5.1718828 0.21923846 9 0.13265238 0.13513212 0 0 3 6
|
||||
10000 330.01685 -862.07457 -26.494645 18.690633 0.87695385 36 0.13775034 0.13905403 0 0 12 24
|
||||
11000 334.26318 -578.48274 -13.236965 12.288625 0.5846359 24 0.13713936 0.13960485 0 0 8 16
|
||||
12000 243.68657 -1244.7156 -25.757644 12.590645 0.80387436 33 0.1339588 0.13588739 0 0 11 22
|
||||
13000 307.66758 -429.66928 -17.864639 14.367878 0.73079488 30 0.12604721 0.1278094 0 0 10 20
|
||||
14000 330.91434 495.97112 -15.374248 13.809499 0.65771539 27 0.12011756 0.12145865 0 0 9 18
|
||||
15000 564.87966 982.72332 -14.810525 26.379517 0.73079488 30 0.12164324 0.12343521 0 0 10 20
|
||||
16000 342.63867 -54.776299 -2.2580523 5.7875978 0.29231795 12 0.13535812 0.13790758 0 0 4 8
|
||||
17000 461.07005 -2.4317694 -1.145154 3.2068452 0.14615898 6 0.1444739 0.14730804 0 0 2 4
|
||||
18000 197.21207 -40.124433 -7.0857418 5.2906654 0.43847693 18 0.14403997 0.14574329 0 0 6 12
|
||||
19000 393.36395 -420.49802 -11.172739 14.461366 0.5846359 24 0.15005606 0.15142063 0 0 8 16
|
||||
20000 356.48539 56.071962 -1.7861789 4.2504609 0.21923846 9 0.15422732 0.15627984 0 0 3 6
|
||||
Loop time of 19.5982 on 1 procs for 20000 steps with 9 atoms
|
||||
|
||||
Performance: 88.171 ns/day, 0.272 hours/ns, 1020.502 timesteps/s
|
||||
99.5% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 2.3404 | 2.3404 | 2.3404 | 0.0 | 11.94
|
||||
Bond | 0.033919 | 0.033919 | 0.033919 | 0.0 | 0.17
|
||||
Kspace | 0.19974 | 0.19974 | 0.19974 | 0.0 | 1.02
|
||||
Neigh | 0.11478 | 0.11478 | 0.11478 | 0.0 | 0.59
|
||||
Comm | 0.22538 | 0.22538 | 0.22538 | 0.0 | 1.15
|
||||
Output | 0.00096536 | 0.00096536 | 0.00096536 | 0.0 | 0.00
|
||||
Modify | 16.627 | 16.627 | 16.627 | 0.0 | 84.84
|
||||
Other | | 0.05594 | | | 0.29
|
||||
|
||||
Nlocal: 9.00000 ave 9 max 9 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 703.000 ave 703 max 703 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 719.000 ave 719 max 719 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 719
|
||||
Ave neighs/atom = 79.888889
|
||||
Ave special neighs/atom = 2.0000000
|
||||
Neighbor list builds = 20196
|
||||
Dangerous builds = 0
|
||||
|
||||
Total wall time: 0:00:19
|
|
@ -0,0 +1 @@
|
|||
/build*
|
|
@ -0,0 +1,68 @@
|
|||
##########################################
|
||||
# CMake build system for plugin examples.
|
||||
# The is meant to be used as a template for plugins that are
|
||||
# distributed independent from the LAMMPS package.
|
||||
##########################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# enforce out-of-source build
|
||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||
message(FATAL_ERROR "In-source builds are not allowed. You must create and use a build directory. "
|
||||
"Please remove CMakeCache.txt and CMakeFiles first.")
|
||||
endif()
|
||||
|
||||
project(plugins VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# NOTE: the next line should be commented out when used outside of the LAMMPS package
|
||||
get_filename_component(LAMMPS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../src ABSOLUTE)
|
||||
set(LAMMPS_HEADER_DIR ${LAMMPS_SOURCE_DIR} CACHE PATH "Location of LAMMPS headers")
|
||||
if(NOT LAMMPS_HEADER_DIR)
|
||||
message(FATAL_ERROR "Must set LAMMPS_HEADER_DIR")
|
||||
endif()
|
||||
|
||||
# by default, install into $HOME/.local (not /usr/local),
|
||||
# so that no root access (and sudo) is needed
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE)
|
||||
endif()
|
||||
|
||||
# C++11 is required
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# bail out on windows
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
message(FATAL_ERROR "LAMMPS plugins are currently not supported on Windows")
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
|
||||
include(CheckIncludeFileCXX)
|
||||
include(LAMMPSInterfaceCXX)
|
||||
|
||||
##########################
|
||||
# building the plugins
|
||||
|
||||
add_library(morse2plugin MODULE morse2plugin.cpp pair_morse2.cpp pair_morse2_omp.cpp)
|
||||
target_include_directories(morse2plugin PRIVATE "${LAMMPS_HEADER_DIR}/USER-OMP")
|
||||
target_link_libraries(morse2plugin PRIVATE lammps)
|
||||
|
||||
add_library(nve2plugin MODULE nve2plugin.cpp fix_nve2.cpp)
|
||||
target_link_libraries(nve2plugin PRIVATE lammps)
|
||||
|
||||
add_library(helloplugin MODULE helloplugin.cpp)
|
||||
target_link_libraries(helloplugin PRIVATE lammps)
|
||||
|
||||
add_library(zero2plugin MODULE zero2plugin.cpp pair_zero2.cpp bond_zero2.cpp
|
||||
angle_zero2.cpp dihedral_zero2.cpp improper_zero2.cpp)
|
||||
target_link_libraries(zero2plugin PRIVATE lammps)
|
||||
|
||||
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
|
||||
PREFIX ""
|
||||
LINK_FLAGS "-rdynamic")
|
||||
|
||||
# MacOS seems to need this
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
|
||||
LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
|
||||
endif()
|
|
@ -0,0 +1,86 @@
|
|||
# Cmake script code to define the LAMMPS C++ interface
|
||||
# settings required for building LAMMPS plugins
|
||||
|
||||
################################################################################
|
||||
# helper function
|
||||
function(validate_option name values)
|
||||
string(TOLOWER ${${name}} needle_lower)
|
||||
string(TOUPPER ${${name}} needle_upper)
|
||||
list(FIND ${values} ${needle_lower} IDX_LOWER)
|
||||
list(FIND ${values} ${needle_upper} IDX_UPPER)
|
||||
if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0)
|
||||
list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}})
|
||||
message(FATAL_ERROR "\n########################################################################\n"
|
||||
"Invalid value '${${name}}' for option ${name}\n"
|
||||
"\n"
|
||||
"Possible values are:\n"
|
||||
"${POSSIBLE_VALUE_LIST}"
|
||||
"########################################################################")
|
||||
endif()
|
||||
endfunction(validate_option)
|
||||
|
||||
#################################################################################
|
||||
# LAMMPS C++ interface. We only need the header related parts.
|
||||
add_library(lammps INTERFACE)
|
||||
target_include_directories(lammps INTERFACE ${LAMMPS_HEADER_DIR})
|
||||
|
||||
################################################################################
|
||||
# MPI configuration
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
find_package(MPI QUIET)
|
||||
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
||||
else()
|
||||
option(BUILD_MPI "Build MPI version" OFF)
|
||||
endif()
|
||||
|
||||
if(BUILD_MPI)
|
||||
find_package(MPI REQUIRED)
|
||||
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
||||
if(LAMMPS_LONGLONG_TO_LONG)
|
||||
target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG)
|
||||
endif()
|
||||
target_link_libraries(lammps INTERFACE MPI::MPI_CXX)
|
||||
else()
|
||||
target_include_directories(lammps INTERFACE "${LAMMPS_SOURCE_DIR}/STUBS")
|
||||
endif()
|
||||
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
|
||||
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
|
||||
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
|
||||
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
||||
target_compile_definitions(lammps INTERFACE -DLAMMPS_${LAMMPS_SIZES})
|
||||
|
||||
################################################################################
|
||||
# detect if we may enable OpenMP support by default
|
||||
set(BUILD_OMP_DEFAULT OFF)
|
||||
find_package(OpenMP QUIET)
|
||||
if(OpenMP_FOUND)
|
||||
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
||||
if(HAVE_OMP_H_INCLUDE)
|
||||
set(BUILD_OMP_DEFAULT ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
|
||||
|
||||
if(BUILD_OMP)
|
||||
find_package(OpenMP REQUIRED)
|
||||
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
||||
if(NOT HAVE_OMP_H_INCLUDE)
|
||||
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
|
||||
endif()
|
||||
|
||||
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR
|
||||
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
||||
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
|
||||
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
|
||||
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
|
||||
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=4)
|
||||
else()
|
||||
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=3)
|
||||
endif()
|
||||
target_link_libraries(lammps INTERFACE OpenMP::OpenMP_CXX)
|
||||
endif()
|
|
@ -0,0 +1,6 @@
|
|||
CXX=mpicxx
|
||||
CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp
|
||||
LD=$(CXX) -shared -rdynamic -fopenmp
|
||||
DSOEXT=.so
|
||||
|
||||
include Makefile.common
|
|
@ -0,0 +1,36 @@
|
|||
default: morse2plugin$(DSOEXT) nve2plugin$(DSOEXT) helloplugin$(DSOEXT) zero2plugin$(DSOEXT)
|
||||
|
||||
helloplugin$(DSOEXT): helloplugin.o
|
||||
$(LD) -o $@ $^
|
||||
|
||||
morse2plugin$(DSOEXT): morse2plugin.o pair_morse2.o pair_morse2_omp.o
|
||||
$(LD) -o $@ $^
|
||||
|
||||
nve2plugin$(DSOEXT): nve2plugin.o fix_nve2.o
|
||||
$(LD) -o $@ $^
|
||||
|
||||
zero2plugin$(DSOEXT): zero2plugin.o pair_zero2.o bond_zero2.o angle_zero2.o dihedral_zero2.o improper_zero2.o
|
||||
$(LD) -o $@ $^
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) -o $@ $(CXXFLAGS) -c $<
|
||||
|
||||
helloplugin.o: helloplugin.cpp
|
||||
|
||||
pair_morse2.o: pair_morse2.cpp pair_morse2.h
|
||||
pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h
|
||||
morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h
|
||||
|
||||
fix_nve2.o: fix_nve2.cpp fix_nve2.h
|
||||
nve2plugin.o: nve2plugin.cpp fix_nve2.h
|
||||
|
||||
pair_zero2.o: pair_zero2.cpp pair_zero2.h
|
||||
bond_zero2.o: bond_zero2.cpp bond_zero2.h
|
||||
angle_zero2.o: angle_zero2.cpp angle_zero2.h
|
||||
dihedral_zero2.o: dihedral_zero2.cpp dihedral_zero2.h
|
||||
improper_zero2.o: improper_zero2.cpp improper_zero2.h
|
||||
zero2plugin.o: zero2plugin.cpp pair_zero2.h bond_zero2.h angle_zero2.h dihedral_zero2.h
|
||||
|
||||
clean:
|
||||
rm -rf *~ *.so *.dylib *.o log.lammps CMakeCache.txt CMakeFiles
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
CXX=mpicxx
|
||||
CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP
|
||||
LD=$(CXX) -bundle -rdynamic -Wl,-undefined,dynamic_lookup
|
||||
DSOEXT=.dylib
|
||||
|
||||
include Makefile.common
|
|
@ -0,0 +1,6 @@
|
|||
CXX=g++
|
||||
CXXFLAGS=-I../../src -I../../src/STUBS -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp
|
||||
LD=$(CXX) -shared -rdynamic -fopenmp
|
||||
DSOEXT=.so
|
||||
|
||||
include Makefile.common
|
|
@ -0,0 +1,152 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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: Carsten Svaneborg (SDU)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "angle_zero2.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleZero2::AngleZero2(LAMMPS *lmp) : Angle(lmp), coeffflag(1) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleZero2::~AngleZero2()
|
||||
{
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(theta0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleZero2::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleZero2::settings(int narg, char **arg)
|
||||
{
|
||||
if ((narg != 0) && (narg != 1))
|
||||
error->all(FLERR,"Illegal angle_style command");
|
||||
|
||||
if (narg == 1) {
|
||||
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||
else error->all(FLERR,"Illegal angle_style command");
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AngleZero2::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->nangletypes;
|
||||
|
||||
memory->create(theta0,n+1,"angle:theta0");
|
||||
memory->create(setflag,n+1,"angle:setflag");
|
||||
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more types
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleZero2::coeff(int narg, char **arg)
|
||||
{
|
||||
if ((narg < 1) || (coeffflag && narg > 2))
|
||||
error->all(FLERR,"Incorrect args for angle coefficients");
|
||||
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error);
|
||||
|
||||
double theta0_one = 0.0;
|
||||
if (coeffflag && (narg == 2))
|
||||
theta0_one = utils::numeric(FLERR,arg[1],false,lmp);
|
||||
|
||||
// convert theta0 from degrees to radians
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
setflag[i] = 1;
|
||||
theta0[i] = theta0_one/180.0 * MY_PI;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for angle coefficients");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double AngleZero2::equilibrium_angle(int i)
|
||||
{
|
||||
return theta0[i];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes out coeffs to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleZero2::write_restart(FILE *fp) {
|
||||
fwrite(&theta0[1],sizeof(double),atom->nangletypes,fp);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleZero2::read_restart(FILE *fp)
|
||||
{
|
||||
allocate();
|
||||
|
||||
if (comm->me == 0) {
|
||||
utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world);
|
||||
|
||||
for (int i = 1; i <= atom->nangletypes; i++) setflag[i] = 1;
|
||||
}
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AngleZero2::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->nangletypes; i++)
|
||||
fprintf(fp,"%d %g\n",i,theta0[i]/MY_PI*180.0);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double AngleZero2::single(int /*type*/, int /*i1*/, int /*i2*/, int /*i3*/)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_ANGLE_ZERO2_H
|
||||
#define LMP_ANGLE_ZERO2_H
|
||||
|
||||
#include "angle.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class AngleZero2 : public Angle {
|
||||
public:
|
||||
AngleZero2(class LAMMPS *);
|
||||
virtual ~AngleZero2();
|
||||
virtual void compute(int, int);
|
||||
virtual void coeff(int, char **);
|
||||
virtual void settings(int, char **);
|
||||
|
||||
double equilibrium_angle(int);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
double single(int, int, int, int);
|
||||
|
||||
protected:
|
||||
double *theta0;
|
||||
int coeffflag;
|
||||
|
||||
void allocate();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
E: Incorrect args for angle coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
*/
|
|
@ -0,0 +1,161 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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: Carsten Svaneborg (SDU)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "bond_zero2.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
BondZero2::BondZero2(LAMMPS *lmp) : Bond(lmp), coeffflag(1) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
BondZero2::~BondZero2()
|
||||
{
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(r0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void BondZero2::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void BondZero2::settings(int narg, char **arg)
|
||||
{
|
||||
if ((narg != 0) && (narg != 1))
|
||||
error->all(FLERR,"Illegal bond_style command");
|
||||
|
||||
if (narg == 1) {
|
||||
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||
else error->all(FLERR,"Illegal bond_style command");
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void BondZero2::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->nbondtypes;
|
||||
|
||||
memory->create(r0,n+1,"bond:r0");
|
||||
memory->create(setflag,n+1,"bond:setflag");
|
||||
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more types
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void BondZero2::coeff(int narg, char **arg)
|
||||
{
|
||||
if ((narg < 1) || (coeffflag && narg > 2))
|
||||
error->all(FLERR,"Incorrect args for bond coefficients");
|
||||
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error);
|
||||
|
||||
double r0_one = 0.0;
|
||||
if (coeffflag && (narg == 2))
|
||||
r0_one = utils::numeric(FLERR,arg[1],false,lmp);
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
setflag[i] = 1;
|
||||
r0[i] = r0_one;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for bond coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return an equilbrium bond length
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double BondZero2::equilibrium_distance(int i)
|
||||
{
|
||||
return r0[i];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes out coeffs to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void BondZero2::write_restart(FILE *fp) {
|
||||
fwrite(&r0[1],sizeof(double),atom->nbondtypes,fp);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void BondZero2::read_restart(FILE *fp)
|
||||
{
|
||||
allocate();
|
||||
|
||||
if (comm->me == 0) {
|
||||
utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world);
|
||||
|
||||
for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void BondZero2::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->nbondtypes; i++)
|
||||
fprintf(fp,"%d %g\n",i,r0[i]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double BondZero2::single(int /*type*/, double /*rsq*/, int /*i*/, int /*j*/,
|
||||
double & /*fforce*/)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *BondZero2::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 1;
|
||||
if (strcmp(str,"r0")==0) return (void*) r0;
|
||||
return nullptr;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_BOND_ZERO2_H
|
||||
#define LMP_BOND_ZERO2_H
|
||||
|
||||
#include "bond.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class BondZero2 : public Bond {
|
||||
public:
|
||||
BondZero2(class LAMMPS *);
|
||||
virtual ~BondZero2();
|
||||
virtual void compute(int, int);
|
||||
virtual void settings(int, char **);
|
||||
|
||||
void coeff(int, char **);
|
||||
double equilibrium_distance(int);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
double single(int, double, int, int, double &);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
double *r0;
|
||||
int coeffflag;
|
||||
|
||||
virtual void allocate();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
E: Incorrect args for bond coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
*/
|
|
@ -0,0 +1,121 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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: Carsten Svaneborg (SDU)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "dihedral_zero2.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
DihedralZero2::DihedralZero2(LAMMPS *lmp) : Dihedral(lmp), coeffflag(1)
|
||||
{
|
||||
writedata = 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
DihedralZero2::~DihedralZero2()
|
||||
{
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero2::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero2::settings(int narg, char **arg)
|
||||
{
|
||||
if ((narg != 0) && (narg != 1))
|
||||
error->all(FLERR,"Illegal dihedral_style command");
|
||||
|
||||
if (narg == 1) {
|
||||
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||
else error->all(FLERR,"Illegal dihedral_style command");
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero2::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->ndihedraltypes;
|
||||
|
||||
memory->create(setflag,n+1,"dihedral:setflag");
|
||||
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more types
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero2::coeff(int narg, char **arg)
|
||||
{
|
||||
if ((narg < 1) || (coeffflag && narg > 1))
|
||||
error->all(FLERR,"Incorrect args for dihedral coefficients");
|
||||
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error);
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
setflag[i] = 1;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for dihedral coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes out coeffs to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero2::write_restart(FILE * /*fp*/) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero2::read_restart(FILE * /*fp*/)
|
||||
{
|
||||
allocate();
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralZero2::write_data(FILE *fp) {
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++)
|
||||
fprintf(fp,"%d\n",i);
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
|
||||
Identical to dihedral harmonic, except if all k's are zero the
|
||||
force loop is skipped.
|
||||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_DIHEDRAL_ZERO2_H
|
||||
#define LMP_DIHEDRAL_ZERO2_H
|
||||
|
||||
#include "dihedral.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class DihedralZero2 : public Dihedral {
|
||||
public:
|
||||
DihedralZero2(class LAMMPS *);
|
||||
virtual ~DihedralZero2();
|
||||
virtual void compute(int, int);
|
||||
virtual void coeff(int, char **);
|
||||
virtual void settings(int, char **);
|
||||
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
int coeffflag;
|
||||
|
||||
virtual void allocate();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
E: Incorrect args for dihedral coefficients
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
|
@ -0,0 +1,171 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_nve2.h"
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "update.h"
|
||||
#include "respa.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixNVE2::FixNVE2(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
{
|
||||
if (strcmp(style,"nve/sphere") != 0 && narg < 3)
|
||||
error->all(FLERR,"Illegal fix nve command");
|
||||
|
||||
dynamic_group_allow = 1;
|
||||
time_integrate = 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int FixNVE2::setmask()
|
||||
{
|
||||
int mask = 0;
|
||||
mask |= INITIAL_INTEGRATE;
|
||||
mask |= FINAL_INTEGRATE;
|
||||
mask |= INITIAL_INTEGRATE_RESPA;
|
||||
mask |= FINAL_INTEGRATE_RESPA;
|
||||
return mask;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVE2::init()
|
||||
{
|
||||
dtv = update->dt;
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
|
||||
if (strstr(update->integrate_style,"respa"))
|
||||
step_respa = ((Respa *) update->integrate)->step;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allow for both per-type and per-atom mass
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixNVE2::initial_integrate(int /*vflag*/)
|
||||
{
|
||||
double dtfm;
|
||||
|
||||
// update v and x of atoms in group
|
||||
|
||||
double **x = atom->x;
|
||||
double **v = atom->v;
|
||||
double **f = atom->f;
|
||||
double *rmass = atom->rmass;
|
||||
double *mass = atom->mass;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||
|
||||
if (rmass) {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
dtfm = dtf / rmass[i];
|
||||
v[i][0] += dtfm * f[i][0];
|
||||
v[i][1] += dtfm * f[i][1];
|
||||
v[i][2] += dtfm * f[i][2];
|
||||
x[i][0] += dtv * v[i][0];
|
||||
x[i][1] += dtv * v[i][1];
|
||||
x[i][2] += dtv * v[i][2];
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
dtfm = dtf / mass[type[i]];
|
||||
v[i][0] += dtfm * f[i][0];
|
||||
v[i][1] += dtfm * f[i][1];
|
||||
v[i][2] += dtfm * f[i][2];
|
||||
x[i][0] += dtv * v[i][0];
|
||||
x[i][1] += dtv * v[i][1];
|
||||
x[i][2] += dtv * v[i][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVE2::final_integrate()
|
||||
{
|
||||
double dtfm;
|
||||
|
||||
// update v of atoms in group
|
||||
|
||||
double **v = atom->v;
|
||||
double **f = atom->f;
|
||||
double *rmass = atom->rmass;
|
||||
double *mass = atom->mass;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||
|
||||
if (rmass) {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
dtfm = dtf / rmass[i];
|
||||
v[i][0] += dtfm * f[i][0];
|
||||
v[i][1] += dtfm * f[i][1];
|
||||
v[i][2] += dtfm * f[i][2];
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
dtfm = dtf / mass[type[i]];
|
||||
v[i][0] += dtfm * f[i][0];
|
||||
v[i][1] += dtfm * f[i][1];
|
||||
v[i][2] += dtfm * f[i][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVE2::initial_integrate_respa(int vflag, int ilevel, int /*iloop*/)
|
||||
{
|
||||
dtv = step_respa[ilevel];
|
||||
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
|
||||
|
||||
// innermost level - NVE update of v and x
|
||||
// all other levels - NVE update of v
|
||||
|
||||
if (ilevel == 0) initial_integrate(vflag);
|
||||
else final_integrate();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVE2::final_integrate_respa(int ilevel, int /*iloop*/)
|
||||
{
|
||||
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
|
||||
final_integrate();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVE2::reset_dt()
|
||||
{
|
||||
dtv = update->dt;
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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 FIX_CLASS
|
||||
|
||||
FixStyle(nve2,FixNVE2)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_NVE2_H
|
||||
#define LMP_FIX_NVE2_H
|
||||
|
||||
#include "fix.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixNVE2 : public Fix {
|
||||
public:
|
||||
FixNVE2(class LAMMPS *, int, char **);
|
||||
virtual ~FixNVE2() {}
|
||||
int setmask();
|
||||
virtual void init();
|
||||
virtual void initial_integrate(int);
|
||||
virtual void final_integrate();
|
||||
virtual void initial_integrate_respa(int, int, int);
|
||||
virtual void final_integrate_respa(int, int);
|
||||
virtual void reset_dt();
|
||||
|
||||
protected:
|
||||
double dtv,dtf;
|
||||
double *step_respa;
|
||||
int mass_require;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
*/
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
#include "lammpsplugin.h"
|
||||
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "pointers.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
class Hello : protected Pointers {
|
||||
public:
|
||||
Hello(class LAMMPS *lmp) : Pointers(lmp) {};
|
||||
void command(int, char **);
|
||||
};
|
||||
}
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
void Hello::command(int argc, char **argv)
|
||||
{
|
||||
if (argc != 1) error->all(FLERR,"Illegal hello command");
|
||||
if (comm->me == 0)
|
||||
utils::logmesg(lmp,fmt::format("Hello, {}!\n",argv[0]));
|
||||
}
|
||||
|
||||
static void hellocreator(LAMMPS *lmp, int argc, char **argv)
|
||||
{
|
||||
Hello hello(lmp);
|
||||
hello.command(argc,argv);
|
||||
}
|
||||
|
||||
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||
{
|
||||
lammpsplugin_t plugin;
|
||||
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||
|
||||
plugin.version = LAMMPS_VERSION;
|
||||
plugin.style = "command";
|
||||
plugin.name = "hello";
|
||||
plugin.info = "Hello world command v1.0";
|
||||
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||
plugin.creator.v3 = (lammpsplugin_factory3 *) &hellocreator;
|
||||
plugin.handle = handle;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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: Carsten Svaneborg (SDU)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "improper_zero2.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ImproperZero2::ImproperZero2(LAMMPS *lmp) : Improper(lmp), coeffflag(1)
|
||||
{
|
||||
writedata = 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ImproperZero2::~ImproperZero2()
|
||||
{
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero2::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero2::settings(int narg, char **arg)
|
||||
{
|
||||
if ((narg != 0) && (narg != 1))
|
||||
error->all(FLERR,"Illegal improper_style command");
|
||||
|
||||
if (narg == 1) {
|
||||
if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0;
|
||||
else error->all(FLERR,"Illegal improper_style command");
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero2::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->nimpropertypes;
|
||||
|
||||
memory->create(setflag,n+1,"improper:setflag");
|
||||
for (int i = 1; i <= n; i++) setflag[i] = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more types
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero2::coeff(int narg, char **arg)
|
||||
{
|
||||
if ((narg < 1) || (coeffflag && narg > 1))
|
||||
error->all(FLERR,"Incorrect args for improper coefficients");
|
||||
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error);
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
setflag[i] = 1;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for improper coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes out coeffs to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero2::write_restart(FILE * /*fp*/) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads coeffs from restart file, bcasts them
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero2::read_restart(FILE * /*fp*/)
|
||||
{
|
||||
allocate();
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperZero2::write_data(FILE *fp) {
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++)
|
||||
fprintf(fp,"%d\n",i);
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_IMPROPER_ZERO2_H
|
||||
#define LMP_IMPROPER_ZERO2_H
|
||||
|
||||
#include "improper.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ImproperZero2 : public Improper {
|
||||
public:
|
||||
ImproperZero2(class LAMMPS *);
|
||||
virtual ~ImproperZero2();
|
||||
virtual void compute(int, int);
|
||||
virtual void coeff(int, char **);
|
||||
virtual void settings(int, char **);
|
||||
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
int coeffflag;
|
||||
|
||||
virtual void allocate();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
E: Incorrect args for improper coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
*/
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
#include "lammpsplugin.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "pair_morse2.h"
|
||||
#include "pair_morse2_omp.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
static Pair *morse2creator(LAMMPS *lmp)
|
||||
{
|
||||
return new PairMorse2(lmp);
|
||||
}
|
||||
|
||||
static Pair *morse2ompcreator(LAMMPS *lmp)
|
||||
{
|
||||
return new PairMorse2OMP(lmp);
|
||||
}
|
||||
|
||||
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||
{
|
||||
lammpsplugin_t plugin;
|
||||
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||
|
||||
// register plain morse2 pair style
|
||||
plugin.version = LAMMPS_VERSION;
|
||||
plugin.style = "pair";
|
||||
plugin.name = "morse2";
|
||||
plugin.info = "Morse2 variant pair style v1.0";
|
||||
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2creator;
|
||||
plugin.handle = handle;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
|
||||
// also register morse2/omp pair style. only need to update changed fields
|
||||
plugin.name = "morse2/omp";
|
||||
plugin.info = "Morse2 variant pair style for OpenMP v1.0";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2ompcreator;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
#include "lammpsplugin.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "fix_nve2.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
static Fix *nve2creator(LAMMPS *lmp, int argc, char **argv)
|
||||
{
|
||||
return new FixNVE2(lmp, argc, argv);
|
||||
}
|
||||
|
||||
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||
{
|
||||
lammpsplugin_t plugin;
|
||||
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||
|
||||
plugin.version = LAMMPS_VERSION;
|
||||
plugin.style = "fix";
|
||||
plugin.name = "nve2";
|
||||
plugin.info = "NVE2 variant fix style v1.0";
|
||||
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||
plugin.creator.v2 = (lammpsplugin_factory2 *) &nve2creator;
|
||||
plugin.handle = handle;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
}
|
|
@ -0,0 +1,359 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_morse2.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairMorse2::PairMorse2(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
writedata = 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairMorse2::~PairMorse2()
|
||||
{
|
||||
if (allocated) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
|
||||
memory->destroy(cut);
|
||||
memory->destroy(d0);
|
||||
memory->destroy(alpha);
|
||||
memory->destroy(r0);
|
||||
memory->destroy(morse1);
|
||||
memory->destroy(offset);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
double rsq,r,dr,dexp,factor_lj;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
|
||||
evdwl = 0.0;
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
double *special_lj = force->special_lj;
|
||||
int newton_pair = force->newton_pair;
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
dr = r - r0[itype][jtype];
|
||||
dexp = exp(-alpha[itype][jtype] * dr);
|
||||
fpair = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
evdwl = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,0.0,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->ntypes;
|
||||
|
||||
memory->create(setflag,n+1,n+1,"pair:setflag");
|
||||
for (int i = 1; i <= n; i++)
|
||||
for (int j = i; j <= n; j++)
|
||||
setflag[i][j] = 0;
|
||||
|
||||
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
||||
|
||||
memory->create(cut,n+1,n+1,"pair:cut");
|
||||
memory->create(d0,n+1,n+1,"pair:d0");
|
||||
memory->create(alpha,n+1,n+1,"pair:alpha");
|
||||
memory->create(r0,n+1,n+1,"pair:r0");
|
||||
memory->create(morse1,n+1,n+1,"pair:morse1");
|
||||
memory->create(offset,n+1,n+1,"pair:offset");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::settings(int narg, char **arg)
|
||||
{
|
||||
if (narg != 1) error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
cut_global = utils::numeric(FLERR,arg[0],false,lmp);
|
||||
|
||||
// reset cutoffs that have been explicitly set
|
||||
|
||||
if (allocated) {
|
||||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++)
|
||||
if (setflag[i][j]) cut[i][j] = cut_global;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more type pairs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg < 5 || narg > 6)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi,jlo,jhi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error);
|
||||
utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error);
|
||||
|
||||
double d0_one = utils::numeric(FLERR,arg[2],false,lmp);
|
||||
double alpha_one = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
double r0_one = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
|
||||
double cut_one = cut_global;
|
||||
if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp);
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
||||
d0[i][j] = d0_one;
|
||||
alpha[i][j] = alpha_one;
|
||||
r0[i][j] = r0_one;
|
||||
cut[i][j] = cut_one;
|
||||
setflag[i][j] = 1;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init for one type pair i,j and corresponding j,i
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairMorse2::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
||||
|
||||
morse1[i][j] = 2.0*d0[i][j]*alpha[i][j];
|
||||
|
||||
if (offset_flag) {
|
||||
double alpha_dr = -alpha[i][j] * (cut[i][j] - r0[i][j]);
|
||||
offset[i][j] = d0[i][j] * (exp(2.0*alpha_dr) - 2.0*exp(alpha_dr));
|
||||
} else offset[i][j] = 0.0;
|
||||
|
||||
d0[j][i] = d0[i][j];
|
||||
alpha[j][i] = alpha[i][j];
|
||||
r0[j][i] = r0[i][j];
|
||||
morse1[j][i] = morse1[i][j];
|
||||
offset[j][i] = offset[i][j];
|
||||
|
||||
return cut[i][j];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::write_restart(FILE *fp)
|
||||
{
|
||||
write_restart_settings(fp);
|
||||
|
||||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&d0[i][j],sizeof(double),1,fp);
|
||||
fwrite(&alpha[i][j],sizeof(double),1,fp);
|
||||
fwrite(&r0[i][j],sizeof(double),1,fp);
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads from restart file, bcasts
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::read_restart(FILE *fp)
|
||||
{
|
||||
read_restart_settings(fp);
|
||||
|
||||
allocate();
|
||||
|
||||
int i,j;
|
||||
int me = comm->me;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::write_restart_settings(FILE *fp)
|
||||
{
|
||||
fwrite(&cut_global,sizeof(double),1,fp);
|
||||
fwrite(&offset_flag,sizeof(int),1,fp);
|
||||
fwrite(&mix_flag,sizeof(int),1,fp);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads from restart file, bcasts
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::read_restart_settings(FILE *fp)
|
||||
{
|
||||
if (comm->me == 0) {
|
||||
utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&offset_flag,1,MPI_INT,0,world);
|
||||
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
fprintf(fp,"%d %g %g %g\n",i,d0[i][i],alpha[i][i],r0[i][i]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes all pairs to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2::write_data_all(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
for (int j = i; j <= atom->ntypes; j++)
|
||||
fprintf(fp,"%d %d %g %g %g %g\n",
|
||||
i,j,d0[i][j],alpha[i][j],r0[i][j],cut[i][j]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairMorse2::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
|
||||
double /*factor_coul*/, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r,dr,dexp,phi;
|
||||
|
||||
r = sqrt(rsq);
|
||||
dr = r - r0[itype][jtype];
|
||||
dexp = exp(-alpha[itype][jtype] * dr);
|
||||
fforce = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r;
|
||||
|
||||
phi = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) - offset[itype][jtype];
|
||||
return factor_lj*phi;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairMorse2::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 2;
|
||||
if (strcmp(str,"d0") == 0) return (void *) d0;
|
||||
if (strcmp(str,"r0") == 0) return (void *) r0;
|
||||
if (strcmp(str,"alpha") == 0) return (void *) alpha;
|
||||
return nullptr;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_PAIR_MORSE2_H
|
||||
#define LMP_PAIR_MORSE2_H
|
||||
|
||||
#include "pair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairMorse2 : public Pair {
|
||||
public:
|
||||
PairMorse2(class LAMMPS *);
|
||||
virtual ~PairMorse2();
|
||||
virtual void compute(int, int);
|
||||
|
||||
void settings(int, char **);
|
||||
void coeff(int, char **);
|
||||
double init_one(int, int);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
void write_data(FILE *);
|
||||
void write_data_all(FILE *);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
double cut_global;
|
||||
double **cut;
|
||||
double **d0,**alpha,**r0;
|
||||
double **morse1;
|
||||
double **offset;
|
||||
|
||||
virtual void allocate();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Incorrect args for pair coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
E: All pair coeffs are not set
|
||||
|
||||
All pair coefficients must be set in the data file or by the
|
||||
pair_coeff command before running a simulation.
|
||||
|
||||
*/
|
|
@ -0,0 +1,160 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
This software is distributed under the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing author: Axel Kohlmeyer (Temple U)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_morse2_omp.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neigh_list.h"
|
||||
#include "suffix.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "omp_compat.h"
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairMorse2OMP::PairMorse2OMP(LAMMPS *lmp) :
|
||||
PairMorse2(lmp), ThrOMP(lmp, THR_PAIR)
|
||||
{
|
||||
suffix_flag |= Suffix::OMP;
|
||||
respa_enable = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairMorse2OMP::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
const int nall = atom->nlocal + atom->nghost;
|
||||
const int nthreads = comm->nthreads;
|
||||
const int inum = list->inum;
|
||||
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag,vflag)
|
||||
#endif
|
||||
{
|
||||
int ifrom, ito, tid;
|
||||
|
||||
loop_setup_thr(ifrom, ito, tid, inum, nthreads);
|
||||
ThrData *thr = fix->get_thr(tid);
|
||||
thr->timer(Timer::START);
|
||||
ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr);
|
||||
|
||||
if (evflag) {
|
||||
if (eflag) {
|
||||
if (force->newton_pair) eval<1,1,1>(ifrom, ito, thr);
|
||||
else eval<1,1,0>(ifrom, ito, thr);
|
||||
} else {
|
||||
if (force->newton_pair) eval<1,0,1>(ifrom, ito, thr);
|
||||
else eval<1,0,0>(ifrom, ito, thr);
|
||||
}
|
||||
} else {
|
||||
if (force->newton_pair) eval<0,0,1>(ifrom, ito, thr);
|
||||
else eval<0,0,0>(ifrom, ito, thr);
|
||||
}
|
||||
|
||||
thr->timer(Timer::PAIR);
|
||||
reduce_thr(this, eflag, vflag, thr);
|
||||
} // end of omp parallel region
|
||||
}
|
||||
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void PairMorse2OMP::eval(int iifrom, int iito, ThrData * const thr)
|
||||
{
|
||||
int i,j,ii,jj,jnum,itype,jtype;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
|
||||
double rsq,r,dr,dexp,factor_lj;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
|
||||
evdwl = 0.0;
|
||||
|
||||
const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
|
||||
dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0];
|
||||
const int * _noalias const type = atom->type;
|
||||
const int nlocal = atom->nlocal;
|
||||
const double * _noalias const special_lj = force->special_lj;
|
||||
double fxtmp,fytmp,fztmp;
|
||||
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = iifrom; ii < iito; ++ii) {
|
||||
|
||||
i = ilist[ii];
|
||||
xtmp = x[i].x;
|
||||
ytmp = x[i].y;
|
||||
ztmp = x[i].z;
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
fxtmp=fytmp=fztmp=0.0;
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
delx = xtmp - x[j].x;
|
||||
dely = ytmp - x[j].y;
|
||||
delz = ztmp - x[j].z;
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r = sqrt(rsq);
|
||||
dr = r - r0[itype][jtype];
|
||||
dexp = exp(-alpha[itype][jtype] * dr);
|
||||
fpair = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r;
|
||||
|
||||
fxtmp += delx*fpair;
|
||||
fytmp += dely*fpair;
|
||||
fztmp += delz*fpair;
|
||||
if (NEWTON_PAIR || j < nlocal) {
|
||||
f[j].x -= delx*fpair;
|
||||
f[j].y -= dely*fpair;
|
||||
f[j].z -= delz*fpair;
|
||||
}
|
||||
|
||||
if (EFLAG) {
|
||||
evdwl = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
}
|
||||
|
||||
if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR,
|
||||
evdwl,0.0,fpair,delx,dely,delz,thr);
|
||||
}
|
||||
}
|
||||
f[i].x += fxtmp;
|
||||
f[i].y += fytmp;
|
||||
f[i].z += fztmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairMorse2OMP::memory_usage()
|
||||
{
|
||||
double bytes = memory_usage_thr();
|
||||
bytes += PairMorse2::memory_usage();
|
||||
|
||||
return bytes;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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: Axel Kohlmeyer (Temple U)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_PAIR_MORSE2_OMP_H
|
||||
#define LMP_PAIR_MORSE2_OMP_H
|
||||
|
||||
#include "pair_morse2.h"
|
||||
#include "thr_omp.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairMorse2OMP : public PairMorse2, public ThrOMP {
|
||||
|
||||
public:
|
||||
PairMorse2OMP(class LAMMPS *);
|
||||
|
||||
virtual void compute(int, int);
|
||||
virtual double memory_usage();
|
||||
|
||||
private:
|
||||
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
|
||||
void eval(int ifrom, int ito, ThrData * const thr);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,247 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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: Carsten Svaneborg (SDU)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "pair_zero2.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairZero2::PairZero2(LAMMPS *lmp) : Pair(lmp) {
|
||||
coeffflag=1;
|
||||
writedata=1;
|
||||
single_enable=1;
|
||||
respa_enable=1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairZero2::~PairZero2()
|
||||
{
|
||||
if (allocated) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
memory->destroy(cut);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::compute_outer(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->ntypes;
|
||||
|
||||
memory->create(setflag,n+1,n+1,"pair:setflag");
|
||||
for (int i = 1; i <= n; i++)
|
||||
for (int j = i; j <= n; j++)
|
||||
setflag[i][j] = 0;
|
||||
|
||||
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
||||
memory->create(cut,n+1,n+1,"pair:cut");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::settings(int narg, char **arg)
|
||||
{
|
||||
if ((narg != 1) && (narg != 2))
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
cut_global = utils::numeric(FLERR,arg[0],false,lmp);
|
||||
if (narg == 2) {
|
||||
if (strcmp("nocoeff",arg[1]) == 0) coeffflag=0;
|
||||
else error->all(FLERR,"Illegal pair_style command");
|
||||
}
|
||||
|
||||
// reset cutoffs that have been explicitly set
|
||||
|
||||
if (allocated) {
|
||||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i+1; j <= atom->ntypes; j++)
|
||||
cut[i][j] = cut_global;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more type pairs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::coeff(int narg, char **arg)
|
||||
{
|
||||
if ((narg < 2) || (coeffflag && narg > 3))
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
|
||||
if (!allocated) allocate();
|
||||
|
||||
int ilo,ihi,jlo,jhi;
|
||||
utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error);
|
||||
utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error);
|
||||
|
||||
double cut_one = cut_global;
|
||||
if (coeffflag && (narg == 3)) cut_one = utils::numeric(FLERR,arg[2],false,lmp);
|
||||
|
||||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
||||
cut[i][j] = cut_one;
|
||||
setflag[i][j] = 1;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init for one type pair i,j and corresponding j,i
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairZero2::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) {
|
||||
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
|
||||
}
|
||||
|
||||
return cut[i][j];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::write_restart(FILE *fp)
|
||||
{
|
||||
write_restart_settings(fp);
|
||||
|
||||
int i,j;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
fwrite(&setflag[i][j],sizeof(int),1,fp);
|
||||
if (setflag[i][j]) {
|
||||
fwrite(&cut[i][j],sizeof(double),1,fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads from restart file, bcasts
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::read_restart(FILE *fp)
|
||||
{
|
||||
read_restart_settings(fp);
|
||||
allocate();
|
||||
|
||||
int i,j;
|
||||
int me = comm->me;
|
||||
for (i = 1; i <= atom->ntypes; i++)
|
||||
for (j = i; j <= atom->ntypes; j++) {
|
||||
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
|
||||
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
|
||||
if (setflag[i][j]) {
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to restart file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::write_restart_settings(FILE *fp)
|
||||
{
|
||||
fwrite(&cut_global,sizeof(double),1,fp);
|
||||
fwrite(&coeffflag,sizeof(int),1,fp);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 reads from restart file, bcasts
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::read_restart_settings(FILE *fp)
|
||||
{
|
||||
int me = comm->me;
|
||||
if (me == 0) {
|
||||
utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error);
|
||||
utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,nullptr,error);
|
||||
}
|
||||
MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world);
|
||||
MPI_Bcast(&coeffflag,1,MPI_INT,0,world);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
fprintf(fp,"%d\n",i);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes all pairs to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairZero2::write_data_all(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ntypes; i++)
|
||||
for (int j = i; j <= atom->ntypes; j++)
|
||||
fprintf(fp,"%d %d %g\n",i,j,cut[i][j]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairZero2::single(int /*i*/, int /*j*/, int /* itype */, int /* jtype */,
|
||||
double /* rsq */, double /*factor_coul*/,
|
||||
double /* factor_lj */, double &fforce)
|
||||
{
|
||||
fforce = 0.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
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.
|
||||
|
||||
Pair zero is a dummy pair interaction useful for requiring a
|
||||
force cutoff distance in the absence of pair-interactions or
|
||||
with hybrid/overlay if a larger force cutoff distance is required.
|
||||
|
||||
This can be used in conjunction with bond/create to create bonds
|
||||
that are longer than the cutoff of a given force field, or to
|
||||
calculate radial distribution functions for models without
|
||||
pair interactions.
|
||||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_PAIR_ZERO2_H
|
||||
#define LMP_PAIR_ZERO2_H
|
||||
|
||||
#include "pair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairZero2 : public Pair {
|
||||
public:
|
||||
PairZero2(class LAMMPS *);
|
||||
virtual ~PairZero2();
|
||||
virtual void compute(int, int);
|
||||
virtual void compute_outer(int, int);
|
||||
void settings(int, char **);
|
||||
void coeff(int, char **);
|
||||
double init_one(int, int);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
void write_data(FILE *);
|
||||
void write_data_all(FILE *);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
|
||||
protected:
|
||||
double cut_global;
|
||||
double **cut;
|
||||
int coeffflag;
|
||||
|
||||
virtual void allocate();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Incorrect args for pair coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
U: Pair cutoff < Respa interior cutoff
|
||||
|
||||
One or more pairwise cutoffs are too short to use with the specified
|
||||
rRESPA cutoffs.
|
||||
|
||||
*/
|
|
@ -0,0 +1,78 @@
|
|||
|
||||
#include "lammpsplugin.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "pair_zero2.h"
|
||||
#include "bond_zero2.h"
|
||||
#include "angle_zero2.h"
|
||||
#include "dihedral_zero2.h"
|
||||
#include "improper_zero2.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
static Pair *pairzerocreator(LAMMPS *lmp)
|
||||
{
|
||||
return new PairZero2(lmp);
|
||||
}
|
||||
|
||||
static Bond *bondzerocreator(LAMMPS *lmp)
|
||||
{
|
||||
return new BondZero2(lmp);
|
||||
}
|
||||
|
||||
static Angle *anglezerocreator(LAMMPS *lmp)
|
||||
{
|
||||
return new AngleZero2(lmp);
|
||||
}
|
||||
|
||||
static Dihedral *dihedralzerocreator(LAMMPS *lmp)
|
||||
{
|
||||
return new DihedralZero2(lmp);
|
||||
}
|
||||
|
||||
static Improper *improperzerocreator(LAMMPS *lmp)
|
||||
{
|
||||
return new ImproperZero2(lmp);
|
||||
}
|
||||
|
||||
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
|
||||
{
|
||||
lammpsplugin_t plugin;
|
||||
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
|
||||
|
||||
// register zero2 pair style
|
||||
plugin.version = LAMMPS_VERSION;
|
||||
plugin.style = "pair";
|
||||
plugin.name = "zero2";
|
||||
plugin.info = "Zero2 variant pair style v1.0";
|
||||
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &pairzerocreator;
|
||||
plugin.handle = handle;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
|
||||
// register zero2 bond style
|
||||
plugin.style = "bond";
|
||||
plugin.info = "Zero2 variant bond style v1.0";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &bondzerocreator;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
|
||||
// register zero2 angle style
|
||||
plugin.style = "angle";
|
||||
plugin.info = "Zero2 variant angle style v1.0";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &anglezerocreator;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
|
||||
// register zero2 dihedral style
|
||||
plugin.style = "dihedral";
|
||||
plugin.info = "Zero2 variant dihedral style v1.0";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &dihedralzerocreator;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
|
||||
// register zero2 improper style
|
||||
plugin.style = "improper";
|
||||
plugin.info = "Zero2 variant improper style v1.0";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &improperzerocreator;
|
||||
(*register_plugin)(&plugin,lmp);
|
||||
}
|
20
lib/README
20
lib/README
|
@ -19,12 +19,12 @@ atc atomistic-to-continuum methods, USER-ATC package
|
|||
from Reese Jones, Jeremy Templeton, Jon Zimmerman (Sandia)
|
||||
awpmd antisymmetrized wave packet molecular dynamics, AWPMD package
|
||||
from Ilya Valuev (JIHT RAS)
|
||||
colvars collective variable module (Metadynamics, ABF and more)
|
||||
colvars collective variable module (Metadynamics, ABF and more)
|
||||
from Giacomo Fiorin and Jerome Henin (ICMS, Temple U)
|
||||
compress hook to system lib for performing I/O compression, COMPRESS pkg
|
||||
from Axel Kohlmeyer (Temple U)
|
||||
gpu general GPU routines, GPU package
|
||||
from Mike Brown (ORNL)
|
||||
from Axel Kohlmeyer (Temple U)
|
||||
gpu general GPU routines, GPU package
|
||||
from Mike Brown (ORNL)
|
||||
h5md ch5md library for output of MD data in HDF5 format
|
||||
from Pierre de Buyl (KU Leuven)
|
||||
kim hooks to the KIM library, used by KIM package
|
||||
|
@ -32,26 +32,28 @@ kim hooks to the KIM library, used by KIM package
|
|||
kokkos Kokkos package for GPU and many-core acceleration
|
||||
from Kokkos development team (Sandia)
|
||||
linalg set of BLAS and LAPACK routines needed by USER-ATC package
|
||||
from Axel Kohlmeyer (Temple U)
|
||||
from Axel Kohlmeyer (Temple U)
|
||||
message client/server communication library via MPI, sockets, files
|
||||
from Steve Plimpton (Sandia)
|
||||
from Steve Plimpton (Sandia)
|
||||
molfile hooks to VMD molfile plugins, used by the USER-MOLFILE package
|
||||
from Axel Kohlmeyer (Temple U) and the VMD development team
|
||||
mscg hooks to the MSCG library, used by fix_mscg command
|
||||
from Jacob Wagner and Greg Voth group (U Chicago)
|
||||
netcdf hooks to a NetCDF library installed on your system
|
||||
from Lars Pastewka (Karlsruhe Institute of Technology)
|
||||
poems POEMS rigid-body integration package, POEMS package
|
||||
plugin settings to load styles into LAMMPS from plugins
|
||||
from Axel Kohlmeyer (Temple U)
|
||||
poems POEMS rigid-body integration package, POEMS package
|
||||
from Rudranarayan Mukherjee (RPI)
|
||||
python hooks to the system Python library, used by the PYTHON package
|
||||
from the LAMMPS development team
|
||||
qmmm quantum mechanics/molecular mechanics coupling interface
|
||||
qmmm quantum mechanics/molecular mechanics coupling interface
|
||||
from Axel Kohlmeyer (Temple U)
|
||||
quip interface to QUIP/libAtoms framework, USER-QUIP package
|
||||
from Albert Bartok-Partay and Gabor Csanyi (U Cambridge)
|
||||
smd hooks to Eigen library, used by USER-SMD package
|
||||
from Georg Ganzenmueller (Ernst Mach Institute, Germany)
|
||||
voronoi hooks to the Voro++ library, used by compute voronoi/atom command
|
||||
from Daniel Schwen (LANL)
|
||||
from Daniel Schwen (LANL)
|
||||
vtk hooks to the VTK library, used by dump custom/vtk command
|
||||
from Richard Berger (JKU)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# /* ----------------------------------------------------------------------
|
||||
# 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
|
||||
# ------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -42,6 +42,10 @@ ifeq (hcc,$(HIP_PLATFORM))
|
|||
HIP_OPTS += -ffast-math
|
||||
# possible values: gfx803,gfx900,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))
|
||||
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] \
|
||||
|
|
|
@ -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
|
||||
path in lammps/lib/gpu/Makefile.hip.
|
||||
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
|
||||
architecture (gfx803, gfx900, gfx906 etc.)
|
||||
export HIP_PLATFORM=amd (ROCm >= 4.1), HIP_PLATFORM=hcc (ROCm <= 4.0)
|
||||
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,
|
||||
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.
|
||||
|
@ -278,4 +278,3 @@ and
|
|||
Brown, W.M., Masako, Y. Implementing Molecular Dynamics on Hybrid High
|
||||
Performance Computers - Three-Body Potentials. Computer Physics Communications.
|
||||
2013. 184: p. 2785–2793.
|
||||
|
||||
|
|
|
@ -740,6 +740,7 @@ void Neighbor::build_nbor_list(double **x, const int inum, const int host_inum,
|
|||
|
||||
// If binning on GPU, do this now
|
||||
if (_gpu_nbor==1) {
|
||||
mn = _max_nbors;
|
||||
const numtyp i_cell_size=static_cast<numtyp>(1.0/_cell_size);
|
||||
const int neigh_block=_block_cell_id;
|
||||
const int GX=(int)ceil((float)nall/neigh_block);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue