Update from master

This commit is contained in:
Stan Gerald Moore
2021-06-24 11:57:21 -06:00
6233 changed files with 415229 additions and 938546 deletions

2
.gitattributes vendored
View File

@ -1,3 +1,5 @@
.gitattributes export-ignore .gitattributes export-ignore
.gitignore export-ignore .gitignore export-ignore
.github export-ignore .github export-ignore
.lgtm.yml export-ignore
SECURITY.md export-ignore

17
.github/CODEOWNERS vendored
View File

@ -13,29 +13,38 @@ lib/kim/* @ellio167
lib/mesont/* @iafoss lib/mesont/* @iafoss
# whole packages # whole packages
src/COMPRESS/* @akohlmey src/COMPRESS/* @rbberger
src/GPU/* @ndtrung81 src/GPU/* @ndtrung81
src/KOKKOS/* @stanmoore1 src/KOKKOS/* @stanmoore1
src/KIM/* @ellio167 src/KIM/* @ellio167
src/LATTE/* @cnegre src/LATTE/* @cnegre
src/MESSAGE/* @sjplimp src/MESSAGE/* @sjplimp
src/MLIAP/* @athomps
src/SNAP/* @athomps
src/SPIN/* @julient31 src/SPIN/* @julient31
src/USER-BROWNIAN/* @samueljmcameron
src/USER-CGDNA/* @ohenrich src/USER-CGDNA/* @ohenrich
src/USER-CGSDK/* @akohlmey src/USER-CGSDK/* @akohlmey
src/USER-COLVARS/* @giacomofiorin src/USER-COLVARS/* @giacomofiorin
src/USER-DIELECTRIC/* @ndtrung81
src/USER-FEP/* @agiliopadua
src/USER-HDNNP/* @singraber
src/USER-INTEL/* @wmbrownintel src/USER-INTEL/* @wmbrownintel
src/USER-MANIFOLD/* @Pakketeretet2 src/USER-MANIFOLD/* @Pakketeretet2
src/USER-MDI/* @taylor-a-barnes
src/USER-MEAMC/* @martok src/USER-MEAMC/* @martok
src/USER-MESONT/* @iafoss src/USER-MESONT/* @iafoss
src/USER-MOFFF/* @hheenen src/USER-MOFFF/* @hheenen
src/USER-MOLFILE/* @akohlmey src/USER-MOLFILE/* @akohlmey
src/USER-NETCDF/* @pastewka src/USER-NETCDF/* @pastewka
src/USER-PACE/* @yury-lysogorskiy
src/USER-PLUMED/* @gtribello src/USER-PLUMED/* @gtribello
src/USER-PHONON/* @lingtikong src/USER-PHONON/* @lingtikong
src/USER-PTM/* @pmla src/USER-PTM/* @pmla
src/USER-OMP/* @akohlmey src/USER-OMP/* @akohlmey
src/USER-QMMM/* @akohlmey src/USER-QMMM/* @akohlmey
src/USER-REAXC/* @hasanmetin src/USER-REAXC/* @hasanmetin
src/USER-REACTION/* @jrgissing
src/USER-SCAFACOS/* @rhalver src/USER-SCAFACOS/* @rhalver
src/USER-TALLY/* @akohlmey src/USER-TALLY/* @akohlmey
src/USER-UEF/* @danicholson src/USER-UEF/* @danicholson
@ -47,7 +56,6 @@ src/GPU/pair_vashishta_gpu.* @andeplane
src/KOKKOS/pair_vashishta_kokkos.* @andeplane src/KOKKOS/pair_vashishta_kokkos.* @andeplane
src/MANYBODY/pair_vashishta_table.* @andeplane src/MANYBODY/pair_vashishta_table.* @andeplane
src/MANYBODY/pair_atm.* @sergeylishchuk src/MANYBODY/pair_atm.* @sergeylishchuk
src/USER-REACTION/fix_bond_react.* @jrgissing
src/USER-MISC/*_grem.* @dstelter92 src/USER-MISC/*_grem.* @dstelter92
src/USER-MISC/compute_stress_mop*.* @RomainVermorel src/USER-MISC/compute_stress_mop*.* @RomainVermorel
@ -122,6 +130,8 @@ tools/emacs/* @HaoZeke
tools/singularity/* @akohlmey @rbberger tools/singularity/* @akohlmey @rbberger
tools/code_standard/* @rbberger tools/code_standard/* @rbberger
tools/valgrind/* @akohlmey tools/valgrind/* @akohlmey
tools/swig/* @akohlmey
tools/offline/* @rbberger
# tests # tests
unittest/* @akohlmey @rbberger unittest/* @akohlmey @rbberger
@ -130,7 +140,7 @@ unittest/* @akohlmey @rbberger
cmake/* @junghans @rbberger cmake/* @junghans @rbberger
cmake/Modules/Packages/USER-COLVARS.cmake @junghans @rbberger @giacomofiorin cmake/Modules/Packages/USER-COLVARS.cmake @junghans @rbberger @giacomofiorin
cmake/Modules/Packages/KIM.cmake @junghans @rbberger @ellio167 cmake/Modules/Packages/KIM.cmake @junghans @rbberger @ellio167
cmake/presets/*.cmake @junghans @rbberger @akohlmey cmake/presets/*.cmake @akohlmey
# python # python
python/* @rbberger python/* @rbberger
@ -142,6 +152,7 @@ fortran/* @akohlmey
doc/utils/*/* @rbberger doc/utils/*/* @rbberger
doc/Makefile @rbberger doc/Makefile @rbberger
doc/README @rbberger doc/README @rbberger
examples/plugin/* @akohlmey
# for releases # for releases
src/version.h @sjplimp src/version.h @sjplimp

View File

@ -26,11 +26,11 @@ __
## I don't want to read this whole thing I just have a question! ## I don't want to read this whole thing I just have a question!
> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to the ['lammps-users' mailing list](https://lammps.sandia.gov/mail.html). You do not need to be subscribed to post to the list (but a mailing list subscription avoids having your post delayed until it is approved by a mailing list moderator). Most posts to the mailing list receive a response within less than 24 hours. Before posting to the mailing list, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html). Following those guidelines will help greatly to get a helpful response. Always mention which LAMMPS version you are using. > **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to either the ['lammps-users' mailing list](https://lammps.sandia.gov/mail.html) or the [LAMMPS Material Science Discourse forum](https://matsci.org/lammps). You do not need to be subscribed to post to the list (but a mailing list subscription avoids having your post delayed until it is approved by a mailing list moderator). Most posts to the mailing list receive a response within less than 24 hours. Before posting to the mailing list, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html). Following those guidelines will help greatly to get a helpful response. Always mention which LAMMPS version you are using. The LAMMPS forum was recently created as part of a larger effort to build a materials science community and have discussions not just about using LAMMPS. Thus the forum may be also used for discussions that would be off-topic for the mailing list. Those will just have to be moved to a more general category.
## How Can I Contribute? ## How Can I Contribute?
There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list, you can report bugs or suggest enhancements by creating issues on GitHub (or posting them to the lammps-users mailing list), and you can contribute by submitting pull requests on GitHub or e-mail your code There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list, you can report bugs or suggest enhancements by creating issues on GitHub (or posting them to the lammps-users mailing list or posting in the LAMMPS Materials Science Discourse forum), and you can contribute by submitting pull requests on GitHub or e-mail your code
to one of the [LAMMPS core developers](https://lammps.sandia.gov/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers. to one of the [LAMMPS core developers](https://lammps.sandia.gov/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers.
### Discussing How To Use LAMMPS ### Discussing How To Use LAMMPS
@ -42,6 +42,8 @@ Anyone can browse/search previous questions/answers in the archives. You do not
If you post a message and you are a subscriber, your message will appear immediately. If you are not a subscriber, your message will be moderated, which typically takes one business day. Either way, when someone replies the reply will usually be sent to both, your personal email address and the mailing list. When replying to people, that responded to your post to the list, please always included the mailing list in your replies (i.e. use "Reply All" and **not** "Reply"). Responses will appear on the list in a few minutes, but it can take a few hours for postings and replies to show up in the SourceForge archive. Sending replies also to the mailing list is important, so that responses are archived and people with a similar issue can search for possible solutions in the mailing list archive. If you post a message and you are a subscriber, your message will appear immediately. If you are not a subscriber, your message will be moderated, which typically takes one business day. Either way, when someone replies the reply will usually be sent to both, your personal email address and the mailing list. When replying to people, that responded to your post to the list, please always included the mailing list in your replies (i.e. use "Reply All" and **not** "Reply"). Responses will appear on the list in a few minutes, but it can take a few hours for postings and replies to show up in the SourceForge archive. Sending replies also to the mailing list is important, so that responses are archived and people with a similar issue can search for possible solutions in the mailing list archive.
The LAMMPS Materials Science Discourse forum was created recently to facilitate discussion not just about LAMMPS and as part of a larger effort towards building a materials science community. The forum contains a read-only sub-category with the continually updated mailing list archive, so you won't miss anything by joining only the forum and not the mailing list.
### Reporting Bugs ### Reporting Bugs
While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://lammps.sandia.gov/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version. While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://lammps.sandia.gov/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version.
@ -108,7 +110,7 @@ For bug reports, the next step is that one of the core LAMMPS developers will se
For submitting pull requests, there is a [detailed tutorial](https://lammps.sandia.gov/doc/Howto_github.html) in the LAMMPS manual. Thus only a brief breakdown of the steps is presented here. Please note, that the LAMMPS developers are still reviewing and trying to improve the process. If you are unsure about something, do not hesitate to post a question on the lammps-users mailing list or contact one fo the core LAMMPS developers. For submitting pull requests, there is a [detailed tutorial](https://lammps.sandia.gov/doc/Howto_github.html) in the LAMMPS manual. Thus only a brief breakdown of the steps is presented here. Please note, that the LAMMPS developers are still reviewing and trying to improve the process. If you are unsure about something, do not hesitate to post a question on the lammps-users mailing list or contact one fo the core LAMMPS developers.
Immediately after the submission, the LAMMPS continuing integration server at ci.lammps.org will download your submitted branch and perform a simple compilation test, i.e. will test whether your submitted code can be compiled under various conditions. It will also do a check on whether your included documentation translates cleanly. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each the pull request is updated with a push to the remote branch on GitHub. Immediately after the submission, the LAMMPS continuing integration server at ci.lammps.org will download your submitted branch and perform a simple compilation test, i.e. will test whether your submitted code can be compiled under various conditions. It will also do a check on whether your included documentation translates cleanly. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each the pull request is updated with a push to the remote branch on GitHub.
Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you are not yet registered as a LAMMPS collaborator, you will receive an invitation for that. As part of the assesment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit). Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you are not yet registered as a LAMMPS collaborator, you will receive an invitation for that. As part of the assessment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit).
You may also receive comments and suggestions on the overall submission or specific details and on occasion specific requests for changes as part of the review. If permitted, also additional changes may be pushed into your pull request branch or a pull request may be filed in your LAMMPS fork on GitHub to include those changes. You may also receive comments and suggestions on the overall submission or specific details and on occasion specific requests for changes as part of the review. If permitted, also additional changes may be pushed into your pull request branch or a pull request may be filed in your LAMMPS fork on GitHub to include those changes.
The LAMMPS developer may then decide to assign the pull request to another developer (e.g. when that developer is more knowledgeable about the submitted feature or enhancement or has written the modified code). It may also happen, that additional developers are requested to provide a review and approve the changes. For submissions, that may change the general behavior of LAMMPS, or where a possibility of unwanted side effects exists, additional tests may be requested by the assigned developer. The LAMMPS developer may then decide to assign the pull request to another developer (e.g. when that developer is more knowledgeable about the submitted feature or enhancement or has written the modified code). It may also happen, that additional developers are requested to provide a review and approve the changes. For submissions, that may change the general behavior of LAMMPS, or where a possibility of unwanted side effects exists, additional tests may be requested by the assigned developer.
If the assigned developer is satisfied and considers the submission ready for inclusion into LAMMPS, the pull request will receive approvals and be merged into the master branch by one of the core LAMMPS developers. After the pull request is merged, you may delete the feature branch used for the pull request in your personal LAMMPS fork. If the assigned developer is satisfied and considers the submission ready for inclusion into LAMMPS, the pull request will receive approvals and be merged into the master branch by one of the core LAMMPS developers. After the pull request is merged, you may delete the feature branch used for the pull request in your personal LAMMPS fork.

4
.github/codeql/cpp.yml vendored Normal file
View File

@ -0,0 +1,4 @@
paths:
- src
- lib
- tools

5
.github/codeql/python.yml vendored Normal file
View File

@ -0,0 +1,5 @@
paths:
- python/lammps
queries:
- uses: security-and-quality

49
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,49 @@
# GitHub action to run static code analysis on C++ and Python code
name: "CodeQL Code Analysis"
on:
push:
branches: [master]
jobs:
analyze:
name: Analyze
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: ['cpp', 'python']
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/${{ matrix.language }}.yml
- name: Create Build Environment
if: ${{ matrix.language == 'cpp' }}
run: mkdir build
- name: Building LAMMPS via CMake
if: ${{ matrix.language == 'cpp' }}
shell: bash
working-directory: build
run: |
cmake -C ../cmake/presets/most.cmake ../cmake
cmake --build . --parallel 2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

54
.github/workflows/unittest-macos.yml vendored Normal file
View File

@ -0,0 +1,54 @@
# GitHub action to build LAMMPS on MacOS and run unit tests
name: "Unittest for MacOS"
on:
push:
branches: [master]
jobs:
build:
name: MacOS Unit Test
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: macos-latest
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Install ccache
run: brew install ccache
- name: Create Build Environment
run: mkdir build
- name: Set up ccache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: macos-ccache-${{ github.sha }}
restore-keys: macos-ccache-
- name: Building LAMMPS via CMake
shell: bash
working-directory: build
run: |
ccache -z
cmake -C ../cmake/presets/clang.cmake \
-C ../cmake/presets/most.cmake \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D ENABLE_TESTING=on \
-D BUILD_SHARED_LIBS=on \
-D LAMMPS_EXCEPTIONS=on \
../cmake
cmake --build . --parallel 2
ccache -s
- name: Run Tests
working-directory: build
shell: bash
run: ctest -V

14
.lgtm.yml Normal file
View File

@ -0,0 +1,14 @@
extraction:
cpp:
configure:
command:
- "mkdir build"
- "cd build"
- "cmake -G Ninja -C ../cmake/presets/most.cmake ../cmake"
index:
build_command:
- "cd build"
- "ninja"
python:
python_setup:
version: 3

View File

@ -1,6 +1,6 @@
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@ -301,9 +301,8 @@ one line to give the program's name and an idea of what it does.
Copyright (C) yyyy name of author Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License version 2 as
the Free Software Foundation; either version 2 of the License, or (at published by the Free Software Foundation.
your option) any later version.
This program is distributed in the hope that it will be useful, but This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of

20
README
View File

@ -14,10 +14,10 @@ LAMMPS is a classical molecular dynamics simulation code designed to
run efficiently on parallel computers. It was developed at Sandia run efficiently on parallel computers. It was developed at Sandia
National Laboratories, a US Department of Energy facility, with National Laboratories, a US Department of Energy facility, with
funding from the DOE. It is an open-source code, distributed freely funding from the DOE. It is an open-source code, distributed freely
under the terms of the GNU Public License (GPL). under the terms of the GNU Public License (GPL) version 2.
The primary author of the code is Steve Plimpton, who can be emailed The primary author of the code is Steve Plimpton, who can be emailed
at sjplimp@sandia.gov. The LAMMPS WWW Site at lammps.sandia.gov has at sjplimp@sandia.gov. The LAMMPS WWW Site at www.lammps.org has
more information about the code and its uses. more information about the code and its uses.
The LAMMPS distribution includes the following files and directories: The LAMMPS distribution includes the following files and directories:
@ -37,14 +37,14 @@ tools pre- and post-processing tools
Point your browser at any of these files to get started: Point your browser at any of these files to get started:
https://lammps.sandia.gov/doc/Manual.html LAMMPS user manual https://docs.lammps.org/Manual.html LAMMPS manual
https://lammps.sandia.gov/doc/Intro.html hi-level introduction https://docs.lammps.org/Intro.html hi-level introduction
https://lammps.sandia.gov/doc/Build.html how to build LAMMPS https://docs.lammps.org/Build.html how to build LAMMPS
https://lammps.sandia.gov/doc/Run_head.html how to run LAMMPS https://docs.lammps.org/Run_head.html how to run LAMMPS
https://lammps.sandia.gov/doc/Commands_all.html Table of available commands https://docs.lammps.org/Commands_all.html Table of available commands
https://lammps.sandia.gov/doc/pg_library.html LAMMPS programmer guide https://docs.lammps.org/Library.html LAMMPS library interfaces
https://lammps.sandia.gov/doc/Modify.html how to modify and extend LAMMPS https://docs.lammps.org/Modify.html how to modify and extend LAMMPS
https://lammps.sandia.gov/doc/pg_developer.html LAMMPS developer guide https://docs.lammps.org/Developer.html LAMMPS developer info
You can also create these doc pages locally: You can also create these doc pages locally:

35
SECURITY.md Normal file
View File

@ -0,0 +1,35 @@
# Security Policy
LAMMPS is designed as a user-level application to conduct computer
simulations for research using classical mechanics. As such LAMMPS
depends to some degrees on users providing correctly formatted input and
LAMMPS needs to read and write files based on uncontrolled user input.
As a parallel application for use in high-performance computing
environments, performance critical steps are also done without checking
data.
LAMMPS also is interfaced to a number of external libraries, including
libraries with experimental research software, that are not validated
and tested by the LAMMPS developers, so it is easy to import bad
behavior from calling functions in one of those libraries.
Thus is is quite easy to crash LAMMPS through malicious input and do all
kinds of filesystem manipulations. And because of that LAMMPS should
**NEVER** be compiled or **run** as superuser, either from a "root" or
"administrator" account directly or indirectly via "sudo" or "su".
Therefore what could be seen as a security vulnerability is usually
either a user mistake or a bug in the code. Bugs can be reported in
the LAMMPS project
[issue tracker on GitHub](https://github.com/lammps/lammps/issues).
# Version Updates
LAMMPS follows continuous release development model. We aim to keep all
release versions (stable or patch) fully functional and employ a variety
of automatic testing procedures to detect failures of existing
functionality from adding new features before releases are made. Thus
bugfixes and updates are only integrated into the current development
branch and thus the next (patch) release and users are recommended to
update regularly.

View File

@ -1,7 +1,7 @@
These are input scripts used to run benchmark tests for many of the These are input scripts used to run benchmark tests for many of the
interatomic potentials in LAMMPS. The results of running these interatomic potentials in LAMMPS. The results of running these
scripts on different machines are shown on the Potentials section of scripts on different machines are shown on the Potentials section of
the Benchmark page of the LAMMPS WWW site (lammps.sandia.gov/bench). the Benchmark page of the LAMMPS WWW site (https://www.lammps.org/bench.html).
Examples are shown below of how to run these scripts. Log files for Examples are shown below of how to run these scripts. Log files for
running them on 1 and 4 processors of a Linux box are included in the running them on 1 and 4 processors of a Linux box are included in the

View File

@ -2,7 +2,7 @@ LAMMPS benchmark problems
This directory contains 5 benchmark problems which are discussed in This directory contains 5 benchmark problems which are discussed in
the Benchmark section of the LAMMPS documentation, and on the the Benchmark section of the LAMMPS documentation, and on the
Benchmark page of the LAMMPS WWW site (lammps.sandia.gov/bench). Benchmark page of the LAMMPS WWW site (https://www.lammps.org/bench.html).
This directory also has several sub-directories: This directory also has several sub-directories:
@ -11,7 +11,7 @@ KEPLER benchmark scripts for GPU cluster with Kepler GPUs
POTENTIALS benchmarks scripts for various potentials in LAMMPS POTENTIALS benchmarks scripts for various potentials in LAMMPS
The results for all of these benchmarks are displayed and discussed on The results for all of these benchmarks are displayed and discussed on
the Benchmark page of the LAMMPS WWW site: lammps.sandia.gov/bench. the Benchmark page of the LAMMPS WWW site: https://www.lammps.org/bench.html
The remainder of this file refers to the 5 problems in the top-level The remainder of this file refers to the 5 problems in the top-level
of this directory and how to run them on CPUs, either in serial or of this directory and how to run them on CPUs, either in serial or

View File

@ -7,6 +7,11 @@ cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0074) if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) cmake_policy(SET CMP0074 NEW)
endif() endif()
# set policy to silence warnings about missing executable permissions in
# pythonx.y-config when cross-compiling. review occasionally if it may be set to NEW
if(POLICY CMP0109)
cmake_policy(SET CMP0109 OLD)
endif()
######################################## ########################################
project(lammps CXX) project(lammps CXX)
@ -22,18 +27,30 @@ set(LAMMPS_TOOLS_DIR ${LAMMPS_DIR}/tools)
set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python) set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python)
set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials) set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials)
set(LAMMPS_DOWNLOADS_URL "https://download.lammps.org" CACHE STRING "Base URL for LAMMPS downloads")
set(LAMMPS_POTENTIALS_URL "${LAMMPS_DOWNLOADS_URL}/potentials")
set(LAMMPS_THIRDPARTY_URL "${LAMMPS_DOWNLOADS_URL}/thirdparty")
mark_as_advanced(LAMMPS_DOWNLOADS_URL)
find_package(Git) find_package(Git)
# by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed # by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "default install path" FORCE ) set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE)
endif()
# If enabled, no need to use LD_LIBRARY_PATH / DYLD_LIBRARY_PATH when installed
option(LAMMPS_INSTALL_RPATH "Set runtime path for shared libraries linked to LAMMPS binaries" OFF)
if(LAMMPS_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
endif() endif()
# Cmake modules/macros are in a subdirectory to keep this file cleaner # Cmake modules/macros are in a subdirectory to keep this file cleaner
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
# make sure LIBRARY_PATH is set if environment variable is set # make sure LIBRARY_PATH is set if environment variable is set
if (DEFINED ENV{LIBRARY_PATH}) if(DEFINED ENV{LIBRARY_PATH})
list(APPEND CMAKE_LIBRARY_PATH "$ENV{LIBRARY_PATH}") list(APPEND CMAKE_LIBRARY_PATH "$ENV{LIBRARY_PATH}")
message(STATUS "Appending $ENV{LIBRARY_PATH} to CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}") message(STATUS "Appending $ENV{LIBRARY_PATH} to CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}")
endif() endif()
@ -60,7 +77,7 @@ check_for_autogen_files(${LAMMPS_SOURCE_DIR})
include(CheckIncludeFileCXX) include(CheckIncludeFileCXX)
# set required compiler flags and compiler/CPU arch specific optimizations # set required compiler flags and compiler/CPU arch specific optimizations
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel") if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4) if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512") set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
@ -74,6 +91,11 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions") set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
# export all symbols when building a .dll file on windows
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
######################################################################## ########################################################################
# User input options # # User input options #
######################################################################## ########################################################################
@ -92,11 +114,23 @@ endif()
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF) option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF) option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF)
# allow enabling clang-tidy for C++ files
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
if(ENABLE_CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*-header-filter=.*" CACHE STRING "")
endif()
include(GNUInstallDirs) include(GNUInstallDirs)
file(GLOB ALL_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp) file(GLOB ALL_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
file(GLOB MAIN_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp) file(GLOB MAIN_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES}) list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
add_library(lammps ${ALL_SOURCES}) add_library(lammps ${ALL_SOURCES})
# tell CMake to export all symbols to a .dll on Windows with MinGW cross-compilers
if(BUILD_SHARED_LIBS AND (CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
set_target_properties(lammps PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
endif()
add_executable(lmp ${MAIN_SOURCES}) add_executable(lmp ${MAIN_SOURCES})
target_link_libraries(lmp PRIVATE lammps) target_link_libraries(lmp PRIVATE lammps)
set_target_properties(lmp PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY}) set_target_properties(lmp PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY})
@ -106,14 +140,16 @@ option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS
QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI PLUGIN QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK USER-COLVARS USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-COLVARS USER-DIELECTRIC USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
USER-MANIFOLD USER-MEAMC USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-H5MD USER-HDNNP USER-LB USER-MANIFOLD USER-MDI USER-MEAMC USER-MESONT USER-MGPT
USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REACTION USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB
USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-RANN USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH
USER-UEF USER-VTK USER-QUIP USER-QMMM USER-YAFF USER-ADIOS) USER-TALLY USER-UEF USER-VTK USER-QUIP USER-QMMM USER-YAFF USER-PACE USER-BROWNIAN)
set(SUFFIX_PACKAGES CORESHELL USER-OMP KOKKOS OPT USER-INTEL GPU)
set(SUFFIX_PACKAGES CORESHELL GPU KOKKOS OPT USER-INTEL USER-OMP)
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES}) foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
option(PKG_${PKG} "Build ${PKG} Package" OFF) option(PKG_${PKG} "Build ${PKG} Package" OFF)
endforeach() endforeach()
@ -137,12 +173,13 @@ if(NOT CMAKE_CROSSCOMPILING)
find_package(MPI QUIET) find_package(MPI QUIET)
option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
else() else()
set(MPI_CXX_SKIP_MPICXX TRUE)
option(BUILD_MPI "Build MPI version" OFF) option(BUILD_MPI "Build MPI version" OFF)
endif() endif()
if(BUILD_MPI) if(BUILD_MPI)
# We use a non-standard procedure to cross-compile with MPI on Windows # We use a non-standard procedure to cross-compile with MPI on Windows
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING) if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
include(MPI4WIN) include(MPI4WIN)
target_link_libraries(lammps PUBLIC MPI::MPI_CXX) target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
else() else()
@ -154,8 +191,7 @@ if(BUILD_MPI)
endif() endif()
endif() endif()
else() else()
enable_language(C) file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.cpp)
file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c)
add_library(mpi_stubs STATIC ${MPI_SOURCES}) add_library(mpi_stubs STATIC ${MPI_SOURCES})
set_target_properties(mpi_stubs PROPERTIES OUTPUT_NAME lammps_mpi_stubs${LAMMPS_MACHINE}) set_target_properties(mpi_stubs PROPERTIES OUTPUT_NAME lammps_mpi_stubs${LAMMPS_MACHINE})
target_include_directories(mpi_stubs PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>) target_include_directories(mpi_stubs PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
@ -177,7 +213,7 @@ string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
target_compile_definitions(lammps PUBLIC -DLAMMPS_${LAMMPS_SIZES}) target_compile_definitions(lammps PUBLIC -DLAMMPS_${LAMMPS_SIZES})
# posix_memalign is not available on Windows # posix_memalign is not available on Windows
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(LAMMPS_MEMALIGN "0" CACHE STRING "posix_memalign() is not available on Windows" FORCE) set(LAMMPS_MEMALIGN "0" CACHE STRING "posix_memalign() is not available on Windows" FORCE)
else() else()
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable") set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable")
@ -199,6 +235,7 @@ pkg_depends(USER-ATC MANYBODY)
pkg_depends(USER-LB MPI) pkg_depends(USER-LB MPI)
pkg_depends(USER-PHONON KSPACE) pkg_depends(USER-PHONON KSPACE)
pkg_depends(USER-SCAFACOS MPI) pkg_depends(USER-SCAFACOS MPI)
pkg_depends(USER-DIELECTRIC KSPACE)
# detect if we may enable OpenMP support by default # detect if we may enable OpenMP support by default
set(BUILD_OMP_DEFAULT OFF) set(BUILD_OMP_DEFAULT OFF)
@ -219,7 +256,10 @@ if(BUILD_OMP)
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support") message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
endif() endif()
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR
(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") OR (CMAKE_CXX_COMPILER_ID STREQUAL "XLClang") OR
((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0))) ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts. # GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
@ -231,68 +271,6 @@ if(BUILD_OMP)
target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX) target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX)
endif() endif()
# Compiler specific features for testing
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
mark_as_advanced(ENABLE_COVERAGE)
if(ENABLE_COVERAGE)
if(CMAKE_VERSION VERSION_LESS 3.13)
if(CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
endif()
else()
target_compile_options(lammps PUBLIC --coverage)
target_link_options(lammps PUBLIC --coverage)
endif()
endif()
endif()
#######################################
# add custom target for IWYU analysis
#######################################
set(ENABLE_IWYU OFF CACHE BOOL "Add 'iwyu' build target to call the include-what-you-use tool")
mark_as_advanced(ENABLE_IWYU)
if(ENABLE_IWYU)
find_program(IWYU_EXE NAMES include-what-you-use iwyu)
find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py)
if (IWYU_EXE AND IWYU_TOOL)
add_custom_target(
iwyu
${IWYU_TOOL} -o clang -p ${CMAKE_CURRENT_BINARY_DIR} -- -Xiwyu --mapping_file=${CMAKE_CURRENT_SOURCE_DIR}/iwyu/iwyu-extra-map.imp
COMMENT "Running IWYU")
add_dependencies(iwyu lammps)
else()
message(FATAL_ERROR "To use IWYU you need the include-what-you-use/iwyu executable"
"and the iwyu-tool/iwyu_tool script installed in your PATH")
endif()
endif()
set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)")
mark_as_advanced(ENABLE_SANITIZER)
set(ENABLE_SANITIZER_VALUES none address leak thread undefined)
set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${ENABLE_SANITIZER_VALUES})
validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
if(NOT ENABLE_SANITIZER STREQUAL "none")
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
if(CMAKE_VERSION VERSION_LESS 3.13)
if(CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
endif()
else()
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
endif()
else()
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
set(ENABLE_SANITIZER "none")
endif()
endif()
if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE) if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
enable_language(C) enable_language(C)
find_package(LAPACK) find_package(LAPACK)
@ -344,7 +322,7 @@ find_program(GZIP_EXECUTABLE gzip)
find_package_handle_standard_args(GZIP REQUIRED_VARS GZIP_EXECUTABLE) find_package_handle_standard_args(GZIP REQUIRED_VARS GZIP_EXECUTABLE)
option(WITH_GZIP "Enable GZIP support" ${GZIP_FOUND}) option(WITH_GZIP "Enable GZIP support" ${GZIP_FOUND})
if(WITH_GZIP) if(WITH_GZIP)
if(GZIP_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)) if(GZIP_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING))
target_compile_definitions(lammps PRIVATE -DLAMMPS_GZIP) target_compile_definitions(lammps PRIVATE -DLAMMPS_GZIP)
else() else()
message(FATAL_ERROR "gzip executable not found") message(FATAL_ERROR "gzip executable not found")
@ -355,7 +333,7 @@ find_program(FFMPEG_EXECUTABLE ffmpeg)
find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_EXECUTABLE) find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_EXECUTABLE)
option(WITH_FFMPEG "Enable FFMPEG support" ${FFMPEG_FOUND}) option(WITH_FFMPEG "Enable FFMPEG support" ${FFMPEG_FOUND})
if(WITH_FFMPEG) if(WITH_FFMPEG)
if(FFMPEG_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)) if(FFMPEG_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING))
target_compile_definitions(lammps PRIVATE -DLAMMPS_FFMPEG) target_compile_definitions(lammps PRIVATE -DLAMMPS_FFMPEG)
else() else()
message(FATAL_ERROR "ffmpeg executable not found") message(FATAL_ERROR "ffmpeg executable not found")
@ -372,8 +350,8 @@ else()
set(CUDA_REQUEST_PIC) set(CUDA_REQUEST_PIC)
endif() endif()
foreach(PKG_WITH_INCL KSPACE PYTHON VORONOI USER-COLVARS USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM foreach(PKG_WITH_INCL KSPACE PYTHON MLIAP VORONOI USER-COLVARS USER-HDNNP USER-MDI USER-MOLFILE USER-NETCDF
USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS) USER-PLUMED USER-QMMM USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS USER-PACE)
if(PKG_${PKG_WITH_INCL}) if(PKG_${PKG_WITH_INCL})
include(Packages/${PKG_WITH_INCL}) include(Packages/${PKG_WITH_INCL})
endif() endif()
@ -470,7 +448,7 @@ foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD USER-MESONT)
if(PKG_${SIMPLE_LIB}) if(PKG_${SIMPLE_LIB})
string(REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}") string(REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}")
string(TOLOWER "${PKG_LIB}" PKG_LIB) string(TOLOWER "${PKG_LIB}" PKG_LIB)
if(PKG_LIB STREQUAL mesont) if(PKG_LIB STREQUAL "mesont")
enable_language(Fortran) enable_language(Fortran)
file(GLOB_RECURSE ${PKG_LIB}_SOURCES file(GLOB_RECURSE ${PKG_LIB}_SOURCES
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.f90) ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.f90)
@ -482,9 +460,9 @@ foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD USER-MESONT)
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES}) add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE}) set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
target_link_libraries(lammps PRIVATE ${PKG_LIB}) target_link_libraries(lammps PRIVATE ${PKG_LIB})
if(PKG_LIB STREQUAL awpmd) if(PKG_LIB STREQUAL "awpmd")
target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include) target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include)
elseif(PKG_LIB STREQUAL h5md) elseif(PKG_LIB STREQUAL "h5md")
target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include ${HDF5_INCLUDE_DIRS}) target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include ${HDF5_INCLUDE_DIRS})
else() else()
target_include_directories(${PKG_LIB} PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}) target_include_directories(${PKG_LIB} PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB})
@ -497,7 +475,7 @@ if(PKG_USER-AWPMD)
endif() endif()
if(PKG_USER-ATC) if(PKG_USER-ATC)
if(LAMMPS_SIZES STREQUAL BIGBIG) if(LAMMPS_SIZES STREQUAL "BIGBIG")
message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG") message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG")
endif() endif()
target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES}) target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES})
@ -524,12 +502,24 @@ foreach(PKG_WITH_INCL CORESHELL QEQ USER-OMP USER-SDPD KOKKOS OPT USER-INTEL GPU
endif() endif()
endforeach() endforeach()
if(PKG_PLUGIN)
if(BUILD_SHARED_LIBS)
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
else()
message(WARNING "Plugin loading will not work unless BUILD_SHARED_LIBS is enabled")
endif()
# link with -ldl or equivalent for plugin loading; except on Windows
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS})
endif()
endif()
###################################################################### ######################################################################
# the windows version of LAMMPS requires a couple extra libraries # the windows version of LAMMPS requires a couple extra libraries
# and the MPI library - if use - has to be linked right before those # and the MPI library - if use - has to be linked right before those
# and after everything else that is compiled locally # and after everything else that is compiled locally
###################################################################### ######################################################################
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(lammps PRIVATE -lwsock32 -lpsapi) target_link_libraries(lammps PRIVATE -lwsock32 -lpsapi)
endif() endif()
@ -578,8 +568,8 @@ add_dependencies(lammps gitversion)
# Actually add executable and lib to build # Actually add executable and lib to build
############################################ ############################################
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
list (FIND LANGUAGES "Fortran" _index) list(FIND LANGUAGES "Fortran" _index)
if (${_index} GREATER -1) if(_index GREATER -1)
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
endif() endif()
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h compute.h dihedral.h domain.h error.h fix.h force.h group.h improper.h set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h compute.h dihedral.h domain.h error.h fix.h force.h group.h improper.h
@ -649,7 +639,7 @@ install(
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
if(CMAKE_VERSION VERSION_LESS 3.12) if(CMAKE_VERSION VERSION_LESS 3.12)
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake # adjust so we find Python 3 versions before Python 2 on old systems with old CMake
set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 3.5) set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5)
find_package(PythonInterp) # Deprecated since version 3.12 find_package(PythonInterp) # Deprecated since version 3.12
if(PYTHONINTERP_FOUND) if(PYTHONINTERP_FOUND)
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
@ -657,12 +647,12 @@ if(BUILD_SHARED_LIBS)
else() else()
find_package(Python COMPONENTS Interpreter) find_package(Python COMPONENTS Interpreter)
endif() endif()
if (Python_EXECUTABLE) if(Python_EXECUTABLE)
add_custom_target( add_custom_target(
install-python install-python ${CMAKE_COMMAND} -E remove_directory build
${Python_EXECUTABLE} install.py -v ${LAMMPS_SOURCE_DIR}/version.h COMMAND ${Python_EXECUTABLE} install.py -v ${LAMMPS_SOURCE_DIR}/version.h
-m ${LAMMPS_PYTHON_DIR}/lammps.py -p ${LAMMPS_PYTHON_DIR}/lammps
-l ${CMAKE_BINARY_DIR}/liblammps${CMAKE_SHARED_LIBRARY_SUFFIX} -l ${CMAKE_BINARY_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX}
WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR} WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR}
COMMENT "Installing LAMMPS Python module") COMMENT "Installing LAMMPS Python module")
else() else()
@ -690,12 +680,9 @@ if(BUILD_SHARED_LIBS OR PKG_PYTHON)
else() else()
find_package(Python COMPONENTS Interpreter) find_package(Python COMPONENTS Interpreter)
endif() endif()
if (Python_EXECUTABLE) if(Python_EXECUTABLE)
execute_process(COMMAND ${Python_EXECUTABLE} file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python)
-c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} setup.py build -b ${CMAKE_BINARY_DIR}/python install --prefix=${CMAKE_INSTALL_PREFIX} --root=\$ENV{DESTDIR}/ WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR})")
OUTPUT_VARIABLE PYTHON_DEFAULT_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PYTHON_INSTDIR ${PYTHON_DEFAULT_INSTDIR} CACHE PATH "Installation folder for LAMMPS Python module")
install(FILES ${LAMMPS_PYTHON_DIR}/lammps.py DESTINATION ${PYTHON_INSTDIR})
endif() endif()
endif() endif()
@ -707,7 +694,7 @@ get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
include(FeatureSummary) include(FeatureSummary)
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND) feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
message(STATUS "<<< Build configuration >>> message(STATUS "<<< Build configuration >>>
Operating System: ${CMAKE_SYSTEM_NAME} Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
Build type: ${CMAKE_BUILD_TYPE} Build type: ${CMAKE_BUILD_TYPE}
Install path: ${CMAKE_INSTALL_PREFIX} Install path: ${CMAKE_INSTALL_PREFIX}
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}") Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
@ -738,15 +725,15 @@ if(OPTIONS)
message(" Options: ${OPTIONS}") message(" Options: ${OPTIONS}")
endif() endif()
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
list (FIND LANGUAGES "Fortran" _index) list(FIND LANGUAGES "Fortran" _index)
if (${_index} GREATER -1) if(_index GREATER -1)
message(STATUS "Fortran Compiler: ${CMAKE_Fortran_COMPILER} message(STATUS "Fortran Compiler: ${CMAKE_Fortran_COMPILER}
Type: ${CMAKE_Fortran_COMPILER_ID} Type: ${CMAKE_Fortran_COMPILER_ID}
Version: ${CMAKE_Fortran_COMPILER_VERSION} Version: ${CMAKE_Fortran_COMPILER_VERSION}
Fortran Flags:${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BTYPE}}") Fortran Flags:${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BTYPE}}")
endif() endif()
list (FIND LANGUAGES "C" _index) list(FIND LANGUAGES "C" _index)
if (${_index} GREATER -1) if(_index GREATER -1)
message(STATUS "C compiler: ${CMAKE_C_COMPILER} message(STATUS "C compiler: ${CMAKE_C_COMPILER}
Type: ${CMAKE_C_COMPILER_ID} Type: ${CMAKE_C_COMPILER_ID}
Version: ${CMAKE_C_COMPILER_VERSION} Version: ${CMAKE_C_COMPILER_VERSION}
@ -776,11 +763,12 @@ if(BUILD_MPI)
endif() endif()
if(PKG_GPU) if(PKG_GPU)
message(STATUS "<<< GPU package settings >>> message(STATUS "<<< GPU package settings >>>
-- GPU API: ${GPU_API}") -- GPU API: ${GPU_API}")
if(GPU_API STREQUAL "CUDA") if(GPU_API STREQUAL "CUDA")
message(STATUS "GPU architecture: ${GPU_ARCH}") message(STATUS "CUDA Compiler: ${CUDA_NVCC_EXECUTABLE}")
elseif(GPU_API STREQUAL "OPENCL") message(STATUS "GPU default architecture: ${GPU_ARCH}")
message(STATUS "OpenCL tuning: ${OCL_TUNE}") message(STATUS "GPU binning with CUDPP: ${CUDPP_OPT}")
message(STATUS "CUDA MPS support: ${CUDA_MPS_SUPPORT}")
elseif(GPU_API STREQUAL "HIP") elseif(GPU_API STREQUAL "HIP")
message(STATUS "HIP platform: ${HIP_PLATFORM}") message(STATUS "HIP platform: ${HIP_PLATFORM}")
message(STATUS "HIP architecture: ${HIP_ARCH}") message(STATUS "HIP architecture: ${HIP_ARCH}")
@ -790,7 +778,7 @@ if(PKG_GPU)
message(STATUS "HIP GPU sorting: off") message(STATUS "HIP GPU sorting: off")
endif() endif()
endif() endif()
message(STATUS "GPU precision: ${GPU_PREC}") message(STATUS "GPU precision: ${GPU_PREC}")
endif() endif()
if(PKG_KOKKOS) if(PKG_KOKKOS)
message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}") message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}")
@ -810,7 +798,7 @@ if(PKG_KSPACE)
endif() endif()
if(PKG_KOKKOS) if(PKG_KOKKOS)
if(Kokkos_ENABLE_CUDA) if(Kokkos_ENABLE_CUDA)
if (${FFT} STREQUAL "KISS") if(FFT STREQUAL "KISS")
message(STATUS "Kokkos FFT: KISS") message(STATUS "Kokkos FFT: KISS")
else() else()
message(STATUS "Kokkos FFT: cuFFT") message(STATUS "Kokkos FFT: cuFFT")

View File

@ -8,13 +8,18 @@ else()
find_package(Python3 COMPONENTS Interpreter QUIET) find_package(Python3 COMPONENTS Interpreter QUIET)
endif() endif()
if (Python3_EXECUTABLE) if(Python3_EXECUTABLE)
if(Python3_VERSION VERSION_GREATER_EQUAL 3.5) if(Python3_VERSION VERSION_GREATER_EQUAL 3.5)
add_custom_target( add_custom_target(
check-whitespace check-whitespace
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py . ${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
WORKING_DIRECTORY ${LAMMPS_DIR} WORKING_DIRECTORY ${LAMMPS_DIR}
COMMENT "Check for whitespace errors") 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( add_custom_target(
check-permissions check-permissions
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py . ${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py .
@ -25,6 +30,11 @@ if (Python3_EXECUTABLE)
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f . ${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f .
WORKING_DIRECTORY ${LAMMPS_DIR} WORKING_DIRECTORY ${LAMMPS_DIR}
COMMENT "Fix whitespace errors") 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( add_custom_target(
fix-permissions fix-permissions
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py -f . ${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py -f .

View File

@ -50,16 +50,20 @@ if(BUILD_DOC)
OUTPUT ${DOC_BUILD_DIR}/requirements.txt OUTPUT ${DOC_BUILD_DIR}/requirements.txt
DEPENDS docenv ${DOCENV_REQUIREMENTS_FILE} DEPENDS docenv ${DOCENV_REQUIREMENTS_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${DOCENV_REQUIREMENTS_FILE} ${DOC_BUILD_DIR}/requirements.txt COMMAND ${CMAKE_COMMAND} -E copy ${DOCENV_REQUIREMENTS_FILE} ${DOC_BUILD_DIR}/requirements.txt
COMMAND ${DOCENV_BINARY_DIR}/pip install --upgrade pip COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install --upgrade pip
COMMAND ${DOCENV_BINARY_DIR}/pip install --upgrade ${LAMMPS_DOC_DIR}/utils/converters COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install --upgrade ${LAMMPS_DOC_DIR}/utils/converters
COMMAND ${DOCENV_BINARY_DIR}/pip install --use-feature=2020-resolver -r ${DOC_BUILD_DIR}/requirements.txt --upgrade COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install -r ${DOC_BUILD_DIR}/requirements.txt --upgrade
) )
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
set(MATHJAX_MD5 "d1c98c746888bfd52ca8ebc10704f92f" CACHE STRING "MD5 checksum of MathJax tarball")
mark_as_advanced(MATHJAX_URL)
# download mathjax distribution and unpack to folder "mathjax" # download mathjax distribution and unpack to folder "mathjax"
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5) if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
file(DOWNLOAD "https://github.com/mathjax/MathJax/archive/3.1.2.tar.gz" file(DOWNLOAD ${MATHJAX_URL}
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz" "${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz"
EXPECTED_MD5 a4a6a093a89bc2ccab1452d766b98e53) EXPECTED_MD5 ${MATHJAX_MD5})
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
file(GLOB MATHJAX_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*) file(GLOB MATHJAX_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax) execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)

View File

@ -0,0 +1,30 @@
# Find the Cythonize tool.
#
# This code sets the following variables:
#
# Cythonize_EXECUTABLE
#
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
#=============================================================================
if(CMAKE_VERSION VERSION_LESS 3.12)
find_package(PythonInterp 3.6 QUIET) # Deprecated since version 3.12
if(PYTHONINTERP_FOUND)
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
endif()
else()
find_package(Python3 3.6 COMPONENTS Interpreter QUIET)
endif()
# Use the Cython executable that lives next to the Python executable
# if it is a local installation.
if(Python3_EXECUTABLE)
get_filename_component(_python_path ${Python3_EXECUTABLE} PATH)
find_program(Cythonize_EXECUTABLE
NAMES cythonize3 cythonize cythonize.bat
HINTS ${_python_path})
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cythonize REQUIRED_VARS Cythonize_EXECUTABLE)
mark_as_advanced(Cythonize_EXECUTABLE)

View File

@ -0,0 +1,61 @@
include(FindPackageHandleStandardArgs)
# Check if N2P2_DIR is set manually.
if (DEFINED ENV{N2P2_DIR})
set(N2P2_DIR "${N2P2_DIR}")
# If not, try if directory "lib/hdnnp/n2p2" exists.
else()
get_filename_component(_fullpath "${LAMMPS_LIB_SOURCE_DIR}/hdnnp/n2p2" REALPATH)
if (EXISTS ${_fullpath})
set(N2P2_DIR "${_fullpath}")
endif()
endif()
# Set path to include directory.
find_path(N2P2_INCLUDE_DIR InterfaceLammps.h HINTS "${N2P2_DIR}/include")
# Two libraries need to be linked: libnnp and libnnpif.
find_library(N2P2_LIBNNP NAMES nnp HINTS "${N2P2_DIR}/lib")
find_library(N2P2_LIBNNPIF NAMES nnpif HINTS "${N2P2_DIR}/lib")
# Users could compile n2p2 with extra flags which are then also required for
# pair_hdnnp.cpp compilation. To forward them to the LAMMPS build process n2p2
# writes a file with cmake commands, e.g.
#
# target_compile_definitions(lammps PRIVATE -DN2P2_NO_SF_GROUPS)
#
# to "lib/lammps-extra.cmake" which is then included by USER-HDNNP.cmake.
find_file(N2P2_CMAKE_EXTRA NAMES lammps-extra.cmake HINTS "${N2P2_DIR}/lib")
find_package_handle_standard_args(N2P2 DEFAULT_MSG
N2P2_DIR
N2P2_INCLUDE_DIR
N2P2_LIBNNP
N2P2_LIBNNPIF
N2P2_CMAKE_EXTRA)
if(N2P2_FOUND)
if (NOT TARGET N2P2::N2P2)
# n2p2 core library "libnnp"
add_library(N2P2::LIBNNP UNKNOWN IMPORTED)
set_target_properties(N2P2::LIBNNP PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${N2P2_INCLUDE_DIR}
IMPORTED_LOCATION ${N2P2_LIBNNP})
# n2p2 interface library "libnnpif"
add_library(N2P2::LIBNNPIF UNKNOWN IMPORTED)
set_target_properties(N2P2::LIBNNPIF PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${N2P2_INCLUDE_DIR}
IMPORTED_LOCATION ${N2P2_LIBNNPIF})
# Put libnnp, libnnpif and include directory together.
add_library(N2P2::N2P2 INTERFACE IMPORTED)
set_property(TARGET N2P2::N2P2 PROPERTY
INTERFACE_LINK_LIBRARIES N2P2::LIBNNPIF N2P2::LIBNNP)
set(N2P2_CMAKE_EXTRAS ${N2P2_CMAKE_EXTRA})
endif()
endif()
mark_as_advanced(
N2P2_DIR
N2P2_INCLUDE_DIR
N2P2_LIBNNP
N2P2_LIBNNPIF
N2P2_CMAKE_EXTRA
)

View File

@ -1,6 +1,6 @@
message(STATUS "Downloading and building Google Test library") message(STATUS "Downloading and building Google Test library")
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(GTEST_LIB_POSTFIX d) set(GTEST_LIB_POSTFIX d)
else() else()
set(GTEST_LIB_POSTFIX) set(GTEST_LIB_POSTFIX)
@ -8,10 +8,12 @@ endif()
include(ExternalProject) include(ExternalProject)
set(GTEST_URL "https://github.com/google/googletest/archive/release-1.10.0.tar.gz" CACHE STRING "URL for GTest tarball") set(GTEST_URL "https://github.com/google/googletest/archive/release-1.10.0.tar.gz" CACHE STRING "URL for GTest tarball")
set(GTEST_MD5 "ecd1fa65e7de707cd5c00bdac56022cd" CACHE STRING "MD5 checksum of GTest tarball")
mark_as_advanced(GTEST_URL) mark_as_advanced(GTEST_URL)
mark_as_advanced(GTEST_MD5)
ExternalProject_Add(googletest ExternalProject_Add(googletest
URL ${GTEST_URL} URL ${GTEST_URL}
URL_MD5 ecd1fa65e7de707cd5c00bdac56022cd URL_MD5 ${GTEST_MD5}
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src" SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build" BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build"
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_GTEST_OPTS} CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_GTEST_OPTS}
@ -20,10 +22,10 @@ ExternalProject_Add(googletest
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
BUILD_BYPRODUCTS <BINARY_DIR>/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${GTEST_LIB_POSTFIX}.a BUILD_BYPRODUCTS <BINARY_DIR>/lib/libgtest${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
<BINARY_DIR>/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gmock${GTEST_LIB_POSTFIX}.a <BINARY_DIR>/lib/libgmock${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
<BINARY_DIR>/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${GTEST_LIB_POSTFIX}.a <BINARY_DIR>/lib/libgtest_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
<BINARY_DIR>/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gmock_main${GTEST_LIB_POSTFIX}.a <BINARY_DIR>/lib/libgmock_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
LOG_DOWNLOAD ON LOG_DOWNLOAD ON
LOG_CONFIGURE ON LOG_CONFIGURE ON
LOG_BUILD ON LOG_BUILD ON
@ -39,10 +41,10 @@ file(MAKE_DIRECTORY ${GTEST_INCLUDE_DIR})
file(MAKE_DIRECTORY ${GMOCK_INCLUDE_DIR}) file(MAKE_DIRECTORY ${GMOCK_INCLUDE_DIR})
ExternalProject_Get_Property(googletest BINARY_DIR) ExternalProject_Get_Property(googletest BINARY_DIR)
set(GTEST_LIBRARY_PATH ${BINARY_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${GTEST_LIB_POSTFIX}.a) set(GTEST_LIBRARY_PATH ${BINARY_DIR}/lib/libgtest${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GMOCK_LIBRARY_PATH ${BINARY_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gmock${GTEST_LIB_POSTFIX}.a) set(GMOCK_LIBRARY_PATH ${BINARY_DIR}/lib/libgmock${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GTEST_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${GTEST_LIB_POSTFIX}.a) set(GTEST_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/libgtest_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GMOCK_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gmock_main${GTEST_LIB_POSTFIX}.a) set(GMOCK_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/libgmock_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
# Prevent GoogleTest from overriding our compiler/linker options # Prevent GoogleTest from overriding our compiler/linker options
# when building with Visual Studio # when building with Visual Studio

View File

@ -0,0 +1,3 @@
# utility script to call WriteOpenCLHeader function
include(${SOURCE_DIR}/Modules/OpenCLUtils.cmake)
WriteOpenCLHeader(${VARNAME} ${HEADER_FILE} ${SOURCE_FILES})

View File

@ -50,6 +50,7 @@ function(check_for_autogen_files source_dir)
file(GLOB SRC_AUTOGEN_FILES ${source_dir}/style_*.h) file(GLOB SRC_AUTOGEN_FILES ${source_dir}/style_*.h)
file(GLOB SRC_AUTOGEN_PACKAGES ${source_dir}/packages_*.h) file(GLOB SRC_AUTOGEN_PACKAGES ${source_dir}/packages_*.h)
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h) list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h)
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
foreach(_SRC ${SRC_AUTOGEN_FILES}) foreach(_SRC ${SRC_AUTOGEN_FILES})
get_filename_component(FILENAME "${_SRC}" NAME) get_filename_component(FILENAME "${_SRC}" NAME)
if(EXISTS ${source_dir}/${FILENAME}) if(EXISTS ${source_dir}/${FILENAME})
@ -85,7 +86,6 @@ endfunction(GenerateBinaryHeader)
# fetch missing potential files # fetch missing potential files
function(FetchPotentials pkgfolder potfolder) function(FetchPotentials pkgfolder potfolder)
if (EXISTS "${pkgfolder}/potentials.txt") if (EXISTS "${pkgfolder}/potentials.txt")
set(LAMMPS_POTENTIALS_URL "https://download.lammps.org/potentials")
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].") file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
foreach(line ${linelist}) foreach(line ${linelist})
string(FIND ${line} " " blank) string(FIND ${line} " " blank)
@ -104,3 +104,13 @@ function(FetchPotentials pkgfolder potfolder)
endforeach() endforeach()
endif() endif()
endfunction(FetchPotentials) endfunction(FetchPotentials)
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
file(STRINGS /etc/os-release distro REGEX "^NAME=")
string(REGEX REPLACE "NAME=\"?([^\"]*)\"?" "\\1" distro "${distro}")
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
set(CMAKE_LINUX_DISTRO ${distro})
set(CMAKE_DISTRO_VERSION ${disversion})
endif()

View File

@ -1,16 +1,25 @@
# Download and configure custom MPICH files for Windows # Download and configure custom MPICH files for Windows
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows") message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball")
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
mark_as_advanced(MPICH2_WIN32_DEVEL_URL)
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
mark_as_advanced(MPICH2_WIN32_DEVEL_MD5)
include(ExternalProject) include(ExternalProject)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
ExternalProject_Add(mpi4win_build ExternalProject_Add(mpi4win_build
URL https://download.lammps.org/thirdparty/mpich2-win64-devel.tar.gz URL ${MPICH2_WIN64_DEVEL_URL}
URL_MD5 4939fdb59d13182fd5dd65211e469f14 URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a) BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
else() else()
ExternalProject_Add(mpi4win_build ExternalProject_Add(mpi4win_build
URL https://download.lammps.org/thirdparty/mpich2-win32-devel.tar.gz URL ${MPICH2_WIN32_DEVEL_URL}
URL_MD5 a61d153500dce44e21b755ee7257e031 URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a) BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
endif() endif()

View File

@ -0,0 +1,50 @@
message(STATUS "Downloading and building OpenCL loader library")
set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2021.05.02.tar.gz" CACHE STRING "URL for OpenCL loader tarball")
set(OPENCL_LOADER_MD5 "29180b05056578afda92f0d394c3a373" CACHE STRING "MD5 checksum of OpenCL loader tarball")
mark_as_advanced(OPENCL_LOADER_URL)
mark_as_advanced(OPENCL_LOADER_MD5)
include(ExternalProject)
ExternalProject_Add(opencl_loader
URL ${OPENCL_LOADER_URL}
URL_MD5 ${OPENCL_LOADER_MD5}
SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build"
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
BUILD_BYPRODUCTS <BINARY_DIR>/libOpenCL${CMAKE_STATIC_LIBRARY_SUFFIX}
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
INSTALL_COMMAND ""
TEST_COMMAND "")
ExternalProject_Get_Property(opencl_loader SOURCE_DIR)
set(OPENCL_LOADER_INCLUDE_DIR ${SOURCE_DIR}/inc)
# workaround for CMake 3.10 on ubuntu 18.04
file(MAKE_DIRECTORY ${OPENCL_LOADER_INCLUDE_DIR})
ExternalProject_Get_Property(opencl_loader BINARY_DIR)
set(OPENCL_LOADER_LIBRARY_PATH "${BINARY_DIR}/libOpenCL${CMAKE_STATIC_LIBRARY_SUFFIX}")
find_package(Threads QUIET)
if(NOT WIN32)
set(OPENCL_LOADER_DEP_LIBS "Threads::Threads;${CMAKE_DL_LIBS}")
else()
set(OPENCL_LOADER_DEP_LIBS "cfgmgr32;runtimeobject")
endif()
add_library(OpenCL::OpenCL UNKNOWN IMPORTED)
add_dependencies(OpenCL::OpenCL opencl_loader)
set_target_properties(OpenCL::OpenCL PROPERTIES
IMPORTED_LOCATION ${OPENCL_LOADER_LIBRARY_PATH}
INTERFACE_INCLUDE_DIRECTORIES ${OPENCL_LOADER_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES "${OPENCL_LOADER_DEP_LIBS}")

View File

@ -1,10 +1,8 @@
function(GenerateOpenCLHeader varname outfile files) function(WriteOpenCLHeader varname outfile files)
message("Creating ${outfile}...")
file(WRITE ${outfile} "const char * ${varname} = \n") file(WRITE ${outfile} "const char * ${varname} = \n")
math(EXPR ARG_END "${ARGC}-1") separate_arguments(files)
foreach(IDX RANGE 2 ${ARG_END}) foreach(filename ${files})
list(GET ARGV ${IDX} filename)
file(READ ${filename} content) file(READ ${filename} content)
string(REGEX REPLACE "\\s*//[^\n]*\n" "\n" content "${content}") string(REGEX REPLACE "\\s*//[^\n]*\n" "\n" content "${content}")
string(REGEX REPLACE "\\\\" "\\\\\\\\" content "${content}") string(REGEX REPLACE "\\\\" "\\\\\\\\" content "${content}")
@ -15,4 +13,16 @@ function(GenerateOpenCLHeader varname outfile files)
endforeach() endforeach()
file(APPEND ${outfile} ";\n") file(APPEND ${outfile} ";\n")
endfunction(WriteOpenCLHeader)
function(GenerateOpenCLHeader varname outfile files)
list(REMOVE_AT ARGV 0 1)
add_custom_command(OUTPUT ${outfile}
COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-D VARNAME=${varname}
-D HEADER_FILE=${outfile}
-D SOURCE_FILES="${ARGV}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/GenerateOpenCLHeader.cmake
DEPENDS ${ARGV}
COMMENT "Generating ${outfile}...")
endfunction(GenerateOpenCLHeader) endfunction(GenerateOpenCLHeader)

