Merge branch 'develop' into gsalkuin/develop
This commit is contained in:
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
@ -101,7 +101,8 @@ src/group.* @sjplimp
|
|||||||
src/improper.* @sjplimp
|
src/improper.* @sjplimp
|
||||||
src/info.* @akohlmey
|
src/info.* @akohlmey
|
||||||
src/kspace.* @sjplimp
|
src/kspace.* @sjplimp
|
||||||
src/lmptyp.h @sjplimp
|
src/lmptype.h @sjplimp
|
||||||
|
src/label_map.* @jrgissing @akohlmey
|
||||||
src/library.* @sjplimp @akohlmey
|
src/library.* @sjplimp @akohlmey
|
||||||
src/main.cpp @sjplimp
|
src/main.cpp @sjplimp
|
||||||
src/min_*.* @sjplimp
|
src/min_*.* @sjplimp
|
||||||
|
|||||||
108
.github/release_steps.md
vendored
Normal file
108
.github/release_steps.md
vendored
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
# LAMMPS Release Steps
|
||||||
|
|
||||||
|
The following notes chronicle the current steps for preparing and publishing LAMMPS releases. For
|
||||||
|
definitions of LAMMPS versions and releases mean, please refer to [the corresponding section in the
|
||||||
|
LAMMPS manual](https://docs.lammps.org/Manual_version.html).
|
||||||
|
|
||||||
|
## LAMMPS Feature Release
|
||||||
|
|
||||||
|
A LAMMPS feature release is currently prepared after about 500 to 750 commits to the 'develop'
|
||||||
|
branch or after a period of four weeks up to two months. This is not a fixed rule, though, since
|
||||||
|
external circumstances can cause delays in preparing a release, or pull requests that are desired to
|
||||||
|
be merged for the release are not yet completed.
|
||||||
|
|
||||||
|
### Preparing a 'next\_release' branch
|
||||||
|
|
||||||
|
Create a 'next\_release' branch off 'develop' and make the following changes:
|
||||||
|
|
||||||
|
- set the LAMMPS\_VERSION define to the planned release date in src/version.h in the format
|
||||||
|
"D Mmm YYYY" or "DD Mmm YYYY"
|
||||||
|
- remove the LAMMPS\_UPDATE define in src/version.h
|
||||||
|
- update the release date in doc/lammps.1
|
||||||
|
- update all TBD arguments for ..versionadded::, ..versionchanged:: ..deprecated:: to the
|
||||||
|
planned release date in the format "DMmmYYYY" or "DDMmmYYYY"
|
||||||
|
- check release notes for merged new features and check if ..versionadded:: or ..versionchanged::
|
||||||
|
are missing and need to be added
|
||||||
|
Submit this pull request, rebase if needed. This is the last pull request merged for the release
|
||||||
|
and should not contain any other changes. (Exceptions: this document, last minute trivial(!) changes).
|
||||||
|
|
||||||
|
This PR shall not be merged before **all** pending tests have completed and cleared. If needed, a
|
||||||
|
bugfix pull request should be created and merged to clear all tests.
|
||||||
|
|
||||||
|
### Create release on GitHub
|
||||||
|
|
||||||
|
When all pending pull requests for the release are merged and have cleared testing, the
|
||||||
|
'next\_release' branch is merged into 'develop'.
|
||||||
|
|
||||||
|
Check out 'develop' locally, pull the latest changes, merge them into 'release', apply a suitable
|
||||||
|
release tag (for historical reasons the tag starts with "patch_" followed by the date, and finally
|
||||||
|
push everything back to GitHub. Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
git checkout develop
|
||||||
|
git pull
|
||||||
|
git checkout release
|
||||||
|
git pull
|
||||||
|
git merge --ff-only develop
|
||||||
|
git tag -s -m "LAMMPS feature release 19 November 2024" patch_19Nov2024
|
||||||
|
git push git@github.com:lammps/lammps.git --tags develop release
|
||||||
|
```
|
||||||
|
|
||||||
|
Go to https://github.com/lammps/lammps/releases and create a new (draft) release page or check the
|
||||||
|
existing draft for any necessary changes from pull requests that were merged but are not listed.
|
||||||
|
Then select the applied tag for the release in the "Choose a tag" dropdown list. Go to the bottom of
|
||||||
|
the list and select the "Set as pre-release" checkbox. The "Set as the latest release" button is
|
||||||
|
reserved for stable releases and updates to them.
|
||||||
|
|
||||||
|
If everything is in order, you can click on the "Publish release" button. Otherwise, click on "Save
|
||||||
|
draft" and finish pending tasks until you can return to edit the release page and publish it.
|
||||||
|
|
||||||
|
### Update download website, prepare pre-compiled packages, update packages to GitHub
|
||||||
|
|
||||||
|
Publishing the release on GitHub will trigger the Temple Jenkins cluster to update
|
||||||
|
the https://docs.lammps.org/ website with the documentation for the new feature release
|
||||||
|
and it will create a tarball for download (which contains the translated manual).
|
||||||
|
|
||||||
|
Build a fully static LAMMPS installation using a musl-libc cross-compiler, install into a
|
||||||
|
lammps-static folder, and create a tarball called lammps-linux-x86_64-19Nov2024.tar.gz (or using a
|
||||||
|
corresponding date with a future release) from the lammps-static folder and upload it to GitHub
|
||||||
|
with:
|
||||||
|
|
||||||
|
```
|
||||||
|
gh release upload patch_19Nov2024 ~/Downloads/lammps-linux-x86_64-19Nov2024.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## LAMMPS Stable Release
|
||||||
|
|
||||||
|
A LAMMPS stable release is prepared about once per year in the months July, August, or September.
|
||||||
|
One (or two, if needed) feature releases before the stable release shall contain only bug fixes
|
||||||
|
or minor feature updates in optional packages. Also substantial changes to the core of the code
|
||||||
|
shall be applied rather toward the beginning of a development cycle between two stable releases
|
||||||
|
than toward the end. The intention is to stablilize significant change to the core and have
|
||||||
|
outside users and developers try them out during the development cycle; the sooner the changes
|
||||||
|
are included, the better chances for spotting peripheral bugs and issues.
|
||||||
|
|
||||||
|
### Prerequesites
|
||||||
|
|
||||||
|
Before making a stable release all remaining backported bugfixes shall be released as a (final)
|
||||||
|
stable update release (see below).
|
||||||
|
|
||||||
|
A LAMMPS stable release process starts like a feature release (see above), only that this feature
|
||||||
|
release is called a "Stable Release Candidate" and no assets are uploaded to GitHub.
|
||||||
|
|
||||||
|
### Synchronize 'maintenance' branch with 'release'
|
||||||
|
|
||||||
|
The state of the 'release' branch is then transferred to the 'maintenance' branch (which will
|
||||||
|
have diverged significantly from 'release' due to the selectively backported bug fixes).
|
||||||
|
|
||||||
|
### Fast-forward merge of 'maintenance' into 'stable' and apply tag
|
||||||
|
|
||||||
|
At this point it should be possible to do a fast-forward merge of 'maintenance' to 'stable'
|
||||||
|
and then apply the stable\_DMmmYYYY tag.
|
||||||
|
|
||||||
|
### Push branches and tags
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## LAMMPS Stable Update Release
|
||||||
14
.github/workflows/kokkos-regression.yaml
vendored
14
.github/workflows/kokkos-regression.yaml
vendored
@ -2,7 +2,7 @@
|
|||||||
name: "Kokkos OpenMP Regression Test"
|
name: "Kokkos OpenMP Regression Test"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- develop
|
- develop
|
||||||
|
|
||||||
@ -17,9 +17,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 4
|
max-parallel: 6
|
||||||
matrix:
|
matrix:
|
||||||
idx: [ 'pair', 'fix', 'compute', 'misc' ]
|
idx: [ 'pair-0', 'pair-1', 'fix-0', 'fix-1', 'compute', 'misc' ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@ -83,6 +83,7 @@ jobs:
|
|||||||
-D PKG_REAXFF=on \
|
-D PKG_REAXFF=on \
|
||||||
-D PKG_REPLICA=on \
|
-D PKG_REPLICA=on \
|
||||||
-D PKG_SRD=on \
|
-D PKG_SRD=on \
|
||||||
|
-D PKG_SPH=on \
|
||||||
-D PKG_VORONOI=on \
|
-D PKG_VORONOI=on \
|
||||||
-G Ninja
|
-G Ninja
|
||||||
cmake --build build
|
cmake --build build
|
||||||
@ -93,9 +94,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
source linuxenv/bin/activate
|
source linuxenv/bin/activate
|
||||||
python3 tools/regression-tests/get_kokkos_input.py \
|
python3 tools/regression-tests/get_kokkos_input.py \
|
||||||
--examples-top-level=examples \
|
--examples-top-level=examples --batch-size=50 \
|
||||||
--filter-out="balance;fire;gcmc;granregion;mdi;mliap;neb;pace;prd;pour;python;snap"
|
--filter-out="balance;fire;gcmc;granregion;hyper;mc;mdi;mliap;neb;pace;prd;pour;python;rigid;snap;streitz;shear;ttm"
|
||||||
|
|
||||||
|
export OMP_PROC_BIND=false
|
||||||
python3 tools/regression-tests/run_tests.py \
|
python3 tools/regression-tests/run_tests.py \
|
||||||
--lmp-bin=build/lmp \
|
--lmp-bin=build/lmp \
|
||||||
--config-file=tools/regression-tests/config_kokkos_openmp.yaml \
|
--config-file=tools/regression-tests/config_kokkos_openmp.yaml \
|
||||||
@ -103,7 +105,7 @@ jobs:
|
|||||||
--output-file=output-${{ matrix.idx }}.xml \
|
--output-file=output-${{ matrix.idx }}.xml \
|
||||||
--progress-file=progress-${{ matrix.idx }}.yaml \
|
--progress-file=progress-${{ matrix.idx }}.yaml \
|
||||||
--log-file=run-${{ matrix.idx }}.log \
|
--log-file=run-${{ matrix.idx }}.log \
|
||||||
--quick-max=100 --verbose
|
--quick-max=100
|
||||||
|
|
||||||
tar -cvf kokkos-regression-test-${{ matrix.idx }}.tar run-${{ matrix.idx }}.log progress-${{ matrix.idx }}.yaml output-${{ matrix.idx }}.xml
|
tar -cvf kokkos-regression-test-${{ matrix.idx }}.tar run-${{ matrix.idx }}.log progress-${{ matrix.idx }}.yaml output-${{ matrix.idx }}.xml
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
# CMake build system
|
# CMake build system
|
||||||
# This file is part of LAMMPS
|
# This file is part of LAMMPS
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.20)
|
||||||
|
message(WARNING "LAMMPS is planning to require at least CMake version 3.20 by Summer 2025. Please upgrade!")
|
||||||
|
endif()
|
||||||
########################################
|
########################################
|
||||||
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
||||||
if(POLICY CMP0074)
|
if(POLICY CMP0074)
|
||||||
@ -141,19 +144,31 @@ endif()
|
|||||||
|
|
||||||
# silence nvcc warnings
|
# silence nvcc warnings
|
||||||
if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||||
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma -Xcudafe --diag_suppress=128")
|
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT}" "-Xcudafe --diag_suppress=unrecognized_pragma,--diag_suppress=128")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# we require C++11 without extensions. Kokkos requires at least C++17 (currently)
|
# we *require* C++11 without extensions but prefer C++17.
|
||||||
|
# Kokkos requires at least C++17 (currently)
|
||||||
if(NOT CMAKE_CXX_STANDARD)
|
if(NOT CMAKE_CXX_STANDARD)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
if(cxx_std_17 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_CXX_STANDARD LESS 11)
|
if(CMAKE_CXX_STANDARD LESS 11)
|
||||||
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
||||||
endif()
|
endif()
|
||||||
|
if(CMAKE_CXX_STANDARD LESS 17)
|
||||||
|
message(WARNING "Selecting C++17 standard is preferred over C++${CMAKE_CXX_STANDARD}")
|
||||||
|
endif()
|
||||||
if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 17))
|
if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 17))
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
endif()
|
endif()
|
||||||
|
# turn off C++17 check in lmptype.h
|
||||||
|
if(LAMMPS_CXX11)
|
||||||
|
add_compile_definitions(LAMMPS_CXX11)
|
||||||
|
endif()
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
||||||
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
||||||
@ -347,6 +362,17 @@ foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
|||||||
option(PKG_${PKG} "Build ${PKG} Package" OFF)
|
option(PKG_${PKG} "Build ${PKG} Package" OFF)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
set(DEPRECATED_PACKAGES AWPMD ATC POEMS)
|
||||||
|
foreach(PKG ${DEPRECATED_PACKAGES})
|
||||||
|
if(PKG_${PKG})
|
||||||
|
message(WARNING
|
||||||
|
"The ${PKG} package will be removed from LAMMPS in Summer 2025 due to lack of "
|
||||||
|
"maintenance and use of code constructs that conflict with modern C++ compilers "
|
||||||
|
"and standards. Please contact developers@lammps.org if you have any concerns "
|
||||||
|
"about this step.")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
# packages with special compiler needs or external libs
|
# packages with special compiler needs or external libs
|
||||||
######################################################
|
######################################################
|
||||||
@ -588,13 +614,8 @@ endif()
|
|||||||
|
|
||||||
set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine specific optimization flags (compilation only)")
|
set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine specific optimization flags (compilation only)")
|
||||||
separate_arguments(CMAKE_TUNE_FLAGS)
|
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
target_compile_options(lammps PRIVATE ${CMAKE_TUNE_FLAGS})
|
||||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
target_compile_options(lmp PRIVATE ${CMAKE_TUNE_FLAGS})
|
||||||
# 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})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Basic system tests (standard libraries, headers, functions, types) #
|
# Basic system tests (standard libraries, headers, functions, types) #
|
||||||
########################################################################
|
########################################################################
|
||||||
@ -1083,12 +1104,15 @@ if(BUILD_TOOLS)
|
|||||||
message(STATUS "<<< Building Tools >>>")
|
message(STATUS "<<< Building Tools >>>")
|
||||||
endif()
|
endif()
|
||||||
if(BUILD_LAMMPS_GUI)
|
if(BUILD_LAMMPS_GUI)
|
||||||
message(STATUS "<<< Building LAMMPS GUI >>>")
|
message(STATUS "<<< Building LAMMPS-GUI >>>")
|
||||||
if(LAMMPS_GUI_USE_PLUGIN)
|
if(LAMMPS_GUI_USE_PLUGIN)
|
||||||
message(STATUS "Loading LAMMPS library as plugin at run time")
|
message(STATUS "Loading LAMMPS library as plugin at run time")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Linking LAMMPS library at compile time")
|
message(STATUS "Linking LAMMPS library at compile time")
|
||||||
endif()
|
endif()
|
||||||
|
if(BUILD_WHAM)
|
||||||
|
message(STATUS "<<< Building WHAM >>>")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(ENABLE_TESTING)
|
if(ENABLE_TESTING)
|
||||||
message(STATUS "<<< Building Unit Tests >>>")
|
message(STATUS "<<< Building Unit Tests >>>")
|
||||||
|
|||||||
@ -7,26 +7,13 @@ endif()
|
|||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# consistency checks and Kokkos options/settings required by LAMMPS
|
# consistency checks and Kokkos options/settings required by LAMMPS
|
||||||
if(Kokkos_ENABLE_CUDA)
|
|
||||||
option(Kokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC "CUDA asynchronous malloc support" OFF)
|
|
||||||
mark_as_advanced(Kokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC)
|
|
||||||
if(Kokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC)
|
|
||||||
message(STATUS "KOKKOS: CUDA malloc async support enabled")
|
|
||||||
else()
|
|
||||||
message(STATUS "KOKKOS: CUDA malloc async support disabled")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(Kokkos_ENABLE_HIP)
|
if(Kokkos_ENABLE_HIP)
|
||||||
option(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS "Enable multiple kernel instantiations with HIP" ON)
|
option(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS "Enable multiple kernel instantiations with HIP" ON)
|
||||||
mark_as_advanced(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS)
|
mark_as_advanced(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS)
|
||||||
option(Kokkos_ENABLE_ROCTHRUST "Use RoCThrust library" ON)
|
option(Kokkos_ENABLE_ROCTHRUST "Use RoCThrust library" ON)
|
||||||
mark_as_advanced(Kokkos_ENABLE_ROCTHRUST)
|
mark_as_advanced(Kokkos_ENABLE_ROCTHRUST)
|
||||||
|
|
||||||
if(Kokkos_ARCH_AMD_GFX942 OR Kokkos_ARCH_AMD_GFX940)
|
|
||||||
option(Kokkos_ENABLE_IMPL_HIP_UNIFIED_MEMORY "Enable unified memory with HIP" ON)
|
|
||||||
mark_as_advanced(Kokkos_ENABLE_IMPL_HIP_UNIFIED_MEMORY)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Adding OpenMP compiler flags without the checks done for
|
# Adding OpenMP compiler flags without the checks done for
|
||||||
# BUILD_OMP can result in compile failures. Enforce consistency.
|
# BUILD_OMP can result in compile failures. Enforce consistency.
|
||||||
if(Kokkos_ENABLE_OPENMP)
|
if(Kokkos_ENABLE_OPENMP)
|
||||||
@ -70,8 +57,8 @@ 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/4.4.01.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/4.5.01.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
||||||
set(KOKKOS_MD5 "de6ee80d00b6212b02bfb7f1e71a8392" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
set(KOKKOS_MD5 "4d832aa0284169d9e3fbae3165286bc6" 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)
|
GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK)
|
||||||
@ -96,7 +83,7 @@ if(DOWNLOAD_KOKKOS)
|
|||||||
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 4.4.01 REQUIRED CONFIG)
|
find_package(Kokkos 4.5.01 REQUIRED CONFIG)
|
||||||
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
target_link_libraries(lammps 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)
|
||||||
@ -130,6 +117,7 @@ set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp
|
|||||||
${KOKKOS_PKG_SOURCES_DIR}/atom_vec_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/atom_vec_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/comm_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/comm_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/comm_tiled_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/comm_tiled_kokkos.cpp
|
||||||
|
${KOKKOS_PKG_SOURCES_DIR}/group_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/min_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/min_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/min_linesearch_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/min_linesearch_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/neighbor_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/neighbor_kokkos.cpp
|
||||||
|
|||||||
@ -1,50 +1,62 @@
|
|||||||
# PACE library support for ML-PACE package
|
# PACE library support for ML-PACE package
|
||||||
|
find_package(pace QUIET)
|
||||||
|
|
||||||
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
|
if(pace_FOUND)
|
||||||
if(POLICY CMP0135)
|
find_package(pace)
|
||||||
cmake_policy(SET CMP0135 OLD)
|
target_link_libraries(lammps PRIVATE pace::pace)
|
||||||
endif()
|
|
||||||
|
|
||||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
|
||||||
set(PACELIB_MD5 "b45de9a633f42ed65422567e3ce56f9f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
|
||||||
mark_as_advanced(PACELIB_URL)
|
|
||||||
mark_as_advanced(PACELIB_MD5)
|
|
||||||
GetFallbackURL(PACELIB_URL PACELIB_FALLBACK)
|
|
||||||
|
|
||||||
# LOCAL_ML-PACE points to top-level dir with local lammps-user-pace repo,
|
|
||||||
# to make it easier to check local build without going through the public github releases
|
|
||||||
if(LOCAL_ML-PACE)
|
|
||||||
set(lib-pace "${LOCAL_ML-PACE}")
|
|
||||||
else()
|
else()
|
||||||
# download library sources to build folder
|
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
|
||||||
if(EXISTS ${CMAKE_BINARY_DIR}/libpace.tar.gz)
|
if(POLICY CMP0135)
|
||||||
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
cmake_policy(SET CMP0135 OLD)
|
||||||
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()
|
endif()
|
||||||
else()
|
|
||||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix2.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||||
endif()
|
set(PACELIB_MD5 "a53bd87cfee8b07d9f44bc17aad69c3f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||||
|
mark_as_advanced(PACELIB_URL)
|
||||||
|
mark_as_advanced(PACELIB_MD5)
|
||||||
|
GetFallbackURL(PACELIB_URL PACELIB_FALLBACK)
|
||||||
|
|
||||||
|
# LOCAL_ML-PACE points to top-level dir with local lammps-user-pace repo,
|
||||||
|
# to make it easier to check local build without going through the public github releases
|
||||||
|
if(LOCAL_ML-PACE)
|
||||||
|
set(lib-pace "${LOCAL_ML-PACE}")
|
||||||
|
else()
|
||||||
|
# download library sources to build folder
|
||||||
|
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(
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
|
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
|
||||||
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
)
|
)
|
||||||
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(${lib-pace} build-pace)
|
# some preinstalled yaml-cpp versions don't provide a namespaced target
|
||||||
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
|
find_package(yaml-cpp QUIET)
|
||||||
|
if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
|
||||||
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
|
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
|
||||||
target_link_libraries(lammps PRIVATE pace)
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(${lib-pace} build-pace)
|
||||||
|
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
|
||||||
|
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
|
||||||
|
target_link_libraries(lammps PRIVATE pace)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
# FindVTK requires that C support is enabled when looking for MPI support
|
||||||
|
enable_language(C)
|
||||||
find_package(VTK REQUIRED NO_MODULE)
|
find_package(VTK REQUIRED NO_MODULE)
|
||||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_VTK)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_VTK)
|
||||||
if (VTK_MAJOR_VERSION VERSION_LESS 9.0)
|
if (VTK_MAJOR_VERSION VERSION_LESS 9.0)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ Last change: 2022-12-30
|
|||||||
|
|
||||||
In fall 2019, the LAMMPS documentation file format has changed from a
|
In fall 2019, the LAMMPS documentation file format has changed from a
|
||||||
home grown markup designed to generate HTML format files only, to
|
home grown markup designed to generate HTML format files only, to
|
||||||
[reStructuredText](https://docutils.sourceforge.io/rst.html>. For a
|
[reStructuredText](https://docutils.sourceforge.io/rst.html>). For a
|
||||||
transition period all files in the old .txt format were transparently
|
transition period all files in the old .txt format were transparently
|
||||||
converted to .rst and then processed. The `txt2rst tool` is still
|
converted to .rst and then processed. The `txt2rst tool` is still
|
||||||
included in the distribution to obtain an initial .rst file for legacy
|
included in the distribution to obtain an initial .rst file for legacy
|
||||||
@ -45,8 +45,7 @@ what kind of information and sections are needed.
|
|||||||
|
|
||||||
## Formatting conventions
|
## Formatting conventions
|
||||||
|
|
||||||
For headlines we try to follow the conventions posted here:
|
For headlines we try to follow the conventions posted [here](https://documentation-style-guide-sphinx.readthedocs.io/en/latest/style-guide.html#headings).
|
||||||
https://documentation-style-guide-sphinx.readthedocs.io/en/latest/style-guide.html#headings
|
|
||||||
It seems to be sufficient to have this consistent only within
|
It seems to be sufficient to have this consistent only within
|
||||||
any single file and it is not (yet) enforced strictly, but making
|
any single file and it is not (yet) enforced strictly, but making
|
||||||
this globally consistent makes it easier to move sections around.
|
this globally consistent makes it easier to move sections around.
|
||||||
@ -64,7 +63,7 @@ Groups of shell commands or LAMMPS input script or C/C++/Python source
|
|||||||
code should be typeset into a `.. code-block::` section. A syntax
|
code should be typeset into a `.. code-block::` section. A syntax
|
||||||
highlighting extension for LAMMPS input scripts is provided, so `LAMMPS`
|
highlighting extension for LAMMPS input scripts is provided, so `LAMMPS`
|
||||||
can be used to indicate the language in the code block in addition to
|
can be used to indicate the language in the code block in addition to
|
||||||
`bash`, `c`, `c++`, `console`, `csh`, `diff', `fortran`, `json`, `make`,
|
`bash`, `c`, `c++`, `console`, `csh`, `diff`, `fortran`, `json`, `make`,
|
||||||
`perl`, `powershell`, `python`, `sh`, or `tcl`, `text`, or `yaml`. When
|
`perl`, `powershell`, `python`, `sh`, or `tcl`, `text`, or `yaml`. When
|
||||||
no syntax style is indicated, no syntax highlighting is performed. When
|
no syntax style is indicated, no syntax highlighting is performed. When
|
||||||
typesetting commands executed on the shell, please do not prefix
|
typesetting commands executed on the shell, please do not prefix
|
||||||
@ -84,7 +83,7 @@ block can be used, followed by multiple `.. tab::` blocks, one
|
|||||||
for each alternative. This is only used for HTML output. For other
|
for each alternative. This is only used for HTML output. For other
|
||||||
outputs, the `.. tabs::` directive is transparently removed and
|
outputs, the `.. tabs::` directive is transparently removed and
|
||||||
the individual `.. tab::` blocks will be replaced with an
|
the individual `.. tab::` blocks will be replaced with an
|
||||||
`.. admonition::`` block. Thus in PDF and ePUB output those will
|
`.. admonition::` block. Thus in PDF and ePUB output those will
|
||||||
be realized as sequential and plain notes.
|
be realized as sequential and plain notes.
|
||||||
|
|
||||||
Special remarks can be highlighted with a `.. note::` block and
|
Special remarks can be highlighted with a `.. note::` block and
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
DOXYFILE_ENCODING = UTF-8
|
DOXYFILE_ENCODING = UTF-8
|
||||||
PROJECT_NAME = "LAMMPS Programmer's Guide"
|
PROJECT_NAME = "LAMMPS Programmer's Guide"
|
||||||
PROJECT_NUMBER = "4 May 2022"
|
PROJECT_NUMBER = "19 November 2024"
|
||||||
PROJECT_BRIEF = "Documentation of the LAMMPS library interface and Python wrapper"
|
PROJECT_BRIEF = "Documentation of the LAMMPS library interface and Python wrapper"
|
||||||
PROJECT_LOGO = lammps-logo.png
|
PROJECT_LOGO = lammps-logo.png
|
||||||
CREATE_SUBDIRS = NO
|
CREATE_SUBDIRS = NO
|
||||||
|
|||||||
@ -6,7 +6,9 @@ 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 it accordingly. Last change 2023-02-10.
|
adapt it accordingly.
|
||||||
|
|
||||||
|
Last change: 2023-02-10
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@ -72,7 +74,7 @@ be assigned to signal urgency to merge this pull request quickly.
|
|||||||
People can be assigned to review a pull request in two ways:
|
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 developer's GitHub
|
* They can be automatically assigned, because a developer's GitHub
|
||||||
handle matches a file pattern in the `.github/CODEOWNERS` file,
|
handle matches a file pattern in the `.github/CODEOWNERS` file,
|
||||||
which associates developers with the code they contributed and
|
which associates developers with the code they contributed and
|
||||||
@ -86,9 +88,9 @@ required before merging, in addition to passing all automated
|
|||||||
compilation and unit tests. Merging counts as implicit approval, so
|
compilation and unit tests. Merging counts as implicit approval, so
|
||||||
does submission of a pull request (by a LAMMPS developer). So the person
|
does submission of a pull request (by a LAMMPS developer). So the person
|
||||||
doing the merge may not also submit an approving review. The GitHub
|
doing the merge may not also submit an approving review. The GitHub
|
||||||
feature, that reviews from code owners are "hard" reviews (i.e. they
|
feature that reviews from code owners are "hard" reviews (i.e. they
|
||||||
must all approve before merging is allowed), is currently disabled.
|
must all approve before merging is allowed) is currently disabled.
|
||||||
It is in the discretion of the merge maintainer to assess when a
|
It is at the discretion of the merge maintainer to assess when a
|
||||||
sufficient degree of approval has been reached, especially from external
|
sufficient degree of approval has been reached, especially from external
|
||||||
collaborators. Reviews may be (automatically) dismissed, when the
|
collaborators. Reviews may be (automatically) dismissed, when the
|
||||||
reviewed code has been changed. Review may be requested a second time.
|
reviewed code has been changed. Review may be requested a second time.
|
||||||
@ -147,7 +149,8 @@ only contain bug fixes, feature additions to peripheral functionality,
|
|||||||
and documentation updates. In between stable releases, bug fixes and
|
and documentation updates. In between stable releases, bug fixes and
|
||||||
infrastructure updates are back-ported from the "develop" branch to the
|
infrastructure updates are back-ported from the "develop" branch to the
|
||||||
"maintenance" branch and occasionally merged into "stable" and published
|
"maintenance" branch and occasionally merged into "stable" and published
|
||||||
as update releases.
|
as update releases. Further explanation of LAMMPS versions can be found
|
||||||
|
[in the documentation](https://docs.lammps.org/Manual_version.html).
|
||||||
|
|
||||||
## Project Management
|
## Project Management
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
.TH LAMMPS "1" "29 August 2024" "2024-08-29"
|
.TH LAMMPS "1" "19 November 2024" "2024-11-19"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B LAMMPS
|
.B LAMMPS
|
||||||
\- Molecular Dynamics Simulator. Version 29 August 2024
|
\- Molecular Dynamics Simulator. Version 19 November 2024
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B lmp
|
.B lmp
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
Build LAMMPS
|
Build LAMMPS
|
||||||
============
|
============
|
||||||
|
|
||||||
LAMMPS is built as a library and an executable from source code using
|
LAMMPS is built as a library and an executable from source code using a
|
||||||
either traditional makefiles for use with GNU make (which may require
|
build environment generated by CMake (Unix Makefiles, Ninja, Xcode,
|
||||||
manual editing), or using a build environment generated by CMake (Unix
|
Visual Studio, KDevelop, CodeBlocks and more depending on the platform).
|
||||||
Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more).
|
Using CMake is the preferred way to build LAMMPS. In addition, LAMMPS
|
||||||
|
can be compiled using the legacy build system based on traditional
|
||||||
|
makefiles for use with GNU make (which may require manual editing).
|
||||||
|
Support for the legacy build system is slowly being phased out and may
|
||||||
|
not be available for all optional features.
|
||||||
|
|
||||||
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 in the :doc:`Install <Install>`
|
or automated build trees, as described in the :doc:`Install <Install>`
|
||||||
|
|||||||
@ -160,7 +160,7 @@ with the OpenMP 3.1 semantics used in LAMMPS for maximal compatibility
|
|||||||
with compiler versions in use. If compilation with OpenMP enabled fails
|
with compiler versions in use. If compilation with OpenMP enabled fails
|
||||||
because of your compiler requiring strict OpenMP 4.0 semantics, you can
|
because of your compiler requiring strict OpenMP 4.0 semantics, you can
|
||||||
change the behavior by adding ``-D LAMMPS_OMP_COMPAT=4`` to the
|
change the behavior by adding ``-D LAMMPS_OMP_COMPAT=4`` to the
|
||||||
``LMP_INC`` variable in your makefile, or add it to the command line
|
``LMP_INC`` variable in your makefile, or add it to the command-line flags
|
||||||
while configuring with CMake. LAMMPS will auto-detect a suitable setting
|
while configuring with CMake. LAMMPS will auto-detect a suitable setting
|
||||||
for most GNU, Clang, and Intel compilers.
|
for most GNU, Clang, and Intel compilers.
|
||||||
|
|
||||||
@ -502,6 +502,8 @@ using CMake or Make.
|
|||||||
# chain.x, micelle2d.x, msi2lmp, phana,
|
# chain.x, micelle2d.x, msi2lmp, phana,
|
||||||
# stl_bin2txt
|
# stl_bin2txt
|
||||||
-D BUILD_LAMMPS_GUI=value # yes or no (default). Build LAMMPS-GUI
|
-D BUILD_LAMMPS_GUI=value # yes or no (default). Build LAMMPS-GUI
|
||||||
|
-D BUILD_WHAM=value # yes (default). Download and build WHAM;
|
||||||
|
# only available for BUILD_LAMMPS_GUI=yes
|
||||||
|
|
||||||
The generated binaries will also become part of the LAMMPS installation
|
The generated binaries will also become part of the LAMMPS installation
|
||||||
(see below).
|
(see below).
|
||||||
|
|||||||
@ -8,7 +8,7 @@ packages. Links to those pages on the :doc:`Build overview <Build>`
|
|||||||
page.
|
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, to change the
|
itself, the text mode or graphical user interface, to change the
|
||||||
generated output files for different build tools and development
|
generated output files for different build tools and development
|
||||||
@ -16,7 +16,7 @@ environments is on a :doc:`separate page <Howto_cmake>`.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
LAMMPS currently requires that CMake version 3.16 or later is available.
|
LAMMPS currently requires that CMake version 3.20 or later is available.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
@ -32,22 +32,22 @@ environments is on a :doc:`separate page <Howto_cmake>`.
|
|||||||
Advantages of using CMake
|
Advantages of using CMake
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
CMake is an alternative to compiling LAMMPS in the traditional way
|
CMake is the preferred way of compiling LAMMPS in contrast to the legacy
|
||||||
through :doc:`(manually customized) makefiles <Build_make>`. Using
|
build system based on GNU make and through :doc:`(manually customized)
|
||||||
CMake has multiple advantages that are specifically helpful for
|
makefiles <Build_make>`. Using CMake has multiple advantages that are
|
||||||
people with limited experience in compiling software or for people
|
specifically helpful for people with limited experience in compiling
|
||||||
that want to modify or extend LAMMPS.
|
software or for people that want to modify or extend LAMMPS.
|
||||||
|
|
||||||
- CMake can detect available hardware, tools, features, and libraries
|
- CMake can detect available hardware, tools, features, and libraries
|
||||||
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 command line, text
|
- CMake supports customization of settings with a command-line, text
|
||||||
mode, or graphical user interface. No manual editing of files,
|
mode, or graphical user interface. No manual editing of files,
|
||||||
knowledge of file formats or complex command line syntax is required.
|
knowledge of file formats or 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
|
||||||
and settings with different choices of LAMMPS packages, settings, or
|
and settings with different choices of LAMMPS packages, settings, or
|
||||||
compilers can be configured and built concurrently from the same
|
compilers can be configured and built concurrently from the same
|
||||||
source tree.
|
source tree.
|
||||||
@ -68,7 +68,7 @@ that purpose you can use either the command-line utility ``cmake`` (or
|
|||||||
graphical utility ``cmake-gui``, or use them interchangeably. The
|
graphical utility ``cmake-gui``, or use them interchangeably. The
|
||||||
second step is then the compilation and linking of all objects,
|
second step is then the compilation and linking of all objects,
|
||||||
libraries, and executables using the selected build tool. Here is a
|
libraries, and executables using the selected build tool. Here is a
|
||||||
minimal example using the command line version of CMake to build LAMMPS
|
minimal example using the command-line version of CMake to build LAMMPS
|
||||||
with no add-on packages enabled and no customization:
|
with no add-on packages enabled and no customization:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -131,7 +131,7 @@ file called ``CMakeLists.txt`` (for LAMMPS it is located in the
|
|||||||
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
|
To modify settings, enable or disable features, you need to set
|
||||||
*variables* with either the ``-D`` command line flag (``-D
|
*variables* with either the ``-D`` command-line flag (``-D
|
||||||
VARIABLE1_NAME=value``) or change them in the text mode of the graphical
|
VARIABLE1_NAME=value``) or change them in the text mode of the graphical
|
||||||
user interface. The ``-D`` flag can be used several times in one command.
|
user interface. The ``-D`` flag can be used several times in one command.
|
||||||
|
|
||||||
@ -141,11 +141,11 @@ 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
|
||||||
once, as the settings from the preset files are stored in the
|
once, as the settings from the preset files are stored in the
|
||||||
``CMakeCache.txt`` file. It is also possible to customize the build
|
``CMakeCache.txt`` file. It is also possible to customize the build
|
||||||
by adding one or more ``-D`` flags to the CMake command line.
|
by adding one or more ``-D`` flags to the CMake command.
|
||||||
|
|
||||||
Generating files for alternate build tools (e.g. Ninja) and project files
|
Generating files for alternate build tools (e.g. Ninja) and project files
|
||||||
for IDEs like Eclipse, CodeBlocks, or Kate can be selected using the ``-G``
|
for IDEs like Eclipse, CodeBlocks, or Kate can be selected using the ``-G``
|
||||||
command line flag. A list of available generator settings for your
|
command-line flag. A list of available generator settings for your
|
||||||
specific CMake version is given when running ``cmake --help``.
|
specific CMake version is given when running ``cmake --help``.
|
||||||
|
|
||||||
.. _cmake_multiconfig:
|
.. _cmake_multiconfig:
|
||||||
|
|||||||
@ -263,9 +263,9 @@ will be skipped if prerequisite features are not available in LAMMPS.
|
|||||||
time. Preference is given to parts of the code base that are easy to
|
time. Preference is given to parts of the code base that are easy to
|
||||||
test or commonly used.
|
test or commonly used.
|
||||||
|
|
||||||
Tests as shown by the ``ctest`` program are command lines defined in the
|
Tests as shown by the ``ctest`` program are commands defined in the
|
||||||
``CMakeLists.txt`` files in the ``unittest`` directory tree. A few
|
``CMakeLists.txt`` files in the ``unittest`` directory tree. A few
|
||||||
tests simply execute LAMMPS with specific command line flags and check
|
tests simply execute LAMMPS with specific command-line flags and check
|
||||||
the output to the screen for expected content. A large number of unit
|
the output to the screen for expected content. A large number of unit
|
||||||
tests are special tests programs using the `GoogleTest framework
|
tests are special tests programs using the `GoogleTest framework
|
||||||
<https://github.com/google/googletest/>`_ and linked to the LAMMPS
|
<https://github.com/google/googletest/>`_ and linked to the LAMMPS
|
||||||
@ -420,7 +420,7 @@ during MD timestepping and manipulate per-atom properties like
|
|||||||
positions, velocities, and forces. For those fix styles, testing can be
|
positions, velocities, and forces. For those fix styles, testing can be
|
||||||
done in a very similar fashion as for force fields and thus there is a
|
done in a very similar fashion as for force fields and thus there is a
|
||||||
test program `test_fix_timestep` that shares a lot of code, properties,
|
test program `test_fix_timestep` that shares a lot of code, properties,
|
||||||
and command line flags with the force field style testers described in
|
and command-line flags with the force field style testers described in
|
||||||
the previous section.
|
the previous section.
|
||||||
|
|
||||||
This tester will set up a small molecular system run with verlet run
|
This tester will set up a small molecular system run with verlet run
|
||||||
@ -642,10 +642,10 @@ The following target are available for both, GNU make and CMake:
|
|||||||
|
|
||||||
.. _gh-cli:
|
.. _gh-cli:
|
||||||
|
|
||||||
GitHub command line interface
|
GitHub command-line interface
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
GitHub has developed a `command line tool <https://cli.github.com>`_
|
GitHub has developed a `command-line tool <https://cli.github.com>`_
|
||||||
to interact with the GitHub website via a command called ``gh``.
|
to interact with the GitHub website via a command called ``gh``.
|
||||||
This is extremely convenient when working with a Git repository hosted
|
This is extremely convenient when working with a Git repository hosted
|
||||||
on GitHub (like LAMMPS). It is thus highly recommended to install it
|
on GitHub (like LAMMPS). It is thus highly recommended to install it
|
||||||
|
|||||||
@ -209,7 +209,7 @@ necessary for ``hipcc`` and the linker to work correctly.
|
|||||||
Using the CHIP-SPV implementation of HIP is supported. It allows one to
|
Using the CHIP-SPV implementation of HIP is supported. It allows one to
|
||||||
run HIP code on Intel GPUs via the OpenCL or Level Zero back ends. To use
|
run HIP code on Intel GPUs via the OpenCL or Level Zero back ends. To use
|
||||||
CHIP-SPV, you must set ``-DHIP_USE_DEVICE_SORT=OFF`` in your CMake
|
CHIP-SPV, you must set ``-DHIP_USE_DEVICE_SORT=OFF`` in your CMake
|
||||||
command line as CHIP-SPV does not yet support hipCUB. As of Summer 2022,
|
command-line as CHIP-SPV does not yet support hipCUB. As of Summer 2022,
|
||||||
the use of HIP for Intel GPUs is experimental. You should only use this
|
the use of HIP for Intel GPUs is experimental. You should only use this
|
||||||
option in preparations to run on Aurora system at Argonne.
|
option in preparations to run on Aurora system at Argonne.
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ option in preparations to run on Aurora system at Argonne.
|
|||||||
|
|
||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
# CUDA target (not recommended, use GPU_ARCH=cuda)
|
# CUDA target (not recommended, use GPU_API=cuda)
|
||||||
# !!! DO NOT set CMAKE_CXX_COMPILER !!!
|
# !!! DO NOT set CMAKE_CXX_COMPILER !!!
|
||||||
export HIP_PLATFORM=nvcc
|
export HIP_PLATFORM=nvcc
|
||||||
export HIP_PATH=/path/to/HIP/install
|
export HIP_PATH=/path/to/HIP/install
|
||||||
@ -421,9 +421,10 @@ minutes to hours) to build. Of course you only need to do that once.)
|
|||||||
cmake build system. The ``lib/kim/Install.py`` script supports a
|
cmake build system. The ``lib/kim/Install.py`` script supports a
|
||||||
``CMAKE`` environment variable if the cmake executable is named other
|
``CMAKE`` environment variable if the cmake executable is named other
|
||||||
than ``cmake`` on your system. Additional environment variables may be
|
than ``cmake`` on your system. Additional environment variables may be
|
||||||
provided on the command line for use by cmake. For example, to use the
|
set with the ``make`` command for use by cmake. For example, to use the
|
||||||
``cmake3`` executable and tell it to use the gnu version 11 compilers
|
``cmake3`` executable and tell it to use the GNU version 11 compilers
|
||||||
to build KIM, one could use the following command line.
|
called ``g++-11``, ``gcc-11`` and ``gfortran-11`` to build KIM, one
|
||||||
|
could use the following command.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -546,16 +547,7 @@ They must be specified in uppercase.
|
|||||||
- Local machine
|
- Local machine
|
||||||
* - AMDAVX
|
* - AMDAVX
|
||||||
- HOST
|
- HOST
|
||||||
- AMD 64-bit x86 CPU (AVX 1)
|
- AMD chip
|
||||||
* - ZEN
|
|
||||||
- HOST
|
|
||||||
- AMD Zen class CPU (AVX 2)
|
|
||||||
* - ZEN2
|
|
||||||
- HOST
|
|
||||||
- AMD Zen2 class CPU (AVX 2)
|
|
||||||
* - ZEN3
|
|
||||||
- HOST
|
|
||||||
- AMD Zen3 class CPU (AVX 2)
|
|
||||||
* - ARMV80
|
* - ARMV80
|
||||||
- HOST
|
- HOST
|
||||||
- ARMv8.0 Compatible CPU
|
- ARMv8.0 Compatible CPU
|
||||||
@ -571,105 +563,126 @@ They must be specified in uppercase.
|
|||||||
* - A64FX
|
* - A64FX
|
||||||
- HOST
|
- HOST
|
||||||
- ARMv8.2 with SVE Support
|
- ARMv8.2 with SVE Support
|
||||||
|
* - ARMV9_GRACE
|
||||||
|
- HOST
|
||||||
|
- ARMv9 NVIDIA Grace CPU
|
||||||
* - SNB
|
* - SNB
|
||||||
- HOST
|
- HOST
|
||||||
- Intel Sandy/Ivy Bridge CPU (AVX 1)
|
- Intel Sandy/Ivy Bridge CPUs
|
||||||
* - HSW
|
* - HSW
|
||||||
- HOST
|
- HOST
|
||||||
- Intel Haswell CPU (AVX 2)
|
- Intel Haswell CPUs
|
||||||
* - BDW
|
* - BDW
|
||||||
- HOST
|
- HOST
|
||||||
- Intel Broadwell Xeon E-class CPU (AVX 2 + transactional mem)
|
- Intel Broadwell Xeon E-class CPUs
|
||||||
* - SKL
|
|
||||||
- HOST
|
|
||||||
- Intel Skylake Client CPU
|
|
||||||
* - SKX
|
|
||||||
- HOST
|
|
||||||
- Intel Skylake Xeon Server CPU (AVX512)
|
|
||||||
* - ICL
|
* - ICL
|
||||||
- HOST
|
- HOST
|
||||||
- Intel Ice Lake Client CPU (AVX512)
|
- Intel Ice Lake Client CPUs (AVX512)
|
||||||
* - ICX
|
* - ICX
|
||||||
- HOST
|
- HOST
|
||||||
- Intel Ice Lake Xeon Server CPU (AVX512)
|
- Intel Ice Lake Xeon Server CPUs (AVX512)
|
||||||
* - SPR
|
* - SKL
|
||||||
- HOST
|
- HOST
|
||||||
- Intel Sapphire Rapids Xeon Server CPU (AVX512)
|
- Intel Skylake Client CPUs
|
||||||
|
* - SKX
|
||||||
|
- HOST
|
||||||
|
- Intel Skylake Xeon Server CPUs (AVX512)
|
||||||
* - KNC
|
* - KNC
|
||||||
- HOST
|
- HOST
|
||||||
- Intel Knights Corner Xeon Phi
|
- Intel Knights Corner Xeon Phi
|
||||||
* - KNL
|
* - KNL
|
||||||
- HOST
|
- HOST
|
||||||
- Intel Knights Landing Xeon Phi
|
- Intel Knights Landing Xeon Phi
|
||||||
|
* - SPR
|
||||||
|
- HOST
|
||||||
|
- Intel Sapphire Rapids Xeon Server CPUs (AVX512)
|
||||||
* - POWER8
|
* - POWER8
|
||||||
- HOST
|
- HOST
|
||||||
- IBM POWER8 CPU
|
- IBM POWER8 CPUs
|
||||||
* - POWER9
|
* - POWER9
|
||||||
- HOST
|
- HOST
|
||||||
- IBM POWER9 CPU
|
- IBM POWER9 CPUs
|
||||||
|
* - ZEN
|
||||||
|
- HOST
|
||||||
|
- AMD Zen architecture
|
||||||
|
* - ZEN2
|
||||||
|
- HOST
|
||||||
|
- AMD Zen2 architecture
|
||||||
|
* - ZEN3
|
||||||
|
- HOST
|
||||||
|
- AMD Zen3 architecture
|
||||||
* - RISCV_SG2042
|
* - RISCV_SG2042
|
||||||
- HOST
|
- HOST
|
||||||
- SG2042 (RISC-V) CPU
|
- SG2042 (RISC-V) CPUs
|
||||||
|
* - RISCV_RVA22V
|
||||||
|
- HOST
|
||||||
|
- RVA22V (RISC-V) CPUs
|
||||||
* - KEPLER30
|
* - KEPLER30
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Kepler generation CC 3.0 GPU
|
- NVIDIA Kepler generation CC 3.0
|
||||||
* - KEPLER32
|
* - KEPLER32
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Kepler generation CC 3.2 GPU
|
- NVIDIA Kepler generation CC 3.2
|
||||||
* - KEPLER35
|
* - KEPLER35
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Kepler generation CC 3.5 GPU
|
- NVIDIA Kepler generation CC 3.5
|
||||||
* - KEPLER37
|
* - KEPLER37
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Kepler generation CC 3.7 GPU
|
- NVIDIA Kepler generation CC 3.7
|
||||||
* - MAXWELL50
|
* - MAXWELL50
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Maxwell generation CC 5.0 GPU
|
- NVIDIA Maxwell generation CC 5.0
|
||||||
* - MAXWELL52
|
* - MAXWELL52
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Maxwell generation CC 5.2 GPU
|
- NVIDIA Maxwell generation CC 5.2
|
||||||
* - MAXWELL53
|
* - MAXWELL53
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Maxwell generation CC 5.3 GPU
|
- NVIDIA Maxwell generation CC 5.3
|
||||||
* - PASCAL60
|
* - PASCAL60
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Pascal generation CC 6.0 GPU
|
- NVIDIA Pascal generation CC 6.0
|
||||||
* - PASCAL61
|
* - PASCAL61
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Pascal generation CC 6.1 GPU
|
- NVIDIA Pascal generation CC 6.1
|
||||||
* - VOLTA70
|
* - VOLTA70
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Volta generation CC 7.0 GPU
|
- NVIDIA Volta generation CC 7.0
|
||||||
* - VOLTA72
|
* - VOLTA72
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Volta generation CC 7.2 GPU
|
- NVIDIA Volta generation CC 7.2
|
||||||
* - TURING75
|
* - TURING75
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Turing generation CC 7.5 GPU
|
- NVIDIA Turing generation CC 7.5
|
||||||
* - AMPERE80
|
* - AMPERE80
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Ampere generation CC 8.0 GPU
|
- NVIDIA Ampere generation CC 8.0
|
||||||
* - AMPERE86
|
* - AMPERE86
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Ampere generation CC 8.6 GPU
|
- NVIDIA Ampere generation CC 8.6
|
||||||
* - ADA89
|
* - ADA89
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Ada Lovelace generation CC 8.9 GPU
|
- NVIDIA Ada generation CC 8.9
|
||||||
* - HOPPER90
|
* - HOPPER90
|
||||||
- GPU
|
- GPU
|
||||||
- NVIDIA Hopper generation CC 9.0 GPU
|
- NVIDIA Hopper generation CC 9.0
|
||||||
* - AMD_GFX906
|
* - AMD_GFX906
|
||||||
- GPU
|
- GPU
|
||||||
- AMD GPU MI50/MI60
|
- AMD GPU MI50/60
|
||||||
* - AMD_GFX908
|
* - AMD_GFX908
|
||||||
- GPU
|
- GPU
|
||||||
- AMD GPU MI100
|
- AMD GPU MI100
|
||||||
* - AMD_GFX90A
|
* - AMD_GFX90A
|
||||||
- GPU
|
- GPU
|
||||||
- AMD GPU MI200
|
- AMD GPU MI200
|
||||||
|
* - AMD_GFX940
|
||||||
|
- GPU
|
||||||
|
- AMD GPU MI300
|
||||||
* - AMD_GFX942
|
* - AMD_GFX942
|
||||||
- GPU
|
- GPU
|
||||||
- AMD GPU MI300
|
- AMD GPU MI300
|
||||||
|
* - AMD_GFX942_APU
|
||||||
|
- GPU
|
||||||
|
- AMD APU MI300A
|
||||||
* - AMD_GFX1030
|
* - AMD_GFX1030
|
||||||
- GPU
|
- GPU
|
||||||
- AMD GPU V620/W6800
|
- AMD GPU V620/W6800
|
||||||
@ -678,7 +691,7 @@ They must be specified in uppercase.
|
|||||||
- AMD GPU RX7900XTX
|
- AMD GPU RX7900XTX
|
||||||
* - AMD_GFX1103
|
* - AMD_GFX1103
|
||||||
- GPU
|
- GPU
|
||||||
- AMD Phoenix APU with Radeon 740M/760M/780M/880M/890M
|
- AMD APU Phoenix
|
||||||
* - INTEL_GEN
|
* - INTEL_GEN
|
||||||
- GPU
|
- GPU
|
||||||
- SPIR64-based devices, e.g. Intel GPUs, using JIT
|
- SPIR64-based devices, e.g. Intel GPUs, using JIT
|
||||||
@ -701,7 +714,7 @@ They must be specified in uppercase.
|
|||||||
- GPU
|
- GPU
|
||||||
- Intel GPU Ponte Vecchio
|
- Intel GPU Ponte Vecchio
|
||||||
|
|
||||||
This list was last updated for version 4.3.0 of the Kokkos library.
|
This list was last updated for version 4.5.1 of the Kokkos library.
|
||||||
|
|
||||||
.. tabs::
|
.. tabs::
|
||||||
|
|
||||||
@ -2191,7 +2204,7 @@ verified to work in February 2020 with Quantum Espresso versions 6.3 to
|
|||||||
from the sources in the *lib* folder (including the essential
|
from the sources in the *lib* folder (including the essential
|
||||||
libqmmm.a) are not included in the static LAMMPS library and
|
libqmmm.a) are not included in the static LAMMPS library and
|
||||||
(currently) not installed, while their code is included in the
|
(currently) not installed, while their code is included in the
|
||||||
shared LAMMPS library. Thus a typical command line to configure
|
shared LAMMPS library. Thus a typical command to configure
|
||||||
building LAMMPS for QMMM would be:
|
building LAMMPS for QMMM would be:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|||||||
@ -8,6 +8,10 @@ Building LAMMPS with traditional makefiles requires that you have a
|
|||||||
for customizing your LAMMPS build with a number of global compilation
|
for customizing your LAMMPS build with a number of global compilation
|
||||||
options and features.
|
options and features.
|
||||||
|
|
||||||
|
This build system is slowly being phased out and may not support all
|
||||||
|
optional features and packages in LAMMPS. It is recommended to switch
|
||||||
|
to the :doc:`CMake based build system <Build_cmake>`.
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
^^^^^^^^^^^^
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
@ -100,9 +100,9 @@ procedure.
|
|||||||
|
|
||||||
It is possible to use both the integrated CMake support of the Visual
|
It is possible to use both the integrated CMake support of the Visual
|
||||||
Studio IDE or use an external CMake installation (e.g. downloaded from
|
Studio IDE or use an external CMake installation (e.g. downloaded from
|
||||||
cmake.org) to create build files and compile LAMMPS from the command line.
|
cmake.org) to create build files and compile LAMMPS from the command-line.
|
||||||
|
|
||||||
Compilation via command line and unit tests are checked automatically
|
Compilation via command-line and unit tests are checked automatically
|
||||||
for the LAMMPS development branch through
|
for the LAMMPS development branch through
|
||||||
`GitHub Actions <https://github.com/lammps/lammps/actions/workflows/compile-msvc.yml>`_.
|
`GitHub Actions <https://github.com/lammps/lammps/actions/workflows/compile-msvc.yml>`_.
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ for the LAMMPS development branch through
|
|||||||
|
|
||||||
Please note, that for either approach CMake will create a so-called
|
Please note, that for either approach CMake will create a so-called
|
||||||
:ref:`"multi-configuration" build environment <cmake_multiconfig>`, and
|
:ref:`"multi-configuration" build environment <cmake_multiconfig>`, and
|
||||||
the command lines for building and testing LAMMPS must be adjusted
|
the commands for building and testing LAMMPS must be adjusted
|
||||||
accordingly.
|
accordingly.
|
||||||
|
|
||||||
The LAMMPS cmake folder contains a ``CMakeSettings.json`` file with
|
The LAMMPS cmake folder contains a ``CMakeSettings.json`` file with
|
||||||
|
|||||||
@ -4,7 +4,7 @@ LAMMPS Class
|
|||||||
The LAMMPS class is encapsulating an MD simulation state and thus it is
|
The LAMMPS class is encapsulating an MD simulation state and thus it is
|
||||||
the class that needs to be created when starting a new simulation system
|
the class that needs to be created when starting a new simulation system
|
||||||
state. The LAMMPS executable essentially creates one instance of this
|
state. The LAMMPS executable essentially creates one instance of this
|
||||||
class and passes the command line flags and tells it to process the
|
class and passes the command-line flags and tells it to process the
|
||||||
provided input (a file or ``stdin``). It shuts the class down when
|
provided input (a file or ``stdin``). It shuts the class down when
|
||||||
control is returned to it and then exits. When using LAMMPS as a
|
control is returned to it and then exits. When using LAMMPS as a
|
||||||
library from another code it is required to create an instance of this
|
library from another code it is required to create an instance of this
|
||||||
|
|||||||
@ -90,6 +90,7 @@ OPT.
|
|||||||
* :doc:`lepton (o) <angle_lepton>`
|
* :doc:`lepton (o) <angle_lepton>`
|
||||||
* :doc:`mesocnt <angle_mesocnt>`
|
* :doc:`mesocnt <angle_mesocnt>`
|
||||||
* :doc:`mm3 <angle_mm3>`
|
* :doc:`mm3 <angle_mm3>`
|
||||||
|
* :doc:`mwlc <angle_mwlc>`
|
||||||
* :doc:`quartic (o) <angle_quartic>`
|
* :doc:`quartic (o) <angle_quartic>`
|
||||||
* :doc:`spica (ko) <angle_spica>`
|
* :doc:`spica (ko) <angle_spica>`
|
||||||
* :doc:`table (o) <angle_table>`
|
* :doc:`table (o) <angle_table>`
|
||||||
|
|||||||
@ -43,7 +43,7 @@ OPT.
|
|||||||
* :doc:`brownian/asphere <fix_brownian>`
|
* :doc:`brownian/asphere <fix_brownian>`
|
||||||
* :doc:`brownian/sphere <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 (k) <fix_cmap>`
|
||||||
* :doc:`colvars <fix_colvars>`
|
* :doc:`colvars <fix_colvars>`
|
||||||
* :doc:`controller <fix_controller>`
|
* :doc:`controller <fix_controller>`
|
||||||
* :doc:`damping/cundall <fix_damping_cundall>`
|
* :doc:`damping/cundall <fix_damping_cundall>`
|
||||||
@ -135,7 +135,7 @@ OPT.
|
|||||||
* :doc:`nve/dot <fix_nve_dot>`
|
* :doc:`nve/dot <fix_nve_dot>`
|
||||||
* :doc:`nve/dotc/langevin <fix_nve_dotc_langevin>`
|
* :doc:`nve/dotc/langevin <fix_nve_dotc_langevin>`
|
||||||
* :doc:`nve/eff <fix_nve_eff>`
|
* :doc:`nve/eff <fix_nve_eff>`
|
||||||
* :doc:`nve/limit <fix_nve_limit>`
|
* :doc:`nve/limit (k) <fix_nve_limit>`
|
||||||
* :doc:`nve/line <fix_nve_line>`
|
* :doc:`nve/line <fix_nve_line>`
|
||||||
* :doc:`nve/manifold/rattle <fix_nve_manifold_rattle>`
|
* :doc:`nve/manifold/rattle <fix_nve_manifold_rattle>`
|
||||||
* :doc:`nve/noforce <fix_nve_noforce>`
|
* :doc:`nve/noforce <fix_nve_noforce>`
|
||||||
@ -188,10 +188,11 @@ OPT.
|
|||||||
* :doc:`qeq/slater <fix_qeq>`
|
* :doc:`qeq/slater <fix_qeq>`
|
||||||
* :doc:`qmmm <fix_qmmm>`
|
* :doc:`qmmm <fix_qmmm>`
|
||||||
* :doc:`qtb <fix_qtb>`
|
* :doc:`qtb <fix_qtb>`
|
||||||
|
* :doc:`qtpie/reaxff <fix_qtpie_reaxff>`
|
||||||
* :doc:`rattle <fix_shake>`
|
* :doc:`rattle <fix_shake>`
|
||||||
* :doc:`reaxff/bonds (k) <fix_reaxff_bonds>`
|
* :doc:`reaxff/bonds (k) <fix_reaxff_bonds>`
|
||||||
* :doc:`reaxff/species (k) <fix_reaxff_species>`
|
* :doc:`reaxff/species (k) <fix_reaxff_species>`
|
||||||
* :doc:`recenter <fix_recenter>`
|
* :doc:`recenter (k) <fix_recenter>`
|
||||||
* :doc:`restrain <fix_restrain>`
|
* :doc:`restrain <fix_restrain>`
|
||||||
* :doc:`rheo <fix_rheo>`
|
* :doc:`rheo <fix_rheo>`
|
||||||
* :doc:`rheo/oxidation <fix_rheo_oxidation>`
|
* :doc:`rheo/oxidation <fix_rheo_oxidation>`
|
||||||
@ -269,7 +270,7 @@ OPT.
|
|||||||
* :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>`
|
||||||
* :doc:`wall/reflect/stochastic <fix_wall_reflect_stochastic>`
|
* :doc:`wall/reflect/stochastic <fix_wall_reflect_stochastic>`
|
||||||
* :doc:`wall/region <fix_wall_region>`
|
* :doc:`wall/region (k) <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:`wall/table <fix_wall>`
|
||||||
|
|||||||
@ -69,7 +69,7 @@ WARNING message is printed. The :doc:`Errors <Errors>` page gives
|
|||||||
more information on what errors mean. The documentation for each
|
more information on what errors mean. The documentation for each
|
||||||
command lists restrictions on how the command can be used.
|
command lists restrictions on how the command can be used.
|
||||||
|
|
||||||
You can use the :ref:`-skiprun <skiprun>` command line flag
|
You can use the :ref:`-skiprun <skiprun>` command-line flag
|
||||||
to have LAMMPS skip the execution of any ``run``, ``minimize``, or similar
|
to have LAMMPS skip the execution of any ``run``, ``minimize``, or similar
|
||||||
commands to check the entire input for correct syntax to avoid crashes
|
commands to check the entire input for correct syntax to avoid crashes
|
||||||
on typos or syntax errors in long runs.
|
on typos or syntax errors in long runs.
|
||||||
|
|||||||
@ -18,7 +18,7 @@ LAMMPS executable directly instead of having a separate tool. A
|
|||||||
combination of the commands :doc:`read_restart <read_restart>` and
|
combination of the commands :doc:`read_restart <read_restart>` and
|
||||||
:doc:`write_data <write_data>` can be used to the same effect. For
|
:doc:`write_data <write_data>` can be used to the same effect. For
|
||||||
added convenience this conversion can also be triggered by
|
added convenience this conversion can also be triggered by
|
||||||
:doc:`command line flags <Run_options>`
|
:doc:`command-line flags <Run_options>`
|
||||||
|
|
||||||
Fix ave/spatial and fix ave/spatial/sphere
|
Fix ave/spatial and fix ave/spatial/sphere
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|||||||
@ -79,19 +79,19 @@ 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
|
||||||
:ref:`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*, *Bond*, *Compute*, and *Dump* classes can also invoke the
|
||||||
of forward and reverse communication operations using the same *Comm*
|
same kind of forward and reverse communication operations using the
|
||||||
class methods. Likewise, the same pack/unpack methods and
|
same *Comm* 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*, *Bond*, *Compute*, or *Dump* class.
|
||||||
|
|
||||||
For *Fix* classes, there is an optional second argument to the
|
For all of these 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
|
class 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 class should set the *comm_forward* and
|
||||||
*comm_reverse* variables to the maximum value, but can invoke the
|
*comm_reverse* variables to the maximum value, but can invoke the
|
||||||
communication for a particular mode with a smaller value. For this
|
communication for a particular mode with a smaller value. For this
|
||||||
to work, the *pack_forward_comm()*, etc methods typically use a class
|
to work, the *pack_forward_comm()*, etc. methods typically use a class
|
||||||
member variable to choose which values to pack/unpack into/from the
|
member variable to choose which values to pack/unpack into/from the
|
||||||
buffer.
|
buffer.
|
||||||
|
|
||||||
|
|||||||
@ -94,12 +94,12 @@ represents what is generally referred to as an "instance of LAMMPS". It
|
|||||||
is 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
|
||||||
flags, initialize MPI (if not already done) and set up file pointers for
|
flags, initialize MPI (if not already done) and set up file pointers for
|
||||||
input and output. The destructor will shut everything down and free all
|
input and output. The destructor will shut everything down and free all
|
||||||
associated memory. Thus code for the standalone LAMMPS executable in
|
associated memory. Thus code for the standalone LAMMPS executable in
|
||||||
``main.cpp`` simply initializes MPI, instantiates a single instance of
|
``main.cpp`` simply initializes MPI, instantiates a single instance of
|
||||||
LAMMPS while passing it the command line flags and input script. It
|
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.
|
||||||
|
|
||||||
|
|||||||
@ -227,12 +227,12 @@ Tests for the C-style library interface
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Tests for validating the LAMMPS C-style library interface are in the
|
Tests for validating the LAMMPS C-style library interface are in the
|
||||||
``unittest/c-library`` folder. They are implemented either to be used
|
``unittest/c-library`` folder. They text either utility functions or
|
||||||
for utility functions or for LAMMPS commands, but use the functions
|
LAMMPS commands, but use the functions implemented in
|
||||||
implemented in the ``src/library.cpp`` file as much as possible. There
|
``src/library.cpp`` as much as possible. There may be some overlap with
|
||||||
may be some overlap with other tests, but only in as much as is required
|
other tests as far as the LAMMPS functionality is concerned, but the
|
||||||
to test the C-style library API. The tests are distributed over
|
focus is on testing the C-style library API. The tests are distributed
|
||||||
multiple test programs which try to match the grouping of the
|
over multiple test programs which try to match the grouping of the
|
||||||
functions in the source code and :ref:`in the manual <lammps_c_api>`.
|
functions in the source code and :ref:`in the manual <lammps_c_api>`.
|
||||||
|
|
||||||
This group of tests also includes tests invoking LAMMPS in parallel
|
This group of tests also includes tests invoking LAMMPS in parallel
|
||||||
@ -258,7 +258,7 @@ Tests for the Python module and package
|
|||||||
|
|
||||||
The ``unittest/python`` folder contains primarily tests for classes and
|
The ``unittest/python`` folder contains primarily tests for classes and
|
||||||
functions in the LAMMPS python module but also for commands in the
|
functions in the LAMMPS python module but also for commands in the
|
||||||
PYTHON package. These tests are only enabled if the necessary
|
PYTHON package. These tests are only enabled, if the necessary
|
||||||
prerequisites are detected or enabled during configuration and
|
prerequisites are detected or enabled during configuration and
|
||||||
compilation of LAMMPS (shared library build enabled, Python interpreter
|
compilation of LAMMPS (shared library build enabled, Python interpreter
|
||||||
found, Python development files found).
|
found, Python development files found).
|
||||||
@ -272,29 +272,30 @@ Tests for the Fortran interface
|
|||||||
|
|
||||||
Tests for using the Fortran module are in the ``unittest/fortran``
|
Tests for using the Fortran module are in the ``unittest/fortran``
|
||||||
folder. Since they are also using the GoogleTest library, they require
|
folder. Since they are also using the GoogleTest library, they require
|
||||||
implementing test wrappers in C++ that will call fortran functions
|
test wrappers written in C++ that will call fortran functions with a C
|
||||||
which provide a C function interface through ISO_C_BINDINGS that will in
|
function interface through ISO_C_BINDINGS which will in turn call the
|
||||||
turn call the functions in the LAMMPS Fortran module.
|
functions in the LAMMPS Fortran module.
|
||||||
|
|
||||||
Tests for the C++-style library interface
|
Tests for the C++-style library interface
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The tests in the ``unittest/cplusplus`` folder are somewhat similar to
|
The tests in the ``unittest/cplusplus`` folder are somewhat similar to
|
||||||
the tests for the C-style library interface, but do not need to test the
|
the tests for the C-style library interface, but do not need to test the
|
||||||
several convenience and utility functions that are only available through
|
convenience and utility functions that are only available through the
|
||||||
the C-style interface. Instead it can focus on the more generic features
|
C-style library interface. Instead they focus on the more generic
|
||||||
that are used internally. This part of the unit tests is currently still
|
features that are used in LAMMPS internally. This part of the unit
|
||||||
mostly in the planning stage.
|
tests is currently still mostly in the planning stage.
|
||||||
|
|
||||||
Tests for reading and writing file formats
|
Tests for reading and writing file formats
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The ``unittest/formats`` folder contains test programs for reading and
|
The ``unittest/formats`` folder contains test programs for reading and
|
||||||
writing files like data files, restart files, potential files or dump files.
|
writing files like data files, restart files, potential files or dump
|
||||||
This covers simple things like the file i/o convenience functions in the
|
files. This covers simple things like the file i/o convenience
|
||||||
``utils::`` namespace to complex tests of atom styles where creating and
|
functions in the ``utils::`` namespace to complex tests of atom styles
|
||||||
deleting atoms with different properties is tested in different ways
|
where creating and deleting of atoms with different properties is tested
|
||||||
and through script commands or reading and writing of data or restart files.
|
in different ways and through script commands or reading and writing of
|
||||||
|
data or restart files.
|
||||||
|
|
||||||
Tests for styles computing or modifying forces
|
Tests for styles computing or modifying forces
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -443,7 +444,7 @@ file for a style that is similar to one to be tested. The file name should
|
|||||||
follow the naming conventions described above and after copying the file,
|
follow the naming conventions described above and after copying the file,
|
||||||
the first step is to replace the style names where needed. The coefficient
|
the first step is to replace the style names where needed. The coefficient
|
||||||
values do not have to be meaningful, just in a reasonable range for the
|
values do not have to be meaningful, just in a reasonable range for the
|
||||||
given system. It does not matter if some forces are large, as long as
|
given system. It does not matter if some forces are large, for as long as
|
||||||
they do not diverge.
|
they do not diverge.
|
||||||
|
|
||||||
The template input files define a large number of index variables at the top
|
The template input files define a large number of index variables at the top
|
||||||
@ -476,7 +477,7 @@ the tabulated coulomb, to test both code paths. The reference results in the YA
|
|||||||
files then should be compared manually, if they agree well enough within the limits
|
files then should be compared manually, if they agree well enough within the limits
|
||||||
of those two approximations.
|
of those two approximations.
|
||||||
|
|
||||||
The ``test_pair_style`` and equivalent programs have special command line options
|
The ``test_pair_style`` and equivalent programs have special command-line options
|
||||||
to update the YAML files. Running a command like
|
to update the YAML files. Running a command like
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -531,19 +532,20 @@ Python module.
|
|||||||
Troubleshooting failed unit tests
|
Troubleshooting failed unit tests
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The are by default no unit tests for newly added features (e.g. pair, fix,
|
There are by default no unit tests for newly added features (e.g. pair,
|
||||||
or compute styles) unless your pull request also includes tests for the
|
fix, or compute styles) unless your pull request also includes tests for
|
||||||
added features. If you are modifying some features, you may see failures
|
these added features. If you are modifying some existing LAMMPS
|
||||||
for existing tests, if your modifications have some unexpected side effects
|
features, you may see failures for existing tests, if your modifications
|
||||||
or your changes render the existing test invalid. If you are adding an
|
have some unexpected side effects or your changes render the existing
|
||||||
accelerated version of an existing style, then only tests for INTEL,
|
test invalid. If you are adding an accelerated version of an existing
|
||||||
KOKKOS (with OpenMP only), OPENMP, and OPT will be run automatically.
|
style, then only tests for INTEL, KOKKOS (with OpenMP only), OPENMP, and
|
||||||
Tests for the GPU package are time consuming and thus are only run
|
OPT will be run automatically. Tests for the GPU package are time
|
||||||
*after* a merge, or when a special label, ``gpu_unit_tests`` is added
|
consuming and thus are only run *after* a merge, or when a special
|
||||||
to the pull request. After the test has started, it is often best to
|
label, ``gpu_unit_tests`` is added to the pull request. After the test
|
||||||
remove the label since every PR activity will re-trigger the test (that
|
has started, it is often best to remove the label since every PR
|
||||||
is a limitation of triggering a test with a label). Support for unit
|
activity will re-trigger the test (that is a limitation of triggering a
|
||||||
tests when using KOKKOS with GPU acceleration is currently not supported.
|
test with a label). Support for unit tests using KOKKOS with GPU
|
||||||
|
acceleration is currently not supported.
|
||||||
|
|
||||||
When you see a failed build on GitHub, click on ``Details`` to be taken
|
When you see a failed build on GitHub, click on ``Details`` to be taken
|
||||||
to the corresponding LAMMPS Jenkins CI web page. Click on the "Exit"
|
to the corresponding LAMMPS Jenkins CI web page. Click on the "Exit"
|
||||||
@ -588,7 +590,7 @@ While the epsilon (relative precision) for a single, `IEEE 754 compliant
|
|||||||
<https://en.wikipedia.org/wiki/IEEE_754>`_, double precision floating
|
<https://en.wikipedia.org/wiki/IEEE_754>`_, double precision floating
|
||||||
point operation is at about 2.2e-16, the achievable precision for the
|
point operation is at about 2.2e-16, the achievable precision for the
|
||||||
tests is lower due to most numbers being sums over intermediate results
|
tests is lower due to most numbers being sums over intermediate results
|
||||||
and the non-associativity of floating point math leading to larger
|
for which the non-associativity of floating point math leads to larger
|
||||||
errors. As a rule of thumb, the test epsilon can often be in the range
|
errors. As a rule of thumb, the test epsilon can often be in the range
|
||||||
5.0e-14 to 1.0e-13. But for "noisy" force kernels, e.g. those a larger
|
5.0e-14 to 1.0e-13. But for "noisy" force kernels, e.g. those a larger
|
||||||
amount of arithmetic operations involving `exp()`, `log()` or `sin()`
|
amount of arithmetic operations involving `exp()`, `log()` or `sin()`
|
||||||
@ -602,14 +604,14 @@ of floating point operations or that some or most intermediate operations
|
|||||||
may be done using approximations or with single precision floating point
|
may be done using approximations or with single precision floating point
|
||||||
math.
|
math.
|
||||||
|
|
||||||
To rerun the failed unit test individually, change to the ``build`` directory
|
To rerun a failed unit test individually, change to the ``build`` directory
|
||||||
and run the test with verbose output. For example,
|
and run the test with verbose output. For example,
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
env TEST_ARGS=-v ctest -R ^MolPairStyle:lj_cut_coul_long -V
|
env TEST_ARGS=-v ctest -R ^MolPairStyle:lj_cut_coul_long -V
|
||||||
|
|
||||||
``ctest`` with the ``-V`` flag also shows the exact command line
|
``ctest`` with the ``-V`` flag also shows the exact command
|
||||||
of the test. One can then use ``gdb --args`` to further debug and
|
of the test. One can then use ``gdb --args`` to further debug and
|
||||||
catch exceptions with the test command, for example,
|
catch exceptions with the test command, for example,
|
||||||
|
|
||||||
|
|||||||
@ -310,7 +310,7 @@ the constructor and the destructor.
|
|||||||
|
|
||||||
Pair styles are different from most classes in LAMMPS that define a
|
Pair styles are different from most classes in LAMMPS that define a
|
||||||
"style", as their constructor only uses the LAMMPS class instance
|
"style", as their constructor only uses the LAMMPS class instance
|
||||||
pointer as an argument, but **not** the command line arguments of the
|
pointer as an argument, but **not** the arguments of the
|
||||||
:doc:`pair_style command <pair_style>`. Instead, those arguments are
|
:doc:`pair_style command <pair_style>`. Instead, those arguments are
|
||||||
processed in the ``Pair::settings()`` function (or rather the version in
|
processed in the ``Pair::settings()`` function (or rather the version in
|
||||||
the derived class). The constructor is the place where global defaults
|
the derived class). The constructor is the place where global defaults
|
||||||
@ -891,7 +891,7 @@ originally created from mixing or not).
|
|||||||
These data file output functions are only useful for true pair-wise
|
These data file output functions are only useful for true pair-wise
|
||||||
additive potentials, where the potential parameters can be entered
|
additive potentials, where the potential parameters can be entered
|
||||||
through *multiple* :doc:`pair_coeff commands <pair_coeff>`. Pair styles
|
through *multiple* :doc:`pair_coeff commands <pair_coeff>`. Pair styles
|
||||||
that require a single "pair_coeff \* \*" command line are not compatible
|
that require a single "pair_coeff \* \*" command are not compatible
|
||||||
with reading their parameters from data files. For pair styles like
|
with reading their parameters from data files. For pair styles like
|
||||||
*born/gauss* that do support writing to data files, the potential
|
*born/gauss* that do support writing to data files, the potential
|
||||||
parameters will be read from the data file, if present, and
|
parameters will be read from the data file, if present, and
|
||||||
@ -1122,7 +1122,7 @@ once. Thus, the ``coeff()`` function has to do three tasks, each of
|
|||||||
which is delegated to a function in the ``PairTersoff`` class:
|
which is delegated to a function in the ``PairTersoff`` class:
|
||||||
|
|
||||||
#. map elements to atom types. Those follow the potential file name in the
|
#. map elements to atom types. Those follow the potential file name in the
|
||||||
command line arguments and are processed by the ``map_element2type()`` function.
|
command arguments and are processed by the ``map_element2type()`` function.
|
||||||
#. read and parse the potential parameter file in the ``read_file()`` function.
|
#. read and parse the potential parameter file in the ``read_file()`` function.
|
||||||
#. Build data structures where the original and derived parameters are
|
#. Build data structures where the original and derived parameters are
|
||||||
indexed by all possible triples of atom types and thus can be looked
|
indexed by all possible triples of atom types and thus can be looked
|
||||||
@ -1356,8 +1356,8 @@ either 0 or 1.
|
|||||||
|
|
||||||
The ``morseflag`` variable defaults to 0 and is set to 1 in the
|
The ``morseflag`` variable defaults to 0 and is set to 1 in the
|
||||||
``PairAIREBOMorse::settings()`` function which is called by the
|
``PairAIREBOMorse::settings()`` function which is called by the
|
||||||
:doc:`pair_style <pair_style>` command. This function delegates
|
:doc:`pair_style <pair_style>` command. This function delegates all
|
||||||
all command line processing and setting of other parameters to the
|
command argument processing and setting of other parameters to the
|
||||||
``PairAIREBO::settings()`` function of the base class.
|
``PairAIREBO::settings()`` function of the base class.
|
||||||
|
|
||||||
.. code-block:: c++
|
.. code-block:: c++
|
||||||
|
|||||||
@ -83,7 +83,7 @@ Run LAMMPS from within the debugger
|
|||||||
Running LAMMPS under the control of the debugger as shown below only
|
Running LAMMPS under the control of the debugger as shown below only
|
||||||
works for a single MPI rank (for debugging a program running in parallel
|
works for a single MPI rank (for debugging a program running in parallel
|
||||||
you usually need a parallel debugger program). A simple way to launch
|
you usually need a parallel debugger program). A simple way to launch
|
||||||
GDB is to prefix the LAMMPS command line with ``gdb --args`` and then
|
GDB is to prefix the LAMMPS command-line with ``gdb --args`` and then
|
||||||
type the command "run" at the GDB prompt. This will launch the
|
type the command "run" at the GDB prompt. This will launch the
|
||||||
debugger, load the LAMMPS executable and its debug info, and then run
|
debugger, load the LAMMPS executable and its debug info, and then run
|
||||||
it. When it reaches the code causing the segmentation fault, it will
|
it. When it reaches the code causing the segmentation fault, it will
|
||||||
@ -180,7 +180,7 @@ inspect the behavior of a compiled program by essentially emulating a
|
|||||||
CPU and instrumenting the program while running. This slows down
|
CPU and instrumenting the program while running. This slows down
|
||||||
execution quite significantly, but can also report issues that are not
|
execution quite significantly, but can also report issues that are not
|
||||||
resulting in a crash. The default valgrind tool is a memory checker and
|
resulting in a crash. The default valgrind tool is a memory checker and
|
||||||
you can use it by prefixing the normal command line with ``valgrind``.
|
you can use it by prefixing the normal command-line with ``valgrind``.
|
||||||
Unlike GDB, this will also work for parallel execution, but it is
|
Unlike GDB, this will also work for parallel execution, but it is
|
||||||
recommended to redirect the valgrind output to a file (e.g. with
|
recommended to redirect the valgrind output to a file (e.g. with
|
||||||
``--log-file=crash-%p.txt``, the %p will be substituted with the
|
``--log-file=crash-%p.txt``, the %p will be substituted with the
|
||||||
@ -235,3 +235,53 @@ from GDB. In addition you get a more specific hint about what cause the
|
|||||||
segmentation fault, i.e. that it is a NULL pointer dereference. To find
|
segmentation fault, i.e. that it is a NULL pointer dereference. To find
|
||||||
out which pointer exactly was NULL, you need to use the debugger, though.
|
out which pointer exactly was NULL, you need to use the debugger, though.
|
||||||
|
|
||||||
|
Debugging when LAMMPS appears to be stuck
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
Sometimes the LAMMPS calculation appears to be stuck, that is the LAMMPS
|
||||||
|
process or processes are active, but there is no visible progress. This
|
||||||
|
can have multiple reasons:
|
||||||
|
|
||||||
|
- The selected styles are slow and require a lot of CPU time and the
|
||||||
|
system is large. When extrapolating the expected speed from smaller
|
||||||
|
systems, one has to factor in that not all models scale linearly with
|
||||||
|
system size, e.g. :doc:`kspace styles like ewald or pppm
|
||||||
|
<kspace_style>`. There is very little that can be done in this case.
|
||||||
|
- The output interval is not set or set to a large value with the
|
||||||
|
:doc:`thermo <thermo>` command. I the first case, there will be output
|
||||||
|
only at the first and last step.
|
||||||
|
- The output is block-buffered and instead of line-buffered. The output
|
||||||
|
will only be written to the screen after 4096 or 8192 characters of
|
||||||
|
output have accumulated. This most often happens for files but also
|
||||||
|
with MPI parallel executables for output to the screen, since the
|
||||||
|
output to the screen is handled by the MPI library so that output from
|
||||||
|
all processes can be shown. This can be suppressed by using the
|
||||||
|
``-nonblock`` or ``-nb`` command-line flag, which turns off buffering
|
||||||
|
for screen and logfile output.
|
||||||
|
- An MPI parallel calculation has a bug where a collective MPI function
|
||||||
|
is called (e.g. ``MPI_Barrier()``, ``MPI_Bcast()``,
|
||||||
|
``MPI_Allreduce()`` and so on) before pending point-to-point
|
||||||
|
communications are completed or when the collective function is only
|
||||||
|
called from a subset of the MPI processes. This also applies to some
|
||||||
|
internal LAMMPS functions like ``Error::all()`` which uses
|
||||||
|
``MPI_Barrier()`` and thus ``Error::one()`` must be called, if the
|
||||||
|
error condition does not happen on all MPI processes simultaneously.
|
||||||
|
- Some function in LAMMPS has a bug where a ``for`` or ``while`` loop
|
||||||
|
does not trigger the exit condition and thus will loop forever. This
|
||||||
|
can happen when the wrong variable is incremented or when one value in
|
||||||
|
a comparison becomes ``NaN`` due to an overflow.
|
||||||
|
|
||||||
|
In the latter two cases, further information and stack traces (see above)
|
||||||
|
can be obtain by attaching a debugger to a running process. For that the
|
||||||
|
process ID (PID) is needed; this can be found on Linux machines with the
|
||||||
|
``top``, ``htop``, ``ps``, or ``pstree`` commands.
|
||||||
|
|
||||||
|
Then running the (GNU) debugger ``gdb`` with the ``-p`` flag followed by
|
||||||
|
the process id will attach the process to the debugger and stop
|
||||||
|
execution of that specific process. From there on it is possible to
|
||||||
|
issue all debugger commands in the same way as when LAMMPS was started
|
||||||
|
from the debugger (see above). Most importantly it is possible to
|
||||||
|
obtain a stack trace with the ``where`` command and thus determine where
|
||||||
|
in the execution of a timestep this process is. Also internal data can
|
||||||
|
be printed and execution single stepped or continued. When the debugger
|
||||||
|
is exited, the calculation will resume normally.
|
||||||
|
|||||||
@ -54,3 +54,26 @@ header of a data file (e.g. the number of atoms) is larger than the
|
|||||||
number of lines provided (e.g. in the corresponding Atoms section)
|
number of lines provided (e.g. in the corresponding Atoms section)
|
||||||
and then LAMMPS will continue reading into the next section and that
|
and then LAMMPS will continue reading into the next section and that
|
||||||
would have a completely different format.
|
would have a completely different format.
|
||||||
|
|
||||||
|
.. _err0003:
|
||||||
|
|
||||||
|
Illegal variable command: expected X arguments but found Y
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
This error indicates that there are the wrong number of arguments for a
|
||||||
|
specific variable command, but a common reason for that is a variable
|
||||||
|
expression that has whitespace but is not enclosed in single or double
|
||||||
|
quotes.
|
||||||
|
|
||||||
|
To explain, the LAMMPS input parser reads and processes lines. The
|
||||||
|
resulting line is broken down into "words". Those are usually
|
||||||
|
individual commands, labels, names, values separated by whitespace (a
|
||||||
|
space or tab character). For "words" that may contain whitespace, they
|
||||||
|
have to be enclosed in single (') or double (") quotes. The parser will
|
||||||
|
then remove the outermost pair of quotes and then pass that string as
|
||||||
|
"word" to the variable command.
|
||||||
|
|
||||||
|
Thus missing quotes or accidental extra whitespace will lead to the
|
||||||
|
error shown in the header because the unquoted whitespace will result
|
||||||
|
in the text being broken into more "words", i.e. the variable expression
|
||||||
|
being split.
|
||||||
|
|||||||
@ -7774,7 +7774,7 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
|
|||||||
*Too few values in body section of molecule file*
|
*Too few values in body section of molecule file*
|
||||||
Self-explanatory.
|
Self-explanatory.
|
||||||
|
|
||||||
*Too many -pk arguments in command line*
|
*Too many -pk arguments in command-line*
|
||||||
The string formed by concatenating the arguments is too long. Use a
|
The string formed by concatenating the arguments is too long. Use a
|
||||||
package command in the input script instead.
|
package command in the input script instead.
|
||||||
|
|
||||||
|
|||||||
@ -146,6 +146,8 @@ Lowercase directories
|
|||||||
+-------------+------------------------------------------------------------------+
|
+-------------+------------------------------------------------------------------+
|
||||||
| streitz | use of Streitz/Mintmire potential with charge equilibration |
|
| streitz | use of Streitz/Mintmire potential with charge equilibration |
|
||||||
+-------------+------------------------------------------------------------------+
|
+-------------+------------------------------------------------------------------+
|
||||||
|
| stress_vcm | removing binned rigid body motion from binned stress profile |
|
||||||
|
+-------------+------------------------------------------------------------------+
|
||||||
| tad | temperature-accelerated dynamics of vacancy diffusion in bulk Si |
|
| tad | temperature-accelerated dynamics of vacancy diffusion in bulk Si |
|
||||||
+-------------+------------------------------------------------------------------+
|
+-------------+------------------------------------------------------------------+
|
||||||
| threebody | regression test input for a variety of manybody potentials |
|
| threebody | regression test input for a variety of manybody potentials |
|
||||||
|
|||||||
@ -16,7 +16,7 @@ compiled alongside the code using it from the source code in
|
|||||||
``fortran/lammps.f90`` *and* with the same compiler used to build the
|
``fortran/lammps.f90`` *and* with the same compiler used to build the
|
||||||
rest of the Fortran code that interfaces to LAMMPS. When linking, you
|
rest of the Fortran code that interfaces to LAMMPS. When linking, you
|
||||||
also need to :doc:`link to the LAMMPS library <Build_link>`. A typical
|
also need to :doc:`link to the LAMMPS library <Build_link>`. A typical
|
||||||
command line for a simple program using the Fortran interface would be:
|
command for a simple program using the Fortran interface would be:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -91,12 +91,12 @@ function and triggered with the optional logical argument set to
|
|||||||
CALL lmp%close(.TRUE.)
|
CALL lmp%close(.TRUE.)
|
||||||
END PROGRAM testlib
|
END PROGRAM testlib
|
||||||
|
|
||||||
It is also possible to pass command line flags from Fortran to C/C++ and
|
It is also possible to pass command-line flags from Fortran to C/C++ and
|
||||||
thus make the resulting executable behave similarly to the standalone
|
thus make the resulting executable behave similarly to the standalone
|
||||||
executable (it will ignore the `-in/-i` flag, though). This allows
|
executable (it will ignore the `-in/-i` flag, though). This allows
|
||||||
using the command line to configure accelerator and suffix settings,
|
using the command-line to configure accelerator and suffix settings,
|
||||||
configure screen and logfile output, or to set index style variables
|
configure screen and logfile output, or to set index style variables
|
||||||
from the command line and more. Here is a correspondingly adapted
|
from the command-line and more. Here is a correspondingly adapted
|
||||||
version of the previous example:
|
version of the previous example:
|
||||||
|
|
||||||
.. code-block:: fortran
|
.. code-block:: fortran
|
||||||
@ -108,7 +108,7 @@ version of the previous example:
|
|||||||
CHARACTER(LEN=128), ALLOCATABLE :: command_args(:)
|
CHARACTER(LEN=128), ALLOCATABLE :: command_args(:)
|
||||||
INTEGER :: i, argc
|
INTEGER :: i, argc
|
||||||
|
|
||||||
! copy command line flags to `command_args()`
|
! copy command-line flags to `command_args()`
|
||||||
argc = COMMAND_ARGUMENT_COUNT()
|
argc = COMMAND_ARGUMENT_COUNT()
|
||||||
ALLOCATE(command_args(0:argc))
|
ALLOCATE(command_args(0:argc))
|
||||||
DO i=0, argc
|
DO i=0, argc
|
||||||
@ -448,7 +448,7 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS.
|
|||||||
compiled with MPI support, it will also initialize MPI, if it has
|
compiled with MPI support, it will also initialize MPI, if it has
|
||||||
not already been initialized before.
|
not already been initialized before.
|
||||||
|
|
||||||
The *args* argument with the list of command line parameters is
|
The *args* argument with the list of command-line parameters is
|
||||||
optional and so it the *comm* argument with the MPI communicator.
|
optional and so it the *comm* argument with the MPI communicator.
|
||||||
If *comm* is not provided, ``MPI_COMM_WORLD`` is assumed. For
|
If *comm* is not provided, ``MPI_COMM_WORLD`` is assumed. For
|
||||||
more details please see the documentation of :cpp:func:`lammps_open`.
|
more details please see the documentation of :cpp:func:`lammps_open`.
|
||||||
|
|||||||
@ -103,6 +103,7 @@ Tutorials howto
|
|||||||
Howto_github
|
Howto_github
|
||||||
Howto_lammps_gui
|
Howto_lammps_gui
|
||||||
Howto_moltemplate
|
Howto_moltemplate
|
||||||
|
Howto_python
|
||||||
Howto_pylammps
|
Howto_pylammps
|
||||||
Howto_wsl
|
Howto_wsl
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ using a shell like Bash or Zsh.
|
|||||||
Visual Studio IDE with the bundled CMake or from the Windows command prompt using
|
Visual Studio IDE with the bundled CMake or from the Windows command prompt using
|
||||||
a separately installed CMake package, both using the native Microsoft Visual C++
|
a separately installed CMake package, both using the native Microsoft Visual C++
|
||||||
compilers and (optionally) the Microsoft MPI SDK. This tutorial, however, only
|
compilers and (optionally) the Microsoft MPI SDK. This tutorial, however, only
|
||||||
covers unix-like command line interfaces.
|
covers unix-like command-line interfaces.
|
||||||
|
|
||||||
We also assume that you have downloaded and unpacked a recent LAMMPS source code package
|
We also assume that you have downloaded and unpacked a recent LAMMPS source code package
|
||||||
or used Git to create a clone of the LAMMPS sources on your compilation machine.
|
or used Git to create a clone of the LAMMPS sources on your compilation machine.
|
||||||
@ -277,7 +277,7 @@ Setting options
|
|||||||
---------------
|
---------------
|
||||||
|
|
||||||
Options that enable, disable or modify settings are modified by setting
|
Options that enable, disable or modify settings are modified by setting
|
||||||
the value of CMake variables. This is done on the command line with the
|
the value of CMake variables. This is done on the command-line with the
|
||||||
*-D* flag in the format ``-D VARIABLE=value``, e.g. ``-D
|
*-D* flag in the format ``-D VARIABLE=value``, e.g. ``-D
|
||||||
CMAKE_BUILD_TYPE=Release`` or ``-D BUILD_MPI=on``. There is one quirk:
|
CMAKE_BUILD_TYPE=Release`` or ``-D BUILD_MPI=on``. There is one quirk:
|
||||||
when used before the CMake directory, there may be a space between the
|
when used before the CMake directory, there may be a space between the
|
||||||
@ -376,7 +376,7 @@ Using presets
|
|||||||
-------------
|
-------------
|
||||||
|
|
||||||
Since LAMMPS has a lot of optional features and packages, specifying
|
Since LAMMPS has a lot of optional features and packages, specifying
|
||||||
them all on the command line can be tedious. Or when selecting a
|
them all on the command-line can be tedious. Or when selecting a
|
||||||
different compiler toolchain, multiple options have to be changed
|
different compiler toolchain, multiple options have to be changed
|
||||||
consistently and that is rather error prone. Or when enabling certain
|
consistently and that is rather error prone. Or when enabling certain
|
||||||
packages, they require consistent settings to be operated in a
|
packages, they require consistent settings to be operated in a
|
||||||
@ -384,7 +384,7 @@ particular mode. For this purpose, we are providing a selection of
|
|||||||
"preset files" for CMake in the folder ``cmake/presets``. They
|
"preset files" for CMake in the folder ``cmake/presets``. They
|
||||||
represent a way to pre-load or override the CMake configuration cache by
|
represent a way to pre-load or override the CMake configuration cache by
|
||||||
setting or changing CMake variables. Preset files are loaded using the
|
setting or changing CMake variables. Preset files are loaded using the
|
||||||
*-C* command line flag. You can combine loading multiple preset files or
|
*-C* command-line flag. You can combine loading multiple preset files or
|
||||||
change some variables later with additional *-D* flags. A few examples:
|
change some variables later with additional *-D* flags. A few examples:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|||||||
@ -163,7 +163,7 @@ After everything is done, add the files to the branch and commit them:
|
|||||||
*git rm*, *git mv* for adding, removing, renaming individual files,
|
*git rm*, *git mv* for adding, removing, renaming individual files,
|
||||||
respectively, and then *git commit* to finalize the commit.
|
respectively, and then *git commit* to finalize the commit.
|
||||||
Carefully check all pending changes with *git status* before
|
Carefully check all pending changes with *git status* before
|
||||||
committing them. If you find doing this on the command line too
|
committing them. If you find doing this on the command-line too
|
||||||
tedious, consider using a GUI, for example the one included in git
|
tedious, consider using a GUI, for example the one included in git
|
||||||
distributions written in Tk, i.e. use *git gui* (on some Linux
|
distributions written in Tk, i.e. use *git gui* (on some Linux
|
||||||
distributions it may be required to install an additional package to
|
distributions it may be required to install an additional package to
|
||||||
|
|||||||
@ -20,8 +20,11 @@ to the online LAMMPS documentation for known LAMMPS commands and styles.
|
|||||||
(Ubuntu 20.04LTS or later and compatible), macOS (version 11 aka Big
|
(Ubuntu 20.04LTS or later and compatible), macOS (version 11 aka Big
|
||||||
Sur or later), and Windows (version 10 or later) :ref:`are available
|
Sur or later), and Windows (version 10 or later) :ref:`are available
|
||||||
<lammps_gui_install>` for download. Non-MPI LAMMPS executables (as
|
<lammps_gui_install>` for download. Non-MPI LAMMPS executables (as
|
||||||
``lmp``) for running LAMMPS from the command line and :doc:`some
|
``lmp``) for running LAMMPS from the command-line and :doc:`some
|
||||||
LAMMPS tools <Tools>` compiled executables are also included.
|
LAMMPS tools <Tools>` compiled executables are also included.
|
||||||
|
Also, the pre-compiled LAMMPS-GUI packages include the WHAM executables
|
||||||
|
from http://membrane.urmc.rochester.edu/content/wham/ for use with
|
||||||
|
LAMMPS tutorials.
|
||||||
|
|
||||||
The source code for LAMMPS-GUI is included in the LAMMPS source code
|
The source code for LAMMPS-GUI is included in the LAMMPS source code
|
||||||
distribution and can be found in the ``tools/lammps-gui`` folder. It
|
distribution and can be found in the ``tools/lammps-gui`` folder. It
|
||||||
@ -29,16 +32,16 @@ to the online LAMMPS documentation for known LAMMPS commands and styles.
|
|||||||
<Build_cmake>`.
|
<Build_cmake>`.
|
||||||
|
|
||||||
LAMMPS-GUI tries to provide an experience similar to what people
|
LAMMPS-GUI tries to provide an experience similar to what people
|
||||||
traditionally would have running LAMMPS using a command line window and
|
traditionally would have running LAMMPS using a command-line window and
|
||||||
the console LAMMPS executable but just rolled into a single executable:
|
the console LAMMPS executable but just rolled into a single executable:
|
||||||
|
|
||||||
- writing & editing LAMMPS input files with a text editor
|
- writing & editing LAMMPS input files with a text editor
|
||||||
- run LAMMPS on those input file with selected command line flags
|
- run LAMMPS on those input file with selected command-line flags
|
||||||
- extract data from the created files and visualize it with and
|
- extract data from the created files and visualize it with and
|
||||||
external software
|
external software
|
||||||
|
|
||||||
That procedure is quite effective for people proficient in using the
|
That procedure is quite effective for people proficient in using the
|
||||||
command line, as that allows them to use tools for the individual steps
|
command-line, as that allows them to use tools for the individual steps
|
||||||
that they are most comfortable with. In fact, it is often *required* to
|
that they are most comfortable with. In fact, it is often *required* to
|
||||||
adopt this workflow when running LAMMPS simulations on high-performance
|
adopt this workflow when running LAMMPS simulations on high-performance
|
||||||
computing facilities.
|
computing facilities.
|
||||||
@ -100,10 +103,11 @@ MacOS 11 and later
|
|||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
After downloading the ``LAMMPS-macOS-multiarch-GUI-<version>.dmg``
|
After downloading the ``LAMMPS-macOS-multiarch-GUI-<version>.dmg``
|
||||||
installer package, you need to double-click it and then, in the window
|
application bundle disk image, you need to double-click it and then, in
|
||||||
that opens, drag the app bundle as indicated into the "Applications"
|
the window that opens, drag the app bundle as indicated into the
|
||||||
folder. The follow the instructions in the "README.txt" file to
|
"Applications" folder. Afterwards, the disk image can be unmounted.
|
||||||
get access to the other included executables.
|
Then follow the instructions in the "README.txt" file to get access to
|
||||||
|
the other included command-line executables.
|
||||||
|
|
||||||
Linux on x86\_64
|
Linux on x86\_64
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
@ -117,15 +121,25 @@ into the "LAMMPS_GUI" folder and execute "./lammps-gui" directly.
|
|||||||
|
|
||||||
The second variant uses `flatpak <https://www.flatpak.org>`_ and
|
The second variant uses `flatpak <https://www.flatpak.org>`_ and
|
||||||
requires the flatpak management and runtime software to be installed.
|
requires the flatpak management and runtime software to be installed.
|
||||||
After downloading the ``LAMMPS-GUI-Linux-x86_64-GUI-<version>.tar.gz``
|
After downloading the ``LAMMPS-GUI-Linux-x86_64-GUI-<version>.flatpak``
|
||||||
flatpak bundle, you can install it with ``flatpak install --user
|
flatpak bundle, you can install it with ``flatpak install --user
|
||||||
LAMMPS-GUI-Linux-x86_64-GUI-<version>.tar.gz``. After installation,
|
LAMMPS-GUI-Linux-x86_64-GUI-<version>.flatpak``. After installation,
|
||||||
LAMMPS-GUI should be integrated into your desktop environment under
|
LAMMPS-GUI should be integrated into your desktop environment under
|
||||||
"Applications > Science" but also can be launched from the console with
|
"Applications > Science" but also can be launched from the console with
|
||||||
``flatpak run org.lammps.lammps-gui``. The flatpak bundle also includes
|
``flatpak run org.lammps.lammps-gui``. The flatpak bundle also includes
|
||||||
the console LAMMPS executable ``lmp`` which can be launched to run
|
the console LAMMPS executable ``lmp`` which can be launched to run
|
||||||
simulations with, for example: ``flatpak run --command=lmp
|
simulations with, for example with:
|
||||||
org.lammps.lammps-gui -in in.melt``.
|
|
||||||
|
.. code-block:: sh
|
||||||
|
|
||||||
|
flatpak run --command=lmp org.lammps.lammps-gui -in in.melt
|
||||||
|
|
||||||
|
Other bundled command-line executables are run the same way and can be
|
||||||
|
listed with:
|
||||||
|
|
||||||
|
.. code-block:: sh
|
||||||
|
|
||||||
|
ls $(flatpak info --show-location org.lammps.lammps-gui )/files/bin
|
||||||
|
|
||||||
|
|
||||||
Compiling from Source
|
Compiling from Source
|
||||||
@ -165,9 +179,9 @@ window is stored when exiting and restored when starting again.
|
|||||||
Opening Files
|
Opening Files
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
|
||||||
The LAMMPS-GUI application can be launched without command line arguments
|
The LAMMPS-GUI application can be launched without command-line arguments
|
||||||
and then starts with an empty buffer in the *Editor* window. If arguments
|
and then starts with an empty buffer in the *Editor* window. If arguments
|
||||||
are given LAMMPS will use first command line argument as the file name for
|
are given LAMMPS will use first command-line argument as the file name for
|
||||||
the *Editor* buffer and reads its contents into the buffer, if the file
|
the *Editor* buffer and reads its contents into the buffer, if the file
|
||||||
exists. All further arguments are ignored. Files can also be opened via
|
exists. All further arguments are ignored. Files can also be opened via
|
||||||
the *File* menu, the `Ctrl-O` (`Command-O` on macOS) keyboard shortcut
|
the *File* menu, the `Ctrl-O` (`Command-O` on macOS) keyboard shortcut
|
||||||
@ -261,14 +275,21 @@ Output Window
|
|||||||
|
|
||||||
By default, when starting a run, an *Output* window opens that displays
|
By default, when starting a run, an *Output* window opens that displays
|
||||||
the screen output of the running LAMMPS calculation, as shown below.
|
the screen output of the running LAMMPS calculation, as shown below.
|
||||||
This text would normally be seen in the command line window.
|
This text would normally be seen in the command-line window.
|
||||||
|
|
||||||
.. image:: JPG/lammps-gui-log.png
|
.. image:: JPG/lammps-gui-log.png
|
||||||
:align: center
|
:align: center
|
||||||
:scale: 50%
|
:scale: 50%
|
||||||
|
|
||||||
LAMMPS-GUI captures the screen output from LAMMPS as it is generated and
|
LAMMPS-GUI captures the screen output from LAMMPS as it is generated and
|
||||||
updates the *Output* window regularly during a run.
|
updates the *Output* window regularly during a run. If there are any
|
||||||
|
warnings or errors in the LAMMPS output, they are highlighted by using
|
||||||
|
bold text colored in red. There is a small panel at the bottom center
|
||||||
|
of the *Output* window showing how many warnings and errors were
|
||||||
|
detected and how many lines the entire output has. By clicking on the
|
||||||
|
button on the right with the warning symbol or by using the keyboard
|
||||||
|
shortcut `Ctrl-N` (`Command-N` on macOS), you can jump to the next
|
||||||
|
line with a warning or error.
|
||||||
|
|
||||||
By default, the *Output* window is replaced each time a run is started.
|
By default, the *Output* window is replaced each time a run is started.
|
||||||
The runs are counted and the run number for the current run is displayed
|
The runs are counted and the run number for the current run is displayed
|
||||||
@ -398,7 +419,7 @@ below.
|
|||||||
Like for the *Output* and *Charts* windows, its content is continuously
|
Like for the *Output* and *Charts* windows, its content is continuously
|
||||||
updated during a run. It will show "(none)" if there are no variables
|
updated during a run. It will show "(none)" if there are no variables
|
||||||
defined. Note that it is also possible to *set* :doc:`index style
|
defined. Note that it is also possible to *set* :doc:`index style
|
||||||
variables <variable>`, that would normally be set via command line
|
variables <variable>`, that would normally be set via command-line
|
||||||
flags, via the "Set Variables..." dialog from the *Run* menu.
|
flags, via the "Set Variables..." dialog from the *Run* menu.
|
||||||
LAMMPS-GUI automatically defines the variable "gui_run" to the current
|
LAMMPS-GUI automatically defines the variable "gui_run" to the current
|
||||||
value of the run counter. That way it is possible to automatically
|
value of the run counter. That way it is possible to automatically
|
||||||
@ -775,11 +796,11 @@ General Settings:
|
|||||||
|
|
||||||
- *Echo input to log:* when checked, all input commands, including
|
- *Echo input to log:* when checked, all input commands, including
|
||||||
variable expansions, are echoed to the *Output* window. This is
|
variable expansions, are echoed to the *Output* window. This is
|
||||||
equivalent to using `-echo screen` at the command line. There is no
|
equivalent to using `-echo screen` at the command-line. There is no
|
||||||
log *file* produced by default, since LAMMPS-GUI uses `-log none`.
|
log *file* produced by default, since LAMMPS-GUI uses `-log none`.
|
||||||
- *Include citation details:* when checked full citation info will be
|
- *Include citation details:* when checked full citation info will be
|
||||||
included to the log window. This is equivalent to using `-cite
|
included to the log window. This is equivalent to using `-cite
|
||||||
screen` on the command line.
|
screen` on the command-line.
|
||||||
- *Show log window by default:* when checked, the screen output of a
|
- *Show log window by default:* when checked, the screen output of a
|
||||||
LAMMPS run will be collected in a log window during the run
|
LAMMPS run will be collected in a log window during the run
|
||||||
- *Show chart window by default:* when checked, the thermodynamic
|
- *Show chart window by default:* when checked, the thermodynamic
|
||||||
@ -828,7 +849,7 @@ Accelerators:
|
|||||||
|
|
||||||
This tab enables selection of an accelerator package for LAMMPS to use
|
This tab enables selection of an accelerator package for LAMMPS to use
|
||||||
and is equivalent to using the `-suffix` and `-package` flags on the
|
and is equivalent to using the `-suffix` and `-package` flags on the
|
||||||
command line. Only settings supported by the LAMMPS library and local
|
command-line. Only settings supported by the LAMMPS library and local
|
||||||
hardware are available. The `Number of threads` field allows setting
|
hardware are available. The `Number of threads` field allows setting
|
||||||
the maximum number of threads for the accelerator packages that use
|
the maximum number of threads for the accelerator packages that use
|
||||||
threads.
|
threads.
|
||||||
|
|||||||
@ -738,8 +738,8 @@ command.
|
|||||||
|
|
||||||
This can be done, for example, by using the built-in visualizer of the
|
This can be done, for example, by using the built-in visualizer of the
|
||||||
:doc:`dump image or dump movie <dump_image>` command to create snapshot
|
:doc:`dump image or dump movie <dump_image>` command to create snapshot
|
||||||
images or a movie. Below are example command lines for using dump image
|
images or a movie. Below are example command for using dump image with
|
||||||
with the :ref:`example listed below <periexample>` and a set of images
|
the :ref:`example listed below <periexample>` and a set of images
|
||||||
created for steps 300, 600, and 2000 this way.
|
created for steps 300, 600, and 2000 this way.
|
||||||
|
|
||||||
.. code-block:: LAMMPS
|
.. code-block:: LAMMPS
|
||||||
|
|||||||
@ -1,564 +1,6 @@
|
|||||||
PyLammps Tutorial
|
PyLammps Tutorial
|
||||||
=================
|
=================
|
||||||
|
|
||||||
.. contents::
|
The PyLammps interface is deprecated and will be removed in a future release of
|
||||||
|
LAMMPS. As such, the PyLammps version of this tutorial has been removed and is
|
||||||
Overview
|
replaced by the :doc:`Python_head`.
|
||||||
--------
|
|
||||||
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>` is a Python wrapper class for
|
|
||||||
LAMMPS which can be created on its own or use an existing
|
|
||||||
:py:class:`lammps Python <lammps.lammps>` object. It creates a simpler,
|
|
||||||
more "pythonic" interface to common LAMMPS functionality, in contrast to
|
|
||||||
the :py:class:`lammps <lammps.lammps>` wrapper for the LAMMPS :ref:`C
|
|
||||||
language library interface API <lammps_c_api>` which is written using
|
|
||||||
`Python ctypes <ctypes_>`_. The :py:class:`lammps <lammps.lammps>`
|
|
||||||
wrapper is discussed on the :doc:`Python_head` doc page.
|
|
||||||
|
|
||||||
Unlike the flat `ctypes <ctypes_>`_ interface, PyLammps exposes a
|
|
||||||
discoverable API. It no longer requires knowledge of the underlying C++
|
|
||||||
code implementation. Finally, the :py:class:`IPyLammps
|
|
||||||
<lammps.IPyLammps>` wrapper builds on top of :py:class:`PyLammps
|
|
||||||
<lammps.PyLammps>` and adds some additional features for `IPython
|
|
||||||
integration <ipython_>`_ into `Jupyter notebooks <jupyter_>`_, e.g. for
|
|
||||||
embedded visualization output from :doc:`dump style image <dump_image>`.
|
|
||||||
|
|
||||||
.. _ctypes: https://docs.python.org/3/library/ctypes.html
|
|
||||||
.. _ipython: https://ipython.org/
|
|
||||||
.. _jupyter: https://jupyter.org/
|
|
||||||
|
|
||||||
Comparison of lammps and PyLammps interfaces
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
lammps.lammps
|
|
||||||
"""""""""""""
|
|
||||||
|
|
||||||
* uses `ctypes <ctypes_>`_
|
|
||||||
* direct memory access to native C++ data with optional support for NumPy arrays
|
|
||||||
* provides functions to send and receive data to LAMMPS
|
|
||||||
* interface modeled after the LAMMPS :ref:`C language library interface API <lammps_c_api>`
|
|
||||||
* requires knowledge of how LAMMPS internally works (C pointers, etc)
|
|
||||||
* full support for running Python with MPI using `mpi4py <https://mpi4py.readthedocs.io>`_
|
|
||||||
* no overhead from creating a more Python-like interface
|
|
||||||
|
|
||||||
lammps.PyLammps
|
|
||||||
"""""""""""""""
|
|
||||||
|
|
||||||
* higher-level abstraction built on *top* of the original :py:class:`ctypes based interface <lammps.lammps>`
|
|
||||||
* manipulation of Python objects
|
|
||||||
* communication with LAMMPS is hidden from API user
|
|
||||||
* shorter, more concise Python
|
|
||||||
* better IPython integration, designed for quick prototyping
|
|
||||||
* designed for serial execution
|
|
||||||
* additional overhead from capturing and parsing the LAMMPS screen output
|
|
||||||
|
|
||||||
Quick Start
|
|
||||||
-----------
|
|
||||||
|
|
||||||
System-wide Installation
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Step 1: Building LAMMPS as a shared library
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
To use LAMMPS inside of Python it has to be compiled as shared
|
|
||||||
library. This library is then loaded by the Python interface. In this
|
|
||||||
example we enable the MOLECULE package and compile LAMMPS with PNG, JPEG
|
|
||||||
and FFMPEG output support enabled.
|
|
||||||
|
|
||||||
Step 1a: For the CMake based build system, the steps are:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
mkdir $LAMMPS_DIR/build-shared
|
|
||||||
cd $LAMMPS_DIR/build-shared
|
|
||||||
|
|
||||||
# MPI, PNG, Jpeg, FFMPEG are auto-detected
|
|
||||||
cmake ../cmake -DPKG_MOLECULE=yes -DBUILD_LIB=yes -DBUILD_SHARED_LIBS=yes
|
|
||||||
make
|
|
||||||
|
|
||||||
Step 1b: For the legacy, make based build system, the steps are:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
cd $LAMMPS_DIR/src
|
|
||||||
|
|
||||||
# add packages if necessary
|
|
||||||
make yes-MOLECULE
|
|
||||||
|
|
||||||
# compile shared library using Makefile
|
|
||||||
make mpi mode=shlib LMP_INC="-DLAMMPS_PNG -DLAMMPS_JPEG -DLAMMPS_FFMPEG" JPG_LIB="-lpng -ljpeg"
|
|
||||||
|
|
||||||
Step 2: Installing the LAMMPS Python package
|
|
||||||
""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
PyLammps is part of the lammps Python package. To install it simply install
|
|
||||||
that package into your current Python installation with:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
make install-python
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Recompiling the shared library requires re-installing the Python package
|
|
||||||
|
|
||||||
Installation inside of a virtualenv
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
You can use virtualenv to create a custom Python environment specifically tuned
|
|
||||||
for your workflow.
|
|
||||||
|
|
||||||
Benefits of using a virtualenv
|
|
||||||
""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
* isolation of your system Python installation from your development installation
|
|
||||||
* installation can happen in your user directory without root access (useful for HPC clusters)
|
|
||||||
* installing packages through pip allows you to get newer versions of packages than e.g., through apt-get or yum package managers (and without root access)
|
|
||||||
* you can even install specific old versions of a package if necessary
|
|
||||||
|
|
||||||
**Prerequisite (e.g. on Ubuntu)**
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
apt-get install python-virtualenv
|
|
||||||
|
|
||||||
Creating a virtualenv with lammps installed
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# create virtualenv named 'testing'
|
|
||||||
virtualenv $HOME/python/testing
|
|
||||||
|
|
||||||
# activate 'testing' environment
|
|
||||||
source $HOME/python/testing/bin/activate
|
|
||||||
|
|
||||||
Now configure and compile the LAMMPS shared library as outlined above.
|
|
||||||
When using CMake and the shared library has already been build, you
|
|
||||||
need to re-run CMake to update the location of the python executable
|
|
||||||
to the location in the virtual environment with:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
cmake . -DPython_EXECUTABLE=$(which python)
|
|
||||||
|
|
||||||
# install LAMMPS package in virtualenv
|
|
||||||
(testing) make install-python
|
|
||||||
|
|
||||||
# install other useful packages
|
|
||||||
(testing) pip install matplotlib jupyter mpi4py
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
# return to original shell
|
|
||||||
(testing) deactivate
|
|
||||||
|
|
||||||
Creating a new instance of PyLammps
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
To create a PyLammps object you need to first import the class from the lammps
|
|
||||||
module. By using the default constructor, a new *lammps* instance is created.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from lammps import PyLammps
|
|
||||||
L = PyLammps()
|
|
||||||
|
|
||||||
You can also initialize PyLammps on top of this existing *lammps* object:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from lammps import lammps, PyLammps
|
|
||||||
lmp = lammps()
|
|
||||||
L = PyLammps(ptr=lmp)
|
|
||||||
|
|
||||||
Commands
|
|
||||||
--------
|
|
||||||
|
|
||||||
Sending a LAMMPS command with the existing library interfaces is done using
|
|
||||||
the command method of the lammps object instance.
|
|
||||||
|
|
||||||
For instance, let's take the following LAMMPS command:
|
|
||||||
|
|
||||||
.. code-block:: LAMMPS
|
|
||||||
|
|
||||||
region box block 0 10 0 5 -0.5 0.5
|
|
||||||
|
|
||||||
In the original interface this command can be executed with the following
|
|
||||||
Python code if *L* was a lammps instance:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.command("region box block 0 10 0 5 -0.5 0.5")
|
|
||||||
|
|
||||||
With the PyLammps interface, any command can be split up into arbitrary parts
|
|
||||||
separated by white-space, passed as individual arguments to a region method.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.region("box block", 0, 10, 0, 5, -0.5, 0.5)
|
|
||||||
|
|
||||||
Note that each parameter is set as Python literal floating-point number. In the
|
|
||||||
PyLammps interface, each command takes an arbitrary parameter list and transparently
|
|
||||||
merges it to a single command string, separating individual parameters by white-space.
|
|
||||||
|
|
||||||
The benefit of this approach is avoiding redundant command calls and easier
|
|
||||||
parameterization. In the original interface parameterization needed to be done
|
|
||||||
manually by creating formatted strings.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.command("region box block %f %f %f %f %f %f" % (xlo, xhi, ylo, yhi, zlo, zhi))
|
|
||||||
|
|
||||||
In contrast, methods of PyLammps accept parameters directly and will convert
|
|
||||||
them automatically to a final command string.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.region("box block", xlo, xhi, ylo, yhi, zlo, zhi)
|
|
||||||
|
|
||||||
System state
|
|
||||||
------------
|
|
||||||
|
|
||||||
In addition to dispatching commands directly through the PyLammps object, it
|
|
||||||
also provides several properties which allow you to query the system state.
|
|
||||||
|
|
||||||
L.system
|
|
||||||
Is a dictionary describing the system such as the bounding box or number of atoms
|
|
||||||
|
|
||||||
L.system.xlo, L.system.xhi
|
|
||||||
bounding box limits along x-axis
|
|
||||||
|
|
||||||
L.system.ylo, L.system.yhi
|
|
||||||
bounding box limits along y-axis
|
|
||||||
|
|
||||||
L.system.zlo, L.system.zhi
|
|
||||||
bounding box limits along z-axis
|
|
||||||
|
|
||||||
L.communication
|
|
||||||
configuration of communication subsystem, such as the number of threads or processors
|
|
||||||
|
|
||||||
L.communication.nthreads
|
|
||||||
number of threads used by each LAMMPS process
|
|
||||||
|
|
||||||
L.communication.nprocs
|
|
||||||
number of MPI processes used by LAMMPS
|
|
||||||
|
|
||||||
L.fixes
|
|
||||||
List of fixes in the current system
|
|
||||||
|
|
||||||
L.computes
|
|
||||||
List of active computes in the current system
|
|
||||||
|
|
||||||
L.dump
|
|
||||||
List of active dumps in the current system
|
|
||||||
|
|
||||||
L.groups
|
|
||||||
List of groups present in the current system
|
|
||||||
|
|
||||||
Working with LAMMPS variables
|
|
||||||
-----------------------------
|
|
||||||
|
|
||||||
LAMMPS variables can be both defined and accessed via the PyLammps interface.
|
|
||||||
|
|
||||||
To define a variable you can use the :doc:`variable <variable>` command:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.variable("a index 2")
|
|
||||||
|
|
||||||
A dictionary of all variables is returned by L.variables
|
|
||||||
|
|
||||||
you can access an individual variable by retrieving a variable object from the
|
|
||||||
L.variables dictionary by name
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
a = L.variables['a']
|
|
||||||
|
|
||||||
The variable value can then be easily read and written by accessing the value
|
|
||||||
property of this object.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
print(a.value)
|
|
||||||
a.value = 4
|
|
||||||
|
|
||||||
Retrieving the value of an arbitrary LAMMPS expressions
|
|
||||||
-------------------------------------------------------
|
|
||||||
|
|
||||||
LAMMPS expressions can be immediately evaluated by using the eval method. The
|
|
||||||
passed string parameter can be any expression containing global thermo values,
|
|
||||||
variables, compute or fix data.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
result = L.eval("ke") # kinetic energy
|
|
||||||
result = L.eval("pe") # potential energy
|
|
||||||
|
|
||||||
result = L.eval("v_t/2.0")
|
|
||||||
|
|
||||||
Accessing atom data
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
All atoms in the current simulation can be accessed by using the L.atoms list.
|
|
||||||
Each element of this list is an object which exposes its properties (id, type,
|
|
||||||
position, velocity, force, etc.).
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# access first atom
|
|
||||||
L.atoms[0].id
|
|
||||||
L.atoms[0].type
|
|
||||||
|
|
||||||
# access second atom
|
|
||||||
L.atoms[1].position
|
|
||||||
L.atoms[1].velocity
|
|
||||||
L.atoms[1].force
|
|
||||||
|
|
||||||
Some properties can also be used to set:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# set position in 2D simulation
|
|
||||||
L.atoms[0].position = (1.0, 0.0)
|
|
||||||
|
|
||||||
# set position in 3D simulation
|
|
||||||
L.atoms[0].position = (1.0, 0.0, 1.)
|
|
||||||
|
|
||||||
Evaluating thermo data
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
Each simulation run usually produces thermo output based on system state,
|
|
||||||
computes, fixes or variables. The trajectories of these values can be queried
|
|
||||||
after a run via the L.runs list. This list contains a growing list of run data.
|
|
||||||
The first element is the output of the first run, the second element that of
|
|
||||||
the second run.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.run(1000)
|
|
||||||
L.runs[0] # data of first 1000 time steps
|
|
||||||
|
|
||||||
L.run(1000)
|
|
||||||
L.runs[1] # data of second 1000 time steps
|
|
||||||
|
|
||||||
Each run contains a dictionary of all trajectories. Each trajectory is
|
|
||||||
accessible through its thermo name:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.runs[0].thermo.Step # list of time steps in first run
|
|
||||||
L.runs[0].thermo.Ke # list of kinetic energy values in first run
|
|
||||||
|
|
||||||
Together with matplotlib plotting data out of LAMMPS becomes simple:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import matplotlib.plot as plt
|
|
||||||
steps = L.runs[0].thermo.Step
|
|
||||||
ke = L.runs[0].thermo.Ke
|
|
||||||
plt.plot(steps, ke)
|
|
||||||
|
|
||||||
Error handling with PyLammps
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
Using C++ exceptions in LAMMPS for errors allows capturing them on the
|
|
||||||
C++ side and rethrowing them on the Python side. This way you can handle
|
|
||||||
LAMMPS errors through the Python exception handling mechanism.
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
Capturing a LAMMPS exception in Python can still mean that the
|
|
||||||
current LAMMPS process is in an illegal state and must be
|
|
||||||
terminated. It is advised to save your data and terminate the Python
|
|
||||||
instance as quickly as possible.
|
|
||||||
|
|
||||||
Using PyLammps in IPython notebooks and Jupyter
|
|
||||||
-----------------------------------------------
|
|
||||||
|
|
||||||
If the LAMMPS Python package is installed for the same Python interpreter as
|
|
||||||
IPython, you can use PyLammps directly inside of an IPython notebook inside of
|
|
||||||
Jupyter. Jupyter is a powerful integrated development environment (IDE) for
|
|
||||||
many dynamic languages like Python, Julia and others, which operates inside of
|
|
||||||
any web browser. Besides auto-completion and syntax highlighting it allows you
|
|
||||||
to create formatted documents using Markup, mathematical formulas, graphics and
|
|
||||||
animations intermixed with executable Python code. It is a great format for
|
|
||||||
tutorials and showcasing your latest research.
|
|
||||||
|
|
||||||
To launch an instance of Jupyter simply run the following command inside your
|
|
||||||
Python environment (this assumes you followed the Quick Start instructions):
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
jupyter notebook
|
|
||||||
|
|
||||||
IPyLammps Examples
|
|
||||||
------------------
|
|
||||||
|
|
||||||
Examples of IPython notebooks can be found in the python/examples/pylammps
|
|
||||||
subdirectory. To open these notebooks launch *jupyter notebook* inside this
|
|
||||||
directory and navigate to one of them. If you compiled and installed
|
|
||||||
a LAMMPS shared library with exceptions, PNG, JPEG and FFMPEG support
|
|
||||||
you should be able to rerun all of these notebooks.
|
|
||||||
|
|
||||||
Validating a dihedral potential
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
This example showcases how an IPython Notebook can be used to compare a simple
|
|
||||||
LAMMPS simulation of a harmonic dihedral potential to its analytical solution.
|
|
||||||
Four atoms are placed in the simulation and the dihedral potential is applied on
|
|
||||||
them using a datafile. Then one of the atoms is rotated along the central axis by
|
|
||||||
setting its position from Python, which changes the dihedral angle.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
phi = [d \* math.pi / 180 for d in range(360)]
|
|
||||||
|
|
||||||
pos = [(1.0, math.cos(p), math.sin(p)) for p in phi]
|
|
||||||
|
|
||||||
pe = []
|
|
||||||
for p in pos:
|
|
||||||
L.atoms[3].position = p
|
|
||||||
L.run(0)
|
|
||||||
pe.append(L.eval("pe"))
|
|
||||||
|
|
||||||
By evaluating the potential energy for each position we can verify that
|
|
||||||
trajectory with the analytical formula. To compare both solutions, we plot
|
|
||||||
both trajectories over each other using matplotlib, which embeds the generated
|
|
||||||
plot inside the IPython notebook.
|
|
||||||
|
|
||||||
.. image:: JPG/pylammps_dihedral.jpg
|
|
||||||
:align: center
|
|
||||||
|
|
||||||
Running a Monte Carlo relaxation
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
This second example shows how to use PyLammps to create a 2D Monte Carlo Relaxation
|
|
||||||
simulation, computing and plotting energy terms and even embedding video output.
|
|
||||||
|
|
||||||
Initially, a 2D system is created in a state with minimal energy.
|
|
||||||
|
|
||||||
.. image:: JPG/pylammps_mc_minimum.jpg
|
|
||||||
:align: center
|
|
||||||
|
|
||||||
It is then disordered by moving each atom by a random delta.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
random.seed(27848)
|
|
||||||
deltaperturb = 0.2
|
|
||||||
|
|
||||||
for i in range(L.system.natoms):
|
|
||||||
x, y = L.atoms[i].position
|
|
||||||
dx = deltaperturb \* random.uniform(-1, 1)
|
|
||||||
dy = deltaperturb \* random.uniform(-1, 1)
|
|
||||||
L.atoms[i].position = (x+dx, y+dy)
|
|
||||||
|
|
||||||
L.run(0)
|
|
||||||
|
|
||||||
.. image:: JPG/pylammps_mc_disordered.jpg
|
|
||||||
:align: center
|
|
||||||
|
|
||||||
Finally, the Monte Carlo algorithm is implemented in Python. It continuously
|
|
||||||
moves random atoms by a random delta and only accepts certain moves.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
estart = L.eval("pe")
|
|
||||||
elast = estart
|
|
||||||
|
|
||||||
naccept = 0
|
|
||||||
energies = [estart]
|
|
||||||
|
|
||||||
niterations = 3000
|
|
||||||
deltamove = 0.1
|
|
||||||
kT = 0.05
|
|
||||||
|
|
||||||
natoms = L.system.natoms
|
|
||||||
|
|
||||||
for i in range(niterations):
|
|
||||||
iatom = random.randrange(0, natoms)
|
|
||||||
current_atom = L.atoms[iatom]
|
|
||||||
|
|
||||||
x0, y0 = current_atom.position
|
|
||||||
|
|
||||||
dx = deltamove \* random.uniform(-1, 1)
|
|
||||||
dy = deltamove \* random.uniform(-1, 1)
|
|
||||||
|
|
||||||
current_atom.position = (x0+dx, y0+dy)
|
|
||||||
|
|
||||||
L.run(1, "pre no post no")
|
|
||||||
|
|
||||||
e = L.eval("pe")
|
|
||||||
energies.append(e)
|
|
||||||
|
|
||||||
if e <= elast:
|
|
||||||
naccept += 1
|
|
||||||
elast = e
|
|
||||||
elif random.random() <= math.exp(natoms\*(elast-e)/kT):
|
|
||||||
naccept += 1
|
|
||||||
elast = e
|
|
||||||
else:
|
|
||||||
current_atom.position = (x0, y0)
|
|
||||||
|
|
||||||
The energies of each iteration are collected in a Python list and finally plotted using matplotlib.
|
|
||||||
|
|
||||||
.. image:: JPG/pylammps_mc_energies_plot.jpg
|
|
||||||
:align: center
|
|
||||||
|
|
||||||
The IPython notebook also shows how to use dump commands and embed video files
|
|
||||||
inside of the IPython notebook.
|
|
||||||
|
|
||||||
Using PyLammps and mpi4py (Experimental)
|
|
||||||
----------------------------------------
|
|
||||||
|
|
||||||
PyLammps can be run in parallel using `mpi4py
|
|
||||||
<https://mpi4py.readthedocs.io>`_. This python package can be installed
|
|
||||||
using
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
pip install mpi4py
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
Usually, any :py:class:`PyLammps <lammps.PyLammps>` command must be
|
|
||||||
executed by *all* MPI processes. However, evaluations and querying
|
|
||||||
the system state is only available on MPI rank 0. Using these
|
|
||||||
functions from other MPI ranks will raise an exception.
|
|
||||||
|
|
||||||
The following is a short example which reads in an existing LAMMPS input
|
|
||||||
file and executes it in parallel. You can find in.melt in the
|
|
||||||
examples/melt folder. Please take note that the
|
|
||||||
:py:meth:`PyLammps.eval() <lammps.PyLammps.eval>` is called only from
|
|
||||||
MPI rank 0.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from mpi4py import MPI
|
|
||||||
from lammps import PyLammps
|
|
||||||
|
|
||||||
L = PyLammps()
|
|
||||||
L.file("in.melt")
|
|
||||||
|
|
||||||
if MPI.COMM_WORLD.rank == 0:
|
|
||||||
print("Potential energy: ", L.eval("pe"))
|
|
||||||
|
|
||||||
MPI.Finalize()
|
|
||||||
|
|
||||||
To run this script (melt.py) in parallel using 4 MPI processes we invoke the
|
|
||||||
following mpirun command:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
mpirun -np 4 python melt.py
|
|
||||||
|
|
||||||
Feedback and Contributing
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
If you find this Python interface useful, please feel free to provide feedback
|
|
||||||
and ideas on how to improve it to Richard Berger (richard.berger@outlook.com). We also
|
|
||||||
want to encourage people to write tutorial style IPython notebooks showcasing LAMMPS usage
|
|
||||||
and maybe their latest research results.
|
|
||||||
|
|||||||
441
doc/src/Howto_python.rst
Normal file
441
doc/src/Howto_python.rst
Normal file
@ -0,0 +1,441 @@
|
|||||||
|
LAMMPS Python Tutorial
|
||||||
|
======================
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Overview
|
||||||
|
--------
|
||||||
|
|
||||||
|
The :py:class:`lammps <lammps.lammps>` Python module is a wrapper class for the
|
||||||
|
LAMMPS :ref:`C language library interface API <lammps_c_api>` which is written using
|
||||||
|
`Python ctypes <ctypes_>`_. The design choice of this wrapper class is to
|
||||||
|
follow the C language API closely with only small changes related to Python
|
||||||
|
specific requirements and to better accommodate object oriented programming.
|
||||||
|
|
||||||
|
In addition to this flat `ctypes <ctypes_>`_ interface, the
|
||||||
|
:py:class:`lammps <lammps.lammps>` wrapper class exposes a discoverable
|
||||||
|
API that doesn't require as much knowledge of the underlying C language
|
||||||
|
library interface or LAMMPS C++ code implementation.
|
||||||
|
|
||||||
|
Finally, the API exposes some additional features for `IPython integration
|
||||||
|
<ipython_>`_ into `Jupyter notebooks <jupyter_>`_, e.g. for embedded
|
||||||
|
visualization output from :doc:`dump style image <dump_image>`.
|
||||||
|
|
||||||
|
.. _ctypes: https://docs.python.org/3/library/ctypes.html
|
||||||
|
.. _ipython: https://ipython.org/
|
||||||
|
.. _jupyter: https://jupyter.org/
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Quick Start
|
||||||
|
-----------
|
||||||
|
|
||||||
|
System-wide or User Installation
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Step 1: Building LAMMPS as a shared library
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
To use LAMMPS inside of Python it has to be compiled as shared library.
|
||||||
|
This library is then loaded by the Python interface. In this example we
|
||||||
|
enable the :ref:`MOLECULE package <PKG-MOLECULE>` and compile LAMMPS
|
||||||
|
with :ref:`PNG, JPEG and FFMPEG output support <graphics>` enabled.
|
||||||
|
|
||||||
|
.. tabs::
|
||||||
|
|
||||||
|
.. tab:: CMake build
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
mkdir $LAMMPS_DIR/build-shared
|
||||||
|
cd $LAMMPS_DIR/build-shared
|
||||||
|
|
||||||
|
# MPI, PNG, Jpeg, FFMPEG are auto-detected
|
||||||
|
cmake ../cmake -DPKG_MOLECULE=yes -DPKG_PYTHON=on -DBUILD_SHARED_LIBS=yes
|
||||||
|
make
|
||||||
|
|
||||||
|
.. tab:: Traditional make
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd $LAMMPS_DIR/src
|
||||||
|
|
||||||
|
# add packages if necessary
|
||||||
|
make yes-MOLECULE
|
||||||
|
make yes-PYTHON
|
||||||
|
|
||||||
|
# compile shared library using Makefile
|
||||||
|
make mpi mode=shlib LMP_INC="-DLAMMPS_PNG -DLAMMPS_JPEG -DLAMMPS_FFMPEG" JPG_LIB="-lpng -ljpeg"
|
||||||
|
|
||||||
|
Step 2: Installing the LAMMPS Python package
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
Next install the LAMMPS Python package into your current Python installation with:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
make install-python
|
||||||
|
|
||||||
|
This will create a so-called `"wheel"
|
||||||
|
<https://packaging.python.org/en/latest/discussions/package-formats/#what-is-a-wheel>`_
|
||||||
|
and then install the LAMMPS Python module from that "wheel" into either
|
||||||
|
into a system folder (provided the command is executed with root
|
||||||
|
privileges) or into your personal Python module folder.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Recompiling the shared library requires re-installing the Python
|
||||||
|
package.
|
||||||
|
|
||||||
|
Installation inside of a virtual environment
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
You can use virtual environments to create a custom Python environment
|
||||||
|
specifically tuned for your workflow.
|
||||||
|
|
||||||
|
Benefits of using a virtualenv
|
||||||
|
""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
* isolation of your system Python installation from your development installation
|
||||||
|
* installation can happen in your user directory without root access (useful for HPC clusters)
|
||||||
|
* installing packages through pip allows you to get newer versions of packages than e.g., through apt-get or yum package managers (and without root access)
|
||||||
|
* you can even install specific old versions of a package if necessary
|
||||||
|
|
||||||
|
**Prerequisite (e.g. on Ubuntu)**
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
apt-get install python-venv
|
||||||
|
|
||||||
|
Creating a virtualenv with lammps installed
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# create virtual envrionment named 'testing'
|
||||||
|
python3 -m venv $HOME/python/testing
|
||||||
|
|
||||||
|
# activate 'testing' environment
|
||||||
|
source $HOME/python/testing/bin/activate
|
||||||
|
|
||||||
|
Now configure and compile the LAMMPS shared library as outlined above.
|
||||||
|
When using CMake and the shared library has already been build, you
|
||||||
|
need to re-run CMake to update the location of the python executable
|
||||||
|
to the location in the virtual environment with:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cmake . -DPython_EXECUTABLE=$(which python)
|
||||||
|
|
||||||
|
# install LAMMPS package in virtualenv
|
||||||
|
(testing) make install-python
|
||||||
|
|
||||||
|
# install other useful packages
|
||||||
|
(testing) pip install matplotlib jupyter mpi4py pandas
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
# return to original shell
|
||||||
|
(testing) deactivate
|
||||||
|
|
||||||
|
-------
|
||||||
|
|
||||||
|
Creating a new lammps instance
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
To create a lammps object you need to first import the class from the lammps
|
||||||
|
module. By using the default constructor, a new :py:class:`lammps
|
||||||
|
<lammps.lammps>` instance is created.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from lammps import lammps
|
||||||
|
L = lammps()
|
||||||
|
|
||||||
|
See the :doc:`LAMMPS Python documentation <Python_create>` for how to customize
|
||||||
|
the instance creation with optional arguments.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Commands
|
||||||
|
--------
|
||||||
|
|
||||||
|
Sending a LAMMPS command with the library interface is done using
|
||||||
|
the ``command`` method of the lammps object.
|
||||||
|
|
||||||
|
For instance, let's take the following LAMMPS command:
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
region box block 0 10 0 5 -0.5 0.5
|
||||||
|
|
||||||
|
This command can be executed with the following Python code if ``L`` is a ``lammps``
|
||||||
|
instance:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
L.command("region box block 0 10 0 5 -0.5 0.5")
|
||||||
|
|
||||||
|
For convenience, the ``lammps`` class also provides a command wrapper ``cmd``
|
||||||
|
that turns any LAMMPS command into a regular function call:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
L.cmd.region("box block", 0, 10, 0, 5, -0.5, 0.5)
|
||||||
|
|
||||||
|
Note that each parameter is set as Python number literal. With
|
||||||
|
the wrapper each command takes an arbitrary parameter list and transparently
|
||||||
|
merges it to a single command string, separating individual parameters by
|
||||||
|
white-space.
|
||||||
|
|
||||||
|
The benefit of this approach is avoiding redundant command calls and easier
|
||||||
|
parameterization. With the ``command`` function each call needs to be assembled
|
||||||
|
manually using formatted strings.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
L.command(f"region box block {xlo} {xhi} {ylo} {yhi} {zlo} {zhi}")
|
||||||
|
|
||||||
|
The wrapper accepts parameters directly and will convert
|
||||||
|
them automatically to a final command string.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
L.cmd.region("box block", xlo, xhi, ylo, yhi, zlo, zhi)
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
When running in IPython you can use Tab-completion after ``L.cmd.`` to see
|
||||||
|
all available LAMMPS commands.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Accessing atom data
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
All per-atom properties that are part of the :doc:`atom style
|
||||||
|
<atom_style>` in the current simulation can be accessed using the
|
||||||
|
:py:meth:`extract_atoms() <lammps.lammps.extract_atoms()>` method. This
|
||||||
|
can be retrieved as ctypes objects or as NumPy arrays through the
|
||||||
|
lammps.numpy module. Those represent the *local* atoms of the
|
||||||
|
individual sub-domain for the current MPI process and may contain
|
||||||
|
information for the local ghost atoms or not depending on the property.
|
||||||
|
Both can be accessed as lists, but for the ctypes list object the size
|
||||||
|
is not known and hast to be retrieved first to avoid out-of-bounds
|
||||||
|
accesses.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
nlocal = L.extract_setting("nlocal")
|
||||||
|
nall = L.extract_setting("nall")
|
||||||
|
print("Number of local atoms ", nlocal, " Number of local and ghost atoms ", nall);
|
||||||
|
|
||||||
|
# access via ctypes directly
|
||||||
|
atom_id = L.extract_atom("id")
|
||||||
|
print("Atom IDs", atom_id[0:nlocal])
|
||||||
|
|
||||||
|
# access through numpy wrapper
|
||||||
|
atom_type = L.numpy.extract_atom("type")
|
||||||
|
print("Atom types", atom_type)
|
||||||
|
|
||||||
|
x = L.numpy.extract_atom("x")
|
||||||
|
v = L.numpy.extract_atom("v")
|
||||||
|
print("positions array shape", x.shape)
|
||||||
|
print("velocity array shape", v.shape)
|
||||||
|
# turn on communicating velocities to ghost atoms
|
||||||
|
L.cmd.comm_modify("vel", "yes")
|
||||||
|
v = L.numpy.extract_atom('v')
|
||||||
|
print("velocity array shape", v.shape)
|
||||||
|
|
||||||
|
Some properties can also be set from Python since internally the
|
||||||
|
data of the C++ code is accessed directly:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
# set position in 2D simulation
|
||||||
|
x[0] = (1.0, 0.0)
|
||||||
|
|
||||||
|
# set position in 3D simulation
|
||||||
|
x[0] = (1.0, 0.0, 1.)
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
Retrieving the values of thermodynamic data and variables
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
To access thermodynamic data from the last completed timestep,
|
||||||
|
you can use the :py:meth:`get_thermo() <lammps.lammps.get_thermo>`
|
||||||
|
method, and to extract the value of (compatible) variables, you
|
||||||
|
can use the :py:meth:`extract_variable() <lammps.lammps.extract_variable>`
|
||||||
|
method.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
result = L.get_thermo("ke") # kinetic energy
|
||||||
|
result = L.get_thermo("pe") # potential energy
|
||||||
|
|
||||||
|
result = L.extract_variable("t") / 2.0
|
||||||
|
|
||||||
|
Error handling
|
||||||
|
--------------
|
||||||
|
|
||||||
|
We are using C++ exceptions in LAMMPS for errors and the C language
|
||||||
|
library interface captures and records them. This allows checking
|
||||||
|
whether errors have happened in Python during a call into LAMMPS and
|
||||||
|
then re-throw the error as a Python exception. This way you can handle
|
||||||
|
LAMMPS errors in the conventional way through the Python exception
|
||||||
|
handling mechanism.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Capturing a LAMMPS exception in Python can still mean that the
|
||||||
|
current LAMMPS process is in an illegal state and must be
|
||||||
|
terminated. It is advised to save your data and terminate the Python
|
||||||
|
instance as quickly as possible.
|
||||||
|
|
||||||
|
Using LAMMPS in IPython notebooks and Jupyter
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
If the LAMMPS Python package is installed for the same Python
|
||||||
|
interpreter as IPython, you can use LAMMPS directly inside of an IPython
|
||||||
|
notebook inside of Jupyter. Jupyter is a powerful integrated development
|
||||||
|
environment (IDE) for many dynamic languages like Python, Julia and
|
||||||
|
others, which operates inside of any web browser. Besides
|
||||||
|
auto-completion and syntax highlighting it allows you to create
|
||||||
|
formatted documents using Markup, mathematical formulas, graphics and
|
||||||
|
animations intermixed with executable Python code. It is a great format
|
||||||
|
for tutorials and showcasing your latest research.
|
||||||
|
|
||||||
|
To launch an instance of Jupyter simply run the following command inside your
|
||||||
|
Python environment (this assumes you followed the Quick Start instructions):
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
jupyter notebook
|
||||||
|
|
||||||
|
Interactive Python Examples
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
Examples of IPython notebooks can be found in the ``python/examples/ipython``
|
||||||
|
subdirectory. To open these notebooks launch ``jupyter notebook`` inside this
|
||||||
|
directory and navigate to one of them. If you compiled and installed
|
||||||
|
a LAMMPS shared library with PNG, JPEG and FFMPEG support
|
||||||
|
you should be able to rerun all of these notebooks.
|
||||||
|
|
||||||
|
Validating a dihedral potential
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This example showcases how an IPython Notebook can be used to compare a simple
|
||||||
|
LAMMPS simulation of a harmonic dihedral potential to its analytical solution.
|
||||||
|
Four atoms are placed in the simulation and the dihedral potential is applied on
|
||||||
|
them using a datafile. Then one of the atoms is rotated along the central axis by
|
||||||
|
setting its position from Python, which changes the dihedral angle.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
phi = [d \* math.pi / 180 for d in range(360)]
|
||||||
|
|
||||||
|
pos = [(1.0, math.cos(p), math.sin(p)) for p in phi]
|
||||||
|
|
||||||
|
x = L.numpy.extract_atom("x")
|
||||||
|
|
||||||
|
pe = []
|
||||||
|
for p in pos:
|
||||||
|
x[3] = p
|
||||||
|
L.cmd.run(0, "post", "no")
|
||||||
|
pe.append(L.get_thermo("pe"))
|
||||||
|
|
||||||
|
By evaluating the potential energy for each position we can verify that
|
||||||
|
trajectory with the analytical formula. To compare both solutions, we plot
|
||||||
|
both trajectories over each other using matplotlib, which embeds the generated
|
||||||
|
plot inside the IPython notebook.
|
||||||
|
|
||||||
|
.. image:: JPG/pylammps_dihedral.jpg
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Running a Monte Carlo relaxation
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This second example shows how to use the `lammps` Python interface to create a
|
||||||
|
2D Monte Carlo Relaxation simulation, computing and plotting energy terms and
|
||||||
|
even embedding video output.
|
||||||
|
|
||||||
|
Initially, a 2D system is created in a state with minimal energy.
|
||||||
|
|
||||||
|
.. image:: JPG/pylammps_mc_minimum.jpg
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
It is then disordered by moving each atom by a random delta.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
random.seed(27848)
|
||||||
|
deltaperturb = 0.2
|
||||||
|
x = L.numpy.extract_atom("x")
|
||||||
|
natoms = x.shape[0]
|
||||||
|
|
||||||
|
for i in range(natoms):
|
||||||
|
dx = deltaperturb \* random.uniform(-1, 1)
|
||||||
|
dy = deltaperturb \* random.uniform(-1, 1)
|
||||||
|
x[i][0] += dx
|
||||||
|
x[i][1] += dy
|
||||||
|
|
||||||
|
L.cmd.run(0, "post", "no")
|
||||||
|
|
||||||
|
.. image:: JPG/pylammps_mc_disordered.jpg
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Finally, the Monte Carlo algorithm is implemented in Python. It continuously
|
||||||
|
moves random atoms by a random delta and only accepts certain moves.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
estart = L.get_thermo("pe")
|
||||||
|
elast = estart
|
||||||
|
|
||||||
|
naccept = 0
|
||||||
|
energies = [estart]
|
||||||
|
|
||||||
|
niterations = 3000
|
||||||
|
deltamove = 0.1
|
||||||
|
kT = 0.05
|
||||||
|
|
||||||
|
for i in range(niterations):
|
||||||
|
x = L.numpy.extract_atom("x")
|
||||||
|
natoms = x.shape[0]
|
||||||
|
iatom = random.randrange(0, natoms)
|
||||||
|
current_atom = x[iatom]
|
||||||
|
|
||||||
|
x0 = current_atom[0]
|
||||||
|
y0 = current_atom[1]
|
||||||
|
|
||||||
|
dx = deltamove \* random.uniform(-1, 1)
|
||||||
|
dy = deltamove \* random.uniform(-1, 1)
|
||||||
|
|
||||||
|
current_atom[0] = x0 + dx
|
||||||
|
current_atom[1] = y0 + dy
|
||||||
|
|
||||||
|
L.cmd.run(1, "pre no post no")
|
||||||
|
|
||||||
|
e = L.get_thermo("pe")
|
||||||
|
energies.append(e)
|
||||||
|
|
||||||
|
if e <= elast:
|
||||||
|
naccept += 1
|
||||||
|
elast = e
|
||||||
|
elif random.random() <= math.exp(natoms\*(elast-e)/kT):
|
||||||
|
naccept += 1
|
||||||
|
elast = e
|
||||||
|
else:
|
||||||
|
current_atom[0] = x0
|
||||||
|
current_atom[1] = y0
|
||||||
|
|
||||||
|
The energies of each iteration are collected in a Python list and finally plotted using matplotlib.
|
||||||
|
|
||||||
|
.. image:: JPG/pylammps_mc_energies_plot.jpg
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
The IPython notebook also shows how to use dump commands and embed video files
|
||||||
|
inside of the IPython notebook.
|
||||||
@ -15,8 +15,9 @@ details of the system, or develop new capabilities. For instance, the numerics
|
|||||||
associated with calculating gradients, reproducing kernels, etc. are separated
|
associated with calculating gradients, reproducing kernels, etc. are separated
|
||||||
into distinct classes to simplify the development of new integration schemes
|
into distinct classes to simplify the development of new integration schemes
|
||||||
which can call these calculations. Additional numerical details can be found in
|
which can call these calculations. Additional numerical details can be found in
|
||||||
:ref:`(Clemmer) <howto_rheo_clemmer>`. Example movies illustrating some of these
|
:ref:`(Palermo) <howto_rheo_palermo>` and :ref:`(Clemmer) <howto_rheo_clemmer>`.
|
||||||
capabilities are found at https://www.lammps.org/movies.html#rheopackage.
|
Example movies illustrating some of these capabilities are found at
|
||||||
|
https://www.lammps.org/movies.html#rheopackage.
|
||||||
|
|
||||||
Note, if you simply want to run a traditional SPH simulation, the :ref:`SPH package
|
Note, if you simply want to run a traditional SPH simulation, the :ref:`SPH package
|
||||||
<PKG-SPH>` package is likely better suited for your application. It has fewer advanced
|
<PKG-SPH>` package is likely better suited for your application. It has fewer advanced
|
||||||
@ -70,7 +71,7 @@ particles to solid (e.g. with the :doc:`set <set>` command), (b) create bpm
|
|||||||
bonds between the particles (see the :doc:`bpm howto <Howto_bpm>` page for
|
bonds between the particles (see the :doc:`bpm howto <Howto_bpm>` page for
|
||||||
more details), and (c) use :doc:`pair rheo/solid <pair_rheo_solid>` to
|
more details), and (c) use :doc:`pair rheo/solid <pair_rheo_solid>` to
|
||||||
apply repulsive contact forces between distinct solid bodies. Akin to pair rheo,
|
apply repulsive contact forces between distinct solid bodies. Akin to pair rheo,
|
||||||
pair rheo/solid considers a particles fluid/solid phase to determine whether to
|
pair rheo/solid considers a particle's fluid/solid phase to determine whether to
|
||||||
apply forces. However, unlike pair rheo, pair rheo/solid does obey special bond
|
apply forces. However, unlike pair rheo, pair rheo/solid does obey special bond
|
||||||
settings such that contact forces do not have to be calculated between two bonded
|
settings such that contact forces do not have to be calculated between two bonded
|
||||||
solid particles in the same elastic body.
|
solid particles in the same elastic body.
|
||||||
@ -79,10 +80,10 @@ In systems with thermal evolution, fix rheo/thermal can optionally set a
|
|||||||
melting/solidification temperature allowing particles to dynamically swap their
|
melting/solidification temperature allowing particles to dynamically swap their
|
||||||
state between fluid and solid when the temperature exceeds or drops below the
|
state between fluid and solid when the temperature exceeds or drops below the
|
||||||
critical temperature, respectively. Using the *react* option, one can specify a maximum
|
critical temperature, respectively. Using the *react* option, one can specify a maximum
|
||||||
bond length and a bond type. Then, when solidifying, particles will search their
|
bond length and a bond type. Then, when solidifying, particles search their
|
||||||
local neighbors and automatically create bonds with any neighboring solid particles
|
local neighbors and automatically create bonds with any neighboring solid particles
|
||||||
in range. For BPM bond styles, bonds will then use the immediate position of the two
|
in range. For BPM bond styles, bonds then use the immediate position of the two
|
||||||
particles to calculate a reference state. When melting, particles will delete any
|
particles to calculate a reference state. When melting, particles delete any
|
||||||
bonds of the specified type when reverting to a fluid state. Special bonds are updated
|
bonds of the specified type when reverting to a fluid state. Special bonds are updated
|
||||||
as bonds are created/broken.
|
as bonds are created/broken.
|
||||||
|
|
||||||
@ -107,6 +108,10 @@ criteria for creating/deleting a bond or altering force calculations).
|
|||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
.. _howto_rheo_palermo:
|
||||||
|
|
||||||
|
**(Palermo)** Palermo, Wolf, Clemmer, O'Connor, Phys. Fluids, 36, 113337 (2024).
|
||||||
|
|
||||||
.. _howto_rheo_clemmer:
|
.. _howto_rheo_clemmer:
|
||||||
|
|
||||||
**(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024).
|
**(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024).
|
||||||
|
|||||||
@ -260,7 +260,7 @@ Switch into the :code:`examples/melt` folder:
|
|||||||
|
|
||||||
cd ../examples/melt
|
cd ../examples/melt
|
||||||
|
|
||||||
To run this example in serial, use the following command line:
|
To run this example in serial, use the following command:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ between them at any time using "git checkout <branch name>".)
|
|||||||
files (mostly by accident). If you do not need access to the entire
|
files (mostly by accident). If you do not need access to the entire
|
||||||
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, which contains only a subset of the git history.
|
of the repository, which contains only a subset of the git history.
|
||||||
Using a depth of 1000 is usually sufficient to include the head
|
Using a depth of 1000 is usually sufficient to include the head
|
||||||
commits of the *develop*, the *release*, and the *maintenance*
|
commits of the *develop*, the *release*, and the *maintenance*
|
||||||
|
|||||||
@ -8,6 +8,8 @@ send an email to all of them at this address: "developers at
|
|||||||
lammps.org". General questions about LAMMPS should be posted in the
|
lammps.org". General questions about LAMMPS should be posted in the
|
||||||
`LAMMPS forum on MatSci <https://matsci.org/lammps/>`_.
|
`LAMMPS forum on MatSci <https://matsci.org/lammps/>`_.
|
||||||
|
|
||||||
|
.. We need to keep this file in sync with https://www.lammps.org/authors.html
|
||||||
|
|
||||||
.. raw:: latex
|
.. raw:: latex
|
||||||
|
|
||||||
\small
|
\small
|
||||||
@ -27,7 +29,7 @@ lammps.org". General questions about LAMMPS should be posted in the
|
|||||||
* - `Steve Plimpton <sjp_>`_
|
* - `Steve Plimpton <sjp_>`_
|
||||||
- SNL (retired)
|
- SNL (retired)
|
||||||
- sjplimp at gmail.com
|
- sjplimp at gmail.com
|
||||||
- MD kernels, parallel algorithms & scalability, code structure and design
|
- original author, MD kernels, parallel algorithms & scalability, code structure and design
|
||||||
* - `Aidan Thompson <at_>`_
|
* - `Aidan Thompson <at_>`_
|
||||||
- SNL
|
- SNL
|
||||||
- athomps at sandia.gov
|
- athomps at sandia.gov
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 78 KiB |
@ -131,16 +131,15 @@ run LAMMPS in serial mode.
|
|||||||
|
|
||||||
.. _lammps_python_api:
|
.. _lammps_python_api:
|
||||||
|
|
||||||
LAMMPS Python APIs
|
LAMMPS Python API
|
||||||
==================
|
=================
|
||||||
|
|
||||||
The LAMMPS Python module enables calling the LAMMPS C library API from
|
The LAMMPS Python module enables calling the LAMMPS C library API from
|
||||||
Python by dynamically loading functions in the LAMMPS shared library through
|
Python by dynamically loading functions in the LAMMPS shared library through
|
||||||
the `Python ctypes module <https://docs.python.org/3/library/ctypes.html>`_.
|
the `Python ctypes module <https://docs.python.org/3/library/ctypes.html>`_.
|
||||||
Because of the dynamic loading, it is **required** that LAMMPS is compiled
|
Because of the dynamic loading, it is **required** that LAMMPS is compiled
|
||||||
in :ref:`"shared" mode <exe>`. The Python interface is object-oriented, but
|
in :ref:`"shared" mode <exe>`. The Python interface is object-oriented, but
|
||||||
otherwise tries to be very similar to the C library API. Three different
|
otherwise tries to be very similar to the C library API.
|
||||||
Python classes to run LAMMPS are available and they build on each other.
|
|
||||||
More information on this is in the :doc:`Python_head`
|
More information on this is in the :doc:`Python_head`
|
||||||
section of the manual. Use of the LAMMPS Python module is described in
|
section of the manual. Use of the LAMMPS Python module is described in
|
||||||
:doc:`Python_module`.
|
:doc:`Python_module`.
|
||||||
|
|||||||
@ -208,20 +208,21 @@ Build system (strict)
|
|||||||
|
|
||||||
LAMMPS currently supports two build systems: one that is based on
|
LAMMPS currently supports two build systems: one that is based on
|
||||||
:doc:`traditional Makefiles <Build_make>` and one that is based on
|
:doc:`traditional Makefiles <Build_make>` and one that is based on
|
||||||
:doc:`CMake <Build_cmake>`. Therefore, your contribution must be
|
:doc:`CMake <Build_cmake>`. As of fall 2024, it is no longer required
|
||||||
compatible with and support both build systems.
|
to support the traditional make build system. New packages may choose
|
||||||
|
to only support building with CMake. Additions to existing packages
|
||||||
|
must follow the requirements set by that package.
|
||||||
|
|
||||||
For a single pair of header and implementation files that are an
|
For a single pair of header and implementation files that are an
|
||||||
independent feature, it is usually only required to add them to
|
independent feature, it is usually only required to add them to
|
||||||
``src/.gitignore``.
|
``src/.gitignore``.
|
||||||
|
|
||||||
For traditional make, if your contributed files or package depend on
|
For traditional make, if your contributed files or package depend on
|
||||||
other LAMMPS style files or packages also being installed
|
other LAMMPS style files or packages also being installed (e.g. because
|
||||||
(e.g. because your file is a derived class from the other LAMMPS
|
your file is a derived class from the other LAMMPS class), then an
|
||||||
class), then an ``Install.sh`` file is also needed to check for those
|
``Install.sh`` file is also needed to check for those dependencies and
|
||||||
dependencies and modifications to ``src/Depend.sh`` to trigger the checks.
|
modifications to ``src/Depend.sh`` to trigger the checks. See other
|
||||||
See other README and Install.sh files in other directories as
|
README and Install.sh files in other directories as examples.
|
||||||
examples.
|
|
||||||
|
|
||||||
Similarly, for CMake support, changes may need to be made to
|
Similarly, for CMake support, changes may need to be made to
|
||||||
``cmake/CMakeLists.txt``, some of the files in ``cmake/presets``, and
|
``cmake/CMakeLists.txt``, some of the files in ``cmake/presets``, and
|
||||||
|
|||||||
@ -46,7 +46,7 @@ Include files (varied)
|
|||||||
but instead should be initialized either in the initializer list of
|
but instead should be initialized either in the initializer list of
|
||||||
the constructor or explicitly assigned in the body of the constructor.
|
the constructor or explicitly assigned in the body of the constructor.
|
||||||
If the member variable is relevant to the functionality of a class
|
If the member variable is relevant to the functionality of a class
|
||||||
(for example when it stores a value from a command line argument), the
|
(for example when it stores a value from a command-line argument), the
|
||||||
member variable declaration is followed by a brief comment explaining
|
member variable declaration is followed by a brief comment explaining
|
||||||
its purpose and what its values can be. Class members that are
|
its purpose and what its values can be. Class members that are
|
||||||
pointers should always be initialized to ``nullptr`` in the
|
pointers should always be initialized to ``nullptr`` in the
|
||||||
|
|||||||
@ -2171,8 +2171,8 @@ the :doc:`Build extras <Build_extras>` page.
|
|||||||
* ``src/OPENMP/README``
|
* ``src/OPENMP/README``
|
||||||
* :doc:`Accelerator packages <Speed_packages>`
|
* :doc:`Accelerator packages <Speed_packages>`
|
||||||
* :doc:`OPENMP package <Speed_omp>`
|
* :doc:`OPENMP package <Speed_omp>`
|
||||||
* :doc:`Command line option -suffix/-sf omp <Run_options>`
|
* :doc:`Command-line option -suffix/-sf omp <Run_options>`
|
||||||
* :doc:`Command line option -package/-pk omp <Run_options>`
|
* :doc:`Command-line option -package/-pk omp <Run_options>`
|
||||||
* :doc:`package omp <package>`
|
* :doc:`package omp <package>`
|
||||||
* Search the :doc:`commands <Commands_all>` pages (:doc:`fix <Commands_fix>`, :doc:`compute <Commands_compute>`,
|
* Search the :doc:`commands <Commands_all>` pages (:doc:`fix <Commands_fix>`, :doc:`compute <Commands_compute>`,
|
||||||
:doc:`pair <Commands_pair>`, :doc:`bond, angle, dihedral, improper <Commands_bond>`,
|
:doc:`pair <Commands_pair>`, :doc:`bond, angle, dihedral, improper <Commands_bond>`,
|
||||||
@ -2789,14 +2789,15 @@ implements smoothed particle hydrodynamics (SPH) for liquids. See the
|
|||||||
related :ref:`MACHDYN package <PKG-MACHDYN>` package for smooth Mach dynamics
|
related :ref:`MACHDYN package <PKG-MACHDYN>` package for smooth Mach dynamics
|
||||||
(SMD) for solids.
|
(SMD) for solids.
|
||||||
|
|
||||||
This package contains ideal gas, Lennard-Jones equation of states,
|
This package contains ideal gas, Lennard-Jones equation of states, Tait,
|
||||||
Tait, and full support for complete (i.e. internal-energy dependent)
|
and full support for complete (i.e. internal-energy dependent) equations
|
||||||
equations of state. It allows for plain or Monaghans XSPH integration
|
of state. It allows for plain or Monaghans XSPH integration of the
|
||||||
of the equations of motion. It has options for density continuity or
|
equations of motion. It has options for density continuity or density
|
||||||
density summation to propagate the density field. It has
|
summation to propagate the density field. It has :doc:`set <set>`
|
||||||
:doc:`set <set>` command options to set the internal energy and density
|
command options to set the internal energy and density of particles from
|
||||||
of particles from the input script and allows the same quantities to
|
the input script and allows the same quantities to be output with
|
||||||
be output with thermodynamic output or to dump files via the :doc:`compute property/atom <compute_property_atom>` command.
|
thermodynamic output or to dump files via the :doc:`compute
|
||||||
|
property/atom <compute_property_atom>` command.
|
||||||
|
|
||||||
**Author:** Georg Ganzenmuller (Fraunhofer-Institute for High-Speed
|
**Author:** Georg Ganzenmuller (Fraunhofer-Institute for High-Speed
|
||||||
Dynamics, Ernst Mach Institute, Germany).
|
Dynamics, Ernst Mach Institute, Germany).
|
||||||
@ -2809,6 +2810,17 @@ Dynamics, Ernst Mach Institute, Germany).
|
|||||||
* ``examples/PACKAGES/sph``
|
* ``examples/PACKAGES/sph``
|
||||||
* https://www.lammps.org/movies.html#sph
|
* https://www.lammps.org/movies.html#sph
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Please note that the SPH PDF guide file has not been updated for
|
||||||
|
many years and thus does not reflect the current *syntax* of the
|
||||||
|
SPH package commands. For that please refer to the LAMMPS manual.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Please also note, that the :ref:`RHEO package <PKG-RHEO>` offers
|
||||||
|
similar functionality in a more modern and flexible implementation.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
.. _PKG-SPIN:
|
.. _PKG-SPIN:
|
||||||
|
|||||||
@ -2,14 +2,8 @@ Per-atom properties
|
|||||||
===================
|
===================
|
||||||
|
|
||||||
Similar to what is described in :doc:`Library_atoms`, the instances of
|
Similar to what is described in :doc:`Library_atoms`, the instances of
|
||||||
:py:class:`lammps <lammps.lammps>`, :py:class:`PyLammps <lammps.PyLammps>`, or
|
:py:class:`lammps <lammps.lammps>` can be used to extract atom quantities
|
||||||
:py:class:`IPyLammps <lammps.IPyLammps>` can be used to extract atom quantities
|
and modify some of them.
|
||||||
and modify some of them. The main difference between the interfaces is how the information
|
|
||||||
is exposed.
|
|
||||||
|
|
||||||
While the :py:class:`lammps <lammps.lammps>` is just a thin layer that wraps C API calls,
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>` and :py:class:`IPyLammps <lammps.IPyLammps>` expose
|
|
||||||
information as objects and properties.
|
|
||||||
|
|
||||||
In some cases the data returned is a direct reference to the original data
|
In some cases the data returned is a direct reference to the original data
|
||||||
inside LAMMPS cast to ``ctypes`` pointers. Where possible, the wrappers will
|
inside LAMMPS cast to ``ctypes`` pointers. Where possible, the wrappers will
|
||||||
@ -25,57 +19,41 @@ against invalid accesses.
|
|||||||
accordingly. These arrays can change sizes and order at every neighbor list
|
accordingly. These arrays can change sizes and order at every neighbor list
|
||||||
rebuild and atom sort event as atoms are migrating between subdomains.
|
rebuild and atom sort event as atoms are migrating between subdomains.
|
||||||
|
|
||||||
.. tabs::
|
.. code-block:: python
|
||||||
|
|
||||||
.. tab:: lammps API
|
from lammps import lammps
|
||||||
|
|
||||||
.. code-block:: python
|
lmp = lammps()
|
||||||
|
lmp.file("in.sysinit")
|
||||||
|
|
||||||
from lammps import lammps
|
|
||||||
|
|
||||||
lmp = lammps()
|
# Read/Write access via ctypes
|
||||||
lmp.file("in.sysinit")
|
nlocal = lmp.extract_global("nlocal")
|
||||||
|
x = lmp.extract_atom("x")
|
||||||
|
|
||||||
nlocal = lmp.extract_global("nlocal")
|
for i in range(nlocal):
|
||||||
x = lmp.extract_atom("x")
|
print("(x,y,z) = (", x[i][0], x[i][1], x[i][2], ")")
|
||||||
|
|
||||||
for i in range(nlocal):
|
# Read/Write access via NumPy arrays
|
||||||
print("(x,y,z) = (", x[i][0], x[i][1], x[i][2], ")")
|
atom_id = L.numpy.extract_atom("id")
|
||||||
|
atom_type = L.numpy.extract_atom("type")
|
||||||
|
x = L.numpy.extract_atom("x")
|
||||||
|
v = L.numpy.extract_atom("v")
|
||||||
|
f = L.numpy.extract_atom("f")
|
||||||
|
|
||||||
lmp.close()
|
# set position in 2D simulation
|
||||||
|
x[0] = (1.0, 0.0)
|
||||||
|
|
||||||
**Methods**:
|
# set position in 3D simulation
|
||||||
|
x[0] = (1.0, 0.0, 1.)
|
||||||
|
|
||||||
* :py:meth:`extract_atom() <lammps.lammps.extract_atom()>`: extract a per-atom quantity
|
lmp.close()
|
||||||
|
|
||||||
**Numpy Methods**:
|
|
||||||
|
|
||||||
* :py:meth:`numpy.extract_atom() <lammps.numpy_wrapper.numpy_wrapper.extract_atom()>`: extract a per-atom quantity as numpy array
|
**Methods**:
|
||||||
|
|
||||||
.. tab:: PyLammps/IPyLammps API
|
* :py:meth:`extract_atom() <lammps.lammps.extract_atom()>`: extract a per-atom quantity
|
||||||
|
|
||||||
All atoms in the current simulation can be accessed by using the :py:attr:`PyLammps.atoms <lammps.PyLammps.atoms>` property.
|
**Numpy Methods**:
|
||||||
Each element of this list is a :py:class:`Atom <lammps.Atom>` or :py:class:`Atom2D <lammps.Atom2D>` object. The attributes of
|
|
||||||
these objects provide access to their data (id, type, position, velocity, force, etc.):
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# access first atom
|
|
||||||
L.atoms[0].id
|
|
||||||
L.atoms[0].type
|
|
||||||
|
|
||||||
# access second atom
|
|
||||||
L.atoms[1].position
|
|
||||||
L.atoms[1].velocity
|
|
||||||
L.atoms[1].force
|
|
||||||
|
|
||||||
Some attributes can be changed:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
# set position in 2D simulation
|
|
||||||
L.atoms[0].position = (1.0, 0.0)
|
|
||||||
|
|
||||||
# set position in 3D simulation
|
|
||||||
L.atoms[0].position = (1.0, 0.0, 1.0)
|
|
||||||
|
|
||||||
|
* :py:meth:`numpy.extract_atom() <lammps.numpy_wrapper.numpy_wrapper.extract_atom()>`: extract a per-atom quantity as numpy array
|
||||||
|
|||||||
@ -6,11 +6,10 @@ Creating or deleting a LAMMPS object
|
|||||||
====================================
|
====================================
|
||||||
|
|
||||||
With the Python interface the creation of a :cpp:class:`LAMMPS
|
With the Python interface the creation of a :cpp:class:`LAMMPS
|
||||||
<LAMMPS_NS::LAMMPS>` instance is included in the constructors for the
|
<LAMMPS_NS::LAMMPS>` instance is included in the constructor for the
|
||||||
:py:class:`lammps <lammps.lammps>`, :py:class:`PyLammps <lammps.PyLammps>`,
|
:py:class:`lammps <lammps.lammps>` class. Internally it will call either
|
||||||
and :py:class:`IPyLammps <lammps.IPyLammps>` classes.
|
:cpp:func:`lammps_open` or :cpp:func:`lammps_open_no_mpi` from the C library
|
||||||
Internally it will call either :cpp:func:`lammps_open` or :cpp:func:`lammps_open_no_mpi` from the C
|
API to create the class instance.
|
||||||
library API to create the class instance.
|
|
||||||
|
|
||||||
All arguments are optional. The *name* argument allows loading a
|
All arguments are optional. The *name* argument allows loading a
|
||||||
LAMMPS shared library that is named ``liblammps_machine.so`` instead of
|
LAMMPS shared library that is named ``liblammps_machine.so`` instead of
|
||||||
@ -26,108 +25,25 @@ to run the Python module like the library interface on a subset of the
|
|||||||
MPI ranks after splitting the communicator.
|
MPI ranks after splitting the communicator.
|
||||||
|
|
||||||
|
|
||||||
Here are simple examples using all three Python interfaces:
|
Here is a simple example using the LAMMPS Python interface:
|
||||||
|
|
||||||
.. tabs::
|
.. code-block:: python
|
||||||
|
|
||||||
.. tab:: lammps API
|
from lammps import lammps
|
||||||
|
|
||||||
.. code-block:: python
|
# NOTE: argv[0] is set by the lammps class constructor
|
||||||
|
args = ["-log", "none"]
|
||||||
|
|
||||||
from lammps import lammps
|
# create LAMMPS instance
|
||||||
|
lmp = lammps(cmdargs=args)
|
||||||
|
|
||||||
# NOTE: argv[0] is set by the lammps class constructor
|
# get and print numerical version code
|
||||||
args = ["-log", "none"]
|
print("LAMMPS Version: ", lmp.version())
|
||||||
|
|
||||||
# create LAMMPS instance
|
# explicitly close and delete LAMMPS instance (optional)
|
||||||
lmp = lammps(cmdargs=args)
|
lmp.close()
|
||||||
|
|
||||||
# get and print numerical version code
|
Same as with the :ref:`C library API <lammps_c_api>`, this will use the
|
||||||
print("LAMMPS Version: ", lmp.version())
|
|
||||||
|
|
||||||
# explicitly close and delete LAMMPS instance (optional)
|
|
||||||
lmp.close()
|
|
||||||
|
|
||||||
.. tab:: PyLammps API
|
|
||||||
|
|
||||||
The :py:class:`PyLammps <lammps.PyLammps>` class is a wrapper around the
|
|
||||||
:py:class:`lammps <lammps.lammps>` class and all of its lower level functions.
|
|
||||||
By default, it will create a new instance of :py:class:`lammps <lammps.lammps>` passing
|
|
||||||
along all arguments to the constructor of :py:class:`lammps <lammps.lammps>`.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from lammps import PyLammps
|
|
||||||
|
|
||||||
# NOTE: argv[0] is set by the lammps class constructor
|
|
||||||
args = ["-log", "none"]
|
|
||||||
|
|
||||||
# create LAMMPS instance
|
|
||||||
L = PyLammps(cmdargs=args)
|
|
||||||
|
|
||||||
# get and print numerical version code
|
|
||||||
print("LAMMPS Version: ", L.version())
|
|
||||||
|
|
||||||
# explicitly close and delete LAMMPS instance (optional)
|
|
||||||
L.close()
|
|
||||||
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>` objects can also be created on top of an existing
|
|
||||||
:py:class:`lammps <lammps.lammps>` object:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from lammps import lammps, PyLammps
|
|
||||||
...
|
|
||||||
# create LAMMPS instance
|
|
||||||
lmp = lammps(cmdargs=args)
|
|
||||||
|
|
||||||
# create PyLammps instance using previously created LAMMPS instance
|
|
||||||
L = PyLammps(ptr=lmp)
|
|
||||||
|
|
||||||
This is useful if you have to create the :py:class:`lammps <lammps.lammps>`
|
|
||||||
instance is a specific way, but want to take advantage of the
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>` interface.
|
|
||||||
|
|
||||||
.. tab:: IPyLammps API
|
|
||||||
|
|
||||||
The :py:class:`IPyLammps <lammps.IPyLammps>` class is an extension of the
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>` class. It has the same construction behavior. By
|
|
||||||
default, it will create a new instance of :py:class:`lammps` passing
|
|
||||||
along all arguments to the constructor of :py:class:`lammps`.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from lammps import IPyLammps
|
|
||||||
|
|
||||||
# NOTE: argv[0] is set by the lammps class constructor
|
|
||||||
args = ["-log", "none"]
|
|
||||||
|
|
||||||
# create LAMMPS instance
|
|
||||||
L = IPyLammps(cmdargs=args)
|
|
||||||
|
|
||||||
# get and print numerical version code
|
|
||||||
print("LAMMPS Version: ", L.version())
|
|
||||||
|
|
||||||
# explicitly close and delete LAMMPS instance (optional)
|
|
||||||
L.close()
|
|
||||||
|
|
||||||
You can also initialize IPyLammps on top of an existing :py:class:`lammps` or :py:class:`PyLammps` object:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from lammps import lammps, IPyLammps
|
|
||||||
...
|
|
||||||
# create LAMMPS instance
|
|
||||||
lmp = lammps(cmdargs=args)
|
|
||||||
|
|
||||||
# create PyLammps instance using previously created LAMMPS instance
|
|
||||||
L = PyLammps(ptr=lmp)
|
|
||||||
|
|
||||||
This is useful if you have to create the :py:class:`lammps <lammps.lammps>`
|
|
||||||
instance is a specific way, but want to take advantage of the
|
|
||||||
:py:class:`IPyLammps <lammps.IPyLammps>` interface.
|
|
||||||
|
|
||||||
In all of the above cases, same as with the :ref:`C library API <lammps_c_api>`, this will use the
|
|
||||||
``MPI_COMM_WORLD`` communicator for the MPI library that LAMMPS was
|
``MPI_COMM_WORLD`` communicator for the MPI library that LAMMPS was
|
||||||
compiled with.
|
compiled with.
|
||||||
|
|
||||||
|
|||||||
@ -1,127 +1,123 @@
|
|||||||
Executing commands
|
Executing commands
|
||||||
==================
|
==================
|
||||||
|
|
||||||
Once an instance of the :py:class:`lammps <lammps.lammps>`,
|
Once an instance of the :py:class:`lammps <lammps.lammps>` class is created, there are
|
||||||
:py:class:`PyLammps <lammps.PyLammps>`, or
|
|
||||||
:py:class:`IPyLammps <lammps.IPyLammps>` class is created, there are
|
|
||||||
multiple ways to "feed" it commands. In a way that is not very different from
|
multiple ways to "feed" it commands. In a way that is not very different from
|
||||||
running a LAMMPS input script, except that Python has many more facilities
|
running a LAMMPS input script, except that Python has many more facilities
|
||||||
for structured programming than the LAMMPS input script syntax. Furthermore
|
for structured programming than the LAMMPS input script syntax. Furthermore
|
||||||
it is possible to "compute" what the next LAMMPS command should be.
|
it is possible to "compute" what the next LAMMPS command should be.
|
||||||
|
|
||||||
.. tabs::
|
Same as in the equivalent :doc:`C library functions <Library_execute>`,
|
||||||
|
commands can be read from a file, a single string, a list of strings and a
|
||||||
|
block of commands in a single multi-line string. They are processed under the
|
||||||
|
same boundary conditions as the C library counterparts. The example below
|
||||||
|
demonstrates the use of :py:func:`lammps.file()`, :py:func:`lammps.command()`,
|
||||||
|
:py:func:`lammps.commands_list()`, and :py:func:`lammps.commands_string()`:
|
||||||
|
|
||||||
.. tab:: lammps API
|
.. code-block:: python
|
||||||
|
|
||||||
Same as in the equivalent
|
from lammps import lammps
|
||||||
:doc:`C library functions <Library_execute>`, commands can be read from a file, a
|
lmp = lammps()
|
||||||
single string, a list of strings and a block of commands in a single
|
|
||||||
multi-line string. They are processed under the same boundary conditions
|
|
||||||
as the C library counterparts. The example below demonstrates the use
|
|
||||||
of :py:func:`lammps.file()`, :py:func:`lammps.command()`,
|
|
||||||
:py:func:`lammps.commands_list()`, and :py:func:`lammps.commands_string()`:
|
|
||||||
|
|
||||||
.. code-block:: python
|
# read commands from file 'in.melt'
|
||||||
|
lmp.file('in.melt')
|
||||||
|
|
||||||
from lammps import lammps
|
# issue a single command
|
||||||
lmp = lammps()
|
lmp.command('variable zpos index 1.0')
|
||||||
|
|
||||||
# read commands from file 'in.melt'
|
# create 10 groups with 10 atoms each
|
||||||
lmp.file('in.melt')
|
cmds = [f"group g{i} id {10*i+1}:{10*(i+1)}" for i in range(10)]
|
||||||
|
lmp.commands_list(cmds)
|
||||||
|
|
||||||
# issue a single command
|
# run commands from a multi-line string
|
||||||
lmp.command('variable zpos index 1.0')
|
block = """
|
||||||
|
clear
|
||||||
|
region box block 0 2 0 2 0 2
|
||||||
|
create_box 1 box
|
||||||
|
create_atoms 1 single 1.0 1.0 ${zpos}
|
||||||
|
"""
|
||||||
|
lmp.commands_string(block)
|
||||||
|
|
||||||
# create 10 groups with 10 atoms each
|
For convenience, the :py:class:`lammps <lammps.lammps>` class also provides a
|
||||||
cmds = ["group g{} id {}:{}".format(i,10*i+1,10*(i+1)) for i in range(10)]
|
command wrapper ``cmd`` that turns any LAMMPS command into a regular function
|
||||||
lmp.commands_list(cmds)
|
call.
|
||||||
|
|
||||||
# run commands from a multi-line string
|
For instance, the following LAMMPS command
|
||||||
block = """
|
|
||||||
clear
|
|
||||||
region box block 0 2 0 2 0 2
|
|
||||||
create_box 1 box
|
|
||||||
create_atoms 1 single 1.0 1.0 ${zpos}
|
|
||||||
"""
|
|
||||||
lmp.commands_string(block)
|
|
||||||
|
|
||||||
.. tab:: PyLammps/IPyLammps API
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
Unlike the lammps API, the PyLammps/IPyLammps APIs allow running LAMMPS
|
region box block 0 10 0 5 -0.5 0.5
|
||||||
commands by calling equivalent member functions of :py:class:`PyLammps <lammps.PyLammps>`
|
|
||||||
and :py:class:`IPyLammps <lammps.IPyLammps>` instances.
|
|
||||||
|
|
||||||
For instance, the following LAMMPS command
|
would normally be executed with the following Python code:
|
||||||
|
|
||||||
.. code-block:: LAMMPS
|
.. code-block:: python
|
||||||
|
|
||||||
region box block 0 10 0 5 -0.5 0.5
|
from lammps import lammps
|
||||||
|
|
||||||
can be executed using with the lammps API with the following Python code if ``lmp`` is an
|
lmp = lammps()
|
||||||
instance of :py:class:`lammps <lammps.lammps>`:
|
lmp.command("region box block 0 10 0 5 -0.5 0.5")
|
||||||
|
|
||||||
.. code-block:: python
|
With the ``cmd`` wrapper, any LAMMPS command can be split up into arbitrary parts.
|
||||||
|
These parts are then passed to a member function with the name of the :doc:`command <Commands_all>`.
|
||||||
|
For the :doc:`region <region>` command that means the :code:`region()` method can be called.
|
||||||
|
The arguments of the command can be passed as one string, or
|
||||||
|
individually.
|
||||||
|
|
||||||
from lammps import lammps
|
.. code-block:: python
|
||||||
|
|
||||||
lmp = lammps()
|
from lammps import lammps
|
||||||
lmp.command("region box block 0 10 0 5 -0.5 0.5")
|
|
||||||
|
|
||||||
With the PyLammps interface, any LAMMPS command can be split up into arbitrary parts.
|
L = lammps()
|
||||||
These parts are then passed to a member function with the name of the :doc:`command <Commands_all>`.
|
|
||||||
For the :doc:`region <region>` command that means the :code:`region()` method can be called.
|
|
||||||
The arguments of the command can be passed as one string, or
|
|
||||||
individually.
|
|
||||||
|
|
||||||
.. code-block:: python
|
# pass command parameters as one string
|
||||||
|
L.cmd.region("box block 0 10 0 5 -0.5 0.5")
|
||||||
|
|
||||||
from lammps import PyLammps
|
# OR pass them individually
|
||||||
|
L.cmd.region("box block", 0, 10, 0, 5, -0.5, 0.5)
|
||||||
|
|
||||||
L = PyLammps()
|
In the latter example, all parameters except the first are Python floating-point literals. The
|
||||||
|
member function takes the entire parameter list and transparently merges it to a single command
|
||||||
|
string.
|
||||||
|
|
||||||
# pass command parameters as one string
|
The benefit of this approach is avoiding redundant command calls and easier
|
||||||
L.region("box block 0 10 0 5 -0.5 0.5")
|
parameterization. With `command`, `commands_list`, and `commands_string` the
|
||||||
|
parameterization needed to be done manually by creating formatted command
|
||||||
|
strings.
|
||||||
|
|
||||||
# OR pass them individually
|
.. code-block:: python
|
||||||
L.region("box block", 0, 10, 0, 5, -0.5, 0.5)
|
|
||||||
|
|
||||||
In the latter example, all parameters except the first are Python floating-point literals. The
|
lmp.command("region box block %f %f %f %f %f %f" % (xlo, xhi, ylo, yhi, zlo, zhi))
|
||||||
member function takes the entire parameter list and transparently merges it to a single command
|
|
||||||
string.
|
|
||||||
|
|
||||||
The benefit of this approach is avoiding redundant command calls and easier
|
In contrast, methods of the `cmd` wrapper accept parameters directly and will convert
|
||||||
parameterization. In the lammps API parameterization needed to be done
|
them automatically to a final command string.
|
||||||
manually by creating formatted command strings.
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
lmp.command("region box block %f %f %f %f %f %f" % (xlo, xhi, ylo, yhi, zlo, zhi))
|
L.cmd.region("box block", xlo, xhi, ylo, yhi, zlo, zhi)
|
||||||
|
|
||||||
In contrast, methods of PyLammps accept parameters directly and will convert
|
.. note::
|
||||||
them automatically to a final command string.
|
|
||||||
|
|
||||||
.. code-block:: python
|
When running in IPython you can use Tab-completion after ``L.cmd.`` to see
|
||||||
|
all available LAMMPS commands.
|
||||||
|
|
||||||
L.region("box block", xlo, xhi, ylo, yhi, zlo, zhi)
|
Using these facilities, the previous example shown above can be rewritten as follows:
|
||||||
|
|
||||||
Using these facilities, the example shown for the lammps API can be rewritten as follows:
|
.. code-block:: python
|
||||||
|
|
||||||
.. code-block:: python
|
from lammps import lammps
|
||||||
|
L = lammps()
|
||||||
|
|
||||||
from lammps import PyLammps
|
# read commands from file 'in.melt'
|
||||||
L = PyLammps()
|
L.file('in.melt')
|
||||||
|
|
||||||
# read commands from file 'in.melt'
|
# issue a single command
|
||||||
L.file('in.melt')
|
L.cmd.variable('zpos', 'index', 1.0)
|
||||||
|
|
||||||
# issue a single command
|
# create 10 groups with 10 atoms each
|
||||||
L.variable('zpos', 'index', 1.0)
|
for i in range(10):
|
||||||
|
L.cmd.group(f"g{i}", "id", f"{10*i+1}:{10*(i+1)}")
|
||||||
|
|
||||||
# create 10 groups with 10 atoms each
|
L.cmd.clear()
|
||||||
for i in range(10):
|
L.cmd.region("box block", 0, 2, 0, 2, 0, 2)
|
||||||
L.group(f"g{i}", "id", f"{10*i+1}:{10*(i+1)}")
|
L.cmd.create_box(1, "box")
|
||||||
|
L.cmd.create_atoms(1, "single", 1.0, 1.0, "${zpos}")
|
||||||
L.clear()
|
|
||||||
L.region("box block", 0, 2, 0, 2, 0, 2)
|
|
||||||
L.create_box(1, "box")
|
|
||||||
L.create_atoms(1, "single", 1.0, 1.0, "${zpos}")
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ together.
|
|||||||
Python_call
|
Python_call
|
||||||
Python_formats
|
Python_formats
|
||||||
Python_examples
|
Python_examples
|
||||||
|
Python_jupyter
|
||||||
Python_error
|
Python_error
|
||||||
Python_trouble
|
Python_trouble
|
||||||
|
|
||||||
|
|||||||
45
doc/src/Python_jupyter.rst
Normal file
45
doc/src/Python_jupyter.rst
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
Using LAMMPS in IPython notebooks and Jupyter
|
||||||
|
=============================================
|
||||||
|
|
||||||
|
If the LAMMPS Python package is installed for the same Python interpreter as
|
||||||
|
`IPython <ipython>`_, you can use LAMMPS directly inside of an IPython notebook inside of
|
||||||
|
Jupyter. `Jupyter <juypter>`_ is a powerful integrated development environment (IDE) for
|
||||||
|
many dynamic languages like Python, Julia and others, which operates inside of
|
||||||
|
any web browser. Besides auto-completion and syntax highlighting it allows you
|
||||||
|
to create formatted documents using Markup, mathematical formulas, graphics and
|
||||||
|
animations intermixed with executable Python code. It is a great format for
|
||||||
|
tutorials and showcasing your latest research.
|
||||||
|
|
||||||
|
The easiest way to install it is via ``pip``:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pip install --user jupyter
|
||||||
|
|
||||||
|
To launch an instance of Jupyter simply run the following command inside your
|
||||||
|
Python environment:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
jupyter notebook
|
||||||
|
|
||||||
|
Interactive Python Examples
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
Examples of IPython notebooks can be found in the ``python/examples/ipython``
|
||||||
|
subdirectory. They require LAMMPS to be compiled as shared library with PYTHON,
|
||||||
|
PNG, JPEG and FFMPEG support.
|
||||||
|
|
||||||
|
To open these notebooks launch ``jupyter notebook index.ipynb`` inside this
|
||||||
|
directory. The opened file provides an overview of the available examples.
|
||||||
|
|
||||||
|
- Example 1: Using LAMMPS with Python (``simple.ipynb``)
|
||||||
|
- Example 2: Analyzing LAMMPS thermodynamic data (``thermo.ipynb``)
|
||||||
|
- Example 3: Working with Per-Atom Data (``atoms.ipynb``)
|
||||||
|
- Example 4: Working with LAMMPS variables (``variables.ipynb``)
|
||||||
|
- Example 5: Validating a dihedral potential (``dihedrals/dihedral.ipynb``)
|
||||||
|
- Example 6: Running a Monte Carlo relaxation (``montecarlo/mc.ipynb``)
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Typically clicking a link in Jupyter will open a new tab, which might be blocked by your pop-up blocker.
|
||||||
@ -10,19 +10,11 @@ be installed into a Python system folder or a user folder with ``make
|
|||||||
install-python``. Components of the module can then loaded into a Python
|
install-python``. Components of the module can then loaded into a Python
|
||||||
session with the ``import`` command.
|
session with the ``import`` command.
|
||||||
|
|
||||||
There are multiple Python interface classes in the :py:mod:`lammps` module:
|
.. warning::
|
||||||
|
|
||||||
- the :py:class:`lammps <lammps.lammps>` class. This is a wrapper around
|
Alternative interfaces such as :py:class:`PyLammps <lammps.PyLammps>` and
|
||||||
the C-library interface and its member functions try to replicate the
|
:py:class:`IPyLammps <lammps.IPyLammps>` classes have been deprecated and
|
||||||
:ref:`C-library API <lammps_c_api>` closely. This is the most
|
will be removed in a future version of LAMMPS.
|
||||||
feature-complete Python API.
|
|
||||||
- the :py:class:`PyLammps <lammps.PyLammps>` class. This is a more high-level
|
|
||||||
and more Python style class implemented on top of the
|
|
||||||
:py:class:`lammps <lammps.lammps>` class.
|
|
||||||
- the :py:class:`IPyLammps <lammps.IPyLammps>` class is derived from
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>` and adds embedded graphics
|
|
||||||
features to conveniently include LAMMPS into `Jupyter
|
|
||||||
<https://jupyter.org/>`_ notebooks.
|
|
||||||
|
|
||||||
.. _mpi4py_url: https://mpi4py.readthedocs.io
|
.. _mpi4py_url: https://mpi4py.readthedocs.io
|
||||||
|
|
||||||
@ -49,7 +41,7 @@ The ``lammps`` class API
|
|||||||
========================
|
========================
|
||||||
|
|
||||||
The :py:class:`lammps <lammps.lammps>` class is the core of the LAMMPS
|
The :py:class:`lammps <lammps.lammps>` class is the core of the LAMMPS
|
||||||
Python interfaces. It is a wrapper around the :ref:`LAMMPS C library
|
Python interface. It is a wrapper around the :ref:`LAMMPS C library
|
||||||
API <lammps_c_api>` using the `Python ctypes module
|
API <lammps_c_api>` using the `Python ctypes module
|
||||||
<https://docs.python.org/3/library/ctypes.html>`_ and a shared library
|
<https://docs.python.org/3/library/ctypes.html>`_ and a shared library
|
||||||
compiled from the LAMMPS sources code. The individual methods in this
|
compiled from the LAMMPS sources code. The individual methods in this
|
||||||
@ -64,40 +56,7 @@ functions. Below is a detailed documentation of the API.
|
|||||||
.. autoclass:: lammps.numpy_wrapper::numpy_wrapper
|
.. autoclass:: lammps.numpy_wrapper::numpy_wrapper
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
----------
|
.. autoclass:: lammps.ipython::wrapper
|
||||||
|
|
||||||
The ``PyLammps`` class API
|
|
||||||
==========================
|
|
||||||
|
|
||||||
The :py:class:`PyLammps <lammps.PyLammps>` class is a wrapper that creates a
|
|
||||||
simpler, more "Pythonic" interface to common LAMMPS functionality. LAMMPS
|
|
||||||
data structures are exposed through objects and properties. This makes Python
|
|
||||||
scripts shorter and more concise. See the :doc:`PyLammps Tutorial
|
|
||||||
<Howto_pylammps>` for an introduction on how to use this interface.
|
|
||||||
|
|
||||||
.. autoclass:: lammps.PyLammps
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. autoclass:: lammps.AtomList
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. autoclass:: lammps.Atom
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. autoclass:: lammps.Atom2D
|
|
||||||
:members:
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
The ``IPyLammps`` class API
|
|
||||||
===========================
|
|
||||||
|
|
||||||
The :py:class:`IPyLammps <lammps.PyLammps>` class is an extension of
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>`, adding additional functions to
|
|
||||||
quickly display visualizations such as images and videos inside of IPython.
|
|
||||||
See the :doc:`PyLammps Tutorial <Howto_pylammps>` for examples.
|
|
||||||
|
|
||||||
.. autoclass:: lammps.IPyLammps
|
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|||||||
@ -4,95 +4,52 @@ Compute, fixes, variables
|
|||||||
This section documents accessing or modifying data from objects like
|
This section documents accessing or modifying data from objects like
|
||||||
computes, fixes, or variables in LAMMPS using the :py:mod:`lammps` module.
|
computes, fixes, or variables in LAMMPS using the :py:mod:`lammps` module.
|
||||||
|
|
||||||
.. tabs::
|
For :py:meth:`lammps.extract_compute() <lammps.lammps.extract_compute()>` and
|
||||||
|
:py:meth:`lammps.extract_fix() <lammps.lammps.extract_fix()>`, the global, per-atom,
|
||||||
|
or local data calculated by the compute or fix can be accessed. What is returned
|
||||||
|
depends on whether the compute or fix calculates a scalar or vector or array.
|
||||||
|
For a scalar, a single double value is returned. If the compute or fix calculates
|
||||||
|
a vector or array, a pointer to the internal LAMMPS data is returned, which you can
|
||||||
|
use via normal Python subscripting.
|
||||||
|
|
||||||
.. tab:: lammps API
|
The one exception is that for a fix that calculates a
|
||||||
|
global vector or array, a single double value from the vector or array
|
||||||
|
is returned, indexed by I (vector) or I and J (array). I,J are
|
||||||
|
zero-based indices.
|
||||||
|
See the :doc:`Howto output <Howto_output>` page for a discussion of
|
||||||
|
global, per-atom, and local data, and of scalar, vector, and array
|
||||||
|
data types. See the doc pages for individual :doc:`computes <compute>`
|
||||||
|
and :doc:`fixes <fix>` for a description of what they calculate and
|
||||||
|
store.
|
||||||
|
|
||||||
For :py:meth:`lammps.extract_compute() <lammps.lammps.extract_compute()>` and
|
For :py:meth:`lammps.extract_variable() <lammps.lammps.extract_variable()>`,
|
||||||
:py:meth:`lammps.extract_fix() <lammps.lammps.extract_fix()>`, the global, per-atom,
|
an :doc:`equal-style or atom-style variable <variable>` is evaluated and
|
||||||
or local data calculated by the compute or fix can be accessed. What is returned
|
its result returned.
|
||||||
depends on whether the compute or fix calculates a scalar or vector or array.
|
|
||||||
For a scalar, a single double value is returned. If the compute or fix calculates
|
|
||||||
a vector or array, a pointer to the internal LAMMPS data is returned, which you can
|
|
||||||
use via normal Python subscripting.
|
|
||||||
|
|
||||||
The one exception is that for a fix that calculates a
|
For equal-style variables a single ``c_double`` value is returned and the
|
||||||
global vector or array, a single double value from the vector or array
|
group argument is ignored. For atom-style variables, a vector of
|
||||||
is returned, indexed by I (vector) or I and J (array). I,J are
|
``c_double`` is returned, one value per atom, which you can use via normal
|
||||||
zero-based indices.
|
Python subscripting. The values will be zero for atoms not in the
|
||||||
See the :doc:`Howto output <Howto_output>` page for a discussion of
|
specified group.
|
||||||
global, per-atom, and local data, and of scalar, vector, and array
|
|
||||||
data types. See the doc pages for individual :doc:`computes <compute>`
|
|
||||||
and :doc:`fixes <fix>` for a description of what they calculate and
|
|
||||||
store.
|
|
||||||
|
|
||||||
For :py:meth:`lammps.extract_variable() <lammps.lammps.extract_variable()>`,
|
:py:meth:`lammps.numpy.extract_compute() <lammps.numpy_wrapper.numpy_wrapper.extract_compute()>`,
|
||||||
an :doc:`equal-style or atom-style variable <variable>` is evaluated and
|
:py:meth:`lammps.numpy.extract_fix() <lammps.numpy_wrapper.numpy_wrapper.extract_fix()>`, and
|
||||||
its result returned.
|
:py:meth:`lammps.numpy.extract_variable() <lammps.numpy_wrapper.numpy_wrapper.extract_variable()>` are
|
||||||
|
equivalent NumPy implementations that return NumPy arrays instead of ``ctypes`` pointers.
|
||||||
|
|
||||||
For equal-style variables a single ``c_double`` value is returned and the
|
The :py:meth:`lammps.set_variable() <lammps.lammps.set_variable()>` method sets an
|
||||||
group argument is ignored. For atom-style variables, a vector of
|
existing string-style variable to a new string value, so that subsequent LAMMPS
|
||||||
``c_double`` is returned, one value per atom, which you can use via normal
|
commands can access the variable.
|
||||||
Python subscripting. The values will be zero for atoms not in the
|
|
||||||
specified group.
|
|
||||||
|
|
||||||
:py:meth:`lammps.numpy.extract_compute() <lammps.numpy_wrapper.numpy_wrapper.extract_compute()>`,
|
**Methods**:
|
||||||
:py:meth:`lammps.numpy.extract_fix() <lammps.numpy_wrapper.numpy_wrapper.extract_fix()>`, and
|
|
||||||
:py:meth:`lammps.numpy.extract_variable() <lammps.numpy_wrapper.numpy_wrapper.extract_variable()>` are
|
|
||||||
equivalent NumPy implementations that return NumPy arrays instead of ``ctypes`` pointers.
|
|
||||||
|
|
||||||
The :py:meth:`lammps.set_variable() <lammps.lammps.set_variable()>` method sets an
|
* :py:meth:`lammps.extract_compute() <lammps.lammps.extract_compute()>`: extract value(s) from a compute
|
||||||
existing string-style variable to a new string value, so that subsequent LAMMPS
|
* :py:meth:`lammps.extract_fix() <lammps.lammps.extract_fix()>`: extract value(s) from a fix
|
||||||
commands can access the variable.
|
* :py:meth:`lammps.extract_variable() <lammps.lammps.extract_variable()>`: extract value(s) from a variable
|
||||||
|
* :py:meth:`lammps.set_variable() <lammps.lammps.set_variable()>`: set existing named string-style variable to value
|
||||||
|
|
||||||
**Methods**:
|
**NumPy Methods**:
|
||||||
|
|
||||||
* :py:meth:`lammps.extract_compute() <lammps.lammps.extract_compute()>`: extract value(s) from a compute
|
* :py:meth:`lammps.numpy.extract_compute() <lammps.numpy_wrapper.numpy_wrapper.extract_compute()>`: extract value(s) from a compute, return arrays as numpy arrays
|
||||||
* :py:meth:`lammps.extract_fix() <lammps.lammps.extract_fix()>`: extract value(s) from a fix
|
* :py:meth:`lammps.numpy.extract_fix() <lammps.numpy_wrapper.numpy_wrapper.extract_fix()>`: extract value(s) from a fix, return arrays as numpy arrays
|
||||||
* :py:meth:`lammps.extract_variable() <lammps.lammps.extract_variable()>`: extract value(s) from a variable
|
* :py:meth:`lammps.numpy.extract_variable() <lammps.numpy_wrapper.numpy_wrapper.extract_variable()>`: extract value(s) from a variable, return arrays as numpy arrays
|
||||||
* :py:meth:`lammps.set_variable() <lammps.lammps.set_variable()>`: set existing named string-style variable to value
|
|
||||||
|
|
||||||
**NumPy Methods**:
|
|
||||||
|
|
||||||
* :py:meth:`lammps.numpy.extract_compute() <lammps.numpy_wrapper.numpy_wrapper.extract_compute()>`: extract value(s) from a compute, return arrays as numpy arrays
|
|
||||||
* :py:meth:`lammps.numpy.extract_fix() <lammps.numpy_wrapper.numpy_wrapper.extract_fix()>`: extract value(s) from a fix, return arrays as numpy arrays
|
|
||||||
* :py:meth:`lammps.numpy.extract_variable() <lammps.numpy_wrapper.numpy_wrapper.extract_variable()>`: extract value(s) from a variable, return arrays as numpy arrays
|
|
||||||
|
|
||||||
|
|
||||||
.. tab:: PyLammps/IPyLammps API
|
|
||||||
|
|
||||||
PyLammps and IPyLammps classes currently do not add any additional ways of
|
|
||||||
retrieving information out of computes and fixes. This information can still be accessed by using the lammps API:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.lmp.extract_compute(...)
|
|
||||||
L.lmp.extract_fix(...)
|
|
||||||
# OR
|
|
||||||
L.lmp.numpy.extract_compute(...)
|
|
||||||
L.lmp.numpy.extract_fix(...)
|
|
||||||
|
|
||||||
LAMMPS variables can be both defined and accessed via the :py:class:`PyLammps <lammps.PyLammps>` interface.
|
|
||||||
|
|
||||||
To define a variable you can use the :doc:`variable <variable>` command:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
L.variable("a index 2")
|
|
||||||
|
|
||||||
A dictionary of all variables is returned by the :py:attr:`PyLammps.variables <lammps.PyLammps.variables>` property:
|
|
||||||
|
|
||||||
you can access an individual variable by retrieving a variable object from the
|
|
||||||
``L.variables`` dictionary by name
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
a = L.variables['a']
|
|
||||||
|
|
||||||
The variable value can then be easily read and written by accessing the value
|
|
||||||
property of this object.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
print(a.value)
|
|
||||||
a.value = 4
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ Below is an example output for Python version 3.8.5.
|
|||||||
|
|
||||||
---------
|
---------
|
||||||
|
|
||||||
LAMMPS can work together with Python in three ways. First, Python can
|
LAMMPS can work together with Python in two ways. First, Python can
|
||||||
wrap LAMMPS through the its :doc:`library interface <Library>`, so
|
wrap LAMMPS through the its :doc:`library interface <Library>`, so
|
||||||
that a Python script can create one or more instances of LAMMPS and
|
that a Python script can create one or more instances of LAMMPS and
|
||||||
launch one or more simulations. In Python terms, this is referred to as
|
launch one or more simulations. In Python terms, this is referred to as
|
||||||
@ -67,22 +67,7 @@ launch one or more simulations. In Python terms, this is referred to as
|
|||||||
|
|
||||||
Launching LAMMPS via Python
|
Launching LAMMPS via Python
|
||||||
|
|
||||||
|
Second, LAMMPS can use the Python interpreter, so that a LAMMPS input
|
||||||
Second, the lower-level Python interface in the :py:class:`lammps Python
|
|
||||||
class <lammps.lammps>` can be used indirectly through the provided
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>` and :py:class:`IPyLammps
|
|
||||||
<lammps.IPyLammps>` wrapper classes, also written in Python. These
|
|
||||||
wrappers try to simplify the usage of LAMMPS in Python by providing a
|
|
||||||
more object-based interface to common LAMMPS functionality. They also
|
|
||||||
reduce the amount of code necessary to parameterize LAMMPS scripts
|
|
||||||
through Python and make variables and computes directly accessible.
|
|
||||||
|
|
||||||
.. figure:: JPG/pylammps-invoke-lammps.png
|
|
||||||
:figclass: align-center
|
|
||||||
|
|
||||||
Using the PyLammps / IPyLammps wrappers
|
|
||||||
|
|
||||||
Third, LAMMPS can use the Python interpreter, so that a LAMMPS input
|
|
||||||
script or styles can invoke Python code directly, and pass information
|
script or styles can invoke Python code directly, and pass information
|
||||||
back-and-forth between the input script and Python functions you write.
|
back-and-forth between the input script and Python functions you write.
|
||||||
This Python code can also call back to LAMMPS to query or change its
|
This Python code can also call back to LAMMPS to query or change its
|
||||||
|
|||||||
@ -2,14 +2,8 @@ System properties
|
|||||||
=================
|
=================
|
||||||
|
|
||||||
Similar to what is described in :doc:`Library_properties`, the instances of
|
Similar to what is described in :doc:`Library_properties`, the instances of
|
||||||
:py:class:`lammps <lammps.lammps>`, :py:class:`PyLammps <lammps.PyLammps>`, or
|
:py:class:`lammps <lammps.lammps>` can be used to extract different kinds
|
||||||
:py:class:`IPyLammps <lammps.IPyLammps>` can be used to extract different kinds
|
of information about the active LAMMPS instance and also to modify some of it.
|
||||||
of information about the active LAMMPS instance and also to modify some of it. The
|
|
||||||
main difference between the interfaces is how the information is exposed.
|
|
||||||
|
|
||||||
While the :py:class:`lammps <lammps.lammps>` is just a thin layer that wraps C API calls,
|
|
||||||
:py:class:`PyLammps <lammps.PyLammps>` and :py:class:`IPyLammps <lammps.IPyLammps>` expose
|
|
||||||
information as objects and properties.
|
|
||||||
|
|
||||||
In some cases the data returned is a direct reference to the original data
|
In some cases the data returned is a direct reference to the original data
|
||||||
inside LAMMPS cast to ``ctypes`` pointers. Where possible, the wrappers will
|
inside LAMMPS cast to ``ctypes`` pointers. Where possible, the wrappers will
|
||||||
@ -25,113 +19,38 @@ against invalid accesses.
|
|||||||
accordingly. These arrays can change sizes and order at every neighbor list
|
accordingly. These arrays can change sizes and order at every neighbor list
|
||||||
rebuild and atom sort event as atoms are migrating between subdomains.
|
rebuild and atom sort event as atoms are migrating between subdomains.
|
||||||
|
|
||||||
.. tabs::
|
.. code-block:: python
|
||||||
|
|
||||||
.. tab:: lammps API
|
from lammps import lammps
|
||||||
|
|
||||||
.. code-block:: python
|
lmp = lammps()
|
||||||
|
lmp.file("in.sysinit")
|
||||||
|
|
||||||
from lammps import lammps
|
natoms = lmp.get_natoms()
|
||||||
|
print(f"running simulation with {natoms} atoms")
|
||||||
|
|
||||||
lmp = lammps()
|
lmp.command("run 1000 post no");
|
||||||
lmp.file("in.sysinit")
|
|
||||||
|
|
||||||
natoms = lmp.get_natoms()
|
for i in range(10):
|
||||||
print(f"running simulation with {natoms} atoms")
|
lmp.command("run 100 pre no post no")
|
||||||
|
pe = lmp.get_thermo("pe")
|
||||||
|
ke = lmp.get_thermo("ke")
|
||||||
|
print(f"PE = {pe}\nKE = {ke}")
|
||||||
|
|
||||||
lmp.command("run 1000 post no");
|
lmp.close()
|
||||||
|
|
||||||
for i in range(10):
|
**Methods**:
|
||||||
lmp.command("run 100 pre no post no")
|
|
||||||
pe = lmp.get_thermo("pe")
|
|
||||||
ke = lmp.get_thermo("ke")
|
|
||||||
print(f"PE = {pe}\nKE = {ke}")
|
|
||||||
|
|
||||||
lmp.close()
|
* :py:meth:`version() <lammps.lammps.version()>`: return the numerical version id, e.g. LAMMPS 2 Sep 2015 -> 20150902
|
||||||
|
* :py:meth:`get_thermo() <lammps.lammps.get_thermo()>`: return current value of a thermo keyword
|
||||||
|
* :py:meth:`last_thermo() <lammps.lammps.last_thermo()>`: return a dictionary of the last thermodynamic output
|
||||||
|
* :py:meth:`get_natoms() <lammps.lammps.get_natoms()>`: total # of atoms as int
|
||||||
|
* :py:meth:`reset_box() <lammps.lammps.reset_box()>`: reset the simulation box size
|
||||||
|
* :py:meth:`extract_setting() <lammps.lammps.extract_setting()>`: return a global setting
|
||||||
|
* :py:meth:`extract_global() <lammps.lammps.extract_global()>`: extract a global quantity
|
||||||
|
* :py:meth:`extract_box() <lammps.lammps.extract_box()>`: extract box info
|
||||||
|
* :py:meth:`create_atoms() <lammps.lammps.create_atoms()>`: create N atoms with IDs, types, x, v, and image flags
|
||||||
|
|
||||||
**Methods**:
|
**Properties**:
|
||||||
|
|
||||||
* :py:meth:`version() <lammps.lammps.version()>`: return the numerical version id, e.g. LAMMPS 2 Sep 2015 -> 20150902
|
* :py:attr:`last_thermo_step <lammps.lammps.last_thermo_step>`: the last timestep thermodynamic output was computed
|
||||||
* :py:meth:`get_thermo() <lammps.lammps.get_thermo()>`: return current value of a thermo keyword
|
|
||||||
* :py:meth:`last_thermo() <lammps.lammps.last_thermo()>`: return a dictionary of the last thermodynamic output
|
|
||||||
* :py:meth:`get_natoms() <lammps.lammps.get_natoms()>`: total # of atoms as int
|
|
||||||
* :py:meth:`reset_box() <lammps.lammps.reset_box()>`: reset the simulation box size
|
|
||||||
* :py:meth:`extract_setting() <lammps.lammps.extract_setting()>`: return a global setting
|
|
||||||
* :py:meth:`extract_global() <lammps.lammps.extract_global()>`: extract a global quantity
|
|
||||||
* :py:meth:`extract_box() <lammps.lammps.extract_box()>`: extract box info
|
|
||||||
* :py:meth:`create_atoms() <lammps.lammps.create_atoms()>`: create N atoms with IDs, types, x, v, and image flags
|
|
||||||
|
|
||||||
**Properties**:
|
|
||||||
|
|
||||||
* :py:attr:`last_thermo_step <lammps.lammps.last_thermo_step>`: the last timestep thermodynamic output was computed
|
|
||||||
|
|
||||||
.. tab:: PyLammps/IPyLammps API
|
|
||||||
|
|
||||||
In addition to the functions provided by :py:class:`lammps <lammps.lammps>`, :py:class:`PyLammps <lammps.PyLammps>` objects
|
|
||||||
have several properties which allow you to query the system state:
|
|
||||||
|
|
||||||
L.system
|
|
||||||
Is a dictionary describing the system such as the bounding box or number of atoms
|
|
||||||
|
|
||||||
L.system.xlo, L.system.xhi
|
|
||||||
bounding box limits along x-axis
|
|
||||||
|
|
||||||
L.system.ylo, L.system.yhi
|
|
||||||
bounding box limits along y-axis
|
|
||||||
|
|
||||||
L.system.zlo, L.system.zhi
|
|
||||||
bounding box limits along z-axis
|
|
||||||
|
|
||||||
L.communication
|
|
||||||
configuration of communication subsystem, such as the number of threads or processors
|
|
||||||
|
|
||||||
L.communication.nthreads
|
|
||||||
number of threads used by each LAMMPS process
|
|
||||||
|
|
||||||
L.communication.nprocs
|
|
||||||
number of MPI processes used by LAMMPS
|
|
||||||
|
|
||||||
L.fixes
|
|
||||||
List of fixes in the current system
|
|
||||||
|
|
||||||
L.computes
|
|
||||||
List of active computes in the current system
|
|
||||||
|
|
||||||
L.dump
|
|
||||||
List of active dumps in the current system
|
|
||||||
|
|
||||||
L.groups
|
|
||||||
List of groups present in the current system
|
|
||||||
|
|
||||||
**Retrieving the value of an arbitrary LAMMPS expressions**
|
|
||||||
|
|
||||||
LAMMPS expressions can be immediately evaluated by using the ``eval`` method. The
|
|
||||||
passed string parameter can be any expression containing global :doc:`thermo` values,
|
|
||||||
variables, compute or fix data (see :doc:`Howto_output`):
|
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
result = L.eval("ke") # kinetic energy
|
|
||||||
result = L.eval("pe") # potential energy
|
|
||||||
|
|
||||||
result = L.eval("v_t/2.0")
|
|
||||||
|
|
||||||
**Example**
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
from lammps import PyLammps
|
|
||||||
|
|
||||||
L = PyLammps()
|
|
||||||
L.file("in.sysinit")
|
|
||||||
|
|
||||||
print(f"running simulation with {L.system.natoms} atoms")
|
|
||||||
|
|
||||||
L.run(1000, "post no");
|
|
||||||
|
|
||||||
for i in range(10):
|
|
||||||
L.run(100, "pre no post no")
|
|
||||||
pe = L.eval("pe")
|
|
||||||
ke = L.eval("ke")
|
|
||||||
print(f"PE = {pe}\nKE = {ke}")
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
Basics of running LAMMPS
|
Basics of running LAMMPS
|
||||||
========================
|
========================
|
||||||
|
|
||||||
LAMMPS is run from the command line, reading commands from a file via
|
LAMMPS is run from the command-line, reading commands from a file via
|
||||||
the ``-in`` command line flag, or from standard input. Using the ``-in
|
the ``-in`` command-line flag, or from standard input. Using the ``-in
|
||||||
in.file`` variant is recommended (see note below). The name of the
|
in.file`` variant is recommended (see note below). The name of the
|
||||||
LAMMPS executable is either ``lmp`` or ``lmp_<machine>`` with
|
LAMMPS executable is either ``lmp`` or ``lmp_<machine>`` with
|
||||||
`<machine>` being the machine string used when compiling LAMMPS. This
|
`<machine>` being the machine string used when compiling LAMMPS. This
|
||||||
@ -25,7 +25,7 @@ build LAMMPS:
|
|||||||
You normally run the LAMMPS command in the directory where your input
|
You normally run the LAMMPS command in the directory where your input
|
||||||
script is located. That is also where output files are produced by
|
script is located. That is also where output files are produced by
|
||||||
default, unless you provide specific other paths in your input script or
|
default, unless you provide specific other paths in your input script or
|
||||||
on the command line. As in some of the examples above, the LAMMPS
|
on the command-line. As in some of the examples above, the LAMMPS
|
||||||
executable itself can be placed elsewhere.
|
executable itself can be placed elsewhere.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|||||||
@ -632,7 +632,7 @@ the ``-package omp`` command-line switch or the :doc:`package omp <package>` com
|
|||||||
|
|
||||||
The :doc:`suffix <suffix>` command can also be used within an input
|
The :doc:`suffix <suffix>` command can also be used within an input
|
||||||
script to set a suffix, or to turn off or back on any suffix setting
|
script to set a suffix, or to turn off or back on any suffix setting
|
||||||
made via the command line.
|
made via the command-line.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ To run with 4 threads, you can type this:
|
|||||||
lmp -in in.lj.lmp -k on t 4 -sf kk
|
lmp -in in.lj.lmp -k on t 4 -sf kk
|
||||||
|
|
||||||
Alternately, you can also install a package with LAMMPS-GUI included and
|
Alternately, you can also install a package with LAMMPS-GUI included and
|
||||||
open the LAMMPS-GUI app (the package includes the command line version
|
open the LAMMPS-GUI app (the package includes the command-line version
|
||||||
of LAMMPS as well) and open the input file in the GUI and run it from
|
of LAMMPS as well) and open the input file in the GUI and run it from
|
||||||
there. For details on LAMMPS-GUI, see :doc:`Howto_lammps_gui`.
|
there. For details on LAMMPS-GUI, see :doc:`Howto_lammps_gui`.
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,8 @@ Coulombics. It has the following general features:
|
|||||||
(for Nvidia GPUs, AMD GPUs, Intel GPUs, and multicore CPUs).
|
(for Nvidia GPUs, AMD GPUs, Intel GPUs, and multicore CPUs).
|
||||||
so that the same functionality is supported on a variety of hardware.
|
so that the same functionality is supported on a variety of hardware.
|
||||||
|
|
||||||
**Required hardware/software:**
|
Required hardware/software
|
||||||
|
""""""""""""""""""""""""""
|
||||||
|
|
||||||
To compile and use this package in CUDA mode, you currently need
|
To compile and use this package in CUDA mode, you currently need
|
||||||
to have an NVIDIA GPU and install the corresponding NVIDIA CUDA
|
to have an NVIDIA GPU and install the corresponding NVIDIA CUDA
|
||||||
@ -69,12 +70,14 @@ To compile and use this package in HIP mode, you have to have the AMD ROCm
|
|||||||
software installed. Versions of ROCm older than 3.5 are currently deprecated
|
software installed. Versions of ROCm older than 3.5 are currently deprecated
|
||||||
by AMD.
|
by AMD.
|
||||||
|
|
||||||
**Building LAMMPS with the GPU package:**
|
Building LAMMPS with the GPU package
|
||||||
|
""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
See the :ref:`Build extras <gpu>` page for
|
See the :ref:`Build extras <gpu>` page for
|
||||||
instructions.
|
instructions.
|
||||||
|
|
||||||
**Run with the GPU package from the command line:**
|
Run with the GPU package from the command-line
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
The ``mpirun`` or ``mpiexec`` command sets the total number of MPI tasks
|
The ``mpirun`` or ``mpiexec`` command sets the total number of MPI tasks
|
||||||
used by LAMMPS (one or multiple per compute node) and the number of MPI
|
used by LAMMPS (one or multiple per compute node) and the number of MPI
|
||||||
@ -133,7 +136,8 @@ affect the setting for bonded interactions (LAMMPS default is "on").
|
|||||||
The "off" setting for pairwise interaction is currently required for
|
The "off" setting for pairwise interaction is currently required for
|
||||||
GPU package pair styles.
|
GPU package pair styles.
|
||||||
|
|
||||||
**Or run with the GPU package by editing an input script:**
|
Run with the GPU package by editing an input script
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
The discussion above for the ``mpirun`` or ``mpiexec`` command, MPI
|
The discussion above for the ``mpirun`` or ``mpiexec`` command, MPI
|
||||||
tasks/node, and use of multiple MPI tasks/GPU is the same.
|
tasks/node, and use of multiple MPI tasks/GPU is the same.
|
||||||
@ -149,7 +153,8 @@ You must also use the :doc:`package gpu <package>` command to enable the
|
|||||||
GPU package, unless the ``-sf gpu`` or ``-pk gpu`` :doc:`command-line switches <Run_options>` were used. It specifies the number of
|
GPU package, unless the ``-sf gpu`` or ``-pk gpu`` :doc:`command-line switches <Run_options>` were used. It specifies the number of
|
||||||
GPUs/node to use, as well as other options.
|
GPUs/node to use, as well as other options.
|
||||||
|
|
||||||
**Speed-ups to expect:**
|
Speed-up to expect
|
||||||
|
""""""""""""""""""
|
||||||
|
|
||||||
The performance of a GPU versus a multicore CPU is a function of your
|
The performance of a GPU versus a multicore CPU is a function of your
|
||||||
hardware, which pair style is used, the number of atoms/GPU, and the
|
hardware, which pair style is used, the number of atoms/GPU, and the
|
||||||
@ -176,10 +181,13 @@ better with multiple OMP threads because the inter-process communication
|
|||||||
is higher for these styles with the GPU package in order to allow
|
is higher for these styles with the GPU package in order to allow
|
||||||
deterministic results.
|
deterministic results.
|
||||||
|
|
||||||
**Guidelines for best performance:**
|
Guidelines for best performance
|
||||||
|
"""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
* Using multiple MPI tasks per GPU will often give the best performance,
|
* Using multiple MPI tasks (2-10) per GPU will often give the best
|
||||||
as allowed my most multicore CPU/GPU configurations.
|
performance, as allowed my most multicore CPU/GPU configurations.
|
||||||
|
Using too many MPI tasks will result in worse performance due to
|
||||||
|
growing overhead with the growing number of MPI tasks.
|
||||||
* If the number of particles per MPI task is small (e.g. 100s of
|
* If the number of particles per MPI task is small (e.g. 100s of
|
||||||
particles), it can be more efficient to run with fewer MPI tasks per
|
particles), it can be more efficient to run with fewer MPI tasks per
|
||||||
GPU, even if you do not use all the cores on the compute node.
|
GPU, even if you do not use all the cores on the compute node.
|
||||||
@ -199,12 +207,13 @@ deterministic results.
|
|||||||
:doc:`angle <angle_style>`, :doc:`dihedral <dihedral_style>`,
|
:doc:`angle <angle_style>`, :doc:`dihedral <dihedral_style>`,
|
||||||
:doc:`improper <improper_style>`, and :doc:`long-range <kspace_style>`
|
:doc:`improper <improper_style>`, and :doc:`long-range <kspace_style>`
|
||||||
calculations will not be included in the "Pair" time.
|
calculations will not be included in the "Pair" time.
|
||||||
* Since only part of the pppm kspace style is GPU accelerated, it
|
* Since only part of the pppm kspace style is GPU accelerated, it may be
|
||||||
may be faster to only use GPU acceleration for Pair styles with
|
faster to only use GPU acceleration for Pair styles with long-range
|
||||||
long-range electrostatics. See the "pair/only" keyword of the
|
electrostatics. See the "pair/only" keyword of the :doc:`package
|
||||||
package command for a shortcut to do that. The work between kspace
|
command <package>` for a shortcut to do that. The distribution of
|
||||||
on the CPU and non-bonded interactions on the GPU can be balanced
|
work between kspace on the CPU and non-bonded interactions on the GPU
|
||||||
through adjusting the coulomb cutoff without loss of accuracy.
|
can be balanced through adjusting the coulomb cutoff without loss of
|
||||||
|
accuracy.
|
||||||
* When the *mode* setting for the package gpu command is force/neigh,
|
* When the *mode* setting for the package gpu command is force/neigh,
|
||||||
the time for neighbor list calculations on the GPU will be added into
|
the time for neighbor list calculations on the GPU will be added into
|
||||||
the "Pair" time, not the "Neigh" time. An additional breakdown of the
|
the "Pair" time, not the "Neigh" time. An additional breakdown of the
|
||||||
@ -220,4 +229,6 @@ deterministic results.
|
|||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
|
|
||||||
None.
|
When using :doc:`hybrid pair styles <pair_hybrid>`, the neighbor list
|
||||||
|
must be generated on the host instead of the GPU and thus the potential
|
||||||
|
GPU acceleration is reduced.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
INTEL package
|
INTEL package
|
||||||
==================
|
=============
|
||||||
|
|
||||||
The INTEL package is maintained by Mike Brown at Intel
|
The INTEL package is maintained by Mike Brown at Intel
|
||||||
Corporation. It provides two methods for accelerating simulations,
|
Corporation. It provides two methods for accelerating simulations,
|
||||||
@ -13,18 +13,18 @@ twice, once on the CPU and once with an offload flag. This allows
|
|||||||
LAMMPS to run on the CPU cores and co-processor cores simultaneously.
|
LAMMPS to run on the CPU cores and co-processor cores simultaneously.
|
||||||
|
|
||||||
Currently Available INTEL Styles
|
Currently Available INTEL Styles
|
||||||
"""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
* Angle Styles: charmm, harmonic
|
* Angle Styles: charmm, harmonic
|
||||||
* Bond Styles: fene, fourier, harmonic
|
* Bond Styles: fene, harmonic
|
||||||
* Dihedral Styles: charmm, fourier, harmonic, opls
|
* Dihedral Styles: charmm, fourier, harmonic, opls
|
||||||
* Fixes: nve, npt, nvt, nvt/sllod, nve/asphere
|
* Fixes: nve, npt, nvt, nvt/sllod, nve/asphere, electrode/conp, electrode/conq, electrode/thermo
|
||||||
* Improper Styles: cvff, harmonic
|
* Improper Styles: cvff, harmonic
|
||||||
* Pair Styles: airebo, airebo/morse, buck/coul/cut, buck/coul/long,
|
* Pair Styles: airebo, airebo/morse, buck/coul/cut, buck/coul/long,
|
||||||
buck, dpd, eam, eam/alloy, eam/fs, gayberne, lj/charmm/coul/charmm,
|
buck, dpd, eam, eam/alloy, eam/fs, gayberne, lj/charmm/coul/charmm,
|
||||||
lj/charmm/coul/long, lj/cut, lj/cut/coul/long, lj/long/coul/long,
|
lj/charmm/coul/long, lj/cut, lj/cut/coul/long, lj/long/coul/long,
|
||||||
rebo, sw, tersoff
|
rebo, snap, sw, tersoff
|
||||||
* K-Space Styles: pppm, pppm/disp
|
* K-Space Styles: pppm, pppm/disp, pppm/electrode
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ Currently Available INTEL Styles
|
|||||||
input requires it, LAMMPS will abort with an error message.
|
input requires it, LAMMPS will abort with an error message.
|
||||||
|
|
||||||
Speed-up to expect
|
Speed-up to expect
|
||||||
"""""""""""""""""""
|
""""""""""""""""""
|
||||||
|
|
||||||
The speedup will depend on your simulation, the hardware, which
|
The speedup will depend on your simulation, the hardware, which
|
||||||
styles are used, the number of atoms, and the floating-point
|
styles are used, the number of atoms, and the floating-point
|
||||||
@ -312,21 +312,21 @@ almost all cases.
|
|||||||
recommended, especially when running on a machine with Intel
|
recommended, especially when running on a machine with Intel
|
||||||
Hyper-Threading technology disabled.
|
Hyper-Threading technology disabled.
|
||||||
|
|
||||||
Run with the INTEL package from the command line
|
Run with the INTEL package from the command-line
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
To enable INTEL optimizations for all available styles used in
|
To enable INTEL optimizations for all available styles used in the input
|
||||||
the input script, the ``-sf intel`` :doc:`command-line switch <Run_options>` can be used without any requirement for
|
script, the ``-sf intel`` :doc:`command-line switch <Run_options>` can
|
||||||
editing the input script. This switch will automatically append
|
be used without any requirement for editing the input script. This
|
||||||
"intel" to styles that support it. It also invokes a default command:
|
switch will automatically append "intel" to styles that support it. It
|
||||||
:doc:`package intel 1 <package>`. This package command is used to set
|
also invokes a default command: :doc:`package intel 1 <package>`. This
|
||||||
options for the INTEL package. The default package command will
|
package command is used to set options for the INTEL package. The
|
||||||
specify that INTEL calculations are performed in mixed precision,
|
default package command will specify that INTEL calculations are
|
||||||
that the number of OpenMP threads is specified by the OMP_NUM_THREADS
|
performed in mixed precision, that the number of OpenMP threads is
|
||||||
environment variable, and that if co-processors are present and the
|
specified by the OMP_NUM_THREADS environment variable, and that if
|
||||||
binary was built with offload support, that 1 co-processor per node
|
co-processors are present and the binary was built with offload support,
|
||||||
will be used with automatic balancing of work between the CPU and the
|
that 1 co-processor per node will be used with automatic balancing of
|
||||||
co-processor.
|
work between the CPU and the co-processor.
|
||||||
|
|
||||||
You can specify different options for the INTEL package by using
|
You can specify different options for the INTEL package by using
|
||||||
the ``-pk intel Nphi`` :doc:`command-line switch <Run_options>` with
|
the ``-pk intel Nphi`` :doc:`command-line switch <Run_options>` with
|
||||||
|
|||||||
@ -77,7 +77,7 @@ version 23 November 2023 and Kokkos version 4.2.
|
|||||||
rank. When running with multiple MPI ranks, you may see segmentation
|
rank. When running with multiple MPI ranks, you may see segmentation
|
||||||
faults without GPU-aware MPI support. These can be avoided by adding
|
faults without GPU-aware MPI support. These can be avoided by adding
|
||||||
the flags :doc:`-pk kokkos gpu/aware off <Run_options>` to the
|
the flags :doc:`-pk kokkos gpu/aware off <Run_options>` to the
|
||||||
LAMMPS command line or by using the command :doc:`package kokkos
|
LAMMPS command-line or by using the command :doc:`package kokkos
|
||||||
gpu/aware off <package>` in the input file.
|
gpu/aware off <package>` in the input file.
|
||||||
|
|
||||||
.. admonition:: Intel Data Center GPU support
|
.. admonition:: Intel Data Center GPU support
|
||||||
@ -423,7 +423,7 @@ in the ``kokkos-cuda.cmake`` CMake preset file.
|
|||||||
cmake -DKokkos_ENABLE_CUDA=yes -DKokkos_ENABLE_OPENMP=yes ../cmake
|
cmake -DKokkos_ENABLE_CUDA=yes -DKokkos_ENABLE_OPENMP=yes ../cmake
|
||||||
|
|
||||||
The suffix "/kk" is equivalent to "/kk/device", and for Kokkos CUDA,
|
The suffix "/kk" is equivalent to "/kk/device", and for Kokkos CUDA,
|
||||||
using the ``-sf kk`` in the command line gives the default CUDA version
|
using the ``-sf kk`` in the command-line gives the default CUDA version
|
||||||
everywhere. However, if the "/kk/host" suffix is added to a specific
|
everywhere. However, if the "/kk/host" suffix is added to a specific
|
||||||
style in the input script, the Kokkos OpenMP (CPU) version of that
|
style in the input script, the Kokkos OpenMP (CPU) version of that
|
||||||
specific style will be used instead. Set the number of OpenMP threads
|
specific style will be used instead. Set the number of OpenMP threads
|
||||||
@ -439,7 +439,7 @@ For example, the command to run with 1 GPU and 8 OpenMP threads is then:
|
|||||||
|
|
||||||
mpiexec -np 1 lmp_kokkos_cuda_openmpi -in in.lj -k on g 1 t 8 -sf kk
|
mpiexec -np 1 lmp_kokkos_cuda_openmpi -in in.lj -k on g 1 t 8 -sf kk
|
||||||
|
|
||||||
Conversely, if the ``-sf kk/host`` is used in the command line and then
|
Conversely, if the ``-sf kk/host`` is used in the command-line and then
|
||||||
the "/kk" or "/kk/device" suffix is added to a specific style in your
|
the "/kk" or "/kk/device" suffix is added to a specific style in your
|
||||||
input script, then only that specific style will run on the GPU while
|
input script, then only that specific style will run on the GPU while
|
||||||
everything else will run on the CPU in OpenMP mode. Note that the
|
everything else will run on the CPU in OpenMP mode. Note that the
|
||||||
@ -451,7 +451,7 @@ on the host CPU can overlap with a pair style running on the
|
|||||||
GPU. First compile with ``--default-stream per-thread`` added to ``CCFLAGS``
|
GPU. First compile with ``--default-stream per-thread`` added to ``CCFLAGS``
|
||||||
in the Kokkos CUDA Makefile. Then explicitly use the "/kk/host"
|
in the Kokkos CUDA Makefile. Then explicitly use the "/kk/host"
|
||||||
suffix for kspace and bonds, angles, etc. in the input file and the
|
suffix for kspace and bonds, angles, etc. in the input file and the
|
||||||
"kk" suffix (equal to "kk/device") on the command line. Also make
|
"kk" suffix (equal to "kk/device") on the command-line. Also make
|
||||||
sure the environment variable ``CUDA_LAUNCH_BLOCKING`` is not set to "1"
|
sure the environment variable ``CUDA_LAUNCH_BLOCKING`` is not set to "1"
|
||||||
so CPU/GPU overlap can occur.
|
so CPU/GPU overlap can occur.
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ Building LAMMPS with the OPENMP package
|
|||||||
See the :ref:`Build extras <openmp>` page for
|
See the :ref:`Build extras <openmp>` page for
|
||||||
instructions.
|
instructions.
|
||||||
|
|
||||||
Run with the OPENMP package from the command line
|
Run with the OPENMP package from the command-line
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
These examples assume one or more 16-core nodes.
|
These examples assume one or more 16-core nodes.
|
||||||
|
|||||||
@ -17,7 +17,7 @@ Building LAMMPS with the OPT package
|
|||||||
|
|
||||||
See the :ref:`Build extras <opt>` page for instructions.
|
See the :ref:`Build extras <opt>` page for instructions.
|
||||||
|
|
||||||
Run with the OPT package from the command line
|
Run with the OPT package from the command-line
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|||||||
@ -501,7 +501,7 @@ Here are a few highlights of LAMMPS-GUI
|
|||||||
- Indicator for line that caused an error
|
- Indicator for line that caused an error
|
||||||
- Visualization of current state in Image Viewer (via calling :doc:`write_dump image <dump_image>`)
|
- Visualization of current state in Image Viewer (via calling :doc:`write_dump image <dump_image>`)
|
||||||
- Capture of images created via :doc:`dump image <dump_image>` in Slide show window
|
- Capture of images created via :doc:`dump image <dump_image>` in Slide show window
|
||||||
- Dialog to set variables, similar to the LAMMPS command line flag '-v' / '-var'
|
- Dialog to set variables, similar to the LAMMPS command-line flag '-v' / '-var'
|
||||||
- Support for GPU, INTEL, KOKKOS/OpenMP, OPENMAP, and OPT and accelerator packages
|
- Support for GPU, INTEL, KOKKOS/OpenMP, OPENMAP, and OPT and accelerator packages
|
||||||
|
|
||||||
Parallelization
|
Parallelization
|
||||||
@ -550,7 +550,7 @@ will be found automatically. 2) you can download the `Flatpak file
|
|||||||
*flatpak* command: ``flatpak install --user
|
*flatpak* command: ``flatpak install --user
|
||||||
LAMMPS-Linux-x86_64-GUI-<version>.flatpak`` and run it with ``flatpak
|
LAMMPS-Linux-x86_64-GUI-<version>.flatpak`` and run it with ``flatpak
|
||||||
run org.lammps.lammps-gui``. The flatpak bundle also includes the
|
run org.lammps.lammps-gui``. The flatpak bundle also includes the
|
||||||
command line version of LAMMPS and some LAMMPS tools like msi2lmp. The
|
command-line version of LAMMPS and some LAMMPS tools like msi2lmp. The
|
||||||
can be launched by using the ``--command`` flag. For example to run
|
can be launched by using the ``--command`` flag. For example to run
|
||||||
LAMMPS directly on the ``in.lj`` benchmark input you would type in the
|
LAMMPS directly on the ``in.lj`` benchmark input you would type in the
|
||||||
``bench`` folder: ``flatpak run --command=lmp -in in.lj`` The flatpak
|
``bench`` folder: ``flatpak run --command=lmp -in in.lj`` The flatpak
|
||||||
@ -608,10 +608,10 @@ would be the ``examples/COUPLE/plugin`` folder of the LAMMPS
|
|||||||
distribution.
|
distribution.
|
||||||
|
|
||||||
When compiling LAMMPS-GUI with plugin support, there is an additional
|
When compiling LAMMPS-GUI with plugin support, there is an additional
|
||||||
command line flag (``-p <path>`` or ``--pluginpath <path>``) which
|
command-line flag (``-p <path>`` or ``--pluginpath <path>``) which
|
||||||
allows to override the path to LAMMPS shared library used by the GUI.
|
allows to override the path to LAMMPS shared library used by the GUI.
|
||||||
This is usually auto-detected on the first run and can be changed in the
|
This is usually auto-detected on the first run and can be changed in the
|
||||||
LAMMPS-GUI *Preferences* dialog. The command line flag allows to reset
|
LAMMPS-GUI *Preferences* dialog. The command-line flag allows to reset
|
||||||
this path to a valid value in case the original setting has become
|
this path to a valid value in case the original setting has become
|
||||||
invalid. An empty path ("") as argument restores the default setting.
|
invalid. An empty path ("") as argument restores the default setting.
|
||||||
|
|
||||||
@ -656,7 +656,7 @@ it will create a compressed ``LAMMPS-Win10-amd64.zip`` zip file with the
|
|||||||
executables and required dependent .dll files. This zip file can be
|
executables and required dependent .dll files. This zip file can be
|
||||||
uncompressed and ``lammps-gui.exe`` run directly from there. The
|
uncompressed and ``lammps-gui.exe`` run directly from there. The
|
||||||
uncompressed folder can be added to the ``PATH`` environment and LAMMPS
|
uncompressed folder can be added to the ``PATH`` environment and LAMMPS
|
||||||
and LAMMPS-GUI can be launched from anywhere from the command line.
|
and LAMMPS-GUI can be launched from anywhere from the command-line.
|
||||||
|
|
||||||
**MinGW64 Cross-compiler**
|
**MinGW64 Cross-compiler**
|
||||||
|
|
||||||
@ -876,7 +876,7 @@ the same ``LAMMPS_CACHING_DIR``. This script does the following:
|
|||||||
#. Start a simple local HTTP server using Python to host files for CMake
|
#. Start a simple local HTTP server using Python to host files for CMake
|
||||||
|
|
||||||
Afterwards, it will print out instruction on how to modify the CMake
|
Afterwards, it will print out instruction on how to modify the CMake
|
||||||
command line to make sure it uses the local HTTP server.
|
commands to make sure it uses the local HTTP server.
|
||||||
|
|
||||||
To undo the environment changes and shutdown the local HTTP server,
|
To undo the environment changes and shutdown the local HTTP server,
|
||||||
run the ``deactivate_caches`` command.
|
run the ``deactivate_caches`` command.
|
||||||
@ -1025,7 +1025,7 @@ with those in the provided log file with the same number of processors
|
|||||||
in the same subdirectory. If the differences between the actual and
|
in the same subdirectory. If the differences between the actual and
|
||||||
reference values are within specified tolerances, the test is considered
|
reference values are within specified tolerances, the test is considered
|
||||||
passed. For each test batch, that is, a set of example input scripts,
|
passed. For each test batch, that is, a set of example input scripts,
|
||||||
the mpirun command, the LAMMPS command line arguments, and the
|
the mpirun command, the LAMMPS command-line arguments, and the
|
||||||
tolerances for individual thermo quantities can be specified in a
|
tolerances for individual thermo quantities can be specified in a
|
||||||
configuration file in YAML format.
|
configuration file in YAML format.
|
||||||
|
|
||||||
|
|||||||
94
doc/src/angle_mwlc.rst
Normal file
94
doc/src/angle_mwlc.rst
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
.. index:: angle_style mwlc
|
||||||
|
|
||||||
|
angle_style mwlc command
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
""""""
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
angle_style mwlc
|
||||||
|
|
||||||
|
Examples
|
||||||
|
""""""""
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
angle_style mwlc
|
||||||
|
angle_coeff * 25 1 10 1
|
||||||
|
|
||||||
|
Description
|
||||||
|
"""""""""""
|
||||||
|
|
||||||
|
.. versionadded:: TBD
|
||||||
|
|
||||||
|
The *mwlc* angle style models a meltable wormlike chain and can be used
|
||||||
|
to model non-linear bending elasticity of polymers, e.g. DNA. *mwlc*
|
||||||
|
uses a potential that is a canonical-ensemble superposition of a
|
||||||
|
non-melted and a melted state :ref:`(Farrell) <Farrell>`. The potential
|
||||||
|
is
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
|
||||||
|
E = -k_{B}T\,\log [q + q^{m}] + E_{0},
|
||||||
|
|
||||||
|
where the non-melted and melted partition functions are
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
q = \exp [-k_{1}(1+\cos{\theta})/k_{B}T]; \\
|
||||||
|
q^{m} = \exp [-(\mu+k_{2}(1+\cos{\theta}))/k_{B}T].
|
||||||
|
|
||||||
|
:math:`k_1` is the bending elastic constant of the non-melted state,
|
||||||
|
:math:`k_2` is the bending elastic constant of the melted state,
|
||||||
|
:math:`\mu` is the melting energy, and
|
||||||
|
:math:`T` is the reference temperature.
|
||||||
|
The reference energy,
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
E_{0} = -k_{B}T\,\log [1 + \exp[-\mu/k_{B}T]],
|
||||||
|
|
||||||
|
ensures that E is zero for a fully extended chain.
|
||||||
|
|
||||||
|
This potential is a continuous version of the two-state potential
|
||||||
|
introduced by :ref:`(Yan) <Yan>`.
|
||||||
|
|
||||||
|
The following coefficients must be defined for each angle type via the
|
||||||
|
:doc:`angle_coeff <angle_coeff>` command as in the example above, or in
|
||||||
|
the data file or restart files read by the :doc:`read_data <read_data>`
|
||||||
|
or :doc:`read_restart <read_restart>` commands:
|
||||||
|
|
||||||
|
* :math:`k_1` (energy)
|
||||||
|
* :math:`k_2` (energy)
|
||||||
|
* :math:`\mu` (energy)
|
||||||
|
* :math:`T` (temperature)
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
|
||||||
|
Restrictions
|
||||||
|
""""""""""""
|
||||||
|
|
||||||
|
This angle style can only be used if LAMMPS was built with the
|
||||||
|
EXTRA-MOLECULE package. See the :doc:`Build package <Build_package>`
|
||||||
|
doc page for more info.
|
||||||
|
|
||||||
|
Related commands
|
||||||
|
""""""""""""""""
|
||||||
|
|
||||||
|
:doc:`angle_coeff <angle_coeff>`
|
||||||
|
|
||||||
|
Default
|
||||||
|
"""""""
|
||||||
|
|
||||||
|
none
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. _Farrell:
|
||||||
|
|
||||||
|
**(Farrell)** `Farrell, Dobnikar, Podgornik, Curk, Phys Rev Lett, 133, 148101 (2024). <https://doi.org/10.1103/PhysRevLett.133.148101>`_
|
||||||
|
|
||||||
|
.. _Yan:
|
||||||
|
|
||||||
|
**(Yan)** `Yan, Marko, Phys Rev Lett, 93, 108108 (2004). <https://doi.org/10.1103/PhysRevLett.93.108108>`_
|
||||||
@ -94,6 +94,7 @@ of (g,i,k,o,t) to indicate which accelerated styles exist.
|
|||||||
* :doc:`lepton <angle_lepton>` - angle potential from evaluating a string
|
* :doc:`lepton <angle_lepton>` - angle potential from evaluating a string
|
||||||
* :doc:`mesocnt <angle_mesocnt>` - piecewise harmonic and linear angle for bending-buckling of nanotubes
|
* :doc:`mesocnt <angle_mesocnt>` - piecewise harmonic and linear angle for bending-buckling of nanotubes
|
||||||
* :doc:`mm3 <angle_mm3>` - anharmonic angle
|
* :doc:`mm3 <angle_mm3>` - anharmonic angle
|
||||||
|
* :doc:`mwlc <angle_mwlc>` - meltable wormlike chain
|
||||||
* :doc:`quartic <angle_quartic>` - angle with cubic and quartic terms
|
* :doc:`quartic <angle_quartic>` - angle with cubic and quartic terms
|
||||||
* :doc:`spica <angle_spica>` - harmonic angle with repulsive SPICA pair style between 1-3 atoms
|
* :doc:`spica <angle_spica>` - harmonic angle with repulsive SPICA pair style between 1-3 atoms
|
||||||
* :doc:`table <angle_table>` - tabulated by angle
|
* :doc:`table <angle_table>` - tabulated by angle
|
||||||
|
|||||||
@ -132,8 +132,8 @@ or :doc:`read_restart <read_restart>` commands:
|
|||||||
* :math:`k_b` (force*distance/radians units)
|
* :math:`k_b` (force*distance/radians units)
|
||||||
* :math:`f_{r,c}` (force units)
|
* :math:`f_{r,c}` (force units)
|
||||||
* :math:`f_{s,c}` (force units)
|
* :math:`f_{s,c}` (force units)
|
||||||
* :math:`\tau_{b,c}` (force*distance units)
|
|
||||||
* :math:`\tau_{t,c}` (force*distance units)
|
* :math:`\tau_{t,c}` (force*distance units)
|
||||||
|
* :math:`\tau_{b,c}` (force*distance units)
|
||||||
* :math:`\gamma_n` (force/velocity units)
|
* :math:`\gamma_n` (force/velocity units)
|
||||||
* :math:`\gamma_s` (force/velocity units)
|
* :math:`\gamma_s` (force/velocity units)
|
||||||
* :math:`\gamma_r` (force*distance/velocity units)
|
* :math:`\gamma_r` (force*distance/velocity units)
|
||||||
@ -154,8 +154,11 @@ page on BPMs.
|
|||||||
|
|
||||||
If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break
|
If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break
|
||||||
during a simulation run. This will prevent some unnecessary calculation.
|
during a simulation run. This will prevent some unnecessary calculation.
|
||||||
However, if a bond reaches a damage criterion greater than one,
|
The recommended bond communication distance no longer depends on bond failure
|
||||||
it will trigger an error.
|
coefficients (which are ignored) but instead corresponds to the typical heuristic
|
||||||
|
maximum strain used by typical non-bpm bond styles. Similar behavior to *break no*
|
||||||
|
can also be attained by setting arbitrarily high values for all four failure
|
||||||
|
coefficients. One cannot use *break no* with *smooth yes*.
|
||||||
|
|
||||||
If the *store/local* keyword is used, an internal fix will track bonds that
|
If the *store/local* keyword is used, an internal fix will track bonds that
|
||||||
break during the simulation. Whenever a bond breaks, data is processed
|
break during the simulation. Whenever a bond breaks, data is processed
|
||||||
|
|||||||
@ -117,8 +117,11 @@ page on BPMs.
|
|||||||
|
|
||||||
If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break
|
If the *break* keyword is set to *no*, LAMMPS assumes bonds should not break
|
||||||
during a simulation run. This will prevent some unnecessary calculation.
|
during a simulation run. This will prevent some unnecessary calculation.
|
||||||
However, if a bond reaches a strain greater than :math:`\epsilon_c`,
|
The recommended bond communication distance no longer depends on the value of
|
||||||
it will trigger an error.
|
:math:`\epsilon_c` (which is ignored) but instead corresponds to the typical
|
||||||
|
heuristic maximum strain used by typical non-bpm bond styles. Similar behavior
|
||||||
|
to *break no* can also be attained by setting an arbitrarily high value of
|
||||||
|
:math:`\epsilon_c`. One cannot use *break no* with *smooth yes*.
|
||||||
|
|
||||||
.. versionadded:: TBD
|
.. versionadded:: TBD
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,12 @@ particle.
|
|||||||
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
||||||
LAMMPS.
|
LAMMPS.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Please note that the SPH PDF guide file has not been updated for
|
||||||
|
many years and thus does not reflect the current *syntax* of the
|
||||||
|
SPH package commands. For that please refer to the LAMMPS manual.
|
||||||
|
|
||||||
The value of the internal energy will be 0.0 for atoms not in the
|
The value of the internal energy will be 0.0 for atoms not in the
|
||||||
specified compute group.
|
specified compute group.
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,12 @@ kernel function interpolation using "pair style sph/rhosum".
|
|||||||
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
||||||
LAMMPS.
|
LAMMPS.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Please note that the SPH PDF guide file has not been updated for
|
||||||
|
many years and thus does not reflect the current *syntax* of the
|
||||||
|
SPH package commands. For that please refer to the LAMMPS manual.
|
||||||
|
|
||||||
The value of the SPH density will be 0.0 for atoms not in the
|
The value of the SPH density will be 0.0 for atoms not in the
|
||||||
specified compute group.
|
specified compute group.
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,12 @@ particles, i.e. a Smooth-Particle Hydrodynamics particle.
|
|||||||
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
||||||
LAMMPS.
|
LAMMPS.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Please note that the SPH PDF guide file has not been updated for
|
||||||
|
many years and thus does not reflect the current *syntax* of the
|
||||||
|
SPH package commands. For that please refer to the LAMMPS manual.
|
||||||
|
|
||||||
The value of the internal energy will be 0.0 for atoms not in the
|
The value of the internal energy will be 0.0 for atoms not in the
|
||||||
specified compute group.
|
specified compute group.
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@ This array can be output with :doc:`fix ave/time <fix_ave_time>`,
|
|||||||
|
|
||||||
.. code-block:: LAMMPS
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
compute 1 all stress/spherical 0 0 0 0.1 10
|
compute p all stress/spherical 0 0 0 0.1 10
|
||||||
fix 2 all ave/time 100 1 100 c_p[*] file dump_p.out mode vector
|
fix 2 all ave/time 100 1 100 c_p[*] file dump_p.out mode vector
|
||||||
|
|
||||||
The values calculated by this compute are "intensive". The stress
|
The values calculated by this compute are "intensive". The stress
|
||||||
|
|||||||
@ -184,11 +184,24 @@ temp/chunk calculation to a file is to use the
|
|||||||
The keyword/value option pairs are used in the following ways.
|
The keyword/value option pairs are used in the following ways.
|
||||||
|
|
||||||
The *com* keyword can be used with a value of *yes* to subtract the
|
The *com* keyword can be used with a value of *yes* to subtract the
|
||||||
velocity of the center-of-mass for each chunk from the velocity of the
|
velocity of the center-of-mass (VCM) for each chunk from the velocity of
|
||||||
atoms in that chunk, before calculating either the global or per-chunk
|
the atoms in that chunk, before calculating either the global or per-chunk
|
||||||
temperature. This can be useful if the atoms are streaming or
|
temperature. This can be useful if the atoms are streaming or
|
||||||
otherwise moving collectively, and you wish to calculate only the
|
otherwise moving collectively, and you wish to calculate only the
|
||||||
thermal temperature.
|
thermal temperature. This per-chunk VCM bias can be used in other fixes and
|
||||||
|
computes that can incorporate a temperature bias. If this compute is used
|
||||||
|
as a temperature bias in other commands then this bias is subtracted from
|
||||||
|
each atom, the command runs with the remaining thermal velocities, and
|
||||||
|
then the bias is added back in. This includes thermostatting
|
||||||
|
fixes like :doc:`fix nvt <fix_nh>`,
|
||||||
|
:doc:`fix temp/rescale <fix_temp_rescale>`,
|
||||||
|
:doc:`fix temp/berendsen <fix_temp_berendsen>`, and
|
||||||
|
:doc:`fix langevin <fix_langevin>`, and computes like
|
||||||
|
:doc:`compute stress/atom <compute_stress_atom>` and
|
||||||
|
:doc:`compute pressure <compute_pressure>`. See the input script in
|
||||||
|
examples/stress_vcm for an example of how to use the *com* keyword in
|
||||||
|
conjunction with compute stress/atom to create a stress profile of a rigid
|
||||||
|
body while removing the overall motion of the rigid body.
|
||||||
|
|
||||||
For the *bias* keyword, *bias-ID* refers to the ID of a temperature
|
For the *bias* keyword, *bias-ID* refers to the ID of a temperature
|
||||||
compute that removes a "bias" velocity from each atom. This also
|
compute that removes a "bias" velocity from each atom. This also
|
||||||
|
|||||||
@ -681,7 +681,7 @@ MPEG or other movie file you can use:
|
|||||||
|
|
||||||
* c) Use FFmpeg
|
* c) Use FFmpeg
|
||||||
|
|
||||||
FFmpeg is a command line tool that is available on many platforms and
|
FFmpeg is a command-line tool that is available on many platforms and
|
||||||
allows extremely flexible encoding and decoding of movies.
|
allows extremely flexible encoding and decoding of movies.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|||||||
@ -367,6 +367,7 @@ accelerated styles exist.
|
|||||||
* :doc:`qeq/slater <fix_qeq>` - charge equilibration via Slater method
|
* :doc:`qeq/slater <fix_qeq>` - charge equilibration via Slater method
|
||||||
* :doc:`qmmm <fix_qmmm>` - functionality to enable a quantum mechanics/molecular mechanics coupling
|
* :doc:`qmmm <fix_qmmm>` - functionality to enable a quantum mechanics/molecular mechanics coupling
|
||||||
* :doc:`qtb <fix_qtb>` - implement quantum thermal bath scheme
|
* :doc:`qtb <fix_qtb>` - implement quantum thermal bath scheme
|
||||||
|
* :doc:`qtpie/reaxff <fix_qtpie_reaxff>` - apply QTPIE charge equilibration
|
||||||
* :doc:`rattle <fix_shake>` - RATTLE constraints on bonds and/or angles
|
* :doc:`rattle <fix_shake>` - RATTLE constraints on bonds and/or angles
|
||||||
* :doc:`reaxff/bonds <fix_reaxff_bonds>` - write out ReaxFF bond information
|
* :doc:`reaxff/bonds <fix_reaxff_bonds>` - write out ReaxFF bond information
|
||||||
* :doc:`reaxff/species <fix_reaxff_species>` - write out ReaxFF molecule information
|
* :doc:`reaxff/species <fix_reaxff_species>` - write out ReaxFF molecule information
|
||||||
|
|||||||
@ -111,7 +111,8 @@ LAMMPS was built with that package. See the :doc:`Build package
|
|||||||
|
|
||||||
This fix does not correctly handle interactions involving multiple
|
This fix does not correctly handle interactions involving multiple
|
||||||
periodic images of the same atom. Hence, it should not be used for
|
periodic images of the same atom. Hence, it should not be used for
|
||||||
periodic cell dimensions less than :math:`10~\AA`.
|
periodic cell dimensions smaller than the non-bonded cutoff radius,
|
||||||
|
which is typically :math:`10~\AA` for ReaxFF simulations.
|
||||||
|
|
||||||
This fix may be used in combination with :doc:`fix efield <fix_efield>`
|
This fix may be used in combination with :doc:`fix efield <fix_efield>`
|
||||||
and will apply the external electric field during charge equilibration,
|
and will apply the external electric field during charge equilibration,
|
||||||
@ -122,7 +123,8 @@ components in non-periodic directions.
|
|||||||
Related commands
|
Related commands
|
||||||
""""""""""""""""
|
""""""""""""""""
|
||||||
|
|
||||||
:doc:`pair_style reaxff <pair_reaxff>`, :doc:`fix qeq/reaxff <fix_qeq_reaxff>`
|
:doc:`pair_style reaxff <pair_reaxff>`, :doc:`fix qeq/reaxff <fix_qeq_reaxff>`,
|
||||||
|
:doc:`fix qtpi/reaxff <fix_qtpie_reaxff>`
|
||||||
|
|
||||||
Default
|
Default
|
||||||
"""""""
|
"""""""
|
||||||
|
|||||||
@ -119,6 +119,14 @@ style supports it. Note that the :doc:`pair_style <pair_style>` and
|
|||||||
to specify these parameters initially; the fix adapt command simply
|
to specify these parameters initially; the fix adapt command simply
|
||||||
overrides the parameters.
|
overrides the parameters.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Pair_coeff settings must be made **explicitly** in order for fix
|
||||||
|
adapt to be able to change them. Settings inferred from mixing
|
||||||
|
are not suitable. If necessary all mixed settings can be output
|
||||||
|
to a file using the :doc:`write_coeff command <write_coeff>` and
|
||||||
|
then the desired mixed pair_coeff settings copied from that file.
|
||||||
|
|
||||||
The *pstyle* argument is the name of the pair style. If
|
The *pstyle* argument is the name of the pair style. If
|
||||||
:doc:`pair_style hybrid or hybrid/overlay <pair_hybrid>` is used,
|
:doc:`pair_style hybrid or hybrid/overlay <pair_hybrid>` is used,
|
||||||
*pstyle* should be a sub-style name. If there are multiple
|
*pstyle* should be a sub-style name. If there are multiple
|
||||||
@ -398,6 +406,8 @@ sub-style name. The angle styles that currently work with fix adapt are:
|
|||||||
+--------------------------------------------------------------------+--------------------+-------------+
|
+--------------------------------------------------------------------+--------------------+-------------+
|
||||||
| :doc:`mm3 <angle_mm3>` | k,theta0 | type angles |
|
| :doc:`mm3 <angle_mm3>` | k,theta0 | type angles |
|
||||||
+--------------------------------------------------------------------+--------------------+-------------+
|
+--------------------------------------------------------------------+--------------------+-------------+
|
||||||
|
| :doc:`mwlc <angle_mwlc>` | k1,k2,mu,T | type angles |
|
||||||
|
+--------------------------------------------------------------------+--------------------+-------------+
|
||||||
| :doc:`quartic <angle_quartic>` | k2,k3,k4,theta0 | type angles |
|
| :doc:`quartic <angle_quartic>` | k2,k3,k4,theta0 | type angles |
|
||||||
+--------------------------------------------------------------------+--------------------+-------------+
|
+--------------------------------------------------------------------+--------------------+-------------+
|
||||||
| :doc:`spica <angle_spica>` | k,theta0 | type angles |
|
| :doc:`spica <angle_spica>` | k,theta0 | type angles |
|
||||||
|
|||||||
@ -116,12 +116,22 @@ style supports it. Note that the :doc:`pair_style <pair_style>` and
|
|||||||
to specify these parameters initially; the fix adapt command simply
|
to specify these parameters initially; the fix adapt command simply
|
||||||
overrides the parameters.
|
overrides the parameters.
|
||||||
|
|
||||||
The *pstyle* argument is the name of the pair style. If :doc:`pair_style hybrid or hybrid/overlay <pair_hybrid>` is used, *pstyle* should be
|
.. note::
|
||||||
a sub-style name. For example, *pstyle* could be specified as "soft"
|
|
||||||
or "lubricate". The *pparam* argument is the name of the parameter to
|
Pair_coeff settings must be made **explicitly** in order for fix
|
||||||
change. This is the current list of pair styles and parameters that
|
adapt/fep to be able to change them. Settings inferred from mixing
|
||||||
can be varied by this fix. See the doc pages for individual pair
|
are not suitable. If necessary all mixed settings can be output
|
||||||
styles and their energy formulas for the meaning of these parameters:
|
to a file using the :doc:`write_coeff command <write_coeff>` and
|
||||||
|
then the desired mixed pair_coeff settings copied from that file.
|
||||||
|
|
||||||
|
The *pstyle* argument is the name of the pair style. If
|
||||||
|
:doc:`pair_style hybrid or hybrid/overlay <pair_hybrid>` is used,
|
||||||
|
*pstyle* should be a sub-style name. For example, *pstyle* could be
|
||||||
|
specified as "soft" or "lubricate". The *pparam* argument is the name
|
||||||
|
of the parameter to change. This is the current list of pair styles and
|
||||||
|
parameters that can be varied by this fix. See the doc pages for
|
||||||
|
individual pair styles and their energy formulas for the meaning of
|
||||||
|
these parameters:
|
||||||
|
|
||||||
+------------------------------------------------------------------------------+-------------------------+------------+
|
+------------------------------------------------------------------------------+-------------------------+------------+
|
||||||
| :doc:`born <pair_born>` | a,b,c | type pairs |
|
| :doc:`born <pair_born>` | a,b,c | type pairs |
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
.. index:: fix cmap
|
.. index:: fix cmap
|
||||||
|
.. index:: fix cmap/kk
|
||||||
|
|
||||||
fix cmap command
|
fix cmap command
|
||||||
================
|
================
|
||||||
|
|
||||||
|
Accelerator Variants: *cmap/kk*
|
||||||
|
|
||||||
Syntax
|
Syntax
|
||||||
""""""
|
""""""
|
||||||
|
|
||||||
@ -141,6 +144,12 @@ outermost level.
|
|||||||
MUST not disable the :doc:`fix_modify <fix_modify>` *energy* option
|
MUST not disable the :doc:`fix_modify <fix_modify>` *energy* option
|
||||||
for this fix.
|
for this fix.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. include:: accel_styles.rst
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
.. index:: fix colvars
|
.. index:: fix colvars
|
||||||
|
.. index:: fix colvars/kk
|
||||||
|
|
||||||
fix colvars command
|
fix colvars command
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
Accelerator Variants: *colvars/kk*
|
||||||
|
|
||||||
Syntax
|
Syntax
|
||||||
""""""
|
""""""
|
||||||
|
|
||||||
@ -118,6 +121,16 @@ thermostat target temperature.
|
|||||||
The *seed* keyword contains the seed for the random number generator
|
The *seed* keyword contains the seed for the random number generator
|
||||||
that will be used in the colvars module.
|
that will be used in the colvars module.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Fix colvars/kk is not really ported to KOKKOS, since the colvars
|
||||||
|
library has not been ported to KOKKOS. It merely has some
|
||||||
|
optimizations to reduce the data transfers between host and device
|
||||||
|
for KOKKOS with GPUs.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
Restarting
|
Restarting
|
||||||
""""""""""
|
""""""""""
|
||||||
|
|||||||
@ -139,9 +139,9 @@ properties are:
|
|||||||
void set_vector_length(int n);
|
void set_vector_length(int n);
|
||||||
void set_vector(int idx, double val);
|
void set_vector(int idx, double val);
|
||||||
|
|
||||||
These allow to set per-atom energy contributions, per-atom stress
|
These enable setting per-atom energy and per-atom stress contributions,
|
||||||
contributions, the length and individual values of a global vector
|
the length and individual values of a global vector of properties that
|
||||||
of properties that the caller code may want to communicate to LAMMPS
|
the caller code may want to communicate to LAMMPS
|
||||||
(e.g. for use in :doc:`fix ave/time <fix_ave_time>` or in
|
(e.g. for use in :doc:`fix ave/time <fix_ave_time>` or in
|
||||||
:doc:`equal-style variables <variable>` or for
|
:doc:`equal-style variables <variable>` or for
|
||||||
:doc:`custom thermo output <thermo_style>`.
|
:doc:`custom thermo output <thermo_style>`.
|
||||||
@ -173,9 +173,19 @@ stress/atom <compute_stress_atom>` commands. The former can be
|
|||||||
accessed by :doc:`thermodynamic output <thermo_style>`. The default
|
accessed by :doc:`thermodynamic output <thermo_style>`. The default
|
||||||
setting for this fix is :doc:`fix_modify virial yes <fix_modify>`.
|
setting for this fix is :doc:`fix_modify virial yes <fix_modify>`.
|
||||||
|
|
||||||
This fix computes a global scalar which can be accessed by various
|
This fix computes a global scalar, a global vector, and a per-atom array
|
||||||
:doc:`output commands <Howto_output>`. The scalar is the potential
|
which can be accessed by various :doc:`output commands <Howto_output>`.
|
||||||
energy discussed above. The scalar stored by this fix is "extensive".
|
The scalar is the potential energy discussed above. The scalar stored
|
||||||
|
by this fix is "extensive".
|
||||||
|
The global vector has a custom length and needs to be set by the external
|
||||||
|
program using the
|
||||||
|
:cpp:func:`lammps_fix_external_set_vector() <lammps_fix_external_set_vector>`
|
||||||
|
and :cpp:func:`lammps_fix_external_set_vector_length()
|
||||||
|
<lammps_fix_external_set_vector_length>`
|
||||||
|
calls of the LAMMPS library interface or the equivalent call of the Python
|
||||||
|
or Fortran modules.
|
||||||
|
The per-atom array has 3 values for each atom and is the applied external
|
||||||
|
force.
|
||||||
|
|
||||||
No parameter of this fix can be used with the *start/stop* keywords of
|
No parameter of this fix can be used with the *start/stop* keywords of
|
||||||
the :doc:`run <run>` command.
|
the :doc:`run <run>` command.
|
||||||
|
|||||||
@ -97,7 +97,7 @@ adjustments.
|
|||||||
To connect VMD to a listening LAMMPS simulation on the same machine
|
To connect VMD to a listening LAMMPS simulation on the same machine
|
||||||
with fix imd enabled, one needs to start VMD and load a coordinate or
|
with fix imd enabled, one needs to start VMD and load a coordinate or
|
||||||
topology file that matches the fix group. When the VMD command
|
topology file that matches the fix group. When the VMD command
|
||||||
prompts appears, one types the command line:
|
prompts appears, one types the command:
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
.. index:: fix nve/limit
|
.. index:: fix nve/limit
|
||||||
|
.. index:: fix nve/limit/kk
|
||||||
|
|
||||||
fix nve/limit command
|
fix nve/limit command
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
|
Accelerator Variants: *nve/limit/kk*
|
||||||
|
|
||||||
Syntax
|
Syntax
|
||||||
""""""
|
""""""
|
||||||
|
|
||||||
@ -79,6 +82,12 @@ is "extensive".
|
|||||||
No parameter of this fix can be used with the *start/stop* keywords of
|
No parameter of this fix can be used with the *start/stop* keywords of
|
||||||
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
|
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. include:: accel_styles.rst
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
none
|
none
|
||||||
|
|||||||
@ -135,7 +135,7 @@ directions for the forces. Only the direction of the vector is
|
|||||||
important; its length is ignored (the entered vectors are
|
important; its length is ignored (the entered vectors are
|
||||||
normalized).
|
normalized).
|
||||||
|
|
||||||
Those styles can be combined within one single command line.
|
Those styles can be combined within one single command.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|||||||
@ -190,7 +190,7 @@ on atoms via the matrix inversion method. A tolerance of 1.0e-6 is
|
|||||||
usually a good number. Keyword *alpha* can be used to change the Slater
|
usually a good number. Keyword *alpha* can be used to change the Slater
|
||||||
type orbital exponent.
|
type orbital exponent.
|
||||||
|
|
||||||
.. versionadded:: TBD
|
.. versionadded:: 19Nov2024
|
||||||
|
|
||||||
The *qeq/ctip* style describes partial charges on atoms in the same way
|
The *qeq/ctip* style describes partial charges on atoms in the same way
|
||||||
as style *qeq/shielded* but also enables the definition of charge
|
as style *qeq/shielded* but also enables the definition of charge
|
||||||
|
|||||||
@ -124,7 +124,8 @@ LAMMPS was built with that package. See the :doc:`Build package
|
|||||||
|
|
||||||
This fix does not correctly handle interactions involving multiple
|
This fix does not correctly handle interactions involving multiple
|
||||||
periodic images of the same atom. Hence, it should not be used for
|
periodic images of the same atom. Hence, it should not be used for
|
||||||
periodic cell dimensions less than 10 Angstroms.
|
periodic cell dimensions smaller than the non-bonded cutoff radius,
|
||||||
|
which is typically :math:`10~\AA` for ReaxFF simulations.
|
||||||
|
|
||||||
This fix may be used in combination with :doc:`fix efield <fix_efield>`
|
This fix may be used in combination with :doc:`fix efield <fix_efield>`
|
||||||
and will apply the external electric field during charge equilibration,
|
and will apply the external electric field during charge equilibration,
|
||||||
@ -138,7 +139,8 @@ as an atom-style variable using the *potential* keyword for `fix efield`.
|
|||||||
Related commands
|
Related commands
|
||||||
""""""""""""""""
|
""""""""""""""""
|
||||||
|
|
||||||
:doc:`pair_style reaxff <pair_reaxff>`, :doc:`fix qeq/shielded <fix_qeq>`
|
:doc:`pair_style reaxff <pair_reaxff>`, :doc:`fix qeq/shielded <fix_qeq>`,
|
||||||
|
:doc:`fix acks2/reaxff <fix_acks2_reaxff>`, :doc:`fix qtpie/reaxff <fix_qtpie_reaxff>`
|
||||||
|
|
||||||
Default
|
Default
|
||||||
"""""""
|
"""""""
|
||||||
|
|||||||
200
doc/src/fix_qtpie_reaxff.rst
Normal file
200
doc/src/fix_qtpie_reaxff.rst
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
.. index:: fix qtpie/reaxff
|
||||||
|
|
||||||
|
fix qtpie/reaxff command
|
||||||
|
========================
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
""""""
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
fix ID group-ID qtpie/reaxff Nevery cutlo cuthi tolerance params gfile args
|
||||||
|
|
||||||
|
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||||
|
* qtpie/reaxff = style name of this fix command
|
||||||
|
* Nevery = perform QTPIE every this many steps
|
||||||
|
* cutlo,cuthi = lo and hi cutoff for Taper radius
|
||||||
|
* tolerance = precision to which charges will be equilibrated
|
||||||
|
* params = reaxff or a filename
|
||||||
|
* gfile = the name of a file containing Gaussian orbital exponents
|
||||||
|
* one or more keywords or keyword/value pairs may be appended
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
keyword = *maxiter*
|
||||||
|
*maxiter* N = limit the number of iterations to *N*
|
||||||
|
|
||||||
|
Examples
|
||||||
|
""""""""
|
||||||
|
|
||||||
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
fix 1 all qtpie/reaxff 1 0.0 10.0 1.0e-6 reaxff exp.qtpie
|
||||||
|
fix 1 all qtpie/reaxff 1 0.0 10.0 1.0e-6 params.qtpie exp.qtpie maxiter 500
|
||||||
|
|
||||||
|
Description
|
||||||
|
"""""""""""
|
||||||
|
|
||||||
|
.. versionadded:: 19Nov2024
|
||||||
|
|
||||||
|
The QTPIE charge equilibration method is an extension of the QEq charge
|
||||||
|
equilibration method. With QTPIE, the partial charges on individual atoms
|
||||||
|
are computed by minimizing the electrostatic energy of the system in the
|
||||||
|
same way as the QEq method but where the absolute electronegativity,
|
||||||
|
:math:`\chi_i`, of each atom in the QEq charge equilibration scheme
|
||||||
|
:ref:`(Rappe and Goddard) <Rappe3>` is replaced with an effective
|
||||||
|
electronegativity given by :ref:`(Chen) <qtpie-Chen>`
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\chi_{\mathrm{eff},i} = \frac{\sum_{j=1}^{N} (\chi_i - \chi_j) S_{ij}}
|
||||||
|
{\sum_{m=1}^{N}S_{im}},
|
||||||
|
|
||||||
|
which acts to penalize long-range charge transfer seen with the QEq charge
|
||||||
|
equilibration scheme. In this equation, :math:`N` is the number of atoms in
|
||||||
|
the system and :math:`S_{ij}` is the overlap integral between atom :math:`i`
|
||||||
|
and atom :math:`j`.
|
||||||
|
|
||||||
|
The effect of an external electric field can be incorporated into the QTPIE
|
||||||
|
method by modifying the absolute or effective electronegativities of each
|
||||||
|
atom :ref:`(Chen) <qtpie-Chen>`. This fix models the effect of an external
|
||||||
|
electric field by using the effective electronegativity given in
|
||||||
|
:ref:`(Gergs) <Gergs>`:
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\chi_{\mathrm{eff},i} = \frac{\sum_{j=1}^{N} (\chi_i - \chi_j + \phi_i - \phi_j) S_{ij}}
|
||||||
|
{\sum_{m=1}^{N}S_{im}},
|
||||||
|
|
||||||
|
where :math:`\phi_i` and :math:`\phi_j` are the electric
|
||||||
|
potentials at the positions of atom :math:`i` and :math:`j`
|
||||||
|
due to the external electric field.
|
||||||
|
|
||||||
|
This fix is typically used in conjunction with the ReaxFF force
|
||||||
|
field model as implemented in the :doc:`pair_style reaxff <pair_reaxff>`
|
||||||
|
command, but it can be used with any potential in LAMMPS, so long as it
|
||||||
|
defines and uses charges on each atom. For more technical details about the
|
||||||
|
charge equilibration performed by `fix qtpie/reaxff`, which is the same as in
|
||||||
|
:doc:`fix qeq/reaxff <fix_qeq_reaxff>` except for the use of
|
||||||
|
:math:`\chi_{\mathrm{eff},i}`, please refer to :ref:`(Aktulga) <qeq-Aktulga2>`.
|
||||||
|
To be explicit, this fix replaces :math:`\chi_k` of eq. 3 in
|
||||||
|
:ref:`(Aktulga) <qeq-Aktulga2>` with :math:`\chi_{\mathrm{eff},k}`.
|
||||||
|
|
||||||
|
This fix requires the absolute electronegativity, :math:`\chi`, in eV, the
|
||||||
|
self-Coulomb potential, :math:`\eta`, in eV, and the shielded Coulomb
|
||||||
|
constant, :math:`\gamma`, in :math:`\AA^{-1}`. If the *params* setting above
|
||||||
|
is the word "reaxff", then these are extracted from the
|
||||||
|
:doc:`pair_style reaxff <pair_reaxff>` command and the ReaxFF force field
|
||||||
|
file it reads in. If a file name is specified for *params*, then the
|
||||||
|
parameters are taken from the specified file and the file must contain
|
||||||
|
one line for each atom type. The latter form must be used when performing
|
||||||
|
QTPIE with a non-ReaxFF potential. Each line should be formatted as follows,
|
||||||
|
ensuring that the parameters are given in units of eV, eV, and :math:`\AA^{-1}`,
|
||||||
|
respectively:
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
itype chi eta gamma
|
||||||
|
|
||||||
|
where *itype* is the atom type from 1 to Ntypes. Note that eta is
|
||||||
|
defined here as twice the eta value in the ReaxFF file.
|
||||||
|
|
||||||
|
The overlap integrals in the equation for :math:`\chi_{\mathrm{eff},i}`
|
||||||
|
are computed by using normalized 1s Gaussian type orbitals. The Gaussian
|
||||||
|
orbital exponents, :math:`\alpha`, that are needed to compute the overlap
|
||||||
|
integrals are taken from the file given by *gfile*.
|
||||||
|
This file must contain one line for each atom type and provide the Gaussian
|
||||||
|
orbital exponent for each atom type in units of inverse square Bohr radius.
|
||||||
|
Each line should be formatted as follows:
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
itype alpha
|
||||||
|
|
||||||
|
Empty lines or any text following the pound sign (#) are ignored. An example
|
||||||
|
*gfile* for a system with two atom types is
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
# An example gfile. Exponents are taken from Table 2.2 of Chen, J. (2009).
|
||||||
|
# Theory and applications of fluctuating-charge models.
|
||||||
|
# The units of the exponents are 1 / (Bohr radius)^2 .
|
||||||
|
1 0.2240 # O
|
||||||
|
2 0.5434 # H
|
||||||
|
|
||||||
|
The optional *maxiter* keyword allows changing the max number
|
||||||
|
of iterations in the linear solver. The default value is 200.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
In order to solve the self-consistent equations for electronegativity
|
||||||
|
equalization, LAMMPS imposes the additional constraint that all the
|
||||||
|
charges in the fix group must add up to zero. The initial charge
|
||||||
|
assignments should also satisfy this constraint. LAMMPS will print a
|
||||||
|
warning if that is not the case.
|
||||||
|
|
||||||
|
Restart, fix_modify, output, run start/stop, minimize info
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
No information about this fix is written to :doc:`binary restart files
|
||||||
|
<restart>`. This fix computes a global scalar (the number of
|
||||||
|
iterations) and a per-atom vector (the effective electronegativity), which
|
||||||
|
can be accessed by various :doc:`output commands <Howto_output>`.
|
||||||
|
No parameter of this fix can be used with the *start/stop* keywords of
|
||||||
|
the :doc:`run <run>` command.
|
||||||
|
|
||||||
|
This fix is invoked during :doc:`energy minimization <minimize>`.
|
||||||
|
|
||||||
|
Restrictions
|
||||||
|
""""""""""""
|
||||||
|
|
||||||
|
This fix is part of the REAXFF package. It is only enabled if
|
||||||
|
LAMMPS was built with that package. See the :doc:`Build package
|
||||||
|
<Build_package>` page for more info.
|
||||||
|
|
||||||
|
This fix does not correctly handle interactions involving multiple
|
||||||
|
periodic images of the same atom. Hence, it should not be used for
|
||||||
|
periodic cell dimensions smaller than the non-bonded cutoff radius,
|
||||||
|
which is typically :math:`10~\AA` for ReaxFF simulations.
|
||||||
|
|
||||||
|
This fix may be used in combination with :doc:`fix efield <fix_efield>`
|
||||||
|
and will apply the external electric field during charge equilibration,
|
||||||
|
but there may be only one fix efield instance used and the electric field
|
||||||
|
must be applied to all atoms in the system. Consequently, `fix efield` must
|
||||||
|
be used with *group-ID* all and must not be used with the keyword *region*.
|
||||||
|
Equal-style variables can be used for electric field vector
|
||||||
|
components without any further settings. Atom-style variables can be used
|
||||||
|
for spatially-varying electric field vector components, but the resulting
|
||||||
|
electric potential must be specified as an atom-style variable using
|
||||||
|
the *potential* keyword for `fix efield`.
|
||||||
|
|
||||||
|
Related commands
|
||||||
|
""""""""""""""""
|
||||||
|
|
||||||
|
:doc:`pair_style reaxff <pair_reaxff>`, :doc:`fix qeq/reaxff <fix_qeq_reaxff>`,
|
||||||
|
:doc:`fix acks2/reaxff <fix_acks2_reaxff>`
|
||||||
|
|
||||||
|
Default
|
||||||
|
"""""""
|
||||||
|
|
||||||
|
maxiter 200
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. _Rappe3:
|
||||||
|
|
||||||
|
**(Rappe)** Rappe and Goddard III, Journal of Physical Chemistry, 95,
|
||||||
|
3358-3363 (1991).
|
||||||
|
|
||||||
|
.. _qtpie-Chen:
|
||||||
|
|
||||||
|
**(Chen)** Chen, Jiahao. Theory and applications of fluctuating-charge models.
|
||||||
|
University of Illinois at Urbana-Champaign, 2009.
|
||||||
|
|
||||||
|
.. _Gergs:
|
||||||
|
|
||||||
|
**(Gergs)** Gergs, Dirkmann and Mussenbrock.
|
||||||
|
Journal of Applied Physics 123.24 (2018).
|
||||||
|
|
||||||
|
.. _qeq-Aktulga2:
|
||||||
|
|
||||||
|
**(Aktulga)** Aktulga, Fogarty, Pandit, Grama, Parallel Computing, 38,
|
||||||
|
245-259 (2012).
|
||||||
@ -1,8 +1,11 @@
|
|||||||
.. index:: fix recenter
|
.. index:: fix recenter
|
||||||
|
.. index:: fix recenter/kk
|
||||||
|
|
||||||
fix recenter command
|
fix recenter command
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
Accelerator Variants: *recenter/kk*
|
||||||
|
|
||||||
Syntax
|
Syntax
|
||||||
""""""
|
""""""
|
||||||
|
|
||||||
@ -113,6 +116,12 @@ The scalar and vector values calculated by this fix are "extensive".
|
|||||||
No parameter of this fix can be used with the *start/stop* keywords of
|
No parameter of this fix can be used with the *start/stop* keywords of
|
||||||
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
|
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. include:: accel_styles.rst
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
|
|
||||||
|
|||||||
@ -16,21 +16,36 @@ Syntax
|
|||||||
* kstyle = *quintic* or *RK0* or *RK1* or *RK2*
|
* kstyle = *quintic* or *RK0* or *RK1* or *RK2*
|
||||||
* zmin = minimal number of neighbors for reproducing kernels
|
* zmin = minimal number of neighbors for reproducing kernels
|
||||||
* zero or more keyword/value pairs may be appended to args
|
* zero or more keyword/value pairs may be appended to args
|
||||||
* keyword = *thermal* or *interface/reconstruct* or *surface/detection* or *shift* or *rho/sum* or *density* or *self/mass* or *speed/sound*
|
* keyword = *thermal* or *interface/reconstruct* or *surface/detection* or *shift* or *rho/sum* or *density* or *speed/sound*
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
*thermal* values = none, turns on thermal evolution
|
*thermal* turns on thermal evolution
|
||||||
*interface/reconstruct* values = none, reconstructs interfaces with solid particles
|
values = none
|
||||||
*surface/detection* values = *sdstyle* *limit* *limit/splash*
|
*interface/reconstruct* reconstructs interfaces with solid particles
|
||||||
*sdstyle* = *coordination* or *divergence*
|
values = none
|
||||||
*limit* = threshold for surface particles
|
*surface/detection* detects free-surfaces with an absence of particles
|
||||||
*limit/splash* = threshold for splash particles
|
values = *sdstyle* *limit* *limit/splash*
|
||||||
*shift* values = none, turns on velocity shifting
|
*sdstyle* = *coordination* or *divergence*
|
||||||
*rho/sum* values = none, uses the kernel to compute the density of particles
|
*limit* = threshold for surface particles
|
||||||
*self/mass* values = none, a particle uses its own mass in a rho summation
|
*limit/splash* = threshold for splash particles (unitless)
|
||||||
*density* values = *rho01*, ... *rho0N* (density)
|
*shift* turns on velocity shifting
|
||||||
*speed/sound* values = *cs0*, ... *csN* (velocity)
|
values = none
|
||||||
|
optional args = *exclude/type* or *scale/cross/type*
|
||||||
|
*exclude/type* values = *types*
|
||||||
|
*types* = list of types
|
||||||
|
*scale/cross/type* values = *shiftscale* *cmin* *wmin*
|
||||||
|
*shiftscale* = fraction of shifting in normal direction to preserve (unitless)
|
||||||
|
*cmin* = minimum color function value required for scaling (unitless)
|
||||||
|
*wmin* = minimum local same-type support required for any shifting (unitless)
|
||||||
|
*rho/sum* density evolution performed by a kernel summation
|
||||||
|
values = none
|
||||||
|
optional args = *self/mass*
|
||||||
|
*self/mass* values = none, a particle uses its own mass in summation
|
||||||
|
*density* specify equilibrium densities for each atom type
|
||||||
|
values = *rho01*, ... *rho0N* (density)
|
||||||
|
*speed/sound* specify speeds of sound for each atom type
|
||||||
|
values = *cs0*, ... *csN* (velocity)
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
""""""""
|
""""""""
|
||||||
@ -39,6 +54,8 @@ Examples
|
|||||||
|
|
||||||
fix 1 all rheo 3.0 quintic 0 thermal density 0.1 0.1 speed/sound 10.0 1.0
|
fix 1 all rheo 3.0 quintic 0 thermal density 0.1 0.1 speed/sound 10.0 1.0
|
||||||
fix 1 all rheo 3.0 RK1 10 shift surface/detection coordination 40
|
fix 1 all rheo 3.0 RK1 10 shift surface/detection coordination 40
|
||||||
|
fix 1 all rheo 3.0 RK1 10 shift exclude/type 2*4 scale/cross/type 0.05 0.02 0.5
|
||||||
|
fix 1 all rheo 3.0 RK1 10 rhosum self/mass
|
||||||
|
|
||||||
Description
|
Description
|
||||||
"""""""""""
|
"""""""""""
|
||||||
@ -46,8 +63,10 @@ Description
|
|||||||
.. versionadded:: 29Aug2024
|
.. versionadded:: 29Aug2024
|
||||||
|
|
||||||
Perform time integration for RHEO particles, updating positions, velocities,
|
Perform time integration for RHEO particles, updating positions, velocities,
|
||||||
and densities. For an overview of other features available in the RHEO package,
|
and densities. For a detailed breakdown of the integration timestep and
|
||||||
see :doc:`the RHEO howto <Howto_rheo>`.
|
numerical details, see :ref:`(Palermo) <fix_rheo_palermo>`. For an overview
|
||||||
|
and list of other features available in the RHEO package, see
|
||||||
|
:doc:`the RHEO howto <Howto_rheo>`.
|
||||||
|
|
||||||
The type of kernel is specified using *kstyle* and the cutoff is *cut*. Four
|
The type of kernel is specified using *kstyle* and the cutoff is *cut*. Four
|
||||||
kernels are currently available. The *quintic* kernel is a standard quintic
|
kernels are currently available. The *quintic* kernel is a standard quintic
|
||||||
@ -70,16 +89,51 @@ and velocity of solid particles are alternatively reconstructed for every
|
|||||||
fluid-solid interaction to ensure no-slip and pressure-balanced boundaries.
|
fluid-solid interaction to ensure no-slip and pressure-balanced boundaries.
|
||||||
This is done by estimating the location of the fluid-solid interface and
|
This is done by estimating the location of the fluid-solid interface and
|
||||||
extrapolating fluid particle properties across the interface to calculate a
|
extrapolating fluid particle properties across the interface to calculate a
|
||||||
temporary apparent density and velocity for a solid particle.
|
temporary apparent density and velocity for a solid particle. The numerical
|
||||||
|
details are the same as those described in
|
||||||
|
:ref:`(Palermo) <fix_rheo_palermo>` except there is an additional
|
||||||
|
restriction that the reconstructed solid density cannot be less than the
|
||||||
|
equilibrium density. This prevents fluid particles from sticking to solid
|
||||||
|
surfaces.
|
||||||
|
|
||||||
A modified form of Fickian particle shifting can be enabled with the
|
A modified form of Fickian particle shifting can be enabled with the
|
||||||
*shift* keyword. This effectively shifts particle positions to generate a
|
*shift* keyword. This effectively shifts particle positions to generate a
|
||||||
more uniform spatial distribution. Shifting currently does not consider the
|
more uniform spatial distribution. By default, shifting does not consider the
|
||||||
type of a particle and therefore may be inappropriate in systems consisting
|
type of a particle and therefore may be inappropriate in systems consisting
|
||||||
of multiple fluid phases.
|
of multiple atom types representing multiple fluid phases. However, two
|
||||||
|
optional sub-arguments can follow the *shift* keyword, *exclude/type* and
|
||||||
|
*scale/cross/type* to adjust shifting at fluid interfaces.
|
||||||
|
|
||||||
In systems with free surfaces, the *surface/detection* keyword can be used
|
The *exclude/type* option lets the user specify a list of atom types which
|
||||||
to classify the location of particles as being within the bulk fluid, on a
|
are not shifted, *types*. A wild-card asterisk can be used in place
|
||||||
|
of or in conjunction with the *types* argument to toggle shifting for
|
||||||
|
multiple atom types. This takes the form "\*" or "\*n" or "m\*"
|
||||||
|
or "m\*n". If :math:`N` is the number of atom types, then an asterisk with
|
||||||
|
no numeric values means all types from 1 to :math:`N`. A leading asterisk
|
||||||
|
means all types from 1 to n (inclusive). A trailing asterisk means all types
|
||||||
|
from m to :math:`N` (inclusive). A middle asterisk means all types from m to n
|
||||||
|
(inclusive).
|
||||||
|
|
||||||
|
The *scale/cross/type* option is designed to handle interfaces between fluids
|
||||||
|
made up of different atom types. Similar to the method by
|
||||||
|
:ref:`(Yang) <fix_rheo_yang>`, a color function is calculated and used to
|
||||||
|
estimate a local interfacial normal vector. Shifting along this normal direction
|
||||||
|
is rescaled by a factor of *scaleshift*, such that a value of *scaleshift* of
|
||||||
|
zero implies there is no shifting in the normal direction and a value of
|
||||||
|
*scaleshift* of one implies no change in behavior. This scaling is only applied
|
||||||
|
to atoms with a color function value greater than *cmin*. To handle scenarios
|
||||||
|
of a small inclusion of one fluid type (e.g. a single atom) inside another,
|
||||||
|
the degree of same-type support is calculated
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
W_{i,\mathrm{same}} = \sum_{j} W_{ij} \delta_{ij}
|
||||||
|
|
||||||
|
where :math:`\delta_{ij}` is zero if atoms :math:`i` and :math:`j` have different
|
||||||
|
types but unity otherwise. If :math:`W_{i,\mathrm{same}}` is ever less than the
|
||||||
|
specified value of *wmin*, shifting is turned off for particle :math:`i`
|
||||||
|
|
||||||
|
In systems with free surfaces (atom-vacuum), the *surface/detection* keyword
|
||||||
|
can classify the location of particles as being within the bulk fluid, on a
|
||||||
free surface, or isolated from other particles in a splash or droplet.
|
free surface, or isolated from other particles in a splash or droplet.
|
||||||
Shifting is then disabled in the normal direction away from the free surface
|
Shifting is then disabled in the normal direction away from the free surface
|
||||||
to prevent particles from diffusing away. Surface detection can also be used
|
to prevent particles from diffusing away. Surface detection can also be used
|
||||||
@ -101,10 +155,9 @@ threshold for this classification is set by the numerical value of
|
|||||||
By default, RHEO integrates particles' densities using a mass diffusion
|
By default, RHEO integrates particles' densities using a mass diffusion
|
||||||
equation. Alternatively, one can update densities every timestep by performing
|
equation. Alternatively, one can update densities every timestep by performing
|
||||||
a kernel summation of the masses of neighboring particles by specifying the *rho/sum*
|
a kernel summation of the masses of neighboring particles by specifying the *rho/sum*
|
||||||
keyword.
|
keyword. Following this keyword, one may include the optional *self/mass* sub-argument
|
||||||
|
which modifies the behavior of the density summation. Typically, the density
|
||||||
The *self/mass* keyword modifies the behavior of the density summation in *rho/sum*.
|
:math:`\rho` of a particle is calculated as the sum over neighbors
|
||||||
Typically, the density :math:`\rho` of a particle is calculated as the sum over neighbors
|
|
||||||
|
|
||||||
.. math::
|
.. math::
|
||||||
\rho_i = \sum_{j} W_{ij} M_j
|
\rho_i = \sum_{j} W_{ij} M_j
|
||||||
@ -120,7 +173,9 @@ equilibrium density *rho0*.
|
|||||||
|
|
||||||
The *speed/sound* keyword is used to specify the speed of sound of each of the
|
The *speed/sound* keyword is used to specify the speed of sound of each of the
|
||||||
N particle types. It must be followed by N numerical values specifying each type's
|
N particle types. It must be followed by N numerical values specifying each type's
|
||||||
speed of sound *cs*.
|
speed of sound *cs*. These values may be ignored if the pressure equation of
|
||||||
|
state has a non-constant speed of sound, as discussed further in
|
||||||
|
:doc:`fix rheo/pressure <fix_rheo_pressure>`.
|
||||||
|
|
||||||
Restart, fix_modify, output, run start/stop, minimize info
|
Restart, fix_modify, output, run start/stop, minimize info
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
@ -163,6 +218,14 @@ Default
|
|||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
.. _fix_rheo_palermo:
|
||||||
|
|
||||||
|
**(Palermo)** Palermo, Wolf, Clemmer, O'Connor, Phys. Fluids, 36, 113337 (2024).
|
||||||
|
|
||||||
|
.. _fix_rheo_yang:
|
||||||
|
|
||||||
|
**(Yang)** Yang, Rakhsha, Hu, Negrut, J. Comp. Physics, 458, 111079 (2022).
|
||||||
|
|
||||||
.. _fix_rheo_hu:
|
.. _fix_rheo_hu:
|
||||||
|
|
||||||
**(Hu)** Hu, and Adams J. Comp. Physics, 213, 844-861 (2006).
|
**(Hu)** Hu, and Adams, J. Comp. Physics, 213, 844-861 (2006).
|
||||||
|
|||||||
@ -14,13 +14,16 @@ Syntax
|
|||||||
* rheo/pressure = style name of this fix command
|
* rheo/pressure = style name of this fix command
|
||||||
* one or more types and pressure styles must be appended
|
* one or more types and pressure styles must be appended
|
||||||
* types = lists of types (see below)
|
* types = lists of types (see below)
|
||||||
* pstyle = *linear* or *taitwater* or *cubic*
|
* pstyle = *linear* or *tait/water* or *tait/general* or *cubic* or *ideal/gas* or *background*
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
*linear* args = none
|
*linear* args = none
|
||||||
*taitwater* args = none
|
*tait/water* args = none
|
||||||
|
*tait/general* args = exponent :math:`gamma` (unitless)
|
||||||
*cubic* args = cubic prefactor :math:`A_3` (pressure/density\^2)
|
*cubic* args = cubic prefactor :math:`A_3` (pressure/density\^2)
|
||||||
|
*ideal/gas* args = heat capacity ratio :math:`gamma` (unitless)
|
||||||
|
*background* args = background pressure :math:`P[b]` (pressure)
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
""""""""
|
""""""""
|
||||||
@ -29,6 +32,7 @@ Examples
|
|||||||
|
|
||||||
fix 1 all rheo/pressure * linear
|
fix 1 all rheo/pressure * linear
|
||||||
fix 1 all rheo/pressure 1 linear 2 cubic 10.0
|
fix 1 all rheo/pressure 1 linear 2 cubic 10.0
|
||||||
|
fix 1 all rheo/pressure * linear * background 0.1
|
||||||
|
|
||||||
Description
|
Description
|
||||||
"""""""""""
|
"""""""""""
|
||||||
@ -40,13 +44,12 @@ define different equations of state for different atom types. An equation
|
|||||||
must be specified for every atom type.
|
must be specified for every atom type.
|
||||||
|
|
||||||
One first defines the atom *types*. A wild-card asterisk can be used in place
|
One first defines the atom *types*. A wild-card asterisk can be used in place
|
||||||
of or in conjunction with the *types* argument to set the coefficients for
|
of or in conjunction with the *types* argument to set values for multiple atom
|
||||||
multiple pairs of atom types. This takes the form "\*" or "\*n" or "m\*"
|
types. This takes the form "\*" or "\*n" or "m\*" or "m\*n". If :math:`N` is
|
||||||
or "m\*n". If :math:`N` is the number of atom types, then an asterisk with
|
the number of atom types, then an asterisk with no numeric values means all types
|
||||||
no numeric values means all types from 1 to :math:`N`. A leading asterisk
|
from 1 to :math:`N`. A leading asterisk means all types from 1 to n (inclusive).
|
||||||
means all types from 1 to n (inclusive). A trailing asterisk means all types
|
A trailing asterisk means all types from m to :math:`N` (inclusive). A middle
|
||||||
from m to :math:`N` (inclusive). A middle asterisk means all types from m to n
|
asterisk means all types from m to n (inclusive).
|
||||||
(inclusive).
|
|
||||||
|
|
||||||
The *types* definition is followed by the pressure style, *pstyle*. Current
|
The *types* definition is followed by the pressure style, *pstyle*. Current
|
||||||
options *linear*, *taitwater*, and *cubic*. Style *linear* is a linear
|
options *linear*, *taitwater*, and *cubic*. Style *linear* is a linear
|
||||||
@ -54,7 +57,7 @@ equation of state with a particle pressure :math:`P` calculated as
|
|||||||
|
|
||||||
.. math::
|
.. math::
|
||||||
|
|
||||||
P = c (\rho - \rho_0)
|
P = c^2 (\rho - \rho_0)
|
||||||
|
|
||||||
where :math:`c` is the speed of sound, :math:`\rho_0` is the equilibrium density,
|
where :math:`c` is the speed of sound, :math:`\rho_0` is the equilibrium density,
|
||||||
and :math:`\rho` is the current density of a particle. The numerical values of
|
and :math:`\rho` is the current density of a particle. The numerical values of
|
||||||
@ -63,14 +66,39 @@ is a cubic equation of state which has an extra argument :math:`A_3`,
|
|||||||
|
|
||||||
.. math::
|
.. math::
|
||||||
|
|
||||||
P = c ((\rho - \rho_0) + A_3 (\rho - \rho_0)^3) .
|
P = c^2 ((\rho - \rho_0) + A_3 (\rho - \rho_0)^3) .
|
||||||
|
|
||||||
Style *taitwater* is Tait's equation of state:
|
Style *tait/water* is Tait's equation of state:
|
||||||
|
|
||||||
.. math::
|
.. math::
|
||||||
|
|
||||||
P = \frac{c^2 \rho_0}{7} \biggl[\left(\frac{\rho}{\rho_0}\right)^{7} - 1\biggr].
|
P = \frac{c^2 \rho_0}{7} \biggl[\left(\frac{\rho}{\rho_0}\right)^{7} - 1\biggr].
|
||||||
|
|
||||||
|
Style *tait/general* generalizes this equation of state
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
|
||||||
|
P = \frac{c^2 \rho_0}{\gamma} \biggl[\left(\frac{\rho}{\rho_0}\right)^{\gamma} - 1\biggr].
|
||||||
|
|
||||||
|
where :math:`\gamma` is an exponent.
|
||||||
|
|
||||||
|
Style *ideal/gas* is the ideal gas equation of state
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
|
||||||
|
P = (\gamma - 1) \rho e
|
||||||
|
|
||||||
|
where :math:`\gamma` is the heat capacity ratio and :math:`e` is the internal energy of
|
||||||
|
a particle per unit mass. This style is only compatible with atom style rheo/thermal.
|
||||||
|
Note that when using this style, the speed of sound is no longer constant such that the
|
||||||
|
value of :math:`c` specified in :doc:`fix rheo <fix_rheo>` is not used.
|
||||||
|
|
||||||
|
The *background* style acts differently than the rest as it
|
||||||
|
only adds a constant background pressure shift :math:`P[b]`
|
||||||
|
to all atoms of the designated types. Therefore, this style
|
||||||
|
must be used in conjunction with another style that specifies
|
||||||
|
an equation of state.
|
||||||
|
|
||||||
Restart, fix_modify, output, run start/stop, minimize info
|
Restart, fix_modify, output, run start/stop, minimize info
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
|||||||
@ -70,13 +70,13 @@ of the energy is used to shift energies. This may be inappropriate in systems
|
|||||||
with multiple atom types with different specific heats.
|
with multiple atom types with different specific heats.
|
||||||
|
|
||||||
For each property, one must first define a list of atom types. A wild-card
|
For each property, one must first define a list of atom types. A wild-card
|
||||||
asterisk can be used in place of or in conjunction with the *types* argument
|
asterisk can be used in place of or in conjunction with the *types* argument to
|
||||||
to set the coefficients for multiple pairs of atom types. This takes the
|
set values for multiple atom types. This takes the form "\*" or "\*n" or "m\*"
|
||||||
form "\*" or "\*n" or "m\*" or "m\*n". If :math:`N` is the number of atom
|
or "m\*n". If :math:`N` is the number of atom types, then an asterisk with no
|
||||||
types, then an asterisk with no numeric values means all types from 1 to
|
numeric values means all types from 1 to :math:`N`. A leading asterisk means
|
||||||
:math:`N`. A leading asterisk means all types from 1 to n (inclusive).
|
all types from 1 to n (inclusive). A trailing asterisk means all types from m
|
||||||
A trailing asterisk means all types from m to :math:`N` (inclusive). A
|
to :math:`N` (inclusive). A middle asterisk means all types from m to n
|
||||||
middle asterisk means all types from m to n (inclusive).
|
(inclusive).
|
||||||
|
|
||||||
The *types* definition for each property is followed by the style. Currently,
|
The *types* definition for each property is followed by the style. Currently,
|
||||||
the only option is *constant*. Style *constant* simply applies a constant value
|
the only option is *constant*. Style *constant* simply applies a constant value
|
||||||
|
|||||||
@ -45,13 +45,12 @@ viscosities for different atom types, but a viscosity must be specified for
|
|||||||
every atom type.
|
every atom type.
|
||||||
|
|
||||||
One first defines the atom *types*. A wild-card asterisk can be used in place
|
One first defines the atom *types*. A wild-card asterisk can be used in place
|
||||||
of or in conjunction with the *types* argument to set the coefficients for
|
of or in conjunction with the *types* argument to set values for multiple atom
|
||||||
multiple pairs of atom types. This takes the form "\*" or "\*n" or "m\*"
|
types. This takes the form "\*" or "\*n" or "m\*" or "m\*n". If :math:`N` is
|
||||||
or "m\*n". If :math:`N` is the number of atom types, then an asterisk with
|
the number of atom types, then an asterisk with no numeric values means all types
|
||||||
no numeric values means all types from 1 to :math:`N`. A leading asterisk
|
from 1 to :math:`N`. A leading asterisk means all types from 1 to n (inclusive).
|
||||||
means all types from 1 to n (inclusive). A trailing asterisk means all types
|
A trailing asterisk means all types from m to :math:`N` (inclusive). A middle
|
||||||
from m to :math:`N` (inclusive). A middle asterisk means all types from m to n
|
asterisk means all types from m to n (inclusive).
|
||||||
(inclusive).
|
|
||||||
|
|
||||||
The *types* definition is followed by the viscosity style, *vstyle*. Two
|
The *types* definition is followed by the viscosity style, *vstyle*. Two
|
||||||
options are available, *constant* and *power*. Style *constant* simply
|
options are available, *constant* and *power*. Style *constant* simply
|
||||||
|
|||||||
@ -32,6 +32,12 @@ Hydrodynamics.
|
|||||||
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
||||||
LAMMPS.
|
LAMMPS.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Please note that the SPH PDF guide file has not been updated for
|
||||||
|
many years and thus does not reflect the current *syntax* of the
|
||||||
|
SPH package commands. For that please refer to the LAMMPS manual.
|
||||||
|
|
||||||
Restart, fix_modify, output, run start/stop, minimize info
|
Restart, fix_modify, output, run start/stop, minimize info
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,12 @@ space. SPH stands for Smoothed Particle Hydrodynamics.
|
|||||||
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
See `this PDF guide <PDF/SPH_LAMMPS_userguide.pdf>`_ to using SPH in
|
||||||
LAMMPS.
|
LAMMPS.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Please note that the SPH PDF guide file has not been updated for
|
||||||
|
many years and thus does not reflect the current *syntax* of the
|
||||||
|
SPH package commands. For that please refer to the LAMMPS manual.
|
||||||
|
|
||||||
Restart, fix_modify, output, run start/stop, minimize info
|
Restart, fix_modify, output, run start/stop, minimize info
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Syntax
|
|||||||
|
|
||||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||||
* spring/self = style name of this fix command
|
* spring/self = style name of this fix command
|
||||||
* K = spring constant (force/distance units)
|
* K = spring constant (force/distance units), can be a variable (see below)
|
||||||
* dir = xyz, xy, xz, yz, x, y, or z (optional, default: xyz)
|
* dir = xyz, xy, xz, yz, x, y, or z (optional, default: xyz)
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
@ -22,6 +22,7 @@ Examples
|
|||||||
.. code-block:: LAMMPS
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
fix tether boundary-atoms spring/self 10.0
|
fix tether boundary-atoms spring/self 10.0
|
||||||
|
fix var all spring/self v_kvar
|
||||||
fix zrest move spring/self 10.0 z
|
fix zrest move spring/self 10.0 z
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@ -42,6 +43,22 @@ directions, but it can be limited to the xy-, xz-, yz-plane and the
|
|||||||
x-, y-, or z-direction, thus restraining the atoms to a line or a
|
x-, y-, or z-direction, thus restraining the atoms to a line or a
|
||||||
plane, respectively.
|
plane, respectively.
|
||||||
|
|
||||||
|
The force constant *k* can be specified as an equal-style or atom-style
|
||||||
|
:doc:`variable <variable>`. If the value is a variable, it should be specified
|
||||||
|
as v_name, where name is the variable name. In this case, the variable
|
||||||
|
will be evaluated each time step, and its value(s) will be used as
|
||||||
|
force constant for the spring force.
|
||||||
|
|
||||||
|
Equal-style variables can specify formulas with various mathematical
|
||||||
|
functions and include :doc:`thermo_style <thermo_style>` command
|
||||||
|
keywords for the simulation box parameters, time step, and elapsed time.
|
||||||
|
Thus, it is easy to specify a time-dependent force field.
|
||||||
|
|
||||||
|
Atom-style variables can specify the same formulas as equal-style
|
||||||
|
variables but can also include per-atom values, such as atom
|
||||||
|
coordinates. Thus, it is easy to specify a spatially-dependent force
|
||||||
|
field with optional time-dependence as well.
|
||||||
|
|
||||||
Restart, fix_modify, output, run start/stop, minimize info
|
Restart, fix_modify, output, run start/stop, minimize info
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
@ -89,7 +106,9 @@ invoked by the :doc:`minimize <minimize>` command.
|
|||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
none
|
|
||||||
|
The KOKKOS version, *fix spring/self/kk* may only be used with a constant
|
||||||
|
value of K, not a variable.
|
||||||
|
|
||||||
Related commands
|
Related commands
|
||||||
""""""""""""""""
|
""""""""""""""""
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
.. index:: fix wall/region
|
.. index:: fix wall/region
|
||||||
|
.. index:: fix wall/region/kk
|
||||||
|
|
||||||
fix wall/region command
|
fix wall/region command
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
Accelerator Variants: *wall/region/kk*
|
||||||
|
|
||||||
Syntax
|
Syntax
|
||||||
""""""
|
""""""
|
||||||
|
|
||||||
@ -234,6 +237,12 @@ invoked by the :doc:`minimize <minimize>` command.
|
|||||||
minimized), you MUST enable the :doc:`fix_modify <fix_modify>`
|
minimized), you MUST enable the :doc:`fix_modify <fix_modify>`
|
||||||
*energy* option for this fix.
|
*energy* option for this fix.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. include:: accel_styles.rst
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
none
|
none
|
||||||
|
|||||||
@ -1084,10 +1084,11 @@ the form of *key_name_key*-*key_name_value* pairs). For example,
|
|||||||
kim property modify 1 key mass source-value 26.98154
|
kim property modify 1 key mass source-value 26.98154
|
||||||
kim property modify 1 key mass source-unit amu
|
kim property modify 1 key mass source-unit amu
|
||||||
|
|
||||||
where the special keyword "key" is followed by a *key_name* ("species" or
|
where the special keyword "key" is followed by a *key_name* ("species"
|
||||||
"mass" in the above) and one or more key-value pairs. These key-value pairs
|
or "mass" in the above) and one or more key-value pairs. These
|
||||||
may continue until either another "key" keyword is given or the end of the
|
key-value pairs may continue until either another "key" keyword is given
|
||||||
command line is reached. Thus, the above could equivalently be written as
|
or the end of the line is reached. Thus, the above could equivalently
|
||||||
|
be written as
|
||||||
|
|
||||||
.. code-block:: LAMMPS
|
.. code-block:: LAMMPS
|
||||||
|
|
||||||
|
|||||||
@ -24,12 +24,12 @@ Description
|
|||||||
"""""""""""
|
"""""""""""
|
||||||
|
|
||||||
Label this line of the input script with the chosen ID. Unless a jump
|
Label this line of the input script with the chosen ID. Unless a jump
|
||||||
command was used previously, this does nothing. But if a
|
command was used previously, this does nothing. But if a :doc:`jump
|
||||||
:doc:`jump <jump>` command was used with a label argument to begin
|
<jump>` command was used with a label argument to begin invoking this
|
||||||
invoking this script file, then all command lines in the script prior
|
script file, then all commands in the script prior to this line will be
|
||||||
to this line will be ignored. I.e. execution of the script will begin
|
ignored. I.e. execution of the script will begin at this line. This is
|
||||||
at this line. This is useful for looping over a section of the input
|
useful for looping over a section of the input script as discussed in
|
||||||
script as discussed in the :doc:`jump <jump>` command.
|
the :doc:`jump <jump>` command.
|
||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user