diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b91e58a83f..7d1f1a417b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -17,6 +17,7 @@ src/GPU/* @ndtrung81 src/KOKKOS/* @stanmoore1 src/KIM/* @ellio167 src/LATTE/* @cnegre +src/MESSAGE/* @sjplimp src/SPIN/* @julient31 src/USER-CGDNA/* @ohenrich src/USER-CGSDK/* @akohlmey @@ -28,20 +29,88 @@ src/USER-MEAMC/* @martok 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 + # 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-MISC/fix_bond_react.* @jrgissing src/USER-MISC/*_grem.* @dstelter92 +src/USER-MISC/compute_stress_mop*.* @RomainVermorel + +# core LAMMPS classes +src/lammps.* @sjplimp +src/pointers.h @sjplimp +src/atom.* @sjplimp +src/atom_vec.* @sjplimp +src/angle.* @sjplimp +src/bond.* @sjplimp +src/comm*.* @sjplimp +src/compute.* @sjplimp +src/dihedral.* @sjplimp +src/domain.* @sjplimp +src/dump*.* @sjplimp +src/error.* @sjplimp +src/finish.* @sjplimp +src/fix.* @sjplimp +src/force.* @sjplimp +src/group.* @sjplimp +src/improper.* @sjplimp +src/kspace.* @sjplimp +src/lmptyp.h @sjplimp +src/library.* @sjplimp +src/main.cpp @sjplimp +src/memory.* @sjplimp +src/modify.* @sjplimp +src/molecule.* @sjplimp +src/my_page.h @sjplimp +src/my_pool_chunk.h @sjplimp +src/npair*.* @sjplimp +src/ntopo*.* @sjplimp +src/nstencil*.* @sjplimp +src/neighbor.* @sjplimp +src/nbin*.* @sjplimp +src/neigh_*.* @sjplimp +src/output.* @sjplimp +src/pair.* @sjplimp +src/rcb.* @sjplimp +src/random_*.* @sjplimp +src/region*.* @sjplimp +src/rcb.* @sjplimp +src/read*.* @sjplimp +src/rerun.* @sjplimp +src/run.* @sjplimp +src/respa.* @sjplimp +src/set.* @sjplimp +src/special.* @sjplimp +src/suffix.h @sjplimp +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 + +# overrides for specific files +src/dump_movie.* @akohlmey +src/exceptions.h @rbberger +src/fix_nh.* @athomps +src/info.* @akohlmey @rbberger +src/timer.* @akohlmey # tools tools/msi2lmp/* @akohlmey @@ -57,3 +126,6 @@ python/* @rbberger doc/utils/*/* @rbberger doc/Makefile @rbberger doc/README @rbberger + +# for releases +src/version.h @sjplimp diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..0e681c280d --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,67 @@ +# Code of Conduct for the LAMMPS Project on GitHub + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as LAMMPS +developers, contributors, and maintainers pledge to making participation in +our project a harassment-free experience for everyone. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of explicit language or imagery +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, issues, and other contributions that are not +aligned to this Code of Conduct, or to ban temporarily or permanently any +developer, maintainer, or contributor for this or other behaviors that they +deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies to all public exchanges in the LAMMPS project +on GitHub and in submitted code. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at developer@lammps.org. All +complaints will be reviewed and investigated and will result in a response +that is deemed necessary and appropriate to the circumstances. The project +team is obligated to maintain confidentiality with regard to the reporter +of an incident. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq + diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index beba468ea0..5a67c547df 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,11 +2,11 @@ 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 workflows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project. +The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project. Thus please also have a look at: -* [The Section on submitting new features for inclusion in LAMMPS of the Manual](http://lammps.sandia.gov/doc/Section_modify.html#mod-15) -* [The LAMMPS GitHub Tutorial in the Manual](http://lammps.sandia.gov/doc/tutorial_github.html) +* [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) ## Table of Contents @@ -18,7 +18,7 @@ Thus please also have a look at: * [Suggesting Enhancements](#suggesting-enhancements) * [Contributing Code](#contributing-code) -[GitHub Workflows](#github-workflows) +[GitHub Work flows](#github-workflows) * [Issues](#issues) * [Pull Requests](#pull-requests) @@ -26,17 +26,17 @@ __ ## 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](http://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](http://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 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. ## 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 -to one of the [LAMMPS core developers](http://lammps.sandia.gov/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers. +to one of the [LAMMPS core developers](https://lammps.sandia.gov/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers. ### Discussing How To Use LAMMPS The LAMMPS mailing list is hosted at SourceForge. The mailing list began in 2005, and now includes tens of thousands of messages in thousands of threads. LAMMPS developers try to respond to posted questions in a timely manner, but there are no guarantees. Please consider that people live in different timezone and may not have time to answer e-mails outside of their work hours. -You can post to list by sending your email to lammps-users at lists.sourceforge.net (no subscription required), but before posting, please read the [mailing list guidelines](http://lammps.sandia.gov/guidelines.html) to maximize your chances to receive a helpful response. +You can post to list by sending your email to lammps-users at lists.sourceforge.net (no subscription required), but before posting, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html) to maximize your chances to receive a helpful response. Anyone can browse/search previous questions/answers in the archives. You do not have to subscribe to the list to post questions, receive answers (to your questions), or browse/search the archives. You **do** need to subscribe to the list if you want emails for **all** the posts (as individual messages or in digest form), or to answer questions yourself. Feel free to sign up and help us out! Answering questions from fellow LAMMPS users is a great way to pay back the community for providing you a useful tool for free, and to pass on the advice you have received yourself to others. It improves your karma and helps you understand your own research better. @@ -44,7 +44,7 @@ If you post a message and you are a subscriber, your message will appear immedia ### 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](http://lammps.sandia.gov/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version. +While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://lammps.sandia.gov/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version. When you click on the green "New Issue" button, you will be provided with a text field, where you can enter your message. That text field with contain a template with several headlines and some descriptions. Keep the headlines that are relevant to your reported potential bug and replace the descriptions with the information as suggested by the descriptions. You can also attach small text files (please add the file name extension `.txt` or it will be rejected), images, or small compressed text files (using gzip, do not use RAR or 7-ZIP or similar tools that are uncommon outside of Windows machines). In many cases, bugs are best illustrated by providing a small input deck (do **not** attach your entire production input, but remove everything that is not required to reproduce the issue, and scale down your system size, that the resulting calculation runs fast and can be run on small desktop quickly). @@ -62,13 +62,13 @@ To be able to submit an issue on GitHub, you have to register for an account (fo We encourage users to submit new features or modifications for LAMMPS 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. -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](http://lammps.sandia.gov/doc/tutorial_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. * 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 lines over 80 characters. I/O is done via the C-style stdio library, class header files should not import any system headers outside , 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. Header files must not import namespaces with using. 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. +* 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 lines over 80 characters. I/O is done via the C-style stdio library, style class header files should not import any system headers outside of , 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 (.cpp) system includes should be placed in angular brackets (<>) and for c-library functions the C++ style header files should be included ( instead of , or instead of ). 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. * If you want your contribution to be added as a user-contributed feature, and it is a single file (actually a `.cpp` and `.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. @@ -102,11 +102,11 @@ For bug reports, the next step is that one of the core LAMMPS developers will se ### Pull Requests -For submitting pull requests, there is a [detailed tutorial](http://lammps.sandia.gov/doc/tutorial_github.html) in the LAMMPS manual. Thus only a brief breakdown of the steps is presented here. +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. -You may also receive comments and suggestions on the overall submission or specific details. If permitted, 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. +Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you are not yet registered as a LAMMPS collaborator, you will receive an invitation for that. As part of the assesment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit). +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 be assigned to the LAMMPS lead developer, Steve Plimpton (@sjplimp), who will then have the final decision on whether the submission will be included, additional changes are required or it will be ultimately rejected. After the pull request is merged, you may delete the pull request branch in your personal LAMMPS fork. -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 not set in stone. +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. +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 workflow may be adjusted. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 53a17a1476..0000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,31 +0,0 @@ -## Summary - -_Please provide a brief description of the issue_ - -## Type of Issue - -_Is this a 'Bug Report' or a 'Suggestion for an Enhancement'?_ - -## Detailed Description (Enhancement Suggestion) - -_Explain how you would like to see LAMMPS enhanced, what feature(s) you are looking for, provide references to relevant background information, and whether you are willing to implement the enhancement yourself or would like to participate in the implementation_ - -## LAMMPS Version (Bug Report) - -_Please specify which LAMMPS version this issue was detected with. If this is not the latest development version, please stop and test that version, too, and report it here if the bug persists_ - -## Expected Behavior (Bug Report) - -_Describe the expected behavior. Quote from the LAMMPS manual where needed or explain why the expected behavior is meaningful, especially when it differs from the manual_ - -## Actual Behavior (Bug Report) - -_Describe the actual behavior, how it differs from the expected behavior, and how this can be observed. Try to be specific and do **not* use vague terms like "doesn't work" or "wrong result". Do not assume that the person reading this has any experience with or knowledge of your specific research._ - -## Steps to Reproduce (Bug Report) - -_Describe the steps required to quickly reproduce the issue. You can attach (small) files to the section below or add URLs where to download an archive with all necessary files. Please try to create input that are as small as possible and run as fast as possible. NOTE: the less effort and time it takes to reproduce your issue, the more likely, that somebody will look into it._ - -## Further Information, Files, and Links - -_Put any additional information here, attach relevant text or image files and URLs to external sites, e.g. relevant publications_ diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..91b7e2bf48 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a bug report to help us eliminate issues and improve LAMMPS +title: "[BUG] _Replace With Suitable Title_" +labels: bug +assignees: '' + +--- + +**Summary** + +_Please provide a clear and concise description of what the bug is._ + +**LAMMPS Version and Platform** + +_Please specify precisely which LAMMPS version this issue was detected with (the first line of the output) and what platform (operating system and its version, hardware) you are running on. If possible, test with the most recent LAMMPS patch version_ + +**Expected Behavior** + +_Describe the expected behavior. Quote from the LAMMPS manual where needed, or explain why the expected behavior is meaningful, especially when it differs from the manual_ + +**Actual Behavior** + +_Describe the actual behavior, how it differs from the expected behavior, and how this can be observed. Try to be specific and do **not** use vague terms like "doesn't work" or "wrong result". Do not assume that the person reading this has any experience with or knowledge of your specific area of research._ + +**Steps to Reproduce** + +_Describe the steps required to (quickly) reproduce the issue. You can attach (small) files to the section below or add URLs where to download an archive with all necessary files. Please try to create an input set that is as minimal and small as possible and reproduces the bug as quickly as possible. **NOTE:** the less effort and time it takes to reproduce your reported bug, the more likely it becomes, that somebody will look into it and fix the problem._ + +**Further Information, Files, and Links** + +_Put any additional information here, attach relevant text or image files and URLs to external sites, e.g. relevant publications_ diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..a3a70c0d5a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Make a suggestion for a new feature or a change to LAMMPS +title: "[Feature Request] _Replace with Title_" +labels: enhancement +assignees: '' + +--- + +**Summary** + +_Please provide a brief and concise description of the suggested feature or change_ + +**Detailed Description** + +_Please explain how you would like to see LAMMPS enhanced, what feature(s) you are looking for, what specific problems this will solve. If possible, provide references to relevant background information like publications or web pages, and whether you are planning to implement the enhancement yourself or would like to participate in the implementation. If applicable add a reference to an existing bug report or issue that this will address._ + +**Further Information, Files, and Links** + +_Put any additional information here, attach relevant text or image files and URLs to external sites, e.g. relevant publications_ diff --git a/.github/ISSUE_TEMPLATE/generic.md b/.github/ISSUE_TEMPLATE/generic.md new file mode 100644 index 0000000000..15d2763919 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/generic.md @@ -0,0 +1,21 @@ +--- +name: Generic Issue +about: For issues that do not fit any of the other categories +title: "_Replace With a Descriptive Title_" +labels: +assignees: '' + +--- + +**Summary** + +_Please provide a clear and concise description of what this issue report is about._ + +**LAMMPS Version and Platform** + +_Please specify precisely which LAMMPS version this issue was detected with (the first line of the output) and what platform (operating system and its version, hardware) you are running on. If possible, test with the most recent LAMMPS patch version_ + +**Details** + +_Please explain the issue in detail here_ + diff --git a/.github/ISSUE_TEMPLATE/help_request.md b/.github/ISSUE_TEMPLATE/help_request.md new file mode 100644 index 0000000000..5e5b3ebffd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/help_request.md @@ -0,0 +1,15 @@ +--- +name: Request for Help +about: "Don't post help requests here, email the lammps-users mailing list" +title: "" +labels: invalid +assignees: '' + +--- + +Please **do not** post requests for help (e.g. with installing or using LAMMPS) here. +Instead send an e-mail to the lammps-users mailing list. + +This issue tracker is for tracking LAMMPS development related issues only. + +Thanks for your cooperation. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 77c81ea69d..9e43aa0244 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,28 +1,43 @@ -## Purpose +**Summary** -_Briefly describe the new feature(s), enhancement(s), or bugfix(es) included in this pull request. If this addresses an open GitHub Issue, mention the issue number, e.g. with `fixes #221` or `closes #135`, so that issue will be automatically closed when the pull request is merged_ +_Briefly describe the new feature(s), enhancement(s), or bugfix(es) included in this pull request._ -## Author(s) +**Related Issues** -_Please state name and affiliation of the author or authors that should be credited with the changes in this pull request_ +_If this addresses an open GitHub issue for this project, please mention the issue number here, and describe the relation. Use the phrases `fixes #221` or `closes #135`, when you want an issue to be automatically closed when the pull request is merged_ -## Backward Compatibility +**Author(s)** -_Please state whether any changes in the pull request break backward compatibility for inputs, and - if yes - explain what has been changed and why_ +_Please state name and affiliation of the author or authors that should be credited with the changes in this pull request. If this pull request adds new files to the distribution, please also provide a suitable "long-lived" e-mail address (ideally something that can outlive your institution's e-mail, in case you change jobs) for the *corresponding* author, i.e. the person the LAMMPS developers can contact directly with questions and requests related to maintenance and support of this contributed code._ -## Implementation Notes +**Licensing** + +By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1). + +**Backward Compatibility** + +_Please state whether any changes in the pull request will break backward compatibility for inputs, and - if yes - explain what has been changed and why_ + +**Implementation Notes** _Provide any relevant details about how the changes are implemented, how correctness was verified, how other features - if any - in LAMMPS are affected_ -## Post Submission Checklist +**Post Submission Checklist** + +_Please check the fields below as they are completed **after** the pull request has been submitted. Delete lines that don't apply_ -_Please check the fields below as they are completed_ - [ ] The feature or features in this pull request is complete -- [ ] Suitable new documentation files and/or updates to the existing docs are included -- [ ] One or more example input decks are included +- [ ] Licensing information is complete +- [ ] Corresponding author information is complete - [ ] The source code follows the LAMMPS formatting guidelines +- [ ] Suitable new documentation files and/or updates to the existing docs are included +- [ ] The added/updated documentation is integrated and tested with the documentation build system +- [ ] The feature has been verified to work with the conventional build system +- [ ] The feature has been verified to work with the CMake based build system +- [ ] A package specific README file has been included or updated +- [ ] One or more example input decks are included -## Further Information, Files, and Links +**Further Information, Files, and Links** _Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. DOIs or webpages)_ diff --git a/.github/PULL_REQUEST_TEMPLATE/bug_fix.md b/.github/PULL_REQUEST_TEMPLATE/bug_fix.md new file mode 100644 index 0000000000..cea04c6873 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/bug_fix.md @@ -0,0 +1,42 @@ +--- +name: Bug fix +about: Submit a pull request that fixes one or more bugs +title: "[BUGFIX] _Replace With Suitable Title_" +labels: bugfix +assignees: '' + +--- + +**Summary** + +_Briefly describe the bug or bugs, that are eliminated by this pull request._ + +**Related Issue(s)** + +_If this request addresses or is related to an existing (open) GitHub issue, e.g. a bug report, mention the issue number number here following a pound sign (aka hashmark), e.g.`#222`._ + +**Author(s)** + +_Please state name and affiliation of the author or authors that should be credited with the changes in this pull request_ + +**Licensing** + +By submitting this pull request I implicitly accept, that my submission is subject to the same licensing terms as the files that are modified. + +**Backward Compatibility** + +_Please state whether any changes in the pull request break backward compatibility for inputs, and - if yes - explain what has been changed and why_ + +**Detailed Description** + +_Provide any relevant details about how the fixed bug can be reproduced, how the changes are implemented, how correctness was verified, how other features - if any - in LAMMPS are affected_ + +## Post Submission Checklist + +_Please check the fields below as they are completed *after* the pull request is submitted_ +- [ ] The code in this pull request is complete +- [ ] The source code follows the LAMMPS formatting guidelines + +## Further Information, Files, and Links + +_Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. to download input decks for testing)_ diff --git a/.github/PULL_REQUEST_TEMPLATE/maintenance_refactoring.md b/.github/PULL_REQUEST_TEMPLATE/maintenance_refactoring.md new file mode 100644 index 0000000000..b3599cb36d --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/maintenance_refactoring.md @@ -0,0 +1,35 @@ +--- +name: Maintenance or Refactoring +about: Submit a pull request that does code refactoring or other maintenance changes +title: "[MAINTENANCE] _Replace With Suitable Title_" +labels: maintenance +assignees: '' + +--- + +**Summary** + +_Briefly describe the included changes._ + +**Related Issue(s)** + +_If this request addresses or is related to an existing (open) GitHub issue, e.g. a bug report, mention the issue number number here following a pound sign (aka hashmark), e.g.`#222`. + +**Author(s)** + +_Please state name and affiliation of the author or authors that should be credited with the changes in this pull request_ + +**Licensing** + +By submitting this pull request I implicitly accept, that my submission is subject to the same licensing terms as the files that are modified. + +**Detailed Description** + +_Provide any relevant details about the included changes._ + +## Post Submission Checklist + +_Please check the fields below as they are completed *after* the pull request is submitted_ +- [ ] The pull request is complete +- [ ] The source code follows the LAMMPS formatting guidelines + diff --git a/.github/PULL_REQUEST_TEMPLATE/new_feature.md b/.github/PULL_REQUEST_TEMPLATE/new_feature.md new file mode 100644 index 0000000000..e9d16a0fc7 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/new_feature.md @@ -0,0 +1,56 @@ +--- +name: New Feature +about: Submit a pull request that adds new Features (complete files) to LAMMPS +title: "[New Feature] _Replace With Suitable Title_" +labels: enhancement +assignees: '' + +--- + +**Summary** + +_Briefly describe the new feature(s) included in this pull request._ + +**Related Issues** + +_If this addresses an existing (open) GitHub issue, e.g. a feature request, mention the issue number here following a pound sign (aka hashmark), e.g. `#331`._ + +**Author(s)** + +_Please state name and affiliation of the author or authors that should be credited with the features added in this pull request. Please provide a suitable "long-lived" e-mail address (e.g. from gmail, yahoo, outlook, etc.) for the *corresponding* author, i.e. the person the LAMMPS developers can contact directly with questions and requests related to maintenance and support of this code. now and in the future_ + +**Licensing** + +_Please add *yes* or *no* to the following two statements (please contact @lammps/core if you have questions about this)_ + +My contribution may be licensed as GPL v2 (default LAMMPS license): +My contribution may be licensed as LGPL (for use as a library with proprietary software): + +**Backward Compatibility** + +_Please state if any of the changes in this pull request will affect backward compatibility for inputs, and - if yes - explain what has been changed and why_ + +**Implementation Notes** + +_Provide any relevant details about how the new features are implemented, how correctness was verified, what platforms (OS, compiler, MPI, hardware, number of processors, accelerator(s)) it was tested on_ + +## Post Submission Checklist + +_Please check the fields below as they are completed *after* the pull request has been submitted_ + +- [ ] The feature or features in this pull request is complete +- [ ] Licensing information is complete +- [ ] Corresponding author information is complete +- [ ] The source code follows the LAMMPS formatting guidelines +- [ ] Suitable new documentation files and/or updates to the existing docs are included +- [ ] The added/updated documentation is integrated and tested with the documentation build system +- [ ] The feature has been verified to work with the conventional build system +- [ ] The feature has been verified to work with the CMake based build system +- [ ] A package specific README file has been included or updated +- [ ] One or more example input decks are included + +## Further Information, Files, and Links + +_Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. DOIs or webpages)_ + + diff --git a/.github/PULL_REQUEST_TEMPLATE/update_enhancement.md b/.github/PULL_REQUEST_TEMPLATE/update_enhancement.md new file mode 100644 index 0000000000..52ef91e6c1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/update_enhancement.md @@ -0,0 +1,42 @@ +--- +name: Update or Enhancement +about: Submit a pull request that provides update or enhancements for a package or feature in LAMMPS +title: "[UPDATE] _Replace With Suitable Title_" +labels: enhancement +assignees: '' + +--- + +**Summary** + +_Briefly describe what kind of updates or enhancements for a package or feature are included. If you are not the original author of the package or feature, please mention, whether your contribution was created independently or in collaboration/cooperation with the original author._ + +**Author(s)** + +_Please state name and affiliation of the author or authors that should be credited with the changes in this pull request_ + +**Licensing** + +By submitting this pull request I implicitly accept, that my submission is subject to the same licensing terms as the original package or feature(s) that are updated or amended by this pull request. + +**Backward Compatibility** + +_Please state whether any changes in the pull request break backward compatibility for inputs, and - if yes - explain what has been changed and why_ + +**Implementation Notes** + +_Provide any relevant details about how the changes are implemented, how correctness was verified, how other features - if any - in LAMMPS are affected_ + +**Post Submission Checklist** + +_Please check the fields below as they are completed_ +- [ ] The feature or features in this pull request is complete +- [ ] Suitable updates to the existing docs are included +- [ ] One or more example input decks are included +- [ ] The source code follows the LAMMPS formatting guidelines + +**Further Information, Files, and Links** + +_Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. DOIs or webpages)_ + + diff --git a/.gitignore b/.gitignore index 50b970249a..f9dda49da6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ *.o *.so +*.lo *.cu_o *.ptx *_ptx.h @@ -21,6 +22,7 @@ log.cite .*.swp *.orig *.rej +vgcore.* .vagrant \#*# .#* @@ -32,6 +34,7 @@ log.cite .Trashes ehthumbs.db Thumbs.db +.clang-format #cmake /build* diff --git a/README b/README index 784b1cb13e..680986bf61 100644 --- a/README +++ b/README @@ -36,7 +36,14 @@ tools pre- and post-processing tools Point your browser at any of these files to get started: -doc/Manual.html the LAMMPS manual -doc/Section_intro.html hi-level introduction to LAMMPS -doc/Section_start.html how to build and use LAMMPS -doc/Developer.pdf LAMMPS developer guide +http://lammps.sandia.gov/doc/Manual.html the LAMMPS manual +http://lammps.sandia.gov/doc/Intro.html hi-level introduction +http://lammps.sandia.gov/doc/Build.html how to build LAMMPS +http://lammps.sandia.gov/doc/Run_head.html how to run LAMMPS +http://lammps.sandia.gov/doc/Developer.pdf LAMMPS developer guide + +You can also create these doc pages locally: + +% cd doc +% make html # creates HTML pages in doc/html +% make pdf # creates Manual.pdf and Developer.pdf diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index f4d3cac5d2..69aff2d72d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -11,25 +11,83 @@ get_filename_component(LAMMPS_LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../lib get_filename_component(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib ABSOLUTE) get_filename_component(LAMMPS_DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../doc ABSOLUTE) +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) + set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "default install path" FORCE ) +endif() # To avoid conflicts with the conventional Makefile build system, we build everything here -file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp) +file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp) file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp) list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) +# Utility functions +function(list_to_bulletpoints result) + list(REMOVE_AT ARGV 0) + set(temp "") + foreach(item ${ARGV}) + set(temp "${temp}* ${item}\n") + endforeach() + set(${result} "${temp}" PARENT_SCOPE) +endfunction(list_to_bulletpoints) + +function(validate_option name values) + string(TOLOWER ${${name}} needle_lower) + string(TOUPPER ${${name}} needle_upper) + list(FIND ${values} ${needle_lower} IDX_LOWER) + list(FIND ${values} ${needle_upper} IDX_UPPER) + if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0) + list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}}) + message(FATAL_ERROR "\n########################################################################\n" + "Invalid value '${${name}}' for option ${name}\n" + "\n" + "Possible values are:\n" + "${POSSIBLE_VALUE_LIST}" + "########################################################################") + endif() +endfunction(validate_option) + +function(get_lammps_version version_header variable) + file(READ ${version_header} line) + 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}") + string(REGEX REPLACE "#define LAMMPS_VERSION \"([0-9]+) ([A-Za-z]+) ([0-9]+)\"" "\\3" year "${line}") + string(STRIP ${day} day) + string(STRIP ${month} month) + string(STRIP ${year} year) + list(FIND MONTHS "${month}" month) + string(LENGTH ${day} day_length) + string(LENGTH ${month} month_length) + if(day_length EQUAL 1) + set(day "0${day}") + endif() + if(month_length EQUAL 1) + set(month "0${month}") + endif() + set(${variable} "${year}${month}${day}" PARENT_SCOPE) +endfunction() + +get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h LAMMPS_VERSION) + # Cmake modules/macros are in a subdirectory to keep this file cleaner set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules) +include(PreventInSourceBuilds) + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) #release comes with -O3 by default set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) +string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE) # check for files auto-generated by make-based buildsystem # this is fast, so check for it all the time message(STATUS "Running check for auto-generated files from make-based build system") file(GLOB SRC_AUTOGEN_FILES ${LAMMPS_SOURCE_DIR}/style_*.h) -list(APPEND SRC_AUTOGEN_FILES ${LAMMPS_SOURCE_DIR}/lmpinstalledpkgs.h) +list(APPEND SRC_AUTOGEN_FILES ${LAMMPS_SOURCE_DIR}/lmpinstalledpkgs.h ${LAMMPS_SOURCE_DIR}/lmpgitversion.h) foreach(_SRC ${SRC_AUTOGEN_FILES}) get_filename_component(FILENAME "${_SRC}" NAME) if(EXISTS ${LAMMPS_SOURCE_DIR}/${FILENAME}) @@ -87,6 +145,7 @@ if(BUILD_EXE) if(LAMMPS_MACHINE) set(LAMMPS_MACHINE "_${LAMMPS_MACHINE}") endif() + set(LAMMPS_BINARY lmp${LAMMPS_MACHINE}) endif() option(BUILD_LIB "Build LAMMPS library" OFF) @@ -95,10 +154,10 @@ if(BUILD_LIB) if(BUILD_SHARED_LIBS) # for all pkg libs, mpi_stubs and linalg set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() - set(LIB_SUFFIX "" CACHE STRING "Suffix to append to liblammps and pkg-config file") - mark_as_advanced(LIB_SUFFIX) - if(LIB_SUFFIX) - set(LIB_SUFFIX "_${LIB_SUFFIX}") + set(LAMMPS_LIB_SUFFIX "" CACHE STRING "Suffix to append to liblammps and pkg-config file") + mark_as_advanced(LAMMPS_LIB_SUFFIX) + if(LAMMPS_LIB_SUFFIX) + set(LAMMPS_LIB_SUFFIX "_${LAMMPS_LIB_SUFFIX}") endif() endif() @@ -106,8 +165,6 @@ if(NOT BUILD_EXE AND NOT BUILD_LIB) message(FATAL_ERROR "You need to at least enable one of two following options: BUILD_LIB or BUILD_EXE") endif() -option(DEVELOPER_MODE "Enable developer mode" OFF) -mark_as_advanced(DEVELOPER_MODE) option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF) include(GNUInstallDirs) @@ -115,6 +172,49 @@ set(LAMMPS_LINK_LIBS) set(LAMMPS_DEPS) set(LAMMPS_API_DEFINES) +set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE GRANULAR + KSPACE MANYBODY MC MESSAGE MISC MOLECULE PERI REPLICA RIGID SHOCK + SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI POEMS LATTE USER-ATC USER-AWPMD + USER-BOCS USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS USER-DIFFRACTION + USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD + USER-MEAMC USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF + USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REAXC USER-SCAFACOS + USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-VTK + USER-QUIP USER-QMMM USER-YAFF USER-ADIOS) +set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU) +set(OTHER_PACKAGES CORESHELL QEQ) +foreach(PKG ${DEFAULT_PACKAGES}) + option(PKG_${PKG} "Build ${PKG} Package" OFF) +endforeach() +foreach(PKG ${ACCEL_PACKAGES} ${OTHER_PACKAGES}) + option(PKG_${PKG} "Build ${PKG} Package" OFF) +endforeach() + +###################################################### +# packages with special compiler needs or external libs +###################################################### +if(PKG_USER-QUIP OR PKG_USER-QMMM OR PKG_LATTE OR PKG_USER-SCAFACOS) + enable_language(Fortran) +endif() + +if(PKG_USER-H5MD OR PKG_USER-QMMM OR PKG_USER-SCAFACOS) + enable_language(C) +endif() + +include_directories(${LAMMPS_SOURCE_DIR}) + + +if(PKG_USER-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 + enable_language(C) + find_package(ADIOS2 REQUIRED) + list(APPEND LAMMPS_LINK_LIBS adios2::adios2) +endif() + + +# do MPI detection after language activation, if MPI for these language is required find_package(MPI QUIET) option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) if(BUILD_MPI) @@ -133,15 +233,21 @@ else() list(APPEND LAMMPS_LINK_LIBS mpi_stubs) endif() -set(LAMMPS_SIZE_LIMIT "LAMMPS_SMALLBIG" CACHE STRING "Lammps size limit") -set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS LAMMPS_SMALLBIG LAMMPS_BIGBIG LAMMPS_SMALLSMALL) -add_definitions(-D${LAMMPS_SIZE_LIMIT}) -set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${LAMMPS_SIZE_LIMIT}") + +set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)") +set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall) +set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES}) +validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES) +string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES) +add_definitions(-DLAMMPS_${LAMMPS_SIZES}) +set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -DLAMMPS_${LAMMPS_SIZES}") # posix_memalign is not available on Windows if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - 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") - add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) + 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") + if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0") + add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) + endif() endif() option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF) @@ -153,25 +259,52 @@ endif() option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) option(ENABLE_TESTING "Enable testing" OFF) -if(ENABLE_TESTING) +if(ENABLE_TESTING AND BUILD_EXE) enable_testing() -endif(ENABLE_TESTING) + option(LAMMPS_TESTING_SOURCE_DIR "Location of lammps-testing source directory" "") + option(LAMMPS_TESTING_GIT_TAG "Git tag of lammps-testing" "master") + mark_as_advanced(LAMMPS_TESTING_SOURCE_DIR LAMMPS_TESTING_GIT_TAG) -set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE GRANULAR - KSPACE MANYBODY MC MEAM MISC MOLECULE PERI REAX REPLICA RIGID SHOCK SPIN SNAP - SRD KIM PYTHON MSCG MPIIO VORONOI POEMS LATTE USER-ATC USER-AWPMD USER-BOCS - USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE - USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC - USER-MOFFF USER-MOLFILE USER-NETCDF USER-PHONON USER-QTB USER-REAXC USER-SMD - USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-VTK USER-QUIP USER-QMMM) -set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU) -set(OTHER_PACKAGES CORESHELL QEQ) -foreach(PKG ${DEFAULT_PACKAGES}) - option(PKG_${PKG} "Build ${PKG} Package" OFF) -endforeach() -foreach(PKG ${ACCEL_PACKAGES} ${OTHER_PACKAGES}) - option(PKG_${PKG} "Build ${PKG} Package" OFF) -endforeach() + if (CMAKE_VERSION VERSION_GREATER "3.10.3" AND NOT LAMMPS_TESTING_SOURCE_DIR) + include(FetchContent) + + FetchContent_Declare(lammps-testing + GIT_REPOSITORY https://github.com/lammps/lammps-testing.git + GIT_TAG ${LAMMPS_TESTING_GIT_TAG} + ) + + FetchContent_GetProperties(lammps-testing) + if(NOT lammps-testing_POPULATED) + message(STATUS "Downloading tests...") + FetchContent_Populate(lammps-testing) + endif() + + set(LAMMPS_TESTING_SOURCE_DIR ${lammps-testing_SOURCE_DIR}) + elseif(NOT LAMMPS_TESTING_SOURCE_DIR) + message(WARNING "Full test-suite requires CMake >= 3.11 or copy of\n" + "https://github.com/lammps/lammps-testing in LAMMPS_TESTING_SOURCE_DIR") + endif() + + if(EXISTS ${LAMMPS_TESTING_SOURCE_DIR}) + message(STATUS "Running test discovery...") + + file(GLOB_RECURSE TEST_SCRIPTS ${LAMMPS_TESTING_SOURCE_DIR}/tests/core/*/in.*) + foreach(script_path ${TEST_SCRIPTS}) + get_filename_component(TEST_NAME ${script_path} EXT) + get_filename_component(SCRIPT_NAME ${script_path} NAME) + get_filename_component(PARENT_DIR ${script_path} DIRECTORY) + string(SUBSTRING ${TEST_NAME} 1 -1 TEST_NAME) + string(REPLACE "-" "_" TEST_NAME ${TEST_NAME}) + string(REPLACE "+" "_" TEST_NAME ${TEST_NAME}) + set(TEST_NAME "test_core_${TEST_NAME}_serial") + add_test(${TEST_NAME} ${CMAKE_BINARY_DIR}/${LAMMPS_BINARY} -in ${SCRIPT_NAME}) + set_tests_properties(${TEST_NAME} PROPERTIES WORKING_DIRECTORY ${PARENT_DIR}) + endforeach() + list(LENGTH TEST_SCRIPTS NUM_TESTS) + + message(STATUS "Found ${NUM_TESTS} tests.") + endif() +endif() macro(pkg_depends PKG1 PKG2) if(PKG_${PKG1} AND NOT (PKG_${PKG2} OR BUILD_${PKG2})) @@ -185,22 +318,17 @@ pkg_depends(MPIIO MPI) pkg_depends(USER-ATC MANYBODY) pkg_depends(USER-LB MPI) pkg_depends(USER-PHONON KSPACE) +pkg_depends(USER-SCAFACOS MPI) -###################################################### -# packages with special compiler needs or external libs -###################################################### -if(PKG_REAX OR PKG_MEAM OR PKG_USER-QUIP OR PKG_USER-QMMM OR PKG_LATTE) - enable_language(Fortran) -endif() - -if(PKG_MEAM OR PKG_USER-H5MD OR PKG_USER-QMMM) - enable_language(C) -endif() - +include(CheckIncludeFileCXX) find_package(OpenMP QUIET) option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND}) -if(BUILD_OMP OR PKG_USER-OMP OR PKG_KOKKOS OR PKG_USER-INTEL) +if(BUILD_OMP) find_package(OpenMP REQUIRED) + check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE) + if(NOT HAVE_OMP_H_INCLUDE) + message(FATAL_ERROR "Cannot find required 'omp.h' header file") + endif() set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() @@ -216,10 +344,13 @@ if(PKG_KSPACE) if(${FFTW}_FOUND) set(FFT "${FFTW}" CACHE STRING "FFT library for KSPACE package") else() - set(FFT "KISSFFT" CACHE STRING "FFT library for KSPACE package") + set(FFT "KISS" CACHE STRING "FFT library for KSPACE package") endif() - set_property(CACHE FFT PROPERTY STRINGS KISSFFT ${FFTW} MKL) - if(NOT FFT STREQUAL "KISSFFT") + set(FFT_VALUES KISS ${FFTW} MKL) + set_property(CACHE FFT PROPERTY STRINGS ${FFT_VALUES}) + validate_option(FFT FFT_VALUES) + string(TOUPPER ${FFT} FFT) + if(NOT FFT STREQUAL "KISS") find_package(${FFT} REQUIRED) if(NOT FFT STREQUAL "FFTW3F") add_definitions(-DFFT_FFTW) @@ -228,38 +359,37 @@ if(PKG_KSPACE) endif() include_directories(${${FFT}_INCLUDE_DIRS}) list(APPEND LAMMPS_LINK_LIBS ${${FFT}_LIBRARIES}) + else() + add_definitions(-DFFT_KISS) endif() - set(PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT") - set_property(CACHE PACK_OPTIMIZATION PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY) - if(NOT PACK_OPTIMIZATION STREQUAL "PACK_ARRAY") - add_definitions(-D${PACK_OPTIMIZATION}) + set(FFT_PACK "array" CACHE STRING "Optimization for FFT") + set(FFT_PACK_VALUES array pointer memcpy) + set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES}) + validate_option(FFT_PACK FFT_PACK_VALUES) + if(NOT FFT_PACK STREQUAL "array") + string(TOUPPER ${FFT_PACK} FFT_PACK) + add_definitions(-DFFT_PACK_${FFT_PACK}) endif() endif() -if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE) +if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-PLUMED OR PKG_USER-QUIP OR PKG_LATTE) find_package(LAPACK) - if(NOT LAPACK_FOUND) + find_package(BLAS) + if(NOT LAPACK_FOUND OR NOT BLAS_FOUND) enable_language(Fortran) - file(GLOB LAPACK_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/linalg/*.[fF]) + file(GLOB LAPACK_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.[fF]) add_library(linalg STATIC ${LAPACK_SOURCES}) set(LAPACK_LIBRARIES linalg) + else() + list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES}) endif() endif() if(PKG_PYTHON) - find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) add_definitions(-DLMP_PYTHON) include_directories(${PYTHON_INCLUDE_DIR}) list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY}) - if(BUILD_LIB AND BUILD_SHARED_LIBS) - if(NOT PYTHON_INSTDIR) - execute_process(COMMAND ${PYTHON_EXECUTABLE} - -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" - OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) - endif() endif() find_package(JPEG QUIET) @@ -306,14 +436,41 @@ if(WITH_FFMPEG) add_definitions(-DLAMMPS_FFMPEG) endif() +if(BUILD_SHARED_LIBS) + set(CONFIGURE_REQUEST_PIC "--with-pic") + set(CMAKE_REQUEST_PIC "-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}") + set(CUDA_REQUEST_PIC "-Xcompiler ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") +else() + set(CONFIGURE_REQUEST_PIC) + set(CMAKE_REQUEST_PIC) + set(CUDA_REQUEST_PIC) +endif() + + if(PKG_VORONOI) - option(DOWNLOAD_VORO "Download voro++ (instead of using the system's one)" OFF) + find_package(VORO) + if(VORO_FOUND) + set(DOWNLOAD_VORO_DEFAULT OFF) + else() + set(DOWNLOAD_VORO_DEFAULT ON) + 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") include(ExternalProject) + + if(BUILD_SHARED_LIBS) + set(VORO_BUILD_CFLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}") + else() + set(VORO_BUILD_CFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}") + endif() + string(APPEND VORO_BUILD_CFLAGS ${CMAKE_CXX_FLAGS}) + set(VORO_BUILD_OPTIONS CXX=${CMAKE_CXX_COMPILER} CFLAGS=${VORO_BUILD_CFLAGS}) + ExternalProject_Add(voro_build - URL http://math.lbl.gov/voro++/download/dir/voro++-0.4.6.tar.gz + URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz URL_MD5 2338b824c3b7b25590e18e8df5d68af9 - CONFIGURE_COMMAND "" BUILD_IN_SOURCE 1 INSTALL_COMMAND "" + CONFIGURE_COMMAND "" BUILD_COMMAND make ${VORO_BUILD_OPTIONS} BUILD_IN_SOURCE 1 INSTALL_COMMAND "" ) ExternalProject_get_property(voro_build SOURCE_DIR) set(VORO_LIBRARIES ${SOURCE_DIR}/src/libvoro++.a) @@ -322,7 +479,7 @@ if(PKG_VORONOI) else() find_package(VORO) if(NOT VORO_FOUND) - message(FATAL_ERROR "VORO not found, help CMake to find it by setting VORO_LIBRARY and VORO_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it") + message(FATAL_ERROR "Voro++ library not found. Help CMake to find it by setting VORO_LIBRARY and VORO_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it") endif() endif() include_directories(${VORO_INCLUDE_DIRS}) @@ -330,58 +487,213 @@ if(PKG_VORONOI) endif() if(PKG_LATTE) - option(DOWNLOAD_LATTE "Download latte (instead of using the system's one)" OFF) + find_package(LATTE) + if(LATTE_FOUND) + set(DOWNLOAD_LATTE_DEFAULT OFF) + else() + set(DOWNLOAD_LATTE_DEFAULT ON) + endif() + option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT}) if(DOWNLOAD_LATTE) - message(STATUS "LATTE not found - we will build our own") + if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR + message(FATAL_ERROR "For downlading LATTE you need at least cmake-3.7") + endif() + message(STATUS "LATTE download requested - we will build our own") include(ExternalProject) ExternalProject_Add(latte_build URL https://github.com/lanl/LATTE/archive/v1.2.1.tar.gz URL_MD5 85ac414fdada2d04619c8f936344df14 SOURCE_SUBDIR cmake - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE} - ) + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= ${CMAKE_REQUEST_PIC} -DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES} + ) ExternalProject_get_property(latte_build INSTALL_DIR) set(LATTE_LIBRARIES ${INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/liblatte.a) list(APPEND LAMMPS_DEPS latte_build) else() find_package(LATTE) if(NOT LATTE_FOUND) - message(FATAL_ERROR "LATTE not found, help CMake to find it by setting LATTE_LIBRARY, or set DOWNLOAD_LATTE=ON to download it") + message(FATAL_ERROR "LATTE library not found, help CMake to find it by setting LATTE_LIBRARY, or set DOWNLOAD_LATTE=ON to download it") endif() endif() list(APPEND LAMMPS_LINK_LIBS ${LATTE_LIBRARIES} ${LAPACK_LIBRARIES}) endif() +if(PKG_USER-SCAFACOS) + find_package(GSL REQUIRED) + find_package(PkgConfig QUIET) + 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") + 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 + CONFIGURE_COMMAND /configure --prefix= --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= + ) + ExternalProject_get_property(scafacos_build INSTALL_DIR) + set(SCAFACOS_BUILD_DIR ${INSTALL_DIR}) + set(SCAFACOS_INCLUDE_DIRS ${SCAFACOS_BUILD_DIR}/include) + list(APPEND LAMMPS_DEPS scafacos_build) + # list and order from pkg_config file of ScaFaCoS build + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_direct.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_ewald.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_fmm.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_p2nfft.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_p3m.a) + list(APPEND LAMMPS_LINK_LIBS ${GSL_LIBRARIES}) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_near.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_gridsort.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_resort.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_redist.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_common.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_pnfft.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_pfft.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_fftw3_mpi.a) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_fftw3.a) + list(APPEND LAMMPS_LINK_LIBS ${MPI_Fortran_LIBRARIES}) + list(APPEND LAMMPS_LINK_LIBS ${MPI_C_LIBRARIES}) + else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(SCAFACOS REQUIRED scafacos) + list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_LDFLAGS}) + endif() + include_directories(${SCAFACOS_INCLUDE_DIRS}) +endif() + +if(PKG_USER-PLUMED) + find_package(GSL REQUIRED) + 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) + + 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") + include(ExternalProject) + ExternalProject_Add(plumed_build + URL https://github.com/plumed/plumed2/releases/download/v2.5.1/plumed-src-2.5.1.tgz + URL_MD5 c2a7b519e32197a120cdf47e0f194f81 + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND /configure --prefix= + ${CONFIGURE_REQUEST_PIC} + --enable-modules=all + ${PLUMED_CONFIG_MPI} + ${PLUMED_CONFIG_OMP} + CXX=${PLUMED_CONFIG_CXX} + CC=${PLUMED_CONFIG_CC} + ) + ExternalProject_get_property(plumed_build INSTALL_DIR) + set(PLUMED_INSTALL_DIR ${INSTALL_DIR}) + list(APPEND LAMMPS_DEPS plumed_build) + if(PLUMED_MODE STREQUAL "STATIC") + add_definitions(-D__PLUMED_WRAPPER_CXX=1) + list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.a ${GSL_LIBRARIES} ${LAPACK_LIBRARIES} ${CMAKE_DL_LIBS}) + elseif(PLUMED_MODE STREQUAL "SHARED") + list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.so ${PLUMED_INSTALL_DIR}/lib/libplumedKernel.so ${CMAKE_DL_LIBS}) + elseif(PLUMED_MODE STREQUAL "RUNTIME") + add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_INSTALL_DIR}/lib/libplumedKernel.so) + list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumedWrapper.a -rdynamic ${CMAKE_DL_LIBS}) + endif() + set(PLUMED_INCLUDE_DIRS "${PLUMED_INSTALL_DIR}/include") + else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(PLUMED REQUIRED plumed) + if(PLUMED_MODE STREQUAL "STATIC") + add_definitions(-D__PLUMED_WRAPPER_CXX=1) + 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") + add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/libplumedKernel.so) + include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime) + endif() + list(APPEND LAMMPS_LINK_LIBS ${PLUMED_LOAD}) + endif() + include_directories(${PLUMED_INCLUDE_DIRS}) +endif() + if(PKG_USER-MOLFILE) + set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers") add_library(molfile INTERFACE) - target_include_directories(molfile INTERFACE ${LAMMPS_LIB_SOURCE_DIR}/molfile) - target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS}) + 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() list(APPEND LAMMPS_LINK_LIBS molfile) endif() if(PKG_USER-NETCDF) find_package(NetCDF REQUIRED) - include_directories(NETCDF_INCLUDE_DIR) - list(APPEND LAMMPS_LINK_LIBS ${NETCDF_LIBRARY}) + include_directories(${NETCDF_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${NETCDF_LIBRARIES}) add_definitions(-DLMP_HAS_NETCDF -DNC_64BIT_DATA=0x0020) endif() if(PKG_USER-SMD) - option(DOWNLOAD_Eigen3 "Download Eigen3 (instead of using the system's one)" OFF) - if(DOWNLOAD_Eigen3) + 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 http://bitbucket.org/eigen/eigen/get/3.3.4.tar.gz - URL_MD5 1a47e78efe365a97de0c022d127607c3 + URL http://bitbucket.org/eigen/eigen/get/3.3.7.tar.gz + URL_MD5 f2a417d083fe8ca4b8ed2bc613d20f07 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) ExternalProject_get_property(Eigen3_build SOURCE_DIR) set(EIGEN3_INCLUDE_DIR ${SOURCE_DIR}) list(APPEND LAMMPS_DEPS Eigen3_build) else() - find_package(Eigen3) - 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") + 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() endif() include_directories(${EIGEN3_INCLUDE_DIR}) @@ -407,33 +719,88 @@ if(PKG_USER-VTK) endif() if(PKG_KIM) - option(DOWNLOAD_KIM "Download kim-api (instead of using the system's one)" OFF) + find_package(CURL) + if(CURL_FOUND) + include_directories(${CURL_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${CURL_LIBRARIES}) + add_definitions(-DLMP_KIM_CURL) + endif() + find_package(KIM-API QUIET) + if(KIM-API_FOUND) + set(DOWNLOAD_KIM_DEFAULT OFF) + else() + set(DOWNLOAD_KIM_DEFAULT ON) + endif() + option(DOWNLOAD_KIM "Download KIM-API from OpenKIM instead of using an already installed one" ${DOWNLOAD_KIM_DEFAULT}) if(DOWNLOAD_KIM) + message(STATUS "KIM-API download requested - we will build our own") + enable_language(C) + enable_language(Fortran) include(ExternalProject) ExternalProject_Add(kim_build - URL https://github.com/openkim/kim-api/archive/v1.9.5.tar.gz - URL_MD5 9f66efc128da33039e30659f36fc6d00 - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND /configure --prefix= + URL https://s3.openkim.org/kim-api/kim-api-2.0.2.txz + URL_MD5 537d9c0abd30f85b875ebb584f9143fa + BINARY_DIR build + CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_INSTALL_PREFIX= + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ) ExternalProject_get_property(kim_build INSTALL_DIR) - set(KIM_INCLUDE_DIRS ${INSTALL_DIR}/include/kim-api-v1) - set(KIM_LIBRARIES ${INSTALL_DIR}/lib/libkim-api-v1.so) + set(KIM-API_INCLUDE_DIRS ${INSTALL_DIR}/include/kim-api) + set(KIM-API_LDFLAGS ${INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/libkim-api${CMAKE_SHARED_LIBRARY_SUFFIX}) list(APPEND LAMMPS_DEPS kim_build) else() - find_package(KIM) - if(NOT KIM_FOUND) - message(FATAL_ERROR "KIM not found, help CMake to find it by setting KIM_LIBRARY and KIM_INCLUDE_DIR, or set DOWNLOAD_KIM=ON to download it") - endif() + find_package(KIM-API REQUIRED) endif() - list(APPEND LAMMPS_LINK_LIBS ${KIM_LIBRARIES}) - include_directories(${KIM_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS "${KIM-API_LDFLAGS}") + include_directories(${KIM-API_INCLUDE_DIRS}) +endif() + +if(PKG_MESSAGE) + option(MESSAGE_ZMQ "Use ZeroMQ in MESSAGE package" OFF) + file(GLOB_RECURSE cslib_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.F + ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.c + ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.cpp) + + add_library(cslib STATIC ${cslib_SOURCES}) + if(BUILD_MPI) + target_compile_definitions(cslib PRIVATE -DMPI_YES) + set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi") + 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_include_directories(cslib PRIVATE ${ZMQ_INCLUDE_DIRS}) + target_link_libraries(cslib PUBLIC ${ZMQ_LIBRARIES}) + else() + target_compile_definitions(cslib PRIVATE -DZMQ_NO) + target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_ZMQ) + endif() + + list(APPEND LAMMPS_LINK_LIBS cslib) + include_directories(${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src) endif() if(PKG_MSCG) find_package(GSL REQUIRED) - option(DOWNLOAD_MSCG "Download latte (instead of using the system's one)" OFF) + find_package(MSCG QUIET) + if(MSGC_FOUND) + set(DOWNLOAD_MSCG_DEFAULT OFF) + else() + set(DOWNLOAD_MSCG_DEFAULT ON) + endif() + option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT}) if(DOWNLOAD_MSCG) + if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR + message(FATAL_ERROR "For downlading MSCG you need at least cmake-3.7") + endif() include(ExternalProject) if(NOT LAPACK_FOUND) set(EXTRA_MSCG_OPTS "-DLAPACK_LIBRARIES=${CMAKE_CURRENT_BINARY_DIR}/liblinalg.a") @@ -442,7 +809,7 @@ if(PKG_MSCG) URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz URL_MD5 8c45e269ee13f60b303edd7823866a91 SOURCE_SUBDIR src/CMake - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE} ${EXTRA_MSCG_OPTS} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS} BUILD_COMMAND make mscg INSTALL_COMMAND "" ) ExternalProject_get_property(mscg_build BINARY_DIR) @@ -478,8 +845,7 @@ endif() ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## -include(CheckIncludeFileCXX) -foreach(HEADER math.h) +foreach(HEADER cmath) check_include_file_cxx(${HEADER} FOUND_${HEADER}) if(NOT FOUND_${HEADER}) message(FATAL_ERROR "Could not find needed header - ${HEADER}") @@ -490,14 +856,15 @@ set(MATH_LIBRARIES "m" CACHE STRING "math library") mark_as_advanced( MATH_LIBRARIES ) include(CheckLibraryExists) if (CMAKE_VERSION VERSION_LESS "3.4") - enable_language(C) # check_library_exists isn't supported without a c compiler before v3.4 + enable_language(C) # check_library_exists isn't supported without a C compiler before v3.4 endif() -foreach(FUNC sin cos) - check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES}) - if(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) - message(FATAL_ERROR "Could not find needed math function - ${FUNC}") - endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) -endforeach(FUNC) +# RB: disabled this check because it breaks with KOKKOS CUDA enabled +#foreach(FUNC sin cos) +# check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES}) +# if(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) +# message(FATAL_ERROR "Could not find needed math function - ${FUNC}") +# endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) +#endforeach(FUNC) list(APPEND LAMMPS_LINK_LIBS ${MATH_LIBRARIES}) ###################################### @@ -512,8 +879,8 @@ RegisterStyles(${LAMMPS_SOURCE_DIR}) foreach(PKG ${DEFAULT_PACKAGES}) set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) - file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/*.cpp) - file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/*.h) + file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp) + file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h) # check for package files in src directory due to old make system DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS}) @@ -527,12 +894,19 @@ foreach(PKG ${DEFAULT_PACKAGES}) endif() endforeach() +# packages that need defines set +foreach(PKG MPIIO) + if(PKG_${PKG}) + add_definitions(-DLMP_${PKG}) + endif() +endforeach() + # dedicated check for entire contents of accelerator packages foreach(PKG ${ACCEL_PACKAGES}) set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG}) - file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/*.cpp) - file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/*.h) + file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp) + file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h) # check for package files in src directory due to old make system DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS}) @@ -541,19 +915,21 @@ endforeach() ############################################## # add lib sources of (simple) enabled packages ############################################ -foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD +foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-QMMM) if(PKG_${SIMPLE_LIB}) string(REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}") string(TOLOWER "${PKG_LIB}" PKG_LIB) - file(GLOB_RECURSE ${PKG_LIB}_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/*.F - ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/*.c ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/*.cpp) + file(GLOB_RECURSE ${PKG_LIB}_SOURCES + ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.F + ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c + ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp) add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES}) list(APPEND LAMMPS_LINK_LIBS ${PKG_LIB}) 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) - target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include) + target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include ${HDF5_INCLUDE_DIRS}) elseif(PKG_LIB STREQUAL colvars) target_compile_options(colvars PRIVATE -DLEPTON) target_include_directories(colvars PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include) @@ -569,6 +945,9 @@ if(PKG_USER-AWPMD) endif() if(PKG_USER-ATC) + if(LAMMPS_SIZES STREQUAL BIGBIG) + message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG") + endif() target_link_libraries(atc ${LAPACK_LIBRARIES}) endif() @@ -576,6 +955,7 @@ if(PKG_USER-H5MD) find_package(HDF5 REQUIRED) target_link_libraries(h5md ${HDF5_LIBRARIES}) target_include_directories(h5md PRIVATE ${HDF5_INCLUDE_DIRS}) + include_directories(${HDF5_INCLUDE_DIRS}) endif() @@ -622,13 +1002,16 @@ if(PKG_USER-OMP) 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}/fix_nh_sphere_omp.cpp + ${USER-OMP_SOURCES_DIR}/domain_omp.cpp) + add_definitions(-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) @@ -658,6 +1041,20 @@ if(PKG_USER-OMP) include_directories(${USER-OMP_SOURCES_DIR}) endif() +# Fix rigid/meso requires RIGID to be installed +if(PKG_USER-SDPD) + 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) + list(REMOVE_ITEM LIB_SOURCES ${USER-SDPD_SOURCES_DIR}/fix_rigid_meso.cpp) + endif() + set_property(GLOBAL PROPERTY FIX "${hlist}") + + include_directories(${USER-SDPD_SOURCES_DIR}) +endif() + if(PKG_KOKKOS) set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos) @@ -685,6 +1082,11 @@ if(PKG_KOKKOS) ${KOKKOS_PKG_SOURCES_DIR}/npair_kokkos.cpp ${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp ${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp) + + if(PKG_KSPACE) + list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp) + endif() + set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}") # detects styles which have KOKKOS version @@ -722,58 +1124,122 @@ if(PKG_OPT) endif() if(PKG_USER-INTEL) - if(NOT DEVELOPER_MODE) - if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - message(FATAL_ERROR "USER-INTEL is only useful together with intel compiler") - endif() - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) - message(FATAL_ERROR "USER-INTEL is needed at least 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}") - endif() + if(LAMMPS_SIZES STREQUAL BIGBIG) + message(FATAL_ERROR "The USER-INTEL Package is not compatible with -DLAMMPS_BIGBIG") + endif() + add_definitions(-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) + add_definitions(-DLMP_INTEL_USELRT) + list(APPEND LAMMPS_LINK_LIBS ${CMAKE_THREAD_LIBS_INIT}) + else() + message(FATAL_ERROR "Must have working threads library for Long-range thread support") endif() - option(INJECT_KNL_FLAG "Inject flags for KNL build" OFF) - if(INJECT_KNL_FLAG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xMIC-AVX512") + endif() + if(INTEL_LRT_MODE STREQUAL "C++11") + add_definitions(-DLMP_INTEL_USERLRT -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() - option(INJECT_INTEL_FLAG "Inject OMG fast flags for USER-INTEL" ON) - if(INJECT_INTEL_FLAG AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + else() + message(WARNING "USER-INTEL gives best performance with Intel compilers") + endif() + + find_package(TBB QUIET) + if(TBB_FOUND) + list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES}) + else() + add_definitions(-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) + add_definitions(-DLMP_USE_MKL_RNG) + list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES}) + 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\\\"\"") + add_compile_options(-xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS}) + add_definitions(-DLMP_INTEL_OFFLOAD) + else() + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xCOMMON-AVX512") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost") endif() include(CheckCXXCompilerFlag) - foreach(_FLAG -qopenmp -qno-offload -fno-alias -ansi-alias -restrict -DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG -O2 "-fp-model fast=2" -no-prec-div -qoverride-limits -qopt-zmm-usage=high) + 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}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_FLAG}") + add_compile_options(${_FLAG}) endif() endforeach() + else() + add_compile_options(-O3 -ffast-math) endif() - set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL) - set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/intel_preprocess.h - ${USER-INTEL_SOURCES_DIR}/intel_buffers.h - ${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp - ${USER-INTEL_SOURCES_DIR}/math_extra_intel.h - ${USER-INTEL_SOURCES_DIR}/nbin_intel.h - ${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp - ${USER-INTEL_SOURCES_DIR}/npair_intel.h - ${USER-INTEL_SOURCES_DIR}/npair_intel.cpp - ${USER-INTEL_SOURCES_DIR}/intel_simd.h - ${USER-INTEL_SOURCES_DIR}/intel_intrinsics.h) + endif() - set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}") + # 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 + ${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp) - # detects styles which have USER-INTEL version - RegisterStylesExt(${USER-INTEL_SOURCES_DIR} opt USER-INTEL_SOURCES) + set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}") - get_property(USER-INTEL_SOURCES GLOBAL PROPERTY 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) + RegisterIntegrateStyle(${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.h) - list(APPEND LIB_SOURCES ${USER-INTEL_SOURCES}) - include_directories(${USER-INTEL_SOURCES_DIR}) + get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES) + + list(APPEND LIB_SOURCES ${USER-INTEL_SOURCES}) + include_directories(${USER-INTEL_SOURCES_DIR}) endif() if(PKG_GPU) - if (CMAKE_VERSION VERSION_LESS "3.1") + if (CMAKE_VERSION VERSION_LESS "3.1") message(FATAL_ERROR "For the GPU package you need at least cmake-3.1") endif() set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU) @@ -781,41 +1247,87 @@ if(PKG_GPU) ${GPU_SOURCES_DIR}/fix_gpu.h ${GPU_SOURCES_DIR}/fix_gpu.cpp) - set(GPU_API "OpenCL" CACHE STRING "API used by GPU package") - set_property(CACHE GPU_API PROPERTY STRINGS OpenCL CUDA) + set(GPU_API "opencl" CACHE STRING "API used by GPU package") + set(GPU_API_VALUES opencl cuda) + set_property(CACHE GPU_API PROPERTY STRINGS ${GPU_API_VALUES}) + validate_option(GPU_API GPU_API_VALUES) + string(TOUPPER ${GPU_API} GPU_API) - set(GPU_PREC "SINGLE_DOUBLE" CACHE STRING "LAMMPS GPU precision size") - set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE) + set(GPU_PREC "mixed" CACHE STRING "LAMMPS GPU precision") + set(GPU_PREC_VALUES double mixed single) + set_property(CACHE GPU_PREC PROPERTY STRINGS ${GPU_PREC_VALUES}) + validate_option(GPU_PREC GPU_PREC_VALUES) + string(TOUPPER ${GPU_PREC} GPU_PREC) - file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp) + if(GPU_PREC STREQUAL "DOUBLE") + set(GPU_PREC_SETTING "DOUBLE_DOUBLE") + elseif(GPU_PREC STREQUAL "MIXED") + set(GPU_PREC_SETTING "SINGLE_DOUBLE") + elseif(GPU_PREC STREQUAL "SINGLE") + set(GPU_PREC_SETTING "SINGLE_SINGLE") + endif() + + 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 REQUIRED) find_program(BIN2C bin2c) if(NOT BIN2C) - message(FATAL_ERROR "Couldn't find bin2c, use -DBIN2C helping cmake to find it.") + 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(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF) + if(CUDA_MPS_SUPPORT) + set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY") + endif() - set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM architecture (e.g. sm_60)") + set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)") - file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/*.cu) + file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu) list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu) if(CUDPP_OPT) cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini) - file(GLOB GPU_LIB_CUDPP_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/*.cpp) - file(GLOB GPU_LIB_CUDPP_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/*.cu) + file(GLOB GPU_LIB_CUDPP_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp) + file(GLOB GPU_LIB_CUDPP_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu) endif() - cuda_compile_cubin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS - -DUNIX -O3 -Xptxas -v --use_fast_math -DNV_KERNEL -DUCL_CUDADR -arch=${GPU_ARCH} -D_${GPU_PREC}) + # 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 "3.1") AND (CUDA_VERSION VERSION_LESS "9.0")) + string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_20,code=[sm_20,compute_20] ") + endif() + # Kepler (GPU Arch 3.x) is supported by CUDA 5 and later + if(CUDA_VERSION VERSION_GREATER "4.9") + string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_30,code=[sm_30,compute_30] -gencode arch=compute_35,code=[sm_35,compute_35] ") + endif() + # Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later + if(CUDA_VERSION VERSION_GREATER "5.9") + string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] ") + endif() + # Pascal (GPU Arch 6.x) is supported by CUDA 8 and later + if(CUDA_VERSION VERSION_GREATER "7.9") + string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61] ") + endif() + # Volta (GPU Arch 7.0) is supported by CUDA 9 and later + if(CUDA_VERSION VERSION_GREATER "8.9") + string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_70,code=[sm_70,compute_70] ") + endif() + # Turing (GPU Arch 7.5) is supported by CUDA 10 and later + if(CUDA_VERSION VERSION_GREATER "9.9") + string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_75,code=[sm_75,compute_75] ") + endif() - cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS $<$:-Xcompiler=-fPIC> - -DUNIX -O3 -Xptxas -v --use_fast_math -DUCL_CUDADR -arch=${GPU_ARCH} -D_${GPU_PREC}) + cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS + -DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING}) + + 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}) foreach(CU_OBJ ${GPU_GEN_OBJS}) get_filename_component(CU_NAME ${CU_OBJ} NAME_WE) @@ -832,7 +1344,7 @@ if(PKG_GPU) add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS}) target_link_libraries(gpu ${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} -DMPI_GERYON -DUCL_NO_EXIT) + target_compile_definitions(gpu PRIVATE -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) @@ -846,15 +1358,18 @@ if(PKG_GPU) target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS}) - elseif(GPU_API STREQUAL "OpenCL") + elseif(GPU_API STREQUAL "OPENCL") find_package(OpenCL REQUIRED) - set(OCL_TUNE "GENERIC" CACHE STRING "OpenCL Device Tuning") - set_property(CACHE OCL_TUNE PROPERTY STRINGS INTEL FERMI KEPLER CYPRESS GENERIC) + set(OCL_TUNE "generic" CACHE STRING "OpenCL Device Tuning") + set(OCL_TUNE_VALUES intel fermi kepler cypress generic) + set_property(CACHE OCL_TUNE PROPERTY STRINGS ${OCL_TUNE_VALUES}) + validate_option(OCL_TUNE OCL_TUNE_VALUES) + string(TOUPPER ${OCL_TUNE} OCL_TUNE) include(OpenCLUtils) set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h) - file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu) + file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu) list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu) foreach(GPU_KERNEL ${GPU_LIB_CU}) @@ -871,7 +1386,7 @@ if(PKG_GPU) add_library(gpu STATIC ${GPU_LIB_SOURCES}) target_link_libraries(gpu ${OpenCL_LIBRARIES}) target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu ${OpenCL_INCLUDE_DIRS}) - target_compile_definitions(gpu PRIVATE -D_${GPU_PREC} -D${OCL_TUNE}_OCL -DMPI_GERYON -DUCL_NO_EXIT) + target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -D${OCL_TUNE}_OCL -DMPI_GERYON -DUCL_NO_EXIT) target_compile_definitions(gpu PRIVATE -DUSE_OPENCL) list(APPEND LAMMPS_LINK_LIBS gpu) @@ -904,7 +1419,6 @@ set(LAMMPS_STYLE_HEADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/styles) GenerateStyleHeaders(${LAMMPS_STYLE_HEADERS_DIR}) -include_directories(${LAMMPS_SOURCE_DIR}) include_directories(${LAMMPS_STYLE_HEADERS_DIR}) ###################################### @@ -912,7 +1426,9 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR}) ###################################### set(temp "#ifndef LMP_INSTALLED_PKGS_H\n#define LMP_INSTALLED_PKGS_H\n") set(temp "${temp}const char * LAMMPS_NS::LAMMPS::installed_packages[] = {\n") -foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES} ${OTHER_PACKAGES}) +set(temp_PKG_LIST ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES} ${OTHER_PACKAGES}) +list(SORT temp_PKG_LIST) +foreach(PKG ${temp_PKG_LIST}) if(PKG_${PKG}) set(temp "${temp} \"${PKG}\",\n") endif() @@ -922,6 +1438,18 @@ message(STATUS "Generating lmpinstalledpkgs.h...") file(WRITE "${LAMMPS_STYLE_HEADERS_DIR}/lmpinstalledpkgs.h.tmp" "${temp}" ) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LAMMPS_STYLE_HEADERS_DIR}/lmpinstalledpkgs.h.tmp" "${LAMMPS_STYLE_HEADERS_DIR}/lmpinstalledpkgs.h") +###################################### +# Generate lmpgitversion.h +###################################### +add_custom_target(gitversion COMMAND ${CMAKE_COMMAND} + -DCMAKE_CURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" + -DGIT_EXECUTABLE="${GIT_EXECUTABLE}" + -DGIT_FOUND="${GIT_FOUND}" + -DLAMMPS_STYLE_HEADERS_DIR="${LAMMPS_STYLE_HEADERS_DIR}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/generate_lmpgitversion.cmake) +set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${LAMMPS_STYLE_HEADERS_DIR}/gitversion.h) +list(APPEND LAMMPS_DEPS gitversion) + ########################################### # Actually add executable and lib to build ############################################ @@ -937,14 +1465,14 @@ if(BUILD_LIB) if(LAMMPS_DEPS) add_dependencies(lammps ${LAMMPS_DEPS}) endif() - set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LIB_SUFFIX}) - if(BUILD_SHARED_LIBS) - set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) - install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install(FILES ${LAMMPS_SOURCE_DIR}/library.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps) - configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LIB_SUFFIX}.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LIB_SUFFIX}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - endif() + set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_LIB_SUFFIX}) + set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION}) + install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(FILES ${LAMMPS_SOURCE_DIR}/library.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps) + configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_LIB_SUFFIX}.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_LIB_SUFFIX}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + configure_file(FindLAMMPS.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindLAMMPS${LAMMPS_LIB_SUFFIX}.cmake @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FindLAMMPS${LAMMPS_LIB_SUFFIX}.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/Modules) else() list(APPEND LMP_SOURCES ${LIB_SOURCES}) endif() @@ -959,14 +1487,26 @@ if(BUILD_EXE) add_dependencies(lmp ${LAMMPS_DEPS}) endif() endif() - - set_target_properties(lmp PROPERTIES OUTPUT_NAME lmp${LAMMPS_MACHINE}) + + set_target_properties(lmp PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY}) install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(FILES ${LAMMPS_DOC_DIR}/lammps.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 RENAME ${LAMMPS_BINARY}.1) if(ENABLE_TESTING) - add_test(ShowHelp lmp${LAMMPS_MACHINE} -help) + add_test(ShowHelp ${LAMMPS_BINARY} -help) endif() + + enable_language(C) + get_filename_component(MSI2LMP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../tools/msi2lmp/src ABSOLUTE) + file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c) + add_executable(msi2lmp ${MSI2LMP_SOURCES}) + target_link_libraries(msi2lmp m) + install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + endif() + + ############################################################################### # Build documentation ############################################################################### @@ -978,7 +1518,7 @@ if(BUILD_DOC) set(VIRTUALENV ${PYTHON_EXECUTABLE} -m virtualenv) - file(GLOB DOC_SOURCES ${LAMMPS_DOC_DIR}/src/*.txt) + file(GLOB DOC_SOURCES ${LAMMPS_DOC_DIR}/src/[^.]*.txt) file(GLOB PDF_EXTRA_SOURCES ${LAMMPS_DOC_DIR}/src/lammps_commands*.txt ${LAMMPS_DOC_DIR}/src/lammps_support.txt ${LAMMPS_DOC_DIR}/src/lammps_tutorials.txt) list(REMOVE_ITEM DOC_SOURCES ${PDF_EXTRA_SOURCES}) @@ -1028,10 +1568,13 @@ if(BUILD_DOC) endif() ############################################################################### -# Install potential files in data directory +# Install potential and force field files in data directory ############################################################################### set(LAMMPS_POTENTIALS_DIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps/potentials) -install(DIRECTORY ${LAMMPS_SOURCE_DIR}/../potentials DESTINATION ${CMAKE_INSTALL_DATADIR}/lammps/potentials) +install(DIRECTORY ${LAMMPS_SOURCE_DIR}/../potentials/ DESTINATION ${LAMMPS_POTENTIALS_DIR}) + +set(LAMMPS_FRC_FILES_DIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps/frc_files) +install(DIRECTORY ${LAMMPS_SOURCE_DIR}/../tools/msi2lmp/frc_files/ DESTINATION ${LAMMPS_FRC_FILES_DIR}) configure_file(etc/profile.d/lammps.sh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.sh @ONLY) configure_file(etc/profile.d/lammps.csh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.csh @ONLY) @@ -1041,6 +1584,49 @@ install( DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/profile.d ) +############################################################################### +# Install LAMMPS lib and python module into site-packages folder with +# "install-python" target. Behaves exactly like "make install-python" for +# conventional build. Only available, if a shared library is built. +# This is primarily for people that only want to use the Python wrapper. +############################################################################### +if(BUILD_LIB AND BUILD_SHARED_LIBS) + find_package(PythonInterp) + if (PYTHONINTERP_FOUND) + add_custom_target( + install-python + ${PYTHON_EXECUTABLE} install.py -v ${LAMMPS_SOURCE_DIR}/version.h + -m ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py + -l ${CMAKE_BINARY_DIR}/liblammps${CMAKE_SHARED_LIBRARY_SUFFIX} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../python + COMMENT "Installing LAMMPS Python module") + else() + add_custom_target( + install-python + ${CMAKE_COMMAND} -E echo "Must have Python installed to install the LAMMPS Python module") + endif() +else() + add_custom_target( + install-python + ${CMAKE_COMMAND} -E echo "Must build LAMMPS as a shared library to use the Python module") +endif() + +############################################################################### +# Add LAMMPS python module to "install" target. This is taylored for building +# LAMMPS for package managers and with different prefix settings. +# This requires either a shared library or that the PYTHON package is included. +############################################################################### +if((BUILD_LIB AND BUILD_SHARED_LIBS) OR (PKG_PYTHON)) + find_package(PythonInterp) + if (PYTHONINTERP_FOUND) + execute_process(COMMAND ${PYTHON_EXECUTABLE} + -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" + OUTPUT_VARIABLE PYTHON_DEFAULT_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) + set(PYTHON_INSTDIR ${PYTHON_DEFAULT_INSTDIR} CACHE PATH "Installation folder for LAMMPS Python module") + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) + endif() +endif() + ############################################################################### # Testing # @@ -1073,13 +1659,12 @@ endif() ############################################################################### # Print package summary ############################################################################### -foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES}) +foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES} ${OTHER_PACKAGES}) if(PKG_${PKG}) message(STATUS "Building package: ${PKG}") endif() endforeach() -string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE) get_directory_property(CPPFLAGS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS) include(FeatureSummary) feature_summary(DESCRIPTION "The following packages have been found:" WHAT PACKAGES_FOUND) @@ -1095,14 +1680,14 @@ message(STATUS "<<< Build configuration >>> get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) list (FIND LANGUAGES "Fortran" _index) if (${_index} GREATER -1) - message(STATUS "Fortran Compiler ${CMAKE_Fortran_COMPILER} + 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) - message(STATUS "C Compiler ${CMAKE_C_COMPILER} + message(STATUS "C Compiler ${CMAKE_C_COMPILER} Type ${CMAKE_C_COMPILER_ID} Version ${CMAKE_C_COMPILER_VERSION} C Flags ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BTYPE}}") @@ -1110,7 +1695,7 @@ endif() if(CMAKE_EXE_LINKER_FLAGS) message(STATUS "Linker flags: Executable ${CMAKE_EXE_LINKER_FLAGS}") - endif() +endif() if(BUILD_SHARED_LIBS) message(STATUS "Shared libraries ${CMAKE_SHARED_LINKER_FLAGS}") else() @@ -1124,7 +1709,7 @@ if(PKG_GPU) message(STATUS "GPU Api: ${GPU_API}") if(GPU_API STREQUAL "CUDA") message(STATUS "GPU Arch: ${GPU_ARCH}") - elseif(GPU_API STREQUAL "OpenCL") + elseif(GPU_API STREQUAL "OPENCL") message(STATUS "OCL Tune: ${OCL_TUNE}") endif() message(STATUS "GPU Precision: ${GPU_PREC}") diff --git a/cmake/FindLAMMPS.cmake.in b/cmake/FindLAMMPS.cmake.in new file mode 100644 index 0000000000..586df83c2d --- /dev/null +++ b/cmake/FindLAMMPS.cmake.in @@ -0,0 +1,48 @@ +# - Find liblammps +# Find the native liblammps headers and libraries. +# +# The following variables will set: +# LAMMPS_INCLUDE_DIRS - where to find lammps/library.h, etc. +# LAMMPS_LIBRARIES - List of libraries when using lammps. +# LAMMPS_API_DEFINES - lammps library api defines +# LAMMPS_VERSION - lammps library version +# LAMMPS_FOUND - True if liblammps found. +# +# In addition a LAMMPS::LAMMPS imported target is getting created. +# +# LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator +# http://lammps.sandia.gov, Sandia National Laboratories +# Steve Plimpton, sjplimp@sandia.gov +# +# Copyright (2003) Sandia Corporation. Under the terms of Contract +# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains +# certain rights in this software. This software is distributed under +# the GNU General Public License. +# +# See the README file in the top-level LAMMPS directory. +# + +find_package(PkgConfig) + +pkg_check_modules(PC_LAMMPS liblammps@LAMMPS_LIB_SUFFIX@) +find_path(LAMMPS_INCLUDE_DIR lammps/library.h HINTS ${PC_LAMMPS_INCLUDE_DIRS} @CMAKE_INSTALL_FULL_INCLUDEDIR@) + +set(LAMMPS_VERSION @LAMMPS_VERSION@) +set(LAMMPS_API_DEFINES @LAMMPS_API_DEFINES@) + +find_library(LAMMPS_LIBRARY NAMES lammps@LAMMPS_LIB_SUFFIX@ HINTS ${PC_LAMMPS_LIBRARY_DIRS} @CMAKE_INSTALL_FULL_LIBDIR@) + +set(LAMMPS_INCLUDE_DIRS "${LAMMPS_INCLUDE_DIR}") +set(LAMMPS_LIBRARIES "${LAMMPS_LIBRARY}") + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LAMMPS_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(LAMMPS REQUIRED_VARS LAMMPS_LIBRARY LAMMPS_INCLUDE_DIR VERSION_VAR LAMMPS_VERSION) + +mark_as_advanced(LAMMPS_INCLUDE_DIR LAMMPS_LIBRARY) + +if(LAMMPS_FOUND AND NOT TARGET LAMMPS::LAMMPS) + add_library(LAMMPS::LAMMPS UNKNOWN IMPORTED) + set_target_properties(LAMMPS::LAMMPS PROPERTIES IMPORTED_LOCATION "${LAMMPS_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${LAMMPS_INCLUDE_DIR}" INTERFACE_COMPILE_DEFINITIONS "${LAMMPS_API_DEFINES}") +endif() diff --git a/cmake/Modules/FindKIM-API.cmake b/cmake/Modules/FindKIM-API.cmake new file mode 100644 index 0000000000..5108b0f98c --- /dev/null +++ b/cmake/Modules/FindKIM-API.cmake @@ -0,0 +1,59 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the Common Development +# and Distribution License Version 1.0 (the "License"). +# +# You can obtain a copy of the license at +# http://www.opensource.org/licenses/CDDL-1.0. See the License for the +# specific language governing permissions and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each file and +# include the License file in a prominent location with the name LICENSE.CDDL. +# If applicable, add the following below this CDDL HEADER, with the fields +# enclosed by brackets "[]" replaced with your own identifying information: +# +# Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved. +# +# CDDL HEADER END +# + +# +# Copyright (c) 2013--2019, Regents of the University of Minnesota. +# All rights reserved. +# +# Contributors: +# Richard Berger +# Christoph Junghans +# Ryan S. Elliott +# + +# - Find KIM-API +# +# sets standard pkg_check_modules variables plus: +# +# KIM-API-CMAKE_C_COMPILER +# KIM-API-CMAKE_CXX_COMPILER +# KIM-API-CMAKE_Fortran_COMPILER +# + +if(KIM-API_FIND_QUIETLY) + set(REQ_OR_QUI "QUIET") +else() + set(REQ_OR_QUI "REQUIRED") +endif() + +find_package(PkgConfig ${REQ_OR_QUI}) +include(FindPackageHandleStandardArgs) + +pkg_check_modules(KIM-API ${REQ_OR_QUI} libkim-api>=2.0) + +if(KIM-API_FOUND) + pkg_get_variable(KIM-API-CMAKE_C_COMPILER libkim-api CMAKE_C_COMPILER) + pkg_get_variable(KIM-API-CMAKE_CXX_COMPILER libkim-api CMAKE_CXX_COMPILER) + pkg_get_variable(KIM-API_CMAKE_Fortran_COMPILER libkim-api CMAKE_Fortran_COMPILER) +endif() + +# handle the QUIETLY and REQUIRED arguments and set KIM-API_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(KIM-API REQUIRED_VARS KIM-API_LIBRARIES) diff --git a/cmake/Modules/FindKIM.cmake b/cmake/Modules/FindKIM.cmake deleted file mode 100644 index a01f817cf6..0000000000 --- a/cmake/Modules/FindKIM.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# - Find kim -# Find the native KIM headers and libraries. -# -# KIM_INCLUDE_DIRS - where to find kim.h, etc. -# KIM_LIBRARIES - List of libraries when using kim. -# KIM_FOUND - True if kim found. -# - -find_path(KIM_INCLUDE_DIR KIM_API.h PATH_SUFFIXES kim-api-v1) - -find_library(KIM_LIBRARY NAMES kim-api-v1) - -set(KIM_LIBRARIES ${KIM_LIBRARY}) -set(KIM_INCLUDE_DIRS ${KIM_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set KIM_FOUND to TRUE -# if all listed variables are TRUE - -find_package_handle_standard_args(KIM DEFAULT_MSG KIM_LIBRARY KIM_INCLUDE_DIR) - -mark_as_advanced(KIM_INCLUDE_DIR KIM_LIBRARY ) diff --git a/cmake/Modules/FindQUIP.cmake b/cmake/Modules/FindQUIP.cmake index 4ee1baf4f8..b6d87d11fa 100644 --- a/cmake/Modules/FindQUIP.cmake +++ b/cmake/Modules/FindQUIP.cmake @@ -1,8 +1,8 @@ # - Find quip # Find the native QUIP libraries. # -# QUIP_LIBRARIES - List of libraries when using fftw3. -# QUIP_FOUND - True if fftw3 found. +# QUIP_LIBRARIES - List of libraries of the QUIP package +# QUIP_FOUND - True if QUIP library was found. # find_library(QUIP_LIBRARY NAMES quip) diff --git a/cmake/Modules/FindTBB.cmake b/cmake/Modules/FindTBB.cmake new file mode 100644 index 0000000000..8cc050817e --- /dev/null +++ b/cmake/Modules/FindTBB.cmake @@ -0,0 +1,46 @@ +# - Find parts of TBB +# Find the native TBB headers and libraries. +# +# TBB_INCLUDE_DIRS - where to find tbb.h, etc. +# TBB_LIBRARIES - List of libraries when using tbb. +# TBB_FOUND - True if tbb found. +# + +######################################################## +# TBB + +# TODO use more generic FindTBB + +find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h PATHS $ENV{TBBROOT}/include) +find_library(TBB_LIBRARY NAMES tbb PATHS $ENV{TBBROOT}/lib/intel64/gcc4.7 + $ENV{TBBROOT}/lib/intel64/gcc4.4 + $ENV{TBBROOT}/lib/intel64/gcc4.1) +set(TBB_LIBRARIES ${TBB_LIBRARY}) +set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set TBB_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(TBB DEFAULT_MSG TBB_LIBRARY TBB_INCLUDE_DIR) + +mark_as_advanced(TBB_INCLUDE_DIR TBB_LIBRARY ) + +######################################################## +# TBB Malloc + +find_path(TBB_MALLOC_INCLUDE_DIR NAMES tbb/tbb.h PATHS $ENV{TBBROOT}/include) +find_library(TBB_MALLOC_LIBRARY NAMES tbbmalloc PATHS $ENV{TBBROOT}/lib/intel64/gcc4.7 + $ENV{TBBROOT}/lib/intel64/gcc4.4 + $ENV{TBBROOT}/lib/intel64/gcc4.1) + +set(TBB_MALLOC_LIBRARIES ${TBB_MALLOC_LIBRARY}) +set(TBB_MALLOC_INCLUDE_DIRS ${TBB_MALLOC_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set TBB_MALLOC_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(TBB_MALLOC DEFAULT_MSG TBB_MALLOC_LIBRARY TBB_MALLOC_INCLUDE_DIR) + +mark_as_advanced(TBB_MALLOC_INCLUDE_DIR TBB_MALLOC_LIBRARY ) diff --git a/cmake/Modules/FindZMQ.cmake b/cmake/Modules/FindZMQ.cmake new file mode 100644 index 0000000000..608ccda777 --- /dev/null +++ b/cmake/Modules/FindZMQ.cmake @@ -0,0 +1,8 @@ +find_path(ZMQ_INCLUDE_DIR zmq.h) +find_library(ZMQ_LIBRARY NAMES zmq) + +set(ZMQ_LIBRARIES ${ZMQ_LIBRARY}) +set(ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ZMQ DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR) diff --git a/cmake/Modules/PreventInSourceBuilds.cmake b/cmake/Modules/PreventInSourceBuilds.cmake new file mode 100644 index 0000000000..31f2376aa1 --- /dev/null +++ b/cmake/Modules/PreventInSourceBuilds.cmake @@ -0,0 +1,23 @@ +# - Prevent in-source builds. +# https://stackoverflow.com/questions/1208681/with-cmake-how-would-you-disable-in-source-builds/ + +function(prevent_in_source_builds) + # make sure the user doesn't play dirty with symlinks + get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) + get_filename_component(srcdir2 "${CMAKE_SOURCE_DIR}/.." REALPATH) + get_filename_component(srcdir3 "${CMAKE_SOURCE_DIR}/../src" REALPATH) + get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) + + # disallow in-source builds + 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. \ +Rather create a dedicated build directory and run CMake there. \ +To clean up after this aborted in-place compilation: + rm -r CMakeCache.txt CMakeFiles +") + endif() +endfunction() + +prevent_in_source_builds() diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index 29ea372597..ebaa5dae8e 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -48,14 +48,21 @@ function(CreateStyleHeader path filename) set(temp "") if(ARGC GREATER 2) list(REMOVE_AT ARGV 0 1) + set(header_list) foreach(FNAME ${ARGV}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${FNAME}") get_filename_component(FNAME ${FNAME} NAME) + list(APPEND header_list ${FNAME}) + endforeach() + list(SORT header_list) + foreach(FNAME ${header_list}) set(temp "${temp}#include \"${FNAME}\"\n") endforeach() endif() message(STATUS "Generating ${filename}...") file(WRITE "${path}/${filename}.tmp" "${temp}" ) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${path}/${filename}.tmp" "${path}/${filename}") + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${path}/${filename}") endfunction(CreateStyleHeader) function(GenerateStyleHeader path property style) @@ -80,19 +87,27 @@ function(RegisterNPairStyle path) AddStyleHeader(${path} NPAIR) endfunction(RegisterNPairStyle) +function(RegisterFixStyle path) + AddStyleHeader(${path} FIX) +endfunction(RegisterFixStyle) + +function(RegisterIntegrateStyle path) + AddStyleHeader(${path} INTEGRATE) +endfunction(RegisterIntegrateStyle) + function(RegisterStyles search_path) FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid FindStyleHeaders(${search_path} BODY_CLASS body_ BODY ) # body ) # atom_vec_body FindStyleHeaders(${search_path} BOND_CLASS bond_ BOND ) # bond ) # force - FindStyleHeaders(${search_path} COMMAND_CLASS "" COMMAND ) # command ) # input + FindStyleHeaders(${search_path} COMMAND_CLASS "[^.]" COMMAND ) # command ) # input FindStyleHeaders(${search_path} COMPUTE_CLASS compute_ COMPUTE ) # compute ) # modify FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force - FindStyleHeaders(${search_path} INTEGRATE_CLASS "" INTEGRATE ) # integrate ) # update - FindStyleHeaders(${search_path} KSPACE_CLASS "" KSPACE ) # kspace ) # force + FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update + FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force FindStyleHeaders(${search_path} MINIMIZE_CLASS min_ MINIMIZE ) # minimize ) # update FindStyleHeaders(${search_path} NBIN_CLASS nbin_ NBIN ) # nbin ) # neighbor FindStyleHeaders(${search_path} NPAIR_CLASS npair_ NPAIR ) # npair ) # neighbor diff --git a/cmake/Modules/generate_lmpgitversion.cmake b/cmake/Modules/generate_lmpgitversion.cmake new file mode 100644 index 0000000000..a4aa59b262 --- /dev/null +++ b/cmake/Modules/generate_lmpgitversion.cmake @@ -0,0 +1,30 @@ +set(temp "#ifndef LMP_GIT_VERSION_H\n#define LMP_GIT_VERSION_H\n") +set(temp_git_commit "(unknown)") +set(temp_git_branch "(unknown)") +set(temp_git_describe "(unknown)") +set(temp_git_info "false") +if(GIT_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git) + set(temp_git_info "true") + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/.. rev-parse HEAD + OUTPUT_VARIABLE temp_git_commit + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/.. rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE temp_git_branch + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/.. describe --dirty=-modified + OUTPUT_VARIABLE temp_git_describe + ERROR_QUIET + 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}#endif\n\n") + +message(STATUS "Generating lmpgitversion.h...") +file(WRITE "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h.tmp" "${temp}" ) +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h.tmp" "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h") diff --git a/cmake/README.md b/cmake/README.md index b6644ffda9..a635f3e06d 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -24,7 +24,7 @@ tasks, act as a reference and provide examples of typical use cases. * [Build directory vs. Source Directory](#build-directory-vs-source-directory) * [Defining and using presets](#defining-and-using-presets) * [Reference](#reference) - * [Common CMAKE Configuration Options](#common-cmake-configuration-options) + * [Common CMake Configuration Options](#common-cmake-configuration-options) * [LAMMPS Configuration Options](#lammps-configuration-options) * [Parallelization and Accelerator Packages](#parallelization-and-accelerator-packages) * [Default Packages](#default-packages) @@ -62,7 +62,7 @@ should get you started. git clone https://github.com/lammps/lammps.git mkdir lammps/build cd lammps/build -cmake ../cmake [-DOPTION_A=VALUE_A -DOPTION_B=VALUE_B ...] +cmake [-D OPTION_A=VALUE_A -D OPTION_B=VALUE_B ...] ../cmake make ``` @@ -155,11 +155,13 @@ make The CMake build exposes a lot of different options. In the old build system some of the package selections were possible by using special make target like -`make yes-std` or `make no-lib`. Achieving the same result with cmake requires +`make yes-std` or `make no-lib`. Achieving a similar result with cmake requires specifying all options manually. This can quickly become a very long command line that is hard to handle. While these could be stored in a simple script file, there is another way of defining "presets" to compile LAMMPS in a certain -way. +way. Since the cmake build process - contrary to the conventional build system - +includes the compilation of the bundled libraries into the standard build process, +the grouping of those presets is somewhat different. A preset is a regular CMake script file that can use constructs such as variables, lists and for-loops to manipulate configuration options and create @@ -171,15 +173,15 @@ Such a file can then be passed to cmake via the `-C` flag. Several examples of presets can be found in the `cmake/presets` folder. ```bash -# build LAMMPS with all "standard" packages which don't use libraries and enable GPU package +# build LAMMPS with all packages enabled which don't use external libraries and enable GPU package mkdir build cd build -cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on +cmake -C ../cmake/presets/all_on.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on ../cmake ``` # Reference -## Common CMAKE Configuration Options +## Common CMake Configuration Options @@ -195,6 +197,7 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on @@ -207,6 +210,16 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on + + + + +
CMAKE_INSTALL_PREFIX Install location where LAMMPS files will be copied to. In the Unix/Linux case with Makefiles this controls what `make install` will do. + Default setting is $HOME/.local.
Enable verbose output from Makefile builds (useful for debugging), the same can be achived by adding `VERBOSE=1` to the `make` call. +
+
off (default)
+
on
+
+
@@ -265,6 +278,26 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on + + BUILD_LIB + control whether to build LAMMPS as a library + +
+
off (default)
+
on
+
+ + + + BUILD_EXE + control whether to build LAMMPS executable + +
+
on (default)
+
off
+
+ + BUILD_SHARED_LIBS control whether to build LAMMPS as a shared-library @@ -315,8 +348,8 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on `mpicxx` in your path and use this MPI implementation.
-
off (default)
-
on
+
on (default, if found)
+
off
@@ -325,8 +358,8 @@ cmake -C ../cmake/presets/std_nolib.cmake ../cmake -DPKG_GPU=on control whether to build LAMMPS with OpenMP support.
-
off (default)
-
on
+
on (default, if found)
+
off
@@ -1271,7 +1304,7 @@ providing the identical features and USER interface.

