Merge branch 'develop' into gran-temp

This commit is contained in:
Axel Kohlmeyer
2023-03-16 17:44:36 -04:00
1348 changed files with 52722 additions and 105377 deletions

7
.github/CODEOWNERS vendored
View File

@ -63,6 +63,7 @@ src/MANYBODY/pair_vashishta_table.* @andeplane
src/MANYBODY/pair_atm.* @sergeylishchuk src/MANYBODY/pair_atm.* @sergeylishchuk
src/REPLICA/*_grem.* @dstelter92 src/REPLICA/*_grem.* @dstelter92
src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel
src/EXTRA-COMPUTE/compute_born_matrix.* @Bibobu @athomps
src/MISC/*_tracker.* @jtclemm src/MISC/*_tracker.* @jtclemm
src/MC/fix_gcmc.* @athomps src/MC/fix_gcmc.* @athomps
src/MC/fix_sgcmc.* @athomps src/MC/fix_sgcmc.* @athomps
@ -149,12 +150,12 @@ tools/vim/* @hammondkd
unittest/* @akohlmey unittest/* @akohlmey
# cmake # cmake
cmake/* @junghans @rbberger cmake/* @rbberger
cmake/Modules/LAMMPSInterfacePlugin.cmake @akohlmey cmake/Modules/LAMMPSInterfacePlugin.cmake @akohlmey
cmake/Modules/MPI4WIN.cmake @akohlmey cmake/Modules/MPI4WIN.cmake @akohlmey
cmake/Modules/OpenCLLoader.cmake @akohlmey cmake/Modules/OpenCLLoader.cmake @akohlmey
cmake/Modules/Packages/COLVARS.cmake @junghans @rbberger @giacomofiorin cmake/Modules/Packages/COLVARS.cmake @rbberger @giacomofiorin
cmake/Modules/Packages/KIM.cmake @junghans @rbberger @ellio167 cmake/Modules/Packages/KIM.cmake @rbberger @ellio167
cmake/presets/*.cmake @akohlmey cmake/presets/*.cmake @akohlmey
# python # python

View File

@ -49,7 +49,9 @@ jobs:
shell: bash shell: bash
working-directory: build working-directory: build
run: | run: |
cmake -C ../cmake/presets/most.cmake ../cmake cmake -C ../cmake/presets/most.cmake \
-D DOWNLOAD_POTENTIALS=off \
../cmake
cmake --build . --parallel 2 cmake --build . --parallel 2
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis

View File

@ -36,6 +36,7 @@ jobs:
nuget install MSMPIsdk nuget install MSMPIsdk
nuget install MSMPIDIST nuget install MSMPIDIST
cmake -C cmake/presets/windows.cmake \ cmake -C cmake/presets/windows.cmake \
-D DOWNLOAD_POTENTIALS=off \
-D PKG_PYTHON=on \ -D PKG_PYTHON=on \
-D WITH_PNG=off \ -D WITH_PNG=off \
-D WITH_JPEG=off \ -D WITH_JPEG=off \
@ -43,7 +44,7 @@ jobs:
-D BUILD_SHARED_LIBS=on \ -D BUILD_SHARED_LIBS=on \
-D LAMMPS_EXCEPTIONS=on \ -D LAMMPS_EXCEPTIONS=on \
-D ENABLE_TESTING=on -D ENABLE_TESTING=on
cmake --build build --config Release cmake --build build --config Release --parallel 2
- name: Run LAMMPS executable - name: Run LAMMPS executable
shell: bash shell: bash

View File

@ -47,6 +47,7 @@ jobs:
python3 -m pip install pyyaml python3 -m pip install pyyaml
cmake -C ../cmake/presets/clang.cmake \ cmake -C ../cmake/presets/clang.cmake \
-C ../cmake/presets/most.cmake \ -C ../cmake/presets/most.cmake \
-D DOWNLOAD_POTENTIALS=off \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D ENABLE_TESTING=on \ -D ENABLE_TESTING=on \

2
.gitignore vendored
View File

@ -55,3 +55,5 @@ out/RelWithDebInfo
out/Release out/Release
out/x86 out/x86
out/x64 out/x64
src/Makefile.package-e
src/Makefile.package.settings-e

View File

@ -30,18 +30,23 @@ for unicode characters and only all-ASCII source code is accepted.
# Version Updates # Version Updates
LAMMPS follows continuous release development model. We aim to keep to LAMMPS follows a continuous release development model. We aim to keep
keep the development version (develop branch) always fully functional the development version (`develop` branch) always fully functional and
and employ a variety of automatic testing procedures to detect failures employ a variety of automatic testing procedures to detect failures of
of existing functionality from adding or modifying features. Most of existing functionality from adding or modifying features. Most of those
those tests are run on pull requests *before* merging to the development tests are run on pull requests and must be passed *before* merging to
branch. The develop branch is protected, so all changes *must* be the `develop` branch. The `develop` branch is protected, so all changes
submitted as a pull request and thus cannot avoid the automated tests. *must* be submitted as a pull request and thus cannot avoid the
automated tests.
Additional tests are run *after* merging. Before releases are made Additional tests are run *after* merging. Before releases are made
*all* tests must have cleared. Then a release tag is applied and the *all* tests must have cleared. Then a release tag is applied and the
release branch fast-forwarded to that tag. Bug fixes and updates are `release` branch is fast-forwarded to that tag. This is referred to to
applied to the current development branch and thus will be available in as a "feature release". Bug fixes and updates are applied first to the
the next (patch) release. For stable releases, selected bug fixes are `develop` branch. Later, they appear in the `release` branch when the
back-ported and occasionally published as update releases. There are next patch release occurs. For stable releases, backported bug fixes
only updates to the latest stable release. and infrastructure updates are first applied to the `maintenance` branch
and then merged to `stable` and published as "updates". For a new
stable release the `stable` branch is updated to the corresponding state
of the `release` branch and a new stable tag is applied in addition to
the release tag.

View File

@ -168,8 +168,8 @@ endif()
######################################################################## ########################################################################
# User input options # # User input options #
######################################################################## ########################################################################
# set path to python interpreter and thus enforcing python version if # set path to python interpreter and thus enforcing python version when
# when in a virtual environment and PYTHON_EXECUTABLE is not set on command line # in a virtual environment and PYTHON_EXECUTABLE is not set on command line
if(DEFINED ENV{VIRTUAL_ENV} AND NOT PYTHON_EXECUTABLE) if(DEFINED ENV{VIRTUAL_ENV} AND NOT PYTHON_EXECUTABLE)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(PYTHON_EXECUTABLE "$ENV{VIRTUAL_ENV}/Scripts/python.exe") set(PYTHON_EXECUTABLE "$ENV{VIRTUAL_ENV}/Scripts/python.exe")
@ -265,6 +265,7 @@ set(STANDARD_PACKAGES
MC MC
MDI MDI
MEAM MEAM
MESONT
MGPT MGPT
MISC MISC
ML-HDNNP ML-HDNNP
@ -308,9 +309,8 @@ set(STANDARD_PACKAGES
YAFF) YAFF)
set(SUFFIX_PACKAGES CORESHELL GPU KOKKOS OPT INTEL OPENMP) set(SUFFIX_PACKAGES CORESHELL GPU KOKKOS OPT INTEL OPENMP)
set(EXTRA_PACKAGES MESONT)
foreach(PKG ${STANDARD_PACKAGES} ${EXTRA_PACKAGES} ${SUFFIX_PACKAGES}) foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
option(PKG_${PKG} "Build ${PKG} Package" OFF) option(PKG_${PKG} "Build ${PKG} Package" OFF)
endforeach() endforeach()
@ -520,7 +520,7 @@ else()
set(CUDA_REQUEST_PIC) set(CUDA_REQUEST_PIC)
endif() endif()
foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE MESONT NETCDF foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF
PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM LATTE MSCG COMPRESS ML-PACE LEPTON) PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM LATTE MSCG COMPRESS ML-PACE LEPTON)
if(PKG_${PKG_WITH_INCL}) if(PKG_${PKG_WITH_INCL})
include(Packages/${PKG_WITH_INCL}) include(Packages/${PKG_WITH_INCL})
@ -538,7 +538,10 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine
separate_arguments(CMAKE_TUNE_FLAGS) separate_arguments(CMAKE_TUNE_FLAGS)
foreach(_FLAG ${CMAKE_TUNE_FLAGS}) foreach(_FLAG ${CMAKE_TUNE_FLAGS})
target_compile_options(lammps PRIVATE ${_FLAG}) target_compile_options(lammps PRIVATE ${_FLAG})
# skip these flags when linking the main executable
if(NOT (("${_FLAG}" STREQUAL "-Xcudafe") OR (("${_FLAG}" STREQUAL "--diag_suppress=unrecognized_pragma"))))
target_compile_options(lmp PRIVATE ${_FLAG}) target_compile_options(lmp PRIVATE ${_FLAG})
endif()
endforeach() endforeach()
######################################################################## ########################################################################
# Basic system tests (standard libraries, headers, functions, types) # # Basic system tests (standard libraries, headers, functions, types) #
@ -566,7 +569,9 @@ RegisterStyles(${LAMMPS_SOURCE_DIR})
######################################################## ########################################################
# Fetch missing external files and archives for packages # Fetch missing external files and archives for packages
######################################################## ########################################################
foreach(PKG ${STANDARD_PACKAGES} ${EXTRA_PACKAGES} ${SUFFIX_PACKAGES}) option(DOWNLOAD_POTENTIALS "Automatically download large potential files" ON)
mark_as_advanced(DOWNLOAD_POTENTIALS)
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
if(PKG_${PKG}) if(PKG_${PKG})
FetchPotentials(${LAMMPS_SOURCE_DIR}/${PKG} ${LAMMPS_POTENTIALS_DIR}) FetchPotentials(${LAMMPS_SOURCE_DIR}/${PKG} ${LAMMPS_POTENTIALS_DIR})
endif() endif()
@ -706,7 +711,7 @@ target_include_directories(lammps PRIVATE ${LAMMPS_STYLE_HEADERS_DIR})
###################################### ######################################
set(temp "#ifndef LMP_INSTALLED_PKGS_H\n#define LMP_INSTALLED_PKGS_H\n") set(temp "#ifndef LMP_INSTALLED_PKGS_H\n#define LMP_INSTALLED_PKGS_H\n")
set(temp "${temp}const char * LAMMPS_NS::LAMMPS::installed_packages[] = {\n") set(temp "${temp}const char * LAMMPS_NS::LAMMPS::installed_packages[] = {\n")
set(temp_PKG_LIST ${STANDARD_PACKAGES} ${EXTRA_PACKAGES} ${SUFFIX_PACKAGES}) set(temp_PKG_LIST ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
list(SORT temp_PKG_LIST) list(SORT temp_PKG_LIST)
foreach(PKG ${temp_PKG_LIST}) foreach(PKG ${temp_PKG_LIST})
if(PKG_${PKG}) if(PKG_${PKG})
@ -851,35 +856,6 @@ else()
${CMAKE_COMMAND} -E echo "Must build LAMMPS as a shared library to use the Python module") ${CMAKE_COMMAND} -E echo "Must build LAMMPS as a shared library to use the Python module")
endif() endif()
###############################################################################
# Add LAMMPS python module to "install" target. This is taylored for building
# LAMMPS for package managers and with different prefix settings.
# This requires either a shared library or that the PYTHON package is included.
###############################################################################
if(BUILD_SHARED_LIBS OR PKG_PYTHON)
if(CMAKE_VERSION VERSION_LESS 3.12)
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
find_package(PythonInterp) # Deprecated since version 3.12
if(PYTHONINTERP_FOUND)
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
endif()
else()
# backward compatibility
if(PYTHON_EXECUTABLE)
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
endif()
find_package(Python COMPONENTS Interpreter)
endif()
if(Python_EXECUTABLE)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python/lib)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python/src)
file(COPY ${LAMMPS_SOURCE_DIR}/version.h DESTINATION ${CMAKE_BINARY_DIR}/python/src)
file(COPY ${LAMMPS_PYTHON_DIR}/README ${LAMMPS_PYTHON_DIR}/pyproject.toml ${LAMMPS_PYTHON_DIR}/setup.py ${LAMMPS_PYTHON_DIR}/lammps DESTINATION ${CMAKE_BINARY_DIR}/python/lib)
install(CODE "if(\"\$ENV{DESTDIR}\" STREQUAL \"\")\n execute_process(COMMAND ${Python_EXECUTABLE} -m pip install -v ${CMAKE_BINARY_DIR}/python/lib --prefix=${CMAKE_INSTALL_PREFIX})\n else()\n execute_process(COMMAND ${Python_EXECUTABLE} -m pip install -v ${CMAKE_BINARY_DIR}/python/lib --prefix=${CMAKE_INSTALL_PREFIX} --root=\$ENV{DESTDIR})\n endif()")
endif()
endif()
include(Testing) include(Testing)
include(CodeCoverage) include(CodeCoverage)
include(CodingStandard) include(CodingStandard)
@ -891,6 +867,23 @@ if(ClangFormat_FOUND)
WORKING_DIRECTORY ${LAMMPS_SOURCE_DIR}) WORKING_DIRECTORY ${LAMMPS_SOURCE_DIR})
endif() endif()
# extract Kokkos compilation settings
get_cmake_property(_allvars VARIABLES)
foreach(_var ${_allvars})
if(${_var})
string(REGEX MATCH "Kokkos_ENABLE_(SERIAL|THREADS|OPENMP|CUDA|HIP|SYCL|OPENMPTARGET|HPX)" _match ${_var})
if(_match)
string(REGEX REPLACE "Kokkos_ENABLE_(OPENMP|SERIAL|CUDA|HIP|SYCL)" "\\1" _match ${_var})
list(APPEND KOKKOS_DEVICE ${_match})
endif()
string(REGEX MATCH "Kokkos_ARCH" _match ${_var})
if(_match)
string(REGEX REPLACE "Kokkos_ARCH_(.*)" "\\1" _match ${_var})
list(APPEND KOKKOS_ARCH ${_match})
endif()
endif()
endforeach()
get_target_property(DEFINES lammps COMPILE_DEFINITIONS) get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
if(BUILD_IS_MULTI_CONFIG) if(BUILD_IS_MULTI_CONFIG)
set(LAMMPS_BUILD_TYPE "Multi-Config") set(LAMMPS_BUILD_TYPE "Multi-Config")
@ -910,7 +903,7 @@ message(STATUS "<<< Build configuration >>>
# Print package summary # Print package summary
############################################################################### ###############################################################################
set(ENABLED_PACKAGES) set(ENABLED_PACKAGES)
foreach(PKG ${STANDARD_PACKAGES} ${EXTRA_PACKAGES} ${SUFFIX_PACKAGES}) foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
if(PKG_${PKG}) if(PKG_${PKG})
list(APPEND ENABLED_PACKAGES ${PKG}) list(APPEND ENABLED_PACKAGES ${PKG})
endif() endif()
@ -988,6 +981,12 @@ if(PKG_GPU)
endif() endif()
message(STATUS "GPU precision: ${GPU_PREC}") message(STATUS "GPU precision: ${GPU_PREC}")
endif() endif()
if(PKG_KOKKOS)
message(STATUS "Kokkos Devices: ${KOKKOS_DEVICE}")
if(KOKKOS_ARCH)
message(STATUS "Kokkos Architecture: ${KOKKOS_ARCH}")
endif()
endif()
if(PKG_KSPACE) if(PKG_KSPACE)
message(STATUS "<<< FFT settings >>> message(STATUS "<<< FFT settings >>>
-- Primary FFT lib: ${FFT}") -- Primary FFT lib: ${FFT}")

View File

@ -56,14 +56,25 @@ if(BUILD_DOC)
) )
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball") set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
set(MATHJAX_MD5 "d1c98c746888bfd52ca8ebc10704f92f" CACHE STRING "MD5 checksum of MathJax tarball") set(MATHJAX_MD5 "b81661c6e6ba06278e6ae37b30b0c492" CACHE STRING "MD5 checksum of MathJax tarball")
mark_as_advanced(MATHJAX_URL) mark_as_advanced(MATHJAX_URL)
GetFallbackURL(MATHJAX_URL MATHJAX_FALLBACK)
# download mathjax distribution and unpack to folder "mathjax" # download mathjax distribution and unpack to folder "mathjax"
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5) if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
file(DOWNLOAD ${MATHJAX_URL} if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz)
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz" file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz)
EXPECTED_MD5 ${MATHJAX_MD5}) endif()
if(NOT "${DL_MD5}" STREQUAL "${MATHJAX_MD5}")
file(DOWNLOAD ${MATHJAX_URL} "${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz" STATUS DL_STATUS SHOW_PROGRESS)
file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz DL_MD5)
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${MATHJAX_MD5}"))
message(WARNING "Download from primary URL ${MATHJAX_URL} failed\nTrying fallback URL ${MATHJAX_FALLBACK}")
file(DOWNLOAD ${MATHJAX_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${MATHJAX_MD5} SHOW_PROGRESS)
endif()
else()
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
file(GLOB MATHJAX_VERSION_DIR ${CONFIGURE_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*) file(GLOB MATHJAX_VERSION_DIR ${CONFIGURE_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax) execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)

View File

@ -9,8 +9,22 @@ function(ExternalCMakeProject target url hash basedir cmakedir cmakefile)
get_filename_component(archive ${url} NAME) get_filename_component(archive ${url} NAME)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
if(EXISTS ${CMAKE_BINARY_DIR}/_deps/${archive})
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
endif()
if(NOT "${DL_MD5}" STREQUAL "${hash}")
message(STATUS "Downloading ${url}") message(STATUS "Downloading ${url}")
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS) file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} STATUS DL_STATUS SHOW_PROGRESS)
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${hash}"))
set(${target}_URL ${url})
GetFallbackURL(${target}_URL fallback)
message(WARNING "Download from primary URL ${url} failed\nTrying fallback URL ${fallback}")
file(DOWNLOAD ${fallback} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
endif()
else()
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/_deps/${archive}")
endif()
message(STATUS "Unpacking and configuring ${archive}") message(STATUS "Unpacking and configuring ${archive}")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive} execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src) WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)

View File

@ -88,6 +88,18 @@ function(get_lammps_version version_header variable)
set(${variable} "${date}" PARENT_SCOPE) set(${variable} "${date}" PARENT_SCOPE)
endfunction() endfunction()
# determine canonical URL for downloading backup copy from download.lammps.org/thirdparty
function(GetFallbackURL input output)
string(REPLACE "_URL" "" _tmp ${input})
string(TOLOWER ${_tmp} libname)
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
if ("${newurl}" STREQUAL "${${input}}")
set(${output} "" PARENT_SCOPE)
else()
set(${output} ${newurl} PARENT_SCOPE)
endif()
endfunction(GetFallbackURL)
################################################################################# #################################################################################
# LAMMPS C++ interface. We only need the header related parts except on windows. # LAMMPS C++ interface. We only need the header related parts except on windows.
add_library(lammps INTERFACE) add_library(lammps INTERFACE)

View File

@ -99,8 +99,15 @@ function(check_for_autogen_files source_dir)
endfunction() endfunction()
macro(pkg_depends PKG1 PKG2) macro(pkg_depends PKG1 PKG2)
if(PKG_${PKG1} AND NOT (PKG_${PKG2} OR BUILD_${PKG2})) if(DEFINED BUILD_${PKG2})
message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be built with the ${PKG2} package") if(PKG_${PKG1} AND NOT BUILD_${PKG2})
message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be built with -D BUILD_${PKG2}=ON")
endif()
elseif(DEFINED PKG_${PKG2})
if(PKG_${PKG1} AND NOT PKG_${PKG2})
message(WARNING "The ${PKG1} package depends on the ${PKG2} package. Enabling it.")
set(PKG_${PKG2} ON CACHE BOOL "" FORCE)
endif()
endif() endif()
endmacro() endmacro()
@ -118,6 +125,7 @@ endfunction(GenerateBinaryHeader)
# fetch missing potential files # fetch missing potential files
function(FetchPotentials pkgfolder potfolder) function(FetchPotentials pkgfolder potfolder)
if(DOWNLOAD_POTENTIALS)
if(EXISTS "${pkgfolder}/potentials.txt") if(EXISTS "${pkgfolder}/potentials.txt")
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].") file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
foreach(line ${linelist}) foreach(line ${linelist})
@ -130,7 +138,7 @@ function(FetchPotentials pkgfolder potfolder)
endif() endif()
if(NOT sum STREQUAL oldsum) if(NOT sum STREQUAL oldsum)
message(STATUS "Downloading external potential ${pot} from ${LAMMPS_POTENTIALS_URL}") message(STATUS "Downloading external potential ${pot} from ${LAMMPS_POTENTIALS_URL}")
string(MD5 TMP_EXT "${CMAKE_BINARY_DIR}") string(RANDOM LENGTH 10 TMP_EXT)
file(DOWNLOAD "${LAMMPS_POTENTIALS_URL}/${pot}.${sum}" "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}" file(DOWNLOAD "${LAMMPS_POTENTIALS_URL}/${pot}.${sum}" "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}"
EXPECTED_HASH MD5=${sum} SHOW_PROGRESS) EXPECTED_HASH MD5=${sum} SHOW_PROGRESS)
file(COPY "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}" DESTINATION "${LAMMPS_POTENTIALS_DIR}") file(COPY "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}" DESTINATION "${LAMMPS_POTENTIALS_DIR}")
@ -138,6 +146,7 @@ function(FetchPotentials pkgfolder potfolder)
endif() endif()
endforeach() endforeach()
endif() endif()
endif()
endfunction(FetchPotentials) endfunction(FetchPotentials)
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux # set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
@ -149,3 +158,15 @@ if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
set(CMAKE_LINUX_DISTRO ${distro}) set(CMAKE_LINUX_DISTRO ${distro})
set(CMAKE_DISTRO_VERSION ${disversion}) set(CMAKE_DISTRO_VERSION ${disversion})
endif() endif()
# determine canonical URL for downloading backup copy from download.lammps.org/thirdparty
function(GetFallbackURL input output)
string(REPLACE "_URL" "" _tmp ${input})
string(TOLOWER ${_tmp} libname)
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
if ("${newurl}" STREQUAL "${${input}}")
set(${output} "" PARENT_SCOPE)
else()
set(${output} ${newurl} PARENT_SCOPE)
endif()
endfunction(GetFallbackURL)

View File

@ -1,4 +1,9 @@
find_package(ZLIB REQUIRED) find_package(ZLIB)
if(NOT ZLIB_FOUND)
message(WARNING "No Zlib development support found. Disabling COMPRESS package...")
set(PKG_COMPRESS OFF CACHE BOOL "" FORCE)
return()
endif()
target_link_libraries(lammps PRIVATE ZLIB::ZLIB) target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
find_package(PkgConfig QUIET) find_package(PkgConfig QUIET)

View File

@ -26,6 +26,19 @@ elseif(GPU_PREC STREQUAL "SINGLE")
set(GPU_PREC_SETTING "SINGLE_SINGLE") set(GPU_PREC_SETTING "SINGLE_SINGLE")
endif() endif()
option(GPU_DEBUG "Enable debugging code of the GPU package" OFF)
mark_as_advanced(GPU_DEBUG)
if(PKG_AMOEBA AND FFT_SINGLE)
message(FATAL_ERROR "GPU acceleration of AMOEBA is not (yet) compatible with single precision FFT")
endif()
if (PKG_AMOEBA)
list(APPEND GPU_SOURCES
${GPU_SOURCES_DIR}/amoeba_convolution_gpu.h
${GPU_SOURCES_DIR}/amoeba_convolution_gpu.cpp)
endif()
file(GLOB GPU_LIB_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp) file(GLOB GPU_LIB_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu) file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
@ -47,9 +60,9 @@ if(GPU_API STREQUAL "CUDA")
option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF) option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF)
if(CUDA_MPS_SUPPORT) if(CUDA_MPS_SUPPORT)
if(CUDPP_OPT) if(CUDPP_OPT)
message(FATAL_ERROR "Must use -DCUDPP_OPT=OFF with -DGPU_CUDA_MPS_SUPPORT=ON") message(FATAL_ERROR "Must use -DCUDPP_OPT=OFF with -DCUDA_MPS_SUPPORT=ON")
endif() endif()
set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY") set(GPU_CUDA_MPS_FLAGS "-DCUDA_MPS_SUPPORT")
endif() endif()
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)") set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
@ -85,9 +98,11 @@ if(GPU_API STREQUAL "CUDA")
# comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported # comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
if(CUDA_VERSION VERSION_LESS 8.0) if(CUDA_VERSION VERSION_LESS 8.0)
message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required") message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required")
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") elseif(CUDA_VERSION VERSION_GREATER_EQUAL "13.0")
message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk") message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk")
set(GPU_CUDA_GENCODE "-arch=all") set(GPU_CUDA_GENCODE "-arch=all")
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
set(GPU_CUDA_GENCODE "-arch=all")
else() else()
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
@ -151,7 +166,12 @@ if(GPU_API STREQUAL "CUDA")
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS}) add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS}) target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS}) target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} ${GPU_CUDA_MPS_FLAGS})
if(GPU_DEBUG)
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
else()
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DUCL_NO_EXIT)
endif()
if(CUDPP_OPT) if(CUDPP_OPT)
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini) target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP) target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
@ -192,6 +212,7 @@ elseif(GPU_API STREQUAL "OPENCL")
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo.cu
) )
foreach(GPU_KERNEL ${GPU_LIB_CU}) foreach(GPU_KERNEL ${GPU_LIB_CU})
@ -208,6 +229,7 @@ elseif(GPU_API STREQUAL "OPENCL")
GenerateOpenCLHeader(tersoff ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu) GenerateOpenCLHeader(tersoff ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu)
GenerateOpenCLHeader(tersoff_zbl ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu) GenerateOpenCLHeader(tersoff_zbl ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu)
GenerateOpenCLHeader(tersoff_mod ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu) GenerateOpenCLHeader(tersoff_mod ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu)
GenerateOpenCLHeader(hippo ${CMAKE_CURRENT_BINARY_DIR}/gpu/hippo_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo.cu)
list(APPEND GPU_LIB_SOURCES list(APPEND GPU_LIB_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/gpu/gayberne_cl.h ${CMAKE_CURRENT_BINARY_DIR}/gpu/gayberne_cl.h
@ -217,14 +239,18 @@ elseif(GPU_API STREQUAL "OPENCL")
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h
${CMAKE_CURRENT_BINARY_DIR}/gpu/hippo_cl.h
) )
add_library(gpu STATIC ${GPU_LIB_SOURCES}) add_library(gpu STATIC ${GPU_LIB_SOURCES})
target_link_libraries(gpu PRIVATE OpenCL::OpenCL) target_link_libraries(gpu PRIVATE OpenCL::OpenCL)
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu) target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu)
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DGERYON_NUMA_FISSION -DUCL_NO_EXIT) target_compile_definitions(gpu PRIVATE -DUSE_OPENCL -D_${GPU_PREC_SETTING})
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL) if(GPU_DEBUG)
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
else()
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DGERYON_NUMA_FISSION -DUCL_NO_EXIT)
endif()
target_link_libraries(lammps PRIVATE gpu) target_link_libraries(lammps PRIVATE gpu)
add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp) add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
@ -261,7 +287,7 @@ elseif(GPU_API STREQUAL "HIP")
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM}) set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd") if(HIP_PLATFORM STREQUAL "amd")
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture") set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
elseif(HIP_PLATFORM STREQUAL "spirv") elseif(HIP_PLATFORM STREQUAL "spirv")
set(HIP_ARCH "spirv" CACHE STRING "HIP target architecture") set(HIP_ARCH "spirv" CACHE STRING "HIP target architecture")
@ -334,7 +360,7 @@ elseif(GPU_API STREQUAL "HIP")
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin") set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h") set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd") if(HIP_PLATFORM STREQUAL "amd")
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY) configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
if(HIP_COMPILER STREQUAL "clang") if(HIP_COMPILER STREQUAL "clang")
@ -374,8 +400,12 @@ elseif(GPU_API STREQUAL "HIP")
add_library(gpu STATIC ${GPU_LIB_SOURCES}) add_library(gpu STATIC ${GPU_LIB_SOURCES})
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu) target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu)
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT) target_compile_definitions(gpu PRIVATE -DUSE_HIP -D_${GPU_PREC_SETTING})
target_compile_definitions(gpu PRIVATE -DUSE_HIP) if(GPU_DEBUG)
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
else()
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DUCL_NO_EXIT)
endif()
target_link_libraries(gpu PRIVATE hip::host) target_link_libraries(gpu PRIVATE hip::host)
if(HIP_USE_DEVICE_SORT) if(HIP_USE_DEVICE_SORT)
@ -384,7 +414,8 @@ elseif(GPU_API STREQUAL "HIP")
set_property(TARGET gpu PROPERTY CXX_STANDARD 14) set_property(TARGET gpu PROPERTY CXX_STANDARD 14)
endif() endif()
# add hipCUB # add hipCUB
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include) find_package(hipcub REQUIRED)
target_link_libraries(gpu PRIVATE hip::hipcub)
target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT) target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT)
if(HIP_PLATFORM STREQUAL "nvcc") if(HIP_PLATFORM STREQUAL "nvcc")
@ -400,15 +431,17 @@ elseif(GPU_API STREQUAL "HIP")
if(DOWNLOAD_CUB) if(DOWNLOAD_CUB)
message(STATUS "CUB download requested") message(STATUS "CUB download requested")
set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball") # TODO: test update to current version 1.17.2
set(CUB_URL "https://github.com/nvidia/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball") set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
mark_as_advanced(CUB_URL) mark_as_advanced(CUB_URL)
mark_as_advanced(CUB_MD5) mark_as_advanced(CUB_MD5)
GetFallbackURL(CUB_URL CUB_FALLBACK)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(CUB ExternalProject_Add(CUB
URL ${CUB_URL} URL ${CUB_URL} ${CUB_FALLBACK}
URL_MD5 ${CUB_MD5} URL_MD5 ${CUB_MD5}
PREFIX "${CMAKE_CURRENT_BINARY_DIR}" PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
@ -431,30 +464,16 @@ elseif(GPU_API STREQUAL "HIP")
add_executable(hip_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp) add_executable(hip_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
target_compile_definitions(hip_get_devices PRIVATE -DUCL_HIP) target_compile_definitions(hip_get_devices PRIVATE -DUCL_HIP)
target_link_libraries(hip_get_devices hip::host) target_link_libraries(hip_get_devices PRIVATE hip::host)
if(HIP_PLATFORM STREQUAL "nvcc") if(HIP_PLATFORM STREQUAL "nvcc")
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__) target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
target_include_directories(gpu PRIVATE ${CUDA_INCLUDE_DIRS}) target_include_directories(gpu PRIVATE ${CUDA_INCLUDE_DIRS})
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_NVCC__) target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_NVCC__)
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/include)
target_include_directories(hip_get_devices PRIVATE ${CUDA_INCLUDE_DIRS}) target_include_directories(hip_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
target_link_libraries(hip_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) target_link_libraries(hip_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
elseif(HIP_PLATFORM STREQUAL "hcc")
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_HCC__)
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
elseif(HIP_PLATFORM STREQUAL "amd")
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_AMD__)
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_AMD__)
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
endif() endif()
target_link_libraries(lammps PRIVATE gpu) target_link_libraries(lammps PRIVATE gpu)

View File

@ -49,12 +49,14 @@ if(DOWNLOAD_KOKKOS)
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
include(ExternalProject) include(ExternalProject)
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.7.00.tar.gz" CACHE STRING "URL for KOKKOS tarball") set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.7.01.tar.gz" CACHE STRING "URL for KOKKOS tarball")
set(KOKKOS_MD5 "84991eca9f066383abe119a5bc7a11c4" CACHE STRING "MD5 checksum of KOKKOS tarball") set(KOKKOS_MD5 "f140e02b826223b1045207d9bc10d404" CACHE STRING "MD5 checksum of KOKKOS tarball")
mark_as_advanced(KOKKOS_URL) mark_as_advanced(KOKKOS_URL)
mark_as_advanced(KOKKOS_MD5) mark_as_advanced(KOKKOS_MD5)
GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK)
ExternalProject_Add(kokkos_build ExternalProject_Add(kokkos_build
URL ${KOKKOS_URL} URL ${KOKKOS_URL} ${KOKKOS_FALLBACK}
URL_MD5 ${KOKKOS_MD5} URL_MD5 ${KOKKOS_MD5}
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS} CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a
@ -70,13 +72,11 @@ if(DOWNLOAD_KOKKOS)
set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a") IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a")
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS) target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
target_link_libraries(lmp PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
elseif(EXTERNAL_KOKKOS) elseif(EXTERNAL_KOKKOS)
find_package(Kokkos 3.7.00 REQUIRED CONFIG) find_package(Kokkos 3.7.01 REQUIRED CONFIG)
target_link_libraries(lammps PRIVATE Kokkos::kokkos) target_link_libraries(lammps PRIVATE Kokkos::kokkos)
target_link_libraries(lmp PRIVATE Kokkos::kokkos)
else() else()
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
@ -96,7 +96,6 @@ else()
${LAMMPS_LIB_KOKKOS_BIN_DIR}) ${LAMMPS_LIB_KOKKOS_BIN_DIR})
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS}) target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
target_link_libraries(lammps PRIVATE kokkos) target_link_libraries(lammps PRIVATE kokkos)
target_link_libraries(lmp PRIVATE kokkos)
if(BUILD_SHARED_LIBS_WAS_ON) if(BUILD_SHARED_LIBS_WAS_ON)
set(BUILD_SHARED_LIBS ON) set(BUILD_SHARED_LIBS ON)
endif() endif()
@ -144,6 +143,7 @@ if(PKG_ML-IAP)
${KOKKOS_PKG_SOURCES_DIR}/mliap_descriptor_so3_kokkos.cpp ${KOKKOS_PKG_SOURCES_DIR}/mliap_descriptor_so3_kokkos.cpp
${KOKKOS_PKG_SOURCES_DIR}/mliap_model_linear_kokkos.cpp ${KOKKOS_PKG_SOURCES_DIR}/mliap_model_linear_kokkos.cpp
${KOKKOS_PKG_SOURCES_DIR}/mliap_model_python_kokkos.cpp ${KOKKOS_PKG_SOURCES_DIR}/mliap_model_python_kokkos.cpp
${KOKKOS_PKG_SOURCES_DIR}/mliap_unified_kokkos.cpp
${KOKKOS_PKG_SOURCES_DIR}/mliap_so3_kokkos.cpp) ${KOKKOS_PKG_SOURCES_DIR}/mliap_so3_kokkos.cpp)
# Add KOKKOS version of ML-IAP Python coupling if non-KOKKOS version is included # Add KOKKOS version of ML-IAP Python coupling if non-KOKKOS version is included

View File

@ -19,6 +19,7 @@ if(DOWNLOAD_LATTE)
set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball") set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball")
mark_as_advanced(LATTE_URL) mark_as_advanced(LATTE_URL)
mark_as_advanced(LATTE_MD5) mark_as_advanced(LATTE_MD5)
GetFallbackURL(LATTE_URL LATTE_FALLBACK)
# CMake cannot pass BLAS or LAPACK library variable to external project if they are a list # CMake cannot pass BLAS or LAPACK library variable to external project if they are a list
list(LENGTH BLAS_LIBRARIES} NUM_BLAS) list(LENGTH BLAS_LIBRARIES} NUM_BLAS)
@ -30,7 +31,7 @@ if(DOWNLOAD_LATTE)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(latte_build ExternalProject_Add(latte_build
URL ${LATTE_URL} URL ${LATTE_URL} ${LATTE_FALLBACK}
URL_MD5 ${LATTE_MD5} URL_MD5 ${LATTE_MD5}
SOURCE_SUBDIR cmake SOURCE_SUBDIR cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib

View File

@ -4,7 +4,7 @@ if(LEPTON_SOURCE_DIR)
endif() endif()
set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton) set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton)
file(GLOB LEPTON_SOURCES ${LEPTON_SOURCE_DIR}/src/[^.]*.cpp) file(GLOB LEPTON_SOURCES ${CONFIGURE_DEPENDS} ${LEPTON_SOURCE_DIR}/src/[^.]*.cpp)
if((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64") OR if((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64") OR
(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") OR (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") OR
@ -15,7 +15,7 @@ else()
endif() endif()
if(LEPTON_ENABLE_JIT) if(LEPTON_ENABLE_JIT)
file(GLOB ASMJIT_SOURCES ${LEPTON_SOURCE_DIR}/asmjit/*/[^.]*.cpp) file(GLOB ASMJIT_SOURCES ${CONFIGURE_DEPENDS} ${LEPTON_SOURCE_DIR}/asmjit/*/[^.]*.cpp)
endif() endif()
add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES}) add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES})

View File

@ -12,6 +12,7 @@ if(DOWNLOAD_MDI)
set(MDI_MD5 "7a222353ae8e03961d5365e6cd48baee" CACHE STRING "MD5 checksum for MDI tarball") set(MDI_MD5 "7a222353ae8e03961d5365e6cd48baee" CACHE STRING "MD5 checksum for MDI tarball")
mark_as_advanced(MDI_URL) mark_as_advanced(MDI_URL)
mark_as_advanced(MDI_MD5) mark_as_advanced(MDI_MD5)
GetFallbackURL(MDI_URL MDI_FALLBACK)
enable_language(C) enable_language(C)
# only ON/OFF are allowed for "mpi" flag when building MDI library # only ON/OFF are allowed for "mpi" flag when building MDI library
@ -63,7 +64,7 @@ if(DOWNLOAD_MDI)
# support cross-compilation and ninja-build # support cross-compilation and ninja-build
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(mdi_build ExternalProject_Add(mdi_build
URL ${MDI_URL} URL ${MDI_URL} ${MDI_FALLBACK}
URL_MD5 ${MDI_MD5} URL_MD5 ${MDI_MD5}
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext
CMAKE_ARGS CMAKE_ARGS

View File

@ -1,73 +0,0 @@
set(MESONT_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/MESONT)
include(StyleHeaderUtils)
include(CheckLanguage)
# always include C++-only sources
file(GLOB MESONT_SOURCES ${CONFIGURE_DEPENDS} ${MESONT_SOURCES_DIR}/[^.]*mesocnt*.cpp)
file(GLOB MESONT_HEADERS ${CONFIGURE_DEPENDS} ${MESONT_SOURCES_DIR}/[^.]*mesocnt*.h)
# remove derived class when base class is not available
if(NOT PKG_MOLECULE)
list(REMOVE_ITEM MESONT_SOURCES ${MESONT_SOURCES_DIR}/bond_mesocnt.cpp)
list(REMOVE_ITEM MESONT_HEADERS ${MESONT_SOURCES_DIR}/bond_mesocnt.h)
endif()
# include styles dependent on Fortran library only when Fortran is available.
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
file(GLOB MESONT_LIB_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/mesont/[^.]*.f90)
add_library(mesont STATIC ${MESONT_LIB_SOURCES})
set_target_properties(mesont PROPERTIES OUTPUT_NAME lammps_mesont${LAMMPS_MACHINE})
target_link_libraries(lammps PRIVATE mesont)
list(APPEND MESONT_SOURCES ${MESONT_SOURCES_DIR}/pair_mesont_tpm.cpp)
list(APPEND MESONT_SOURCES ${MESONT_SOURCES_DIR}/atom_vec_mesont.cpp)
list(APPEND MESONT_SOURCES ${MESONT_SOURCES_DIR}/compute_mesont.cpp)
list(APPEND MESONT_HEADERS ${MESONT_SOURCES_DIR}/pair_mesont_tpm.h)
list(APPEND MESONT_HEADERS ${MESONT_SOURCES_DIR}/atom_vec_mesont.h)
list(APPEND MESONT_HEADERS ${MESONT_SOURCES_DIR}/compute_mesont.h)
endif()
# check for package files in src directory due to old make system
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${MESONT_SOURCES} ${MESONT_HEADERS})
# manually register style headers
get_property(alist GLOBAL PROPERTY ANGLE)
get_property(blist GLOBAL PROPERTY BOND)
get_property(clist GLOBAL PROPERTY COMPUTE)
get_property(plist GLOBAL PROPERTY PAIR)
get_property(vlist GLOBAL PROPERTY ATOM_VEC)
foreach(fname ${MESONT_HEADERS})
file(STRINGS ${fname} is_style LIMIT_COUNT 1 REGEX ANGLE_CLASS)
if(is_style)
list(APPEND alist ${fname})
endif()
file(STRINGS ${fname} is_style LIMIT_COUNT 1 REGEX BOND_CLASS)
if(is_style)
list(APPEND blist ${fname})
endif()
file(STRINGS ${fname} is_style LIMIT_COUNT 1 REGEX COMPUTE_CLASS)
if(is_style)
list(APPEND clist ${fname})
endif()
file(STRINGS ${fname} is_style LIMIT_COUNT 1 REGEX PAIR_CLASS)
if(is_style)
list(APPEND plist ${fname})
endif()
file(STRINGS ${fname} is_style LIMIT_COUNT 1 REGEX ATOM_CLASS)
if(is_style)
list(APPEND vlist ${fname})
endif()
endforeach()
set_property(GLOBAL PROPERTY ANGLE "${alist}")
set_property(GLOBAL PROPERTY BOND "${blist}")
set_property(GLOBAL PROPERTY COMPUTE "${clist}")
set_property(GLOBAL PROPERTY PAIR "${plist}")
set_property(GLOBAL PROPERTY ATOM_VEC "${vlist}")
target_sources(lammps PRIVATE ${MESONT_SOURCES})
target_include_directories(lammps PRIVATE ${MESONT_SOURCES_DIR})
RegisterPackages(${MESONT_SOURCES_DIR})

View File

@ -6,10 +6,11 @@ else()
endif() endif()
option(DOWNLOAD_N2P2 "Download n2p2 library instead of using an already installed one)" ${DOWNLOAD_N2P2_DEFAULT}) option(DOWNLOAD_N2P2 "Download n2p2 library instead of using an already installed one)" ${DOWNLOAD_N2P2_DEFAULT})
if(DOWNLOAD_N2P2) if(DOWNLOAD_N2P2)
set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.1.4.tar.gz" CACHE STRING "URL for n2p2 tarball") set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.2.0.tar.gz" CACHE STRING "URL for n2p2 tarball")
set(N2P2_MD5 "9595b066636cd6b90b0fef93398297a5" CACHE STRING "MD5 checksum of N2P2 tarball") set(N2P2_MD5 "a2d9ab7f676b3a74a324fc1eda0a911d" CACHE STRING "MD5 checksum of N2P2 tarball")
mark_as_advanced(N2P2_URL) mark_as_advanced(N2P2_URL)
mark_as_advanced(N2P2_MD5) mark_as_advanced(N2P2_MD5)
GetFallbackURL(N2P2_URL N2P2_FALLBACK)
# adjust settings from detected compiler to compiler platform in n2p2 library # adjust settings from detected compiler to compiler platform in n2p2 library
# set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7) # set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7)
@ -72,7 +73,7 @@ if(DOWNLOAD_N2P2)
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling) # download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(n2p2_build ExternalProject_Add(n2p2_build
URL ${N2P2_URL} URL ${N2P2_URL} ${N2P2_FALLBACK}
URL_MD5 ${N2P2_MD5} URL_MD5 ${N2P2_MD5}
UPDATE_COMMAND "" UPDATE_COMMAND ""
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""

View File

@ -1,11 +1,25 @@
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.01.3.tar.gz" CACHE STRING "URL for PACE evaluator library sources") set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.01.3.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
set(PACELIB_MD5 "f418d32b60e531063ac4285bf702b468" CACHE STRING "MD5 checksum of PACE evaluator library tarball") set(PACELIB_MD5 "4f0b3b5b14456fe9a73b447de3765caa" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_URL)
mark_as_advanced(PACELIB_MD5) mark_as_advanced(PACELIB_MD5)
GetFallbackURL(PACELIB_URL PACELIB_FALLBACK)
# download library sources to build folder # download library sources to build folder
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS if(EXISTS ${CMAKE_BINARY_DIR}/libpace.tar.gz)
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
endif()
if(NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}")
message(STATUS "Downloading ${PACELIB_URL}")
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz STATUS DL_STATUS SHOW_PROGRESS)
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}"))
message(WARNING "Download from primary URL ${PACELIB_URL} failed\nTrying fallback URL ${PACELIB_FALLBACK}")
file(DOWNLOAD ${PACELIB_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5} SHOW_PROGRESS)
endif()
else()
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
endif()
# uncompress downloaded sources # uncompress downloaded sources
execute_process( execute_process(

View File

@ -16,6 +16,7 @@ if(DOWNLOAD_QUIP)
set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n") set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n")
set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n") set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n")
set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n") set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n")
set(temp "${temp}F95_PRE_FILENAME_FLAG = -Tf\n")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n") set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n") set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n")

View File

@ -59,10 +59,11 @@ if(DOWNLOAD_PLUMED)
mark_as_advanced(PLUMED_URL) mark_as_advanced(PLUMED_URL)
mark_as_advanced(PLUMED_MD5) mark_as_advanced(PLUMED_MD5)
GetFallbackURL(PLUMED_URL PLUMED_FALLBACK)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(plumed_build ExternalProject_Add(plumed_build
URL ${PLUMED_URL} URL ${PLUMED_URL} ${PLUMED_FALLBACK}
URL_MD5 ${PLUMED_MD5} URL_MD5 ${PLUMED_MD5}
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>

View File

@ -18,6 +18,8 @@ if(DOWNLOAD_SCAFACOS)
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball") set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
mark_as_advanced(SCAFACOS_URL) mark_as_advanced(SCAFACOS_URL)
mark_as_advanced(SCAFACOS_MD5) mark_as_advanced(SCAFACOS_MD5)
GetFallbackURL(SCAFACOS_URL SCAFACOS_FALLBACK)
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later. # version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
@ -30,7 +32,7 @@ if(DOWNLOAD_SCAFACOS)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(scafacos_build ExternalProject_Add(scafacos_build
URL ${SCAFACOS_URL} URL ${SCAFACOS_URL} ${SCAFACOS_FALLBACK}
URL_MD5 ${SCAFACOS_MD5} URL_MD5 ${SCAFACOS_MD5}
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc

View File

@ -50,12 +50,16 @@ if(BUILD_LAMMPS_SHELL)
add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp ${ICON_RC_FILE}) add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp ${ICON_RC_FILE})
target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell) target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell)
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
# workaround for broken readline pkg-config file on FreeBSD # workaround for broken readline pkg-config file on FreeBSD
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
target_include_directories(lammps-shell PRIVATE /usr/local/include) target_include_directories(lammps-shell PRIVATE /usr/local/include)
endif() endif()
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE) if(CMAKE_SYSTEM_NAME STREQUAL "LinuxMUSL")
pkg_check_modules(TERMCAP IMPORTED_TARGET REQUIRED termcap)
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::TERMCAP)
endif()
install(TARGETS lammps-shell EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS lammps-shell EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/lammps-shell/icons DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/) install(DIRECTORY ${LAMMPS_TOOLS_DIR}/lammps-shell/icons DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/)
install(FILES ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/) install(FILES ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/)

View File

@ -40,6 +40,7 @@ set(ALL_PACKAGES
MANYBODY MANYBODY
MC MC
MEAM MEAM
MESONT
MISC MISC
ML-IAP ML-IAP
ML-POD ML-POD

View File

@ -16,7 +16,6 @@ set(PACKAGES_WITH_LIB
LEPTON LEPTON
MACHDYN MACHDYN
MDI MDI
MESONT
ML-HDNNP ML-HDNNP
ML-PACE ML-PACE
ML-QUIP ML-QUIP

View File

@ -36,6 +36,7 @@ set(WIN_PACKAGES
MANYBODY MANYBODY
MC MC
MEAM MEAM
MESONT
MISC MISC
ML-IAP ML-IAP
ML-POD ML-POD

View File

@ -86,18 +86,19 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
@$(MAKE) $(MFLAGS) -C graphviz all @$(MAKE) $(MFLAGS) -C graphviz all
@(\ @(\
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \ . $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build -E $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\ sphinx-build -E $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
touch $(RSTDIR)/Fortran.rst ;\ touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\ sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
ln -sf Manual.html html/index.html;\ ln -sf Manual.html html/index.html;\
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\ rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
echo "############################################" ;\ echo "############################################" ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
rst_anchor_check src/*.rst ;\ rst_anchor_check src/*.rst ;\
python $(BUILDDIR)/utils/check-packages.py -s ../src -d src ;\ $(PYTHON) $(BUILDDIR)/utils/check-packages.py -s ../src -d src ;\
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\ env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\ env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
python $(BUILDDIR)/utils/check-styles.py -s ../src -d src ;\ env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst ;\
$(PYTHON) $(BUILDDIR)/utils/check-styles.py -s ../src -d src ;\
echo "############################################" ;\ echo "############################################" ;\
deactivate ;\ deactivate ;\
) )
@ -114,9 +115,9 @@ fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
@$(MAKE) $(MFLAGS) -C graphviz all @$(MAKE) $(MFLAGS) -C graphviz all
@mkdir -p fasthtml @mkdir -p fasthtml
@(\ @(\
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \ . $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\ sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
touch $(RSTDIR)/Fortran.rst ;\ touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\ sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
deactivate ;\ deactivate ;\
) )
@ -131,8 +132,8 @@ fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
@(\ @(\
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \ . $(VENV)/bin/activate ; \
cp $(SPHINXCONFIG)/false_positives.txt $(RSTDIR)/ ; env PYTHONWARNINGS= \ cp $(SPHINXCONFIG)/false_positives.txt $(RSTDIR)/; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build -b spelling -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\ sphinx-build -b spelling -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\ rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
deactivate ;\ deactivate ;\
@ -146,9 +147,9 @@ epub: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
@rm -f LAMMPS.epub @rm -f LAMMPS.epub
@cp src/JPG/*.* epub/JPG @cp src/JPG/*.* epub/JPG
@(\ @(\
. $(VENV)/bin/activate ;\ . $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build -E $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\ sphinx-build -E $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
touch $(RSTDIR)/Fortran.rst ;\ touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\ sphinx-build $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\ rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
deactivate ;\ deactivate ;\
@ -167,17 +168,18 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
@$(MAKE) $(MFLAGS) -C graphviz all @$(MAKE) $(MFLAGS) -C graphviz all
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi @if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi
@(\ @(\
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \ . $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build -E $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\ sphinx-build -E $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
touch $(RSTDIR)/Fortran.rst ;\ touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
sphinx-build $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\ sphinx-build $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\ rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
echo "############################################" ;\ echo "############################################" ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
rst_anchor_check src/*.rst ;\ rst_anchor_check src/*.rst ;\
python utils/check-packages.py -s ../src -d src ;\ $(PYTHON) utils/check-packages.py -s ../src -d src ;\
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\ env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\ env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
python utils/check-styles.py -s ../src -d src ;\ env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst ;\
$(PYTHON) utils/check-styles.py -s ../src -d src ;\
echo "############################################" ;\ echo "############################################" ;\
deactivate ;\ deactivate ;\
) )
@ -200,22 +202,22 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
anchor_check : $(ANCHORCHECK) anchor_check : $(ANCHORCHECK)
@(\ @(\
. $(VENV)/bin/activate ;\ . $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
rst_anchor_check src/*.rst ;\ rst_anchor_check src/*.rst ;\
deactivate ;\ deactivate ;\
) )
style_check : $(VENV) style_check : $(VENV)
@(\ @(\
. $(VENV)/bin/activate ;\ . $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
python utils/check-styles.py -s ../src -d src ;\ $(PYTHON) utils/check-styles.py -s ../src -d src ;\
deactivate ;\ deactivate ;\
) )
package_check : $(VENV) package_check : $(VENV)
@(\ @(\
. $(VENV)/bin/activate ;\ . $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
python utils/check-packages.py -s ../src -d src ;\ $(PYTHON) utils/check-packages.py -s ../src -d src ;\
deactivate ;\ deactivate ;\
) )
@ -224,6 +226,14 @@ char_check :
role_check : role_check :
@( env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst && exit 1 || : ) @( env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst && exit 1 || : )
@( env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst && exit 1 || : )
link_check : $(VENV) html
@(\
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
linkchecker -F html --check-extern html/Manual.html ;\
deactivate ;\
)
xmlgen : doxygen/xml/index.xml xmlgen : doxygen/xml/index.xml
@ -252,7 +262,7 @@ $(MATHJAX):
$(ANCHORCHECK): $(VENV) $(ANCHORCHECK): $(VENV)
@( \ @( \
. $(VENV)/bin/activate; \ . $(VENV)/bin/activate; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
pip $(PIP_OPTIONS) install -e utils/converters;\ pip $(PIP_OPTIONS) install -e utils/converters;\
deactivate;\ deactivate;\
) )

View File

@ -1,12 +1,12 @@
# Outline of the GitHub Development Workflow # Outline of the GitHub Development Workflow
This purpose of this document is to provide a point of reference for the The purpose of this document is to provide a point of reference for the
core LAMMPS developers and other LAMMPS contributors to understand the core LAMMPS developers and other LAMMPS contributors to understand the
choices the LAMMPS developers have agreed on. Git and GitHub provide the choices the LAMMPS developers have agreed on. Git and GitHub provide the
tools, but do not set policies, so it is up to the developers to come to tools, but do not set policies, so it is up to the developers to come to
an agreement as to how to define and interpret policies. This document an agreement as to how to define and interpret policies. This document
is likely to change as our experiences and needs change and we try to is likely to change as our experiences and needs change, and we try to
adapt accordingly. Last change 2021-09-02. adapt it accordingly. Last change 2023-02-10.
## Table of Contents ## Table of Contents
@ -22,47 +22,50 @@ adapt accordingly. Last change 2021-09-02.
## GitHub Merge Management ## GitHub Merge Management
In the interest of consistency, ONLY ONE of the core LAMMPS developers In the interest of consistency, ONLY ONE of the core LAMMPS developers
should doing the merging itself. This is currently should do the merging. This is currently
[@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer). If this [@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer). If this
assignment needs to be changed, it shall be done right after a stable assignment needs to be changed, it shall be done right after a stable
release. If the currently assigned developer cannot merge outstanding release. If the currently assigned developer cannot merge outstanding
pull requests in a timely manner, or in other extenuating circumstances, pull requests in a timely manner, or in other extenuating circumstances,
other core LAMMPS developers with merge rights can merge pull requests, other core LAMMPS developers with merge permission may merge pull
when necessary. requests.
## Pull Requests ## Pull Requests
ALL changes to the LAMMPS code and documentation, however trivial, MUST *ALL* changes to the LAMMPS code and documentation, however trivial,
be submitted as a pull request to GitHub. All changes to the "develop" MUST be submitted as a pull request to GitHub. All changes to the
branch must be made exclusively through merging pull requests. The "develop" branch must be made exclusively through merging pull requests.
"release" and "stable" branches, respectively are only to be updated The "release" and "stable" branches, respectively, are only to be
upon patch or stable releases with fast-forward merges based on the updated upon feature or stable releases based on the associated
associated tags. Pull requests may also be submitted to (long-running) tags. Updates to the stable release in between stable releases
feature branches created by LAMMPS developers inside the LAMMPS project, (for example, back-ported bug fixes) are first merged into the "maintenance"
if needed. Those are not subject to the merge and review restrictions branch and then into the "stable" branch as update releases.
discussed in this document, though, but get managed as needed on a
case-by-case basis. Pull requests may also be submitted to (long-running) feature branches
created by LAMMPS developers inside the LAMMPS project, if needed. Those
are not subject to the merge and review restrictions discussed in this
document, though, but get managed as needed on a case-by-case basis.
### Pull Request Assignments ### Pull Request Assignments
Pull requests can be "chaperoned" by one of the LAMMPS core developers. Pull requests can be "chaperoned" by one of the LAMMPS core developers.
This is indicated by who the pull request is assigned to. LAMMPS core This is indicated by whom the pull request is assigned to. LAMMPS core
developers can self-assign or they can decide to assign a pull request developers can self-assign, or they can decide to assign a pull request
to a different LAMMPS developer. Being assigned to a pull request means, to a different LAMMPS developer. Being assigned to a pull request means,
that this pull request may need some work and the assignee is tasked to that this pull request may need some work and the assignee is tasked to
determine whether this might be needed or not, and may either implement determine whether this might be needed or not. The assignee may either
the required changes or ask the submitter of the pull request to implement choose to implement required changes or ask the submitter of the pull
them. Even though, all LAMMPS developers may have write access to pull request to implement them. Even though, all LAMMPS developers may have
requests (if enabled by the submitter, which is the default), only the write access to pull requests (if enabled by the submitter, which is the
submitter or the assignee of a pull request may do so. During this default), only the submitter or the assignee of a pull request should do
period the `work_in_progress` label may be applied to the pull so. During this period, the `work_in_progress` label may be applied to
request. The assignee gets to decide what happens to the pull request the pull request. The assignee gets to decide what happens to the pull
next, e.g. whether it should be assigned to a different developer for request next, e.g. whether it should be assigned to a different
additional checks and changes, or is recommended to be merged. Removing developer for additional checks and changes, or is recommended to be
the `work_in_progress` label and assigning the pull request to the merged. Removing the `work_in_progress` label and assigning the pull
developer tasked with merging signals that a pull request is ready to be request to the developer tasked with merging signals that a pull request
merged. In addition, a `ready_for_merge` label may also be assigned is ready to be merged. In addition, a `ready_for_merge` label may also
to signal urgency to merge this pull request quickly. be assigned to signal urgency to merge this pull request quickly.
### Pull Request Reviews ### Pull Request Reviews
@ -70,32 +73,33 @@ People can be assigned to review a pull request in two ways:
* They can be assigned manually to review a pull request * They can be assigned manually to review a pull request
by the submitter or a LAMMPS developer by the submitter or a LAMMPS developer
* They can be automatically assigned, because a developers matches * They can be automatically assigned, because a developer's GitHub
a file pattern in the `.github/CODEOWNERS` file, which associates handle matches a file pattern in the `.github/CODEOWNERS` file,
developers with the code they contributed and maintain. which associates developers with the code they contributed and
maintain.
Reviewers are requested to state their appraisal of the proposed changes Reviewers are requested to state their appraisal of the proposed changes
and either approve or request changes. People may unassign themselves and either approve or request changes. People may unassign themselves
from review, if they feel not competent about the changes proposed. At from review, if they feel not competent about the changes proposed. At
least two approvals from LAMMPS developers with write access are required least two approvals from LAMMPS developers with write access are
before merging in addition to the automated compilation tests. required before merging, in addition to passing all automated
Merging counts as implicit approval, so does submission of a pull request compilation and unit tests. Merging counts as implicit approval, so
(by a LAMMPS developer). So the person doing the merge may not also submit does submission of a pull request (by a LAMMPS developer). So the person
an approving review. The feature, that reviews from code owners are "hard" doing the merge may not also submit an approving review. The GitHub
reviews (i.e. they must all be approved before merging is allowed), is feature, that reviews from code owners are "hard" reviews (i.e. they
currently disabled and it is in the discretion of the merge maintainer to must all approve before merging is allowed), is currently disabled.
assess when a sufficient degree of approval, especially from external It is in the discretion of the merge maintainer to assess when a
contributors, has been reached in these cases. Reviews may be sufficient degree of approval has been reached, especially from external
(automatically) dismissed, when the reviewed code has been changed, collaborators. Reviews may be (automatically) dismissed, when the
and then approval is required a second time. reviewed code has been changed. Review may be requested a second time.
### Pull Request Discussions ### Pull Request Discussions
All discussions about a pull request should be kept as much as possible All discussions about a pull request should be kept as much as possible
on the pull request discussion page on GitHub, so that other developers on the pull request discussion page on GitHub, so that other developers
can later review the entire discussion after the fact and understand the can later review the entire discussion after the fact and understand the
rationale behind choices made. Exceptions to this policy are technical rationale behind choices that were made. Exceptions to this policy are
discussions, that are centered on tools or policies themselves technical discussions, that are centered on tools or policies themselves
(git, GitHub, c++) rather than on the content of the pull request. (git, GitHub, c++) rather than on the content of the pull request.
## GitHub Issues ## GitHub Issues
@ -109,39 +113,43 @@ marker in the subject. This is automatically done when using the
corresponding template for submitting an issue. Issues may be assigned corresponding template for submitting an issue. Issues may be assigned
to one or more developers, if they are working on this feature or to one or more developers, if they are working on this feature or
working to resolve an issue. Issues that have nobody working working to resolve an issue. Issues that have nobody working
on them at the moment or in the near future, have the label on them at the moment, or in the near future, have the label
`volunteer needed` attached. `volunteer needed` attached.
When an issue, say `#125` is resolved by a specific pull request, When an issue, say `#125` is resolved by a specific pull request, the
the comment for the pull request shall contain the text `closes #125` comment for the pull request shall contain the text `closes #125` or
or `fixes #125`, so that the issue is automatically deleted when `fixes #125`, so that the issue is automatically deleted when the pull
the pull request is merged. The template for pull requests includes request is merged. The template for pull requests includes a header
a header where connections between pull requests and issues can be listed where connections between pull requests and issues can be listed, and
and thus were this comment should be placed. thus where this comment should be placed.
## Milestones and Release Planning ## Milestones and Release Planning
LAMMPS uses a continuous release development model with incremental LAMMPS uses a continuous release development model with incremental
changes, i.e. significant effort is made - including automated pre-merge changes, i.e. significant effort is made -- including automated pre-merge
testing - that the code in the branch "develop" does not get easily testing -- that the code in the branch "develop" does not get easily
broken. These tests are run after every update to a pull request. More broken. These tests are run after every update to a pull request. More
extensive and time consuming tests (including regression testing) are extensive and time-consuming tests (including regression testing) are
performed after code is merged to the "develop" branch. There are patch performed after code is merged to the "develop" branch. There are feature
releases of LAMMPS every 3-5 weeks at a point, when the LAMMPS releases of LAMMPS made about every 4-6 weeks at a point, when the LAMMPS
developers feel, that a sufficient amount of changes have happened, and developers feel, that a sufficient number of changes has been included
the post-merge testing has been successful. These patch releases are and all post-merge testing has been successful. These feature releases are
marked with a `patch_<version date>` tag and the "release" branch marked with a `patch_<version date>` tag and the "release" branch
follows only these versions (and thus is always supposed to be of follows only these versions with fast-forward merges. While "develop" may
production quality, unlike "develop", which may be temporary broken, in be temporarily broken through issues only detected by the post-merge tests,
the case of larger change sets or unexpected incompatibilities or side The "release" branch is always supposed to be of production quality.
effects.
About 1-2 times each year, there are going to be "stable" releases of About once each year, there is a "stable" release of LAMMPS.
LAMMPS. These have seen additional, manual testing and review of These have seen additional, manual testing and review of
results from testing with instrumented code and static code analysis. results from testing with instrumented code and static code analysis.
Also, the last 1-3 patch releases before a stable release are "release Also, the last few feature releases before a stable release are "release
candidate" versions which only contain bugfixes and documentation candidate" versions which only contain bug fixes, feature additions to
updates. For release planning and the information of code contributors, peripheral functionality, and documentation updates. In between stable
issues and pull requests being actively worked on are assigned a releases, bug fixes and infrastructure updates are back-ported from the
"milestone", which corresponds to the next stable release or the stable "develop" branch to the "maintenance" branch and occasionally merged
release after that, with a tentative release date. into "stable" and published as update releases.
For release planning and the information of code contributors, issues
and pull requests being actively worked on are assigned a "milestone",
which corresponds to the next stable release or the stable release after
that, with a tentative release date.

View File

@ -1,7 +1,7 @@
.TH LAMMPS "1" "22 December 2022" "2022-12-22" .TH LAMMPS "1" "8 February 2023" "2023-02-08"
.SH NAME .SH NAME
.B LAMMPS .B LAMMPS
\- Molecular Dynamics Simulator. Version 22 December 2022 \- Molecular Dynamics Simulator. Version 8 February 2023
.SH SYNOPSIS .SH SYNOPSIS
.B lmp .B lmp

View File

@ -1,11 +1,11 @@
.TH MSI2LMP "1" "v3.9.9" "2018-11-05" .TH MSI2LMP "1" "v3.9.10" "2023-03-10"
.SH NAME .SH NAME
.B MSI2LMP .B MSI2LMP
\- Converter for Materials Studio files to LAMMPS \- Converter for Materials Studio files to LAMMPS
.SH SYNOPSIS .SH SYNOPSIS
.B msi2lmp .B msi2lmp
<ROOTNAME> [-class <I|1|II|2|O|0>] [-frc <path to frc file>] [-print #] [-ignore] [-nocenter] [-oldstyle] [-shift <x> <y> <z>] [-help] <ROOTNAME> [-class <I|1|II|2|O|0>] [-frc <path to frc file>] [-print #] [-ignore] [-nocenter] [-oldstyle] [-shift <x> <y> <z>]
.SH DESCRIPTION .SH DESCRIPTION
.PP .PP
@ -22,6 +22,9 @@ needed between .frc and .car/.mdf files are the atom types.
.SH OPTIONS .SH OPTIONS
.TP .TP
\fB\-h\fR, \fB\-help\fR,
Print detailed help message to the screen and stop.
.TP
\fB\<ROOTNAME>\fR \fB\<ROOTNAME>\fR
This has to be the first argument and is a This has to be the first argument and is a
.B mandatory .B mandatory

View File

@ -63,7 +63,7 @@ In the src directory, there is one top-level Makefile and several
low-level machine-specific files named Makefile.xxx where xxx = the low-level machine-specific files named Makefile.xxx where xxx = the
machine name. If a low-level Makefile exists for your platform, you do machine name. If a low-level Makefile exists for your platform, you do
not need to edit the top-level Makefile. However you should check the not need to edit the top-level Makefile. However you should check the
system-specific section of the low-level Makefile to insure the system-specific section of the low-level Makefile to ensure the
various paths are correct for your environment. If a low-level various paths are correct for your environment. If a low-level
Makefile does not exist for your platform, you will need to add a Makefile does not exist for your platform, you will need to add a
suitable target to the top-level Makefile. You will also need to suitable target to the top-level Makefile. You will also need to

View File

@ -1206,7 +1206,7 @@ this command is not typically needed if the &quot;nonbond style&quot; and &quot;
an exception to this is if a short cutoff is used initially, an exception to this is if a short cutoff is used initially,
but a longer cutoff will be used for a subsequent run (in the same but a longer cutoff will be used for a subsequent run (in the same
input script), in this case the &quot;maximum cutoff&quot; command should be input script), in this case the &quot;maximum cutoff&quot; command should be
used to insure enough memory is allocated for the later run used to ensure enough memory is allocated for the later run
note that a restart file contains nonbond cutoffs (so it is not necessary note that a restart file contains nonbond cutoffs (so it is not necessary
to use a &quot;nonbond style&quot; command before &quot;read restart&quot;), but LAMMPS to use a &quot;nonbond style&quot; command before &quot;read restart&quot;), but LAMMPS
still needs to know what the maximum cutoff will be before the still needs to know what the maximum cutoff will be before the

View File

@ -6,9 +6,9 @@ either traditional makefiles for use with GNU make (which may require
manual editing), or using a build environment generated by CMake (Unix manual editing), or using a build environment generated by CMake (Unix
Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more). Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more).
As an alternative you can download a package with pre-built executables As an alternative, you can download a package with pre-built executables
or automated build trees as described on the :doc:`Install <Install>` or automated build trees, as described in the :doc:`Install <Install>`
page. section of the manual.
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@ -44,7 +44,7 @@ standard. A more detailed discussion of that is below.
The executable created by CMake (after running make) is named The executable created by CMake (after running make) is named
``lmp`` unless the ``LAMMPS_MACHINE`` option is set. When setting ``lmp`` unless the ``LAMMPS_MACHINE`` option is set. When setting
``LAMMPS_MACHINE=name`` the executable will be called ``LAMMPS_MACHINE=name``, the executable will be called
``lmp_name``. Using ``BUILD_MPI=no`` will enforce building a ``lmp_name``. Using ``BUILD_MPI=no`` will enforce building a
serial executable using the MPI STUBS library. serial executable using the MPI STUBS library.
@ -60,7 +60,7 @@ standard. A more detailed discussion of that is below.
Any ``make machine`` command will look up the make settings from a Any ``make machine`` command will look up the make settings from a
file ``Makefile.machine`` in the folder ``src/MAKE`` or one of its file ``Makefile.machine`` in the folder ``src/MAKE`` or one of its
sub-directories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a subdirectories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a
folder ``Obj_machine`` with all objects and generated files and an folder ``Obj_machine`` with all objects and generated files and an
executable called ``lmp_machine``\ . The standard parallel build executable called ``lmp_machine``\ . The standard parallel build
with ``make mpi`` assumes a standard MPI installation with MPI with ``make mpi`` assumes a standard MPI installation with MPI
@ -107,9 +107,9 @@ MPI and OpenMP support in LAMMPS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you are installing MPI yourself to build a parallel LAMMPS If you are installing MPI yourself to build a parallel LAMMPS
executable, we recommend either MPICH or OpenMPI which are regularly executable, we recommend either MPICH or OpenMPI, which are regularly
used and tested with LAMMPS by the LAMMPS developers. MPICH can be used and tested with LAMMPS by the LAMMPS developers. MPICH can be
downloaded from the `MPICH home page <https://www.mpich.org>`_ and downloaded from the `MPICH home page <https://www.mpich.org>`_, and
OpenMPI can be downloaded correspondingly from the `OpenMPI home page OpenMPI can be downloaded correspondingly from the `OpenMPI home page
<https://www.open-mpi.org>`_. Other MPI packages should also work. No <https://www.open-mpi.org>`_. Other MPI packages should also work. No
specific vendor provided and standard compliant MPI library is currently specific vendor provided and standard compliant MPI library is currently
@ -130,12 +130,12 @@ package can be compiled to include OpenMP threading.
In addition, there are a few commands in LAMMPS that have native OpenMP In addition, there are a few commands in LAMMPS that have native OpenMP
support included as well. These are commands in the ``MPIIO``, support included as well. These are commands in the ``MPIIO``,
``ML-SNAP``, ``DIFFRACTION``, and ``DPD-REACT`` packages. In addition ``ML-SNAP``, ``DIFFRACTION``, and ``DPD-REACT`` packages. Furthermore,
some packages support OpenMP threading indirectly through the libraries some packages support OpenMP threading indirectly through the libraries
they interface to: e.g. ``LATTE``, ``KSPACE``, and ``COLVARS``. they interface to: e.g. ``LATTE``, ``KSPACE``, and ``COLVARS``. See the
See the :doc:`Packages details <Packages_details>` page for more :doc:`Packages details <Packages_details>` page for more info on these
info on these packages and the pages for their respective commands packages, and the pages for their respective commands for OpenMP
for OpenMP threading info. threading info.
For CMake, if you use ``BUILD_OMP=yes``, you can use these packages For CMake, if you use ``BUILD_OMP=yes``, you can use these packages
and turn on their native OpenMP support and turn on their native OpenMP and turn on their native OpenMP support and turn on their native OpenMP
@ -144,9 +144,9 @@ variable before you launch LAMMPS.
For building via conventional make, the ``CCFLAGS`` and ``LINKFLAGS`` For building via conventional make, the ``CCFLAGS`` and ``LINKFLAGS``
variables in Makefile.machine need to include the compiler flag that variables in Makefile.machine need to include the compiler flag that
enables OpenMP. For GNU compilers it is ``-fopenmp``\ . For (recent) Intel enables OpenMP. For the GNU compilers or Clang, it is ``-fopenmp``\ .
compilers it is ``-qopenmp``\ . If you are using a different compiler, For (recent) Intel compilers, it is ``-qopenmp``\ . If you are using a
please refer to its documentation. different compiler, please refer to its documentation.
.. _default-none-issues: .. _default-none-issues:
@ -174,15 +174,16 @@ Choice of compiler and compile/link options
The choice of compiler and compiler flags can be important for maximum The choice of compiler and compiler flags can be important for maximum
performance. Vendor provided compilers for a specific hardware can performance. Vendor provided compilers for a specific hardware can
produce faster code than open-source compilers like the GNU compilers. produce faster code than open-source compilers like the GNU compilers.
On the most common x86 hardware most popular C++ compilers are quite On the most common x86 hardware, the most popular C++ compilers are
similar in performance of C/C++ code at high optimization levels. When quite similar in their ability to optimize regular C/C++ source code at
using the ``INTEL`` package, there is a distinct advantage in using high optimization levels. When using the ``INTEL`` package, there is a
the `Intel C++ compiler <intel_>`_ due to much improved vectorization distinct advantage in using the `Intel C++ compiler <intel_>`_ due to
through SSE and AVX instructions on compatible hardware as the source much improved vectorization through SSE and AVX instructions on
code includes changes and Intel compiler specific directives to enable compatible hardware. The source code in that package conditionally
high degrees of vectorization. This may change over time as equivalent includes compiler specific directives to enable these high degrees of
vectorization directives are included into OpenMP standard revisions and vectorization. This may change over time as equivalent vectorization
other compilers adopt them. directives are included into the OpenMP standard and other compilers
adopt them.
.. _intel: https://software.intel.com/en-us/intel-compilers .. _intel: https://software.intel.com/en-us/intel-compilers
@ -196,7 +197,7 @@ LAMMPS.
.. tab:: CMake build .. tab:: CMake build
By default CMake will use the compiler it finds according to By default CMake will use the compiler it finds according to
internal preferences and it will add optimization flags internal preferences, and it will add optimization flags
appropriate to that compiler and any :doc:`accelerator packages appropriate to that compiler and any :doc:`accelerator packages
<Speed_packages>` you have included in the build. CMake will <Speed_packages>` you have included in the build. CMake will
check if the detected or selected compiler is compatible with the check if the detected or selected compiler is compatible with the
@ -250,9 +251,9 @@ LAMMPS.
and `-C ../cmake/presets/pgi.cmake` and `-C ../cmake/presets/pgi.cmake`
will switch the compiler to the PGI compilers. will switch the compiler to the PGI compilers.
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add Furthermore, you can set ``CMAKE_TUNE_FLAGS`` to specifically add
compiler flags to tune for optimal performance on given hosts. By compiler flags to tune for optimal performance on given hosts.
default this variable is empty. This variable is empty by default.
.. note:: .. note::
@ -368,10 +369,10 @@ running LAMMPS from Python via its library interface.
# no default value # no default value
The compilation will always produce a LAMMPS library and an The compilation will always produce a LAMMPS library and an
executable linked to it. By default this will be a static library executable linked to it. By default, this will be a static
named ``liblammps.a`` and an executable named ``lmp`` Setting library named ``liblammps.a`` and an executable named ``lmp``
``BUILD_SHARED_LIBS=yes`` will instead produce a shared library Setting ``BUILD_SHARED_LIBS=yes`` will instead produce a shared
called ``liblammps.so`` (or ``liblammps.dylib`` or library called ``liblammps.so`` (or ``liblammps.dylib`` or
``liblammps.dll`` depending on the platform) If ``liblammps.dll`` depending on the platform) If
``LAMMPS_MACHINE=name`` is set in addition, the name of the ``LAMMPS_MACHINE=name`` is set in addition, the name of the
generated libraries will be changed to either ``liblammps_name.a`` generated libraries will be changed to either ``liblammps_name.a``
@ -429,7 +430,7 @@ You may need to use ``sudo make install`` in place of the last line if
you do not have write privileges for ``/usr/local/lib`` or use the you do not have write privileges for ``/usr/local/lib`` or use the
``--prefix`` configuration option to select an installation folder, ``--prefix`` configuration option to select an installation folder,
where you do have write access. The end result should be the file where you do have write access. The end result should be the file
``/usr/local/lib/libmpich.so``. On many Linux installations the folder ``/usr/local/lib/libmpich.so``. On many Linux installations, the folder
``${HOME}/.local`` is an alternative to using ``/usr/local`` and does ``${HOME}/.local`` is an alternative to using ``/usr/local`` and does
not require superuser or sudo access. In that case the configuration not require superuser or sudo access. In that case the configuration
step becomes: step becomes:
@ -438,9 +439,10 @@ step becomes:
./configure --enable-shared --prefix=${HOME}/.local ./configure --enable-shared --prefix=${HOME}/.local
Avoiding to use "sudo" for custom software installation (i.e. from source Avoiding the use of "sudo" for custom software installation (i.e. from
and not through a package manager tool provided by the OS) is generally source and not through a package manager tool provided by the OS) is
recommended to ensure the integrity of the system software installation. generally recommended to ensure the integrity of the system software
installation.
---------- ----------
@ -514,11 +516,11 @@ using CMake or Make.
Install LAMMPS after a build Install LAMMPS after a build
------------------------------------------ ------------------------------------------
After building LAMMPS, you may wish to copy the LAMMPS executable of After building LAMMPS, you may wish to copy the LAMMPS executable or
library, along with other LAMMPS files (library header, doc files) to library, along with other LAMMPS files (library header, doc files), to a
a globally visible place on your system, for others to access. Note globally visible place on your system, for others to access. Note that
that you may need super-user privileges (e.g. sudo) if the directory you may need super-user privileges (e.g. sudo) if the directory you want
you want to copy files to is protected. to copy files to is protected.
.. tabs:: .. tabs::
@ -536,7 +538,7 @@ you want to copy files to is protected.
environment variable, if you are installing LAMMPS into a non-system environment variable, if you are installing LAMMPS into a non-system
location and/or are linking to libraries in a non-system location that location and/or are linking to libraries in a non-system location that
depend on such runtime path settings. depend on such runtime path settings.
As an alternative you may set the CMake variable ``LAMMPS_INSTALL_RPATH`` As an alternative, you may set the CMake variable ``LAMMPS_INSTALL_RPATH``
to ``on`` and then the runtime paths for any linked shared libraries to ``on`` and then the runtime paths for any linked shared libraries
and the library installation folder for the LAMMPS library will be and the library installation folder for the LAMMPS library will be
embedded and thus the requirement to set environment variables is avoided. embedded and thus the requirement to set environment variables is avoided.

View File

@ -9,10 +9,10 @@ page.
The following text assumes some familiarity with CMake and focuses on The following text assumes some familiarity with CMake and focuses on
using the command line tool ``cmake`` and what settings are supported using the command line tool ``cmake`` and what settings are supported
for building LAMMPS. A more detailed tutorial on how to use ``cmake`` for building LAMMPS. A more detailed tutorial on how to use CMake
itself, the text mode or graphical user interface, change the generated itself, the text mode or graphical user interface, to change the
output files for different build tools and development environments is generated output files for different build tools and development
on a :doc:`separate page <Howto_cmake>`. environments is on a :doc:`separate page <Howto_cmake>`.
.. note:: .. note::
@ -22,12 +22,12 @@ on a :doc:`separate page <Howto_cmake>`.
.. warning:: .. warning::
You must not mix the :doc:`traditional make based <Build_make>` You must not mix the :doc:`traditional make based <Build_make>`
LAMMPS build procedure with using CMake. Thus no packages may be LAMMPS build procedure with using CMake. No packages may be
installed or a build been previously attempted in the LAMMPS source installed or a build been previously attempted in the LAMMPS source
directory by using ``make <machine>``. CMake will detect if this is directory by using ``make <machine>``. CMake will detect if this is
the case and generate an error. To remove conflicting files from the the case and generate an error. To remove conflicting files from the
``src`` you can use the command ``make no-all purge`` which will ``src`` you can use the command ``make no-all purge`` which will
un-install all packages and delete all auto-generated files. uninstall all packages and delete all auto-generated files.
Advantages of using CMake Advantages of using CMake
@ -44,9 +44,9 @@ software or for people that want to modify or extend LAMMPS.
and adapt the LAMMPS default build configuration accordingly. and adapt the LAMMPS default build configuration accordingly.
- CMake can generate files for different build tools and integrated - CMake can generate files for different build tools and integrated
development environments (IDE). development environments (IDE).
- CMake supports customization of settings with a text mode or graphical - CMake supports customization of settings with a command line, text
user interface. No knowledge of file formats or and complex command mode, or graphical user interface. No knowledge of file formats or
line syntax required. complex command line syntax is required.
- All enabled components are compiled in a single build operation. - All enabled components are compiled in a single build operation.
- Automated dependency tracking for all files and configuration options. - Automated dependency tracking for all files and configuration options.
- Support for true out-of-source compilation. Multiple configurations - Support for true out-of-source compilation. Multiple configurations
@ -55,23 +55,23 @@ software or for people that want to modify or extend LAMMPS.
source tree. source tree.
- Simplified packaging of LAMMPS for Linux distributions, environment - Simplified packaging of LAMMPS for Linux distributions, environment
modules, or automated build tools like `Homebrew <https://brew.sh/>`_. modules, or automated build tools like `Homebrew <https://brew.sh/>`_.
- Integration of automated regression testing (the LAMMPS side for that - Integration of automated unit and regression testing (the LAMMPS side
is still under development). of this is still under active development).
.. _cmake_build: .. _cmake_build:
Getting started Getting started
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
Building LAMMPS with CMake is a two-step process. First you use CMake Building LAMMPS with CMake is a two-step process. In the first step,
to generate a build environment in a new directory. For that purpose you use CMake to generate a build environment in a new directory. For
you can use either the command-line utility ``cmake`` (or ``cmake3``), that purpose you can use either the command-line utility ``cmake`` (or
the text-mode UI utility ``ccmake`` (or ``ccmake3``) or the graphical ``cmake3``), the text-mode UI utility ``ccmake`` (or ``ccmake3``) or the
utility ``cmake-gui``, or use them interchangeably. The second step is graphical utility ``cmake-gui``, or use them interchangeably. The
then the compilation and linking of all objects, libraries, and second step is then the compilation and linking of all objects,
executables. Here is a minimal example using the command line version of libraries, and executables using the selected build tool. Here is a
CMake to build LAMMPS with no add-on packages enabled and no minimal example using the command line version of CMake to build LAMMPS
customization: with no add-on packages enabled and no customization:
.. code-block:: bash .. code-block:: bash
@ -96,17 +96,17 @@ Compilation can take a long time, since LAMMPS is a large project with
many features. If your machine has multiple CPU cores (most do these many features. If your machine has multiple CPU cores (most do these
days), you can speed this up by compiling sources in parallel with days), you can speed this up by compiling sources in parallel with
``make -j N`` (with N being the maximum number of concurrently executed ``make -j N`` (with N being the maximum number of concurrently executed
tasks). Also installation of the `ccache <https://ccache.dev/>`_ (= tasks). Installation of the `ccache <https://ccache.dev/>`_ (= Compiler
Compiler Cache) software may speed up repeated compilation even more, Cache) software may speed up repeated compilation even more, e.g. during
e.g. during code development. code development, especially when repeatedly switching between branches.
After the initial build, whenever you edit LAMMPS source files, enable After the initial build, whenever you edit LAMMPS source files, enable
or disable packages, change compiler flags or build options, you must or disable packages, change compiler flags or build options, you must
re-compile and relink the LAMMPS executable with ``cmake --build .`` (or re-compile and relink the LAMMPS executable with ``cmake --build .`` (or
``make``). If the compilation fails for some reason, try running ``make``). If the compilation fails for some reason, try running
``cmake .`` and then compile again. The included dependency tracking ``cmake .`` and then compile again. The included dependency tracking
should make certain that only the necessary subset of files are should make certain that only the necessary subset of files is
re-compiled. You can also delete compiled objects, libraries and re-compiled. You can also delete compiled objects, libraries, and
executables with ``cmake --build . --target clean`` (or ``make clean``). executables with ``cmake --build . --target clean`` (or ``make clean``).
After compilation, you may optionally install the LAMMPS executable into After compilation, you may optionally install the LAMMPS executable into
@ -132,12 +132,12 @@ file called ``CMakeLists.txt`` (for LAMMPS it is located in the
``CMakeCache.txt``, which is generated at the end of the CMake ``CMakeCache.txt``, which is generated at the end of the CMake
configuration step. The cache file contains all current CMake settings. configuration step. The cache file contains all current CMake settings.
To modify settings, enable or disable features, you need to set *variables* To modify settings, enable or disable features, you need to set
with either the *-D* command line flag (``-D VARIABLE1_NAME=value``) or *variables* with either the *-D* command line flag (``-D
change them in the text mode of graphical user interface. The *-D* flag VARIABLE1_NAME=value``) or change them in the text mode of the graphical
can be used several times in one command. user interface. The *-D* flag can be used several times in one command.
For your convenience we provide :ref:`CMake presets <cmake_presets>` For your convenience, we provide :ref:`CMake presets <cmake_presets>`
that combine multiple settings to enable optional LAMMPS packages or use that combine multiple settings to enable optional LAMMPS packages or use
a different compiler tool chain. Those are loaded with the *-C* flag a different compiler tool chain. Those are loaded with the *-C* flag
(``-C ../cmake/presets/basic.cmake``). This step would only be needed (``-C ../cmake/presets/basic.cmake``). This step would only be needed
@ -155,22 +155,23 @@ specific CMake version is given when running ``cmake --help``.
Multi-configuration build systems Multi-configuration build systems
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Throughout this manual it is mostly assumed that LAMMPS is being built Throughout this manual, it is mostly assumed that LAMMPS is being built
on a Unix-like operating system with "make" as the underlying "builder", on a Unix-like operating system with "make" as the underlying "builder",
since this is the most common case. In this case the build "configuration" since this is the most common case. In this case the build
is chose using ``-D CMAKE_BUILD_TYPE=<configuration>`` with ``<configuration>`` "configuration" is chose using ``-D CMAKE_BUILD_TYPE=<configuration>``
being one of "Release", "Debug", "RelWithDebInfo", or "MinSizeRel". with ``<configuration>`` being one of "Release", "Debug",
Some build tools, however, can also use or even require to have a so-called "RelWithDebInfo", or "MinSizeRel". Some build tools, however, can also
multi-configuration build system setup. For those the built type (or use or even require having a so-called multi-configuration build system
configuration) is chosen at compile time using the same build files. E.g. setup. For a multi-configuration build, the built type (or
with: configuration) is selected at compile time using the same build
files. E.g. with:
.. code-block:: bash .. code-block:: bash
cmake --build build-multi --config Release cmake --build build-multi --config Release
In that case the resulting binaries are not in the build folder directly In that case the resulting binaries are not in the build folder directly
but in sub-directories corresponding to the build type (i.e. Release in but in subdirectories corresponding to the build type (i.e. Release in
the example from above). Similarly, for running unit tests the the example from above). Similarly, for running unit tests the
configuration is selected with the *-C* flag: configuration is selected with the *-C* flag:
@ -184,7 +185,7 @@ particular applicable to compiling packages that require additional libraries
that would be downloaded and compiled by CMake. The "windows" preset file that would be downloaded and compiled by CMake. The "windows" preset file
tries to keep track of which packages can be compiled natively with the tries to keep track of which packages can be compiled natively with the
MSVC compilers out-of-the box. Not all of those external libraries are MSVC compilers out-of-the box. Not all of those external libraries are
portable to Windows either. portable to Windows, either.
Installing CMake Installing CMake

View File

@ -46,7 +46,7 @@ It can be enabled for all C++ code with the following CMake flag
With this flag enabled all source files will be processed twice, first to 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 be compiled and then to be analyzed. Please note that the analysis can be
significantly more time consuming than the compilation itself. significantly more time-consuming than the compilation itself.
---------- ----------

View File

@ -47,7 +47,6 @@ This is the list of packages that may require additional steps.
* :ref:`LEPTON <lepton>` * :ref:`LEPTON <lepton>`
* :ref:`MACHDYN <machdyn>` * :ref:`MACHDYN <machdyn>`
* :ref:`MDI <mdi>` * :ref:`MDI <mdi>`
* :ref:`MESONT <mesont>`
* :ref:`ML-HDNNP <ml-hdnnp>` * :ref:`ML-HDNNP <ml-hdnnp>`
* :ref:`ML-IAP <mliap>` * :ref:`ML-IAP <mliap>`
* :ref:`ML-PACE <ml-pace>` * :ref:`ML-PACE <ml-pace>`
@ -127,10 +126,11 @@ CMake build
-D GPU_API=value # value = opencl (default) or cuda or hip -D GPU_API=value # value = opencl (default) or cuda or hip
-D GPU_PREC=value # precision setting -D GPU_PREC=value # precision setting
# value = double or mixed (default) or single # value = double or mixed (default) or single
-D HIP_PATH # path to HIP installation. Must be set if GPU_API=HIP
-D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda -D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda
# value = sm_XX, see below # value = sm_XX (see below, default is sm_50)
# default is sm_50 -D GPU_DEBUG=value # enable debug code in the GPU package library, mostly useful for developers
# value = yes or no (default)
-D HIP_PATH=value # value = path to HIP installation. Must be set if GPU_API=HIP
-D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip -D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip
# value depends on selected HIP_PLATFORM # value depends on selected HIP_PLATFORM
# default is 'gfx906' for HIP_PLATFORM=amd and 'sm_50' for HIP_PLATFORM=nvcc # default is 'gfx906' for HIP_PLATFORM=amd and 'sm_50' for HIP_PLATFORM=nvcc
@ -274,7 +274,7 @@ To enable GPU binning via CUDA performance primitives set the Makefile variable
most modern GPUs. most modern GPUs.
To support the CUDA multiprocessor server you can set the define To support the CUDA multiprocessor server you can set the define
``-DCUDA_PROXY``. Please note that in this case you must **not** use ``-DCUDA_MPS_SUPPORT``. Please note that in this case you must **not** use
the CUDA performance primitives and thus set the variable ``CUDPP_OPT`` the CUDA performance primitives and thus set the variable ``CUDPP_OPT``
to empty. to empty.
@ -288,7 +288,7 @@ your machine are not correct, the LAMMPS build will fail, and
.. note:: .. note::
If you re-build the GPU library in ``lib/gpu``, you should always If you re-build the GPU library in ``lib/gpu``, you should always
un-install the GPU package in ``lammps/src``, then re-install it and uninstall the GPU package in ``lammps/src``, then re-install it and
re-build LAMMPS. This is because the compilation of files in the GPU re-build LAMMPS. This is because the compilation of files in the GPU
package uses the library settings from the ``lib/gpu/Makefile.machine`` package uses the library settings from the ``lib/gpu/Makefile.machine``
used to build the GPU library. used to build the GPU library.
@ -606,6 +606,12 @@ They must be specified in uppercase.
* - AMPERE86 * - AMPERE86
- GPU - GPU
- NVIDIA Ampere generation CC 8.6 GPU - NVIDIA Ampere generation CC 8.6 GPU
* - ADA89
- GPU
- NVIDIA Ada Lovelace generation CC 8.9 GPU
* - HOPPER90
- GPU
- NVIDIA Hopper generation CC 9.0 GPU
* - VEGA900 * - VEGA900
- GPU - GPU
- AMD GPU MI25 GFX900 - AMD GPU MI25 GFX900
@ -640,7 +646,7 @@ They must be specified in uppercase.
- GPU - GPU
- Intel GPU Ponte Vecchio - Intel GPU Ponte Vecchio
This list was last updated for version 3.7.0 of the Kokkos library. This list was last updated for version 3.7.1 of the Kokkos library.
.. tabs:: .. tabs::
@ -915,9 +921,9 @@ included in the LAMMPS source distribution in the ``lib/lepton`` folder.
.. code-block:: bash .. code-block:: bash
$ make lib-lepton # print help message make lib-lepton # print help message
$ make lib-lepton args="-m serial" # build with GNU g++ compiler (settings as with "make serial") make lib-lepton args="-m serial" # build with GNU g++ compiler (settings as with "make serial")
$ make lib-lepton args="-m mpi" # build with default MPI compiler (settings as with "make mpi") make lib-lepton args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
The "machine" argument of the "-m" flag is used to find a The "machine" argument of the "-m" flag is used to find a
Makefile.machine to use as build recipe. Makefile.machine to use as build recipe.
@ -1129,7 +1135,7 @@ VORONOI package
----------------------------- -----------------------------
To build with this package, you must download and build the To build with this package, you must download and build the
`Voro++ library <https://math.lbl.gov/voro++>`_ or install a `Voro++ library <https://math.lbl.gov/voro++/>`_ or install a
binary package provided by your operating system. binary package provided by your operating system.
.. tabs:: .. tabs::
@ -1359,7 +1365,7 @@ module included in the LAMMPS source distribution.
auto-generated consistent with those used in the core LAMMPS makefiles. auto-generated consistent with those used in the core LAMMPS makefiles.
.. versionchanged:: TBD .. versionchanged:: 8Feb2023
Please note that Colvars uses the Lepton library, which is now Please note that Colvars uses the Lepton library, which is now
included with the LEPTON package; if you use anything other than included with the LEPTON package; if you use anything other than
@ -1391,8 +1397,21 @@ This package depends on the KSPACE package.
.. tab:: CMake build .. tab:: CMake build
No additional settings are needed besides ``-D PKG_KSPACE=yes`` and .. code-block:: bash
``-D PKG_ELECTRODE=yes``.
-D PKG_ELECTRODE=yes # enable the package itself
-D PKG_KSPACE=yes # the ELECTRODE package requires KSPACE
-D USE_INTERNAL_LINALG=value #
Features in the ELECTRODE package are dependent on code in the
KSPACE package so the latter one *must* be enabled.
The ELECTRODE package also requires LAPACK (and BLAS) and CMake
can identify their locations and pass that info to the LATTE build
script. But on some systems this may cause problems when linking
or the dependency is not desired. Try enabling
``USE_INTERNAL_LINALG`` in those cases to use the bundled linear
algebra library and work around the limitation.
.. tab:: Traditional make .. tab:: Traditional make
@ -1839,48 +1858,6 @@ MDI package
---------- ----------
.. _mesont:
MESONT package
-------------------------
This package includes a library written in Fortran 90 in the
``lib/mesont`` folder, so a working Fortran 90 compiler is required to
compile it. Also, the files with the force field data for running the
bundled examples are not included in the source distribution. Instead
they will be downloaded the first time this package is installed.
.. tabs::
.. tab:: CMake build
No additional settings are needed besides ``-D PKG_MESONT=yes``
.. tab:: Traditional make
Before building LAMMPS, you must build the *mesont* library in
``lib/mesont``\ . You can also do it in one step from the
``lammps/src`` dir, using a command like these, which simply
invokes the ``lib/mesont/Install.py`` script with the specified
args:
.. code-block:: bash
make lib-mesont # print help message
make lib-mesont args="-m gfortran" # build with GNU g++ compiler (settings as with "make serial")
make lib-mesont args="-m ifort" # build with Intel icc compiler
The build should produce two files: ``lib/mesont/libmesont.a`` and
``lib/mesont/Makefile.lammps``\ . The latter is copied from an
existing ``Makefile.lammps.\*`` and has settings needed to build
LAMMPS with the *mesont* library (though typically the settings
contain only the Fortran runtime library). If necessary, you can
edit/create a new ``lib/mesont/Makefile.machine`` file for your
system, which should define an ``EXTRAMAKE`` variable to specify a
corresponding ``Makefile.lammps.machine`` file.
----------
.. _molfile: .. _molfile:
MOLFILE package MOLFILE package
@ -1987,10 +1964,10 @@ OPENMP package
Apple offers the `Xcode package and IDE Apple offers the `Xcode package and IDE
<https://developer.apple.com/xcode/>`_ for compiling software on <https://developer.apple.com/xcode/>`_ for compiling software on
macOS, so you have likely installed it to compile LAMMPS. Their macOS, so you have likely installed it to compile LAMMPS. Their
compiler is based on `Clang <https://clang.llvm.org/>`, but while it compiler is based on `Clang <https://clang.llvm.org/>`_, but while it
is capable of processing OpenMP directives, the necessary header is capable of processing OpenMP directives, the necessary header
files and OpenMP runtime library are missing. The `R developers files and OpenMP runtime library are missing. The `R developers
<https://www.r-project.org/>` have figured out a way to build those <https://www.r-project.org/>`_ have figured out a way to build those
in a compatible fashion. One can download them from in a compatible fashion. One can download them from
`https://mac.r-project.org/openmp/ `https://mac.r-project.org/openmp/
<https://mac.r-project.org/openmp/>`_. Simply adding those files as <https://mac.r-project.org/openmp/>`_. Simply adding those files as

View File

@ -1,33 +1,32 @@
Link LAMMPS as a library to another code Link LAMMPS as a library to another code
======================================== ========================================
LAMMPS is designed as a library of C++ objects that can be LAMMPS is designed as a library of C++ objects that can be integrated
integrated into other applications including Python scripts. into other applications, including Python scripts. The files
The files ``src/library.cpp`` and ``src/library.h`` define a ``src/library.cpp`` and ``src/library.h`` define a C-style API for using
C-style API for using LAMMPS as a library. See the LAMMPS as a library. See the :doc:`Howto_library` page for a
:doc:`Howto_library` page description of the interface and how to use it for your needs.
for a description of the interface and how to use it for your needs.
The :doc:`Build_basics` page explains how to build The :doc:`Build_basics` page explains how to build LAMMPS as either a
LAMMPS as either a shared or static library. This results in a file shared or static library. This results in a file in the compilation
in the compilation folder called ``liblammps.a`` or ``liblammps_<name>.a`` folder called ``liblammps.a`` or ``liblammps_<name>.a`` in case of
in case of building a static library. In case of a shared library building a static library. In case of a shared library, the name is the
the name is the same only that the suffix is going to be either ``.so`` same only that the suffix is going to be either ``.so`` or ``.dylib`` or
or ``.dylib`` or ``.dll`` instead of ``.a`` depending on the OS. ``.dll`` instead of ``.a`` depending on the OS. In some cases, the
In some cases the ``.so`` file may be a symbolic link to a file with ``.so`` file may be a symbolic link to a file with the suffix ``.so.0``
the suffix ``.so.0`` (or some other number). (or some other number).
.. note:: .. note::
Care should be taken to use the same MPI library for the calling code Care should be taken to use the same MPI library for the calling code
and the LAMMPS library unless LAMMPS is to be compiled without (real) and the LAMMPS library, unless LAMMPS is to be compiled without (real)
MPI support using the include STUBS MPI library. MPI support using the included STUBS MPI library.
Link with LAMMPS as a static library Link with LAMMPS as a static library
------------------------------------ ------------------------------------
The calling application can link to LAMMPS as a static library with The calling application can link to LAMMPS as a static library with
compilation and link commands as in the examples shown below. These compilation and link commands, as in the examples shown below. These
are examples for a code written in C in the file ``caller.c``. are examples for a code written in C in the file ``caller.c``.
The benefit of linking to a static library is, that the resulting The benefit of linking to a static library is, that the resulting
executable is independent of that library since all required executable is independent of that library since all required
@ -142,10 +141,10 @@ Link with LAMMPS as a shared library
When linking to LAMMPS built as a shared library, the situation becomes When linking to LAMMPS built as a shared library, the situation becomes
much simpler, as all dependent libraries and objects are either included much simpler, as all dependent libraries and objects are either included
in the shared library or registered as a dependent library in the shared in the shared library or registered as a dependent library in the shared
library file. Thus those libraries need not to be specified when library file. Thus, those libraries need not be specified when linking
linking the calling executable. Only the *-I* flags are needed. So the the calling executable. Only the *-I* flags are needed. So the example
example case from above of the serial version static LAMMPS library with case from above of the serial version static LAMMPS library with the
the POEMS package installed becomes: POEMS package installed becomes:
.. tabs:: .. tabs::

View File

@ -20,21 +20,22 @@ with :doc:`CMake <Build_cmake>`. The makefiles of the traditional
make based build process and the scripts they are calling expect a few make based build process and the scripts they are calling expect a few
additional tools to be available and functioning. additional tools to be available and functioning.
* a working C/C++ compiler toolchain supporting the C++11 standard; on * A working C/C++ compiler toolchain supporting the C++11 standard; on
Linux these are often the GNU compilers. Some older compilers Linux, these are often the GNU compilers. Some older compiler versions
require adding flags like ``-std=c++11`` to enable the C++11 mode. require adding flags like ``-std=c++11`` to enable the C++11 mode.
* a Bourne shell compatible "Unix" shell program (often this is ``bash``) * A Bourne shell compatible "Unix" shell program (frequently this is ``bash``)
* a few shell utilities: ``ls``, ``mv``, ``ln``, ``rm``, ``grep``, ``sed``, ``tr``, ``cat``, ``touch``, ``diff``, ``dirname`` * A few shell utilities: ``ls``, ``mv``, ``ln``, ``rm``, ``grep``, ``sed``, ``tr``, ``cat``, ``touch``, ``diff``, ``dirname``
* python (optional, required for ``make lib-<pkg>`` in the src folder). * Python (optional, required for ``make lib-<pkg>`` in the src
python scripts are currently tested with python 2.7 and 3.6. The procedure folder). Python scripts are currently tested with python 2.7 and
for :doc:`building the documentation <Build_manual>` requires python 3.5 or later. 3.6 to 3.11. The procedure for :doc:`building the documentation
<Build_manual>` *requires* Python 3.5 or later.
Getting started Getting started
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
To include LAMMPS packages (i.e. optional commands and styles) you must To include LAMMPS packages (i.e. optional commands and styles) you must
enable (or "install") them first, as discussed on the :doc:`Build enable (or "install") them first, as discussed on the :doc:`Build
package <Build_package>` page. If a packages requires (provided or package <Build_package>` page. If a package requires (provided or
external) libraries, you must configure and build those libraries external) libraries, you must configure and build those libraries
**before** building LAMMPS itself and especially **before** enabling **before** building LAMMPS itself and especially **before** enabling
such a package with ``make yes-<package>``. :doc:`Building LAMMPS with such a package with ``make yes-<package>``. :doc:`Building LAMMPS with
@ -56,36 +57,36 @@ Compilation can take a long time, since LAMMPS is a large project with
many features. If your machine has multiple CPU cores (most do these many features. If your machine has multiple CPU cores (most do these
days), you can speed this up by compiling sources in parallel with days), you can speed this up by compiling sources in parallel with
``make -j N`` (with N being the maximum number of concurrently executed ``make -j N`` (with N being the maximum number of concurrently executed
tasks). Also installation of the `ccache <https://ccache.dev/>`_ (= tasks). Installation of the `ccache <https://ccache.dev/>`_ (= Compiler
Compiler Cache) software may speed up repeated compilation even more, Cache) software may speed up repeated compilation even more, e.g. during
e.g. during code development. code development, especially when repeatedly switching between branches.
After the initial build, whenever you edit LAMMPS source files, or add After the initial build, whenever you edit LAMMPS source files, or add
or remove new files to the source directory (e.g. by installing or or remove new files to the source directory (e.g. by installing or
uninstalling packages), you must re-compile and relink the LAMMPS uninstalling packages), you must re-compile and relink the LAMMPS
executable with the same ``make <machine>`` command. The makefile's executable with the same ``make <machine>`` command. The makefile's
dependency tracking should insure that only the necessary subset of dependency tracking should ensure that only the necessary subset of
files are re-compiled. If you change settings in the makefile, you have files is re-compiled. If you change settings in the makefile, you have
to recompile *everything*. To delete all objects you can use ``make to recompile *everything*. To delete all objects, you can use ``make
clean-<machine>``. clean-<machine>``.
.. note:: .. note::
Before the actual compilation starts, LAMMPS will perform several Before the actual compilation starts, LAMMPS will perform several
steps to collect information from the configuration and setup that steps to collect information from the configuration and setup that is
is then embedded into the executable. When you build LAMMPS for then embedded into the executable. When you build LAMMPS for the
the first time, it will also compile a tool to quickly assemble first time, it will also compile a tool to quickly determine a list
a list of dependencies, that are required for the make program to of dependencies. Those are required for the make program to
correctly detect which parts need to be recompiled after changes correctly detect, which files need to be recompiled or relinked
were made to the sources. after changes were made to the sources.
Customized builds and alternate makefiles Customized builds and alternate makefiles
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The ``src/MAKE`` directory tree contains the ``Makefile.<machine>`` The ``src/MAKE`` directory tree contains the ``Makefile.<machine>``
files included in the LAMMPS distribution. Typing ``make example`` uses files included in the LAMMPS distribution. Typing ``make example`` uses
``Makefile.example`` from one of those folders, if available. Thus the ``Makefile.example`` from one of those folders, if available. The
``make serial`` and ``make mpi`` lines above use ``make serial`` and ``make mpi`` lines above, for example, use
``src/MAKE/Makefile.serial`` and ``src/MAKE/Makefile.mpi``, ``src/MAKE/Makefile.serial`` and ``src/MAKE/Makefile.mpi``,
respectively. Other makefiles are in these directories: respectively. Other makefiles are in these directories:
@ -106,12 +107,13 @@ a new name, please edit the first line with the description and machine
name, so you will not confuse yourself, when looking at the machine name, so you will not confuse yourself, when looking at the machine
summary. summary.
Makefiles you may wish to try include these (some require a package Makefiles you may wish to try out, include those listed below (some
first be installed). Many of these include specific compiler flags require a package first be installed). Many of these include specific
for optimized performance. Please note, however, that some of these compiler flags for optimized performance. Please note, however, that
customized machine Makefile are contributed by users. Since both some of these customized machine Makefile are contributed by users, and
compilers, OS configurations, and LAMMPS itself keep changing, their thus may have modifications specific to the systems of those users.
settings may become outdated: Since compilers, OS configurations, and LAMMPS itself keep changing,
their settings may become outdated, too:
.. code-block:: bash .. code-block:: bash

View File

@ -2,7 +2,7 @@ Build the LAMMPS documentation
============================== ==============================
Depending on how you obtained LAMMPS and whether you have built the Depending on how you obtained LAMMPS and whether you have built the
manual yourself, this directory has a number of sub-directories and manual yourself, this directory has a number of subdirectories and
files. Here is a list with descriptions: files. Here is a list with descriptions:
.. code-block:: bash .. code-block:: bash
@ -33,7 +33,7 @@ various tools and files. Some of them have to be installed (see below). For
the rest the build process will attempt to download and install them into the rest the build process will attempt to download and install them into
a python virtual environment and local folders. a python virtual environment and local folders.
A current version of the manual (latest patch release, that is the state A current version of the manual (latest feature release, that is the state
of the *release* branch) is is available online at: of the *release* branch) is is available online at:
`https://docs.lammps.org/ <https://docs.lammps.org/>`_. `https://docs.lammps.org/ <https://docs.lammps.org/>`_.
A version of the manual corresponding to the ongoing development (that is A version of the manual corresponding to the ongoing development (that is
@ -48,9 +48,9 @@ Build using GNU make
The LAMMPS manual is written in `reStructuredText <rst_>`_ format which The LAMMPS manual is written in `reStructuredText <rst_>`_ format which
can be translated to different output format using the `Sphinx can be translated to different output format using the `Sphinx
<https://sphinx-doc.org>`_ document generator tool. It also <https://www.sphinx-doc.org/>`_ document generator tool. It also
incorporates programmer documentation extracted from the LAMMPS C++ incorporates programmer documentation extracted from the LAMMPS C++
sources through the `Doxygen <https://doxygen.nl>`_ program. Currently sources through the `Doxygen <https://doxygen.nl/>`_ program. Currently
the translation to HTML, PDF (via LaTeX), ePUB (for many e-book readers) the translation to HTML, PDF (via LaTeX), ePUB (for many e-book readers)
and MOBI (for Amazon Kindle readers) are supported. For that to work a and MOBI (for Amazon Kindle readers) are supported. For that to work a
Python 3 interpreter, the ``doxygen`` tools and internet access to Python 3 interpreter, the ``doxygen`` tools and internet access to
@ -87,6 +87,7 @@ folder. The following ``make`` commands are available:
make anchor_check # check for duplicate anchor labels make anchor_check # check for duplicate anchor labels
make style_check # check for complete and consistent style lists make style_check # check for complete and consistent style lists
make package_check # check for complete and consistent package lists make package_check # check for complete and consistent package lists
make link_check # check for broken or outdated URLs
make spelling # spell-check the manual make spelling # spell-check the manual
---------- ----------

View File

@ -4,13 +4,14 @@ Include packages in build
In LAMMPS, a package is a group of files that enable a specific set of In LAMMPS, a package is a group of files that enable a specific set of
features. For example, force fields for molecular systems or features. For example, force fields for molecular systems or
rigid-body constraints are in packages. In the src directory, each rigid-body constraints are in packages. In the src directory, each
package is a sub-directory with the package name in capital letters. package is a subdirectory with the package name in capital letters.
An overview of packages is given on the :doc:`Packages <Packages>` doc An overview of packages is given on the :doc:`Packages <Packages>` doc
page. Brief overviews of each package are on the :doc:`Packages details <Packages_details>` page. page. Brief overviews of each package are on the :doc:`Packages details
<Packages_details>` page.
When building LAMMPS, you can choose to include or exclude each When building LAMMPS, you can choose to include or exclude each
package. In general there is no need to include a package if you package. Generally, there is no need to include a package if you
never plan to use its features. never plan to use its features.
If you get a run-time error that a LAMMPS command or style is If you get a run-time error that a LAMMPS command or style is
@ -49,7 +50,6 @@ packages:
* :ref:`LEPTON <lepton>` * :ref:`LEPTON <lepton>`
* :ref:`MACHDYN <machdyn>` * :ref:`MACHDYN <machdyn>`
* :ref:`MDI <mdi>` * :ref:`MDI <mdi>`
* :ref:`MESONT <mesont>`
* :ref:`ML-HDNNP <ml-hdnnp>` * :ref:`ML-HDNNP <ml-hdnnp>`
* :ref:`ML-IAP <mliap>` * :ref:`ML-IAP <mliap>`
* :ref:`ML-PACE <ml-pace>` * :ref:`ML-PACE <ml-pace>`
@ -94,7 +94,7 @@ versus make.
If you switch between building with CMake and make builds, no If you switch between building with CMake and make builds, no
packages in the src directory can be installed when you invoke packages in the src directory can be installed when you invoke
``cmake``. CMake will give an error if that is not the case, ``cmake``. CMake will give an error if that is not the case,
indicating how you can un-install all packages in the src dir. indicating how you can uninstall all packages in the src dir.
.. tab:: Traditional make .. tab:: Traditional make
@ -103,7 +103,7 @@ versus make.
cd lammps/src cd lammps/src
make ps # check which packages are currently installed make ps # check which packages are currently installed
make yes-name # install a package with name make yes-name # install a package with name
make no-name # un-install a package with name make no-name # uninstall a package with name
make mpi # build LAMMPS with whatever packages are now installed make mpi # build LAMMPS with whatever packages are now installed
Examples: Examples:
@ -119,13 +119,13 @@ versus make.
.. note:: .. note::
You must always re-build LAMMPS (via make) after installing or You must always re-build LAMMPS (via make) after installing or
un-installing a package, for the action to take effect. The uninstalling a package, for the action to take effect. The
included dependency tracking will make certain only files that included dependency tracking will make certain only files that
are required to be rebuilt are recompiled. are required to be rebuilt are recompiled.
.. note:: .. note::
You cannot install or un-install packages and build LAMMPS in a You cannot install or uninstall packages and build LAMMPS in a
single make command with multiple targets, e.g. ``make single make command with multiple targets, e.g. ``make
yes-colloid mpi``. This is because the make procedure creates yes-colloid mpi``. This is because the make procedure creates
a list of source files that will be out-of-date for the build a list of source files that will be out-of-date for the build
@ -150,7 +150,7 @@ other files dependent on that package are also excluded.
if you downloaded a tarball, 3 packages (KSPACE, MANYBODY, MOLECULE) if you downloaded a tarball, 3 packages (KSPACE, MANYBODY, MOLECULE)
were pre-installed via the traditional make procedure in the ``src`` were pre-installed via the traditional make procedure in the ``src``
directory. That is no longer the case, so that CMake will build directory. That is no longer the case, so that CMake will build
as-is without needing to un-install those packages. as-is without needing to uninstall those packages.
---------- ----------
@ -167,9 +167,9 @@ control flow constructs for more complex operations.
LAMMPS includes several of these files to define configuration LAMMPS includes several of these files to define configuration
"presets", similar to the options that exist for the Make based "presets", similar to the options that exist for the Make based
system. Using these files you can enable/disable portions of the system. Using these files, you can enable/disable portions of the
available packages in LAMMPS. If you need a custom preset you can take available packages in LAMMPS. If you need a custom preset, you can
one of them as a starting point and customize it to your needs. make a copy of one of them and modify it to suit your needs.
.. code-block:: bash .. code-block:: bash
@ -183,7 +183,7 @@ one of them as a starting point and customize it to your needs.
cmake -C ../cmake/presets/pgi.cmake [OPTIONS] ../cmake # change settings to use the PGI compilers by default cmake -C ../cmake/presets/pgi.cmake [OPTIONS] ../cmake # change settings to use the PGI compilers by default
cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages
cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages
mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross compilers mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross-compilers
Presets that have names starting with "windows" are specifically for Presets that have names starting with "windows" are specifically for
compiling LAMMPS :doc:`natively on Windows <Build_windows>` and compiling LAMMPS :doc:`natively on Windows <Build_windows>` and
@ -227,7 +227,7 @@ The following commands are useful for managing package source files
and their installation when building LAMMPS via traditional make. and their installation when building LAMMPS via traditional make.
Just type ``make`` in lammps/src to see a one-line summary. Just type ``make`` in lammps/src to see a one-line summary.
These commands install/un-install sets of packages: These commands install/uninstall sets of packages:
.. code-block:: bash .. code-block:: bash
@ -243,40 +243,40 @@ These commands install/un-install sets of packages:
make yes-ext # install packages that require external libraries make yes-ext # install packages that require external libraries
make no-ext # uninstall packages that require external libraries make no-ext # uninstall packages that require external libraries
which install/un-install various sets of packages. Typing ``make which install/uninstall various sets of packages. Typing ``make
package`` will list all the these commands. package`` will list all the these commands.
.. note:: .. note::
Installing or un-installing a package for the make based build process Installing or uninstalling a package for the make based build process
works by simply copying files back and forth between the main source works by simply copying files back and forth between the main source
directory src and the sub-directories with the package name (e.g. directory src and the subdirectories with the package name (e.g.
src/KSPACE, src/ATC), so that the files are included or excluded src/KSPACE, src/ATC), so that the files are included or excluded
when LAMMPS is built. Only source files in the src folder will be when LAMMPS is built. Only source files in the src folder will be
compiled. compiled.
The following make commands help manage files that exist in both the The following make commands help manage files that exist in both the
src directory and in package sub-directories. You do not normally src directory and in package subdirectories. You do not normally
need to use these commands unless you are editing LAMMPS files or are need to use these commands unless you are editing LAMMPS files or are
updating LAMMPS via git. updating LAMMPS via git.
Type ``make package-status`` or ``make ps`` to show which packages are Type ``make package-status`` or ``make ps`` to show which packages are
currently installed. For those that are installed, it will list any currently installed. For those that are installed, it will list any
files that are different in the src directory and package files that are different in the src directory and package
sub-directory. subdirectory.
Type ``make package-installed`` or ``make pi`` to show which packages are Type ``make package-installed`` or ``make pi`` to show which packages are
currently installed, without listing the status of packages that are currently installed, without listing the status of packages that are
not installed. not installed.
Type ``make package-update`` or ``make pu`` to overwrite src files with Type ``make package-update`` or ``make pu`` to overwrite src files with
files from the package sub-directories if the package is installed. It files from the package subdirectories if the package is installed. It
should be used after the checkout has been :doc:`updated or changed should be used after the checkout has been :doc:`updated or changed
withy git <Install_git>`, this will only update the files in the package with git <Install_git>`, this will only update the files in the package
sub-directories, but not the copies in the src folder. subdirectories, but not the copies in the src folder.
Type ``make package-overwrite`` to overwrite files in the package Type ``make package-overwrite`` to overwrite files in the package
sub-directories with src files. subdirectories with src files.
Type ``make package-diff`` to list all differences between pairs of Type ``make package-diff`` to list all differences between pairs of
files in both the source directory and the package directory. files in both the source directory and the package directory.

View File

@ -1,8 +1,8 @@
Optional build settings Optional build settings
======================= =======================
LAMMPS can be built with several optional settings. Each sub-section LAMMPS can be built with several optional settings. Each subsection
explain how to do this for building both with CMake and make. explains how to do this for building both with CMake and make.
* `C++11 standard compliance`_ when building all of LAMMPS * `C++11 standard compliance`_ when building all of LAMMPS
* `FFT library`_ for use with the :doc:`kspace_style pppm <kspace_style>` command * `FFT library`_ for use with the :doc:`kspace_style pppm <kspace_style>` command
@ -41,7 +41,7 @@ FFT library
When the KSPACE package is included in a LAMMPS build, the When the KSPACE package is included in a LAMMPS build, the
:doc:`kspace_style pppm <kspace_style>` command performs 3d FFTs which :doc:`kspace_style pppm <kspace_style>` command performs 3d FFTs which
require use of an FFT library to compute 1d FFTs. The KISS FFT require use of an FFT library to compute 1d FFTs. The KISS FFT
library is included with LAMMPS but other libraries can be faster. library is included with LAMMPS, but other libraries can be faster.
LAMMPS can use them if they are available on your system. LAMMPS can use them if they are available on your system.
.. tabs:: .. tabs::
@ -63,9 +63,9 @@ LAMMPS can use them if they are available on your system.
Usually these settings are all that is needed. If FFTW3 is Usually these settings are all that is needed. If FFTW3 is
selected, then CMake will try to detect, if threaded FFTW selected, then CMake will try to detect, if threaded FFTW
libraries are available and enable them by default. This setting libraries are available and enable them by default. This setting
is independent of whether OpenMP threads are enabled and a is independent of whether OpenMP threads are enabled and a package
packages like KOKKOS or OPENMP is used. If CMake cannot detect like KOKKOS or OPENMP is used. If CMake cannot detect the FFT
the FFT library, you can set these variables to assist: library, you can set these variables to assist:
.. code-block:: bash .. code-block:: bash
@ -141,18 +141,18 @@ The Intel MKL math library is part of the Intel compiler suite. It
can be used with the Intel or GNU compiler (see the ``FFT_LIB`` setting can be used with the Intel or GNU compiler (see the ``FFT_LIB`` setting
above). above).
Performing 3d FFTs in parallel can be time consuming due to data Performing 3d FFTs in parallel can be time-consuming due to data access
access and required communication. This cost can be reduced by and required communication. This cost can be reduced by performing
performing single-precision FFTs instead of double precision. Single single-precision FFTs instead of double precision. Single precision
precision means the real and imaginary parts of a complex datum are means the real and imaginary parts of a complex datum are 4-byte floats.
4-byte floats. Double precision means they are 8-byte doubles. Note Double precision means they are 8-byte doubles. Note that Fourier
that Fourier transform and related PPPM operations are somewhat less transform and related PPPM operations are somewhat less sensitive to
sensitive to floating point truncation errors and thus the resulting floating point truncation errors, and thus the resulting error is
error is less than the difference in precision. Using the ``-DFFT_SINGLE`` generally less than the difference in precision. Using the
setting trades off a little accuracy for reduced memory use and ``-DFFT_SINGLE`` setting trades off a little accuracy for reduced memory
parallel communication costs for transposing 3d FFT data. use and parallel communication costs for transposing 3d FFT data.
When using ``-DFFT_SINGLE`` with FFTW3 you may need to build the FFTW When using ``-DFFT_SINGLE`` with FFTW3, you may need to build the FFTW
library a second time with support for single-precision. library a second time with support for single-precision.
For FFTW3, do the following, which should produce the additional For FFTW3, do the following, which should produce the additional
@ -177,11 +177,11 @@ ARRAY mode.
Size of LAMMPS integer types and size limits Size of LAMMPS integer types and size limits
-------------------------------------------- --------------------------------------------
LAMMPS has a few integer data types which can be defined as either LAMMPS uses a few custom integer data types, which can be defined as
4-byte (= 32-bit) or 8-byte (= 64-bit) integers at compile time. either 4-byte (= 32-bit) or 8-byte (= 64-bit) integers at compile time.
This has an impact on the size of a system that can be simulated This has an impact on the size of a system that can be simulated, or how
or how large counters can become before "rolling over". large counters can become before "rolling over". The default setting of
The default setting of "smallbig" is almost always adequate. "smallbig" is almost always adequate.
.. tabs:: .. tabs::
@ -254,7 +254,7 @@ topology information, though IDs are enabled by default. The
:doc:`atom_modify id no <atom_modify>` command will turn them off. Atom :doc:`atom_modify id no <atom_modify>` command will turn them off. Atom
IDs are required for molecular systems with bond topology (bonds, IDs are required for molecular systems with bond topology (bonds,
angles, dihedrals, etc). Similarly, some force or compute or fix styles angles, dihedrals, etc). Similarly, some force or compute or fix styles
require atom IDs. Thus if you model a molecular system or use one of require atom IDs. Thus, if you model a molecular system or use one of
those styles with more than 2 billion atoms, you need the "bigbig" those styles with more than 2 billion atoms, you need the "bigbig"
setting. setting.
@ -264,7 +264,7 @@ systems and 500 million for systems with bonds (the additional
restriction is due to using the 2 upper bits of the local atom index restriction is due to using the 2 upper bits of the local atom index
in neighbor lists for storing special bonds info). in neighbor lists for storing special bonds info).
Image flags store 3 values per atom in a single integer which count the Image flags store 3 values per atom in a single integer, which count the
number of times an atom has moved through the periodic box in each number of times an atom has moved through the periodic box in each
dimension. See the :doc:`dump <dump>` manual page for a discussion. If dimension. See the :doc:`dump <dump>` manual page for a discussion. If
an atom moves through the periodic box more than this limit, the value an atom moves through the periodic box more than this limit, the value
@ -285,7 +285,7 @@ Output of JPG, PNG, and movie files
-------------------------------------------------- --------------------------------------------------
The :doc:`dump image <dump_image>` command has options to output JPEG or The :doc:`dump image <dump_image>` command has options to output JPEG or
PNG image files. Likewise the :doc:`dump movie <dump_image>` command PNG image files. Likewise, the :doc:`dump movie <dump_image>` command
outputs movie files in a variety of movie formats. Using these options outputs movie files in a variety of movie formats. Using these options
requires the following settings: requires the following settings:
@ -354,7 +354,7 @@ Read or write compressed files
If this option is enabled, large files can be read or written with If this option is enabled, large files can be read or written with
compression by ``gzip`` or similar tools by several LAMMPS commands, compression by ``gzip`` or similar tools by several LAMMPS commands,
including :doc:`read_data <read_data>`, :doc:`rerun <rerun>`, and including :doc:`read_data <read_data>`, :doc:`rerun <rerun>`, and
:doc:`dump <dump>`. Currently supported compression tools are: :doc:`dump <dump>`. Supported compression tools are currently
``gzip``, ``bzip2``, ``zstd``, and ``lzma``. ``gzip``, ``bzip2``, ``zstd``, and ``lzma``.
.. tabs:: .. tabs::
@ -394,7 +394,7 @@ Memory allocation alignment
--------------------------------------- ---------------------------------------
This setting enables the use of the "posix_memalign()" call instead of This setting enables the use of the "posix_memalign()" call instead of
"malloc()" when LAMMPS allocates large chunks or memory. Vector "malloc()" when LAMMPS allocates large chunks of memory. Vector
instructions on CPUs may become more efficient, if dynamically allocated instructions on CPUs may become more efficient, if dynamically allocated
memory is aligned on larger-than-default byte boundaries. On most memory is aligned on larger-than-default byte boundaries. On most
current operating systems, the "malloc()" implementation returns current operating systems, the "malloc()" implementation returns
@ -496,7 +496,7 @@ Trigger selected floating-point exceptions
------------------------------------------ ------------------------------------------
Many kinds of CPUs have the capability to detect when a calculation Many kinds of CPUs have the capability to detect when a calculation
results in an invalid math operation like a division by zero or calling results in an invalid math operation, like a division by zero or calling
the square root with a negative argument. The default behavior on the square root with a negative argument. The default behavior on
most operating systems is to continue and have values for ``NaN`` (= not most operating systems is to continue and have values for ``NaN`` (= not
a number) or ``Inf`` (= infinity). This allows software to detect and a number) or ``Inf`` (= infinity). This allows software to detect and

View File

@ -42,6 +42,7 @@ OPT.
* :doc:`gaussian <bond_gaussian>` * :doc:`gaussian <bond_gaussian>`
* :doc:`gromos (o) <bond_gromos>` * :doc:`gromos (o) <bond_gromos>`
* :doc:`harmonic (iko) <bond_harmonic>` * :doc:`harmonic (iko) <bond_harmonic>`
* :doc:`harmonic/restrain <bond_harmonic_restrain>`
* :doc:`harmonic/shift (o) <bond_harmonic_shift>` * :doc:`harmonic/shift (o) <bond_harmonic_shift>`
* :doc:`harmonic/shift/cut (o) <bond_harmonic_shift_cut>` * :doc:`harmonic/shift/cut (o) <bond_harmonic_shift_cut>`
* :doc:`lepton (o) <bond_lepton>` * :doc:`lepton (o) <bond_lepton>`

View File

@ -88,7 +88,6 @@ KOKKOS, o = OPENMP, t = OPT.
* :doc:`ke/atom/eff <compute_ke_atom_eff>` * :doc:`ke/atom/eff <compute_ke_atom_eff>`
* :doc:`ke/eff <compute_ke_eff>` * :doc:`ke/eff <compute_ke_eff>`
* :doc:`ke/rigid <compute_ke_rigid>` * :doc:`ke/rigid <compute_ke_rigid>`
* :doc:`mesont <compute_mesont>`
* :doc:`mliap <compute_mliap>` * :doc:`mliap <compute_mliap>`
* :doc:`momentum <compute_momentum>` * :doc:`momentum <compute_momentum>`
* :doc:`msd <compute_msd>` * :doc:`msd <compute_msd>`
@ -105,6 +104,7 @@ KOKKOS, o = OPENMP, t = OPT.
* :doc:`pe/tally <compute_tally>` * :doc:`pe/tally <compute_tally>`
* :doc:`plasticity/atom <compute_plasticity_atom>` * :doc:`plasticity/atom <compute_plasticity_atom>`
* :doc:`pressure <compute_pressure>` * :doc:`pressure <compute_pressure>`
* :doc:`pressure/alchemy <compute_pressure_alchemy>`
* :doc:`pressure/uef <compute_pressure_uef>` * :doc:`pressure/uef <compute_pressure_uef>`
* :doc:`property/atom <compute_property_atom>` * :doc:`property/atom <compute_property_atom>`
* :doc:`property/chunk <compute_property_chunk>` * :doc:`property/chunk <compute_property_chunk>`

View File

@ -29,6 +29,7 @@ OPT.
* :doc:`adapt/fep <fix_adapt_fep>` * :doc:`adapt/fep <fix_adapt_fep>`
* :doc:`addforce <fix_addforce>` * :doc:`addforce <fix_addforce>`
* :doc:`addtorque <fix_addtorque>` * :doc:`addtorque <fix_addtorque>`
* :doc:`alchemy <fix_alchemy>`
* :doc:`amoeba/bitorsion <fix_amoeba_bitorsion>` * :doc:`amoeba/bitorsion <fix_amoeba_bitorsion>`
* :doc:`amoeba/pitorsion <fix_amoeba_pitorsion>` * :doc:`amoeba/pitorsion <fix_amoeba_pitorsion>`
* :doc:`append/atoms <fix_append_atoms>` * :doc:`append/atoms <fix_append_atoms>`
@ -44,9 +45,6 @@ OPT.
* :doc:`ave/time <fix_ave_time>` * :doc:`ave/time <fix_ave_time>`
* :doc:`aveforce <fix_aveforce>` * :doc:`aveforce <fix_aveforce>`
* :doc:`balance <fix_balance>` * :doc:`balance <fix_balance>`
* :doc:`brownian <fix_brownian>`
* :doc:`brownian/asphere <fix_brownian>`
* :doc:`brownian/sphere <fix_brownian>`
* :doc:`bocs <fix_bocs>` * :doc:`bocs <fix_bocs>`
* :doc:`bond/break <fix_bond_break>` * :doc:`bond/break <fix_bond_break>`
* :doc:`bond/create <fix_bond_create>` * :doc:`bond/create <fix_bond_create>`
@ -54,6 +52,9 @@ OPT.
* :doc:`bond/react <fix_bond_react>` * :doc:`bond/react <fix_bond_react>`
* :doc:`bond/swap <fix_bond_swap>` * :doc:`bond/swap <fix_bond_swap>`
* :doc:`box/relax <fix_box_relax>` * :doc:`box/relax <fix_box_relax>`
* :doc:`brownian <fix_brownian>`
* :doc:`brownian/asphere <fix_brownian>`
* :doc:`brownian/sphere <fix_brownian>`
* :doc:`charge/regulation <fix_charge_regulation>` * :doc:`charge/regulation <fix_charge_regulation>`
* :doc:`cmap <fix_cmap>` * :doc:`cmap <fix_cmap>`
* :doc:`colvars <fix_colvars>` * :doc:`colvars <fix_colvars>`
@ -169,7 +170,7 @@ OPT.
* :doc:`pafi <fix_pafi>` * :doc:`pafi <fix_pafi>`
* :doc:`pair <fix_pair>` * :doc:`pair <fix_pair>`
* :doc:`phonon <fix_phonon>` * :doc:`phonon <fix_phonon>`
* :doc:`pimd <fix_pimd>` * :doc:`pimd/nvt <fix_pimd>`
* :doc:`planeforce <fix_planeforce>` * :doc:`planeforce <fix_planeforce>`
* :doc:`plumed <fix_plumed>` * :doc:`plumed <fix_plumed>`
* :doc:`poems <fix_poems>` * :doc:`poems <fix_poems>`
@ -264,6 +265,7 @@ OPT.
* :doc:`wall/lj1043 <fix_wall>` * :doc:`wall/lj1043 <fix_wall>`
* :doc:`wall/lj126 <fix_wall>` * :doc:`wall/lj126 <fix_wall>`
* :doc:`wall/lj93 (k) <fix_wall>` * :doc:`wall/lj93 (k) <fix_wall>`
* :doc:`wall/lepton <fix_wall>`
* :doc:`wall/morse <fix_wall>` * :doc:`wall/morse <fix_wall>`
* :doc:`wall/piston <fix_wall_piston>` * :doc:`wall/piston <fix_wall_piston>`
* :doc:`wall/reflect (k) <fix_wall_reflect>` * :doc:`wall/reflect (k) <fix_wall_reflect>`
@ -271,4 +273,5 @@ OPT.
* :doc:`wall/region <fix_wall_region>` * :doc:`wall/region <fix_wall_region>`
* :doc:`wall/region/ees <fix_wall_ees>` * :doc:`wall/region/ees <fix_wall_ees>`
* :doc:`wall/srd <fix_wall_srd>` * :doc:`wall/srd <fix_wall_srd>`
* :doc:`wall/table <fix_wall>`
* :doc:`widom <fix_widom>` * :doc:`widom <fix_widom>`

View File

@ -39,7 +39,7 @@ OPT.
* :doc:`agni (o) <pair_agni>` * :doc:`agni (o) <pair_agni>`
* :doc:`airebo (io) <pair_airebo>` * :doc:`airebo (io) <pair_airebo>`
* :doc:`airebo/morse (io) <pair_airebo>` * :doc:`airebo/morse (io) <pair_airebo>`
* :doc:`amoeba <pair_amoeba>` * :doc:`amoeba (g) <pair_amoeba>`
* :doc:`atm <pair_atm>` * :doc:`atm <pair_atm>`
* :doc:`awpmd/cut <pair_awpmd>` * :doc:`awpmd/cut <pair_awpmd>`
* :doc:`beck (go) <pair_beck>` * :doc:`beck (go) <pair_beck>`
@ -126,7 +126,7 @@ OPT.
* :doc:`hbond/dreiding/lj (o) <pair_hbond_dreiding>` * :doc:`hbond/dreiding/lj (o) <pair_hbond_dreiding>`
* :doc:`hbond/dreiding/morse (o) <pair_hbond_dreiding>` * :doc:`hbond/dreiding/morse (o) <pair_hbond_dreiding>`
* :doc:`hdnnp <pair_hdnnp>` * :doc:`hdnnp <pair_hdnnp>`
* :doc:`hippo <pair_amoeba>` * :doc:`hippo (g) <pair_amoeba>`
* :doc:`ilp/graphene/hbn (t) <pair_ilp_graphene_hbn>` * :doc:`ilp/graphene/hbn (t) <pair_ilp_graphene_hbn>`
* :doc:`ilp/tmd (t) <pair_ilp_tmd>` * :doc:`ilp/tmd (t) <pair_ilp_tmd>`
* :doc:`kolmogorov/crespi/full <pair_kolmogorov_crespi_full>` * :doc:`kolmogorov/crespi/full <pair_kolmogorov_crespi_full>`
@ -166,7 +166,7 @@ OPT.
* :doc:`lj/cut/coul/msm (go) <pair_lj_cut_coul>` * :doc:`lj/cut/coul/msm (go) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/msm/dielectric <pair_dielectric>` * :doc:`lj/cut/coul/msm/dielectric <pair_dielectric>`
* :doc:`lj/cut/coul/wolf (o) <pair_lj_cut_coul>` * :doc:`lj/cut/coul/wolf (o) <pair_lj_cut_coul>`
* :doc:`lj/cut/dipole/cut (go) <pair_dipole>` * :doc:`lj/cut/dipole/cut (gko) <pair_dipole>`
* :doc:`lj/cut/dipole/long (g) <pair_dipole>` * :doc:`lj/cut/dipole/long (g) <pair_dipole>`
* :doc:`lj/cut/dipole/sf (go) <pair_dipole>` * :doc:`lj/cut/dipole/sf (go) <pair_dipole>`
* :doc:`lj/cut/soft (o) <pair_fep_soft>` * :doc:`lj/cut/soft (o) <pair_fep_soft>`
@ -175,7 +175,7 @@ OPT.
* :doc:`lj/cut/tip4p/long (got) <pair_lj_cut_tip4p>` * :doc:`lj/cut/tip4p/long (got) <pair_lj_cut_tip4p>`
* :doc:`lj/cut/tip4p/long/soft (o) <pair_fep_soft>` * :doc:`lj/cut/tip4p/long/soft (o) <pair_fep_soft>`
* :doc:`lj/expand (gko) <pair_lj_expand>` * :doc:`lj/expand (gko) <pair_lj_expand>`
* :doc:`lj/expand/coul/long (g) <pair_lj_expand>` * :doc:`lj/expand/coul/long (gk) <pair_lj_expand>`
* :doc:`lj/gromacs (gko) <pair_gromacs>` * :doc:`lj/gromacs (gko) <pair_gromacs>`
* :doc:`lj/gromacs/coul/gromacs (ko) <pair_gromacs>` * :doc:`lj/gromacs/coul/gromacs (ko) <pair_gromacs>`
* :doc:`lj/long/coul/long (iot) <pair_lj_long>` * :doc:`lj/long/coul/long (iot) <pair_lj_long>`
@ -200,11 +200,11 @@ OPT.
* :doc:`mdpd <pair_mesodpd>` * :doc:`mdpd <pair_mesodpd>`
* :doc:`mdpd/rhosum <pair_mesodpd>` * :doc:`mdpd/rhosum <pair_mesodpd>`
* :doc:`meam (k) <pair_meam>` * :doc:`meam (k) <pair_meam>`
* :doc:`meam/ms (k) <pair_meam>`
* :doc:`meam/spline (o) <pair_meam_spline>` * :doc:`meam/spline (o) <pair_meam_spline>`
* :doc:`meam/sw/spline <pair_meam_sw_spline>` * :doc:`meam/sw/spline <pair_meam_sw_spline>`
* :doc:`mesocnt <pair_mesocnt>` * :doc:`mesocnt <pair_mesocnt>`
* :doc:`mesocnt/viscous <pair_mesocnt>` * :doc:`mesocnt/viscous <pair_mesocnt>`
* :doc:`mesont/tpm <pair_mesont_tpm>`
* :doc:`mgpt <pair_mgpt>` * :doc:`mgpt <pair_mgpt>`
* :doc:`mie/cut (g) <pair_mie>` * :doc:`mie/cut (g) <pair_mie>`
* :doc:`mliap (k) <pair_mliap>` * :doc:`mliap (k) <pair_mliap>`

View File

@ -50,6 +50,27 @@ for some optimizations leading to better performance. The pair style
period the C++ version of MEAM was called USER-MEAMC so it could period the C++ version of MEAM was called USER-MEAMC so it could
coexist with the Fortran version. coexist with the Fortran version.
Minimize style fire/old
-----------------------
.. deprecated:: 8Feb2023
Minimize style *fire/old* has been removed. Its functionality can be
reproduced with *fire* with specific options. Please see the
:doc:`min_modify command <min_modify>` documentation for details.
Pair style mesont/tpm, compute style mesont, atom style mesont
--------------------------------------------------------------
.. deprecated:: 8Feb2023
Pair style *mesont/tpm*, compute style *mesont*, and atom style
*mesont* have been removed from the :ref:`MESONT package <PKG-MESONT>`.
The same functionality is available through
:doc:`pair style mesocnt <pair_mesocnt>`,
:doc:`bond style mesocnt <bond_mesocnt>` and
:doc:`angle style mesocnt <angle_mesocnt>`.
REAX package REAX package
------------ ------------

View File

@ -1,52 +1,53 @@
Code design Code design
----------- -----------
This section explains some of the code design choices in LAMMPS with This section explains some code design choices in LAMMPS with the goal
the goal of helping developers write new code similar to the existing of helping developers write new code similar to the existing code.
code. Please see the section on :doc:`Requirements for contributed Please see the section on :doc:`Requirements for contributed code
code <Modify_style>` for more specific recommendations and guidelines. <Modify_style>` for more specific recommendations and guidelines. While
While that section is organized more in the form of a checklist for that section is organized more in the form of a checklist for code
code contributors, the focus here is on overall code design strategy, contributors, the focus here is on overall code design strategy, choices
choices made between possible alternatives, and discussing some made between possible alternatives, and discussing some relevant C++
relevant C++ programming language constructs. programming language constructs.
Historically, the basic design philosophy of the LAMMPS C++ code was a Historically, the basic design philosophy of the LAMMPS C++ code was a
"C with classes" style. The motivation was to make it easy to modify "C with classes" style. The motivation was to make it easy to modify
LAMMPS for people without significant training in C++ programming. LAMMPS for people without significant training in C++ programming. Data
Data structures and code constructs were used that resemble the structures and code constructs were used that resemble the previous
previous implementation(s) in Fortran. A contributing factor to this implementation(s) in Fortran. A contributing factor to this choice was
choice also was that at the time, C++ compilers were often not mature that at the time, C++ compilers were often not mature and some advanced
and some of the advanced features contained bugs or did not function features contained bugs or did not function as the standard required.
as the standard required. There were also disagreements between There were also disagreements between compiler vendors as to how to
compiler vendors as to how to interpret the C++ standard documents. interpret the C++ standard documents.
However, C++ compilers have now advanced significantly. In 2020 we However, C++ compilers and the C++ programming language have advanced
decided to to require the C++11 standard as the minimum C++ language significantly. In 2020, the LAMMPS developers decided to require the
standard for LAMMPS. Since then we have begun to also replace some of C++11 standard as the minimum C++ language standard for LAMMPS. Since
the C-style constructs with equivalent C++ functionality, either from then, we have begun to replace C-style constructs with equivalent C++
the C++ standard library or as custom classes or functions, in order functionality. This was taken either from the C++ standard library or
to improve readability of the code and to increase code reuse through implemented as custom classes or functions. The goal is to improve
abstraction of commonly used functionality. readability of the code and to increase code reuse through abstraction
of commonly used functionality.
.. note:: .. note::
Please note that as of spring 2022 there is still a sizable chunk Please note that as of spring 2023 there is still a sizable chunk of
of legacy code in LAMMPS that has not yet been refactored to legacy code in LAMMPS that has not yet been refactored to reflect
reflect these style conventions in full. LAMMPS has a large code these style conventions in full. LAMMPS has a large code base and
base and many different contributors and there also is a hierarchy many contributors. There is also a hierarchy of precedence in which
of precedence in which the code is adapted. Highest priority has the code is adapted. Highest priority has been the code in the
been the code in the ``src`` folder, followed by code in packages ``src`` folder, followed by code in packages in order of their
in order of their popularity and complexity (simpler code is popularity and complexity (simpler code gets adapted sooner), followed
adapted sooner), followed by code in the ``lib`` folder. Source by code in the ``lib`` folder. Source code that is downloaded from
code that is downloaded from external packages or libraries during external packages or libraries during compilation is not subject to
compilation is not subject to the conventions discussed here. the conventions discussed here.
Object oriented code Object-oriented code
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
LAMMPS is designed to be an object oriented code. Each simulation is LAMMPS is designed to be an object-oriented code. Each simulation is
represented by an instance of the LAMMPS class. When running in represented by an instance of the LAMMPS class. When running in
parallel each MPI process creates such an instance. This can be seen parallel, each MPI process creates such an instance. This can be seen
in the ``main.cpp`` file where the core steps of running a LAMMPS in the ``main.cpp`` file where the core steps of running a LAMMPS
simulation are the following 3 lines of code: simulation are the following 3 lines of code:
@ -67,14 +68,14 @@ other special features.
The basic LAMMPS class hierarchy which is created by the LAMMPS class The basic LAMMPS class hierarchy which is created by the LAMMPS class
constructor is shown in :ref:`class-topology`. When input commands constructor is shown in :ref:`class-topology`. When input commands
are processed, additional class instances are created, or deleted, or are processed, additional class instances are created, or deleted, or
replaced. Likewise specific member functions of specific classes are replaced. Likewise, specific member functions of specific classes are
called to trigger actions such creating atoms, computing forces, called to trigger actions such creating atoms, computing forces,
computing properties, time-propagating the system, or writing output. computing properties, time-propagating the system, or writing output.
Compositing and Inheritance Compositing and Inheritance
=========================== ===========================
LAMMPS makes extensive use of the object oriented programming (OOP) LAMMPS makes extensive use of the object-oriented programming (OOP)
principles of *compositing* and *inheritance*. Classes like the principles of *compositing* and *inheritance*. Classes like the
``LAMMPS`` class are a **composite** containing pointers to instances ``LAMMPS`` class are a **composite** containing pointers to instances
of other classes like ``Atom``, ``Comm``, ``Force``, ``Neighbor``, of other classes like ``Atom``, ``Comm``, ``Force``, ``Neighbor``,
@ -83,7 +84,7 @@ functionality by storing and manipulating data related to the
simulation and providing member functions that trigger certain simulation and providing member functions that trigger certain
actions. Some of those classes like ``Force`` are themselves actions. Some of those classes like ``Force`` are themselves
composites, containing instances of classes describing different force composites, containing instances of classes describing different force
interactions. Similarly the ``Modify`` class contains a list of interactions. Similarly, the ``Modify`` class contains a list of
``Fix`` and ``Compute`` classes. If the input commands that ``Fix`` and ``Compute`` classes. If the input commands that
correspond to these classes include the word *style*, then LAMMPS correspond to these classes include the word *style*, then LAMMPS
stores only a single instance of that class. E.g. *atom_style*, stores only a single instance of that class. E.g. *atom_style*,
@ -100,19 +101,18 @@ derived class variant was instantiated. In LAMMPS these derived
classes are often referred to as "styles", e.g. pair styles, fix classes are often referred to as "styles", e.g. pair styles, fix
styles, atom styles and so on. styles, atom styles and so on.
This is the origin of the flexibility of LAMMPS. For example pair This is the origin of the flexibility of LAMMPS. For example, pair
styles implement a variety of different non-bonded interatomic styles implement a variety of different non-bonded interatomic
potentials functions. All details for the implementation of a potentials functions. All details for the implementation of a
potential are stored and executed in a single class. potential are stored and executed in a single class.
As mentioned above, there can be multiple instances of classes derived As mentioned above, there can be multiple instances of classes derived
from the ``Fix`` or ``Compute`` base classes. They represent a from the ``Fix`` or ``Compute`` base classes. They represent a
different facet of LAMMPS flexibility as they provide methods which different facet of LAMMPS' flexibility, as they provide methods which
can be called at different points in time within a timestep, as can be called at different points within a timestep, as explained in
explained in `Developer_flow`. This allows the input script to tailor `Developer_flow`. This allows the input script to tailor how a specific
how a specific simulation is run, what diagnostic computations are simulation is run, what diagnostic computations are performed, and how
performed, and how the output of those computations is further the output of those computations is further processed or output.
processed or output.
Additional code sharing is possible by creating derived classes from the Additional code sharing is possible by creating derived classes from the
derived classes (e.g., to implement an accelerated version of a pair derived classes (e.g., to implement an accelerated version of a pair
@ -164,15 +164,15 @@ The difference in behavior of the ``normal()`` and the ``poly()`` member
functions is which of the two member functions is called when executing functions is which of the two member functions is called when executing
`base1->call()` versus `base2->call()`. Without polymorphism, a `base1->call()` versus `base2->call()`. Without polymorphism, a
function within the base class can only call member functions within the function within the base class can only call member functions within the
same scope, that is ``Base::call()`` will always call same scope: that is, ``Base::call()`` will always call
``Base::normal()``. But for the `base2->call()` case the call of the ``Base::normal()``. But for the `base2->call()` case, the call of the
virtual member function will be dispatched to ``Derived::poly()`` virtual member function will be dispatched to ``Derived::poly()``
instead. This mechanism means that functions are called within the instead. This mechanism results in calling functions that are within
scope of the class type that was used to *create* the class instance are the scope of the class that was used to *create* the instance, even if
invoked; even if they are assigned to a pointer using the type of a base they are assigned to a pointer for their base class. This is the
class. This is the desired behavior and this way LAMMPS can even use desired behavior, and this way LAMMPS can even use styles that are loaded
styles that are loaded at runtime from a shared object file with the at runtime from a shared object file with the :doc:`plugin command
:doc:`plugin command <plugin>`. <plugin>`.
A special case of virtual functions are so-called pure functions. These A special case of virtual functions are so-called pure functions. These
are virtual functions that are initialized to 0 in the class declaration are virtual functions that are initialized to 0 in the class declaration
@ -189,12 +189,12 @@ This has the effect that an instance of the base class cannot be
created and that derived classes **must** implement these functions. created and that derived classes **must** implement these functions.
Many of the functions listed with the various class styles in the Many of the functions listed with the various class styles in the
section :doc:`Modify` are pure functions. The motivation for this is section :doc:`Modify` are pure functions. The motivation for this is
to define the interface or API of the functions but defer their to define the interface or API of the functions, but defer their
implementation to the derived classes. implementation to the derived classes.
However, there are downsides to this. For example, calls to virtual However, there are downsides to this. For example, calls to virtual
functions from within a constructor, will not be in the scope of the functions from within a constructor, will *not* be in the scope of the
derived class and thus it is good practice to either avoid calling them derived class, and thus it is good practice to either avoid calling them
or to provide an explicit scope such as ``Base::poly()`` or or to provide an explicit scope such as ``Base::poly()`` or
``Derived::poly()``. Furthermore, any destructors in classes containing ``Derived::poly()``. Furthermore, any destructors in classes containing
virtual functions should be declared virtual too, so they will be virtual functions should be declared virtual too, so they will be
@ -208,8 +208,8 @@ dispatch.
that are intended to replace a virtual or pure function use the that are intended to replace a virtual or pure function use the
``override`` property keyword. For the same reason, the use of ``override`` property keyword. For the same reason, the use of
overloads or default arguments for virtual functions should be overloads or default arguments for virtual functions should be
avoided as they lead to confusion over which function is supposed to avoided, as they lead to confusion over which function is supposed to
override which and which arguments need to be declared. override which, and which arguments need to be declared.
Style Factories Style Factories
=============== ===============
@ -219,10 +219,10 @@ uses a programming pattern called `Factory`. Those are functions that
create an instance of a specific derived class, say ``PairLJCut`` and create an instance of a specific derived class, say ``PairLJCut`` and
return a pointer to the type of the common base class of that style, return a pointer to the type of the common base class of that style,
``Pair`` in this case. To associate the factory function with the ``Pair`` in this case. To associate the factory function with the
style keyword, an ``std::map`` class is used with function pointers style keyword, a ``std::map`` class is used with function pointers
indexed by their keyword (for example "lj/cut" for ``PairLJCut`` and indexed by their keyword (for example "lj/cut" for ``PairLJCut`` and
"morse" for ``PairMorse``). A couple of typedefs help keep the code "morse" for ``PairMorse``). A couple of typedefs help keep the code
readable and a template function is used to implement the actual readable, and a template function is used to implement the actual
factory functions for the individual classes. Below is an example factory functions for the individual classes. Below is an example
of such a factory function from the ``Force`` class as declared in of such a factory function from the ``Force`` class as declared in
``force.h`` and implemented in ``force.cpp``. The file ``style_pair.h`` ``force.h`` and implemented in ``force.cpp``. The file ``style_pair.h``
@ -279,26 +279,26 @@ from and writing to files and console instead of C++ "iostreams".
This is mainly motivated by better performance, better control over This is mainly motivated by better performance, better control over
formatting, and less effort to achieve specific formatting. formatting, and less effort to achieve specific formatting.
Since mixing "stdio" and "iostreams" can lead to unexpected Since mixing "stdio" and "iostreams" can lead to unexpected behavior,
behavior. use of the latter is strongly discouraged. Also output to use of the latter is strongly discouraged. Output to the screen should
the screen should not use the predefined ``stdout`` FILE pointer, but *not* use the predefined ``stdout`` FILE pointer, but rather the
rather the ``screen`` and ``logfile`` FILE pointers managed by the ``screen`` and ``logfile`` FILE pointers managed by the LAMMPS class.
LAMMPS class. Furthermore, output should generally only be done by Furthermore, output should generally only be done by MPI rank 0
MPI rank 0 (``comm->me == 0``). Output that is sent to both (``comm->me == 0``). Output that is sent to both ``screen`` and
``screen`` and ``logfile`` should use the :cpp:func:`utils::logmesg() ``logfile`` should use the :cpp:func:`utils::logmesg() convenience
convenience function <LAMMPS_NS::utils::logmesg>`. function <LAMMPS_NS::utils::logmesg>`.
We also discourage the use of stringstreams because the bundled {fmt} We discourage the use of stringstreams because the bundled {fmt} library
library and the customized tokenizer classes can provide the same and the customized tokenizer classes provide the same functionality in a
functionality in a cleaner way with better performance. This also cleaner way with better performance. This also helps maintain a
helps maintain a consistent programming syntax with code from many consistent programming syntax with code from many different
different contributors. contributors.
Formatting with the {fmt} library Formatting with the {fmt} library
=================================== ===================================
The LAMMPS source code includes a copy of the `{fmt} library The LAMMPS source code includes a copy of the `{fmt} library
<https://fmt.dev>`_ which is preferred over formatting with the <https://fmt.dev>`_, which is preferred over formatting with the
"printf()" family of functions. The primary reason is that it allows "printf()" family of functions. The primary reason is that it allows
a typesafe default format for any type of supported data. This is a typesafe default format for any type of supported data. This is
particularly useful for formatting integers of a given size (32-bit or particularly useful for formatting integers of a given size (32-bit or
@ -313,17 +313,16 @@ been included into the C++20 language standard, so changes to adopt it
are future-proof. are future-proof.
Formatted strings are frequently created by calling the Formatted strings are frequently created by calling the
``fmt::format()`` function which will return a string as a ``fmt::format()`` function, which will return a string as a
``std::string`` class instance. In contrast to the ``%`` placeholder ``std::string`` class instance. In contrast to the ``%`` placeholder in
in ``printf()``, the {fmt} library uses ``{}`` to embed format ``printf()``, the {fmt} library uses ``{}`` to embed format descriptors.
descriptors. In the simplest case, no additional characters are In the simplest case, no additional characters are needed, as {fmt} will
needed as {fmt} will choose the default format based on the data type choose the default format based on the data type of the argument.
of the argument. Otherwise the ``fmt::print()`` function may be Otherwise, the ``fmt::print()`` function may be used instead of
used instead of ``printf()`` or ``fprintf()``. In addition, several ``printf()`` or ``fprintf()``. In addition, several LAMMPS output
LAMMPS output functions, that originally accepted a single string as functions, that originally accepted a single string as argument have
argument have been overloaded to accept a format string with optional been overloaded to accept a format string with optional arguments as
arguments as well (e.g., ``Error::all()``, ``Error::one()``, well (e.g., ``Error::all()``, ``Error::one()``, ``utils::logmesg()``).
``utils::logmesg()``).
Summary of the {fmt} format syntax Summary of the {fmt} format syntax
================================== ==================================
@ -332,10 +331,11 @@ The syntax of the format string is "{[<argument id>][:<format spec>]}",
where either the argument id or the format spec (separated by a colon where either the argument id or the format spec (separated by a colon
':') is optional. The argument id is usually a number starting from 0 ':') is optional. The argument id is usually a number starting from 0
that is the index to the arguments following the format string. By that is the index to the arguments following the format string. By
default these are assigned in order (i.e. 0, 1, 2, 3, 4 etc.). The most default, these are assigned in order (i.e. 0, 1, 2, 3, 4 etc.). The
common case for using argument id would be to use the same argument in most common case for using argument id would be to use the same argument
multiple places in the format string without having to provide it as an in multiple places in the format string without having to provide it as
argument multiple times. In LAMMPS the argument id is rarely used. an argument multiple times. The argument id is rarely used in the LAMMPS
source code.
More common is the use of a format specifier, which starts with a colon. More common is the use of a format specifier, which starts with a colon.
This may optionally be followed by a fill character (default is ' '). If This may optionally be followed by a fill character (default is ' '). If
@ -347,18 +347,19 @@ width, which may be followed by a dot '.' and a precision for floating
point numbers. The final character in the format string would be an point numbers. The final character in the format string would be an
indicator for the "presentation", i.e. 'd' for decimal presentation of indicator for the "presentation", i.e. 'd' for decimal presentation of
integers, 'x' for hexadecimal, 'o' for octal, 'c' for character etc. integers, 'x' for hexadecimal, 'o' for octal, 'c' for character etc.
This mostly follows the "printf()" scheme but without requiring an This mostly follows the "printf()" scheme, but without requiring an
additional length parameter to distinguish between different integer additional length parameter to distinguish between different integer
widths. The {fmt} library will detect those and adapt the formatting widths. The {fmt} library will detect those and adapt the formatting
accordingly. For floating point numbers there are correspondingly, 'g' accordingly. For floating point numbers there are correspondingly, 'g'
for generic presentation, 'e' for exponential presentation, and 'f' for for generic presentation, 'e' for exponential presentation, and 'f' for
fixed point presentation. fixed point presentation.
Thus "{:8}" would represent *any* type argument using at least 8 The format string "{:8}" would thus represent *any* type argument and be
characters; "{:<8}" would do this as left aligned, "{:^8}" as centered, replaced by at least 8 characters; "{:<8}" would do this as left
"{:>8}" as right aligned. If a specific presentation is selected, the aligned, "{:^8}" as centered, "{:>8}" as right aligned. If a specific
argument type must be compatible or else the {fmt} formatting code will presentation is selected, the argument type must be compatible or else
throw an exception. Some format string examples are given below: the {fmt} formatting code will throw an exception. Some format string
examples are given below:
.. code-block:: c++ .. code-block:: c++
@ -392,12 +393,12 @@ documentation <https://fmt.dev/latest/syntax.html>`_ website.
Memory management Memory management
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
Dynamical allocation of small data and objects can be done with the Dynamical allocation of small data and objects can be done with the C++
the C++ commands "new" and "delete/delete[]. Large data should use commands "new" and "delete/delete[]". Large data should use the member
the member functions of the ``Memory`` class, most commonly, functions of the ``Memory`` class, most commonly, ``Memory::create()``,
``Memory::create()``, ``Memory::grow()``, and ``Memory::destroy()``, ``Memory::grow()``, and ``Memory::destroy()``, which provide variants
which provide variants for vectors, 2d arrays, 3d arrays, etc. for vectors, 2d arrays, 3d arrays, etc. These can also be used for
These can also be used for small data. small data.
The use of ``malloc()``, ``calloc()``, ``realloc()`` and ``free()`` The use of ``malloc()``, ``calloc()``, ``realloc()`` and ``free()``
directly is strongly discouraged. To simplify adapting legacy code directly is strongly discouraged. To simplify adapting legacy code
@ -408,26 +409,24 @@ perform additional error checks for safety.
Use of these custom memory allocation functions is motivated by the Use of these custom memory allocation functions is motivated by the
following considerations: following considerations:
- memory allocation failures on *any* MPI rank during a parallel run - Memory allocation failures on *any* MPI rank during a parallel run
will trigger an immediate abort of the entire parallel calculation will trigger an immediate abort of the entire parallel calculation.
instead of stalling it - A failing "new" will trigger an exception, which is also captured by
- a failing "new" will trigger an exception which is also captured by LAMMPS and triggers a global abort.
LAMMPS and triggers a global abort - Allocation of multidimensional arrays will be done in a C compatible
- allocation of multi-dimensional arrays will be done in a C compatible fashion, but such that the storage of the actual data is stored in one
fashion but so that the storage of the actual data is stored in one large contiguous block. Thus, when MPI communication is needed,
large contiguous block. Thus when MPI communication is needed,
the data can be communicated directly (similar to Fortran arrays). the data can be communicated directly (similar to Fortran arrays).
- the "destroy()" and "sfree()" functions may safely be called on NULL - The "destroy()" and "sfree()" functions may safely be called on NULL
pointers pointers.
- the "destroy()" functions will nullify the pointer variables making - The "destroy()" functions will nullify the pointer variables, thus
"use after free" errors easy to detect making "use after free" errors easy to detect.
- it is possible to use a larger than default memory alignment (not on - It is possible to use a larger than default memory alignment (not on
all operating systems, since the allocated storage pointers must be all operating systems, since the allocated storage pointers must be
compatible with ``free()`` for technical reasons) compatible with ``free()`` for technical reasons).
In the practical implementation of code this means that any pointer In the practical implementation of code this means, that any pointer
variables that are class members should be initialized to a variables, that are class members should be initialized to a ``nullptr``
``nullptr`` value in their respective constructors. That way it is value in their respective constructors. That way, it is safe to call
safe to call ``Memory::destroy()`` or ``delete[]`` on them before ``Memory::destroy()`` or ``delete[]`` on them before *any* allocation
*any* allocation outside the constructor. This helps prevent memory outside the constructor. This helps prevent memory leaks.
leaks.

View File

@ -14,8 +14,8 @@ Owned and ghost atoms
As described on the :doc:`parallel partitioning algorithms As described on the :doc:`parallel partitioning algorithms
<Developer_par_part>` page, LAMMPS spatially decomposes the simulation <Developer_par_part>` page, LAMMPS spatially decomposes the simulation
domain, either in a *brick* or *tiled* manner. Each processor (MPI domain, either in a *brick* or *tiled* manner. Each processor (MPI
task) owns atoms within its sub-domain and additionally stores ghost task) owns atoms within its subdomain and additionally stores ghost
atoms within a cutoff distance of its sub-domain. atoms within a cutoff distance of its subdomain.
Forward and reverse communication Forward and reverse communication
================================= =================================
@ -28,7 +28,7 @@ The need to do this communication arises when data from the owned atoms
is updated (e.g. their positions) and this updated information needs to is updated (e.g. their positions) and this updated information needs to
be **copied** to the corresponding ghost atoms. be **copied** to the corresponding ghost atoms.
And second, *reverse communication* which sends ghost atom information And second, *reverse communication*, which sends ghost atom information
from each processor to the owning processor to **accumulate** (sum) from each processor to the owning processor to **accumulate** (sum)
the values with the corresponding owned atoms. The need for this the values with the corresponding owned atoms. The need for this
arises when data is computed and also stored with ghost atoms arises when data is computed and also stored with ghost atoms
@ -58,7 +58,7 @@ embedded-atom method (EAM) which compute intermediate values in the
first part of the compute() function that need to be stored by both first part of the compute() function that need to be stored by both
owned and ghost atoms for the second part of the force computation. owned and ghost atoms for the second part of the force computation.
The *Comm* class methods perform the MPI communication for buffers of The *Comm* class methods perform the MPI communication for buffers of
per-atom data. They "call back" to the *Pair* class so it can *pack* per-atom data. They "call back" to the *Pair* class, so it can *pack*
or *unpack* the buffer with data the *Pair* class owns. There are 4 or *unpack* the buffer with data the *Pair* class owns. There are 4
such methods that the *Pair* class must define, assuming it uses both such methods that the *Pair* class must define, assuming it uses both
forward and reverse communication: forward and reverse communication:
@ -70,22 +70,22 @@ forward and reverse communication:
The arguments to these methods include the buffer and a list of atoms The arguments to these methods include the buffer and a list of atoms
to pack or unpack. The *Pair* class also must set the *comm_forward* to pack or unpack. The *Pair* class also must set the *comm_forward*
and *comm_reverse* variables which store the number of values stored and *comm_reverse* variables, which store the number of values stored
in the communication buffers for each operation. This means, if in the communication buffers for each operation. This means, if
desired, it can choose to store multiple per-atom values in the desired, it can choose to store multiple per-atom values in the
buffer, and they will be communicated together to minimize buffer, and they will be communicated together to minimize
communication overhead. The communication buffers are defined vectors communication overhead. The communication buffers are defined vectors
containing ``double`` values. To correctly store integers that may be containing ``double`` values. To correctly store integers that may be
64-bit (bigint, tagint, imageint) in the buffer, you need to use the 64-bit (bigint, tagint, imageint) in the buffer, you need to use the
`ubuf union <Communication buffer coding with ubuf>`_ construct. :ref:`ubuf union <communication_buffer_coding_with_ubuf>` construct.
The *Fix*, *Compute*, and *Dump* classes can also invoke the same kind The *Fix*, *Compute*, and *Dump* classes can also invoke the same kind
of forward and reverse communication operations using the same *Comm* of forward and reverse communication operations using the same *Comm*
class methods. Likewise the same pack/unpack methods and class methods. Likewise, the same pack/unpack methods and
comm_forward/comm_reverse variables must be defined by the calling comm_forward/comm_reverse variables must be defined by the calling
*Fix*, *Compute*, or *Dump* class. *Fix*, *Compute*, or *Dump* class.
For *Fix* classes there is an optional second argument to the For *Fix* classes, there is an optional second argument to the
*forward_comm()* and *reverse_comm()* call which can be used when the *forward_comm()* and *reverse_comm()* call which can be used when the
fix performs multiple modes of communication, with different numbers fix performs multiple modes of communication, with different numbers
of values per atom. The fix should set the *comm_forward* and of values per atom. The fix should set the *comm_forward* and
@ -150,7 +150,7 @@ latter case, when the *ring* operation is complete, each processor can
examine its original buffer to extract modified values. examine its original buffer to extract modified values.
Note that the *ring* operation is similar to an MPI_Alltoall() Note that the *ring* operation is similar to an MPI_Alltoall()
operation where every processor effectively sends and receives data to operation, where every processor effectively sends and receives data to
every other processor. The difference is that the *ring* operation every other processor. The difference is that the *ring* operation
does it one step at a time, so the total volume of data does not need does it one step at a time, so the total volume of data does not need
to be stored by every processor. However, the *ring* operation is to be stored by every processor. However, the *ring* operation is
@ -184,8 +184,8 @@ The *exchange_data()* method triggers the communication to be
performed. Each processor provides the vector of *N* datums to send, performed. Each processor provides the vector of *N* datums to send,
and the size of each datum. All datums must be the same size. and the size of each datum. All datums must be the same size.
The *create_atom()* and *exchange_atom()* methods are similar except The *create_atom()* and *exchange_atom()* methods are similar, except
that the size of each datum can be different. Typically this is used that the size of each datum can be different. Typically, this is used
to communicate atoms, each with a variable amount of per-atom data, to to communicate atoms, each with a variable amount of per-atom data, to
other processors. other processors.

View File

@ -45,9 +45,9 @@ other methods in the class.
zero before each timestep, so that forces (torques, etc) can be zero before each timestep, so that forces (torques, etc) can be
accumulated. accumulated.
Now for the ``Verlet::run()`` method. Its basic structure in hi-level pseudo Now for the ``Verlet::run()`` method. Its basic structure in hi-level
code is shown below. In the actual code in ``src/verlet.cpp`` some of pseudocode is shown below. In the actual code in ``src/verlet.cpp``
these operations are conditionally invoked. some of these operations are conditionally invoked.
.. code-block:: python .. code-block:: python
@ -105,17 +105,17 @@ need it. These flags are passed to the various methods that compute
particle interactions, so that they either compute and tally the particle interactions, so that they either compute and tally the
corresponding data or can skip the extra calculations if the energy and corresponding data or can skip the extra calculations if the energy and
virial are not needed. See the comments for the ``Integrate::ev_set()`` virial are not needed. See the comments for the ``Integrate::ev_set()``
method which document the flag values. method, which document the flag values.
At various points of the timestep, fixes are invoked, At various points of the timestep, fixes are invoked,
e.g. ``fix->initial_integrate()``. In the code, this is actually done e.g. ``fix->initial_integrate()``. In the code, this is actually done
via the Modify class which stores all the Fix objects and lists of which via the Modify class, which stores all the Fix objects and lists of which
should be invoked at what point in the timestep. Fixes are the LAMMPS should be invoked at what point in the timestep. Fixes are the LAMMPS
mechanism for tailoring the operations of a timestep for a particular mechanism for tailoring the operations of a timestep for a particular
simulation. As described elsewhere, each fix has one or more methods, simulation. As described elsewhere, each fix has one or more methods,
each of which is invoked at a specific stage of the timestep, as show in each of which is invoked at a specific stage of the timestep, as show in
the timestep pseudo-code. All the active fixes defined in an input the timestep pseudocode. All the active fixes defined in an input
script, that are flagged to have an ``initial_integrate()`` method are script, that are flagged to have an ``initial_integrate()`` method, are
invoked at the beginning of each timestep. Examples are :doc:`fix nve invoked at the beginning of each timestep. Examples are :doc:`fix nve
<fix_nve>` or :doc:`fix nvt or fix npt <fix_nh>` which perform the <fix_nve>` or :doc:`fix nvt or fix npt <fix_nh>` which perform the
start-of-timestep velocity-Verlet integration operations to update start-of-timestep velocity-Verlet integration operations to update
@ -131,15 +131,15 @@ can be changed using the :doc:`neigh_modify every/delay/check
<neigh_modify>` command. If not, coordinates of ghost atoms are <neigh_modify>` command. If not, coordinates of ghost atoms are
acquired by each processor via the ``forward_comm()`` method of the Comm acquired by each processor via the ``forward_comm()`` method of the Comm
class. If neighbor lists need to be built, several operations within class. If neighbor lists need to be built, several operations within
the inner if clause of the pseudo-code are first invoked. The the inner if clause of the pseudocode are first invoked. The
``pre_exchange()`` method of any defined fixes is invoked first. ``pre_exchange()`` method of any defined fixes is invoked first.
Typically this inserts or deletes particles from the system. Typically, this inserts or deletes particles from the system.
Periodic boundary conditions are then applied by the Domain class via Periodic boundary conditions are then applied by the Domain class via
its ``pbc()`` method to remap particles that have moved outside the its ``pbc()`` method to remap particles that have moved outside the
simulation box back into the box. Note that this is not done every simulation box back into the box. Note that this is not done every
timestep, but only when neighbor lists are rebuilt. This is so that timestep, but only when neighbor lists are rebuilt. This is so that
each processor's sub-domain will have consistent (nearby) atom each processor's subdomain will have consistent (nearby) atom
coordinates for its owned and ghost atoms. It is also why dumped atom coordinates for its owned and ghost atoms. It is also why dumped atom
coordinates may be slightly outside the simulation box if not dumped coordinates may be slightly outside the simulation box if not dumped
on a step where the neighbor lists are rebuilt. on a step where the neighbor lists are rebuilt.
@ -148,15 +148,15 @@ The box boundaries are then reset (if needed) via the ``reset_box()``
method of the Domain class, e.g. if box boundaries are shrink-wrapped to method of the Domain class, e.g. if box boundaries are shrink-wrapped to
current particle coordinates. A change in the box size or shape current particle coordinates. A change in the box size or shape
requires internal information for communicating ghost atoms (Comm class) requires internal information for communicating ghost atoms (Comm class)
and neighbor list bins (Neighbor class) be updated. The ``setup()`` and neighbor list bins (Neighbor class) to be updated. The ``setup()``
method of the Comm class and ``setup_bins()`` method of the Neighbor method of the Comm class and ``setup_bins()`` method of the Neighbor
class perform the update. class perform the update.
The code is now ready to migrate atoms that have left a processor's The code is now ready to migrate atoms that have left a processor's
geometric sub-domain to new processors. The ``exchange()`` method of geometric subdomain to new processors. The ``exchange()`` method of
the Comm class performs this operation. The ``borders()`` method of the the Comm class performs this operation. The ``borders()`` method of the
Comm class then identifies ghost atoms surrounding each processor's Comm class then identifies ghost atoms surrounding each processor's
sub-domain and communicates ghost atom information to neighboring subdomain and communicates ghost atom information to neighboring
processors. It does this by looping over all the atoms owned by a processors. It does this by looping over all the atoms owned by a
processor to make lists of those to send to each neighbor processor. On processor to make lists of those to send to each neighbor processor. On
subsequent timesteps, the lists are used by the ``Comm::forward_comm()`` subsequent timesteps, the lists are used by the ``Comm::forward_comm()``
@ -217,20 +217,21 @@ file, and restart files. See the :doc:`thermo_style <thermo_style>`,
:doc:`dump <dump>`, and :doc:`restart <restart>` commands for more :doc:`dump <dump>`, and :doc:`restart <restart>` commands for more
details. details.
The the flow of control during energy minimization iterations is The flow of control during energy minimization iterations is similar to
similar to that of a molecular dynamics timestep. Forces are computed, that of a molecular dynamics timestep. Forces are computed, neighbor
neighbor lists are built as needed, atoms migrate to new processors, and lists are built as needed, atoms migrate to new processors, and atom
atom coordinates and forces are communicated to neighboring processors. coordinates and forces are communicated to neighboring processors. The
The only difference is what Fix class operations are invoked when. Only only difference is what Fix class operations are invoked when. Only a
a subset of LAMMPS fixes are useful during energy minimization, as subset of LAMMPS fixes are useful during energy minimization, as
explained in their individual doc pages. The relevant Fix class methods explained in their individual doc pages. The relevant Fix class methods
are ``min_pre_exchange()``, ``min_pre_force()``, and ``min_post_force()``. are ``min_pre_exchange()``, ``min_pre_force()``, and
Each fix is invoked at the appropriate place within the minimization ``min_post_force()``. Each fix is invoked at the appropriate place
iteration. For example, the ``min_post_force()`` method is analogous to within the minimization iteration. For example, the
the ``post_force()`` method for dynamics; it is used to alter or constrain ``min_post_force()`` method is analogous to the ``post_force()`` method
forces on each atom, which affects the minimization procedure. for dynamics; it is used to alter or constrain forces on each atom,
which affects the minimization procedure.
After all iterations are completed there is a ``cleanup`` step which After all iterations are completed, there is a ``cleanup`` step which
calls the ``post_run()`` method of fixes to perform operations only required calls the ``post_run()`` method of fixes to perform operations only required
at the end of a calculations (like freeing temporary storage or creating at the end of a calculation (like freeing temporary storage or creating
final outputs). final outputs).

View File

@ -28,9 +28,9 @@ grid.
More specifically, a grid point is defined for each cell (by default More specifically, a grid point is defined for each cell (by default
the center point), and a processor owns a grid cell if its point is the center point), and a processor owns a grid cell if its point is
within the processor's spatial sub-domain. The union of processor within the processor's spatial subdomain. The union of processor
sub-domains is the global simulation box. If a grid point is on the subdomains is the global simulation box. If a grid point is on the
boundary of two sub-domains, the lower processor owns the grid cell. A boundary of two subdomains, the lower processor owns the grid cell. A
processor may also store copies of ghost cells which surround its processor may also store copies of ghost cells which surround its
owned cells. owned cells.
@ -62,7 +62,7 @@ y-dimension. It is even possible to define a 1x1x1 3d grid, though it
may be inefficient to use it in a computational sense. may be inefficient to use it in a computational sense.
Note that the choice of grid size is independent of the number of Note that the choice of grid size is independent of the number of
processors or their layout in a grid of processor sub-domains which processors or their layout in a grid of processor subdomains which
overlays the simulations domain. Depending on the distributed grid overlays the simulations domain. Depending on the distributed grid
size, a single processor may own many 1000s or no grid cells. size, a single processor may own many 1000s or no grid cells.
@ -70,7 +70,7 @@ A command can define multiple grids, each of a different size. Each
grid is an instantiation of the Grid2d or Grid3d class. grid is an instantiation of the Grid2d or Grid3d class.
The command also defines what data it will store for each grid it The command also defines what data it will store for each grid it
creates and it allocates the multi-dimensional array(s) needed to creates and it allocates the multidimensional array(s) needed to
store the data. No grid cell data is stored within the Grid2d or store the data. No grid cell data is stored within the Grid2d or
Grid3d classes. Grid3d classes.
@ -115,7 +115,7 @@ which stores *Nvalues* per grid cell.
nyhi_out, nxlo_out, nxhi_out, nvalues, nyhi_out, nxlo_out, nxhi_out, nvalues,
"data3d_multi"); "data3d_multi");
Note that these multi-dimensional arrays are allocated as contiguous Note that these multidimensional arrays are allocated as contiguous
chunks of memory where the x-index of the grid varies fastest, then y, chunks of memory where the x-index of the grid varies fastest, then y,
and the z-index slowest. For multiple values per grid cell, the and the z-index slowest. For multiple values per grid cell, the
Nvalues are contiguous, so their index varies even faster than the Nvalues are contiguous, so their index varies even faster than the
@ -160,7 +160,7 @@ cells (the entire allocated grid).
Grid class constructors Grid class constructors
^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
The following sub-sections describe the public methods of the Grid3d The following subsections describe the public methods of the Grid3d
class which a style command can invoke. The Grid2d methods are class which a style command can invoke. The Grid2d methods are
similar; simply remove arguments which refer to the z-dimension. similar; simply remove arguments which refer to the z-dimension.
@ -235,7 +235,7 @@ invoked, because they influence its operation.
void set_zfactor(double factor); void set_zfactor(double factor);
Processors own a grid cell if a point within the grid cell is inside Processors own a grid cell if a point within the grid cell is inside
the processor's sub-domain. By default this is the center point of the the processor's subdomain. By default this is the center point of the
grid cell. The *set_shift_grid()* method can change this. The *shift* grid cell. The *set_shift_grid()* method can change this. The *shift*
argument is a value from 0.0 to 1.0 (inclusive) which is the offset of argument is a value from 0.0 to 1.0 (inclusive) which is the offset of
the point within the grid cell in each dimension. The default is 0.5 the point within the grid cell in each dimension. The default is 0.5
@ -245,9 +245,9 @@ typically no need to change the default as it is optimal for
minimizing the number of ghost cells needed. minimizing the number of ghost cells needed.
If a processor maps its particles to grid cells, it needs to allow for If a processor maps its particles to grid cells, it needs to allow for
its particles being outside its sub-domain between reneighboring. The its particles being outside its subdomain between reneighboring. The
*distance* argument of the *set_distance()* method sets the furthest *distance* argument of the *set_distance()* method sets the furthest
distance outside a processor's sub-domain which a particle can move. distance outside a processor's subdomain which a particle can move.
Typically this is half the neighbor skin distance, assuming Typically this is half the neighbor skin distance, assuming
reneighboring is done appropriately. This distance is used in reneighboring is done appropriately. This distance is used in
determining how many ghost cells a processor needs to store to enable determining how many ghost cells a processor needs to store to enable
@ -295,7 +295,7 @@ to the Grid class via the *set_zfactor()* method (*set_yfactor()* for
2d grids). The Grid class will then assign ownership of the 1/3 of 2d grids). The Grid class will then assign ownership of the 1/3 of
grid cells that overlay the simulation box to the processors which grid cells that overlay the simulation box to the processors which
also overlay the simulation box. The remaining 2/3 of the grid cells also overlay the simulation box. The remaining 2/3 of the grid cells
are assigned to processors whose sub-domains are adjacent to the upper are assigned to processors whose subdomains are adjacent to the upper
z boundary of the simulation box. z boundary of the simulation box.
---------- ----------
@ -533,7 +533,7 @@ processor's ghost cells extend further than nearest neighbor
processors. processors.
This can be checked by callers who have the option to change the This can be checked by callers who have the option to change the
global grid size to insure more efficient nearest-neighbor-only global grid size to ensure more efficient nearest-neighbor-only
communication if they wish. In this case, they instantiate a grid of communication if they wish. In this case, they instantiate a grid of
a given size (resolution), then invoke *setup_comm()* followed by a given size (resolution), then invoke *setup_comm()* followed by
*ghost_adjacent()*. If the ghost cells are not adjacent, they destroy *ghost_adjacent()*. If the ghost cells are not adjacent, they destroy
@ -549,13 +549,13 @@ Grid class remap methods for load balancing
The following methods are used when a load-balancing operation, The following methods are used when a load-balancing operation,
triggered by the :doc:`balance <balance>` or :doc:`fix balance triggered by the :doc:`balance <balance>` or :doc:`fix balance
<fix_balance>` commands, changes the partitioning of the simulation <fix_balance>` commands, changes the partitioning of the simulation
domain into processor sub-domains. domain into processor subdomains.
In order to work with load-balancing, any style command (compute, fix, In order to work with load-balancing, any style command (compute, fix,
pair, or kspace style) which allocates a grid and stores per-grid data pair, or kspace style) which allocates a grid and stores per-grid data
should define a *reset_grid()* method; it takes no arguments. It will should define a *reset_grid()* method; it takes no arguments. It will
be called by the two balance commands after they have reset processor be called by the two balance commands after they have reset processor
sub-domains and migrated atoms (particles) to new owning processors. subdomains and migrated atoms (particles) to new owning processors.
The *reset_grid()* method will typically perform some or all of the The *reset_grid()* method will typically perform some or all of the
following operations. See the src/fix_ave_grid.cpp and following operations. See the src/fix_ave_grid.cpp and
src/EXTRA_FIX/fix_ttm_grid.cpp files for examples of *reset_grid()* src/EXTRA_FIX/fix_ttm_grid.cpp files for examples of *reset_grid()*
@ -564,7 +564,7 @@ functions.
First, the *reset_grid()* method can instantiate new grid(s) of the First, the *reset_grid()* method can instantiate new grid(s) of the
same global size, then call *setup_grid()* to partition them via the same global size, then call *setup_grid()* to partition them via the
new processor sub-domains. At this point, it can invoke the new processor subdomains. At this point, it can invoke the
*identical()* method which compares the owned and ghost grid cell *identical()* method which compares the owned and ghost grid cell
index bounds between two grids, the old grid passed as a pointer index bounds between two grids, the old grid passed as a pointer
argument, and the new grid whose *identical()* method is being called. argument, and the new grid whose *identical()* method is being called.
@ -753,7 +753,7 @@ their input script syntax, as described on the :doc:`Howto_grid
* f_ID:gname:dname * f_ID:gname:dname
* f_ID:gname:dname[I] * f_ID:gname:dname[I]
Each grid a command instantiates has a unique *gname*, defined by the Each grid command instantiates has a unique *gname*, defined by the
command. Likewise each grid cell data structure (scalar or vector) command. Likewise each grid cell data structure (scalar or vector)
associated with a grid has a unique *dname*, also defined by the associated with a grid has a unique *dname*, also defined by the
command. command.
@ -784,8 +784,7 @@ The *get_grid_by_index()* method is called after the
*get_grid_by_name()* method, using the grid index it returned as its *get_grid_by_name()* method, using the grid index it returned as its
argument. This method will return a pointer to the Grid2d or Grid3d argument. This method will return a pointer to the Grid2d or Grid3d
class. The caller can use this to query grid attributes, such as the class. The caller can use this to query grid attributes, such as the
global size of the grid. The :doc:`dump grid <dump>` to insure each global size of the grid, to ensure it is of the expected size.
its grid reference arguments are for grids of the same size.
The *get_griddata_by_name()* method takes a grid index *igrid* and a The *get_griddata_by_name()* method takes a grid index *igrid* and a
data name as input. It returns two values. The *ncol* argument is data name as input. It returns two values. The *ncol* argument is
@ -799,7 +798,7 @@ A value of -1 is returned if the data name is not recognized.
The *get_griddata_by_index()* method is called after the The *get_griddata_by_index()* method is called after the
*get_griddata_by_name()* method, using the data index it returned as *get_griddata_by_name()* method, using the data index it returned as
its argument. This method will return a pointer to the its argument. This method will return a pointer to the
multi-dimensional array which stores the requested data. multidimensional array which stores the requested data.
As in the discussion above of the Memory class *create_offset()* As in the discussion above of the Memory class *create_offset()*
methods, the dimensionality of the array associated with the returned methods, the dimensionality of the array associated with the returned

View File

@ -11,6 +11,7 @@ Available topics are:
- `Reading and parsing of text and text files`_ - `Reading and parsing of text and text files`_
- `Requesting and accessing neighbor lists`_ - `Requesting and accessing neighbor lists`_
- `Choosing between a custom atom style, fix property/atom, and fix STORE/ATOM`_
- `Fix contributions to instantaneous energy, virial, and cumulative energy`_ - `Fix contributions to instantaneous energy, virial, and cumulative energy`_
- `KSpace PPPM FFT grids`_ - `KSpace PPPM FFT grids`_
@ -102,7 +103,7 @@ build is then :doc:`processed in parallel <Developer_par_neigh>`.
The most commonly required neighbor list is a so-called "half" neighbor The most commonly required neighbor list is a so-called "half" neighbor
list, where each pair of atoms is listed only once (except when the list, where each pair of atoms is listed only once (except when the
:doc:`newton command setting <newton>` for pair is off; in that case :doc:`newton command setting <newton>` for pair is off; in that case
pairs straddling sub-domains or periodic boundaries will be listed twice). pairs straddling subdomains or periodic boundaries will be listed twice).
Thus these are the default settings when a neighbor list request is created in: Thus these are the default settings when a neighbor list request is created in:
.. code-block:: c++ .. code-block:: c++
@ -216,6 +217,30 @@ command:
neighbor->add_request(this, "delete_atoms", NeighConst::REQ_FULL); neighbor->add_request(this, "delete_atoms", NeighConst::REQ_FULL);
Choosing between a custom atom style, fix property/atom, and fix STORE/ATOM
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
There are multiple ways to manage per-atom data within LAMMPS. Often
the per-atom storage is only used locally and managed by the class that
uses it. If the data has to persist between multiple time steps and
migrate with atoms when they move from sub-domain to sub-domain or
across periodic boundaries, then using a custom atom style, or :doc:`fix
property/atom <fix_property_atom>`, or the internal fix STORE/ATOM are
possible options.
- Using the atom style is usually the most programming effort and mostly
needed when the per-atom data is an integral part of the model like a
per-atom charge or diameter and thus should be part of the Atoms
section of a :doc:`data file <read_data>`.
- Fix property/atom is useful if the data is optional or should be
entered by the user, or accessed as a (named) custom property. In this
case the fix should be entered as part of the input (and not
internally) which allows to enter and store its content with data files.
- Fix STORE/ATOM should be used when the data should be accessed internally
only and thus the fix can be created internally.
Fix contributions to instantaneous energy, virial, and cumulative energy Fix contributions to instantaneous energy, virial, and cumulative energy
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -361,7 +386,7 @@ allocated as a 1d vector or 3d array. Either way, the ordering of
values within contiguous memory x fastest, then y, z slowest. values within contiguous memory x fastest, then y, z slowest.
For the ``3d decomposition`` of the grid, the global grid is For the ``3d decomposition`` of the grid, the global grid is
partitioned into bricks that correspond to the sub-domains of the partitioned into bricks that correspond to the subdomains of the
simulation box that each processor owns. Often, this is a regular 3d simulation box that each processor owns. Often, this is a regular 3d
array (Px by Py by Pz) of bricks, where P = number of processors = array (Px by Py by Pz) of bricks, where P = number of processors =
Px * Py * Pz. More generally it can be a tiled decomposition, where Px * Py * Pz. More generally it can be a tiled decomposition, where

View File

@ -7,7 +7,7 @@ but there are small a number of files in several other languages like C,
Fortran, Shell script, or Python. Fortran, Shell script, or Python.
The core of the code is located in the ``src`` folder and its The core of the code is located in the ``src`` folder and its
sub-directories. A sizable number of these files are in the ``src`` subdirectories. A sizable number of these files are in the ``src``
directory itself, but there are plenty of :doc:`packages <Packages>`, directory itself, but there are plenty of :doc:`packages <Packages>`,
which can be included or excluded when LAMMPS is built. See the which can be included or excluded when LAMMPS is built. See the
:doc:`Include packages in build <Build_package>` section of the manual :doc:`Include packages in build <Build_package>` section of the manual
@ -15,42 +15,42 @@ for more information about that part of the build process. LAMMPS
currently supports building with :doc:`conventional makefiles currently supports building with :doc:`conventional makefiles
<Build_make>` and through :doc:`CMake <Build_cmake>`. Those procedures <Build_make>` and through :doc:`CMake <Build_cmake>`. Those procedures
differ in how packages are enabled or disabled for inclusion into a differ in how packages are enabled or disabled for inclusion into a
LAMMPS binary so they cannot be mixed. The source files for each LAMMPS binary, so they cannot be mixed. The source files for each
package are in all-uppercase sub-directories of the ``src`` folder, for package are in all-uppercase subdirectories of the ``src`` folder, for
example ``src/MOLECULE`` or ``src/EXTRA-MOLECULE``. The ``src/STUBS`` example ``src/MOLECULE`` or ``src/EXTRA-MOLECULE``. The ``src/STUBS``
sub-directory is not a package but contains a dummy MPI library, that is subdirectory is not a package but contains a dummy MPI library, that is
used when building a serial version of the code. The ``src/MAKE`` used when building a serial version of the code. The ``src/MAKE``
directory and its sub-directories contain makefiles with settings and directory and its subdirectories contain makefiles with settings and
flags for a variety of configuration and machines for the build process flags for a variety of configuration and machines for the build process
with traditional makefiles. with traditional makefiles.
The ``lib`` directory contains the source code for several supporting The ``lib`` directory contains the source code for several supporting
libraries or files with configuration settings to use globally installed libraries or files with configuration settings to use globally installed
libraries, that are required by some of the optional packages. They may libraries, that are required by some optional packages. They may
include python scripts that can transparently download additional source include python scripts that can transparently download additional source
code on request. Each sub-directory, like ``lib/poems`` or ``lib/gpu``, code on request. Each subdirectory, like ``lib/poems`` or ``lib/gpu``,
contains the source files, some of which are in different languages such contains the source files, some of which are in different languages such
as Fortran or CUDA. These libraries included in the LAMMPS build, as Fortran or CUDA. These libraries included in the LAMMPS build, if the
if the corresponding package is installed. corresponding package is installed.
LAMMPS C++ source files almost always come in pairs, such as LAMMPS C++ source files almost always come in pairs, such as
``src/run.cpp`` (implementation file) and ``src/run.h`` (header file). ``src/run.cpp`` (implementation file) and ``src/run.h`` (header file).
Each pair of files defines a C++ class, for example the Each pair of files defines a C++ class, for example the
:cpp:class:`LAMMPS_NS::Run` class which contains the code invoked by the :cpp:class:`LAMMPS_NS::Run` class, which contains the code invoked by
:doc:`run <run>` command in a LAMMPS input script. As this example the :doc:`run <run>` command in a LAMMPS input script. As this example
illustrates, source file and class names often have a one-to-one illustrates, source file and class names often have a one-to-one
correspondence with a command used in a LAMMPS input script. Some correspondence with a command used in a LAMMPS input script. Some
source files and classes do not have a corresponding input script source files and classes do not have a corresponding input script
command, e.g. ``src/force.cpp`` and the :cpp:class:`LAMMPS_NS::Force` command, for example ``src/force.cpp`` and the :cpp:class:`LAMMPS_NS::Force`
class. They are discussed in the next section. class. They are discussed in the next section.
The names of all source files are in lower case and may use the The names of all source files are in lower case and may use the
underscore character '_' to separate words. Outside of bundled libraries underscore character '_' to separate words. Apart from bundled,
which may have different conventions, all C and C++ header files have a externally maintained libraries, which may have different conventions,
``.h`` extension, all C++ files have a ``.cpp`` extension, and C files a all C and C++ header files have a ``.h`` extension, all C++ files have a
``.c`` extension. A small number of C++ classes and utility functions ``.cpp`` extension, and C files a ``.c`` extension. A few C++ classes
are implemented with only a ``.h`` file. Examples are the Pointers and and utility functions are implemented with only a ``.h`` file. Examples
Commands classes or the MathVec functions. are the Pointers and Commands classes or the MathVec functions.
Class topology Class topology
-------------- --------------
@ -62,35 +62,36 @@ associated source files in the ``src`` folder, for example the class
:cpp:class:`LAMMPS_NS::Memory` corresponds to the files ``memory.cpp`` :cpp:class:`LAMMPS_NS::Memory` corresponds to the files ``memory.cpp``
and ``memory.h``, or the class :cpp:class:`LAMMPS_NS::AtomVec` and ``memory.h``, or the class :cpp:class:`LAMMPS_NS::AtomVec`
corresponds to the files ``atom_vec.cpp`` and ``atom_vec.h``. Full corresponds to the files ``atom_vec.cpp`` and ``atom_vec.h``. Full
lines in the figure represent compositing: that is the class at the base lines in the figure represent compositing: that is, the class at the
of the arrow holds a pointer to an instance of the class at the tip. base of the arrow holds a pointer to an instance of the class at the
Dashed lines instead represent inheritance: the class to the tip of the tip. Dashed lines instead represent inheritance: the class at the tip
arrow is derived from the class at the base. Classes with a red boundary of the arrow is derived from the class at the base. Classes with a red
are not instantiated directly, but they represent the base classes for boundary are not instantiated directly, but they represent the base
"styles". Those "styles" make up the bulk of the LAMMPS code and only classes for "styles". Those "styles" make up the bulk of the LAMMPS
a few representative examples are included in the figure so it remains code and only a few representative examples are included in the figure,
readable. so it remains readable.
.. _class-topology: .. _class-topology:
.. figure:: JPG/lammps-classes.png .. figure:: JPG/lammps-classes.png
LAMMPS class topology LAMMPS class topology
This figure shows some of the relations of the base classes of the This figure shows relations of base classes of the LAMMPS
LAMMPS simulation package. Full lines indicate that a class holds an simulation package. Full lines indicate that a class holds an
instance of the class it is pointing to; dashed lines point to instance of the class it is pointing to; dashed lines point to
derived classes that are given as examples of what classes may be derived classes that are given as examples of what classes may be
instantiated during a LAMMPS run based on the input commands and instantiated during a LAMMPS run based on the input commands and
accessed through the API define by their respective base classes. At accessed through the API define by their respective base classes.
the core is the :cpp:class:`LAMMPS <LAMMPS_NS::LAMMPS>` class, which At the core is the :cpp:class:`LAMMPS <LAMMPS_NS::LAMMPS>` class,
holds pointers to class instances with specific purposes. Those may which holds pointers to class instances with specific purposes.
hold instances of other classes, sometimes directly, or only Those may hold instances of other classes, sometimes directly, or
temporarily, sometimes as derived classes or derived classes of only temporarily, sometimes as derived classes or derived classes
derived classes, which may also hold instances of other classes. of derived classes, which may also hold instances of other
classes.
The :cpp:class:`LAMMPS_NS::LAMMPS` class is the topmost class and The :cpp:class:`LAMMPS_NS::LAMMPS` class is the topmost class and
represents what is generally referred to an "instance" of LAMMPS. It is represents what is generally referred to as an "instance of LAMMPS". It
a composite holding pointers to instances of other core classes is a composite holding pointers to instances of other core classes
providing the core functionality of the MD engine in LAMMPS and through providing the core functionality of the MD engine in LAMMPS and through
them abstractions of the required operations. The constructor of the them abstractions of the required operations. The constructor of the
LAMMPS class will instantiate those instances, process the command line LAMMPS class will instantiate those instances, process the command line
@ -102,42 +103,44 @@ LAMMPS while passing it the command line flags and input script. It
deletes the LAMMPS instance after the method reading the input returns deletes the LAMMPS instance after the method reading the input returns
and shuts down the MPI environment before it exits the executable. and shuts down the MPI environment before it exits the executable.
The :cpp:class:`LAMMPS_NS::Pointers` is not shown in the The :cpp:class:`LAMMPS_NS::Pointers` class is not shown in the
:ref:`class-topology` figure for clarity. It holds references to many :ref:`class-topology` figure for clarity. It holds references to many
of the members of the `LAMMPS_NS::LAMMPS`, so that all classes derived of the members of the `LAMMPS_NS::LAMMPS`, so that all classes derived
from :cpp:class:`LAMMPS_NS::Pointers` have direct access to those from :cpp:class:`LAMMPS_NS::Pointers` have direct access to those
reference. From the class topology all classes with blue boundary are references. From the class topology all classes with blue boundary are
referenced in the Pointers class and all classes in the second and third referenced in the Pointers class and all classes in the second and third
columns, that are not listed as derived classes are instead derived from columns, that are not listed as derived classes, are instead derived
:cpp:class:`LAMMPS_NS::Pointers`. To initialize the pointer references from :cpp:class:`LAMMPS_NS::Pointers`. To initialize the pointer
in Pointers, a pointer to the LAMMPS class instance needs to be passed references in Pointers, a pointer to the LAMMPS class instance needs to
to the constructor and thus all constructors for classes derived from it be passed to the constructor. All constructors for classes derived from
must do so and pass this pointer to the constructor for Pointers. it, must do so and thus pass that pointer to the constructor for
:cpp:class:`LAMMPS_NS::Pointers`. The default constructor for
:cpp:class:`LAMMPS_NS::Pointers` is disabled to enforce this.
Since all storage is supposed to be encapsulated (there are a few Since all storage is supposed to be encapsulated (there are a few
exceptions), the LAMMPS class can also be instantiated multiple times by exceptions), the LAMMPS class can also be instantiated multiple times by
a calling code. Outside of the aforementioned exceptions, those LAMMPS a calling code. Outside the aforementioned exceptions, those LAMMPS
instances can be used alternately. As of the time of this writing instances can be used alternately. As of the time of this writing
(early 2021) LAMMPS is not yet sufficiently thread-safe for concurrent (early 2023) LAMMPS is not yet sufficiently thread-safe for concurrent
execution. When running in parallel with MPI, care has to be taken, execution. When running in parallel with MPI, care has to be taken,
that suitable copies of communicators are used to not create conflicts that suitable copies of communicators are used to not create conflicts
between different instances. between different instances.
The LAMMPS class currently (early 2021) holds instances of 19 classes The LAMMPS class currently holds instances of 19 classes representing
representing the core functionality. There are a handful of virtual the core functionality. There are a handful of virtual parent classes
parent classes in LAMMPS that define what LAMMPS calls ``styles``. They in LAMMPS that define what LAMMPS calls ``styles``. These are shaded
are shaded red in the :ref:`class-topology` figure. Each of these are red in the :ref:`class-topology` figure. Each of these are parents of a
parents of a number of child classes that implement the interface number of child classes that implement the interface defined by the
defined by the parent class. There are two main categories of these parent class. There are two main categories of these ``styles``: some
``styles``: some may only have one instance active at a time (e.g. atom, may only have one instance active at a time (e.g. atom, pair, bond,
pair, bond, angle, dihedral, improper, kspace, comm) and there is a angle, dihedral, improper, kspace, comm) and there is a dedicated
dedicated pointer variable for each of them in the composite class. pointer variable for each of them in the corresponding composite class.
Setups that require a mix of different such styles have to use a Setups that require a mix of different such styles have to use a
*hybrid* class that takes the place of the one allowed instance and then *hybrid* class instance that acts as a proxy, and manages and forwards
manages and forwards calls to the corresponding sub-styles for the calls to the corresponding sub-style class instances for the designated
designated subset of atoms or data. The composite class may also have subset of atoms or data. The composite class may also have lists of
lists of class instances, e.g. Modify handles lists of compute and fix class instances, e.g. ``Modify`` handles lists of compute and fix
styles, while Output handles a list of dump class instances. styles, while ``Output`` handles a list of dump class instances.
The exception to this scheme are the ``command`` style classes. These The exception to this scheme are the ``command`` style classes. These
implement specific commands that can be invoked before, after, or in implement specific commands that can be invoked before, after, or in
@ -146,19 +149,19 @@ command() method called and then, after completion, the class instance
deleted. Examples for this are the create_box, create_atoms, minimize, deleted. Examples for this are the create_box, create_atoms, minimize,
run, set, or velocity command styles. run, set, or velocity command styles.
For all those ``styles`` certain naming conventions are employed: for For all those ``styles``, certain naming conventions are employed: for
the fix nve command the class is called FixNVE and the source files are the fix nve command the class is called FixNVE and the source files are
``fix_nve.h`` and ``fix_nve.cpp``. Similarly for fix ave/time we have ``fix_nve.h`` and ``fix_nve.cpp``. Similarly, for fix ave/time we have
FixAveTime and ``fix_ave_time.h`` and ``fix_ave_time.cpp``. Style names FixAveTime and ``fix_ave_time.h`` and ``fix_ave_time.cpp``. Style names
are lower case and without spaces or special characters. A suffix or are lower case and without spaces or special characters. A suffix or
words are appended with a forward slash '/' which denotes a variant of words are appended with a forward slash '/' which denotes a variant of
the corresponding class without the suffix. To connect the style name the corresponding class without the suffix. To connect the style name
and the class name, LAMMPS uses macros like: ``AtomStyle()``, and the class name, LAMMPS uses macros like: ``AtomStyle()``,
``PairStyle()``, ``BondStyle()``, ``RegionStyle()``, and so on in the ``PairStyle()``, ``BondStyle()``, ``RegionStyle()``, and so on in the
corresponding header file. During configuration or compilation files corresponding header file. During configuration or compilation, files
with the pattern ``style_<name>.h`` are created that consist of a list with the pattern ``style_<name>.h`` are created that consist of a list
of include statements including all headers of all styles of a given of include statements including all headers of all styles of a given
type that are currently active (or "installed). type that are currently enabled (or "installed").
More details on individual classes in the :ref:`class-topology` are as More details on individual classes in the :ref:`class-topology` are as
@ -172,8 +175,8 @@ follows:
that one or multiple simulations can be run, on the processors that one or multiple simulations can be run, on the processors
allocated for a run, e.g. by the mpirun command. allocated for a run, e.g. by the mpirun command.
- The Input class reads and processes input input strings and files, - The Input class reads and processes input (strings and files), stores
stores variables, and invokes :doc:`commands <Commands_all>`. variables, and invokes :doc:`commands <Commands_all>`.
- Command style classes are derived from the Command class. They provide - Command style classes are derived from the Command class. They provide
input script commands that perform one-time operations input script commands that perform one-time operations
@ -192,7 +195,7 @@ follows:
- The Atom class stores per-atom properties associated with atom styles. - The Atom class stores per-atom properties associated with atom styles.
More precisely, they are allocated and managed by a class derived from More precisely, they are allocated and managed by a class derived from
the AtomVec class, and the Atom class simply stores pointers to them. the AtomVec class, and the Atom class simply stores pointers to them.
The classes derived from AtomVec represent the different atom styles The classes derived from AtomVec represent the different atom styles,
and they are instantiated through the :doc:`atom_style <atom_style>` and they are instantiated through the :doc:`atom_style <atom_style>`
command. command.
@ -207,17 +210,21 @@ follows:
instance is created by pair, fix, or compute styles when they need a instance is created by pair, fix, or compute styles when they need a
particular kind of neighbor list and use the NeighRequest properties particular kind of neighbor list and use the NeighRequest properties
to select the neighbor list settings for the given request. There can to select the neighbor list settings for the given request. There can
be multiple instances of the NeighRequest class and the Neighbor class be multiple instances of the NeighRequest class. The Neighbor class
will try to optimize how they are computed by creating copies or will try to optimize how the requests are processed. Depending on the
sub-lists where possible. NeighRequest properties, neighbor lists are constructed from scratch,
aliased, or constructed by post-processing an existing list into
sub-lists.
- The Comm class performs inter-processor communication, typically of - The Comm class performs inter-processor communication, typically of
ghost atom information. This usually involves MPI message exchanges ghost atom information. This usually involves MPI message exchanges
with 6 neighboring processors in the 3d logical grid of processors with 6 neighboring processors in the 3d logical grid of processors
mapped to the simulation box. There are two :doc:`communication styles mapped to the simulation box. There are two :doc:`communication styles
<comm_style>` enabling different ways to do the domain decomposition. <comm_style>`, enabling different ways to perform the domain
Sometimes the Irregular class is used, when atoms may migrate to decomposition.
arbitrary processors.
- The Irregular class is used, when atoms may migrate to arbitrary
processors.
- The Domain class stores the simulation box geometry, as well as - The Domain class stores the simulation box geometry, as well as
geometric Regions and any user definition of a Lattice. The latter geometric Regions and any user definition of a Lattice. The latter
@ -246,7 +253,7 @@ follows:
file, dump file snapshots, and restart files. These correspond to the file, dump file snapshots, and restart files. These correspond to the
:doc:`Thermo <thermo_style>`, :doc:`Dump <dump>`, and :doc:`Thermo <thermo_style>`, :doc:`Dump <dump>`, and
:doc:`WriteRestart <write_restart>` classes respectively. The Dump :doc:`WriteRestart <write_restart>` classes respectively. The Dump
class is a base class with several derived classes implementing class is a base class, with several derived classes implementing
various dump style variants. various dump style variants.
- The Timer class logs timing information, output at the end - The Timer class logs timing information, output at the end

View File

@ -1,22 +1,22 @@
Communication Communication
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
Following the partitioning scheme in use all per-atom data is Following the selected partitioning scheme, all per-atom data is
distributed across the MPI processes, which allows LAMMPS to handle very distributed across the MPI processes, which allows LAMMPS to handle very
large systems provided it uses a correspondingly large number of MPI large systems provided it uses a correspondingly large number of MPI
processes. Since The per-atom data (atom IDs, positions, velocities, processes. Since The per-atom data (atom IDs, positions, velocities,
types, etc.) To be able to compute the short-range interactions MPI types, etc.) To be able to compute the short-range interactions, MPI
processes need not only access to data of atoms they "own" but also processes need not only access to the data of atoms they "own" but also
information about atoms from neighboring sub-domains, in LAMMPS referred information about atoms from neighboring subdomains, in LAMMPS referred
to as "ghost" atoms. These are copies of atoms storing required to as "ghost" atoms. These are copies of atoms storing required
per-atom data for up to the communication cutoff distance. The green per-atom data for up to the communication cutoff distance. The green
dashed-line boxes in the :ref:`domain-decomposition` figure illustrate dashed-line boxes in the :ref:`domain-decomposition` figure illustrate
the extended ghost-atom sub-domain for one processor. the extended ghost-atom subdomain for one processor.
This approach is also used to implement periodic boundary This approach is also used to implement periodic boundary
conditions: atoms that lie within the cutoff distance across a periodic conditions: atoms that lie within the cutoff distance across a periodic
boundary are also stored as ghost atoms and taken from the periodic boundary are also stored as ghost atoms and taken from the periodic
replication of the sub-domain, which may be the same sub-domain, e.g. if replication of the subdomain, which may be the same subdomain, e.g. if
running in serial. As a consequence of this, force computation in running in serial. As a consequence of this, force computation in
LAMMPS is not subject to minimum image conventions and thus cutoffs may LAMMPS is not subject to minimum image conventions and thus cutoffs may
be larger than half the simulation domain. be larger than half the simulation domain.
@ -28,10 +28,10 @@ be larger than half the simulation domain.
ghost atom communication ghost atom communication
This figure shows the ghost atom communication patterns between This figure shows the ghost atom communication patterns between
sub-domains for "brick" (left) and "tiled" communication styles for subdomains for "brick" (left) and "tiled" communication styles for
2d simulations. The numbers indicate MPI process ranks. Here the 2d simulations. The numbers indicate MPI process ranks. Here the
sub-domains are drawn spatially separated for clarity. The subdomains are drawn spatially separated for clarity. The
dashed-line box is the extended sub-domain of processor 0 which dashed-line box is the extended subdomain of processor 0 which
includes its ghost atoms. The red- and blue-shaded boxes are the includes its ghost atoms. The red- and blue-shaded boxes are the
regions of communicated ghost atoms. regions of communicated ghost atoms.
@ -42,7 +42,7 @@ atom communication is performed in two stages for a 2d simulation (three
in 3d) for both a regular and irregular partitioning of the simulation in 3d) for both a regular and irregular partitioning of the simulation
box. For the regular case (left) atoms are exchanged first in the box. For the regular case (left) atoms are exchanged first in the
*x*-direction, then in *y*, with four neighbors in the grid of processor *x*-direction, then in *y*, with four neighbors in the grid of processor
sub-domains. subdomains.
In the *x* stage, processor ranks 1 and 2 send owned atoms in their In the *x* stage, processor ranks 1 and 2 send owned atoms in their
red-shaded regions to rank 0 (and vice versa). Then in the *y* stage, red-shaded regions to rank 0 (and vice versa). Then in the *y* stage,
@ -55,11 +55,11 @@ For the irregular case (right) the two stages are similar, but a
processor can have more than one neighbor in each direction. In the processor can have more than one neighbor in each direction. In the
*x* stage, MPI ranks 1,2,3 send owned atoms in their red-shaded regions to *x* stage, MPI ranks 1,2,3 send owned atoms in their red-shaded regions to
rank 0 (and vice versa). These include only atoms between the lower rank 0 (and vice versa). These include only atoms between the lower
and upper *y*-boundary of rank 0's sub-domain. In the *y* stage, ranks and upper *y*-boundary of rank 0's subdomain. In the *y* stage, ranks
4,5,6 send atoms in their blue-shaded regions to rank 0. This may 4,5,6 send atoms in their blue-shaded regions to rank 0. This may
include ghost atoms they received in the *x* stage, but only if they include ghost atoms they received in the *x* stage, but only if they
are needed by rank 0 to fill its extended ghost atom regions in the are needed by rank 0 to fill its extended ghost atom regions in the
+/-*y* directions (blue rectangles). Thus in this case, ranks 5 and +/-*y* directions (blue rectangles). Thus, in this case, ranks 5 and
6 do not include ghost atoms they received from each other (in the *x* 6 do not include ghost atoms they received from each other (in the *x*
stage) in the atoms they send to rank 0. The key point is that while stage) in the atoms they send to rank 0. The key point is that while
the pattern of communication is more complex in the irregular the pattern of communication is more complex in the irregular
@ -78,14 +78,14 @@ A "reverse" communication is when computed ghost atom attributes are
sent back to the processor who owns the atom. This is used (for sent back to the processor who owns the atom. This is used (for
example) to sum partial forces on ghost atoms to the complete force on example) to sum partial forces on ghost atoms to the complete force on
owned atoms. The order of the two stages described in the owned atoms. The order of the two stages described in the
:ref:`ghost-atom-comm` figure is inverted and the same lists of atoms :ref:`ghost-atom-comm` figure is inverted, and the same lists of atoms
are used to pack and unpack message buffers with per-atom forces. When are used to pack and unpack message buffers with per-atom forces. When
a received buffer is unpacked, the ghost forces are summed to owned atom a received buffer is unpacked, the ghost forces are summed to owned atom
forces. As in forward communication, forces on atoms in the four blue forces. As in forward communication, forces on atoms in the four blue
corners of the diagrams are sent, received, and summed twice (once at corners of the diagrams are sent, received, and summed twice (once at
each stage) before owning processors have the full force. each stage) before owning processors have the full force.
These two operations are used many places within LAMMPS aside from These two operations are used in many places within LAMMPS aside from
exchange of coordinates and forces, for example by manybody potentials exchange of coordinates and forces, for example by manybody potentials
to share intermediate per-atom values, or by rigid-body integrators to to share intermediate per-atom values, or by rigid-body integrators to
enable each atom in a body to access body properties. Here are enable each atom in a body to access body properties. Here are
@ -105,16 +105,16 @@ performed in LAMMPS:
atom pairs when building neighbor lists or computing forces. atom pairs when building neighbor lists or computing forces.
- The cutoff distance for exchanging ghost atoms is typically equal to - The cutoff distance for exchanging ghost atoms is typically equal to
the neighbor cutoff. But it can also chosen to be longer if needed, the neighbor cutoff. But it can also set to a larger value if needed,
e.g. half the diameter of a rigid body composed of multiple atoms or e.g. half the diameter of a rigid body composed of multiple atoms or
over 3x the length of a stretched bond for dihedral interactions. It over 3x the length of a stretched bond for dihedral interactions. It
can also exceed the periodic box size. For the regular communication can also exceed the periodic box size. For the regular communication
pattern (left), if the cutoff distance extends beyond a neighbor pattern (left), if the cutoff distance extends beyond a neighbor
processor's sub-domain, then multiple exchanges are performed in the processor's subdomain, then multiple exchanges are performed in the
same direction. Each exchange is with the same neighbor processor, same direction. Each exchange is with the same neighbor processor,
but buffers are packed/unpacked using a different list of atoms. For but buffers are packed/unpacked using a different list of atoms. For
forward communication, in the first exchange a processor sends only forward communication, in the first exchange, a processor sends only
owned atoms. In subsequent exchanges, it sends ghost atoms received owned atoms. In subsequent exchanges, it sends ghost atoms received
in previous exchanges. For the irregular pattern (right) overlaps of in previous exchanges. For the irregular pattern (right) overlaps of
a processor's extended ghost-atom sub-domain with all other processors a processor's extended ghost-atom subdomain with all other processors
in each dimension are detected. in each dimension are detected.

View File

@ -20,7 +20,7 @@ e) electric field values from grid points near each atom are interpolated to com
For any of the spatial-decomposition partitioning schemes each processor For any of the spatial-decomposition partitioning schemes each processor
owns the brick-shaped portion of FFT grid points contained within its owns the brick-shaped portion of FFT grid points contained within its
sub-domain. The two interpolation operations use a stencil of grid subdomain. The two interpolation operations use a stencil of grid
points surrounding each atom. To accommodate the stencil size, each points surrounding each atom. To accommodate the stencil size, each
processor also stores a few layers of ghost grid points surrounding its processor also stores a few layers of ghost grid points surrounding its
brick. Forward and reverse communication of grid point values is brick. Forward and reverse communication of grid point values is
@ -40,31 +40,31 @@ orthogonal boxes.
.. _fft-parallel: .. _fft-parallel:
.. figure:: img/fft-decomp-parallel.png .. figure:: img/fft-decomp-parallel.png
:align: center
parallel FFT in PPPM Parallel FFT in PPPM
Stages of a parallel FFT for a simulation domain overlaid Stages of a parallel FFT for a simulation domain overlaid with an
with an 8x8x8 3d FFT grid, partitioned across 64 processors. 8x8x8 3d FFT grid, partitioned across 64 processors. Within each
Within each of the 4 diagrams, grid cells of the same color are of the 4 diagrams, grid cells of the same color are owned by a
owned by a single processor; for simplicity only cells owned by 4 single processor; for simplicity, only cells owned by 4 or 8 of
or 8 of the 64 processors are colored. The two images on the left the 64 processors are colored. The two images on the left
illustrate brick-to-pencil communication. The two images on the illustrate brick-to-pencil communication. The two images on the
right illustrate pencil-to-pencil communication, which in this right illustrate pencil-to-pencil communication, which in this
case transposes the *y* and *z* dimensions of the grid. case transposes the *y* and *z* dimensions of the grid.
Parallel 3d FFTs require substantial communication relative to their Parallel 3d FFTs require substantial communication relative to their
computational cost. A 3d FFT is implemented by a series of 1d FFTs computational cost. A 3d FFT is implemented by a series of 1d FFTs
along the *x-*, *y-*, and *z-*\ direction of the FFT grid. Thus the FFT along the *x-*, *y-*, and *z-*\ direction of the FFT grid. Thus, the
grid cannot be decomposed like atoms into 3 dimensions for parallel FFT grid cannot be decomposed like atoms into 3 dimensions for parallel
processing of the FFTs but only in 1 (as planes) or 2 (as pencils) processing of the FFTs but only in 1 (as planes) or 2 (as pencils)
dimensions and in between the steps the grid needs to be transposed to dimensions and in between the steps the grid needs to be transposed to
have the FFT grid portion "owned" by each MPI process complete in the have the FFT grid portion "owned" by each MPI process complete in the
direction of the 1d FFTs it has to perform. LAMMPS uses the direction of the 1d FFTs it has to perform. LAMMPS uses the
pencil-decomposition algorithm as shown in the :ref:`fft-parallel` figure. pencil-decomposition algorithm as shown in the :ref:`fft-parallel`
figure.
Initially (far left), each processor owns a brick of same-color grid Initially (far left), each processor owns a brick of same-color grid
cells (actually grid points) contained within in its sub-domain. A cells (actually grid points) contained within in its subdomain. A
brick-to-pencil communication operation converts this layout to 1d brick-to-pencil communication operation converts this layout to 1d
pencils in the *x*-dimension (center left). Again, cells of the same pencils in the *x*-dimension (center left). Again, cells of the same
color are owned by the same processor. Each processor can then compute color are owned by the same processor. Each processor can then compute
@ -97,7 +97,7 @@ across all $P$ processors with a single call to ``MPI_Alltoall()``, but
this is typically much slower. However, for the specialized brick and this is typically much slower. However, for the specialized brick and
pencil tiling illustrated in :ref:`fft-parallel` figure, collective pencil tiling illustrated in :ref:`fft-parallel` figure, collective
communication across the entire MPI communicator is not required. In communication across the entire MPI communicator is not required. In
the example an :math:`8^3` grid with 512 grid cells is partitioned the example, an :math:`8^3` grid with 512 grid cells is partitioned
across 64 processors; each processor owns a 2x2x2 3d brick of grid across 64 processors; each processor owns a 2x2x2 3d brick of grid
cells. The initial brick-to-pencil communication (upper left to upper cells. The initial brick-to-pencil communication (upper left to upper
right) only requires collective communication within subgroups of 4 right) only requires collective communication within subgroups of 4
@ -132,7 +132,7 @@ grid/particle operations that LAMMPS supports:
- The fftMPI library allows each grid dimension to be a multiple of - The fftMPI library allows each grid dimension to be a multiple of
small prime factors (2,3,5), and allows any number of processors to small prime factors (2,3,5), and allows any number of processors to
perform the FFT. The resulting brick and pencil decompositions are perform the FFT. The resulting brick and pencil decompositions are
thus not always as well-aligned but the size of subgroups of thus not always as well-aligned, but the size of subgroups of
processors for the two modes of communication (brick/pencil and processors for the two modes of communication (brick/pencil and
pencil/pencil) still scale as :math:`O(P^{\frac{1}{3}})` and pencil/pencil) still scale as :math:`O(P^{\frac{1}{3}})` and
:math:`O(P^{\frac{1}{2}})`. :math:`O(P^{\frac{1}{2}})`.
@ -143,26 +143,28 @@ grid/particle operations that LAMMPS supports:
in memory. This reordering can be done during the packing or in memory. This reordering can be done during the packing or
unpacking of buffers for MPI communication. unpacking of buffers for MPI communication.
- For large systems and particularly a large number of MPI processes, - For large systems and particularly many MPI processes, the dominant
the dominant cost for parallel FFTs is often the communication, not cost for parallel FFTs is often the communication, not the computation
the computation of 1d FFTs, even though the latter scales as :math:`N of 1d FFTs, even though the latter scales as :math:`N \log(N)` in the
\log(N)` in the number of grid points *N* per grid direction. This is number of grid points *N* per grid direction. This is due to the fact
due to the fact that only a 2d decomposition into pencils is possible that only a 2d decomposition into pencils is possible while atom data
while atom data (and their corresponding short-range force and energy (and their corresponding short-range force and energy computations)
computations) can be decomposed efficiently in 3d. can be decomposed efficiently in 3d.
This can be addressed by reducing the number of MPI processes involved Reducing the number of MPI processes involved in the MPI communication
in the MPI communication by using :doc:`hybrid MPI + OpenMP will reduce this kind of overhead. By using a :doc:`hybrid MPI +
parallelization <Speed_omp>`. This will use OpenMP parallelization OpenMP parallelization <Speed_omp>` it is still possible to use all
inside the MPI domains and while that may have a lower parallel processes for parallel computation. It will use OpenMP
efficiency, it reduces the communication overhead. parallelization inside the MPI domains. While that may have a lower
parallel efficiency for some part of the computation, that can be less
than the communication overhead in the 3d FFTs.
As an alternative it is also possible to start a :ref:`multi-partition As an alternative, it is also possible to start a :ref:`multi-partition
<partition>` calculation and then use the :doc:`verlet/split <partition>` calculation and then use the :doc:`verlet/split
integrator <run_style>` to perform the PPPM computation on a integrator <run_style>` to perform the PPPM computation on a
dedicated, separate partition of MPI processes. This uses an integer dedicated, separate partition of MPI processes. This uses an integer
"1:*p*" mapping of *p* sub-domains of the atom decomposition to one "1:*p*" mapping of *p* subdomains of the atom decomposition to one
sub-domain of the FFT grid decomposition and where pairwise non-bonded subdomain of the FFT grid decomposition and where pairwise non-bonded
and bonded forces and energies are computed on the larger partition and bonded forces and energies are computed on the larger partition
and the PPPM kspace computation concurrently on the smaller partition. and the PPPM kspace computation concurrently on the smaller partition.
@ -172,10 +174,10 @@ grid/particle operations that LAMMPS supports:
- LAMMPS implements a ``GridComm`` class which overlays the simulation - LAMMPS implements a ``GridComm`` class which overlays the simulation
domain with a regular grid, partitions it across processors in a domain with a regular grid, partitions it across processors in a
manner consistent with processor sub-domains, and provides methods for manner consistent with processor subdomains, and provides methods for
forward and reverse communication of owned and ghost grid point forward and reverse communication of owned and ghost grid point
values. It is used for PPPM as an FFT grid (as outlined above) and values. It is used for PPPM as an FFT grid (as outlined above) and
also for the MSM algorithm which uses a cascade of grid sizes from also for the MSM algorithm, which uses a cascade of grid sizes from
fine to coarse to compute long-range Coulombic forces. The GridComm fine to coarse to compute long-range Coulombic forces. The GridComm
class is also useful for models where continuum fields interact with class is also useful for models where continuum fields interact with
particles. For example, the two-temperature model (TTM) defines heat particles. For example, the two-temperature model (TTM) defines heat

View File

@ -3,12 +3,12 @@ Neighbor lists
To compute forces efficiently, each processor creates a Verlet-style To compute forces efficiently, each processor creates a Verlet-style
neighbor list which enumerates all pairs of atoms *i,j* (*i* = owned, neighbor list which enumerates all pairs of atoms *i,j* (*i* = owned,
*j* = owned or ghost) with separation less than the applicable *j* = owned or ghost) with separation less than the applicable neighbor
neighbor list cutoff distance. In LAMMPS the neighbor lists are stored list cutoff distance. In LAMMPS, the neighbor lists are stored in a
in a multiple-page data structure; each page is a contiguous chunk of multiple-page data structure; each page is a contiguous chunk of memory
memory which stores vectors of neighbor atoms *j* for many *i* atoms. which stores vectors of neighbor atoms *j* for many *i* atoms. This
This allows pages to be incrementally allocated or deallocated in blocks allows pages to be incrementally allocated or deallocated in blocks as
as needed. Neighbor lists typically consume the most memory of any data needed. Neighbor lists typically consume the most memory of any data
structure in LAMMPS. The neighbor list is rebuilt (from scratch) once structure in LAMMPS. The neighbor list is rebuilt (from scratch) once
every few timesteps, then used repeatedly each step for force or other every few timesteps, then used repeatedly each step for force or other
computations. The neighbor cutoff distance is :math:`R_n = R_f + computations. The neighbor cutoff distance is :math:`R_n = R_f +
@ -16,20 +16,20 @@ computations. The neighbor cutoff distance is :math:`R_n = R_f +
the interatomic potential for computing short-range pairwise or manybody the interatomic potential for computing short-range pairwise or manybody
forces and :math:`\Delta_s` is a "skin" distance that allows the list to forces and :math:`\Delta_s` is a "skin" distance that allows the list to
be used for multiple steps assuming that atoms do not move very far be used for multiple steps assuming that atoms do not move very far
between consecutive time steps. Typically the code triggers between consecutive time steps. Typically, the code triggers
reneighboring when any atom has moved half the skin distance since the reneighboring when any atom has moved half the skin distance since the
last reneighboring; this and other options of the neighbor list rebuild last reneighboring; this and other options of the neighbor list rebuild
can be adjusted with the :doc:`neigh_modify <neigh_modify>` command. can be adjusted with the :doc:`neigh_modify <neigh_modify>` command.
On steps when reneighboring is performed, atoms which have moved outside On steps when reneighboring is performed, atoms which have moved outside
their owning processor's sub-domain are first migrated to new processors their owning processor's subdomain are first migrated to new processors
via communication. Periodic boundary conditions are also (only) via communication. Periodic boundary conditions are also (only)
enforced on these steps to ensure each atom is re-assigned to the enforced on these steps to ensure each atom is re-assigned to the
correct processor. After migration, the atoms owned by each processor correct processor. After migration, the atoms owned by each processor
are stored in a contiguous vector. Periodically each processor are stored in a contiguous vector. Periodically, each processor
spatially sorts owned atoms within its vector to reorder it for improved spatially sorts owned atoms within its vector to reorder it for improved
cache efficiency in force computations and neighbor list building. For cache efficiency in force computations and neighbor list building. For
that atoms are spatially binned and then reordered so that atoms in the that, atoms are spatially binned and then reordered so that atoms in the
same bin are adjacent in the vector. Atom sorting can be disabled or same bin are adjacent in the vector. Atom sorting can be disabled or
its settings modified with the :doc:`atom_modify <atom_modify>` command. its settings modified with the :doc:`atom_modify <atom_modify>` command.
@ -39,12 +39,12 @@ its settings modified with the :doc:`atom_modify <atom_modify>` command.
neighbor list stencils neighbor list stencils
A 2d simulation sub-domain (thick black line) and the corresponding A 2d simulation subdomain (thick black line) and the corresponding
ghost atom cutoff region (dashed blue line) for both orthogonal ghost atom cutoff region (dashed blue line) for both orthogonal
(left) and triclinic (right) domains. A regular grid of neighbor (left) and triclinic (right) domains. A regular grid of neighbor
bins (thin lines) overlays the entire simulation domain and need not bins (thin lines) overlays the entire simulation domain and need not
align with sub-domain boundaries; only the portion overlapping the align with subdomain boundaries; only the portion overlapping the
augmented sub-domain is shown. In the triclinic case it overlaps the augmented subdomain is shown. In the triclinic case, it overlaps the
bounding box of the tilted rectangle. The blue- and red-shaded bins bounding box of the tilted rectangle. The blue- and red-shaded bins
represent a stencil of bins searched to find neighbors of a particular represent a stencil of bins searched to find neighbors of a particular
atom (black dot). atom (black dot).
@ -52,13 +52,13 @@ its settings modified with the :doc:`atom_modify <atom_modify>` command.
To build a local neighbor list in linear time, the simulation domain is To build a local neighbor list in linear time, the simulation domain is
overlaid (conceptually) with a regular 3d (or 2d) grid of neighbor bins, overlaid (conceptually) with a regular 3d (or 2d) grid of neighbor bins,
as shown in the :ref:`neighbor-stencil` figure for 2d models and a as shown in the :ref:`neighbor-stencil` figure for 2d models and a
single MPI processor's sub-domain. Each processor stores a set of single MPI processor's subdomain. Each processor stores a set of
neighbor bins which overlap its sub-domain extended by the neighbor neighbor bins which overlap its subdomain, extended by the neighbor
cutoff distance :math:`R_n`. As illustrated, the bins need not align cutoff distance :math:`R_n`. As illustrated, the bins need not align
with processor boundaries; an integer number in each dimension is fit to with processor boundaries; an integer number in each dimension is fit to
the size of the entire simulation box. the size of the entire simulation box.
Most often LAMMPS builds what it calls a "half" neighbor list where Most often, LAMMPS builds what is called a "half" neighbor list where
each *i,j* neighbor pair is stored only once, with either atom *i* or each *i,j* neighbor pair is stored only once, with either atom *i* or
*j* as the central atom. The build can be done efficiently by using a *j* as the central atom. The build can be done efficiently by using a
pre-computed "stencil" of bins around a central origin bin which pre-computed "stencil" of bins around a central origin bin which
@ -67,18 +67,18 @@ is simply a list of integer offsets in *x,y,z* of nearby bins
surrounding the origin bin which are close enough to contain any surrounding the origin bin which are close enough to contain any
neighbor atom *j* within a distance :math:`R_n` from any atom *i* in the neighbor atom *j* within a distance :math:`R_n` from any atom *i* in the
origin bin. Note that for a half neighbor list, the stencil can be origin bin. Note that for a half neighbor list, the stencil can be
asymmetric since each atom only need store half its nearby neighbors. asymmetric, since each atom only need store half its nearby neighbors.
These stencils are illustrated in the figure for a half list and a bin These stencils are illustrated in the figure for a half list and a bin
size of :math:`\frac{1}{2} R_n`. There are 13 red+blue stencil bins in size of :math:`\frac{1}{2} R_n`. There are 13 red+blue stencil bins in
2d (for the orthogonal case, 15 for triclinic). In 3d there would be 2d (for the orthogonal case, 15 for triclinic). In 3d there would be
63, 13 in the plane of bins that contain the origin bin and 25 in each 63, 13 in the plane of bins that contain the origin bin and 25 in each
of the two planes above it in the *z* direction (75 for triclinic). The of the two planes above it in the *z* direction (75 for triclinic). The
reason the triclinic stencil has extra bins is because the bins tile the triclinic stencil has extra bins because the bins tile the bounding box
bounding box of the entire triclinic domain and thus are not periodic of the entire triclinic domain, and thus are not periodic with respect
with respect to the simulation box itself. The stencil and logic for to the simulation box itself. The stencil and logic for determining
determining which *i,j* pairs to include in the neighbor list are which *i,j* pairs to include in the neighbor list are altered slightly
altered slightly to account for this. to account for this.
To build a neighbor list, a processor first loops over its "owned" plus To build a neighbor list, a processor first loops over its "owned" plus
"ghost" atoms and assigns each to a neighbor bin. This uses an integer "ghost" atoms and assigns each to a neighbor bin. This uses an integer
@ -95,7 +95,7 @@ supports:
been found to be optimal for many typical cases. Smaller bins incur been found to be optimal for many typical cases. Smaller bins incur
additional overhead to loop over; larger bins require more distance additional overhead to loop over; larger bins require more distance
calculations. Note that for smaller bin sizes, the 2d stencil in the calculations. Note that for smaller bin sizes, the 2d stencil in the
figure would be more semi-circular in shape (hemispherical in 3d), figure would be of a more semicircular shape (hemispherical in 3d),
with bins near the corners of the square eliminated due to their with bins near the corners of the square eliminated due to their
distance from the origin bin. distance from the origin bin.
@ -111,8 +111,8 @@ supports:
symmetric stencil. It also includes lists with partial enumeration of symmetric stencil. It also includes lists with partial enumeration of
ghost atom neighbors. The full and ghost-atom lists are used by ghost atom neighbors. The full and ghost-atom lists are used by
various manybody interatomic potentials. Lists may also use different various manybody interatomic potentials. Lists may also use different
criteria for inclusion of a pair interaction. Typically this simply criteria for inclusion of a pairwise interaction. Typically, this
depends only on the distance between two atoms and the cutoff simply depends only on the distance between two atoms and the cutoff
distance. But for finite-size coarse-grained particles with distance. But for finite-size coarse-grained particles with
individual diameters (e.g. polydisperse granular particles), it can individual diameters (e.g. polydisperse granular particles), it can
also depend on the diameters of the two particles. also depend on the diameters of the two particles.
@ -121,11 +121,11 @@ supports:
of the master neighbor list for the full system need to be generated, of the master neighbor list for the full system need to be generated,
one for each sub-style, which contains only the *i,j* pairs needed to one for each sub-style, which contains only the *i,j* pairs needed to
compute interactions between subsets of atoms for the corresponding compute interactions between subsets of atoms for the corresponding
potential. This means not all *i* or *j* atoms owned by a processor potential. This means, not all *i* or *j* atoms owned by a processor
are included in a particular sub-list. are included in a particular sub-list.
- Some models use different cutoff lengths for pairwise interactions - Some models use different cutoff lengths for pairwise interactions
between different kinds of particles which are stored in a single between different kinds of particles, which are stored in a single
neighbor list. One example is a solvated colloidal system with large neighbor list. One example is a solvated colloidal system with large
colloidal particles where colloid/colloid, colloid/solvent, and colloidal particles where colloid/colloid, colloid/solvent, and
solvent/solvent interaction cutoffs can be dramatically different. solvent/solvent interaction cutoffs can be dramatically different.
@ -144,7 +144,7 @@ supports:
- For small and sparse systems and as a fallback method, LAMMPS also - For small and sparse systems and as a fallback method, LAMMPS also
supports neighbor list construction without binning by using a full supports neighbor list construction without binning by using a full
:math:`O(N^2)` loop over all *i,j* atom pairs in a sub-domain when :math:`O(N^2)` loop over all *i,j* atom pairs in a subdomain when
using the :doc:`neighbor nsq <neighbor>` command. using the :doc:`neighbor nsq <neighbor>` command.
- Dependent on the "pair" setting of the :doc:`newton <newton>` command, - Dependent on the "pair" setting of the :doc:`newton <newton>` command,
@ -153,7 +153,7 @@ supports:
For the newton pair *on* setting the atom *j* is only added to the For the newton pair *on* setting the atom *j* is only added to the
list if its *z* coordinate is larger, or if equal the *y* coordinate list if its *z* coordinate is larger, or if equal the *y* coordinate
is larger, and that is equal, too, the *x* coordinate is larger. For is larger, and that is equal, too, the *x* coordinate is larger. For
homogeneously dense systems that will result in picking neighbors from homogeneously dense systems, that will result in picking neighbors from
a same size sector in always the same direction relative to the a same size sector in always the same direction relative to the
"owned" atom and thus it should lead to similar length neighbor lists "owned" atom, and thus it should lead to similar length neighbor lists
and thus reduce the chance of a load imbalance. and reduce the chance of a load imbalance.

View File

@ -6,7 +6,7 @@ thread parallelism to predominantly distribute loops over local data
and thus follow an orthogonal parallelization strategy to the and thus follow an orthogonal parallelization strategy to the
decomposition into spatial domains used by the :doc:`MPI partitioning decomposition into spatial domains used by the :doc:`MPI partitioning
<Developer_par_part>`. For clarity, this section discusses only the <Developer_par_part>`. For clarity, this section discusses only the
implementation in the OPENMP package as it is the simplest. The INTEL implementation in the OPENMP package, as it is the simplest. The INTEL
and KOKKOS package offer additional options and are more complex since and KOKKOS package offer additional options and are more complex since
they support more features and different hardware like co-processors they support more features and different hardware like co-processors
or GPUs. or GPUs.
@ -14,7 +14,7 @@ or GPUs.
One of the key decisions when implementing the OPENMP package was to One of the key decisions when implementing the OPENMP package was to
keep the changes to the source code small, so that it would be easier to keep the changes to the source code small, so that it would be easier to
maintain the code and keep it in sync with the non-threaded standard maintain the code and keep it in sync with the non-threaded standard
implementation. this is achieved by a) making the OPENMP version a implementation. This is achieved by a) making the OPENMP version a
derived class from the regular version (e.g. ``PairLJCutOMP`` from derived class from the regular version (e.g. ``PairLJCutOMP`` from
``PairLJCut``) and overriding only methods that are multi-threaded or ``PairLJCut``) and overriding only methods that are multi-threaded or
need to be modified to support multi-threading (similar to what was done need to be modified to support multi-threading (similar to what was done
@ -26,13 +26,13 @@ into three separate classes ``ThrOMP``, ``ThrData``, and ``FixOMP``.
available in the corresponding base class (e.g. ``Pair`` for available in the corresponding base class (e.g. ``Pair`` for
``PairLJCutOMP``) like multi-thread aware variants of the "tally" ``PairLJCutOMP``) like multi-thread aware variants of the "tally"
functions. Those functions are made available through multiple functions. Those functions are made available through multiple
inheritance so those new functions have to have unique names to avoid inheritance, so those new functions have to have unique names to avoid
ambiguities; typically ``_thr`` is appended to the name of the function. ambiguities; typically ``_thr`` is appended to the name of the function.
``ThrData`` is a classes that manages per-thread data structures. ``ThrData`` is a class that manages per-thread data structures. It is
It is used instead of extending the corresponding storage to per-thread used instead of extending the corresponding storage to per-thread arrays
arrays to avoid slowdowns due to "false sharing" when multiple threads to avoid slowdowns due to "false sharing" when multiple threads update
update adjacent elements in an array and thus force the CPU cache lines adjacent elements in an array and thus force the CPU cache lines to be
to be reset and re-fetched. ``FixOMP`` finally manages the "multi-thread reset and re-fetched. ``FixOMP`` finally manages the "multi-thread
state" like settings and access to per-thread storage, it is activated state" like settings and access to per-thread storage, it is activated
by the :doc:`package omp <package>` command. by the :doc:`package omp <package>` command.
@ -46,24 +46,24 @@ involve multiple atoms and thus there are race conditions when multiple
threads want to update per-atom data of the same atoms. Five possible threads want to update per-atom data of the same atoms. Five possible
strategies have been considered to avoid this: strategies have been considered to avoid this:
1) restructure the code so that there is no overlapping access possible 1. Restructure the code so that there is no overlapping access possible
when computing in parallel, e.g. by breaking lists into multiple when computing in parallel, e.g. by breaking lists into multiple
parts and synchronizing threads in between. parts and synchronizing threads in between.
2) have each thread be "responsible" for a specific group of atoms and 2. Have each thread be "responsible" for a specific group of atoms and
compute these interactions multiple times, once on each thread that compute these interactions multiple times, once on each thread that
is responsible for a given atom and then have each thread only update is responsible for a given atom, and then have each thread only update
the properties of this atom. the properties of this atom.
3) use mutexes around functions and regions of code where the data race 3. Use mutexes around functions and regions of code where the data race
could happen could happen.
4) use atomic operations when updating per-atom properties 4. Use atomic operations when updating per-atom properties.
5) use replicated per-thread data structures to accumulate data without 5. Use replicated per-thread data structures to accumulate data without
conflicts and then use a reduction to combine those results into the conflicts and then use a reduction to combine those results into the
data structures used by the regular style. data structures used by the regular style.
Option 5 was chosen for the OPENMP package because it would retain the Option 5 was chosen for the OPENMP package because it would retain the
performance for the case of 1 thread and the code would be more performance for the case of a single thread and the code would be more
maintainable. Option 1 would require extensive code changes, maintainable. Option 1 would require extensive code changes,
particularly to the neighbor list code; options 2 would have incurred a particularly to the neighbor list code; option 2 would have incurred a
2x or more performance penalty for the serial case; option 3 causes 2x or more performance penalty for the serial case; option 3 causes
significant overhead and would enforce serialization of operations in significant overhead and would enforce serialization of operations in
inner loops and thus defeat the purpose of multi-threading; option 4 inner loops and thus defeat the purpose of multi-threading; option 4
@ -80,7 +80,7 @@ equivalent to the number of CPU cores per CPU socket on high-end
supercomputers. supercomputers.
Thus arrays like the force array are dimensioned to the number of atoms Thus arrays like the force array are dimensioned to the number of atoms
times the number of threads when enabling OpenMP support and inside the times the number of threads when enabling OpenMP support, and inside the
compute functions a pointer to a different chunk is obtained by each thread. compute functions a pointer to a different chunk is obtained by each thread.
Similarly, accumulators like potential energy or virial are kept in Similarly, accumulators like potential energy or virial are kept in
per-thread instances of the ``ThrData`` class and then only reduced and per-thread instances of the ``ThrData`` class and then only reduced and
@ -91,7 +91,7 @@ Loop scheduling
""""""""""""""" """""""""""""""
Multi-thread parallelization is applied by distributing (outer) loops Multi-thread parallelization is applied by distributing (outer) loops
statically across threads. Typically this would be the loop over local statically across threads. Typically, this would be the loop over local
atoms *i* when processing *i,j* pairs of atoms from a neighbor list. atoms *i* when processing *i,j* pairs of atoms from a neighbor list.
The design of the neighbor list code results in atoms having a similar The design of the neighbor list code results in atoms having a similar
number of neighbors for homogeneous systems and thus load imbalances number of neighbors for homogeneous systems and thus load imbalances

View File

@ -7,39 +7,39 @@ distributed-memory parallelism is set with the :doc:`comm_style command
.. _domain-decomposition: .. _domain-decomposition:
.. figure:: img/domain-decomp.png .. figure:: img/domain-decomp.png
:align: center
domain decomposition Domain decomposition schemes
This figure shows the different kinds of domain decomposition used This figure shows the different kinds of domain decomposition used
for MPI parallelization: "brick" on the left with an orthogonal for MPI parallelization: "brick" on the left with an orthogonal
(left) and a triclinic (middle) simulation domain, and a "tiled" (left) and a triclinic (middle) simulation domain, and a "tiled"
decomposition (right). The black lines show the division into decomposition (right). The black lines show the division into
sub-domains and the contained atoms are "owned" by the corresponding subdomains, and the contained atoms are "owned" by the
MPI process. The green dashed lines indicate how sub-domains are corresponding MPI process. The green dashed lines indicate how
extended with "ghost" atoms up to the communication cutoff distance. subdomains are extended with "ghost" atoms up to the communication
cutoff distance.
The LAMMPS simulation box is a 3d or 2d volume, which can be orthogonal The LAMMPS simulation box is a 3d or 2d volume, which can be of
or triclinic in shape, as illustrated in the :ref:`domain-decomposition` orthogonal or triclinic shape, as illustrated in the
figure for the 2d case. Orthogonal means the box edges are aligned with :ref:`domain-decomposition` figure for the 2d case. Orthogonal means
the *x*, *y*, *z* Cartesian axes, and the box faces are thus all the box edges are aligned with the *x*, *y*, *z* Cartesian axes, and the
rectangular. Triclinic allows for a more general parallelepiped shape box faces are thus all rectangular. Triclinic allows for a more general
in which edges are aligned with three arbitrary vectors and the box parallelepiped shape in which edges are aligned with three arbitrary
faces are parallelograms. In each dimension box faces can be periodic, vectors and the box faces are parallelograms. In each dimension, box
or non-periodic with fixed or shrink-wrapped boundaries. In the fixed faces can be periodic, or non-periodic with fixed or shrink-wrapped
case, atoms which move outside the face are deleted; shrink-wrapped boundaries. In the fixed case, atoms which move outside the face are
means the position of the box face adjusts continuously to enclose all deleted; shrink-wrapped means the position of the box face adjusts
the atoms. continuously to enclose all the atoms.
For distributed-memory MPI parallelism, the simulation box is spatially For distributed-memory MPI parallelism, the simulation box is spatially
decomposed (partitioned) into non-overlapping sub-domains which fill the decomposed (partitioned) into non-overlapping subdomains which fill the
box. The default partitioning, "brick", is most suitable when atom box. The default partitioning, "brick", is most suitable when atom
density is roughly uniform, as shown in the left-side images of the density is roughly uniform, as shown in the left-side images of the
:ref:`domain-decomposition` figure. The sub-domains comprise a regular :ref:`domain-decomposition` figure. The subdomains comprise a regular
grid and all sub-domains are identical in size and shape. Both the grid, and all subdomains are identical in size and shape. Both the
orthogonal and triclinic boxes can deform continuously during a orthogonal and triclinic boxes can deform continuously during a
simulation, e.g. to compress a solid or shear a liquid, in which case simulation, e.g. to compress a solid or shear a liquid, in which case
the processor sub-domains likewise deform. the processor subdomains likewise deform.
For models with non-uniform density, the number of particles per For models with non-uniform density, the number of particles per
@ -50,14 +50,14 @@ load. For such models, LAMMPS supports multiple strategies to reduce
the load imbalance: the load imbalance:
- The processor grid decomposition is by default based on the simulation - The processor grid decomposition is by default based on the simulation
cell volume and tries to optimize the volume to surface ratio for the sub-domains. cell volume and tries to optimize the volume to surface ratio for the subdomains.
This can be changed with the :doc:`processors command <processors>`. This can be changed with the :doc:`processors command <processors>`.
- The parallel planes defining the size of the sub-domains can be shifted - The parallel planes defining the size of the subdomains can be shifted
with the :doc:`balance command <balance>`. Which can be done in addition with the :doc:`balance command <balance>`. Which can be done in addition
to choosing a more optimal processor grid. to choosing a more optimal processor grid.
- The recursive bisectioning algorithm in combination with the "tiled" - The recursive bisectioning algorithm in combination with the "tiled"
communication style can produce a partitioning with equal numbers of communication style can produce a partitioning with equal numbers of
particles in each sub-domain. particles in each subdomain.
.. |decomp1| image:: img/decomp-regular.png .. |decomp1| image:: img/decomp-regular.png
@ -76,14 +76,14 @@ the load imbalance:
The pictures above demonstrate different decompositions for a 2d system The pictures above demonstrate different decompositions for a 2d system
with 12 MPI ranks. The atom colors indicate the load imbalance of each with 12 MPI ranks. The atom colors indicate the load imbalance of each
sub-domain with green being optimal and red the least optimal. subdomain, with green being optimal and red the least optimal.
Due to the vacuum in the system, the default decomposition is unbalanced Due to the vacuum in the system, the default decomposition is
with several MPI ranks without atoms (left). By forcing a 1x12x1 unbalanced, with several MPI ranks without atoms (left). By forcing a
processor grid, every MPI rank does computations now, but number of 1x12x1 processor grid, every MPI rank does computations now, but the
atoms per sub-domain is still uneven and the thin slice shape increases number of atoms per subdomain is still uneven, and the thin slice shape
the amount of communication between sub-domains (center left). With a increases the amount of communication between subdomains (center
2x6x1 processor grid and shifting the sub-domain divisions, the load left). With a 2x6x1 processor grid and shifting the subdomain divisions,
imbalance is further reduced and the amount of communication required the load imbalance is further reduced and the amount of communication
between sub-domains is less (center right). And using the recursive required between subdomains is less (center right). And using the
bisectioning leads to further improved decomposition (right). recursive bisectioning leads to further improved decomposition (right).

View File

@ -7,7 +7,7 @@ decomposition. The parallelization aims to be efficient, and resulting
in good strong scaling (= good speedup for the same system) and good in good strong scaling (= good speedup for the same system) and good
weak scaling (= the computational cost of enlarging the system is weak scaling (= the computational cost of enlarging the system is
proportional to the system size). Additional parallelization using GPUs proportional to the system size). Additional parallelization using GPUs
or OpenMP can also be applied within the sub-domain assigned to an MPI or OpenMP can also be applied within the subdomain assigned to an MPI
process. For clarity, most of the following illustrations show the 2d process. For clarity, most of the following illustrations show the 2d
simulation case. The underlying algorithms in those cases, however, simulation case. The underlying algorithms in those cases, however,
apply to both 2d and 3d cases equally well. apply to both 2d and 3d cases equally well.

View File

@ -24,6 +24,7 @@ Available topics in mostly chronological order are:
- `Use of "override" instead of "virtual"`_ - `Use of "override" instead of "virtual"`_
- `Simplified and more compact neighbor list requests`_ - `Simplified and more compact neighbor list requests`_
- `Split of fix STORE into fix STORE/GLOBAL and fix STORE/PERATOM`_ - `Split of fix STORE into fix STORE/GLOBAL and fix STORE/PERATOM`_
- `Rename of fix STORE/PERATOM to fix STORE/ATOM and change of arguments`_
- `Use Output::get_dump_by_id() instead of Output::find_dump()`_ - `Use Output::get_dump_by_id() instead of Output::find_dump()`_
- `Refactored grid communication using Grid3d/Grid2d classes instead of GridComm`_ - `Refactored grid communication using Grid3d/Grid2d classes instead of GridComm`_
@ -385,6 +386,34 @@ New:
This change is **required** or else the code will not compile. This change is **required** or else the code will not compile.
Rename of fix STORE/PERATOM to fix STORE/ATOM and change of arguments
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. versionchanged:: TBD
The available functionality of the internal fix to store per-atom
properties was expanded to enable storing data with ghost atoms and to
support binary restart files. With those changes, the fix was renamed
to fix STORE/ATOM and the number and order of (required) arguments has
changed.
Old syntax: ``ID group-ID STORE/PERATOM rflag n1 n2 [n3]``
- *rflag* = 0/1, *no*/*yes* store per-atom values in restart file
- :math:`n1 = 1, n2 = 1, \mathrm{no}\;n3 \to` per-atom vector, single value per atom
- :math:`n1 = 1, n2 > 1, \mathrm{no}\;n3 \to` per-atom array, *n2* values per atom
- :math:`n1 = 1, n2 > 0, n3 > 0 \to` per-atom tensor, *n2* x *n3* values per atom
New syntax: ``ID group-ID STORE/ATOM n1 n2 gflag rflag``
- :math:`n1 = 1, n2 = 0 \to` per-atom vector, single value per atom
- :math:`n1 > 1, n2 = 0 \to` per-atom array, *n1* values per atom
- :math:`n1 > 0, n2 > 0 \to` per-atom tensor, *n1* x *n2* values per atom
- *gflag* = 0/1, *no*/*yes* communicate per-atom values with ghost atoms
- *rflag* = 0/1, *no*/*yes* store per-atom values in restart file
Since this is an internal fix, there is no user visible change.
Use Output::get_dump_by_id() instead of Output::find_dump() Use Output::get_dump_by_id() instead of Output::find_dump()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -643,11 +643,13 @@ Tohoku University (under MIT license)
--------------------------- ---------------------------
.. _communication_buffer_coding_with_ubuf:
Communication buffer coding with *ubuf* Communication buffer coding with *ubuf*
--------------------------------------- ---------------------------------------
LAMMPS uses communication buffers where it collects data from various LAMMPS uses communication buffers where it collects data from various
class instances and then exchanges the data with neighboring sub-domains. class instances and then exchanges the data with neighboring subdomains.
For simplicity those buffers are defined as ``double`` buffers and For simplicity those buffers are defined as ``double`` buffers and
used for doubles and integer numbers. This presents a unique problem used for doubles and integer numbers. This presents a unique problem
when 64-bit integers are used. While the storage needed for a ``double`` when 64-bit integers are used. While the storage needed for a ``double``

View File

@ -113,7 +113,7 @@ LAMMPS output, something is wrong with your simulation. If you
suspect this is happening, it is a good idea to print out suspect this is happening, it is a good idea to print out
thermodynamic info frequently (e.g. every timestep) via the thermodynamic info frequently (e.g. every timestep) via the
:doc:`thermo <thermo>` so you can monitor what is happening. :doc:`thermo <thermo>` so you can monitor what is happening.
Visualizing the atom movement is also a good idea to insure your model Visualizing the atom movement is also a good idea to ensure your model
is behaving as you expect. is behaving as you expect.
In parallel, one way LAMMPS can hang is due to how different MPI In parallel, one way LAMMPS can hang is due to how different MPI

View File

@ -75,7 +75,7 @@ Using the GDB debugger to get a stack trace
There are two options to use the GDB debugger for identifying the origin There are two options to use the GDB debugger for identifying the origin
of the segmentation fault or similar crash. The GDB debugger has many of the segmentation fault or similar crash. The GDB debugger has many
more features and options, as can be seen for example its `online more features and options, as can be seen for example its `online
documentation <https://sourceware.org/gdb/current/onlinedocs/gdb/>`_. documentation <https://www.sourceware.org/gdb/documentation/>`_.
Run LAMMPS from within the debugger Run LAMMPS from within the debugger
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -5635,7 +5635,7 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
Lost atoms are checked for each time thermo output is done. See the Lost atoms are checked for each time thermo output is done. See the
thermo_modify lost command for options. Lost atoms usually indicate thermo_modify lost command for options. Lost atoms usually indicate
bad dynamics, e.g. atoms have been blown far out of the simulation bad dynamics, e.g. atoms have been blown far out of the simulation
box, or moved further than one processor's sub-domain away before box, or moved further than one processor's subdomain away before
reneighboring. reneighboring.
*MEAM library error %d* *MEAM library error %d*
@ -6092,7 +6092,7 @@ keyword to allow for additional bonds to be formed
after a read_data, read_restart, or create_box command. after a read_data, read_restart, or create_box command.
*Next command must list all universe and uloop variables* *Next command must list all universe and uloop variables*
This is to insure they stay in sync. This is to ensure they stay in sync.
*No Kspace style defined for compute group/group* *No Kspace style defined for compute group/group*
Self-explanatory. Self-explanatory.
@ -6266,14 +6266,14 @@ keyword to allow for additional bonds to be formed
One or more atoms are attempting to map their charge to a MSM grid point One or more atoms are attempting to map their charge to a MSM grid point
that is not owned by a processor. This is likely for one of two that is not owned by a processor. This is likely for one of two
reasons, both of them bad. First, it may mean that an atom near the reasons, both of them bad. First, it may mean that an atom near the
boundary of a processor's sub-domain has moved more than 1/2 the boundary of a processor's subdomain has moved more than 1/2 the
:doc:`neighbor skin distance <neighbor>` without neighbor lists being :doc:`neighbor skin distance <neighbor>` without neighbor lists being
rebuilt and atoms being migrated to new processors. This also means rebuilt and atoms being migrated to new processors. This also means
you may be missing pairwise interactions that need to be computed. you may be missing pairwise interactions that need to be computed.
The solution is to change the re-neighboring criteria via the The solution is to change the re-neighboring criteria via the
:doc:`neigh_modify <neigh_modify>` command. The safest settings are :doc:`neigh_modify <neigh_modify>` command. The safest settings are
"delay 0 every 1 check yes". Second, it may mean that an atom has "delay 0 every 1 check yes". Second, it may mean that an atom has
moved far outside a processor's sub-domain or even the entire moved far outside a processor's subdomain or even the entire
simulation box. This indicates bad physics, e.g. due to highly simulation box. This indicates bad physics, e.g. due to highly
overlapping atoms, too large a timestep, etc. overlapping atoms, too large a timestep, etc.
@ -6281,14 +6281,14 @@ keyword to allow for additional bonds to be formed
One or more atoms are attempting to map their charge to a PPPM grid One or more atoms are attempting to map their charge to a PPPM grid
point that is not owned by a processor. This is likely for one of two point that is not owned by a processor. This is likely for one of two
reasons, both of them bad. First, it may mean that an atom near the reasons, both of them bad. First, it may mean that an atom near the
boundary of a processor's sub-domain has moved more than 1/2 the boundary of a processor's subdomain has moved more than 1/2 the
:doc:`neighbor skin distance <neighbor>` without neighbor lists being :doc:`neighbor skin distance <neighbor>` without neighbor lists being
rebuilt and atoms being migrated to new processors. This also means rebuilt and atoms being migrated to new processors. This also means
you may be missing pairwise interactions that need to be computed. you may be missing pairwise interactions that need to be computed.
The solution is to change the re-neighboring criteria via the The solution is to change the re-neighboring criteria via the
:doc:`neigh_modify <neigh_modify>` command. The safest settings are :doc:`neigh_modify <neigh_modify>` command. The safest settings are
"delay 0 every 1 check yes". Second, it may mean that an atom has "delay 0 every 1 check yes". Second, it may mean that an atom has
moved far outside a processor's sub-domain or even the entire moved far outside a processor's subdomain or even the entire
simulation box. This indicates bad physics, e.g. due to highly simulation box. This indicates bad physics, e.g. due to highly
overlapping atoms, too large a timestep, etc. overlapping atoms, too large a timestep, etc.
@ -6296,14 +6296,14 @@ keyword to allow for additional bonds to be formed
One or more atoms are attempting to map their charge to a PPPM grid One or more atoms are attempting to map their charge to a PPPM grid
point that is not owned by a processor. This is likely for one of two point that is not owned by a processor. This is likely for one of two
reasons, both of them bad. First, it may mean that an atom near the reasons, both of them bad. First, it may mean that an atom near the
boundary of a processor's sub-domain has moved more than 1/2 the boundary of a processor's subdomain has moved more than 1/2 the
:doc:`neighbor skin distance <neighbor>` without neighbor lists being :doc:`neighbor skin distance <neighbor>` without neighbor lists being
rebuilt and atoms being migrated to new processors. This also means rebuilt and atoms being migrated to new processors. This also means
you may be missing pairwise interactions that need to be computed. you may be missing pairwise interactions that need to be computed.
The solution is to change the re-neighboring criteria via the The solution is to change the re-neighboring criteria via the
:doc:`neigh_modify <neigh_modify>` command. The safest settings are :doc:`neigh_modify <neigh_modify>` command. The safest settings are
"delay 0 every 1 check yes". Second, it may mean that an atom has "delay 0 every 1 check yes". Second, it may mean that an atom has
moved far outside a processor's sub-domain or even the entire moved far outside a processor's subdomain or even the entire
simulation box. This indicates bad physics, e.g. due to highly simulation box. This indicates bad physics, e.g. due to highly
overlapping atoms, too large a timestep, etc. overlapping atoms, too large a timestep, etc.
@ -7231,7 +7231,7 @@ keyword to allow for additional bonds to be formed
*Replacing a fix, but new style != old style* *Replacing a fix, but new style != old style*
A fix ID can be used a second time, but only if the style matches the A fix ID can be used a second time, but only if the style matches the
previous fix. In this case it is assumed you with to reset a fix's previous fix. In this case it is assumed you want to reset a fix's
parameters. This error may mean you are mistakenly re-using a fix ID parameters. This error may mean you are mistakenly re-using a fix ID
when you do not intend to. when you do not intend to.
@ -7337,7 +7337,7 @@ keyword to allow for additional bonds to be formed
*Rigid body atoms %d %d missing on proc %d at step %ld* *Rigid body atoms %d %d missing on proc %d at step %ld*
This means that an atom cannot find the atom that owns the rigid body This means that an atom cannot find the atom that owns the rigid body
it is part of, or vice versa. The solution is to use the communicate it is part of, or vice versa. The solution is to use the communicate
cutoff command to insure ghost atoms are acquired from far enough away cutoff command to ensure ghost atoms are acquired from far enough away
to encompass the max distance printed when the fix rigid/small command to encompass the max distance printed when the fix rigid/small command
was invoked. was invoked.

View File

@ -109,9 +109,9 @@ Doc page with :doc:`ERROR messages <Errors_messages>`
*Communication cutoff is shorter than a bond length based estimate. This may lead to errors.* *Communication cutoff is shorter than a bond length based estimate. This may lead to errors.*
Since LAMMPS stores topology data with individual atoms, all atoms Since LAMMPS stores topology data with individual atoms, all atoms
comprising a bond, angle, dihedral or improper must be present on any comprising a bond, angle, dihedral or improper must be present on any
sub-domain that "owns" the atom with the information, either as a subdomain that "owns" the atom with the information, either as a
local or a ghost atom. The communication cutoff is what determines up local or a ghost atom. The communication cutoff is what determines up
to what distance from a sub-domain boundary ghost atoms are created. to what distance from a subdomain boundary ghost atoms are created.
The communication cutoff is by default the largest non-bonded cutoff The communication cutoff is by default the largest non-bonded cutoff
plus the neighbor skin distance, but for short or non-bonded cutoffs plus the neighbor skin distance, but for short or non-bonded cutoffs
and/or long bonds, this may not be sufficient. This warning indicates and/or long bonds, this may not be sufficient. This warning indicates
@ -351,7 +351,7 @@ This will most likely cause errors in kinetic fluctuations.
Self-explanatory. Self-explanatory.
*Kspace_modify slab param < 2.0 may cause unphysical behavior* *Kspace_modify slab param < 2.0 may cause unphysical behavior*
The kspace_modify slab parameter should be larger to insure periodic The kspace_modify slab parameter should be larger to ensure periodic
grids padded with empty space do not overlap. grids padded with empty space do not overlap.
*Less insertions than requested* *Less insertions than requested*
@ -398,7 +398,7 @@ This will most likely cause errors in kinetic fluctuations.
Lost atoms are checked for each time thermo output is done. See the Lost atoms are checked for each time thermo output is done. See the
thermo_modify lost command for options. Lost atoms usually indicate thermo_modify lost command for options. Lost atoms usually indicate
bad dynamics, e.g. atoms have been blown far out of the simulation bad dynamics, e.g. atoms have been blown far out of the simulation
box, or moved further than one processor's sub-domain away before box, or moved further than one processor's subdomain away before
reneighboring. reneighboring.
*MSM mesh too small, increasing to 2 points in each direction* *MSM mesh too small, increasing to 2 points in each direction*
@ -491,7 +491,7 @@ This will most likely cause errors in kinetic fluctuations.
*Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies* *Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies*
This is because excluding specific pair interactions also excludes This is because excluding specific pair interactions also excludes
them from long-range interactions which may not be the desired effect. them from long-range interactions which may not be the desired effect.
The special_bonds command handles this consistently by insuring The special_bonds command handles this consistently by ensuring
excluded (or weighted) 1-2, 1-3, 1-4 interactions are treated excluded (or weighted) 1-2, 1-3, 1-4 interactions are treated
consistently by both the short-range pair style and the long-range consistently by both the short-range pair style and the long-range
solver. This is not done for exclusions of charged atom pairs via the solver. This is not done for exclusions of charged atom pairs via the
@ -545,7 +545,7 @@ This will most likely cause errors in kinetic fluctuations.
If there are other fixes that act immediately after the initial stage If there are other fixes that act immediately after the initial stage
of time integration within a timestep (i.e. after atoms move), then of time integration within a timestep (i.e. after atoms move), then
the command that sets up the dynamic group should appear after those the command that sets up the dynamic group should appear after those
fixes. This will insure that dynamic group assignments are made fixes. This will ensure that dynamic group assignments are made
after all atoms have moved. after all atoms have moved.
*One or more respa levels compute no forces* *One or more respa levels compute no forces*
@ -582,13 +582,13 @@ This will most likely cause errors in kinetic fluctuations.
needed. The requested volume fraction may be too high, or other atoms needed. The requested volume fraction may be too high, or other atoms
may be in the insertion region. may be in the insertion region.
*Proc sub-domain size < neighbor skin, could lead to lost atoms* *Proc subdomain size < neighbor skin, could lead to lost atoms*
The decomposition of the physical domain (likely due to load The decomposition of the physical domain (likely due to load
balancing) has led to a processor's sub-domain being smaller than the balancing) has led to a processor's subdomain being smaller than the
neighbor skin in one or more dimensions. Since reneighboring is neighbor skin in one or more dimensions. Since reneighboring is
triggered by atoms moving the skin distance, this may lead to lost triggered by atoms moving the skin distance, this may lead to lost
atoms, if an atom moves all the way across a neighboring processor's atoms, if an atom moves all the way across a neighboring processor's
sub-domain before reneighboring is triggered. subdomain before reneighboring is triggered.
*Reducing PPPM order b/c stencil extends beyond nearest neighbor processor* *Reducing PPPM order b/c stencil extends beyond nearest neighbor processor*
This may lead to a larger grid than desired. See the kspace_modify overlap This may lead to a larger grid than desired. See the kspace_modify overlap

View File

@ -1,7 +1,7 @@
Example scripts Example scripts
=============== ===============
The LAMMPS distribution includes an examples sub-directory with many The LAMMPS distribution includes an examples subdirectory with many
sample problems. Many are 2d models that run quickly and are sample problems. Many are 2d models that run quickly and are
straightforward to visualize, requiring at most a couple of minutes to straightforward to visualize, requiring at most a couple of minutes to
run on a desktop machine. Each problem has an input script (in.\*) and run on a desktop machine. Each problem has an input script (in.\*) and
@ -29,7 +29,7 @@ be quickly post-processed into a movie using commands described on the
Animations of many of the examples can be viewed on the Movies section Animations of many of the examples can be viewed on the Movies section
of the `LAMMPS website <https://www.lammps.org/movies.html>`_. of the `LAMMPS website <https://www.lammps.org/movies.html>`_.
There are two kinds of sub-directories in the examples folder. Lower There are two kinds of subdirectories in the examples folder. Lower
case named directories contain one or a few simple, quick-to-run case named directories contain one or a few simple, quick-to-run
problems. Upper case named directories contain up to several complex problems. Upper case named directories contain up to several complex
scripts that illustrate a particular kind of simulation method or scripts that illustrate a particular kind of simulation method or
@ -221,10 +221,10 @@ Uppercase directories
Nearly all of these directories have README files which give more Nearly all of these directories have README files which give more
details on how to understand and use their contents. details on how to understand and use their contents.
The PACKAGES directory has a large number of sub-directories which The PACKAGES directory has a large number of subdirectories which
correspond by name to specific packages. They contain scripts that correspond by name to specific packages. They contain scripts that
illustrate how to use the command(s) provided in those packages. Many illustrate how to use the command(s) provided in those packages. Many
of the sub-directories have their own README files which give further of the subdirectories have their own README files which give further
instructions. See the :doc:`Packages_details <Packages_details>` doc instructions. See the :doc:`Packages_details <Packages_details>` doc
page for more info on specific packages. page for more info on specific packages.

View File

@ -47,7 +47,16 @@ Fortran code in order to uses the Fortran interface.
A working example can be found together with equivalent examples in C and A working example can be found together with equivalent examples in C and
C++ in the ``examples/COUPLE/simple`` folder of the LAMMPS distribution. C++ in the ``examples/COUPLE/simple`` folder of the LAMMPS distribution.
.. versionchanged:: TBD .. admonition:: Fortran compiler compatibility
:class: note
A fully Fortran 2003 compatible Fortran compiler is required.
This means that currently only GNU Fortran 9 and later are
compatible and thus the default compilers of Red Hat or CentOS 7
and Ubuntu 18.04 LTS and not compatible. Either newer compilers
need to be installed or the Linux updated.
.. versionchanged:: 8Feb2023
.. note:: .. note::
@ -303,6 +312,12 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS.
:ftype scatter_atoms_subset: subroutine :ftype scatter_atoms_subset: subroutine
:f gather_bonds: :f:subr:`gather_bonds` :f gather_bonds: :f:subr:`gather_bonds`
:ftype gather_bonds: subroutine :ftype gather_bonds: subroutine
:f gather_angles: :f:subr:`gather_angles`
:ftype gather_angles: subroutine
:f gather_dihedrals: :f:subr:`gather_dihedrals`
:ftype gather_dihedrals: subroutine
:f gather_impropers: :f:subr:`gather_impropers`
:ftype gather_impropers: subroutine
:f gather: :f:subr:`gather` :f gather: :f:subr:`gather`
:ftype gather: subroutine :ftype gather: subroutine
:f gather_concat: :f:subr:`gather_concat` :f gather_concat: :f:subr:`gather_concat`
@ -1532,6 +1547,51 @@ Procedures Bound to the :f:type:`lammps` Derived Type
-------- --------
.. f:subroutine:: gather_angles(data)
Gather type and constituent atom information for all angles.
.. versionadded:: 8Feb2023
This function copies the list of all angles into an allocatable array.
The array will be filled with (angle type, angle atom 1, angle atom 2, angle atom 3)
for each angle. The array is allocated to the right length (i.e., four times the
number of angles). The array *data* must be of the same type as the LAMMPS
``tagint`` type, which is equivalent to either ``INTEGER(c_int)`` or
``INTEGER(c_int64_t)``, depending on whether ``-DLAMMPS_BIGBIG`` was used
when LAMMPS was built. If the supplied array does not match, an error will
result at run-time.
An example of how to use this routine is below:
.. code-block:: fortran
PROGRAM angles
USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_int
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT
USE LIBLAMMPS
IMPLICIT NONE
INTEGER(c_int), DIMENSION(:), ALLOCATABLE, TARGET :: angles
INTEGER(c_int), DIMENSION(:,:), POINTER :: angles_array
TYPE(lammps) :: lmp
INTEGER :: i
! other commands to initialize LAMMPS, create angles, etc.
CALL lmp%gather_angles(angles)
angles_array(1:4, 1:SIZE(angles)/4) => angles
DO i = 1, SIZE(angles)/4
WRITE(OUTPUT_UNIT,'(A,1X,I4,A,I4,1X,I4,1X,I4)') 'angle', angles_array(1,i), &
'; type = ', angles_array(2,i), angles_array(3,i), angles_array(4,i)
END DO
END PROGRAM angles
:p data: array into which to copy the result. \*The ``KIND`` parameter is
either ``c_int`` or, if LAMMPS was compiled with ``-DLAMMPS_BIGBIG``,
kind ``c_int64_t``.
:ptype data: integer(kind=\*),allocatable
:to: :cpp:func:`lammps_gather_angles`
--------
.. f:subroutine:: gather(self, name, count, data) .. f:subroutine:: gather(self, name, count, data)
Gather the named per-atom, per-atom fix, per-atom compute, or fix Gather the named per-atom, per-atom fix, per-atom compute, or fix
@ -1574,6 +1634,98 @@ Procedures Bound to the :f:type:`lammps` Derived Type
-------- --------
.. f:subroutine:: gather_dihedrals(data)
Gather type and constituent atom information for all dihedrals.
.. versionadded:: 8Feb2023
This function copies the list of all dihedrals into an allocatable array.
The array will be filled with (dihedral type, dihedral atom 1, dihedral atom 2,
dihedral atom 3, dihedral atom 4) for each dihedral. The array is allocated to
the right length (i.e., five times the number of dihedrals).
The array *data* must be of the same type as the LAMMPS
``tagint`` type, which is equivalent to either ``INTEGER(c_int)`` or
``INTEGER(c_int64_t)``, depending on whether ``-DLAMMPS_BIGBIG`` was used
when LAMMPS was built. If the supplied array does not match, an error will
result at run-time.
An example of how to use this routine is below:
.. code-block:: fortran
PROGRAM dihedrals
USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_int
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT
USE LIBLAMMPS
IMPLICIT NONE
INTEGER(c_int), DIMENSION(:), ALLOCATABLE, TARGET :: dihedrals
INTEGER(c_int), DIMENSION(:,:), POINTER :: dihedrals_array
TYPE(lammps) :: lmp
INTEGER :: i
! other commands to initialize LAMMPS, create dihedrals, etc.
CALL lmp%gather_dihedrals(dihedrals)
dihedrals_array(1:5, 1:SIZE(dihedrals)/5) => dihedrals
DO i = 1, SIZE(dihedrals)/5
WRITE(OUTPUT_UNIT,'(A,1X,I4,A,I4,1X,I4,1X,I4,1X,I4)') 'dihedral', dihedrals_array(1,i), &
'; type = ', dihedrals_array(2,i), dihedrals_array(3,i), dihedrals_array(4,i), dihedrals_array(5,i)
END DO
END PROGRAM dihedrals
:p data: array into which to copy the result. \*The ``KIND`` parameter is
either ``c_int`` or, if LAMMPS was compiled with ``-DLAMMPS_BIGBIG``,
kind ``c_int64_t``.
:ptype data: integer(kind=\*),allocatable
:to: :cpp:func:`lammps_gather_dihedrals`
--------
.. f:subroutine:: gather_impropers(data)
Gather type and constituent atom information for all impropers.
.. versionadded:: 8Feb2023
This function copies the list of all impropers into an allocatable array.
The array will be filled with (improper type, improper atom 1, improper atom 2,
improper atom 3, improper atom 4) for each improper. The array is allocated to
the right length (i.e., five times the number of impropers).
The array *data* must be of the same type as the LAMMPS
``tagint`` type, which is equivalent to either ``INTEGER(c_int)`` or
``INTEGER(c_int64_t)``, depending on whether ``-DLAMMPS_BIGBIG`` was used
when LAMMPS was built. If the supplied array does not match, an error will
result at run-time.
An example of how to use this routine is below:
.. code-block:: fortran
PROGRAM impropers
USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_int
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT
USE LIBLAMMPS
IMPLICIT NONE
INTEGER(c_int), DIMENSION(:), ALLOCATABLE, TARGET :: impropers
INTEGER(c_int), DIMENSION(:,:), POINTER :: impropers_array
TYPE(lammps) :: lmp
INTEGER :: i
! other commands to initialize LAMMPS, create impropers, etc.
CALL lmp%gather_impropers(impropers)
impropers_array(1:5, 1:SIZE(impropers)/5) => impropers
DO i = 1, SIZE(impropers)/5
WRITE(OUTPUT_UNIT,'(A,1X,I4,A,I4,1X,I4,1X,I4,1X,I4)') 'improper', impropers_array(1,i), &
'; type = ', impropers_array(2,i), impropers_array(3,i), impropers_array(4,i), impropers_array(5,i)
END DO
END PROGRAM impropers
:p data: array into which to copy the result. \*The ``KIND`` parameter is
either ``c_int`` or, if LAMMPS was compiled with ``-DLAMMPS_BIGBIG``,
kind ``c_int64_t``.
:ptype data: integer(kind=\*),allocatable
:to: :cpp:func:`lammps_gather_impropers`
--------
.. f:subroutine:: gather_concat(self, name, count, data) .. f:subroutine:: gather_concat(self, name, count, data)
Gather the named per-atom, per-atom fix, per-atom compute, or fix Gather the named per-atom, per-atom fix, per-atom compute, or fix
@ -2003,7 +2155,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
The LAMMPS :doc:`dump style movie <dump_image>` supports generating movies The LAMMPS :doc:`dump style movie <dump_image>` supports generating movies
from images on-the-fly via creating a pipe to the from images on-the-fly via creating a pipe to the
`ffmpeg <https://ffmpeg.org/ffmpeg/>`_ program. `ffmpeg <https://ffmpeg.org/>`_ program.
This function checks whether this feature was This function checks whether this feature was
:ref:`enabled at compile time <graphics>`. :ref:`enabled at compile time <graphics>`.
It does **not** check whether the ``ffmpeg`` itself is installed and usable. It does **not** check whether the ``ffmpeg`` itself is installed and usable.

View File

@ -4,9 +4,9 @@ Howto discussions
These doc pages describe how to perform various tasks with LAMMPS, These doc pages describe how to perform various tasks with LAMMPS,
both for users and developers. The both for users and developers. The
`glossary <https://www.lammps.org/glossary.html>`_ website page also lists MD `glossary <https://www.lammps.org/glossary.html>`_ website page also lists MD
terminology with links to corresponding LAMMPS manual pages. The terminology, with links to corresponding LAMMPS manual pages. The
example input scripts included in the examples directory of the LAMMPS example input scripts included in the ``examples`` directory of the LAMMPS
distribution and highlighted on the :doc:`Examples <Examples>` doc page source code distribution and highlighted on the :doc:`Examples` page
also show how to set up and run various kinds of simulations. also show how to set up and run various kinds of simulations.
General howto General howto
@ -70,6 +70,7 @@ Force fields howto
Howto_amoeba Howto_amoeba
Howto_tip3p Howto_tip3p
Howto_tip4p Howto_tip4p
Howto_tip5p
Howto_spc Howto_spc
Packages howto Packages howto

View File

@ -22,7 +22,7 @@ atom in the file, assign a z coordinate so it falls inside the
z-boundaries of the box - e.g. 0.0. z-boundaries of the box - e.g. 0.0.
Use the :doc:`fix enforce2d <fix_enforce2d>` command as the last Use the :doc:`fix enforce2d <fix_enforce2d>` command as the last
defined fix to insure that the z-components of velocities and forces defined fix to ensure that the z-components of velocities and forces
are zeroed out every timestep. The reason to make it the last fix is are zeroed out every timestep. The reason to make it the last fix is
so that any forces induced by other fixes will be zeroed out. so that any forces induced by other fixes will be zeroed out.

View File

@ -3,16 +3,16 @@ Bonded particle models
The BPM package implements bonded particle models which can be used to The BPM package implements bonded particle models which can be used to
simulate mesoscale solids. Solids are constructed as a collection of simulate mesoscale solids. Solids are constructed as a collection of
particles which each represent a coarse-grained region of space much particles, which each represent a coarse-grained region of space much
larger than the atomistic scale. Particles within a solid region are larger than the atomistic scale. Particles within a solid region are
then connected by a network of bonds to provide solid elasticity. then connected by a network of bonds to provide solid elasticity.
Unlike traditional bonds in molecular dynamics, the equilibrium bond Unlike traditional bonds in molecular dynamics, the equilibrium bond
length can vary between bonds. Bonds store the reference state. This length can vary between bonds. Bonds store the reference state. This
includes setting the equilibrium length equal to the initial distance includes setting the equilibrium length equal to the initial distance
between the two particles but can also include data on the bond between the two particles, but can also include data on the bond
orientation for rotational models. This produces a stress free initial orientation for rotational models. This produces a stress-free initial
state. Furthermore, bonds are allowed to break under large strains state. Furthermore, bonds are allowed to break under large strains,
producing fracture. The examples/bpm directory has sample input scripts producing fracture. The examples/bpm directory has sample input scripts
for simulations of the fragmentation of an impacted plate and the for simulations of the fragmentation of an impacted plate and the
pouring of extended, elastic bodies. pouring of extended, elastic bodies.
@ -22,8 +22,8 @@ pouring of extended, elastic bodies.
Bonds can be created using a :doc:`read data <read_data>` or Bonds can be created using a :doc:`read data <read_data>` or
:doc:`create bonds <create_bonds>` command. Alternatively, a :doc:`create bonds <create_bonds>` command. Alternatively, a
:doc:`molecule <molecule>` template with bonds can be used with :doc:`molecule <molecule>` template with bonds can be used with
:doc:`fix deposit <fix_deposit>` or :doc:`fix pour <fix_pour>` to :doc:`fix deposit <fix_deposit>` or :doc:`fix pour <fix_pour>` to create
create solid grains. solid grains.
In this implementation, bonds store their reference state when they are In this implementation, bonds store their reference state when they are
first computed in the setup of the first simulation run. Data is then first computed in the setup of the first simulation run. Data is then
@ -35,21 +35,20 @@ such as those created by pouring grains using :doc:`fix pour
---------- ----------
Currently there are two types of bonds included in the BPM Currently, there are two types of bonds included in the BPM package. The
package. The first bond style, :doc:`bond bpm/spring first bond style, :doc:`bond bpm/spring <bond_bpm_spring>`, only applies
<bond_bpm_spring>`, only applies pairwise, central body forces. Point pairwise, central body forces. Point particles must have :doc:`bond atom
particles must have :doc:`bond atom style <atom_style>` and may be style <atom_style>` and may be thought of as nodes in a spring
thought of as nodes in a spring network. Alternatively, the second network. Alternatively, the second bond style, :doc:`bond bpm/rotational
bond style, :doc:`bond bpm/rotational <bond_bpm_rotational>`, resolves <bond_bpm_rotational>`, resolves tangential forces and torques arising
tangential forces and torques arising with the shearing, bending, and with the shearing, bending, and twisting of the bond due to rotation or
twisting of the bond due to rotation or displacement of particles. displacement of particles. Particles are similar to those used in the
Particles are similar to those used in the :doc:`granular package :doc:`granular package <Howto_granular>`, :doc:`atom style sphere
<Howto_granular>`, :doc:`atom style sphere <atom_style>`. However, <atom_style>`. However, they must also track the current orientation of
they must also track the current orientation of particles and store bonds particles and store bonds, and therefore use a :doc:`bpm/sphere atom
and therefore use a :doc:`bpm/sphere atom style <atom_style>`. style <atom_style>`. This also requires a unique integrator :doc:`fix
This also requires a unique integrator :doc:`fix nve/bpm/sphere nve/bpm/sphere <fix_nve_bpm_sphere>` which numerically integrates
<fix_nve_bpm_sphere>` which numerically integrates orientation similar orientation similar to :doc:`fix nve/asphere <fix_nve_asphere>`.
to :doc:`fix nve/asphere <fix_nve_asphere>`.
In addition to bond styles, a new pair style :doc:`pair bpm/spring In addition to bond styles, a new pair style :doc:`pair bpm/spring
<pair_bpm_spring>` was added to accompany the bpm/spring bond <pair_bpm_spring>` was added to accompany the bpm/spring bond
@ -63,7 +62,7 @@ A list of IDs for bonded atoms can be generated using the
:doc:`compute property/local <compute_property_local>` command. :doc:`compute property/local <compute_property_local>` command.
Various properties of bonds can be computed using the Various properties of bonds can be computed using the
:doc:`compute bond/local <compute_bond_local>` command. This :doc:`compute bond/local <compute_bond_local>` command. This
command allows one to access data saved to the bond's history command allows one to access data saved to the bond's history,
such as the reference length of the bond. More information on such as the reference length of the bond. More information on
bond history data can be found on the documentation pages for the specific bond history data can be found on the documentation pages for the specific
BPM bond styles. Finally, this data can be output using a :doc:`dump local <dump>` BPM bond styles. Finally, this data can be output using a :doc:`dump local <dump>`
@ -90,7 +89,7 @@ bond settings
Alternatively, one can turn off all pair interactions between bonded Alternatively, one can turn off all pair interactions between bonded
particles. Unlike :doc:`bond quartic <bond_quartic>`, this is not done particles. Unlike :doc:`bond quartic <bond_quartic>`, this is not done
by subtracting pair forces during the bond computation but rather by by subtracting pair forces during the bond computation, but rather by
dynamically updating the special bond list. This is the default behavior dynamically updating the special bond list. This is the default behavior
of BPM bond styles and is done by updating the 1-2 special bond list as of BPM bond styles and is done by updating the 1-2 special bond list as
bonds break. To do this, LAMMPS requires :doc:`newton <newton>` bond off bonds break. To do this, LAMMPS requires :doc:`newton <newton>` bond off
@ -134,7 +133,10 @@ the following are currently compatible with BPM bond styles:
* :doc:`fix bond/break <fix_bond_break>` * :doc:`fix bond/break <fix_bond_break>`
* :doc:`fix bond/swap <fix_bond_swap>` * :doc:`fix bond/swap <fix_bond_swap>`
Note :doc:`create_bonds <create_bonds>` requires certain special_bonds settings. .. note::
To subtract pair interactions, one will need to switch between different
special_bonds settings in the input script. An example is found in The :doc:`create_bonds <create_bonds>` command requires certain
examples/bpm/impact. :doc:`special_bonds <special_bonds>` settings. To subtract pair
interactions, one will need to switch between different *special_bonds*
settings in the input script. An example is found in
``examples/bpm/impact``.

View File

@ -1,15 +1,15 @@
Broken Bonds Broken Bonds
============ ============
Typically, bond interactions persist for the duration of a simulation Typically, bond interactions persist for the duration of a simulation in
in LAMMPS. However, there are some exceptions that allow for bonds to LAMMPS. However, there are some exceptions that allow for bonds to
break including the :doc:`quartic bond style <bond_quartic>` and the break, including the :doc:`quartic bond style <bond_quartic>` and the
bond styles in the :doc:`BPM package <Howto_bpm>` which contains the bond styles in the :doc:`BPM package <Howto_bpm>` which contains the
:doc:`bpm/spring <bond_bpm_spring>` and :doc:`bpm/spring <bond_bpm_spring>` and :doc:`bpm/rotational
:doc:`bpm/rotational <bond_bpm_rotational>` bond styles. In these cases, <bond_bpm_rotational>` bond styles. In these cases, a bond can be broken
a bond can be broken if it is stretched beyond a user-defined threshold. if it is stretched beyond a user-defined threshold. LAMMPS accomplishes
LAMMPS accomplishes this by setting the bond type to zero such that the this by setting the bond type to 0, such that the bond force is no
bond force is no longer computed. longer computed.
Users are normally able to weight the contribution of pair forces to atoms Users are normally able to weight the contribution of pair forces to atoms
that are bonded using the :doc:`special_bonds command <special_bonds>`. that are bonded using the :doc:`special_bonds command <special_bonds>`.

View File

@ -89,7 +89,7 @@ different options (``build-parallel``, ``build-serial``) or with
different compilers (``build-gnu``, ``build-clang``, ``build-intel``) different compilers (``build-gnu``, ``build-clang``, ``build-intel``)
and so on. All the auxiliary files created by one build process and so on. All the auxiliary files created by one build process
(executable, object files, log files, etc) are stored in this directory (executable, object files, log files, etc) are stored in this directory
or sub-directories within it that CMake creates. or subdirectories within it that CMake creates.
Running CMake Running CMake

View File

@ -111,7 +111,7 @@ Therefore it is typically desirable to decouple the relative motion of
the core/shell pair, which is an imaginary degree of freedom, from the the core/shell pair, which is an imaginary degree of freedom, from the
real physical system. To do that, the :doc:`compute temp/cs <compute_temp_cs>` command can be used, in conjunction with real physical system. To do that, the :doc:`compute temp/cs <compute_temp_cs>` command can be used, in conjunction with
any of the thermostat fixes, such as :doc:`fix nvt <fix_nh>` or :doc:`fix langevin <fix_langevin>`. This compute uses the center-of-mass velocity any of the thermostat fixes, such as :doc:`fix nvt <fix_nh>` or :doc:`fix langevin <fix_langevin>`. This compute uses the center-of-mass velocity
of the core/shell pairs to calculate a temperature, and insures that of the core/shell pairs to calculate a temperature, and ensures that
velocity is what is rescaled for thermostatting purposes. This velocity is what is rescaled for thermostatting purposes. This
compute also works for a system with both core/shell pairs and compute also works for a system with both core/shell pairs and
non-polarized ions (ions without an attached satellite particle). The non-polarized ions (ions without an attached satellite particle). The

View File

@ -1,27 +1,27 @@
Coupling LAMMPS to other codes Coupling LAMMPS to other codes
============================== ==============================
LAMMPS is designed to allow it to be coupled to other codes. For LAMMPS is designed to support being coupled to other codes. For
example, a quantum mechanics code might compute forces on a subset of example, a quantum mechanics code might compute forces on a subset of
atoms and pass those forces to LAMMPS. Or a continuum finite element atoms and pass those forces to LAMMPS. Or a continuum finite element
(FE) simulation might use atom positions as boundary conditions on FE (FE) simulation might use atom positions as boundary conditions on FE
nodal points, compute a FE solution, and return interpolated forces on nodal points, compute a FE solution, and return interpolated forces on
MD atoms. MD atoms.
LAMMPS can be coupled to other codes in at least 4 ways. Each has LAMMPS can be coupled to other codes in at least 4 different ways. Each
advantages and disadvantages, which you will have to think about in the has advantages and disadvantages, which you will have to think about in
context of your application. the context of your application.
1. Define a new :doc:`fix <fix>` command that calls the other code. 1. Define a new :doc:`fix <fix>` command that calls the other code. In
In this scenario, LAMMPS is the driver code. During timestepping, this scenario, LAMMPS is the driver code. During timestepping, the
the fix is invoked, and can make library calls to the other code, fix is invoked, and can make library calls to the other code, which
which has been linked to LAMMPS as a library. This is the way the has been linked to LAMMPS as a library. This is the way the
:ref:`LATTE <PKG-LATTE>` package, which performs density-functional :ref:`LATTE <PKG-LATTE>` package, which performs density-functional
tight-binding calculations using the `LATTE software tight-binding calculations using the `LATTE software
<https://github.com/lanl/LATTE>`_ to compute forces, is hooked to <https://github.com/lanl/LATTE>`_ to compute forces, is interfaced to
LAMMPS. See the :doc:`fix latte <fix_latte>` command for more LAMMPS. See the :doc:`fix latte <fix_latte>` command for more
details. Also see the :doc:`Modify <Modify>` doc pages for info on details. Also see the :doc:`Modify <Modify>` pages for information
how to add a new fix to LAMMPS. on how to add a new fix to LAMMPS.
.. spacer .. spacer
@ -42,28 +42,26 @@ context of your application.
stand-alone code could communicate with LAMMPS through files that the stand-alone code could communicate with LAMMPS through files that the
command writes and reads. command writes and reads.
See the :doc:`Modify command <Modify_command>` page for info on how See the :doc:`Modify command <Modify_command>` page for information
to add a new command to LAMMPS. on how to add a new command to LAMMPS.
.. spacer .. spacer
3. Use LAMMPS as a library called by another code. In this case the 3. Use LAMMPS as a library called by another code. In this case, the
other code is the driver and calls LAMMPS as needed. Or a wrapper other code is the driver and calls LAMMPS as needed. Alternately, a
code could link and call both LAMMPS and another code as libraries. wrapper code could link and call both LAMMPS and another code as
Again, the :doc:`run <run>` command has options that allow it to be libraries. Again, the :doc:`run <run>` command has options that
invoked with minimal overhead (no setup or clean-up) if you wish to allow it to be invoked with minimal overhead (no setup or clean-up)
do multiple short runs, driven by another program. Details about if you wish to do multiple short runs, driven by another program.
using the library interface are given in the :doc:`library API Details about using the library interface are given in the
<Library>` documentation. :doc:`library API <Library>` documentation.
.. spacer .. spacer
4. Couple LAMMPS with another code in a client/server fashion, using 4. Couple LAMMPS with another code in a client/server fashion, using the
using the `MDI Library `MDI Library <https://molssi-mdi.github.io/MDI_Library/html/index.html>`_
<https://molssi-mdi.github.io/MDI_Library/html/index.html>`_
developed by the `Molecular Sciences Software Institute (MolSSI) developed by the `Molecular Sciences Software Institute (MolSSI)
<https://molssi.org>`_ to run LAMMPS as either an MDI driver <https://molssi.org>`_ to run LAMMPS as either an MDI driver (client)
(client) or an MDI engine (server). The MDI driver issues commands or an MDI engine (server). The MDI driver issues commands to the MDI
to the MDI server to exchange data between them. See the server to exchange data between them. See the :doc:`Howto_mdi` page for
:doc:`Howto mdi <Howto_mdi>` page for more information about how more information about how LAMMPS can operate in either of these modes.
LAMMPS can operate in either of these modes.

View File

@ -315,7 +315,7 @@ add changes. Please watch the comments to the pull requests. The two
"test" labels are used to trigger extended tests before the code is "test" labels are used to trigger extended tests before the code is
merged. This is sometimes done by LAMMPS developers, if they suspect merged. This is sometimes done by LAMMPS developers, if they suspect
that there may be some subtle side effects from your changes. It is not that there may be some subtle side effects from your changes. It is not
done by default, because those tests are very time consuming. The done by default, because those tests are very time-consuming. The
*ready_for_merge* label is usually attached when the LAMMPS developer *ready_for_merge* label is usually attached when the LAMMPS developer
assigned to the pull request considers this request complete and to assigned to the pull request considers this request complete and to
trigger a final full test evaluation. trigger a final full test evaluation.
@ -476,16 +476,25 @@ to your remote(s) as well:
**Recent changes in the workflow** **Recent changes in the workflow**
Some changes to the workflow are not captured in this tutorial. For Some recent changes to the workflow are not captured in this tutorial.
example, in addition to the *develop* branch, to which all new features For example, in addition to the *develop* branch, to which all new
should be submitted, there is also a *release* and a *stable* branch; features should be submitted, there is also a *release*, a *stable*, and
these have the same content as *develop*, but are only updated after a a *maintenance* branch; the *release* branch is updated from the
patch release or stable release was made. Furthermore, the naming of *develop* as part of a feature release, and *stable* (together with
the patches now follow the pattern "patch_<Day><Month><Year>" to *release*) are updated from *develop* when a stable release is made. In
simplify comparisons between releases. Finally, all patches and between stable releases, selected bug fixes and infrastructure updates
submissions are subject to automatic testing and code checks to make are back-ported from the *develop* branch to the *maintenance* branch
sure they at the very least compile. and occasionally merged to *stable* as an update release.
A discussion of the LAMMPS developer GitHub workflow can be found in the Furthermore, the naming of the release tags now follow the pattern
file `doc/github-development-workflow.md "patch_<Day><Month><Year>" to simplify comparisons between releases.
For stable releases additional "stable_<Day><Month><Year>" tags are
applied and update releases are tagged with
"stable_<Day><Month><Year>_update<Number>", Finally, all releases and
submissions are subject to automatic testing and code checks to make
sure they compile with a variety of compilers and popular operating
systems. Some unit and regression testing is applied as well.
A detailed discussion of the LAMMPS developer GitHub workflow can be
found in the file `doc/github-development-workflow.md
<https://github.com/lammps/lammps/blob/develop/doc/github-development-workflow.md>`_ <https://github.com/lammps/lammps/blob/develop/doc/github-development-workflow.md>`_

View File

@ -11,7 +11,7 @@ more values (data).
The grid cells and data they store are distributed across processors. The grid cells and data they store are distributed across processors.
Each processor owns the grid cells (and data) whose center points lie Each processor owns the grid cells (and data) whose center points lie
within the spatial sub-domain of the processor. If needed for its within the spatial subdomain of the processor. If needed for its
computations, a processor may also store ghost grid cells with their computations, a processor may also store ghost grid cells with their
data. data.
@ -28,7 +28,7 @@ box size, as set by the :doc:`boundary <boundary>` command for fixed
or shrink-wrapped boundaries. or shrink-wrapped boundaries.
If load-balancing is invoked by the :doc:`balance <balance>` or If load-balancing is invoked by the :doc:`balance <balance>` or
:doc:`fix balance <fix_balance>` commands, then the sub-domain owned :doc:`fix balance <fix_balance>` commands, then the subdomain owned
by a processor can change which may also change which grid cells they by a processor can change which may also change which grid cells they
own. own.

View File

@ -6,22 +6,22 @@ can be built as a static or shared library, so that it can be called by
another code, used in a :doc:`coupled manner <Howto_couple>` with other another code, used in a :doc:`coupled manner <Howto_couple>` with other
codes, or driven through a :doc:`Python interface <Python_head>`. codes, or driven through a :doc:`Python interface <Python_head>`.
At the core of LAMMPS is the ``LAMMPS`` class which encapsulates the At the core of LAMMPS is the ``LAMMPS`` class, which encapsulates the
state of the simulation program through the state of the various class state of the simulation program through the state of the various class
instances that it is composed of. So a calculation using LAMMPS instances that it is composed of. So a calculation using LAMMPS
requires to create an instance of the ``LAMMPS`` class and then send it requires creating an instance of the ``LAMMPS`` class and then send it
(text) commands, either individually or from a file, or perform other (text) commands, either individually or from a file, or perform other
operations that modify the state stored inside that instance or drive operations that modify the state stored inside that instance or drive
simulations. This is essentially what the ``src/main.cpp`` file does simulations. This is essentially what the ``src/main.cpp`` file does as
as well for the standalone LAMMPS executable with reading commands well for the standalone LAMMPS executable, reading commands either from
either from an input file or stdin. an input file or the standard input.
Creating a LAMMPS instance can be done by using C++ code directly or Creating a LAMMPS instance can be done by using C++ code directly or
through a C-style interface library to LAMMPS that is provided in the through a C-style interface library to LAMMPS that is provided in the
files ``src/library.cpp`` and ``library.h``. This files ``src/library.cpp`` and ``src/library.h``. This :ref:`C language
:ref:`C language API <lammps_c_api>`, can be used from C and C++, API <lammps_c_api>`, can be used from C and C++, and is also the basis
and is also the basis for the :doc:`Python <Python_module>` and for the :doc:`Python <Python_module>` and :doc:`Fortran <Fortran>`
:doc:`Fortran <Fortran>` interfaces or wrappers included in the interfaces or the :ref:`SWIG based wrappers <swig>` included in the
LAMMPS source code. LAMMPS source code.
The ``examples/COUPLE`` and ``python/examples`` directories contain some The ``examples/COUPLE`` and ``python/examples`` directories contain some

View File

@ -12,11 +12,11 @@ developed by the `Molecular Sciences Software Institute (MolSSI)
<https://molssi.org>`_, which is supported by the :ref:`MDI <PKG-MDI>` <https://molssi.org>`_, which is supported by the :ref:`MDI <PKG-MDI>`
package. package.
Alternate methods for code coupling with LAMMPS are described on the Alternate methods for coupling codes with LAMMPS are described on the
:doc:`Howto couple <Howto_couple>` doc page. :doc:`Howto_couple` page.
Some advantages of client/server coupling are that the codes can run Some advantages of client/server coupling are that the codes can run
as stand-alone executables; they need not be linked together. Thus as stand-alone executables; they need not be linked together. Thus,
neither code needs to have a library interface. This also makes it neither code needs to have a library interface. This also makes it
easy to run the two codes on different numbers of processors. If a easy to run the two codes on different numbers of processors. If a
message protocol (format and content) is defined for a particular kind message protocol (format and content) is defined for a particular kind
@ -41,7 +41,7 @@ within that sub-communicator exchange messages with the corresponding
engine instance, and can also send MPI messages to other processors in engine instance, and can also send MPI messages to other processors in
the driver. The driver code can also destroy engine instances and the driver. The driver code can also destroy engine instances and
re-instantiate them. LAMMPS can operate as either a stand-alone or re-instantiate them. LAMMPS can operate as either a stand-alone or
plugin MDI engine. When it operates as a driver, if can use either plugin MDI engine. When it operates as a driver, it can use either
stand-alone or plugin MDI engines. stand-alone or plugin MDI engines.
The way in which an MDI driver communicates with an MDI engine is by The way in which an MDI driver communicates with an MDI engine is by
@ -50,83 +50,83 @@ to MPI_Send() and MPI_Recv() calls. Each send or receive operation
uses a string to identify the command name, and optionally some data, uses a string to identify the command name, and optionally some data,
which can be a single value or vector of values of any data type. which can be a single value or vector of values of any data type.
Inside the MDI library, data is exchanged between the driver and Inside the MDI library, data is exchanged between the driver and
engine via MPI calls or sockets. This a run-time choice by the user. engine via MPI calls or sockets. This is a run-time choice by the user.
---------- ----------
The :ref:`MDI <PKG-MDI>` package provides a :doc:`mdi engine <mdi>` The :ref:`MDI <PKG-MDI>` package provides a :doc:`mdi engine <mdi>`
command which enables LAMMPS to operate as an MDI engine. Its doc command, which enables LAMMPS to operate as an MDI engine. Its doc
page explains the variety of standard and custom MDI commands which page explains the variety of standard and custom MDI commands which
the LAMMPS engine recognizes and can respond to. the LAMMPS engine recognizes and can respond to.
The package also provides a :doc:`mdi plugin <mdi>` command which The package also provides a :doc:`mdi plugin <mdi>` command, which
enables LAMMPS to operate as an MDI driver and load an MDI engine as a enables LAMMPS to operate as an MDI driver and load an MDI engine as a
plugin library. plugin library.
The package also has a `fix mdi/qm <fix_mdi_qm>` command in which The package furthermore includes a :doc:`fix mdi/qm <fix_mdi_qm>`
LAMMPS operates as an MDI driver in conjunction with a quantum command, in which LAMMPS operates as an MDI driver in conjunction with a
mechanics code as an MDI engine. The post_force() method of the quantum mechanics code as an MDI engine. The post_force() method of the
fix_mdi_qm.cpp file shows how a driver issues MDI commands to another ``fix_mdi_qm.cpp`` file shows how a driver issues MDI commands to
code. This command can be used to couple to an MDI engine which is another code. This command can be used to couple to an MDI engine,
either a stand-alone code or a plugin library. which is either a stand-alone code or a plugin library.
As explained on the `fix mdi/qm <fix_mdi_qm>` command doc page, it can As explained in the :doc:`fix mdi/qm <fix_mdi_qm>` command
be used to perform *ab initio* MD simulations or energy minimizations, documentation, it can be used to perform *ab initio* MD simulations or
or to evaluate the quantum energy and forces for a series of energy minimizations, or to evaluate the quantum energy and forces for a
independent systems. The examples/mdi directory has example input series of independent systems. The ``examples/mdi`` directory has
scripts for all of these use cases. example input scripts for all of these use cases.
---------- ----------
The examples/mdi directory contains Python scripts and LAMMPS input The examples/mdi directory contains Python scripts and LAMMPS input
script which use LAMMPS as either an MDI driver or engine or both. script which use LAMMPS as either an MDI driver or engine, or both.
Currently, 5 example use cases are provided: Currently, 5 example use cases are provided:
* Run ab initio MD (AIMD) using 2 instances of LAMMPS. As a driver * Run ab initio MD (AIMD) using 2 instances of LAMMPS. As a driver,
LAMMPS performs the timestepping in either NVE or NPT mode. As an LAMMPS performs the timestepping in either NVE or NPT mode. As an
engine, LAMMPS computes forces and is a surrogate for a quantum engine, LAMMPS computes forces and is a surrogate for a quantum
code. code.
* As a driver, LAMMPS runs an MD simulation. Every N steps it passes * LAMMPS runs an MD simulation as a driver. Every N steps it passes the
the current snapshot to an MDI engine to evaluate the energy, current snapshot to an MDI engine to evaluate the energy, virial, and
virial, and peratom forces. As the engine LAMMPS is a surrogate for peratom forces. As the engine, LAMMPS is a surrogate for a quantum
a quantum code.
* As a driver, LAMMPS loops over a series of data files and passes the
configuration to an MDI engine to evaluate the energy, virial, and
peratom forces. As the engine LAMMPS is a surrogate for a quantum
code. code.
* LAMMPS loops over a series of data files and passes the configuration
to an MDI engine to evaluate the energy, virial, and peratom forces
and thus acts as a simulation driver. As the engine, LAMMPS is used
as a surrogate for a quantum code.
* A Python script driver invokes a sequence of unrelated LAMMPS * A Python script driver invokes a sequence of unrelated LAMMPS
calculations. Calculations can be single-point energy/force calculations. Calculations can be single-point energy/force
evaluations, MD runs, or energy minimizations. evaluations, MD runs, or energy minimizations.
* Run AIMD with a Python driver code and 2 LAMMPS instances as * Run AIMD with a Python driver code and 2 LAMMPS instances as engines.
engines. The first LAMMPS instance performs MD timestepping. The The first LAMMPS instance performs MD timestepping. The second LAMMPS
second LAMMPS instance acts as a surrogate QM code to compute instance acts as a surrogate QM code to compute forces.
forces.
Note that in any of these example where LAMMPS is used as an engine, .. note::
an actual QM code (which supports MDI) could be used in its place,
In any of these examples where LAMMPS is used as an engine, an actual
QM code (provided it has support for MDI) could be used in its place,
without modifying the input scripts or launch commands, except to without modifying the input scripts or launch commands, except to
specify the name of the QM code. specify the name of the QM code.
The examples/mdi/Run.sh file illustrates how to launch both driver and The ``examples/mdi/Run.sh`` file illustrates how to launch both driver
engine codes so that they communicate using the MDI library via either and engine codes so that they communicate using the MDI library via
MPI or sockets. Or using the engine as a stand-alone code or plugin either MPI or sockets, or using the engine as a stand-alone code, or
library. as a plugin library.
------------- -------------
Currently there are at least two quantum DFT codes which have direct Currently, there are at least two quantum DFT codes which have direct MDI
MDI support, `Quantum ESPRESSO (QE) support, `Quantum ESPRESSO (QE) <https://www.quantum-espresso.org/>`_
<https://www.quantum-espresso.org/>`_ and `INQ and `INQ <https://qsg.llnl.gov/node/101.html>`_. There are also several
<https://qsg.llnl.gov/node/101.html>`_. There are also several QM QM codes which have indirect support through QCEngine or i-PI. The
codes which have indirect support through QCEngine or i-PI. The former means they require a wrapper program (QCEngine) with MDI support
former means they require a wrapper program (QCEngine) with MDI which writes/read files to pass data to the quantum code itself. The
support which writes/read files to pass data to the quantum code list of QCEngine-supported and i-PI-supported quantum codes is on the
itself. The list of QCEngine-supported and i-PI-supported quantum `MDI webpage
codes is on the `MDI webpage
<https://molssi-mdi.github.io/MDI_Library/html/index.html>`_. <https://molssi-mdi.github.io/MDI_Library/html/index.html>`_.
Here is how to build QE as a stand-alone ``pw.x`` file which can be Here is how to build QE as a stand-alone ``pw.x`` file which can be
@ -138,7 +138,7 @@ used in stand-alone mode:
build the executable pw.x, following the `QE build guide <https://gitlab.com/QEF/q-e/-/wikis/Developers/CMake-build-system>`_ build the executable pw.x, following the `QE build guide <https://gitlab.com/QEF/q-e/-/wikis/Developers/CMake-build-system>`_
Here is how to build QE as a shared library which can be used in plugin mode, Here is how to build QE as a shared library which can be used in plugin mode,
which results in a libqemdi.so file in <base_path>/q-e/MDI/src: which results in a ``libqemdi.so`` file in ``<base_path>/q-e/MDI/src``:
.. code-block:: bash .. code-block:: bash
@ -149,8 +149,8 @@ which results in a libqemdi.so file in <base_path>/q-e/MDI/src:
INQ cannot be built as a stand-alone code; it is by design a library. INQ cannot be built as a stand-alone code; it is by design a library.
Here is how to build INQ as a shared library which can be used in Here is how to build INQ as a shared library which can be used in
plugin mode, which results in a libinqmdi.so file in plugin mode, which results in a ``libinqmdi.so`` file in
<base_path>/inq/build/examples: ``<base_path>/inq/build/examples``:
.. code-block:: bash .. code-block:: bash

View File

@ -4,7 +4,7 @@ Run multiple simulations from one input script
This can be done in several ways. See the documentation for This can be done in several ways. See the documentation for
individual commands for more details on how these examples work. individual commands for more details on how these examples work.
If "multiple simulations" means continue a previous simulation for If "multiple simulations" means to continue a previous simulation for
more timesteps, then you simply use the :doc:`run <run>` command more timesteps, then you simply use the :doc:`run <run>` command
multiple times. For example, this script multiple times. For example, this script

View File

@ -26,7 +26,7 @@ discussion, note that users can also :doc:`add their own computes and
fixes to LAMMPS <Modify>` which can then generate values that can then fixes to LAMMPS <Modify>` which can then generate values that can then
be output with these commands. be output with these commands.
The following sub-sections discuss different LAMMPS commands related The following subsections discuss different LAMMPS commands related
to output and the kind of data they operate on and produce: to output and the kind of data they operate on and produce:
* :ref:`Global/per-atom/local/per-grid data <global>` * :ref:`Global/per-atom/local/per-grid data <global>`
@ -59,7 +59,7 @@ of bond distances.
A per-grid datum is one or more values per grid cell, for a grid which A per-grid datum is one or more values per grid cell, for a grid which
overlays the simulation domain. The grid cells and the data they overlays the simulation domain. The grid cells and the data they
store are distributed across processors; each processor owns the grid store are distributed across processors; each processor owns the grid
cells whose center point falls within its sub-domain. cells whose center point falls within its subdomain.
.. _scalar: .. _scalar:
@ -322,7 +322,7 @@ The chief difference between the :doc:`fix ave/grid <fix_ave_grid>`
and :doc:`fix ave/chunk <fix_ave_chunk>` commands when used in this and :doc:`fix ave/chunk <fix_ave_chunk>` commands when used in this
context is that the former uses a distributed grid, while the latter context is that the former uses a distributed grid, while the latter
uses a global grid. Distributed means that each processor owns the uses a global grid. Distributed means that each processor owns the
subset of grid cells within its sub-domain. Global means that each subset of grid cells within its subdomain. Global means that each
processor owns a copy of the entire grid. The :doc:`fix ave/grid processor owns a copy of the entire grid. The :doc:`fix ave/grid
<fix_ave_grid>` command is thus more efficient for large grids. <fix_ave_grid>` command is thus more efficient for large grids.

View File

@ -783,19 +783,19 @@ Pitfalls
**Parallel Scalability** **Parallel Scalability**
LAMMPS operates in parallel in a :doc:`spatial-decomposition mode LAMMPS operates in parallel in a :doc:`spatial-decomposition mode
<Developer_par_part>`, where each processor owns a spatial sub-domain of <Developer_par_part>`, where each processor owns a spatial subdomain of
the overall simulation domain and communicates with its neighboring the overall simulation domain and communicates with its neighboring
processors via distributed-memory message passing (MPI) to acquire ghost processors via distributed-memory message passing (MPI) to acquire ghost
atom information to allow forces on the atoms it owns to be atom information to allow forces on the atoms it owns to be
computed. LAMMPS also uses Verlet neighbor lists which are recomputed computed. LAMMPS also uses Verlet neighbor lists which are recomputed
every few timesteps as particles move. On these timesteps, particles every few timesteps as particles move. On these timesteps, particles
also migrate to new processors as needed. LAMMPS decomposes the overall also migrate to new processors as needed. LAMMPS decomposes the overall
simulation domain so that spatial sub-domains of nearly equal volume are simulation domain so that spatial subdomains of nearly equal volume are
assigned to each processor. When each sub-domain contains nearly the assigned to each processor. When each subdomain contains nearly the
same number of particles, this results in a reasonable load balance same number of particles, this results in a reasonable load balance
among all processors. As is more typical with some peridynamic among all processors. As is more typical with some peridynamic
simulations, some sub-domains may contain many particles while other simulations, some subdomains may contain many particles while other
sub-domains contain few particles, resulting in a load imbalance that subdomains contain few particles, resulting in a load imbalance that
impacts parallel scalability. impacts parallel scalability.
**Setting the "skin" distance** **Setting the "skin" distance**

View File

@ -392,7 +392,7 @@ IPyLammps Examples
------------------ ------------------
Examples of IPython notebooks can be found in the python/examples/pylammps Examples of IPython notebooks can be found in the python/examples/pylammps
sub-directory. To open these notebooks launch *jupyter notebook* inside this subdirectory. To open these notebooks launch *jupyter notebook* inside this
directory and navigate to one of them. If you compiled and installed directory and navigate to one of them. If you compiled and installed
a LAMMPS shared library with exceptions, PNG, JPEG and FFMPEG support a LAMMPS shared library with exceptions, PNG, JPEG and FFMPEG support
you should be able to rerun all of these notebooks. you should be able to rerun all of these notebooks.

View File

@ -47,9 +47,9 @@ script which is required when running in multi-replica mode.
Also note that with MPI installed on a machine (e.g. your desktop), you Also note that with MPI installed on a machine (e.g. your desktop), you
can run on more (virtual) processors than you have physical processors. can run on more (virtual) processors than you have physical processors.
Thus the above commands could be run on a single-processor (or Thus, the above commands could be run on a single-processor (or
few-processor) desktop so that you can run a multi-replica simulation on few-processor) desktop so that you can run a multi-replica simulation on
more replicas than you have physical processors. This is useful for more replicas than you have physical processors. This is useful for
testing and debugging, since with most modern processors and MPI testing and debugging, since with most modern processors and MPI
libraries the efficiency of a calculation can severely diminish when libraries, the efficiency of a calculation can severely diminish when
oversubscribing processors. oversubscribing processors.

View File

@ -7,8 +7,9 @@ run will continue from where the previous run left off. Or binary
restart files can be saved to disk using the :doc:`restart <restart>` restart files can be saved to disk using the :doc:`restart <restart>`
command. At a later time, these binary files can be read via a command. At a later time, these binary files can be read via a
:doc:`read_restart <read_restart>` command in a new script. Or they can :doc:`read_restart <read_restart>` command in a new script. Or they can
be converted to text data files using the :doc:`-r command-line switch <Run_options>` and read by a :doc:`read_data <read_data>` be converted to text data files using the :doc:`-r command-line switch
command in a new script. <Run_options>` and read by a :doc:`read_data <read_data>` command in a
new script.
Here we give examples of 2 scripts that read either a binary restart Here we give examples of 2 scripts that read either a binary restart
file or a converted data file and then issue a new run command to file or a converted data file and then issue a new run command to
@ -47,7 +48,7 @@ last 50 timesteps:
Note that the following commands do not need to be repeated because Note that the following commands do not need to be repeated because
their settings are included in the restart file: *units, atom_style, their settings are included in the restart file: *units, atom_style,
special_bonds, pair_style, bond_style*. However these commands do special_bonds, pair_style, bond_style*. However, these commands do
need to be used, since their settings are not in the restart file: need to be used, since their settings are not in the restart file:
*neighbor, fix, timestep*\ . *neighbor, fix, timestep*\ .
@ -90,7 +91,7 @@ Then, this script could be used to re-run the last 50 steps:
Note that nearly all the settings specified in the original *in.chain* Note that nearly all the settings specified in the original *in.chain*
script must be repeated, except the *pair_coeff* and *bond_coeff* script must be repeated, except the *pair_coeff* and *bond_coeff*
commands since the new data file lists the force field coefficients. commands, since the new data file lists the force field coefficients.
Also, the :doc:`reset_timestep <reset_timestep>` command is used to tell Also, the :doc:`reset_timestep <reset_timestep>` command is used to tell
LAMMPS the current timestep. This value is stored in restart files, LAMMPS the current timestep. This value is stored in restart files, but
but not in data files. not in data files.

View File

@ -20,7 +20,6 @@ atoms and the water molecule to run a rigid SPC model.
| LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.0 | LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.0
| :math:`r_0` of OH bond = 1.0 | :math:`r_0` of OH bond = 1.0
| :math:`\theta_0` of HOH angle = 109.47\ :math:`^{\circ}` | :math:`\theta_0` of HOH angle = 109.47\ :math:`^{\circ}`
|
Note that as originally proposed, the SPC model was run with a 9 Note that as originally proposed, the SPC model was run with a 9
Angstrom cutoff for both LJ and Coulomb terms. It can also be used Angstrom cutoff for both LJ and Coulomb terms. It can also be used
@ -33,16 +32,123 @@ the partial charge assignments change:
| O charge = -0.8476 | O charge = -0.8476
| H charge = 0.4238 | H charge = 0.4238
|
See the :ref:`(Berendsen) <howto-Berendsen>` reference for more details on both See the :ref:`(Berendsen) <howto-Berendsen>` reference for more details on both
the SPC and SPC/E models. 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.
.. 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/coul/cut 10.0
pair_coeff 1 1 0.1553 3.166
pair_coeff 1 2 0.0 1.0
pair_coeff 2 2 0.0 1.0
bond_style zero
bond_coeff 1 1.0
angle_style zero
angle_coeff 1 109.47
molecule water spce.mol
create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33
timestep 1.0
fix rigid all shake 0.0001 10 10000 b 1 a 1
minimize 0.0 0.0 1000 10000
run 0 post no
reset_timestep 0
velocity all create 300.0 5463576
fix integrate all nvt temp 300.0 300.0 1.0
thermo_style custom step temp press etotal density pe ke
thermo 1000
run 20000 upto
write_data tip4p.data nocoeff
.. _spce_molecule:
.. code-block::
# Water molecule. SPC/E geometry
3 atoms
2 bonds
1 angles
Coords
1 0.00000 -0.06461 0.00000
2 0.81649 0.51275 0.00000
3 -0.81649 0.51275 0.00000
Types
1 1 # O
2 2 # H
3 2 # H
Charges
1 -0.8476
2 0.4238
3 0.4238
Bonds
1 1 1 2
2 1 1 3
Angles
1 1 2 1 3
Shake Flags
1 1
2 1
3 1
Shake Atoms
1 1 2 3
2 1 2 3
3 1 2 3
Shake Bond Types
1 1 1 1
2 1 1 1
3 1 1 1
Special Bond Counts
1 2 0 0
2 1 1 0
3 1 1 0
Special Bonds
1 2 3
2 1 3
3 1 2
Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_. Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_.
---------- ----------
.. _howto-Berendsen: .. _howto-Berendsen:
**(Berendsen)** Berendsen, Grigera, Straatsma, J Phys Chem, 91, **(Berendsen)** Berendsen, Grigera, Straatsma, J Phys Chem, 91, 6269-6271 (1987).
6269-6271 (1987).

View File

@ -93,7 +93,7 @@ Some of the pair styles used to compute pairwise interactions between
finite-size particles also compute the correct interaction with point finite-size particles also compute the correct interaction with point
particles as well, e.g. the interaction between a point particle and a particles as well, e.g. the interaction between a point particle and a
finite-size particle or between two point particles. If necessary, finite-size particle or between two point particles. If necessary,
:doc:`pair_style hybrid <pair_hybrid>` can be used to insure the correct :doc:`pair_style hybrid <pair_hybrid>` can be used to ensure the correct
interactions are computed for the appropriate style of interactions. interactions are computed for the appropriate style of interactions.
Likewise, using groups to partition particles (ellipsoids versus Likewise, using groups to partition particles (ellipsoids versus
spheres versus point particles) will allow you to use the appropriate spheres versus point particles) will allow you to use the appropriate

View File

@ -1,53 +1,211 @@
TIP3P water model TIP3P water model
================= =================
The TIP3P water model as implemented in CHARMM The TIP3P water model as implemented in CHARMM :ref:`(MacKerell)
:ref:`(MacKerell) <howto-tip3p>` specifies a 3-site rigid water molecule with <howto-tip3p>` specifies a 3-site rigid water molecule with charges and
charges and Lennard-Jones parameters assigned to each of the 3 atoms. Lennard-Jones parameters assigned to each of the 3 atoms.
In LAMMPS the :doc:`fix shake <fix_shake>` command can be used to hold
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.
These are the additional parameters (in real units) to set for O and H A suitable pair style with cutoff Coulomb would be:
atoms and the water molecule to run a rigid TIP3P-CHARMM model with a
cutoff. The K values can be used if a flexible TIP3P model (without
fix shake) is desired. If the LJ epsilon and sigma for HH and OH are
set to 0.0, it corresponds to the original 1983 TIP3P model
:ref:`(Jorgensen) <Jorgensen1>`.
| O mass = 15.9994 * :doc:`pair_style lj/cut/coul/cut <pair_lj_cut_coul>`
| H mass = 1.008
| O charge = -0.834
| H charge = 0.417
| LJ :math:`\epsilon` of OO = 0.1521
| LJ :math:`\sigma` of OO = 3.1507
| LJ :math:`\epsilon` of HH = 0.0460
| LJ :math:`\sigma` of HH = 0.4000
| LJ :math:`\epsilon` of OH = 0.0836
| LJ :math:`\sigma` of OH = 1.7753
| K of OH bond = 450
| :math:`r_0` of OH bond = 0.9572
| K of HOH angle = 55
| :math:`\theta` of HOH angle = 104.52\ :math:`^{\circ}`
|
These are the parameters to use for TIP3P with a long-range Coulomb or these commands for a long-range Coulomb model:
solver (e.g. Ewald or PPPM in LAMMPS), see :ref:`(Price) <Price1>` for
details: * :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:`kspace_style pppm/disp <kspace_style>`
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
<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.
The table below lists the force field parameters (in real :doc:`units
<units>`) to for the water molecule atoms to run a rigid or flexible
TIP3P-CHARMM model with a cutoff, the original 1983 TIP3P model
:ref:`(Jorgensen) <Jorgensen1>`, or a TIP3P model with parameters
optimized for a long-range Coulomb solver (e.g. Ewald or PPPM in LAMMPS)
:ref:`(Price) <Price1>`. The K values can be used if a flexible TIP3P
model (without fix shake) is desired, for rigid bonds/angles they are
ignored.
.. list-table::
:header-rows: 1
:widths: auto
* - Parameter
- TIP3P-CHARMM
- TIP3P (original)
- TIP3P (Ewald)
* - O mass (amu)
- 15.9994
- 15.9994
- 15.9994
* - H mass (amu)
- 1.008
- 1.008
- 1.008
* - O charge (:math:`e`)
- -0.834
- -0.834
- -0.834
* - H charge (:math:`e`)
- 0.417
- 0.417
- 0.417
* - LJ :math:`\epsilon` of OO (kcal/mole)
- 0.1521
- 0.1521
- 0.1020
* - LJ :math:`\sigma` of OO (:math:`\AA`)
- 3.1507
- 3.1507
- 3.188
* - LJ :math:`\epsilon` of HH (kcal/mole)
- 0.0460
- 0.0
- 0.0
* - LJ :math:`\sigma` of HH (:math:`\AA`)
- 0.4
- 1.0
- 1.0
* - LJ :math:`\epsilon` of OH (kcal/mole)
- 0.0836
- 0.0
- 0.0
* - LJ :math:`\sigma` of OH (:math:`\AA`)
- 1.7753
- 1.0
- 1.0
* - K of OH bond (kcal/mole/:math:`\AA^2`)
- 450
- 450
- 450
* - :math:`r_0` of OH bond (:math:`\AA`)
- 0.9572
- 0.9572
- 0.9572
* - K of HOH angle (kcal/mole)
- 55.0
- 55.0
- 55.0
* - :math:`\theta_0` of HOH angle
- 104.52\ :math:`^{\circ}`
- 104.52\ :math:`^{\circ}`
- 104.52\ :math:`^{\circ}`
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.
.. 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/coul/cut 8.0
pair_coeff 1 1 0.1521 3.1507
pair_coeff 2 2 0.0 1.0
bond_style zero
bond_coeff 1 0.9574
angle_style zero
angle_coeff 1 104.52
molecule water tip3p.mol
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
run 0 post no
reset_timestep 0
velocity all create 300.0 5463576
fix integrate all nvt temp 300 300 1.0
thermo_style custom step temp press etotal pe
thermo 1000
run 20000
write_data tip3p.data nocoeff
.. _tip3p_molecule:
.. code-block::
# Water molecule. TIP3P geometry
3 atoms
2 bonds
1 angles
Coords
1 0.00000 -0.06556 0.00000
2 0.75695 0.52032 0.00000
3 -0.75695 0.52032 0.00000
Types
1 1 # O
2 2 # H
3 2 # H
Charges
1 -0.834
2 0.417
3 0.417
Bonds
1 1 1 2
2 1 1 3
Angles
1 1 2 1 3
Shake Flags
1 1
2 1
3 1
Shake Atoms
1 1 2 3
2 1 2 3
3 1 2 3
Shake Bond Types
1 1 1 1
2 1 1 1
3 1 1 1
Special Bond Counts
1 2 0 0
2 1 1 0
3 1 1 0
Special Bonds
1 2 3
2 1 3
3 1 2
| O mass = 15.9994
| H mass = 1.008
| O charge = -0.830
| H charge = 0.415
| LJ :math:`\epsilon` of OO = 0.102
| LJ :math:`\sigma` of OO = 3.188
| LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.0
| K of OH bond = 450
| :math:`r_0` of OH bond = 0.9572
| K of HOH angle = 55
| :math:`\theta` of HOH angle = 104.52\ :math:`^{\circ}`
|
Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_. Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_.

View File

@ -2,19 +2,33 @@ TIP4P water model
================= =================
The four-point TIP4P rigid water model extends the traditional The four-point TIP4P rigid water model extends the traditional
three-point TIP3P model by adding an additional site, usually :doc:`three-point TIP3P <Howto_tip3p>` model by adding an additional
massless, where the charge associated with the oxygen atom is placed. site M, usually massless, where the charge associated with the oxygen
This site M is located at a fixed distance away from the oxygen along atom is placed. This site M is located at a fixed distance away from
the bisector of the HOH bond angle. A bond style of *harmonic* and an the oxygen along the bisector of the HOH bond angle. A bond style of
angle style of *harmonic* or *charmm* should also be used. :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.
A TIP4P model is run with LAMMPS using either these commands There are two ways to implement TIP4P water in LAMMPS:
for a cutoff model:
#. Use a specially written pair style that uses the :ref:`TIP3P geometry
<tip3p_molecule>` without the point M. The point M location is then
implicitly derived from the other atoms or each water molecule and
used during the force computation. The forces on M are then
projected on the oxygen and the two hydrogen atoms. This is
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.
This can be done with the following pair styles for Coulomb with a cutoff:
* :doc:`pair_style tip4p/cut <pair_lj_cut_tip4p>` * :doc:`pair_style tip4p/cut <pair_lj_cut_tip4p>`
* :doc:`pair_style lj/cut/tip4p/cut <pair_lj_cut_tip4p>` * :doc:`pair_style lj/cut/tip4p/cut <pair_lj_cut_tip4p>`
or these commands for a long-range model: or these commands for a long-range Coulomb treatment:
* :doc:`pair_style tip4p/long <pair_coul>` * :doc:`pair_style tip4p/long <pair_coul>`
* :doc:`pair_style lj/cut/tip4p/long <pair_lj_cut_tip4p>` * :doc:`pair_style lj/cut/tip4p/long <pair_lj_cut_tip4p>`
@ -31,71 +45,95 @@ parameter sets listed below are all for rigid TIP4P model variants and
thus the bond and angle force constants are not used and can be set to thus the bond and angle force constants are not used and can be set to
any legal value; only equilibrium length and angle are used. any legal value; only equilibrium length and angle are used.
These are the additional parameters (in real units) to set for O and H #. Use an :ref:`explicit 4 point TIP4P geometry <tip4p_molecule>` where
atoms and the water molecule to run a rigid TIP4P model with a cutoff the oxygen atom carries no charge and the M point no Lennard-Jones
:ref:`(Jorgensen) <Jorgensen5>`. Note that the OM distance is specified in interactions. Since :doc:`fix shake <fix_shake>` or :doc:`fix rattle
the :doc:`pair_style <pair_style>` command, not as part of the pair <fix_shake>` may not be applied to this kind of geometry, :doc:`fix
coefficients. rigid or fix rigid/small <fix_rigid>` or its thermostatted variants
are required to maintain a rigid geometry. This avoids some of the
issues with respect to analysis and non-tip4p styles, but it is a
more costly force computation (more atoms in the same volume and thus
more neighbors in the neighbor lists) and requires a much shorter
timestep for stable integration of the rigid body motion. Since no
bonds or angles are required, they do not need to be defined and atom
style charge would be sufficient for a bulk TIP4P water system. In
order to avoid that LAMMPS produces an error due to the massless M
site a tiny non-zero mass needs to be assigned.
| O mass = 15.9994 The table below lists the force field parameters (in real :doc:`units
| H mass = 1.008 <units>`) to for a selection of popular variants of the TIP4P model.
| O charge = -1.040 There is the rigid TIP4P model with a cutoff :ref:`(Jorgensen)
| H charge = 0.520 <Jorgensen5>`, the TIP4/Ice model :ref:`(Abascal1) <Abascal1>`, the
| :math:`r_0` of OH bond = 0.9572 TIP4P/2005 model :ref:`(Abascal2) <Abascal2>` and a version of TIP4P
| :math:`\theta` of HOH angle = 104.52\ :math:`^{\circ}` parameters adjusted for use with a long-range Coulombic solver
| OM distance = 0.15 (e.g. Ewald or PPPM in LAMMPS). Note that for implicit TIP4P models the
| LJ :math:`\epsilon` of O-O = 0.1550 OM distance is specified in the :doc:`pair_style <pair_style>` command,
| LJ :math:`\sigma` of O-O = 3.1536 not as part of the pair coefficients.
| LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.0
| Coulomb cutoff = 8.5
|
For the TIP4/Ice model (J Chem Phys, 122, 234511 (2005); .. list-table::
https://doi.org/10.1063/1.1931662) these values can be used: :header-rows: 1
:widths: auto
| O mass = 15.9994 * - Parameter
| H mass = 1.008 - TIP4P (original)
| O charge = -1.1794 - TIP4P/Ice
| H charge = 0.5897 - TIP4P/2005
| :math:`r_0` of OH bond = 0.9572 - TIP4P (Ewald)
| :math:`\theta` of HOH angle = 104.52\ :math:`^{\circ}` * - O mass (amu)
| OM distance = 0.1577 - 15.9994
| LJ :math:`\epsilon` of O-O = 0.21084 - 15.9994
| LJ :math:`\sigma` of O-O = 3.1668 - 15.9994
| LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.0 - 15.9994
| Coulomb cutoff = 8.5 * - H mass (amu)
| - 1.008
- 1.008
For the TIP4P/2005 model (J Chem Phys, 123, 234505 (2005); - 1.008
https://doi.org/10.1063/1.2121687), these values can be used: - 1.008
* - O or M charge (:math:`e`)
| O mass = 15.9994 - -1.040
| H mass = 1.008 - -1.1794
| O charge = -1.1128 - -1.1128
| H charge = 0.5564 - -1.04844
| :math:`r_0` of OH bond = 0.9572 * - H charge (:math:`e`)
| :math:`\theta` of HOH angle = 104.52\ :math:`^{\circ}` - 0.520
| OM distance = 0.1546 - 0.5897
| LJ :math:`\epsilon` of O-O = 0.1852 - 0.5564
| LJ :math:`\sigma` of O-O = 3.1589 - 0.52422
| LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.0 * - LJ :math:`\epsilon` of OO (kcal/mole)
| Coulomb cutoff = 8.5 - 0.1550
| - 0.1577
- 0.1852
These are the parameters to use for TIP4P with a long-range Coulombic - 0.16275
solver (e.g. Ewald or PPPM in LAMMPS): * - LJ :math:`\sigma` of OO (:math:`\AA`)
- 3.1536
| O mass = 15.9994 - 3.1668
| H mass = 1.008 - 3.1589
| O charge = -1.0484 - 3.16435
| H charge = 0.5242 * - LJ :math:`\epsilon` of HH, MM, OH, OM, HM (kcal/mole)
| :math:`r_0` of OH bond = 0.9572 - 0.0
| :math:`\theta` of HOH angle = 104.52\ :math:`^{\circ}` - 0.0
| OM distance = 0.1250 - 0.0
| LJ :math:`\epsilon` of O-O = 0.16275 - 0.0
| LJ :math:`\sigma` of O-O = 3.16435 * - LJ :math:`\sigma` of HH, MM, OH, OM, HM (:math:`\AA`)
| LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.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
* - :math:`\theta_0` of HOH angle
- 104.52\ :math:`^{\circ}`
- 104.52\ :math:`^{\circ}`
- 104.52\ :math:`^{\circ}`
- 104.52\ :math:`^{\circ}`
* - OM distance (:math:`\AA`)
- 0.15
- 0.1577
- 0.1546
- 0.1250
Note that the when using the TIP4P pair style, the neighbor list cutoff Note that the when using the TIP4P pair style, the neighbor list cutoff
for Coulomb interactions is effectively extended by a distance 2 \* (OM for Coulomb interactions is effectively extended by a distance 2 \* (OM
@ -108,6 +146,117 @@ trade-off for your model. The OM distance and the LJ and Coulombic
cutoffs are set in the :doc:`pair_style lj/cut/tip4p/long cutoffs are set in the :doc:`pair_style lj/cut/tip4p/long
<pair_lj_cut_tip4p>` command. <pair_lj_cut_tip4p>` command.
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):
.. 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/cut 1 2 1 1 0.15 8.0
pair_coeff 1 1 0.1550 3.1536
pair_coeff 2 2 0.0 1.0
bond_style zero
bond_coeff 1 0.9574
angle_style zero
angle_coeff 1 104.52
molecule water tip3p.mol # this uses the TIP3P geometry
create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33
# must change charges for TIP4P
set type 1 charge -1.040
set type 2 charge 0.520
fix rigid all shake 0.001 10 10000 b 1 a 1
minimize 0.0 0.0 1000 10000
run 0 post no
reset_timestep 0
velocity all create 300.0 5463576
fix integrate all nvt temp 300 300 1.0
thermo_style custom step temp press etotal pe
thermo 1000
run 20000
write_data tip3p.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/nvt/small
<fix_rigid>` no bonds need to be defined and thus no extra storage needs
to be reserved for them, but we need to switch to atom style full or use
:doc:`fix property/atom mol <fix_property_atom>` so that fix
rigid/nvt/small can identify rigid bodies by their molecule ID:
.. code-block:: LAMMPS
units real
atom_style charge
region box block -5 5 -5 5 -5 5
create_box 3 box
mass 1 15.9994
mass 2 1.008
mass 3 1.0e-100
pair_style lj/cut/coul/cut 8.0
pair_coeff 1 1 0.1550 3.1536
pair_coeff 2 2 0.0 1.0
pair_coeff 3 3 0.0 1.0
fix mol all property/atom mol
molecule water tip4p.mol
create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33
timestep 0.1
fix integrate all rigid/nvt/small molecule temp 300.0 300.0 1.0
velocity all create 300.0 5463576
thermo_style custom step temp press etotal density pe ke
thermo 1000
run 20000
write_data tip4p.data nocoeff
.. _tip4p_molecule:
.. code-block::
# Water molecule. Explicit TIP4P geometry for use with fix rigid
4 atoms
Coords
1 0.00000 -0.06556 0.00000
2 0.75695 0.52032 0.00000
3 -0.75695 0.52032 0.00000
4 0.00000 0.08444 0.00000
Types
1 1 # O
2 2 # H
3 2 # H
4 3 # M
Charges
1 0.000
2 0.520
3 0.520
4 -1.040
Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_. Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_.
---------- ----------
@ -116,3 +265,13 @@ Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wik
**(Jorgensen)** Jorgensen, Chandrasekhar, Madura, Impey, Klein, J Chem **(Jorgensen)** Jorgensen, Chandrasekhar, Madura, Impey, Klein, J Chem
Phys, 79, 926 (1983). Phys, 79, 926 (1983).
.. _Abascal1:
**(Abascal1)** Abascal, Sanz, Fernandez, Vega, J Chem Phys, 122, 234511 (2005)
https://doi.org/10.1063/1.1931662
.. _Abascal2:
**(Abascal2)** Abascal, J Chem Phys, 123, 234505 (2005)
https://doi.org/10.1063/1.2121687

161
doc/src/Howto_tip5p.rst Normal file
View File

@ -0,0 +1,161 @@
TIP5P water model
=================
The five-point TIP5P rigid water model extends the :doc:`three-point
TIP3P model <Howto_tip3p>` by adding two additional sites L, usually
massless, where the charge associated with the oxygen atom is placed.
These sites L are located at a fixed distance away from the oxygen atom,
forming a tetrahedral angle that is rotated by 90 degrees from the HOH
plane. Those sites thus somewhat approximate lone pairs of the oxygen
and consequently improve the water structure to become even more
"tetrahedral" in comparison to the :doc:`four-point TIP4P model
<Howto_tip4p>`.
A suitable pair style with cutoff Coulomb would be:
* :doc:`pair_style lj/cut/coul/cut <pair_lj_cut_coul>`
or these commands for a long-range 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:`kspace_style pppm/disp <kspace_style>`
A TIP5P model *must* be run using a :doc:`rigid fix <fix_rigid>` since
there is no other option to keep this kind of structure rigid in LAMMPS.
In order to avoid that LAMMPS produces an error due to the massless L
sites, those need to be assigned a tiny non-zero mass.
The table below lists the force field parameters (in real :doc:`units
<units>`) to for a the TIP5P model with a cutoff :ref:`(Mahoney)
<Mahoney>` and the TIP5P-E model :ref:`(Rick) <Rick>` for use with a
long-range Coulombic solver (e.g. Ewald or PPPM in LAMMPS).
.. list-table::
:header-rows: 1
:widths: auto
* - Parameter
- TIP5P
- TIP5P-E
* - O mass (amu)
- 15.9994
- 15.9994
* - H mass (amu)
- 1.008
- 1.008
* - O charge (:math:`e`)
- 0.0
- 0.0
* - L charge (:math:`e`)
- -0.241
- -0.241
* - H charge (:math:`e`)
- 0.241
- 0.241
* - LJ :math:`\epsilon` of OO (kcal/mole)
- 0.1600
- 0.1780
* - LJ :math:`\sigma` of OO (:math:`\AA`)
- 3.1200
- 3.0970
* - LJ :math:`\epsilon` of HH, LL, OH, OL, HL (kcal/mole)
- 0.0
- 0.0
* - LJ :math:`\sigma` of HH, LL, OH, OL, HL (:math:`\AA`)
- 1.0
- 1.0
* - :math:`r_0` of OH bond (:math:`\AA`)
- 0.9572
- 0.9572
* - :math:`\theta_0` of HOH angle
- 104.52\ :math:`^{\circ}`
- 104.52\ :math:`^{\circ}`
* - OL distance (:math:`\AA`)
- 0.70
- 0.70
* - :math:`\theta_0` of LOL angle
- 109.47\ :math:`^{\circ}`
- 109.47\ :math:`^{\circ}`
Below is the code for a LAMMPS input file for setting up a simulation of
TIP5P water with a molecule file. Because of using :doc:`fix
rigid/nvt/small <fix_rigid>` no bonds need to be defined and thus no
extra storage needs to be reserved for them, but we need to switch to
atom style full or use :doc:`fix property/atom mol <fix_property_atom>`
so that fix rigid/nvt/small can identify rigid bodies by their molecule
ID:
.. code-block:: LAMMPS
units real
atom_style charge
region box block -5 5 -5 5 -5 5
create_box 3 box
mass 1 15.9994
mass 2 1.008
mass 3 1.0e-100
pair_style lj/cut/coul/cut 8.0
pair_coeff 1 1 0.160 3.12
pair_coeff 2 2 0.0 1.0
pair_coeff 3 3 0.0 1.0
fix mol all property/atom mol
molecule water tip5p.mol
create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33
timestep 0.20
fix integrate all rigid/nvt/small molecule temp 300.0 300.0 1.0
reset_timestep 0
velocity all create 300.0 5463576
thermo_style custom step temp press etotal density pe ke
thermo 1000
run 20000
write_data tip5p.data nocoeff
.. _tip5p_molecule:
.. code-block::
# Water molecule. Explicit TIP5P geometry for use with fix rigid
5 atoms
Coords
1 0.00000 -0.06556 0.00000
2 0.75695 0.52032 0.00000
3 -0.75695 0.52032 0.00000
4 0.00000 -0.46971 0.57154
5 0.00000 -0.46971 -0.57154
Types
1 1 # O
2 2 # H
3 2 # H
4 3 # L
5 3 # L
Charges
1 0.000
2 0.241
3 0.241
4 -0.241
5 -0.241
Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_.
----------
.. _Mahoney:
**(Mahoney)** Mahoney, Jorgensen, J Chem Phys 112, 8910 (2000)
.. _Rick:
**(Rick)** Rick, J Chem Phys 120, 6085 (2004)

View File

@ -150,7 +150,7 @@ option with either of the commands.
Note that if a simulation box has a large tilt factor, LAMMPS will run Note that if a simulation box has a large tilt factor, LAMMPS will run
less efficiently, due to the large volume of communication needed to less efficiently, due to the large volume of communication needed to
acquire ghost atoms around a processor's irregular-shaped sub-domain. acquire ghost atoms around a processor's irregular-shaped subdomain.
For extreme values of tilt, LAMMPS may also lose atoms and generate an For extreme values of tilt, LAMMPS may also lose atoms and generate an
error. error.

View File

@ -1,33 +1,21 @@
Visualize LAMMPS snapshots Visualize LAMMPS snapshots
========================== ==========================
LAMMPS itself does not do visualization, but snapshots from LAMMPS Snapshots from LAMMPS simulations can be viewed, visualized, and
simulations can be visualized (and analyzed) in a variety of ways. analyzed in a variety of ways.
Mention dump image and dump movie. LAMMPS snapshots are created by the :doc:`dump <dump>` command, which
can create files in several formats. The native LAMMPS dump format is a
text file (see "dump atom" or "dump custom") which can be visualized by
`several visualization tools <https://www.lammps.org/viz.html>`_ for MD
simulation trajectories. `OVITO <https://www.ovito.org>`_ and `VMD
<https://www.ks.uiuc.edu/Research/vmd>`_ seem to be the most popular
choices among them.
LAMMPS snapshots are created by the :doc:`dump <dump>` command which can The :doc:`dump image <dump_image>` and :doc:`dump movie <dump_image>`
create files in several formats. The native LAMMPS dump format is a styles can output internally rendered images or convert them to a movie
text file (see "dump atom" or "dump custom") which can be visualized during the MD run.
by several popular visualization tools. The :doc:`dump image <dump_image>` and :doc:`dump movie <dump_image>` styles can
output internally rendered images and convert a sequence of them to a
movie during the MD run. Several programs included with LAMMPS as
auxiliary tools can convert between LAMMPS format files and other
formats. See the :doc:`Tools <Tools>` page for details.
A Python-based toolkit distributed by our group can read native LAMMPS Programs included with LAMMPS as auxiliary tools can convert
dump files, including custom dump files with additional columns of between LAMMPS format files and other formats. See the :doc:`Tools
user-specified atom information, and convert them to various formats or <Tools>` page for details. These are rarely needed these days.
pipe them into visualization software directly. See the `Pizza.py WWW
site <pizza_>`_ for details. Specifically, Pizza.py can convert LAMMPS
dump files into PDB, XYZ, `EnSight <ensight_>`_, and VTK formats.
Pizza.py can pipe LAMMPS dump files directly into the Raster3d and
RasMol visualization programs. Pizza.py has tools that do interactive
3d OpenGL visualization and one that creates SVG images of dump file
snapshots.
.. _pizza: https://lammps.github.io/pizza
.. _ensight: https://www.ansys.com/products/fluids/ansys-ensight
.. _atomeye: http://li.mit.edu/Archive/Graphics/A/

View File

@ -11,12 +11,14 @@ LAMMPS in workshop settings, we had to redirect Windows users to
Linux Virtual Machines such as VirtualBox or Unix-like compilation with Linux Virtual Machines such as VirtualBox or Unix-like compilation with
Cygwin. Cygwin.
With the latest updates in Windows 10 (Version 2004, Build 19041 or higher), With the latest updates in Windows 10 (Version 2004, Build 19041 or
Microsoft has added a new way to work on Linux-based code. The Windows higher), Microsoft has added a new way to work on Linux-based code. The
Subsystem for Linux (WSL). With WSL Version 2, you now get a Linux Virtual `Windows Subsystem for Linux (WSL)
Machine that transparently integrates into Windows. All you need is to ensure <https://learn.microsoft.com/en-us/windows/wsl/>`_. With WSL Version 2,
you have the latest Windows updates installed and enable this new feature. you now get a Linux Virtual Machine that transparently integrates into
Linux VMs are then easily installed using the Microsoft Store. Windows. All you need is to ensure you have the latest Windows updates
installed and enable this new feature. Linux VMs are then easily
installed using the Microsoft Store.
In this tutorial, I'll show you how to set up and compile LAMMPS for both serial In this tutorial, I'll show you how to set up and compile LAMMPS for both serial
and MPI usage in WSL2. and MPI usage in WSL2.

View File

@ -18,6 +18,8 @@ you **must** build LAMMPS from the source code.
developers have no control over their choices of how they configure developers have no control over their choices of how they configure
and build their packages and when they update them. and build their packages and when they update them.
----
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
@ -29,38 +31,40 @@ you **must** build LAMMPS from the source code.
Install_tarball Install_tarball
Install_git Install_git
These are the files and sub-directories in the LAMMPS distribution: ----
+------------+-------------------------------------------+ These are the files and subdirectories in the LAMMPS distribution:
+------------+---------------------------------------------+
| README | Short description of the LAMMPS package | | README | Short description of the LAMMPS package |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| LICENSE | GNU General Public License (GPL) | | LICENSE | GNU General Public License (GPL) |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| SECURITY.md| Security Policy for the LAMMPS package | | SECURITY.md| Security policy for the LAMMPS package |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| bench | benchmark problems | | bench | benchmark inputs |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| cmake | CMake build files | | cmake | CMake build files |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| doc | documentation | | doc | documentation and tools to build the manual |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| examples | simple test problems | | examples | example input files |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| fortran | Fortran wrapper for LAMMPS | | fortran | Fortran module for LAMMPS library interface |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| lib | additional provided or external libraries | | lib | additional provided or external libraries |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| potentials | interatomic potential files | | potentials | selected interatomic potential files |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| python | Python wrappers for LAMMPS | | python | Python module for LAMMPS library interface |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| src | source files | | src | LAMMPS source files |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| tools | pre- and post-processing tools | | tools | pre- and post-processing tools |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
| unittest | sources and inputs for testing LAMMPS | | unittest | source code and inputs for testing LAMMPS |
+------------+-------------------------------------------+ +------------+---------------------------------------------+
You will have all of these if you download source. You will only have You will have all of these if you downloaded the LAMMPS source code.
some of them if you download executables, as explained on the pages You will have only some of them if you downloaded executables, as
listed above. explained on the pages listed above.

View File

@ -1,7 +1,7 @@
Download an executable for Linux or Mac via Conda Download an executable for Linux or Mac via Conda
------------------------------------------------- -------------------------------------------------
Pre-compiled LAMMPS binaries are available for macOS or Linux via the Pre-compiled LAMMPS binaries are available for macOS and Linux via the
`Conda <conda_>`_ package management system. `Conda <conda_>`_ package management system.
First, one must set up the Conda package manager on your system. Follow the First, one must set up the Conda package manager on your system. Follow the
@ -21,19 +21,19 @@ Then, you can install LAMMPS on your system with the following command:
conda activate my-lammps-env conda activate my-lammps-env
conda install lammps conda install lammps
The LAMMPS binary is built with the :ref:`KIM package <kim>` which The LAMMPS binary is built with the :ref:`KIM package <kim>`, which
results in Conda also installing the `kim-api` binaries when LAMMPS is results in Conda also installing the `kim-api` binaries when LAMMPS is
installed. In order to use potentials from `openkim.org <openkim_>`_, you can installed. In order to use potentials from `openkim.org <openkim_>`_,
install the `openkim-models` package you can install the `openkim-models` package
.. code-block:: bash .. code-block:: bash
conda install openkim-models conda install openkim-models
If you have problems with the installation you can post issues to If you have problems with the installation, you can post issues to `this
`this link <conda_forge_lammps_>`_. link <conda_forge_lammps_>`_. Thanks to Jan Janssen
Thanks to Jan Janssen (Max-Planck-Institut fuer Eisenforschung) for setting (Max-Planck-Institut fuer Eisenforschung) for setting up the Conda
up the Conda capability. capability.
.. _conda_forge_lammps: https://github.com/conda-forge/lammps-feedstock/issues .. _conda_forge_lammps: https://github.com/conda-forge/lammps-feedstock/issues
.. _openkim: https://openkim.org .. _openkim: https://openkim.org

View File

@ -1,16 +1,16 @@
Download the LAMMPS source with git Download the LAMMPS source with git
----------------------------------- -----------------------------------
All LAMMPS development is coordinated through the "LAMMPS GitHub LAMMPS development is coordinated through the "LAMMPS GitHub site".
site". If you clone the LAMMPS repository onto your local machine, it If you clone the LAMMPS repository onto your local machine, it has
has several advantages: several advantages:
* You can stay current with changes to LAMMPS with a single git * You can stay current with changes to LAMMPS with a single git
command. command.
* You can create your own development branches to add code to LAMMPS. * You can create your own development branches to add code to LAMMPS.
* You can submit your new features back to GitHub for inclusion in * You can submit your new features back to GitHub for inclusion in
LAMMPS. For that you should first create your own :doc:`fork on LAMMPS. For that, you should first create your own :doc:`fork on
GitHub <Howto_github>`. GitHub <Howto_github>`, though.
You must have `git <git_>`_ installed on your system to use the You must have `git <git_>`_ installed on your system to use the
commands explained below to communicate with the git servers on commands explained below to communicate with the git servers on
@ -26,15 +26,18 @@ provides `limited support for subversion clients <svn_>`_.
.. _git: https://git-scm.com .. _git: https://git-scm.com
.. _svn: https://help.github.com/en/github/importing-your-projects-to-github/working-with-subversion-on-github .. _svn: https://help.github.com/en/github/importing-your-projects-to-github/working-with-subversion-on-github
You can follow the LAMMPS development on 3 different git branches: You can follow the LAMMPS development on 4 different git branches:
* **stable** : this branch is updated from the *release* branch with * **release** : this branch is updated with every patch or feature release;
every stable release version and also has selected bug fixes and updates updates are always "fast-forward" merges from *develop*
back-ported from the *develop* branch
* **release** : this branch is updated with every patch release;
updates are always "fast forward" merges from *develop*
* **develop** : this branch follows the ongoing development and * **develop** : this branch follows the ongoing development and
is updated with every merge commit of a pull request is updated with every merge commit of a pull request
* **stable** : this branch is updated from the *release* branch with
every stable release version and also has selected bug fixes with every
update release when the *maintenance* branch is merged into it
* **maintenance** : this branch collects back-ported bug fixes from the
*develop* branch to the *stable* branch. It is used to update *stable*
for update releases and it synchronized with *stable* at each stable release.
To access the git repositories on your box, use the clone command to To access the git repositories on your box, use the clone command to
create a local copy of the LAMMPS repository with a command like: create a local copy of the LAMMPS repository with a command like:
@ -58,19 +61,19 @@ between them at any time using "git checkout <branch name>".)
commit history (most people don't), you can speed up the "cloning" commit history (most people don't), you can speed up the "cloning"
process and reduce local disk space requirements by using the process and reduce local disk space requirements by using the
*--depth* git command line flag. That will create a "shallow clone" *--depth* git command line flag. That will create a "shallow clone"
of the repository containing only a subset of the git history. Using of the repository, which contains only a subset of the git history.
a depth of 1000 is usually sufficient to include the head commits of Using a depth of 1000 is usually sufficient to include the head
the *develop* and the *release* branches. To include the head commit commits of the *develop*, the *release*, and the *maintenance*
of the *stable* branch you may need a depth of up to 10000. If you branches. To include the head commit of the *stable* branch you may
later need more of the git history, you can always convert the need a depth of up to 10000. If you later need more of the git
shallow clone into a "full clone". history, you can always convert the shallow clone into a "full
clone".
Once the command completes, your directory will contain the same files Once the command completes, your directory will contain the same files
as if you unpacked a current LAMMPS tarball, with the exception, that as if you unpacked a current LAMMPS tarball, with the exception, that
the HTML documentation files are not included. They can be fetched the HTML documentation files are not included. They can be generated
from the LAMMPS website by typing ``make fetch`` in the doc directory. from the content provided in ``doc/src`` by typing ``make html`` from
Or they can be generated from the content provided in ``doc/src`` by the ``doc`` directory.
typing ``make html`` from the ``doc`` directory.
After initial cloning, as bug fixes and new features are added to After initial cloning, as bug fixes and new features are added to
LAMMPS you can stay up-to-date by typing the following git commands LAMMPS you can stay up-to-date by typing the following git commands
@ -79,16 +82,17 @@ from within the "mylammps" directory:
.. code-block:: bash .. code-block:: bash
git checkout release # not needed if you always stay in this branch git checkout release # not needed if you always stay in this branch
git checkout stable # use one of these 3 checkout commands git checkout stable # use one of these 4 checkout commands
git checkout develop # to choose the branch to follow git checkout develop # to choose the branch to follow
git checkout maintenance
git pull git pull
Doing a "pull" will not change any files you have added to the LAMMPS Doing a "pull" will not change any files you have added to the LAMMPS
directory structure. It will also not change any existing LAMMPS directory structure. It will also not change any existing LAMMPS files
files you have edited, unless those files have changed in the you have edited, unless those files have changed in the repository. In
repository. In that case, git will attempt to merge the new that case, git will attempt to merge the changes from the repository
repository file with your version of the file and tell you if there file with your version of the file and tell you if there are any
are any conflicts. See the git documentation for details. conflicts. See the git documentation for details.
If you want to access a particular previous release version of LAMMPS, If you want to access a particular previous release version of LAMMPS,
you can instead "check out" any version with a published tag. See the you can instead "check out" any version with a published tag. See the
@ -145,24 +149,24 @@ changed. How to do this depends on the build system you are using.
to enforce consistency of the source between the src folder to enforce consistency of the source between the src folder
and package directories. This is OK to do even if you don't and package directories. This is OK to do even if you don't
use any packages. The ``make purge`` command removes any deprecated use any packages. The ``make purge`` command removes any deprecated
src files if they were removed by the patch from a package src files if they were removed by the update from a package
sub-directory. subdirectory.
.. warning:: .. warning::
If you wish to edit/change a src file that is from a package, If you wish to edit/change a src file that is from a package,
you should edit the version of the file inside the package you should edit the version of the file inside the package
sub-directory with src, then re-install the package. The subdirectory with src, then re-install the package. The
version in the source directory is merely a copy and will be version in the source directory is merely a copy and will be
wiped out if you type "make package-update". wiped out if you type "make package-update".
.. admonition:: Git protocols .. admonition:: Git protocols
:class: note :class: note
The servers at github.com support the "https://" access protocol for The servers at github.com support the "https" access protocol for
anonymous, read-only access. If you have a suitably configured anonymous, read-only access. If you have a suitably configured
GitHub account, you may also use SSH protocol with the URL GitHub account, you may also use SSH protocol with the URL
"git@github.com:lammps/lammps.git". ``git@github.com:lammps/lammps.git``.
The LAMMPS GitHub project is currently managed by Axel Kohlmeyer The LAMMPS GitHub project is currently overseen by Axel Kohlmeyer
(Temple U, akohlmey at gmail.com). (Temple U, akohlmey at gmail.com).

View File

@ -3,7 +3,8 @@ Download an executable for Linux
Binaries are available for different versions of Linux: Binaries are available for different versions of Linux:
- :ref:`Pre-built Ubuntu Linux executables <ubuntu>` - :ref:`Pre-built static Linux x86_64 executables <static>`
- :ref:`Pre-built Ubuntu and Debian Linux executables <ubuntu>`
- :ref:`Pre-built Fedora Linux executables <fedora>` - :ref:`Pre-built Fedora Linux executables <fedora>`
- :ref:`Pre-built EPEL Linux executables (RHEL, CentOS) <epel>` - :ref:`Pre-built EPEL Linux executables (RHEL, CentOS) <epel>`
- :ref:`Pre-built OpenSuse Linux executables <opensuse>` - :ref:`Pre-built OpenSuse Linux executables <opensuse>`
@ -14,21 +15,50 @@ Binaries are available for different versions of Linux:
If you have questions about these pre-compiled LAMMPS executables, If you have questions about these pre-compiled LAMMPS executables,
you need to contact the people preparing those packages. The LAMMPS you need to contact the people preparing those packages. The LAMMPS
developers have no control over their choices of how they configure developers have no control over how they configure and build their
and build their packages and when they update them. packages and when they update them. They may only provide packages
for stable release versions and not always update the packages in a
timely fashion after a new LAMMPS release is made.
----------
.. _static:
Pre-built static Linux x86_64 executables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pre-built LAMMPS executables for Linux, that are statically linked and
compiled for 64-bit x86 CPUs (x86_64 or AMD64) are available for download
at `https://download.lammps.org/static/ <https://download.lammps.org/static/>`_.
Because of that static linkage (and unlike the Linux distribution specific
packages listed below), they do not depend on any installed software and
thus should run on *any* 64-bit x86 machine with *any* Linux version.
These executable include most of the available packages and multi-thread
parallelization (via INTEL, KOKKOS, or OPENMP package). They are **not**
compatible with MPI. Several of the LAMMPS tools executables (e.g. ``msi2lmp``)
and the ``lammps-shell`` program are included as well. Because of the
static linkage, there is no ``liblammps.so`` library file and thus also the
LAMMPS python module, which depends on it, is not included.
The compressed tar archives available for download have names following
the pattern ``lammps-linux-x86_64-<version>.tar.gz`` and will all unpack
into a ``lammps-static`` folder. The executables are then in the
``lammps-static/bin/`` folder. Since they do not depend on any other
software, they may be freely moved or copied around.
---------- ----------
.. _ubuntu: .. _ubuntu:
Pre-built Ubuntu Linux executables Pre-built Ubuntu and Debian Linux executables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A pre-built LAMMPS executable suitable for running on the latest Ubuntu A pre-built LAMMPS executable, suitable for running on the latest Ubuntu
Linux versions, can be downloaded as a Debian package. This allows you and Debian Linux versions, can be downloaded as a Debian package. This
to install LAMMPS with a single command, and stay (mostly) up-to-date allows you to install LAMMPS with a single command, and stay (mostly)
with the current stable version of LAMMPS by simply updating your up-to-date with the current stable version of LAMMPS by simply updating
operating system. your operating system.
To install LAMMPS do the following once: To install LAMMPS do the following once:
@ -38,8 +68,22 @@ To install LAMMPS do the following once:
This downloads an executable named ``lmp`` to your box and multiple This downloads an executable named ``lmp`` to your box and multiple
packages with supporting data, examples and libraries as well as any packages with supporting data, examples and libraries as well as any
missing dependencies. This executable can then be used in the usual way missing dependencies. For example, the LAMMPS binary in this package is
to run input scripts: built with the :ref:`KIM package <kim>` enabled, which results in the
above command also installing the ``kim-api`` binaries when LAMMPS is
installed, unless they were installed already. In order to use
potentials from `openkim.org <openkim_>`_, you can also install the
``openkim-models`` package:
.. code-block:: bash
sudo apt-get install openkim-models
Or use the `KIM-API commands <https://openkim.org/doc/usage/obtaining-models/#installing_api>`_
to download and install individual models.
This LAMMPS executable can then be used in the usual way to run input
scripts:
.. code-block:: bash .. code-block:: bash
@ -51,20 +95,9 @@ To update LAMMPS to the latest packaged version, do the following:
sudo apt-get update sudo apt-get update
which will also update other packages on your system. This will also update other packages on your system.
The ``lmp`` binary is built with the :ref:`KIM package <kim>` included, To uninstall LAMMPS, do the following:
which results in the above command also installing the ``kim-api``
binaries when LAMMPS is installed. In order to use potentials from
`openkim.org <openkim_>`_, you can also install the ``openkim-models``
package
.. code-block:: bash
sudo apt-get install openkim-models
Or use the KIM-API commands to download and install individual models.
To un-install LAMMPS, do the following:
.. code-block:: bash .. code-block:: bash
@ -83,8 +116,9 @@ Ubuntu package capability.
Pre-built Fedora Linux executables Pre-built Fedora Linux executables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pre-built LAMMPS packages for stable releases are available in the Pre-built `LAMMPS packages for stable releases
Fedora Linux distribution as of Fedora version 28. The packages can be <https://packages.fedoraproject.org/pkgs/lammps/>`_ are available in the
Fedora Linux distribution since Fedora version 28. The packages can be
installed via the dnf package manager. There are 3 basic varieties installed via the dnf package manager. There are 3 basic varieties
(lammps = no MPI, lammps-mpich = MPICH MPI library, lammps-openmpi = (lammps = no MPI, lammps-mpich = MPICH MPI library, lammps-openmpi =
OpenMPI MPI library) and for each support for linking to the C library OpenMPI MPI library) and for each support for linking to the C library
@ -109,7 +143,7 @@ To install LAMMPS with OpenMPI and run an input ``in.lj`` with 2 CPUs do:
The ``dnf install`` command is needed only once. In case of a new LAMMPS The ``dnf install`` command is needed only once. In case of a new LAMMPS
stable release, ``dnf update`` will automatically update to the newer stable release, ``dnf update`` will automatically update to the newer
version as soon at the RPM files are built and uploaded to the download version as soon as the RPM files are built and uploaded to the download
mirrors. The ``module load`` command is needed once per (shell) session mirrors. The ``module load`` command is needed once per (shell) session
or shell terminal instance, unless it is automatically loaded from the or shell terminal instance, unless it is automatically loaded from the
shell profile. shell profile.
@ -165,7 +199,7 @@ in OpenSuse as of Leap 15.0. You can install the package with:
zypper install lammps zypper install lammps
This includes support for OpenMPI. The name of the LAMMPS executable This includes support for OpenMPI. The name of the LAMMPS executable
is ``lmp``. Thus to run an input in parallel on 2 CPUs you would do: is ``lmp``. To run an input in parallel on 2 CPUs you would do:
.. code-block:: bash .. code-block:: bash
@ -192,17 +226,18 @@ Thanks to Christoph Junghans (LANL) for making LAMMPS available in OpenSuse.
Gentoo Linux executable Gentoo Linux executable
^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
LAMMPS is part of Gentoo's main package tree and can be installed by LAMMPS is part of `Gentoo's main package tree
typing: <https://packages.gentoo.org/packages/sci-physics/lammps>`_ and can be
installed by typing:
.. code-block:: bash .. code-block:: bash
emerge --ask lammps emerge --ask lammps
Note that in Gentoo the LAMMPS source is downloaded and the package is Note that in Gentoo the LAMMPS source code is downloaded and the package is
built on the your machine. then compiled and installed on your machine.
Certain LAMMPS packages can be enable via USE flags, type Certain LAMMPS packages can be enabled via USE flags, type
.. code-block:: bash .. code-block:: bash
@ -221,8 +256,11 @@ Archlinux build-script
^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
LAMMPS is available via Arch's unofficial Arch User repository (AUR). LAMMPS is available via Arch's unofficial Arch User repository (AUR).
There are three scripts available, named lammps, lammps-beta and lammps-git. There are three scripts available, named `lammps
They respectively package the stable, patch and git releases. <https://aur.archlinux.org/packages/lammps>`_, `lammps-beta
<https://aur.archlinux.org/packages/lammps>`_ and `lammps-git
<https://aur.archlinux.org/packages/lammps>`_. They respectively
package the stable, feature, and git releases.
To install, you will need to have the git package installed. You may use To install, you will need to have the git package installed. You may use
any of the above names in-place of lammps. any of the above names in-place of lammps.
@ -234,9 +272,9 @@ any of the above names in-place of lammps.
makepkg -s makepkg -s
makepkg -i makepkg -i
To update, you may repeat the above, or change into the cloned directory, To update LAMMPS, you may repeat the above, or change into the cloned
and execute the following, after which, if there are any changes, you may directory, and execute the following, after which, if there are any
use makepkg as above. changes, you may use makepkg as above.
.. code-block:: bash .. code-block:: bash
@ -244,12 +282,5 @@ use makepkg as above.
Alternatively, you may use an AUR helper to install these packages. Alternatively, you may use an AUR helper to install these packages.
Note that the AUR provides build-scripts that download the source and Note that the AUR provides build-scripts that download the source code
the build the package on your machine. and then build and install the package on your machine.
.. note::
It looks like the Arch Linux AUR repository build scripts for LAMMPS
have not been updated since the 29 October 2020 version. You may want
to consider installing a more current version of LAMMPS from source
directly.

View File

@ -2,10 +2,11 @@ Download an executable for Mac
------------------------------ ------------------------------
LAMMPS can be downloaded, built, and configured for OS X on a Mac with LAMMPS can be downloaded, built, and configured for OS X on a Mac with
`Homebrew <homebrew_>`_. (Alternatively, see the install instructions for `Homebrew <homebrew_>`_. (Alternatively, see the installation
:doc:`Download an executable via Conda <Install_conda>`.) The following LAMMPS instructions for :doc:`downloading an executable via Conda
packages are unavailable at this time because of additional needs not yet met: <Install_conda>`.) The following LAMMPS packages are unavailable at
GPU, KOKKOS, LATTE, MSCG, MPIIO, POEMS, VORONOI. this time because of additional requirements not yet met: GPU, KOKKOS,
LATTE, MSCG, MPIIO, POEMS, VORONOI.
After installing Homebrew, you can install LAMMPS on your system with After installing Homebrew, you can install LAMMPS on your system with
the following commands: the following commands:
@ -24,16 +25,16 @@ Lennard-Jones benchmark file:
brew test lammps -v brew test lammps -v
The LAMMPS binary is built with the :ref:`KIM package <kim>` which The LAMMPS binary is built with the :ref:`KIM package <kim>`, which
results in Homebrew also installing the `kim-api` binaries when LAMMPS is results in Homebrew also installing the `kim-api` binaries when LAMMPS
installed. In order to use potentials from `openkim.org <openkim_>`_, you can is installed. In order to use potentials from `openkim.org
install the `openkim-models` package <openkim_>`_, you can install the `openkim-models` package
.. code-block:: bash .. code-block:: bash
brew install openkim-models brew install openkim-models
If you have problems with the installation you can post issues to If you have problems with the installation, you can post issues to
`this link <https://github.com/Homebrew/homebrew-core/issues>`_. `this link <https://github.com/Homebrew/homebrew-core/issues>`_.
.. _homebrew: https://brew.sh .. _homebrew: https://brew.sh

View File

@ -9,17 +9,19 @@ of the `LAMMPS website <lws_>`_.
.. _older: https://download.lammps.org/tars/ .. _older: https://download.lammps.org/tars/
.. _lws: https://www.lammps.org .. _lws: https://www.lammps.org
You have two choices of tarballs, either the most recent stable You have two choices of tarballs, either the most recent stable release
release or the most current patch release. Stable releases occur a or the most recent feature release. Stable releases occur a few times
few times per year, and undergo more testing before release. Patch per year, and undergo more testing before release. Also, between stable
releases occur a couple times per month. The new contents in all releases bug fixes from the feature releases are back-ported and the
releases are listed on the `bug and feature page <bug_>`_ of the website. tarball occasionally updated. Feature releases occur every 4 to 8
weeks. The new contents in all feature releases are listed on the `bug
and feature page <bug_>`_ of the LAMMPS homepage.
Both tarballs include LAMMPS documentation (HTML and PDF files) Both tarballs include LAMMPS documentation (HTML and PDF files)
corresponding to that version. The download page also has an option corresponding to that version.
to download the current-version LAMMPS documentation by itself.
Older versions of LAMMPS can also be downloaded from `this page <older_>`_. Tarballs of older LAMMPS versions can also be downloaded from `this page
<older_>`_.
Once you have a tarball, unzip and untar it with the following Once you have a tarball, unzip and untar it with the following
command: command:
@ -36,13 +38,13 @@ in its name, e.g. lammps-23Jun18.
You can also download a compressed tar or zip archives from the You can also download a compressed tar or zip archives from the
"Assets" sections of the `LAMMPS GitHub releases site <git_>`_. "Assets" sections of the `LAMMPS GitHub releases site <git_>`_.
The file name will be lammps-<version>.zip which can be unzipped The file name will be lammps-<version>.zip which can be unzipped
with the following command, to create a lammps-<version> dir: with the following command, to create a lammps-<version> directory:
.. code-block:: bash .. code-block:: bash
unzip lammps*.zip unzip lammps*.zip
This version corresponds to the selected LAMMPS patch or stable This version corresponds to the selected LAMMPS feature or stable
release. release.
.. _git: https://github.com/lammps/lammps/releases .. _git: https://github.com/lammps/lammps/releases

View File

@ -17,11 +17,12 @@ install the Windows MPI package (MPICH2 from Argonne National Labs),
needed to run in parallel with MPI. needed to run in parallel with MPI.
The LAMMPS binaries contain *all* :doc:`optional packages <Packages>` The LAMMPS binaries contain *all* :doc:`optional packages <Packages>`
included in the source distribution except: KIM, KOKKOS, MSCG, PYTHON, included in the source distribution except: ADIOS, H5MD, KIM, ML-PACE,
ADIOS, H5MD, NETCDF, QMMM, ML-QUIP, and VTK. ML-QUIP, MSCG, NETCDF, PLUMED, QMMM, SCAFACOS, and VTK. The serial
The serial version also does not include the MPIIO and version also does not include the MPIIO and LATBOLTZ packages. The
LATBOLTZ packages. The GPU package is compiled for OpenCL with PYTHON package is only available in the Python installers that bundle a
mixed precision kernels. Python runtime. The GPU package is compiled for OpenCL with mixed
precision kernels.
The LAMMPS library is compiled as a shared library and the The LAMMPS library is compiled as a shared library and the
:doc:`LAMMPS Python module <Python_module>` is installed, so that :doc:`LAMMPS Python module <Python_module>` is installed, so that
@ -33,7 +34,7 @@ Windows, once it is installed, in both serial and parallel.
When you download the installer package, you run it on your Windows When you download the installer package, you run it on your Windows
machine. It will then prompt you with a dialog, where you can choose machine. It will then prompt you with a dialog, where you can choose
the installation directory, unpack and copy several executables, the installation directory, unpack and copy several executables,
potential files, documentation pdfs, selected example files, etc. It potential files, documentation PDFs, selected example files, etc. It
will then update a few system settings (e.g. PATH, LAMMPS_POTENTIALS) will then update a few system settings (e.g. PATH, LAMMPS_POTENTIALS)
and add an entry into the Start Menu (with references to the and add an entry into the Start Menu (with references to the
documentation, LAMMPS homepage and more). From that menu, there is documentation, LAMMPS homepage and more). From that menu, there is
@ -41,10 +42,10 @@ also a link to an uninstaller that removes the files and undoes the
environment manipulations. environment manipulations.
Note that to update to a newer version of LAMMPS, you should typically Note that to update to a newer version of LAMMPS, you should typically
uninstall the version you currently have, download a new installer, uninstall the version you currently have, download a new installer, and
and go through the install procedure described above. I.e. the same go through the installation procedure described above. I.e. the same
procedure for installing/updating most Windows programs. You can procedure for installing/updating most Windows programs. You can
install multiple versions of LAMMPS (in different directories), but install multiple versions of LAMMPS (in different directories), but only
only the executable for the last-installed package will be found the executable for the last-installed package will be found
automatically, so this should only be done for debugging purposes. automatically, so this should only be done for debugging purposes.

Some files were not shown because too many files have changed in this diff Show More