mirror of https://github.com/lammps/lammps.git
Merge branch 'develop' into compute_temp_profile_dof
This commit is contained in:
commit
8e9cc0eb51
|
@ -1,3 +1,11 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.github export-ignore
|
||||
.lgtm.yml export-ignore
|
||||
SECURITY.md export-ignore
|
||||
* text=auto
|
||||
*.jpg -text
|
||||
*.pdf -text
|
||||
*.gz -text
|
||||
*.png -text
|
||||
*.ps -text
|
||||
|
|
|
@ -13,43 +13,51 @@ lib/kim/* @ellio167
|
|||
lib/mesont/* @iafoss
|
||||
|
||||
# whole packages
|
||||
src/COMPRESS/* @akohlmey
|
||||
src/COMPRESS/* @rbberger
|
||||
src/GPU/* @ndtrung81
|
||||
src/KOKKOS/* @stanmoore1
|
||||
src/KIM/* @ellio167
|
||||
src/LATTE/* @cnegre
|
||||
src/MESSAGE/* @sjplimp
|
||||
src/MLIAP/* @athomps
|
||||
src/SNAP/* @athomps
|
||||
src/SPIN/* @julient31
|
||||
src/USER-CGDNA/* @ohenrich
|
||||
src/USER-CGSDK/* @akohlmey
|
||||
src/USER-COLVARS/* @giacomofiorin
|
||||
src/USER-INTEL/* @wmbrownintel
|
||||
src/USER-MANIFOLD/* @Pakketeretet2
|
||||
src/USER-MEAMC/* @martok
|
||||
src/USER-MESONT/* @iafoss
|
||||
src/USER-MOFFF/* @hheenen
|
||||
src/USER-MOLFILE/* @akohlmey
|
||||
src/USER-NETCDF/* @pastewka
|
||||
src/USER-PLUMED/* @gtribello
|
||||
src/USER-PHONON/* @lingtikong
|
||||
src/USER-PTM/* @pmla
|
||||
src/USER-OMP/* @akohlmey
|
||||
src/USER-QMMM/* @akohlmey
|
||||
src/USER-REAXC/* @hasanmetin
|
||||
src/USER-SCAFACOS/* @rhalver
|
||||
src/USER-TALLY/* @akohlmey
|
||||
src/USER-UEF/* @danicholson
|
||||
src/USER-VTK/* @rbberger
|
||||
|
||||
src/BROWNIAN/* @samueljmcameron
|
||||
src/CG-DNA/* @ohenrich
|
||||
src/CG-SDK/* @akohlmey
|
||||
src/COLVARS/* @giacomofiorin
|
||||
src/DIELECTRIC/* @ndtrung81
|
||||
src/FEP/* @agiliopadua
|
||||
src/ML-HDNNP/* @singraber
|
||||
src/INTEL/* @wmbrownintel
|
||||
src/MANIFOLD/* @Pakketeretet2
|
||||
src/MDI/* @taylor-a-barnes
|
||||
src/MEAM/* @martok
|
||||
src/MESONT/* @iafoss
|
||||
src/MOFFF/* @hheenen
|
||||
src/MOLFILE/* @akohlmey
|
||||
src/NETCDF/* @pastewka
|
||||
src/ML-PACE/* @yury-lysogorskiy
|
||||
src/PLUMED/* @gtribello
|
||||
src/PHONON/* @lingtikong
|
||||
src/PTM/* @pmla
|
||||
src/OPENMP/* @akohlmey
|
||||
src/QMMM/* @akohlmey
|
||||
src/REAXFF/* @hasanmetin @stanmoore1
|
||||
src/REACTION/* @jrgissing
|
||||
src/SCAFACOS/* @rhalver
|
||||
src/TALLY/* @akohlmey
|
||||
src/UEF/* @danicholson
|
||||
src/VTK/* @rbberger
|
||||
|
||||
# individual files in packages
|
||||
src/GPU/pair_vashishta_gpu.* @andeplane
|
||||
src/KOKKOS/pair_vashishta_kokkos.* @andeplane
|
||||
src/MANYBODY/pair_vashishta_table.* @andeplane
|
||||
src/MANYBODY/pair_atm.* @sergeylishchuk
|
||||
src/USER-REACTION/fix_bond_react.* @jrgissing
|
||||
src/USER-MISC/*_grem.* @dstelter92
|
||||
src/USER-MISC/compute_stress_mop*.* @RomainVermorel
|
||||
src/REPLICA/*_grem.* @dstelter92
|
||||
src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel
|
||||
src/MISC/*_tracker.* @jtclemm
|
||||
|
||||
# core LAMMPS classes
|
||||
src/lammps.* @sjplimp
|
||||
|
@ -73,8 +81,9 @@ src/kspace.* @sjplimp
|
|||
src/lmptyp.h @sjplimp
|
||||
src/library.* @sjplimp
|
||||
src/main.cpp @sjplimp
|
||||
src/min_*.* @sjplimp
|
||||
src/memory.* @sjplimp
|
||||
src/modify.* @sjplimp
|
||||
src/modify.* @sjplimp @stanmoore1
|
||||
src/molecule.* @sjplimp
|
||||
src/my_page.h @sjplimp
|
||||
src/my_pool_chunk.h @sjplimp
|
||||
|
@ -101,7 +110,6 @@ src/thermo.* @sjplimp
|
|||
src/universe.* @sjplimp
|
||||
src/update.* @sjplimp
|
||||
src/variable.* @sjplimp
|
||||
src/verlet.* @sjplimp
|
||||
src/velocity.* @sjplimp
|
||||
src/write_data.* @sjplimp
|
||||
src/write_restart.* @sjplimp
|
||||
|
@ -114,23 +122,26 @@ src/info.* @akohlmey @rbberger
|
|||
src/timer.* @akohlmey
|
||||
src/min* @sjplimp @stanmoore1
|
||||
src/utils.* @akohlmey @rbberger
|
||||
src/verlet.* @sjplimp @stanmoore1
|
||||
src/math_eigen_impl.h @jewettaij
|
||||
|
||||
# tools
|
||||
tools/msi2lmp/* @akohlmey
|
||||
tools/emacs/* @HaoZeke
|
||||
tools/singularity/* @akohlmey @rbberger
|
||||
tools/code_standard/* @rbberger
|
||||
tools/coding_standard/* @rbberger
|
||||
tools/valgrind/* @akohlmey
|
||||
tools/swig/* @akohlmey
|
||||
tools/offline/* @rbberger
|
||||
|
||||
# tests
|
||||
unittest/* @akohlmey @rbberger
|
||||
|
||||
# cmake
|
||||
cmake/* @junghans @rbberger
|
||||
cmake/Modules/Packages/USER-COLVARS.cmake @junghans @rbberger @giacomofiorin
|
||||
cmake/Modules/Packages/COLVARS.cmake @junghans @rbberger @giacomofiorin
|
||||
cmake/Modules/Packages/KIM.cmake @junghans @rbberger @ellio167
|
||||
cmake/presets/*.cmake @junghans @rbberger @akohlmey
|
||||
cmake/presets/*.cmake @akohlmey
|
||||
|
||||
# python
|
||||
python/* @rbberger
|
||||
|
@ -142,6 +153,7 @@ fortran/* @akohlmey
|
|||
doc/utils/*/* @rbberger
|
||||
doc/Makefile @rbberger
|
||||
doc/README @rbberger
|
||||
examples/plugin/* @akohlmey
|
||||
|
||||
# for releases
|
||||
src/version.h @sjplimp
|
||||
|
|
|
@ -5,8 +5,9 @@ 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.
|
||||
|
||||
Thus please also have a look at:
|
||||
* [The Section on submitting new features for inclusion in LAMMPS of the Manual](https://lammps.sandia.gov/doc/Modify_contribute.html)
|
||||
* [The LAMMPS GitHub Tutorial in the Manual](http://lammps.sandia.gov/doc/Howto_github.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://lammps.sandia.gov/doc/Modify_contribute.html)
|
||||
* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
|
@ -26,11 +27,11 @@ __
|
|||
|
||||
## I don't want to read this whole thing I just have a question!
|
||||
|
||||
> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to the ['lammps-users' mailing list](https://lammps.sandia.gov/mail.html). You do not need to be subscribed to post to the list (but a mailing list subscription avoids having your post delayed until it is approved by a mailing list moderator). Most posts to the mailing list receive a response within less than 24 hours. Before posting to the mailing list, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html). Following those guidelines will help greatly to get a helpful response. Always mention which LAMMPS version you are using.
|
||||
> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to either the ['lammps-users' mailing list](https://lammps.sandia.gov/mail.html) or the [LAMMPS Material Science Discourse forum](https://matsci.org/lammps). You do not need to be subscribed to post to the list (but a mailing list subscription avoids having your post delayed until it is approved by a mailing list moderator). Most posts to the mailing list receive a response within less than 24 hours. Before posting to the mailing list, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html). Following those guidelines will help greatly to get a helpful response. Always mention which LAMMPS version you are using. The LAMMPS forum was recently created as part of a larger effort to build a materials science community and have discussions not just about using LAMMPS. Thus the forum may be also used for discussions that would be off-topic for the mailing list. Those will just have to be posted to a more general category.
|
||||
|
||||
## How Can I Contribute?
|
||||
|
||||
There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list, you can report bugs or suggest enhancements by creating issues on GitHub (or posting them to the lammps-users mailing list), and you can contribute by submitting pull requests on GitHub or e-mail your code
|
||||
There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list 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://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
|
||||
|
@ -42,6 +43,8 @@ Anyone can browse/search previous questions/answers in the archives. You do not
|
|||
|
||||
If you post a message and you are a subscriber, your message will appear immediately. If you are not a subscriber, your message will be moderated, which typically takes one business day. Either way, when someone replies the reply will usually be sent to both, your personal email address and the mailing list. When replying to people, that responded to your post to the list, please always included the mailing list in your replies (i.e. use "Reply All" and **not** "Reply"). Responses will appear on the list in a few minutes, but it can take a few hours for postings and replies to show up in the SourceForge archive. Sending replies also to the mailing list is important, so that responses are archived and people with a similar issue can search for possible solutions in the mailing list archive.
|
||||
|
||||
The LAMMPS Materials Science Discourse forum was created recently to facilitate discussion not just about LAMMPS and as part of a larger effort towards building a materials science community. The forum contains a read-only sub-category with the continually updated mailing list archive, so you won't miss anything by joining only the forum and not the mailing list.
|
||||
|
||||
### Reporting Bugs
|
||||
|
||||
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.
|
||||
|
@ -60,37 +63,12 @@ To be able to submit an issue on GitHub, you have to register for an account (fo
|
|||
|
||||
### Contributing Code
|
||||
|
||||
We encourage users to submit new features or modifications for LAMMPS to the core developers so they can be added to the LAMMPS distribution. The preferred way to manage and coordinate this is by submitting a pull request at the LAMMPS project on GitHub. For any larger modifications or programming project, you are encouraged to contact the LAMMPS developers ahead of time, in order to discuss implementation strategies and coding guidelines, that will make it easier to integrate your contribution and result in less work for everybody involved. You are also encouraged to search through the list of open issues on GitHub and submit a new issue for a planned feature, so you would not duplicate the work of others (and possibly get scooped by them) or have your work duplicated by others.
|
||||
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:
|
||||
* [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://lammps.sandia.gov/doc/Modify_contribute.html)
|
||||
* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html)
|
||||
|
||||
How quickly your contribution will be integrated depends largely on how much effort it will cause to integrate and test it, how much it requires changes to the core code base, and of how much interest it is to the larger LAMMPS community. Please see below for a checklist of typical requirements. Once you have prepared everything, see [this tutorial](https://lammps.sandia.gov/doc/Howto_github.html)
|
||||
for instructions on how to submit your changes or new files through a GitHub pull request
|
||||
|
||||
Here is a checklist of steps you need to follow to submit a single file or user package for our consideration. Following these steps will save both you and us time. See existing files in packages in the source directory for examples. If you are uncertain, please ask on the lammps-users mailing list.
|
||||
|
||||
* C++ source code must be compatible with the C++-11 standard. Packages may require a later standard, if justified.
|
||||
* All source files you provide must compile with the most current version of LAMMPS with multiple configurations. In particular you need to test compiling LAMMPS from scratch with `-DLAMMPS_BIGBIG` set in addition to the default `-DLAMMPS_SMALLBIG` setting. Your code will need to work correctly in serial and in parallel using MPI.
|
||||
* For consistency with the rest of LAMMPS and especially, if you want your contribution(s) to be added to main LAMMPS code or one of its standard packages, it needs to be written in a style compatible with other LAMMPS source files. This means: 2-character indentation per level, no tabs, no trailing whitespace, no lines over 80 characters. I/O is done via the C-style stdio library, style class header files should not import any system headers, STL containers should be avoided in headers, and forward declarations used where possible or needed. All added code should be placed into the LAMMPS_NS namespace or a sub-namespace; global or static variables should be avoided, as they conflict with the modular nature of LAMMPS and the C++ class structure. There MUST NOT be any "using namespace XXX;" statements in headers. In the implementation file (<name>.cpp) system includes should be placed in angular brackets (<>) and for c-library functions the C++ style header files should be included (<cstdio> instead of <stdio.h>, or <cstring> instead of <string.h>). This all is so the developers can more easily understand, integrate, and maintain your contribution and reduce conflicts with other parts of LAMMPS. This basically means that the code accesses data structures, performs its operations, and is formatted similar to other LAMMPS source files, including the use of the error class for error and warning messages.
|
||||
* Source, style name, and documentation file should follow the following naming convention: style names should be lowercase and words separated by a forward slash; for a new fix style 'foo/bar', the class should be named FixFooBar, the name of the source files should be 'fix_foo_bar.h' and 'fix_foo_bar.cpp' and the corresponding documentation should be in a file 'fix_foo_bar.rst'.
|
||||
* If you want your contribution to be added as a user-contributed feature, and it is a single file (actually a `<name>.cpp` and `<name>.h` file) it can be rapidly added to the USER-MISC directory. Include the one-line entry to add to the USER-MISC/README file in that directory, along with the 2 source files. You can do this multiple times if you wish to contribute several individual features.
|
||||
* If you want your contribution to be added as a user-contribution and it is several related features, it is probably best to make it a user package directory with a name like USER-FOO. In addition to your new files, the directory should contain a README text file. The README should contain your name and contact information and a brief description of what your new package does. If your files depend on other LAMMPS style files also being installed (e.g. because your file is a derived class from the other LAMMPS class), then an Install.sh file is also needed to check for those dependencies. See other README and Install.sh files in other USER directories as examples. Send us a tarball of this USER-FOO directory.
|
||||
* Your new source files need to have the LAMMPS copyright, GPL notice, and your name and email address at the top, like other user-contributed LAMMPS source files. They need to create a class that is inside the LAMMPS namespace. If the file is for one of the USER packages, including USER-MISC, then we are not as picky about the coding style (see above). I.e. the files do not need to be in the same stylistic format and syntax as other LAMMPS files, though that would be nice for developers as well as users who try to read your code.
|
||||
* You **must** also create or extend a documentation file for each new command or style you are adding to LAMMPS. For simplicity and convenience, the documentation of groups of closely related commands or styles may be combined into a single file. This will be one file for a single-file feature. For a package, it might be several files. These are files in the [reStructuredText](https://docutils.sourceforge.io/rst.html) markup language, that are then converted to HTML and PDF. The tools for this conversion are included in the source distribution, and the translation can be as simple as doing "make html pdf" in the doc folder. Thus the documentation source files must be in the same format and style as other `<name>.rst` files in the lammps/doc/src directory for similar commands and styles; use one or more of them as a starting point. An introduction to reStructuredText can be found at [https://docutils.sourceforge.io/docs/user/rst/quickstart.html](https://docutils.sourceforge.io/docs/user/rst/quickstart.html). The text files can include mathematical expressions and symbol in ".. math::" sections or ":math:" expressions or figures (see doc/JPG for examples), or even additional PDF files with further details (see doc/PDF for examples). The doc page should also include literature citations as appropriate; see the bottom of doc/fix_nh.rst for examples and the earlier part of the same file for how to format the cite itself. The "Restrictions" section of the doc page should indicate that your command is only available if LAMMPS is built with the appropriate USER-MISC or USER-FOO package. See other user package doc files for examples of how to do this. The prerequisite for building the HTML format files are Python 3.x and virtualenv. Please run at least `make html`, `make pdf` and `make spelling` and carefully inspect and proofread the resulting HTML format doc page as well as the output produced to the screen. Make sure that all spelling errors are fixed or the necessary false positives are added to the `doc/utils/sphinx-config/false_positives.txt` file. For new styles, those usually also need to be added to lists on the respective overview pages. This can be checked for also with `make style_check`.
|
||||
* For a new package (or even a single command) you should include one or more example scripts demonstrating its use. These should run in no more than a couple minutes, even on a single processor, and not require large data files as input. See directories under examples/USER for examples of input scripts other users provided for their packages. These example inputs are also required for validating memory accesses and testing for memory leaks with valgrind
|
||||
* For new utility functions or class (i.e. anything that does not depend on a LAMMPS object), new unit tests should be added to the unittest tree.
|
||||
* When adding a new LAMMPS style, a .yaml file with a test configuration and reference data should be added for the styles where a suitable tester program already exists (e.g. pair styles, bond styles, etc.).
|
||||
* If there is a paper of yours describing your feature (either the algorithm/science behind the feature itself, or its initial usage, or its implementation in LAMMPS), you can add the citation to the <name>.cpp source file. See src/USER-EFF/atom_vec_electron.cpp for an example. A LaTeX citation is stored in a variable at the top of the file and a single line of code that references the variable is added to the constructor of the class. Whenever a user invokes your feature from their input script, this will cause LAMMPS to output the citation to a log.cite file and prompt the user to examine the file. Note that you should only use this for a paper you or your group authored. E.g. adding a cite in the code for a paper by Nose and Hoover if you write a fix that implements their integrator is not the intended usage. That kind of citation should just be in the doc page you provide.
|
||||
|
||||
Finally, as a general rule-of-thumb, the more clear and self-explanatory you make your documentation and README files, and the easier you make it for people to get started, e.g. by providing example scripts, the more likely it is that users will try out your new feature.
|
||||
|
||||
If the new features/files are broadly useful we may add them as core files to LAMMPS or as part of a standard package. Else we will add them as a user-contributed file or package. Examples of user packages are in src sub-directories that start with USER. The USER-MISC package is simply a collection of (mostly) unrelated single files, which is the simplest way to have your contribution quickly added to the LAMMPS distribution. You can see a list of the both standard and user packages by typing "make package" in the LAMMPS src directory.
|
||||
|
||||
Note that by providing us files to release, you are agreeing to make them open-source, i.e. we can release them under the terms of the GPL, used as a license for the rest of LAMMPS. See Section 1.4 for details.
|
||||
|
||||
With user packages and files, all we are really providing (aside from the fame and fortune that accompanies having your name in the source code and on the Authors page of the LAMMPS WWW site), is a means for you to distribute your work to the LAMMPS user community, and a mechanism for others to easily try out your new feature. This may help you find bugs or make contact with new collaborators. Note that you are also implicitly agreeing to support your code which means answer questions, fix bugs, and maintain it if LAMMPS changes in some way that breaks it (an unusual event).
|
||||
|
||||
To be able to submit an issue on GitHub, you have to register for an account (for GitHub in general). If you do not want to do that, or have other reservations or difficulties to submit a pull request, you can - as an alternative - contact one or more of the core LAMMPS developers and ask if one of them would be interested in manually merging your code into LAMMPS and send them your source code. Since the effort to merge a pull request is a small fraction of the effort of integrating source code manually (which would usually be done by converting the contribution into a pull request), your chances to have your new code included quickly are the best with a pull request.
|
||||
|
||||
If you prefer to submit patches or full files, you should first make certain, that your code works correctly with the latest patch-level version of LAMMPS and contains all bug fixes from it. Then create a gzipped tar file of all changed or added files or a corresponding patch file using 'diff -u' or 'diff -c' and compress it with gzip. Please only use gzip compression, as this works well on all platforms.
|
||||
|
||||
## GitHub Workflows
|
||||
|
||||
|
@ -100,17 +78,17 @@ This section briefly summarizes the steps that will happen **after** you have su
|
|||
|
||||
After submitting an issue, one or more of the LAMMPS developers will review it and categorize it by assigning labels. Confirmed bug reports will be labeled `bug`; if the bug report also contains a suggestion for how to fix it, it will be labeled `bugfix`; if the issue is a feature request, it will be labeled `enhancement`. Other labels may be attached as well, depending on which parts of the LAMMPS code are affected. If the assessment is, that the issue does not warrant any changes, the `wontfix` label will be applied and if the submission is incorrect or something that should not be submitted as an issue, the `invalid` label will be applied. In both of the last two cases, the issue will then be closed without further action.
|
||||
|
||||
For feature requests, what happens next is that developers may comment on the viability or relevance of the request, discuss and make suggestions for how to implement it. If a LAMMPS developer or user is planning to implement the feature, the issue will be assigned to that developer. For developers, that are not yet listed as LAMMPS project collaborators, they will receive an invitation to be added to the LAMMPS project as a collaborator so they can get assigned. If the requested feature or enhancement is implemented, it will usually be submitted as a pull request, which will contain a reference to the issue number. And once the pull request is reviewed and accepted for inclusion into LAMMPS, the issue will be closed. For details on how pull requests are processed, please see below.
|
||||
For feature requests, what happens next is that developers may comment on the viability or relevance of the request, discuss and make suggestions for how to implement it. If a LAMMPS developer or user is planning to implement the feature, the issue will be assigned to that developer. For developers, that are not yet listed as LAMMPS project collaborators, they will receive an invitation to be added to the LAMMPS project as a collaborator so they can get assigned. If the requested feature or enhancement is implemented, it will be submitted as a pull request, which will contain a reference to the issue number. And once the pull request is reviewed and accepted for inclusion into LAMMPS, the issue will be closed. For details on how pull requests are processed, please see below. Feature requests may be labeled with `volunteer_needed` if none of the LAMMPS developers has the time and the required knowledge implement the feature.
|
||||
|
||||
For bug reports, the next step is that one of the core LAMMPS developers will self-assign to the issue and try to confirm the bug. If confirmed, the `bug` label and potentially other labels are added to classify the issue and its impact to LAMMPS. Before confirming, further questions may be asked or requests for providing additional input files or details about the steps required to reproduce the issue. Any bugfix is likely to be submitted as a pull request (more about that below) and since most bugs require only local changes, the bugfix may be included in a pull request specifically set up to collect such local bugfixes or small enhancements. Once the bugfix is included in the master branch, the issue will be closed.
|
||||
For bug reports, the next step is that one of the core LAMMPS developers will self-assign to the issue and try to confirm the bug. If confirmed, the `bug` label and potentially other labels are added to classify the issue and its impact to LAMMPS. Otherwise the `unconfirmed` label will be applied and some comment about what was tried to confirm the bug added. Before confirming, further questions may be asked or requests for providing additional input files or details about the steps required to reproduce the issue. Any bugfix will be submitted as a pull request (more about that below) and since most bugs require only local changes, the bugfix may be included in a pull request specifically set up to collect such local bugfixes or small enhancements. Once the bugfix is included in the master branch, the issue will be closed.
|
||||
|
||||
### Pull Requests
|
||||
|
||||
For submitting pull requests, there is a [detailed tutorial](https://lammps.sandia.gov/doc/Howto_github.html) in the LAMMPS manual. Thus only a brief breakdown of the steps is presented here. Please note, that the LAMMPS developers are still reviewing and trying to improve the process. If you are unsure about something, do not hesitate to post a question on the lammps-users mailing list or contact one fo the core LAMMPS developers.
|
||||
Immediately after the submission, the LAMMPS continuing integration server at ci.lammps.org will download your submitted branch and perform a simple compilation test, i.e. will test whether your submitted code can be compiled under various conditions. It will also do a check on whether your included documentation translates cleanly. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each the pull request is updated with a push to the remote branch on GitHub.
|
||||
Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you are not yet registered as a LAMMPS collaborator, you will receive an invitation for that. As part of the assessment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit).
|
||||
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 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).
|
||||
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.
|
||||
If the assigned developer is satisfied and considers the submission ready for inclusion into LAMMPS, the pull request will receive approvals and be merged into the master branch by one of the core LAMMPS developers. After the pull request is merged, you may delete the feature branch used for the pull request in your personal LAMMPS fork.
|
||||
If the assigned developer is satisfied and considers the submission ready for inclusion into LAMMPS, the pull request will receive approvals and be merged into the master branch by one of the core LAMMPS developers. After the pull request is merged, you may delete the feature branch used for the pull request in your personal LAMMPS fork. The minimum requirement to merge a pull request is that all automated tests have to pass and at least one LAMMPS developer has approved integrating the submitted code. Since the approver will not be the person merging a pull request, you will have at least two LAMMPS developers that looked at your contribution.
|
||||
Since the learning curve for git is quite steep for efficiently managing remote repositories, local and remote branches, pull requests and more, do not hesitate to ask questions, if you are not sure about how to do certain steps that are asked of you. Even if the changes asked of you do not make sense to you, they may be important for the LAMMPS developers. Please also note, that these all are guidelines and nothing set in stone. So depending on the nature of the contribution, the work flow may be adjusted.
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
paths:
|
||||
- src
|
||||
- lib
|
||||
- tools
|
|
@ -0,0 +1,5 @@
|
|||
paths:
|
||||
- python/lammps
|
||||
|
||||
queries:
|
||||
- uses: security-and-quality
|
|
@ -3,7 +3,7 @@ name: "CodeQL Code Analysis"
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
branches: [develop]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
|
@ -31,16 +31,18 @@ jobs:
|
|||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
config-file: ./.github/codeql/${{ matrix.language }}.yml
|
||||
|
||||
- name: Create Build Environment
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
if: ${{ matrix.language == 'cpp' }}
|
||||
run: mkdir build
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
if: ${{ matrix.language == 'cpp' }}
|
||||
shell: bash
|
||||
working-directory: ${{github.workspace}}/build
|
||||
working-directory: build
|
||||
run: |
|
||||
cmake -C $GITHUB_WORKSPACE/cmake/presets/most.cmake $GITHUB_WORKSPACE/cmake
|
||||
cmake -C ../cmake/presets/most.cmake ../cmake
|
||||
cmake --build . --parallel 2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# GitHub action to build LAMMPS on Windows with Visual C++
|
||||
name: "Native Windows Compilation and Unit Tests"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Windows Compilation Test
|
||||
if: ${{ github.repository == 'lammps/lammps' }}
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Select Python version
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m pip install numpy
|
||||
python3 -m pip install pyyaml
|
||||
cmake -C cmake/presets/windows.cmake \
|
||||
-D PKG_PYTHON=on \
|
||||
-S cmake -B build \
|
||||
-D BUILD_SHARED_LIBS=on \
|
||||
-D LAMMPS_EXCEPTIONS=on \
|
||||
-D ENABLE_TESTING=on
|
||||
cmake --build build --config Release
|
||||
|
||||
- name: Run LAMMPS executable
|
||||
shell: bash
|
||||
run: |
|
||||
./build/Release/lmp.exe -h
|
||||
./build/Release/lmp.exe -in bench/in.lj
|
||||
|
||||
- name: Run Unit Tests
|
||||
working-directory: build
|
||||
shell: bash
|
||||
run: ctest -V -C Release
|
|
@ -3,13 +3,15 @@ name: "Unittest for MacOS"
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
branches: [develop]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: MacOS Unit Test
|
||||
if: ${{ github.repository == 'lammps/lammps' }}
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
@ -17,18 +19,37 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Install ccache
|
||||
run: brew install ccache
|
||||
|
||||
- name: Create Build Environment
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
run: mkdir build
|
||||
|
||||
- name: Set up ccache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: macos-ccache-${{ github.sha }}
|
||||
restore-keys: macos-ccache-
|
||||
|
||||
- name: Building LAMMPS via CMake
|
||||
shell: bash
|
||||
working-directory: ${{github.workspace}}/build
|
||||
working-directory: build
|
||||
run: |
|
||||
cmake -C $GITHUB_WORKSPACE/cmake/presets/most.cmake $GITHUB_WORKSPACE/cmake \
|
||||
-DENABLE_TESTING=ON -DBUILD_SHARED_LIBS=ON -DLAMMPS_EXCEPTIONS=ON
|
||||
ccache -z
|
||||
python3 -m pip install pyyaml
|
||||
cmake -C ../cmake/presets/clang.cmake \
|
||||
-C ../cmake/presets/most.cmake \
|
||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-D ENABLE_TESTING=on \
|
||||
-D BUILD_SHARED_LIBS=on \
|
||||
-D LAMMPS_EXCEPTIONS=on \
|
||||
../cmake
|
||||
cmake --build . --parallel 2
|
||||
ccache -s
|
||||
|
||||
- name: Run Tests
|
||||
working-directory: ${{github.workspace}}/build
|
||||
working-directory: build
|
||||
shell: bash
|
||||
run: ctest -V
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*.sif
|
||||
*.dll
|
||||
*.pyc
|
||||
*.whl
|
||||
a.out
|
||||
__pycache__
|
||||
|
||||
Obj_*
|
||||
|
@ -36,13 +38,20 @@ vgcore.*
|
|||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
.clang-format
|
||||
.lammps_history
|
||||
.vs
|
||||
|
||||
#cmake
|
||||
/build*
|
||||
/CMakeCache.txt
|
||||
/CMakeFiles/
|
||||
/Testing
|
||||
/Makefile
|
||||
/Testing
|
||||
/cmake_install.cmake
|
||||
/lmp
|
||||
out/Debug
|
||||
out/RelWithDebInfo
|
||||
out/Release
|
||||
out/x86
|
||||
out/x64
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
extraction:
|
||||
cpp:
|
||||
configure:
|
||||
command:
|
||||
- "mkdir build"
|
||||
- "cd build"
|
||||
- "cmake -G Ninja -C ../cmake/presets/most.cmake ../cmake"
|
||||
index:
|
||||
build_command:
|
||||
- "cd build"
|
||||
- "ninja"
|
||||
python:
|
||||
python_setup:
|
||||
version: 3
|
20
README
20
README
|
@ -14,10 +14,10 @@ LAMMPS is a classical molecular dynamics simulation code designed to
|
|||
run efficiently on parallel computers. It was developed at Sandia
|
||||
National Laboratories, a US Department of Energy facility, with
|
||||
funding from the DOE. It is an open-source code, distributed freely
|
||||
under the terms of the GNU Public License (GPL).
|
||||
under the terms of the GNU Public License (GPL) version 2.
|
||||
|
||||
The primary author of the code is Steve Plimpton, who can be emailed
|
||||
at sjplimp@sandia.gov. The LAMMPS WWW Site at lammps.sandia.gov has
|
||||
at sjplimp@sandia.gov. The LAMMPS WWW Site at www.lammps.org has
|
||||
more information about the code and its uses.
|
||||
|
||||
The LAMMPS distribution includes the following files and directories:
|
||||
|
@ -37,14 +37,14 @@ tools pre- and post-processing tools
|
|||
|
||||
Point your browser at any of these files to get started:
|
||||
|
||||
https://lammps.sandia.gov/doc/Manual.html LAMMPS manual
|
||||
https://lammps.sandia.gov/doc/Intro.html hi-level introduction
|
||||
https://lammps.sandia.gov/doc/Build.html how to build LAMMPS
|
||||
https://lammps.sandia.gov/doc/Run_head.html how to run LAMMPS
|
||||
https://lammps.sandia.gov/doc/Commands_all.html Table of available commands
|
||||
https://lammps.sandia.gov/doc/Library.html LAMMPS library interfaces
|
||||
https://lammps.sandia.gov/doc/Modify.html how to modify and extend LAMMPS
|
||||
https://lammps.sandia.gov/doc/Developer.html LAMMPS developer info
|
||||
https://docs.lammps.org/Manual.html LAMMPS manual
|
||||
https://docs.lammps.org/Intro.html hi-level introduction
|
||||
https://docs.lammps.org/Build.html how to build LAMMPS
|
||||
https://docs.lammps.org/Run_head.html how to run LAMMPS
|
||||
https://docs.lammps.org/Commands_all.html Table of available commands
|
||||
https://docs.lammps.org/Library.html LAMMPS library interfaces
|
||||
https://docs.lammps.org/Modify.html how to modify and extend LAMMPS
|
||||
https://docs.lammps.org/Developer.html LAMMPS developer info
|
||||
|
||||
You can also create these doc pages locally:
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# Security Policy
|
||||
|
||||
LAMMPS is designed as a user-level application to conduct computer
|
||||
simulations for research using classical mechanics. As such LAMMPS
|
||||
depends to some degrees on users providing correctly formatted input and
|
||||
LAMMPS needs to read and write files based on uncontrolled user input.
|
||||
As a parallel application for use in high-performance computing
|
||||
environments, performance critical steps are also done without checking
|
||||
data.
|
||||
|
||||
LAMMPS also is interfaced to a number of external libraries, including
|
||||
libraries with experimental research software, that are not validated
|
||||
and tested by the LAMMPS developers, so it is easy to import bad
|
||||
behavior from calling functions in one of those libraries.
|
||||
|
||||
Thus is is quite easy to crash LAMMPS through malicious input and do all
|
||||
kinds of filesystem manipulations. And because of that LAMMPS should
|
||||
**NEVER** be compiled or **run** as superuser, either from a "root" or
|
||||
"administrator" account directly or indirectly via "sudo" or "su".
|
||||
|
||||
Therefore what could be seen as a security vulnerability is usually
|
||||
either a user mistake or a bug in the code. Bugs can be reported in
|
||||
the LAMMPS project
|
||||
[issue tracker on GitHub](https://github.com/lammps/lammps/issues).
|
||||
|
||||
To mitigate issues with using homoglyphs or bidirectional reordering in
|
||||
unicode, which have been demonstrated as a vector to obfuscate and hide
|
||||
malicious changes to the source code, all LAMMPS submissions are checked
|
||||
for unicode characters and only all-ASCII source code is accepted.
|
||||
|
||||
# Version Updates
|
||||
|
||||
LAMMPS follows continuous release development model. We aim to keep all
|
||||
release versions (stable or patch) fully functional and employ a variety
|
||||
of automatic testing procedures to detect failures of existing
|
||||
functionality from adding new features before releases are made. Thus
|
||||
bugfixes and updates are only integrated into the current development
|
||||
branch and thus the next (patch) release and users are recommended to
|
||||
update regularly.
|
|
@ -1,7 +1,7 @@
|
|||
These are input scripts used to run benchmark tests for many of the
|
||||
interatomic potentials in LAMMPS. The results of running these
|
||||
scripts on different machines are shown on the Potentials section of
|
||||
the Benchmark page of the LAMMPS WWW site (lammps.sandia.gov/bench).
|
||||
the Benchmark page of the LAMMPS WWW site (https://www.lammps.org/bench.html).
|
||||
|
||||
Examples are shown below of how to run these scripts. Log files for
|
||||
running them on 1 and 4 processors of a Linux box are included in the
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# bulk Ni in MEAM
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 3.52
|
||||
region box block 0 20 0 20 0 20
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
|
||||
pair_style meam
|
||||
pair_coeff * * library.meam Ni4 Ni.meam Ni4
|
||||
|
||||
velocity all create 1600.0 376847 loop geom
|
||||
|
||||
neighbor 1.0 bin
|
||||
neigh_modify delay 5 every 1
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
timestep 0.005
|
||||
thermo 50
|
||||
|
||||
run 100
|
|
@ -1,24 +0,0 @@
|
|||
# bulk Ni in MEAM
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 3.52
|
||||
region box block 0 20 0 20 0 20
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
|
||||
pair_style meam/c
|
||||
pair_coeff * * library.meam Ni4 Ni.meam Ni4
|
||||
|
||||
velocity all create 1600.0 376847 loop geom
|
||||
|
||||
neighbor 1.0 bin
|
||||
neigh_modify delay 5 every 1
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
timestep 0.005
|
||||
thermo 50
|
||||
|
||||
run 100
|
|
@ -0,0 +1,84 @@
|
|||
LAMMPS (9 Oct 2020)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
# bulk Ni in MEAM
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 3.52
|
||||
Lattice spacing in x,y,z = 3.5200000 3.5200000 3.5200000
|
||||
region box block 0 20 0 20 0 20
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (70.400000 70.400000 70.400000)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 32000 atoms
|
||||
create_atoms CPU = 0.002 seconds
|
||||
|
||||
pair_style meam
|
||||
pair_coeff * * library.meam Ni4 Ni.meam Ni4
|
||||
Reading potential file library.meam with DATE: 2012-06-29
|
||||
Reading potential file Ni.meam with DATE: 2007-06-11
|
||||
|
||||
velocity all create 1600.0 376847 loop geom
|
||||
|
||||
neighbor 1.0 bin
|
||||
neigh_modify delay 5 every 1
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
timestep 0.005
|
||||
thermo 50
|
||||
|
||||
run 100
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 5 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5
|
||||
ghost atom cutoff = 5
|
||||
binsize = 2.5, bins = 29 29 29
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair meam, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
(2) pair meam, perpetual, half/full from (1)
|
||||
attributes: half, newton on
|
||||
pair build: halffull/newton
|
||||
stencil: none
|
||||
bin: none
|
||||
Per MPI rank memory allocation (min/avg/max) = 55.92 | 55.92 | 55.92 Mbytes
|
||||
Step Temp E_pair E_mol TotEng Press
|
||||
0 1600 -142400 0 -135782.09 20259.18
|
||||
50 885.10702 -139411.51 0 -135750.54 32425.431
|
||||
100 895.50973 -139454.3 0 -135750.3 31804.185
|
||||
Loop time of 21.655 on 1 procs for 100 steps with 32000 atoms
|
||||
|
||||
Performance: 1.995 ns/day, 12.031 hours/ns, 4.618 timesteps/s
|
||||
99.9% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 21.181 | 21.181 | 21.181 | 0.0 | 97.81
|
||||
Neigh | 0.42787 | 0.42787 | 0.42787 | 0.0 | 1.98
|
||||
Comm | 0.013557 | 0.013557 | 0.013557 | 0.0 | 0.06
|
||||
Output | 0.00020766 | 0.00020766 | 0.00020766 | 0.0 | 0.00
|
||||
Modify | 0.023456 | 0.023456 | 0.023456 | 0.0 | 0.11
|
||||
Other | | 0.008504 | | | 0.04
|
||||
|
||||
Nlocal: 32000.0 ave 32000 max 32000 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 13576.0 ave 13576 max 13576 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 780360.0 ave 780360 max 780360 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
FullNghs: 1.56072e+06 ave 1.56072e+06 max 1.56072e+06 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 1560720
|
||||
Ave neighs/atom = 48.772500
|
||||
Neighbor list builds = 8
|
||||
Dangerous builds = 0
|
||||
Total wall time: 0:00:21
|
|
@ -0,0 +1,84 @@
|
|||
LAMMPS (9 Oct 2020)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
# bulk Ni in MEAM
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 3.52
|
||||
Lattice spacing in x,y,z = 3.5200000 3.5200000 3.5200000
|
||||
region box block 0 20 0 20 0 20
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (70.400000 70.400000 70.400000)
|
||||
1 by 2 by 2 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 32000 atoms
|
||||
create_atoms CPU = 0.001 seconds
|
||||
|
||||
pair_style meam
|
||||
pair_coeff * * library.meam Ni4 Ni.meam Ni4
|
||||
Reading potential file library.meam with DATE: 2012-06-29
|
||||
Reading potential file Ni.meam with DATE: 2007-06-11
|
||||
|
||||
velocity all create 1600.0 376847 loop geom
|
||||
|
||||
neighbor 1.0 bin
|
||||
neigh_modify delay 5 every 1
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
timestep 0.005
|
||||
thermo 50
|
||||
|
||||
run 100
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 5 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5
|
||||
ghost atom cutoff = 5
|
||||
binsize = 2.5, bins = 29 29 29
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair meam, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
(2) pair meam, perpetual, half/full from (1)
|
||||
attributes: half, newton on
|
||||
pair build: halffull/newton
|
||||
stencil: none
|
||||
bin: none
|
||||
Per MPI rank memory allocation (min/avg/max) = 17.42 | 17.42 | 17.42 Mbytes
|
||||
Step Temp E_pair E_mol TotEng Press
|
||||
0 1600 -142400 0 -135782.09 20259.18
|
||||
50 885.10702 -139411.51 0 -135750.54 32425.431
|
||||
100 895.50973 -139454.3 0 -135750.3 31804.185
|
||||
Loop time of 6.34746 on 4 procs for 100 steps with 32000 atoms
|
||||
|
||||
Performance: 6.806 ns/day, 3.526 hours/ns, 15.754 timesteps/s
|
||||
98.0% CPU use with 4 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 6.0585 | 6.1109 | 6.1535 | 1.4 | 96.27
|
||||
Neigh | 0.11286 | 0.11651 | 0.12455 | 1.4 | 1.84
|
||||
Comm | 0.058046 | 0.099641 | 0.15569 | 11.7 | 1.57
|
||||
Output | 9.0122e-05 | 0.00016046 | 0.0003624 | 0.0 | 0.00
|
||||
Modify | 0.010822 | 0.011674 | 0.014224 | 1.4 | 0.18
|
||||
Other | | 0.008601 | | | 0.14
|
||||
|
||||
Nlocal: 8000.00 ave 8045 max 7947 min
|
||||
Histogram: 1 0 0 1 0 0 0 1 0 1
|
||||
Nghost: 6066.75 ave 6120 max 6021 min
|
||||
Histogram: 1 0 1 0 0 0 1 0 0 1
|
||||
Neighs: 195090.0 ave 196403 max 193697 min
|
||||
Histogram: 1 0 0 1 0 0 0 1 0 1
|
||||
FullNghs: 390180.0 ave 392616 max 387490 min
|
||||
Histogram: 1 0 0 1 0 0 0 1 0 1
|
||||
|
||||
Total # of neighbors = 1560720
|
||||
Ave neighs/atom = 48.772500
|
||||
Neighbor list builds = 8
|
||||
Dangerous builds = 0
|
||||
Total wall time: 0:00:06
|
|
@ -1,84 +0,0 @@
|
|||
LAMMPS (9 Oct 2020)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
# bulk Ni in MEAM
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 3.52
|
||||
Lattice spacing in x,y,z = 3.5200000 3.5200000 3.5200000
|
||||
region box block 0 20 0 20 0 20
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (70.400000 70.400000 70.400000)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 32000 atoms
|
||||
create_atoms CPU = 0.002 seconds
|
||||
|
||||
pair_style meam/c
|
||||
pair_coeff * * library.meam Ni4 Ni.meam Ni4
|
||||
Reading potential file library.meam with DATE: 2012-06-29
|
||||
Reading potential file Ni.meam with DATE: 2007-06-11
|
||||
|
||||
velocity all create 1600.0 376847 loop geom
|
||||
|
||||
neighbor 1.0 bin
|
||||
neigh_modify delay 5 every 1
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
timestep 0.005
|
||||
thermo 50
|
||||
|
||||
run 100
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 5 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5
|
||||
ghost atom cutoff = 5
|
||||
binsize = 2.5, bins = 29 29 29
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair meam/c, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
(2) pair meam/c, perpetual, half/full from (1)
|
||||
attributes: half, newton on
|
||||
pair build: halffull/newton
|
||||
stencil: none
|
||||
bin: none
|
||||
Per MPI rank memory allocation (min/avg/max) = 55.92 | 55.92 | 55.92 Mbytes
|
||||
Step Temp E_pair E_mol TotEng Press
|
||||
0 1600 -142400 0 -135782.09 20259.18
|
||||
50 885.10702 -139411.51 0 -135750.54 32425.431
|
||||
100 895.50973 -139454.3 0 -135750.3 31804.185
|
||||
Loop time of 21.655 on 1 procs for 100 steps with 32000 atoms
|
||||
|
||||
Performance: 1.995 ns/day, 12.031 hours/ns, 4.618 timesteps/s
|
||||
99.9% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 21.181 | 21.181 | 21.181 | 0.0 | 97.81
|
||||
Neigh | 0.42787 | 0.42787 | 0.42787 | 0.0 | 1.98
|
||||
Comm | 0.013557 | 0.013557 | 0.013557 | 0.0 | 0.06
|
||||
Output | 0.00020766 | 0.00020766 | 0.00020766 | 0.0 | 0.00
|
||||
Modify | 0.023456 | 0.023456 | 0.023456 | 0.0 | 0.11
|
||||
Other | | 0.008504 | | | 0.04
|
||||
|
||||
Nlocal: 32000.0 ave 32000 max 32000 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 13576.0 ave 13576 max 13576 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 780360.0 ave 780360 max 780360 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
FullNghs: 1.56072e+06 ave 1.56072e+06 max 1.56072e+06 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 1560720
|
||||
Ave neighs/atom = 48.772500
|
||||
Neighbor list builds = 8
|
||||
Dangerous builds = 0
|
||||
Total wall time: 0:00:21
|
|
@ -1,84 +0,0 @@
|
|||
LAMMPS (9 Oct 2020)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
# bulk Ni in MEAM
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 3.52
|
||||
Lattice spacing in x,y,z = 3.5200000 3.5200000 3.5200000
|
||||
region box block 0 20 0 20 0 20
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (70.400000 70.400000 70.400000)
|
||||
1 by 2 by 2 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 32000 atoms
|
||||
create_atoms CPU = 0.001 seconds
|
||||
|
||||
pair_style meam/c
|
||||
pair_coeff * * library.meam Ni4 Ni.meam Ni4
|
||||
Reading potential file library.meam with DATE: 2012-06-29
|
||||
Reading potential file Ni.meam with DATE: 2007-06-11
|
||||
|
||||
velocity all create 1600.0 376847 loop geom
|
||||
|
||||
neighbor 1.0 bin
|
||||
neigh_modify delay 5 every 1
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
timestep 0.005
|
||||
thermo 50
|
||||
|
||||
run 100
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 5 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5
|
||||
ghost atom cutoff = 5
|
||||
binsize = 2.5, bins = 29 29 29
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair meam/c, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
(2) pair meam/c, perpetual, half/full from (1)
|
||||
attributes: half, newton on
|
||||
pair build: halffull/newton
|
||||
stencil: none
|
||||
bin: none
|
||||
Per MPI rank memory allocation (min/avg/max) = 17.42 | 17.42 | 17.42 Mbytes
|
||||
Step Temp E_pair E_mol TotEng Press
|
||||
0 1600 -142400 0 -135782.09 20259.18
|
||||
50 885.10702 -139411.51 0 -135750.54 32425.431
|
||||
100 895.50973 -139454.3 0 -135750.3 31804.185
|
||||
Loop time of 6.34746 on 4 procs for 100 steps with 32000 atoms
|
||||
|
||||
Performance: 6.806 ns/day, 3.526 hours/ns, 15.754 timesteps/s
|
||||
98.0% CPU use with 4 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 6.0585 | 6.1109 | 6.1535 | 1.4 | 96.27
|
||||
Neigh | 0.11286 | 0.11651 | 0.12455 | 1.4 | 1.84
|
||||
Comm | 0.058046 | 0.099641 | 0.15569 | 11.7 | 1.57
|
||||
Output | 9.0122e-05 | 0.00016046 | 0.0003624 | 0.0 | 0.00
|
||||
Modify | 0.010822 | 0.011674 | 0.014224 | 1.4 | 0.18
|
||||
Other | | 0.008601 | | | 0.14
|
||||
|
||||
Nlocal: 8000.00 ave 8045 max 7947 min
|
||||
Histogram: 1 0 0 1 0 0 0 1 0 1
|
||||
Nghost: 6066.75 ave 6120 max 6021 min
|
||||
Histogram: 1 0 1 0 0 0 1 0 0 1
|
||||
Neighs: 195090.0 ave 196403 max 193697 min
|
||||
Histogram: 1 0 0 1 0 0 0 1 0 1
|
||||
FullNghs: 390180.0 ave 392616 max 387490 min
|
||||
Histogram: 1 0 0 1 0 0 0 1 0 1
|
||||
|
||||
Total # of neighbors = 1560720
|
||||
Ave neighs/atom = 48.772500
|
||||
Neighbor list builds = 8
|
||||
Dangerous builds = 0
|
||||
Total wall time: 0:00:06
|
|
@ -24,7 +24,7 @@ velocity all create 300.0 9999
|
|||
|
||||
pair_style reax/c NULL
|
||||
pair_coeff * * ffield.reax C H O N
|
||||
WARNING: Changed valency_val to valency_boc for X (src/USER-REAXC/reaxc_ffield.cpp:315)
|
||||
WARNING: Changed valency_val to valency_boc for X (src/REAXFF/reaxc_ffield.cpp:315)
|
||||
|
||||
timestep 0.1
|
||||
fix 1 all nve
|
||||
|
|
|
@ -24,7 +24,7 @@ velocity all create 300.0 9999
|
|||
|
||||
pair_style reax/c NULL
|
||||
pair_coeff * * ffield.reax C H O N
|
||||
WARNING: Changed valency_val to valency_boc for X (src/USER-REAXC/reaxc_ffield.cpp:315)
|
||||
WARNING: Changed valency_val to valency_boc for X (src/REAXFF/reaxc_ffield.cpp:315)
|
||||
|
||||
timestep 0.1
|
||||
fix 1 all nve
|
||||
|
|
|
@ -2,16 +2,14 @@ LAMMPS benchmark problems
|
|||
|
||||
This directory contains 5 benchmark problems which are discussed in
|
||||
the Benchmark section of the LAMMPS documentation, and on the
|
||||
Benchmark page of the LAMMPS WWW site (lammps.sandia.gov/bench).
|
||||
Benchmark page of the LAMMPS WWW site (https://www.lammps.org/bench.html).
|
||||
|
||||
This directory also has several sub-directories:
|
||||
This directory also has one sub-directories:
|
||||
|
||||
FERMI benchmark scripts for desktop machine with Fermi GPUs (Tesla)
|
||||
KEPLER benchmark scripts for GPU cluster with Kepler GPUs
|
||||
POTENTIALS benchmarks scripts for various potentials in LAMMPS
|
||||
|
||||
The results for all of these benchmarks are displayed and discussed on
|
||||
the Benchmark page of the LAMMPS WWW site: lammps.sandia.gov/bench.
|
||||
the Benchmark page of the LAMMPS WWW site: https://www.lammps.org/bench.html
|
||||
|
||||
The remainder of this file refers to the 5 problems in the top-level
|
||||
of this directory and how to run them on CPUs, either in serial or
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
[run]
|
||||
source = @LAMMPS_PYTHON_DIR@
|
||||
parallel=True
|
||||
branch=True
|
||||
omit=*/install.py
|
||||
*/setup.py
|
||||
|
||||
[paths]
|
||||
sources = python
|
||||
@LAMMPS_PYTHON_DIR@
|
|
@ -7,13 +7,22 @@ cmake_minimum_required(VERSION 3.10)
|
|||
if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
# set policy to silence warnings about missing executable permissions in
|
||||
# pythonx.y-config when cross-compiling. review occasionally if it may be set to NEW
|
||||
if(POLICY CMP0109)
|
||||
cmake_policy(SET CMP0109 OLD)
|
||||
endif()
|
||||
########################################
|
||||
|
||||
project(lammps CXX)
|
||||
set(SOVERSION 0)
|
||||
get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
get_filename_component(LAMMPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE)
|
||||
get_filename_component(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib ABSOLUTE)
|
||||
# collect all executables and shared libs in the top level build folder
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
set(LAMMPS_SOURCE_DIR ${LAMMPS_DIR}/src)
|
||||
set(LAMMPS_LIB_SOURCE_DIR ${LAMMPS_DIR}/lib)
|
||||
|
@ -22,12 +31,21 @@ set(LAMMPS_TOOLS_DIR ${LAMMPS_DIR}/tools)
|
|||
set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python)
|
||||
set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials)
|
||||
|
||||
set(LAMMPS_DOWNLOADS_URL "https://download.lammps.org" CACHE STRING "Base URL for LAMMPS downloads")
|
||||
set(LAMMPS_POTENTIALS_URL "${LAMMPS_DOWNLOADS_URL}/potentials")
|
||||
set(LAMMPS_THIRDPARTY_URL "${LAMMPS_DOWNLOADS_URL}/thirdparty")
|
||||
mark_as_advanced(LAMMPS_DOWNLOADS_URL)
|
||||
|
||||
find_package(Git)
|
||||
|
||||
# by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND (NOT CMAKE_CROSSCOMPILING))
|
||||
set(CMAKE_INSTALL_PREFIX "$ENV{USERPROFILE}/LAMMPS" CACHE PATH "Default install path" FORCE)
|
||||
else()
|
||||
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If enabled, no need to use LD_LIBRARY_PATH / DYLD_LIBRARY_PATH when installed
|
||||
option(LAMMPS_INSTALL_RPATH "Set runtime path for shared libraries linked to LAMMPS binaries" OFF)
|
||||
|
@ -67,7 +85,17 @@ check_for_autogen_files(${LAMMPS_SOURCE_DIR})
|
|||
include(CheckIncludeFileCXX)
|
||||
|
||||
# set required compiler flags and compiler/CPU arch specific optimizations
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qrestrict")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
|
||||
set(CMAKE_TUNE_DEFAULT "/QxCOMMON-AVX512")
|
||||
else()
|
||||
set(CMAKE_TUNE_DEFAULT "/QxHost")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
|
||||
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
|
||||
|
@ -75,11 +103,48 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
|
|||
set(CMAKE_TUNE_DEFAULT "-xHost")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# we require C++11 without extensions
|
||||
# silence excessive warnings for new Intel Compilers
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
||||
set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare")
|
||||
endif()
|
||||
|
||||
# silence excessive warnings for PGI/NVHPC compilers
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "PGI"))
|
||||
set(CMAKE_TUNE_DEFAULT "-Minform=severe")
|
||||
endif()
|
||||
|
||||
# silence nvcc warnings
|
||||
if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA))
|
||||
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma")
|
||||
endif()
|
||||
|
||||
# we require C++11 without extensions. Kokkos requires at least C++14 (currently)
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
if(CMAKE_CXX_STANDARD LESS 11)
|
||||
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
||||
endif()
|
||||
if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14))
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
||||
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
||||
# and prints lots of pointless warnings about "unsafe" functions
|
||||
if(MSVC)
|
||||
add_compile_options(/Zc:__cplusplus)
|
||||
add_compile_options(/wd4244)
|
||||
add_compile_options(/wd4267)
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# export all symbols when building a .dll file on windows
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND BUILD_SHARED_LIBS)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# User input options #
|
||||
|
@ -92,18 +157,27 @@ endif()
|
|||
set(LAMMPS_BINARY lmp${LAMMPS_MACHINE})
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
||||
if(BUILD_SHARED_LIBS) # for all pkg libs, mpi_stubs and linalg
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
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_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF)
|
||||
|
||||
# allow enabling clang-tidy for C++ files
|
||||
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
|
||||
if(ENABLE_CLANG_TIDY)
|
||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*-header-filter=.*" CACHE STRING "")
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(GLOB ALL_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||
file(GLOB MAIN_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
||||
add_library(lammps ${ALL_SOURCES})
|
||||
|
||||
# tell CMake to export all symbols to a .dll on Windows with MinGW cross-compilers
|
||||
if(BUILD_SHARED_LIBS AND (CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||
set_target_properties(lammps PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
|
||||
endif()
|
||||
|
||||
add_executable(lmp ${MAIN_SOURCES})
|
||||
target_link_libraries(lmp PRIVATE lammps)
|
||||
set_target_properties(lmp PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY})
|
||||
|
@ -111,17 +185,92 @@ install(TARGETS lmp EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|||
|
||||
option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
||||
|
||||
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE
|
||||
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS
|
||||
QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
|
||||
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK
|
||||
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD
|
||||
USER-LB USER-MANIFOLD USER-MEAMC USER-MESONT USER-MGPT USER-MISC USER-MOFFF
|
||||
USER-MOLFILE USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB
|
||||
USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH
|
||||
USER-TALLY USER-UEF USER-VTK USER-QUIP USER-QMMM USER-YAFF)
|
||||
set(STANDARD_PACKAGES
|
||||
ADIOS
|
||||
ASPHERE
|
||||
ATC
|
||||
AWPMD
|
||||
BOCS
|
||||
BODY
|
||||
BPM
|
||||
BROWNIAN
|
||||
CG-DNA
|
||||
CG-SDK
|
||||
CLASS2
|
||||
COLLOID
|
||||
COLVARS
|
||||
COMPRESS
|
||||
DIELECTRIC
|
||||
DIFFRACTION
|
||||
DIPOLE
|
||||
DPD-BASIC
|
||||
DPD-MESO
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
EXTRA-FIX
|
||||
EXTRA-MOLECULE
|
||||
EXTRA-PAIR
|
||||
FEP
|
||||
GRANULAR
|
||||
H5MD
|
||||
INTERLAYER
|
||||
KIM
|
||||
KSPACE
|
||||
LATBOLTZ
|
||||
LATTE
|
||||
MACHDYN
|
||||
MANIFOLD
|
||||
MANYBODY
|
||||
MC
|
||||
MDI
|
||||
MEAM
|
||||
MESONT
|
||||
MGPT
|
||||
MISC
|
||||
ML-HDNNP
|
||||
ML-IAP
|
||||
ML-PACE
|
||||
ML-QUIP
|
||||
ML-RANN
|
||||
ML-SNAP
|
||||
MOFFF
|
||||
MOLECULE
|
||||
MOLFILE
|
||||
MPIIO
|
||||
MSCG
|
||||
NETCDF
|
||||
ORIENT
|
||||
PERI
|
||||
PHONON
|
||||
PLUGIN
|
||||
PLUMED
|
||||
POEMS
|
||||
PTM
|
||||
PYTHON
|
||||
QEQ
|
||||
QMMM
|
||||
QTB
|
||||
REACTION
|
||||
REAXFF
|
||||
REPLICA
|
||||
RIGID
|
||||
SCAFACOS
|
||||
SHOCK
|
||||
SMTBQ
|
||||
SPH
|
||||
SPIN
|
||||
SRD
|
||||
TALLY
|
||||
UEF
|
||||
VORONOI
|
||||
VTK
|
||||
YAFF)
|
||||
|
||||
set(SUFFIX_PACKAGES CORESHELL GPU KOKKOS OPT USER-INTEL USER-OMP)
|
||||
set(SUFFIX_PACKAGES CORESHELL GPU KOKKOS OPT INTEL OPENMP)
|
||||
|
||||
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||
option(PKG_${PKG} "Build ${PKG} Package" OFF)
|
||||
|
@ -132,7 +281,7 @@ endforeach()
|
|||
######################################################
|
||||
target_include_directories(lammps PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}>)
|
||||
|
||||
if(PKG_USER-ADIOS)
|
||||
if(PKG_ADIOS)
|
||||
# The search for ADIOS2 must come before MPI because
|
||||
# it includes its own MPI search with the latest FindMPI.cmake
|
||||
# script that defines the MPI::MPI_C target
|
||||
|
@ -142,7 +291,6 @@ if(PKG_USER-ADIOS)
|
|||
endif()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
find_package(MPI QUIET)
|
||||
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
||||
else()
|
||||
|
@ -150,32 +298,26 @@ else()
|
|||
endif()
|
||||
|
||||
if(BUILD_MPI)
|
||||
# do not include the (obsolete) MPI C++ bindings which makes
|
||||
# for leaner object files and avoids namespace conflicts
|
||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||
include(MPI4WIN)
|
||||
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
|
||||
else()
|
||||
find_package(MPI REQUIRED)
|
||||
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
|
||||
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
||||
if(LAMMPS_LONGLONG_TO_LONG)
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_LONGLONG_TO_LONG)
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
|
||||
else()
|
||||
file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.cpp)
|
||||
add_library(mpi_stubs STATIC ${MPI_SOURCES})
|
||||
set_target_properties(mpi_stubs PROPERTIES OUTPUT_NAME lammps_mpi_stubs${LAMMPS_MACHINE})
|
||||
target_include_directories(mpi_stubs PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries(lammps PRIVATE mpi_stubs)
|
||||
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
|
||||
target_compile_definitions(lammps INTERFACE $<INSTALL_INTERFACE:LAMMPS_LIB_NO_MPI>)
|
||||
else()
|
||||
target_sources(lammps PRIVATE ${LAMMPS_SOURCE_DIR}/STUBS/mpi.cpp)
|
||||
add_library(mpi_stubs INTERFACE)
|
||||
target_include_directories(mpi_stubs INTERFACE $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
|
||||
target_link_libraries(lammps PUBLIC mpi_stubs)
|
||||
endif()
|
||||
add_library(MPI::MPI_CXX ALIAS mpi_stubs)
|
||||
endif()
|
||||
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
|
||||
|
@ -185,7 +327,7 @@ string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
|||
target_compile_definitions(lammps PUBLIC -DLAMMPS_${LAMMPS_SIZES})
|
||||
|
||||
# posix_memalign is not available on Windows
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(LAMMPS_MEMALIGN "0" CACHE STRING "posix_memalign() is not available on Windows" FORCE)
|
||||
else()
|
||||
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable")
|
||||
|
@ -201,12 +343,15 @@ endif()
|
|||
|
||||
# "hard" dependencies between packages resulting
|
||||
# in an error instead of skipping over files
|
||||
pkg_depends(MLIAP SNAP)
|
||||
pkg_depends(ML-IAP ML-SNAP)
|
||||
pkg_depends(MPIIO MPI)
|
||||
pkg_depends(USER-ATC MANYBODY)
|
||||
pkg_depends(USER-LB MPI)
|
||||
pkg_depends(USER-PHONON KSPACE)
|
||||
pkg_depends(USER-SCAFACOS MPI)
|
||||
pkg_depends(ATC MANYBODY)
|
||||
pkg_depends(LATBOLTZ MPI)
|
||||
pkg_depends(SCAFACOS MPI)
|
||||
pkg_depends(DIELECTRIC KSPACE)
|
||||
pkg_depends(DIELECTRIC EXTRA-PAIR)
|
||||
pkg_depends(CG-DNA MOLECULE)
|
||||
pkg_depends(CG-DNA ASPHERE)
|
||||
|
||||
# detect if we may enable OpenMP support by default
|
||||
set(BUILD_OMP_DEFAULT OFF)
|
||||
|
@ -228,81 +373,23 @@ if(BUILD_OMP)
|
|||
endif()
|
||||
|
||||
if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") OR (CMAKE_CXX_COMPILER_ID STREQUAL "XLClang") OR
|
||||
((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
||||
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
||||
((CMAKE_CXX_COMPILER_ID STREQUAL "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.
|
||||
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=4)
|
||||
set(LAMMPS_OMP_COMPAT_LEVEL 4)
|
||||
else()
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=3)
|
||||
set(LAMMPS_OMP_COMPAT_LEVEL 3)
|
||||
endif()
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=${LAMMPS_OMP_COMPAT_LEVEL})
|
||||
target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX)
|
||||
target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX)
|
||||
endif()
|
||||
|
||||
# Compiler specific features for testing
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
||||
mark_as_advanced(ENABLE_COVERAGE)
|
||||
if(ENABLE_COVERAGE)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(lammps PUBLIC --coverage)
|
||||
target_link_options(lammps PUBLIC --coverage)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#######################################
|
||||
# add custom target for IWYU analysis
|
||||
#######################################
|
||||
set(ENABLE_IWYU OFF CACHE BOOL "Add 'iwyu' build target to call the include-what-you-use tool")
|
||||
mark_as_advanced(ENABLE_IWYU)
|
||||
if(ENABLE_IWYU)
|
||||
find_program(IWYU_EXE NAMES include-what-you-use iwyu)
|
||||
find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py)
|
||||
if (IWYU_EXE AND IWYU_TOOL)
|
||||
add_custom_target(
|
||||
iwyu
|
||||
${IWYU_TOOL} -o clang -p ${CMAKE_CURRENT_BINARY_DIR} -- -Xiwyu --mapping_file=${CMAKE_CURRENT_SOURCE_DIR}/iwyu/iwyu-extra-map.imp
|
||||
COMMENT "Running IWYU")
|
||||
add_dependencies(iwyu lammps)
|
||||
else()
|
||||
message(FATAL_ERROR "To use IWYU you need the include-what-you-use/iwyu executable"
|
||||
"and the iwyu-tool/iwyu_tool script installed in your PATH")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)")
|
||||
mark_as_advanced(ENABLE_SANITIZER)
|
||||
set(ENABLE_SANITIZER_VALUES none address leak thread undefined)
|
||||
set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${ENABLE_SANITIZER_VALUES})
|
||||
validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
|
||||
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
||||
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
||||
set(ENABLE_SANITIZER "none")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
|
||||
if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE)
|
||||
enable_language(C)
|
||||
find_package(LAPACK)
|
||||
find_package(BLAS)
|
||||
|
@ -322,6 +409,8 @@ if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# tweak jpeg library names to avoid linker errors with MinGW cross-compilation
|
||||
set(JPEG_NAMES libjpeg libjpeg-62)
|
||||
find_package(JPEG QUIET)
|
||||
option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
||||
if(WITH_JPEG)
|
||||
|
@ -353,7 +442,7 @@ find_program(GZIP_EXECUTABLE gzip)
|
|||
find_package_handle_standard_args(GZIP REQUIRED_VARS GZIP_EXECUTABLE)
|
||||
option(WITH_GZIP "Enable GZIP support" ${GZIP_FOUND})
|
||||
if(WITH_GZIP)
|
||||
if(GZIP_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING))
|
||||
if(GZIP_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING))
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_GZIP)
|
||||
else()
|
||||
message(FATAL_ERROR "gzip executable not found")
|
||||
|
@ -364,7 +453,7 @@ find_program(FFMPEG_EXECUTABLE ffmpeg)
|
|||
find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_EXECUTABLE)
|
||||
option(WITH_FFMPEG "Enable FFMPEG support" ${FFMPEG_FOUND})
|
||||
if(WITH_FFMPEG)
|
||||
if(FFMPEG_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING))
|
||||
if(FFMPEG_FOUND OR ((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING))
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_FFMPEG)
|
||||
else()
|
||||
message(FATAL_ERROR "ffmpeg executable not found")
|
||||
|
@ -381,8 +470,8 @@ else()
|
|||
set(CUDA_REQUEST_PIC)
|
||||
endif()
|
||||
|
||||
foreach(PKG_WITH_INCL KSPACE PYTHON MLIAP VORONOI USER-COLVARS USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM
|
||||
USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS)
|
||||
foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF
|
||||
PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM LATTE MSCG COMPRESS ML-PACE)
|
||||
if(PKG_${PKG_WITH_INCL})
|
||||
include(Packages/${PKG_WITH_INCL})
|
||||
endif()
|
||||
|
@ -399,6 +488,7 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine
|
|||
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||
target_compile_options(lmp PRIVATE ${_FLAG})
|
||||
endforeach()
|
||||
########################################################################
|
||||
# Basic system tests (standard libraries, headers, functions, types) #
|
||||
|
@ -410,9 +500,12 @@ foreach(HEADER cmath)
|
|||
endif(NOT FOUND_${HEADER})
|
||||
endforeach(HEADER)
|
||||
|
||||
set(MATH_LIBRARIES "m" CACHE STRING "math library")
|
||||
mark_as_advanced( MATH_LIBRARIES )
|
||||
target_link_libraries(lammps PRIVATE ${MATH_LIBRARIES})
|
||||
# make the standard math library overrideable and autodetected (for systems that don't have it)
|
||||
find_library(STANDARD_MATH_LIB m DOC "Standard Math library")
|
||||
mark_as_advanced(STANDARD_MATH_LIB)
|
||||
if(STANDARD_MATH_LIB)
|
||||
target_link_libraries(lammps PRIVATE ${STANDARD_MATH_LIB})
|
||||
endif()
|
||||
|
||||
######################################
|
||||
# Generate Basic Style files
|
||||
|
@ -475,11 +568,10 @@ endforeach()
|
|||
##############################################
|
||||
# add lib sources of (simple) enabled packages
|
||||
############################################
|
||||
foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD USER-MESONT)
|
||||
if(PKG_${SIMPLE_LIB})
|
||||
string(REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}")
|
||||
foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT)
|
||||
if(PKG_${PKG_LIB})
|
||||
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
||||
if(PKG_LIB STREQUAL mesont)
|
||||
if(PKG_LIB STREQUAL "mesont")
|
||||
enable_language(Fortran)
|
||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.f90)
|
||||
|
@ -491,9 +583,9 @@ foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD USER-MESONT)
|
|||
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
||||
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
||||
target_link_libraries(lammps PRIVATE ${PKG_LIB})
|
||||
if(PKG_LIB STREQUAL awpmd)
|
||||
if(PKG_LIB STREQUAL "awpmd")
|
||||
target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include)
|
||||
elseif(PKG_LIB STREQUAL h5md)
|
||||
elseif(PKG_LIB STREQUAL "h5md")
|
||||
target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include ${HDF5_INCLUDE_DIRS})
|
||||
else()
|
||||
target_include_directories(${PKG_LIB} PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB})
|
||||
|
@ -501,45 +593,53 @@ foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD USER-MESONT)
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
if(PKG_USER-AWPMD)
|
||||
if(PKG_AWPMD)
|
||||
target_link_libraries(awpmd PRIVATE ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(PKG_USER-ATC)
|
||||
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
||||
message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG")
|
||||
if(PKG_ATC)
|
||||
if(LAMMPS_SIZES STREQUAL "BIGBIG")
|
||||
message(FATAL_ERROR "The ATC Package is not compatible with -DLAMMPS_BIGBIG")
|
||||
endif()
|
||||
target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES})
|
||||
if(BUILD_MPI)
|
||||
target_link_libraries(atc PRIVATE MPI::MPI_CXX)
|
||||
target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES} MPI::MPI_CXX)
|
||||
else()
|
||||
target_link_libraries(atc PRIVATE mpi_stubs)
|
||||
target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES} mpi_stubs)
|
||||
endif()
|
||||
target_include_directories(atc PRIVATE ${LAMMPS_SOURCE_DIR})
|
||||
target_compile_definitions(atc PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||
endif()
|
||||
|
||||
if(PKG_USER-H5MD)
|
||||
include(Packages/USER-H5MD)
|
||||
if(PKG_H5MD)
|
||||
include(Packages/H5MD)
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
# packages which selectively include variants based on enabled styles
|
||||
# e.g. accelerator packages
|
||||
######################################################################
|
||||
foreach(PKG_WITH_INCL CORESHELL QEQ USER-OMP USER-SDPD KOKKOS OPT USER-INTEL GPU)
|
||||
foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH PHONON QEQ OPENMP KOKKOS OPT INTEL GPU)
|
||||
if(PKG_${PKG_WITH_INCL})
|
||||
include(Packages/${PKG_WITH_INCL})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(PKG_PLUGIN)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
|
||||
endif()
|
||||
|
||||
# link with -ldl or equivalent for plugin loading; except on Windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
# the windows version of LAMMPS requires a couple extra libraries
|
||||
# and the MPI library - if use - has to be linked right before those
|
||||
# and after everything else that is compiled locally
|
||||
######################################################################
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE -lwsock32 -lpsapi)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE "wsock32;psapi")
|
||||
endif()
|
||||
|
||||
######################################################
|
||||
|
@ -588,7 +688,7 @@ add_dependencies(lammps gitversion)
|
|||
############################################
|
||||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
list(FIND LANGUAGES "Fortran" _index)
|
||||
if(${_index} GREATER -1)
|
||||
if(_index GREATER -1)
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||
endif()
|
||||
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h compute.h dihedral.h domain.h error.h fix.h force.h group.h improper.h
|
||||
|
@ -600,6 +700,7 @@ endif()
|
|||
|
||||
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
|
||||
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
||||
set_target_properties(lammps PROPERTIES PREFIX "lib")
|
||||
target_include_directories(lammps PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps>)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps)
|
||||
foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
||||
|
@ -619,6 +720,9 @@ foreach(_DEF ${LAMMPS_DEFINES})
|
|||
endforeach()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS lammps EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
if(NOT BUILD_MPI)
|
||||
install(TARGETS mpi_stubs EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(EXPORT LAMMPS_Targets FILE LAMMPS_Targets.cmake NAMESPACE LAMMPS:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LAMMPS)
|
||||
|
@ -658,7 +762,7 @@ install(
|
|||
if(BUILD_SHARED_LIBS)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
||||
set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5)
|
||||
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})
|
||||
|
@ -666,13 +770,15 @@ if(BUILD_SHARED_LIBS)
|
|||
else()
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
endif()
|
||||
if(BUILD_IS_MULTI_CONFIG)
|
||||
set(LIBLAMMPS_SHARED_BINARY ${CMAKE_BINARY_DIR}/$<CONFIG>/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
else()
|
||||
set(LIBLAMMPS_SHARED_BINARY ${CMAKE_BINARY_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
endif()
|
||||
if(Python_EXECUTABLE)
|
||||
add_custom_target(
|
||||
install-python ${CMAKE_COMMAND} -E remove_directory build
|
||||
COMMAND ${Python_EXECUTABLE} install.py -v ${LAMMPS_SOURCE_DIR}/version.h
|
||||
-p ${LAMMPS_PYTHON_DIR}/lammps
|
||||
-l ${CMAKE_BINARY_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR}
|
||||
COMMAND ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps -l ${LIBLAMMPS_SHARED_BINARY}
|
||||
COMMENT "Installing LAMMPS Python module")
|
||||
else()
|
||||
add_custom_target(
|
||||
|
@ -708,13 +814,26 @@ endif()
|
|||
include(Testing)
|
||||
include(CodeCoverage)
|
||||
include(CodingStandard)
|
||||
find_package(ClangFormat 8.0)
|
||||
|
||||
if(ClangFormat_FOUND)
|
||||
add_custom_target(format-src
|
||||
COMMAND ${ClangFormat_EXECUTABLE} --verbose -i -style=file *.cpp *.h */*.cpp */*.h
|
||||
WORKING_DIRECTORY ${LAMMPS_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
|
||||
if(BUILD_IS_MULTI_CONFIG)
|
||||
set(LAMMPS_BUILD_TYPE "Multi-Config")
|
||||
else()
|
||||
set(LAMMPS_BUILD_TYPE ${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
include(FeatureSummary)
|
||||
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
||||
message(STATUS "<<< Build configuration >>>
|
||||
Operating System: ${CMAKE_SYSTEM_NAME}
|
||||
Build type: ${CMAKE_BUILD_TYPE}
|
||||
LAMMPS Version: ${PROJECT_VERSION}
|
||||
Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
|
||||
Build type: ${LAMMPS_BUILD_TYPE}
|
||||
Install path: ${CMAKE_INSTALL_PREFIX}
|
||||
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
||||
###############################################################################
|
||||
|
@ -745,14 +864,14 @@ if(OPTIONS)
|
|||
endif()
|
||||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
list(FIND LANGUAGES "Fortran" _index)
|
||||
if(${_index} GREATER -1)
|
||||
if(_index GREATER -1)
|
||||
message(STATUS "Fortran Compiler: ${CMAKE_Fortran_COMPILER}
|
||||
Type: ${CMAKE_Fortran_COMPILER_ID}
|
||||
Version: ${CMAKE_Fortran_COMPILER_VERSION}
|
||||
Fortran Flags:${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BTYPE}}")
|
||||
endif()
|
||||
list(FIND LANGUAGES "C" _index)
|
||||
if(${_index} GREATER -1)
|
||||
if(_index GREATER -1)
|
||||
message(STATUS "C compiler: ${CMAKE_C_COMPILER}
|
||||
Type: ${CMAKE_C_COMPILER_ID}
|
||||
Version: ${CMAKE_C_COMPILER_VERSION}
|
||||
|
@ -784,7 +903,10 @@ if(PKG_GPU)
|
|||
message(STATUS "<<< GPU package settings >>>
|
||||
-- GPU API: ${GPU_API}")
|
||||
if(GPU_API STREQUAL "CUDA")
|
||||
message(STATUS "CUDA Compiler: ${CUDA_NVCC_EXECUTABLE}")
|
||||
message(STATUS "GPU default architecture: ${GPU_ARCH}")
|
||||
message(STATUS "GPU binning with CUDPP: ${CUDPP_OPT}")
|
||||
message(STATUS "CUDA MPS support: ${CUDA_MPS_SUPPORT}")
|
||||
elseif(GPU_API STREQUAL "HIP")
|
||||
message(STATUS "HIP platform: ${HIP_PLATFORM}")
|
||||
message(STATUS "HIP architecture: ${HIP_ARCH}")
|
||||
|
@ -814,7 +936,7 @@ if(PKG_KSPACE)
|
|||
endif()
|
||||
if(PKG_KOKKOS)
|
||||
if(Kokkos_ENABLE_CUDA)
|
||||
if (${FFT} STREQUAL "KISS")
|
||||
if(FFT STREQUAL "KISS")
|
||||
message(STATUS "Kokkos FFT: KISS")
|
||||
else()
|
||||
message(STATUS "Kokkos FFT: cuFFT")
|
||||
|
|
|
@ -0,0 +1,156 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug-MSVC",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"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": "PKG_PYTHON",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Release-MSVC",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"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": "PKG_PYTHON",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Debug-Clang",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_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": "PKG_PYTHON",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Release-Clang",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_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": "PKG_PYTHON",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "ENABLE_TESTING",
|
||||
"value": "True",
|
||||
"type": "BOOL"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -54,6 +54,8 @@ if(ENABLE_COVERAGE)
|
|||
|
||||
if(COVERAGE_FOUND)
|
||||
set(PYTHON_COVERAGE_HTML_DIR ${CMAKE_BINARY_DIR}/python_coverage_html)
|
||||
configure_file(.coveragerc.in ${CMAKE_BINARY_DIR}/.coveragerc @ONLY)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/unittest/python/.coverage
|
||||
COMMAND ${COVERAGE_BINARY} combine
|
||||
|
@ -63,16 +65,16 @@ if(ENABLE_COVERAGE)
|
|||
|
||||
add_custom_target(
|
||||
gen_python_coverage_html
|
||||
COMMAND ${COVERAGE_BINARY} html -d ${PYTHON_COVERAGE_HTML_DIR}
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage
|
||||
COMMAND ${COVERAGE_BINARY} html --rcfile=${CMAKE_BINARY_DIR}/.coveragerc -d ${PYTHON_COVERAGE_HTML_DIR}
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage ${CMAKE_BINARY_DIR}/.coveragerc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Generating HTML Python coverage report..."
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
gen_python_coverage_xml
|
||||
COMMAND ${COVERAGE_BINARY} xml -o ${CMAKE_BINARY_DIR}/python_coverage.xml
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage
|
||||
COMMAND ${COVERAGE_BINARY} xml --rcfile=${CMAKE_BINARY_DIR}/.coveragerc -o ${CMAKE_BINARY_DIR}/python_coverage.xml
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage ${CMAKE_BINARY_DIR}/.coveragerc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Generating XML Python coverage report..."
|
||||
)
|
||||
|
|
|
@ -15,6 +15,11 @@ if(Python3_EXECUTABLE)
|
|||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Check for whitespace errors")
|
||||
add_custom_target(
|
||||
check-homepage
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Check for homepage URL errors")
|
||||
add_custom_target(
|
||||
check-permissions
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py .
|
||||
|
@ -25,6 +30,11 @@ if(Python3_EXECUTABLE)
|
|||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Fix whitespace errors")
|
||||
add_custom_target(
|
||||
fix-homepage
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py -f .
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
COMMENT "Fix homepage URL errors")
|
||||
add_custom_target(
|
||||
fix-permissions
|
||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py -f .
|
||||
|
|
|
@ -7,13 +7,13 @@ if(BUILD_DOC)
|
|||
# Sphinx 3.x requires at least Python 3.5
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
find_package(PythonInterp 3.5 REQUIRED)
|
||||
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m virtualenv -p ${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 virtualenv -p ${Python3_EXECUTABLE})
|
||||
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
||||
endif()
|
||||
find_package(Doxygen 1.8.10 REQUIRED)
|
||||
|
||||
|
@ -55,11 +55,15 @@ if(BUILD_DOC)
|
|||
COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install -r ${DOC_BUILD_DIR}/requirements.txt --upgrade
|
||||
)
|
||||
|
||||
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
|
||||
set(MATHJAX_MD5 "d1c98c746888bfd52ca8ebc10704f92f" CACHE STRING "MD5 checksum of MathJax tarball")
|
||||
mark_as_advanced(MATHJAX_URL)
|
||||
|
||||
# download mathjax distribution and unpack to folder "mathjax"
|
||||
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
|
||||
file(DOWNLOAD "https://github.com/mathjax/MathJax/archive/3.1.2.tar.gz"
|
||||
file(DOWNLOAD ${MATHJAX_URL}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz"
|
||||
EXPECTED_MD5 a4a6a093a89bc2ccab1452d766b98e53)
|
||||
EXPECTED_MD5 ${MATHJAX_MD5})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(GLOB MATHJAX_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# Build a CMake based external library as subdirectory.
|
||||
# The sources will be unpacked to ${CMAKE_BINARY_DIR}/_deps/${target}-src
|
||||
# The binaries will be built in ${CMAKE_BINARY_DIR}/_deps/${target}-build
|
||||
#
|
||||
function(ExternalCMakeProject target url hash basedir cmakedir cmakefile)
|
||||
# change settings locally
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
get_filename_component(archive ${url} NAME)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||
message(STATUS "Downloading ${url}")
|
||||
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
|
||||
message(STATUS "Unpacking and configuring ${archive}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||
file(GLOB TARGET_SOURCE "${CMAKE_BINARY_DIR}/_deps/src/${basedir}*")
|
||||
list(LENGTH TARGET_SOURCE _num)
|
||||
if(_num GREATER 1)
|
||||
message(FATAL_ERROR "Inconsistent ${target} library sources. "
|
||||
"Please delete ${CMAKE_BINARY_DIR}/_deps/src and re-run cmake")
|
||||
endif()
|
||||
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/_deps/${target}-src)
|
||||
file(RENAME ${TARGET_SOURCE} ${CMAKE_BINARY_DIR}/_deps/${target}-src)
|
||||
if(NOT (cmakefile STREQUAL ""))
|
||||
file(COPY ${cmakefile} DESTINATION ${CMAKE_BINARY_DIR}/_deps/${target}-src/${cmakedir}/)
|
||||
get_filename_component(_cmakefile ${cmakefile} NAME)
|
||||
file(RENAME "${CMAKE_BINARY_DIR}/_deps/${target}-src/${cmakedir}/${_cmakefile}"
|
||||
"${CMAKE_BINARY_DIR}/_deps/${target}-src/${cmakedir}/CMakeLists.txt")
|
||||
endif()
|
||||
add_subdirectory("${CMAKE_BINARY_DIR}/_deps/${target}-src/${cmakedir}"
|
||||
"${CMAKE_BINARY_DIR}/_deps/${target}-build")
|
||||
endfunction(ExternalCMakeProject)
|
|
@ -8,18 +8,19 @@
|
|||
#=============================================================================
|
||||
|
||||
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(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
else()
|
||||
find_package(Python3 3.6 COMPONENTS Interpreter QUIET)
|
||||
find_package(Python 3.6 COMPONENTS Interpreter QUIET)
|
||||
endif()
|
||||
|
||||
# Use the Cython executable that lives next to the Python executable
|
||||
# if it is a local installation.
|
||||
if(Python3_EXECUTABLE)
|
||||
get_filename_component(_python_path ${Python3_EXECUTABLE} PATH)
|
||||
if(Python_EXECUTABLE)
|
||||
get_filename_component(_python_path ${Python_EXECUTABLE} PATH)
|
||||
find_program(Cythonize_EXECUTABLE
|
||||
NAMES cythonize3 cythonize cythonize.bat
|
||||
HINTS ${_python_path})
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# Check if N2P2_DIR is set manually.
|
||||
if (DEFINED ENV{N2P2_DIR})
|
||||
set(N2P2_DIR "${N2P2_DIR}")
|
||||
# If not, try if directory "lib/hdnnp/n2p2" exists.
|
||||
else()
|
||||
get_filename_component(_fullpath "${LAMMPS_LIB_SOURCE_DIR}/hdnnp/n2p2" REALPATH)
|
||||
if (EXISTS ${_fullpath})
|
||||
set(N2P2_DIR "${_fullpath}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set path to include directory.
|
||||
find_path(N2P2_INCLUDE_DIR InterfaceLammps.h HINTS "${N2P2_DIR}/include")
|
||||
# Two libraries need to be linked: libnnp and libnnpif.
|
||||
find_library(N2P2_LIBNNP NAMES nnp HINTS "${N2P2_DIR}/lib")
|
||||
find_library(N2P2_LIBNNPIF NAMES nnpif HINTS "${N2P2_DIR}/lib")
|
||||
# Users could compile n2p2 with extra flags which are then also required for
|
||||
# pair_hdnnp.cpp compilation. To forward them to the LAMMPS build process n2p2
|
||||
# writes a file with cmake commands, e.g.
|
||||
#
|
||||
# target_compile_definitions(lammps PRIVATE -DN2P2_NO_SF_GROUPS)
|
||||
#
|
||||
# to "lib/lammps-extra.cmake" which is then included by ML-HDNNP.cmake.
|
||||
find_file(N2P2_CMAKE_EXTRA NAMES lammps-extra.cmake HINTS "${N2P2_DIR}/lib")
|
||||
|
||||
find_package_handle_standard_args(N2P2 DEFAULT_MSG
|
||||
N2P2_DIR
|
||||
N2P2_INCLUDE_DIR
|
||||
N2P2_LIBNNP
|
||||
N2P2_LIBNNPIF
|
||||
N2P2_CMAKE_EXTRA)
|
||||
|
||||
if(N2P2_FOUND)
|
||||
if (NOT TARGET N2P2::N2P2)
|
||||
# n2p2 core library "libnnp"
|
||||
add_library(N2P2::LIBNNP UNKNOWN IMPORTED)
|
||||
set_target_properties(N2P2::LIBNNP PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${N2P2_INCLUDE_DIR}
|
||||
IMPORTED_LOCATION ${N2P2_LIBNNP})
|
||||
# n2p2 interface library "libnnpif"
|
||||
add_library(N2P2::LIBNNPIF UNKNOWN IMPORTED)
|
||||
set_target_properties(N2P2::LIBNNPIF PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${N2P2_INCLUDE_DIR}
|
||||
IMPORTED_LOCATION ${N2P2_LIBNNPIF})
|
||||
# Put libnnp, libnnpif and include directory together.
|
||||
add_library(N2P2::N2P2 INTERFACE IMPORTED)
|
||||
set_property(TARGET N2P2::N2P2 PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES N2P2::LIBNNPIF N2P2::LIBNNP)
|
||||
set(N2P2_CMAKE_EXTRAS ${N2P2_CMAKE_EXTRA})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
N2P2_DIR
|
||||
N2P2_INCLUDE_DIR
|
||||
N2P2_LIBNNP
|
||||
N2P2_LIBNNPIF
|
||||
N2P2_CMAKE_EXTRA
|
||||
)
|
|
@ -1,79 +0,0 @@
|
|||
message(STATUS "Downloading and building Google Test library")
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set(GTEST_LIB_POSTFIX d)
|
||||
else()
|
||||
set(GTEST_LIB_POSTFIX)
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
set(GTEST_URL "https://github.com/google/googletest/archive/release-1.10.0.tar.gz" CACHE STRING "URL for GTest tarball")
|
||||
mark_as_advanced(GTEST_URL)
|
||||
ExternalProject_Add(googletest
|
||||
URL ${GTEST_URL}
|
||||
URL_MD5 ecd1fa65e7de707cd5c00bdac56022cd
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build"
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_GTEST_OPTS}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
BUILD_BYPRODUCTS <BINARY_DIR>/lib/libgtest${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
<BINARY_DIR>/lib/libgmock${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
<BINARY_DIR>/lib/libgtest_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
<BINARY_DIR>/lib/libgmock_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
LOG_DOWNLOAD ON
|
||||
LOG_CONFIGURE ON
|
||||
LOG_BUILD ON
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND "")
|
||||
|
||||
ExternalProject_Get_Property(googletest SOURCE_DIR)
|
||||
set(GTEST_INCLUDE_DIR ${SOURCE_DIR}/googletest/include)
|
||||
set(GMOCK_INCLUDE_DIR ${SOURCE_DIR}/googlemock/include)
|
||||
|
||||
# workaround for CMake 3.10 on ubuntu 18.04
|
||||
file(MAKE_DIRECTORY ${GTEST_INCLUDE_DIR})
|
||||
file(MAKE_DIRECTORY ${GMOCK_INCLUDE_DIR})
|
||||
|
||||
ExternalProject_Get_Property(googletest BINARY_DIR)
|
||||
set(GTEST_LIBRARY_PATH ${BINARY_DIR}/lib/libgtest${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set(GMOCK_LIBRARY_PATH ${BINARY_DIR}/lib/libgmock${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set(GTEST_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/libgtest_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set(GMOCK_MAIN_LIBRARY_PATH ${BINARY_DIR}/lib/libgmock_main${GTEST_LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
|
||||
# Prevent GoogleTest from overriding our compiler/linker options
|
||||
# when building with Visual Studio
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
||||
find_package(Threads QUIET)
|
||||
|
||||
add_library(GTest::GTest UNKNOWN IMPORTED)
|
||||
set_target_properties(GTest::GTest PROPERTIES
|
||||
IMPORTED_LOCATION ${GTEST_LIBRARY_PATH}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR}
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
|
||||
add_dependencies(GTest::GTest googletest)
|
||||
|
||||
add_library(GTest::GMock UNKNOWN IMPORTED)
|
||||
set_target_properties(GTest::GMock PROPERTIES
|
||||
IMPORTED_LOCATION ${GMOCK_LIBRARY_PATH}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${GMOCK_INCLUDE_DIR}
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
|
||||
add_dependencies(GTest::GMock googletest)
|
||||
|
||||
add_library(GTest::GTestMain UNKNOWN IMPORTED)
|
||||
set_target_properties(GTest::GTestMain PROPERTIES
|
||||
IMPORTED_LOCATION ${GTEST_MAIN_LIBRARY_PATH}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR}
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
|
||||
add_dependencies(GTest::GTestMain googletest)
|
||||
|
||||
add_library(GTest::GMockMain UNKNOWN IMPORTED)
|
||||
set_target_properties(GTest::GMockMain PROPERTIES
|
||||
IMPORTED_LOCATION ${GMOCK_MAIN_LIBRARY_PATH}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${GMOCK_INCLUDE_DIR}
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
|
||||
add_dependencies(GTest::GMockMain googletest)
|
|
@ -0,0 +1,3 @@
|
|||
# utility script to call WriteOpenCLHeader function
|
||||
include(${SOURCE_DIR}/Modules/OpenCLUtils.cmake)
|
||||
WriteOpenCLHeader(${VARNAME} ${HEADER_FILE} ${SOURCE_FILES})
|
|
@ -25,7 +25,7 @@ function(validate_option name values)
|
|||
endfunction(validate_option)
|
||||
|
||||
function(get_lammps_version version_header variable)
|
||||
file(READ ${version_header} line)
|
||||
file(STRINGS ${version_header} line REGEX LAMMPS_VERSION)
|
||||
set(MONTHS x Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
|
||||
string(REGEX REPLACE "#define LAMMPS_VERSION \"([0-9]+) ([A-Za-z]+) ([0-9]+)\"" "\\1" day "${line}")
|
||||
string(REGEX REPLACE "#define LAMMPS_VERSION \"([0-9]+) ([A-Za-z]+) ([0-9]+)\"" "\\2" month "${line}")
|
||||
|
@ -67,7 +67,7 @@ endfunction()
|
|||
|
||||
macro(pkg_depends PKG1 PKG2)
|
||||
if(PKG_${PKG1} AND NOT (PKG_${PKG2} OR BUILD_${PKG2}))
|
||||
message(FATAL_ERROR "${PKG1} package needs LAMMPS to be build with ${PKG2}")
|
||||
message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be build with the ${PKG2} package")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -86,7 +86,6 @@ endfunction(GenerateBinaryHeader)
|
|||
# fetch missing potential files
|
||||
function(FetchPotentials pkgfolder potfolder)
|
||||
if(EXISTS "${pkgfolder}/potentials.txt")
|
||||
set(LAMMPS_POTENTIALS_URL "https://download.lammps.org/potentials")
|
||||
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
|
||||
foreach(line ${linelist})
|
||||
string(FIND ${line} " " blank)
|
||||
|
@ -105,3 +104,13 @@ function(FetchPotentials pkgfolder potfolder)
|
|||
endforeach()
|
||||
endif()
|
||||
endfunction(FetchPotentials)
|
||||
|
||||
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
|
||||
file(STRINGS /etc/os-release distro REGEX "^NAME=")
|
||||
string(REGEX REPLACE "NAME=\"?([^\"]*)\"?" "\\1" distro "${distro}")
|
||||
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
|
||||
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
|
||||
set(CMAKE_LINUX_DISTRO ${distro})
|
||||
set(CMAKE_DISTRO_VERSION ${disversion})
|
||||
endif()
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
# Download and configure custom MPICH files for Windows
|
||||
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
|
||||
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||
set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball")
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN32_DEVEL_URL)
|
||||
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||
mark_as_advanced(MPICH2_WIN32_DEVEL_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
ExternalProject_Add(mpi4win_build
|
||||
URL https://download.lammps.org/thirdparty/mpich2-win64-devel.tar.gz
|
||||
URL_MD5 4939fdb59d13182fd5dd65211e469f14
|
||||
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 https://download.lammps.org/thirdparty/mpich2-win32-devel.tar.gz
|
||||
URL_MD5 a61d153500dce44e21b755ee7257e031
|
||||
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()
|
||||
|
|
|
@ -1,48 +1,11 @@
|
|||
message(STATUS "Downloading and building OpenCL loader library")
|
||||
|
||||
include(ExternalProject)
|
||||
set(OPENCL_LOADER_URL "https://download.lammps.org/thirdparty/opencl-loader-2020.12.18.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 "8d3a801e87a2c6653bf0e27707063914" CACHE STRING "MD5 checksum of OpenCL loader tarball")
|
||||
mark_as_advanced(OPENCL_LOADER_URL)
|
||||
ExternalProject_Add(opencl_loader
|
||||
URL ${OPENCL_LOADER_URL}
|
||||
URL_MD5 011cdcbd41030be94f3fced6d763a52a
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build"
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
BUILD_BYPRODUCTS <BINARY_DIR>/libOpenCL${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
LOG_DOWNLOAD ON
|
||||
LOG_CONFIGURE ON
|
||||
LOG_BUILD ON
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND "")
|
||||
|
||||
ExternalProject_Get_Property(opencl_loader SOURCE_DIR)
|
||||
set(OPENCL_LOADER_INCLUDE_DIR ${SOURCE_DIR}/inc)
|
||||
|
||||
# workaround for CMake 3.10 on ubuntu 18.04
|
||||
file(MAKE_DIRECTORY ${OPENCL_LOADER_INCLUDE_DIR})
|
||||
|
||||
ExternalProject_Get_Property(opencl_loader BINARY_DIR)
|
||||
set(OPENCL_LOADER_LIBRARY_PATH "${BINARY_DIR}/libOpenCL${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
|
||||
find_package(Threads QUIET)
|
||||
if(NOT WIN32)
|
||||
set(OPENCL_LOADER_DEP_LIBS "Threads::Threads;${CMAKE_DL_LIBS}")
|
||||
else()
|
||||
set(OPENCL_LOADER_DEP_LIBS "cfgmgr32;runtimeobject")
|
||||
endif()
|
||||
|
||||
add_library(OpenCL::OpenCL UNKNOWN IMPORTED)
|
||||
add_dependencies(OpenCL::OpenCL opencl_loader)
|
||||
|
||||
set_target_properties(OpenCL::OpenCL PROPERTIES
|
||||
IMPORTED_LOCATION ${OPENCL_LOADER_LIBRARY_PATH}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${OPENCL_LOADER_INCLUDE_DIR}
|
||||
INTERFACE_LINK_LIBRARIES "${OPENCL_LOADER_DEP_LIBS}")
|
||||
mark_as_advanced(OPENCL_LOADER_MD5)
|
||||
|
||||
set(INSTALL_LIBOPENCL OFF CACHE BOOL "" FORCE)
|
||||
include(ExternalCMakeProject)
|
||||
ExternalCMakeProject(opencl_loader ${OPENCL_LOADER_URL} ${OPENCL_LOADER_MD5} opencl-loader . "")
|
||||
|
||||
add_library(OpenCL::OpenCL ALIAS OpenCL)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
function(GenerateOpenCLHeader varname outfile files)
|
||||
message("Creating ${outfile}...")
|
||||
function(WriteOpenCLHeader varname outfile files)
|
||||
file(WRITE ${outfile} "const char * ${varname} = \n")
|
||||
math(EXPR ARG_END "${ARGC}-1")
|
||||
separate_arguments(files)
|
||||
|
||||
foreach(IDX RANGE 2 ${ARG_END})
|
||||
list(GET ARGV ${IDX} filename)
|
||||
foreach(filename ${files})
|
||||
file(READ ${filename} content)
|
||||
string(REGEX REPLACE "\\s*//[^\n]*\n" "\n" content "${content}")
|
||||
string(REGEX REPLACE "\\\\" "\\\\\\\\" content "${content}")
|
||||
|
@ -15,4 +13,16 @@ function(GenerateOpenCLHeader varname outfile files)
|
|||
endforeach()
|
||||
|
||||
file(APPEND ${outfile} ";\n")
|
||||
endfunction(WriteOpenCLHeader)
|
||||
|
||||
function(GenerateOpenCLHeader varname outfile files)
|
||||
list(REMOVE_AT ARGV 0 1)
|
||||
add_custom_command(OUTPUT ${outfile}
|
||||
COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-D VARNAME=${varname}
|
||||
-D HEADER_FILE=${outfile}
|
||||
-D SOURCE_FILES="${ARGV}"
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/GenerateOpenCLHeader.cmake
|
||||
DEPENDS ${ARGV}
|
||||
COMMENT "Generating ${outfile}...")
|
||||
endfunction(GenerateOpenCLHeader)
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||
|
||||
file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
||||
|
||||
option(COLVARS_DEBUG "Debugging messages for Colvars (quite verbose)" OFF)
|
||||
|
||||
# Build Lepton by default
|
||||
option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
||||
|
||||
if(COLVARS_LEPTON)
|
||||
set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton)
|
||||
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp)
|
||||
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()
|
||||
|
||||
add_library(colvars STATIC ${COLVARS_SOURCES})
|
||||
target_compile_definitions(colvars PRIVATE -DCOLVARS_LAMMPS)
|
||||
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||
target_compile_options(colvars PRIVATE ${_FLAG})
|
||||
endforeach()
|
||||
set_target_properties(colvars PROPERTIES OUTPUT_NAME lammps_colvars${LAMMPS_MACHINE})
|
||||
target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||
# The line below is needed to locate math_eigen_impl.h
|
||||
target_include_directories(colvars PRIVATE ${LAMMPS_SOURCE_DIR})
|
||||
target_link_libraries(lammps PRIVATE colvars)
|
||||
|
||||
if(COLVARS_DEBUG)
|
||||
# Need to export the macro publicly to also affect the proxy
|
||||
target_compile_definitions(colvars PUBLIC -DCOLVARS_DEBUG)
|
||||
endif()
|
||||
|
||||
if(COLVARS_LEPTON)
|
||||
target_link_libraries(lammps PRIVATE lepton)
|
||||
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
||||
# 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()
|
|
@ -1,10 +1,11 @@
|
|||
find_package(ZLIB REQUIRED)
|
||||
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(Zstd IMPORTED_TARGET libzstd>=1.4)
|
||||
|
||||
if(Zstd_FOUND)
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_ZSTD)
|
||||
target_link_libraries(lammps PRIVATE PkgConfig::Zstd)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# Fix rigid/meso requires RIGID to be installed
|
||||
set(DPD-SMOOTH_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/DPD-SMOOTH)
|
||||
|
||||
get_property(hlist GLOBAL PROPERTY FIX)
|
||||
if(NOT PKG_RIGID)
|
||||
list(REMOVE_ITEM hlist ${DPD-SMOOTH_SOURCES_DIR}/fix_rigid_meso.h)
|
||||
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||
list(REMOVE_ITEM LAMMPS_SOURCES ${DPD-SMOOTH_SOURCES_DIR}/fix_rigid_meso.cpp)
|
||||
set_property(TARGET lammps PROPERTY SOURCES ${LAMMPS_SOURCES})
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY FIX "${hlist}")
|
||||
|
||||
target_include_directories(lammps PRIVATE ${DPD-SMOOTH_SOURCES_DIR})
|
|
@ -30,12 +30,20 @@ file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
|||
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||
|
||||
if(GPU_API STREQUAL "CUDA")
|
||||
find_package(CUDA QUIET)
|
||||
# augment search path for CUDA toolkit libraries to include the stub versions. Needed to find libcuda.so on machines without a CUDA driver installation
|
||||
if(CUDA_FOUND)
|
||||
set(CMAKE_LIBRARY_PATH "${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs;${CUDA_TOOLKIT_ROOT_DIR}/lib/stubs;${CUDA_TOOLKIT_ROOT_DIR}/lib64;${CUDA_TOOLKIT_ROOT_DIR}/lib;${CMAKE_LIBRARY_PATH}")
|
||||
find_package(CUDA REQUIRED)
|
||||
else()
|
||||
message(FATAL_ERROR "CUDA Toolkit not found")
|
||||
endif()
|
||||
|
||||
find_program(BIN2C bin2c)
|
||||
if(NOT BIN2C)
|
||||
message(FATAL_ERROR "Could not find bin2c, use -DBIN2C=/path/to/bin2c to help cmake finding it.")
|
||||
endif()
|
||||
option(CUDPP_OPT "Enable CUDPP_OPT" ON)
|
||||
option(CUDPP_OPT "Enable GPU binning via CUDAPP (should be off for modern GPUs)" OFF)
|
||||
option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF)
|
||||
if(CUDA_MPS_SUPPORT)
|
||||
if(CUDPP_OPT)
|
||||
|
@ -71,10 +79,15 @@ if(GPU_API STREQUAL "CUDA")
|
|||
# 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
|
||||
set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}")
|
||||
# Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0
|
||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "3.2") AND (CUDA_VERSION VERSION_LESS "9.0"))
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_20,code=[sm_20,compute_20] ")
|
||||
endif()
|
||||
|
||||
# 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
|
||||
if(CUDA_VERSION VERSION_LESS 8.0)
|
||||
message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required")
|
||||
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk")
|
||||
set(GPU_CUDA_GENCODE "-arch=all")
|
||||
else()
|
||||
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30] ")
|
||||
|
@ -107,15 +120,21 @@ if(GPU_API STREQUAL "CUDA")
|
|||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
|
||||
endif()
|
||||
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
message(WARNING "Unsupported CUDA version. Use at your own risk.")
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||
endif()
|
||||
# # Lovelace (GPU Arch 9.x) is supported by CUDA 12.0? and later
|
||||
#if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
# string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_9x,code=[sm_9x,compute_9x]")
|
||||
#endif()
|
||||
endif()
|
||||
|
||||
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING})
|
||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
||||
|
||||
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING})
|
||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
||||
|
||||
foreach(CU_OBJ ${GPU_GEN_OBJS})
|
||||
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
|
||||
|
@ -131,7 +150,7 @@ if(GPU_API STREQUAL "CUDA")
|
|||
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
||||
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
||||
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
||||
if(CUDPP_OPT)
|
||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
||||
|
@ -145,7 +164,14 @@ if(GPU_API STREQUAL "CUDA")
|
|||
target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||
|
||||
elseif(GPU_API STREQUAL "OPENCL")
|
||||
option(USE_STATIC_OPENCL_LOADER "Download and include a static OpenCL ICD loader" ON)
|
||||
# the static OpenCL loader doesn't seem to work on macOS. use the system provided
|
||||
# version by default instead (for as long as it will be available)
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
set(_opencl_static_default OFF)
|
||||
else()
|
||||
set(_opencl_static_default ON)
|
||||
endif()
|
||||
option(USE_STATIC_OPENCL_LOADER "Download and include a static OpenCL ICD loader" ${_opencl_static_default})
|
||||
mark_as_advanced(USE_STATIC_OPENCL_LOADER)
|
||||
if(USE_STATIC_OPENCL_LOADER)
|
||||
include(OpenCLLoader)
|
||||
|
@ -207,18 +233,25 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||
elseif(GPU_API STREQUAL "HIP")
|
||||
if(NOT DEFINED HIP_PATH)
|
||||
if(NOT DEFINED ENV{HIP_PATH})
|
||||
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to which HIP has been installed")
|
||||
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to HIP installation")
|
||||
else()
|
||||
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed")
|
||||
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to HIP installation")
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH})
|
||||
find_package(HIP REQUIRED)
|
||||
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)
|
||||
option(HIP_USE_DEVICE_SORT "Use GPU sorting" ON)
|
||||
|
||||
if(NOT DEFINED HIP_PLATFORM)
|
||||
if(NOT DEFINED ENV{HIP_PLATFORM})
|
||||
set(HIP_PLATFORM "hcc" CACHE PATH "HIP Platform to be used during compilation")
|
||||
set(HIP_PLATFORM "amd" CACHE PATH "HIP Platform to be used during compilation")
|
||||
else()
|
||||
set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE PATH "HIP Platform used during compilation")
|
||||
endif()
|
||||
|
@ -226,19 +259,21 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
|
||||
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
|
||||
|
||||
if(HIP_PLATFORM STREQUAL "hcc")
|
||||
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
||||
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
||||
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||
find_package(CUDA REQUIRED)
|
||||
set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)")
|
||||
|
||||
if(CUDA_VERSION VERSION_LESS 8.0)
|
||||
message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required")
|
||||
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk")
|
||||
set(HIP_CUDA_GENCODE "-arch=all")
|
||||
else()
|
||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
||||
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
||||
set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}")
|
||||
# Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0
|
||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "3.2") AND (CUDA_VERSION VERSION_LESS "9.0"))
|
||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_20,code=[sm_20,compute_20]")
|
||||
endif()
|
||||
# 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 HIP_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30]")
|
||||
|
@ -267,8 +302,10 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
|
||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
|
||||
endif()
|
||||
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||
message(WARNING "Unsupported CUDA version. Use at your own risk.")
|
||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -284,23 +321,23 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
|
||||
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
|
||||
|
||||
if(HIP_PLATFORM STREQUAL "hcc")
|
||||
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
||||
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
||||
|
||||
if(HIP_COMPILER STREQUAL "clang")
|
||||
add_custom_command(OUTPUT ${CUBIN_FILE}
|
||||
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco --offload-arch=${HIP_ARCH} -O3 -ffast-math -DUSE_HIP -D_${GPU_PREC_SETTING} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_CPP_FILE}
|
||||
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco --offload-arch=${HIP_ARCH} -O3 -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 "Generating ${CU_NAME}.cubin")
|
||||
else()
|
||||
add_custom_command(OUTPUT ${CUBIN_FILE}
|
||||
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco -t="${HIP_ARCH}" -f=\"-O3 -ffast-math -DUSE_HIP -D_${GPU_PREC_SETTING} -I${LAMMPS_LIB_SOURCE_DIR}/gpu\" -o ${CUBIN_FILE} ${CU_CPP_FILE}
|
||||
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco -t="${HIP_ARCH}" -f=\"-O3 -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 "Generating ${CU_NAME}.cubin")
|
||||
endif()
|
||||
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||
add_custom_command(OUTPUT ${CUBIN_FILE}
|
||||
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE}
|
||||
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE}
|
||||
DEPENDS ${CU_FILE}
|
||||
COMMENT "Generating ${CU_NAME}.cubin")
|
||||
endif()
|
||||
|
@ -315,12 +352,17 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LAMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h ${LAMMPS_LIB_BINARY_DIR}/gpu/*.cu.cpp")
|
||||
|
||||
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_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_HIP)
|
||||
target_link_libraries(gpu PRIVATE hip::host)
|
||||
|
||||
if(HIP_USE_DEVICE_SORT)
|
||||
if(HIP_PLATFORM STREQUAL "amd")
|
||||
# newer version of ROCm (5.1+) require c++14 for rocprim
|
||||
set_property(TARGET gpu PROPERTY CXX_STANDARD 14)
|
||||
endif()
|
||||
# add hipCUB
|
||||
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||
target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT)
|
||||
|
@ -338,11 +380,16 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
|
||||
if(DOWNLOAD_CUB)
|
||||
message(STATUS "CUB download requested")
|
||||
set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
||||
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
|
||||
mark_as_advanced(CUB_URL)
|
||||
mark_as_advanced(CUB_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(CUB
|
||||
GIT_REPOSITORY https://github.com/NVlabs/cub
|
||||
TIMEOUT 5
|
||||
URL ${CUB_URL}
|
||||
URL_MD5 ${CUB_MD5}
|
||||
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
@ -354,7 +401,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
else()
|
||||
find_package(CUB)
|
||||
if(NOT CUB_FOUND)
|
||||
message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it")
|
||||
message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_CUB=ON to download it")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -362,8 +409,9 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
endif()
|
||||
endif()
|
||||
|
||||
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_link_libraries(hip_get_devices hip::host)
|
||||
|
||||
if(HIP_PLATFORM STREQUAL "nvcc")
|
||||
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
|
||||
|
@ -381,6 +429,12 @@ elseif(GPU_API STREQUAL "HIP")
|
|||
|
||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
|
||||
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||
elseif(HIP_PLATFORM STREQUAL "amd")
|
||||
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_AMD__)
|
||||
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||
|
||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_AMD__)
|
||||
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||
endif()
|
||||
|
||||
target_link_libraries(lammps PRIVATE gpu)
|
||||
|
@ -392,13 +446,12 @@ RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES)
|
|||
RegisterFixStyle(${GPU_SOURCES_DIR}/fix_gpu.h)
|
||||
|
||||
get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES)
|
||||
|
||||
if(NOT BUILD_MPI)
|
||||
# mpistubs is aliased to MPI::MPI_CXX, but older versions of cmake won't work forward the include path
|
||||
target_link_libraries(gpu PRIVATE mpi_stubs)
|
||||
else()
|
||||
if(BUILD_MPI)
|
||||
target_link_libraries(gpu PRIVATE MPI::MPI_CXX)
|
||||
else()
|
||||
target_link_libraries(gpu PRIVATE mpi_stubs)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(gpu PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||
set_target_properties(gpu PROPERTIES OUTPUT_NAME lammps_gpu${LAMMPS_MACHINE})
|
||||
target_sources(lammps PRIVATE ${GPU_SOURCES})
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
enable_language(C)
|
||||
|
||||
# we don't use the parallel i/o interface.
|
||||
set(HDF5_PREFER_PARALLEL FALSE)
|
||||
|
||||
find_package(HDF5 REQUIRED)
|
||||
|
||||
# parallel HDF5 will import incompatible MPI headers with a serial build
|
||||
if((NOT BUILD_MPI) AND HDF5_IS_PARALLEL)
|
||||
message(FATAL_ERROR "Serial LAMMPS build and parallel HDF5 library are not compatible")
|
||||
endif()
|
||||
|
||||
target_link_libraries(h5md PRIVATE ${HDF5_LIBRARIES})
|
||||
target_include_directories(h5md PUBLIC ${HDF5_INCLUDE_DIRS})
|
|
@ -0,0 +1,116 @@
|
|||
check_include_file_cxx(immintrin.h FOUND_IMMINTRIN)
|
||||
if(NOT FOUND_IMMINTRIN)
|
||||
message(FATAL_ERROR "immintrin.h header not found, Intel package won't work without it")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL)
|
||||
|
||||
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by INTEL (cpu or knl)")
|
||||
set(INTEL_ARCH_VALUES cpu knl)
|
||||
set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES})
|
||||
validate_option(INTEL_ARCH INTEL_ARCH_VALUES)
|
||||
string(TOUPPER ${INTEL_ARCH} INTEL_ARCH)
|
||||
|
||||
find_package(Threads QUIET)
|
||||
if(Threads_FOUND)
|
||||
set(INTEL_LRT_MODE "threads" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
|
||||
else()
|
||||
set(INTEL_LRT_MODE "none" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
|
||||
endif()
|
||||
set(INTEL_LRT_VALUES none threads c++11)
|
||||
set_property(CACHE INTEL_LRT_MODE PROPERTY STRINGS ${INTEL_LRT_VALUES})
|
||||
validate_option(INTEL_LRT_MODE INTEL_LRT_VALUES)
|
||||
string(TOUPPER ${INTEL_LRT_MODE} INTEL_LRT_MODE)
|
||||
if(INTEL_LRT_MODE STREQUAL "THREADS")
|
||||
if(Threads_FOUND)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT)
|
||||
target_link_libraries(lammps PRIVATE Threads::Threads)
|
||||
else()
|
||||
message(FATAL_ERROR "Must have working threads library for Long-range thread support")
|
||||
endif()
|
||||
endif()
|
||||
if(INTEL_LRT_MODE STREQUAL "C++11")
|
||||
if(Threads_FOUND)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT -DLMP_INTEL_LRT11)
|
||||
target_link_libraries(lammps PRIVATE Threads::Threads)
|
||||
else()
|
||||
message(FATAL_ERROR "Must have working threads library for Long-range thread support")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
|
||||
message(FATAL_ERROR "INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "INTEL gives best performance with Intel compilers")
|
||||
endif()
|
||||
|
||||
find_package(TBB_MALLOC QUIET)
|
||||
if(TBB_MALLOC_FOUND)
|
||||
target_link_libraries(lammps PRIVATE TBB::TBB_MALLOC)
|
||||
else()
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_NO_TBB)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
message(WARNING "INTEL with Intel compilers should use TBB malloc libraries")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(MKL QUIET)
|
||||
if(MKL_FOUND)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_USE_MKL_RNG)
|
||||
target_link_libraries(lammps PRIVATE MKL::MKL)
|
||||
else()
|
||||
message(STATUS "Pair style dpd/intel will be faster with MKL libraries")
|
||||
endif()
|
||||
|
||||
if((NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "64") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "128") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "256"))
|
||||
message(FATAL_ERROR "INTEL only supports memory alignment of 64, 128 or 256 on this platform")
|
||||
endif()
|
||||
|
||||
if(INTEL_ARCH STREQUAL "KNL")
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
message(FATAL_ERROR "Must use Intel compiler with INTEL for KNL architecture")
|
||||
endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload")
|
||||
set(MIC_OPTIONS "-qoffload-option,mic,compiler,\"-fp-model fast=2 -mGLOB_default_function_attrs=\\\"gather_scatter_loop_unroll=4\\\"\"")
|
||||
target_compile_options(lammps PRIVATE -xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_OFFLOAD)
|
||||
else()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
include(CheckCXXCompilerFlag)
|
||||
foreach(_FLAG -O2 "-fp-model fast=2" -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
|
||||
string(REGEX REPLACE "[ =\"]" "" _FLAGX ${_FLAG})
|
||||
check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAGX})
|
||||
if(COMPILER_SUPPORTS${_FLAGX})
|
||||
separate_arguments(_FLAG UNIX_COMMAND "${_FLAG}")
|
||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# collect sources
|
||||
set(INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/INTEL)
|
||||
set(INTEL_SOURCES ${INTEL_SOURCES_DIR}/fix_intel.cpp
|
||||
${INTEL_SOURCES_DIR}/fix_nh_intel.cpp
|
||||
${INTEL_SOURCES_DIR}/intel_buffers.cpp
|
||||
${INTEL_SOURCES_DIR}/nbin_intel.cpp
|
||||
${INTEL_SOURCES_DIR}/npair_intel.cpp)
|
||||
|
||||
set_property(GLOBAL PROPERTY "INTEL_SOURCES" "${INTEL_SOURCES}")
|
||||
|
||||
# detect styles which have a INTEL version
|
||||
RegisterStylesExt(${INTEL_SOURCES_DIR} intel INTEL_SOURCES)
|
||||
RegisterNBinStyle(${INTEL_SOURCES_DIR}/nbin_intel.h)
|
||||
RegisterNPairStyle(${INTEL_SOURCES_DIR}/npair_intel.h)
|
||||
RegisterFixStyle(${INTEL_SOURCES_DIR}/fix_intel.h)
|
||||
|
||||
get_property(INTEL_SOURCES GLOBAL PROPERTY INTEL_SOURCES)
|
||||
if(PKG_KSPACE)
|
||||
list(APPEND INTEL_SOURCES ${INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp)
|
||||
RegisterIntegrateStyle(${INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
||||
endif()
|
||||
|
||||
target_sources(lammps PRIVATE ${INTEL_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${INTEL_SOURCES_DIR})
|
|
@ -35,9 +35,13 @@ if(DOWNLOAD_KIM)
|
|||
include(ExternalProject)
|
||||
enable_language(C)
|
||||
enable_language(Fortran)
|
||||
set(KIM_URL "https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" CACHE STRING "URL for KIM tarball")
|
||||
set(KIM_MD5 "ae1ddda2ef7017ea07934e519d023dca" CACHE STRING "MD5 checksum of KIM tarball")
|
||||
mark_as_advanced(KIM_URL)
|
||||
mark_as_advanced(KIM_MD5)
|
||||
ExternalProject_Add(kim_build
|
||||
URL https://s3.openkim.org/kim-api/kim-api-2.2.1.txz
|
||||
URL_MD5 ae1ddda2ef7017ea07934e519d023dca
|
||||
URL ${KIM_URL}
|
||||
URL_MD5 ${KIM_MD5}
|
||||
BINARY_DIR build
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
########################################################################
|
||||
# As of version 3.3.0 Kokkos requires C++14
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
if(CMAKE_CXX_STANDARD LESS 14)
|
||||
message(FATAL_ERROR "The KOKKOS package requires the C++ standard to be set to at least C++14")
|
||||
endif()
|
||||
########################################################################
|
||||
# consistency checks and Kokkos options/settings required by LAMMPS
|
||||
if(Kokkos_ENABLE_CUDA)
|
||||
|
@ -9,8 +11,14 @@ if(Kokkos_ENABLE_CUDA)
|
|||
endif()
|
||||
# Adding OpenMP compiler flags without the checks done for
|
||||
# BUILD_OMP can result in compile failures. Enforce consistency.
|
||||
if(Kokkos_ENABLE_OPENMP AND NOT BUILD_OMP)
|
||||
if(Kokkos_ENABLE_OPENMP)
|
||||
if(NOT BUILD_OMP)
|
||||
message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
|
||||
else()
|
||||
if(LAMMPS_OMP_COMPAT_LEVEL LESS 4)
|
||||
message(FATAL_ERROR "Compiler must support OpenMP 4.0 or later with Kokkos_ENABLE_OPENMP")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
########################################################################
|
||||
|
||||
|
@ -25,6 +33,8 @@ if(DOWNLOAD_KOKKOS)
|
|||
endforeach()
|
||||
message(STATUS "KOKKOS download requested - we will build our own")
|
||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>")
|
||||
# build KOKKOS downloaded libraries as static libraries but with PIC, if needed
|
||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DBUILD_SHARED_LIBS=OFF")
|
||||
if(CMAKE_REQUEST_PIC)
|
||||
list(APPEND KOKKOS_LIB_BUILD_ARGS ${CMAKE_REQUEST_PIC})
|
||||
endif()
|
||||
|
@ -37,41 +47,65 @@ if(DOWNLOAD_KOKKOS)
|
|||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
|
||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||
include(ExternalProject)
|
||||
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.5.00.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
||||
set(KOKKOS_MD5 "079323d973ae0e1c38c0a54a150c674e" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||
mark_as_advanced(KOKKOS_URL)
|
||||
mark_as_advanced(KOKKOS_MD5)
|
||||
ExternalProject_Add(kokkos_build
|
||||
URL https://github.com/kokkos/kokkos/archive/3.3.01.tar.gz
|
||||
URL_MD5 08201d1c7cf5bc458ce0f5b44a629d5a
|
||||
URL ${KOKKOS_URL}
|
||||
URL_MD5 ${KOKKOS_MD5}
|
||||
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a
|
||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a
|
||||
)
|
||||
ExternalProject_get_property(kokkos_build INSTALL_DIR)
|
||||
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||
add_library(LAMMPS::KOKKOS UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::KOKKOS PROPERTIES
|
||||
add_library(LAMMPS::KOKKOSCORE UNKNOWN IMPORTED)
|
||||
add_library(LAMMPS::KOKKOSCONTAINERS UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::KOKKOSCORE PROPERTIES
|
||||
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscore.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include"
|
||||
INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOS)
|
||||
add_dependencies(LAMMPS::KOKKOS kokkos_build)
|
||||
set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES
|
||||
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a")
|
||||
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::KOKKOSCONTAINERS kokkos_build)
|
||||
elseif(EXTERNAL_KOKKOS)
|
||||
find_package(Kokkos 3.3.01 REQUIRED CONFIG)
|
||||
find_package(Kokkos 3.5.00 REQUIRED CONFIG)
|
||||
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
||||
target_link_libraries(lmp PRIVATE Kokkos::kokkos)
|
||||
else()
|
||||
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
||||
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
||||
# build KOKKOS internal libraries as static libraries but with PIC, if needed
|
||||
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()
|
||||
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||
|
||||
|
||||
set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src
|
||||
${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src
|
||||
${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src
|
||||
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
|
||||
target_link_libraries(lammps PRIVATE kokkos)
|
||||
target_link_libraries(lmp PRIVATE kokkos)
|
||||
if(BUILD_SHARED_LIBS_WAS_ON)
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
endif()
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_KOKKOS)
|
||||
endif()
|
||||
target_compile_definitions(lammps PUBLIC $<BUILD_INTERFACE:LMP_KOKKOS>)
|
||||
|
||||
set(KOKKOS_PKG_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/KOKKOS)
|
||||
set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/atom_kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/atom_map_kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/atom_vec_kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/comm_kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/comm_tiled_kokkos.cpp
|
||||
|
@ -92,13 +126,19 @@ if(PKG_KSPACE)
|
|||
${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp
|
||||
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
|
||||
if(Kokkos_ENABLE_CUDA)
|
||||
if(NOT ${FFT} STREQUAL "KISS")
|
||||
if(NOT (FFT STREQUAL "KISS"))
|
||||
target_compile_definitions(lammps PRIVATE -DFFT_CUFFT)
|
||||
target_link_libraries(lammps PRIVATE cufft)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
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}/third_order_kokkos.cpp)
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}")
|
||||
|
||||
# detects styles which have KOKKOS version
|
||||
|
@ -109,7 +149,7 @@ RegisterNBinStyle(${KOKKOS_PKG_SOURCES_DIR}/nbin_kokkos.h)
|
|||
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_kokkos.h)
|
||||
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_halffull_kokkos.h)
|
||||
|
||||
if(PKG_USER-DPD)
|
||||
if(PKG_DPD-REACT)
|
||||
get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES)
|
||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/npair_ssa_kokkos.cpp)
|
||||
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_ssa_kokkos.h)
|
||||
|
@ -119,4 +159,4 @@ endif()
|
|||
get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES)
|
||||
|
||||
target_sources(lammps PRIVATE ${KOKKOS_PKG_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${KOKKOS_PKG_SOURCES_DIR})
|
||||
target_include_directories(lammps PUBLIC $<BUILD_INTERFACE:${KOKKOS_PKG_SOURCES_DIR}>)
|
||||
|
|
|
@ -15,10 +15,22 @@ 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 https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz
|
||||
URL_MD5 820e73a457ced178c08c71389a385de7
|
||||
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}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
find_package(Eigen3 NO_MODULE)
|
||||
if(EIGEN3_FOUND)
|
||||
set(DOWNLOAD_EIGEN3_DEFAULT OFF)
|
||||
else()
|
||||
set(DOWNLOAD_EIGEN3_DEFAULT ON)
|
||||
endif()
|
||||
option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT})
|
||||
if(DOWNLOAD_EIGEN3)
|
||||
message(STATUS "Eigen3 download requested - we will build our own")
|
||||
|
||||
set(EIGEN3_URL "${LAMMPS_THIRDPARTY_URL}/eigen-3.4.0.tar.gz" CACHE STRING "URL for Eigen3 tarball")
|
||||
set(EIGEN3_MD5 "4c527a9171d71a72a9d4186e65bea559" CACHE STRING "MD5 checksum of Eigen3 tarball")
|
||||
mark_as_advanced(EIGEN3_URL)
|
||||
mark_as_advanced(EIGEN3_MD5)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(Eigen3_build
|
||||
URL ${EIGEN3_URL}
|
||||
URL_MD5 ${EIGEN3_MD5}
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
)
|
||||
ExternalProject_get_property(Eigen3_build SOURCE_DIR)
|
||||
add_library(LAMMPS::EIGEN3 INTERFACE IMPORTED)
|
||||
set_target_properties(LAMMPS::EIGEN3 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}")
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::EIGEN3)
|
||||
add_dependencies(LAMMPS::EIGEN3 Eigen3_build)
|
||||
else()
|
||||
find_package(Eigen3 NO_MODULE)
|
||||
mark_as_advanced(Eigen3_DIR)
|
||||
if(NOT EIGEN3_FOUND)
|
||||
message(FATAL_ERROR "Eigen3 not found, help CMake to find it by setting EIGEN3_INCLUDE_DIR, or set DOWNLOAD_EIGEN3=ON to download it")
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE Eigen3::Eigen)
|
||||
endif()
|
||||
|
||||
# PGI/Nvidia compiler internals collide with vector intrinsics support in Eigen3
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC"))
|
||||
target_compile_definitions(lammps PRIVATE -DEIGEN_DONT_VECTORIZE)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(lammps PRIVATE -DEIGEN_NO_CUDA)
|
|
@ -0,0 +1,118 @@
|
|||
find_package(mdi QUIET)
|
||||
if(${mdi_FOUND})
|
||||
set(DOWNLOAD_MDI_DEFAULT OFF)
|
||||
else()
|
||||
set(DOWNLOAD_MDI_DEFAULT ON)
|
||||
endif()
|
||||
option(DOWNLOAD_MDI "Download and compile the MDI library instead of using an already installed one" ${DOWNLOAD_MDI_DEFAULT})
|
||||
|
||||
if(DOWNLOAD_MDI)
|
||||
message(STATUS "MDI download requested - we will build our own")
|
||||
set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.3.2.tar.gz" CACHE STRING "URL for MDI tarball")
|
||||
set(MDI_MD5 "836f5da400d8cff0f0e4435640f9454f" CACHE STRING "MD5 checksum for MDI tarball")
|
||||
mark_as_advanced(MDI_URL)
|
||||
mark_as_advanced(MDI_MD5)
|
||||
enable_language(C)
|
||||
|
||||
# only ON/OFF are allowed for "mpi" flag when building MDI library
|
||||
# so translate boolean value of BUILD_MPI
|
||||
# always disable MPI when cross-compiling to Windows.
|
||||
if((BUILD_MPI) AND NOT((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING))
|
||||
set(MDI_USE_MPI ON)
|
||||
else()
|
||||
set(MDI_USE_MPI OFF)
|
||||
endif()
|
||||
|
||||
# detect if we have python development support and thus can enable python plugins
|
||||
set(MDI_USE_PYTHON_PLUGINS OFF)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
find_package(PythonLibs QUIET) # Deprecated since version 3.12
|
||||
if(PYTHONLIBS_FOUND)
|
||||
set(MDI_USE_PYTHON_PLUGINS ON)
|
||||
endif()
|
||||
else()
|
||||
find_package(Python QUIET COMPONENTS Development)
|
||||
if(Python_Development_FOUND)
|
||||
set(MDI_USE_PYTHON_PLUGINS ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# download/ build MDI library
|
||||
# always build static library with -fpic
|
||||
# support cross-compilation and ninja-build
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(mdi_build
|
||||
URL ${MDI_URL}
|
||||
URL_MD5 ${MDI_MD5}
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
-Dlanguage=C
|
||||
-Dlibtype=STATIC
|
||||
-Dmpi=${MDI_USE_MPI}
|
||||
-Dpython_plugins=${MDI_USE_PYTHON_PLUGINS}
|
||||
UPDATE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS "<BINARY_DIR>/MDI_Library/libmdi.a"
|
||||
)
|
||||
|
||||
# where is the compiled library?
|
||||
ExternalProject_get_property(mdi_build BINARY_DIR)
|
||||
set(MDI_BINARY_DIR "${BINARY_DIR}/MDI_Library")
|
||||
# workaround for older CMake versions
|
||||
file(MAKE_DIRECTORY ${MDI_BINARY_DIR})
|
||||
|
||||
# create imported target for the MDI library
|
||||
add_library(LAMMPS::MDI UNKNOWN IMPORTED)
|
||||
add_dependencies(LAMMPS::MDI mdi_build)
|
||||
set_target_properties(LAMMPS::MDI PROPERTIES
|
||||
IMPORTED_LOCATION "${MDI_BINARY_DIR}/libmdi.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${MDI_BINARY_DIR}
|
||||
)
|
||||
|
||||
set(MDI_DEP_LIBS "")
|
||||
# if compiling with python plugins we need
|
||||
# to add python libraries as dependency.
|
||||
if(MDI_USE_PYTHON_PLUGINS)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
list(APPEND MDI_DEP_LIBS ${PYTHON_LIBRARIES})
|
||||
else()
|
||||
list(APPEND MDI_DEP_LIBS Python::Python)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
||||
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
||||
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
||||
endif()
|
||||
if(MDI_DEP_LIBS)
|
||||
set_target_properties(LAMMPS::MDI PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES "${MDI_DEP_LIBS}")
|
||||
endif()
|
||||
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::MDI)
|
||||
target_link_libraries(lmp PRIVATE LAMMPS::MDI)
|
||||
|
||||
else()
|
||||
|
||||
find_package(mdi)
|
||||
if(NOT mdi_FOUND)
|
||||
message(FATAL_ERROR "MDI library not found. Help CMake to find it "
|
||||
"by setting mdi_LIBRARY and mdi_INCLUDE_DIR, or set DOWNLOAD_MDI=ON "
|
||||
"to download and compile it")
|
||||
endif()
|
||||
|
||||
# Link the lammps library against MDI
|
||||
target_include_directories(lammps PRIVATE ${mdi_INCLUDE_DIR})
|
||||
target_link_libraries(lammps PRIVATE ${mdi_LIBRARY})
|
||||
|
||||
# Link the lammps executable against MDI
|
||||
target_include_directories(lmp PRIVATE ${mdi_INCLUDE_DIR})
|
||||
target_link_libraries(lmp PRIVATE ${mdi_LIBRARY})
|
||||
endif()
|
||||
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_MDI)
|
||||
target_compile_definitions(lmp PRIVATE -DLMP_MDI)
|
|
@ -1,31 +0,0 @@
|
|||
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
||||
message(FATAL_ERROR "The MESSAGE Package is not compatible with -DLAMMPS_BIGBIG")
|
||||
endif()
|
||||
option(MESSAGE_ZMQ "Use ZeroMQ in MESSAGE package" OFF)
|
||||
file(GLOB_RECURSE cslib_SOURCES
|
||||
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.cpp)
|
||||
|
||||
add_library(cslib STATIC ${cslib_SOURCES})
|
||||
target_compile_definitions(cslib PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||
set_target_properties(cslib PROPERTIES OUTPUT_NAME lammps_cslib${LAMMPS_MACHINE})
|
||||
if(BUILD_MPI)
|
||||
target_compile_definitions(cslib PRIVATE -DMPI_YES)
|
||||
set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi")
|
||||
target_link_libraries(cslib PRIVATE MPI::MPI_CXX)
|
||||
else()
|
||||
target_compile_definitions(cslib PRIVATE -DMPI_NO)
|
||||
target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_MPI)
|
||||
set_target_properties(cslib PROPERTIES OUTPUT_NAME "csnompi")
|
||||
endif()
|
||||
|
||||
if(MESSAGE_ZMQ)
|
||||
target_compile_definitions(cslib PRIVATE -DZMQ_YES)
|
||||
find_package(ZMQ REQUIRED)
|
||||
target_link_libraries(cslib PUBLIC ZMQ::ZMQ)
|
||||
else()
|
||||
target_compile_definitions(cslib PRIVATE -DZMQ_NO)
|
||||
target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_ZMQ)
|
||||
endif()
|
||||
|
||||
target_link_libraries(lammps PRIVATE cslib)
|
||||
target_include_directories(lammps PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src)
|
|
@ -0,0 +1,125 @@
|
|||
find_package(N2P2 QUIET)
|
||||
if(N2P2_FOUND)
|
||||
set(DOWNLOAD_N2P2_DEFAULT OFF)
|
||||
else()
|
||||
set(DOWNLOAD_N2P2_DEFAULT ON)
|
||||
endif()
|
||||
option(DOWNLOAD_N2P2 "Download n2p2 library instead of using an already installed one)" ${DOWNLOAD_N2P2_DEFAULT})
|
||||
if(DOWNLOAD_N2P2)
|
||||
set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.1.4.tar.gz" CACHE STRING "URL for n2p2 tarball")
|
||||
set(N2P2_MD5 "9595b066636cd6b90b0fef93398297a5" CACHE STRING "MD5 checksum of N2P2 tarball")
|
||||
mark_as_advanced(N2P2_URL)
|
||||
mark_as_advanced(N2P2_MD5)
|
||||
|
||||
# adjust settings from detected compiler to compiler platform in n2p2 library
|
||||
# set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7)
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
set(N2P2_COMP llvm)
|
||||
set(N2P2_CXX_STD "-std=c++11")
|
||||
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM"))
|
||||
set(N2P2_COMP intel)
|
||||
set(N2P2_CXX_STD "-std=c++11")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(N2P2_COMP gnu)
|
||||
set(N2P2_CXX_STD "-std=gnu++11")
|
||||
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC"))
|
||||
set(N2P2_COMP gnu)
|
||||
set(N2P2_CXX_STD "--c++11")
|
||||
else() # default
|
||||
set(N2P2_COMP "")
|
||||
endif()
|
||||
|
||||
# pass on archive creator command. prefer compiler specific version, if set.
|
||||
# important when using cross compiler.
|
||||
if(CMAKE_CXX_COMPILER_AR)
|
||||
set(N2P2_AR ${CMAKE_CXX_COMPILER_AR})
|
||||
else()
|
||||
set(N2P2_AR ${CMAKE_AR})
|
||||
endif()
|
||||
|
||||
# adjust compilation of n2p2 library to whether MPI is requested in LAMMPS or not
|
||||
# need special care for compiling for MPICH2 with Linux-to-Windows cross compiler.
|
||||
if(NOT BUILD_MPI)
|
||||
set(N2P2_PROJECT_OPTIONS "-DN2P2_NO_MPI")
|
||||
else()
|
||||
# get path to MPI include directory
|
||||
get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(N2P2_PROJECT_OPTIONS "-I${N2P2_MPI_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# prefer GNU make, if available. N2P2 lib seems to need it.
|
||||
find_program(N2P2_MAKE NAMES gmake make)
|
||||
|
||||
# override compiler (optimization) flags in n2p2 library to flags used for LAMMPS
|
||||
# specifically -march=native can result in problems when compiling on HPC clusters or with a cross compiler
|
||||
# this convoluted way gets correct quoting/escaping when configuring the external project
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
|
||||
set(N2P2_BUILD_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}} ${N2P2_CXX_STD}")
|
||||
set(N2P2_BUILD_OPTIONS INTERFACES=LAMMPS COMP=${N2P2_COMP} "PROJECT_OPTIONS=${N2P2_PROJECT_OPTIONS}" "PROJECT_DEBUG="
|
||||
"PROJECT_CC=${CMAKE_CXX_COMPILER}" "PROJECT_MPICC=${CMAKE_CXX_COMPILER}" "PROJECT_CFLAGS=${N2P2_BUILD_FLAGS}"
|
||||
"PROJECT_AR=${N2P2_AR}" "APP_CORE=nnp-convert" "APP_TRAIN=nnp-train" "APP=nnp-convert")
|
||||
# echo final flag for debugging
|
||||
message(STATUS "N2P2 BUILD OPTIONS: ${N2P2_BUILD_OPTIONS}")
|
||||
|
||||
# must have "sed" command to compile n2p2 library (for now)
|
||||
find_program(HAVE_SED sed)
|
||||
if(NOT HAVE_SED)
|
||||
message(FATAL_ERROR "Must have 'sed' program installed to compile 'n2p2' library for ML-HDNNP package")
|
||||
endif()
|
||||
|
||||
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(n2p2_build
|
||||
URL ${N2P2_URL}
|
||||
URL_MD5 ${N2P2_MD5}
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
PATCH_COMMAND sed -i -e "s/\\(MPI_\\(P\\|Unp\\)ack(\\)/\\1(void *) /" src/libnnpif/LAMMPS/InterfaceLammps.cpp
|
||||
BUILD_COMMAND ${N2P2_MAKE} -f makefile libnnpif ${N2P2_BUILD_OPTIONS}
|
||||
BUILD_ALWAYS YES
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_IN_SOURCE 1
|
||||
LOG_BUILD ON
|
||||
SOURCE_SUBDIR src/
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libnnp.a <SOURCE_DIR>/lib/libnnpif.a
|
||||
)
|
||||
|
||||
# create imported target LAMMPS::N2P2 from two libraries nnp and nnpif
|
||||
ExternalProject_get_property(n2p2_build SOURCE_DIR)
|
||||
# n2p2 core library "libnnp"
|
||||
add_library(LAMMPS::N2P2::LIBNNP UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::N2P2::LIBNNP PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libnnp.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include")
|
||||
# n2p2 interface library "libnnpif"
|
||||
add_library(LAMMPS::N2P2::LIBNNPIF UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::N2P2::LIBNNPIF PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libnnpif.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include")
|
||||
# nnpif library has MPI calls if MPI is enabled, so we must link with MPI libs
|
||||
if(BUILD_MPI)
|
||||
set_target_properties(LAMMPS::N2P2::LIBNNPIF PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES MPI::MPI_CXX)
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)
|
||||
add_dependencies(LAMMPS::N2P2::LIBNNPIF MPI::MPI_CXX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# final step to define imported target
|
||||
add_library(LAMMPS::N2P2 INTERFACE IMPORTED)
|
||||
set_property(TARGET LAMMPS::N2P2 PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES LAMMPS::N2P2::LIBNNPIF LAMMPS::N2P2::LIBNNP)
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::N2P2)
|
||||
|
||||
add_dependencies(LAMMPS::N2P2 n2p2_build)
|
||||
# work around issues with older CMake versions
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||
file(MAKE_DIRECTORY "${SOURCE_DIR}/lib")
|
||||
else()
|
||||
find_package(N2P2)
|
||||
if(NOT N2P2_FOUND)
|
||||
message(FATAL_ERROR "n2p2 not found, help CMake to find it by setting N2P2_DIR, or set DOWNLOAD_N2P2=ON to download it")
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE N2P2::N2P2)
|
||||
include(${N2P2_CMAKE_EXTRAS})
|
||||
endif()
|
|
@ -0,0 +1,40 @@
|
|||
# if PYTHON package is included we may also include Python support in ML-IAP
|
||||
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
||||
if(PKG_PYTHON)
|
||||
find_package(Cythonize QUIET)
|
||||
if(Cythonize_FOUND)
|
||||
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_ENABLE_PYTHON_DEFAULT})
|
||||
|
||||
if(MLIAP_ENABLE_PYTHON)
|
||||
find_package(Cythonize REQUIRED)
|
||||
if(NOT PKG_PYTHON)
|
||||
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
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()
|
||||
|
||||
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
||||
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})
|
||||
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_SRC} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
|
||||
MAIN_DEPENDENCY ${MLIAP_CYTHON_SRC}
|
||||
COMMENT "Generating C++ sources with cythonize...")
|
||||
target_compile_definitions(lammps PRIVATE -DMLIAP_PYTHON)
|
||||
target_sources(lammps PRIVATE ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
|
||||
target_include_directories(lammps PRIVATE ${MLIAP_BINARY_DIR})
|
||||
endif()
|
|
@ -0,0 +1,32 @@
|
|||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||
|
||||
set(PACELIB_MD5 "a2ac3315c41a1a4a5c912bcb1bc9c5cc" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||
mark_as_advanced(PACELIB_URL)
|
||||
mark_as_advanced(PACELIB_MD5)
|
||||
|
||||
# download library sources to build folder
|
||||
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS
|
||||
|
||||
# uncompress downloaded sources
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace*
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*)
|
||||
add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp)
|
||||
set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include)
|
||||
|
||||
file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE)
|
||||
file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp)
|
||||
list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp)
|
||||
|
||||
add_library(pace STATIC ${PACE_EVALUATOR_SOURCES})
|
||||
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
|
||||
target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR})
|
||||
|
||||
|
||||
target_link_libraries(pace PRIVATE yaml-cpp-pace)
|
||||
|
||||
target_link_libraries(lammps PRIVATE pace)
|
|
@ -0,0 +1,72 @@
|
|||
enable_language(Fortran)
|
||||
find_package(QUIP QUIET)
|
||||
|
||||
if(QUIP_FOUND)
|
||||
set(DOWNLOAD_QUIP_DEFAULT OFF)
|
||||
else()
|
||||
set(DOWNLOAD_QUIP_DEFAULT ON)
|
||||
endif()
|
||||
option(DOWNLOAD_QUIP "Download the QUIP library instead of using an already installed one" ${DOWNLOAD_QUIP_DEFAULT})
|
||||
if(DOWNLOAD_QUIP)
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
|
||||
set(temp "F77 = ${CMAKE_Fortran_COMPILER}\nF90 = ${CMAKE_Fortran_COMPILER}\nF95 = ${CMAKE_Fortran_COMPILER}\n")
|
||||
set(temp "${temp}CC=${CMAKE_C_COMPILER}\nCPLUSPLUS=${CMAKE_CXX_COMPILER}\nLINKER=${CMAKE_Fortran_COMPILER}\n")
|
||||
if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
|
||||
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
|
||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n")
|
||||
set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n")
|
||||
set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n")
|
||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
||||
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
|
||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n")
|
||||
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")
|
||||
else()
|
||||
message(FATAL_ERROR "The ${CMAKE_Fortran_COMPILER_ID} Fortran compiler is not (yet) supported for building QUIP")
|
||||
endif()
|
||||
set(temp "${temp}CFLAGS += -fPIC \nCPLUSPLUSFLAGS += -fPIC\nAR_ADD=src\n")
|
||||
set(temp "${temp}MATH_LINKOPTS=")
|
||||
foreach(flag ${BLAS_LIBRARIES})
|
||||
set(temp "${temp} ${flag}")
|
||||
endforeach()
|
||||
foreach(flag ${LAPACK_LIBRARIES})
|
||||
set(temp "${temp} ${flag}")
|
||||
endforeach()
|
||||
# Fix cmake crashing when MATH_LINKOPTS not set, required for e.g. recent Cray Programming Environment
|
||||
set(temp "${temp} -L/_DUMMY_PATH_\n")
|
||||
set(temp "${temp}PYTHON=python\nPIP=pip\nEXTRA_LINKOPTS=\n")
|
||||
set(temp "${temp}HAVE_CP2K=0\nHAVE_VASP=0\nHAVE_TB=0\nHAVE_PRECON=1\nHAVE_LOTF=0\nHAVE_ONIOM=0\n")
|
||||
set(temp "${temp}HAVE_LOCAL_E_MIX=0\nHAVE_QC=0\nHAVE_GAP=1\nHAVE_DESCRIPTORS_NONCOMMERCIAL=1\n")
|
||||
set(temp "${temp}HAVE_TURBOGAP=0\nHAVE_QR=1\nHAVE_THIRDPARTY=0\nHAVE_FX=0\nHAVE_SCME=0\nHAVE_MTP=0\n")
|
||||
set(temp "${temp}HAVE_MBD=0\nHAVE_TTM_NF=0\nHAVE_CH4=0\nHAVE_NETCDF4=0\nHAVE_MDCORE=0\nHAVE_ASAP=0\n")
|
||||
set(temp "${temp}HAVE_CGAL=0\nHAVE_METIS=0\nHAVE_LMTO_TBE=0\nHAVE_SCALAPACK=0\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/quip.config "${temp}")
|
||||
|
||||
message(STATUS "QUIP download via git requested - we will build our own")
|
||||
# QUIP has no releases (except for a tag marking the end of Python 2 support). We use the current "public" branch
|
||||
# The LAMMPS interface wrapper has a compatibility constant that is being checked at runtime.
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(quip_build
|
||||
GIT_REPOSITORY "https://github.com/libAtoms/QUIP/"
|
||||
GIT_TAG origin/public
|
||||
GIT_SHALLOW YES
|
||||
GIT_PROGRESS YES
|
||||
GIT_SUBMODULES "src/fox;src/GAP"
|
||||
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
|
||||
BUILD_COMMAND env QUIP_ARCH=lammps make libquip
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_IN_SOURCE YES
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/build/lammps/libquip.a
|
||||
)
|
||||
ExternalProject_get_property(quip_build SOURCE_DIR)
|
||||
add_library(LAMMPS::QUIP UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::QUIP PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/build/lammps/libquip.a"
|
||||
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::QUIP)
|
||||
add_dependencies(LAMMPS::QUIP quip_build)
|
||||
else()
|
||||
find_package(QUIP REQUIRED)
|
||||
target_link_libraries(lammps PRIVATE QUIP::QUIP ${LAPACK_LIBRARIES})
|
||||
endif()
|
|
@ -1,40 +0,0 @@
|
|||
# if PYTHON package is included we may also include Python support in MLIAP
|
||||
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
||||
if(PKG_PYTHON)
|
||||
find_package(Cythonize QUIET)
|
||||
if(Cythonize_FOUND)
|
||||
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(MLIAP_ENABLE_PYTHON "Build MLIAP package with Python support" ${MLIAP_ENABLE_PYTHON_DEFAULT})
|
||||
|
||||
if(MLIAP_ENABLE_PYTHON)
|
||||
find_package(Cythonize REQUIRED)
|
||||
if(NOT PKG_PYTHON)
|
||||
message(FATAL_ERROR "Must enable PYTHON package for including Python support in MLIAP")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6)
|
||||
message(FATAL_ERROR "Python support in MLIAP requires Python 3.6 or later")
|
||||
endif()
|
||||
else()
|
||||
if(Python_VERSION VERSION_LESS 3.6)
|
||||
message(FATAL_ERROR "Python support in MLIAP requires Python 3.6 or later")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
||||
set(MLIAP_CYTHON_SRC ${LAMMPS_SOURCE_DIR}/MLIAP/mliap_model_python_couple.pyx)
|
||||
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_SRC} NAME_WE)
|
||||
file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR})
|
||||
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_SRC} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
|
||||
MAIN_DEPENDENCY ${MLIAP_CYTHON_SRC}
|
||||
COMMENT "Generating C++ sources with cythonize...")
|
||||
target_compile_definitions(lammps PRIVATE -DMLIAP_PYTHON)
|
||||
target_sources(lammps PRIVATE ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
|
||||
target_include_directories(lammps PRIVATE ${MLIAP_BINARY_DIR})
|
||||
endif()
|
|
@ -0,0 +1,7 @@
|
|||
set(MOLFILE_INCLUDE_DIR "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
|
||||
add_library(molfile INTERFACE)
|
||||
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIR})
|
||||
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
||||
target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE molfile)
|
|
@ -7,34 +7,17 @@ else()
|
|||
endif()
|
||||
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
|
||||
if(DOWNLOAD_MSCG)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(mscg_build
|
||||
URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz
|
||||
URL_MD5 8c45e269ee13f60b303edd7823866a91
|
||||
SOURCE_SUBDIR src/CMake
|
||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
|
||||
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target mscg
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <BINARY_DIR>/libmscg.a
|
||||
)
|
||||
ExternalProject_get_property(mscg_build BINARY_DIR)
|
||||
ExternalProject_get_property(mscg_build SOURCE_DIR)
|
||||
file(MAKE_DIRECTORY ${SOURCE_DIR}/src)
|
||||
add_library(LAMMPS::MSCG UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::MSCG PROPERTIES
|
||||
IMPORTED_LOCATION "${BINARY_DIR}/libmscg.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/src"
|
||||
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::MSCG)
|
||||
add_dependencies(LAMMPS::MSCG mscg_build)
|
||||
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)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# NETCDF can use NetCDF, Parallel NetCDF (PNetCDF), or both. At least one necessary.
|
||||
# NetCDF library enables dump style "netcdf", while PNetCDF enables dump style "netcdf/mpiio"
|
||||
|
||||
# may use NetCDF or PNetCDF with MPI, but must have NetCDF without
|
||||
if(NOT BUILD_MPI)
|
||||
find_package(NetCDF REQUIRED)
|
||||
else()
|
||||
find_package(NetCDF)
|
||||
if(NETCDF_FOUND)
|
||||
find_package(PNetCDF)
|
||||
else()
|
||||
find_package(PNetCDF REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NETCDF_FOUND)
|
||||
target_link_libraries(lammps PRIVATE NetCDF::NetCDF)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_HAS_NETCDF)
|
||||
endif(NETCDF_FOUND)
|
||||
|
||||
if(PNETCDF_FOUND)
|
||||
target_link_libraries(lammps PRIVATE PNetCDF::PNetCDF)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_HAS_PNETCDF)
|
||||
endif(PNETCDF_FOUND)
|
||||
|
||||
target_compile_definitions(lammps PRIVATE -DNC_64BIT_DATA=0x0020)
|
|
@ -0,0 +1,40 @@
|
|||
set(OPENMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/OPENMP)
|
||||
set(OPENMP_SOURCES ${OPENMP_SOURCES_DIR}/thr_data.cpp
|
||||
${OPENMP_SOURCES_DIR}/thr_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/fix_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/fix_nh_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/fix_nh_sphere_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/domain_omp.cpp)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_OPENMP)
|
||||
set_property(GLOBAL PROPERTY "OMP_SOURCES" "${OPENMP_SOURCES}")
|
||||
|
||||
# detects styles which have OPENMP version
|
||||
RegisterStylesExt(${OPENMP_SOURCES_DIR} omp OMP_SOURCES)
|
||||
RegisterFixStyle(${OPENMP_SOURCES_DIR}/fix_omp.h)
|
||||
|
||||
get_property(OPENMP_SOURCES GLOBAL PROPERTY OMP_SOURCES)
|
||||
|
||||
# manually add package dependent source files from OPENMP that do not provide styles
|
||||
|
||||
if(PKG_ASPHERE)
|
||||
list(APPEND OPENMP_SOURCES ${OPENMP_SOURCES_DIR}/fix_nh_asphere_omp.cpp)
|
||||
endif()
|
||||
|
||||
if(PKG_RIGID)
|
||||
list(APPEND OPENMP_SOURCES ${OPENMP_SOURCES_DIR}/fix_rigid_nh_omp.cpp)
|
||||
endif()
|
||||
|
||||
if(PKG_REAXFF)
|
||||
list(APPEND OPENMP_SOURCES ${OPENMP_SOURCES_DIR}/reaxff_bond_orders_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/reaxff_hydrogen_bonds_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/reaxff_nonbonded_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/reaxff_bonds_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/reaxff_init_md_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/reaxff_torsion_angles_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/reaxff_forces_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/reaxff_multi_body_omp.cpp
|
||||
${OPENMP_SOURCES_DIR}/reaxff_valence_angles_omp.cpp)
|
||||
endif()
|
||||
|
||||
target_sources(lammps PRIVATE ${OPENMP_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${OPENMP_SOURCES_DIR})
|
|
@ -0,0 +1,9 @@
|
|||
# fix phonon may only be installed if also the FFT wrappers from KSPACE are installed
|
||||
if(NOT PKG_KSPACE)
|
||||
get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX)
|
||||
list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/PHONON/fix_phonon.h)
|
||||
set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}")
|
||||
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/PHONON/fix_phonon.cpp)
|
||||
set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}")
|
||||
endif()
|
|
@ -0,0 +1,105 @@
|
|||
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)
|
||||
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/libplumed.a")
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumed${CMAKE_SHARED_LIBRARY_SUFFIX};<INSTALL_DIR>/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a")
|
||||
endif()
|
||||
|
||||
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.7.4/plumed-src-2.7.4.tgz" CACHE STRING "URL for PLUMED tarball")
|
||||
set(PLUMED_MD5 "858e0b6aed173748fc85b6bc8a9dcb3e" CACHE STRING "MD5 checksum of PLUMED tarball")
|
||||
|
||||
mark_as_advanced(PLUMED_URL)
|
||||
mark_as_advanced(PLUMED_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(plumed_build
|
||||
URL ${PLUMED_URL}
|
||||
URL_MD5 ${PLUMED_MD5}
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
${CONFIGURE_REQUEST_PIC}
|
||||
--enable-modules=all
|
||||
${PLUMED_CONFIG_MPI}
|
||||
${PLUMED_CONFIG_OMP}
|
||||
CXX=${PLUMED_CONFIG_CXX}
|
||||
CC=${PLUMED_CONFIG_CC}
|
||||
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
|
||||
)
|
||||
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
||||
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed.a INTERFACE_LINK_LIBRARIES "${PLUMED_LINK_LIBS};${CMAKE_DL_LIBS}")
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed${CMAKE_SHARED_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_DL_LIBS}")
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumedWrapper.a 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}/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
||||
endif()
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_LINK_LIBRARIES "${PLUMED_LOAD}")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_INCLUDE_DIRS}")
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
|
|
@ -3,7 +3,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12)
|
|||
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS})
|
||||
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES})
|
||||
else()
|
||||
find_package(Python REQUIRED COMPONENTS Development)
|
||||
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
||||
target_link_libraries(lammps PRIVATE Python::Python)
|
||||
endif()
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
# Fix qeq/fire requires MANYBODY (i.e. COMB and COMB3) to be installed
|
||||
set(QEQ_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/QEQ)
|
||||
file(GLOB QEQ_HEADERS ${QEQ_SOURCES_DIR}/fix*.h)
|
||||
file(GLOB QEQ_SOURCES ${QEQ_SOURCES_DIR}/fix*.cpp)
|
||||
|
||||
get_property(hlist GLOBAL PROPERTY FIX)
|
||||
if(NOT PKG_MANYBODY)
|
||||
list(REMOVE_ITEM QEQ_HEADERS ${QEQ_SOURCES_DIR}/fix_qeq_fire.h)
|
||||
list(REMOVE_ITEM QEQ_SOURCES ${QEQ_SOURCES_DIR}/fix_qeq_fire.cpp)
|
||||
list(REMOVE_ITEM hlist ${QEQ_SOURCES_DIR}/fix_qeq_fire.h)
|
||||
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||
list(REMOVE_ITEM LAMMPS_SOURCES ${QEQ_SOURCES_DIR}/fix_qeq_fire.cpp)
|
||||
set_property(TARGET lammps PROPERTY SOURCES ${LAMMPS_SOURCES})
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY "QEQ_SOURCES" "${QEQ_SOURCES}")
|
||||
set_property(GLOBAL PROPERTY FIX "${hlist}")
|
||||
|
||||
foreach(MY_HEADER ${QEQ_HEADERS})
|
||||
AddStyleHeader(${MY_HEADER} FIX)
|
||||
endforeach()
|
||||
|
||||
get_property(QEQ_SOURCES GLOBAL PROPERTY QEQ_SOURCES)
|
||||
target_sources(lammps PRIVATE ${QEQ_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${QEQ_SOURCES_DIR})
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
enable_language(Fortran)
|
||||
enable_language(C)
|
||||
|
||||
find_package(GSL REQUIRED)
|
||||
find_package(PkgConfig QUIET)
|
||||
find_package(MPI REQUIRED)
|
||||
set(DOWNLOAD_SCAFACOS_DEFAULT ON)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(SCAFACOS QUIET scafacos)
|
||||
if(SCAFACOS_FOUND)
|
||||
set(DOWNLOAD_SCAFACOS_DEFAULT OFF)
|
||||
endif()
|
||||
endif()
|
||||
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
|
||||
if(DOWNLOAD_SCAFACOS)
|
||||
message(STATUS "ScaFaCoS download requested - we will build our own")
|
||||
set(SCAFACOS_URL "https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz" CACHE STRING "URL for SCAFACOS tarball")
|
||||
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
|
||||
mark_as_advanced(SCAFACOS_URL)
|
||||
mark_as_advanced(SCAFACOS_MD5)
|
||||
|
||||
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
||||
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
EXPECTED_HASH MD5=4baa1333bb28fcce102d505e1992d032)
|
||||
|
||||
find_program(HAVE_PATCH patch)
|
||||
if(NOT HAVE_PATCH)
|
||||
message(FATAL_ERROR "The 'patch' program is required to build the ScaFaCoS library")
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(scafacos_build
|
||||
URL ${SCAFACOS_URL}
|
||||
URL_MD5 ${SCAFACOS_MD5}
|
||||
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
||||
--enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m
|
||||
--with-internal-fftw --with-internal-pfft
|
||||
--with-internal-pnfft ${CONFIGURE_REQUEST_PIC}
|
||||
FC=${CMAKE_MPI_Fortran_COMPILER}
|
||||
CXX=${CMAKE_MPI_CXX_COMPILER}
|
||||
CC=${CMAKE_MPI_C_COMPILER}
|
||||
F77=
|
||||
BUILD_BYPRODUCTS
|
||||
<INSTALL_DIR>/lib/libfcs.a
|
||||
<INSTALL_DIR>/lib/libfcs_direct.a
|
||||
<INSTALL_DIR>/lib/libfcs_ewald.a
|
||||
<INSTALL_DIR>/lib/libfcs_fmm.a
|
||||
<INSTALL_DIR>/lib/libfcs_p2nfft.a
|
||||
<INSTALL_DIR>/lib/libfcs_p3m.a
|
||||
<INSTALL_DIR>/lib/libfcs_near.a
|
||||
<INSTALL_DIR>/lib/libfcs_gridsort.a
|
||||
<INSTALL_DIR>/lib/libfcs_resort.a
|
||||
<INSTALL_DIR>/lib/libfcs_redist.a
|
||||
<INSTALL_DIR>/lib/libfcs_common.a
|
||||
<INSTALL_DIR>/lib/libfcs_pnfft.a
|
||||
<INSTALL_DIR>/lib/libfcs_pfft.a
|
||||
<INSTALL_DIR>/lib/libfcs_fftw3_mpi.a
|
||||
<INSTALL_DIR>/lib/libfcs_fftw3.a
|
||||
)
|
||||
ExternalProject_get_property(scafacos_build INSTALL_DIR)
|
||||
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||
add_library(LAMMPS::SCAFACOS UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::SCAFACOS PROPERTIES
|
||||
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libfcs.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include"
|
||||
INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libfcs.a;${INSTALL_DIR}/lib/libfcs_direct.a;${INSTALL_DIR}/lib/libfcs_ewald.a;${INSTALL_DIR}/lib/libfcs_fmm.a;${INSTALL_DIR}/lib/libfcs_p2nfft.a;${INSTALL_DIR}/lib/libfcs_p3m.a;GSL::gsl;${INSTALL_DIR}/lib/libfcs_near.a;${INSTALL_DIR}/lib/libfcs_gridsort.a;${INSTALL_DIR}/lib/libfcs_resort.a;${INSTALL_DIR}/lib/libfcs_redist.a;${INSTALL_DIR}/lib/libfcs_common.a;${INSTALL_DIR}/lib/libfcs_pnfft.a;${INSTALL_DIR}/lib/libfcs_pfft.a;${INSTALL_DIR}/lib/libfcs_fftw3_mpi.a;${INSTALL_DIR}/lib/libfcs_fftw3.a;MPI::MPI_Fortran;MPI::MPI_C")
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::SCAFACOS)
|
||||
add_dependencies(LAMMPS::SCAFACOS scafacos_build)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SCAFACOS REQUIRED IMPORTED_TARGET scafacos)
|
||||
target_link_libraries(lammps PRIVATE PkgConfig::SCAFACOS)
|
||||
endif()
|
|
@ -1,39 +0,0 @@
|
|||
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||
|
||||
file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
||||
|
||||
option(COLVARS_DEBUG "Debugging messages for Colvars (quite verbose)" OFF)
|
||||
|
||||
# Build Lepton by default
|
||||
option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
||||
|
||||
if(COLVARS_LEPTON)
|
||||
set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton)
|
||||
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp)
|
||||
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()
|
||||
|
||||
add_library(colvars STATIC ${COLVARS_SOURCES})
|
||||
target_compile_definitions(colvars PRIVATE -DCOLVARS_LAMMPS)
|
||||
set_target_properties(colvars PROPERTIES OUTPUT_NAME lammps_colvars${LAMMPS_MACHINE})
|
||||
target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||
# The line below is needed to locate math_eigen_impl.h
|
||||
target_include_directories(colvars PRIVATE ${LAMMPS_SOURCE_DIR})
|
||||
target_link_libraries(lammps PRIVATE colvars)
|
||||
|
||||
if(COLVARS_DEBUG)
|
||||
# Need to export the macro publicly to also affect the proxy
|
||||
target_compile_definitions(colvars PUBLIC -DCOLVARS_DEBUG)
|
||||
endif()
|
||||
|
||||
if(COLVARS_LEPTON)
|
||||
target_link_libraries(lammps PRIVATE lepton)
|
||||
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
||||
# 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()
|
|
@ -1,5 +0,0 @@
|
|||
enable_language(C)
|
||||
|
||||
find_package(HDF5 REQUIRED)
|
||||
target_link_libraries(h5md PRIVATE ${HDF5_LIBRARIES})
|
||||
target_include_directories(h5md PUBLIC ${HDF5_INCLUDE_DIRS})
|
|
@ -1,109 +0,0 @@
|
|||
check_include_file_cxx(immintrin.h FOUND_IMMINTRIN)
|
||||
if(NOT FOUND_IMMINTRIN)
|
||||
message(FATAL_ERROR "immintrin.h header not found, Intel package won't work without it")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_USER_INTEL)
|
||||
|
||||
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
|
||||
set(INTEL_ARCH_VALUES cpu knl)
|
||||
set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES})
|
||||
validate_option(INTEL_ARCH INTEL_ARCH_VALUES)
|
||||
string(TOUPPER ${INTEL_ARCH} INTEL_ARCH)
|
||||
|
||||
find_package(Threads QUIET)
|
||||
if(Threads_FOUND)
|
||||
set(INTEL_LRT_MODE "threads" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
|
||||
else()
|
||||
set(INTEL_LRT_MODE "none" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
|
||||
endif()
|
||||
set(INTEL_LRT_VALUES none threads c++11)
|
||||
set_property(CACHE INTEL_LRT_MODE PROPERTY STRINGS ${INTEL_LRT_VALUES})
|
||||
validate_option(INTEL_LRT_MODE INTEL_LRT_VALUES)
|
||||
string(TOUPPER ${INTEL_LRT_MODE} INTEL_LRT_MODE)
|
||||
if(INTEL_LRT_MODE STREQUAL "THREADS")
|
||||
if(Threads_FOUND)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT)
|
||||
target_link_libraries(lammps PRIVATE Threads::Threads)
|
||||
else()
|
||||
message(FATAL_ERROR "Must have working threads library for Long-range thread support")
|
||||
endif()
|
||||
endif()
|
||||
if(INTEL_LRT_MODE STREQUAL "C++11")
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT -DLMP_INTEL_LRT11)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
|
||||
message(FATAL_ERROR "USER-INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "USER-INTEL gives best performance with Intel compilers")
|
||||
endif()
|
||||
|
||||
find_package(TBB_MALLOC QUIET)
|
||||
if(TBB_MALLOC_FOUND)
|
||||
target_link_libraries(lammps PRIVATE TBB::TBB_MALLOC)
|
||||
else()
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_NO_TBB)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
message(WARNING "USER-INTEL with Intel compilers should use TBB malloc libraries")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(MKL QUIET)
|
||||
if(MKL_FOUND)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_USE_MKL_RNG)
|
||||
target_link_libraries(lammps PRIVATE MKL::MKL)
|
||||
else()
|
||||
message(STATUS "Pair style dpd/intel will be faster with MKL libraries")
|
||||
endif()
|
||||
|
||||
if((NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "64") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "128") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "256"))
|
||||
message(FATAL_ERROR "USER-INTEL only supports memory alignment of 64, 128 or 256 on this platform")
|
||||
endif()
|
||||
|
||||
if(INTEL_ARCH STREQUAL "KNL")
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
message(FATAL_ERROR "Must use Intel compiler with USER-INTEL for KNL architecture")
|
||||
endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload")
|
||||
set(MIC_OPTIONS "-qoffload-option,mic,compiler,\"-fp-model fast=2 -mGLOB_default_function_attrs=\\\"gather_scatter_loop_unroll=4\\\"\"")
|
||||
target_compile_options(lammps PRIVATE -xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_OFFLOAD)
|
||||
else()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
include(CheckCXXCompilerFlag)
|
||||
foreach(_FLAG -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
|
||||
check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAG})
|
||||
if(COMPILER_SUPPORTS${_FLAG})
|
||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# collect sources
|
||||
set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL)
|
||||
set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/fix_intel.cpp
|
||||
${USER-INTEL_SOURCES_DIR}/fix_nh_intel.cpp
|
||||
${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp
|
||||
${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp
|
||||
${USER-INTEL_SOURCES_DIR}/npair_intel.cpp)
|
||||
|
||||
set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}")
|
||||
|
||||
# detect styles which have a USER-INTEL version
|
||||
RegisterStylesExt(${USER-INTEL_SOURCES_DIR} intel USER-INTEL_SOURCES)
|
||||
RegisterNBinStyle(${USER-INTEL_SOURCES_DIR}/nbin_intel.h)
|
||||
RegisterNPairStyle(${USER-INTEL_SOURCES_DIR}/npair_intel.h)
|
||||
RegisterFixStyle(${USER-INTEL_SOURCES_DIR}/fix_intel.h)
|
||||
|
||||
get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES)
|
||||
if(PKG_KSPACE)
|
||||
list(APPEND USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp)
|
||||
RegisterIntegrateStyle(${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
||||
endif()
|
||||
|
||||
target_sources(lammps PRIVATE ${USER-INTEL_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${USER-INTEL_SOURCES_DIR})
|
|
@ -1,9 +0,0 @@
|
|||
set(MOLFILE_INCLUDE_DIR "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
|
||||
set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}")
|
||||
add_library(molfile INTERFACE)
|
||||
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
|
||||
# no need to link with -ldl on windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE molfile)
|
|
@ -1,26 +0,0 @@
|
|||
# USER-NETCDF can use NetCDF, Parallel NetCDF (PNetCDF), or both. At least one necessary.
|
||||
# NetCDF library enables dump style "netcdf", while PNetCDF enables dump style "netcdf/mpiio"
|
||||
|
||||
# may use NetCDF or PNetCDF with MPI, but must have NetCDF without
|
||||
if(NOT BUILD_MPI)
|
||||
find_package(NetCDF REQUIRED)
|
||||
else()
|
||||
find_package(NetCDF)
|
||||
if(NETCDF_FOUND)
|
||||
find_package(PNetCDF)
|
||||
else()
|
||||
find_package(PNetCDF REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NETCDF_FOUND)
|
||||
target_link_libraries(lammps PRIVATE NetCDF::NetCDF)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_HAS_NETCDF)
|
||||
endif(NETCDF_FOUND)
|
||||
|
||||
if(PNETCDF_FOUND)
|
||||
target_link_libraries(lammps PRIVATE PNetCDF::PNetCDF)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_HAS_PNETCDF)
|
||||
endif(PNETCDF_FOUND)
|
||||
|
||||
target_compile_definitions(lammps PRIVATE -DNC_64BIT_DATA=0x0020)
|
|
@ -1,40 +0,0 @@
|
|||
set(USER-OMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-OMP)
|
||||
set(USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/thr_data.cpp
|
||||
${USER-OMP_SOURCES_DIR}/thr_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/fix_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/fix_nh_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/fix_nh_sphere_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/domain_omp.cpp)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_USER_OMP)
|
||||
set_property(GLOBAL PROPERTY "OMP_SOURCES" "${USER-OMP_SOURCES}")
|
||||
|
||||
# detects styles which have USER-OMP version
|
||||
RegisterStylesExt(${USER-OMP_SOURCES_DIR} omp OMP_SOURCES)
|
||||
RegisterFixStyle(${USER-OMP_SOURCES_DIR}/fix_omp.h)
|
||||
|
||||
get_property(USER-OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES)
|
||||
|
||||
# manually add package dependent source files from USER-OMP that do not provide styles
|
||||
|
||||
if(PKG_ASPHERE)
|
||||
list(APPEND USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/fix_nh_asphere_omp.cpp)
|
||||
endif()
|
||||
|
||||
if(PKG_RIGID)
|
||||
list(APPEND USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/fix_rigid_nh_omp.cpp)
|
||||
endif()
|
||||
|
||||
if(PKG_USER-REAXC)
|
||||
list(APPEND USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/reaxc_bond_orders_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/reaxc_hydrogen_bonds_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/reaxc_nonbonded_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/reaxc_bonds_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/reaxc_init_md_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/reaxc_torsion_angles_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/reaxc_forces_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/reaxc_multi_body_omp.cpp
|
||||
${USER-OMP_SOURCES_DIR}/reaxc_valence_angles_omp.cpp)
|
||||
endif()
|
||||
|
||||
target_sources(lammps PRIVATE ${USER-OMP_SOURCES})
|
||||
target_include_directories(lammps PRIVATE ${USER-OMP_SOURCES_DIR})
|
|
@ -1,98 +0,0 @@
|
|||
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)
|
||||
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/libplumed.a")
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumed${CMAKE_SHARED_LIBRARY_SUFFIX};<INSTALL_DIR>/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a")
|
||||
endif()
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(plumed_build
|
||||
URL https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz
|
||||
URL_MD5 95f29dd0c067577f11972ff90dfc7d12
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
${CONFIGURE_REQUEST_PIC}
|
||||
--enable-modules=all
|
||||
${PLUMED_CONFIG_MPI}
|
||||
${PLUMED_CONFIG_OMP}
|
||||
CXX=${PLUMED_CONFIG_CXX}
|
||||
CC=${PLUMED_CONFIG_CC}
|
||||
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
|
||||
)
|
||||
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
||||
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed.a INTERFACE_LINK_LIBRARIES "${PLUMED_LINK_LIBS};${CMAKE_DL_LIBS}")
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed${CMAKE_SHARED_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_DL_LIBS}")
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumedWrapper.a 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}/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
||||
endif()
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_LINK_LIBRARIES "${PLUMED_LOAD}")
|
||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_INCLUDE_DIRS}")
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
|
|
@ -1,3 +0,0 @@
|
|||
enable_language(Fortran)
|
||||
find_package(QUIP REQUIRED)
|
||||
target_link_libraries(lammps PRIVATE QUIP::QUIP ${LAPACK_LIBRARIES})
|
|
@ -1,65 +0,0 @@
|
|||
enable_language(Fortran)
|
||||
enable_language(C)
|
||||
|
||||
find_package(GSL REQUIRED)
|
||||
find_package(PkgConfig QUIET)
|
||||
find_package(MPI REQUIRED)
|
||||
set(DOWNLOAD_SCAFACOS_DEFAULT ON)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(SCAFACOS QUIET scafacos)
|
||||
if(SCAFACOS_FOUND)
|
||||
set(DOWNLOAD_SCAFACOS_DEFAULT OFF)
|
||||
endif()
|
||||
endif()
|
||||
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
|
||||
if(DOWNLOAD_SCAFACOS)
|
||||
message(STATUS "ScaFaCoS download requested - we will build our own")
|
||||
|
||||
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
||||
file(DOWNLOAD https://download.lammps.org/thirdparty/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
EXPECTED_HASH MD5=4baa1333bb28fcce102d505e1992d032)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(scafacos_build
|
||||
URL https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz
|
||||
URL_MD5 bd46d74e3296bd8a444d731bb10c1738
|
||||
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
||||
--enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m
|
||||
--with-internal-fftw --with-internal-pfft
|
||||
--with-internal-pnfft ${CONFIGURE_REQUEST_PIC}
|
||||
FC=${CMAKE_MPI_Fortran_COMPILER}
|
||||
CXX=${CMAKE_MPI_CXX_COMPILER}
|
||||
CC=${CMAKE_MPI_C_COMPILER}
|
||||
F77=
|
||||
BUILD_BYPRODUCTS
|
||||
<INSTALL_DIR>/lib/libfcs.a
|
||||
<INSTALL_DIR>/lib/libfcs_direct.a
|
||||
<INSTALL_DIR>/lib/libfcs_ewald.a
|
||||
<INSTALL_DIR>/lib/libfcs_fmm.a
|
||||
<INSTALL_DIR>/lib/libfcs_p2nfft.a
|
||||
<INSTALL_DIR>/lib/libfcs_p3m.a
|
||||
<INSTALL_DIR>/lib/libfcs_near.a
|
||||
<INSTALL_DIR>/lib/libfcs_gridsort.a
|
||||
<INSTALL_DIR>/lib/libfcs_resort.a
|
||||
<INSTALL_DIR>/lib/libfcs_redist.a
|
||||
<INSTALL_DIR>/lib/libfcs_common.a
|
||||
<INSTALL_DIR>/lib/libfcs_pnfft.a
|
||||
<INSTALL_DIR>/lib/libfcs_pfft.a
|
||||
<INSTALL_DIR>/lib/libfcs_fftw3_mpi.a
|
||||
<INSTALL_DIR>/lib/libfcs_fftw3.a
|
||||
)
|
||||
ExternalProject_get_property(scafacos_build INSTALL_DIR)
|
||||
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||
add_library(LAMMPS::SCAFACOS UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::SCAFACOS PROPERTIES
|
||||
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libfcs.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include"
|
||||
INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libfcs.a;${INSTALL_DIR}/lib/libfcs_direct.a;${INSTALL_DIR}/lib/libfcs_ewald.a;${INSTALL_DIR}/lib/libfcs_fmm.a;${INSTALL_DIR}/lib/libfcs_p2nfft.a;${INSTALL_DIR}/lib/libfcs_p3m.a;GSL::gsl;${INSTALL_DIR}/lib/libfcs_near.a;${INSTALL_DIR}/lib/libfcs_gridsort.a;${INSTALL_DIR}/lib/libfcs_resort.a;${INSTALL_DIR}/lib/libfcs_redist.a;${INSTALL_DIR}/lib/libfcs_common.a;${INSTALL_DIR}/lib/libfcs_pnfft.a;${INSTALL_DIR}/lib/libfcs_pfft.a;${INSTALL_DIR}/lib/libfcs_fftw3_mpi.a;${INSTALL_DIR}/lib/libfcs_fftw3.a;MPI::MPI_Fortran;MPI::MPI_C")
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::SCAFACOS)
|
||||
add_dependencies(LAMMPS::SCAFACOS scafacos_build)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SCAFACOS REQUIRED IMPORTED_TARGET scafacos)
|
||||
target_link_libraries(lammps PRIVATE PkgConfig::SCAFACOS)
|
||||
endif()
|
|
@ -1,13 +0,0 @@
|
|||
# Fix rigid/meso requires RIGID to be installed
|
||||
set(USER-SDPD_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-SDPD)
|
||||
|
||||
get_property(hlist GLOBAL PROPERTY FIX)
|
||||
if(NOT PKG_RIGID)
|
||||
list(REMOVE_ITEM hlist ${USER-SDPD_SOURCES_DIR}/fix_rigid_meso.h)
|
||||
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||
list(REMOVE_ITEM LAMMPS_SOURCES ${USER-SDPD_SOURCES_DIR}/fix_rigid_meso.cpp)
|
||||
set_property(TARGET lammps PROPERTY SOURCES ${LAMMPS_SOURCES})
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY FIX "${hlist}")
|
||||
|
||||
target_include_directories(lammps PRIVATE ${USER-SDPD_SOURCES_DIR})
|
|
@ -1,28 +0,0 @@
|
|||
find_package(Eigen3 NO_MODULE)
|
||||
if(EIGEN3_FOUND)
|
||||
set(DOWNLOAD_EIGEN3_DEFAULT OFF)
|
||||
else()
|
||||
set(DOWNLOAD_EIGEN3_DEFAULT ON)
|
||||
endif()
|
||||
option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT})
|
||||
if(DOWNLOAD_EIGEN3)
|
||||
message(STATUS "Eigen3 download requested - we will build our own")
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(Eigen3_build
|
||||
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
|
||||
URL_MD5 9e30f67e8531477de4117506fe44669b
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
)
|
||||
ExternalProject_get_property(Eigen3_build SOURCE_DIR)
|
||||
add_library(LAMMPS::EIGEN3 INTERFACE IMPORTED)
|
||||
set_target_properties(LAMMPS::EIGEN3 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}")
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::EIGEN3)
|
||||
add_dependencies(LAMMPS::EIGEN3 Eigen3_build)
|
||||
else()
|
||||
find_package(Eigen3 NO_MODULE)
|
||||
mark_as_advanced(Eigen3_DIR)
|
||||
if(NOT EIGEN3_FOUND)
|
||||
message(FATAL_ERROR "Eigen3 not found, help CMake to find it by setting EIGEN3_INCLUDE_DIR, or set DOWNLOAD_EIGEN3=ON to download it")
|
||||
endif()
|
||||
target_link_libraries(lammps PRIVATE Eigen3::Eigen)
|
||||
endif()
|
|
@ -7,6 +7,11 @@ endif()
|
|||
option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT})
|
||||
if(DOWNLOAD_VORO)
|
||||
message(STATUS "Voro++ download requested - we will build our own")
|
||||
set(VORO_URL "${LAMMPS_THIRDPARTY_URL}/voro++-0.4.6.tar.gz" CACHE STRING "URL for Voro++ tarball")
|
||||
set(VORO_MD5 "2338b824c3b7b25590e18e8df5d68af9" CACHE STRING "MD5 checksum for Voro++ tarball")
|
||||
mark_as_advanced(VORO_URL)
|
||||
mark_as_advanced(VORO_MD5)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
|
@ -21,9 +26,14 @@ if(DOWNLOAD_VORO)
|
|||
set(VORO_BUILD_OPTIONS CXX=${CMAKE_CXX_COMPILER} CFLAGS=${VORO_BUILD_CFLAGS})
|
||||
endif()
|
||||
|
||||
find_program(HAVE_PATCH patch)
|
||||
if(NOT HAVE_PATCH)
|
||||
message(FATAL_ERROR "The 'patch' program is required to build the voro++ library")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(voro_build
|
||||
URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz
|
||||
URL_MD5 2338b824c3b7b25590e18e8df5d68af9
|
||||
URL ${VORO_URL}
|
||||
URL_MD5 ${VORO_MD5}
|
||||
PATCH_COMMAND patch -b -p0 < ${LAMMPS_LIB_SOURCE_DIR}/voronoi/voro-make.patch
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND make ${VORO_BUILD_OPTIONS}
|
||||
|
|
|
@ -9,7 +9,7 @@ function(prevent_in_source_builds)
|
|||
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
|
||||
|
||||
# disallow in-source builds
|
||||
if("${srcdir}" STREQUAL "${bindir}" OR "${srcdir2}" STREQUAL "${bindir}" OR "${srcdir3}" STREQUAL "${bindir}")
|
||||
if(("${srcdir}" STREQUAL "${bindir}") OR ("${srcdir2}" STREQUAL "${bindir}") OR ("${srcdir3}" STREQUAL "${bindir}"))
|
||||
message(FATAL_ERROR "\
|
||||
|
||||
CMake must not to be run in the source directory. \
|
||||
|
|
|
@ -16,11 +16,14 @@ if(ENABLE_TESTING)
|
|||
set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command")
|
||||
set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options")
|
||||
|
||||
# check if a faster linker is available.
|
||||
# only verified with GNU and Clang compilers and new CMake
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||
# 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.
|
||||
# also only verified with Fedora Linux > 30 and Ubuntu <= 18.04 (Ubuntu 20.04 fails)
|
||||
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")))
|
||||
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND (CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04))
|
||||
OR ((CMAKE_LINUX_DISTRO STREQUAL "Fedora") AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30)))
|
||||
include(CheckCXXCompilerFlag)
|
||||
set(CMAKE_CUSTOM_LINKER_DEFAULT default)
|
||||
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
|
||||
|
@ -53,3 +56,76 @@ if(ENABLE_TESTING)
|
|||
get_filename_component(LAMMPS_UNITTEST_BIN ${CMAKE_BINARY_DIR}/unittest ABSOLUTE)
|
||||
add_subdirectory(${LAMMPS_UNITTEST_DIR} ${LAMMPS_UNITTEST_BIN})
|
||||
endif()
|
||||
|
||||
# Compiler specific features for testing
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
||||
mark_as_advanced(ENABLE_COVERAGE)
|
||||
if(ENABLE_COVERAGE)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(lammps PUBLIC --coverage)
|
||||
target_link_options(lammps PUBLIC --coverage)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#######################################
|
||||
# add custom target for IWYU analysis
|
||||
#######################################
|
||||
set(ENABLE_IWYU OFF CACHE BOOL "Add 'iwyu' build target to call the include-what-you-use tool")
|
||||
mark_as_advanced(ENABLE_IWYU)
|
||||
if(ENABLE_IWYU)
|
||||
# enforce these settings
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable reporting compilation commands to compile_commands.json" FORCE)
|
||||
if(NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
|
||||
message(FATAL_ERROR "IWYU is only supported with Clang or GNU compilers")
|
||||
endif()
|
||||
# detect the "native" header folder so we can include them first
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --print-search-dirs OUTPUT_VARIABLE IWYU_SEARCH_PATHS)
|
||||
string(REGEX REPLACE ".*libraries: *=([^:]+):.*" "\\1/include" IWYU_EXTRA_INCLUDE_DIR ${IWYU_SEARCH_PATHS})
|
||||
find_program(IWYU_EXE NAMES include-what-you-use iwyu)
|
||||
find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py)
|
||||
if(IWYU_EXE AND IWYU_TOOL)
|
||||
add_custom_target(
|
||||
iwyu
|
||||
${IWYU_TOOL} -o clang -p ${CMAKE_CURRENT_BINARY_DIR} -- -I${IWYU_EXTRA_INCLUDE_DIR} -Xiwyu --mapping_file=${CMAKE_CURRENT_SOURCE_DIR}/iwyu/iwyu-extra-map.imp
|
||||
COMMENT "Running IWYU")
|
||||
add_dependencies(iwyu lammps)
|
||||
else()
|
||||
message(FATAL_ERROR "To use IWYU you need the include-what-you-use/iwyu executable"
|
||||
"and the iwyu-tool/iwyu_tool script installed in your PATH")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#######################################
|
||||
# select code sanitizer options
|
||||
#######################################
|
||||
set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)")
|
||||
mark_as_advanced(ENABLE_SANITIZER)
|
||||
set(ENABLE_SANITIZER_VALUES none address leak thread undefined)
|
||||
set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${ENABLE_SANITIZER_VALUES})
|
||||
validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
|
||||
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
||||
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
||||
set(ENABLE_SANITIZER "none")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -9,21 +9,25 @@ if(BUILD_TOOLS)
|
|||
check_language(Fortran)
|
||||
if(CMAKE_Fortran_COMPILER)
|
||||
enable_language(Fortran)
|
||||
add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f)
|
||||
add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f90)
|
||||
target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||
install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
add_executable(micelle2d.x ${LAMMPS_TOOLS_DIR}/micelle2d.f90)
|
||||
target_link_libraries(micelle2d.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||
install(TARGETS chain.x micelle2d.x DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
else()
|
||||
message(WARNING "No suitable Fortran compiler found, skipping build of 'chain.x'")
|
||||
message(WARNING "No suitable Fortran compiler found, skipping build of 'chain.x' and 'micelle2d.x'")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "CMake build doesn't support fortran, skipping build of 'chain.x'")
|
||||
message(WARNING "CMake build doesn't support Fortran, skipping build of 'chain.x' and 'micelle2d.x'")
|
||||
endif()
|
||||
|
||||
enable_language(C)
|
||||
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
||||
file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
||||
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
||||
target_link_libraries(msi2lmp PRIVATE ${MATH_LIBRARIES})
|
||||
if(STANDARD_MATH_LIB)
|
||||
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
||||
endif()
|
||||
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
endif()
|
||||
|
@ -45,7 +49,7 @@ if(BUILD_LAMMPS_SHELL)
|
|||
target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell)
|
||||
|
||||
# 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)
|
||||
endif()
|
||||
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
message(STATUS "Downloading and building YAML library")
|
||||
|
||||
include(ExternalProject)
|
||||
set(YAML_URL "https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz" CACHE STRING "URL for libyaml tarball")
|
||||
mark_as_advanced(YAML_URL)
|
||||
ExternalProject_Add(libyaml
|
||||
URL ${YAML_URL}
|
||||
URL_MD5 bb15429d8fb787e7d3f1c83ae129a999
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/yaml-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/yaml-build"
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure ${CONFIGURE_REQUEST_PIC}
|
||||
CXX=${CMAKE_CXX_COMPILER}
|
||||
CC=${CMAKE_C_COMPILER}
|
||||
--prefix=<INSTALL_DIR> --disable-shared
|
||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libyaml${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
TEST_COMMAND "")
|
||||
|
||||
ExternalProject_Get_Property(libyaml INSTALL_DIR)
|
||||
set(YAML_INCLUDE_DIR ${INSTALL_DIR}/include)
|
||||
set(YAML_LIBRARY_DIR ${INSTALL_DIR}/lib)
|
||||
|
||||
# workaround for CMake 3.10 on ubuntu 18.04
|
||||
file(MAKE_DIRECTORY ${YAML_INCLUDE_DIR})
|
||||
file(MAKE_DIRECTORY ${YAML_LIBRARY_DIR})
|
||||
|
||||
set(YAML_LIBRARY_PATH ${INSTALL_DIR}/lib/libyaml${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
|
||||
add_library(Yaml::Yaml UNKNOWN IMPORTED)
|
||||
set_target_properties(Yaml::Yaml PROPERTIES
|
||||
IMPORTED_LOCATION ${YAML_LIBRARY_PATH}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${YAML_INCLUDE_DIR})
|
||||
add_dependencies(Yaml::Yaml libyaml)
|
|
@ -17,17 +17,17 @@ if(GIT_FOUND AND EXISTS ${LAMMPS_DIR}/.git)
|
|||
ERROR_QUIET
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified --always
|
||||
OUTPUT_VARIABLE temp_git_describe
|
||||
ERROR_QUIET
|
||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
|
||||
set(temp "${temp}const bool LAMMPS_NS::LAMMPS::has_git_info = ${temp_git_info};\n")
|
||||
set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_commit[] = \"${temp_git_commit}\";\n")
|
||||
set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_branch[] = \"${temp_git_branch}\";\n")
|
||||
set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_descriptor[] = \"${temp_git_describe}\";\n")
|
||||
set(temp "${temp}bool LAMMPS_NS::LAMMPS::has_git_info() { return ${temp_git_info}; }\n")
|
||||
set(temp "${temp}const char *LAMMPS_NS::LAMMPS::git_commit() { return \"${temp_git_commit}\"; }\n")
|
||||
set(temp "${temp}const char *LAMMPS_NS::LAMMPS::git_branch() { return \"${temp_git_branch}\"; }\n")
|
||||
set(temp "${temp}const char *LAMMPS_NS::LAMMPS::git_descriptor() { return \"${temp_git_describe}\"; }\n")
|
||||
set(temp "${temp}#endif\n\n")
|
||||
|
||||
message(STATUS "Generating lmpgitversion.h...")
|
||||
|
|
|
@ -1,7 +1,33 @@
|
|||
[
|
||||
{ include: [ "<bits/types/struct_rusage.h>", private, "<sys/resource.h>", public ] },
|
||||
{ include: [ "<bits/exception.h>", public, "<exception>", public ] },
|
||||
{ include: [ "@<Eigen/.*>", private, "<Eigen/Eigen>", public ] },
|
||||
{ include: [ "@<gtest/.*>", private, "\"gtest/gtest.h\"", public ] },
|
||||
{ include: [ "@<gmock/.*>", private, "\"gmock/gmock.h\"", public ] },
|
||||
{ include: [ "@<gmock/.*>", private, "\"gmock/gmock.h\"", public ] },
|
||||
{ include: [ "@<(cell|c_loops|container).hh>", private, "<voro++.hh>", public ] },
|
||||
{ include: [ "@\"atom_vec_.*.h\"", public, "\"style_atom.h\"", public ] },
|
||||
{ include: [ "@\"body_.*.h\"", public, "\"style_body.h\"", public ] },
|
||||
{ include: [ "@\"compute_.*.h\"", public, "\"style_compute.h\"", public ] },
|
||||
{ include: [ "@\"fix_.*.h\"", public, "\"style_fix.h\"", public ] },
|
||||
{ include: [ "@\"dump_.*.h\"", public, "\"style_dump.h\"", public ] },
|
||||
{ include: [ "@\"min_.*.h\"", public, "\"style_minimize.h\"", public ] },
|
||||
{ include: [ "@\"reader_.*.h\"", public, "\"style_reader.h\"", public ] },
|
||||
{ include: [ "@\"region_.*.h\"", public, "\"style_region.h\"", public ] },
|
||||
{ include: [ "@\"pair_.*.h\"", public, "\"style_pair.h\"", public ] },
|
||||
{ include: [ "@\"angle_.*.h\"", public, "\"style_angle.h\"", public ] },
|
||||
{ include: [ "@\"bond_.*.h\"", public, "\"style_bond.h\"", public ] },
|
||||
{ include: [ "@\"dihedral_.*.h\"", public, "\"style_dihedral.h\"", public ] },
|
||||
{ include: [ "@\"improper_.*.h\"", public, "\"style_improper.h\"", public ] },
|
||||
{ include: [ "@\"kspace_.*.h\"", public, "\"style_kspace.h\"", public ] },
|
||||
{ include: [ "@\"nbin_.*.h\"", public, "\"style_nbin.h\"", public ] },
|
||||
{ include: [ "@\"npair_.*.h\"", public, "\"style_npair.h\"", public ] },
|
||||
{ include: [ "@\"nstencil_.*.h\"", public, "\"style_nstencil.h\"", public ] },
|
||||
{ include: [ "@\"ntopo_.*.h\"", public, "\"style_ntopo.h\"", public ] },
|
||||
{ include: [ "\"fmt/core.h\"", private, "\"fmt/format.h\"", public ] },
|
||||
{ include: [ "<float.h>", public, "<cfloat>", public ] },
|
||||
{ include: [ "\"float.h\"", public, "<cfloat>", public ] },
|
||||
{ include: [ "<limits.h>", public, "<climits>", public ] },
|
||||
{ include: [ "\"limits.h\"", public, "<climits>", public ] },
|
||||
{ include: [ "<stdio.h>", public, "<cstdio>", public ] },
|
||||
{ include: [ "<bits/types/struct_rusage.h>", private, "<sys/types.h>", public ] },
|
||||
{ include: [ "<bits/types/struct_tm.h>", private, "<ctime>", public ] },
|
||||
]
|
||||
|
|
|
@ -24,7 +24,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|||
|
||||
Name: liblammps@LAMMPS_MACHINE@
|
||||
Description: Large-scale Atomic/Molecular Massively Parallel Simulator Library
|
||||
URL: http://lammps.sandia.gov
|
||||
URL: https://www.lammps.org
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires:
|
||||
Libs: -L${libdir} -llammps@LAMMPS_MACHINE@
|
||||
|
|
|
@ -1,17 +1,96 @@
|
|||
# preset that turns on all existing packages off. can be used to reset
|
||||
# Preset that turns on all existing packages off. Can be used to reset
|
||||
# an existing package selection without losing any other settings
|
||||
|
||||
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
|
||||
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MESSAGE MLIAP
|
||||
MOLECULE MPIIO MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK
|
||||
SNAP SPIN SRD VORONOI
|
||||
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK
|
||||
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
|
||||
USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESODPD
|
||||
USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP
|
||||
USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP
|
||||
USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ
|
||||
USER-SPH USER-TALLY USER-UEF USER-VTK USER-YAFF)
|
||||
set(ALL_PACKAGES
|
||||
ADIOS
|
||||
ASPHERE
|
||||
ATC
|
||||
AWPMD
|
||||
BOCS
|
||||
BODY
|
||||
BPM
|
||||
BROWNIAN
|
||||
CG-DNA
|
||||
CG-SDK
|
||||
CLASS2
|
||||
COLLOID
|
||||
COLVARS
|
||||
COMPRESS
|
||||
CORESHELL
|
||||
DIELECTRIC
|
||||
DIFFRACTION
|
||||
DIPOLE
|
||||
DPD-BASIC
|
||||
DPD-MESO
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
EXTRA-FIX
|
||||
EXTRA-MOLECULE
|
||||
EXTRA-PAIR
|
||||
FEP
|
||||
GPU
|
||||
GRANULAR
|
||||
H5MD
|
||||
INTEL
|
||||
INTERLAYER
|
||||
KIM
|
||||
KOKKOS
|
||||
KSPACE
|
||||
LATBOLTZ
|
||||
LATTE
|
||||
MACHDYN
|
||||
MANIFOLD
|
||||
MANYBODY
|
||||
MC
|
||||
MDI
|
||||
MEAM
|
||||
MESONT
|
||||
MGPT
|
||||
MISC
|
||||
ML-HDNNP
|
||||
ML-IAP
|
||||
ML-PACE
|
||||
ML-QUIP
|
||||
ML-RANN
|
||||
ML-SNAP
|
||||
MOFFF
|
||||
MOLECULE
|
||||
MOLFILE
|
||||
MPIIO
|
||||
MSCG
|
||||
NETCDF
|
||||
OPENMP
|
||||
OPT
|
||||
ORIENT
|
||||
PERI
|
||||
PHONON
|
||||
PLUGIN
|
||||
PLUMED
|
||||
POEMS
|
||||
PTM
|
||||
PYTHON
|
||||
QEQ
|
||||
QMMM
|
||||
QTB
|
||||
REACTION
|
||||
REAXFF
|
||||
REPLICA
|
||||
RIGID
|
||||
SCAFACOS
|
||||
SHOCK
|
||||
SMTBQ
|
||||
SPH
|
||||
SPIN
|
||||
SRD
|
||||
TALLY
|
||||
UEF
|
||||
VORONOI
|
||||
VTK
|
||||
YAFF)
|
||||
|
||||
foreach(PKG ${ALL_PACKAGES})
|
||||
set(PKG_${PKG} OFF CACHE BOOL "" FORCE)
|
||||
|
|
|
@ -1,19 +1,98 @@
|
|||
# preset that turns on all existing packages. using the combination
|
||||
# this preset followed by the nolib.cmake preset should configure a
|
||||
# LAMMPS binary, with as many packages included, that can be compiled
|
||||
# Preset that turns on all existing packages. Using the combination
|
||||
# of this preset followed by the nolib.cmake preset should configure
|
||||
# a LAMMPS binary, with as many packages included, that can be compiled
|
||||
# with just a working C++ compiler and an MPI library.
|
||||
|
||||
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
|
||||
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MESSAGE MLIAP
|
||||
MOLECULE MPIIO MSCG OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK
|
||||
SNAP SPIN SRD VORONOI
|
||||
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK
|
||||
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
|
||||
USER-H5MD USER-INTEL USER-LB USER-MANIFOLD USER-MEAMC USER-MESODPD
|
||||
USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-OMP
|
||||
USER-PHONON USER-PLUMED USER-PTM USER-QMMM USER-QTB USER-QUIP
|
||||
USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ
|
||||
USER-SPH USER-TALLY USER-UEF USER-VTK USER-YAFF)
|
||||
set(ALL_PACKAGES
|
||||
ADIOS
|
||||
ASPHERE
|
||||
ATC
|
||||
AWPMD
|
||||
BOCS
|
||||
BODY
|
||||
BPM
|
||||
BROWNIAN
|
||||
CG-DNA
|
||||
CG-SDK
|
||||
CLASS2
|
||||
COLLOID
|
||||
COLVARS
|
||||
COMPRESS
|
||||
CORESHELL
|
||||
DIELECTRIC
|
||||
DIFFRACTION
|
||||
DIPOLE
|
||||
DPD-BASIC
|
||||
DPD-MESO
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
EXTRA-FIX
|
||||
EXTRA-MOLECULE
|
||||
EXTRA-PAIR
|
||||
FEP
|
||||
GPU
|
||||
GRANULAR
|
||||
H5MD
|
||||
INTEL
|
||||
INTERLAYER
|
||||
KIM
|
||||
KOKKOS
|
||||
KSPACE
|
||||
LATBOLTZ
|
||||
LATTE
|
||||
MACHDYN
|
||||
MANIFOLD
|
||||
MANYBODY
|
||||
MC
|
||||
MDI
|
||||
MEAM
|
||||
MESONT
|
||||
MGPT
|
||||
MISC
|
||||
ML-HDNNP
|
||||
ML-IAP
|
||||
ML-PACE
|
||||
ML-QUIP
|
||||
ML-RANN
|
||||
ML-SNAP
|
||||
MOFFF
|
||||
MOLECULE
|
||||
MOLFILE
|
||||
MPIIO
|
||||
MSCG
|
||||
NETCDF
|
||||
OPENMP
|
||||
OPT
|
||||
ORIENT
|
||||
PERI
|
||||
PHONON
|
||||
PLUGIN
|
||||
PLUMED
|
||||
POEMS
|
||||
PTM
|
||||
PYTHON
|
||||
QEQ
|
||||
QMMM
|
||||
QTB
|
||||
REACTION
|
||||
REAXFF
|
||||
REPLICA
|
||||
RIGID
|
||||
SCAFACOS
|
||||
SHOCK
|
||||
SMTBQ
|
||||
SPH
|
||||
SPIN
|
||||
SRD
|
||||
TALLY
|
||||
UEF
|
||||
VORONOI
|
||||
VTK
|
||||
YAFF)
|
||||
|
||||
foreach(PKG ${ALL_PACKAGES})
|
||||
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes)
|
||||
|
||||
# prefer flang over gfortran, if available
|
||||
find_program(CLANG_FORTRAN NAMES flang gfortran f95)
|
||||
set(ENV{OMPI_FC} ${CLANG_FORTRAN})
|
||||
|
||||
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER ${CLANG_FORTRAN} CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
|
||||
set(MPI_CXX "clang++" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(OpenMP_C "clang" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# preset that turns on packages with automatic downloads of sources of potentials
|
||||
# compilation of libraries like Plumed or ScaFaCoS can take a considerable amount of time.
|
||||
# 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.
|
||||
|
||||
set(ALL_PACKAGES KIM LATTE MSCG VORONOI USER-PLUMED USER-SCAFACOS USER-SMD USER-MESONT)
|
||||
set(ALL_PACKAGES KIM LATTE MSCG VORONOI PLUMED SCAFACOS MACHDYN MESONT MDI ML-PACE)
|
||||
|
||||
foreach(PKG ${ALL_PACKAGES})
|
||||
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
||||
|
@ -9,9 +9,11 @@ endforeach()
|
|||
|
||||
set(DOWNLOAD_KIM ON CACHE BOOL "" FORCE)
|
||||
set(DOWNLOAD_LATTE ON CACHE BOOL "" FORCE)
|
||||
set(DOWNLOAD_MDI ON CACHE BOOL "" FORCE)
|
||||
set(DOWNLOAD_MSCG ON CACHE BOOL "" FORCE)
|
||||
set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
|
||||
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
|
||||
set(DOWNLOAD_PACE ON CACHE BOOL "" FORCE)
|
||||
set(DOWNLOAD_PLUMED ON CACHE BOOL "" FORCE)
|
||||
set(DOWNLOAD_SCAFACOS ON CACHE BOOL "" FORCE)
|
||||
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
# preset that will restore gcc/g++ with support for MPI and OpenMP (on Linux boxes)
|
||||
# preset that will explicitly request gcc/g++ compilers with support for MPI and OpenMP
|
||||
|
||||
set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "gcc" 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_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Og -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX "g++" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
set(MPI_C "gcc" CACHE STRING "" FORCE)
|
||||
set(MPI_C_COMPILER "mpicc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Og -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(MPI_Fortran "gfortran" CACHE STRING "" FORCE)
|
||||
set(MPI_Fortran_COMPILER "mpifort" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Og -g -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
|
||||
set(OpenMP_C "gcc" CACHE STRING "" FORCE)
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
# preset that will enable hipcc plus gcc with support for MPI and OpenMP (on Linux boxes)
|
||||
# preset that will enable hipcc plus gcc/gfortran with support for MPI and OpenMP (on Linux boxes)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "hipcc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER gfortran CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
|
||||
set(OpenMP_CXX "hipcc" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX "hipcc" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(OpenMP_C "gcc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "gomp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX "hipcc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# preset that will enable hip (clang/clang++) with support for MPI and OpenMP (on Linux boxes)
|
||||
|
||||
# prefer flang over gfortran, if available
|
||||
find_program(CLANG_FORTRAN NAMES flang gfortran f95)
|
||||
set(ENV{OMPI_FC} ${CLANG_FORTRAN})
|
||||
|
||||
set(CMAKE_CXX_COMPILER "hipcc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "hipcc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER ${CLANG_FORTRAN} CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
|
||||
set(MPI_CXX "hipcc" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(OpenMP_C "hipcc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX "hipcc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)
|
|
@ -3,10 +3,20 @@
|
|||
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER "ifort" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
|
||||
set(MPI_CXX "icpc" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_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_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
|
|
|
@ -5,7 +5,5 @@ set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
|||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_PASCAL60 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)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# preset that enables KOKKOS and selects SYCL compilation with OpenMP
|
||||
# enabled as well. Also sets some performance related compiler flags.
|
||||
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ENABLE_SYCL ON CACHE BOOL "" FORCE)
|
||||
set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE)
|
||||
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||
|
||||
set(CMAKE_CXX_COMPILER clang++ CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Xsycl-target-frontend -O3" CACHE STRING "" FORCE)
|
||||
set(CMAKE_TUNE_FLAGS "-fgpu-inline-threshold=100000 -Xsycl-target-frontend -O3 -Xsycl-target-frontend -ffp-contract=on -Wno-unknown-cuda-version" CACHE STRING "" FORCE)
|
|
@ -1,13 +1,77 @@
|
|||
set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
|
||||
GRANULAR KSPACE LATTE MANYBODY MC MISC MLIAP MOLECULE OPT
|
||||
PERI POEMS QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
|
||||
USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK
|
||||
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF
|
||||
USER-FEP USER-INTEL USER-MANIFOLD USER-MEAMC USER-MESODPD
|
||||
USER-MESONT USER-MISC USER-MGPT USER-MOFFF USER-MOLFILE USER-OMP
|
||||
USER-PHONON USER-PTM USER-QTB USER-REACTION USER-REAXC
|
||||
USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF
|
||||
USER-YAFF)
|
||||
set(WIN_PACKAGES
|
||||
ASPHERE
|
||||
ATC
|
||||
AWPMD
|
||||
BOCS
|
||||
BODY
|
||||
BPM
|
||||
BROWNIAN
|
||||
CG-DNA
|
||||
CG-SDK
|
||||
CLASS2
|
||||
COLLOID
|
||||
COLVARS
|
||||
COMPRESS
|
||||
CORESHELL
|
||||
DIELECTRIC
|
||||
DIFFRACTION
|
||||
DIPOLE
|
||||
DPD-BASIC
|
||||
DPD-MESO
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
EXTRA-FIX
|
||||
EXTRA-MOLECULE
|
||||
EXTRA-PAIR
|
||||
FEP
|
||||
GPU
|
||||
GRANULAR
|
||||
INTEL
|
||||
INTERLAYER
|
||||
KSPACE
|
||||
LATTE
|
||||
MACHDYN
|
||||
MANIFOLD
|
||||
MANYBODY
|
||||
MC
|
||||
MDI
|
||||
MEAM
|
||||
MESONT
|
||||
MGPT
|
||||
MISC
|
||||
ML-HDNNP
|
||||
ML-IAP
|
||||
ML-SNAP
|
||||
ML-RANN
|
||||
MOFFF
|
||||
MOLECULE
|
||||
MOLFILE
|
||||
OPENMP
|
||||
OPT
|
||||
ORIENT
|
||||
PERI
|
||||
PHONON
|
||||
POEMS
|
||||
PTM
|
||||
QEQ
|
||||
QTB
|
||||
REACTION
|
||||
REAXFF
|
||||
REPLICA
|
||||
RIGID
|
||||
SHOCK
|
||||
SMTBQ
|
||||
SPH
|
||||
SPIN
|
||||
SRD
|
||||
TALLY
|
||||
UEF
|
||||
VORONOI
|
||||
YAFF)
|
||||
|
||||
foreach(PKG ${WIN_PACKAGES})
|
||||
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
||||
|
@ -16,7 +80,7 @@ endforeach()
|
|||
# these two packages require a full MPI implementation
|
||||
if(BUILD_MPI)
|
||||
set(PKG_MPIIO ON CACHE BOOL "" FORCE)
|
||||
set(PKG_USER-LB ON CACHE BOOL "" FORCE)
|
||||
set(PKG_LATBOLTZ ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
|
||||
|
|
|
@ -2,13 +2,66 @@
|
|||
# external libraries. Compared to all_on.cmake some more unusual packages
|
||||
# are removed. The resulting binary should be able to run most inputs.
|
||||
|
||||
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
|
||||
GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI
|
||||
POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
|
||||
USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
||||
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-MESODPD
|
||||
USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION
|
||||
USER-REAXC USER-SDPD USER-SPH USER-SMD USER-UEF USER-YAFF)
|
||||
set(ALL_PACKAGES
|
||||
ASPHERE
|
||||
BOCS
|
||||
BODY
|
||||
BPM
|
||||
BROWNIAN
|
||||
CG-DNA
|
||||
CG-SDK
|
||||
CLASS2
|
||||
COLLOID
|
||||
COLVARS
|
||||
COMPRESS
|
||||
CORESHELL
|
||||
DIELECTRIC
|
||||
DIFFRACTION
|
||||
DIPOLE
|
||||
DPD-BASIC
|
||||
DPD-MESO
|
||||
DPD-REACT
|
||||
DPD-SMOOTH
|
||||
DRUDE
|
||||
EFF
|
||||
EXTRA-COMPUTE
|
||||
EXTRA-DUMP
|
||||
EXTRA-FIX
|
||||
EXTRA-MOLECULE
|
||||
EXTRA-PAIR
|
||||
FEP
|
||||
GRANULAR
|
||||
INTERLAYER
|
||||
KSPACE
|
||||
MACHDYN
|
||||
MANYBODY
|
||||
MC
|
||||
MEAM
|
||||
MISC
|
||||
ML-IAP
|
||||
ML-SNAP
|
||||
MOFFF
|
||||
MOLECULE
|
||||
OPENMP
|
||||
OPT
|
||||
ORIENT
|
||||
PERI
|
||||
PHONON
|
||||
PLUGIN
|
||||
POEMS
|
||||
QEQ
|
||||
REACTION
|
||||
REAXFF
|
||||
REPLICA
|
||||
RIGID
|
||||
SHOCK
|
||||
SPH
|
||||
SPIN
|
||||
SRD
|
||||
TALLY
|
||||
UEF
|
||||
VORONOI
|
||||
YAFF)
|
||||
|
||||
foreach(PKG ${ALL_PACKAGES})
|
||||
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
||||
|
|
|
@ -1,10 +1,33 @@
|
|||
# preset that turns off all packages that require some form of external
|
||||
# library or special compiler (fortran or cuda) or equivalent.
|
||||
|
||||
set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MPIIO MSCG PYTHON
|
||||
VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-H5MD USER-LB
|
||||
USER-MOLFILE USER-MESONT USER-NETCDF USER-PLUMED USER-QMMM USER-QUIP
|
||||
USER-SCAFACOS USER-SMD USER-VTK)
|
||||
set(PACKAGES_WITH_LIB
|
||||
ADIOS
|
||||
ATC
|
||||
AWPMD
|
||||
COMPRESS
|
||||
GPU
|
||||
H5MD
|
||||
KIM
|
||||
KOKKOS
|
||||
LATBOLTZ
|
||||
LATTE
|
||||
MACHDYN
|
||||
MDI
|
||||
MESONT
|
||||
ML-HDNNP
|
||||
ML-PACE
|
||||
ML-QUIP
|
||||
MOLFILE
|
||||
MPIIO
|
||||
MSCG
|
||||
NETCDF
|
||||
PLUMED
|
||||
PYTHON
|
||||
QMMM
|
||||
SCAFACOS
|
||||
VORONOI
|
||||
VTK)
|
||||
|
||||
foreach(PKG ${PACKAGES_WITH_LIB})
|
||||
set(PKG_${PKG} OFF CACHE BOOL "" FORCE)
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# preset that will enable the LLVM based Intel compilers with support for MPI and OpenMP and Fortran (on Linux boxes)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "icpx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "icx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER "ifx" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
|
||||
set(MPI_CXX "icpx" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
set(OpenMP_C "icx" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX "icpx" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# preset that will restore gcc/g++ with support for MPI and OpenMP (on Linux boxes)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -Werror=vla -Wno-maybe-uninitialized -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -Werror=vla -Wno-maybe-uninitialized -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX "g++" CACHE STRING "" FORCE)
|
||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||
set(MPI_C "gcc" CACHE STRING "" FORCE)
|
||||
set(MPI_C_COMPILER "mpicc" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -Wno-maybe-uninitialized -g" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -Wno-maybe-uninitialized -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Wall -O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||
set(MPI_Fortran "gfortran" CACHE STRING "" FORCE)
|
||||
set(MPI_Fortran_COMPILER "mpifort" CACHE STRING "" FORCE)
|
||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||
|
||||
set(OpenMP_C "gcc" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_C_LIB_NAMES "gomp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX "g++" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_CXX_LIB_NAMES "gomp" CACHE STRING "" FORCE)
|
||||
set(OpenMP_omp_LIBRARY "libgomp.so" CACHE PATH "" FORCE)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue