Merge remote-tracking branch 'github/develop' into file-formats
This commit is contained in:
5
.github/CODEOWNERS
vendored
5
.github/CODEOWNERS
vendored
@ -72,6 +72,8 @@ src/EXTRA-COMMAND/ndx_group.* @akohlmey
|
||||
src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel
|
||||
src/EXTRA-COMPUTE/compute_born_matrix.* @Bibobu @athomps
|
||||
src/EXTRA-FIX/fix_deform_pressure.* @jtclemm
|
||||
src/EXTRA-PAIR/pair_dispersion_d3.* @soniasolomoni @arthurfl
|
||||
src/EXTRA-PAIR/d3_parameters.h @soniasolomoni @arthurfl
|
||||
src/MISC/*_tracker.* @jtclemm
|
||||
src/MC/fix_gcmc.* @athomps
|
||||
src/MC/fix_sgcmc.* @athomps
|
||||
@ -101,7 +103,8 @@ src/group.* @sjplimp
|
||||
src/improper.* @sjplimp
|
||||
src/info.* @akohlmey
|
||||
src/kspace.* @sjplimp
|
||||
src/lmptyp.h @sjplimp
|
||||
src/lmptype.h @sjplimp
|
||||
src/label_map.* @jrgissing @akohlmey
|
||||
src/library.* @sjplimp @akohlmey
|
||||
src/main.cpp @sjplimp
|
||||
src/min_*.* @sjplimp
|
||||
|
||||
370
.github/release_steps.md
vendored
Normal file
370
.github/release_steps.md
vendored
Normal file
@ -0,0 +1,370 @@
|
||||
# LAMMPS Release Steps
|
||||
|
||||
The following notes chronicle the current steps for preparing and
|
||||
publishing LAMMPS releases. For definitions of LAMMPS versions and
|
||||
releases, 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. 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. We currently use a mix of automated tests running on
|
||||
either Temple's Jenkins cluster or GitHub workflows. Those include time
|
||||
consuming tests not run on pull requests. If needed, a bug-fix 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 or update the 'develop' branch locally, pull the latest
|
||||
changes, merge them into 'release' with a fast forward(!) merge, and
|
||||
apply a suitable release tag (for historical reasons the tag starts with
|
||||
"patch_" followed by the date, and finally push everything back to
|
||||
GitHub. There should be no commits made to 'release' but only
|
||||
fast forward merges. Example:
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
git pull
|
||||
git checkout release
|
||||
git pull
|
||||
git merge --ff-only develop
|
||||
git tag -s -m "LAMMPS feature release 4 February 2025" patch_4Feb2025
|
||||
git push git@github.com:lammps/lammps.git --tags develop release
|
||||
```
|
||||
|
||||
Applying this tag will trigger two actions on the Temple Jenkins cluster:
|
||||
- The online manual at https://docs.lammps.org/ will be updated to the
|
||||
state of the 'release' branch. Merges to the 'develop' branch will
|
||||
trigger updating https://docs.lammps.org/latest/ so by reviewing the
|
||||
version of the manual under the "latest" URL, it is possible to preview
|
||||
what the updated release documentation will look like.
|
||||
- A downloadable tar archive of the LAMMPS distribution that includes the
|
||||
html format documentation and a PDF of the manual will be created and
|
||||
uploaded to the download server at https://download.lammps.org/tars
|
||||
Note that the file is added, but the `index.html` file is not updated,
|
||||
so it is not yet publicly visible.
|
||||
|
||||
Go to https://github.com/lammps/lammps/releases and create a new (draft)
|
||||
release page with a summary of all the changes included and references
|
||||
to the pull requests they were merged from 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" drop-down 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.
|
||||
|
||||
### Prepare pre-compiled packages, update packages to GitHub
|
||||
|
||||
A suitable build environment is provided with the
|
||||
https://download.lammps.org/static/fedora41_musl_mingw.sif container
|
||||
image. The corresponding container build definition file is maintained
|
||||
in the tools/singularity folder of the LAMMPS source distribution.
|
||||
|
||||
#### Fully portable static Linux x86_64 non-MPI binaries
|
||||
|
||||
The following commands use the Fedora container to build a fully static
|
||||
LAMMPS installation using a musl-libc cross-compiler, install it into a
|
||||
`lammps-static` folder, and create a tarball called
|
||||
`lammps-linux-x86_64-4Feb2025.tar.gz` (or using a corresponding date
|
||||
with a future release) from the `lammps-static` folder.
|
||||
|
||||
``` sh
|
||||
rm -rf release-packages
|
||||
mkdir release-packages
|
||||
cd release-packages
|
||||
wget https://download.lammps.org/static/fedora41_musl.sif
|
||||
apptainer shell fedora41_musl.sif
|
||||
git clone -b release --depth 10 https://github.com/lammps/lammps.git lammps-release
|
||||
cmake -S lammps-release/cmake -B build-release -G Ninja -D CMAKE_INSTALL_PREFIX=$PWD/lammps-static -D CMAKE_TOOLCHAIN_FILE=/usr/musl/share/cmake/linux-musl.cmake -C lammps-release/cmake/presets/most.cmake -C lammps-release/cmake/presets/kokkos-openmp.cmake -D DOWNLOAD_POTENTIALS=OFF -D BUILD_MPI=OFF -D BUILD_TESTING=OFF -D CMAKE_BUILD_TYPE=Release -D PKG_ATC=ON -D PKG_AWPMD=ON -D PKG_MANIFOLD=ON -D PKG_MESONT=ON -D PKG_MGPT=ON -D PKG_ML-PACE=ON -D PKG_ML-RANN=ON -D PKG_MOLFILE=ON -D PKG_PTM=ON -D PKG_QTB=ON -D PKG_SMTBQ=ON
|
||||
cmake --build build-release --target all
|
||||
cmake --build build-release --target install
|
||||
/usr/musl/bin/x86_64-linux-musl-strip lammps-static/bin/*
|
||||
tar -czvvf ../lammps-linux-x86_64-4Feb2025.tar.gz lammps-static
|
||||
exit # fedora 41 container
|
||||
cd ..
|
||||
```
|
||||
|
||||
The resulting tar archive can be uploaded to the GitHub release page with:
|
||||
|
||||
``` sh
|
||||
gh release upload patch_4Feb2025 lammps-linux-x86_64-4Feb2025.tar.gz
|
||||
```
|
||||
|
||||
#### Linux x86_64 Flatpak bundle with GUI included
|
||||
|
||||
Make sure you have the `flatpak` and `flatpak-builder` packages
|
||||
installed locally (they require binaries that run with elevated
|
||||
privileges and thus cannot be used from the container) and build a
|
||||
LAMMPS and LAMMPS-GUI flatpak bundle in the `release-packages` folder
|
||||
with:
|
||||
|
||||
``` sh
|
||||
cd release-packages
|
||||
flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak-builder --force-clean --verbose --repo=$PWD/flatpak-repo --install-deps-from=flathub --state-dir=$PWD --user --ccache --default-branch=release flatpak-build lammps-release/tools/lammps-gui/org.lammps.lammps-gui.yml
|
||||
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo --verbose $PWD/flatpak-repo ../LAMMPS-Linux-x86_64-GUI-4Feb2025.flatpak org.lammps.lammps-gui release
|
||||
cd ..
|
||||
```
|
||||
|
||||
The resulting flatpak bundle file can be uploaded to the GitHub release page with:
|
||||
|
||||
``` sh
|
||||
gh release upload patch_4Feb2025 LAMMPS-Linux-x86_64-GUI-4Feb2025.flatpak
|
||||
```
|
||||
|
||||
#### LAMMPS Source tarball
|
||||
|
||||
The container for the static binary can also be used to prepare the source
|
||||
tarball including the HTML and PDF manual (this is currently done automatically
|
||||
when the releases is created and the tarball uploaded to https://download.lammps.org/tars/).
|
||||
The steps are as follows:
|
||||
|
||||
``` sh
|
||||
cd release-packages
|
||||
apptainer shell fedora41_musl_mingw.sif
|
||||
cd lammps-release
|
||||
rm -f ../release.tar*
|
||||
git archive --output=../release.tar --prefix=lammps-4Feb2025/ HEAD
|
||||
cd doc
|
||||
make clean-all
|
||||
make html pdf
|
||||
tar -rf ../../release.tar --transform 's,^,lammps-4Feb2025/doc/,' html Manual.pdf
|
||||
gzip -9v ../../release.tar
|
||||
mv ../../release.tar.gz ../../lammps-src-4Feb2025.tar.gz
|
||||
exit # fedora41 container
|
||||
cd ..
|
||||
```
|
||||
|
||||
The resulting source tarball can be uploaded to the GitHub release page with:
|
||||
|
||||
``` sh
|
||||
gh release upload patch_4Feb2025 lammps-src-4Feb2025.tar.gz
|
||||
```
|
||||
|
||||
#### Build Windows Installer Packages with MinGW Linux-to-Windows Cross-compiler
|
||||
|
||||
The various Windows installer packages can also be built with
|
||||
apptainer container image.
|
||||
|
||||
``` sh
|
||||
cd release-packages
|
||||
apptainer shell fedora41_musl_mingw.sif
|
||||
git clone --depth 10 https://github.com/lammps/lammps-packages.git lammps-packages
|
||||
cd lammps-packages/mingw-cross
|
||||
ln -sf ../../lammps-release lammps
|
||||
./buildall.sh release >& mk.log & less +F mk.log
|
||||
```
|
||||
|
||||
The installer with the GUI included can be uploaded to the GitHub release page with:
|
||||
|
||||
``` sh
|
||||
ln -sf LAMMPS-64bit-GUI-4Feb2025.exe LAMMPS-Win10-64bit-GUI-4Feb2025.exe
|
||||
gh release upload patch_4Feb2025 LAMMPS-Win10-64bit-GUI-4Feb2025.exe
|
||||
```
|
||||
|
||||
The symbolic link is used to have a consistent naming scheme for the packages
|
||||
attached to the GitHub release page.
|
||||
|
||||
#### Clean up:
|
||||
|
||||
``` sh
|
||||
cd ..
|
||||
rm -r release-packages
|
||||
```
|
||||
|
||||
#### Build Multi-arch App-bundle for macOS
|
||||
|
||||
Building app-bundles for macOS is not as easily automated and portable
|
||||
as some of the other steps. It requires a machine actually running
|
||||
macOS. In that machine the Xcode compiler package needs to be
|
||||
installed. This also includes tools for building and manipulating disk
|
||||
images. This compiler supports building executables for both, the
|
||||
x86_64 and the arm64 architectures. This requires building with CMake
|
||||
and using the CMake settings:
|
||||
|
||||
``` sh
|
||||
-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64
|
||||
-D CMAKE_OSX_DEPLOYMENT_TARGET=11.0
|
||||
```
|
||||
|
||||
This will add the compiler flags `-arch arm64 -arch x86_64
|
||||
-mmacosx-version-min=11.0` and thus produce object for both
|
||||
architectures and support for macOS versions back to version 11 (aka Big
|
||||
Sur). With these settings the following libraries should be compiled
|
||||
and installed (e.g. to `$HOME/.local`) as static libraries only:
|
||||
- libomp taken from the LLVM/Clang source distribution (to support OpenMP)
|
||||
- jpeg
|
||||
- zlib
|
||||
- png
|
||||
- Qt (for LAMMPS-GUI)
|
||||
|
||||
When configuring LAMMPS the `cmake/presets/clang.cmake` should be used
|
||||
and as many packages as possible enabled. For LAMMPS-GUI, MPI should be
|
||||
disabled with `-D BUILD_MPI=OFF` and LAMMPS-GUI enabled with
|
||||
`-D BUILD_LAMMPS_GUI=ON`. If the CMake configuration is successful,
|
||||
settings for building a macOS app-bundle are enabled and with `cmake
|
||||
--build build --target dmg` extra steps will be executed that will build
|
||||
a macOS application installer image under the name
|
||||
`LAMMPS_GUI-macOS-multiarch-4Feb2025.dmg`
|
||||
|
||||
The application image can be uploaded to the GitHub release page with:
|
||||
|
||||
``` sh
|
||||
ln -sf LAMMPS_GUI-macOS-multiarch-4Feb2025.dmg LAMMPS-macOS-multiarch-GUI-4Feb2025.dmg
|
||||
gh release upload patch_4Feb2025 LAMMPS-macOS-multiarch-GUI-4Feb2025.dmg
|
||||
```
|
||||
|
||||
The symbolic link is used to have a consistent naming scheme for the packages
|
||||
attached to the GitHub release page.
|
||||
|
||||
We are currently building the application images on macOS 12 (aka Monterey).
|
||||
|
||||
#### Build Linux x86_64 binary tarball on Ubuntu 20.04LTS
|
||||
|
||||
While the flatpak Linux version uses portable runtime libraries provided
|
||||
by the flatpak environment, we also build regular Linux executables that
|
||||
use a wrapper script and matching shared libraries in a tarball. To be
|
||||
compatible with many Linux distributions, one has to build this on a
|
||||
very old Linux distribution, since most Linux system libraries are
|
||||
usually backward compatible but not forward compatible. This is
|
||||
currently done on an Ubuntu 20.04LTS system. Once LAMMPS moves to
|
||||
require CMake 3.20 and C++17, we will have to move to Ubuntu 22.04LTS.
|
||||
This installation (either on a real or a virtual machine) should have
|
||||
the packages installed that are indicated in
|
||||
`tools/singularity/ubuntu20.04.def` plus Qt version 5.x with development
|
||||
headers, so that LAMMPS-GUI can be compiled.
|
||||
|
||||
Also the building of the binary tarball and setup of the bundled
|
||||
libraries and wrapper scripts is automated and can executed with `cmake
|
||||
--build build --target tgz`. This should produce a file
|
||||
`LAMMPS_GUI-Linux-amd64-4Feb2025.tar.gz` which can be uploaded to the
|
||||
GitHub release page with:
|
||||
|
||||
``` sh
|
||||
ln -sf LAMMPS_GUI-Linux-amd64-4Feb2025.tar.gz LAMMPS-Linux-x86_64-GUI-4Feb2025.tar.gz
|
||||
gh release upload patch_4Feb2025 LAMMPS-Linux-x86_64-GUI-4Feb2025.tar.gz
|
||||
```
|
||||
|
||||
### Update download page on LAMMPS website
|
||||
|
||||
Check out the LAMMPS website repo
|
||||
https://github.com/lammps/lammps-website.git and edit the file
|
||||
`src/download.txt` for the new release. Test translation with `make
|
||||
html` and review `html/download.html` Then add and commit to git and
|
||||
push the changes to GitHub. The Temple Jenkis cluster will
|
||||
automatically update https://www.lammps.org/download.html accordingly.
|
||||
|
||||
Also notify Steve of the release so he can update `src/bug.txt` on the
|
||||
website from the available release notes.
|
||||
|
||||
## 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
|
||||
|
||||
After making a stable release, bugfixes from the 'develop' branch
|
||||
are selectively backported to the 'maintenance' branch. This is
|
||||
done with "git cherry-pick \<commit hash\>' wherever possible.
|
||||
The LAMMPS\_UPDATE define in "src/version.h" is set to "Maintenance".
|
||||
|
||||
### Prerequesites
|
||||
|
||||
When a sufficient number of bugfixes has accumulated or an urgent
|
||||
or important bugfix needs to be distributed a new stable update
|
||||
release is made. To make this publicly visible a pull request
|
||||
is submitted that will merge 'maintenance' into 'stable'. Before
|
||||
merging, set LAMMPS\_UPDATE in "src/version.h" to "Update #" with
|
||||
"#" indicating the update count (1, 2, and so on).
|
||||
Also draft suitable release notes under https://github.com/lammps/lammps/releases
|
||||
|
||||
### Fast-forward merge of 'maintenance' into 'stable', apply tag, and publish
|
||||
|
||||
Do a fast-forward merge of 'maintenance' to 'stable' and then
|
||||
apply the stable\_DMmmYYYY\_update# tag and push branch and tag
|
||||
to GitHub. The corresponding pull request will be automatically
|
||||
closed. Example:
|
||||
|
||||
```
|
||||
git checkout maintenance
|
||||
git pull
|
||||
git checkout stable
|
||||
git pull
|
||||
git merge --ff-only maintenance
|
||||
git tag -s -m 'Update 2 for Stable LAMMPS version 29 August 2024' stable_29Aug2024_update2
|
||||
git push git@github.com:lammps/lammps.git --tags maintenance stable
|
||||
```
|
||||
|
||||
Associate draft release notes with new tag and publish as "latest release".
|
||||
|
||||
On https://ci.lammps.org/ go to "dev", "stable" and manually execute
|
||||
the "update\_release" task. This will update https://docs.lammps.org/stable
|
||||
and prepare a stable tarball.
|
||||
|
||||
### Build and upload binary packages and source tarball to GitHub
|
||||
|
||||
The build procedure is the same as for the feature releases, only
|
||||
that packages are built from the 'stable' branch.
|
||||
92
.github/workflows/check-cpp23.yml
vendored
Normal file
92
.github/workflows/check-cpp23.yml
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
# GitHub action to build LAMMPS on Linux with gcc and C++23
|
||||
name: "Check for C++23 Compatibility"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build with C++23 support enabled
|
||||
if: ${{ github.repository == 'lammps/lammps' }}
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Install extra packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ccache \
|
||||
libeigen3-dev \
|
||||
libcurl4-openssl-dev \
|
||||
mold \
|
||||
mpi-default-bin \
|
||||
mpi-default-dev \
|
||||
ninja-build \
|
||||
python3-dev
|
||||
|
||||
- name: Create Build Environment
|
||||
run: mkdir build
|
||||
|
||||
- name: Set up ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: linux-cpp23-ccache-${{ github.sha }}
|
||||
restore-keys: linux-cpp23-ccache-
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
shell: bash
|
||||
run: |
|
||||
ccache -z
|
||||
python3 -m venv linuxenv
|
||||
source linuxenv/bin/activate
|
||||
python3 -m pip install numpy
|
||||
python3 -m pip install pyyaml
|
||||
cmake -S cmake -B build \
|
||||
-C cmake/presets/most.cmake \
|
||||
-C cmake/presets/kokkos-openmp.cmake \
|
||||
-D CMAKE_CXX_STANDARD=23 \
|
||||
-D CMAKE_CXX_COMPILER=g++ \
|
||||
-D CMAKE_C_COMPILER=gcc \
|
||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_BUILD_TYPE=Debug \
|
||||
-D CMAKE_CXX_FLAGS_DEBUG="-Og -g" \
|
||||
-D DOWNLOAD_POTENTIALS=off \
|
||||
-D BUILD_MPI=on \
|
||||
-D BUILD_SHARED_LIBS=on \
|
||||
-D BUILD_TOOLS=off \
|
||||
-D ENABLE_TESTING=off \
|
||||
-D MLIAP_ENABLE_ACE=on \
|
||||
-D MLIAP_ENABLE_PYTHON=off \
|
||||
-D PKG_AWPMD=on \
|
||||
-D PKG_GPU=on \
|
||||
-D GPU_API=opencl \
|
||||
-D PKG_KOKKOS=on \
|
||||
-D PKG_LATBOLTZ=on \
|
||||
-D PKG_MDI=on \
|
||||
-D PKG_MANIFOLD=on \
|
||||
-D PKG_ML-PACE=on \
|
||||
-D PKG_ML-RANN=off \
|
||||
-D PKG_MOLFILE=on \
|
||||
-D PKG_RHEO=on \
|
||||
-D PKG_PTM=on \
|
||||
-D PKG_PYTHON=on \
|
||||
-D PKG_QTB=on \
|
||||
-D PKG_SMTBQ=on \
|
||||
-G Ninja
|
||||
cmake --build build
|
||||
ccache -s
|
||||
2
.github/workflows/check-vla.yml
vendored
2
.github/workflows/check-vla.yml
vendored
@ -77,7 +77,7 @@ jobs:
|
||||
-D PKG_MDI=on \
|
||||
-D PKG_MANIFOLD=on \
|
||||
-D PKG_ML-PACE=on \
|
||||
-D PKG_ML-RANN=off \
|
||||
-D PKG_ML-RANN=on \
|
||||
-D PKG_MOLFILE=on \
|
||||
-D PKG_RHEO=on \
|
||||
-D PKG_PTM=on \
|
||||
|
||||
1
.github/workflows/coverity.yml
vendored
1
.github/workflows/coverity.yml
vendored
@ -67,7 +67,6 @@ jobs:
|
||||
-D PKG_MANIFOLD=on \
|
||||
-D PKG_MDI=on \
|
||||
-D PKG_MGPT=on \
|
||||
-D PKG_ML-PACE=on \
|
||||
-D PKG_ML-RANN=on \
|
||||
-D PKG_MOLFILE=on \
|
||||
-D PKG_NETCDF=on \
|
||||
|
||||
126
.github/workflows/kokkos-regression.yaml
vendored
Normal file
126
.github/workflows/kokkos-regression.yaml
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
# GitHub action to build LAMMPS on Linux and run selected regression tests
|
||||
name: "Kokkos OpenMP Regression Test"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build LAMMPS with Kokkos OpenMP
|
||||
# restrict to official LAMMPS repository
|
||||
if: ${{ github.repository == 'lammps/lammps' }}
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
strategy:
|
||||
max-parallel: 6
|
||||
matrix:
|
||||
idx: [ 'pair-0', 'pair-1', 'fix-0', 'fix-1', 'compute', 'misc' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
show-progress: false
|
||||
|
||||
- name: Install extra packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ccache ninja-build libeigen3-dev \
|
||||
libcurl4-openssl-dev python3-dev \
|
||||
mpi-default-bin mpi-default-dev
|
||||
|
||||
- name: Create Build Environment
|
||||
run: mkdir build
|
||||
|
||||
- name: Set up ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: linux-kokkos-ccache-${{ github.sha }}
|
||||
restore-keys: linux-kokkos-ccache-
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
shell: bash
|
||||
run: |
|
||||
ccache -z
|
||||
python3 -m venv linuxenv
|
||||
source linuxenv/bin/activate
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install numpy pyyaml junit_xml
|
||||
cmake -S cmake -B build \
|
||||
-C cmake/presets/gcc.cmake \
|
||||
-C cmake/presets/basic.cmake \
|
||||
-C cmake/presets/kokkos-openmp.cmake \
|
||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-D BUILD_SHARED_LIBS=off \
|
||||
-D DOWNLOAD_POTENTIALS=off \
|
||||
-D PKG_AMOEBA=on \
|
||||
-D PKG_ASPHERE=on \
|
||||
-D PKG_BROWNIAN=on \
|
||||
-D PKG_CLASS2=on \
|
||||
-D PKG_COLLOID=on \
|
||||
-D PKG_CORESHELL=on \
|
||||
-D PKG_DIPOLE=on \
|
||||
-D PKG_DPD-BASIC=on \
|
||||
-D PKG_EXTRA-COMPUTE=on \
|
||||
-D PKG_EXTRA-FIX=on \
|
||||
-D PKG_EXTRA-MOLECULE=on \
|
||||
-D PKG_EXTRA-PAIR=on \
|
||||
-D PKG_GRANULAR=on \
|
||||
-D PKG_LEPTON=on \
|
||||
-D PKG_MC=on \
|
||||
-D PKG_MEAM=on \
|
||||
-D PKG_POEMS=on \
|
||||
-D PKG_PYTHON=on \
|
||||
-D PKG_QEQ=on \
|
||||
-D PKG_REAXFF=on \
|
||||
-D PKG_REPLICA=on \
|
||||
-D PKG_SRD=on \
|
||||
-D PKG_SPH=on \
|
||||
-D PKG_VORONOI=on \
|
||||
-G Ninja
|
||||
cmake --build build
|
||||
ccache -s
|
||||
|
||||
- name: Run Regression Tests for Selected Examples
|
||||
shell: bash
|
||||
run: |
|
||||
source linuxenv/bin/activate
|
||||
python3 tools/regression-tests/get_kokkos_input.py \
|
||||
--examples-top-level=examples --batch-size=50 \
|
||||
--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 \
|
||||
--lmp-bin=build/lmp \
|
||||
--config-file=tools/regression-tests/config_kokkos_openmp.yaml \
|
||||
--list-input=input-list-${{ matrix.idx }}-kk.txt \
|
||||
--output-file=output-${{ matrix.idx }}.xml \
|
||||
--progress-file=progress-${{ matrix.idx }}.yaml \
|
||||
--log-file=run-${{ matrix.idx }}.log \
|
||||
--quick-max=100
|
||||
|
||||
tar -cvf kokkos-regression-test-${{ matrix.idx }}.tar run-${{ matrix.idx }}.log progress-${{ matrix.idx }}.yaml output-${{ matrix.idx }}.xml
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: kokkos-regression-test-artifact-${{ matrix.idx }}
|
||||
path: kokkos-regression-test-${{ matrix.idx }}.tar
|
||||
|
||||
merge:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Merge Artifacts
|
||||
uses: actions/upload-artifact/merge@v4
|
||||
with:
|
||||
name: merged-kokkos-regresssion-artifact
|
||||
pattern: kokkos-regression-test-artifact-*
|
||||
53
.github/workflows/lammps-gui-flatpak.yml
vendored
Normal file
53
.github/workflows/lammps-gui-flatpak.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# GitHub action to build LAMMPS-GUI as a flatpak bundle
|
||||
name: "Build LAMMPS-GUI as flatpak bundle"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{github.event_name == 'pull_request'}}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: LAMMPS-GUI flatpak build
|
||||
if: ${{ github.repository == 'lammps/lammps' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Install extra packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ccache \
|
||||
libeigen3-dev \
|
||||
libcurl4-openssl-dev \
|
||||
mold \
|
||||
ninja-build \
|
||||
python3-dev \
|
||||
flatpak \
|
||||
flatpak-builder
|
||||
|
||||
- name: Set up access to flatpak repo
|
||||
run: flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
- name: Build flatpak
|
||||
run: |
|
||||
mkdir flatpack-state
|
||||
sed -i -e 's/branch:.*/branch: develop/' tools/lammps-gui/org.lammps.lammps-gui.yml
|
||||
flatpak-builder --force-clean --verbose --repo=flatpak-repo \
|
||||
--install-deps-from=flathub --state-dir=flatpak-state \
|
||||
--user --ccache --default-branch=${{ github.ref_name }} \
|
||||
flatpak-build tools/lammps-gui/org.lammps.lammps-gui.yml
|
||||
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo \
|
||||
--verbose flatpak-repo LAMMPS-Linux-x86_64-GUI.flatpak \
|
||||
org.lammps.lammps-gui ${{ github.ref_name }}
|
||||
flatpak install -y -v --user LAMMPS-Linux-x86_64-GUI.flatpak
|
||||
1
.github/workflows/style-check.yml
vendored
1
.github/workflows/style-check.yml
vendored
@ -35,3 +35,4 @@ jobs:
|
||||
make check-permissions
|
||||
make check-homepage
|
||||
make check-errordocs
|
||||
make check-fmtlib
|
||||
|
||||
81
.github/workflows/unittest-arm64.yml
vendored
Normal file
81
.github/workflows/unittest-arm64.yml
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
# GitHub action to build LAMMPS on Linux with ARM64 and run standard unit tests
|
||||
name: "Unittest for Linux on ARM64"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{github.event_name == 'pull_request'}}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Linux ARM64 Unit Test
|
||||
if: ${{ github.repository == 'lammps/lammps' }}
|
||||
runs-on: ubuntu-22.04-arm
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Install extra packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ccache \
|
||||
libeigen3-dev \
|
||||
libcurl4-openssl-dev \
|
||||
mold \
|
||||
ninja-build \
|
||||
python3-dev
|
||||
|
||||
- name: Create Build Environment
|
||||
run: mkdir build
|
||||
|
||||
- name: Set up ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: linux-unit-ccache-${{ github.sha }}
|
||||
restore-keys: linux-unit-ccache-
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
shell: bash
|
||||
run: |
|
||||
ccache -z
|
||||
python3 -m venv linuxenv
|
||||
source linuxenv/bin/activate
|
||||
python3 -m pip install numpy
|
||||
python3 -m pip install pyyaml
|
||||
cmake -S cmake -B build \
|
||||
-C cmake/presets/gcc.cmake \
|
||||
-C cmake/presets/most.cmake \
|
||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-D BUILD_SHARED_LIBS=on \
|
||||
-D DOWNLOAD_POTENTIALS=off \
|
||||
-D ENABLE_TESTING=on \
|
||||
-D MLIAP_ENABLE_ACE=on \
|
||||
-D MLIAP_ENABLE_PYTHON=off \
|
||||
-D PKG_MANIFOLD=on \
|
||||
-D PKG_ML-PACE=on \
|
||||
-D PKG_ML-RANN=on \
|
||||
-D PKG_RHEO=on \
|
||||
-D PKG_PTM=on \
|
||||
-D PKG_PYTHON=on \
|
||||
-D PKG_QTB=on \
|
||||
-D PKG_SMTBQ=on \
|
||||
-G Ninja
|
||||
cmake --build build
|
||||
ccache -s
|
||||
|
||||
- name: Run Tests
|
||||
working-directory: build
|
||||
shell: bash
|
||||
run: ctest -V -LE unstable
|
||||
15
README
15
README
@ -23,17 +23,20 @@ more information about the code and its uses.
|
||||
The LAMMPS distribution includes the following files and directories:
|
||||
|
||||
README this file
|
||||
LICENSE the GNU General Public License (GPL)
|
||||
bench benchmark problems
|
||||
LICENSE the GNU General Public License (GPLv2)
|
||||
CITATION.cff Citation information for LAMMPS in CFF format
|
||||
bench benchmark inputs
|
||||
cmake CMake build files
|
||||
doc documentation
|
||||
examples simple test problems
|
||||
fortran Fortran wrapper for LAMMPS
|
||||
examples example inputs for many LAMMPS commands
|
||||
fortran Fortran 2003 module for LAMMPS
|
||||
lib additional provided or external libraries
|
||||
potentials interatomic potential files
|
||||
python Python wrappers for LAMMPS
|
||||
python Python module for LAMMPS
|
||||
src source files
|
||||
tools pre- and post-processing tools
|
||||
unittest test programs for use with CTest
|
||||
.github Git and GitHub related files and tools
|
||||
|
||||
Point your browser at any of these files to get started:
|
||||
|
||||
@ -42,6 +45,8 @@ https://docs.lammps.org/Intro.html hi-level introduction
|
||||
https://docs.lammps.org/Build.html how to build LAMMPS
|
||||
https://docs.lammps.org/Run_head.html how to run LAMMPS
|
||||
https://docs.lammps.org/Commands_all.html Table of available commands
|
||||
https://docs.lammps.org/Howto.html Short tutorials and HowTo discussions
|
||||
https://docs.lammps.org/Errors.html How to interpret and debug errors
|
||||
https://docs.lammps.org/Library.html LAMMPS library interfaces
|
||||
https://docs.lammps.org/Modify.html how to modify and extend LAMMPS
|
||||
https://docs.lammps.org/Developer.html LAMMPS developer info
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
# CMake build system
|
||||
# This file is part of LAMMPS
|
||||
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
|
||||
if(POLICY CMP0074)
|
||||
@ -118,7 +121,7 @@ endif()
|
||||
|
||||
# silence excessive warnings for new Intel Compilers
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
||||
set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare -Wno-unused-command-line-argument")
|
||||
set(CMAKE_TUNE_DEFAULT "-fp-model precise -Wno-tautological-constant-compare -Wno-unused-command-line-argument")
|
||||
endif()
|
||||
|
||||
# silence excessive warnings for PGI/NVHPC compilers
|
||||
@ -141,19 +144,31 @@ endif()
|
||||
|
||||
# silence nvcc warnings
|
||||
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")
|
||||
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT}" "-Xcudafe --diag_suppress=unrecognized_pragma,--diag_suppress=128")
|
||||
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)
|
||||
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()
|
||||
if(CMAKE_CXX_STANDARD LESS 11)
|
||||
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
||||
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))
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
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_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
||||
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
||||
@ -165,6 +180,7 @@ if(MSVC)
|
||||
add_compile_options(/wd4267)
|
||||
add_compile_options(/wd4250)
|
||||
add_compile_options(/EHsc)
|
||||
add_compile_options(/utf-8)
|
||||
endif()
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
@ -193,7 +209,7 @@ endif()
|
||||
########################################################################
|
||||
# User input options #
|
||||
########################################################################
|
||||
# backward compatibility with CMake before 3.12 and older LAMMPS documentation
|
||||
# backward compatibility with older LAMMPS documentation
|
||||
if (PYTHON_EXECUTABLE)
|
||||
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
||||
endif()
|
||||
@ -209,6 +225,12 @@ if(DEFINED ENV{VIRTUAL_ENV} AND NOT Python_EXECUTABLE)
|
||||
" Setting Python interpreter to: ${Python_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
find_package(Python COMPONENTS Interpreter QUIET)
|
||||
# NOTE: RHEL 8.0 and Ubuntu 18.04LTS ship with Python 3.6, Python 3.8 was EOL in 2024
|
||||
if(Python_VERSION VERSION_LESS 3.6)
|
||||
message(FATAL_ERROR "LAMMPS requires Python 3.6 or later")
|
||||
endif()
|
||||
|
||||
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
||||
mark_as_advanced(LAMMPS_MACHINE)
|
||||
if(LAMMPS_MACHINE)
|
||||
@ -346,6 +368,17 @@ foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||
option(PKG_${PKG} "Build ${PKG} Package" OFF)
|
||||
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
|
||||
######################################################
|
||||
@ -398,8 +431,8 @@ else()
|
||||
target_link_libraries(lammps PUBLIC mpi_stubs)
|
||||
endif()
|
||||
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||
set(LAMMPS_SIZES_VALUES smallbig bigbig)
|
||||
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
|
||||
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
|
||||
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
||||
@ -578,6 +611,16 @@ foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# settings for misc packages and styles
|
||||
if(PKG_MISC)
|
||||
option(LAMMPS_ASYNC_IMD "Asynchronous IMD processing" OFF)
|
||||
mark_as_advanced(LAMMPS_ASYNC_IMD)
|
||||
if(LAMMPS_ASYNC_IMD)
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_ASYNC_IMD)
|
||||
message(STATUS "Using IMD in asynchronous mode")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# optionally enable building script wrappers using swig
|
||||
option(WITH_SWIG "Build scripting language wrappers with SWIG" OFF)
|
||||
if(WITH_SWIG)
|
||||
@ -587,13 +630,8 @@ endif()
|
||||
|
||||
set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine specific optimization flags (compilation only)")
|
||||
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||
# 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()
|
||||
target_compile_options(lammps PRIVATE ${CMAKE_TUNE_FLAGS})
|
||||
target_compile_options(lmp PRIVATE ${CMAKE_TUNE_FLAGS})
|
||||
########################################################################
|
||||
# Basic system tests (standard libraries, headers, functions, types) #
|
||||
########################################################################
|
||||
@ -822,9 +860,15 @@ foreach(_DEF ${LAMMPS_DEFINES})
|
||||
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${_DEF}")
|
||||
endforeach()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS lammps EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS lammps EXPORT LAMMPS_Targets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
if(NOT BUILD_MPI)
|
||||
install(TARGETS mpi_stubs EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS mpi_stubs EXPORT LAMMPS_Targets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
@ -892,7 +936,7 @@ endif()
|
||||
include(Testing)
|
||||
include(CodeCoverage)
|
||||
include(CodingStandard)
|
||||
find_package(ClangFormat 11.0)
|
||||
find_package(ClangFormat 11.0 QUIET)
|
||||
|
||||
if(ClangFormat_FOUND)
|
||||
add_custom_target(format-src
|
||||
@ -1076,12 +1120,15 @@ if(BUILD_TOOLS)
|
||||
message(STATUS "<<< Building Tools >>>")
|
||||
endif()
|
||||
if(BUILD_LAMMPS_GUI)
|
||||
message(STATUS "<<< Building LAMMPS GUI >>>")
|
||||
message(STATUS "<<< Building LAMMPS-GUI >>>")
|
||||
if(LAMMPS_GUI_USE_PLUGIN)
|
||||
message(STATUS "Loading LAMMPS library as plugin at run time")
|
||||
else()
|
||||
message(STATUS "Linking LAMMPS library at compile time")
|
||||
endif()
|
||||
if(BUILD_WHAM)
|
||||
message(STATUS "<<< Building WHAM >>>")
|
||||
endif()
|
||||
endif()
|
||||
if(ENABLE_TESTING)
|
||||
message(STATUS "<<< Building Unit Tests >>>")
|
||||
|
||||
@ -7,76 +7,76 @@
|
||||
# For Python coverage the coverage package needs to be installed
|
||||
###############################################################################
|
||||
if(ENABLE_COVERAGE)
|
||||
find_program(GCOVR_BINARY gcovr)
|
||||
find_package_handle_standard_args(GCOVR DEFAULT_MSG GCOVR_BINARY)
|
||||
find_program(GCOVR_BINARY gcovr)
|
||||
find_package_handle_standard_args(GCOVR DEFAULT_MSG GCOVR_BINARY)
|
||||
|
||||
find_program(COVERAGE_BINARY coverage)
|
||||
find_package_handle_standard_args(COVERAGE DEFAULT_MSG COVERAGE_BINARY)
|
||||
find_program(COVERAGE_BINARY coverage)
|
||||
find_package_handle_standard_args(COVERAGE DEFAULT_MSG COVERAGE_BINARY)
|
||||
|
||||
if(GCOVR_FOUND)
|
||||
get_filename_component(ABSOLUTE_LAMMPS_SOURCE_DIR ${LAMMPS_SOURCE_DIR} ABSOLUTE)
|
||||
if(GCOVR_FOUND)
|
||||
get_filename_component(ABSOLUTE_LAMMPS_SOURCE_DIR ${LAMMPS_SOURCE_DIR} ABSOLUTE)
|
||||
|
||||
add_custom_target(
|
||||
gen_coverage_xml
|
||||
COMMAND ${GCOVR_BINARY} -s -x -r ${ABSOLUTE_LAMMPS_SOURCE_DIR} --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Generating XML coverage report..."
|
||||
)
|
||||
add_custom_target(
|
||||
gen_coverage_xml
|
||||
COMMAND ${GCOVR_BINARY} -s -x -r ${ABSOLUTE_LAMMPS_SOURCE_DIR} --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Generating XML coverage report..."
|
||||
)
|
||||
|
||||
set(COVERAGE_HTML_DIR ${CMAKE_BINARY_DIR}/coverage_html)
|
||||
set(COVERAGE_HTML_DIR ${CMAKE_BINARY_DIR}/coverage_html)
|
||||
|
||||
add_custom_target(coverage_html_folder
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_HTML_DIR})
|
||||
add_custom_target(coverage_html_folder
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_HTML_DIR})
|
||||
|
||||
add_custom_target(
|
||||
gen_coverage_html
|
||||
COMMAND ${GCOVR_BINARY} -s --html --html-details -r ${ABSOLUTE_LAMMPS_SOURCE_DIR} --object-directory=${CMAKE_BINARY_DIR} -o ${COVERAGE_HTML_DIR}/index.html
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Generating HTML coverage report..."
|
||||
)
|
||||
add_dependencies(gen_coverage_html coverage_html_folder)
|
||||
add_custom_target(
|
||||
gen_coverage_html
|
||||
COMMAND ${GCOVR_BINARY} -s --html --html-details -r ${ABSOLUTE_LAMMPS_SOURCE_DIR} --object-directory=${CMAKE_BINARY_DIR} -o ${COVERAGE_HTML_DIR}/index.html
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Generating HTML coverage report..."
|
||||
)
|
||||
add_dependencies(gen_coverage_html coverage_html_folder)
|
||||
|
||||
add_custom_target(clean_coverage_html
|
||||
${CMAKE_COMMAND} -E remove_directory ${COVERAGE_HTML_DIR}
|
||||
COMMENT "Deleting HTML coverage report..."
|
||||
)
|
||||
add_custom_target(clean_coverage_html
|
||||
${CMAKE_COMMAND} -E remove_directory ${COVERAGE_HTML_DIR}
|
||||
COMMENT "Deleting HTML coverage report..."
|
||||
)
|
||||
|
||||
add_custom_target(reset_coverage
|
||||
${CMAKE_COMMAND} -E remove -f */*.gcda */*/*.gcda */*/*/*.gcda
|
||||
*/*/*/*/*.gcda */*/*/*/*/*.gcda */*/*/*/*/*/*.gcda
|
||||
*/*/*/*/*/*/*/*.gcda */*/*/*/*/*/*/*/*.gcda
|
||||
*/*/*/*/*/*/*/*/*/*.gcda */*/*/*/*/*/*/*/*/*/*.gcda
|
||||
WORKIND_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Deleting coverage data files..."
|
||||
)
|
||||
add_dependencies(reset_coverage clean_coverage_html)
|
||||
endif()
|
||||
add_custom_target(reset_coverage
|
||||
${CMAKE_COMMAND} -E remove -f */*.gcda */*/*.gcda */*/*/*.gcda
|
||||
*/*/*/*/*.gcda */*/*/*/*/*.gcda */*/*/*/*/*/*.gcda
|
||||
*/*/*/*/*/*/*/*.gcda */*/*/*/*/*/*/*/*.gcda
|
||||
*/*/*/*/*/*/*/*/*/*.gcda */*/*/*/*/*/*/*/*/*/*.gcda
|
||||
WORKIND_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Deleting coverage data files..."
|
||||
)
|
||||
add_dependencies(reset_coverage clean_coverage_html)
|
||||
endif()
|
||||
|
||||
if(COVERAGE_FOUND)
|
||||
set(PYTHON_COVERAGE_HTML_DIR ${CMAKE_BINARY_DIR}/python_coverage_html)
|
||||
configure_file(.coveragerc.in ${CMAKE_BINARY_DIR}/.coveragerc @ONLY)
|
||||
if(COVERAGE_FOUND)
|
||||
set(PYTHON_COVERAGE_HTML_DIR ${CMAKE_BINARY_DIR}/python_coverage_html)
|
||||
configure_file(.coveragerc.in ${CMAKE_BINARY_DIR}/.coveragerc @ONLY)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/unittest/python/.coverage
|
||||
COMMAND ${COVERAGE_BINARY} combine
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Combine Python coverage files..."
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/unittest/python/.coverage
|
||||
COMMAND ${COVERAGE_BINARY} combine
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Combine Python coverage files..."
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
gen_python_coverage_html
|
||||
COMMAND ${COVERAGE_BINARY} html --rcfile=${CMAKE_BINARY_DIR}/.coveragerc -d ${PYTHON_COVERAGE_HTML_DIR}
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage ${CMAKE_BINARY_DIR}/.coveragerc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Generating HTML Python coverage report..."
|
||||
)
|
||||
add_custom_target(
|
||||
gen_python_coverage_html
|
||||
COMMAND ${COVERAGE_BINARY} html --rcfile=${CMAKE_BINARY_DIR}/.coveragerc -d ${PYTHON_COVERAGE_HTML_DIR}
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage ${CMAKE_BINARY_DIR}/.coveragerc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Generating HTML Python coverage report..."
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
gen_python_coverage_xml
|
||||
COMMAND ${COVERAGE_BINARY} xml --rcfile=${CMAKE_BINARY_DIR}/.coveragerc -o ${CMAKE_BINARY_DIR}/python_coverage.xml
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage ${CMAKE_BINARY_DIR}/.coveragerc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Generating XML Python coverage report..."
|
||||
)
|
||||
endif()
|
||||
add_custom_target(
|
||||
gen_python_coverage_xml
|
||||
COMMAND ${COVERAGE_BINARY} xml --rcfile=${CMAKE_BINARY_DIR}/.coveragerc -o ${CMAKE_BINARY_DIR}/python_coverage.xml
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage ${CMAKE_BINARY_DIR}/.coveragerc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Generating XML Python coverage report..."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -1,40 +1,39 @@
|
||||
# use default (or custom) Python executable, if version is sufficient
|
||||
if(Python_VERSION VERSION_GREATER_EQUAL 3.6)
|
||||
# use default (or custom) Python executable.
|
||||
# Python version check is in main CMakeLists.txt file
|
||||
if(Python_EXECUTABLE)
|
||||
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
||||
endif()
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
|
||||
if(Python3_EXECUTABLE)
|
||||
if(Python3_VERSION VERSION_GREATER_EQUAL 3.6)
|
||||
add_custom_target(
|
||||
check-whitespace
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Check for whitespace errors")
|
||||
add_custom_target(
|
||||
check-homepage
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Check for homepage URL errors")
|
||||
add_custom_target(
|
||||
check-permissions
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Check for permission errors")
|
||||
add_custom_target(
|
||||
fix-whitespace
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Fix whitespace errors")
|
||||
add_custom_target(
|
||||
fix-homepage
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py -f .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Fix homepage URL errors")
|
||||
add_custom_target(
|
||||
fix-permissions
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py -f .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Fix permission errors")
|
||||
endif()
|
||||
add_custom_target(
|
||||
check-whitespace
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Check for whitespace errors")
|
||||
add_custom_target(
|
||||
check-homepage
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Check for homepage URL errors")
|
||||
add_custom_target(
|
||||
check-permissions
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Check for permission errors")
|
||||
add_custom_target(
|
||||
fix-whitespace
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Fix whitespace errors")
|
||||
add_custom_target(
|
||||
fix-homepage
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py -f .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Fix homepage URL errors")
|
||||
add_custom_target(
|
||||
fix-permissions
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py -f .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Fix permission errors")
|
||||
endif()
|
||||
|
||||
@ -13,7 +13,7 @@ if(BUILD_DOC)
|
||||
endif()
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
if(Python3_VERSION VERSION_LESS 3.8)
|
||||
message(FATAL_ERROR "Python 3.8 and up is required to build the HTML documentation")
|
||||
message(FATAL_ERROR "Python 3.8 and up is required to build the LAMMPS HTML documentation")
|
||||
endif()
|
||||
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
||||
|
||||
@ -65,8 +65,8 @@ if(BUILD_DOC)
|
||||
find_package(Sphinx)
|
||||
endif()
|
||||
|
||||
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
|
||||
set(MATHJAX_MD5 "b81661c6e6ba06278e6ae37b30b0c492" CACHE STRING "MD5 checksum of MathJax tarball")
|
||||
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.2.2.tar.gz" CACHE STRING "URL for MathJax tarball")
|
||||
set(MATHJAX_MD5 "08dd6ef33ca08870220d9aade2a62845" CACHE STRING "MD5 checksum of MathJax tarball")
|
||||
mark_as_advanced(MATHJAX_URL)
|
||||
GetFallbackURL(MATHJAX_URL MATHJAX_FALLBACK)
|
||||
|
||||
@ -110,6 +110,7 @@ if(BUILD_DOC)
|
||||
add_custom_command(
|
||||
OUTPUT html
|
||||
DEPENDS ${DOC_SOURCES} ${DOCENV_DEPS} ${DOXYGEN_XML_DIR}/index.xml ${BUILD_DOC_CONFIG_FILE}
|
||||
COMMAND ${Python3_EXECUTABLE} ${LAMMPS_DOC_DIR}/utils/make-globbed-tocs.py -d ${LAMMPS_DOC_DIR}/src
|
||||
COMMAND Sphinx::sphinx-build ${SPHINX_EXTRA_OPTS} -b html -c ${DOC_BUILD_DIR} -d ${DOC_BUILD_DIR}/doctrees ${LAMMPS_DOC_DIR}/src ${DOC_BUILD_DIR}/html
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink Manual.html ${DOC_BUILD_DIR}/html/index.html
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DOC_DIR}/src/PDF ${DOC_BUILD_DIR}/html/PDF
|
||||
|
||||
@ -21,9 +21,9 @@ if(VORO_FOUND)
|
||||
set(VORO_LIBRARIES ${VORO_LIBRARY})
|
||||
set(VORO_INCLUDE_DIRS ${VORO_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET VORO::VORO)
|
||||
add_library(VORO::VORO UNKNOWN IMPORTED)
|
||||
set_target_properties(VORO::VORO PROPERTIES
|
||||
if(NOT TARGET VORO::voro++)
|
||||
add_library(VORO::voro++ UNKNOWN IMPORTED)
|
||||
set_target_properties(VORO::voro++ PROPERTIES
|
||||
IMPORTED_LOCATION "${VORO_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${VORO_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
@ -34,8 +34,26 @@ if(MSVC)
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# C++11 is required
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
if(cxx_std_17 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_CXX_STANDARD LESS 11)
|
||||
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
||||
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))
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
# turn off C++17 check in lmptype.h
|
||||
if(LAMMPS_CXX11)
|
||||
add_compile_definitions(LAMMPS_CXX11)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Need -restrict with Intel compilers
|
||||
@ -242,8 +260,8 @@ endif()
|
||||
|
||||
################
|
||||
# integer size selection
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||
set(LAMMPS_SIZES_VALUES smallbig bigbig)
|
||||
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
|
||||
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
|
||||
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
||||
|
||||
@ -3,7 +3,7 @@ enable_language(C)
|
||||
# we don't use the parallel i/o interface.
|
||||
set(HDF5_PREFER_PARALLEL FALSE)
|
||||
|
||||
find_package(HDF5 REQUIRED)
|
||||
find_package(HDF5 COMPONENTS C REQUIRED)
|
||||
|
||||
# parallel HDF5 will import incompatible MPI headers with a serial build
|
||||
if((NOT BUILD_MPI) AND HDF5_IS_PARALLEL)
|
||||
|
||||
@ -72,6 +72,10 @@ if(INTEL_ARCH STREQUAL "KNL")
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
message(FATAL_ERROR "Must use Intel compiler with INTEL for KNL architecture")
|
||||
endif()
|
||||
message(WARNING, "Support for Intel Xeon Phi accelerators and Knight's Landing CPUs "
|
||||
"will be removed from LAMMPS in Summer 2025 due to lack of available machines "
|
||||
"in labs and HPC centers and removed support in recent compilers "
|
||||
"Please contact developers@lammps.org if you have any concerns about this step.")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload")
|
||||
set(MIC_OPTIONS "-qoffload-option,mic,compiler,\"-fp-model fast=2 -mGLOB_default_function_attrs=\\\"gather_scatter_loop_unroll=4\\\"\"")
|
||||
target_compile_options(lammps PRIVATE -xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
|
||||
|
||||
@ -7,10 +7,13 @@ endif()
|
||||
|
||||
########################################################################
|
||||
# consistency checks and Kokkos options/settings required by LAMMPS
|
||||
if(Kokkos_ENABLE_CUDA)
|
||||
message(STATUS "KOKKOS: Enabling CUDA LAMBDA function support")
|
||||
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "" FORCE)
|
||||
if(Kokkos_ENABLE_HIP)
|
||||
option(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS "Enable multiple kernel instantiations with HIP" ON)
|
||||
mark_as_advanced(Kokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS)
|
||||
option(Kokkos_ENABLE_ROCTHRUST "Use RoCThrust library" ON)
|
||||
mark_as_advanced(Kokkos_ENABLE_ROCTHRUST)
|
||||
endif()
|
||||
|
||||
# Adding OpenMP compiler flags without the checks done for
|
||||
# BUILD_OMP can result in compile failures. Enforce consistency.
|
||||
if(Kokkos_ENABLE_OPENMP)
|
||||
@ -18,6 +21,15 @@ if(Kokkos_ENABLE_OPENMP)
|
||||
message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(Kokkos_ENABLE_SERIAL)
|
||||
if(NOT (Kokkos_ENABLE_OPENMP OR Kokkos_ENABLE_THREADS OR
|
||||
Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_HIP OR Kokkos_ENABLE_SYCL
|
||||
OR Kokkos_ENABLE_OPENMPTARGET))
|
||||
option(Kokkos_ENABLE_ATOMICS_BYPASS "Disable atomics for Kokkos Serial Backend" ON)
|
||||
mark_as_advanced(Kokkos_ENABLE_ATOMICS_BYPASS)
|
||||
endif()
|
||||
endif()
|
||||
########################################################################
|
||||
|
||||
option(EXTERNAL_KOKKOS "Build against external kokkos library" OFF)
|
||||
@ -45,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_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||
include(ExternalProject)
|
||||
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/4.3.01.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
||||
set(KOKKOS_MD5 "243de871b3dc2cf3990c1c404032df83" CACHE STRING "MD5 checksum of 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 "4d832aa0284169d9e3fbae3165286bc6" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||
mark_as_advanced(KOKKOS_URL)
|
||||
mark_as_advanced(KOKKOS_MD5)
|
||||
GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK)
|
||||
@ -71,7 +83,7 @@ if(DOWNLOAD_KOKKOS)
|
||||
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
|
||||
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
|
||||
elseif(EXTERNAL_KOKKOS)
|
||||
find_package(Kokkos 4.3.01 REQUIRED CONFIG)
|
||||
find_package(Kokkos 4.5.01 REQUIRED CONFIG)
|
||||
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
||||
else()
|
||||
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
||||
|
||||
@ -24,9 +24,7 @@ if(MLIAP_ENABLE_PYTHON)
|
||||
if(NOT PKG_PYTHON)
|
||||
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
||||
endif()
|
||||
if(Python_VERSION VERSION_LESS 3.6)
|
||||
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
||||
endif()
|
||||
# Python version check is in main CMakeLists.txt file
|
||||
|
||||
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
||||
file(GLOB MLIAP_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/ML-IAP/*.pyx)
|
||||
|
||||
@ -1,50 +1,62 @@
|
||||
# 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(POLICY CMP0135)
|
||||
cmake_policy(SET CMP0135 OLD)
|
||||
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}")
|
||||
if(pace_FOUND)
|
||||
find_package(pace)
|
||||
target_link_libraries(lammps PRIVATE pace::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)
|
||||
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
|
||||
if(POLICY CMP0135)
|
||||
cmake_policy(SET CMP0135 OLD)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
||||
endif()
|
||||
|
||||
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")
|
||||
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
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-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)
|
||||
# uncompress downloaded sources
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
||||
endif()
|
||||
|
||||
# some preinstalled yaml-cpp versions don't provide a namespaced target
|
||||
find_package(yaml-cpp QUIET)
|
||||
if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
|
||||
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
|
||||
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()
|
||||
|
||||
@ -37,7 +37,7 @@ if(DOWNLOAD_QUIP)
|
||||
endforeach()
|
||||
# Fix cmake crashing when MATH_LINKOPTS not set, required for e.g. recent Cray Programming Environment
|
||||
set(temp "${temp} -L/_DUMMY_PATH_\n")
|
||||
set(temp "${temp}PYTHON=python\nPIP=pip\nEXTRA_LINKOPTS=\n")
|
||||
set(temp "${temp}PYTHON=${Python_EXECUTABLE}\nPIP=pip\nEXTRA_LINKOPTS=\n")
|
||||
set(temp "${temp}HAVE_CP2K=0\nHAVE_VASP=0\nHAVE_TB=0\nHAVE_PRECON=1\nHAVE_LOTF=0\nHAVE_ONIOM=0\n")
|
||||
set(temp "${temp}HAVE_LOCAL_E_MIX=0\nHAVE_QC=0\nHAVE_GAP=1\nHAVE_DESCRIPTORS_NONCOMMERCIAL=1\n")
|
||||
set(temp "${temp}HAVE_TURBOGAP=0\nHAVE_QR=1\nHAVE_THIRDPARTY=0\nHAVE_FX=0\nHAVE_SCME=0\nHAVE_MTP=0\n")
|
||||
|
||||
@ -32,14 +32,21 @@ endif()
|
||||
|
||||
# Note: must also adjust check for supported API versions in
|
||||
# fix_plumed.cpp when version changes from v2.n.x to v2.n+1.y
|
||||
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.9.2/plumed-src-2.9.2.tgz"
|
||||
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.9.3/plumed-src-2.9.3.tgz"
|
||||
CACHE STRING "URL for PLUMED tarball")
|
||||
set(PLUMED_MD5 "04862602a372c1013bdfee2d6d03bace" CACHE STRING "MD5 checksum of PLUMED tarball")
|
||||
set(PLUMED_MD5 "ee1249805fe94bccee17d10610d3f6f1" CACHE STRING "MD5 checksum of PLUMED tarball")
|
||||
|
||||
mark_as_advanced(PLUMED_URL)
|
||||
mark_as_advanced(PLUMED_MD5)
|
||||
GetFallbackURL(PLUMED_URL PLUMED_FALLBACK)
|
||||
|
||||
# adjust C++ standard support for self-compiled Plumed2
|
||||
if(CMAKE_CXX_STANDARD GREATER 11)
|
||||
set(PLUMED_CXX_STANDARD 14)
|
||||
else()
|
||||
set(PLUMED_CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND (CMAKE_CROSSCOMPILING))
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(CROSS_CONFIGURE mingw64-configure)
|
||||
@ -55,7 +62,7 @@ if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND (CMAKE_CROSSCOMPILING))
|
||||
URL_MD5 ${PLUMED_MD5}
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ${CROSS_CONFIGURE} --disable-shared --disable-bsymbolic
|
||||
--disable-python --enable-cxx=11
|
||||
--disable-python --enable-cxx=${PLUMED_CXX_STANDARD}
|
||||
--enable-modules=-adjmat:+crystallization:-dimred:+drr:+eds:-fisst:+funnel:+logmfd:+manyrestraints:+maze:+opes:+multicolvar:-pamm:-piv:+s2cm:-sasa:-ves
|
||||
${PLUMED_CONFIG_OMP}
|
||||
${PLUMED_CONFIG_MPI}
|
||||
@ -142,7 +149,7 @@ else()
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
${CONFIGURE_REQUEST_PIC}
|
||||
--enable-modules=all
|
||||
--enable-cxx=11
|
||||
--enable-cxx=${PLUMED_CXX_STANDARD}
|
||||
--disable-python
|
||||
${PLUMED_CONFIG_MPI}
|
||||
${PLUMED_CONFIG_OMP}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
if(NOT Python_INTERPRETER)
|
||||
# backward compatibility with CMake before 3.12 and older LAMMPS documentation
|
||||
# backward compatibility with older LAMMPS documentation
|
||||
if(PYTHON_EXECUTABLE)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
|
||||
@ -54,5 +54,5 @@ else()
|
||||
if(NOT VORO_FOUND)
|
||||
message(FATAL_ERROR "Voro++ library not found. Help CMake to find it by setting VORO_LIBRARY and VORO_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it")
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE VORO::VORO)
|
||||
target_link_libraries(lammps PRIVATE VORO::voro++)
|
||||
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)
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_VTK)
|
||||
if (VTK_MAJOR_VERSION VERSION_LESS 9.0)
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
# preset that enables KOKKOS and selects CUDA compilation with OpenMP
|
||||
# enabled as well. This preselects CC 5.0 as default GPU arch, since
|
||||
# that is compatible with all higher CC, but not the default CC 3.5
|
||||
# enabled as well. The GPU architecture *must* match your hardware
|
||||
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
||||
|
||||
@ -6,13 +6,24 @@ set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SYCL ON CACHE BOOL "" FORCE)
|
||||
|
||||
set(FFT "MKL" CACHE STRING "" FORCE)
|
||||
set(FFT_KOKKOS "MKL_GPU" CACHE STRING "" FORCE)
|
||||
|
||||
unset(USE_INTERNAL_LINALG)
|
||||
unset(USE_INTERNAL_LINALG CACHE)
|
||||
set(BLAS_VENDOR "Intel10_64_dyn")
|
||||
|
||||
# hide deprecation warnings temporarily for stable release
|
||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
set(CMAKE_CXX_COMPILER icpx CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER icx CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER "" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
|
||||
# Silence everything
|
||||
set(CMAKE_CXX_FLAGS "-w" CACHE STRING "" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-fsycl -flink-huge-device-code -fsycl-max-parallel-link-jobs=32 -fsycl-targets=spir64_gen -Xsycl-target-backend \"-device 12.60.7\" " CACHE STRING "" FORCE)
|
||||
set(CMAKE_TUNE_FLAGS "-O3 -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=spir64_gen" CACHE STRING "" FORCE)
|
||||
#set(CMAKE_EXE_LINKER_FLAGS "-fsycl -flink-huge-device-code -fsycl-targets=spir64_gen " CACHE STRING "" FORCE)
|
||||
#set(CMAKE_TUNE_FLAGS "-O3 -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=spir64_gen" CACHE STRING "" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-fsycl -flink-huge-device-code " CACHE STRING "" FORCE)
|
||||
set(CMAKE_TUNE_FLAGS "-O3 -fsycl -fsycl-device-code-split=per_kernel " CACHE STRING "" FORCE)
|
||||
|
||||
@ -3,26 +3,9 @@
|
||||
set(CMAKE_CXX_COMPILER "icpx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "icx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER "ifx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
|
||||
set(MPI_CXX "icpx" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(OpenMP_C "icx" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX "icpx" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_Fortran_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
||||
# force using internal BLAS/LAPCK since external ones may not be ABI compatible
|
||||
set(USE_INTERNAL_LINALG ON CACHE BOOL "" FORCE)
|
||||
|
||||
|
||||
7
doc/.gitignore
vendored
7
doc/.gitignore
vendored
@ -17,3 +17,10 @@
|
||||
*.el
|
||||
/utils/sphinx-config/_static/mathjax
|
||||
/utils/sphinx-config/_static/polyfill.js
|
||||
/src/pairs.rst
|
||||
/src/bonds.rst
|
||||
/src/angles.rst
|
||||
/src/dihedrals.rst
|
||||
/src/impropers.rst
|
||||
/src/computes.rst
|
||||
/src/fixes.rst
|
||||
|
||||
54
doc/Makefile
54
doc/Makefile
@ -17,9 +17,11 @@ MATHJAXTAG = 3.2.2
|
||||
|
||||
PYTHON = $(word 3,$(shell type python3))
|
||||
DOXYGEN = $(word 3,$(shell type doxygen))
|
||||
PANDOC = $(word 3,$(shell type pandoc))
|
||||
HAS_PYTHON3 = NO
|
||||
HAS_DOXYGEN = NO
|
||||
HAS_PDFLATEX = NO
|
||||
HAS_PANDOC = NO
|
||||
|
||||
ifeq ($(shell type python3 >/dev/null 2>&1; echo $$?), 0)
|
||||
HAS_PYTHON3 = YES
|
||||
@ -31,10 +33,14 @@ endif
|
||||
|
||||
ifeq ($(shell type pdflatex >/dev/null 2>&1; echo $$?), 0)
|
||||
ifeq ($(shell type latexmk >/dev/null 2>&1; echo $$?), 0)
|
||||
HAS_PDFLATEX = YES
|
||||
HAS_PDFLATEX = YES
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(shell type pandoc >/dev/null 2>&1; echo $$?), 0)
|
||||
HAS_PANDOC = YES
|
||||
endif
|
||||
|
||||
# override settings for PIP commands
|
||||
# PIP_OPTIONS = --cert /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt --proxy http://proxy.mydomain.org
|
||||
|
||||
@ -45,8 +51,9 @@ SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocess
|
||||
# we only want to use explicitly listed files.
|
||||
DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//')
|
||||
|
||||
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check role_check xmlgen fasthtml
|
||||
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check role_check xmlgen fasthtml fasthtml-init
|
||||
|
||||
FASTHTMLFILES = $(patsubst $(RSTDIR)/%.rst,fasthtml/%.html,$(wildcard $(RSTDIR)/*rst))
|
||||
# ------------------------------------------
|
||||
|
||||
help:
|
||||
@ -83,7 +90,10 @@ $(SPHINXCONFIG)/conf.py: $(SPHINXCONFIG)/conf.py.in
|
||||
-e 's,@LAMMPS_PYTHON_DIR@,$(BUILDDIR)/../python,g' \
|
||||
-e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@
|
||||
|
||||
html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
||||
globbed-tocs:
|
||||
$(PYTHON) $(BUILDDIR)/utils/make-globbed-tocs.py -d $(RSTDIR)
|
||||
|
||||
html: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||
@(\
|
||||
@ -113,26 +123,24 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
||||
@rm -rf html/PDF/.[sg]*
|
||||
@echo "Build finished. The HTML pages are in doc/html."
|
||||
|
||||
fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||
@mkdir -p fasthtml
|
||||
@(\
|
||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
||||
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
||||
deactivate ;\
|
||||
)
|
||||
@rm -rf fasthtml/_sources
|
||||
@rm -rf fasthtml/PDF
|
||||
@rm -rf fasthtml/USER
|
||||
@rm -rf fasthtml/JPG
|
||||
@cp -r src/PDF fasthtml/PDF
|
||||
@rm -rf fasthtml/PDF/.[sg]*
|
||||
fasthtml: fasthtml-init $(FASTHTMLFILES)
|
||||
@echo "Fast HTML build finished. The HTML pages are in doc/fasthtml."
|
||||
|
||||
spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
||||
fasthtml-init:
|
||||
@mkdir -p fasthtml/JPG
|
||||
@cp src/JPG/*.* fasthtml/JPG
|
||||
@cp $(RSTDIR)/accel_styles.rst $(RSTDIR)/lepton_expression.rst fasthtml/
|
||||
@cp $(BUILDDIR)/utils/pandoc.css fasthtml/
|
||||
|
||||
fasthtml/%.html: $(RSTDIR)/%.rst
|
||||
@if [ "$(HAS_PANDOC)" == "NO" ] ; then echo "Make 'fasthtml' requires the 'pandoc' software" 1>&2; exit 1; fi
|
||||
@mkdir -p fasthtml
|
||||
@echo converting $< to $@
|
||||
@sed -e 's/\\AA/\\mathring{\\mathrm{A}}/g' $< > fasthtml/$*.temp.rst
|
||||
@pandoc -s --mathml --css="pandoc.css" --template=$(BUILDDIR)/utils/pandoc.html --metadata title="$@" -o $@ fasthtml/$*.temp.rst
|
||||
@rm -f fasthtml/$*.temp.rst
|
||||
|
||||
spelling: xmlgen globbed-tocs $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@(\
|
||||
. $(VENV)/bin/activate ; \
|
||||
@ -143,7 +151,7 @@ spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives
|
||||
)
|
||||
@echo "Spell check finished."
|
||||
|
||||
epub: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
epub: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||
@mkdir -p epub/JPG
|
||||
@ -166,7 +174,7 @@ mobi: epub
|
||||
@ebook-convert LAMMPS.epub LAMMPS.mobi
|
||||
@echo "Conversion finished. The MOBI manual file is created."
|
||||
|
||||
pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
pdf: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi
|
||||
|
||||
20
doc/README
20
doc/README
@ -22,12 +22,12 @@ doxygen-warn.log logfile with warnings from running doxygen
|
||||
and:
|
||||
|
||||
github-development-workflow.md notes on the LAMMPS development workflow
|
||||
include-file-conventions.md notes on LAMMPS' include file conventions
|
||||
documentation_conventions.md notes on writing documentation for LAMMPS
|
||||
|
||||
If you downloaded a LAMMPS tarball from www.lammps.org, then the html
|
||||
folder and the PDF manual should be included. If you downloaded LAMMPS
|
||||
from GitHub then you either need to build them.
|
||||
using GitHub then you either need to build them yourself or read the
|
||||
online version at https://docs.lammps.org/
|
||||
|
||||
You can build the HTML and PDF files yourself, by typing "make html"
|
||||
or by "make pdf", respectively. This requires various tools and files.
|
||||
@ -39,10 +39,10 @@ environment and local folders.
|
||||
|
||||
Installing prerequisites for the documentation build
|
||||
|
||||
To run the HTML documention build toolchain, python 3.x, doxygen, git,
|
||||
and the venv python module have to be installed if not already available.
|
||||
Also internet access is initially required to download external files
|
||||
and tools.
|
||||
To run the HTML documention build toolchain, python 3.8 or later,
|
||||
doxygen 1.8.10 or later, git, and the venv python module have to be
|
||||
installed if not already available. Also internet access is initially
|
||||
required to download external files and tools.
|
||||
|
||||
Building the PDF format manual requires in addition a compatible LaTeX
|
||||
installation with support for PDFLaTeX and several add-on LaTeX packages
|
||||
@ -52,16 +52,24 @@ installed. This includes:
|
||||
- babel
|
||||
- capt-of
|
||||
- cmap
|
||||
- dvipng
|
||||
- ellipse
|
||||
- fncychap
|
||||
- fontawesom
|
||||
- framed
|
||||
- geometry
|
||||
- gyre
|
||||
- hyperref
|
||||
- hypcap
|
||||
- needspace
|
||||
- pict2e
|
||||
- times
|
||||
- tabulary
|
||||
- titlesec
|
||||
- upquote
|
||||
- wrapfig
|
||||
- xindy
|
||||
|
||||
Also the latexmk script is required to run PDFLaTeX and related tools.
|
||||
the required number of times to have self-consistent output and include
|
||||
updated bibliography and indices.
|
||||
|
||||
@ -10,7 +10,7 @@ Last change: 2022-12-30
|
||||
|
||||
In fall 2019, the LAMMPS documentation file format has changed from a
|
||||
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
|
||||
converted to .rst and then processed. The `txt2rst tool` is still
|
||||
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
|
||||
|
||||
For headlines we try to follow the conventions posted here:
|
||||
https://documentation-style-guide-sphinx.readthedocs.io/en/latest/style-guide.html#headings
|
||||
For headlines we try to follow the conventions posted [here](https://documentation-style-guide-sphinx.readthedocs.io/en/latest/style-guide.html#headings).
|
||||
It seems to be sufficient to have this consistent only within
|
||||
any single file and it is not (yet) enforced strictly, but making
|
||||
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
|
||||
highlighting extension for LAMMPS input scripts is provided, so `LAMMPS`
|
||||
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
|
||||
no syntax style is indicated, no syntax highlighting is performed. When
|
||||
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
|
||||
outputs, the `.. tabs::` directive is transparently removed and
|
||||
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.
|
||||
|
||||
Special remarks can be highlighted with a `.. note::` block and
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
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_LOGO = lammps-logo.png
|
||||
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
|
||||
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
|
||||
adapt it accordingly. Last change 2023-02-10.
|
||||
adapt it accordingly.
|
||||
|
||||
Last change: 2023-02-10
|
||||
|
||||
## 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:
|
||||
|
||||
* 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
|
||||
handle matches a file pattern in the `.github/CODEOWNERS` file,
|
||||
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
|
||||
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
|
||||
feature, that reviews from code owners are "hard" reviews (i.e. they
|
||||
must all approve before merging is allowed), is currently disabled.
|
||||
It is in the discretion of the merge maintainer to assess when a
|
||||
feature that reviews from code owners are "hard" reviews (i.e. they
|
||||
must all approve before merging is allowed) is currently disabled.
|
||||
It is at the discretion of the merge maintainer to assess when a
|
||||
sufficient degree of approval has been reached, especially from external
|
||||
collaborators. Reviews may be (automatically) dismissed, when the
|
||||
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
|
||||
infrastructure updates are back-ported from the "develop" branch to the
|
||||
"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
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
.TH LAMMPS "1" "29 August 2024" "2024-08-29"
|
||||
.TH LAMMPS "1" "4 February 2025" "2025-02-04"
|
||||
.SH NAME
|
||||
.B LAMMPS
|
||||
\- Molecular Dynamics Simulator. Version 29 August 2024
|
||||
\- Molecular Dynamics Simulator. Version 4 February 2025
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B lmp
|
||||
@ -311,7 +311,7 @@ the chapter on errors in the
|
||||
manual gives some additional information about error messages, if possible.
|
||||
|
||||
.SH COPYRIGHT
|
||||
© 2003--2024 Sandia Corporation
|
||||
© 2003--2025 Sandia Corporation
|
||||
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2 as
|
||||
|
||||
@ -1,15 +1,42 @@
|
||||
Build LAMMPS
|
||||
============
|
||||
|
||||
LAMMPS is built as a library and an executable from source code using
|
||||
either traditional makefiles for use with GNU make (which may require
|
||||
manual editing), or using a build environment generated by CMake (Unix
|
||||
Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more).
|
||||
LAMMPS is built as a library and an executable from source code using a
|
||||
build environment generated by CMake (Unix Makefiles, Ninja, Xcode,
|
||||
Visual Studio, KDevelop, CodeBlocks and more depending on the platform).
|
||||
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
|
||||
or automated build trees, as described in the :doc:`Install <Install>`
|
||||
section of the manual.
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
Which software you need to compile and use LAMMPS strongly depends on
|
||||
which :doc:`features and settings <Build_settings>` and which
|
||||
:doc:`optional packages <Packages_list>` you are trying to include.
|
||||
Common to all is that you need a C++ and C compiler, where the C++
|
||||
compiler has to support at least the C++11 standard (note that some
|
||||
compilers require command-line flag to activate C++11 support).
|
||||
Furthermore, if you are building with CMake, you need at least CMake
|
||||
version 3.20 and a compatible build tool (make or ninja-build); if you
|
||||
are building the the legacy GNU make based build system you need GNU
|
||||
make (other make variants are not going to work since the build system
|
||||
uses features unique to GNU make) and a Unix-like build environment with
|
||||
a Bourne shell, and shell tools like "sed", "grep", "touch", "test",
|
||||
"tr", "cp", "mv", "rm", "ln", "diff" and so on. Parts of LAMMPS
|
||||
interface with or use Python version 3.6 or later.
|
||||
|
||||
The LAMMPS developers aim to keep LAMMPS very portable and usable -
|
||||
at least in parts - on most operating systems commonly used for
|
||||
running MD simulations. Please see the :doc:`section on portablility
|
||||
<Intro_portability>` for more details.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
|
||||
@ -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
|
||||
because of your compiler requiring strict OpenMP 4.0 semantics, you can
|
||||
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
|
||||
for most GNU, Clang, and Intel compilers.
|
||||
|
||||
@ -196,13 +196,18 @@ LAMMPS.
|
||||
|
||||
.. tab:: CMake build
|
||||
|
||||
By default CMake will use the compiler it finds according to
|
||||
By default CMake will use the compiler it finds according to its
|
||||
internal preferences, and it will add optimization flags
|
||||
appropriate to that compiler and any :doc:`accelerator packages
|
||||
<Speed_packages>` you have included in the build. CMake will
|
||||
check if the detected or selected compiler is compatible with the
|
||||
C++ support requirements of LAMMPS and stop with an error, if this
|
||||
is not the case.
|
||||
is not the case. A C++11 compatible compiler is currently
|
||||
required, but a transition to require C++17 is in progress and
|
||||
planned to be completed in Summer 2025. Currently, setting
|
||||
``-DLAMMPS_CXX11=yes`` is required when configuring with CMake while
|
||||
using a C++11 compatible compiler that does not support C++17,
|
||||
otherwise setting ``-DCMAKE_CXX_STANDARD=17`` is preferred.
|
||||
|
||||
You can tell CMake to look for a specific compiler with setting
|
||||
CMake variables (listed below) during configuration. For a few
|
||||
@ -223,6 +228,8 @@ LAMMPS.
|
||||
-D CMAKE_C_COMPILER=name # name of C compiler
|
||||
-D CMAKE_Fortran_COMPILER=name # name of Fortran compiler
|
||||
|
||||
-D CMAKE_CXX_STANDARD=17 # put compiler in C++17 mode
|
||||
-D LAMMPS_CXX11=yes # enforce compilation in C++11 mode
|
||||
-D CMAKE_CXX_FLAGS=string # flags to use with C++ compiler
|
||||
-D CMAKE_C_FLAGS=string # flags to use with C compiler
|
||||
-D CMAKE_Fortran_FLAGS=string # flags to use with Fortran compiler
|
||||
@ -321,15 +328,23 @@ LAMMPS.
|
||||
you would have to install a newer compiler that supports C++11;
|
||||
either as a binary package or through compiling from source.
|
||||
|
||||
If you build LAMMPS with any :doc:`Speed_packages` included,
|
||||
there may be specific compiler or linker flags that are either
|
||||
required or recommended to enable required features and to
|
||||
achieve optimal performance. You need to include these in the
|
||||
``CCFLAGS`` and ``LINKFLAGS`` settings above. For details, see the
|
||||
documentation for the individual packages listed on the
|
||||
:doc:`Speed_packages` page. Or examine these files in the
|
||||
``src/MAKE/OPTIONS`` directory. They correspond to each of the 5
|
||||
accelerator packages and their hardware variants:
|
||||
While a C++11 compatible compiler is currently sufficient to compile
|
||||
LAMMPS, a transition to require C++17 is in progress and planned to
|
||||
be completed in Summer 2025. Currently, setting ``-DLAMMPS_CXX11``
|
||||
in the ``LMP_INC =`` line in the machine makefile is required when
|
||||
using a C++11 compatible compiler that does not support C++17.
|
||||
Otherwise, to enable C++17 support (if not enabled by default) using
|
||||
a compiler flag like ``-std=c++17`` in CCFLAGS may needed.
|
||||
|
||||
If you build LAMMPS with any :doc:`Speed_packages` included,
|
||||
there may be specific compiler or linker flags that are either
|
||||
required or recommended to enable required features and to
|
||||
achieve optimal performance. You need to include these in the
|
||||
``CCFLAGS`` and ``LINKFLAGS`` settings above. For details, see the
|
||||
documentation for the individual packages listed on the
|
||||
:doc:`Speed_packages` page. Or examine these files in the
|
||||
``src/MAKE/OPTIONS`` directory. They correspond to each of the 5
|
||||
accelerator packages and their hardware variants:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -502,6 +517,8 @@ using CMake or Make.
|
||||
# chain.x, micelle2d.x, msi2lmp, phana,
|
||||
# stl_bin2txt
|
||||
-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
|
||||
(see below).
|
||||
|
||||
@ -8,7 +8,7 @@ packages. Links to those pages on the :doc:`Build overview <Build>`
|
||||
page.
|
||||
|
||||
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
|
||||
itself, the text mode or graphical user interface, to change the
|
||||
generated output files for different build tools and development
|
||||
@ -16,7 +16,7 @@ environments is on a :doc:`separate page <Howto_cmake>`.
|
||||
|
||||
.. 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::
|
||||
|
||||
@ -32,29 +32,29 @@ environments is on a :doc:`separate page <Howto_cmake>`.
|
||||
Advantages of using CMake
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
CMake is an alternative to compiling LAMMPS in the traditional way
|
||||
through :doc:`(manually customized) makefiles <Build_make>`. Using
|
||||
CMake has multiple advantages that are specifically helpful for
|
||||
people with limited experience in compiling software or for people
|
||||
that want to modify or extend LAMMPS.
|
||||
CMake is the preferred way of compiling LAMMPS in contrast to the legacy
|
||||
build system based on GNU make and through :doc:`(manually customized)
|
||||
makefiles <Build_make>`. Using CMake has multiple advantages that are
|
||||
specifically helpful for people with limited experience in compiling
|
||||
software or for people that want to modify or extend LAMMPS.
|
||||
|
||||
- CMake can detect available hardware, tools, features, and libraries
|
||||
and adapt the LAMMPS default build configuration accordingly.
|
||||
- CMake can generate files for different build tools and integrated
|
||||
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,
|
||||
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.
|
||||
- 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
|
||||
compilers can be configured and built concurrently from the same
|
||||
source tree.
|
||||
- Simplified packaging of LAMMPS for Linux distributions, environment
|
||||
modules, or automated build tools like `Homebrew <https://brew.sh/>`_.
|
||||
- Integration of automated unit and regression testing (the LAMMPS side
|
||||
of this is still under active development).
|
||||
modules, or automated build tools like `Spack <https://spack.io>`_
|
||||
or `Homebrew <https://brew.sh/>`_.
|
||||
- Integration of automated unit and regression testing.
|
||||
|
||||
.. _cmake_build:
|
||||
|
||||
@ -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
|
||||
second step is then the compilation and linking of all objects,
|
||||
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:
|
||||
|
||||
.. code-block:: bash
|
||||
@ -119,6 +119,13 @@ configured) and additional files like LAMMPS API headers, manpages,
|
||||
potential and force field files. The location of the installation tree
|
||||
defaults to ``${HOME}/.local``.
|
||||
|
||||
.. note::
|
||||
|
||||
If you have set `-D CMAKE_INSTALL_PREFIX` to install LAMMPS into a
|
||||
system location on a Linux machine , you may also have to run (as
|
||||
root) the `ldconfig` program to update the cache file for fast lookup
|
||||
of system shared libraries.
|
||||
|
||||
.. _cmake_options:
|
||||
|
||||
Configuration and build options
|
||||
@ -131,7 +138,7 @@ file called ``CMakeLists.txt`` (for LAMMPS it is located in the
|
||||
configuration step. The cache file contains all current CMake settings.
|
||||
|
||||
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
|
||||
user interface. The ``-D`` flag can be used several times in one command.
|
||||
|
||||
@ -141,11 +148,11 @@ a different compiler tool chain. Those are loaded with the ``-C`` flag
|
||||
(``-C ../cmake/presets/basic.cmake``). This step would only be needed
|
||||
once, as the settings from the preset files are stored in the
|
||||
``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
|
||||
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``.
|
||||
|
||||
.. _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
|
||||
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
|
||||
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
|
||||
tests are special tests programs using the `GoogleTest framework
|
||||
<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
|
||||
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,
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
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``.
|
||||
This is extremely convenient when working with a Git repository hosted
|
||||
on GitHub (like LAMMPS). It is thus highly recommended to install it
|
||||
|
||||
@ -48,6 +48,7 @@ This is the list of packages that may require additional steps.
|
||||
* :ref:`LEPTON <lepton>`
|
||||
* :ref:`MACHDYN <machdyn>`
|
||||
* :ref:`MDI <mdi>`
|
||||
* :ref:`MISC <misc>`
|
||||
* :ref:`ML-HDNNP <ml-hdnnp>`
|
||||
* :ref:`ML-IAP <mliap>`
|
||||
* :ref:`ML-PACE <ml-pace>`
|
||||
@ -209,7 +210,7 @@ necessary for ``hipcc`` and the linker to work correctly.
|
||||
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
|
||||
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
|
||||
option in preparations to run on Aurora system at Argonne.
|
||||
|
||||
@ -232,7 +233,7 @@ option in preparations to run on Aurora system at Argonne.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
# CUDA target (not recommended, use GPU_ARCH=cuda)
|
||||
# CUDA target (not recommended, use GPU_API=cuda)
|
||||
# !!! DO NOT set CMAKE_CXX_COMPILER !!!
|
||||
export HIP_PLATFORM=nvcc
|
||||
export HIP_PATH=/path/to/HIP/install
|
||||
@ -254,11 +255,10 @@ Traditional make
|
||||
|
||||
Before building LAMMPS, you must build the GPU library in ``lib/gpu``\ .
|
||||
You can do this manually if you prefer; follow the instructions in
|
||||
``lib/gpu/README``. Note that the GPU library uses MPI calls, so you must
|
||||
use the same MPI library (or the STUBS library) settings as the main
|
||||
LAMMPS code. This also applies to the ``-DLAMMPS_BIGBIG``\ ,
|
||||
``-DLAMMPS_SMALLBIG``\ , or ``-DLAMMPS_SMALLSMALL`` settings in whichever
|
||||
Makefile you use.
|
||||
``lib/gpu/README``. Note that the GPU library uses MPI calls, so you
|
||||
must use the same MPI library (or the STUBS library) settings as the
|
||||
main LAMMPS code. This also applies to the ``-DLAMMPS_BIGBIG`` or
|
||||
``-DLAMMPS_SMALLBIG`` settings in whichever Makefile you use.
|
||||
|
||||
You can also build the library in one step from the ``lammps/src`` dir,
|
||||
using a command like these, which simply invokes the ``lib/gpu/Install.py``
|
||||
@ -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`` environment variable if the cmake executable is named other
|
||||
than ``cmake`` on your system. Additional environment variables may be
|
||||
provided on the command line for use by cmake. For example, to use the
|
||||
``cmake3`` executable and tell it to use the gnu version 11 compilers
|
||||
to build KIM, one could use the following command line.
|
||||
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
|
||||
called ``g++-11``, ``gcc-11`` and ``gfortran-11`` to build KIM, one
|
||||
could use the following command.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -546,16 +547,7 @@ They must be specified in uppercase.
|
||||
- Local machine
|
||||
* - AMDAVX
|
||||
- HOST
|
||||
- AMD 64-bit x86 CPU (AVX 1)
|
||||
* - ZEN
|
||||
- HOST
|
||||
- AMD Zen class CPU (AVX 2)
|
||||
* - ZEN2
|
||||
- HOST
|
||||
- AMD Zen2 class CPU (AVX 2)
|
||||
* - ZEN3
|
||||
- HOST
|
||||
- AMD Zen3 class CPU (AVX 2)
|
||||
- AMD chip
|
||||
* - ARMV80
|
||||
- HOST
|
||||
- ARMv8.0 Compatible CPU
|
||||
@ -571,105 +563,126 @@ They must be specified in uppercase.
|
||||
* - A64FX
|
||||
- HOST
|
||||
- ARMv8.2 with SVE Support
|
||||
* - ARMV9_GRACE
|
||||
- HOST
|
||||
- ARMv9 NVIDIA Grace CPU
|
||||
* - SNB
|
||||
- HOST
|
||||
- Intel Sandy/Ivy Bridge CPU (AVX 1)
|
||||
- Intel Sandy/Ivy Bridge CPUs
|
||||
* - HSW
|
||||
- HOST
|
||||
- Intel Haswell CPU (AVX 2)
|
||||
- Intel Haswell CPUs
|
||||
* - BDW
|
||||
- HOST
|
||||
- Intel Broadwell Xeon E-class CPU (AVX 2 + transactional mem)
|
||||
* - SKL
|
||||
- HOST
|
||||
- Intel Skylake Client CPU
|
||||
* - SKX
|
||||
- HOST
|
||||
- Intel Skylake Xeon Server CPU (AVX512)
|
||||
- Intel Broadwell Xeon E-class CPUs
|
||||
* - ICL
|
||||
- HOST
|
||||
- Intel Ice Lake Client CPU (AVX512)
|
||||
- Intel Ice Lake Client CPUs (AVX512)
|
||||
* - ICX
|
||||
- HOST
|
||||
- Intel Ice Lake Xeon Server CPU (AVX512)
|
||||
* - SPR
|
||||
- Intel Ice Lake Xeon Server CPUs (AVX512)
|
||||
* - SKL
|
||||
- HOST
|
||||
- Intel Sapphire Rapids Xeon Server CPU (AVX512)
|
||||
- Intel Skylake Client CPUs
|
||||
* - SKX
|
||||
- HOST
|
||||
- Intel Skylake Xeon Server CPUs (AVX512)
|
||||
* - KNC
|
||||
- HOST
|
||||
- Intel Knights Corner Xeon Phi
|
||||
* - KNL
|
||||
- HOST
|
||||
- Intel Knights Landing Xeon Phi
|
||||
* - SPR
|
||||
- HOST
|
||||
- Intel Sapphire Rapids Xeon Server CPUs (AVX512)
|
||||
* - POWER8
|
||||
- HOST
|
||||
- IBM POWER8 CPU
|
||||
- IBM POWER8 CPUs
|
||||
* - POWER9
|
||||
- HOST
|
||||
- IBM POWER9 CPU
|
||||
- IBM POWER9 CPUs
|
||||
* - ZEN
|
||||
- HOST
|
||||
- AMD Zen architecture
|
||||
* - ZEN2
|
||||
- HOST
|
||||
- AMD Zen2 architecture
|
||||
* - ZEN3
|
||||
- HOST
|
||||
- AMD Zen3 architecture
|
||||
* - RISCV_SG2042
|
||||
- HOST
|
||||
- SG2042 (RISC-V) CPU
|
||||
- SG2042 (RISC-V) CPUs
|
||||
* - RISCV_RVA22V
|
||||
- HOST
|
||||
- RVA22V (RISC-V) CPUs
|
||||
* - KEPLER30
|
||||
- GPU
|
||||
- NVIDIA Kepler generation CC 3.0 GPU
|
||||
- NVIDIA Kepler generation CC 3.0
|
||||
* - KEPLER32
|
||||
- GPU
|
||||
- NVIDIA Kepler generation CC 3.2 GPU
|
||||
- NVIDIA Kepler generation CC 3.2
|
||||
* - KEPLER35
|
||||
- GPU
|
||||
- NVIDIA Kepler generation CC 3.5 GPU
|
||||
- NVIDIA Kepler generation CC 3.5
|
||||
* - KEPLER37
|
||||
- GPU
|
||||
- NVIDIA Kepler generation CC 3.7 GPU
|
||||
- NVIDIA Kepler generation CC 3.7
|
||||
* - MAXWELL50
|
||||
- GPU
|
||||
- NVIDIA Maxwell generation CC 5.0 GPU
|
||||
- NVIDIA Maxwell generation CC 5.0
|
||||
* - MAXWELL52
|
||||
- GPU
|
||||
- NVIDIA Maxwell generation CC 5.2 GPU
|
||||
- NVIDIA Maxwell generation CC 5.2
|
||||
* - MAXWELL53
|
||||
- GPU
|
||||
- NVIDIA Maxwell generation CC 5.3 GPU
|
||||
- NVIDIA Maxwell generation CC 5.3
|
||||
* - PASCAL60
|
||||
- GPU
|
||||
- NVIDIA Pascal generation CC 6.0 GPU
|
||||
- NVIDIA Pascal generation CC 6.0
|
||||
* - PASCAL61
|
||||
- GPU
|
||||
- NVIDIA Pascal generation CC 6.1 GPU
|
||||
- NVIDIA Pascal generation CC 6.1
|
||||
* - VOLTA70
|
||||
- GPU
|
||||
- NVIDIA Volta generation CC 7.0 GPU
|
||||
- NVIDIA Volta generation CC 7.0
|
||||
* - VOLTA72
|
||||
- GPU
|
||||
- NVIDIA Volta generation CC 7.2 GPU
|
||||
- NVIDIA Volta generation CC 7.2
|
||||
* - TURING75
|
||||
- GPU
|
||||
- NVIDIA Turing generation CC 7.5 GPU
|
||||
- NVIDIA Turing generation CC 7.5
|
||||
* - AMPERE80
|
||||
- GPU
|
||||
- NVIDIA Ampere generation CC 8.0 GPU
|
||||
- NVIDIA Ampere generation CC 8.0
|
||||
* - AMPERE86
|
||||
- GPU
|
||||
- NVIDIA Ampere generation CC 8.6 GPU
|
||||
- NVIDIA Ampere generation CC 8.6
|
||||
* - ADA89
|
||||
- GPU
|
||||
- NVIDIA Ada Lovelace generation CC 8.9 GPU
|
||||
- NVIDIA Ada generation CC 8.9
|
||||
* - HOPPER90
|
||||
- GPU
|
||||
- NVIDIA Hopper generation CC 9.0 GPU
|
||||
- NVIDIA Hopper generation CC 9.0
|
||||
* - AMD_GFX906
|
||||
- GPU
|
||||
- AMD GPU MI50/MI60
|
||||
- AMD GPU MI50/60
|
||||
* - AMD_GFX908
|
||||
- GPU
|
||||
- AMD GPU MI100
|
||||
* - AMD_GFX90A
|
||||
- GPU
|
||||
- AMD GPU MI200
|
||||
* - AMD_GFX940
|
||||
- GPU
|
||||
- AMD GPU MI300
|
||||
* - AMD_GFX942
|
||||
- GPU
|
||||
- AMD GPU MI300
|
||||
* - AMD_GFX942_APU
|
||||
- GPU
|
||||
- AMD APU MI300A
|
||||
* - AMD_GFX1030
|
||||
- GPU
|
||||
- AMD GPU V620/W6800
|
||||
@ -678,7 +691,7 @@ They must be specified in uppercase.
|
||||
- AMD GPU RX7900XTX
|
||||
* - AMD_GFX1103
|
||||
- GPU
|
||||
- AMD Phoenix APU with Radeon 740M/760M/780M/880M/890M
|
||||
- AMD APU Phoenix
|
||||
* - INTEL_GEN
|
||||
- GPU
|
||||
- SPIR64-based devices, e.g. Intel GPUs, using JIT
|
||||
@ -701,7 +714,7 @@ They must be specified in uppercase.
|
||||
- GPU
|
||||
- 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::
|
||||
|
||||
@ -1125,11 +1138,10 @@ POEMS package
|
||||
PYTHON package
|
||||
---------------------------
|
||||
|
||||
Building with the PYTHON package requires you have a the Python development
|
||||
headers and library available on your system, which needs to be a Python 2.7
|
||||
version or a Python 3.x version. Since support for Python 2.x has ended,
|
||||
using Python 3.x is strongly recommended. See ``lib/python/README`` for
|
||||
additional details.
|
||||
Building with the PYTHON package requires you have a the Python
|
||||
development headers and library available on your system, which
|
||||
needs to be Python version 3.6 or later. See ``lib/python/README``
|
||||
for additional details.
|
||||
|
||||
.. tabs::
|
||||
|
||||
@ -1145,7 +1157,7 @@ additional details.
|
||||
set the Python_EXECUTABLE variable to specify which Python
|
||||
interpreter should be used. Note note that you will also need to
|
||||
have the development headers installed for this version,
|
||||
e.g. python2-devel.
|
||||
e.g. python3-devel.
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
@ -2018,7 +2030,7 @@ TBB and MKL.
|
||||
.. _mdi:
|
||||
|
||||
MDI package
|
||||
-----------------------------
|
||||
-----------
|
||||
|
||||
.. tabs::
|
||||
|
||||
@ -2045,6 +2057,37 @@ MDI package
|
||||
|
||||
----------
|
||||
|
||||
.. _misc:
|
||||
|
||||
MISC package
|
||||
------------
|
||||
|
||||
The :doc:`fix imd <fix_imd>` style in this package can be run either
|
||||
synchronously (communication with IMD clients is done in the main
|
||||
process) or asynchronously (the fix spawns a separate thread that can
|
||||
communicate with IMD clients concurrently to the LAMMPS execution).
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. tab:: CMake build
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
-D LAMMPS_ASYNC_IMD=value # Run IMD server asynchronously
|
||||
# value = no (default) or yes
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
To enable asynchronous mode the ``-DLAMMPS_ASYNC_IMD`` define
|
||||
needs to be added to the ``LMP_INC`` variable in the
|
||||
``Makefile.machine`` you are using. For example:
|
||||
|
||||
.. code-block:: make
|
||||
|
||||
LMP_INC = -DLAMMPS_ASYNC_IMD -DLAMMPS_MEMALIGN=64
|
||||
|
||||
----------
|
||||
|
||||
.. _molfile:
|
||||
|
||||
MOLFILE package
|
||||
@ -2191,7 +2234,7 @@ verified to work in February 2020 with Quantum Espresso versions 6.3 to
|
||||
from the sources in the *lib* folder (including the essential
|
||||
libqmmm.a) are not included in the static LAMMPS library and
|
||||
(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:
|
||||
|
||||
.. 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
|
||||
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
|
||||
^^^^^^^^^^^^
|
||||
|
||||
@ -26,9 +30,9 @@ additional tools to be available and functioning.
|
||||
* A Bourne shell compatible "Unix" shell program (frequently this is ``bash``)
|
||||
* A few shell utilities: ``ls``, ``mv``, ``ln``, ``rm``, ``grep``, ``sed``, ``tr``, ``cat``, ``touch``, ``diff``, ``dirname``
|
||||
* Python (optional, required for ``make lib-<pkg>`` in the ``src``
|
||||
folder). Python scripts are currently tested with python 2.7 and
|
||||
3.6 to 3.11. The procedure for :doc:`building the documentation
|
||||
<Build_manual>` *requires* Python 3.5 or later.
|
||||
folder). Python scripts are currently tested with 3.6 to 3.11.
|
||||
The procedure for :doc:`building the documentation <Build_manual>`
|
||||
*requires* Python 3.8 or later.
|
||||
|
||||
Getting started
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
@ -78,8 +78,7 @@ folder. The following ``make`` commands are available:
|
||||
make epub # generate LAMMPS.epub in ePUB format using Sphinx
|
||||
make mobi # generate LAMMPS.mobi in MOBI format using ebook-convert
|
||||
|
||||
make fasthtml # generate approximate HTML in fasthtml dir using Sphinx
|
||||
# some Sphinx extensions do not work correctly with this
|
||||
make fasthtml # generate approximate HTML in fasthtml dir using pandoc
|
||||
|
||||
make clean # remove intermediate RST files created by HTML build
|
||||
make clean-all # remove entire build folder and any cached data
|
||||
@ -116,9 +115,9 @@ environment variable.
|
||||
Prerequisites for HTML
|
||||
----------------------
|
||||
|
||||
To run the HTML documentation build toolchain, python 3, git, doxygen,
|
||||
and virtualenv have to be installed locally. Here are instructions for
|
||||
common setups:
|
||||
To run the HTML documentation build toolchain, Python 3.8 or later, git,
|
||||
doxygen, and virtualenv have to be installed locally. Here are
|
||||
instructions for common setups:
|
||||
|
||||
.. tabs::
|
||||
|
||||
@ -128,13 +127,7 @@ common setups:
|
||||
|
||||
sudo apt-get install git doxygen
|
||||
|
||||
.. tab:: RHEL or CentOS (Version 7.x)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo yum install git doxygen
|
||||
|
||||
.. tab:: Fedora or RHEL/CentOS (8.x or later)
|
||||
.. tab:: Fedora or RHEL/AlmaLinux/RockyLinux (8.x or later)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -154,7 +147,36 @@ Prerequisites for PDF
|
||||
|
||||
In addition to the tools needed for building the HTML format manual,
|
||||
a working LaTeX installation with support for PDFLaTeX and a selection
|
||||
of LaTeX styles/packages are required. To run the PDFLaTeX translation
|
||||
of LaTeX styles/packages are required. Apart from LaTeX packages that
|
||||
are usually installed by default, the following packages are required:
|
||||
|
||||
.. table_from_list::
|
||||
:columns: 11
|
||||
|
||||
- amsmath
|
||||
- anysize
|
||||
- babel
|
||||
- capt-of
|
||||
- cmap
|
||||
- dvipng
|
||||
- ellipse
|
||||
- fncychap
|
||||
- fontawesome
|
||||
- framed
|
||||
- geometry
|
||||
- gyre
|
||||
- hyperref
|
||||
- hypcap
|
||||
- needspace
|
||||
- pict2e
|
||||
- times
|
||||
- tabulary
|
||||
- titlesec
|
||||
- upquote
|
||||
- wrapfig
|
||||
- xindy
|
||||
|
||||
To run the PDFLaTeX translation
|
||||
the ``latexmk`` script needs to be installed as well.
|
||||
|
||||
Prerequisites for ePUB and MOBI
|
||||
@ -182,12 +204,42 @@ documentation is required and either existing files in the ``src``
|
||||
folder need to be updated or new files added. These files are written in
|
||||
`reStructuredText <rst_>`_ markup for translation with the Sphinx tool.
|
||||
|
||||
Testing your contribution
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Before contributing any documentation, please check that both the HTML
|
||||
and the PDF format documentation can translate without errors. During
|
||||
testing the html translation, you may use the ``make fasthtml`` command
|
||||
which does an approximate translation (i.e. not all Sphinx features and
|
||||
extensions will work), but runs very fast because it will only translate
|
||||
files that have been changed since the last ``make fasthtml`` command.
|
||||
and the PDF format documentation can translate without errors and that
|
||||
there are no spelling issues. This is done with ``make html``, ``make pdf``,
|
||||
and ``make spelling``, respectively.
|
||||
|
||||
Fast and approximate translation to HTML
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Translating the full manual to HTML or PDF can take a long time. Thus
|
||||
there is a fast and approximate way to translate the reStructuredText to
|
||||
HTML as a quick-n-dirty way of checking your manual page.
|
||||
|
||||
This translation uses `Pandoc <https://pandoc.org>`_ instead of Sphinx
|
||||
and thus all special Sphinx features (cross-references, advanced tables,
|
||||
embedding of Python docstrings or doxygen documentation, and so on) will
|
||||
not render correctly. Most embedded math should render correctly. This
|
||||
is a **very fast** way to check the syntax and layout of a documentation
|
||||
file translated to HTML while writing it.
|
||||
|
||||
To translate **all** manual pages, you can type ``make fasthtml`` at the
|
||||
command line. The translated HTML files are then in the ``fasthtml``
|
||||
folder. All subsequent ``make fasthtml`` commands will only translate
|
||||
``.rst`` files that have been changed. The ``make fasthtml`` command
|
||||
can be parallelized with make using the `-j` flag. You can also
|
||||
directly translate only individual pages: e.g. to translate only the
|
||||
``doc/src/pair_lj.rst`` page type ``make fasthtml/pair_lj.html``
|
||||
|
||||
After writing the documentation is completed, you will still need
|
||||
to verify with ``make html`` and ``make pdf`` that it translates
|
||||
correctly.
|
||||
|
||||
Tests for consistency, completeness, and other known issues
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Please also check the output to the console for any warnings or problems. There will
|
||||
be multiple tests run automatically:
|
||||
|
||||
@ -49,6 +49,7 @@ packages:
|
||||
* :ref:`LEPTON <lepton>`
|
||||
* :ref:`MACHDYN <machdyn>`
|
||||
* :ref:`MDI <mdi>`
|
||||
* :ref:`MISC <misc>`
|
||||
* :ref:`ML-HDNNP <ml-hdnnp>`
|
||||
* :ref:`ML-IAP <mliap>`
|
||||
* :ref:`ML-PACE <ml-pace>`
|
||||
|
||||
@ -8,12 +8,13 @@ Optional build settings
|
||||
LAMMPS can be built with several optional settings. Each subsection
|
||||
explains how to do this for building both with CMake and make.
|
||||
|
||||
* `C++11 standard compliance`_ when building all of LAMMPS
|
||||
* `C++11 and C++17 standard compliance`_ when building all of LAMMPS
|
||||
* `FFT library`_ for use with the :doc:`kspace_style pppm <kspace_style>` command
|
||||
* `Size of LAMMPS integer types and size limits`_
|
||||
* `Read or write compressed files`_
|
||||
* `Output of JPEG, PNG, and movie files`_ via the :doc:`dump image <dump_image>` or :doc:`dump movie <dump_image>` commands
|
||||
* `Support for downloading files`_
|
||||
* `Support for downloading files from the input`_
|
||||
* `Prevent download of large potential files`_
|
||||
* `Memory allocation alignment`_
|
||||
* `Workaround for long long integers`_
|
||||
* `Exception handling when using LAMMPS as a library`_ to capture errors
|
||||
@ -23,14 +24,15 @@ explains how to do this for building both with CMake and make.
|
||||
|
||||
.. _cxx11:
|
||||
|
||||
C++11 standard compliance
|
||||
-------------------------
|
||||
C++11 and C++17 standard compliance
|
||||
-----------------------------------
|
||||
|
||||
A C++11 standard compatible compiler is a requirement for compiling LAMMPS.
|
||||
LAMMPS version 3 March 2020 is the last version compatible with the previous
|
||||
C++98 standard for the core code and most packages. Most currently used
|
||||
C++ compilers are compatible with C++11, but some older ones may need extra
|
||||
flags to enable C++11 compliance. Example for GNU c++ 4.8.x:
|
||||
A C++11 standard compatible compiler is currently the minimum
|
||||
requirement for compiling LAMMPS. LAMMPS version 3 March 2020 is the
|
||||
last version compatible with the previous C++98 standard for the core
|
||||
code and most packages. Most currently used C++ compilers are compatible
|
||||
with C++11, but some older ones may need extra flags to enable C++11
|
||||
compliance. Example for GNU c++ 4.8.x:
|
||||
|
||||
.. code-block:: make
|
||||
|
||||
@ -40,6 +42,17 @@ Individual packages may require compliance with a later C++ standard
|
||||
like C++14 or C++17. These requirements will be documented with the
|
||||
:doc:`individual packages <Packages_details>`.
|
||||
|
||||
.. versionchanged:: 4Feb2025
|
||||
|
||||
Starting with LAMMPS version 4 February 2025 we are starting a
|
||||
transition to require the C++17 standard. Most current compilers are
|
||||
compatible and if the C++17 standard is available by default, LAMMPS
|
||||
will enable C++17 and will compile normally. If the chosen compiler is
|
||||
not compatible with C++17, but only supports C++11, then the define
|
||||
-DLAMMPS_CXX11 is required to fall back to compiling with a C++11
|
||||
compiler. After the next stable release of LAMMPS in summer 2025, the
|
||||
LAMMPS development branch and future releases will require C++17.
|
||||
|
||||
----------
|
||||
|
||||
.. _fft:
|
||||
@ -303,7 +316,7 @@ large counters can become before "rolling over". The default setting of
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
-D LAMMPS_SIZES=value # smallbig (default) or bigbig or smallsmall
|
||||
-D LAMMPS_SIZES=value # smallbig (default) or bigbig
|
||||
|
||||
If the variable is not set explicitly, "smallbig" is used.
|
||||
|
||||
@ -314,7 +327,7 @@ large counters can become before "rolling over". The default setting of
|
||||
|
||||
.. code-block:: make
|
||||
|
||||
LMP_INC = -DLAMMPS_SMALLBIG # or -DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL
|
||||
LMP_INC = -DLAMMPS_SMALLBIG # or -DLAMMPS_BIGBIG
|
||||
|
||||
The default setting is ``-DLAMMPS_SMALLBIG`` if nothing is specified
|
||||
|
||||
@ -323,34 +336,27 @@ LAMMPS system size restrictions
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 18 27 28 27
|
||||
:widths: 27 36 37
|
||||
:align: center
|
||||
|
||||
* -
|
||||
- smallbig
|
||||
- bigbig
|
||||
- smallsmall
|
||||
* - Total atom count
|
||||
- :math:`2^{63}` atoms (= :math:`9.223 \cdot 10^{18}`)
|
||||
- :math:`2^{63}` atoms (= :math:`9.223 \cdot 10^{18}`)
|
||||
- :math:`2^{31}` atoms (= :math:`2.147 \cdot 10^9`)
|
||||
* - Total timesteps
|
||||
- :math:`2^{63}` steps (= :math:`9.223 \cdot 10^{18}`)
|
||||
- :math:`2^{63}` steps (= :math:`9.223 \cdot 10^{18}`)
|
||||
- :math:`2^{31}` steps (= :math:`2.147 \cdot 10^9`)
|
||||
* - Atom ID values
|
||||
- :math:`1 \le i \le 2^{31} (= 2.147 \cdot 10^9)`
|
||||
- :math:`1 \le i \le 2^{63} (= 9.223 \cdot 10^{18})`
|
||||
- :math:`1 \le i \le 2^{31} (= 2.147 \cdot 10^9)`
|
||||
* - Image flag values
|
||||
- :math:`-512 \le i \le 511`
|
||||
- :math:`- 1\,048\,576 \le i \le 1\,048\,575`
|
||||
- :math:`-512 \le i \le 511`
|
||||
|
||||
The "bigbig" setting increases the size of image flags and atom IDs over
|
||||
"smallbig" and the "smallsmall" setting is only needed if your machine
|
||||
does not support 64-bit integers or incurs performance penalties when
|
||||
using them.
|
||||
the default "smallbig" setting.
|
||||
|
||||
These are limits for the core of the LAMMPS code, specific features or
|
||||
some styles may impose additional limits. The :ref:`ATC
|
||||
@ -504,8 +510,8 @@ during a run.
|
||||
|
||||
.. _libcurl:
|
||||
|
||||
Support for downloading files
|
||||
-----------------------------
|
||||
Support for downloading files from the input
|
||||
--------------------------------------------
|
||||
|
||||
.. versionadded:: 29Aug2024
|
||||
|
||||
@ -548,6 +554,25 @@ LAMMPS is compiled accordingly which needs the following settings:
|
||||
|
||||
----------
|
||||
|
||||
.. _download_pot:
|
||||
|
||||
Prevent download of large potential files
|
||||
-----------------------------------------
|
||||
|
||||
.. versionadded:: 8Feb2023
|
||||
|
||||
LAMMPS bundles a selection of potential files in the ``potentials``
|
||||
folder as examples of how those kinds of potential files look like and
|
||||
for use with the provided input examples in the ``examples`` tree. To
|
||||
keep the size of the distributed LAMMPS source package small, very large
|
||||
potential files (> 5 MBytes) are not bundled, but only downloaded on
|
||||
demand when the :doc:`corresponding package <Packages_list>` is
|
||||
installed. This automatic download can be prevented when :doc:`building
|
||||
LAMMPS with CMake <Build_cmake>` by adding the setting `-D
|
||||
DOWNLOAD_POTENTIALS=off` when configuring.
|
||||
|
||||
----------
|
||||
|
||||
.. _align:
|
||||
|
||||
Memory allocation alignment
|
||||
|
||||
@ -100,9 +100,9 @@ procedure.
|
||||
|
||||
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
|
||||
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
|
||||
`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
|
||||
: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.
|
||||
|
||||
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 class that needs to be created when starting a new simulation system
|
||||
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
|
||||
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
|
||||
|
||||
@ -140,6 +140,7 @@ additional letter in parenthesis: k = KOKKOS.
|
||||
* :doc:`plugin <plugin>`
|
||||
* :doc:`prd <prd>`
|
||||
* :doc:`python <python>`
|
||||
* :doc:`region2vmd <region2vmd>`
|
||||
* :doc:`tad <tad>`
|
||||
* :doc:`temper <temper>`
|
||||
* :doc:`temper/grem <temper_grem>`
|
||||
|
||||
@ -23,6 +23,7 @@ OPT.
|
||||
*
|
||||
* :doc:`bpm/rotational <bond_bpm_rotational>`
|
||||
* :doc:`bpm/spring <bond_bpm_spring>`
|
||||
* :doc:`bpm/spring/plastic <bond_bpm_spring_plastic>`
|
||||
* :doc:`class2 (ko) <bond_class2>`
|
||||
* :doc:`fene (iko) <bond_fene>`
|
||||
* :doc:`fene/expand (o) <bond_fene_expand>`
|
||||
@ -90,6 +91,7 @@ OPT.
|
||||
* :doc:`lepton (o) <angle_lepton>`
|
||||
* :doc:`mesocnt <angle_mesocnt>`
|
||||
* :doc:`mm3 <angle_mm3>`
|
||||
* :doc:`mwlc <angle_mwlc>`
|
||||
* :doc:`quartic (o) <angle_quartic>`
|
||||
* :doc:`spica (ko) <angle_spica>`
|
||||
* :doc:`table (o) <angle_table>`
|
||||
|
||||
@ -58,6 +58,7 @@ KOKKOS, o = OPENMP, t = OPT.
|
||||
* :doc:`fep/ta <compute_fep_ta>`
|
||||
* :doc:`force/tally <compute_tally>`
|
||||
* :doc:`fragment/atom <compute_cluster_atom>`
|
||||
* :doc:`gaussian/grid/local (k) <compute_gaussian_grid_local>`
|
||||
* :doc:`global/atom <compute_global_atom>`
|
||||
* :doc:`group/group <compute_group_group>`
|
||||
* :doc:`gyration <compute_gyration>`
|
||||
@ -140,8 +141,8 @@ KOKKOS, o = OPENMP, t = OPT.
|
||||
* :doc:`smd/vol <compute_smd_vol>`
|
||||
* :doc:`snap <compute_sna_atom>`
|
||||
* :doc:`sna/atom <compute_sna_atom>`
|
||||
* :doc:`sna/grid <compute_sna_atom>`
|
||||
* :doc:`sna/grid/local <compute_sna_atom>`
|
||||
* :doc:`sna/grid (k) <compute_sna_atom>`
|
||||
* :doc:`sna/grid/local (k) <compute_sna_atom>`
|
||||
* :doc:`snad/atom <compute_sna_atom>`
|
||||
* :doc:`snav/atom <compute_sna_atom>`
|
||||
* :doc:`sph/e/atom <compute_sph_e_atom>`
|
||||
@ -177,6 +178,7 @@ KOKKOS, o = OPENMP, t = OPT.
|
||||
* :doc:`ti <compute_ti>`
|
||||
* :doc:`torque/chunk <compute_torque_chunk>`
|
||||
* :doc:`vacf <compute_vacf>`
|
||||
* :doc:`vacf/chunk <compute_vacf_chunk>`
|
||||
* :doc:`vcm/chunk <compute_vcm_chunk>`
|
||||
* :doc:`viscosity/cos <compute_viscosity_cos>`
|
||||
* :doc:`voronoi/atom <compute_voronoi_atom>`
|
||||
|
||||
@ -43,7 +43,7 @@ OPT.
|
||||
* :doc:`brownian/asphere <fix_brownian>`
|
||||
* :doc:`brownian/sphere <fix_brownian>`
|
||||
* :doc:`charge/regulation <fix_charge_regulation>`
|
||||
* :doc:`cmap <fix_cmap>`
|
||||
* :doc:`cmap (k) <fix_cmap>`
|
||||
* :doc:`colvars <fix_colvars>`
|
||||
* :doc:`controller <fix_controller>`
|
||||
* :doc:`damping/cundall <fix_damping_cundall>`
|
||||
@ -58,6 +58,7 @@ OPT.
|
||||
* :doc:`dt/reset (k) <fix_dt_reset>`
|
||||
* :doc:`edpd/source <fix_dpd_source>`
|
||||
* :doc:`efield (k) <fix_efield>`
|
||||
* :doc:`efield/lepton <fix_efield_lepton>`
|
||||
* :doc:`efield/tip4p <fix_efield>`
|
||||
* :doc:`ehex <fix_ehex>`
|
||||
* :doc:`electrode/conp (i) <fix_electrode>`
|
||||
@ -134,7 +135,7 @@ OPT.
|
||||
* :doc:`nve/dot <fix_nve_dot>`
|
||||
* :doc:`nve/dotc/langevin <fix_nve_dotc_langevin>`
|
||||
* :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/manifold/rattle <fix_nve_manifold_rattle>`
|
||||
* :doc:`nve/noforce <fix_nve_noforce>`
|
||||
@ -161,6 +162,8 @@ OPT.
|
||||
* :doc:`phonon <fix_phonon>`
|
||||
* :doc:`pimd/langevin <fix_pimd>`
|
||||
* :doc:`pimd/nvt <fix_pimd>`
|
||||
* :doc:`pimd/langevin/bosonic <fix_pimd>`
|
||||
* :doc:`pimd/nvt/bosonic <fix_pimd>`
|
||||
* :doc:`planeforce <fix_planeforce>`
|
||||
* :doc:`plumed <fix_plumed>`
|
||||
* :doc:`poems <fix_poems>`
|
||||
@ -178,6 +181,7 @@ OPT.
|
||||
* :doc:`python/move <fix_python_move>`
|
||||
* :doc:`qbmsst <fix_qbmsst>`
|
||||
* :doc:`qeq/comb (o) <fix_qeq_comb>`
|
||||
* :doc:`qeq/ctip <fix_qeq>`
|
||||
* :doc:`qeq/dynamic <fix_qeq>`
|
||||
* :doc:`qeq/fire <fix_qeq>`
|
||||
* :doc:`qeq/point <fix_qeq>`
|
||||
@ -186,10 +190,11 @@ OPT.
|
||||
* :doc:`qeq/slater <fix_qeq>`
|
||||
* :doc:`qmmm <fix_qmmm>`
|
||||
* :doc:`qtb <fix_qtb>`
|
||||
* :doc:`qtpie/reaxff <fix_qtpie_reaxff>`
|
||||
* :doc:`rattle <fix_shake>`
|
||||
* :doc:`reaxff/bonds (k) <fix_reaxff_bonds>`
|
||||
* :doc:`reaxff/species (k) <fix_reaxff_species>`
|
||||
* :doc:`recenter <fix_recenter>`
|
||||
* :doc:`recenter (k) <fix_recenter>`
|
||||
* :doc:`restrain <fix_restrain>`
|
||||
* :doc:`rheo <fix_rheo>`
|
||||
* :doc:`rheo/oxidation <fix_rheo_oxidation>`
|
||||
@ -267,7 +272,7 @@ OPT.
|
||||
* :doc:`wall/piston <fix_wall_piston>`
|
||||
* :doc:`wall/reflect (k) <fix_wall_reflect>`
|
||||
* :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/srd <fix_wall_srd>`
|
||||
* :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
|
||||
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
|
||||
commands to check the entire input for correct syntax to avoid crashes
|
||||
on typos or syntax errors in long runs.
|
||||
|
||||
@ -44,7 +44,7 @@ OPT.
|
||||
* :doc:`born/coul/wolf/cs (g) <pair_cs>`
|
||||
* :doc:`born/gauss <pair_born_gauss>`
|
||||
* :doc:`bpm/spring <pair_bpm_spring>`
|
||||
* :doc:`brownian (o) <pair_brownian>`
|
||||
* :doc:`brownian (ko) <pair_brownian>`
|
||||
* :doc:`brownian/poly (o) <pair_brownian>`
|
||||
* :doc:`buck (giko) <pair_buck>`
|
||||
* :doc:`buck/coul/cut (giko) <pair_buck>`
|
||||
@ -59,6 +59,7 @@ OPT.
|
||||
* :doc:`comb (o) <pair_comb>`
|
||||
* :doc:`comb3 <pair_comb>`
|
||||
* :doc:`cosine/squared <pair_cosine_squared>`
|
||||
* :doc:`coul/ctip <pair_coul>`
|
||||
* :doc:`coul/cut (gko) <pair_coul>`
|
||||
* :doc:`coul/cut/dielectric <pair_dielectric>`
|
||||
* :doc:`coul/cut/global (o) <pair_coul>`
|
||||
@ -79,6 +80,7 @@ OPT.
|
||||
* :doc:`coul/tt <pair_coul_tt>`
|
||||
* :doc:`coul/wolf (ko) <pair_coul>`
|
||||
* :doc:`coul/wolf/cs <pair_cs>`
|
||||
* :doc:`dispersion/d3 <pair_dispersion_d3>`
|
||||
* :doc:`dpd (giko) <pair_dpd>`
|
||||
* :doc:`dpd/coul/slater/long (g) <pair_dpd_coul_slater_long>`
|
||||
* :doc:`dpd/ext (ko) <pair_dpd_ext>`
|
||||
@ -113,7 +115,9 @@ OPT.
|
||||
* :doc:`gw/zbl <pair_gw>`
|
||||
* :doc:`harmonic/cut (o) <pair_harmonic_cut>`
|
||||
* :doc:`hbond/dreiding/lj (o) <pair_hbond_dreiding>`
|
||||
* :doc:`hbond/dreiding/lj/angleoffset (o) <pair_hbond_dreiding>`
|
||||
* :doc:`hbond/dreiding/morse (o) <pair_hbond_dreiding>`
|
||||
* :doc:`hbond/dreiding/morse/angleoffset (o) <pair_hbond_dreiding>`
|
||||
* :doc:`hdnnp <pair_hdnnp>`
|
||||
* :doc:`hippo (g) <pair_amoeba>`
|
||||
* :doc:`ilp/graphene/hbn (t) <pair_ilp_graphene_hbn>`
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
Removed commands and packages
|
||||
=============================
|
||||
|
||||
.. contents::
|
||||
|
||||
------
|
||||
|
||||
This page lists LAMMPS commands and packages that have been removed from
|
||||
the distribution and provides suggestions for alternatives or
|
||||
replacements. LAMMPS has special dummy styles implemented, that will
|
||||
@ -8,94 +12,32 @@ stop LAMMPS and print a suitable error message in most cases, when a
|
||||
style/command is used that has been removed or will replace the command
|
||||
with the direct alternative (if available) and print a warning.
|
||||
|
||||
restart2data tool
|
||||
-----------------
|
||||
|
||||
.. versionchanged:: 23Nov2013
|
||||
|
||||
The functionality of the restart2data tool has been folded into the
|
||||
LAMMPS executable directly instead of having a separate tool. A
|
||||
combination of the commands :doc:`read_restart <read_restart>` and
|
||||
:doc:`write_data <write_data>` can be used to the same effect. For
|
||||
added convenience this conversion can also be triggered by
|
||||
:doc:`command line flags <Run_options>`
|
||||
|
||||
Fix ave/spatial and fix ave/spatial/sphere
|
||||
------------------------------------------
|
||||
|
||||
.. deprecated:: 11Dec2015
|
||||
|
||||
The fixes ave/spatial and ave/spatial/sphere have been removed from LAMMPS
|
||||
since they were superseded by the more general and extensible "chunk
|
||||
infrastructure". Here the system is partitioned in one of many possible
|
||||
ways through the :doc:`compute chunk/atom <compute_chunk_atom>` command
|
||||
and then averaging is done using :doc:`fix ave/chunk <fix_ave_chunk>`.
|
||||
Please refer to the :doc:`chunk HOWTO <Howto_chunk>` section for an overview.
|
||||
|
||||
Box command
|
||||
-----------
|
||||
|
||||
.. deprecated:: 22Dec2022
|
||||
|
||||
The *box* command has been removed and the LAMMPS code changed so it won't
|
||||
be needed. If present, LAMMPS will ignore the command and print a warning.
|
||||
|
||||
Reset_ids, reset_atom_ids, reset_mol_ids commands
|
||||
-------------------------------------------------
|
||||
|
||||
.. deprecated:: 22Dec2022
|
||||
|
||||
The *reset_ids*, *reset_atom_ids*, and *reset_mol_ids* commands have
|
||||
been folded into the :doc:`reset_atoms <reset_atoms>` command. If
|
||||
present, LAMMPS will replace the commands accordingly and print a
|
||||
warning.
|
||||
|
||||
LATTE package
|
||||
-------------
|
||||
|
||||
.. deprecated:: 15Jun2023
|
||||
|
||||
The LATTE package with the fix latte command was removed from LAMMPS.
|
||||
This functionality has been superseded by :doc:`fix mdi/qm <fix_mdi_qm>`
|
||||
and :doc:`fix mdi/qmmm <fix_mdi_qmmm>` from the :ref:`MDI package
|
||||
<PKG-MDI>`. These fixes are compatible with several quantum software
|
||||
packages, including LATTE. See the ``examples/QUANTUM`` dir and the
|
||||
:doc:`MDI coupling HOWTO <Howto_mdi>` page. MDI supports running LAMMPS
|
||||
with LATTE as a plugin library (similar to the way fix latte worked), as
|
||||
well as on a different set of MPI processors.
|
||||
|
||||
MEAM package
|
||||
LAMMPS shell
|
||||
------------
|
||||
|
||||
The MEAM package in Fortran has been replaced by a C++ implementation.
|
||||
The code in the :ref:`MEAM package <PKG-MEAM>` is a translation of the
|
||||
Fortran code of MEAM into C++, which removes several restrictions
|
||||
(e.g. there can be multiple instances in hybrid pair styles) and allows
|
||||
for some optimizations leading to better performance. The pair style
|
||||
:doc:`meam <pair_meam>` has the exact same syntax. For a transition
|
||||
period the C++ version of MEAM was called USER-MEAMC so it could
|
||||
coexist with the Fortran version.
|
||||
.. versionchanged:: 29Aug2024
|
||||
|
||||
Minimize style fire/old
|
||||
-----------------------
|
||||
The LAMMPS shell has been removed from the LAMMPS distribution. Users
|
||||
are encouraged to use the :ref:`LAMMPS-GUI <lammps_gui>` tool instead.
|
||||
|
||||
.. deprecated:: 8Feb2023
|
||||
i-PI tool
|
||||
---------
|
||||
|
||||
Minimize style *fire/old* has been removed. Its functionality can be
|
||||
reproduced with *fire* with specific options. Please see the
|
||||
:doc:`min_modify command <min_modify>` documentation for details.
|
||||
.. versionchanged:: 27Jun2024
|
||||
|
||||
Pair style mesont/tpm, compute style mesont, atom style mesont
|
||||
--------------------------------------------------------------
|
||||
The i-PI tool has been removed from the LAMMPS distribution. Instead,
|
||||
instructions to install i-PI from PyPI via pip are provided.
|
||||
|
||||
.. deprecated:: 8Feb2023
|
||||
USER-REAXC package
|
||||
------------------
|
||||
|
||||
Pair style *mesont/tpm*, compute style *mesont*, and atom style
|
||||
*mesont* have been removed from the :ref:`MESONT package <PKG-MESONT>`.
|
||||
The same functionality is available through
|
||||
:doc:`pair style mesocnt <pair_mesocnt>`,
|
||||
:doc:`bond style mesocnt <bond_mesocnt>` and
|
||||
:doc:`angle style mesocnt <angle_mesocnt>`.
|
||||
.. deprecated:: 7Feb2024
|
||||
|
||||
The USER-REAXC package has been renamed to :ref:`REAXFF <PKG-REAXFF>`.
|
||||
In the process also the pair style and related fixes were renamed to use
|
||||
the "reaxff" string instead of "reax/c". For a while LAMMPS was maintaining
|
||||
backward compatibility by providing aliases for the styles. These have
|
||||
been removed, so using "reaxff" is now *required*.
|
||||
|
||||
MPIIO package
|
||||
-------------
|
||||
@ -115,7 +57,6 @@ Similarly, the "nfile" and "fileper" keywords exist for restarts:
|
||||
see :doc:`restart <restart>`, :doc:`read_restart <read_restart>`,
|
||||
:doc:`write_restart <write_restart>`.
|
||||
|
||||
|
||||
MSCG package
|
||||
------------
|
||||
|
||||
@ -126,9 +67,73 @@ for many years and instead superseded by the `OpenMSCG software
|
||||
<https://software.rcc.uchicago.edu/mscg/>`_ of the Voth group at the
|
||||
University of Chicago, which can be used independent from LAMMPS.
|
||||
|
||||
LATTE package
|
||||
-------------
|
||||
|
||||
.. deprecated:: 15Jun2023
|
||||
|
||||
The LATTE package with the fix latte command was removed from LAMMPS.
|
||||
This functionality has been superseded by :doc:`fix mdi/qm <fix_mdi_qm>`
|
||||
and :doc:`fix mdi/qmmm <fix_mdi_qmmm>` from the :ref:`MDI package
|
||||
<PKG-MDI>`. These fixes are compatible with several quantum software
|
||||
packages, including LATTE. See the ``examples/QUANTUM`` dir and the
|
||||
:doc:`MDI coupling HOWTO <Howto_mdi>` page. MDI supports running LAMMPS
|
||||
with LATTE as a plugin library (similar to the way fix latte worked), as
|
||||
well as on a different set of MPI processors.
|
||||
|
||||
Minimize style fire/old
|
||||
-----------------------
|
||||
|
||||
.. deprecated:: 8Feb2023
|
||||
|
||||
Minimize style *fire/old* has been removed. Its functionality can be
|
||||
reproduced with style *fire* with specific options. Please see the
|
||||
:doc:`min_modify command <min_modify>` documentation for details.
|
||||
|
||||
Pair style mesont/tpm, compute style mesont, atom style mesont
|
||||
--------------------------------------------------------------
|
||||
|
||||
.. deprecated:: 8Feb2023
|
||||
|
||||
Pair style *mesont/tpm*, compute style *mesont*, and atom style
|
||||
*mesont* have been removed from the :ref:`MESONT package <PKG-MESONT>`.
|
||||
The same functionality is available through
|
||||
:doc:`pair style mesocnt <pair_mesocnt>`,
|
||||
:doc:`bond style mesocnt <bond_mesocnt>` and
|
||||
:doc:`angle style mesocnt <angle_mesocnt>`.
|
||||
|
||||
Box command
|
||||
-----------
|
||||
|
||||
.. deprecated:: 22Dec2022
|
||||
|
||||
The *box* command has been removed and the LAMMPS code changed so it won't
|
||||
be needed. If present, LAMMPS will ignore the command and print a warning.
|
||||
|
||||
Reset_ids, reset_atom_ids, reset_mol_ids commands
|
||||
-------------------------------------------------
|
||||
|
||||
.. deprecated:: 22Dec2022
|
||||
|
||||
The *reset_ids*, *reset_atom_ids*, and *reset_mol_ids* commands have
|
||||
been folded into the :doc:`reset_atoms <reset_atoms>` command. If
|
||||
present, LAMMPS will replace the commands accordingly and print a
|
||||
warning.
|
||||
|
||||
MESSAGE package
|
||||
---------------
|
||||
|
||||
.. deprecated:: 4May2022
|
||||
|
||||
The MESSAGE package has been removed since it was superseded by the
|
||||
:ref:`MDI package <PKG-MDI>`. MDI implements the same functionality
|
||||
and in a more general way with direct support for more applications.
|
||||
|
||||
REAX package
|
||||
------------
|
||||
|
||||
.. deprecated:: 4Jan2019
|
||||
|
||||
The REAX package has been removed since it was superseded by the
|
||||
:ref:`REAXFF package <PKG-REAXFF>`. The REAXFF package has been tested
|
||||
to yield equivalent results to the REAX package, offers better
|
||||
@ -138,20 +143,25 @@ syntax compatible with the removed reax pair style, so input files will
|
||||
have to be adapted. The REAXFF package was originally called
|
||||
USER-REAXC.
|
||||
|
||||
USER-REAXC package
|
||||
------------------
|
||||
MEAM package
|
||||
------------
|
||||
|
||||
.. deprecated:: 7Feb2024
|
||||
.. deprecated:: 4Jan2019
|
||||
|
||||
The USER-REAXC package has been renamed to :ref:`REAXFF <PKG-REAXFF>`.
|
||||
In the process also the pair style and related fixes were renamed to use
|
||||
the "reaxff" string instead of "reax/c". For a while LAMMPS was maintaining
|
||||
backward compatibility by providing aliases for the styles. These have
|
||||
been removed, so using "reaxff" is now *required*.
|
||||
The MEAM package in Fortran has been replaced by a C++ implementation.
|
||||
The code in the :ref:`MEAM package <PKG-MEAM>` is a translation of the
|
||||
Fortran code of MEAM into C++, which removes several restrictions
|
||||
(e.g. there can be multiple instances in hybrid pair styles) and allows
|
||||
for some optimizations leading to better performance. The pair style
|
||||
:doc:`meam <pair_meam>` has the exact same syntax. For a transition
|
||||
period the C++ version of MEAM was called USER-MEAMC so it could
|
||||
coexist with the Fortran version.
|
||||
|
||||
USER-CUDA package
|
||||
-----------------
|
||||
|
||||
.. deprecated:: 31May2016
|
||||
|
||||
The USER-CUDA package had been removed, since it had been unmaintained
|
||||
for a long time and had known bugs and problems. Significant parts of
|
||||
the design were transferred to the
|
||||
@ -160,19 +170,39 @@ performance characteristics on NVIDIA GPUs. Both, the KOKKOS
|
||||
and the :ref:`GPU package <PKG-GPU>` are maintained
|
||||
and allow running LAMMPS with GPU acceleration.
|
||||
|
||||
i-PI tool
|
||||
---------
|
||||
Compute atom/molecule
|
||||
_____________________
|
||||
|
||||
.. versionchanged:: 27Jun2024
|
||||
.. deprecated:: 11 Dec2015
|
||||
|
||||
The i-PI tool has been removed from the LAMMPS distribution. Instead,
|
||||
instructions to install i-PI from PyPI via pip are provided.
|
||||
The atom/molecule command has been removed from LAMMPS since it was superseded
|
||||
by the more general and extensible "chunk infrastructure". Here the system is
|
||||
partitioned in one of many possible ways - including using molecule IDs -
|
||||
through the :doc:`compute chunk/atom <compute_chunk_atom>` command and then
|
||||
summing is done using :doc:`compute reduce/chunk <compute_reduce_chunk>` Please
|
||||
refer to the :doc:`chunk HOWTO <Howto_chunk>` section for an overview.
|
||||
|
||||
LAMMPS shell
|
||||
------------
|
||||
Fix ave/spatial and fix ave/spatial/sphere
|
||||
------------------------------------------
|
||||
|
||||
.. versionchanged:: 29Aug2024
|
||||
.. deprecated:: 11Dec2015
|
||||
|
||||
The LAMMPS shell has been removed from the LAMMPS distribution. Users
|
||||
are encouraged to use the :ref:`LAMMPS-GUI <lammps_gui>` tool instead.
|
||||
The fixes ave/spatial and ave/spatial/sphere have been removed from LAMMPS
|
||||
since they were superseded by the more general and extensible "chunk
|
||||
infrastructure". Here the system is partitioned in one of many possible
|
||||
ways through the :doc:`compute chunk/atom <compute_chunk_atom>` command
|
||||
and then averaging is done using :doc:`fix ave/chunk <fix_ave_chunk>`.
|
||||
Please refer to the :doc:`chunk HOWTO <Howto_chunk>` section for an overview.
|
||||
|
||||
restart2data tool
|
||||
-----------------
|
||||
|
||||
.. deprecated:: 23Nov2013
|
||||
|
||||
The functionality of the restart2data tool has been folded into the
|
||||
LAMMPS executable directly instead of having a separate tool. A
|
||||
combination of the commands :doc:`read_restart <read_restart>` and
|
||||
:doc:`write_data <write_data>` can be used to the same effect. For
|
||||
added convenience this conversion can also be triggered by
|
||||
:doc:`command-line flags <Run_options>`
|
||||
|
||||
|
||||
@ -24,4 +24,5 @@ of time and requests from the LAMMPS user community.
|
||||
Classes
|
||||
Developer_platform
|
||||
Developer_utils
|
||||
Developer_internal
|
||||
Developer_grid
|
||||
|
||||
@ -203,6 +203,7 @@ processed in the expected order before types are removed from dynamic
|
||||
dispatch.
|
||||
|
||||
.. admonition:: Important Notes
|
||||
:class: note
|
||||
|
||||
In order to be able to detect incompatibilities at compile time and
|
||||
to avoid unexpected behavior, it is crucial that all member functions
|
||||
@ -300,18 +301,24 @@ Formatting with the {fmt} library
|
||||
|
||||
The LAMMPS source code includes a copy of the `{fmt} library
|
||||
<https://fmt.dev>`_, which is preferred over formatting with the
|
||||
"printf()" family of functions. The primary reason is that it allows
|
||||
a typesafe default format for any type of supported data. This is
|
||||
"printf()" family of functions. The primary reason is that it allows a
|
||||
typesafe default format for any type of supported data. This is
|
||||
particularly useful for formatting integers of a given size (32-bit or
|
||||
64-bit) which may require different format strings depending on
|
||||
compile time settings or compilers/operating systems. Furthermore,
|
||||
{fmt} gives better performance, has more functionality, a familiar
|
||||
formatting syntax that has similarities to ``format()`` in Python, and
|
||||
provides a facility that can be used to integrate format strings and a
|
||||
variable number of arguments into custom functions in a much simpler
|
||||
way than the varargs mechanism of the C library. Finally, {fmt} has
|
||||
been included into the C++20 language standard, so changes to adopt it
|
||||
are future-proof.
|
||||
64-bit) which may require different format strings depending on compile
|
||||
time settings or compilers/operating systems. Furthermore, {fmt} gives
|
||||
better performance, has more functionality, a familiar formatting syntax
|
||||
that has similarities to ``format()`` in Python, and provides a facility
|
||||
that can be used to integrate format strings and a variable number of
|
||||
arguments into custom functions in a much simpler way than the varargs
|
||||
mechanism of the C library. Finally, {fmt} has been included into the
|
||||
C++20 language standard as ``std::format()``, so changes to adopt it are
|
||||
future-proof, for as long as they are not using any extensions that are
|
||||
not (yet) included into C++.
|
||||
|
||||
The long-term plan is to switch to using ``std::format()`` instead of
|
||||
``fmt::format()`` when the minimum C++ standard required for LAMMPS will
|
||||
be set to C++20. See the :ref:`basic build instructions <compile>` for
|
||||
more details.
|
||||
|
||||
Formatted strings are frequently created by calling the
|
||||
``fmt::format()`` function, which will return a string as a
|
||||
@ -319,11 +326,13 @@ Formatted strings are frequently created by calling the
|
||||
``printf()``, the {fmt} library uses ``{}`` to embed format descriptors.
|
||||
In the simplest case, no additional characters are needed, as {fmt} will
|
||||
choose the default format based on the data type of the argument.
|
||||
Otherwise, the ``fmt::print()`` function may be used instead of
|
||||
``printf()`` or ``fprintf()``. In addition, several LAMMPS output
|
||||
functions, that originally accepted a single string as argument have
|
||||
been overloaded to accept a format string with optional arguments as
|
||||
well (e.g., ``Error::all()``, ``Error::one()``, ``utils::logmesg()``).
|
||||
Otherwise, the :cpp:func:`utils::print() <LAMMPS_NS::utils::print>`
|
||||
function may be used instead of ``printf()`` or ``fprintf()``. In
|
||||
addition, several LAMMPS output functions, that originally accepted a
|
||||
single string as argument have been overloaded to accept a format string
|
||||
with optional arguments as well (e.g., ``Error::all()``,
|
||||
``Error::one()``, :cpp:func:`utils::logmesg()
|
||||
<LAMMPS_NS::utils::logmesg>`).
|
||||
|
||||
Summary of the {fmt} format syntax
|
||||
==================================
|
||||
|
||||
@ -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
|
||||
:ref:`ubuf union <communication_buffer_coding_with_ubuf>` construct.
|
||||
|
||||
The *Fix*, *Compute*, and *Dump* classes can also invoke the same kind
|
||||
of forward and reverse communication operations using the same *Comm*
|
||||
class methods. Likewise, the same pack/unpack methods and
|
||||
The *Fix*, *Bond*, *Compute*, and *Dump* classes can also invoke the
|
||||
same kind of forward and reverse communication operations using the
|
||||
same *Comm* class methods. Likewise, the same pack/unpack methods and
|
||||
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
|
||||
fix performs multiple modes of communication, with different numbers
|
||||
of values per atom. The fix should set the *comm_forward* and
|
||||
class performs multiple modes of communication, with different numbers
|
||||
of values per atom. The class should set the *comm_forward* and
|
||||
*comm_reverse* variables to the maximum value, but can invoke the
|
||||
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
|
||||
buffer.
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ nve, nvt, npt.
|
||||
|
||||
At the end of the timestep, fixes that contain an ``end_of_step()``
|
||||
method are invoked. These typically perform a diagnostic calculation,
|
||||
e.g. the ave/time and ave/spatial fixes. The final operation of the
|
||||
e.g. the ave/time and ave/chunk fixes. The final operation of the
|
||||
timestep is to perform any requested output, via the ``write()`` method
|
||||
of the Output class. There are 3 kinds of LAMMPS output: thermodynamic
|
||||
output to the screen and log file, snapshots of atom data to a dump
|
||||
|
||||
113
doc/src/Developer_internal.rst
Normal file
113
doc/src/Developer_internal.rst
Normal file
@ -0,0 +1,113 @@
|
||||
|
||||
Internal Styles
|
||||
---------------
|
||||
|
||||
LAMMPS has a number of styles that are not meant to be used in an input
|
||||
file and thus are not documented in the :doc:`LAMMPS command
|
||||
documentation <Commands_all>`. The differentiation between user
|
||||
commands and internal commands is through the case of the command name:
|
||||
user commands and styles are all lower case, internal styles are all
|
||||
upper case. Internal styles are not called from the input file, but
|
||||
their classes are instantiated by other styles. Often they are
|
||||
created by other styles to store internal data or to perform actions
|
||||
regularly at specific steps of the simulation.
|
||||
|
||||
The paragraphs below document some of those styles that have general
|
||||
utility and may be used to avoid redundant implementation.
|
||||
|
||||
DEPRECATED Styles
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
The styles called DEPRECATED (e.g. pair, bond, fix, compute, region, etc.)
|
||||
have the purpose to inform users that a specific style has been removed
|
||||
or renamed. This is achieved by creating an alias for the deprecated
|
||||
style to the corresponding class. For example, the fix style DEPRECATED
|
||||
is aliased to fix style ave/spatial and fix style ave/spatial/sphere with
|
||||
the following code:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
FixStyle(DEPRECATED,FixDeprecated);
|
||||
FixStyle(ave/spatial,FixDeprecated);
|
||||
FixStyle(ave/spatial/sphere,FixDeprecated);
|
||||
|
||||
The individual class will then determine based on the style name
|
||||
what action to perform:
|
||||
|
||||
- inform that the style has been removed and what style replaces it, if any, and then error out
|
||||
- inform that the style has been renamed and then either execute the replacement or error out
|
||||
- inform that the style is no longer required, and it is thus ignored and continue
|
||||
|
||||
There is also a section in the user's guide for :doc:`removed commands
|
||||
and packages <Commands_removed>` with additional explanations.
|
||||
|
||||
Internal fix styles
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
fix DUMMY
|
||||
"""""""""
|
||||
|
||||
Most fix classes cannot be instantiated before the simulation box has
|
||||
been created since they access data that is only available then.
|
||||
However, in some cases it is required that a fix must be at or close to
|
||||
the top of the list of all fixes. In those cases an instance of the
|
||||
DUMMY fix style may be created by calling ``Modify::add_fix()`` and then
|
||||
later replaced by calling ``Modify::replace_fix()``.
|
||||
|
||||
fix STORE/ATOM
|
||||
""""""""""""""
|
||||
|
||||
Fix STORE/ATOM can be used as persistent storage of per-atom data.
|
||||
|
||||
**Syntax**
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID STORE/ATOM N1 N2 gflag rflag
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* STORE/ATOM = style name of this fix command
|
||||
* N1 = 1, N2 = 0 : data is per-atom vector = single value per atom
|
||||
* N1 > 1, N2 = 0 : data is per-atom array = N1 values per atom
|
||||
* N1 > 0, N2 > 0 : data is per-atom tensor = N1xN2 values per atom
|
||||
* gflag = 1 communicate per-atom values with ghost atoms, 0 do not update ghost atom data
|
||||
* rflag = 1 store per-atom value in restart file, 0 do not store data in restart
|
||||
|
||||
Similar functionality is also available through using custom per-atom
|
||||
properties with :doc:`fix property/atom <fix_property_atom>`. The
|
||||
choice between the two fixes should be based on whether the user should
|
||||
be able to access this per-atom data: if yes, then fix property/atom is
|
||||
preferred, otherwise fix STORE/ATOM.
|
||||
|
||||
fix STORE/GLOBAL
|
||||
""""""""""""""""
|
||||
|
||||
Fix STORE/GLOBAL can be used as persistent storage of global data with support for restarts
|
||||
|
||||
**Syntax**
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID STORE/GLOBAL N1 N2
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* STORE/GLOBAL = style name of this fix command
|
||||
* N1 >=1 : number of global items to store
|
||||
* N2 = 1 : data is global vector of length N1
|
||||
* N2 > 1 : data is global N1xN2 array
|
||||
|
||||
fix STORE/LOCAL
|
||||
"""""""""""""""
|
||||
|
||||
Fix STORE/LOCAL can be used as persistent storage for local data
|
||||
|
||||
**Syntax**
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID STORE/LOCAL Nreset Nvalues
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* STORE/LOCAL = style name of this fix command
|
||||
* Nreset = frequency at which local data is available
|
||||
* Nvalues = number of values per local item, that is the number of columns
|
||||
@ -7,13 +7,7 @@ typically document what a variable stores, what a small section of
|
||||
code does, or what a function does and its input/outputs. The topics
|
||||
on this page are intended to document code functionality at a higher level.
|
||||
|
||||
Available topics are:
|
||||
|
||||
- `Reading and parsing of text and text files`_
|
||||
- `Requesting and accessing neighbor lists`_
|
||||
- `Choosing between a custom atom style, fix property/atom, and fix STORE/ATOM`_
|
||||
- `Fix contributions to instantaneous energy, virial, and cumulative energy`_
|
||||
- `KSpace PPPM FFT grids`_
|
||||
.. contents::
|
||||
|
||||
----
|
||||
|
||||
@ -218,6 +212,149 @@ command:
|
||||
|
||||
neighbor->add_request(this, "delete_atoms", NeighConst::REQ_FULL);
|
||||
|
||||
|
||||
Errors, warnings, and informational messages
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
LAMMPS has specialized functionality to handle errors (which should
|
||||
terminate LAMMPS), warning messages (which should indicate possible
|
||||
problems *without* terminating LAMMPS), and informational text for
|
||||
messages about the progress and chosen settings. We *strongly*
|
||||
encourage using these facilities and to *stay away* from using
|
||||
``printf()`` or ``fprintf()`` or ``std::cout`` or ``std::cerr`` and
|
||||
calling ``MPI_Abort()`` or ``exit()`` directly. Warnings and
|
||||
informational messages should be printed only on MPI rank 0 to avoid
|
||||
flooding the output when running in parallel with many MPI processes.
|
||||
|
||||
**Errors**
|
||||
|
||||
When LAMMPS encounters an error, for example a syntax error in the
|
||||
input, then a suitable error message should be printed giving a brief,
|
||||
one line remark about the reason and then call either ``Error::all()``
|
||||
or ``Error::one()``. ``Error::all()`` must be called when the failing
|
||||
code path is executed by *all* MPI processes and the error condition
|
||||
will appear for *all* MPI processes the same. If desired, each MPI
|
||||
process may set a flag to either 0 or 1 and then MPI_Allreduce()
|
||||
searching for the maximum can be used to determine if there was an error
|
||||
on *any* of the MPI processes and make this information available to
|
||||
*all*. ``Error::one()`` in contrast needs to be called when only one or
|
||||
a few MPI processes execute the code path or can have the error
|
||||
condition. ``Error::all()`` is generally the preferred option.
|
||||
|
||||
Calling these functions does not abort LAMMPS directly, but rather
|
||||
throws either a ``LAMMPSException`` (from ``Error::all()``) or a
|
||||
``LAMMPSAbortException`` (from ``Error::one()``). These exceptions are
|
||||
caught by the LAMMPS ``main()`` program and then handled accordingly.
|
||||
The reason for this approach is to support applications, especially
|
||||
graphical applications like :ref:`LAMMPS-GUI <lammps_gui>`, that are
|
||||
linked to the LAMMPS library and have a mechanism to avoid that an error
|
||||
in LAMMPS terminates the application. By catching the exceptions, the
|
||||
application can delete the failing LAMMPS class instance and create a
|
||||
new one to try again. In a similar fashion, the :doc:`LAMMPS Python
|
||||
module <Python_module>` checks for this and then re-throws corresponding
|
||||
Python exception, which in turn can be caught by the calling Python
|
||||
code.
|
||||
|
||||
There are multiple "signatures" that can be called:
|
||||
|
||||
- ``Error::all(FLERR, "Error message")``: this will abort LAMMPS with
|
||||
the error message "Error message", followed by the last line of input
|
||||
that was read and processed before the error condition happened.
|
||||
|
||||
- ``Error::all(FLERR, Error::NOLASTLINE, "Error message")``: this is the
|
||||
same as before but without the last line of input. This is preferred
|
||||
for errors that would happen *during* a :doc:`run <run>` or
|
||||
:doc:`minimization <minimize>`, since showing the "run" or "minimize"
|
||||
command would be the last line, but is unrelated to the error.
|
||||
|
||||
- ``Error::all(FLERR, idx, "Error message")``: this is for argument
|
||||
parsing where "idx" is the index (starting at 0) of the argument for a
|
||||
LAMMPS command that is causing the failure (use -1 for the command
|
||||
itself). For index 0, you need to use the constant ``Error::ARGZERO``
|
||||
to work around the inability of some compilers to disambiguate between
|
||||
a NULL pointer and an integer constant 0, even with an added type cast.
|
||||
The output may also include the last input line *before* and
|
||||
*after*, if they differ due to substituting variables. A textual
|
||||
indicator is pointing to the specific word that failed. Using the
|
||||
constant ``Error::NOPOINTER`` in place of the *idx* argument will
|
||||
suppress the marker and then the behavior is like the *idx* argument
|
||||
is not provided.
|
||||
|
||||
FLERR is a macro containing the filename and line where the Error class
|
||||
is called and that information is appended to the error message. This
|
||||
allows to quickly find the relevant source code causing the error. For
|
||||
all three signatures, the single string "Error message" may be replaced
|
||||
with a format string using '{}' placeholders and followed by a variable
|
||||
number of arguments, one for each placeholder. This format string and
|
||||
the arguments are then handed for formatting to the `{fmt} library
|
||||
<https://fmt.dev>`_ (which is bundled with LAMMPS) and thus allow
|
||||
processing similar to the "format()" functionality in Python.
|
||||
|
||||
.. note::
|
||||
|
||||
For commands like :doc:`fix ave/time <fix_ave_time>` that accept
|
||||
wildcard arguments, the :cpp:func:`utils::expand_args` function
|
||||
may be passed as an optional argument where the function will provide
|
||||
a map to the original arguments from the expanded argument indices.
|
||||
|
||||
For complex errors, that can have multiple causes and which cannot be
|
||||
explained in a single line, you can append to the error message, the
|
||||
string created by :cpp:func:`utils::errorurl`, which then provides a
|
||||
URL pointing to a paragraph of the :doc:`Errors_details` that
|
||||
corresponds to the number provided. Example:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
error->all(FLERR, "Unknown identifier in data file: {}{}", keyword, utils::errorurl(1));
|
||||
|
||||
This will output something like this:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
ERROR: Unknown identifier in data file: Massess
|
||||
For more information see https://docs.lammps.org/err0001 (src/read_data.cpp:1482)
|
||||
Last input line: read_data data.peptide
|
||||
|
||||
Where the URL points to the first paragraph with explanations on
|
||||
the :doc:`Errors_details` page in the manual.
|
||||
|
||||
**Warnings**
|
||||
|
||||
To print warnings, the ``Errors::warning()`` function should be used.
|
||||
It also requires the FLERR macros as first argument to easily identify
|
||||
the location of the warning in the source code. Same as with the error
|
||||
functions above, the function has two variants: one just taking a single
|
||||
string as final argument and a second that uses the `{fmt} library
|
||||
<https://fmt.dev>`_ to make it similar to, say, ``fprintf()``. One
|
||||
motivation to use this function is that it will output warnings with
|
||||
always the same capitalization of the leading "WARNING" string. A
|
||||
second is that it has a built in rate limiter. After a given number (by
|
||||
default 100), that can be set via the :doc:`thermo_modify command
|
||||
<thermo_modify>` no more warnings are printed. Also, warnings are
|
||||
written consistently to both screen and logfile or not, depending on the
|
||||
settings for :ref:`screen <screen>` or :doc:`logfile <log>` output.
|
||||
|
||||
.. note::
|
||||
|
||||
Unlike ``Error::all()``, the warning function will produce output on
|
||||
*every* MPI process, so it typically would be prefixed with an if
|
||||
statement testing for ``comm->me == 0``, i.e. limiting output to MPI
|
||||
rank 0.
|
||||
|
||||
**Informational messages**
|
||||
|
||||
Finally, for informational message LAMMPS has the
|
||||
:cpp:func:`utils::logmesg() convenience function
|
||||
<LAMMPS_NS::utils::logmesg>`. It also uses the `{fmt} library
|
||||
<https://fmt.dev>`_ to support using a format string followed by a
|
||||
matching number of arguments. It will output the resulting formatted
|
||||
text to both, the screen and the logfile and will honor the
|
||||
corresponding settings about whether this output is active and to which
|
||||
file it should be send. Same as for ``Error::warning()``, it would
|
||||
produce output for every MPI process and thus should usually be called
|
||||
only on MPI rank 0 to avoid flooding the output when running with many
|
||||
parallel processes.
|
||||
|
||||
Choosing between a custom atom style, fix property/atom, and fix STORE/ATOM
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@ -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
|
||||
providing the core functionality of the MD engine in LAMMPS and through
|
||||
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
|
||||
input and output. The destructor will shut everything down and free all
|
||||
associated memory. Thus code for the standalone LAMMPS executable in
|
||||
``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
|
||||
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
|
||||
``unittest/c-library`` folder. They are implemented either to be used
|
||||
for utility functions or for LAMMPS commands, but use the functions
|
||||
implemented in the ``src/library.cpp`` file as much as possible. There
|
||||
may be some overlap with other tests, but only in as much as is required
|
||||
to test the C-style library API. The tests are distributed over
|
||||
multiple test programs which try to match the grouping of the
|
||||
``unittest/c-library`` folder. They text either utility functions or
|
||||
LAMMPS commands, but use the functions implemented in
|
||||
``src/library.cpp`` as much as possible. There may be some overlap with
|
||||
other tests as far as the LAMMPS functionality is concerned, but the
|
||||
focus is on testing the C-style library API. The tests are distributed
|
||||
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>`.
|
||||
|
||||
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
|
||||
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
|
||||
compilation of LAMMPS (shared library build enabled, Python interpreter
|
||||
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``
|
||||
folder. Since they are also using the GoogleTest library, they require
|
||||
implementing test wrappers in C++ that will call fortran functions
|
||||
which provide a C function interface through ISO_C_BINDINGS that will in
|
||||
turn call the functions in the LAMMPS Fortran module.
|
||||
test wrappers written in C++ that will call fortran functions with a C
|
||||
function interface through ISO_C_BINDINGS which will in turn call the
|
||||
functions in the LAMMPS Fortran module.
|
||||
|
||||
Tests for the C++-style library interface
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
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
|
||||
several convenience and utility functions that are only available through
|
||||
the C-style interface. Instead it can focus on the more generic features
|
||||
that are used internally. This part of the unit tests is currently still
|
||||
mostly in the planning stage.
|
||||
convenience and utility functions that are only available through the
|
||||
C-style library interface. Instead they focus on the more generic
|
||||
features that are used in LAMMPS internally. This part of the unit
|
||||
tests is currently still mostly in the planning stage.
|
||||
|
||||
Tests for reading and writing file formats
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The ``unittest/formats`` folder contains test programs for reading and
|
||||
writing files like data files, restart files, potential files or dump files.
|
||||
This covers simple things like the file i/o convenience functions in the
|
||||
``utils::`` namespace to complex tests of atom styles where creating and
|
||||
deleting atoms with different properties is tested in different ways
|
||||
and through script commands or reading and writing of data or restart files.
|
||||
writing files like data files, restart files, potential files or dump
|
||||
files. This covers simple things like the file i/o convenience
|
||||
functions in the ``utils::`` namespace to complex tests of atom styles
|
||||
where creating and deleting of atoms with different properties is tested
|
||||
in different ways and through script commands or reading and writing of
|
||||
data or restart files.
|
||||
|
||||
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,
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
.. code-block:: bash
|
||||
@ -531,19 +532,20 @@ Python module.
|
||||
Troubleshooting failed unit tests
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The are by default no unit tests for newly added features (e.g. pair, fix,
|
||||
or compute styles) unless your pull request also includes tests for the
|
||||
added features. If you are modifying some features, you may see failures
|
||||
for existing tests, if your modifications have some unexpected side effects
|
||||
or your changes render the existing test invalid. If you are adding an
|
||||
accelerated version of an existing style, then only tests for INTEL,
|
||||
KOKKOS (with OpenMP only), OPENMP, and OPT will be run automatically.
|
||||
Tests for the GPU package are time consuming and thus are only run
|
||||
*after* a merge, or when a special label, ``gpu_unit_tests`` is added
|
||||
to the pull request. After the test has started, it is often best to
|
||||
remove the label since every PR activity will re-trigger the test (that
|
||||
is a limitation of triggering a test with a label). Support for unit
|
||||
tests when using KOKKOS with GPU acceleration is currently not supported.
|
||||
There are by default no unit tests for newly added features (e.g. pair,
|
||||
fix, or compute styles) unless your pull request also includes tests for
|
||||
these added features. If you are modifying some existing LAMMPS
|
||||
features, you may see failures for existing tests, if your modifications
|
||||
have some unexpected side effects or your changes render the existing
|
||||
test invalid. If you are adding an accelerated version of an existing
|
||||
style, then only tests for INTEL, KOKKOS (with OpenMP only), OPENMP, and
|
||||
OPT will be run automatically. Tests for the GPU package are time
|
||||
consuming and thus are only run *after* a merge, or when a special
|
||||
label, ``gpu_unit_tests`` is added to the pull request. After the test
|
||||
has started, it is often best to remove the label since every PR
|
||||
activity will re-trigger the test (that is a limitation of triggering a
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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()`
|
||||
@ -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
|
||||
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,
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
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
|
||||
catch exceptions with the test command, for example,
|
||||
|
||||
|
||||
@ -133,6 +133,9 @@ and parsing files or arguments.
|
||||
.. doxygenfunction:: trim_comment
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: strcompress
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: strip_style_suffix
|
||||
:project: progguide
|
||||
|
||||
@ -166,6 +169,9 @@ and parsing files or arguments.
|
||||
.. doxygenfunction:: split_lines
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: strsame
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: strmatch
|
||||
:project: progguide
|
||||
|
||||
@ -232,12 +238,21 @@ Convenience functions
|
||||
.. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &mesg)
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: print(FILE *fp, const std::string &format, Args&&... args)
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: print(FILE *fp, const std::string &mesg)
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: errorurl
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: missing_cmd_args
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: point_to_error
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: flush_buffers(LAMMPS *lmp)
|
||||
:project: progguide
|
||||
|
||||
|
||||
@ -96,8 +96,8 @@ Here the we specify which methods of the fix should be called during
|
||||
MPI_Allreduce(localAvgVel, globalAvgVel, 4, MPI_DOUBLE, MPI_SUM, world);
|
||||
scale3(1.0 / globalAvgVel[3], globalAvgVel);
|
||||
if ((comm->me == 0) && screen) {
|
||||
fmt::print(screen,"{}, {}, {}\n",
|
||||
globalAvgVel[0], globalAvgVel[1], globalAvgVel[2]);
|
||||
utils::print(screen, "{}, {}, {}\n",
|
||||
globalAvgVel[0], globalAvgVel[1], globalAvgVel[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -310,7 +310,7 @@ the constructor and the destructor.
|
||||
|
||||
Pair styles are different from most classes in LAMMPS that define a
|
||||
"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
|
||||
processed in the ``Pair::settings()`` function (or rather the version in
|
||||
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
|
||||
additive potentials, where the potential parameters can be entered
|
||||
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
|
||||
*born/gauss* that do support writing to data files, the potential
|
||||
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:
|
||||
|
||||
#. 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.
|
||||
#. Build data structures where the original and derived parameters are
|
||||
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
|
||||
``PairAIREBOMorse::settings()`` function which is called by the
|
||||
:doc:`pair_style <pair_style>` command. This function delegates
|
||||
all command line processing and setting of other parameters to the
|
||||
:doc:`pair_style <pair_style>` command. This function delegates all
|
||||
command argument processing and setting of other parameters to the
|
||||
``PairAIREBO::settings()`` function of the base class.
|
||||
|
||||
.. 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
|
||||
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
|
||||
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
|
||||
debugger, load the LAMMPS executable and its debug info, and then run
|
||||
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
|
||||
execution quite significantly, but can also report issues that are not
|
||||
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
|
||||
recommended to redirect the valgrind output to a file (e.g. with
|
||||
``--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
|
||||
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.
|
||||
|
||||
@ -4,9 +4,237 @@ Error and warning details
|
||||
Many errors or warnings are self-explanatory and thus straightforward to
|
||||
resolve. However, there are also cases, where there is no single cause
|
||||
and explanation, where LAMMPS can only detect symptoms of an error but
|
||||
not the exact cause, or where the explanation needs to be more detailed than
|
||||
what can be fit into a message printed by the program. The following are
|
||||
discussions of such cases.
|
||||
not the exact cause, or where the explanation needs to be more detailed
|
||||
than what can be fit into a message printed by the program. The
|
||||
following are discussions of such cases.
|
||||
|
||||
.. contents::
|
||||
|
||||
------
|
||||
|
||||
General troubleshooting advice
|
||||
------------------------------
|
||||
|
||||
Below are suggestions that can help to understand the causes of problems
|
||||
with simulations leading to errors or unexpected results.
|
||||
|
||||
.. _hint01:
|
||||
|
||||
Create a small test system
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Debugging problems often requires running a simulation many times with
|
||||
small modifications, thus it can be a huge time saver to first assemble
|
||||
a small test system input that has the same issue, but will take much
|
||||
time until it triggers the error condition. Also, it will be easier to
|
||||
see what happens.
|
||||
|
||||
.. _hint02:
|
||||
|
||||
Visualize your trajectory
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
To better understand what is causing problems, it is often very useful
|
||||
to visualize the system close to the point of failure. It may be
|
||||
necessary to have LAMMPS output trajectory frames rather frequently. To
|
||||
avoid gigantic files, you can use :doc:`dump_modify delay <dump_modify>`
|
||||
to delay output until the critical section is reached, and you can use a
|
||||
smaller test system (see above).
|
||||
|
||||
.. _hint03:
|
||||
|
||||
Parallel versus serial
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Issues where something is "lost" or "missing" often exhibit that issue
|
||||
only when running in parallel. That doesn't mean there is no problem,
|
||||
only the symptoms are not triggering an error quickly. Correspondingly,
|
||||
errors may be triggered faster with more processors and thus smaller
|
||||
sub-domains.
|
||||
|
||||
.. _hint04:
|
||||
|
||||
Segmentation Fault
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
A segmentation fault is an error reported by the **operating system**
|
||||
and not LAMMPS itself. It happens when a process tries to access a
|
||||
memory address that is not available. This can have **many** reasons:
|
||||
memory has not been allocated, a memory buffer is not large enough, a
|
||||
memory address is computed from an incorrect index, a memory buffer is
|
||||
used after it has been freed, some general memory corruption. When
|
||||
investigating a segmentation fault (aka segfault), it is important to
|
||||
determine which process is causing it; it may not always be LAMMPS. For
|
||||
example, some MPI library implementations report a segmentation fault
|
||||
from their "mpirun" or "mpiexec" command when the application has been
|
||||
terminated unexpectedly.
|
||||
|
||||
While a segmentation fault is likely an indication of a bug in LAMMPS,
|
||||
it need not always be; it can also be the consequence of too aggressive
|
||||
simulation settings. For time critical code paths, LAMMPS will assume
|
||||
the user has chosen the settings carefully and will not make any checks
|
||||
to avoid to avoid performance penalties.
|
||||
|
||||
A crucial step in resolving a segmentation fault is to identify the exact
|
||||
location in the code where it happens. Please see `Errors_debug` for
|
||||
a couple of examples showing how to do this on a Linux machine. With
|
||||
this information -- a simple way to reproduce the segmentation fault and
|
||||
the exact :doc:`LAMMPS version <Manual_version>` and platform you are
|
||||
running on -- you can contact the LAMMPS developers or post in the LAMMPS
|
||||
forum to get assistance.
|
||||
|
||||
.. _hint05:
|
||||
|
||||
Fast moving atoms
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Fast moving atoms may be "lost" or "missing" when their velocity becomes
|
||||
so large that they can cross a sub-domain within one timestep. This
|
||||
often happens when atoms are too close, but atoms may also "move" too
|
||||
fast from sub-domain to sub-domain if the box changes rapidly. E.g. when
|
||||
setting a large an initial box with :doc:`shrink-wrap boundary
|
||||
conditions <boundary>` that collapses on the first step (in this case
|
||||
the solution is often using 'm' instead of 's' as a boundary condition).
|
||||
|
||||
To reduce the impact of "close contacts", one can remove those atoms or
|
||||
molecules with something like :doc:`delete_atoms overlap 0.1 all all
|
||||
<delete_atoms>`. With periodic boundaries, a close contact pair of atoms
|
||||
may be on opposite sides of the simulation box. Another option would be
|
||||
to first run a minimization (aka quench) before starting the MD. Reducing
|
||||
the time step can also help. Many times, one just needs to "ease" the
|
||||
system into a balanced state and can then switch to more aggressive settings.
|
||||
|
||||
The speed of atoms during an MD run depends on the steepness of the
|
||||
potential function and their mass. Since the positions and velocities
|
||||
of atoms are computed with finite timesteps, the timestep needs to be
|
||||
small enough for stable numeric integration of the trajectory. If the timestep
|
||||
is too large during initialization (or other instances of extreme dynamics),
|
||||
using :doc:`fix nve/limit <fix_nve_limit>` or :doc:`fix dt/reset <fix_dt_reset>`
|
||||
temporarily can help to avoid too large updates or adapt the timestep according
|
||||
to the displacements.
|
||||
|
||||
.. _hint06:
|
||||
|
||||
Ignoring lost atoms
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
It is tempting to use the :doc:`thermo_modify lost ignore <thermo_modify>`
|
||||
to avoid LAMMPS aborting with an error on lost atoms. This setting should,
|
||||
however, *only* be used when atoms *should* leave the system. In general,
|
||||
ignoring a problem does not solve it.
|
||||
|
||||
.. _hint07:
|
||||
|
||||
Pressure, forces, positions becoming NaN or Inf
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Some potentials can overflow or have a division by zero with close contacts
|
||||
or bad geometries (for the given force styles in use) leading to forces
|
||||
that can no longer be represented as numbers. Those will show as "NaN" or
|
||||
"Inf". On most machines, the program will continue, but there is no way
|
||||
to recover from it and those NaN or Inf values will propagate. So-called
|
||||
:doc:`"soft-core" potentials <pair_fep_soft>` or the :doc:`"soft" repulsive-only
|
||||
pair style <pair_soft>` are less prone for this behavior (depending on the
|
||||
settings in use) and can be used at the beginning of a simulation. Also,
|
||||
single precision numbers can overflow much faster, so for the GPU or INTEL
|
||||
package it may be beneficial to run with double precision initially before
|
||||
switching to mixed or single precision for faster execution when the system
|
||||
has relaxed.
|
||||
|
||||
.. _hint08:
|
||||
|
||||
Communication cutoff
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The communication cutoff determines the "overlap" between sub-domains
|
||||
and atoms in these regions are referred to in LAMMPS as "ghost atoms".
|
||||
This region has to be large enough to contain all atoms of a bond,
|
||||
angle, dihedral, or improper with just one atom in the actual sub-domain.
|
||||
Typically, this cutoff is set to the largest cutoff from the :doc:`pair
|
||||
style(s) <pair_style>` plus the :doc:`neighbor list skin distance
|
||||
<neighbor>` and will typically be sufficient for all bonded
|
||||
interactions. But if the pair style cutoff is small, this may not be
|
||||
enough. LAMMPS will print a warning in this case using some heuristic
|
||||
based on the equilibrium bond length, but that still may not be sufficient
|
||||
for cases where the force constants are small and thus bonds may be
|
||||
stretched very far. The communication cutoff can be adjusted with
|
||||
:doc:`comm_modify cutoff \<value\> <comm_modify>`, but setting this too
|
||||
large will waste CPU time and memory.
|
||||
|
||||
.. _hint09:
|
||||
|
||||
Neighbor list settings
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Every time LAMMPS rebuilds the neighbor lists, LAMMPS will also check
|
||||
for "lost" or "missing" atoms. Thus it can help to use very
|
||||
conservative :doc:`neighbor list settings <neigh_modify>` and then
|
||||
examine the neighbor list statistics if the neighbor list rebuild can be
|
||||
safely delayed. Rebuilding the neighbor list less frequently
|
||||
(i.e. through increasing the *delay* or *every*) setting has diminishing
|
||||
returns and increasing risks.
|
||||
|
||||
.. _hint10:
|
||||
|
||||
Units
|
||||
^^^^^
|
||||
|
||||
A frequent cause for a variety of problems is due to using the wrong
|
||||
:doc:`units <units>` settings for a particular potentials, especially
|
||||
when reading them from a potential file. Most of the (example)
|
||||
potentials bundled with LAMMPS have a "UNITS:" tag that allows LAMMPS to
|
||||
check of the units are consistent with what is intended, but potential
|
||||
files from publications or potential parameter databases may lack this
|
||||
metadata information and thus will not error out or warn when using the
|
||||
wrong setting. Most potential files usually use "metal" units, but some
|
||||
are parameterized for other settings, most notably :doc:`ReaxFF
|
||||
potentials <pair_reaxff>` that use "real" units.
|
||||
|
||||
Also, individual parameters for :doc:`pair_coeff <pair_coeff>` commands
|
||||
taken from publications or other MD software may need to be converted
|
||||
and sometimes in unexpected ways. Thus some careful checking is
|
||||
recommended.
|
||||
|
||||
.. _hint11:
|
||||
|
||||
No error message printed
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
In some cases -- especially when running in parallel with MPI -- LAMMPS
|
||||
may stop without displaying an error. But the fact that nothing was
|
||||
displayed does not mean there was not an error message. Instead it is
|
||||
highly likely that the message was written to a buffer and LAMMPS was
|
||||
aborted before the buffer was output. Usually, output buffers are output
|
||||
for every line of output, but sometimes this is delayed until 4096 or
|
||||
8192 bytes of output have been accumulated. This buffering for screen
|
||||
and logfile output can be disabled by using the :ref:`-nb or -nonbuf
|
||||
<nonbuf>` command-line flag. This is most often needed when debugging
|
||||
crashing multi-replica calculations.
|
||||
|
||||
.. _hint12:
|
||||
|
||||
Errors before or after the simulation box is created
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
As critical step in a LAMMPS input is when the simulation box is
|
||||
defined, either with a :doc:`create_box command <create_box>`, a
|
||||
:doc:`read_data command <read_data>`, or a :doc:`read_restart command
|
||||
<read_restart>`. After this step, certain settings are locked in (e.g.
|
||||
units, or number of atom, bond, angle, dihedral, improper types) and
|
||||
cannot be changed after that. Consequently, commands that change such
|
||||
settings (e.g. :doc:`units <units>`) are only allowed before the box is
|
||||
defined. Very few commands can be used before and after, like
|
||||
:doc:`pair_style <pair_style>` (but not :doc:`pair_coeff <pair_coeff>`).
|
||||
Most LAMMPS commands must be used after the simulation box is created.
|
||||
|
||||
Consequently, LAMMPS will stop with an error, if a command is used in
|
||||
the wrong place. This is not always obvious. So index or string style
|
||||
:doc:`variables <variable>` can be expanded anywhere in the input, but
|
||||
equal style (or similar) variables can only be expanded before the box
|
||||
is defined if they do not reference anything that cannot be defined
|
||||
before the box (e.g. a compute or fix reference or a thermo keyword).
|
||||
|
||||
------
|
||||
|
||||
.. _err0001:
|
||||
|
||||
@ -34,8 +262,8 @@ treated as a comment.
|
||||
Another possibility to trigger this error is to have a keyword in the
|
||||
data file that corresponds to a fix (e.g. :doc:`fix cmap <fix_cmap>`)
|
||||
but the :doc:`read_data <read_data>` command is missing the (optional)
|
||||
arguments that identify the fix and the header keyword and section
|
||||
keyword or those arguments are inconsistent with the keywords in the
|
||||
arguments that identify the fix and its header and section keywords.
|
||||
Alternatively, those arguments are inconsistent with the keywords in the
|
||||
data file.
|
||||
|
||||
.. _err0002:
|
||||
@ -45,12 +273,589 @@ Incorrect format in ... section of data file
|
||||
|
||||
This error happens when LAMMPS reads the contents of a section of a
|
||||
:doc:`data file <read_data>` and the number of parameters in the line
|
||||
differs from what is expected. This most commonly happens, when the
|
||||
differs from what is expected. This most commonly happens when the
|
||||
atom style is different from what is expected for a specific data file
|
||||
since changing the atom style usually changes the format of the line.
|
||||
|
||||
This error can also happen when the number of entries indicated in the
|
||||
This error can also occur when the number of entries indicated in the
|
||||
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)
|
||||
and then LAMMPS will continue reading into the next section and that
|
||||
would have a completely different format.
|
||||
causing LAMMPS to continue reading into the next section which has
|
||||
a completely different format.
|
||||
|
||||
.. _err0003:
|
||||
|
||||
Illegal variable command: expected X arguments but found Y
|
||||
----------------------------------------------------------
|
||||
|
||||
This error indicates that a variable command has the wrong number of
|
||||
arguments. A common reason for this is that the variable expression
|
||||
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, and 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 pass that string as
|
||||
"word" to the variable command.
|
||||
|
||||
Thus missing quotes or accidental extra whitespace will trigger this
|
||||
error because the unquoted whitespace will result in the text being broken
|
||||
into more "words", i.e. the variable expression being split.
|
||||
|
||||
.. _err0004:
|
||||
|
||||
Out of range atoms - cannot compute ...
|
||||
---------------------------------------
|
||||
|
||||
The PPPM (and also PPPMDisp and MSM) methods need to assemble a grid
|
||||
of electron density data derived from the (partial) charges assigned to
|
||||
the atoms. These charges are smeared out across multiple grid points
|
||||
(see :doc:`kspace_modify order <kspace_modify>`). When running in
|
||||
parallel with MPI, LAMMPS uses a :doc:`domain decomposition scheme
|
||||
<Developer_par_part>` where each processor manages a subset of atoms and
|
||||
thus also a grid representing the density. The processor's grid covers the
|
||||
actual volume of the sub-domain and some extra space corresponding to the
|
||||
:doc:`neighbor list skin <neighbor>`. These are then :doc:`combined and
|
||||
redistributed <Developer_par_long>` for parallel processing of the
|
||||
long-range component of the Coulomb interaction.
|
||||
|
||||
The ``Out of range atoms`` error can happen when atoms move too fast,
|
||||
the neighbor list skin is too small, or the neighbor lists are not
|
||||
updated frequently enough. The smeared charges cannot then be fully
|
||||
assigned to the density grid for all atoms. LAMMPS checks for this
|
||||
condition and stops with an error. Most of the time, this is an
|
||||
indication of a system with very high forces, often at the beginning
|
||||
of a simulation or when boundary conditions are changed. The
|
||||
error becomes more likely with more MPI processes.
|
||||
|
||||
There are multiple options to explore for avoiding the error. The best
|
||||
choice depends strongly on the individual system, and often a
|
||||
combination of changes is required. For example, more conservative MD
|
||||
parameter settings can be used (larger neighbor skin, shorter time step,
|
||||
more frequent neighbor list updates). Sometimes, it helps to revisit
|
||||
the system generation and avoid close contacts when building it. Otherwise
|
||||
one can use the :doc:`delete_atoms overlap<delete_atoms>` command to delete
|
||||
those close contact atoms or run a minimization before the MD. It can also
|
||||
help to temporarily use a cutoff-Coulomb pair style and no kspace style
|
||||
until the system has somewhat equilibrated and then switch to the
|
||||
long-range solver.
|
||||
|
||||
.. _err0005:
|
||||
|
||||
Bond (or angle, dihedral, or improper) atoms missing
|
||||
----------------------------------------------------
|
||||
|
||||
The second atom needed to compute a particular bond (or the third or fourth
|
||||
atom for angle, dihedral, or improper) is missing on the indicated timestep
|
||||
and processor. Typically, this is because the two bonded atoms have become
|
||||
too far apart relative to the communication cutoff distance for ghost atoms.
|
||||
By default, the communication cutoff is set by the pair cutoff. However, to
|
||||
accommodate larger distances between topologically connected atoms, it can
|
||||
be manually adjusted using :doc:`comm_modify <comm_modify>` at the cost of
|
||||
increased communication and more ghost atoms. However, missing bond atoms
|
||||
may also indicate that there are unstable dynamics which caused the atoms
|
||||
to blow apart. In this scenario, increasing the communication distance will
|
||||
not solve the underlying issue. Rather, see :ref:`Fast moving atoms <hint05>`
|
||||
and :ref:`Neighbor list settings <hint09>` in the general troubleshooting
|
||||
section above for ideas to fix unstable dynamics.
|
||||
|
||||
If atoms are intended to be lost during a simulation (e.g. due to open boundary
|
||||
conditions or :doc:`fix evaporate <fix_evaporate>`) such that two bonded atoms
|
||||
may be lost at different times from each other, this error can be converted to a
|
||||
warning or turned off using the *lost/bond* keyword in the :doc:`thermo_modify
|
||||
<thermo_modify>` command.
|
||||
|
||||
.. _err0006:
|
||||
|
||||
Non-numeric atom coords - simulation unstable
|
||||
---------------------------------------------
|
||||
This error usually occurs due to issues with system geometry or the potential in
|
||||
use. See :ref:`Pressure, forces, positions becoming NaN or Inf <hint07>` above in the
|
||||
general troubleshooting section.
|
||||
|
||||
.. _err0007:
|
||||
|
||||
Non-numeric pressure - simulation unstable
|
||||
------------------------------------------
|
||||
This error usually occurs due to issues with system geometry or the potential in
|
||||
use. See :ref:`Pressure, forces, positions becoming NaN or Inf <hint07>` above in the
|
||||
general troubleshooting section.
|
||||
|
||||
|
||||
.. _err0008:
|
||||
|
||||
Lost atoms ...
|
||||
--------------
|
||||
|
||||
A simulation stopping with an error due to lost atoms can have multiple
|
||||
causes. In the majority of cases, lost atoms are unexpected and a result
|
||||
of extremely high velocities causing instabilities in the system, and
|
||||
those velocities can result from a variety of issues. For ideas on how
|
||||
to track down issues with unexpected lost atoms, see :ref:`Fast moving
|
||||
atoms <hint05>` and :ref:`Neighbor list settings <hint09>` in the
|
||||
general troubleshooting section above. In specific situations however,
|
||||
losing atoms is expected material behavior (e.g. with sputtering and
|
||||
surface evaporation simulations) and an unwanted crash can be resolved
|
||||
by changing the :doc:`thermo_modify lost <thermo_modify>` keyword from
|
||||
the default 'error' to 'warn' or 'ignore' (though heed the advice in
|
||||
:ref:`Ignoring lost atoms <hint06>` above!).
|
||||
|
||||
.. _err0009:
|
||||
|
||||
Too many neighbor bins
|
||||
----------------------
|
||||
|
||||
The simulation box has become too large relative to the size of a
|
||||
neighbor bin and LAMMPS is unable to store the needed number of
|
||||
bins. This typically implies the simulation box has expanded too far.
|
||||
This can happen when some atoms move rapidly apart with shrink-wrap boundaries
|
||||
or when a fix (like fix deform or a barostat) excessively grows the simulation
|
||||
box.
|
||||
|
||||
.. _err0010:
|
||||
|
||||
Unrecognized pair style ... is part of ... package which is not enabled in this LAMMPS binary
|
||||
---------------------------------------------------------------------------------------------
|
||||
|
||||
The LAMMPS executable (binary) being used was not compiled with a package
|
||||
containing the specified pair style. This indicates that the executable needs to
|
||||
be re-built after enabling the correct package in the relevant Makefile or CMake
|
||||
build directory. See :doc:`Section 3. Build LAMMPS <Build>` for more details.
|
||||
One can check if the expected package and pair style is present in the
|
||||
executable by running it with the ``-help`` (or ``-h``) flag on the command
|
||||
line. One common oversight, especially for beginner LAMMPS users, is to enable
|
||||
the package, but to forget to run commands to rebuild (e.g., to run the final
|
||||
``make`` or ``cmake`` command).
|
||||
|
||||
If this error is occurring with an executable that the user does not control
|
||||
(e.g., through a module on HPC clusters), the user will need to get in contact
|
||||
with the relevant person or people who can update the executable.
|
||||
|
||||
.. _err0012:
|
||||
|
||||
fmt::format_error
|
||||
-----------------
|
||||
|
||||
LAMMPS uses the `{fmt} library <https://fmt.dev>`_ for advanced string
|
||||
formatting tasks. This is similar to the ``printf()`` family of
|
||||
functions from the standard C library, but more flexible. If there is a
|
||||
bug in the LAMMPS code and the format string does not match the list of
|
||||
arguments or has some other error, this error message will be shown.
|
||||
You should contact the LAMMPS developers and report the bug as a `GitHub
|
||||
Bug Report Issue <https://github.com/lammps/lammps/issues>`_ along with
|
||||
sufficient information to easily reproduce it.
|
||||
|
||||
|
||||
.. _err0013:
|
||||
|
||||
Substitution for illegal variable
|
||||
---------------------------------
|
||||
|
||||
A variable in an input script or a variable expression was not found in
|
||||
the list of valid variables. The most common reason for this is a typo
|
||||
somewhere in the input file such that the expression uses an invalid variable
|
||||
name. The second most common reason is omitting the curly braces for a
|
||||
direct variable with a name that is not a single letter. For example:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
variable cutoff index 10.0
|
||||
pair_style lj/cut ${cutoff} # this is correct
|
||||
pair_style lj/cut $cutoff # this is incorrect, LAMMPS looks for 'c' instead of 'cutoff'
|
||||
variable c index 5.0 # if $c is defined, LAMMPS subsitutes only '$c' and reads: 5utoff
|
||||
|
||||
Another potential source of this error may be invalid command line
|
||||
variables (-var or -v argument) used when launching LAMMPS from an
|
||||
interactive shell or shell scripts. An uncommon source for this error
|
||||
is using the :doc:`next command <next>` to advance through a list of values
|
||||
provided by an index style variable. If there is no remaining element in
|
||||
the list, LAMMPS will delete the variable and any following expansion or
|
||||
reference attempt will trigger the error.
|
||||
|
||||
Users with harder-to-track variable errors might also find reading
|
||||
:doc:`Section 5.2. Parsing rules for input scripts<Commands_parse>`
|
||||
helpful.
|
||||
|
||||
.. _err0014:
|
||||
|
||||
Bond atom missing in image check or box size check
|
||||
--------------------------------------------------
|
||||
|
||||
This can be either an error or a warning depending on your
|
||||
:doc:`thermo_modify settings <thermo_modify>`. It is flagged in a part
|
||||
of the LAMMPS code where it updates the domain decomposition and before
|
||||
it builds the neighbor lists. It checks that both atoms of a bond are
|
||||
within the communication cutoff of a subdomain. It is usually caused by
|
||||
atoms moving too fast (see the :ref:`paragraph on fast moving atoms
|
||||
<hint05>`), or by the :doc:`communication cutoff being too
|
||||
small <comm_modify>`, or by waiting too long between :doc:`sub-domain
|
||||
and neighbor list updates <neigh_modify>`.
|
||||
|
||||
.. _err0015:
|
||||
|
||||
Cannot use neighbor bins - box size \<\< cutoff
|
||||
-----------------------------------------------
|
||||
|
||||
LAMMPS is unable to build neighbor bins since the size of the box is
|
||||
much smaller than an interaction cutoff in at least one of its dimensions.
|
||||
Typically, this error is triggered when the simulation box has one very
|
||||
thin dimension. If a cubic neighbor bin had to fit exactly within
|
||||
the thin dimension, then an inordinate amount of bins would be created to
|
||||
fill space. This error can be avoided using the generally slower
|
||||
:doc:`nsq neighbor style <neighbor>` or by increasing the size of the
|
||||
smallest box lengths.
|
||||
|
||||
.. _err0016:
|
||||
|
||||
Did not assign all atoms correctly
|
||||
----------------------------------
|
||||
|
||||
This error happens most commonly when :doc:`reading a data file <read_data>`
|
||||
under :doc:`non-periodic boundary conditions<boundary>`. Only atoms with
|
||||
positions **inside** the simulation box will be read and thus any atoms
|
||||
outside the box will be skipped and the total atom count will not match,
|
||||
which triggers the error. This does not happen with periodic boundary
|
||||
conditions where atoms outside the principal box will be "wrapped" into
|
||||
the principal box and their image flags set accordingly.
|
||||
|
||||
Similar errors can happen with the :doc:`replicate command<replicate>` or
|
||||
the :doc:`read_restart command<read_restart>`. In these cases the cause
|
||||
may be a problematic geometry, an insufficient communication cutoff, or
|
||||
a bug in the LAMMPS source code. In these cases it is advisable to set
|
||||
up :ref:`small test case <hint01>` for testing and debugging. This will
|
||||
be required in case you need to get help from a LAMMPS developer.
|
||||
|
||||
.. _err0017:
|
||||
|
||||
Domain too large for neighbor bins
|
||||
----------------------------------
|
||||
|
||||
The domain has become extremely large so that neighbor bins cannot
|
||||
be used. Too many neighbor bins would need to be created to fill space.
|
||||
Most likely, one or more atoms have been blown a great distance out of
|
||||
the simulation box or a fix (like fix deform or a barostat) has
|
||||
excessively grown the simulation box.
|
||||
|
||||
.. _err0018:
|
||||
|
||||
Step X: (h)bondchk failed
|
||||
-------------------------
|
||||
|
||||
This error is a consequence of the heuristic memory allocations for
|
||||
buffers of the regular ReaxFF version. In ReaxFF simulations, the lists
|
||||
of bonds and hydrogen bonds can change due to chemical reactions. The
|
||||
default approach, however, assumes that these changes are not very
|
||||
large, so it allocates buffers for the current system setup plus a
|
||||
safety margin. This can be adjusted with the :doc:`safezone, mincap,
|
||||
and minhbonds settings of the pair style <pair_reaxff>`, but only to some
|
||||
extent. When equilibrating a new system, or simulating a sparse system
|
||||
in parallel, this can be difficult to control and become wasteful. A
|
||||
simple workaround is often to break a simulation down in multiple
|
||||
chunks. A better approach, however, is to compile and use the KOKKOS
|
||||
package version of ReaxFF (you do not need a GPU for that, but can also
|
||||
compile it in serial or OpenMP mode), which uses a more robust
|
||||
memory allocation approach.
|
||||
|
||||
.. _err0019:
|
||||
|
||||
Numeric index X is out of bounds
|
||||
--------------------------------
|
||||
|
||||
This error most commonly happens when setting force field coefficients
|
||||
with either the :doc:`pair_coeff <pair_coeff>`, the :doc:`bond_coeff
|
||||
<bond_coeff>`, the :doc:`angle_coeff <angle_coeff>`, the
|
||||
:doc:`dihedral_coeff <dihedral_coeff>`, or the :doc:`improper_coeff
|
||||
<improper_coeff>` command. These commands accept type labels,
|
||||
explicit numbers, and wildcards for ranges of numbers. If the numeric
|
||||
value of any of these is outside the valid range (defined by the number
|
||||
of corresponding types), LAMMPS will stop with this error. A few other
|
||||
commands and styles also allow ranges of numbers and check
|
||||
using the same method and thus print the same kind of error.
|
||||
|
||||
The cause is almost always a typo in the input or a logic error
|
||||
when defining the values or ranges. So one needs to carefully
|
||||
review the input. Along with the error, LAMMPS will print the
|
||||
valid range as a hint.
|
||||
|
||||
.. _err0020:
|
||||
|
||||
Compute, fix, or variable vector or array is accessed out-of-range
|
||||
------------------------------------------------------------------
|
||||
|
||||
When accessing an individual element of a global vector or array or a
|
||||
per-atom vector or array provided by a compute or fix or atom-style or
|
||||
vector-style variable or data from a specific atom, an index in square
|
||||
brackets ("[ ]") (or two indices) must be provided to determine which
|
||||
element to access and it must be in a valid range or else LAMMPS would
|
||||
access invalid data or crash with a segmentation fault. In the two most
|
||||
common cases, where this data is accessed, :doc:`variable expressions
|
||||
<variable>` and :doc:`thermodynamic output <thermo_style>`, LAMMPS will
|
||||
check for valid indices and stop with an error otherwise.
|
||||
|
||||
While LAMMPS is written in C++ (which uses 0 based indexing) these
|
||||
indices start at 1 (i.e. similar to Fortran). Any index smaller than 1
|
||||
or larger than the maximum allowed value should trigger this error.
|
||||
Since this kind of error frequently happens with rather complex
|
||||
expressions, it is recommended to test these with small test systems,
|
||||
where the values can be tracked with output files for all relevant
|
||||
properties at every step.
|
||||
|
||||
.. _err0021:
|
||||
|
||||
Incorrect args for pair coefficients (also bond/angle/dihedral/improper coefficients)
|
||||
-------------------------------------------------------------------------------------
|
||||
|
||||
The parameters in the :doc:`pair_coeff <pair_coeff>` command for a specified
|
||||
:doc:`pair_style <pair_style>` have a missing or erroneous argument. The same
|
||||
applies when seeing this error for :doc:`bond_coeff <bond_coeff>`,
|
||||
:doc:`angle_coeff <angle_coeff>`, :doc:`dihedral_coeff <dihedral_coeff>`, or
|
||||
:doc:`improper_coeff <improper_coeff>` and their respective style commands when
|
||||
using the MOLECULE or EXTRA-MOLECULE packages. The cases below describe
|
||||
some ways to approach pair coefficient errors, but the same strategies
|
||||
apply to bonded systems as well.
|
||||
|
||||
Outside of normal typos, this error can have several sources. In all cases, the
|
||||
first step is to compare the command arguments to the expected format found in
|
||||
the corresponding :doc:`pair_style <pair_style>` page. This can reveal cases
|
||||
where, for example, a pair style was changed, but the pair coefficients were not
|
||||
updated. This can happen especially with pair style variants such as
|
||||
:doc:`pair_style eam <pair_eam>` vs. :doc:`pair_style eam/alloy <pair_style>`
|
||||
that look very similar but accept different parameters (the latter 'eam/alloy'
|
||||
variant takes element type names while 'eam' does not).
|
||||
|
||||
Another common source of coefficient errors is when using multiple pair styles
|
||||
with commands such as :doc:`pair_style hybrid <pair_hybrid>`. Using hybrid pair
|
||||
styles requires adding an extra "label" argument in the coefficient commands
|
||||
that designates which pair style the command line refers to. Moreover, if
|
||||
the same pair style is used multiple times, this label must be followed by
|
||||
an additional numeric argument. Also, different pair styles may require
|
||||
different arguments.
|
||||
|
||||
This error message might also require a close look at other LAMMPS input files
|
||||
that are read in by the input script, such as data files or restart files.
|
||||
|
||||
.. _err0022:
|
||||
|
||||
Energy was not tallied on needed timestep (also virial, per-atom energy, per-atom virial)
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
This error is generated when LAMMPS attempts to access an out-of-date or
|
||||
non-existent energy, pressure, or virial. For efficiency reasons,
|
||||
LAMMPS does *not* calculate these quantities when the forces are
|
||||
calculated on every timestep or iteration. Global quantities are only
|
||||
calculated when they are needed for :doc:`thermo <thermo_style>` output
|
||||
(at the beginning, end, and at regular intervals specified by the
|
||||
:doc:`thermo <thermo>` command). Similarly, per-atom quantities are only
|
||||
calculated if they are needed to write per-atom energy or virial to a
|
||||
dump file. This system works fine for simple input scripts. However,
|
||||
the many user-specified `variable`, `fix`, and `compute` commands that
|
||||
LAMMPS provides make it difficult to anticipate when a quantity will be
|
||||
requested. In some use cases, LAMMPS will figure out that a quantity is
|
||||
needed and arrange for it to be calculated on that timestep e.g. if it
|
||||
is requested by :doc:`fix ave/time <fix_ave_time>` or similar commands.
|
||||
If that fails, it can be detected by a mismatch between the current
|
||||
timestep and when a quantity was last calculated, in which case an error
|
||||
message of this type is generated.
|
||||
|
||||
The most common cause of this type of error is requesting a quantity before
|
||||
the start of the simulation.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
# run 0 post no # this will fix the error
|
||||
variable e equal pe # requesting energy compute
|
||||
print "Potential energy = $e" # this will generate the error
|
||||
run 1000 # start of simulation
|
||||
|
||||
This situation can be avoided by adding in a "run 0" command, as explained in
|
||||
more detail in the "Variable Accuracy" section of the
|
||||
:doc:`variable <variable>` doc page.
|
||||
|
||||
Another cause is requesting a quantity on a timestep that is not
|
||||
a thermo or dump output timestep. This can often be
|
||||
remedied by increasing the frequency of thermo or dump output.
|
||||
|
||||
.. _err0023:
|
||||
|
||||
Molecule auto special bond generation overflow
|
||||
----------------------------------------------
|
||||
|
||||
In order to correctly apply the :doc:`special_bonds <special_bonds>`
|
||||
settings (also known as "exclusions"), LAMMPS needs to maintain for each
|
||||
atom a list of atoms that are connected to this atom, either directly with
|
||||
a bond or indirectly through bonding with an intermediate atom(s). The purpose
|
||||
is to either remove or tag those pairs of atoms in the neighbor list. This
|
||||
information is stored with individual
|
||||
atoms and thus the maximum number of such "special" neighbors is set
|
||||
when the simulation box is created. When reading (relative) geometry
|
||||
and topology of a 'molecule' from a :doc:`molecule file <molecule>`,
|
||||
LAMMPS will build the list of such "special" neighbors for the molecule atom
|
||||
(if not given in the molecule file explicitly). The error is triggered
|
||||
when the resulting list is too long for the space reserved when
|
||||
creating the simulation box. The solution is to increase the
|
||||
corresponding setting. Overestimating this value will only consume
|
||||
more memory, and is thus a safe choice.
|
||||
|
||||
.. _err0024:
|
||||
|
||||
Molecule topology/atom exceeds system topology/atom
|
||||
---------------------------------------------------
|
||||
|
||||
LAMMPS uses :doc:`domain decomposition <Developer_par_part>` to
|
||||
distribute data (i.e. atoms) across the MPI processes in parallel
|
||||
runs. This includes topology data about bonds, angles,
|
||||
dihedrals, impropers and :doc:`"special" neighbors <special_bonds>`.
|
||||
This information is stored with either one or all atoms involved in such
|
||||
a topology entry (which of the two option applies depends on the
|
||||
:doc:`newton <newton>` setting for bonds). When reading a data file,
|
||||
LAMMPS analyzes the requirements for this file and then the values are
|
||||
"locked in" and cannot be extended.
|
||||
|
||||
So loading a molecule file that requires more of the topology per atom
|
||||
storage or adding a data file with such needs will lead to an error. To
|
||||
avoid the error, one or more of the `extra/XXX/per/atom` keywords are
|
||||
required to extend the corresponding storage. It is no problem to
|
||||
choose those numbers generously and have more storage reserved than
|
||||
actually needed, but having these numbers set too small will lead to an
|
||||
error.
|
||||
|
||||
.. _err0025:
|
||||
|
||||
Molecule topology type exceeds system topology type
|
||||
---------------------------------------------------
|
||||
|
||||
The total number of atom, bond, angle, dihedral, and improper types is
|
||||
"locked in" when LAMMPS creates the simulation box. This can happen
|
||||
through either the :doc:`create_box <create_box>`, the :doc:`read_data
|
||||
<read_data>`, or the :doc:`read_restart <read_restart>` command. After
|
||||
this it is not possible to refer to an additional type. So loading a
|
||||
molecule file that uses additional types or adding a data file that
|
||||
would require additional types will lead to an error. To avoid the
|
||||
error, one or more of the `extra/XXX/types` keywords are required to
|
||||
extend the maximum number of the individual types.
|
||||
|
||||
.. _err0026:
|
||||
|
||||
Molecule attributes do not match system attributes
|
||||
--------------------------------------------------
|
||||
|
||||
Choosing an :doc:`atom_style <atom_style>` in LAMMPS determines which
|
||||
per-atom properties are available. In a :doc:`molecule file
|
||||
<molecule>`, however, it is possible to add sections (for example Masses
|
||||
or Charges) that are not supported by the atom style. Masses for
|
||||
example, are usually not a per-atom property, but defined through the
|
||||
atom type. Thus it would not be required to have a Masses section and
|
||||
the included data would be ignored. LAMMPS prints this warning to
|
||||
inform about this case.
|
||||
|
||||
.. _err0027:
|
||||
|
||||
Inconsistent image flags
|
||||
------------------------
|
||||
|
||||
This warning happens when the distance between the *unwrapped* x-, y-,
|
||||
or z-components of the coordinates of a bond is larger than half the box
|
||||
with periodic boundaries or larger than the box with non-periodic
|
||||
boundaries. It means that the positions and image flags have become
|
||||
inconsistent. LAMMPS will still compute bonded interactions based on
|
||||
the closest periodic images of the atoms and thus in most cases the
|
||||
results will be correct. Nevertheless, it is good practice to update
|
||||
the system so that the message does not appear. It will help with
|
||||
future manipulations of the system.
|
||||
|
||||
There is one case where this warning *must* appear: when you have a
|
||||
chain of connected bonds that pass through the entire box and connect
|
||||
back to the first atom in the chain through periodic boundaries,
|
||||
i.e. some kind of "infinite polymer". In that case, the bond image
|
||||
flags *must* be inconsistent for the one bond that reaches back to the
|
||||
beginning of the chain.
|
||||
|
||||
|
||||
.. _err0028:
|
||||
|
||||
No fixes with time integration, atoms won't move
|
||||
------------------------------------------------
|
||||
|
||||
This warning will be issued if LAMMPS encounters a :doc:`run <run>` command that
|
||||
does not have a preceding :doc:`fix <fix>` command that updates atom/object
|
||||
positions and velocities per step. In other words, there are no fixes detected
|
||||
that perform velocity-Verlet time integration, such as :doc:`fix nve <fix_nve>`.
|
||||
Note that this alert does not mean that there are no active fixes. LAMMPS has a
|
||||
very wide variety of fixes, many of which do not move objects but also operate
|
||||
through steps, such as printing outputs (e.g. :doc:`fix print <fix_print>`),
|
||||
performing calculations (e.g. :doc:`fix ave/time <fix_ave_time>`), or changing
|
||||
other system parameters (e.g. :doc:`fix dt/reset <fix_dt_reset>`). It is up to
|
||||
the user to determine whether the lack of a time-integrating fix is intentional
|
||||
or not.
|
||||
|
||||
|
||||
.. _err0029:
|
||||
|
||||
System is not charge neutral, net charge = ...
|
||||
----------------------------------------------
|
||||
|
||||
the sum of charges in the system is not zero. When a system is not
|
||||
charge-neutral, methods that evolve/manipulate per-atom charges, evaluate
|
||||
Coulomb interactions, evaluate Coulomb forces, or evaluate/manipulate other
|
||||
properties relying on per-atom charges may raise this warning. A non-zero
|
||||
net charge most commonly arises after setting per-atom charges :doc:`set <set>`
|
||||
such that the sum is non-zero or by reading in a system through :doc:`read_data
|
||||
<read_data>` where the per-atom charges do not sum to zero. However, a loss of
|
||||
charge neutrality may occur in other less common ways, like when charge
|
||||
equilibration methods (e.g., :doc:`fix qeq <fix_qeq>`) fail.
|
||||
|
||||
A similar warning/error may be raised when using certain charge equilibration
|
||||
methods: :doc:`fix qeq <fix_qeq>`, :doc:`fix qeq/comb <fix_qeq_comb>`, :doc:`fix
|
||||
qeq/reaxff <fix_qeq_reaxff>`, and :doc:`fix qtpie/reaxff <fix_qtpie_reaxff>`. In
|
||||
such cases, this warning/error will be raised for the fix :doc:`group <group>`
|
||||
when the group has a non-zero net charge.
|
||||
|
||||
When the system is expected to be charge-neutral, this warning often arises due
|
||||
to an error in the lammps input (e.g., an incorrect :doc:`set <set>` command,
|
||||
error in the data file read by :doc:`read_data <read_data>`, incorrectly
|
||||
grouping atoms with charge, etc.). If the system is NOT expected to be
|
||||
charge-neutral, the user should make sure that the method(s) used are
|
||||
appropriate for systems with a non-zero net charge. Some commonly used fixes for
|
||||
charge equilibration :doc:`fix qeq <fix_qeq>`, pair styles that include charge
|
||||
interactions :doc:`pair_style coul/XXX <pair_coul>`, and kspace methods
|
||||
:doc:`kspace_style <kspace_style>` can, in theory, support systems with non-zero
|
||||
net charge. However, non-zero net charge can lead to spurious artifacts. The
|
||||
severity of these artifacts depends on the magnitude of total charge, system
|
||||
size, and methods used. Before running simulations or calculations for systems
|
||||
with non-zero net charge, users should test for artifacts and convergence of
|
||||
properties.
|
||||
|
||||
.. _err0030:
|
||||
|
||||
Variable evaluation before simulation box is defined
|
||||
----------------------------------------------------
|
||||
|
||||
This error happens, when trying to expand or use an equal- or atom-style
|
||||
variable (or an equivalent style), where the expression contains a
|
||||
reference to something (e.g. a compute reference, a property of an atom,
|
||||
or a thermo keyword) that is not allowed to be used before the
|
||||
simulation box is defined. See the paragraph on :ref:`errors before or
|
||||
after the simulation box is created <hint12>` for additional
|
||||
information.
|
||||
|
||||
.. _err0031:
|
||||
|
||||
Invalid thermo keyword 'X' in variable formula
|
||||
----------------------------------------------
|
||||
|
||||
This error message is often misleading. It is caused when evaluating a
|
||||
:doc:`variable command <variable>` expression and LAMMPS comes across a
|
||||
string that it does not recognize. LAMMPS first checks if a string is a
|
||||
reference to a compute, fix, custom property, or another variable by
|
||||
looking at the first 2-3 characters (and if it is, it checks whether the
|
||||
referenced item exists). Next LAMMPS checks if the string matches one
|
||||
of the available functions or constants. If that fails, LAMMPS will
|
||||
assume that this string is a :doc:`thermo keyword <thermo_style>` and
|
||||
let the code for printing thermodynamic output return the corresponding
|
||||
value. However, if this fails too, since the string is not a thermo
|
||||
keyword, LAMMPS stops with the 'Invalid thermo keyword' error. But it
|
||||
is also possible, that there is just a typo in the name of a valid
|
||||
variable function. Thus it is recommended to check the failing variable
|
||||
expression very carefully.
|
||||
|
||||
@ -6233,8 +6233,9 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
|
||||
Atom IDs must be positive integers.
|
||||
|
||||
*One or more atom IDs is too big*
|
||||
The limit on atom IDs is set by the SMALLBIG, BIGBIG, SMALLSMALL
|
||||
setting in your LAMMPS build. See the :doc:`Build settings <Build_settings>` page for more info.
|
||||
The limit on atom IDs is set by the SMALLBIG, BIGBIG
|
||||
setting in your LAMMPS build. See the
|
||||
:doc:`Build settings <Build_settings>` page for more info.
|
||||
|
||||
*One or more atom IDs is zero*
|
||||
Either all atoms IDs must be zero or none of them.
|
||||
@ -7774,7 +7775,7 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
|
||||
*Too few values in body section of molecule file*
|
||||
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
|
||||
package command in the input script instead.
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ Lowercase directories
|
||||
+-------------+------------------------------------------------------------------+
|
||||
| body | body particles, 2d system |
|
||||
+-------------+------------------------------------------------------------------+
|
||||
| bpm | BPM simulations of pouring elastic grains and plate impact |
|
||||
| bpm | simulations of solid elastic/plastic deformation and fracture |
|
||||
+-------------+------------------------------------------------------------------+
|
||||
| cmap | CMAP 5-body contributions to CHARMM force field |
|
||||
+-------------+------------------------------------------------------------------+
|
||||
@ -146,6 +146,8 @@ Lowercase directories
|
||||
+-------------+------------------------------------------------------------------+
|
||||
| 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 |
|
||||
+-------------+------------------------------------------------------------------+
|
||||
| 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
|
||||
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
|
||||
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
|
||||
|
||||
@ -91,12 +91,12 @@ function and triggered with the optional logical argument set to
|
||||
CALL lmp%close(.TRUE.)
|
||||
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
|
||||
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
|
||||
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:
|
||||
|
||||
.. code-block:: fortran
|
||||
@ -108,7 +108,7 @@ version of the previous example:
|
||||
CHARACTER(LEN=128), ALLOCATABLE :: command_args(:)
|
||||
INTEGER :: i, argc
|
||||
|
||||
! copy command line flags to `command_args()`
|
||||
! copy command-line flags to `command_args()`
|
||||
argc = COMMAND_ARGUMENT_COUNT()
|
||||
ALLOCATE(command_args(0:argc))
|
||||
DO i=0, argc
|
||||
@ -321,6 +321,14 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS.
|
||||
:ftype set_string_variable: subroutine
|
||||
:f set_internal_variable: :f:subr:`set_internal_variable`
|
||||
:ftype set_internal_variable: subroutine
|
||||
:f eval: :f:func:`eval`
|
||||
:ftype eval: function
|
||||
:f clearstep_compute: :f:subr:`clearstep_compute`
|
||||
:ftype clearstep_compute: subroutine
|
||||
:f addstep_compute: :f:subr:`addstep_compute`
|
||||
:ftype addstep_compute: subroutine
|
||||
:f addstep_compute_all: :f:subr:`addstep_compute_all`
|
||||
:ftype addstep_compute_all: subroutine
|
||||
:f gather_atoms: :f:subr:`gather_atoms`
|
||||
:ftype gather_atoms: subroutine
|
||||
:f gather_atoms_concat: :f:subr:`gather_atoms_concat`
|
||||
@ -448,7 +456,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
|
||||
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.
|
||||
If *comm* is not provided, ``MPI_COMM_WORLD`` is assumed. For
|
||||
more details please see the documentation of :cpp:func:`lammps_open`.
|
||||
@ -954,6 +962,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
:f:func:`extract_atom` between runs.
|
||||
|
||||
.. admonition:: Array index order
|
||||
:class: tip
|
||||
|
||||
Two-dimensional arrays returned from :f:func:`extract_atom` will be
|
||||
**transposed** from equivalent arrays in C, and they will be indexed
|
||||
@ -1066,6 +1075,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
you based on data from the :cpp:class:`Compute` class.
|
||||
|
||||
.. admonition:: Array index order
|
||||
:class: tip
|
||||
|
||||
Two-dimensional arrays returned from :f:func:`extract_compute` will be
|
||||
**transposed** from equivalent arrays in C, and they will be indexed
|
||||
@ -1324,6 +1334,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
:rtype data: polymorphic
|
||||
|
||||
.. admonition:: Array index order
|
||||
:class: tip
|
||||
|
||||
Two-dimensional global, per-atom, or local array data from
|
||||
:f:func:`extract_fix` will be **transposed** from equivalent arrays in
|
||||
@ -1448,11 +1459,62 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
an internal-style variable, an error is generated.
|
||||
|
||||
:p character(len=*) name: name of the variable
|
||||
:p read(c_double) val: new value to assign to the variable
|
||||
:p real(c_double) val: new value to assign to the variable
|
||||
:to: :cpp:func:`lammps_set_internal_variable`
|
||||
|
||||
--------
|
||||
|
||||
.. f:function:: eval(expr)
|
||||
|
||||
This function is a wrapper around :cpp:func:`lammps_eval` that takes a
|
||||
LAMMPS equal style variable string, evaluates it and returns the resulting
|
||||
scalar value as a floating-point number.
|
||||
|
||||
.. versionadded:: 4Feb2025
|
||||
|
||||
:p character(len=\*) expr: string to be evaluated
|
||||
:to: :cpp:func:`lammps_eval`
|
||||
:r value [real(c_double)]: result of the evaluated string
|
||||
|
||||
--------
|
||||
|
||||
.. f:subroutine:: clearstep_compute()
|
||||
|
||||
Clear whether a compute has been invoked
|
||||
|
||||
.. versionadded:: 4Feb2025
|
||||
|
||||
:to: :cpp:func:`lammps_clearstep_compute`
|
||||
|
||||
--------
|
||||
|
||||
.. f:subroutine:: addstep_compute(nextstep)
|
||||
|
||||
Add timestep to list of future compute invocations
|
||||
if the compute has been invoked on the current timestep
|
||||
|
||||
.. versionadded:: 4Feb2025
|
||||
|
||||
overloaded for 32-bit and 64-bit integer arguments
|
||||
|
||||
:p integer(kind=8 or kind=4) nextstep: next timestep
|
||||
:to: :cpp:func:`lammps_addstep_compute`
|
||||
|
||||
--------
|
||||
|
||||
.. f:subroutine:: addstep_compute_all(nextstep)
|
||||
|
||||
Add timestep to list of future compute invocations
|
||||
|
||||
.. versionadded:: 4Feb2025
|
||||
|
||||
overloaded for 32-bit and 64-bit integer arguments
|
||||
|
||||
:p integer(kind=8 or kind=4) nextstep: next timestep
|
||||
:to: :cpp:func:`lammps_addstep_compute_all`
|
||||
|
||||
--------
|
||||
|
||||
.. f:subroutine:: gather_atoms(name, count, data)
|
||||
|
||||
This function calls :cpp:func:`lammps_gather_atoms` to gather the named
|
||||
@ -2711,8 +2773,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
||||
END SUBROUTINE external_callback
|
||||
END INTERFACE
|
||||
|
||||
where ``c_bigint`` is ``c_int`` if ``-DLAMMPS_SMALLSMALL`` was used and
|
||||
``c_int64_t`` otherwise; and ``c_tagint`` is ``c_int64_t`` if
|
||||
where ``c_bigint`` is ``c_int64_t`` and ``c_tagint`` is ``c_int64_t`` if
|
||||
``-DLAMMPS_BIGBIG`` was used and ``c_int`` otherwise.
|
||||
|
||||
The argument *caller* to :f:subr:`set_fix_external_callback` is unlimited
|
||||
|
||||
@ -103,6 +103,7 @@ Tutorials howto
|
||||
Howto_github
|
||||
Howto_lammps_gui
|
||||
Howto_moltemplate
|
||||
Howto_python
|
||||
Howto_pylammps
|
||||
Howto_wsl
|
||||
|
||||
|
||||
@ -10,20 +10,21 @@ and/or pressure (P) is specified by the user, and the thermostat or
|
||||
barostat attempts to equilibrate the system to the requested T and/or
|
||||
P.
|
||||
|
||||
Barostatting in LAMMPS is performed by :doc:`fixes <fix>`. Two
|
||||
Barostatting in LAMMPS is performed by :doc:`fixes <fix>`. Three
|
||||
barostatting methods are currently available: Nose-Hoover (npt and
|
||||
nph) and Berendsen:
|
||||
nph), Berendsen, and various linear controllers in deform/pressure:
|
||||
|
||||
* :doc:`fix npt <fix_nh>`
|
||||
* :doc:`fix npt/sphere <fix_npt_sphere>`
|
||||
* :doc:`fix npt/asphere <fix_npt_asphere>`
|
||||
* :doc:`fix nph <fix_nh>`
|
||||
* :doc:`fix press/berendsen <fix_press_berendsen>`
|
||||
* :doc:`fix deform/pressure <fix_deform_pressure>`
|
||||
|
||||
The :doc:`fix npt <fix_nh>` commands include a Nose-Hoover thermostat
|
||||
and barostat. :doc:`Fix nph <fix_nh>` is just a Nose/Hoover barostat;
|
||||
it does no thermostatting. Both :doc:`fix nph <fix_nh>` and :doc:`fix press/berendsen <fix_press_berendsen>` can be used in conjunction
|
||||
with any of the thermostatting fixes.
|
||||
it does no thermostatting. The fixes :doc:`nph <fix_nh>`, :doc:`press/berendsen <fix_press_berendsen>`, and :doc:`deform/pressure <fix_deform_pressure>`
|
||||
can be used in conjunction with any of the thermostatting fixes.
|
||||
|
||||
As with the :doc:`thermostats <Howto_thermostat>`, :doc:`fix npt <fix_nh>`
|
||||
and :doc:`fix nph <fix_nh>` only use translational motion of the
|
||||
@ -44,9 +45,9 @@ a temperature or pressure compute to a barostatting fix.
|
||||
.. note::
|
||||
|
||||
As with the thermostats, the Nose/Hoover methods (:doc:`fix npt <fix_nh>` and :doc:`fix nph <fix_nh>`) perform time integration.
|
||||
:doc:`Fix press/berendsen <fix_press_berendsen>` does NOT, so it should
|
||||
be used with one of the constant NVE fixes or with one of the NVT
|
||||
fixes.
|
||||
:doc:`Fix press/berendsen <fix_press_berendsen>` and :doc:`fix deform/pressure <fix_deform_pressure>`
|
||||
do NOT, so they should be used with one of the constant NVE fixes or with
|
||||
one of the NVT fixes.
|
||||
|
||||
Thermodynamic output, which can be setup via the
|
||||
:doc:`thermo_style <thermo_style>` command, often includes pressure
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
CHARMM, AMBER, COMPASS, and DREIDING force fields
|
||||
=================================================
|
||||
CHARMM, AMBER, COMPASS, DREIDING, and OPLS force fields
|
||||
=======================================================
|
||||
|
||||
A compact summary of the concepts, definitions, and properties of
|
||||
force fields with explicit bonded interactions (like the ones discussed
|
||||
@ -236,6 +236,40 @@ documentation for the formula it computes.
|
||||
|
||||
* :doc:`special_bonds <special_bonds>` dreiding
|
||||
|
||||
OPLS
|
||||
----
|
||||
|
||||
OPLS (Optimized Potentials for Liquid Simulations) is a general force
|
||||
field for atomistic simulation of organic molecules in solvent. It was
|
||||
developed by the `Jorgensen group
|
||||
<https://traken.chem.yale.edu/oplsaam.html>`_ at Purdue University and
|
||||
later at Yale University. Multiple versions of the OPLS parameters
|
||||
exist for united atom representations (OPLS-UA) and for all-atom
|
||||
representations (OPLS-AA).
|
||||
|
||||
This force field is based on atom types mapped to specific functional
|
||||
groups in organic and biological molecules. Each atom includes a
|
||||
static, partial atomic charge reflecting the oxidation state of the
|
||||
element derived from its bonded neighbors :ref:`(Jorgensen)
|
||||
<howto-jorgensen>` and computed based on increments determined by the
|
||||
atom type of the atoms bond to it.
|
||||
|
||||
The interaction styles listed below compute force field formulas that
|
||||
are fully or in part consistent with the OPLS style force fields. See
|
||||
each command's documentation for the formula it computes. Some are only
|
||||
compatible with a subset of OPLS interactions.
|
||||
|
||||
* :doc:`bond_style <bond_harmonic>` harmonic
|
||||
* :doc:`angle_style <angle_harmonic>` harmonic
|
||||
* :doc:`dihedral_style <dihedral_opls>` opls
|
||||
* :doc:`improper_style <improper_cvff>` cvff
|
||||
* :doc:`improper_style <improper_fourier>` fourier
|
||||
* :doc:`improper_style <improper_harmonic>` harmonic
|
||||
* :doc:`pair_style <pair_lj_cut_coul>` lj/cut/coul/cut
|
||||
* :doc:`pair_style <pair_lj_cut_coul>` lj/cut/coul/long
|
||||
* :doc:`pair_modify <pair_modify>` geometric
|
||||
* :doc:`special_bonds <special_bonds>` lj/coul 0.0 0.0 0.5
|
||||
|
||||
----------
|
||||
|
||||
.. _Typelabel2:
|
||||
@ -266,3 +300,6 @@ documentation for the formula it computes.
|
||||
|
||||
**(Mayo)** Mayo, Olfason, Goddard III (1990). J Phys Chem, 94, 8897-8909. https://doi.org/10.1021/j100389a010
|
||||
|
||||
.. _howto-Jorgensen:
|
||||
|
||||
**(Jorgensen)** Jorgensen, Tirado-Rives (1988). J Am Chem Soc, 110, 1657-1666. https://doi.org/10.1021/ja00214a001
|
||||
|
||||
@ -5,7 +5,11 @@ The BPM package implements bonded particle models which can be used to
|
||||
simulate mesoscale solids. Solids are constructed as a collection of
|
||||
particles, which each represent a coarse-grained region of space much
|
||||
larger than the atomistic scale. Particles within a solid region are
|
||||
then connected by a network of bonds to provide solid elasticity.
|
||||
then connected by a network of bonds to model solid elasticity.
|
||||
There are many names for methods that are based on similar (or
|
||||
equivalent) capabilities to those in this package, including, but not
|
||||
limited to, cohesive beam models, bonded DEMs, lattice spring models,
|
||||
mass spring models, and lattice particle methods.
|
||||
|
||||
Unlike traditional bonds in molecular dynamics, the equilibrium bond
|
||||
length can vary between bonds. Bonds store the reference state. This
|
||||
@ -38,11 +42,14 @@ such as those created by pouring grains using :doc:`fix pour
|
||||
|
||||
----------
|
||||
|
||||
Currently, there are two types of bonds included in the BPM package. The
|
||||
Currently, there are three types of bonds included in the BPM package. The
|
||||
first bond style, :doc:`bond bpm/spring <bond_bpm_spring>`, only applies
|
||||
pairwise, central body forces. Point particles must have :doc:`bond atom
|
||||
style <atom_style>` and may be thought of as nodes in a spring
|
||||
network. Alternatively, the second bond style, :doc:`bond bpm/rotational
|
||||
network. An optional multibody term can be used to adjust the network's
|
||||
Poisson's ratio. The :doc:`bpm/spring/plastic <bond_bpm_spring_plastic>`
|
||||
bond style is similar except it adds a plastic yield strain.
|
||||
Alternatively, the third bond style, :doc:`bond bpm/rotational
|
||||
<bond_bpm_rotational>`, resolves tangential forces and torques arising
|
||||
with the shearing, bending, and twisting of the bond due to rotation or
|
||||
displacement of particles. Particles are similar to those used in the
|
||||
@ -55,8 +62,9 @@ orientation similar to :doc:`fix nve/asphere <fix_nve_asphere>`.
|
||||
|
||||
In addition to bond styles, a new pair style :doc:`pair bpm/spring
|
||||
<pair_bpm_spring>` was added to accompany the bpm/spring bond
|
||||
style. This pair style is simply a hookean repulsion with similar
|
||||
velocity damping as its sister bond style.
|
||||
style. By default, this pair style is simply a hookean repulsion with
|
||||
similar velocity damping as its sister bond style, but optional
|
||||
arguments can be used to modify the force.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -58,28 +58,30 @@ chunk ID for an individual atom can also be static (e.g. a molecule
|
||||
ID), or dynamic (e.g. what spatial bin an atom is in as it moves).
|
||||
|
||||
Note that this compute allows the per-atom output of other
|
||||
:doc:`computes <compute>`, :doc:`fixes <fix>`, and
|
||||
:doc:`variables <variable>` to be used to define chunk IDs for each
|
||||
atom. This means you can write your own compute or fix to output a
|
||||
per-atom quantity to use as chunk ID. See the :doc:`Modify <Modify>`
|
||||
doc pages for info on how to do this. You can also define a :doc:`per-atom variable <variable>` in the input script that uses a formula to
|
||||
generate a chunk ID for each atom.
|
||||
:doc:`computes <compute>`, :doc:`fixes <fix>`, and :doc:`variables
|
||||
<variable>` to be used to define chunk IDs for each atom. This means
|
||||
you can write your own compute or fix to output a per-atom quantity to
|
||||
use as chunk ID. See the :doc:`Modify <Modify>` doc pages for info on
|
||||
how to do this. You can also define a :doc:`per-atom variable
|
||||
<variable>` in the input script that uses a formula to generate a chunk
|
||||
ID for each atom.
|
||||
|
||||
Fix ave/chunk command:
|
||||
----------------------
|
||||
|
||||
This fix takes the ID of a :doc:`compute chunk/atom <compute_chunk_atom>` command as input. For each chunk,
|
||||
it then sums one or more specified per-atom values over the atoms in
|
||||
each chunk. The per-atom values can be any atom property, such as
|
||||
velocity, force, charge, potential energy, kinetic energy, stress,
|
||||
etc. Additional keywords are defined for per-chunk properties like
|
||||
density and temperature. More generally any per-atom value generated
|
||||
by other :doc:`computes <compute>`, :doc:`fixes <fix>`, and :doc:`per-atom variables <variable>`, can be summed over atoms in each chunk.
|
||||
This fix takes the ID of a :doc:`compute chunk/atom
|
||||
<compute_chunk_atom>` command as input. For each chunk, it then sums
|
||||
one or more specified per-atom values over the atoms in each chunk. The
|
||||
per-atom values can be any atom property, such as velocity, force,
|
||||
charge, potential energy, kinetic energy, stress, etc. Additional
|
||||
keywords are defined for per-chunk properties like density and
|
||||
temperature. More generally any per-atom value generated by other
|
||||
:doc:`computes <compute>`, :doc:`fixes <fix>`, and :doc:`per-atom
|
||||
variables <variable>`, can be summed over atoms in each chunk.
|
||||
|
||||
Similar to other averaging fixes, this fix allows the summed per-chunk
|
||||
values to be time-averaged in various ways, and output to a file. The
|
||||
fix produces a global array as output with one row of values per
|
||||
chunk.
|
||||
fix produces a global array as output with one row of values per chunk.
|
||||
|
||||
Compute \*/chunk commands:
|
||||
--------------------------
|
||||
@ -97,17 +99,20 @@ category:
|
||||
* :doc:`compute torque/chunk <compute_vcm_chunk>`
|
||||
* :doc:`compute vcm/chunk <compute_vcm_chunk>`
|
||||
|
||||
They each take the ID of a :doc:`compute chunk/atom <compute_chunk_atom>` command as input. As their names
|
||||
indicate, they calculate the center-of-mass, radius of gyration,
|
||||
moments of inertia, mean-squared displacement, temperature, torque,
|
||||
and velocity of center-of-mass for each chunk of atoms. The :doc:`compute property/chunk <compute_property_chunk>` command can tally the
|
||||
count of atoms in each chunk and extract other per-chunk properties.
|
||||
They each take the ID of a :doc:`compute chunk/atom
|
||||
<compute_chunk_atom>` command as input. As their names indicate, they
|
||||
calculate the center-of-mass, radius of gyration, moments of inertia,
|
||||
mean-squared displacement, temperature, torque, and velocity of
|
||||
center-of-mass for each chunk of atoms. The :doc:`compute
|
||||
property/chunk <compute_property_chunk>` command can tally the count of
|
||||
atoms in each chunk and extract other per-chunk properties.
|
||||
|
||||
The reason these various calculations are not part of the :doc:`fix ave/chunk command <fix_ave_chunk>`, is that each requires a more
|
||||
The reason these various calculations are not part of the :doc:`fix
|
||||
ave/chunk command <fix_ave_chunk>`, is that each requires a more
|
||||
complicated operation than simply summing and averaging over per-atom
|
||||
values in each chunk. For example, many of them require calculation
|
||||
of a center of mass, which requires summing mass\*position over the
|
||||
atoms and then dividing by summed mass.
|
||||
values in each chunk. For example, many of them require calculation of
|
||||
a center of mass, which requires summing mass\*position over the atoms
|
||||
and then dividing by summed mass.
|
||||
|
||||
All of these computes produce a global vector or global array as
|
||||
output, with one or more values per chunk. The output can be used in
|
||||
@ -118,9 +123,10 @@ various ways:
|
||||
* As input to the :doc:`fix ave/histo <fix_ave_histo>` command to
|
||||
histogram values across chunks. E.g. a histogram of cluster sizes or
|
||||
molecule diffusion rates.
|
||||
* As input to special functions of :doc:`equal-style variables <variable>`, like sum() and max() and ave(). E.g. to
|
||||
find the largest cluster or fastest diffusing molecule or average
|
||||
radius-of-gyration of a set of molecules (chunks).
|
||||
* As input to special functions of :doc:`equal-style variables
|
||||
<variable>`, like sum() and max() and ave(). E.g. to find the largest
|
||||
cluster or fastest diffusing molecule or average radius-of-gyration of
|
||||
a set of molecules (chunks).
|
||||
|
||||
Other chunk commands:
|
||||
---------------------
|
||||
@ -138,9 +144,10 @@ spatially average per-chunk values calculated by a per-chunk compute.
|
||||
|
||||
The :doc:`compute reduce/chunk <compute_reduce_chunk>` command reduces a
|
||||
peratom value across the atoms in each chunk to produce a value per
|
||||
chunk. When used with the :doc:`compute chunk/spread/atom <compute_chunk_spread_atom>` command it can
|
||||
create peratom values that induce a new set of chunks with a second
|
||||
:doc:`compute chunk/atom <compute_chunk_atom>` command.
|
||||
chunk. When used with the :doc:`compute chunk/spread/atom
|
||||
<compute_chunk_spread_atom>` command it can create peratom values that
|
||||
induce a new set of chunks with a second :doc:`compute chunk/atom
|
||||
<compute_chunk_atom>` command.
|
||||
|
||||
Example calculations with chunks
|
||||
--------------------------------
|
||||
|
||||
@ -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
|
||||
a separately installed CMake package, both using the native Microsoft Visual C++
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
@ -376,7 +376,7 @@ Using presets
|
||||
-------------
|
||||
|
||||
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
|
||||
consistently and that is rather error prone. Or when enabling certain
|
||||
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
|
||||
represent a way to pre-load or override the CMake configuration cache by
|
||||
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:
|
||||
|
||||
.. 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,
|
||||
respectively, and then *git commit* to finalize the commit.
|
||||
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
|
||||
distributions written in Tk, i.e. use *git gui* (on some Linux
|
||||
distributions it may be required to install an additional package to
|
||||
@ -487,10 +487,10 @@ updates are back-ported from the *develop* branch to the *maintenance*
|
||||
branch and occasionally merged to *stable* as an update release.
|
||||
|
||||
Furthermore, the naming of the release tags now follow the pattern
|
||||
"patch_<Day><Month><Year>" to simplify comparisons between releases.
|
||||
For stable releases additional "stable_<Day><Month><Year>" tags are
|
||||
"patch\_<Day><Month><Year>" to simplify comparisons between releases.
|
||||
For stable releases additional "stable\_<Day><Month><Year>" tags are
|
||||
applied and update releases are tagged with
|
||||
"stable_<Day><Month><Year>_update<Number>", Finally, all releases and
|
||||
"stable\_<Day><Month><Year>\_update<Number>", Finally, all releases and
|
||||
submissions are subject to automatic testing and code checks to make
|
||||
sure they compile with a variety of compilers and popular operating
|
||||
systems. Some unit and regression testing is applied as well.
|
||||
|
||||
@ -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
|
||||
Sur or later), and Windows (version 10 or later) :ref:`are available
|
||||
<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.
|
||||
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
|
||||
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>`.
|
||||
|
||||
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:
|
||||
|
||||
- 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
|
||||
external software
|
||||
|
||||
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
|
||||
adopt this workflow when running LAMMPS simulations on high-performance
|
||||
computing facilities.
|
||||
@ -61,13 +64,18 @@ simple LAMMPS simulations. It is very suitable for tutorials on LAMMPS
|
||||
since you only need to learn how to use a single program for most tasks
|
||||
and thus time can be saved and people can focus on learning LAMMPS.
|
||||
The tutorials at https://lammpstutorials.github.io/ are specifically
|
||||
updated for use with LAMMPS-GUI.
|
||||
updated for use with LAMMPS-GUI and can their tutorial materials can
|
||||
be downloaded and loaded directly from the GUI.
|
||||
|
||||
Another design goal is to keep the barrier low when replacing part of
|
||||
the functionality of LAMMPS-GUI with external tools. That said, LAMMPS-GUI
|
||||
has some unique functionality that is not found elsewhere:
|
||||
|
||||
- auto-adapting to features available in the integrated LAMMPS library
|
||||
- auto-completion for LAMMPS commands and options
|
||||
- context-sensitive online help
|
||||
- start and stop of simulations via mouse or keyboard
|
||||
- monitoring of simulation progress
|
||||
- interactive visualization using the :doc:`dump image <dump_image>`
|
||||
command with the option to copy-paste the resulting settings
|
||||
- automatic slide show generation from dump image out at runtime
|
||||
@ -100,10 +108,11 @@ MacOS 11 and later
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
After downloading the ``LAMMPS-macOS-multiarch-GUI-<version>.dmg``
|
||||
installer package, you need to double-click it and then, in the window
|
||||
that opens, drag the app bundle as indicated into the "Applications"
|
||||
folder. The follow the instructions in the "README.txt" file to
|
||||
get access to the other included executables.
|
||||
application bundle disk image, you need to double-click it and then, in
|
||||
the window that opens, drag the app bundle as indicated into the
|
||||
"Applications" folder. Afterwards, the disk image can be unmounted.
|
||||
Then follow the instructions in the "README.txt" file to get access to
|
||||
the other included command-line executables.
|
||||
|
||||
Linux on x86\_64
|
||||
^^^^^^^^^^^^^^^^
|
||||
@ -117,15 +126,25 @@ into the "LAMMPS_GUI" folder and execute "./lammps-gui" directly.
|
||||
|
||||
The second variant uses `flatpak <https://www.flatpak.org>`_ and
|
||||
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
|
||||
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
|
||||
"Applications > Science" but also can be launched from the console with
|
||||
``flatpak run org.lammps.lammps-gui``. The flatpak bundle also includes
|
||||
the console LAMMPS executable ``lmp`` which can be launched to run
|
||||
simulations with, for example: ``flatpak run --command=lmp
|
||||
org.lammps.lammps-gui -in in.melt``.
|
||||
simulations with, for example with:
|
||||
|
||||
.. 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
|
||||
@ -165,9 +184,9 @@ window is stored when exiting and restored when starting again.
|
||||
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
|
||||
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
|
||||
exists. All further arguments are ignored. Files can also be opened via
|
||||
the *File* menu, the `Ctrl-O` (`Command-O` on macOS) keyboard shortcut
|
||||
@ -261,14 +280,21 @@ Output Window
|
||||
|
||||
By default, when starting a run, an *Output* window opens that displays
|
||||
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
|
||||
:align: center
|
||||
:scale: 50%
|
||||
|
||||
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.
|
||||
The runs are counted and the run number for the current run is displayed
|
||||
@ -398,7 +424,7 @@ below.
|
||||
Like for the *Output* and *Charts* windows, its content is continuously
|
||||
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
|
||||
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.
|
||||
LAMMPS-GUI automatically defines the variable "gui_run" to the current
|
||||
value of the run counter. That way it is possible to automatically
|
||||
@ -775,11 +801,11 @@ General Settings:
|
||||
|
||||
- *Echo input to log:* when checked, all input commands, including
|
||||
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`.
|
||||
- *Include citation details:* when checked full citation info will be
|
||||
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
|
||||
LAMMPS run will be collected in a log window during the run
|
||||
- *Show chart window by default:* when checked, the thermodynamic
|
||||
@ -828,7 +854,7 @@ Accelerators:
|
||||
|
||||
This tab enables selection of an accelerator package for LAMMPS to use
|
||||
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
|
||||
the maximum number of threads for the accelerator packages that use
|
||||
threads.
|
||||
|
||||
@ -2,14 +2,18 @@ Moltemplate Tutorial
|
||||
====================
|
||||
|
||||
In this tutorial, we are going to use the tool :ref:`Moltemplate
|
||||
<moltemplate>` to set up a classical molecular dynamic simulation using
|
||||
the :ref:`OPLS-AA force field <OPLSAA96>`. The first
|
||||
task is to describe an organic compound and create a complete input deck
|
||||
for LAMMPS. The second task is to map the OPLS-AA force field to a
|
||||
molecular sample created with an external tool, e.g. PACKMOL, and
|
||||
exported as a PDB file. The files used in this tutorial can be found
|
||||
in the ``tools/moltemplate/tutorial-files`` folder of the LAMMPS
|
||||
source code distribution.
|
||||
<Moltemplate1>` from https://moltemplate.org/ to set up a classical
|
||||
molecular dynamic simulation using the :ref:`OPLS-AA force field
|
||||
<oplsaa2024>`. The first task is to describe an organic compound and
|
||||
create a complete input deck for LAMMPS. The second task is to use
|
||||
moltemplate to build a polymer. The third task is to map the OPLS-AA
|
||||
force field to a molecular sample created with an external tool,
|
||||
e.g. PACKMOL, and exported as a PDB file. The files used in this
|
||||
tutorial can be found in the ``tools/moltemplate/tutorial-files`` folder
|
||||
of the LAMMPS source code distribution.
|
||||
|
||||
Many more examples can be found here: https://moltemplate.org/examples.html
|
||||
|
||||
|
||||
Simulating an organic solvent
|
||||
"""""""""""""""""""""""""""""
|
||||
@ -17,14 +21,13 @@ Simulating an organic solvent
|
||||
This example aims to create a cubic box of the organic solvent
|
||||
formamide.
|
||||
|
||||
The first step is to create a molecular topology in the
|
||||
LAMMPS-template (LT) file format representing a single molecule, which
|
||||
will be stored in a Moltemplate object called ``_FAM inherits OPLSAA {}``.
|
||||
The first step is to create a molecular topology in the LAMMPS-template
|
||||
(LT) file format representing a single molecule, which will be
|
||||
stored in a Moltemplate object called ``_FAM inherits OPLSAA {}``.
|
||||
This command states that the object ``_FAM`` is based on an existing
|
||||
object called ``OPLSAA``, which contains OPLS-AA parameters, atom type
|
||||
definitions, partial charges, masses and bond-angle rules for many organic
|
||||
and biological compounds.
|
||||
|
||||
The atomic structure is the starting point to populate the command
|
||||
``write('Data Atoms') {}``, which will write the ``Atoms`` section in the
|
||||
LAMMPS data file. The OPLS-AA force field uses the ``atom_style full``,
|
||||
@ -36,21 +39,23 @@ to the ``molID``, except that the same variable is used for the whole
|
||||
molecule. The atom types are assigned using ``@``-type variables. The
|
||||
assignment of atom types (e.g. ``@atom:177``, ``@atom:178``) is done using
|
||||
the OPLS-AA atom types defined in the "In Charges" section of the file
|
||||
``oplsaa.lt``, looking for a reasonable match with the description of the atom.
|
||||
``oplsaa2024.lt``, looking for a reasonable match with the description of the atom.
|
||||
The resulting file (``formamide.lt``) follows:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
import /usr/local/moltemplate/moltemplate/force_fields/oplsaa2024.lt # defines OPLSAA
|
||||
|
||||
_FAM inherits OPLSAA {
|
||||
|
||||
# atomID molID atomType charge coordX coordY coordZ
|
||||
write('Data Atoms') {
|
||||
$atom:C00 $mol @atom:177 0.00 0.100 0.490 0.0
|
||||
$atom:O01 $mol @atom:178 0.00 1.091 -0.250 0.0
|
||||
$atom:N02 $mol @atom:179 0.00 -1.121 -0.181 0.0
|
||||
$atom:H03 $mol @atom:182 0.00 -2.013 0.272 0.0
|
||||
$atom:H04 $mol @atom:182 0.00 -1.056 -1.190 0.0
|
||||
$atom:H05 $mol @atom:221 0.00 0.144 1.570 0.0
|
||||
$atom:C00 $mol @atom:235 0.00 0.100 0.490 0.0
|
||||
$atom:O01 $mol @atom:236 0.00 1.091 -0.250 0.0
|
||||
$atom:N02 $mol @atom:237 0.00 -1.121 -0.181 0.0
|
||||
$atom:H03 $mol @atom:240 0.00 -2.013 0.272 0.0
|
||||
$atom:H04 $mol @atom:240 0.00 -1.056 -1.190 0.0
|
||||
$atom:H05 $mol @atom:279 0.00 0.144 1.570 0.0
|
||||
}
|
||||
|
||||
# A list of the bonds in the molecule:
|
||||
@ -64,16 +69,17 @@ The resulting file (``formamide.lt``) follows:
|
||||
}
|
||||
}
|
||||
|
||||
You don't have to specify the charge in this example because they will
|
||||
be assigned according to the atom type. Analogously, only a
|
||||
"Data Bond List" section is needed as the atom type will determine the
|
||||
bond type. The other bonded interactions (e.g. angles,
|
||||
dihedrals, and impropers) will be automatically generated by
|
||||
You don't have to specify the charge in this example because the OPLSAA
|
||||
force-field assigns charge according to the atom type. (This is not true
|
||||
when using other force fields.) A "Data Bond List" section is needed as
|
||||
the atom type will determine the bond type. The other bonded interactions
|
||||
(e.g. angles, dihedrals, and impropers) will be automatically generated by
|
||||
Moltemplate.
|
||||
|
||||
If the simulation is non-neutral, or Moltemplate complains that you have
|
||||
missing bond, angle, or dihedral types, this means at least one of your
|
||||
atom types is incorrect.
|
||||
If the simulation is not charge-neutral, or Moltemplate complains that
|
||||
you have missing bond, angle, or dihedral types, this probably means that
|
||||
at least one of your atom types is incorrect (or that perhaps there is no
|
||||
suitable atom type currently defined in the ``oplsaa2024.lt`` file).
|
||||
|
||||
The second step is to create a master file with instructions to build a
|
||||
starting structure and the LAMMPS commands to run an NPT simulation. The
|
||||
@ -81,11 +87,9 @@ master file (``solv_01.lt``) follows:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Import the force field.
|
||||
import /usr/local/moltemplate/moltemplate/force_fields/oplsaa.lt
|
||||
import formamide.lt # after oplsaa.lt, as it depends on it.
|
||||
import formamide.lt # Defines "_FAM" and OPLSAA
|
||||
|
||||
# Create the input sample.
|
||||
# Distribute the molecules on a 5x5x5 cubic grid with spacing 4.6
|
||||
solv = new _FAM [5].move( 4.6, 0, 0)
|
||||
[5].move( 0, 4.6, 0)
|
||||
[5].move( 0, 0, 4.6)
|
||||
@ -98,8 +102,11 @@ master file (``solv_01.lt``) follows:
|
||||
-11.5 11.5 zlo zhi
|
||||
}
|
||||
|
||||
# Create an input deck for LAMMPS.
|
||||
write_once("In Init"){
|
||||
# Note: The lines below in the "In Run" section are often omitted.
|
||||
|
||||
write_once("In Run"){
|
||||
# Create an input deck for LAMMPS.
|
||||
# Run an NPT simulation.
|
||||
# Input variables.
|
||||
variable run string solv_01 # output name
|
||||
variable ts equal 1 # timestep
|
||||
@ -109,12 +116,6 @@ master file (``solv_01.lt``) follows:
|
||||
variable equi equal 5000 # Equilibration steps
|
||||
variable prod equal 30000 # Production steps
|
||||
|
||||
# PBC (set them before the creation of the box).
|
||||
boundary p p p
|
||||
}
|
||||
|
||||
# Run an NPT simulation.
|
||||
write_once("In Run"){
|
||||
# Derived variables.
|
||||
variable tcouple equal \$\{ts\}*100
|
||||
variable pcouple equal \$\{ts\}*1000
|
||||
@ -143,7 +144,7 @@ master file (``solv_01.lt``) follows:
|
||||
unfix NPT
|
||||
}
|
||||
|
||||
The first two commands insert the content of files ``oplsaa.lt`` and
|
||||
The first two commands insert the content of files ``oplsaa2024.lt`` and
|
||||
``formamide.lt`` into the master file. At this point, we can use the
|
||||
command ``solv = new _FAM [N]`` to create N copies of a molecule of type
|
||||
``_FAM``. In this case, we create an array of 5*5*5 molecules on a cubic
|
||||
@ -153,21 +154,37 @@ the sample was created from scratch, we also specify the simulation box
|
||||
size in the "Data Boundary" section.
|
||||
|
||||
The LAMMPS setting for the force field are specified in the file
|
||||
``oplsaa.lt`` and are written automatically in the input deck. We also
|
||||
``oplsaa2024.lt`` and are written automatically in the input deck. We also
|
||||
specify the boundary conditions and a set of variables in
|
||||
the "In Init" section. The remaining commands to run an NPT simulation
|
||||
the "In Init" section.
|
||||
|
||||
The remaining commands to run an NPT simulation
|
||||
are written in the "In Run" section. Note that in this script, LAMMPS
|
||||
variables are protected with the escape character ``\`` to distinguish
|
||||
them from Moltemplate variables, e.g. ``\$\{run\}`` is a LAMMPS
|
||||
variable that is written in the input deck as ``${run}``.
|
||||
|
||||
(Note: Moltemplate can be slow to run, so you need to change you run
|
||||
settings frequently, I recommended moving those commands (from "In Run")
|
||||
out of your .lt files and into a separate file. Moltemplate creates a
|
||||
file named ``run.in.EXAMPLE`` for this purpose. You can put your run
|
||||
settings and fixes that file and then invoke LAMMPS using
|
||||
``mpirun -np 4 lmp -in run.in.EXAMPLE`` instead.)
|
||||
|
||||
|
||||
Compile the master file with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
moltemplate.sh -overlay-all solv_01.lt
|
||||
moltemplate.sh solv_01.lt
|
||||
cleanup_moltemplate.sh # <-- optional: see below
|
||||
|
||||
And execute the simulation with the following:
|
||||
(Note: The optional "cleanup_moltemplate.sh" command deletes
|
||||
unused atom types, which sometimes makes LAMMPS run faster.
|
||||
But it does not work with many-body pair styles or dreiding-style h-bonds.
|
||||
Fortunately most force fields, including OPLSAA, don't use those features.)
|
||||
|
||||
Then execute the simulation with the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -180,15 +197,116 @@ And execute the simulation with the following:
|
||||
Snapshot of the sample at the beginning and end of the simulation.
|
||||
Rendered with Ovito.
|
||||
|
||||
|
||||
Building a simple polymer
|
||||
"""""""""""""""""""""""""
|
||||
Moltemplate is particularly useful for building polymers (and other molecules
|
||||
with sub-units). As an simple example, consider butane:
|
||||
|
||||
.. figure:: JPG/butane.jpg
|
||||
|
||||
The ``butane.lt`` file below defines Butane as a polymer containing
|
||||
4 monomers (of type ``CH3``, ``CH2``, ``CH2``, ``CH3``).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
import /usr/local/moltemplate/moltemplate/force_fields/oplsaa2024.lt # defines OPLSAA
|
||||
|
||||
CH3 inherits OPLSAA {
|
||||
|
||||
# atomID molID atomType charge coordX coordY coordZ
|
||||
write("Data Atoms") {
|
||||
$atom:c $mol:... @atom:54 0.0 0.000000 0.4431163 0.000000
|
||||
$atom:h1 $mol:... @atom:60 0.0 0.000000 1.0741603 0.892431
|
||||
$atom:h2 $mol:... @atom:60 0.0 0.000000 1.0741603 -0.892431
|
||||
$atom:h3 $mol:... @atom:60 0.0 -0.892431 -0.1879277 0.000000
|
||||
}
|
||||
# (Using "$mol:..." indicates this object ("CH3") is part of a larger
|
||||
# molecule. Moltemplate will share the molecule-ID with that molecule.)
|
||||
|
||||
# A list of the bonds within the "CH3" molecular sub-unit:
|
||||
# BondID AtomID1 AtomID2
|
||||
write('Data Bond List') {
|
||||
$bond:ch1 $atom:c $atom:h1
|
||||
$bond:ch2 $atom:c $atom:h2
|
||||
$bond:ch3 $atom:c $atom:h3
|
||||
}
|
||||
}
|
||||
|
||||
CH2 inherits OPLSAA {
|
||||
|
||||
# atomID molID atomType charge coordX coordY coordZ
|
||||
write("Data Atoms") {
|
||||
$atom:c $mol:... @atom:57 0.0 0.000000 0.4431163 0.000000
|
||||
$atom:h1 $mol:... @atom:60 0.0 0.000000 1.0741603 0.892431
|
||||
$atom:h2 $mol:... @atom:60 0.0 0.000000 1.0741603 -0.892431
|
||||
}
|
||||
|
||||
# A list of the bonds within the "CH2" molecular sub-unit:
|
||||
# BondID AtomID1 AtomID2
|
||||
write('Data Bond List') {
|
||||
$bond:ch1 $atom:c $atom:h1
|
||||
$bond:ch2 $atom:c $atom:h2
|
||||
}
|
||||
}
|
||||
|
||||
Butane inherits OPLSAA {
|
||||
|
||||
create_var {$mol} # optional:force all monomers to share the same molecule-ID
|
||||
|
||||
# - Create 4 monomers
|
||||
# - Move them along the X axis using ".move()",
|
||||
# - Rotate them 180 degrees with respect to the previous monomer
|
||||
monomer1 = new CH3
|
||||
monomer2 = new CH2.rot(180,1,0,0).move(1.2533223,0,0)
|
||||
monomer3 = new CH2.move(2.5066446,0,0)
|
||||
monomer4 = new CH3.rot(180,0,0,1).move(3.7599669,0,0)
|
||||
|
||||
# A list of the bonds connecting different monomers together:
|
||||
write('Data Bond List') {
|
||||
$bond:b1 $atom:monomer1/c $atom:monomer2/c
|
||||
$bond:b2 $atom:monomer2/c $atom:monomer3/c
|
||||
$bond:b3 $atom:monomer3/c $atom:monomer4/c
|
||||
}
|
||||
}
|
||||
|
||||
Again, you don't have to specify the charge in this example because OPLSAA
|
||||
assigns charges according to the atom type.
|
||||
|
||||
This ``Butane`` object is a molecule which can be used anywhere other molecules
|
||||
can be used. (You can arrange ``Butane`` molecules on a lattice, as we did previously.
|
||||
You can also modify individual butane molecules by adding or deleting atoms or bonds.
|
||||
You can add bonds between specific butane molecules or use ``Butane`` as a
|
||||
subunit to define even larger molecules. See the moltemplate manual for details.)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
How to build a complex polymer
|
||||
""""""""""""""""""""""""""""""""""""""""""
|
||||
A similar procedure can be used to create more complicated polymers,
|
||||
such as the NIPAM polymer example shown below. For details, see:
|
||||
|
||||
https://github.com/jewettaij/moltemplate/tree/master/examples/all_atom/force_field_OPLSAA/NIPAM_polymer+water+ions
|
||||
|
||||
|
||||
|
||||
|
||||
Mapping an existing structure
|
||||
"""""""""""""""""""""""""""""
|
||||
|
||||
Another helpful way to use Moltemplate is mapping an existing molecular
|
||||
sample to a force field. This is useful when a complex sample is
|
||||
assembled from different simulations or created with specialized
|
||||
software (e.g. PACKMOL). As in the previous example, all molecular
|
||||
species in the sample must be defined using single-molecule Moltemplate
|
||||
objects. For this example, we use a short polymer in a box containing
|
||||
sample to a force field. This is useful when a complex sample is assembled
|
||||
from different simulations or created with specialized software (e.g. PACKMOL).
|
||||
(Note: The previous link shows how to build this entire system from scratch
|
||||
using only moltemplate. However here we will assume instead that we obtained
|
||||
a PDB file for this system using PACKMOL.)
|
||||
|
||||
As in the previous examples, all molecular species in the sample
|
||||
are defined using single-molecule Moltemplate objects.
|
||||
For this example, we use a short polymer in a box containing
|
||||
water molecules and ions in the PDB file ``model.pdb``.
|
||||
|
||||
It is essential to understand that the order of atoms in the PDB file
|
||||
@ -246,25 +364,25 @@ The resulting master LT file defining short annealing at a fixed volume
|
||||
.. code-block:: bash
|
||||
|
||||
# Use the OPLS-AA force field for all species.
|
||||
import /usr/local/moltemplate/moltemplate/force_fields/oplsaa.lt
|
||||
import /usr/local/moltemplate/moltemplate/force_fields/oplsaa2024.lt
|
||||
import PolyNIPAM.lt
|
||||
|
||||
# Define the SPC water and ions as in the OPLS-AA
|
||||
Ca inherits OPLSAA {
|
||||
write("Data Atoms"){
|
||||
$atom:a1 $mol:. @atom:354 0.0 0.00000 0.00000 0.000000
|
||||
$atom:a1 $mol:. @atom:412 0.0 0.00000 0.00000 0.000000
|
||||
}
|
||||
}
|
||||
Cl inherits OPLSAA {
|
||||
write("Data Atoms"){
|
||||
$atom:a1 $mol:. @atom:344 0.0 0.00000 0.00000 0.000000
|
||||
$atom:a1 $mol:. @atom:401 0.0 0.00000 0.00000 0.000000
|
||||
}
|
||||
}
|
||||
SPC inherits OPLSAA {
|
||||
write("Data Atoms"){
|
||||
$atom:O $mol:. @atom:76 0. 0.0000000 0.00000 0.000000
|
||||
$atom:H1 $mol:. @atom:77 0. 0.8164904 0.00000 0.5773590
|
||||
$atom:H2 $mol:. @atom:77 0. -0.8164904 0.00000 0.5773590
|
||||
$atom:O $mol:. @atom:9991 0. 0.0000000 0.00000 0.0000000
|
||||
$atom:H1 $mol:. @atom:9990 0. 0.8164904 0.00000 0.5773590
|
||||
$atom:H2 $mol:. @atom:9990 0. -0.8164904 0.00000 0.5773590
|
||||
}
|
||||
write("Data Bond List") {
|
||||
$bond:OH1 $atom:O $atom:H1
|
||||
@ -285,8 +403,15 @@ The resulting master LT file defining short annealing at a fixed volume
|
||||
0 26 zlo zhi
|
||||
}
|
||||
|
||||
# Define the input variables.
|
||||
write_once("In Init"){
|
||||
boundary p p p # "p p p" is the default. This line is optional.
|
||||
neighbor 3 bin # (This line is also optional in this example.)
|
||||
}
|
||||
|
||||
# Note: The lines below in the "In Run" section are often omitted.
|
||||
|
||||
# Run an NVT simulation.
|
||||
write_once("In Run"){
|
||||
# Input variables.
|
||||
variable run string sample01 # output name
|
||||
variable ts equal 2 # timestep
|
||||
@ -294,13 +419,6 @@ The resulting master LT file defining short annealing at a fixed volume
|
||||
variable p equal 1. # equilibrium pressure
|
||||
variable equi equal 30000 # equilibration steps
|
||||
|
||||
# PBC (set them before the creation of the box).
|
||||
boundary p p p
|
||||
neighbor 3 bin
|
||||
}
|
||||
|
||||
# Run an NVT simulation.
|
||||
write_once("In Run"){
|
||||
# Set the output.
|
||||
thermo 1000
|
||||
thermo_style custom step etotal evdwl ecoul elong ebond eangle &
|
||||
@ -314,8 +432,8 @@ The resulting master LT file defining short annealing at a fixed volume
|
||||
write_data \$\{run\}.min
|
||||
|
||||
# Set the constrains.
|
||||
group watergroup type @atom:76 @atom:77
|
||||
fix 0 watergroup shake 0.0001 10 0 b @bond:042_043 a @angle:043_042_043
|
||||
group watergroup type @atom:9991 @atom:9990
|
||||
fix 0 watergroup shake 0.0001 10 0 b @bond:spcO_spcH a @angle:spcH_spcO_spcH
|
||||
|
||||
# Short annealing.
|
||||
timestep \$\{ts\}
|
||||
@ -327,7 +445,7 @@ The resulting master LT file defining short annealing at a fixed volume
|
||||
|
||||
|
||||
In this example, the water model is SPC and it is defined in the
|
||||
``oplsaa.lt`` file with atom types ``@atom:76`` and ``@atom:77``. For
|
||||
``oplsaa2024.lt`` file with atom types ``@atom:9991`` and ``@atom:9990``. For
|
||||
water we also use the ``group`` and ``fix shake`` commands with
|
||||
Moltemplate ``@``-type variables, to ensure consistency with the
|
||||
numerical values assigned during compilation. To identify the bond and
|
||||
@ -336,19 +454,20 @@ are:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
replace{ @atom:76 @atom:76_b042_a042_d042_i042 }
|
||||
replace{ @atom:77 @atom:77_b043_a043_d043_i043 }
|
||||
replace{ @atom:9991 @atom:9991_bspcO_aspcO_dspcO_ispcO }
|
||||
replace{ @atom:9990 @atom:9990_bspcH_aspcH_dspcH_ispcH }
|
||||
|
||||
From which we can identify the following "Data Bonds By Type":
|
||||
``@bond:042_043 @atom:*_b042*_a*_d*_i* @atom:*_b043*_a*_d*_i*`` and
|
||||
"Data Angles By Type": ``@angle:043_042_043 @atom:*_b*_a043*_d*_i*
|
||||
@atom:*_b*_a042*_d*_i* @atom:*_b*_a043*_d*_i*``
|
||||
``@bond:spcO_spcH @atom:*_bspcO*_a*_d*_i* @atom:*_bspcH*_a*_d*_i*``
|
||||
and "Data Angles By Type":
|
||||
``@angle:spcH_spcO_spcH @atom:*_b*_aspcH*_d*_i* @atom:*_b*_aspcO*_d*_i* @atom:*_b*_aspcH*_d*_i*``
|
||||
|
||||
Compile the master file with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
moltemplate.sh -overlay-all -pdb model.pdb sample01.lt
|
||||
moltemplate.sh -pdb model.pdb sample01.lt
|
||||
cleanup_moltemplate.sh
|
||||
|
||||
And execute the simulation with the following:
|
||||
|
||||
@ -363,8 +482,13 @@ And execute the simulation with the following:
|
||||
Sample visualized with Ovito loading the trajectory into the DATA
|
||||
file written after minimization.
|
||||
|
||||
|
||||
------------
|
||||
|
||||
.. _OPLSAA96:
|
||||
.. _oplsaa2024:
|
||||
|
||||
**(OPLS-AA)** Jorgensen, Maxwell, Tirado-Rives, J Am Chem Soc, 118(45), 11225-11236 (1996).
|
||||
**(OPLS-AA)** Jorgensen, W.L., Ghahremanpour, M.M., Saar, A., Tirado-Rives, J., J. Phys. Chem. B, 128(1), 250-262 (2024).
|
||||
|
||||
.. _Moltemplate1:
|
||||
|
||||
**(Moltemplate)** Jewett et al., J. Mol. Biol., 433(11), 166841 (2021)
|
||||
|
||||
@ -197,7 +197,7 @@ The LPS model has a force scalar state
|
||||
.. math::
|
||||
|
||||
\underline{t} = \frac{3K\theta}{m}\underline{\omega}\,\underline{x} +
|
||||
\alpha \underline{\omega}\,\underline{e}^{\rm d}, \qquad\qquad\textrm{(3)}
|
||||
\alpha \underline{\omega}\,\underline{e}^\mathrm{d}, \qquad\qquad\textrm{(3)}
|
||||
|
||||
with :math:`K` the bulk modulus and :math:`\alpha` related to the shear
|
||||
modulus :math:`G` as
|
||||
@ -242,14 +242,14 @@ scalar state are defined, respectively, as
|
||||
|
||||
.. math::
|
||||
|
||||
\underline{e}^{\rm i}=\frac{\theta \underline{x}}{3}, \qquad
|
||||
\underline{e}^{\rm d} = \underline{e}- \underline{e}^{\rm i},
|
||||
\underline{e}^\mathrm{i}=\frac{\theta \underline{x}}{3}, \qquad
|
||||
\underline{e}^\mathrm{d} = \underline{e}- \underline{e}^\mathrm{i},
|
||||
|
||||
|
||||
where the arguments of the state functions and the vectors on which they
|
||||
operate are omitted for simplicity. We note that the LPS model is linear
|
||||
in the dilatation :math:`\theta`, and in the deviatoric part of the
|
||||
extension :math:`\underline{e}^{\rm d}`.
|
||||
extension :math:`\underline{e}^\mathrm{d}`.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -738,8 +738,8 @@ command.
|
||||
|
||||
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
|
||||
images or a movie. Below are example command lines for using dump image
|
||||
with the :ref:`example listed below <periexample>` and a set of images
|
||||
images or a movie. Below are example command for using dump image with
|
||||
the :ref:`example listed below <periexample>` and a set of images
|
||||
created for steps 300, 600, and 2000 this way.
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
@ -1,564 +1,6 @@
|
||||
PyLammps Tutorial
|
||||
=================
|
||||
|
||||
.. contents::
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
: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.
|
||||
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
|
||||
replaced by the :doc:`Python_head`.
|
||||
|
||||
464
doc/src/Howto_python.rst
Normal file
464
doc/src/Howto_python.rst
Normal file
@ -0,0 +1,464 @@
|
||||
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 LAMMPS 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 module
|
||||
"""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Next install the LAMMPS Python module 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.
|
||||
|
||||
.. _externally_managed:
|
||||
|
||||
.. admonition:: Handling an "externally-managed-environment" Error
|
||||
:class: Hint
|
||||
|
||||
Some Python installations made through Linux distributions
|
||||
(e.g. Ubuntu 24.04LTS or later) will prevent installing the LAMMPS
|
||||
Python module into a system folder or a corresponding folder of the
|
||||
individual user as attempted by ``make install-python`` with an error
|
||||
stating that an *externally managed* python installation must be only
|
||||
managed by the same package package management tool. This is an
|
||||
optional setting, so not all Linux distributions follow it currently
|
||||
(Spring 2025). The reasoning and explanations for this error can be
|
||||
found in the `Python Packaging User Guide
|
||||
<https://packaging.python.org/en/latest/specifications/externally-managed-environments/>`_
|
||||
|
||||
These guidelines suggest to create a virtual environment and install
|
||||
the LAMMPS Python module there (see below). This is generally a good
|
||||
idea and the LAMMPS developers recommend this, too. If, however, you
|
||||
want to proceed and install the LAMMPS Python module regardless, you
|
||||
can install the "wheel" file (see above) manually with the ``pip``
|
||||
command by adding the ``--break-system-packages`` flag.
|
||||
|
||||
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
|
||||
into distinct classes to simplify the development of new integration schemes
|
||||
which can call these calculations. Additional numerical details can be found in
|
||||
:ref:`(Clemmer) <howto_rheo_clemmer>`. Example movies illustrating some of these
|
||||
capabilities are found at https://www.lammps.org/movies.html#rheopackage.
|
||||
:ref:`(Palermo) <howto_rheo_palermo>` and :ref:`(Clemmer) <howto_rheo_clemmer>`.
|
||||
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
|
||||
<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
|
||||
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,
|
||||
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
|
||||
settings such that contact forces do not have to be calculated between two bonded
|
||||
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
|
||||
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
|
||||
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
|
||||
in range. For BPM bond styles, bonds will then use the immediate position of the two
|
||||
particles to calculate a reference state. When melting, particles will delete any
|
||||
in range. For BPM bond styles, bonds then use the immediate position of the two
|
||||
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
|
||||
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:
|
||||
|
||||
**(Clemmer)** Clemmer, Pierce, O'Connor, Nevins, Jones, Lechman, Tencer, Appl. Math. Model., 130, 310-326 (2024).
|
||||
|
||||
@ -249,23 +249,23 @@ as follows:
|
||||
|
||||
.. math::
|
||||
|
||||
a = & {\rm lx} \\
|
||||
b^2 = & {\rm ly}^2 + {\rm xy}^2 \\
|
||||
c^2 = & {\rm lz}^2 + {\rm xz}^2 + {\rm yz}^2 \\
|
||||
\cos{\alpha} = & \frac{{\rm xy}*{\rm xz} + {\rm ly}*{\rm yz}}{b*c} \\
|
||||
\cos{\beta} = & \frac{\rm xz}{c} \\
|
||||
\cos{\gamma} = & \frac{\rm xy}{b} \\
|
||||
a = & \mathrm{lx} \\
|
||||
b^2 = & \mathrm{ly}^2 + \mathrm{xy}^2 \\
|
||||
c^2 = & \mathrm{lz}^2 + \mathrm{xz}^2 + \mathrm{yz}^2 \\
|
||||
\cos{\alpha} = & \frac{\mathrm{xy}*\mathrm{xz} + \mathrm{ly}*\mathrm{yz}}{b*c} \\
|
||||
\cos{\beta} = & \frac{\mathrm{xz}}{c} \\
|
||||
\cos{\gamma} = & \frac{\mathrm{xy}}{b} \\
|
||||
|
||||
The inverse relationship can be written as follows:
|
||||
|
||||
.. math::
|
||||
|
||||
{\rm lx} = & a \\
|
||||
{\rm xy} = & b \cos{\gamma} \\
|
||||
{\rm xz} = & c \cos{\beta}\\
|
||||
{\rm ly}^2 = & b^2 - {\rm xy}^2 \\
|
||||
{\rm yz} = & \frac{b*c \cos{\alpha} - {\rm xy}*{\rm xz}}{\rm ly} \\
|
||||
{\rm lz}^2 = & c^2 - {\rm xz}^2 - {\rm yz}^2 \\
|
||||
\mathrm{lx} = & a \\
|
||||
\mathrm{xy} = & b \cos{\gamma} \\
|
||||
\mathrm{xz} = & c \cos{\beta}\\
|
||||
\mathrm{ly}^2 = & b^2 - \mathrm{xy}^2 \\
|
||||
\mathrm{yz} = & \frac{b*c \cos{\alpha} - \mathrm{xy}*\mathrm{xz}}{\mathrm{ly}} \\
|
||||
\mathrm{lz}^2 = & c^2 - \mathrm{xz}^2 - \mathrm{yz}^2 \\
|
||||
|
||||
The values of *a*, *b*, *c*, :math:`\alpha` , :math:`\beta`, and
|
||||
:math:`\gamma` can be printed out or accessed by computes using the
|
||||
|
||||
@ -260,7 +260,7 @@ Switch into the :code:`examples/melt` folder:
|
||||
|
||||
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::
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ your machine and "release" is one of the 3 branches listed above.
|
||||
between them at any time using "git checkout <branch name>".)
|
||||
|
||||
.. admonition:: Saving time and disk space when using ``git clone``
|
||||
:class: note
|
||||
|
||||
The complete git history of the LAMMPS project is quite large because
|
||||
it contains the entire commit history of the project since fall 2006,
|
||||
@ -60,7 +61,7 @@ between them at any time using "git checkout <branch name>".)
|
||||
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"
|
||||
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.
|
||||
Using a depth of 1000 is usually sufficient to include the head
|
||||
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 forum on MatSci <https://matsci.org/lammps/>`_.
|
||||
|
||||
.. We need to keep this file in sync with https://www.lammps.org/authors.html
|
||||
|
||||
.. raw:: latex
|
||||
|
||||
\small
|
||||
@ -27,7 +29,7 @@ lammps.org". General questions about LAMMPS should be posted in the
|
||||
* - `Steve Plimpton <sjp_>`_
|
||||
- SNL (retired)
|
||||
- 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_>`_
|
||||
- SNL
|
||||
- athomps at sandia.gov
|
||||
|
||||
@ -13,10 +13,14 @@ Programming language standards
|
||||
|
||||
Most of the C++ code currently requires a compiler compatible with the
|
||||
C++11 standard, the KOKKOS package currently requires C++17. Most of
|
||||
the Python code is written to be compatible with Python 3.5 or later or
|
||||
Python 2.7. Some Python scripts *require* Python 3 and a few others
|
||||
still need to be ported from Python 2 to Python 3.
|
||||
the Python code is written to be compatible with Python 3.6 or later.
|
||||
|
||||
.. deprecated:: TBD
|
||||
|
||||
Python 2.x is no longer supported and trying to use it, e.g. for the
|
||||
LAMMPS Python module should result in an error. If you come across
|
||||
some part of the LAMMPS distribution that is not (yet) compatible with
|
||||
Python 3, please notify the LAMMPS developers.
|
||||
|
||||
Build systems
|
||||
^^^^^^^^^^^^^
|
||||
@ -24,25 +28,26 @@ Build systems
|
||||
LAMMPS can be compiled from source code using a (traditional) build
|
||||
system based on shell scripts, a few shell utilities (grep, sed, cat,
|
||||
tr) and the GNU make program. This requires running within a Bourne
|
||||
shell (``/bin/sh``). Alternatively, a build system with different back ends
|
||||
can be created using CMake. CMake must be at least version 3.16.
|
||||
shell (``/bin/sh``). Alternatively, a build system with different back
|
||||
ends can be created using CMake. CMake must be at least version 3.16.
|
||||
|
||||
Operating systems
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
The primary development platform for LAMMPS is Linux. Thus, the chances
|
||||
for LAMMPS to compile without problems on Linux machines are the best.
|
||||
for LAMMPS to compile without problems are the best on Linux machines.
|
||||
Also, compilation and correct execution on macOS and Windows (using
|
||||
Microsoft Visual C++) is checked automatically for largest part of the
|
||||
source code. Some (optional) features are not compatible with all
|
||||
Microsoft Visual C++) is checked automatically for the largest part of
|
||||
the source code. Some (optional) features are not compatible with all
|
||||
operating systems, either through limitations of the corresponding
|
||||
LAMMPS source code or through source code or build system
|
||||
incompatibilities of required libraries.
|
||||
LAMMPS source code or through incompatibilities of source code or
|
||||
build system of required external libraries or packages.
|
||||
|
||||
Executables for Windows may be created natively using either Cygwin or
|
||||
Visual Studio or with a Linux to Windows MinGW cross-compiler.
|
||||
|
||||
Additionally, FreeBSD and Solaris have been tested successfully.
|
||||
Additionally, FreeBSD and Solaris have been tested successfully to
|
||||
run LAMMPS and produce results consistent with those on Linux.
|
||||
|
||||
Compilers
|
||||
^^^^^^^^^
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 94 KiB |
BIN
doc/src/JPG/butane.jpg
Normal file
BIN
doc/src/JPG/butane.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
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 APIs
|
||||
==================
|
||||
LAMMPS Python API
|
||||
=================
|
||||
|
||||
The LAMMPS Python module enables calling the LAMMPS C library API from
|
||||
Python by dynamically loading functions in the LAMMPS shared library through
|
||||
the `Python ctypes module <https://docs.python.org/3/library/ctypes.html>`_.
|
||||
Because of the dynamic loading, it is **required** that LAMMPS is compiled
|
||||
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
|
||||
Python classes to run LAMMPS are available and they build on each other.
|
||||
otherwise tries to be very similar to the C library API.
|
||||
More information on this is in the :doc:`Python_head`
|
||||
section of the manual. Use of the LAMMPS Python module is described in
|
||||
:doc:`Python_module`.
|
||||
|
||||
@ -19,9 +19,9 @@ there are now a few requirements for including new changes or extensions.
|
||||
be added.
|
||||
- New features should also be implemented and documented not just
|
||||
for the C interface, but also the Python and Fortran interfaces.
|
||||
- All additions should work and be compatible with ``-DLAMMPS_BIGBIG``,
|
||||
``-DLAMMPS_SMALLBIG``, ``-DLAMMPS_SMALLSMALL`` as well as when
|
||||
compiling with and without MPI support.
|
||||
- All additions should work and be compatible with
|
||||
``-DLAMMPS_BIGBIG``, ``-DLAMMPS_SMALLBIG`` as well as when compiling
|
||||
with and without MPI support.
|
||||
- The ``library.h`` file should be kept compatible to C code at
|
||||
a level similar to C89. Its interfaces may not reference any
|
||||
custom data types (e.g. ``bigint``, ``tagint``, and so on) that
|
||||
|
||||
@ -7,6 +7,7 @@ This section documents the following functions:
|
||||
- :cpp:func:`lammps_command`
|
||||
- :cpp:func:`lammps_commands_list`
|
||||
- :cpp:func:`lammps_commands_string`
|
||||
- :cpp:func:`lammps_expand`
|
||||
|
||||
--------------------
|
||||
|
||||
@ -79,3 +80,8 @@ Below is a short example using some of these functions.
|
||||
.. doxygenfunction:: lammps_commands_string
|
||||
:project: progguide
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_expand
|
||||
:project: progguide
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Compute, fixes, variables
|
||||
=========================
|
||||
Computes, fixes, variables
|
||||
==========================
|
||||
|
||||
This section documents accessing or modifying data stored by computes,
|
||||
fixes, or variables in LAMMPS using the following functions:
|
||||
@ -12,6 +12,10 @@ fixes, or variables in LAMMPS using the following functions:
|
||||
- :cpp:func:`lammps_set_string_variable`
|
||||
- :cpp:func:`lammps_set_internal_variable`
|
||||
- :cpp:func:`lammps_variable_info`
|
||||
- :cpp:func:`lammps_eval`
|
||||
- :cpp:func:`lammps_clearstep_compute`
|
||||
- :cpp:func:`lammps_addstep_compute_all`
|
||||
- :cpp:func:`lammps_addstep_compute`
|
||||
|
||||
-----------------------
|
||||
|
||||
@ -55,6 +59,26 @@ fixes, or variables in LAMMPS using the following functions:
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_eval
|
||||
:project: progguide
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_clearstep_compute
|
||||
:project: progguide
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_addstep_compute_all
|
||||
:project: progguide
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenfunction:: lammps_addstep_compute
|
||||
:project: progguide
|
||||
|
||||
-----------------------
|
||||
|
||||
.. doxygenenum:: _LMP_DATATYPE_CONST
|
||||
|
||||
.. doxygenenum:: _LMP_STYLE_CONST
|
||||
|
||||
@ -45,6 +45,8 @@ class. See compute.h for details.
|
||||
+-----------------------+------------------------------------------------------------------+
|
||||
| pair_tally_callback | callback function for *tally*\ -style computes (optional). |
|
||||
+-----------------------+------------------------------------------------------------------+
|
||||
| modify_param | called when a compute_modify request is executed (optional) |
|
||||
+-----------------------+------------------------------------------------------------------+
|
||||
| memory_usage | tally memory usage (optional) |
|
||||
+-----------------------+------------------------------------------------------------------+
|
||||
|
||||
|
||||
@ -189,10 +189,8 @@ of the contribution. As of January 2023, all previously included
|
||||
Fortran code for the LAMMPS executable has been replaced by equivalent
|
||||
C++ code.
|
||||
|
||||
Python code must be compatible with Python 3.5 and later. Large parts
|
||||
of LAMMPS (including the :ref:`PYTHON package <PKG-PYTHON>`) are also
|
||||
compatible with Python 2.7. Compatibility with Python 2.7 is desirable,
|
||||
but compatibility with Python 3.5 is **required**.
|
||||
Python code currently must be compatible with Python 3.6. If a later
|
||||
version or Python is required, it needs to be documented.
|
||||
|
||||
Compatibility with older programming language standards is very
|
||||
important to maintain portability and availability of LAMMPS on many
|
||||
@ -208,20 +206,21 @@ Build system (strict)
|
||||
|
||||
LAMMPS currently supports two build systems: 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
|
||||
compatible with and support both build systems.
|
||||
:doc:`CMake <Build_cmake>`. As of fall 2024, it is no longer required
|
||||
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
|
||||
independent feature, it is usually only required to add them to
|
||||
``src/.gitignore``.
|
||||
|
||||
For traditional make, if your contributed files or package depend on
|
||||
other LAMMPS style files or packages also being installed
|
||||
(e.g. because your file is a derived class from the other LAMMPS
|
||||
class), then an ``Install.sh`` file is also needed to check for those
|
||||
dependencies and modifications to ``src/Depend.sh`` to trigger the checks.
|
||||
See other README and Install.sh files in other directories as
|
||||
examples.
|
||||
other LAMMPS style files or packages also being installed (e.g. because
|
||||
your file is a derived class from the other LAMMPS class), then an
|
||||
``Install.sh`` file is also needed to check for those dependencies and
|
||||
modifications to ``src/Depend.sh`` to trigger the checks. See other
|
||||
README and Install.sh files in other directories as examples.
|
||||
|
||||
Similarly, for CMake support, changes may need to be made to
|
||||
``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
|
||||
the constructor or explicitly assigned in the body of the constructor.
|
||||
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
|
||||
its purpose and what its values can be. Class members that are
|
||||
pointers should always be initialized to ``nullptr`` in the
|
||||
|
||||
@ -880,7 +880,7 @@ groups of atoms that interact with the remaining atoms as electrolyte.
|
||||
|
||||
**Authors:** The ELECTRODE package is written and maintained by Ludwig
|
||||
Ahrens-Iwers (TUHH, Hamburg, Germany), Shern Tee (UQ, Brisbane, Australia) and
|
||||
Robert Meissner (TUHH, Hamburg, Germany).
|
||||
Robert Meissner (Helmholtz-Zentrum Hereon, Geesthacht and TUHH, Hamburg, Germany).
|
||||
|
||||
.. versionadded:: 4May2022
|
||||
|
||||
@ -994,6 +994,7 @@ Additional pair styles that are less commonly used.
|
||||
|
||||
* ``src/EXTRA-PAIR``: filenames -> commands
|
||||
* :doc:`pair_style <pair_style>`
|
||||
* ``examples/PACKAGES/dispersion``
|
||||
|
||||
----------
|
||||
|
||||
@ -2171,8 +2172,8 @@ the :doc:`Build extras <Build_extras>` page.
|
||||
* ``src/OPENMP/README``
|
||||
* :doc:`Accelerator packages <Speed_packages>`
|
||||
* :doc:`OPENMP package <Speed_omp>`
|
||||
* :doc:`Command line option -suffix/-sf omp <Run_options>`
|
||||
* :doc:`Command line option -package/-pk omp <Run_options>`
|
||||
* :doc:`Command-line option -suffix/-sf omp <Run_options>`
|
||||
* :doc:`Command-line option -package/-pk omp <Run_options>`
|
||||
* :doc:`package omp <package>`
|
||||
* 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>`,
|
||||
@ -2427,7 +2428,7 @@ ways to use LAMMPS and Python together.
|
||||
|
||||
Building with the PYTHON package assumes you have a Python development
|
||||
environment (headers and libraries) available on your system, which needs
|
||||
to be either Python version 2.7 or Python 3.5 and later.
|
||||
to be Python version 3.6 or later.
|
||||
|
||||
**Install:**
|
||||
|
||||
@ -2789,14 +2790,15 @@ implements smoothed particle hydrodynamics (SPH) for liquids. See the
|
||||
related :ref:`MACHDYN package <PKG-MACHDYN>` package for smooth Mach dynamics
|
||||
(SMD) for solids.
|
||||
|
||||
This package contains ideal gas, Lennard-Jones equation of states,
|
||||
Tait, and full support for complete (i.e. internal-energy dependent)
|
||||
equations of state. It allows for plain or Monaghans XSPH integration
|
||||
of the equations of motion. It has options for density continuity or
|
||||
density summation to propagate the density field. It has
|
||||
:doc:`set <set>` command options to set the internal energy and density
|
||||
of particles from the input script and allows the same quantities to
|
||||
be output with thermodynamic output or to dump files via the :doc:`compute property/atom <compute_property_atom>` command.
|
||||
This package contains ideal gas, Lennard-Jones equation of states, Tait,
|
||||
and full support for complete (i.e. internal-energy dependent) equations
|
||||
of state. It allows for plain or Monaghans XSPH integration of the
|
||||
equations of motion. It has options for density continuity or density
|
||||
summation to propagate the density field. It has :doc:`set <set>`
|
||||
command options to set the internal energy and density of particles from
|
||||
the input script and allows the same quantities to be output with
|
||||
thermodynamic output or to dump files via the :doc:`compute
|
||||
property/atom <compute_property_atom>` command.
|
||||
|
||||
**Author:** Georg Ganzenmuller (Fraunhofer-Institute for High-Speed
|
||||
Dynamics, Ernst Mach Institute, Germany).
|
||||
@ -2809,6 +2811,17 @@ Dynamics, Ernst Mach Institute, Germany).
|
||||
* ``examples/PACKAGES/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:
|
||||
|
||||
@ -2,14 +2,8 @@ Per-atom properties
|
||||
===================
|
||||
|
||||
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:`IPyLammps <lammps.IPyLammps>` can be used to extract atom quantities
|
||||
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.
|
||||
:py:class:`lammps <lammps.lammps>` can be used to extract atom quantities
|
||||
and modify some of them.
|
||||
|
||||
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
|
||||
@ -25,57 +19,41 @@ against invalid accesses.
|
||||
accordingly. These arrays can change sizes and order at every neighbor list
|
||||
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()
|
||||
lmp.file("in.sysinit")
|
||||
# Read/Write access via ctypes
|
||||
nlocal = lmp.extract_global("nlocal")
|
||||
x = lmp.extract_atom("x")
|
||||
|
||||
nlocal = lmp.extract_global("nlocal")
|
||||
x = lmp.extract_atom("x")
|
||||
for i in range(nlocal):
|
||||
print("(x,y,z) = (", x[i][0], x[i][1], x[i][2], ")")
|
||||
|
||||
for i in range(nlocal):
|
||||
print("(x,y,z) = (", x[i][0], x[i][1], x[i][2], ")")
|
||||
# Read/Write access via NumPy arrays
|
||||
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.
|
||||
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)
|
||||
**Numpy Methods**:
|
||||
|
||||
* :py:meth:`numpy.extract_atom() <lammps.numpy_wrapper.numpy_wrapper.extract_atom()>`: extract a per-atom quantity as numpy array
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user