-
KISSFFT
+
KISS
FFTW3
FFTW2
MKL
@@ -1279,13 +1312,13 @@ providing the identical features and USER interface.

- PACK_ARRAY + FFT_PACK Optimization for FFT
-
PACK_ARRAY
-
PACK_POINTER
-
PACK_MEMCPY
+
array (default)
+
pointer
+
memcpy
@@ -1377,6 +1410,40 @@ TODO ### PYTHON Package +### USER-INTEL Package + + + + + + + + + + + + + + + + + + + + + +
OptionDescriptionValues
INTEL_ARCHTarget architecture for USER-INTEL package +
+
cpu (default)
+
knl
+
+
INTEL_LRT_MODEHow to support Long-range thread mode in Verlet integration +
+
threads (default, if pthreads available)
+
none (default, if pthreads not available)
+
c++11
+
+
### GPU Package The GPU package builds a support library which can either use OpenCL or CUDA as @@ -1396,8 +1463,8 @@ target API. API used by GPU package
-
OpenCL (default)
-
CUDA
+
opencl (default)
+
cuda
@@ -1406,9 +1473,9 @@ target API. Precision size used by GPU package kernels
-
SINGLE_DOUBLE
-
SINGLE_SINGLE
-
DOUBLE_DOUBLE
+
mixed (default)
+
single
+
double
@@ -1417,12 +1484,12 @@ target API. Tuning target for OpenCL driver code
-
GENERIC (default)
-
INTEL (Intel CPU)
-
PHI (Intel Xeon Phi)
-
FERMI (NVIDIA)
-
KEPLER (NVIDIA)
-
CYPRESS (AMD)
+
generic (default)
+
intel (Intel CPU)
+
phi (Intel Xeon Phi)
+
fermi (NVIDIA)
+
kepler (NVIDIA)
+
cypress (AMD)
@@ -1449,6 +1516,21 @@ target API.
+ + CUDA_MPS_SUPPORT (CUDA only) + Enable tweaks for running with Nvidia CUDA Multi-process services daemon + +
+
on
+
off (default)
+
+ + + + BIN2C (CUDA only) + Path to bin2c executable, will automatically pick up the first one in your $PATH. + (automatic) + @@ -1517,6 +1599,16 @@ Requires a Eigen3 installation + + WITH_JPEG + Enables/Disable JPEG support in LAMMPS + +
+
yes (default, if found)
+
no
+
+ + JPEG_INCLUDE_DIR @@ -1544,6 +1636,16 @@ Requires a Eigen3 installation + + WITH_PNG + Enables/Disable PNG support in LAMMPS + +
+
yes (default, if found)
+
no
+
+ + PNG_INCLUDE_DIR @@ -1573,11 +1675,20 @@ requires `gzip` to be in your `PATH` - GZIP_EXECUTABLE - + WITH_GZIP + Enables/Disable GZIP support in LAMMPS +
+
yes (default, if found)
+
no
+
+ + GZIP_EXECUTABLE + Path to gzip executable, will automatically pick up the first one in your $PATH. + (automatic) + @@ -1595,19 +1706,33 @@ requires `ffmpeg` to be in your `PATH` - FFMPEG_EXECUTABLE - + WITH_FFMPEG + Enables/Disable FFMPEG support in LAMMPS +
+
yes (default, if found)
+
no
+
+ + FFMPEG_EXECUTABLE + Path to ffmpeg executable, will automatically pick up the first one in your $PATH. + (automatic) + ## Compilers -By default, `cmake` will use your environment C/C++/Fortran compilers for a build. It uses the `CC`, `CXX` and `FC` environment variables to detect which compilers should be used. However, these values -will be cached after the first run of `cmake`. Subsequent runs of `cmake` will ignore changes in these environment variables. To ensure the correct values are used you avoid the cache by setting the `CMAKE_C_COMPILER`, `CMAKE_CXX_COMPILER`, `CMAKE_Fortran_COMPILER` options directly. +By default, `cmake` will use your environment C/C++/Fortran compilers for a +build. It uses the `CC`, `CXX` and `FC` environment variables to detect which +compilers should be used. However, these values will be cached after the first +run of `cmake`. Subsequent runs of `cmake` will ignore changes in these +environment variables. To ensure the correct values are used you avoid the +cache by setting the `CMAKE_C_COMPILER`, `CMAKE_CXX_COMPILER`, +`CMAKE_Fortran_COMPILER` options directly. @@ -1637,26 +1762,33 @@ will be cached after the first run of `cmake`. Subsequent runs of `cmake` will i value of `FC` environment variable at first `cmake` run + + + + +
CXX_COMPILER_LAUNCHERCMake will run this tool and pass the compiler and its arguments to the tool. Some example tools are distcc and ccache. + (empty) +
### Building with GNU Compilers ```bash -cmake ../cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran +cmake -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ -D CMAKE_Fortran_COMPILER=gfortran ../cmake ``` ### Building with Intel Compilers ```bash -cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort +cmake -D CMAKE_C_COMPILER=icc -D CMAKE_CXX_COMPILER=icpc -D CMAKE_Fortran_COMPILER=ifort ../cmake ``` ### Building with LLVM/Clang Compilers ```bash -cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang +cmake -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_Fortran_COMPILER=flang ../cmake ``` diff --git a/cmake/etc/profile.d/lammps.csh.in b/cmake/etc/profile.d/lammps.csh.in index def49bf75c..42f222d67c 100644 --- a/cmake/etc/profile.d/lammps.csh.in +++ b/cmake/etc/profile.d/lammps.csh.in @@ -1,2 +1,4 @@ -# set environment for LAMMPS executables to find potential files +# set environment for LAMMPS and msi2lmp executables +# to find potential and force field files if ( "$?LAMMPS_POTENTIALS" == 0 ) setenv LAMMPS_POTENTIALS @LAMMPS_POTENTIALS_DIR@ +if ( "$?MSI2LMP_LIBRARY" == 0 ) setenv MSI2LMP_LIBRARY @LAMMPS_FRC_FILES_DIR@ diff --git a/cmake/etc/profile.d/lammps.sh.in b/cmake/etc/profile.d/lammps.sh.in index acd75fa0cf..c1967cb5b2 100644 --- a/cmake/etc/profile.d/lammps.sh.in +++ b/cmake/etc/profile.d/lammps.sh.in @@ -1,2 +1,5 @@ -# set environment for LAMMPS executables to find potential files -export LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS-@LAMMPS_POTENTIALS_DIR@} +# set environment for LAMMPS and msi2lmp executables +# to find potential and force field files +LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS-@LAMMPS_POTENTIALS_DIR@} +MSI2LMP_LIBRARY=${MSI2LMP_LIBRARY-@LAMMPS_FRC_FILES_DIR@} +export LAMMPS_POTENTIALS MSI2LMP_LIBRARY diff --git a/cmake/pkgconfig/liblammps.pc.in b/cmake/pkgconfig/liblammps.pc.in index 400b7593cf..a8710ca224 100644 --- a/cmake/pkgconfig/liblammps.pc.in +++ b/cmake/pkgconfig/liblammps.pc.in @@ -1,18 +1,38 @@ # pkg-config file for lammps # https://people.freedesktop.org/~dbn/pkg-config-guide.html -# Usage: cc `pkg-config --cflags --libs liblammps` -o myapp myapp.c -# after you added @CMAKE_INSTALL_FULL_LIBDIR@/pkg-config to PKG_CONFIG_PATH, + +# Add the directory where lammps.pc got installed to your PKG_CONFIG_PATH # e.g. export PKG_CONFIG_PATH=@CMAKE_INSTALL_FULL_LIBDIR@/pkgconfig -prefix=@CMAKE_INSTALL_FULL_PREFIX@ +# Use this on commandline with: +# c++ `pkg-config --cflags --libs lammps` -o myapp myapp.cpp + +# Use this in a Makefile: +# myapp: myapp.cpp +# $(CC) `pkg-config --cflags --libs lammps` -o $@ $< + +# Use this in autotools: +# configure.ac: +# PKG_CHECK_MODULES([LAMMPS], [lammps]) +# Makefile.am: +# myapp_CFLAGS = $(LAMMPS_CFLAGS) +# myapp_LDADD = $(LAMMPS_LIBS) + +# Use this in CMake: +# CMakeLists.txt: +# find_package(PkgConfig) +# pkg_check_modules(LAMMPS IMPORTED_TARGET lammps) +# target_link_libraries( PkgConfig::LAMMPS) + +prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: liblammps@LAMMPS_MACHINE@ Description: Large-scale Atomic/Molecular Massively Parallel Simulator Library URL: http://lammps.sandia.gov -Version: +Version: @LAMMPS_VERSION@ Requires: -Libs: -L${libdir} -llammps@LIB_SUFFIX@@ +Libs: -L${libdir} -llammps@LAMMPS_LIB_SUFFIX@ Libs.private: -lm Cflags: -I${includedir} @LAMMPS_API_DEFINES@ diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index f7e90ddbb4..9d03be99ec 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -1,21 +1,17 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) +# preset that turns on all existing packages off. can be used to reset +# an existing package selection without losing any other settings -set(USER_PACKAGES 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-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) +set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU + GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MESSAGE 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-MESO + 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-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH + USER-TALLY USER-UEF USER-VTK USER-YAFF) foreach(PKG ${ALL_PACKAGES}) set(PKG_${PKG} OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 2c6f67904e..2ff107975a 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -1,21 +1,19 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) +# 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 +# with just a working C++ compiler and an MPI library. -set(USER_PACKAGES 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-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) +set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU + GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MISC MESSAGE 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-MESO + 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-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH + USER-TALLY USER-UEF USER-VTK USER-YAFF) foreach(PKG ${ALL_PACKAGES}) set(PKG_${PKG} ON CACHE BOOL "" FORCE) diff --git a/cmake/presets/clang.cmake b/cmake/presets/clang.cmake new file mode 100644 index 0000000000..828f359f54 --- /dev/null +++ b/cmake/presets/clang.cmake @@ -0,0 +1,17 @@ +# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes) + +set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE) +set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS "-Wall -Wextra -g -O2 -DNDEBG" CACHE STRING "" FORCE) +set(MPI_CXX "clang++" CACHE STRING "" FORCE) +set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) +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) +set(OpenMP_CXX "clang++" CACHE STRING "" FORCE) +set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE) +set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE) +set(OpenMP_omp_LIBRARY "/usr/lib64/libomp.so" CACHE PATH "" FORCE) + diff --git a/cmake/presets/manual_selection.cmake b/cmake/presets/manual_selection.cmake deleted file mode 100644 index 6c03d983f6..0000000000 --- a/cmake/presets/manual_selection.cmake +++ /dev/null @@ -1,69 +0,0 @@ -set(PKG_ASPHERE OFF CACHE BOOL "" FORCE) -set(PKG_BODY OFF CACHE BOOL "" FORCE) -set(PKG_CLASS2 OFF CACHE BOOL "" FORCE) -set(PKG_COLLOID OFF CACHE BOOL "" FORCE) -set(PKG_COMPRESS OFF CACHE BOOL "" FORCE) -set(PKG_CORESHELL OFF CACHE BOOL "" FORCE) -set(PKG_DIPOLE OFF CACHE BOOL "" FORCE) -set(PKG_GPU OFF CACHE BOOL "" FORCE) -set(PKG_GRANULAR OFF CACHE BOOL "" FORCE) -set(PKG_KIM OFF CACHE BOOL "" FORCE) -set(PKG_KOKKOS OFF CACHE BOOL "" FORCE) -set(PKG_KSPACE OFF CACHE BOOL "" FORCE) -set(PKG_LATTE OFF CACHE BOOL "" FORCE) -set(PKG_LIB OFF CACHE BOOL "" FORCE) -set(PKG_MANYBODY OFF CACHE BOOL "" FORCE) -set(PKG_MC OFF CACHE BOOL "" FORCE) -set(PKG_MEAM OFF CACHE BOOL "" FORCE) -set(PKG_MISC OFF CACHE BOOL "" FORCE) -set(PKG_MOLECULE OFF CACHE BOOL "" FORCE) -set(PKG_MPIIO OFF CACHE BOOL "" FORCE) -set(PKG_MSCG OFF CACHE BOOL "" FORCE) -set(PKG_OPT OFF CACHE BOOL "" FORCE) -set(PKG_PERI OFF CACHE BOOL "" FORCE) -set(PKG_POEMS OFF CACHE BOOL "" FORCE) -set(PKG_PYTHOFF OFF CACHE BOOL "" FORCE) -set(PKG_QEQ OFF CACHE BOOL "" FORCE) -set(PKG_REAX OFF CACHE BOOL "" FORCE) -set(PKG_REPLICA OFF CACHE BOOL "" FORCE) -set(PKG_RIGID OFF CACHE BOOL "" FORCE) -set(PKG_SHOCK OFF CACHE BOOL "" FORCE) -set(PKG_SNAP OFF CACHE BOOL "" FORCE) -set(PKG_SRD OFF CACHE BOOL "" FORCE) -set(PKG_VOROFFOI OFF CACHE BOOL "" FORCE) - -set(PKG_USER OFF CACHE BOOL "" FORCE) -set(PKG_USER-ATC OFF CACHE BOOL "" FORCE) -set(PKG_USER-AWPMD OFF CACHE BOOL "" FORCE) -set(PKG_USER-BOCS OFF CACHE BOOL "" FORCE) -set(PKG_USER-CGDNA OFF CACHE BOOL "" FORCE) -set(PKG_USER-CGSDK OFF CACHE BOOL "" FORCE) -set(PKG_USER-COLVARS OFF CACHE BOOL "" FORCE) -set(PKG_USER-DIFFRACTIOFF OFF CACHE BOOL "" FORCE) -set(PKG_USER-DPD OFF CACHE BOOL "" FORCE) -set(PKG_USER-DRUDE OFF CACHE BOOL "" FORCE) -set(PKG_USER-EFF OFF CACHE BOOL "" FORCE) -set(PKG_USER-FEP OFF CACHE BOOL "" FORCE) -set(PKG_USER-H5MD OFF CACHE BOOL "" FORCE) -set(PKG_USER-INTEL OFF CACHE BOOL "" FORCE) -set(PKG_USER-LB OFF CACHE BOOL "" FORCE) -set(PKG_USER-MANIFOLD OFF CACHE BOOL "" FORCE) -set(PKG_USER-MEAMC OFF CACHE BOOL "" FORCE) -set(PKG_USER-MESO OFF CACHE BOOL "" FORCE) -set(PKG_USER-MGPT OFF CACHE BOOL "" FORCE) -set(PKG_USER-MISC OFF CACHE BOOL "" FORCE) -set(PKG_USER-MOFFF OFF CACHE BOOL "" FORCE) -set(PKG_USER-MOLFILE OFF CACHE BOOL "" FORCE) -set(PKG_USER-NETCDF OFF CACHE BOOL "" FORCE) -set(PKG_USER-OMP OFF CACHE BOOL "" FORCE) -set(PKG_USER-PHOFFOFF OFF CACHE BOOL "" FORCE) -set(PKG_USER-QMMM OFF CACHE BOOL "" FORCE) -set(PKG_USER-QTB OFF CACHE BOOL "" FORCE) -set(PKG_USER-QUIP OFF CACHE BOOL "" FORCE) -set(PKG_USER-REAXC OFF CACHE BOOL "" FORCE) -set(PKG_USER-SMD OFF CACHE BOOL "" FORCE) -set(PKG_USER-SMTBQ OFF CACHE BOOL "" FORCE) -set(PKG_USER-SPH OFF CACHE BOOL "" FORCE) -set(PKG_USER-TALLY OFF CACHE BOOL "" FORCE) -set(PKG_USER-UEF OFF CACHE BOOL "" FORCE) -set(PKG_USER-VTK OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake new file mode 100644 index 0000000000..b53e5a7b93 --- /dev/null +++ b/cmake/presets/mingw-cross.cmake @@ -0,0 +1,17 @@ +set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU + GRANULAR KSPACE MANYBODY MC MISC 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-MESO USER-MISC USER-MOFFF USER-MOLFILE USER-OMP + USER-PHONON USER-PTM USER-QTB USER-REAXC USER-SDPD USER-SMD + USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-YAFF) + +foreach(PKG ${WIN_PACKAGES}) + set(PKG_${PKG} ON CACHE BOOL "" FORCE) +endforeach() + +set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) +set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) +set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE) +set(INTEL_LRT_MODE "none" CACHE STRING "" FORCE) diff --git a/cmake/presets/minimal.cmake b/cmake/presets/minimal.cmake new file mode 100644 index 0000000000..e9ce6d6103 --- /dev/null +++ b/cmake/presets/minimal.cmake @@ -0,0 +1,8 @@ +# preset that turns on just a few, frequently used packages +# this will be compiled quickly and handle a lot of common inputs. + +set(ALL_PACKAGES KSPACE MANYBODY MOLECULE RIGID) + +foreach(PKG ${ALL_PACKAGES}) + set(PKG_${PKG} ON CACHE BOOL "" FORCE) +endforeach() diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake new file mode 100644 index 0000000000..35ad7ba55c --- /dev/null +++ b/cmake/presets/most.cmake @@ -0,0 +1,15 @@ +# preset that turns on a wide range of packages, some of which require +# 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 CLASS2 COLLOID CORESHELL DIPOLE + GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI + PYTHON QEQ REPLICA RIGID SHOCK SRD VORONOI + USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD + USER-DRUDE USER-FEP USER-MEAMC USER-MESO + USER-MISC USER-MOFFF USER-OMP USER-PLUMED USER-PHONON USER-REAXC + USER-SPH USER-SMD USER-UEF USER-YAFF) + +foreach(PKG ${ALL_PACKAGES}) + set(PKG_${PKG} ON CACHE BOOL "" FORCE) +endforeach() diff --git a/cmake/presets/nolib.cmake b/cmake/presets/nolib.cmake index cd603aa804..c0968a8d82 100644 --- a/cmake/presets/nolib.cmake +++ b/cmake/presets/nolib.cmake @@ -1,21 +1,10 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) +# preset that turns off all packages that require some form of external +# library or special compiler (fortran or cuda) or equivalent. -set(USER_PACKAGES 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-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) +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-NETCDF USER-PLUMED USER-QMMM USER-QUIP + USER-SCAFACOS USER-SMD USER-VTK) foreach(PKG ${PACKAGES_WITH_LIB}) set(PKG_${PKG} OFF CACHE BOOL "" FORCE) diff --git a/cmake/presets/std.cmake b/cmake/presets/std.cmake deleted file mode 100644 index 36da897957..0000000000 --- a/cmake/presets/std.cmake +++ /dev/null @@ -1,22 +0,0 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) - -set(USER_PACKAGES 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-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) - -foreach(PKG ${STANDARD_PACKAGES}) - set(PKG_${PKG} ON CACHE BOOL "" FORCE) -endforeach() diff --git a/cmake/presets/std_nolib.cmake b/cmake/presets/std_nolib.cmake deleted file mode 100644 index 9bffefcbe0..0000000000 --- a/cmake/presets/std_nolib.cmake +++ /dev/null @@ -1,26 +0,0 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) - -set(USER_PACKAGES 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-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) - -foreach(PKG ${STANDARD_PACKAGES}) - set(PKG_${PKG} ON CACHE BOOL "" FORCE) -endforeach() - -foreach(PKG ${PACKAGES_WITH_LIB}) - set(PKG_${PKG} OFF CACHE BOOL "" FORCE) -endforeach() diff --git a/cmake/presets/user.cmake b/cmake/presets/user.cmake deleted file mode 100644 index cb81b67558..0000000000 --- a/cmake/presets/user.cmake +++ /dev/null @@ -1,22 +0,0 @@ -set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MEAM MISC - MOLECULE MPIIO MSCG OPT PERI POEMS - PYTHON QEQ REAX REPLICA RIGID SHOCK SNAP SRD VORONOI) - -set(USER_PACKAGES 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-MESO - USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE - USER-NETCDF USER-OMP USER-PHONON USER-QMMM USER-QTB - USER-QUIP USER-REAXC USER-SMD USER-SMTBQ USER-SPH USER-TALLY - USER-UEF USER-VTK) - -set(PACKAGES_WITH_LIB COMPRESS GPU KIM KOKKOS LATTE MEAM MPIIO MSCG POEMS PYTHON REAX VORONOI - USER-ATC USER-AWPMD USER-COLVARS USER-H5MD USER-LB USER-MOLFILE - USER-NETCDF USER-QMMM USER-QUIP USER-SMD USER-VTK) - -set(ALL_PACKAGES ${STANDARD_PACKAGES} ${USER_PACKAGES}) - -foreach(PKG ${USER_PACKAGES}) - set(PKG_${PKG} ON CACHE BOOL "" FORCE) -endforeach() diff --git a/doc/.gitignore b/doc/.gitignore index 7d30949237..88679898a8 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,4 +1,6 @@ +/old /html +/latex /spelling /LAMMPS.epub /LAMMPS.mobi diff --git a/doc/Makefile b/doc/Makefile index 81f3623499..fa60aa3698 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,7 +1,7 @@ # Makefile for LAMMPS documentation -SHELL = /bin/bash -SHA1 = $(shell echo $USER-$PWD | python utils/sha1sum.py) +SHELL = /bin/bash +SHA1 = $(shell echo ${USER}-${PWD} | python utils/sha1sum.py) BUILDDIR = /tmp/lammps-docs-$(SHA1) RSTDIR = $(BUILDDIR)/rst VENV = $(BUILDDIR)/docenv @@ -31,21 +31,24 @@ SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocess SOURCES=$(filter-out $(wildcard src/lammps_commands*.txt) src/lammps_support.txt src/lammps_tutorials.txt,$(wildcard src/*.txt)) OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst) -.PHONY: help clean-all clean epub html pdf old venv spelling anchor_check +.PHONY: help clean-all clean epub mobi html pdf old venv spelling anchor_check # ------------------------------------------ help: @echo "Please use \`make ' where is one of" @echo " html create HTML doc pages in html dir" - @echo " pdf create Manual.pdf and Developer.pdf in this dir" - @echo " old create old-style HTML doc pages in old dir" + @echo " pdf create Developer.pdf and Manual.pdf in this dir" + @echo " old create old-style HTML doc pages and Manual.pdf in old dir" @echo " fetch fetch HTML and PDF files from LAMMPS web site" @echo " epub create ePUB format manual for e-book readers" + @echo " mobi convert ePUB to MOBI format manual for e-book readers (e.g. Kindle)" + @echo " (requires ebook-convert tool from calibre)" @echo " clean remove all intermediate RST files" @echo " clean-all reset the entire build environment" @echo " txt2html build txt2html tool" @echo " anchor_check scan for duplicate anchor labels" + @echo " spelling spell-check the manual" # ------------------------------------------ @@ -53,7 +56,7 @@ clean-all: clean rm -rf $(BUILDDIR)/* utils/txt2html/txt2html.exe clean: - rm -rf $(RSTDIR) html old epub + rm -rf $(RSTDIR) html old epub latex rm -rf spelling clean-spelling: @@ -93,9 +96,10 @@ spelling: $(OBJECTS) utils/sphinx-config/false_positives.txt @echo "Spell check finished." epub: $(OBJECTS) - @mkdir -p epub + @mkdir -p epub/JPG @rm -f LAMMPS.epub @cp src/JPG/lammps-logo.png epub/ + @cp src/JPG/*.* epub/JPG @(\ . $(VENV)/bin/activate ;\ cp -r src/* $(RSTDIR)/ ;\ @@ -106,21 +110,49 @@ epub: $(OBJECTS) @rm -rf epub @echo "Build finished. The ePUB manual file is created." -pdf: utils/txt2html/txt2html.exe +mobi: epub + @rm -f LAMMPS.mobi + @ebook-convert LAMMPS.epub LAMMPS.mobi + @echo "Conversion finished. The MOBI manual file is created." + +pdf: $(OBJECTS) $(ANCHORCHECK) @(\ - set -e; \ - cd src; \ - ../utils/txt2html/txt2html.exe -b *.txt; \ - htmldoc --batch lammps.book; \ - for s in `echo *.txt | sed -e 's,\.txt,\.html,g'` ; \ - do grep -q $$s lammps.book || \ - echo doc file $$s missing in src/lammps.book; done; \ - rm *.html; \ - cd Developer; \ + cd src/Developer; \ pdflatex developer; \ pdflatex developer; \ mv developer.pdf ../../Developer.pdf; \ + cd ../../; \ ) + @(\ + . $(VENV)/bin/activate ;\ + cp -r src/* $(RSTDIR)/ ;\ + sphinx-build $(SPHINXEXTRA) -b latex -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\ + echo "############################################" ;\ + doc_anchor_check src/*.txt ;\ + echo "############################################" ;\ + deactivate ;\ + ) + @cd latex && \ + sed 's/latexmk -pdf -dvi- -ps-/pdflatex/g' Makefile > temp && \ + mv temp Makefile && \ + sed 's/\\begin{equation}//g' LAMMPS.tex > tmp.tex && \ + mv tmp.tex LAMMPS.tex && \ + sed 's/\\end{equation}//g' LAMMPS.tex > tmp.tex && \ + mv tmp.tex LAMMPS.tex && \ + make && \ + make && \ + mv LAMMPS.pdf ../Manual.pdf && \ + cd ../; + @rm -rf latex/_sources + @rm -rf latex/PDF + @rm -rf latex/USER + @cp -r src/PDF latex/PDF + @cp -r src/USER latex/USER + @rm -rf latex/PDF/.[sg]* + @rm -rf latex/USER/.[sg]* + @rm -rf latex/USER/*/.[sg]* + @rm -rf latex/USER/*/*.[sg]* + @echo "Build finished. Manual.pdf and Developer.pdf are in this directory." old: utils/txt2html/txt2html.exe @rm -rf old @@ -130,6 +162,18 @@ old: utils/txt2html/txt2html.exe cp Eqs/*.jpg ../old/Eqs; \ cp JPG/* ../old/JPG; \ cp PDF/* ../old/PDF; + @( set -e;\ + cd src/Developer; \ + pdflatex developer; \ + pdflatex developer; \ + mv developer.pdf ../../old/Developer.pdf; \ + cd ../../old; \ + for s in `echo ../src/*.txt | sed -e 's,\.\./src/,,g' -e 's/ \(pairs\|bonds\|angles\|dihedrals\|impropers\|commands_list\|fixes\|computes\).txt/ /g' | sed -e 's,\.txt,\.html,g'` ; \ + do grep -q ^$$s ../src/lammps.book || \ + echo WARNING: doc file $$s missing in src/lammps.book; done; \ + htmldoc --batch ../src/lammps.book; \ + ) + fetch: @rm -rf html_www Manual_www.pdf Developer_www.pdf @@ -167,8 +211,7 @@ $(VENV): @( \ $(VIRTUALENV) -p $(PYTHON) $(VENV); \ . $(VENV)/bin/activate; \ - pip install Sphinx; \ - pip install sphinxcontrib-images; \ + pip install Sphinx==1.7.6; \ deactivate;\ ) diff --git a/doc/github-development-workflow.md b/doc/github-development-workflow.md new file mode 100644 index 0000000000..ee64703707 --- /dev/null +++ b/doc/github-development-workflow.md @@ -0,0 +1,196 @@ +# Outline of the GitHub Development Workflow + +This purpose of this document is to provide a point of reference for the +core LAMMPS developers and other LAMMPS contributors to understand the +choices the LAMMPS developers have agreed on. Git and GitHub provide the +tools, but do not set policies, so it is up to the developers to come to +an agreement as to how to define and interpret policies. This document +is likely to change as our experiences and needs change and we try to +adapt accordingly. Last change 2018-12-19. + +## Table of Contents + + * [GitHub Merge Management](#github-merge-management) + * [Pull Requests](#pull-requests) + * [Pull Request Assignments](#pull-request-assignments) + * [Pull Request Reviews](#pull-request-reviews) + * [Pull Request Discussions](#pull-request-discussions) + * [Checklist for Pull Requests](#checklist-for-pull-requests) + * [GitHub Issues](#github-issues) + * [Milestones and Release Planning](#milestones-and-release-planning) + +## GitHub Merge Management + +In the interest of consistency, ONLY ONE of the core LAMMPS developers +should doing the merging itself. This is currently +[@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer). +If this assignment needs to be changed, it shall be done right after a +stable release. If the currently assigned developer cannot merge outstanding pull +requests in a timely manner, or in other extenuating circumstances, +other core LAMMPS developers with merge rights can merge pull requests, +when necessary. + +## Pull Requests + +ALL changes to the LAMMPS code and documentation, however trivial, MUST +be submitted as a pull request to GitHub. All changes to the "master" +branch must be made exclusively through merging pull requests. The +"unstable" and "stable" branches, respectively are only to be updated +upon patch or stable releases with fast-forward merges based on the +associated tags. Pull requests may also be submitted to (long-running) +feature branches created by LAMMPS developers inside the LAMMPS project, +if needed. Those are not subject to the merge and review restrictions +discussed in this document, though, but get managed as needed on a +case-by-case basis. + +### Pull Request Assignments + +Pull requests can be "chaperoned" by one of the LAMMPS core developers. +This is indicated by who the pull request is assigned to. LAMMPS core +developers can self-assign or they can decide to assign a pull request +to a different LAMMPS developer. Being assigned to a pull request means, +that this pull request may need some work and the assignee is tasked to +determine whether this might be needed or not, and may either implement +the required changes or ask the submitter of the pull request to implement +them. Even though, all LAMMPS developers may have write access to pull +requests (if enabled by the submitter, which is the default), only the +submitter or the assignee of a pull request may do so. During this +period the `work_in_progress` label shall be applied to the pull +request. The assignee gets to decide what happens to the pull request +next, e.g. whether it should be assigned to a different developer for +additional checks and changes, or is recommended to be merged. Removing +the `work_in_progress` label and assigning the pull request to the +developer tasked with merging signals that a pull request is ready to be +merged. + +### Pull Request Reviews + +People can be assigned to review a pull request in two ways: + + * They can be assigned manually to review a pull request + by the submitter or a LAMMPS developer + * They can be automatically assigned, because a developers matches + a file pattern in the `.github/CODEOWNERS` file, which associates + developers with the code they contributed and maintain. + +Reviewers are requested to state their appraisal of the proposed changes +and either approve or request changes. People may unassign themselves +from review, if they feel not competent about the changes proposed. At +least two approvals from LAMMPS developers with write access are required +before merging in addition to the automated compilation tests. +Merging counts as implicit approval, so does submission of a pull request +(by a LAMMPS developer). So the person doing the merge may not also submit +an approving review. The feature, that reviews from code owners are "hard" +reviews (i.e. they must all be approved before merging is allowed), is +currently disabled and it is in the discretion of the merge maintainer to +assess when a sufficient degree of approval, especially from external +contributors, has been reached in these cases. Reviews may be +(automatically) dismissed, when the reviewed code has been changed, +and then approval is required a second time. + +### Pull Request Discussions + +All discussions about a pull request should be kept as much as possible +on the pull request discussion page on GitHub, so that other developers +can later review the entire discussion after the fact and understand the +rationale behind choices made. Exceptions to this policy are technical +discussions, that are centered on tools or policies themselves +(git, github, c++) rather than on the content of the pull request. + +### Checklist for Pull Requests + +Here are some items to check: + * source and text files should not have CR/LF line endings (use dos2unix to remove) + * every new command or style should have documentation. The names of + source files (c++ and manual) should follow the name of the style. + (example: `src/fix_nve.cpp`, `src/fix_nve.h` for `fix nve` command, + implementing the class `FixNVE`, documented in `doc/src/fix_nve.txt`) + * all new style names should be lower case, the must be no dashes, + blanks, or underscores separating words, only forward slashes. + * new style docs should be added to the "overview" files in + `doc/src/Commands_*.txt`, `doc/src/{fixes,computes,pairs,bonds,...}.txt` + and `doc/src/lammps.book` + * check whether manual cleanly translates with `make html` and `make pdf` + * check spelling of manual with `make spelling` in doc folder + * new source files in packages should be added to `src/.gitignore` + * removed or renamed files in packages should be added to `src/Purge.list` + * C++ source files should use C++ style include files for accessing + C-library APIs, e.g. `#include ` instead of `#include `. + And they should use angular brackets instead of double quotes. Full list: + * assert.h -> cassert + * ctype.h -> cctype + * errno.h -> cerrno + * float.h -> cfloat + * limits.h -> climits + * math.h -> cmath + * complex.h -> complex + * setjmp.h -> csetjmp + * signal.h -> csignal + * stddef.h -> cstddef + * stdint.h -> cstdint + * stdio.h -> cstdio + * stdlib.h -> cstdlib + * string.h -> cstring + * time.h -> ctime + * Do NOT replace (as they are C++-11): `inttypes.h` and `stdint.h`. + * Code should follow the C++-98 standard. C++-11 is only accepted + in individual special purpose packages + * indentation is 2 spaces per level + * there should be NO tabs and no trailing whitespace + * header files, especially of new styles, should not include any + other headers, except the header with the base class or cstdio. + Forward declarations should be used instead when possible. + * iostreams should be avoided. LAMMPS uses stdio from the C-library. + * use of STL in headers and class definitions should be avoided. + * there MUST NOT be any "using namespace XXX;" statements in headers. + * static class members should be avoided at all cost. + * anything storing atom IDs should be using `tagint` and not `int`. + This can be flagged by the compiler only for pointers and only when + compiling LAMMPS with `-DLAMMPS_BIGBIG`. + * when including both `lmptype.h` (and using defines or macros from it) + and `mpi.h`, `lmptype.h` must be included first. + * when pair styles are added, check if settings for flags like + `single_enable`, `writedata`, `reinitflag`, `manybody_flag` + and others are correctly set and supported. + +## GitHub Issues + +The GitHub issue tracker is the location where the LAMMPS developers +and other contributors or LAMMPS users can report issues or bugs with +the LAMMPS code or request new features to be added. Feature requests +are usually indicated by a `[Feature Request]` marker in the subject. +Issues are assigned to a person, if this person is working on this +feature or working to resolve an issue. Issues that have nobody working +on them at the moment, have the label `volunteer needed` attached. + +When an issue, say `#125` is resolved by a specific pull request, +the comment for the pull request shall contain the text `closes #125` +or `fixes #125`, so that the issue is automatically deleted when +the pull request is merged. + +## Milestones and Release Planning + +LAMMPS uses a continuous release development model with incremental +changes, i.e. significant effort is made - including automated pre-merge +testing - that the code in the branch "master" does not get broken. +More extensive testing (including regression testing) is performed after +code is merged to the "master" branch. There are patch releases of +LAMMPS every 1-3 weeks at a point, when the LAMMPS developers feel, that +a sufficient amount of changes have happened, and the post-merge testing +has been successful. These patch releases are marked with a +`patch_` tag and the "unstable" branch follows only these +versions (and thus is always supposed to be of production quality, +unlike "master", which may be temporary broken, in the case of larger +change sets or unexpected incompatibilities or side effects. + +About 3-4 times each year, there are going to be "stable" releases +of LAMMPS. These have seen additional, manual testing and review of +results from testing with instrumented code and static code analysis. +Also, in the last 2-3 patch releases before a stable release are +"release candidate" versions which only contain bugfixes and +documentation updates. For release planning and the information of +code contributors, issues and pull requests being actively worked on +are assigned a "milestone", which corresponds to the next stable +release or the stable release after that, with a tentative release +date. + diff --git a/doc/lammps.1 b/doc/lammps.1 new file mode 100644 index 0000000000..4686198fef --- /dev/null +++ b/doc/lammps.1 @@ -0,0 +1,264 @@ +.TH LAMMPS "11 April 2019" "2019-04-11" +.SH NAME +.B LAMMPS +\- Molecular Dynamics Simulator. + +.SH SYNOPSIS +.B lmp +\-in [OPTIONS] ... + +or + +mpirun \-np 2 +.B lmp + [OPTIONS] ... + +or + +.B lmp +\-r2data file.restart file.data + +.SH DESCRIPTION +.B LAMMPS +is a classical molecular dynamics code, and an acronym for \fBL\fRarge-scale +\fBA\fRtomic/\fBM\fRolecular \fBM\fRassively \fBP\fRarallel \fBS\fRimulator. +.B LAMMPS +has potentials for soft +materials (bio-molecules, polymers) and solid-state materials (metals, +semiconductors) and coarse-grained or mesoscopic systems. It can be used to +model atoms or, more generically, as a parallel particle simulator at the +atomic, meso, or continuum scale. + +See https://lammps.sandia.gov/ for more information and documentation. + +.SH EXECUTABLE NAME +The +.B LAMMPS +executable can have different names depending on how it was configured, +compiled and installed. It will be either +.B lmp +or +.B lmp_. +The suffix corresponds to the (machine specific) makefile +used to compile +.B LAMMPS +when using the conventional build process. When building +.B LAMMPS +using +.B CMake +this parameter can be chosen arbitrarily at configuration +time, but more common is to just use +.B lmp +without a suffix. In this manpage we will use +.B lmp +to represent any of those names. + +.SH OPTIONS + +.TP +\fB\-h\fR or \fB\-help\fR +Print a brief help summary and a list of settings and options compiled +into this executable. It also explicitly lists all LAMMPS styles +(atom_style, fix, compute, pair_style, bond_style, etc) available in +the specific executable. This can tell you if the command you want to +use was included via the appropriate package at compile time. +LAMMPS will print the info and immediately exit if this switch is used. +.TP +\fB\-e\fR or \fB\-echo\fR +Set the style of command echoing. The style can be +.B none +or +.B screen +or +.B log +or +.B both. +Depending on the style, each command read from the input script will +be echoed to the screen and/or logfile. This can be useful to figure +out which line of your script is causing an input error. +The default value is +.B log. +.TP +\fB\-i \fR or \fB\-in \fR +Specify a file to use as an input script. If it is not specified, +LAMMPS reads its script from standard input. This is a required +switch when running LAMMPS in multi-partition mode. +.TP +\fB\-k on/off [keyword value]\fR or \fB\-kokkos on/off [keyword value]\fR +Enable or disable general KOKKOS support, as provided by the KOKKOS +package. Even if LAMMPS is built with this package, this switch must +be set to \fBon\fR to enable running with KOKKOS-enabled styles. More +details on this switch and its optional keyword value pairs are discussed +at: https://lammps.sandia.gov/doc/Run_options.html +.TP +\fB\-l \fR or \fB\-log \fR +Specify a log file for LAMMPS to write status information to. +The default value is "log.lammps". If the file name "none" is used, +\fBLAMMPS\fR will not write a log file. In multi-partition mode only +some high-level all-partition information is written to the "" +file, the remainder is written in a per-partition file ".N" +with "N" being the respective partition number, unless overridden +by the \-plog flag (see below). +.TP +\fB\-m \fR or \fB\-mpicolor \fR +If used, this must be the first command-line argument after the +.B LAMMPS +executable name. It is only used when +.B LAMMPS +is launched by an mpirun command which also launches one or more +other executable(s) at the same time. +.B LAMMPS +and the other executable(s) perform an MPI_Comm_split(), each with +their own different colors, to split the MPI_COMM_WORLD communicator +for each executable to the subset of processors they are supposed to +be actually running on. Currently, this is only used in +.B LAMMPS +to perform client/server messaging with another application. +.B LAMMPS +can act as either a client or server (or both). +.TP +\fB\-nc\fR or \fB\-nocite\fR +Disable writing the "log.cite" file which is normally written to +list references for specific cite-able features used during a +.B LAMMPS +run. +.TP +\fB\-pk