Compare commits
222 Commits
patch_7Feb
...
patch_23Ju
| Author | SHA1 | Date | |
|---|---|---|---|
| 88c8b6ec6f | |||
| f01e28f574 | |||
| 96627d27b1 | |||
| b3fc574a6a | |||
| 8a3f7560c9 | |||
| 8406e92a9a | |||
| 3b376b4448 | |||
| ca3b7be623 | |||
| c825c52d2f | |||
| 0ea0e4ce59 | |||
| d53d4b4d99 | |||
| b37cd14dd1 | |||
| a921a6bdc1 | |||
| 51a0345941 | |||
| 8d70960e2d | |||
| 5661703b30 | |||
| bc30304f72 | |||
| c76da483fb | |||
| 036a1e47d2 | |||
| 5430c3b592 | |||
| 9b7cb8200c | |||
| 550eedbb1f | |||
| 3a058f278d | |||
| 0f7f0b5f86 | |||
| 3de7534b84 | |||
| 7065462faf | |||
| 2e9d8e1ccb | |||
| 19b84f7cbd | |||
| 9b7c445a15 | |||
| 91e56444ce | |||
| 9b3c8c36bd | |||
| 3403520967 | |||
| d8f969f1df | |||
| 3487deccb6 | |||
| 0926fc627d | |||
| 7999778d94 | |||
| b4ef4c1ff2 | |||
| 72b08e4b87 | |||
| faa64a84e8 | |||
| 32b67fff2b | |||
| f3dbf4122d | |||
| e25ac786da | |||
| f30fba0061 | |||
| 03f319604f | |||
| 0782dab1ec | |||
| c43cce54ab | |||
| 281a368702 | |||
| f28d69b429 | |||
| e674e0c927 | |||
| eebabf99b8 | |||
| 23a19f4431 | |||
| d618b0ffc0 | |||
| ffc71b8733 | |||
| 564df78698 | |||
| 8db0b5ca39 | |||
| 79e26fe829 | |||
| 523d4b0242 | |||
| fe39a3e581 | |||
| 081cc1f992 | |||
| 53c80c2c00 | |||
| 554b64a147 | |||
| dc08dba592 | |||
| 0eaa2775cd | |||
| 852673ce41 | |||
| 8c711e405a | |||
| 25b9f95061 | |||
| ee66a6f8c1 | |||
| b694a5f582 | |||
| 7ab3fce93f | |||
| 1f9509cb6f | |||
| cad1d8ece4 | |||
| b709d75f80 | |||
| 5839909061 | |||
| 30f374de58 | |||
| 0f9fec05fb | |||
| 972a86f0ec | |||
| 7338ebfc94 | |||
| 7132152693 | |||
| c9925f64f7 | |||
| 6da523c8b8 | |||
| 0522284589 | |||
| e10a66dabc | |||
| 51dd631a76 | |||
| d37249787e | |||
| f44841de69 | |||
| 54c5337d2d | |||
| efb0e63bf6 | |||
| 13d78c3afa | |||
| f2910b1d9c | |||
| 78b22a64aa | |||
| 8bb1880c9d | |||
| e7b36c7b90 | |||
| d7804e3770 | |||
| 8d0f9695d2 | |||
| 52b2e4f364 | |||
| 41140149ea | |||
| 85e556ac8f | |||
| cd5437a7e2 | |||
| 00cc82ac94 | |||
| 20f87e3f1d | |||
| 97e34f0667 | |||
| 3e5da9b09a | |||
| a62fcca7a4 | |||
| 778d59fa6b | |||
| 3833a85d7a | |||
| 6d961ab29f | |||
| 001824e0f6 | |||
| 953d32f9b3 | |||
| edba922665 | |||
| 53806d4601 | |||
| 67597722d5 | |||
| 337794a9e9 | |||
| 5f5fb895ff | |||
| 0302d03bc6 | |||
| 0a4fef369f | |||
| 7d5fc356fe | |||
| 8103e5a18f | |||
| e5b56b67fe | |||
| 8ffb7e5f89 | |||
| cb9ab48ce7 | |||
| 1ebb1cee40 | |||
| f0e7101bd2 | |||
| 6fd8b2b177 | |||
| 6edaf42b3d | |||
| 79c047487d | |||
| ac5acb9abf | |||
| 87fbbd3b13 | |||
| 8ac0ec6473 | |||
| 8acba74c4d | |||
| 34bcbdf41d | |||
| d519ca0213 | |||
| a392e8dc09 | |||
| a4d4f77bc2 | |||
| 83a8f72d83 | |||
| 3c54b56cfe | |||
| ff1a08f148 | |||
| 5a53b0fc03 | |||
| e550600ebe | |||
| 7cb13be52a | |||
| ab56d7ecd7 | |||
| bd6ac3ee6d | |||
| 27ca0a8f41 | |||
| f688b9b6b5 | |||
| 16c61b3cc0 | |||
| fb480f22fc | |||
| d0507559a4 | |||
| 58eb331b08 | |||
| c68015ca87 | |||
| 583c22d6e0 | |||
| 58a4694d92 | |||
| 97cf345528 | |||
| 0658abbdd4 | |||
| 72026a58bf | |||
| 7152231a10 | |||
| 8fe8a667b6 | |||
| 560c543e69 | |||
| c5e6650924 | |||
| 10373ea5c9 | |||
| 992b1cf582 | |||
| 1505f3de06 | |||
| 566efe04f2 | |||
| 7586adbb6a | |||
| 69d6ddccc5 | |||
| 5ae496dcef | |||
| bc5d742623 | |||
| 882e699163 | |||
| 9c725d79d6 | |||
| 79fbf437a3 | |||
| d130aa4289 | |||
| 5d8b83a251 | |||
| 5a2548a83d | |||
| a85b310e1f | |||
| e51fd40547 | |||
| 62f271658b | |||
| 0aa742934f | |||
| a26a709a7b | |||
| 027293d285 | |||
| f7d049ac2d | |||
| ea0ff1c8f7 | |||
| 5c1bb5f13a | |||
| 24d9b4b611 | |||
| a0e75c9006 | |||
| 2435b953e1 | |||
| c042e12323 | |||
| e9efe46db9 | |||
| ecc14b7308 | |||
| 0152fe5cdf | |||
| 892d17af22 | |||
| 2cca00203e | |||
| 9f4626a62a | |||
| e890a0b45e | |||
| 68223f0385 | |||
| 1291a88bff | |||
| d9b687450a | |||
| bd950b37d7 | |||
| 21fcdf8c56 | |||
| 6b400fb4bf | |||
| d982298ab2 | |||
| 765fd7f763 | |||
| 0325047c01 | |||
| 2dce8923ee | |||
| 8d1ba074be | |||
| 4675a3b560 | |||
| 8999b1f69f | |||
| 6c2b19c11b | |||
| a425334928 | |||
| db2faf2789 | |||
| fdbb7d0da4 | |||
| 52cd99918f | |||
| a3e6a95ffb | |||
| 5b65169997 | |||
| 5f3bf69e30 | |||
| 507c02b9af | |||
| b7fe47ba48 | |||
| 7dfd11da4b | |||
| 97ba95f30e | |||
| c1945b4ec9 | |||
| c4291a4b8e | |||
| 5b5dfa86c5 | |||
| 3ca3f6959f | |||
| f7b7bfa406 | |||
| 3d2f29c92d |
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3,7 +3,6 @@
|
|||||||
.github export-ignore
|
.github export-ignore
|
||||||
.lgtm.yml export-ignore
|
.lgtm.yml export-ignore
|
||||||
SECURITY.md export-ignore
|
SECURITY.md export-ignore
|
||||||
CITATION.cff export-ignore
|
|
||||||
* text=auto
|
* text=auto
|
||||||
*.jpg -text
|
*.jpg -text
|
||||||
*.pdf -text
|
*.pdf -text
|
||||||
|
|||||||
75
.github/CODEOWNERS
vendored
75
.github/CODEOWNERS
vendored
@ -13,45 +13,39 @@ lib/kim/* @ellio167
|
|||||||
lib/mesont/* @iafoss
|
lib/mesont/* @iafoss
|
||||||
|
|
||||||
# whole packages
|
# whole packages
|
||||||
src/ADIOS/* @pnorbert
|
src/COMPRESS/* @rbberger
|
||||||
src/AMOEBA/* @sjplimp
|
src/GPU/* @ndtrung81
|
||||||
src/BPM/* @jtclemm
|
src/KOKKOS/* @stanmoore1
|
||||||
|
src/KIM/* @ellio167
|
||||||
|
src/LATTE/* @cnegre
|
||||||
|
src/MESSAGE/* @sjplimp
|
||||||
|
src/MLIAP/* @athomps
|
||||||
|
src/SNAP/* @athomps
|
||||||
|
src/SPIN/* @julient31
|
||||||
src/BROWNIAN/* @samueljmcameron
|
src/BROWNIAN/* @samueljmcameron
|
||||||
src/CG-DNA/* @ohenrich
|
src/CG-DNA/* @ohenrich
|
||||||
src/CG-SPICA/* @yskmiyazaki
|
src/CG-SDK/* @akohlmey
|
||||||
src/COLVARS/* @giacomofiorin
|
src/COLVARS/* @giacomofiorin
|
||||||
src/COMPRESS/* @rbberger
|
|
||||||
src/DIELECTRIC/* @ndtrung81
|
src/DIELECTRIC/* @ndtrung81
|
||||||
src/ELECTRODE/* @ludwig-ahrens
|
|
||||||
src/FEP/* @agiliopadua
|
src/FEP/* @agiliopadua
|
||||||
src/GPU/* @ndtrung81
|
src/ML-HDNNP/* @singraber
|
||||||
src/GRANULAR/* @jtclemm @dsbolin
|
|
||||||
src/INTEL/* @wmbrownintel
|
src/INTEL/* @wmbrownintel
|
||||||
src/KIM/* @ellio167
|
|
||||||
src/KOKKOS/* @stanmoore1
|
|
||||||
src/LATTE/* @cnegre
|
|
||||||
src/MANIFOLD/* @Pakketeretet2
|
src/MANIFOLD/* @Pakketeretet2
|
||||||
src/MDI/* @taylor-a-barnes @sjplimp
|
src/MDI/* @taylor-a-barnes
|
||||||
src/MEAM/* @martok
|
src/MEAM/* @martok
|
||||||
src/MESONT/* @iafoss
|
src/MESONT/* @iafoss
|
||||||
src/ML-HDNNP/* @singraber
|
|
||||||
src/ML-IAP/* @athomps
|
|
||||||
src/ML-PACE/* @yury-lysogorskiy
|
|
||||||
src/ML-POD/* @exapde @rohskopf
|
|
||||||
src/MOFFF/* @hheenen
|
src/MOFFF/* @hheenen
|
||||||
src/MOLFILE/* @akohlmey
|
src/MOLFILE/* @akohlmey
|
||||||
src/NETCDF/* @pastewka
|
src/NETCDF/* @pastewka
|
||||||
src/OPENMP/* @akohlmey
|
src/ML-PACE/* @yury-lysogorskiy
|
||||||
src/PHONON/* @lingtikong
|
|
||||||
src/PLUGIN/* @akohlmey
|
|
||||||
src/PLUMED/* @gtribello
|
src/PLUMED/* @gtribello
|
||||||
|
src/PHONON/* @lingtikong
|
||||||
src/PTM/* @pmla
|
src/PTM/* @pmla
|
||||||
|
src/OPENMP/* @akohlmey
|
||||||
src/QMMM/* @akohlmey
|
src/QMMM/* @akohlmey
|
||||||
src/REACTION/* @jrgissing
|
|
||||||
src/REAXFF/* @hasanmetin @stanmoore1
|
src/REAXFF/* @hasanmetin @stanmoore1
|
||||||
|
src/REACTION/* @jrgissing
|
||||||
src/SCAFACOS/* @rhalver
|
src/SCAFACOS/* @rhalver
|
||||||
src/SNAP/* @athomps
|
|
||||||
src/SPIN/* @julient31
|
|
||||||
src/TALLY/* @akohlmey
|
src/TALLY/* @akohlmey
|
||||||
src/UEF/* @danicholson
|
src/UEF/* @danicholson
|
||||||
src/VTK/* @rbberger
|
src/VTK/* @rbberger
|
||||||
@ -61,14 +55,9 @@ src/GPU/pair_vashishta_gpu.* @andeplane
|
|||||||
src/KOKKOS/pair_vashishta_kokkos.* @andeplane
|
src/KOKKOS/pair_vashishta_kokkos.* @andeplane
|
||||||
src/MANYBODY/pair_vashishta_table.* @andeplane
|
src/MANYBODY/pair_vashishta_table.* @andeplane
|
||||||
src/MANYBODY/pair_atm.* @sergeylishchuk
|
src/MANYBODY/pair_atm.* @sergeylishchuk
|
||||||
src/MANYBODY/pair_nb3b_screened.* @flodesani
|
|
||||||
src/REPLICA/*_grem.* @dstelter92
|
src/REPLICA/*_grem.* @dstelter92
|
||||||
src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel
|
src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel
|
||||||
src/EXTRA-COMPUTE/compute_born_matrix.* @Bibobu @athomps
|
|
||||||
src/MISC/*_tracker.* @jtclemm
|
src/MISC/*_tracker.* @jtclemm
|
||||||
src/MC/fix_gcmc.* @athomps
|
|
||||||
src/MC/fix_sgcmc.* @athomps
|
|
||||||
src/REPLICA/fix_pimd_langevin.* @Yi-FanLi
|
|
||||||
|
|
||||||
# core LAMMPS classes
|
# core LAMMPS classes
|
||||||
src/lammps.* @sjplimp
|
src/lammps.* @sjplimp
|
||||||
@ -130,47 +119,41 @@ src/dump_movie.* @akohlmey
|
|||||||
src/exceptions.h @rbberger
|
src/exceptions.h @rbberger
|
||||||
src/fix_nh.* @athomps
|
src/fix_nh.* @athomps
|
||||||
src/info.* @akohlmey @rbberger
|
src/info.* @akohlmey @rbberger
|
||||||
src/min* @sjplimp @stanmoore1
|
|
||||||
src/platform.* @akohlmey
|
|
||||||
src/timer.* @akohlmey
|
src/timer.* @akohlmey
|
||||||
|
src/min* @sjplimp @stanmoore1
|
||||||
src/utils.* @akohlmey @rbberger
|
src/utils.* @akohlmey @rbberger
|
||||||
src/verlet.* @sjplimp @stanmoore1
|
src/verlet.* @sjplimp @stanmoore1
|
||||||
src/math_eigen_impl.h @jewettaij
|
src/math_eigen_impl.h @jewettaij
|
||||||
src/fix_press_langevin.* @Bibobu
|
|
||||||
|
|
||||||
# tools
|
# tools
|
||||||
tools/coding_standard/* @akohlmey @rbberger
|
|
||||||
tools/emacs/* @HaoZeke
|
|
||||||
tools/lammps-shell/* @akohlmey
|
|
||||||
tools/msi2lmp/* @akohlmey
|
tools/msi2lmp/* @akohlmey
|
||||||
tools/offline/* @rbberger
|
tools/emacs/* @HaoZeke
|
||||||
tools/singularity/* @akohlmey @rbberger
|
tools/singularity/* @akohlmey @rbberger
|
||||||
tools/swig/* @akohlmey
|
tools/coding_standard/* @rbberger
|
||||||
tools/valgrind/* @akohlmey
|
tools/valgrind/* @akohlmey
|
||||||
tools/vim/* @hammondkd
|
tools/swig/* @akohlmey
|
||||||
|
tools/offline/* @rbberger
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
unittest/* @akohlmey
|
unittest/* @akohlmey @rbberger
|
||||||
|
|
||||||
# cmake
|
# cmake
|
||||||
cmake/* @akohlmey
|
cmake/* @junghans @rbberger
|
||||||
cmake/Modules/LAMMPSInterfacePlugin.cmake @akohlmey
|
cmake/Modules/Packages/COLVARS.cmake @junghans @rbberger @giacomofiorin
|
||||||
cmake/Modules/MPI4WIN.cmake @akohlmey
|
cmake/Modules/Packages/KIM.cmake @junghans @rbberger @ellio167
|
||||||
cmake/Modules/OpenCLLoader.cmake @akohlmey
|
|
||||||
cmake/Modules/Packages/COLVARS.cmake @giacomofiorin
|
|
||||||
cmake/Modules/Packages/KIM.cmake @ellio167
|
|
||||||
cmake/presets/*.cmake @akohlmey
|
cmake/presets/*.cmake @akohlmey
|
||||||
|
|
||||||
# python
|
# python
|
||||||
python/* @rbberger
|
python/* @rbberger
|
||||||
|
|
||||||
# fortran
|
# fortran
|
||||||
fortran/* @akohlmey @hammondkd
|
fortran/* @akohlmey
|
||||||
|
|
||||||
# docs
|
# docs
|
||||||
doc/* @akohlmey
|
doc/utils/*/* @rbberger
|
||||||
|
doc/Makefile @rbberger
|
||||||
|
doc/README @rbberger
|
||||||
examples/plugin/* @akohlmey
|
examples/plugin/* @akohlmey
|
||||||
examples/PACKAGES/pace/plugin/* @akohlmey
|
|
||||||
|
|
||||||
# for releases
|
# for releases
|
||||||
src/version.h @sjplimp
|
src/version.h @sjplimp
|
||||||
|
|||||||
24
.github/CONTRIBUTING.md
vendored
24
.github/CONTRIBUTING.md
vendored
@ -1,13 +1,13 @@
|
|||||||
# Contributing to LAMMPS via GitHub
|
# Contributing to LAMMPS via GitHub
|
||||||
|
|
||||||
Thank you for considering to contribute to the LAMMPS software project.
|
Thank your for considering to contribute to the LAMMPS software project.
|
||||||
|
|
||||||
The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project.
|
The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project.
|
||||||
|
|
||||||
Thus please also have a look at:
|
Thus please also have a look at:
|
||||||
* [The guide for submitting new features in the LAMMPS manual](https://docs.lammps.org/Modify_contribute.html)
|
* [The guide for submitting new features in the LAMMPS manual](https://www.lammps.org/doc/Modify_contribute.html)
|
||||||
* [The guide on programming style and requirement in the LAMMPS manual](https://docs.lammps.org/Modify_requirements.html)
|
* [The guide on programming style and requirement in the LAMMPS manual](https://www.lammps.org/doc/Modify_style.html)
|
||||||
* [The GitHub tutorial in the LAMMPS manual](http://docs.lammps.org/Howto_github.html)
|
* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html)
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@ -27,17 +27,17 @@ __
|
|||||||
|
|
||||||
## I don't want to read this whole thing I just have a question!
|
## I don't want to read this whole thing I just have a question!
|
||||||
|
|
||||||
> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to the [LAMMPS Material Science Discourse forum](https://matsci.org/lammps). Before posting to the forum, please read the general [guidelines](https://www.lammps.org/guidelines.html) and the forum specific [suggestions](https://matsci.org/t/please-read-this-first-guidelines-and-suggestions-for-posting-lammps-questions/49913). Following those guidelines and suggestions will help greatly to get a helpful response. *Always* mention which LAMMPS version you are using. The MatSci website may be also used for discussions that would be off-topic for the LAMMPS categories. Those will just have to be posted to a different category.
|
> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to either the ['lammps-users' mailing list](https://lammps.sandia.gov/mail.html) or the [LAMMPS Material Science Discourse forum](https://matsci.org/lammps). You do not need to be subscribed to post to the list (but a mailing list subscription avoids having your post delayed until it is approved by a mailing list moderator). Most posts to the mailing list receive a response within less than 24 hours. Before posting to the mailing list, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html). Following those guidelines will help greatly to get a helpful response. Always mention which LAMMPS version you are using. The LAMMPS forum was recently created as part of a larger effort to build a materials science community and have discussions not just about using LAMMPS. Thus the forum may be also used for discussions that would be off-topic for the mailing list. Those will just have to be posted to a more general category.
|
||||||
|
|
||||||
## How Can I Contribute?
|
## How Can I Contribute?
|
||||||
|
|
||||||
There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list or the forum, you can report bugs or suggest enhancements by creating issues on GitHub (or posting them to the lammps-users mailing list or posting in the LAMMPS Materials Science Discourse forum), and you can contribute by submitting pull requests on GitHub or e-mail your code
|
There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list or the forum, you can report bugs or suggest enhancements by creating issues on GitHub (or posting them to the lammps-users mailing list or posting in the LAMMPS Materials Science Discourse forum), and you can contribute by submitting pull requests on GitHub or e-mail your code
|
||||||
to one of the [LAMMPS core developers](https://www.lammps.org/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers.
|
to one of the [LAMMPS core developers](https://lammps.sandia.gov/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers.
|
||||||
|
|
||||||
### Discussing How To Use LAMMPS
|
### Discussing How To Use LAMMPS
|
||||||
|
|
||||||
The LAMMPS mailing list is hosted at SourceForge. The mailing list began in 2005, and now includes tens of thousands of messages in thousands of threads. LAMMPS developers try to respond to posted questions in a timely manner, but there are no guarantees. Please consider that people live in different timezone and may not have time to answer e-mails outside of their work hours.
|
The LAMMPS mailing list is hosted at SourceForge. The mailing list began in 2005, and now includes tens of thousands of messages in thousands of threads. LAMMPS developers try to respond to posted questions in a timely manner, but there are no guarantees. Please consider that people live in different timezone and may not have time to answer e-mails outside of their work hours.
|
||||||
You can post to list by sending your email to lammps-users at lists.sourceforge.net (no subscription required), but before posting, please read the [mailing list guidelines](https://www.lammps.org/guidelines.html) to maximize your chances to receive a helpful response.
|
You can post to list by sending your email to lammps-users at lists.sourceforge.net (no subscription required), but before posting, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html) to maximize your chances to receive a helpful response.
|
||||||
|
|
||||||
Anyone can browse/search previous questions/answers in the archives. You do not have to subscribe to the list to post questions, receive answers (to your questions), or browse/search the archives. You **do** need to subscribe to the list if you want emails for **all** the posts (as individual messages or in digest form), or to answer questions yourself. Feel free to sign up and help us out! Answering questions from fellow LAMMPS users is a great way to pay back the community for providing you a useful tool for free, and to pass on the advice you have received yourself to others. It improves your karma and helps you understand your own research better.
|
Anyone can browse/search previous questions/answers in the archives. You do not have to subscribe to the list to post questions, receive answers (to your questions), or browse/search the archives. You **do** need to subscribe to the list if you want emails for **all** the posts (as individual messages or in digest form), or to answer questions yourself. Feel free to sign up and help us out! Answering questions from fellow LAMMPS users is a great way to pay back the community for providing you a useful tool for free, and to pass on the advice you have received yourself to others. It improves your karma and helps you understand your own research better.
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ The LAMMPS Materials Science Discourse forum was created recently to facilitate
|
|||||||
|
|
||||||
### Reporting Bugs
|
### Reporting Bugs
|
||||||
|
|
||||||
While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://www.lammps.org/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version.
|
While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://lammps.sandia.gov/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version.
|
||||||
|
|
||||||
When you click on the green "New Issue" button, you will be provided with a text field, where you can enter your message. That text field with contain a template with several headlines and some descriptions. Keep the headlines that are relevant to your reported potential bug and replace the descriptions with the information as suggested by the descriptions.
|
When you click on the green "New Issue" button, you will be provided with a text field, where you can enter your message. That text field with contain a template with several headlines and some descriptions. Keep the headlines that are relevant to your reported potential bug and replace the descriptions with the information as suggested by the descriptions.
|
||||||
You can also attach small text files (please add the file name extension `.txt` or it will be rejected), images, or small compressed text files (using gzip, do not use RAR or 7-ZIP or similar tools that are uncommon outside of Windows machines). In many cases, bugs are best illustrated by providing a small input deck (do **not** attach your entire production input, but remove everything that is not required to reproduce the issue, and scale down your system size, that the resulting calculation runs fast and can be run on small desktop quickly).
|
You can also attach small text files (please add the file name extension `.txt` or it will be rejected), images, or small compressed text files (using gzip, do not use RAR or 7-ZIP or similar tools that are uncommon outside of Windows machines). In many cases, bugs are best illustrated by providing a small input deck (do **not** attach your entire production input, but remove everything that is not required to reproduce the issue, and scale down your system size, that the resulting calculation runs fast and can be run on small desktop quickly).
|
||||||
@ -65,9 +65,9 @@ To be able to submit an issue on GitHub, you have to register for an account (fo
|
|||||||
|
|
||||||
We encourage users to submit new features or modifications for LAMMPS. Instructions, guidelines, requirements,
|
We encourage users to submit new features or modifications for LAMMPS. Instructions, guidelines, requirements,
|
||||||
and recommendations are in the following sections of the LAMMPS manual:
|
and recommendations are in the following sections of the LAMMPS manual:
|
||||||
* [The guide for submitting new features in the LAMMPS manual](https://docs.lammps.org/Modify_contribute.html)
|
* [The guide for submitting new features in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html)
|
||||||
* [The guide on programming style and requirement in the LAMMPS manual](https://docs.lammps.org/Modify_requirements.html)
|
* [The guide on programming style and requirement in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html)
|
||||||
* [The GitHub tutorial in the LAMMPS manual](http://docs.lammps.org/Howto_github.html)
|
* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html)
|
||||||
|
|
||||||
|
|
||||||
## GitHub Workflows
|
## GitHub Workflows
|
||||||
@ -85,7 +85,7 @@ For bug reports, the next step is that one of the core LAMMPS developers will se
|
|||||||
### Pull Requests
|
### Pull Requests
|
||||||
|
|
||||||
Pull requests are the **only** way that changes get made to the LAMMPS distribution. So also the LAMMPS core developers will submit pull requests for their own changes and discuss them on GitHub. Thus if you submit a pull request it will be treated in a similar fashion. When you submit a pull request you may opt to submit a "Draft" pull request. That means your changes are visible and will be subject to testing, but reviewers will not be (auto-)assigned and comments will take into account that this is not complete. On the other hand, this is a perfect way to ask the LAMMPS developers for comments on non-obvious changes and get feedback and possible suggestions for improvements or recommendations about what to avoid.
|
Pull requests are the **only** way that changes get made to the LAMMPS distribution. So also the LAMMPS core developers will submit pull requests for their own changes and discuss them on GitHub. Thus if you submit a pull request it will be treated in a similar fashion. When you submit a pull request you may opt to submit a "Draft" pull request. That means your changes are visible and will be subject to testing, but reviewers will not be (auto-)assigned and comments will take into account that this is not complete. On the other hand, this is a perfect way to ask the LAMMPS developers for comments on non-obvious changes and get feedback and possible suggestions for improvements or recommendations about what to avoid.
|
||||||
Immediately after the submission, the LAMMPS continuing integration server at https://ci.lammps.org will download your submitted branch and perform a number of tests: it will tests whether it compiles cleanly under various conditions, it will also do a check on whether your included documentation translates cleanly and run some unit tests and other checks. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each time the pull request is updated with a push to the remote branch on GitHub. If you are unsure about what you need to change, ask a question in the discussion area of the pull request.
|
Immediately after the submission, the LAMMPS continuing integration server at ci.lammps.org will download your submitted branch and perform a number of tests: it will tests whether it compiles cleanly under various conditions, it will also do a check on whether your included documentation translates cleanly and run some unit tests and other checks. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each time the pull request is updated with a push to the remote branch on GitHub. If you are unsure about what you need to change, ask a question in the discussion area of the pull request.
|
||||||
Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you submitted a draft pull request, this will not happen unless you mark it "ready for review". If you are not yet invited as a LAMMPS collaborator, and your contribution seems significant, you may also receive an invitation for collaboration on the LAMMPS repository. As part of the assessment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit).
|
Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you submitted a draft pull request, this will not happen unless you mark it "ready for review". If you are not yet invited as a LAMMPS collaborator, and your contribution seems significant, you may also receive an invitation for collaboration on the LAMMPS repository. As part of the assessment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit).
|
||||||
You may also receive comments and suggestions on the overall submission or specific details and on occasion specific requests for changes as part of the review. If permitted, also additional changes may be pushed into your pull request branch or a pull request may be filed in your LAMMPS fork on GitHub to include those changes.
|
You may also receive comments and suggestions on the overall submission or specific details and on occasion specific requests for changes as part of the review. If permitted, also additional changes may be pushed into your pull request branch or a pull request may be filed in your LAMMPS fork on GitHub to include those changes.
|
||||||
The LAMMPS developer may then decide to assign the pull request to another developer (e.g. when that developer is more knowledgeable about the submitted feature or enhancement or has written the modified code). It may also happen, that additional developers are requested to provide a review and approve the changes. For submissions, that may change the general behavior of LAMMPS, or where a possibility of unwanted side effects exists, additional tests may be requested by the assigned developer.
|
The LAMMPS developer may then decide to assign the pull request to another developer (e.g. when that developer is more knowledgeable about the submitted feature or enhancement or has written the modified code). It may also happen, that additional developers are requested to provide a review and approve the changes. For submissions, that may change the general behavior of LAMMPS, or where a possibility of unwanted side effects exists, additional tests may be requested by the assigned developer.
|
||||||
|
|||||||
7
.github/ISSUE_TEMPLATE/help_request.md
vendored
7
.github/ISSUE_TEMPLATE/help_request.md
vendored
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: Request for Help
|
name: Request for Help
|
||||||
about: "Don't post help requests here, post in the LAMMPS forum"
|
about: "Don't post help requests here, email the lammps-users mailing list"
|
||||||
title: ""
|
title: ""
|
||||||
labels: invalid
|
labels: invalid
|
||||||
assignees: ''
|
assignees: ''
|
||||||
@ -8,9 +8,8 @@ assignees: ''
|
|||||||
---
|
---
|
||||||
|
|
||||||
Please **do not** post requests for help (e.g. with installing or using LAMMPS) here.
|
Please **do not** post requests for help (e.g. with installing or using LAMMPS) here.
|
||||||
Instead, you can post to the LAMMPS category in the Materials Science Community
|
Instead send an e-mail to the lammps-users mailing list.
|
||||||
Discourse forum at: https://matsci.org/lammps/
|
|
||||||
|
|
||||||
This issue tracker is for tracking LAMMPS development related issues only.
|
This issue tracker is for tracking LAMMPS development related issues only.
|
||||||
|
|
||||||
Thank you in advance for your cooperation.
|
Thanks for your cooperation.
|
||||||
|
|||||||
6
.github/codecov.yml
vendored
6
.github/codecov.yml
vendored
@ -7,7 +7,7 @@ coverage:
|
|||||||
threshold: 10%
|
threshold: 10%
|
||||||
only_pulls: false
|
only_pulls: false
|
||||||
branches:
|
branches:
|
||||||
- "develop"
|
- "master"
|
||||||
flags:
|
flags:
|
||||||
- "unit"
|
- "unit"
|
||||||
paths:
|
paths:
|
||||||
@ -16,14 +16,14 @@ coverage:
|
|||||||
project:
|
project:
|
||||||
default:
|
default:
|
||||||
branches:
|
branches:
|
||||||
- "develop"
|
- "master"
|
||||||
paths:
|
paths:
|
||||||
- "src"
|
- "src"
|
||||||
informational: true
|
informational: true
|
||||||
patch:
|
patch:
|
||||||
default:
|
default:
|
||||||
branches:
|
branches:
|
||||||
- "develop"
|
- "master"
|
||||||
paths:
|
paths:
|
||||||
- "src"
|
- "src"
|
||||||
informational: true
|
informational: true
|
||||||
|
|||||||
12
.github/workflows/codeql-analysis.yml
vendored
12
.github/workflows/codeql-analysis.yml
vendored
@ -25,17 +25,17 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v3
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
config-file: ./.github/codeql/${{ matrix.language }}.yml
|
config-file: ./.github/codeql/${{ matrix.language }}.yml
|
||||||
@ -49,10 +49,8 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: |
|
run: |
|
||||||
cmake -C ../cmake/presets/most.cmake \
|
cmake -C ../cmake/presets/most.cmake ../cmake
|
||||||
-D DOWNLOAD_POTENTIALS=off \
|
|
||||||
../cmake
|
|
||||||
cmake --build . --parallel 2
|
cmake --build . --parallel 2
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v3
|
uses: github/codeql-action/analyze@v2
|
||||||
|
|||||||
21
.github/workflows/compile-msvc.yml
vendored
21
.github/workflows/compile-msvc.yml
vendored
@ -3,11 +3,7 @@ name: "Native Windows Compilation and Unit Tests"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [develop]
|
||||||
- develop
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@ -19,32 +15,27 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Select Python version
|
- name: Select Python version
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.10'
|
||||||
|
|
||||||
- name: Building LAMMPS via CMake
|
- name: Building LAMMPS via CMake
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install numpy
|
python3 -m pip install numpy
|
||||||
python3 -m pip install pyyaml
|
python3 -m pip install pyyaml
|
||||||
nuget install MSMPIsdk
|
|
||||||
nuget install MSMPIDIST
|
|
||||||
cmake -C cmake/presets/windows.cmake \
|
cmake -C cmake/presets/windows.cmake \
|
||||||
-D DOWNLOAD_POTENTIALS=off \
|
|
||||||
-D PKG_PYTHON=on \
|
-D PKG_PYTHON=on \
|
||||||
-D WITH_PNG=off \
|
|
||||||
-D WITH_JPEG=off \
|
|
||||||
-S cmake -B build \
|
-S cmake -B build \
|
||||||
-D BUILD_SHARED_LIBS=on \
|
-D BUILD_SHARED_LIBS=on \
|
||||||
-D LAMMPS_EXCEPTIONS=on \
|
-D LAMMPS_EXCEPTIONS=on \
|
||||||
-D ENABLE_TESTING=on
|
-D ENABLE_TESTING=on
|
||||||
cmake --build build --config Release --parallel 2
|
cmake --build build --config Release
|
||||||
|
|
||||||
- name: Run LAMMPS executable
|
- name: Run LAMMPS executable
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -55,4 +46,4 @@ jobs:
|
|||||||
- name: Run Unit Tests
|
- name: Run Unit Tests
|
||||||
working-directory: build
|
working-directory: build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ctest -V -C Release -E FixTimestep:python_move_nve
|
run: ctest -V -C Release
|
||||||
|
|||||||
99
.github/workflows/coverity.yml
vendored
99
.github/workflows/coverity.yml
vendored
@ -1,99 +0,0 @@
|
|||||||
name: "Run Coverity Scan"
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 0 * * FRI"
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
if: ${{ github.repository == 'lammps/lammps' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: lammps/buildenv:ubuntu20.04
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
- name: Create Build and Download Folder
|
|
||||||
run: mkdir build download
|
|
||||||
|
|
||||||
- name: Cache Coverity
|
|
||||||
id: cache-coverity
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ./download/
|
|
||||||
key: ${{ runner.os }}-download-${{ hashFiles('**/coverity_tool.*') }}
|
|
||||||
|
|
||||||
- name: Download Coverity if necessary
|
|
||||||
if: steps.cache-coverity.outputs.cache-hit != 'true'
|
|
||||||
working-directory: download
|
|
||||||
run: |
|
|
||||||
wget -nv https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=LAMMPS" -O coverity_tool.tgz
|
|
||||||
wget -nv https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=LAMMPS&md5=1" -O coverity_tool.md5
|
|
||||||
echo " coverity_tool.tgz" >> coverity_tool.md5
|
|
||||||
md5sum -c coverity_tool.md5
|
|
||||||
|
|
||||||
- name: Setup Coverity
|
|
||||||
run: |
|
|
||||||
tar xzf download/coverity_tool.tgz
|
|
||||||
ln -s cov-analysis-linux64-* coverity
|
|
||||||
|
|
||||||
- name: Configure LAMMPS via CMake
|
|
||||||
shell: bash
|
|
||||||
working-directory: build
|
|
||||||
run: |
|
|
||||||
cmake \
|
|
||||||
-C ../cmake/presets/clang.cmake \
|
|
||||||
-C ../cmake/presets/most.cmake \
|
|
||||||
-C ../cmake/presets/kokkos-openmp.cmake \
|
|
||||||
-D CMAKE_BUILD_TYPE="RelWithDebug" \
|
|
||||||
-D CMAKE_TUNE_FLAGS="-Wall -Wextra -Wno-unused-result" \
|
|
||||||
-D BUILD_MPI=on \
|
|
||||||
-D BUILD_OMP=on \
|
|
||||||
-D BUILD_SHARED_LIBS=on \
|
|
||||||
-D LAMMPS_SIZES=SMALLBIG \
|
|
||||||
-D LAMMPS_EXCEPTIONS=off \
|
|
||||||
-D PKG_ATC=on \
|
|
||||||
-D PKG_AWPMD=on \
|
|
||||||
-D PKG_H5MD=on \
|
|
||||||
-D PKG_INTEL=on \
|
|
||||||
-D PKG_LATBOLTZ=on \
|
|
||||||
-D PKG_MANIFOLD=on \
|
|
||||||
-D PKG_MDI=on \
|
|
||||||
-D PKG_MGPT=on \
|
|
||||||
-D PKG_ML-PACE=on \
|
|
||||||
-D PKG_ML-RANN=on \
|
|
||||||
-D PKG_MOLFILE=on \
|
|
||||||
-D PKG_NETCDF=on \
|
|
||||||
-D PKG_PTM=on \
|
|
||||||
-D PKG_QTB=on \
|
|
||||||
-D PKG_SMTBQ=on \
|
|
||||||
../cmake
|
|
||||||
|
|
||||||
- name: Run Coverity Scan
|
|
||||||
shell: bash
|
|
||||||
working-directory: build
|
|
||||||
run: |
|
|
||||||
export PATH=$GITHUB_WORKSPACE/coverity/bin:$PATH
|
|
||||||
cov-build --dir cov-int cmake --build . --parallel 2
|
|
||||||
|
|
||||||
- name: Create tarball with scan results
|
|
||||||
shell: bash
|
|
||||||
working-directory: build
|
|
||||||
run: tar czf lammps.tgz cov-int
|
|
||||||
|
|
||||||
- name: Upload scan result to Coverity
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
curl --form token=${{ secrets.COVERITY_TOKEN }} \
|
|
||||||
--form email=${{ secrets.COVERITY_EMAIL }} \
|
|
||||||
--form file=@build/lammps.tgz \
|
|
||||||
--form version=${{ github.sha }} \
|
|
||||||
--form description="LAMMPS automated build" \
|
|
||||||
https://scan.coverity.com/builds?project=LAMMPS
|
|
||||||
12
.github/workflows/unittest-macos.yml
vendored
12
.github/workflows/unittest-macos.yml
vendored
@ -3,11 +3,7 @@ name: "Unittest for MacOS"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [develop]
|
||||||
- develop
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@ -21,7 +17,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
@ -32,7 +28,7 @@ jobs:
|
|||||||
run: mkdir build
|
run: mkdir build
|
||||||
|
|
||||||
- name: Set up ccache
|
- name: Set up ccache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.CCACHE_DIR }}
|
path: ${{ env.CCACHE_DIR }}
|
||||||
key: macos-ccache-${{ github.sha }}
|
key: macos-ccache-${{ github.sha }}
|
||||||
@ -43,11 +39,9 @@ jobs:
|
|||||||
working-directory: build
|
working-directory: build
|
||||||
run: |
|
run: |
|
||||||
ccache -z
|
ccache -z
|
||||||
python3 -m pip install numpy
|
|
||||||
python3 -m pip install pyyaml
|
python3 -m pip install pyyaml
|
||||||
cmake -C ../cmake/presets/clang.cmake \
|
cmake -C ../cmake/presets/clang.cmake \
|
||||||
-C ../cmake/presets/most.cmake \
|
-C ../cmake/presets/most.cmake \
|
||||||
-D DOWNLOAD_POTENTIALS=off \
|
|
||||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||||
-D ENABLE_TESTING=on \
|
-D ENABLE_TESTING=on \
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@ -55,8 +55,3 @@ out/RelWithDebInfo
|
|||||||
out/Release
|
out/Release
|
||||||
out/x86
|
out/x86
|
||||||
out/x64
|
out/x64
|
||||||
src/Makefile.package-e
|
|
||||||
src/Makefile.package.settings-e
|
|
||||||
/cmake/build/x64-Debug-Clang
|
|
||||||
/install/x64-GUI-MSVC
|
|
||||||
/install
|
|
||||||
|
|||||||
91
CITATION.cff
91
CITATION.cff
@ -1,91 +0,0 @@
|
|||||||
# 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
|
funding from the DOE. It is an open-source code, distributed freely
|
||||||
under the terms of the GNU Public License (GPL) version 2.
|
under the terms of the GNU Public License (GPL) version 2.
|
||||||
|
|
||||||
The code is maintained by the LAMMPS development team who can be emailed
|
The primary author of the code is Steve Plimpton, who can be emailed
|
||||||
at developers@lammps.org. The LAMMPS WWW Site at www.lammps.org has
|
at sjplimp@sandia.gov. The LAMMPS WWW Site at www.lammps.org has
|
||||||
more information about the code and its uses.
|
more information about the code and its uses.
|
||||||
|
|
||||||
The LAMMPS distribution includes the following files and directories:
|
The LAMMPS distribution includes the following files and directories:
|
||||||
|
|||||||
35
SECURITY.md
35
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.
|
behavior from calling functions in one of those libraries.
|
||||||
|
|
||||||
Thus is is quite easy to crash LAMMPS through malicious input and do all
|
Thus is is quite easy to crash LAMMPS through malicious input and do all
|
||||||
kinds of file system manipulations. And because of that LAMMPS should
|
kinds of filesystem manipulations. And because of that LAMMPS should
|
||||||
**NEVER** be compiled or **run** as superuser, either from a "root" or
|
**NEVER** be compiled or **run** as superuser, either from a "root" or
|
||||||
"administrator" account directly or indirectly via "sudo" or "su".
|
"administrator" account directly or indirectly via "sudo" or "su".
|
||||||
|
|
||||||
Therefore what could be seen as a security vulnerability is usually
|
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
|
either a user mistake or a bug in the code. Bugs can be reported in
|
||||||
LAMMPS project [issue tracker on
|
the LAMMPS project
|
||||||
GitHub](https://github.com/lammps/lammps/issues).
|
[issue tracker on GitHub](https://github.com/lammps/lammps/issues).
|
||||||
|
|
||||||
To mitigate issues with using homoglyphs or bidirectional reordering in
|
To mitigate issues with using homoglyphs or bidirectional reordering in
|
||||||
unicode, which have been demonstrated as a vector to obfuscate and hide
|
unicode, which have been demonstrated as a vector to obfuscate and hide
|
||||||
@ -30,23 +30,10 @@ for unicode characters and only all-ASCII source code is accepted.
|
|||||||
|
|
||||||
# Version Updates
|
# Version Updates
|
||||||
|
|
||||||
LAMMPS follows a continuous release development model. We aim to keep
|
LAMMPS follows continuous release development model. We aim to keep all
|
||||||
the development version (`develop` branch) always fully functional and
|
release versions (stable or patch) fully functional and employ a variety
|
||||||
employ a variety of automatic testing procedures to detect failures of
|
of automatic testing procedures to detect failures of existing
|
||||||
existing functionality from adding or modifying features. Most of those
|
functionality from adding new features before releases are made. Thus
|
||||||
tests are run on pull requests and must be passed *before* merging to
|
bugfixes and updates are only integrated into the current development
|
||||||
the `develop` branch. The `develop` branch is protected, so all changes
|
branch and thus the next (patch) release and users are recommended to
|
||||||
*must* be submitted as a pull request and thus cannot avoid the
|
update regularly.
|
||||||
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 referred to to
|
|
||||||
as a "feature 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, backported bug fixes
|
|
||||||
and infrastructure updates are first applied to the `maintenance` branch
|
|
||||||
and then merged to `stable` and published as "updates". For a new
|
|
||||||
stable release the `stable` branch is updated to the corresponding state
|
|
||||||
of the `release` branch and a new stable tag is applied in addition to
|
|
||||||
the release tag.
|
|
||||||
|
|||||||
@ -1,25 +1,25 @@
|
|||||||
# FENE beadspring benchmark
|
# FENE beadspring benchmark
|
||||||
|
|
||||||
units lj
|
units lj
|
||||||
atom_style bond
|
atom_style bond
|
||||||
special_bonds fene
|
special_bonds fene
|
||||||
|
|
||||||
read_data data.chain
|
read_data data.chain
|
||||||
|
|
||||||
neighbor 0.4 bin
|
neighbor 0.4 bin
|
||||||
neigh_modify every 1 delay 1
|
neigh_modify every 1 delay 1
|
||||||
|
|
||||||
bond_style fene
|
bond_style fene
|
||||||
bond_coeff 1 30.0 1.5 1.0 1.0
|
bond_coeff 1 30.0 1.5 1.0 1.0
|
||||||
|
|
||||||
pair_style lj/cut 1.12
|
pair_style lj/cut 1.12
|
||||||
pair_modify shift yes
|
pair_modify shift yes
|
||||||
pair_coeff 1 1 1.0 1.0 1.12
|
pair_coeff 1 1 1.0 1.0 1.12
|
||||||
|
|
||||||
fix 1 all nve
|
fix 1 all nve
|
||||||
fix 2 all langevin 1.0 1.0 10.0 904297
|
fix 2 all langevin 1.0 1.0 10.0 904297
|
||||||
|
|
||||||
thermo 100
|
thermo 100
|
||||||
timestep 0.012
|
timestep 0.012
|
||||||
|
|
||||||
run 100
|
run 100
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
# FENE beadspring benchmark
|
# FENE beadspring benchmark
|
||||||
|
|
||||||
variable x index 1
|
variable x index 1
|
||||||
variable y index 1
|
variable y index 1
|
||||||
variable z index 1
|
variable z index 1
|
||||||
|
|
||||||
units lj
|
units lj
|
||||||
atom_style bond
|
atom_style bond
|
||||||
atom_modify map hash
|
atom_modify map hash
|
||||||
special_bonds fene
|
special_bonds fene
|
||||||
|
|
||||||
read_data data.chain
|
read_data data.chain
|
||||||
|
|
||||||
replicate $x $y $z
|
replicate $x $y $z
|
||||||
|
|
||||||
neighbor 0.4 bin
|
neighbor 0.4 bin
|
||||||
neigh_modify every 1 delay 1
|
neigh_modify every 1 delay 1
|
||||||
|
|
||||||
bond_style fene
|
bond_style fene
|
||||||
bond_coeff 1 30.0 1.5 1.0 1.0
|
bond_coeff 1 30.0 1.5 1.0 1.0
|
||||||
|
|
||||||
pair_style lj/cut 1.12
|
pair_style lj/cut 1.12
|
||||||
pair_modify shift yes
|
pair_modify shift yes
|
||||||
pair_coeff 1 1 1.0 1.0 1.12
|
pair_coeff 1 1 1.0 1.0 1.12
|
||||||
|
|
||||||
fix 1 all nve
|
fix 1 all nve
|
||||||
fix 2 all langevin 1.0 1.0 10.0 904297
|
fix 2 all langevin 1.0 1.0 10.0 904297
|
||||||
|
|
||||||
thermo 100
|
thermo 100
|
||||||
timestep 0.012
|
timestep 0.012
|
||||||
|
|
||||||
run 100
|
run 100
|
||||||
|
|||||||
@ -1,33 +1,33 @@
|
|||||||
# LAMMPS benchmark of granular flow
|
# LAMMPS benchmark of granular flow
|
||||||
# chute flow of 32000 atoms with frozen base at 26 degrees
|
# chute flow of 32000 atoms with frozen base at 26 degrees
|
||||||
|
|
||||||
units lj
|
units lj
|
||||||
atom_style sphere
|
atom_style sphere
|
||||||
boundary p p fs
|
boundary p p fs
|
||||||
newton off
|
newton off
|
||||||
comm_modify vel yes
|
comm_modify vel yes
|
||||||
|
|
||||||
read_data data.chute
|
read_data data.chute
|
||||||
|
|
||||||
pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 0
|
pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 0
|
||||||
pair_coeff * *
|
pair_coeff * *
|
||||||
|
|
||||||
neighbor 0.1 bin
|
neighbor 0.1 bin
|
||||||
neigh_modify every 1 delay 0
|
neigh_modify every 1 delay 0
|
||||||
|
|
||||||
timestep 0.0001
|
timestep 0.0001
|
||||||
|
|
||||||
group bottom type 2
|
group bottom type 2
|
||||||
group active subtract all bottom
|
group active subtract all bottom
|
||||||
neigh_modify exclude group bottom bottom
|
neigh_modify exclude group bottom bottom
|
||||||
|
|
||||||
fix 1 all gravity 1.0 chute 26.0
|
fix 1 all gravity 1.0 chute 26.0
|
||||||
fix 2 bottom freeze
|
fix 2 bottom freeze
|
||||||
fix 3 active nve/sphere
|
fix 3 active nve/sphere
|
||||||
|
|
||||||
compute 1 all erotate/sphere
|
compute 1 all erotate/sphere
|
||||||
thermo_style custom step atoms ke c_1 vol
|
thermo_style custom step atoms ke c_1 vol
|
||||||
thermo_modify norm no
|
thermo_modify norm no
|
||||||
thermo 100
|
thermo 100
|
||||||
|
|
||||||
run 100
|
run 100
|
||||||
|
|||||||
@ -1,38 +1,38 @@
|
|||||||
# LAMMPS benchmark of granular flow
|
# LAMMPS benchmark of granular flow
|
||||||
# chute flow of 32000 atoms with frozen base at 26 degrees
|
# chute flow of 32000 atoms with frozen base at 26 degrees
|
||||||
|
|
||||||
variable x index 1
|
variable x index 1
|
||||||
variable y index 1
|
variable y index 1
|
||||||
|
|
||||||
units lj
|
units lj
|
||||||
atom_style sphere
|
atom_style sphere
|
||||||
boundary p p fs
|
boundary p p fs
|
||||||
newton off
|
newton off
|
||||||
comm_modify vel yes
|
comm_modify vel yes
|
||||||
|
|
||||||
read_data data.chute
|
read_data data.chute
|
||||||
|
|
||||||
replicate $x $y 1
|
replicate $x $y 1
|
||||||
|
|
||||||
pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 0
|
pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 0
|
||||||
pair_coeff * *
|
pair_coeff * *
|
||||||
|
|
||||||
neighbor 0.1 bin
|
neighbor 0.1 bin
|
||||||
neigh_modify every 1 delay 0
|
neigh_modify every 1 delay 0
|
||||||
|
|
||||||
timestep 0.0001
|
timestep 0.0001
|
||||||
|
|
||||||
group bottom type 2
|
group bottom type 2
|
||||||
group active subtract all bottom
|
group active subtract all bottom
|
||||||
neigh_modify exclude group bottom bottom
|
neigh_modify exclude group bottom bottom
|
||||||
|
|
||||||
fix 1 all gravity 1.0 chute 26.0
|
fix 1 all gravity 1.0 chute 26.0
|
||||||
fix 2 bottom freeze
|
fix 2 bottom freeze
|
||||||
fix 3 active nve/sphere
|
fix 3 active nve/sphere
|
||||||
|
|
||||||
compute 1 all erotate/sphere
|
compute 1 all erotate/sphere
|
||||||
thermo_style custom step atoms ke c_1 vol
|
thermo_style custom step atoms ke c_1 vol
|
||||||
thermo_modify norm no
|
thermo_modify norm no
|
||||||
thermo 100
|
thermo 100
|
||||||
|
|
||||||
run 100
|
run 100
|
||||||
|
|||||||
40
bench/in.eam
40
bench/in.eam
@ -1,32 +1,32 @@
|
|||||||
# bulk Cu lattice
|
# bulk Cu lattice
|
||||||
|
|
||||||
variable x index 1
|
variable x index 1
|
||||||
variable y index 1
|
variable y index 1
|
||||||
variable z index 1
|
variable z index 1
|
||||||
|
|
||||||
variable xx equal 20*$x
|
variable xx equal 20*$x
|
||||||
variable yy equal 20*$y
|
variable yy equal 20*$y
|
||||||
variable zz equal 20*$z
|
variable zz equal 20*$z
|
||||||
|
|
||||||
units metal
|
units metal
|
||||||
atom_style atomic
|
atom_style atomic
|
||||||
|
|
||||||
lattice fcc 3.615
|
lattice fcc 3.615
|
||||||
region box block 0 ${xx} 0 ${yy} 0 ${zz}
|
region box block 0 ${xx} 0 ${yy} 0 ${zz}
|
||||||
create_box 1 box
|
create_box 1 box
|
||||||
create_atoms 1 box
|
create_atoms 1 box
|
||||||
|
|
||||||
pair_style eam
|
pair_style eam
|
||||||
pair_coeff 1 1 Cu_u3.eam
|
pair_coeff 1 1 Cu_u3.eam
|
||||||
|
|
||||||
velocity all create 1600.0 376847 loop geom
|
velocity all create 1600.0 376847 loop geom
|
||||||
|
|
||||||
neighbor 1.0 bin
|
neighbor 1.0 bin
|
||||||
neigh_modify every 1 delay 5 check yes
|
neigh_modify every 1 delay 5 check yes
|
||||||
|
|
||||||
fix 1 all nve
|
fix 1 all nve
|
||||||
|
|
||||||
timestep 0.005
|
timestep 0.005
|
||||||
thermo 50
|
thermo 50
|
||||||
|
|
||||||
run 100
|
run 100
|
||||||
|
|||||||
40
bench/in.lj
40
bench/in.lj
@ -1,30 +1,30 @@
|
|||||||
# 3d Lennard-Jones melt
|
# 3d Lennard-Jones melt
|
||||||
|
|
||||||
variable x index 1
|
variable x index 1
|
||||||
variable y index 1
|
variable y index 1
|
||||||
variable z index 1
|
variable z index 1
|
||||||
|
|
||||||
variable xx equal 20*$x
|
variable xx equal 20*$x
|
||||||
variable yy equal 20*$y
|
variable yy equal 20*$y
|
||||||
variable zz equal 20*$z
|
variable zz equal 20*$z
|
||||||
|
|
||||||
units lj
|
units lj
|
||||||
atom_style atomic
|
atom_style atomic
|
||||||
|
|
||||||
lattice fcc 0.8442
|
lattice fcc 0.8442
|
||||||
region box block 0 ${xx} 0 ${yy} 0 ${zz}
|
region box block 0 ${xx} 0 ${yy} 0 ${zz}
|
||||||
create_box 1 box
|
create_box 1 box
|
||||||
create_atoms 1 box
|
create_atoms 1 box
|
||||||
mass 1 1.0
|
mass 1 1.0
|
||||||
|
|
||||||
velocity all create 1.44 87287 loop geom
|
velocity all create 1.44 87287 loop geom
|
||||||
|
|
||||||
pair_style lj/cut 2.5
|
pair_style lj/cut 2.5
|
||||||
pair_coeff 1 1 1.0 1.0 2.5
|
pair_coeff 1 1 1.0 1.0 2.5
|
||||||
|
|
||||||
neighbor 0.3 bin
|
neighbor 0.3 bin
|
||||||
neigh_modify delay 0 every 20 check no
|
neigh_modify delay 0 every 20 check no
|
||||||
|
|
||||||
fix 1 all nve
|
fix 1 all nve
|
||||||
|
|
||||||
run 100
|
run 100
|
||||||
|
|||||||
@ -1,27 +1,27 @@
|
|||||||
# Rhodopsin model
|
# Rhodopsin model
|
||||||
|
|
||||||
units real
|
units real
|
||||||
neigh_modify delay 5 every 1
|
neigh_modify delay 5 every 1
|
||||||
|
|
||||||
atom_style full
|
atom_style full
|
||||||
bond_style harmonic
|
bond_style harmonic
|
||||||
angle_style charmm
|
angle_style charmm
|
||||||
dihedral_style charmm
|
dihedral_style charmm
|
||||||
improper_style harmonic
|
improper_style harmonic
|
||||||
pair_style lj/charmm/coul/long 8.0 10.0
|
pair_style lj/charmm/coul/long 8.0 10.0
|
||||||
pair_modify mix arithmetic
|
pair_modify mix arithmetic
|
||||||
kspace_style pppm 1e-4
|
kspace_style pppm 1e-4
|
||||||
|
|
||||||
read_data data.rhodo
|
read_data data.rhodo
|
||||||
|
|
||||||
fix 1 all shake 0.0001 5 0 m 1.0 a 232
|
fix 1 all shake 0.0001 5 0 m 1.0 a 232
|
||||||
fix 2 all npt temp 300.0 300.0 100.0 &
|
fix 2 all npt temp 300.0 300.0 100.0 &
|
||||||
z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1
|
z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1
|
||||||
|
|
||||||
special_bonds charmm
|
special_bonds charmm
|
||||||
|
|
||||||
thermo 50
|
thermo 50
|
||||||
thermo_style multi
|
thermo_style multi
|
||||||
timestep 2.0
|
timestep 2.0
|
||||||
|
|
||||||
run 100
|
run 100
|
||||||
|
|||||||
@ -1,34 +1,34 @@
|
|||||||
# Rhodopsin model
|
# Rhodopsin model
|
||||||
|
|
||||||
variable x index 1
|
variable x index 1
|
||||||
variable y index 1
|
variable y index 1
|
||||||
variable z index 1
|
variable z index 1
|
||||||
|
|
||||||
units real
|
units real
|
||||||
neigh_modify delay 5 every 1
|
neigh_modify delay 5 every 1
|
||||||
|
|
||||||
atom_style full
|
atom_style full
|
||||||
atom_modify map hash
|
atom_modify map hash
|
||||||
bond_style harmonic
|
bond_style harmonic
|
||||||
angle_style charmm
|
angle_style charmm
|
||||||
dihedral_style charmm
|
dihedral_style charmm
|
||||||
improper_style harmonic
|
improper_style harmonic
|
||||||
pair_style lj/charmm/coul/long 8.0 10.0
|
pair_style lj/charmm/coul/long 8.0 10.0
|
||||||
pair_modify mix arithmetic
|
pair_modify mix arithmetic
|
||||||
kspace_style pppm 1e-4
|
kspace_style pppm 1e-4
|
||||||
|
|
||||||
read_data data.rhodo
|
read_data data.rhodo
|
||||||
|
|
||||||
replicate $x $y $z
|
replicate $x $y $z
|
||||||
|
|
||||||
fix 1 all shake 0.0001 5 0 m 1.0 a 232
|
fix 1 all shake 0.0001 5 0 m 1.0 a 232
|
||||||
fix 2 all npt temp 300.0 300.0 100.0 &
|
fix 2 all npt temp 300.0 300.0 100.0 &
|
||||||
z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1
|
z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1
|
||||||
|
|
||||||
special_bonds charmm
|
special_bonds charmm
|
||||||
|
|
||||||
thermo 50
|
thermo 50
|
||||||
thermo_style multi
|
thermo_style multi
|
||||||
timestep 2.0
|
timestep 2.0
|
||||||
|
|
||||||
run 100
|
run 100
|
||||||
|
|||||||
615
cmake/CMakeLists.jpeg
Normal file
615
cmake/CMakeLists.jpeg
Normal file
@ -0,0 +1,615 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
# When using CMake 3.4 and later, don't export symbols from executables unless
|
||||||
|
# the CMAKE_ENABLE_EXPORTS variable is set.
|
||||||
|
if(POLICY CMP0065)
|
||||||
|
cmake_policy(SET CMP0065 NEW)
|
||||||
|
endif()
|
||||||
|
if (POLICY CMP0077)
|
||||||
|
cmake_policy(SET CMP0077 NEW)
|
||||||
|
endif()
|
||||||
|
if(CMAKE_EXECUTABLE_SUFFIX)
|
||||||
|
set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
project(libjpeg-turbo C)
|
||||||
|
set(VERSION 2.1.3)
|
||||||
|
set(COPYRIGHT_YEAR "1991-2022")
|
||||||
|
string(REPLACE "." ";" VERSION_TRIPLET ${VERSION})
|
||||||
|
list(GET VERSION_TRIPLET 0 VERSION_MAJOR)
|
||||||
|
list(GET VERSION_TRIPLET 1 VERSION_MINOR)
|
||||||
|
list(GET VERSION_TRIPLET 2 VERSION_REVISION)
|
||||||
|
function(pad_number NUMBER OUTPUT_LEN)
|
||||||
|
string(LENGTH "${${NUMBER}}" INPUT_LEN)
|
||||||
|
if(INPUT_LEN LESS OUTPUT_LEN)
|
||||||
|
math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1")
|
||||||
|
set(NUM ${${NUMBER}})
|
||||||
|
foreach(C RANGE ${ZEROES})
|
||||||
|
set(NUM "0${NUM}")
|
||||||
|
endforeach()
|
||||||
|
set(${NUMBER} ${NUM} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
pad_number(VERSION_MINOR 3)
|
||||||
|
pad_number(VERSION_REVISION 3)
|
||||||
|
set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION})
|
||||||
|
|
||||||
|
# CMake 3.14 and later sets CMAKE_MACOSX_BUNDLE to TRUE by default when
|
||||||
|
# CMAKE_SYSTEM_NAME is iOS, tvOS, or watchOS, which breaks the libjpeg-turbo
|
||||||
|
# build. (Specifically, when CMAKE_MACOSX_BUNDLE is TRUE, executables for
|
||||||
|
# Apple platforms are built as application bundles, which causes CMake to
|
||||||
|
# complain that our install() directives for executables do not specify a
|
||||||
|
# BUNDLE DESTINATION. Even if CMake did not complain, building executables as
|
||||||
|
# application bundles would break our iOS packages.)
|
||||||
|
set(CMAKE_MACOSX_BUNDLE FALSE)
|
||||||
|
|
||||||
|
string(TIMESTAMP DEFAULT_BUILD "%Y%m%d")
|
||||||
|
set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})")
|
||||||
|
|
||||||
|
# NOTE: On Windows, this does nothing except when using MinGW or Cygwin.
|
||||||
|
# CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to
|
||||||
|
# Debug when using NMake.
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
endif()
|
||||||
|
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
|
message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
|
||||||
|
|
||||||
|
include(cmakescripts/PackageInfo.cmake)
|
||||||
|
|
||||||
|
# Detect CPU type and whether we're building 64-bit or 32-bit code
|
||||||
|
math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8")
|
||||||
|
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC)
|
||||||
|
set(COUNT 1)
|
||||||
|
foreach(ARCH ${CMAKE_OSX_ARCHITECTURES})
|
||||||
|
if(COUNT GREATER 1)
|
||||||
|
message(FATAL_ERROR "The libjpeg-turbo build system does not support multiple values in CMAKE_OSX_ARCHITECTURES.")
|
||||||
|
endif()
|
||||||
|
math(EXPR COUNT "${COUNT}+1")
|
||||||
|
endforeach()
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32")
|
||||||
|
if(BITS EQUAL 64 OR CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
|
||||||
|
set(CPU_TYPE x86_64)
|
||||||
|
else()
|
||||||
|
set(CPU_TYPE i386)
|
||||||
|
endif()
|
||||||
|
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE})
|
||||||
|
set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE})
|
||||||
|
endif()
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^arm")
|
||||||
|
if(BITS EQUAL 64)
|
||||||
|
set(CPU_TYPE arm64)
|
||||||
|
else()
|
||||||
|
set(CPU_TYPE arm)
|
||||||
|
endif()
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^ppc" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^powerpc")
|
||||||
|
set(CPU_TYPE powerpc)
|
||||||
|
else()
|
||||||
|
set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC})
|
||||||
|
endif()
|
||||||
|
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR
|
||||||
|
CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR
|
||||||
|
CMAKE_OSX_ARCHITECTURES MATCHES "i386")
|
||||||
|
set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES})
|
||||||
|
endif()
|
||||||
|
if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
|
||||||
|
set(CPU_TYPE powerpc)
|
||||||
|
endif()
|
||||||
|
if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64")
|
||||||
|
set(CPU_TYPE arm64)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "${BITS}-bit build (${CPU_TYPE})")
|
||||||
|
|
||||||
|
macro(report_directory var)
|
||||||
|
if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var})
|
||||||
|
message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}")
|
||||||
|
else()
|
||||||
|
message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})")
|
||||||
|
endif()
|
||||||
|
mark_as_advanced(CLEAR CMAKE_INSTALL_${var})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR")
|
||||||
|
if(UNIX)
|
||||||
|
list(APPEND DIRLIST "MANDIR")
|
||||||
|
endif()
|
||||||
|
foreach(dir ${DIRLIST})
|
||||||
|
report_directory(${dir})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# CONFIGURATION OPTIONS
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
macro(boolean_number var)
|
||||||
|
if(${var})
|
||||||
|
set(${var} 1 ${ARGN})
|
||||||
|
else()
|
||||||
|
set(${var} 0 ${ARGN})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
option(ENABLE_SHARED "Build shared libraries" FALSE)
|
||||||
|
boolean_number(ENABLE_SHARED)
|
||||||
|
option(ENABLE_STATIC "Build static libraries" TRUE)
|
||||||
|
boolean_number(ENABLE_STATIC)
|
||||||
|
option(REQUIRE_SIMD "Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)" FALSE)
|
||||||
|
boolean_number(REQUIRE_SIMD)
|
||||||
|
option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_ARITH_DEC=0 WITH_ARITH_ENC=0 WITH_JAVA=0 WITH_SIMD=0 WITH_TURBOJPEG=0 )" FALSE)
|
||||||
|
boolean_number(WITH_12BIT)
|
||||||
|
option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE)
|
||||||
|
boolean_number(WITH_ARITH_DEC)
|
||||||
|
option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE)
|
||||||
|
boolean_number(WITH_ARITH_ENC)
|
||||||
|
if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
|
||||||
|
set(WITH_JAVA 0)
|
||||||
|
else()
|
||||||
|
option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE)
|
||||||
|
boolean_number(WITH_JAVA)
|
||||||
|
endif()
|
||||||
|
option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE)
|
||||||
|
boolean_number(WITH_JPEG7)
|
||||||
|
option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE)
|
||||||
|
boolean_number(WITH_JPEG8)
|
||||||
|
option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE)
|
||||||
|
boolean_number(WITH_MEM_SRCDST)
|
||||||
|
option(WITH_SIMD "Include SIMD extensions, if available for this platform" FALSE)
|
||||||
|
boolean_number(WITH_SIMD)
|
||||||
|
option(WITH_TURBOJPEG "Include the TurboJPEG API library and associated test programs" FALSE)
|
||||||
|
boolean_number(WITH_TURBOJPEG)
|
||||||
|
option(WITH_FUZZ "Build fuzz targets" FALSE)
|
||||||
|
|
||||||
|
macro(report_option var desc)
|
||||||
|
if(${var})
|
||||||
|
message(STATUS "${desc} enabled (${var} = ${${var}})")
|
||||||
|
else()
|
||||||
|
message(STATUS "${desc} disabled (${var} = ${${var}})")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if(WITH_JAVA)
|
||||||
|
set(ENABLE_SHARED 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all
|
||||||
|
# targets, which will cause the shared library builds to fail. Thus, if shared
|
||||||
|
# libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set
|
||||||
|
# to FALSE, we need to unset it, thus restoring the default behavior
|
||||||
|
# (automatically using PIC for shared library targets.)
|
||||||
|
if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND
|
||||||
|
NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED)
|
||||||
|
unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
report_option(ENABLE_SHARED "Shared libraries")
|
||||||
|
report_option(ENABLE_STATIC "Static libraries")
|
||||||
|
|
||||||
|
if(ENABLE_SHARED)
|
||||||
|
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_JPEG8 OR WITH_JPEG7)
|
||||||
|
set(WITH_ARITH_ENC 1)
|
||||||
|
set(WITH_ARITH_DEC 1)
|
||||||
|
endif()
|
||||||
|
if(WITH_JPEG8)
|
||||||
|
set(WITH_MEM_SRCDST 0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_12BIT)
|
||||||
|
set(WITH_ARITH_DEC 0)
|
||||||
|
set(WITH_ARITH_ENC 0)
|
||||||
|
set(WITH_JAVA 0)
|
||||||
|
set(WITH_SIMD 0)
|
||||||
|
set(WITH_TURBOJPEG 0)
|
||||||
|
set(BITS_IN_JSAMPLE 12)
|
||||||
|
else()
|
||||||
|
set(BITS_IN_JSAMPLE 8)
|
||||||
|
endif()
|
||||||
|
report_option(WITH_12BIT "12-bit JPEG support")
|
||||||
|
|
||||||
|
if(WITH_ARITH_DEC)
|
||||||
|
set(D_ARITH_CODING_SUPPORTED 1)
|
||||||
|
endif()
|
||||||
|
if(NOT WITH_12BIT)
|
||||||
|
report_option(WITH_ARITH_DEC "Arithmetic decoding support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_ARITH_ENC)
|
||||||
|
set(C_ARITH_CODING_SUPPORTED 1)
|
||||||
|
endif()
|
||||||
|
if(NOT WITH_12BIT)
|
||||||
|
report_option(WITH_ARITH_ENC "Arithmetic encoding support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT WITH_12BIT)
|
||||||
|
report_option(WITH_TURBOJPEG "TurboJPEG API library")
|
||||||
|
report_option(WITH_JAVA "TurboJPEG Java wrapper")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_MEM_SRCDST)
|
||||||
|
set(MEM_SRCDST_SUPPORTED 1)
|
||||||
|
set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;")
|
||||||
|
endif()
|
||||||
|
if(NOT WITH_JPEG8)
|
||||||
|
report_option(WITH_MEM_SRCDST "In-memory source/destination managers")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(SO_AGE 2)
|
||||||
|
if(WITH_MEM_SRCDST)
|
||||||
|
set(SO_AGE 3)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_JPEG8)
|
||||||
|
set(JPEG_LIB_VERSION 80)
|
||||||
|
elseif(WITH_JPEG7)
|
||||||
|
set(JPEG_LIB_VERSION 70)
|
||||||
|
else()
|
||||||
|
set(JPEG_LIB_VERSION 62)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10")
|
||||||
|
math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10")
|
||||||
|
if(JPEG_LIB_VERSION STREQUAL "62")
|
||||||
|
set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION})
|
||||||
|
else()
|
||||||
|
set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10})
|
||||||
|
endif()
|
||||||
|
if(JPEG_LIB_VERSION STREQUAL "80")
|
||||||
|
set(DEFAULT_SO_MINOR_VERSION 2)
|
||||||
|
else()
|
||||||
|
set(DEFAULT_SO_MINOR_VERSION 0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if
|
||||||
|
# WITH_JPEG7 or WITH_JPEG8 has changed.
|
||||||
|
if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR
|
||||||
|
(DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT))
|
||||||
|
set(FORCE_SO_VERSION "FORCE")
|
||||||
|
endif()
|
||||||
|
set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "")
|
||||||
|
set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "")
|
||||||
|
|
||||||
|
set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING
|
||||||
|
"Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})"
|
||||||
|
${FORCE_SO_VERSION})
|
||||||
|
set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING
|
||||||
|
"Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})"
|
||||||
|
${FORCE_SO_VERSION})
|
||||||
|
|
||||||
|
set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}")
|
||||||
|
message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})")
|
||||||
|
message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}")
|
||||||
|
|
||||||
|
# Because the TurboJPEG API library uses versioned symbols and changes the
|
||||||
|
# names of functions whenever they are modified in a backward-incompatible
|
||||||
|
# manner, it is always backward-ABI-compatible with itself, so the major and
|
||||||
|
# minor SO versions don't change. However, we increase the middle number (the
|
||||||
|
# SO "age") whenever functions are added to the API.
|
||||||
|
set(TURBOJPEG_SO_MAJOR_VERSION 0)
|
||||||
|
set(TURBOJPEG_SO_AGE 2)
|
||||||
|
set(TURBOJPEG_SO_VERSION 0.${TURBOJPEG_SO_AGE}.0)
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# COMPILER SETTINGS
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
option(WITH_CRT_DLL
|
||||||
|
"Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it."
|
||||||
|
FALSE)
|
||||||
|
if(NOT WITH_CRT_DLL)
|
||||||
|
# Use the static C library for all build types
|
||||||
|
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
if(${var} MATCHES "/MD")
|
||||||
|
string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
|
# Use the maximum optimization level for release builds
|
||||||
|
foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
if(${var} MATCHES "-O2")
|
||||||
|
string(REGEX REPLACE "-O2" "-O3" ${var} "${${var}}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||||
|
if(CMAKE_C_COMPILER_ID MATCHES "SunPro")
|
||||||
|
# Use the maximum optimization level for release builds
|
||||||
|
foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
if(${var} MATCHES "-xO3")
|
||||||
|
string(REGEX REPLACE "-xO3" "-xO5" ${var} "${${var}}")
|
||||||
|
endif()
|
||||||
|
if(${var} MATCHES "-xO2")
|
||||||
|
string(REGEX REPLACE "-xO2" "-xO5" ${var} "${${var}}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
|
||||||
|
|
||||||
|
set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
|
||||||
|
message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}")
|
||||||
|
|
||||||
|
set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
|
||||||
|
message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}")
|
||||||
|
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
include(CheckIncludeFiles)
|
||||||
|
include(CheckTypeSize)
|
||||||
|
|
||||||
|
check_type_size("size_t" SIZE_T)
|
||||||
|
check_type_size("unsigned long" UNSIGNED_LONG)
|
||||||
|
|
||||||
|
if(SIZE_T EQUAL UNSIGNED_LONG)
|
||||||
|
check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }"
|
||||||
|
HAVE_BUILTIN_CTZL)
|
||||||
|
endif()
|
||||||
|
if(MSVC)
|
||||||
|
check_include_files("intrin.h" HAVE_INTRIN_H)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
set(RIGHT_SHIFT_IS_UNSIGNED 0)
|
||||||
|
else()
|
||||||
|
include(CheckCSourceRuns)
|
||||||
|
check_c_source_runs("
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
int is_shifting_signed (long arg) {
|
||||||
|
long res = arg >> 4;
|
||||||
|
if (res == -0x7F7E80CL)
|
||||||
|
return 1; /* right shift is signed */
|
||||||
|
/* see if unsigned-shift hack will fix it. */
|
||||||
|
/* we can't just test exact value since it depends on width of long... */
|
||||||
|
res |= (~0L) << (32-4);
|
||||||
|
if (res == -0x7F7E80CL)
|
||||||
|
return 0; /* right shift is unsigned */
|
||||||
|
printf(\"Right shift isn't acting as I expect it to.\\\\n\");
|
||||||
|
printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\");
|
||||||
|
return 0; /* try it with unsigned anyway */
|
||||||
|
}
|
||||||
|
int main (void) {
|
||||||
|
exit(is_shifting_signed(-0x7F7E80B1L));
|
||||||
|
}" RIGHT_SHIFT_IS_UNSIGNED)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(INLINE_OPTIONS "__inline;inline")
|
||||||
|
else()
|
||||||
|
set(INLINE_OPTIONS "__inline__;inline")
|
||||||
|
endif()
|
||||||
|
option(FORCE_INLINE "Force function inlining" TRUE)
|
||||||
|
boolean_number(FORCE_INLINE)
|
||||||
|
if(FORCE_INLINE)
|
||||||
|
if(MSVC)
|
||||||
|
list(INSERT INLINE_OPTIONS 0 "__forceinline")
|
||||||
|
else()
|
||||||
|
list(INSERT INLINE_OPTIONS 0 "inline __attribute__((always_inline))")
|
||||||
|
list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
foreach(inline ${INLINE_OPTIONS})
|
||||||
|
check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }"
|
||||||
|
INLINE_WORKS)
|
||||||
|
if(INLINE_WORKS)
|
||||||
|
set(INLINE ${inline})
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(NOT INLINE_WORKS)
|
||||||
|
message(FATAL_ERROR "Could not determine how to inline functions.")
|
||||||
|
endif()
|
||||||
|
message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})")
|
||||||
|
|
||||||
|
if(WITH_TURBOJPEG)
|
||||||
|
if(MSVC)
|
||||||
|
set(THREAD_LOCAL "__declspec(thread)")
|
||||||
|
else()
|
||||||
|
set(THREAD_LOCAL "__thread")
|
||||||
|
endif()
|
||||||
|
check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL)
|
||||||
|
if(HAVE_THREAD_LOCAL)
|
||||||
|
message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}")
|
||||||
|
else()
|
||||||
|
message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.")
|
||||||
|
unset(THREAD_LOCAL)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS
|
||||||
|
"-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS)
|
||||||
|
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map)
|
||||||
|
if(HAVE_VERSION_SCRIPT)
|
||||||
|
message(STATUS "Linker supports GNU-style version scripts")
|
||||||
|
set(MAPFLAG "-Wl,--version-script,")
|
||||||
|
set(TJMAPFLAG "-Wl,--version-script,")
|
||||||
|
else()
|
||||||
|
message(STATUS "Linker does not support GNU-style version scripts")
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||||
|
# The Solaris linker doesn't like our version script for the libjpeg API
|
||||||
|
# library, but the version script for the TurboJPEG API library should
|
||||||
|
# still work.
|
||||||
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map
|
||||||
|
"VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map -shared")
|
||||||
|
check_c_source_compiles("int foo() { return 0; } int foo2() { return 2; }"
|
||||||
|
HAVE_MAPFILE)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS)
|
||||||
|
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map)
|
||||||
|
if(HAVE_MAPFILE)
|
||||||
|
message(STATUS "Linker supports mapfiles")
|
||||||
|
set(TJMAPFLAG "-Wl,-M,")
|
||||||
|
else()
|
||||||
|
message(STATUS "Linker does not support mapfiles")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Generate files
|
||||||
|
if(WIN32)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/win/jconfig.h.in jconfig.h)
|
||||||
|
else()
|
||||||
|
configure_file(jconfig.h.in jconfig.h)
|
||||||
|
endif()
|
||||||
|
configure_file(jconfigint.h.in jconfigint.h)
|
||||||
|
configure_file(jversion.h.in jversion.h)
|
||||||
|
if(UNIX)
|
||||||
|
configure_file(libjpeg.map.in libjpeg.map)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Include directories and compiler definitions
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# TARGETS
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if(CMAKE_EXECUTABLE_SUFFIX_TMP)
|
||||||
|
set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX_TMP})
|
||||||
|
endif()
|
||||||
|
message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
|
|
||||||
|
set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
|
||||||
|
jcicc.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c
|
||||||
|
jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c
|
||||||
|
jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c
|
||||||
|
jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c
|
||||||
|
jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c
|
||||||
|
jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
|
||||||
|
|
||||||
|
if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
|
||||||
|
set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_ARITH_ENC)
|
||||||
|
set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_ARITH_DEC)
|
||||||
|
set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_SIMD)
|
||||||
|
add_subdirectory(simd)
|
||||||
|
if(NEON_INTRINSICS)
|
||||||
|
add_definitions(-DNEON_INTRINSICS)
|
||||||
|
endif()
|
||||||
|
elseif(NOT WITH_12BIT)
|
||||||
|
message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})")
|
||||||
|
endif()
|
||||||
|
if(WITH_SIMD)
|
||||||
|
message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})")
|
||||||
|
if(MSVC_IDE OR XCODE)
|
||||||
|
set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
add_library(simd OBJECT jsimd_none.c)
|
||||||
|
if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED))
|
||||||
|
set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_JAVA)
|
||||||
|
add_subdirectory(java)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_SHARED)
|
||||||
|
add_subdirectory(sharedlib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_STATIC)
|
||||||
|
add_library(jpeg-static STATIC ${JPEG_SOURCES} $<TARGET_OBJECTS:simd>
|
||||||
|
${SIMD_OBJS})
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_TURBOJPEG)
|
||||||
|
if(ENABLE_SHARED)
|
||||||
|
set(TURBOJPEG_SOURCES ${JPEG_SOURCES} $<TARGET_OBJECTS:simd> ${SIMD_OBJS}
|
||||||
|
turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c rdppm.c
|
||||||
|
wrbmp.c wrppm.c)
|
||||||
|
set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile)
|
||||||
|
if(WITH_JAVA)
|
||||||
|
set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
|
||||||
|
include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
||||||
|
set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile.jni)
|
||||||
|
endif()
|
||||||
|
if(MSVC)
|
||||||
|
configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in
|
||||||
|
${CMAKE_BINARY_DIR}/win/turbojpeg.rc)
|
||||||
|
set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES}
|
||||||
|
${CMAKE_BINARY_DIR}/win/turbojpeg.rc)
|
||||||
|
endif()
|
||||||
|
add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES})
|
||||||
|
set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS
|
||||||
|
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
|
||||||
|
if(WIN32)
|
||||||
|
set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
|
||||||
|
endif()
|
||||||
|
if(MINGW)
|
||||||
|
set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at)
|
||||||
|
endif()
|
||||||
|
if(APPLE AND (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR
|
||||||
|
CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.4))
|
||||||
|
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
|
||||||
|
endif()
|
||||||
|
set_target_properties(turbojpeg PROPERTIES MACOSX_RPATH 1)
|
||||||
|
endif()
|
||||||
|
set_target_properties(turbojpeg PROPERTIES
|
||||||
|
SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION})
|
||||||
|
if(TJMAPFLAG)
|
||||||
|
set_target_properties(turbojpeg PROPERTIES
|
||||||
|
LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_STATIC)
|
||||||
|
add_library(turbojpeg-static STATIC ${JPEG_SOURCES} $<TARGET_OBJECTS:simd>
|
||||||
|
${SIMD_OBJS} turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c
|
||||||
|
rdppm.c wrbmp.c wrppm.c)
|
||||||
|
set_property(TARGET turbojpeg-static PROPERTY COMPILE_FLAGS
|
||||||
|
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(USE_SETMODE "-DUSE_SETMODE")
|
||||||
|
endif()
|
||||||
|
if(WITH_12BIT)
|
||||||
|
set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED ${USE_SETMODE}")
|
||||||
|
else()
|
||||||
|
set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}")
|
||||||
|
set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c)
|
||||||
|
set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c)
|
||||||
|
endif()
|
||||||
741
cmake/CMakeLists.png
Normal file
741
cmake/CMakeLists.png
Normal file
@ -0,0 +1,741 @@
|
|||||||
|
# CMakeLists.txt
|
||||||
|
|
||||||
|
# Copyright (C) 2018 Cosmin Truta
|
||||||
|
# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson
|
||||||
|
# Written by Christian Ehrlicher, 2007
|
||||||
|
# Revised by Roger Lowman, 2009-2010
|
||||||
|
# Revised by Clifford Yapp, 2011-2012,2017
|
||||||
|
# Revised by Roger Leigh, 2016
|
||||||
|
# Revised by Andreas Franek, 2016
|
||||||
|
# Revised by Sam Serrels, 2017
|
||||||
|
# Revised by Vadim Barkov, 2017
|
||||||
|
# Revised by Vicky Pfau, 2018
|
||||||
|
# Revised by Cameron Cawley, 2018
|
||||||
|
# Revised by Cosmin Truta, 2018
|
||||||
|
# Revised by Kyle Bentley, 2018
|
||||||
|
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
cmake_policy(VERSION 3.1)
|
||||||
|
# When using CMake 3.4 and later, don't export symbols from executables unless
|
||||||
|
# the CMAKE_ENABLE_EXPORTS variable is set.
|
||||||
|
if(POLICY CMP0065)
|
||||||
|
cmake_policy(SET CMP0065 NEW)
|
||||||
|
endif()
|
||||||
|
if (POLICY CMP0077)
|
||||||
|
cmake_policy(SET CMP0077 NEW)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
||||||
|
|
||||||
|
project(libpng C ASM)
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
set(PNGLIB_MAJOR 1)
|
||||||
|
set(PNGLIB_MINOR 6)
|
||||||
|
set(PNGLIB_RELEASE 37)
|
||||||
|
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
|
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
# needed packages
|
||||||
|
|
||||||
|
# Allow users to specify location of Zlib.
|
||||||
|
# Useful if zlib is being built alongside this as a sub-project.
|
||||||
|
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" ON)
|
||||||
|
|
||||||
|
if(NOT PNG_BUILD_ZLIB)
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
include_directories(${ZLIB_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
|
||||||
|
find_library(M_LIBRARY m)
|
||||||
|
else()
|
||||||
|
# libm is not needed and/or not available
|
||||||
|
set(M_LIBRARY "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# COMMAND LINE OPTIONS
|
||||||
|
option(PNG_SHARED "Build shared lib" OFF)
|
||||||
|
option(PNG_STATIC "Build static lib" ON)
|
||||||
|
option(PNG_TESTS "Build libpng tests" OFF)
|
||||||
|
|
||||||
|
# Many more configuration options could be added here
|
||||||
|
option(PNG_FRAMEWORK "Build OS X framework" OFF)
|
||||||
|
option(PNG_DEBUG "Build with debug output" OFF)
|
||||||
|
option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" OFF)
|
||||||
|
|
||||||
|
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
|
||||||
|
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
|
||||||
|
|
||||||
|
if(PNG_HARDWARE_OPTIMIZATIONS)
|
||||||
|
|
||||||
|
# set definitions and sources for arm
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
||||||
|
set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
|
||||||
|
set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations:
|
||||||
|
check: (default) use internal checking code;
|
||||||
|
off: disable the optimizations;
|
||||||
|
on: turn on unconditionally.")
|
||||||
|
set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS
|
||||||
|
${PNG_ARM_NEON_POSSIBLE_VALUES})
|
||||||
|
list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index)
|
||||||
|
if(index EQUAL -1)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]")
|
||||||
|
elseif(NOT ${PNG_ARM_NEON} STREQUAL "off")
|
||||||
|
set(libpng_arm_sources
|
||||||
|
arm/arm_init.c
|
||||||
|
arm/filter_neon.S
|
||||||
|
arm/filter_neon_intrinsics.c
|
||||||
|
arm/palette_neon_intrinsics.c)
|
||||||
|
|
||||||
|
if(${PNG_ARM_NEON} STREQUAL "on")
|
||||||
|
add_definitions(-DPNG_ARM_NEON_OPT=2)
|
||||||
|
elseif(${PNG_ARM_NEON} STREQUAL "check")
|
||||||
|
add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for powerpc
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
|
||||||
|
set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off)
|
||||||
|
set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations:
|
||||||
|
off: disable the optimizations.")
|
||||||
|
set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS
|
||||||
|
${PNG_POWERPC_VSX_POSSIBLE_VALUES})
|
||||||
|
list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index)
|
||||||
|
if(index EQUAL -1)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]")
|
||||||
|
elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "off")
|
||||||
|
set(libpng_powerpc_sources
|
||||||
|
powerpc/powerpc_init.c
|
||||||
|
powerpc/filter_vsx_intrinsics.c)
|
||||||
|
if(${PNG_POWERPC_VSX} STREQUAL "on")
|
||||||
|
add_definitions(-DPNG_POWERPC_VSX_OPT=2)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for intel
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
|
||||||
|
set(PNG_INTEL_SSE_POSSIBLE_VALUES on off)
|
||||||
|
set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations:
|
||||||
|
off: disable the optimizations")
|
||||||
|
set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS
|
||||||
|
${PNG_INTEL_SSE_POSSIBLE_VALUES})
|
||||||
|
list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index)
|
||||||
|
if(index EQUAL -1)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]")
|
||||||
|
elseif(NOT ${PNG_INTEL_SSE} STREQUAL "off")
|
||||||
|
set(libpng_intel_sources
|
||||||
|
intel/intel_init.c
|
||||||
|
intel/filter_sse2_intrinsics.c)
|
||||||
|
if(${PNG_INTEL_SSE} STREQUAL "on")
|
||||||
|
add_definitions(-DPNG_INTEL_SSE_OPT=1)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
add_definitions(-DPNG_INTEL_SSE_OPT=0)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for MIPS
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
|
||||||
|
set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
|
||||||
|
set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
|
||||||
|
off: disable the optimizations")
|
||||||
|
set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS
|
||||||
|
${PNG_MIPS_MSA_POSSIBLE_VALUES})
|
||||||
|
list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index)
|
||||||
|
if(index EQUAL -1)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]")
|
||||||
|
elseif(NOT ${PNG_MIPS_MSA} STREQUAL "off")
|
||||||
|
set(libpng_mips_sources
|
||||||
|
mips/mips_init.c
|
||||||
|
mips/filter_msa_intrinsics.c)
|
||||||
|
if(${PNG_MIPS_MSA} STREQUAL "on")
|
||||||
|
add_definitions(-DPNG_MIPS_MSA_OPT=2)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else(PNG_HARDWARE_OPTIMIZATIONS)
|
||||||
|
|
||||||
|
# set definitions and sources for arm
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
||||||
|
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for powerpc
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
|
||||||
|
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for intel
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
|
||||||
|
add_definitions(-DPNG_INTEL_SSE_OPT=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for MIPS
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
|
||||||
|
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif(PNG_HARDWARE_OPTIMIZATIONS)
|
||||||
|
|
||||||
|
# SET LIBNAME
|
||||||
|
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
|
|
||||||
|
# to distinguish between debug and release lib
|
||||||
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
|
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
option(ld-version-script "Enable linker version script" ON)
|
||||||
|
if(ld-version-script AND NOT APPLE)
|
||||||
|
# Check if LD supports linker scripts.
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
|
||||||
|
global: sym;
|
||||||
|
local: *;
|
||||||
|
};
|
||||||
|
|
||||||
|
VERS_2 {
|
||||||
|
global: sym2;
|
||||||
|
main;
|
||||||
|
} VERS_1;
|
||||||
|
")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
|
||||||
|
check_c_source_compiles("void sym(void) {}
|
||||||
|
void sym2(void) {}
|
||||||
|
int main(void) {return 0;}
|
||||||
|
" HAVE_LD_VERSION_SCRIPT)
|
||||||
|
if(NOT HAVE_LD_VERSION_SCRIPT)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
check_c_source_compiles("void sym(void) {}
|
||||||
|
void sym2(void) {}
|
||||||
|
int main(void) {return 0;}
|
||||||
|
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
|
||||||
|
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find symbol prefix. Likely obsolete and unnecessary with recent
|
||||||
|
# toolchains (it's not done in many other projects).
|
||||||
|
function(symbol_prefix)
|
||||||
|
set(SYMBOL_PREFIX)
|
||||||
|
|
||||||
|
execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-"
|
||||||
|
INPUT_FILE /dev/null
|
||||||
|
OUTPUT_VARIABLE OUT
|
||||||
|
RESULT_VARIABLE STATUS)
|
||||||
|
|
||||||
|
if(CPP_FAIL)
|
||||||
|
message(WARNING "Failed to run the C preprocessor")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE "\n" ";" OUT "${OUT}")
|
||||||
|
foreach(line ${OUT})
|
||||||
|
string(REGEX MATCH "^PREFIX=" found_match "${line}")
|
||||||
|
if(found_match)
|
||||||
|
string(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
|
||||||
|
string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
|
||||||
|
if(found_match)
|
||||||
|
string(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
|
||||||
|
endif()
|
||||||
|
set(SYMBOL_PREFIX "${prefix}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
|
||||||
|
set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
symbol_prefix()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(AWK NAMES gawk awk)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
if(NOT AWK OR ANDROID)
|
||||||
|
# No awk available to generate sources; use pre-built pnglibconf.h
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
||||||
|
add_custom_target(genfiles) # Dummy
|
||||||
|
else()
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
# Generate .chk from .out with awk
|
||||||
|
# generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_chk)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs INPUT OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if(NOT _GC_INPUT)
|
||||||
|
message(FATAL_ERROR "generate_chk: Missing INPUT argument")
|
||||||
|
endif()
|
||||||
|
if(NOT _GC_OUTPUT)
|
||||||
|
message(FATAL_ERROR "generate_chk: Missing OUTPUT argument")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${_GC_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DINPUT=${_GC_INPUT}"
|
||||||
|
"-DOUTPUT=${_GC_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake"
|
||||||
|
DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate .out from .c with awk
|
||||||
|
# generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_out)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs INPUT OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if(NOT _GO_INPUT)
|
||||||
|
message(FATAL_ERROR "generate_out: Missing INPUT argument")
|
||||||
|
endif()
|
||||||
|
if(NOT _GO_OUTPUT)
|
||||||
|
message(FATAL_ERROR "generate_out: Missing OUTPUT argument")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${_GO_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DINPUT=${_GO_INPUT}"
|
||||||
|
"-DOUTPUT=${_GO_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake"
|
||||||
|
DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate specific source file with awk
|
||||||
|
# generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_source)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if(NOT _GSO_OUTPUT)
|
||||||
|
message(FATAL_ERROR "generate_source: Missing OUTPUT argument")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DOUTPUT=${_GSO_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
|
||||||
|
DEPENDS ${_GSO_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Copy file
|
||||||
|
function(generate_copy source destination)
|
||||||
|
add_custom_command(OUTPUT "${destination}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E remove "${destination}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${source}"
|
||||||
|
"${destination}"
|
||||||
|
DEPENDS "${source}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate scripts/pnglibconf.h
|
||||||
|
generate_source(OUTPUT "scripts/pnglibconf.c"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
|
||||||
|
|
||||||
|
# Generate pnglibconf.c
|
||||||
|
generate_source(OUTPUT "pnglibconf.c"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
|
||||||
|
|
||||||
|
if(PNG_PREFIX)
|
||||||
|
set(PNGLIBCONF_H_EXTRA_DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst")
|
||||||
|
set(PNGPREFIX_H_EXTRA_DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
|
||||||
|
|
||||||
|
# Generate pnglibconf.h
|
||||||
|
generate_source(OUTPUT "pnglibconf.h"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
|
||||||
|
${PNGLIBCONF_H_EXTRA_DEPENDS})
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
|
||||||
|
|
||||||
|
# Generate pngprefix.h
|
||||||
|
generate_source(OUTPUT "pngprefix.h"
|
||||||
|
DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS})
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def")
|
||||||
|
|
||||||
|
add_custom_target(symbol-check DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk")
|
||||||
|
|
||||||
|
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
|
||||||
|
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
|
||||||
|
|
||||||
|
add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
|
||||||
|
add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
|
||||||
|
|
||||||
|
add_custom_target("genprebuilt"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DOUTPUT=scripts/pnglibconf.h.prebuilt"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
|
# A single target handles generation of all generated files. If
|
||||||
|
# they are depended upon separately by multiple targets, this
|
||||||
|
# confuses parallel make (it would require a separate top-level
|
||||||
|
# target for each file to track the dependencies properly).
|
||||||
|
add_custom_target(genfiles DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
|
||||||
|
endif(NOT AWK OR ANDROID)
|
||||||
|
|
||||||
|
# OUR SOURCES
|
||||||
|
set(libpng_public_hdrs
|
||||||
|
png.h
|
||||||
|
pngconf.h
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
|
||||||
|
)
|
||||||
|
set(libpng_private_hdrs
|
||||||
|
pngpriv.h
|
||||||
|
pngdebug.h
|
||||||
|
pnginfo.h
|
||||||
|
pngstruct.h
|
||||||
|
)
|
||||||
|
if(AWK AND NOT ANDROID)
|
||||||
|
list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
|
||||||
|
endif()
|
||||||
|
set(libpng_sources
|
||||||
|
${libpng_public_hdrs}
|
||||||
|
${libpng_private_hdrs}
|
||||||
|
png.c
|
||||||
|
pngerror.c
|
||||||
|
pngget.c
|
||||||
|
pngmem.c
|
||||||
|
pngpread.c
|
||||||
|
pngread.c
|
||||||
|
pngrio.c
|
||||||
|
pngrtran.c
|
||||||
|
pngrutil.c
|
||||||
|
pngset.c
|
||||||
|
pngtrans.c
|
||||||
|
pngwio.c
|
||||||
|
pngwrite.c
|
||||||
|
pngwtran.c
|
||||||
|
pngwutil.c
|
||||||
|
${libpng_arm_sources}
|
||||||
|
${libpng_intel_sources}
|
||||||
|
${libpng_mips_sources}
|
||||||
|
${libpng_powerpc_sources}
|
||||||
|
)
|
||||||
|
set(pngtest_sources
|
||||||
|
pngtest.c
|
||||||
|
)
|
||||||
|
set(pngvalid_sources
|
||||||
|
contrib/libtests/pngvalid.c
|
||||||
|
)
|
||||||
|
set(pngstest_sources
|
||||||
|
contrib/libtests/pngstest.c
|
||||||
|
)
|
||||||
|
set(pngunknown_sources
|
||||||
|
contrib/libtests/pngunknown.c
|
||||||
|
)
|
||||||
|
set(pngimage_sources
|
||||||
|
contrib/libtests/pngimage.c
|
||||||
|
)
|
||||||
|
set(pngfix_sources
|
||||||
|
contrib/tools/pngfix.c
|
||||||
|
)
|
||||||
|
set(png_fix_itxt_sources
|
||||||
|
contrib/tools/png-fix-itxt.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PNG_DEBUG)
|
||||||
|
add_definitions(-DPNG_DEBUG)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# NOW BUILD OUR TARGET
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
|
unset(PNG_LIB_TARGETS)
|
||||||
|
|
||||||
|
if(PNG_STATIC)
|
||||||
|
# does not work without changing name
|
||||||
|
set(PNG_LIB_NAME_STATIC png_static)
|
||||||
|
add_library(png_static STATIC ${libpng_sources})
|
||||||
|
add_dependencies(png_static genfiles)
|
||||||
|
# MSVC doesn't use a different file extension for shared vs. static
|
||||||
|
# libs. We are able to change OUTPUT_NAME to remove the _static
|
||||||
|
# for all other platforms.
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_target_properties(png_static PROPERTIES
|
||||||
|
OUTPUT_NAME "${PNG_LIB_NAME}"
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
else()
|
||||||
|
set_target_properties(png_static PROPERTIES
|
||||||
|
OUTPUT_NAME "${PNG_LIB_NAME}_static"
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
endif()
|
||||||
|
list(APPEND PNG_LIB_TARGETS png_static)
|
||||||
|
if(MSVC)
|
||||||
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
|
set_target_properties(png_static PROPERTIES PREFIX "lib")
|
||||||
|
endif()
|
||||||
|
target_link_libraries(png_static ${M_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT PNG_LIB_TARGETS)
|
||||||
|
message(SEND_ERROR
|
||||||
|
"No library variant selected to build. "
|
||||||
|
"Please enable at least one of the following options: "
|
||||||
|
"PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set a variable with CMake code which:
|
||||||
|
# Creates a symlink from src to dest (if possible) or alternatively
|
||||||
|
# copies if different.
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
function(create_symlink DEST_FILE)
|
||||||
|
|
||||||
|
cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT S_TARGET AND NOT S_FILE)
|
||||||
|
message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(S_TARGET AND S_FILE)
|
||||||
|
message(FATAL_ERROR "create_symlink: Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; can only have one.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(S_FILE)
|
||||||
|
# If we don't need to symlink something that's coming from a build target,
|
||||||
|
# we can go ahead and symlink/copy at configure time.
|
||||||
|
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
else()
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(S_TARGET)
|
||||||
|
# We need to use generator expressions, which can be a bit tricky, so for
|
||||||
|
# simplicity make the symlink a POST_BUILD step and use the TARGET
|
||||||
|
# signature of add_custom_command.
|
||||||
|
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
|
||||||
|
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
||||||
|
else()
|
||||||
|
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Create source generation scripts.
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
|
||||||
|
|
||||||
|
# libpng is a library so default to 'lib'
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
set(CMAKE_INSTALL_LIBDIR lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# CREATE PKGCONFIG FILES
|
||||||
|
# We use the same files like ./configure, so we have to set its vars.
|
||||||
|
# Only do this on Windows for Cygwin - the files don't make much sense outside
|
||||||
|
# of a UNIX look-alike.
|
||||||
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||||
|
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
|
||||||
|
set(LIBS "-lz -lm")
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
||||||
|
create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc)
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
||||||
|
create_symlink(libpng-config FILE ${PNGLIB_NAME}-config)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# SET UP LINKS
|
||||||
|
if(PNG_SHARED)
|
||||||
|
set_target_properties(png PROPERTIES
|
||||||
|
# VERSION 16.${PNGLIB_RELEASE}.1.6.37
|
||||||
|
VERSION 16.${PNGLIB_RELEASE}.0
|
||||||
|
SOVERSION 16
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# INSTALL
|
||||||
|
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
||||||
|
install(TARGETS ${PNG_LIB_TARGETS}
|
||||||
|
EXPORT libpng
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
|
if(PNG_SHARED)
|
||||||
|
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
||||||
|
if(CYGWIN OR MINGW)
|
||||||
|
create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
|
||||||
|
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
|
||||||
|
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PNG_STATIC)
|
||||||
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
|
create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static)
|
||||||
|
install(FILES $<TARGET_LINKER_FILE_DIR:png_static>/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
|
||||||
|
install(FILES ${libpng_public_hdrs} DESTINATION include)
|
||||||
|
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
|
||||||
|
endif()
|
||||||
|
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL)
|
||||||
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
||||||
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL)
|
||||||
|
install(TARGETS ${PNG_BIN_TARGETS}
|
||||||
|
RUNTIME DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL)
|
||||||
|
# Install man pages
|
||||||
|
if(NOT PNG_MAN_DIR)
|
||||||
|
set(PNG_MAN_DIR "share/man")
|
||||||
|
endif()
|
||||||
|
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
|
||||||
|
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
|
||||||
|
# Install pkg-config files
|
||||||
|
if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW)
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
|
||||||
|
DESTINATION bin)
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||||
|
DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Create an export file that CMake users can include() to import our targets.
|
||||||
|
if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL)
|
||||||
|
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# what's with libpng-manual.txt and all the extra files?
|
||||||
|
|
||||||
|
# UNINSTALL
|
||||||
|
# do we need this?
|
||||||
|
|
||||||
|
# DIST
|
||||||
|
# do we need this?
|
||||||
|
|
||||||
|
# to create msvc import lib for mingw compiled shared lib
|
||||||
|
# pexports libpng.dll > libpng.def
|
||||||
|
# lib /def:libpng.def /machine:x86
|
||||||
@ -1,9 +1,8 @@
|
|||||||
# -*- CMake -*- master configuration file for building LAMMPS
|
|
||||||
########################################
|
########################################
|
||||||
# CMake build system
|
# CMake build system
|
||||||
# This file is part of LAMMPS
|
# This file is part of LAMMPS
|
||||||
cmake_minimum_required(VERSION 3.16)
|
# 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
|
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
||||||
if(POLICY CMP0074)
|
if(POLICY CMP0074)
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
@ -12,11 +11,11 @@ endif()
|
|||||||
if(POLICY CMP0075)
|
if(POLICY CMP0075)
|
||||||
cmake_policy(SET CMP0075 NEW)
|
cmake_policy(SET CMP0075 NEW)
|
||||||
endif()
|
endif()
|
||||||
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
|
# set policy to silence warnings about missing executable permissions in
|
||||||
if(POLICY CMP0135)
|
# pythonx.y-config when cross-compiling. review occasionally if it may be set to NEW
|
||||||
cmake_policy(SET CMP0135 OLD)
|
if(POLICY CMP0109)
|
||||||
|
cmake_policy(SET CMP0109 OLD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
project(lammps CXX)
|
project(lammps CXX)
|
||||||
@ -105,7 +104,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)
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
|
||||||
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
|
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_TUNE_DEFAULT "-xHost -fp-model fast=2 -no-prec-div -qoverride-limits -diag-disable=10441 -diag-disable=11074 -diag-disable=11076 -diag-disable=2196")
|
set(CMAKE_TUNE_DEFAULT "-xHost")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -120,45 +119,33 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "
|
|||||||
set(CMAKE_TUNE_DEFAULT "-Minform=severe")
|
set(CMAKE_TUNE_DEFAULT "-Minform=severe")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# this hack is required to compile fmt lib with CrayClang version 15.0.2
|
|
||||||
# CrayClang is only directly recognized by version 3.28 and later
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.28)
|
|
||||||
get_filename_component(_exe "${CMAKE_CXX_COMPILER}" NAME)
|
|
||||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (_exe STREQUAL "crayCC"))
|
|
||||||
set(CMAKE_TUNE_DEFAULT "-DFMT_STATIC_THOUSANDS_SEPARATOR")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "CrayClang")
|
|
||||||
set(CMAKE_TUNE_DEFAULT "-DFMT_STATIC_THOUSANDS_SEPARATOR")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# silence nvcc warnings
|
# silence nvcc warnings
|
||||||
if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||||
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma")
|
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# we require C++11 without extensions. Kokkos requires at least C++17 (currently)
|
# we require C++11 without extensions. Kokkos requires at least C++14 (currently)
|
||||||
if(NOT CMAKE_CXX_STANDARD)
|
if(NOT CMAKE_CXX_STANDARD)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_CXX_STANDARD LESS 11)
|
if(CMAKE_CXX_STANDARD LESS 11)
|
||||||
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 17))
|
if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14))
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
||||||
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
||||||
# and prints lots of pointless warnings about "unsafe" functions
|
# and prints lots of pointless warnings about "unsafe" functions
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel"))
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
add_compile_options(/Zc:__cplusplus)
|
add_compile_options(/Zc:__cplusplus)
|
||||||
add_compile_options(/wd4244)
|
add_compile_options(/wd4244)
|
||||||
add_compile_options(/wd4267)
|
add_compile_options(/wd4267)
|
||||||
add_compile_options(/wd4250)
|
if(LAMMPS_EXCEPTIONS)
|
||||||
add_compile_options(/EHsc)
|
add_compile_options(/EHsc)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
@ -171,22 +158,6 @@ endif()
|
|||||||
########################################################################
|
########################################################################
|
||||||
# User input options #
|
# User input options #
|
||||||
########################################################################
|
########################################################################
|
||||||
# backward compatibility with CMake before 3.12 and older LAMMPS documentation
|
|
||||||
if (PYTHON_EXECUTABLE)
|
|
||||||
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
|
||||||
endif()
|
|
||||||
# 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()
|
|
||||||
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")
|
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
||||||
mark_as_advanced(LAMMPS_MACHINE)
|
mark_as_advanced(LAMMPS_MACHINE)
|
||||||
if(LAMMPS_MACHINE)
|
if(LAMMPS_MACHINE)
|
||||||
@ -198,7 +169,6 @@ option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
|||||||
option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared libraries" ON)
|
option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared libraries" ON)
|
||||||
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
||||||
option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF)
|
option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF)
|
||||||
option(BUILD_LAMMPS_GUI "Build and install the LAMMPS GUI" OFF)
|
|
||||||
|
|
||||||
# Support using clang-tidy for C++ files with selected options
|
# Support using clang-tidy for C++ files with selected options
|
||||||
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
|
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
|
||||||
@ -209,8 +179,8 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
file(GLOB ALL_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
file(GLOB ALL_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||||
file(GLOB MAIN_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/main.cpp)
|
file(GLOB MAIN_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||||
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
||||||
add_library(lammps ${ALL_SOURCES})
|
add_library(lammps ${ALL_SOURCES})
|
||||||
|
|
||||||
@ -228,7 +198,6 @@ option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
|||||||
|
|
||||||
set(STANDARD_PACKAGES
|
set(STANDARD_PACKAGES
|
||||||
ADIOS
|
ADIOS
|
||||||
AMOEBA
|
|
||||||
ASPHERE
|
ASPHERE
|
||||||
ATC
|
ATC
|
||||||
AWPMD
|
AWPMD
|
||||||
@ -237,7 +206,7 @@ set(STANDARD_PACKAGES
|
|||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SPICA
|
CG-SDK
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -264,7 +233,7 @@ set(STANDARD_PACKAGES
|
|||||||
KIM
|
KIM
|
||||||
KSPACE
|
KSPACE
|
||||||
LATBOLTZ
|
LATBOLTZ
|
||||||
LEPTON
|
LATTE
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
@ -280,10 +249,11 @@ set(STANDARD_PACKAGES
|
|||||||
ML-QUIP
|
ML-QUIP
|
||||||
ML-RANN
|
ML-RANN
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
ML-POD
|
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
|
MPIIO
|
||||||
|
MSCG
|
||||||
NETCDF
|
NETCDF
|
||||||
ORIENT
|
ORIENT
|
||||||
PERI
|
PERI
|
||||||
@ -329,15 +299,6 @@ if(PKG_ADIOS)
|
|||||||
# script that defines the MPI::MPI_C target
|
# script that defines the MPI::MPI_C target
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
find_package(ADIOS2 REQUIRED)
|
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)
|
target_link_libraries(lammps PRIVATE adios2::adios2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -389,20 +350,23 @@ if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0")
|
|||||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" ${ENABLE_TESTING})
|
||||||
|
if(LAMMPS_EXCEPTIONS)
|
||||||
|
target_compile_definitions(lammps PUBLIC -DLAMMPS_EXCEPTIONS)
|
||||||
|
endif()
|
||||||
|
|
||||||
# "hard" dependencies between packages resulting
|
# "hard" dependencies between packages resulting
|
||||||
# in an error instead of skipping over files
|
# in an error instead of skipping over files
|
||||||
pkg_depends(ML-IAP ML-SNAP)
|
pkg_depends(ML-IAP ML-SNAP)
|
||||||
|
pkg_depends(MPIIO MPI)
|
||||||
pkg_depends(ATC MANYBODY)
|
pkg_depends(ATC MANYBODY)
|
||||||
pkg_depends(LATBOLTZ MPI)
|
pkg_depends(LATBOLTZ MPI)
|
||||||
pkg_depends(SCAFACOS MPI)
|
pkg_depends(SCAFACOS MPI)
|
||||||
pkg_depends(AMOEBA KSPACE)
|
|
||||||
pkg_depends(DIELECTRIC KSPACE)
|
pkg_depends(DIELECTRIC KSPACE)
|
||||||
pkg_depends(DIELECTRIC EXTRA-PAIR)
|
pkg_depends(DIELECTRIC EXTRA-PAIR)
|
||||||
pkg_depends(CG-DNA MOLECULE)
|
pkg_depends(CG-DNA MOLECULE)
|
||||||
pkg_depends(CG-DNA ASPHERE)
|
pkg_depends(CG-DNA ASPHERE)
|
||||||
pkg_depends(ELECTRODE KSPACE)
|
pkg_depends(ELECTRODE KSPACE)
|
||||||
pkg_depends(EXTRA-MOLECULE MOLECULE)
|
|
||||||
pkg_depends(MESONT MOLECULE)
|
|
||||||
|
|
||||||
# detect if we may enable OpenMP support by default
|
# detect if we may enable OpenMP support by default
|
||||||
set(BUILD_OMP_DEFAULT OFF)
|
set(BUILD_OMP_DEFAULT OFF)
|
||||||
@ -428,7 +392,6 @@ if(BUILD_OMP)
|
|||||||
(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") OR (CMAKE_CXX_COMPILER_ID STREQUAL "XLClang") OR
|
(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") OR (CMAKE_CXX_COMPILER_ID STREQUAL "XLClang") OR
|
||||||
((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
||||||
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
||||||
((CMAKE_CXX_COMPILER_ID STREQUAL "CrayClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
|
||||||
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
|
||||||
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
|
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
|
||||||
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
|
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
|
||||||
@ -441,31 +404,21 @@ if(BUILD_OMP)
|
|||||||
target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX)
|
target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# lower C++ standard for fmtlib sources when using Intel classic compiler
|
if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE OR PKG_ELECTRODE)
|
||||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_STANDARD GREATER_EQUAL 17)
|
|
||||||
AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2021.10))
|
|
||||||
message(STATUS "Lowering C++ standard for compiling fmtlib sources with Intel Classic compiler")
|
|
||||||
get_filename_component(LMP_UTILS_SRC "${LAMMPS_SOURCE_DIR}/utils.cpp" ABSOLUTE)
|
|
||||||
get_filename_component(LMP_VARIABLE_SRC "${LAMMPS_SOURCE_DIR}/variable.cpp" ABSOLUTE)
|
|
||||||
get_filename_component(FMT_FORMAT_SRC "${LAMMPS_SOURCE_DIR}/fmtlib_format.cpp" ABSOLUTE)
|
|
||||||
get_filename_component(FMT_OS_SRC "${LAMMPS_SOURCE_DIR}/fmtlib_os.cpp" ABSOLUTE)
|
|
||||||
set_source_files_properties("${FMT_FORMAT_SRC}" "${FMT_OS_SRC}" "${LMP_VARIABLE_SRC}" "${LMP_UTILS_SRC}"
|
|
||||||
PROPERTIES COMPILE_OPTIONS "-std=c++14")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_TOOLS)
|
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
if (NOT USE_INTERNAL_LINALG)
|
find_package(LAPACK)
|
||||||
find_package(LAPACK)
|
find_package(BLAS)
|
||||||
find_package(BLAS)
|
if(NOT LAPACK_FOUND OR NOT BLAS_FOUND)
|
||||||
endif()
|
include(CheckGeneratorSupport)
|
||||||
if(NOT LAPACK_FOUND OR NOT BLAS_FOUND OR USE_INTERNAL_LINALG)
|
if(NOT CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
||||||
file(GLOB LINALG_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.cpp)
|
status(FATAL_ERROR "Cannot build internal linear algebra library as CMake build tool lacks Fortran support")
|
||||||
add_library(linalg STATIC ${LINALG_SOURCES})
|
endif()
|
||||||
|
enable_language(Fortran)
|
||||||
|
file(GLOB LAPACK_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.[fF])
|
||||||
|
add_library(linalg STATIC ${LAPACK_SOURCES})
|
||||||
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
||||||
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||||
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
|
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||||
target_link_libraries(lammps PRIVATE linalg)
|
|
||||||
else()
|
else()
|
||||||
list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@ -478,7 +431,12 @@ option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
|||||||
if(WITH_JPEG)
|
if(WITH_JPEG)
|
||||||
find_package(JPEG REQUIRED)
|
find_package(JPEG REQUIRED)
|
||||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
||||||
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(PNG QUIET)
|
find_package(PNG QUIET)
|
||||||
@ -528,7 +486,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF
|
foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF
|
||||||
PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM COMPRESS ML-PACE LEPTON)
|
PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM LATTE MSCG COMPRESS ML-PACE)
|
||||||
if(PKG_${PKG_WITH_INCL})
|
if(PKG_${PKG_WITH_INCL})
|
||||||
include(Packages/${PKG_WITH_INCL})
|
include(Packages/${PKG_WITH_INCL})
|
||||||
endif()
|
endif()
|
||||||
@ -545,10 +503,7 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine
|
|||||||
separate_arguments(CMAKE_TUNE_FLAGS)
|
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||||
# skip these flags when linking the main executable
|
target_compile_options(lmp PRIVATE ${_FLAG})
|
||||||
if(NOT (("${_FLAG}" STREQUAL "-Xcudafe") OR (("${_FLAG}" STREQUAL "--diag_suppress=unrecognized_pragma"))))
|
|
||||||
target_compile_options(lmp PRIVATE ${_FLAG})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
########################################################################
|
########################################################################
|
||||||
# Basic system tests (standard libraries, headers, functions, types) #
|
# Basic system tests (standard libraries, headers, functions, types) #
|
||||||
@ -576,8 +531,6 @@ RegisterStyles(${LAMMPS_SOURCE_DIR})
|
|||||||
########################################################
|
########################################################
|
||||||
# Fetch missing external files and archives for packages
|
# Fetch missing external files and archives for packages
|
||||||
########################################################
|
########################################################
|
||||||
option(DOWNLOAD_POTENTIALS "Automatically download large potential files" ON)
|
|
||||||
mark_as_advanced(DOWNLOAD_POTENTIALS)
|
|
||||||
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||||
if(PKG_${PKG})
|
if(PKG_${PKG})
|
||||||
FetchPotentials(${LAMMPS_SOURCE_DIR}/${PKG} ${LAMMPS_POTENTIALS_DIR})
|
FetchPotentials(${LAMMPS_SOURCE_DIR}/${PKG} ${LAMMPS_POTENTIALS_DIR})
|
||||||
@ -590,8 +543,8 @@ endforeach()
|
|||||||
foreach(PKG ${STANDARD_PACKAGES})
|
foreach(PKG ${STANDARD_PACKAGES})
|
||||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
|
|
||||||
file(GLOB ${PKG}_SOURCES CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||||
file(GLOB ${PKG}_HEADERS CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||||
|
|
||||||
# check for package files in src directory due to old make system
|
# check for package files in src directory due to old make system
|
||||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||||
@ -607,12 +560,19 @@ foreach(PKG ${STANDARD_PACKAGES})
|
|||||||
RegisterPackages(${${PKG}_SOURCES_DIR})
|
RegisterPackages(${${PKG}_SOURCES_DIR})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
# packages that need defines set
|
||||||
|
foreach(PKG MPIIO)
|
||||||
|
if(PKG_${PKG})
|
||||||
|
target_compile_definitions(lammps PRIVATE -DLMP_${PKG})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
# dedicated check for entire contents of accelerator packages
|
# dedicated check for entire contents of accelerator packages
|
||||||
foreach(PKG ${SUFFIX_PACKAGES})
|
foreach(PKG ${SUFFIX_PACKAGES})
|
||||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
|
|
||||||
file(GLOB ${PKG}_SOURCES CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||||
file(GLOB ${PKG}_HEADERS CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||||
|
|
||||||
# check for package files in src directory due to old make system
|
# check for package files in src directory due to old make system
|
||||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||||
@ -623,11 +583,18 @@ endforeach()
|
|||||||
##############################################
|
##############################################
|
||||||
# add lib sources of (simple) enabled packages
|
# add lib sources of (simple) enabled packages
|
||||||
############################################
|
############################################
|
||||||
foreach(PKG_LIB POEMS ATC AWPMD H5MD)
|
foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT)
|
||||||
if(PKG_${PKG_LIB})
|
if(PKG_${PKG_LIB})
|
||||||
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
||||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES CONFIGURE_DEPENDS
|
if(PKG_LIB STREQUAL "mesont")
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
enable_language(Fortran)
|
||||||
|
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
||||||
|
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.f90)
|
||||||
|
else()
|
||||||
|
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
||||||
|
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c
|
||||||
|
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
||||||
|
endif()
|
||||||
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
||||||
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
||||||
target_link_libraries(lammps PRIVATE ${PKG_LIB})
|
target_link_libraries(lammps PRIVATE ${PKG_LIB})
|
||||||
@ -641,7 +608,7 @@ foreach(PKG_LIB POEMS ATC AWPMD H5MD)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(PKG_ELECTRODE OR PKG_ML-POD)
|
if(PKG_ELECTRODE)
|
||||||
target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES})
|
target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -670,7 +637,7 @@ endif()
|
|||||||
# packages which selectively include variants based on enabled styles
|
# packages which selectively include variants based on enabled styles
|
||||||
# e.g. accelerator packages
|
# e.g. accelerator packages
|
||||||
######################################################################
|
######################################################################
|
||||||
foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MC MISC PHONON QEQ OPENMP KOKKOS OPT INTEL GPU)
|
foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH PHONON QEQ OPENMP KOKKOS OPT INTEL GPU)
|
||||||
if(PKG_${PKG_WITH_INCL})
|
if(PKG_${PKG_WITH_INCL})
|
||||||
include(Packages/${PKG_WITH_INCL})
|
include(Packages/${PKG_WITH_INCL})
|
||||||
endif()
|
endif()
|
||||||
@ -743,17 +710,18 @@ list(FIND LANGUAGES "Fortran" _index)
|
|||||||
if(_index GREATER -1)
|
if(_index GREATER -1)
|
||||||
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h command.h compute.h dihedral.h domain.h
|
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h compute.h dihedral.h domain.h error.h fix.h force.h group.h improper.h
|
||||||
error.h exceptions.h fix.h force.h group.h improper.h input.h info.h kspace.h lammps.h lattice.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
|
||||||
library.h lmppython.h lmptype.h memory.h modify.h neighbor.h neigh_list.h output.h pair.h
|
pair.h pointers.h region.h timer.h universe.h update.h utils.h variable.h)
|
||||||
platform.h pointers.h region.h timer.h universe.h update.h utils.h variable.h)
|
if(LAMMPS_EXCEPTIONS)
|
||||||
set(LAMMPS_FMT_HEADERS core.h format.h)
|
list(APPEND LAMMPS_CXX_HEADERS exceptions.h)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
|
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
|
||||||
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
||||||
set_target_properties(lammps PROPERTIES PREFIX "lib")
|
set_target_properties(lammps PROPERTIES PREFIX "lib")
|
||||||
target_include_directories(lammps PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps>)
|
target_include_directories(lammps PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps>)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps)
|
||||||
foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
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_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})
|
add_custom_target(${_HEADER} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER})
|
||||||
@ -762,14 +730,6 @@ foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
|||||||
install(FILES ${LAMMPS_SOURCE_DIR}/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
|
install(FILES ${LAMMPS_SOURCE_DIR}/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
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>)
|
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>)
|
||||||
add_library(LAMMPS::lammps ALIAS lammps)
|
add_library(LAMMPS::lammps ALIAS lammps)
|
||||||
get_target_property(LAMMPS_DEFINES lammps INTERFACE_COMPILE_DEFINITIONS)
|
get_target_property(LAMMPS_DEFINES lammps INTERFACE_COMPILE_DEFINITIONS)
|
||||||
@ -796,11 +756,9 @@ include(Tools)
|
|||||||
include(Documentation)
|
include(Documentation)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Install bench, potential and force field files in data directory
|
# Install potential and force field files in data directory
|
||||||
###############################################################################
|
###############################################################################
|
||||||
set(LAMMPS_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/lammps)
|
set(LAMMPS_INSTALL_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps)
|
||||||
|
|
||||||
install(DIRECTORY ${LAMMPS_DIR}/bench DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
|
||||||
install(DIRECTORY ${LAMMPS_POTENTIALS_DIR} DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
install(DIRECTORY ${LAMMPS_POTENTIALS_DIR} DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
||||||
if(BUILD_TOOLS)
|
if(BUILD_TOOLS)
|
||||||
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/msi2lmp/frc_files DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/msi2lmp/frc_files DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
||||||
@ -821,8 +779,16 @@ install(
|
|||||||
# This is primarily for people that only want to use the Python wrapper.
|
# This is primarily for people that only want to use the Python wrapper.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
# backward compatibility
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
find_package(Python COMPONENTS Interpreter)
|
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
||||||
|
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
||||||
|
find_package(PythonInterp) # Deprecated since version 3.12
|
||||||
|
if(PYTHONINTERP_FOUND)
|
||||||
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(Python COMPONENTS Interpreter)
|
||||||
|
endif()
|
||||||
if(BUILD_IS_MULTI_CONFIG)
|
if(BUILD_IS_MULTI_CONFIG)
|
||||||
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||||
else()
|
else()
|
||||||
@ -831,8 +797,9 @@ if(BUILD_SHARED_LIBS)
|
|||||||
set(LIBLAMMPS_SHARED_BINARY ${MY_BUILD_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set(LIBLAMMPS_SHARED_BINARY ${MY_BUILD_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
if(Python_EXECUTABLE)
|
if(Python_EXECUTABLE)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
install-python ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps
|
install-python ${CMAKE_COMMAND} -E remove_directory build
|
||||||
-l ${LIBLAMMPS_SHARED_BINARY} -w ${MY_BUILD_DIR} -v ${LAMMPS_SOURCE_DIR}/version.h
|
COMMAND ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps
|
||||||
|
-l ${LIBLAMMPS_SHARED_BINARY} -w ${MY_BUILD_DIR}
|
||||||
COMMENT "Installing LAMMPS Python module")
|
COMMENT "Installing LAMMPS Python module")
|
||||||
else()
|
else()
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
@ -845,6 +812,26 @@ else()
|
|||||||
${CMAKE_COMMAND} -E echo "Must build LAMMPS as a shared library to use the Python module")
|
${CMAKE_COMMAND} -E echo "Must build LAMMPS as a shared library to use the Python module")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Add LAMMPS python module to "install" target. This is taylored for building
|
||||||
|
# LAMMPS for package managers and with different prefix settings.
|
||||||
|
# This requires either a shared library or that the PYTHON package is included.
|
||||||
|
###############################################################################
|
||||||
|
if(BUILD_SHARED_LIBS OR PKG_PYTHON)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
find_package(PythonInterp) # Deprecated since version 3.12
|
||||||
|
if(PYTHONINTERP_FOUND)
|
||||||
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
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})")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
include(Testing)
|
include(Testing)
|
||||||
include(CodeCoverage)
|
include(CodeCoverage)
|
||||||
include(CodingStandard)
|
include(CodingStandard)
|
||||||
@ -856,23 +843,6 @@ if(ClangFormat_FOUND)
|
|||||||
WORKING_DIRECTORY ${LAMMPS_SOURCE_DIR})
|
WORKING_DIRECTORY ${LAMMPS_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# extract Kokkos compilation settings
|
|
||||||
get_cmake_property(_allvars VARIABLES)
|
|
||||||
foreach(_var ${_allvars})
|
|
||||||
if(${_var})
|
|
||||||
string(REGEX MATCH "Kokkos_ENABLE_(SERIAL|THREADS|OPENMP|CUDA|HIP|SYCL|OPENMPTARGET|HPX)" _match ${_var})
|
|
||||||
if(_match)
|
|
||||||
string(REGEX REPLACE "Kokkos_ENABLE_(OPENMP|SERIAL|CUDA|HIP|SYCL)" "\\1" _match ${_var})
|
|
||||||
list(APPEND KOKKOS_DEVICE ${_match})
|
|
||||||
endif()
|
|
||||||
string(REGEX MATCH "Kokkos_ARCH" _match ${_var})
|
|
||||||
if(_match)
|
|
||||||
string(REGEX REPLACE "Kokkos_ARCH_(.*)" "\\1" _match ${_var})
|
|
||||||
list(APPEND KOKKOS_ARCH ${_match})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
|
get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
|
||||||
if(BUILD_IS_MULTI_CONFIG)
|
if(BUILD_IS_MULTI_CONFIG)
|
||||||
set(LAMMPS_BUILD_TYPE "Multi-Config")
|
set(LAMMPS_BUILD_TYPE "Multi-Config")
|
||||||
@ -881,23 +851,12 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
||||||
if(GIT_FOUND AND EXISTS ${LAMMPS_DIR}/.git)
|
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified --always
|
|
||||||
OUTPUT_VARIABLE GIT_DESCRIBE
|
|
||||||
ERROR_QUIET
|
|
||||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
endif()
|
|
||||||
message(STATUS "<<< Build configuration >>>
|
message(STATUS "<<< Build configuration >>>
|
||||||
LAMMPS Version: ${PROJECT_VERSION} ${GIT_DESCRIBE}
|
LAMMPS Version: ${PROJECT_VERSION}
|
||||||
Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
|
Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
|
||||||
CMake Version: ${CMAKE_VERSION}
|
|
||||||
Build type: ${LAMMPS_BUILD_TYPE}
|
Build type: ${LAMMPS_BUILD_TYPE}
|
||||||
Install path: ${CMAKE_INSTALL_PREFIX}
|
Install path: ${CMAKE_INSTALL_PREFIX}
|
||||||
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
||||||
if(CMAKE_CROSSCOMPILING)
|
|
||||||
message(STATUS "Cross compiling on ${CMAKE_HOST_SYSTEM}")
|
|
||||||
endif()
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Print package summary
|
# Print package summary
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -941,9 +900,11 @@ if(_index GREATER -1)
|
|||||||
endif()
|
endif()
|
||||||
message(STATUS "<<< Linker flags: >>>")
|
message(STATUS "<<< Linker flags: >>>")
|
||||||
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
||||||
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
||||||
if(OPTIONS)
|
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
||||||
message(STATUS "Linker options: ${OPTIONS}")
|
if(OPTIONS)
|
||||||
|
message(STATUS "Linker options: ${OPTIONS}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_EXE_LINKER_FLAGS)
|
if(CMAKE_EXE_LINKER_FLAGS)
|
||||||
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
@ -979,43 +940,37 @@ if(PKG_GPU)
|
|||||||
message(STATUS "GPU precision: ${GPU_PREC}")
|
message(STATUS "GPU precision: ${GPU_PREC}")
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KOKKOS)
|
if(PKG_KOKKOS)
|
||||||
message(STATUS "Kokkos Devices: ${KOKKOS_DEVICE}")
|
message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}")
|
||||||
if(KOKKOS_ARCH)
|
|
||||||
message(STATUS "Kokkos Architecture: ${KOKKOS_ARCH}")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KSPACE)
|
if(PKG_KSPACE)
|
||||||
if (FFT_USE_HEFFTE)
|
message(STATUS "<<< FFT settings >>>
|
||||||
message(STATUS "<<< FFT settings >>>
|
|
||||||
-- Primary FFT lib: heFFTe")
|
|
||||||
if (FFT_HEFFTE_BACKEND)
|
|
||||||
message(STATUS "heFFTe backend: ${FFT_HEFFTE_BACKEND}")
|
|
||||||
else()
|
|
||||||
message(STATUS "heFFTe backend: stock (builtin FFT implementation, tested for corrected but not optimized for production)")
|
|
||||||
endif()
|
|
||||||
message(STATUS "Using distributed FFT algorithms from heFTTe")
|
|
||||||
if(FFT_SINGLE)
|
|
||||||
message(STATUS "Using single precision FFTs")
|
|
||||||
else()
|
|
||||||
message(STATUS "Using double precision FFTs")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(STATUS "<<< FFT settings >>>
|
|
||||||
-- Primary FFT lib: ${FFT}")
|
-- Primary FFT lib: ${FFT}")
|
||||||
if(FFT_SINGLE)
|
if(FFT_SINGLE)
|
||||||
message(STATUS "Using single precision FFTs")
|
message(STATUS "Using single precision FFTs")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Using double precision FFTs")
|
message(STATUS "Using double precision FFTs")
|
||||||
endif()
|
endif()
|
||||||
if(FFT_FFTW_THREADS OR FFT_MKL_THREADS)
|
if(FFT_FFTW_THREADS OR FFT_MKL_THREADS)
|
||||||
message(STATUS "Using threaded FFTs")
|
message(STATUS "Using threaded FFTs")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Using non-threaded FFTs")
|
message(STATUS "Using non-threaded FFTs")
|
||||||
endif()
|
|
||||||
message(STATUS "Using builtin distributed FFT algorithms")
|
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KOKKOS)
|
if(PKG_KOKKOS)
|
||||||
message(STATUS "Kokkos FFT: ${FFT_KOKKOS}")
|
if(Kokkos_ENABLE_CUDA)
|
||||||
|
if(FFT STREQUAL "KISS")
|
||||||
|
message(STATUS "Kokkos FFT: KISS")
|
||||||
|
else()
|
||||||
|
message(STATUS "Kokkos FFT: cuFFT")
|
||||||
|
endif()
|
||||||
|
elseif(Kokkos_ENABLE_HIP)
|
||||||
|
if(FFT STREQUAL "KISS")
|
||||||
|
message(STATUS "Kokkos FFT: KISS")
|
||||||
|
else()
|
||||||
|
message(STATUS "Kokkos FFT: hipFFT")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "Kokkos FFT: ${FFT}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(BUILD_DOC)
|
if(BUILD_DOC)
|
||||||
@ -1027,14 +982,6 @@ endif()
|
|||||||
if(BUILD_LAMMPS_SHELL)
|
if(BUILD_LAMMPS_SHELL)
|
||||||
message(STATUS "<<< Building LAMMPS Shell >>>")
|
message(STATUS "<<< Building LAMMPS Shell >>>")
|
||||||
endif()
|
endif()
|
||||||
if(BUILD_LAMMPS_GUI)
|
|
||||||
message(STATUS "<<< Building LAMMPS GUI >>>")
|
|
||||||
if(LAMMPS_GUI_USE_PLUGIN)
|
|
||||||
message(STATUS "Loading LAMMPS library as plugin at run time")
|
|
||||||
else()
|
|
||||||
message(STATUS "Linking LAMMPS library at compile time")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(ENABLE_TESTING)
|
if(ENABLE_TESTING)
|
||||||
message(STATUS "<<< Building Unit Tests >>>")
|
message(STATUS "<<< Building Unit Tests >>>")
|
||||||
if(ENABLE_COVERAGE)
|
if(ENABLE_COVERAGE)
|
||||||
|
|||||||
195
cmake/CMakeLists.zlib
Normal file
195
cmake/CMakeLists.zlib
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
# When using CMake 3.4 and later, don't export symbols from executables unless
|
||||||
|
# the CMAKE_ENABLE_EXPORTS variable is set.
|
||||||
|
if(POLICY CMP0065)
|
||||||
|
cmake_policy(SET CMP0065 NEW)
|
||||||
|
endif()
|
||||||
|
if (POLICY CMP0077)
|
||||||
|
cmake_policy(SET CMP0077 NEW)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
||||||
|
|
||||||
|
project(zlib C)
|
||||||
|
|
||||||
|
set(VERSION "1.2.11")
|
||||||
|
|
||||||
|
option(ASM686 "Enable building i686 assembly implementation" OFF)
|
||||||
|
option(AMD64 "Enable building amd64 assembly implementation" OFF)
|
||||||
|
|
||||||
|
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
||||||
|
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
||||||
|
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
|
||||||
|
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
|
||||||
|
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
|
||||||
|
|
||||||
|
include(CheckTypeSize)
|
||||||
|
include(CheckFunctionExists)
|
||||||
|
include(CheckIncludeFile)
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
|
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||||
|
check_include_file(stdint.h HAVE_STDINT_H)
|
||||||
|
check_include_file(stddef.h HAVE_STDDEF_H)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check to see if we have large file support
|
||||||
|
#
|
||||||
|
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
|
||||||
|
# We add these other definitions here because CheckTypeSize.cmake
|
||||||
|
# in CMake 2.4.x does not automatically do so and we want
|
||||||
|
# compatibility with CMake 2.4.x.
|
||||||
|
if(HAVE_SYS_TYPES_H)
|
||||||
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
|
||||||
|
endif()
|
||||||
|
if(HAVE_STDINT_H)
|
||||||
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
|
||||||
|
endif()
|
||||||
|
if(HAVE_STDDEF_H)
|
||||||
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
|
||||||
|
endif()
|
||||||
|
check_type_size(off64_t OFF64_T)
|
||||||
|
check_type_size(off64_t OFF64_T)
|
||||||
|
if(HAVE_OFF64_T)
|
||||||
|
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check for fseeko
|
||||||
|
#
|
||||||
|
check_function_exists(fseeko HAVE_FSEEKO)
|
||||||
|
if(NOT HAVE_FSEEKO)
|
||||||
|
add_definitions(-DNO_FSEEKO)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check for unistd.h
|
||||||
|
#
|
||||||
|
check_include_file(unistd.h Z_HAVE_UNISTD_H)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||||
|
# If we're doing an out of source build and the user has a zconf.h
|
||||||
|
# in their source tree...
|
||||||
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
|
||||||
|
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
|
||||||
|
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
|
||||||
|
${ZLIB_PC} @ONLY)
|
||||||
|
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
#============================================================================
|
||||||
|
# zlib
|
||||||
|
#============================================================================
|
||||||
|
|
||||||
|
set(ZLIB_PUBLIC_HDRS
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
|
||||||
|
zlib.h
|
||||||
|
)
|
||||||
|
set(ZLIB_PRIVATE_HDRS
|
||||||
|
crc32.h
|
||||||
|
deflate.h
|
||||||
|
gzguts.h
|
||||||
|
inffast.h
|
||||||
|
inffixed.h
|
||||||
|
inflate.h
|
||||||
|
inftrees.h
|
||||||
|
trees.h
|
||||||
|
zutil.h
|
||||||
|
)
|
||||||
|
set(ZLIB_SRCS
|
||||||
|
adler32.c
|
||||||
|
compress.c
|
||||||
|
crc32.c
|
||||||
|
deflate.c
|
||||||
|
gzclose.c
|
||||||
|
gzlib.c
|
||||||
|
gzread.c
|
||||||
|
gzwrite.c
|
||||||
|
inflate.c
|
||||||
|
infback.c
|
||||||
|
inftrees.c
|
||||||
|
inffast.c
|
||||||
|
trees.c
|
||||||
|
uncompr.c
|
||||||
|
zutil.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT MINGW)
|
||||||
|
set(ZLIB_DLL_SRCS
|
||||||
|
win32/zlib1.rc # If present will override custom build rule below.
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
if(ASM686)
|
||||||
|
set(ZLIB_ASMS contrib/asm686/match.S)
|
||||||
|
elseif (AMD64)
|
||||||
|
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(ZLIB_ASMS)
|
||||||
|
add_definitions(-DASMV)
|
||||||
|
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
if(ASM686)
|
||||||
|
ENABLE_LANGUAGE(ASM_MASM)
|
||||||
|
set(ZLIB_ASMS
|
||||||
|
contrib/masmx86/inffas32.asm
|
||||||
|
contrib/masmx86/match686.asm
|
||||||
|
)
|
||||||
|
elseif (AMD64)
|
||||||
|
ENABLE_LANGUAGE(ASM_MASM)
|
||||||
|
set(ZLIB_ASMS
|
||||||
|
contrib/masmx64/gvmat64.asm
|
||||||
|
contrib/masmx64/inffasx64.asm
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ZLIB_ASMS)
|
||||||
|
add_definitions(-DASMV -DASMINF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
|
||||||
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
|
||||||
|
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
|
||||||
|
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
# This gets us DLL resource information when compiling on MinGW.
|
||||||
|
if(NOT CMAKE_RC_COMPILER)
|
||||||
|
set(CMAKE_RC_COMPILER windres.exe)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
||||||
|
COMMAND ${CMAKE_RC_COMPILER}
|
||||||
|
-D GCC_WINDRES
|
||||||
|
-I ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
-I ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
||||||
|
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
|
||||||
|
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
||||||
|
endif(MINGW)
|
||||||
|
|
||||||
|
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
# On unix-like platforms the library is almost always called libz
|
||||||
|
set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z)
|
||||||
|
endif()
|
||||||
@ -63,11 +63,6 @@
|
|||||||
"name": "ENABLE_TESTING",
|
"name": "ENABLE_TESTING",
|
||||||
"value": "True",
|
"value": "True",
|
||||||
"type": "BOOL"
|
"type": "BOOL"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "BUILD_LAMMPS_GUI",
|
|
||||||
"value": "False",
|
|
||||||
"type": "BOOL"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -77,7 +72,7 @@
|
|||||||
"configurationType": "Debug",
|
"configurationType": "Debug",
|
||||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe -DBUILD_MPI=off",
|
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
||||||
"buildCommandArgs": "",
|
"buildCommandArgs": "",
|
||||||
"ctestCommandArgs": "",
|
"ctestCommandArgs": "",
|
||||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||||
@ -110,7 +105,7 @@
|
|||||||
"configurationType": "Release",
|
"configurationType": "Release",
|
||||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe -DBUILD_MPI=off",
|
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
||||||
"buildCommandArgs": "",
|
"buildCommandArgs": "",
|
||||||
"ctestCommandArgs": "-V",
|
"ctestCommandArgs": "-V",
|
||||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||||
@ -308,54 +303,6 @@
|
|||||||
"type": "STRING"
|
"type": "STRING"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "x64-GUI-MSVC",
|
|
||||||
"generator": "Ninja",
|
|
||||||
"configurationType": "Release",
|
|
||||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
|
||||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
|
||||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -D QT_DIR=C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5 -D Qt5_DIR=C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5",
|
|
||||||
"buildCommandArgs": "",
|
|
||||||
"ctestCommandArgs": "-V",
|
|
||||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
|
||||||
"variables": [
|
|
||||||
{
|
|
||||||
"name": "BUILD_SHARED_LIBS",
|
|
||||||
"value": "True",
|
|
||||||
"type": "BOOL"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "BUILD_TOOLS",
|
|
||||||
"value": "True",
|
|
||||||
"type": "BOOL"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "LAMMPS_EXCEPTIONS",
|
|
||||||
"value": "True",
|
|
||||||
"type": "BOOL"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ENABLE_TESTING",
|
|
||||||
"value": "False",
|
|
||||||
"type": "BOOL"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "BUILD_MPI",
|
|
||||||
"value": "False",
|
|
||||||
"type": "BOOL"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "WITH_PNG",
|
|
||||||
"value": "False",
|
|
||||||
"type": "BOOL"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "BUILD_LAMMPS_GUI",
|
|
||||||
"value": "True",
|
|
||||||
"type": "BOOL"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
# use default (or custom) Python executable, if version is sufficient
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
if(Python_VERSION VERSION_GREATER_EQUAL 3.6)
|
find_package(PythonInterp 3.5 QUIET) # Deprecated since version 3.12
|
||||||
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
if(PYTHONINTERP_FOUND)
|
||||||
|
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
set(Python3_VERSION ${PYTHON_VERSION_STRING})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(Python3 COMPONENTS Interpreter QUIET)
|
||||||
endif()
|
endif()
|
||||||
find_package(Python3 COMPONENTS Interpreter)
|
|
||||||
|
|
||||||
if(Python3_EXECUTABLE)
|
if(Python3_EXECUTABLE)
|
||||||
if(Python3_VERSION VERSION_GREATER_EQUAL 3.6)
|
if(Python3_VERSION VERSION_GREATER_EQUAL 3.5)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
check-whitespace
|
check-whitespace
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
if(NOT DEFINED ROCM_PATH)
|
|
||||||
if(NOT DEFINED ENV{ROCM_PATH})
|
|
||||||
set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to ROCm installation")
|
|
||||||
else()
|
|
||||||
set(ROCM_PATH $ENV{ROCM_PATH} CACHE PATH "Path to ROCm installation")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH})
|
|
||||||
@ -4,19 +4,21 @@
|
|||||||
option(BUILD_DOC "Build LAMMPS HTML documentation" OFF)
|
option(BUILD_DOC "Build LAMMPS HTML documentation" OFF)
|
||||||
|
|
||||||
if(BUILD_DOC)
|
if(BUILD_DOC)
|
||||||
# Current Sphinx versions require at least Python 3.8
|
# Sphinx 3.x requires at least Python 3.5
|
||||||
# use default (or custom) Python executable, if version is sufficient
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
if(Python_VERSION VERSION_GREATER_EQUAL 3.8)
|
find_package(PythonInterp 3.5 REQUIRED)
|
||||||
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv)
|
||||||
|
else()
|
||||||
|
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||||
|
if(Python3_VERSION VERSION_LESS 3.5)
|
||||||
|
message(FATAL_ERROR "Python 3.5 and up is required to build the HTML documentation")
|
||||||
|
endif()
|
||||||
|
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
||||||
endif()
|
endif()
|
||||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
|
||||||
if(Python3_VERSION VERSION_LESS 3.8)
|
|
||||||
message(FATAL_ERROR "Python 3.8 and up is required to build the HTML documentation")
|
|
||||||
endif()
|
|
||||||
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
|
||||||
|
|
||||||
find_package(Doxygen 1.8.10 REQUIRED)
|
find_package(Doxygen 1.8.10 REQUIRED)
|
||||||
file(GLOB DOC_SOURCES CONFIGURE_DEPENDS ${LAMMPS_DOC_DIR}/src/[^.]*.rst)
|
|
||||||
|
file(GLOB DOC_SOURCES ${LAMMPS_DOC_DIR}/src/[^.]*.rst)
|
||||||
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT docenv
|
OUTPUT docenv
|
||||||
@ -54,27 +56,16 @@ if(BUILD_DOC)
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
|
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
|
||||||
set(MATHJAX_MD5 "b81661c6e6ba06278e6ae37b30b0c492" CACHE STRING "MD5 checksum of MathJax tarball")
|
set(MATHJAX_MD5 "d1c98c746888bfd52ca8ebc10704f92f" CACHE STRING "MD5 checksum of MathJax tarball")
|
||||||
mark_as_advanced(MATHJAX_URL)
|
mark_as_advanced(MATHJAX_URL)
|
||||||
GetFallbackURL(MATHJAX_URL MATHJAX_FALLBACK)
|
|
||||||
|
|
||||||
# download mathjax distribution and unpack to folder "mathjax"
|
# download mathjax distribution and unpack to folder "mathjax"
|
||||||
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
|
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
|
||||||
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz)
|
file(DOWNLOAD ${MATHJAX_URL}
|
||||||
file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz)
|
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz"
|
||||||
endif()
|
EXPECTED_MD5 ${MATHJAX_MD5})
|
||||||
if(NOT "${DL_MD5}" STREQUAL "${MATHJAX_MD5}")
|
|
||||||
file(DOWNLOAD ${MATHJAX_URL} "${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz" STATUS DL_STATUS SHOW_PROGRESS)
|
|
||||||
file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz DL_MD5)
|
|
||||||
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${MATHJAX_MD5}"))
|
|
||||||
message(WARNING "Download from primary URL ${MATHJAX_URL} failed\nTrying fallback URL ${MATHJAX_FALLBACK}")
|
|
||||||
file(DOWNLOAD ${MATHJAX_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${MATHJAX_MD5} SHOW_PROGRESS)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
|
||||||
endif()
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
file(GLOB MATHJAX_VERSION_DIR CONFIGURE_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
file(GLOB MATHJAX_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)
|
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -9,22 +9,8 @@ function(ExternalCMakeProject target url hash basedir cmakedir cmakefile)
|
|||||||
|
|
||||||
get_filename_component(archive ${url} NAME)
|
get_filename_component(archive ${url} NAME)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||||
if(EXISTS ${CMAKE_BINARY_DIR}/_deps/${archive})
|
message(STATUS "Downloading ${url}")
|
||||||
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
|
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
|
||||||
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}")
|
message(STATUS "Unpacking and configuring ${archive}")
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive}
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||||
@ -43,5 +29,5 @@ function(ExternalCMakeProject target url hash basedir cmakedir cmakefile)
|
|||||||
"${CMAKE_BINARY_DIR}/_deps/${target}-src/${cmakedir}/CMakeLists.txt")
|
"${CMAKE_BINARY_DIR}/_deps/${target}-src/${cmakedir}/CMakeLists.txt")
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory("${CMAKE_BINARY_DIR}/_deps/${target}-src/${cmakedir}"
|
add_subdirectory("${CMAKE_BINARY_DIR}/_deps/${target}-src/${cmakedir}"
|
||||||
"${CMAKE_BINARY_DIR}/_deps/${target}-build" EXCLUDE_FROM_ALL)
|
"${CMAKE_BINARY_DIR}/_deps/${target}-build")
|
||||||
endfunction(ExternalCMakeProject)
|
endfunction(ExternalCMakeProject)
|
||||||
|
|||||||
@ -1,12 +1,5 @@
|
|||||||
# Find clang-format
|
# Find clang-format
|
||||||
find_program(ClangFormat_EXECUTABLE NAMES clang-format
|
find_program(ClangFormat_EXECUTABLE NAMES clang-format
|
||||||
clang-format-17.0
|
|
||||||
clang-format-16.0
|
|
||||||
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-10.0
|
||||||
clang-format-9.0
|
clang-format-9.0
|
||||||
clang-format-8.0
|
clang-format-8.0
|
||||||
@ -21,33 +14,19 @@ if(ClangFormat_EXECUTABLE)
|
|||||||
OUTPUT_VARIABLE clang_format_version
|
OUTPUT_VARIABLE clang_format_version
|
||||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
if(clang_format_version MATCHES "^(Ubuntu |Debian |)clang-format version .*")
|
|
||||||
# Arch Linux output:
|
if(clang_format_version MATCHES "^clang-format version .*")
|
||||||
|
# Arch Linux
|
||||||
# clang-format version 10.0.0
|
# 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)
|
# clang-format version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
|
||||||
#
|
string(REGEX REPLACE "clang-format version ([0-9.]+).*"
|
||||||
# Ubuntu 20.04 LTS output:
|
"\\1"
|
||||||
# clang-format version 10.0.0-4ubuntu1
|
|
||||||
#
|
|
||||||
# Ubuntu 22.04 LTS output:
|
|
||||||
# Ubuntu clang-format version 14.0.0-1ubuntu1
|
|
||||||
#
|
|
||||||
# Debian 11 output:
|
|
||||||
# Debian clang-format version 11.0.1-2
|
|
||||||
#
|
|
||||||
# Debian 12 output:
|
|
||||||
# Debian clang-format version 14.0.6
|
|
||||||
#
|
|
||||||
# Fedora 36 output:
|
|
||||||
# clang-format version 14.0.5 (Fedora 14.0.5-1.fc36)
|
|
||||||
string(REGEX REPLACE "^(Ubuntu |Debian |)clang-format version ([0-9.]+).*"
|
|
||||||
"\\2"
|
|
||||||
ClangFormat_VERSION
|
ClangFormat_VERSION
|
||||||
"${clang_format_version}")
|
"${clang_format_version}")
|
||||||
elseif(clang_format_version MATCHES ".*LLVM version .*")
|
elseif(clang_format_version MATCHES ".*LLVM version .*")
|
||||||
# CentOS 7 output:
|
# CentOS 7 Output
|
||||||
# LLVM (http://llvm.org/):
|
# LLVM (http://llvm.org/):
|
||||||
# LLVM version 3.4.2
|
# LLVM version 3.4.2
|
||||||
# Optimized build.
|
# Optimized build.
|
||||||
|
|||||||
@ -7,7 +7,15 @@
|
|||||||
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
|
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
find_package(Python 3.6 COMPONENTS Interpreter QUIET)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
||||||
|
find_package(PythonInterp 3.6 QUIET) # Deprecated since version 3.12
|
||||||
|
if(PYTHONINTERP_FOUND)
|
||||||
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(Python 3.6 COMPONENTS Interpreter QUIET)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Use the Cython executable that lives next to the Python executable
|
# Use the Cython executable that lives next to the Python executable
|
||||||
# if it is a local installation.
|
# if it is a local installation.
|
||||||
|
|||||||
19
cmake/Modules/FindZMQ.cmake
Normal file
19
cmake/Modules/FindZMQ.cmake
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
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()
|
||||||
@ -28,8 +28,9 @@ if(MSVC)
|
|||||||
add_compile_options(/Zc:__cplusplus)
|
add_compile_options(/Zc:__cplusplus)
|
||||||
add_compile_options(/wd4244)
|
add_compile_options(/wd4244)
|
||||||
add_compile_options(/wd4267)
|
add_compile_options(/wd4267)
|
||||||
add_compile_options(/wd4250)
|
if(LAMMPS_EXCEPTIONS)
|
||||||
add_compile_options(/EHsc)
|
add_compile_options(/EHsc)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
@ -64,7 +65,7 @@ endfunction(validate_option)
|
|||||||
|
|
||||||
# helper function for getting the most recently modified file or folder from a glob pattern
|
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||||
function(get_newest_file path variable)
|
function(get_newest_file path variable)
|
||||||
file(GLOB _dirs CONFIGURE_DEPENDS ${path})
|
file(GLOB _dirs ${path})
|
||||||
set(_besttime 2000-01-01T00:00:00)
|
set(_besttime 2000-01-01T00:00:00)
|
||||||
set(_bestfile "<unknown>")
|
set(_bestfile "<unknown>")
|
||||||
foreach(_dir ${_dirs})
|
foreach(_dir ${_dirs})
|
||||||
@ -87,18 +88,6 @@ function(get_lammps_version version_header variable)
|
|||||||
set(${variable} "${date}" PARENT_SCOPE)
|
set(${variable} "${date}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# determine canonical URL for downloading backup copy from download.lammps.org/thirdparty
|
|
||||||
function(GetFallbackURL input output)
|
|
||||||
string(REPLACE "_URL" "" _tmp ${input})
|
|
||||||
string(TOLOWER ${_tmp} libname)
|
|
||||||
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
|
|
||||||
if ("${newurl}" STREQUAL "${${input}}")
|
|
||||||
set(${output} "" PARENT_SCOPE)
|
|
||||||
else()
|
|
||||||
set(${output} ${newurl} PARENT_SCOPE)
|
|
||||||
endif()
|
|
||||||
endfunction(GetFallbackURL)
|
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
# LAMMPS C++ interface. We only need the header related parts except on windows.
|
# LAMMPS C++ interface. We only need the header related parts except on windows.
|
||||||
add_library(lammps INTERFACE)
|
add_library(lammps INTERFACE)
|
||||||
@ -123,76 +112,45 @@ if(BUILD_MPI)
|
|||||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||||
# We use a non-standard procedure to cross-compile with MPI on Windows
|
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||||
# Download and configure MinGW compatible MPICH development files for Windows
|
# Download and configure custom MPICH files for Windows
|
||||||
option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF)
|
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
||||||
if(USE_MSMPI)
|
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||||
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
|
||||||
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 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||||
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (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_WIN64_DEVEL_URL)
|
||||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
mark_as_advanced(MPICH2_WIN32_DEVEL_URL)
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||||
|
mark_as_advanced(MPICH2_WIN32_DEVEL_MD5)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
ExternalProject_Add(mpi4win_build
|
ExternalProject_Add(mpi4win_build
|
||||||
URL ${MPICH2_WIN64_DEVEL_URL}
|
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||||
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.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()
|
else()
|
||||||
# Download and configure custom MPICH files for Windows
|
ExternalProject_Add(mpi4win_build
|
||||||
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||||
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||||
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()
|
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()
|
else()
|
||||||
find_package(MPI REQUIRED)
|
find_package(MPI REQUIRED)
|
||||||
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
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
|
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||||
function(get_newest_file path variable)
|
function(get_newest_file path variable)
|
||||||
file(GLOB _dirs CONFIGURE_DEPENDS ${path})
|
file(GLOB _dirs ${path})
|
||||||
set(_besttime 2000-01-01T00:00:00)
|
set(_besttime 2000-01-01T00:00:00)
|
||||||
set(_bestfile "<unknown>")
|
set(_bestfile "<unknown>")
|
||||||
foreach(_dir ${_dirs})
|
foreach(_dir ${_dirs})
|
||||||
@ -80,34 +80,27 @@ endfunction()
|
|||||||
|
|
||||||
function(check_for_autogen_files source_dir)
|
function(check_for_autogen_files source_dir)
|
||||||
message(STATUS "Running check for auto-generated files from make-based build system")
|
message(STATUS "Running check for auto-generated files from make-based build system")
|
||||||
file(GLOB SRC_AUTOGEN_FILES CONFIGURE_DEPENDS ${source_dir}/style_*.h)
|
file(GLOB SRC_AUTOGEN_FILES ${source_dir}/style_*.h)
|
||||||
file(GLOB SRC_AUTOGEN_PACKAGES CONFIGURE_DEPENDS ${source_dir}/packages_*.h)
|
file(GLOB SRC_AUTOGEN_PACKAGES ${source_dir}/packages_*.h)
|
||||||
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h)
|
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h)
|
||||||
list(APPEND SRC_AUTOGEN_FILES ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
|
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
|
||||||
foreach(_SRC ${SRC_AUTOGEN_FILES})
|
foreach(_SRC ${SRC_AUTOGEN_FILES})
|
||||||
get_filename_component(FILENAME "${_SRC}" NAME)
|
get_filename_component(FILENAME "${_SRC}" NAME)
|
||||||
if(EXISTS ${source_dir}/${FILENAME})
|
if(EXISTS ${source_dir}/${FILENAME})
|
||||||
message(FATAL_ERROR "\n########################################################################\n"
|
message(FATAL_ERROR "\n########################################################################\n"
|
||||||
"Found header file ${source_dir}/${FILENAME} generated by the make-based build system\n"
|
"Found header file(s) generated by the make-based build system\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Please run\n"
|
"Please run\n"
|
||||||
"make -C ${source_dir} purge\n"
|
"make -C ${source_dir} purge\n"
|
||||||
"to remove\n"
|
"to remove\n"
|
||||||
"########################################################################")
|
"########################################################################")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
macro(pkg_depends PKG1 PKG2)
|
macro(pkg_depends PKG1 PKG2)
|
||||||
if(DEFINED BUILD_${PKG2})
|
if(PKG_${PKG1} AND NOT (PKG_${PKG2} OR BUILD_${PKG2}))
|
||||||
if(PKG_${PKG1} AND NOT 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 -D BUILD_${PKG2}=ON")
|
|
||||||
endif()
|
|
||||||
elseif(DEFINED PKG_${PKG2})
|
|
||||||
if(PKG_${PKG1} AND NOT PKG_${PKG2})
|
|
||||||
message(WARNING "The ${PKG1} package depends on the ${PKG2} package. Enabling it.")
|
|
||||||
set(PKG_${PKG2} ON CACHE BOOL "" FORCE)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
@ -125,48 +118,34 @@ endfunction(GenerateBinaryHeader)
|
|||||||
|
|
||||||
# fetch missing potential files
|
# fetch missing potential files
|
||||||
function(FetchPotentials pkgfolder potfolder)
|
function(FetchPotentials pkgfolder potfolder)
|
||||||
if(DOWNLOAD_POTENTIALS)
|
if(EXISTS "${pkgfolder}/potentials.txt")
|
||||||
if(EXISTS "${pkgfolder}/potentials.txt")
|
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
|
||||||
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
|
foreach(line ${linelist})
|
||||||
foreach(line ${linelist})
|
string(FIND ${line} " " blank)
|
||||||
string(FIND ${line} " " blank)
|
math(EXPR plusone "${blank}+1")
|
||||||
math(EXPR plusone "${blank}+1")
|
string(SUBSTRING ${line} 0 ${blank} pot)
|
||||||
string(SUBSTRING ${line} 0 ${blank} pot)
|
string(SUBSTRING ${line} ${plusone} -1 sum)
|
||||||
string(SUBSTRING ${line} ${plusone} -1 sum)
|
if(EXISTS "${LAMMPS_POTENTIALS_DIR}/${pot}")
|
||||||
if(EXISTS "${LAMMPS_POTENTIALS_DIR}/${pot}")
|
file(MD5 "${LAMMPS_POTENTIALS_DIR}/${pot}" oldsum)
|
||||||
file(MD5 "${LAMMPS_POTENTIALS_DIR}/${pot}" oldsum)
|
endif()
|
||||||
endif()
|
if(NOT sum STREQUAL oldsum)
|
||||||
if(NOT sum STREQUAL oldsum)
|
message(STATUS "Downloading external potential ${pot} from ${LAMMPS_POTENTIALS_URL}")
|
||||||
message(STATUS "Downloading external potential ${pot} from ${LAMMPS_POTENTIALS_URL}")
|
string(MD5 TMP_EXT "${CMAKE_BINARY_DIR}")
|
||||||
string(RANDOM LENGTH 10 TMP_EXT)
|
file(DOWNLOAD "${LAMMPS_POTENTIALS_URL}/${pot}.${sum}" "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}"
|
||||||
file(DOWNLOAD "${LAMMPS_POTENTIALS_URL}/${pot}.${sum}" "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}"
|
EXPECTED_HASH MD5=${sum} SHOW_PROGRESS)
|
||||||
EXPECTED_HASH MD5=${sum} SHOW_PROGRESS)
|
file(COPY "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}" DESTINATION "${LAMMPS_POTENTIALS_DIR}")
|
||||||
file(COPY "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}" DESTINATION "${LAMMPS_POTENTIALS_DIR}")
|
file(RENAME "${LAMMPS_POTENTIALS_DIR}/${pot}.${TMP_EXT}" "${LAMMPS_POTENTIALS_DIR}/${pot}")
|
||||||
file(RENAME "${LAMMPS_POTENTIALS_DIR}/${pot}.${TMP_EXT}" "${LAMMPS_POTENTIALS_DIR}/${pot}")
|
endif()
|
||||||
endif()
|
endforeach()
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
endfunction(FetchPotentials)
|
endfunction(FetchPotentials)
|
||||||
|
|
||||||
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
|
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
|
||||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
|
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
|
||||||
file(STRINGS /etc/os-release distro REGEX "^NAME=")
|
file(STRINGS /etc/os-release distro REGEX "^NAME=")
|
||||||
string(REGEX REPLACE "NAME=\"?([^ ]+).*\"?" "\\1" distro "${distro}")
|
string(REGEX REPLACE "NAME=\"?([^\"]*)\"?" "\\1" distro "${distro}")
|
||||||
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
|
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
|
||||||
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
|
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
|
||||||
set(CMAKE_LINUX_DISTRO ${distro})
|
set(CMAKE_LINUX_DISTRO ${distro})
|
||||||
set(CMAKE_DISTRO_VERSION ${disversion})
|
set(CMAKE_DISTRO_VERSION ${disversion})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# determine canonical URL for downloading backup copy from download.lammps.org/thirdparty
|
|
||||||
function(GetFallbackURL input output)
|
|
||||||
string(REPLACE "_URL" "" _tmp ${input})
|
|
||||||
string(TOLOWER ${_tmp} libname)
|
|
||||||
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
|
|
||||||
if ("${newurl}" STREQUAL "${${input}}")
|
|
||||||
set(${output} "" PARENT_SCOPE)
|
|
||||||
else()
|
|
||||||
set(${output} ${newurl} PARENT_SCOPE)
|
|
||||||
endif()
|
|
||||||
endfunction(GetFallbackURL)
|
|
||||||
|
|||||||
@ -1,74 +1,39 @@
|
|||||||
# Download and configure MinGW compatible MPICH development files for Windows
|
# Download and configure custom MPICH files for Windows
|
||||||
option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF)
|
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)
|
||||||
|
|
||||||
if(USE_MSMPI)
|
include(ExternalProject)
|
||||||
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
ExternalProject_Add(mpi4win_build
|
||||||
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||||
mark_as_advanced(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()
|
else()
|
||||||
message(STATUS "Downloading and configuring MPICH2-1.4.1 for Windows cross-compilation")
|
ExternalProject_Add(mpi4win_build
|
||||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||||
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
|
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||||
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball")
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||||
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()
|
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 @@
|
|||||||
message(STATUS "Downloading and building OpenCL loader library")
|
message(STATUS "Downloading and building OpenCL loader library")
|
||||||
set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2024.02.09.tar.gz" CACHE STRING "URL for OpenCL loader tarball")
|
set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2022.01.04.tar.gz" CACHE STRING "URL for OpenCL loader tarball")
|
||||||
set(OPENCL_LOADER_MD5 "f3573cf9daa3558ba46fd5866517f38f" CACHE STRING "MD5 checksum of OpenCL loader tarball")
|
set(OPENCL_LOADER_MD5 "8d3a801e87a2c6653bf0e27707063914" CACHE STRING "MD5 checksum of OpenCL loader tarball")
|
||||||
mark_as_advanced(OPENCL_LOADER_URL)
|
mark_as_advanced(OPENCL_LOADER_URL)
|
||||||
mark_as_advanced(OPENCL_LOADER_MD5)
|
mark_as_advanced(OPENCL_LOADER_MD5)
|
||||||
|
|
||||||
@ -8,3 +8,4 @@ set(INSTALL_LIBOPENCL OFF CACHE BOOL "" FORCE)
|
|||||||
include(ExternalCMakeProject)
|
include(ExternalCMakeProject)
|
||||||
ExternalCMakeProject(opencl_loader ${OPENCL_LOADER_URL} ${OPENCL_LOADER_MD5} opencl-loader . "")
|
ExternalCMakeProject(opencl_loader ${OPENCL_LOADER_URL} ${OPENCL_LOADER_MD5} opencl-loader . "")
|
||||||
|
|
||||||
|
add_library(OpenCL::OpenCL ALIAS OpenCL)
|
||||||
|
|||||||
@ -1,15 +1,20 @@
|
|||||||
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||||
|
|
||||||
file(GLOB COLVARS_SOURCES CONFIGURE_DEPENDS ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
||||||
|
|
||||||
option(COLVARS_DEBUG "Enable debugging messages for Colvars (quite verbose)" OFF)
|
option(COLVARS_DEBUG "Debugging messages for Colvars (quite verbose)" OFF)
|
||||||
|
|
||||||
option(COLVARS_LEPTON "Use the Lepton library for custom expressions" ON)
|
# Build Lepton by default
|
||||||
|
option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
||||||
|
|
||||||
if(COLVARS_LEPTON)
|
if(COLVARS_LEPTON)
|
||||||
if(NOT LEPTON_SOURCE_DIR)
|
set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton)
|
||||||
include(Packages/LEPTON)
|
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp)
|
||||||
endif()
|
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)
|
||||||
|
set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE})
|
||||||
|
target_include_directories(lepton PRIVATE ${LEPTON_DIR}/include)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(colvars STATIC ${COLVARS_SOURCES})
|
add_library(colvars STATIC ${COLVARS_SOURCES})
|
||||||
@ -25,11 +30,14 @@ target_include_directories(colvars PRIVATE ${LAMMPS_SOURCE_DIR})
|
|||||||
target_link_libraries(lammps PRIVATE colvars)
|
target_link_libraries(lammps PRIVATE colvars)
|
||||||
|
|
||||||
if(COLVARS_DEBUG)
|
if(COLVARS_DEBUG)
|
||||||
# Need to export the define publicly to be valid in interface code
|
# Need to export the macro publicly to also affect the proxy
|
||||||
target_compile_definitions(colvars PUBLIC -DCOLVARS_DEBUG)
|
target_compile_definitions(colvars PUBLIC -DCOLVARS_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(COLVARS_LEPTON)
|
if(COLVARS_LEPTON)
|
||||||
|
target_link_libraries(lammps PRIVATE lepton)
|
||||||
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
||||||
target_link_libraries(colvars PUBLIC lepton)
|
# Disable the line below when linking Lepton as a DLL with MSVC
|
||||||
|
target_compile_definitions(colvars PRIVATE -DLEPTON_USE_STATIC_LIBRARIES)
|
||||||
|
target_include_directories(colvars PUBLIC ${LEPTON_DIR}/include)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
find_package(ZLIB)
|
find_package(ZLIB REQUIRED)
|
||||||
if(NOT ZLIB_FOUND)
|
|
||||||
message(WARNING "No Zlib development support found. Disabling COMPRESS package...")
|
|
||||||
set(PKG_COMPRESS OFF CACHE BOOL "" FORCE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
|
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
|
||||||
|
|
||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
|
|
||||||
# Silence CMake warnings about FindCUDA being obsolete.
|
|
||||||
# We may need to eventually rewrite this section to use enable_language(CUDA)
|
|
||||||
if(POLICY CMP0146)
|
|
||||||
cmake_policy(SET CMP0146 OLD)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU)
|
set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU)
|
||||||
set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h
|
set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h
|
||||||
${GPU_SOURCES_DIR}/fix_gpu.h
|
${GPU_SOURCES_DIR}/fix_gpu.h
|
||||||
@ -33,20 +26,7 @@ elseif(GPU_PREC STREQUAL "SINGLE")
|
|||||||
set(GPU_PREC_SETTING "SINGLE_SINGLE")
|
set(GPU_PREC_SETTING "SINGLE_SINGLE")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(GPU_DEBUG "Enable debugging code of the GPU package" OFF)
|
file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
||||||
mark_as_advanced(GPU_DEBUG)
|
|
||||||
|
|
||||||
if(PKG_AMOEBA AND FFT_SINGLE)
|
|
||||||
message(FATAL_ERROR "GPU acceleration of AMOEBA is not (yet) compatible with single precision FFT")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (PKG_AMOEBA)
|
|
||||||
list(APPEND GPU_SOURCES
|
|
||||||
${GPU_SOURCES_DIR}/amoeba_convolution_gpu.h
|
|
||||||
${GPU_SOURCES_DIR}/amoeba_convolution_gpu.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(GLOB GPU_LIB_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
|
||||||
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
|
|
||||||
if(GPU_API STREQUAL "CUDA")
|
if(GPU_API STREQUAL "CUDA")
|
||||||
@ -67,17 +47,15 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF)
|
option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF)
|
||||||
if(CUDA_MPS_SUPPORT)
|
if(CUDA_MPS_SUPPORT)
|
||||||
if(CUDPP_OPT)
|
if(CUDPP_OPT)
|
||||||
message(FATAL_ERROR "Must use -DCUDPP_OPT=OFF with -DCUDA_MPS_SUPPORT=ON")
|
message(FATAL_ERROR "Must use -DCUDPP_OPT=OFF with -DGPU_CUDA_MPS_SUPPORT=ON")
|
||||||
endif()
|
endif()
|
||||||
set(GPU_CUDA_MPS_FLAGS "-DCUDA_MPS_SUPPORT")
|
set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY")
|
||||||
endif()
|
endif()
|
||||||
option(CUDA_BUILD_MULTIARCH "Enable building CUDA kernels for all supported GPU architectures" ON)
|
|
||||||
mark_as_advanced(GPU_BUILD_MULTIARCH)
|
|
||||||
|
|
||||||
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
||||||
|
|
||||||
# ensure that no *cubin.h files exist from a compile in the lib/gpu folder
|
# ensure that no *cubin.h files exist from a compile in the lib/gpu folder
|
||||||
file(GLOB GPU_LIB_OLD_CUBIN_HEADERS CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h)
|
file(GLOB GPU_LIB_OLD_CUBIN_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h)
|
||||||
if(GPU_LIB_OLD_CUBIN_HEADERS)
|
if(GPU_LIB_OLD_CUBIN_HEADERS)
|
||||||
message(FATAL_ERROR "########################################################################\n"
|
message(FATAL_ERROR "########################################################################\n"
|
||||||
"Found file(s) generated by the make-based build system in lib/gpu\n"
|
"Found file(s) generated by the make-based build system in lib/gpu\n"
|
||||||
@ -87,81 +65,76 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
"########################################################################")
|
"########################################################################")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
file(GLOB GPU_LIB_CU ${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)
|
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)
|
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
|
|
||||||
if(CUDPP_OPT)
|
if(CUDPP_OPT)
|
||||||
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
||||||
file(GLOB GPU_LIB_CUDPP_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp)
|
file(GLOB GPU_LIB_CUDPP_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp)
|
||||||
file(GLOB GPU_LIB_CUDPP_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu)
|
file(GLOB GPU_LIB_CUDPP_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
# 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
|
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
||||||
set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}")
|
set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}")
|
||||||
|
|
||||||
if(CUDA_BUILD_MULTIARCH)
|
# apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0
|
||||||
# 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
|
||||||
# only the Kepler achitecture and beyond is supported
|
if(CUDA_VERSION VERSION_LESS 8.0)
|
||||||
# comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required")
|
||||||
if(CUDA_VERSION VERSION_LESS 8.0)
|
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||||
message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required")
|
message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk")
|
||||||
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "13.0")
|
set(GPU_CUDA_GENCODE "-arch=all")
|
||||||
message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk")
|
else()
|
||||||
set(GPU_CUDA_GENCODE "-arch=all")
|
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
||||||
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
||||||
set(GPU_CUDA_GENCODE "-arch=all")
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30] ")
|
||||||
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"))
|
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30] ")
|
|
||||||
endif()
|
|
||||||
# Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11
|
|
||||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0"))
|
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_35,code=[sm_35,compute_35]")
|
|
||||||
endif()
|
|
||||||
# Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later
|
|
||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "6.0")
|
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52]")
|
|
||||||
endif()
|
|
||||||
# Pascal (GPU Arch 6.x) is supported by CUDA 8 and later
|
|
||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0")
|
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61]")
|
|
||||||
endif()
|
|
||||||
# Volta (GPU Arch 7.0) is supported by CUDA 9 and later
|
|
||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0")
|
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_70,code=[sm_70,compute_70]")
|
|
||||||
endif()
|
|
||||||
# Turing (GPU Arch 7.5) is supported by CUDA 10 and later
|
|
||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0")
|
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_75,code=[sm_75,compute_75]")
|
|
||||||
endif()
|
|
||||||
# Ampere (GPU Arch 8.0) is supported by CUDA 11 and later
|
|
||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
|
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
|
|
||||||
endif()
|
|
||||||
# Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later
|
|
||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
|
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
|
|
||||||
endif()
|
|
||||||
# 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()
|
|
||||||
endif()
|
endif()
|
||||||
|
# Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11
|
||||||
|
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0"))
|
||||||
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_35,code=[sm_35,compute_35]")
|
||||||
|
endif()
|
||||||
|
# Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "6.0")
|
||||||
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52]")
|
||||||
|
endif()
|
||||||
|
# Pascal (GPU Arch 6.x) is supported by CUDA 8 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0")
|
||||||
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61]")
|
||||||
|
endif()
|
||||||
|
# Volta (GPU Arch 7.0) is supported by CUDA 9 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0")
|
||||||
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_70,code=[sm_70,compute_70]")
|
||||||
|
endif()
|
||||||
|
# Turing (GPU Arch 7.5) is supported by CUDA 10 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0")
|
||||||
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_75,code=[sm_75,compute_75]")
|
||||||
|
endif()
|
||||||
|
# Ampere (GPU Arch 8.0) is supported by CUDA 11 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
|
||||||
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
|
||||||
|
endif()
|
||||||
|
# Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
|
||||||
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
|
||||||
|
endif()
|
||||||
|
# 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()
|
endif()
|
||||||
|
|
||||||
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -allow-unsupported-compiler -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
||||||
|
|
||||||
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -allow-unsupported-compiler -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
||||||
|
|
||||||
foreach(CU_OBJ ${GPU_GEN_OBJS})
|
foreach(CU_OBJ ${GPU_GEN_OBJS})
|
||||||
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
|
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
|
||||||
@ -177,17 +150,14 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
||||||
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} ${GPU_CUDA_MPS_FLAGS})
|
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
||||||
if(GPU_DEBUG)
|
|
||||||
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
|
||||||
else()
|
|
||||||
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DUCL_NO_EXIT)
|
|
||||||
endif()
|
|
||||||
if(CUDPP_OPT)
|
if(CUDPP_OPT)
|
||||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(lammps PRIVATE gpu)
|
||||||
|
|
||||||
add_executable(nvc_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
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_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR)
|
||||||
target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
@ -212,7 +182,7 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
include(OpenCLUtils)
|
include(OpenCLUtils)
|
||||||
set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h)
|
set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h)
|
||||||
|
|
||||||
file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu)
|
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||||
list(REMOVE_ITEM GPU_LIB_CU
|
list(REMOVE_ITEM GPU_LIB_CU
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu
|
||||||
@ -221,7 +191,6 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo.cu
|
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(GPU_KERNEL ${GPU_LIB_CU})
|
foreach(GPU_KERNEL ${GPU_LIB_CU})
|
||||||
@ -238,7 +207,6 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
GenerateOpenCLHeader(tersoff ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu)
|
GenerateOpenCLHeader(tersoff ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu)
|
||||||
GenerateOpenCLHeader(tersoff_zbl ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu)
|
GenerateOpenCLHeader(tersoff_zbl ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu)
|
||||||
GenerateOpenCLHeader(tersoff_mod ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu)
|
GenerateOpenCLHeader(tersoff_mod ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu)
|
||||||
GenerateOpenCLHeader(hippo ${CMAKE_CURRENT_BINARY_DIR}/gpu/hippo_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo.cu)
|
|
||||||
|
|
||||||
list(APPEND GPU_LIB_SOURCES
|
list(APPEND GPU_LIB_SOURCES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/gayberne_cl.h
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/gayberne_cl.h
|
||||||
@ -248,26 +216,36 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/hippo_cl.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
||||||
target_link_libraries(gpu PRIVATE OpenCL::OpenCL)
|
target_link_libraries(gpu PRIVATE OpenCL::OpenCL)
|
||||||
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu)
|
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu)
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL -D_${GPU_PREC_SETTING})
|
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DGERYON_NUMA_FISSION -DUCL_NO_EXIT)
|
||||||
if(GPU_DEBUG)
|
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL)
|
||||||
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
|
||||||
else()
|
target_link_libraries(lammps PRIVATE gpu)
|
||||||
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)
|
add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||||
target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL)
|
target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL)
|
||||||
target_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL)
|
target_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL)
|
||||||
add_dependencies(ocl_get_devices OpenCL::OpenCL)
|
add_dependencies(ocl_get_devices OpenCL::OpenCL)
|
||||||
|
|
||||||
elseif(GPU_API STREQUAL "HIP")
|
elseif(GPU_API STREQUAL "HIP")
|
||||||
include(DetectHIPInstallation)
|
if(NOT DEFINED HIP_PATH)
|
||||||
|
if(NOT DEFINED ENV{HIP_PATH})
|
||||||
|
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to HIP installation")
|
||||||
|
else()
|
||||||
|
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to HIP installation")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED ROCM_PATH)
|
||||||
|
if(NOT DEFINED ENV{ROCM_PATH})
|
||||||
|
set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to ROCm installation")
|
||||||
|
else()
|
||||||
|
set(ROCM_PATH $ENV{ROCM_PATH} CACHE PATH "Path to ROCm installation")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
list(APPEND CMAKE_PREFIX_PATH ${HIP_PATH} ${ROCM_PATH})
|
||||||
find_package(hip REQUIRED)
|
find_package(hip REQUIRED)
|
||||||
option(HIP_USE_DEVICE_SORT "Use GPU sorting" ON)
|
option(HIP_USE_DEVICE_SORT "Use GPU sorting" ON)
|
||||||
|
|
||||||
@ -281,10 +259,8 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
|
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "amd")
|
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
||||||
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
||||||
elseif(HIP_PLATFORM STREQUAL "spirv")
|
|
||||||
set(HIP_ARCH "spirv" CACHE STRING "HIP target architecture")
|
|
||||||
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
find_package(CUDA REQUIRED)
|
find_package(CUDA REQUIRED)
|
||||||
set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)")
|
set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)")
|
||||||
@ -297,7 +273,6 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
else()
|
else()
|
||||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
# 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
|
# --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}")
|
set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}")
|
||||||
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
||||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
||||||
@ -327,22 +302,14 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
|
||||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
|
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
|
||||||
endif()
|
endif()
|
||||||
# Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later
|
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0? 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")
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
file(GLOB GPU_LIB_CU ${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)
|
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||||
|
|
||||||
set(GPU_LIB_CU_HIP "")
|
set(GPU_LIB_CU_HIP "")
|
||||||
@ -354,7 +321,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
|
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
|
||||||
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
|
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "amd")
|
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
||||||
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
||||||
|
|
||||||
if(HIP_COMPILER STREQUAL "clang")
|
if(HIP_COMPILER STREQUAL "clang")
|
||||||
@ -373,14 +340,7 @@ 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}
|
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE}
|
||||||
DEPENDS ${CU_FILE}
|
DEPENDS ${CU_FILE}
|
||||||
COMMENT "Generating ${CU_NAME}.cubin")
|
COMMENT "Generating ${CU_NAME}.cubin")
|
||||||
elseif(HIP_PLATFORM STREQUAL "spirv")
|
endif()
|
||||||
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}
|
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
|
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
|
||||||
@ -394,12 +354,8 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
||||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_HIP -D_${GPU_PREC_SETTING})
|
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT)
|
||||||
if(GPU_DEBUG)
|
target_compile_definitions(gpu PRIVATE -DUSE_HIP)
|
||||||
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
|
||||||
else()
|
|
||||||
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DUCL_NO_EXIT)
|
|
||||||
endif()
|
|
||||||
target_link_libraries(gpu PRIVATE hip::host)
|
target_link_libraries(gpu PRIVATE hip::host)
|
||||||
|
|
||||||
if(HIP_USE_DEVICE_SORT)
|
if(HIP_USE_DEVICE_SORT)
|
||||||
@ -408,8 +364,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
set_property(TARGET gpu PROPERTY CXX_STANDARD 14)
|
set_property(TARGET gpu PROPERTY CXX_STANDARD 14)
|
||||||
endif()
|
endif()
|
||||||
# add hipCUB
|
# add hipCUB
|
||||||
find_package(hipcub REQUIRED)
|
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
target_link_libraries(gpu PRIVATE hip::hipcub)
|
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT)
|
target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT)
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "nvcc")
|
if(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
@ -425,17 +380,15 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
if(DOWNLOAD_CUB)
|
if(DOWNLOAD_CUB)
|
||||||
message(STATUS "CUB download requested")
|
message(STATUS "CUB download requested")
|
||||||
# TODO: test update to current version 1.17.2
|
set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
||||||
set(CUB_URL "https://github.com/nvidia/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
|
||||||
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
|
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
|
||||||
mark_as_advanced(CUB_URL)
|
mark_as_advanced(CUB_URL)
|
||||||
mark_as_advanced(CUB_MD5)
|
mark_as_advanced(CUB_MD5)
|
||||||
GetFallbackURL(CUB_URL CUB_FALLBACK)
|
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
ExternalProject_Add(CUB
|
ExternalProject_Add(CUB
|
||||||
URL ${CUB_URL} ${CUB_FALLBACK}
|
URL ${CUB_URL}
|
||||||
URL_MD5 ${CUB_MD5}
|
URL_MD5 ${CUB_MD5}
|
||||||
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
@ -458,24 +411,34 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
add_executable(hip_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
add_executable(hip_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||||
target_compile_definitions(hip_get_devices PRIVATE -DUCL_HIP)
|
target_compile_definitions(hip_get_devices PRIVATE -DUCL_HIP)
|
||||||
target_link_libraries(hip_get_devices PRIVATE hip::host)
|
target_link_libraries(hip_get_devices hip::host)
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "nvcc")
|
if(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
|
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
|
||||||
|
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
target_include_directories(gpu PRIVATE ${CUDA_INCLUDE_DIRS})
|
target_include_directories(gpu PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||||
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
|
|
||||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_NVCC__)
|
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_NVCC__)
|
||||||
|
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/include)
|
||||||
target_include_directories(hip_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
target_include_directories(hip_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||||
target_link_libraries(hip_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(hip_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
endif()
|
elseif(HIP_PLATFORM STREQUAL "hcc")
|
||||||
endif()
|
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_HCC__)
|
||||||
|
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
|
||||||
if(BUILD_OMP)
|
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
|
||||||
find_package(OpenMP COMPONENTS CXX REQUIRED)
|
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
target_link_libraries(gpu PRIVATE OpenMP::OpenMP_CXX)
|
elseif(HIP_PLATFORM STREQUAL "amd")
|
||||||
|
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_AMD__)
|
||||||
|
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
|
||||||
|
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_AMD__)
|
||||||
|
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(lammps PRIVATE gpu)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(lammps PRIVATE gpu)
|
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}")
|
set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}")
|
||||||
# detect styles which have a GPU version
|
# detect styles which have a GPU version
|
||||||
|
|||||||
@ -112,5 +112,9 @@ if(PKG_KSPACE)
|
|||||||
RegisterIntegrateStyle(${INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
RegisterIntegrateStyle(${INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(PKG_ELECTRODE)
|
||||||
|
list(APPEND INTEL_SOURCES ${INTEL_SOURCES_DIR}/electrode_accel_intel.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_sources(lammps PRIVATE ${INTEL_SOURCES})
|
target_sources(lammps PRIVATE ${INTEL_SOURCES})
|
||||||
target_include_directories(lammps PRIVATE ${INTEL_SOURCES_DIR})
|
target_include_directories(lammps PRIVATE ${INTEL_SOURCES_DIR})
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
set(KIM-API_MIN_VERSION 2.1.3)
|
set(KIM-API_MIN_VERSION 2.1.3)
|
||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
if(CURL_FOUND)
|
if(CURL_FOUND)
|
||||||
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
target_include_directories(lammps PRIVATE ${CURL_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(lammps PRIVATE ${CURL_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
||||||
|
endif()
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
||||||
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
||||||
mark_as_advanced(LMP_DEBUG_CURL)
|
mark_as_advanced(LMP_DEBUG_CURL)
|
||||||
@ -14,7 +19,7 @@ if(CURL_FOUND)
|
|||||||
target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK)
|
target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
option(KIM_EXTRA_UNITTESTS "Enable extra unit tests for the KIM package." OFF)
|
set(KIM_EXTRA_UNITTESTS OFF CACHE STRING "Set extra unit tests verbose mode on/off. If on, extra tests are included.")
|
||||||
mark_as_advanced(KIM_EXTRA_UNITTESTS)
|
mark_as_advanced(KIM_EXTRA_UNITTESTS)
|
||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
set(DOWNLOAD_KIM_DEFAULT ON)
|
set(DOWNLOAD_KIM_DEFAULT ON)
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
########################################################################
|
########################################################################
|
||||||
# As of version 4.0.0 Kokkos requires C++17
|
# As of version 3.3.0 Kokkos requires C++14
|
||||||
if(CMAKE_CXX_STANDARD LESS 17)
|
if(CMAKE_CXX_STANDARD LESS 14)
|
||||||
message(FATAL_ERROR "The KOKKOS package requires the C++ standard to
|
message(FATAL_ERROR "The KOKKOS package requires the C++ standard to be set to at least C++14")
|
||||||
be set to at least C++17")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# consistency checks and Kokkos options/settings required by LAMMPS
|
# consistency checks and Kokkos options/settings required by LAMMPS
|
||||||
if(Kokkos_ENABLE_CUDA)
|
if(Kokkos_ENABLE_CUDA)
|
||||||
@ -16,6 +14,11 @@ endif()
|
|||||||
if(Kokkos_ENABLE_OPENMP)
|
if(Kokkos_ENABLE_OPENMP)
|
||||||
if(NOT BUILD_OMP)
|
if(NOT BUILD_OMP)
|
||||||
message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
|
message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
|
||||||
|
else()
|
||||||
|
# NVHPC does not seem to provide a detectable OpenMP version, but is far beyond version 3.1
|
||||||
|
if((OpenMP_CXX_VERSION VERSION_LESS 3.1) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC"))
|
||||||
|
message(FATAL_ERROR "Compiler must support OpenMP 3.1 or later with Kokkos_ENABLE_OPENMP")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
########################################################################
|
########################################################################
|
||||||
@ -45,14 +48,12 @@ if(DOWNLOAD_KOKKOS)
|
|||||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
|
||||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/4.2.00.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.6.01.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
||||||
set(KOKKOS_MD5 "731647b61a4233f568d583702e9cd6d1" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
set(KOKKOS_MD5 "0ec97fc0c356dd65bd2487defe81a7bf" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||||
mark_as_advanced(KOKKOS_URL)
|
mark_as_advanced(KOKKOS_URL)
|
||||||
mark_as_advanced(KOKKOS_MD5)
|
mark_as_advanced(KOKKOS_MD5)
|
||||||
GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK)
|
|
||||||
|
|
||||||
ExternalProject_Add(kokkos_build
|
ExternalProject_Add(kokkos_build
|
||||||
URL ${KOKKOS_URL} ${KOKKOS_FALLBACK}
|
URL ${KOKKOS_URL}
|
||||||
URL_MD5 ${KOKKOS_MD5}
|
URL_MD5 ${KOKKOS_MD5}
|
||||||
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
||||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a
|
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a
|
||||||
@ -68,11 +69,13 @@ if(DOWNLOAD_KOKKOS)
|
|||||||
set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES
|
set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES
|
||||||
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a")
|
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a")
|
||||||
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
||||||
|
target_link_libraries(lmp PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
||||||
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
|
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
|
||||||
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
|
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
|
||||||
elseif(EXTERNAL_KOKKOS)
|
elseif(EXTERNAL_KOKKOS)
|
||||||
find_package(Kokkos 4.2.00 REQUIRED CONFIG)
|
find_package(Kokkos 3.6.01 REQUIRED CONFIG)
|
||||||
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
||||||
|
target_link_libraries(lmp PRIVATE Kokkos::kokkos)
|
||||||
else()
|
else()
|
||||||
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
||||||
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
||||||
@ -84,7 +87,8 @@ else()
|
|||||||
if(CMAKE_REQUEST_PIC)
|
if(CMAKE_REQUEST_PIC)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR} EXCLUDE_FROM_ALL)
|
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||||
|
|
||||||
|
|
||||||
set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src
|
set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src
|
||||||
${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src
|
${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src
|
||||||
@ -92,6 +96,7 @@ else()
|
|||||||
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||||
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
|
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
|
||||||
target_link_libraries(lammps PRIVATE kokkos)
|
target_link_libraries(lammps PRIVATE kokkos)
|
||||||
|
target_link_libraries(lmp PRIVATE kokkos)
|
||||||
if(BUILD_SHARED_LIBS_WAS_ON)
|
if(BUILD_SHARED_LIBS_WAS_ON)
|
||||||
set(BUILD_SHARED_LIBS ON)
|
set(BUILD_SHARED_LIBS ON)
|
||||||
endif()
|
endif()
|
||||||
@ -117,69 +122,23 @@ set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp
|
|||||||
${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp)
|
${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp)
|
||||||
|
|
||||||
# fix wall/gran has been refactored in an incompatible way. Use old version of base class for now
|
|
||||||
if(PKG_GRANULAR)
|
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fix_wall_gran_old.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PKG_KSPACE)
|
if(PKG_KSPACE)
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fft3d_kokkos.cpp
|
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fft3d_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/grid3d_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
|
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
|
||||||
set(FFT_KOKKOS "KISS" CACHE STRING "FFT library for Kokkos-enabled KSPACE package")
|
|
||||||
set(FFT_KOKKOS_VALUES KISS FFTW3 MKL HIPFFT CUFFT)
|
|
||||||
set_property(CACHE FFT_KOKKOS PROPERTY STRINGS ${FFT_KOKKOS_VALUES})
|
|
||||||
validate_option(FFT_KOKKOS FFT_KOKKOS_VALUES)
|
|
||||||
string(TOUPPER ${FFT_KOKKOS} FFT_KOKKOS)
|
|
||||||
|
|
||||||
if(Kokkos_ENABLE_CUDA)
|
if(Kokkos_ENABLE_CUDA)
|
||||||
if(NOT ((FFT_KOKKOS STREQUAL "KISS") OR (FFT_KOKKOS STREQUAL "CUFFT")))
|
if(NOT (FFT STREQUAL "KISS"))
|
||||||
message(FATAL_ERROR "The CUDA backend of Kokkos requires either KISS FFT or CUFFT.")
|
target_compile_definitions(lammps PRIVATE -DFFT_CUFFT)
|
||||||
elseif(FFT_KOKKOS STREQUAL "KISS")
|
|
||||||
message(WARNING "Using KISS FFT with the CUDA backend of Kokkos may be sub-optimal.")
|
|
||||||
target_compile_definitions(lammps PRIVATE -DFFT_KOKKOS_KISS)
|
|
||||||
elseif(FFT_KOKKOS STREQUAL "CUFFT")
|
|
||||||
target_compile_definitions(lammps PRIVATE -DFFT_KOKKOS_CUFFT)
|
|
||||||
target_link_libraries(lammps PRIVATE cufft)
|
target_link_libraries(lammps PRIVATE cufft)
|
||||||
endif()
|
endif()
|
||||||
elseif(Kokkos_ENABLE_HIP)
|
elseif(Kokkos_ENABLE_HIP)
|
||||||
if(NOT ((FFT_KOKKOS STREQUAL "KISS") OR (FFT_KOKKOS STREQUAL "HIPFFT")))
|
if(NOT (FFT STREQUAL "KISS"))
|
||||||
message(FATAL_ERROR "The HIP backend of Kokkos requires either KISS FFT or HIPFFT.")
|
target_compile_definitions(lammps PRIVATE -DFFT_HIPFFT)
|
||||||
elseif(FFT_KOKKOS STREQUAL "KISS")
|
target_link_libraries(lammps PRIVATE hipfft)
|
||||||
message(WARNING "Using KISS FFT with the HIP backend of Kokkos may be sub-optimal.")
|
|
||||||
target_compile_definitions(lammps PRIVATE -DFFT_KOKKOS_KISS)
|
|
||||||
elseif(FFT_KOKKOS STREQUAL "HIPFFT")
|
|
||||||
include(DetectHIPInstallation)
|
|
||||||
find_package(hipfft REQUIRED)
|
|
||||||
target_compile_definitions(lammps PRIVATE -DFFT_KOKKOS_HIPFFT)
|
|
||||||
target_link_libraries(lammps PRIVATE hip::hipfft)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PKG_ML-IAP)
|
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/mliap_data_kokkos.cpp
|
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/mliap_descriptor_so3_kokkos.cpp
|
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/mliap_model_linear_kokkos.cpp
|
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/mliap_model_python_kokkos.cpp
|
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/mliap_unified_kokkos.cpp
|
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/mliap_so3_kokkos.cpp)
|
|
||||||
|
|
||||||
# Add KOKKOS version of ML-IAP Python coupling if non-KOKKOS version is included
|
|
||||||
if(MLIAP_ENABLE_PYTHON AND Cythonize_EXECUTABLE)
|
|
||||||
file(GLOB MLIAP_KOKKOS_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/KOKKOS/*.pyx)
|
|
||||||
foreach(MLIAP_CYTHON_FILE ${MLIAP_KOKKOS_CYTHON_SRC})
|
|
||||||
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE)
|
|
||||||
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_FILE} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
|
||||||
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
|
||||||
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
|
|
||||||
MAIN_DEPENDENCY ${MLIAP_CYTHON_FILE}
|
|
||||||
COMMENT "Generating C++ sources with cythonize...")
|
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PKG_PHONON)
|
if(PKG_PHONON)
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/dynamical_matrix_kokkos.cpp)
|
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/dynamical_matrix_kokkos.cpp)
|
||||||
|
|||||||
@ -46,61 +46,6 @@ else()
|
|||||||
target_compile_definitions(lammps PRIVATE -DFFT_KISS)
|
target_compile_definitions(lammps PRIVATE -DFFT_KISS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(FFT_USE_HEFFTE "Use heFFTe as the distributed FFT engine, overrides the FFT option." OFF)
|
|
||||||
if(FFT_USE_HEFFTE)
|
|
||||||
# if FFT_HEFFTE is enabled, use the heFFTe parallel engine instead of the builtin fftMPI engine
|
|
||||||
|
|
||||||
# map standard FFT choices to available heFFTe backends: FFTW3 -> FFTW, KISS -> BUILTIN
|
|
||||||
set(FFT_HEFFTE_BACKEND_VALUES FFTW MKL BUILTIN)
|
|
||||||
string(REPLACE FFTW3 FFTW FFT_HEFFTE_BACKEND_DEFAULT ${FFT})
|
|
||||||
string(REPLACE KISS BUILTIN FFT_HEFFTE_BACKEND_DEFAULT ${FFT_HEFFTE_BACKEND_DEFAULT})
|
|
||||||
set(FFT_HEFFTE_BACKEND "${FFT_HEFFTE_BACKEND_DEFAULT}" CACHE STRING "Select heFFTe backend, e.g., FFTW or MKL")
|
|
||||||
set_property(CACHE FFT_HEFFTE_BACKEND PROPERTY STRINGS ${FFT_HEFFTE_BACKEND_VALUES})
|
|
||||||
validate_option(FFT_HEFFTE_BACKEND FFT_HEFFTE_BACKEND_VALUES)
|
|
||||||
|
|
||||||
if(FFT_HEFFTE_BACKEND STREQUAL "FFTW") # respect the backend choice, FFTW or MKL
|
|
||||||
set(HEFFTE_COMPONENTS "FFTW")
|
|
||||||
set(Heffte_ENABLE_FFTW "ON" CACHE BOOL "Enables FFTW backend for heFFTe")
|
|
||||||
elseif(FFT_HEFFTE_BACKEND STREQUAL "MKL")
|
|
||||||
set(HEFFTE_COMPONENTS "MKL")
|
|
||||||
set(Heffte_ENABLE_MKL "ON" CACHE BOOL "Enables MKL backend for heFFTe")
|
|
||||||
else()
|
|
||||||
set(HEFFTE_COMPONENTS "BUILTIN")
|
|
||||||
message(WARNING "FFT_HEFFTE_BACKEND not selected, defaulting to the builtin 'stock' backend, which is intended for testing and is not optimized for production runs")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(Heffte 2.4.0 QUIET COMPONENTS ${HEFFTE_COMPONENTS})
|
|
||||||
if (NOT Heffte_FOUND) # download and build
|
|
||||||
if(BUILD_SHARED_LIBS)
|
|
||||||
set(BUILD_SHARED_LIBS_WAS_ON YES)
|
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
|
||||||
endif()
|
|
||||||
if(CMAKE_REQUEST_PIC)
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
||||||
endif()
|
|
||||||
set(Heffte_ENABLE_${FFT_HEFFTE_BACKEND} ON)
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(HEFFTE_PROJECT # using v2.4.0
|
|
||||||
URL "https://github.com/icl-utk-edu/heffte/archive/refs/tags/v2.4.0.tar.gz"
|
|
||||||
URL_HASH SHA256=02310fb4f9688df02f7181667e61c3adb7e38baf79611d80919d47452ff7881d
|
|
||||||
)
|
|
||||||
FetchContent_Populate(HEFFTE_PROJECT)
|
|
||||||
|
|
||||||
# fixup git hash to show "(unknown)" to avoid compilation failures.
|
|
||||||
file(READ ${heffte_project_SOURCE_DIR}/include/heffte_config.cmake.h HEFFTE_CFG_FILE_TEXT)
|
|
||||||
string(REPLACE "@Heffte_GIT_HASH@" "(unknown)" HEFFTE_CFG_FILE_TEXT "${HEFFTE_CFG_FILE_TEXT}")
|
|
||||||
file(WRITE ${heffte_project_SOURCE_DIR}/include/heffte_config.cmake.h "${HEFFTE_CFG_FILE_TEXT}")
|
|
||||||
|
|
||||||
add_subdirectory(${heffte_project_SOURCE_DIR} ${heffte_project_BINARY_DIR} EXCLUDE_FROM_ALL)
|
|
||||||
add_library(Heffte::Heffte ALIAS Heffte)
|
|
||||||
if(BUILD_SHARED_LIBS_WAS_ON)
|
|
||||||
set(BUILD_SHARED_LIBS ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
target_compile_definitions(lammps PRIVATE -DFFT_HEFFTE "-DFFT_HEFFTE_${FFT_HEFFTE_BACKEND}")
|
|
||||||
target_link_libraries(lammps PRIVATE Heffte::Heffte)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(FFT_PACK "array" CACHE STRING "Optimization for FFT")
|
set(FFT_PACK "array" CACHE STRING "Optimization for FFT")
|
||||||
set(FFT_PACK_VALUES array pointer memcpy)
|
set(FFT_PACK_VALUES array pointer memcpy)
|
||||||
set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES})
|
set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES})
|
||||||
|
|||||||
52
cmake/Modules/Packages/LATTE.cmake
Normal file
52
cmake/Modules/Packages/LATTE.cmake
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
enable_language(Fortran)
|
||||||
|
|
||||||
|
# using lammps in a super-build setting
|
||||||
|
if(TARGET LATTE::latte)
|
||||||
|
target_link_libraries(lammps PRIVATE LATTE::latte)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(LATTE 1.2.2 CONFIG)
|
||||||
|
if(LATTE_FOUND)
|
||||||
|
set(DOWNLOAD_LATTE_DEFAULT OFF)
|
||||||
|
else()
|
||||||
|
set(DOWNLOAD_LATTE_DEFAULT ON)
|
||||||
|
endif()
|
||||||
|
option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
|
||||||
|
if(DOWNLOAD_LATTE)
|
||||||
|
message(STATUS "LATTE download requested - we will build our own")
|
||||||
|
set(LATTE_URL "https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" CACHE STRING "URL for LATTE tarball")
|
||||||
|
set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball")
|
||||||
|
mark_as_advanced(LATTE_URL)
|
||||||
|
mark_as_advanced(LATTE_MD5)
|
||||||
|
|
||||||
|
# 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")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
ExternalProject_Add(latte_build
|
||||||
|
URL ${LATTE_URL}
|
||||||
|
URL_MD5 ${LATTE_MD5}
|
||||||
|
SOURCE_SUBDIR cmake
|
||||||
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
|
||||||
|
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
||||||
|
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} -DCMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}
|
||||||
|
-DCMAKE_Fortran_FLAGS_${BTYPE}=${CMAKE_Fortran_FLAGS_${BTYPE}} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||||
|
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/liblatte.a
|
||||||
|
)
|
||||||
|
ExternalProject_get_property(latte_build INSTALL_DIR)
|
||||||
|
add_library(LAMMPS::LATTE UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(LAMMPS::LATTE PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${INSTALL_DIR}/lib/liblatte.a"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||||
|
target_link_libraries(lammps PRIVATE LAMMPS::LATTE)
|
||||||
|
add_dependencies(LAMMPS::LATTE latte_build)
|
||||||
|
else()
|
||||||
|
find_package(LATTE 1.2.2 REQUIRED CONFIG)
|
||||||
|
target_link_libraries(lammps PRIVATE LATTE::latte)
|
||||||
|
endif()
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# avoid including this file twice
|
|
||||||
if(LEPTON_SOURCE_DIR)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton)
|
|
||||||
|
|
||||||
file(GLOB LEPTON_SOURCES CONFIGURE_DEPENDS ${LEPTON_SOURCE_DIR}/src/[^.]*.cpp)
|
|
||||||
|
|
||||||
if((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64") OR
|
|
||||||
(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") OR
|
|
||||||
(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64"))
|
|
||||||
option(LEPTON_ENABLE_JIT "Enable Just-In-Time compiler for Lepton" ON)
|
|
||||||
else()
|
|
||||||
option(LEPTON_ENABLE_JIT "Enable Just-In-Time compiler for Lepton" OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(LEPTON_ENABLE_JIT)
|
|
||||||
file(GLOB ASMJIT_SOURCES CONFIGURE_DEPENDS ${LEPTON_SOURCE_DIR}/asmjit/*/[^.]*.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES})
|
|
||||||
set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE})
|
|
||||||
target_compile_definitions(lepton PUBLIC LEPTON_BUILDING_STATIC_LIBRARY=1)
|
|
||||||
target_include_directories(lepton PUBLIC ${LEPTON_SOURCE_DIR}/include)
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
||||||
find_library(LIB_RT rt QUIET)
|
|
||||||
target_link_libraries(lepton PUBLIC ${LIB_RT})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(LEPTON_ENABLE_JIT)
|
|
||||||
target_compile_definitions(lepton PUBLIC "LEPTON_USE_JIT=1;ASMJIT_BUILD_X86=1;ASMJIT_STATIC=1;ASMJIT_BUILD_RELEASE=1")
|
|
||||||
target_include_directories(lepton PUBLIC ${LEPTON_SOURCE_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(lammps PRIVATE lepton)
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
# fix sgcmc may only be installed if also the EAM pair style from MANYBODY is installed
|
|
||||||
if(NOT PKG_MANYBODY)
|
|
||||||
get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX)
|
|
||||||
list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.h)
|
|
||||||
set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}")
|
|
||||||
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
|
||||||
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.cpp)
|
|
||||||
set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}")
|
|
||||||
endif()
|
|
||||||
@ -8,11 +8,10 @@ option(DOWNLOAD_MDI "Download and compile the MDI library instead of using an al
|
|||||||
|
|
||||||
if(DOWNLOAD_MDI)
|
if(DOWNLOAD_MDI)
|
||||||
message(STATUS "MDI download requested - we will build our own")
|
message(STATUS "MDI download requested - we will build our own")
|
||||||
set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.4.26.tar.gz" CACHE STRING "URL for MDI tarball")
|
set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.3.2.tar.gz" CACHE STRING "URL for MDI tarball")
|
||||||
set(MDI_MD5 "3124bb85259471e2a53a891f04bf697a" CACHE STRING "MD5 checksum for MDI tarball")
|
set(MDI_MD5 "836f5da400d8cff0f0e4435640f9454f" CACHE STRING "MD5 checksum for MDI tarball")
|
||||||
mark_as_advanced(MDI_URL)
|
mark_as_advanced(MDI_URL)
|
||||||
mark_as_advanced(MDI_MD5)
|
mark_as_advanced(MDI_MD5)
|
||||||
GetFallbackURL(MDI_URL MDI_FALLBACK)
|
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
|
|
||||||
# only ON/OFF are allowed for "mpi" flag when building MDI library
|
# only ON/OFF are allowed for "mpi" flag when building MDI library
|
||||||
@ -26,16 +25,15 @@ if(DOWNLOAD_MDI)
|
|||||||
|
|
||||||
# detect if we have python development support and thus can enable python plugins
|
# detect if we have python development support and thus can enable python plugins
|
||||||
set(MDI_USE_PYTHON_PLUGINS OFF)
|
set(MDI_USE_PYTHON_PLUGINS OFF)
|
||||||
find_package(Python QUIET COMPONENTS Development)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
if(Python_Development_FOUND)
|
find_package(PythonLibs QUIET) # Deprecated since version 3.12
|
||||||
set(MDI_USE_PYTHON_PLUGINS ON)
|
if(PYTHONLIBS_FOUND)
|
||||||
endif()
|
set(MDI_USE_PYTHON_PLUGINS ON)
|
||||||
# python plugins are not supported and thus must be always off on Windows
|
endif()
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
else()
|
||||||
unset(Python_Development_FOUND)
|
find_package(Python QUIET COMPONENTS Development)
|
||||||
set(MDI_USE_PYTHON_PLUGINS OFF)
|
if(Python_Development_FOUND)
|
||||||
if(CMAKE_CROSSCOMPILING)
|
set(MDI_USE_PYTHON_PLUGINS ON)
|
||||||
set(CMAKE_INSTALL_LIBDIR lib)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -44,11 +42,10 @@ if(DOWNLOAD_MDI)
|
|||||||
# support cross-compilation and ninja-build
|
# support cross-compilation and ninja-build
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(mdi_build
|
ExternalProject_Add(mdi_build
|
||||||
URL ${MDI_URL} ${MDI_FALLBACK}
|
URL ${MDI_URL}
|
||||||
URL_MD5 ${MDI_MD5}
|
URL_MD5 ${MDI_MD5}
|
||||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext
|
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
||||||
CMAKE_ARGS
|
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext
|
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||||
@ -57,34 +54,37 @@ if(DOWNLOAD_MDI)
|
|||||||
-Dlanguage=C
|
-Dlanguage=C
|
||||||
-Dlibtype=STATIC
|
-Dlibtype=STATIC
|
||||||
-Dmpi=${MDI_USE_MPI}
|
-Dmpi=${MDI_USE_MPI}
|
||||||
-Dplugins=ON
|
|
||||||
-Dpython_plugins=${MDI_USE_PYTHON_PLUGINS}
|
-Dpython_plugins=${MDI_USE_PYTHON_PLUGINS}
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
INSTALL_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext/src/mdi_build-build --target install
|
INSTALL_COMMAND ""
|
||||||
BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext/${CMAKE_INSTALL_LIBDIR}/mdi/${CMAKE_STATIC_LIBRARY_PREFIX}mdi${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
BUILD_BYPRODUCTS "<BINARY_DIR>/MDI_Library/libmdi.a"
|
||||||
)
|
)
|
||||||
|
|
||||||
# where is the compiled library?
|
# where is the compiled library?
|
||||||
ExternalProject_get_property(mdi_build PREFIX)
|
ExternalProject_get_property(mdi_build BINARY_DIR)
|
||||||
|
set(MDI_BINARY_DIR "${BINARY_DIR}/MDI_Library")
|
||||||
# workaround for older CMake versions
|
# workaround for older CMake versions
|
||||||
file(MAKE_DIRECTORY ${PREFIX}/${CMAKE_INSTALL_LIBDIR}/mdi)
|
file(MAKE_DIRECTORY ${MDI_BINARY_DIR})
|
||||||
file(MAKE_DIRECTORY ${PREFIX}/include/mdi)
|
|
||||||
|
|
||||||
# create imported target for the MDI library
|
# create imported target for the MDI library
|
||||||
add_library(LAMMPS::MDI UNKNOWN IMPORTED)
|
add_library(LAMMPS::MDI UNKNOWN IMPORTED)
|
||||||
add_dependencies(LAMMPS::MDI mdi_build)
|
add_dependencies(LAMMPS::MDI mdi_build)
|
||||||
set_target_properties(LAMMPS::MDI PROPERTIES
|
set_target_properties(LAMMPS::MDI PROPERTIES
|
||||||
IMPORTED_LOCATION "${PREFIX}/${CMAKE_INSTALL_LIBDIR}/mdi/${CMAKE_STATIC_LIBRARY_PREFIX}mdi${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
IMPORTED_LOCATION "${MDI_BINARY_DIR}/libmdi.a"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${PREFIX}/include/mdi
|
INTERFACE_INCLUDE_DIRECTORIES ${MDI_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(MDI_DEP_LIBS "")
|
set(MDI_DEP_LIBS "")
|
||||||
# if compiling with python plugins we need
|
# if compiling with python plugins we need
|
||||||
# to add python libraries as dependency.
|
# to add python libraries as dependency.
|
||||||
if(MDI_USE_PYTHON_PLUGINS)
|
if(MDI_USE_PYTHON_PLUGINS)
|
||||||
list(APPEND MDI_DEP_LIBS Python::Python)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
endif()
|
list(APPEND MDI_DEP_LIBS ${PYTHON_LIBRARIES})
|
||||||
|
else()
|
||||||
|
list(APPEND MDI_DEP_LIBS Python::Python)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
||||||
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
||||||
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
# pair style and fix srp/react depend on the fixes bond/break and bond/create from the MC package
|
|
||||||
if(NOT PKG_MC)
|
|
||||||
get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX)
|
|
||||||
list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/MISC/fix_srp_react.h)
|
|
||||||
set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}")
|
|
||||||
get_property(LAMMPS_PAIR_HEADERS GLOBAL PROPERTY PAIR)
|
|
||||||
list(REMOVE_ITEM LAMMPS_PAIR_HEADERS ${LAMMPS_SOURCE_DIR}/MISC/pair_srp_react.h)
|
|
||||||
set_property(GLOBAL PROPERTY PAIR "${LAMMPS_PAIR_HEADERS}")
|
|
||||||
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
|
||||||
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MISC/fix_srp_react.cpp)
|
|
||||||
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MISC/pair_srp_react.cpp)
|
|
||||||
set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}")
|
|
||||||
endif()
|
|
||||||
@ -6,11 +6,10 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
option(DOWNLOAD_N2P2 "Download n2p2 library instead of using an already installed one)" ${DOWNLOAD_N2P2_DEFAULT})
|
option(DOWNLOAD_N2P2 "Download n2p2 library instead of using an already installed one)" ${DOWNLOAD_N2P2_DEFAULT})
|
||||||
if(DOWNLOAD_N2P2)
|
if(DOWNLOAD_N2P2)
|
||||||
set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.2.0.tar.gz" CACHE STRING "URL for n2p2 tarball")
|
set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.1.4.tar.gz" CACHE STRING "URL for n2p2 tarball")
|
||||||
set(N2P2_MD5 "a2d9ab7f676b3a74a324fc1eda0a911d" CACHE STRING "MD5 checksum of N2P2 tarball")
|
set(N2P2_MD5 "9595b066636cd6b90b0fef93398297a5" CACHE STRING "MD5 checksum of N2P2 tarball")
|
||||||
mark_as_advanced(N2P2_URL)
|
mark_as_advanced(N2P2_URL)
|
||||||
mark_as_advanced(N2P2_MD5)
|
mark_as_advanced(N2P2_MD5)
|
||||||
GetFallbackURL(N2P2_URL N2P2_FALLBACK)
|
|
||||||
|
|
||||||
# adjust settings from detected compiler to compiler platform in n2p2 library
|
# adjust settings from detected compiler to compiler platform in n2p2 library
|
||||||
# set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7)
|
# set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7)
|
||||||
@ -73,7 +72,7 @@ if(DOWNLOAD_N2P2)
|
|||||||
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
|
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(n2p2_build
|
ExternalProject_Add(n2p2_build
|
||||||
URL ${N2P2_URL} ${N2P2_FALLBACK}
|
URL ${N2P2_URL}
|
||||||
URL_MD5 ${N2P2_MD5}
|
URL_MD5 ${N2P2_MD5}
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
|
|||||||
@ -2,7 +2,12 @@
|
|||||||
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
||||||
if(PKG_PYTHON)
|
if(PKG_PYTHON)
|
||||||
find_package(Cythonize QUIET)
|
find_package(Cythonize QUIET)
|
||||||
find_package(Python COMPONENTS NumPy QUIET)
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
|
||||||
|
find_package(Python COMPONENTS NumPy QUIET)
|
||||||
|
else()
|
||||||
|
# assume we have NumPy
|
||||||
|
set(Python_NumPy_FOUND ON)
|
||||||
|
endif()
|
||||||
if(Cythonize_FOUND AND Python_NumPy_FOUND)
|
if(Cythonize_FOUND AND Python_NumPy_FOUND)
|
||||||
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
@ -12,27 +17,33 @@ option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_EN
|
|||||||
|
|
||||||
if(MLIAP_ENABLE_PYTHON)
|
if(MLIAP_ENABLE_PYTHON)
|
||||||
find_package(Cythonize REQUIRED)
|
find_package(Cythonize REQUIRED)
|
||||||
find_package(Python COMPONENTS NumPy REQUIRED)
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
|
||||||
|
find_package(Python COMPONENTS NumPy REQUIRED)
|
||||||
|
endif()
|
||||||
if(NOT PKG_PYTHON)
|
if(NOT PKG_PYTHON)
|
||||||
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
||||||
endif()
|
endif()
|
||||||
if(Python_VERSION VERSION_LESS 3.6)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6)
|
||||||
|
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(Python_VERSION VERSION_LESS 3.6)
|
||||||
|
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
||||||
file(GLOB MLIAP_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/ML-IAP/*.pyx)
|
set(MLIAP_CYTHON_SRC ${LAMMPS_SOURCE_DIR}/ML-IAP/mliap_model_python_couple.pyx)
|
||||||
|
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_SRC} NAME_WE)
|
||||||
file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR})
|
file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR})
|
||||||
foreach(MLIAP_CYTHON_FILE ${MLIAP_CYTHON_SRC})
|
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
||||||
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE)
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_SRC} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||||
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_FILE} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
|
||||||
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
MAIN_DEPENDENCY ${MLIAP_CYTHON_SRC}
|
||||||
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
|
COMMENT "Generating C++ sources with cythonize...")
|
||||||
MAIN_DEPENDENCY ${MLIAP_CYTHON_FILE}
|
|
||||||
COMMENT "Generating C++ sources with cythonize...")
|
|
||||||
target_sources(lammps PRIVATE ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
|
|
||||||
endforeach()
|
|
||||||
target_compile_definitions(lammps PRIVATE -DMLIAP_PYTHON)
|
target_compile_definitions(lammps PRIVATE -DMLIAP_PYTHON)
|
||||||
|
target_sources(lammps PRIVATE ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
|
||||||
target_include_directories(lammps PRIVATE ${MLIAP_BINARY_DIR})
|
target_include_directories(lammps PRIVATE ${MLIAP_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,44 +1,37 @@
|
|||||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.fix2.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||||
|
|
||||||
set(PACELIB_MD5 "b45de9a633f42ed65422567e3ce56f9f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
set(PACELIB_MD5 "32394d799bc282bb57696c78c456e64f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||||
mark_as_advanced(PACELIB_URL)
|
mark_as_advanced(PACELIB_URL)
|
||||||
mark_as_advanced(PACELIB_MD5)
|
mark_as_advanced(PACELIB_MD5)
|
||||||
GetFallbackURL(PACELIB_URL PACELIB_FALLBACK)
|
|
||||||
|
|
||||||
# LOCAL_ML-PACE points to top-level dir with local lammps-user-pace repo,
|
# download library sources to build folder
|
||||||
# to make it easier to check local build without going through the public github releases
|
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS
|
||||||
if(LOCAL_ML-PACE)
|
|
||||||
set(lib-pace "${LOCAL_ML-PACE}")
|
|
||||||
else()
|
|
||||||
# download library sources to build folder
|
|
||||||
if(EXISTS ${CMAKE_BINARY_DIR}/libpace.tar.gz)
|
|
||||||
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
|
||||||
endif()
|
|
||||||
if(NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}")
|
|
||||||
message(STATUS "Downloading ${PACELIB_URL}")
|
|
||||||
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz STATUS DL_STATUS SHOW_PROGRESS)
|
|
||||||
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
|
||||||
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}"))
|
|
||||||
message(WARNING "Download from primary URL ${PACELIB_URL} failed\nTrying fallback URL ${PACELIB_FALLBACK}")
|
|
||||||
file(DOWNLOAD ${PACELIB_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5} SHOW_PROGRESS)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
# uncompress downloaded sources
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
||||||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
)
|
||||||
|
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
||||||
|
|
||||||
# uncompress downloaded sources
|
# enforce building libyaml-cpp as static library and turn off optional features
|
||||||
execute_process(
|
set(YAML_BUILD_SHARED_LIBS OFF)
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
|
set(YAML_CPP_BUILD_CONTRIB OFF)
|
||||||
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
set(YAML_CPP_BUILD_TOOLS OFF)
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp)
|
||||||
)
|
set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include)
|
||||||
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(${lib-pace} build-pace)
|
file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE)
|
||||||
|
file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp)
|
||||||
|
list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp)
|
||||||
|
|
||||||
|
add_library(pace STATIC ${PACE_EVALUATOR_SOURCES})
|
||||||
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
|
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
|
||||||
|
target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
target_link_libraries(pace PRIVATE yaml-cpp-pace)
|
||||||
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
|
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
|
||||||
target_link_libraries(lammps PRIVATE pace)
|
target_link_libraries(lammps PRIVATE pace)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -16,11 +16,8 @@ if(DOWNLOAD_QUIP)
|
|||||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n")
|
set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n")
|
||||||
set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n")
|
set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n")
|
||||||
set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n")
|
set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n")
|
||||||
set(temp "${temp}F95_PRE_FILENAME_FLAG = -Tf\n")
|
|
||||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
||||||
# quip library uses GNU fortran extensions. If any more restrictive standards are set, reset them
|
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
|
||||||
string(REGEX REPLACE -std=f[0-9]+ -std=gnu _fopt "${CMAKE_Fortran_FLAGS_${BTYPE}}")
|
|
||||||
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${_fopt} -fmax-stack-var-size=6553600\n")
|
|
||||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n")
|
set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n")
|
||||||
set(temp "${temp}F95FLAGS += -x f95-cpp-input -ffree-line-length-none -ffree-form -fno-second-underscore -fPIC\n")
|
set(temp "${temp}F95FLAGS += -x f95-cpp-input -ffree-line-length-none -ffree-form -fno-second-underscore -fPIC\n")
|
||||||
set(temp "${temp}F77FLAGS += -x f77-cpp-input -fno-second-underscore -fPIC\n")
|
set(temp "${temp}F77FLAGS += -x f77-cpp-input -fno-second-underscore -fPIC\n")
|
||||||
@ -58,15 +55,15 @@ if(DOWNLOAD_QUIP)
|
|||||||
GIT_SUBMODULES "src/fox;src/GAP"
|
GIT_SUBMODULES "src/fox;src/GAP"
|
||||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/quip.config <SOURCE_DIR>/arch/Makefile.lammps
|
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/quip.config <SOURCE_DIR>/arch/Makefile.lammps
|
||||||
CONFIGURE_COMMAND env QUIP_ARCH=lammps make config
|
CONFIGURE_COMMAND env QUIP_ARCH=lammps make config
|
||||||
BUILD_COMMAND env QUIP_ARCH=lammps make -j1 libquip
|
BUILD_COMMAND env QUIP_ARCH=lammps make libquip
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
BUILD_IN_SOURCE YES
|
BUILD_IN_SOURCE YES
|
||||||
BUILD_BYPRODUCTS <SOURCE_DIR>/build/lammps/${CMAKE_STATIC_LIBRARY_PREFIX}quip${CMAKE_STATIC_LIBRARY_SUFFIX}
|
BUILD_BYPRODUCTS <SOURCE_DIR>/build/lammps/libquip.a
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(quip_build SOURCE_DIR)
|
ExternalProject_get_property(quip_build SOURCE_DIR)
|
||||||
add_library(LAMMPS::QUIP UNKNOWN IMPORTED)
|
add_library(LAMMPS::QUIP UNKNOWN IMPORTED)
|
||||||
set_target_properties(LAMMPS::QUIP PROPERTIES
|
set_target_properties(LAMMPS::QUIP PROPERTIES
|
||||||
IMPORTED_LOCATION "${SOURCE_DIR}/build/lammps/${CMAKE_STATIC_LIBRARY_PREFIX}quip${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
IMPORTED_LOCATION "${SOURCE_DIR}/build/lammps/libquip.a"
|
||||||
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||||
target_link_libraries(lammps PRIVATE LAMMPS::QUIP)
|
target_link_libraries(lammps PRIVATE LAMMPS::QUIP)
|
||||||
add_dependencies(LAMMPS::QUIP quip_build)
|
add_dependencies(LAMMPS::QUIP quip_build)
|
||||||
|
|||||||
28
cmake/Modules/Packages/MSCG.cmake
Normal file
28
cmake/Modules/Packages/MSCG.cmake
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
find_package(GSL REQUIRED)
|
||||||
|
find_package(MSCG QUIET)
|
||||||
|
if(MSGC_FOUND)
|
||||||
|
set(DOWNLOAD_MSCG_DEFAULT OFF)
|
||||||
|
else()
|
||||||
|
set(DOWNLOAD_MSCG_DEFAULT ON)
|
||||||
|
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")
|
||||||
|
mark_as_advanced(MSCG_URL)
|
||||||
|
mark_as_advanced(MSCG_MD5)
|
||||||
|
|
||||||
|
include(ExternalCMakeProject)
|
||||||
|
ExternalCMakeProject(mscg ${MSCG_URL} ${MSCG_MD5} MSCG-release src/CMake "")
|
||||||
|
|
||||||
|
# set include and link library
|
||||||
|
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/mscg-src/src")
|
||||||
|
target_link_libraries(lammps PRIVATE mscg)
|
||||||
|
else()
|
||||||
|
find_package(MSCG)
|
||||||
|
if(NOT MSCG_FOUND)
|
||||||
|
message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIR, or set DOWNLOAD_MSCG=ON to download it")
|
||||||
|
endif()
|
||||||
|
target_link_libraries(lammps PRIVATE MSCG::MSCG)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(lammps PRIVATE GSL::gsl ${LAPACK_LIBRARIES})
|
||||||
@ -1,169 +1,105 @@
|
|||||||
# Plumed2 support for PLUMED package
|
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)
|
||||||
|
|
||||||
if(BUILD_MPI)
|
set(PLUMED_LINK_LIBS)
|
||||||
set(PLUMED_CONFIG_MPI "--enable-mpi")
|
if(PLUMED_MODE STREQUAL "STATIC")
|
||||||
set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER})
|
find_package(LAPACK REQUIRED)
|
||||||
set(PLUMED_CONFIG_CXX ${CMAKE_MPI_CXX_COMPILER})
|
find_package(BLAS REQUIRED)
|
||||||
set(PLUMED_CONFIG_CPP "-I ${MPI_CXX_INCLUDE_PATH}")
|
find_package(GSL REQUIRED)
|
||||||
set(PLUMED_CONFIG_LIB "${MPI_CXX_LIBRARIES}")
|
list(APPEND PLUMED_LINK_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} GSL::gsl)
|
||||||
set(PLUMED_CONFIG_DEP "mpi4win_build")
|
find_package(ZLIB QUIET)
|
||||||
else()
|
if(ZLIB_FOUND)
|
||||||
set(PLUMED_CONFIG_MPI "--disable-mpi")
|
list(APPEND PLUMED_LINK_LIBS ZLIB::ZLIB)
|
||||||
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()
|
|
||||||
|
|
||||||
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.8.3/plumed-src-2.8.3.tgz"
|
|
||||||
CACHE STRING "URL for PLUMED tarball")
|
|
||||||
set(PLUMED_MD5 "76d23cd394eba9e6530316ed1184e219" CACHE STRING "MD5 checksum of PLUMED tarball")
|
|
||||||
|
|
||||||
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()
|
|
||||||
message(FATAL_ERROR "Unsupported target system: ${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
|
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "Downloading and cross-compiling Plumed2 for ${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR} with ${CROSS_CONFIGURE}")
|
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)
|
||||||
|
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})
|
||||||
|
else()
|
||||||
|
set(PLUMED_CONFIG_MPI "--disable-mpi")
|
||||||
|
set(PLUMED_CONFIG_CC ${CMAKE_C_COMPILER})
|
||||||
|
set(PLUMED_CONFIG_CXX ${CMAKE_CXX_COMPILER})
|
||||||
|
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)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(plumed_build
|
ExternalProject_Add(plumed_build
|
||||||
URL ${PLUMED_URL} ${PLUMED_FALLBACK}
|
URL ${PLUMED_URL}
|
||||||
URL_MD5 ${PLUMED_MD5}
|
URL_MD5 ${PLUMED_MD5}
|
||||||
BUILD_IN_SOURCE 1
|
BUILD_IN_SOURCE 1
|
||||||
CONFIGURE_COMMAND ${CROSS_CONFIGURE} --disable-shared --disable-bsymbolic
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||||
--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}
|
${CONFIGURE_REQUEST_PIC}
|
||||||
--enable-modules=all
|
--enable-modules=all
|
||||||
--enable-cxx=11
|
|
||||||
--disable-python
|
|
||||||
${PLUMED_CONFIG_MPI}
|
${PLUMED_CONFIG_MPI}
|
||||||
${PLUMED_CONFIG_OMP}
|
${PLUMED_CONFIG_OMP}
|
||||||
CXX=${PLUMED_CONFIG_CXX}
|
CXX=${PLUMED_CONFIG_CXX}
|
||||||
CC=${PLUMED_CONFIG_CC}
|
CC=${PLUMED_CONFIG_CC}
|
||||||
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
|
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
||||||
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||||
add_dependencies(LAMMPS::PLUMED plumed_build)
|
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||||
if(PLUMED_MODE STREQUAL "STATIC")
|
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}")
|
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")
|
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}")
|
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")
|
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 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}")
|
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()
|
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()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
|
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
if(NOT Python_INTERPRETER)
|
find_package(PythonLibs REQUIRED) # Deprecated since version 3.12
|
||||||
# backward compatibility with CMake before 3.12 and older LAMMPS documentation
|
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS})
|
||||||
if(PYTHON_EXECUTABLE)
|
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES})
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
else()
|
||||||
endif()
|
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
||||||
find_package(Python COMPONENTS Interpreter)
|
target_link_libraries(lammps PRIVATE Python::Python)
|
||||||
endif()
|
endif()
|
||||||
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
|
||||||
target_link_libraries(lammps PRIVATE Python::Python)
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
||||||
|
|||||||
@ -18,8 +18,6 @@ if(DOWNLOAD_SCAFACOS)
|
|||||||
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
|
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
|
||||||
mark_as_advanced(SCAFACOS_URL)
|
mark_as_advanced(SCAFACOS_URL)
|
||||||
mark_as_advanced(SCAFACOS_MD5)
|
mark_as_advanced(SCAFACOS_MD5)
|
||||||
GetFallbackURL(SCAFACOS_URL SCAFACOS_FALLBACK)
|
|
||||||
|
|
||||||
|
|
||||||
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
||||||
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||||
@ -32,7 +30,7 @@ if(DOWNLOAD_SCAFACOS)
|
|||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(scafacos_build
|
ExternalProject_Add(scafacos_build
|
||||||
URL ${SCAFACOS_URL} ${SCAFACOS_FALLBACK}
|
URL ${SCAFACOS_URL}
|
||||||
URL_MD5 ${SCAFACOS_MD5}
|
URL_MD5 ${SCAFACOS_MD5}
|
||||||
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
function(FindStyleHeaders path style_class file_pattern headers)
|
function(FindStyleHeaders path style_class file_pattern headers)
|
||||||
file(GLOB files CONFIGURE_DEPENDS "${path}/${file_pattern}*.h")
|
file(GLOB files "${path}/${file_pattern}*.h")
|
||||||
get_property(hlist GLOBAL PROPERTY ${headers})
|
get_property(hlist GLOBAL PROPERTY ${headers})
|
||||||
|
|
||||||
foreach(file_name ${files})
|
foreach(file_name ${files})
|
||||||
@ -95,76 +95,73 @@ function(RegisterIntegrateStyle path)
|
|||||||
endfunction(RegisterIntegrateStyle)
|
endfunction(RegisterIntegrateStyle)
|
||||||
|
|
||||||
function(RegisterStyles search_path)
|
function(RegisterStyles search_path)
|
||||||
FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force
|
FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force
|
||||||
FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid
|
FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid
|
||||||
FindStyleHeaders(${search_path} BODY_CLASS body_ BODY ) # body ) # atom_vec_body
|
FindStyleHeaders(${search_path} BODY_CLASS body_ BODY ) # body ) # atom_vec_body
|
||||||
FindStyleHeaders(${search_path} BOND_CLASS bond_ BOND ) # bond ) # force
|
FindStyleHeaders(${search_path} BOND_CLASS bond_ BOND ) # bond ) # force
|
||||||
FindStyleHeaders(${search_path} COMMAND_CLASS "[^.]" COMMAND ) # command ) # input
|
FindStyleHeaders(${search_path} COMMAND_CLASS "[^.]" COMMAND ) # command ) # input
|
||||||
FindStyleHeaders(${search_path} COMPUTE_CLASS compute_ COMPUTE ) # compute ) # modify
|
FindStyleHeaders(${search_path} COMPUTE_CLASS compute_ COMPUTE ) # compute ) # modify
|
||||||
FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force
|
FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force
|
||||||
FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump
|
FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump
|
||||||
FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify
|
FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify
|
||||||
FindStyleHeaders(${search_path} GRAN_SUB_MOD_CLASS gran_sub_mod_ GRAN_SUB_MOD ) # gran_sub_mod ) # granular_model
|
FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force
|
||||||
FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force
|
FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update
|
||||||
FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update
|
FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force
|
||||||
FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force
|
FindStyleHeaders(${search_path} MINIMIZE_CLASS min_ MINIMIZE ) # minimize ) # update
|
||||||
FindStyleHeaders(${search_path} MINIMIZE_CLASS min_ MINIMIZE ) # minimize ) # update
|
FindStyleHeaders(${search_path} NBIN_CLASS nbin_ NBIN ) # nbin ) # neighbor
|
||||||
FindStyleHeaders(${search_path} NBIN_CLASS nbin_ NBIN ) # nbin ) # neighbor
|
FindStyleHeaders(${search_path} NPAIR_CLASS npair_ NPAIR ) # npair ) # neighbor
|
||||||
FindStyleHeaders(${search_path} NPAIR_CLASS npair_ NPAIR ) # npair ) # neighbor
|
FindStyleHeaders(${search_path} NSTENCIL_CLASS nstencil_ NSTENCIL ) # nstencil ) # neighbor
|
||||||
FindStyleHeaders(${search_path} NSTENCIL_CLASS nstencil_ NSTENCIL ) # nstencil ) # neighbor
|
FindStyleHeaders(${search_path} NTOPO_CLASS ntopo_ NTOPO ) # ntopo ) # neighbor
|
||||||
FindStyleHeaders(${search_path} NTOPO_CLASS ntopo_ NTOPO ) # ntopo ) # neighbor
|
FindStyleHeaders(${search_path} PAIR_CLASS pair_ PAIR ) # pair ) # force
|
||||||
FindStyleHeaders(${search_path} PAIR_CLASS pair_ PAIR ) # pair ) # force
|
FindStyleHeaders(${search_path} READER_CLASS reader_ READER ) # reader ) # read_dump
|
||||||
FindStyleHeaders(${search_path} READER_CLASS reader_ READER ) # reader ) # read_dump
|
FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain
|
||||||
FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain
|
|
||||||
endfunction(RegisterStyles)
|
endfunction(RegisterStyles)
|
||||||
|
|
||||||
function(RegisterStylesExt search_path extension sources)
|
function(RegisterStylesExt search_path extension sources)
|
||||||
FindStyleHeadersExt(${search_path} ANGLE_CLASS ${extension} ANGLE ${sources})
|
FindStyleHeadersExt(${search_path} ANGLE_CLASS ${extension} ANGLE ${sources})
|
||||||
FindStyleHeadersExt(${search_path} ATOM_CLASS ${extension} ATOM_VEC ${sources})
|
FindStyleHeadersExt(${search_path} ATOM_CLASS ${extension} ATOM_VEC ${sources})
|
||||||
FindStyleHeadersExt(${search_path} BODY_CLASS ${extension} BODY ${sources})
|
FindStyleHeadersExt(${search_path} BODY_CLASS ${extension} BODY ${sources})
|
||||||
FindStyleHeadersExt(${search_path} BOND_CLASS ${extension} BOND ${sources})
|
FindStyleHeadersExt(${search_path} BOND_CLASS ${extension} BOND ${sources})
|
||||||
FindStyleHeadersExt(${search_path} COMMAND_CLASS ${extension} COMMAND ${sources})
|
FindStyleHeadersExt(${search_path} COMMAND_CLASS ${extension} COMMAND ${sources})
|
||||||
FindStyleHeadersExt(${search_path} COMPUTE_CLASS ${extension} COMPUTE ${sources})
|
FindStyleHeadersExt(${search_path} COMPUTE_CLASS ${extension} COMPUTE ${sources})
|
||||||
FindStyleHeadersExt(${search_path} DIHEDRAL_CLASS ${extension} DIHEDRAL ${sources})
|
FindStyleHeadersExt(${search_path} DIHEDRAL_CLASS ${extension} DIHEDRAL ${sources})
|
||||||
FindStyleHeadersExt(${search_path} DUMP_CLASS ${extension} DUMP ${sources})
|
FindStyleHeadersExt(${search_path} DUMP_CLASS ${extension} DUMP ${sources})
|
||||||
FindStyleHeadersExt(${search_path} FIX_CLASS ${extension} FIX ${sources})
|
FindStyleHeadersExt(${search_path} FIX_CLASS ${extension} FIX ${sources})
|
||||||
FindStyleHeadersExt(${search_path} GRAN_SUB_MOD_CLASS ${extension} GRAN_SUB_MOD ${sources})
|
FindStyleHeadersExt(${search_path} IMPROPER_CLASS ${extension} IMPROPER ${sources})
|
||||||
FindStyleHeadersExt(${search_path} IMPROPER_CLASS ${extension} IMPROPER ${sources})
|
FindStyleHeadersExt(${search_path} INTEGRATE_CLASS ${extension} INTEGRATE ${sources})
|
||||||
FindStyleHeadersExt(${search_path} INTEGRATE_CLASS ${extension} INTEGRATE ${sources})
|
FindStyleHeadersExt(${search_path} KSPACE_CLASS ${extension} KSPACE ${sources})
|
||||||
FindStyleHeadersExt(${search_path} KSPACE_CLASS ${extension} KSPACE ${sources})
|
FindStyleHeadersExt(${search_path} MINIMIZE_CLASS ${extension} MINIMIZE ${sources})
|
||||||
FindStyleHeadersExt(${search_path} MINIMIZE_CLASS ${extension} MINIMIZE ${sources})
|
FindStyleHeadersExt(${search_path} NBIN_CLASS ${extension} NBIN ${sources})
|
||||||
FindStyleHeadersExt(${search_path} NBIN_CLASS ${extension} NBIN ${sources})
|
FindStyleHeadersExt(${search_path} NPAIR_CLASS ${extension} NPAIR ${sources})
|
||||||
FindStyleHeadersExt(${search_path} NPAIR_CLASS ${extension} NPAIR ${sources})
|
FindStyleHeadersExt(${search_path} NSTENCIL_CLASS ${extension} NSTENCIL ${sources})
|
||||||
FindStyleHeadersExt(${search_path} NSTENCIL_CLASS ${extension} NSTENCIL ${sources})
|
FindStyleHeadersExt(${search_path} NTOPO_CLASS ${extension} NTOPO ${sources})
|
||||||
FindStyleHeadersExt(${search_path} NTOPO_CLASS ${extension} NTOPO ${sources})
|
FindStyleHeadersExt(${search_path} PAIR_CLASS ${extension} PAIR ${sources})
|
||||||
FindStyleHeadersExt(${search_path} PAIR_CLASS ${extension} PAIR ${sources})
|
FindStyleHeadersExt(${search_path} READER_CLASS ${extension} READER ${sources})
|
||||||
FindStyleHeadersExt(${search_path} READER_CLASS ${extension} READER ${sources})
|
FindStyleHeadersExt(${search_path} REGION_CLASS ${extension} REGION ${sources})
|
||||||
FindStyleHeadersExt(${search_path} REGION_CLASS ${extension} REGION ${sources})
|
|
||||||
endfunction(RegisterStylesExt)
|
endfunction(RegisterStylesExt)
|
||||||
|
|
||||||
function(GenerateStyleHeaders output_path)
|
function(GenerateStyleHeaders output_path)
|
||||||
message(STATUS "Generating style headers...")
|
message(STATUS "Generating style headers...")
|
||||||
GenerateStyleHeader(${output_path} ANGLE angle ) # force
|
GenerateStyleHeader(${output_path} ANGLE angle ) # force
|
||||||
GenerateStyleHeader(${output_path} ATOM_VEC atom ) # atom atom_vec_hybrid
|
GenerateStyleHeader(${output_path} ATOM_VEC atom ) # atom atom_vec_hybrid
|
||||||
GenerateStyleHeader(${output_path} BODY body ) # atom_vec_body
|
GenerateStyleHeader(${output_path} BODY body ) # atom_vec_body
|
||||||
GenerateStyleHeader(${output_path} BOND bond ) # force
|
GenerateStyleHeader(${output_path} BOND bond ) # force
|
||||||
GenerateStyleHeader(${output_path} COMMAND command ) # input
|
GenerateStyleHeader(${output_path} COMMAND command ) # input
|
||||||
GenerateStyleHeader(${output_path} COMPUTE compute ) # modify
|
GenerateStyleHeader(${output_path} COMPUTE compute ) # modify
|
||||||
GenerateStyleHeader(${output_path} DIHEDRAL dihedral ) # force
|
GenerateStyleHeader(${output_path} DIHEDRAL dihedral ) # force
|
||||||
GenerateStyleHeader(${output_path} DUMP dump ) # output write_dump
|
GenerateStyleHeader(${output_path} DUMP dump ) # output write_dump
|
||||||
GenerateStyleHeader(${output_path} FIX fix ) # modify
|
GenerateStyleHeader(${output_path} FIX fix ) # modify
|
||||||
GenerateStyleHeader(${output_path} GRAN_SUB_MOD gran_sub_mod ) # granular_model
|
GenerateStyleHeader(${output_path} IMPROPER improper ) # force
|
||||||
GenerateStyleHeader(${output_path} IMPROPER improper ) # force
|
GenerateStyleHeader(${output_path} INTEGRATE integrate ) # update
|
||||||
GenerateStyleHeader(${output_path} INTEGRATE integrate ) # update
|
GenerateStyleHeader(${output_path} KSPACE kspace ) # force
|
||||||
GenerateStyleHeader(${output_path} KSPACE kspace ) # force
|
GenerateStyleHeader(${output_path} MINIMIZE minimize ) # update
|
||||||
GenerateStyleHeader(${output_path} MINIMIZE minimize ) # update
|
GenerateStyleHeader(${output_path} NBIN nbin ) # neighbor
|
||||||
GenerateStyleHeader(${output_path} NBIN nbin ) # neighbor
|
GenerateStyleHeader(${output_path} NPAIR npair ) # neighbor
|
||||||
GenerateStyleHeader(${output_path} NPAIR npair ) # neighbor
|
GenerateStyleHeader(${output_path} NSTENCIL nstencil ) # neighbor
|
||||||
GenerateStyleHeader(${output_path} NSTENCIL nstencil ) # neighbor
|
GenerateStyleHeader(${output_path} NTOPO ntopo ) # neighbor
|
||||||
GenerateStyleHeader(${output_path} NTOPO ntopo ) # neighbor
|
GenerateStyleHeader(${output_path} PAIR pair ) # force
|
||||||
GenerateStyleHeader(${output_path} PAIR pair ) # force
|
GenerateStyleHeader(${output_path} READER reader ) # read_dump
|
||||||
GenerateStyleHeader(${output_path} READER reader ) # read_dump
|
GenerateStyleHeader(${output_path} REGION region ) # domain
|
||||||
GenerateStyleHeader(${output_path} REGION region ) # domain
|
|
||||||
endfunction(GenerateStyleHeaders)
|
endfunction(GenerateStyleHeaders)
|
||||||
|
|
||||||
function(DetectBuildSystemConflict lammps_src_dir)
|
function(DetectBuildSystemConflict lammps_src_dir)
|
||||||
@ -187,7 +184,7 @@ endfunction(DetectBuildSystemConflict)
|
|||||||
|
|
||||||
|
|
||||||
function(FindPackagesHeaders path style_class file_pattern headers)
|
function(FindPackagesHeaders path style_class file_pattern headers)
|
||||||
file(GLOB files CONFIGURE_DEPENDS "${path}/${file_pattern}*.h")
|
file(GLOB files "${path}/${file_pattern}*.h")
|
||||||
get_property(plist GLOBAL PROPERTY ${headers})
|
get_property(plist GLOBAL PROPERTY ${headers})
|
||||||
|
|
||||||
foreach(file_name ${files})
|
foreach(file_name ${files})
|
||||||
|
|||||||
@ -6,7 +6,7 @@ if(ENABLE_TESTING)
|
|||||||
find_program(VALGRIND_BINARY NAMES valgrind)
|
find_program(VALGRIND_BINARY NAMES valgrind)
|
||||||
# generate custom suppression file
|
# generate custom suppression file
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "\n")
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "\n")
|
||||||
file(GLOB VALGRIND_SUPPRESSION_FILES CONFIGURE_DEPENDS ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp)
|
file(GLOB VALGRIND_SUPPRESSION_FILES ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp)
|
||||||
foreach(SUPP ${VALGRIND_SUPPRESSION_FILES})
|
foreach(SUPP ${VALGRIND_SUPPRESSION_FILES})
|
||||||
file(READ ${SUPP} SUPPRESSIONS)
|
file(READ ${SUPP} SUPPRESSIONS)
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "${SUPPRESSIONS}")
|
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "${SUPPRESSIONS}")
|
||||||
@ -18,33 +18,29 @@ if(ENABLE_TESTING)
|
|||||||
|
|
||||||
# we need to build and link a LOT of tester executables, so it is worth checking if
|
# we need to build and link a LOT of tester executables, so it is worth checking if
|
||||||
# a faster linker is available. requires GNU or Clang compiler, newer CMake.
|
# a faster linker is available. requires GNU or Clang compiler, newer CMake.
|
||||||
# also only verified with Fedora Linux > 30 and Ubuntu 18.04 or 22.04+(Ubuntu 20.04 fails)
|
# also only verified with Fedora Linux > 30 and Ubuntu <= 18.04 (Ubuntu 20.04 fails)
|
||||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
||||||
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND
|
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
||||||
((CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04) OR (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04)))
|
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND (CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04))
|
||||||
OR ((CMAKE_LINUX_DISTRO STREQUAL "Fedora") AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30)))
|
OR ((CMAKE_LINUX_DISTRO STREQUAL "Fedora") AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30)))
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT default)
|
set(CMAKE_CUSTOM_LINKER_DEFAULT default)
|
||||||
check_cxx_compiler_flag(-fuse-ld=mold HAVE_MOLD_LINKER_FLAG)
|
|
||||||
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
|
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
|
||||||
check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER_FLAG)
|
check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER_FLAG)
|
||||||
check_cxx_compiler_flag(-fuse-ld=bfd HAVE_BFD_LINKER_FLAG)
|
check_cxx_compiler_flag(-fuse-ld=bfd HAVE_BFD_LINKER_FLAG)
|
||||||
find_program(HAVE_MOLD_LINKER_BIN ld.mold)
|
|
||||||
find_program(HAVE_LLD_LINKER_BIN lld ld.lld)
|
find_program(HAVE_LLD_LINKER_BIN lld ld.lld)
|
||||||
find_program(HAVE_GOLD_LINKER_BIN ld.gold)
|
find_program(HAVE_GOLD_LINKER_BIN ld.gold)
|
||||||
find_program(HAVE_BFD_LINKER_BIN ld.bfd)
|
find_program(HAVE_BFD_LINKER_BIN ld.bfd)
|
||||||
if(HAVE_MOLD_LINKER_FLAG AND HAVE_MOLD_LINKER_BIN)
|
if(HAVE_LLD_LINKER_FLAG AND HAVE_LLD_LINKER_BIN)
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT mold)
|
|
||||||
elseif(HAVE_LLD_LINKER_FLAG AND HAVE_LLD_LINKER_BIN)
|
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT lld)
|
set(CMAKE_CUSTOM_LINKER_DEFAULT lld)
|
||||||
elseif(HAVE_GOLD_LINKER_FLAG AND HAVE_GOLD_LINKER_BIN)
|
elseif(HAVE_GOLD_LINKER_FLAG AND HAVE_GOLD_LINKER_BIN)
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT gold)
|
set(CMAKE_CUSTOM_LINKER_DEFAULT gold)
|
||||||
elseif(HAVE_BFD_LINKER_FLAG AND HAVE_BFD_LINKER_BIN)
|
elseif(HAVE_BFD_LINKER_FLAG AND HAVE_BFD_LINKER_BIN)
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT bfd)
|
set(CMAKE_CUSTOM_LINKER_DEFAULT bfd)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CUSTOM_LINKER_VALUES mold lld gold bfd default)
|
set(CMAKE_CUSTOM_LINKER_VALUES lld gold bfd default)
|
||||||
set(CMAKE_CUSTOM_LINKER ${CMAKE_CUSTOM_LINKER_DEFAULT} CACHE STRING "Choose a custom linker for faster linking (mold, lld, gold, bfd, default)")
|
set(CMAKE_CUSTOM_LINKER ${CMAKE_CUSTOM_LINKER_DEFAULT} CACHE STRING "Choose a custom linker for faster linking (lld, gold, bfd, default)")
|
||||||
validate_option(CMAKE_CUSTOM_LINKER CMAKE_CUSTOM_LINKER_VALUES)
|
validate_option(CMAKE_CUSTOM_LINKER CMAKE_CUSTOM_LINKER_VALUES)
|
||||||
mark_as_advanced(CMAKE_CUSTOM_LINKER)
|
mark_as_advanced(CMAKE_CUSTOM_LINKER)
|
||||||
if(NOT "${CMAKE_CUSTOM_LINKER}" STREQUAL "default")
|
if(NOT "${CMAKE_CUSTOM_LINKER}" STREQUAL "default")
|
||||||
@ -66,8 +62,16 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
||||||
mark_as_advanced(ENABLE_COVERAGE)
|
mark_as_advanced(ENABLE_COVERAGE)
|
||||||
if(ENABLE_COVERAGE)
|
if(ENABLE_COVERAGE)
|
||||||
target_compile_options(lammps PUBLIC --coverage)
|
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||||
target_link_options(lammps PUBLIC --coverage)
|
if(CMAKE_CXX_FLAGS)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
target_compile_options(lammps PUBLIC --coverage)
|
||||||
|
target_link_options(lammps PUBLIC --coverage)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -110,8 +114,16 @@ validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
|
|||||||
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
||||||
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
||||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||||
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||||
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
if(CMAKE_CXX_FLAGS)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
|
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
||||||
set(ENABLE_SANITIZER "none")
|
set(ENABLE_SANITIZER "none")
|
||||||
|
|||||||
@ -26,24 +26,21 @@ if(BUILD_TOOLS)
|
|||||||
|
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
||||||
file(GLOB MSI2LMP_SOURCES CONFIGURE_DEPENDS ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
||||||
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
||||||
if(STANDARD_MATH_LIB)
|
if(STANDARD_MATH_LIB)
|
||||||
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||||
|
|
||||||
add_subdirectory(${LAMMPS_TOOLS_DIR}/phonon ${CMAKE_BINARY_DIR}/phana_build)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(PkgConfig QUIET)
|
|
||||||
if(BUILD_LAMMPS_SHELL)
|
if(BUILD_LAMMPS_SHELL)
|
||||||
if(NOT PkgConfig_FOUND)
|
|
||||||
message(FATAL_ERROR "Must have pkg-config installed for building LAMMPS shell")
|
|
||||||
endif()
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(READLINE IMPORTED_TARGET REQUIRED readline)
|
pkg_check_modules(READLINE IMPORTED_TARGET REQUIRED readline)
|
||||||
|
if(NOT LAMMPS_EXCEPTIONS)
|
||||||
|
message(WARNING "The LAMMPS shell needs LAMMPS_EXCEPTIONS enabled for full functionality")
|
||||||
|
endif()
|
||||||
|
|
||||||
# include resource compiler to embed icons into the executable on Windows
|
# include resource compiler to embed icons into the executable on Windows
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
@ -53,23 +50,15 @@ if(BUILD_LAMMPS_SHELL)
|
|||||||
|
|
||||||
add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp ${ICON_RC_FILE})
|
add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp ${ICON_RC_FILE})
|
||||||
target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell)
|
target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell)
|
||||||
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
|
|
||||||
|
|
||||||
# workaround for broken readline pkg-config file on FreeBSD
|
# workaround for broken readline pkg-config file on FreeBSD
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
target_include_directories(lammps-shell PRIVATE /usr/local/include)
|
target_include_directories(lammps-shell PRIVATE /usr/local/include)
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "LinuxMUSL")
|
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
|
||||||
pkg_check_modules(TERMCAP IMPORTED_TARGET REQUIRED termcap)
|
|
||||||
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::TERMCAP)
|
|
||||||
endif()
|
|
||||||
install(TARGETS lammps-shell EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS lammps-shell EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/lammps-shell/icons DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/)
|
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/lammps-shell/icons DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/)
|
||||||
install(FILES ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/)
|
install(FILES ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_LAMMPS_GUI)
|
|
||||||
get_filename_component(LAMMPS_GUI_DIR ${LAMMPS_SOURCE_DIR}/../tools/lammps-gui ABSOLUTE)
|
|
||||||
get_filename_component(LAMMPS_GUI_BIN ${CMAKE_BINARY_DIR}/lammps-gui-build ABSOLUTE)
|
|
||||||
add_subdirectory(${LAMMPS_GUI_DIR} ${LAMMPS_GUI_BIN})
|
|
||||||
endif()
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 86 KiB |
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en-US</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
|
||||||
<key>CFBundleDisplayName</key>
|
|
||||||
<string>The LAMMPS Molecular Dynamics Software</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>lammps</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>org.lammps.gui</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleLongVersionString</key>
|
|
||||||
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>LAMMPS_GUI</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
|
||||||
<key>CSResourcesFileMapped</key>
|
|
||||||
<true/>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
LAMMPS and LAMMPS GUI universal binaries for macOS (arm64/x86_64)
|
|
||||||
=================================================================
|
|
||||||
|
|
||||||
This package provides universal binaries of LAMMPS and LAMMPS GUI that should
|
|
||||||
run on macOS systems running running macOS version 11 (Big Sur) or newer. Note
|
|
||||||
the binaries are compiled without MPI support and contain a compatible subset
|
|
||||||
of the available packages.
|
|
||||||
|
|
||||||
The following individual commands are included:
|
|
||||||
binary2txt lammps-gui lmp msi2lmp phana stl_bin2txt
|
|
||||||
|
|
||||||
After copying the LAMMPS_GUI folder into your Applications folder, please follow
|
|
||||||
these steps:
|
|
||||||
|
|
||||||
1. Open the Terminal app
|
|
||||||
|
|
||||||
2. Type the following command and press ENTER:
|
|
||||||
|
|
||||||
open ~/.zprofile
|
|
||||||
|
|
||||||
This will open a text editor for modifying the .zprofile file in your home
|
|
||||||
directory.
|
|
||||||
|
|
||||||
3. Add the following lines to the end of the file, save it, and close the editor
|
|
||||||
|
|
||||||
LAMMPS_INSTALL_DIR=/Applications/LAMMPS_GUI.app/Contents
|
|
||||||
LAMMPS_POTENTIALS=${LAMMPS_INSTALL_DIR}/share/lammps/potentials
|
|
||||||
LAMMPS_BENCH_DIR=${LAMMPS_INSTALL_DIR}/share/lammps/bench
|
|
||||||
MSI2LMP_LIBRARY=${LAMMPS_INSTALL_DIR}/share/lammps/frc_files
|
|
||||||
PATH=${LAMMPS_INSTALL_DIR}/bin:$PATH
|
|
||||||
export LAMMPS_POTENTIALS LAMMPS_BENCH_DIR PATH
|
|
||||||
|
|
||||||
4. In your existing terminal, type the following command make the settings active
|
|
||||||
|
|
||||||
source ~/.zprofile
|
|
||||||
|
|
||||||
Note, you don't have to type this in new terminals, since they will apply
|
|
||||||
the changes from .zprofile automatically.
|
|
||||||
|
|
||||||
Note: the above assumes you use the default shell (zsh) that comes with
|
|
||||||
MacOS. If you customized MacOS to use a different shell, you'll need to
|
|
||||||
modify that shell's init file (.cshrc, .bashrc, etc.) instead with
|
|
||||||
appropiate commands to modify the same environment variables.
|
|
||||||
|
|
||||||
5. Try running LAMMPS (which might fail, see step 7)
|
|
||||||
|
|
||||||
lmp -in ${LAMMPS_BENCH_DIR}/in.lj
|
|
||||||
|
|
||||||
6. Try running the LAMMPS GUI
|
|
||||||
|
|
||||||
lammps-gui ${LAMMPS_BENCH_DIR}/in.rhodo
|
|
||||||
|
|
||||||
Depending on the size and resolution of your screen, the fonts may be too
|
|
||||||
small to read. This can be adjusted by setting the environment variable
|
|
||||||
QT_FONT_DPI. The default value would be 72, so to increase the fonts by a
|
|
||||||
third, one can add to the .zprofile file the line
|
|
||||||
|
|
||||||
export QT_FONT_DPI=96
|
|
||||||
|
|
||||||
and reload as shown above.
|
|
||||||
|
|
||||||
7. Give permission to execute the commands (lmp, lammps-gui, msi2lmp, binary2txt, phana, stl_bin2txt)
|
|
||||||
|
|
||||||
MacOS will likely block the initial run of the executables, since they were
|
|
||||||
downloaded from the internet and are missing a known signature from an
|
|
||||||
identified developer. Go to "Settings" and search for "Security settings".
|
|
||||||
It should display a message that an executable like "lmp" was blocked. Press
|
|
||||||
"Open anyway", which might prompt you for your admin credentials. Afterwards
|
|
||||||
"lmp" and the other executables should work as expected.
|
|
||||||
@ -1,77 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
APP_NAME=lammps-gui
|
|
||||||
DESTDIR=${PWD}/../LAMMPS_GUI
|
|
||||||
|
|
||||||
echo "Delete old files, if they exist"
|
|
||||||
rm -rf ${DESTDIR} ../LAMMPS_GUI-Linux-amd64.tar.gz
|
|
||||||
|
|
||||||
echo "Create staging area for deployment and populate"
|
|
||||||
DESTDIR=${DESTDIR} cmake --install . --prefix "/"
|
|
||||||
|
|
||||||
echo "Remove debug info"
|
|
||||||
for s in ${DESTDIR}/bin/* ${DESTDIR}/lib/liblammps*
|
|
||||||
do \
|
|
||||||
test -f $s && strip --strip-debug $s
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Remove libc, gcc, and X11 related shared libs"
|
|
||||||
rm -f ${DESTDIR}/lib/ld*.so ${DESTDIR}/lib/ld*.so.[0-9]
|
|
||||||
rm -f ${DESTDIR}/lib/lib{c,dl,rt,m,pthread}.so.?
|
|
||||||
rm -f ${DESTDIR}/lib/lib{c,dl,rt,m,pthread}-[0-9].[0-9]*.so
|
|
||||||
rm -f ${DESTDIR}/lib/libX* ${DESTDIR}/lib/libxcb*
|
|
||||||
rm -f ${DESTDIR}/lib/libgcc_s*
|
|
||||||
rm -f ${DESTDIR}/lib/libstdc++*
|
|
||||||
|
|
||||||
# get qt dir
|
|
||||||
QTDIR=$(ldd ${DESTDIR}/bin/lammps-gui | grep libQt5Core | sed -e 's/^.*=> *//' -e 's/libQt5Core.so.*$/qt5/')
|
|
||||||
cat > ${DESTDIR}/bin/qt.conf <<EOF
|
|
||||||
[Paths]
|
|
||||||
Plugins = ../qt5plugins
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# platform plugin
|
|
||||||
mkdir -p ${DESTDIR}/qt5plugins/platforms
|
|
||||||
cp ${QTDIR}/plugins/platforms/libqxcb.so ${DESTDIR}/qt5plugins/platforms
|
|
||||||
|
|
||||||
# get platform plugin dependencies
|
|
||||||
QTDEPS=$(LD_LIBRARY_PATH=${DESTDIR}/lib ldd ${QTDIR}/plugins/platforms/libqxcb.so | grep -v ${DESTDIR} | grep libQt5 | sed -e 's/^.*=> *//' -e 's/\(libQt5.*.so.*\) .*$/\1/')
|
|
||||||
for dep in ${QTDEPS}
|
|
||||||
do \
|
|
||||||
cp ${dep} ${DESTDIR}/lib
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Add additional plugins for Qt"
|
|
||||||
for dir in styles imageformats
|
|
||||||
do \
|
|
||||||
cp -r ${QTDIR}/plugins/${dir} ${DESTDIR}/qt5plugins/
|
|
||||||
done
|
|
||||||
|
|
||||||
# get imageplugin dependencies
|
|
||||||
for s in ${DESTDIR}/qt5plugins/imageformats/*.so
|
|
||||||
do \
|
|
||||||
QTDEPS=$(LD_LIBRARY_PATH=${DESTDIR}/lib ldd $s | grep -v ${DESTDIR} | grep -E '(libQt5|jpeg)' | sed -e 's/^.*=> *//' -e 's/\(lib.*.so.*\) .*$/\1/')
|
|
||||||
for dep in ${QTDEPS}
|
|
||||||
do \
|
|
||||||
cp ${dep} ${DESTDIR}/lib
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Set up wrapper script"
|
|
||||||
MYDIR=$(dirname "$0")
|
|
||||||
cp ${MYDIR}/linux_wrapper.sh ${DESTDIR}/bin
|
|
||||||
for s in ${DESTDIR}/bin/*
|
|
||||||
do \
|
|
||||||
EXE=$(basename $s)
|
|
||||||
test ${EXE} = linux_wrapper.sh && continue
|
|
||||||
test ${EXE} = qt.conf && continue
|
|
||||||
ln -s bin/linux_wrapper.sh ${DESTDIR}/${EXE}
|
|
||||||
done
|
|
||||||
|
|
||||||
pushd ..
|
|
||||||
tar -czvvf LAMMPS_GUI-Linux-amd64.tar.gz LAMMPS_GUI
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo "Cleanup dir"
|
|
||||||
rm -r ${DESTDIR}
|
|
||||||
exit 0
|
|
||||||
@ -1,111 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
APP_NAME=lammps-gui
|
|
||||||
|
|
||||||
echo "Delete old files, if they exist"
|
|
||||||
rm -f ${APP_NAME}.dmg ${APP_NAME}-rw.dmg LAMMPS_GUI-macOS-multiarch.dmg
|
|
||||||
|
|
||||||
echo "Create initial dmg file with macdeployqt"
|
|
||||||
macdeployqt lammps-gui.app -dmg
|
|
||||||
echo "Create writable dmg file"
|
|
||||||
hdiutil convert ${APP_NAME}.dmg -format UDRW -o ${APP_NAME}-rw.dmg
|
|
||||||
|
|
||||||
echo "Mount writeable DMG file in read-write mode. Keep track of device and volume names"
|
|
||||||
DEVICE=$(hdiutil attach -readwrite -noverify ${APP_NAME}-rw.dmg | grep '^/dev/' | sed 1q | awk '{print $1}')
|
|
||||||
VOLUME=$(df | grep ${DEVICE} | sed -e 's/^.*\(\/Volumes\/\)/\1/')
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
echo "Create link to Application folder and move README and background image files"
|
|
||||||
|
|
||||||
pushd "${VOLUME}"
|
|
||||||
ln -s /Applications .
|
|
||||||
mv ${APP_NAME}.app/Contents/Resources/README.txt .
|
|
||||||
mkdir .background
|
|
||||||
mv ${APP_NAME}.app/Contents/Resources/LAMMPS_DMG_Background.png .background/background.png
|
|
||||||
mv ${APP_NAME}.app LAMMPS_GUI.app
|
|
||||||
cd LAMMPS_GUI.app/Contents
|
|
||||||
|
|
||||||
echo "Attach icons to LAMMPS console and GUI executables"
|
|
||||||
echo "read 'icns' (-16455) \"Resources/lammps.icns\";" > icon.rsrc
|
|
||||||
Rez -a icon.rsrc -o bin/lmp
|
|
||||||
SetFile -a C bin/lmp
|
|
||||||
Rez -a icon.rsrc -o MacOS/lammps-gui
|
|
||||||
SetFile -a C MacOS/lammps-gui
|
|
||||||
rm icon.rsrc
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo 'Tell the Finder to resize the window, set the background,'
|
|
||||||
echo 'change the icon size, place the icons in the right position, etc.'
|
|
||||||
echo '
|
|
||||||
tell application "Finder"
|
|
||||||
tell disk "'${APP_NAME}'"
|
|
||||||
|
|
||||||
-- wait for the image to finish mounting
|
|
||||||
set open_attempts to 0
|
|
||||||
repeat while open_attempts < 4
|
|
||||||
try
|
|
||||||
open
|
|
||||||
delay 1
|
|
||||||
set open_attempts to 5
|
|
||||||
close
|
|
||||||
on error errStr number errorNumber
|
|
||||||
set open_attempts to open_attempts + 1
|
|
||||||
delay 10
|
|
||||||
end try
|
|
||||||
end repeat
|
|
||||||
delay 5
|
|
||||||
|
|
||||||
-- open the image the first time and save a .DS_Store
|
|
||||||
-- just the background and icon setup
|
|
||||||
open
|
|
||||||
set current view of container window to icon view
|
|
||||||
set theViewOptions to the icon view options of container window
|
|
||||||
set background picture of theViewOptions to file ".background:background.png"
|
|
||||||
set arrangement of theViewOptions to not arranged
|
|
||||||
set icon size of theViewOptions to 64
|
|
||||||
delay 5
|
|
||||||
close
|
|
||||||
|
|
||||||
-- next set up the position of the app and Applications symlink
|
|
||||||
-- plus hide all window decorations
|
|
||||||
open
|
|
||||||
update without registering applications
|
|
||||||
tell container window
|
|
||||||
set sidebar width to 0
|
|
||||||
set statusbar visible to false
|
|
||||||
set toolbar visible to false
|
|
||||||
set the bounds to { 100, 40, 868, 640 }
|
|
||||||
set position of item "'LAMMPS_GUI'.app" to { 190, 216 }
|
|
||||||
set position of item "Applications" to { 576, 216 }
|
|
||||||
set position of item "README.txt" to { 190, 400 }
|
|
||||||
end tell
|
|
||||||
update without registering applications
|
|
||||||
delay 5
|
|
||||||
close
|
|
||||||
|
|
||||||
-- one last open and close to check the results
|
|
||||||
open
|
|
||||||
delay 5
|
|
||||||
close
|
|
||||||
end tell
|
|
||||||
delay 1
|
|
||||||
end tell
|
|
||||||
' | osascript
|
|
||||||
|
|
||||||
sync
|
|
||||||
|
|
||||||
echo "Unmount modified disk image and convert to compressed read-only image"
|
|
||||||
hdiutil detach "${DEVICE}"
|
|
||||||
hdiutil convert "${APP_NAME}-rw.dmg" -format UDZO -o "LAMMPS_GUI-macOS-multiarch.dmg"
|
|
||||||
|
|
||||||
echo "Attach icon to .dmg file"
|
|
||||||
echo "read 'icns' (-16455) \"lammps-gui.app/Contents/Resources/lammps.icns\";" > icon.rsrc
|
|
||||||
Rez -a icon.rsrc -o LAMMPS_GUI-macOS-multiarch.dmg
|
|
||||||
SetFile -a C LAMMPS_GUI-macOS-multiarch.dmg
|
|
||||||
rm icon.rsrc
|
|
||||||
|
|
||||||
echo "Delete temporary disk images"
|
|
||||||
rm -f "${APP_NAME}-rw.dmg"
|
|
||||||
rm -f "${APP_NAME}.dmg"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
APP_NAME=lammps-gui
|
|
||||||
DESTDIR=${PWD}/LAMMPS_GUI
|
|
||||||
SYSROOT="$1"
|
|
||||||
|
|
||||||
echo "Delete old files, if they exist"
|
|
||||||
rm -rvf ${DESTDIR}/LAMMPS_GUI ${DESTDIR}/LAMMPS-Win10-amd64.zip
|
|
||||||
|
|
||||||
echo "Create staging area for deployment and populate"
|
|
||||||
DESTDIR=${DESTDIR} cmake --install . --prefix "/"
|
|
||||||
|
|
||||||
# no static libs needed
|
|
||||||
rm -rvf ${DESTDIR}/lib
|
|
||||||
# but the LAMMPS lib
|
|
||||||
|
|
||||||
echo "Copying required DLL files"
|
|
||||||
for dll in $(objdump -p *.exe *.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq)
|
|
||||||
do \
|
|
||||||
doskip=0
|
|
||||||
for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32
|
|
||||||
do \
|
|
||||||
test ${dll} = ${skip}.dll && doskip=1
|
|
||||||
done
|
|
||||||
test ${doskip} -eq 1 && continue
|
|
||||||
test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Copy required Qt plugins"
|
|
||||||
mkdir -p ${DESTDIR}/qt5plugins
|
|
||||||
for plugin in imageformats platforms styles
|
|
||||||
do \
|
|
||||||
cp -r ${SYSROOT}/lib/qt5/plugins/${plugin} ${DESTDIR}/qt5plugins/
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Check dependencies of DLL files"
|
|
||||||
for dll in $(objdump -p ${DESTDIR}/bin/*.dll ${DESTDIR}/qt5plugins/*/*.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq)
|
|
||||||
do \
|
|
||||||
doskip=0
|
|
||||||
for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32
|
|
||||||
do \
|
|
||||||
test ${dll} = ${skip}.dll && doskip=1
|
|
||||||
done
|
|
||||||
test ${doskip} -eq 1 && continue
|
|
||||||
test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin
|
|
||||||
done
|
|
||||||
|
|
||||||
for dll in $(objdump -p ${DESTDIR}/bin/*.dll ${DESTDIR}/qt5plugins/*/*.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq)
|
|
||||||
do \
|
|
||||||
doskip=0
|
|
||||||
for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32
|
|
||||||
do \
|
|
||||||
test ${dll} = ${skip}.dll && doskip=1
|
|
||||||
done
|
|
||||||
test ${doskip} -eq 1 && continue
|
|
||||||
test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin
|
|
||||||
done
|
|
||||||
|
|
||||||
cat > ${DESTDIR}/bin/qt.conf <<EOF
|
|
||||||
[Paths]
|
|
||||||
Plugins = ../qt5plugins
|
|
||||||
EOF
|
|
||||||
zip -9rvD LAMMPS-Win10-amd64.zip LAMMPS_GUI
|
|
||||||
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# CMake script to be run post installation to build zipped package
|
|
||||||
|
|
||||||
# clean up old zipfile and deployment tree
|
|
||||||
file(REMOVE LAMMPS_GUI-Win10-amd64.zip)
|
|
||||||
file(REMOVE_RECURSE LAMMPS_GUI)
|
|
||||||
file(RENAME ${INSTNAME} LAMMPS_GUI)
|
|
||||||
|
|
||||||
# move all executables and dlls to main folder and delete bin folder
|
|
||||||
file(GLOB BINFILES LIST_DIRECTORIES FALSE LAMMPS_GUI/bin/*.exe LAMMPS_GUI/bin/*.dll)
|
|
||||||
foreach(bin ${BINFILES})
|
|
||||||
get_filename_component(exe ${bin} NAME)
|
|
||||||
file(RENAME ${bin} LAMMPS_GUI/${exe})
|
|
||||||
endforeach()
|
|
||||||
file(REMOVE_RECURSE LAMMPS_GUI/bin)
|
|
||||||
|
|
||||||
# create qt.conf so Qt will find its plugins
|
|
||||||
file(WRITE LAMMPS_GUI/qt.conf "[Paths]\r\nPlugins = qt5plugins\r\n")
|
|
||||||
|
|
||||||
# initialize environment and then run windeployqt to populate folder with missing dependencies and Qt plugins
|
|
||||||
file(WRITE qtdeploy.bat "@ECHO OFF\r\nset VSCMD_DEBUG=0\r\nCALL ${VC_INIT} x64\r\nset PATH=${QT5_BIN_DIR};%PATH%\r\nwindeployqt --plugindir LAMMPS_GUI/qt5plugins --release LAMMPS_GUI/lammps-gui.exe --no-quick-import --no-webkit2 --no-translations --no-system-d3d-compiler --no-angle --no-opengl-sw\r\n")
|
|
||||||
execute_process(COMMAND cmd.exe /c qtdeploy.bat COMMAND_ECHO STDERR)
|
|
||||||
file(REMOVE qtdeploy.bat)
|
|
||||||
|
|
||||||
# download and uncompress static FFMpeg and gzip binaries
|
|
||||||
file(DOWNLOAD "https://download.lammps.org/thirdparty/ffmpeg-gzip.zip" ffmpeg-gzip.zip)
|
|
||||||
file(WRITE unpackzip.ps1 "Expand-Archive -Path ffmpeg-gzip.zip -DestinationPath LAMMPS_GUI")
|
|
||||||
execute_process(COMMAND powershell -ExecutionPolicy Bypass -File unpackzip.ps1)
|
|
||||||
file(REMOVE unpackzip.ps1)
|
|
||||||
file(REMOVE ffmpeg-gzip.zip)
|
|
||||||
|
|
||||||
# create zip archive
|
|
||||||
file(WRITE makearchive.ps1 "Compress-Archive -Path LAMMPS_GUI -CompressionLevel Optimal -DestinationPath LAMMPS_GUI-Win10-amd64.zip")
|
|
||||||
execute_process(COMMAND powershell -ExecutionPolicy Bypass -File makearchive.ps1)
|
|
||||||
file(REMOVE makearchive.ps1)
|
|
||||||
file(REMOVE_RECURSE LAMMPS_GUI)
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 598 KiB |
Binary file not shown.
@ -1,18 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# wrapper for bundled executables
|
|
||||||
|
|
||||||
# reset locale to avoid problems with decimal numbers
|
|
||||||
export LC_ALL=C
|
|
||||||
|
|
||||||
BASEDIR=$(dirname "$0")
|
|
||||||
EXENAME=$(basename "$0")
|
|
||||||
|
|
||||||
# append to LD_LIBRARY_PATH to prefer local (newer) libs
|
|
||||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${BASEDIR}/lib
|
|
||||||
|
|
||||||
# set some environment variables for LAMMPS etc.
|
|
||||||
LAMMPS_POTENTIALS=${BASEDIR}/share/lammps/potentials
|
|
||||||
MSI2LMP_LIBRARY=${BASEDIR}/share/lammps/frc_files
|
|
||||||
export LD_LIBRARY_PATH LAMMPS_POTENTIALS MSI2LMP_LIBRARY
|
|
||||||
|
|
||||||
exec "${BASEDIR}/bin/${EXENAME}" "$@"
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ $# != 2 ]
|
|
||||||
then
|
|
||||||
echo "usage: $0 <pngfile> <iconset name>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
png="$1"
|
|
||||||
ico="$2"
|
|
||||||
|
|
||||||
if [ ! -f ${png} ]
|
|
||||||
then
|
|
||||||
echo "PNG Image $1 not found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf ${ico}.iconset
|
|
||||||
mkdir ${ico}.iconset
|
|
||||||
sips -z 16 16 ${png} --out ${ico}.iconset/icon_16x16.png
|
|
||||||
sips -z 32 32 ${png} --out ${ico}.iconset/icon_16x16@2x.png
|
|
||||||
sips -z 32 32 ${png} --out ${ico}.iconset/icon_32x32.png
|
|
||||||
sips -z 64 64 ${png} --out ${ico}.iconset/icon_32x32@2x.png
|
|
||||||
sips -z 128 128 ${png} --out ${ico}.iconset/icon_128x128.png
|
|
||||||
sips -z 256 256 ${png} --out ${ico}.iconset/icon_128x128@2x.png
|
|
||||||
sips -z 256 256 ${png} --out ${ico}.iconset/icon_256x256.png
|
|
||||||
sips -z 512 512 ${png} --out ${ico}.iconset/icon_256x256@2x.png
|
|
||||||
sips -z 512 512 ${png} --out ${ico}.iconset/icon_512x512.png
|
|
||||||
sips -z 1024 1024 ${png} --out ${ico}.iconset/icon_512x512@2x.png
|
|
||||||
iconutil -c icns ${ico}.iconset
|
|
||||||
rm -rf ${ico}.iconset
|
|
||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
set(ALL_PACKAGES
|
set(ALL_PACKAGES
|
||||||
ADIOS
|
ADIOS
|
||||||
AMOEBA
|
|
||||||
ASPHERE
|
ASPHERE
|
||||||
ATC
|
ATC
|
||||||
AWPMD
|
AWPMD
|
||||||
@ -12,7 +11,7 @@ set(ALL_PACKAGES
|
|||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SPICA
|
CG-SDK
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -43,7 +42,7 @@ set(ALL_PACKAGES
|
|||||||
KOKKOS
|
KOKKOS
|
||||||
KSPACE
|
KSPACE
|
||||||
LATBOLTZ
|
LATBOLTZ
|
||||||
LEPTON
|
LATTE
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
@ -56,13 +55,14 @@ set(ALL_PACKAGES
|
|||||||
ML-HDNNP
|
ML-HDNNP
|
||||||
ML-IAP
|
ML-IAP
|
||||||
ML-PACE
|
ML-PACE
|
||||||
ML-POD
|
|
||||||
ML-QUIP
|
ML-QUIP
|
||||||
ML-RANN
|
ML-RANN
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
|
MPIIO
|
||||||
|
MSCG
|
||||||
NETCDF
|
NETCDF
|
||||||
OPENMP
|
OPENMP
|
||||||
OPT
|
OPT
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
set(ALL_PACKAGES
|
set(ALL_PACKAGES
|
||||||
ADIOS
|
ADIOS
|
||||||
AMOEBA
|
|
||||||
ASPHERE
|
ASPHERE
|
||||||
ATC
|
ATC
|
||||||
AWPMD
|
AWPMD
|
||||||
@ -14,7 +13,7 @@ set(ALL_PACKAGES
|
|||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SPICA
|
CG-SDK
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -45,7 +44,7 @@ set(ALL_PACKAGES
|
|||||||
KOKKOS
|
KOKKOS
|
||||||
KSPACE
|
KSPACE
|
||||||
LATBOLTZ
|
LATBOLTZ
|
||||||
LEPTON
|
LATTE
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
@ -58,13 +57,14 @@ set(ALL_PACKAGES
|
|||||||
ML-HDNNP
|
ML-HDNNP
|
||||||
ML-IAP
|
ML-IAP
|
||||||
ML-PACE
|
ML-PACE
|
||||||
ML-POD
|
|
||||||
ML-QUIP
|
ML-QUIP
|
||||||
ML-RANN
|
ML-RANN
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
|
MPIIO
|
||||||
|
MSCG
|
||||||
NETCDF
|
NETCDF
|
||||||
OPENMP
|
OPENMP
|
||||||
OPT
|
OPT
|
||||||
|
|||||||
@ -3,13 +3,6 @@
|
|||||||
# prefer flang over gfortran, if available
|
# prefer flang over gfortran, if available
|
||||||
find_program(CLANG_FORTRAN NAMES flang gfortran f95)
|
find_program(CLANG_FORTRAN NAMES flang gfortran f95)
|
||||||
set(ENV{OMPI_FC} ${CLANG_FORTRAN})
|
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_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
||||||
@ -17,9 +10,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_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g ${FC_STD_VERSION}" 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 ${FC_STD_VERSION}" 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 ${FC_STD_VERSION}" CACHE STRING "" FORCE)
|
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" 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_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
# Preset that turns on packages with automatic downloads of sources or potentials.
|
# Preset that turns on packages with automatic downloads of sources or potentials.
|
||||||
# Compilation of libraries like Plumed or ScaFaCoS can take a considerable amount of time.
|
# Compilation of libraries like Plumed or ScaFaCoS can take a considerable amount of time.
|
||||||
|
|
||||||
set(ALL_PACKAGES KIM MSCG VORONOI PLUMED SCAFACOS MACHDYN MESONT MDI ML-PACE)
|
set(ALL_PACKAGES KIM LATTE MSCG VORONOI PLUMED SCAFACOS MACHDYN MESONT MDI ML-PACE)
|
||||||
|
|
||||||
foreach(PKG ${ALL_PACKAGES})
|
foreach(PKG ${ALL_PACKAGES})
|
||||||
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DOWNLOAD_KIM ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_KIM ON CACHE BOOL "" FORCE)
|
||||||
|
set(DOWNLOAD_LATTE ON CACHE BOOL "" FORCE)
|
||||||
set(DOWNLOAD_MDI ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_MDI ON CACHE BOOL "" FORCE)
|
||||||
|
set(DOWNLOAD_MSCG ON CACHE BOOL "" FORCE)
|
||||||
set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
|
||||||
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
|
||||||
set(DOWNLOAD_PACE ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_PACE ON CACHE BOOL "" FORCE)
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
# preset that enables GPU and selects CUDA API
|
|
||||||
|
|
||||||
set(PKG_GPU ON CACHE BOOL "Build GPU package" FORCE)
|
|
||||||
set(GPU_API "cuda" CACHE STRING "APU used by GPU package" FORCE)
|
|
||||||
set(GPU_PREC "mixed" CACHE STRING "" FORCE)
|
|
||||||
|
|
||||||
set(CUDA_NVCC_FLAGS "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
|
||||||
set(CUDA_NVCC_FLAGS_DEBUG "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
|
||||||
set(CUDA_NVCC_FLAGS_MINSIZEREL "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
|
||||||
set(CUDA_NVCC_FLAGS_RELWITHDEBINFO "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
|
||||||
set(CUDA_NVCC_FLAGS_RELEASE "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# preset that will enable the classic Intel compilers with support for MPI and OpenMP (on Linux boxes)
|
# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes)
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
|
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
|
||||||
@ -18,11 +18,11 @@ set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
|||||||
|
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
set(OpenMP_C "icc" CACHE STRING "" FORCE)
|
set(OpenMP_C "icc" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_C_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX "icpc" CACHE STRING "" FORCE)
|
set(OpenMP_CXX "icpc" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_Fortran_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
||||||
|
|
||||||
|
|||||||
@ -6,11 +6,6 @@ set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
|||||||
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
||||||
set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE)
|
set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE)
|
||||||
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||||
get_filename_component(NVCC_WRAPPER_CMD ${CMAKE_CURRENT_SOURCE_DIR}/../lib/kokkos/bin/nvcc_wrapper ABSOLUTE)
|
|
||||||
set(CMAKE_CXX_COMPILER ${NVCC_WRAPPER_CMD} CACHE FILEPATH "" FORCE)
|
|
||||||
|
|
||||||
# If KSPACE is also enabled, use CUFFT for FFTs
|
|
||||||
set(FFT_KOKKOS "CUFFT" CACHE STRING FORCE)
|
|
||||||
|
|
||||||
# hide deprecation warnings temporarily for stable release
|
# hide deprecation warnings temporarily for stable release
|
||||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||||
|
|||||||
@ -12,9 +12,6 @@ set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
|||||||
set(CMAKE_CXX_COMPILER hipcc CACHE STRING "" FORCE)
|
set(CMAKE_CXX_COMPILER hipcc CACHE STRING "" FORCE)
|
||||||
set(CMAKE_TUNE_FLAGS "-munsafe-fp-atomics" CACHE STRING "" FORCE)
|
set(CMAKE_TUNE_FLAGS "-munsafe-fp-atomics" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
# If KSPACE is also enabled, use CUFFT for FFTs
|
|
||||||
set(FFT_KOKKOS "HIPFFT" CACHE STRING FORCE)
|
|
||||||
|
|
||||||
# hide deprecation warnings temporarily for stable release
|
# hide deprecation warnings temporarily for stable release
|
||||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
# preset that will build portable multi-arch binaries on macOS without MPI
|
|
||||||
|
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0 CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
|
||||||
|
|
||||||
set(BUILD_MPI FALSE CACHE BOOL "" FORCE)
|
|
||||||
@ -1,5 +1,4 @@
|
|||||||
set(WIN_PACKAGES
|
set(WIN_PACKAGES
|
||||||
AMOEBA
|
|
||||||
ASPHERE
|
ASPHERE
|
||||||
ATC
|
ATC
|
||||||
AWPMD
|
AWPMD
|
||||||
@ -8,7 +7,7 @@ set(WIN_PACKAGES
|
|||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SPICA
|
CG-SDK
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -35,7 +34,7 @@ set(WIN_PACKAGES
|
|||||||
INTEL
|
INTEL
|
||||||
INTERLAYER
|
INTERLAYER
|
||||||
KSPACE
|
KSPACE
|
||||||
LEPTON
|
LATTE
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
@ -47,7 +46,6 @@ set(WIN_PACKAGES
|
|||||||
MISC
|
MISC
|
||||||
ML-HDNNP
|
ML-HDNNP
|
||||||
ML-IAP
|
ML-IAP
|
||||||
ML-POD
|
|
||||||
ML-RANN
|
ML-RANN
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
@ -83,6 +81,7 @@ endforeach()
|
|||||||
|
|
||||||
# these two packages require a full MPI implementation
|
# these two packages require a full MPI implementation
|
||||||
if(BUILD_MPI)
|
if(BUILD_MPI)
|
||||||
|
set(PKG_MPIIO ON CACHE BOOL "" FORCE)
|
||||||
set(PKG_LATBOLTZ ON CACHE BOOL "" FORCE)
|
set(PKG_LATBOLTZ ON CACHE BOOL "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -3,14 +3,13 @@
|
|||||||
# are removed. The resulting binary should be able to run most inputs.
|
# are removed. The resulting binary should be able to run most inputs.
|
||||||
|
|
||||||
set(ALL_PACKAGES
|
set(ALL_PACKAGES
|
||||||
AMOEBA
|
|
||||||
ASPHERE
|
ASPHERE
|
||||||
BOCS
|
BOCS
|
||||||
BODY
|
BODY
|
||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SPICA
|
CG-SDK
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -24,8 +23,8 @@ set(ALL_PACKAGES
|
|||||||
DPD-REACT
|
DPD-REACT
|
||||||
DPD-SMOOTH
|
DPD-SMOOTH
|
||||||
DRUDE
|
DRUDE
|
||||||
EFF
|
|
||||||
ELECTRODE
|
ELECTRODE
|
||||||
|
EFF
|
||||||
EXTRA-COMPUTE
|
EXTRA-COMPUTE
|
||||||
EXTRA-DUMP
|
EXTRA-DUMP
|
||||||
EXTRA-FIX
|
EXTRA-FIX
|
||||||
@ -35,15 +34,12 @@ set(ALL_PACKAGES
|
|||||||
GRANULAR
|
GRANULAR
|
||||||
INTERLAYER
|
INTERLAYER
|
||||||
KSPACE
|
KSPACE
|
||||||
LEPTON
|
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANYBODY
|
MANYBODY
|
||||||
MC
|
MC
|
||||||
MEAM
|
MEAM
|
||||||
MESONT
|
|
||||||
MISC
|
MISC
|
||||||
ML-IAP
|
ML-IAP
|
||||||
ML-POD
|
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
|
|||||||
@ -12,13 +12,16 @@ set(PACKAGES_WITH_LIB
|
|||||||
KIM
|
KIM
|
||||||
KOKKOS
|
KOKKOS
|
||||||
LATBOLTZ
|
LATBOLTZ
|
||||||
LEPTON
|
LATTE
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MDI
|
MDI
|
||||||
|
MESONT
|
||||||
ML-HDNNP
|
ML-HDNNP
|
||||||
ML-PACE
|
ML-PACE
|
||||||
ML-QUIP
|
ML-QUIP
|
||||||
MOLFILE
|
MOLFILE
|
||||||
|
MPIIO
|
||||||
|
MSCG
|
||||||
NETCDF
|
NETCDF
|
||||||
PLUMED
|
PLUMED
|
||||||
PYTHON
|
PYTHON
|
||||||
|
|||||||
@ -18,11 +18,11 @@ set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
|||||||
|
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
set(OpenMP_C "icx" CACHE STRING "" FORCE)
|
set(OpenMP_C "icx" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_C_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX "icpx" CACHE STRING "" FORCE)
|
set(OpenMP_CXX "icpx" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_Fortran_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
set(WIN_PACKAGES
|
set(WIN_PACKAGES
|
||||||
AMOEBA
|
|
||||||
ASPHERE
|
ASPHERE
|
||||||
AWPMD
|
|
||||||
BOCS
|
BOCS
|
||||||
BODY
|
BODY
|
||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SPICA
|
CG-SDK
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -21,7 +19,6 @@ set(WIN_PACKAGES
|
|||||||
DPD-SMOOTH
|
DPD-SMOOTH
|
||||||
DRUDE
|
DRUDE
|
||||||
EFF
|
EFF
|
||||||
ELECTRODE
|
|
||||||
EXTRA-COMPUTE
|
EXTRA-COMPUTE
|
||||||
EXTRA-DUMP
|
EXTRA-DUMP
|
||||||
EXTRA-FIX
|
EXTRA-FIX
|
||||||
@ -31,22 +28,17 @@ set(WIN_PACKAGES
|
|||||||
GRANULAR
|
GRANULAR
|
||||||
INTERLAYER
|
INTERLAYER
|
||||||
KSPACE
|
KSPACE
|
||||||
LEPTON
|
|
||||||
MACHDYN
|
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
MC
|
MC
|
||||||
MEAM
|
MEAM
|
||||||
MESONT
|
|
||||||
MISC
|
MISC
|
||||||
ML-IAP
|
ML-IAP
|
||||||
ML-POD
|
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
OPENMP
|
OPENMP
|
||||||
OPT
|
|
||||||
ORIENT
|
ORIENT
|
||||||
PERI
|
PERI
|
||||||
PHONON
|
PHONON
|
||||||
|
|||||||
68
doc/Makefile
68
doc/Makefile
@ -45,7 +45,7 @@ SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocess
|
|||||||
# we only want to use explicitly listed files.
|
# we only want to use explicitly listed files.
|
||||||
DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//')
|
DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//')
|
||||||
|
|
||||||
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check role_check xmlgen fasthtml
|
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check xmlgen fasthtml
|
||||||
|
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
|
|
||||||
@ -63,7 +63,6 @@ help:
|
|||||||
@echo " anchor_check scan for duplicate anchor labels"
|
@echo " anchor_check scan for duplicate anchor labels"
|
||||||
@echo " style_check check for complete and consistent style lists"
|
@echo " style_check check for complete and consistent style lists"
|
||||||
@echo " package_check check for complete and consistent package lists"
|
@echo " package_check check for complete and consistent package lists"
|
||||||
@echo " role_check check for misformatted role keywords"
|
|
||||||
@echo " spelling spell-check the manual"
|
@echo " spelling spell-check the manual"
|
||||||
|
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
@ -87,21 +86,17 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
|||||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
||||||
sphinx-build -E $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
sphinx-build -E $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
||||||
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
touch $(RSTDIR)/Fortran.rst ;\
|
||||||
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
||||||
ln -sf Manual.html html/index.html;\
|
ln -sf Manual.html html/index.html;\
|
||||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||||
echo "############################################" ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
echo "############################################" ;\
|
||||||
rst_anchor_check src/*.rst ;\
|
rst_anchor_check src/*.rst ;\
|
||||||
$(PYTHON) $(BUILDDIR)/utils/check-packages.py -s ../src -d src ;\
|
python $(BUILDDIR)/utils/check-packages.py -s ../src -d src ;\
|
||||||
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
||||||
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
|
python $(BUILDDIR)/utils/check-styles.py -s ../src -d src ;\
|
||||||
env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst ;\
|
|
||||||
env LC_ALL=C grep -n ':\(ref\|doc\):[^`]' $(RSTDIR)/*.rst ;\
|
|
||||||
env LC_ALL=C grep -n '\(ref\|doc\)`[^`]' $(RSTDIR)/*.rst ;\
|
|
||||||
$(PYTHON) $(BUILDDIR)/utils/check-styles.py -s ../src -d src ;\
|
|
||||||
echo "############################################" ;\
|
echo "############################################" ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
@ -118,9 +113,9 @@ fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
|||||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||||
@mkdir -p fasthtml
|
@mkdir -p fasthtml
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
||||||
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
||||||
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
touch $(RSTDIR)/Fortran.rst ;\
|
||||||
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
@ -135,8 +130,8 @@ fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
|||||||
spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
||||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; \
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
||||||
cp $(SPHINXCONFIG)/false_positives.txt $(RSTDIR)/; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
cp $(SPHINXCONFIG)/false_positives.txt $(RSTDIR)/ ; env PYTHONWARNINGS= \
|
||||||
sphinx-build -b spelling -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
sphinx-build -b spelling -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
||||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
@ -150,9 +145,9 @@ epub: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
|||||||
@rm -f LAMMPS.epub
|
@rm -f LAMMPS.epub
|
||||||
@cp src/JPG/*.* epub/JPG
|
@cp src/JPG/*.* epub/JPG
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
. $(VENV)/bin/activate ;\
|
||||||
sphinx-build -E $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
sphinx-build -E $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
||||||
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
touch $(RSTDIR)/Fortran.rst ;\
|
||||||
sphinx-build $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
sphinx-build $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
||||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
@ -171,20 +166,16 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
|||||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||||
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi
|
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
||||||
sphinx-build -E $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
sphinx-build -E $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
||||||
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
touch $(RSTDIR)/Fortran.rst ;\
|
||||||
sphinx-build $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
sphinx-build $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
||||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||||
echo "############################################" ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
echo "############################################" ;\
|
||||||
rst_anchor_check src/*.rst ;\
|
rst_anchor_check src/*.rst ;\
|
||||||
$(PYTHON) utils/check-packages.py -s ../src -d src ;\
|
python utils/check-packages.py -s ../src -d src ;\
|
||||||
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
||||||
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
|
python utils/check-styles.py -s ../src -d src ;\
|
||||||
env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst ;\
|
|
||||||
env LC_ALL=C grep -n ':\(ref\|doc\):[^`]' $(RSTDIR)/*.rst ;\
|
|
||||||
env LC_ALL=C grep -n '\(ref\|doc\)`[^`]' $(RSTDIR)/*.rst ;\
|
|
||||||
$(PYTHON) utils/check-styles.py -s ../src -d src ;\
|
|
||||||
echo "############################################" ;\
|
echo "############################################" ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
@ -207,41 +198,28 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
|||||||
|
|
||||||
anchor_check : $(ANCHORCHECK)
|
anchor_check : $(ANCHORCHECK)
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
. $(VENV)/bin/activate ;\
|
||||||
rst_anchor_check src/*.rst ;\
|
rst_anchor_check src/*.rst ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
|
|
||||||
style_check : $(VENV)
|
style_check : $(VENV)
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
. $(VENV)/bin/activate ;\
|
||||||
$(PYTHON) utils/check-styles.py -s ../src -d src ;\
|
python utils/check-styles.py -s ../src -d src ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
|
|
||||||
package_check : $(VENV)
|
package_check : $(VENV)
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
. $(VENV)/bin/activate ;\
|
||||||
$(PYTHON) utils/check-packages.py -s ../src -d src ;\
|
python utils/check-packages.py -s ../src -d src ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
|
|
||||||
char_check :
|
char_check :
|
||||||
@( env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst && exit 1 || : )
|
@( env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst && exit 1 || : )
|
||||||
|
|
||||||
role_check :
|
|
||||||
@( env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst && exit 1 || : )
|
|
||||||
@( env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst && exit 1 || : )
|
|
||||||
@( env LC_ALL=C grep -n ':\(ref\|doc\):[^`]' $(RSTDIR)/*.rst && exit 1 || : )
|
|
||||||
@( env LC_ALL=C grep -n '\(ref\|doc\)`[^`]' $(RSTDIR)/*.rst && exit 1 || : )
|
|
||||||
|
|
||||||
link_check : $(VENV) html
|
|
||||||
@(\
|
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
|
||||||
linkchecker -F html --check-extern html/Manual.html ;\
|
|
||||||
deactivate ;\
|
|
||||||
)
|
|
||||||
|
|
||||||
xmlgen : doxygen/xml/index.xml
|
xmlgen : doxygen/xml/index.xml
|
||||||
|
|
||||||
doxygen/Doxyfile: doxygen/Doxyfile.in
|
doxygen/Doxyfile: doxygen/Doxyfile.in
|
||||||
@ -269,7 +247,7 @@ $(MATHJAX):
|
|||||||
|
|
||||||
$(ANCHORCHECK): $(VENV)
|
$(ANCHORCHECK): $(VENV)
|
||||||
@( \
|
@( \
|
||||||
. $(VENV)/bin/activate; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
. $(VENV)/bin/activate; \
|
||||||
pip $(PIP_OPTIONS) install -e utils/converters;\
|
pip $(PIP_OPTIONS) install -e utils/converters;\
|
||||||
deactivate;\
|
deactivate;\
|
||||||
)
|
)
|
||||||
|
|||||||
@ -40,9 +40,8 @@ environment and local folders.
|
|||||||
Installing prerequisites for the documentation build
|
Installing prerequisites for the documentation build
|
||||||
|
|
||||||
To run the HTML documention build toolchain, python 3.x, doxygen, git,
|
To run the HTML documention build toolchain, python 3.x, doxygen, git,
|
||||||
and the venv python module have to be installed if not already available.
|
and virtualenv have to be installed. Also internet access is initially
|
||||||
Also internet access is initially required to download external files
|
required to download external files and tools.
|
||||||
and tools.
|
|
||||||
|
|
||||||
Building the PDF format manual requires in addition a compatible LaTeX
|
Building the PDF format manual requires in addition a compatible LaTeX
|
||||||
installation with support for PDFLaTeX and several add-on LaTeX packages
|
installation with support for PDFLaTeX and several add-on LaTeX packages
|
||||||
|
|||||||
@ -4,44 +4,45 @@ This purpose of this document is to provide a point of reference
|
|||||||
for LAMMPS developers and contributors as to what conventions
|
for LAMMPS developers and contributors as to what conventions
|
||||||
should be used to structure and format files in the LAMMPS manual.
|
should be used to structure and format files in the LAMMPS manual.
|
||||||
|
|
||||||
Last change: 2022-12-30
|
Last change: 2020-04-23
|
||||||
|
|
||||||
## File format and tools
|
## File format and tools
|
||||||
|
|
||||||
In fall 2019, the LAMMPS documentation file format has changed from a
|
In fall 2019, the LAMMPS documentation file format has changed from
|
||||||
home grown markup designed to generate HTML format files only, to
|
a home grown minimal markup designed to generate HTML format files
|
||||||
[reStructuredText](https://docutils.sourceforge.io/rst.html>. For a
|
from a mostly plain text format to using the reStructuredText file
|
||||||
transition period all files in the old .txt format were transparently
|
format. For a transition period all files in the old .txt format
|
||||||
converted to .rst and then processed. The `txt2rst tool` is still
|
were transparently converted to .rst and then processed. The txt2rst
|
||||||
included in the distribution to obtain an initial .rst file for legacy
|
tool is still included in the distribution to obtain an initial .rst
|
||||||
integration into the manual. Since that transition to reStructured
|
file for integration into the manual. Since the transition to
|
||||||
text, many of the artifacts of the translation have been removed though,
|
reStructured text as source format, many of the artifacts or the
|
||||||
and parts of the documentation refactored and expanded to take advantage
|
translation have been removed though and parts of the documentation
|
||||||
of the capabilities reStructuredText and associated tools. The
|
refactored and expanded to take advantage of the capabilities
|
||||||
conversion from the source to the final formats (HTML, PDF, and
|
reStructuredText and associated tools. The conversion from the
|
||||||
optionally e-book reader formats ePUB and MOBI) is mostly automated and
|
source to the final formats (HTML, PDF, and optionally e-book
|
||||||
controlled by a Makefile in the `doc` folder. This makefile assumes that
|
reader formats ePUB and MOBI) is mostly automated and controlled
|
||||||
the processing is done on a Unix-like machine and Python 3.5 or later
|
by a Makefile in the `doc` folder. This makefile assumes that the
|
||||||
and a matching venv module are available. Additional Python
|
processing is done on a Unix-like machine and Python 3.5 or later
|
||||||
packages (like the Sphinx tool and several extensions) are transparently
|
and a matching virtualenv module are available. Additional Python
|
||||||
installed into a virtual environment over the internet using the `pip`
|
packages (like the Sphinx tool and several extensions) are
|
||||||
package manager. Further requirements and details are discussed in the
|
transparently installed into a virtual environment over the
|
||||||
manual.
|
internet using the `pip` package manager. Further requirements
|
||||||
|
and details are discussed in the manual.
|
||||||
|
|
||||||
## Work in progress
|
## Work in progress
|
||||||
|
|
||||||
The refactoring and improving of the documentation is an ongoing
|
The refactoring and improving of the documentation is an ongoing
|
||||||
process, so statements in this document may not always be fully
|
process, so statements in this document may not always be fully
|
||||||
up-to-date. When in doubt, contact the LAMMPS developers.
|
up-to-date. If in doubt, contact the LAMMPS developers.
|
||||||
|
|
||||||
## General structure
|
## General structure
|
||||||
|
|
||||||
The layout and formatting of added files should follow the example of
|
The layout and formatting of added files should follow the example
|
||||||
the existing files. Since many of those were initially derived from
|
of the existing files. Since those are directly derived from their
|
||||||
their former .txt format versions and the manual has been maintained in
|
former .txt format versions and the manual has been maintained in
|
||||||
that format for many years, there is a large degree of consistency
|
that format for many years, there is a large degree of consistency
|
||||||
already, so comparison with similar files should give you a good idea
|
already, so comparison with similar files should give you a good
|
||||||
what kind of information and sections are needed.
|
idea what kind of information and sections are needed.
|
||||||
|
|
||||||
## Formatting conventions
|
## Formatting conventions
|
||||||
|
|
||||||
@ -51,27 +52,21 @@ It seems to be sufficient to have this consistent only within
|
|||||||
any single file and it is not (yet) enforced strictly, but making
|
any single file and it is not (yet) enforced strictly, but making
|
||||||
this globally consistent makes it easier to move sections around.
|
this globally consistent makes it easier to move sections around.
|
||||||
|
|
||||||
File names, folders, paths, (shell) commands, definitions, makefile
|
Filenames, folders, paths, (shell) commands, definitions, makefile
|
||||||
settings and similar should be formatted as "literals" with
|
settings and similar should be formatted as "literals" with
|
||||||
double backward quotes bracketing the item: \`\`path/to/some/file\`\`
|
double backward quotes bracketing the item: \`\`path/to/some/file\`\`
|
||||||
|
|
||||||
Keywords and options are formatted in italics: \*option\*
|
Keywords and options are formatted in italics: \*option\*
|
||||||
|
|
||||||
Mathematical expressions, equations, symbols are typeset using
|
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++/Python source
|
Groups of shell commands or LAMMPS input script or C/C++ source
|
||||||
code should be typeset into a `.. code-block::` section. A syntax
|
code should be typeset into a `.. code-block::` section. A syntax
|
||||||
highlighting extension for LAMMPS input scripts is provided, so `LAMMPS`
|
highlighting extension for LAMMPS input scripts is provided, so
|
||||||
can be used to indicate the language in the code block in addition to
|
`LAMMPS` can be used to indicate the language in the code block
|
||||||
`bash`, `c`, `c++`, `console`, `csh`, `diff', `fortran`, `json`, `make`,
|
in addition to `bash`, `c`, or `python`. When no syntax style
|
||||||
`perl`, `powershell`, `python`, `sh`, or `tcl`, `text`, or `yaml`. When
|
is indicated, no syntax highlighting is performed.
|
||||||
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
|
As an alternative, e.g. to typeset the syntax of file formats
|
||||||
a `.. parsed-literal::` block can be used, which allows some
|
a `.. parsed-literal::` block can be used, which allows some
|
||||||
@ -94,30 +89,22 @@ by ` :class: note`.
|
|||||||
|
|
||||||
## Required steps when adding a custom style to LAMMPS
|
## 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
|
When adding a new style (e.g. pair style or a compute or a fix)
|
||||||
command, it is **required** to include the **corresponding documentation**
|
or a new command, it is **required** to include the corresponding
|
||||||
in [reStructuredText format](https://docutils.sourceforge.io/rst.html).
|
documentation. Those are often new files that need to be added.
|
||||||
Those are often new files that need to be added. In order to be
|
In order to be included in the documentation, those new files
|
||||||
included in the documentation, those new files need to be referenced in a
|
need to be reference in a `.. toctree::` block. Most of those
|
||||||
`.. toctree::` block. Most of those use patterns with wild cards, so the
|
use patterns with wildcards, so the addition will be automatic.
|
||||||
addition will be automatic. However, those additions also need to be
|
However, those additions also need to be added to some lists of
|
||||||
added to some lists of styles or commands. The `make style\_check`
|
styles or commands. The `make style\_check` command will perform
|
||||||
command when executed in the `doc` folder will perform a test and report
|
a test and report any missing entries and list the affected files.
|
||||||
any missing entries and list the affected files. Any references defined
|
Any references defined with `.. \_refname:` have to be unique
|
||||||
with `.. \_refname:` have to be unique across all documentation files
|
across all documentation files and this can be checked for with
|
||||||
and this can be checked for with `make anchor\_check`. Finally, a
|
`make anchor\_check`. Finally, a spell-check should be done,
|
||||||
spell-check should be done, which is triggered via `make spelling`. Any
|
which is triggered via `make spelling`. Any offenses need to
|
||||||
offenses need to be corrected and false positives should be added to the
|
be corrected and false positives should be added to the file
|
||||||
file `utils/sphinx-config/false\_positives.txt`.
|
`utils/sphinx-config/false\_positives.txt`.
|
||||||
|
|
||||||
## Required additional steps when adding a new package to LAMMPS
|
## Required additional steps when adding a new package to LAMMPS
|
||||||
|
|
||||||
When adding a new package, the package must be added to the list of
|
TODO
|
||||||
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,12 +1,12 @@
|
|||||||
# Outline of the GitHub Development Workflow
|
# Outline of the GitHub Development Workflow
|
||||||
|
|
||||||
The purpose of this document is to provide a point of reference for the
|
This purpose of this document is to provide a point of reference for the
|
||||||
core LAMMPS developers and other LAMMPS contributors to understand the
|
core LAMMPS developers and other LAMMPS contributors to understand the
|
||||||
choices the LAMMPS developers have agreed on. Git and GitHub provide the
|
choices the LAMMPS developers have agreed on. Git and GitHub provide the
|
||||||
tools, but do not set policies, so it is up to the developers to come to
|
tools, but do not set policies, so it is up to the developers to come to
|
||||||
an agreement as to how to define and interpret policies. This document
|
an agreement as to how to define and interpret policies. This document
|
||||||
is likely to change as our experiences and needs change, and we try to
|
is likely to change as our experiences and needs change and we try to
|
||||||
adapt it accordingly. Last change 2023-02-10.
|
adapt accordingly. Last change 2021-09-02.
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@ -22,50 +22,47 @@ adapt it accordingly. Last change 2023-02-10.
|
|||||||
## GitHub Merge Management
|
## GitHub Merge Management
|
||||||
|
|
||||||
In the interest of consistency, ONLY ONE of the core LAMMPS developers
|
In the interest of consistency, ONLY ONE of the core LAMMPS developers
|
||||||
should do the merging. This is currently
|
should doing the merging itself. This is currently
|
||||||
[@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer). If this
|
[@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer). If this
|
||||||
assignment needs to be changed, it shall be done right after a stable
|
assignment needs to be changed, it shall be done right after a stable
|
||||||
release. If the currently assigned developer cannot merge outstanding
|
release. If the currently assigned developer cannot merge outstanding
|
||||||
pull requests in a timely manner, or in other extenuating circumstances,
|
pull requests in a timely manner, or in other extenuating circumstances,
|
||||||
other core LAMMPS developers with merge permission may merge pull
|
other core LAMMPS developers with merge rights can merge pull requests,
|
||||||
requests.
|
when necessary.
|
||||||
|
|
||||||
## Pull Requests
|
## Pull Requests
|
||||||
|
|
||||||
*ALL* changes to the LAMMPS code and documentation, however trivial,
|
ALL changes to the LAMMPS code and documentation, however trivial, MUST
|
||||||
MUST be submitted as a pull request to GitHub. All changes to the
|
be submitted as a pull request to GitHub. All changes to the "develop"
|
||||||
"develop" branch must be made exclusively through merging pull requests.
|
branch must be made exclusively through merging pull requests. The
|
||||||
The "release" and "stable" branches, respectively, are only to be
|
"release" and "stable" branches, respectively are only to be updated
|
||||||
updated upon "feature releases" or "stable releases" based on the
|
upon patch or stable releases with fast-forward merges based on the
|
||||||
associated tags. Updates to the stable release in between stable releases
|
associated tags. Pull requests may also be submitted to (long-running)
|
||||||
(for example, back-ported bug fixes) are first merged into the "maintenance"
|
feature branches created by LAMMPS developers inside the LAMMPS project,
|
||||||
branch and then into the "stable" branch as "stable update releases".
|
if needed. Those are not subject to the merge and review restrictions
|
||||||
|
discussed in this document, though, but get managed as needed on a
|
||||||
Pull requests may also be submitted to (long-running) feature branches
|
case-by-case basis.
|
||||||
created by LAMMPS developers inside the LAMMPS project, if needed. Those
|
|
||||||
are not subject to the merge and review restrictions discussed in this
|
|
||||||
document, though, but get managed as needed on a case-by-case basis.
|
|
||||||
|
|
||||||
### Pull Request Assignments
|
### Pull Request Assignments
|
||||||
|
|
||||||
Pull requests can be "chaperoned" by one of the LAMMPS core developers.
|
Pull requests can be "chaperoned" by one of the LAMMPS core developers.
|
||||||
This is indicated by whom the pull request is assigned to. LAMMPS core
|
This is indicated by who the pull request is assigned to. LAMMPS core
|
||||||
developers can self-assign, or they can decide to assign a pull request
|
developers can self-assign or they can decide to assign a pull request
|
||||||
to a different LAMMPS developer. Being assigned to a pull request means,
|
to a different LAMMPS developer. Being assigned to a pull request means,
|
||||||
that this pull request may need some work and the assignee is tasked to
|
that this pull request may need some work and the assignee is tasked to
|
||||||
determine whether this might be needed or not. The assignee may either
|
determine whether this might be needed or not, and may either implement
|
||||||
choose to implement required changes or ask the submitter of the pull
|
the required changes or ask the submitter of the pull request to implement
|
||||||
request to implement them. Even though, all LAMMPS developers may have
|
them. Even though, all LAMMPS developers may have write access to pull
|
||||||
write access to pull requests (if enabled by the submitter, which is the
|
requests (if enabled by the submitter, which is the default), only the
|
||||||
default), only the submitter or the assignee of a pull request should do
|
submitter or the assignee of a pull request may do so. During this
|
||||||
so. During this period, the `work_in_progress` label may be applied to
|
period the `work_in_progress` label may be applied to the pull
|
||||||
the pull request. The assignee gets to decide what happens to the pull
|
request. The assignee gets to decide what happens to the pull request
|
||||||
request next, e.g. whether it should be assigned to a different
|
next, e.g. whether it should be assigned to a different developer for
|
||||||
developer for additional checks and changes, or is recommended to be
|
additional checks and changes, or is recommended to be merged. Removing
|
||||||
merged. Removing the `work_in_progress` label and assigning the pull
|
the `work_in_progress` label and assigning the pull request to the
|
||||||
request to the developer tasked with merging signals that a pull request
|
developer tasked with merging signals that a pull request is ready to be
|
||||||
is ready to be merged. In addition, a `ready_for_merge` label may also
|
merged. In addition, a `ready_for_merge` label may also be assigned
|
||||||
be assigned to signal urgency to merge this pull request quickly.
|
to signal urgency to merge this pull request quickly.
|
||||||
|
|
||||||
### Pull Request Reviews
|
### Pull Request Reviews
|
||||||
|
|
||||||
@ -73,33 +70,32 @@ People can be assigned to review a pull request in two ways:
|
|||||||
|
|
||||||
* They can be assigned manually to review a pull request
|
* They can be assigned manually to review a pull request
|
||||||
by the submitter or a LAMMPS developer
|
by the submitter or a LAMMPS developer
|
||||||
* They can be automatically assigned, because a developer's GitHub
|
* They can be automatically assigned, because a developers matches
|
||||||
handle matches a file pattern in the `.github/CODEOWNERS` file,
|
a file pattern in the `.github/CODEOWNERS` file, which associates
|
||||||
which associates developers with the code they contributed and
|
developers with the code they contributed and maintain.
|
||||||
maintain.
|
|
||||||
|
|
||||||
Reviewers are requested to state their appraisal of the proposed changes
|
Reviewers are requested to state their appraisal of the proposed changes
|
||||||
and either approve or request changes. People may unassign themselves
|
and either approve or request changes. People may unassign themselves
|
||||||
from review, if they feel not competent about the changes proposed. At
|
from review, if they feel not competent about the changes proposed. At
|
||||||
least two approvals from LAMMPS developers with write access are
|
least two approvals from LAMMPS developers with write access are required
|
||||||
required before merging, in addition to passing all automated
|
before merging in addition to the automated compilation tests.
|
||||||
compilation and unit tests. Merging counts as implicit approval, so
|
Merging counts as implicit approval, so does submission of a pull request
|
||||||
does submission of a pull request (by a LAMMPS developer). So the person
|
(by a LAMMPS developer). So the person doing the merge may not also submit
|
||||||
doing the merge may not also submit an approving review. The GitHub
|
an approving review. The feature, that reviews from code owners are "hard"
|
||||||
feature, that reviews from code owners are "hard" reviews (i.e. they
|
reviews (i.e. they must all be approved before merging is allowed), is
|
||||||
must all approve before merging is allowed), is currently disabled.
|
currently disabled and it is in the discretion of the merge maintainer to
|
||||||
It is in the discretion of the merge maintainer to assess when a
|
assess when a sufficient degree of approval, especially from external
|
||||||
sufficient degree of approval has been reached, especially from external
|
contributors, has been reached in these cases. Reviews may be
|
||||||
collaborators. Reviews may be (automatically) dismissed, when the
|
(automatically) dismissed, when the reviewed code has been changed,
|
||||||
reviewed code has been changed. Review may be requested a second time.
|
and then approval is required a second time.
|
||||||
|
|
||||||
### Pull Request Discussions
|
### Pull Request Discussions
|
||||||
|
|
||||||
All discussions about a pull request should be kept as much as possible
|
All discussions about a pull request should be kept as much as possible
|
||||||
on the pull request discussion page on GitHub, so that other developers
|
on the pull request discussion page on GitHub, so that other developers
|
||||||
can later review the entire discussion after the fact and understand the
|
can later review the entire discussion after the fact and understand the
|
||||||
rationale behind choices that were made. Exceptions to this policy are
|
rationale behind choices made. Exceptions to this policy are technical
|
||||||
technical discussions, that are centered on tools or policies themselves
|
discussions, that are centered on tools or policies themselves
|
||||||
(git, GitHub, c++) rather than on the content of the pull request.
|
(git, GitHub, c++) rather than on the content of the pull request.
|
||||||
|
|
||||||
## GitHub Issues
|
## GitHub Issues
|
||||||
@ -113,47 +109,39 @@ marker in the subject. This is automatically done when using the
|
|||||||
corresponding template for submitting an issue. Issues may be assigned
|
corresponding template for submitting an issue. Issues may be assigned
|
||||||
to one or more developers, if they are working on this feature or
|
to one or more developers, if they are working on this feature or
|
||||||
working to resolve an issue. Issues that have nobody working
|
working to resolve an issue. Issues that have nobody working
|
||||||
on them at the moment, or in the near future, have the label
|
on them at the moment or in the near future, have the label
|
||||||
`volunteer needed` attached.
|
`volunteer needed` attached.
|
||||||
|
|
||||||
When an issue, say `#125` is resolved by a specific pull request, the
|
When an issue, say `#125` is resolved by a specific pull request,
|
||||||
comment for the pull request shall contain the text `closes #125` or
|
the comment for the pull request shall contain the text `closes #125`
|
||||||
`fixes #125`, so that the issue is automatically deleted when the pull
|
or `fixes #125`, so that the issue is automatically deleted when
|
||||||
request is merged. The template for pull requests includes a header
|
the pull request is merged. The template for pull requests includes
|
||||||
where connections between pull requests and issues can be listed, and
|
a header where connections between pull requests and issues can be listed
|
||||||
thus where this comment should be placed.
|
and thus were this comment should be placed.
|
||||||
|
|
||||||
## Release Planning
|
## Milestones and Release Planning
|
||||||
|
|
||||||
LAMMPS uses a continuous release development model with incremental
|
LAMMPS uses a continuous release development model with incremental
|
||||||
changes, i.e. significant effort is made -- including automated pre-merge
|
changes, i.e. significant effort is made - including automated pre-merge
|
||||||
testing -- that the code in the branch "develop" does not get easily
|
testing - that the code in the branch "develop" does not get easily
|
||||||
broken. These tests are run after every update to a pull request. More
|
broken. These tests are run after every update to a pull request. More
|
||||||
extensive and time-consuming tests (including regression testing) are
|
extensive and time consuming tests (including regression testing) are
|
||||||
performed after code is merged to the "develop" branch. There are feature
|
performed after code is merged to the "develop" branch. There are patch
|
||||||
releases of LAMMPS made about every 4-8 weeks at a point, when the LAMMPS
|
releases of LAMMPS every 3-5 weeks at a point, when the LAMMPS
|
||||||
developers feel, that a sufficient number of changes have been included
|
developers feel, that a sufficient amount of changes have happened, and
|
||||||
and all post-merge testing has been successful. These feature releases are
|
the post-merge testing has been successful. These patch releases are
|
||||||
marked with a `patch_<version date>` tag and the "release" branch
|
marked with a `patch_<version date>` tag and the "release" branch
|
||||||
follows only these versions with fast-forward merges. While "develop" may
|
follows only these versions (and thus is always supposed to be of
|
||||||
be temporarily broken through issues only detected by the post-merge tests,
|
production quality, unlike "develop", which may be temporary broken, in
|
||||||
The "release" branch is always supposed to be of production quality.
|
the case of larger change sets or unexpected incompatibilities or side
|
||||||
|
effects.
|
||||||
|
|
||||||
About once each year, there is a "stable" release of LAMMPS. These have
|
About 1-2 times each year, there are going to be "stable" releases of
|
||||||
seen additional, manual testing and review of results from testing with
|
LAMMPS. These have seen additional, manual testing and review of
|
||||||
instrumented code and static code analysis. Also, the last few feature
|
results from testing with instrumented code and static code analysis.
|
||||||
releases before a stable release are "release candidate" versions which
|
Also, the last 1-3 patch releases before a stable release are "release
|
||||||
only contain bug fixes, feature additions to peripheral functionality,
|
candidate" versions which only contain bugfixes and documentation
|
||||||
and documentation updates. In between stable releases, bug fixes and
|
updates. For release planning and the information of code contributors,
|
||||||
infrastructure updates are back-ported from the "develop" branch to the
|
issues and pull requests being actively worked on are assigned a
|
||||||
"maintenance" branch and occasionally merged into "stable" and published
|
"milestone", which corresponds to the next stable release or the stable
|
||||||
as update releases.
|
release after that, with a tentative release date.
|
||||||
|
|
||||||
## Project Management
|
|
||||||
|
|
||||||
For release planning and the information of code contributors, issues
|
|
||||||
and pull requests are being managed with GitHub Project Boards. There
|
|
||||||
are currently three boards: LAMMPS Feature Requests, LAMMPS Bug Reports,
|
|
||||||
and LAMMPS Pull Requests. Each board is organized in columns where
|
|
||||||
submissions are categorized. Within each column the entries are
|
|
||||||
(manually) sorted according their priority.
|
|
||||||
|
|||||||
@ -16,11 +16,8 @@ clean:
|
|||||||
rm -f $(IMGSVG) $(IMGPDF) $(IMGPNG) *~
|
rm -f $(IMGSVG) $(IMGPDF) $(IMGPNG) *~
|
||||||
|
|
||||||
ifeq ($(HAS_DOT),YES)
|
ifeq ($(HAS_DOT),YES)
|
||||||
$(IMGDIR)/lammps-classes.png : lammps-classes.dot
|
|
||||||
dot -Tpng -Kneato -o $@ $<
|
|
||||||
|
|
||||||
$(IMGDIR)/%.png: %.dot
|
$(IMGDIR)/%.png: %.dot
|
||||||
dot -Tpng -Kdot -o $@ $<
|
dot -Tpng -Kneato -o $@ $<
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAS_DOT),NO)
|
ifeq ($(HAS_DOT),NO)
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
// LAMMPS branches and releases
|
|
||||||
digraph releases {
|
|
||||||
rankdir="LR";
|
|
||||||
github [shape="box" label="Pull Requests\non GitHub" height=0.75];
|
|
||||||
github -> develop [label="Merge commits"];
|
|
||||||
{
|
|
||||||
rank = "same";
|
|
||||||
work [shape="none" label="Development branches:"]
|
|
||||||
develop [label="'develop' branch" height=0.75];
|
|
||||||
maintenance [label="'maintenance' branch" height=0.75];
|
|
||||||
};
|
|
||||||
{
|
|
||||||
rank = "same";
|
|
||||||
upload [shape="none" label="Release branches:"]
|
|
||||||
release [label="'release' branch" height=0.75];
|
|
||||||
stable [label="'stable' branch" height=0.75];
|
|
||||||
};
|
|
||||||
develop -> release [label="Feature release\n(every 4-8 weeks)"];
|
|
||||||
release -> stable [label="Stable release\n(once per year)"];
|
|
||||||
stable -> maintenance [label="Reset on stable release" style="setlinewidth(2)"];
|
|
||||||
develop -> maintenance [label="Backports of bugfixes" style="dashed"];
|
|
||||||
maintenance -> stable [label="Updates to stable release"];
|
|
||||||
{
|
|
||||||
rank = "same";
|
|
||||||
tag [shape="none" label="Applied tags:"];
|
|
||||||
patchtag [shape="box" label="patch_<date>"];
|
|
||||||
stabletag [shape="box" label="stable_<date>"];
|
|
||||||
updatetag [shape="box" label="stable_<date>_update<num>"];
|
|
||||||
};
|
|
||||||
release -> patchtag [label="feature release" style="dotted"];
|
|
||||||
stable -> stabletag [label="stable release" style="dotted"];
|
|
||||||
stable -> updatetag [label="update release" style="dotted"];
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
.TH LAMMPS "1" "7 February 2024" "2024-02-07"
|
.TH LAMMPS "1" "23 June 2022" "2022-6-23"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B LAMMPS
|
.B LAMMPS
|
||||||
\- Molecular Dynamics Simulator. Version 7 February 2024
|
\- Molecular Dynamics Simulator. Version 23 June 2022
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B lmp
|
.B lmp
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
.TH MSI2LMP "1" "v3.9.10" "2023-03-10"
|
.TH MSI2LMP "1" "v3.9.9" "2018-11-05"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B MSI2LMP
|
.B MSI2LMP
|
||||||
\- Converter for Materials Studio files to LAMMPS
|
\- Converter for Materials Studio files to LAMMPS
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B msi2lmp
|
.B msi2lmp
|
||||||
[-help] <ROOTNAME> [-class <I|1|II|2|O|0>] [-frc <path to frc file>] [-print #] [-ignore] [-nocenter] [-oldstyle] [-shift <x> <y> <z>]
|
<ROOTNAME> [-class <I|1|II|2|O|0>] [-frc <path to frc file>] [-print #] [-ignore] [-nocenter] [-oldstyle] [-shift <x> <y> <z>]
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -22,9 +22,6 @@ needed between .frc and .car/.mdf files are the atom types.
|
|||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
\fB\-h\fR, \fB\-help\fR,
|
|
||||||
Print detailed help message to the screen and stop.
|
|
||||||
.TP
|
|
||||||
\fB\<ROOTNAME>\fR
|
\fB\<ROOTNAME>\fR
|
||||||
This has to be the first argument and is a
|
This has to be the first argument and is a
|
||||||
.B mandatory
|
.B mandatory
|
||||||
|
|||||||
@ -63,7 +63,7 @@ In the src directory, there is one top-level Makefile and several
|
|||||||
low-level machine-specific files named Makefile.xxx where xxx = the
|
low-level machine-specific files named Makefile.xxx where xxx = the
|
||||||
machine name. If a low-level Makefile exists for your platform, you do
|
machine name. If a low-level Makefile exists for your platform, you do
|
||||||
not need to edit the top-level Makefile. However you should check the
|
not need to edit the top-level Makefile. However you should check the
|
||||||
system-specific section of the low-level Makefile to ensure the
|
system-specific section of the low-level Makefile to insure the
|
||||||
various paths are correct for your environment. If a low-level
|
various paths are correct for your environment. If a low-level
|
||||||
Makefile does not exist for your platform, you will need to add a
|
Makefile does not exist for your platform, you will need to add a
|
||||||
suitable target to the top-level Makefile. You will also need to
|
suitable target to the top-level Makefile. You will also need to
|
||||||
|
|||||||
@ -1206,7 +1206,7 @@ this command is not typically needed if the "nonbond style" and "
|
|||||||
an exception to this is if a short cutoff is used initially,
|
an exception to this is if a short cutoff is used initially,
|
||||||
but a longer cutoff will be used for a subsequent run (in the same
|
but a longer cutoff will be used for a subsequent run (in the same
|
||||||
input script), in this case the "maximum cutoff" command should be
|
input script), in this case the "maximum cutoff" command should be
|
||||||
used to ensure enough memory is allocated for the later run
|
used to insure enough memory is allocated for the later run
|
||||||
note that a restart file contains nonbond cutoffs (so it is not necessary
|
note that a restart file contains nonbond cutoffs (so it is not necessary
|
||||||
to use a "nonbond style" command before "read restart"), but LAMMPS
|
to use a "nonbond style" command before "read restart"), but LAMMPS
|
||||||
still needs to know what the maximum cutoff will be before the
|
still needs to know what the maximum cutoff will be before the
|
||||||
|
|||||||
@ -203,7 +203,7 @@ Bibliography
|
|||||||
A Caro, DA Crowson, M Caro; Phys Rev Lett, 95, 075702 (2005)
|
A Caro, DA Crowson, M Caro; Phys Rev Lett, 95, 075702 (2005)
|
||||||
|
|
||||||
**(CasP)**
|
**(CasP)**
|
||||||
CasP webpage: http://www.casp-program.org/
|
CasP webpage: https://www.helmholtz-berlin.de/people/gregor-schiwietz/casp_en.html
|
||||||
|
|
||||||
**(Cawkwell2012)**
|
**(Cawkwell2012)**
|
||||||
A.\ M. N. Niklasson, M. J. Cawkwell, Phys. Rev. B, 86 (17), 174308 (2012).
|
A.\ M. N. Niklasson, M. J. Cawkwell, Phys. Rev. B, 86 (17), 174308 (2012).
|
||||||
@ -314,7 +314,7 @@ Bibliography
|
|||||||
Espanol, Revenga, Physical Review E, 67, 026705 (2003).
|
Espanol, Revenga, Physical Review E, 67, 026705 (2003).
|
||||||
|
|
||||||
**(Espanol1997)**
|
**(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)**
|
||||||
Evans and Morriss, Phys Rev A, 30, 1528 (1984).
|
Evans and Morriss, Phys Rev A, 30, 1528 (1984).
|
||||||
@ -368,7 +368,7 @@ Bibliography
|
|||||||
Frenkel and Smit, Understanding Molecular Simulation, Academic Press, London, 2002.
|
Frenkel and Smit, Understanding Molecular Simulation, Academic Press, London, 2002.
|
||||||
|
|
||||||
**(GLE4MD)**
|
**(GLE4MD)**
|
||||||
`https://gle4md.org/ <https://gle4md.org/>`_
|
`http://gle4md.org/ <http://gle4md.org/>`_
|
||||||
|
|
||||||
**(Gao)**
|
**(Gao)**
|
||||||
Gao and Weber, Nuclear Instruments and Methods in Physics Research B 191 (2012) 504.
|
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)
|
Hayre, and Farago, Comp Phys Comm, 185, 524 (2014)
|
||||||
|
|
||||||
**(Groot)**
|
**(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)**
|
||||||
Guenole, Noehring, Vaid, Houlle, Xie, Prakash, Bitzek, Comput Mater Sci, 175, 109584 (2020).
|
Guenole, Noehring, Vaid, Houlle, Xie, Prakash, Bitzek, Comput Mater Sci, 175, 109584 (2020).
|
||||||
|
|
||||||
**(Gullet)**
|
**(Gullet)**
|
||||||
Gullet, Wagner, Slepoy, SANDIA Report 2003-8782 (2003). DOI:10.2172/918395
|
Gullet, Wagner, Slepoy, SANDIA Report 2003-8782 (2003).
|
||||||
|
|
||||||
**(Guo)**
|
**(Guo)**
|
||||||
Guo and Thirumalai, Journal of Molecular Biology, 263, 323-43 (1996).
|
Guo and Thirumalai, Journal of Molecular Biology, 263, 323-43 (1996).
|
||||||
@ -461,7 +461,7 @@ Bibliography
|
|||||||
Hunt, Mol Simul, 42, 347 (2016).
|
Hunt, Mol Simul, 42, 347 (2016).
|
||||||
|
|
||||||
**(IPI)**
|
**(IPI)**
|
||||||
`https://ipi-code.org/ <https://ipi-code.org/>`
|
`http://epfl-cosmo.github.io/gle4md/index.html?page=ipi <http://epfl-cosmo.github.io/gle4md/index.html?page=ipi>`_
|
||||||
|
|
||||||
**(IPI-CPC)**
|
**(IPI-CPC)**
|
||||||
Ceriotti, More and Manolopoulos, Comp Phys Comm, 185, 1019-1026 (2014).
|
Ceriotti, More and Manolopoulos, Comp Phys Comm, 185, 1019-1026 (2014).
|
||||||
@ -562,9 +562,6 @@ Bibliography
|
|||||||
**(Kumar)**
|
**(Kumar)**
|
||||||
Kumar and Skinner, J. Phys. Chem. B, 112, 8311 (2008)
|
Kumar and Skinner, J. Phys. Chem. B, 112, 8311 (2008)
|
||||||
|
|
||||||
**(Lafourcade)**
|
|
||||||
Lafourcade, Maillet, Denoual, Duval, Allera, Goryaeva, and Marinica, `Comp. Mat. Science, 230, 112534 (2023) <https://doi.org/10.1016/j.commatsci.2023.112534>`_
|
|
||||||
|
|
||||||
**(Lamoureux and Roux)**
|
**(Lamoureux and Roux)**
|
||||||
G.\ Lamoureux, B. Roux, J. Chem. Phys 119, 3025 (2003)
|
G.\ Lamoureux, B. Roux, J. Chem. Phys 119, 3025 (2003)
|
||||||
|
|
||||||
@ -608,16 +605,16 @@ Bibliography
|
|||||||
I.\ Leven et al, J. Chem.Theory Comput. 12, 2896-905 (2016).
|
I.\ Leven et al, J. Chem.Theory Comput. 12, 2896-905 (2016).
|
||||||
|
|
||||||
**(Li2013_POF)**
|
**(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)**
|
**(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)**
|
**(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)**
|
**(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)**
|
**(Lisal)**
|
||||||
M.\ Lisal, J.K. Brennan, J. Bonet Avalos, "Dissipative particle dynamics at isothermal, isobaric, isoenergetic, and isoenthalpic conditions using Shardlow-like splitting algorithms.",
|
M.\ Lisal, J.K. Brennan, J. Bonet Avalos, "Dissipative particle dynamics at isothermal, isobaric, isoenergetic, and isoenthalpic conditions using Shardlow-like splitting algorithms.",
|
||||||
@ -736,8 +733,8 @@ Bibliography
|
|||||||
**(Mishin)**
|
**(Mishin)**
|
||||||
Mishin, Mehl, and Papaconstantopoulos, Acta Mater, 53, 4029 (2005).
|
Mishin, Mehl, and Papaconstantopoulos, Acta Mater, 53, 4029 (2005).
|
||||||
|
|
||||||
**(Mitchell and Fincham)**
|
**(Mitchell and Finchham)**
|
||||||
Mitchell, Fincham, J Phys Condensed Matter, 5, 1031-1038 (1993).
|
Mitchell, Finchham, J Phys Condensed Matter, 5, 1031-1038 (1993).
|
||||||
|
|
||||||
**(Mitchell2011)**
|
**(Mitchell2011)**
|
||||||
Mitchell. A non-local, ordinary-state-based viscoelasticity model for peridynamics. Sandia National Lab Report, 8064:1-28 (2011).
|
Mitchell. A non-local, ordinary-state-based viscoelasticity model for peridynamics. Sandia National Lab Report, 8064:1-28 (2011).
|
||||||
@ -878,7 +875,7 @@ Bibliography
|
|||||||
G.A. Tribello, M. Bonomi, D. Branduardi, C. Camilloni and G. Bussi, Comp. Phys. Comm 185, 604 (2014)
|
G.A. Tribello, M. Bonomi, D. Branduardi, C. Camilloni and G. Bussi, Comp. Phys. Comm 185, 604 (2014)
|
||||||
|
|
||||||
**(Paquay)**
|
**(Paquay)**
|
||||||
Paquay and Kusters, Biophys. J., 110, 6, (2016). preprint available at `arXiv:1411.3019 <https://arxiv.org/abs/1411.3019/>`_.
|
Paquay and Kusters, Biophys. J., 110, 6, (2016). preprint available at `arXiv:1411.3019 <http://arxiv.org/abs/1411.3019/>`_.
|
||||||
|
|
||||||
**(Park)**
|
**(Park)**
|
||||||
Park, Schulten, J. Chem. Phys. 120 (13), 5946 (2004)
|
Park, Schulten, J. Chem. Phys. 120 (13), 5946 (2004)
|
||||||
@ -1376,7 +1373,7 @@ Bibliography
|
|||||||
Zhu, Tajkhorshid, and Schulten, Biophys. J. 83, 154 (2002).
|
Zhu, Tajkhorshid, and Schulten, Biophys. J. 83, 154 (2002).
|
||||||
|
|
||||||
**(Ziegler)**
|
**(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)**
|
**(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.
|
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.
|
||||||
|
|||||||
@ -6,9 +6,9 @@ either traditional makefiles for use with GNU make (which may require
|
|||||||
manual editing), or using a build environment generated by CMake (Unix
|
manual editing), or using a build environment generated by CMake (Unix
|
||||||
Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more).
|
Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more).
|
||||||
|
|
||||||
As an alternative, you can download a package with pre-built executables
|
As an alternative you can download a package with pre-built executables
|
||||||
or automated build trees, as described in the :doc:`Install <Install>`
|
or automated build trees as described on the :doc:`Install <Install>`
|
||||||
section of the manual.
|
page.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|||||||
@ -44,7 +44,7 @@ standard. A more detailed discussion of that is below.
|
|||||||
|
|
||||||
The executable created by CMake (after running make) is named
|
The executable created by CMake (after running make) is named
|
||||||
``lmp`` unless the ``LAMMPS_MACHINE`` option is set. When setting
|
``lmp`` unless the ``LAMMPS_MACHINE`` option is set. When setting
|
||||||
``LAMMPS_MACHINE=name``, the executable will be called
|
``LAMMPS_MACHINE=name`` the executable will be called
|
||||||
``lmp_name``. Using ``BUILD_MPI=no`` will enforce building a
|
``lmp_name``. Using ``BUILD_MPI=no`` will enforce building a
|
||||||
serial executable using the MPI STUBS library.
|
serial executable using the MPI STUBS library.
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ standard. A more detailed discussion of that is below.
|
|||||||
|
|
||||||
Any ``make machine`` command will look up the make settings from a
|
Any ``make machine`` command will look up the make settings from a
|
||||||
file ``Makefile.machine`` in the folder ``src/MAKE`` or one of its
|
file ``Makefile.machine`` in the folder ``src/MAKE`` or one of its
|
||||||
subdirectories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a
|
sub-directories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a
|
||||||
folder ``Obj_machine`` with all objects and generated files and an
|
folder ``Obj_machine`` with all objects and generated files and an
|
||||||
executable called ``lmp_machine``\ . The standard parallel build
|
executable called ``lmp_machine``\ . The standard parallel build
|
||||||
with ``make mpi`` assumes a standard MPI installation with MPI
|
with ``make mpi`` assumes a standard MPI installation with MPI
|
||||||
@ -90,7 +90,7 @@ standard. A more detailed discussion of that is below.
|
|||||||
directory, or ``make`` from the ``src/STUBS`` dir. If the build
|
directory, or ``make`` from the ``src/STUBS`` dir. If the build
|
||||||
fails, you may need to edit the ``STUBS/Makefile`` for your
|
fails, you may need to edit the ``STUBS/Makefile`` for your
|
||||||
platform. The stubs library does not provide MPI/IO functions
|
platform. The stubs library does not provide MPI/IO functions
|
||||||
required by some LAMMPS packages, e.g. ``LATBOLTZ``,
|
required by some LAMMPS packages, e.g. ``MPIIO`` or ``LATBOLTZ``,
|
||||||
and thus is not compatible with those packages.
|
and thus is not compatible with those packages.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
@ -107,9 +107,9 @@ MPI and OpenMP support in LAMMPS
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If you are installing MPI yourself to build a parallel LAMMPS
|
If you are installing MPI yourself to build a parallel LAMMPS
|
||||||
executable, we recommend either MPICH or OpenMPI, which are regularly
|
executable, we recommend either MPICH or OpenMPI which are regularly
|
||||||
used and tested with LAMMPS by the LAMMPS developers. MPICH can be
|
used and tested with LAMMPS by the LAMMPS developers. MPICH can be
|
||||||
downloaded from the `MPICH home page <https://www.mpich.org>`_, and
|
downloaded from the `MPICH home page <https://www.mpich.org>`_ and
|
||||||
OpenMPI can be downloaded correspondingly from the `OpenMPI home page
|
OpenMPI can be downloaded correspondingly from the `OpenMPI home page
|
||||||
<https://www.open-mpi.org>`_. Other MPI packages should also work. No
|
<https://www.open-mpi.org>`_. Other MPI packages should also work. No
|
||||||
specific vendor provided and standard compliant MPI library is currently
|
specific vendor provided and standard compliant MPI library is currently
|
||||||
@ -129,12 +129,13 @@ in particular the Intel compilers on top of OpenMP. Also, the ``KOKKOS``
|
|||||||
package can be compiled to include OpenMP threading.
|
package can be compiled to include OpenMP threading.
|
||||||
|
|
||||||
In addition, there are a few commands in LAMMPS that have native OpenMP
|
In addition, there are a few commands in LAMMPS that have native OpenMP
|
||||||
support included as well. These are commands in the ``ML-SNAP``,
|
support included as well. These are commands in the ``MPIIO``,
|
||||||
``DIFFRACTION``, and ``DPD-REACT`` packages. Furthermore, some packages
|
``ML-SNAP``, ``DIFFRACTION``, and ``DPD-REACT`` packages. In addition
|
||||||
support OpenMP threading indirectly through the libraries they interface
|
some packages support OpenMP threading indirectly through the libraries
|
||||||
to: e.g. ``KSPACE``, and ``COLVARS``. See the :doc:`Packages details
|
they interface to: e.g. ``LATTE``, ``KSPACE``, and ``COLVARS``.
|
||||||
<Packages_details>` page for more info on these packages, and the pages
|
See the :doc:`Packages details <Packages_details>` page for more
|
||||||
for their respective commands for OpenMP threading info.
|
info on these packages and the pages for their respective commands
|
||||||
|
for OpenMP threading info.
|
||||||
|
|
||||||
For CMake, if you use ``BUILD_OMP=yes``, you can use these packages
|
For CMake, if you use ``BUILD_OMP=yes``, you can use these packages
|
||||||
and turn on their native OpenMP support and turn on their native OpenMP
|
and turn on their native OpenMP support and turn on their native OpenMP
|
||||||
@ -143,9 +144,9 @@ variable before you launch LAMMPS.
|
|||||||
|
|
||||||
For building via conventional make, the ``CCFLAGS`` and ``LINKFLAGS``
|
For building via conventional make, the ``CCFLAGS`` and ``LINKFLAGS``
|
||||||
variables in Makefile.machine need to include the compiler flag that
|
variables in Makefile.machine need to include the compiler flag that
|
||||||
enables OpenMP. For the GNU compilers or Clang, it is ``-fopenmp``\ .
|
enables OpenMP. For GNU compilers it is ``-fopenmp``\ . For (recent) Intel
|
||||||
For (recent) Intel compilers, it is ``-qopenmp``\ . If you are using a
|
compilers it is ``-qopenmp``\ . If you are using a different compiler,
|
||||||
different compiler, please refer to its documentation.
|
please refer to its documentation.
|
||||||
|
|
||||||
.. _default-none-issues:
|
.. _default-none-issues:
|
||||||
|
|
||||||
@ -173,16 +174,15 @@ Choice of compiler and compile/link options
|
|||||||
The choice of compiler and compiler flags can be important for maximum
|
The choice of compiler and compiler flags can be important for maximum
|
||||||
performance. Vendor provided compilers for a specific hardware can
|
performance. Vendor provided compilers for a specific hardware can
|
||||||
produce faster code than open-source compilers like the GNU compilers.
|
produce faster code than open-source compilers like the GNU compilers.
|
||||||
On the most common x86 hardware, the most popular C++ compilers are
|
On the most common x86 hardware most popular C++ compilers are quite
|
||||||
quite similar in their ability to optimize regular C/C++ source code at
|
similar in performance of C/C++ code at high optimization levels. When
|
||||||
high optimization levels. When using the ``INTEL`` package, there is a
|
using the ``INTEL`` package, there is a distinct advantage in using
|
||||||
distinct advantage in using the `Intel C++ compiler <intel_>`_ due to
|
the `Intel C++ compiler <intel_>`_ due to much improved vectorization
|
||||||
much improved vectorization through SSE and AVX instructions on
|
through SSE and AVX instructions on compatible hardware as the source
|
||||||
compatible hardware. The source code in that package conditionally
|
code includes changes and Intel compiler specific directives to enable
|
||||||
includes compiler specific directives to enable these high degrees of
|
high degrees of vectorization. This may change over time as equivalent
|
||||||
vectorization. This may change over time as equivalent vectorization
|
vectorization directives are included into OpenMP standard revisions and
|
||||||
directives are included into the OpenMP standard and other compilers
|
other compilers adopt them.
|
||||||
adopt them.
|
|
||||||
|
|
||||||
.. _intel: https://software.intel.com/en-us/intel-compilers
|
.. _intel: https://software.intel.com/en-us/intel-compilers
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ LAMMPS.
|
|||||||
.. tab:: CMake build
|
.. tab:: CMake build
|
||||||
|
|
||||||
By default CMake will use the compiler it finds according to
|
By default CMake will use the compiler it finds according to
|
||||||
internal preferences, and it will add optimization flags
|
internal preferences and it will add optimization flags
|
||||||
appropriate to that compiler and any :doc:`accelerator packages
|
appropriate to that compiler and any :doc:`accelerator packages
|
||||||
<Speed_packages>` you have included in the build. CMake will
|
<Speed_packages>` you have included in the build. CMake will
|
||||||
check if the detected or selected compiler is compatible with the
|
check if the detected or selected compiler is compatible with the
|
||||||
@ -250,9 +250,9 @@ LAMMPS.
|
|||||||
and `-C ../cmake/presets/pgi.cmake`
|
and `-C ../cmake/presets/pgi.cmake`
|
||||||
will switch the compiler to the PGI compilers.
|
will switch the compiler to the PGI compilers.
|
||||||
|
|
||||||
Furthermore, you can set ``CMAKE_TUNE_FLAGS`` to specifically add
|
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add
|
||||||
compiler flags to tune for optimal performance on given hosts.
|
compiler flags to tune for optimal performance on given hosts. By
|
||||||
This variable is empty by default.
|
default this variable is empty.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ LAMMPS.
|
|||||||
|
|
||||||
Parallel build (see ``src/MAKE/Makefile.mpi``):
|
Parallel build (see ``src/MAKE/Makefile.mpi``):
|
||||||
|
|
||||||
.. code-block:: make
|
.. code-block:: bash
|
||||||
|
|
||||||
CC = mpicxx
|
CC = mpicxx
|
||||||
CCFLAGS = -g -O3
|
CCFLAGS = -g -O3
|
||||||
@ -296,7 +296,7 @@ LAMMPS.
|
|||||||
|
|
||||||
If compilation stops with a message like the following:
|
If compilation stops with a message like the following:
|
||||||
|
|
||||||
.. code-block:: output
|
.. code-block::
|
||||||
|
|
||||||
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../STUBS -c ../main.cpp
|
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../STUBS -c ../main.cpp
|
||||||
In file included from ../pointers.h:24:0,
|
In file included from ../pointers.h:24:0,
|
||||||
@ -368,10 +368,10 @@ running LAMMPS from Python via its library interface.
|
|||||||
# no default value
|
# no default value
|
||||||
|
|
||||||
The compilation will always produce a LAMMPS library and an
|
The compilation will always produce a LAMMPS library and an
|
||||||
executable linked to it. By default, this will be a static
|
executable linked to it. By default this will be a static library
|
||||||
library named ``liblammps.a`` and an executable named ``lmp``
|
named ``liblammps.a`` and an executable named ``lmp`` Setting
|
||||||
Setting ``BUILD_SHARED_LIBS=yes`` will instead produce a shared
|
``BUILD_SHARED_LIBS=yes`` will instead produce a shared library
|
||||||
library called ``liblammps.so`` (or ``liblammps.dylib`` or
|
called ``liblammps.so`` (or ``liblammps.dylib`` or
|
||||||
``liblammps.dll`` depending on the platform) If
|
``liblammps.dll`` depending on the platform) If
|
||||||
``LAMMPS_MACHINE=name`` is set in addition, the name of the
|
``LAMMPS_MACHINE=name`` is set in addition, the name of the
|
||||||
generated libraries will be changed to either ``liblammps_name.a``
|
generated libraries will be changed to either ``liblammps_name.a``
|
||||||
@ -429,7 +429,7 @@ You may need to use ``sudo make install`` in place of the last line if
|
|||||||
you do not have write privileges for ``/usr/local/lib`` or use the
|
you do not have write privileges for ``/usr/local/lib`` or use the
|
||||||
``--prefix`` configuration option to select an installation folder,
|
``--prefix`` configuration option to select an installation folder,
|
||||||
where you do have write access. The end result should be the file
|
where you do have write access. The end result should be the file
|
||||||
``/usr/local/lib/libmpich.so``. On many Linux installations, the folder
|
``/usr/local/lib/libmpich.so``. On many Linux installations the folder
|
||||||
``${HOME}/.local`` is an alternative to using ``/usr/local`` and does
|
``${HOME}/.local`` is an alternative to using ``/usr/local`` and does
|
||||||
not require superuser or sudo access. In that case the configuration
|
not require superuser or sudo access. In that case the configuration
|
||||||
step becomes:
|
step becomes:
|
||||||
@ -438,10 +438,9 @@ step becomes:
|
|||||||
|
|
||||||
./configure --enable-shared --prefix=${HOME}/.local
|
./configure --enable-shared --prefix=${HOME}/.local
|
||||||
|
|
||||||
Avoiding the use of "sudo" for custom software installation (i.e. from
|
Avoiding to use "sudo" for custom software installation (i.e. from source
|
||||||
source and not through a package manager tool provided by the OS) is
|
and not through a package manager tool provided by the OS) is generally
|
||||||
generally recommended to ensure the integrity of the system software
|
recommended to ensure the integrity of the system software installation.
|
||||||
installation.
|
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -488,9 +487,8 @@ using CMake or Make.
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D BUILD_TOOLS=value # yes or no (default). Build binary2txt, chain.x, micelle2d.x, msi2lmp, phana, stl_bin2txt
|
-D BUILD_TOOLS=value # yes or no (default)
|
||||||
-D BUILD_LAMMPS_SHELL=value # yes or no (default). Build lammps-shell
|
-D BUILD_LAMMPS_SHELL=value # yes or no (default)
|
||||||
-D BUILD_LAMMPS_GUI=value # yes or no (default). Build lammps-gui
|
|
||||||
|
|
||||||
The generated binaries will also become part of the LAMMPS installation
|
The generated binaries will also become part of the LAMMPS installation
|
||||||
(see below).
|
(see below).
|
||||||
@ -504,6 +502,7 @@ using CMake or Make.
|
|||||||
make binary2txt # build only binary2txt tool
|
make binary2txt # build only binary2txt tool
|
||||||
make chain # build only chain tool
|
make chain # build only chain tool
|
||||||
make micelle2d # build only micelle2d tool
|
make micelle2d # build only micelle2d tool
|
||||||
|
make thermo_extract # build only thermo_extract tool
|
||||||
|
|
||||||
cd lammps/tools/lammps-shell
|
cd lammps/tools/lammps-shell
|
||||||
make # build LAMMPS shell
|
make # build LAMMPS shell
|
||||||
@ -515,11 +514,11 @@ using CMake or Make.
|
|||||||
Install LAMMPS after a build
|
Install LAMMPS after a build
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
After building LAMMPS, you may wish to copy the LAMMPS executable or
|
After building LAMMPS, you may wish to copy the LAMMPS executable of
|
||||||
library, along with other LAMMPS files (library header, doc files), to a
|
library, along with other LAMMPS files (library header, doc files) to
|
||||||
globally visible place on your system, for others to access. Note that
|
a globally visible place on your system, for others to access. Note
|
||||||
you may need super-user privileges (e.g. sudo) if the directory you want
|
that you may need super-user privileges (e.g. sudo) if the directory
|
||||||
to copy files to is protected.
|
you want to copy files to is protected.
|
||||||
|
|
||||||
.. tabs::
|
.. tabs::
|
||||||
|
|
||||||
@ -537,7 +536,7 @@ to copy files to is protected.
|
|||||||
environment variable, if you are installing LAMMPS into a non-system
|
environment variable, if you are installing LAMMPS into a non-system
|
||||||
location and/or are linking to libraries in a non-system location that
|
location and/or are linking to libraries in a non-system location that
|
||||||
depend on such runtime path settings.
|
depend on such runtime path settings.
|
||||||
As an alternative, you may set the CMake variable ``LAMMPS_INSTALL_RPATH``
|
As an alternative you may set the CMake variable ``LAMMPS_INSTALL_RPATH``
|
||||||
to ``on`` and then the runtime paths for any linked shared libraries
|
to ``on`` and then the runtime paths for any linked shared libraries
|
||||||
and the library installation folder for the LAMMPS library will be
|
and the library installation folder for the LAMMPS library will be
|
||||||
embedded and thus the requirement to set environment variables is avoided.
|
embedded and thus the requirement to set environment variables is avoided.
|
||||||
|
|||||||
@ -9,42 +9,44 @@ page.
|
|||||||
|
|
||||||
The following text assumes some familiarity with CMake and focuses on
|
The following text assumes some familiarity with CMake and focuses on
|
||||||
using the command line tool ``cmake`` and what settings are supported
|
using the command line tool ``cmake`` and what settings are supported
|
||||||
for building LAMMPS. A more detailed tutorial on how to use CMake
|
for building LAMMPS. A more detailed tutorial on how to use ``cmake``
|
||||||
itself, the text mode or graphical user interface, to change the
|
itself, the text mode or graphical user interface, change the generated
|
||||||
generated output files for different build tools and development
|
output files for different build tools and development environments is
|
||||||
environments is on a :doc:`separate page <Howto_cmake>`.
|
on a :doc:`separate page <Howto_cmake>`.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
LAMMPS currently requires that CMake version 3.16 or later is available.
|
LAMMPS currently requires that CMake version 3.10 or later is available;
|
||||||
|
version 3.12 or later is preferred.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
You must not mix the :doc:`traditional make based <Build_make>`
|
You must not mix the :doc:`traditional make based <Build_make>`
|
||||||
LAMMPS build procedure with using CMake. No packages may be
|
LAMMPS build procedure with using CMake. Thus no packages may be
|
||||||
installed or a build been previously attempted in the LAMMPS source
|
installed or a build been previously attempted in the LAMMPS source
|
||||||
directory by using ``make <machine>``. CMake will detect if this is
|
directory by using ``make <machine>``. CMake will detect if this is
|
||||||
the case and generate an error. To remove conflicting files from the
|
the case and generate an error. To remove conflicting files from the
|
||||||
``src`` you can use the command ``make no-all purge`` which will
|
``src`` you can use the command ``make no-all purge`` which will
|
||||||
uninstall all packages and delete all auto-generated files.
|
un-install all packages and delete all auto-generated files.
|
||||||
|
|
||||||
|
|
||||||
Advantages of using CMake
|
Advantages of using CMake
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
CMake is an alternative to compiling LAMMPS in the traditional way
|
CMake is an alternative to compiling LAMMPS in the traditional way
|
||||||
through :doc:`(manually customized) makefiles <Build_make>`. Using
|
through :doc:`(manually customized) makefiles <Build_make>` and a recent
|
||||||
CMake has multiple advantages that are specifically helpful for
|
addition to LAMMPS thanks to the efforts of Christoph Junghans (LANL)
|
||||||
people with limited experience in compiling software or for people
|
and Richard Berger (Temple U). Using CMake has multiple advantages that
|
||||||
that want to modify or extend LAMMPS.
|
are specifically helpful for people with limited experience in compiling
|
||||||
|
software or for people that want to modify or extend LAMMPS.
|
||||||
|
|
||||||
- CMake can detect available hardware, tools, features, and libraries
|
- CMake can detect available hardware, tools, features, and libraries
|
||||||
and adapt the LAMMPS default build configuration accordingly.
|
and adapt the LAMMPS default build configuration accordingly.
|
||||||
- CMake can generate files for different build tools and integrated
|
- CMake can generate files for different build tools and integrated
|
||||||
development environments (IDE).
|
development environments (IDE).
|
||||||
- CMake supports customization of settings with a command line, text
|
- CMake supports customization of settings with a text mode or graphical
|
||||||
mode, or graphical user interface. No manual editing of files,
|
user interface. No knowledge of file formats or and complex command
|
||||||
knowledge of file formats or complex command line syntax is required.
|
line syntax required.
|
||||||
- All enabled components are compiled in a single build operation.
|
- All enabled components are compiled in a single build operation.
|
||||||
- Automated dependency tracking for all files and configuration options.
|
- Automated dependency tracking for all files and configuration options.
|
||||||
- Support for true out-of-source compilation. Multiple configurations
|
- Support for true out-of-source compilation. Multiple configurations
|
||||||
@ -53,23 +55,23 @@ that want to modify or extend LAMMPS.
|
|||||||
source tree.
|
source tree.
|
||||||
- Simplified packaging of LAMMPS for Linux distributions, environment
|
- Simplified packaging of LAMMPS for Linux distributions, environment
|
||||||
modules, or automated build tools like `Homebrew <https://brew.sh/>`_.
|
modules, or automated build tools like `Homebrew <https://brew.sh/>`_.
|
||||||
- Integration of automated unit and regression testing (the LAMMPS side
|
- Integration of automated regression testing (the LAMMPS side for that
|
||||||
of this is still under active development).
|
is still under development).
|
||||||
|
|
||||||
.. _cmake_build:
|
.. _cmake_build:
|
||||||
|
|
||||||
Getting started
|
Getting started
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Building LAMMPS with CMake is a two-step process. In the first step,
|
Building LAMMPS with CMake is a two-step process. First you use CMake
|
||||||
you use CMake to generate a build environment in a new directory. For
|
to generate a build environment in a new directory. For that purpose
|
||||||
that purpose you can use either the command-line utility ``cmake`` (or
|
you can use either the command-line utility ``cmake`` (or ``cmake3``),
|
||||||
``cmake3``), the text-mode UI utility ``ccmake`` (or ``ccmake3``) or the
|
the text-mode UI utility ``ccmake`` (or ``ccmake3``) or the graphical
|
||||||
graphical utility ``cmake-gui``, or use them interchangeably. The
|
utility ``cmake-gui``, or use them interchangeably. The second step is
|
||||||
second step is then the compilation and linking of all objects,
|
then the compilation and linking of all objects, libraries, and
|
||||||
libraries, and executables using the selected build tool. Here is a
|
executables. Here is a minimal example using the command line version of
|
||||||
minimal example using the command line version of CMake to build LAMMPS
|
CMake to build LAMMPS with no add-on packages enabled and no
|
||||||
with no add-on packages enabled and no customization:
|
customization:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -94,17 +96,17 @@ Compilation can take a long time, since LAMMPS is a large project with
|
|||||||
many features. If your machine has multiple CPU cores (most do these
|
many features. If your machine has multiple CPU cores (most do these
|
||||||
days), you can speed this up by compiling sources in parallel with
|
days), you can speed this up by compiling sources in parallel with
|
||||||
``make -j N`` (with N being the maximum number of concurrently executed
|
``make -j N`` (with N being the maximum number of concurrently executed
|
||||||
tasks). Installation of the `ccache <https://ccache.dev/>`_ (= Compiler
|
tasks). Also installation of the `ccache <https://ccache.dev/>`_ (=
|
||||||
Cache) software may speed up repeated compilation even more, e.g. during
|
Compiler Cache) software may speed up repeated compilation even more,
|
||||||
code development, especially when repeatedly switching between branches.
|
e.g. during code development.
|
||||||
|
|
||||||
After the initial build, whenever you edit LAMMPS source files, enable
|
After the initial build, whenever you edit LAMMPS source files, enable
|
||||||
or disable packages, change compiler flags or build options, you must
|
or disable packages, change compiler flags or build options, you must
|
||||||
re-compile and relink the LAMMPS executable with ``cmake --build .`` (or
|
re-compile and relink the LAMMPS executable with ``cmake --build .`` (or
|
||||||
``make``). If the compilation fails for some reason, try running
|
``make``). If the compilation fails for some reason, try running
|
||||||
``cmake .`` and then compile again. The included dependency tracking
|
``cmake .`` and then compile again. The included dependency tracking
|
||||||
should make certain that only the necessary subset of files is
|
should make certain that only the necessary subset of files are
|
||||||
re-compiled. You can also delete compiled objects, libraries, and
|
re-compiled. You can also delete compiled objects, libraries and
|
||||||
executables with ``cmake --build . --target clean`` (or ``make clean``).
|
executables with ``cmake --build . --target clean`` (or ``make clean``).
|
||||||
|
|
||||||
After compilation, you may optionally install the LAMMPS executable into
|
After compilation, you may optionally install the LAMMPS executable into
|
||||||
@ -130,12 +132,12 @@ file called ``CMakeLists.txt`` (for LAMMPS it is located in the
|
|||||||
``CMakeCache.txt``, which is generated at the end of the CMake
|
``CMakeCache.txt``, which is generated at the end of the CMake
|
||||||
configuration step. The cache file contains all current CMake settings.
|
configuration step. The cache file contains all current CMake settings.
|
||||||
|
|
||||||
To modify settings, enable or disable features, you need to set
|
To modify settings, enable or disable features, you need to set *variables*
|
||||||
*variables* with either the *-D* command line flag (``-D
|
with either the *-D* command line flag (``-D VARIABLE1_NAME=value``) or
|
||||||
VARIABLE1_NAME=value``) or change them in the text mode of the graphical
|
change them in the text mode of graphical user interface. The *-D* flag
|
||||||
user interface. The *-D* flag can be used several times in one command.
|
can be used several times in one command.
|
||||||
|
|
||||||
For your convenience, we provide :ref:`CMake presets <cmake_presets>`
|
For your convenience we provide :ref:`CMake presets <cmake_presets>`
|
||||||
that combine multiple settings to enable optional LAMMPS packages or use
|
that combine multiple settings to enable optional LAMMPS packages or use
|
||||||
a different compiler tool chain. Those are loaded with the *-C* flag
|
a different compiler tool chain. Those are loaded with the *-C* flag
|
||||||
(``-C ../cmake/presets/basic.cmake``). This step would only be needed
|
(``-C ../cmake/presets/basic.cmake``). This step would only be needed
|
||||||
@ -153,23 +155,22 @@ specific CMake version is given when running ``cmake --help``.
|
|||||||
Multi-configuration build systems
|
Multi-configuration build systems
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Throughout this manual, it is mostly assumed that LAMMPS is being built
|
Throughout this manual it is mostly assumed that LAMMPS is being built
|
||||||
on a Unix-like operating system with "make" as the underlying "builder",
|
on a Unix-like operating system with "make" as the underlying "builder",
|
||||||
since this is the most common case. In this case the build
|
since this is the most common case. In this case the build "configuration"
|
||||||
"configuration" is chose using ``-D CMAKE_BUILD_TYPE=<configuration>``
|
is chose using ``-D CMAKE_BUILD_TYPE=<configuration>`` with ``<configuration>``
|
||||||
with ``<configuration>`` being one of "Release", "Debug",
|
being one of "Release", "Debug", "RelWithDebInfo", or "MinSizeRel".
|
||||||
"RelWithDebInfo", or "MinSizeRel". Some build tools, however, can also
|
Some build tools, however, can also use or even require to have a so-called
|
||||||
use or even require having a so-called multi-configuration build system
|
multi-configuration build system setup. For those the built type (or
|
||||||
setup. For a multi-configuration build, the built type (or
|
configuration) is chosen at compile time using the same build files. E.g.
|
||||||
configuration) is selected at compile time using the same build
|
with:
|
||||||
files. E.g. with:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
cmake --build build-multi --config Release
|
cmake --build build-multi --config Release
|
||||||
|
|
||||||
In that case the resulting binaries are not in the build folder directly
|
In that case the resulting binaries are not in the build folder directly
|
||||||
but in subdirectories corresponding to the build type (i.e. Release in
|
but in sub-directories corresponding to the build type (i.e. Release in
|
||||||
the example from above). Similarly, for running unit tests the
|
the example from above). Similarly, for running unit tests the
|
||||||
configuration is selected with the *-C* flag:
|
configuration is selected with the *-C* flag:
|
||||||
|
|
||||||
@ -177,13 +178,13 @@ configuration is selected with the *-C* flag:
|
|||||||
|
|
||||||
ctest -C Debug
|
ctest -C Debug
|
||||||
|
|
||||||
The CMake scripts in LAMMPS have basic support for being compiled using
|
The CMake scripts in LAMMPS have basic support for being compiled using a
|
||||||
a multi-config build system, but not all of it has been ported. This is
|
multi-config build system, but not all of it has been ported. This is in
|
||||||
in particular applicable to compiling packages that require additional
|
particular applicable to compiling packages that require additional libraries
|
||||||
libraries that would be downloaded and compiled by CMake. The
|
that would be downloaded and compiled by CMake. The "windows" preset file
|
||||||
``windows.cmake`` preset file tries to keep track of which packages can
|
tries to keep track of which packages can be compiled natively with the
|
||||||
be compiled natively with the MSVC compilers out-of-the box. Not all of
|
MSVC compilers out-of-the box. Not all of those external libraries are
|
||||||
the external libraries are portable to Windows, either.
|
portable to Windows either.
|
||||||
|
|
||||||
|
|
||||||
Installing CMake
|
Installing CMake
|
||||||
|
|||||||
@ -46,7 +46,7 @@ It can be enabled for all C++ code with the following CMake flag
|
|||||||
|
|
||||||
With this flag enabled all source files will be processed twice, first to
|
With this flag enabled all source files will be processed twice, first to
|
||||||
be compiled and then to be analyzed. Please note that the analysis can be
|
be compiled and then to be analyzed. Please note that the analysis can be
|
||||||
significantly more time-consuming than the compilation itself.
|
significantly more time consuming than the compilation itself.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -122,87 +122,64 @@ Code Coverage and Unit Testing (CMake only)
|
|||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
The LAMMPS code is subject to multiple levels of automated testing
|
The LAMMPS code is subject to multiple levels of automated testing
|
||||||
during development:
|
during development: integration testing (i.e. whether the code compiles
|
||||||
|
on various platforms and with a variety of settings), unit testing
|
||||||
- Integration testing (i.e. whether the code compiles
|
(i.e. whether certain individual parts of the code produce the expected
|
||||||
on various platforms and with a variety of compilers and settings),
|
results for given inputs), run testing (whether selected complete input
|
||||||
- Unit testing (i.e. whether certain functions or classes of the code
|
decks run without crashing for multiple configurations), and regression
|
||||||
produce the expected results for given inputs),
|
testing (i.e. whether selected input examples reproduce the same
|
||||||
- Run testing (i.e. whether selected input decks can run to completion
|
results over a given number of steps and operations within a given
|
||||||
without crashing for multiple configurations),
|
error margin). The status of this automated testing can be viewed on
|
||||||
- Regression testing (i.e. whether selected input examples reproduce the
|
`https://ci.lammps.org <https://ci.lammps.org>`_.
|
||||||
same results over a given number of steps and operations within a
|
|
||||||
given error margin).
|
|
||||||
|
|
||||||
The status of this automated testing can be viewed on `https://ci.lammps.org
|
|
||||||
<https://ci.lammps.org>`_.
|
|
||||||
|
|
||||||
The scripts and inputs for integration, run, and regression testing
|
The scripts and inputs for integration, run, and regression testing
|
||||||
are maintained in a
|
are maintained in a
|
||||||
`separate repository <https://github.com/lammps/lammps-testing>`_
|
`separate repository <https://github.com/lammps/lammps-testing>`_
|
||||||
of the LAMMPS project on GitHub. A few tests are also run as GitHub
|
of the LAMMPS project on GitHub.
|
||||||
Actions and their configuration files are in the ``.github/workflows/``
|
|
||||||
folder of the LAMMPS git tree.
|
|
||||||
|
|
||||||
The unit testing facility is integrated into the CMake build process of
|
The unit testing facility is integrated into the CMake build process
|
||||||
the LAMMPS source code distribution itself. It can be enabled by
|
of the LAMMPS source code distribution itself. It can be enabled by
|
||||||
setting ``-D ENABLE_TESTING=on`` during the CMake configuration step.
|
setting ``-D ENABLE_TESTING=on`` during the CMake configuration step.
|
||||||
It requires the `YAML <https://pyyaml.org/>`_ library and matching
|
It requires the `YAML <http://pyyaml.org/>`_ library and development
|
||||||
development headers to compile (if those are not found locally a recent
|
headers (if those are not found locally a recent version will be
|
||||||
version of that library will be downloaded and compiled along with
|
downloaded and compiled along with LAMMPS and the test program) to
|
||||||
LAMMPS and the test programs) and will download and compile a specific
|
compile and will download and compile a specific recent version of the
|
||||||
version of the `GoogleTest <https://github.com/google/googletest/>`_ C++
|
`Googletest <https://github.com/google/googletest/>`_ C++ test framework
|
||||||
test framework that is used to implement the tests.
|
for implementing the tests.
|
||||||
|
|
||||||
.. admonition:: Software version and LAMMPS configuration requirements
|
.. admonition:: Software version requirements for testing
|
||||||
:class: note
|
:class: note
|
||||||
|
|
||||||
The compiler and library version requirements for the testing
|
The compiler and library version requirements for the testing
|
||||||
framework are more strict than for the main part of LAMMPS. For
|
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
|
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
|
(version 4.8.x) are not sufficient. The CMake configuration will try
|
||||||
to detect incompatible versions and either skip incompatible tests or
|
to detect compatible versions and either skip incompatible tests or
|
||||||
stop with an error. Also the number of available tests will depend on
|
stop with an error.
|
||||||
installed LAMMPS packages, development environment, operating system,
|
|
||||||
and configuration settings.
|
|
||||||
|
|
||||||
After compilation is complete, the unit testing is started in the build
|
After compilation is complete, the unit testing is started in the build
|
||||||
folder using the ``ctest`` command, which is part of the CMake software.
|
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::
|
||||||
|
|
||||||
.. code-block:: console
|
[...]$ 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
|
||||||
|
|
||||||
$ ctest
|
100% tests passed, 0 tests failed out of 26
|
||||||
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
|
|
||||||
|
|
||||||
100% tests passed, 0 tests failed out of 563
|
Total Test time (real) = 25.57 sec
|
||||||
|
|
||||||
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:
|
The ``ctest`` command has many options, the most important ones are:
|
||||||
|
|
||||||
@ -233,39 +210,18 @@ 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
|
The tests will adapt to the compilation settings of LAMMPS, so that tests
|
||||||
will be skipped if prerequisite features are not available in LAMMPS.
|
will be skipped if prerequisite features are not available in LAMMPS.
|
||||||
|
|
||||||
.. admonition:: Work in Progress
|
.. note::
|
||||||
:class: note
|
|
||||||
|
|
||||||
The unit test framework was added in spring 2020 and is under active
|
The unit test framework was added in spring 2020 and is under active
|
||||||
development. The coverage is not complete and will be expanded over
|
development. The coverage is not complete and will be expanded over
|
||||||
time. Preference is given to parts of the code base that are easy to
|
time.
|
||||||
test or commonly used.
|
|
||||||
|
|
||||||
Tests as shown by the ``ctest`` program are command lines defined in the
|
Tests for styles of the same kind of style (e.g. pair styles or bond
|
||||||
``CMakeLists.txt`` files in the ``unittest`` directory tree. A few
|
styles) are performed with the same test executable using different
|
||||||
tests simply execute LAMMPS with specific command line flags and check
|
input files in YAML format. So to add a test for another style of the
|
||||||
the output to the screen for expected content. A large number of unit
|
same kind it may be sufficient to add a suitable YAML file.
|
||||||
tests are special tests programs using the `GoogleTest framework
|
:doc:`Detailed instructions for adding tests <Developer_unittest>` are
|
||||||
<https://github.com/google/googletest/>`_ and linked to the LAMMPS
|
provided in the Programmer Guide part of the manual.
|
||||||
library that test individual functions or create a LAMMPS class
|
|
||||||
instance, execute one or more commands and check data inside the LAMMPS
|
|
||||||
class hierarchy. There are also tests for the C-library, Fortran, and
|
|
||||||
Python module interfaces to LAMMPS. The Python tests use the Python
|
|
||||||
"unittest" module in a similar fashion than the others use `GoogleTest`.
|
|
||||||
These special test programs are structured to perform multiple
|
|
||||||
individual tests internally and each of those contains several checks
|
|
||||||
(aka assertions) for internal data being changed as expected.
|
|
||||||
|
|
||||||
Tests for force computing or modifying styles (e.g. styles for non-bonded
|
|
||||||
and bonded interactions and selected fixes) are run by using a more generic
|
|
||||||
test program that reads its input from files in YAML format. The YAML file
|
|
||||||
provides the information on how to customized the test program to test
|
|
||||||
a specific style and - if needed - with specific settings.
|
|
||||||
To add a test for another, similar style (e.g. a new pair style) it is
|
|
||||||
usually sufficient to add a suitable YAML file. :doc:`Detailed
|
|
||||||
instructions for adding tests <Developer_unittest>` are provided in the
|
|
||||||
Programmer Guide part of the manual. A description of what happens
|
|
||||||
during the tests is given below.
|
|
||||||
|
|
||||||
Unit tests for force styles
|
Unit tests for force styles
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -281,22 +237,20 @@ A test run is then a a collection multiple individual test runs each
|
|||||||
with many comparisons to reference results based on template input
|
with many comparisons to reference results based on template input
|
||||||
files, individual command settings, relative error margins, and
|
files, individual command settings, relative error margins, and
|
||||||
reference data stored in a YAML format file with ``.yaml``
|
reference data stored in a YAML format file with ``.yaml``
|
||||||
suffix. Currently the programs ``test_pair_style``, ``test_bond_style``,
|
suffix. Currently the programs ``test_pair_style``, ``test_bond_style``, and
|
||||||
``test_angle_style``, ``test_dihedral_style``, and
|
``test_angle_style`` are implemented. They will compare forces, energies and
|
||||||
``test_improper_style`` are implemented. They will compare forces,
|
(global) stress for all atoms after a ``run 0`` calculation and after a
|
||||||
energies and (global) stress for all atoms after a ``run 0`` calculation
|
few steps of MD with :doc:`fix nve <fix_nve>`, each in multiple variants
|
||||||
and after a few steps of MD with :doc:`fix nve <fix_nve>`, each in
|
with different settings and also for multiple accelerated styles. If a
|
||||||
multiple variants with different settings and also for multiple
|
prerequisite style or package is missing, the individual tests are
|
||||||
accelerated styles. If a prerequisite style or package is missing, the
|
skipped. All tests will be executed on a single MPI process, so using
|
||||||
individual tests are skipped. All force style tests will be executed on
|
the CMake option ``-D BUILD_MPI=off`` can significantly speed up testing,
|
||||||
a single MPI process, so using the CMake option ``-D BUILD_MPI=off`` can
|
since this will skip the MPI initialization for each test run.
|
||||||
significantly speed up testing, since this will skip the MPI
|
Below is an example command and output:
|
||||||
initialization for each test run. Below is an example command and
|
|
||||||
output:
|
|
||||||
|
|
||||||
.. code-block:: console
|
.. parsed-literal::
|
||||||
|
|
||||||
$ test_pair_style mol-pair-lj_cut.yaml
|
[tests]$ test_pair_style mol-pair-lj_cut.yaml
|
||||||
[==========] Running 6 tests from 1 test suite.
|
[==========] Running 6 tests from 1 test suite.
|
||||||
[----------] Global test environment set-up.
|
[----------] Global test environment set-up.
|
||||||
[----------] 6 tests from PairStyle
|
[----------] 6 tests from PairStyle
|
||||||
@ -444,16 +398,15 @@ When compiling LAMMPS with enabled tests, most test executables will
|
|||||||
need to be linked against the LAMMPS library. Since this can be a very
|
need to be linked against the LAMMPS library. Since this can be a very
|
||||||
large library with many C++ objects when many packages are enabled, link
|
large library with many C++ objects when many packages are enabled, link
|
||||||
times can become very long on machines that use the GNU BFD linker (e.g.
|
times can become very long on machines that use the GNU BFD linker (e.g.
|
||||||
Linux systems). Alternatives like the ``mold`` linker, the ``lld``
|
Linux systems). Alternatives like the ``lld`` linker of the LLVM project
|
||||||
linker of the LLVM project, or the ``gold`` linker available with GNU
|
or the ``gold`` linker available with GNU binutils can speed up this step
|
||||||
binutils can speed up this step substantially (in this order). CMake
|
substantially. CMake will by default test if any of the two can be
|
||||||
will by default test if any of the three can be enabled and use it when
|
enabled and use it when ``ENABLE_TESTING`` is active. It can also be
|
||||||
``ENABLE_TESTING`` is active. It can also be selected manually through
|
selected manually through the ``CMAKE_CUSTOM_LINKER`` CMake variable.
|
||||||
the ``CMAKE_CUSTOM_LINKER`` CMake variable. Allowed values are
|
Allowed values are ``lld``, ``gold``, ``bfd``, or ``default``. The
|
||||||
``mold``, ``lld``, ``gold``, ``bfd``, or ``default``. The ``default``
|
``default`` option will use the system default linker otherwise, the
|
||||||
option will use the system default linker otherwise, the linker is
|
linker is chosen explicitly. This option is only available for the
|
||||||
chosen explicitly. This option is only available for the GNU or Clang
|
GNU or Clang C++ compiler.
|
||||||
C++ compilers.
|
|
||||||
|
|
||||||
Tests for other components and utility functions
|
Tests for other components and utility functions
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -547,15 +500,11 @@ The following options are available.
|
|||||||
make fix-errordocs # remove error docs in header files
|
make fix-errordocs # remove error docs in header files
|
||||||
make check-permissions # search for files with permissions issues
|
make check-permissions # search for files with permissions issues
|
||||||
make fix-permissions # correct permissions issues in files
|
make fix-permissions # correct permissions issues in files
|
||||||
make check-docs # search for several issues in the manual
|
|
||||||
make check-version # list files with pending release version tags
|
|
||||||
make check # run all check targets from above
|
make check # run all check targets from above
|
||||||
|
|
||||||
These should help to make source and documentation files conforming
|
These should help to make source and documentation files conforming
|
||||||
to some the coding style preferences of the LAMMPS developers.
|
to some the coding style preferences of the LAMMPS developers.
|
||||||
|
|
||||||
.. _clang-format:
|
|
||||||
|
|
||||||
Clang-format support
|
Clang-format support
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
@ -581,7 +530,7 @@ commands like the following:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. 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:
|
The following target are available for both, GNU make and CMake:
|
||||||
@ -590,19 +539,3 @@ 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-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
|
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/
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user