View File

@ -1,7 +1,10 @@
set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU) set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU)
set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h
${GPU_SOURCES_DIR}/fix_gpu.h ${GPU_SOURCES_DIR}/fix_gpu.h
${GPU_SOURCES_DIR}/fix_gpu.cpp) ${GPU_SOURCES_DIR}/fix_gpu.cpp
${GPU_SOURCES_DIR}/fix_nh_gpu.h
${GPU_SOURCES_DIR}/fix_nh_gpu.cpp)
target_compile_definitions(lammps PRIVATE -DLMP_GPU)
set(GPU_API "opencl" CACHE STRING "API used by GPU package") set(GPU_API "opencl" CACHE STRING "API used by GPU package")
set(GPU_API_VALUES opencl cuda hip) set(GPU_API_VALUES opencl cuda hip)
@ -32,9 +35,12 @@ if(GPU_API STREQUAL "CUDA")
if(NOT BIN2C) if(NOT BIN2C)
message(FATAL_ERROR "Could not find bin2c, use -DBIN2C=/path/to/bin2c to help cmake finding it.") message(FATAL_ERROR "Could not find bin2c, use -DBIN2C=/path/to/bin2c to help cmake finding it.")
endif() endif()
option(CUDPP_OPT "Enable CUDPP_OPT" ON) option(CUDPP_OPT "Enable GPU binning via CUDAPP (should be off for modern GPUs)" OFF)
option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF) option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF)
if(CUDA_MPS_SUPPORT) if(CUDA_MPS_SUPPORT)
if(CUDPP_OPT)
message(FATAL_ERROR "Must use -DCUDPP_OPT=OFF with -DGPU_CUDA_MPS_SUPPORT=ON")
endif()
set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY") set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY")
endif() endif()
@ -42,7 +48,7 @@ if(GPU_API STREQUAL "CUDA")
# ensure that no *cubin.h files exist from a compile in the lib/gpu folder # ensure that no *cubin.h files exist from a compile in the lib/gpu folder
file(GLOB GPU_LIB_OLD_CUBIN_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h) file(GLOB GPU_LIB_OLD_CUBIN_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h)
if (GPU_LIB_OLD_CUBIN_HEADERS) if(GPU_LIB_OLD_CUBIN_HEADERS)
message(FATAL_ERROR "########################################################################\n" message(FATAL_ERROR "########################################################################\n"
"Found file(s) generated by the make-based build system in lib/gpu\n" "Found file(s) generated by the make-based build system in lib/gpu\n"
"Please run\n" "Please run\n"
@ -97,15 +103,19 @@ if(GPU_API STREQUAL "CUDA")
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]") string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
endif() endif()
# Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
message(WARNING "Unsupported CUDA version. Use at your own risk.") message(WARNING "Unsupported CUDA version. Use at your own risk.")
endif() endif()
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC} cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING}) -DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC} cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING}) -DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
foreach(CU_OBJ ${GPU_GEN_OBJS}) foreach(CU_OBJ ${GPU_GEN_OBJS})
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE) get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
@ -121,7 +131,7 @@ if(GPU_API STREQUAL "CUDA")
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS}) add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS}) target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS}) target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
if(CUDPP_OPT) if(CUDPP_OPT)
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini) target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP) target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
@ -135,27 +145,20 @@ if(GPU_API STREQUAL "CUDA")
target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS}) target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
elseif(GPU_API STREQUAL "OPENCL") elseif(GPU_API STREQUAL "OPENCL")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") # the static OpenCL loader doesn't seem to work on macOS. use the system provided
# download and unpack support binaries for compilation of windows binaries. # version by default instead (for as long as it will be available)
set(LAMMPS_THIRDPARTY_URL "https://download.lammps.org/thirdparty") if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
file(DOWNLOAD "${LAMMPS_THIRDPARTY_URL}/opencl-win-devel.tar.gz" "${CMAKE_CURRENT_BINARY_DIR}/opencl-win-devel.tar.gz" set(_opencl_static_default OFF)
EXPECTED_MD5 2c00364888d5671195598b44c2e0d44d) else()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf opencl-win-devel.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set(_opencl_static_default ON)
add_library(OpenCL::OpenCL UNKNOWN IMPORTED) endif()
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") option(USE_STATIC_OPENCL_LOADER "Download and include a static OpenCL ICD loader" ${_opencl_static_default})
set_target_properties(OpenCL::OpenCL PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win32/libOpenCL.dll") mark_as_advanced(USE_STATIC_OPENCL_LOADER)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") if(USE_STATIC_OPENCL_LOADER)
set_target_properties(OpenCL::OpenCL PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win64/libOpenCL.dll") include(OpenCLLoader)
endif()
set_target_properties(OpenCL::OpenCL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/include")
else() else()
find_package(OpenCL REQUIRED) find_package(OpenCL REQUIRED)
endif() endif()
set(OCL_TUNE "generic" CACHE STRING "OpenCL Device Tuning")
set(OCL_TUNE_VALUES intel fermi kepler cypress generic)
set_property(CACHE OCL_TUNE PROPERTY STRINGS ${OCL_TUNE_VALUES})
validate_option(OCL_TUNE OCL_TUNE_VALUES)
string(TOUPPER ${OCL_TUNE} OCL_TUNE)
include(OpenCLUtils) include(OpenCLUtils)
set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h) set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h)
@ -199,7 +202,7 @@ elseif(GPU_API STREQUAL "OPENCL")
add_library(gpu STATIC ${GPU_LIB_SOURCES}) add_library(gpu STATIC ${GPU_LIB_SOURCES})
target_link_libraries(gpu PRIVATE OpenCL::OpenCL) target_link_libraries(gpu PRIVATE OpenCL::OpenCL)
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu) target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu)
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -D${OCL_TUNE}_OCL -DMPI_GERYON -DUCL_NO_EXIT) target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DGERYON_NUMA_FISSION -DUCL_NO_EXIT)
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL) target_compile_definitions(gpu PRIVATE -DUSE_OPENCL)
target_link_libraries(lammps PRIVATE gpu) target_link_libraries(lammps PRIVATE gpu)
@ -207,6 +210,7 @@ elseif(GPU_API STREQUAL "OPENCL")
add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp) add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL) target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL)
target_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL) target_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL)
add_dependencies(ocl_get_devices OpenCL::OpenCL)
elseif(GPU_API STREQUAL "HIP") elseif(GPU_API STREQUAL "HIP")
if(NOT DEFINED HIP_PATH) if(NOT DEFINED HIP_PATH)
if(NOT DEFINED ENV{HIP_PATH}) if(NOT DEFINED ENV{HIP_PATH})
@ -221,7 +225,7 @@ elseif(GPU_API STREQUAL "HIP")
if(NOT DEFINED HIP_PLATFORM) if(NOT DEFINED HIP_PLATFORM)
if(NOT DEFINED ENV{HIP_PLATFORM}) if(NOT DEFINED ENV{HIP_PLATFORM})
set(HIP_PLATFORM "hcc" CACHE PATH "HIP Platform to be used during compilation") set(HIP_PLATFORM "amd" CACHE PATH "HIP Platform to be used during compilation")
else() else()
set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE PATH "HIP Platform used during compilation") set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE PATH "HIP Platform used during compilation")
endif() endif()
@ -229,7 +233,7 @@ elseif(GPU_API STREQUAL "HIP")
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM}) set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
if(HIP_PLATFORM STREQUAL "hcc") if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture") set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
elseif(HIP_PLATFORM STREQUAL "nvcc") elseif(HIP_PLATFORM STREQUAL "nvcc")
find_package(CUDA REQUIRED) find_package(CUDA REQUIRED)
@ -287,23 +291,23 @@ elseif(GPU_API STREQUAL "HIP")
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin") set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h") set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
if(HIP_PLATFORM STREQUAL "hcc") if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY) configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
if(HIP_COMPILER STREQUAL "clang") if(HIP_COMPILER STREQUAL "clang")
add_custom_command(OUTPUT ${CUBIN_FILE} add_custom_command(OUTPUT ${CUBIN_FILE}
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco --offload-arch=${HIP_ARCH} -O3 -ffast-math -DUSE_HIP -D_${GPU_PREC_SETTING} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_CPP_FILE} VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco --offload-arch=${HIP_ARCH} -O3 -ffast-math -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_CPP_FILE}
DEPENDS ${CU_CPP_FILE} DEPENDS ${CU_CPP_FILE}
COMMENT "Generating ${CU_NAME}.cubin") COMMENT "Generating ${CU_NAME}.cubin")
else() else()
add_custom_command(OUTPUT ${CUBIN_FILE} add_custom_command(OUTPUT ${CUBIN_FILE}
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco -t="${HIP_ARCH}" -f=\"-O3 -ffast-math -DUSE_HIP -D_${GPU_PREC_SETTING} -I${LAMMPS_LIB_SOURCE_DIR}/gpu\" -o ${CUBIN_FILE} ${CU_CPP_FILE} VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco -t="${HIP_ARCH}" -f=\"-O3 -ffast-math -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} -I${LAMMPS_LIB_SOURCE_DIR}/gpu\" -o ${CUBIN_FILE} ${CU_CPP_FILE}
DEPENDS ${CU_CPP_FILE} DEPENDS ${CU_CPP_FILE}
COMMENT "Generating ${CU_NAME}.cubin") COMMENT "Generating ${CU_NAME}.cubin")
endif() endif()
elseif(HIP_PLATFORM STREQUAL "nvcc") elseif(HIP_PLATFORM STREQUAL "nvcc")
add_custom_command(OUTPUT ${CUBIN_FILE} add_custom_command(OUTPUT ${CUBIN_FILE}
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE} VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE}
DEPENDS ${CU_FILE} DEPENDS ${CU_FILE}
COMMENT "Generating ${CU_NAME}.cubin") COMMENT "Generating ${CU_NAME}.cubin")
endif() endif()
@ -341,11 +345,16 @@ elseif(GPU_API STREQUAL "HIP")
if(DOWNLOAD_CUB) if(DOWNLOAD_CUB)
message(STATUS "CUB download requested") message(STATUS "CUB download requested")
set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
mark_as_advanced(CUB_URL)
mark_as_advanced(CUB_MD5)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(CUB ExternalProject_Add(CUB
GIT_REPOSITORY https://github.com/NVlabs/cub URL ${CUB_URL}
TIMEOUT 5 URL_MD5 ${CUB_MD5}
PREFIX "${CMAKE_CURRENT_BINARY_DIR}" PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
@ -357,7 +366,7 @@ elseif(GPU_API STREQUAL "HIP")
else() else()
find_package(CUB) find_package(CUB)
if(NOT CUB_FOUND) if(NOT CUB_FOUND)
message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it") message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_CUB=ON to download it")
endif() endif()
endif() endif()
@ -384,18 +393,21 @@ elseif(GPU_API STREQUAL "HIP")
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__) target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include) target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
elseif(HIP_PLATFORM STREQUAL "amd")
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_AMD__)
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_AMD__)
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
endif() endif()
target_link_libraries(lammps PRIVATE gpu) target_link_libraries(lammps PRIVATE gpu)
endif() endif()
# GPU package
FindStyleHeaders(${GPU_SOURCES_DIR} FIX_CLASS fix_ FIX)
set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}") set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}")
# detect styles which have a GPU version
# detects styles which have GPU version
RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES) RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES)
RegisterFixStyle(${GPU_SOURCES_DIR}/fix_gpu.h)
get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES)

View File

