Compare commits
149 Commits
stable_23J
...
stable_23J
| Author | SHA1 | Date | |
|---|---|---|---|
| 59e8b9370f | |||
| 39fa2021e2 | |||
| 83f492a195 | |||
| 933457acbe | |||
| 06f4099566 | |||
| 5624a78b17 | |||
| 47e875142f | |||
| 62c844d5ac | |||
| 263b6d4d6f | |||
| 4acca38a65 | |||
| 4cf642b526 | |||
| 52fc8f05ee | |||
| 047df9aa9e | |||
| fb3bd20dff | |||
| c7d62c4709 | |||
| b18008c58d | |||
| 9469321e3d | |||
| a4a9efeefc | |||
| 70744f10e0 | |||
| 9bea55bd77 | |||
| 73525b3bbc | |||
| 9cf67699cc | |||
| 666fe4cfbe | |||
| ed7bd50500 | |||
| d241e26d03 | |||
| 73e7163ed6 | |||
| 5a5a86684a | |||
| ae3f57e89a | |||
| fff7b2a859 | |||
| 83ba1c9d20 | |||
| ce10614cab | |||
| facbeac052 | |||
| 188ee5af15 | |||
| f176b8b14c | |||
| 2396b2feea | |||
| 4399c1b6c1 | |||
| fd046c8fd8 | |||
| 09b7694601 | |||
| df20503434 | |||
| f4aa24a36a | |||
| 007c04bc97 | |||
| 418d1e16e1 | |||
| 6471d781d0 | |||
| 97ddc5917c | |||
| a95ff20647 | |||
| 9e0a9e2601 | |||
| 8b34d65970 | |||
| 0a1c2bcccc | |||
| c9442c591c | |||
| b7d316031d | |||
| 361e9f3ea5 | |||
| 28120793b8 | |||
| f32ce8377e | |||
| 9021b8bc6a | |||
| 838fe3020d | |||
| b4d4dcbcbc | |||
| 52a892ec46 | |||
| 0ee3d9da5d | |||
| 50afb292b0 | |||
| 275ef9da17 | |||
| b6a87390a3 | |||
| 72178631c5 | |||
| f8859c5fca | |||
| 979119a29b | |||
| bc66572275 | |||
| 609231675f | |||
| d9675b5da4 | |||
| 7d32b4f42a | |||
| 697e5b15ec | |||
| ade0718c11 | |||
| 31033ff6e0 | |||
| 9a598ba5a8 | |||
| ff20448b1d | |||
| af5229ba58 | |||
| b180200c48 | |||
| 27441cf2ea | |||
| db61bf609b | |||
| 015fa4cb0a | |||
| 62f6f91146 | |||
| e163b0b1d7 | |||
| 169a886898 | |||
| cbd276c49d | |||
| 183c6c06ff | |||
| 93a46da58e | |||
| 6b6a47bd3c | |||
| 4a0a98a0fd | |||
| 369ea4fd26 | |||
| d63c002bf5 | |||
| e931d3153b | |||
| 2913c063d4 | |||
| 5606b57646 | |||
| 0fafe34008 | |||
| a9a1640d67 | |||
| 812363fb99 | |||
| b40e0be1c9 | |||
| 1be973da07 | |||
| aca2c52795 | |||
| 536b2ab7e5 | |||
| ccef293161 | |||
| 4b0de87813 | |||
| fa22aef31b | |||
| cb7544a615 | |||
| a9be4906b7 | |||
| 6f36d21a04 | |||
| c55a15c4dc | |||
| 8f01dad1a9 | |||
| db6e1aa20d | |||
| 3cee69a077 | |||
| 69ffe71595 | |||
| 16fa033111 | |||
| 8e494aa771 | |||
| d203cce8b5 | |||
| f8de1b1a75 | |||
| de89a25a25 | |||
| f982e95267 | |||
| 293d0cdb58 | |||
| 011f2651ee | |||
| a8d3c43a77 | |||
| c19641f8b3 | |||
| 6596b343ff | |||
| b6dbb0330c | |||
| 0dd138666a | |||
| 33b9fec150 | |||
| 32b020a165 | |||
| c1db230331 | |||
| 254c052ecc | |||
| 8e889dfa7c | |||
| 5b6a52a646 | |||
| 55f56deb63 | |||
| bfe127a720 | |||
| d95c8911a3 | |||
| 0380f9d854 | |||
| 71b1d60363 | |||
| 8b1f92fabd | |||
| 419af0cf28 | |||
| 9030c59932 | |||
| ee88078150 | |||
| 04451f6072 | |||
| 2364f7f08b | |||
| 7f82a58f51 | |||
| 1caf074ba1 | |||
| 34677f78c2 | |||
| e095609ac6 | |||
| 1122408957 | |||
| 5f9b78ca01 | |||
| fe138fc75c | |||
| 31c324ff61 | |||
| 30564ed8b7 | |||
| f05bfe45a8 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3,6 +3,7 @@
|
||||
.github export-ignore
|
||||
.lgtm.yml export-ignore
|
||||
SECURITY.md export-ignore
|
||||
CITATION.cff export-ignore
|
||||
* text=auto
|
||||
*.jpg -text
|
||||
*.pdf -text
|
||||
|
||||
66
.github/CODEOWNERS
vendored
66
.github/CODEOWNERS
vendored
@ -13,39 +13,44 @@ lib/kim/* @ellio167
|
||||
lib/mesont/* @iafoss
|
||||
|
||||
# whole packages
|
||||
src/COMPRESS/* @rbberger
|
||||
src/GPU/* @ndtrung81
|
||||
src/KOKKOS/* @stanmoore1
|
||||
src/KIM/* @ellio167
|
||||
src/LATTE/* @cnegre
|
||||
src/MESSAGE/* @sjplimp
|
||||
src/MLIAP/* @athomps
|
||||
src/SNAP/* @athomps
|
||||
src/SPIN/* @julient31
|
||||
src/ADIOS/* @pnorbert
|
||||
src/AMOEBA/* @sjplimp
|
||||
src/BPM/* @jtclemm
|
||||
src/BROWNIAN/* @samueljmcameron
|
||||
src/CG-DNA/* @ohenrich
|
||||
src/CG-SDK/* @akohlmey
|
||||
src/CG-SDK/* @yskmiyazaki
|
||||
src/COLVARS/* @giacomofiorin
|
||||
src/COMPRESS/* @rbberger
|
||||
src/DIELECTRIC/* @ndtrung81
|
||||
src/ELECTRODE/* @ludwig-ahrens
|
||||
src/FEP/* @agiliopadua
|
||||
src/ML-HDNNP/* @singraber
|
||||
src/GPU/* @ndtrung81
|
||||
src/GRANULAR/* @jtclemm @dsbolin
|
||||
src/INTEL/* @wmbrownintel
|
||||
src/KIM/* @ellio167
|
||||
src/KOKKOS/* @stanmoore1
|
||||
src/LATTE/* @cnegre
|
||||
src/MANIFOLD/* @Pakketeretet2
|
||||
src/MDI/* @taylor-a-barnes
|
||||
src/MDI/* @taylor-a-barnes @sjplimp
|
||||
src/MEAM/* @martok
|
||||
src/MESONT/* @iafoss
|
||||
src/ML-HDNNP/* @singraber
|
||||
src/ML-IAP/* @athomps
|
||||
src/ML-PACE/* @yury-lysogorskiy
|
||||
src/MOFFF/* @hheenen
|
||||
src/MOLFILE/* @akohlmey
|
||||
src/NETCDF/* @pastewka
|
||||
src/ML-PACE/* @yury-lysogorskiy
|
||||
src/PLUMED/* @gtribello
|
||||
src/PHONON/* @lingtikong
|
||||
src/PTM/* @pmla
|
||||
src/OPENMP/* @akohlmey
|
||||
src/PHONON/* @lingtikong
|
||||
src/PLUGIN/* @akohlmey
|
||||
src/PLUMED/* @gtribello
|
||||
src/PTM/* @pmla
|
||||
src/QMMM/* @akohlmey
|
||||
src/REAXFF/* @hasanmetin @stanmoore1
|
||||
src/REACTION/* @jrgissing
|
||||
src/REAXFF/* @hasanmetin @stanmoore1
|
||||
src/SCAFACOS/* @rhalver
|
||||
src/SNAP/* @athomps
|
||||
src/SPIN/* @julient31
|
||||
src/TALLY/* @akohlmey
|
||||
src/UEF/* @danicholson
|
||||
src/VTK/* @rbberger
|
||||
@ -119,26 +124,32 @@ src/dump_movie.* @akohlmey
|
||||
src/exceptions.h @rbberger
|
||||
src/fix_nh.* @athomps
|
||||
src/info.* @akohlmey @rbberger
|
||||
src/timer.* @akohlmey
|
||||
src/min* @sjplimp @stanmoore1
|
||||
src/platform.* @akohlmey
|
||||
src/timer.* @akohlmey
|
||||
src/utils.* @akohlmey @rbberger
|
||||
src/verlet.* @sjplimp @stanmoore1
|
||||
src/math_eigen_impl.h @jewettaij
|
||||
|
||||
# tools
|
||||
tools/msi2lmp/* @akohlmey
|
||||
tools/coding_standard/* @akohlmey @rbberger
|
||||
tools/emacs/* @HaoZeke
|
||||
tools/singularity/* @akohlmey @rbberger
|
||||
tools/coding_standard/* @rbberger
|
||||
tools/valgrind/* @akohlmey
|
||||
tools/swig/* @akohlmey
|
||||
tools/lammps-shell/* @akohlmey
|
||||
tools/msi2lmp/* @akohlmey
|
||||
tools/offline/* @rbberger
|
||||
tools/singularity/* @akohlmey @rbberger
|
||||
tools/swig/* @akohlmey
|
||||
tools/valgrind/* @akohlmey
|
||||
tools/vim/* @hammondkd
|
||||
|
||||
# tests
|
||||
unittest/* @akohlmey @rbberger
|
||||
unittest/* @akohlmey
|
||||
|
||||
# cmake
|
||||
cmake/* @junghans @rbberger
|
||||
cmake/Modules/LAMMPSInterfacePlugin.cmake @akohlmey
|
||||
cmake/Modules/MPI4WIN.cmake @akohlmey
|
||||
cmake/Modules/OpenCLLoader.cmake @akohlmey
|
||||
cmake/Modules/Packages/COLVARS.cmake @junghans @rbberger @giacomofiorin
|
||||
cmake/Modules/Packages/KIM.cmake @junghans @rbberger @ellio167
|
||||
cmake/presets/*.cmake @akohlmey
|
||||
@ -147,13 +158,12 @@ cmake/presets/*.cmake @akohlmey
|
||||
python/* @rbberger
|
||||
|
||||
# fortran
|
||||
fortran/* @akohlmey
|
||||
fortran/* @akohlmey @hammondkd
|
||||
|
||||
# docs
|
||||
doc/utils/*/* @rbberger
|
||||
doc/Makefile @rbberger
|
||||
doc/README @rbberger
|
||||
doc/* @akohlmey
|
||||
examples/plugin/* @akohlmey
|
||||
examples/PACKAGES/pace/plugin/* @akohlmey
|
||||
|
||||
# for releases
|
||||
src/version.h @sjplimp
|
||||
|
||||
7
.github/ISSUE_TEMPLATE/help_request.md
vendored
7
.github/ISSUE_TEMPLATE/help_request.md
vendored
@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Request for Help
|
||||
about: "Don't post help requests here, email the lammps-users mailing list"
|
||||
about: "Don't post help requests here, post in the LAMMPS forum"
|
||||
title: ""
|
||||
labels: invalid
|
||||
assignees: ''
|
||||
@ -8,8 +8,9 @@ assignees: ''
|
||||
---
|
||||
|
||||
Please **do not** post requests for help (e.g. with installing or using LAMMPS) here.
|
||||
Instead send an e-mail to the lammps-users mailing list.
|
||||
Instead, you can post to the LAMMPS category in the Materials Science Community
|
||||
Discourse forum at: https://matsci.org/lammps/
|
||||
|
||||
This issue tracker is for tracking LAMMPS development related issues only.
|
||||
|
||||
Thanks for your cooperation.
|
||||
Thank you in advance for your cooperation.
|
||||
|
||||
6
.github/codecov.yml
vendored
6
.github/codecov.yml
vendored
@ -7,7 +7,7 @@ coverage:
|
||||
threshold: 10%
|
||||
only_pulls: false
|
||||
branches:
|
||||
- "master"
|
||||
- "develop"
|
||||
flags:
|
||||
- "unit"
|
||||
paths:
|
||||
@ -16,14 +16,14 @@ coverage:
|
||||
project:
|
||||
default:
|
||||
branches:
|
||||
- "master"
|
||||
- "develop"
|
||||
paths:
|
||||
- "src"
|
||||
informational: true
|
||||
patch:
|
||||
default:
|
||||
branches:
|
||||
- "master"
|
||||
- "develop"
|
||||
paths:
|
||||
- "src"
|
||||
informational: true
|
||||
|
||||
14
.github/workflows/compile-msvc.yml
vendored
14
.github/workflows/compile-msvc.yml
vendored
@ -3,7 +3,11 @@ name: "Native Windows Compilation and Unit Tests"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
branches:
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
@ -22,15 +26,19 @@ jobs:
|
||||
- name: Select Python version
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m pip install numpy
|
||||
python3 -m pip install pyyaml
|
||||
nuget install MSMPIsdk
|
||||
nuget install MSMPIDIST
|
||||
cmake -C cmake/presets/windows.cmake \
|
||||
-D PKG_PYTHON=on \
|
||||
-D WITH_PNG=off \
|
||||
-D WITH_JPEG=off \
|
||||
-S cmake -B build \
|
||||
-D BUILD_SHARED_LIBS=on \
|
||||
-D LAMMPS_EXCEPTIONS=on \
|
||||
@ -46,4 +54,4 @@ jobs:
|
||||
- name: Run Unit Tests
|
||||
working-directory: build
|
||||
shell: bash
|
||||
run: ctest -V -C Release
|
||||
run: ctest -V -C Release -E FixTimestep:python_move_nve
|
||||
|
||||
7
.github/workflows/unittest-macos.yml
vendored
7
.github/workflows/unittest-macos.yml
vendored
@ -3,7 +3,11 @@ name: "Unittest for MacOS"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
branches:
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
@ -39,6 +43,7 @@ jobs:
|
||||
working-directory: build
|
||||
run: |
|
||||
ccache -z
|
||||
python3 -m pip install numpy
|
||||
python3 -m pip install pyyaml
|
||||
cmake -C ../cmake/presets/clang.cmake \
|
||||
-C ../cmake/presets/most.cmake \
|
||||
|
||||
91
CITATION.cff
Normal file
91
CITATION.cff
Normal file
@ -0,0 +1,91 @@
|
||||
# YAML 1.2
|
||||
---
|
||||
cff-version: 1.2.0
|
||||
title: "LAMMPS: Large-scale Atomic/Molecular Massively Parallel Simulator"
|
||||
type: software
|
||||
authors:
|
||||
- family-names: "Plimpton"
|
||||
given-names: "Steven J."
|
||||
- family-names: "Kohlmeyer"
|
||||
given-names: "Axel"
|
||||
orcid: "https://orcid.org/0000-0001-6204-6475"
|
||||
- family-names: "Thompson"
|
||||
given-names: "Aidan P."
|
||||
orcid: "https://orcid.org/0000-0002-0324-9114"
|
||||
- family-names: "Moore"
|
||||
given-names: "Stan G."
|
||||
- family-names: "Berger"
|
||||
given-names: "Richard"
|
||||
orcid: "https://orcid.org/0000-0002-3044-8266"
|
||||
doi: 10.5281/zenodo.3726416
|
||||
license: GPL-2.0-only
|
||||
url: https://www.lammps.org
|
||||
repository-code: https://github.com/lammps/lammps/
|
||||
keywords:
|
||||
- "Molecular Dynamics"
|
||||
- "Materials Modeling"
|
||||
message: "If you are referencing LAMMPS in a publication, please cite the paper below."
|
||||
preferred-citation:
|
||||
type: article
|
||||
doi: "10.1016/j.cpc.2021.108171"
|
||||
url: "https://www.sciencedirect.com/science/article/pii/S0010465521002836"
|
||||
authors:
|
||||
- family-names: "Thompson"
|
||||
given-names: "Aidan P."
|
||||
orcid: "https://orcid.org/0000-0002-0324-9114"
|
||||
- family-names: "Aktulga"
|
||||
given-names: "H. Metin"
|
||||
- family-names: "Berger"
|
||||
given-names: "Richard"
|
||||
orcid: "https://orcid.org/0000-0002-3044-8266"
|
||||
- family-names: "Bolintineanu"
|
||||
given-names: "Dan S."
|
||||
- family-names: "Brown"
|
||||
given-names: "W. Michael"
|
||||
- family-names: "Crozier"
|
||||
given-names: "Paul S."
|
||||
- family-names: "in 't Veld"
|
||||
given-names: "Pieter J."
|
||||
- family-names: "Kohlmeyer"
|
||||
given-names: "Axel"
|
||||
orcid: "https://orcid.org/0000-0001-6204-6475"
|
||||
- family-names: "Moore"
|
||||
given-names: "Stan G."
|
||||
- family-names: "Nguyen"
|
||||
given-names: "Trung Dac"
|
||||
- family-names: "Shan"
|
||||
given-names: "Ray"
|
||||
- family-names: "Stevens"
|
||||
given-names: "Mark J."
|
||||
- family-names: "Tranchida"
|
||||
given-names: "Julien"
|
||||
- family-names: "Trott"
|
||||
given-names: "Christian"
|
||||
- family-names: "Plimpton"
|
||||
given-names: "Steven J."
|
||||
title: "LAMMPS - a flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales"
|
||||
journal: "Computer Physics Communications"
|
||||
keywords:
|
||||
- Molecular dynamics
|
||||
- Materials modeling
|
||||
- Parallel algorithms
|
||||
- LAMMPS
|
||||
month: 2
|
||||
volume: 271
|
||||
issn: 0010-4655
|
||||
pages: 108171
|
||||
year: 2022
|
||||
references:
|
||||
- title: "Fast Parallel Algorithms for Short-Range Molecular Dynamics"
|
||||
type: article
|
||||
journal: Journal of Computational Physics
|
||||
volume: 117
|
||||
number: 1
|
||||
pages: "1-19"
|
||||
year: 1995
|
||||
issn: 0021-9991
|
||||
doi: 10.1006/jcph.1995.1039
|
||||
url: https://www.sciencedirect.com/science/article/pii/S002199918571039X
|
||||
authors:
|
||||
- family-names: "Plimpton"
|
||||
given-names: "Steve"
|
||||
4
README
4
README
@ -16,8 +16,8 @@ National Laboratories, a US Department of Energy facility, with
|
||||
funding from the DOE. It is an open-source code, distributed freely
|
||||
under the terms of the GNU Public License (GPL) version 2.
|
||||
|
||||
The primary author of the code is Steve Plimpton, who can be emailed
|
||||
at sjplimp@sandia.gov. The LAMMPS WWW Site at www.lammps.org has
|
||||
The code is maintained by the LAMMPS development team who can be emailed
|
||||
at developers@lammps.org. The LAMMPS WWW Site at www.lammps.org has
|
||||
more information about the code and its uses.
|
||||
|
||||
The LAMMPS distribution includes the following files and directories:
|
||||
|
||||
31
SECURITY.md
31
SECURITY.md
@ -14,14 +14,14 @@ 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
|
||||
kinds of file system 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).
|
||||
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).
|
||||
|
||||
To mitigate issues with using homoglyphs or bidirectional reordering in
|
||||
unicode, which have been demonstrated as a vector to obfuscate and hide
|
||||
@ -30,10 +30,19 @@ for unicode characters and only all-ASCII source code is accepted.
|
||||
|
||||
# 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.
|
||||
LAMMPS follows a continuous release development model. We aim to keep
|
||||
the development version (`develop` branch) always fully functional and
|
||||
employ a variety of automatic testing procedures to detect failures
|
||||
of existing functionality from adding or modifying features. Most of
|
||||
those tests are run on pull requests *before* merging to the `develop`
|
||||
branch. The `develop` branch is protected, so all changes *must* be
|
||||
submitted as a pull request and thus cannot avoid the automated tests.
|
||||
|
||||
Additional tests are run *after* merging. Before releases are made
|
||||
*all* tests must have cleared. Then a release tag is applied and the
|
||||
`release` branch is fast-forwarded to that tag. This is often referred
|
||||
to as a patch release. Bug fixes and updates are
|
||||
applied first to the `develop` branch. Later, they appear in the `release`
|
||||
branch when the next patch release occurs.
|
||||
For stable releases, selected bug fixes, updates, and new functionality
|
||||
are pushed to the `stable` branch and a new stable tag is applied.
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
# This file is part of LAMMPS
|
||||
# Created by Christoph Junghans and Richard Berger
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
########################################
|
||||
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
||||
if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
@ -16,6 +17,17 @@ endif()
|
||||
if(POLICY CMP0109)
|
||||
cmake_policy(SET CMP0109 OLD)
|
||||
endif()
|
||||
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
|
||||
if(POLICY CMP0135)
|
||||
cmake_policy(SET CMP0135 OLD)
|
||||
endif()
|
||||
########################################
|
||||
# Use CONFIGURE_DEPENDS as option for file(GLOB...) when available
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
unset(CONFIGURE_DEPENDS)
|
||||
else()
|
||||
set(CONFIGURE_DEPENDS CONFIGURE_DEPENDS)
|
||||
endif()
|
||||
########################################
|
||||
|
||||
project(lammps CXX)
|
||||
@ -104,7 +116,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
|
||||
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
|
||||
else()
|
||||
set(CMAKE_TUNE_DEFAULT "-xHost")
|
||||
set(CMAKE_TUNE_DEFAULT "-xHost -fp-model fast=2 -no-prec-div -qoverride-limits -diag-disable=10441 -diag-disable=2196")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -139,13 +151,11 @@ set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
||||
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
||||
# and prints lots of pointless warnings about "unsafe" functions
|
||||
if(MSVC)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel"))
|
||||
add_compile_options(/Zc:__cplusplus)
|
||||
add_compile_options(/wd4244)
|
||||
add_compile_options(/wd4267)
|
||||
if(LAMMPS_EXCEPTIONS)
|
||||
add_compile_options(/EHsc)
|
||||
endif()
|
||||
add_compile_options(/EHsc)
|
||||
endif()
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
@ -158,6 +168,19 @@ endif()
|
||||
########################################################################
|
||||
# User input options #
|
||||
########################################################################
|
||||
# set path to python interpreter and thus enforcing python version when
|
||||
# in a virtual environment and PYTHON_EXECUTABLE is not set on command line
|
||||
if(DEFINED ENV{VIRTUAL_ENV} AND NOT PYTHON_EXECUTABLE)
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(PYTHON_EXECUTABLE "$ENV{VIRTUAL_ENV}/Scripts/python.exe")
|
||||
else()
|
||||
set(PYTHON_EXECUTABLE "$ENV{VIRTUAL_ENV}/bin/python")
|
||||
endif()
|
||||
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
||||
message(STATUS "Running in virtual environment: $ENV{VIRTUAL_ENV}\n"
|
||||
" Setting Python interpreter to: ${PYTHON_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
||||
mark_as_advanced(LAMMPS_MACHINE)
|
||||
if(LAMMPS_MACHINE)
|
||||
@ -179,8 +202,8 @@ else()
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(GLOB ALL_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||
file(GLOB MAIN_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||
file(GLOB ALL_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||
file(GLOB MAIN_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
||||
add_library(lammps ${ALL_SOURCES})
|
||||
|
||||
@ -299,6 +322,15 @@ if(PKG_ADIOS)
|
||||
# script that defines the MPI::MPI_C target
|
||||
enable_language(C)
|
||||
find_package(ADIOS2 REQUIRED)
|
||||
if(BUILD_MPI)
|
||||
if(NOT ADIOS2_HAVE_MPI)
|
||||
message(FATAL_ERROR "ADIOS2 must be built with MPI support when LAMMPS has MPI enabled")
|
||||
endif()
|
||||
else()
|
||||
if(ADIOS2_HAVE_MPI)
|
||||
message(FATAL_ERROR "ADIOS2 must be built without MPI support when LAMMPS has MPI disabled")
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE adios2::adios2)
|
||||
endif()
|
||||
|
||||
@ -367,6 +399,7 @@ pkg_depends(DIELECTRIC EXTRA-PAIR)
|
||||
pkg_depends(CG-DNA MOLECULE)
|
||||
pkg_depends(CG-DNA ASPHERE)
|
||||
pkg_depends(ELECTRODE KSPACE)
|
||||
pkg_depends(EXTRA-MOLECULE MOLECULE)
|
||||
|
||||
# detect if we may enable OpenMP support by default
|
||||
set(BUILD_OMP_DEFAULT OFF)
|
||||
@ -414,8 +447,8 @@ if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE OR PKG_ELECTRODE
|
||||
status(FATAL_ERROR "Cannot build internal linear algebra library as CMake build tool lacks Fortran support")
|
||||
endif()
|
||||
enable_language(Fortran)
|
||||
file(GLOB LAPACK_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.[fF])
|
||||
add_library(linalg STATIC ${LAPACK_SOURCES})
|
||||
file(GLOB LINALG_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.[fF])
|
||||
add_library(linalg STATIC ${LINALG_SOURCES})
|
||||
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
||||
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||
@ -543,8 +576,8 @@ endforeach()
|
||||
foreach(PKG ${STANDARD_PACKAGES})
|
||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||
|
||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||
file(GLOB ${PKG}_SOURCES ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||
file(GLOB ${PKG}_HEADERS ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||
|
||||
# check for package files in src directory due to old make system
|
||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||
@ -571,8 +604,8 @@ endforeach()
|
||||
foreach(PKG ${SUFFIX_PACKAGES})
|
||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||
|
||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||
file(GLOB ${PKG}_SOURCES ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||
file(GLOB ${PKG}_HEADERS ${CONFIGURE_DEPENDS} ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||
|
||||
# check for package files in src directory due to old make system
|
||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||
@ -588,10 +621,10 @@ foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT)
|
||||
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
||||
if(PKG_LIB STREQUAL "mesont")
|
||||
enable_language(Fortran)
|
||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.f90)
|
||||
else()
|
||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c
|
||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
||||
endif()
|
||||
@ -710,18 +743,17 @@ list(FIND LANGUAGES "Fortran" _index)
|
||||
if(_index GREATER -1)
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||
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
|
||||
input.h info.h kspace.h lammps.h lattice.h library.h lmppython.h lmptype.h memory.h modify.h neighbor.h neigh_list.h output.h
|
||||
pair.h pointers.h region.h timer.h universe.h update.h utils.h variable.h)
|
||||
if(LAMMPS_EXCEPTIONS)
|
||||
list(APPEND LAMMPS_CXX_HEADERS exceptions.h)
|
||||
endif()
|
||||
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h command.h compute.h dihedral.h domain.h
|
||||
error.h exceptions.h fix.h force.h group.h improper.h input.h info.h kspace.h lammps.h lattice.h
|
||||
library.h lmppython.h lmptype.h memory.h modify.h neighbor.h neigh_list.h output.h pair.h
|
||||
platform.h pointers.h region.h timer.h universe.h update.h utils.h variable.h)
|
||||
set(LAMMPS_FMT_HEADERS core.h format.h)
|
||||
|
||||
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
|
||||
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
||||
set_target_properties(lammps PROPERTIES PREFIX "lib")
|
||||
target_include_directories(lammps PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps>)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt)
|
||||
foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_SOURCE_DIR}/${_HEADER} ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} DEPENDS ${LAMMPS_SOURCE_DIR}/${_HEADER})
|
||||
add_custom_target(${_HEADER} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER})
|
||||
@ -730,6 +762,14 @@ foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
||||
install(FILES ${LAMMPS_SOURCE_DIR}/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(_HEADER ${LAMMPS_FMT_HEADERS})
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt/${_HEADER} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_SOURCE_DIR}/fmt/${_HEADER} ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt/${_HEADER} DEPENDS ${LAMMPS_SOURCE_DIR}/fmt/${_HEADER})
|
||||
add_custom_target(fmt_${_HEADER} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt/${_HEADER})
|
||||
add_dependencies(lammps fmt_${_HEADER})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(FILES ${LAMMPS_SOURCE_DIR}/fmt/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps/fmt)
|
||||
endif()
|
||||
endforeach()
|
||||
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>)
|
||||
add_library(LAMMPS::lammps ALIAS lammps)
|
||||
get_target_property(LAMMPS_DEFINES lammps INTERFACE_COMPILE_DEFINITIONS)
|
||||
@ -784,9 +824,13 @@ if(BUILD_SHARED_LIBS)
|
||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
||||
find_package(PythonInterp) # Deprecated since version 3.12
|
||||
if(PYTHONINTERP_FOUND)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
else()
|
||||
# backward compatibility
|
||||
if(PYTHON_EXECUTABLE)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
endif()
|
||||
if(BUILD_IS_MULTI_CONFIG)
|
||||
@ -819,16 +863,25 @@ endif()
|
||||
###############################################################################
|
||||
if(BUILD_SHARED_LIBS OR PKG_PYTHON)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
||||
find_package(PythonInterp) # Deprecated since version 3.12
|
||||
if(PYTHONINTERP_FOUND)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
else()
|
||||
# backward compatibility
|
||||
if(PYTHON_EXECUTABLE)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
endif()
|
||||
if(Python_EXECUTABLE)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python)
|
||||
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})")
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python/lib)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python/src)
|
||||
file(COPY ${LAMMPS_SOURCE_DIR}/version.h DESTINATION ${CMAKE_BINARY_DIR}/python/src)
|
||||
file(COPY ${LAMMPS_PYTHON_DIR}/README ${LAMMPS_PYTHON_DIR}/pyproject.toml ${LAMMPS_PYTHON_DIR}/setup.py ${LAMMPS_PYTHON_DIR}/lammps DESTINATION ${CMAKE_BINARY_DIR}/python/lib)
|
||||
install(CODE "if(\"\$ENV{DESTDIR}\" STREQUAL \"\")\n execute_process(COMMAND ${Python_EXECUTABLE} -m pip install -v ${CMAKE_BINARY_DIR}/python/lib --prefix=${CMAKE_INSTALL_PREFIX})\n else()\n execute_process(COMMAND ${Python_EXECUTABLE} -m pip install -v ${CMAKE_BINARY_DIR}/python/lib --prefix=${CMAKE_INSTALL_PREFIX} --root=\$ENV{DESTDIR})\n endif()")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -843,6 +896,23 @@ if(ClangFormat_FOUND)
|
||||
WORKING_DIRECTORY ${LAMMPS_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# extract Kokkos compilation settings
|
||||
get_cmake_property(_allvars VARIABLES)
|
||||
foreach(_var ${_allvars})
|
||||
if(${_var})
|
||||
string(REGEX MATCH "Kokkos_ENABLE_(SERIAL|THREADS|OPENMP|CUDA|HIP|SYCL|OPENMPTARGET|HPX)" _match ${_var})
|
||||
if(_match)
|
||||
string(REGEX REPLACE "Kokkos_ENABLE_(OPENMP|SERIAL|CUDA|HIP|SYCL)" "\\1" _match ${_var})
|
||||
list(APPEND KOKKOS_DEVICE ${_match})
|
||||
endif()
|
||||
string(REGEX MATCH "Kokkos_ARCH" _match ${_var})
|
||||
if(_match)
|
||||
string(REGEX REPLACE "Kokkos_ARCH_(.*)" "\\1" _match ${_var})
|
||||
list(APPEND KOKKOS_ARCH ${_match})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
|
||||
if(BUILD_IS_MULTI_CONFIG)
|
||||
set(LAMMPS_BUILD_TYPE "Multi-Config")
|
||||
@ -854,6 +924,7 @@ feature_summary(DESCRIPTION "The following tools and libraries have been found a
|
||||
message(STATUS "<<< Build configuration >>>
|
||||
LAMMPS Version: ${PROJECT_VERSION}
|
||||
Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
|
||||
CMake Version: ${CMAKE_VERSION}
|
||||
Build type: ${LAMMPS_BUILD_TYPE}
|
||||
Install path: ${CMAKE_INSTALL_PREFIX}
|
||||
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
||||
@ -940,7 +1011,10 @@ if(PKG_GPU)
|
||||
message(STATUS "GPU precision: ${GPU_PREC}")
|
||||
endif()
|
||||
if(PKG_KOKKOS)
|
||||
message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}")
|
||||
message(STATUS "Kokkos Devices: ${KOKKOS_DEVICE}")
|
||||
if(KOKKOS_ARCH)
|
||||
message(STATUS "Kokkos Architecture: ${KOKKOS_ARCH}")
|
||||
endif()
|
||||
endif()
|
||||
if(PKG_KSPACE)
|
||||
message(STATUS "<<< FFT settings >>>
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe -DBUILD_MPI=off",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||
@ -105,7 +105,7 @@
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe -DBUILD_MPI=off",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "-V",
|
||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||
@ -305,4 +305,4 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -17,7 +17,7 @@ if(BUILD_DOC)
|
||||
endif()
|
||||
find_package(Doxygen 1.8.10 REQUIRED)
|
||||
|
||||
file(GLOB DOC_SOURCES ${LAMMPS_DOC_DIR}/src/[^.]*.rst)
|
||||
file(GLOB DOC_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_DOC_DIR}/src/[^.]*.rst)
|
||||
|
||||
|
||||
add_custom_command(
|
||||
@ -56,16 +56,27 @@ if(BUILD_DOC)
|
||||
)
|
||||
|
||||
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
|
||||
set(MATHJAX_MD5 "d1c98c746888bfd52ca8ebc10704f92f" CACHE STRING "MD5 checksum of MathJax tarball")
|
||||
set(MATHJAX_MD5 "b81661c6e6ba06278e6ae37b30b0c492" CACHE STRING "MD5 checksum of MathJax tarball")
|
||||
mark_as_advanced(MATHJAX_URL)
|
||||
GetFallbackURL(MATHJAX_URL MATHJAX_FALLBACK)
|
||||
|
||||
# download mathjax distribution and unpack to folder "mathjax"
|
||||
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
|
||||
file(DOWNLOAD ${MATHJAX_URL}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz"
|
||||
EXPECTED_MD5 ${MATHJAX_MD5})
|
||||
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz)
|
||||
file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz)
|
||||
endif()
|
||||
if(NOT "${DL_MD5}" STREQUAL "${MATHJAX_MD5}")
|
||||
file(DOWNLOAD ${MATHJAX_URL} "${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz" STATUS DL_STATUS SHOW_PROGRESS)
|
||||
file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz DL_MD5)
|
||||
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${MATHJAX_MD5}"))
|
||||
message(WARNING "Download from primary URL ${MATHJAX_URL} failed\nTrying fallback URL ${MATHJAX_FALLBACK}")
|
||||
file(DOWNLOAD ${MATHJAX_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${MATHJAX_MD5} SHOW_PROGRESS)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
||||
endif()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(GLOB MATHJAX_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
||||
file(GLOB MATHJAX_VERSION_DIR ${CONFIGURE_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)
|
||||
endif()
|
||||
|
||||
|
||||
@ -9,8 +9,22 @@ function(ExternalCMakeProject target url hash basedir cmakedir cmakefile)
|
||||
|
||||
get_filename_component(archive ${url} NAME)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||
message(STATUS "Downloading ${url}")
|
||||
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
|
||||
if(EXISTS ${CMAKE_BINARY_DIR}/_deps/${archive})
|
||||
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
|
||||
endif()
|
||||
if(NOT "${DL_MD5}" STREQUAL "${hash}")
|
||||
message(STATUS "Downloading ${url}")
|
||||
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} STATUS DL_STATUS SHOW_PROGRESS)
|
||||
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
|
||||
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${hash}"))
|
||||
set(${target}_URL ${url})
|
||||
GetFallbackURL(${target}_URL fallback)
|
||||
message(WARNING "Download from primary URL ${url} failed\nTrying fallback URL ${fallback}")
|
||||
file(DOWNLOAD ${fallback} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/_deps/${archive}")
|
||||
endif()
|
||||
message(STATUS "Unpacking and configuring ${archive}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
# Find clang-format
|
||||
find_program(ClangFormat_EXECUTABLE NAMES clang-format
|
||||
clang-format-15.0
|
||||
clang-format-14.0
|
||||
clang-format-13.0
|
||||
clang-format-12.0
|
||||
clang-format-11.0
|
||||
clang-format-10.0
|
||||
clang-format-9.0
|
||||
clang-format-8.0
|
||||
@ -14,19 +19,27 @@ if(ClangFormat_EXECUTABLE)
|
||||
OUTPUT_VARIABLE clang_format_version
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
|
||||
if(clang_format_version MATCHES "^clang-format version .*")
|
||||
# Arch Linux
|
||||
if(clang_format_version MATCHES "^(Ubuntu |)clang-format version .*")
|
||||
# Arch Linux output:
|
||||
# clang-format version 10.0.0
|
||||
|
||||
# Ubuntu 18.04 LTS Output
|
||||
#
|
||||
# Ubuntu 18.04 LTS output:
|
||||
# clang-format version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
|
||||
string(REGEX REPLACE "clang-format version ([0-9.]+).*"
|
||||
"\\1"
|
||||
#
|
||||
# Ubuntu 20.04 LTS output:
|
||||
# clang-format version 10.0.0-4ubuntu1
|
||||
#
|
||||
# Ubuntu 22.04 LTS output:
|
||||
# Ubuntu clang-format version 14.0.0-1ubuntu1
|
||||
#
|
||||
# Fedora 36 output:
|
||||
# clang-format version 14.0.5 (Fedora 14.0.5-1.fc36)
|
||||
string(REGEX REPLACE "^(Ubuntu |)clang-format version ([0-9.]+).*"
|
||||
"\\2"
|
||||
ClangFormat_VERSION
|
||||
"${clang_format_version}")
|
||||
elseif(clang_format_version MATCHES ".*LLVM version .*")
|
||||
# CentOS 7 Output
|
||||
# CentOS 7 output:
|
||||
# LLVM (http://llvm.org/):
|
||||
# LLVM version 3.4.2
|
||||
# Optimized build.
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
find_path(ZMQ_INCLUDE_DIR zmq.h)
|
||||
find_library(ZMQ_LIBRARY NAMES zmq)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZMQ DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR)
|
||||
|
||||
# Copy the results to the output variables and target.
|
||||
if(ZMQ_FOUND)
|
||||
set(ZMQ_LIBRARIES ${ZMQ_LIBRARY})
|
||||
set(ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET ZMQ::ZMQ)
|
||||
add_library(ZMQ::ZMQ UNKNOWN IMPORTED)
|
||||
set_target_properties(ZMQ::ZMQ PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${ZMQ_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ZMQ_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
@ -65,7 +65,7 @@ endfunction(validate_option)
|
||||
|
||||
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||
function(get_newest_file path variable)
|
||||
file(GLOB _dirs ${path})
|
||||
file(GLOB _dirs ${CONFIGURE_DEPENDS} ${path})
|
||||
set(_besttime 2000-01-01T00:00:00)
|
||||
set(_bestfile "<unknown>")
|
||||
foreach(_dir ${_dirs})
|
||||
@ -88,6 +88,18 @@ function(get_lammps_version version_header variable)
|
||||
set(${variable} "${date}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# determine canonical URL for downloading backup copy from download.lammps.org/thirdparty
|
||||
function(GetFallbackURL input output)
|
||||
string(REPLACE "_URL" "" _tmp ${input})
|
||||
string(TOLOWER ${_tmp} libname)
|
||||
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
|
||||
if ("${newurl}" STREQUAL "${${input}}")
|
||||
set(${output} "" PARENT_SCOPE)
|
||||
else()
|
||||
set(${output} ${newurl} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(GetFallbackURL)
|
||||
|
||||
#################################################################################
|
||||
# LAMMPS C++ interface. We only need the header related parts except on windows.
|
||||
add_library(lammps INTERFACE)
|
||||
@ -112,45 +124,76 @@ if(BUILD_MPI)
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||
# Download and configure custom MPICH files for Windows
|
||||
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||
set(MPICH2_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)
|
||||
# Download and configure MinGW compatible MPICH development files for Windows
|
||||
option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF)
|
||||
if(USE_MSMPI)
|
||||
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
||||
else()
|
||||
message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI")
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a")
|
||||
else()
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
# Download and configure custom MPICH files for Windows
|
||||
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
else()
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||
else()
|
||||
find_package(MPI REQUIRED)
|
||||
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
||||
|
||||
@ -41,7 +41,7 @@ endfunction()
|
||||
|
||||
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||
function(get_newest_file path variable)
|
||||
file(GLOB _dirs ${path})
|
||||
file(GLOB _dirs ${CONFIGURE_DEPENDS} ${path})
|
||||
set(_besttime 2000-01-01T00:00:00)
|
||||
set(_bestfile "<unknown>")
|
||||
foreach(_dir ${_dirs})
|
||||
@ -80,8 +80,8 @@ endfunction()
|
||||
|
||||
function(check_for_autogen_files source_dir)
|
||||
message(STATUS "Running check for auto-generated files from make-based build system")
|
||||
file(GLOB SRC_AUTOGEN_FILES ${source_dir}/style_*.h)
|
||||
file(GLOB SRC_AUTOGEN_PACKAGES ${source_dir}/packages_*.h)
|
||||
file(GLOB SRC_AUTOGEN_FILES ${CONFIGURE_DEPENDS} ${source_dir}/style_*.h)
|
||||
file(GLOB SRC_AUTOGEN_PACKAGES ${CONFIGURE_DEPENDS} ${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}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
|
||||
foreach(_SRC ${SRC_AUTOGEN_FILES})
|
||||
@ -100,7 +100,7 @@ endfunction()
|
||||
|
||||
macro(pkg_depends PKG1 PKG2)
|
||||
if(PKG_${PKG1} AND NOT (PKG_${PKG2} OR BUILD_${PKG2}))
|
||||
message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be build with the ${PKG2} package")
|
||||
message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be built with the ${PKG2} package")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@ -149,3 +149,15 @@ if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
|
||||
set(CMAKE_LINUX_DISTRO ${distro})
|
||||
set(CMAKE_DISTRO_VERSION ${disversion})
|
||||
endif()
|
||||
|
||||
# determine canonical URL for downloading backup copy from download.lammps.org/thirdparty
|
||||
function(GetFallbackURL input output)
|
||||
string(REPLACE "_URL" "" _tmp ${input})
|
||||
string(TOLOWER ${_tmp} libname)
|
||||
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
|
||||
if ("${newurl}" STREQUAL "${${input}}")
|
||||
set(${output} "" PARENT_SCOPE)
|
||||
else()
|
||||
set(${output} ${newurl} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(GetFallbackURL)
|
||||
|
||||
@ -1,39 +1,74 @@
|
||||
# Download and configure custom MPICH files for Windows
|
||||
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||
set(MPICH2_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)
|
||||
# Download and configure MinGW compatible MPICH development files for Windows
|
||||
option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
if(USE_MSMPI)
|
||||
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
||||
else()
|
||||
message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI")
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a")
|
||||
else()
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
message(STATUS "Downloading and configuring MPICH2-1.4.1 for Windows cross-compilation")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||
set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN32_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
mark_as_advanced(MPICH2_WIN32_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
else()
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||
endif()
|
||||
|
||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||
|
||||
# set variables for status reporting at the end of CMake run
|
||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||
|
||||
file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
||||
file(GLOB COLVARS_SOURCES ${CONFIGURE_DEPENDS} ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
||||
|
||||
option(COLVARS_DEBUG "Debugging messages for Colvars (quite verbose)" OFF)
|
||||
|
||||
@ -9,7 +9,7 @@ option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
||||
|
||||
if(COLVARS_LEPTON)
|
||||
set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton)
|
||||
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp)
|
||||
file(GLOB LEPTON_SOURCES ${CONFIGURE_DEPENDS} ${LEPTON_DIR}/src/[^.]*.cpp)
|
||||
add_library(lepton STATIC ${LEPTON_SOURCES})
|
||||
# Change the define below to LEPTON_BUILDING_SHARED_LIBRARY when linking Lepton as a DLL with MSVC
|
||||
target_compile_definitions(lepton PRIVATE -DLEPTON_BUILDING_STATIC_LIBRARY)
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(ZLIB)
|
||||
if(NOT ZLIB_FOUND)
|
||||
message(WARNING "No Zlib development support found. Disabling COMPRESS package...")
|
||||
set(PKG_COMPRESS OFF CACHE BOOL "" FORCE)
|
||||
return()
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
@ -26,7 +26,10 @@ elseif(GPU_PREC STREQUAL "SINGLE")
|
||||
set(GPU_PREC_SETTING "SINGLE_SINGLE")
|
||||
endif()
|
||||
|
||||
file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
||||
option(GPU_DEBUG "Enable debugging code of the GPU package" OFF)
|
||||
mark_as_advanced(GPU_DEBUG)
|
||||
|
||||
file(GLOB GPU_LIB_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
||||
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||
|
||||
if(GPU_API STREQUAL "CUDA")
|
||||
@ -55,7 +58,7 @@ if(GPU_API STREQUAL "CUDA")
|
||||
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
||||
|
||||
# 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 ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h)
|
||||
if(GPU_LIB_OLD_CUBIN_HEADERS)
|
||||
message(FATAL_ERROR "########################################################################\n"
|
||||
"Found file(s) generated by the make-based build system in lib/gpu\n"
|
||||
@ -65,15 +68,15 @@ if(GPU_API STREQUAL "CUDA")
|
||||
"########################################################################")
|
||||
endif()
|
||||
|
||||
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||
file(GLOB GPU_LIB_CU ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||
|
||||
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||
|
||||
if(CUDPP_OPT)
|
||||
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
||||
file(GLOB GPU_LIB_CUDPP_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp)
|
||||
file(GLOB GPU_LIB_CUDPP_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu)
|
||||
file(GLOB GPU_LIB_CUDPP_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp)
|
||||
file(GLOB GPU_LIB_CUDPP_CU ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu)
|
||||
endif()
|
||||
|
||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
||||
@ -82,11 +85,14 @@ if(GPU_API STREQUAL "CUDA")
|
||||
|
||||
# apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0
|
||||
# only the Kepler achitecture and beyond is supported
|
||||
# comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
||||
if(CUDA_VERSION VERSION_LESS 8.0)
|
||||
message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required")
|
||||
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "13.0")
|
||||
message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk")
|
||||
set(GPU_CUDA_GENCODE "-arch=all")
|
||||
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
set(GPU_CUDA_GENCODE "-arch=all")
|
||||
else()
|
||||
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
||||
@ -120,14 +126,14 @@ if(GPU_API STREQUAL "CUDA")
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
|
||||
endif()
|
||||
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later
|
||||
# Lovelace (GPU Arch 8.9) is supported by CUDA 11.8 and later
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8")
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||
endif()
|
||||
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0 and later
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||
endif()
|
||||
# # Lovelace (GPU Arch 9.x) is supported by CUDA 12.0? and later
|
||||
#if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
# string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_9x,code=[sm_9x,compute_9x]")
|
||||
#endif()
|
||||
endif()
|
||||
|
||||
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||
@ -150,14 +156,17 @@ if(GPU_API STREQUAL "CUDA")
|
||||
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
||||
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} ${GPU_CUDA_MPS_FLAGS})
|
||||
if(GPU_DEBUG)
|
||||
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
||||
else()
|
||||
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DUCL_NO_EXIT)
|
||||
endif()
|
||||
if(CUDPP_OPT)
|
||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
||||
endif()
|
||||
|
||||
target_link_libraries(lammps PRIVATE gpu)
|
||||
|
||||
add_executable(nvc_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||
target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR)
|
||||
target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||
@ -182,7 +191,7 @@ elseif(GPU_API STREQUAL "OPENCL")
|
||||
include(OpenCLUtils)
|
||||
set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h)
|
||||
|
||||
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||
file(GLOB GPU_LIB_CU ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||
list(REMOVE_ITEM GPU_LIB_CU
|
||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu
|
||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu
|
||||
@ -221,19 +230,23 @@ elseif(GPU_API STREQUAL "OPENCL")
|
||||
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
||||
target_link_libraries(gpu PRIVATE OpenCL::OpenCL)
|
||||
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu)
|
||||
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DGERYON_NUMA_FISSION -DUCL_NO_EXIT)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL)
|
||||
|
||||
target_link_libraries(lammps PRIVATE gpu)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL -D_${GPU_PREC_SETTING})
|
||||
if(GPU_DEBUG)
|
||||
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
||||
else()
|
||||
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DGERYON_NUMA_FISSION -DUCL_NO_EXIT)
|
||||
endif()
|
||||
|
||||
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_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL)
|
||||
add_dependencies(ocl_get_devices OpenCL::OpenCL)
|
||||
|
||||
elseif(GPU_API STREQUAL "HIP")
|
||||
if(NOT DEFINED HIP_PATH)
|
||||
if(NOT DEFINED ENV{HIP_PATH})
|
||||
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to HIP installation")
|
||||
message(FATAL_ERROR "GPU_API=HIP requires HIP_PATH to be defined.\n"
|
||||
"Either pass the HIP_PATH as a CMake option via -DHIP_PATH=... or set the HIP_PATH environment variable.")
|
||||
else()
|
||||
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to HIP installation")
|
||||
endif()
|
||||
@ -261,6 +274,8 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
|
||||
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
||||
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
||||
elseif(HIP_PLATFORM STREQUAL "spirv")
|
||||
set(HIP_ARCH "spirv" CACHE STRING "HIP target architecture")
|
||||
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||
find_package(CUDA REQUIRED)
|
||||
set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)")
|
||||
@ -273,6 +288,7 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
else()
|
||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
||||
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
||||
# comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
||||
set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}")
|
||||
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
||||
@ -302,14 +318,22 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
|
||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
|
||||
endif()
|
||||
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later
|
||||
# Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
|
||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
|
||||
endif()
|
||||
# Lovelace (GPU Arch 8.9) is supported by CUDA 11.8 and later
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8")
|
||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||
endif()
|
||||
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0 and later
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||
file(GLOB GPU_LIB_CU ${CONFIGURE_DEPENDS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||
|
||||
set(GPU_LIB_CU_HIP "")
|
||||
@ -340,7 +364,14 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
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}
|
||||
COMMENT "Generating ${CU_NAME}.cubin")
|
||||
endif()
|
||||
elseif(HIP_PLATFORM STREQUAL "spirv")
|
||||
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
||||
|
||||
add_custom_command(OUTPUT ${CUBIN_FILE}
|
||||
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} -c -O3 -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}
|
||||
COMMENT "Gerating ${CU_NAME}.cubin")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${CUBIN_H_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -D VARNAME=${CU_NAME} -D HEADER_FILE=${CUBIN_H_FILE} -D SOURCE_FILE=${CUBIN_FILE} -P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/GenerateBinaryHeader.cmake
|
||||
@ -354,8 +385,12 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
|
||||
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_HIP)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_HIP -D_${GPU_PREC_SETTING})
|
||||
if(GPU_DEBUG)
|
||||
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
||||
else()
|
||||
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DUCL_NO_EXIT)
|
||||
endif()
|
||||
target_link_libraries(gpu PRIVATE hip::host)
|
||||
|
||||
if(HIP_USE_DEVICE_SORT)
|
||||
@ -380,15 +415,17 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
|
||||
if(DOWNLOAD_CUB)
|
||||
message(STATUS "CUB download requested")
|
||||
set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
||||
# TODO: test update to current version 1.17.2
|
||||
set(CUB_URL "https://github.com/nvidia/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
||||
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
|
||||
mark_as_advanced(CUB_URL)
|
||||
mark_as_advanced(CUB_MD5)
|
||||
GetFallbackURL(CUB_URL CUB_FALLBACK)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(CUB
|
||||
URL ${CUB_URL}
|
||||
URL ${CUB_URL} ${CUB_FALLBACK}
|
||||
URL_MD5 ${CUB_MD5}
|
||||
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
CONFIGURE_COMMAND ""
|
||||
@ -411,7 +448,7 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
|
||||
add_executable(hip_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||
target_compile_definitions(hip_get_devices PRIVATE -DUCL_HIP)
|
||||
target_link_libraries(hip_get_devices hip::host)
|
||||
target_link_libraries(hip_get_devices PRIVATE hip::host)
|
||||
|
||||
if(HIP_PLATFORM STREQUAL "nvcc")
|
||||
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
|
||||
@ -436,10 +473,14 @@ elseif(GPU_API STREQUAL "HIP")
|
||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_AMD__)
|
||||
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||
endif()
|
||||
|
||||
target_link_libraries(lammps PRIVATE gpu)
|
||||
endif()
|
||||
|
||||
if(BUILD_OMP)
|
||||
find_package(OpenMP COMPONENTS CXX REQUIRED)
|
||||
target_link_libraries(gpu PRIVATE OpenMP::OpenMP_CXX)
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE gpu)
|
||||
|
||||
set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}")
|
||||
# detect styles which have a GPU version
|
||||
RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES)
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
if(CMAKE_CXX_STANDARD LESS 14)
|
||||
message(FATAL_ERROR "The KOKKOS package requires the C++ standard to be set to at least C++14")
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# consistency checks and Kokkos options/settings required by LAMMPS
|
||||
if(Kokkos_ENABLE_CUDA)
|
||||
@ -52,8 +53,10 @@ if(DOWNLOAD_KOKKOS)
|
||||
set(KOKKOS_MD5 "0ec97fc0c356dd65bd2487defe81a7bf" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||
mark_as_advanced(KOKKOS_URL)
|
||||
mark_as_advanced(KOKKOS_MD5)
|
||||
GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK)
|
||||
|
||||
ExternalProject_Add(kokkos_build
|
||||
URL ${KOKKOS_URL}
|
||||
URL ${KOKKOS_URL} ${KOKKOS_FALLBACK}
|
||||
URL_MD5 ${KOKKOS_MD5}
|
||||
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a
|
||||
|
||||
@ -19,17 +19,19 @@ if(DOWNLOAD_LATTE)
|
||||
set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball")
|
||||
mark_as_advanced(LATTE_URL)
|
||||
mark_as_advanced(LATTE_MD5)
|
||||
GetFallbackURL(LATTE_URL LATTE_FALLBACK)
|
||||
|
||||
# CMake cannot pass BLAS or LAPACK library variable to external project if they are a list
|
||||
list(LENGTH BLAS_LIBRARIES} NUM_BLAS)
|
||||
list(LENGTH LAPACK_LIBRARIES NUM_LAPACK)
|
||||
if((NUM_BLAS GREATER 1) OR (NUM_LAPACK GREATER 1))
|
||||
message(FATAL_ERROR "Cannot compile downloaded LATTE library due to a technical limitation")
|
||||
if((NUM_BLAS GREATER 1) OR (NUM_LAPACK GREATER 1) AND NOT USE_INTERNAL_LINALG)
|
||||
message(FATAL_ERROR "Cannot compile downloaded LATTE library due to a technical limitation. "
|
||||
"Try to configure LAMMPS with '-D USE_INTERNAL_LINALG=on' added as a workaround.")
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(latte_build
|
||||
URL ${LATTE_URL}
|
||||
URL ${LATTE_URL} ${LATTE_FALLBACK}
|
||||
URL_MD5 ${LATTE_MD5}
|
||||
SOURCE_SUBDIR cmake
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
|
||||
|
||||
@ -12,6 +12,7 @@ if(DOWNLOAD_MDI)
|
||||
set(MDI_MD5 "836f5da400d8cff0f0e4435640f9454f" CACHE STRING "MD5 checksum for MDI tarball")
|
||||
mark_as_advanced(MDI_URL)
|
||||
mark_as_advanced(MDI_MD5)
|
||||
GetFallbackURL(MDI_URL MDI_FALLBACK)
|
||||
enable_language(C)
|
||||
|
||||
# only ON/OFF are allowed for "mpi" flag when building MDI library
|
||||
@ -42,7 +43,7 @@ if(DOWNLOAD_MDI)
|
||||
# support cross-compilation and ninja-build
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(mdi_build
|
||||
URL ${MDI_URL}
|
||||
URL ${MDI_URL} ${MDI_FALLBACK}
|
||||
URL_MD5 ${MDI_MD5}
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||
|
||||
@ -6,10 +6,11 @@ else()
|
||||
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")
|
||||
set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.2.0.tar.gz" CACHE STRING "URL for n2p2 tarball")
|
||||
set(N2P2_MD5 "a2d9ab7f676b3a74a324fc1eda0a911d" CACHE STRING "MD5 checksum of N2P2 tarball")
|
||||
mark_as_advanced(N2P2_URL)
|
||||
mark_as_advanced(N2P2_MD5)
|
||||
GetFallbackURL(N2P2_URL N2P2_FALLBACK)
|
||||
|
||||
# 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)
|
||||
@ -72,7 +73,7 @@ if(DOWNLOAD_N2P2)
|
||||
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(n2p2_build
|
||||
URL ${N2P2_URL}
|
||||
URL ${N2P2_URL} ${N2P2_FALLBACK}
|
||||
URL_MD5 ${N2P2_MD5}
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
@ -3,9 +3,23 @@ set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2
|
||||
set(PACELIB_MD5 "32394d799bc282bb57696c78c456e64f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
mark_as_advanced(PACELIB_URL)
|
||||
mark_as_advanced(PACELIB_MD5)
|
||||
GetFallbackURL(PACELIB_URL PACELIB_FALLBACK)
|
||||
|
||||
# download library sources to build folder
|
||||
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS
|
||||
if(EXISTS ${CMAKE_BINARY_DIR}/libpace.tar.gz)
|
||||
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
||||
endif()
|
||||
if(NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}")
|
||||
message(STATUS "Downloading ${PACELIB_URL}")
|
||||
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz STATUS DL_STATUS SHOW_PROGRESS)
|
||||
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
||||
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}"))
|
||||
message(WARNING "Download from primary URL ${PACELIB_URL} failed\nTrying fallback URL ${PACELIB_FALLBACK}")
|
||||
file(DOWNLOAD ${PACELIB_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5} SHOW_PROGRESS)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
||||
endif()
|
||||
|
||||
# uncompress downloaded sources
|
||||
execute_process(
|
||||
@ -22,8 +36,8 @@ set(YAML_CPP_BUILD_TOOLS OFF)
|
||||
add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp)
|
||||
set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include)
|
||||
|
||||
file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE)
|
||||
file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp)
|
||||
file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${CONFIGURE_DEPENDS} ${lib-pace}/ML-PACE)
|
||||
file(GLOB PACE_EVALUATOR_SOURCES ${CONFIGURE_DEPENDS} ${lib-pace}/ML-PACE/*.cpp)
|
||||
list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp)
|
||||
|
||||
add_library(pace STATIC ${PACE_EVALUATOR_SOURCES})
|
||||
|
||||
@ -16,6 +16,7 @@ if(DOWNLOAD_QUIP)
|
||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n")
|
||||
set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n")
|
||||
set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n")
|
||||
set(temp "${temp}F95_PRE_FILENAME_FLAG = -Tf\n")
|
||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
||||
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
|
||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n")
|
||||
@ -58,12 +59,12 @@ if(DOWNLOAD_QUIP)
|
||||
BUILD_COMMAND env QUIP_ARCH=lammps make libquip
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_IN_SOURCE YES
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/build/lammps/libquip.a
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/build/lammps/${CMAKE_STATIC_LIBRARY_PREFIX}quip${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
)
|
||||
ExternalProject_get_property(quip_build SOURCE_DIR)
|
||||
add_library(LAMMPS::QUIP UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::QUIP PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/build/lammps/libquip.a"
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/build/lammps/${CMAKE_STATIC_LIBRARY_PREFIX}quip${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::QUIP)
|
||||
add_dependencies(LAMMPS::QUIP quip_build)
|
||||
|
||||
@ -7,8 +7,8 @@ else()
|
||||
endif()
|
||||
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
|
||||
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")
|
||||
set(MSCG_URL "https://github.com/uchicago-voth/MSCG-release/archive/491270a73539e3f6951e76f7dbe84e258b3ebb45.tar.gz" CACHE STRING "URL for MSCG tarball")
|
||||
set(MSCG_MD5 "7ea50748fba5c3a372e0266bd31d2f11" CACHE STRING "MD5 checksum of MSCG tarball")
|
||||
mark_as_advanced(MSCG_URL)
|
||||
mark_as_advanced(MSCG_MD5)
|
||||
|
||||
|
||||
@ -1,105 +1,169 @@
|
||||
set(PLUMED_MODE "static" CACHE STRING "Linkage mode for Plumed2 library")
|
||||
set(PLUMED_MODE_VALUES static shared runtime)
|
||||
set_property(CACHE PLUMED_MODE PROPERTY STRINGS ${PLUMED_MODE_VALUES})
|
||||
validate_option(PLUMED_MODE PLUMED_MODE_VALUES)
|
||||
string(TOUPPER ${PLUMED_MODE} PLUMED_MODE)
|
||||
# Plumed2 support for PLUMED package
|
||||
|
||||
set(PLUMED_LINK_LIBS)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
find_package(LAPACK REQUIRED)
|
||||
find_package(BLAS REQUIRED)
|
||||
find_package(GSL REQUIRED)
|
||||
list(APPEND PLUMED_LINK_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} GSL::gsl)
|
||||
find_package(ZLIB QUIET)
|
||||
if(ZLIB_FOUND)
|
||||
list(APPEND PLUMED_LINK_LIBS ZLIB::ZLIB)
|
||||
endif()
|
||||
find_package(FFTW3 QUIET)
|
||||
if(FFTW3_FOUND)
|
||||
list(APPEND PLUMED_LINK_LIBS FFTW3::FFTW3)
|
||||
endif()
|
||||
if(BUILD_MPI)
|
||||
set(PLUMED_CONFIG_MPI "--enable-mpi")
|
||||
set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER})
|
||||
set(PLUMED_CONFIG_CXX ${CMAKE_MPI_CXX_COMPILER})
|
||||
set(PLUMED_CONFIG_CPP "-I ${MPI_CXX_INCLUDE_PATH}")
|
||||
set(PLUMED_CONFIG_LIB "${MPI_CXX_LIBRARIES}")
|
||||
set(PLUMED_CONFIG_DEP "mpi4win_build")
|
||||
else()
|
||||
set(PLUMED_CONFIG_MPI "--disable-mpi")
|
||||
set(PLUMED_CONFIG_CC ${CMAKE_C_COMPILER})
|
||||
set(PLUMED_CONFIG_CXX ${CMAKE_CXX_COMPILER})
|
||||
set(PLUMED_CONFIG_CPP "")
|
||||
set(PLUMED_CONFIG_LIB "")
|
||||
set(PLUMED_CONFIG_DEP "")
|
||||
endif()
|
||||
if(BUILD_OMP)
|
||||
set(PLUMED_CONFIG_OMP "--enable-openmp")
|
||||
else()
|
||||
set(PLUMED_CONFIG_OMP "--disable-openmp")
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
set(DOWNLOAD_PLUMED_DEFAULT ON)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PLUMED QUIET plumed)
|
||||
if(PLUMED_FOUND)
|
||||
set(DOWNLOAD_PLUMED_DEFAULT OFF)
|
||||
endif()
|
||||
endif()
|
||||
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.8.2/plumed-src-2.8.2.tgz"
|
||||
CACHE STRING "URL for PLUMED tarball")
|
||||
set(PLUMED_MD5 "599092b6a0aa6fff992612537ad98994" CACHE STRING "MD5 checksum of PLUMED tarball")
|
||||
|
||||
option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" ${DOWNLOAD_PLUMED_DEFAULT})
|
||||
if(DOWNLOAD_PLUMED)
|
||||
if(BUILD_MPI)
|
||||
set(PLUMED_CONFIG_MPI "--enable-mpi")
|
||||
set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER})
|
||||
set(PLUMED_CONFIG_CXX ${CMAKE_MPI_CXX_COMPILER})
|
||||
mark_as_advanced(PLUMED_URL)
|
||||
mark_as_advanced(PLUMED_MD5)
|
||||
GetFallbackURL(PLUMED_URL PLUMED_FALLBACK)
|
||||
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND (CMAKE_CROSSCOMPILING))
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(CROSS_CONFIGURE mingw64-configure)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
set(CROSS_CONFIGURE mingw32-configure)
|
||||
else()
|
||||
set(PLUMED_CONFIG_MPI "--disable-mpi")
|
||||
set(PLUMED_CONFIG_CC ${CMAKE_C_COMPILER})
|
||||
set(PLUMED_CONFIG_CXX ${CMAKE_CXX_COMPILER})
|
||||
message(FATAL_ERROR "Unsupported target system: ${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
|
||||
endif()
|
||||
if(BUILD_OMP)
|
||||
set(PLUMED_CONFIG_OMP "--enable-openmp")
|
||||
else()
|
||||
set(PLUMED_CONFIG_OMP "--disable-openmp")
|
||||
endif()
|
||||
message(STATUS "PLUMED download requested - we will build our own")
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumed${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumed${CMAKE_SHARED_LIBRARY_SUFFIX};<INSTALL_DIR>/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumedWrapper${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||
endif()
|
||||
|
||||
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.8.1/plumed-src-2.8.1.tgz" CACHE STRING "URL for PLUMED tarball")
|
||||
set(PLUMED_MD5 "6bfe72ebdae63dc38a9ca27d9b0e08f8" CACHE STRING "MD5 checksum of PLUMED tarball")
|
||||
|
||||
mark_as_advanced(PLUMED_URL)
|
||||
mark_as_advanced(PLUMED_MD5)
|
||||
|
||||
message(STATUS "Downloading and cross-compiling Plumed2 for ${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR} with ${CROSS_CONFIGURE}")
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(plumed_build
|
||||
URL ${PLUMED_URL}
|
||||
URL ${PLUMED_URL} ${PLUMED_FALLBACK}
|
||||
URL_MD5 ${PLUMED_MD5}
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
CONFIGURE_COMMAND ${CROSS_CONFIGURE} --disable-shared --disable-bsymbolic
|
||||
--disable-python --enable-cxx=11
|
||||
--enable-modules=-adjmat:+crystallization:-dimred:+drr:+eds:-fisst:+funnel:+logmfd:+manyrestraints:+maze:+opes:+multicolvar:-pamm:-piv:+s2cm:-sasa:-ves
|
||||
${PLUMED_CONFIG_OMP}
|
||||
${PLUMED_CONFIG_MPI}
|
||||
CXX=${PLUMED_CONFIG_CXX}
|
||||
CC=${PLUMED_CONFIG_CC}
|
||||
CPPFLAGS=${PLUMED_CONFIG_CPP}
|
||||
LIBS=${PLUMED_CONFIG_LIB}
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS "<SOURCE_DIR>/src/lib/install/libplumed.a" "<SOURCE_DIR>/src/lib/install/plumed.exe"
|
||||
DEPENDS "${PLUMED_MPI_CONFIG_DEP}"
|
||||
)
|
||||
ExternalProject_Get_Property(plumed_build SOURCE_DIR)
|
||||
set(PLUMED_BUILD_DIR ${SOURCE_DIR})
|
||||
set(PLUMED_INSTALL_DIR ${PLUMED_BUILD_DIR}/src/lib/install)
|
||||
file(MAKE_DIRECTORY ${PLUMED_BUILD_DIR}/src/include)
|
||||
|
||||
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES
|
||||
IMPORTED_LOCATION "${PLUMED_INSTALL_DIR}/libplumed.a"
|
||||
INTERFACE_LINK_LIBRARIES "-Wl,--image-base -Wl,0x10000000 -lfftw3 -lz -fstack-protector -lssp -fopenmp"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_BUILD_DIR}/src/include")
|
||||
|
||||
add_custom_target(plumed_copy ALL ${CMAKE_COMMAND} -E rm -rf ${CMAKE_BINARY_DIR}/plumed.exe ${CMAKE_BINARY_DIR}/plumed_patches
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PLUMED_INSTALL_DIR}/plumed.exe ${CMAKE_BINARY_DIR}/plumed.exe
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PLUMED_BUILD_DIR}/patches ${CMAKE_BINARY_DIR}/patches
|
||||
BYPRODUCTS ${CMAKE_BINARY_DIR}/plumed.exe ${CMAKE_BINARY_DIR}/patches
|
||||
DEPENDS plumed_build
|
||||
COMMENT "Copying Plumed files"
|
||||
)
|
||||
|
||||
else()
|
||||
|
||||
set(PLUMED_MODE "static" CACHE STRING "Linkage mode for Plumed2 library")
|
||||
set(PLUMED_MODE_VALUES static shared runtime)
|
||||
set_property(CACHE PLUMED_MODE PROPERTY STRINGS ${PLUMED_MODE_VALUES})
|
||||
validate_option(PLUMED_MODE PLUMED_MODE_VALUES)
|
||||
string(TOUPPER ${PLUMED_MODE} PLUMED_MODE)
|
||||
|
||||
set(PLUMED_LINK_LIBS)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
find_package(LAPACK REQUIRED)
|
||||
find_package(BLAS REQUIRED)
|
||||
find_package(GSL REQUIRED)
|
||||
list(APPEND PLUMED_LINK_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} GSL::gsl)
|
||||
find_package(ZLIB QUIET)
|
||||
if(ZLIB_FOUND)
|
||||
list(APPEND PLUMED_LINK_LIBS ZLIB::ZLIB)
|
||||
endif()
|
||||
find_package(FFTW3 QUIET)
|
||||
if(FFTW3_FOUND)
|
||||
list(APPEND PLUMED_LINK_LIBS FFTW3::FFTW3)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
set(DOWNLOAD_PLUMED_DEFAULT ON)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PLUMED QUIET plumed)
|
||||
if(PLUMED_FOUND)
|
||||
set(DOWNLOAD_PLUMED_DEFAULT OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" ${DOWNLOAD_PLUMED_DEFAULT})
|
||||
if(DOWNLOAD_PLUMED)
|
||||
message(STATUS "PLUMED download requested - we will build our own")
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumed${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumed${CMAKE_SHARED_LIBRARY_SUFFIX};<INSTALL_DIR>/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumedWrapper${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(plumed_build
|
||||
URL ${PLUMED_URL} ${PLUMED_FALLBACK}
|
||||
URL_MD5 ${PLUMED_MD5}
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
${CONFIGURE_REQUEST_PIC}
|
||||
--enable-modules=all
|
||||
--enable-cxx=11
|
||||
--disable-python
|
||||
${PLUMED_CONFIG_MPI}
|
||||
${PLUMED_CONFIG_OMP}
|
||||
CXX=${PLUMED_CONFIG_CXX}
|
||||
CC=${PLUMED_CONFIG_CC}
|
||||
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
|
||||
)
|
||||
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
||||
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumed${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${PLUMED_LINK_LIBS};${CMAKE_DL_LIBS}")
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumed${CMAKE_SHARED_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_DL_LIBS}")
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumedWrapper${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
|
||||
)
|
||||
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
||||
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumed${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${PLUMED_LINK_LIBS};${CMAKE_DL_LIBS}")
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumed${CMAKE_SHARED_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_DL_LIBS}")
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumedWrapper${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||
endif()
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
|
||||
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PLUMED REQUIRED plumed)
|
||||
add_library(LAMMPS::PLUMED INTERFACE IMPORTED)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.static)
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.shared)
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
||||
endif()
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_LINK_LIBRARIES "${PLUMED_LOAD}")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_INCLUDE_DIRS}")
|
||||
endif()
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
|
||||
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PLUMED REQUIRED plumed)
|
||||
add_library(LAMMPS::PLUMED INTERFACE IMPORTED)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.static)
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.shared)
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
||||
endif()
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_LINK_LIBRARIES "${PLUMED_LOAD}")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
|
||||
|
||||
@ -1,8 +1,28 @@
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
if(NOT PYTHON_VERSION_STRING)
|
||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
||||
# search for interpreter first, so we have a consistent library
|
||||
find_package(PythonInterp) # Deprecated since version 3.12
|
||||
if(PYTHONINTERP_FOUND)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
endif()
|
||||
# search for the library matching the selected interpreter
|
||||
set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
|
||||
find_package(PythonLibs REQUIRED) # Deprecated since version 3.12
|
||||
if(NOT (PYTHON_VERSION_STRING STREQUAL PYTHONLIBS_VERSION_STRING))
|
||||
message(FATAL_ERROR "Python Library version ${PYTHONLIBS_VERSION_STRING} does not match Interpreter version ${PYTHON_VERSION_STRING}")
|
||||
endif()
|
||||
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS})
|
||||
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES})
|
||||
else()
|
||||
if(NOT Python_INTERPRETER)
|
||||
# backward compatibility
|
||||
if(PYTHON_EXECUTABLE)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
endif()
|
||||
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
||||
target_link_libraries(lammps PRIVATE Python::Python)
|
||||
endif()
|
||||
|
||||
@ -18,6 +18,8 @@ if(DOWNLOAD_SCAFACOS)
|
||||
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
|
||||
mark_as_advanced(SCAFACOS_URL)
|
||||
mark_as_advanced(SCAFACOS_MD5)
|
||||
GetFallbackURL(SCAFACOS_URL SCAFACOS_FALLBACK)
|
||||
|
||||
|
||||
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
||||
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
@ -30,7 +32,7 @@ if(DOWNLOAD_SCAFACOS)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(scafacos_build
|
||||
URL ${SCAFACOS_URL}
|
||||
URL ${SCAFACOS_URL} ${SCAFACOS_FALLBACK}
|
||||
URL_MD5 ${SCAFACOS_MD5}
|
||||
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
function(FindStyleHeaders path style_class file_pattern headers)
|
||||
file(GLOB files "${path}/${file_pattern}*.h")
|
||||
file(GLOB files ${CONFIGURE_DEPENDS} "${path}/${file_pattern}*.h")
|
||||
get_property(hlist GLOBAL PROPERTY ${headers})
|
||||
|
||||
foreach(file_name ${files})
|
||||
@ -184,7 +184,7 @@ endfunction(DetectBuildSystemConflict)
|
||||
|
||||
|
||||
function(FindPackagesHeaders path style_class file_pattern headers)
|
||||
file(GLOB files "${path}/${file_pattern}*.h")
|
||||
file(GLOB files ${CONFIGURE_DEPENDS} "${path}/${file_pattern}*.h")
|
||||
get_property(plist GLOBAL PROPERTY ${headers})
|
||||
|
||||
foreach(file_name ${files})
|
||||
|
||||
@ -6,7 +6,7 @@ if(ENABLE_TESTING)
|
||||
find_program(VALGRIND_BINARY NAMES valgrind)
|
||||
# generate custom suppression file
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "\n")
|
||||
file(GLOB VALGRIND_SUPPRESSION_FILES ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp)
|
||||
file(GLOB VALGRIND_SUPPRESSION_FILES ${CONFIGURE_DEPENDS} ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp)
|
||||
foreach(SUPP ${VALGRIND_SUPPRESSION_FILES})
|
||||
file(READ ${SUPP} SUPPRESSIONS)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "${SUPPRESSIONS}")
|
||||
|
||||
@ -26,7 +26,7 @@ if(BUILD_TOOLS)
|
||||
|
||||
enable_language(C)
|
||||
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
||||
file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
||||
file(GLOB MSI2LMP_SOURCES ${CONFIGURE_DEPENDS} ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
||||
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
||||
if(STANDARD_MATH_LIB)
|
||||
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
||||
@ -50,12 +50,16 @@ if(BUILD_LAMMPS_SHELL)
|
||||
|
||||
add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp ${ICON_RC_FILE})
|
||||
target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell)
|
||||
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
|
||||
|
||||
# workaround for broken readline pkg-config file on FreeBSD
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
target_include_directories(lammps-shell PRIVATE /usr/local/include)
|
||||
endif()
|
||||
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "LinuxMUSL")
|
||||
pkg_check_modules(TERMCAP IMPORTED_TARGET REQUIRED termcap)
|
||||
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::TERMCAP)
|
||||
endif()
|
||||
install(TARGETS lammps-shell EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/lammps-shell/icons DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/)
|
||||
install(FILES ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/)
|
||||
|
||||
@ -3,6 +3,13 @@
|
||||
# prefer flang over gfortran, if available
|
||||
find_program(CLANG_FORTRAN NAMES flang gfortran f95)
|
||||
set(ENV{OMPI_FC} ${CLANG_FORTRAN})
|
||||
get_filename_component(_tmp_fc ${CLANG_FORTRAN} NAME)
|
||||
if (_tmp_fc STREQUAL "flang")
|
||||
set(FC_STD_VERSION "-std=f2018")
|
||||
set(BUILD_MPI OFF)
|
||||
else()
|
||||
set(FC_STD_VERSION "-std=f2003")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
||||
@ -10,9 +17,9 @@ set(CMAKE_Fortran_COMPILER ${CLANG_FORTRAN} 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 -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g ${FC_STD_VERSION}" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG ${FC_STD_VERSION}" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG ${FC_STD_VERSION}" 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)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes)
|
||||
# preset that will enable the classic Intel compilers with support for MPI and OpenMP (on Linux boxes)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
|
||||
@ -18,11 +18,11 @@ set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(OpenMP_C "icc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX "icpc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_Fortran_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
||||
|
||||
|
||||
@ -18,11 +18,11 @@ 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_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX "icpx" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_Fortran_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocess
|
||||
# we only want to use explicitly listed files.
|
||||
DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//')
|
||||
|
||||
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check xmlgen fasthtml
|
||||
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check role_check xmlgen fasthtml
|
||||
|
||||
# ------------------------------------------
|
||||
|
||||
@ -96,6 +96,7 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
||||
rst_anchor_check src/*.rst ;\
|
||||
python $(BUILDDIR)/utils/check-packages.py -s ../src -d src ;\
|
||||
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
||||
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
|
||||
python $(BUILDDIR)/utils/check-styles.py -s ../src -d src ;\
|
||||
echo "############################################" ;\
|
||||
deactivate ;\
|
||||
@ -175,6 +176,7 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
rst_anchor_check src/*.rst ;\
|
||||
python utils/check-packages.py -s ../src -d src ;\
|
||||
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
||||
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
|
||||
python utils/check-styles.py -s ../src -d src ;\
|
||||
echo "############################################" ;\
|
||||
deactivate ;\
|
||||
@ -220,6 +222,9 @@ package_check : $(VENV)
|
||||
char_check :
|
||||
@( env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst && exit 1 || : )
|
||||
|
||||
role_check :
|
||||
@( env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst && exit 1 || : )
|
||||
|
||||
xmlgen : doxygen/xml/index.xml
|
||||
|
||||
doxygen/Doxyfile: doxygen/Doxyfile.in
|
||||
|
||||
@ -40,8 +40,9 @@ environment and local folders.
|
||||
Installing prerequisites for the documentation build
|
||||
|
||||
To run the HTML documention build toolchain, python 3.x, doxygen, git,
|
||||
and virtualenv have to be installed. Also internet access is initially
|
||||
required to download external files and tools.
|
||||
and the venv python module have to be installed if not already available.
|
||||
Also internet access is initially required to download external files
|
||||
and tools.
|
||||
|
||||
Building the PDF format manual requires in addition a compatible LaTeX
|
||||
installation with support for PDFLaTeX and several add-on LaTeX packages
|
||||
|
||||
@ -4,45 +4,44 @@ This purpose of this document is to provide a point of reference
|
||||
for LAMMPS developers and contributors as to what conventions
|
||||
should be used to structure and format files in the LAMMPS manual.
|
||||
|
||||
Last change: 2020-04-23
|
||||
Last change: 2022-12-30
|
||||
|
||||
## File format and tools
|
||||
|
||||
In fall 2019, the LAMMPS documentation file format has changed from
|
||||
a home grown minimal markup designed to generate HTML format files
|
||||
from a mostly plain text format to using the reStructuredText file
|
||||
format. For a transition period all files in the old .txt format
|
||||
were transparently converted to .rst and then processed. The txt2rst
|
||||
tool is still included in the distribution to obtain an initial .rst
|
||||
file for integration into the manual. Since the transition to
|
||||
reStructured text as source format, many of the artifacts or the
|
||||
translation have been removed though and parts of the documentation
|
||||
refactored and expanded to take advantage of the capabilities
|
||||
reStructuredText and associated tools. The conversion from the
|
||||
source to the final formats (HTML, PDF, and optionally e-book
|
||||
reader formats ePUB and MOBI) is mostly automated and controlled
|
||||
by a Makefile in the `doc` folder. This makefile assumes that the
|
||||
processing is done on a Unix-like machine and Python 3.5 or later
|
||||
and a matching virtualenv module are available. Additional Python
|
||||
packages (like the Sphinx tool and several extensions) are
|
||||
transparently installed into a virtual environment over the
|
||||
internet using the `pip` package manager. Further requirements
|
||||
and details are discussed in the manual.
|
||||
In fall 2019, the LAMMPS documentation file format has changed from a
|
||||
home grown markup designed to generate HTML format files only, to
|
||||
[reStructuredText](https://docutils.sourceforge.io/rst.html>. For a
|
||||
transition period all files in the old .txt format were transparently
|
||||
converted to .rst and then processed. The `txt2rst tool` is still
|
||||
included in the distribution to obtain an initial .rst file for legacy
|
||||
integration into the manual. Since that transition to reStructured
|
||||
text, many of the artifacts of the translation have been removed though,
|
||||
and parts of the documentation refactored and expanded to take advantage
|
||||
of the capabilities reStructuredText and associated tools. The
|
||||
conversion from the source to the final formats (HTML, PDF, and
|
||||
optionally e-book reader formats ePUB and MOBI) is mostly automated and
|
||||
controlled by a Makefile in the `doc` folder. This makefile assumes that
|
||||
the processing is done on a Unix-like machine and Python 3.5 or later
|
||||
and a matching venv module are available. Additional Python
|
||||
packages (like the Sphinx tool and several extensions) are transparently
|
||||
installed into a virtual environment over the internet using the `pip`
|
||||
package manager. Further requirements and details are discussed in the
|
||||
manual.
|
||||
|
||||
## Work in progress
|
||||
|
||||
The refactoring and improving of the documentation is an ongoing
|
||||
process, so statements in this document may not always be fully
|
||||
up-to-date. If in doubt, contact the LAMMPS developers.
|
||||
up-to-date. When in doubt, contact the LAMMPS developers.
|
||||
|
||||
## General structure
|
||||
|
||||
The layout and formatting of added files should follow the example
|
||||
of the existing files. Since those are directly derived from their
|
||||
former .txt format versions and the manual has been maintained in
|
||||
The layout and formatting of added files should follow the example of
|
||||
the existing files. Since many of those were initially derived from
|
||||
their former .txt format versions and the manual has been maintained in
|
||||
that format for many years, there is a large degree of consistency
|
||||
already, so comparison with similar files should give you a good
|
||||
idea what kind of information and sections are needed.
|
||||
already, so comparison with similar files should give you a good idea
|
||||
what kind of information and sections are needed.
|
||||
|
||||
## Formatting conventions
|
||||
|
||||
@ -52,21 +51,27 @@ It seems to be sufficient to have this consistent only within
|
||||
any single file and it is not (yet) enforced strictly, but making
|
||||
this globally consistent makes it easier to move sections around.
|
||||
|
||||
Filenames, folders, paths, (shell) commands, definitions, makefile
|
||||
File names, folders, paths, (shell) commands, definitions, makefile
|
||||
settings and similar should be formatted as "literals" with
|
||||
double backward quotes bracketing the item: \`\`path/to/some/file\`\`
|
||||
|
||||
Keywords and options are formatted in italics: \*option\*
|
||||
|
||||
Mathematical expressions, equations, symbols are typeset using
|
||||
either a `.. math:`` block or the `:math:` role.
|
||||
either a `.. math:` block or the `:math:` role.
|
||||
|
||||
Groups of shell commands or LAMMPS input script or C/C++ source
|
||||
Groups of shell commands or LAMMPS input script or C/C++/Python source
|
||||
code should be typeset into a `.. code-block::` section. A syntax
|
||||
highlighting extension for LAMMPS input scripts is provided, so
|
||||
`LAMMPS` can be used to indicate the language in the code block
|
||||
in addition to `bash`, `c`, or `python`. When no syntax style
|
||||
is indicated, no syntax highlighting is performed.
|
||||
highlighting extension for LAMMPS input scripts is provided, so `LAMMPS`
|
||||
can be used to indicate the language in the code block in addition to
|
||||
`bash`, `c`, `c++`, `console`, `csh`, `diff', `fortran`, `json`, `make`,
|
||||
`perl`, `powershell`, `python`, `sh`, or `tcl`, `text`, or `yaml`. When
|
||||
no syntax style is indicated, no syntax highlighting is performed. When
|
||||
typesetting commands executed on the shell, please do not prefix
|
||||
commands with a shell prompt and use `bash` highlighting, except when
|
||||
the block also shows the output from that command. In the latter case,
|
||||
please use a dollar sign as the shell prompt and `console` for syntax
|
||||
highlighting.
|
||||
|
||||
As an alternative, e.g. to typeset the syntax of file formats
|
||||
a `.. parsed-literal::` block can be used, which allows some
|
||||
@ -89,22 +94,30 @@ by ` :class: note`.
|
||||
|
||||
## Required steps when adding a custom style to LAMMPS
|
||||
|
||||
When adding a new style (e.g. pair style or a compute or a fix)
|
||||
or a new command, it is **required** to include the corresponding
|
||||
documentation. Those are often new files that need to be added.
|
||||
In order to be included in the documentation, those new files
|
||||
need to be reference in a `.. toctree::` block. Most of those
|
||||
use patterns with wildcards, so the addition will be automatic.
|
||||
However, those additions also need to be added to some lists of
|
||||
styles or commands. The `make style\_check` command will perform
|
||||
a test and report any missing entries and list the affected files.
|
||||
Any references defined with `.. \_refname:` have to be unique
|
||||
across all documentation files and this can be checked for with
|
||||
`make anchor\_check`. Finally, a spell-check should be done,
|
||||
which is triggered via `make spelling`. Any offenses need to
|
||||
be corrected and false positives should be added to the file
|
||||
`utils/sphinx-config/false\_positives.txt`.
|
||||
When adding a new style (e.g. pair style or a compute or a fix) or a new
|
||||
command, it is **required** to include the **corresponding documentation**
|
||||
in [reStructuredText format](https://docutils.sourceforge.io/rst.html).
|
||||
Those are often new files that need to be added. In order to be
|
||||
included in the documentation, those new files need to be referenced in a
|
||||
`.. toctree::` block. Most of those use patterns with wild cards, so the
|
||||
addition will be automatic. However, those additions also need to be
|
||||
added to some lists of styles or commands. The `make style\_check`
|
||||
command when executed in the `doc` folder will perform a test and report
|
||||
any missing entries and list the affected files. Any references defined
|
||||
with `.. \_refname:` have to be unique across all documentation files
|
||||
and this can be checked for with `make anchor\_check`. Finally, a
|
||||
spell-check should be done, which is triggered via `make spelling`. Any
|
||||
offenses need to be corrected and false positives should be added to the
|
||||
file `utils/sphinx-config/false\_positives.txt`.
|
||||
|
||||
## Required additional steps when adding a new package to LAMMPS
|
||||
|
||||
TODO
|
||||
When adding a new package, the package must be added to the list of
|
||||
packages in the `Packages_list.rst` file. If additional build instructions
|
||||
need to be followed, a corresponding section should be added to the
|
||||
`Build_extras.rst` file and linked from the list at the top of the
|
||||
file as well as the equivalent list in the `Build_packages.rst` file.
|
||||
|
||||
A detailed description of the package and pointers to configuration,
|
||||
included commands and examples, external pages, author information and
|
||||
more should be added to the `Packages_details.rst` file.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
.TH LAMMPS "1" "23 June 2022" "2022-6-23"
|
||||
.TH LAMMPS "1" "23 June 2022 - Update 4" "2022-6-23"
|
||||
.SH NAME
|
||||
.B LAMMPS
|
||||
\- Molecular Dynamics Simulator. Version 23 June 2022
|
||||
\- Molecular Dynamics Simulator. Version 23 June 2022 - Update 4
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B lmp
|
||||
|
||||
@ -314,7 +314,7 @@ Bibliography
|
||||
Espanol, Revenga, Physical Review E, 67, 026705 (2003).
|
||||
|
||||
**(Espanol1997)**
|
||||
Espanol, Europhys Lett, 40(6): 631-636 (1997). DOI: 10.1209/epl/i1997-00515-8
|
||||
Espanol, Europhys Lett, 40(6): 631-636 (1997). DOI:10.1209/epl/i1997-00515-8
|
||||
|
||||
**(Evans and Morriss)**
|
||||
Evans and Morriss, Phys Rev A, 30, 1528 (1984).
|
||||
@ -368,7 +368,7 @@ Bibliography
|
||||
Frenkel and Smit, Understanding Molecular Simulation, Academic Press, London, 2002.
|
||||
|
||||
**(GLE4MD)**
|
||||
`http://gle4md.org/ <http://gle4md.org/>`_
|
||||
`https://gle4md.org/ <https://gle4md.org/>`_
|
||||
|
||||
**(Gao)**
|
||||
Gao and Weber, Nuclear Instruments and Methods in Physics Research B 191 (2012) 504.
|
||||
@ -401,13 +401,13 @@ Bibliography
|
||||
Hayre, and Farago, Comp Phys Comm, 185, 524 (2014)
|
||||
|
||||
**(Groot)**
|
||||
Groot and Warren, J Chem Phys, 107: 4423-4435 (1997). DOI: 10.1063/1.474784
|
||||
Groot and Warren, J Chem Phys, 107: 4423-4435 (1997). DOI:10.1063/1.474784
|
||||
|
||||
**(Guenole)**
|
||||
Guenole, Noehring, Vaid, Houlle, Xie, Prakash, Bitzek, Comput Mater Sci, 175, 109584 (2020).
|
||||
|
||||
**(Gullet)**
|
||||
Gullet, Wagner, Slepoy, SANDIA Report 2003-8782 (2003).
|
||||
Gullet, Wagner, Slepoy, SANDIA Report 2003-8782 (2003). DOI:10.2172/918395
|
||||
|
||||
**(Guo)**
|
||||
Guo and Thirumalai, Journal of Molecular Biology, 263, 323-43 (1996).
|
||||
@ -461,7 +461,7 @@ Bibliography
|
||||
Hunt, Mol Simul, 42, 347 (2016).
|
||||
|
||||
**(IPI)**
|
||||
`http://epfl-cosmo.github.io/gle4md/index.html?page=ipi <http://epfl-cosmo.github.io/gle4md/index.html?page=ipi>`_
|
||||
`https://ipi-code.org/ <https://ipi-code.org/>`
|
||||
|
||||
**(IPI-CPC)**
|
||||
Ceriotti, More and Manolopoulos, Comp Phys Comm, 185, 1019-1026 (2014).
|
||||
@ -605,16 +605,16 @@ Bibliography
|
||||
I.\ Leven et al, J. Chem.Theory Comput. 12, 2896-905 (2016).
|
||||
|
||||
**(Li2013_POF)**
|
||||
Li, Hu, Wang, Ma, Zhou, Phys Fluids, 25: 072103 (2013). DOI: 10.1063/1.4812366.
|
||||
Li, Hu, Wang, Ma, Zhou, Phys Fluids, 25: 072103 (2013). DOI:10.1063/1.4812366.
|
||||
|
||||
**(Li2014_JCP)**
|
||||
Li, Tang, Lei, Caswell, Karniadakis, J Comput Phys, 265: 113-127 (2014). DOI: 10.1016/j.jcp.2014.02.003.
|
||||
Li, Tang, Lei, Caswell, Karniadakis, J Comput Phys, 265: 113-127 (2014). DOI:10.1016/j.jcp.2014.02.003.
|
||||
|
||||
**(Li2015_CC)**
|
||||
Li, Tang, Li, Karniadakis, Chem Commun, 51: 11038-11040 (2015). DOI: 10.1039/C5CC01684C.
|
||||
Li, Tang, Li, Karniadakis, Chem Commun, 51: 11038-11040 (2015). DOI:10.1039/C5CC01684C.
|
||||
|
||||
**(Li2015_JCP)**
|
||||
Li, Yazdani, Tartakovsky, Karniadakis, J Chem Phys, 143: 014101 (2015). DOI: 10.1063/1.4923254.
|
||||
Li, Yazdani, Tartakovsky, Karniadakis, J Chem Phys, 143: 014101 (2015). DOI:10.1063/1.4923254.
|
||||
|
||||
**(Lisal)**
|
||||
M.\ Lisal, J.K. Brennan, J. Bonet Avalos, "Dissipative particle dynamics at isothermal, isobaric, isoenergetic, and isoenthalpic conditions using Shardlow-like splitting algorithms.",
|
||||
@ -733,8 +733,8 @@ Bibliography
|
||||
**(Mishin)**
|
||||
Mishin, Mehl, and Papaconstantopoulos, Acta Mater, 53, 4029 (2005).
|
||||
|
||||
**(Mitchell and Finchham)**
|
||||
Mitchell, Finchham, J Phys Condensed Matter, 5, 1031-1038 (1993).
|
||||
**(Mitchell and Fincham)**
|
||||
Mitchell, Fincham, J Phys Condensed Matter, 5, 1031-1038 (1993).
|
||||
|
||||
**(Mitchell2011)**
|
||||
Mitchell. A non-local, ordinary-state-based viscoelasticity model for peridynamics. Sandia National Lab Report, 8064:1-28 (2011).
|
||||
@ -875,7 +875,7 @@ Bibliography
|
||||
G.A. Tribello, M. Bonomi, D. Branduardi, C. Camilloni and G. Bussi, Comp. Phys. Comm 185, 604 (2014)
|
||||
|
||||
**(Paquay)**
|
||||
Paquay and Kusters, Biophys. J., 110, 6, (2016). preprint available at `arXiv:1411.3019 <http://arxiv.org/abs/1411.3019/>`_.
|
||||
Paquay and Kusters, Biophys. J., 110, 6, (2016). preprint available at `arXiv:1411.3019 <https://arxiv.org/abs/1411.3019/>`_.
|
||||
|
||||
**(Park)**
|
||||
Park, Schulten, J. Chem. Phys. 120 (13), 5946 (2004)
|
||||
@ -1373,7 +1373,7 @@ Bibliography
|
||||
Zhu, Tajkhorshid, and Schulten, Biophys. J. 83, 154 (2002).
|
||||
|
||||
**(Ziegler)**
|
||||
J.F. Ziegler, J. P. Biersack and U. Littmark, "The Stopping and Range of Ions in Matter," Volume 1, Pergamon, 1985.
|
||||
J.F. Ziegler, J. P. Biersack and U. Littmark, "The Stopping and Range of Ions in Matter", Volume 1, Pergamon, 1985.
|
||||
|
||||
**(Zimmerman2004)**
|
||||
Zimmerman, JA; Webb, EB; Hoyt, JJ;. Jones, RE; Klein, PA; Bammann, DJ, "Calculation of stress in atomistic simulation." Special Issue of Modelling and Simulation in Materials Science and Engineering (2004),12:S319.
|
||||
|
||||
@ -276,7 +276,7 @@ LAMMPS.
|
||||
|
||||
Parallel build (see ``src/MAKE/Makefile.mpi``):
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: make
|
||||
|
||||
CC = mpicxx
|
||||
CCFLAGS = -g -O3
|
||||
@ -296,7 +296,7 @@ LAMMPS.
|
||||
|
||||
If compilation stops with a message like the following:
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: output
|
||||
|
||||
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../STUBS -c ../main.cpp
|
||||
In file included from ../pointers.h:24:0,
|
||||
|
||||
@ -140,7 +140,7 @@ of the LAMMPS project on GitHub.
|
||||
The unit testing facility is integrated into the CMake build process
|
||||
of the LAMMPS source code distribution itself. It can be enabled by
|
||||
setting ``-D ENABLE_TESTING=on`` during the CMake configuration step.
|
||||
It requires the `YAML <http://pyyaml.org/>`_ library and development
|
||||
It requires the `YAML <https://pyyaml.org/>`_ library and development
|
||||
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
|
||||
@ -154,32 +154,48 @@ for implementing the tests.
|
||||
framework are more strict than for the main part of LAMMPS. For
|
||||
example the default GNU C++ and Fortran compilers of RHEL/CentOS 7.x
|
||||
(version 4.8.x) are not sufficient. The CMake configuration will try
|
||||
to detect compatible versions and either skip incompatible tests or
|
||||
stop with an error.
|
||||
to detect incompatible versions and either skip incompatible tests or
|
||||
stop with an error. Also the number of tests will depend on
|
||||
installed LAMMPS packages, development environment, operating system,
|
||||
and configuration settings.
|
||||
|
||||
After compilation is complete, the unit testing is started in the build
|
||||
folder using the ``ctest`` command, which is part of the CMake software.
|
||||
The output of this command will be looking something like this::
|
||||
The output of this command will be looking something like this:
|
||||
|
||||
[...]$ ctest
|
||||
Test project /home/akohlmey/compile/lammps/build-testing
|
||||
Start 1: MolPairStyle:hybrid-overlay
|
||||
1/109 Test #1: MolPairStyle:hybrid-overlay ......... Passed 0.02 sec
|
||||
Start 2: MolPairStyle:hybrid
|
||||
2/109 Test #2: MolPairStyle:hybrid ................. Passed 0.01 sec
|
||||
Start 3: MolPairStyle:lj_class2
|
||||
[...]
|
||||
Start 107: PotentialFileReader
|
||||
107/109 Test #107: PotentialFileReader ................ Passed 0.04 sec
|
||||
Start 108: EIMPotentialFileReader
|
||||
108/109 Test #108: EIMPotentialFileReader ............. Passed 0.03 sec
|
||||
Start 109: TestSimpleCommands
|
||||
109/109 Test #109: TestSimpleCommands ................. Passed 0.02 sec
|
||||
.. code-block:: console
|
||||
|
||||
100% tests passed, 0 tests failed out of 26
|
||||
$ ctest
|
||||
Test project /home/akohlmey/compile/lammps/build-testing
|
||||
Start 1: RunLammps
|
||||
1/563 Test #1: RunLammps .......................................... Passed 0.28 sec
|
||||
Start 2: HelpMessage
|
||||
2/563 Test #2: HelpMessage ........................................ Passed 0.06 sec
|
||||
Start 3: InvalidFlag
|
||||
3/563 Test #3: InvalidFlag ........................................ Passed 0.06 sec
|
||||
Start 4: Tokenizer
|
||||
4/563 Test #4: Tokenizer .......................................... Passed 0.05 sec
|
||||
Start 5: MemPool
|
||||
5/563 Test #5: MemPool ............................................ Passed 0.05 sec
|
||||
Start 6: ArgUtils
|
||||
6/563 Test #6: ArgUtils ........................................... Passed 0.05 sec
|
||||
[...]
|
||||
Start 561: ImproperStyle:zero
|
||||
561/563 Test #561: ImproperStyle:zero ................................. Passed 0.07 sec
|
||||
Start 562: TestMliapPyUnified
|
||||
562/563 Test #562: TestMliapPyUnified ................................. Passed 0.16 sec
|
||||
Start 563: TestPairList
|
||||
563/563 Test #563: TestPairList ....................................... Passed 0.06 sec
|
||||
|
||||
Total Test time (real) = 25.57 sec
|
||||
100% tests passed, 0 tests failed out of 563
|
||||
|
||||
Label Time Summary:
|
||||
generated = 0.85 sec*proc (3 tests)
|
||||
noWindows = 4.16 sec*proc (2 tests)
|
||||
slow = 78.33 sec*proc (67 tests)
|
||||
unstable = 28.23 sec*proc (34 tests)
|
||||
|
||||
Total Test time (real) = 132.34 sec
|
||||
|
||||
The ``ctest`` command has many options, the most important ones are:
|
||||
|
||||
@ -210,11 +226,13 @@ Fortran) and testing different aspects of the LAMMPS software and its features.
|
||||
The tests will adapt to the compilation settings of LAMMPS, so that tests
|
||||
will be skipped if prerequisite features are not available in LAMMPS.
|
||||
|
||||
.. note::
|
||||
.. admonition:: Work in Progress
|
||||
:class: note
|
||||
|
||||
The unit test framework was added in spring 2020 and is under active
|
||||
development. The coverage is not complete and will be expanded over
|
||||
time.
|
||||
time. Preference is given to parts of the code base that are easy to
|
||||
test or commonly used.
|
||||
|
||||
Tests for styles of the same kind of style (e.g. pair styles or bond
|
||||
styles) are performed with the same test executable using different
|
||||
@ -248,9 +266,9 @@ the CMake option ``-D BUILD_MPI=off`` can significantly speed up testing,
|
||||
since this will skip the MPI initialization for each test run.
|
||||
Below is an example command and output:
|
||||
|
||||
.. parsed-literal::
|
||||
.. code-block:: console
|
||||
|
||||
[tests]$ test_pair_style mol-pair-lj_cut.yaml
|
||||
$ test_pair_style mol-pair-lj_cut.yaml
|
||||
[==========] Running 6 tests from 1 test suite.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 6 tests from PairStyle
|
||||
@ -530,7 +548,7 @@ commands like the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ clang-format -i some_file.cpp
|
||||
clang-format -i some_file.cpp
|
||||
|
||||
|
||||
The following target are available for both, GNU make and CMake:
|
||||
@ -539,3 +557,19 @@ The following target are available for both, GNU make and CMake:
|
||||
|
||||
make format-src # apply clang-format to all files in src and the package folders
|
||||
make format-tests # apply clang-format to all files in the unittest tree
|
||||
|
||||
----------
|
||||
|
||||
.. _gh-cli:
|
||||
|
||||
GitHub command line interface
|
||||
-----------------------------
|
||||
|
||||
GitHub is developing a `tool for the command line
|
||||
<https://cli.github.com>`_ that interacts with the GitHub website via a
|
||||
command called ``gh``. This can be extremely convenient when working
|
||||
with a Git repository hosted on GitHub (like LAMMPS). It is thus highly
|
||||
recommended to install it when doing LAMMPS development.
|
||||
|
||||
The capabilities of the ``gh`` command is continually expanding, so
|
||||
please see the documentation at https://cli.github.com/manual/
|
||||
|
||||
@ -12,11 +12,11 @@ in addition to
|
||||
- Traditional make
|
||||
* - .. code-block:: bash
|
||||
|
||||
$ cmake -D PKG_NAME=yes
|
||||
cmake -D PKG_NAME=yes
|
||||
|
||||
- .. code-block:: bash
|
||||
- .. code-block:: console
|
||||
|
||||
$ make yes-name
|
||||
make yes-name
|
||||
|
||||
as described on the :doc:`Build_package <Build_package>` page.
|
||||
|
||||
@ -28,14 +28,16 @@ You may need to tell LAMMPS where it is found on your system.
|
||||
|
||||
This is the list of packages that may require additional steps.
|
||||
|
||||
.. this list must be kept in sync with its counterpart in Build_package.rst
|
||||
.. table_from_list::
|
||||
:columns: 6
|
||||
|
||||
* :ref:`ADIOS <adios>`
|
||||
* :ref:`ATC <atc>`
|
||||
* :ref:`AWPMD <awpmd>`
|
||||
* :ref:`COLVARS <colvars>`
|
||||
* :ref:`COLVARS <colvar>`
|
||||
* :ref:`COMPRESS <compress>`
|
||||
* :ref:`ELECTRODE <electrode>`
|
||||
* :ref:`GPU <gpu>`
|
||||
* :ref:`H5MD <h5md>`
|
||||
* :ref:`INTEL <intel>`
|
||||
@ -148,7 +150,9 @@ CMake build
|
||||
* sm_60 or sm_61 for Pascal (supported since CUDA 8)
|
||||
* sm_70 for Volta (supported since CUDA 9)
|
||||
* sm_75 for Turing (supported since CUDA 10)
|
||||
* sm_80 for Ampere (supported since CUDA 11)
|
||||
* sm_80 or sm_86 for Ampere (supported since CUDA 11, sm_86 since CUDA 11.1)
|
||||
* sm_89 for Lovelace (supported since CUDA 11.8)
|
||||
* sm_90 for Hopper (supported since CUDA 12.0)
|
||||
|
||||
A more detailed list can be found, for example,
|
||||
at `Wikipedia's CUDA article <https://en.wikipedia.org/wiki/CUDA#GPUs_supported>`_
|
||||
@ -221,10 +225,10 @@ script with the specified args:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-gpu # print help message
|
||||
$ make lib-gpu args="-b" # build GPU library with default Makefile.linux
|
||||
$ make lib-gpu args="-m xk7 -p single -o xk7.single" # create new Makefile.xk7.single, altered for single-precision
|
||||
$ make lib-gpu args="-m mpi -a sm_60 -p mixed -b" # build GPU library with mixed precision and P100 using other settings in Makefile.mpi
|
||||
make lib-gpu # print help message
|
||||
make lib-gpu args="-b" # build GPU library with default Makefile.linux
|
||||
make lib-gpu args="-m xk7 -p single -o xk7.single" # create new Makefile.xk7.single, altered for single-precision
|
||||
make lib-gpu args="-m mpi -a sm_60 -p mixed -b" # build GPU library with mixed precision and P100 using other settings in Makefile.mpi
|
||||
|
||||
Note that this procedure starts with a Makefile.machine in lib/gpu, as
|
||||
specified by the "-m" switch. For your convenience, machine makefiles
|
||||
@ -337,13 +341,13 @@ minutes to hours) to build. Of course you only need to do that once.)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-kim # print help message
|
||||
$ make lib-kim args="-b " # (re-)install KIM API lib with only example models
|
||||
$ make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model
|
||||
$ make lib-kim args="-b -a everything" # install KIM API lib with all models
|
||||
$ make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver
|
||||
$ make lib-kim args="-p /usr/local" # use an existing KIM API installation at the provided location
|
||||
$ make lib-kim args="-p /usr/local -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # ditto but add one model or driver
|
||||
make lib-kim # print help message
|
||||
make lib-kim args="-b " # (re-)install KIM API lib with only example models
|
||||
make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model
|
||||
make lib-kim args="-b -a everything" # install KIM API lib with all models
|
||||
make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver
|
||||
make lib-kim args="-p /usr/local" # use an existing KIM API installation at the provided location
|
||||
make lib-kim args="-p /usr/local -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # ditto but add one model or driver
|
||||
|
||||
When using the "-b " option, the KIM library is built using its native
|
||||
cmake build system. The ``lib/kim/Install.py`` script supports a
|
||||
@ -355,7 +359,7 @@ minutes to hours) to build. Of course you only need to do that once.)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ CMAKE=cmake3 CXX=g++-11 CC=gcc-11 FC=gfortran-11 make lib-kim args="-b " # (re-)install KIM API lib using cmake3 and gnu v11 compilers with only example models
|
||||
CMAKE=cmake3 CXX=g++-11 CC=gcc-11 FC=gfortran-11 make lib-kim args="-b " # (re-)install KIM API lib using cmake3 and gnu v11 compilers with only example models
|
||||
|
||||
Settings for debugging OpenKIM web queries discussed below need to
|
||||
be applied by adding them to the ``LMP_INC`` variable through
|
||||
@ -808,11 +812,11 @@ library.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-latte # print help message
|
||||
$ make lib-latte args="-b" # download and build in lib/latte/LATTE-master
|
||||
$ make lib-latte args="-p $HOME/latte" # use existing LATTE installation in $HOME/latte
|
||||
$ make lib-latte args="-b -m gfortran" # download and build in lib/latte and
|
||||
# copy Makefile.lammps.gfortran to Makefile.lammps
|
||||
make lib-latte # print help message
|
||||
make lib-latte args="-b" # download and build in lib/latte/LATTE-master
|
||||
make lib-latte args="-p $HOME/latte" # use existing LATTE installation in $HOME/latte
|
||||
make lib-latte args="-b -m gfortran" # download and build in lib/latte and
|
||||
# copy Makefile.lammps.gfortran to Makefile.lammps
|
||||
|
||||
Note that 3 symbolic (soft) links, ``includelink`` and ``liblink``
|
||||
and ``filelink.o``, are created in ``lib/latte`` to point to
|
||||
@ -911,12 +915,12 @@ more details.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-mscg # print help message
|
||||
$ make lib-mscg args="-b -m serial" # download and build in lib/mscg/MSCG-release-master
|
||||
# with the settings compatible with "make serial"
|
||||
$ make lib-mscg args="-b -m mpi" # download and build in lib/mscg/MSCG-release-master
|
||||
# with the settings compatible with "make mpi"
|
||||
$ make lib-mscg args="-p /usr/local/mscg-release" # use the existing MS-CG installation in /usr/local/mscg-release
|
||||
make lib-mscg # print help message
|
||||
make lib-mscg args="-b -m serial" # download and build in lib/mscg/MSCG-release-master
|
||||
# with the settings compatible with "make serial"
|
||||
make lib-mscg args="-b -m mpi" # download and build in lib/mscg/MSCG-release-master
|
||||
# with the settings compatible with "make mpi"
|
||||
make lib-mscg args="-p /usr/local/mscg-release" # use the existing MS-CG installation in /usr/local/mscg-release
|
||||
|
||||
Note that 2 symbolic (soft) links, ``includelink`` and ``liblink``,
|
||||
will be created in ``lib/mscg`` to point to the MS-CG
|
||||
@ -968,10 +972,10 @@ POEMS package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-poems # print help message
|
||||
$ make lib-poems args="-m serial" # build with GNU g++ compiler (settings as with "make serial")
|
||||
$ make lib-poems args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi")
|
||||
$ make lib-poems args="-m icc" # build with Intel icc compiler
|
||||
make lib-poems # print help message
|
||||
make lib-poems args="-m serial" # build with GNU g++ compiler (settings as with "make serial")
|
||||
make lib-poems args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi")
|
||||
make lib-poems args="-m icc" # build with Intel icc compiler
|
||||
|
||||
The build should produce two files: ``lib/poems/libpoems.a`` and
|
||||
``lib/poems/Makefile.lammps``. The latter is copied from an
|
||||
@ -1057,10 +1061,10 @@ binary package provided by your operating system.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-voronoi # print help message
|
||||
$ make lib-voronoi args="-b" # download and build the default version in lib/voronoi/voro++-<version>
|
||||
$ make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++
|
||||
$ make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6
|
||||
make lib-voronoi # print help message
|
||||
make lib-voronoi args="-b" # download and build the default version in lib/voronoi/voro++-<version>
|
||||
make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++
|
||||
make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6
|
||||
|
||||
Note that 2 symbolic (soft) links, ``includelink`` and
|
||||
``liblink``, are created in lib/voronoi to point to the Voro++
|
||||
@ -1101,13 +1105,13 @@ systems.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make yes-adios
|
||||
make yes-adios
|
||||
|
||||
otherwise, set ADIOS2_DIR environment variable when turning on the package:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ADIOS2_DIR=path make yes-adios # path is where ADIOS 2.x is installed
|
||||
ADIOS2_DIR=path make yes-adios # path is where ADIOS 2.x is installed
|
||||
|
||||
----------
|
||||
|
||||
@ -1136,10 +1140,10 @@ The ATC package requires the MANYBODY package also be installed.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-atc # print help message
|
||||
$ make lib-atc args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial")
|
||||
$ make lib-atc args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
$ make lib-atc args="-m icc" # build with Intel icc compiler
|
||||
make lib-atc # print help message
|
||||
make lib-atc args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial")
|
||||
make lib-atc args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
make lib-atc args="-m icc" # build with Intel icc compiler
|
||||
|
||||
The build should produce two files: ``lib/atc/libatc.a`` and
|
||||
``lib/atc/Makefile.lammps``. The latter is copied from an
|
||||
@ -1158,17 +1162,17 @@ The ATC package requires the MANYBODY package also be installed.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-linalg # print help message
|
||||
$ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial")
|
||||
$ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi")
|
||||
$ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
|
||||
make lib-linalg # print help message
|
||||
make lib-linalg args="-m serial" # build with GNU C++ compiler (settings as with "make serial")
|
||||
make lib-linalg args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi")
|
||||
make lib-linalg args="-m g++" # build with GNU Fortran compiler
|
||||
|
||||
----------
|
||||
|
||||
.. _awpmd:
|
||||
|
||||
AWPMD package
|
||||
------------------
|
||||
-------------
|
||||
|
||||
.. tabs::
|
||||
|
||||
@ -1187,10 +1191,10 @@ AWPMD package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-awpmd # print help message
|
||||
$ make lib-awpmd args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial")
|
||||
$ make lib-awpmd args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
$ make lib-awpmd args="-m icc" # build with Intel icc compiler
|
||||
make lib-awpmd # print help message
|
||||
make lib-awpmd args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial")
|
||||
make lib-awpmd args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
make lib-awpmd args="-m icc" # build with Intel icc compiler
|
||||
|
||||
The build should produce two files: ``lib/awpmd/libawpmd.a`` and
|
||||
``lib/awpmd/Makefile.lammps``. The latter is copied from an
|
||||
@ -1209,21 +1213,20 @@ AWPMD package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-linalg # print help message
|
||||
$ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial")
|
||||
$ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi")
|
||||
$ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
|
||||
make lib-linalg # print help message
|
||||
make lib-linalg args="-m serial" # build with GNU C++ compiler (settings as with "make serial")
|
||||
make lib-linalg args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi")
|
||||
make lib-linalg args="-m g++" # build with GNU C++ compiler
|
||||
|
||||
----------
|
||||
|
||||
.. _colvars:
|
||||
.. _colvar:
|
||||
|
||||
COLVARS package
|
||||
---------------------------------------
|
||||
---------------
|
||||
|
||||
This package includes the `Colvars library
|
||||
<https://colvars.github.io/>`_ into the LAMMPS distribution, which can
|
||||
be built for the most part with all major versions of the C++ language.
|
||||
This package enables the use of the `Colvars <https://colvars.github.io/>`_
|
||||
module included in the LAMMPS source distribution.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@ -1250,10 +1253,10 @@ be built for the most part with all major versions of the C++ language.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-colvars # print help message
|
||||
$ make lib-colvars args="-m serial" # build with GNU g++ compiler (settings as with "make serial")
|
||||
$ make lib-colvars args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
$ make lib-colvars args="-m g++-debug" # build with GNU g++ compiler and colvars debugging enabled
|
||||
make lib-colvars # print help message
|
||||
make lib-colvars args="-m serial" # build with GNU g++ compiler (settings as with "make serial")
|
||||
make lib-colvars args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
make lib-colvars args="-m g++-debug" # build with GNU g++ compiler and colvars debugging enabled
|
||||
|
||||
The "machine" argument of the "-m" flag is used to find a
|
||||
Makefile.machine to use as build recipe. If it does not already
|
||||
@ -1265,8 +1268,8 @@ be built for the most part with all major versions of the C++ language.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ COLVARS_DEBUG=yes make lib-colvars args="-m machine" # Build with debug code (much slower)
|
||||
$ COLVARS_LEPTON=no make lib-colvars args="-m machine" # Build without Lepton (included otherwise)
|
||||
COLVARS_DEBUG=yes make lib-colvars args="-m machine" # Build with debug code (much slower)
|
||||
COLVARS_LEPTON=no make lib-colvars args="-m machine" # Build without Lepton (included otherwise)
|
||||
|
||||
The build should produce two files: the library ``lib/colvars/libcolvars.a``
|
||||
(which also includes Lepton objects if enabled) and the specification file
|
||||
@ -1300,9 +1303,9 @@ This package depends on the KSPACE package.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-electrode # print help message
|
||||
$ make lib-electrode args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial")
|
||||
$ make lib-electrode args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
make lib-electrode # print help message
|
||||
make lib-electrode args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial")
|
||||
make lib-electrode args="-m mpi" # build with default MPI compiler (settings as with "make mpi")
|
||||
|
||||
|
||||
Note that the ``Makefile.lammps`` file has settings for the BLAS
|
||||
@ -1313,10 +1316,10 @@ This package depends on the KSPACE package.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-linalg # print help message
|
||||
$ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial")
|
||||
$ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi")
|
||||
$ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
|
||||
make lib-linalg # print help message
|
||||
make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial")
|
||||
make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi")
|
||||
make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
|
||||
|
||||
The package itself is activated with ``make yes-KSPACE`` and
|
||||
``make yes-ELECTRODE``
|
||||
@ -1356,8 +1359,8 @@ at: `https://github.com/ICAMS/lammps-user-pace/ <https://github.com/ICAMS/lammps
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-pace # print help message
|
||||
$ make lib-pace args="-b" # download and build the default version in lib/pace
|
||||
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.
|
||||
|
||||
@ -1456,10 +1459,10 @@ LAMMPS build.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-plumed # print help message
|
||||
$ make lib-plumed args="-b" # download and build PLUMED in lib/plumed/plumed2
|
||||
$ make lib-plumed args="-p $HOME/.local" # use existing PLUMED installation in $HOME/.local
|
||||
$ make lib-plumed args="-p /usr/local -m shared" # use existing PLUMED installation in
|
||||
make lib-plumed # print help message
|
||||
make lib-plumed args="-b" # download and build PLUMED in lib/plumed/plumed2
|
||||
make lib-plumed args="-p $HOME/.local" # use existing PLUMED installation in $HOME/.local
|
||||
make lib-plumed args="-p /usr/local -m shared" # use existing PLUMED installation in
|
||||
# /usr/local and use shared linkage mode
|
||||
|
||||
Note that 2 symbolic (soft) links, ``includelink`` and ``liblink``
|
||||
@ -1472,8 +1475,8 @@ LAMMPS build.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make yes-plumed
|
||||
$ make machine
|
||||
make yes-plumed
|
||||
make machine
|
||||
|
||||
Once this compilation completes you should be able to run LAMMPS
|
||||
in the usual way. For shared linkage mode, libplumed.so must be
|
||||
@ -1525,8 +1528,8 @@ the HDF5 library.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-h5md # print help message
|
||||
$ make lib-h5md args="-m h5cc" # build with h5cc compiler
|
||||
make lib-h5md # print help message
|
||||
make lib-h5md args="-m h5cc" # build with h5cc compiler
|
||||
|
||||
The build should produce two files: ``lib/h5md/libch5md.a`` and
|
||||
``lib/h5md/Makefile.lammps``. The latter is copied from an
|
||||
@ -1580,10 +1583,10 @@ details please see ``lib/hdnnp/README`` and the `n2p2 build documentation
|
||||
|
||||
.. 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
|
||||
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
|
||||
@ -1683,8 +1686,8 @@ MDI package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ python Install.py -m gcc # build using gcc compiler
|
||||
$ python Install.py -m icc # build using icc compiler
|
||||
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``\ .
|
||||
@ -1718,9 +1721,9 @@ they will be downloaded the first time this package is installed.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-mesont # print help message
|
||||
$ make lib-mesont args="-m gfortran" # build with GNU g++ compiler (settings as with "make serial")
|
||||
$ make lib-mesont args="-m ifort" # build with Intel icc compiler
|
||||
make lib-mesont # print help message
|
||||
make lib-mesont args="-m gfortran" # build with GNU g++ compiler (settings as with "make serial")
|
||||
make lib-mesont args="-m ifort" # build with Intel icc compiler
|
||||
|
||||
The build should produce two files: ``lib/mesont/libmesont.a`` and
|
||||
``lib/mesont/Makefile.lammps``\ . The latter is copied from an
|
||||
@ -1833,6 +1836,22 @@ OPENMP package
|
||||
For other platforms and compilers, please consult the
|
||||
documentation about OpenMP support for your compiler.
|
||||
|
||||
.. admonition:: Adding OpenMP support on macOS
|
||||
:class: note
|
||||
|
||||
Apple offers the `Xcode package and IDE
|
||||
<https://developer.apple.com/xcode/>`_ for compiling software on
|
||||
macOS, so you have likely installed it to compile LAMMPS. Their
|
||||
compiler is based on `Clang <https://clang.llvm.org/>`, but while it
|
||||
is capable of processing OpenMP directives, the necessary header
|
||||
files and OpenMP runtime library are missing. The `R developers
|
||||
<https://www.r-project.org/>` have figured out a way to build those
|
||||
in a compatible fashion. One can download them from
|
||||
`https://mac.r-project.org/openmp/
|
||||
<https://mac.r-project.org/openmp/>`_. Simply adding those files as
|
||||
instructed enables the Xcode C++ compiler to compile LAMMPS with ``-D
|
||||
BUILD_OMP=yes``.
|
||||
|
||||
----------
|
||||
|
||||
.. _qmmm:
|
||||
@ -1887,10 +1906,10 @@ verified to work in February 2020 with Quantum Espresso versions 6.3 to
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-qmmm # print help message
|
||||
$ make lib-qmmm args="-m serial" # build with GNU Fortran compiler (settings as in "make serial")
|
||||
$ make lib-qmmm args="-m mpi" # build with default MPI compiler (settings as in "make mpi")
|
||||
$ make lib-qmmm args="-m gfortran" # build with GNU Fortran compiler
|
||||
make lib-qmmm # print help message
|
||||
make lib-qmmm args="-m serial" # build with GNU Fortran compiler (settings as in "make serial")
|
||||
make lib-qmmm args="-m mpi" # build with default MPI compiler (settings as in "make mpi")
|
||||
make lib-qmmm args="-m gfortran" # build with GNU Fortran compiler
|
||||
|
||||
The build should produce two files: ``lib/qmmm/libqmmm.a`` and
|
||||
``lib/qmmm/Makefile.lammps``. The latter is copied from an
|
||||
@ -1929,7 +1948,7 @@ within CMake will download the non-commercial use version.
|
||||
|
||||
-D DOWNLOAD_QUIP=value # download QUIP library for build, value = no (default) or yes
|
||||
-D QUIP_LIBRARY=path # path to libquip.a (only needed if a custom location)
|
||||
|
||||
|
||||
CMake will try to download and build the QUIP library from GitHub, if it is not
|
||||
found on the local machine. This requires to have git installed. It will use the same compilers
|
||||
and flags as used for compiling LAMMPS. Currently this is only supported for the GNU and the
|
||||
@ -2028,9 +2047,9 @@ Eigen3 is a template library, so you do not need to build it.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lib-smd # print help message
|
||||
$ make lib-smd args="-b" # download to lib/smd/eigen3
|
||||
$ make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3
|
||||
make lib-smd # print help message
|
||||
make lib-smd args="-b" # download to lib/smd/eigen3
|
||||
make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3
|
||||
|
||||
Note that a symbolic (soft) link named ``includelink`` is created
|
||||
in ``lib/smd`` to point to the Eigen dir. When LAMMPS builds it
|
||||
|
||||
@ -209,7 +209,7 @@ You can verify whether all required shared libraries are found with the
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ LD_LIBRARY_PATH=/home/user/lammps/src ldd caller
|
||||
LD_LIBRARY_PATH=/home/user/lammps/src ldd caller
|
||||
linux-vdso.so.1 (0x00007ffe729e0000)
|
||||
liblammps.so => /home/user/lammps/src/liblammps.so (0x00007fc91bb9e000)
|
||||
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fc91b984000)
|
||||
@ -222,7 +222,7 @@ If a required library is missing, you would get a 'not found' entry:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ldd caller
|
||||
ldd caller
|
||||
linux-vdso.so.1 (0x00007ffd672fe000)
|
||||
liblammps.so => not found
|
||||
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fb7c7e86000)
|
||||
|
||||
@ -48,18 +48,15 @@ Build using GNU make
|
||||
|
||||
The LAMMPS manual is written in `reStructuredText <rst_>`_ format which
|
||||
can be translated to different output format using the `Sphinx
|
||||
<sphinx_>`_ document generator tool. It also incorporates programmer
|
||||
documentation extracted from the LAMMPS C++ sources through the `Doxygen
|
||||
<https://doxygen.nl>`_ program. Currently the translation to HTML, PDF
|
||||
(via LaTeX), ePUB (for many e-book readers) and MOBI (for Amazon Kindle
|
||||
readers) are supported. For that to work a Python 3 interpreter, the
|
||||
``doxygen`` tools and internet access to download additional files and
|
||||
tools are required. This download is usually only required once or
|
||||
after the documentation folder is returned to a pristine state with
|
||||
``make clean-all``.
|
||||
|
||||
.. _rst: https://docutils.readthedocs.io/en/sphinx-docs/user/rst/quickstart.html
|
||||
.. _sphinx: https://www.sphinx-doc.org
|
||||
<https://sphinx-doc.org>`_ document generator tool. It also
|
||||
incorporates programmer documentation extracted from the LAMMPS C++
|
||||
sources through the `Doxygen <https://doxygen.nl>`_ program. Currently
|
||||
the translation to HTML, PDF (via LaTeX), ePUB (for many e-book readers)
|
||||
and MOBI (for Amazon Kindle readers) are supported. For that to work a
|
||||
Python 3 interpreter, the ``doxygen`` tools and internet access to
|
||||
download additional files and tools are required. This download is
|
||||
usually only required once or after the documentation folder is returned
|
||||
to a pristine state with ``make clean-all``.
|
||||
|
||||
For the documentation build a python virtual environment is set up in
|
||||
the folder ``doc/docenv`` and various python packages are installed into
|
||||
@ -128,38 +125,29 @@ common setups:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install python-virtualenv git doxygen
|
||||
sudo apt-get install git doxygen
|
||||
|
||||
.. tab:: RHEL or CentOS (Version 7.x)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo yum install python3-virtualenv git doxygen
|
||||
sudo yum install git doxygen
|
||||
|
||||
.. tab:: Fedora or RHEL/CentOS (8.x or later)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo dnf install python3-virtualenv git doxygen
|
||||
sudo dnf install git doxygen
|
||||
|
||||
.. tab:: MacOS X
|
||||
.. tab:: macOS
|
||||
|
||||
*Python 3*
|
||||
|
||||
Download the latest Python 3 MacOS X package from
|
||||
If Python 3 is not available on your macOS system, you can
|
||||
download the latest Python 3 macOS package from
|
||||
`https://www.python.org <https://www.python.org>`_ and install it.
|
||||
This will install both Python 3 and pip3.
|
||||
|
||||
*virtualenv*
|
||||
|
||||
Once Python 3 is installed, open a Terminal and type
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install virtualenv
|
||||
|
||||
This will install virtualenv from the Python Package Index.
|
||||
|
||||
Prerequisites for PDF
|
||||
---------------------
|
||||
|
||||
@ -179,7 +167,7 @@ math expressions transparently into embedded images.
|
||||
For converting the generated ePUB file to a MOBI format file (for e-book
|
||||
readers, like Kindle, that cannot read ePUB), you also need to have the
|
||||
``ebook-convert`` tool from the "calibre" software
|
||||
installed. `http://calibre-ebook.com/ <http://calibre-ebook.com/>`_
|
||||
installed. `https://calibre-ebook.com/ <https://calibre-ebook.com/>`_
|
||||
Typing ``make mobi`` will first create the ePUB file and then convert
|
||||
it. On the Kindle readers in particular, you also have support for PDF
|
||||
files, so you could download and view the PDF version as an alternative.
|
||||
@ -219,9 +207,20 @@ be multiple tests run automatically:
|
||||
- A test that only standard, printable ASCII text characters are used.
|
||||
This runs the command ``env LC_ALL=C grep -n '[^ -~]' src/*.rst`` and
|
||||
thus prints all offending lines with filename and line number
|
||||
prepended to the screen. Special characters like the Angstrom
|
||||
:math:`\mathrm{\mathring{A}}` should be typeset with embedded math
|
||||
(like this ``:math:`\mathrm{\mathring{A}}```\ ).
|
||||
prepended to the screen. Special characters like Greek letters
|
||||
(:math:`\alpha~~\sigma~~\epsilon`), super- or subscripts
|
||||
(:math:`x^2~~\mathrm{U}_{LJ}`), mathematical expressions
|
||||
(:math:`\frac{1}{2}\mathrm{N}~~x\to\infty`), or the Angstrom symbol
|
||||
(:math:`\AA`) should be typeset with embedded LaTeX (like this
|
||||
``:math:`\alpha \sigma \epsilon```, ``:math:`x^2 \mathrm{E}_{LJ}```,
|
||||
``:math:`\frac{1}{2}\mathrm{N} x\to\infty```, or ``:math:`\AA```\ ).
|
||||
|
||||
- Embedded LaTeX is rendered in HTML output with `MathJax
|
||||
<https://www.mathjax.org/>`_ and in PDF output by passing the embedded
|
||||
text to LaTeX. Some care has to be taken, though, since there are
|
||||
limitations which macros and features can be used in either mode, so
|
||||
it is recommended to always check whether any new or changed
|
||||
documentation does translate and render correctly with either output.
|
||||
|
||||
- A test whether all styles are documented and listed in their
|
||||
respective overview pages. A typical output with warnings looks like this:
|
||||
@ -252,6 +251,5 @@ manual with ``make spelling``. This requires `a library called enchant
|
||||
positives* (e.g. keywords, names, abbreviations) those can be added to
|
||||
the file ``lammps/doc/utils/sphinx-config/false_positives.txt``.
|
||||
|
||||
.. _rst: https://docutils.readthedocs.io/en/sphinx-docs/user/rst/quickstart.html
|
||||
|
||||
.. _lws: https://www.lammps.org
|
||||
.. _rst: https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html
|
||||
|
||||
@ -30,14 +30,16 @@ steps, as explained on the :doc:`Build extras <Build_extras>` page.
|
||||
These links take you to the extra instructions for those select
|
||||
packages:
|
||||
|
||||
.. this list must be kept in sync with its counterpart in Build_extras.rst
|
||||
.. table_from_list::
|
||||
:columns: 6
|
||||
|
||||
* :ref:`ADIOS <adios>`
|
||||
* :ref:`ATC <atc>`
|
||||
* :ref:`AWPMD <awpmd>`
|
||||
* :ref:`COLVARS <colvars>`
|
||||
* :ref:`COLVARS <colvar>`
|
||||
* :ref:`COMPRESS <compress>`
|
||||
* :ref:`ELECTRODE <electrode>`
|
||||
* :ref:`GPU <gpu>`
|
||||
* :ref:`H5MD <h5md>`
|
||||
* :ref:`INTEL <intel>`
|
||||
@ -45,7 +47,10 @@ packages:
|
||||
* :ref:`KOKKOS <kokkos>`
|
||||
* :ref:`LATTE <latte>`
|
||||
* :ref:`MACHDYN <machdyn>`
|
||||
* :ref:`MDI <mdi>`
|
||||
* :ref:`MESONT <mesont>`
|
||||
* :ref:`ML-HDNNP <ml-hdnnp>`
|
||||
* :ref:`ML-IAP <mliap>`
|
||||
* :ref:`ML-PACE <ml-pace>`
|
||||
* :ref:`ML-QUIP <ml-quip>`
|
||||
* :ref:`MOLFILE <molfile>`
|
||||
|
||||
@ -111,26 +111,25 @@ LAMMPS can use them if they are available on your system.
|
||||
files in its default search path. You must specify ``FFT_LIB``
|
||||
with the appropriate FFT libraries to include in the link.
|
||||
|
||||
The `KISS FFT library <http://kissfft.sf.net>`_ is included in the LAMMPS
|
||||
distribution. It is portable across all platforms. Depending on the size
|
||||
of the FFTs and the number of processors used, the other libraries listed
|
||||
here can be faster.
|
||||
The `KISS FFT library <https://github.com/mborgerding/kissfft>`_ is
|
||||
included in the LAMMPS distribution. It is portable across all
|
||||
platforms. Depending on the size of the FFTs and the number of
|
||||
processors used, the other libraries listed here can be faster.
|
||||
|
||||
However, note that long-range Coulombics are only a portion of the
|
||||
per-timestep CPU cost, FFTs are only a portion of long-range
|
||||
Coulombics, and 1d FFTs are only a portion of the FFT cost (parallel
|
||||
communication can be costly). A breakdown of these timings is printed
|
||||
to the screen at the end of a run when using the
|
||||
:doc:`kspace_style pppm <kspace_style>` command. The
|
||||
:doc:`Screen and logfile output <Run_output>`
|
||||
page gives more details. A more detailed (and time consuming)
|
||||
report of the FFT performance is generated with the
|
||||
per-timestep CPU cost, FFTs are only a portion of long-range Coulombics,
|
||||
and 1d FFTs are only a portion of the FFT cost (parallel communication
|
||||
can be costly). A breakdown of these timings is printed to the screen
|
||||
at the end of a run when using the :doc:`kspace_style pppm
|
||||
<kspace_style>` command. The :doc:`Screen and logfile output
|
||||
<Run_output>` page gives more details. A more detailed (and time
|
||||
consuming) report of the FFT performance is generated with the
|
||||
:doc:`kspace_modify fftbench yes <kspace_modify>` command.
|
||||
|
||||
FFTW is a fast, portable FFT library that should also work on any
|
||||
platform and can be faster than the KISS FFT library. You can
|
||||
download it from `www.fftw.org <http://www.fftw.org>`_. LAMMPS requires
|
||||
version 3.X; the legacy version 2.1.X is no longer supported.
|
||||
platform and can be faster than the KISS FFT library. You can download
|
||||
it from `www.fftw.org <https://www.fftw.org>`_. LAMMPS requires version
|
||||
3.X; the legacy version 2.1.X is no longer supported.
|
||||
|
||||
Building FFTW for your box should be as simple as ``./configure; make;
|
||||
make install``. The install command typically requires root privileges
|
||||
|
||||
@ -14,7 +14,9 @@
|
||||
General commands
|
||||
================
|
||||
|
||||
An alphabetic list of general LAMMPS commands.
|
||||
An alphabetic list of general LAMMPS commands. Note that style
|
||||
commands with many variants, can be more easily accessed via the small
|
||||
table above.
|
||||
|
||||
.. table_from_list::
|
||||
:columns: 5
|
||||
|
||||
@ -40,9 +40,6 @@ OPT.
|
||||
* :doc:`ave/time <fix_ave_time>`
|
||||
* :doc:`aveforce <fix_aveforce>`
|
||||
* :doc:`balance <fix_balance>`
|
||||
* :doc:`brownian <fix_brownian>`
|
||||
* :doc:`brownian/asphere <fix_brownian>`
|
||||
* :doc:`brownian/sphere <fix_brownian>`
|
||||
* :doc:`bocs <fix_bocs>`
|
||||
* :doc:`bond/break <fix_bond_break>`
|
||||
* :doc:`bond/create <fix_bond_create>`
|
||||
@ -50,6 +47,9 @@ OPT.
|
||||
* :doc:`bond/react <fix_bond_react>`
|
||||
* :doc:`bond/swap <fix_bond_swap>`
|
||||
* :doc:`box/relax <fix_box_relax>`
|
||||
* :doc:`brownian <fix_brownian>`
|
||||
* :doc:`brownian/asphere <fix_brownian>`
|
||||
* :doc:`brownian/sphere <fix_brownian>`
|
||||
* :doc:`charge/regulation <fix_charge_regulation>`
|
||||
* :doc:`cmap <fix_cmap>`
|
||||
* :doc:`colvars <fix_colvars>`
|
||||
|
||||
@ -91,8 +91,8 @@ OPT.
|
||||
* :doc:`coul/wolf/cs <pair_cs>`
|
||||
* :doc:`dpd (giko) <pair_dpd>`
|
||||
* :doc:`dpd/fdt <pair_dpd_fdt>`
|
||||
* :doc:`dpd/ext (k) <pair_dpd_ext>`
|
||||
* :doc:`dpd/ext/tstat (k) <pair_dpd_ext>`
|
||||
* :doc:`dpd/ext (ko) <pair_dpd_ext>`
|
||||
* :doc:`dpd/ext/tstat (ko) <pair_dpd_ext>`
|
||||
* :doc:`dpd/fdt/energy (k) <pair_dpd_fdt>`
|
||||
* :doc:`dpd/tstat (gko) <pair_dpd>`
|
||||
* :doc:`dsmc <pair_dsmc>`
|
||||
|
||||
@ -2,14 +2,17 @@ Removed commands and packages
|
||||
=============================
|
||||
|
||||
This page lists LAMMPS commands and packages that have been removed from
|
||||
the distribution and provides suggestions for alternatives or replacements.
|
||||
LAMMPS has special dummy styles implemented, that will stop LAMMPS and
|
||||
print a suitable error message in most cases, when a style/command is used
|
||||
that has been removed.
|
||||
the distribution and provides suggestions for alternatives or
|
||||
replacements. LAMMPS has special dummy styles implemented, that will
|
||||
stop LAMMPS and print a suitable error message in most cases, when a
|
||||
style/command is used that has been removed or will replace the command
|
||||
with the direct alternative (if available) and print a warning.
|
||||
|
||||
Fix ave/spatial and fix ave/spatial/sphere
|
||||
------------------------------------------
|
||||
|
||||
.. deprecated:: 11Dec2015
|
||||
|
||||
The fixes ave/spatial and ave/spatial/sphere have been removed from LAMMPS
|
||||
since they were superseded by the more general and extensible "chunk
|
||||
infrastructure". Here the system is partitioned in one of many possible
|
||||
@ -30,18 +33,21 @@ The code in the :ref:`MEAM package <PKG-MEAM>` is a translation of the
|
||||
Fortran code of MEAM into C++, which removes several restrictions
|
||||
(e.g. there can be multiple instances in hybrid pair styles) and allows
|
||||
for some optimizations leading to better performance. The pair style
|
||||
:doc:`meam <pair_meam>` has the exact same syntax.
|
||||
:doc:`meam <pair_meam>` has the exact same syntax. For a transition
|
||||
period the C++ version of MEAM was called USER-MEAMC so it could
|
||||
coexist with the Fortran version.
|
||||
|
||||
REAX package
|
||||
------------
|
||||
|
||||
The REAX package has been removed since it was superseded by the
|
||||
:ref:`REAXFF package <PKG-REAXFF>`. The REAXFF
|
||||
package has been tested to yield equivalent results to the REAX package,
|
||||
offers better performance, supports OpenMP multi-threading via OPENMP,
|
||||
and GPU and threading parallelization through KOKKOS. The new pair styles
|
||||
are not syntax compatible with the removed reax pair style, so input
|
||||
files will have to be adapted.
|
||||
:ref:`REAXFF package <PKG-REAXFF>`. The REAXFF package has been tested
|
||||
to yield equivalent results to the REAX package, offers better
|
||||
performance, supports OpenMP multi-threading via OPENMP, and GPU and
|
||||
threading parallelization through KOKKOS. The new pair styles are not
|
||||
syntax compatible with the removed reax pair style, so input files will
|
||||
have to be adapted. The REAXFF package was originally called
|
||||
USER-REAXC.
|
||||
|
||||
USER-CUDA package
|
||||
-----------------
|
||||
@ -60,5 +66,6 @@ restart2data tool
|
||||
The functionality of the restart2data tool has been folded into the
|
||||
LAMMPS executable directly instead of having a separate tool. A
|
||||
combination of the commands :doc:`read_restart <read_restart>` and
|
||||
:doc:`write_data <write_data>` can be used to the same effect. For added
|
||||
convenience this conversion can also be triggered by :doc:`command line flags <Run_options>`
|
||||
:doc:`write_data <write_data>` can be used to the same effect. For
|
||||
added convenience this conversion can also be triggered by
|
||||
:doc:`command line flags <Run_options>`
|
||||
|
||||
@ -17,6 +17,7 @@ of time and requests from the LAMMPS user community.
|
||||
Developer_flow
|
||||
Developer_write
|
||||
Developer_notes
|
||||
Developer_updating
|
||||
Developer_plugins
|
||||
Developer_unittest
|
||||
Classes
|
||||
|
||||
@ -50,7 +50,7 @@ parallel each MPI process creates such an instance. This can be seen
|
||||
in the ``main.cpp`` file where the core steps of running a LAMMPS
|
||||
simulation are the following 3 lines of code:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm);
|
||||
lammps->input->file();
|
||||
@ -78,7 +78,7 @@ LAMMPS makes extensive use of the object oriented programming (OOP)
|
||||
principles of *compositing* and *inheritance*. Classes like the
|
||||
``LAMMPS`` class are a **composite** containing pointers to instances
|
||||
of other classes like ``Atom``, ``Comm``, ``Force``, ``Neighbor``,
|
||||
``Modify``, and so on. Each of these classes implement certain
|
||||
``Modify``, and so on. Each of these classes implements certain
|
||||
functionality by storing and manipulating data related to the
|
||||
simulation and providing member functions that trigger certain
|
||||
actions. Some of those classes like ``Force`` are themselves
|
||||
@ -87,9 +87,9 @@ interactions. Similarly the ``Modify`` class contains a list of
|
||||
``Fix`` and ``Compute`` classes. If the input commands that
|
||||
correspond to these classes include the word *style*, then LAMMPS
|
||||
stores only a single instance of that class. E.g. *atom_style*,
|
||||
*comm_style*, *pair_style*, *bond_style*. It the input command does
|
||||
not include the word *style*, there can be many instances of that
|
||||
class defined. E.g. *region*, *fix*, *compute*, *dump*.
|
||||
*comm_style*, *pair_style*, *bond_style*. If the input command does
|
||||
**not** include the word *style*, then there may be many instances of
|
||||
that class defined, for example *region*, *fix*, *compute*, *dump*.
|
||||
|
||||
**Inheritance** enables creation of *derived* classes that can share
|
||||
common functionality in their base class while providing a consistent
|
||||
@ -232,7 +232,7 @@ macro ``PairStyle()`` will associate the style name "lj/cut"
|
||||
with a factory function creating an instance of the ``PairLJCut``
|
||||
class.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
// from force.h
|
||||
typedef Pair *(*PairCreator)(LAMMPS *);
|
||||
@ -360,7 +360,7 @@ characters; "{:<8}" would do this as left aligned, "{:^8}" as centered,
|
||||
argument type must be compatible or else the {fmt} formatting code will
|
||||
throw an exception. Some format string examples are given below:
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c++
|
||||
|
||||
auto mesg = fmt::format(" CPU time: {:4d}:{:02d}:{:02d}\n", cpuh, cpum, cpus);
|
||||
mesg = fmt::format("{:<8s}| {:<10.5g} | {:<10.5g} | {:<10.5g} |{:6.1f} |{:6.2f}\n",
|
||||
|
||||
@ -105,7 +105,7 @@ list, where each pair of atoms is listed only once (except when the
|
||||
pairs straddling sub-domains or periodic boundaries will be listed twice).
|
||||
Thus these are the default settings when a neighbor list request is created in:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void Pair::init_style()
|
||||
{
|
||||
@ -129,7 +129,7 @@ neighbor list request to the specific needs of a style an additional
|
||||
request flag is needed. The :doc:`tersoff <pair_tersoff>` pair style,
|
||||
for example, needs a "full" neighbor list:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void PairTersoff::init_style()
|
||||
{
|
||||
@ -141,7 +141,7 @@ When a pair style supports r-RESPA time integration with different cutoff region
|
||||
the request flag may depend on the corresponding r-RESPA settings. Here an example
|
||||
from pair style lj/cut:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void PairLJCut::init_style()
|
||||
{
|
||||
@ -160,7 +160,7 @@ Granular pair styles need neighbor lists based on particle sizes and not cutoff
|
||||
and also may require to have the list of previous neighbors available ("history").
|
||||
For example with:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
if (use_history) neighbor->add_request(this, NeighConst::REQ_SIZE | NeighConst::REQ_HISTORY);
|
||||
else neighbor->add_request(this, NeighConst::REQ_SIZE);
|
||||
@ -170,7 +170,7 @@ settings each request can set an id which is then used in the corresponding
|
||||
``init_list()`` function to assign it to the suitable pointer variable. This is
|
||||
done for example by the :doc:`pair style meam <pair_meam>`:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void PairMEAM::init_style()
|
||||
{
|
||||
@ -189,7 +189,7 @@ just once) and this can also be indicated by a flag. As an example here
|
||||
is the request from the ``FixPeriNeigh`` class which is created
|
||||
internally by :doc:`Peridynamics pair styles <pair_peri>`:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
|
||||
@ -198,7 +198,7 @@ than what is usually inferred from the pair style settings (largest cutoff of
|
||||
all pair styles plus neighbor list skin). The following is used in the
|
||||
:doc:`compute rdf <compute_rdf>` command implementation:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
if (cutflag)
|
||||
neighbor->add_request(this, NeighConst::REQ_OCCASIONAL)->set_cutoff(mycutneigh);
|
||||
@ -212,7 +212,7 @@ for printing the neighbor list summary the name of the requesting command
|
||||
should be set. Below is the request from the :doc:`delete atoms <delete_atoms>`
|
||||
command:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
neighbor->add_request(this, "delete_atoms", NeighConst::REQ_FULL);
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ Parallel algorithms
|
||||
|
||||
LAMMPS is designed to enable running simulations in parallel using the
|
||||
MPI parallel communication standard with distributed data via domain
|
||||
decomposition. The parallelization aims to be efficient result in good
|
||||
strong scaling (= good speedup for the same system) and good weak
|
||||
scaling (= the computational cost of enlarging the system is
|
||||
decomposition. The parallelization aims to be efficient, and resulting
|
||||
in good strong scaling (= good speedup for the same system) and good
|
||||
weak scaling (= the computational cost of enlarging the system is
|
||||
proportional to the system size). Additional parallelization using GPUs
|
||||
or OpenMP can also be applied within the sub-domain assigned to an MPI
|
||||
process. For clarity, most of the following illustrations show the 2d
|
||||
|
||||
@ -95,7 +95,7 @@ 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++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
#include "version.h"
|
||||
@ -141,7 +141,7 @@ 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++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
#include "version.h"
|
||||
@ -176,7 +176,7 @@ 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++
|
||||
.. code-block:: c++
|
||||
|
||||
#include "lammpsplugin.h"
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ 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++
|
||||
.. code-block:: c++
|
||||
|
||||
TEST_F(SimpleCommandsTest, UnknownCommand)
|
||||
{
|
||||
@ -249,7 +249,7 @@ 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
|
||||
.. code-block:: cmake
|
||||
|
||||
if (BUILD_MPI)
|
||||
add_executable(test_library_mpi test_library_mpi.cpp)
|
||||
@ -489,7 +489,7 @@ to update the YAML files. Running a command like
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ test_pair_style mol-pair-lennard_mdf.yaml -g new.yaml
|
||||
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,
|
||||
@ -500,13 +500,13 @@ It is also possible to do an update in place with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ test_pair_style mol-pair-lennard_mdf.yaml -u
|
||||
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
|
||||
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
|
||||
|
||||
425
doc/src/Developer_updating.rst
Normal file
425
doc/src/Developer_updating.rst
Normal file
@ -0,0 +1,425 @@
|
||||
Notes for updating code written for older LAMMPS versions
|
||||
---------------------------------------------------------
|
||||
|
||||
This section documents how C++ source files that are available *outside
|
||||
of the LAMMPS source distribution* (e.g. in external USER packages or as
|
||||
source files provided as a supplement to a publication) that are written
|
||||
for an older version of LAMMPS and thus need to be updated to be
|
||||
compatible with the current version of LAMMPS. Due to the active
|
||||
development of LAMMPS it is likely to always be incomplete. Please
|
||||
contact developers@lammps.org in case you run across an issue that is not
|
||||
(yet) listed here. Please also review the latest information about the
|
||||
LAMMPS :doc:`programming style conventions <Modify_style>`, especially
|
||||
if you are considering to submit the updated version for inclusion into
|
||||
the LAMMPS distribution.
|
||||
|
||||
Available topics in mostly chronological order are:
|
||||
|
||||
- `Setting flags in the constructor`_
|
||||
- `Rename of pack/unpack_comm() to pack/unpack_forward_comm()`_
|
||||
- `Use ev_init() to initialize variables derived from eflag and vflag`_
|
||||
- `Use utils::numeric() functions instead of force->numeric()`_
|
||||
- `Use utils::open_potential() function to open potential files`_
|
||||
- `Simplify customized error messages`_
|
||||
- `Use of "override" instead of "virtual"`_
|
||||
- `Simplified and more compact neighbor list requests`_
|
||||
- `Split of fix STORE into fix STORE/GLOBAL and fix STORE/PERATOM`_
|
||||
- `Use Output::get_dump_by_id() instead of Output::find_dump()`_
|
||||
|
||||
----
|
||||
|
||||
Setting flags in the constructor
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
As LAMMPS gains additional functionality, new flags may need to be set
|
||||
in the constructor or a class to signal compatibility with such features.
|
||||
Most of the time the defaults are chosen conservatively, but sometimes
|
||||
the conservative choice is the uncommon choice, and then those settings
|
||||
need to be made when updating code.
|
||||
|
||||
Pair styles:
|
||||
|
||||
- ``manybody_flag``: set to 1 if your pair style is not pair-wise additive
|
||||
- ``restartinfo``: set to 0 if your pair style does not store data in restart files
|
||||
|
||||
|
||||
Rename of pack/unpack_comm() to pack/unpack_forward_comm()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 8Aug2014
|
||||
|
||||
In this change set the functions to pack data into communication buffers
|
||||
and to unpack data from communication buffers for :doc:`forward
|
||||
communications <Developer_comm_ops>` were renamed from ``pack_comm()``
|
||||
and ``unpack_comm()`` to ``pack_forward_comm()`` and
|
||||
``unpack_forward_comm()``, respectively. Also the meaning of the return
|
||||
value of these functions was changed: rather than returning the number
|
||||
of items per atom stored in the buffer, now the total number of items
|
||||
added (or unpacked) needs to be returned. Here is an example from the
|
||||
`PairEAM` class. Of course the member function declaration in corresponding
|
||||
header file needs to be updated accordingly.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int PairEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc)
|
||||
{
|
||||
int m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int j = list[i];
|
||||
buf[m++] = fp[j];
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int PairEAM::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc)
|
||||
{
|
||||
int m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int j = list[i];
|
||||
buf[m++] = fp[j];
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
.. note::
|
||||
|
||||
Because the various "pack" and "unpack" functions are defined in the
|
||||
respective base classes as dummy functions doing nothing, and because
|
||||
of the the name mismatch the custom versions in the derived class
|
||||
will no longer be called, there will be no compilation error when
|
||||
this change is not applied. Only calculations will suddenly produce
|
||||
incorrect results because the required forward communication calls
|
||||
will cease to function correctly.
|
||||
|
||||
Use ev_init() to initialize variables derived from eflag and vflag
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 29Mar2019
|
||||
|
||||
There are several variables that need to be initialized based on
|
||||
the values of the "eflag" and "vflag" variables and since sometimes
|
||||
there are new bits added and new variables need to be set to 1 or 0.
|
||||
To make this consistent, across all styles, there is now an inline
|
||||
function ``ev_init(eflag, vflag)`` that makes those settings
|
||||
consistently and calls either ``ev_setup()`` or ``ev_unset()``.
|
||||
Example from a pair style:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
if (eflag || vflag) ev_setup(eflag, vflag);
|
||||
else evflag = vflag_fdotr = eflag_global = eflag_atom = 0;
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
ev_init(eflag, vflag);
|
||||
|
||||
Not applying this change will not cause a compilation error, but
|
||||
can lead to inconsistent behavior and incorrect tallying of
|
||||
energy or virial.
|
||||
|
||||
Use utils::numeric() functions instead of force->numeric()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 18Sep2020
|
||||
|
||||
The "numeric()" conversion functions (including "inumeric()",
|
||||
"bnumeric()", and "tnumeric()") have been moved from the Force class to
|
||||
the utils namespace. Also they take an additional argument that selects
|
||||
whether the ``Error::all()`` or ``Error::one()`` function should be
|
||||
called in case of an error. The former should be used when *all* MPI
|
||||
processes call the conversion function and the latter *must* be used
|
||||
when they are called from only one or a subset of the MPI processes.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
val = force->numeric(FLERR, arg[1]);
|
||||
num = force->inumeric(FLERR, arg[2]);
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
val = utils::numeric(FLERR, true, arg[1], lmp);
|
||||
num = utils::inumeric(FLERR, false, arg[2], lmp);
|
||||
|
||||
.. seealso::
|
||||
|
||||
:cpp:func:`utils::numeric() <LAMMPS_NS::utils::numeric>`,
|
||||
:cpp:func:`utils::inumeric() <LAMMPS_NS::utils::inumeric>`,
|
||||
:cpp:func:`utils::bnumeric() <LAMMPS_NS::utils::bnumeric>`,
|
||||
:cpp:func:`utils::tnumeric() <LAMMPS_NS::utils::tnumeric>`
|
||||
|
||||
Use utils::open_potential() function to open potential files
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 18Sep2020
|
||||
|
||||
The :cpp:func:`utils::open_potential()
|
||||
<LAMMPS_NS::utils::open_potential>` function must be used to replace
|
||||
calls to ``force->open_potential()`` and should be used to replace
|
||||
``fopen()`` for opening potential files for reading. The custom
|
||||
function does three additional steps compared to ``fopen()``: 1) it will
|
||||
try to parse the ``UNITS:`` and ``DATE:`` metadata will stop with an
|
||||
error on a units mismatch and will print the date info, if present, in
|
||||
the log file; 2) for pair styles that support it, it will set up
|
||||
possible automatic unit conversions based on the embedded unit
|
||||
information and LAMMPS' current units setting; 3) it will not only try
|
||||
to open a potential file at the given path, but will also search in the
|
||||
folders listed in the ``LAMMPS_POTENTIALS`` environment variable. This
|
||||
allows to keep potential files in a common location instead of having to
|
||||
copy them around for simulations.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
fp = force->open_potential(filename);
|
||||
fp = fopen(filename, "r");
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
fp = utils::open_potential(filename, lmp);
|
||||
|
||||
Simplify customized error messages
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 14May2021
|
||||
|
||||
Aided by features of the bundled {fmt} library, error messages now
|
||||
can have a variable number of arguments and the string will be interpreted
|
||||
as a {fmt} style format string so that custom error messages can be
|
||||
easily customized without having to use temporary buffers and ``sprintf()``.
|
||||
Example:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
if (fptr == NULL) {
|
||||
char str[128];
|
||||
sprintf(str,"Cannot open AEAM potential file %s",filename);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
if (fptr == nullptr)
|
||||
error->one(FLERR, "Cannot open AEAM potential file {}: {}", filename, utils::getsyserror());
|
||||
|
||||
Use of "override" instead of "virtual"
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 17Feb2022
|
||||
|
||||
Since LAMMPS requires C++11 we switched to use the "override" keyword
|
||||
instead of "virtual" to indicate polymorphism in derived classes. This
|
||||
allows the C++ compiler to better detect inconsistencies when an
|
||||
override is intended or not. Please note that "override" has to be
|
||||
added to **all** polymorph functions in derived classes and "virtual"
|
||||
*only* to the function in the base class (or the destructor). Here is
|
||||
an example from the ``FixWallReflect`` class:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
FixWallReflect(class LAMMPS *, int, char **);
|
||||
virtual ~FixWallReflect();
|
||||
int setmask();
|
||||
void init();
|
||||
void post_integrate();
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
FixWallReflect(class LAMMPS *, int, char **);
|
||||
~FixWallReflect() override;
|
||||
int setmask() override;
|
||||
void init() override;
|
||||
void post_integrate() override;
|
||||
|
||||
This change set will neither cause a compilation failure, nor will it
|
||||
change functionality, but if you plan to submit the updated code for
|
||||
inclusion into the LAMMPS distribution, it will be requested for achieve
|
||||
a consistent :doc:`programming style <Modify_style>`.
|
||||
|
||||
Simplified function names for forward and reverse communication
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 24Mar2022
|
||||
|
||||
Rather then using the function name to distinguish between the different
|
||||
forward and reverse communication functions for styles, LAMMPS now uses
|
||||
the type of the "this" pointer argument.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
comm->forward_comm_pair(this);
|
||||
comm->forward_comm_fix(this);
|
||||
comm->forward_comm_compute(this);
|
||||
comm->forward_comm_dump(this);
|
||||
comm->reverse_comm_pair(this);
|
||||
comm->reverse_comm_fix(this);
|
||||
comm->reverse_comm_compute(this);
|
||||
comm->reverse_comm_dump(this);
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
comm->forward_comm(this);
|
||||
comm->reverse_comm(this);
|
||||
|
||||
This change is **required** or else the code will not compile.
|
||||
|
||||
Simplified and more compact neighbor list requests
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 24Mar2022
|
||||
|
||||
This change set reduces the amount of code required to request a
|
||||
neighbor list. It enforces consistency and no longer requires to change
|
||||
internal data of the request. More information on neighbor list
|
||||
requests can be :doc:`found here <Developer_notes>`. Example from the
|
||||
``ComputeRDF`` class:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
if (cutflag) {
|
||||
neighbor->requests[irequest]->cut = 1;
|
||||
neighbor->requests[irequest]->cutoff = mycutneigh;
|
||||
}
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
auto req = neighbor->add_request(this, NeighConst::REQ_OCCASIONAL);
|
||||
if (cutflag) req->set_cutoff(mycutneigh);
|
||||
|
||||
Public access to the ``NeighRequest`` class data members has been
|
||||
removed so this update is **required** to avoid compilation failure.
|
||||
|
||||
Split of fix STORE into fix STORE/GLOBAL and fix STORE/PERATOM
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 15Sep2022
|
||||
|
||||
This change splits the GLOBAL and PERATOM modes of fix STORE into two
|
||||
separate fixes STORE/GLOBAL and STORE/PERATOM. There was very little
|
||||
shared code between the two fix STORE modes and the two different code
|
||||
paths had to be prefixed with if statements. Furthermore, some flags
|
||||
were used differently in the two modes leading to confusion. Splitting
|
||||
the code into two fix styles, makes it more easily maintainable. Since
|
||||
these are internal fixes, there is no user visible change.
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
#include "fix_store.h"
|
||||
|
||||
FixStore *fix = dynamic_cast<FixStore *>(
|
||||
modify->add_fix(fmt::format("{} {} STORE peratom 1 13",id_pole,group->names[0]));
|
||||
|
||||
FixStore *fix = dynamic_cast<FixStore *>(modify->get_fix_by_id(id_pole));
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
#include "fix_store_peratom.h"
|
||||
|
||||
FixStorePeratom *fix = dynamic_cast<FixStorePeratom *>(
|
||||
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 13",id_pole,group->names[0]));
|
||||
|
||||
FixStorePeratom *fix = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_pole));
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
#include "fix_store.h"
|
||||
|
||||
FixStore *fix = dynamic_cast<FixStore *>(
|
||||
modify->add_fix(fmt::format("{} {} STORE global 1 1",id_fix,group->names[igroup]));
|
||||
|
||||
FixStore *fix = dynamic_cast<FixStore *>(modify->get_fix_by_id(id_fix));
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
#include "fix_store_global.h"
|
||||
|
||||
FixStoreGlobal *fix = dynamic_cast<FixStoreGlobal *>(
|
||||
modify->add_fix(fmt::format("{} {} STORE/GLOBAL 1 1",id_fix,group->names[igroup]));
|
||||
|
||||
FixStoreGlobal *fix = dynamic_cast<FixStoreGlobal *>(modify->get_fix_by_id(id_fix));
|
||||
|
||||
This change is **required** or else the code will not compile.
|
||||
|
||||
Use Output::get_dump_by_id() instead of Output::find_dump()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionchanged:: 15Sep2022
|
||||
|
||||
The accessor function to individual dump style instances has been changed
|
||||
from ``Output::find_dump()`` returning the index of the dump instance in
|
||||
the list of dumps to ``Output::get_dump_by_id()`` returning a pointer to
|
||||
the dump directly. Example:
|
||||
|
||||
Old:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
int idump = output->find_dump(arg[iarg+1]);
|
||||
if (idump < 0)
|
||||
error->all(FLERR,"Dump ID in hyper command does not exist");
|
||||
memory->grow(dumplist,ndump+1,"hyper:dumplist");
|
||||
dumplist[ndump++] = idump;
|
||||
|
||||
[...]
|
||||
|
||||
if (dumpflag)
|
||||
for (int idump = 0; idump < ndump; idump++)
|
||||
output->dump[dumplist[idump]]->write();
|
||||
|
||||
New:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
auto idump = output->get_dump_by_id(arg[iarg+1]);
|
||||
if (!idump) error->all(FLERR,"Dump ID {} in hyper command does not exist", arg[iarg+1]);
|
||||
dumplist.emplace_back(idump);
|
||||
|
||||
[...]
|
||||
|
||||
if (dumpflag) for (auto idump : dumplist) idump->write();
|
||||
|
||||
This change is **required** or else the code will not compile.
|
||||
@ -205,7 +205,7 @@ Argument processing
|
||||
Convenience functions
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. doxygenfunction:: logmesg(LAMMPS *lmp, const S &format, Args&&... args)
|
||||
.. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &format, Args&&... args)
|
||||
:project: progguide
|
||||
|
||||
.. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &mesg)
|
||||
@ -305,7 +305,7 @@ are all "whitespace" characters, i.e. the space character, the tabulator
|
||||
character, the carriage return character, the linefeed character, and
|
||||
the form feed character.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: Tokenizer class example listing entries of the PATH environment variable
|
||||
|
||||
#include "tokenizer.h"
|
||||
@ -337,7 +337,7 @@ tokenizer into a ``try`` / ``catch`` block to handle errors. The
|
||||
when a (type of) number is requested as next token that is not
|
||||
compatible with the string representing the next word.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: ValueTokenizer class example with exception handling
|
||||
|
||||
#include "tokenizer.h"
|
||||
@ -415,7 +415,7 @@ one or two array indices "[<number>]" with numbers > 0.
|
||||
|
||||
A typical code segment would look like this:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: Usage example for ArgInfo class
|
||||
|
||||
int nvalues = 0;
|
||||
@ -464,7 +464,7 @@ open the file, and will call the :cpp:class:`LAMMPS_NS::Error` class in
|
||||
case of failures to read or to convert numbers, so that LAMMPS will be
|
||||
aborted.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: Use of PotentialFileReader class in pair style coul/streitz
|
||||
|
||||
PotentialFileReader reader(lmp, file, "coul/streitz");
|
||||
@ -543,7 +543,7 @@ chunk size needs to be known in advance, 2) with :cpp:func:`MyPage::vget()
|
||||
its size is registered later with :cpp:func:`MyPage::vgot()
|
||||
<LAMMPS_NS::MyPage::vgot>`.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
:caption: Example of using :cpp:class:`MyPage <LAMMPS_NS::MyPage>`
|
||||
|
||||
#include "my_page.h"
|
||||
|
||||
@ -26,7 +26,7 @@ constructor with the signature: ``FixPrintVel(class LAMMPS *, int, char **)``.
|
||||
Every fix must be registered in LAMMPS by writing the following lines
|
||||
of code in the header before include guards:
|
||||
|
||||
.. code-block:: c
|
||||
.. code-block:: c++
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
// clang-format off
|
||||
@ -47,7 +47,7 @@ keyword when it parses the input script.
|
||||
Let's write a simple fix which will print the average velocity at the end
|
||||
of each timestep. First of all, implement a constructor:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
FixPrintVel::FixPrintVel(LAMMPS *lmp, int narg, char **arg)
|
||||
: Fix(lmp, narg, arg)
|
||||
@ -72,7 +72,7 @@ in the Fix class called ``nevery`` which specifies how often the method
|
||||
|
||||
The next method we need to implement is ``setmask()``:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
int FixPrintVel::setmask()
|
||||
{
|
||||
@ -87,7 +87,7 @@ during execution. The constant ``END_OF_STEP`` corresponds to the
|
||||
are called during a timestep and the order in which they are called
|
||||
are shown in the previous section.
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
void FixPrintVel::end_of_step()
|
||||
{
|
||||
@ -143,7 +143,7 @@ The group membership information of an atom is contained in the *mask*
|
||||
property of and atom and the bit corresponding to a given group is
|
||||
stored in the groupbit variable which is defined in Fix base class:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
if (atom->mask[i] & groupbit) {
|
||||
@ -174,7 +174,7 @@ to store positions of atoms from previous timestep, we need to add
|
||||
``double** xold`` to the header file. Than add allocation code
|
||||
to the constructor:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
FixSavePos::FixSavePos(LAMMPS *lmp, int narg, char **arg), xold(nullptr)
|
||||
{
|
||||
@ -190,7 +190,7 @@ to the constructor:
|
||||
|
||||
Implement the aforementioned methods:
|
||||
|
||||
.. code-block:: C++
|
||||
.. code-block:: c++
|
||||
|
||||
double FixSavePos::memory_usage()
|
||||
{
|
||||
|
||||
@ -40,7 +40,7 @@ We use it to show how to identify the origin of a segmentation fault.
|
||||
|
||||
After recompiling LAMMPS and running the input you should get something like this:
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: console
|
||||
|
||||
$ ./lmp -in in.melt
|
||||
LAMMPS (19 Mar 2020)
|
||||
@ -75,7 +75,7 @@ Using the GDB debugger to get a stack trace
|
||||
There are two options to use the GDB debugger for identifying the origin
|
||||
of the segmentation fault or similar crash. The GDB debugger has many
|
||||
more features and options, as can be seen for example its `online
|
||||
documentation <http://sourceware.org/gdb/current/onlinedocs/gdb/>`_.
|
||||
documentation <https://sourceware.org/gdb/current/onlinedocs/gdb/>`_.
|
||||
|
||||
Run LAMMPS from within the debugger
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -90,8 +90,9 @@ it. When it reaches the code causing the segmentation fault, it will
|
||||
stop with a message why it stopped, print the current line of code, and
|
||||
drop back to the GDB prompt.
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: console
|
||||
|
||||
(gdb) run
|
||||
[...]
|
||||
Setting up Verlet run ...
|
||||
Unit style : lj
|
||||
@ -106,7 +107,7 @@ drop back to the GDB prompt.
|
||||
Now typing the command "where" will show the stack of functions starting from
|
||||
the current function back to "main()".
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: console
|
||||
|
||||
(gdb) where
|
||||
#0 0x00000000006653ab in LAMMPS_NS::PairLJCut::compute (this=0x829740, eflag=1, vflag=<optimized out>) at /home/akohlmey/compile/lammps/src/pair_lj_cut.cpp:139
|
||||
@ -124,7 +125,7 @@ You can also print the value of variables and see if there is anything
|
||||
unexpected. Segmentation faults, for example, commonly happen when a
|
||||
pointer variable is not assigned and still initialized to NULL.
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: console
|
||||
|
||||
(gdb) print x
|
||||
$1 = (double **) 0x7ffff7ca1010
|
||||
@ -153,7 +154,7 @@ utility to the current folder. Example: ``coredumpctl -o core dump lmp``.
|
||||
Now you can launch the debugger to load the executable, its debug info
|
||||
and the core dump and drop you to a prompt like before.
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: console
|
||||
|
||||
$ gdb lmp core
|
||||
Reading symbols from lmp...
|
||||
@ -186,7 +187,7 @@ recommended to redirect the valgrind output to a file (e.g. with
|
||||
process ID) so that the messages of the multiple valgrind instances to
|
||||
the console are not mixed.
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: console
|
||||
|
||||
$ valgrind ./lmp -in in.melt
|
||||
==1933642== Memcheck, a memory error detector
|
||||
|
||||
@ -1,32 +1,51 @@
|
||||
The ``LIBLAMMPS`` Fortran Module
|
||||
********************************
|
||||
The :f:mod:`LIBLAMMPS` Fortran Module
|
||||
*************************************
|
||||
|
||||
The ``LIBLAMMPS`` module provides an interface to call LAMMPS from a
|
||||
Fortran code. It is based on the LAMMPS C-library interface and
|
||||
requires a Fortran 2003 compatible compiler to be compiled.
|
||||
The :f:mod:`LIBLAMMPS` module provides an interface to call LAMMPS from
|
||||
Fortran. It is based on the LAMMPS C library interface and requires a
|
||||
fully Fortran 2003-compatible compiler to be compiled. It is designed
|
||||
to be self-contained and not require any support functions written in C,
|
||||
C++, or Fortran other than those in the C library interface and the
|
||||
LAMMPS Fortran module itself.
|
||||
|
||||
While C libraries have a defined binary interface (ABI) and can thus be
|
||||
used from multiple compiler versions from different vendors for as long
|
||||
as they are compatible with the hosting operating system, the same is
|
||||
not true for Fortran codes. Thus the LAMMPS Fortran module needs to be
|
||||
used from multiple compiler versions from different vendors as long as
|
||||
they are compatible with the hosting operating system, the same is not
|
||||
true for Fortran programs. Thus, the LAMMPS Fortran module needs to be
|
||||
compiled alongside the code using it from the source code in
|
||||
``fortran/lammps.f90``. When linking, you also need to
|
||||
:doc:`link to the LAMMPS library <Build_link>`. A typical command line
|
||||
for a simple program using the Fortran interface would be:
|
||||
``fortran/lammps.f90`` *and* with the same compiler used to build the
|
||||
rest of the Fortran code that interfaces to LAMMPS. When linking, you
|
||||
also need to :doc:`link to the LAMMPS library <Build_link>`. A typical
|
||||
command line for a simple program using the Fortran interface would be:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
mpifort -o testlib.x lammps.f90 testlib.f90 -L. -llammps
|
||||
mpifort -o testlib.x lammps.f90 testlib.f90 -L. -llammps
|
||||
|
||||
Please note, that the MPI compiler wrapper is only required when the
|
||||
calling the library from an MPI parallel code. Please also note the
|
||||
order of the source files: the ``lammps.f90`` file needs to be compiled
|
||||
first, since it provides the ``LIBLAMMPS`` module that is imported by
|
||||
the Fortran code using the interface. A working example code can be
|
||||
found together with equivalent examples in C and C++ in the
|
||||
``examples/COUPLE/simple`` folder of the LAMMPS distribution.
|
||||
Please note that the MPI compiler wrapper is only required when the
|
||||
calling the library *from* an MPI-parallelized program. Otherwise,
|
||||
using the plain Fortran compiler (gfortran, ifort, flang, etc.) will
|
||||
suffice, since there are no direct references to MPI library features,
|
||||
definitions and subroutine calls; MPI communicators are referred to by
|
||||
their integer index representation as required by the Fortran MPI
|
||||
interface. It may be necessary to link to additional libraries,
|
||||
depending on how LAMMPS was configured and whether the LAMMPS library
|
||||
:doc:`was compiled as a static or dynamic library <Build_link>`.
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
If the LAMMPS library itself has been compiled with MPI support, the
|
||||
resulting executable will be able to run LAMMPS in parallel with
|
||||
``mpirun``, ``mpiexec``, or equivalent. This may be either on the
|
||||
"world" communicator or a sub-communicator created by the calling
|
||||
Fortran code. If, on the other hand, the LAMMPS library has been
|
||||
compiled **without** MPI support, each LAMMPS instance will run
|
||||
independently using just one processor.
|
||||
|
||||
Please also note that the order of the source files matters: the
|
||||
``lammps.f90`` file needs to be compiled first, since it provides the
|
||||
:f:mod:`LIBLAMMPS` module that would need to be imported by the calling
|
||||
Fortran code in order to uses the Fortran interface.
|
||||
A working example can be found together with equivalent examples in C and
|
||||
C++ in the ``examples/COUPLE/simple`` folder of the LAMMPS distribution.
|
||||
|
||||
.. admonition:: Work in Progress
|
||||
:class: note
|
||||
@ -49,61 +68,96 @@ found together with equivalent examples in C and C++ in the
|
||||
Creating or deleting a LAMMPS object
|
||||
************************************
|
||||
|
||||
With the Fortran interface the creation of a :cpp:class:`LAMMPS
|
||||
With the Fortran interface, the creation of a :cpp:class:`LAMMPS
|
||||
<LAMMPS_NS::LAMMPS>` instance is included in the constructor for
|
||||
creating the :f:func:`lammps` derived type. To import the definition of
|
||||
that type and its type bound procedures you need to add a ``USE
|
||||
LIBLAMMPS`` statement. Internally it will call either
|
||||
that type and its type-bound procedures, you need to add a ``USE LIBLAMMPS``
|
||||
statement. Internally, it will call either
|
||||
:cpp:func:`lammps_open_fortran` or :cpp:func:`lammps_open_no_mpi` from
|
||||
the C library API to create the class instance. All arguments are
|
||||
optional and :cpp:func:`lammps_mpi_init` will be called automatically,
|
||||
if it is needed. Similarly, a possible call to :cpp:func:`lammps_finalize`
|
||||
is integrated into the :f:func:`close` function and triggered with
|
||||
the optional logical argument set to ``.true.``. Here is a simple example:
|
||||
optional and :cpp:func:`lammps_mpi_init` will be called automatically
|
||||
if it is needed. Similarly, a possible call to
|
||||
:cpp:func:`lammps_mpi_finalize` is integrated into the :f:func:`close`
|
||||
function and triggered with the optional logical argument set to
|
||||
``.TRUE.``. Here is a simple example:
|
||||
|
||||
.. code-block:: fortran
|
||||
|
||||
PROGRAM testlib
|
||||
USE LIBLAMMPS ! include the LAMMPS library interface
|
||||
TYPE(lammps) :: lmp ! derived type to hold LAMMPS instance
|
||||
CHARACTER(len=*), DIMENSION(*), PARAMETER :: args = &
|
||||
[ CHARACTER(len=12) :: 'liblammps', '-log', 'none' ]
|
||||
IMPLICIT NONE
|
||||
TYPE(lammps) :: lmp ! derived type to hold LAMMPS instance
|
||||
CHARACTER(LEN=12), PARAMETER :: args(3) = &
|
||||
[ CHARACTER(LEN=12) :: 'liblammps', '-log', 'none' ]
|
||||
|
||||
! create a LAMMPS instance (and initialize MPI)
|
||||
lmp = lammps(args)
|
||||
! get and print numerical version code
|
||||
PRINT*, 'LAMMPS Version: ', lmp%version()
|
||||
! delete LAMMPS instance (and shuts down MPI)
|
||||
CALL lmp%close(.true.)
|
||||
|
||||
! delete LAMMPS instance (and shutdown MPI)
|
||||
CALL lmp%close(.TRUE.)
|
||||
END PROGRAM testlib
|
||||
|
||||
It is also possible to pass command line flags from Fortran to C/C++ and
|
||||
thus make the resulting executable behave similarly to the standalone
|
||||
executable (it will ignore the `-in/-i` flag, though). This allows
|
||||
using the command line to configure accelerator and suffix settings,
|
||||
configure screen and logfile output, or to set index style variables
|
||||
from the command line and more. Here is a correspondingly adapted
|
||||
version of the previous example:
|
||||
|
||||
.. code-block:: fortran
|
||||
|
||||
PROGRAM testlib2
|
||||
USE LIBLAMMPS ! include the LAMMPS library interface
|
||||
IMPLICIT NONE
|
||||
TYPE(lammps) :: lmp ! derived type to hold LAMMPS instance
|
||||
CHARACTER(LEN=128), ALLOCATABLE :: command_args(:)
|
||||
INTEGER :: i, argc
|
||||
|
||||
! copy command line flags to `command_args()`
|
||||
argc = COMMAND_ARGUMENT_COUNT()
|
||||
ALLOCATE(command_args(0:argc))
|
||||
DO i=0, argc
|
||||
CALL GET_COMMAND_ARGUMENT(i, command_args(i))
|
||||
END DO
|
||||
|
||||
! create a LAMMPS instance (and initialize MPI)
|
||||
lmp = lammps(command_args)
|
||||
! get and print numerical version code
|
||||
PRINT*, 'Program name: ', command_args(0)
|
||||
PRINT*, 'LAMMPS Version: ', lmp%version()
|
||||
! delete LAMMPS instance (and shuts down MPI)
|
||||
CALL lmp%close(.TRUE.)
|
||||
DEALLOCATE(command_args)
|
||||
END PROGRAM testlib2
|
||||
|
||||
--------------------
|
||||
|
||||
Executing LAMMPS commands
|
||||
=========================
|
||||
*************************
|
||||
|
||||
Once a LAMMPS instance is created, it is possible to "drive" the LAMMPS
|
||||
simulation by telling LAMMPS to read commands from a file, or pass
|
||||
simulation by telling LAMMPS to read commands from a file or to pass
|
||||
individual or multiple commands from strings or lists of strings. This
|
||||
is done similar to how it is implemented in the `C-library
|
||||
<pg_lib_execute>` interface. Before handing off the calls to the
|
||||
C-library interface, the corresponding Fortran versions of the calls
|
||||
is done similarly to how it is implemented in the :doc:`C library
|
||||
interface <Library_execute>`. Before handing off the calls to the
|
||||
C library interface, the corresponding Fortran versions of the calls
|
||||
(:f:func:`file`, :f:func:`command`, :f:func:`commands_list`, and
|
||||
:f:func:`commands_string`) have to make a copy of the strings passed as
|
||||
:f:func:`commands_string`) have to make copies of the strings passed as
|
||||
arguments so that they can be modified to be compatible with the
|
||||
requirements of strings in C without affecting the original strings.
|
||||
Those copies are automatically deleted after the functions return.
|
||||
Below is a small demonstration of the uses of the different functions:
|
||||
Below is a small demonstration of the uses of the different functions.
|
||||
|
||||
.. code-block:: fortran
|
||||
|
||||
PROGRAM testcmd
|
||||
USE LIBLAMMPS
|
||||
TYPE(lammps) :: lmp
|
||||
CHARACTER(len=512) :: cmds
|
||||
CHARACTER(len=40),ALLOCATABLE :: cmdlist(:)
|
||||
CHARACTER(len=10) :: trimmed
|
||||
TYPE(lammps) :: lmp
|
||||
CHARACTER(LEN=512) :: cmds
|
||||
CHARACTER(LEN=40), ALLOCATABLE :: cmdlist(:)
|
||||
CHARACTER(LEN=10) :: trimmed
|
||||
INTEGER :: i
|
||||
|
||||
lmp = lammps()
|
||||
@ -111,10 +165,10 @@ Below is a small demonstration of the uses of the different functions:
|
||||
CALL lmp%command('variable zpos index 1.0')
|
||||
! define 10 groups of 10 atoms each
|
||||
ALLOCATE(cmdlist(10))
|
||||
DO i=1,10
|
||||
WRITE(trimmed,'(I10)') 10*i
|
||||
WRITE(cmdlist(i),'(A,I1,A,I10,A,A)') &
|
||||
'group g',i-1,' id ',10*(i-1)+1,':',ADJUSTL(trimmed)
|
||||
DO i=1, 10
|
||||
WRITE(trimmed,'(I10)') 10*i
|
||||
WRITE(cmdlist(i),'(A,I1,A,I10,A,A)') &
|
||||
'group g', i-1, ' id ', 10*(i-1)+1, ':', ADJUSTL(trimmed)
|
||||
END DO
|
||||
CALL lmp%commands_list(cmdlist)
|
||||
! run multiple commands from multi-line string
|
||||
@ -123,8 +177,7 @@ Below is a small demonstration of the uses of the different functions:
|
||||
'create_box 1 box' // NEW_LINE('A') // &
|
||||
'create_atoms 1 single 1.0 1.0 ${zpos}'
|
||||
CALL lmp%commands_string(cmds)
|
||||
CALL lmp%close()
|
||||
|
||||
CALL lmp%close(.TRUE.)
|
||||
END PROGRAM testcmd
|
||||
|
||||
---------------
|
||||
|
||||
@ -83,6 +83,7 @@ Packages howto
|
||||
Howto_coreshell
|
||||
Howto_drude
|
||||
Howto_drude2
|
||||
Howto_peri
|
||||
Howto_manifold
|
||||
Howto_spins
|
||||
|
||||
|
||||
@ -3,24 +3,20 @@ CHARMM, AMBER, COMPASS, and DREIDING force fields
|
||||
|
||||
A force field has 2 parts: the formulas that define it and the
|
||||
coefficients used for a particular system. Here we only discuss
|
||||
formulas implemented in LAMMPS that correspond to formulas commonly
|
||||
used in the CHARMM, AMBER, COMPASS, and DREIDING force fields. Setting
|
||||
formulas implemented in LAMMPS that correspond to formulas commonly used
|
||||
in the CHARMM, AMBER, COMPASS, and DREIDING force fields. Setting
|
||||
coefficients is done either from special sections in an input data file
|
||||
via the :doc:`read_data <read_data>` command or in the input script with
|
||||
commands like :doc:`pair_coeff <pair_coeff>` or
|
||||
:doc:`bond_coeff <bond_coeff>` and so on. See the :doc:`Tools <Tools>` doc
|
||||
page for additional tools that can use CHARMM, AMBER, or Materials
|
||||
Studio generated files to assign force field coefficients and convert
|
||||
their output into LAMMPS input.
|
||||
commands like :doc:`pair_coeff <pair_coeff>` or :doc:`bond_coeff
|
||||
<bond_coeff>` and so on. See the :doc:`Tools <Tools>` doc page for
|
||||
additional tools that can use CHARMM, AMBER, or Materials Studio
|
||||
generated files to assign force field coefficients and convert their
|
||||
output into LAMMPS input.
|
||||
|
||||
See :ref:`(MacKerell) <howto-MacKerell>` for a description of the CHARMM force
|
||||
field. See :ref:`(Cornell) <howto-Cornell>` for a description of the AMBER
|
||||
force field. See :ref:`(Sun) <howto-Sun>` for a description of the COMPASS
|
||||
force field.
|
||||
|
||||
.. _charmm: http://www.scripps.edu/brooks
|
||||
|
||||
.. _amber: http://amber.scripps.edu
|
||||
See :ref:`(MacKerell) <howto-MacKerell>` for a description of the CHARMM
|
||||
force field. See :ref:`(Cornell) <howto-Cornell>` for a description of
|
||||
the AMBER force field. See :ref:`(Sun) <howto-Sun>` for a description
|
||||
of the COMPASS force field.
|
||||
|
||||
The interaction styles listed below compute force field formulas that
|
||||
are consistent with common options in CHARMM or AMBER. See each
|
||||
@ -41,9 +37,10 @@ command's documentation for the formula it computes.
|
||||
|
||||
.. note::
|
||||
|
||||
For CHARMM, newer *charmmfsw* or *charmmfsh* styles were released
|
||||
in March 2017. We recommend they be used instead of the older *charmm*
|
||||
styles. See discussion of the differences on the :doc:`pair charmm <pair_charmm>` and :doc:`dihedral charmm <dihedral_charmm>` doc
|
||||
For CHARMM, newer *charmmfsw* or *charmmfsh* styles were released in
|
||||
March 2017. We recommend they be used instead of the older *charmm*
|
||||
styles. See discussion of the differences on the :doc:`pair charmm
|
||||
<pair_charmm>` and :doc:`dihedral charmm <dihedral_charmm>` doc
|
||||
pages.
|
||||
|
||||
COMPASS is a general force field for atomistic simulation of common
|
||||
|
||||
@ -46,7 +46,7 @@ This tutorial assumes that you are operating in a command-line environment
|
||||
using a shell like Bash.
|
||||
|
||||
- Linux: any Terminal window will work
|
||||
- MacOS X: launch the Terminal application.
|
||||
- macOS: launch the Terminal application.
|
||||
- Windows 10: install and run the :doc:`Windows Subsystem for Linux <Howto_wsl>`
|
||||
|
||||
We also assume that you have downloaded and unpacked a recent LAMMPS source code package
|
||||
@ -56,7 +56,7 @@ You should change into the top level directory of the LAMMPS source tree all
|
||||
paths mentioned in the tutorial are relative to that. Immediately after downloading
|
||||
it should look like this:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ ls
|
||||
bench doc lib potentials README tools
|
||||
@ -104,7 +104,7 @@ the progress of the configuration printed to the screen followed by a
|
||||
summary of the enabled features, options and compiler settings. A typical
|
||||
summary screen will look like this:
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: console
|
||||
|
||||
$ cmake ../cmake/
|
||||
-- The CXX compiler identification is GNU 8.2.0
|
||||
|
||||
@ -10,7 +10,7 @@ changes or additions you have made to LAMMPS into the official LAMMPS
|
||||
distribution. It uses the process of updating this very tutorial as an
|
||||
example to describe the individual steps and options. You need to be
|
||||
familiar with git and you may want to have a look at the `git book
|
||||
<http://git-scm.com/book/>`_ to familiarize yourself with some of the
|
||||
<https://git-scm.com/book/>`_ to familiarize yourself with some of the
|
||||
more advanced git features used below.
|
||||
|
||||
As of fall 2016, submitting contributions to LAMMPS via pull requests
|
||||
@ -78,13 +78,13 @@ machine via HTTPS:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git clone https://github.com/<your user name>/lammps.git <some name>
|
||||
git clone https://github.com/<your user name>/lammps.git <some name>
|
||||
|
||||
or, if you have set up your GitHub account for using SSH keys, via SSH:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git clone git@github.com:<your user name>/lammps.git
|
||||
git clone git@github.com:<your user name>/lammps.git
|
||||
|
||||
You can find the proper URL by clicking the "Clone or download"-button:
|
||||
|
||||
@ -103,21 +103,21 @@ and use git pull:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd mylammps
|
||||
$ git checkout develop
|
||||
$ git pull https://github.com/lammps/lammps develop
|
||||
cd mylammps
|
||||
git checkout develop
|
||||
git pull https://github.com/lammps/lammps develop
|
||||
|
||||
You can also add this URL as a remote:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git remote add upstream https://www.github.com/lammps/lammps
|
||||
git remote add upstream https://www.github.com/lammps/lammps
|
||||
|
||||
From then on you can update your upstream branches with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git fetch upstream
|
||||
git fetch upstream
|
||||
|
||||
and then refer to the upstream repository branches with
|
||||
`upstream/develop` or `upstream/release` and so on.
|
||||
@ -129,8 +129,8 @@ workflow that updated this tutorial, and hence we will call the branch
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git fetch upstream
|
||||
$ git checkout -b github-tutorial-update upstream/develop
|
||||
git fetch upstream
|
||||
git checkout -b github-tutorial-update upstream/develop
|
||||
|
||||
Now that we have changed branches, we can make our changes to our local
|
||||
repository. Just remember that if you want to start working on another,
|
||||
@ -150,8 +150,8 @@ After everything is done, add the files to the branch and commit them:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git add doc/src/Howto_github.txt
|
||||
$ git add doc/src/JPG/tutorial*.png
|
||||
git add doc/src/Howto_github.txt
|
||||
git add doc/src/JPG/tutorial*.png
|
||||
|
||||
.. warning::
|
||||
|
||||
@ -174,13 +174,13 @@ useful message that explains the change.
|
||||
|
||||
.. 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:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git push
|
||||
git push
|
||||
|
||||
Git will ask you for your user name and password on GitHub if you have
|
||||
not configured anything. If your local branch is not present on GitHub yet,
|
||||
@ -188,7 +188,7 @@ it will ask you to add it by running
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git push --set-upstream origin github-tutorial-update
|
||||
git push --set-upstream origin github-tutorial-update
|
||||
|
||||
If you correctly type your user name and
|
||||
password, the feature branch should be added to your fork on GitHub.
|
||||
@ -198,13 +198,13 @@ If you want to make really sure you push to the right repository
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git push origin
|
||||
git push origin
|
||||
|
||||
or using an explicit URL:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git push git@github.com:Pakketeretet2/lammps.git
|
||||
git push git@github.com:Pakketeretet2/lammps.git
|
||||
|
||||
----------
|
||||
|
||||
@ -412,10 +412,10 @@ we need to pull Axel's change back into our branch, and merge them:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git add Howto_github.txt
|
||||
$ git add JPG/tutorial_reverse_pull_request*.png
|
||||
$ git commit -m "Updated text and images on reverse pull requests"
|
||||
$ git pull
|
||||
git add Howto_github.txt
|
||||
git add JPG/tutorial_reverse_pull_request*.png
|
||||
git commit -m "Updated text and images on reverse pull requests"
|
||||
git pull
|
||||
|
||||
In this case, the merge was painless because git could auto-merge:
|
||||
|
||||
@ -428,10 +428,10 @@ commit and push again:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git add Howto_github.txt
|
||||
$ git add JPG/tutorial_reverse_pull_request6.png
|
||||
$ git commit -m "Merged Axel's suggestions and updated text"
|
||||
$ git push git@github.com:Pakketeretet2/lammps
|
||||
git add Howto_github.txt
|
||||
git add JPG/tutorial_reverse_pull_request6.png
|
||||
git commit -m "Merged Axel's suggestions and updated text"
|
||||
git push git@github.com:Pakketeretet2/lammps
|
||||
|
||||
This merge also shows up on the lammps GitHub page:
|
||||
|
||||
@ -456,9 +456,9 @@ branch!
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git checkout develop
|
||||
$ git pull https://github.com/lammps/lammps develop
|
||||
$ git branch -d github-tutorial-update
|
||||
git checkout develop
|
||||
git pull https://github.com/lammps/lammps develop
|
||||
git branch -d github-tutorial-update
|
||||
|
||||
If you do not pull first, it is not really a problem but git will warn
|
||||
you at the next statement that you are deleting a local branch that
|
||||
@ -472,7 +472,7 @@ to your remote(s) as well:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git push origin :github-tutorial-update
|
||||
git push origin :github-tutorial-update
|
||||
|
||||
**Recent changes in the workflow**
|
||||
|
||||
@ -486,5 +486,6 @@ simplify comparisons between releases. Finally, all patches and
|
||||
submissions are subject to automatic testing and code checks to make
|
||||
sure they at the very least compile.
|
||||
|
||||
A discussion of the LAMMPS developer GitHub workflow can be found in the file
|
||||
`doc/github-development-workflow.md <https://github.com/lammps/lammps/blob/develop/doc/github-development-workflow.md>`_
|
||||
A discussion of the LAMMPS developer GitHub workflow can be found in the
|
||||
file `doc/github-development-workflow.md
|
||||
<https://github.com/lammps/lammps/blob/develop/doc/github-development-workflow.md>`_
|
||||
|
||||
@ -47,4 +47,4 @@ to the relevant fixes.
|
||||
.. _Paquay1:
|
||||
|
||||
**(Paquay)** Paquay and Kusters, Biophys. J., 110, 6, (2016).
|
||||
preprint available at `arXiv:1411.3019 <http://arxiv.org/abs/1411.3019/>`_.
|
||||
preprint available at `arXiv:1411.3019 <https://arxiv.org/abs/1411.3019/>`_.
|
||||
|
||||
@ -22,10 +22,11 @@ commands you specify.
|
||||
As discussed below, LAMMPS gives you a variety of ways to determine
|
||||
what quantities are computed and printed when the thermodynamics,
|
||||
dump, or fix commands listed above perform output. Throughout this
|
||||
discussion, note that users can also :doc:`add their own computes and fixes to LAMMPS <Modify>` which can then generate values that can then be
|
||||
output with these commands.
|
||||
discussion, note that users can also :doc:`add their own computes and
|
||||
fixes to LAMMPS <Modify>` which can then generate values that can then
|
||||
be output with these commands.
|
||||
|
||||
The following sub-sections discuss different LAMMPS command related
|
||||
The following sub-sections discuss different LAMMPS commands related
|
||||
to output and the kind of data they operate on and produce:
|
||||
|
||||
* :ref:`Global/per-atom/local data <global>`
|
||||
@ -94,11 +95,11 @@ script references the data determines which style is meant. Example: if
|
||||
a compute provides both a global scalar and a per-atom vector, the
|
||||
former will be accessed by using ``c_ID`` in an equal-style variable,
|
||||
while the latter will be accessed by using ``c_ID`` in an atom-style
|
||||
variable. Note that atom-style variable formulas can also access global
|
||||
scalars, but in this case it is not possible to do directly because of
|
||||
the ambiguity. Instead, an equal-style variable can be defined which
|
||||
accesses the global scalar, and that variable used in the atom-style
|
||||
variable formula in place of ``c_ID``.
|
||||
variable. Note that atom-style variable formulas can also access
|
||||
global scalars, but in this case it is not possible to do this
|
||||
directly because of the ambiguity. Instead, an equal-style variable
|
||||
can be defined which accesses the global scalar, and that variable can
|
||||
be used in the atom-style variable formula in place of ``c_ID``.
|
||||
|
||||
.. _thermo:
|
||||
|
||||
@ -141,9 +142,10 @@ There is also a :doc:`dump custom <dump>` format where the user
|
||||
specifies what values are output with each atom. Pre-defined atom
|
||||
attributes can be specified (id, x, fx, etc). Three additional kinds
|
||||
of keywords can also be specified (c_ID, f_ID, v_name), where a
|
||||
:doc:`compute <compute>` or :doc:`fix <fix>` or :doc:`variable <variable>`
|
||||
provides the values to be output. In each case, the compute, fix, or
|
||||
variable must generate per-atom values for input to the :doc:`dump custom <dump>` command.
|
||||
:doc:`compute <compute>` or :doc:`fix <fix>` or :doc:`variable
|
||||
<variable>` provides the values to be output. In each case, the
|
||||
compute, fix, or variable must generate per-atom values for input to
|
||||
the :doc:`dump custom <dump>` command.
|
||||
|
||||
There is also a :doc:`dump local <dump>` format where the user specifies
|
||||
what local values to output. A pre-defined index keyword can be
|
||||
@ -160,12 +162,13 @@ Fixes that write output files
|
||||
-----------------------------
|
||||
|
||||
Several fixes take various quantities as input and can write output
|
||||
files: :doc:`fix ave/time <fix_ave_time>`, :doc:`fix ave/chunk <fix_ave_chunk>`, :doc:`fix ave/histo <fix_ave_histo>`,
|
||||
:doc:`fix ave/correlate <fix_ave_correlate>`, and :doc:`fix print <fix_print>`.
|
||||
files: :doc:`fix ave/time <fix_ave_time>`, :doc:`fix ave/chunk
|
||||
<fix_ave_chunk>`, :doc:`fix ave/histo <fix_ave_histo>`, :doc:`fix
|
||||
ave/correlate <fix_ave_correlate>`, and :doc:`fix print <fix_print>`.
|
||||
|
||||
The :doc:`fix ave/time <fix_ave_time>` command enables direct output to
|
||||
a file and/or time-averaging of global scalars or vectors. The user
|
||||
specifies one or more quantities as input. These can be global
|
||||
The :doc:`fix ave/time <fix_ave_time>` command enables direct output
|
||||
to a file and/or time-averaging of global scalars or vectors. The
|
||||
user specifies one or more quantities as input. These can be global
|
||||
:doc:`compute <compute>` values, global :doc:`fix <fix>` values, or
|
||||
:doc:`variables <variable>` of any style except the atom style which
|
||||
produces per-atom values. Since a variable can refer to keywords used
|
||||
@ -184,8 +187,8 @@ atoms, e.g. individual molecules. The per-atom quantities can be atom
|
||||
density (mass or number) or atom attributes such as position,
|
||||
velocity, force. They can also be per-atom quantities calculated by a
|
||||
:doc:`compute <compute>`, by a :doc:`fix <fix>`, or by an atom-style
|
||||
:doc:`variable <variable>`. The chunk-averaged output of this fix can
|
||||
also be used as input to other output commands.
|
||||
:doc:`variable <variable>`. The chunk-averaged output of this fix is
|
||||
global and can also be used as input to other output commands.
|
||||
|
||||
The :doc:`fix ave/histo <fix_ave_histo>` command enables direct output
|
||||
to a file of histogrammed quantities, which can be global or per-atom
|
||||
@ -202,32 +205,35 @@ written to the screen and log file or to a separate file, periodically
|
||||
during a running simulation. The line can contain one or more
|
||||
:doc:`variable <variable>` values for any style variable except the
|
||||
vector or atom styles). As explained above, variables themselves can
|
||||
contain references to global values generated by :doc:`thermodynamic keywords <thermo_style>`, :doc:`computes <compute>`,
|
||||
:doc:`fixes <fix>`, or other :doc:`variables <variable>`, or to per-atom
|
||||
values for a specific atom. Thus the :doc:`fix print <fix_print>`
|
||||
command is a means to output a wide variety of quantities separate
|
||||
from normal thermodynamic or dump file output.
|
||||
contain references to global values generated by :doc:`thermodynamic
|
||||
keywords <thermo_style>`, :doc:`computes <compute>`, :doc:`fixes
|
||||
<fix>`, or other :doc:`variables <variable>`, or to per-atom values
|
||||
for a specific atom. Thus the :doc:`fix print <fix_print>` command is
|
||||
a means to output a wide variety of quantities separate from normal
|
||||
thermodynamic or dump file output.
|
||||
|
||||
.. _computeoutput:
|
||||
|
||||
Computes that process output quantities
|
||||
---------------------------------------
|
||||
|
||||
The :doc:`compute reduce <compute_reduce>` and :doc:`compute reduce/region <compute_reduce>` commands take one or more per-atom
|
||||
or local vector quantities as inputs and "reduce" them (sum, min, max,
|
||||
The :doc:`compute reduce <compute_reduce>` and :doc:`compute
|
||||
reduce/region <compute_reduce>` commands take one or more per-atom or
|
||||
local vector quantities as inputs and "reduce" them (sum, min, max,
|
||||
ave) to scalar quantities. These are produced as output values which
|
||||
can be used as input to other output commands.
|
||||
|
||||
The :doc:`compute slice <compute_slice>` command take one or more global
|
||||
vector or array quantities as inputs and extracts a subset of their
|
||||
values to create a new vector or array. These are produced as output
|
||||
values which can be used as input to other output commands.
|
||||
The :doc:`compute slice <compute_slice>` command take one or more
|
||||
global vector or array quantities as inputs and extracts a subset of
|
||||
their values to create a new vector or array. These are produced as
|
||||
output values which can be used as input to other output commands.
|
||||
|
||||
The :doc:`compute property/atom <compute_property_atom>` command takes a
|
||||
list of one or more pre-defined atom attributes (id, x, fx, etc) and
|
||||
The :doc:`compute property/atom <compute_property_atom>` command takes
|
||||
a list of one or more pre-defined atom attributes (id, x, fx, etc) and
|
||||
stores the values in a per-atom vector or array. These are produced
|
||||
as output values which can be used as input to other output commands.
|
||||
The list of atom attributes is the same as for the :doc:`dump custom <dump>` command.
|
||||
The list of atom attributes is the same as for the :doc:`dump custom
|
||||
<dump>` command.
|
||||
|
||||
The :doc:`compute property/local <compute_property_local>` command takes
|
||||
a list of one or more pre-defined local attributes (bond info, angle
|
||||
|
||||
1078
doc/src/Howto_peri.rst
Normal file
1078
doc/src/Howto_peri.rst
Normal file
File diff suppressed because it is too large
Load Diff
@ -152,14 +152,14 @@ Creating a new instance of PyLammps
|
||||
To create a PyLammps object you need to first import the class from the lammps
|
||||
module. By using the default constructor, a new *lammps* instance is created.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import PyLammps
|
||||
L = PyLammps()
|
||||
|
||||
You can also initialize PyLammps on top of this existing *lammps* object:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from lammps import lammps, PyLammps
|
||||
lmp = lammps()
|
||||
@ -180,14 +180,14 @@ For instance, let's take the following LAMMPS command:
|
||||
In the original interface this command can be executed with the following
|
||||
Python code if *L* was a lammps instance:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.command("region box block 0 10 0 5 -0.5 0.5")
|
||||
|
||||
With the PyLammps interface, any command can be split up into arbitrary parts
|
||||
separated by white-space, passed as individual arguments to a region method.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.region("box block", 0, 10, 0, 5, -0.5, 0.5)
|
||||
|
||||
@ -199,14 +199,14 @@ The benefit of this approach is avoiding redundant command calls and easier
|
||||
parameterization. In the original interface parameterization needed to be done
|
||||
manually by creating formatted strings.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.command("region box block %f %f %f %f %f %f" % (xlo, xhi, ylo, yhi, zlo, zhi))
|
||||
|
||||
In contrast, methods of PyLammps accept parameters directly and will convert
|
||||
them automatically to a final command string.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.region("box block", xlo, xhi, ylo, yhi, zlo, zhi)
|
||||
|
||||
@ -256,7 +256,7 @@ LAMMPS variables can be both defined and accessed via the PyLammps interface.
|
||||
|
||||
To define a variable you can use the :doc:`variable <variable>` command:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.variable("a index 2")
|
||||
|
||||
@ -265,14 +265,14 @@ A dictionary of all variables is returned by L.variables
|
||||
you can access an individual variable by retrieving a variable object from the
|
||||
L.variables dictionary by name
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
a = L.variables['a']
|
||||
|
||||
The variable value can then be easily read and written by accessing the value
|
||||
property of this object.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
print(a.value)
|
||||
a.value = 4
|
||||
@ -284,7 +284,7 @@ LAMMPS expressions can be immediately evaluated by using the eval method. The
|
||||
passed string parameter can be any expression containing global thermo values,
|
||||
variables, compute or fix data.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
result = L.eval("ke") # kinetic energy
|
||||
result = L.eval("pe") # potential energy
|
||||
@ -298,7 +298,7 @@ All atoms in the current simulation can be accessed by using the L.atoms list.
|
||||
Each element of this list is an object which exposes its properties (id, type,
|
||||
position, velocity, force, etc.).
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
# access first atom
|
||||
L.atoms[0].id
|
||||
@ -311,7 +311,7 @@ position, velocity, force, etc.).
|
||||
|
||||
Some properties can also be used to set:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
# set position in 2D simulation
|
||||
L.atoms[0].position = (1.0, 0.0)
|
||||
@ -328,7 +328,7 @@ after a run via the L.runs list. This list contains a growing list of run data.
|
||||
The first element is the output of the first run, the second element that of
|
||||
the second run.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.run(1000)
|
||||
L.runs[0] # data of first 1000 time steps
|
||||
@ -339,14 +339,14 @@ the second run.
|
||||
Each run contains a dictionary of all trajectories. Each trajectory is
|
||||
accessible through its thermo name:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
L.runs[0].thermo.Step # list of time steps in first run
|
||||
L.runs[0].thermo.Ke # list of kinetic energy values in first run
|
||||
|
||||
Together with matplotlib plotting data out of LAMMPS becomes simple:
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
import matplotlib.plot as plt
|
||||
steps = L.runs[0].thermo.Step
|
||||
@ -406,7 +406,7 @@ Four atoms are placed in the simulation and the dihedral potential is applied on
|
||||
them using a datafile. Then one of the atoms is rotated along the central axis by
|
||||
setting its position from Python, which changes the dihedral angle.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
phi = [d \* math.pi / 180 for d in range(360)]
|
||||
|
||||
@ -439,7 +439,7 @@ Initially, a 2D system is created in a state with minimal energy.
|
||||
|
||||
It is then disordered by moving each atom by a random delta.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
random.seed(27848)
|
||||
deltaperturb = 0.2
|
||||
@ -458,7 +458,7 @@ It is then disordered by moving each atom by a random delta.
|
||||
Finally, the Monte Carlo algorithm is implemented in Python. It continuously
|
||||
moves random atoms by a random delta and only accepts certain moves.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
estart = L.eval("pe")
|
||||
elast = estart
|
||||
@ -517,7 +517,7 @@ PyLammps can be run in parallel using mpi4py. This python package can be install
|
||||
The following is a short example which reads in an existing LAMMPS input file and
|
||||
executes it in parallel. You can find in.melt in the examples/melt folder.
|
||||
|
||||
.. code-block:: Python
|
||||
.. code-block:: python
|
||||
|
||||
from mpi4py import MPI
|
||||
from lammps import PyLammps
|
||||
|
||||
@ -38,7 +38,7 @@ the partial charge assignments change:
|
||||
See the :ref:`(Berendsen) <howto-Berendsen>` reference for more details on both
|
||||
the SPC and SPC/E models.
|
||||
|
||||
Wikipedia also has a nice article on `water models <http://en.wikipedia.org/wiki/Water_model>`_.
|
||||
Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -30,9 +30,11 @@ can be coupled to another Langevin thermostat applied to the atoms
|
||||
using :doc:`fix langevin <fix_langevin>` in order to simulate
|
||||
thermostatted spin-lattice systems.
|
||||
|
||||
The magnetic Gilbert damping can also be applied using :doc:`fix langevin/spin <fix_langevin_spin>`. It allows to either dissipate
|
||||
the thermal energy of the Langevin thermostat, or to perform a
|
||||
relaxation of the magnetic configuration toward an equilibrium state.
|
||||
The magnetic damping can also be applied
|
||||
using :doc:`fix langevin/spin <fix_langevin_spin>`.
|
||||
It allows to either dissipate the thermal energy of the Langevin
|
||||
thermostat, or to perform a relaxation of the magnetic configuration
|
||||
toward an equilibrium state.
|
||||
|
||||
The command :doc:`fix setforce/spin <fix_setforce>` allows to set the
|
||||
components of the magnetic precession vectors (while erasing and
|
||||
@ -52,9 +54,11 @@ All the computed magnetic properties can be output by two main
|
||||
commands. The first one is :doc:`compute spin <compute_spin>`, that
|
||||
enables to evaluate magnetic averaged quantities, such as the total
|
||||
magnetization of the system along x, y, or z, the spin temperature, or
|
||||
the magnetic energy. The second command is :doc:`compute property/atom <compute_property_atom>`. It enables to output all the
|
||||
per atom magnetic quantities. Typically, the orientation of a given
|
||||
magnetic spin, or the magnetic force acting on this spin.
|
||||
the magnetic energy. The second command
|
||||
is :doc:`compute property/atom <compute_property_atom>`.
|
||||
It enables to output all the per atom magnetic quantities. Typically,
|
||||
the orientation of a given magnetic spin, or the magnetic force
|
||||
acting on this spin.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ JSON
|
||||
"ke": $(ke)
|
||||
}""" file current_state.json screen no
|
||||
|
||||
.. code-block:: JSON
|
||||
.. code-block:: json
|
||||
:caption: current_state.json
|
||||
|
||||
{
|
||||
|
||||
@ -49,7 +49,7 @@ details:
|
||||
| :math:`\theta` of HOH angle = 104.52\ :math:`^{\circ}`
|
||||
|
|
||||
|
||||
Wikipedia also has a nice article on `water models <http://en.wikipedia.org/wiki/Water_model>`_.
|
||||
Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -8,18 +8,28 @@ This site M is located at a fixed distance away from the oxygen along
|
||||
the bisector of the HOH bond angle. A bond style of *harmonic* and an
|
||||
angle style of *harmonic* or *charmm* should also be used.
|
||||
|
||||
A TIP4P model is run with LAMMPS using either this command
|
||||
A TIP4P model is run with LAMMPS using either these commands
|
||||
for a cutoff model:
|
||||
|
||||
* :doc:`pair_style tip4p/cut <pair_lj_cut_tip4p>`
|
||||
* :doc:`pair_style lj/cut/tip4p/cut <pair_lj_cut_tip4p>`
|
||||
|
||||
or these two commands for a long-range model:
|
||||
or these commands for a long-range model:
|
||||
|
||||
* :doc:`pair_style tip4p/long <pair_coul>`
|
||||
* :doc:`pair_style lj/cut/tip4p/long <pair_lj_cut_tip4p>`
|
||||
* :doc:`pair_style lj/long/tip4p/long <pair_lj_long>`
|
||||
* :doc:`pair_style tip4p/long/soft <pair_fep_soft>`
|
||||
* :doc:`pair_style lj/cut/tip4p/long/soft <pair_fep_soft>`
|
||||
* :doc:`kspace_style pppm/tip4p <kspace_style>`
|
||||
* :doc:`kspace_style pppm/disp/tip4p <kspace_style>`
|
||||
|
||||
For both models, the bond lengths and bond angles should be held fixed
|
||||
using the :doc:`fix shake <fix_shake>` command.
|
||||
The bond lengths and bond angles should be held fixed using the
|
||||
:doc:`fix shake <fix_shake>` or :doc:`fix rattle <fix_shake>` command,
|
||||
unless a parameterization for a flexible TIP4P model is used. The
|
||||
parameter sets listed below are all for rigid TIP4P model variants and
|
||||
thus the bond and angle force constants are not used and can be set to
|
||||
any legal value; only equilibrium length and angle are used.
|
||||
|
||||
These are the additional parameters (in real units) to set for O and H
|
||||
atoms and the water molecule to run a rigid TIP4P model with a cutoff
|
||||
@ -87,17 +97,18 @@ solver (e.g. Ewald or PPPM in LAMMPS):
|
||||
| LJ :math:`\epsilon`, :math:`\sigma` of OH, HH = 0.0
|
||||
|
|
||||
|
||||
Note that the when using the TIP4P pair style, the neighbor list
|
||||
cutoff for Coulomb interactions is effectively extended by a distance
|
||||
2 \* (OM distance), to account for the offset distance of the
|
||||
fictitious charges on O atoms in water molecules. Thus it is
|
||||
typically best in an efficiency sense to use a LJ cutoff >= Coulomb
|
||||
cutoff + 2\*(OM distance), to shrink the size of the neighbor list.
|
||||
This leads to slightly larger cost for the long-range calculation, so
|
||||
you can test the trade-off for your model. The OM distance and the LJ
|
||||
and Coulombic cutoffs are set in the :doc:`pair_style lj/cut/tip4p/long <pair_lj_cut_tip4p>` command.
|
||||
Note that the when using the TIP4P pair style, the neighbor list cutoff
|
||||
for Coulomb interactions is effectively extended by a distance 2 \* (OM
|
||||
distance), to account for the offset distance of the fictitious charges
|
||||
on O atoms in water molecules. Thus it is typically best in an
|
||||
efficiency sense to use a LJ cutoff >= Coulomb cutoff + 2\*(OM
|
||||
distance), to shrink the size of the neighbor list. This leads to
|
||||
slightly larger cost for the long-range calculation, so you can test the
|
||||
trade-off for your model. The OM distance and the LJ and Coulombic
|
||||
cutoffs are set in the :doc:`pair_style lj/cut/tip4p/long
|
||||
<pair_lj_cut_tip4p>` command.
|
||||
|
||||
Wikipedia also has a nice article on `water models <http://en.wikipedia.org/wiki/Water_model>`_.
|
||||
Wikipedia also has a nice article on `water models <https://en.wikipedia.org/wiki/Water_model>`_.
|
||||
|
||||
----------
|
||||
|
||||
|
||||
@ -17,9 +17,10 @@ formats. See the :doc:`Tools <Tools>` page for details.
|
||||
|
||||
A Python-based toolkit distributed by our group can read native LAMMPS
|
||||
dump files, including custom dump files with additional columns of
|
||||
user-specified atom information, and convert them to various formats
|
||||
or pipe them into visualization software directly. See the `Pizza.py WWW site <pizza_>`_ for details. Specifically, Pizza.py can convert
|
||||
LAMMPS dump files into PDB, XYZ, `EnSight <ensight_>`_, and VTK formats.
|
||||
user-specified atom information, and convert them to various formats or
|
||||
pipe them into visualization software directly. See the `Pizza.py WWW
|
||||
site <pizza_>`_ for details. Specifically, Pizza.py can convert LAMMPS
|
||||
dump files into PDB, XYZ, `EnSight <ensight_>`_, and VTK formats.
|
||||
Pizza.py can pipe LAMMPS dump files directly into the Raster3d and
|
||||
RasMol visualization programs. Pizza.py has tools that do interactive
|
||||
3d OpenGL visualization and one that creates SVG images of dump file
|
||||
|
||||
@ -3,10 +3,20 @@ Install LAMMPS
|
||||
|
||||
You can download LAMMPS as an executable or as source code.
|
||||
|
||||
With source code, you also have to :doc:`build LAMMPS <Build>`. But you
|
||||
have more flexibility as to what features to include or exclude in the
|
||||
build. If you plan to :doc:`modify or extend LAMMPS <Modify>`, then you
|
||||
need the source code.
|
||||
When downloading the LAMMPS source code, you also have to :doc:`build
|
||||
LAMMPS <Build>`. But you have more flexibility as to what features to
|
||||
include or exclude in the build. When you download and install
|
||||
pre-compiled LAMMPS executables, you are limited to install which
|
||||
version of LAMMPS is available and which features are included of these
|
||||
builds. If you plan to :doc:`modify or extend LAMMPS <Modify>`, then
|
||||
you **must** build LAMMPS from the source code.
|
||||
|
||||
.. note::
|
||||
|
||||
If you have questions about the pre-compiled LAMMPS executables, you
|
||||
need to contact the people preparing those executables. The LAMMPS
|
||||
developers have no control over their choices of how they configure
|
||||
and build their packages and when they update them.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
@ -1,24 +1,25 @@
|
||||
Download an executable for Linux or Mac via Conda
|
||||
-------------------------------------------------
|
||||
|
||||
Binaries are available for MacOS or Linux via `Conda <conda_>`_.
|
||||
Pre-compiled LAMMPS binaries are available for macOS or Linux via the
|
||||
`Conda <conda_>`_ package management system.
|
||||
|
||||
First, one must setup the Conda package manager on your system. Follow the
|
||||
instructions to install `Miniconda <mini_conda_install_>`_, then create a conda
|
||||
environment (named `my-lammps-env` or whatever you prefer) for your lammps
|
||||
environment (named `my-lammps-env` or whatever you prefer) for your LAMMPS
|
||||
install:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
% conda config --add channels conda-forge
|
||||
% conda create -n my-lammps-env
|
||||
conda config --add channels conda-forge
|
||||
conda create -n my-lammps-env
|
||||
|
||||
Then, you can install lammps on your system with the following command:
|
||||
Then, you can install LAMMPS on your system with the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
% conda activate my-lammps-env
|
||||
% conda install lammps
|
||||
conda activate my-lammps-env
|
||||
conda install lammps
|
||||
|
||||
The LAMMPS binary is built with the :ref:`KIM package <kim>` which
|
||||
results in Conda also installing the `kim-api` binaries when LAMMPS is
|
||||
@ -27,7 +28,7 @@ install the `openkim-models` package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
% conda install openkim-models
|
||||
conda install openkim-models
|
||||
|
||||
If you have problems with the installation you can post issues to
|
||||
`this link <conda_forge_lammps_>`_.
|
||||
@ -38,3 +39,10 @@ up the Conda capability.
|
||||
.. _openkim: https://openkim.org
|
||||
.. _conda: https://docs.conda.io/en/latest/index.html
|
||||
.. _mini_conda_install: https://docs.conda.io/en/latest/miniconda.html
|
||||
|
||||
.. note::
|
||||
|
||||
If you have questions about these pre-compiled LAMMPS executables,
|
||||
you need to contact the people preparing those packages. The LAMMPS
|
||||
developers have no control over their choices of how they configure
|
||||
and build their packages and when they update them.
|
||||
|
||||
@ -41,7 +41,7 @@ create a local copy of the LAMMPS repository with a command like:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git clone -b release https://github.com/lammps/lammps.git mylammps
|
||||
git clone -b release https://github.com/lammps/lammps.git mylammps
|
||||
|
||||
where "mylammps" is the name of the directory you wish to create on
|
||||
your machine and "release" is one of the 3 branches listed above.
|
||||
@ -78,10 +78,10 @@ from within the "mylammps" directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git checkout release # not needed if you always stay in this branch
|
||||
$ git checkout stable # use one of these 3 checkout commands
|
||||
$ git checkout develop # to choose the branch to follow
|
||||
$ git pull
|
||||
git checkout release # not needed if you always stay in this branch
|
||||
git checkout stable # use one of these 3 checkout commands
|
||||
git checkout develop # to choose the branch to follow
|
||||
git pull
|
||||
|
||||
Doing a "pull" will not change any files you have added to the LAMMPS
|
||||
directory structure. It will also not change any existing LAMMPS
|
||||
@ -97,7 +97,7 @@ this is as follows.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git checkout tagID
|
||||
git checkout tagID
|
||||
|
||||
Stable versions and what tagID to use for a particular stable version
|
||||
are discussed on `this page <https://www.lammps.org/bug.html#version>`_.
|
||||
@ -138,13 +138,13 @@ changed. How to do this depends on the build system you are using.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make purge # remove any deprecated src files
|
||||
$ make package-update # sync package files with src files
|
||||
$ make foo # re-build for your machine (mpi, serial, etc)
|
||||
make purge # remove any deprecated src files
|
||||
make package-update # sync package files with src files
|
||||
make foo # re-build for your machine (mpi, serial, etc)
|
||||
|
||||
to enforce consistency of the source between the src folder
|
||||
and package directories. This is OK to do even if you don't
|
||||
use any packages. The "make purge" command removes any deprecated
|
||||
use any packages. The ``make purge`` command removes any deprecated
|
||||
src files if they were removed by the patch from a package
|
||||
sub-directory.
|
||||
|
||||
@ -160,9 +160,9 @@ changed. How to do this depends on the build system you are using.
|
||||
:class: note
|
||||
|
||||
The servers at github.com support the "https://" access protocol for
|
||||
anonymous, read-only access. If you have a suitably configured GitHub
|
||||
account, you may also use SSH protocol with the
|
||||
URL "git@github.com:lammps/lammps.git".
|
||||
anonymous, read-only access. If you have a suitably configured
|
||||
GitHub account, you may also use SSH protocol with the URL
|
||||
"git@github.com:lammps/lammps.git".
|
||||
|
||||
The LAMMPS GitHub project is currently managed by Axel Kohlmeyer
|
||||
(Temple U, akohlmey at gmail.com).
|
||||
|
||||
@ -3,13 +3,19 @@ Download an executable for Linux
|
||||
|
||||
Binaries are available for different versions of Linux:
|
||||
|
||||
| :ref:`Pre-built Ubuntu Linux executables <ubuntu>`
|
||||
| :ref:`Pre-built Fedora Linux executables <fedora>`
|
||||
| :ref:`Pre-built EPEL Linux executables (RHEL, CentOS) <epel>`
|
||||
| :ref:`Pre-built OpenSuse Linux executables <opensuse>`
|
||||
| :ref:`Gentoo Linux executable <gentoo>`
|
||||
| :ref:`Arch Linux build-script <arch>`
|
||||
|
|
||||
- :ref:`Pre-built Ubuntu Linux executables <ubuntu>`
|
||||
- :ref:`Pre-built Fedora Linux executables <fedora>`
|
||||
- :ref:`Pre-built EPEL Linux executables (RHEL, CentOS) <epel>`
|
||||
- :ref:`Pre-built OpenSuse Linux executables <opensuse>`
|
||||
- :ref:`Gentoo Linux executable <gentoo>`
|
||||
- :ref:`Arch Linux build-script <arch>`
|
||||
|
||||
.. note::
|
||||
|
||||
If you have questions about these pre-compiled LAMMPS executables,
|
||||
you need to contact the people preparing those packages. The LAMMPS
|
||||
developers have no control over their choices of how they configure
|
||||
and build their packages and when they update them.
|
||||
|
||||
----------
|
||||
|
||||
@ -18,86 +24,53 @@ Binaries are available for different versions of Linux:
|
||||
Pre-built Ubuntu Linux executables
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
A pre-built LAMMPS executable suitable for running on the latest
|
||||
Ubuntu Linux versions, can be downloaded as a Debian package. This
|
||||
allows you to install LAMMPS with a single command, and stay
|
||||
up-to-date with the current stable version of LAMMPS by simply updating
|
||||
your operating system. Please note, that the repository below offers
|
||||
two LAMMPS packages, ``lammps-daily`` and ``lammps-stable``. The
|
||||
LAMMPS developers recommend to use the ``lammps-stable`` package for
|
||||
any production simulations. The ``lammps-daily`` package is built
|
||||
from the LAMMPS development sources, and those versions may have known
|
||||
issues and bugs when new features are added and the software has not
|
||||
undergone full release testing.
|
||||
|
||||
To install the appropriate personal-package archives (PPAs), do the
|
||||
following once:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo add-apt-repository ppa:gladky-anton/lammps
|
||||
$ sudo add-apt-repository ppa:openkim/latest
|
||||
$ sudo apt-get update
|
||||
A pre-built LAMMPS executable suitable for running on the latest Ubuntu
|
||||
Linux versions, can be downloaded as a Debian package. This allows you
|
||||
to install LAMMPS with a single command, and stay (mostly) up-to-date
|
||||
with the current stable version of LAMMPS by simply updating your
|
||||
operating system.
|
||||
|
||||
To install LAMMPS do the following once:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo apt-get install lammps-stable
|
||||
sudo apt-get install lammps
|
||||
|
||||
This downloads an executable named ``lmp_stable`` to your box, which
|
||||
can then be used in the usual way to run input scripts:
|
||||
This downloads an executable named ``lmp`` to your box and multiple
|
||||
packages with supporting data, examples and libraries as well as any
|
||||
missing dependencies. This executable can then be used in the usual way
|
||||
to run input scripts:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ lmp_stable -in in.lj
|
||||
lmp -in in.lj
|
||||
|
||||
To update LAMMPS to the most current stable version, do the following:
|
||||
To update LAMMPS to the latest packaged version, do the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo apt-get update
|
||||
sudo apt-get update
|
||||
|
||||
which will also update other packages on your system.
|
||||
|
||||
To get a copy of the current documentation and examples:
|
||||
The ``lmp`` binary is built with the :ref:`KIM package <kim>` included,
|
||||
which results in the above command also installing the ``kim-api``
|
||||
binaries when LAMMPS is installed. In order to use potentials from
|
||||
`openkim.org <openkim_>`_, you can also install the ``openkim-models``
|
||||
package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo apt-get install lammps-stable-doc
|
||||
|
||||
which will download the doc files in
|
||||
``/usr/share/doc/lammps-stable-doc/doc`` and example problems in
|
||||
``/usr/share/doc/lammps-doc/examples``.
|
||||
|
||||
To get a copy of the current potentials files:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo apt-get install lammps-stable-data
|
||||
|
||||
which will download the potentials files to
|
||||
``/usr/share/lammps-stable/potentials``. The ``lmp_stable`` binary is
|
||||
hard-coded to look for potential files in this directory (it does not
|
||||
use the ``LAMMPS_POTENTIALS`` environment variable, as described
|
||||
in :doc:`pair_coeff <pair_coeff>` command).
|
||||
|
||||
The ``lmp_stable`` binary is built with the :ref:`KIM package <kim>` which
|
||||
results in the above command also installing the ``kim-api`` binaries when LAMMPS
|
||||
is installed. In order to use potentials from `openkim.org <openkim_>`_, you
|
||||
can install the ``openkim-models`` package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo apt-get install openkim-models
|
||||
sudo apt-get install openkim-models
|
||||
|
||||
Or use the KIM-API commands to download and install individual models.
|
||||
To un-install LAMMPS, do the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo apt-get remove lammps-stable
|
||||
sudo apt-get remove lammps
|
||||
|
||||
Please use ``lmp_stable -help`` to see which compilation options, packages,
|
||||
Please use ``lmp -help`` to see which compilation options, packages,
|
||||
and styles are included in the binary.
|
||||
|
||||
Thanks to Anton Gladky (gladky.anton at gmail.com) for setting up this
|
||||
@ -110,29 +83,29 @@ Ubuntu package capability.
|
||||
Pre-built Fedora Linux executables
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Pre-built LAMMPS packages for stable releases are available
|
||||
in the Fedora Linux distribution as of version 28. The packages
|
||||
can be installed via the dnf package manager. There are 3 basic
|
||||
varieties (lammps = no MPI, lammps-mpich = MPICH MPI library,
|
||||
lammps-openmpi = OpenMPI MPI library) and for each support for
|
||||
linking to the C library interface (lammps-devel, lammps-mpich-devel,
|
||||
lammps-openmpi-devel), the header for compiling programs using
|
||||
the C library interface (lammps-headers), and the LAMMPS python
|
||||
module for Python 3. All packages can be installed at the same
|
||||
time and the name of the LAMMPS executable is ``lmp`` and ``lmp_openmpi``
|
||||
or ``lmp_mpich`` respectively. By default, ``lmp`` will refer to the
|
||||
serial executable, unless one of the MPI environment modules is loaded
|
||||
(``module load mpi/mpich-x86_64`` or ``module load mpi/openmpi-x86_64``).
|
||||
Then the corresponding parallel LAMMPS executable can be used.
|
||||
The same mechanism applies when loading the LAMMPS python module.
|
||||
Pre-built LAMMPS packages for stable releases are available in the
|
||||
Fedora Linux distribution as of Fedora version 28. The packages can be
|
||||
installed via the dnf package manager. There are 3 basic varieties
|
||||
(lammps = no MPI, lammps-mpich = MPICH MPI library, lammps-openmpi =
|
||||
OpenMPI MPI library) and for each support for linking to the C library
|
||||
interface (lammps-devel, lammps-mpich-devel, lammps-openmpi-devel), the
|
||||
header for compiling programs using the C library interface
|
||||
(lammps-headers), and the LAMMPS python module for Python 3. All
|
||||
packages can be installed at the same time and the name of the LAMMPS
|
||||
executable is ``lmp`` and ``lmp_openmpi`` or ``lmp_mpich`` respectively.
|
||||
By default, ``lmp`` will refer to the serial executable, unless one of
|
||||
the MPI environment modules is loaded (``module load mpi/mpich-x86_64``
|
||||
or ``module load mpi/openmpi-x86_64``). Then the corresponding parallel
|
||||
LAMMPS executable can be used. The same mechanism applies when loading
|
||||
the LAMMPS python module.
|
||||
|
||||
To install LAMMPS with OpenMPI and run an input ``in.lj`` with 2 CPUs do:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ dnf install lammps-openmpi
|
||||
$ module load mpi/openmpi-x86_64
|
||||
$ mpirun -np 2 lmp -in in.lj
|
||||
dnf install lammps-openmpi
|
||||
module load mpi/openmpi-x86_64
|
||||
mpirun -np 2 lmp -in in.lj
|
||||
|
||||
The ``dnf install`` command is needed only once. In case of a new LAMMPS
|
||||
stable release, ``dnf update`` will automatically update to the newer
|
||||
@ -148,7 +121,7 @@ can install the `openkim-models` package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ dnf install openkim-models
|
||||
dnf install openkim-models
|
||||
|
||||
Please use ``lmp -help`` to see which compilation options, packages,
|
||||
and styles are included in the binary.
|
||||
@ -189,14 +162,14 @@ in OpenSuse as of Leap 15.0. You can install the package with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ zypper install lammps
|
||||
zypper install lammps
|
||||
|
||||
This includes support for OpenMPI. The name of the LAMMPS executable
|
||||
is ``lmp``. Thus to run an input in parallel on 2 CPUs you would do:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ mpirun -np 2 lmp -in in.lj
|
||||
mpirun -np 2 lmp -in in.lj
|
||||
|
||||
Please use ``lmp -help`` to see which compilation options, packages,
|
||||
and styles are included in the binary.
|
||||
@ -208,7 +181,7 @@ can install the `openkim-models` package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ zypper install openkim-models
|
||||
zypper install openkim-models
|
||||
|
||||
Thanks to Christoph Junghans (LANL) for making LAMMPS available in OpenSuse.
|
||||
|
||||
@ -224,7 +197,7 @@ typing:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
% emerge --ask lammps
|
||||
emerge --ask lammps
|
||||
|
||||
Note that in Gentoo the LAMMPS source is downloaded and the package is
|
||||
built on the your machine.
|
||||
@ -233,7 +206,7 @@ Certain LAMMPS packages can be enable via USE flags, type
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
% equery uses lammps
|
||||
equery uses lammps
|
||||
|
||||
for details.
|
||||
|
||||
@ -256,10 +229,10 @@ any of the above names in-place of lammps.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git clone https://aur.archlinux.org/lammps.git
|
||||
$ cd lammps
|
||||
$ makepkg -s
|
||||
$ makepkg -i
|
||||
git clone https://aur.archlinux.org/lammps.git
|
||||
cd lammps
|
||||
makepkg -s
|
||||
makepkg -i
|
||||
|
||||
To update, you may repeat the above, or change into the cloned directory,
|
||||
and execute the following, after which, if there are any changes, you may
|
||||
@ -267,9 +240,16 @@ use makepkg as above.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git pull
|
||||
git pull
|
||||
|
||||
Alternatively, you may use an AUR helper to install these packages.
|
||||
|
||||
Note that the AUR provides build-scripts that download the source and
|
||||
the build the package on your machine.
|
||||
|
||||
.. note::
|
||||
|
||||
It looks like the Arch Linux AUR repository build scripts for LAMMPS
|
||||
have not been updated since the 29 October 2020 version. You may want
|
||||
to consider installing a more current version of LAMMPS from source
|
||||
directly.
|
||||
|
||||
@ -12,7 +12,7 @@ the following commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
% brew install lammps
|
||||
brew install lammps
|
||||
|
||||
This will install the executables "lammps_serial" and "lammps_mpi", as well as
|
||||
the LAMMPS "doc", "potentials", "tools", "bench", and "examples" directories.
|
||||
@ -22,7 +22,7 @@ Lennard-Jones benchmark file:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
% brew test lammps -v
|
||||
brew test lammps -v
|
||||
|
||||
The LAMMPS binary is built with the :ref:`KIM package <kim>` which
|
||||
results in Homebrew also installing the `kim-api` binaries when LAMMPS is
|
||||
@ -31,7 +31,7 @@ install the `openkim-models` package
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
% brew install openkim-models
|
||||
brew install openkim-models
|
||||
|
||||
If you have problems with the installation you can post issues to
|
||||
`this link <https://github.com/Homebrew/homebrew-core/issues>`_.
|
||||
|
||||
@ -26,7 +26,7 @@ command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar -xzvf lammps*.tar.gz
|
||||
tar -xzvf lammps*.tar.gz
|
||||
|
||||
This will create a LAMMPS directory with the version date
|
||||
in its name, e.g. lammps-23Jun18.
|
||||
@ -40,7 +40,7 @@ with the following command, to create a lammps-<version> dir:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ unzip lammps*.zip
|
||||
unzip lammps*.zip
|
||||
|
||||
This version corresponds to the selected LAMMPS patch or stable
|
||||
release.
|
||||
|
||||
@ -6,7 +6,7 @@ Windows system can be downloaded from this site:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
`http://packages.lammps.org/windows.html <http://packages.lammps.org/windows.html>`_
|
||||
`https://packages.lammps.org/windows.html <https://packages.lammps.org/windows.html>`_
|
||||
|
||||
Note that each installer package has a date in its name, which
|
||||
corresponds to the LAMMPS version of the same date. Installers for
|
||||
|
||||
@ -4,13 +4,13 @@ Authors of LAMMPS
|
||||
The primary LAMMPS developers are at Sandia National Labs and Temple
|
||||
University:
|
||||
|
||||
* `Steve Plimpton <sjp_>`_, sjplimp at sandia.gov
|
||||
* `Steve Plimpton <sjp_>`_, sjplimp at gmail.com
|
||||
* Aidan Thompson, athomps at sandia.gov
|
||||
* Stan Moore, stamoor at sandia.gov
|
||||
* Axel Kohlmeyer, akohlmey at gmail.com
|
||||
* Richard Berger, richard.berger at outlook.com
|
||||
|
||||
.. _sjp: http://www.cs.sandia.gov/~sjplimp
|
||||
.. _sjp: https://sjplimp.github.io
|
||||
.. _lws: https://www.lammps.org
|
||||
|
||||
Past developers include Paul Crozier and Mark Stevens, both at Sandia,
|
||||
|
||||
@ -27,7 +27,7 @@ namely https://www.lammps.org.
|
||||
The original publication describing the parallel algorithms used in the
|
||||
initial versions of LAMMPS is:
|
||||
|
||||
`S. Plimpton, Fast Parallel Algorithms for Short-Range Molecular Dynamics, J Comp Phys, 117, 1-19 (1995). <http://www.sandia.gov/~sjplimp/papers/jcompphys95.pdf>`_
|
||||
`S. Plimpton, Fast Parallel Algorithms for Short-Range Molecular Dynamics, J Comp Phys, 117, 1-19 (1995). <https://doi.org/10.1006/jcph.1995.1039>`_
|
||||
|
||||
|
||||
DOI for the LAMMPS source code
|
||||
|
||||
@ -95,7 +95,7 @@ commands)
|
||||
* metal-organic framework potentials (QuickFF, MO-FF)
|
||||
* implicit solvent potentials: hydrodynamic lubrication, Debye
|
||||
* force-field compatibility with common CHARMM, AMBER, DREIDING, OPLS, GROMACS, COMPASS options
|
||||
* access to the `OpenKIM Repository <http://openkim.org>`_ of potentials via :doc:`kim command <kim_commands>`
|
||||
* access to the `OpenKIM Repository <https://openkim.org>`_ of potentials via the :doc:`kim command <kim_commands>`
|
||||
* hybrid potentials: multiple pair, bond, angle, dihedral, improper potentials can be used in one simulation
|
||||
* overlaid potentials: superposition of multiple pair potentials (including many-body) with optional scale factor
|
||||
|
||||
@ -205,7 +205,7 @@ Pre- and post-processing
|
||||
|
||||
.. _pizza: https://lammps.github.io/pizza
|
||||
|
||||
.. _python: http://www.python.org
|
||||
.. _python: https://www.python.org
|
||||
|
||||
.. _special:
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ Here are suggestions on how to perform these tasks:
|
||||
linear bead-spring polymer chains. The moltemplate program is a true
|
||||
molecular builder that will generate complex molecular models. See
|
||||
the :doc:`Tools <Tools>` page for details on tools packaged with
|
||||
LAMMPS. The `Pre/post processing page <http:/www.lammps.org/prepost.html>`_ of the LAMMPS website
|
||||
LAMMPS. The `Pre/post processing page <https:/www.lammps.org/prepost.html>`_ of the LAMMPS website
|
||||
describes a variety of third party tools for this task. Furthermore,
|
||||
some LAMMPS internal commands allow to reconstruct, or selectively add
|
||||
topology information, as well as provide the option to insert molecule
|
||||
@ -80,5 +80,5 @@ Here are suggestions on how to perform these tasks:
|
||||
`Pizza.py <https://lammps.github.io/pizza>`_ which can do certain kinds of
|
||||
setup, analysis, plotting, and visualization (via OpenGL) for LAMMPS
|
||||
simulations. It thus provides some functionality for several of the
|
||||
above bullets. Pizza.py is written in `Python <http://www.python.org>`_
|
||||
and is available for download from `this page <http://www.cs.sandia.gov/~sjplimp/download.html>`_.
|
||||
above bullets. Pizza.py is written in `Python <https://www.python.org>`_
|
||||
and is available for download from `this page <https://sjplimp.github.io/download.html>`_.
|
||||
|
||||
@ -23,9 +23,9 @@ applies to LAMMPS is in the LICENSE file included in the LAMMPS distribution.
|
||||
|
||||
.. _lgpl: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
.. _gnuorg: http://www.gnu.org
|
||||
.. _gnuorg: https://www.gnu.org
|
||||
|
||||
.. _opensource: http://www.opensource.org
|
||||
.. _opensource: https://www.opensource.org
|
||||
|
||||
Here is a more specific summary of what the GPL means for LAMMPS users:
|
||||
|
||||
|
||||
BIN
doc/src/JPG/dump.peri.2000.png
Normal file
BIN
doc/src/JPG/dump.peri.2000.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
BIN
doc/src/JPG/dump.peri.300.png
Normal file
BIN
doc/src/JPG/dump.peri.300.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
BIN
doc/src/JPG/dump.peri.600.png
Normal file
BIN
doc/src/JPG/dump.peri.600.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 157 KiB |
BIN
doc/src/JPG/ovito-peri-snap.png
Normal file
BIN
doc/src/JPG/ovito-peri-snap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 494 KiB |
BIN
doc/src/JPG/pdlammps_fig1.png
Normal file
BIN
doc/src/JPG/pdlammps_fig1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
BIN
doc/src/JPG/pdlammps_fig2.png
Normal file
BIN
doc/src/JPG/pdlammps_fig2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
@ -2,12 +2,13 @@ LAMMPS Library Interfaces
|
||||
*************************
|
||||
|
||||
As described on the :doc:`library interface to LAMMPS <Howto_library>`
|
||||
page, LAMMPS can be built as a library (static or shared), so that
|
||||
it can be called by another code, used in a :doc:`coupled manner
|
||||
page, LAMMPS can be built as a library (static or shared), so that it
|
||||
can be called by another code, used in a :doc:`coupled manner
|
||||
<Howto_couple>` with other codes, or driven through a :doc:`Python
|
||||
script <Python_head>`. Even the LAMMPS standalone executable is
|
||||
essentially a thin wrapper on top of the LAMMPS library, creating a
|
||||
LAMMPS instance, processing input and then existing.
|
||||
script <Python_head>`. The LAMMPS standalone executable itself is
|
||||
essentially a thin wrapper on top of the LAMMPS library, which creates a
|
||||
LAMMPS instance, passes the input for processing to that instance, and
|
||||
then exits.
|
||||
|
||||
Most of the APIs described below are based on C language wrapper
|
||||
functions in the files ``src/library.h`` and ``src/library.cpp``, but
|
||||
@ -87,6 +88,18 @@ run LAMMPS in serial mode.
|
||||
message retrieved <lammps_get_last_error_message>`. We thus
|
||||
recommend enabling C++ exceptions when using the library interface,
|
||||
|
||||
.. admonition:: Using the C library interface as a plugin
|
||||
:class: note
|
||||
|
||||
Rather than including the C library directly and link to the LAMMPS
|
||||
library at compile time, you can use the ``liblammpsplugin.h`` header
|
||||
file and the ``liblammpsplugin.c`` C code in the
|
||||
``examples/COUPLE/plugin`` folder for an interface to LAMMPS that is
|
||||
largely identical to the regular library interface, only that it will
|
||||
load a LAMMPS shared library file at runtime. This can be useful for
|
||||
applications where the interface to LAMMPS would be an optional
|
||||
feature.
|
||||
|
||||
.. warning::
|
||||
|
||||
No checks are made on the arguments of the function calls of the C
|
||||
@ -163,5 +176,3 @@ The following links provide some examples and references to the C++ API.
|
||||
:maxdepth: 1
|
||||
|
||||
Cplusplus
|
||||
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ crashes within LAMMPS may be recovered from by enabling
|
||||
:ref:`exceptions <exceptions>`, avoiding them proactively is a safer
|
||||
approach.
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c
|
||||
:caption: Example for using configuration settings functions
|
||||
|
||||
#include "library.h"
|
||||
|
||||
@ -21,7 +21,7 @@ as the "handle" argument in subsequent function calls until that
|
||||
instance is destroyed by calling :cpp:func:`lammps_close`. Here is a
|
||||
simple example demonstrating its use:
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c
|
||||
|
||||
#include "library.h"
|
||||
#include <stdio.h>
|
||||
|
||||
@ -30,7 +30,7 @@ be included in the file or strings, and expansion of variables with
|
||||
``${name}`` or ``$(expression)`` syntax is performed.
|
||||
Below is a short example using some of these functions.
|
||||
|
||||
.. code-block:: C
|
||||
.. code-block:: c
|
||||
|
||||
/* define to make the otherwise hidden prototype for "lammps_open()" visible */
|
||||
#define LAMMPS_LIB_MPI
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user