Merge https://github.com/lammps/lammps into pair_rann
This commit is contained in:
4
.github/workflows/unittest-macos.yml
vendored
4
.github/workflows/unittest-macos.yml
vendored
@ -24,7 +24,9 @@ jobs:
|
||||
shell: bash
|
||||
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
|
||||
|
||||
|
||||
@ -1,841 +0,0 @@
|
||||
########################################
|
||||
# CMake build system
|
||||
# This file is part of LAMMPS
|
||||
# Created by Christoph Junghans and Richard Berger
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
||||
if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
########################################
|
||||
|
||||
project(lammps CXX)
|
||||
set(SOVERSION 0)
|
||||
|
||||
get_filename_component(LAMMPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE)
|
||||
get_filename_component(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib ABSOLUTE)
|
||||
|
||||
set(LAMMPS_SOURCE_DIR ${LAMMPS_DIR}/src)
|
||||
set(LAMMPS_LIB_SOURCE_DIR ${LAMMPS_DIR}/lib)
|
||||
set(LAMMPS_DOC_DIR ${LAMMPS_DIR}/doc)
|
||||
set(LAMMPS_TOOLS_DIR ${LAMMPS_DIR}/tools)
|
||||
set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python)
|
||||
set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials)
|
||||
|
||||
find_package(Git)
|
||||
|
||||
# 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()
|
||||
|
||||
# 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)
|
||||
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
endif()
|
||||
|
||||
# Cmake modules/macros are in a subdirectory to keep this file cleaner
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
|
||||
|
||||
# make sure LIBRARY_PATH is set if environment variable is set
|
||||
if(DEFINED ENV{LIBRARY_PATH})
|
||||
list(APPEND CMAKE_LIBRARY_PATH "$ENV{LIBRARY_PATH}")
|
||||
message(STATUS "Appending $ENV{LIBRARY_PATH} to CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}")
|
||||
endif()
|
||||
|
||||
include(LAMMPSUtils)
|
||||
|
||||
get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h PROJECT_VERSION)
|
||||
|
||||
include(PreventInSourceBuilds)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
|
||||
|
||||
# check for files auto-generated by make-based buildsystem
|
||||
# this is fast, so check for it all the time
|
||||
check_for_autogen_files(${LAMMPS_SOURCE_DIR})
|
||||
|
||||
######################################################################
|
||||
# compiler tests
|
||||
# these need ot be done early (before further tests).
|
||||
#####################################################################
|
||||
include(CheckIncludeFileCXX)
|
||||
|
||||
# set required compiler flags and compiler/CPU arch specific optimizations
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
|
||||
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
|
||||
else()
|
||||
set(CMAKE_TUNE_DEFAULT "-xHost")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# we require C++11 without extensions
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
||||
|
||||
########################################################################
|
||||
# User input options #
|
||||
########################################################################
|
||||
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
||||
mark_as_advanced(LAMMPS_MACHINE)
|
||||
if(LAMMPS_MACHINE)
|
||||
set(LAMMPS_MACHINE "_${LAMMPS_MACHINE}")
|
||||
endif()
|
||||
set(LAMMPS_BINARY lmp${LAMMPS_MACHINE})
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
||||
if(BUILD_SHARED_LIBS) # for all pkg libs, mpi_stubs and linalg
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
||||
option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(GLOB ALL_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||
file(GLOB MAIN_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
||||
add_library(lammps ${ALL_SOURCES})
|
||||
add_executable(lmp ${MAIN_SOURCES})
|
||||
target_link_libraries(lmp PRIVATE lammps)
|
||||
set_target_properties(lmp PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY})
|
||||
install(TARGETS lmp EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
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
|
||||
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
|
||||
USER-MOLFILE USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB
|
||||
USER-RANN USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH
|
||||
USER-TALLY USER-UEF USER-VTK USER-QUIP USER-QMMM USER-YAFF)
|
||||
|
||||
set(SUFFIX_PACKAGES CORESHELL GPU KOKKOS OPT USER-INTEL USER-OMP)
|
||||
|
||||
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||
option(PKG_${PKG} "Build ${PKG} Package" OFF)
|
||||
endforeach()
|
||||
|
||||
######################################################
|
||||
# packages with special compiler needs or external libs
|
||||
######################################################
|
||||
target_include_directories(lammps PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}>)
|
||||
|
||||
if(PKG_USER-ADIOS)
|
||||
# The search for ADIOS2 must come before MPI because
|
||||
# it includes its own MPI search with the latest FindMPI.cmake
|
||||
# script that defines the MPI::MPI_C target
|
||||
enable_language(C)
|
||||
find_package(ADIOS2 REQUIRED)
|
||||
target_link_libraries(lammps PRIVATE adios2::adios2)
|
||||
endif()
|
||||
|
||||
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)
|
||||
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)
|
||||
include(MPI4WIN)
|
||||
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
|
||||
else()
|
||||
find_package(MPI REQUIRED)
|
||||
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
|
||||
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 PRIVATE -DLAMMPS_LONGLONG_TO_LONG)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.cpp)
|
||||
add_library(mpi_stubs STATIC ${MPI_SOURCES})
|
||||
set_target_properties(mpi_stubs PROPERTIES OUTPUT_NAME lammps_mpi_stubs${LAMMPS_MACHINE})
|
||||
target_include_directories(mpi_stubs PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries(lammps PRIVATE mpi_stubs)
|
||||
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
|
||||
target_compile_definitions(lammps INTERFACE $<INSTALL_INTERFACE:LAMMPS_LIB_NO_MPI>)
|
||||
else()
|
||||
target_link_libraries(lammps PUBLIC mpi_stubs)
|
||||
endif()
|
||||
add_library(MPI::MPI_CXX ALIAS mpi_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 PUBLIC -DLAMMPS_${LAMMPS_SIZES})
|
||||
|
||||
# posix_memalign is not available on Windows
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(LAMMPS_MEMALIGN "0" CACHE STRING "posix_memalign() is not available on Windows" FORCE)
|
||||
else()
|
||||
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable")
|
||||
endif()
|
||||
if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0")
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
|
||||
endif()
|
||||
|
||||
option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" ${ENABLE_TESTING})
|
||||
if(LAMMPS_EXCEPTIONS)
|
||||
target_compile_definitions(lammps PUBLIC -DLAMMPS_EXCEPTIONS)
|
||||
endif()
|
||||
|
||||
# "hard" dependencies between packages resulting
|
||||
# in an error instead of skipping over files
|
||||
pkg_depends(MLIAP SNAP)
|
||||
pkg_depends(MPIIO MPI)
|
||||
pkg_depends(USER-ATC MANYBODY)
|
||||
pkg_depends(USER-LB MPI)
|
||||
pkg_depends(USER-PHONON KSPACE)
|
||||
pkg_depends(USER-SCAFACOS MPI)
|
||||
|
||||
# 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 PRIVATE -DLAMMPS_OMP_COMPAT=4)
|
||||
else()
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=3)
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX)
|
||||
endif()
|
||||
|
||||
# Compiler specific features for testing
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
||||
mark_as_advanced(ENABLE_COVERAGE)
|
||||
if(ENABLE_COVERAGE)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(lammps PUBLIC --coverage)
|
||||
target_link_options(lammps PUBLIC --coverage)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#######################################
|
||||
# add custom target for IWYU analysis
|
||||
#######################################
|
||||
set(ENABLE_IWYU OFF CACHE BOOL "Add 'iwyu' build target to call the include-what-you-use tool")
|
||||
mark_as_advanced(ENABLE_IWYU)
|
||||
if(ENABLE_IWYU)
|
||||
find_program(IWYU_EXE NAMES include-what-you-use iwyu)
|
||||
find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py)
|
||||
if (IWYU_EXE AND IWYU_TOOL)
|
||||
add_custom_target(
|
||||
iwyu
|
||||
${IWYU_TOOL} -o clang -p ${CMAKE_CURRENT_BINARY_DIR} -- -Xiwyu --mapping_file=${CMAKE_CURRENT_SOURCE_DIR}/iwyu/iwyu-extra-map.imp
|
||||
COMMENT "Running IWYU")
|
||||
add_dependencies(iwyu lammps)
|
||||
else()
|
||||
message(FATAL_ERROR "To use IWYU you need the include-what-you-use/iwyu executable"
|
||||
"and the iwyu-tool/iwyu_tool script installed in your PATH")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)")
|
||||
mark_as_advanced(ENABLE_SANITIZER)
|
||||
set(ENABLE_SANITIZER_VALUES none address leak thread undefined)
|
||||
set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${ENABLE_SANITIZER_VALUES})
|
||||
validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
|
||||
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
||||
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
||||
set(ENABLE_SANITIZER "none")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
|
||||
enable_language(C)
|
||||
find_package(LAPACK)
|
||||
find_package(BLAS)
|
||||
if(NOT LAPACK_FOUND OR NOT BLAS_FOUND)
|
||||
include(CheckGeneratorSupport)
|
||||
if(NOT CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
||||
status(FATAL_ERROR "Cannot build internal linear algebra library as CMake build tool lacks Fortran support")
|
||||
endif()
|
||||
enable_language(Fortran)
|
||||
file(GLOB LAPACK_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.[fF])
|
||||
add_library(linalg STATIC ${LAPACK_SOURCES})
|
||||
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
||||
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||
else()
|
||||
list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(JPEG QUIET)
|
||||
option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
||||
if(WITH_JPEG)
|
||||
find_package(JPEG REQUIRED)
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS})
|
||||
target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(PNG QUIET)
|
||||
find_package(ZLIB QUIET)
|
||||
if(PNG_FOUND AND ZLIB_FOUND)
|
||||
option(WITH_PNG "Enable PNG support" ON)
|
||||
else()
|
||||
option(WITH_PNG "Enable PNG support" OFF)
|
||||
endif()
|
||||
if(WITH_PNG)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_link_libraries(lammps PRIVATE PNG::PNG ZLIB::ZLIB)
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_PNG)
|
||||
endif()
|
||||
|
||||
find_program(GZIP_EXECUTABLE gzip)
|
||||
find_package_handle_standard_args(GZIP REQUIRED_VARS GZIP_EXECUTABLE)
|
||||
option(WITH_GZIP "Enable GZIP support" ${GZIP_FOUND})
|
||||
if(WITH_GZIP)
|
||||
if(GZIP_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING))
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_GZIP)
|
||||
else()
|
||||
message(FATAL_ERROR "gzip executable not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(FFMPEG_EXECUTABLE ffmpeg)
|
||||
find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_EXECUTABLE)
|
||||
option(WITH_FFMPEG "Enable FFMPEG support" ${FFMPEG_FOUND})
|
||||
if(WITH_FFMPEG)
|
||||
if(FFMPEG_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING))
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_FFMPEG)
|
||||
else()
|
||||
message(FATAL_ERROR "ffmpeg executable not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CONFIGURE_REQUEST_PIC "--with-pic")
|
||||
set(CMAKE_REQUEST_PIC "-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}")
|
||||
set(CUDA_REQUEST_PIC "-Xcompiler ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
||||
else()
|
||||
set(CONFIGURE_REQUEST_PIC)
|
||||
set(CMAKE_REQUEST_PIC)
|
||||
set(CUDA_REQUEST_PIC)
|
||||
endif()
|
||||
|
||||
foreach(PKG_WITH_INCL KSPACE PYTHON MLIAP VORONOI USER-COLVARS USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM
|
||||
USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS)
|
||||
if(PKG_${PKG_WITH_INCL})
|
||||
include(Packages/${PKG_WITH_INCL})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# optionally enable building script wrappers using swig
|
||||
option(WITH_SWIG "Build scripting language wrappers with SWIG" OFF)
|
||||
if(WITH_SWIG)
|
||||
get_filename_component(LAMMPS_SWIG_DIR ${LAMMPS_SOURCE_DIR}/../tools/swig ABSOLUTE)
|
||||
add_subdirectory(${LAMMPS_SWIG_DIR} swig)
|
||||
endif()
|
||||
|
||||
set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine specific optimization flags (compilation only)")
|
||||
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||
endforeach()
|
||||
########################################################################
|
||||
# Basic system tests (standard libraries, headers, functions, types) #
|
||||
########################################################################
|
||||
foreach(HEADER cmath)
|
||||
check_include_file_cxx(${HEADER} FOUND_${HEADER})
|
||||
if(NOT FOUND_${HEADER})
|
||||
message(FATAL_ERROR "Could not find needed header - ${HEADER}")
|
||||
endif(NOT FOUND_${HEADER})
|
||||
endforeach(HEADER)
|
||||
|
||||
set(MATH_LIBRARIES "m" CACHE STRING "math library")
|
||||
mark_as_advanced( MATH_LIBRARIES )
|
||||
target_link_libraries(lammps PRIVATE ${MATH_LIBRARIES})
|
||||
|
||||
######################################
|
||||
# Generate Basic Style files
|
||||
######################################
|
||||
include(StyleHeaderUtils)
|
||||
RegisterStyles(${LAMMPS_SOURCE_DIR})
|
||||
|
||||
########################################################
|
||||
# Fetch missing external files and archives for packages
|
||||
########################################################
|
||||
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||
if(PKG_${PKG})
|
||||
FetchPotentials(${LAMMPS_SOURCE_DIR}/${PKG} ${LAMMPS_POTENTIALS_DIR})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
##############################################
|
||||
# add sources of enabled packages
|
||||
############################################
|
||||
foreach(PKG ${STANDARD_PACKAGES})
|
||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||
|
||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||
|
||||
# check for package files in src directory due to old make system
|
||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||
|
||||
if(PKG_${PKG})
|
||||
# detects styles in package and adds them to global list
|
||||
RegisterStyles(${${PKG}_SOURCES_DIR})
|
||||
|
||||
target_sources(lammps PRIVATE ${${PKG}_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${${PKG}_SOURCES_DIR})
|
||||
endif()
|
||||
|
||||
RegisterPackages(${${PKG}_SOURCES_DIR})
|
||||
endforeach()
|
||||
|
||||
# packages that need defines set
|
||||
foreach(PKG MPIIO)
|
||||
if(PKG_${PKG})
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_${PKG})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# dedicated check for entire contents of accelerator packages
|
||||
foreach(PKG ${SUFFIX_PACKAGES})
|
||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||
|
||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||
|
||||
# check for package files in src directory due to old make system
|
||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||
|
||||
RegisterPackages(${${PKG}_SOURCES_DIR})
|
||||
endforeach()
|
||||
|
||||
##############################################
|
||||
# add lib sources of (simple) enabled packages
|
||||
############################################
|
||||
foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD USER-MESONT)
|
||||
if(PKG_${SIMPLE_LIB})
|
||||
string(REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}")
|
||||
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
||||
if(PKG_LIB STREQUAL mesont)
|
||||
enable_language(Fortran)
|
||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.f90)
|
||||
else()
|
||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c
|
||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
||||
endif()
|
||||
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
||||
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
||||
target_link_libraries(lammps PRIVATE ${PKG_LIB})
|
||||
if(PKG_LIB STREQUAL awpmd)
|
||||
target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include)
|
||||
elseif(PKG_LIB STREQUAL h5md)
|
||||
target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include ${HDF5_INCLUDE_DIRS})
|
||||
else()
|
||||
target_include_directories(${PKG_LIB} PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(PKG_USER-AWPMD)
|
||||
target_link_libraries(awpmd PRIVATE ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(PKG_USER-ATC)
|
||||
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
||||
message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG")
|
||||
endif()
|
||||
target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES})
|
||||
if(BUILD_MPI)
|
||||
target_link_libraries(atc PRIVATE MPI::MPI_CXX)
|
||||
else()
|
||||
target_link_libraries(atc PRIVATE mpi_stubs)
|
||||
endif()
|
||||
target_include_directories(atc PRIVATE ${LAMMPS_SOURCE_DIR})
|
||||
target_compile_definitions(atc PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||
endif()
|
||||
|
||||
if(PKG_USER-H5MD)
|
||||
include(Packages/USER-H5MD)
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
# packages which selectively include variants based on enabled styles
|
||||
# e.g. accelerator packages
|
||||
######################################################################
|
||||
foreach(PKG_WITH_INCL CORESHELL QEQ USER-OMP USER-SDPD KOKKOS OPT USER-INTEL GPU)
|
||||
if(PKG_${PKG_WITH_INCL})
|
||||
include(Packages/${PKG_WITH_INCL})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
######################################################################
|
||||
# the windows version of LAMMPS requires a couple extra libraries
|
||||
# and the MPI library - if use - has to be linked right before those
|
||||
# and after everything else that is compiled locally
|
||||
######################################################################
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE -lwsock32 -lpsapi)
|
||||
endif()
|
||||
|
||||
######################################################
|
||||
# Generate style headers based on global list of
|
||||
# styles registered during package selection
|
||||
# Generate packages headers from all packages
|
||||
######################################################
|
||||
set(LAMMPS_STYLE_HEADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/styles)
|
||||
|
||||
GenerateStyleHeaders(${LAMMPS_STYLE_HEADERS_DIR})
|
||||
GeneratePackagesHeaders(${LAMMPS_STYLE_HEADERS_DIR})
|
||||
|
||||
target_include_directories(lammps PRIVATE ${LAMMPS_STYLE_HEADERS_DIR})
|
||||
|
||||
######################################
|
||||
# Generate lmpinstalledpkgs.h
|
||||
######################################
|
||||
set(temp "#ifndef LMP_INSTALLED_PKGS_H\n#define LMP_INSTALLED_PKGS_H\n")
|
||||
set(temp "${temp}const char * LAMMPS_NS::LAMMPS::installed_packages[] = {\n")
|
||||
set(temp_PKG_LIST ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||
list(SORT temp_PKG_LIST)
|
||||
foreach(PKG ${temp_PKG_LIST})
|
||||
if(PKG_${PKG})
|
||||
set(temp "${temp} \"${PKG}\",\n")
|
||||
endif()
|
||||
endforeach()
|
||||
set(temp "${temp} NULL\n};\n#endif\n\n")
|
||||
message(STATUS "Generating lmpinstalledpkgs.h...")
|
||||
file(WRITE "${LAMMPS_STYLE_HEADERS_DIR}/lmpinstalledpkgs.h.tmp" "${temp}" )
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LAMMPS_STYLE_HEADERS_DIR}/lmpinstalledpkgs.h.tmp" "${LAMMPS_STYLE_HEADERS_DIR}/lmpinstalledpkgs.h")
|
||||
|
||||
######################################
|
||||
# Generate lmpgitversion.h
|
||||
######################################
|
||||
add_custom_target(gitversion COMMAND ${CMAKE_COMMAND}
|
||||
-DLAMMPS_DIR="${LAMMPS_DIR}"
|
||||
-DGIT_EXECUTABLE="${GIT_EXECUTABLE}"
|
||||
-DGIT_FOUND="${GIT_FOUND}"
|
||||
-DLAMMPS_STYLE_HEADERS_DIR="${LAMMPS_STYLE_HEADERS_DIR}"
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/generate_lmpgitversion.cmake)
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${LAMMPS_STYLE_HEADERS_DIR}/gitversion.h)
|
||||
add_dependencies(lammps gitversion)
|
||||
|
||||
###########################################
|
||||
# Actually add executable and lib to build
|
||||
############################################
|
||||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
list (FIND LANGUAGES "Fortran" _index)
|
||||
if(${_index} GREATER -1)
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||
endif()
|
||||
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h compute.h dihedral.h domain.h error.h fix.h force.h group.h improper.h
|
||||
input.h info.h kspace.h lammps.h lattice.h library.h lmppython.h lmptype.h memory.h modify.h neighbor.h neigh_list.h output.h
|
||||
pair.h pointers.h region.h timer.h universe.h update.h utils.h variable.h)
|
||||
if(LAMMPS_EXCEPTIONS)
|
||||
list(APPEND LAMMPS_CXX_HEADERS exceptions.h)
|
||||
endif()
|
||||
|
||||
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
|
||||
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
||||
target_include_directories(lammps PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps>)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps)
|
||||
foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_SOURCE_DIR}/${_HEADER} ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} DEPENDS ${LAMMPS_SOURCE_DIR}/${_HEADER})
|
||||
add_custom_target(${_HEADER} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER})
|
||||
add_dependencies(lammps ${_HEADER})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(FILES ${LAMMPS_SOURCE_DIR}/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
|
||||
endif()
|
||||
endforeach()
|
||||
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>)
|
||||
add_library(LAMMPS::lammps ALIAS lammps)
|
||||
get_target_property(LAMMPS_DEFINES lammps INTERFACE_COMPILE_DEFINITIONS)
|
||||
set(LAMMPS_API_DEFINES)
|
||||
foreach(_DEF ${LAMMPS_DEFINES})
|
||||
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${_DEF}")
|
||||
endforeach()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS lammps EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(EXPORT LAMMPS_Targets FILE LAMMPS_Targets.cmake NAMESPACE LAMMPS:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LAMMPS)
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_file(LAMMPSConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LAMMPSConfig.cmake @ONLY)
|
||||
write_basic_package_version_file("LAMMPSConfigVersion.cmake" VERSION ${PROJECT_VERSION} COMPATIBILITY ExactVersion)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LAMMPSConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/LAMMPSConfigVersion.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LAMMPS)
|
||||
endif()
|
||||
install(FILES ${LAMMPS_DOC_DIR}/lammps.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 RENAME ${LAMMPS_BINARY}.1)
|
||||
|
||||
include(Tools)
|
||||
include(Documentation)
|
||||
|
||||
###############################################################################
|
||||
# Install potential and force field files in data directory
|
||||
###############################################################################
|
||||
set(LAMMPS_INSTALL_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps)
|
||||
install(DIRECTORY ${LAMMPS_POTENTIALS_DIR} DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
||||
if(BUILD_TOOLS)
|
||||
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/msi2lmp/frc_files DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
||||
endif()
|
||||
|
||||
configure_file(etc/profile.d/lammps.sh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.sh @ONLY)
|
||||
configure_file(etc/profile.d/lammps.csh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.csh @ONLY)
|
||||
install(
|
||||
FILES ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.sh
|
||||
${CMAKE_BINARY_DIR}/etc/profile.d/lammps.csh
|
||||
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/profile.d
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# Install LAMMPS lib and python module into site-packages folder with
|
||||
# "install-python" target. Behaves exactly like "make install-python" for
|
||||
# conventional build. Only available, if a shared library is built.
|
||||
# This is primarily for people that only want to use the Python wrapper.
|
||||
###############################################################################
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
||||
set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5)
|
||||
find_package(PythonInterp) # Deprecated since version 3.12
|
||||
if(PYTHONINTERP_FOUND)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
else()
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
endif()
|
||||
if (Python_EXECUTABLE)
|
||||
add_custom_target(
|
||||
install-python ${CMAKE_COMMAND} -E remove_directory build
|
||||
COMMAND ${Python_EXECUTABLE} install.py -v ${LAMMPS_SOURCE_DIR}/version.h
|
||||
-p ${LAMMPS_PYTHON_DIR}/lammps
|
||||
-l ${CMAKE_BINARY_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR}
|
||||
COMMENT "Installing LAMMPS Python module")
|
||||
else()
|
||||
add_custom_target(
|
||||
install-python
|
||||
${CMAKE_COMMAND} -E echo "Must have Python installed to install the LAMMPS Python module")
|
||||
endif()
|
||||
else()
|
||||
add_custom_target(
|
||||
install-python
|
||||
${CMAKE_COMMAND} -E echo "Must build LAMMPS as a shared library to use the Python module")
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
# Add LAMMPS python module to "install" target. This is taylored for building
|
||||
# LAMMPS for package managers and with different prefix settings.
|
||||
# This requires either a shared library or that the PYTHON package is included.
|
||||
###############################################################################
|
||||
if(BUILD_SHARED_LIBS OR PKG_PYTHON)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
find_package(PythonInterp) # Deprecated since version 3.12
|
||||
if(PYTHONINTERP_FOUND)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
else()
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
endif()
|
||||
if (Python_EXECUTABLE)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python)
|
||||
install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} setup.py build -b ${CMAKE_BINARY_DIR}/python install --prefix=${CMAKE_INSTALL_PREFIX} --root=\$ENV{DESTDIR}/ WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(Testing)
|
||||
include(CodeCoverage)
|
||||
include(CodingStandard)
|
||||
|
||||
get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
|
||||
include(FeatureSummary)
|
||||
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
||||
message(STATUS "<<< Build configuration >>>
|
||||
Operating System: ${CMAKE_SYSTEM_NAME}
|
||||
Build type: ${CMAKE_BUILD_TYPE}
|
||||
Install path: ${CMAKE_INSTALL_PREFIX}
|
||||
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
||||
###############################################################################
|
||||
# Print package summary
|
||||
###############################################################################
|
||||
set(ENABLED_PACKAGES)
|
||||
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||
if(PKG_${PKG})
|
||||
list(APPEND ENABLED_PACKAGES ${PKG})
|
||||
endif()
|
||||
endforeach()
|
||||
if(ENABLED_PACKAGES)
|
||||
list(SORT ENABLED_PACKAGES)
|
||||
else()
|
||||
set(ENABLED_PACKAGES "<None>")
|
||||
endif()
|
||||
message(STATUS "Enabled packages: ${ENABLED_PACKAGES}")
|
||||
|
||||
message(STATUS "<<< Compilers and Flags: >>>
|
||||
-- C++ Compiler: ${CMAKE_CXX_COMPILER}
|
||||
Type: ${CMAKE_CXX_COMPILER_ID}
|
||||
Version: ${CMAKE_CXX_COMPILER_VERSION}
|
||||
C++ Flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}
|
||||
Defines: ${DEFINES}")
|
||||
get_target_property(OPTIONS lammps COMPILE_OPTIONS)
|
||||
if(OPTIONS)
|
||||
message(" Options: ${OPTIONS}")
|
||||
endif()
|
||||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
list (FIND LANGUAGES "Fortran" _index)
|
||||
if(${_index} GREATER -1)
|
||||
message(STATUS "Fortran Compiler: ${CMAKE_Fortran_COMPILER}
|
||||
Type: ${CMAKE_Fortran_COMPILER_ID}
|
||||
Version: ${CMAKE_Fortran_COMPILER_VERSION}
|
||||
Fortran Flags:${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BTYPE}}")
|
||||
endif()
|
||||
list (FIND LANGUAGES "C" _index)
|
||||
if(${_index} GREATER -1)
|
||||
message(STATUS "C compiler: ${CMAKE_C_COMPILER}
|
||||
Type: ${CMAKE_C_COMPILER_ID}
|
||||
Version: ${CMAKE_C_COMPILER_VERSION}
|
||||
C Flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BTYPE}}")
|
||||
endif()
|
||||
message(STATUS "<<< Linker flags: >>>")
|
||||
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
||||
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
||||
if(OPTIONS)
|
||||
message(STATUS "Linker options: ${OPTIONS}")
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_EXE_LINKER_FLAGS)
|
||||
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
message(STATUS "Shared library flags: ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
else()
|
||||
message(STATUS "Static library flags: ${CMAKE_STATIC_LINKER_FLAGS}")
|
||||
endif()
|
||||
if(BUILD_MPI)
|
||||
message(STATUS "<<< MPI flags >>>
|
||||
-- MPI_defines: ${MPI_CXX_COMPILE_DEFINITIONS}
|
||||
-- MPI includes: ${MPI_CXX_INCLUDE_PATH}
|
||||
-- MPI libraries: ${MPI_CXX_LIBRARIES};${MPI_Fortran_LIBRARIES}")
|
||||
endif()
|
||||
if(PKG_GPU)
|
||||
message(STATUS "<<< GPU package settings >>>
|
||||
-- GPU API: ${GPU_API}")
|
||||
if(GPU_API STREQUAL "CUDA")
|
||||
message(STATUS "GPU default architecture: ${GPU_ARCH}")
|
||||
elseif(GPU_API STREQUAL "HIP")
|
||||
message(STATUS "HIP platform: ${HIP_PLATFORM}")
|
||||
message(STATUS "HIP architecture: ${HIP_ARCH}")
|
||||
if(HIP_USE_DEVICE_SORT)
|
||||
message(STATUS "HIP GPU sorting: on")
|
||||
else()
|
||||
message(STATUS "HIP GPU sorting: off")
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "GPU precision: ${GPU_PREC}")
|
||||
endif()
|
||||
if(PKG_KOKKOS)
|
||||
message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}")
|
||||
endif()
|
||||
if(PKG_KSPACE)
|
||||
message(STATUS "<<< FFT settings >>>
|
||||
-- Primary FFT lib: ${FFT}")
|
||||
if(FFT_SINGLE)
|
||||
message(STATUS "Using single precision FFTs")
|
||||
else()
|
||||
message(STATUS "Using double precision FFTs")
|
||||
endif()
|
||||
if(FFT_FFTW_THREADS OR FFT_MKL_THREADS)
|
||||
message(STATUS "Using threaded FFTs")
|
||||
else()
|
||||
message(STATUS "Using non-threaded FFTs")
|
||||
endif()
|
||||
if(PKG_KOKKOS)
|
||||
if(Kokkos_ENABLE_CUDA)
|
||||
if (${FFT} STREQUAL "KISS")
|
||||
message(STATUS "Kokkos FFT: KISS")
|
||||
else()
|
||||
message(STATUS "Kokkos FFT: cuFFT")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Kokkos FFT: ${FFT}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_DOC)
|
||||
message(STATUS "<<< Building HTML Manual >>>")
|
||||
endif()
|
||||
if(BUILD_TOOLS)
|
||||
message(STATUS "<<< Building Tools >>>")
|
||||
endif()
|
||||
if(BUILD_LAMMPS_SHELL)
|
||||
message(STATUS "<<< Building LAMMPS Shell >>>")
|
||||
endif()
|
||||
if(ENABLE_TESTING)
|
||||
message(STATUS "<<< Building Unit Tests >>>")
|
||||
if(ENABLE_COVERAGE)
|
||||
message(STATUS "Collecting code coverage data")
|
||||
endif()
|
||||
endif()
|
||||
@ -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)
|
||||
@ -105,3 +104,13 @@ function(FetchPotentials pkgfolder potfolder)
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction(FetchPotentials)
|
||||
|
||||
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL Linux) AND (EXISTS /etc/os-release))
|
||||
file(STRINGS /etc/os-release distro REGEX "^NAME=")
|
||||
string(REGEX REPLACE "NAME=\"?([^\"]*)\"?" "\\1" distro "${distro}")
|
||||
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
|
||||
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
|
||||
set(CMAKE_LINUX_DISTRO ${distro})
|
||||
set(CMAKE_DISTRO_VERSION ${disversion})
|
||||
endif()
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -131,7 +131,7 @@ if(GPU_API STREQUAL "CUDA")
|
||||
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
||||
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
||||
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
||||
if(CUDPP_OPT)
|
||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
||||
@ -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}
|
||||
|
||||
@ -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)
|
||||
|
||||
26
cmake/Modules/Packages/USER-PACE.cmake
Normal file
26
cmake/Modules/Packages/USER-PACE.cmake
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.4.9.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||
set(PACELIB_MD5 "4db54962fbd6adcf8c18d46e1798ceb5" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
mark_as_advanced(PACELIB_URL)
|
||||
mark_as_advanced(PACELIB_MD5)
|
||||
|
||||
# download library sources to build folder
|
||||
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5})
|
||||
|
||||
# uncompress downloaded sources
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
|
||||
file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PACE)
|
||||
file(GLOB PACE_EVALUATOR_SOURCES ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PACE/*.cpp)
|
||||
list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp)
|
||||
|
||||
add_library(pace STATIC ${PACE_EVALUATOR_SOURCES})
|
||||
set_target_properties(pace PROPERTIES OUTPUT_NAME pace${LAMMPS_MACHINE})
|
||||
target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR})
|
||||
target_link_libraries(lammps PRIVATE pace)
|
||||
|
||||
@ -53,10 +53,17 @@ 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.1/plumed-src-2.7.1.tgz" CACHE STRING "URL for PLUMED tarball")
|
||||
set(PLUMED_MD5 "4eac6a462ec84dfe0cec96c82421b8e8" 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}
|
||||
|
||||
@ -16,11 +16,14 @@ if(ENABLE_TESTING)
|
||||
set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command")
|
||||
set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options")
|
||||
|
||||
# check if a faster linker is available.
|
||||
# only verified with GNU and Clang compilers and new CMake
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||
# we need to build and link a LOT of tester executables, so it is worth checking if
|
||||
# a faster linker is available. requires GNU or Clang compiler, newer CMake.
|
||||
# also only verified with Fedora Linux > 30 and Ubuntu <= 18.04 (Ubuntu 20.04 fails)
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL Linux) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
||||
AND ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")))
|
||||
if (((CMAKE_LINUX_DISTRO STREQUAL Ubuntu) AND (CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04))
|
||||
OR ((CMAKE_LINUX_DISTRO STREQUAL Fedora) AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30)))
|
||||
include(CheckCXXCompilerFlag)
|
||||
set(CMAKE_CUSTOM_LINKER_DEFAULT default)
|
||||
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -18,8 +18,8 @@ digraph lammps {
|
||||
Up [shape=box label="Update" color=blue]
|
||||
Un [shape=box label="Universe" color=blue]
|
||||
Ti [shape=box label="Timer" color=blue]
|
||||
Lt [label="Lattice"]
|
||||
Rg [label="Region" color=red]
|
||||
Lt [label="Lattice"]
|
||||
Rb [shape=box label="RegionBlock"]
|
||||
Rs [shape=box label="RegionSphere"]
|
||||
Av [label="AtomVec" color=red]
|
||||
@ -34,6 +34,7 @@ digraph lammps {
|
||||
Du [label="Dump" color=red]
|
||||
Fi [label="Fix" color=red]
|
||||
Cp [label="Compute" color=red]
|
||||
Cm [label="Command" color=red]
|
||||
Th [label="Thermo"]
|
||||
Va [label="Variable"]
|
||||
Ew [shape=box label="Ewald"]
|
||||
@ -71,16 +72,19 @@ digraph lammps {
|
||||
Dg [shape=box label="DumpCFG"]
|
||||
Ve [shape=box label="Verlet"]
|
||||
Rr [shape=box label="Respa"]
|
||||
Ru [shape=box label="Run"]
|
||||
Se [shape=box label="Set"]
|
||||
Pt [shape=box label="PPPMTIP4P"]
|
||||
Vs [shape=box label="VerletSplit"]
|
||||
Ro [shape=box label="RespaOMP"]
|
||||
Mc [shape=box label="MinCG"]
|
||||
Mf [shape=box label="MinFire"]
|
||||
La -> {At Ci Co Do Er Fo Gr In Me Mo Ne Ou Ti Up Un} [penwidth=2]
|
||||
Do -> {Lt Rg} [penwidth=2]
|
||||
Do -> {Rg Lt} [penwidth=2]
|
||||
Rg -> {Rb Rs} [style=dashed penwidth=2]
|
||||
Co -> {Cb Ct} [style=dashed penwidth=2]
|
||||
In -> Va [penwidth=2]
|
||||
In -> {Va Cm} [penwidth=2]
|
||||
Cm -> {Ru Se} [style=dashed penwidth=2]
|
||||
Mo -> {Fi Cp} [penwidth=2]
|
||||
Fo -> {Pa Bo An Di Im Ks} [penwidth=2]
|
||||
Ks -> {Ew Pp} [style=dashed penwidth=2]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
.TH LAMMPS "10 March 2021" "2021-03-10"
|
||||
.TH LAMMPS "8 April 2021" "2021-04-08"
|
||||
.SH NAME
|
||||
.B LAMMPS
|
||||
\- Molecular Dynamics Simulator.
|
||||
|
||||
@ -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>`
|
||||
|
||||
@ -52,6 +52,7 @@ This is the list of packages that may require additional steps.
|
||||
* :ref:`USER-MESONT <user-mesont>`
|
||||
* :ref:`USER-MOLFILE <user-molfile>`
|
||||
* :ref:`USER-NETCDF <user-netcdf>`
|
||||
* :ref:`USER-PACE <user-pace>`
|
||||
* :ref:`USER-PLUMED <user-plumed>`
|
||||
* :ref:`USER-OMP <user-omp>`
|
||||
* :ref:`USER-QMMM <user-qmmm>`
|
||||
@ -125,7 +126,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 +170,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)
|
||||
@ -1240,6 +1248,46 @@ be built for the most part with all major versions of the C++ language.
|
||||
|
||||
----------
|
||||
|
||||
.. _user-pace:
|
||||
|
||||
USER-PACE package
|
||||
-----------------------------
|
||||
|
||||
This package requires a library that can be downloaded and built
|
||||
in lib/pace or somewhere else, which must be done before building
|
||||
LAMMPS with this package. The code for the library can be found
|
||||
at: `https://github.com/ICAMS/lammps-user-pace/ <https://github.com/ICAMS/lammps-user-pace/>`_
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. tab:: CMake build
|
||||
|
||||
By default the library will be downloaded from the git repository
|
||||
and built automatically when the USER-PACE package is enabled with
|
||||
``-D PKG_USER-PACE=yes``. The location for the sources may be
|
||||
customized by setting the variable ``PACELIB_URL`` when
|
||||
configuring with CMake (e.g. to use a local archive on machines
|
||||
without internet access). Since CMake checks the validity of the
|
||||
archive with ``md5sum`` you may also need to set ``PACELIB_MD5``
|
||||
if you provide a different library version than what is downloaded
|
||||
automatically.
|
||||
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
You can download and build the USER-PACE library
|
||||
in one step from the ``lammps/src`` dir, using these commands,
|
||||
which invoke the ``lib/pace/Install.py`` script.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-pace # print help message
|
||||
$ make lib-pace args="-b" # download and build the default version in lib/pace
|
||||
|
||||
You should not need to edit the ``lib/pace/Makefile.lammps`` file.
|
||||
|
||||
----------
|
||||
|
||||
.. _user-plumed:
|
||||
|
||||
USER-PLUMED package
|
||||
|
||||
@ -30,17 +30,17 @@ steps, as explained on the :doc:`Build extras <Build_extras>` page.
|
||||
These links take you to the extra instructions for those select
|
||||
packages:
|
||||
|
||||
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`COMPRESS <compress>` | :ref:`GPU <gpu>` | :ref:`KIM <kim>` | :ref:`KOKKOS <kokkos>` | :ref:`LATTE <latte>` | :ref:`MESSAGE <message>` |
|
||||
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`MSCG <mscg>` | :ref:`OPT <opt>` | :ref:`POEMS <poems>` | :ref:`PYTHON <python>` | :ref:`VORONOI <voronoi>` | :ref:`USER-ADIOS <user-adios>` |
|
||||
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`USER-ATC <user-atc>` | :ref:`USER-AWPMD <user-awpmd>` | :ref:`USER-COLVARS <user-colvars>` | :ref:`USER-H5MD <user-h5md>` | :ref:`USER-INTEL <user-intel>` | :ref:`USER-MOLFILE <user-molfile>` |
|
||||
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`USER-NETCDF <user-netcdf>` | :ref:`USER-PLUMED <user-plumed>` | :ref:`USER-OMP <user-omp>` | :ref:`USER-QMMM <user-qmmm>` | :ref:`USER-QUIP <user-quip>` | :ref:`USER-SCAFACOS <user-scafacos>` |
|
||||
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`USER-SMD <user-smd>` | :ref:`USER-VTK <user-vtk>` | | | | |
|
||||
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
+--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`COMPRESS <compress>` | :ref:`GPU <gpu>` | :ref:`KIM <kim>` | :ref:`KOKKOS <kokkos>` | :ref:`LATTE <latte>` | :ref:`MESSAGE <message>` |
|
||||
+--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`MSCG <mscg>` | :ref:`OPT <opt>` | :ref:`POEMS <poems>` | :ref:`PYTHON <python>` | :ref:`VORONOI <voronoi>` | :ref:`USER-ADIOS <user-adios>` |
|
||||
+--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`USER-ATC <user-atc>` | :ref:`USER-AWPMD <user-awpmd>` | :ref:`USER-COLVARS <user-colvars>` | :ref:`USER-H5MD <user-h5md>` | :ref:`USER-INTEL <user-intel>` | :ref:`USER-MOLFILE <user-molfile>` |
|
||||
+--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`USER-NETCDF <user-netcdf>` | :ref:`USER-PACE <user-pace>` | :ref:`USER-PLUMED <user-plumed>` | :ref:`USER-OMP <user-omp>` | :ref:`USER-QMMM <user-qmmm>` | :ref:`USER-QUIP <user-quip>` |
|
||||
+--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
| :ref:`USER-SCAFACOS <user-scafacos>` | :ref:`USER-SMD <user-smd>` | :ref:`USER-VTK <user-vtk>` | | | |
|
||||
+--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+
|
||||
|
||||
The mechanism for including packages is simple but different for CMake
|
||||
versus make.
|
||||
|
||||
@ -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:
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@ OPT.
|
||||
* :doc:`bond/react <fix_bond_react>`
|
||||
* :doc:`bond/swap <fix_bond_swap>`
|
||||
* :doc:`box/relax <fix_box_relax>`
|
||||
* :doc:`charge/regulation <fix_charge_regulation>`
|
||||
* :doc:`client/md <fix_client_md>`
|
||||
* :doc:`cmap <fix_cmap>`
|
||||
* :doc:`colvars <fix_colvars>`
|
||||
|
||||
@ -26,6 +26,7 @@ OPT.
|
||||
* :doc:`zero <pair_zero>`
|
||||
* :doc:`hybrid (k) <pair_hybrid>`
|
||||
* :doc:`hybrid/overlay (k) <pair_hybrid>`
|
||||
* :doc:`hybrid/scaled <pair_hybrid>`
|
||||
* :doc:`kim <pair_kim>`
|
||||
* :doc:`list <pair_list>`
|
||||
*
|
||||
@ -33,7 +34,6 @@ OPT.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* :doc:`adp (o) <pair_adp>`
|
||||
* :doc:`agni (o) <pair_agni>`
|
||||
* :doc:`airebo (io) <pair_airebo>`
|
||||
@ -69,6 +69,7 @@ OPT.
|
||||
* :doc:`comb3 <pair_comb>`
|
||||
* :doc:`cosine/squared <pair_cosine_squared>`
|
||||
* :doc:`coul/cut (gko) <pair_coul>`
|
||||
* :doc:`coul/cut/global (o) <pair_coul>`
|
||||
* :doc:`coul/cut/soft (o) <pair_fep_soft>`
|
||||
* :doc:`coul/debye (gko) <pair_coul>`
|
||||
* :doc:`coul/diel (o) <pair_coul_diel>`
|
||||
@ -187,7 +188,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>`
|
||||
@ -215,6 +216,7 @@ OPT.
|
||||
* :doc:`oxrna2/stk <pair_oxrna2>`
|
||||
* :doc:`oxrna2/xstk <pair_oxrna2>`
|
||||
* :doc:`oxrna2/coaxstk <pair_oxrna2>`
|
||||
* :doc:`pace <pair_pace>`
|
||||
* :doc:`peri/eps <pair_peri>`
|
||||
* :doc:`peri/lps (o) <pair_peri>`
|
||||
* :doc:`peri/pmb (o) <pair_peri>`
|
||||
|
||||
@ -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
|
||||
|
||||
@ -49,8 +49,8 @@ underscore character '_' to separate words. Outside of bundled libraries
|
||||
which may have different conventions, all C and C++ header files have a
|
||||
``.h`` extension, all C++ files have a ``.cpp`` extension, and C files a
|
||||
``.c`` extension. A small number of C++ classes and utility functions
|
||||
are implemented with only a ``.h`` file. Examples are the Pointer class
|
||||
or the MathVec functions.
|
||||
are implemented with only a ``.h`` file. Examples are the Pointers and
|
||||
Commands classes or the MathVec functions.
|
||||
|
||||
Class topology
|
||||
--------------
|
||||
@ -144,7 +144,7 @@ implement specific commands that can be invoked before, after, or in
|
||||
between runs. For these an instance of the class is created, its
|
||||
command() method called and then, after completion, the class instance
|
||||
deleted. Examples for this are the create_box, create_atoms, minimize,
|
||||
run, or velocity command styles.
|
||||
run, set, or velocity command styles.
|
||||
|
||||
For all those ``styles`` certain naming conventions are employed: for
|
||||
the fix nve command the class is called FixNVE and the source files are
|
||||
@ -175,11 +175,11 @@ follows:
|
||||
- The Input class reads and processes input input strings and files,
|
||||
stores variables, and invokes :doc:`commands <Commands_all>`.
|
||||
|
||||
- As discussed above, command style classes are directly derived from
|
||||
the Pointers class. They provide input script commands that perform
|
||||
one-time operations before/after/between simulations or which invoke a
|
||||
simulation. They are instantiated from within the Input class,
|
||||
invoked, then immediately destructed.
|
||||
- Command style classes are derived from the Command class. They provide
|
||||
input script commands that perform one-time operations
|
||||
before/after/between simulations or which invoke a simulation. They
|
||||
are usually instantiated from within the Input class, its ``command``
|
||||
method invoked, and then immediately destructed.
|
||||
|
||||
- The Finish class is instantiated to print statistics to the screen
|
||||
after a simulation is performed, by commands like run and minimize.
|
||||
|
||||
251
doc/src/Developer_plugins.rst
Normal file
251
doc/src/Developer_plugins.rst
Normal file
@ -0,0 +1,251 @@
|
||||
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, improper or command styles
|
||||
* - creator.v2
|
||||
- Pointer to factory function for compute, fix, or region 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. command, 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.
|
||||
|
||||
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`` function 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``, however 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
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
Command styles also use the first variant of factory function as
|
||||
demonstrated in the following example, which also shows that the
|
||||
implementation of the plugin class may be within the same source
|
||||
file as the plugin interface code:
|
||||
|
||||
.. code-block:: C++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "command.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
class Hello : public Command {
|
||||
public:
|
||||
Hello(class LAMMPS *lmp) : Command(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)
|
||||
{
|
||||
return new Hello(lmp);
|
||||
}
|
||||
|
||||
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.1";
|
||||
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
|
||||
plugin.creator.v1 = (lammpsplugin_factory1 *) &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
|
||||
|
||||
@ -21,8 +21,8 @@ orientations and their associated inter-atomic distances.
|
||||
|
||||
The command :doc:`fix precession/spin <fix_precession_spin>` allows to
|
||||
apply a constant magnetic torque on all the spins in the system. This
|
||||
torque can be an external magnetic field (Zeeman interaction), or an
|
||||
uniaxial magnetic anisotropy.
|
||||
torque can be an external magnetic field (Zeeman interaction), and an
|
||||
uniaxial or cubic magnetic anisotropy.
|
||||
|
||||
A Langevin thermostat can be applied to those magnetic spins using
|
||||
:doc:`fix langevin/spin <fix_langevin_spin>`. Typically, this thermostat
|
||||
|
||||
@ -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".
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 286 KiB |
@ -76,7 +76,7 @@ It documents the following functions:
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_create_atoms(void *handle, int n, int *id, int *type, double *x, double *v, int *image, int bexpand)
|
||||
.. doxygenfunction:: lammps_create_atoms(void *handle, int n, const int *id, const int *type, const double *x, const double *v, const int *image, int bexpand)
|
||||
:project: progguide
|
||||
|
||||
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
Input script command style
|
||||
==========================
|
||||
|
||||
New commands can be added to LAMMPS input scripts by adding new
|
||||
classes that have a "command" method. For example, the create_atoms,
|
||||
read_data, velocity, and run commands are all implemented in this
|
||||
fashion. When such a command is encountered in the LAMMPS input
|
||||
script, LAMMPS simply creates a class with the corresponding name,
|
||||
invokes the "command" method of the class, and passes it the arguments
|
||||
from the input script. The command method can perform whatever
|
||||
operations it wishes on LAMMPS data structures.
|
||||
New commands can be added to LAMMPS input scripts by adding new classes
|
||||
that are derived from the Command class and thus must have a "command"
|
||||
method. For example, the create_atoms, read_data, velocity, and run
|
||||
commands are all implemented in this fashion. When such a command is
|
||||
encountered in the LAMMPS input script, LAMMPS simply creates a class
|
||||
instance with the corresponding name, invokes the "command" method of
|
||||
the class, and passes it the arguments from the input script. The
|
||||
command method can perform whatever operations it wishes on LAMMPS data
|
||||
structures.
|
||||
|
||||
The single method your new class must define is as follows:
|
||||
|
||||
|
||||
@ -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>`
|
||||
@ -89,6 +90,7 @@ page gives those details.
|
||||
* :ref:`USER-MOLFILE <PKG-USER-MOLFILE>`
|
||||
* :ref:`USER-NETCDF <PKG-USER-NETCDF>`
|
||||
* :ref:`USER-OMP <PKG-USER-OMP>`
|
||||
* :ref:`USER-PACE <PKG-USER-PACE>`
|
||||
* :ref:`USER-PHONON <PKG-USER-PHONON>`
|
||||
* :ref:`USER-PLUMED <PKG-USER-PLUMED>`
|
||||
* :ref:`USER-PTM <PKG-USER-PTM>`
|
||||
@ -584,7 +586,7 @@ MC package
|
||||
Several fixes and a pair style that have Monte Carlo (MC) or MC-like
|
||||
attributes. These include fixes for creating, breaking, and swapping
|
||||
bonds, for performing atomic swaps, and performing grand-canonical MC
|
||||
(GCMC) in conjunction with dynamics.
|
||||
(GCMC) or similar processes in conjunction with dynamics.
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
@ -592,8 +594,12 @@ bonds, for performing atomic swaps, and performing grand-canonical MC
|
||||
* :doc:`fix atom/swap <fix_atom_swap>`
|
||||
* :doc:`fix bond/break <fix_bond_break>`
|
||||
* :doc:`fix bond/create <fix_bond_create>`
|
||||
* :doc:`fix bond/create/angle <fix_bond_create>`
|
||||
* :doc:`fix bond/swap <fix_bond_swap>`
|
||||
* :doc:`fix charge/regulation <fix_charge_regulation>`
|
||||
* :doc:`fix gcmc <fix_gcmc>`
|
||||
* :doc:`fix tfmc <fix_tfmc>`
|
||||
* :doc:`fix widom <fix_widom>`
|
||||
* :doc:`pair_style dsmc <pair_dsmc>`
|
||||
* https://lammps.sandia.gov/movies.html#gcmc
|
||||
|
||||
@ -843,6 +849,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
|
||||
@ -1326,6 +1354,46 @@ This package has :ref:`specific installation instructions <user-colvars>` on the
|
||||
|
||||
----------
|
||||
|
||||
.. _PKG-USER-PACE:
|
||||
|
||||
USER-PACE package
|
||||
-------------------
|
||||
|
||||
**Contents:**
|
||||
|
||||
A pair style for the Atomic Cluster Expansion potential (ACE).
|
||||
ACE is a methodology for deriving a highly accurate classical potential
|
||||
fit to a large archive of quantum mechanical (DFT) data. The USER-PACE
|
||||
package provides an efficient implementation for running simulations
|
||||
with ACE potentials.
|
||||
|
||||
**Authors:**
|
||||
|
||||
This package was written by Yury Lysogorskiy^1,
|
||||
Cas van der Oord^2, Anton Bochkarev^1,
|
||||
Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1,
|
||||
Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1.
|
||||
|
||||
^1: Ruhr-University Bochum, Bochum, Germany
|
||||
|
||||
^2: University of Cambridge, Cambridge, United Kingdom
|
||||
|
||||
^3: Sandia National Laboratories, Albuquerque, New Mexico, USA
|
||||
|
||||
^4: University of British Columbia, Vancouver, BC, Canada
|
||||
|
||||
**Install:**
|
||||
|
||||
This package has :ref:`specific installation instructions <user-pace>` on the :doc:`Build extras <Build_extras>` page.
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
* src/USER-PACE: filenames -> commands
|
||||
* :doc:`pair_style pace <pair_pace>`
|
||||
* examples/USER/pace
|
||||
|
||||
----------
|
||||
|
||||
.. _PKG-USER-PLUMED:
|
||||
|
||||
USER-PLUMED package
|
||||
@ -2456,6 +2524,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 |
|
||||
|
||||
@ -81,6 +81,8 @@ package:
|
||||
+------------------------------------------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------+---------+
|
||||
| :ref:`USER-OMP <PKG-USER-OMP>` | OpenMP-enabled styles | :doc:`Speed omp <Speed_omp>` | `Benchmarks <https://lammps.sandia.gov/bench.html>`_ | no |
|
||||
+------------------------------------------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------+---------+
|
||||
| :ref:`USER-PACE <PKG-USER-PACE>` | Fast implementation of Atomic Cluster Expansion (ACE) potential | :doc:`pair pace <pair_pace>` | USER/pace | ext |
|
||||
+------------------------------------------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------+---------+
|
||||
| :ref:`USER-PHONON <PKG-USER-PHONON>` | phonon dynamical matrix | :doc:`fix phonon <fix_phonon>` | USER/phonon | no |
|
||||
+------------------------------------------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------+---------+
|
||||
| :ref:`USER-PLUMED <PKG-USER-PLUMED>` | :ref:`PLUMED <PLUMED>` free energy library | :doc:`fix plumed <fix_plumed>` | USER/plumed | ext |
|
||||
|
||||
@ -142,7 +142,7 @@ Style Constants
|
||||
Type Constants
|
||||
--------------
|
||||
|
||||
.. py:data:: LMP_TYPE_SCALAR, LMP_TYLE_VECTOR, LMP_TYPE_ARRAY, LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS
|
||||
.. py:data:: LMP_TYPE_SCALAR, LMP_TYPE_VECTOR, LMP_TYPE_ARRAY, LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS
|
||||
:type: int
|
||||
|
||||
Constants in the :py:mod:`lammps` module to select what type of data
|
||||
|
||||
@ -1,6 +1,43 @@
|
||||
Neighbor list access
|
||||
====================
|
||||
|
||||
Access to neighbor lists is handled through a couple of wrapper classes
|
||||
that allows to treat it like either a python list or a NumPy array. The
|
||||
access procedure is similar to that of the C-library interface: use one
|
||||
of the "find" functions to look up the index of the neighbor list in the
|
||||
global table of neighbor lists and then get access to the neighbor list
|
||||
data. The code sample below demonstrates reading the neighbor list data
|
||||
using the NumPy access method.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps
|
||||
import numpy as np
|
||||
|
||||
lmp = lammps()
|
||||
lmp.commands_string("""
|
||||
region box block -2 2 -2 2 -2 2
|
||||
lattice fcc 1.0
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
mass 1 1.0
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0
|
||||
run 0 post no""")
|
||||
|
||||
# look up the neighbor list
|
||||
nlidx = lmp.find_pair_neighlist('lj/cut')
|
||||
nl = lmp.numpy.get_neighlist(nlidx)
|
||||
tags = lmp.extract_atom('id')
|
||||
print("half neighbor list with {} entries".format(nl.size))
|
||||
# print neighbor list contents
|
||||
for i in range(0,nl.size):
|
||||
idx, nlist = nl.get(i)
|
||||
print("\natom {} with ID {} has {} neighbors:".format(idx,tags[idx],nlist.size))
|
||||
if nlist.size > 0:
|
||||
for n in np.nditer(nlist):
|
||||
print(" atom {} with ID {}".format(n,tags[n]))
|
||||
|
||||
**Methods:**
|
||||
|
||||
* :py:meth:`lammps.get_neighlist() <lammps.lammps.get_neighlist()>`: Get neighbor list for given index
|
||||
|
||||
@ -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).
|
||||
|
||||
@ -27,7 +27,7 @@ Syntax
|
||||
template-ID = ID of molecule template specified in a separate :doc:`molecule <molecule>` command
|
||||
*hybrid* args = list of one or more sub-styles, each with their args
|
||||
|
||||
* accelerated styles (with same args) = *angle/kk* or *atomic/kk* or *bond/kk* or *charge/kk* or *full/kk* or *molecular/kk*
|
||||
* accelerated styles (with same args) = *angle/kk* or *atomic/kk* or *bond/kk* or *charge/kk* or *full/kk* or *molecular/kk* or *spin/kk*
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
@ -257,7 +257,7 @@ factor, similar to how the :doc:`fix balance shift <fix_balance>`
|
||||
command operates.
|
||||
|
||||
The *dimstr* argument is a string of characters, each of which must be
|
||||
an "x" or "y" or "z". Eacn character can appear zero or one time,
|
||||
an "x" or "y" or "z". Each character can appear zero or one time,
|
||||
since there is no advantage to balancing on a dimension more than
|
||||
once. You should normally only list dimensions where you expect there
|
||||
to be a density variation in the particles.
|
||||
@ -285,7 +285,7 @@ plane gets closer to the target value.
|
||||
|
||||
After the balanced plane positions are determined, if any pair of
|
||||
adjacent planes are closer together than the neighbor skin distance
|
||||
(as specified by the :doc`neigh_modify <neigh_modify>` command), then
|
||||
(as specified by the :doc:`neigh_modify <neigh_modify>` command), then
|
||||
the plane positions are shifted to separate them by at least this
|
||||
amount. This is to prevent particles being lost when dynamics are run
|
||||
with processor sub-domains that are too narrow in one or more
|
||||
|
||||
@ -77,6 +77,7 @@ Commands
|
||||
pair_style
|
||||
pair_write
|
||||
partition
|
||||
plugin
|
||||
prd
|
||||
print
|
||||
processors
|
||||
|
||||
@ -46,13 +46,14 @@ system volume (or area in 2d). The second term is the virial, equal to
|
||||
-dU/dV, computed for all pairwise as well as 2-body, 3-body, 4-body,
|
||||
many-body, and long-range interactions, where :math:`r_i` and
|
||||
:math:`f_i` are the position and force vector of atom *i*, and the black
|
||||
dot indicates a dot product. When periodic boundary conditions are
|
||||
used, N' necessarily includes periodic image (ghost) atoms outside the
|
||||
central box, and the position and force vectors of ghost atoms are thus
|
||||
included in the summation. When periodic boundary conditions are not
|
||||
used, N' = N = the number of atoms in the system. :doc:`Fixes <fix>`
|
||||
that impose constraints (e.g. the :doc:`fix shake <fix_shake>` command)
|
||||
also contribute to the virial term.
|
||||
dot indicates a dot product. This is computed in parallel for each
|
||||
sub-domain and then summed over all parallel processes. Thus N'
|
||||
necessarily includes atoms from neighboring sub-domains (so-called ghost
|
||||
atoms) and the position and force vectors of ghost atoms are thus
|
||||
included in the summation. Only when running in serial and without
|
||||
periodic boundary conditions is N' = N = the number of atoms in the
|
||||
system. :doc:`Fixes <fix>` that impose constraints (e.g. the :doc:`fix
|
||||
shake <fix_shake>` command) may also contribute to the virial term.
|
||||
|
||||
A symmetric pressure tensor, stored as a 6-element vector, is also
|
||||
calculated by this compute. The 6 components of the vector are
|
||||
|
||||
@ -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
|
||||
|
||||
@ -308,9 +308,9 @@ performed with dump style *xtc*\ .
|
||||
|
||||
----------
|
||||
|
||||
The *format* keyword can be used to change the default numeric format
|
||||
output by the text-based dump styles: *atom*\ , *custom*\ , *cfg*\ , and
|
||||
*xyz* styles, and their MPIIO variants. Only the *line* or *none*
|
||||
The *format* keyword can be used to change the default numeric format output
|
||||
by the text-based dump styles: *atom*\ , *local*\ , *custom*\ , *cfg*\ , and
|
||||
*xyz* styles, and their MPIIO variants. Only the *line* or *none*
|
||||
options can be used with the *atom* and *xyz* styles.
|
||||
|
||||
All the specified format strings are C-style formats, e.g. as used by
|
||||
@ -362,7 +362,7 @@ settings, reverting all values to their default format.
|
||||
|
||||
compute 1 all property/local batom1 batom2
|
||||
dump 1 all local 100 tmp.bonds index c_1[1] c_1[2]
|
||||
dump_modify 1 format "%d %0.0f %0.0f"
|
||||
dump_modify 1 format line "%d %0.0f %0.0f"
|
||||
|
||||
will output the two atom IDs for atoms in each bond as integers. If
|
||||
the dump_modify command were omitted, they would appear as
|
||||
|
||||
@ -189,6 +189,7 @@ accelerated styles exist.
|
||||
* :doc:`bond/react <fix_bond_react>` - apply topology changes to model reactions
|
||||
* :doc:`bond/swap <fix_bond_swap>` - Monte Carlo bond swapping
|
||||
* :doc:`box/relax <fix_box_relax>` - relax box size during energy minimization
|
||||
* :doc:`charge/regulation <fix_charge_regulation>` - Monte Carlo sampling of charge regulation
|
||||
* :doc:`client/md <fix_client_md>` - MD client for client/server simulations
|
||||
* :doc:`cmap <fix_cmap>` - enables CMAP cross-terms of the CHARMM force field
|
||||
* :doc:`colvars <fix_colvars>` - interface to the collective variables "Colvars" library
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -138,8 +138,8 @@ vector or columns of the array had been listed one by one. E.g. these
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute myCOM all com/chunk
|
||||
fix 1 all ave/histo 100 1 100 c_myCOM[*] file tmp1.com mode vector
|
||||
fix 2 all ave/histo 100 1 100 c_myCOM[1] c_myCOM[2] c_myCOM[3] file tmp2.com mode vector
|
||||
fix 1 all ave/histo 100 1 100 -10.0 10.0 100 c_myCOM[*] file tmp1.com mode vector
|
||||
fix 2 all ave/histo 100 1 100 -10.0 10.0 100 c_myCOM[1] c_myCOM[2] c_myCOM[3] file tmp2.com mode vector
|
||||
|
||||
If the fix ave/histo/weight command is used, exactly two values must
|
||||
be specified. If the values are vectors, they must be the same
|
||||
|
||||
@ -216,7 +216,7 @@ above. It changes the positions of cutting planes between processors
|
||||
in an iterative fashion, seeking to reduce the imbalance factor.
|
||||
|
||||
The *dimstr* argument is a string of characters, each of which must be
|
||||
an "x" or "y" or "z". Eacn character can appear zero or one time,
|
||||
an "x" or "y" or "z". Each character can appear zero or one time,
|
||||
since there is no advantage to balancing on a dimension more than
|
||||
once. You should normally only list dimensions where you expect there
|
||||
to be a density variation in the particles.
|
||||
|
||||
276
doc/src/fix_charge_regulation.rst
Normal file
276
doc/src/fix_charge_regulation.rst
Normal file
@ -0,0 +1,276 @@
|
||||
|
||||
.. index:: fix charge/regulation
|
||||
|
||||
fix charge/regulation command
|
||||
=============================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
fix ID group-ID charge/regulation cation_type anion_type keyword value(s)
|
||||
|
||||
* ID, group-ID are documented in fix command
|
||||
* charge/regulation = style name of this fix command
|
||||
* cation_type = atom type of free cations
|
||||
* anion_type = atom type of free anions
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
keyword = *pH*, *pKa*, *pKb*, *pIp*, *pIm*, *pKs*, *acid_type*, *base_type*, *lunit_nm*, *temp*, *tempfixid*, *nevery*, *nmc*, *xrd*, *seed*, *tag*, *group*, *onlysalt*, *pmcmoves*
|
||||
*pH* value = pH of the solution
|
||||
*pKa* value = acid dissociation constant
|
||||
*pKb* value = base dissociation constant
|
||||
*pIp* value = chemical potential of free cations
|
||||
*pIm* value = chemical potential of free anions
|
||||
*pKs* value = solution self-dissociation constant
|
||||
*acid_type* = atom type of acid groups
|
||||
*base_type* = atom type of base groups
|
||||
*lunit_nm* value = unit length used by LAMMPS (# in the units of nanometers)
|
||||
*temp* value = temperature
|
||||
*tempfixid* value = fix ID of temperature thermostat
|
||||
*nevery* value = invoke this fix every nevery steps
|
||||
*nmc* value = number of charge regulation MC moves to attempt every nevery steps
|
||||
*xrd* value = cutoff distance for acid/base reaction
|
||||
*seed* value = random # seed (positive integer)
|
||||
*tag* value = yes or no (yes: The code assign unique tags to inserted ions; no: The tag of all inserted ions is "0")
|
||||
*group* value = group-ID, inserted ions are assigned to group group-ID. Can be used multiple times to assign inserted ions to multiple groups.
|
||||
*onlysalt* values = flag charge_cation charge_anion.
|
||||
flag = yes or no (yes: the fix performs only ion insertion/deletion, no: perform acid/base dissociation and ion insertion/deletion)
|
||||
charge_cation, charge_anion = value of cation/anion charge, must be an integer (only specify if flag = yes)
|
||||
*pmcmoves* values = pmcA pmcB pmcI - MC move fractions for acid ionization (pmcA), base ionization (pmcB) and free ion exchange (pmcI)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix chareg all charge/regulation 1 2 acid_type 3 base_type 4 pKa 5 pKb 7 lb 1.0 nevery 200 nexchange 200 seed 123 tempfixid fT
|
||||
|
||||
fix chareg all charge/regulation 1 2 pIp 3 pIm 3 onlysalt yes 2 -1 seed 123 tag yes temp 1.0
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
This fix performs Monte Carlo (MC) sampling of charge regulation and
|
||||
exchange of ions with a reservoir as discussed in :ref:`(Curk1) <Curk1>`
|
||||
and :ref:`(Curk2) <Curk2>`. The implemented method is largely analogous
|
||||
to the grand-reaction ensemble method in :ref:`(Landsgesell)
|
||||
<Landsgesell>`. The implementation is parallelized, compatible with
|
||||
existing LAMMPS functionalities, and applicable to any system utilizing
|
||||
discrete, ionizable groups or surface sites.
|
||||
|
||||
Specifically, the fix implements the following three types of MC moves,
|
||||
which discretely change the charge state of individual particles and
|
||||
insert ions into the systems: :math:`\mathrm{A} \rightleftharpoons
|
||||
\mathrm{A}^-+\mathrm{X}^+`, :math:`\mathrm{B} \rightleftharpoons
|
||||
\mathrm{B}^++\mathrm{X}^-`, and :math:`\emptyset \rightleftharpoons
|
||||
Z^-\mathrm{X}^{Z^+}+Z^+\mathrm{X}^{-Z^-}`. In the former two types of
|
||||
reactions, Monte Carlo moves alter the charge value of specific atoms
|
||||
(:math:`\mathrm{A}`, :math:`\mathrm{B}`) and simultaneously insert a
|
||||
counterion to preserve the charge neutrality of the system, modeling the
|
||||
dissociation/association process. The last type of reaction performs
|
||||
grand canonical MC exchange of ion pairs with a (fictitious) reservoir.
|
||||
|
||||
In our implementation "acid" refers to particles that can attain charge
|
||||
:math:`q=\{0,-1\}` and "base" to particles with :math:`q=\{0,1\}`,
|
||||
whereas the MC exchange of free ions allows any integer charge values of
|
||||
:math:`{Z^+}` and :math:`{Z^-}`.
|
||||
|
||||
Here we provide several practical examples for modeling charge
|
||||
regulation effects in solvated systems. An acid ionization reaction
|
||||
(:math:`\mathrm{A} \rightleftharpoons \mathrm{A}^-+\mathrm{H}^+`) can be
|
||||
defined via a single line in the input file
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix acid_reaction all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 5.0 pIp 7.0 pIm 7.0
|
||||
|
||||
where the fix attempts to charge :math:`\mathrm{A}` (discharge
|
||||
:math:`\mathrm{A}^-`) to :math:`\mathrm{A}^-` (:math:`\mathrm{A}`) and
|
||||
insert (delete) a proton (atom type 2). Besides, the fix implements
|
||||
self-ionization reaction of water :math:`\emptyset \rightleftharpoons
|
||||
\mathrm{H}^++\mathrm{OH}^-`. However, this approach is highly
|
||||
inefficient at :math:`\mathrm{pH} \approx 7` when the concentration of
|
||||
both protons and hydroxyl ions is low, resulting in a relatively low
|
||||
acceptance rate of MC moves.
|
||||
|
||||
A more efficient way is to allow salt ions to participate in ionization
|
||||
reactions, which can be easily achieved via
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix acid_reaction all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 5.0 pIp 2.0 pIm 2.0
|
||||
|
||||
where particles of atom type 4 and 5 are the salt cations and anions,
|
||||
both at chemical potential pI=2.0, see :ref:`(Curk1) <Curk1>` and
|
||||
:ref:`(Landsgesell) <Landsgesell>` for more details.
|
||||
|
||||
|
||||
Similarly, we could have simultaneously added a base ionization reaction
|
||||
(:math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{OH}^-`)
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix base_reaction all charge/regulation 2 3 base_type 6 pH 7.0 pKb 6.0 pIp 7.0 pIm 7.0
|
||||
|
||||
where the fix will attempt to charge :math:`\mathrm{B}` (discharge
|
||||
:math:`\mathrm{B}^+`) to :math:`\mathrm{B}^+` (:math:`\mathrm{B}`) and
|
||||
insert (delete) a hydroxyl ion :math:`\mathrm{OH}^-` of atom type 3. If
|
||||
neither the acid or the base type is specified, for example,
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix salt_reaction all charge/regulation 4 5 pIp 2.0 pIm 2.0
|
||||
|
||||
the fix simply inserts or deletes an ion pair of a free cation (atom
|
||||
type 4) and a free anion (atom type 5) as done in a conventional
|
||||
grand-canonical MC simulation.
|
||||
|
||||
|
||||
The fix is compatible with LAMMPS sub-packages such as *molecule* or
|
||||
*rigid*. That said, the acid and base particles can be part of larger
|
||||
molecules or rigid bodies. Free ions that are inserted to or deleted
|
||||
from the system must be defined as single particles (no bonded
|
||||
interactions allowed) and cannot be part of larger molecules or rigid
|
||||
bodies. If *molecule* package is used, all inserted ions have a molecule
|
||||
ID equal to zero.
|
||||
|
||||
Note that LAMMPS implicitly assumes a constant number of particles
|
||||
(degrees of freedom). Since using this fix alters the total number of
|
||||
particles during the simulation, any thermostat used by LAMMPS, such as
|
||||
NVT or Langevin, must use a dynamic calculation of system
|
||||
temperature. This can be achieved by specifying a dynamic temperature
|
||||
compute (e.g. dtemp) and using it with the desired thermostat, e.g. a
|
||||
Langevin thermostat:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute dtemp all temp
|
||||
compute_modify dtemp dynamic yes
|
||||
fix fT all langevin 1.0 1.0 1.0 123
|
||||
fix_modify fT temp dtemp
|
||||
|
||||
The chemical potential units (e.g. pH) are in the standard log10
|
||||
representation assuming reference concentration :math:`\rho_0 =
|
||||
\mathrm{mol}/\mathrm{l}`. Therefore, to perform the internal unit
|
||||
conversion, the length (in nanometers) of the LAMMPS unit length must be
|
||||
specified via *lunit_nm* (default is set to the Bjerrum length in water
|
||||
at room temperature *lunit_nm* = 0.71nm). For example, in the dilute
|
||||
ideal solution limit, the concentration of free ions will be
|
||||
:math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`.
|
||||
|
||||
The temperature used in MC acceptance probability is set by *temp*. This
|
||||
temperature should be the same as the temperature set by the molecular
|
||||
dynamics thermostat. For most purposes, it is probably best to use
|
||||
*tempfixid* keyword which dynamically sets the temperature equal to the
|
||||
chosen MD thermostat temperature, in the example above we assumed the
|
||||
thermostat fix-ID is *fT*. The inserted particles attain a random
|
||||
velocity corresponding to the specified temperature. Using *tempfixid*
|
||||
overrides any fixed temperature set by *temp*.
|
||||
|
||||
The *xrd* keyword can be used to restrict the inserted/deleted
|
||||
counterions to a specific radial distance from an acid or base particle
|
||||
that is currently participating in a reaction. This can be used to
|
||||
simulate more realist reaction dynamics. If *xrd* = 0 or *xrd* > *L* /
|
||||
2, where *L* is the smallest box dimension, the radial restriction is
|
||||
automatically turned off and free ion can be inserted or deleted
|
||||
anywhere in the simulation box.
|
||||
|
||||
If the *tag yes* is used, every inserted atom gets a unique tag ID,
|
||||
otherwise, the tag of every inserted atom is set to 0. *tag yes* might
|
||||
cause an integer overflow in very long simulations since the tags are
|
||||
unique to every particle and thus increase with every successful
|
||||
particle insertion.
|
||||
|
||||
The *pmcmoves* keyword sets the relative probability of attempting the
|
||||
three types of MC moves (reactions): acid charging, base charging, and
|
||||
ion pair exchange. The fix only attempts to perform particle charging
|
||||
MC moves if *acid_type* or *base_type* is defined. Otherwise fix only
|
||||
performs free ion insertion/deletion. For example, if *acid_type* is not
|
||||
defined, *pmcA* is automatically set to 0. The vector *pmcmoves* is
|
||||
automatically normalized, for example, if set to *pmcmoves* 0 0.33 0.33,
|
||||
the vector would be normalized to [0,0.5,0.5].
|
||||
|
||||
The *only_salt* option can be used to perform multivalent
|
||||
grand-canonical ion-exchange moves. If *only_salt yes* is used, no
|
||||
charge exchange is performed, only ion insertion/deletion (*pmcmoves* is
|
||||
set to [0,0,1]), but ions can be multivalent. In the example above, an
|
||||
MC move would consist of three ion insertion/deletion to preserve the
|
||||
charge neutrality of the system.
|
||||
|
||||
The *group* keyword can be used to add inserted particles to a specific
|
||||
group-ID. All inserted particles are automatically added to group *all*.
|
||||
|
||||
|
||||
Output
|
||||
""""""
|
||||
|
||||
This fix computes a global vector of length 8, which can be accessed by
|
||||
various output commands. The vector values are the following global
|
||||
quantities:
|
||||
|
||||
* 1 = cumulative MC attempts
|
||||
* 2 = cumulative MC successes
|
||||
* 3 = current # of neutral acid atoms
|
||||
* 4 = current # of -1 charged acid atoms
|
||||
* 5 = current # of neutral base atoms
|
||||
* 6 = current # of +1 charged base atoms
|
||||
* 7 = current # of free cations
|
||||
* 8 = current # of free anions
|
||||
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This fix is part of the MC package. It is only enabled if LAMMPS
|
||||
was built with that package. See the :doc:`Build package
|
||||
<Build_package>` doc page for more info.
|
||||
|
||||
The :doc:`atom_style <atom_style>`, used must contain the charge
|
||||
property, for example, the style could be *charge* or *full*. Only
|
||||
usable for 3D simulations. Atoms specified as free ions cannot be part
|
||||
of rigid bodies or molecules and cannot have bonding interactions. The
|
||||
scheme is limited to integer charges, any atoms with non-integer charges
|
||||
will not be considered by the fix.
|
||||
|
||||
All interaction potentials used must be continuous, otherwise the MD
|
||||
integration and the particle exchange MC moves do not correspond to the
|
||||
same equilibrium ensemble. For example, if an lj/cut pair style is used,
|
||||
the LJ potential must be shifted so that it vanishes at the cutoff. This
|
||||
can be easily achieved using the :doc:`pair_modify <pair_modify>`
|
||||
command, i.e., by using: *pair_modify shift yes*.
|
||||
|
||||
.. note::
|
||||
|
||||
Region restrictions are not yet implemented.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix gcmc <fix_gcmc>`,
|
||||
:doc:`fix atom/swap <fix_atom_swap>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs = 14.0;
|
||||
acid_type = -1; base_type = -1; lunit_nm = 0.71; temp = 1.0; nevery =
|
||||
100; nmc = 100; xrd = 0; seed = 0; tag = no; onlysalt = no, pmcmoves =
|
||||
[1/3, 1/3, 1/3], group-ID = all
|
||||
|
||||
----------
|
||||
|
||||
.. _Curk1:
|
||||
|
||||
**(Curk1)** T. Curk, J. Yuan, and E. Luijten, "Coarse-grained simulation of charge regulation using LAMMPS", preprint (2021).
|
||||
|
||||
.. _Curk2:
|
||||
|
||||
**(Curk2)** T. Curk and E. Luijten, "Charge-regulation effects in nanoparticle self-assembly", PRL (2021)
|
||||
|
||||
.. _Landsgesell:
|
||||
|
||||
**(Landsgesell)** J. Landsgesell, P. Hebbeker, O. Rud, R. Lunkad, P. Kosovan, and C. Holm, "Grand-reaction method for simulations of ionization equilibria coupled to ion partitioning", Macromolecules 53, 3007-3020 (2020).
|
||||
@ -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
|
||||
|
||||
@ -12,7 +12,7 @@ Syntax
|
||||
|
||||
* ID, group are documented in :doc:`fix <fix>` command
|
||||
* precession/spin = style name of this fix command
|
||||
* style = *zeeman* or *anisotropy* or *cubic*
|
||||
* style = *zeeman* or *anisotropy* or *cubic* or *stt*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -22,12 +22,12 @@ Syntax
|
||||
*anisotropy* args = K x y z
|
||||
K = intensity of the magnetic anisotropy (in eV)
|
||||
x y z = vector direction of the anisotropy
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*cubic* args = K1 K2c n1x n1y n1x n2x n2y n2z n3x n3y n3z
|
||||
K1 and K2c = intensity of the magnetic anisotropy (in eV)
|
||||
n1x to n3z = three direction vectors of the cubic anisotropy
|
||||
*stt* args = J x y z
|
||||
J = intensity of the spin-transfer torque field
|
||||
x y z = vector direction of the field
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -125,6 +125,11 @@ axis along the :math:`(1 1 1)`-type cube diagonals). :math:`K_2^c >
|
||||
diagonals. See chapter 2 of :ref:`(Skomski) <Skomski1>` for more
|
||||
details on cubic anisotropies.
|
||||
|
||||
Style *stt* is used to simulate the interaction between the spins and
|
||||
a spin-transfer torque.
|
||||
See equation (7) of :ref:`(Chirac) <Chirac1>` for more details about the
|
||||
implemented spin-transfer torque term.
|
||||
|
||||
In all cases, the choice of :math:`(x y z)` only imposes the vector
|
||||
directions for the forces. Only the direction of the vector is
|
||||
important; its length is ignored (the entered vectors are
|
||||
@ -132,6 +137,16 @@ normalized).
|
||||
|
||||
Those styles can be combined within one single command line.
|
||||
|
||||
.. note::
|
||||
|
||||
The norm of all vectors defined with the precession/spin command
|
||||
have to be non-zero. For example, defining
|
||||
"fix 1 all precession/spin zeeman 0.1 0.0 0.0 0.0" would result
|
||||
in an error message.
|
||||
Since those vector components are used to compute the inverse of the
|
||||
field (or anisotropy) vector norm, setting a zero-vector would result
|
||||
in a division by zero.
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
@ -162,11 +177,6 @@ is only enabled if LAMMPS was built with this package, and if the
|
||||
atom_style "spin" was declared. See the :doc:`Build package
|
||||
<Build_package>` doc page for more info.
|
||||
|
||||
The *precession/spin* style can only be declared once. If more than
|
||||
one precession type (for example combining an anisotropy and a Zeeman
|
||||
interactions) has to be declared, they have to be chained in the same
|
||||
command line (as shown in the examples above).
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
@ -184,3 +194,9 @@ none
|
||||
|
||||
**(Skomski)** Skomski, R. (2008). Simple models of magnetism.
|
||||
Oxford University Press.
|
||||
|
||||
.. _Chirac1:
|
||||
|
||||
**(Chirac)** Chirac, Théophile, et al. Ultrafast antiferromagnetic
|
||||
switching in NiO induced by spin transfer torques.
|
||||
Physical Review B 102.13 (2020): 134415.
|
||||
|
||||
@ -56,27 +56,28 @@ Examples
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Perform the charge equilibration (QEq) method as described in :ref:`(Rappe and Goddard) <Rappe1>` and formulated in :ref:`(Nakano) <Nakano1>` (also known
|
||||
as the matrix inversion method) and in :ref:`(Rick and Stuart) <Rick1>` (also
|
||||
known as the extended Lagrangian method) based on the
|
||||
electronegativity equilization principle.
|
||||
Perform the charge equilibration (QEq) method as described in
|
||||
:ref:`(Rappe and Goddard) <Rappe1>` and formulated in :ref:`(Nakano)
|
||||
<Nakano1>` (also known as the matrix inversion method) and in
|
||||
:ref:`(Rick and Stuart) <Rick1>` (also known as the extended Lagrangian
|
||||
method) based on the electronegativity equilization principle.
|
||||
|
||||
These fixes can be used with any :doc:`pair style <pair_style>` in
|
||||
LAMMPS, so long as per-atom charges are defined. The most typical
|
||||
use-case is in conjunction with a :doc:`pair style <pair_style>` that
|
||||
performs charge equilibration periodically (e.g. every timestep), such
|
||||
as the ReaxFF or Streitz-Mintmire potential.
|
||||
But these fixes can also be used with
|
||||
potentials that normally assume per-atom charges are fixed, e.g. a
|
||||
:doc:`Buckingham <pair_buck>` or :doc:`LJ/Coulombic <pair_lj>` potential.
|
||||
as the ReaxFF or Streitz-Mintmire potential. But these fixes can also
|
||||
be used with potentials that normally assume per-atom charges are fixed,
|
||||
e.g. a :doc:`Buckingham <pair_buck>` or :doc:`LJ/Coulombic <pair_lj>`
|
||||
potential.
|
||||
|
||||
Because the charge equilibration calculation is effectively
|
||||
independent of the pair style, these fixes can also be used to perform
|
||||
a one-time assignment of charges to atoms. For example, you could
|
||||
define the QEq fix, perform a zero-timestep run via the :doc:`run <run>`
|
||||
command without any pair style defined which would set per-atom
|
||||
charges (based on the current atom configuration), then remove the fix
|
||||
via the :doc:`unfix <unfix>` command before performing further dynamics.
|
||||
Because the charge equilibration calculation is effectively independent
|
||||
of the pair style, these fixes can also be used to perform a one-time
|
||||
assignment of charges to atoms. For example, you could define the QEq
|
||||
fix, perform a zero-timestep run via the :doc:`run <run>` command
|
||||
without any pair style defined which would set per-atom charges (based
|
||||
on the current atom configuration), then remove the fix via the
|
||||
:doc:`unfix <unfix>` command before performing further dynamics.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -87,11 +88,14 @@ via the :doc:`unfix <unfix>` command before performing further dynamics.
|
||||
|
||||
.. note::
|
||||
|
||||
The :doc:`fix qeq/comb <fix_qeq_comb>` command must still be used
|
||||
to perform charge equilibration with the :doc:`COMB potential <pair_comb>`. The :doc:`fix qeq/reax <fix_qeq_reax>`
|
||||
command can be used to perform charge equilibration with the :doc:`ReaxFF force field <pair_reaxc>`, although fix qeq/shielded yields the
|
||||
same results as fix qeq/reax if *Nevery*\ , *cutoff*\ , and *tolerance*
|
||||
are the same. Eventually the fix qeq/reax command will be deprecated.
|
||||
The :doc:`fix qeq/comb <fix_qeq_comb>` command must still be used to
|
||||
perform charge equilibration with the :doc:`COMB potential
|
||||
<pair_comb>`. The :doc:`fix qeq/reax <fix_qeq_reax>` command can be
|
||||
used to perform charge equilibration with the :doc:`ReaxFF force
|
||||
field <pair_reaxc>`, although fix qeq/shielded yields the same
|
||||
results as fix qeq/reax if *Nevery*\ , *cutoff*\ , and *tolerance*
|
||||
are the same. Eventually the fix qeq/reax command will be
|
||||
deprecated.
|
||||
|
||||
The QEq method minimizes the electrostatic energy of the system (or
|
||||
equalizes the derivative of energy with respect to charge of all the
|
||||
@ -134,55 +138,57 @@ usually a good number.
|
||||
The *qeq/shielded* style describes partial charges on atoms also as
|
||||
point charges, but uses a shielded Coulomb potential to describe the
|
||||
interaction between a pair of charged particles. Interaction through
|
||||
the shielded Coulomb is given by equation (13) of the :ref:`ReaxFF force field <vanDuin>` paper. The shielding accounts for charge overlap
|
||||
the shielded Coulomb is given by equation (13) of the :ref:`ReaxFF force
|
||||
field <vanDuin>` paper. The shielding accounts for charge overlap
|
||||
between charged particles at small separation. This style is the same
|
||||
as :doc:`fix qeq/reax <fix_qeq_reax>`, and can be used with :doc:`pair_style reax/c <pair_reaxc>`. Only the *chi*\ , *eta*\ , and *gamma*
|
||||
parameters from the *qfile* file are used. When using the string
|
||||
*reax/c* as filename, these parameters are extracted directly from
|
||||
an active *reax/c* pair style. This style solves partial
|
||||
charges on atoms via the matrix inversion method. A tolerance of
|
||||
1.0e-6 is usually a good number.
|
||||
as :doc:`fix qeq/reax <fix_qeq_reax>`, and can be used with
|
||||
:doc:`pair_style reax/c <pair_reaxc>`. Only the *chi*\ , *eta*\ , and
|
||||
*gamma* parameters from the *qfile* file are used. When using the string
|
||||
*reax/c* as filename, these parameters are extracted directly from an
|
||||
active *reax/c* pair style. This style solves partial charges on atoms
|
||||
via the matrix inversion method. A tolerance of 1.0e-6 is usually a
|
||||
good number.
|
||||
|
||||
The *qeq/slater* style describes partial charges on atoms as spherical
|
||||
charge densities centered around atoms via the Slater 1\ *s* orbital, so
|
||||
that the interaction between a pair of charged particles is the
|
||||
product of two Slater 1\ *s* orbitals. The expression for the Slater
|
||||
1\ *s* orbital is given under equation (6) of the
|
||||
:ref:`Streitz-Mintmire <Streitz1>` paper. Only the *chi*\ , *eta*\ , *zeta*\ , and
|
||||
*qcore* parameters from the *qfile* file are used. When using the string
|
||||
that the interaction between a pair of charged particles is the product
|
||||
of two Slater 1\ *s* orbitals. The expression for the Slater 1\ *s*
|
||||
orbital is given under equation (6) of the :ref:`Streitz-Mintmire
|
||||
<Streitz1>` paper. Only the *chi*\ , *eta*\ , *zeta*\ , and *qcore*
|
||||
parameters from the *qfile* file are used. When using the string
|
||||
*coul/streitz* as filename, these parameters are extracted directly from
|
||||
an active *coul/streitz* pair style. This style solves
|
||||
partial charges on atoms via the matrix inversion method. A tolerance
|
||||
of 1.0e-6 is usually a good number. Keyword *alpha* can be used to
|
||||
change the Slater type orbital exponent.
|
||||
an active *coul/streitz* pair style. This style solves partial charges
|
||||
on atoms via the matrix inversion method. A tolerance of 1.0e-6 is
|
||||
usually a good number. Keyword *alpha* can be used to change the Slater
|
||||
type orbital exponent.
|
||||
|
||||
The *qeq/dynamic* style describes partial charges on atoms as point
|
||||
charges that interact through 1/r, but the extended Lagrangian method
|
||||
is used to solve partial charges on atoms. Only the *chi* and *eta*
|
||||
charges that interact through 1/r, but the extended Lagrangian method is
|
||||
used to solve partial charges on atoms. Only the *chi* and *eta*
|
||||
parameters from the *qfile* file are used. Note that Coulomb
|
||||
catastrophe can occur if repulsion between the pair of charged
|
||||
particles is too weak. A tolerance of 1.0e-3 is usually a good
|
||||
number. Keyword *qdamp* can be used to change the damping factor, while
|
||||
keyword *qstep* can be used to change the time step size.
|
||||
catastrophe can occur if repulsion between the pair of charged particles
|
||||
is too weak. A tolerance of 1.0e-3 is usually a good number. Keyword
|
||||
*qdamp* can be used to change the damping factor, while keyword *qstep*
|
||||
can be used to change the time step size.
|
||||
|
||||
The :ref:`\ *qeq/fire*\ <Shan>` style describes the same charge model and charge
|
||||
solver as the *qeq/dynamic* style, but employs a FIRE minimization
|
||||
algorithm to solve for equilibrium charges.
|
||||
Keyword *qdamp* can be used to change the damping factor, while
|
||||
keyword *qstep* can be used to change the time step size.
|
||||
The :ref:`\ *qeq/fire*\ <Shan>` style describes the same charge model
|
||||
and charge solver as the *qeq/dynamic* style, but employs a FIRE
|
||||
minimization algorithm to solve for equilibrium charges. Keyword
|
||||
*qdamp* can be used to change the damping factor, while keyword *qstep*
|
||||
can be used to change the time step size.
|
||||
|
||||
Note that *qeq/point*\ , *qeq/shielded*\ , and *qeq/slater* describe
|
||||
different charge models, whereas the matrix inversion method and the
|
||||
extended Lagrangian method (\ *qeq/dynamic* and *qeq/fire*\ ) are
|
||||
different solvers.
|
||||
|
||||
Note that *qeq/point*\ , *qeq/dynamic* and *qeq/fire* styles all describe
|
||||
charges as point charges that interact through 1/r relationship, but
|
||||
solve partial charges on atoms using different solvers. These three
|
||||
styles should yield comparable results if
|
||||
the QEq parameters and *Nevery*\ , *cutoff*\ , and *tolerance* are the
|
||||
same. Style *qeq/point* is typically faster, *qeq/dynamic* scales
|
||||
better on larger sizes, and *qeq/fire* is faster than *qeq/dynamic*\ .
|
||||
Note that *qeq/point*\ , *qeq/dynamic* and *qeq/fire* styles all
|
||||
describe charges as point charges that interact through 1/r
|
||||
relationship, but solve partial charges on atoms using different
|
||||
solvers. These three styles should yield comparable results if the QEq
|
||||
parameters and *Nevery*\ , *cutoff*\ , and *tolerance* are the same.
|
||||
Style *qeq/point* is typically faster, *qeq/dynamic* scales better on
|
||||
larger sizes, and *qeq/fire* is faster than *qeq/dynamic*\ .
|
||||
|
||||
.. note::
|
||||
|
||||
@ -200,9 +206,11 @@ better on larger sizes, and *qeq/fire* is faster than *qeq/dynamic*\ .
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about these fixes is written to :doc:`binary restart files <restart>`. No global scalar or vector or per-atom
|
||||
quantities are stored by these fixes for access by various :doc:`output commands <Howto_output>`. No parameter of these fixes can be used
|
||||
with the *start/stop* keywords of the :doc:`run <run>` command.
|
||||
No information about these fixes is written to :doc:`binary restart
|
||||
files <restart>`. No global scalar or vector or per-atom quantities are
|
||||
stored by these fixes for access by various :doc:`output commands
|
||||
<Howto_output>`. No parameter of these fixes can be used with the
|
||||
*start/stop* keywords of the :doc:`run <run>` command.
|
||||
|
||||
Thexe fixes are invoked during :doc:`energy minimization <minimize>`.
|
||||
|
||||
@ -210,7 +218,8 @@ Restrictions
|
||||
""""""""""""
|
||||
|
||||
These fixes are part of the QEQ package. They are only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` doc page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
@ -29,6 +29,7 @@ Syntax
|
||||
gamma_t = damping coefficient for collisions in tangential direction (1/time units or 1/time-distance units - see discussion below)
|
||||
xmu = static yield criterion (unitless value between 0.0 and 1.0e4)
|
||||
dampflag = 0 or 1 if tangential damping force is excluded or included
|
||||
optional keyword = *limit_damping*, limit damping to prevent attractive interaction
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -95,7 +96,8 @@ Specifically, delta = radius - r = overlap of particle with wall, m_eff
|
||||
= mass of particle, and the effective radius of contact = RiRj/Ri+Rj is
|
||||
set to the radius of the particle.
|
||||
|
||||
The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu* and *dampflag*
|
||||
The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu*, *dampflag*,
|
||||
and the optional keyword *limit_damping*
|
||||
have the same meaning and units as those specified with the
|
||||
:doc:`pair_style gran/\* <pair_gran>` commands. This means a NULL can be
|
||||
used for either *Kt* or *gamma_t* as described on that page. If a
|
||||
|
||||
@ -181,7 +181,8 @@ radius - r = overlap of particle with wall, m_eff = mass of particle,
|
||||
and the effective radius of contact is just the radius of the
|
||||
particle.
|
||||
|
||||
The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu* and *dampflag*
|
||||
The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu*, *dampflag*,
|
||||
and the optional keyword *limit_damping*
|
||||
have the same meaning and units as those specified with the
|
||||
:doc:`pair_style gran/\* <pair_gran>` commands. This means a NULL can be
|
||||
used for either *Kt* or *gamma_t* as described on that page. If a
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
.. index:: pair_style coul/dsf/gpu
|
||||
.. index:: pair_style coul/dsf/kk
|
||||
.. index:: pair_style coul/dsf/omp
|
||||
.. index:: pair_style coul/cut/global
|
||||
.. index:: pair_style coul/cut/global/omp
|
||||
.. index:: pair_style coul/long
|
||||
.. index:: pair_style coul/long/omp
|
||||
.. index:: pair_style coul/long/kk
|
||||
@ -40,6 +42,11 @@ pair_style coul/dsf command
|
||||
|
||||
Accelerator Variants: *coul/dsf/gpu*, *coul/dsf/kk*, *coul/dsf/omp*
|
||||
|
||||
pair_style coul/cut/global command
|
||||
==================================
|
||||
|
||||
Accelerator Variants: *coul/cut/omp*
|
||||
|
||||
pair_style coul/long command
|
||||
============================
|
||||
|
||||
@ -76,8 +83,8 @@ Syntax
|
||||
pair_style coul/cut cutoff
|
||||
pair_style coul/debye kappa cutoff
|
||||
pair_style coul/dsf alpha cutoff
|
||||
pair_style coul/cut/global cutoff
|
||||
pair_style coul/long cutoff
|
||||
pair_style coul/long/gpu cutoff
|
||||
pair_style coul/wolf alpha cutoff
|
||||
pair_style coul/streitz cutoff keyword alpha
|
||||
pair_style tip4p/cut otype htype btype atype qdist cutoff
|
||||
@ -245,6 +252,11 @@ Streitz-Mintmire parameterization for the material being modeled.
|
||||
|
||||
----------
|
||||
|
||||
Pair style *coul/cut/global* computes the same Coulombic interactions
|
||||
as style *coul/cut* except that it allows only a single global cutoff
|
||||
and thus makes it compatible for use in combination with long-range
|
||||
coulomb styles in :doc:`hybrid pair styles <pair_hybrid>`.
|
||||
|
||||
Styles *coul/long* and *coul/msm* compute the same Coulombic
|
||||
interactions as style *coul/cut* except that an additional damping
|
||||
factor is applied so it can be used in conjunction with the
|
||||
|
||||
@ -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
|
||||
|
||||
@ -26,7 +26,7 @@ Syntax
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style style Kn Kt gamma_n gamma_t xmu dampflag
|
||||
pair_style style Kn Kt gamma_n gamma_t xmu dampflag keyword
|
||||
|
||||
* style = *gran/hooke* or *gran/hooke/history* or *gran/hertz/history*
|
||||
* Kn = elastic constant for normal particle repulsion (force/distance units or pressure units - see discussion below)
|
||||
@ -36,6 +36,13 @@ Syntax
|
||||
* xmu = static yield criterion (unitless value between 0.0 and 1.0e4)
|
||||
* dampflag = 0 or 1 if tangential damping force is excluded or included
|
||||
|
||||
* keyword = *limit_damping*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*limit_damping* value = none
|
||||
limit damping to prevent attractive interaction
|
||||
|
||||
.. note::
|
||||
|
||||
Versions of LAMMPS before 9Jan09 had different style names for
|
||||
@ -54,6 +61,8 @@ Examples
|
||||
|
||||
pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 1
|
||||
pair_style gran/hooke 200000.0 70000.0 50.0 30.0 0.5 0
|
||||
pair_style gran/hooke 200000.0 70000.0 50.0 30.0 0.5 0 limit_damping
|
||||
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
@ -208,6 +217,12 @@ potential is used as a sub-style of :doc:`pair_style hybrid <pair_hybrid>`, then
|
||||
pair_coeff command to determine which atoms interact via a granular
|
||||
potential.
|
||||
|
||||
If two particles are moving away from each other while in contact, there
|
||||
is a possibility that the particles could experience an effective attractive
|
||||
force due to damping. If the *limit_damping* keyword is used, this option
|
||||
will zero out the normal component of the force if there is an effective
|
||||
attractive force.
|
||||
|
||||
----------
|
||||
|
||||
.. include:: accel_styles.rst
|
||||
|
||||
@ -24,7 +24,7 @@ Examples
|
||||
pair_coeff * * hooke 1000.0 50.0 tangential linear_history 500.0 1.0 0.4 damping mass_velocity
|
||||
|
||||
pair_style granular
|
||||
pair_coeff * * hertz 1000.0 50.0 tangential mindlin 1000.0 1.0 0.4
|
||||
pair_coeff * * hertz 1000.0 50.0 tangential mindlin 1000.0 1.0 0.4 limit_damping
|
||||
|
||||
pair_style granular
|
||||
pair_coeff * * hertz/material 1e8 0.3 0.3 tangential mindlin_rescale NULL 1.0 0.4 damping tsuji
|
||||
@ -623,6 +623,14 @@ Finally, the twisting torque on each particle is given by:
|
||||
|
||||
----------
|
||||
|
||||
If two particles are moving away from each other while in contact, there
|
||||
is a possibility that the particles could experience an effective attractive
|
||||
force due to damping. If the optional *limit_damping* keyword is used, this option
|
||||
will zero out the normal component of the force if there is an effective
|
||||
attractive force. This keyword cannot be used with the JKR or DMT models.
|
||||
|
||||
----------
|
||||
|
||||
The *granular* pair style can reproduce the behavior of the
|
||||
*pair gran/\** styles with the appropriate settings (some very
|
||||
minor differences can be expected due to corrections in
|
||||
@ -657,6 +665,12 @@ then LAMMPS will use that cutoff for the specified atom type
|
||||
combination, and automatically set pairwise cutoffs for the remaining
|
||||
atom types.
|
||||
|
||||
If two particles are moving away from each other while in contact, there
|
||||
is a possibility that the particles could experience an effective attractive
|
||||
force due to damping. If the *limit_damping* keyword is used, this option
|
||||
will zero out the normal component of the force if there is an effective
|
||||
attractive force. This keyword cannot be used with the JKR or DMT models.
|
||||
|
||||
----------
|
||||
|
||||
.. include:: accel_styles.rst
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
.. index:: pair_style hybrid/kk
|
||||
.. index:: pair_style hybrid/overlay
|
||||
.. index:: pair_style hybrid/overlay/kk
|
||||
.. index:: pair_style hybrid/scaled
|
||||
|
||||
pair_style hybrid command
|
||||
=========================
|
||||
@ -13,6 +14,9 @@ pair_style hybrid/overlay command
|
||||
|
||||
Accelerator Variants: *hybrid/overlay/kk*
|
||||
|
||||
pair_style hybrid/scaled command
|
||||
==================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
@ -20,8 +24,10 @@ Syntax
|
||||
|
||||
pair_style hybrid style1 args style2 args ...
|
||||
pair_style hybrid/overlay style1 args style2 args ...
|
||||
pair_style hybrid/scaled factor1 style1 args factor2 style 2 args ...
|
||||
|
||||
* style1,style2 = list of one or more pair styles and their arguments
|
||||
* factor1,factor2 = scale factors for pair styles, may be a variable
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -37,47 +43,73 @@ Examples
|
||||
pair_coeff * * lj/cut 1.0 1.0
|
||||
pair_coeff * * coul/long
|
||||
|
||||
pair_style hybrid/scaled 0.5 tersoff 0.5 sw
|
||||
pair_coeff * * tersoff Si.tersoff Si
|
||||
pair_coeff * * sw Si.sw Si
|
||||
|
||||
variable one equal ramp(1.0,0.0)
|
||||
variable two equal 1.0-v_one
|
||||
pair_style hybrid/scaled v_one lj/cut 2.5 v_two morse 2.5
|
||||
pair_coeff 1 1 lj/cut 1.0 1.0 2.5
|
||||
pair_coeff 1 1 morse 1.0 1.0 1.0 2.5
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
The *hybrid* and *hybrid/overlay* styles enable the use of multiple
|
||||
pair styles in one simulation. With the *hybrid* style, exactly one
|
||||
pair style is assigned to each pair of atom types. With the
|
||||
*hybrid/overlay* style, one or more pair styles can be assigned to
|
||||
each pair of atom types. The assignment of pair styles to type pairs
|
||||
is made via the :doc:`pair_coeff <pair_coeff>` command.
|
||||
The *hybrid*, *hybrid/overlay*, and *hybrid/scaled* styles enable the
|
||||
use of multiple pair styles in one simulation. With the *hybrid* style,
|
||||
exactly one pair style is assigned to each pair of atom types. With the
|
||||
*hybrid/overlay* and *hybrid/scaled* styles, one or more pair styles can
|
||||
be assigned to each pair of atom types. The assignment of pair styles
|
||||
to type pairs is made via the :doc:`pair_coeff <pair_coeff>` command.
|
||||
The major difference between the *hybrid/overlay* and *hybrid/scaled*
|
||||
styles is that the *hybrid/scaled* adds a scale factor for each
|
||||
sub-style contribution to forces, energies and stresses. Because of the
|
||||
added complexity, the *hybrid/scaled* style has more overhead and thus
|
||||
may be slower than *hybrid/overlay*.
|
||||
|
||||
Here are two examples of hybrid simulations. The *hybrid* style could
|
||||
be used for a simulation of a metal droplet on a LJ surface. The
|
||||
metal atoms interact with each other via an *eam* potential, the
|
||||
surface atoms interact with each other via a *lj/cut* potential, and
|
||||
the metal/surface interaction is also computed via a *lj/cut*
|
||||
potential. The *hybrid/overlay* style could be used as in the second
|
||||
example above, where multiple potentials are superposed in an additive
|
||||
fashion to compute the interaction between atoms. In this example,
|
||||
using *lj/cut* and *coul/long* together gives the same result as if
|
||||
the *lj/cut/coul/long* potential were used by itself. In this case,
|
||||
it would be more efficient to use the single combined potential, but
|
||||
in general any combination of pair potentials can be used together in
|
||||
to produce an interaction that is not encoded in any single pair_style
|
||||
be used for a simulation of a metal droplet on a LJ surface. The metal
|
||||
atoms interact with each other via an *eam* potential, the surface atoms
|
||||
interact with each other via a *lj/cut* potential, and the metal/surface
|
||||
interaction is also computed via a *lj/cut* potential. The
|
||||
*hybrid/overlay* style could be used as in the second example above,
|
||||
where multiple potentials are superposed in an additive fashion to
|
||||
compute the interaction between atoms. In this example, using *lj/cut*
|
||||
and *coul/long* together gives the same result as if the
|
||||
*lj/cut/coul/long* potential were used by itself. In this case, it
|
||||
would be more efficient to use the single combined potential, but in
|
||||
general any combination of pair potentials can be used together in to
|
||||
produce an interaction that is not encoded in any single pair_style
|
||||
file, e.g. adding Coulombic forces between granular particles.
|
||||
|
||||
If the *hybrid/scaled* style is used instead of *hybrid/overlay*\ ,
|
||||
contributions from sub-styles are weighted by their scale factors, which
|
||||
may be fractional or even negative. Furthermore the scale factors may
|
||||
be variables that may change during a simulation. This enables
|
||||
switching smoothly between two different pair styles or two different
|
||||
parameter sets during a run.
|
||||
|
||||
All pair styles that will be used are listed as "sub-styles" following
|
||||
the *hybrid* or *hybrid/overlay* keyword, in any order. Each
|
||||
sub-style's name is followed by its usual arguments, as illustrated in
|
||||
the example above. See the doc pages of individual pair styles for a
|
||||
listing and explanation of the appropriate arguments.
|
||||
the *hybrid* or *hybrid/overlay* keyword, in any order. In case of the
|
||||
*hybrid/scaled* pair style, each sub-style is prefixed with a scale
|
||||
factor. The scale factor is either a floating point number or an equal
|
||||
style (or equivalent) variable. Each sub-style's name is followed by
|
||||
its usual arguments, as illustrated in the examples above. See the doc
|
||||
pages of the individual pair styles for a listing and explanation of the
|
||||
appropriate arguments for them.
|
||||
|
||||
Note that an individual pair style can be used multiple times as a
|
||||
sub-style. For efficiency this should only be done if your model
|
||||
requires it. E.g. if you have different regions of Si and C atoms and
|
||||
wish to use a Tersoff potential for pure Si for one set of atoms, and
|
||||
a Tersoff potential for pure C for the other set (presumably with some
|
||||
third potential for Si-C interactions), then the sub-style *tersoff*
|
||||
could be listed twice. But if you just want to use a Lennard-Jones or
|
||||
other pairwise potential for several different atom type pairs in your
|
||||
model, then you should just list the sub-style once and use the
|
||||
pair_coeff command to assign parameters for the different type pairs.
|
||||
sub-style. For efficiency reasons this should only be done if your
|
||||
model requires it. E.g. if you have different regions of Si and C atoms
|
||||
and wish to use a Tersoff potential for pure Si for one set of atoms,
|
||||
and a Tersoff potential for pure C for the other set (presumably with
|
||||
some third potential for Si-C interactions), then the sub-style
|
||||
*tersoff* could be listed twice. But if you just want to use a
|
||||
Lennard-Jones or other pairwise potential for several different atom
|
||||
type pairs in your model, then you should just list the sub-style once
|
||||
and use the pair_coeff command to assign parameters for the different
|
||||
type pairs.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -143,16 +175,16 @@ one sub-style. Just as with a simulation using a single pair style,
|
||||
if you specify the same atom type pair in a second pair_coeff command,
|
||||
the previous assignment will be overwritten.
|
||||
|
||||
For the *hybrid/overlay* style, each atom type pair I,J can be
|
||||
assigned to one or more sub-styles. If you specify the same atom type
|
||||
pair in a second pair_coeff command with a new sub-style, then the
|
||||
second sub-style is added to the list of potentials that will be
|
||||
calculated for two interacting atoms of those types. If you specify
|
||||
the same atom type pair in a second pair_coeff command with a
|
||||
sub-style that has already been defined for that pair of atoms, then
|
||||
the new pair coefficients simply override the previous ones, as in the
|
||||
normal usage of the pair_coeff command. E.g. these two sets of
|
||||
commands are the same:
|
||||
For the *hybrid/overlay* and *hybrid/scaled* styles, each atom type pair
|
||||
I,J can be assigned to one or more sub-styles. If you specify the same
|
||||
atom type pair in a second pair_coeff command with a new sub-style, then
|
||||
the second sub-style is added to the list of potentials that will be
|
||||
calculated for two interacting atoms of those types. If you specify the
|
||||
same atom type pair in a second pair_coeff command with a sub-style that
|
||||
has already been defined for that pair of atoms, then the new pair
|
||||
coefficients simply override the previous ones, as in the normal usage
|
||||
of the pair_coeff command. E.g. these two sets of commands are the
|
||||
same:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -166,42 +198,43 @@ commands are the same:
|
||||
|
||||
Coefficients must be defined for each pair of atoms types via the
|
||||
:doc:`pair_coeff <pair_coeff>` command as described above, or in the
|
||||
data file or restart files read by the :doc:`read_data <read_data>` or
|
||||
:doc:`read_restart <read_restart>` commands, or by mixing as described
|
||||
below.
|
||||
data file read by the :doc:`read_data <read_data>` commands, or by
|
||||
mixing as described below.
|
||||
|
||||
For both the *hybrid* and *hybrid/overlay* styles, every atom type
|
||||
pair I,J (where I <= J) must be assigned to at least one sub-style via
|
||||
the :doc:`pair_coeff <pair_coeff>` command as in the examples above, or
|
||||
in the data file read by the :doc:`read_data <read_data>`, or by mixing
|
||||
as described below.
|
||||
For all of the *hybrid*, *hybrid/overlay*, and *hybrid/scaled* styles,
|
||||
every atom type pair I,J (where I <= J) must be assigned to at least one
|
||||
sub-style via the :doc:`pair_coeff <pair_coeff>` command as in the
|
||||
examples above, or in the data file read by the :doc:`read_data
|
||||
<read_data>`, or by mixing as described below. Also all sub-styles
|
||||
must be used at least once in a :doc:`pair_coeff <pair_coeff>` command.
|
||||
|
||||
If you want there to be no interactions between a particular pair of
|
||||
atom types, you have 3 choices. You can assign the type pair to some
|
||||
sub-style and use the :doc:`neigh_modify exclude type <neigh_modify>`
|
||||
command. You can assign it to some sub-style and set the coefficients
|
||||
so that there is effectively no interaction (e.g. epsilon = 0.0 in a
|
||||
LJ potential). Or, for *hybrid* and *hybrid/overlay* simulations, you
|
||||
can use this form of the pair_coeff command in your input script:
|
||||
so that there is effectively no interaction (e.g. epsilon = 0.0 in a LJ
|
||||
potential). Or, for *hybrid*, *hybrid/overlay*, or *hybrid/scaled*
|
||||
simulations, you can use this form of the pair_coeff command in your
|
||||
input script:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_coeff 2 3 none
|
||||
pair_coeff 2 3 none
|
||||
|
||||
or this form in the "Pair Coeffs" section of the data file:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
3 none
|
||||
3 none
|
||||
|
||||
If an assignment to *none* is made in a simulation with the
|
||||
*hybrid/overlay* pair style, it wipes out all previous assignments of
|
||||
that atom type pair to sub-styles.
|
||||
*hybrid/overlay* or *hybrid/scaled* pair style, it wipes out all
|
||||
previous assignments of that pair of atom types to sub-styles.
|
||||
|
||||
Note that you may need to use an :doc:`atom_style <atom_style>` hybrid
|
||||
command in your input script, if atoms in the simulation will need
|
||||
attributes from several atom styles, due to using multiple pair
|
||||
potentials.
|
||||
styles with different requirements.
|
||||
|
||||
----------
|
||||
|
||||
@ -210,8 +243,9 @@ for applying weightings that change the strength of pairwise
|
||||
interactions between pairs of atoms that are also 1-2, 1-3, and 1-4
|
||||
neighbors in the molecular bond topology, as normally set by the
|
||||
:doc:`special_bonds <special_bonds>` command. Different weights can be
|
||||
assigned to different pair hybrid sub-styles via the :doc:`pair_modify special <pair_modify>` command. This allows multiple force fields
|
||||
to be used in a model of a hybrid system, however, there is no consistent
|
||||
assigned to different pair hybrid sub-styles via the :doc:`pair_modify
|
||||
special <pair_modify>` command. This allows multiple force fields to be
|
||||
used in a model of a hybrid system, however, there is no consistent
|
||||
approach to determine parameters automatically for the interactions
|
||||
between the two force fields, this is only recommended when particles
|
||||
described by the different force fields do not mix.
|
||||
@ -260,7 +294,10 @@ the specific syntax, requirements and restrictions.
|
||||
----------
|
||||
|
||||
The potential energy contribution to the overall system due to an
|
||||
individual sub-style can be accessed and output via the :doc:`compute pair <compute_pair>` command.
|
||||
individual sub-style can be accessed and output via the :doc:`compute
|
||||
pair <compute_pair>` command. Note that in the case of pair style
|
||||
*hybrid/scaled* this is the **unscaled** potential energy of the
|
||||
selected sub-style.
|
||||
|
||||
----------
|
||||
|
||||
@ -282,28 +319,27 @@ Pair_style hybrid allows interactions between type pairs 2-2, 1-2,
|
||||
could even add a second interaction for 1-1 to be computed by another
|
||||
pair style, assuming pair_style hybrid/overlay is used.
|
||||
|
||||
But you should not, as a general rule, attempt to exclude the
|
||||
many-body interactions for some subset of the type pairs within the
|
||||
set of 1,3,4 interactions, e.g. exclude 1-1 or 1-3 interactions. That
|
||||
is not conceptually well-defined for many-body interactions, since the
|
||||
But you should not, as a general rule, attempt to exclude the many-body
|
||||
interactions for some subset of the type pairs within the set of 1,3,4
|
||||
interactions, e.g. exclude 1-1 or 1-3 interactions. That is not
|
||||
conceptually well-defined for many-body interactions, since the
|
||||
potential will typically calculate energies and foces for small groups
|
||||
of atoms, e.g. 3 or 4 atoms, using the neighbor lists of the atoms to
|
||||
find the additional atoms in the group. It is typically non-physical
|
||||
to think of excluding an interaction between a particular pair of
|
||||
atoms when the potential computes 3-body or 4-body interactions.
|
||||
find the additional atoms in the group.
|
||||
|
||||
However, you can still use the pair_coeff none setting or the
|
||||
:doc:`neigh_modify exclude <neigh_modify>` command to exclude certain
|
||||
type pairs from the neighbor list that will be passed to a many-body
|
||||
sub-style. This will alter the calculations made by a many-body
|
||||
potential, since it builds its list of 3-body, 4-body, etc
|
||||
interactions from the pair list. You will need to think carefully as
|
||||
to whether it produces a physically meaningful result for your model.
|
||||
potential beyond the specific pairs, since it builds its list of 3-body,
|
||||
4-body, etc interactions from the pair lists. You will need to think
|
||||
**carefully** as to whether excluding such pairs produces a physically
|
||||
meaningful result for your model.
|
||||
|
||||
For example, imagine you have two atom types in your model, type 1 for
|
||||
atoms in one surface, and type 2 for atoms in the other, and you wish
|
||||
to use a Tersoff potential to compute interactions within each
|
||||
surface, but not between surfaces. Then either of these two command
|
||||
surface, but not between the surfaces. Then either of these two command
|
||||
sequences would implement that model:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
@ -320,9 +356,9 @@ Either way, only neighbor lists with 1-1 or 2-2 interactions would be
|
||||
passed to the Tersoff potential, which means it would compute no
|
||||
3-body interactions containing both type 1 and 2 atoms.
|
||||
|
||||
Here is another example, using hybrid/overlay, to use 2 many-body
|
||||
potentials together, in an overlapping manner. Imagine you have CNT
|
||||
(C atoms) on a Si surface. You want to use Tersoff for Si/Si and Si/C
|
||||
Here is another example to use 2 many-body potentials together in an
|
||||
overlapping manner using hybrid/overlay. Imagine you have CNT (C atoms)
|
||||
on a Si surface. You want to use Tersoff for Si/Si and Si/C
|
||||
interactions, and AIREBO for C/C interactions. Si atoms are type 1; C
|
||||
atoms are type 2. Something like this will work:
|
||||
|
||||
@ -333,9 +369,9 @@ atoms are type 2. Something like this will work:
|
||||
pair_coeff * * airebo CH.airebo NULL C
|
||||
|
||||
Note that to prevent the Tersoff potential from computing C/C
|
||||
interactions, you would need to modify the SiC.tersoff file to turn
|
||||
off C/C interaction, i.e. by setting the appropriate coefficients to
|
||||
0.0.
|
||||
interactions, you would need to **modify** the SiC.tersoff potential
|
||||
file to turn off C/C interaction, i.e. by setting the appropriate
|
||||
coefficients to 0.0.
|
||||
|
||||
----------
|
||||
|
||||
@ -343,18 +379,19 @@ Styles with a *gpu*\ , *intel*\ , *kk*\ , *omp*\ , or *opt* suffix are
|
||||
functionally the same as the corresponding style without the suffix.
|
||||
They have been optimized to run faster, depending on your available
|
||||
hardware, as discussed on the :doc:`Speed packages <Speed_packages>` doc
|
||||
page.
|
||||
page. Pair style *hybrid/scaled* does (currently) not support the
|
||||
*gpu*, *omp*, *kk*, or *intel* suffix.
|
||||
|
||||
Since the *hybrid* and *hybrid/overlay* styles delegate computation to
|
||||
the individual sub-styles, the suffix versions of the *hybrid* and
|
||||
*hybrid/overlay* styles are used to propagate the corresponding suffix
|
||||
to all sub-styles, if those versions exist. Otherwise the
|
||||
non-accelerated version will be used.
|
||||
Since the *hybrid*, *hybrid/overlay*, *hybrid/scaled* styles delegate
|
||||
computation to the individual sub-styles, the suffix versions of the
|
||||
*hybrid* and *hybrid/overlay* styles are used to propagate the
|
||||
corresponding suffix to all sub-styles, if those versions
|
||||
exist. Otherwise the non-accelerated version will be used.
|
||||
|
||||
The individual accelerated sub-styles are part of the GPU, USER-OMP
|
||||
and OPT packages, respectively. They are only enabled if LAMMPS was
|
||||
built with those packages. See the :doc:`Build package <Build_package>`
|
||||
doc page for more info.
|
||||
The individual accelerated sub-styles are part of the GPU, KOKKOS,
|
||||
USER-INTEL, USER-OMP, and OPT packages, respectively. They are only
|
||||
enabled if LAMMPS was built with those packages. See the :doc:`Build
|
||||
package <Build_package>` doc page for more info.
|
||||
|
||||
You can specify the accelerated styles explicitly in your input script
|
||||
by including their suffix, or you can use the :doc:`-suffix command-line switch <Run_options>` when you invoke LAMMPS, or you can use the
|
||||
@ -372,28 +409,31 @@ Any pair potential settings made via the
|
||||
:doc:`pair_modify <pair_modify>` command are passed along to all
|
||||
sub-styles of the hybrid potential.
|
||||
|
||||
For atom type pairs I,J and I != J, if the sub-style assigned to I,I
|
||||
and J,J is the same, and if the sub-style allows for mixing, then the
|
||||
For atom type pairs I,J and I != J, if the sub-style assigned to I,I and
|
||||
J,J is the same, and if the sub-style allows for mixing, then the
|
||||
coefficients for I,J can be mixed. This means you do not have to
|
||||
specify a pair_coeff command for I,J since the I,J type pair will be
|
||||
assigned automatically to the sub-style defined for both I,I and J,J
|
||||
and its coefficients generated by the mixing rule used by that
|
||||
sub-style. For the *hybrid/overlay* style, there is an additional
|
||||
requirement that both the I,I and J,J pairs are assigned to a single
|
||||
sub-style. See the "pair_modify" command for details of mixing rules.
|
||||
See the See the doc page for the sub-style to see if allows for
|
||||
mixing.
|
||||
assigned automatically to the sub-style defined for both I,I and J,J and
|
||||
its coefficients generated by the mixing rule used by that sub-style.
|
||||
For the *hybrid/overlay* and *hybrid/scaled* style, there is an
|
||||
additional requirement that both the I,I and J,J pairs are assigned to a
|
||||
single sub-style. See the :doc:`pair_modify <pair_modify>` command for
|
||||
details of mixing rules. See the See the doc page for the sub-style to
|
||||
see if allows for mixing.
|
||||
|
||||
The hybrid pair styles supports the :doc:`pair_modify <pair_modify>`
|
||||
shift, table, and tail options for an I,J pair interaction, if the
|
||||
associated sub-style supports it.
|
||||
|
||||
For the hybrid pair styles, the list of sub-styles and their
|
||||
respective settings are written to :doc:`binary restart files <restart>`, so a :doc:`pair_style <pair_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. Thus, pair_coeff commands need to be re-specified in the
|
||||
restart input script.
|
||||
For the hybrid pair styles, the list of sub-styles and their respective
|
||||
settings are written to :doc:`binary restart files <restart>`, so a
|
||||
:doc:`pair_style <pair_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. Thus, pair_coeff
|
||||
commands need to be re-specified in the restart input script. For pair
|
||||
style *hybrid/scaled* also the names of any variables used as scale
|
||||
factors are restored, but not the variables themselves, so those may
|
||||
need to be redefined when continuing from a restart.
|
||||
|
||||
These pair styles support the use of the *inner*\ , *middle*\ , and
|
||||
*outer* keywords of the :doc:`run_style respa <run_style>` command, if
|
||||
@ -409,6 +449,12 @@ e.g. *lj/cut/coul/long* or *buck/coul/long*\ . You must insure that the
|
||||
short-range Coulombic cutoff used by each of these long pair styles is
|
||||
the same or else LAMMPS will generate an error.
|
||||
|
||||
Pair style *hybrid/scaled* currently only works for non-accelerated
|
||||
pair styles and pair styles from the OPT package.
|
||||
|
||||
When using pair styles from the GPU package they must not be listed
|
||||
multiple times. LAMMPS will detect this and abort.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
|
||||
@ -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
|
||||
114
doc/src/pair_pace.rst
Normal file
114
doc/src/pair_pace.rst
Normal file
@ -0,0 +1,114 @@
|
||||
.. index:: pair_style pace
|
||||
|
||||
pair_style pace command
|
||||
========================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style pace ... keyword values ...
|
||||
|
||||
* an optional keyword may be appended
|
||||
* keyword = *product* or *recursive*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*product* = use product algorithm for basis functions
|
||||
*recursive* = use recursive algorithm for basis functions
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style pace
|
||||
pair_style pace product
|
||||
pair_coeff * * Cu-PBE-core-rep.ace Cu
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Pair style *pace* computes interactions using the Atomic Cluster
|
||||
Expansion (ACE), which is a general expansion of the atomic energy in
|
||||
multi-body basis functions. :ref:`(Drautz) <Drautz20191>`.
|
||||
The *pace* pair style
|
||||
provides an efficient implementation that
|
||||
is described in this paper :ref:`(Lysogorskiy) <Lysogorskiy20211>`.
|
||||
|
||||
In ACE, the total energy is decomposed into a sum over
|
||||
atomic energies. The energy of atom *i* is expressed as a
|
||||
linear or non-linear function of one or more density functions.
|
||||
By projecting the
|
||||
density onto a local atomic base, the lowest order contributions
|
||||
to the energy can be expressed as a set of scalar polynomials in
|
||||
basis function contributions summed over neighbor atoms.
|
||||
|
||||
Only a single pair_coeff command is used with the *pace* style which
|
||||
specifies an ACE coefficient file followed by N additional arguments
|
||||
specifying the mapping of ACE elements to LAMMPS atom types,
|
||||
where N is the number of LAMMPS atom types:
|
||||
|
||||
* ACE coefficient file
|
||||
* N element names = mapping of ACE elements to atom types
|
||||
|
||||
Only a single pair_coeff command is used with the *pace* style which
|
||||
specifies an ACE file that fully defines the potential.
|
||||
Note that unlike for other potentials, cutoffs are
|
||||
not set in the pair_style or pair_coeff command; they are specified in
|
||||
the ACE file.
|
||||
|
||||
The pair_style *pace* command may be followed by an optional keyword
|
||||
*product* or *recursive*, which determines which of two algorithms
|
||||
is used for the calculation of basis functions and derivatives.
|
||||
The default is *recursive*.
|
||||
|
||||
See the :doc:`pair_coeff <pair_coeff>` doc page for alternate ways
|
||||
to specify the path for the ACE coefficient file.
|
||||
|
||||
Mixing, shift, table, tail correction, restart, rRESPA info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
For atom type pairs I,J and I != J, where types I and J correspond to
|
||||
two different element types, mixing is performed by LAMMPS with
|
||||
user-specifiable parameters as described above. You never need to
|
||||
specify a pair_coeff command with I != J arguments for this style.
|
||||
|
||||
This pair style does not support the :doc:`pair_modify <pair_modify>`
|
||||
shift, table, and tail options.
|
||||
|
||||
This pair style does not write its information to :doc:`binary restart files <restart>`, since it is stored in potential files. Thus, you
|
||||
need to re-specify the pair_style and pair_coeff commands in an input
|
||||
script that reads a restart file.
|
||||
|
||||
This pair style can only be used via the *pair* keyword of the
|
||||
:doc:`run_style respa <run_style>` command. It does not support the
|
||||
*inner*\ , *middle*\ , *outer* keywords.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This pair style is part of the USER-PACE package. It is 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_style snap <pair_snap>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
recursive
|
||||
|
||||
.. _Drautz20191:
|
||||
|
||||
**(Drautz)** Drautz, Phys Rev B, 99, 014104 (2019).
|
||||
|
||||
.. _Lysogorskiy20211:
|
||||
|
||||
**(Lysogorskiy)** Lysogorskiy, van der Oord, Bochkarev, Menon, Rinaldi, Hammerschmidt, Mrovec, Thompson, Csanyi, Ortner, Drautz, TBD (2021).
|
||||
@ -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)
|
||||
|
||||
@ -95,10 +95,11 @@ accelerated styles exist.
|
||||
* :doc:`none <pair_none>` - turn off pairwise interactions
|
||||
* :doc:`hybrid <pair_hybrid>` - multiple styles of pairwise interactions
|
||||
* :doc:`hybrid/overlay <pair_hybrid>` - multiple styles of superposed pairwise interactions
|
||||
* :doc:`hybrid/scaled <pair_hybrid>` - multiple styles of scaled superposed pairwise interactions
|
||||
* :doc:`zero <pair_zero>` - neighbor list but no interactions
|
||||
|
||||
* :doc:`adp <pair_adp>` - angular dependent potential (ADP) of Mishin
|
||||
* :doc:`agni <pair_agni>` - machine learned potential mapping atomic environment to forces
|
||||
* :doc:`agni <pair_agni>` - AGNI machine-learning potential
|
||||
* :doc:`airebo <pair_airebo>` - AIREBO potential of Stuart
|
||||
* :doc:`airebo/morse <pair_airebo>` - AIREBO with Morse instead of LJ
|
||||
* :doc:`atm <pair_atm>` - Axilrod-Teller-Muto potential
|
||||
@ -132,6 +133,7 @@ accelerated styles exist.
|
||||
* :doc:`comb3 <pair_comb>` - charge-optimized many-body (COMB3) potential
|
||||
* :doc:`cosine/squared <pair_cosine_squared>` - Cooke-Kremer-Deserno membrane model potential
|
||||
* :doc:`coul/cut <pair_coul>` - cutoff Coulomb potential
|
||||
* :doc:`coul/cut/global <pair_coul>` - cutoff Coulomb potential
|
||||
* :doc:`coul/cut/soft <pair_fep_soft>` - Coulomb potential with a soft core
|
||||
* :doc:`coul/debye <pair_coul>` - cutoff Coulomb potential with Debye screening
|
||||
* :doc:`coul/diel <pair_coul_diel>` - Coulomb potential with dielectric permittivity
|
||||
@ -250,7 +252,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
|
||||
@ -278,6 +280,7 @@ accelerated styles exist.
|
||||
* :doc:`oxrna2/hbond <pair_oxrna2>` -
|
||||
* :doc:`oxrna2/stk <pair_oxrna2>` -
|
||||
* :doc:`oxrna2/xstk <pair_oxrna2>` -
|
||||
* :doc:`pace <pair_pace>` - Atomic Cluster Expansion (ACE) machine-learning potential
|
||||
* :doc:`peri/eps <pair_peri>` - peridynamic EPS potential
|
||||
* :doc:`peri/lps <pair_peri>` - peridynamic LPS potential
|
||||
* :doc:`peri/pmb <pair_peri>` - peridynamic PMB potential
|
||||
@ -296,7 +299,7 @@ accelerated styles exist.
|
||||
* :doc:`smd/ulsph <pair_smd_ulsph>` -
|
||||
* :doc:`smtbq <pair_smtbq>` -
|
||||
* :doc:`mliap <pair_mliap>` - Multiple styles of machine-learning potential
|
||||
* :doc:`snap <pair_snap>` - SNAP quantum-accurate potential
|
||||
* :doc:`snap <pair_snap>` - SNAP machine-learning potential
|
||||
* :doc:`soft <pair_soft>` - Soft (cosine) potential
|
||||
* :doc:`sph/heatconduction <pair_sph_heatconduction>` -
|
||||
* :doc:`sph/idealgas <pair_sph_idealgas>` -
|
||||
|
||||
@ -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"
|
||||
|
||||
90
doc/src/plugin.rst
Normal file
90
doc/src/plugin.rst
Normal file
@ -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
|
||||
|
||||
@ -261,6 +261,7 @@ bitmask
|
||||
bitrate
|
||||
bitrates
|
||||
Bitzek
|
||||
Bjerrum
|
||||
Blaise
|
||||
blanchedalmond
|
||||
blocksize
|
||||
@ -268,6 +269,7 @@ blueviolet
|
||||
bn
|
||||
bni
|
||||
bo
|
||||
Bochkarev
|
||||
Bochum
|
||||
bocs
|
||||
bodyflag
|
||||
@ -343,6 +345,7 @@ Cao
|
||||
Capolungo
|
||||
Caro
|
||||
cartesian
|
||||
Cas
|
||||
CasP
|
||||
Caswell
|
||||
Cates
|
||||
@ -502,6 +505,8 @@ coulgauss
|
||||
coulombic
|
||||
Coulombic
|
||||
Coulombics
|
||||
counterion
|
||||
counterions
|
||||
Courant
|
||||
covalent
|
||||
covalently
|
||||
@ -730,6 +735,7 @@ DRUDE
|
||||
dsf
|
||||
dsmc
|
||||
dt
|
||||
dtemp
|
||||
dtgrow
|
||||
dtheta
|
||||
dtshrink
|
||||
@ -758,7 +764,6 @@ Dyre
|
||||
Dzyaloshinskii
|
||||
Eaa
|
||||
Eaat
|
||||
Eacn
|
||||
eam
|
||||
eangle
|
||||
earg
|
||||
@ -878,6 +883,7 @@ equilibrates
|
||||
equilibrating
|
||||
equilibration
|
||||
Equilibria
|
||||
equilibria
|
||||
equilization
|
||||
equipartitioning
|
||||
Ercolessi
|
||||
@ -1069,6 +1075,7 @@ fuer
|
||||
fx
|
||||
fy
|
||||
fz
|
||||
Gabor
|
||||
Gahler
|
||||
gainsboro
|
||||
Galindo
|
||||
@ -1193,6 +1200,7 @@ Halperin
|
||||
Halver
|
||||
Hamaker
|
||||
Hamel
|
||||
Hammerschmidt
|
||||
haptic
|
||||
Hara
|
||||
Harpertown
|
||||
@ -1212,6 +1220,7 @@ hbnewflag
|
||||
hbond
|
||||
hcp
|
||||
heatconduction
|
||||
Hebbeker
|
||||
Hebenstreit
|
||||
Hecht
|
||||
Heenen
|
||||
@ -1279,6 +1288,7 @@ hy
|
||||
hydrophobicity
|
||||
hydrostatic
|
||||
hydrostatically
|
||||
hydroxyl
|
||||
Hynninen
|
||||
Hyoungki
|
||||
hyperdynamics
|
||||
@ -1369,6 +1379,7 @@ ints
|
||||
inv
|
||||
invariants
|
||||
inversed
|
||||
ionizable
|
||||
ionocovalent
|
||||
iostreams
|
||||
iparam
|
||||
@ -1548,6 +1559,7 @@ Koning
|
||||
Kooser
|
||||
Korn
|
||||
Koskinen
|
||||
Kosovan
|
||||
Koster
|
||||
Kosztin
|
||||
Kp
|
||||
@ -1588,11 +1600,13 @@ lammps
|
||||
Lammps
|
||||
LAMMPS
|
||||
lammpsplot
|
||||
lammpsplugin
|
||||
Lampis
|
||||
Lamoureux
|
||||
Lanczos
|
||||
Lande
|
||||
Landron
|
||||
Landsgesell
|
||||
langevin
|
||||
Langevin
|
||||
Langston
|
||||
@ -1730,10 +1744,13 @@ lpsapi
|
||||
lrt
|
||||
lsfftw
|
||||
ltbbmalloc
|
||||
Lua
|
||||
lubricateU
|
||||
lucy
|
||||
Lua
|
||||
Luding
|
||||
Luijten
|
||||
lunit
|
||||
Lunkad
|
||||
Lussetti
|
||||
Lustig
|
||||
lval
|
||||
@ -1742,6 +1759,7 @@ lx
|
||||
ly
|
||||
Lybrand
|
||||
lyon
|
||||
Lysogorskiy
|
||||
Lyulin
|
||||
lz
|
||||
Maaravi
|
||||
@ -1800,8 +1818,10 @@ Materias
|
||||
mathbf
|
||||
mathjax
|
||||
matlab
|
||||
Matous
|
||||
matplotlib
|
||||
Matsubara
|
||||
Matteo
|
||||
Mattice
|
||||
Mattox
|
||||
Mattson
|
||||
@ -1862,6 +1882,7 @@ MEMALIGN
|
||||
membered
|
||||
memcheck
|
||||
Mendelev
|
||||
Menon
|
||||
mer
|
||||
Meremianin
|
||||
Mersenne
|
||||
@ -1985,6 +2006,7 @@ mpiio
|
||||
mpirun
|
||||
mplayer
|
||||
mps
|
||||
Mrovec
|
||||
Mryglod
|
||||
mscg
|
||||
MSCG
|
||||
@ -2019,6 +2041,7 @@ multiscale
|
||||
multisectioning
|
||||
multithreading
|
||||
Multithreading
|
||||
multivalent
|
||||
Mundy
|
||||
Murdick
|
||||
Murtola
|
||||
@ -2064,6 +2087,7 @@ Nanoletters
|
||||
nanomechanics
|
||||
nanometer
|
||||
nanometers
|
||||
nanoparticle
|
||||
nanoparticles
|
||||
Nanotube
|
||||
nanotube
|
||||
@ -2173,6 +2197,7 @@ nm
|
||||
Nm
|
||||
Nmax
|
||||
nmax
|
||||
nmc
|
||||
Nmin
|
||||
nmin
|
||||
Nmols
|
||||
@ -2307,9 +2332,11 @@ OMP
|
||||
oneAPI
|
||||
onelevel
|
||||
oneway
|
||||
onlysalt
|
||||
onn
|
||||
ons
|
||||
OO
|
||||
Oord
|
||||
opencl
|
||||
openKIM
|
||||
openmp
|
||||
@ -2330,6 +2357,7 @@ Orsi
|
||||
ortho
|
||||
orthonormal
|
||||
orthorhombic
|
||||
Ortner
|
||||
oso
|
||||
Otype
|
||||
Ouldridge
|
||||
@ -2389,6 +2417,8 @@ pbc
|
||||
pc
|
||||
pchain
|
||||
Pchain
|
||||
pcmoves
|
||||
pmcmoves
|
||||
Pdamp
|
||||
pdb
|
||||
pdf
|
||||
@ -2433,6 +2463,7 @@ phosphide
|
||||
Phs
|
||||
Physica
|
||||
physik
|
||||
pI
|
||||
Piaggi
|
||||
picocoulomb
|
||||
picocoulombs
|
||||
@ -2444,7 +2475,9 @@ pid
|
||||
piecewise
|
||||
Pieniazek
|
||||
Pieter
|
||||
pIm
|
||||
pimd
|
||||
pIp
|
||||
Piola
|
||||
Pisarev
|
||||
Pishevar
|
||||
@ -2459,6 +2492,9 @@ ploop
|
||||
PloS
|
||||
plt
|
||||
plumedfile
|
||||
pKa
|
||||
pKb
|
||||
pKs
|
||||
pmb
|
||||
Pmolrotate
|
||||
Pmoltrans
|
||||
@ -2619,6 +2655,7 @@ radians
|
||||
Rafferty
|
||||
rahman
|
||||
Rahman
|
||||
Ralf
|
||||
Raman
|
||||
ramped
|
||||
ramping
|
||||
@ -2680,6 +2717,7 @@ representable
|
||||
Reproducibility
|
||||
reproducibility
|
||||
repuls
|
||||
reqid
|
||||
rescale
|
||||
rescaled
|
||||
rescales
|
||||
@ -2725,6 +2763,7 @@ Rij
|
||||
RIj
|
||||
Rik
|
||||
Rin
|
||||
Rinaldi
|
||||
Rino
|
||||
RiRj
|
||||
Risi
|
||||
@ -2784,6 +2823,7 @@ rst
|
||||
rstyle
|
||||
Rubensson
|
||||
Rubia
|
||||
Rud
|
||||
Rudd
|
||||
Rudra
|
||||
Rudranarayan
|
||||
@ -2813,6 +2853,7 @@ Sandia
|
||||
sandybrown
|
||||
sanitizer
|
||||
Sanyal
|
||||
Sarath
|
||||
sc
|
||||
scafacos
|
||||
SCAFACOS
|
||||
|
||||
@ -45,3 +45,14 @@ directory.
|
||||
results (computed by the python script).
|
||||
Note: This example is a reworked version of a test problem
|
||||
provided by Martin Kroger (ETHZ).
|
||||
|
||||
- validation_nve:
|
||||
simulates a small assembly of magnetic atoms (54). The atoms are
|
||||
coupled by an exchange interaction and a mechanical potential
|
||||
(EAM here).
|
||||
This example represents an NVE run: the total energy of the
|
||||
system is preserved, whereas the spin and lattice energy
|
||||
reservoirs are exchanging energy.
|
||||
Run as: ./run-test-nve.sh
|
||||
Output: res_lammps.dat contains the data. The results are displayed
|
||||
by nve_spin_lattice.pdf.
|
||||
|
||||
25
examples/SPIN/test_problems/run_all.sh
Executable file
25
examples/SPIN/test_problems/run_all.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# test 1: damping and exchange
|
||||
cd validation_damped_exchange/
|
||||
./run-test-exchange.sh
|
||||
rm dump.data res_lammps.dat res_llg.dat
|
||||
cd ..
|
||||
|
||||
# test 2: damping and Zeeman
|
||||
cd validation_damped_precession/
|
||||
./run-test-prec.sh
|
||||
rm res_lammps.dat res_llg.dat
|
||||
cd ..
|
||||
|
||||
# test 3: langevin, damping and Zeeman
|
||||
cd validation_langevin_precession/
|
||||
./run-test-prec.sh
|
||||
rm average_spin test-prec-spin.in res_lammps.dat res_langevin.dat
|
||||
cd ..
|
||||
|
||||
# test 4: NVE run, test Etot preservation
|
||||
cd validation_nve/
|
||||
./run-test-nve.sh
|
||||
rm nve_spin_lattice.pdf res_lammps.dat
|
||||
cd ..
|
||||
@ -6,7 +6,7 @@ import matplotlib.pyplot as plt
|
||||
import mpmath as mp
|
||||
|
||||
hbar=0.658212 # Planck's constant (eV.fs/rad)
|
||||
# J0=0.05 # per-neighbor exchange interaction (eV)
|
||||
J0=0.05 # per-neighbor exchange interaction (eV)
|
||||
|
||||
# exchange interaction parameters
|
||||
J1 = 11.254 # in eV
|
||||
|
||||
@ -3,9 +3,15 @@
|
||||
# clean old res
|
||||
rm res_*.dat
|
||||
|
||||
# compute Lammps
|
||||
# test standard Lammps
|
||||
./../../../../src/lmp_serial \
|
||||
-in test-spin-precession.in
|
||||
|
||||
# test spin/kk with Kokkos Lammps
|
||||
# mpirun -np 1 ../../../../src/lmp_kokkos_mpi_only \
|
||||
# -k on -sf kk -in test-spin-precession.in
|
||||
|
||||
# extract data from Lammps run
|
||||
in="$(grep -n Step log.lammps | awk -F ':' '{print $1}')"
|
||||
en="$(grep -n Loop log.lammps | awk -F ':' '{print $1}')"
|
||||
in="$(echo "$in+1" | bc -l)"
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
|
||||
units metal
|
||||
atom_style spin
|
||||
# atom_style spin/kk
|
||||
atom_modify map array
|
||||
boundary f f f
|
||||
shell echo "test1"
|
||||
|
||||
atom_modify map array
|
||||
lattice sc 3.0
|
||||
|
||||
@ -3,9 +3,15 @@
|
||||
# clean old res
|
||||
rm res_*.dat
|
||||
|
||||
# compute Lammps
|
||||
# test standard Lammps
|
||||
./../../../../src/lmp_serial \
|
||||
-in test-spin-precession.in
|
||||
|
||||
# test spin/kk with Kokkos Lammps
|
||||
# mpirun -np 1 ../../../../src/lmp_kokkos_mpi_only \
|
||||
# -k on -sf kk -in test-spin-precession.in
|
||||
|
||||
# extract data from Lammps run
|
||||
in="$(grep -n Step log.lammps | awk -F ':' '{print $1}')"
|
||||
en="$(grep -n Loop log.lammps | awk -F ':' '{print $1}')"
|
||||
in="$(echo "$in+1" | bc -l)"
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
units metal
|
||||
atom_style spin
|
||||
# atom_style spin/kk
|
||||
atom_modify map array
|
||||
boundary f f f
|
||||
|
||||
|
||||
@ -12,7 +12,14 @@ do
|
||||
temp="$(echo "$tempi+$i*($tempf-$tempi)/$N" | bc -l)"
|
||||
sed s/temperature/${temp}/g test-prec-spin.template > \
|
||||
test-prec-spin.in
|
||||
|
||||
# test standard Lammps
|
||||
./../../../../src/lmp_serial -in test-prec-spin.in
|
||||
|
||||
# test spin/kk with Kokkos Lammps
|
||||
# mpirun -np 1 ../../../../src/lmp_kokkos_mpi_only \
|
||||
# -k on -sf kk -in test-prec-spin.in
|
||||
|
||||
Hz="$(tail -n 1 average_spin | awk -F " " '{print $3}')"
|
||||
sz="$(tail -n 1 average_spin | awk -F " " '{print $5}')"
|
||||
en="$(tail -n 1 average_spin | awk -F " " '{print $6}')"
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
units metal
|
||||
atom_style spin
|
||||
# atom_style spin/kk
|
||||
atom_modify map array
|
||||
boundary p p p
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
clear
|
||||
units metal
|
||||
atom_style spin
|
||||
# atom_style spin/kk
|
||||
|
||||
dimension 3
|
||||
boundary p p p
|
||||
@ -46,4 +47,8 @@ variable tmag equal c_out_mag[6]
|
||||
thermo_style custom step time v_tmag temp v_emag ke pe etotal
|
||||
thermo 200
|
||||
|
||||
compute outsp all property/atom spx spy spz sp fmx fmy fmz
|
||||
dump 1 all custom 10 dump_iron.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3]
|
||||
|
||||
run 100000
|
||||
# run 1
|
||||
|
||||
@ -3,9 +3,14 @@
|
||||
# clean old res
|
||||
rm res_*.dat
|
||||
|
||||
# compute Lammps
|
||||
./../../../../src/lmp_serial \
|
||||
-in in.spin.iron-nve
|
||||
# test standard Lammps
|
||||
../../../../src/lmp_serial -in in.spin.iron-nve
|
||||
|
||||
# test spin/kk with Kokkos Lammps
|
||||
# mpirun -np 1 ../../../../src/lmp_kokkos_mpi_only \
|
||||
# -k on -sf kk -in in.spin.iron-nve
|
||||
|
||||
# extract data from Lammps run
|
||||
in="$(grep -n Step log.lammps | awk -F ':' '{print $1}')"
|
||||
en="$(grep -n Loop log.lammps | awk -F ':' '{print $1}')"
|
||||
in="$(echo "$in+1" | bc -l)"
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
clear
|
||||
units metal
|
||||
atom_style spin
|
||||
# atom_style spin/kk
|
||||
|
||||
dimension 3
|
||||
boundary p p p
|
||||
@ -30,8 +31,8 @@ neighbor 0.1 bin
|
||||
neigh_modify every 10 check yes delay 20
|
||||
|
||||
fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
|
||||
fix 2 all langevin 200.0 200.0 1.0 48279
|
||||
fix 3 all langevin/spin 0.0 0.00001 321
|
||||
fix 2 all langevin 200.0 200.0 0.1 48279
|
||||
fix 3 all langevin/spin 0.0 0.0 321
|
||||
fix 4 all nve/spin lattice moving
|
||||
timestep 0.001
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user