@ -19,6 +19,8 @@ if(CURL_FOUND)
target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK) target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK)
endif() endif()
endif() endif()
set(KIM_EXTRA_UNITTESTS OFF CACHE STRING "Set extra unit tests verbose mode on/off. If on, extra tests are included.")
mark_as_advanced(KIM_EXTRA_UNITTESTS)
find_package(PkgConfig QUIET) find_package(PkgConfig QUIET)
set(DOWNLOAD_KIM_DEFAULT ON) set(DOWNLOAD_KIM_DEFAULT ON)
if(PKG_CONFIG_FOUND) if(PKG_CONFIG_FOUND)
@ -33,9 +35,13 @@ if(DOWNLOAD_KIM)
include(ExternalProject) include(ExternalProject)
enable_language(C) enable_language(C)
enable_language(Fortran) enable_language(Fortran)
set(KIM_URL "https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" CACHE STRING "URL for KIM tarball")
set(KIM_MD5 "ae1ddda2ef7017ea07934e519d023dca" CACHE STRING "MD5 checksum of KIM tarball")
mark_as_advanced(KIM_URL)
mark_as_advanced(KIM_MD5)
ExternalProject_Add(kim_build ExternalProject_Add(kim_build
URL https://s3.openkim.org/kim-api/kim-api-2.1.3.txz URL ${KIM_URL}
URL_MD5 6ee829a1bbba5f8b9874c88c4c4ebff8 URL_MD5 ${KIM_MD5}
BINARY_DIR build BINARY_DIR build
CMAKE_ARGS ${CMAKE_REQUEST_PIC} CMAKE_ARGS ${CMAKE_REQUEST_PIC}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
@ -53,11 +59,28 @@ if(DOWNLOAD_KIM)
add_library(LAMMPS::KIM UNKNOWN IMPORTED) add_library(LAMMPS::KIM UNKNOWN IMPORTED)
set_target_properties(LAMMPS::KIM PROPERTIES set_target_properties(LAMMPS::KIM PROPERTIES
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkim-api${CMAKE_SHARED_LIBRARY_SUFFIX}" IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkim-api${CMAKE_SHARED_LIBRARY_SUFFIX}"
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include/kim-api") INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include/kim-api"
target_link_libraries(lammps PRIVATE LAMMPS::KIM) )
add_dependencies(LAMMPS::KIM kim_build) add_dependencies(LAMMPS::KIM kim_build)
target_link_libraries(lammps PRIVATE LAMMPS::KIM)
# Set rpath so lammps build directory is relocatable
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(_rpath_prefix "@loader_path")
else()
set(_rpath_prefix "$ORIGIN")
endif()
set_target_properties(lmp PROPERTIES
BUILD_RPATH "${_rpath_prefix}/kim_build-prefix/lib"
)
else() else()
find_package(PkgConfig REQUIRED) if(KIM-API_FOUND AND KIM-API_VERSION VERSION_GREATER_EQUAL 2.2.0)
pkg_check_modules(KIM-API REQUIRED IMPORTED_TARGET libkim-api>=${KIM-API_MIN_VERSION}) # For kim-api >= 2.2.0
target_link_libraries(lammps PRIVATE PkgConfig::KIM-API) find_package(KIM-API 2.2.0 CONFIG REQUIRED)
target_link_libraries(lammps PRIVATE KIM-API::kim-api)
else()
# For kim-api 2.1.3 (consistent with previous version of this file)
find_package(PkgConfig REQUIRED)
pkg_check_modules(KIM-API REQUIRED IMPORTED_TARGET libkim-api>=${KIM-API_MIN_VERSION})
target_link_libraries(lammps PRIVATE PkgConfig::KIM-API)
endif()
endif() endif()

View File

@ -1,4 +1,7 @@
######################################################################## ########################################################################
# As of version 3.3.0 Kokkos requires C++14
set(CMAKE_CXX_STANDARD 14)
########################################################################
# consistency checks and Kokkos options/settings required by LAMMPS # consistency checks and Kokkos options/settings required by LAMMPS
if(Kokkos_ENABLE_CUDA) if(Kokkos_ENABLE_CUDA)
message(STATUS "KOKKOS: Enabling CUDA LAMBDA function support") message(STATUS "KOKKOS: Enabling CUDA LAMBDA function support")
@ -34,9 +37,13 @@ if(DOWNLOAD_KOKKOS)
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
include(ExternalProject) include(ExternalProject)
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.4.01.tar.gz" CACHE STRING "URL for KOKKOS tarball")
set(KOKKOS_MD5 "4c84698917c93a18985b311bb6caf84f" CACHE STRING "MD5 checksum of KOKKOS tarball")
mark_as_advanced(KOKKOS_URL)
mark_as_advanced(KOKKOS_MD5)
ExternalProject_Add(kokkos_build ExternalProject_Add(kokkos_build
URL https://github.com/kokkos/kokkos/archive/3.2.00.tar.gz URL ${KOKKOS_URL}
URL_MD5 81569170fe232e5e64ab074f7cca5e50 URL_MD5 ${KOKKOS_MD5}
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS} CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a
) )
@ -48,10 +55,12 @@ if(DOWNLOAD_KOKKOS)
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include" INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include"
INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOS) target_link_libraries(lammps PRIVATE LAMMPS::KOKKOS)
target_link_libraries(lmp PRIVATE LAMMPS::KOKKOS)
add_dependencies(LAMMPS::KOKKOS kokkos_build) add_dependencies(LAMMPS::KOKKOS kokkos_build)
elseif(EXTERNAL_KOKKOS) elseif(EXTERNAL_KOKKOS)
find_package(Kokkos 3.2.00 REQUIRED CONFIG) find_package(Kokkos 3.4.01 REQUIRED CONFIG)
target_link_libraries(lammps PRIVATE Kokkos::kokkos) target_link_libraries(lammps PRIVATE Kokkos::kokkos)
target_link_libraries(lmp PRIVATE Kokkos::kokkos)
else() else()
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
@ -63,6 +72,7 @@ else()
${LAMMPS_LIB_KOKKOS_BIN_DIR}) ${LAMMPS_LIB_KOKKOS_BIN_DIR})
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS}) target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
target_link_libraries(lammps PRIVATE kokkos) target_link_libraries(lammps PRIVATE kokkos)
target_link_libraries(lmp PRIVATE kokkos)
endif() endif()
target_compile_definitions(lammps PRIVATE -DLMP_KOKKOS) target_compile_definitions(lammps PRIVATE -DLMP_KOKKOS)
@ -89,7 +99,7 @@ if(PKG_KSPACE)
${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp ${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp) ${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
if(Kokkos_ENABLE_CUDA) if(Kokkos_ENABLE_CUDA)
if(NOT ${FFT} STREQUAL "KISS") if(NOT (FFT STREQUAL "KISS"))
target_compile_definitions(lammps PRIVATE -DFFT_CUFFT) target_compile_definitions(lammps PRIVATE -DFFT_CUFFT)
target_link_libraries(lammps PRIVATE cufft) target_link_libraries(lammps PRIVATE cufft)
endif() endif()

View File

@ -15,10 +15,14 @@ endif()
option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT}) option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
if(DOWNLOAD_LATTE) if(DOWNLOAD_LATTE)
message(STATUS "LATTE download requested - we will build our own") message(STATUS "LATTE download requested - we will build our own")
set(LATTE_URL "https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" CACHE STRING "URL for LATTE tarball")
set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball")
mark_as_advanced(LATTE_URL)
mark_as_advanced(LATTE_MD5)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(latte_build ExternalProject_Add(latte_build
URL https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz URL ${LATTE_URL}
URL_MD5 820e73a457ced178c08c71389a385de7 URL_MD5 ${LATTE_MD5}
SOURCE_SUBDIR cmake SOURCE_SUBDIR cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES} -DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}

View File

@ -1,10 +1,9 @@
if(LAMMPS_SIZES STREQUAL BIGBIG) if(LAMMPS_SIZES STREQUAL "BIGBIG")
message(FATAL_ERROR "The MESSAGE Package is not compatible with -DLAMMPS_BIGBIG") message(FATAL_ERROR "The MESSAGE Package is not compatible with -DLAMMPS_BIGBIG")
endif() endif()
option(MESSAGE_ZMQ "Use ZeroMQ in MESSAGE package" OFF) option(MESSAGE_ZMQ "Use ZeroMQ in MESSAGE package" OFF)
file(GLOB_RECURSE cslib_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.F file(GLOB_RECURSE cslib_SOURCES
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.c ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.cpp)
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.cpp)
add_library(cslib STATIC ${cslib_SOURCES}) add_library(cslib STATIC ${cslib_SOURCES})
target_compile_definitions(cslib PRIVATE -DLAMMPS_${LAMMPS_SIZES}) target_compile_definitions(cslib PRIVATE -DLAMMPS_${LAMMPS_SIZES})

View File

@ -0,0 +1,40 @@
# if PYTHON package is included we may also include Python support in MLIAP
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
if(PKG_PYTHON)
find_package(Cythonize QUIET)
if(Cythonize_FOUND)
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
endif()
endif()
option(MLIAP_ENABLE_PYTHON "Build MLIAP package with Python support" ${MLIAP_ENABLE_PYTHON_DEFAULT})
if(MLIAP_ENABLE_PYTHON)
find_package(Cythonize REQUIRED)
if(NOT PKG_PYTHON)
message(FATAL_ERROR "Must enable PYTHON package for including Python support in MLIAP")
endif()
if(CMAKE_VERSION VERSION_LESS 3.12)
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6)
message(FATAL_ERROR "Python support in MLIAP requires Python 3.6 or later")
endif()
else()
if(Python_VERSION VERSION_LESS 3.6)
message(FATAL_ERROR "Python support in MLIAP requires Python 3.6 or later")
endif()
endif()
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
set(MLIAP_CYTHON_SRC ${LAMMPS_SOURCE_DIR}/MLIAP/mliap_model_python_couple.pyx)
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_SRC} NAME_WE)
file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR})
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_SRC} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
MAIN_DEPENDENCY ${MLIAP_CYTHON_SRC}
COMMENT "Generating C++ sources with cythonize...")
target_compile_definitions(lammps PRIVATE -DMLIAP_PYTHON)
target_sources(lammps PRIVATE ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
target_include_directories(lammps PRIVATE ${MLIAP_BINARY_DIR})
endif()

View File

@ -7,10 +7,15 @@ else()
endif() endif()
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT}) option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
if(DOWNLOAD_MSCG) if(DOWNLOAD_MSCG)
set(MSCG_URL "https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz" CACHE STRING "URL for MSCG tarball")
set(MSCG_MD5 "8c45e269ee13f60b303edd7823866a91" CACHE STRING "MD5 checksum of MSCG tarball")
mark_as_advanced(MSCG_URL)
mark_as_advanced(MSCG_MD5)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(mscg_build ExternalProject_Add(mscg_build
URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz URL ${MSCG_URL}
URL_MD5 8c45e269ee13f60b303edd7823866a91 URL_MD5 ${MSCG_MD5}
SOURCE_SUBDIR src/CMake SOURCE_SUBDIR src/CMake
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS} CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}

View File

@ -1,18 +1,13 @@
# Fix qeq/fire requires MANYBODY (i.e. COMB and COMB3) to be installed # Fix qeq/fire requires MANYBODY (i.e. COMB and COMB3) to be installed
set(QEQ_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/QEQ) set(QEQ_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/QEQ)
file(GLOB QEQ_HEADERS ${QEQ_SOURCES_DIR}/fix*.h)
file(GLOB QEQ_SOURCES ${QEQ_SOURCES_DIR}/fix*.cpp)
get_property(hlist GLOBAL PROPERTY FIX)
if(NOT PKG_MANYBODY) if(NOT PKG_MANYBODY)
list(REMOVE_ITEM QEQ_HEADERS ${QEQ_SOURCES_DIR}/fix_qeq_fire.h) list(REMOVE_ITEM hlist ${QEQ_SOURCES_DIR}/fix_qeq_fire.h)
list(REMOVE_ITEM QEQ_SOURCES ${QEQ_SOURCES_DIR}/fix_qeq_fire.cpp) get_target_property(LAMMPS_SOURCES lammps SOURCES)
list(REMOVE_ITEM LAMMPS_SOURCES ${QEQ_SOURCES_DIR}/fix_qeq_fire.cpp)
set_property(TARGET lammps PROPERTY SOURCES ${LAMMPS_SOURCES})
endif() endif()
set_property(GLOBAL PROPERTY "QEQ_SOURCES" "${QEQ_SOURCES}") set_property(GLOBAL PROPERTY FIX "${hlist}")
foreach(MY_HEADER ${QEQ_HEADERS})
AddStyleHeader(${MY_HEADER} FIX)
endforeach()
get_property(QEQ_SOURCES GLOBAL PROPERTY QEQ_SOURCES)
target_sources(lammps PRIVATE ${QEQ_SOURCES})
target_include_directories(lammps PRIVATE ${QEQ_SOURCES_DIR}) target_include_directories(lammps PRIVATE ${QEQ_SOURCES_DIR})

View File

@ -0,0 +1,127 @@
find_package(N2P2 QUIET)
if(N2P2_FOUND)
set(DOWNLOAD_N2P2_DEFAULT OFF)
else()
set(DOWNLOAD_N2P2_DEFAULT ON)
endif()
option(DOWNLOAD_N2P2 "Download n2p2 library instead of using an already installed one)" ${DOWNLOAD_N2P2_DEFAULT})
if(DOWNLOAD_N2P2)
set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.1.4.tar.gz" CACHE STRING "URL for n2p2 tarball")
set(N2P2_MD5 "9595b066636cd6b90b0fef93398297a5" CACHE STRING "MD5 checksum of N2P2 tarball")
mark_as_advanced(N2P2_URL)
mark_as_advanced(N2P2_MD5)
# adjust settings from detected compiler to compiler platform in n2p2 library
# set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7)
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
set(N2P2_COMP llvm)
set(N2P2_CXX_STD "-std=c++11")
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM"))
set(N2P2_COMP intel)
set(N2P2_CXX_STD "-std=c++11")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(N2P2_COMP gnu)
set(N2P2_CXX_STD "-std=gnu++11")
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC"))
set(N2P2_COMP gnu)
set(N2P2_CXX_STD "--c++11")
else() # default
set(N2P2_COMP "")
endif()
# pass on archive creator command. prefer compiler specific version, if set.
# important when using cross compiler.
if(CMAKE_CXX_COMPILER_AR)
set(N2P2_AR ${CMAKE_CXX_COMPILER_AR})
else()
set(N2P2_AR ${CMAKE_AR})
endif()
# adjust compilation of n2p2 library to whether MPI is requested in LAMMPS or not
# need special care for compiling for MPICH2 with Linux-to-Windows cross compiler.
if(NOT BUILD_MPI)
set(N2P2_PROJECT_OPTIONS "-DN2P2_NO_MPI")
else()
# get path to MPI include directory when cross-compiling to windows
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)
get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES)
set(N2P2_PROJECT_OPTIONS "-I ${N2P2_MPI_INCLUDE} -DMPICH_SKIP_MPICXX=1")
set(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER})
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES)
set(N2P2_PROJECT_OPTIONS "-I ${N2P2_MPI_INCLUDE} -DMPICH_SKIP_MPICXX=1")
set(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER})
endif()
endif()
# prefer GNU make, if available. N2P2 lib seems to need it.
find_program(N2P2_MAKE NAMES gmake make)
# override compiler (optimization) flags in n2p2 library to flags used for LAMMPS
# specifically -march=native can result in problems when compiling on HPC clusters or with a cross compiler
# this convoluted way gets correct quoting/escaping when configuring the external project
string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
set(N2P2_BUILD_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}} ${N2P2_CXX_STD}")
set(N2P2_BUILD_OPTIONS INTERFACES=LAMMPS COMP=${N2P2_COMP} "PROJECT_OPTIONS=${N2P2_PROJECT_OPTIONS}" "PROJECT_DEBUG="
"PROJECT_CC=${CMAKE_CXX_COMPILER}" "PROJECT_MPICC=${MPI_CXX_COMPILER}" "PROJECT_CFLAGS=${N2P2_BUILD_FLAGS}"
"PROJECT_AR=${N2P2_AR}")
# echo final flag for debugging
message(STATUS "N2P2 BUILD OPTIONS: ${N2P2_BUILD_OPTIONS}")
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
include(ExternalProject)
ExternalProject_Add(n2p2_build
URL ${N2P2_URL}
URL_MD5 ${N2P2_MD5}
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
PATCH_COMMAND sed -i -e "s/\\(MPI_\\(P\\|Unp\\)ack(\\)/\\1(void *) /" src/libnnpif/LAMMPS/InterfaceLammps.cpp
BUILD_COMMAND ${N2P2_MAKE} -f makefile libnnpif ${N2P2_BUILD_OPTIONS}
BUILD_ALWAYS YES
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
LOG_BUILD ON
SOURCE_SUBDIR src/
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libnnp.a <SOURCE_DIR>/lib/libnnpif.a
)
# create imported target LAMMPS::N2P2 from two libraries nnp and nnpif
ExternalProject_get_property(n2p2_build SOURCE_DIR)
# n2p2 core library "libnnp"
add_library(LAMMPS::N2P2::LIBNNP UNKNOWN IMPORTED)
set_target_properties(LAMMPS::N2P2::LIBNNP PROPERTIES
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libnnp.a"
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include")
# n2p2 interface library "libnnpif"
add_library(LAMMPS::N2P2::LIBNNPIF UNKNOWN IMPORTED)
set_target_properties(LAMMPS::N2P2::LIBNNPIF PROPERTIES
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libnnpif.a"
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include")
# nnpif library has MPI calls if MPI is enabled, so we must link with MPI libs
if(BUILD_MPI)
set_target_properties(LAMMPS::N2P2::LIBNNPIF PROPERTIES
INTERFACE_LINK_LIBRARIES MPI::MPI_CXX)
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)
add_dependencies(LAMMPS::N2P2::LIBNNPIF MPI::MPI_CXX)
endif()
endif()
# final step to define imported target
add_library(LAMMPS::N2P2 INTERFACE IMPORTED)
set_property(TARGET LAMMPS::N2P2 PROPERTY
INTERFACE_LINK_LIBRARIES LAMMPS::N2P2::LIBNNPIF LAMMPS::N2P2::LIBNNP)
target_link_libraries(lammps PRIVATE LAMMPS::N2P2)
add_dependencies(LAMMPS::N2P2 n2p2_build)
# work around issues with older CMake versions
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
file(MAKE_DIRECTORY "${SOURCE_DIR}/lib")
else()
find_package(N2P2)
if(NOT N2P2_FOUND)
message(FATAL_ERROR "n2p2 not found, help CMake to find it by setting N2P2_DIR, or set DOWNLOAD_N2P2=ON to download it")
endif()
target_link_libraries(lammps PRIVATE N2P2::N2P2)
include(${N2P2_CMAKE_EXTRAS})
endif()

View File

@ -30,7 +30,12 @@ if(INTEL_LRT_MODE STREQUAL "THREADS")
endif() endif()
endif() endif()
if(INTEL_LRT_MODE STREQUAL "C++11") if(INTEL_LRT_MODE STREQUAL "C++11")
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT -DLMP_INTEL_LRT11) if(Threads_FOUND)
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT -DLMP_INTEL_LRT11)
target_link_libraries(lammps PRIVATE Threads::Threads)
else()
message(FATAL_ERROR "Must have working threads library for Long-range thread support")
endif()
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
@ -74,9 +79,11 @@ if(INTEL_ARCH STREQUAL "KNL")
else() else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
foreach(_FLAG -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict) foreach(_FLAG -O2 "-fp-model fast=2" -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAG}) string(REGEX REPLACE "[ =\"]" "" _FLAGX ${_FLAG})
if(COMPILER_SUPPORTS${_FLAG}) check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAGX})
if(COMPILER_SUPPORTS${_FLAGX})
separate_arguments(_FLAG UNIX_COMMAND "${_FLAG}")
target_compile_options(lammps PRIVATE ${_FLAG}) target_compile_options(lammps PRIVATE ${_FLAG})
endif() endif()
endforeach() endforeach()

View File

@ -0,0 +1,118 @@
find_package(mdi QUIET)
if(${mdi_FOUND})
set(DOWNLOAD_MDI_DEFAULT OFF)
else()
set(DOWNLOAD_MDI_DEFAULT ON)
endif()
option(DOWNLOAD_MDI "Download and compile the MDI library instead of using an already installed one" ${DOWNLOAD_MDI_DEFAULT})
if(DOWNLOAD_MDI)
message(STATUS "MDI download requested - we will build our own")
set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.2.9.tar.gz" CACHE STRING "URL for MDI tarball")
set(MDI_MD5 "ddfa46d6ee15b4e59cfd527ec7212184" CACHE STRING "MD5 checksum for MDI tarball")
mark_as_advanced(MDI_URL)
mark_as_advanced(MDI_MD5)
enable_language(C)
# only ON/OFF are allowed for "mpi" flag when building MDI library
# so translate boolean value of BUILD_MPI
# always disable MPI when cross-compiling to Windows.
if((BUILD_MPI) AND NOT((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING))
set(MDI_USE_MPI ON)
else()
set(MDI_USE_MPI OFF)
endif()
# detect if we have python development support and thus can enable python plugins
set(MDI_USE_PYTHON_PLUGINS OFF)
if(CMAKE_VERSION VERSION_LESS 3.12)
find_package(PythonLibs QUIET) # Deprecated since version 3.12
if(PYTHONLIBS_FOUND)
set(MDI_USE_PYTHON_PLUGINS ON)
endif()
else()
find_package(Python QUIET COMPONENTS Development)
if(Python_Development_FOUND)
set(MDI_USE_PYTHON_PLUGINS ON)
endif()
endif()
# download/ build MDI library
# always build static library with -fpic
# support cross-compilation and ninja-build
include(ExternalProject)
ExternalProject_Add(mdi_build
URL ${MDI_URL}
URL_MD5 ${MDI_MD5}
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-Dlanguage=C
-Dlibtype=STATIC
-Dmpi=${MDI_USE_MPI}
-Dpython_plugins=${MDI_USE_PYTHON_PLUGINS}
UPDATE_COMMAND ""
INSTALL_COMMAND ""
BUILD_BYPRODUCTS "<BINARY_DIR>/MDI_Library/libmdi.a"
)
# where is the compiled library?
ExternalProject_get_property(mdi_build BINARY_DIR)
set(MDI_BINARY_DIR "${BINARY_DIR}/MDI_Library")
# workaround for older CMake versions
file(MAKE_DIRECTORY ${MDI_BINARY_DIR})
# create imported target for the MDI library
add_library(LAMMPS::MDI UNKNOWN IMPORTED)
add_dependencies(LAMMPS::MDI mdi_build)
set_target_properties(LAMMPS::MDI PROPERTIES
IMPORTED_LOCATION "${MDI_BINARY_DIR}/libmdi.a"
INTERFACE_INCLUDE_DIRECTORIES ${MDI_BINARY_DIR}
)
set(MDI_DEP_LIBS "")
# if compiling with python plugins we need
# to add python libraries as dependency.
if(MDI_USE_PYTHON_PLUGINS)
if(CMAKE_VERSION VERSION_LESS 3.12)
list(APPEND MDI_DEP_LIBS ${PYTHON_LIBRARIES})
else()
list(APPEND MDI_DEP_LIBS Python::Python)
endif()
endif()
# need to add support for dlopen/dlsym, except when compiling for Windows.
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
endif()
if(MDI_DEP_LIBS)
set_target_properties(LAMMPS::MDI PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES "${MDI_DEP_LIBS}")
endif()
target_link_libraries(lammps PRIVATE LAMMPS::MDI)
target_link_libraries(lmp PRIVATE LAMMPS::MDI)
else()
find_package(mdi)
if(NOT mdi_FOUND)
message(FATAL_ERROR "MDI library not found. Help CMake to find it "
"by setting mdi_LIBRARY and mdi_INCLUDE_DIR, or set DOWNLOAD_MDI=ON "
"to download and compile it")
endif()
# Link the lammps library against MDI
target_include_directories(lammps PRIVATE ${mdi_INCLUDE_DIR})
target_link_libraries(lammps PRIVATE ${mdi_LIBRARY})
# Link the lammps executable against MDI
target_include_directories(lmp PRIVATE ${mdi_INCLUDE_DIR})
target_link_libraries(lmp PRIVATE ${mdi_LIBRARY})
endif()
target_compile_definitions(lammps PRIVATE -DLMP_USER_MDI)
target_compile_definitions(lmp PRIVATE -DLMP_USER_MDI)

View File

@ -2,8 +2,4 @@ set(MOLFILE_INCLUDE_DIR "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to
set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}") set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}")
add_library(molfile INTERFACE) add_library(molfile INTERFACE)
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS}) target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
# no need to link with -ldl on windows
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
endif()
target_link_libraries(lammps PRIVATE molfile) target_link_libraries(lammps PRIVATE molfile)

View File

