Merge branch 'develop' of github.com:lammps/lammps into kk_update_4.6.1
This commit is contained in:
10
.github/release_steps.md
vendored
10
.github/release_steps.md
vendored
@ -104,13 +104,13 @@ with a future release) from the `lammps-static` folder.
|
||||
rm -rf release-packages
|
||||
mkdir release-packages
|
||||
cd release-packages
|
||||
wget https://download.lammps.org/static/fedora41_musl.sif
|
||||
apptainer shell fedora41_musl.sif
|
||||
wget https://download.lammps.org/static/fedora41_musl_mingw.sif
|
||||
apptainer shell fedora41_musl_mingw.sif
|
||||
git clone -b release --depth 10 https://github.com/lammps/lammps.git lammps-release
|
||||
cmake -S lammps-release/cmake -B build-release -G Ninja -D CMAKE_INSTALL_PREFIX=$PWD/lammps-static -D CMAKE_TOOLCHAIN_FILE=/usr/musl/share/cmake/linux-musl.cmake -C lammps-release/cmake/presets/most.cmake -C lammps-release/cmake/presets/kokkos-openmp.cmake -D DOWNLOAD_POTENTIALS=OFF -D BUILD_MPI=OFF -D BUILD_TESTING=OFF -D CMAKE_BUILD_TYPE=Release -D PKG_ATC=ON -D PKG_AWPMD=ON -D PKG_MANIFOLD=ON -D PKG_MESONT=ON -D PKG_MGPT=ON -D PKG_ML-PACE=ON -D PKG_ML-RANN=ON -D PKG_MOLFILE=ON -D PKG_PTM=ON -D PKG_QTB=ON -D PKG_SMTBQ=ON
|
||||
cmake --build build-release --target all
|
||||
cmake --build build-release --target install
|
||||
/usr/musl/bin/x86_64-linux-musl-strip lammps-static/bin/*
|
||||
/usr/musl/bin/x86_64-linux-musl-strip -g lammps-static/bin/*
|
||||
tar -czvvf ../lammps-linux-x86_64-4Feb2025.tar.gz lammps-static
|
||||
exit # fedora 41 container
|
||||
cd ..
|
||||
@ -204,7 +204,7 @@ cd ..
|
||||
rm -r release-packages
|
||||
```
|
||||
|
||||
#### Build Multi-arch App-bundle for macOS
|
||||
#### Build Multi-arch App-bundle with GUI for macOS
|
||||
|
||||
Building app-bundles for macOS is not as easily automated and portable
|
||||
as some of the other steps. It requires a machine actually running
|
||||
@ -251,7 +251,7 @@ attached to the GitHub release page.
|
||||
|
||||
We are currently building the application images on macOS 12 (aka Monterey).
|
||||
|
||||
#### Build Linux x86_64 binary tarball on Ubuntu 20.04LTS
|
||||
#### Build Linux x86_64 binary tarball with GUI on Ubuntu 20.04LTS
|
||||
|
||||
While the flatpak Linux version uses portable runtime libraries provided
|
||||
by the flatpak environment, we also build regular Linux executables that
|
||||
|
||||
23
.github/workflows/check-cpp23.yml
vendored
23
.github/workflows/check-cpp23.yml
vendored
@ -1,4 +1,4 @@
|
||||
# GitHub action to build LAMMPS on Linux with gcc and C++23
|
||||
# GitHub action to build LAMMPS on Linux with gcc or clang and C++23
|
||||
name: "Check for C++23 Compatibility"
|
||||
|
||||
on:
|
||||
@ -11,11 +11,19 @@ on:
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{github.event_name == 'pull_request'}}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build with C++23 support enabled
|
||||
if: ${{ github.repository == 'lammps/lammps' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
max-parallel: 2
|
||||
matrix:
|
||||
idx: [ gcc, clang ]
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
|
||||
@ -29,8 +37,11 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ccache \
|
||||
libeigen3-dev \
|
||||
clang \
|
||||
libcurl4-openssl-dev \
|
||||
libeigen3-dev \
|
||||
libfftw3-dev \
|
||||
libomp-dev \
|
||||
mold \
|
||||
mpi-default-bin \
|
||||
mpi-default-dev \
|
||||
@ -44,8 +55,8 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: linux-cpp23-ccache-${{ github.sha }}
|
||||
restore-keys: linux-cpp23-ccache-
|
||||
key: linux-cpp23-ccache-${{ matrix.idx }}-${{ github.sha }}
|
||||
restore-keys: linux-cpp23-ccache-${{ matrix.idx }}
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
shell: bash
|
||||
@ -58,14 +69,14 @@ jobs:
|
||||
cmake -S cmake -B build \
|
||||
-C cmake/presets/most.cmake \
|
||||
-C cmake/presets/kokkos-openmp.cmake \
|
||||
-C cmake/presets/${{ matrix.idx }}.cmake \
|
||||
-D CMAKE_CXX_STANDARD=23 \
|
||||
-D CMAKE_CXX_COMPILER=g++ \
|
||||
-D CMAKE_C_COMPILER=gcc \
|
||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_BUILD_TYPE=Debug \
|
||||
-D CMAKE_CXX_FLAGS_DEBUG="-Og -g" \
|
||||
-D DOWNLOAD_POTENTIALS=off \
|
||||
-D FFT=KISS \
|
||||
-D BUILD_MPI=on \
|
||||
-D BUILD_SHARED_LIBS=on \
|
||||
-D BUILD_TOOLS=off \
|
||||
|
||||
@ -7,6 +7,10 @@ if(CMAKE_VERSION VERSION_LESS 3.20)
|
||||
message(WARNING "LAMMPS is planning to require at least CMake version 3.20 by Summer 2025. Please upgrade!")
|
||||
endif()
|
||||
########################################
|
||||
# initialize version variables with project command
|
||||
if(POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
endif()
|
||||
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
||||
if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
@ -27,7 +31,10 @@ endif()
|
||||
|
||||
########################################
|
||||
|
||||
project(lammps CXX)
|
||||
project(lammps
|
||||
DESCRIPTION "The LAMMPS Molecular Dynamics Simulator"
|
||||
HOMEPAGE_URL "https://www.lammps.org"
|
||||
LANGUAGES CXX C)
|
||||
set(SOVERSION 0)
|
||||
get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
@ -131,7 +138,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "
|
||||
endif()
|
||||
|
||||
# silence nvcc warnings
|
||||
if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||
if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT
|
||||
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
||||
OR (CMAKE_CXX_COMPILER_ID STREQUAL "XLClang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "CrayClang")))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xcudafe --diag_suppress=unrecognized_pragma,--diag_suppress=128")
|
||||
endif()
|
||||
|
||||
@ -194,6 +203,10 @@ if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND BUILD_SHARED_LIBS)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
endif()
|
||||
|
||||
# do not include the (obsolete) MPI C++ bindings which makes for leaner object files
|
||||
# and avoids namespace conflicts. Put this early to increase its visbility.
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE CACHE BOOL "Skip MPI C++ Bindings" FORCE)
|
||||
|
||||
########################################################################
|
||||
# User input options #
|
||||
########################################################################
|
||||
@ -231,15 +244,6 @@ option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared lib
|
||||
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
||||
option(BUILD_LAMMPS_GUI "Build and install the LAMMPS GUI" OFF)
|
||||
|
||||
# Support using clang-tidy for C++ files with selected options
|
||||
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
|
||||
if(ENABLE_CLANG_TIDY)
|
||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*,performance-trivially-destructible,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-qualified-auto,misc-unused-parameters,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-shrink-to-fit,modernize-use-auto,modernize-use-using,modernize-use-override,modernize-use-bool-literals,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-equals-default,modernize-use-equals-delete,modernize-replace-random-shuffle,modernize-deprecated-headers,modernize-use-nullptr,modernize-use-noexcept,modernize-redundant-void-arg;-fix;-header-filter=.*,header-filter=library.h,header-filter=fmt/*.h" CACHE STRING "clang-tidy settings")
|
||||
else()
|
||||
unset(CMAKE_CXX_CLANG_TIDY CACHE)
|
||||
endif()
|
||||
|
||||
|
||||
file(GLOB ALL_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||
file(GLOB MAIN_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
||||
@ -264,6 +268,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
||||
set(STANDARD_PACKAGES
|
||||
ADIOS
|
||||
AMOEBA
|
||||
APIP
|
||||
ASPHERE
|
||||
ATC
|
||||
AWPMD
|
||||
@ -377,7 +382,6 @@ if(PKG_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)
|
||||
if(BUILD_MPI)
|
||||
if(NOT ADIOS2_HAVE_MPI)
|
||||
@ -392,21 +396,18 @@ if(PKG_ADIOS)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
find_package(MPI QUIET)
|
||||
find_package(MPI QUIET COMPONENTS CXX)
|
||||
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
||||
else()
|
||||
option(BUILD_MPI "Build MPI version" OFF)
|
||||
endif()
|
||||
|
||||
if(BUILD_MPI)
|
||||
# do not include the (obsolete) MPI C++ bindings which makes
|
||||
# for leaner object files and avoids namespace conflicts
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||
include(MPI4WIN)
|
||||
else()
|
||||
find_package(MPI REQUIRED)
|
||||
find_package(MPI REQUIRED COMPONENTS 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)
|
||||
@ -467,6 +468,7 @@ pkg_depends(ELECTRODE KSPACE)
|
||||
pkg_depends(EXTRA-MOLECULE MOLECULE)
|
||||
pkg_depends(MESONT MOLECULE)
|
||||
pkg_depends(RHEO BPM)
|
||||
pkg_depends(APIP ML-PACE)
|
||||
|
||||
# detect if we may enable OpenMP support by default
|
||||
set(BUILD_OMP_DEFAULT OFF)
|
||||
@ -533,7 +535,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_STANDARD GREATER_EQUA
|
||||
endif()
|
||||
|
||||
if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR PKG_RHEO OR BUILD_TOOLS)
|
||||
enable_language(C)
|
||||
if (NOT USE_INTERNAL_LINALG)
|
||||
find_package(LAPACK)
|
||||
find_package(BLAS)
|
||||
|
||||
@ -62,6 +62,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
endif()
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
||||
# skip over obsolete MPI-2 C++ bindings
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
|
||||
#######
|
||||
# helper functions from LAMMPSUtils.cmake
|
||||
function(validate_option name values)
|
||||
@ -128,8 +131,7 @@ endif()
|
||||
################################################################################
|
||||
# MPI configuration
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
find_package(MPI QUIET)
|
||||
find_package(MPI QUIET COMPONENTS CXX)
|
||||
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
||||
else()
|
||||
option(BUILD_MPI "Build MPI version" OFF)
|
||||
@ -141,78 +143,38 @@ if(BUILD_MPI)
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||
# Download and configure MinGW compatible MPICH development files for Windows
|
||||
option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF)
|
||||
if(USE_MSMPI)
|
||||
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
||||
else()
|
||||
message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI")
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a")
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
||||
else()
|
||||
# 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_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
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 ${MPICH2_WIN32_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||
message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI")
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a")
|
||||
else()
|
||||
find_package(MPI REQUIRED)
|
||||
find_package(MPI REQUIRED COMPONENTS 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 INTERFACE -DLAMMPS_LONGLONG_TO_LONG)
|
||||
|
||||
@ -75,13 +75,25 @@ function(get_lammps_version version_header variable)
|
||||
list(FIND MONTHS "${month}" month)
|
||||
string(LENGTH ${day} day_length)
|
||||
string(LENGTH ${month} month_length)
|
||||
if(day_length EQUAL 1)
|
||||
set(day "0${day}")
|
||||
# no leading zero needed for new version string with dots
|
||||
# if(day_length EQUAL 1)
|
||||
# set(day "0${day}")
|
||||
# endif()
|
||||
# if(month_length EQUAL 1)
|
||||
# set(month "0${month}")
|
||||
#endif()
|
||||
file(STRINGS ${version_header} line REGEX LAMMPS_UPDATE)
|
||||
string(REGEX REPLACE "#define LAMMPS_UPDATE \"Update ([0-9]+)\"" "\\1" tweak "${line}")
|
||||
if (line MATCHES "#define LAMMPS_UPDATE \"(Maintenance|Development)\"")
|
||||
set(tweak "99")
|
||||
endif()
|
||||
if(month_length EQUAL 1)
|
||||
set(month "0${month}")
|
||||
if(NOT tweak)
|
||||
set(tweak "0")
|
||||
endif()
|
||||
set(${variable} "${year}${month}${day}" PARENT_SCOPE)
|
||||
# new version string with dots
|
||||
set(${variable} "${year}.${month}.${day}.${tweak}" PARENT_SCOPE)
|
||||
# old version string without dots
|
||||
# set(${variable} "${year}${month}${day}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(check_for_autogen_files source_dir)
|
||||
|
||||
@ -1,74 +1,31 @@
|
||||
# Download and configure MinGW compatible MPICH development files for Windows
|
||||
option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF)
|
||||
# set-up MS-MPI library for Windows with MinGW compatibility
|
||||
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
|
||||
if(USE_MSMPI)
|
||||
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
||||
else()
|
||||
message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI")
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a")
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
||||
else()
|
||||
message(STATUS "Downloading and configuring MPICH2-1.4.1 for Windows cross-compilation")
|
||||
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 ${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 ${MPICH2_WIN32_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||
message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI")
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a")
|
||||
|
||||
@ -27,7 +27,6 @@ if(BUILD_OMP)
|
||||
endif()
|
||||
|
||||
if(BUILD_MPI)
|
||||
target_compile_definitions(colvars PUBLIC -DCOLVARS_MPI)
|
||||
target_link_libraries(colvars PUBLIC MPI::MPI_CXX)
|
||||
endif()
|
||||
|
||||
|
||||
@ -189,7 +189,7 @@ if(GPU_API STREQUAL "CUDA")
|
||||
endif()
|
||||
|
||||
add_executable(nvc_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||
target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR)
|
||||
target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR -DLAMMPS_${LAMMPS_SIZES})
|
||||
target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||
target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||
|
||||
@ -489,7 +489,7 @@ else()
|
||||
target_link_libraries(gpu PRIVATE mpi_stubs)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(gpu PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||
set_target_properties(gpu PROPERTIES OUTPUT_NAME lammps_gpu${LAMMPS_MACHINE})
|
||||
target_compile_definitions(gpu PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||
target_sources(lammps PRIVATE ${GPU_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${GPU_SOURCES_DIR})
|
||||
|
||||
@ -7,3 +7,13 @@ if(NOT PKG_MANYBODY)
|
||||
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.cpp)
|
||||
set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}")
|
||||
endif()
|
||||
|
||||
# fix neighbor/swap may only be installed if also the VORONOI package is installed
|
||||
if(NOT PKG_VORONOI)
|
||||
get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX)
|
||||
list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/MC/fix_neighbor_swap.h)
|
||||
set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}")
|
||||
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MC/fix_neighbor_swap.cpp)
|
||||
set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}")
|
||||
endif()
|
||||
|
||||
@ -53,7 +53,13 @@ else()
|
||||
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
|
||||
endif()
|
||||
|
||||
add_subdirectory(${lib-pace} build-pace)
|
||||
# fixup yaml-cpp/emitterutils.cpp for GCC 15+ until patch is applied
|
||||
file(READ ${lib-pace}/yaml-cpp/src/emitterutils.cpp yaml_emitterutils)
|
||||
string(REPLACE "#include <sstream>" "#include <sstream>\n#include <cinttypes>" yaml_tmp_emitterutils "${yaml_emitterutils}")
|
||||
string(REPLACE "#include <cinttypes>\n#include <cinttypes>" "#include <cinttypes>" yaml_emitterutils "${yaml_tmp_emitterutils}")
|
||||
file(WRITE ${lib-pace}/yaml-cpp/src/emitterutils.cpp "${yaml_emitterutils}")
|
||||
|
||||
add_subdirectory(${lib-pace} build-pace EXCLUDE_FROM_ALL)
|
||||
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
|
||||
|
||||
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
|
||||
|
||||
@ -21,11 +21,11 @@ if(ENABLE_TESTING)
|
||||
# also only verified with Fedora Linux > 30 and Ubuntu 18.04 or 22.04+(Ubuntu 20.04 fails)
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
||||
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND
|
||||
((CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04) OR (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04)))
|
||||
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.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(--ld-path=${CMAKE_LINKER} HAVE_LD_PATH_FLAG)
|
||||
check_cxx_compiler_flag(-fuse-ld=mold HAVE_MOLD_LINKER_FLAG)
|
||||
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
|
||||
check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER_FLAG)
|
||||
@ -50,6 +50,17 @@ if(ENABLE_TESTING)
|
||||
if(NOT "${CMAKE_CUSTOM_LINKER}" STREQUAL "default")
|
||||
target_link_options(lammps PUBLIC -fuse-ld=${CMAKE_CUSTOM_LINKER})
|
||||
endif()
|
||||
if(HAVE_LD_PATH_FLAG)
|
||||
if("${CMAKE_CUSTOM_LINKER}" STREQUAL "mold")
|
||||
target_link_options(lammps PUBLIC --ld-path=${HAVE_MOLD_LINKER_BIN})
|
||||
elseif("${CMAKE_CUSTOM_LINKER}" STREQUAL "lld")
|
||||
target_link_options(lammps PUBLIC --ld-path=${HAVE_LLD_LINKER_BIN})
|
||||
elseif("${CMAKE_CUSTOM_LINKER}" STREQUAL "gold")
|
||||
target_link_options(lammps PUBLIC --ld-path=${HAVE_GOLD_LINKER_BIN})
|
||||
elseif("${CMAKE_CUSTOM_LINKER}" STREQUAL "bfd")
|
||||
target_link_options(lammps PUBLIC --ld-path=${HAVE_BFD_LINKER_BIN})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@ -6,6 +6,10 @@ if(BUILD_TOOLS)
|
||||
add_executable(stl_bin2txt ${LAMMPS_TOOLS_DIR}/stl_bin2txt.cpp)
|
||||
install(TARGETS stl_bin2txt DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
add_executable(reformat-json ${LAMMPS_TOOLS_DIR}/json/reformat-json.cpp)
|
||||
target_include_directories(reformat-json PRIVATE ${LAMMPS_SOURCE_DIR})
|
||||
install(TARGETS reformat-json DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
include(CheckGeneratorSupport)
|
||||
if(CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
||||
include(CheckLanguage)
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
set(ALL_PACKAGES
|
||||
ADIOS
|
||||
AMOEBA
|
||||
APIP
|
||||
ASPHERE
|
||||
ATC
|
||||
AWPMD
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
set(ALL_PACKAGES
|
||||
ADIOS
|
||||
AMOEBA
|
||||
APIP
|
||||
ASPHERE
|
||||
ATC
|
||||
AWPMD
|
||||
|
||||
@ -19,12 +19,19 @@ set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
|
||||
set(MPI_CXX "hipcc" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
set(MPI_C "hipcc" CACHE STRING "" FORCE)
|
||||
set(MPI_C_COMPILER "mpicc" CACHE STRING "" FORCE)
|
||||
|
||||
# change as needed. This is for Fedora Linux 41 and 42
|
||||
set(_libomp_root "/usr/lib/clang/18")
|
||||
# we need to explicitly specify the include dir, since hipcc will
|
||||
# compile each file twice and doesn't find omp.h the second time
|
||||
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(OpenMP_C "hipcc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-fopenmp=libomp -I${_libomp_root}/include" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX "hipcc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-fopenmp=libomp -I${_libomp_root}/include" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
# preset that enables KOKKOS and selects CUDA compilation with OpenMP
|
||||
# enabled as well. The GPU architecture *must* match your hardware
|
||||
# enabled as well. The GPU architecture *must* match your hardware (If not manually set, Kokkos will try to autodetect it).
|
||||
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE)
|
||||
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||
get_filename_component(NVCC_WRAPPER_CMD ${CMAKE_CURRENT_SOURCE_DIR}/../lib/kokkos/bin/nvcc_wrapper ABSOLUTE)
|
||||
set(CMAKE_CXX_COMPILER ${NVCC_WRAPPER_CMD} CACHE FILEPATH "" FORCE)
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
# preset that enables KOKKOS and selects HIP compilation with OpenMP
|
||||
# enabled as well. Also sets some performance related compiler flags.
|
||||
# preset that enables KOKKOS and selects HIP compilation withOUT OpenMP.
|
||||
# Kokkos OpenMP is not compatible with the second pass of hipcc.
|
||||
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_OPENMP OFF CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_HIP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_VEGA90A on CACHE BOOL "" FORCE)
|
||||
@ -11,11 +11,11 @@ set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -munsafe-fp-atomics" CACHE STRING "" FORCE)
|
||||
|
||||
# If KSPACE is also enabled, use CUFFT for FFTs
|
||||
# If KSPACE is also enabled, use HIPFFT for FFTs
|
||||
set(FFT_KOKKOS "HIPFFT" CACHE STRING "" FORCE)
|
||||
|
||||
# hide deprecation warnings temporarily for stable release
|
||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||
#set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# these flags are needed to build with Cray MPICH on OLCF Crusher
|
||||
#-D CMAKE_CXX_FLAGS="-I/${MPICH_DIR}/include"
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
set(PACKAGES_WITH_LIB
|
||||
ADIOS
|
||||
APIP
|
||||
ATC
|
||||
AWPMD
|
||||
COMPRESS
|
||||
|
||||
@ -99,8 +99,6 @@ html: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJ
|
||||
@(\
|
||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
sphinx-build -E $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
||||
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
||||
ln -sf Manual.html html/index.html;\
|
||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||
echo "############################################" ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
@ -162,8 +160,6 @@ epub: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
@(\
|
||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
sphinx-build -E $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
||||
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
sphinx-build $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||
deactivate ;\
|
||||
)
|
||||
@ -183,8 +179,6 @@ pdf: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
@(\
|
||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
sphinx-build -E $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
||||
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
sphinx-build $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||
echo "############################################" ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
rst_anchor_check src/*.rst ;\
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
.TH LAMMPS "1" "2 April 2025" "2025-04-02"
|
||||
.TH LAMMPS "1" "12 June 2025" "2025-06-12"
|
||||
.SH NAME
|
||||
.B LAMMPS
|
||||
\- Molecular Dynamics Simulator. Version 2 April 2025
|
||||
\- Molecular Dynamics Simulator. Version 12 June 2025
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B lmp
|
||||
|
||||
@ -28,28 +28,6 @@ variable VERBOSE set to 1:
|
||||
|
||||
----------
|
||||
|
||||
.. _clang-tidy:
|
||||
|
||||
Enable static code analysis with clang-tidy (CMake only)
|
||||
--------------------------------------------------------
|
||||
|
||||
The `clang-tidy tool <https://clang.llvm.org/extra/clang-tidy/>`_ is a
|
||||
static code analysis tool to diagnose (and potentially fix) typical
|
||||
programming errors or coding style violations. It has a modular framework
|
||||
of tests that can be adjusted to help identifying problems before they
|
||||
become bugs and also assist in modernizing large code bases (like LAMMPS).
|
||||
It can be enabled for all C++ code with the following CMake flag
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
-D ENABLE_CLANG_TIDY=value # value = no (default) or yes
|
||||
|
||||
With this flag enabled all source files will be processed twice, first to
|
||||
be compiled and then to be analyzed. Please note that the analysis can be
|
||||
significantly more time-consuming than the compilation itself.
|
||||
|
||||
----------
|
||||
|
||||
.. _iwyu_processing:
|
||||
|
||||
Report missing and unneeded '#include' statements (CMake only)
|
||||
|
||||
@ -35,6 +35,7 @@ This is the list of packages that may require additional steps.
|
||||
:columns: 6
|
||||
|
||||
* :ref:`ADIOS <adios>`
|
||||
* :ref:`APIP <apip>`
|
||||
* :ref:`ATC <atc>`
|
||||
* :ref:`AWPMD <awpmd>`
|
||||
* :ref:`COLVARS <colvar>`
|
||||
@ -1284,6 +1285,34 @@ systems.
|
||||
|
||||
----------
|
||||
|
||||
.. _apip:
|
||||
|
||||
APIP package
|
||||
-----------------------------
|
||||
|
||||
The APIP package depends on the library of the
|
||||
:ref:`ML-PACE <ml-pace>` 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
|
||||
|
||||
No additional settings are needed besides ``-D PKG_APIP=yes``
|
||||
and ``-D PKG_ML-PACE=yes``.
|
||||
One can use a local version of the ML-PACE library instead of
|
||||
automatically downloading the library as described :ref:`here <ml-pace>`.
|
||||
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
You need to install the ML-PACE package *first* and follow
|
||||
the instructions :ref:`here <ml-pace>` before installing
|
||||
the APIP package.
|
||||
|
||||
----------
|
||||
|
||||
.. _atc:
|
||||
|
||||
ATC package
|
||||
|
||||
@ -22,6 +22,7 @@ OPT.
|
||||
* :doc:`append/atoms <fix_append_atoms>`
|
||||
* :doc:`atc <fix_atc>`
|
||||
* :doc:`atom/swap <fix_atom_swap>`
|
||||
* :doc:`atom_weight/apip <fix_atom_weight_apip>`
|
||||
* :doc:`ave/atom <fix_ave_atom>`
|
||||
* :doc:`ave/chunk <fix_ave_chunk>`
|
||||
* :doc:`ave/correlate <fix_ave_correlate>`
|
||||
@ -29,6 +30,7 @@ OPT.
|
||||
* :doc:`ave/grid <fix_ave_grid>`
|
||||
* :doc:`ave/histo <fix_ave_histo>`
|
||||
* :doc:`ave/histo/weight <fix_ave_histo>`
|
||||
* :doc:`ave/moments <fix_ave_moments>`
|
||||
* :doc:`ave/time <fix_ave_time>`
|
||||
* :doc:`aveforce <fix_aveforce>`
|
||||
* :doc:`balance <fix_balance>`
|
||||
@ -90,6 +92,8 @@ OPT.
|
||||
* :doc:`imd <fix_imd>`
|
||||
* :doc:`indent <fix_indent>`
|
||||
* :doc:`ipi <fix_ipi>`
|
||||
* :doc:`lambda/apip <fix_lambda_apip>`
|
||||
* :doc:`lambda_thermostat/apip <fix_lambda_thermostat_apip>`
|
||||
* :doc:`langevin (k) <fix_langevin>`
|
||||
* :doc:`langevin/drude <fix_langevin_drude>`
|
||||
* :doc:`langevin/eff <fix_langevin_eff>`
|
||||
@ -217,6 +221,7 @@ OPT.
|
||||
* :doc:`rigid/small (o) <fix_rigid>`
|
||||
* :doc:`rx (k) <fix_rx>`
|
||||
* :doc:`saed/vtk <fix_saed_vtk>`
|
||||
* :doc:`set <fix_set>`
|
||||
* :doc:`setforce (k) <fix_setforce>`
|
||||
* :doc:`setforce/spin <fix_setforce>`
|
||||
* :doc:`sgcmc <fix_sgcmc>`
|
||||
|
||||
@ -31,3 +31,5 @@ OPT.
|
||||
* :doc:`pppm/dielectric <kspace_style>`
|
||||
* :doc:`pppm/electrode (i) <kspace_style>`
|
||||
* :doc:`scafacos <kspace_style>`
|
||||
* :doc:`zero <kspace_style>`
|
||||
|
||||
|
||||
@ -96,7 +96,9 @@ OPT.
|
||||
* :doc:`eam/cd <pair_eam>`
|
||||
* :doc:`eam/cd/old <pair_eam>`
|
||||
* :doc:`eam/fs (gikot) <pair_eam>`
|
||||
* :doc:`eam/fs/apip <pair_eam_apip>`
|
||||
* :doc:`eam/he <pair_eam>`
|
||||
* :doc:`eam/apip <pair_eam_apip>`
|
||||
* :doc:`edip (o) <pair_edip>`
|
||||
* :doc:`edip/multi <pair_edip>`
|
||||
* :doc:`edpd (g) <pair_mesodpd>`
|
||||
@ -124,6 +126,9 @@ OPT.
|
||||
* :doc:`ilp/tmd (t) <pair_ilp_tmd>`
|
||||
* :doc:`kolmogorov/crespi/full <pair_kolmogorov_crespi_full>`
|
||||
* :doc:`kolmogorov/crespi/z <pair_kolmogorov_crespi_z>`
|
||||
* :doc:`lambda/input/apip <pair_lambda_input_apip>`
|
||||
* :doc:`lambda/input/csp/apip <pair_lambda_input_apip>`
|
||||
* :doc:`lambda/zone/apip <pair_lambda_zone_apip>`
|
||||
* :doc:`lcbop <pair_lcbop>`
|
||||
* :doc:`lebedeva/z <pair_lebedeva_z>`
|
||||
* :doc:`lennard/mdf <pair_mdf>`
|
||||
@ -237,6 +242,9 @@ OPT.
|
||||
* :doc:`oxrna2/coaxstk <pair_oxrna2>`
|
||||
* :doc:`pace (k) <pair_pace>`
|
||||
* :doc:`pace/extrapolation (k) <pair_pace>`
|
||||
* :doc:`pace/apip <pair_pace_apip>`
|
||||
* :doc:`pace/fast/apip <pair_pace_apip>`
|
||||
* :doc:`pace/precise/apip <pair_pace_apip>`
|
||||
* :doc:`pedone (o) <pair_pedone>`
|
||||
* :doc:`pod (k) <pair_pod>`
|
||||
* :doc:`peri/eps <pair_peri>`
|
||||
|
||||
@ -15,7 +15,7 @@ with the direct alternative (if available) and print a warning.
|
||||
GJF formulation in fix langevin
|
||||
-------------------------------
|
||||
|
||||
.. deprecated:: TBD
|
||||
.. deprecated:: 12Jun2025
|
||||
|
||||
The *gjf* keyword in fix langevin is deprecated and will be removed
|
||||
soon. The GJF functionality has been moved to its own fix style
|
||||
|
||||
@ -68,24 +68,25 @@ Members of ``lammpsplugin_t``
|
||||
* - author
|
||||
- String with the name and email of the author
|
||||
* - creator.v1
|
||||
- Pointer to factory function for pair, bond, angle, dihedral, improper, kspace, or command styles
|
||||
- Pointer to factory function for pair, bond, angle, dihedral, improper, kspace, command, or minimize styles
|
||||
* - creator.v2
|
||||
- Pointer to factory function for compute, fix, or region styles
|
||||
- Pointer to factory function for compute, fix, region, or run styles
|
||||
* - handle
|
||||
- Pointer to the open DSO file handle
|
||||
|
||||
Only one of the two alternate creator entries can be used at a time and
|
||||
which of those is determined by the style of plugin. The "creator.v1"
|
||||
element is for factory functions of supported styles computing forces
|
||||
(i.e. pair, bond, angle, dihedral, or improper styles) or command 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.
|
||||
(i.e. pair, bond, angle, dihedral, or improper styles), command styles,
|
||||
or minimize 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,
|
||||
region, or run 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
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
@ -247,8 +248,8 @@ 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.
|
||||
in a global 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
|
||||
@ -263,6 +264,21 @@ the plugin will override the existing code. This can be used to modify
|
||||
the behavior of existing styles or to debug new versions of them without
|
||||
having to re-compile or re-install all of LAMMPS.
|
||||
|
||||
.. versionchanged:: 12Jun2025
|
||||
|
||||
When using the :doc:`clear <clear>` command, plugins are not unloaded
|
||||
but restored to their respective style maps. This also applies when
|
||||
multiple LAMMPS instances are created and deleted through the library
|
||||
interface. The :doc:`plugin load <plugin>` load command may be issued
|
||||
again, but for existing plugins they will be skipped. To replace
|
||||
plugins they must be explicitly unloaded with :doc:`plugin unload
|
||||
<plugin>`. When multiple LAMMPS instances are created concurrently, any
|
||||
loaded plugins will be added to the global list of plugins, but are not
|
||||
immediately available to any LAMMPS instance that was created before
|
||||
loading the plugin. To "import" such plugins, the :doc:`plugin restore
|
||||
<plugin>` may be used. Plugins are only removed when they are explicitly
|
||||
unloaded or the LAMMPS interface is "finalized".
|
||||
|
||||
Compiling plugins
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ Available topics in mostly chronological order are:
|
||||
- `Rename of fix STORE/PERATOM to fix STORE/ATOM and change of arguments`_
|
||||
- `Use Output::get_dump_by_id() instead of Output::find_dump()`_
|
||||
- `Refactored grid communication using Grid3d/Grid2d classes instead of GridComm`_
|
||||
- `FLERR as first argument to minimum image functions in Domain class`_
|
||||
|
||||
----
|
||||
|
||||
@ -610,3 +611,47 @@ KSpace solvers which use distributed FFT grids:
|
||||
- ``src/KSPACE/pppm.cpp``
|
||||
|
||||
This change is **required** or else the code will not compile.
|
||||
|
||||
FLERR as first argument to minimum image functions in Domain class
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 12Jun2025
|
||||
|
||||
The ``Domain::minimum_image()`` and ``Domain::minimum_image_big()``
|
||||
functions were changed to take the ``FLERR`` macros as first argument.
|
||||
This way the error message indicates *where* the function was called
|
||||
instead of pointing to the implementation of the function. Example:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
double delx1 = x[i1][0] - x[i2][0];
|
||||
double dely1 = x[i1][1] - x[i2][1];
|
||||
double delz1 = x[i1][2] - x[i2][2];
|
||||
domain->minimum_image(delx1, dely1, delz1);
|
||||
double r1 = sqrt(delx1 * delx1 + dely1 * dely1 + delz1 * delz1);
|
||||
|
||||
double delx2 = x[i3][0] - x[i2][0];
|
||||
double dely2 = x[i3][1] - x[i2][1];
|
||||
double delz2 = x[i3][2] - x[i2][2];
|
||||
domain->minimum_image_big(delx2, dely2, delz2);
|
||||
double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2);
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
double delx1 = x[i1][0] - x[i2][0];
|
||||
double dely1 = x[i1][1] - x[i2][1];
|
||||
double delz1 = x[i1][2] - x[i2][2];
|
||||
domain->minimum_image(FLERR, delx1, dely1, delz1);
|
||||
double r1 = sqrt(delx1 * delx1 + dely1 * dely1 + delz1 * delz1);
|
||||
|
||||
double delx2 = x[i3][0] - x[i2][0];
|
||||
double dely2 = x[i3][1] - x[i2][1];
|
||||
double delz2 = x[i3][2] - x[i2][2];
|
||||
domain->minimum_image_big(FLERR, delx2, dely2, delz2);
|
||||
double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2);
|
||||
|
||||
This change is **required** or else the code will not compile.
|
||||
|
||||
@ -1,124 +1,149 @@
|
||||
Common problems
|
||||
===============
|
||||
Common issues that are often regarded as bugs
|
||||
=============================================
|
||||
|
||||
If two LAMMPS runs do not produce the exact same answer on different
|
||||
machines or different numbers of processors, this is typically not a
|
||||
bug. In theory you should get identical answers on any number of
|
||||
processors and on any machine. In practice, numerical round-off can
|
||||
cause slight differences and eventual divergence of molecular dynamics
|
||||
phase space trajectories within a few 100s or few 1000s of timesteps.
|
||||
However, the statistical properties of the two runs (e.g. average
|
||||
energy or temperature) should still be the same.
|
||||
The list below are some random notes on behavior of LAMMPS that is
|
||||
sometimes unexpected or even considered a bug. Most of the time, these
|
||||
are just issues of understanding how LAMMPS is implemented and
|
||||
parallelized. Please also have a look at the :doc:`Error details
|
||||
discussions page <Errors_details>` that contains recommendations for
|
||||
tracking down issues and explanations for error messages that may
|
||||
sometimes be confusing or need additional explanations.
|
||||
|
||||
If the :doc:`velocity <velocity>` command is used to set initial atom
|
||||
velocities, a particular atom can be assigned a different velocity
|
||||
when the problem is run on a different number of processors or on
|
||||
different machines. If this happens, the phase space trajectories of
|
||||
the two simulations will rapidly diverge. See the discussion of the
|
||||
*loop* option in the :doc:`velocity <velocity>` command for details and
|
||||
options that avoid this issue.
|
||||
- A LAMMPS simulation typically has two stages, 1) issuing commands
|
||||
and 2) run or minimize. Most LAMMPS errors are detected in stage 1),
|
||||
others at the beginning of stage 2), and finally others like a bond
|
||||
stretching too far may or lost atoms or bonds may not occur until the
|
||||
middle of a run.
|
||||
|
||||
Similarly, the :doc:`create_atoms <create_atoms>` command generates a
|
||||
lattice of atoms. For the same physical system, the ordering and
|
||||
numbering of atoms by atom ID may be different depending on the number
|
||||
of processors.
|
||||
- If two LAMMPS runs do not produce the exact same answer on different
|
||||
machines or different numbers of processors, this is typically not a
|
||||
bug. In theory you should get identical answers on any number of
|
||||
processors and on any machine. In practice, numerical round-off can
|
||||
cause slight differences and eventual divergence of molecular dynamics
|
||||
phase space trajectories within a few 100s or few 1000s of timesteps.
|
||||
This can be triggered by different ordering of atoms due to different
|
||||
domain decompositions, but also through different CPU architectures,
|
||||
different operating systems, different compilers or compiler versions,
|
||||
different compiler optimization levels, different FFT libraries.
|
||||
However, the statistical properties of the two runs (e.g. average
|
||||
energy or temperature) should still be the same.
|
||||
|
||||
Some commands use random number generators which may be setup to
|
||||
produce different random number streams on each processor and hence
|
||||
will produce different effects when run on different numbers of
|
||||
processors. A commonly-used example is the :doc:`fix langevin <fix_langevin>` command for thermostatting.
|
||||
- If the :doc:`velocity <velocity>` command is used to set initial atom
|
||||
velocities, a particular atom can be assigned a different velocity
|
||||
when the problem is run on a different number of processors or on
|
||||
different machines. If this happens, the phase space trajectories of
|
||||
the two simulations will rapidly diverge. See the discussion of the
|
||||
*loop* option in the :doc:`velocity <velocity>` command for details
|
||||
and options that avoid this issue.
|
||||
|
||||
A LAMMPS simulation typically has two stages, setup and run. Most
|
||||
LAMMPS errors are detected at setup time; others like a bond
|
||||
stretching too far may not occur until the middle of a run.
|
||||
- Similarly, the :doc:`create_atoms <create_atoms>` command generates a
|
||||
lattice of atoms. For the same physical system, the ordering and
|
||||
numbering of atoms by atom ID may be different depending on the number
|
||||
of processors.
|
||||
|
||||
LAMMPS tries to flag errors and print informative error messages so
|
||||
you can fix the problem. For most errors it will also print the last
|
||||
input script command that it was processing. Of course, LAMMPS cannot
|
||||
figure out your physics or numerical mistakes, like choosing too big a
|
||||
timestep, specifying erroneous force field coefficients, or putting 2
|
||||
atoms on top of each other! If you run into errors that LAMMPS
|
||||
does not catch that you think it should flag, please send an email to
|
||||
the `developers <https://www.lammps.org/authors.html>`_ or create an new
|
||||
topic on the dedicated `MatSci forum section <https://matsci.org/lammps/>`_.
|
||||
- Some commands use random number generators which may be setup to
|
||||
produce different random number streams on each processor and hence
|
||||
will produce different effects when run on different numbers of
|
||||
processors. A commonly-used example is the :doc:`fix langevin
|
||||
<fix_langevin>` command for thermostatting.
|
||||
|
||||
If you get an error message about an invalid command in your input
|
||||
script, you can determine what command is causing the problem by
|
||||
looking in the log.lammps file or using the :doc:`echo command <echo>`
|
||||
to see it on the screen. If you get an error like "Invalid ...
|
||||
style", with ... being fix, compute, pair, etc, it means that you
|
||||
mistyped the style name or that the command is part of an optional
|
||||
package which was not compiled into your executable. The list of
|
||||
available styles in your executable can be listed by using
|
||||
:doc:`the -h command-line switch <Run_options>`. The installation and
|
||||
compilation of optional packages is explained on the
|
||||
:doc:`Build packages <Build_package>` doc page.
|
||||
- LAMMPS tries to flag errors and print informative error messages so
|
||||
you can fix the problem. For most errors it will also print the last
|
||||
input script command that it was processing or even point to the
|
||||
keyword that is causing troubles. Of course, LAMMPS cannot figure out
|
||||
your physics or numerical mistakes, like choosing too big a timestep,
|
||||
specifying erroneous force field coefficients, or putting 2 atoms on
|
||||
top of each other! Also, LAMMPS does not know what you *intend* to
|
||||
do, but very strictly applies the syntax as described in the
|
||||
documentation. If you run into errors that LAMMPS does not catch that
|
||||
you think it should flag, please send an email to the `developers
|
||||
<https://www.lammps.org/authors.html>`_ or create an new topic on the
|
||||
dedicated `MatSci forum section <https://matsci.org/lammps/>`_.
|
||||
|
||||
For a given command, LAMMPS expects certain arguments in a specified
|
||||
order. If you mess this up, LAMMPS will often flag the error, but it
|
||||
may also simply read a bogus argument and assign a value that is
|
||||
valid, but not what you wanted. E.g. trying to read the string "abc"
|
||||
as an integer value of 0. Careful reading of the associated doc page
|
||||
for the command should allow you to fix these problems. In most cases,
|
||||
where LAMMPS expects to read a number, either integer or floating point,
|
||||
it performs a stringent test on whether the provided input actually
|
||||
is an integer or floating-point number, respectively, and reject the
|
||||
input with an error message (for instance, when an integer is required,
|
||||
but a floating-point number 1.0 is provided):
|
||||
- If you get an error message about an invalid command in your input
|
||||
script, you can determine what command is causing the problem by
|
||||
looking in the log.lammps file or using the :doc:`echo command <echo>`
|
||||
to see it on the screen. If you get an error like "Invalid ...
|
||||
style", with ... being fix, compute, pair, etc, it means that you
|
||||
mistyped the style name or that the command is part of an optional
|
||||
package which was not compiled into your executable. The list of
|
||||
available styles in your executable can be listed by using
|
||||
:doc:`the -h command-line switch <Run_options>`. The installation and
|
||||
compilation of optional packages is explained on the :doc:`Build
|
||||
packages <Build_package>` doc page.
|
||||
|
||||
.. parsed-literal::
|
||||
- For a given command, LAMMPS expects certain arguments in a specified
|
||||
order. If you mess this up, LAMMPS will often flag the error, but it
|
||||
may also simply read a bogus argument and assign a value that is
|
||||
valid, but not what you wanted. E.g. trying to read the string "abc"
|
||||
as an integer value of 0. Careful reading of the associated doc page
|
||||
for the command should allow you to fix these problems. In most cases,
|
||||
where LAMMPS expects to read a number, either integer or floating
|
||||
point, it performs a stringent test on whether the provided input
|
||||
actually is an integer or floating-point number, respectively, and
|
||||
reject the input with an error message (for instance, when an integer
|
||||
is required, but a floating-point number 1.0 is provided):
|
||||
|
||||
ERROR: Expected integer parameter instead of '1.0' in input script or data file
|
||||
.. parsed-literal::
|
||||
|
||||
Some commands allow for using variable references in place of numeric
|
||||
constants so that the value can be evaluated and may change over the
|
||||
course of a run. This is typically done with the syntax *v_name* for a
|
||||
parameter, where name is the name of the variable. On the other hand,
|
||||
immediate variable expansion with the syntax ${name} is performed while
|
||||
reading the input and before parsing commands,
|
||||
ERROR: Expected integer parameter instead of '1.0' in input script or data file
|
||||
|
||||
.. note::
|
||||
- Some commands allow for using variable references in place of numeric
|
||||
constants so that the value can be evaluated and may change over the
|
||||
course of a run. This is typically done with the syntax *v_name* for
|
||||
a parameter, where name is the name of the variable. On the other
|
||||
hand, immediate variable expansion with the syntax ${name} is
|
||||
performed while reading the input and before parsing commands,
|
||||
|
||||
Using a variable reference (i.e. *v_name*) is only allowed if
|
||||
the documentation of the corresponding command explicitly says it is.
|
||||
Otherwise, you will receive an error message of this kind:
|
||||
.. note::
|
||||
|
||||
.. parsed-literal::
|
||||
Using a variable reference (i.e. *v_name*) is only allowed if
|
||||
the documentation of the corresponding command explicitly says it is.
|
||||
Otherwise, you will receive an error message of this kind:
|
||||
|
||||
ERROR: Expected floating point parameter instead of 'v_name' in input script or data file
|
||||
.. parsed-literal::
|
||||
|
||||
Generally, LAMMPS will print a message to the screen and logfile and
|
||||
exit gracefully when it encounters a fatal error. Sometimes it will
|
||||
print a WARNING to the screen and logfile and continue on; you can
|
||||
decide if the WARNING is important or not. A WARNING message that is
|
||||
generated in the middle of a run is only printed to the screen, not to
|
||||
the logfile, to avoid cluttering up thermodynamic output. If LAMMPS
|
||||
crashes or hangs without spitting out an error message first then it
|
||||
could be a bug (see :doc:`this section <Errors_bugs>`) or one of the following
|
||||
cases:
|
||||
ERROR: Expected floating point parameter instead of 'v_name' in input script or data file
|
||||
|
||||
LAMMPS runs in the available memory a processor allows to be
|
||||
allocated. Most reasonable MD runs are compute limited, not memory
|
||||
limited, so this should not be a bottleneck on most platforms. Almost
|
||||
all large memory allocations in the code are done via C-style malloc's
|
||||
which will generate an error message if you run out of memory.
|
||||
Smaller chunks of memory are allocated via C++ "new" statements. If
|
||||
you are unlucky you could run out of memory just when one of these
|
||||
small requests is made, in which case the code will crash or hang (in
|
||||
parallel), since LAMMPS does not trap on those errors.
|
||||
- Generally, LAMMPS will print a message to the screen and logfile and
|
||||
exit gracefully when it encounters a fatal error. When running in
|
||||
parallel this message may be stuck in an I/O buffer and LAMMPS will be
|
||||
terminated before that buffer is printed. In that case you can try
|
||||
adding the ``-nonblock`` or ``-nb`` command-line flag to turn off that
|
||||
buffering. Please note that this should not be used for production
|
||||
runs, since turning off buffering usually has a significant negative
|
||||
impact on performance (even worse than :doc:`thermo_modify flush yes
|
||||
<thermo_modify>`). Sometimes LAMMPS will print a WARNING to the
|
||||
screen and logfile and continue on; you can decide if the WARNING is
|
||||
important or not, but as a general rule do not ignore warnings that
|
||||
you not understand. A WARNING message that is generated in the middle
|
||||
of a run is only printed to the screen, not to the logfile, to avoid
|
||||
cluttering up thermodynamic output. If LAMMPS crashes or hangs
|
||||
without generating an error message first then it could be a bug
|
||||
(see :doc:`this section <Errors_bugs>`).
|
||||
|
||||
Illegal arithmetic can cause LAMMPS to run slow or crash. This is
|
||||
typically due to invalid physics and numerics that your simulation is
|
||||
computing. If you see wild thermodynamic values or NaN values in your
|
||||
LAMMPS output, something is wrong with your simulation. If you
|
||||
suspect this is happening, it is a good idea to print out
|
||||
thermodynamic info frequently (e.g. every timestep) via the
|
||||
:doc:`thermo <thermo>` so you can monitor what is happening.
|
||||
Visualizing the atom movement is also a good idea to ensure your model
|
||||
is behaving as you expect.
|
||||
- LAMMPS runs in the available memory a processor allows to be
|
||||
allocated. Most reasonable MD runs are compute limited, not memory
|
||||
limited, so this should not be a bottleneck on most platforms. Almost
|
||||
all large memory allocations in the code are done via C-style malloc's
|
||||
which will generate an error message if you run out of memory.
|
||||
Smaller chunks of memory are allocated via C++ "new" statements. If
|
||||
you are unlucky you could run out of memory just when one of these
|
||||
small requests is made, in which case the code will crash or hang (in
|
||||
parallel).
|
||||
|
||||
In parallel, one way LAMMPS can hang is due to how different MPI
|
||||
implementations handle buffering of messages. If the code hangs
|
||||
without an error message, it may be that you need to specify an MPI
|
||||
setting or two (usually via an environment variable) to enable
|
||||
buffering or boost the sizes of messages that can be buffered.
|
||||
- Illegal arithmetic can cause LAMMPS to run slow or crash. This is
|
||||
typically due to invalid physics and numerics that your simulation is
|
||||
computing. If you see wild thermodynamic values or NaN values in your
|
||||
LAMMPS output, something is wrong with your simulation. If you
|
||||
suspect this is happening, it is a good idea to print out
|
||||
thermodynamic info frequently (e.g. every timestep) via the
|
||||
:doc:`thermo <thermo>` so you can monitor what is happening.
|
||||
Visualizing the atom movement is also a good idea to ensure your model
|
||||
is behaving as you expect.
|
||||
|
||||
- When running in parallel with MPI, one way LAMMPS can hang is because
|
||||
LAMMPS has come across an error condition, but only on one or a few
|
||||
MPI processes and not all of them. LAMMPS has two different "stop
|
||||
with an error message" functions and the correct one has to be called
|
||||
or else it will hang.
|
||||
|
||||
@ -51,8 +51,11 @@ Parallel versus serial
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Issues where something is "lost" or "missing" often exhibit that issue
|
||||
only when running in parallel. That doesn't mean there is no problem,
|
||||
only the symptoms are not triggering an error quickly. Correspondingly,
|
||||
*only* when running in parallel. That doesn't mean there is no problem
|
||||
when running in serial, only the symptoms are not triggering an error.
|
||||
This may be because there is no domain decomposition with just one
|
||||
processor and thus all atoms are accessible, or it may be because the
|
||||
problem will manifest faster with smaller subdomains. Correspondingly,
|
||||
errors may be triggered faster with more processors and thus smaller
|
||||
sub-domains.
|
||||
|
||||
@ -244,6 +247,25 @@ equal style (or similar) variables can only be expanded before the box
|
||||
is defined if they do not reference anything that cannot be defined
|
||||
before the box (e.g. a compute or fix reference or a thermo keyword).
|
||||
|
||||
.. _hint13:
|
||||
|
||||
Illegal ... command
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
These are a catchall error messages that used to be used a lot in LAMMPS
|
||||
(also programmers are sometimes lazy). They usually include the name of
|
||||
the source file and the line where the error happened. This can be used
|
||||
to track down what caused the error (most often some form of syntax error)
|
||||
by looking at the source code. However, this has two disadvantages: 1. one
|
||||
has to check the source file from the exact same LAMMPS version, or else
|
||||
the line number would be different or the core may have been rewritten and
|
||||
that specific error does not exist anymore.
|
||||
|
||||
The LAMMPS developers are committed to replace these too generic error
|
||||
messages with more descriptive errors, e.g. listing *which* keyword was
|
||||
causing the error, so that it will be much simpler to look up the
|
||||
correct syntax in the manual (and without referring to the source code).
|
||||
|
||||
------
|
||||
|
||||
.. _err0001:
|
||||
@ -1029,13 +1051,15 @@ Even though the LAMMPS error message recommends to increase the "one"
|
||||
parameter, this may not always be the correct solution. The neighbor
|
||||
list overflow can also be a symptom for some other error that cannot be
|
||||
easily detected. For example, a frequent reason for an (unexpected)
|
||||
high density are incorrect box boundaries (since LAMMPS wraps atoms back
|
||||
high density are incorrect box dimensions (since LAMMPS wraps atoms back
|
||||
into the principal box with periodic boundaries) or coordinates provided
|
||||
as fractional coordinates. In both cases, LAMMPS cannot easily know
|
||||
whether the input geometry has such a high density (and thus requiring
|
||||
more neighbor list storage per atom) by intention. Rather than blindly
|
||||
increasing the "one" parameter, it is thus worth checking if this is
|
||||
justified by the combination of density and cutoff.
|
||||
as fractional coordinates (LAMMPS does not support this for data files).
|
||||
In both cases, LAMMPS cannot easily know whether the input geometry has
|
||||
such a high density (and thus requiring more neighbor list storage per
|
||||
atom) on purpose or by accident. Rather than blindly increasing the
|
||||
"one" parameter, it is thus worth checking if this is justified by the
|
||||
combination of density and cutoff. This is particularly recommended
|
||||
when using some tool(s) to convert input or data files.
|
||||
|
||||
When boosting (= increasing) the "one" parameter, it is recommended to
|
||||
also increase the value for the "page" parameter to maintain the ratio
|
||||
|
||||
@ -69,10 +69,11 @@ statement. Internally, it will call either
|
||||
:cpp:func:`lammps_open_fortran` or :cpp:func:`lammps_open_no_mpi` from
|
||||
the C library API to create the class instance. All arguments are
|
||||
optional and :cpp:func:`lammps_mpi_init` will be called automatically
|
||||
if it is needed. Similarly, a possible call to
|
||||
:cpp:func:`lammps_mpi_finalize` is integrated into the :f:func:`close`
|
||||
function and triggered with the optional logical argument set to
|
||||
``.TRUE.``. Here is a simple example:
|
||||
if it is needed. Similarly, optional calls to
|
||||
:cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_kokkos_finalize`,
|
||||
:cpp:func:`lammps_python_finalize`, and :cpp:func:`lammps_plugin_finalize`
|
||||
are integrated into the :f:func:`close` function and triggered with the
|
||||
optional logical argument set to ``.TRUE.``. Here is a simple example:
|
||||
|
||||
.. code-block:: fortran
|
||||
|
||||
@ -521,8 +522,8 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
This method will close down the LAMMPS instance through calling
|
||||
:cpp:func:`lammps_close`. If the *finalize* argument is present and
|
||||
has a value of ``.TRUE.``, then this subroutine also calls
|
||||
:cpp:func:`lammps_kokkos_finalize` and
|
||||
:cpp:func:`lammps_mpi_finalize`.
|
||||
:cpp:func:`lammps_kokkos_finalize`, :cpp:func:`lammps_mpi_finalize`,
|
||||
:cpp:func:`lammps_python_finalize`, and :cpp:func:`lammps_plugin_finalize`.
|
||||
|
||||
:o finalize: shut down the MPI environment of the LAMMPS
|
||||
library if ``.TRUE.``.
|
||||
@ -530,6 +531,8 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
:to: :cpp:func:`lammps_close`
|
||||
:to: :cpp:func:`lammps_mpi_finalize`
|
||||
:to: :cpp:func:`lammps_kokkos_finalize`
|
||||
:to: :cpp:func:`lammps_python_finalize`
|
||||
:to: :cpp:func:`lammps_plugin_finalize`
|
||||
|
||||
--------
|
||||
|
||||
@ -2096,7 +2099,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
|
||||
--------
|
||||
|
||||
.. f:subroutine:: create_atoms([id,] type, x, [v,] [image,] [bexpand])
|
||||
.. f:function:: create_atoms([id,] type, x, [v,] [image,] [bexpand])
|
||||
|
||||
This method calls :cpp:func:`lammps_create_atoms` to create additional atoms
|
||||
from a given list of coordinates and a list of atom types. Additionally,
|
||||
@ -2125,6 +2128,8 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
will be created, not dropped, and the box dimensions will be extended.
|
||||
Default is ``.FALSE.``
|
||||
:otype bexpand: logical,optional
|
||||
:r atoms: number of created atoms
|
||||
:rtype atoms: integer(c_int)
|
||||
:to: :cpp:func:`lammps_create_atoms`
|
||||
|
||||
.. note::
|
||||
@ -2149,6 +2154,18 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
|
||||
--------
|
||||
|
||||
.. f:subroutine:: create_molecule(id, jsonstr)
|
||||
|
||||
Add molecule template from string with JSON data
|
||||
|
||||
.. versionadded:: TBD
|
||||
|
||||
:p character(len=\*) id: desired molecule-ID
|
||||
:p character(len=\*) jsonstr: string with JSON data defining the molecule template
|
||||
:to: :cpp:func:`lammps_create_molecule`
|
||||
|
||||
--------
|
||||
|
||||
.. f:function:: find_pair_neighlist(style[, exact][, nsub][, reqid])
|
||||
|
||||
Find index of a neighbor list requested by a pair style.
|
||||
|
||||
@ -66,6 +66,7 @@ Force fields howto
|
||||
:name: force_howto
|
||||
:maxdepth: 1
|
||||
|
||||
Howto_FFgeneral
|
||||
Howto_bioFF
|
||||
Howto_amoeba
|
||||
Howto_tip3p
|
||||
@ -92,6 +93,7 @@ Packages howto
|
||||
Howto_manifold
|
||||
Howto_rheo
|
||||
Howto_spins
|
||||
Howto_apip
|
||||
|
||||
Tutorials howto
|
||||
===============
|
||||
|
||||
55
doc/src/Howto_FFgeneral.rst
Normal file
55
doc/src/Howto_FFgeneral.rst
Normal file
@ -0,0 +1,55 @@
|
||||
Some general force field considerations
|
||||
=======================================
|
||||
|
||||
A compact summary of the concepts, definitions, and properties of force
|
||||
fields with explicit bonded interactions (like the ones discussed in
|
||||
this HowTo) is given in :ref:`(Gissinger) <Typelabel2>`.
|
||||
|
||||
A force field has 2 parts: the formulas that define its potential
|
||||
functions and the coefficients used for a particular system. To assign
|
||||
parameters it is first required to assign atom types. Those are not
|
||||
only based on the elements, but also on the chemical environment due to
|
||||
the atoms bound to them. This often follows the chemical concept of
|
||||
*functional groups*. Example: a carbon atom bound with a single bond to
|
||||
a single OH-group (alcohol) would be a different atom type than a carbon
|
||||
atom bound to a methyl CH3 group (aliphatic carbon). The atom types
|
||||
usually then determine the non-bonded Lennard-Jones parameters and the
|
||||
parameters for bonds, angles, dihedrals, and impropers. On top of that,
|
||||
partial charges have to be applied. Those are usually independent of
|
||||
the atom types and are determined either for groups of atoms called
|
||||
residues with some fitting procedure based on quantum mechanical
|
||||
calculations, or based on some increment system that add or subtract
|
||||
increments from the partial charge of an atom based on the types of
|
||||
the neighboring atoms.
|
||||
|
||||
Force fields differ in the strategies they employ to determine the
|
||||
parameters and charge distribution in how generic or specific they are
|
||||
which in turn has an impact on the accuracy (compare for example
|
||||
CGenFF to CHARMM and GAFF to Amber). Because of the different
|
||||
strategies, it is not a good idea to use a mix of parameters from
|
||||
different force field *families* (like CHARMM, Amber, or GROMOS)
|
||||
and that extends to the parameters for the solvent, especially
|
||||
water. The publication describing the parameterization of a force
|
||||
field will describe which water model to use. Changing the water
|
||||
model usually leads to overall worse results (even if it may improve
|
||||
on the water itself).
|
||||
|
||||
In addition, one has to consider that *families* of force fields like
|
||||
CHARMM, Amber, OPLS, or GROMOS have evolved over time and thus provide
|
||||
different *revisions* of the force field parameters. These often
|
||||
corresponds to changes in the functional form or the parameterization
|
||||
strategies. This may also result in changes required for simulation
|
||||
settings like the preferred cutoff or how Coulomb interactions are
|
||||
computed (cutoff, smoothed/shifted cutoff, or long-range with Ewald
|
||||
summation or equivalent). Unless explicitly stated in the publication
|
||||
describing the force field, the Coulomb interaction cannot be chosen at
|
||||
will but must match the revision of the force field. That said,
|
||||
liberties may be taken during the initial equilibration of a system to
|
||||
speed up the process, but not for production simulations.
|
||||
|
||||
----------
|
||||
|
||||
.. _Typelabel2:
|
||||
|
||||
**(Gissinger)** J. R. Gissinger, I. Nikiforov, Y. Afshar, B. Waters, M. Choi, D. S. Karls, A. Stukowski, W. Im, H. Heinz, A. Kohlmeyer, and E. B. Tadmor, J Phys Chem B, 128, 3282-3297 (2024).
|
||||
|
||||
225
doc/src/Howto_apip.rst
Normal file
225
doc/src/Howto_apip.rst
Normal file
@ -0,0 +1,225 @@
|
||||
Adaptive-precision interatomic potentials (APIP)
|
||||
================================================
|
||||
|
||||
The :ref:`PKG-APIP <PKG-APIP>` enables use of adaptive-precision potentials
|
||||
as described in :ref:`(Immel) <Immel2025_1>`.
|
||||
In the context of this package, precision refers to the accuracy of an interatomic
|
||||
potential.
|
||||
|
||||
Modern machine-learning (ML) potentials translate the accuracy of DFT
|
||||
simulations into MD simulations, i.e., ML potentials are more accurate
|
||||
compared to traditional empirical potentials.
|
||||
However, this accuracy comes at a cost: there is a considerable performance
|
||||
gap between the evaluation of classical and ML potentials, e.g., the force
|
||||
calculation of a classical EAM potential is 100-1000 times faster compared
|
||||
to the ML-based ACE method.
|
||||
The evaluation time difference results in a conflict between large time and
|
||||
length scales on the one hand and accuracy on the other.
|
||||
This conflict is resolved by an APIP model for simulations, in which the highest precision
|
||||
is required only locally but not globally.
|
||||
|
||||
An APIP model uses a precise but
|
||||
expensive ML potential only for a subset of atoms, while a fast
|
||||
potential is used for the remaining atoms.
|
||||
Whether the precise or the fast potential is used is determined
|
||||
by a continuous switching parameter :math:`\lambda_i` that can be defined for each
|
||||
atom :math:`i`.
|
||||
The switching parameter can be adjusted dynamically during a simulation or
|
||||
kept constant as explained below.
|
||||
|
||||
The potential energy :math:`E_i` of an atom :math:`i` described by an
|
||||
adaptive-precision
|
||||
interatomic potential is given by :ref:`(Immel) <Immel2025_1>`
|
||||
|
||||
.. math::
|
||||
|
||||
E_i = \lambda_i E_i^\text{(fast)} + (1-\lambda_i) E_i^\text{(precise)},
|
||||
|
||||
whereas :math:`E_i^\text{(fast)}` is the potential energy of atom :math:`i`
|
||||
according to a fast interatomic potential,
|
||||
:math:`E_i^\text{(precise)}` is the potential energy according to a precise
|
||||
interatomic potential and :math:`\lambda_i\in[0,1]` is the
|
||||
switching parameter that decides how the potential energies are weighted.
|
||||
|
||||
Adaptive-precision saves computation time when the computation of the
|
||||
precise potential is not required for many atoms, i.e., when
|
||||
:math:`\lambda_i=1` applies for many atoms.
|
||||
|
||||
The currently implemented potentials are:
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Fast potential
|
||||
- Precise potential
|
||||
* - :doc:`ACE <pair_pace_apip>`
|
||||
- :doc:`ACE <pair_pace_apip>`
|
||||
* - :doc:`EAM <pair_eam_apip>`
|
||||
-
|
||||
|
||||
In theory, any short-range potential can be used for an adaptive-precision
|
||||
interatomic potential. How to implement a new (fast or precise)
|
||||
adaptive-precision
|
||||
potential is explained in :ref:`here <implementing_new_apip_styles>`.
|
||||
|
||||
The switching parameter :math:`\lambda_i` that combines the two potentials
|
||||
can be dynamically calculated during a
|
||||
simulation.
|
||||
Alternatively, one can set a constant switching parameter before the start
|
||||
of a simulation.
|
||||
To run a simulation with an adaptive-precision potential, one needs the
|
||||
following components:
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. tab:: dynamic switching parameter
|
||||
|
||||
#. :doc:`atom_style apip <atom_style>` so that the switching parameter :math:`\lambda_i` can be stored.
|
||||
#. A fast potential: :doc:`eam/apip <pair_eam_apip>` or :doc:`pace/fast/apip <pair_pace_apip>`.
|
||||
#. A precise potential: :doc:`pace/precise/apip <pair_pace_apip>`.
|
||||
#. :doc:`pair_style lambda/input/apip <pair_lambda_input_apip>` to calculate :math:`\lambda_i^\text{input}`, from which :math:`\lambda_i` is calculated.
|
||||
#. :doc:`fix lambda/apip <fix_lambda_apip>` to calculate the switching parameter :math:`\lambda_i`.
|
||||
#. :doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>` to calculate the spatial transition zone of the switching parameter.
|
||||
#. :doc:`pair_style hybrid/overlay <pair_hybrid>` to combine the previously mentioned pair_styles.
|
||||
#. :doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>` to conserve the energy when switching parameters change.
|
||||
#. :doc:`fix atom_weight/apip <fix_atom_weight_apip>` to approximate the load caused by every atom, as the computations of the pair_styles are only required for a subset of atoms.
|
||||
#. :doc:`fix balance <fix_balance>` to perform dynamic load balancing with the calculated load.
|
||||
|
||||
.. tab:: constant switching parameter
|
||||
|
||||
#. :doc:`atom_style apip <atom_style>` so that the switching parameter :math:`\lambda_i` can be stored.
|
||||
#. A fast potential: :doc:`eam/apip <pair_eam_apip>` or :doc:`pace/fast/apip <pair_pace_apip>`.
|
||||
#. A precise potential: :doc:`pace/precise/apip <pair_pace_apip>`.
|
||||
#. :doc:`set <set>` command to set the switching parameter :math:`\lambda_i`.
|
||||
#. :doc:`pair_style hybrid/overlay <pair_hybrid>` to combine the previously mentioned pair_styles.
|
||||
#. :doc:`fix atom_weight/apip <fix_atom_weight_apip>` to approximate the load caused by every atom, as the computations of the pair_styles are only required for a subset of atoms.
|
||||
#. :doc:`fix balance <fix_balance>` to perform dynamic load balancing with the calculated load.
|
||||
|
||||
----------
|
||||
|
||||
Example
|
||||
"""""""
|
||||
.. note::
|
||||
|
||||
How to select the values of the parameters of an adaptive-precision
|
||||
interatomic potential is discussed in detail in :ref:`(Immel) <Immel2025_1>`.
|
||||
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. tab:: dynamic switching parameter
|
||||
|
||||
Lines like these would appear in the input script:
|
||||
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
atom_style apip
|
||||
comm_style tiled
|
||||
|
||||
pair_style hybrid/overlay eam/fs/apip pace/precise/apip lambda/input/csp/apip fcc cutoff 5.0 lambda/zone/apip 12.0
|
||||
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
|
||||
pair_coeff * * pace/precise/apip Cu.yace Cu
|
||||
pair_coeff * * lambda/input/csp/apip
|
||||
pair_coeff * * lambda/zone/apip
|
||||
|
||||
fix 2 all lambda/apip 2.5 3.0 time_averaged_zone 4.0 12.0 110 110 min_delta_lambda 0.01
|
||||
fix 3 all lambda_thermostat/apip N_rescaling 200
|
||||
fix 4 all atom_weight/apip 100 eam ace lambda/input lambda/zone all
|
||||
|
||||
variable myweight atom f_4
|
||||
|
||||
fix 5 all balance 100 1.1 rcb weight var myweight
|
||||
|
||||
First, the :doc:`atom_style apip <atom_style>` and the communication style are set.
|
||||
|
||||
.. note::
|
||||
Note, that :doc:`comm_style <comm_style>` *tiled* is required for the style *rcb* of
|
||||
:doc:`fix balance <fix_balance>`, but not for APIP.
|
||||
However, the flexibility offered by the balancing style *rcb*, compared to the
|
||||
balancing style *shift*, is advantageous for APIP.
|
||||
|
||||
An adaptive-precision EAM-ACE potential, for which the switching parameter
|
||||
:math:`\lambda` is calculated from the CSP, is defined via
|
||||
:doc:`pair_style hybrid/overlay <pair_hybrid>`.
|
||||
The fixes ensure that the switching parameter is calculated, the energy conserved,
|
||||
the weight for the load balancing calculated and the load-balancing itself is done.
|
||||
|
||||
.. tab:: constant switching parameter
|
||||
|
||||
Lines like these would appear in the input script:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
atom_style apip
|
||||
comm_style tiled
|
||||
|
||||
pair_style hybrid/overlay eam/fs/apip pace/precise/apip
|
||||
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
|
||||
pair_coeff * * pace/precise/apip Cu.yace Cu
|
||||
|
||||
# calculate lambda somehow
|
||||
variable lambda atom ...
|
||||
set group all apip/lambda v_lambda
|
||||
|
||||
fix 4 all atom_weight/apip 100 eam ace lambda/input lambda/zone all
|
||||
|
||||
variable myweight atom f_4
|
||||
|
||||
fix 5 all balance 100 1.1 rcb weight var myweight
|
||||
|
||||
First, the :doc:`atom_style apip <atom_style>` and the communication style are set.
|
||||
|
||||
.. note::
|
||||
Note, that :doc:`comm_style <comm_style>` *tiled* is required for the style *rcb* of
|
||||
:doc:`fix balance <fix_balance>`, but not for APIP.
|
||||
However, the flexibility offered by the balancing style *rcb*, compared to the
|
||||
balancing style *shift*, is advantageous for APIP.
|
||||
|
||||
An adaptive-precision EAM-ACE potential is defined via
|
||||
:doc:`pair_style hybrid/overlay <pair_hybrid>`.
|
||||
The switching parameter :math:`\lambda_i` of the adaptive-precision
|
||||
EAM-ACE potential is set via the :doc:`set command <set>`.
|
||||
The parameter is not updated during the simulation.
|
||||
Therefore, the potential is conservative.
|
||||
The fixes ensure that the weight for the load balancing is calculated
|
||||
and the load-balancing itself is done.
|
||||
|
||||
----------
|
||||
|
||||
.. _implementing_new_apip_styles:
|
||||
|
||||
Implementing new APIP pair styles
|
||||
"""""""""""""""""""""""""""""""""
|
||||
|
||||
One can introduce adaptive-precision to an existing pair style by modifying
|
||||
the original pair style.
|
||||
One should calculate the force
|
||||
:math:`F_i = - \nabla_i \sum_j E_j^\text{original}` for a fast potential or
|
||||
:math:`F_i = - (1-\nabla_i) \sum_j E_j^\text{original}` for a precise
|
||||
potential from the original potential
|
||||
energy :math:`E_j^\text{original}` to see where the switching parameter
|
||||
:math:`\lambda_i` needs to be introduced in the force calculation.
|
||||
The switching parameter :math:`\lambda_i` is known for all atoms :math:`i`
|
||||
in force calculation routine.
|
||||
One needs to introduce an abortion criterion based on :math:`\lambda_i` to
|
||||
ensure that all not required calculations are skipped and compute time can
|
||||
be saved.
|
||||
Furthermore, one needs to provide the number of calculations and measure the
|
||||
computation time.
|
||||
Communication within the force calculation needs to be prevented to allow
|
||||
effective load-balancing.
|
||||
With communication, the load balancer cannot balance few calculations of the
|
||||
precise potential on one processor with many computations of the fast
|
||||
potential on another processor.
|
||||
|
||||
All changes in the pair_style pace/apip compared to the pair_style pace
|
||||
are annotated and commented.
|
||||
Thus, the pair_style pace/apip can serve as an example for the implementation
|
||||
of new adaptive-precision potentials.
|
||||
|
||||
----------
|
||||
|
||||
.. _Immel2025_1:
|
||||
|
||||
**(Immel)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)
|
||||
@ -1,22 +1,16 @@
|
||||
CHARMM, AMBER, COMPASS, DREIDING, and OPLS force fields
|
||||
=======================================================
|
||||
|
||||
A compact summary of the concepts, definitions, and properties of
|
||||
force fields with explicit bonded interactions (like the ones discussed
|
||||
in this HowTo) is given in :ref:`(Gissinger) <Typelabel2>`.
|
||||
|
||||
A force field has 2 parts: the formulas that define it and the
|
||||
coefficients used for a particular system. Here we only discuss
|
||||
formulas implemented in LAMMPS that correspond to formulas commonly used
|
||||
in the CHARMM, AMBER, COMPASS, and DREIDING force fields. Setting
|
||||
coefficients is done either from special sections in an input data file
|
||||
via the :doc:`read_data <read_data>` command or in the input script with
|
||||
commands like :doc:`pair_coeff <pair_coeff>` or :doc:`bond_coeff
|
||||
<bond_coeff>` and so on. See the :doc:`Tools <Tools>` doc page for
|
||||
additional tools that can use CHARMM, AMBER, or Materials Studio
|
||||
generated files to assign force field coefficients and convert their
|
||||
output into LAMMPS input. LAMMPS input scripts can also be generated by
|
||||
`charmm-gui.org <https://charmm-gui.org/>`_.
|
||||
Here we only discuss formulas implemented in LAMMPS that correspond to
|
||||
formulas commonly used in the CHARMM, AMBER, COMPASS, and DREIDING force
|
||||
fields. Setting coefficients is done either from special sections in an
|
||||
input data file via the :doc:`read_data <read_data>` command or in the
|
||||
input script with commands like :doc:`pair_coeff <pair_coeff>` or
|
||||
:doc:`bond_coeff <bond_coeff>` and so on. See the :doc:`Tools <Tools>`
|
||||
doc page for additional tools that can use CHARMM, AMBER, or Materials
|
||||
Studio generated files to assign force field coefficients and convert
|
||||
their output into LAMMPS input. LAMMPS input scripts can also be
|
||||
generated by `charmm-gui.org <https://charmm-gui.org/>`_.
|
||||
|
||||
CHARMM and AMBER
|
||||
----------------
|
||||
@ -203,9 +197,11 @@ rather than individual force constants and geometric parameters that
|
||||
depend on the particular combinations of atoms involved in the bond,
|
||||
angle, or torsion terms. DREIDING has an :doc:`explicit hydrogen bond
|
||||
term <pair_hbond_dreiding>` to describe interactions involving a
|
||||
hydrogen atom on very electronegative atoms (N, O, F). Unlike CHARMM
|
||||
or AMBER, the DREIDING force field has not been parameterized for
|
||||
considering solvents (like water).
|
||||
hydrogen atom on very electronegative atoms (N, O, F). Unlike CHARMM or
|
||||
AMBER, the DREIDING force field has not been parameterized for
|
||||
considering solvents (like water) and has no rules for assigning
|
||||
(partial) charges. That will seriously limit its accuracy when used for
|
||||
simulating systems where those matter.
|
||||
|
||||
See :ref:`(Mayo) <howto-Mayo>` for a description of the DREIDING force field
|
||||
|
||||
@ -272,10 +268,6 @@ compatible with a subset of OPLS interactions.
|
||||
|
||||
----------
|
||||
|
||||
.. _Typelabel2:
|
||||
|
||||
**(Gissinger)** J. R. Gissinger, I. Nikiforov, Y. Afshar, B. Waters, M. Choi, D. S. Karls, A. Stukowski, W. Im, H. Heinz, A. Kohlmeyer, and E. B. Tadmor, J Phys Chem B, 128, 3282-3297 (2024).
|
||||
|
||||
.. _howto-MacKerell:
|
||||
|
||||
**(MacKerell)** MacKerell, Bashford, Bellott, Dunbrack, Evanseck, Field, Fischer, Gao, Guo, Ha, et al (1998). J Phys Chem, 102, 3586 . https://doi.org/10.1021/jp973084f
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
SPC water model
|
||||
===============
|
||||
SPC and SPC/E water model
|
||||
=========================
|
||||
|
||||
The SPC water model specifies a 3-site rigid water molecule with
|
||||
charges and Lennard-Jones parameters assigned to each of the three atoms.
|
||||
@ -8,6 +8,18 @@ the two O-H bonds and the H-O-H angle rigid. A bond style of
|
||||
*harmonic* and an angle style of *harmonic* or *charmm* should also be
|
||||
used.
|
||||
|
||||
One suitable pair style with cutoff Coulomb would for instance be:
|
||||
|
||||
* :doc:`pair_style lj/cut/coul/cut <pair_lj_cut_coul>`
|
||||
|
||||
These commands are examples for a long-range Coulomb model:
|
||||
|
||||
* :doc:`pair_style lj/cut/coul/long <pair_lj_cut_coul>`
|
||||
* :doc:`pair_style lj/cut/coul/long/soft <pair_fep_soft>`
|
||||
* :doc:`kspace_style pppm <kspace_style>`
|
||||
* :doc:`pair_style lj/long/coul/long <pair_lj_long>`
|
||||
* :doc:`kspace_style pppm/disp <kspace_style>`
|
||||
|
||||
These are the additional parameters (in real units) to set for O and H
|
||||
atoms and the water molecule to run a rigid SPC model.
|
||||
|
||||
@ -39,7 +51,9 @@ the SPC and SPC/E models.
|
||||
Below is the code for a LAMMPS input file and a molecule file
|
||||
(``spce.mol``) of SPC/E water for use with the :doc:`molecule command
|
||||
<molecule>` demonstrating how to set up a small bulk water system for
|
||||
SPC/E with rigid bonds.
|
||||
SPC/E with rigid bonds. For simplicity and speed the example uses a
|
||||
cutoff Coulomb. Most production simulations require long-range Coulomb
|
||||
instead.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
||||
@ -5,17 +5,24 @@ The TIP3P water model as implemented in CHARMM :ref:`(MacKerell)
|
||||
<howto-tip3p>` specifies a 3-site rigid water molecule with charges and
|
||||
Lennard-Jones parameters assigned to each of the three atoms.
|
||||
|
||||
A suitable pair style with cutoff Coulomb would be:
|
||||
One suitable pair style with cutoff Coulomb would for instance be:
|
||||
|
||||
* :doc:`pair_style lj/cut/coul/cut <pair_lj_cut_coul>`
|
||||
|
||||
or these commands for a long-range Coulomb model:
|
||||
These commands are examples for a long-range Coulomb model:
|
||||
|
||||
* :doc:`pair_style lj/cut/coul/long <pair_lj_cut_coul>`
|
||||
* :doc:`pair_style lj/cut/coul/long/soft <pair_fep_soft>`
|
||||
* :doc:`kspace_style pppm <kspace_style>`
|
||||
* :doc:`pair_style lj/long/coul/long <pair_lj_long>`
|
||||
* :doc:`kspace_style pppm/disp <kspace_style>`
|
||||
|
||||
And these pair styles are compatible with the CHARMM force field:
|
||||
|
||||
* :doc:`pair_style lj/charmm/coul/charmm <pair_charmm>`
|
||||
* :doc:`pair_style lj/charmm/coul/long <pair_charmm>`
|
||||
* :doc:`pair_style lj/charmmfsw/coul/long <pair_charmm>`
|
||||
|
||||
In LAMMPS the :doc:`fix shake or fix rattle <fix_shake>` command can be
|
||||
used to hold the two O-H bonds and the H-O-H angle rigid. A bond style
|
||||
of :doc:`harmonic <bond_harmonic>` and an angle style of :doc:`harmonic
|
||||
@ -100,7 +107,9 @@ ignored.
|
||||
Below is the code for a LAMMPS input file and a molecule file
|
||||
(``tip3p.mol``) of TIP3P water for use with the :doc:`molecule command
|
||||
<molecule>` demonstrating how to set up a small bulk water system for
|
||||
TIP3P with rigid bonds.
|
||||
TIP3P with rigid bonds. For simplicity and speed the example uses a
|
||||
cutoff Coulomb. Most production simulations require long-range Coulomb
|
||||
instead.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
TIP4P water model
|
||||
=================
|
||||
TIP4P and OPC water models
|
||||
==========================
|
||||
|
||||
The four-point TIP4P rigid water model extends the traditional
|
||||
:doc:`three-point TIP3P <Howto_tip3p>` model by adding an additional
|
||||
@ -9,9 +9,11 @@ the oxygen along the bisector of the HOH bond angle. A bond style of
|
||||
:doc:`harmonic <bond_harmonic>` and an angle style of :doc:`harmonic
|
||||
<angle_harmonic>` or :doc:`charmm <angle_charmm>` should also be used.
|
||||
In case of rigid bonds also bond style :doc:`zero <bond_zero>` and angle
|
||||
style :doc:`zero <angle_zero>` can be used.
|
||||
style :doc:`zero <angle_zero>` can be used. Very similar to the TIP4P
|
||||
model is the OPC water model. It can be realized the same way as TIP4P
|
||||
but has different geometry and force field parameters.
|
||||
|
||||
There are two ways to implement TIP4P water in LAMMPS:
|
||||
There are two ways to implement TIP4P-like water in LAMMPS:
|
||||
|
||||
#. Use a specially written pair style that uses the :ref:`TIP3P geometry
|
||||
<tip3p_molecule>` without the point M. The point M location is then
|
||||
@ -21,7 +23,10 @@ There are two ways to implement TIP4P water in LAMMPS:
|
||||
computationally very efficient, but the charge distribution in space
|
||||
is only correct within the tip4p labeled styles. So all other
|
||||
computations using charges will "see" the negative charge incorrectly
|
||||
on the oxygen atom.
|
||||
located on the oxygen atom unless they are specially written for using
|
||||
the TIP4P geometry internally as well, e.g. :doc:`compute dipole/tip4p
|
||||
<compute_dipole>`, :doc:`fix efield/tip4p <fix_efield>`, or
|
||||
:doc:`kspace_style pppm/tip4p <kspace_style>`.
|
||||
|
||||
This can be done with the following pair styles for Coulomb with a cutoff:
|
||||
|
||||
@ -68,77 +73,90 @@ TIP4P/2005 model :ref:`(Abascal2) <Abascal2>` and a version of TIP4P
|
||||
parameters adjusted for use with a long-range Coulombic solver
|
||||
(e.g. Ewald or PPPM in LAMMPS). Note that for implicit TIP4P models the
|
||||
OM distance is specified in the :doc:`pair_style <pair_style>` command,
|
||||
not as part of the pair coefficients.
|
||||
not as part of the pair coefficients. Also parameters for the OPC
|
||||
model (:ref:`Izadi <Izadi>`) are provided.
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 36 19 13 15 17
|
||||
:widths: 40 12 12 14 11 11
|
||||
|
||||
* - Parameter
|
||||
- TIP4P (original)
|
||||
- TIP4P/Ice
|
||||
- TIP4P/2005
|
||||
- TIP4P (Ewald)
|
||||
- OPC
|
||||
* - O mass (amu)
|
||||
- 15.9994
|
||||
- 15.9994
|
||||
- 15.9994
|
||||
- 15.9994
|
||||
- 15.9994
|
||||
* - H mass (amu)
|
||||
- 1.008
|
||||
- 1.008
|
||||
- 1.008
|
||||
- 1.008
|
||||
- 1.008
|
||||
* - O or M charge (:math:`e`)
|
||||
- -1.040
|
||||
- -1.1794
|
||||
- -1.1128
|
||||
- -1.04844
|
||||
- -1.3582
|
||||
* - H charge (:math:`e`)
|
||||
- 0.520
|
||||
- 0.5897
|
||||
- 0.5564
|
||||
- 0.52422
|
||||
- 0.6791
|
||||
* - LJ :math:`\epsilon` of OO (kcal/mole)
|
||||
- 0.1550
|
||||
- 0.21084
|
||||
- 0.1852
|
||||
- 0.16275
|
||||
- 0.21280
|
||||
* - LJ :math:`\sigma` of OO (:math:`\AA`)
|
||||
- 3.1536
|
||||
- 3.1668
|
||||
- 3.1589
|
||||
- 3.16435
|
||||
- 3.1660
|
||||
* - LJ :math:`\epsilon` of HH, MM, OH, OM, HM (kcal/mole)
|
||||
- 0.0
|
||||
- 0.0
|
||||
- 0.0
|
||||
- 0.0
|
||||
- 0.0
|
||||
* - LJ :math:`\sigma` of HH, MM, OH, OM, HM (:math:`\AA`)
|
||||
- 1.0
|
||||
- 1.0
|
||||
- 1.0
|
||||
- 1.0
|
||||
- 1.0
|
||||
* - :math:`r_0` of OH bond (:math:`\AA`)
|
||||
- 0.9572
|
||||
- 0.9572
|
||||
- 0.9572
|
||||
- 0.9572
|
||||
- 0.8724
|
||||
* - :math:`\theta_0` of HOH angle
|
||||
- 104.52\ :math:`^{\circ}`
|
||||
- 104.52\ :math:`^{\circ}`
|
||||
- 104.52\ :math:`^{\circ}`
|
||||
- 104.52\ :math:`^{\circ}`
|
||||
- 103.60\ :math:`^{\circ}`
|
||||
* - OM distance (:math:`\AA`)
|
||||
- 0.15
|
||||
- 0.1577
|
||||
- 0.1546
|
||||
- 0.1250
|
||||
- 0.1594
|
||||
|
||||
Note that the when using the TIP4P pair style, the neighbor list cutoff
|
||||
Note that the when using a TIP4P pair style, the neighbor list cutoff
|
||||
for Coulomb interactions is effectively extended by a distance 2 \* (OM
|
||||
distance), to account for the offset distance of the fictitious charges
|
||||
on O atoms in water molecules. Thus it is typically best in an
|
||||
on O atoms in water molecules. Thus, it is typically best in an
|
||||
efficiency sense to use a LJ cutoff >= Coulomb cutoff + 2\*(OM
|
||||
distance), to shrink the size of the neighbor list. This leads to
|
||||
slightly larger cost for the long-range calculation, so you can test the
|
||||
@ -149,7 +167,9 @@ cutoffs are set in the :doc:`pair_style lj/cut/tip4p/long
|
||||
Below is the code for a LAMMPS input file using the implicit method and
|
||||
the :ref:`TIP3P molecule file <tip3p_molecule>`. Because the TIP4P
|
||||
charges are different from TIP3P they need to be reset (or the molecule
|
||||
file changed):
|
||||
file changed). For simplicity and speed the example uses a cutoff
|
||||
Coulomb. Most production simulations require long-range Coulomb
|
||||
instead.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -192,6 +212,94 @@ file changed):
|
||||
run 20000
|
||||
write_data tip4p-implicit.data nocoeff
|
||||
|
||||
When constructing an OPC model, we cannot use the ``tip3p.mol`` file due
|
||||
to the different geometry. Below is a molecule file providing the 3
|
||||
sites of an implicit OPC geometry for use with TIP4P styles. Note, that
|
||||
the "Shake" and "Special" sections are missing here. Those will be
|
||||
auto-generated by LAMMPS when the molecule file is loaded *after* the
|
||||
simulation box has been created. These sections are required only when
|
||||
the molecule file is loaded *before*.
|
||||
|
||||
.. _opc3p_molecule:
|
||||
.. code-block::
|
||||
|
||||
# Water molecule. 3 point geometry for OPC model
|
||||
|
||||
3 atoms
|
||||
2 bonds
|
||||
1 angles
|
||||
|
||||
Coords
|
||||
|
||||
1 0.00000 -0.06037 0.00000
|
||||
2 0.68558 0.50250 0.00000
|
||||
3 -0.68558 0.50250 0.00000
|
||||
|
||||
Types
|
||||
|
||||
1 1 # O
|
||||
2 2 # H
|
||||
3 2 # H
|
||||
|
||||
Charges
|
||||
|
||||
1 -1.3582
|
||||
2 0.6791
|
||||
3 0.6791
|
||||
|
||||
Bonds
|
||||
|
||||
1 1 1 2
|
||||
2 1 1 3
|
||||
|
||||
Angles
|
||||
|
||||
1 1 2 1 3
|
||||
|
||||
Below is a LAMMPS input file using the implicit method to implement
|
||||
the OPC model using the molecule file from above and including the
|
||||
PPPM long-range Coulomb solver.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
units real
|
||||
atom_style full
|
||||
region box block -5 5 -5 5 -5 5
|
||||
create_box 2 box bond/types 1 angle/types 1 &
|
||||
extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2
|
||||
|
||||
mass 1 15.9994
|
||||
mass 2 1.008
|
||||
|
||||
pair_style lj/cut/tip4p/long 1 2 1 1 0.1594 12.0
|
||||
pair_coeff 1 1 0.2128 3.166
|
||||
pair_coeff 2 2 0.0 1.0
|
||||
|
||||
bond_style zero
|
||||
bond_coeff 1 0.8724
|
||||
|
||||
angle_style zero
|
||||
angle_coeff 1 103.6
|
||||
|
||||
kspace_style pppm/tip4p 1.0e-5
|
||||
|
||||
molecule water opc3p.mol # this file has the OPC geometry but is without M
|
||||
create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33
|
||||
|
||||
fix rigid all shake 0.001 10 10000 b 1 a 1
|
||||
minimize 0.0 0.0 1000 10000
|
||||
|
||||
reset_timestep 0
|
||||
timestep 1.0
|
||||
velocity all create 300.0 5463576
|
||||
fix integrate all nvt temp 300 300 100.0
|
||||
|
||||
thermo_style custom step temp press etotal pe
|
||||
|
||||
thermo 1000
|
||||
run 20000
|
||||
write_data opc-implicit.data nocoeff
|
||||
|
||||
Below is the code for a LAMMPS input file using the explicit method and
|
||||
a TIP4P molecule file. Because of using :doc:`fix rigid/small
|
||||
<fix_rigid>` no bonds need to be defined and thus no extra storage needs
|
||||
@ -279,3 +387,8 @@ Phys, 79, 926 (1983).
|
||||
|
||||
**(Abascal2)** Abascal, J Chem Phys, 123, 234505 (2005)
|
||||
https://doi.org/10.1063/1.2121687
|
||||
|
||||
.. _Izadi:
|
||||
|
||||
**(Izadi)** Izadi, Anandakrishnan, Onufriev, J. Phys. Chem. Lett., 5, 21, 3863 (2014)
|
||||
https://doi.org/10.1021/jz501780a
|
||||
|
||||
@ -87,7 +87,9 @@ atom style full or use :doc:`fix property/atom mol <fix_property_atom>`
|
||||
so that fix rigid/small can identify rigid bodies by their molecule ID.
|
||||
Also a :doc:`neigh_modify exclude <neigh_modify>` command is added to
|
||||
exclude computing intramolecular non-bonded interactions, since those
|
||||
are removed by the rigid fix anyway:
|
||||
are removed by the rigid fix anyway. For simplicity and speed the
|
||||
example uses a cutoff Coulomb. Most production simulations require
|
||||
long-range Coulomb instead.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
|
||||
@ -21,8 +21,8 @@ You can follow the LAMMPS development on 4 different git branches:
|
||||
|
||||
* **develop** : this branch follows the ongoing development and is
|
||||
updated with every merge commit of a pull request
|
||||
* **release** : this branch is updated with every "feature release";
|
||||
updates are always "fast-forward" merges from *develop*
|
||||
* **release** : this branch is updated with every "feature release"
|
||||
and updates are always "fast-forward" merges from *develop*
|
||||
* **maintenance** : this branch collects back-ported bug fixes from the
|
||||
*develop* branch to the *stable* branch. It is used to update the
|
||||
*stable* branch for "stable update releases".
|
||||
|
||||
@ -84,8 +84,9 @@ lammps.org". General questions about LAMMPS should be posted in the
|
||||
|
||||
\normalsize
|
||||
|
||||
Past developers include Paul Crozier and Mark Stevens, both at SNL,
|
||||
and Ray Shan, now at Materials Design.
|
||||
Past core developers include Paul Crozier and Mark Stevens, both at SNL,
|
||||
and Ray Shan while at SNL and later at Materials Design, now at Thermo
|
||||
Fisher Scientific.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -28,8 +28,9 @@ Build systems
|
||||
LAMMPS can be compiled from source code using a (traditional) build
|
||||
system based on shell scripts, a few shell utilities (grep, sed, cat,
|
||||
tr) and the GNU make program. This requires running within a Bourne
|
||||
shell (``/bin/sh``). Alternatively, a build system with different back
|
||||
ends can be created using CMake. CMake must be at least version 3.16.
|
||||
shell (``/bin/sh`` or ``/bin/bash``). Alternatively, a build system
|
||||
with different back ends can be created using CMake. CMake must be
|
||||
at least version 3.16.
|
||||
|
||||
Operating systems
|
||||
^^^^^^^^^^^^^^^^^
|
||||
@ -40,11 +41,18 @@ Also, compilation and correct execution on macOS and Windows (using
|
||||
Microsoft Visual C++) is checked automatically for the largest part of
|
||||
the source code. Some (optional) features are not compatible with all
|
||||
operating systems, either through limitations of the corresponding
|
||||
LAMMPS source code or through incompatibilities of source code or
|
||||
build system of required external libraries or packages.
|
||||
LAMMPS source code or through incompatibilities or build system
|
||||
limitations of required external libraries or packages.
|
||||
|
||||
Executables for Windows may be created natively using either Cygwin or
|
||||
Visual Studio or with a Linux to Windows MinGW cross-compiler.
|
||||
Executables for Windows may be created either natively using Cygwin,
|
||||
MinGW, Intel, Clang, or Microsoft Visual C++ compilers, or with a Linux
|
||||
to Windows MinGW cross-compiler. Native compilation is supported using
|
||||
Microsoft Visual Studio or a terminal window (using the CMake build
|
||||
system).
|
||||
|
||||
Executables for macOS may be created either using Xcode or GNU compilers
|
||||
installed with Homebrew. In the latter case, building of LAMMPS through
|
||||
Homebrew instead of a manual compile is also possible.
|
||||
|
||||
Additionally, FreeBSD and Solaris have been tested successfully to
|
||||
run LAMMPS and produce results consistent with those on Linux.
|
||||
@ -61,8 +69,9 @@ CPU architectures
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
The primary CPU architecture for running LAMMPS is 64-bit x86, but also
|
||||
32-bit x86, and 64-bit ARM and PowerPC (64-bit, Little Endian) are
|
||||
regularly tested.
|
||||
64-bit ARM and PowerPC (64-bit, Little Endian) are currently regularly
|
||||
tested. Further architectures are tested by Linux distributions that
|
||||
bundle LAMMPS.
|
||||
|
||||
Portability compliance
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
BIN
doc/src/JPG/lammps-gui-screen.png
Normal file
BIN
doc/src/JPG/lammps-gui-screen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
@ -11,6 +11,7 @@ This section documents the following functions:
|
||||
- :cpp:func:`lammps_mpi_finalize`
|
||||
- :cpp:func:`lammps_kokkos_finalize`
|
||||
- :cpp:func:`lammps_python_finalize`
|
||||
- :cpp:func:`lammps_plugin_finalize`
|
||||
- :cpp:func:`lammps_error`
|
||||
|
||||
--------------------
|
||||
@ -119,5 +120,10 @@ calling program.
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_plugin_finalize
|
||||
:project: progguide
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_error
|
||||
:project: progguide
|
||||
|
||||
@ -27,6 +27,7 @@ It documents the following functions:
|
||||
- :cpp:func:`lammps_scatter`
|
||||
- :cpp:func:`lammps_scatter_subset`
|
||||
- :cpp:func:`lammps_create_atoms`
|
||||
- :cpp:func:`lammps_create_molecule`
|
||||
|
||||
-----------------------
|
||||
|
||||
@ -103,4 +104,8 @@ It documents the following functions:
|
||||
.. 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
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_create_molecule
|
||||
:project: progguide
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ gives those details.
|
||||
|
||||
* :ref:`ADIOS <PKG-ADIOS>`
|
||||
* :ref:`AMOEBA <PKG-AMOEBA>`
|
||||
* :ref:`APIP <PKG-APIP>`
|
||||
* :ref:`ASPHERE <PKG-ASPHERE>`
|
||||
* :ref:`ATC <PKG-ATC>`
|
||||
* :ref:`AWPMD <PKG-AWPMD>`
|
||||
@ -186,6 +187,60 @@ provided by the Ponder group in their
|
||||
|
||||
----------
|
||||
|
||||
.. _PKG-APIP:
|
||||
|
||||
APIP package
|
||||
------------
|
||||
|
||||
**Contents:**
|
||||
|
||||
This package provides adaptive-precision interatomic potentials (APIP) as
|
||||
described in:
|
||||
|
||||
D. Immel, R. Drautz and G. Sutmann, "Adaptive-precision potentials for
|
||||
large-scale atomistic simulations", J. Chem. Phys. 162, 114119 (2025)
|
||||
`link <immel2025_doi_>`_
|
||||
|
||||
Adaptive-precision means, that a fast interatomic potential, such as EAM,
|
||||
is coupled to a precise interatomic potential, such as ACE.
|
||||
This package provides the required pair_styles and fixes to run an efficient,
|
||||
energy-conserving adaptive-precision simulation.
|
||||
|
||||
In the context of this package, precision refers to the accuracy of an interatomic
|
||||
potential.
|
||||
|
||||
.. _immel2025_doi: https://doi.org/10.1063/5.0245877
|
||||
|
||||
**Authors:**
|
||||
|
||||
This package was written by David Immel^1,
|
||||
Ralf Drautz^2 and Godehard Sutmann^1^2.
|
||||
|
||||
^1: Forschungszentrum Juelich, Juelich, Germany
|
||||
|
||||
^2: Ruhr-University Bochum, Bochum, Germany
|
||||
|
||||
**Install:**
|
||||
|
||||
The APIP package requires also the installation of ML-PACE, which has
|
||||
:ref:`specific installation instructions <ml-pace>` on the
|
||||
:doc:`Build extras <Build_extras>` page.
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
* ``src/APIP``: filenames -> commands
|
||||
* :doc:`Howto APIP <Howto_apip>`
|
||||
* ``examples/PACKAGES/apip``
|
||||
* :doc:`fix atom_weight/apip <fix_atom_weight_apip>`
|
||||
* :doc:`fix lambda/apip <fix_lambda_apip>`
|
||||
* :doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>`
|
||||
* :doc:`pair_style eam/apip <pair_eam_apip>`
|
||||
* :doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`
|
||||
* :doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`
|
||||
* :doc:`pair_style pace/apip <pair_pace_apip>`
|
||||
|
||||
----------
|
||||
|
||||
.. _PKG-ASPHERE:
|
||||
|
||||
ASPHERE package
|
||||
|
||||
@ -38,6 +38,11 @@ whether an extra library is needed to build and use the package:
|
||||
- :doc:`AMOEBA and HIPPO howto <Howto_amoeba>`
|
||||
- amoeba
|
||||
- no
|
||||
* - :ref:`APIP <PKG-APIP>`
|
||||
- adaptive-precision interatomic potentials
|
||||
- :doc:`Howto APIP <Howto_apip>`
|
||||
- ``PACKAGES/apip``
|
||||
- ext
|
||||
* - :ref:`ASPHERE <PKG-ASPHERE>`
|
||||
- aspherical particle models
|
||||
- :doc:`Howto spherical <Howto_spherical>`
|
||||
|
||||
@ -5,18 +5,28 @@ LAMMPS has several commands which can be used to invoke Python
|
||||
code directly from an input script:
|
||||
|
||||
* :doc:`python <python>`
|
||||
* :doc:`variable python <variable>`
|
||||
* :doc:`python-style variables <variable>`
|
||||
* :doc:`equal-style and atom-style variables with formulas containing Python function wrappers <variable>`
|
||||
* :doc:`fix python/invoke <fix_python_invoke>`
|
||||
* :doc:`pair_style python <pair_python>`
|
||||
|
||||
The :doc:`python <python>` command which can be used to define and
|
||||
execute a Python function that you write the code for. The Python
|
||||
function can also be assigned to a LAMMPS python-style variable via
|
||||
the :doc:`variable <variable>` command. Each time the variable is
|
||||
The :doc:`python <python>` command can be used to define and execute a
|
||||
Python function that you write the code for. The Python function can
|
||||
also be assigned to a LAMMPS python-style variable via the
|
||||
:doc:`variable <variable>` command. Each time the variable is
|
||||
evaluated, either in the LAMMPS input script itself, or by another
|
||||
LAMMPS command that uses the variable, this will trigger the Python
|
||||
function to be invoked.
|
||||
|
||||
The Python function can also be referenced in the formula used to
|
||||
define an :doc:`equal-style or atom-style variable <variable>`, using
|
||||
the syntax for a :doc:`Python function wrapper <variable>`. This make
|
||||
it easy to pass LAMMPS-related arguments to the Python function, as
|
||||
well as to invoke it whenever the equal- or atom-style variable is
|
||||
evaluated. For an atom-style variable it means the Python function
|
||||
can be invoked once per atom, using per-atom properties as arguments
|
||||
to the function.
|
||||
|
||||
The Python code for the function can be included directly in the input
|
||||
script or in an auxiliary file. The function can have arguments which
|
||||
are mapped to LAMMPS variables (also defined in the input script) and
|
||||
|
||||
@ -75,15 +75,34 @@ section below for examples where this has been done.
|
||||
**Differences between the GPU and KOKKOS packages:**
|
||||
|
||||
* The GPU package accelerates only pair force, neighbor list, and (parts
|
||||
of) PPPM calculations. The KOKKOS package attempts to run most of the
|
||||
of) PPPM calculations (and runs the remaining force computations on
|
||||
the CPU concurrently). The KOKKOS package attempts to run most of the
|
||||
calculation on the GPU, but can transparently support non-accelerated
|
||||
code (with a performance penalty due to having data transfers between
|
||||
host and GPU).
|
||||
* The list of which styles are accelerated by the GPU or KOKKOS package
|
||||
differs with some overlap.
|
||||
* The GPU package requires neighbor lists to be built on the CPU when using
|
||||
hybrid pair styles, exclusion lists, or a triclinic simulation box.
|
||||
* The GPU package can be compiled for CUDA, HIP, or OpenCL and thus supports
|
||||
NVIDIA, AMD, and Intel GPUs well. On NVIDIA hardware, using CUDA is
|
||||
typically resulting in equal or better performance over OpenCL.
|
||||
* OpenCL in the GPU package does theoretically also support Intel CPUs or
|
||||
Intel Xeon Phi, but the native support for those in KOKKOS (or INTEL)
|
||||
is superior.
|
||||
* The GPU package benefits from running multiple MPI processes (2-8) per
|
||||
GPU to parallelize the non-GPU accelerated styles. The KOKKOS package
|
||||
usually not, especially when all parts of the calculation have KOKKOS
|
||||
support.
|
||||
* The GPU package can be compiled for CUDA, HIP, or OpenCL and thus
|
||||
supports NVIDIA, AMD, and Intel GPUs well. On NVIDIA or AMD hardware,
|
||||
using native CUDA or HIP compilation, respectively, with either GPU or
|
||||
KOKKOS results in equal or better performance over OpenCL.
|
||||
* OpenCL in the GPU package supports NVIDIA, AMD, and Intel GPUs at the
|
||||
*same time* and with the *same executable*. KOKKOS currently does not
|
||||
support OpenCL.
|
||||
* The GPU package supports single precision floating point, mixed
|
||||
precision floating point, and double precision floating point math on
|
||||
the GPU. This must be chosen at compile time. KOKKOS currently only
|
||||
supports double precision floating point math. Using single or mixed
|
||||
precision (recommended) results in significantly improved performance
|
||||
on consumer GPUs for some loss in accuracy (which is rather small with
|
||||
mixed precision). Single and mixed precision support for KOKKOS is in
|
||||
development (no ETA yet).
|
||||
* Some pair styles (for example :doc:`snap <pair_snap>`, :doc:`mliap
|
||||
<pair_mliap>` or :doc:`reaxff <pair_reaxff>` in the KOKKOS package have
|
||||
seen extensive optimizations and specializations for GPUs and CPUs.
|
||||
|
||||
@ -1,16 +1,218 @@
|
||||
Measuring performance
|
||||
=====================
|
||||
|
||||
Before trying to make your simulation run faster, you should
|
||||
understand how it currently performs and where the bottlenecks are.
|
||||
Factors that influence performance
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The best way to do this is run the your system (actual number of
|
||||
atoms) for a modest number of timesteps (say 100 steps) on several
|
||||
different processor counts, including a single processor if possible.
|
||||
Do this for an equilibrium version of your system, so that the
|
||||
100-step timings are representative of a much longer run. There is
|
||||
typically no need to run for 1000s of timesteps to get accurate
|
||||
timings; you can simply extrapolate from short runs.
|
||||
Before trying to make your simulation run faster, you should understand
|
||||
how it currently performs and where the bottlenecks are. We generally
|
||||
distinguish between serial performance (how fast can a single process do
|
||||
the calculations?) and parallel efficiency (how much faster does a
|
||||
calculation get by using more processes?). There are many factors
|
||||
affecting either and below are some lists discussing some commonly
|
||||
known but also some less known factors.
|
||||
|
||||
Factors affecting serial performance (in no specific order):
|
||||
|
||||
* CPU hardware: clock rate, cache sizes, CPU architecture (instructions
|
||||
per clock, vectorization support, fused multiply-add support and more)
|
||||
* RAM speed and number of channels that the CPU can use to access RAM
|
||||
* Cooling: CPUs can change the CPU clock based on thermal load, thus the
|
||||
degree of cooling can affect the speed of a CPU. Sometimes even the
|
||||
temperature of neighboring compute nodes in a cluster can make a
|
||||
difference.
|
||||
* Compiler optimization: most of LAMMPS is written to be easy to modify
|
||||
and thus compiler optimization can speed up calculations. However, too
|
||||
aggressive compiler optimization can produce incorrect results or
|
||||
crashes (during compilation or at runtime).
|
||||
* Source code improvements: styles in the OPT, OPENMP, and INTEL package
|
||||
can be faster than their base implementation due to improved data
|
||||
access patterns, cache efficiency, or vectorization. Compiler optimization
|
||||
is required to take full advantage of these.
|
||||
* Number and kind of fixes, computes, or variables used during a simulation,
|
||||
especially if they result in collective communication operations
|
||||
* Pair style cutoffs and system density: calculations get slower the more
|
||||
neighbors are in the neighbor list and thus for which interactions need
|
||||
to be computed. Force fields with pair styles that compute interactions
|
||||
between triples or quadruples of atoms or that use embedding energies or
|
||||
charge equilibration will need to walk the neighbor lists multiple times.
|
||||
* Neighbor list settings: tradeoff between neighbor list skin (larger
|
||||
skin = more neighbors, more distances to compute before applying the
|
||||
cutoff) and frequency of neighbor list builds (larger skin = fewer
|
||||
neighbor list builds).
|
||||
* Proximity of per-atom data in physical memory that for atoms that are
|
||||
close in space improves cache efficiency (thus LAMMPS will by default
|
||||
sort atoms in local storage accordingly)
|
||||
* Using r-RESPA multi-timestepping or a SHAKE or RATTLE fix to constrain
|
||||
bonds with higher-frequency vibrations may allow a larger (outer) timestep
|
||||
and thus fewer force evaluations (usually the most time consuming step in
|
||||
MD) for the same simulated time (with some tradeoff in accuracy).
|
||||
|
||||
Factors affecting parallel efficiency (in no specific order):
|
||||
|
||||
* Bandwidth and latency of communication between processes. This can vary a
|
||||
lot between processes on the same CPU or physical node and processes
|
||||
on different physical nodes and there vary between different
|
||||
communication technologies (like Ethernet or InfiniBand or other
|
||||
high-speed interconnects)
|
||||
* Frequency and complexity of communication patterns required
|
||||
* Number of "work units" (usually correlated with the number of atoms
|
||||
and choice of force field) per MPI-process required for one time step
|
||||
(if this number becomes too small, the cost of communication becomes
|
||||
dominant).
|
||||
* Choice of parallelization method (MPI-only, OpenMP-only, MPI+OpenMP,
|
||||
MPI+GPU, MPI+GPU+OpenMP)
|
||||
* Algorithmic complexity of the chosen force field (pair-wise vs. many-body
|
||||
potential, Ewald vs. PPPM vs. (compensated or smoothed) cutoff-Coulomb)
|
||||
* Communication cutoff: a larger cutoff results in more ghost atoms and
|
||||
thus more data that needs to be communicated
|
||||
* Frequency of neighbor list builds: during a neighbor list build the
|
||||
domain decomposition is updated and the list of ghost atoms rebuilt
|
||||
which requires multiple global communication steps
|
||||
* FFT-grid settings and number of MPI processes for kspace style PPPM:
|
||||
PPPM uses parallel 3d FFTs which will drop much faster in parallel
|
||||
efficiency with respect to the number of MPI processes than other
|
||||
parts of the force computation. Thus using MPI+OpenMP parallelization
|
||||
or :doc:`run style verlet/split <run_style>` can improve parallel
|
||||
efficiency by limiting the number of MPI processes used for the FFTs.
|
||||
* Load (im-)balance: LAMMPS' domain decomposition assumes that atoms are
|
||||
evenly distributed across the entire simulation box. If there are
|
||||
areas of vacuum, this may lead to different amounts of work for
|
||||
different MPI processes. Using the :doc:`processors command
|
||||
<processors>` to change the spatial decomposition, or MPI+OpenMP
|
||||
parallelization instead of only-MPI to have larger sub-domains, or the
|
||||
(fix) balance command (without or with switching to communication style
|
||||
tiled) to change the sub-domain volumes are all methods that
|
||||
can help to avoid load imbalances.
|
||||
|
||||
Examples comparing serial performance
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Before looking at your own input deck(s), you should get some reference
|
||||
data from a known input so that you know what kind of performance you
|
||||
should expect from your input. For the following we therefore use the
|
||||
``in.rhodo.scaled`` input file and ``data.rhodo`` data file from the
|
||||
``bench`` folder. This is a system of 32000 atoms using the CHARMM force
|
||||
field and long-range electrostatics running for 100 MD steps. The
|
||||
performance data is printed at the end of a run and only measures the
|
||||
performance during propagation and excludes the setup phase.
|
||||
|
||||
Running with a single MPI process on an AMD Ryzen Threadripper PRO
|
||||
9985WX CPU (64 cores, 128 threads, base clock: 3.2GHz, max. clock
|
||||
5.4GHz, L1/L2/L3 cache 5MB/64MB/256MB, 8 DDR5-6400 memory channels) one
|
||||
gets the following performance report:
|
||||
|
||||
.. code-block::
|
||||
|
||||
Performance: 1.232 ns/day, 19.476 hours/ns, 7.131 timesteps/s, 228.197 katom-step/s
|
||||
99.2% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
The %CPU value should be at 100% or very close. Lower values would
|
||||
be an indication that there are *other* processes also using the same
|
||||
CPU core and thus invalidating the performance data. The katom-step/s
|
||||
value is best suited for comparisons, since it is fairly independent
|
||||
from the system size. The `in.rhodo.scaled` input can be easily made
|
||||
larger through replication in the three dimensions by settings variables
|
||||
"x", "y", "z" to values other than 1 from the command line with the
|
||||
"-var" flag. Example:
|
||||
|
||||
- 32000 atoms: 228.8 katom-step/s
|
||||
- 64000 atoms: 231.6 katom-step/s
|
||||
- 128000 atoms: 231.1 katom-step/s
|
||||
- 256000 atoms: 226.4 katom-step/s
|
||||
- 864000 atoms: 229.6 katom-step/s
|
||||
|
||||
Comparing to an AMD Ryzen 7 7840HS CPU (8 cores, 16 threads, base clock
|
||||
3.8GHz, max. clock 5.1GHz, L1/L2/L3 cache 512kB/8MB/16MB, 2 DDR5-5600
|
||||
memory channels), we get similar single core performance (~220
|
||||
katom-step/s vs. ~230 katom-step/s) due to the similar clock and
|
||||
architecture:
|
||||
|
||||
- 32000 atoms: 219.8 katom-step/s
|
||||
- 64000 atoms: 222.5 katom-step/s
|
||||
- 128000 atoms: 216.8 katom-step/s
|
||||
- 256000 atoms: 221.0 katom-step/s
|
||||
- 864000 atoms: 221.1 katom-step/s
|
||||
|
||||
Switching to an older Intel Xeon E5-2650 v4 CPU (12 cores, 12 threads,
|
||||
base clock 2.2GHz, max. clock 2.9GHz, L1/L2/L3 cache (64kB/256kB/30MB, 4
|
||||
DDR4-2400 memory channels) leads to a lower performance of approximately
|
||||
109 katom-step/s due to differences in architecture and clock. In all
|
||||
cases, when looking at multiple runs, the katom-step/s property
|
||||
fluctuates by approximately 1% around the average.
|
||||
|
||||
From here on we are looking at the performance for the 256000 atom system only
|
||||
and change several settings incrementally:
|
||||
|
||||
#. No compiler optimization GCC (-Og -g): 183.8 katom-step/s
|
||||
#. Moderate optimization with debug info GCC (-O2 -g): 231.1 katom-step/s
|
||||
#. Full compiler optimization GCC (-DNDEBUG -O3): 236.0 katom-step/s
|
||||
#. Aggressive compiler optimization GCC (-O3 -ffast-math -march=native): 239.9 katom-step/s
|
||||
#. Source code optimization in OPENMP package (1 thread): 266.7 katom-step/s
|
||||
#. Use *fix nvt* instead of *fix npt* (compute virial only every 50 steps): 272.9 katom-step/s
|
||||
#. Increase pair style cutoff by 2 :math:`\AA`: 181.2 katom-step/s
|
||||
#. Use tight PPPM convergence (1.0e-6 instead of 1.0e-4): 161.9 katom-step/s
|
||||
#. Use Ewald summation instead of PPPM (at 1.0e-4 convergence): 19.9 katom-step/s
|
||||
|
||||
The numbers show that gains from aggressive compiler optimizations are
|
||||
rather small in LAMMPS, the data access optimizations in the OPENMP (and
|
||||
OPT) packages are more prominent. On the other side, using more
|
||||
accurate force field settings causes, not unexpectedly, a significant
|
||||
slowdown (to about half the speed). Finally, using regular Ewald
|
||||
summation causes a massive slowdown due to the bad algorithmic scaling
|
||||
with system size.
|
||||
|
||||
Examples comparing parallel performance
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The parallel performance usually goes on top of the serial performance.
|
||||
Using twice as many processors should increase the performance metric
|
||||
by up to a factor of two. With the number of processors *N* and the
|
||||
serial performance :math:`p_1` and the performance for *N* processors
|
||||
:math:`p_N` we can define a *parallel efficiency* in percent as follows:
|
||||
|
||||
.. math::
|
||||
|
||||
P_{eff} = \frac{p_N}{p_1 \cdot N} \cdot 100\%
|
||||
|
||||
For the AMD Ryzen Threadripper PRO 9985WX CPU and the serial
|
||||
simulation settings of point 6. from above, we get the following
|
||||
parallel efficiency data for the 256000 atom system:
|
||||
|
||||
- 1 MPI task: 273.6 katom-step/s, :math:`P_{eff} = 100\%`
|
||||
- 2 MPI tasks: 530.6 katom-step/s, :math:`P_{eff} = 97\%`
|
||||
- 4 MPI tasks: 1.021 Matom-step/s, :math:`P_{eff} = 93\%`
|
||||
- 8 MPI tasks: 1.837 Matom-step/s, :math:`P_{eff} = 84\%`
|
||||
- 16 MPI tasks: 3.574 Matom-step/s, :math:`P_{eff} = 82\%`
|
||||
- 32 MPI tasks: 6.479 Matom-step/s, :math:`P_{eff} = 74\%`
|
||||
- 64 MPI tasks: 9.032 Matom-step/s, :math:`P_{eff} = 52\%`
|
||||
- 128 MPI tasks: 12.03 Matom-step/s, :math:`P_{eff} = 34\%`
|
||||
|
||||
The 128 MPI tasks run uses CPU cores from hyper-threading.
|
||||
|
||||
For a small system with only 32000 atoms the parallel efficiency
|
||||
drops off earlier when the number of work units is too small relative
|
||||
to the communication overhead:
|
||||
|
||||
- 1 MPI task: 270.8 katom-step/s, :math:`P_{eff} = 100\%`
|
||||
- 2 MPI tasks: 529.3 katom-step/s, :math:`P_{eff} = 98\%`
|
||||
- 4 MPI tasks: 989.8 katom-step/s, :math:`P_{eff} = 91\%`
|
||||
- 8 MPI tasks: 1.832 Matom-step/s, :math:`P_{eff} = 85\%`
|
||||
- 16 MPI tasks: 3.463 Matom-step/s, :math:`P_{eff} = 80\%`
|
||||
- 32 MPI tasks: 5.970 Matom-step/s, :math:`P_{eff} = 69\%`
|
||||
- 64 MPI tasks: 7.477 Matom-step/s, :math:`P_{eff} = 42\%`
|
||||
- 128 MPI tasks: 8.069 Matom-step/s, :math:`P_{eff} = 23\%`
|
||||
|
||||
Measuring performance of your input deck
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The best way to do this is run the your system (actual number of atoms)
|
||||
for a modest number of timesteps (say 100 steps) on several different
|
||||
processor counts, including a single processor if possible. Do this for
|
||||
an equilibrium version of your system, so that the 100-step timings are
|
||||
representative of a much longer run. There is typically no need to run
|
||||
for 1000s of timesteps to get accurate timings; you can simply
|
||||
extrapolate from short runs.
|
||||
|
||||
For the set of runs, look at the timing data printed to the screen and
|
||||
log file at the end of each LAMMPS run. The
|
||||
@ -28,12 +230,15 @@ breakdown and relative percentages. For example, trying different
|
||||
options for speeding up the long-range solvers will have little impact
|
||||
if they only consume 10% of the run time. If the pairwise time is
|
||||
dominating, you may want to look at GPU or OMP versions of the pair
|
||||
style, as discussed below. Comparing how the percentages change as
|
||||
you increase the processor count gives you a sense of how different
|
||||
operations within the timestep are scaling. Note that if you are
|
||||
running with a Kspace solver, there is additional output on the
|
||||
breakdown of the Kspace time. For PPPM, this includes the fraction
|
||||
spent on FFTs, which can be communication intensive.
|
||||
style, as discussed below. Comparing how the percentages change as you
|
||||
increase the processor count gives you a sense of how different
|
||||
operations within the timestep are scaling. If you are using PPPM as
|
||||
Kspace solver, you can turn on an additional output with
|
||||
:doc:`kspace_modify fftbench yes <kspace_modify>` which measures the
|
||||
time spent during PPPM on the 3d FFTs, which can be communication
|
||||
intensive for larger processor counts. This provides an indication
|
||||
whether it is worth trying out alternatives to the default FFT settings
|
||||
for additional performance.
|
||||
|
||||
Another important detail in the timing info are the histograms of
|
||||
atoms counts and neighbor counts. If these vary widely across
|
||||
|
||||
@ -92,6 +92,7 @@ Miscellaneous tools
|
||||
* :ref:`LAMMPS coding standards <coding_standard>`
|
||||
* :ref:`emacs <emacs>`
|
||||
* :ref:`i-PI <ipi>`
|
||||
* :ref:`JSON support <json>`
|
||||
* :ref:`kate <kate>`
|
||||
* :ref:`LAMMPS-GUI <lammps_gui>`
|
||||
* :ref:`LAMMPS magic patterns for file(1) <magic>`
|
||||
@ -364,7 +365,7 @@ These tools were provided by Aidan Thompson at Sandia
|
||||
.. _fep:
|
||||
|
||||
fep tool
|
||||
------------------
|
||||
--------
|
||||
|
||||
The tools/fep directory contains Python scripts useful for
|
||||
post-processing results from performing free-energy perturbation
|
||||
@ -379,7 +380,7 @@ See README file in the tools/fep directory.
|
||||
.. _ipi:
|
||||
|
||||
i-PI tool
|
||||
-------------------
|
||||
---------
|
||||
|
||||
.. versionchanged:: 27June2024
|
||||
|
||||
@ -432,6 +433,87 @@ tools/createatoms tool's input file.
|
||||
|
||||
----------
|
||||
|
||||
.. _json:
|
||||
|
||||
JSON support files
|
||||
------------------
|
||||
|
||||
.. versionadded:: 12June2025
|
||||
|
||||
The ``tools/json`` directory contains files and tools to support
|
||||
using `JSON format <https://www.json.org/>`_ files in LAMMPS.
|
||||
Currently only the :doc:`molecule command <molecule>` supports
|
||||
files in JSON format directly, but this is planned to be expanded
|
||||
in the future.
|
||||
|
||||
JSON file validation
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The JSON syntax is independent of its content, and thus the data in the
|
||||
file must follow suitable conventions to be correctly parsed during
|
||||
input. This can be done in a portable fashion using a `JSON schema file
|
||||
<https://json-schema.org/>`_ (which is in JSON format as well) to define
|
||||
those conventions. A suitable JSON validator software can then validate
|
||||
JSON files against the requirements. Validating a particular JSON file
|
||||
against a schema ensures that both, the syntax *and* the conventions
|
||||
are followed. This is useful when writing or editing JSON files in a
|
||||
text editor or when writing a pre-processing script or tool to create
|
||||
JSON files for a specific purpose in LAMMPS. It **cannot** check
|
||||
whether the file contents are physically meaningful, though.
|
||||
|
||||
One such validator tool is `check-jsonschema
|
||||
<https://check-jsonschema.readthedocs.io/>`_ which is written in Python
|
||||
and can be installed using the `pip Python package manager
|
||||
<https://pypi.org/>`_, best in a virtual environment as shown below (for
|
||||
a Bourne Shell command line):
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
python -m venv validate-json
|
||||
source validate-json/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install check-jsonschema
|
||||
|
||||
To validate a specific JSON file against a provided schema (here for
|
||||
a :doc:`molecule command file <molecule>` you would then run for example:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
check-jsonschema --schemafile molecule-schema.json tip3p.json
|
||||
|
||||
The latest schema files are also maintained and available for download
|
||||
at https://download.lammps.org/json . This enables validation of JSON
|
||||
files even if the LAMMPS sources are not locally available. Example:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
check-jsonschema --schemafile https://download.lammps.org/json/molecule-schema.json tip3p.json
|
||||
|
||||
JSON file format normalization
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
There are extensions to the strict JSON format that allow for comments
|
||||
or ignore additional (dangling) commas. The ``reformat-json.cpp`` tool
|
||||
will read JSON files in relaxed format, but write it out in strict format.
|
||||
It is also possible to change the level of indentation from -1 (all data
|
||||
one long line) to any positive integer value. The original file will be
|
||||
backed up (.bak added to file name) and then overwritten.
|
||||
|
||||
Manual compilation (it will be automatically included in the CMake build
|
||||
if building tools is requested during CMake configuration):
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
g++ -I <path/to/lammps/src> -o reformat-json reformat-json.cpp
|
||||
|
||||
Usage:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
reformat-json <indent-width> <json-file-1> [<json-file-2> ...]
|
||||
|
||||
----------
|
||||
|
||||
.. _kate:
|
||||
|
||||
kate tool
|
||||
@ -475,9 +557,13 @@ beginners to start with LAMMPS, it is also the expectation that
|
||||
LAMMPS-GUI users will eventually transition to workflows that most
|
||||
experienced LAMMPS users employ.
|
||||
|
||||
All features have been extensively exposed to keyboard shortcuts, so
|
||||
that there is also appeal for experienced LAMMPS users for prototyping
|
||||
and testing simulation setups.
|
||||
.. image:: JPG/lammps-gui-screen.png
|
||||
:align: center
|
||||
:scale: 50%
|
||||
|
||||
Features have been extensively exposed to keyboard shortcuts, so that
|
||||
there is also appeal for experienced LAMMPS users for prototyping and
|
||||
testing simulation setups.
|
||||
|
||||
Features
|
||||
^^^^^^^^
|
||||
@ -502,7 +588,7 @@ Here are a few highlights of LAMMPS-GUI
|
||||
- Visualization of current state in Image Viewer (via calling :doc:`write_dump image <dump_image>`)
|
||||
- Capture of images created via :doc:`dump image <dump_image>` in Slide show window
|
||||
- Dialog to set variables, similar to the LAMMPS command-line flag '-v' / '-var'
|
||||
- Support for GPU, INTEL, KOKKOS/OpenMP, OPENMAP, and OPT and accelerator packages
|
||||
- Support for GPU, INTEL, KOKKOS/OpenMP, OPENMP, and OPT accelerator packages
|
||||
|
||||
Parallelization
|
||||
^^^^^^^^^^^^^^^
|
||||
@ -523,8 +609,8 @@ with CMake is required.
|
||||
The LAMMPS-GUI has been successfully compiled and tested on:
|
||||
|
||||
- Ubuntu Linux 20.04LTS x86_64 using GCC 9, Qt version 5.12
|
||||
- Fedora Linux 40 x86\_64 using GCC 14 and Clang 17, Qt version 5.15LTS
|
||||
- Fedora Linux 40 x86\_64 using GCC 14, Qt version 6.7
|
||||
- Fedora Linux 41 x86\_64 using GCC 14 and Clang 17, Qt version 5.15LTS
|
||||
- Fedora Linux 41 x86\_64 using GCC 14, Qt version 6.8
|
||||
- Apple macOS 12 (Monterey) and macOS 13 (Ventura) with Xcode on arm64 and x86\_64, Qt version 5.15LTS
|
||||
- Windows 10 and 11 x86_64 with Visual Studio 2022 and Visual C++ 14.36, Qt version 5.15LTS
|
||||
- Windows 10 and 11 x86_64 with Visual Studio 2022 and Visual C++ 14.40, Qt version 6.7
|
||||
|
||||
@ -10,7 +10,7 @@ Syntax
|
||||
|
||||
atom_style style args
|
||||
|
||||
* style = *amoeba* or *angle* or *atomic* or *body* or *bond* or *charge* or *dielectric* or *dipole* or *dpd* or *edpd* or *electron* or *ellipsoid* or *full* or *line* or *mdpd* or *molecular* or *oxdna* or *peri* or *smd* or *sph* or *sphere* or *bpm/sphere* or *spin* or *tdpd* or *tri* or *template* or *wavepacket* or *hybrid*
|
||||
* style = *amoeba* or *angle* or *apip* or *atomic* or *body* or *bond* or *charge* or *dielectric* or *dipole* or *dpd* or *edpd* or *electron* or *ellipsoid* or *full* or *line* or *mdpd* or *molecular* or *oxdna* or *peri* or *smd* or *sph* or *sphere* or *bpm/sphere* or *spin* or *tdpd* or *tri* or *template* or *wavepacket* or *hybrid*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -117,6 +117,10 @@ the Additional Information section below.
|
||||
- *bond* + "angle data"
|
||||
- :ref:`MOLECULE <PKG-MOLECULE>`
|
||||
- bead-spring polymers with stiffness
|
||||
* - *apip*
|
||||
- *atomic* + apip_lambda, apip_lambda_required, apip_lambda_input, apip_lambda_const, apip_lambda_input_ta, apip_e_fast, apip_e_precise, apip_f_const_lambda, apip_f_dyn_lambda
|
||||
- :ref:`APIP <PKG-APIP>`
|
||||
- adaptive-precision interatomic potentials(APIP), see :doc:`APIP howto <Howto_apip>`
|
||||
* - *atomic*
|
||||
- tag, type, x, v, f, image, mask
|
||||
-
|
||||
|
||||
@ -53,15 +53,17 @@ The value *eng* is the interaction energy for the angle.
|
||||
|
||||
The value *v_name* can be used together with the *set* keyword to
|
||||
compute a user-specified function of the angle theta. The *name*
|
||||
specified for the *v_name* value is the name of an :doc:`equal-style variable <variable>` which should evaluate a formula based on a
|
||||
specified for the *v_name* value is the name of an :doc:`equal-style
|
||||
variable <variable>` which should evaluate a formula based on a
|
||||
variable which will store the angle theta. This other variable must
|
||||
be an :doc:`internal-style variable <variable>` defined in the input
|
||||
script; its initial numeric value can be anything. It must be an
|
||||
internal-style variable, because this command resets its value
|
||||
directly. The *set* keyword is used to identify the name of this
|
||||
other variable associated with theta.
|
||||
be an :doc:`internal-style variable <variable>` specified by the *set*
|
||||
keyword. It is an internal-style variable, because this command
|
||||
resets its value directly. The internal-style variable does not need
|
||||
to be defined in the input script (though it can be); if it is not
|
||||
defined, then the *set* option creates an :doc:`internal-style
|
||||
variable <variable>` with the specified name.
|
||||
|
||||
Note that the value of theta for each angle which stored in the
|
||||
Note that the value of theta for each angle which is stored in the
|
||||
internal variable is in radians, not degrees.
|
||||
|
||||
As an example, these commands can be added to the bench/in.rhodo
|
||||
@ -70,7 +72,6 @@ system and output the statistics in various ways:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable t internal 0.0
|
||||
variable cos equal cos(v_t)
|
||||
variable cossq equal cos(v_t)*cos(v_t)
|
||||
|
||||
|
||||
@ -64,20 +64,32 @@ All these properties are computed for the pair of atoms in a bond,
|
||||
whether the two atoms represent a simple diatomic molecule, or are part
|
||||
of some larger molecule.
|
||||
|
||||
The value *dist* is the current length of the bond.
|
||||
The values *dx*, *dy*, and *dz* are the xyz components of the
|
||||
*distance* between the pair of atoms. This value is always the
|
||||
distance from the atom of lower to the one with the higher id.
|
||||
.. versionchanged:: 12Jun2025
|
||||
|
||||
The sign of *dx*, *dy*, *dz* is no longer determined by the atom IDs
|
||||
of the bonded atoms but by their order in the bond list to be
|
||||
consistent with *fx*, *fy*, and *fz*.
|
||||
|
||||
The value *dist* is the current length of the bond. The values *dx*,
|
||||
*dy*, and *dz* are the :math:`(x,y,z)` components of the distance vector
|
||||
:math:`\vec{x_i} - \vec{x_j}` between the atoms in the bond. The order
|
||||
of the atoms is determined by the bond list and the respective atom-IDs
|
||||
can be output with :doc:`compute property/local
|
||||
<compute_property_local>`.
|
||||
|
||||
The value *engpot* is the potential energy for the bond,
|
||||
based on the current separation of the pair of atoms in the bond.
|
||||
|
||||
The value *force* is the magnitude of the force acting between the
|
||||
pair of atoms in the bond.
|
||||
The value *force* is the magnitude of the force acting between the pair
|
||||
of atoms in the bond, which is positive for a repulsive force and
|
||||
negative for an attractive force.
|
||||
|
||||
The values *fx*, *fy*, and *fz* are the xyz components of
|
||||
*force* between the pair of atoms in the bond. For bond styles that apply
|
||||
non-central forces, such as :doc:`bond_style bpm/rotational
|
||||
The values *fx*, *fy*, and *fz* are the :math:`(x,y,z)` components of
|
||||
the force on the first atom *i* in the bond due to the second atom *j*.
|
||||
Mathematically, they are obtained by multiplying the value of *force*
|
||||
from above with a unit vector created from the *dx*, *dy*, and *dz*
|
||||
components of the distance vector also described above. For bond styles
|
||||
that apply non-central forces, such as :doc:`bond_style bpm/rotational
|
||||
<bond_bpm_rotational>`, these values only include the :math:`(x,y,z)`
|
||||
components of the normal force component.
|
||||
|
||||
@ -118,13 +130,15 @@ moving apart.
|
||||
|
||||
The value *v_name* can be used together with the *set* keyword to
|
||||
compute a user-specified function of the bond distance. The *name*
|
||||
specified for the *v_name* value is the name of an :doc:`equal-style variable <variable>` which should evaluate a formula based on a
|
||||
variable which will store the bond distance. This other variable must
|
||||
be an :doc:`internal-style variable <variable>` defined in the input
|
||||
script; its initial numeric value can be anything. It must be an
|
||||
internal-style variable, because this command resets its value
|
||||
directly. The *set* keyword is used to identify the name of this
|
||||
other variable associated with theta.
|
||||
specified for the *v_name* value is the name of an :doc:`equal-style
|
||||
variable <variable>` which should evaluate a formula based on a
|
||||
variable which stores the bond distance. This other variable must be
|
||||
the :doc:`internal-style variable <variable>` specified by the *set*
|
||||
keyword. It is an internal-style variable, because this command
|
||||
resets its value directly. The internal-style variable does not need
|
||||
to be defined in the input script (though it can be); if it is not
|
||||
defined, then the *set* option creates an :doc:`internal-style
|
||||
variable <variable>` with the specified name.
|
||||
|
||||
As an example, these commands can be added to the bench/in.rhodo
|
||||
script to compute the length\ :math:`^2` of every bond in the system and
|
||||
@ -132,7 +146,6 @@ output the statistics in various ways:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable d internal 0.0
|
||||
variable dsq equal v_d*v_d
|
||||
|
||||
compute 1 all property/local batom1 batom2 btype
|
||||
|
||||
@ -45,30 +45,31 @@ interactions. The number of datums generated, aggregated across all
|
||||
processors, equals the number of dihedral angles in the system, modified
|
||||
by the group parameter as explained below.
|
||||
|
||||
The value *phi* (:math:`\phi`) is the dihedral angle, as defined in the diagram
|
||||
on the :doc:`dihedral_style <dihedral_style>` doc page.
|
||||
The value *phi* (:math:`\phi`) is the dihedral angle, as defined in
|
||||
the diagram on the :doc:`dihedral_style <dihedral_style>` doc page.
|
||||
|
||||
The value *v_name* can be used together with the *set* keyword to compute a
|
||||
user-specified function of the dihedral angle :math:`\phi`. The *name*
|
||||
specified for the *v_name* value is the name of an
|
||||
:doc:`equal-style variable <variable>` which should evaluate a formula based on
|
||||
a variable which will store the angle :math:`\phi`. This other variable must
|
||||
be an :doc:`internal-style variable <variable>` defined in the input
|
||||
script; its initial numeric value can be anything. It must be an
|
||||
internal-style variable, because this command resets its value
|
||||
directly. The *set* keyword is used to identify the name of this
|
||||
other variable associated with :math:`\phi`.
|
||||
The value *v_name* can be used together with the *set* keyword to
|
||||
compute a user-specified function of the dihedral angle :math:`\phi`.
|
||||
The *name* specified for the *v_name* value is the name of an
|
||||
:doc:`equal-style variable <variable>` which should evaluate a formula
|
||||
based on a variable which will store the angle :math:`\phi`. This
|
||||
other variable must be an :doc:`internal-style variable <variable>`
|
||||
specified by the *set* keyword. It is an internal-style variable,
|
||||
because this command resets its value directly. The internal-style
|
||||
variable does not need to be defined in the input script (though it
|
||||
can be); if it is not defined, then the *set* option creates an
|
||||
:doc:`internal-style variable <variable>` with the specified name.
|
||||
|
||||
Note that the value of :math:`\phi` for each angle which stored in the internal
|
||||
variable is in radians, not degrees.
|
||||
Note that the value of :math:`\phi` for each angle which stored in the
|
||||
internal variable is in radians, not degrees.
|
||||
|
||||
As an example, these commands can be added to the bench/in.rhodo
|
||||
script to compute the :math:`\cos\phi` and :math:`\cos^2\phi` of every dihedral
|
||||
angle in the system and output the statistics in various ways:
|
||||
script to compute the :math:`\cos\phi` and :math:`\cos^2\phi` of every
|
||||
dihedral angle in the system and output the statistics in various
|
||||
ways:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable p internal 0.0
|
||||
variable cos equal cos(v_p)
|
||||
variable cossq equal cos(v_p)*cos(v_p)
|
||||
|
||||
@ -100,10 +101,10 @@ no consistent ordering of the entries within the local vector or array
|
||||
from one timestep to the next. The only consistency that is
|
||||
guaranteed is that the ordering on a particular timestep will be the
|
||||
same for local vectors or arrays generated by other compute commands.
|
||||
For example, dihedral output from the
|
||||
:doc:`compute property/local <compute_property_local>` command can be combined
|
||||
with data from this command and output by the :doc:`dump local <dump>`
|
||||
command in a consistent way.
|
||||
For example, dihedral output from the :doc:`compute property/local
|
||||
<compute_property_local>` command can be combined with data from this
|
||||
command and output by the :doc:`dump local <dump>` command in a
|
||||
consistent way.
|
||||
|
||||
Here is an example of how to do this:
|
||||
|
||||
|
||||
@ -49,8 +49,6 @@ proportional to the diffusion coefficient of the diffusing atoms.
|
||||
The displacement of an atom is from its reference position. This is
|
||||
normally the original position at the time
|
||||
the compute command was issued, unless the *average* keyword is set to *yes*\ .
|
||||
The value of the displacement will be
|
||||
0.0 for atoms not in the specified compute group.
|
||||
|
||||
If the *com* option is set to *yes* then the effect of any drift in
|
||||
the center-of-mass of the group of atoms is subtracted out before the
|
||||
@ -111,7 +109,10 @@ distance\ :math:`^2` :doc:`units <units>`.
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
Compute *msd* cannot be used with a dynamic group.
|
||||
Compute *msd* cannot be used with a dynamic group and the number of
|
||||
atoms in the compute group must not be changed by some fixes like,
|
||||
for example, :doc:`fix deposit <fix_deposit>` or
|
||||
:doc:`fix evaporate <fix_evaporate>`.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
@ -56,19 +56,33 @@ force cutoff distance for that interaction, as defined by the
|
||||
:doc:`pair_style <pair_style>` and :doc:`pair_coeff <pair_coeff>`
|
||||
commands.
|
||||
|
||||
The value *dist* is the distance between the pair of atoms.
|
||||
The values *dx*, *dy*, and *dz* are the :math:`(x,y,z)` components of the
|
||||
*distance* between the pair of atoms. This value is always the
|
||||
distance from the atom of higher to the one with the lower atom ID.
|
||||
.. versionchanged:: 12Jun2025
|
||||
|
||||
The sign of *dx*, *dy*, *dz* is no longer determined by the value of
|
||||
their atom-IDs but by their order in the neighbor list to be
|
||||
consistent with *fx*, *fy*, and *fz*.
|
||||
|
||||
The value *dist* is the distance between the pair of atoms. The values
|
||||
*dx*, *dy*, and *dz* are the :math:`(x,y,z)` components of the distance
|
||||
vector :math:`\vec{x_i} - \vec{x_j}` between the pair of atoms. The
|
||||
order of the atoms is determined by the neighbor list and the respective
|
||||
atom-IDs can be output with :doc:`compute property/local
|
||||
<compute_property_local>`.
|
||||
|
||||
The value *eng* is the interaction energy for the pair of atoms.
|
||||
|
||||
The value *force* is the force acting between the pair of atoms, which
|
||||
is positive for a repulsive force and negative for an attractive
|
||||
force. The values *fx*, *fy*, and *fz* are the :math:`(x,y,z)` components of
|
||||
*force* on atom I. For pair styles that apply non-central forces,
|
||||
such as :doc:`granular pair styles <pair_gran>`, these values only include
|
||||
the :math:`(x,y,z)` components of the normal force component.
|
||||
force.
|
||||
|
||||
The values *fx*, *fy*, and *fz* are the :math:`(x,y,z)` components of
|
||||
the force vector on the first atom *i* of a pair in the neighbor list
|
||||
due to the second atom *j*. Mathematically, they are obtained by
|
||||
multiplying the value of *force* from above with a unit vector created
|
||||
from the *dx*, *dy*, and *dz* components of the distance vector also
|
||||
described above. For pair styles that apply non-central forces, such as
|
||||
:doc:`granular pair styles <pair_gran>`, these values only include the
|
||||
:math:`(x,y,z)` components of the normal force component.
|
||||
|
||||
A pair style may define additional pairwise quantities which can be
|
||||
accessed as *p1* to *pN*, where :math:`N` is defined by the pair style.
|
||||
|
||||
@ -34,6 +34,8 @@ Syntax
|
||||
i_name, d_name, i2_name[I], d2_name[I],
|
||||
vfrac, s0, espin, eradius, ervel, erforce,
|
||||
rho, drho, e, de, cv, buckling,
|
||||
apip_lambda, apip_lambda_input, apip_e_fast,
|
||||
apip_e_precise
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -70,6 +72,13 @@ Syntax
|
||||
*i2_name[I]* = Ith column of custom integer array with name
|
||||
*d2_name[I]* = Ith column of custom floating-point array with name
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
APIP package per-atom properties:
|
||||
*apip_lambda* = switching parameter
|
||||
*apip_lambda_input* = input used to calculate the switching parameter
|
||||
*apip_e_fast,apip_e_precise* = potential energies mixed by the adaptive-precision potential
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
PERI package per-atom properties:
|
||||
@ -162,6 +171,22 @@ segment particles and define the end points of each line segment.
|
||||
*corner2z*, *corner3x*, *corner3y*, *corner3z*, are defined for
|
||||
triangular particles and define the corner points of each triangle.
|
||||
|
||||
The accessible quantities from the :doc:`APIP package <Howto_apip>` are
|
||||
explained in the doc pages of this package in detail.
|
||||
In short: *apip_lambda* is the switching parameter :math:`\lambda\in[0,1]`,
|
||||
that is calculated from *apip_lambda_input* and that mixes the energies
|
||||
of a fast (*apip_e_fast*) and a precise (*apip_e_precise*) potential
|
||||
into an adaptive-precision energy.
|
||||
|
||||
.. note::
|
||||
|
||||
The energy according to the fast and the precise potential are only
|
||||
computed for the subset of atoms, for which it is required, i.e.,
|
||||
for an atom :math:`i` with :math:`\lambda_i=1` one does not need
|
||||
:math:`E_i^\text{precise}` and with :math:`\lambda_i=0` one does
|
||||
not need :math:`E_i^\text{fast}`.
|
||||
|
||||
|
||||
In addition, the various per-atom quantities listed above for specific
|
||||
packages are only accessible by this command.
|
||||
|
||||
|
||||
@ -396,7 +396,7 @@ correct number of particles are inserted, in a perfectly random
|
||||
fashion. Which lattice sites are selected will change with the number
|
||||
of processors used.
|
||||
|
||||
.. versionadded:: TBD
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
The *group* keyword adds the newly created atoms to the named
|
||||
:doc:`group <group>`. If the group does not yet exist it will be
|
||||
@ -416,24 +416,23 @@ atom, based on its coordinates. They apply to all styles except
|
||||
*single*. The *name* specified for the *var* keyword is the name of
|
||||
an :doc:`equal-style variable <variable>` that should evaluate to a
|
||||
zero or non-zero value based on one or two or three variables that
|
||||
will store the *x*, *y*, or *z* coordinates of an atom (one variable per
|
||||
coordinate). If used, these other variables must be
|
||||
:doc:`internal-style variables <variable>` defined in the input
|
||||
script; their initial numeric value can be anything. They must be
|
||||
internal-style variables, because this command resets their values
|
||||
directly. The *set* keyword is used to identify the names of these
|
||||
other variables, one variable for the *x*-coordinate of a created atom,
|
||||
one for *y*, and one for *z*.
|
||||
will store the *x*, *y*, or *z* coordinates of an atom (one variable
|
||||
per coordinate). If used, these other variables must be specified by
|
||||
the *set* keyword. They are internal-style variable, because this
|
||||
command resets their values directly. The internal-style variables do
|
||||
not need to be defined in the input script (though they can be); if
|
||||
one (or more) is not defined, then the *set* option creates an
|
||||
:doc:`internal-style variable <variable>` with the specified name.
|
||||
|
||||
.. figure:: img/sinusoid.jpg
|
||||
:figwidth: 50%
|
||||
:align: right
|
||||
:target: _images/sinusoid.jpg
|
||||
|
||||
When an atom is created, its :math:`(x,y,z)` coordinates become the values for
|
||||
any *set* variable that is defined. The *var* variable is then
|
||||
evaluated. If the returned value is 0.0, the atom is not created. If
|
||||
it is non-zero, the atom is created.
|
||||
When an atom is about to be created, its :math:`(x,y,z)` coordinates
|
||||
become the values for any *set* variable that is defined. The *var*
|
||||
variable is then evaluated. If the returned value is 0.0, the atom is
|
||||
not created. If it is non-zero, the atom is created.
|
||||
|
||||
As an example, these commands can be used in a 2d simulation, to
|
||||
create a sinusoidal surface. Note that the surface is "rough" due to
|
||||
@ -456,8 +455,6 @@ converts lattice spacings to distance.
|
||||
region box block 0 $x 0 $y -0.5 0.5
|
||||
create_box 1 box
|
||||
|
||||
variable xx internal 0.0
|
||||
variable yy internal 0.0
|
||||
variable v equal "(0.2*v_y*ylat * cos(v_xx/xlat * 2.0*PI*4.0/v_x) + 0.5*v_y*ylat - v_yy) > 0.0"
|
||||
create_atoms 1 box var v set x xx set y yy
|
||||
write_dump all atom sinusoid.lammpstrj
|
||||
|
||||
@ -201,6 +201,7 @@ accelerated styles exist.
|
||||
* :doc:`append/atoms <fix_append_atoms>` - append atoms to a running simulation
|
||||
* :doc:`atc <fix_atc>` - initiates a coupled MD/FE simulation
|
||||
* :doc:`atom/swap <fix_atom_swap>` - Monte Carlo atom type swapping
|
||||
* :doc:`atom_weight/apip <fix_atom_weight_apip>` - compute atomic load of an :doc:`APIP potential <Howto_apip>` for load balancing
|
||||
* :doc:`ave/atom <fix_ave_atom>` - compute per-atom time-averaged quantities
|
||||
* :doc:`ave/chunk <fix_ave_chunk>` - compute per-chunk time-averaged quantities
|
||||
* :doc:`ave/correlate <fix_ave_correlate>` - compute/output time correlations
|
||||
@ -208,6 +209,7 @@ accelerated styles exist.
|
||||
* :doc:`ave/grid <fix_ave_grid>` - compute per-grid time-averaged quantities
|
||||
* :doc:`ave/histo <fix_ave_histo>` - compute/output time-averaged histograms
|
||||
* :doc:`ave/histo/weight <fix_ave_histo>` - weighted version of fix ave/histo
|
||||
* :doc:`ave/moments <fix_ave_moments>` - compute moments of scalar quantities
|
||||
* :doc:`ave/time <fix_ave_time>` - compute/output global time-averaged quantities
|
||||
* :doc:`aveforce <fix_aveforce>` - add an averaged force to each atom
|
||||
* :doc:`balance <fix_balance>` - perform dynamic load-balancing
|
||||
@ -269,6 +271,7 @@ accelerated styles exist.
|
||||
* :doc:`imd <fix_imd>` - implements the "Interactive MD" (IMD) protocol
|
||||
* :doc:`indent <fix_indent>` - impose force due to an indenter
|
||||
* :doc:`ipi <fix_ipi>` - enable LAMMPS to run as a client for i-PI path-integral simulations
|
||||
* :doc:`lambda/apip <fix_lambda_apip>` - compute switching parameter, that controls the precision of an :doc:`APIP potential <Howto_apip>`
|
||||
* :doc:`langevin <fix_langevin>` - Langevin temperature control
|
||||
* :doc:`langevin/drude <fix_langevin_drude>` - Langevin temperature control of Drude oscillators
|
||||
* :doc:`langevin/eff <fix_langevin_eff>` - Langevin temperature control for the electron force field model
|
||||
@ -277,6 +280,7 @@ accelerated styles exist.
|
||||
* :doc:`lb/momentum <fix_lb_momentum>` - :doc:`fix momentum <fix_momentum>` replacement for use with a lattice-Boltzmann fluid
|
||||
* :doc:`lb/viscous <fix_lb_viscous>` - :doc:`fix viscous <fix_viscous>` replacement for use with a lattice-Boltzmann fluid
|
||||
* :doc:`lineforce <fix_lineforce>` - constrain atoms to move in a line
|
||||
* :doc:`lambda_thermostat/apip <fix_lambda_thermostat_apip>` - apply energy conserving correction for an :doc:`APIP potential <Howto_apip>`
|
||||
* :doc:`manifoldforce <fix_manifoldforce>` - restrain atoms to a manifold during minimization
|
||||
* :doc:`mdi/qm <fix_mdi_qm>` - LAMMPS operates as a client for a quantum code via the MolSSI Driver Interface (MDI)
|
||||
* :doc:`mdi/qmmm <fix_mdi_qmmm>` - LAMMPS operates as client for QM/MM simulation with a quantum code via the MolSSI Driver Interface (MDI)
|
||||
@ -396,6 +400,7 @@ accelerated styles exist.
|
||||
* :doc:`rigid/small <fix_rigid>` - constrain many small clusters of atoms to move as a rigid body with NVE integration
|
||||
* :doc:`rx <fix_rx>` - solve reaction kinetic ODEs for a defined reaction set
|
||||
* :doc:`saed/vtk <fix_saed_vtk>` - time-average the intensities from :doc:`compute saed <compute_saed>`
|
||||
* :doc:`set <fix_set>` - reset an atom property via an atom-style variable every N steps
|
||||
* :doc:`setforce <fix_setforce>` - set the force on each atom
|
||||
* :doc:`setforce/spin <fix_setforce>` - set magnetic precession vectors on each atom
|
||||
* :doc:`sgcmc <fix_sgcmc>` - fix for hybrid semi-grand canonical MD/MC simulations
|
||||
|
||||
@ -440,7 +440,7 @@ this fix uses to reset theta0 needs to generate values in radians.
|
||||
|
||||
----------
|
||||
|
||||
.. versionadded:: TBD
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
The *dihedral* keyword uses the specified variable to change the value of
|
||||
a dihedral coefficient over time, very similar to how the *angle* keyword
|
||||
|
||||
143
doc/src/fix_atom_weight_apip.rst
Normal file
143
doc/src/fix_atom_weight_apip.rst
Normal file
@ -0,0 +1,143 @@
|
||||
.. index:: fix atom_weight/apip
|
||||
|
||||
fix atom_weight/apip command
|
||||
============================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID atom_weight/apip nevery fast_potential precise_potential lambda_input lambda_zone group_lambda_input [no_rescale]
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* atom_weight/apip = style name of this fix command
|
||||
* nevery = perform load calculation every this many steps
|
||||
* fast_potential = *eam* or *ace* for time measurements of the corresponding pair_style or float for constant time
|
||||
* precise_potential = *ace* for a time measurement of the pair_style pace/apip or float for constant time
|
||||
* lambda_input = *lambda/input* for a time measurement of pair_style lambda/input/apip or float for constant time
|
||||
* lambda_zone = *lambda/zone* for a time measurement of pair_style lambda/zone/apip or float for constant time
|
||||
* group_lambda_input = group-ID of the group for which lambda_input is computed
|
||||
* no_rescale = do not rescale the work per processor to the measured total force-computation time
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix 2 all atom_weight/apip 50 eam ace lambda/input lambda/zone all
|
||||
fix 2 all atom_weight/apip 50 1e-05 0.0004 4e-06 4e-06 all
|
||||
fix 2 all atom_weight/apip 50 ace ace 4e-06 4e-06 all no_rescale
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
This command approximates the load every atom causes when an
|
||||
adaptive-precision interatomic potential (APIP) according to
|
||||
:ref:`(Immel) <Immel2025_2>` is used.
|
||||
This approximated load can be saved as atomic variable and
|
||||
used as input for the dynamic load balancing via the
|
||||
:doc:`fix balance <fix_balance>` command.
|
||||
|
||||
An adaptive-precision potential like :doc:`eam/apip <pair_eam_apip>`
|
||||
and :doc:`pace/apip <pair_pace_apip>` is calculated only
|
||||
for a subset of atoms.
|
||||
The switching parameter that determines per atom, which potential energy is
|
||||
used, can be also calculated by
|
||||
:doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`.
|
||||
A spatial switching zone, that ensures a smooth transition between two
|
||||
different interatomic potentials, can be calculated by
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`.
|
||||
Thus, there are up to four force-subroutines, that are computed only for a
|
||||
subset of atoms and combined via the pair_style :doc:`hybrid/overlay <pair_hybrid>`.
|
||||
For all four force-subroutines, the average work per atom is be measured
|
||||
per processor by the corresponding pair_style.
|
||||
This fix extracts these measurements of the pair styles every *nevery*
|
||||
steps. The average compute times are used to calculates a per-atom vector with
|
||||
the approximated atomic weight, whereas the average compute time of the four
|
||||
subroutines contributes only to the load of atoms, for which the corresponding
|
||||
subroutine was calculated.
|
||||
If not disabled via *no_rescale*, the so calculated load is
|
||||
rescaled per processor so that the total atomic compute time matches the
|
||||
also measured total compute time of the whole pair_style.
|
||||
This atomic weight is intended to be used
|
||||
as input for :doc:`fix balance <fix_balance>`:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable nevery equal 10
|
||||
fix weight_atom all atom_weight/apip ${nevery} eam ace lambda/input lambda/zone all
|
||||
variable myweight atom f_weight_atom
|
||||
fix balance all balance ${nevery} 1.1 rcb weight var myweight
|
||||
|
||||
Furthermore, this fix provides the over the processors averaged compute time of the
|
||||
four pair_styles, which are used to approximate the atomic weight, as vector.
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about this fix is written to
|
||||
:doc:`binary restart files <restart>`. None of the
|
||||
:doc:`fix_modify <fix_modify>` options are relevant to this fix.
|
||||
|
||||
This fix produces a per-atom vector that contains the atomic
|
||||
weight of each atom.
|
||||
The per-atom vector can only be accessed on timesteps that are multiples
|
||||
of *nevery*.
|
||||
|
||||
Furthermore, this fix computes a global vector of length 4 with
|
||||
statistical information about the four different (possibly)
|
||||
measured compute times per force subroutine. The four
|
||||
values in the vector are as follows:
|
||||
|
||||
#. average compute time for one atom using the fast pair_style
|
||||
#. average compute time for one atom using the precise pair_style
|
||||
#. average compute time of lambda/input/apip for one atom
|
||||
#. average compute time of lambda/zone/apip for one atom
|
||||
|
||||
The compute times are computed as average of all processors that
|
||||
measured at least one computation of the corresponding style.
|
||||
The vector values calculated by this fix are "intensive" and
|
||||
updated whenever the per-atom vector is computed, i.e., in
|
||||
timesteps that are multiples of *nevery*.
|
||||
|
||||
The vector and the per-atom vector can be accessed by various
|
||||
:doc:`output commands <Howto_output>`.
|
||||
|
||||
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This fix is part of the APIP package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix balance <fix_balance>`,
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>`,
|
||||
:doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>`,
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`,
|
||||
:doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`,
|
||||
:doc:`pair_style eam/apip <pair_eam_apip>`,
|
||||
:doc:`pair_style pace/apip <pair_pace_apip>`,
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
*no_rescale* is not used by default.
|
||||
|
||||
----------
|
||||
|
||||
.. _Immel2025_2:
|
||||
|
||||
**(Immel)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)
|
||||
@ -82,10 +82,9 @@ specified values may represent calculations performed by computes and
|
||||
fixes which store their own "group" definitions.
|
||||
|
||||
Each listed value can be the result of a compute or fix or the
|
||||
evaluation of an equal-style or vector-style variable. For
|
||||
vector-style variables, the specified indices can include a wildcard
|
||||
character. See the :doc:`fix ave/correlate <fix_ave_correlate>` page
|
||||
for details.
|
||||
evaluation of an equal-style or vector-style variable. The specified
|
||||
indices can include a wildcard string. See the
|
||||
:doc:`fix ave/correlate <fix_ave_correlate>` page for details on that.
|
||||
|
||||
The *Nevery* and *Nfreq* arguments specify on what time steps the input
|
||||
values will be used to calculate correlation data and the frequency
|
||||
|
||||
296
doc/src/fix_ave_moments.rst
Normal file
296
doc/src/fix_ave_moments.rst
Normal file
@ -0,0 +1,296 @@
|
||||
.. index:: fix ave/moments
|
||||
|
||||
fix ave/moments command
|
||||
=======================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID ave/moments Nevery Nrepeat Nfreq value1 value2 ... moment1 moment2 ... keyword args ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* ave/moments = style name of this fix command
|
||||
* Nevery = use input values every this many time steps
|
||||
* Nrepeat = # of times to use input values for calculating averages
|
||||
* Nfreq = calculate averages every this many time steps
|
||||
* one or more input variables can be listed
|
||||
* value = v_name
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
c_ID = global scalar calculated by a compute with ID
|
||||
c_ID[I] = Ith component of global vector calculated by a compute with ID, I can include wildcard (see below)
|
||||
f_ID = global scalar calculated by a fix with ID
|
||||
f_ID[I] = Ith component of global vector calculated by a fix with ID, I can include wildcard (see below)
|
||||
v_name = value calculated by an equal-style variable with name
|
||||
v_name[I] = value calculated by a vector-style variable with name, I can include wildcard (see below)
|
||||
|
||||
* one or more moments to compute can be listed
|
||||
* moment = *mean* or *stddev* or *variance* or *skew* or *kurtosis*, see exact definitions below.
|
||||
* zero or more keyword/arg pairs may be appended
|
||||
* keyword = *start* or *history*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*start* args = Nstart
|
||||
Nstart = invoke first after this time step
|
||||
*history* args = Nrecent
|
||||
Nrecent = keep a history of up to Nrecent outputs
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix 1 all ave/moments 1 1000 100 v_volume mean stddev
|
||||
fix 1 all ave/moments 1 200 1000 v_volume variance kurtosis history 10
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
Using one or more values as input, calculate the moments of the underlying
|
||||
(population) distributions based on samples collected every few time
|
||||
steps over a time step window. The definitions of the moments calculated
|
||||
are given below.
|
||||
|
||||
The group specified with this command is ignored. However, note that
|
||||
specified values may represent calculations performed by computes and
|
||||
fixes which store their own "group" definitions.
|
||||
|
||||
Each listed value can be the result of a :doc:`compute <compute>` or
|
||||
:doc:`fix <fix>` or the evaluation of an equal-style or vector-style
|
||||
:doc:`variable <variable>`. In each case, the compute, fix, or variable
|
||||
must produce a global quantity, not a per-atom or local quantity.
|
||||
If you wish to spatial- or time-average or histogram per-atom
|
||||
quantities from a compute, fix, or variable, then see the :doc:`fix
|
||||
ave/chunk <fix_ave_chunk>`, :doc:`fix ave/atom <fix_ave_atom>`, or
|
||||
:doc:`fix ave/histo <fix_ave_histo>` commands. If you wish to sum a
|
||||
per-atom quantity into a single global quantity, see the :doc:`compute
|
||||
reduce <compute_reduce>` command.
|
||||
|
||||
Many :doc:`computes <compute>` and :doc:`fixes <fix>` produce global
|
||||
quantities. See their doc pages for details. :doc:`Variables <variable>`
|
||||
of style *equal* and *vector* are the only ones that can be used with
|
||||
this fix. Variables of style *atom* cannot be used, since they produce
|
||||
per-atom values.
|
||||
|
||||
The input values must all be scalars or vectors with a bracketed term
|
||||
appended, indicating the :math:`I^\text{th}` value of the vector is
|
||||
used.
|
||||
|
||||
The result of this fix can be accessed as a vector, containing the
|
||||
interleaved moments of each input in order. If M moments are requested,
|
||||
then the moments of input 1 will be the first M values in the vector
|
||||
output by this fix. The moments of input 2 will the next M values, etc.
|
||||
If there are N values, the vector length will be N*M.
|
||||
|
||||
----------
|
||||
|
||||
For input values from a compute or fix or variable, the bracketed index
|
||||
I can be specified using a wildcard asterisk with the index to
|
||||
effectively specify multiple values. This takes the form "\*" or "\*n"
|
||||
or "m\*" or "m\*n". If :math:`N` is the size of the vector, then an
|
||||
asterisk with no numeric values means all indices from 1 to :math:`N`.
|
||||
A leading asterisk means all indices from 1 to n (inclusive). A
|
||||
trailing asterisk means all indices from n to :math:`N` (inclusive). A
|
||||
middle asterisk means all indices from m to n (inclusive).
|
||||
|
||||
Using a wildcard is the same as if the individual elements of the vector
|
||||
or cells of the array had been listed one by one. For examples, see the
|
||||
description of this capability in :doc:`fix ave/time <fix_ave_time>`.
|
||||
|
||||
----------
|
||||
|
||||
The :math:`N_\text{every}`, :math:`N_\text{repeat}`, and
|
||||
:math:`N_\text{freq}` arguments specify on what time steps the input
|
||||
values will be used in order to contribute to the average. The final
|
||||
statistics are generated on time steps that are a multiple of
|
||||
:math:`N_\text{freq}`\ . The average is over a window of up to
|
||||
:math:`N_\text{repeat}` quantities, computed in the preceding portion of
|
||||
the simulation once every :math:`N_\text{every}` time steps.
|
||||
|
||||
.. note::
|
||||
|
||||
Contrary to most fix ave/* commands, it is not required that Nevery *
|
||||
Nrepeat <= Nfreq. This is to allow the user to choose the time
|
||||
window and number of samples contributing to the output at each
|
||||
Nfreq interval.
|
||||
|
||||
For example, if :math:`N_\text{freq}=100` and :math:`N_\text{repeat}=5`
|
||||
(and :math:`N_\text{every}=1`), then on step 100 values from time steps
|
||||
96, 97, 98, 99, and 100 will be used. The fix does not compute its
|
||||
inputs on steps that are not required. If :math:`N_\text{freq}=5`,
|
||||
:math:`N_\text{repeat}=8` and :math:`N_\text{every}=1`, then values
|
||||
will first be calculated on step 5 from steps 1-5, on step 10 from 3-10,
|
||||
on step 15 from 8-15 and so on, forming a rolling average over
|
||||
timesteps that span a time window larger than Nfreq.
|
||||
|
||||
----------
|
||||
|
||||
If a value begins with "c\_", a compute ID must follow which has been
|
||||
previously defined in the input script. If no bracketed term is
|
||||
appended, the global scalar calculated by the compute is used. If a
|
||||
bracketed term is appended, the Ith element of the global vector
|
||||
calculated by the compute is used. See the discussion above for how I
|
||||
can be specified with a wildcard asterisk to effectively specify
|
||||
multiple values.
|
||||
|
||||
If a value begins with "f\_", a fix ID must follow which has been
|
||||
previously defined in the input script. If no bracketed term is
|
||||
appended, the global scalar calculated by the fix is used. If a
|
||||
bracketed term is appended, the Ith element of the global vector
|
||||
calculated by the fix is used. See the discussion above for how I can
|
||||
be specified with a wildcard asterisk to effectively specify multiple
|
||||
values.
|
||||
|
||||
Note that some fixes only produce their values on certain time steps,
|
||||
which must be compatible with *Nevery*, else an error will result.
|
||||
Users can also write code for their own fix styles and :doc:`add them to
|
||||
LAMMPS <Modify>`.
|
||||
|
||||
If a value begins with "v\_", a variable name must follow which has been
|
||||
previously defined in the input script. Only equal-style or vector-style
|
||||
variables can be used, which both produce global values. Vector-style
|
||||
variables require a bracketed term to specify the Ith element of the
|
||||
vector calculated by the variable.
|
||||
|
||||
Note that variables of style *equal* and *vector* define a formula which
|
||||
can reference individual atom properties or thermodynamic keywords, or
|
||||
they can invoke other computes, fixes, or variables when they are
|
||||
evaluated, so this is a very general means of specifying quantities to
|
||||
time average.
|
||||
|
||||
----------
|
||||
|
||||
The moments are output in the order requested in the arguments following
|
||||
the last input. Any number and order of moments can be specified,
|
||||
although it does not make much sense to specify the same moment multiple
|
||||
times. All moments are computed using a correction of the sample estimators
|
||||
used to obtain unbiased cumulants :math:`k_{1..4}` (see :ref:`(Cramer)
|
||||
<Cramer1>`). The correction for variance is the standard Bessel
|
||||
correction. For other moments, see :ref:`(Joanes)<Joanes1>`.
|
||||
|
||||
For *mean*, the arithmetic mean :math:`\bar{x} = \frac{1}{n}
|
||||
\sum_{i=1}^{n} x_i` is calculated.
|
||||
|
||||
For *variance*, the Bessel-corrected sample variance :math:`var = k_2 =
|
||||
\frac{1}{n - 1} \sum_{i=1}^{n} (x_i - \bar{x})^2` is calculated.
|
||||
|
||||
For *stddev*, the Bessel-corrected sample standard deviation
|
||||
:math:`stddev = \sqrt{k_2}` is calculated.
|
||||
|
||||
For *skew*, the adjusted Fisher--Pearson standardized moment :math:`G_1
|
||||
= \frac{k_3}{k_2^{3/2}} = \frac{k_3}{stddev^3}` is calculated.
|
||||
|
||||
For *kurtosis*, the adjusted Fisher--Pearson standardized moment
|
||||
:math:`G_2 = \frac{k_4}{k_2^2}` is calculated.
|
||||
|
||||
----------
|
||||
|
||||
Fix invocation and output can be modified by optional keywords.
|
||||
|
||||
The *start* keyword specifies that the first computation should be no
|
||||
earlier than the step number given (but will still occur on a multiple
|
||||
of *Nfreq*). The default is step 0. Often input values can be 0.0 at
|
||||
time 0, so setting *start* to a larger value can avoid including a 0.0
|
||||
in a longer series.
|
||||
|
||||
The *history* keyword stores the Nrecent most recent outputs on Nfreq
|
||||
timesteps, so they can be accessed as global outputs of the fix. Nrecent
|
||||
must be >= 1. The default is 1, meaning only the most recent output is
|
||||
accessible. For example, if history 10 is specified and Nfreq = 1000,
|
||||
then on timestep 20000, the Nfreq outputs from steps 20000, 19000, ...
|
||||
11000 are available for access. See below for details on how to access
|
||||
the history values.
|
||||
|
||||
For example, this will store the outputs of the previous 10 Nfreq
|
||||
time steps, i.e. a window of 10000 time steps:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix 1 all ave/moments 1 200 1000 v_volume mean history 10
|
||||
|
||||
The previous results can be accessed as values in a global array output
|
||||
by this fix. Each column of the array is the vector output of the N-th
|
||||
preceding Nfreq timestep. For example, assuming a single moment is
|
||||
calculated, the most recent result corresponding to the third input
|
||||
value would be accessed as "f_name[3][1]", "f_name[3][4]" is the 4th
|
||||
most recent and so on. The current vector output is always the first
|
||||
column of the array, corresponding to the most recent result.
|
||||
|
||||
To illustrate the utility of keeping output history, consider using
|
||||
this fix in conjunction with :doc:`fix halt <fix_halt>` to stop a run
|
||||
automatically if a quantity is converged to within some desired tolerance:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable target equal etot
|
||||
fix aveg all ave/moments 1 200 1000 v_target mean stddev history 10
|
||||
variable stopcond equal "abs(f_aveg[1]-f_aveg[1][10])<f_aveg[2]"
|
||||
fix fhalt all halt 1000 v_stopcond == 1
|
||||
|
||||
In this example, every 1000 time steps, the average and standard
|
||||
deviation of the total energy over the previous 200 time steps are
|
||||
calculated. If the difference between the most recent and 10-th most
|
||||
recent average is lower than the most recent standard deviation, the run
|
||||
is stopped.
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about this fix is written to :doc:`binary restart files
|
||||
<restart>`.
|
||||
|
||||
This fix produces a global vector and global array which can be accessed
|
||||
by various :doc:`output commands <Howto_output>`. The values can be
|
||||
accessed on any time step, but may not be current.
|
||||
|
||||
A global vector is produced with the # of elements = number of moments *
|
||||
number of inputs. The moments are output in the order given in the fix
|
||||
definition. An array is produced having # of rows = length of vector
|
||||
output (with an ordering which matches the vector) and # of columns =
|
||||
value of *history*. There is always at least one column.
|
||||
|
||||
Each element of the global vector or array can be either "intensive" or
|
||||
"extensive", depending on whether the values contributing to the element
|
||||
are "intensive" or "extensive". If a compute or fix provides the value
|
||||
being time averaged, then the compute or fix determines whether the value
|
||||
is intensive or extensive; see the page for that compute or fix for
|
||||
further info. Values produced by a variable are treated as intensive.
|
||||
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This compute is part of the EXTRA-FIX package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix ave/time <fix_ave_time>`,
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
The option defaults are history = 1, start = 0.
|
||||
|
||||
----------
|
||||
|
||||
.. _Cramer1:
|
||||
|
||||
**(Cramer)** Cramer, Mathematical Methods of Statistics, Princeton University Press (1946).
|
||||
|
||||
.. _Joanes1:
|
||||
|
||||
**(Joanes)** Joanes, Gill, The Statistician, 47, 183--189 (1998).
|
||||
@ -98,52 +98,53 @@ the following dynamic equation:
|
||||
|
||||
\frac{dc}{dt} = -\alpha (K_p e + K_i \int_0^t e \, dt + K_d \frac{de}{dt} )
|
||||
|
||||
where *c* is the continuous time analog of the control variable,
|
||||
*e* =\ *pvar*\ -\ *setpoint* is the error in the process variable, and
|
||||
:math:`\alpha`, :math:`K_p`, :math:`K_i` , and :math:`K_d` are constants
|
||||
set by the corresponding
|
||||
keywords described above. The discretized version of this equation is:
|
||||
where *c* is the continuous time analog of the control variable, *e*
|
||||
=\ *pvar*\ -\ *setpoint* is the error in the process variable, and
|
||||
:math:`\alpha`, :math:`K_p`, :math:`K_i` , and :math:`K_d` are
|
||||
constants set by the corresponding keywords described above. The
|
||||
discretized version of this equation is:
|
||||
|
||||
.. math::
|
||||
|
||||
c_n = c_{n-1} -\alpha \left( K_p \tau e_n + K_i \tau^2 \sum_{i=1}^n e_i + K_d (e_n - e_{n-1}) \right)
|
||||
|
||||
where :math:`\tau = \mathtt{Nevery} \cdot \mathtt{timestep}` is the time
|
||||
interval between updates,
|
||||
and the subscripted variables indicate the values of *c* and *e* at
|
||||
successive updates.
|
||||
where :math:`\tau = \mathtt{Nevery} \cdot \mathtt{timestep}` is the
|
||||
time interval between updates, and the subscripted variables indicate
|
||||
the values of *c* and *e* at successive updates.
|
||||
|
||||
From the first equation, it is clear that if the three gain values
|
||||
:math:`K_p`, :math:`K_i`, :math:`K_d` are dimensionless constants,
|
||||
then :math:`\alpha` must have
|
||||
units of [unit *cvar*\ ]/[unit *pvar*\ ]/[unit time] e.g. [ eV/K/ps
|
||||
]. The advantage of this unit scheme is that the value of the
|
||||
constants should be invariant under a change of either the MD timestep
|
||||
size or the value of *Nevery*\ . Similarly, if the LAMMPS :doc:`unit style <units>` is changed, it should only be necessary to change
|
||||
the value of :math:`\alpha` to reflect this, while leaving :math:`K_p`,
|
||||
:math:`K_i`, and :math:`K_d` unaltered.
|
||||
then :math:`\alpha` must have units of [unit *cvar*\ ]/[unit *pvar*\
|
||||
]/[unit time] e.g. [ eV/K/ps ]. The advantage of this unit scheme is
|
||||
that the value of the constants should be invariant under a change of
|
||||
either the MD timestep size or the value of *Nevery*\ . Similarly, if
|
||||
the LAMMPS :doc:`unit style <units>` is changed, it should only be
|
||||
necessary to change the value of :math:`\alpha` to reflect this, while
|
||||
leaving :math:`K_p`, :math:`K_i`, and :math:`K_d` unaltered.
|
||||
|
||||
When choosing the values of the four constants, it is best to first
|
||||
pick a value and sign for :math:`\alpha` that is consistent with the
|
||||
magnitudes and signs of *pvar* and *cvar*\ . The magnitude of :math:`K_p`
|
||||
should then be tested over a large positive range keeping :math:`K_i = K_d =0`.
|
||||
A good value for :math:`K_p` will produce a fast response in *pvar*,
|
||||
without overshooting the *setpoint*\ . For many applications, proportional
|
||||
feedback is sufficient, and so :math:`K_i = K_d =0` can be used. In cases
|
||||
where there is a substantial lag time in the response of *pvar* to a change
|
||||
in *cvar*, this can be counteracted by increasing :math:`K_d`. In situations
|
||||
magnitudes and signs of *pvar* and *cvar*\ . The magnitude of
|
||||
:math:`K_p` should then be tested over a large positive range keeping
|
||||
:math:`K_i = K_d =0`. A good value for :math:`K_p` will produce a
|
||||
fast response in *pvar*, without overshooting the *setpoint*\ . For
|
||||
many applications, proportional feedback is sufficient, and so
|
||||
:math:`K_i = K_d =0` can be used. In cases where there is a
|
||||
substantial lag time in the response of *pvar* to a change in *cvar*,
|
||||
this can be counteracted by increasing :math:`K_d`. In situations
|
||||
where *pvar* plateaus without reaching *setpoint*, this can be
|
||||
counteracted by increasing :math:`K_i`. In the language of Charles Dickens,
|
||||
:math:`K_p` represents the error of the present, :math:`K_i` the error of
|
||||
the past, and :math:`K_d` the error yet to come.
|
||||
counteracted by increasing :math:`K_i`. In the language of Charles
|
||||
Dickens, :math:`K_p` represents the error of the present, :math:`K_i`
|
||||
the error of the past, and :math:`K_d` the error yet to come.
|
||||
|
||||
Because this fix updates *cvar*, but does not initialize its value,
|
||||
the initial value :math:`c_0` is that assigned by the user in the input script via
|
||||
the :doc:`internal-style variable <variable>` command. This value is
|
||||
used (by every other LAMMPS command that uses the variable) until this
|
||||
fix performs its first update of *cvar* after *Nevery* timesteps. On
|
||||
the first update, the value of the derivative term is set to zero,
|
||||
because the value of :math:`e_{n-1}` is not yet defined.
|
||||
the initial value :math:`c_0` is that assigned by the user in the
|
||||
input script via the :doc:`internal-style variable <variable>`
|
||||
command. This value is used (by every other LAMMPS command that uses
|
||||
the variable) until this fix performs its first update of *cvar* after
|
||||
*Nevery* timesteps. On the first update, the value of the derivative
|
||||
term is set to zero, because the value of :math:`e_{n-1}` is not yet
|
||||
defined.
|
||||
|
||||
----------
|
||||
|
||||
@ -154,21 +155,23 @@ must produce a global quantity, not a per-atom or local quantity.
|
||||
|
||||
If *pvar* begins with "c\_", a compute ID must follow which has been
|
||||
previously defined in the input script and which generates a global
|
||||
scalar or vector. See the individual :doc:`compute <compute>` doc page
|
||||
for details. If no bracketed integer is appended, the scalar
|
||||
scalar or vector. See the individual :doc:`compute <compute>` doc
|
||||
page for details. If no bracketed integer is appended, the scalar
|
||||
calculated by the compute is used. If a bracketed integer is
|
||||
appended, the Ith value of the vector calculated by the compute is
|
||||
used. Users can also write code for their own compute styles and :doc:`add them to LAMMPS <Modify>`.
|
||||
used. Users can also write code for their own compute styles and
|
||||
:doc:`add them to LAMMPS <Modify>`.
|
||||
|
||||
If *pvar* begins with "f\_", a fix ID must follow which has been
|
||||
previously defined in the input script and which generates a global
|
||||
scalar or vector. See the individual :doc:`fix <fix>` page for
|
||||
details. Note that some fixes only produce their values on certain
|
||||
timesteps, which must be compatible with when fix controller
|
||||
references the values, or else an error results. If no bracketed integer
|
||||
is appended, the scalar calculated by the fix is used. If a bracketed
|
||||
integer is appended, the Ith value of the vector calculated by the fix
|
||||
is used. Users can also write code for their own fix style and :doc:`add them to LAMMPS <Modify>`.
|
||||
references the values, or else an error results. If no bracketed
|
||||
integer is appended, the scalar calculated by the fix is used. If a
|
||||
bracketed integer is appended, the Ith value of the vector calculated
|
||||
by the fix is used. Users can also write code for their own fix style
|
||||
and :doc:`add them to LAMMPS <Modify>`.
|
||||
|
||||
If *pvar* begins with "v\_", a variable name must follow which has been
|
||||
previously defined in the input script. Only equal-style variables
|
||||
@ -182,19 +185,21 @@ variable.
|
||||
The target value *setpoint* for the process variable must be a numeric
|
||||
value, in whatever units *pvar* is defined for.
|
||||
|
||||
The control variable *cvar* must be the name of an :doc:`internal-style variable <variable>` previously defined in the input script. Note
|
||||
that it is not specified with a "v\_" prefix, just the name of the
|
||||
variable. It must be an internal-style variable, because this fix
|
||||
updates its value directly. Note that other commands can use an
|
||||
equal-style versus internal-style variable interchangeably.
|
||||
The control variable *cvar* must be the name of an
|
||||
:doc:`internal-style variable <variable>` previously defined in the
|
||||
input script. Note that it is not specified with a "v\_" prefix, just
|
||||
the name of the variable. It must be an internal-style variable,
|
||||
because this fix updates its value directly. Note that other commands
|
||||
can use an equal-style versus internal-style variable interchangeably.
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Currently, no information about this fix is written to :doc:`binary restart files <restart>`. None of the :doc:`fix_modify <fix_modify>` options
|
||||
are relevant to this fix.
|
||||
Currently, no information about this fix is written to :doc:`binary
|
||||
restart files <restart>`. None of the :doc:`fix_modify <fix_modify>`
|
||||
options are relevant to this fix.
|
||||
|
||||
This fix produces a global vector with 3 values which can be accessed
|
||||
by various :doc:`output commands <Howto_output>`. The values can be
|
||||
@ -211,7 +216,8 @@ variable is in. The vector values calculated by this fix are
|
||||
"extensive".
|
||||
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
@ -298,7 +298,8 @@ Note that it should return the "change" in box length, not the
|
||||
absolute box length. This means it should evaluate to 0.0 when
|
||||
invoked on the initial timestep of the run following the definition of
|
||||
fix deform. It should evaluate to a value > 0.0 to dilate the box at
|
||||
future times, or a value < 0.0 to compress the box.
|
||||
future times, or a value < 0.0 to compress the box. The exception
|
||||
would be if the run command uses the *pre no* option.
|
||||
|
||||
The variable *name2* must also be an :doc:`equal-style variable
|
||||
<variable>` and should calculate the rate of box length change, in
|
||||
|
||||
@ -225,22 +225,25 @@ rotated configuration of the molecule.
|
||||
|
||||
.. versionadded:: 21Nov2023
|
||||
|
||||
The *var* and *set* keywords can be used together to provide a criterion
|
||||
for accepting or rejecting the addition of an individual atom, based on its
|
||||
coordinates. The *name* specified for the *var* keyword is the name of an
|
||||
:doc:`equal-style variable <variable>` that should evaluate to a zero or
|
||||
non-zero value based on one or two or three variables that will store the
|
||||
*x*, *y*, or *z* coordinates of an atom (one variable per coordinate). If
|
||||
used, these other variables must be :doc:`internal-style variables
|
||||
<variable>` defined in the input script; their initial numeric value can be
|
||||
anything. They must be internal-style variables, because this command
|
||||
resets their values directly. The *set* keyword is used to identify the
|
||||
names of these other variables, one variable for the *x*-coordinate of a
|
||||
created atom, one for *y*, and one for *z*. When an atom is created, its
|
||||
:math:`(x,y,z)` coordinates become the values for any *set* variable that
|
||||
is defined. The *var* variable is then evaluated. If the returned value
|
||||
is 0.0, the atom is not created. If it is non-zero, the atom is created.
|
||||
For an example of how to use these keywords, see the
|
||||
The *var* and *set* keywords can be used together to provide a
|
||||
criterion for accepting or rejecting the addition of an individual
|
||||
atom, based on its coordinates. The *name* specified for the *var*
|
||||
keyword is the name of an :doc:`equal-style variable <variable>` that
|
||||
should evaluate to a zero or non-zero value based on one or two or
|
||||
three variables that will store the *x*, *y*, or *z* coordinates of an
|
||||
atom (one variable per coordinate). If used, these other variables
|
||||
must be :doc:`internal-style variables <variable>` specified by the
|
||||
*set* keyword. They must be internal-style variables, because this
|
||||
command resets their values directly. The internal-style variables do
|
||||
not need to be defined in the input script (though they can be); if
|
||||
one (or more) is not defined, then the *set* option creates an
|
||||
:doc:`internal-style variable <variable>` with the specified name.
|
||||
|
||||
When an atom is about to be created, its :math:`(x,y,z)` coordinates
|
||||
become the values for any *set* variable that is defined. The *var*
|
||||
variable is then evaluated. If the returned value is 0.0, the atom is
|
||||
not created. If it is non-zero, the atom is created. For an example
|
||||
of how to use the set/var keywords in a similar context, see the
|
||||
:doc:`create_atoms <create_atoms>` command.
|
||||
|
||||
The *rate* option moves the insertion volume in the z direction (3d)
|
||||
@ -304,12 +307,13 @@ units of distance or velocity.
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This fix writes the state of the deposition to :doc:`binary restart files <restart>`. This includes information about how many
|
||||
particles have been deposited, the random number generator seed, the
|
||||
next timestep for deposition, etc. See the
|
||||
:doc:`read_restart <read_restart>` command for info on how to re-specify
|
||||
a fix in an input script that reads a restart file, so that the
|
||||
operation of the fix continues in an uninterrupted fashion.
|
||||
This fix writes the state of the deposition to :doc:`binary restart
|
||||
files <restart>`. This includes information about how many particles
|
||||
have been deposited, the random number generator seed, the next
|
||||
timestep for deposition, etc. See the :doc:`read_restart
|
||||
<read_restart>` command for info on how to re-specify a fix in an
|
||||
input script that reads a restart file, so that the operation of the
|
||||
fix continues in an uninterrupted fashion.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@ -39,10 +39,11 @@ Examples
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
Apply a Langevin thermostat as described in :ref:`(Gronbech-Jensen-2020) <Gronbech-Jensen-2020>`
|
||||
to a group of atoms which models an interaction with a background
|
||||
implicit solvent. As described in the papers cited below, the GJ methods
|
||||
implicit solvent. As described in the papers cited below, the GJ methods
|
||||
provide exact diffusion, drift, and Boltzmann sampling for linear systems for
|
||||
any time step within the stability limit. The purpose of this set of methods
|
||||
is therefore to significantly improve statistical accuracy at longer time steps
|
||||
|
||||
262
doc/src/fix_lambda_apip.rst
Normal file
262
doc/src/fix_lambda_apip.rst
Normal file
@ -0,0 +1,262 @@
|
||||
.. index:: fix lambda/apip
|
||||
|
||||
fix lambda/apip command
|
||||
=======================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID lambda/apip thr_lo thr_hi keyword args ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* lambda/apip = style name of this fix command
|
||||
* thr_lo = value below which :math:`\lambda_i^\text{input}` results in a switching parameter of 1
|
||||
* thr_hi = value above which :math:`\lambda_i^\text{input}` results in a switching parameter of 0
|
||||
* zero or one keyword/args pairs may be appended
|
||||
* keyword = *time_averaged_zone* or *min_delta_lambda* or *lambda_non_group* or *store_atomic_stats* or *dump_atomic_history* or *group_fast* or *group_precise* or *group_ignore_lambda_input*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*time_averaged_zone* args = cut_lo cut_hi history_len_lambda_input history_len_lambda
|
||||
cut_lo = distance at which the radial function decreases from 1
|
||||
cut_hi = distance from which on the radial function is 0
|
||||
history_len_lambda_input = number of time steps for which lambda_input is averaged
|
||||
history_len_lambda = number of time steps for which the switching parameter is averaged
|
||||
*min_delta_lambda* args = delta
|
||||
delta = value below which changes of the switching parameter are neglected (>= 0)
|
||||
*lambda_non_group* args = lambda_ng
|
||||
lambda_ng = *precise* or *fast* or float
|
||||
*precise* = assign a constant switching parameter of 0 to atoms, that are not in the group specified by group-ID
|
||||
*fast* = assign a constant switching parameter of 1 to atoms, that are not in the group specified by group-ID
|
||||
float = assign this constant switching parameter to atoms, that are not in the group specified by group-ID (0 <= float <= 1)
|
||||
*group_fast* args = group-ID-fast
|
||||
group-ID-fast = the switching parameter of 1 is used instead of the one computed by lambda_input for atoms in the group specified by group-ID-fast
|
||||
*group_precise* args = group-ID-precise
|
||||
group-ID-precise = the switching parameter of 0 is used instead of the one computed by lambda_input for atoms in the group specified by group-ID-precise
|
||||
*group_ignore_lambda_input* args = group-ID-ignore-lambda-input
|
||||
group-ID-ignore-lambda-input = the switching parameter of lambda_ng is used instead of the one computed by lambda_input for atoms in the group specified by group-ID-ignore-lambda-input
|
||||
*store_atomic_stats* args = none
|
||||
*dump_atomic_history* args = none
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix 2 all lambda/apip 3.0 3.5 time_averaged_zone 4.0 12.0 110 110 min_delta_lambda 0.01
|
||||
fix 2 mobile lambda/apip 3.0 3.5 time_averaged_zone 4.0 12.0 110 110 min_delta_lambda 0.01 group_ignore_lambda_input immobile lambda_non_group fast
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
The potential energy :math:`E_i` of an atom :math:`i` of an adaptive-precision
|
||||
potential according to :ref:`(Immel) <Immel2025_3>` is given by
|
||||
|
||||
.. math::
|
||||
|
||||
E_i = \lambda_i E_i^\text{(fast)} + (1-\lambda_i) E_i^\text{(precise)},
|
||||
|
||||
whereas :math:`E_i^\text{(fast)}` is the potential energy of atom :math:`i`
|
||||
according to a fast interatomic potential like EAM,
|
||||
:math:`E_i^\text{(precise)}` is the potential energy according to a precise
|
||||
interatomic potential such as ACE and :math:`\lambda_i\in[0,1]` is the
|
||||
switching parameter that decides which potential energy is used.
|
||||
This fix calculates the switching parameter :math:`\lambda_i` based on the
|
||||
input provided from :doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`.
|
||||
|
||||
The calculation of the switching parameter is described in detail in
|
||||
:ref:`(Immel) <Immel2025_3>`.
|
||||
This fix calculates the switching parameter for all atoms in the
|
||||
:doc:`group <group>`
|
||||
described by group-ID, while the value of *lambda_non_group* is used
|
||||
as switching parameter for all other atoms.
|
||||
|
||||
First, this fix calculates per atom :math:`i` the time averaged input
|
||||
:math:`\lambda^\text{input}_{\text{avg},i}` from
|
||||
:math:`\lambda^\text{input}_{i}`, whereas the number of averaged timesteps
|
||||
can be set via *time_averaged_zone*.
|
||||
|
||||
.. note::
|
||||
|
||||
:math:`\lambda^\text{input}_{i}` is calculated by
|
||||
:doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`, which needs to be included
|
||||
in the input script as well.
|
||||
|
||||
The time averaged input :math:`\lambda^\text{input}_{\text{avg},i}` is then
|
||||
used to calculate the switching parameter
|
||||
|
||||
.. math::
|
||||
|
||||
\lambda_{0,i}(t) = f^\text{(cut)} \left(\frac{\lambda_{\text{avg},i}^\text{input}(t) - \lambda_\text{lo}^\text{input}}{\lambda_\text{hi}^\text{input} - \lambda_\text{lo}^\text{input}} \right)\,,
|
||||
|
||||
whereas the thresholds :math:`\lambda_\text{hi}^\text{input}`
|
||||
and :math:`\lambda_\text{lo}^\text{input}` are set by the
|
||||
values provided as *thr_lo* and *thr_hi* and :math:`f^\text{(cut)}(x)` is a cutoff function
|
||||
that is 1 for :math:`x\leq 0`, decays from 1 to 0 for :math:`x\in[0,1]`, and
|
||||
is 0 for :math:`x\geq 1`.
|
||||
If the *group_precise* argument is used, :math:`\lambda_{0,i}=0` is used for all
|
||||
atoms :math:`i` assigned to the corresponding :doc:`group <group>`.
|
||||
If the *group_fast* argument is used, :math:`\lambda_{0,i}=1` is used for all
|
||||
atoms :math:`i` assigned to the corresponding :doc:`group <group>`.
|
||||
If an atom is in the groups *group_fast* and *group_precise*,
|
||||
:math:`\lambda_{0,i}=0` is used.
|
||||
If the *group_ignore_lambda_input* argument is used,
|
||||
:math:`\lambda_i^\text{input}` is not computed for all atoms :math:`i` assigned
|
||||
to the corresponding :doc:`group <group>`; instead, if the value is not already
|
||||
set by *group_fast* or *group_precise*, the value of *lambda_non_group* is
|
||||
used.
|
||||
|
||||
.. note::
|
||||
|
||||
The computation of :math:`\lambda_i^\text{input}` is not required for
|
||||
atoms that are in the groups *group_fast* and *group_precise*.
|
||||
Thus, one should use *group_ignore_lambda_input* and prevent the
|
||||
computation of :math:`\lambda_i^\text{input}` for all atoms, for
|
||||
which a constant input is used.
|
||||
|
||||
A spatial transition zone between the fast and the precise potential is
|
||||
introduced via
|
||||
|
||||
.. math::
|
||||
|
||||
\lambda_{\text{min},i}(t) = \text{min}\left(\left\{1 - (1 -\lambda_{0,j}(t)) f^\text{(cut)}\left(\frac{r_{ij}(t)-r_{\lambda,\text{lo}}}{r_{\lambda,\text{hi}} - r_{\lambda,\text{lo}}}\right) : j \in \Omega_{\lambda,i} \right\}\right)\,,
|
||||
|
||||
whereas the thresholds :math:`r_{\lambda,\text{lo}}` and
|
||||
:math:`r_{\lambda,\text{hi}}`
|
||||
of the cutoff function are set via *time_averaged_zone* and
|
||||
:math:`\Omega_{\lambda,i}` is the set of
|
||||
neighboring atoms of atom :math:`i`.
|
||||
|
||||
.. note::
|
||||
|
||||
:math:`\lambda_{\text{min},i}` is calculated by
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`, which needs to be included
|
||||
in the input script as well.
|
||||
|
||||
The switching parameter is smoothed by the calculation of the time average
|
||||
|
||||
.. math::
|
||||
|
||||
\lambda_{\text{avg},i}(t) = \frac{1}{N_{\lambda,\text{avg}}} \sum_{n=1}^{N_{\lambda,\text{avg}}} \lambda_{\text{min},i}(t - n \Delta t)\,,
|
||||
|
||||
whereas :math:`\Delta t` is the :doc:`timestep <timestep>` and
|
||||
:math:`N_{\lambda,\text{avg}}` is the number of averaged timesteps, that
|
||||
can be set via *time_averaged_zone*.
|
||||
|
||||
Finally, numerical fluctuations of the switching parameter are suppressed by the usage of
|
||||
|
||||
.. math::
|
||||
|
||||
\lambda_{i}(t) = \left\{
|
||||
\begin{array}{ll}
|
||||
\lambda_{\text{avg},i}(t) & \text{ for } \left|\lambda_{\text{avg},i}(t) - \lambda_{i}(t-\Delta t)\right|\geq \Delta\lambda_\text{min} \text{ or } \lambda_{\text{avg},i}(t)\in\{0,1\}, \\
|
||||
\lambda_{i}(t-\Delta t) & \text{ otherwise}\,,
|
||||
\end{array}
|
||||
\right.
|
||||
|
||||
whereas the minimum change :math:`\Delta\lambda_\text{min}` is set by the
|
||||
*min_delta_lambda* argument.
|
||||
|
||||
.. note::
|
||||
|
||||
*group_fast* affects only :math:`\lambda_{0,i}(t)`. The switching parameter
|
||||
of atoms in this :doc:`group <group>` may change due to the calculation of the
|
||||
spatial switching zone.
|
||||
A switching parameter of 1 can be enforced by excluding the corresponding
|
||||
atoms from the :doc:`group <group>` described by group-ID and using *lambda_non_group* 1
|
||||
as argument.
|
||||
|
||||
----------
|
||||
|
||||
A code example for the calculation of the switching parameter for an
|
||||
adaptive-precision potential is given in the following:
|
||||
The adaptive-precision potential is created
|
||||
by combining :doc:`pair_style eam/fs/apip <pair_eam_apip>`
|
||||
and :doc:`pair_style pace/precise/apip <pair_pace_apip>`.
|
||||
The input, from which the switching parameter is calculated, is provided
|
||||
by :doc:`pair lambda/input/csp/apip <pair_lambda_input_apip>`.
|
||||
The switching parameter is calculated by this fix, whereas the spatial
|
||||
transition zone of the switching parameter is calculated by
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style hybrid/overlay eam/fs/apip pace/precise/apip lambda/input/csp/apip fcc cutoff 5.0 lambda/zone/apip 12.0
|
||||
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
|
||||
pair_coeff * * pace/precise/apip Cu_precise.yace Cu
|
||||
pair_coeff * * lambda/input/csp/apip
|
||||
pair_coeff * * lambda/zone/apip
|
||||
fix 2 all lambda/apip 3.0 3.5 time_averaged_zone 4.0 12.0 110 110 min_delta_lambda 0.01
|
||||
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
The saved history of the switching parameter :math:`\lambda_i`
|
||||
and the saved history of
|
||||
:math:`\lambda_i^\text{input}` are written to
|
||||
:doc:`binary restart files <restart>` allow a smooth restart of a simulation.
|
||||
None of the :doc:`fix_modify <fix_modify>` options are relevant to this fix.
|
||||
|
||||
If the *store_atomic_stats* argument is used, basic statistics is provided as
|
||||
per-atom array:
|
||||
|
||||
#. :math:`\lambda_i^\text{input}(t)`
|
||||
#. :math:`\lambda_{\text{avg},i}^\text{input}(t)`
|
||||
#. :math:`\lambda_{0,i}(t)`
|
||||
#. :math:`\lambda_{\text{min},i}(t)`
|
||||
#. :math:`\lambda_{i}(t)`
|
||||
|
||||
If the *dump_atomic_history* argument is used, the whole saved history
|
||||
of :math:`\lambda_i^\text{input}(t)` is appended to the previously
|
||||
mentioned array per atom.
|
||||
|
||||
The per-atom vector can be accessed by various
|
||||
:doc:`output commands <Howto_output>`.
|
||||
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This fix is part of the APIP package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`,
|
||||
:doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`,
|
||||
:doc:`pair_style eam/apip <pair_eam_apip>`,
|
||||
:doc:`pair_style pace/apip <pair_pace_apip>`,
|
||||
:doc:`fix atom_weight/apip <fix_atom_weight_apip>`
|
||||
:doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>`,
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
*min_delta_lambda* = 0,
|
||||
*lambda_non_group* = 1,
|
||||
*cut_lo* = 4.0,
|
||||
*cut_hi* = 12.0,
|
||||
*history_len_lambda_input* = 100,
|
||||
*history_len_lambda* = 100,
|
||||
*store_atomic_stats* is not used,
|
||||
*dump_atomic_history* is not used,
|
||||
*group_fast* is not used,
|
||||
*group_precise* is not used,
|
||||
*group_ignore_lambda_input* is not used
|
||||
|
||||
----------
|
||||
|
||||
.. _Immel2025_3:
|
||||
|
||||
**(Immel)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)
|
||||
176
doc/src/fix_lambda_thermostat_apip.rst
Normal file
176
doc/src/fix_lambda_thermostat_apip.rst
Normal file
@ -0,0 +1,176 @@
|
||||
.. index:: fix lambda_thermostat/apip
|
||||
|
||||
fix lambda_thermostat/apip command
|
||||
==================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID lambda_thermostat/apip keyword values ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* lambda_thermostat/apip = style name of this fix command
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *seed* or *store_atomic_forces* or *N_rescaling*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*seed* value = integer
|
||||
integer = integer that is used as seed for the random number generator (> 0)
|
||||
*store_atomic_forces* value = nevery
|
||||
nevery = provide per-atom output every this many steps
|
||||
*N_rescaling* value = groupsize
|
||||
groupsize = rescale this many neighboring atoms (> 1)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix 2 all lambda_thermostat/apip
|
||||
fix 2 all lambda_thermostat/apip N_rescaling 100
|
||||
fix 2 all lambda_thermostat/apip seed 42
|
||||
fix 2 all lambda_thermostat/apip seed 42 store_atomic_forces 1000
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
This command applies the local thermostat described in
|
||||
:ref:`(Immel) <Immel2025_4>`
|
||||
to conserve the energy when the switching parameters of an
|
||||
:doc:`adaptive-precision interatomic potential <Howto_apip>` (APIP)
|
||||
are updated while the gradient
|
||||
of the switching parameter is neglected in the force calculation.
|
||||
|
||||
.. warning::
|
||||
|
||||
The temperature change caused by this fix is only the means to the end of
|
||||
conserving the energy. Thus, this fix is not a classical thermostat, that
|
||||
ensures a given temperature in the system.
|
||||
All available thermostats are listed :doc:`here <Howto_thermostat>`.
|
||||
|
||||
The potential energy :math:`E_i` of an atom :math:`i` is given by the formula from
|
||||
:ref:`(Immel) <Immel2025_4>`
|
||||
|
||||
.. math::
|
||||
|
||||
E_i = \lambda_i E_i^\text{(fast)} + (1-\lambda_i) E_i^\text{(precise)},
|
||||
|
||||
whereas :math:`E_i^\text{(fast)}` is the potential energy of atom :math:`i`
|
||||
according to a fast interatomic potential like EAM,
|
||||
:math:`E_i^\text{(precise)}` is the potential energy according to a precise
|
||||
interatomic potential such as ACE and :math:`\lambda_i\in[0,1]` is the
|
||||
switching parameter that decides which potential energy is used.
|
||||
This potential energy and the corresponding forces are conservative when
|
||||
the switching parameter :math:`\lambda_i` is constant in time for all atoms
|
||||
:math:`i`.
|
||||
|
||||
For a conservative force calculation and dynamic switching parameters,
|
||||
the atomic force on an atom is given by
|
||||
:math:`F_i = -\nabla_i \sum_j E_j` and includes the derivative of the switching
|
||||
parameter :math:`\lambda_i`.
|
||||
The force contribution of this gradient of the switching function can cause
|
||||
large forces which are not similar to the forces of the fast or the precise
|
||||
interatomic potential as discussed in :ref:`(Immel) <Immel2025_4>`.
|
||||
Thus, one can neglect the gradient of the switching parameter in the force
|
||||
calculation and compensate for the violation of energy conservation by
|
||||
the application of the local thermostat implemented in this fix.
|
||||
One can compute the violation of the energy conservation :math:`\Delta H_i`
|
||||
for all atoms :math:`i` as discussed in :ref:`(Immel) <Immel2025_4>`.
|
||||
To locally correct this energy violation :math:`\Delta H_i`, one
|
||||
can rescale the velocity of atom :math:`i` and of neighboring atoms.
|
||||
The rescaling is done relative to the center-of-mass velocity of the
|
||||
group and, thus, conserves the momentum.
|
||||
|
||||
.. note::
|
||||
|
||||
This local thermostat provides the NVE ensemble rather than the NVT
|
||||
ensemble as
|
||||
the energy :math:`\Delta H_i` determines the rescaling factor rather than
|
||||
a temperature.
|
||||
|
||||
Velocities :math:`v` are updated by the integrator according to
|
||||
:math:`\Delta v_i = (F_i/m_i)\Delta t`, whereas `m` denotes the mass of atom
|
||||
:math:`i` and :math:`\Delta t` is the time step.
|
||||
One can interpret the velocity difference :math:`\Delta v` caused by the
|
||||
rescaling as the application of an additional force which is given by
|
||||
:math:`F^\text{lt}_i = (v^\text{unscaled}_i - v^\text{rescaled}_i) m_i
|
||||
/ \Delta t` :ref:`(Immel) <Immel2025_4>`.
|
||||
This additional force is computed when the *store_atomic_forces* option
|
||||
is used.
|
||||
|
||||
The local thermostat is not appropriate for simulations at a temperature of 0K.
|
||||
|
||||
.. note::
|
||||
|
||||
The maximum decrease of the kinetic energy is achieved with a rescaling
|
||||
factor of 0, i.e., the relative velocity of the group of rescaled atoms
|
||||
is set to zero. One cannot decrease the energy further. Thus, the
|
||||
local thermostat can fail, which is, however, reported by the returned
|
||||
vector.
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about this fix is written to
|
||||
:doc:`binary restart files <restart>`. None of the
|
||||
:doc:`fix_modify <fix_modify>` options are relevant to this fix.
|
||||
|
||||
If the *store_atomic_forces* option is used, this fix produces every
|
||||
*nevery* time steps a per-atom array that contains the theoretical force
|
||||
applied by the local thermostat in all three spatial dimensions in the first
|
||||
three components. :math:`\Delta H_i` is the fourth component of the per-atom
|
||||
array.
|
||||
The per-atom array can only be accessed on timesteps that are multiples
|
||||
of *nevery*.
|
||||
|
||||
Furthermore, this fix computes a global vector of length 6 with
|
||||
information about the rescaling:
|
||||
|
||||
#. number of atoms whose energy changed due to the last :math:`\lambda` update
|
||||
#. contribution of the potential energy to the last computed :math:`\Delta H`
|
||||
#. contribution of the kinetic energy to the last computed :math:`\Delta H`
|
||||
#. sum over all atoms of the absolute energy change caused by the last rescaling step
|
||||
#. energy change that could not be compensated accumulated over all timesteps
|
||||
#. number of atoms whose energy change could not be compensated accumulated over all timesteps
|
||||
|
||||
The vector and the per-atom vector can be accessed by various
|
||||
:doc:`output commands <Howto_output>`.
|
||||
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This fix is part of the APIP package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>`,
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`,
|
||||
:doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`,
|
||||
:doc:`pair_style eam/apip <pair_eam_apip>`,
|
||||
:doc:`pair_style pace/apip <pair_pace_apip>`,
|
||||
:doc:`fix atom_weight/apip <fix_atom_weight_apip>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
seed = 42, N_rescaling = 200, *store_atomic_forces* is not used
|
||||
|
||||
----------
|
||||
|
||||
.. _Immel2025_4:
|
||||
|
||||
**(Immel)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)
|
||||
@ -37,18 +37,18 @@ Examples
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
.. versionadded:: 19Nov2024
|
||||
.. versionadded:: 2Apr2025
|
||||
|
||||
This fix implements the QEqR method for charge equilibration, which
|
||||
differs from the QEq charge equilibration method :ref:`(Rappe and
|
||||
Goddard) <Rappe4>` only in how external electric fields are accounted
|
||||
for. This fix therefore raises a warning when used without :doc:`fix
|
||||
efield <fix_efield>` since :doc:`fix qeq/reaxff <fix_qeq_reaxff>` should
|
||||
be used without an external electric field. Charges are computed with
|
||||
the QEqR method by minimizing the electrostatic energy of the system in
|
||||
the same way as the QEq method but where the absolute electronegativity,
|
||||
:math:`\chi_i`, of each atom in the QEq method is replaced with an
|
||||
effective electronegativity given by
|
||||
This fix implements the QEqR method :ref:`(Lalli) <lalli2>` for charge
|
||||
equilibration, which differs from the QEq charge equilibration method
|
||||
:ref:`(Rappe and Goddard) <Rappe4>` only in how external electric fields
|
||||
are accounted for. This fix therefore raises a warning when used without
|
||||
:doc:`fix efield <fix_efield>` since :doc:`fix qeq/reaxff <fix_qeq_reaxff>`
|
||||
should be used when no external electric field is present. Charges are
|
||||
computed with the QEqR method by minimizing the electrostatic energy of
|
||||
the system in the same way as the QEq method but where the absolute
|
||||
electronegativity, :math:`\chi_i`, of each atom in the QEq method is
|
||||
replaced with an effective electronegativity given by
|
||||
|
||||
.. math::
|
||||
\chi_{\mathrm{r}i} = \chi_i + \frac{\sum_{j=1}^{N} \beta(\phi_i - \phi_j) S_{ij}}
|
||||
@ -61,8 +61,9 @@ external electric field and :math:`S_{ij}` is the overlap integral
|
||||
between atoms :math:`i` and :math:`j`. This formulation is advantageous
|
||||
over the method used by :doc:`fix qeq/reaxff <fix_qeq_reaxff>` to
|
||||
account for an external electric field in that it permits periodic
|
||||
boundaries in the direction of an external electric field and in that it
|
||||
does not worsen long-range charge transfer seen with QEq.
|
||||
boundaries in the direction of an external electric field and in
|
||||
that it does not worsen long-range charge transfer seen with
|
||||
QEq. See :ref:`Lalli <lalli2>` for further details.
|
||||
|
||||
This fix is typically used in conjunction with the ReaxFF force field
|
||||
model as implemented in the :doc:`pair_style reaxff <pair_reaxff>`
|
||||
@ -184,6 +185,10 @@ scale = 1.0 and maxiter = 200
|
||||
|
||||
----------
|
||||
|
||||
.. _lalli2:
|
||||
|
||||
**(Lalli)** Lalli and Giusti, Journal of Chemical Physics, 162, 174311 (2025).
|
||||
|
||||
.. _Rappe4:
|
||||
|
||||
**(Rappe)** Rappe and Goddard III, Journal of Physical Chemistry, 95,
|
||||
|
||||
@ -59,8 +59,7 @@ and atom :math:`j`.
|
||||
The effect of an external electric field can be incorporated into the QTPIE
|
||||
method by modifying the absolute or effective electronegativities of each
|
||||
atom :ref:`(Chen) <qtpie-Chen>`. This fix models the effect of an external
|
||||
electric field by using the effective electronegativity given in
|
||||
:ref:`(Gergs) <Gergs>`:
|
||||
electric field by using the effective electronegativity :ref:`(Lalli) <lalli>`
|
||||
|
||||
.. math::
|
||||
\tilde{\chi}_{\mathrm{r}i} = \frac{\sum_{j=1}^{N} (\chi_i - \chi_j + \beta(\phi_i - \phi_j)) S_{ij}}
|
||||
@ -68,7 +67,8 @@ electric field by using the effective electronegativity given in
|
||||
|
||||
where :math:`\beta` is a scaling factor and :math:`\phi_i` and :math:`\phi_j`
|
||||
are the electric potentials at the positions of atoms :math:`i` and :math:`j`
|
||||
due to the external electric field.
|
||||
due to the external electric field. Additional details regarding the
|
||||
implementation and performance of this fix are provided in :ref:`Lalli <lalli>`.
|
||||
|
||||
This fix is typically used in conjunction with the ReaxFF force
|
||||
field model as implemented in the :doc:`pair_style reaxff <pair_reaxff>`
|
||||
@ -206,10 +206,9 @@ scale = 1.0 and maxiter = 200
|
||||
**(Chen)** Chen, Jiahao. Theory and applications of fluctuating-charge models.
|
||||
University of Illinois at Urbana-Champaign, 2009.
|
||||
|
||||
.. _Gergs:
|
||||
.. _lalli:
|
||||
|
||||
**(Gergs)** Gergs, Dirkmann and Mussenbrock.
|
||||
Journal of Applied Physics 123.24 (2018).
|
||||
**(Lalli)** Lalli and Giusti, Journal of Chemical Physics, 162, 174311 (2025).
|
||||
|
||||
.. _qeq-Aktulga2:
|
||||
|
||||
|
||||
175
doc/src/fix_set.rst
Normal file
175
doc/src/fix_set.rst
Normal file
@ -0,0 +1,175 @@
|
||||
.. index:: fix set
|
||||
|
||||
fix set command
|
||||
===============
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID set Nfreq rnflag set-args
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* set = style name of this fix command
|
||||
* Nfreq = reset per-atom properties every this many timesteps
|
||||
* rnflag = 1 to reneighbor on next timestep, 0 to not
|
||||
* set-args = identical to args for the :doc:`set <set>` command
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix 10 all set 1 0 group all i_dump v_new
|
||||
fix 10 all set 1 0 group all i_dump v_turnoff
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
Reset one or more properties of one or more atoms once every *Nfreq*
|
||||
steps during a simulation.
|
||||
|
||||
If the *rnflag* for reneighboring is set to 1, then a reneighboring
|
||||
will be triggered on the next timestep (since the fix set operation
|
||||
occurs at the end of the current timestep). This is important to do
|
||||
if this command changes per-atom properties that need to be
|
||||
communicated to ghost atoms. If this is not the case, an *rnflag*
|
||||
setting of 0 can be used; reneighboring will only be triggered on
|
||||
subsequent timesteps by the usual neighbor list criteria; see the
|
||||
:doc:`neigh_modify command <neigh_modify>`.
|
||||
|
||||
Here are two examples where an *rnflag* setting of 1 are needed. If a
|
||||
custom per-atom property is changed and the :doc:`fix property/atom
|
||||
<fix_property_atom>` command to create the property used the *ghost
|
||||
yes* keyword. Or if per-atom charges are changed, all pair styles
|
||||
which compute Coulombic interactions require charge values for ghost
|
||||
atoms. In both these examples, the re-neighboring will trigger the
|
||||
changes in the owned atom properties to be immediately communicated to
|
||||
ghost atoms.
|
||||
|
||||
The arguments following *Nfreq* and *rnflag* are identical to those
|
||||
allowed for the :doc:`set <set>` command, as in the examples above and
|
||||
below.
|
||||
|
||||
Note that the group-ID setting for this command is ignored. The
|
||||
syntax for the :doc:`set <set>` arguments allows selection of which
|
||||
atoms have their properties reset.
|
||||
|
||||
This command can only be used to reset an atom property using a
|
||||
per-atom variable. This option in allowed by many, but not all, of
|
||||
the keyword/value pairs supported by the :doc:`set <set>` command.
|
||||
The reason for this restriction is that if a per-atom variable is not
|
||||
used, this command will typically not change atom properties during
|
||||
the simulation.
|
||||
|
||||
The :doc:`set <set>` command can be used with similar syntax to this
|
||||
command to reset atom properties once before or between simulations.
|
||||
|
||||
----------
|
||||
|
||||
Here is an example of input script commands which will output atoms
|
||||
into a dump file only when their x-velocity crosses a threshold value
|
||||
*vthresh* for the first time. Their position and x-velocity will then
|
||||
be output every step for *twindow* timesteps.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable vthresh equal 2 # threshold velocity
|
||||
variable twindow equal 10 # dump for this many steps
|
||||
#
|
||||
# define custom property i_dump to store timestep threshold is crossed
|
||||
#
|
||||
fix 2 all property/atom i_dump
|
||||
set group all i_dump -1
|
||||
#
|
||||
# fix set command checks for threshold crossings every step
|
||||
# resets i_dump from -1 to current timestep when crossing occurs
|
||||
#
|
||||
variable start atom "vx > v_vthresh && i_dump == -1"
|
||||
variable new atom ternary(v_start,step,i_dump)
|
||||
fix 3 all set 1 0 group all i_dump v_new
|
||||
#
|
||||
# dump command with thresh which enforces twindow
|
||||
#
|
||||
dump 1 all custom 1 tmp.dump id x y vx i_dump
|
||||
variable dumpflag atom "i_dump >= 0 && (step-i_dump) < v_twindow"
|
||||
dump_modify 1 thresh v_dumpflag == 1
|
||||
#
|
||||
# run the simulation
|
||||
# final dump with all atom IDs which crossed threshold on which timestep
|
||||
#
|
||||
run 1000
|
||||
write_dump all custom tmp.dump.final id i_dump modify thresh i_dump >= 0
|
||||
|
||||
The tmp.dump.final file lists which atoms crossed the velocity
|
||||
threshold. This command will print the *twindow* timesteps when a
|
||||
specific atom ID (104 in this case) was output in the tmp.dump file:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
% grep "^104 " tmp.dump
|
||||
|
||||
If these commands are used instead of the above, then an atom can
|
||||
cross the velocity threshold multiple times, and will be output for
|
||||
*twindow* timesteps each time. However the write_dump command is no
|
||||
longer useful.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable vthresh equal 2 # threshold velocity
|
||||
variable twindow equal 10 # dump for this many steps
|
||||
#
|
||||
# define custom property i_dump to store timestep threshold is crossed
|
||||
#
|
||||
fix 2 all property/atom i_dump
|
||||
set group all i_dump -1
|
||||
#
|
||||
# fix set command checks for threshold crossings every step
|
||||
# resets i_dump from -1 to current timestep when crossing occurs
|
||||
#
|
||||
variable start atom "vx > v_vthresh && i_dump == -1"
|
||||
variable turnon atom ternary(v_start,step,i_dump)
|
||||
variable stop atom "v_turnon >= 0 && (step-v_turnon) < v_twindow"
|
||||
variable turnoff atom ternary(v_stop,v_turnon,-1)
|
||||
fix 3 all set 1 0 group all i_dump v_turnoff
|
||||
#
|
||||
# dump command with thresh which enforces twindow
|
||||
#
|
||||
dump 1 all custom 1 tmp.dump id x y vx i_dump
|
||||
variable dumpflag atom "i_dump >= 0 && (step-i_dump) < v_twindow"
|
||||
dump_modify 1 thresh v_dumpflag == 1
|
||||
#
|
||||
# run the simulation
|
||||
#
|
||||
run 1000
|
||||
|
||||
----------
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about this fix is written to :doc:`binary restart files
|
||||
<restart>`. None of the :doc:`fix_modify <fix_modify>` options are
|
||||
relevant to this fix. No global or per-atom quantities are stored by
|
||||
this fix for access by various :doc:`output commands <Howto_output>`.
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
none
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`set <set>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
@ -32,6 +32,7 @@
|
||||
.. index:: kspace_style msm/cg/omp
|
||||
.. index:: kspace_style msm/dielectric
|
||||
.. index:: kspace_style scafacos
|
||||
.. index:: kspace_style zero
|
||||
|
||||
kspace_style command
|
||||
====================
|
||||
@ -43,7 +44,7 @@ Syntax
|
||||
|
||||
kspace_style style value
|
||||
|
||||
* style = *none* or *ewald* or *ewald/dipole* or *ewald/dipole/spin* or *ewald/disp* or *ewald/disp/dipole* or *ewald/omp* or *ewald/electrode* or *pppm* or *pppm/cg* or *pppm/disp* or *pppm/tip4p* or *pppm/stagger* or *pppm/disp/tip4p* or *pppm/gpu* or *pppm/intel* or *pppm/disp/intel* or *pppm/kk* or *pppm/omp* or *pppm/cg/omp* or *pppm/disp/tip4p/omp* or *pppm/tip4p/omp* or *pppm/dielectic* or *pppm/disp/dielectric* or *pppm/electrode* or *pppm/electrode/intel* or *msm* or *msm/cg* or *msm/omp* or *msm/cg/omp* or *msm/dielectric* or *scafacos*
|
||||
* style = *none* or *ewald* or *ewald/dipole* or *ewald/dipole/spin* or *ewald/disp* or *ewald/disp/dipole* or *ewald/omp* or *ewald/electrode* or *pppm* or *pppm/cg* or *pppm/disp* or *pppm/tip4p* or *pppm/stagger* or *pppm/disp/tip4p* or *pppm/gpu* or *pppm/intel* or *pppm/disp/intel* or *pppm/kk* or *pppm/omp* or *pppm/cg/omp* or *pppm/disp/tip4p/omp* or *pppm/tip4p/omp* or *pppm/dielectic* or *pppm/disp/dielectric* or *pppm/electrode* or *pppm/electrode/intel* or *msm* or *msm/cg* or *msm/omp* or *msm/cg/omp* or *msm/dielectric* or *scafacos* or *zero*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -121,6 +122,7 @@ Syntax
|
||||
*scafacos* values = method accuracy
|
||||
method = fmm or p2nfft or p3m or ewald or direct
|
||||
accuracy = desired relative error in forces
|
||||
*zero* value = none
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -132,6 +134,7 @@ Examples
|
||||
kspace_style msm 1.0e-4
|
||||
kspace_style scafacos fmm 1.0e-4
|
||||
kspace_style none
|
||||
kspace_style zero
|
||||
|
||||
Used in input scripts:
|
||||
|
||||
@ -375,6 +378,13 @@ other ScaFaCoS options currently exposed to LAMMPS.
|
||||
|
||||
----------
|
||||
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
The *zero* style does not do any calculations, but is compatible
|
||||
with all pair styles that require some version of a kspace style.
|
||||
|
||||
----------
|
||||
|
||||
The specified *accuracy* determines the relative RMS error in per-atom
|
||||
forces calculated by the long-range solver. It is set as a
|
||||
dimensionless number, relative to the force that two unit point
|
||||
|
||||
@ -34,7 +34,7 @@ Syntax
|
||||
*ioff* value = Ioff
|
||||
Ioff = offset to add to improper types
|
||||
*scale* value = sfactor
|
||||
sfactor = scale factor to apply to the size and mass of the molecule
|
||||
sfactor = scale factor to apply to the size, mass, and dipole of the molecule
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -42,6 +42,7 @@ Examples
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
molecule 1 mymol.txt
|
||||
molecule water tip3p.json
|
||||
molecule 1 co2.txt h2o.txt
|
||||
molecule CO2 co2.txt boff 3 aoff 2
|
||||
molecule 1 mymol.txt offset 6 9 18 23 14
|
||||
@ -65,7 +66,7 @@ templates include:
|
||||
* :doc:`atom_style template <atom_style>`
|
||||
|
||||
The ID of a molecule template can only contain alphanumeric characters
|
||||
and underscores.
|
||||
and underscores, same as other IDs in LAMMPS.
|
||||
|
||||
A single template can contain multiple molecules, listed one per file.
|
||||
Some of the commands listed above currently use only the first
|
||||
@ -74,6 +75,13 @@ contains multiple molecules. The :doc:`atom_style template
|
||||
<atom_style>` command allows multiple-molecule templates to define a
|
||||
system with more than one templated molecule.
|
||||
|
||||
The molecule file can be either in a *native* format or in `JSON format
|
||||
<https://www.json.org/>`_. JSON formal filenames **must** have the
|
||||
extension ".json". Files with any other name will be assumed to be in
|
||||
the "native" format. The details of the two formats are described
|
||||
below. When referencing multiple molecule files in a single *molecule*
|
||||
command, each of those files may be either format.
|
||||
|
||||
Each filename can be followed by optional keywords which are applied
|
||||
only to the molecule in the file as used in this template. This is to
|
||||
make it easy to use the same molecule file in different molecule
|
||||
@ -95,40 +103,45 @@ use that attribute (e.g. no bonds).
|
||||
labels will determine the actual types directly depending on the
|
||||
current :doc:`labelmap <labelmap>` settings.
|
||||
|
||||
The *scale* keyword scales the size of the molecule. This can be
|
||||
useful for modeling polydisperse granular rigid bodies. The scale
|
||||
factor is applied to each of these properties in the molecule file, if
|
||||
they are defined: the individual particle coordinates (Coords
|
||||
section), the individual mass of each particle (Masses section), the
|
||||
individual diameters of each particle (Diameters section), the total
|
||||
mass of the molecule (header keyword = mass), the center-of-mass of
|
||||
the molecule (header keyword = com), and the moments of inertia of the
|
||||
molecule (header keyword = inertia).
|
||||
The *scale* keyword scales the size of the molecule. This can be useful
|
||||
for modeling polydisperse granular rigid bodies. The scale factor is
|
||||
applied to each of these properties in the molecule file, if they are
|
||||
defined: the individual particle coordinates (Coords or "coords"
|
||||
section), the individual mass of each particle (Masses or "masses"
|
||||
section), the individual diameters of each particle (Diameters or
|
||||
"diameters" section), the per-atom dipoles (Dipoles or "dipoles"
|
||||
section) the total mass of the molecule (header keyword = mass), the
|
||||
center-of-mass of the molecule (header keyword = com), and the moments
|
||||
of inertia of the molecule (header keyword = inertia).
|
||||
|
||||
.. note::
|
||||
|
||||
The molecule command can be used to define molecules with bonds,
|
||||
angles, dihedrals, impropers, or special bond lists of neighbors
|
||||
angles, dihedrals, impropers, and special bond lists of neighbors
|
||||
within a molecular topology, so that you can later add the molecules
|
||||
to your simulation, via one or more of the commands listed above.
|
||||
Since this topology-related information requires that suitable storage
|
||||
is reserved when LAMMPS creates the simulation box (e.g. when using
|
||||
the :doc:`create_box <create_box>` command or the
|
||||
:doc:`read_data <read_data>` command) suitable space has to be reserved
|
||||
so you do not overflow those pre-allocated data structures when adding
|
||||
molecules later. Both the :doc:`create_box <create_box>` command and
|
||||
the :doc:`read_data <read_data>` command have "extra" options which
|
||||
ensure space is allocated for storing topology info for molecules that
|
||||
are added later.
|
||||
Since this topology-related information requires that suitable
|
||||
storage is reserved when LAMMPS creates the simulation box (e.g. when
|
||||
using the :doc:`create_box <create_box>` command or the
|
||||
:doc:`read_data <read_data>` command) suitable space has to be
|
||||
reserved at that step so you do not overflow those pre-allocated data
|
||||
structures when adding molecules later. Both the :doc:`create_box
|
||||
<create_box>` command and the :doc:`read_data <read_data>` command
|
||||
have "extra" options which ensure extra space is allocated for
|
||||
storing topology info for molecules that are added later. This
|
||||
feature is *not* available for the :doc:`read_restart command
|
||||
<read_restart>`, thus binary restart files need to be converted
|
||||
to data files first.
|
||||
|
||||
----------
|
||||
|
||||
Format of a molecule file
|
||||
"""""""""""""""""""""""""
|
||||
Format of a native molecule file
|
||||
""""""""""""""""""""""""""""""""
|
||||
|
||||
The format of an individual molecule file looks similar but is
|
||||
different than that of a data file read by the :doc:`read_data <read_data>`
|
||||
commands. Here is a simple example for a TIP3P water molecule:
|
||||
The format of an "native" individual molecule file looks similar but is
|
||||
*different* from that of a data file read by the :doc:`read_data
|
||||
<read_data>` commands. Here is a simple example for a TIP3P water
|
||||
molecule:
|
||||
|
||||
.. code-block::
|
||||
|
||||
@ -196,7 +209,7 @@ defining a *body* particle, which requires setting the number of
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 20 13 42 15
|
||||
:widths: 21 12 47 20
|
||||
|
||||
* - Number(s)
|
||||
- Keyword
|
||||
@ -205,7 +218,7 @@ defining a *body* particle, which requires setting the number of
|
||||
* - N
|
||||
- atoms
|
||||
- # of atoms N in molecule
|
||||
- 0
|
||||
- keyword is *required*
|
||||
* - Nb
|
||||
- bonds
|
||||
- # of bonds Nb in molecule
|
||||
@ -228,8 +241,8 @@ defining a *body* particle, which requires setting the number of
|
||||
- 0
|
||||
* - Ninteger Ndouble
|
||||
- body
|
||||
- # of integer and floating-point values in body particle
|
||||
- 0
|
||||
- # of integer and floating-point values in :doc:`body particle <Howto_body>`
|
||||
- 0 0
|
||||
* - Mtotal
|
||||
- mass
|
||||
- total mass of molecule
|
||||
@ -669,6 +682,343 @@ the file format.
|
||||
|
||||
----------
|
||||
|
||||
Format of a JSON molecule file
|
||||
""""""""""""""""""""""""""""""
|
||||
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
The format of a JSON format individual molecule file must follow the
|
||||
`JSON format <https://www.json.org/>`_, which evolved from the
|
||||
JavaScript programming language as a programming-language-neutral data
|
||||
interchange language. The JSON syntax is independent of its content,
|
||||
and thus the data in the file must follow suitable conventions to be
|
||||
correctly processed. LAMMPS provides a `JSON schema file
|
||||
<https://json-schema.org/>`_ for JSON format molecule files in the
|
||||
:ref:`tools/json folder <json>` to represent those conventions. Using
|
||||
the schema file any JSON format molecule files can be validated. Please
|
||||
note that the format requirement for JSON are very strict and the JSON
|
||||
reader in LAMMPS does not accept files with extensions like comments.
|
||||
Validating a particular JSON format molecule file against this schema
|
||||
ensures that both, the JSON syntax requirement *and* the LAMMPS
|
||||
conventions for molecule template files are followed. LAMMPS should be
|
||||
able to read and parse any JSON file that passes the schema check. This
|
||||
is a formal check only and thus it **cannot** check whether the file
|
||||
contents are consistent or physically meaningful.
|
||||
|
||||
Here is a simple example for the same TIP3P water molecule from above in
|
||||
JSON format and also using :doc:`type labels <labelmap>` instead of
|
||||
numeric types:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"application": "LAMMPS",
|
||||
"format": "molecule",
|
||||
"revision": 1,
|
||||
"title": "Water molecule. TIP3P geometry",
|
||||
"schema": "https://download.lammps.org/json/molecule-schema.json",
|
||||
"units": "real",
|
||||
"coords": {
|
||||
"format": ["atom-id", "x", "y", "z"],
|
||||
"data": [
|
||||
[1, 0.00000, -0.06556, 0.00000],
|
||||
[2, 0.75695, 0.52032, 0.00000],
|
||||
[3, -0.75695, 0.52032, 0.00000]
|
||||
]
|
||||
},
|
||||
"types": {
|
||||
"format": ["atom-id", "type"],
|
||||
"data": [
|
||||
[1, "OW"],
|
||||
[2, "HO1"],
|
||||
[3, "HO1"]
|
||||
]
|
||||
},
|
||||
"charges": {
|
||||
"format": ["atom-id", "charge"],
|
||||
"data": [
|
||||
[1, -0.834],
|
||||
[2, 0.417],
|
||||
[3, 0.417]
|
||||
]
|
||||
},
|
||||
"bonds": {
|
||||
"format": ["bond-type", "atom1", "atom2"],
|
||||
"data": [
|
||||
["OW-HO1", 1, 2],
|
||||
["OW-HO1", 1, 3]
|
||||
]
|
||||
},
|
||||
"angles": {
|
||||
"format": ["angle-type", "atom1", "atom2", "atom3"],
|
||||
"data": [
|
||||
["HO1-OW-HO1", 2, 1, 3]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Unlike with the native molecule file format, there are no header or body
|
||||
sections, just a list of keywords with associated data. JSON format
|
||||
data is read, parsed, and stored in an internal dictionary data
|
||||
structure in one step and thus the order of keywords is not relevant.
|
||||
|
||||
Data for keywords is either provided directly following the keyword or
|
||||
as a *data block*. A *data block* is a list that has to include two
|
||||
keywords, "format" and "data", where the former lists keywords of the
|
||||
properties that are stored in the columns of the "data" lists. The
|
||||
names and order of entries in the "format" list (and thus how the data
|
||||
is interpreted) are currently fixed.
|
||||
|
||||
Since the length of the various lists can be easily obtained from the
|
||||
internal data structure, several header keywords of the "native" molecule
|
||||
file are not needed. On the other hand, some additional keywords are
|
||||
required to identify the conventions applied to the generic JSON file
|
||||
format. The structure of the data itself mostly follows what is used
|
||||
for the "native" molecule file format.
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Keyword
|
||||
- Argument(s)
|
||||
- Required
|
||||
- Description
|
||||
* - application
|
||||
- "LAMMPS"
|
||||
- yes
|
||||
- indicates a LAMMPS JSON file; files from other applications may be accepted in the future
|
||||
* - format
|
||||
- "molecule"
|
||||
- yes
|
||||
- indicates a molecule template file
|
||||
* - revision
|
||||
- an integer
|
||||
- yes
|
||||
- currently 1, to facility backward compatibility on changes to the conventions
|
||||
* - title
|
||||
- a string
|
||||
- no
|
||||
- information about the template which will echoed to the screen and log
|
||||
* - schema
|
||||
- URL as string
|
||||
- no
|
||||
- location of a JSON schema file for validating the molecule file format
|
||||
* - units
|
||||
- a string
|
||||
- no
|
||||
- indicates :doc:`units settings <units>` for this molecule template
|
||||
* - com
|
||||
- list with 3 doubles
|
||||
- no
|
||||
- overrides the auto-computed center-of-mass for the template
|
||||
* - masstotal
|
||||
- double
|
||||
- no
|
||||
- overrides the auto-computed total mass for the template
|
||||
* - inertia
|
||||
- list with 6 doubles
|
||||
- no
|
||||
- overrides the auto-computed moments of inertia
|
||||
* - coords
|
||||
- a data block
|
||||
- no
|
||||
- contains atom positions with the format "atom-id", "x", "y", "z" (same as Coords)
|
||||
* - types
|
||||
- a data block
|
||||
- yes
|
||||
- assigns atom types to atoms with the format "atom-id", "type" (same as Types)
|
||||
* - molecule
|
||||
- a data block
|
||||
- no
|
||||
- assigns molecule-IDs to atoms with the format "atom-id", "molecule-id" (same as Molecules)
|
||||
* - fragments
|
||||
- a data block
|
||||
- no
|
||||
- assigns atom-ids to fragment-IDs with the format "fragment-id", "atom-id-list" (same as Fragments)
|
||||
* - charges
|
||||
- a data block
|
||||
- no
|
||||
- assigns charges to atoms with the format "atom-id", "charge" (same as Charges)
|
||||
* - dipoles
|
||||
- a data block
|
||||
- no
|
||||
- assigns point dipoles to atoms with the format "atom-id", "mux", "muy", "muz" (same as Dipoles)
|
||||
* - diameters
|
||||
- a data block
|
||||
- no
|
||||
- assigns diameters to atoms with the format "atom-id", "diameter" (same as Diameters)
|
||||
* - masses
|
||||
- a data block
|
||||
- no
|
||||
- assigns per-atom masses to atoms with the format "atom-id", "mass" (same as Masses)
|
||||
* - bonds
|
||||
- a data block
|
||||
- no
|
||||
- defines bonds in the molecule template with the format "bond-type", "atom1", "atom2" (same as Bonds without bond-ID)
|
||||
* - angles
|
||||
- a data block
|
||||
- no
|
||||
- defines angles in the molecule template with the format "angle-type", "atom1", "atom2", "atom3" (same as Angles without angle-ID)
|
||||
* - dihedrals
|
||||
- a data block
|
||||
- no
|
||||
- defines dihedrals in the molecule template with the format "dihedral-type", "atom1", "atom2", "atom3", "atom4" (same as Dihedrals without dihedral-ID)
|
||||
* - impropers
|
||||
- a data block
|
||||
- no
|
||||
- defines impropers in the molecule template with the format "improper-type", "atom1", "atom2", "atom3", "atom4" (same as Impropers without improper-ID)
|
||||
* - shake
|
||||
- 3 JSON objects
|
||||
- no
|
||||
- contains the sub-sections "flags", "atoms", "bonds" described below
|
||||
* - special
|
||||
- 2 JSON objects
|
||||
- no
|
||||
- contains the sub-sections "counts" and "bonds" described below
|
||||
* - body
|
||||
- 2 JSON objects
|
||||
- no
|
||||
- contains the "integers" and "doubles" sub-sections with arrays with the same data as Body Integers and Body Doubles, respectively
|
||||
|
||||
The following table describes the sub-sections for the "special" entry from above:
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Subsection
|
||||
- Argument(s)
|
||||
- Required
|
||||
- Description
|
||||
* - counts
|
||||
- a data block
|
||||
- yes
|
||||
- contains the counts of 1-2, 1-3, and 1-4 special neighbors with the format "atom-id", "n12", "n13", "n14" (same as Special Bond Counts)
|
||||
* - bonds
|
||||
- a data block
|
||||
- yes
|
||||
- contains the lists of special neighbors to atoms with the format "atom-id", "atom-id-list" (same as Special Bonds)
|
||||
|
||||
The following table describes the sub-sections for the "shake" entry from above:
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Subsection
|
||||
- Argument(s)
|
||||
- Required
|
||||
- Description
|
||||
* - flags
|
||||
- a data block
|
||||
- yes
|
||||
- contains the counts shake flags for atoms with the format "atom-id", "flag" (same as Shake Flags)
|
||||
* - atoms
|
||||
- a data block
|
||||
- yes
|
||||
- contains the lists of shake cluster atom-ids for atoms with the format "atom-id", "atom-id-list" (same as Shake Atoms)
|
||||
* - bonds
|
||||
- a data block
|
||||
- yes
|
||||
- contains the lists of shake bond or angle types for atoms with the format "atom-id", "type-list" (same as Shake Bonds)
|
||||
|
||||
The "special" and "shake" sections are usually not needed, since the
|
||||
data can be auto-generated as soon as the simulation box is defined.
|
||||
Below is an example for what would have to be *added* to the example
|
||||
JSON file above in case the molecule command needs to be issued earlier.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
"special": {
|
||||
"counts": {
|
||||
"format": ["atom-id", "n12", "n13", "n14"],
|
||||
"data": [
|
||||
[1, 2, 0, 0],
|
||||
[2, 1, 1, 0],
|
||||
[3, 1, 1, 0]
|
||||
]
|
||||
},
|
||||
"bonds": {
|
||||
"format": ["atom-id", "atom-id-list"],
|
||||
"data": [
|
||||
[1, [2, 3]],
|
||||
[2, [1, 3]],
|
||||
[3, [1, 2]]
|
||||
]
|
||||
}
|
||||
},
|
||||
"shake": {
|
||||
"flags": {
|
||||
"format": ["atom-id", "flag"],
|
||||
"data": [
|
||||
[1, 1],
|
||||
[2, 1],
|
||||
[3, 1]
|
||||
]
|
||||
},
|
||||
"atoms": {
|
||||
"format": ["atom-id", "atom-id-list"],
|
||||
"data": [
|
||||
[1, [1, 2, 3]],
|
||||
[2, [1, 2, 3]],
|
||||
[3, [1, 2, 3]]
|
||||
]
|
||||
},
|
||||
"types": {
|
||||
"format": ["atom-id", "type-list"],
|
||||
"data": [
|
||||
[1, ["OW-HO1", "OW-HO1", "HO1-OW-HO1"]],
|
||||
[2, ["OW-HO1", "OW-HO1", "HO1-OW-HO1"]],
|
||||
[3, ["OW-HO1", "OW-HO1", "HO1-OW-HO1"]]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Below is a minimal example of a JSON format molecule template for a body
|
||||
particle for :doc:`pair style body/nparticle
|
||||
<pair_body_nparticle>`. Molecule templates for body particles must
|
||||
contain only one atom:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"application": "LAMMPS",
|
||||
"format": "molecule",
|
||||
"revision": 1,
|
||||
"title": "Square body for body/nparticles",
|
||||
"schema": "https://download.lammps.org/json/molecule-schema.json",
|
||||
"units": "real",
|
||||
"coords": {
|
||||
"format": ["atom-id", "x", "y", "z"],
|
||||
"data": [
|
||||
[1, 0.00000, 0.00000, 0.00000]
|
||||
]
|
||||
},
|
||||
"types": {
|
||||
"format": ["atom-id", "type"],
|
||||
"data": [
|
||||
[1, 1]
|
||||
]
|
||||
},
|
||||
"masses": {
|
||||
"format": ["atom-id", "mass"],
|
||||
"data": [
|
||||
[1, 1.0]
|
||||
]
|
||||
},
|
||||
"body": {
|
||||
"integers": [4],
|
||||
"doubles": [
|
||||
1.0, 1.0, 4.0, 0.0, 0.0, 0.0,
|
||||
-0.70710678118654752440, -0.70710678118654752440, 0.0,
|
||||
-0.70710678118654752440, 0.70710678118654752440, 0.0,
|
||||
0.70710678118654752440, 0.70710678118654752440, 0.0,
|
||||
0.70710678118654752440, -0.70710678118654752440, 0.0
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
|
||||
127
doc/src/pair_eam_apip.rst
Normal file
127
doc/src/pair_eam_apip.rst
Normal file
@ -0,0 +1,127 @@
|
||||
.. index:: pair_style eam/apip
|
||||
.. index:: pair_style eam/fs/apip
|
||||
|
||||
pair_style eam/apip command
|
||||
=============================
|
||||
|
||||
Constant precision variant: *eam*
|
||||
|
||||
pair_style eam/fs/apip command
|
||||
================================
|
||||
|
||||
Constant precision variant: *eam/fs*
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style eam/apip
|
||||
pair_style eam/fs/apip
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style hybrid/overlay eam/fs/apip pace/precise/apip lambda/input/csp/apip fcc cutoff 5.0 lambda/zone/apip 12.0
|
||||
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
|
||||
pair_coeff * * pace/precise/apip Cu_precise.yace Cu
|
||||
pair_coeff * * lambda/input/csp/apip
|
||||
pair_coeff * * lambda/zone/apip
|
||||
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
Style *eam* computes pairwise interactions for metals and metal alloys
|
||||
using embedded-atom method (EAM) potentials :ref:`(Daw) <Daw2>`. The total
|
||||
energy :math:`E_i` of an atom :math:`i` is given by
|
||||
|
||||
.. math::
|
||||
|
||||
E_i^\text{EAM} = F_\alpha \left(\sum_{j \neq i}\ \rho_\beta (r_{ij})\right) +
|
||||
\frac{1}{2} \sum_{j \neq i} \phi_{\alpha\beta} (r_{ij})
|
||||
|
||||
where :math:`F` is the embedding energy which is a function of the atomic
|
||||
electron density :math:`\rho`, :math:`\phi` is a pair potential interaction,
|
||||
and :math:`\alpha` and :math:`\beta` are the element types of atoms
|
||||
:math:`i` and :math:`j`. The multi-body nature of the EAM potential is a
|
||||
result of the embedding energy term. Both summations in the formula are over
|
||||
all neighbors :math:`j` of atom :math:`i` within the cutoff distance.
|
||||
EAM is documented in detail in :doc:`pair_style eam <pair_eam>`.
|
||||
|
||||
The potential energy :math:`E_i` of an atom :math:`i` of an adaptive-precision
|
||||
interatomic potential (APIP) according to :ref:`(Immel) <Immel2025_5>` is given by
|
||||
|
||||
.. math::
|
||||
|
||||
E_i^\text{APIP} = \lambda_i E_i^\text{(fast)} + (1-\lambda_i) E_i^\text{(precise)}\,,
|
||||
|
||||
whereas the switching parameter :math:`\lambda_i` is computed
|
||||
dynamically during a simulation by :doc:`fix lambda/apip <fix_lambda_apip>`
|
||||
or set prior to a simulation via :doc:`set <set>`.
|
||||
|
||||
The pair style *eam/fs/apip* computes the potential energy
|
||||
:math:`\lambda_i E_i^\text{EAM}` and the
|
||||
corresponding force and should be combined
|
||||
with a precise potential like
|
||||
:doc:`pair_style pace/precise/apip <pair_pace_apip>` that computes the
|
||||
potential energy :math:`(1-\lambda_i) E_i^\text{(precise)}` and the
|
||||
corresponding force via :doc:`pair_style hybrid/overlay <pair_hybrid>`.
|
||||
|
||||
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 as
|
||||
described above with the individual styles. You never need to specify
|
||||
a pair_coeff command with I != J arguments for the eam/apip styles.
|
||||
|
||||
This pair style does not support the :doc:`pair_modify <pair_modify>`
|
||||
shift, table, and tail options.
|
||||
|
||||
The eam/apip pair styles do not write their information to :doc:`binary
|
||||
restart files <restart>`, since it is stored in tabulated potential
|
||||
files. Thus, you need to re-specify the pair_style and pair_coeff
|
||||
commands in an input script that reads a restart file.
|
||||
|
||||
The eam/apip 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
|
||||
""""""""""""
|
||||
|
||||
This pair styles are part of the APIP package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`pair_style eam <pair_eam>`,
|
||||
:doc:`pair_style hybrid/overlay <pair_hybrid>`,
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>`,
|
||||
:doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>`,
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`,
|
||||
:doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`,
|
||||
:doc:`pair_style pace/apip <pair_pace_apip>`,
|
||||
:doc:`fix atom_weight/apip <fix_atom_weight_apip>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
|
||||
----------
|
||||
|
||||
.. _Immel2025_5:
|
||||
|
||||
**(Immel)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)
|
||||
|
||||
.. _Daw2:
|
||||
|
||||
**(Daw)** Daw, Baskes, Phys Rev Lett, 50, 1285 (1983).
|
||||
Daw, Baskes, Phys Rev B, 29, 6443 (1984).
|
||||
@ -421,8 +421,8 @@ by specifying different integer values for the :math:`d_{type}` input parameter.
|
||||
damping option is only compatible with the normal *mdr* contact model.
|
||||
|
||||
Setting :math:`d_{type} = 1` is the suggested damping option. This specifies a damping
|
||||
model that takes into account the contact stiffness :math:`k_{mdr}` calulated
|
||||
by the normal *mdr* contact model to determine the damping coefficent:
|
||||
model that takes into account the contact stiffness :math:`k_{mdr}` calculated
|
||||
by the normal *mdr* contact model to determine the damping coefficient:
|
||||
|
||||
.. math::
|
||||
|
||||
@ -435,8 +435,8 @@ normal *mdr* contact model:
|
||||
|
||||
k_{mdr} = 2 E_{eff} a_{mdr}.
|
||||
|
||||
In this case, :math:`\eta_{n0}` is simply a dimensionless coefficent that scales the
|
||||
the overall damping coefficent.
|
||||
In this case, :math:`\eta_{n0}` is simply a dimensionless coefficient that scales the
|
||||
the overall damping coefficient.
|
||||
|
||||
The other supported option is :math:`d_{type} = 2`, which defines a simple damping model
|
||||
similar to the *velocity* option
|
||||
|
||||
@ -100,6 +100,56 @@ first is assigned to intra-molecular interactions (i.e. both atoms
|
||||
have the same molecule ID), the second to inter-molecular interactions
|
||||
(i.e. interacting atoms have different molecule IDs).
|
||||
|
||||
.. admonition:: When **NOT** to use a hybrid pair style
|
||||
:class: warning
|
||||
|
||||
Using pair style *hybrid* can be very tempting to use if you need a
|
||||
**many-body potential** supporting a mix of elements for which you
|
||||
cannot find a potential file that covers *all* of them. Regardless
|
||||
of how this is set up, there will be *errors*. The major use case
|
||||
where the error is *small*, is when the many-body sub-styles are used
|
||||
on different objects (for example a slab and a liquid, a metal and a
|
||||
nano-machining work piece). In that case the *mixed* terms
|
||||
**should** be provided by a pair-wise additive potential (like
|
||||
Lennard-Jones or Morse) to avoid unexpected behavior and reduce
|
||||
errors. LAMMPS cannot easily check for this condition and thus will
|
||||
accept good and bad choices alike.
|
||||
|
||||
Outside of this, we *strongly* recommend *against* using pair style
|
||||
hybrid with many-body potentials for the following reasons:
|
||||
|
||||
1. When trying to combine EAM or MEAM potentials, there is a *large*
|
||||
error in the embedding term, since it is computed separately for
|
||||
each sub-style only.
|
||||
|
||||
2. When trying to combine many-body potentials like Stillinger-Weber,
|
||||
Tersoff, AIREBO, Vashishta, or similar, you have to understand
|
||||
that the potential of a sub-style cannot be applied in a pair-wise
|
||||
fashion but will need to be applied to multiples of atoms
|
||||
(e.g. a Tersoff potential of elements A and B includes the
|
||||
interactions A-A, B-B, A-B, A-A-A, A-A-B, A-B-B, A-B-A, B-A-A,
|
||||
B-A-B, B-B-A, B-B-B; AIREBO also considers all quadruples of
|
||||
atom elements).
|
||||
|
||||
3. When one of the sub-styles uses charge-equilibration (= QEq; like
|
||||
in ReaxFF or COMB) you have inconsistent QEq behavior because
|
||||
either you try to apply QEq to *all* atoms but then you are
|
||||
missing the QEq parameters for the non-QEq pair style (and it
|
||||
would be inconsistent to apply QEq for pair styles that are not
|
||||
parameterized for QEq) or else you would have either no charges or
|
||||
fixed charges interacting with the QEq which also leads to
|
||||
inconsistent behavior between two sub-styles. When attempting to
|
||||
use multiple ReaxFF instances to combine different potential
|
||||
files, you might be able to work around the QEq limitations, but
|
||||
point 2. still applies.
|
||||
|
||||
We understand that it is frustrating to not be able to run simulations
|
||||
due to lack of available potential files, but that does not justify
|
||||
combining potentials in a broken way via pair style hybrid. This is
|
||||
not what the hybrid pair styles are designed for.
|
||||
|
||||
----------
|
||||
|
||||
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
|
||||
@ -374,12 +424,11 @@ selected sub-style.
|
||||
|
||||
----------
|
||||
|
||||
.. note::
|
||||
|
||||
Several of the potentials defined via the pair_style command in
|
||||
LAMMPS are really many-body potentials, such as Tersoff, AIREBO, MEAM,
|
||||
ReaxFF, etc. The way to think about using these potentials in a
|
||||
hybrid setting is as follows.
|
||||
Even though the command name "pair_style" would suggest that these are
|
||||
pair-wise interactions, several of the potentials defined via the
|
||||
pair_style command in LAMMPS are really many-body potentials, such as
|
||||
Tersoff, AIREBO, MEAM, ReaxFF, etc. The way to think about using these
|
||||
potentials in a hybrid setting is as follows.
|
||||
|
||||
A subset of atom types is assigned to the many-body potential with a
|
||||
single :doc:`pair_coeff <pair_coeff>` command, using "\* \*" to include
|
||||
|
||||
151
doc/src/pair_lambda_input_apip.rst
Normal file
151
doc/src/pair_lambda_input_apip.rst
Normal file
@ -0,0 +1,151 @@
|
||||
.. index:: pair_style lambda/input/apip
|
||||
.. index:: pair_style lambda/input/csp/apip
|
||||
|
||||
pair_style lambda/input/apip command
|
||||
====================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style lambda/input/apip cutoff
|
||||
|
||||
* lambda/input/apip = style name of this pair style
|
||||
* cutoff = global cutoff (distance units)
|
||||
|
||||
pair_style lambda/input/csp/apip command
|
||||
========================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style lambda/input/csp/apip lattice keyword args
|
||||
|
||||
* lambda/input/csp/apip = style name of this pair style
|
||||
* lattice = *fcc* or *bcc* or integer
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*fcc* = use 12 nearest neighbors to calculate the CSP like in a perfect fcc lattice
|
||||
*bcc* = use 8 nearest neighbors to calculate the CSP like in a perfect bcc lattice
|
||||
integer = use N nearest neighbors to calculate the CSP
|
||||
|
||||
* zero or more keyword/args pairs may be appended
|
||||
* keyword = *cutoff* or *N_buffer*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*cutoff* args = cutoff
|
||||
cutoff = distance in which neighboring atoms are considered (> 0)
|
||||
*N_buffer* args = N_buffer
|
||||
N_buffer = number of additional neighbors, which are included in the j-j+N/2 calculation
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style lambda/input/csp/apip fcc
|
||||
pair_style lambda/input/csp/apip fcc cutoff 5.0
|
||||
pair_style lambda/input/csp/apip bcc cutoff 5.0 N_buffer 2
|
||||
pair_style lambda/input/csp/apip 14
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
This pair_styles calculates :math:`\lambda_i^\text{input}(t)`, which
|
||||
is required for :doc:`fix lambda/apip <fix_lambda_apip>`.
|
||||
|
||||
The pair_style lambda_input sets :math:`\lambda_i^\text{input}(t) = 0`.
|
||||
|
||||
The pair_style lambda_input/csp calculates
|
||||
:math:`\lambda_i^\text{input}(t) = \text{CSP}_i(t)`.
|
||||
The centro-symmetry parameter (CSP) :ref:`(Kelchner) <Kelchner_2>` is described
|
||||
in :doc:`compute centro/atom <compute_centro_atom>`.
|
||||
|
||||
The lattice argument is described in
|
||||
:doc:`compute centro/atom <compute_centro_atom>` and determines
|
||||
the number of neighboring atoms that are used to compute the CSP.
|
||||
The *N_buffer* argument allows to include more neighboring atoms in
|
||||
the calculation of the contributions from the pair j,j+N/2 to the CSP as
|
||||
discussed in :ref:`(Immel) <Immel2025_6>`.
|
||||
|
||||
The computation of :math:`\lambda_i^\text{input}(t)` is done by this
|
||||
pair_style instead of by :doc:`fix lambda/apip <fix_lambda_apip>`, as this computation
|
||||
takes time and this pair_style can be included in the load-balancing via
|
||||
:doc:`fix atom_weight/apip <fix_atom_weight_apip>`.
|
||||
|
||||
A code example for the calculation of the switching parameter for an adaptive-
|
||||
precision potential is given in the following:
|
||||
The adaptive-precision potential is created
|
||||
by combining :doc:`pair_style eam/fs/apip <pair_eam_apip>`
|
||||
and :doc:`pair_style pace/precise/apip <pair_pace_apip>`.
|
||||
The input, from which the switching parameter is calculated, is provided
|
||||
by this pair_style.
|
||||
The switching parameter is calculated by :doc:`fix lambda/apip <fix_lambda_apip>`,
|
||||
whereas the spatial
|
||||
transition zone of the switching parameter is calculated by
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style hybrid/overlay eam/fs/apip pace/precise/apip lambda/input/csp/apip fcc cutoff 5.0 lambda/zone/apip 12.0
|
||||
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
|
||||
pair_coeff * * pace/precise/apip Cu_precise.yace Cu
|
||||
pair_coeff * * lambda/input/csp/apip
|
||||
pair_coeff * * lambda/zone/apip
|
||||
fix 2 all lambda/apip 3.0 3.5 time_averaged_zone 4.0 12.0 110 110 min_delta_lambda 0.01
|
||||
|
||||
----------
|
||||
|
||||
Mixing, shift, table, tail correction, restart, rRESPA info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
The cutoff distance for this pair style can be mixed. The default mix
|
||||
value is *geometric*\ . See the "pair_modify" command for details.
|
||||
|
||||
This pair style does not support the :doc:`pair_modify <pair_modify>`
|
||||
shift, table, and tail options.
|
||||
|
||||
This pair style writes no information to :doc:`binary restart files <restart>`, so pair_style and pair_coeff commands need
|
||||
to be specified in an input script that reads a restart file.
|
||||
|
||||
This pair style does not support the use of the *inner*, *middle*,
|
||||
and *outer* keywords of the :doc:`run_style respa <run_style>` command.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
This fix is part of the APIP package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`compute centro/atom <compute_centro_atom>`,
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>`,
|
||||
:doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>`,
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`,
|
||||
:doc:`pair_style eam/apip <pair_eam_apip>`,
|
||||
:doc:`pair_style pace/apip <pair_pace_apip>`,
|
||||
:doc:`fix atom_weight/apip <fix_atom_weight_apip>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
N_buffer=0, cutoff=5.0
|
||||
|
||||
----------
|
||||
|
||||
.. _Kelchner_2:
|
||||
|
||||
**(Kelchner)** Kelchner, Plimpton, Hamilton, Phys Rev B, 58, 11085 (1998).
|
||||
|
||||
.. _Immel2025_6:
|
||||
|
||||
**(Immel)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)
|
||||
106
doc/src/pair_lambda_zone_apip.rst
Normal file
106
doc/src/pair_lambda_zone_apip.rst
Normal file
@ -0,0 +1,106 @@
|
||||
.. index:: pair_style lambda/zone/apip
|
||||
|
||||
pair_style lambda/zone/apip command
|
||||
===================================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style lambda/zone/apip cutoff
|
||||
|
||||
* lambda/zone/apip = style name of this pair style
|
||||
* cutoff = global cutoff (distance units)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style lambda/zone/apip 12.0
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
This pair_style calculates :math:`\lambda_{\text{min},i}`, which
|
||||
is required for :doc:`fix lambda/apip <fix_lambda_apip>`.
|
||||
The meaning of :math:`\lambda_{\text{min},i}` is documented in
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>`, as this pair_style is for use with
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>` only.
|
||||
|
||||
This pair_style requires only the global cutoff as argument.
|
||||
The remaining quantities, that are required to calculate
|
||||
:math:`\lambda_{\text{min},i}` are extracted from
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>` and, thus,
|
||||
do not need to be passed to this pair_style as arguments.
|
||||
|
||||
.. warning::
|
||||
|
||||
The cutoff given as argument to this pair style is only relevant for the
|
||||
neighbor list creation. The radii, which define :math:`r_{\lambda,\text{hi}}` and :math:`r_{\lambda,\text{lo}}` are defined by :doc:`fix lambda/apip <fix_lambda_apip>`.
|
||||
|
||||
The computation of :math:`\lambda_{\text{min},i}` is done by this
|
||||
pair_style instead of by :doc:`fix lambda/apip <fix_lambda_apip>`, as this computation
|
||||
takes time and this pair_style can be included in the load-balancing via
|
||||
:doc:`fix atom_weight/apip <fix_atom_weight_apip>`.
|
||||
|
||||
A code example for the calculation of the switching parameter for an
|
||||
adaptive-precision interatomic potential (APIP) is given in the following:
|
||||
The adaptive-precision potential is created
|
||||
by combining :doc:`pair_style eam/fs/apip <pair_eam_apip>`
|
||||
and :doc:`pair_style pace/precise/apip <pair_pace_apip>`.
|
||||
The input, from which the switching parameter is calculated, is provided
|
||||
by :doc:`pair lambda/input/csp/apip <pair_lambda_input_apip>`.
|
||||
The switching parameter is calculated by :doc:`fix lambda/apip <fix_lambda_apip>`,
|
||||
whereas the spatial transition zone of the switching parameter is calculated
|
||||
by this pair style.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style hybrid/overlay eam/fs/apip pace/precise/apip lambda/input/csp/apip fcc cutoff 5.0 lambda/zone/apip 12.0
|
||||
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
|
||||
pair_coeff * * pace/precise/apip Cu_precise.yace Cu
|
||||
pair_coeff * * lambda/input/csp/apip
|
||||
pair_coeff * * lambda/zone/apip
|
||||
fix 2 all lambda/apip 3.0 3.5 time_averaged_zone 4.0 12.0 110 110 min_delta_lambda 0.01
|
||||
|
||||
----------
|
||||
|
||||
Mixing, shift, table, tail correction, restart, rRESPA info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
The cutoff distance for this pair style can be mixed. The default mix
|
||||
value is *geometric*\ . See the "pair_modify" command for details.
|
||||
|
||||
This pair style does not support the :doc:`pair_modify <pair_modify>`
|
||||
shift, table, and tail options.
|
||||
|
||||
This pair style writes no information to :doc:`binary restart files <restart>`, so pair_style and pair_coeff commands need
|
||||
to be specified in an input script that reads a restart file.
|
||||
|
||||
This pair style does not support the use of the *inner*, *middle*,
|
||||
and *outer* keywords of the :doc:`run_style respa <run_style>` command.
|
||||
|
||||
----------
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
This fix is part of the APIP package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>`,
|
||||
:doc:`fix atom_weight/apip <fix_atom_weight_apip>`
|
||||
:doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`,
|
||||
:doc:`pair_style eam/apip <pair_eam_apip>`,
|
||||
:doc:`pair_style pace/apip <pair_pace_apip>`,
|
||||
:doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>`,
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
@ -27,7 +27,7 @@ Examples
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
.. versionadded:: TBD
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
Pair style *lj/pirani* computes pairwise interactions from an Improved
|
||||
Lennard-Jones (ILJ) potential according to :ref:`(Pirani) <Pirani>`.
|
||||
|
||||
@ -48,13 +48,19 @@ At the inner cutoff the force and its first derivative
|
||||
will match the non-smoothed LJ formula. At the outer cutoff the force
|
||||
and its first derivative will be 0.0. The inner cutoff cannot be 0.0.
|
||||
|
||||
Explicit expressions for the coefficients C1, C2, C3, C4, as well as the
|
||||
energy discontinuity at the cutoff can be found here :ref:`(Leoni_1) <Leoni_1>`
|
||||
and here :ref:`(Leoni_2) <Leoni_2>`
|
||||
|
||||
.. note::
|
||||
|
||||
this force smoothing causes the energy to be discontinuous both
|
||||
in its values and first derivative. This can lead to poor energy
|
||||
conservation and may require the use of a thermostat. Plot the energy
|
||||
and force resulting from this formula via the
|
||||
:doc:`pair_write <pair_write>` command to see the effect.
|
||||
conservation and may require the use of a thermostat. The energy
|
||||
value discontinuity can be eliminated by shifting the potential
|
||||
energy to be zero at the outer cutoff using the pair_modify shift
|
||||
option. With or without shifting, you can plot the resulting energy
|
||||
and force via the :doc:`pair_write <pair_write>` command to see the effect.
|
||||
|
||||
The following coefficients must be defined for each pair of atoms
|
||||
types via the :doc:`pair_coeff <pair_coeff>` command as in the examples
|
||||
@ -122,3 +128,14 @@ Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
|
||||
----------
|
||||
|
||||
.. _Leoni_1:
|
||||
|
||||
**(Leoni_1)** F. Leoni et al., Phys Rev Lett, 134, 128201 (2025).
|
||||
|
||||
.. _Leoni_2:
|
||||
|
||||
**(Leoni_2)** F. Leoni et al., Phys Rev Lett, 134, Supplementary Material (2025).
|
||||
|
||||
|
||||
147
doc/src/pair_pace_apip.rst
Normal file
147
doc/src/pair_pace_apip.rst
Normal file
@ -0,0 +1,147 @@
|
||||
.. index:: pair_style pace/apip
|
||||
.. index:: pair_style pace/fast/apip
|
||||
.. index:: pair_style pace/precise/apip
|
||||
|
||||
pair_style pace/apip command
|
||||
============================
|
||||
|
||||
pair_style pace/fast/apip command
|
||||
=================================
|
||||
|
||||
pair_style pace/precise/apip command
|
||||
====================================
|
||||
|
||||
Constant precision variant: *pace*
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style pace/apip ... keyword values ...
|
||||
pair_style pace/fast/apip ... keyword values ...
|
||||
pair_style pace/precise/apip ... keyword values ...
|
||||
|
||||
* one or more keyword/value pairs may be appended
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
keyword = keywords of :doc:`pair pace <pair_pace>`
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style hybrid/overlay pace/fast/apip pace/precise/apip lambda/input/csp/apip fcc cutoff 5.0 lambda/zone/apip 12.0
|
||||
pair_coeff * * pace/fast/apip Cu_fast.yace Cu
|
||||
pair_coeff * * pace/precise/apip Cu_precise.yace Cu
|
||||
pair_coeff * * lambda/input/csp/apip
|
||||
pair_coeff * * lambda/zone/apip
|
||||
|
||||
pair_style hybrid/overlay eam/fs/apip pace/precise/apip lambda/input/csp/apip fcc cutoff 5.0 lambda/zone/apip 12.0
|
||||
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
|
||||
pair_coeff * * pace/precise/apip Cu_precise.yace Cu
|
||||
pair_coeff * * lambda/input/csp/apip
|
||||
pair_coeff * * lambda/zone/apip
|
||||
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Pair style :doc:`pace <pair_pace>` computes interactions using the Atomic
|
||||
Cluster Expansion (ACE), which is a general expansion of the atomic energy in
|
||||
multi-body basis functions :ref:`(Drautz19) <Drautz2019_2>`. The *pace*
|
||||
pair style provides an efficient implementation that is described in
|
||||
this paper :ref:`(Lysogorskiy21) <Lysogorskiy20211_2>`.
|
||||
|
||||
The potential energy :math:`E_i` of an atom :math:`i` of an adaptive-precision
|
||||
interatomic potential (APIP) according to
|
||||
:ref:`(Immel25) <Immel2025_7>` is given by
|
||||
|
||||
.. math::
|
||||
|
||||
E_i^\text{APIP} = \lambda_i E_i^\text{(fast)} + (1-\lambda_i) E_i^\text{(precise)}\,,
|
||||
|
||||
whereas the switching parameter :math:`\lambda_i` is computed
|
||||
dynamically during a simulation by :doc:`fix lambda/apip <fix_lambda_apip>`
|
||||
or set prior to a simulation via :doc:`set <set>`.
|
||||
|
||||
The pair style *pace/precise/apip* computes the potential energy
|
||||
:math:`(1-\lambda_i) E_i^\text{(pace)}` and the
|
||||
corresponding force and should be combined
|
||||
with a fast potential that computes the potential energy
|
||||
:math:`\lambda_i E_i^\text{(fast)}` and the corresponding force
|
||||
via :doc:`pair_style hybrid/overlay <pair_hybrid>`.
|
||||
|
||||
The pair style *pace/fast/apip* computes the potential energy
|
||||
:math:`\lambda_i E_i^\text{(pace)}` and the
|
||||
corresponding force and should be combined
|
||||
with a precise potential that computes the potential energy
|
||||
:math:`(1-\lambda_i) E_i^\text{(precise)}` and the corresponding force
|
||||
via :doc:`pair_style hybrid/overlay <pair_hybrid>`.
|
||||
|
||||
The pair_styles *pace/fast/apip* and *pace/precise/apip*
|
||||
commands may be followed by the optional keywords of
|
||||
:doc:`pair_style pace <pair_pace>`, which are described
|
||||
:doc:`here <pair_pace>`.
|
||||
|
||||
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 styles does not support the :doc:`pair_modify <pair_modify>`
|
||||
shift, table, and tail options.
|
||||
|
||||
This pair styles 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 styles 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 styles are part of the APIP package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`pair_style pace <pair_pace>`,
|
||||
:doc:`pair_style hybrid/overlay <pair_hybrid>`,
|
||||
:doc:`fix lambda/apip <fix_lambda_apip>`,
|
||||
:doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>`,
|
||||
:doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`,
|
||||
:doc:`pair_style lambda/input/apip <pair_lambda_input_apip>`,
|
||||
:doc:`pair_style eam/apip <pair_eam_apip>`,
|
||||
:doc:`fix atom_weight/apip <fix_atom_weight_apip>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
See :doc:`pair_style pace <pair_pace>`.
|
||||
|
||||
----------
|
||||
|
||||
.. _Drautz2019_2:
|
||||
|
||||
**(Drautz19)** Drautz, Phys Rev B, 99, 014104 (2019).
|
||||
|
||||
.. _Lysogorskiy20211_2:
|
||||
|
||||
**(Lysogorskiy21)** Lysogorskiy, van der Oord, Bochkarev, Menon, Rinaldi, Hammerschmidt, Mrovec, Thompson, Csanyi, Ortner, Drautz, npj Comp Mat, 7, 97 (2021).
|
||||
|
||||
.. _Immel2025_7:
|
||||
|
||||
**(Immel25)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)
|
||||
@ -188,7 +188,9 @@ accelerated styles exist.
|
||||
* :doc:`eam/cd <pair_eam>` - concentration-dependent EAM
|
||||
* :doc:`eam/cd/old <pair_eam>` - older two-site model for concentration-dependent EAM
|
||||
* :doc:`eam/fs <pair_eam>` - Finnis-Sinclair EAM
|
||||
* :doc:`eam/fs/apip <pair_eam_apip>` - :doc:`adaptive precision <Howto_apip>` version of FS EAM, used as fast potential
|
||||
* :doc:`eam/he <pair_eam>` - Finnis-Sinclair EAM modified for Helium in metals
|
||||
* :doc:`eam/apip <pair_eam_apip>` - :doc:`adaptive-precision <Howto_apip>` version of EAM, used as fast potential
|
||||
* :doc:`edip <pair_edip>` - three-body EDIP potential
|
||||
* :doc:`edip/multi <pair_edip>` - multi-element EDIP potential
|
||||
* :doc:`edpd <pair_mesodpd>` - eDPD particle interactions
|
||||
@ -217,6 +219,9 @@ accelerated styles exist.
|
||||
* :doc:`kim <pair_kim>` - interface to potentials provided by KIM project
|
||||
* :doc:`kolmogorov/crespi/full <pair_kolmogorov_crespi_full>` - Kolmogorov-Crespi (KC) potential with no simplifications
|
||||
* :doc:`kolmogorov/crespi/z <pair_kolmogorov_crespi_z>` - Kolmogorov-Crespi (KC) potential with normals along z-axis
|
||||
* :doc:`lambda/input/apip <pair_lambda_input_apip>` - constant as input for the precision calculation of an :doc:`adaptive-precision interatomic potential (APIP) <Howto_apip>`
|
||||
* :doc:`lambda/input/csp/apip <pair_lambda_input_apip>` - CSP as input for the precision calculation of an :doc:`adaptive-precision interatomic potential (APIP) <Howto_apip>`
|
||||
* :doc:`lambda/zone/apip <pair_lambda_zone_apip>` - transition zone of an :doc:`adaptive-precision interatomic potential <Howto_apip>`
|
||||
* :doc:`lcbop <pair_lcbop>` - long-range bond-order potential (LCBOP)
|
||||
* :doc:`lebedeva/z <pair_lebedeva_z>` - Lebedeva interlayer potential for graphene with normals along z-axis
|
||||
* :doc:`lennard/mdf <pair_mdf>` - LJ potential in A/B form with a taper function
|
||||
@ -330,6 +335,9 @@ accelerated styles exist.
|
||||
* :doc:`oxrna2/xstk <pair_oxrna2>` -
|
||||
* :doc:`pace <pair_pace>` - Atomic Cluster Expansion (ACE) machine-learning potential
|
||||
* :doc:`pace/extrapolation <pair_pace>` - Atomic Cluster Expansion (ACE) machine-learning potential with extrapolation grades
|
||||
* :doc:`pace/apip <pair_pace_apip>` - :doc:`adaptive-precision <Howto_apip>` version of ACE, used as precise potential
|
||||
* :doc:`pace/fast/apip <pair_pace_apip>` - :doc:`adaptive-precision <Howto_apip>` version of ACE, used as fast potential
|
||||
* :doc:`pace/precise/apip <pair_pace_apip>` - :doc:`adaptive-precision <Howto_apip>` version of ACE, used as precise potential
|
||||
* :doc:`pedone <pair_pedone>` - Pedone (PMMCS) potential (non-Coulomb part)
|
||||
* :doc:`pod <pair_pod>` - Proper orthogonal decomposition (POD) machine-learning potential
|
||||
* :doc:`peri/eps <pair_peri>` - Peridynamic EPS potential
|
||||
|
||||
@ -10,16 +10,17 @@ Syntax
|
||||
|
||||
plugin command args
|
||||
|
||||
* command = *load* or *unload* or *list* or *clear*
|
||||
* command = *load* or *unload* or *list* or *clear* or *restore*
|
||||
* 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 *kspace* or *compute* or *fix* or *region* or *command*
|
||||
*style* = *pair* or *bond* or *angle* or *dihedral* or *improper* or *kspace* or *compute* or *fix* or *region* or *command* or *run* or *min*
|
||||
*list* = print a list of currently loaded plugins
|
||||
*clear* = unload all currently loaded plugins
|
||||
*restore* = restore all loaded plugins
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -31,6 +32,7 @@ Examples
|
||||
plugin unload command hello
|
||||
plugin list
|
||||
plugin clear
|
||||
plugin restore
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
@ -40,22 +42,46 @@ 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.
|
||||
|
||||
.. admonition:: Plugins are a global, per-executable property
|
||||
:class: Hint
|
||||
|
||||
Unlike most settings in LAMMPS, plugins are a per-executable global
|
||||
property. Loading a plugin means that it is not only available for
|
||||
the current LAMMPS instance but for all *future* LAMMPS instances.
|
||||
|
||||
After a :doc:`clear <clear>` command, all currently loaded plugins
|
||||
will be restored and do not need to be loaded again.
|
||||
|
||||
When using the library interface or the Python or Fortran module
|
||||
to create multiple concurrent LAMMPS instances, all plugins should
|
||||
be loaded by the first created LAMMPS instance as all future instances
|
||||
will inherit them. To import plugins that were loaded by a different
|
||||
LAMMPS instance, use the *restore* command.
|
||||
|
||||
|
||||
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
|
||||
plugin DSO with the given filename. A message with information about
|
||||
the plugin style and name and more will be printed. Individual DSO
|
||||
files may contain multiple plugins. If a plugin is already loaded
|
||||
it will be skipped. 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.
|
||||
that style instance will be deleted and replaced by the default setting
|
||||
for that style.
|
||||
|
||||
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.
|
||||
|
||||
.. versionadded:: 12Jun2025
|
||||
|
||||
The *restore* command will restore all currently loaded plugins.
|
||||
This allows to "import" plugins into a different LAMMPS instance.
|
||||
|
||||
.. admonition:: Automatic loading of plugins
|
||||
:class: note
|
||||
|
||||
@ -79,7 +105,7 @@ 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
|
||||
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
|
||||
|
||||
@ -10,7 +10,7 @@ Syntax
|
||||
|
||||
python mode keyword args ...
|
||||
|
||||
* mode = *source* or name of Python function
|
||||
* mode = *source* or *name* of Python function
|
||||
|
||||
if mode is *source*:
|
||||
|
||||
@ -18,35 +18,39 @@ Syntax
|
||||
|
||||
keyword = *here* or name of a *Python file*
|
||||
*here* arg = inline
|
||||
inline = one or more lines of Python code which defines func
|
||||
inline = one or more lines of Python code which will be executed immediately
|
||||
must be a single argument, typically enclosed between triple quotes
|
||||
*Python file* = name of a file with Python code which will be executed immediately
|
||||
|
||||
* if *mode* is the name of a Python function, one or more keywords with/without arguments must be appended
|
||||
* if *mode* is *name* of a Python function:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
one or more keywords with/without arguments must be appended
|
||||
keyword = *invoke* or *input* or *return* or *format* or *length* or *file* or *here* or *exists*
|
||||
*invoke* arg = none = invoke the previously defined Python function
|
||||
*invoke* arg = logreturn (optional)
|
||||
invoke the previously-defined Python function
|
||||
if logreturn is specified, print the return value of the invoked function to the screen and logfile
|
||||
*input* args = N i1 i2 ... iN
|
||||
N = # of inputs to function
|
||||
i1,...,iN = value, SELF, or LAMMPS variable name
|
||||
value = integer number, floating point number, or string
|
||||
SELF = reference to LAMMPS itself which can be accessed by Python function
|
||||
variable = v_name, where name = name of LAMMPS variable, e.g. v_abc
|
||||
SELF = reference to LAMMPS itself which can then be accessed by Python function
|
||||
variable = v_name, where name = name of a LAMMPS variable, e.g. v_abc
|
||||
internal variable = iv_name, where name = name of a LAMMPS internal-style variable, e.g. iv_xyz
|
||||
*return* arg = varReturn
|
||||
varReturn = v_name = LAMMPS variable name which the return value of the Python function will be assigned to
|
||||
*format* arg = fstring with M characters
|
||||
M = N if no return value, where N = # of inputs
|
||||
M = N+1 if there is a return value
|
||||
fstring = each character (i,f,s,p) corresponds in order to an input or return value
|
||||
'i' = integer, 'f' = floating point, 's' = string, 'p' = SELF
|
||||
fstring = each character (i,f,s,p) corresponds (in order) to an input or return value
|
||||
'i' = integer, 'f' = floating point, 's' = string, 'p' = SELF
|
||||
*length* arg = Nlen
|
||||
Nlen = max length of string returned from Python function
|
||||
*file* arg = filename
|
||||
filename = file of Python code, which defines func
|
||||
filename = file of Python code, which defines the Python function
|
||||
*here* arg = inline
|
||||
inline = one or more lines of Python code which defines func
|
||||
inline = one or more lines of Python code which defines the Python function
|
||||
must be a single argument, typically enclosed between triple quotes
|
||||
*exists* arg = none = Python code has been loaded by previous python command
|
||||
|
||||
@ -56,7 +60,7 @@ Examples
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
python pForce input 2 v_x 20.0 return v_f format fff file force.py
|
||||
python pForce invoke
|
||||
python pForce invoke logreturn
|
||||
|
||||
python factorial input 1 myN return v_fac format ii here """
|
||||
def factorial(n):
|
||||
@ -87,75 +91,149 @@ Examples
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
The *python* command allows interfacing LAMMPS with an embedded Python
|
||||
interpreter and enables either executing arbitrary python code in that
|
||||
interpreter, registering a Python function for future execution (as a
|
||||
python style variable, from a fix interfaced with python, or for direct
|
||||
invocation), or invoking such a previously registered function.
|
||||
The *python* command interfaces LAMMPS with an embedded Python
|
||||
interpreter and enables executing arbitrary python code in that
|
||||
interpreter. This can be done immediately, by using *mode* = *source*.
|
||||
Or execution can be deferred, by registering a Python function for later
|
||||
execution, by using *mode* = *name* of a Python function.
|
||||
|
||||
Arguments, including LAMMPS variables, can be passed to the function
|
||||
from the LAMMPS input script and a value returned by the Python function
|
||||
assigned to a LAMMPS variable. The Python code for the function can be included
|
||||
directly in the input script or in a separate Python file. The function
|
||||
can be standard Python code or it can make "callbacks" to LAMMPS through
|
||||
its library interface to query or set internal values within LAMMPS.
|
||||
This is a powerful mechanism for performing complex operations in a
|
||||
LAMMPS input script that are not possible with the simple input script
|
||||
and variable syntax which LAMMPS defines. Thus your input script can
|
||||
operate more like a true programming language.
|
||||
Later execution can be triggered in one of two ways. One is to use the
|
||||
python command again with its *invoke* keyword. The other is to trigger
|
||||
the evaluation of a python-style, equal-style, vector-style, or
|
||||
atom-style variable. A python-style variable invokes its associated
|
||||
Python function; its return value becomes the value of the python-style
|
||||
variable. Equal-, vector-, and atom-style variables can use a Python
|
||||
function wrapper in their formulas which encodes the python-style
|
||||
variable name, and specifies arguments (which themselves can be numeric
|
||||
formulas) to pass to the Python function associated with the
|
||||
python-style variable.
|
||||
|
||||
As explained on the :doc:`variable <variable>` doc page, the definition
|
||||
of a python-style variable associates a Python function name with the
|
||||
variable. Its specification must match the *mode* argument of the
|
||||
*python* command for the Python function name. For example these two
|
||||
commands would be consistent:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable foo python myMultiply
|
||||
python myMultiply return v_foo format f file funcs.py
|
||||
|
||||
The two commands can appear in either order in the input script so long
|
||||
as both are specified before the Python function is invoked for the
|
||||
first time.
|
||||
|
||||
Note that python-style, equal-style, vector-style, and atom-style
|
||||
variables can be used in many different ways within LAMMPS. They can be
|
||||
evaluated directly in an input script, effectively replacing the
|
||||
variable with its value. Or they can be passed to various commands as
|
||||
arguments, so that the variable is evaluated multiple times during a
|
||||
simulation run. See the :doc:`variable <variable>` command doc page for
|
||||
more details on variable styles which enable Python function evaluation.
|
||||
|
||||
The Python code for a Python function can be included directly in the
|
||||
input script or in a separate Python file. The function can be standard
|
||||
Python code or it can make "callbacks" to LAMMPS through its library
|
||||
interface to query or set internal values within LAMMPS. This is a
|
||||
powerful mechanism for performing complex operations in a LAMMPS input
|
||||
script that are not possible with the simple input script and variable
|
||||
syntax which LAMMPS defines. Thus your input script can operate more
|
||||
like a true programming language.
|
||||
|
||||
Use of this command requires building LAMMPS with the PYTHON package
|
||||
which links to the Python library so that the Python interpreter is
|
||||
embedded in LAMMPS. More details about this process are given below.
|
||||
|
||||
There are two ways to invoke a Python function once it has been
|
||||
registered. One is using the *invoke* keyword. The other is to assign
|
||||
the function to a :doc:`python-style variable <variable>` defined in
|
||||
your input script. Whenever the variable is evaluated, it will execute
|
||||
the Python function to assign a value to the variable. Note that
|
||||
variables can be evaluated in many different ways within LAMMPS. They
|
||||
can be substituted with their result directly in an input script, or
|
||||
they can be passed to various commands as arguments, so that the
|
||||
variable is evaluated during a simulation run.
|
||||
|
||||
A broader overview of how Python can be used with LAMMPS is given in the
|
||||
:doc:`Use Python with LAMMPS <Python_head>` section of the
|
||||
documentation. There also is an ``examples/python`` directory which
|
||||
documentation. There is also an ``examples/python`` directory which
|
||||
illustrates use of the python command.
|
||||
|
||||
----------
|
||||
|
||||
The first argument of the *python* command is either the *source*
|
||||
keyword or the name of a Python function. This defines the mode
|
||||
of the python command.
|
||||
The first argument to the *python* command is the *mode* setting, which
|
||||
is either *source* or the *name* of a Python function.
|
||||
|
||||
.. versionchanged:: 22Dec2022
|
||||
|
||||
If the *source* keyword is used, it is followed by either a file name or
|
||||
the *here* keyword. No other keywords can be used. The *here* keyword
|
||||
is followed by a string with python commands, either on a single line
|
||||
enclosed in quotes, or as multiple lines enclosed in triple quotes.
|
||||
These Python commands will be passed to the python interpreter and
|
||||
executed immediately without registering a Python function for future
|
||||
execution. The code will be loaded into and run in the "main" module of
|
||||
the Python interpreter. This allows running arbitrary Python code at
|
||||
any time while processing the LAMMPS input file. This can be used to
|
||||
pre-load Python modules, initialize global variables, define functions
|
||||
or classes, or perform operations using the python programming language.
|
||||
The Python code will be executed in parallel on all MPI processes. No
|
||||
arguments can be passed.
|
||||
If *source* is used, it is followed by either the *here* keyword or a
|
||||
file name containing Python code. The *here* keyword is followed by a
|
||||
single *inline* argument which is a string containing one or more python
|
||||
commands. The string can either be on the same line as the *python*
|
||||
command, enclosed in quotes, or it can be multiple lines enclosed in
|
||||
triple quotes.
|
||||
|
||||
In all other cases, the first argument is the name of a Python function
|
||||
that will be registered with LAMMPS for future execution. The function
|
||||
may already be defined (see *exists* keyword) or must be defined using
|
||||
the *file* or *here* keywords as explained below.
|
||||
In either case, the in-line code or the file contents are passed to the
|
||||
python interpreter and executed immediately. The code will be loaded
|
||||
into and run in the "main" module of the Python interpreter. This
|
||||
allows running arbitrary Python code at any time while processing the
|
||||
LAMMPS input file. This can be used to pre-load Python modules,
|
||||
initialize global variables, define functions or classes, or perform
|
||||
operations using the Python programming language. The Python code will
|
||||
be executed in parallel on all the MPI processes being used to run
|
||||
LAMMPS. Note that no arguments can be passed to the executed Python
|
||||
code.
|
||||
|
||||
If the *invoke* keyword is used, no other keywords can be used, and a
|
||||
If the *mode* setting is the *name* of a Python function, then it will
|
||||
be registered with LAMMPS for future execution (or can already be
|
||||
defined, see the *exists* keyword). One or more keywords must follow
|
||||
the *mode* function name. One of the keywords must be *invoke*, *file*,
|
||||
*here*, or *exists*, which specifies what Python code to load into the
|
||||
Python interpreter. Note that only one of those 4 keywords is allowed
|
||||
since their operations are mutually exclusive.
|
||||
|
||||
----------
|
||||
|
||||
If the *invoke* keyword is used, no other keywords can be used. A
|
||||
previous *python* command must have registered the Python function
|
||||
referenced by this command. This invokes the Python function with the
|
||||
previously defined arguments and the return value is processed as
|
||||
explained below. You can invoke the function as many times as you wish
|
||||
in your input script.
|
||||
referenced by this command, which can then be invoked multiple times in
|
||||
an input script via the *invoke* keyword. Each invocation passes
|
||||
current values for arguments to the Python function. A return value of
|
||||
the Python function will be ignored unless the Python function is linked
|
||||
to a :doc:`python style variable <variable>` with the *return* keyword.
|
||||
This return value can be logged to the screen and logfile by adding the
|
||||
optional *logreturn* argument to the *invoke* keyword. In that case a
|
||||
message with the name of the python command and the return value is
|
||||
printed. Note that return values of python functions are otherwise
|
||||
*only* accessible when the function is invoked indirectly by evaluating
|
||||
its associated :doc:`python style variable <variable>`, as described
|
||||
below.
|
||||
|
||||
The *file* keyword gives the name of a file containing Python code,
|
||||
which should end with a ".py" suffix. The code will be immediately
|
||||
loaded into and run in the "main" module of the Python interpreter. The
|
||||
Python code will be executed in parallel on all MPI processes. Note
|
||||
that Python code which contains a function definition does NOT "execute"
|
||||
the function when it is run; it simply defines the function so that it
|
||||
can be invoked later.
|
||||
|
||||
The *here* keyword does the same thing, except that the Python code
|
||||
follows as a single argument to the *here* keyword. This can be done
|
||||
using triple quotes as delimiters, as in the examples above and below.
|
||||
This allows Python code to be listed verbatim in your input script, with
|
||||
proper indentation, blank lines, and comments, as desired. See the
|
||||
:doc:`Commands parse <Commands_parse>` doc page, for an explanation of
|
||||
how triple quotes can be used as part of input script syntax.
|
||||
|
||||
The *exists* keyword takes no argument. It simply means that Python
|
||||
code containing the needed Python function has already been loaded into
|
||||
the LAMMPS Python interpreter, for example by previous *python source*
|
||||
command or in a file that was loaded previously with the *file*
|
||||
keyword. This allows use of a single file of Python code which contains
|
||||
multiple functions, any of which can be used in the same (or different)
|
||||
input scripts (see below).
|
||||
|
||||
Note that the Python code that is loaded and run by the *file* or *here*
|
||||
keyword must contain a function with the specified function *name*. To
|
||||
operate properly when the function is later invoked, the code for the
|
||||
function must match the *input* and *return* and *format* keywords
|
||||
specified by the python command. Otherwise Python will generate an
|
||||
error.
|
||||
|
||||
----------
|
||||
|
||||
The other keywords which can be used with the *python* command are
|
||||
*input*, *return*, *format*, and *length*.
|
||||
|
||||
The *input* keyword defines how many arguments *N* the Python function
|
||||
expects. If it takes no arguments, then the *input* keyword should not
|
||||
@ -169,35 +247,63 @@ itself using the :doc:`LAMMPS Python module <Python_module>`. This
|
||||
enables the function to call back to LAMMPS through its library
|
||||
interface as explained below. This allows the Python function to query
|
||||
or set values internal to LAMMPS which can affect the subsequent
|
||||
execution of the input script. A LAMMPS variable can also be used as an
|
||||
argument, specified as v_name, where "name" is the name of the variable.
|
||||
Any style of LAMMPS variable returning a scalar or a string can be used,
|
||||
as defined by the :doc:`variable <variable>` command. The *format*
|
||||
keyword must be used to set the type of data that is passed to Python.
|
||||
Each time the Python function is invoked, the LAMMPS variable is
|
||||
evaluated and its value is passed to the Python function.
|
||||
execution of the input script.
|
||||
|
||||
A LAMMPS variable can also be used as an *input* argument, specified as
|
||||
v_name, where "name" is the name of the variable defined in the input
|
||||
script. Any style of LAMMPS variable returning a scalar or a string can
|
||||
be used, as defined by the :doc:`variable <variable>` command. The
|
||||
style of variable must be consistent with the *format* keyword
|
||||
specification for the type of data that is passed to Python. Each time
|
||||
the Python function is invoked, the LAMMPS variable is evaluated and its
|
||||
value is passed as an argument to the Python function. Note that a
|
||||
python-style variable can be used as an argument, which means that the a
|
||||
Python function can use arguments which invoke other Python functions.
|
||||
|
||||
A LAMMPS internal-style variable can also be used as an *input*
|
||||
argument, specified as iv_name, where "name" is the name of the
|
||||
internal-style variable. The internal-style variable does not have to
|
||||
be defined in the input script (though it can be); if it is not defined,
|
||||
this command creates an :doc:`internal-style variable <variable>` with
|
||||
the specified name.
|
||||
|
||||
An internal-style variable must be used when an equal-style,
|
||||
vector-style, or atom-style variable triggers the invocation of the
|
||||
Python function defined by this command, by including a Python function
|
||||
wrapper with arguments in its formula. Each of the arguments must be
|
||||
specified as an internal-style variable via the *input* keyword.
|
||||
|
||||
In brief, the syntax for a Python function wrapper in a variable formula
|
||||
is ``py_varname(arg1,arg2,...argN)``, where "varname" is the name of a
|
||||
python-style variable associated with a Python function defined by this
|
||||
command. One or more arguments to the function wrapper can themselves
|
||||
be sub-formulas which the variable command will evaluate and pass as
|
||||
arguments to the Python function. This is done by assigning the numeric
|
||||
result for each argument to an internal-style variable; thus the *input*
|
||||
keyword must specify the arguments as internal-style variables and their
|
||||
format (see below) as "f" for floating point. This is because LAMMPS
|
||||
variable formulas are calculated with floating point arithmetic (any
|
||||
integer values are converted to floating point). Note that the Python
|
||||
function can also have additional inputs, also specified by the *input*
|
||||
keyword, which are NOT arguments in the Python function wrapper. See
|
||||
the example below for the ``mixedargs`` Python function.
|
||||
|
||||
See the :doc:`variable <variable>` command doc page for full details on
|
||||
formula syntax including for Python function wrappers. Examples using
|
||||
Python function wrappers are shown below. Note that as explained above
|
||||
with python-style variables, Python function wrappers can be nested; a
|
||||
sub-formula for an argument can contain its own Python function wrapper
|
||||
which invokes another Python function.
|
||||
|
||||
The *return* keyword is only needed if the Python function returns a
|
||||
value. The specified *varReturn* must be of the form v_name, where
|
||||
"name" is the name of a python-style LAMMPS variable, defined by the
|
||||
value. The specified *varReturn* is of the form v_name, where "name" is
|
||||
the name of a python-style LAMMPS variable, defined by the
|
||||
:doc:`variable <variable>` command. The Python function can return a
|
||||
numeric or string value, as specified by the *format* keyword.
|
||||
|
||||
As explained on the :doc:`variable <variable>` doc page, the definition
|
||||
of a python-style variable associates a Python function name with the
|
||||
variable. This must match the *Python function name* first argument of
|
||||
the *python* command. For example these two commands would be
|
||||
consistent:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable foo python myMultiply
|
||||
python myMultiply return v_foo format f file funcs.py
|
||||
|
||||
The two commands can appear in either order in the input script so
|
||||
long as both are specified before the Python function is invoked for
|
||||
the first time. Afterwards, the variable 'foo' is associated with
|
||||
the Python function 'myMultiply'.
|
||||
numeric or string value, as specified by the *format* keyword. This
|
||||
return value is *only* accessible when its associated python-style
|
||||
variable is evaluated. When the *invoke* keyword is used, the return
|
||||
value of the python function is ignored unless the optional *logreturn*
|
||||
argument is specified.
|
||||
|
||||
The *format* keyword must be used if the *input* or *return* keywords
|
||||
are used. It defines an *fstring* with M characters, where M = sum of
|
||||
@ -214,47 +320,16 @@ but only if the output of the Python function is flagged as a numeric
|
||||
value ("i" or "f") via the *format* keyword.
|
||||
|
||||
If the *return* keyword is used and the *format* keyword specifies the
|
||||
output as a string, then the default maximum length of that string is
|
||||
63 characters (64-1 for the string terminator). If you want to return
|
||||
a longer string, the *length* keyword can be specified with its *Nlen*
|
||||
value set to a larger number (the code allocates space for Nlen+1 to
|
||||
include the string terminator). If the Python function generates a
|
||||
output as a string, then the default maximum length of that string is 63
|
||||
characters (64-1 for the string terminator). If you want to return a
|
||||
longer string, the *length* keyword can be specified with its *Nlen*
|
||||
value set to a larger number. LAMMPS will then allocate Nlen+1 space to
|
||||
include the string terminator. If the Python function generates a
|
||||
string longer than the default 63 or the specified *Nlen*, it will be
|
||||
truncated.
|
||||
|
||||
----------
|
||||
|
||||
Either the *file*, *here*, or *exists* keyword must be used, but only
|
||||
one of them. These keywords specify what Python code to load into the
|
||||
Python interpreter. The *file* keyword gives the name of a file
|
||||
containing Python code, which should end with a ".py" suffix. The code
|
||||
will be immediately loaded into and run in the "main" module of the
|
||||
Python interpreter. The Python code will be executed in parallel on all
|
||||
MPI processes. Note that Python code which contains a function
|
||||
definition does not "execute" the function when it is run; it simply
|
||||
defines the function so that it can be invoked later.
|
||||
|
||||
The *here* keyword does the same thing, except that the Python code
|
||||
follows as a single argument to the *here* keyword. This can be done
|
||||
using triple quotes as delimiters, as in the examples above. This
|
||||
allows Python code to be listed verbatim in your input script, with
|
||||
proper indentation, blank lines, and comments, as desired. See the
|
||||
:doc:`Commands parse <Commands_parse>` doc page, for an explanation of
|
||||
how triple quotes can be used as part of input script syntax.
|
||||
|
||||
The *exists* keyword takes no argument. It means that Python code
|
||||
containing the required Python function with the given name has already
|
||||
been executed, for example by a *python source* command or in the same
|
||||
file that was used previously with the *file* keyword.
|
||||
|
||||
Note that the Python code that is loaded and run must contain a function
|
||||
with the specified function name. To operate properly when later
|
||||
invoked, the function code must match the *input* and *return* and
|
||||
*format* keywords specified by the python command. Otherwise Python
|
||||
will generate an error.
|
||||
|
||||
----------
|
||||
|
||||
This section describes how Python code can be written to work with
|
||||
LAMMPS.
|
||||
|
||||
@ -275,16 +350,16 @@ keyword once to load several functions, and the *exists* keyword
|
||||
thereafter in subsequent python commands to register the other functions
|
||||
that were previously loaded with LAMMPS.
|
||||
|
||||
A Python function you define (or more generally, the code you load)
|
||||
can import other Python modules or classes, it can make calls to other
|
||||
A Python function you define (or more generally, the code you load) can
|
||||
import other Python modules or classes, it can make calls to other
|
||||
system functions or functions you define, and it can access or modify
|
||||
global variables (in the "main" module) which will persist between
|
||||
successive function calls. The latter can be useful, for example, to
|
||||
prevent a function from being invoke multiple times per timestep by
|
||||
different commands in a LAMMPS input script that access the returned
|
||||
python-style variable associated with the function. For example,
|
||||
consider this function loaded with two global variables defined
|
||||
outside the function:
|
||||
consider this function loaded with two global variables defined outside
|
||||
the function:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@ -308,32 +383,33 @@ previous value is simply returned, without re-computing it. The
|
||||
"global" statement inside the Python function allows it to overwrite the
|
||||
global variables from within the local context of the function.
|
||||
|
||||
Note that if you load Python code multiple times (via multiple python
|
||||
commands), you can overwrite previously loaded variables and functions
|
||||
if you are not careful. E.g. if the code above were loaded twice, the
|
||||
global variables would be re-initialized, which might not be what you
|
||||
want. Likewise, if a function with the same name exists in two chunks
|
||||
of Python code you load, the function loaded second will override the
|
||||
function loaded first.
|
||||
Also note that if you load Python code multiple times (via multiple
|
||||
python commands), you can overwrite previously loaded variables and
|
||||
functions if you are not careful. E.g. if the code above were loaded
|
||||
twice, the global variables would be re-initialized, which might not be
|
||||
what you want. Likewise, if a function with the same name exists in two
|
||||
chunks of Python code you load, the function loaded second will override
|
||||
the function loaded first.
|
||||
|
||||
It's important to realize that if you are running LAMMPS in parallel,
|
||||
each MPI task will load the Python interpreter and execute a local
|
||||
copy of the Python function(s) you define. There is no connection
|
||||
between the Python interpreters running on different processors.
|
||||
This implies three important things.
|
||||
each MPI task will load the Python interpreter and execute a local copy
|
||||
of the Python function(s) you define. There is no connection between
|
||||
the Python interpreters running on different processors. This implies
|
||||
three important things.
|
||||
|
||||
First, if you put a print or other statement creating output to the
|
||||
screen in your Python function, you will see P copies of the output,
|
||||
when running on P processors. If the prints occur at (nearly) the same
|
||||
time, the P copies of the output may be mixed together. When loading
|
||||
the LAMMPS Python module into the embedded Python interpreter, it is
|
||||
possible to pass the pointer to the current LAMMPS class instance and
|
||||
via the Python interface to the LAMMPS library interface, it is possible
|
||||
to determine the MPI rank of the current process and thus adapt the
|
||||
Python code so that output will only appear on MPI rank 0. The
|
||||
following LAMMPS input demonstrates how this could be done. The text
|
||||
'Hello, LAMMPS!' should be printed only once, even when running LAMMPS
|
||||
in parallel.
|
||||
time, the P copies of the output may be mixed together.
|
||||
|
||||
It is possible to avoid this issue, by passing the pointer to the
|
||||
current LAMMPS class instance to the Python function via the {input}
|
||||
SELF argument described above. The Python function can then use the
|
||||
Python interface to the LAMMPS library interface, and determine the MPI
|
||||
rank of the current process. The Python code can then ensure output
|
||||
will only appear on MPI rank 0. The following LAMMPS input demonstrates
|
||||
how this could be done. The text 'Hello, LAMPS!' should be printed only
|
||||
once, even when running LAMMPS in parallel.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -348,27 +424,26 @@ in parallel.
|
||||
|
||||
python python_hello invoke
|
||||
|
||||
If your Python code loads Python modules that are not pre-loaded by the
|
||||
Python library, then it will load the module from disk. This may be a
|
||||
bottleneck if 1000s of processors try to load a module at the same time.
|
||||
On some large supercomputers, loading of modules from disk by Python may
|
||||
be disabled. In this case you would need to pre-build a Python library
|
||||
that has the required modules pre-loaded and link LAMMPS with that
|
||||
library.
|
||||
Second, if your Python code loads Python modules that are not pre-loaded
|
||||
by the Python library, then it will load the module from disk. This may
|
||||
be a bottleneck if 1000s of processors try to load a module at the same
|
||||
time. On some large supercomputers, loading of modules from disk by
|
||||
Python may be disabled. In this case you would need to pre-build a
|
||||
Python library that has the required modules pre-loaded and link LAMMPS
|
||||
with that library.
|
||||
|
||||
Third, if your Python code calls back to LAMMPS (discussed in the
|
||||
next section) and causes LAMMPS to perform an MPI operation requires
|
||||
global communication (e.g. via MPI_Allreduce), such as computing the
|
||||
global temperature of the system, then you must ensure all your Python
|
||||
Third, if your Python code calls back to LAMMPS (discussed in the next
|
||||
section) and causes LAMMPS to perform an MPI operation requires global
|
||||
communication (e.g. via MPI_Allreduce), such as computing the global
|
||||
temperature of the system, then you must ensure all your Python
|
||||
functions (running independently on different processors) call back to
|
||||
LAMMPS. Otherwise the code may hang.
|
||||
|
||||
----------
|
||||
|
||||
Your Python function can "call back" to LAMMPS through its
|
||||
library interface, if you use the SELF input to pass Python
|
||||
a pointer to LAMMPS. The mechanism for doing this in your
|
||||
Python function is as follows:
|
||||
As mentioned above, a Python function can "call back" to LAMMPS through
|
||||
its library interface, if the SELF input is used to pass Python a
|
||||
pointer to LAMMPS. The mechanism for doing this is as follows:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@ -393,15 +468,15 @@ appeared in your input script. In this case, LAMMPS should output
|
||||
Hello from inside Python
|
||||
|
||||
to the screen and log file. Note that since the LAMMPS print command
|
||||
itself takes a string in quotes as its argument, the Python string
|
||||
must be delimited with a different style of quotes.
|
||||
itself takes a string in quotes as its argument, the Python string must
|
||||
be delimited with a different style of quotes.
|
||||
|
||||
The :doc:`Python_head` page describes the syntax
|
||||
for how Python wraps the various functions included in the LAMMPS
|
||||
library interface.
|
||||
The :doc:`Python_head` page describes the syntax for how Python wraps
|
||||
the various functions included in the LAMMPS library interface.
|
||||
|
||||
A more interesting example is in the ``examples/python/in.python`` script
|
||||
which loads and runs the following function from ``examples/python/funcs.py``:
|
||||
A more interesting example is in the ``examples/python/in.python``
|
||||
script which loads and runs the following function from
|
||||
``examples/python/funcs.py``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@ -416,7 +491,7 @@ which loads and runs the following function from ``examples/python/funcs.py``:
|
||||
|
||||
lmp.set_variable("cut",cut) # set a variable in LAMMPS
|
||||
lmp.command("pair_style lj/cut ${cut}") # LAMMPS command
|
||||
#lmp.command("pair_style lj/cut %d" % cut) # LAMMPS command option
|
||||
#lmp.command("pair_style lj/cut %d" % cut) # alternate form of LAMMPS command
|
||||
|
||||
lmp.command("pair_coeff * * 1.0 1.0") # ditto
|
||||
lmp.command("run 10") # ditto
|
||||
@ -432,51 +507,160 @@ with these input script commands:
|
||||
python loop invoke
|
||||
|
||||
This has the effect of looping over a series of 10 short runs (10
|
||||
timesteps each) where the pair style cutoff is increased from a value
|
||||
of 1.0 in distance units, in increments of 0.1. The looping stops
|
||||
when the per-atom potential energy falls below a threshold of -4.0 in
|
||||
energy units. More generally, Python can be used to implement a loop
|
||||
with complex logic, much more so than can be created using the LAMMPS
|
||||
timesteps each) where the pair style cutoff is increased from a value of
|
||||
1.0 in distance units, in increments of 0.1. The looping stops when the
|
||||
per-atom potential energy falls below a threshold of -4.0 in energy
|
||||
units. More generally, Python can be used to implement a loop with
|
||||
complex logic, much more so than can be created using the LAMMPS
|
||||
:doc:`jump <jump>` and :doc:`if <if>` commands.
|
||||
|
||||
Several LAMMPS library functions are called from the loop function.
|
||||
Get_natoms() returns the number of atoms in the simulation, so that it
|
||||
can be used to normalize the potential energy that is returned by
|
||||
extract_compute() for the "thermo_pe" compute that is defined by
|
||||
default for LAMMPS thermodynamic output. Set_variable() sets the
|
||||
value of a string variable defined in LAMMPS. This library function
|
||||
is a useful way for a Python function to return multiple values to
|
||||
LAMMPS, more than the single value that can be passed back via a
|
||||
return statement. This cutoff value in the "cut" variable is then
|
||||
substituted (by LAMMPS) in the pair_style command that is executed
|
||||
next. Alternatively, the "LAMMPS command option" line could be used
|
||||
in place of the 2 preceding lines, to have Python insert the value
|
||||
into the LAMMPS command string.
|
||||
extract_compute() for the "thermo_pe" compute that is defined by default
|
||||
for LAMMPS thermodynamic output. Set_variable() sets the value of a
|
||||
string variable defined in LAMMPS. This library function is a useful
|
||||
way for a Python function to return multiple values to LAMMPS, more than
|
||||
the single value that can be passed back via a return statement. This
|
||||
cutoff value in the "cut" variable is then substituted (by LAMMPS) in
|
||||
the pair_style command that is executed next. Alternatively, the
|
||||
"alternate form of LAMMPS command" line could be used in place of the 2
|
||||
preceding lines, to have Python insert the value into the LAMMPS command
|
||||
string.
|
||||
|
||||
.. note::
|
||||
|
||||
When using the callback mechanism just described, recognize that
|
||||
there are some operations you should not attempt because LAMMPS cannot
|
||||
execute them correctly. If the Python function is invoked between
|
||||
runs in the LAMMPS input script, then it should be OK to invoke any
|
||||
LAMMPS input script command via the library interface command() or
|
||||
file() functions, so long as the command would work if it were
|
||||
executed in the LAMMPS input script directly at the same point.
|
||||
there are some operations you should not attempt because LAMMPS
|
||||
cannot execute them correctly. If the Python function is invoked
|
||||
between runs in the LAMMPS input script, then it should be OK to
|
||||
invoke any LAMMPS input script command via the library interface
|
||||
command() or file() functions, so long as the command would work if
|
||||
it were executed in the LAMMPS input script directly at the same
|
||||
point.
|
||||
|
||||
However, a Python function can also be invoked during a run, whenever
|
||||
an associated LAMMPS variable it is assigned to is evaluated. If the
|
||||
variable is an input argument to another LAMMPS command (e.g. :doc:`fix setforce <fix_setforce>`), then the Python function will be invoked
|
||||
inside the class for that command, in one of its methods that is
|
||||
invoked in the middle of a timestep. You cannot execute arbitrary
|
||||
input script commands from the Python function (again, via the
|
||||
command() or file() functions) at that point in the run and expect it
|
||||
to work. Other library functions such as those that invoke computes
|
||||
or other variables may have hidden side effects as well. In these
|
||||
cases, LAMMPS has no simple way to check that something illogical is
|
||||
being attempted.
|
||||
|
||||
The same applies to Python functions called during a simulation run at
|
||||
each time step using :doc:`fix python/invoke <fix_python_invoke>`.
|
||||
----------
|
||||
|
||||
As noted above, a Python function can be invoked during a run, whenever
|
||||
an associated python-style variable it is assigned to is evaluated.
|
||||
|
||||
If the variable is an input argument to another LAMMPS command
|
||||
(e.g. :doc:`fix setforce <fix_setforce>`), then the Python function will
|
||||
be invoked inside the class for that command, possibly in one of its
|
||||
methods that is invoked in the middle of a timestep. You cannot execute
|
||||
arbitrary input script commands from the Python function (again, via the
|
||||
command() or file() functions) at that point in the run and expect it to
|
||||
work. Other library functions such as those that invoke computes or
|
||||
other variables may have hidden side effects as well. In these cases,
|
||||
LAMMPS has no simple way to check that something illogical is being
|
||||
attempted.
|
||||
|
||||
The same constraints apply to Python functions called during a
|
||||
simulation run at each time step using the :doc:`fix python/invoke
|
||||
<fix_python_invoke>` command.
|
||||
|
||||
----------
|
||||
|
||||
As noted above, a Python function can also be invoked within the formula
|
||||
for an equal-style, vector-style, or atom-style variable. This means
|
||||
the Python function will be invoked whenever that variable is invoked.
|
||||
In the case of a vector-style variable, the Python function can be
|
||||
invoked once per element of the global vector. In the case of an
|
||||
atom-style variable, the Python function can be invoked once per atom.
|
||||
|
||||
Here are three simple examples using equal-, vector-, and atom-style
|
||||
variables to trigger execution of a Python function:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable foo python truncate
|
||||
python truncate return v_foo input 1 iv_arg format fi here """
|
||||
def truncate(x):
|
||||
return int(x)
|
||||
"""
|
||||
variable ptrunc equal py_foo(press)
|
||||
print "TRUNCATED pressure = ${ptrunc}"
|
||||
|
||||
The Python ``truncate`` function simply converts a floating-point value
|
||||
to an integer value. When the LAMMPS print command evaluates the
|
||||
equal-style ``ptrunc`` variable, the current thermodynamic pressure is
|
||||
passed to the Python function. The truncated value is output to the
|
||||
screen and logfile by the print command. Note that the *input* keyword
|
||||
for the *python* command, specifies an internal-style variable named
|
||||
"arg" as iv_arg which is required to invoke the Python function from a
|
||||
Python function wrapper.
|
||||
|
||||
The last 2 lines can be replaced by these to define a vector-style
|
||||
variable which invokes the same Python ``truncate`` function:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute ke all temp
|
||||
variable ke vector c_ke
|
||||
variable ketrunc vector py_foo(v_ke)
|
||||
thermo_style custom step temp epair v_ketrunc[*6]
|
||||
|
||||
The vector-style variable ``ketrunc`` invokes the Python ``truncate``
|
||||
function on each of the 6 components of the global kinetic energy tensor
|
||||
calculated by the :doc:`compute ke <compute_ke>` command. The 6
|
||||
truncated values will be printed with thermo output to the screen and
|
||||
log file.
|
||||
|
||||
Or the last 2 lines of the equal-style variable example can be replaced
|
||||
by these to define atom-style variables which invoke the same Python
|
||||
``truncate`` function:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable xtrunc atom py_foo(x)
|
||||
variable ytrunc atom py_foo(y)
|
||||
variable ztrunc atom py_foo(z)
|
||||
dump 1 all custom 100 tmp.dump id x y z v_xtrunc v_ytrunc v_ztrunc
|
||||
|
||||
When the dump command invokes the 3 atom-style variables, their
|
||||
arguments x,y,z to the Python function wrapper are the current per-atom
|
||||
coordinates of each atom. The Python ``truncate`` function is thus
|
||||
invoked 3 times for each atom, and the truncated coordinate values for
|
||||
each atom are written to the dump file.
|
||||
|
||||
Note that when using a Python function wrapper in a variable, arguments
|
||||
can be passed to the Python function either from the variable formula or
|
||||
by *input* keyword to the :doc:`python command <python>`. For example,
|
||||
consider these (made up) commands:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable foo python mixedargs
|
||||
python mixedargs return v_foo input 6 7.5 v_myValue iv_arg1 iv_argy iv_argz v_flag &
|
||||
format fffffsf here """
|
||||
def mixedargs(a,b,x,y,z,flag):
|
||||
...
|
||||
return result
|
||||
"""
|
||||
variable flag string optionABC
|
||||
variable myValue equal "2.0*temp*c_pe"
|
||||
compute pe all pe
|
||||
compute peatom all pe/atom
|
||||
variable field atom py_foo(x+3.0,sqrt(y),(z-zlo)*c_peatom)
|
||||
|
||||
They define a Python ``mixedargs`` function with 6 arguments. Three of
|
||||
them are internal-style variables, which the variable formula calculates
|
||||
as numeric values for each atom and passes to the function. In this
|
||||
example, these arguments are themselves small formulas containing the
|
||||
x,y,z coordinates of each atom as well as a per-atom compute (c_peratom)
|
||||
and thermodynamic keyword (zlo).
|
||||
|
||||
The other three arguments ``(7.5,v_myValue,v_flag)`` are defined by the
|
||||
*python* command. The first and last are constant values ("7.5" and the
|
||||
``optionABC`` string). The second argument (``myValue``) is the result
|
||||
of an equal-style variable formula which accesses the system temperature
|
||||
and potential energy.
|
||||
|
||||
The "result" returned by each invocation of the Python ``mixedargs``
|
||||
function becomes the per-atom value in the atom-style "field" variable,
|
||||
which could be output to a dump file or used elsewhere in the input
|
||||
script.
|
||||
|
||||
----------
|
||||
|
||||
@ -485,12 +669,11 @@ interactively or by using Python to launch a Python script stored in a
|
||||
file, and your code has an error, you will typically see informative
|
||||
error messages. That is not the case when you run Python code from
|
||||
LAMMPS using an embedded Python interpreter. The code will typically
|
||||
fail silently. LAMMPS will catch some errors but cannot tell you
|
||||
where in the Python code the problem occurred. For example, if the
|
||||
Python code cannot be loaded and run because it has syntax or other
|
||||
logic errors, you may get an error from Python pointing to the
|
||||
offending line, or you may get one of these generic errors from
|
||||
LAMMPS:
|
||||
fail silently. LAMMPS will catch some errors but cannot tell you where
|
||||
in the Python code the problem occurred. For example, if the Python
|
||||
code cannot be loaded and run because it has syntax or other logic
|
||||
errors, you may get an error from Python pointing to the offending line,
|
||||
or you may get one of these generic errors from LAMMPS:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -504,16 +687,16 @@ you will typically get this generic error from LAMMPS:
|
||||
|
||||
Python function evaluation failed
|
||||
|
||||
Here are three suggestions for debugging your Python code while
|
||||
running it under LAMMPS.
|
||||
Here are three suggestions for debugging your Python code while running
|
||||
it under LAMMPS.
|
||||
|
||||
First, don't run it under LAMMPS, at least to start with! Debug it
|
||||
using plain Python. Load and invoke your function, pass it arguments,
|
||||
check return values, etc.
|
||||
|
||||
Second, add Python print statements to the function to check how far
|
||||
it gets and intermediate values it calculates. See the discussion
|
||||
above about printing from Python when running in parallel.
|
||||
Second, add Python print statements to the function to check how far it
|
||||
gets and intermediate values it calculates. See the discussion above
|
||||
about printing from Python when running in parallel.
|
||||
|
||||
Third, use Python exception handling. For example, say this statement
|
||||
in your Python function is failing, because you have not initialized the
|
||||
@ -523,8 +706,7 @@ variable foo:
|
||||
|
||||
foo += 1
|
||||
|
||||
If you put one (or more) statements inside a "try" statement,
|
||||
like this:
|
||||
If you put one (or more) statements inside a "try" statement, like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@ -563,13 +745,15 @@ If you use Python code which calls back to LAMMPS, via the SELF input
|
||||
argument explained above, there is an extra step required when building
|
||||
LAMMPS. LAMMPS must also be built as a shared library and your Python
|
||||
function must be able to load the :doc:`"lammps" Python module
|
||||
<Python_module>` that wraps the LAMMPS library interface. These are the
|
||||
same steps required to use Python by itself to wrap LAMMPS. Details on
|
||||
these steps are explained on the :doc:`Python <Python_head>` doc page.
|
||||
Note that it is important that the stand-alone LAMMPS executable and the
|
||||
LAMMPS shared library be consistent (built from the same source code
|
||||
files) in order for this to work. If the two have been built at
|
||||
different times using different source files, problems may occur.
|
||||
<Python_module>` that wraps the LAMMPS library interface.
|
||||
|
||||
These are the same steps required to use Python by itself to wrap
|
||||
LAMMPS. Details on these steps are explained on the :doc:`Python
|
||||
<Python_head>` doc page. Note that it is important that the stand-alone
|
||||
LAMMPS executable and the LAMMPS shared library be consistent (built
|
||||
from the same source code files) in order for this to work. If the two
|
||||
have been built at different times using different source files,
|
||||
problems may occur.
|
||||
|
||||
Another limitation of calling back to Python from the LAMMPS module
|
||||
using the *python* command in a LAMMPS input is that both, the Python
|
||||
@ -583,7 +767,8 @@ global variables will become invisible.
|
||||
Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`shell <shell>`, :doc:`variable <variable>`, :doc:`fix python/invoke <fix_python_invoke>`
|
||||
:doc:`shell <shell>`, :doc:`variable <variable>`,
|
||||
:doc:`fix python/invoke <fix_python_invoke>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
@ -16,12 +16,13 @@ Syntax
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
field = *x* or *y* or *z* or *vx* or *vy* or *vz* or *q* or *ix* or *iy* or *iz* or *fx* or *fy* or *fz*
|
||||
field = *x* or *y* or *z* or *vx* or *vy* or *vz* or *q* or *ix* or *iy* or *iz* or *fx* or *fy* or *fz* or *apip_lambda*
|
||||
*x*,\ *y*,\ *z* = atom coordinates
|
||||
*vx*,\ *vy*,\ *vz* = velocity components
|
||||
*q* = charge
|
||||
*ix*,\ *iy*,\ *iz* = image flags in each dimension
|
||||
*fx*,\ *fy*,\ *fz* = force components
|
||||
*apip_lambda* = switching parameter of an :doc:`adaptive-precision interatomic potential <Howto_apip>`
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *nfile* or *box* or *timestep* or *replace* or *purge* or *trim* or *add* or *label* or *scaled* or *wrapped* or *format*
|
||||
|
||||
@ -103,14 +103,16 @@ must be done.
|
||||
|
||||
.. note::
|
||||
|
||||
If your input script changes the system between 2 runs, then the
|
||||
initial setup must be performed to ensure the change is recognized by
|
||||
all parts of the code that are affected. Examples are adding a
|
||||
:doc:`fix <fix>` or :doc:`dump <dump>` or :doc:`compute <compute>`, changing
|
||||
a :doc:`neighbor <neigh_modify>` list parameter, or writing restart file
|
||||
which can migrate atoms between processors. LAMMPS has no easy way to
|
||||
check if this has happened, but it is an error to use the *pre no*
|
||||
option in this case.
|
||||
If your input script "changes" the system between 2 runs, then the
|
||||
initial setup typically needs to be performed to ensure the change
|
||||
is recognized by all parts of the code that are affected. Examples
|
||||
are adding a :doc:`fix <fix>` or :doc:`dump <dump>` or
|
||||
:doc:`compute <compute>`, changing a :doc:`neighbor <neigh_modify>`
|
||||
list parameter, using the :doc:`set <set>` command, or writing a
|
||||
restart file via the :doc:`write_restart <write_restart>` command,
|
||||
which can migrate atoms between processors. LAMMPS has no easy way
|
||||
to check if this has happened, but it is an error to use the *pre
|
||||
no* option in these cases.
|
||||
|
||||
If *post* is specified as "no", the full timing summary is skipped;
|
||||
only a one-line summary timing is printed.
|
||||
|
||||
800
doc/src/set.rst
800
doc/src/set.rst
@ -22,21 +22,114 @@ Syntax
|
||||
for style = *region*, ID = a region ID
|
||||
|
||||
* one or more keyword/value pairs may be appended
|
||||
* keyword = *type* or *type/fraction* or *type/ratio* or *type/subset*
|
||||
or *mol* or *x* or *y* or *z* or *vx* or *vy* or *vz* or *charge* or
|
||||
*dipole* or *dipole/random* or *quat* or *spin/atom* or *spin/atom/random* or
|
||||
*spin/electron* or *radius/electron* or
|
||||
*quat* or *quat/random* or *diameter* or *shape* or *length* or *tri* or
|
||||
*theta* or *theta/random* or *angmom* or *omega* or
|
||||
*mass* or *density* or *density/disc* or *temperature* or
|
||||
*volume* or *image* or *bond* or *angle* or *dihedral* or
|
||||
*improper* or *sph/e* or *sph/cv* or *sph/rho* or
|
||||
*smd/contact/radius* or *smd/mass/density* or *dpd/theta* or
|
||||
*edpd/temp* or *edpd/cv* or *cc* or *epsilon* or
|
||||
*i_name* or *d_name* or *i2_name* or *d2_name*
|
||||
|
||||
* keyword = *angle* or *angmom* or *apip/lambda* or *bond* or *cc* or *charge*
|
||||
or *density* or *density/disc* or *diameter* or *dihedral* or *dipole*
|
||||
or *dipole/random* or *dpd/theta* or *edpd/cv* or *edpd/temp* or
|
||||
*epsilon* or *image* or *improper* or *length* or *mass* or *mol* or
|
||||
*omega* or *quat* or *quat/random* or *radius/electron* or *shape* or
|
||||
*smd/contact/radius* or *smd/mass/density* or *sph/cv* or *sph/e* or
|
||||
*sph/rho* or *spin/atom* or *spin/atom/random* or *spin/electron* or
|
||||
*temperature* or *theta* or *theta/random* or *tri* or *type* or
|
||||
*type/fraction* or *type/ratio* or *type/subset* or *volume* or *vx*
|
||||
or *vy* or *vz* or *x* or *y* or *z* or *i_name* or *d_name* or
|
||||
*i2_name* or *d2_name*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*angle* value = numeric angle type or angle type label, for all angles between selected atoms
|
||||
*angmom* values = Lx Ly Lz
|
||||
Lx,Ly,Lz = components of angular momentum vector (distance-mass-velocity units)
|
||||
any of Lx,Ly,Lz can be an atom-style variable (see below)
|
||||
*apip/lambda* value = fast or precise or float
|
||||
fast = switching parameter of fast potential (1)
|
||||
precise = switching parameter of fast potential (0)
|
||||
float = constant float or atom-style variable (between 0 and 1)
|
||||
*bond* value = numeric bond type or bond type label, for all bonds between selected atoms
|
||||
*cc* values = index cc
|
||||
index = index of a chemical species (1 to Nspecies)
|
||||
cc = chemical concentration of tDPD particles for a species (mole/volume units)
|
||||
cc can be an atom-style variable (see below)
|
||||
*charge* value = atomic charge (charge units)
|
||||
value can be an atom-style variable (see below)
|
||||
*density* value = particle density for a sphere or ellipsoid (mass/distance\^3 units), or for a triangle (mass/distance\^2 units) or line (mass/distance units) particle
|
||||
value can be an atom-style variable (see below)
|
||||
*density/disc* value = particle density for a 2d disc or ellipse (mass/distance\^2 units)
|
||||
value can be an atom-style variable (see below)
|
||||
*diameter* value = diameter of spherical particle (distance units)
|
||||
value can be an atom-style variable (see below)
|
||||
*dihedral* value = numeric dihedral type or dihedral type label, for all dihedrals between selected atoms
|
||||
*dipole* values = x y z
|
||||
x,y,z = orientation of dipole moment vector
|
||||
any of x,y,z can be an atom-style variable (see below)
|
||||
*dipole/random* values = seed Dlen
|
||||
seed = random # seed (positive integer) for dipole moment orientations
|
||||
Dlen = magnitude of dipole moment (dipole units)
|
||||
*dpd/theta* value = internal temperature of DPD particles (temperature units)
|
||||
value can be an atom-style variable (see below)
|
||||
value can be NULL which sets internal temp of each particle to KE temp
|
||||
*edpd/cv* value = volumetric heat capacity of eDPD particles (energy/temperature/volume units)
|
||||
value can be an atom-style variable (see below)
|
||||
*edpd/temp* value = temperature of eDPD particles (temperature units)
|
||||
value can be an atom-style variable (see below)
|
||||
*epsilon* value = dielectric constant of the medium where the atoms reside
|
||||
value can be an atom-style variable (see below)
|
||||
*image* values = nx ny nz
|
||||
nx,ny,nz = which periodic image of the simulation box the atom is in
|
||||
any of nx,ny,nz can be an atom-style variable (see below)
|
||||
*improper* value = numeric improper type or improper type label, for all impropers between selected atoms
|
||||
*length* value = len
|
||||
len = length of line segment (distance units)
|
||||
len can be an atom-style variable (see below)
|
||||
*mass* value = per-atom mass (mass units)
|
||||
value can be an atom-style variable (see below)
|
||||
*mol* value = molecule ID
|
||||
the moleclue ID can be an atom-style variable (see below)
|
||||
*omega* values = Wx Wy Wz
|
||||
Wx,Wy,Wz = components of angular velocity vector (radians/time units)
|
||||
any of Wx,Wy,Wz can be an atom-style variable (see below)
|
||||
*quat* values = a b c theta
|
||||
a,b,c = unit vector to rotate particle around via right-hand rule
|
||||
theta = rotation angle (degrees)
|
||||
any of a,b,c,theta values can be an atom-style variable (see below)
|
||||
*quat/random* value = seed
|
||||
seed = random # seed (positive integer) for quaternion orientations
|
||||
*radius/electron* value = eradius
|
||||
eradius = electron radius (or fixed-core radius) (distance units)
|
||||
value can be an atom-style variable (see below)
|
||||
*shape* values = Sx Sy Sz
|
||||
Sx,Sy,Sz = 3 diameters of ellipsoid (distance units)
|
||||
any of Sx,Sy,Sz can be an atom-style variable (see below)
|
||||
*smd/contact/radius* value = radius for short range interactions, i.e. contact and friction
|
||||
value can be an atom-style variable (see below)
|
||||
*smd/mass/density* value = set particle mass based on volume by providing a mass density
|
||||
value can be an atom-style variable (see below)
|
||||
*sph/cv* value = heat capacity of SPH particles (need units)
|
||||
value can be an atom-style variable (see below)
|
||||
*sph/e* value = energy of SPH particles (need units)
|
||||
value can be an atom-style variable (see below)
|
||||
*sph/rho* value = density of SPH particles (need units)
|
||||
value can be an atom-style variable (see below)
|
||||
*spin/atom* values = g x y z
|
||||
g = magnitude of magnetic spin vector (in Bohr magneton's unit)
|
||||
x,y,z = orientation of magnetic spin vector
|
||||
any of x,y,z can be an atom-style variable (see below)
|
||||
*spin/atom/random* values = seed Dlen
|
||||
seed = random # seed (positive integer) for magnetic spin orientations
|
||||
Dlen = magnitude of magnetic spin vector (in Bohr magneton's unit)
|
||||
*spin/electron* value = espin
|
||||
espin = electron spin (+1/-1), 0 = nuclei, 2 = fixed-core, 3 = pseudo-cores (i.e. ECP)
|
||||
value can be an atom-style variable (see below)
|
||||
*temperature* value = temperature for finite-size particles (temperature units)
|
||||
value can be an atom-style variable (see below)
|
||||
*theta* value = angle (degrees)
|
||||
angle = orientation of line segment with respect to x-axis
|
||||
value can be an atom-style variable (see below)
|
||||
*theta/random* value = seed
|
||||
seed = random # seed (positive integer) for line segment orienations
|
||||
*tri* value = side
|
||||
side = side length of equilateral triangle (distance units)
|
||||
value can be an atom-style variable (see below)
|
||||
*type* value = numeric atom type or type label
|
||||
value can be an atom-style variable (see below)
|
||||
*type/fraction* values = type fraction seed
|
||||
@ -51,104 +144,22 @@ Syntax
|
||||
type = numeric atom type or type label
|
||||
Nsubset = exact number of selected atoms to set to new atom type
|
||||
seed = random # seed (positive integer)
|
||||
*mol* value = molecule ID
|
||||
value can be an atom-style variable (see below)
|
||||
*x*,\ *y*,\ *z* value = atom coordinate (distance units)
|
||||
*volume* value = particle volume for Peridynamic particle (distance\^3 units)
|
||||
value can be an atom-style variable (see below)
|
||||
*vx*,\ *vy*,\ *vz* value = atom velocity (velocity units)
|
||||
value can be an atom-style variable (see below)
|
||||
*charge* value = atomic charge (charge units)
|
||||
*x*,\ *y*,\ *z* value = atom coordinate (distance units)
|
||||
value can be an atom-style variable (see below)
|
||||
*dipole* values = x y z
|
||||
x,y,z = orientation of dipole moment vector
|
||||
any of x,y,z can be an atom-style variable (see below)
|
||||
*dipole/random* value = seed Dlen
|
||||
seed = random # seed (positive integer) for dipole moment orientations
|
||||
Dlen = magnitude of dipole moment (dipole units)
|
||||
*spin/atom* values = g x y z
|
||||
g = magnitude of magnetic spin vector (in Bohr magneton's unit)
|
||||
x,y,z = orientation of magnetic spin vector
|
||||
any of x,y,z can be an atom-style variable (see below)
|
||||
*spin/atom/random* value = seed Dlen
|
||||
seed = random # seed (positive integer) for magnetic spin orientations
|
||||
Dlen = magnitude of magnetic spin vector (in Bohr magneton's unit)
|
||||
*radius/electron* values = eradius
|
||||
eradius = electron radius (or fixed-core radius) (distance units)
|
||||
*spin/electron* value = espin
|
||||
espin = electron spin (+1/-1), 0 = nuclei, 2 = fixed-core, 3 = pseudo-cores (i.e. ECP)
|
||||
*quat* values = a b c theta
|
||||
a,b,c = unit vector to rotate particle around via right-hand rule
|
||||
theta = rotation angle (degrees)
|
||||
any of a,b,c,theta can be an atom-style variable (see below)
|
||||
*quat/random* value = seed
|
||||
seed = random # seed (positive integer) for quaternion orientations
|
||||
*diameter* value = diameter of spherical particle (distance units)
|
||||
value can be an atom-style variable (see below)
|
||||
*shape* value = Sx Sy Sz
|
||||
Sx,Sy,Sz = 3 diameters of ellipsoid (distance units)
|
||||
*length* value = len
|
||||
len = length of line segment (distance units)
|
||||
len can be an atom-style variable (see below)
|
||||
*tri* value = side
|
||||
side = side length of equilateral triangle (distance units)
|
||||
side can be an atom-style variable (see below)
|
||||
*theta* value = angle (degrees)
|
||||
angle = orientation of line segment with respect to x-axis
|
||||
angle can be an atom-style variable (see below)
|
||||
*theta/random* value = seed
|
||||
seed = random # seed (positive integer) for line segment orienations
|
||||
*angmom* values = Lx Ly Lz
|
||||
Lx,Ly,Lz = components of angular momentum vector (distance-mass-velocity units)
|
||||
any of Lx,Ly,Lz can be an atom-style variable (see below)
|
||||
*omega* values = Wx Wy Wz
|
||||
Wx,Wy,Wz = components of angular velocity vector (radians/time units)
|
||||
any of wx,wy,wz can be an atom-style variable (see below)
|
||||
*mass* value = per-atom mass (mass units)
|
||||
value can be an atom-style variable (see below)
|
||||
*density* value = particle density for a sphere or ellipsoid (mass/distance\^3 units), or for a triangle (mass/distance\^2 units) or line (mass/distance units) particle
|
||||
value can be an atom-style variable (see below)
|
||||
*density/disc* value = particle density for a 2d disc or ellipse (mass/distance\^2 units)
|
||||
value can be an atom-style variable (see below)
|
||||
*temperature* value = temperature for finite-size particles (temperature units)
|
||||
value can be an atom-style variable (see below)
|
||||
*volume* value = particle volume for Peridynamic particle (distance\^3 units)
|
||||
value can be an atom-style variable (see below)
|
||||
*image* nx ny nz
|
||||
nx,ny,nz = which periodic image of the simulation box the atom is in
|
||||
any of nx,ny,nz can be an atom-style variable (see below)
|
||||
*bond* value = numeric bond type or bond type label, for all bonds between selected atoms
|
||||
*angle* value = numeric angle type or angle type label, for all angles between selected atoms
|
||||
*dihedral* value = numeric dihedral type or dihedral type label, for all dihedrals between selected atoms
|
||||
*improper* value = numeric improper type or improper type label, for all impropers between selected atoms
|
||||
*rheo/rho* value = density of RHEO particles (mass/distance\^3)
|
||||
*rheo/status* value = status or phase of RHEO particles (unitless)
|
||||
*sph/e* value = energy of SPH particles (need units)
|
||||
value can be an atom-style variable (see below)
|
||||
*sph/cv* value = heat capacity of SPH particles (need units)
|
||||
value can be an atom-style variable (see below)
|
||||
*sph/rho* value = density of SPH particles (need units)
|
||||
value can be an atom-style variable (see below)
|
||||
*smd/contact/radius* = radius for short range interactions, i.e. contact and friction
|
||||
value can be an atom-style variable (see below)
|
||||
*smd/mass/density* = set particle mass based on volume by providing a mass density
|
||||
value can be an atom-style variable (see below)
|
||||
*dpd/theta* value = internal temperature of DPD particles (temperature units)
|
||||
value can be an atom-style variable (see below)
|
||||
value can be NULL which sets internal temp of each particle to KE temp
|
||||
*edpd/temp* value = temperature of eDPD particles (temperature units)
|
||||
value can be an atom-style variable (see below)
|
||||
*edpd/cv* value = volumetric heat capacity of eDPD particles (energy/temperature/volume units)
|
||||
value can be an atom-style variable (see below)
|
||||
*cc* values = index cc
|
||||
index = index of a chemical species (1 to Nspecies)
|
||||
cc = chemical concentration of tDPD particles for a species (mole/volume units)
|
||||
*epsilon* value = dielectric constant of the medium where the atoms reside
|
||||
*i_name* value = custom integer vector with name
|
||||
value can be an atom-style variable (see below)
|
||||
*d_name* value = custom floating-point vector with name
|
||||
*i2_name* value = column of a custom integer array with name
|
||||
value can be an atom-style variable (see below)
|
||||
*i2_name* value = custom integer array with name
|
||||
column specified as i2_name[N] where N is 1 to Ncol
|
||||
*d2_name* value = column of a custom floating-point array with name
|
||||
value can be an atom-style variable (see below)
|
||||
*d2_name* value = custom floating-point array with name
|
||||
column specified as d2_name[N] where N is 1 to Ncol
|
||||
value can be an atom-style variable (see below)
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -177,22 +188,26 @@ Description
|
||||
|
||||
Set one or more properties of one or more atoms. Since atom
|
||||
properties are initially assigned by the :doc:`read_data <read_data>`,
|
||||
:doc:`read_restart <read_restart>` or :doc:`create_atoms <create_atoms>`
|
||||
commands, this command changes those assignments. This can be useful
|
||||
for overriding the default values assigned by the
|
||||
:doc:`create_atoms <create_atoms>` command (e.g. charge = 0.0). It can
|
||||
be useful for altering pairwise and molecular force interactions,
|
||||
:doc:`read_restart <read_restart>` or :doc:`create_atoms
|
||||
<create_atoms>` commands, this command changes those assignments.
|
||||
This can be useful for overriding the default values assigned by the
|
||||
:doc:`create_atoms <create_atoms>` command (e.g. charge = 0.0). It
|
||||
can be useful for altering pairwise and molecular force interactions,
|
||||
since force-field coefficients are defined in terms of types. It can
|
||||
be used to change the labeling of atoms by atom type or molecule ID
|
||||
when they are output in :doc:`dump <dump>` files. It can also be useful
|
||||
for debugging purposes; i.e. positioning an atom at a precise location
|
||||
to compute subsequent forces or energy.
|
||||
when they are output in :doc:`dump <dump>` files. It can also be
|
||||
useful for debugging purposes; i.e. positioning an atom at a precise
|
||||
location to compute subsequent forces or energy.
|
||||
|
||||
Note that the *style* and *ID* arguments determine which atoms have
|
||||
their properties reset. The remaining keywords specify which
|
||||
properties to reset and what the new values are. Some strings like
|
||||
*type* or *mol* can be used as a style and/or a keyword.
|
||||
|
||||
The :doc:`fix set <fix_set>` command can be used with similar syntax
|
||||
to this command to reset atom properties once every *N* steps during a
|
||||
simulation using via atom-style variables.
|
||||
|
||||
----------
|
||||
|
||||
This section describes how to select which atoms to change
|
||||
@ -211,8 +226,8 @@ can be specified, e.g. "C". The style *mol* selects all the atoms in
|
||||
a range of molecule IDs.
|
||||
|
||||
In each of the range cases, the range can be specified as a single
|
||||
numeric value, or a wildcard asterisk can be used to specify a range
|
||||
of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For
|
||||
numeric value, or with a wildcard asterisk to specify a range of
|
||||
values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For
|
||||
example, for the style *type*, if N = the number of atom types, then
|
||||
an asterisk with no numeric values means all types from 1 to N. A
|
||||
leading asterisk means all types from 1 to n (inclusive). A trailing
|
||||
@ -222,25 +237,25 @@ means all types from m to n (inclusive). For all the styles except
|
||||
|
||||
The style *group* selects all the atoms in the specified group. The
|
||||
style *region* selects all the atoms in the specified geometric
|
||||
region. See the :doc:`group <group>` and :doc:`region <region>` commands
|
||||
for details of how to specify a group or region.
|
||||
region. See the :doc:`group <group>` and :doc:`region <region>`
|
||||
commands for details of how to specify a group or region.
|
||||
|
||||
----------
|
||||
|
||||
This section describes the keyword options for which properties to
|
||||
The next section describes the keyword options for which properties to
|
||||
change, for the selected atoms.
|
||||
|
||||
Note that except where explicitly prohibited below, all of the
|
||||
keywords allow an :doc:`atom-style or atomfile-style variable
|
||||
<variable>` to be used as the specified value(s). If the value is a
|
||||
variable, it should be specified as v_name, where name is the
|
||||
variable name. In this case, the variable will be evaluated, and its
|
||||
resulting per-atom value used to determine the value assigned to each
|
||||
selected atom. Note that the per-atom value from the variable will be
|
||||
ignored for atoms that are not selected via the *style* and *ID*
|
||||
settings explained above. A simple way to use per-atom values from
|
||||
the variable to reset a property for all atoms is to use style *atom*
|
||||
with *ID* = "\*"; this selects all atom IDs.
|
||||
variable, it should be specified as v_name, where name is the variable
|
||||
name. In this case, the variable will be evaluated, and its resulting
|
||||
per-atom value used to determine the value assigned to each selected
|
||||
atom. Note that the per-atom value from the variable will be ignored
|
||||
for atoms that are not selected via the *style* and *ID* settings
|
||||
explained above. A simple way to use per-atom values from the
|
||||
variable to reset a property for all atoms is to use style *atom* with
|
||||
*ID* = "\*"; this selects all atom IDs.
|
||||
|
||||
Atom-style variables can specify formulas with various mathematical
|
||||
functions, and include :doc:`thermo_style <thermo_style>` command
|
||||
@ -256,52 +271,110 @@ from a file.
|
||||
.. note::
|
||||
|
||||
Atom-style and atomfile-style variables return floating point
|
||||
per-atom values. If the values are assigned to an integer variable,
|
||||
such as the molecule ID, then the floating point value is truncated to
|
||||
its integer portion, e.g. a value of 2.6 would become 2.
|
||||
per-atom values. If the values are assigned to an integer
|
||||
variable, such as the molecule ID, then the floating point value is
|
||||
truncated to its integer portion, e.g. a value of 2.6 would
|
||||
become 2.
|
||||
|
||||
----------
|
||||
|
||||
.. versionchanged:: 28Mar2023
|
||||
|
||||
Support for type labels was added for setting atom, bond, angle,
|
||||
dihedral, and improper types
|
||||
Support for type labels was added for setting angle types
|
||||
|
||||
Keyword *type* sets the atom type for all selected atoms. A specified
|
||||
value can be either a numeric atom type or an atom type label. When
|
||||
using a numeric type, the specified value must be from 1 to ntypes,
|
||||
where ntypes was set by the :doc:`create_box <create_box>` command or
|
||||
the *atom types* field in the header of the data file read by the
|
||||
:doc:`read_data <read_data>` command. When using a type label it must
|
||||
have been defined previously. See the :doc:`Howto type labels
|
||||
<Howto_type_labels>` doc page for the allowed syntax of type labels
|
||||
and a general discussion of how type labels can be used.
|
||||
Keyword *angle* sets the angle type of all angles of selected atoms to
|
||||
the specified value. The value can be a numeric type from 1 to
|
||||
nangletypes. Or it can be a angle type label. See the :doc:`Howto
|
||||
type labels <Howto_type_labels>` doc page for the allowed syntax of
|
||||
type labels and a general discussion of how type labels can be used.
|
||||
All atoms in a particular angle must be selected atoms in order for
|
||||
the change to be made. The value of nangletypes was set by the *angle
|
||||
types* field in the header of the data file read by the
|
||||
:doc:`read_data <read_data>` command. This keyword does NOT allow use
|
||||
of an atom-style variable.
|
||||
|
||||
Keyword *type/fraction* sets the atom type for a fraction of the selected
|
||||
atoms. The actual number of atoms changed is not guaranteed
|
||||
to be exactly the specified fraction (0 <= *fraction* <= 1), but
|
||||
should be statistically close. Random numbers are used in such a way
|
||||
that a particular atom is changed or not changed, regardless of how
|
||||
many processors are being used. This keyword does not allow use of an
|
||||
atom-style variable.
|
||||
Keyword *angmom* sets the angular momentum of selected atoms. The
|
||||
particles must be ellipsoids as defined by the :doc:`atom_style
|
||||
ellipsoid <atom_style>` command or triangles as defined by the
|
||||
:doc:`atom_style tri <atom_style>` command. The angular momentum
|
||||
vector of the particles is set to the 3 specified components.
|
||||
|
||||
Keywords *type/ratio* and *type/subset* also set the atom type for a
|
||||
fraction of the selected atoms. The actual number of atoms changed
|
||||
will be exactly the requested number. For *type/ratio* the specified
|
||||
fraction (0 <= *fraction* <= 1) determines the number. For
|
||||
*type/subset*, the specified *Nsubset* is the number. An iterative
|
||||
algorithm is used which ensures the correct number of atoms are
|
||||
selected, in a perfectly random fashion. Which atoms are selected
|
||||
will change with the number of processors used. These keywords do not
|
||||
allow use of an atom-style variable.
|
||||
.. versionchanged:: 28Mar2023
|
||||
|
||||
Keyword *mol* sets the molecule ID for all selected atoms. The
|
||||
:doc:`atom style <atom_style>` being used must support the use of
|
||||
molecule IDs.
|
||||
Support for type labels was added for setting bond types
|
||||
|
||||
Keywords *x*, *y*, *z*, and *charge* set the coordinates or
|
||||
charge of all selected atoms. For *charge*, the :doc:`atom style
|
||||
<atom_style>` being used must support the use of atomic
|
||||
charge. Keywords *vx*, *vy*, and *vz* set the velocities of all
|
||||
selected atoms.
|
||||
Keyword *bond* sets the bond type of all bonds of selected atoms to
|
||||
the specified value. The value can be a numeric type from 1 to
|
||||
nbondtypes. Or it can be a bond type label. See the :doc:`Howto type
|
||||
labels <Howto_type_labels>` doc page for the allowed syntax of type
|
||||
labels and a general discussion of how type labels can be used. All
|
||||
atoms in a particular bond must be selected atoms in order for the
|
||||
change to be made. The value of nbondtypes was set by the *bond
|
||||
types* field in the header of the data file read by the
|
||||
:doc:`read_data <read_data>` command. This keyword does NOT allow use
|
||||
of an atom-style variable.
|
||||
|
||||
Keyword *cc* sets the chemical concentration of a tDPD particle for a
|
||||
specified species as defined by the DPD-MESO package. Currently, only
|
||||
:doc:`atom_style tdpd <atom_style>` defines particles with this
|
||||
attribute. An integer for "index" selects a chemical species (1 to
|
||||
Nspecies) where Nspecies is set by the atom_style command. The value
|
||||
for the chemical concentration must be >= 0.0.
|
||||
|
||||
Keyword *charge* set the charge of all selected atoms. The :doc:`atom
|
||||
style <atom_style>` being used must support the use of atomic charge.
|
||||
|
||||
Keyword *density* or *density/disc* also sets the mass of all selected
|
||||
particles, but in a different way. The particles must have a per-atom
|
||||
mass attribute, as defined by the :doc:`atom_style <atom_style>`
|
||||
command. If the atom has a radius attribute (see :doc:`atom_style
|
||||
sphere <atom_style>`) and its radius is non-zero, its mass is set from
|
||||
the density and particle volume for 3d systems (the input density is
|
||||
assumed to be in mass/distance\^3 units). For 2d, the default is for
|
||||
LAMMPS to model particles with a radius attribute as spheres.
|
||||
However, if the *density/disc* keyword is used, then they can be
|
||||
modeled as 2d discs (circles). Their mass is set from the density and
|
||||
particle area (the input density is assumed to be in mass/distance\^2
|
||||
units).
|
||||
|
||||
If the atom has a shape attribute (see :doc:`atom_style ellipsoid
|
||||
<atom_style>`) and its 3 shape parameters are non-zero, then its mass
|
||||
is set from the density and particle volume (the input density is
|
||||
assumed to be in mass/distance\^3 units). The *density/disc* keyword
|
||||
has no effect; it does not (yet) treat 3d ellipsoids as 2d ellipses.
|
||||
|
||||
If the atom has a length attribute (see :doc:`atom_style line
|
||||
<atom_style>`) and its length is non-zero, then its mass is set from
|
||||
the density and line segment length (the input density is assumed to
|
||||
be in mass/distance units). If the atom has an area attribute (see
|
||||
:doc:`atom_style tri <atom_style>`) and its area is non-zero, then its
|
||||
mass is set from the density and triangle area (the input density is
|
||||
assumed to be in mass/distance\^2 units).
|
||||
|
||||
If none of these cases are valid, then the mass is set to the density
|
||||
value directly (the input density is assumed to be in mass units).
|
||||
|
||||
Keyword *diameter* sets the size of the selected atoms. The particles
|
||||
must be finite-size spheres as defined by the :doc:`atom_style sphere
|
||||
<atom_style>` command. The diameter of a particle can be set to 0.0,
|
||||
which means they will be treated as point particles. Note that this
|
||||
command does not adjust the particle mass, even if it was defined with
|
||||
a density, e.g. via the :doc:`read_data <read_data>` command.
|
||||
|
||||
.. versionchanged:: 28Mar2023
|
||||
|
||||
Support for type labels was added for setting dihedral types
|
||||
|
||||
Keyword *dihedral* sets the dihedral type of all dihedrals of selected
|
||||
atoms to the specified value. The value can be a numeric type from 1
|
||||
to ndihedraltypes. Or it can be a dihedral type label. See the
|
||||
:doc:`Howto type labels <Howto_type_labels>` doc page for the allowed
|
||||
syntax of type labels and a general discussion of how type labels can
|
||||
be used. All atoms in a particular dihedral must be selected atoms in
|
||||
order for the change to be made. The value of ndihedraltypes was set
|
||||
by the *dihedral types* field in the header of the data file read by
|
||||
the :doc:`read_data <read_data>` command. This keyword does NOT allow
|
||||
use of an atom-style variable.
|
||||
|
||||
Keyword *dipole* uses the specified x,y,z values as components of a
|
||||
vector to set as the orientation of the dipole moment vectors of the
|
||||
@ -313,40 +386,106 @@ moment vectors for the selected atoms and sets the magnitude of each
|
||||
to the specified *Dlen* value. For 2d systems, the z component of the
|
||||
orientation is set to 0.0. Random numbers are used in such a way that
|
||||
the orientation of a particular atom is the same, regardless of how
|
||||
many processors are being used. This keyword does not allow use of an
|
||||
many processors are being used. This keyword does NOT allow use of an
|
||||
atom-style variable.
|
||||
|
||||
.. versionchanged:: 15Sep2022
|
||||
Keyword *dpd/theta* sets the internal temperature of a DPD particle as
|
||||
defined by the DPD-REACT package. If the specified value is a number
|
||||
it must be >= 0.0. If the specified value is NULL, then the kinetic
|
||||
temperature Tkin of each particle is computed as 3/2 k Tkin = KE = 1/2
|
||||
m v\^2 = 1/2 m (vx\*vx+vy\*vy+vz\*vz). Each particle's internal
|
||||
temperature is set to Tkin. If the specified value is an atom-style
|
||||
variable, then the variable is evaluated for each particle. If a
|
||||
value >= 0.0, the internal temperature is set to that value. If it is
|
||||
< 0.0, the computation of Tkin is performed and the internal
|
||||
temperature is set to that value.
|
||||
|
||||
Keyword *spin/atom* uses the specified g value to set the magnitude of the
|
||||
magnetic spin vectors, and the x,y,z values as components of a vector
|
||||
to set as the orientation of the magnetic spin vectors of the selected
|
||||
atoms. This keyword was previously called *spin*.
|
||||
Keywords *edpd/temp* and *edpd/cv* set the temperature and volumetric
|
||||
heat capacity of an eDPD particle as defined by the DPD-MESO package.
|
||||
Currently, only :doc:`atom_style edpd <atom_style>` defines particles
|
||||
with these attributes. The values for the temperature and heat
|
||||
capacity must be positive.
|
||||
|
||||
.. versionchanged:: 15Sep2022
|
||||
Keyword *epsilon* sets the dielectric constant of a particle to be
|
||||
that of the medium where the particle resides as defined by the
|
||||
DIELECTRIC package. Currently, only :doc:`atom_style dielectric
|
||||
<atom_style>` defines particles with this attribute. The value for the
|
||||
dielectric constant must be >= 0.0. Note that the set command with
|
||||
this keyword will rescale the particle charge accordingly so that the
|
||||
real charge (e.g., as read from a data file) stays intact. To change
|
||||
the real charges, one needs to use the set command with the *charge*
|
||||
keyword. Care must be taken to ensure that the real and scaled charges
|
||||
and the dielectric constants are consistent.
|
||||
|
||||
Keyword *spin/atom/random* randomizes the orientation of the magnetic spin
|
||||
vectors for the selected atoms and sets the magnitude of each to the
|
||||
specified *Dlen* value. This keyword was previously called *spin/random*.
|
||||
Keyword *image* sets which image of the simulation box the atom is
|
||||
considered to be in. An image of 0 means it is inside the box as
|
||||
defined. A value of 2 means add 2 box lengths to get the true value.
|
||||
A value of -1 means subtract 1 box length to get the true value.
|
||||
LAMMPS updates these flags as atoms cross periodic boundaries during
|
||||
the simulation. The flags can be output with atom snapshots via the
|
||||
:doc:`dump <dump>` command. If a value of NULL is specified for any
|
||||
of nx,ny,nz, then the current image value for that dimension is
|
||||
unchanged. For non-periodic dimensions only a value of 0 can be
|
||||
specified. This command can be useful after a system has been
|
||||
equilibrated and atoms have diffused one or more box lengths in
|
||||
various directions. This command can then reset the image values for
|
||||
atoms so that they are effectively inside the simulation box, e.g if a
|
||||
diffusion coefficient is about to be measured via the :doc:`compute
|
||||
msd <compute_msd>` command. Care should be taken not to reset the
|
||||
image flags of two atoms in a bond to the same value if the bond
|
||||
straddles a periodic boundary (rather they should be different by +/-
|
||||
1). This will not affect the dynamics of a simulation, but may mess
|
||||
up analysis of the trajectories if a LAMMPS diagnostic or your own
|
||||
analysis relies on the image flags to unwrap a molecule which
|
||||
straddles the periodic box.
|
||||
|
||||
.. versionadded:: 15Sep2022
|
||||
.. versionchanged:: 28Mar2023
|
||||
|
||||
Keyword *radius/electron* uses the specified value to set the radius of
|
||||
electrons or fixed cores.
|
||||
Support for type labels was added for setting improper types
|
||||
|
||||
.. versionadded:: 15Sep2022
|
||||
Keyword *improper* sets the improper type of all impropers of selected
|
||||
atoms to the specified value. The value can be a numeric type from 1
|
||||
to nimpropertypes. Or it can be a improper type label. See the
|
||||
:doc:`Howto type labels <Howto_type_labels>` doc page for the allowed
|
||||
syntax of type labels and a general discussion of how type labels can
|
||||
be used. All atoms in a particular improper must be selected atoms in
|
||||
order for the change to be made. The value of nimpropertypes was set
|
||||
by the *improper types* field in the header of the data file read by
|
||||
the :doc:`read_data <read_data>` command. This keyword does NOT allow
|
||||
use of an atom-style variable.
|
||||
|
||||
Keyword *spin/electron* sets the spin of an electron (+/- 1) or indicates
|
||||
nuclei (=0), fixed-cores (=2), or pseudo-cores (= 3).
|
||||
Keyword *length* sets the length of selected atoms. The particles
|
||||
must be line segments as defined by the :doc:`atom_style line
|
||||
<atom_style>` command. If the specified value is non-zero the line
|
||||
segment is (re)set to a length = the specified value, centered around
|
||||
the particle position, with an orientation along the x-axis. If the
|
||||
specified value is 0.0, the particle will become a point particle.
|
||||
Note that this command does not adjust the particle mass, even if it
|
||||
was defined with a density, e.g. via the :doc:`read_data <read_data>`
|
||||
command.
|
||||
|
||||
Keyword *mass* sets the mass of all selected particles. The particles
|
||||
must have a per-atom mass attribute, as defined by the
|
||||
:doc:`atom_style <atom_style>` command. See the "mass" command for
|
||||
how to set mass values on a per-type basis.
|
||||
|
||||
Keyword *mol* sets the molecule ID for all selected atoms. The
|
||||
:doc:`atom style <atom_style>` being used must support the use of
|
||||
molecule IDs.
|
||||
|
||||
Keyword *omega* sets the angular velocity of selected atoms. The
|
||||
particles must be spheres as defined by the :doc:`atom_style sphere
|
||||
<atom_style>` command. The angular velocity vector of the particles
|
||||
is set to the 3 specified components.
|
||||
|
||||
Keyword *quat* uses the specified values to create a quaternion
|
||||
(4-vector) that represents the orientation of the selected atoms. The
|
||||
particles must define a quaternion for their orientation
|
||||
(e.g. ellipsoids, triangles, body particles) as defined by the
|
||||
:doc:`atom_style <atom_style>` command. Note that particles defined by
|
||||
:doc:`atom_style ellipsoid <atom_style>` have 3 shape parameters. The 3
|
||||
values must be non-zero for each particle set by this command. They
|
||||
are used to specify the aspect ratios of an ellipsoidal particle,
|
||||
:doc:`atom_style <atom_style>` command. Note that particles defined
|
||||
by :doc:`atom_style ellipsoid <atom_style>` have 3 shape parameters.
|
||||
The 3 values must be non-zero for each particle set by this command.
|
||||
They are used to specify the aspect ratios of an ellipsoidal particle,
|
||||
which is oriented by default with its x-axis along the simulation
|
||||
box's x-axis, and similarly for y and z. If this body is rotated (via
|
||||
the right-hand rule) by an angle theta around a unit rotation vector
|
||||
@ -360,51 +499,77 @@ ignored, since a rotation vector of (0,0,1) is the only valid choice.
|
||||
Keyword *quat/random* randomizes the orientation of the quaternion for
|
||||
the selected atoms. The particles must define a quaternion for their
|
||||
orientation (e.g. ellipsoids, triangles, body particles) as defined by
|
||||
the :doc:`atom_style <atom_style>` command. Random numbers are used in
|
||||
such a way that the orientation of a particular atom is the same,
|
||||
the :doc:`atom_style <atom_style>` command. Random numbers are used
|
||||
in such a way that the orientation of a particular atom is the same,
|
||||
regardless of how many processors are being used. For 2d systems,
|
||||
only orientations in the xy plane are generated. As with keyword
|
||||
*quat*, for ellipsoidal particles, the 3 shape values must be non-zero
|
||||
for each particle set by this command. This keyword does not allow
|
||||
for each particle set by this command. This keyword does NOT allow
|
||||
use of an atom-style variable.
|
||||
|
||||
Keyword *diameter* sets the size of the selected atoms. The particles
|
||||
must be finite-size spheres as defined by the :doc:`atom_style sphere
|
||||
<atom_style>` command. The diameter of a particle can be set to 0.0,
|
||||
which means they will be treated as point particles. Note that this
|
||||
command does not adjust the particle mass, even if it was defined with
|
||||
a density, e.g. via the :doc:`read_data <read_data>` command.
|
||||
.. versionadded:: 15Sep2022
|
||||
|
||||
Keyword *radius/electron* uses the specified value to set the radius
|
||||
of electrons or fixed cores.
|
||||
|
||||
Keyword *shape* sets the size and shape of the selected atoms. The
|
||||
particles must be ellipsoids as defined by the :doc:`atom_style
|
||||
ellipsoid <atom_style>` command. The *Sx*, *Sy*, *Sz* settings
|
||||
are the 3 diameters of the ellipsoid in each direction. All 3 can be
|
||||
set to the same value, which means the ellipsoid is effectively a
|
||||
sphere. They can also all be set to 0.0 which means the particle will
|
||||
be treated as a point particle. Note that this command does not
|
||||
adjust the particle mass, even if it was defined with a density,
|
||||
e.g. via the :doc:`read_data <read_data>` command.
|
||||
ellipsoid <atom_style>` command. The *Sx*, *Sy*, *Sz* settings are
|
||||
the 3 diameters of the ellipsoid in each direction. All 3 can be set
|
||||
to the same value, which means the ellipsoid is effectively a sphere.
|
||||
They can also all be set to 0.0 which means the particle will be
|
||||
treated as a point particle. Note that this command does not adjust
|
||||
the particle mass, even if it was defined with a density, e.g. via the
|
||||
:doc:`read_data <read_data>` command.
|
||||
|
||||
Keyword *length* sets the length of selected atoms. The particles
|
||||
must be line segments as defined by the :doc:`atom_style line
|
||||
<atom_style>` command. If the specified value is non-zero the line
|
||||
segment is (re)set to a length = the specified value, centered around
|
||||
the particle position, with an orientation along the x-axis. If the
|
||||
specified value is 0.0, the particle will become a point particle.
|
||||
Note that this command does not adjust the particle mass, even if it
|
||||
was defined with a density, e.g. via the :doc:`read_data <read_data>`
|
||||
command.
|
||||
Keyword *smd/contact/radius* only applies to simulations with the
|
||||
Smooth Mach Dynamics package MACHDYN. Itsets an interaction radius
|
||||
for computing short-range interactions, e.g. repulsive forces to
|
||||
prevent different individual physical bodies from penetrating each
|
||||
other. Note that the SPH smoothing kernel diameter used for computing
|
||||
long range, nonlocal interactions, is set using the *diameter*
|
||||
keyword.
|
||||
|
||||
Keyword *tri* sets the size of selected atoms. The particles must be
|
||||
triangles as defined by the :doc:`atom_style tri <atom_style>` command.
|
||||
If the specified value is non-zero the triangle is (re)set to be an
|
||||
equilateral triangle in the xy plane with side length = the specified
|
||||
value, with a centroid at the particle position, with its base
|
||||
parallel to the x axis, and the y-axis running from the center of the
|
||||
base to the top point of the triangle. If the specified value is 0.0,
|
||||
the particle will become a point particle. Note that this command
|
||||
does not adjust the particle mass, even if it was defined with a
|
||||
density, e.g. via the :doc:`read_data <read_data>` command.
|
||||
Keyword *smd/mass/density* sets the mass of all selected particles,
|
||||
but it is only applicable to the Smooth Mach Dynamics package MACHDYN.
|
||||
It assumes that the particle volume has already been correctly set and
|
||||
calculates particle mass from the provided mass density value.
|
||||
|
||||
Keywords *sph/cv*, *sph/e*, and *sph/rho* set the heat capacity,
|
||||
energy, and density of smoothed particle hydrodynamics (SPH)
|
||||
particles. See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to
|
||||
using SPH in LAMMPS.
|
||||
|
||||
.. note::
|
||||
|
||||
Note that the SPH PDF guide file has not been updated for many
|
||||
years and thus does not reflect the current *syntax* of the SPH
|
||||
package commands. For that, please refer to the LAMMPS manual.
|
||||
|
||||
.. versionchanged:: 15Sep2022
|
||||
|
||||
Keyword *spin/atom* uses the specified g value to set the magnitude of
|
||||
the magnetic spin vectors, and the x,y,z values as components of a
|
||||
vector to set as the orientation of the magnetic spin vectors of the
|
||||
selected atoms. This keyword was previously called *spin*.
|
||||
|
||||
.. versionchanged:: 15Sep2022
|
||||
|
||||
Keyword *spin/atom/random* randomizes the orientation of the magnetic
|
||||
spin vectors for the selected atoms and sets the magnitude of each to
|
||||
the specified *Dlen* value. This keyword does NOT allow use of an
|
||||
atom-style variable. This keyword was previously called
|
||||
*spin/random*.
|
||||
|
||||
.. versionadded:: 15Sep2022
|
||||
|
||||
Keyword *spin/electron* sets the spin of an electron (+/- 1) or
|
||||
indicates nuclei (=0), fixed-cores (=2), or pseudo-cores (= 3).
|
||||
|
||||
Keyword *temperature* sets the temperature of a finite-size particle.
|
||||
Currently, only the GRANULAR package supports this attribute. The
|
||||
temperature must be added using an instance of :doc:`fix property/atom
|
||||
<fix_property_atom>` The values for the temperature must be positive.
|
||||
|
||||
Keyword *theta* sets the orientation of selected atoms. The particles
|
||||
must be line segments as defined by the :doc:`atom_style line
|
||||
@ -413,169 +578,78 @@ orientation angle of the line segments with respect to the x axis.
|
||||
|
||||
Keyword *theta/random* randomizes the orientation of theta for the
|
||||
selected atoms. The particles must be line segments as defined by the
|
||||
:doc:`atom_style line <atom_style>` command. Random numbers are used in
|
||||
such a way that the orientation of a particular atom is the same,
|
||||
:doc:`atom_style line <atom_style>` command. Random numbers are used
|
||||
in such a way that the orientation of a particular atom is the same,
|
||||
regardless of how many processors are being used. This keyword does
|
||||
not allow use of an atom-style variable.
|
||||
NOT allow use of an atom-style variable.
|
||||
|
||||
Keyword *angmom* sets the angular momentum of selected atoms. The
|
||||
particles must be ellipsoids as defined by the :doc:`atom_style
|
||||
ellipsoid <atom_style>` command or triangles as defined by the
|
||||
:doc:`atom_style tri <atom_style>` command. The angular momentum
|
||||
vector of the particles is set to the 3 specified components.
|
||||
Keyword *tri* sets the size of selected atoms. The particles must be
|
||||
triangles as defined by the :doc:`atom_style tri <atom_style>`
|
||||
command. If the specified value is non-zero the triangle is (re)set
|
||||
to be an equilateral triangle in the xy plane with side length = the
|
||||
specified value, with a centroid at the particle position, with its
|
||||
base parallel to the x axis, and the y-axis running from the center of
|
||||
the base to the top point of the triangle. If the specified value is
|
||||
0.0, the particle will become a point particle. Note that this
|
||||
command does not adjust the particle mass, even if it was defined with
|
||||
a density, e.g. via the :doc:`read_data <read_data>` command.
|
||||
|
||||
Keyword *omega* sets the angular velocity of selected atoms. The
|
||||
particles must be spheres as defined by the :doc:`atom_style sphere
|
||||
<atom_style>` command. The angular velocity vector of the particles is
|
||||
set to the 3 specified components.
|
||||
.. versionchanged:: 28Mar2023
|
||||
|
||||
Keyword *mass* sets the mass of all selected particles. The particles
|
||||
must have a per-atom mass attribute, as defined by the :doc:`atom_style
|
||||
<atom_style>` command. See the "mass" command for how to set mass
|
||||
values on a per-type basis.
|
||||
Support for type labels was added for setting atom types
|
||||
|
||||
Keyword *density* or *density/disc* also sets the mass of all selected
|
||||
particles, but in a different way. The particles must have a per-atom
|
||||
mass attribute, as defined by the :doc:`atom_style <atom_style>`
|
||||
command. If the atom has a radius attribute (see :doc:`atom_style
|
||||
sphere <atom_style>`) and its radius is non-zero, its mass is set from
|
||||
the density and particle volume for 3d systems (the input density is
|
||||
assumed to be in mass/distance\^3 units). For 2d, the default is for
|
||||
LAMMPS to model particles with a radius attribute as spheres. However,
|
||||
if the *density/disc* keyword is used, then they can be modeled as 2d
|
||||
discs (circles). Their mass is set from the density and particle area
|
||||
(the input density is assumed to be in mass/distance\^2 units).
|
||||
|
||||
If the atom has a shape attribute (see :doc:`atom_style ellipsoid
|
||||
<atom_style>`) and its 3 shape parameters are non-zero, then its mass is
|
||||
set from the density and particle volume (the input density is assumed
|
||||
to be in mass/distance\^3 units). The *density/disc* keyword has no
|
||||
effect; it does not (yet) treat 3d ellipsoids as 2d ellipses.
|
||||
|
||||
If the atom has a length attribute (see :doc:`atom_style line
|
||||
<atom_style>`) and its length is non-zero, then its mass is set from the
|
||||
density and line segment length (the input density is assumed to be in
|
||||
mass/distance units). If the atom has an area attribute (see
|
||||
:doc:`atom_style tri <atom_style>`) and its area is non-zero, then its
|
||||
mass is set from the density and triangle area (the input density is
|
||||
assumed to be in mass/distance\^2 units).
|
||||
|
||||
If none of these cases are valid, then the mass is set to the density
|
||||
value directly (the input density is assumed to be in mass units).
|
||||
|
||||
Keyword *temperature* sets the temperature of a finite-size particle.
|
||||
Currently, only the GRANULAR package supports this attribute. The
|
||||
temperature must be added using an instance of
|
||||
:doc:`fix property/atom <fix_property_atom>` The values for the
|
||||
temperature must be positive.
|
||||
|
||||
Keyword *volume* sets the volume of all selected particles. Currently,
|
||||
only the :doc:`atom_style peri <atom_style>` command defines particles
|
||||
with a volume attribute. Note that this command does not adjust the
|
||||
particle mass.
|
||||
|
||||
Keyword *image* sets which image of the simulation box the atom is
|
||||
considered to be in. An image of 0 means it is inside the box as
|
||||
defined. A value of 2 means add 2 box lengths to get the true value. A
|
||||
value of -1 means subtract 1 box length to get the true value. LAMMPS
|
||||
updates these flags as atoms cross periodic boundaries during the
|
||||
simulation. The flags can be output with atom snapshots via the
|
||||
:doc:`dump <dump>` command. If a value of NULL is specified for any of
|
||||
nx,ny,nz, then the current image value for that dimension is unchanged.
|
||||
For non-periodic dimensions only a value of 0 can be specified. This
|
||||
command can be useful after a system has been equilibrated and atoms
|
||||
have diffused one or more box lengths in various directions. This
|
||||
command can then reset the image values for atoms so that they are
|
||||
effectively inside the simulation box, e.g if a diffusion coefficient is
|
||||
about to be measured via the :doc:`compute msd <compute_msd>` command.
|
||||
Care should be taken not to reset the image flags of two atoms in a bond
|
||||
to the same value if the bond straddles a periodic boundary (rather they
|
||||
should be different by +/- 1). This will not affect the dynamics of a
|
||||
simulation, but may mess up analysis of the trajectories if a LAMMPS
|
||||
diagnostic or your own analysis relies on the image flags to unwrap a
|
||||
molecule which straddles the periodic box.
|
||||
|
||||
Keywords *bond*, *angle*, *dihedral*, and *improper*, set the bond
|
||||
type (angle type, etc) of all bonds (angles, etc) of selected atoms to
|
||||
the specified value. The value can be a numeric type from 1 to
|
||||
nbondtypes (nangletypes, etc). Or it can be a type label (bond type
|
||||
label, angle type label, etc). See the :doc:`Howto type labels
|
||||
Keyword *type* sets the atom type for all selected atoms. A specified
|
||||
value can be either a numeric atom type or an atom type label. When
|
||||
using a numeric type, the specified value must be from 1 to ntypes,
|
||||
where ntypes was set by the :doc:`create_box <create_box>` command or
|
||||
the *atom types* field in the header of the data file read by the
|
||||
:doc:`read_data <read_data>` command. When using a type label it must
|
||||
have been defined previously. See the :doc:`Howto type labels
|
||||
<Howto_type_labels>` doc page for the allowed syntax of type labels
|
||||
and a general discussion of how type labels can be used. All atoms in
|
||||
a particular bond (angle, etc) must be selected atoms in order for the
|
||||
change to be made. The value of nbondtypes (nangletypes, etc) was set
|
||||
by the *bond types* (\ *angle types*, etc) field in the header of the
|
||||
data file read by the :doc:`read_data <read_data>` command. These
|
||||
keywords do not allow use of an atom-style variable.
|
||||
and a general discussion of how type labels can be used.
|
||||
|
||||
Keywords *rheo/rho* and *rheo/status* set the density and the status of
|
||||
rheo particles. In particular, one can only set the phase in the status
|
||||
as described by the :doc:`RHEO howto page <Howto_rheo>`.
|
||||
Keyword *type/fraction* sets the atom type for a fraction of the
|
||||
selected atoms. The actual number of atoms changed is not guaranteed
|
||||
to be exactly the specified fraction (0 <= *fraction* <= 1), but
|
||||
should be statistically close. Random numbers are used in such a way
|
||||
that a particular atom is changed or not changed, regardless of how
|
||||
many processors are being used. This keyword does NOT allow use of an
|
||||
atom-style variable.
|
||||
|
||||
Keywords *sph/e*, *sph/cv*, and *sph/rho* set the energy, heat capacity,
|
||||
and density of smoothed particle hydrodynamics (SPH) particles. See
|
||||
`this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in LAMMPS.
|
||||
Keywords *type/ratio* and *type/subset* also set the atom type for a
|
||||
fraction of the selected atoms. The actual number of atoms changed
|
||||
will be exactly the requested number. For *type/ratio* the specified
|
||||
fraction (0 <= *fraction* <= 1) determines the number. For
|
||||
*type/subset*, the specified *Nsubset* is the number. An iterative
|
||||
algorithm is used which ensures the correct number of atoms are
|
||||
selected, in a perfectly random fashion. Which atoms are selected
|
||||
will change with the number of processors used. These keywords do not
|
||||
allow use of an atom-style variable.
|
||||
|
||||
.. note::
|
||||
Keyword *volume* sets the volume of all selected particles.
|
||||
Currently, only the :doc:`atom_style peri <atom_style>` command
|
||||
defines particles with a volume attribute. Note that this command
|
||||
does not adjust the particle mass.
|
||||
|
||||
Please note that the SPH PDF guide file has not been updated for
|
||||
many years and thus does not reflect the current *syntax* of the
|
||||
SPH package commands. For that please refer to the LAMMPS manual.
|
||||
Keywords *vx*, *vy*, and *vz* set the velocities of all selected
|
||||
atoms.
|
||||
|
||||
Keyword *smd/mass/density* sets the mass of all selected particles, but
|
||||
it is only applicable to the Smooth Mach Dynamics package MACHDYN. It
|
||||
assumes that the particle volume has already been correctly set and
|
||||
calculates particle mass from the provided mass density value.
|
||||
Keywords *x*, *y*, *z* set the coordinates of all selected atoms.
|
||||
|
||||
Keyword *smd/contact/radius* only applies to simulations with the Smooth
|
||||
Mach Dynamics package MACHDYN. Itsets an interaction radius for
|
||||
computing short-range interactions, e.g. repulsive forces to prevent
|
||||
different individual physical bodies from penetrating each other. Note
|
||||
that the SPH smoothing kernel diameter used for computing long range,
|
||||
nonlocal interactions, is set using the *diameter* keyword.
|
||||
|
||||
Keyword *dpd/theta* sets the internal temperature of a DPD particle as
|
||||
defined by the DPD-REACT package. If the specified value is a number it
|
||||
must be >= 0.0. If the specified value is NULL, then the kinetic
|
||||
temperature Tkin of each particle is computed as 3/2 k Tkin = KE = 1/2 m
|
||||
v\^2 = 1/2 m (vx\*vx+vy\*vy+vz\*vz). Each particle's internal
|
||||
temperature is set to Tkin. If the specified value is an atom-style
|
||||
variable, then the variable is evaluated for each particle. If a value
|
||||
>= 0.0, the internal temperature is set to that value. If it is < 0.0,
|
||||
the computation of Tkin is performed and the internal temperature is set
|
||||
to that value.
|
||||
|
||||
Keywords *edpd/temp* and *edpd/cv* set the temperature and volumetric
|
||||
heat capacity of an eDPD particle as defined by the DPD-MESO package.
|
||||
Currently, only :doc:`atom_style edpd <atom_style>` defines particles
|
||||
with these attributes. The values for the temperature and heat capacity
|
||||
must be positive.
|
||||
|
||||
Keyword *cc* sets the chemical concentration of a tDPD particle for a
|
||||
specified species as defined by the DPD-MESO package. Currently, only
|
||||
:doc:`atom_style tdpd <atom_style>` defines particles with this
|
||||
attribute. An integer for "index" selects a chemical species (1 to
|
||||
Nspecies) where Nspecies is set by the atom_style command. The value for
|
||||
the chemical concentration must be >= 0.0.
|
||||
|
||||
Keyword *epsilon* sets the dielectric constant of a particle, precisely
|
||||
of the medium where the particle resides as defined by the DIELECTRIC
|
||||
package. Currently, only :doc:`atom_style dielectric <atom_style>`
|
||||
defines particles with this attribute. The value for the dielectric
|
||||
constant must be >= 0.0. Note that the set command with this keyword
|
||||
will rescale the particle charge accordingly so that the real charge
|
||||
(e.g., as read from a data file) stays intact. To change the real
|
||||
charges, one needs to use the set command with the *charge*
|
||||
keyword. Care must be taken to ensure that the real and scaled charges,
|
||||
and dielectric constants are consistent.
|
||||
Keyword *apip/lambda* sets the switching parameter of an
|
||||
adaptive-precision interatomic potential (:doc:`APIP <Howto_apip>`).
|
||||
The precise potential is used for an atom when its switching parameter
|
||||
:math:`\lambda` is 0. The fast potential is used for an atom when its
|
||||
switching parameter :math:`\lambda` is 1. Both potentials are partially
|
||||
used for :math:`\lambda\in(0,1)`.
|
||||
|
||||
Keywords *i_name*, *d_name*, *i2_name*, *d2_name* refer to custom
|
||||
per-atom integer and floating-point vectors or arrays that have been
|
||||
added via the :doc:`fix property/atom <fix_property_atom>` command.
|
||||
When that command is used specific names are given to each attribute
|
||||
which are the "name" portion of these keywords. For arrays *i2_name*
|
||||
and *d2_name*, the column of the array must also be included following
|
||||
the name in brackets: e.g. d2_xyz[2], i2_mySpin[3].
|
||||
and *d2_name*, the column of the array to set must also be included
|
||||
following the name in brackets: e.g. d2_xyz[2] or i2_mySpin[3].
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
@ -584,7 +658,7 @@ You cannot set an atom attribute (e.g. *mol* or *q* or *volume*\ ) if
|
||||
the :doc:`atom_style <atom_style>` does not have that attribute.
|
||||
|
||||
This command requires inter-processor communication to coordinate the
|
||||
setting of bond types (angle types, etc). This means that your system
|
||||
setting of bond types (angle types, etc). This means that the system
|
||||
must be ready to perform a simulation before using one of these
|
||||
keywords (force fields set, atom mass set, etc). This is not
|
||||
necessary for other keywords.
|
||||
@ -599,7 +673,7 @@ Related commands
|
||||
""""""""""""""""
|
||||
|
||||
:doc:`create_box <create_box>`, :doc:`create_atoms <create_atoms>`,
|
||||
:doc:`read_data <read_data>`
|
||||
:doc:`read_data <read_data>`, :doc:`fix set <fix_set>`
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
@ -45,7 +45,8 @@ Syntax
|
||||
*universe* args = one or more strings
|
||||
*world* args = one string for each partition of processors
|
||||
|
||||
*equal* or *vector* or *atom* args = one formula containing numbers, thermo keywords, math operations, built-in functions, atom values and vectors, compute/fix/variable references
|
||||
*equal* or *vector* or *atom* args = one formula containing numbers, thermo keywords,
|
||||
math operations, built-in functions, atom values and vectors, compute/fix/variable references
|
||||
numbers = 0.0, 100, -5.4, 2.8e-4, etc
|
||||
constants = PI, version, on, off, true, false, yes, no
|
||||
thermo keywords = vol, ke, press, etc from :doc:`thermo_style <thermo_style>`
|
||||
@ -67,8 +68,13 @@ 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), sort(x), rsort(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label), is_typelabel(kind,label), is_timeout()
|
||||
feature functions = is_available(category,feature), is_active(category,feature), is_defined(category,id)
|
||||
special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), sort(x), rsort(x),
|
||||
gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name),
|
||||
extract_setting(name), label2type(kind,label),
|
||||
is_typelabel(kind,label), is_timeout()
|
||||
feature functions = is_available(category,feature), is_active(category,feature),
|
||||
is_defined(category,id)
|
||||
python function wrapper = py_varname(x,y,z,...)
|
||||
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, radius, q, x, y, z, vx, vy, vz, fx, fy, fz
|
||||
custom atom property = i_name, d_name, i_name[i], d_name[i], i2_name[i], d2_name[i], i2_name[i][j], d2_name[i][j]
|
||||
@ -127,18 +133,21 @@ command), or used as input to an averaging fix (see the :doc:`fix
|
||||
ave/time <fix_ave_time>` command). Variables of style *vector* store
|
||||
a formula which produces a vector of such values which can be used as
|
||||
input to various averaging fixes, or elements of which can be part of
|
||||
thermodynamic output. Variables of style *atom* store a formula which
|
||||
when evaluated produces one numeric value per atom which can be output
|
||||
to a dump file (see the :doc:`dump custom <dump>` command) or used as
|
||||
input to an averaging fix (see the :doc:`fix ave/chunk
|
||||
<fix_ave_chunk>` and :doc:`fix ave/atom <fix_ave_atom>` commands).
|
||||
Variables of style *atomfile* can be used anywhere in an input script
|
||||
that atom-style variables are used; they get their per-atom values
|
||||
from a file rather than from a formula. Variables of style *python*
|
||||
can be hooked to Python functions using code you provide, so that the
|
||||
variable gets its value from the evaluation of the Python code.
|
||||
Variables of style *internal* are used by a few commands which set
|
||||
their value directly.
|
||||
thermodynamic output.
|
||||
|
||||
Variables of style *atom* store a formula which when evaluated
|
||||
produces one numeric value per atom which can be output to a dump file
|
||||
(see the :doc:`dump custom <dump>` command) or used as input to an
|
||||
averaging fix (see the :doc:`fix ave/chunk <fix_ave_chunk>` and
|
||||
:doc:`fix ave/atom <fix_ave_atom>` commands). Variables of style
|
||||
*atomfile* can be used anywhere in an input script that atom-style
|
||||
variables are used; they get their per-atom values from a file rather
|
||||
than from a formula.
|
||||
|
||||
Variables of style *python* can be hooked to Python functions using
|
||||
Python code you provide, so that the variable gets its value from the
|
||||
evaluation of the Python code. Variables of style *internal* are used
|
||||
by a few commands which set their value directly.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -166,15 +175,16 @@ simulation.
|
||||
|
||||
.. note::
|
||||
|
||||
When an input script line is encountered that defines a variable
|
||||
of style *equal* or *vector* or *atom* or *python* that contains a
|
||||
formula or Python code, the formula is NOT immediately evaluated. It
|
||||
will be evaluated every time when the variable is **used** instead. If
|
||||
you simply want to evaluate a formula in place you can use as
|
||||
so-called. See the section below about "Immediate Evaluation of
|
||||
Variables" for more details on the topic. This is also true of a
|
||||
*format* style variable since it evaluates another variable when it is
|
||||
invoked.
|
||||
When an input script line is encountered that defines a variable of
|
||||
style *equal* or *vector* or *atom* or *python* that contains a
|
||||
formula or links to Python code, the formula or Python code is NOT
|
||||
immediately evaluated. Instead, it is evaluated each time the
|
||||
variable is **used**. If you simply want to evaluate a formula in
|
||||
place you can use a so-called immediate variable. as described in
|
||||
the preceding note. Or see the section below about "Immediate
|
||||
Evaluation of Variables" for more details on the topic. This is
|
||||
also true of a *format* style variable since it evaluates another
|
||||
variable when it is invoked.
|
||||
|
||||
Variables of style *equal* and *vector* and *atom* can be used as
|
||||
inputs to various other commands which evaluate their formulas as
|
||||
@ -183,12 +193,12 @@ this context, variables of style *timer* or *internal* or *python* can
|
||||
be used in place of an equal-style variable, with the following two
|
||||
caveats.
|
||||
|
||||
First, internal-style variables can be used except by commands that
|
||||
set the value stored by the internal variable. When the LAMMPS
|
||||
command evaluates the internal-style variable, it will use the value
|
||||
set (internally) by another command. Second, python-style variables
|
||||
can be used so long as the associated Python function, as defined by
|
||||
the :doc:`python <python>` command, returns a numeric value. When the
|
||||
First, internal-style variables require their values be set by code
|
||||
elsewhere in LAMMPS. When a LAMMPS input script or command evaluates
|
||||
an internal-style variable, it must have a current value set
|
||||
(internally) via that mechanism. Second, python-style variables can
|
||||
be used so long as the associated Python function, as defined by the
|
||||
:doc:`python <python>` command, returns a numeric value. When the
|
||||
LAMMPS command evaluates the python-style variable, the Python
|
||||
function will be executed.
|
||||
|
||||
@ -388,13 +398,24 @@ using the :doc:`command-line switch -var <Run_options>`.
|
||||
|
||||
For the *internal* style a numeric value is provided. This value will
|
||||
be assigned to the variable until a LAMMPS command sets it to a new
|
||||
value. There are currently only two LAMMPS commands that require
|
||||
*internal* variables as inputs, because they reset them:
|
||||
:doc:`create_atoms <create_atoms>` and :doc:`fix controller
|
||||
<fix_controller>`. As mentioned above, an internal-style variable can
|
||||
be used in place of an equal-style variable anywhere else in an input
|
||||
script, e.g. as an argument to another command that allows for
|
||||
equal-style variables.
|
||||
value.
|
||||
|
||||
Note however, that most commands which use internal-style variables do
|
||||
not require them to be defined in the input script. They create one or
|
||||
more internal-style variables if they do not already exist. Examples
|
||||
are these commands:
|
||||
|
||||
* :doc:`create_atoms <create_atoms>`
|
||||
* :doc:`fix deposit <fix_deposit>`
|
||||
* :doc:`compute bond/local <compute_bond_local>`
|
||||
* :doc:`compute angle/local <compute_angle_local>`
|
||||
* :doc:`compute dihedral/local <compute_dihedral_local>`
|
||||
* :doc:`python <python>` command in conjunction with Python function wrappers used in equal- and atom-style variable formulas
|
||||
|
||||
A command which does require an internal-style variable to be defined in
|
||||
the input script is the :doc:`fix controller <fix_controller>` command,
|
||||
because another (arbitrary) command typically also references the
|
||||
variable.
|
||||
|
||||
----------
|
||||
|
||||
@ -439,6 +460,15 @@ python-style variable can be used in place of an equal-style variable
|
||||
anywhere in an input script, e.g. as an argument to another command
|
||||
that allows for equal-style variables.
|
||||
|
||||
A python-style variable can also be used within the formula for an
|
||||
equal-style or atom-style formula in a Python function wrapper, as
|
||||
explained below for variable formulas. In this context, the usage
|
||||
syntax is py_varname(arg1,arg2,...), where varname is the name of the
|
||||
python-style variable. When a Python wrapper function is used in an
|
||||
atom-style formula, it can be invoked once per atom using arguments
|
||||
specific to each atom. The resulting values in the atom-style
|
||||
variable can thus be calculated by Python code.
|
||||
|
||||
----------
|
||||
|
||||
For the *string* style, a single string is assigned to the variable.
|
||||
@ -528,9 +558,9 @@ is a valid (though strange) variable formula:
|
||||
|
||||
Specifically, a formula can contain numbers, constants, thermo
|
||||
keywords, math operators, math functions, group functions, region
|
||||
functions, special functions, feature functions, atom values, atom
|
||||
vectors, custom atom properties, compute references, fix references, and references to other
|
||||
variables.
|
||||
functions, special functions, feature functions, Python function
|
||||
wrappers, atom values, atom vectors, custom atom properties, compute
|
||||
references, fix references, and references to other variables.
|
||||
|
||||
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Number | 0.2, 100, 1.0e20, -15.4, etc |
|
||||
@ -551,6 +581,8 @@ variables.
|
||||
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Feature functions | is_available(category,feature), is_active(category,feature), is_defined(category,id) |
|
||||
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Python func wrapper | py_varname(x,y,z,...) |
|
||||
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Atom values | 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 vectors | id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q |
|
||||
@ -1161,6 +1193,84 @@ variable name.
|
||||
|
||||
----------
|
||||
|
||||
Python Function wrapper
|
||||
------------------------
|
||||
|
||||
A Python function wrapper enables the formula for an equal-style or
|
||||
atom-style variable to invoke functions coded in Python. In the case
|
||||
of an equal-style variable, the Python-coded function will be invoked
|
||||
once. In the case of an atom-style variable, it can be invoked once
|
||||
per atom, if one or more of its arguments include a per-atom quantity,
|
||||
e.g. the position of an atom. As illustrated below, the reason to use
|
||||
a Python function wrapper is to make it easy to pass LAMMPS-related
|
||||
arguments to the Python-coded function associated with a python-style
|
||||
variable.
|
||||
|
||||
The syntax for defining a Python function wrapper is
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
py_varname(arg1,arg2,...argN)
|
||||
|
||||
where *varname* is the name of a python-style variable which couples
|
||||
to a Python-coded function. The function will be passed the zero or
|
||||
more arguments listed in parentheses: *arg1*, *arg2*, ... *argN*. As
|
||||
with Math Functions, each argument can itself be an arbitrarily
|
||||
complex formula.
|
||||
|
||||
A Python function wrapper can be used in the following manner by an
|
||||
input script:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable foo python truncate
|
||||
python truncate return v_foo input 1 v_arg format fi here """
|
||||
def truncate(x):
|
||||
return int(x)
|
||||
"""
|
||||
variable xtrunc atom py_foo(x)
|
||||
variable ytrunc atom py_foo(y)
|
||||
variable ztrunc atom py_foo(z)
|
||||
dump 1 all custom 100 tmp.dump id x y z v_xtrunc v_ytrunc v_ztrunc
|
||||
|
||||
The first two commands define a python-style variable *foo* and couple
|
||||
it to the Python-coded function *truncate()* which takes a single
|
||||
floating point argument, and returns its truncated integer value. In
|
||||
this case, the Python code for truncate() is included in the *python*
|
||||
command; it could also be contained in a file. See the :doc:`python
|
||||
<python>` command doc page for details.
|
||||
|
||||
The next three commands define atom-style variables *xtrunc*,
|
||||
*ytrunc*, and *ztrunc*. Each of them include the same Python function
|
||||
wrapper in their formula, with a different argument. The atom-style
|
||||
variable *xtrunc* will invoke the python-style variable *foo*, which
|
||||
will in turn invoke the Python-coded *truncate()* method. Because
|
||||
*xtrunc* is an atom-style variable, and the argument *x* in the Python
|
||||
function wrapper is a per-atom quantity (the x-coord of each atom),
|
||||
each processor will invoke the *truncate()* method once per atom, for
|
||||
the atoms it owns.
|
||||
|
||||
When invoked for the Ith atom, the value of the *arg* internal-style
|
||||
variable, defined by the *python* command, is set to the x-coord of
|
||||
the Ith atom. The call via python-style variable *foo* to the Python
|
||||
*truncate()* function passes the value of the *arg* variable as the
|
||||
function's first (and only) argument. Likewise, the return value of
|
||||
the Python function is stored by the python-style variable *foo* and
|
||||
used in the *xtrunc* atom-style variable formula for the Ith atom.
|
||||
|
||||
The resulting per-atom vector for *xtrunc* will thus contain the
|
||||
truncated x-coord of every atom in the system. The dump command
|
||||
includes the truncated xyz coords for each atom in its output.
|
||||
|
||||
See the :doc:`python <python>` command for more details on options the
|
||||
*python* command can specify as well as examples of more complex Python
|
||||
functions which can be wrapped in this manner. In particular, the
|
||||
Python function can take a variety of arguments, some generated by the
|
||||
*python* command, and others by the arguments of the Python function
|
||||
wrapper.
|
||||
|
||||
----------
|
||||
|
||||
Atom Values and Vectors
|
||||
-----------------------
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ Sphinx >= 5.3.0, <8.3.0
|
||||
sphinxcontrib-spelling
|
||||
sphinxcontrib-jquery
|
||||
sphinx-design
|
||||
sphinx-toolbox
|
||||
git+https://github.com/akohlmey/sphinx-fortran@parallel-read
|
||||
sphinx-tabs>=3.4.1
|
||||
breathe
|
||||
@ -10,3 +11,4 @@ six
|
||||
pyyaml
|
||||
linkchecker
|
||||
ipython
|
||||
numpy
|
||||
|
||||
@ -50,6 +50,7 @@ extensions = [
|
||||
'sphinx.ext.mathjax',
|
||||
'sphinx.ext.imgmath',
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx_toolbox.collapse',
|
||||
'lammps_theme',
|
||||
'sphinxcontrib.jquery',
|
||||
'sphinxfortran.fortran_domain',
|
||||
@ -370,6 +371,17 @@ latex_elements = {
|
||||
{%
|
||||
\hypersetup{pageanchor=false}% avoid duplicate destination warnings
|
||||
\begin{titlepage}%
|
||||
\sffamily\Large
|
||||
The LAMMPS developers are thinking about dropping the PDF format version of
|
||||
the LAMMPS manual. This would allow us to focus on the HTML version, use
|
||||
HTML-only features, and skip checking if the documentation source files,
|
||||
especially the embedded mathematical expressions, are compatible with \LaTeX{} output.
|
||||
|
||||
Please let us know how you feel about this change by sending an email to
|
||||
\texttt{developers@lammps.org} stating whether you agree or disagree with
|
||||
removing support for the PDF format version of the manual and optionally
|
||||
provide arguments for your preference.
|
||||
\clearpage
|
||||
\sffamily\bfseries
|
||||
\begingroup % for PDF information dictionary
|
||||
\def\endgraf{ }\def\and{\& }%
|
||||
|
||||
@ -33,6 +33,7 @@ activationfunctions
|
||||
acylindricity
|
||||
addforce
|
||||
Addington
|
||||
addstep
|
||||
addtorque
|
||||
adf
|
||||
Adhikari
|
||||
@ -82,6 +83,7 @@ Alessandro
|
||||
Alexey
|
||||
ali
|
||||
aliceblue
|
||||
aliphatic
|
||||
Allera
|
||||
Allinger
|
||||
allocatable
|
||||
@ -103,6 +105,7 @@ Amit
|
||||
amsmath
|
||||
amu
|
||||
Amzallag
|
||||
Anandakrishnan
|
||||
analytical
|
||||
Anders
|
||||
Andric
|
||||
@ -110,6 +113,7 @@ Andrienko
|
||||
Andzelm
|
||||
Ang
|
||||
anglegrad
|
||||
anglelist
|
||||
angleoffset
|
||||
angletangrad
|
||||
angmom
|
||||
@ -132,6 +136,8 @@ anton
|
||||
Antonelli
|
||||
anysize
|
||||
api
|
||||
apip
|
||||
APIP
|
||||
apolar
|
||||
Apoorva
|
||||
Appl
|
||||
@ -227,6 +233,7 @@ Bagi
|
||||
Bagnold
|
||||
Baig
|
||||
Bajaj
|
||||
bak
|
||||
Bal
|
||||
balancer
|
||||
Balankura
|
||||
@ -347,6 +354,7 @@ Bomont
|
||||
BondAngle
|
||||
BondBond
|
||||
bondchk
|
||||
bondlist
|
||||
bondmax
|
||||
bondscreened
|
||||
bondscreenedspin
|
||||
@ -395,6 +403,7 @@ Broglie
|
||||
brownian
|
||||
brownw
|
||||
Broyden
|
||||
Bruenger
|
||||
Bruskin
|
||||
Brusselle
|
||||
Bryantsev
|
||||
@ -524,6 +533,7 @@ civ
|
||||
CKD
|
||||
ckk
|
||||
Clang
|
||||
clearstep
|
||||
clearstore
|
||||
Cleary
|
||||
Clebsch
|
||||
@ -626,6 +636,7 @@ cp
|
||||
cpp
|
||||
cpu
|
||||
cradius
|
||||
Cramer
|
||||
createatoms
|
||||
createAtoms
|
||||
CreateIDs
|
||||
@ -647,6 +658,7 @@ CSiC
|
||||
csld
|
||||
cslib
|
||||
CSlib
|
||||
csp
|
||||
cstdio
|
||||
cstdlib
|
||||
cstring
|
||||
@ -666,6 +678,7 @@ cuFFT
|
||||
CuH
|
||||
Cui
|
||||
Cummins
|
||||
cumulants
|
||||
Cundall
|
||||
cundall
|
||||
Curk
|
||||
@ -819,6 +832,7 @@ diffusively
|
||||
diffusivities
|
||||
diffusivity
|
||||
dihedral
|
||||
dihedrallist
|
||||
dihedrals
|
||||
Dihedrals
|
||||
dihydride
|
||||
@ -1169,6 +1183,7 @@ Fermionic
|
||||
Ferrand
|
||||
fexternal
|
||||
Fexternal
|
||||
ffast
|
||||
ffield
|
||||
ffl
|
||||
fflush
|
||||
@ -1324,7 +1339,6 @@ Geocomputing
|
||||
georg
|
||||
Georg
|
||||
Geotechnica
|
||||
Gergs
|
||||
germain
|
||||
Germann
|
||||
Germano
|
||||
@ -1352,6 +1366,7 @@ Gillan
|
||||
Gingold
|
||||
Gissinger
|
||||
github
|
||||
Giusti
|
||||
GJ
|
||||
gjf
|
||||
gjwagne
|
||||
@ -1374,6 +1389,7 @@ gmres
|
||||
gname
|
||||
gneb
|
||||
GNEB
|
||||
Godehard
|
||||
Goerigk
|
||||
Goga
|
||||
Goldfarb
|
||||
@ -1609,8 +1625,10 @@ Imageint
|
||||
Imagemagick
|
||||
imagename
|
||||
imd
|
||||
Immel
|
||||
Impey
|
||||
impl
|
||||
improperlist
|
||||
impropers
|
||||
Impropers
|
||||
imulator
|
||||
@ -1727,6 +1745,7 @@ Iyz
|
||||
iz
|
||||
izcm
|
||||
ized
|
||||
Izadi
|
||||
Izrailev
|
||||
Izumi
|
||||
Izvekov
|
||||
@ -1763,6 +1782,7 @@ jik
|
||||
JIK
|
||||
jku
|
||||
jN
|
||||
Joanes
|
||||
Joannopoulos
|
||||
Jochim
|
||||
Jonsson
|
||||
@ -1807,6 +1827,7 @@ Karniadakis
|
||||
Karplus
|
||||
Karttunen
|
||||
kate
|
||||
katom
|
||||
Katsnelson
|
||||
Katsura
|
||||
Kaufmann
|
||||
@ -1855,6 +1876,7 @@ Kloss
|
||||
Kloza
|
||||
kmax
|
||||
Kmax
|
||||
kMC
|
||||
KMP
|
||||
kmu
|
||||
Knizhnik
|
||||
@ -1919,6 +1941,7 @@ Lachet
|
||||
Lackmann
|
||||
Ladd
|
||||
lagrangian
|
||||
Lalli
|
||||
lambdai
|
||||
LambdaLanczos
|
||||
Lambrecht
|
||||
@ -1981,6 +2004,7 @@ lennard
|
||||
Lennard
|
||||
Lenosky
|
||||
Lenz
|
||||
Leoni
|
||||
Lett
|
||||
Leuven
|
||||
Leven
|
||||
@ -2182,6 +2206,7 @@ Materias
|
||||
mathbf
|
||||
mathjax
|
||||
matlab
|
||||
Matom
|
||||
Matous
|
||||
matplotlib
|
||||
Matsubara
|
||||
@ -2479,6 +2504,7 @@ namespaces
|
||||
nan
|
||||
NaN
|
||||
Nandor
|
||||
nanglelist
|
||||
nangles
|
||||
Nangletype
|
||||
nangletypes
|
||||
@ -2515,6 +2541,7 @@ nbodies
|
||||
nbody
|
||||
Nbody
|
||||
nbond
|
||||
nbondlist
|
||||
nbonds
|
||||
nbondtype
|
||||
Nbondtype
|
||||
@ -2536,6 +2563,7 @@ ncount
|
||||
nd
|
||||
ndactrung
|
||||
ndescriptors
|
||||
ndihedrallist
|
||||
ndihedrals
|
||||
Ndihedraltype
|
||||
ndihedraltypes
|
||||
@ -2593,6 +2621,7 @@ NiAlH
|
||||
Nicklas
|
||||
Niklasson
|
||||
Nikolskiy
|
||||
nimproperlist
|
||||
nimpropers
|
||||
Nimpropertype
|
||||
nimpropertypes
|
||||
@ -2687,6 +2716,7 @@ Nprocs
|
||||
npt
|
||||
nr
|
||||
Nr
|
||||
Nrecent
|
||||
Nrecompute
|
||||
Nrepeat
|
||||
nreset
|
||||
@ -2765,6 +2795,7 @@ ocl
|
||||
octahedral
|
||||
octants
|
||||
Odegard
|
||||
Og
|
||||
Ohara
|
||||
O'Hearn
|
||||
ohenrich
|
||||
@ -2797,6 +2828,7 @@ oneMKL
|
||||
oneway
|
||||
onlysalt
|
||||
ons
|
||||
Onufriev
|
||||
OO
|
||||
Oord
|
||||
opencl
|
||||
@ -3105,6 +3137,7 @@ Pxy
|
||||
pxz
|
||||
py
|
||||
Py
|
||||
pyargs
|
||||
pydir
|
||||
pylammps
|
||||
PyLammps
|
||||
@ -3345,6 +3378,7 @@ Rmin
|
||||
RMS
|
||||
rmsd
|
||||
rnage
|
||||
rnflag
|
||||
rng
|
||||
rNEMD
|
||||
ro
|
||||
@ -3400,6 +3434,7 @@ ry
|
||||
Ryckaert
|
||||
Rycroft
|
||||
Rydbergs
|
||||
Ryzen
|
||||
rz
|
||||
Rz
|
||||
Sabry
|
||||
@ -3819,6 +3854,8 @@ Thiaville
|
||||
Thibaudeau
|
||||
Thijsse
|
||||
Thirumalai
|
||||
thr
|
||||
Threadripper
|
||||
threebody
|
||||
thrid
|
||||
ThunderX
|
||||
@ -4044,6 +4081,7 @@ Vaiwala
|
||||
valent
|
||||
Valeriu
|
||||
valgrind
|
||||
validator
|
||||
Valone
|
||||
valuev
|
||||
Valuev
|
||||
@ -4053,6 +4091,7 @@ Vanduyfhuys
|
||||
varargs
|
||||
varavg
|
||||
variational
|
||||
varname
|
||||
Varshalovich
|
||||
Varshney
|
||||
vashishta
|
||||
@ -4121,6 +4160,7 @@ volpress
|
||||
volumetric
|
||||
von
|
||||
Voro
|
||||
voro
|
||||
Vorobyov
|
||||
voronoi
|
||||
Voronoi
|
||||
|
||||
@ -27,10 +27,7 @@ if(MSVC)
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
find_package(MPI REQUIRED)
|
||||
# do not include the (obsolete) MPI C++ bindings which makes
|
||||
# for leaner object files and avoids namespace conflicts
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
find_package(MPI REQUIRED COMPONENTS C)
|
||||
|
||||
##########################
|
||||
|
||||
|
||||
@ -79,6 +79,7 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib)
|
||||
ADDSYM(mpi_finalize);
|
||||
ADDSYM(kokkos_finalize);
|
||||
ADDSYM(python_finalize);
|
||||
ADDSYM(plugin_finalize);
|
||||
|
||||
ADDSYM(error);
|
||||
ADDSYM(expand);
|
||||
@ -140,6 +141,7 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib)
|
||||
ADDSYM(scatter_subset);
|
||||
|
||||
ADDSYM(create_atoms);
|
||||
ADDSYM(create_molecule);
|
||||
|
||||
ADDSYM(find_pair_neighlist);
|
||||
ADDSYM(find_fix_neighlist);
|
||||
|
||||
@ -134,6 +134,7 @@ struct _liblammpsplugin {
|
||||
void (*mpi_finalize)();
|
||||
void (*kokkos_finalize)();
|
||||
void (*python_finalize)();
|
||||
void (*plugin_finalize)();
|
||||
|
||||
void (*error)(void *, int, const char *);
|
||||
char *(*expand)(void *, const char *);
|
||||
@ -206,6 +207,7 @@ struct _liblammpsplugin {
|
||||
int (*create_atoms)(void *, int, const int64_t *, const int *, const double *, const double *,
|
||||
const int64_t *, int);
|
||||
#endif
|
||||
int (*create_molecule)(void *, const char *, const char *);
|
||||
|
||||
int (*find_pair_neighlist)(void *, const char *, int, int, int);
|
||||
int (*find_fix_neighlist)(void *, const char *, int);
|
||||
|
||||
@ -25,10 +25,10 @@ if(MSVC)
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
find_package(MPI QUIET)
|
||||
# do not include the (obsolete) MPI C++ bindings which makes
|
||||
# for leaner object files and avoids namespace conflicts
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
find_package(MPI QUIET COMPONENTS C CXX)
|
||||
|
||||
##########################
|
||||
|
||||
|
||||
34
examples/PACKAGES/apip/Cu-1.yace
Normal file
34
examples/PACKAGES/apip/Cu-1.yace
Normal file
@ -0,0 +1,34 @@
|
||||
NOTE: This is a simple potential for the example. Production usage without testing is not recommended. Provided by Yury Lysogorskiy (ICAMS, RUB, Germany).
|
||||
elements: [Cu]
|
||||
E0: [0]
|
||||
deltaSplineBins: 0.001
|
||||
embeddings:
|
||||
0: {ndensity: 2, FS_parameters: [1, 1, 1, 0.5], npoti: FinnisSinclairShiftedScaled, rho_core_cutoff: 100000, drho_core_cutoff: 250}
|
||||
bonds:
|
||||
[0, 0]: {nradmax: 2, lmax: 2, nradbasemax: 15, radbasename: ChebPow, radparameters: [2], radcoefficients: [[[0.99440439385969503, -0.085048653403583918, -0.23248632054717755, -0.22732701549371864, 0.026354948476648921, 0.21853318667456997, 0.05745747498169812, -0.19717925712228765, -0.11474256770370879, 0.12738668745839368, 0.053777769435472259, -0.11094768379576209, 0.072620812391582482, -0.058715761632824881, 0.030359986427775303], [0.96259704765772924, -0.10129488003029259, -0.10345557604916655, -0.020393848425879282, 0.076671442494272601, 0.10318554794001746, 0.0555341702761026, 0.00083194423680727696, -0.018184436957498409, -0.021866885826555403, -0.020179969116479776, 0.021880011516616484, 0.053112509345249602, -0.083707026393616657, 0.020611714544479017], [1.001530579978529, -0.030080648426358471, -0.13318582671063051, -0.24371635685809706, -0.22760541127468878, -0.041144767051648642, 0.18080289144697201, 0.24543156067198274, 0.11014559411659355, -0.069512010077804498, -0.1172049950938457, -0.027509386703874331, 0.056985864219913585, 0.037536629112081353, -0.044222474537374087]], [[0.25716120576634355, 1.7485527550537943, 0.91889737965719875, 0.50902244208852199, -0.15895537149482841, -0.48109723575282892, -0.17843605933015286, 0.39450608859531944, 0.59293909285591195, 0.18268386912819001, -0.34706543720907351, -0.3210061634328315, 0.21678650779400246, 0.39500148786376449, -0.31820913370341625], [0.0079213202761679105, 1.0212489038630681, 0.011530454475879359, -0.049445152058907642, -0.15268524878755677, -0.2319378608755131, -0.20612580998548105, -0.067027395211212315, 0.08241096034972574, 0.11288597065081186, 0.01355948960244063, -0.074722461388416803, -0.022724332047049267, 0.088871664887057056, 0.031667459613258314], [-0.0069872405356639312, 0.9939655327342134, 0.035044055182587928, 0.099765277857093104, 0.11687607289674087, 0.030241996404391416, -0.12367698594314165, -0.22480900218170197, -0.17727517861619441, -0.015144941558075584, 0.11375495728241894, 0.090680932947050971, -0.041190210394591399, -0.10085768296286811, 0.055789864104988186]]], prehc: 0, lambdahc: 0, rcut: 3.8999999999999999, dcut: 0.01, rcut_in: 0, dcut_in: 0, inner_cutoff_type: density}
|
||||
functions:
|
||||
0:
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [1], ls: [0], ms_combs: [0], ctildes: [0.26072556900842869, -0.03073189825062177]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [2], ls: [0], ms_combs: [0], ctildes: [0.64429175483702295, -0.1630534353246999]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [3], ls: [0], ms_combs: [0], ctildes: [0.51856313423563594, -0.4259316875879266]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [4], ls: [0], ms_combs: [0], ctildes: [-0.078113533662468398, -0.70352070540668643]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [5], ls: [0], ms_combs: [0], ctildes: [-0.45633111544093646, -0.7859368117550467]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [6], ls: [0], ms_combs: [0], ctildes: [-0.19608401600520556, -0.59151667874441172]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [7], ls: [0], ms_combs: [0], ctildes: [0.30580228338697285, -0.29248216980800118]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [8], ls: [0], ms_combs: [0], ctildes: [0.40167461008815436, -0.15647925731818518]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [9], ls: [0], ms_combs: [0], ctildes: [0.053519057558225343, -0.25900906688118652]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [10], ls: [0], ms_combs: [0], ctildes: [-0.20446546815457517, -0.40019216010057629]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [11], ls: [0], ms_combs: [0], ctildes: [-0.070020661105060208, -0.33441939205411986]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [12], ls: [0], ms_combs: [0], ctildes: [0.15734064575001952, -0.055233119903794807]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [13], ls: [0], ms_combs: [0], ctildes: [0.10021406559793103, 0.18641744536767416]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [14], ls: [0], ms_combs: [0], ctildes: [-0.14066730990975543, 0.14711096149210373]}
|
||||
- {mu0: 0, rank: 1, ndensity: 2, num_ms_combs: 1, mus: [0], ns: [15], ls: [0], ms_combs: [0], ctildes: [0.031100766650549283, -0.13720067925313634]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 1, mus: [0, 0], ns: [1, 1], ls: [0, 0], ms_combs: [0, 0], ctildes: [1.0984212008195524, 0.49756623164565855]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 2, mus: [0, 0], ns: [1, 1], ls: [1, 1], ms_combs: [0, 0, 1, -1], ctildes: [0.2591109116320176, 0.21348077494861176, -0.5182218232640351, -0.4269615498972234]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 3, mus: [0, 0], ns: [1, 1], ls: [2, 2], ms_combs: [0, 0, 1, -1, 2, -2], ctildes: [0.015905361441871636, 0.023783303055646809, -0.031810722883743273, -0.047566606111293624, 0.031810722883743286, 0.047566606111293638]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 1, mus: [0, 0], ns: [2, 1], ls: [0, 0], ms_combs: [0, 0], ctildes: [0.63958612617724186, 1.6623415103929948]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 2, mus: [0, 0], ns: [2, 1], ls: [1, 1], ms_combs: [0, 0, 1, -1], ctildes: [0.14199022782503917, 0.0069900458821809735, -0.28398045565007829, -0.013980091764361944]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 3, mus: [0, 0], ns: [2, 1], ls: [2, 2], ms_combs: [0, 0, 1, -1, 2, -2], ctildes: [0.028732470496968317, -0.037173039560267927, -0.05746494099393664, 0.074346079120535868, 0.057464940993936654, -0.074346079120535882]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 1, mus: [0, 0], ns: [2, 2], ls: [0, 0], ms_combs: [0, 0], ctildes: [0.056442895466964321, 0.0054387873274233034]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 2, mus: [0, 0], ns: [2, 2], ls: [1, 1], ms_combs: [0, 0, 1, -1], ctildes: [0.025326283180140272, -0.19511149476156769, -0.050652566360280531, 0.39022298952313533]}
|
||||
- {mu0: 0, rank: 2, ndensity: 2, num_ms_combs: 3, mus: [0, 0], ns: [2, 2], ls: [2, 2], ms_combs: [0, 0, 1, -1, 2, -2], ctildes: [0.012754475331985416, -0.058934602152610385, -0.025508950663970836, 0.11786920430522078, 0.025508950663970843, -0.11786920430522081]}
|
||||
6006
examples/PACKAGES/apip/Cu_300K_Immel_2023.eam.fs
Normal file
6006
examples/PACKAGES/apip/Cu_300K_Immel_2023.eam.fs
Normal file
File diff suppressed because it is too large
Load Diff
11
examples/PACKAGES/apip/README
Normal file
11
examples/PACKAGES/apip/README
Normal file
@ -0,0 +1,11 @@
|
||||
The APIP package is based on the paper:
|
||||
|
||||
David Immel, Ralf Drautz, Godehard Sutmann; Adaptive-precision potentials for large-scale atomistic simulations. J. Chem. Phys. 14 March 2025; 162 (11): 114119. https://doi.org/10.1063/5.0245877
|
||||
|
||||
The pair_style pace/apip requires the installation of lib/pace of the ML-PACE package.
|
||||
The installation of lib/pace is described in src/ML-PACE/README .
|
||||
|
||||
Examples of how to use an adaptive-precision potential are provided in examples/PACKAGES/apip .
|
||||
|
||||
in.vacancy contains a small example that can be used to visualize the transition region and get a visual impression of the selected parameters.
|
||||
in.surface.balance in a more realistic example, in which a surface is simulated and the benefit of fix apip_atom_weight and fix balance for adaptive-precision interatomic potentials is demonstrated.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user