@ -0,0 +1,25 @@
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.4.9.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
set(PACELIB_MD5 "4db54962fbd6adcf8c18d46e1798ceb5" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
mark_as_advanced(PACELIB_URL)
mark_as_advanced(PACELIB_MD5)
# download library sources to build folder
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5})
# uncompress downloaded sources
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PACE)
file(GLOB PACE_EVALUATOR_SOURCES ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PACE/*.cpp)
list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp)
add_library(pace STATIC ${PACE_EVALUATOR_SOURCES})
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR})
target_link_libraries(lammps PRIVATE pace)

View File

@ -53,10 +53,17 @@ if(DOWNLOAD_PLUMED)
elseif(PLUMED_MODE STREQUAL "RUNTIME") elseif(PLUMED_MODE STREQUAL "RUNTIME")
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a") set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a")
endif() endif()
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.7.1/plumed-src-2.7.1.tgz" CACHE STRING "URL for PLUMED tarball")
set(PLUMED_MD5 "4eac6a462ec84dfe0cec96c82421b8e8" CACHE STRING "MD5 checksum of PLUMED tarball")
mark_as_advanced(PLUMED_URL)
mark_as_advanced(PLUMED_MD5)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(plumed_build ExternalProject_Add(plumed_build
URL https://github.com/plumed/plumed2/releases/download/v2.6.1/plumed-src-2.6.1.tgz URL ${PLUMED_URL}
URL_MD5 89a9a450fc6025299fe16af235957163 URL_MD5 ${PLUMED_MD5}
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
${CONFIGURE_REQUEST_PIC} ${CONFIGURE_REQUEST_PIC}
@ -65,6 +72,7 @@ if(DOWNLOAD_PLUMED)
${PLUMED_CONFIG_OMP} ${PLUMED_CONFIG_OMP}
CXX=${PLUMED_CONFIG_CXX} CXX=${PLUMED_CONFIG_CXX}
CC=${PLUMED_CONFIG_CC} CC=${PLUMED_CONFIG_CC}
PATCH_COMMAND sed -i "/^#include <algorithm>/a #include <limits>" <SOURCE_DIR>/src/lepton/Operation.h
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS} BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
) )
ExternalProject_get_property(plumed_build INSTALL_DIR) ExternalProject_get_property(plumed_build INSTALL_DIR)

View File

@ -14,15 +14,19 @@ endif()
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT}) option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
if(DOWNLOAD_SCAFACOS) if(DOWNLOAD_SCAFACOS)
message(STATUS "ScaFaCoS download requested - we will build our own") message(STATUS "ScaFaCoS download requested - we will build our own")
set(SCAFACOS_URL "https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz" CACHE STRING "URL for SCAFACOS tarball")
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
mark_as_advanced(SCAFACOS_URL)
mark_as_advanced(SCAFACOS_MD5)
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later. # version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
file(DOWNLOAD https://download.lammps.org/thirdparty/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
EXPECTED_HASH MD5=4baa1333bb28fcce102d505e1992d032) EXPECTED_HASH MD5=4baa1333bb28fcce102d505e1992d032)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(scafacos_build ExternalProject_Add(scafacos_build
URL https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz URL ${SCAFACOS_URL}
URL_MD5 bd46d74e3296bd8a444d731bb10c1738 URL_MD5 ${SCAFACOS_MD5}
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
--enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m --enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m

View File

@ -7,10 +7,14 @@ endif()
option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT}) option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT})
if(DOWNLOAD_EIGEN3) if(DOWNLOAD_EIGEN3)
message(STATUS "Eigen3 download requested - we will build our own") message(STATUS "Eigen3 download requested - we will build our own")
set(EIGEN3_URL "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz" CACHE STRING "URL for Eigen3 tarball")
set(EIGEN3_MD5 "9e30f67e8531477de4117506fe44669b" CACHE STRING "MD5 checksum of Eigen3 tarball")
mark_as_advanced(EIGEN3_URL)
mark_as_advanced(EIGEN3_MD5)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(Eigen3_build ExternalProject_Add(Eigen3_build
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz URL ${EIGEN3_URL}
URL_MD5 9e30f67e8531477de4117506fe44669b URL_MD5 ${EIGEN3_MD5}
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
) )
ExternalProject_get_property(Eigen3_build SOURCE_DIR) ExternalProject_get_property(Eigen3_build SOURCE_DIR)

View File

@ -7,6 +7,11 @@ endif()
option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT}) option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT})
if(DOWNLOAD_VORO) if(DOWNLOAD_VORO)
message(STATUS "Voro++ download requested - we will build our own") message(STATUS "Voro++ download requested - we will build our own")
set(VORO_URL "${LAMMPS_THIRDPARTY_URL}/voro++-0.4.6.tar.gz" CACHE STRING "URL for Voro++ tarball")
set(VORO_MD5 "2338b824c3b7b25590e18e8df5d68af9" CACHE STRING "MD5 checksum for Voro++ tarball")
mark_as_advanced(VORO_URL)
mark_as_advanced(VORO_MD5)
include(ExternalProject) include(ExternalProject)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
@ -22,8 +27,8 @@ if(DOWNLOAD_VORO)
endif() endif()
ExternalProject_Add(voro_build ExternalProject_Add(voro_build
URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz URL ${VORO_URL}
URL_MD5 2338b824c3b7b25590e18e8df5d68af9 URL_MD5 ${VORO_MD5}
PATCH_COMMAND patch -b -p0 < ${LAMMPS_LIB_SOURCE_DIR}/voronoi/voro-make.patch PATCH_COMMAND patch -b -p0 < ${LAMMPS_LIB_SOURCE_DIR}/voronoi/voro-make.patch
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND make ${VORO_BUILD_OPTIONS} BUILD_COMMAND make ${VORO_BUILD_OPTIONS}

View File

@ -9,7 +9,7 @@ function(prevent_in_source_builds)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
# disallow in-source builds # disallow in-source builds
if("${srcdir}" STREQUAL "${bindir}" OR "${srcdir2}" STREQUAL "${bindir}" OR "${srcdir3}" STREQUAL "${bindir}") if(("${srcdir}" STREQUAL "${bindir}") OR ("${srcdir2}" STREQUAL "${bindir}") OR ("${srcdir3}" STREQUAL "${bindir}"))
message(FATAL_ERROR "\ message(FATAL_ERROR "\
CMake must not to be run in the source directory. \ CMake must not to be run in the source directory. \

View File

@ -16,11 +16,14 @@ if(ENABLE_TESTING)
set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command") set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command")
set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options") set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options")
# check if a faster linker is available. # we need to build and link a LOT of tester executables, so it is worth checking if
# only verified with GNU and Clang compilers and new CMake # a faster linker is available. requires GNU or Clang compiler, newer CMake.
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) # also only verified with Fedora Linux > 30 and Ubuntu <= 18.04 (Ubuntu 20.04 fails)
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")) AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND (CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04))
OR ((CMAKE_LINUX_DISTRO STREQUAL "Fedora") AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30)))
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
set(CMAKE_CUSTOM_LINKER_DEFAULT default) set(CMAKE_CUSTOM_LINKER_DEFAULT default)
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG) check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
@ -53,3 +56,76 @@ if(ENABLE_TESTING)
get_filename_component(LAMMPS_UNITTEST_BIN ${CMAKE_BINARY_DIR}/unittest ABSOLUTE) get_filename_component(LAMMPS_UNITTEST_BIN ${CMAKE_BINARY_DIR}/unittest ABSOLUTE)
add_subdirectory(${LAMMPS_UNITTEST_DIR} ${LAMMPS_UNITTEST_BIN}) add_subdirectory(${LAMMPS_UNITTEST_DIR} ${LAMMPS_UNITTEST_BIN})
endif() endif()
# Compiler specific features for testing
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
mark_as_advanced(ENABLE_COVERAGE)
if(ENABLE_COVERAGE)
if(CMAKE_VERSION VERSION_LESS 3.13)
if(CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
endif()
else()
target_compile_options(lammps PUBLIC --coverage)
target_link_options(lammps PUBLIC --coverage)
endif()
endif()
endif()
#######################################
# add custom target for IWYU analysis
#######################################
set(ENABLE_IWYU OFF CACHE BOOL "Add 'iwyu' build target to call the include-what-you-use tool")
mark_as_advanced(ENABLE_IWYU)
if(ENABLE_IWYU)
# enforce these settings
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable reporting compilation commands to compile_commands.json" FORCE)
if(NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
message(FATAL_ERROR "IWYU is only supported with Clang or GNU compilers")
endif()
# detect the "native" header folder so we can include them first
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --print-search-dirs OUTPUT_VARIABLE IWYU_SEARCH_PATHS)
string(REGEX REPLACE ".*libraries: *=([^:]+):.*" "\\1/include" IWYU_EXTRA_INCLUDE_DIR ${IWYU_SEARCH_PATHS})
find_program(IWYU_EXE NAMES include-what-you-use iwyu)
find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py)
if(IWYU_EXE AND IWYU_TOOL)
add_custom_target(
iwyu
${IWYU_TOOL} -o clang -p ${CMAKE_CURRENT_BINARY_DIR} -- -I${IWYU_EXTRA_INCLUDE_DIR} -Xiwyu --mapping_file=${CMAKE_CURRENT_SOURCE_DIR}/iwyu/iwyu-extra-map.imp
COMMENT "Running IWYU")
add_dependencies(iwyu lammps)
else()
message(FATAL_ERROR "To use IWYU you need the include-what-you-use/iwyu executable"
"and the iwyu-tool/iwyu_tool script installed in your PATH")
endif()
endif()
#######################################
# select code sanitizer options
#######################################
set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)")
mark_as_advanced(ENABLE_SANITIZER)
set(ENABLE_SANITIZER_VALUES none address leak thread undefined)
set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${ENABLE_SANITIZER_VALUES})
validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
if(NOT ENABLE_SANITIZER STREQUAL "none")
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
if(CMAKE_VERSION VERSION_LESS 3.13)
if(CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
endif()
else()
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
endif()
else()
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
set(ENABLE_SANITIZER "none")
endif()
endif()

View File

@ -45,7 +45,7 @@ if(BUILD_LAMMPS_SHELL)
target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell) target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell)
# workaround for broken readline pkg-config file on FreeBSD # workaround for broken readline pkg-config file on FreeBSD
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD) if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
target_include_directories(lammps-shell PRIVATE /usr/local/include) target_include_directories(lammps-shell PRIVATE /usr/local/include)
endif() endif()
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE) target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)

47
cmake/Modules/YAML.cmake Normal file
View File

@ -0,0 +1,47 @@
message(STATUS "Downloading and building YAML library")
include(ExternalProject)
set(YAML_URL "https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz" CACHE STRING "URL for libyaml tarball")
set(YAML_MD5 "bb15429d8fb787e7d3f1c83ae129a999" CACHE STRING "MD5 checksum of libyaml tarball")
mark_as_advanced(YAML_URL)
mark_as_advanced(YAML_MD5)
# support cross-compilation to windows
if(CMAKE_CROSSCOMPILING AND (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
set(YAML_CROSS_HOST --host=i686-mingw64)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(YAML_CROSS_HOST --host=x86_64-mingw64)
else()
message(FATAL_ERROR "Unsupported cross-compilation "
" for ${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}"
" on ${CMAKE_HOST_SYSTEM}/${CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
endif()
ExternalProject_Add(libyaml
URL ${YAML_URL}
URL_MD5 ${YAML_MD5}
SOURCE_DIR "${CMAKE_BINARY_DIR}/yaml-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/yaml-build"
CONFIGURE_COMMAND <SOURCE_DIR>/configure ${CONFIGURE_REQUEST_PIC}
CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER}
--prefix=<INSTALL_DIR> --disable-shared ${YAML_CROSS_HOST}
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libyaml${CMAKE_STATIC_LIBRARY_SUFFIX}
TEST_COMMAND "")
ExternalProject_Get_Property(libyaml INSTALL_DIR)
set(YAML_INCLUDE_DIR ${INSTALL_DIR}/include)
set(YAML_LIBRARY_DIR ${INSTALL_DIR}/lib)
# workaround for CMake 3.10 on ubuntu 18.04
file(MAKE_DIRECTORY ${YAML_INCLUDE_DIR})
file(MAKE_DIRECTORY ${YAML_LIBRARY_DIR})
set(YAML_LIBRARY_PATH ${INSTALL_DIR}/lib/libyaml${CMAKE_STATIC_LIBRARY_SUFFIX})
add_library(Yaml::Yaml UNKNOWN IMPORTED)
set_target_properties(Yaml::Yaml PROPERTIES
IMPORTED_LOCATION ${YAML_LIBRARY_PATH}
INTERFACE_INCLUDE_DIRECTORIES ${YAML_INCLUDE_DIR})
add_dependencies(Yaml::Yaml libyaml)

View File

@ -17,7 +17,7 @@ if(GIT_FOUND AND EXISTS ${LAMMPS_DIR}/.git)
ERROR_QUIET ERROR_QUIET
WORKING_DIRECTORY ${LAMMPS_DIR} WORKING_DIRECTORY ${LAMMPS_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified --always
OUTPUT_VARIABLE temp_git_describe OUTPUT_VARIABLE temp_git_describe
ERROR_QUIET ERROR_QUIET
WORKING_DIRECTORY ${LAMMPS_DIR} WORKING_DIRECTORY ${LAMMPS_DIR}

View File

@ -24,7 +24,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: liblammps@LAMMPS_MACHINE@ Name: liblammps@LAMMPS_MACHINE@
Description: Large-scale Atomic/Molecular Massively Parallel Simulator Library Description: Large-scale Atomic/Molecular Massively Parallel Simulator Library
URL: http://lammps.sandia.gov URL: https://www.lammps.org
Version: @PROJECT_VERSION@ Version: @PROJECT_VERSION@
Requires: Requires:
Libs: -L${libdir} -llammps@LAMMPS_MACHINE@ Libs: -L${libdir} -llammps@LAMMPS_MACHINE@

View File

@ -2,16 +2,16 @@
# an existing package selection without losing any other settings # an existing package selection without losing any other settings
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MESSAGE MLIAP GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE
MOLECULE MPIIO MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK MPIIO MSCG OPT PERI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN
SNAP SPIN SRD VORONOI SRD VORONOI
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-ADIOS USER-ATC USER-AWPMD USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESODPD USER-HDNNP USER-INTEL USER-LB USER-MANIFOLD USER-MDI USER-MEAMC USER-MESODPD
USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP
USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP USER-PACE USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP USER-RANN
USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH
USER-SPH USER-TALLY USER-UEF USER-VTK USER-YAFF) USER-TALLY USER-UEF USER-VTK USER-YAFF USER-DIELECTRIC)
foreach(PKG ${ALL_PACKAGES}) foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} OFF CACHE BOOL "" FORCE) set(PKG_${PKG} OFF CACHE BOOL "" FORCE)

View File

@ -4,16 +4,16 @@
# with just a working C++ compiler and an MPI library. # with just a working C++ compiler and an MPI library.
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MESSAGE MLIAP GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE
MOLECULE MPIIO MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK MPIIO MSCG OPT PERI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN
SNAP SPIN SRD VORONOI SRD VORONOI
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-ADIOS USER-ATC USER-AWPMD USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESODPD USER-HDNNP USER-INTEL USER-LB USER-MANIFOLD USER-MDI USER-MEAMC USER-MESODPD
USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP
USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP USER-PACE USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP USER-RANN
USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH
USER-SPH USER-TALLY USER-UEF USER-VTK USER-YAFF) USER-TALLY USER-UEF USER-VTK USER-YAFF USER-DIELECTRIC)
foreach(PKG ${ALL_PACKAGES}) foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE) set(PKG_${PKG} ON CACHE BOOL "" FORCE)

View File

@ -1,13 +1,26 @@
# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes) # preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes)
# prefer flang over gfortran, if available
find_program(CLANG_FORTRAN NAMES flang gfortran f95)
set(ENV{OMPI_FC} ${CLANG_FORTRAN})
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE) set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
set(CMAKE_Fortran_COMPILER ${CLANG_FORTRAN} CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" 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_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 -std=f95" CACHE STRING "" FORCE)
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG -std=f95" CACHE STRING "" FORCE)
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f95" 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 "clang++" CACHE STRING "" FORCE) set(MPI_CXX "clang++" CACHE STRING "" FORCE)
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)
unset(HAVE_OMP_H_INCLUDE CACHE)
set(OpenMP_C "clang" CACHE STRING "" FORCE) set(OpenMP_C "clang" CACHE STRING "" FORCE)
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE) set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE) set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)

View File

@ -1,7 +1,7 @@
# preset that turns on packages with automatic downloads of sources of potentials # Preset that turns on packages with automatic downloads of sources or potentials.
# compilation of libraries like Plumed or ScaFaCoS can take a considerable amount of time. # Compilation of libraries like Plumed or ScaFaCoS can take a considerable amount of time.
set(ALL_PACKAGES KIM LATTE MSCG VORONOI USER-PLUMED USER-SCAFACOS USER-SMD USER-MESONT) set(ALL_PACKAGES KIM LATTE MSCG VORONOI USER-PLUMED USER-SCAFACOS USER-SMD USER-MESONT USER-MDI USER-PACE)
foreach(PKG ${ALL_PACKAGES}) foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE) set(PKG_${PKG} ON CACHE BOOL "" FORCE)
@ -9,9 +9,11 @@ endforeach()
set(DOWNLOAD_KIM ON CACHE BOOL "" FORCE) set(DOWNLOAD_KIM ON CACHE BOOL "" FORCE)
set(DOWNLOAD_LATTE ON CACHE BOOL "" FORCE) set(DOWNLOAD_LATTE ON CACHE BOOL "" FORCE)
set(DOWNLOAD_MDI ON CACHE BOOL "" FORCE)
set(DOWNLOAD_MSCG ON CACHE BOOL "" FORCE) set(DOWNLOAD_MSCG ON CACHE BOOL "" FORCE)
set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
set(DOWNLOAD_PACE ON CACHE BOOL "" FORCE)
set(DOWNLOAD_PLUMED ON CACHE BOOL "" FORCE) set(DOWNLOAD_PLUMED ON CACHE BOOL "" FORCE)
set(DOWNLOAD_SCAFACOS ON CACHE BOOL "" FORCE) set(DOWNLOAD_SCAFACOS ON CACHE BOOL "" FORCE)

View File

@ -2,10 +2,22 @@
set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE) set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE) set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
set(MPI_CXX "g++" CACHE STRING "" FORCE) set(MPI_CXX "g++" CACHE STRING "" FORCE)
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
set(MPI_C "gcc" CACHE STRING "" FORCE)
set(MPI_C_COMPILER "mpicc" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_DEBUG "-Wall -g" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
set(MPI_Fortran "gfortran" CACHE STRING "" FORCE)
set(MPI_Fortran_COMPILER "mpifort" CACHE STRING "" FORCE)
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -g" CACHE STRING "" FORCE)
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE)
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE) unset(HAVE_OMP_H_INCLUDE CACHE)
set(OpenMP_C "gcc" CACHE STRING "" FORCE) set(OpenMP_C "gcc" CACHE STRING "" FORCE)

View File

@ -3,10 +3,20 @@
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE) set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
set(CMAKE_Fortran_COMPILER "ifort" CACHE STRING "" FORCE) set(CMAKE_Fortran_COMPILER "ifort" 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 "icpc" CACHE STRING "" FORCE) set(MPI_CXX "icpc" CACHE STRING "" FORCE)
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)
unset(HAVE_OMP_H_INCLUDE CACHE)
set(OpenMP_C "icc" CACHE STRING "" FORCE) set(OpenMP_C "icc" CACHE STRING "" FORCE)
set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE) set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE)
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE) set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)

View File

@ -1,13 +1,13 @@
set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KSPACE LATTE MANYBODY MC MISC MLIAP MOLECULE OPT GRANULAR KSPACE LATTE MANYBODY MC MISC MLIAP MOLECULE OPT
PERI POEMS QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI PERI POEMS QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-ATC USER-AWPMD USER-BOCS USER-BROWNIAN USER-CGDNA USER-CGSDK
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
USER-FEP USER-INTEL USER-MANIFOLD USER-MEAMC USER-MESODPD USER-HDNNP USER-INTEL USER-MANIFOLD USER-MDI USER-MEAMC USER-MESODPD
USER-MESONT USER-MISC USER-MGPT USER-MOFFF USER-MOLFILE USER-OMP USER-MESONT USER-MISC USER-MGPT USER-MOFFF USER-MOLFILE USER-OMP
USER-PHONON USER-PTM USER-QTB USER-REACTION USER-REAXC USER-PHONON USER-PTM USER-QTB USER-REACTION USER-REAXC
USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF
USER-YAFF) USER-YAFF USER-DIELECTRIC)
foreach(PKG ${WIN_PACKAGES}) foreach(PKG ${WIN_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE) set(PKG_${PKG} ON CACHE BOOL "" FORCE)

View File

@ -4,11 +4,11 @@
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI
POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-MESODPD USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC
USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION USER-MESODPD USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION
USER-REAXC USER-SDPD USER-SPH USER-SMD USER-UEF USER-YAFF) USER-REAXC USER-SDPD USER-SPH USER-SMD USER-UEF USER-YAFF USER-DIELECTRIC)
foreach(PKG ${ALL_PACKAGES}) foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE) set(PKG_${PKG} ON CACHE BOOL "" FORCE)

View File

@ -1,10 +1,11 @@
# preset that turns off all packages that require some form of external # preset that turns off all packages that require some form of external
# library or special compiler (fortran or cuda) or equivalent. # library or special compiler (fortran or cuda) or equivalent.
set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MPIIO MSCG PYTHON set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MESSAGE MPIIO MSCG
VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-H5MD USER-LB PYTHON VORONOI
USER-MOLFILE USER-MESONT USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP USER-ADIOS USER-ATC USER-AWPMD USER-H5MD USER-HDNNP USER-LB USER-MOLFILE
USER-SCAFACOS USER-SMD USER-VTK) USER-MESONT USER-MDI USER-NETCDF USER-PACE USER-PLUMED USER-QMMM USER-QUIP
USER-SCAFACOS USER-SMD USER-VTK)
foreach(PKG ${PACKAGES_WITH_LIB}) foreach(PKG ${PACKAGES_WITH_LIB})
set(PKG_${PKG} OFF CACHE BOOL "" FORCE) set(PKG_${PKG} OFF CACHE BOOL "" FORCE)

View File

@ -0,0 +1,28 @@
# preset that will enable the LLVM based Intel compilers with support for MPI and OpenMP and Fortran (on Linux boxes)
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" CACHE STRING "" FORCE)
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_CXX "icpx" CACHE STRING "" FORCE)
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE)
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)

View File

@ -0,0 +1,26 @@
# preset that will restore gcc/g++ with support for MPI and OpenMP (on Linux boxes)
set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -Werror=vla -Wno-maybe-uninitialized -g" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -Werror=vla -Wno-maybe-uninitialized -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O3 -DNDEBUG" CACHE STRING "" FORCE)
set(MPI_CXX "g++" CACHE STRING "" FORCE)
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
set(MPI_C "gcc" CACHE STRING "" FORCE)
set(MPI_C_COMPILER "mpicc" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -Wno-maybe-uninitialized -g" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -Wno-maybe-uninitialized -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELEASE "-Wall -O3 -DNDEBUG" CACHE STRING "" FORCE)
set(MPI_Fortran "gfortran" CACHE STRING "" FORCE)
set(MPI_Fortran_COMPILER "mpifort" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)
set(OpenMP_C "gcc" CACHE STRING "" FORCE)
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
set(OpenMP_C_LIB_NAMES "gomp" CACHE STRING "" FORCE)
set(OpenMP_CXX "g++" CACHE STRING "" FORCE)
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
set(OpenMP_CXX_LIB_NAMES "gomp" CACHE STRING "" FORCE)
set(OpenMP_omp_LIBRARY "libgomp.so" CACHE PATH "" FORCE)

16
cmake/presets/pgi.cmake Normal file
View File

@ -0,0 +1,16 @@
# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes)
set(CMAKE_CXX_COMPILER "pgc++" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "pgcc" CACHE STRING "" FORCE)
set(CMAKE_Fortran_COMPILER "pgfortran" CACHE STRING "" FORCE)
set(MPI_CXX "pgc++" CACHE STRING "" FORCE)
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)
set(OpenMP_C "pgcc" CACHE STRING "" FORCE)
set(OpenMP_C_FLAGS "-mp" CACHE STRING "" FORCE)
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_CXX "pgc++" CACHE STRING "" FORCE)
set(OpenMP_CXX_FLAGS "-mp" CACHE STRING "" FORCE)
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)

View File

@ -10,7 +10,6 @@ endif
BUILDDIR = ${CURDIR} BUILDDIR = ${CURDIR}
RSTDIR = $(BUILDDIR)/src RSTDIR = $(BUILDDIR)/src
VENV = $(BUILDDIR)/docenv VENV = $(BUILDDIR)/docenv
TXT2RST = $(VENV)/bin/txt2rst
ANCHORCHECK = $(VENV)/bin/rst_anchor_check ANCHORCHECK = $(VENV)/bin/rst_anchor_check
SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config
MATHJAX = $(SPHINXCONFIG)/_static/mathjax MATHJAX = $(SPHINXCONFIG)/_static/mathjax
@ -47,6 +46,8 @@ HAS_PDFLATEX = YES
endif endif
endif endif
# override settings for PIP commands
# PIP_OPTIONS = --cert /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt --proxy http://proxy.mydomain.org
#SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())') $(shell test -f $(BUILDDIR)/doxygen/xml/run.stamp && printf -- "-E") #SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())') $(shell test -f $(BUILDDIR)/doxygen/xml/run.stamp && printf -- "-E")
@ -57,7 +58,7 @@ SPHINXEXTRA = -E -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiproc
# we only want to use explicitly listed files. # 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\|\)//') 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 rst html pdf spelling anchor_check style_check xmlgen .PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check char_check xmlgen
# ------------------------------------------ # ------------------------------------------
@ -66,7 +67,6 @@ help:
@echo "Please use \`make <target>' where <target> is one of" @echo "Please use \`make <target>' where <target> is one of"
@echo " html create HTML pages in html dir" @echo " html create HTML pages in html dir"
@echo " pdf create Manual.pdf in this dir" @echo " pdf create Manual.pdf in this dir"
@echo " fetch fetch HTML and PDF files from LAMMPS web site"
@echo " epub create ePUB format manual for e-book readers" @echo " epub create ePUB format manual for e-book readers"
@echo " mobi convert ePUB to MOBI format manual for e-book readers (e.g. Kindle)" @echo " mobi convert ePUB to MOBI format manual for e-book readers (e.g. Kindle)"
@echo " (requires ebook-convert tool from calibre)" @echo " (requires ebook-convert tool from calibre)"
@ -94,7 +94,7 @@ $(SPHINXCONFIG)/conf.py: $(SPHINXCONFIG)/conf.py.in
-e 's,@LAMMPS_PYTHON_DIR@,$(BUILDDIR)/../python,g' \ -e 's,@LAMMPS_PYTHON_DIR@,$(BUILDDIR)/../python,g' \
-e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@ -e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@
html: xmlgen $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
@$(MAKE) $(MFLAGS) -C graphviz all @$(MAKE) $(MFLAGS) -C graphviz all
@(\ @(\
@ -118,7 +118,7 @@ html: xmlgen $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
@rm -rf html/PDF/.[sg]* @rm -rf html/PDF/.[sg]*
@echo "Build finished. The HTML pages are in doc/html." @echo "Build finished. The HTML pages are in doc/html."
spelling: xmlgen $(VENV) $(SPHINXCONFIG)/false_positives.txt spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
@(\ @(\
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \ . $(VENV)/bin/activate ; env PYTHONWARNINGS= \
@ -183,13 +183,6 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
@rm -rf latex/PDF/.[sg]* @rm -rf latex/PDF/.[sg]*
@echo "Build finished. Manual.pdf is in this directory." @echo "Build finished. Manual.pdf is in this directory."
fetch:
@rm -rf html_www Manual_www.pdf
@curl -s -o Manual_www.pdf http://lammps.sandia.gov/doc/Manual.pdf
@curl -s -o lammps-doc.tar.gz http://lammps.sandia.gov/tars/lammps-doc.tar.gz
@tar xzf lammps-doc.tar.gz
@rm -f lammps-doc.tar.gz
anchor_check : $(ANCHORCHECK) anchor_check : $(ANCHORCHECK)
@(\ @(\
. $(VENV)/bin/activate ;\ . $(VENV)/bin/activate ;\
@ -211,6 +204,9 @@ package_check : $(VENV)
deactivate ;\ deactivate ;\
) )
char_check :
@( env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst && exit 1 || : )
xmlgen : doxygen/xml/index.xml xmlgen : doxygen/xml/index.xml
doxygen/Doxyfile: doxygen/Doxyfile.in doxygen/Doxyfile: doxygen/Doxyfile.in
@ -228,15 +224,15 @@ $(VENV):
@( \ @( \
$(VIRTUALENV) -p $(PYTHON) $(VENV); \ $(VIRTUALENV) -p $(PYTHON) $(VENV); \
. $(VENV)/bin/activate; \ . $(VENV)/bin/activate; \
pip install --upgrade pip; \ pip $(PIP_OPTIONS) install --upgrade pip; \
pip install --use-feature=2020-resolver -r $(BUILDDIR)/utils/requirements.txt; \ pip $(PIP_OPTIONS) install -r $(BUILDDIR)/utils/requirements.txt; \
deactivate;\ deactivate;\
) )
$(MATHJAX): $(MATHJAX):
@git clone --depth 1 https://github.com/mathjax/MathJax.git $@ @git clone -b 3.2.0 -c advice.detachedHead=0 --depth 1 git://github.com/mathjax/MathJax.git $@
$(TXT2RST) $(ANCHORCHECK): $(VENV) $(ANCHORCHECK): $(VENV)
@( \ @( \
. $(VENV)/bin/activate; \ . $(VENV)/bin/activate; \
(cd utils/converters;\ (cd utils/converters;\

View File

@ -25,16 +25,11 @@ github-development-workflow.md notes on the LAMMPS development workflow
include-file-conventions.md notes on LAMMPS' include file conventions include-file-conventions.md notes on LAMMPS' include file conventions
documentation_conventions.md notes on writing documentation for LAMMPS documentation_conventions.md notes on writing documentation for LAMMPS
If you downloaded a LAMMPS tarball from lammps.sandia.gov, then the html 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 folder and the PDF manual should be included. If you downloaded LAMMPS
from GitHub then you either need to download them or build them. from GitHub then you either need to build them.
(a) You can "fetch" the current HTML and PDF files from the LAMMPS web You can build the HTML and PDF files yourself, by typing "make html"
site. Just type "make fetch". This should create a html_www directory
and Manual_www.pdf file. These will always represent the latest published
patch/development version of LAMMPS.
(b) You can build the HTML and PDF files yourself, by typing "make html"
or by "make pdf", respectively. This requires various tools and files. or by "make pdf", respectively. This requires various tools and files.
Some of them have to be installed (more on that below). For the rest the Some of them have to be installed (more on that below). For the rest the
build process will attempt to download and install into a python virtual build process will attempt to download and install into a python virtual
@ -78,4 +73,4 @@ the tool 'ebook-convert' from the 'calibre' e-book management software
---------------- ----------------
More details this can be found in the manual itself. The online More details this can be found in the manual itself. The online
version is at: https://lammps.sandia.gov/doc/Manual_build.html version is at: https://docs.lammps.org/Build_manual.html

View File

@ -424,6 +424,8 @@ INPUT = @LAMMPS_SOURCE_DIR@/utils.cpp \
@LAMMPS_SOURCE_DIR@/input.h \ @LAMMPS_SOURCE_DIR@/input.h \
@LAMMPS_SOURCE_DIR@/tokenizer.cpp \ @LAMMPS_SOURCE_DIR@/tokenizer.cpp \
@LAMMPS_SOURCE_DIR@/tokenizer.h \ @LAMMPS_SOURCE_DIR@/tokenizer.h \
@LAMMPS_SOURCE_DIR@/arg_info.cpp \
@LAMMPS_SOURCE_DIR@/arg_info.h \
@LAMMPS_SOURCE_DIR@/text_file_reader.cpp \ @LAMMPS_SOURCE_DIR@/text_file_reader.cpp \
@LAMMPS_SOURCE_DIR@/text_file_reader.h \ @LAMMPS_SOURCE_DIR@/text_file_reader.h \
@LAMMPS_SOURCE_DIR@/potential_file_reader.cpp \ @LAMMPS_SOURCE_DIR@/potential_file_reader.cpp \

View File

@ -95,7 +95,7 @@ on the pull request discussion page on GitHub, so that other developers
can later review the entire discussion after the fact and understand the can later review the entire discussion after the fact and understand the
rationale behind choices made. Exceptions to this policy are technical rationale behind choices made. Exceptions to this policy are technical
discussions, that are centered on tools or policies themselves discussions, that are centered on tools or policies themselves
(git, github, c++) rather than on the content of the pull request. (git, GitHub, c++) rather than on the content of the pull request.
### Checklist for Pull Requests ### Checklist for Pull Requests

View File

@ -18,8 +18,8 @@ digraph lammps {
Up [shape=box label="Update" color=blue] Up [shape=box label="Update" color=blue]
Un [shape=box label="Universe" color=blue] Un [shape=box label="Universe" color=blue]
Ti [shape=box label="Timer" color=blue] Ti [shape=box label="Timer" color=blue]
Lt [label="Lattice"]
Rg [label="Region" color=red] Rg [label="Region" color=red]
Lt [label="Lattice"]
Rb [shape=box label="RegionBlock"] Rb [shape=box label="RegionBlock"]
Rs [shape=box label="RegionSphere"] Rs [shape=box label="RegionSphere"]
Av [label="AtomVec" color=red] Av [label="AtomVec" color=red]
@ -34,6 +34,7 @@ digraph lammps {
Du [label="Dump" color=red] Du [label="Dump" color=red]
Fi [label="Fix" color=red] Fi [label="Fix" color=red]
Cp [label="Compute" color=red] Cp [label="Compute" color=red]
Cm [label="Command" color=red]
Th [label="Thermo"] Th [label="Thermo"]
Va [label="Variable"] Va [label="Variable"]
Ew [shape=box label="Ewald"] Ew [shape=box label="Ewald"]
@ -71,16 +72,19 @@ digraph lammps {
Dg [shape=box label="DumpCFG"] Dg [shape=box label="DumpCFG"]
Ve [shape=box label="Verlet"] Ve [shape=box label="Verlet"]
Rr [shape=box label="Respa"] Rr [shape=box label="Respa"]
Ru [shape=box label="Run"]
Se [shape=box label="Set"]
Pt [shape=box label="PPPMTIP4P"] Pt [shape=box label="PPPMTIP4P"]
Vs [shape=box label="VerletSplit"] Vs [shape=box label="VerletSplit"]
Ro [shape=box label="RespaOMP"] Ro [shape=box label="RespaOMP"]
Mc [shape=box label="MinCG"] Mc [shape=box label="MinCG"]
Mf [shape=box label="MinFire"] Mf [shape=box label="MinFire"]
La -> {At Ci Co Do Er Fo Gr In Me Mo Ne Ou Ti Up Un} [penwidth=2] La -> {At Ci Co Do Er Fo Gr In Me Mo Ne Ou Ti Up Un} [penwidth=2]
Do -> {Lt Rg} [penwidth=2] Do -> {Rg Lt} [penwidth=2]
Rg -> {Rb Rs} [style=dashed penwidth=2] Rg -> {Rb Rs} [style=dashed penwidth=2]
Co -> {Cb Ct} [style=dashed penwidth=2] Co -> {Cb Ct} [style=dashed penwidth=2]
In -> Va [penwidth=2] In -> {Va Cm} [penwidth=2]
Cm -> {Ru Se} [style=dashed penwidth=2]
Mo -> {Fi Cp} [penwidth=2] Mo -> {Fi Cp} [penwidth=2]
Fo -> {Pa Bo An Di Im Ks} [penwidth=2] Fo -> {Pa Bo An Di Im Ks} [penwidth=2]
Ks -> {Ew Pp} [style=dashed penwidth=2] Ks -> {Ew Pp} [style=dashed penwidth=2]

View File

@ -1,4 +1,4 @@
.TH LAMMPS "29 October 2020" "2020-10-29" .TH LAMMPS "27 May 2021" "2021-05-27"
.SH NAME .SH NAME
.B LAMMPS .B LAMMPS
\- Molecular Dynamics Simulator. \- Molecular Dynamics Simulator.
@ -34,7 +34,7 @@ semiconductors) and coarse-grained or mesoscopic systems. It can be used to
model atoms or, more generically, as a parallel particle simulator at the model atoms or, more generically, as a parallel particle simulator at the
atomic, meso, or continuum scale. atomic, meso, or continuum scale.
See https://lammps.sandia.gov/ for more information and documentation. See https://www.lammps.org/ for more information and documentation.
.SH EXECUTABLE NAME .SH EXECUTABLE NAME
The The

View File

@ -1129,6 +1129,9 @@ Bibliography
**(Sutmann)** **(Sutmann)**
Sutmann, Arnold, Fahrenberger, et. al., Physical review / E 88(6), 063308 (2013) Sutmann, Arnold, Fahrenberger, et. al., Physical review / E 88(6), 063308 (2013)
**(Sutmann)** G. Sutmann. ScaFaCoS - a Scalable library of Fast Coulomb Solvers for particle Systems.
In Bajaj, Zavattieri, Koslowski, Siegmund, Proceedings of the Society of Engineering Science 51st Annual Technical Meeting. 2014.
**(Swinburne)** **(Swinburne)**
Swinburne and Marinica, Physical Review Letters, 120, 1 (2018) Swinburne and Marinica, Physical Review Letters, 120, 1 (2018)
@ -1285,9 +1288,6 @@ Bibliography
**(Wennberg)** **(Wennberg)**
Wennberg, Murtola, Hess, Lindahl, J Chem Theory Comput, 9, 3527 (2013). Wennberg, Murtola, Hess, Lindahl, J Chem Theory Comput, 9, 3527 (2013).
**(Who)**
Who, Author2, Author3, J of Long Range Solvers, 35, 164-177 (2012).
**(Wicaksono1)** **(Wicaksono1)**
Wicaksono, Sinclair, Militzer, Computational Materials Science, 117, 397-405 (2016). Wicaksono, Sinclair, Militzer, Computational Materials Science, 117, 397-405 (2016).

View File

@ -1,7 +1,7 @@
Basic build options Basic build options
=================== ===================
The following topics are covered on this page, for building both with The following topics are covered on this page, for building with both
CMake and make: CMake and make:
* :ref:`Serial vs parallel build <serial>` * :ref:`Serial vs parallel build <serial>`
@ -95,7 +95,7 @@ standard. A more detailed discussion of that is below.
.. note:: .. note::
The file ``src/STUBS/mpi.c`` provides a CPU timer function The file ``src/STUBS/mpi.cpp`` provides a CPU timer function
called ``MPI_Wtime()`` that calls ``gettimeofday()``. If your called ``MPI_Wtime()`` that calls ``gettimeofday()``. If your
operating system does not support ``gettimeofday()``, you will operating system does not support ``gettimeofday()``, you will
need to insert code to call another timer. Note that the need to insert code to call another timer. Note that the
@ -234,14 +234,21 @@ LAMMPS.
cmake ../cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran cmake ../cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran
# Building with Intel Compilers: # Building with Intel Compilers:
cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort
# Building with Intel oneAPI Compilers:
cmake ../cmake -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DCMAKE_Fortran_COMPILER=ifx
# Building with LLVM/Clang Compilers: # Building with LLVM/Clang Compilers:
cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang
# Building with PGI/Nvidia Compilers:
cmake ../cmake -DCMAKE_C_COMPILER=pgcc -DCMAKE_CXX_COMPILER=pgc++ -DCMAKE_Fortran_COMPILER=pgfortran
For compiling with the Clang/LLVM compilers a CMake preset is For compiling with the Clang/LLVM compilers a CMake preset is
provided that can be loaded with provided that can be loaded with
`-C ../cmake/presets/clang.cmake`. Similarly, `-C ../cmake/presets/clang.cmake`. Similarly,
`-C ../cmake/presets/intel.cmake` should switch the compiler `-C ../cmake/presets/intel.cmake` should switch the compiler
toolchain to the Intel compilers. toolchain to the legacy Intel compilers, `-C ../cmake/presets/oneapi.cmake`
will switch to the LLVM based oneAPI Intel compilers,
and `-C ../cmake/presets/pgi.cmake`
will switch the compiler to the PGI compilers.
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add
compiler flags to tune for optimal performance on given hosts. By compiler flags to tune for optimal performance on given hosts. By
@ -523,6 +530,20 @@ you want to copy files to is protected.
make # perform make after CMake command make # perform make after CMake command
make install # perform the installation into prefix make install # perform the installation into prefix
During the installation process CMake will by default remove any runtime
path settings for loading shared libraries. Because of this you may
have to set or modify the ``LD_LIBRARY_PATH`` (or ``DYLD_LIBRARY_PATH``)
environment variable, if you are installing LAMMPS into a non-system
location and/or are linking to libraries in a non-system location that
depend on such runtime path settings.
As an alternative you may set the CMake variable ``LAMMPS_INSTALL_RPATH``
to ``on`` and then the runtime paths for any linked shared libraries
and the library installation folder for the LAMMPS library will be
embedded and thus the requirement to set environment variables is avoided.
The ``off`` setting is usually preferred for packaged binaries or when
setting up environment modules, the ``on`` setting is more convenient
for installing software into a non-system or personal folder.
.. tab:: Traditional make .. tab:: Traditional make
There is no "install" option in the ``src/Makefile`` for LAMMPS. There is no "install" option in the ``src/Makefile`` for LAMMPS.

View File

@ -28,6 +28,28 @@ variable VERBOSE set to 1:
---------- ----------
.. _clang-tidy:
Enable static code analysis with clang-tidy
-------------------------------------------
The `clang-tidy tool <https://clang.llvm.org/extra/clang-tidy/>`_ is a
static code analysis tool to diagnose (and potentially fix) typical
programming errors or coding style violations. It has a modular framework
of tests that can be adjusted to help identifying problems before they
become bugs and also assist in modernizing large code bases (like LAMMPS).
It can be enabled for all C++ code with the following CMake flag
.. code-block:: bash
-D ENABLE_CLANG_TIDY=value # value = no (default) or yes
With this flag enabled all source files will be processed twice, first to
be compiled and then to be analyzed. Please note that the analysis can be
significantly more time consuming than the compilation itself.
----------
.. _iwyu_processing: .. _iwyu_processing:
Report missing and unneeded '#include' statements Report missing and unneeded '#include' statements
@ -108,11 +130,18 @@ results over a given number of steps and operations within a given
error margin). The status of this automated testing can be viewed on error margin). The status of this automated testing can be viewed on
`https://ci.lammps.org <https://ci.lammps.org>`_. `https://ci.lammps.org <https://ci.lammps.org>`_.
The scripts and inputs for integration, run, and regression testing
are maintained in a
`separate repository <https://github.com/lammps/lammps-testing>`_
of the LAMMPS project on GitHub.
The unit testing facility is integrated into the CMake build process The unit testing facility is integrated into the CMake build process
of the LAMMPS source code distribution itself. It can be enabled by of the LAMMPS source code distribution itself. It can be enabled by
setting ``-D ENABLE_TESTING=on`` during the CMake configuration step. setting ``-D ENABLE_TESTING=on`` during the CMake configuration step.
It requires the `PyYAML <http://pyyaml.org/>`_ library and development It requires the `YAML <http://pyyaml.org/>`_ library and development
headers to compile and will download and compile a recent version of the headers (if those are not found locally a recent version will be
downloaded and compiled along with LAMMPS and the test program) to
compile and will download and compile a specific recent version of the
`Googletest <https://github.com/google/googletest/>`_ C++ test framework `Googletest <https://github.com/google/googletest/>`_ C++ test framework
for implementing the tests. for implementing the tests.
@ -162,22 +191,21 @@ The ``ctest`` command has many options, the most important ones are:
In its full implementation, the unit test framework will consist of multiple In its full implementation, the unit test framework will consist of multiple
kinds of tests implemented in different programming languages (C++, C, Python, kinds of tests implemented in different programming languages (C++, C, Python,
Fortran) and testing different aspects of the LAMMPS software and its features. Fortran) and testing different aspects of the LAMMPS software and its features.
At the moment only tests for "force styles" are implemented. More on those The tests will adapt to the compilation settings of LAMMPS, so that tests
in the next section. will be skipped if prerequisite features are not available in LAMMPS.
.. note:: .. note::
The unit test framework is new and still under development. The unit test framework was added in spring 2020 and is under active
The coverage is only minimal and will be expanded over time. development. The coverage is not complete and will be expanded over
Tests styles of the same kind of style (e.g. pair styles or time.
bond styles) are performed with the same executable using
different input files in YAML format. So to add a test for Tests for styles of the same kind of style (e.g. pair styles or bond
another pair style can be done by copying the YAML file and styles) are performed with the same test executable using different
editing the style settings and then running the individual test input files in YAML format. So to add a test for another style of the
program with a flag to update the computed reference data. same kind it may be sufficient to add a suitable YAML file.
Detailed documentation about how to add new test program and :doc:`Detailed instructions for adding tests <Developer_unittest>` are
the contents of the YAML files for existing test programs provided in the Programmer Guide part of the manual.
will be provided in time as well.
Unit tests for force styles Unit tests for force styles
^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -441,12 +469,24 @@ The following options are available.
.. code-block:: bash .. code-block:: bash
make check-whitespace # generate coverage report in HTML format make check-whitespace # search for files with whitespace issues
make fix-whitespace # generate coverage report in XML format make fix-whitespace # correct whitespace issues in files
make check-permissions # delete folder with HTML format coverage report make check-homepage # search for files with old LAMMPS homepage URLs
make fix-permissions # delete all collected coverage data and HTML output make fix-homepage # correct LAMMPS homepage URLs in files
make check-permissions # search for files with permissions issues
make fix-permissions # correct permissions issues in files
For the code in the ``unittest`` tree we are using the `clang-format` For the code in the ``unittest`` and ``src`` trees we are transitioning
tool (Clang version 8.0 or later is required). If available, the source to use the `clang-format` tool to assist with having a consistent source
code files in the ``unittest`` tree can be updated to conform to the code style. The `clang-format` command bundled with Clang version 8.0
formatting settings using ``make format-tests``. or later is required. The configuration is in files ``.clang-format``
in the respective folders. Since the modifications from `clang-format`
can be significant and - especially for "legacy style code" - also is
not always improving readability, a large number of files currently have
a ``// clang-format off`` at the top, which will disable the processing.
Over time, files will be refactored and updated to that `clang-format`
may be applied to them (at least in part).
If `clang-format` is available, the source code files in the ``unittest``
tree can be updated to conform to the formatting settings using
``make format-tests`` and the files in ``src`` with ``make format-src``.

View File

@ -37,6 +37,7 @@ This is the list of packages that may require additional steps.
* :ref:`KOKKOS <kokkos>` * :ref:`KOKKOS <kokkos>`
* :ref:`LATTE <latte>` * :ref:`LATTE <latte>`
* :ref:`MESSAGE <message>` * :ref:`MESSAGE <message>`
* :ref:`MLIAP <mliap>`
* :ref:`MSCG <mscg>` * :ref:`MSCG <mscg>`
* :ref:`OPT <opt>` * :ref:`OPT <opt>`
* :ref:`POEMS <poems>` * :ref:`POEMS <poems>`
@ -47,10 +48,13 @@ This is the list of packages that may require additional steps.
* :ref:`USER-AWPMD <user-awpmd>` * :ref:`USER-AWPMD <user-awpmd>`
* :ref:`USER-COLVARS <user-colvars>` * :ref:`USER-COLVARS <user-colvars>`
* :ref:`USER-H5MD <user-h5md>` * :ref:`USER-H5MD <user-h5md>`
* :ref:`USER-HDNNP <user-hdnnp>`
* :ref:`USER-INTEL <user-intel>` * :ref:`USER-INTEL <user-intel>`
* :ref:`USER-MDI <user-mdi>`
* :ref:`USER-MESONT <user-mesont>` * :ref:`USER-MESONT <user-mesont>`
* :ref:`USER-MOLFILE <user-molfile>` * :ref:`USER-MOLFILE <user-molfile>`
* :ref:`USER-NETCDF <user-netcdf>` * :ref:`USER-NETCDF <user-netcdf>`
* :ref:`USER-PACE <user-pace>`
* :ref:`USER-PLUMED <user-plumed>` * :ref:`USER-PLUMED <user-plumed>`
* :ref:`USER-OMP <user-omp>` * :ref:`USER-OMP <user-omp>`
* :ref:`USER-QMMM <user-qmmm>` * :ref:`USER-QMMM <user-qmmm>`
@ -119,21 +123,21 @@ CMake build
-D GPU_API=value # value = opencl (default) or cuda or hip -D GPU_API=value # value = opencl (default) or cuda or hip
-D GPU_PREC=value # precision setting -D GPU_PREC=value # precision setting
# value = double or mixed (default) or single # value = double or mixed (default) or single
-D OCL_TUNE=value # hardware choice for GPU_API=opencl
# generic (default) or intel (Intel CPU) or fermi, kepler, cypress (NVIDIA)
-D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda -D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda
# value = sm_XX, see below # value = sm_XX, see below
# default is sm_50 # default is sm_50
-D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip -D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip
# value depends on selected HIP_PLATFORM # value depends on selected HIP_PLATFORM
# default is 'gfx906' for HIP_PLATFORM=hcc and 'sm_50' for HIP_PLATFORM=nvcc # default is 'gfx906' for HIP_PLATFORM=amd and 'sm_50' for HIP_PLATFORM=nvcc
-D HIP_USE_DEVICE_SORT=value # enables GPU sorting -D HIP_USE_DEVICE_SORT=value # enables GPU sorting
# value = yes (default) or no # value = yes (default) or no
-D CUDPP_OPT=value # optimization setting for GPU_API=cuda -D CUDPP_OPT=value # use GPU binning on with CUDA (should be off for modern GPUs)
# enables CUDA Performance Primitives Optimizations # enables CUDA Performance Primitives, must be "no" for CUDA_MPS_SUPPORT=yes
# value = yes (default) or no # value = yes or no (default)
-D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active nvidia-cuda-mps daemon -D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active nvidia-cuda-mps daemon
# value = yes or no (default) # value = yes or no (default)
-D USE_STATIC_OPENCL_LOADER=value # downloads/includes OpenCL ICD loader library, no local OpenCL headers/libs needed
# value = yes (default) or no
:code:`GPU_ARCH` settings for different GPU hardware is as follows: :code:`GPU_ARCH` settings for different GPU hardware is as follows:
@ -160,19 +164,32 @@ When building with CMake, you **must NOT** build the GPU library in ``lib/gpu``
using the traditional build procedure. CMake will detect files generated by that using the traditional build procedure. CMake will detect files generated by that
process and will terminate with an error and a suggestion for how to remove them. process and will terminate with an error and a suggestion for how to remove them.
If you are compiling for OpenCL, the default setting is to download, build, and
link with a static OpenCL ICD loader library and standard OpenCL headers. This
way no local OpenCL development headers or library needs to be present and only
OpenCL compatible drivers need to be installed to use OpenCL. If this is not
desired, you can set :code:`USE_STATIC_OPENCL_LOADER` to :code:`no`.
If you are compiling with HIP, note that before running CMake you will have to If you are compiling with HIP, note that before running CMake you will have to
set appropriate environment variables. Some variables such as set appropriate environment variables. Some variables such as
:code:`HCC_AMDGPU_TARGET` or :code:`CUDA_PATH` are necessary for :code:`hipcc` :code:`HCC_AMDGPU_TARGET` (for ROCm <= 4.0) or :code:`CUDA_PATH` are necessary for :code:`hipcc`
and the linker to work correctly. and the linker to work correctly.
.. code:: bash .. code:: bash
# AMDGPU target # AMDGPU target (ROCm <= 4.0)
export HIP_PLATFORM=hcc export HIP_PLATFORM=hcc
export HCC_AMDGPU_TARGET=gfx906 export HCC_AMDGPU_TARGET=gfx906
cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc .. cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc ..
make -j 4 make -j 4
.. code:: bash
# AMDGPU target (ROCm >= 4.1)
export HIP_PLATFORM=amd
cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc ..
make -j 4
.. code:: bash .. code:: bash
# CUDA target (not recommended, use GPU_ARCH=cuda) # CUDA target (not recommended, use GPU_ARCH=cuda)
@ -218,11 +235,20 @@ Makefile if desired:
* ``CUDA_PRECISION`` = precision (double, mixed, single) * ``CUDA_PRECISION`` = precision (double, mixed, single)
* ``EXTRAMAKE`` = which Makefile.lammps.\* file to copy to Makefile.lammps * ``EXTRAMAKE`` = which Makefile.lammps.\* file to copy to Makefile.lammps
The file Makefile.linux_multi is set up to include support for multiple The file Makefile.cuda is set up to include support for multiple
GPU architectures as supported by the CUDA toolkit in use. This is done GPU architectures as supported by the CUDA toolkit in use. This is done
through using the "--gencode " flag, which can be used multiple times and through using the "--gencode " flag, which can be used multiple times and
thus support all GPU architectures supported by your CUDA compiler. thus support all GPU architectures supported by your CUDA compiler.
To enable GPU binning via CUDA performance primitives set the Makefile variable
``CUDPP_OPT = -DUSE_CUDPP -Icudpp_mini``. This should **not** be used with
most modern GPUs.
To support the CUDA multiprocessor server you can set the define
``-DCUDA_PROXY``. Please note that in this case you must **not** use
the CUDA performance primitives and thus set the variable ``CUDPP_OPT``
to empty.
If the library build is successful, 3 files should be created: If the library build is successful, 3 files should be created:
``lib/gpu/libgpu.a``\ , ``lib/gpu/nvc_get_devices``\ , and ``lib/gpu/libgpu.a``\ , ``lib/gpu/nvc_get_devices``\ , and
``lib/gpu/Makefile.lammps``\ . The latter has settings that enable LAMMPS ``lib/gpu/Makefile.lammps``\ . The latter has settings that enable LAMMPS
@ -249,18 +275,18 @@ To build with this package, the KIM library with API v2 must be downloaded
and built on your system. It must include the KIM models that you want to and built on your system. It must include the KIM models that you want to
use with LAMMPS. use with LAMMPS.
If you would like to use the :doc:`kim_query <kim_commands>` If you would like to use the :doc:`kim query <kim_commands>`
command, you also need to have libcurl installed with the matching command, you also need to have libcurl installed with the matching
development headers and the curl-config tool. development headers and the curl-config tool.
If you would like to use the :doc:`kim_property <kim_commands>` If you would like to use the :doc:`kim property <kim_commands>`
command, you need to build LAMMPS with the PYTHON package installed command, you need to build LAMMPS with the PYTHON package installed
and linked to Python 3.6 or later. See the :ref:`PYTHON package build info <python>` and linked to Python 3.6 or later. See the :ref:`PYTHON package build info <python>`
for more details on this. After successfully building LAMMPS with Python, you for more details on this. After successfully building LAMMPS with Python, you
also need to install the kim-property Python package, which can be easily done using also need to install the ``kim-property`` Python package, which can be easily
*pip* as ``pip install kim-property``, or from the *conda-forge* channel as done using *pip* as ``pip install kim-property``, or from the *conda-forge*
``conda install kim-property`` if LAMMPS is built in Conda. More detailed channel as ``conda install kim-property`` if LAMMPS is built in Conda. More
information is available at: detailed information is available at:
`kim-property installation <https://github.com/openkim/kim-property#installing-kim-property>`_. `kim-property installation <https://github.com/openkim/kim-property#installing-kim-property>`_.
In addition to installing the KIM API, it is also necessary to install the In addition to installing the KIM API, it is also necessary to install the
@ -282,6 +308,7 @@ minutes to hours) to build. Of course you only need to do that once.)
-D DOWNLOAD_KIM=value # download OpenKIM API v2 for build, value = no (default) or yes -D DOWNLOAD_KIM=value # download OpenKIM API v2 for build, value = no (default) or yes
-D LMP_DEBUG_CURL=value # set libcurl verbose mode on/off, value = off (default) or on -D LMP_DEBUG_CURL=value # set libcurl verbose mode on/off, value = off (default) or on
-D LMP_NO_SSL_CHECK=value # tell libcurl to not verify the peer, value = no (default) or yes -D LMP_NO_SSL_CHECK=value # tell libcurl to not verify the peer, value = no (default) or yes
-D KIM_EXTRA_UNITTESTS=value # enables extra unit tests, value = no (default) or yes
If ``DOWNLOAD_KIM`` is set to *yes* (or *on*), the KIM API library If ``DOWNLOAD_KIM`` is set to *yes* (or *on*), the KIM API library
will be downloaded and built inside the CMake build directory. If will be downloaded and built inside the CMake build directory. If
@ -290,11 +317,16 @@ minutes to hours) to build. Of course you only need to do that once.)
``PKG_CONFIG_PATH`` environment variable so that libkim-api can be ``PKG_CONFIG_PATH`` environment variable so that libkim-api can be
found, or run the command ``source kim-api-activate``. found, or run the command ``source kim-api-activate``.
Extra unit tests can only be available if they are explicitly requested
(``KIM_EXTRA_UNITTESTS`` is set to *yes* (or *on*)) and the prerequisites
are met. See :ref:`KIM Extra unit tests <kim_extra_unittests>` for
more details on this.
.. tab:: Traditional make .. tab:: Traditional make
You can download and build the KIM library manually if you prefer; You can download and build the KIM library manually if you prefer;
follow the instructions in ``lib/kim/README``. You can also do follow the instructions in ``lib/kim/README``. You can also do
this in one step from the lammps/src dir, using a command like this in one step from the lammps/src directory, using a command like
these, which simply invoke the ``lib/kim/Install.py`` script with these, which simply invoke the ``lib/kim/Install.py`` script with
the specified args. the specified args.
@ -314,7 +346,7 @@ minutes to hours) to build. Of course you only need to do that once.)
.. code-block:: make .. code-block:: make
LMP_INC = -DLMP_NO_SSL_CHECK LMP_INC = -DLMP_NO_SSL_CHECK
Debugging OpenKIM web queries in LAMMPS Debugging OpenKIM web queries in LAMMPS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -338,6 +370,39 @@ specify your own CA cert path by setting the environment variable
``CURL_CA_BUNDLE`` to the path of your choice. A call to the KIM web ``CURL_CA_BUNDLE`` to the path of your choice. A call to the KIM web
query would get this value from the environment variable. query would get this value from the environment variable.
.. _kim_extra_unittests:
KIM Extra unit tests (CMake only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
During development, testing, or debugging, if
:doc:`unit testing <Build_development>` is enabled in LAMMPS, one can also
enable extra tests on :doc:`KIM commands <kim_commands>` by setting the
``KIM_EXTRA_UNITTESTS`` to *yes* (or *on*).
Enabling the extra unit tests have some requirements,
* It requires to have internet access.
* It requires to have libcurl installed with the matching development headers
and the curl-config tool.
* It requires to build LAMMPS with the PYTHON package installed and linked to
Python 3.6 or later. See the :ref:`PYTHON package build info <python>` for
more details on this.
* It requires to have ``kim-property`` Python package installed, which can be
easily done using *pip* as ``pip install kim-property``, or from the
*conda-forge* channel as ``conda install kim-property`` if LAMMPS is built in
Conda. More detailed information is available at:
`kim-property installation <https://github.com/openkim/kim-property#installing-kim-property>`_.
* It is also necessary to install
``EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000``,
``EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005``, and
``LennardJones612_UniversalShifted__MO_959249795837_003`` KIM models.
See `Obtaining KIM Models <http://openkim.org/doc/usage/obtaining-models>`_
to learn how to install a pre-built binary of the OpenKIM Repository of
Models or see
`Installing KIM Models <https://openkim.org/doc/usage/obtaining-models/#installing_models>`_
to learn how to install the specific KIM models.
---------- ----------
.. _kokkos: .. _kokkos:
@ -392,6 +457,9 @@ They must be specified in uppercase.
* - ZEN2 * - ZEN2
- HOST - HOST
- AMD Zen2 class CPU (AVX 2) - AMD Zen2 class CPU (AVX 2)
* - ZEN3
- HOST
- AMD Zen3 class CPU (AVX 2)
* - ARMV80 * - ARMV80
- HOST - HOST
- ARMv8.0 Compatible CPU - ARMv8.0 Compatible CPU
@ -404,6 +472,9 @@ They must be specified in uppercase.
* - ARMV8_THUNDERX2 * - ARMV8_THUNDERX2
- HOST - HOST
- ARMv8 Cavium ThunderX2 CPU - ARMv8 Cavium ThunderX2 CPU
* - A64FX
- HOST
- ARMv8.2 with SVE Support
* - WSM * - WSM
- HOST - HOST
- Intel Westmere CPU (SSE 4.2) - Intel Westmere CPU (SSE 4.2)
@ -476,17 +547,23 @@ They must be specified in uppercase.
* - AMPERE80 * - AMPERE80
- GPU - GPU
- NVIDIA Ampere generation CC 8.0 GPU - NVIDIA Ampere generation CC 8.0 GPU
* - AMPERE86
- GPU
- NVIDIA Ampere generation CC 8.6 GPU
* - VEGA900 * - VEGA900
- GPU - GPU
- AMD GPU MI25 GFX900 - AMD GPU MI25 GFX900
* - VEGA906 * - VEGA906
- GPU - GPU
- AMD GPU MI50/MI60 GFX906 - AMD GPU MI50/MI60 GFX906
* - VEGA908
- GPU
- AMD GPU MI100 GFX908
* - INTEL_GEN * - INTEL_GEN
- GPU - GPU
- Intel GPUs Gen9+ - Intel GPUs Gen9+
This list was last updated for version 3.2 of the Kokkos library. This list was last updated for version 3.4.1 of the Kokkos library.
.. tabs:: .. tabs::
@ -732,6 +809,54 @@ be installed on your system.
---------- ----------
.. _mliap:
MLIAP package
---------------------------
Building the MLIAP package requires including the :ref:`SNAP <PKG-SNAP>`
package. There will be an error message if this requirement is not satisfied.
Using the *mliappy* model also requires enabling Python support, which
in turn requires the :ref:`PYTHON <PKG-PYTHON>`
package **and** requires you have the `cython <https://cython.org>`_ software
installed and with it a working ``cythonize`` command. This feature requires
compiling LAMMPS with Python version 3.6 or later.
.. tabs::
.. tab:: CMake build
.. code-block:: bash
-D MLIAP_ENABLE_PYTHON=value # enable mliappy model (default is autodetect)
Without this setting, CMake will check whether it can find a
suitable Python version and the ``cythonize`` command and choose
the default accordingly. During the build procedure the provided
.pyx file(s) will be automatically translated to C++ code and compiled.
Please do **not** run ``cythonize`` manually in the ``src/MLIAP`` folder,
as that can lead to compilation errors if Python support is not enabled.
If you did by accident, please remove the generated .cpp and .h files.
.. tab:: Traditional make
The build uses the ``lib/python/Makefile.mliap_python`` file in the
compile/link process to add a rule to update the files generated by
the ``cythonize`` command in case the corresponding .pyx file(s) were
modified. You may need to modify ``lib/python/Makefile.lammps``
if the LAMMPS build fails.
To manually enforce building MLIAP with Python support enabled,
you can add
``-DMLIAP_PYTHON`` to the ``LMP_INC`` variable in your machine makefile.
You may have to manually run the ``cythonize`` command on .pyx file(s)
in the ``src`` folder, if this is not automatically done during
installing the MLIAP package. Please do **not** run ``cythonize``
in the ``src/MLIAP`` folder, as that can lead to compilation errors
if Python support is not enabled.
If you did by accident, please remove the generated .cpp and .h files.
----------
.. _mscg: .. _mscg:
MSCG package MSCG package
@ -1134,6 +1259,46 @@ be built for the most part with all major versions of the C++ language.
---------- ----------
.. _user-pace:
USER-PACE package
-----------------------------
This package requires a library that can be downloaded and built
in lib/pace or somewhere else, which must be done before building
LAMMPS with this package. The code for the library can be found
at: `https://github.com/ICAMS/lammps-user-pace/ <https://github.com/ICAMS/lammps-user-pace/>`_
.. tabs::
.. tab:: CMake build
By default the library will be downloaded from the git repository
and built automatically when the USER-PACE package is enabled with
``-D PKG_USER-PACE=yes``. The location for the sources may be
customized by setting the variable ``PACELIB_URL`` when
configuring with CMake (e.g. to use a local archive on machines
without internet access). Since CMake checks the validity of the
archive with ``md5sum`` you may also need to set ``PACELIB_MD5``
if you provide a different library version than what is downloaded
automatically.
.. tab:: Traditional make
You can download and build the USER-PACE library
in one step from the ``lammps/src`` dir, using these commands,
which invoke the ``lib/pace/Install.py`` script.
.. code-block:: bash
$ make lib-pace # print help message
$ make lib-pace args="-b" # download and build the default version in lib/pace
You should not need to edit the ``lib/pace/Makefile.lammps`` file.
----------
.. _user-plumed: .. _user-plumed:
USER-PLUMED package USER-PLUMED package
@ -1309,6 +1474,60 @@ the HDF5 library.
---------- ----------
.. _user-hdnnp:
USER-HDNNP package
---------------------------------
To build with the USER-HDNNP package it is required to download and build the
external `n2p2 <https://github.com/CompPhysVienna/n2p2>`__ library ``v2.1.4``
(or higher). The LAMMPS build process offers an automatic download and
compilation of *n2p2* or allows you to choose the installation directory of
*n2p2* manually. Please see the boxes below for the CMake and traditional build
system for detailed information.
In case of a manual installation of *n2p2* you only need to build the *n2p2* core
library ``libnnp`` and interface library ``libnnpif``. When using GCC it should
suffice to execute ``make libnnpif`` in the *n2p2* ``src`` directory. For more
details please see ``lib/hdnnp/README`` and the `n2p2 build documentation
<https://compphysvienna.github.io/n2p2/topics/build.html>`__.
.. tabs::
.. tab:: CMake build
.. code-block:: bash
-D DOWNLOAD_N2P2=value # download n2p2 for build, value = no (default) or yes
-D N2P2_DIR=path # n2p2 base directory (only needed if a custom location)
If ``DOWNLOAD_N2P2`` is set, the *n2p2* library will be downloaded and
built inside the CMake build directory. If the *n2p2* library is already
on your system (in a location CMake cannot find it), set the ``N2P2_DIR``
to path where *n2p2* is located. If *n2p2* is located directly in
``lib/hdnnp/n2p2`` it will be automatically found by CMake.
.. tab:: Traditional make
You can download and build the *n2p2* library manually if you prefer;
follow the instructions in ``lib/hdnnp/README``\ . You can also do it in
one step from the ``lammps/src`` dir, using a command like these, which
simply invoke the ``lib/hdnnp/Install.py`` script with the specified args:
.. code-block:: bash
$ make lib-hdnnp # print help message
$ make lib-hdnnp args="-b" # download and build in lib/hdnnp/n2p2-...
$ make lib-hdnnp args="-b -v 2.1.4" # download and build specific version
$ make lib-hdnnp args="-p /usr/local/n2p2" # use the existing n2p2 installation in /usr/local/n2p2
Note that 3 symbolic (soft) links, ``includelink``, ``liblink`` and
``Makefile.lammps``, will be created in ``lib/hdnnp`` to point to
``n2p2/include``, ``n2p2/lib`` and ``n2p2/lib/Makefile.lammps-extra``,
respectively. When LAMMPS is built in ``src`` it will use these links.
----------
.. _user-intel: .. _user-intel:
USER-INTEL package USER-INTEL package
@ -1379,6 +1598,35 @@ TBB and MKL.
---------- ----------
.. _user-mdi:
USER-MDI package
-----------------------------
.. tabs::
.. tab:: CMake build
.. code-block:: bash
-D DOWNLOAD_MDI=value # download MDI Library for build, value = no (default) or yes
.. tab:: Traditional make
Before building LAMMPS, you must build the MDI Library in
``lib/mdi``\ . You can do this by executing a command like one
of the following from the ``lib/mdi`` directory:
.. code-block:: bash
$ python Install.py -m gcc # build using gcc compiler
$ python Install.py -m icc # build using icc compiler
The build should produce two files: ``lib/mdi/includelink/mdi.h``
and ``lib/mdi/liblink/libmdi.so``\ .
----------
.. _user-mesont: .. _user-mesont:
USER-MESONT package USER-MESONT package

View File

@ -20,16 +20,8 @@ the suffix ``.so.0`` (or some other number).
.. note:: .. note::
Care should be taken to use the same MPI library for the calling code Care should be taken to use the same MPI library for the calling code
and the LAMMPS library. The ``library.h`` file includes ``mpi.h`` and the LAMMPS library unless LAMMPS is to be compiled without (real)
and uses definitions from it so those need to be available and MPI support using the include STUBS MPI library.
consistent. When LAMMPS is compiled with the included STUBS MPI
library, then its ``mpi.h`` file needs to be included. While it is
technically possible to use a full MPI library in the calling code
and link to a serial LAMMPS library compiled with MPI STUBS, it is
recommended to use the *same* MPI library for both, and then use
``MPI_Comm_split()`` in the calling code to pass a suitable
communicator with a subset of MPI ranks to the function creating the
LAMMPS instance.
Link with LAMMPS as a static library Link with LAMMPS as a static library
------------------------------------ ------------------------------------
@ -110,7 +102,7 @@ executable, that are also required to link the LAMMPS executable.
.. code-block:: bash .. code-block:: bash
gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c gcc -c -O -I${HOME}/lammps/src -caller.c
g++ -o caller caller.o -L${HOME}/lammps/lib/poems \ g++ -o caller caller.o -L${HOME}/lammps/lib/poems \
-L${HOME}/lammps/src/STUBS -L${HOME}/lammps/src \ -L${HOME}/lammps/src/STUBS -L${HOME}/lammps/src \
-llammps_serial -lpoems -lmpi_stubs -llammps_serial -lpoems -lmpi_stubs
@ -174,7 +166,7 @@ the POEMS package installed becomes:
.. code-block:: bash .. code-block:: bash
gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c gcc -c -O -I${HOME}/lammps/src -caller.c
g++ -o caller caller.o -L${HOME}/lammps/src -llammps_serial g++ -o caller caller.o -L${HOME}/lammps/src -llammps_serial
Locating liblammps.so at runtime Locating liblammps.so at runtime

View File

@ -28,29 +28,18 @@ If you downloaded LAMMPS as a tarball from `the LAMMPS website <lws_>`_,
the html folder and the PDF files should be included. the html folder and the PDF files should be included.
If you downloaded LAMMPS from the public git repository, then the HTML If you downloaded LAMMPS from the public git repository, then the HTML
and PDF files are not included. Instead you need to create them, in one and PDF files are not included. You can build the HTML or PDF files yourself,
of two ways: by typing ``make html`` or ``make pdf`` in the ``doc`` folder. This requires
various tools and files. Some of them have to be installed (see below). For
a. You can "fetch" the current HTML and PDF files from the LAMMPS web the rest the build process will attempt to download and install them into
site. Just type ``make fetch``. This should download a ``html_www`` a python virtual environment and local folders.
directory and a ``Manual_www.pdf`` file. Note that if new LAMMPS features
have been added more recently than the date of your LAMMPS version, the
fetched documentation will include those changes (but your source code
will not, unless you update your local repository).
b. You can build the HTML or PDF files yourself, by typing ``make html``
or ``make pdf`` in the ``doc`` folder. This requires various tools
and files. Some of them have to be installed (see below). For the
rest the build process will attempt to download and install them into
a python virtual environment and local folders.
A current version of the manual (latest patch release, aka unstable A current version of the manual (latest patch release, aka unstable
branch) is is available online at: branch) is is available online at:
`https://lammps.sandia.gov/doc/Manual.html `https://docs.lammps.org/Manual.html <https://docs.lammps.org/Manual.html>`_.
<https://lammps.sandia.gov/doc/Manual.html>`_ A version of the manual A version of the manual corresponding to the ongoing development (aka master branch)
corresponding to the ongoing development (aka master branch) is is available online at: `https://docs.lammps.org/latest/
available online at: `https://docs.lammps.org/ <https://docs.lammps.org/latest/>`_
<https://docs.lammps.org/>`_
Build using GNU make Build using GNU make
-------------------- --------------------
@ -74,7 +63,11 @@ For the documentation build a python virtual environment is set up in
the folder ``doc/docenv`` and various python packages are installed into the folder ``doc/docenv`` and various python packages are installed into
that virtual environment via the ``pip`` tool. For rendering embedded that virtual environment via the ``pip`` tool. For rendering embedded
LaTeX code also the `MathJax <https://www.mathjax.org/>`_ JavaScript LaTeX code also the `MathJax <https://www.mathjax.org/>`_ JavaScript
engine needs to be downloaded. engine needs to be downloaded. If you need to pass additional options
to the pip commands to work (e.g. to use a web proxy or to point to
additional SSL certificates) you can set them via the ``PIP_OPTIONS``
environment variable or uncomment and edit the ``PIP_OPTIONS`` setting
at beginning of the makefile.
The actual translation is then done via ``make`` commands in the doc The actual translation is then done via ``make`` commands in the doc
folder. The following ``make`` commands are available: folder. The following ``make`` commands are available:
@ -108,7 +101,10 @@ installation of the HTML manual pages into the "install" step when
installing LAMMPS after the CMake build via ``cmake --build . --target installing LAMMPS after the CMake build via ``cmake --build . --target
install``. The documentation build is included in the default build install``. The documentation build is included in the default build
target, but can also be requested independently with target, but can also be requested independently with
``cmake --build . --target doc``. ``cmake --build . --target doc``. If you need to pass additional options
to the pip commands to work (e.g. to use a web proxy or to point to
additional SSL certificates) you can set them via the ``PIP_OPTIONS``
environment variable.
.. code-block:: bash .. code-block:: bash
@ -250,4 +246,4 @@ the file ``lammps/doc/utils/sphinx-config/false_positives.txt``.
.. _rst: https://docutils.readthedocs.io/en/sphinx-docs/user/rst/quickstart.html .. _rst: https://docutils.readthedocs.io/en/sphinx-docs/user/rst/quickstart.html
.. _lws: https://lammps.sandia.gov .. _lws: https://www.lammps.org

View File

@ -30,17 +30,17 @@ steps, as explained on the :doc:`Build extras <Build_extras>` page.
These links take you to the extra instructions for those select These links take you to the extra instructions for those select
packages: packages:
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +--------------------------------------+--------------------------------------+------------------------------------+----------------------------------+--------------------------------+--------------------------------+
| :ref:`COMPRESS <compress>` | :ref:`GPU <gpu>` | :ref:`KIM <kim>` | :ref:`KOKKOS <kokkos>` | :ref:`LATTE <latte>` | :ref:`MESSAGE <message>` | | :ref:`COMPRESS <compress>` | :ref:`GPU <gpu>` | :ref:`KIM <kim>` | :ref:`KOKKOS <kokkos>` | :ref:`LATTE <latte>` | :ref:`MESSAGE <message>` |
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +--------------------------------------+--------------------------------------+------------------------------------+----------------------------------+--------------------------------+--------------------------------+
| :ref:`MSCG <mscg>` | :ref:`OPT <opt>` | :ref:`POEMS <poems>` | :ref:`PYTHON <python>` | :ref:`VORONOI <voronoi>` | :ref:`USER-ADIOS <user-adios>` | | :ref:`MSCG <mscg>` | :ref:`OPT <opt>` | :ref:`POEMS <poems>` | :ref:`PYTHON <python>` | :ref:`VORONOI <voronoi>` | :ref:`USER-ADIOS <user-adios>` |
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +--------------------------------------+--------------------------------------+------------------------------------+----------------------------------+--------------------------------+--------------------------------+
| :ref:`USER-ATC <user-atc>` | :ref:`USER-AWPMD <user-awpmd>` | :ref:`USER-COLVARS <user-colvars>` | :ref:`USER-H5MD <user-h5md>` | :ref:`USER-INTEL <user-intel>` | :ref:`USER-MOLFILE <user-molfile>` | | :ref:`USER-ATC <user-atc>` | :ref:`USER-AWPMD <user-awpmd>` | :ref:`USER-COLVARS <user-colvars>` | :ref:`USER-H5MD <user-h5md>` | :ref:`USER-HDNNP <user-hdnnp>` | :ref:`USER-INTEL <user-intel>` |
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +--------------------------------------+--------------------------------------+------------------------------------+----------------------------------+--------------------------------+--------------------------------+
| :ref:`USER-NETCDF <user-netcdf>` | :ref:`USER-PLUMED <user-plumed>` | :ref:`USER-OMP <user-omp>` | :ref:`USER-QMMM <user-qmmm>` | :ref:`USER-QUIP <user-quip>` | :ref:`USER-SCAFACOS <user-scafacos>` | | :ref:`USER-MOLFILE <user-molfile>` | :ref:`USER-NETCDF <user-netcdf>` | :ref:`USER-PACE <user-pace>` | :ref:`USER-PLUMED <user-plumed>` | :ref:`USER-OMP <user-omp>` | :ref:`USER-QMMM <user-qmmm>` |
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +--------------------------------------+--------------------------------------+------------------------------------+----------------------------------+--------------------------------+--------------------------------+
| :ref:`USER-SMD <user-smd>` | :ref:`USER-VTK <user-vtk>` | | | | | | :ref:`USER-QUIP <user-quip>` | :ref:`USER-SCAFACOS <user-scafacos>` | :ref:`USER-SMD <user-smd>` | :ref:`USER-VTK <user-vtk>` | | |
+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +--------------------------------------+--------------------------------------+------------------------------------+----------------------------------+--------------------------------+--------------------------------+
The mechanism for including packages is simple but different for CMake The mechanism for including packages is simple but different for CMake
versus make. versus make.
@ -160,6 +160,7 @@ one of them as a starting point and customize it to your needs.
cmake -C ../cmake/presets/clang.cmake [OPTIONS] ../cmake # change settings to use the Clang compilers by default cmake -C ../cmake/presets/clang.cmake [OPTIONS] ../cmake # change settings to use the Clang compilers by default
cmake -C ../cmake/presets/gcc.cmake [OPTIONS] ../cmake # change settings to use the GNU compilers by default cmake -C ../cmake/presets/gcc.cmake [OPTIONS] ../cmake # change settings to use the GNU compilers by default
cmake -C ../cmake/presets/intel.cmake [OPTIONS] ../cmake # change settings to use the Intel compilers by default cmake -C ../cmake/presets/intel.cmake [OPTIONS] ../cmake # change settings to use the Intel compilers by default
cmake -C ../cmake/presets/pgi.cmake [OPTIONS] ../cmake # change settings to use the PGI compilers by default
cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages cmake -C ../cmake/presets/all_on.cmake [OPTIONS] ../cmake # enable all packages
cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages cmake -C ../cmake/presets/all_off.cmake [OPTIONS] ../cmake # disable all packages
mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross compilers mingw64-cmake -C ../cmake/presets/mingw-cross.cmake [OPTIONS] ../cmake # compile with MinGW cross compilers

View File

@ -60,17 +60,14 @@ An alphabetic list of all general LAMMPS commands.
* :doc:`include <include>` * :doc:`include <include>`
* :doc:`info <info>` * :doc:`info <info>`
* :doc:`jump <jump>` * :doc:`jump <jump>`
* :doc:`kim_init <kim_commands>` * :doc:`kim <kim_commands>`
* :doc:`kim_interactions <kim_commands>`
* :doc:`kim_param <kim_commands>`
* :doc:`kim_property <kim_commands>`
* :doc:`kim_query <kim_commands>`
* :doc:`kspace_modify <kspace_modify>` * :doc:`kspace_modify <kspace_modify>`
* :doc:`kspace_style <kspace_style>` * :doc:`kspace_style <kspace_style>`
* :doc:`label <label>` * :doc:`label <label>`
* :doc:`lattice <lattice>` * :doc:`lattice <lattice>`
* :doc:`log <log>` * :doc:`log <log>`
* :doc:`mass <mass>` * :doc:`mass <mass>`
* :doc:`mdi/engine <mdi_engine>`
* :doc:`message <message>` * :doc:`message <message>`
* :doc:`minimize <minimize>` * :doc:`minimize <minimize>`
* :doc:`min_modify <min_modify>` * :doc:`min_modify <min_modify>`
@ -90,6 +87,7 @@ An alphabetic list of all general LAMMPS commands.
* :doc:`pair_style <pair_style>` * :doc:`pair_style <pair_style>`
* :doc:`pair_write <pair_write>` * :doc:`pair_write <pair_write>`
* :doc:`partition <partition>` * :doc:`partition <partition>`
* :doc:`plugin <plugin>`
* :doc:`prd <prd>` * :doc:`prd <prd>`
* :doc:`print <print>` * :doc:`print <print>`
* :doc:`processors <processors>` * :doc:`processors <processors>`

View File

@ -35,6 +35,7 @@ OPT.
* :doc:`class2 (ko) <bond_class2>` * :doc:`class2 (ko) <bond_class2>`
* :doc:`fene (iko) <bond_fene>` * :doc:`fene (iko) <bond_fene>`
* :doc:`fene/expand (o) <bond_fene_expand>` * :doc:`fene/expand (o) <bond_fene_expand>`
* :doc:`gaussian <bond_gaussian>`
* :doc:`gromos (o) <bond_gromos>` * :doc:`gromos (o) <bond_gromos>`
* :doc:`harmonic (iko) <bond_harmonic>` * :doc:`harmonic (iko) <bond_harmonic>`
* :doc:`harmonic/shift (o) <bond_harmonic_shift>` * :doc:`harmonic/shift (o) <bond_harmonic_shift>`
@ -84,6 +85,7 @@ OPT.
* :doc:`dipole (o) <angle_dipole>` * :doc:`dipole (o) <angle_dipole>`
* :doc:`fourier (o) <angle_fourier>` * :doc:`fourier (o) <angle_fourier>`
* :doc:`fourier/simple (o) <angle_fourier_simple>` * :doc:`fourier/simple (o) <angle_fourier_simple>`
* :doc:`gaussian <angle_gaussian>` - multicentered Gaussian-based angle potential
* :doc:`harmonic (iko) <angle_harmonic>` * :doc:`harmonic (iko) <angle_harmonic>`
* :doc:`mm3 <angle_mm3>` * :doc:`mm3 <angle_mm3>`
* :doc:`quartic (o) <angle_quartic>` * :doc:`quartic (o) <angle_quartic>`
@ -124,7 +126,7 @@ OPT.
* :doc:`quadratic (o) <dihedral_quadratic>` * :doc:`quadratic (o) <dihedral_quadratic>`
* :doc:`spherical <dihedral_spherical>` * :doc:`spherical <dihedral_spherical>`
* :doc:`table (o) <dihedral_table>` * :doc:`table (o) <dihedral_table>`
* :doc:`table/cut <dihedral_table_cut>` * :doc:`table/cut <dihedral_table>`
.. _improper: .. _improper:

View File

@ -47,11 +47,13 @@ KOKKOS, o = USER-OMP, t = OPT.
* :doc:`dihedral <compute_dihedral>` * :doc:`dihedral <compute_dihedral>`
* :doc:`dihedral/local <compute_dihedral_local>` * :doc:`dihedral/local <compute_dihedral_local>`
* :doc:`dilatation/atom <compute_dilatation_atom>` * :doc:`dilatation/atom <compute_dilatation_atom>`
* :doc:`dipole <compute_dipole>`
* :doc:`dipole/chunk <compute_dipole_chunk>` * :doc:`dipole/chunk <compute_dipole_chunk>`
* :doc:`displace/atom <compute_displace_atom>` * :doc:`displace/atom <compute_displace_atom>`
* :doc:`dpd <compute_dpd>` * :doc:`dpd <compute_dpd>`
* :doc:`dpd/atom <compute_dpd_atom>` * :doc:`dpd/atom <compute_dpd_atom>`
* :doc:`edpd/temp/atom <compute_edpd_temp_atom>` * :doc:`edpd/temp/atom <compute_edpd_temp_atom>`
* :doc:`efield/atom <compute_efield_atom>`
* :doc:`entropy/atom <compute_entropy_atom>` * :doc:`entropy/atom <compute_entropy_atom>`
* :doc:`erotate/asphere <compute_erotate_asphere>` * :doc:`erotate/asphere <compute_erotate_asphere>`
* :doc:`erotate/rigid <compute_erotate_rigid>` * :doc:`erotate/rigid <compute_erotate_rigid>`

View File

@ -39,6 +39,9 @@ OPT.
* :doc:`ave/time <fix_ave_time>` * :doc:`ave/time <fix_ave_time>`
* :doc:`aveforce <fix_aveforce>` * :doc:`aveforce <fix_aveforce>`
* :doc:`balance <fix_balance>` * :doc:`balance <fix_balance>`
* :doc:`brownian <fix_brownian>`
* :doc:`brownian/asphere <fix_brownian>`
* :doc:`brownian/sphere <fix_brownian>`
* :doc:`bocs <fix_bocs>` * :doc:`bocs <fix_bocs>`
* :doc:`bond/break <fix_bond_break>` * :doc:`bond/break <fix_bond_break>`
* :doc:`bond/create <fix_bond_create>` * :doc:`bond/create <fix_bond_create>`
@ -46,6 +49,7 @@ OPT.
* :doc:`bond/react <fix_bond_react>` * :doc:`bond/react <fix_bond_react>`
* :doc:`bond/swap <fix_bond_swap>` * :doc:`bond/swap <fix_bond_swap>`
* :doc:`box/relax <fix_box_relax>` * :doc:`box/relax <fix_box_relax>`
* :doc:`charge/regulation <fix_charge_regulation>`
* :doc:`client/md <fix_client_md>` * :doc:`client/md <fix_client_md>`
* :doc:`cmap <fix_cmap>` * :doc:`cmap <fix_cmap>`
* :doc:`colvars <fix_colvars>` * :doc:`colvars <fix_colvars>`
@ -62,6 +66,7 @@ OPT.
* :doc:`efield <fix_efield>` * :doc:`efield <fix_efield>`
* :doc:`ehex <fix_ehex>` * :doc:`ehex <fix_ehex>`
* :doc:`electron/stopping <fix_electron_stopping>` * :doc:`electron/stopping <fix_electron_stopping>`
* :doc:`electron/stopping/fit <fix_electron_stopping>`
* :doc:`enforce2d (k) <fix_enforce2d>` * :doc:`enforce2d (k) <fix_enforce2d>`
* :doc:`eos/cv <fix_eos_cv>` * :doc:`eos/cv <fix_eos_cv>`
* :doc:`eos/table <fix_eos_table>` * :doc:`eos/table <fix_eos_table>`
@ -96,6 +101,7 @@ OPT.
* :doc:`lb/viscous <fix_lb_viscous>` * :doc:`lb/viscous <fix_lb_viscous>`
* :doc:`lineforce <fix_lineforce>` * :doc:`lineforce <fix_lineforce>`
* :doc:`manifoldforce <fix_manifoldforce>` * :doc:`manifoldforce <fix_manifoldforce>`
* :doc:`mdi/engine <fix_mdi_engine>`
* :doc:`meso/move <fix_meso_move>` * :doc:`meso/move <fix_meso_move>`
* :doc:`momentum (k) <fix_momentum>` * :doc:`momentum (k) <fix_momentum>`
* :doc:`momentum/chunk <fix_momentum>` * :doc:`momentum/chunk <fix_momentum>`
@ -113,7 +119,7 @@ OPT.
* :doc:`nph/eff <fix_nh_eff>` * :doc:`nph/eff <fix_nh_eff>`
* :doc:`nph/sphere (o) <fix_nph_sphere>` * :doc:`nph/sphere (o) <fix_nph_sphere>`
* :doc:`nphug <fix_nphug>` * :doc:`nphug <fix_nphug>`
* :doc:`npt (iko) <fix_nh>` * :doc:`npt (giko) <fix_nh>`
* :doc:`npt/asphere (o) <fix_npt_asphere>` * :doc:`npt/asphere (o) <fix_npt_asphere>`
* :doc:`npt/body <fix_npt_body>` * :doc:`npt/body <fix_npt_body>`
* :doc:`npt/cauchy <fix_npt_cauchy>` * :doc:`npt/cauchy <fix_npt_cauchy>`
@ -121,8 +127,8 @@ OPT.
* :doc:`npt/sphere (o) <fix_npt_sphere>` * :doc:`npt/sphere (o) <fix_npt_sphere>`
* :doc:`npt/uef <fix_nh_uef>` * :doc:`npt/uef <fix_nh_uef>`
* :doc:`numdiff <fix_numdiff>` * :doc:`numdiff <fix_numdiff>`
* :doc:`nve (iko) <fix_nve>` * :doc:`nve (giko) <fix_nve>`
* :doc:`nve/asphere (i) <fix_nve_asphere>` * :doc:`nve/asphere (gi) <fix_nve_asphere>`
* :doc:`nve/asphere/noforce <fix_nve_asphere_noforce>` * :doc:`nve/asphere/noforce <fix_nve_asphere_noforce>`
* :doc:`nve/awpmd <fix_nve_awpmd>` * :doc:`nve/awpmd <fix_nve_awpmd>`
* :doc:`nve/body <fix_nve_body>` * :doc:`nve/body <fix_nve_body>`
@ -137,7 +143,7 @@ OPT.
* :doc:`nve/spin <fix_nve_spin>` * :doc:`nve/spin <fix_nve_spin>`
* :doc:`nve/tri <fix_nve_tri>` * :doc:`nve/tri <fix_nve_tri>`
* :doc:`nvk <fix_nvk>` * :doc:`nvk <fix_nvk>`
* :doc:`nvt (iko) <fix_nh>` * :doc:`nvt (giko) <fix_nh>`
* :doc:`nvt/asphere (o) <fix_nvt_asphere>` * :doc:`nvt/asphere (o) <fix_nvt_asphere>`
* :doc:`nvt/body <fix_nvt_body>` * :doc:`nvt/body <fix_nvt_body>`
* :doc:`nvt/eff <fix_nh_eff>` * :doc:`nvt/eff <fix_nh_eff>`
@ -156,6 +162,9 @@ OPT.
* :doc:`planeforce <fix_planeforce>` * :doc:`planeforce <fix_planeforce>`
* :doc:`plumed <fix_plumed>` * :doc:`plumed <fix_plumed>`
* :doc:`poems <fix_poems>` * :doc:`poems <fix_poems>`
* :doc:`polarize/bem/gmres <fix_polarize>`
* :doc:`polarize/bem/icc <fix_polarize>`
* :doc:`polarize/functional <fix_polarize>`
* :doc:`pour <fix_pour>` * :doc:`pour <fix_pour>`
* :doc:`precession/spin <fix_precession_spin>` * :doc:`precession/spin <fix_precession_spin>`
* :doc:`press/berendsen <fix_press_berendsen>` * :doc:`press/berendsen <fix_press_berendsen>`
@ -195,7 +204,7 @@ OPT.
* :doc:`saed/vtk <fix_saed_vtk>` * :doc:`saed/vtk <fix_saed_vtk>`
* :doc:`setforce (k) <fix_setforce>` * :doc:`setforce (k) <fix_setforce>`
* :doc:`setforce/spin <fix_setforce>` * :doc:`setforce/spin <fix_setforce>`
* :doc:`shake <fix_shake>` * :doc:`shake (k) <fix_shake>`
* :doc:`shardlow (k) <fix_shardlow>` * :doc:`shardlow (k) <fix_shardlow>`
* :doc:`smd <fix_smd>` * :doc:`smd <fix_smd>`
* :doc:`smd/adjust_dt <fix_smd_adjust_dt>` * :doc:`smd/adjust_dt <fix_smd_adjust_dt>`
@ -220,6 +229,8 @@ OPT.
* :doc:`temp/rescale <fix_temp_rescale>` * :doc:`temp/rescale <fix_temp_rescale>`
* :doc:`temp/rescale/eff <fix_temp_rescale_eff>` * :doc:`temp/rescale/eff <fix_temp_rescale_eff>`
* :doc:`tfmc <fix_tfmc>` * :doc:`tfmc <fix_tfmc>`
* :doc:`tgnpt/drude <fix_tgnh_drude>`
* :doc:`tgnvt/drude <fix_tgnh_drude>`
* :doc:`thermal/conductivity <fix_thermal_conductivity>` * :doc:`thermal/conductivity <fix_thermal_conductivity>`
* :doc:`ti/spring <fix_ti_spring>` * :doc:`ti/spring <fix_ti_spring>`
* :doc:`tmd <fix_tmd>` * :doc:`tmd <fix_tmd>`

View File

@ -28,6 +28,7 @@ OPT.
* :doc:`ewald/dipole/spin <kspace_style>` * :doc:`ewald/dipole/spin <kspace_style>`
* :doc:`msm (o) <kspace_style>` * :doc:`msm (o) <kspace_style>`
* :doc:`msm/cg (o) <kspace_style>` * :doc:`msm/cg (o) <kspace_style>`
* :doc:`msm/dielectric <kspace_style>`
* :doc:`pppm (giko) <kspace_style>` * :doc:`pppm (giko) <kspace_style>`
* :doc:`pppm/cg (o) <kspace_style>` * :doc:`pppm/cg (o) <kspace_style>`
* :doc:`pppm/dipole <kspace_style>` * :doc:`pppm/dipole <kspace_style>`
@ -36,4 +37,5 @@ OPT.
* :doc:`pppm/disp/tip4p (o) <kspace_style>` * :doc:`pppm/disp/tip4p (o) <kspace_style>`
* :doc:`pppm/stagger <kspace_style>` * :doc:`pppm/stagger <kspace_style>`
* :doc:`pppm/tip4p (o) <kspace_style>` * :doc:`pppm/tip4p (o) <kspace_style>`
* :doc:`pppm/dielectric <kspace_style>`
* :doc:`scafacos <kspace_style>` * :doc:`scafacos <kspace_style>`

View File

@ -26,6 +26,7 @@ OPT.
* :doc:`zero <pair_zero>` * :doc:`zero <pair_zero>`
* :doc:`hybrid (k) <pair_hybrid>` * :doc:`hybrid (k) <pair_hybrid>`
* :doc:`hybrid/overlay (k) <pair_hybrid>` * :doc:`hybrid/overlay (k) <pair_hybrid>`
* :doc:`hybrid/scaled <pair_hybrid>`
* :doc:`kim <pair_kim>` * :doc:`kim <pair_kim>`
* :doc:`list <pair_list>` * :doc:`list <pair_list>`
* *
@ -33,7 +34,6 @@ OPT.
* *
* *
* *
*
* :doc:`adp (o) <pair_adp>` * :doc:`adp (o) <pair_adp>`
* :doc:`agni (o) <pair_agni>` * :doc:`agni (o) <pair_agni>`
* :doc:`airebo (io) <pair_airebo>` * :doc:`airebo (io) <pair_airebo>`
@ -69,12 +69,15 @@ OPT.
* :doc:`comb3 <pair_comb>` * :doc:`comb3 <pair_comb>`
* :doc:`cosine/squared <pair_cosine_squared>` * :doc:`cosine/squared <pair_cosine_squared>`
* :doc:`coul/cut (gko) <pair_coul>` * :doc:`coul/cut (gko) <pair_coul>`
* :doc:`coul/cut/dielectric <pair_dielectric>`
* :doc:`coul/cut/global (o) <pair_coul>`
* :doc:`coul/cut/soft (o) <pair_fep_soft>` * :doc:`coul/cut/soft (o) <pair_fep_soft>`
* :doc:`coul/debye (gko) <pair_coul>` * :doc:`coul/debye (gko) <pair_coul>`
* :doc:`coul/diel (o) <pair_coul_diel>` * :doc:`coul/diel (o) <pair_coul_diel>`
* :doc:`coul/dsf (gko) <pair_coul>` * :doc:`coul/dsf (gko) <pair_coul>`
* :doc:`coul/long (gko) <pair_coul>` * :doc:`coul/long (gko) <pair_coul>`
* :doc:`coul/long/cs (g) <pair_cs>` * :doc:`coul/long/cs (g) <pair_cs>`
* :doc:`coul/long/dielectric <pair_dielectric>`
* :doc:`coul/long/soft (o) <pair_fep_soft>` * :doc:`coul/long/soft (o) <pair_fep_soft>`
* :doc:`coul/msm (o) <pair_coul>` * :doc:`coul/msm (o) <pair_coul>`
* :doc:`coul/slater/cut <pair_coul_slater>` * :doc:`coul/slater/cut <pair_coul_slater>`
@ -86,6 +89,8 @@ OPT.
* :doc:`coul/wolf/cs <pair_cs>` * :doc:`coul/wolf/cs <pair_cs>`
* :doc:`dpd (gio) <pair_dpd>` * :doc:`dpd (gio) <pair_dpd>`
* :doc:`dpd/fdt <pair_dpd_fdt>` * :doc:`dpd/fdt <pair_dpd_fdt>`
* :doc:`dpd/ext <pair_dpd_ext>`
* :doc:`dpd/ext/tstat <pair_dpd_ext>`
* :doc:`dpd/fdt/energy (k) <pair_dpd_fdt>` * :doc:`dpd/fdt/energy (k) <pair_dpd_fdt>`
* :doc:`dpd/tstat (go) <pair_dpd>` * :doc:`dpd/tstat (go) <pair_dpd>`
* :doc:`dsmc <pair_dsmc>` * :doc:`dsmc <pair_dsmc>`
@ -96,6 +101,7 @@ OPT.
* :doc:`eam/cd <pair_eam>` * :doc:`eam/cd <pair_eam>`
* :doc:`eam/cd/old <pair_eam>` * :doc:`eam/cd/old <pair_eam>`
* :doc:`eam/fs (gikot) <pair_eam>` * :doc:`eam/fs (gikot) <pair_eam>`
* :doc:`eam/he <pair_eam>`
* :doc:`edip (o) <pair_edip>` * :doc:`edip (o) <pair_edip>`
* :doc:`edip/multi <pair_edip>` * :doc:`edip/multi <pair_edip>`
* :doc:`edpd <pair_mesodpd>` * :doc:`edpd <pair_mesodpd>`
@ -114,6 +120,7 @@ OPT.
* :doc:`gw/zbl <pair_gw>` * :doc:`gw/zbl <pair_gw>`
* :doc:`hbond/dreiding/lj (o) <pair_hbond_dreiding>` * :doc:`hbond/dreiding/lj (o) <pair_hbond_dreiding>`
* :doc:`hbond/dreiding/morse (o) <pair_hbond_dreiding>` * :doc:`hbond/dreiding/morse (o) <pair_hbond_dreiding>`
* :doc:`hdnnp <pair_hdnnp>`
* :doc:`ilp/graphene/hbn <pair_ilp_graphene_hbn>` * :doc:`ilp/graphene/hbn <pair_ilp_graphene_hbn>`
* :doc:`kolmogorov/crespi/full <pair_kolmogorov_crespi_full>` * :doc:`kolmogorov/crespi/full <pair_kolmogorov_crespi_full>`
* :doc:`kolmogorov/crespi/z <pair_kolmogorov_crespi_z>` * :doc:`kolmogorov/crespi/z <pair_kolmogorov_crespi_z>`
@ -121,7 +128,7 @@ OPT.
* :doc:`lebedeva/z <pair_lebedeva_z>` * :doc:`lebedeva/z <pair_lebedeva_z>`
* :doc:`lennard/mdf <pair_mdf>` * :doc:`lennard/mdf <pair_mdf>`
* :doc:`line/lj <pair_line_lj>` * :doc:`line/lj <pair_line_lj>`
* :doc:`lj/charmm/coul/charmm (iko) <pair_charmm>` * :doc:`lj/charmm/coul/charmm (giko) <pair_charmm>`
* :doc:`lj/charmm/coul/charmm/implicit (ko) <pair_charmm>` * :doc:`lj/charmm/coul/charmm/implicit (ko) <pair_charmm>`
* :doc:`lj/charmm/coul/long (gikot) <pair_charmm>` * :doc:`lj/charmm/coul/long (gikot) <pair_charmm>`
* :doc:`lj/charmm/coul/long/soft (o) <pair_fep_soft>` * :doc:`lj/charmm/coul/long/soft (o) <pair_fep_soft>`
@ -138,13 +145,17 @@ OPT.
* :doc:`lj/cubic (go) <pair_lj_cubic>` * :doc:`lj/cubic (go) <pair_lj_cubic>`
* :doc:`lj/cut (gikot) <pair_lj>` * :doc:`lj/cut (gikot) <pair_lj>`
* :doc:`lj/cut/coul/cut (gko) <pair_lj_cut_coul>` * :doc:`lj/cut/coul/cut (gko) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/cut/dielectric (o) <pair_dielectric>`
* :doc:`lj/cut/coul/cut/soft (o) <pair_fep_soft>` * :doc:`lj/cut/coul/cut/soft (o) <pair_fep_soft>`
* :doc:`lj/cut/coul/debye (gko) <pair_lj_cut_coul>` * :doc:`lj/cut/coul/debye (gko) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/debye/dielectric <pair_dielectric>`
* :doc:`lj/cut/coul/dsf (gko) <pair_lj_cut_coul>` * :doc:`lj/cut/coul/dsf (gko) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/long (gikot) <pair_lj_cut_coul>` * :doc:`lj/cut/coul/long (gikot) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/long/cs <pair_cs>` * :doc:`lj/cut/coul/long/cs <pair_cs>`
* :doc:`lj/cut/coul/long/dielectric (o) <pair_dielectric>`
* :doc:`lj/cut/coul/long/soft (o) <pair_fep_soft>` * :doc:`lj/cut/coul/long/soft (o) <pair_fep_soft>`
* :doc:`lj/cut/coul/msm (go) <pair_lj_cut_coul>` * :doc:`lj/cut/coul/msm (go) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/msm/dielectric <pair_dielectric>`
* :doc:`lj/cut/coul/wolf (o) <pair_lj_cut_coul>` * :doc:`lj/cut/coul/wolf (o) <pair_lj_cut_coul>`
* :doc:`lj/cut/dipole/cut (go) <pair_dipole>` * :doc:`lj/cut/dipole/cut (go) <pair_dipole>`
* :doc:`lj/cut/dipole/long (g) <pair_dipole>` * :doc:`lj/cut/dipole/long (g) <pair_dipole>`
@ -159,14 +170,16 @@ OPT.
* :doc:`lj/gromacs (gko) <pair_gromacs>` * :doc:`lj/gromacs (gko) <pair_gromacs>`
* :doc:`lj/gromacs/coul/gromacs (ko) <pair_gromacs>` * :doc:`lj/gromacs/coul/gromacs (ko) <pair_gromacs>`
* :doc:`lj/long/coul/long (iot) <pair_lj_long>` * :doc:`lj/long/coul/long (iot) <pair_lj_long>`
* :doc:`lj/long/coul/long/dielectric <pair_dielectric>`
* :doc:`lj/long/dipole/long <pair_dipole>` * :doc:`lj/long/dipole/long <pair_dipole>`
* :doc:`lj/long/tip4p/long (o) <pair_lj_long>` * :doc:`lj/long/tip4p/long (o) <pair_lj_long>`
* :doc:`lj/mdf <pair_mdf>` * :doc:`lj/mdf <pair_mdf>`
* :doc:`lj/relres (o) <pair_lj_relres>`
* :doc:`lj/sdk (gko) <pair_sdk>` * :doc:`lj/sdk (gko) <pair_sdk>`
* :doc:`lj/sdk/coul/long (go) <pair_sdk>` * :doc:`lj/sdk/coul/long (go) <pair_sdk>`
* :doc:`lj/sdk/coul/msm (o) <pair_sdk>` * :doc:`lj/sdk/coul/msm (o) <pair_sdk>`
* :doc:`lj/sf/dipole/sf (go) <pair_dipole>` * :doc:`lj/sf/dipole/sf (go) <pair_dipole>`
* :doc:`lj/smooth (o) <pair_lj_smooth>` * :doc:`lj/smooth (go) <pair_lj_smooth>`
* :doc:`lj/smooth/linear (o) <pair_lj_smooth_linear>` * :doc:`lj/smooth/linear (o) <pair_lj_smooth_linear>`
* :doc:`lj/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>` * :doc:`lj/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
* :doc:`lj96/cut (go) <pair_lj96>` * :doc:`lj96/cut (go) <pair_lj96>`
@ -185,7 +198,7 @@ OPT.
* :doc:`mgpt <pair_mgpt>` * :doc:`mgpt <pair_mgpt>`
* :doc:`mie/cut (g) <pair_mie>` * :doc:`mie/cut (g) <pair_mie>`
* :doc:`mliap <pair_mliap>` * :doc:`mliap <pair_mliap>`
* :doc:`mm3/switch3/coulgauss/long <pair_mm3_switch3_coulgauss_long>` * :doc:`mm3/switch3/coulgauss/long <pair_lj_switch3_coulgauss_long>`
* :doc:`momb <pair_momb>` * :doc:`momb <pair_momb>`
* :doc:`morse (gkot) <pair_morse>` * :doc:`morse (gkot) <pair_morse>`
* :doc:`morse/smooth/linear (o) <pair_morse>` * :doc:`morse/smooth/linear (o) <pair_morse>`
@ -213,6 +226,7 @@ OPT.
* :doc:`oxrna2/stk <pair_oxrna2>` * :doc:`oxrna2/stk <pair_oxrna2>`
* :doc:`oxrna2/xstk <pair_oxrna2>` * :doc:`oxrna2/xstk <pair_oxrna2>`
* :doc:`oxrna2/coaxstk <pair_oxrna2>` * :doc:`oxrna2/coaxstk <pair_oxrna2>`
* :doc:`pace <pair_pace>`
* :doc:`peri/eps <pair_peri>` * :doc:`peri/eps <pair_peri>`
* :doc:`peri/lps (o) <pair_peri>` * :doc:`peri/lps (o) <pair_peri>`
* :doc:`peri/pmb (o) <pair_peri>` * :doc:`peri/pmb (o) <pair_peri>`
@ -220,6 +234,7 @@ OPT.
* :doc:`polymorphic <pair_polymorphic>` * :doc:`polymorphic <pair_polymorphic>`
* :doc:`python <pair_python>` * :doc:`python <pair_python>`
* :doc:`quip <pair_quip>` * :doc:`quip <pair_quip>`
* :doc:`rann <pair_rann>`
* :doc:`reax/c (ko) <pair_reaxc>` * :doc:`reax/c (ko) <pair_reaxc>`
* :doc:`rebo (io) <pair_airebo>` * :doc:`rebo (io) <pair_airebo>`
* :doc:`resquared (go) <pair_resquared>` * :doc:`resquared (go) <pair_resquared>`
@ -241,6 +256,7 @@ OPT.
* :doc:`spin/dipole/long <pair_spin_dipole>` * :doc:`spin/dipole/long <pair_spin_dipole>`
* :doc:`spin/dmi <pair_spin_dmi>` * :doc:`spin/dmi <pair_spin_dmi>`
* :doc:`spin/exchange <pair_spin_exchange>` * :doc:`spin/exchange <pair_spin_exchange>`
* :doc:`spin/exchange/biquadratic <pair_spin_exchange>`
* :doc:`spin/magelec <pair_spin_magelec>` * :doc:`spin/magelec <pair_spin_magelec>`
* :doc:`spin/neel <pair_spin_neel>` * :doc:`spin/neel <pair_spin_neel>`
* :doc:`srp <pair_srp>` * :doc:`srp <pair_srp>`
@ -261,6 +277,7 @@ OPT.
* :doc:`ufm (got) <pair_ufm>` * :doc:`ufm (got) <pair_ufm>`
* :doc:`vashishta (gko) <pair_vashishta>` * :doc:`vashishta (gko) <pair_vashishta>`
* :doc:`vashishta/table (o) <pair_vashishta>` * :doc:`vashishta/table (o) <pair_vashishta>`
* :doc:`wf/cut <pair_wf_cut>`
* :doc:`yukawa (gko) <pair_yukawa>` * :doc:`yukawa (gko) <pair_yukawa>`
* :doc:`yukawa/colloid (go) <pair_yukawa_colloid>` * :doc:`yukawa/colloid (go) <pair_yukawa_colloid>`
* :doc:`zbl (gko) <pair_zbl>` * :doc:`zbl (gko) <pair_zbl>`

View File

@ -162,3 +162,26 @@ LAMMPS:
triple quotes can be nested in the usual manner. See the doc pages triple quotes can be nested in the usual manner. See the doc pages
for those commands for examples. Only one of level of nesting is for those commands for examples. Only one of level of nesting is
allowed, but that should be sufficient for most use cases. allowed, but that should be sufficient for most use cases.
.. admonition:: ASCII versus UTF-8
:class: note
LAMMPS expects and processes 7-bit ASCII format text internally.
Many modern environments use UTF-8 encoding, which is a superset
of the 7-bit ASCII character table and thus mostly compatible.
However, there are several non-ASCII characters that can look
very similar to their ASCII equivalents or are invisible (so they
look like a blank), but are encoded differently. Web browsers,
PDF viewers, document editors are known to sometimes replace one
with the other for a better looking output. However, that can
lead to problems, for instance, when using cut-n-paste of input
file examples from web pages, or when using a document editor
(not a dedicated plain text editor) for writing LAMMPS inputs.
LAMMPS will try to detect this and substitute the non-ASCII
characters with their ASCII equivalents where known. There also
is going to be a warning printed, if this occurs. It is
recommended to avoid such characters altogether in LAMMPS input,
data and potential files. The replacement tables are likely
incomplete and dependent on users reporting problems processing
correctly looking input containing UTF-8 encoded non-ASCII
characters.

View File

@ -13,5 +13,8 @@ of time and requests from the LAMMPS user community.
Developer_org Developer_org
Developer_flow Developer_flow
Developer_write Developer_write
Developer_notes
Developer_plugins
Developer_unittest
Classes Classes
Developer_utils Developer_utils

227
doc/src/Developer_notes.rst Normal file
View File

@ -0,0 +1,227 @@
Notes for developers and code maintainers
-----------------------------------------
This section documents how some of the code functionality within
LAMMPS works at a conceptual level. Comments on code in source files
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.
Fix contributions to instantaneous energy, virial, and cumulative energy
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Fixes can calculate contributions to the instantaneous energy and/or
virial of the system, both in a global and peratom sense. Fixes that
perform thermostatting or barostatting can calculate the cumulative
energy they add to or subtract from the system, which is accessed by
the *ecouple* and *econserve* thermodynamic keywords. This subsection
explains how both work and what flags to set in a new fix to enable
this functionality.
Let's start with thermostatting and barostatting fixes. Examples are
the :doc:`fix langevin <fix_langevin>` and :doc:`fix npt <fix_nh>`
commands. Here is what the fix needs to do:
* Set the variable *ecouple_flag* = 1 in the constructor. Also set
*scalar_flag* = 1, *extscalar* = 1, and *global_freq* to a timestep
increment which matches how often the fix is invoked.
* Implement a compute_scalar() method that returns the cumulative
energy added or subtracted by the fix, e.g. by rescaling the
velocity of atoms. The sign convention is that subtracted energy is
positive, added energy is negative. This must be the total energy
added to the entire system, i.e. an "extensive" quantity, not a
per-atom energy. Cumulative means the summed energy since the fix
was instantiated, even across multiple runs. This is because the
energy is used by the *econserve* thermodynamic keyword to check
that the fix is conserving the total energy of the system,
i.e. potential energy + kinetic energy + coupling energy = a
constant.
And here is how the code operates:
* The Modify class makes a list of all fixes that set *ecouple_flag* = 1.
* The :doc:`thermo_style custom <thermo_style>` command defines
*ecouple* and *econserve* keywords.
* These keywords sum the energy contributions from all the
*ecouple_flag* = 1 fixes by invoking the energy_couple() method in
the Modify class, which calls the compute_scalar() method of each
fix in the list.
------------------
Next, here is how a fix contributes to the instantaneous energy and
virial of the system. First, it sets any or all of these flags to a
value of 1 in their constructor:
* *energy_global_flag* to contribute to global energy, example: :doc:`fix indent <fix_indent>`
* *energy_peratom_flag* to contribute to peratom energy, :doc:`fix cmap <fix_cmap>`
* *virial_global_flag* to contribute to global virial, example: :doc:`fix wall <fix_wall>`
* *virial_peratom_flag* to contribute to peratom virial, example: :doc:`fix wall <fix_wall>`
The fix must also do the following:
* For global energy, implement a compute_scalar() method that returns
the energy added or subtracted on this timestep. Here the sign
convention is that added energy is positive, subtracted energy is
negative.
* For peratom energy, invoke the ev_init(eflag,vflag) function each
time the fix is invoked, which initializes per-atom energy storage.
The value of eflag may need to be stored from an earlier call to the
fix during the same timestep. See how the :doc:`fix cmap
<fix_cmap>` command does this in src/MOLECULE/fix_cmap.cpp. When an
energy for one or more atoms is calculated, invoke the ev_tally()
function to tally the contribution to each atom. Both the ev_init()
and ev_tally() methods are in the parent Fix class.
* For global and/or peratom virial, invoke the v_init(vflag) function
each time the fix is invoked, which initializes virial storage.
When forces on one or more atoms are calculated, invoke the
v_tally() function to tally the contribution. Both the v_init() and
v_tally() methods are in the parent Fix class. Note that there are
several variants of v_tally(); choose the one appropriate to your
fix.
.. note::
The ev_init() and ev_tally() methods also account for global and
peratom virial contributions. Thus you do not need to invoke the
v_init() and v_tally() methods, if the fix also calculates peratom
energies.
The fix must also specify whether (by default) to include or exclude
these contributions to the global/peratom energy/virial of the system.
For the fix to include the contributions, set either of both of these
variables in the constructor:
* *thermo_energy* = 1, for global and peratom energy
* *thermo_virial* = 1, for global and peratom virial
Note that these variables are zeroed in fix.cpp. Thus if you don't
set the variables, the contributions will be excluded (by default)
However, the user has ultimate control over whether to include or
exclude the contributions of the fix via the :doc:`fix modify
<fix_modify>` command:
* fix modify *energy yes* to include global and peratom energy contributions
* fix modify *virial yes* to include global and peratom virial contributions
If the fix contributes to any of the global/peratom energy/virial
values for the system, it should be explained on the fix doc page,
along with the default values for the *energy yes/no* and *virial
yes/no* settings of the :doc:`fix modify <fix_modify>` command.
Finally, these 4 contributions are included in the output of 4
computes:
* global energy in :doc:`compute pe <compute_pe>`
* peratom energy in :doc:`compute pe/atom <compute_pe_atom>`
* global virial in :doc:`compute pressure <compute_pressure>`
* peratom virial in :doc:`compute stress/atom <compute_stress_atom>`
These computes invoke a method of the Modify class to include
contributions from fixes that have the corresponding flags set,
e.g. *energy_peratom_flag* and *thermo_energy* for :doc:`compute
pe/atom <compute_pe_atom>`.
Note that each compute has an optional keyword to either include or
exclude all contributions from fixes. Also note that :doc:`compute pe
<compute_pe>` and :doc:`compute pressure <compute_pressure>` are what
is used (by default) by :doc:`thermodynamic output <thermo_style>` to
calculate values for its *pe* and *press* keywords.
KSpace PPPM FFT grids
^^^^^^^^^^^^^^^^^^^^^
The various :doc:`KSpace PPPM <kspace_style>` styles in LAMMPS use
FFTs to solve Poisson's equation. This subsection describes:
* how FFT grids are defined
* how they are decomposed across processors
* how they are indexed by each processor
* how particle charge and electric field values are mapped to/from
the grid
An FFT grid cell is a 3d volume; grid points are corners of a grid
cell and the code stores values assigned to grid points in vectors or
3d arrays. A global 3d FFT grid has points indexed 0 to N-1 inclusive
in each dimension.
Each processor owns two subsets of the grid, each subset is
brick-shaped. Depending on how it is used, these subsets are
allocated as a 1d vector or 3d array. Either way, the ordering of
values within contiguous memory x fastest, then y, z slowest.
For the ``3d decomposition`` of the grid, the global grid is
partitioned into bricks that correspond to the sub-domains of the
simulation box that each processor owns. Often, this is a regular 3d
array (Px by Py by Pz) of bricks, where P = number of processors =
Px * Py * Pz. More generally it can be a tiled decomposition, where
each processor owns a brick and the union of all the bricks is the
global grid. Tiled decompositions are produced by load balancing with
the RCB algorithm; see the :doc:`balance rcb <balance>` command.
For the ``FFT decompostion`` of the grid, each processor owns a brick
that spans the entire x dimension of the grid while the y and z
dimensions are partitioned as a regular 2d array (P1 by P2), where P =
P1 * P2.
The following indices store the inclusive bounds of the brick a
processor owns, within the global grid:
.. parsed-literal::
nxlo_in,nxhi_in,nylo_in,nyhi_in,nzlo_in,nzhi_in = 3d decomposition brick
nxlo_fft,nxhi_fft,nylo_fft,nyhi_fft,nzlo_fft,nzhi_fft = FFT decomposition brick
nxlo_out,nxhi_out,nylo_out,nyhi_out,nzlo_out,nzhi_out = 3d decomposition brick + ghost cells
The ``in`` and ``fft`` indices are from 0 to N-1 inclusive in each
dimension, where N is the grid size.
The ``out`` indices index an array which stores the ``in`` subset of
the grid plus ghost cells that surround it. These indices can thus be
< 0 or >= N.
The number of ghost cells a processor owns in each of the 6 directions
is a function of:
.. parsed-literal::
neighbor skin distance (since atoms can move outside a proc subdomain)
qdist = offset or charge from atom due to TIP4P fictitious charge
order = mapping stencil size
shift = factor used when order is an even number (see below)
Here is an explanation of how the PPPM variables ``order``,
``nlower`` / ``nupper``, ``shift``, and ``OFFSET`` work. They are the
relevant variables that determine how atom charge is mapped to grid
points and how field values are mapped from grid points to atoms:
.. parsed-literal::
order = # of nearby grid points in each dim that atom charge/field are mapped to/from
nlower,nupper = extent of stencil around the grid point an atom is assigned to
OFFSET = large integer added/subtracted when mapping to avoid int(-0.75) = 0 when -1 is the desired result
The particle_map() method assigns each atom to a grid point.
If order is even, say 4:
.. parsed-literal::
atom is assigned to grid point to its left (in each dim)
shift = OFFSET
nlower = -1, nupper = 2, which are offsets from assigned grid point
window of mapping grid pts is thus 2 grid points to left of atom, 2 to right
If order is odd, say 5:
.. parsed-literal::
atom is assigned to left/right grid pt it is closest to (in each dim)
shift = OFFSET + 0.5
nlower = 2, nupper = 2
if point is in left half of cell, then window of affected grid pts is 3 grid points to left of atom, 2 to right
if point is in right half of cell, then window of affected grid pts is 2 grid points to left of atom, 3 to right
These settings apply to each dimension, so that if order = 5, an
atom's charge is mapped to 125 grid points that surround the atom.

View File

@ -1,68 +1,75 @@
Source files Source files
------------ ------------
The source files of the LAMMPS code are found in two The source files of the LAMMPS code are found in two directories of the
directories of the distribution: ``src`` and ``lib``. distribution: ``src`` and ``lib``. Most of the code is written in C++
Most of the code is C++ but there are small numbers of files but there are small a number of files in several other languages like C,
in several other languages. Fortran, Shell script, or Python.
The core of the code is located in the The core of the code is located in the ``src`` folder and its
``src`` folder and its sub-directories. sub-directories. A sizable number of these files are in the ``src``
A sizable number of these files are in the ``src`` directory directory itself, but there are plenty of :doc:`packages <Packages>`,
itself, but there are plenty of :doc:`packages <Packages>`, which can be which can be included or excluded when LAMMPS is built. See the
included or excluded when LAMMPS is built. See the :doc:`Include :doc:`Include packages in build <Build_package>` section of the manual
packages in build <Build_package>` section of the manual for more for more information about that part of the build process. LAMMPS
information about that part of the build process. LAMMPS currently currently supports building with :doc:`conventional makefiles
supports building with :doc:`conventional makefiles <Build_make>` and <Build_make>` and through :doc:`CMake <Build_cmake>`. Those procedures
through :doc:`CMake <Build_cmake>` which differ in how packages are differ in how packages are enabled or disabled for inclusion into a
enabled or disabled for a LAMMPS binary. The source files for each LAMMPS binary so they cannot be mixed. The source files for each
package are in all-uppercase sub-directories of the ``src`` folder, for package are in all-uppercase sub-directories of the ``src`` folder, for
example ``src/MOLECULE`` or ``src/USER-MISC``. The ``src/STUBS`` example ``src/MOLECULE`` or ``src/USER-MISC``. The ``src/STUBS``
sub-directory is not a package but contains a dummy MPI library, that is sub-directory is not a package but contains a dummy MPI library, that is
used when building a serial version of the code. The ``src/MAKE`` used when building a serial version of the code. The ``src/MAKE``
directory contains makefiles with settings and flags for a variety of directory and its sub-directories contain makefiles with settings and
configuration and machines for the build process with traditional flags for a variety of configuration and machines for the build process
makefiles. with traditional makefiles.
The ``lib`` directory contains the source code for several supporting The ``lib`` directory contains the source code for several supporting
libraries or files with configuration settings to use globally installed libraries or files with configuration settings to use globally installed
libraries, that are required by some of the optional packages. libraries, that are required by some of the optional packages. They may
Each sub-directory, like ``lib/poems`` or ``lib/gpu``, contains the include python scripts that can transparently download additional source
source files, some of which are in different languages such as Fortran code on request. Each sub-directory, like ``lib/poems`` or ``lib/gpu``,
or CUDA. These libraries are linked to during a LAMMPS build, if the contains the source files, some of which are in different languages such
corresponding package is installed. as Fortran or CUDA. These libraries included in the LAMMPS build,
if the corresponding package is installed.
LAMMPS C++ source files almost always come in pairs, such as LAMMPS C++ source files almost always come in pairs, such as
``src/run.cpp`` (implementation file) and ``src/run.h`` (header file). ``src/run.cpp`` (implementation file) and ``src/run.h`` (header file).
Each pair of files defines a C++ Each pair of files defines a C++ class, for example the
class, for example the :cpp:class:`LAMMPS_NS::Run` class which contains :cpp:class:`LAMMPS_NS::Run` class which contains the code invoked by the
the code invoked by the :doc:`run <run>` command in a LAMMPS input script. :doc:`run <run>` command in a LAMMPS input script. As this example
As this example illustrates, source file and class names often have a illustrates, source file and class names often have a one-to-one
one-to-one correspondence with a command used in a LAMMPS input script. correspondence with a command used in a LAMMPS input script. Some
Some source files and classes do not have a corresponding input script source files and classes do not have a corresponding input script
command, e.g. ``src/force.cpp`` and the :cpp:class:`LAMMPS_NS::Force` command, e.g. ``src/force.cpp`` and the :cpp:class:`LAMMPS_NS::Force`
class. They are discussed in the next section. class. They are discussed in the next section.
A small number of C++ classes and utility functions are implemented with The names of all source files are in lower case and may use the
only a ``.h`` file. Examples are the Pointer class or the MathVec functions. underscore character '_' to separate words. Outside of bundled libraries
which may have different conventions, all C and C++ header files have a
``.h`` extension, all C++ files have a ``.cpp`` extension, and C files a
``.c`` extension. A small number of C++ classes and utility functions
are implemented with only a ``.h`` file. Examples are the Pointers and
Commands classes or the MathVec functions.
Class topology Class topology
-------------- --------------
Though LAMMPS has a lot of source files and classes, its class topology Though LAMMPS has a lot of source files and classes, its class topology
is relative flat, as outlined in the :ref:`class-topology` figure. Each is not very deep, which can be seen from the :ref:`class-topology`
name refers to a class and has a pair of associated source files in the figure. In that figure, each name refers to a class and has a pair of
``src`` folder, for example the class :cpp:class:`LAMMPS_NS::Memory` associated source files in the ``src`` folder, for example the class
corresponds to the files ``memory.cpp`` and ``memory.h``, or the class :cpp:class:`LAMMPS_NS::Memory` corresponds to the files ``memory.cpp``
:cpp:class:`LAMMPS_NS::AtomVec` corresponds to the files and ``memory.h``, or the class :cpp:class:`LAMMPS_NS::AtomVec`
``atom_vec.cpp`` and ``atom_vec.h``. Full lines in the figure represent corresponds to the files ``atom_vec.cpp`` and ``atom_vec.h``. Full
compositing: that is the class to the left holds a pointer to an lines in the figure represent compositing: that is the class at the base
instance of the class to the right. Dashed lines instead represent of the arrow holds a pointer to an instance of the class at the tip.
inheritance: the class to the right is derived from the class on the Dashed lines instead represent inheritance: the class to the tip of the
left. Classes with a red boundary are not instantiated directly, but arrow is derived from the class at the base. Classes with a red boundary
they represent the base classes for "styles". Those "styles" make up are not instantiated directly, but they represent the base classes for
the bulk of the LAMMPS code and only a few typical examples are included "styles". Those "styles" make up the bulk of the LAMMPS code and only
in the figure for demonstration purposes. a few representative examples are included in the figure so it remains
readable.
.. _class-topology: .. _class-topology:
.. figure:: JPG/lammps-classes.png .. figure:: JPG/lammps-classes.png
@ -82,69 +89,76 @@ in the figure for demonstration purposes.
derived classes, which may also hold instances of other classes. derived classes, which may also hold instances of other classes.
The :cpp:class:`LAMMPS_NS::LAMMPS` class is the topmost class and The :cpp:class:`LAMMPS_NS::LAMMPS` class is the topmost class and
represents what is referred to an "instance" of LAMMPS. It is a represents what is generally referred to an "instance" of LAMMPS. It is
composite holding references to instances of other core classes a composite holding pointers to instances of other core classes
providing the core functionality of the MD engine in LAMMPS and through providing the core functionality of the MD engine in LAMMPS and through
them abstractions of the required operations. The constructor of the them abstractions of the required operations. The constructor of the
LAMMPS class will instantiate those instances, process the command line LAMMPS class will instantiate those instances, process the command line
flags, initialize MPI (if not already done) and set up file pointers for flags, initialize MPI (if not already done) and set up file pointers for
input and output. The destructor will shut everything down and free all input and output. The destructor will shut everything down and free all
associated memory. Thus code for the standalone LAMMPS executable in associated memory. Thus code for the standalone LAMMPS executable in
``main.cpp`` simply initializes MPI, instantiates a single instance of ``main.cpp`` simply initializes MPI, instantiates a single instance of
LAMMPS, and passes it the command line flags and input script. It LAMMPS while passing it the command line flags and input script. It
deletes the LAMMPS instance after the method reading the input returns deletes the LAMMPS instance after the method reading the input returns
and shuts down the MPI environment before it exits the executable. and shuts down the MPI environment before it exits the executable.
The :cpp:class:`LAMMPS_NS::Pointers` is not shown in the The :cpp:class:`LAMMPS_NS::Pointers` is not shown in the
:ref:`class-topology` figure, it holds references to members of the :ref:`class-topology` figure for clarity. It holds references to many
`LAMMPS_NS::LAMMPS`, so that all classes derived from of the members of the `LAMMPS_NS::LAMMPS`, so that all classes derived
:cpp:class:`LAMMPS_NS::Pointers` have direct access to those reference. from :cpp:class:`LAMMPS_NS::Pointers` have direct access to those
From the class topology all classes with blue boundary are referenced in reference. From the class topology all classes with blue boundary are
this class and all classes in the second and third columns, that are not referenced in the Pointers class and all classes in the second and third
listed as derived classes are instead derived from columns, that are not listed as derived classes are instead derived from
:cpp:class:`LAMMPS_NS::Pointers`. :cpp:class:`LAMMPS_NS::Pointers`. To initialize the pointer references
in Pointers, a pointer to the LAMMPS class instance needs to be passed
to the constructor and thus all constructors for classes derived from it
must do so and pass this pointer to the constructor for Pointers.
Since all storage is encapsulated, the LAMMPS class can also be Since all storage is supposed to be encapsulated (there are a few
instantiated multiple times by a calling code, and that can be either exceptions), the LAMMPS class can also be instantiated multiple times by
simultaneously or consecutively. When running in parallel with MPI, a calling code. Outside of the aforementioned exceptions, those LAMMPS
care has to be taken, that suitable communicators are used to not instances can be used alternately. As of the time of this writing
create conflicts between different instances. (early 2021) LAMMPS is not yet sufficiently thread-safe for concurrent
execution. When running in parallel with MPI, care has to be taken,
that suitable copies of communicators are used to not create conflicts
between different instances.
The LAMMPS class currently holds instances of 19 classes representing The LAMMPS class currently (early 2021) holds instances of 19 classes
different core functionalities There are a handful of virtual parent representing the core functionality. There are a handful of virtual
classes in LAMMPS that define what LAMMPS calls ``styles``. They are parent classes in LAMMPS that define what LAMMPS calls ``styles``. They
shaded red in the :ref:`class-topology` figure. Each of these are are shaded red in the :ref:`class-topology` figure. Each of these are
parents of a number of child classes that implement the interface parents of a number of child classes that implement the interface
defined by the parent class. There are two main categories of these defined by the parent class. There are two main categories of these
``styles``: some may only have one instance active at a time (e.g. atom, ``styles``: some may only have one instance active at a time (e.g. atom,
pair, bond, angle, dihedral, improper, kspace, comm) and there is a pair, bond, angle, dihedral, improper, kspace, comm) and there is a
dedicated pointer variable in the composite class that manages them. dedicated pointer variable for each of them in the composite class.
Setups that require a mix of different such styles have to use a Setups that require a mix of different such styles have to use a
*hybrid* class that manages and forwards calls to the corresponding *hybrid* class that takes the place of the one allowed instance and then
sub-styles for the designated subset of atoms or data. or the composite manages and forwards calls to the corresponding sub-styles for the
class may have lists of class instances, e.g. Modify handles lists of designated subset of atoms or data. The composite class may also have
compute and fix styles, while Output handles dumps class instances. lists of class instances, e.g. Modify handles lists of compute and fix
styles, while Output handles a list of dump class instances.
The exception to this scheme are the ``command`` style classes. These The exception to this scheme are the ``command`` style classes. These
implement specific commands that can be invoked before, after, or between implement specific commands that can be invoked before, after, or in
runs or are commands which launch a simulation. For these an instance between runs. For these an instance of the class is created, its
of the class is created, its command() method called and then, after command() method called and then, after completion, the class instance
completion, the class instance deleted. Examples for this are the deleted. Examples for this are the create_box, create_atoms, minimize,
create_box, create_atoms, minimize, run, or velocity command styles. run, set, or velocity command styles.
For all those ``styles`` certain naming conventions are employed: for For all those ``styles`` certain naming conventions are employed: for
the fix nve command the class is called FixNVE and the files are the fix nve command the class is called FixNVE and the source files are
``fix_nve.h`` and ``fix_nve.cpp``. Similarly for fix ave/time we have ``fix_nve.h`` and ``fix_nve.cpp``. Similarly for fix ave/time we have
FixAveTime and ``fix_ave_time.h`` and ``fix_ave_time.cpp``. Style names FixAveTime and ``fix_ave_time.h`` and ``fix_ave_time.cpp``. Style names
are lower case and without spaces or special characters. A suffix or are lower case and without spaces or special characters. A suffix or
multiple appended with a forward slash '/' denotes a variant of the words are appended with a forward slash '/' which denotes a variant of
corresponding class without the suffix. To connect the style name and the corresponding class without the suffix. To connect the style name
the class name, LAMMPS uses macros like the following ATOM\_CLASS, and the class name, LAMMPS uses macros like: ``AtomStyle()``,
PAIR\_CLASS, BOND\_CLASS, REGION\_CLASS, FIX\_CLASS, COMPUTE\_CLASS, ``PairStyle()``, ``BondStyle()``, ``RegionStyle()``, and so on in the
or DUMP\_CLASS in the corresponding header file. During compilation corresponding header file. During configuration or compilation files
files with the pattern ``style_name.h`` are created that contain include with the pattern ``style_<name>.h`` are created that consist of a list
statements including all headers of all styles of a given type that of include statements including all headers of all styles of a given
are currently active (or "installed). type that are currently active (or "installed).
More details on individual classes in the :ref:`class-topology` are as More details on individual classes in the :ref:`class-topology` are as
@ -152,20 +166,20 @@ follows:
- The Memory class handles allocation of all large vectors and arrays. - The Memory class handles allocation of all large vectors and arrays.
- The Error class prints all error and warning messages. - The Error class prints all (terminal) error and warning messages.
- The Universe class sets up partitions of processors so that multiple - The Universe class sets up one or more partitions of processors so
simulations can be run, each on a subset of the processors allocated that one or multiple simulations can be run, on the processors
for a run, e.g. by the mpirun command. allocated for a run, e.g. by the mpirun command.
- The Input class reads and processes input input strings and files, - The Input class reads and processes input input strings and files,
stores variables, and invokes :doc:`commands <Commands_all>`. stores variables, and invokes :doc:`commands <Commands_all>`.
- As discussed above, command style classes are directly derived from - Command style classes are derived from the Command class. They provide
the Pointers class. They provide input script commands that perform input script commands that perform one-time operations
one-time operations before/after/between simulations or which invoke a before/after/between simulations or which invoke a simulation. They
simulation. They are instantiated from within the Input class, are usually instantiated from within the Input class, its ``command``
invoked, then immediately destructed. method invoked, and then immediately destructed.
- The Finish class is instantiated to print statistics to the screen - The Finish class is instantiated to print statistics to the screen
after a simulation is performed, by commands like run and minimize. after a simulation is performed, by commands like run and minimize.
@ -241,7 +255,8 @@ follows:
.. TODO section on "Spatial decomposition and parallel operations" .. TODO section on "Spatial decomposition and parallel operations"
.. diagram of 3d processor grid, brick vs. tiled. local vs. ghost .. diagram of 3d processor grid, brick vs. tiled. local vs. ghost
.. atoms, 6-way communication with pack/unpack functions, .. atoms, 6-way communication with pack/unpack functions,
.. PBC as part of the communication .. PBC as part of the communication, forward and reverse communication
.. rendezvous communication, ring communication.
.. TODO section on "Fixes, Computes, and Variables" .. TODO section on "Fixes, Computes, and Variables"
.. how and when data is computed and provided and how it is .. how and when data is computed and provided and how it is

View File

@ -0,0 +1,251 @@
Writing plugins
---------------
Plugins provide a mechanism to add functionality to a LAMMPS executable
without recompiling LAMMPS. The functionality for this and the
:doc:`plugin command <plugin>` are implemented in the
:ref:`PLUGIN package <PKG-PLUGIN>` which must be installed to use plugins.
Plugins use the operating system's capability to load dynamic shared
object (DSO) files in a way similar shared libraries and then reference
specific functions in those DSOs. Any DSO file with plugins has to include
an initialization function with a specific name, "lammpsplugin_init", that
has to follow specific rules described below. When loading the DSO with
the "plugin" command, this function is looked up and called and will then
register the contained plugin(s) with LAMMPS.
From the programmer perspective this can work because of the object
oriented design of LAMMPS where all pair style commands are derived from
the class Pair, all fix style commands from the class Fix and so on and
usually only functions present in those base classes are called
directly. When a :doc:`pair_style` command or :doc:`fix` command is
issued a new instance of such a derived class is created. This is done
by a so-called factory function which is mapped to the style name. Thus
when, for example, the LAMMPS processes the command ``pair_style lj/cut
2.5``, LAMMPS will look up the factory function for creating the
``PairLJCut`` class and then execute it. The return value of that
function is a ``Pair *`` pointer and the pointer will be assigned to the
location for the currently active pair style.
A DSO file with a plugin thus has to implement such a factory function
and register it with LAMMPS so that it gets added to the map of available
styles of the given category. To register a plugin with LAMMPS an
initialization function has to be present in the DSO file called
``lammpsplugin_init`` which is called with three ``void *`` arguments:
a pointer to the current LAMMPS instance, a pointer to the opened DSO
handle, and a pointer to the registration function. The registration
function takes two arguments: a pointer to a ``lammpsplugin_t`` struct
with information about the plugin and a pointer to the current LAMMPS
instance. Please see below for an example of how the registration is
done.
Members of ``lammpsplugin_t``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. list-table::
:header-rows: 1
:widths: auto
* - Member
- Description
* - version
- LAMMPS Version string the plugin was compiled for
* - style
- Style of the plugin (pair, bond, fix, command, etc.)
* - name
- Name of the plugin style
* - info
- String with information about the plugin
* - author
- String with the name and email of the author
* - creator.v1
- Pointer to factory function for pair, bond, angle, dihedral, improper or command styles
* - creator.v2
- Pointer to factory function for compute, fix, or region styles
* - handle
- Pointer to the open DSO file handle
Only one of the three alternate creator entries can be used at a time
and which of those is determined by the style of plugin. The
"creator.v1" element is for factory functions of supported styles
computing forces (i.e. command, pair, bond, angle, dihedral, or
improper styles) and the function takes as single argument the pointer
to the LAMMPS instance. The factory function is cast to the
``lammpsplugin_factory1`` type before assignment. The "creator.v2"
element is for factory functions creating an instance of a fix, compute,
or region style and takes three arguments: a pointer to the LAMMPS
instance, an integer with the length of the argument list and a ``char
**`` pointer to the list of arguments. The factory function pointer
needs to be cast to the ``lammpsplugin_factory2`` type before
assignment.
Pair style example
^^^^^^^^^^^^^^^^^^
As an example, a hypothetical pair style plugin "morse2" implemented in
a class ``PairMorse2`` in the files ``pair_morse2.h`` and
``pair_morse2.cpp`` with the factory function and initialization
function would look like this:
.. code-block:: C++
#include "lammpsplugin.h"
#include "version.h"
#include "pair_morse2.h"
using namespace LAMMPS_NS;
static Pair *morse2creator(LAMMPS *lmp)
{
return new PairMorse2(lmp);
}
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
{
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
lammpsplugin_t plugin;
plugin.version = LAMMPS_VERSION;
plugin.style = "pair";
plugin.name = "morse2";
plugin.info = "Morse2 variant pair style v1.0";
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2creator;
plugin.handle = handle;
(*register_plugin)(&plugin,lmp);
}
The factory function in this example is called ``morse2creator()``. It
receives a pointer to the LAMMPS class as only argument and thus has to
be assigned to the *creator.v1* member of the plugin struct and cast to
the ``lammpsplugin_factory1`` function pointer type. It returns a
pointer to the allocated class instance derived from the ``Pair`` class.
This function may be declared static to avoid clashes with other
plugins. The name of the derived class, ``PairMorse2``, however must be
unique inside the entire LAMMPS executable.
Fix style example
^^^^^^^^^^^^^^^^^
If the factory function would be for a fix or compute, which take three
arguments (a pointer to the LAMMPS class, the number of arguments and the
list of argument strings), then the pointer type is ``lammpsplugin_factory2``
and it must be assigned to the *creator.v2* member of the plugin struct.
Below is an example for that:
.. code-block:: C++
#include "lammpsplugin.h"
#include "version.h"
#include "fix_nve2.h"
using namespace LAMMPS_NS;
static Fix *nve2creator(LAMMPS *lmp, int argc, char **argv)
{
return new FixNVE2(lmp,argc,argv);
}
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
{
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
lammpsplugin_t plugin;
plugin.version = LAMMPS_VERSION;
plugin.style = "fix";
plugin.name = "nve2";
plugin.info = "NVE2 variant fix style v1.0";
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
plugin.creator.v2 = (lammpsplugin_factory2 *) &nve2creator;
plugin.handle = handle;
(*register_plugin)(&plugin,lmp);
}
Command style example
^^^^^^^^^^^^^^^^^^^^^
Command styles also use the first variant of factory function as
demonstrated in the following example, which also shows that the
implementation of the plugin class may be within the same source
file as the plugin interface code:
.. code-block:: C++
#include "lammpsplugin.h"
#include "comm.h"
#include "error.h"
#include "command.h"
#include "version.h"
#include <cstring>
namespace LAMMPS_NS {
class Hello : public Command {
public:
Hello(class LAMMPS *lmp) : Command(lmp) {};
void command(int, char **);
};
}
using namespace LAMMPS_NS;
void Hello::command(int argc, char **argv)
{
if (argc != 1) error->all(FLERR,"Illegal hello command");
if (comm->me == 0)
utils::logmesg(lmp,fmt::format("Hello, {}!\n",argv[0]));
}
static void hellocreator(LAMMPS *lmp)
{
return new Hello(lmp);
}
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
{
lammpsplugin_t plugin;
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;
plugin.version = LAMMPS_VERSION;
plugin.style = "command";
plugin.name = "hello";
plugin.info = "Hello world command v1.1";
plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)";
plugin.creator.v1 = (lammpsplugin_factory1 *) &hellocreator;
plugin.handle = handle;
(*register_plugin)(&plugin,lmp);
}
Additional Details
^^^^^^^^^^^^^^^^^^
The initialization function **must** be called ``lammpsplugin_init``, it
**must** have C bindings and it takes three void pointers as arguments.
The first is a pointer to the LAMMPS class that calls it and it needs to
be passed to the registration function. The second argument is a
pointer to the internal handle of the DSO file, this needs to be added
to the plugin info struct, so that the DSO can be closed and unloaded
when all its contained plugins are unloaded. The third argument is a
function pointer to the registration function and needs to be stored
in a variable of ``lammpsplugin_regfunc`` type and then called with a
pointer to the ``lammpsplugin_t`` struct and the pointer to the LAMMPS
instance as arguments to register a single plugin. There may be multiple
calls to multiple plugins in the same initialization function.
To register a plugin a struct of the ``lammpsplugin_t`` needs to be filled
with relevant info: current LAMMPS version string, kind of style, name of
style, info string, author string, pointer to factory function, and the
DSO handle. The registration function is called with a pointer to the address
of this struct and the pointer of the LAMMPS class. The registration function
will then add the factory function of the plugin style to the respective
style map under the provided name. It will also make a copy of the struct
in a list of all loaded plugins and update the reference counter for loaded
plugins from this specific DSO file.
The pair style itself (i.e. the PairMorse2 class in this example) can be
written just like any other pair style that is included in LAMMPS. For
a plugin, the use of the ``PairStyle`` macro in the section encapsulated
by ``#ifdef PAIR_CLASS`` is not needed, since the mapping of the class
name to the style name is done by the plugin registration function with
the information from the ``lammpsplugin_t`` struct. It may be included
in case the new code is intended to be later included in LAMMPS directly.

View File

@ -0,0 +1,536 @@
Adding tests for unit testing
-----------------------------
This section discusses adding or expanding tests for the unit test
infrastructure included into the LAMMPS source code distribution.
Unlike example inputs, unit tests focus on testing the "local" behavior
of individual features, tend to run fast, and should be set up to cover
as much of the added code as possible. When contributing code to the
distribution, the LAMMPS developers will appreciate if additions to the
integrated unit test facility are included.
Given the complex nature of MD simulations where many operations can
only be performed when suitable "real" simulation environment has been
set up, not all tests will be unit tests in the strict definition of
the term. They are rather executed on a more abstract level by issuing
LAMMPS script commands and then inspecting the changes to the internal
data. For some classes of tests, generic test programs have been
written that can be applied to parts of LAMMPS that use the same
interface (via polymorphism) and those are driven by input files, so
tests can be added by simply adding more of those input files. Those
tests should be seen more as a hybrid between unit and regression tests.
When adding tests it is recommended to also :ref:`enable support for
code coverage reporting <testing>`, and study the coverage reports
so that it is possible to monitor which parts of the code of a given
file are executed during the tests and which tests would need to be
added to increase the coverage.
The tests are grouped into categories and corresponding folders.
The following sections describe how the tests are implemented and
executed in those categories with increasing complexity of tests
and implementation.
Tests for utility functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
These tests are driven by programs in the ``unittest/utils`` folder
and most closely resemble conventional unit tests. There is one test
program for each namespace or group of classes or file. The naming
convention for the sources and executables is that they start with
with ``test_``. The following sources and groups of tests are currently
available:
.. list-table::
:header-rows: 1
:widths: auto
:align: left
* - File name:
- Test name:
- Description:
* - ``test_argutils.cpp``
- ArgInfo
- Tests for ``ArgInfo`` class used by LAMMPS
* - ``test_fmtlib.cpp``
- FmtLib
- Tests for ``fmtlib::`` functions used by LAMMPS
* - ``test_math_eigen_impl.cpp``
- MathEigen
- Tests for ``MathEigen::`` classes and functions
* - ``test_mempool.cpp``
- MemPool
- Tests for :cpp:class:`MyPage <LAMMPS_NS::MyPage>` and :cpp:class:`MyPoolChunk <LAMMPS_NS::MyPoolChunk>`
* - ``test_tokenizer.cpp``
- Tokenizer
- Tests for :cpp:class:`Tokenizer <LAMMPS_NS::Tokenizer>` and :cpp:class:`ValueTokenizer <LAMMPS_NS::ValueTokenizer>`
* - ``test_utils.cpp``
- Utils
- Tests for ``utils::`` :doc:`functions <Developer_utils>`
To add tests either an existing source file needs to be modified or a
new source file needs to be added to the distribution and enabled for
testing. To add a new file suitable CMake script code needs to be added
to the ``CMakeLists.txt`` file in the ``unittest/utils`` folder. Example:
.. code-block:: cmake
add_executable(test_tokenizer test_tokenizer.cpp)
target_link_libraries(test_tokenizer PRIVATE lammps GTest::GMockMain GTest::GMock GTest::GTest)
add_test(Tokenizer test_tokenizer)
This adds instructions to build the ``test_tokenizer`` executable from
``test_tokenizer.cpp`` and links it with the GoogleTest libraries and the
LAMMPS library as well as it uses the ``main()`` function from the
GoogleMock library of GoogleTest. The third line registers the executable
as a test program to be run from ``ctest`` under the name ``Tokenizer``.
The test executable itself will execute multiple individual tests
through the GoogleTest framework. In this case each test consists of
creating a tokenizer class instance with a given string and explicit or
default separator choice, and then executing member functions of the
class and comparing their results with expected values. A few examples:
.. code-block:: c++
TEST(Tokenizer, empty_string)
{
Tokenizer t("", " ");
ASSERT_EQ(t.count(), 0);
}
TEST(Tokenizer, two_words)
{
Tokenizer t("test word", " ");
ASSERT_EQ(t.count(), 2);
}
TEST(Tokenizer, default_separators)
{
Tokenizer t(" \r\n test \t word \f");
ASSERT_THAT(t.next(), Eq("test"));
ASSERT_THAT(t.next(), Eq("word"));
ASSERT_EQ(t.count(), 2);
}
Each of these TEST functions will become an individual
test run by the test program. When using the ``ctest``
command as a front end to run the tests, their output
will be suppressed and only a summary printed, but adding
the '-V' option will then produce output from the tests
above like the following:
.. code-block::
[...]
1: [ RUN ] Tokenizer.empty_string
1: [ OK ] Tokenizer.empty_string (0 ms)
1: [ RUN ] Tokenizer.two_words
1: [ OK ] Tokenizer.two_words (0 ms)
1: [ RUN ] Tokenizer.default_separators
1: [ OK ] Tokenizer.default_separators (0 ms)
[...]
The MathEigen test collection has been adapted from a standalone test
and does not use the GoogleTest framework and thus not representative.
The other test sources, however, can serve as guiding examples for
additional tests.
Tests for individual LAMMPS commands
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The tests ``unittest/commands`` are a bit more complex as they require
to first create a :cpp:class:`LAMMPS <LAMMPS_NS::LAMMPS>` class instance
and then use the :doc:`C++ API <Cplusplus>` to pass individual commands
to that LAMMPS instance. For that reason these tests use a GoogleTest
"test fixture", i.e. a class derived from ``testing::Test`` that will
create (and delete) the required LAMMPS class instance for each set of
tests in a ``TEST_F()`` function. Please see the individual source files
for different examples of setting up suitable test fixtures. Here is an
example for implementing a test using a fixture by first checking the
default value and then issuing LAMMPS commands and checking whether they
have the desired effect:
.. code-block:: c++
TEST_F(SimpleCommandsTest, ResetTimestep)
{
ASSERT_EQ(lmp->update->ntimestep, 0);
BEGIN_HIDE_OUTPUT();
command("reset_timestep 10");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->ntimestep, 10);
BEGIN_HIDE_OUTPUT();
command("reset_timestep 0");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->ntimestep, 0);
TEST_FAILURE(".*ERROR: Timestep must be >= 0.*", command("reset_timestep -10"););
TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep"););
TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep 10 10"););
TEST_FAILURE(".*ERROR: Expected integer .*", command("reset_timestep xxx"););
}
Please note the use of the ``BEGIN_HIDE_OUTPUT`` and ``END_HIDE_OUTPUT``
functions that will capture output from running LAMMPS. This is normally
discarded but by setting the verbose flag (via setting the ``TEST_ARGS``
environment variable, ``TEST_ARGS=-v``) it can be printed and used to
understand why tests fail unexpectedly.
Another complexity of these tests stems from the need to capture
situations where LAMMPS will stop with an error, i.e. handle so-called
"death tests". Here the LAMMPS code will operate differently depending
on whether it was configured to throw C++ exceptions on errors or call
either ``exit()`` or ``MPI_Abort()``. In the latter case, the test code
also needs to detect whether LAMMPS was compiled with the OpenMPI
library, as OpenMPI is **only** compatible the death test options of the
GoogleTest library when C++ exceptions are enabled; otherwise those
"death tests" must be skipped to avoid reporting bogus failures. The
specifics of this step are implemented in the ``TEST_FAILURE()``
macro. These tests operate by capturing the screen output when executing
the failing command and then comparing that with a provided regular
expression string pattern. Example:
.. code-block:: C++
TEST_F(SimpleCommandsTest, UnknownCommand)
{
TEST_FAILURE(".*ERROR: Unknown command.*", lmp->input->one("XXX one two"););
}
The following test programs are currently available:
.. list-table::
:header-rows: 1
:widths: auto
:align: left
* - File name:
- Test name:
- Description:
* - ``test_simple_commands.cpp``
- SimpleCommands
- Tests for LAMMPS commands that do not require a box
* - ``test_lattice_region.cpp``
- LatticeRegion
- Tests to validate the :doc:`lattice <lattice>` and :doc:`region <region>` commands
* - ``test_groups.cpp``
- GroupTest
- Tests to validate the :doc:`group <group>` command
* - ``test_variables.cpp``
- VariableTest
- Tests to validate the :doc:`variable <variable>` command
* - ``test_kim_commands.cpp``
- KimCommands
- Tests for several commands from the :ref:`KIM package <PKG-KIM>`
* - ``test_reset_ids.cpp``
- ResetIDs
- Tests to validate the :doc:`reset_atom_ids <reset_atom_ids>` and :doc:`reset_mol_ids <reset_mol_ids>` commands
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 in either way used
for utility functions and 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 tries 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
through the library interface, provided that LAMMPS was compiled with
MPI support. These include tests where LAMMPS is run in multi-partition
mode or only on a subset of the MPI world communicator. The CMake
script code for adding this kind of test looks like this:
.. code-block:: CMake
if (BUILD_MPI)
add_executable(test_library_mpi test_library_mpi.cpp)
target_link_libraries(test_library_mpi PRIVATE lammps GTest::GTest GTest::GMock)
target_compile_definitions(test_library_mpi PRIVATE ${TEST_CONFIG_DEFS})
add_mpi_test(NAME LibraryMPI NUM_PROCS 4 COMMAND $<TARGET_FILE:test_library_mpi>)
endif()
Note the custom function ``add_mpi_test()`` which adapts how ``ctest``
will execute the test so it is launched in parallel (with 4 MPI ranks).
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
prerequisites are detected or enabled during configuration and
compilation of LAMMPS (shared library build enabled, Python interpreter
found, Python development files found).
The Python tests are implemented using the ``unittest`` standard Python
module and split into multiple files with similar categories as the
tests for the C-style library interface.
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
to also implement 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. This part of the
unit tests is incomplete since the Fortran module it is based on is
incomplete as well.
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.
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 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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These are tests common configurations for pair styles, bond styles,
angle styles, kspace styles and certain fix styles. Those are tests
driven by some test executables build from sources in the
``unittest/force-styles`` folder and use LAMMPS input template and data
files as well as input files in YAML format from the
``unittest/force-styles/tests`` folder. The YAML file names have to
follow some naming conventions so they get associated with the test
programs and categorized and listed with canonical names in the list
of tests as displayed by ``ctest -N``. If you add a new YAML file,
you need to re-run CMake to update the corresponding list of tests.
A minimal YAML file for a (molecular) pair style test will looks
something like the following (see ``mol-pair-zero.yaml``):
.. code-block:: yaml
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:21 202
epsilon: 1e-14
prerequisites: ! |
atom full
pair zero
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
pair_style: zero 8.0
pair_coeff: ! |
* *
extract: ! ""
natoms: 29
init_vdwl: 0
init_coul: 0
[...]
The following table describes the available keys and their purpose for
testing pair styles:
.. list-table::
:header-rows: 1
* - Key:
- Description:
* - lammps_version
- LAMMPS version used to last update the reference data
* - date_generated
- date when the file was last updated
* - epsilon
- base value for the relative precision required for tests to pass
* - prerequisites
- list of style kind / style name pairs required to run the test
* - pre_commands
- LAMMPS commands to be executed before the input template file is read
* - post_commands
- LAMMPS commands to be executed right before the actual tests
* - input_file
- LAMMPS input file template based on pair style zero
* - pair_style
- arguments to the pair_style command to be tested
* - pair_coeff
- list of pair_coeff arguments to set parameters for the input template
* - extract
- list of keywords supported by ``Pair::extract()`` and their dimension
* - natoms
- number of atoms in the input file template
* - init_vdwl
- non-Coulomb pair energy after "run 0"
* - init_coul
- Coulomb pair energy after "run 0"
* - init_stress
- stress tensor after "run 0"
* - init_forces
- forces on atoms after "run 0"
* - run_vdwl
- non-Coulomb pair energy after "run 4"
* - run_coul
- Coulomb pair energy after "run 4"
* - run_stress
- stress tensor after "run 4"
* - run_forces
- forces on atoms after "run 4"
The test program will read all this data from the YAML file and then
create a LAMMPS instance, apply the settings/commands from the YAML file
as needed and then issue a "run 0" command, write out a restart file, a
data file and a coeff file. The actual test will then compare computed
energies, stresses, and forces with the reference data, issue a "run 4"
command and compare to the second set of reference data. This will be
run with both the newton_pair setting enabled and disabled and is
expected to generate the same results (allowing for some numerical
noise). Then it will restart from the previously generated restart and
compare with the reference and also start from the data file. A final
check will use multi-cutoff r-RESPA (if supported by the pair style) at
a 1:1 split and compare to the Verlet results. These sets of tests are
run with multiple test fixtures for accelerated styles (OPT, USER-OMP,
USER-INTEL) and for the latter two with 4 OpenMP threads enabled. For
these tests the relative error (epsilon) is lowered by a common factor
due to the additional numerical noise, but the tests are still comparing
to the same reference data.
Additional tests will check whether all listed extract keywords are
supported and have the correct dimensionality and the final set of tests
will set up a few pairs of atoms explicitly and in such a fashion that
the forces on the atoms computed from ``Pair::compute()`` will match
individually with the results from ``Pair::single()``, if the pair style
does support that functionality.
With this scheme a large fraction of the code of any tested pair style
will be executed and consistent results are required for different
settings and between different accelerated pair style variants and the
base class, as well as for computing individual pairs through the
``Pair::single()`` where supported.
The ``test_pair_style`` tester is used with 4 categories of test inputs:
- pair styles compatible with molecular systems using bonded
interactions and exclusions. For pair styles requiring a KSpace style
the KSpace computations are disabled. The YAML files match the
pattern "mol-pair-\*.yaml" and the tests are correspondingly labeled
with "MolPairStyle:\*"
- pair styles not compatible with the previous input template.
The YAML files match the pattern "atomic-pair-\*.yaml" and the tests are
correspondingly labeled with "AtomicPairStyle:\*"
- manybody pair styles.
The YAML files match the pattern "atomic-pair-\*.yaml" and the tests are
correspondingly labeled with "AtomicPairStyle:\*"
- kspace styles.
The YAML files match the pattern "kspace-\*.yaml" and the tests are
correspondingly labeled with "KSpaceStyle:\*". In these cases a compatible
pair style is defined, but the computation of the pair style contributions
is disabled.
The ``test_bond_style`` and ``test_angle_style`` are set up in a similar
fashion and share support functions with the pair style tester. The final
group of tests in this section is for fix styles that add/manipulate forces
and velocities, e.g. for time integration, thermostats and more.
Adding a new test is easiest done by copying and modifying an existing test
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, for as long as they do not diverge.
The template input files define a large number of index variables at the top
that can be modified inside the YAML file to control the behavior. For example,
if a pair style requires a "newton on" setting, the following can be used in
as the "pre_commands" section:
.. code-block:: yaml
pre_commands: ! |
variable newton_pair delete
variable newton_pair index on
And for a pair style requiring a kspace solver the following would be used as
the "post_commands" section:
.. code-block:: yaml
post_commands: ! |
pair_modify table 0
kspace_style pppm/tip4p 1.0e-6
kspace_modify gewald 0.3
kspace_modify compute no
Note that this disables computing the kspace contribution, but still will run
the setup. The "gewald" parameter should be set explicitly to speed up the run.
For styles with long-range electrostatics, typically two tests are added one using
the (slower) analytic approximation of the erfc() function and the other using
the tabulated coulomb, to test both code paths. The reference results in the YAML
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
to update the YAML files. Running a command like
.. code-block:: bash
$ test_pair_style mol-pair-lennard_mdf.yaml -g new.yaml
will read the settings from the ``mol-pair-lennard_mdf.yaml`` file and then compute
the reference data and write a new file with to ``new.yaml``. If this step fails,
there are likely some (LAMMPS or YAML) syntax issues in the YAML file that need to
be resolved and then one can compare the two files to see if the output is as expected.
It is also possible to do an update in place with:
.. code-block:: bash
$ test_pair_style mol-pair-lennard_mdf.yaml -u
And one can finally run the full set of tests with:
.. code-block:: bash
$ test_pair_style mol-pair-lennard_mdf.yaml
This will just print a summary of the groups of tests. When using the "-v" flag
the test will also keep any LAMMPS output and when using the "-s" flag, there
will be some statistics reported on the relative errors for the individual checks
which can help to figure out what would be a good choice of the epsilon parameter.
It should be as small as possible to catch any unintended side effects from changes
elsewhere, but large enough to accommodate the numerical noise due to the implementation
of the potentials and differences in compilers.
.. note::
These kinds of tests can be very sensitive to compiler optimization and
thus the expectation is that they pass with compiler optimization turned
off. When compiler optimization is enabled, there may be some failures, but
one has to carefully check whether those are acceptable due to the enhanced
numerical noise from reordering floating-point math operations or due to
the compiler mis-compiling the code. That is not always obvious.
Tests for programs in the tools folder
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The ``unittest/tools`` folder contains tests for programs in the
``tools`` folder. This currently only contains tests for the LAMMPS
shell, which are implemented as a python scripts using the ``unittest``
Python module and launching the tool commands through the ``subprocess``
Python module.

View File

@ -9,14 +9,29 @@ reading or writing to files with error checking or translation of
strings into specific types of numbers with checking for validity. This strings into specific types of numbers with checking for validity. This
reduces redundant implementations and encourages consistent behavior. reduces redundant implementations and encourages consistent behavior.
I/O with status check I/O with status check and similar functions
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These are wrappers around the corresponding C library calls like The the first two functions are wrappers around the corresponding C
``fgets()`` or ``fread()``. They will check if there were errors library calls ``fgets()`` or ``fread()``. They will check if there
on reading or an unexpected end-of-file state was reached. In that were errors on reading or an unexpected end-of-file state was reached.
case, the functions will stop the calculation with an error message, In that case, the functions will stop with an error message, indicating
indicating the name of the problematic file, if possible. the name of the problematic file, if possible unless the *error* argument
is a NULL pointer.
The :cpp:func:`fgets_trunc` function will work similar for ``fgets()``
but it will read in a whole line (i.e. until the end of line or end
of file), but store only as many characters as will fit into the buffer
including a final newline character and the terminating NULL byte.
If the line in the file is longer it will thus be truncated in the buffer.
This function is used by :cpp:func:`read_lines_from_file` to read individual
lines but make certain they follow the size constraints.
The :cpp:func:`read_lines_from_file` function will read the requested
number of lines of a maximum length into a buffer and will return 0
if successful or 1 if not. It also guarantees that all lines are
terminated with a newline character and the entire buffer with a
NULL character.
---------- ----------
@ -26,6 +41,12 @@ indicating the name of the problematic file, if possible.
.. doxygenfunction:: sfread .. doxygenfunction:: sfread
:project: progguide :project: progguide
.. doxygenfunction:: fgets_trunc
:project: progguide
.. doxygenfunction:: read_lines_from_file
:project: progguide
---------- ----------
String to number conversions with validity check String to number conversions with validity check
@ -71,12 +92,21 @@ and parsing files or arguments.
---------- ----------
.. doxygenfunction:: strdup
:project: progguide
.. doxygenfunction:: trim .. doxygenfunction:: trim
:project: progguide :project: progguide
.. doxygenfunction:: trim_comment .. doxygenfunction:: trim_comment
:project: progguide :project: progguide
.. doxygenfunction:: has_utf8
:project: progguide
.. doxygenfunction:: utf8_subst
:project: progguide
.. doxygenfunction:: count_words(const char *text) .. doxygenfunction:: count_words(const char *text)
:project: progguide :project: progguide
@ -92,9 +122,15 @@ and parsing files or arguments.
.. doxygenfunction:: split_words .. doxygenfunction:: split_words
:project: progguide :project: progguide
.. doxygenfunction:: split_lines
:project: progguide
.. doxygenfunction:: strmatch .. doxygenfunction:: strmatch
:project: progguide :project: progguide
.. doxygenfunction:: strfind
:project: progguide
.. doxygenfunction:: is_integer .. doxygenfunction:: is_integer
:project: progguide :project: progguide
@ -149,7 +185,10 @@ Argument processing
Convenience functions Convenience functions
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: logmesg .. doxygenfunction:: logmesg(LAMMPS *lmp, const S &format, Args&&... args)
:project: progguide
.. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &mesg)
:project: progguide :project: progguide
.. doxygenfunction:: getsyserror .. doxygenfunction:: getsyserror
@ -286,6 +325,50 @@ This code example should produce the following output:
---------- ----------
Argument parsing classes
---------------------------
The purpose of argument parsing classes it to simplify and unify how
arguments of commands in LAMMPS are parsed and to make abstractions of
repetitive tasks.
The :cpp:class:`LAMMPS_NS::ArgInfo` class provides an abstraction
for parsing references to compute or fix styles or variables. These
would start with a "c\_", "f\_", "v\_" followed by the ID or name of
than instance and may be postfixed with one or two array indices
"[<number>]" with numbers > 0.
A typical code segment would look like this:
.. code-block:: C++
:caption: Usage example for ArgInfo class
int nvalues = 0;
for (iarg = 0; iarg < nargnew; iarg++) {
ArgInfo argi(arg[iarg]);
which[nvalues] = argi.get_type();
argindex[nvalues] = argi.get_index1();
ids[nvalues] = argi.copy_name();
if ((which[nvalues] == ArgInfo::UNKNOWN)
|| (which[nvalues] == ArgInfo::NONE)
|| (argi.get_dim() > 1))
error->all(FLERR,"Illegal compute XXX command");
nvalues++;
}
----------
.. doxygenclass:: LAMMPS_NS::ArgInfo
:project: progguide
:members:
----------
File reader classes File reader classes
------------------- -------------------

View File

@ -59,7 +59,7 @@ of each timestep. First of all, implement a constructor:
} }
In the constructor you should parse your fix arguments which are In the constructor you should parse your fix arguments which are
specified in the script. All fixes have pretty the same syntax: specified in the script. All fixes have pretty much the same syntax:
``fix <fix-ID> <fix group> <fix name> <fix arguments ...>``. The ``fix <fix-ID> <fix group> <fix name> <fix arguments ...>``. The
first 3 parameters are parsed by Fix base class constructor, while first 3 parameters are parsed by Fix base class constructor, while
``<fix arguments>`` should be parsed by you. In our case, we need to ``<fix arguments>`` should be parsed by you. In our case, we need to

View File

@ -5,8 +5,8 @@ If you are confident that you have found a bug in LAMMPS, please follow
the steps outlined below: the steps outlined below:
* Check the `New features and bug fixes * Check the `New features and bug fixes
<https://lammps.sandia.gov/bug.html>`_ section of the `LAMMPS WWW site <https://www.lammps.org/bug.html>`_ section of the `LAMMPS WWW site
<https://lammps.sandia.gov>`_ or the <https://www.lammps.org>`_ or the
`GitHub Releases page <https://github.com/lammps/lammps/releases>`_ to `GitHub Releases page <https://github.com/lammps/lammps/releases>`_ to
see if the bug has already been addressed in a patch release. see if the bug has already been addressed in a patch release.
* Check that your issue can be reproduced with the latest development * Check that your issue can be reproduced with the latest development
@ -17,7 +17,7 @@ the steps outlined below:
if your issue has already been reported and if it is still open. if your issue has already been reported and if it is still open.
* Check the `GitHub Pull Requests page <https://github.com/lammps/lammps/pulls>`_ * Check the `GitHub Pull Requests page <https://github.com/lammps/lammps/pulls>`_
to see if there is already a fix for your bug pending. to see if there is already a fix for your bug pending.
* Check the `mailing list archives <https://lammps.sandia.gov/mail.html>`_ * Check the `mailing list archives <https://www.lammps.org/mail.html>`_
to see if the issue has been discussed before. to see if the issue has been discussed before.
If none of these steps yields any useful information, please file a new If none of these steps yields any useful information, please file a new

View File

@ -39,7 +39,7 @@ figure out your physics or numerical mistakes, like choosing too big a
timestep, specifying erroneous force field coefficients, or putting 2 timestep, specifying erroneous force field coefficients, or putting 2
atoms on top of each other! If you run into errors that LAMMPS atoms on top of each other! If you run into errors that LAMMPS
does not catch that you think it should flag, please send an email to does not catch that you think it should flag, please send an email to
the `developers <https://lammps.sandia.gov/authors.html>`_. the `developers <https://www.lammps.org/authors.html>`_.
If you get an error message about an invalid command in your input If you get an error message about an invalid command in your input
script, you can determine what command is causing the problem by script, you can determine what command is causing the problem by

View File

@ -3871,7 +3871,7 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
*Fix orient/fcc found self twice* *Fix orient/fcc found self twice*
The neighbor lists used by fix orient/fcc are messed up. If this The neighbor lists used by fix orient/fcc are messed up. If this
error occurs, it is likely a bug, so send an email to the error occurs, it is likely a bug, so send an email to the
`developers <https://lammps.sandia.gov/authors.html>`_. `developers <https://www.lammps.org/authors.html>`_.
*Fix peri neigh does not exist* *Fix peri neigh does not exist*
Somehow a fix that the pair style defines has been deleted. Somehow a fix that the pair style defines has been deleted.

View File

@ -119,7 +119,6 @@ Doc page with :doc:`ERROR messages <Errors_messages>`
:doc:`pair style zero <pair_zero>` with a suitable cutoff or use :doc:`comm_modify cutoff <comm_modify>`. :doc:`pair style zero <pair_zero>` with a suitable cutoff or use :doc:`comm_modify cutoff <comm_modify>`.
*Communication cutoff is shorter than a bond length based estimate. This may lead to errors.* *Communication cutoff is shorter than a bond length based estimate. This may lead to errors.*
Since LAMMPS stores topology data with individual atoms, all atoms Since LAMMPS stores topology data with individual atoms, all atoms
comprising a bond, angle, dihedral or improper must be present on any comprising a bond, angle, dihedral or improper must be present on any
sub-domain that "owns" the atom with the information, either as a sub-domain that "owns" the atom with the information, either as a

View File

@ -18,7 +18,7 @@ files and image files.
If you uncomment the :doc:`dump <dump>` command in the input script, a If you uncomment the :doc:`dump <dump>` command in the input script, a
text dump file will be produced, which can be animated by various text dump file will be produced, which can be animated by various
`visualization programs <https://lammps.sandia.gov/viz.html>`_. `visualization programs <https://www.lammps.org/viz.html>`_.
If you uncomment the :doc:`dump image <dump>` command in the input If you uncomment the :doc:`dump image <dump>` command in the input
script, and assuming you have built LAMMPS with a JPG library, JPG script, and assuming you have built LAMMPS with a JPG library, JPG
@ -27,7 +27,7 @@ be quickly post-processed into a movie using commands described on the
:doc:`dump image <dump_image>` doc page. :doc:`dump image <dump_image>` doc page.
Animations of many of the examples can be viewed on the Movies section Animations of many of the examples can be viewed on the Movies section
of the `LAMMPS web site <https://lammps.sandia.gov/movies.html>`_. of the `LAMMPS web site <https://www.lammps.org/movies.html>`_.
There are two kinds of sub-directories in the examples folder. Lower There are two kinds of sub-directories in the examples folder. Lower
case named directories contain one or a few simple, quick-to-run case named directories contain one or a few simple, quick-to-run
@ -108,6 +108,8 @@ Lowercase directories
+-------------+------------------------------------------------------------------+ +-------------+------------------------------------------------------------------+
| msst | MSST shock dynamics | | msst | MSST shock dynamics |
+-------------+------------------------------------------------------------------+ +-------------+------------------------------------------------------------------+
| multi | multi neighboring for systems with large interaction disparities |
+-------------+------------------------------------------------------------------+
| nb3b | use of non-bonded 3-body harmonic pair style | | nb3b | use of non-bonded 3-body harmonic pair style |
+-------------+------------------------------------------------------------------+ +-------------+------------------------------------------------------------------+
| neb | nudged elastic band (NEB) calculation for barrier finding | | neb | nudged elastic band (NEB) calculation for barrier finding |
@ -164,7 +166,7 @@ Here is how you can run and visualize one of the sample problems:
Running the simulation produces the files *dump.indent* and Running the simulation produces the files *dump.indent* and
*log.lammps*\ . You can visualize the dump file of snapshots with a *log.lammps*\ . You can visualize the dump file of snapshots with a
variety of third-party tools highlighted on the variety of third-party tools highlighted on the
`Visualization <https://lammps.sandia.gov/viz.html>`_ page of the LAMMPS `Visualization <https://www.lammps.org/viz.html>`_ page of the LAMMPS
web site. web site.
If you uncomment the :doc:`dump image <dump_image>` line(s) in the input If you uncomment the :doc:`dump image <dump_image>` line(s) in the input

View File

@ -3,7 +3,7 @@ Howto discussions
These doc pages describe how to perform various tasks with LAMMPS, These doc pages describe how to perform various tasks with LAMMPS,
both for users and developers. The both for users and developers. The
`glossary <https://lammps.sandia.gov/glossary.html>`_ website page also lists MD `glossary <https://www.lammps.org/glossary.html>`_ website page also lists MD
terminology with links to corresponding LAMMPS manual pages. The terminology with links to corresponding LAMMPS manual pages. The
example input scripts included in the examples directory of the LAMMPS example input scripts included in the examples directory of the LAMMPS
distribution and highlighted on the :doc:`Examples <Examples>` doc page distribution and highlighted on the :doc:`Examples <Examples>` doc page
@ -23,6 +23,7 @@ General howto
Howto_library Howto_library
Howto_couple Howto_couple
Howto_client_server Howto_client_server
Howto_mdi
Settings howto Settings howto
============== ==============

View File

@ -91,6 +91,7 @@ documentation for the formula it computes.
* :doc:`bond_style <bond_harmonic>` harmonic * :doc:`bond_style <bond_harmonic>` harmonic
* :doc:`bond_style <bond_morse>` morse * :doc:`bond_style <bond_morse>` morse
* :doc:`angle_style <angle_cosine_squared>` cosine/squared
* :doc:`angle_style <angle_harmonic>` harmonic * :doc:`angle_style <angle_harmonic>` harmonic
* :doc:`angle_style <angle_cosine>` cosine * :doc:`angle_style <angle_cosine>` cosine
* :doc:`angle_style <angle_cosine_periodic>` cosine/periodic * :doc:`angle_style <angle_cosine_periodic>` cosine/periodic

View File

@ -296,6 +296,8 @@ Some common CMake variables
- Description - Description
* - ``CMAKE_INSTALL_PREFIX`` * - ``CMAKE_INSTALL_PREFIX``
- root directory of install location for ``make install`` (default: ``$HOME/.local``) - root directory of install location for ``make install`` (default: ``$HOME/.local``)
* - ``LAMMPS_INSTALL_RPATH``
- set or remove runtime path setting from binaries for ``make install`` (default: ``off``)
* - ``CMAKE_BUILD_TYPE`` * - ``CMAKE_BUILD_TYPE``
- controls compilation options: - controls compilation options:
one of ``RelWithDebInfo`` (default), ``Release``, ``Debug``, ``MinSizeRel`` one of ``RelWithDebInfo`` (default), ``Release``, ``Debug``, ``MinSizeRel``
@ -409,10 +411,10 @@ interface (``ccmake`` or ``cmake-gui``).
.. note:: .. note::
Using a preset to select a compiler package (``clang.cmake``, Using a preset to select a compiler package (``clang.cmake``,
``gcc.cmake``, or ``intel.cmake``) are an exception to the option ``gcc.cmake``, ``intel.cmake``, ``oneapi.cmake``, or ``pgi.cmake``)
of updating the configuration incrementally, as they will trigger are an exception to the mechanism of updating the configuration incrementally,
a reset of cached internal CMake settings and thus reset them to as they will trigger a reset of cached internal CMake settings and thus
their default values. reset settings to their default values.
Compilation and build targets Compilation and build targets
----------------------------- -----------------------------

View File

@ -42,10 +42,11 @@ screening. It may be necessary to use the *extra/special/per/atom*
keyword of the :doc:`read_data <read_data>` command. If using :doc:`fix shake <fix_shake>`, make sure no Drude particle is in this fix keyword of the :doc:`read_data <read_data>` command. If using :doc:`fix shake <fix_shake>`, make sure no Drude particle is in this fix
group. group.
There are two ways to thermostat the Drude particles at a low There are three ways to thermostat the Drude particles at a low
temperature: use either :doc:`fix langevin/drude <fix_langevin_drude>` temperature: use either :doc:`fix langevin/drude <fix_langevin_drude>`
for a Langevin thermostat, or :doc:`fix drude/transform/\* <fix_drude_transform>` for a Nose-Hoover for a Langevin thermostat, or :doc:`fix drude/transform/\* <fix_drude_transform>` for a Nose-Hoover
thermostat. The former requires use of the command :doc:`comm_modify vel yes <comm_modify>`. The latter requires two separate integration thermostat, or :doc:`fix tgnvt/drude <fix_tgnh_drude>` for a temperature-grouped Nose-Hoover thermostat.
The first and third require use of the command :doc:`comm_modify vel yes <comm_modify>`. The second requires two separate integration
fixes like *nvt* or *npt*\ . The correct temperatures of the reduced fixes like *nvt* or *npt*\ . The correct temperatures of the reduced
degrees of freedom can be calculated using the :doc:`compute temp/drude <compute_temp_drude>`. This requires also to use the degrees of freedom can be calculated using the :doc:`compute temp/drude <compute_temp_drude>`. This requires also to use the
command *comm_modify vel yes*. command *comm_modify vel yes*.

View File

@ -9,6 +9,8 @@ USER-DRUDE package activated. Then, the data file and input scripts
have to be modified to include the Drude dipoles and how to handle have to be modified to include the Drude dipoles and how to handle
them. them.
Example input scripts available: examples/USER/drude
---------- ----------
**Overview of Drude induced dipoles** **Overview of Drude induced dipoles**
@ -36,7 +38,7 @@ polarizability :math:`\alpha` by
Ideally, the mass of the Drude particle should be small, and the Ideally, the mass of the Drude particle should be small, and the
stiffness of the harmonic bond should be large, so that the Drude stiffness of the harmonic bond should be large, so that the Drude
particle remains close ot the core. The values of Drude mass, Drude particle remains close to the core. The values of Drude mass, Drude
charge, and force constant can be chosen following different charge, and force constant can be chosen following different
strategies, as in the following examples of polarizable force strategies, as in the following examples of polarizable force
fields: fields:
@ -221,6 +223,14 @@ modification of forces but no position/velocity updates), the fix
fix NVE all nve fix NVE all nve
To avoid the flying ice cube artifact, where the atoms progressively freeze and the
center of mass of the whole system drifts faster and faster, the *fix momentum*
can be used. For instance:
.. code-block:: LAMMPS
fix MOMENTUM all momentum 100 linear 1 1 1
Finally, do not forget to update the atom type elements if you use Finally, do not forget to update the atom type elements if you use
them in a *dump_modify ... element ...* command, by adding the element them in a *dump_modify ... element ...* command, by adding the element
type of the DPs. Here for instance type of the DPs. Here for instance
@ -376,14 +386,7 @@ For our phenol example, the groups would be defined as
Note that with the fixes *drude/transform*\ , it is not required to Note that with the fixes *drude/transform*\ , it is not required to
specify *comm_modify vel yes* because the fixes do it anyway (several specify *comm_modify vel yes* because the fixes do it anyway (several
times and for the forces also). To avoid the flying ice cube artifact times and for the forces also).
:ref:`(Lamoureux and Roux) <Lamoureux2>`, where the atoms progressively freeze and the
center of mass of the whole system drifts faster and faster, the *fix
momentum* can be used. For instance:
.. code-block:: LAMMPS
fix MOMENTUM all momentum 100 linear 1 1 1
It is a bit more tricky to run a NPT simulation with Nose-Hoover It is a bit more tricky to run a NPT simulation with Nose-Hoover
barostat and thermostat. First, the volume should be integrated only barostat and thermostat. First, the volume should be integrated only
@ -404,6 +407,31 @@ instructions for thermostatting and barostatting will look like
fix NVT DRUDES nvt temp 1. 1. 20 fix NVT DRUDES nvt temp 1. 1. 20
fix INVERSE all drude/transform/inverse fix INVERSE all drude/transform/inverse
Another option for thermalizing the Drude model is to use the
temperature-grouped Nose-Hoover (TGNH) thermostat proposed by :ref:`(Son) <TGNH-SON>`.
This is implemented as :doc:`fix tgnvt/drude <fix_tgnh_drude>` and :doc:`fix tgnpt/drude <fix_tgnh_drude>`.
It separates the kinetic energy into three contributions:
the molecular center of mass (COM) motion, the motion of atoms or atom-Drude pairs relative to molecular COMs,
and the relative motion of atom-Drude pairs.
An independent Nose-Hoover chain is applied to each type of motion.
When TGNH is used, the temperatures of molecular, atomic and Drude motion can be printed out with :doc:`thermo_style` command.
NVT simulation with TGNH thermostat
.. code-block:: LAMMPS
comm_modify vel yes
fix TGNVT all tgnvt/drude temp 300. 300. 100 1. 20
thermo_style custom f_TGNVT[1] f_TGNVT[2] f_TGNVT[3]
NPT simulation with TGNH thermostat
.. code-block:: LAMMPS
comm_modify vel yes
fix TGNPT all tgnpt/drude temp 300. 300. 100 1. 20 iso 1. 1. 500
thermo_style custom f_TGNPT[1] f_TGNPT[2] f_TGNPT[3]
---------- ----------
**Rigid bodies** **Rigid bodies**
@ -480,3 +508,7 @@ NPT ensemble using Nose-Hoover thermostat:
**(SWM4-NDP)** Lamoureux, Harder, Vorobyov, Roux, MacKerell, Chem Phys **(SWM4-NDP)** Lamoureux, Harder, Vorobyov, Roux, MacKerell, Chem Phys
Let, 418, 245-249 (2006) Let, 418, 245-249 (2006)
.. _TGNH-Son:
**(Son)** Son, McDaniel, Cui and Yethiraj, J Phys Chem Lett, 10, 7523 (2019).

View File

@ -72,7 +72,7 @@ explained in more detail here: `feature branch workflow <https://www.atlassian.c
**Feature branches** **Feature branches**
First of all, create a clone of your version on github on your local First of all, create a clone of your version on GitHub on your local
machine via HTTPS: machine via HTTPS:
.. code-block:: bash .. code-block:: bash
@ -155,7 +155,7 @@ useful message that explains the change.
.. code-block:: bash .. code-block:: bash
$ git commit -m 'Finally updated the github tutorial' $ git commit -m 'Finally updated the GitHub tutorial'
After the commit, the changes can be pushed to the same branch on GitHub: After the commit, the changes can be pushed to the same branch on GitHub:

View File

@ -18,12 +18,13 @@ This compute
calculates rotational kinetic energy which can be :doc:`output with thermodynamic info <Howto_output>`. calculates rotational kinetic energy which can be :doc:`output with thermodynamic info <Howto_output>`.
Use one of these 3 pair potentials, which compute forces and torques Use one of these 4 pair potentials, which compute forces and torques
between interacting pairs of particles: between interacting pairs of particles:
* :doc:`pair_style <pair_style>` gran/history * :doc:`pair_style gran/history <pair_gran>`
* :doc:`pair_style <pair_style>` gran/no_history * :doc:`pair_style gran/no_history <pair_gran>`
* :doc:`pair_style <pair_style>` gran/hertzian * :doc:`pair_style gran/hertzian <pair_gran>`
* :doc:`pair_style granular <pair_granular>`
These commands implement fix options specific to granular systems: These commands implement fix options specific to granular systems:
@ -31,6 +32,7 @@ These commands implement fix options specific to granular systems:
* :doc:`fix pour <fix_pour>` * :doc:`fix pour <fix_pour>`
* :doc:`fix viscous <fix_viscous>` * :doc:`fix viscous <fix_viscous>`
* :doc:`fix wall/gran <fix_wall_gran>` * :doc:`fix wall/gran <fix_wall_gran>`
* :doc:`fix wall/gran/region <fix_wall_gran_region>`
The fix style *freeze* zeroes both the force and torque of frozen The fix style *freeze* zeroes both the force and torque of frozen
atoms, and should be used for granular system instead of the fix style atoms, and should be used for granular system instead of the fix style

132
doc/src/Howto_mdi.rst Normal file
View File

@ -0,0 +1,132 @@
Using LAMMPS with the MDI library for code coupling
===================================================
.. note::
This Howto doc page will eventually replace the
:doc:`Howto client/server <Howto_client_server>` doc page.
Client/server coupling of two codes is where one code is the "client"
and sends request messages (data) to a "server" code. The server
responds to each request with a reply message. This enables the two
codes to work in tandem to perform a simulation. LAMMPS can act as
either a client or server code; it does this by using the `MolSSI
Driver Interface (MDI) library
<https://molssi-mdi.github.io/MDI_Library/html/index.html>`_,
developed by the `Molecular Sciences Software Institute (MolSSI)
<https://molssi.org>`_.
Alternate methods for code coupling with LAMMPS are described on the
:doc:`Howto couple <Howto_couple>` doc page.
Some advantages of client/server coupling are that the two codes can run
as stand-alone executables; they need not be linked together. Thus
neither code needs to have a library interface. This also makes it easy
to run the two codes on different numbers of processors. If a message
protocol (format and content) is defined for a particular kind of
simulation, then in principle any code which implements the client-side
protocol can be used in tandem with any code which implements the
server-side protocol. Neither code needs to know what specific other
code it is working with.
In MDI nomenclature, a client code is the "driver", and a server code is
an "engine". One driver code can communicate with one or more instances
of one or more engine codes. Driver and engine codes can be written in
any language: C, C++, Fortran, Python, etc.
In addition to allowing driver and engine(s) running to run as
stand-alone executables, MDI also enables a server code to be a
"plugin" to the client code. In this scenario, server code(s) are
compiled as shared libraries, and one (or more) instances of the
server are instantiated by the driver code. If the driver code runs
in parallel, it can split its MPI communicator into multiple
sub-communicators, and launch each plugin engine instance on a
sub-communicator. Driver processors in that sub-communicator exchange
messages with that engine instance, and can also send MPI messages to
other processors in the driver. The driver code can also destroy
engine instances and re-instantiate them.
The way that a driver communicates with an engine is by making
MDI_Send() and MDI_Recv() calls, which are conceptually similar to
MPI_Send() and MPI_Recv() calls. Each send or receive has a string
which identifies the command name, and optionally some data, which can
be a single value or vector of values of any data type. Inside the
MDI library, data is exchanged between the driver and engine via MPI
calls or sockets. This a run-time choice by the user.
-------------
As an example, LAMMPS and the ``pw.x`` command from Quantum Espresso (a
suite of quantum DFT codes), can work together via the MDI library to
perform an ab initio MD (AIMD) simulation, where LAMMPS runs an MD
simulation and sends a message each timestep to ``pw.x`` asking it to
compute quantum forces on the current configuration of atoms. Here is
how the 2 codes are launched to communicate by MPI:
.. code-block:: bash
% mpirun -np 2 lmp_mpi -mdi "-role DRIVER -name d -method MPI" \
-in in.aimd : -np 16 pw.x -in qe.in -mdi "-role ENGINE -name e -method MPI"
In this case LAMMPS runs on 2 processors (MPI tasks), ``pw.x`` runs on 16
processors.
Here is how the 2 codes are launched to communicate by sockets:
.. code-block:: bash
% mpirun -np 2 lmp_mpi -mdi "-role DRIVER -name d -method TCP -port 8021" -in in.aimd
% mpirun -np 16 pw.x -in qe.in -mdi "-role ENGINE -name e -method TCP -port 8021 -hostname localhost"
These commands could be issued in different windows on a desktop
machine. Or in the same window, if the first command is ended with
"&" so as to run in the background. If "localhost" is replaced by an
IP address, ``pw.x`` could be run on another machine on the same network, or
even on another machine across the country.
After both codes initialize themselves to model the same system, this is
what occurs each timestep:
* LAMMPS send a ">COORDS" message to ``pw.x`` with a 3*N vector of current atom coords
* ``pw.x`` receives the message/coords and computes quantum forces on all the atoms
* LAMMPS send a "<FORCES" message to ``pw.x`` and waits for the result
* ``pw.x`` receives the message (after its computation finishes) and sends a 3*N vector of forces
* LAMMPS receives the forces and time integrates to complete a single timestep
-------------
Examples scripts for using LAMMPS as an MDI engine are in the
examples/mdi directory. See the README file in that directory for
instructions on how to run the examples.
.. note::
Work is underway to add commands that allow LAMMPS to be used as an
MDI driver, e.g. for the AIMD example discussed above. Example
scripts for this usage mode will be added the same directory when
available.
If LAMMPS is used as a stand-alone engine it should set up the system
it will be modeling in its input script, then invoke the
:doc:`mdi/engine <mdi_engine>` command. This will put LAMMPS into
"engine mode" where it waits for messages and data from the driver.
When the driver sends an "EXIT" command, LAMMPS will exit engine mode
and the input script will continue.
If LAMMPS is used as a plugin engine it operates the same way, except
that the driver will pass LAMMPS an input script to initialize itself.
Upon receiving the "EXIT" command, LAMMPS will exit engine mode and the
input script will continue. After finishing execution of the input
script, the instance of LAMMPS will be destroyed.
LAMMPS supports the full set of MD-appropriate engine commands defined
by the MDI library. See the :doc:`mdi/engine <mdi_engine>` doc page for
a list of these.
If those commands are not sufficient for a user-developed driver to use
LAMMPS as an engine, then new commands can be easily added. See these
two files which implement the definition of MDI commands and the logic
for responding to them:
* src/MDI/mdi_engine.cpp
* src/MDI/fix_mdi_engine.cpp

View File

@ -9,8 +9,8 @@ Overview
``PyLammps`` is a Python wrapper class for LAMMPS which can be created ``PyLammps`` is a Python wrapper class for LAMMPS which can be created
on its own or use an existing lammps Python object. It creates a simpler, on its own or use an existing lammps Python object. It creates a simpler,
more "pythonic" interface to common LAMMPS functionality, in contrast to more "pythonic" interface to common LAMMPS functionality, in contrast to
the ``lammps.py`` wrapper for the C-style LAMMPS library interface which the ``lammps`` wrapper for the C-style LAMMPS library interface which
is written using `Python ctypes <ctypes_>`_. The ``lammps.py`` wrapper is written using `Python ctypes <ctypes_>`_. The ``lammps`` wrapper
is discussed on the :doc:`Python_head` doc page. is discussed on the :doc:`Python_head` doc page.
Unlike the flat ``ctypes`` interface, PyLammps exposes a discoverable Unlike the flat ``ctypes`` interface, PyLammps exposes a discoverable

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