5
.github/CODEOWNERS
vendored
@ -22,7 +22,6 @@ src/SPIN/* @julient31
|
|||||||
src/USER-CGDNA/* @ohenrich
|
src/USER-CGDNA/* @ohenrich
|
||||||
src/USER-CGSDK/* @akohlmey
|
src/USER-CGSDK/* @akohlmey
|
||||||
src/USER-COLVARS/* @giacomofiorin
|
src/USER-COLVARS/* @giacomofiorin
|
||||||
src/USER-DPD/* @timattox
|
|
||||||
src/USER-INTEL/* @wmbrownintel
|
src/USER-INTEL/* @wmbrownintel
|
||||||
src/USER-MANIFOLD/* @Pakketeretet2
|
src/USER-MANIFOLD/* @Pakketeretet2
|
||||||
src/USER-MEAMC/* @martok
|
src/USER-MEAMC/* @martok
|
||||||
@ -46,7 +45,7 @@ src/GPU/pair_vashishta_gpu.* @andeplane
|
|||||||
src/KOKKOS/pair_vashishta_kokkos.* @andeplane
|
src/KOKKOS/pair_vashishta_kokkos.* @andeplane
|
||||||
src/MANYBODY/pair_vashishta_table.* @andeplane
|
src/MANYBODY/pair_vashishta_table.* @andeplane
|
||||||
src/MANYBODY/pair_atm.* @sergeylishchuk
|
src/MANYBODY/pair_atm.* @sergeylishchuk
|
||||||
src/USER-MISC/fix_bond_react.* @jrgissing
|
src/USER-REACTION/fix_bond_react.* @jrgissing
|
||||||
src/USER-MISC/*_grem.* @dstelter92
|
src/USER-MISC/*_grem.* @dstelter92
|
||||||
src/USER-MISC/compute_stress_mop*.* @RomainVermorel
|
src/USER-MISC/compute_stress_mop*.* @RomainVermorel
|
||||||
|
|
||||||
@ -116,9 +115,11 @@ src/min* @sjplimp @stanmoore1
|
|||||||
# tools
|
# tools
|
||||||
tools/msi2lmp/* @akohlmey
|
tools/msi2lmp/* @akohlmey
|
||||||
tools/emacs/* @HaoZeke
|
tools/emacs/* @HaoZeke
|
||||||
|
tools/singularity/* @akohlmey @rbberger
|
||||||
|
|
||||||
# cmake
|
# cmake
|
||||||
cmake/* @junghans @rbberger
|
cmake/* @junghans @rbberger
|
||||||
|
cmake/Modules/Packages/USER-COLVARS.cmake @junghans @rbberger @giacomofiorin
|
||||||
|
|
||||||
# python
|
# python
|
||||||
python/* @rbberger
|
python/* @rbberger
|
||||||
|
|||||||
12
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -9,24 +9,24 @@ assignees: ''
|
|||||||
|
|
||||||
**Summary**
|
**Summary**
|
||||||
|
|
||||||
_Please provide a clear and concise description of what the bug is._
|
<!--Please provide a clear and concise description of what the bug is.-->
|
||||||
|
|
||||||
**LAMMPS Version and Platform**
|
**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_
|
<!--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**
|
**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_
|
<!--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**
|
**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._
|
<!--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**
|
**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._
|
<!--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**
|
**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_
|
<!--Put any additional information here, attach relevant text or image files and URLs to external sites, e.g. relevant publications-->
|
||||||
|
|||||||
6
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -9,12 +9,12 @@ assignees: ''
|
|||||||
|
|
||||||
**Summary**
|
**Summary**
|
||||||
|
|
||||||
_Please provide a brief and concise description of the suggested feature or change_
|
<!--Please provide a brief and concise description of the suggested feature or change-->
|
||||||
|
|
||||||
**Detailed Description**
|
**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._
|
<!--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**
|
**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_
|
<!--Put any additional information here, attach relevant text or image files and URLs to external sites, e.g. relevant publications-->
|
||||||
|
|||||||
6
.github/ISSUE_TEMPLATE/generic.md
vendored
@ -9,13 +9,13 @@ assignees: ''
|
|||||||
|
|
||||||
**Summary**
|
**Summary**
|
||||||
|
|
||||||
_Please provide a clear and concise description of what this issue report is about._
|
<!--Please provide a clear and concise description of what this issue report is about.-->
|
||||||
|
|
||||||
**LAMMPS Version and Platform**
|
**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_
|
<!--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**
|
**Details**
|
||||||
|
|
||||||
_Please explain the issue in detail here_
|
<!--Please explain the issue in detail here-->
|
||||||
|
|
||||||
|
|||||||
14
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,14 +1,14 @@
|
|||||||
**Summary**
|
**Summary**
|
||||||
|
|
||||||
_Briefly describe the new feature(s), enhancement(s), or bugfix(es) included in this pull request._
|
<!--Briefly describe the new feature(s), enhancement(s), or bugfix(es) included in this pull request.-->
|
||||||
|
|
||||||
**Related Issues**
|
**Related Issues**
|
||||||
|
|
||||||
_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_
|
<!--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-->
|
||||||
|
|
||||||
**Author(s)**
|
**Author(s)**
|
||||||
|
|
||||||
_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._
|
<!--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.-->
|
||||||
|
|
||||||
**Licensing**
|
**Licensing**
|
||||||
|
|
||||||
@ -16,15 +16,15 @@ By submitting this pull request, I agree, that my contribution will be included
|
|||||||
|
|
||||||
**Backward Compatibility**
|
**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_
|
<!--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**
|
**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_
|
<!--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 **after** the pull request has been submitted. Delete lines that don't apply-->
|
||||||
|
|
||||||
- [ ] The feature or features in this pull request is complete
|
- [ ] The feature or features in this pull request is complete
|
||||||
- [ ] Licensing information is complete
|
- [ ] Licensing information is complete
|
||||||
@ -39,6 +39,6 @@ _Please check the fields below as they are completed **after** the pull request
|
|||||||
|
|
||||||
**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)_
|
<!--Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. DOIs or webpages)-->
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
14
.github/PULL_REQUEST_TEMPLATE/bug_fix.md
vendored
@ -9,15 +9,15 @@ assignees: ''
|
|||||||
|
|
||||||
**Summary**
|
**Summary**
|
||||||
|
|
||||||
_Briefly describe the bug or bugs, that are eliminated by this pull request._
|
<!--Briefly describe the bug or bugs, that are eliminated by this pull request.-->
|
||||||
|
|
||||||
**Related Issue(s)**
|
**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`._
|
<!--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)**
|
**Author(s)**
|
||||||
|
|
||||||
_Please state name and affiliation of the author or authors that should be credited with the changes in this pull request_
|
<!--Please state name and affiliation of the author or authors that should be credited with the changes in this pull request-->
|
||||||
|
|
||||||
**Licensing**
|
**Licensing**
|
||||||
|
|
||||||
@ -25,18 +25,18 @@ By submitting this pull request I implicitly accept, that my submission is subje
|
|||||||
|
|
||||||
**Backward Compatibility**
|
**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_
|
<!--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**
|
**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_
|
<!--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
|
## Post Submission Checklist
|
||||||
|
|
||||||
_Please check the fields below as they are completed *after* the pull request is submitted_
|
<!--Please check the fields below as they are completed *after* the pull request is submitted-->
|
||||||
- [ ] The code in this pull request is complete
|
- [ ] The code in this pull request is complete
|
||||||
- [ ] The source code follows the LAMMPS formatting guidelines
|
- [ ] The source code follows the LAMMPS formatting guidelines
|
||||||
|
|
||||||
## 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. to download input decks for testing)_
|
<!--Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. to download input decks for testing)-->
|
||||||
|
|||||||
@ -9,15 +9,15 @@ assignees: ''
|
|||||||
|
|
||||||
**Summary**
|
**Summary**
|
||||||
|
|
||||||
_Briefly describe the included changes._
|
<!--Briefly describe the included changes.-->
|
||||||
|
|
||||||
**Related Issue(s)**
|
**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`.
|
<!--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)**
|
**Author(s)**
|
||||||
|
|
||||||
_Please state name and affiliation of the author or authors that should be credited with the changes in this pull request_
|
<!--Please state name and affiliation of the author or authors that should be credited with the changes in this pull request-->
|
||||||
|
|
||||||
**Licensing**
|
**Licensing**
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ By submitting this pull request I implicitly accept, that my submission is subje
|
|||||||
|
|
||||||
**Detailed Description**
|
**Detailed Description**
|
||||||
|
|
||||||
_Provide any relevant details about the included changes._
|
<!--Provide any relevant details about the included changes.-->
|
||||||
|
|
||||||
## Post Submission Checklist
|
## Post Submission Checklist
|
||||||
|
|
||||||
_Please check the fields below as they are completed *after* the pull request is submitted_
|
<!--Please check the fields below as they are completed *after* the pull request is submitted-->
|
||||||
- [ ] The pull request is complete
|
- [ ] The pull request is complete
|
||||||
- [ ] The source code follows the LAMMPS formatting guidelines
|
- [ ] The source code follows the LAMMPS formatting guidelines
|
||||||
|
|
||||||
|
|||||||
16
.github/PULL_REQUEST_TEMPLATE/new_feature.md
vendored
@ -9,34 +9,34 @@ assignees: ''
|
|||||||
|
|
||||||
**Summary**
|
**Summary**
|
||||||
|
|
||||||
_Briefly describe the new feature(s) included in this pull request._
|
<!--Briefly describe the new feature(s) included in this pull request.-->
|
||||||
|
|
||||||
**Related Issues**
|
**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`._
|
<!--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)**
|
**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_
|
<!--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**
|
**Licensing**
|
||||||
|
|
||||||
_Please add *yes* or *no* to the following two statements (please contact @lammps/core if you have questions about this)_
|
<!--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 GPL v2 (default LAMMPS license):
|
||||||
My contribution may be licensed as LGPL (for use as a library with proprietary software):
|
My contribution may be licensed as LGPL (for use as a library with proprietary software):
|
||||||
|
|
||||||
**Backward Compatibility**
|
**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_
|
<!--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**
|
**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_
|
<!--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
|
## Post Submission Checklist
|
||||||
|
|
||||||
_Please check the fields below as they are completed *after* the pull request has been submitted_
|
<!--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
|
- [ ] The feature or features in this pull request is complete
|
||||||
- [ ] Licensing information is complete
|
- [ ] Licensing information is complete
|
||||||
@ -51,6 +51,6 @@ _Please check the fields below as they are completed *after* the pull request ha
|
|||||||
|
|
||||||
## 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)_
|
<!--Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. DOIs or webpages)-->
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,11 +9,11 @@ assignees: ''
|
|||||||
|
|
||||||
**Summary**
|
**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._
|
<!--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)**
|
**Author(s)**
|
||||||
|
|
||||||
_Please state name and affiliation of the author or authors that should be credited with the changes in this pull request_
|
<!--Please state name and affiliation of the author or authors that should be credited with the changes in this pull request-->
|
||||||
|
|
||||||
**Licensing**
|
**Licensing**
|
||||||
|
|
||||||
@ -21,15 +21,15 @@ By submitting this pull request I implicitly accept, that my submission is subje
|
|||||||
|
|
||||||
**Backward Compatibility**
|
**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_
|
<!--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**
|
**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_
|
<!--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_
|
<!--Please check the fields below as they are completed-->
|
||||||
- [ ] The feature or features in this pull request is complete
|
- [ ] The feature or features in this pull request is complete
|
||||||
- [ ] Suitable updates to the existing docs are included
|
- [ ] Suitable updates to the existing docs are included
|
||||||
- [ ] One or more example input decks are included
|
- [ ] One or more example input decks are included
|
||||||
@ -37,6 +37,6 @@ _Please check the fields below as they are completed_
|
|||||||
|
|
||||||
**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)_
|
<!--Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. DOIs or webpages)-->
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
.gitignore
vendored
@ -9,6 +9,7 @@
|
|||||||
*.d
|
*.d
|
||||||
*.x
|
*.x
|
||||||
*.exe
|
*.exe
|
||||||
|
*.sif
|
||||||
*.dll
|
*.dll
|
||||||
*.pyc
|
*.pyc
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|||||||
@ -6,13 +6,16 @@ cmake_minimum_required(VERSION 3.10)
|
|||||||
|
|
||||||
project(lammps CXX)
|
project(lammps CXX)
|
||||||
set(SOVERSION 0)
|
set(SOVERSION 0)
|
||||||
get_filename_component(LAMMPS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src ABSOLUTE)
|
|
||||||
get_filename_component(LAMMPS_LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../lib ABSOLUTE)
|
get_filename_component(LAMMPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE)
|
||||||
get_filename_component(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib ABSOLUTE)
|
get_filename_component(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib ABSOLUTE)
|
||||||
get_filename_component(LAMMPS_DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../doc ABSOLUTE)
|
|
||||||
get_filename_component(LAMMPS_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../tools ABSOLUTE)
|
set(LAMMPS_SOURCE_DIR ${LAMMPS_DIR}/src)
|
||||||
get_filename_component(LAMMPS_PYTHON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../python ABSOLUTE)
|
set(LAMMPS_LIB_SOURCE_DIR ${LAMMPS_DIR}/lib)
|
||||||
get_filename_component(LAMMPS_POTENTIALS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../potentials ABSOLUTE)
|
set(LAMMPS_DOC_DIR ${LAMMPS_DIR}/doc)
|
||||||
|
set(LAMMPS_TOOLS_DIR ${LAMMPS_DIR}/tools)
|
||||||
|
set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python)
|
||||||
|
set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials)
|
||||||
|
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
|
|
||||||
@ -21,17 +24,12 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|||||||
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "default install path" FORCE )
|
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "default install path" FORCE )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# To avoid conflicts with the conventional Makefile build system, we build everything here
|
|
||||||
file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
|
||||||
file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
|
|
||||||
list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES})
|
|
||||||
|
|
||||||
# Cmake modules/macros are in a subdirectory to keep this file cleaner
|
# Cmake modules/macros are in a subdirectory to keep this file cleaner
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
|
||||||
|
|
||||||
include(LAMMPSUtils)
|
include(LAMMPSUtils)
|
||||||
|
|
||||||
get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h LAMMPS_VERSION)
|
get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h PROJECT_VERSION)
|
||||||
|
|
||||||
include(PreventInSourceBuilds)
|
include(PreventInSourceBuilds)
|
||||||
|
|
||||||
@ -69,9 +67,10 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
|||||||
set(CMAKE_TUNE_DEFAULT "-ffast-math -march=native")
|
set(CMAKE_TUNE_DEFAULT "-ffast-math -march=native")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# we require C++11
|
# we require C++11 without extensions
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
# GNU compiler specific features for testing
|
# GNU compiler specific features for testing
|
||||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||||
@ -85,43 +84,33 @@ endif()
|
|||||||
########################################################################
|
########################################################################
|
||||||
# User input options #
|
# User input options #
|
||||||
########################################################################
|
########################################################################
|
||||||
option(BUILD_EXE "Build lmp binary" ON)
|
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
||||||
if(BUILD_EXE)
|
mark_as_advanced(LAMMPS_MACHINE)
|
||||||
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
if(LAMMPS_MACHINE)
|
||||||
mark_as_advanced(LAMMPS_MACHINE)
|
|
||||||
if(LAMMPS_MACHINE)
|
|
||||||
set(LAMMPS_MACHINE "_${LAMMPS_MACHINE}")
|
set(LAMMPS_MACHINE "_${LAMMPS_MACHINE}")
|
||||||
endif()
|
|
||||||
set(LAMMPS_BINARY lmp${LAMMPS_MACHINE})
|
|
||||||
endif()
|
endif()
|
||||||
|
set(LAMMPS_BINARY lmp${LAMMPS_MACHINE})
|
||||||
|
|
||||||
option(BUILD_LIB "Build LAMMPS library" OFF)
|
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
||||||
if(BUILD_LIB)
|
if(BUILD_SHARED_LIBS) # for all pkg libs, mpi_stubs and linalg
|
||||||
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
|
||||||
if(BUILD_SHARED_LIBS) # for all pkg libs, mpi_stubs and linalg
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
endif()
|
|
||||||
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()
|
endif()
|
||||||
|
|
||||||
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
||||||
|
|
||||||
if(NOT BUILD_EXE AND NOT BUILD_LIB)
|
include(GNUInstallDirs)
|
||||||
message(FATAL_ERROR "You need to at least enable one of two following options: BUILD_LIB or BUILD_EXE")
|
file(GLOB ALL_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||||
endif()
|
file(GLOB MAIN_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||||
|
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
||||||
|
add_library(lammps ${ALL_SOURCES})
|
||||||
|
add_executable(lmp ${MAIN_SOURCES})
|
||||||
|
target_link_libraries(lmp PRIVATE lammps)
|
||||||
|
set_target_properties(lmp PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY})
|
||||||
|
install(TARGETS lmp EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
||||||
option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
set(LAMMPS_LINK_LIBS)
|
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE
|
||||||
set(LAMMPS_DEPS)
|
|
||||||
set(LAMMPS_API_DEFINES)
|
|
||||||
|
|
||||||
set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
|
|
||||||
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MOLECULE PERI POEMS QEQ
|
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MOLECULE PERI POEMS QEQ
|
||||||
REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
|
REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
|
||||||
USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK USER-COLVARS
|
USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK USER-COLVARS
|
||||||
@ -130,33 +119,15 @@ set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
|
|||||||
USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REACTION
|
USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REACTION
|
||||||
USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY
|
USER-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)
|
USER-UEF USER-VTK USER-QUIP USER-QMMM USER-YAFF USER-ADIOS)
|
||||||
set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU)
|
set(SUFFIX_PACKAGES CORESHELL USER-OMP KOKKOS OPT USER-INTEL GPU)
|
||||||
foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
|
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||||
option(PKG_${PKG} "Build ${PKG} Package" OFF)
|
option(PKG_${PKG} "Build ${PKG} Package" OFF)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
######################################################
|
|
||||||
# download and unpack support binaries for compilation
|
|
||||||
# of windows binaries.
|
|
||||||
######################################################
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
||||||
set(LAMMPS_THIRDPARTY_URL "http://download.lammps.org/thirdparty")
|
|
||||||
file(DOWNLOAD "${LAMMPS_THIRDPARTY_URL}/opencl-win-devel.tar.gz" "${CMAKE_CURRENT_BINARY_DIR}/opencl-win-devel.tar.gz"
|
|
||||||
EXPECTED_MD5 2c00364888d5671195598b44c2e0d44d)
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf opencl-win-devel.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
|
|
||||||
set(OpenCL_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win32/libOpenCL.dll")
|
|
||||||
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
|
|
||||||
set(OpenCL_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win64/libOpenCL.dll")
|
|
||||||
endif()
|
|
||||||
set(OpenCL_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/include")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
######################################################
|
|
||||||
######################################################
|
######################################################
|
||||||
# packages with special compiler needs or external libs
|
# packages with special compiler needs or external libs
|
||||||
######################################################
|
######################################################
|
||||||
include_directories(${LAMMPS_SOURCE_DIR})
|
target_include_directories(lammps PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}>)
|
||||||
|
|
||||||
if(PKG_USER-ADIOS)
|
if(PKG_USER-ADIOS)
|
||||||
# The search for ADIOS2 must come before MPI because
|
# The search for ADIOS2 must come before MPI because
|
||||||
@ -164,35 +135,44 @@ if(PKG_USER-ADIOS)
|
|||||||
# script that defines the MPI::MPI_C target
|
# script that defines the MPI::MPI_C target
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
find_package(ADIOS2 REQUIRED)
|
find_package(ADIOS2 REQUIRED)
|
||||||
list(APPEND LAMMPS_LINK_LIBS adios2::adios2)
|
target_link_libraries(lammps PRIVATE adios2::adios2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# do MPI detection after language activation,
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
# in case MPI for these languages is required
|
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||||
set(MPI_CXX_SKIP_MPICXX TRUE)
|
find_package(MPI QUIET)
|
||||||
find_package(MPI QUIET)
|
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
||||||
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
else()
|
||||||
|
option(BUILD_MPI "Build MPI version" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(BUILD_MPI)
|
if(BUILD_MPI)
|
||||||
# We use a non-standard procedure to compile with MPI on windows
|
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)
|
||||||
include(MPI4WIN)
|
include(MPI4WIN)
|
||||||
|
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
|
||||||
else()
|
else()
|
||||||
find_package(MPI REQUIRED)
|
find_package(MPI REQUIRED)
|
||||||
include_directories(${MPI_CXX_INCLUDE_PATH})
|
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
|
||||||
add_definitions(-DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1)
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${MPI_CXX_LIBRARIES})
|
|
||||||
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
||||||
if(LAMMPS_LONGLONG_TO_LONG)
|
if(LAMMPS_LONGLONG_TO_LONG)
|
||||||
add_definitions(-DLAMMPS_LONGLONG_TO_LONG)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_LONGLONG_TO_LONG)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c)
|
file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c)
|
||||||
add_library(mpi_stubs STATIC ${MPI_SOURCES})
|
add_library(mpi_stubs STATIC ${MPI_SOURCES})
|
||||||
include_directories(${LAMMPS_SOURCE_DIR}/STUBS)
|
set_target_properties(mpi_stubs PROPERTIES OUTPUT_NAME lammps_mpi_stubs${LAMMPS_MACHINE})
|
||||||
list(APPEND LAMMPS_LINK_LIBS mpi_stubs)
|
target_include_directories(mpi_stubs PUBLIC $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps/mpi>)
|
||||||
|
install(FILES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps/mpi)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_link_libraries(lammps PRIVATE mpi_stubs)
|
||||||
|
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps/mpi>)
|
||||||
|
else()
|
||||||
|
target_link_libraries(lammps PUBLIC mpi_stubs)
|
||||||
|
endif()
|
||||||
|
add_library(MPI::MPI_CXX ALIAS mpi_stubs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||||
@ -200,8 +180,7 @@ set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
|
|||||||
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
|
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
|
||||||
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
|
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
|
||||||
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
||||||
add_definitions(-DLAMMPS_${LAMMPS_SIZES})
|
target_compile_definitions(lammps PUBLIC -DLAMMPS_${LAMMPS_SIZES})
|
||||||
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -DLAMMPS_${LAMMPS_SIZES}")
|
|
||||||
|
|
||||||
# posix_memalign is not available on Windows
|
# posix_memalign is not available on Windows
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
@ -210,13 +189,12 @@ else()
|
|||||||
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable")
|
set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable")
|
||||||
endif()
|
endif()
|
||||||
if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0")
|
if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0")
|
||||||
add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF)
|
option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF)
|
||||||
if(LAMMPS_EXCEPTIONS)
|
if(LAMMPS_EXCEPTIONS)
|
||||||
add_definitions(-DLAMMPS_EXCEPTIONS)
|
target_compile_definitions(lammps PUBLIC -DLAMMPS_EXCEPTIONS)
|
||||||
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -DLAMMPS_EXCEPTIONS")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# "hard" dependencies between packages resulting
|
# "hard" dependencies between packages resulting
|
||||||
@ -237,16 +215,7 @@ if(OpenMP_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TODO: this is a temporary workaround until a better solution is found. AK 2019-05-30
|
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
|
||||||
# GNU GCC 9.x uses settings incompatible with our use of 'default(none)' in OpenMP pragmas
|
|
||||||
# where we assume older GCC semantics. For the time being, we disable OpenMP by default
|
|
||||||
# for GCC 9.x and beyond. People may manually turn it on, but need to run the script
|
|
||||||
# src/USER-OMP/hack_openmp_for_pgi_gcc9.sh on all sources to make it compatible with gcc 9.
|
|
||||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.99.9))
|
|
||||||
option(BUILD_OMP "Build with OpenMP support" OFF)
|
|
||||||
else()
|
|
||||||
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(BUILD_OMP)
|
if(BUILD_OMP)
|
||||||
find_package(OpenMP REQUIRED)
|
find_package(OpenMP REQUIRED)
|
||||||
@ -254,8 +223,18 @@ if(BUILD_OMP)
|
|||||||
if(NOT HAVE_OMP_H_INCLUDE)
|
if(NOT HAVE_OMP_H_INCLUDE)
|
||||||
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
|
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
|
||||||
endif()
|
endif()
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.99.9)) OR
|
||||||
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.99.9)) OR
|
||||||
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18.99.9))
|
||||||
|
)
|
||||||
|
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
|
||||||
|
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
|
||||||
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=4)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=3)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
|
if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
|
||||||
@ -270,6 +249,7 @@ if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
|
|||||||
enable_language(Fortran)
|
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})
|
add_library(linalg STATIC ${LAPACK_SOURCES})
|
||||||
|
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
||||||
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||||
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
|
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||||
else()
|
else()
|
||||||
@ -282,9 +262,13 @@ find_package(JPEG QUIET)
|
|||||||
option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
||||||
if(WITH_JPEG)
|
if(WITH_JPEG)
|
||||||
find_package(JPEG REQUIRED)
|
find_package(JPEG REQUIRED)
|
||||||
add_definitions(-DLAMMPS_JPEG)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
||||||
include_directories(${JPEG_INCLUDE_DIR})
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${JPEG_LIBRARIES})
|
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIR})
|
||||||
|
target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(PNG QUIET)
|
find_package(PNG QUIET)
|
||||||
@ -297,9 +281,8 @@ endif()
|
|||||||
if(WITH_PNG)
|
if(WITH_PNG)
|
||||||
find_package(PNG REQUIRED)
|
find_package(PNG REQUIRED)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
include_directories(${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS})
|
target_link_libraries(lammps PRIVATE PNG::PNG ZLIB::ZLIB)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_PNG)
|
||||||
add_definitions(-DLAMMPS_PNG)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_program(GZIP_EXECUTABLE gzip)
|
find_program(GZIP_EXECUTABLE gzip)
|
||||||
@ -309,7 +292,7 @@ if(WITH_GZIP)
|
|||||||
if(NOT GZIP_FOUND)
|
if(NOT GZIP_FOUND)
|
||||||
message(FATAL_ERROR "gzip executable not found")
|
message(FATAL_ERROR "gzip executable not found")
|
||||||
endif()
|
endif()
|
||||||
add_definitions(-DLAMMPS_GZIP)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_GZIP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_program(FFMPEG_EXECUTABLE ffmpeg)
|
find_program(FFMPEG_EXECUTABLE ffmpeg)
|
||||||
@ -319,7 +302,7 @@ if(WITH_FFMPEG)
|
|||||||
if(NOT FFMPEG_FOUND)
|
if(NOT FFMPEG_FOUND)
|
||||||
message(FATAL_ERROR "ffmpeg executable not found")
|
message(FATAL_ERROR "ffmpeg executable not found")
|
||||||
endif()
|
endif()
|
||||||
add_definitions(-DLAMMPS_FFMPEG)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_FFMPEG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
@ -332,29 +315,25 @@ else()
|
|||||||
set(CUDA_REQUEST_PIC)
|
set(CUDA_REQUEST_PIC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(Packages/KSPACE)
|
foreach(PKG_WITH_INCL KSPACE PYTHON VORONOI USER-COLVARS USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM
|
||||||
include(Packages/PYTHON)
|
USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS)
|
||||||
include(Packages/VORONOI)
|
if(PKG_${PKG_WITH_INCL})
|
||||||
include(Packages/USER-COLVARS)
|
include(Packages/${PKG_WITH_INCL})
|
||||||
include(Packages/USER-MOLFILE)
|
endif()
|
||||||
include(Packages/USER-NETCDF)
|
endforeach()
|
||||||
include(Packages/USER-PLUMED)
|
|
||||||
include(Packages/USER-QMMM)
|
|
||||||
include(Packages/USER-QUIP)
|
|
||||||
include(Packages/USER-SCAFACOS)
|
|
||||||
include(Packages/USER-SMD)
|
|
||||||
include(Packages/USER-VTK)
|
|
||||||
include(Packages/KIM)
|
|
||||||
include(Packages/LATTE)
|
|
||||||
include(Packages/MESSAGE)
|
|
||||||
include(Packages/MSCG)
|
|
||||||
include(Packages/COMPRESS)
|
|
||||||
|
|
||||||
set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler specific optimization or instrumentation")
|
set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler specific optimization or instrumentation")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_TUNE_FLAGS}")
|
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||||
if(CMAKE_Fortran_COMPILER)
|
include(CheckCXXCompilerFlag)
|
||||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_TUNE_FLAGS}")
|
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||||
endif()
|
string(REGEX REPLACE "[=\"]" "" _FLAGX ${_FLAG})
|
||||||
|
check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAGX})
|
||||||
|
if(COMPILER_SUPPORTS${_FLAGX})
|
||||||
|
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||||
|
else()
|
||||||
|
message(WARNING "${_FLAG} found in CMAKE_TUNE_FLAGS, but not supported by the compiler, skipping")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
########################################################################
|
########################################################################
|
||||||
# Basic system tests (standard libraries, headers, functions, types) #
|
# Basic system tests (standard libraries, headers, functions, types) #
|
||||||
########################################################################
|
########################################################################
|
||||||
@ -367,15 +346,7 @@ endforeach(HEADER)
|
|||||||
|
|
||||||
set(MATH_LIBRARIES "m" CACHE STRING "math library")
|
set(MATH_LIBRARIES "m" CACHE STRING "math library")
|
||||||
mark_as_advanced( MATH_LIBRARIES )
|
mark_as_advanced( MATH_LIBRARIES )
|
||||||
include(CheckLibraryExists)
|
target_link_libraries(lammps PRIVATE ${MATH_LIBRARIES})
|
||||||
# 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})
|
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
# Generate Basic Style files
|
# Generate Basic Style files
|
||||||
@ -386,7 +357,7 @@ RegisterStyles(${LAMMPS_SOURCE_DIR})
|
|||||||
##############################################
|
##############################################
|
||||||
# add sources of enabled packages
|
# add sources of enabled packages
|
||||||
############################################
|
############################################
|
||||||
foreach(PKG ${DEFAULT_PACKAGES})
|
foreach(PKG ${STANDARD_PACKAGES})
|
||||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
|
|
||||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||||
@ -399,8 +370,8 @@ foreach(PKG ${DEFAULT_PACKAGES})
|
|||||||
# detects styles in package and adds them to global list
|
# detects styles in package and adds them to global list
|
||||||
RegisterStyles(${${PKG}_SOURCES_DIR})
|
RegisterStyles(${${PKG}_SOURCES_DIR})
|
||||||
|
|
||||||
list(APPEND LIB_SOURCES ${${PKG}_SOURCES})
|
target_sources(lammps PRIVATE ${${PKG}_SOURCES})
|
||||||
include_directories(${${PKG}_SOURCES_DIR})
|
target_include_directories(lammps PRIVATE ${${PKG}_SOURCES_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
RegisterPackages(${${PKG}_SOURCES_DIR})
|
RegisterPackages(${${PKG}_SOURCES_DIR})
|
||||||
@ -409,12 +380,12 @@ endforeach()
|
|||||||
# packages that need defines set
|
# packages that need defines set
|
||||||
foreach(PKG MPIIO)
|
foreach(PKG MPIIO)
|
||||||
if(PKG_${PKG})
|
if(PKG_${PKG})
|
||||||
add_definitions(-DLMP_${PKG})
|
target_compile_definitions(lammps PRIVATE -DLMP_${PKG})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# dedicated check for entire contents of accelerator packages
|
# dedicated check for entire contents of accelerator packages
|
||||||
foreach(PKG ${ACCEL_PACKAGES})
|
foreach(PKG ${SUFFIX_PACKAGES})
|
||||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
|
|
||||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||||
@ -434,14 +405,11 @@ foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD)
|
|||||||
string(REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}")
|
string(REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}")
|
||||||
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
||||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
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}/[^.]*.c
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
||||||
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
||||||
if(LAMMPS_USE_MPI4WIN)
|
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
||||||
add_dependencies(${PKG_LIB} mpi4win_build)
|
target_link_libraries(lammps PRIVATE ${PKG_LIB})
|
||||||
endif()
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${PKG_LIB})
|
|
||||||
if(PKG_LIB STREQUAL awpmd)
|
if(PKG_LIB STREQUAL awpmd)
|
||||||
target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include)
|
target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include)
|
||||||
elseif(PKG_LIB STREQUAL h5md)
|
elseif(PKG_LIB STREQUAL h5md)
|
||||||
@ -453,30 +421,36 @@ foreach(SIMPLE_LIB POEMS USER-ATC USER-AWPMD USER-H5MD)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(PKG_USER-AWPMD)
|
if(PKG_USER-AWPMD)
|
||||||
target_link_libraries(awpmd ${LAPACK_LIBRARIES})
|
target_link_libraries(awpmd PRIVATE ${LAPACK_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PKG_USER-ATC)
|
if(PKG_USER-ATC)
|
||||||
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
||||||
message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG")
|
message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(atc ${LAPACK_LIBRARIES})
|
target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES})
|
||||||
|
if(BUILD_MPI)
|
||||||
|
target_link_libraries(atc PRIVATE MPI::MPI_CXX)
|
||||||
|
else()
|
||||||
|
target_link_libraries(atc PRIVATE mpi_stubs)
|
||||||
|
endif()
|
||||||
|
target_include_directories(atc PRIVATE ${LAMMPS_SOURCE_DIR})
|
||||||
|
target_compile_definitions(atc PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(Packages/USER-H5MD)
|
if(PKG_USER-H5MD)
|
||||||
|
include(Packages/USER-H5MD)
|
||||||
|
endif()
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# packages which selectively include variants based on enabled styles
|
# packages which selectively include variants based on enabled styles
|
||||||
# e.g. accelerator packages
|
# e.g. accelerator packages
|
||||||
######################################################################
|
######################################################################
|
||||||
include(Packages/CORESHELL)
|
foreach(PKG_WITH_INCL CORESHELL QEQ USER-OMP USER-SDPD KOKKOS OPT USER-INTEL GPU)
|
||||||
include(Packages/QEQ)
|
if(PKG_${PKG_WITH_INCL})
|
||||||
include(Packages/USER-OMP)
|
include(Packages/${PKG_WITH_INCL})
|
||||||
include(Packages/USER-SDPD)
|
endif()
|
||||||
include(Packages/KOKKOS)
|
endforeach()
|
||||||
include(Packages/OPT)
|
|
||||||
include(Packages/USER-INTEL)
|
|
||||||
include(Packages/GPU)
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# the windows version of LAMMPS requires a couple extra libraries
|
# the windows version of LAMMPS requires a couple extra libraries
|
||||||
@ -484,10 +458,7 @@ include(Packages/GPU)
|
|||||||
# and after everything else that is compiled locally
|
# and after everything else that is compiled locally
|
||||||
######################################################################
|
######################################################################
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
if(LAMMPS_USE_MPI4WIN)
|
target_link_libraries(lammps PRIVATE -lwsock32 -lpsapi)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${MPI4WIN_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS -lwsock32 -lpsapi)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
@ -500,14 +471,14 @@ set(LAMMPS_STYLE_HEADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/styles)
|
|||||||
GenerateStyleHeaders(${LAMMPS_STYLE_HEADERS_DIR})
|
GenerateStyleHeaders(${LAMMPS_STYLE_HEADERS_DIR})
|
||||||
GeneratePackagesHeaders(${LAMMPS_STYLE_HEADERS_DIR})
|
GeneratePackagesHeaders(${LAMMPS_STYLE_HEADERS_DIR})
|
||||||
|
|
||||||
include_directories(${LAMMPS_STYLE_HEADERS_DIR})
|
target_include_directories(lammps PRIVATE ${LAMMPS_STYLE_HEADERS_DIR})
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
# Generate lmpinstalledpkgs.h
|
# Generate lmpinstalledpkgs.h
|
||||||
######################################
|
######################################
|
||||||
set(temp "#ifndef LMP_INSTALLED_PKGS_H\n#define LMP_INSTALLED_PKGS_H\n")
|
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")
|
set(temp "${temp}const char * LAMMPS_NS::LAMMPS::installed_packages[] = {\n")
|
||||||
set(temp_PKG_LIST ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
|
set(temp_PKG_LIST ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||||
list(SORT temp_PKG_LIST)
|
list(SORT temp_PKG_LIST)
|
||||||
foreach(PKG ${temp_PKG_LIST})
|
foreach(PKG ${temp_PKG_LIST})
|
||||||
if(PKG_${PKG})
|
if(PKG_${PKG})
|
||||||
@ -523,13 +494,13 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LAMMPS_STYLE_HE
|
|||||||
# Generate lmpgitversion.h
|
# Generate lmpgitversion.h
|
||||||
######################################
|
######################################
|
||||||
add_custom_target(gitversion COMMAND ${CMAKE_COMMAND}
|
add_custom_target(gitversion COMMAND ${CMAKE_COMMAND}
|
||||||
-DCMAKE_CURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
|
-DLAMMPS_DIR="${LAMMPS_DIR}"
|
||||||
-DGIT_EXECUTABLE="${GIT_EXECUTABLE}"
|
-DGIT_EXECUTABLE="${GIT_EXECUTABLE}"
|
||||||
-DGIT_FOUND="${GIT_FOUND}"
|
-DGIT_FOUND="${GIT_FOUND}"
|
||||||
-DLAMMPS_STYLE_HEADERS_DIR="${LAMMPS_STYLE_HEADERS_DIR}"
|
-DLAMMPS_STYLE_HEADERS_DIR="${LAMMPS_STYLE_HEADERS_DIR}"
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/generate_lmpgitversion.cmake)
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/generate_lmpgitversion.cmake)
|
||||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${LAMMPS_STYLE_HEADERS_DIR}/gitversion.h)
|
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${LAMMPS_STYLE_HEADERS_DIR}/gitversion.h)
|
||||||
list(APPEND LAMMPS_DEPS gitversion)
|
add_dependencies(lammps gitversion)
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Actually add executable and lib to build
|
# Actually add executable and lib to build
|
||||||
@ -537,86 +508,65 @@ list(APPEND LAMMPS_DEPS gitversion)
|
|||||||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||||
list (FIND LANGUAGES "Fortran" _index)
|
list (FIND LANGUAGES "Fortran" _index)
|
||||||
if (${_index} GREATER -1)
|
if (${_index} GREATER -1)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
list(REMOVE_DUPLICATES LAMMPS_LINK_LIBS)
|
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h compute.h dihedral.h domain.h error.h fix.h force.h group.h improper.h
|
||||||
if(BUILD_LIB)
|
input.h info.h kspace.h lammps.h lattice.h library.h lmppython.h lmptype.h memory.h modify.h neighbor.h neigh_list.h output.h
|
||||||
add_library(lammps ${LIB_SOURCES})
|
pair.h pointers.h region.h timer.h universe.h update.h variable.h)
|
||||||
target_link_libraries(lammps ${LAMMPS_LINK_LIBS})
|
if(LAMMPS_EXCEPTIONS)
|
||||||
if(LAMMPS_DEPS)
|
list(APPEND LAMMPS_CXX_HEADERS exceptions.h)
|
||||||
add_dependencies(lammps ${LAMMPS_DEPS})
|
|
||||||
endif()
|
|
||||||
set(LAMMPS_CXX_HEADERS
|
|
||||||
${LAMMPS_SOURCE_DIR}/angle.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/atom.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/bond.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/citeme.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/comm.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/compute.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/dihedral.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/domain.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/error.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/fix.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/force.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/group.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/improper.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/input.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/kspace.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/lammps.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/lattice.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/lmppython.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/memory.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/modify.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/neighbor.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/neigh_list.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/output.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/pair.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/pointers.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/region.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/timer.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/universe.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/update.h
|
|
||||||
${LAMMPS_SOURCE_DIR}/variable.h)
|
|
||||||
|
|
||||||
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)
|
|
||||||
install(FILES ${LAMMPS_CXX_HEADERS} 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()
|
endif()
|
||||||
|
|
||||||
if(BUILD_EXE)
|
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
|
||||||
add_executable(lmp ${LMP_SOURCES})
|
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
||||||
if(BUILD_LIB)
|
target_include_directories(lammps PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
target_link_libraries(lmp lammps)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps)
|
||||||
else()
|
foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
||||||
target_link_libraries(lmp ${LAMMPS_LINK_LIBS})
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_SOURCE_DIR}/${_HEADER} ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} DEPENDS ${LAMMPS_SOURCE_DIR}/${_HEADER})
|
||||||
if(LAMMPS_DEPS)
|
add_custom_target(${_HEADER} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER})
|
||||||
add_dependencies(lmp ${LAMMPS_DEPS})
|
add_dependencies(lammps ${_HEADER})
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
install(FILES ${LAMMPS_SOURCE_DIR}/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endforeach()
|
||||||
|
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>)
|
||||||
set_target_properties(lmp PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY})
|
add_library(LAMMPS::lammps ALIAS lammps)
|
||||||
install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
get_target_property(LAMMPS_DEFINES lammps INTERFACE_COMPILE_DEFINITIONS)
|
||||||
install(FILES ${LAMMPS_DOC_DIR}/lammps.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 RENAME ${LAMMPS_BINARY}.1)
|
set(LAMMPS_API_DEFINES)
|
||||||
|
foreach(_DEF ${LAMMPS_DEFINES})
|
||||||
|
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${_DEF}")
|
||||||
|
endforeach()
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
install(TARGETS lammps EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc @ONLY)
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
install(EXPORT LAMMPS_Targets FILE LAMMPS_Targets.cmake NAMESPACE LAMMPS:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LAMMPS)
|
||||||
|
file(GLOB MODULE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Modules/Find*.cmake)
|
||||||
|
install(FILES ${MODULE_FILES} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LAMMPS)
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
configure_file(LAMMPSConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LAMMPSConfig.cmake @ONLY)
|
||||||
|
write_basic_package_version_file("LAMMPSConfigVersion.cmake" VERSION ${PROJECT_VERSION} COMPATIBILITY ExactVersion)
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LAMMPSConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/LAMMPSConfigVersion.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LAMMPS)
|
||||||
endif()
|
endif()
|
||||||
|
install(FILES ${LAMMPS_DOC_DIR}/lammps.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 RENAME ${LAMMPS_BINARY}.1)
|
||||||
|
|
||||||
if(BUILD_TOOLS)
|
if(BUILD_TOOLS)
|
||||||
add_executable(binary2txt ${LAMMPS_TOOLS_DIR}/binary2txt.cpp)
|
add_executable(binary2txt ${LAMMPS_TOOLS_DIR}/binary2txt.cpp)
|
||||||
|
target_compile_definitions(binary2txt PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||||
install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
||||||
include(CheckGeneratorSupport)
|
include(CheckGeneratorSupport)
|
||||||
if(CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
if(CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
||||||
|
include(CheckLanguage)
|
||||||
|
check_language(Fortran)
|
||||||
|
if(CMAKE_Fortran_COMPILER)
|
||||||
enable_language(Fortran)
|
enable_language(Fortran)
|
||||||
add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f)
|
add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f)
|
||||||
target_link_libraries(chain.x ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||||
install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
else()
|
||||||
|
message(WARNING "No suitable Fortran compiler found, skipping building 'chain.x'")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(WARNING "CMake build doesn't support fortran, skipping building 'chain.x'")
|
message(WARNING "CMake build doesn't support fortran, skipping building 'chain.x'")
|
||||||
endif()
|
endif()
|
||||||
@ -625,7 +575,7 @@ if(BUILD_TOOLS)
|
|||||||
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
||||||
file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
||||||
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
||||||
target_link_libraries(msi2lmp m)
|
target_link_libraries(msi2lmp PRIVATE ${MATH_LIBRARIES})
|
||||||
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||||
endif()
|
endif()
|
||||||
@ -655,12 +605,19 @@ install(
|
|||||||
# conventional build. Only available, if a shared library is built.
|
# conventional build. Only available, if a shared library is built.
|
||||||
# This is primarily for people that only want to use the Python wrapper.
|
# This is primarily for people that only want to use the Python wrapper.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
if(BUILD_LIB AND BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
find_package(PythonInterp)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
if (PYTHONINTERP_FOUND)
|
find_package(PythonInterp) # Deprecated since version 3.12
|
||||||
|
if(PYTHONINTERP_FOUND)
|
||||||
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(Python COMPONENTS Interpreter)
|
||||||
|
endif()
|
||||||
|
if (Python_EXECUTABLE)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
install-python
|
install-python
|
||||||
${PYTHON_EXECUTABLE} install.py -v ${LAMMPS_SOURCE_DIR}/version.h
|
${Python_EXECUTABLE} install.py -v ${LAMMPS_SOURCE_DIR}/version.h
|
||||||
-m ${LAMMPS_PYTHON_DIR}/lammps.py
|
-m ${LAMMPS_PYTHON_DIR}/lammps.py
|
||||||
-l ${CMAKE_BINARY_DIR}/liblammps${CMAKE_SHARED_LIBRARY_SUFFIX}
|
-l ${CMAKE_BINARY_DIR}/liblammps${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR}
|
WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR}
|
||||||
@ -681,10 +638,17 @@ endif()
|
|||||||
# LAMMPS for package managers and with different prefix settings.
|
# LAMMPS for package managers and with different prefix settings.
|
||||||
# This requires either a shared library or that the PYTHON package is included.
|
# This requires either a shared library or that the PYTHON package is included.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
if((BUILD_LIB AND BUILD_SHARED_LIBS) OR (PKG_PYTHON))
|
if(BUILD_SHARED_LIBS OR PKG_PYTHON)
|
||||||
find_package(PythonInterp)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
if (PYTHONINTERP_FOUND)
|
find_package(PythonInterp) # Deprecated since version 3.12
|
||||||
execute_process(COMMAND ${PYTHON_EXECUTABLE}
|
if(PYTHONINTERP_FOUND)
|
||||||
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(Python COMPONENTS Interpreter)
|
||||||
|
endif()
|
||||||
|
if (Python_EXECUTABLE)
|
||||||
|
execute_process(COMMAND ${Python_EXECUTABLE}
|
||||||
-c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))"
|
-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)
|
OUTPUT_VARIABLE PYTHON_DEFAULT_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
set(PYTHON_INSTDIR ${PYTHON_DEFAULT_INSTDIR} CACHE PATH "Installation folder for LAMMPS Python module")
|
set(PYTHON_INSTDIR ${PYTHON_DEFAULT_INSTDIR} CACHE PATH "Installation folder for LAMMPS Python module")
|
||||||
@ -698,59 +662,75 @@ include(CodeCoverage)
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Print package summary
|
# Print package summary
|
||||||
###############################################################################
|
###############################################################################
|
||||||
foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
|
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||||
if(PKG_${PKG})
|
if(PKG_${PKG})
|
||||||
message(STATUS "Building package: ${PKG}")
|
message(STATUS "Building package: ${PKG}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
get_directory_property(CPPFLAGS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
|
get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
||||||
message(STATUS "<<< Build configuration >>>
|
message(STATUS "<<< Build configuration >>>
|
||||||
Build type ${CMAKE_BUILD_TYPE}
|
Build type: ${CMAKE_BUILD_TYPE}
|
||||||
Install path ${CMAKE_INSTALL_PREFIX}
|
Install path: ${CMAKE_INSTALL_PREFIX}
|
||||||
Generator ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}
|
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}
|
||||||
Compilers and Flags:
|
-- <<< Compilers and Flags: >>>
|
||||||
C++ Compiler ${CMAKE_CXX_COMPILER}
|
-- C++ Compiler: ${CMAKE_CXX_COMPILER}
|
||||||
Type ${CMAKE_CXX_COMPILER_ID}
|
Type: ${CMAKE_CXX_COMPILER_ID}
|
||||||
Version ${CMAKE_CXX_COMPILER_VERSION}
|
Version: ${CMAKE_CXX_COMPILER_VERSION}
|
||||||
C++ Flags ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}
|
C++ Flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}
|
||||||
Defines ${CPPFLAGS}")
|
Defines: ${DEFINES}")
|
||||||
|
get_target_property(OPTIONS lammps COMPILE_OPTIONS)
|
||||||
|
if(OPTIONS)
|
||||||
|
message(" Options: ${OPTIONS}")
|
||||||
|
endif()
|
||||||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||||
list (FIND LANGUAGES "Fortran" _index)
|
list (FIND LANGUAGES "Fortran" _index)
|
||||||
if (${_index} GREATER -1)
|
if (${_index} GREATER -1)
|
||||||
message(STATUS "Fortran Compiler ${CMAKE_Fortran_COMPILER}
|
message(STATUS "Fortran Compiler: ${CMAKE_Fortran_COMPILER}
|
||||||
Type ${CMAKE_Fortran_COMPILER_ID}
|
Type: ${CMAKE_Fortran_COMPILER_ID}
|
||||||
Version ${CMAKE_Fortran_COMPILER_VERSION}
|
Version: ${CMAKE_Fortran_COMPILER_VERSION}
|
||||||
Fortran Flags ${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BTYPE}}")
|
Fortran Flags:${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BTYPE}}")
|
||||||
endif()
|
endif()
|
||||||
list (FIND LANGUAGES "C" _index)
|
list (FIND LANGUAGES "C" _index)
|
||||||
if (${_index} GREATER -1)
|
if (${_index} GREATER -1)
|
||||||
message(STATUS "C compiler ${CMAKE_C_COMPILER}
|
message(STATUS "C compiler: ${CMAKE_C_COMPILER}
|
||||||
Type ${CMAKE_C_COMPILER_ID}
|
Type: ${CMAKE_C_COMPILER_ID}
|
||||||
Version ${CMAKE_C_COMPILER_VERSION}
|
Version: ${CMAKE_C_COMPILER_VERSION}
|
||||||
C Flags ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BTYPE}}")
|
C Flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BTYPE}}")
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "<<< Linker flags: >>>")
|
||||||
|
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
||||||
if(CMAKE_EXE_LINKER_FLAGS)
|
if(CMAKE_EXE_LINKER_FLAGS)
|
||||||
message(STATUS "Linker flags:
|
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
Executable ${CMAKE_EXE_LINKER_FLAGS}")
|
|
||||||
endif()
|
endif()
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
message(STATUS "Shared library flags: ${CMAKE_SHARED_LINKER_FLAGS}")
|
message(STATUS "Shared library flags: ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Static library flags: ${CMAKE_STATIC_LINKER_FLAGS}")
|
message(STATUS "Static library flags: ${CMAKE_STATIC_LINKER_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "Link libraries: ${LAMMPS_LINK_LIBS}")
|
|
||||||
if(BUILD_MPI)
|
if(BUILD_MPI)
|
||||||
message(STATUS "Using MPI with headers in ${MPI_CXX_INCLUDE_PATH} and these libraries: ${MPI_CXX_LIBRARIES};${MPI_Fortran_LIBRARIES}")
|
message(STATUS "<<< MPI flags >>>
|
||||||
|
-- MPI_defines: ${MPI_CXX_COMPILE_DEFINITIONS}
|
||||||
|
-- MPI includes: ${MPI_CXX_INCLUDE_PATH}
|
||||||
|
-- MPI libraries: ${MPI_CXX_LIBRARIES};${MPI_Fortran_LIBRARIES}")
|
||||||
endif()
|
endif()
|
||||||
if(PKG_GPU)
|
if(PKG_GPU)
|
||||||
message(STATUS "GPU API: ${GPU_API}")
|
message(STATUS "<<< GPU package settings >>>
|
||||||
|
-- GPU API: ${GPU_API}")
|
||||||
if(GPU_API STREQUAL "CUDA")
|
if(GPU_API STREQUAL "CUDA")
|
||||||
message(STATUS "GPU architecture: ${GPU_ARCH}")
|
message(STATUS "GPU architecture: ${GPU_ARCH}")
|
||||||
elseif(GPU_API STREQUAL "OPENCL")
|
elseif(GPU_API STREQUAL "OPENCL")
|
||||||
message(STATUS "OpenCL parameter tuning: ${OCL_TUNE}")
|
message(STATUS "OpenCL tuning: ${OCL_TUNE}")
|
||||||
|
elseif(GPU_API STREQUAL "HIP")
|
||||||
|
message(STATUS "HIP platform: ${HIP_PLATFORM}")
|
||||||
|
message(STATUS "HIP architecture: ${HIP_ARCH}")
|
||||||
|
if(HIP_USE_DEVICE_SORT)
|
||||||
|
message(STATUS "HIP GPU sorting: on")
|
||||||
|
else()
|
||||||
|
message(STATUS "HIP GPU sorting: off")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "GPU precision: ${GPU_PREC}")
|
message(STATUS "GPU precision: ${GPU_PREC}")
|
||||||
endif()
|
endif()
|
||||||
@ -758,7 +738,8 @@ if(PKG_KOKKOS)
|
|||||||
message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}")
|
message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}")
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KSPACE)
|
if(PKG_KSPACE)
|
||||||
message(STATUS "Using ${FFT} as primary FFT library")
|
message(STATUS "<<< FFT settings >>>
|
||||||
|
-- Primary FFT lib: ${FFT}")
|
||||||
if(FFT_SINGLE)
|
if(FFT_SINGLE)
|
||||||
message(STATUS "Using single precision FFTs")
|
message(STATUS "Using single precision FFTs")
|
||||||
else()
|
else()
|
||||||
@ -770,7 +751,7 @@ if(PKG_KSPACE)
|
|||||||
message(STATUS "Using non-threaded FFTs")
|
message(STATUS "Using non-threaded FFTs")
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KOKKOS)
|
if(PKG_KOKKOS)
|
||||||
if(KOKKOS_ENABLE_CUDA)
|
if(Kokkos_ENABLE_CUDA)
|
||||||
if (${FFT} STREQUAL "KISS")
|
if (${FFT} STREQUAL "KISS")
|
||||||
message(STATUS "Kokkos FFT: KISS")
|
message(STATUS "Kokkos FFT: KISS")
|
||||||
else()
|
else()
|
||||||
|
|||||||
@ -1,48 +0,0 @@
|
|||||||
# - 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()
|
|
||||||
11
cmake/LAMMPSConfig.cmake.in
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
if(@BUILD_MPI@)
|
||||||
|
find_dependency(MPI REQUIRED CXX)
|
||||||
|
endif()
|
||||||
|
if(@PKG_KSPACE@)
|
||||||
|
if(@FFT@ STREQUAL "FFTW3")
|
||||||
|
find_dependency(@FFTW@ REQUIRED MODULE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/LAMMPS_Targets.cmake")
|
||||||
@ -1,10 +1,8 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Build documentation
|
# Build documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
option(BUILD_DOC "Build LAMMPS documentation" OFF)
|
option(BUILD_DOC "Build LAMMPS HTML documentation" OFF)
|
||||||
if(BUILD_DOC)
|
if(BUILD_DOC)
|
||||||
include(ProcessorCount)
|
|
||||||
ProcessorCount(NPROCS)
|
|
||||||
find_package(PythonInterp 3 REQUIRED)
|
find_package(PythonInterp 3 REQUIRED)
|
||||||
|
|
||||||
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m virtualenv)
|
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m virtualenv)
|
||||||
@ -26,15 +24,49 @@ if(BUILD_DOC)
|
|||||||
COMMAND ${DOCENV_BINARY_DIR}/pip install --upgrade ${LAMMPS_DOC_DIR}/utils/converters
|
COMMAND ${DOCENV_BINARY_DIR}/pip install --upgrade ${LAMMPS_DOC_DIR}/utils/converters
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# download mathjax distribution and unpack to folder "mathjax"
|
||||||
|
file(DOWNLOAD "https://github.com/mathjax/MathJax/archive/3.0.5.tar.gz"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz"
|
||||||
|
EXPECTED_MD5 5d9d3799cce77a1a95eee6be04eb68e7)
|
||||||
|
|
||||||
|
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mathjax)
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
file(GLOB MATHJAX_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${CMAKE_CURRENT_BINARY_DIR}/mathjax)
|
||||||
|
endif()
|
||||||
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/_static/mathjax)
|
||||||
|
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/mathjax/es5 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/html/_static/mathjax/)
|
||||||
|
|
||||||
|
# note, this may run in parallel with other tasks, so we must not use multiple processes here
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT html
|
OUTPUT html
|
||||||
DEPENDS ${DOC_SOURCES} docenv requirements.txt
|
DEPENDS ${DOC_SOURCES} docenv requirements.txt
|
||||||
COMMAND ${DOCENV_BINARY_DIR}/sphinx-build -j ${NPROCS} -b html -c ${LAMMPS_DOC_DIR}/utils/sphinx-config -d ${CMAKE_BINARY_DIR}/doctrees ${LAMMPS_DOC_DIR}/src html
|
COMMAND ${DOCENV_BINARY_DIR}/sphinx-build -b html -c ${LAMMPS_DOC_DIR}/utils/sphinx-config -d ${CMAKE_BINARY_DIR}/doctrees ${LAMMPS_DOC_DIR}/src html
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# copy selected image files to html output tree
|
||||||
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/html/JPG)
|
||||||
|
set(HTML_EXTRA_IMAGES balance_nonuniform.jpg balance_rcb.jpg
|
||||||
|
balance_uniform.jpg bow_tutorial_01.png bow_tutorial_02.png
|
||||||
|
bow_tutorial_03.png bow_tutorial_04.png bow_tutorial_05.png
|
||||||
|
dump1.jpg dump2.jpg examples_mdpd.gif gran_funnel.png gran_mixer.png
|
||||||
|
hop1.jpg hop2.jpg saed_ewald_intersect.jpg saed_mesh.jpg
|
||||||
|
screenshot_atomeye.jpg screenshot_gl.jpg screenshot_pymol.jpg
|
||||||
|
screenshot_vmd.jpg sinusoid.jpg xrd_mesh.jpg)
|
||||||
|
set(HTML_IMAGE_TARGETS "")
|
||||||
|
foreach(_IMG ${HTML_EXTRA_IMAGES})
|
||||||
|
string(PREPEND _IMG JPG/)
|
||||||
|
list(APPEND HTML_IMAGE_TARGETS "html/${_IMG}")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/${_IMG}
|
||||||
|
DEPENDS ${LAMMPS_DOC_DIR}/src/${_IMG} html/JPG
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${LAMMPS_DOC_DIR}/src/${_IMG} ${CMAKE_BINARY_DIR}/html/${_IMG}
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
doc ALL
|
doc ALL
|
||||||
DEPENDS html
|
DEPENDS html html/_static/mathjax/es5 ${HTML_IMAGE_TARGETS}
|
||||||
SOURCES ${LAMMPS_DOC_DIR}/utils/requirements.txt ${DOC_SOURCES}
|
SOURCES ${LAMMPS_DOC_DIR}/utils/requirements.txt ${DOC_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
16
cmake/Modules/FindCUB.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# - Find CUB
|
||||||
|
# Find the CUB header library
|
||||||
|
#
|
||||||
|
# CUB_INCLUDE_DIRS - where to find cub/cub.cuh
|
||||||
|
# CUB_FOUND - True if CUB found.
|
||||||
|
#
|
||||||
|
|
||||||
|
find_path(CUB_INCLUDE_DIR cub.cuh PATH_SUFFIXES cub)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set CUB_FOUND to TRUE
|
||||||
|
# if all listed variables are TRUE
|
||||||
|
|
||||||
|
find_package_handle_standard_args(CUB DEFAULT_MSG CUB_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(CUB_INCLUDE_DIR)
|
||||||
@ -14,14 +14,34 @@ find_path(FFTW3_INCLUDE_DIR fftw3.h HINTS ${PC_FFTW3_INCLUDE_DIRS})
|
|||||||
find_library(FFTW3_LIBRARY NAMES fftw3 HINTS ${PC_FFTW3_LIBRARY_DIRS})
|
find_library(FFTW3_LIBRARY NAMES fftw3 HINTS ${PC_FFTW3_LIBRARY_DIRS})
|
||||||
find_library(FFTW3_OMP_LIBRARY NAMES fftw3_omp HINTS ${PC_FFTW3_LIBRARY_DIRS})
|
find_library(FFTW3_OMP_LIBRARY NAMES fftw3_omp HINTS ${PC_FFTW3_LIBRARY_DIRS})
|
||||||
|
|
||||||
set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR})
|
|
||||||
set(FFTW3_LIBRARIES ${FFTW3_LIBRARY})
|
|
||||||
set(FFTW3_OMP_LIBRARIES ${FFTW3_OMP_LIBRARY})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE
|
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE
|
||||||
# if all listed variables are TRUE
|
# if all listed variables are TRUE
|
||||||
|
|
||||||
find_package_handle_standard_args(FFTW3 DEFAULT_MSG FFTW3_LIBRARY FFTW3_INCLUDE_DIR)
|
find_package_handle_standard_args(FFTW3 DEFAULT_MSG FFTW3_LIBRARY FFTW3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# Copy the results to the output variables and target.
|
||||||
|
if(FFTW3_FOUND)
|
||||||
|
set(FFTW3_LIBRARIES ${FFTW3_LIBRARY} )
|
||||||
|
set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
if(NOT TARGET FFTW3::FFTW3)
|
||||||
|
add_library(FFTW3::FFTW3 UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(FFTW3::FFTW3 PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${FFTW3_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIRS}")
|
||||||
|
endif()
|
||||||
|
if(FFTW3_OMP_LIBRARY)
|
||||||
|
set(FFTW3_OMP_LIBRARIES ${FFTW3_OMP_LIBRARY})
|
||||||
|
if(NOT TARGET FFTW3::FFTW3_OMP)
|
||||||
|
add_library(FFTW3::FFTW3_OMP UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(FFTW3::FFTW3_OMP PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${FFTW3_OMP_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIRS}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARY FFTW3_OMP_LIBRARY)
|
mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARY FFTW3_OMP_LIBRARY)
|
||||||
|
|||||||
@ -13,14 +13,34 @@ find_path(FFTW3F_INCLUDE_DIR fftw3.h HINTS ${PC_FFTW3F_INCLUDE_DIRS})
|
|||||||
find_library(FFTW3F_LIBRARY NAMES fftw3f HINTS ${PC_FFTW3F_LIBRARY_DIRS})
|
find_library(FFTW3F_LIBRARY NAMES fftw3f HINTS ${PC_FFTW3F_LIBRARY_DIRS})
|
||||||
find_library(FFTW3F_OMP_LIBRARY NAMES fftw3f_omp HINTS ${PC_FFTW3F_LIBRARY_DIRS})
|
find_library(FFTW3F_OMP_LIBRARY NAMES fftw3f_omp HINTS ${PC_FFTW3F_LIBRARY_DIRS})
|
||||||
|
|
||||||
set(FFTW3F_INCLUDE_DIRS ${FFTW3F_INCLUDE_DIR})
|
|
||||||
set(FFTW3F_LIBRARIES ${FFTW3F_LIBRARY})
|
|
||||||
set(FFTW3F_OMP_LIBRARIES ${FFTW3F_OMP_LIBRARY})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
# handle the QUIETLY and REQUIRED arguments and set FFTW3F_FOUND to TRUE
|
# handle the QUIETLY and REQUIRED arguments and set FFTW3F_FOUND to TRUE
|
||||||
# if all listed variables are TRUE
|
# if all listed variables are TRUE
|
||||||
|
|
||||||
find_package_handle_standard_args(FFTW3F DEFAULT_MSG FFTW3F_LIBRARY FFTW3F_INCLUDE_DIR)
|
find_package_handle_standard_args(FFTW3F DEFAULT_MSG FFTW3F_LIBRARY FFTW3F_INCLUDE_DIR)
|
||||||
|
|
||||||
mark_as_advanced(FFTW3F_INCLUDE_DIR FFTW3F_LIBRARY)
|
# Copy the results to the output variables and target.
|
||||||
|
if(FFTW3F_FOUND)
|
||||||
|
set(FFTW3F_LIBRARIES ${FFTW3F_LIBRARY} )
|
||||||
|
set(FFTW3F_INCLUDE_DIRS ${FFTW3F_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
if(NOT TARGET FFTW3F::FFTW3F)
|
||||||
|
add_library(FFTW3F::FFTW3F UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(FFTW3F::FFTW3F PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${FFTW3F_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${FFTW3F_INCLUDE_DIRS}")
|
||||||
|
endif()
|
||||||
|
if(FFTW3F_OMP_LIBRARY)
|
||||||
|
set(FFTW3F_OMP_LIBRARIES ${FFTW3F_OMP_LIBRARY})
|
||||||
|
if(NOT TARGET FFTW3F::FFTW3F_OMP)
|
||||||
|
add_library(FFTW3F::FFTW3F_OMP UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(FFTW3F::FFTW3F_OMP PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${FFTW3F_OMP_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${FFTW3F_INCLUDE_DIRS}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(FFTW3F_INCLUDE_DIR FFTW3F_LIBRARY FFTW3F_OMP_LIBRARY)
|
||||||
|
|||||||
@ -1,85 +0,0 @@
|
|||||||
#
|
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
function(_KIMAPI_GET_VERSION _OUT_ver _version_hdr)
|
|
||||||
if(NOT EXISTS ${_version_hdr})
|
|
||||||
message(FATAL_ERROR "Header file ${_version_hdr} not found (check value of KIM-API_INCLUDE_DIR)")
|
|
||||||
endif()
|
|
||||||
foreach(_var KIM_VERSION_MAJOR KIM_VERSION_MINOR KIM_VERSION_PATCH)
|
|
||||||
file(STRINGS ${_version_hdr} _contents REGEX "#define ${_var}[ \t]+")
|
|
||||||
if(_contents)
|
|
||||||
string(REGEX REPLACE ".*#define ${_var}[ \t]+([0-9]+).*" "\\1" _${_var} "${_contents}")
|
|
||||||
if(${_${_var}} STREQUAL "")
|
|
||||||
message(FATAL_ERROR "Version parsing failed for ${_var} in ${_version_hdr}, got empty return!")
|
|
||||||
elseif(NOT ${_${_var}} MATCHES "^[0-9]+$")
|
|
||||||
message(FATAL_ERROR "Version parsing failed for ${_var} in ${_version_hdr}, excepted a number but got ${_${_var}}!")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "No ${_var} line found in include file ${_version_hdr}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
set(${_OUT_ver} ${_KIM_VERSION_MAJOR}.${_KIM_VERSION_MINOR}.${_KIM_VERSION_PATCH} PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
||||||
if(KIM-API_INCLUDEDIR)
|
|
||||||
_KIMAPI_GET_VERSION(KIM-API_VERSION ${KIM-API_INCLUDEDIR}/KIM_Version.h)
|
|
||||||
else()
|
|
||||||
set(KIM-API_VERSION 0)
|
|
||||||
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 VERSION_VAR KIM-API_VERSION)
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
# - Find latte
|
|
||||||
# Find the native LATTE libraries.
|
|
||||||
#
|
|
||||||
# LATTE_LIBRARIES - List of libraries when using latte.
|
|
||||||
# LATTE_FOUND - True if latte found.
|
|
||||||
#
|
|
||||||
|
|
||||||
find_library(LATTE_LIBRARY NAMES latte)
|
|
||||||
|
|
||||||
set(LATTE_LIBRARIES ${LATTE_LIBRARY})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set LATTE_FOUND to TRUE
|
|
||||||
# if all listed variables are TRUE
|
|
||||||
|
|
||||||
find_package_handle_standard_args(LATTE DEFAULT_MSG LATTE_LIBRARY)
|
|
||||||
|
|
||||||
mark_as_advanced(LATTE_LIBRARY)
|
|
||||||
@ -10,13 +10,22 @@ find_path(MKL_INCLUDE_DIR mkl_dfti.h HINTS $ENV{MKLROOT}/include)
|
|||||||
|
|
||||||
find_library(MKL_LIBRARY NAMES mkl_rt HINTS $ENV{MKLROOT}/lib $ENV{MKLROOT}/lib/intel64)
|
find_library(MKL_LIBRARY NAMES mkl_rt HINTS $ENV{MKLROOT}/lib $ENV{MKLROOT}/lib/intel64)
|
||||||
|
|
||||||
set(MKL_LIBRARIES ${MKL_LIBRARY})
|
|
||||||
set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
# handle the QUIETLY and REQUIRED arguments and set MKL_FOUND to TRUE
|
# handle the QUIETLY and REQUIRED arguments and set MKL_FOUND to TRUE
|
||||||
# if all listed variables are TRUE
|
# if all listed variables are TRUE
|
||||||
|
|
||||||
find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARY MKL_INCLUDE_DIR)
|
find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARY MKL_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(MKL_FOUND)
|
||||||
|
set(MKL_LIBRARIES ${MKL_LIBRARY})
|
||||||
|
set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET MKL::MKL)
|
||||||
|
add_library(MKL::MKL UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(MKL::MKL PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${MKL_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
mark_as_advanced(MKL_INCLUDE_DIR MKL_LIBRARY )
|
mark_as_advanced(MKL_INCLUDE_DIR MKL_LIBRARY )
|
||||||
|
|||||||
@ -10,13 +10,23 @@ find_path(MSCG_INCLUDE_DIR mscg.h PATH_SUFFIXES mscg)
|
|||||||
|
|
||||||
find_library(MSCG_LIBRARY NAMES mscg)
|
find_library(MSCG_LIBRARY NAMES mscg)
|
||||||
|
|
||||||
set(MSCG_LIBRARIES ${MSCG_LIBRARY})
|
|
||||||
set(MSCG_INCLUDE_DIRS ${MSCG_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
# handle the QUIETLY and REQUIRED arguments and set MSCG_FOUND to TRUE
|
# handle the QUIETLY and REQUIRED arguments and set MSCG_FOUND to TRUE
|
||||||
# if all listed variables are TRUE
|
# if all listed variables are TRUE
|
||||||
|
|
||||||
find_package_handle_standard_args(MSCG DEFAULT_MSG MSCG_LIBRARY MSCG_INCLUDE_DIR)
|
find_package_handle_standard_args(MSCG DEFAULT_MSG MSCG_LIBRARY MSCG_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# Copy the results to the output variables and target.
|
||||||
|
if(MSCG_FOUND)
|
||||||
|
set(MSCG_LIBRARIES ${MSCG_LIBRARY})
|
||||||
|
set(MSCG_INCLUDE_DIRS ${MSCG_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET MSCG::MSCG)
|
||||||
|
add_library(MSCG::MSCG UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(MSCG::MSCG PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${MSCG_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${MSCG_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
mark_as_advanced(MSCG_INCLUDE_DIR MSCG_LIBRARY )
|
mark_as_advanced(MSCG_INCLUDE_DIR MSCG_LIBRARY )
|
||||||
|
|||||||
@ -120,3 +120,14 @@ set (NETCDF_INCLUDE_DIRS ${NetCDF_includes})
|
|||||||
include (FindPackageHandleStandardArgs)
|
include (FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args (NetCDF
|
find_package_handle_standard_args (NetCDF
|
||||||
DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDE_DIRS NETCDF_HAS_INTERFACES)
|
DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDE_DIRS NETCDF_HAS_INTERFACES)
|
||||||
|
|
||||||
|
# Copy the results to the output variables and target.
|
||||||
|
if(NetCDF_FOUND)
|
||||||
|
if(NOT TARGET NetCDF::NetCDF)
|
||||||
|
add_library(NetCDF::NetCDF UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(NetCDF::NetCDF PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${NETCDF_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_INCLUDE_DIRS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${NETCDF_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|||||||
@ -53,3 +53,12 @@ include (FindPackageHandleStandardArgs)
|
|||||||
find_package_handle_standard_args (PNetCDF DEFAULT_MSG PNETCDF_LIBRARIES PNETCDF_INCLUDES)
|
find_package_handle_standard_args (PNetCDF DEFAULT_MSG PNETCDF_LIBRARIES PNETCDF_INCLUDES)
|
||||||
|
|
||||||
mark_as_advanced (PNETCDF_LIBRARIES PNETCDF_INCLUDES)
|
mark_as_advanced (PNETCDF_LIBRARIES PNETCDF_INCLUDES)
|
||||||
|
|
||||||
|
if(PNetCDF_FOUND)
|
||||||
|
if(NOT TARGET PNetCDF::PNetCDF)
|
||||||
|
add_library(PNetCDF::PNetCDF UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(PNetCDF::PNetCDF PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${PNETCDF_LIBRARIES}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PNETCDF_INCLUDES}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|||||||
@ -7,12 +7,21 @@
|
|||||||
|
|
||||||
find_library(QUIP_LIBRARY NAMES quip)
|
find_library(QUIP_LIBRARY NAMES quip)
|
||||||
|
|
||||||
set(QUIP_LIBRARIES ${QUIP_LIBRARY})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
# handle the QUIETLY and REQUIRED arguments and set QUIP_FOUND to TRUE
|
# handle the QUIETLY and REQUIRED arguments and set QUIP_FOUND to TRUE
|
||||||
# if all listed variables are TRUE
|
# if all listed variables are TRUE
|
||||||
|
|
||||||
find_package_handle_standard_args(QUIP DEFAULT_MSG QUIP_LIBRARY)
|
find_package_handle_standard_args(QUIP DEFAULT_MSG QUIP_LIBRARY)
|
||||||
|
|
||||||
|
# Copy the results to the output variables and target.
|
||||||
|
if(QUIP_FOUND)
|
||||||
|
set(QUIP_LIBRARIES ${QUIP_LIBRARY})
|
||||||
|
|
||||||
|
if(NOT TARGET QUIP::QUIP)
|
||||||
|
add_library(QUIP::QUIP UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(QUIP::QUIP PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${QUIP_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
mark_as_advanced(QUIP_LIBRARY)
|
mark_as_advanced(QUIP_LIBRARY)
|
||||||
|
|||||||
@ -1,46 +0,0 @@
|
|||||||
# - 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 )
|
|
||||||
37
cmake/Modules/FindTBB_MALLOC.cmake
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# - Find parts of TBB_MALLOC
|
||||||
|
# Find the native TBB_MALLOC headers and libraries.
|
||||||
|
#
|
||||||
|
# TBB_MALLOC_INCLUDE_DIRS - where to find tbb.h, etc.
|
||||||
|
# TBB_MALLOC_LIBRARIES - List of libraries when using tbb.
|
||||||
|
# TBB_MALLOC_FOUND - True if tbb found.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
# 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.8
|
||||||
|
$ENV{TBBROOT}/lib/intel64/gcc4.7
|
||||||
|
$ENV{TBBROOT}/lib/intel64/gcc4.4
|
||||||
|
$ENV{TBBROOT}/lib/intel64/gcc4.1)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
if(TBB_MALLOC_FOUND)
|
||||||
|
set(TBB_MALLOC_LIBRARIES ${TBB_MALLOC_LIBRARY})
|
||||||
|
set(TBB_MALLOC_INCLUDE_DIRS ${TBB_MALLOC_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET TBB::TBB_MALLOC)
|
||||||
|
add_library(TBB::TBB_MALLOC UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(TBB::TBB_MALLOC PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${TBB_MALLOC_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${TBB_MALLOC_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(TBB_MALLOC_INCLUDE_DIR TBB_MALLOC_LIBRARY )
|
||||||
@ -10,13 +10,23 @@ find_path(VORO_INCLUDE_DIR voro++.hh PATH_SUFFIXES voro++)
|
|||||||
|
|
||||||
find_library(VORO_LIBRARY NAMES voro++)
|
find_library(VORO_LIBRARY NAMES voro++)
|
||||||
|
|
||||||
set(VORO_LIBRARIES ${VORO_LIBRARY})
|
|
||||||
set(VORO_INCLUDE_DIRS ${VORO_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
# handle the QUIETLY and REQUIRED arguments and set VORO_FOUND to TRUE
|
# handle the QUIETLY and REQUIRED arguments and set VORO_FOUND to TRUE
|
||||||
# if all listed variables are TRUE
|
# if all listed variables are TRUE
|
||||||
|
|
||||||
find_package_handle_standard_args(VORO DEFAULT_MSG VORO_LIBRARY VORO_INCLUDE_DIR)
|
find_package_handle_standard_args(VORO DEFAULT_MSG VORO_LIBRARY VORO_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# Copy the results to the output variables and target.
|
||||||
|
if(VORO_FOUND)
|
||||||
|
set(VORO_LIBRARIES ${VORO_LIBRARY})
|
||||||
|
set(VORO_INCLUDE_DIRS ${VORO_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET VORO::VORO)
|
||||||
|
add_library(VORO::VORO UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(VORO::VORO PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${VORO_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${VORO_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
mark_as_advanced(VORO_INCLUDE_DIR VORO_LIBRARY )
|
mark_as_advanced(VORO_INCLUDE_DIR VORO_LIBRARY )
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
find_path(ZMQ_INCLUDE_DIR zmq.h)
|
find_path(ZMQ_INCLUDE_DIR zmq.h)
|
||||||
find_library(ZMQ_LIBRARY NAMES zmq)
|
find_library(ZMQ_LIBRARY NAMES zmq)
|
||||||
|
|
||||||
set(ZMQ_LIBRARIES ${ZMQ_LIBRARY})
|
|
||||||
set(ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(ZMQ DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR)
|
find_package_handle_standard_args(ZMQ DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# Copy the results to the output variables and target.
|
||||||
|
if(ZMQ_FOUND)
|
||||||
|
set(ZMQ_LIBRARIES ${ZMQ_LIBRARY})
|
||||||
|
set(ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET ZMQ::ZMQ)
|
||||||
|
add_library(ZMQ::ZMQ UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(ZMQ::ZMQ PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${ZMQ_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${ZMQ_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|||||||
3
cmake/Modules/GenerateBinaryHeader.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# utility script to call GenerateBinaryHeader function
|
||||||
|
include(${SOURCE_DIR}/Modules/LAMMPSUtils.cmake)
|
||||||
|
GenerateBinaryHeader(${VARNAME} ${HEADER_FILE} ${SOURCE_FILES})
|
||||||
@ -69,3 +69,19 @@ macro(pkg_depends PKG1 PKG2)
|
|||||||
message(FATAL_ERROR "${PKG1} package needs LAMMPS to be build with ${PKG2}")
|
message(FATAL_ERROR "${PKG1} package needs LAMMPS to be build with ${PKG2}")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# CMake-only replacement for bin2c and xxd
|
||||||
|
function(GenerateBinaryHeader varname outfile files)
|
||||||
|
message("Creating ${outfile}...")
|
||||||
|
file(WRITE ${outfile} "// CMake generated file\n")
|
||||||
|
math(EXPR ARG_END "${ARGC}-1")
|
||||||
|
|
||||||
|
foreach(IDX RANGE 2 ${ARG_END})
|
||||||
|
list(GET ARGV ${IDX} filename)
|
||||||
|
file(READ ${filename} content HEX)
|
||||||
|
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," content "${content}")
|
||||||
|
string(REGEX REPLACE ",$" "" content "${content}")
|
||||||
|
file(APPEND ${outfile} "const unsigned char ${varname}[] = { ${content} };\n")
|
||||||
|
file(APPEND ${outfile} "const unsigned int ${varname}_size = sizeof(${varname});\n")
|
||||||
|
endforeach()
|
||||||
|
endfunction(GenerateBinaryHeader)
|
||||||
|
|||||||
@ -16,8 +16,15 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||||
add_definitions(-DMPICH_SKIP_MPICXX)
|
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||||
include_directories("${SOURCE_DIR}/include")
|
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||||
set(MPI4WIN_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||||
list(APPEND LAMMPS_DEPS mpi4win_build)
|
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||||
set(LAMMPS_USE_MPI4WIN ON)
|
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
|
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||||
|
|
||||||
|
# set variables for status reporting at the end of CMake run
|
||||||
|
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||||
|
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
|
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
if(PKG_COMPRESS)
|
find_package(ZLIB REQUIRED)
|
||||||
find_package(ZLIB REQUIRED)
|
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
|
||||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${ZLIB_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
if(PKG_CORESHELL)
|
|
||||||
set(CORESHELL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/CORESHELL)
|
set(CORESHELL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/CORESHELL)
|
||||||
set(CORESHELL_SOURCES)
|
set(CORESHELL_SOURCES)
|
||||||
set_property(GLOBAL PROPERTY "CORESHELL_SOURCES" "${CORESHELL_SOURCES}")
|
set_property(GLOBAL PROPERTY "CORESHELL_SOURCES" "${CORESHELL_SOURCES}")
|
||||||
@ -8,6 +7,5 @@ if(PKG_CORESHELL)
|
|||||||
|
|
||||||
get_property(CORESHELL_SOURCES GLOBAL PROPERTY CORESHELL_SOURCES)
|
get_property(CORESHELL_SOURCES GLOBAL PROPERTY CORESHELL_SOURCES)
|
||||||
|
|
||||||
list(APPEND LIB_SOURCES ${CORESHELL_SOURCES})
|
target_sources(lammps PRIVATE ${CORESHELL_SOURCES})
|
||||||
include_directories(${CORESHELL_SOURCES_DIR})
|
target_include_directories(lammps PRIVATE ${CORESHELL_SOURCES_DIR})
|
||||||
endif()
|
|
||||||
|
|||||||
@ -1,33 +1,32 @@
|
|||||||
if(PKG_GPU)
|
set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU)
|
||||||
set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU)
|
set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h
|
||||||
set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h
|
|
||||||
${GPU_SOURCES_DIR}/fix_gpu.h
|
${GPU_SOURCES_DIR}/fix_gpu.h
|
||||||
${GPU_SOURCES_DIR}/fix_gpu.cpp)
|
${GPU_SOURCES_DIR}/fix_gpu.cpp)
|
||||||
|
|
||||||
set(GPU_API "opencl" CACHE STRING "API used by GPU package")
|
set(GPU_API "opencl" CACHE STRING "API used by GPU package")
|
||||||
set(GPU_API_VALUES opencl cuda)
|
set(GPU_API_VALUES opencl cuda hip)
|
||||||
set_property(CACHE GPU_API PROPERTY STRINGS ${GPU_API_VALUES})
|
set_property(CACHE GPU_API PROPERTY STRINGS ${GPU_API_VALUES})
|
||||||
validate_option(GPU_API GPU_API_VALUES)
|
validate_option(GPU_API GPU_API_VALUES)
|
||||||
string(TOUPPER ${GPU_API} GPU_API)
|
string(TOUPPER ${GPU_API} GPU_API)
|
||||||
|
|
||||||
set(GPU_PREC "mixed" CACHE STRING "LAMMPS GPU precision")
|
set(GPU_PREC "mixed" CACHE STRING "LAMMPS GPU precision")
|
||||||
set(GPU_PREC_VALUES double mixed single)
|
set(GPU_PREC_VALUES double mixed single)
|
||||||
set_property(CACHE GPU_PREC PROPERTY STRINGS ${GPU_PREC_VALUES})
|
set_property(CACHE GPU_PREC PROPERTY STRINGS ${GPU_PREC_VALUES})
|
||||||
validate_option(GPU_PREC GPU_PREC_VALUES)
|
validate_option(GPU_PREC GPU_PREC_VALUES)
|
||||||
string(TOUPPER ${GPU_PREC} GPU_PREC)
|
string(TOUPPER ${GPU_PREC} GPU_PREC)
|
||||||
|
|
||||||
if(GPU_PREC STREQUAL "DOUBLE")
|
if(GPU_PREC STREQUAL "DOUBLE")
|
||||||
set(GPU_PREC_SETTING "DOUBLE_DOUBLE")
|
set(GPU_PREC_SETTING "DOUBLE_DOUBLE")
|
||||||
elseif(GPU_PREC STREQUAL "MIXED")
|
elseif(GPU_PREC STREQUAL "MIXED")
|
||||||
set(GPU_PREC_SETTING "SINGLE_DOUBLE")
|
set(GPU_PREC_SETTING "SINGLE_DOUBLE")
|
||||||
elseif(GPU_PREC STREQUAL "SINGLE")
|
elseif(GPU_PREC STREQUAL "SINGLE")
|
||||||
set(GPU_PREC_SETTING "SINGLE_SINGLE")
|
set(GPU_PREC_SETTING "SINGLE_SINGLE")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
||||||
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
|
|
||||||
if(GPU_API STREQUAL "CUDA")
|
if(GPU_API STREQUAL "CUDA")
|
||||||
find_package(CUDA REQUIRED)
|
find_package(CUDA REQUIRED)
|
||||||
find_program(BIN2C bin2c)
|
find_program(BIN2C bin2c)
|
||||||
if(NOT BIN2C)
|
if(NOT BIN2C)
|
||||||
@ -39,7 +38,7 @@ if(PKG_GPU)
|
|||||||
set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY")
|
set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
||||||
|
|
||||||
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)
|
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||||
@ -97,9 +96,8 @@ if(PKG_GPU)
|
|||||||
endforeach()
|
endforeach()
|
||||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LAMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h")
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LAMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h")
|
||||||
|
|
||||||
|
|
||||||
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
||||||
target_link_libraries(gpu ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
||||||
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
||||||
if(CUDPP_OPT)
|
if(CUDPP_OPT)
|
||||||
@ -107,19 +105,30 @@ if(PKG_GPU)
|
|||||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS gpu)
|
target_link_libraries(lammps PRIVATE gpu)
|
||||||
if(LAMMPS_USE_MPI4WIN)
|
|
||||||
add_dependencies(gpu mpi4win_build)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(nvc_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
add_executable(nvc_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||||
target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR)
|
target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR)
|
||||||
target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
elseif(GPU_API STREQUAL "OPENCL")
|
||||||
elseif(GPU_API STREQUAL "OPENCL")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
|
# download and unpack support binaries for compilation of windows binaries.
|
||||||
|
set(LAMMPS_THIRDPARTY_URL "http://download.lammps.org/thirdparty")
|
||||||
|
file(DOWNLOAD "${LAMMPS_THIRDPARTY_URL}/opencl-win-devel.tar.gz" "${CMAKE_CURRENT_BINARY_DIR}/opencl-win-devel.tar.gz"
|
||||||
|
EXPECTED_MD5 2c00364888d5671195598b44c2e0d44d)
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf opencl-win-devel.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
add_library(OpenCL::OpenCL UNKNOWN IMPORTED)
|
||||||
|
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
|
||||||
|
set_target_properties(OpenCL::OpenCL PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win32/libOpenCL.dll")
|
||||||
|
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
|
||||||
|
set_target_properties(OpenCL::OpenCL PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win64/libOpenCL.dll")
|
||||||
|
endif()
|
||||||
|
set_target_properties(OpenCL::OpenCL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/include")
|
||||||
|
else()
|
||||||
find_package(OpenCL REQUIRED)
|
find_package(OpenCL REQUIRED)
|
||||||
|
endif()
|
||||||
set(OCL_TUNE "generic" CACHE STRING "OpenCL Device Tuning")
|
set(OCL_TUNE "generic" CACHE STRING "OpenCL Device Tuning")
|
||||||
set(OCL_TUNE_VALUES intel fermi kepler cypress generic)
|
set(OCL_TUNE_VALUES intel fermi kepler cypress generic)
|
||||||
set_property(CACHE OCL_TUNE PROPERTY STRINGS ${OCL_TUNE_VALUES})
|
set_property(CACHE OCL_TUNE PROPERTY STRINGS ${OCL_TUNE_VALUES})
|
||||||
@ -166,32 +175,197 @@ if(PKG_GPU)
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
||||||
target_link_libraries(gpu ${OpenCL_LIBRARIES})
|
target_link_libraries(gpu PRIVATE OpenCL::OpenCL)
|
||||||
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu ${OpenCL_INCLUDE_DIRS})
|
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu)
|
||||||
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -D${OCL_TUNE}_OCL -DMPI_GERYON -DUCL_NO_EXIT)
|
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -D${OCL_TUNE}_OCL -DMPI_GERYON -DUCL_NO_EXIT)
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL)
|
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL)
|
||||||
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS gpu)
|
target_link_libraries(lammps PRIVATE gpu)
|
||||||
if(LAMMPS_USE_MPI4WIN)
|
|
||||||
add_dependencies(gpu mpi4win_build)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||||
target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL)
|
target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL)
|
||||||
target_link_libraries(ocl_get_devices PRIVATE ${OpenCL_LIBRARIES})
|
target_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL)
|
||||||
target_include_directories(ocl_get_devices PRIVATE ${OpenCL_INCLUDE_DIRS})
|
elseif(GPU_API STREQUAL "HIP")
|
||||||
|
if(NOT DEFINED HIP_PATH)
|
||||||
|
if(NOT DEFINED ENV{HIP_PATH})
|
||||||
|
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to which HIP has been installed")
|
||||||
|
else()
|
||||||
|
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH})
|
||||||
|
find_package(HIP REQUIRED)
|
||||||
|
option(HIP_USE_DEVICE_SORT "Use GPU sorting" ON)
|
||||||
|
|
||||||
|
if(NOT DEFINED HIP_PLATFORM)
|
||||||
|
if(NOT DEFINED ENV{HIP_PLATFORM})
|
||||||
|
set(HIP_PLATFORM "hcc" CACHE PATH "HIP Platform to be used during compilation")
|
||||||
|
else()
|
||||||
|
set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE PATH "HIP Platform used during compilation")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# GPU package
|
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
|
||||||
FindStyleHeaders(${GPU_SOURCES_DIR} FIX_CLASS fix_ FIX)
|
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}")
|
if(HIP_PLATFORM STREQUAL "hcc")
|
||||||
|
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
||||||
|
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
|
find_package(CUDA REQUIRED)
|
||||||
|
set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)")
|
||||||
|
|
||||||
# detects styles which have GPU version
|
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
||||||
RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES)
|
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
||||||
|
set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH} ")
|
||||||
|
# Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0
|
||||||
|
if((CUDA_VERSION VERSION_GREATER "3.1") AND (CUDA_VERSION VERSION_LESS "9.0"))
|
||||||
|
string(APPEND HIP_CUDA_GENCODE "-gencode arch=compute_20,code=[sm_20,compute_20] ")
|
||||||
|
endif()
|
||||||
|
# Kepler (GPU Arch 3.x) is supported by CUDA 5 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER "4.9")
|
||||||
|
string(APPEND HIP_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 HIP_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 HIP_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 HIP_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 HIP_CUDA_GENCODE "-gencode arch=compute_75,code=[sm_75,compute_75] ")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES)
|
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||||
|
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||||
|
|
||||||
list(APPEND LIB_SOURCES ${GPU_SOURCES})
|
set(GPU_LIB_CU_HIP "")
|
||||||
include_directories(${GPU_SOURCES_DIR})
|
foreach(CU_FILE ${GPU_LIB_CU})
|
||||||
|
get_filename_component(CU_NAME ${CU_FILE} NAME_WE)
|
||||||
|
string(REGEX REPLACE "^.*lal_" "" CU_NAME "${CU_NAME}")
|
||||||
|
|
||||||
|
set(CU_CPP_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cu.cpp")
|
||||||
|
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
|
||||||
|
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
|
||||||
|
|
||||||
|
if(HIP_PLATFORM STREQUAL "hcc")
|
||||||
|
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT ${CUBIN_FILE}
|
||||||
|
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --genco -t="${HIP_ARCH}" -f=\"-O3 -ffast-math -DUSE_HIP -D_${GPU_PREC_SETTING} -I${LAMMPS_LIB_SOURCE_DIR}/gpu\" -o ${CUBIN_FILE} ${CU_CPP_FILE}
|
||||||
|
DEPENDS ${CU_CPP_FILE}
|
||||||
|
COMMENT "Generating ${CU_NAME}.cubin")
|
||||||
|
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
|
add_custom_command(OUTPUT ${CUBIN_FILE}
|
||||||
|
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE}
|
||||||
|
DEPENDS ${CU_FILE}
|
||||||
|
COMMENT "Generating ${CU_NAME}.cubin")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT ${CUBIN_H_FILE}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -D VARNAME=${CU_NAME} -D HEADER_FILE=${CUBIN_H_FILE} -D SOURCE_FILES=${CUBIN_FILE} -P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/GenerateBinaryHeader.cmake
|
||||||
|
DEPENDS ${CUBIN_FILE}
|
||||||
|
COMMENT "Generating ${CU_NAME}_cubin.h")
|
||||||
|
|
||||||
|
list(APPEND GPU_LIB_SOURCES ${CUBIN_H_FILE})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LAMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h ${LAMMPS_LIB_BINARY_DIR}/gpu/*.cu.cpp")
|
||||||
|
|
||||||
|
hip_add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
||||||
|
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
|
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT)
|
||||||
|
target_compile_definitions(gpu PRIVATE -DUSE_HIP)
|
||||||
|
|
||||||
|
if(HIP_USE_DEVICE_SORT)
|
||||||
|
# add hipCUB
|
||||||
|
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT)
|
||||||
|
|
||||||
|
if(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
|
find_package(CUB)
|
||||||
|
|
||||||
|
if(CUB_FOUND)
|
||||||
|
set(DOWNLOAD_CUB_DEFAULT OFF)
|
||||||
|
else()
|
||||||
|
set(DOWNLOAD_CUB_DEFAULT ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(DOWNLOAD_CUB "Download and compile the CUB library instead of using an already installed one" ${DOWNLOAD_CUB_DEFAULT})
|
||||||
|
|
||||||
|
if(DOWNLOAD_CUB)
|
||||||
|
message(STATUS "CUB download requested")
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
ExternalProject_Add(CUB
|
||||||
|
GIT_REPOSITORY https://github.com/NVlabs/cub
|
||||||
|
TIMEOUT 5
|
||||||
|
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
UPDATE_COMMAND ""
|
||||||
|
)
|
||||||
|
ExternalProject_get_property(CUB SOURCE_DIR)
|
||||||
|
set(CUB_INCLUDE_DIR ${SOURCE_DIR})
|
||||||
|
else()
|
||||||
|
find_package(CUB)
|
||||||
|
if(NOT CUB_FOUND)
|
||||||
|
message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(gpu PRIVATE ${CUB_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
hip_add_executable(hip_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||||
|
target_compile_definitions(hip_get_devices PRIVATE -DUCL_HIP)
|
||||||
|
|
||||||
|
if(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
|
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
|
||||||
|
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
target_include_directories(gpu PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
|
|
||||||
|
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_NVCC__)
|
||||||
|
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/include)
|
||||||
|
target_include_directories(hip_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(hip_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
|
elseif(HIP_PLATFORM STREQUAL "hcc")
|
||||||
|
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_HCC__)
|
||||||
|
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
|
||||||
|
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
|
||||||
|
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(lammps PRIVATE gpu)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# GPU package
|
||||||
|
FindStyleHeaders(${GPU_SOURCES_DIR} FIX_CLASS fix_ FIX)
|
||||||
|
|
||||||
|
set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}")
|
||||||
|
|
||||||
|
# detects styles which have GPU version
|
||||||
|
RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES)
|
||||||
|
|
||||||
|
get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES)
|
||||||
|
|
||||||
|
if(NOT BUILD_MPI)
|
||||||
|
# mpistubs is aliased to MPI::MPI_CXX, but older versions of cmake won't work forward the include path
|
||||||
|
target_link_libraries(gpu PRIVATE mpi_stubs)
|
||||||
|
else()
|
||||||
|
target_link_libraries(gpu PRIVATE MPI::MPI_CXX)
|
||||||
|
endif()
|
||||||
|
target_compile_definitions(gpu PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||||
|
set_target_properties(gpu PROPERTIES OUTPUT_NAME lammps_gpu${LAMMPS_MACHINE})
|
||||||
|
target_sources(lammps PRIVATE ${GPU_SOURCES})
|
||||||
|
target_include_directories(lammps PRIVATE ${GPU_SOURCES_DIR})
|
||||||
|
|||||||
@ -1,43 +1,35 @@
|
|||||||
if(PKG_KIM)
|
set(KIM-API_MIN_VERSION 2.1.3)
|
||||||
set(KIM-API_MIN_VERSION 2.1)
|
find_package(CURL)
|
||||||
find_package(CURL)
|
if(CURL_FOUND)
|
||||||
if(CURL_FOUND)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
include_directories(${CURL_INCLUDE_DIRS})
|
target_include_directories(lammps PRIVATE ${CURL_INCLUDE_DIRS})
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${CURL_LIBRARIES})
|
target_link_libraries(lammps PRIVATE ${CURL_LIBRARIES})
|
||||||
add_definitions(-DLMP_KIM_CURL)
|
else()
|
||||||
|
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
||||||
|
endif()
|
||||||
|
target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
||||||
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
||||||
mark_as_advanced(LMP_DEBUG_CURL)
|
mark_as_advanced(LMP_DEBUG_CURL)
|
||||||
if(LMP_DEBUG_CURL)
|
if(LMP_DEBUG_CURL)
|
||||||
add_definitions(-DLMP_DEBUG_CURL)
|
target_compile_definitions(lammps PRIVATE -DLMP_DEBUG_CURL)
|
||||||
endif()
|
endif()
|
||||||
set(LMP_NO_SSL_CHECK OFF CACHE STRING "Tell libcurl to not verify the peer. If on, the connection succeeds regardless of the names in the certificate. Insecure - Use with caution!")
|
set(LMP_NO_SSL_CHECK OFF CACHE STRING "Tell libcurl to not verify the peer. If on, the connection succeeds regardless of the names in the certificate. Insecure - Use with caution!")
|
||||||
mark_as_advanced(LMP_NO_SSL_CHECK)
|
mark_as_advanced(LMP_NO_SSL_CHECK)
|
||||||
if(LMP_NO_SSL_CHECK)
|
if(LMP_NO_SSL_CHECK)
|
||||||
add_definitions(-DLMP_NO_SSL_CHECK)
|
target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
find_package(KIM-API QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
|
set(DOWNLOAD_KIM_DEFAULT ON)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(KIM-API QUIET libkim-api>=${KIM-API_MIN_VERSION})
|
||||||
if(KIM-API_FOUND)
|
if(KIM-API_FOUND)
|
||||||
if (KIM-API_VERSION VERSION_LESS ${KIM-API_MIN_VERSION})
|
|
||||||
if ("${DOWNLOAD_KIM}" STREQUAL "")
|
|
||||||
message(WARNING "Unsuitable KIM-API version \"${KIM-API_VERSION}\" found, but required is at least \"${KIM-API_MIN_VERSION}\". Default behavior set to download and build our own.")
|
|
||||||
endif()
|
|
||||||
set(DOWNLOAD_KIM_DEFAULT ON)
|
|
||||||
else()
|
|
||||||
set(DOWNLOAD_KIM_DEFAULT OFF)
|
set(DOWNLOAD_KIM_DEFAULT OFF)
|
||||||
endif()
|
endif()
|
||||||
else()
|
endif()
|
||||||
if ("${DOWNLOAD_KIM}" STREQUAL "")
|
option(DOWNLOAD_KIM "Download KIM-API from OpenKIM instead of using an already installed one" ${DOWNLOAD_KIM_DEFAULT})
|
||||||
message(WARNING "KIM-API package not found. Default behavior set to download and build our own")
|
if(DOWNLOAD_KIM)
|
||||||
endif()
|
|
||||||
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")
|
message(STATUS "KIM-API download requested - we will build our own")
|
||||||
# Workaround for cross compilation with MinGW where ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
# is a full path, so we need to remove the prefix
|
|
||||||
string(REPLACE ${CMAKE_INSTALL_PREFIX} "" _KIM_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
enable_language(Fortran)
|
enable_language(Fortran)
|
||||||
@ -49,19 +41,23 @@ if(PKG_KIM)
|
|||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||||
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
|
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
|
||||||
|
-DCMAKE_INSTALL_LIBDIR=lib
|
||||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||||
BUILD_BYPRODUCTS <INSTALL_DIR>/${_KIM_LIBDIR}/libkim-api${CMAKE_SHARED_LIBRARY_SUFFIX}
|
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkim-api${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(kim_build INSTALL_DIR)
|
ExternalProject_get_property(kim_build INSTALL_DIR)
|
||||||
set(KIM-API_INCLUDE_DIRS ${INSTALL_DIR}/include/kim-api)
|
file(MAKE_DIRECTORY ${INSTALL_DIR}/include/kim-api)
|
||||||
set(KIM-API_LDFLAGS ${INSTALL_DIR}/${_KIM_LIBDIR}/libkim-api${CMAKE_SHARED_LIBRARY_SUFFIX})
|
add_library(LAMMPS::KIM UNKNOWN IMPORTED)
|
||||||
list(APPEND LAMMPS_DEPS kim_build)
|
set_target_properties(LAMMPS::KIM PROPERTIES
|
||||||
else()
|
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkim-api${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||||
find_package(KIM-API ${KIM-API_MIN_VERSION} REQUIRED)
|
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include/kim-api")
|
||||||
endif()
|
target_link_libraries(lammps PRIVATE LAMMPS::KIM)
|
||||||
list(APPEND LAMMPS_LINK_LIBS "${KIM-API_LDFLAGS}")
|
add_dependencies(LAMMPS::KIM kim_build)
|
||||||
include_directories(${KIM-API_INCLUDE_DIRS})
|
else()
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(KIM-API REQUIRED IMPORTED_TARGET libkim-api>=${KIM-API_MIN_VERSION})
|
||||||
|
target_link_libraries(lammps PRIVATE PkgConfig::KIM-API)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,12 +1,58 @@
|
|||||||
if(PKG_KOKKOS)
|
########################################################################
|
||||||
# TODO: this option needs to be documented when this works with a
|
# consistency checks and Kokkos options/settings required by LAMMPS
|
||||||
# regular release version of KOKKOS, and a version compatibility check
|
if(Kokkos_ENABLE_CUDA)
|
||||||
# of external KOKKOS lib versus what the KOKKOS package needs is required.
|
message(STATUS "KOKKOS: Enabling CUDA LAMBDA function support")
|
||||||
option(EXTERNAL_KOKKOS "Build against external kokkos library")
|
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "" FORCE)
|
||||||
if(EXTERNAL_KOKKOS)
|
endif()
|
||||||
find_package(Kokkos REQUIRED)
|
# Adding OpenMP compiler flags without the checks done for
|
||||||
list(APPEND LAMMPS_LINK_LIBS Kokkos::kokkos)
|
# BUILD_OMP can result in compile failures. Enforce consistency.
|
||||||
else()
|
if(Kokkos_ENABLE_OPENMP AND NOT BUILD_OMP)
|
||||||
|
message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
|
||||||
|
endif()
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
option(EXTERNAL_KOKKOS "Build against external kokkos library" OFF)
|
||||||
|
option(DOWNLOAD_KOKKOS "Download the KOKKOS library instead of using the bundled one" OFF)
|
||||||
|
if(DOWNLOAD_KOKKOS)
|
||||||
|
# extract Kokkos-related variables and values so we can forward them to the Kokkos library build
|
||||||
|
get_cmake_property(_VARS VARIABLES)
|
||||||
|
list(FILTER _VARS INCLUDE REGEX ^Kokkos_)
|
||||||
|
foreach(_VAR IN LISTS _VARS)
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-D${_VAR}=${${_VAR}}")
|
||||||
|
endforeach()
|
||||||
|
message(STATUS "KOKKOS download requested - we will build our own")
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>")
|
||||||
|
if(CMAKE_REQUEST_PIC)
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS ${CMAKE_REQUEST_PIC})
|
||||||
|
endif()
|
||||||
|
# append other CMake variables that need to be forwarded to CMAKE_ARGS
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_INSTALL_LIBDIR=lib")
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}")
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}")
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
|
||||||
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||||
|
include(ExternalProject)
|
||||||
|
ExternalProject_Add(kokkos_build
|
||||||
|
URL https://github.com/kokkos/kokkos/archive/3.1.01.tar.gz
|
||||||
|
URL_MD5 3ccb2100f7fc316891e7dad3bc33fa37
|
||||||
|
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
||||||
|
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a
|
||||||
|
)
|
||||||
|
ExternalProject_get_property(kokkos_build INSTALL_DIR)
|
||||||
|
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||||
|
add_library(LAMMPS::KOKKOS UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(LAMMPS::KOKKOS PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscore.a"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include"
|
||||||
|
INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
|
||||||
|
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOS)
|
||||||
|
add_dependencies(LAMMPS::KOKKOS kokkos_build)
|
||||||
|
elseif(EXTERNAL_KOKKOS)
|
||||||
|
find_package(Kokkos 3.1.01 REQUIRED CONFIG)
|
||||||
|
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
||||||
|
else()
|
||||||
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
||||||
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
||||||
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||||
@ -15,13 +61,13 @@ if(PKG_KOKKOS)
|
|||||||
${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src
|
${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src
|
||||||
${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src
|
${LAMMPS_LIB_KOKKOS_SRC_DIR}/algorithms/src
|
||||||
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||||
include_directories(${Kokkos_INCLUDE_DIRS})
|
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
|
||||||
list(APPEND LAMMPS_LINK_LIBS kokkos)
|
target_link_libraries(lammps PRIVATE kokkos)
|
||||||
endif()
|
endif()
|
||||||
add_definitions(-DLMP_KOKKOS)
|
target_compile_definitions(lammps PRIVATE -DLMP_KOKKOS)
|
||||||
|
|
||||||
set(KOKKOS_PKG_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/KOKKOS)
|
set(KOKKOS_PKG_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/KOKKOS)
|
||||||
set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp
|
set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/atom_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/atom_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/atom_vec_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/atom_vec_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/comm_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/comm_kokkos.cpp
|
||||||
@ -38,37 +84,36 @@ if(PKG_KOKKOS)
|
|||||||
${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp)
|
${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp)
|
||||||
|
|
||||||
if(PKG_KSPACE)
|
if(PKG_KSPACE)
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fft3d_kokkos.cpp
|
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fft3d_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
|
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
|
||||||
if(KOKKOS_ENABLE_CUDA)
|
if(Kokkos_ENABLE_CUDA)
|
||||||
if(NOT ${FFT} STREQUAL "KISS")
|
if(NOT ${FFT} STREQUAL "KISS")
|
||||||
add_definitions(-DFFT_CUFFT)
|
target_compile_definitions(lammps PRIVATE -DFFT_CUFFT)
|
||||||
list(APPEND LAMMPS_LINK_LIBS cufft)
|
target_link_libraries(lammps PRIVATE cufft)
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}")
|
set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}")
|
||||||
|
|
||||||
# detects styles which have KOKKOS version
|
# detects styles which have KOKKOS version
|
||||||
RegisterStylesExt(${KOKKOS_PKG_SOURCES_DIR} kokkos KOKKOS_PKG_SOURCES)
|
RegisterStylesExt(${KOKKOS_PKG_SOURCES_DIR} kokkos KOKKOS_PKG_SOURCES)
|
||||||
|
|
||||||
# register kokkos-only styles
|
# register kokkos-only styles
|
||||||
RegisterNBinStyle(${KOKKOS_PKG_SOURCES_DIR}/nbin_kokkos.h)
|
RegisterNBinStyle(${KOKKOS_PKG_SOURCES_DIR}/nbin_kokkos.h)
|
||||||
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_kokkos.h)
|
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_kokkos.h)
|
||||||
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_halffull_kokkos.h)
|
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_halffull_kokkos.h)
|
||||||
|
|
||||||
if(PKG_USER-DPD)
|
if(PKG_USER-DPD)
|
||||||
get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES)
|
get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES)
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/npair_ssa_kokkos.cpp)
|
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/npair_ssa_kokkos.cpp)
|
||||||
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_ssa_kokkos.h)
|
RegisterNPairStyle(${KOKKOS_PKG_SOURCES_DIR}/npair_ssa_kokkos.h)
|
||||||
set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}")
|
set_property(GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}")
|
||||||
endif()
|
|
||||||
|
|
||||||
get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES)
|
|
||||||
|
|
||||||
list(APPEND LIB_SOURCES ${KOKKOS_PKG_SOURCES})
|
|
||||||
include_directories(${KOKKOS_PKG_SOURCES_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
get_property(KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES)
|
||||||
|
|
||||||
|
target_sources(lammps PRIVATE ${KOKKOS_PKG_SOURCES})
|
||||||
|
target_include_directories(lammps PRIVATE ${KOKKOS_PKG_SOURCES_DIR})
|
||||||
|
|||||||
@ -1,26 +1,24 @@
|
|||||||
if(PKG_KSPACE)
|
option(FFT_SINGLE "Use single precision FFTs instead of double precision FFTs" OFF)
|
||||||
option(FFT_SINGLE "Use single precision FFTs instead of double precision FFTs" OFF)
|
set(FFTW "FFTW3")
|
||||||
set(FFTW "FFTW3")
|
if(FFT_SINGLE)
|
||||||
if(FFT_SINGLE)
|
|
||||||
set(FFTW "FFTW3F")
|
set(FFTW "FFTW3F")
|
||||||
add_definitions(-DFFT_SINGLE)
|
target_compile_definitions(lammps PUBLIC -DFFT_SINGLE)
|
||||||
endif()
|
endif()
|
||||||
find_package(${FFTW} QUIET)
|
find_package(${FFTW} QUIET)
|
||||||
if(${FFTW}_FOUND)
|
if(${FFTW}_FOUND)
|
||||||
set(FFT "FFTW3" CACHE STRING "FFT library for KSPACE package")
|
set(FFT "FFTW3" CACHE STRING "FFT library for KSPACE package")
|
||||||
else()
|
else()
|
||||||
set(FFT "KISS" CACHE STRING "FFT library for KSPACE package")
|
set(FFT "KISS" CACHE STRING "FFT library for KSPACE package")
|
||||||
endif()
|
endif()
|
||||||
set(FFT_VALUES KISS FFTW3 MKL)
|
set(FFT_VALUES KISS FFTW3 MKL)
|
||||||
set_property(CACHE FFT PROPERTY STRINGS ${FFT_VALUES})
|
set_property(CACHE FFT PROPERTY STRINGS ${FFT_VALUES})
|
||||||
validate_option(FFT FFT_VALUES)
|
validate_option(FFT FFT_VALUES)
|
||||||
string(TOUPPER ${FFT} FFT)
|
string(TOUPPER ${FFT} FFT)
|
||||||
|
|
||||||
if(FFT STREQUAL "FFTW3")
|
if(FFT STREQUAL "FFTW3")
|
||||||
find_package(${FFTW} REQUIRED)
|
find_package(${FFTW} REQUIRED)
|
||||||
add_definitions(-DFFT_FFTW3)
|
target_compile_definitions(lammps PUBLIC -DFFT_FFTW3)
|
||||||
include_directories(${${FFTW}_INCLUDE_DIRS})
|
target_link_libraries(lammps PUBLIC ${FFTW}::${FFTW})
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${${FFTW}_LIBRARIES})
|
|
||||||
if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY)
|
if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY)
|
||||||
option(FFT_FFTW_THREADS "Use threaded FFTW library" ON)
|
option(FFT_FFTW_THREADS "Use threaded FFTW library" ON)
|
||||||
else()
|
else()
|
||||||
@ -29,32 +27,30 @@ if(PKG_KSPACE)
|
|||||||
|
|
||||||
if(FFT_FFTW_THREADS)
|
if(FFT_FFTW_THREADS)
|
||||||
if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY)
|
if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY)
|
||||||
add_definitions(-DFFT_FFTW_THREADS)
|
target_compile_definitions(lammps PRIVATE -DFFT_FFTW_THREADS)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${${FFTW}_OMP_LIBRARIES})
|
target_link_libraries(lammps PRIVATE ${FFTW}::${FFTW}_OMP)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Need OpenMP enabled FFTW3 library for FFT_THREADS")
|
message(FATAL_ERROR "Need OpenMP enabled FFTW3 library for FFT_THREADS")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif(FFT STREQUAL "MKL")
|
elseif(FFT STREQUAL "MKL")
|
||||||
find_package(MKL REQUIRED)
|
find_package(MKL REQUIRED)
|
||||||
add_definitions(-DFFT_MKL)
|
target_compile_definitions(lammps PRIVATE -DFFT_MKL)
|
||||||
option(FFT_MKL_THREADS "Use threaded MKL FFT" ON)
|
option(FFT_MKL_THREADS "Use threaded MKL FFT" ON)
|
||||||
if(FFT_MKL_THREADS)
|
if(FFT_MKL_THREADS)
|
||||||
add_definitions(-DFFT_MKL_THREADS)
|
target_compile_definitions(lammps PRIVATE -DFFT_MKL_THREADS)
|
||||||
endif()
|
endif()
|
||||||
include_directories(${MKL_INCLUDE_DIRS})
|
target_link_libraries(lammps PRIVATE MKL::MKL)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES})
|
else()
|
||||||
else()
|
|
||||||
# last option is KISSFFT
|
# last option is KISSFFT
|
||||||
add_definitions(-DFFT_KISS)
|
target_compile_definitions(lammps PRIVATE -DFFT_KISS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(FFT_PACK "array" CACHE STRING "Optimization for FFT")
|
set(FFT_PACK "array" CACHE STRING "Optimization for FFT")
|
||||||
set(FFT_PACK_VALUES array pointer memcpy)
|
set(FFT_PACK_VALUES array pointer memcpy)
|
||||||
set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES})
|
set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES})
|
||||||
validate_option(FFT_PACK FFT_PACK_VALUES)
|
validate_option(FFT_PACK FFT_PACK_VALUES)
|
||||||
if(NOT FFT_PACK STREQUAL "array")
|
if(NOT FFT_PACK STREQUAL "array")
|
||||||
string(TOUPPER ${FFT_PACK} FFT_PACK)
|
string(TOUPPER ${FFT_PACK} FFT_PACK)
|
||||||
add_definitions(-DFFT_PACK_${FFT_PACK})
|
target_compile_definitions(lammps PRIVATE -DFFT_PACK_${FFT_PACK})
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,40 +1,40 @@
|
|||||||
if(PKG_LATTE)
|
enable_language(Fortran)
|
||||||
enable_language(Fortran)
|
|
||||||
find_package(LATTE)
|
# using lammps in a super-build setting
|
||||||
if(LATTE_FOUND)
|
if(TARGET LATTE::latte)
|
||||||
|
target_link_libraries(lammps PRIVATE LATTE::latte)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(LATTE 1.2.2 CONFIG)
|
||||||
|
if(LATTE_FOUND)
|
||||||
set(DOWNLOAD_LATTE_DEFAULT OFF)
|
set(DOWNLOAD_LATTE_DEFAULT OFF)
|
||||||
else()
|
else()
|
||||||
set(DOWNLOAD_LATTE_DEFAULT ON)
|
set(DOWNLOAD_LATTE_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
|
option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
|
||||||
if(DOWNLOAD_LATTE)
|
if(DOWNLOAD_LATTE)
|
||||||
message(STATUS "LATTE download requested - we will build our own")
|
message(STATUS "LATTE download requested - we will build our own")
|
||||||
# Workaround for cross compilation with MinGW where ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
# is a full path, so we need to remove the prefix
|
|
||||||
string(REPLACE ${CMAKE_INSTALL_PREFIX} "" _LATTE_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(latte_build
|
ExternalProject_Add(latte_build
|
||||||
URL https://github.com/lanl/LATTE/archive/v1.2.1.tar.gz
|
URL https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz
|
||||||
URL_MD5 85ac414fdada2d04619c8f936344df14
|
URL_MD5 820e73a457ced178c08c71389a385de7
|
||||||
SOURCE_SUBDIR cmake
|
SOURCE_SUBDIR cmake
|
||||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC}
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
|
||||||
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
||||||
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} -DCMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}
|
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} -DCMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}
|
||||||
-DCMAKE_Fortran_FLAGS_${BTYPE}=${CMAKE_Fortran_FLAGS_${BTYPE}} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
-DCMAKE_Fortran_FLAGS_${BTYPE}=${CMAKE_Fortran_FLAGS_${BTYPE}} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||||
BUILD_BYPRODUCTS <INSTALL_DIR>/${_LATTE_LIBDIR}/liblatte.a
|
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/liblatte.a
|
||||||
)
|
)
|
||||||
list(APPEND LAMMPS_DEPS latte_build)
|
|
||||||
ExternalProject_get_property(latte_build INSTALL_DIR)
|
ExternalProject_get_property(latte_build INSTALL_DIR)
|
||||||
set(LATTE_LIBRARIES ${INSTALL_DIR}/${_LATTE_LIBDIR}/liblatte.a)
|
add_library(LAMMPS::LATTE UNKNOWN IMPORTED)
|
||||||
else()
|
set_target_properties(LAMMPS::LATTE PROPERTIES
|
||||||
find_package(LATTE)
|
IMPORTED_LOCATION "${INSTALL_DIR}/lib/liblatte.a"
|
||||||
if(NOT LATTE_FOUND)
|
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||||
message(FATAL_ERROR "LATTE library not found, help CMake to find it by setting LATTE_LIBRARY, or set DOWNLOAD_LATTE=ON to download it")
|
target_link_libraries(lammps PRIVATE LAMMPS::LATTE)
|
||||||
endif()
|
add_dependencies(LAMMPS::LATTE latte_build)
|
||||||
endif()
|
else()
|
||||||
if(NOT LAPACK_FOUND)
|
find_package(LATTE 1.2.2 REQUIRED CONFIG)
|
||||||
add_dependencies(latte_build linalg)
|
target_link_libraries(lammps PRIVATE LATTE::latte)
|
||||||
endif()
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${LATTE_LIBRARIES} ${LAPACK_LIBRARIES})
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
if(PKG_MESSAGE)
|
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
||||||
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
|
||||||
message(FATAL_ERROR "The MESSAGE Package is not compatible with -DLAMMPS_BIGBIG")
|
message(FATAL_ERROR "The MESSAGE Package is not compatible with -DLAMMPS_BIGBIG")
|
||||||
endif()
|
endif()
|
||||||
option(MESSAGE_ZMQ "Use ZeroMQ in MESSAGE package" OFF)
|
option(MESSAGE_ZMQ "Use ZeroMQ in MESSAGE package" OFF)
|
||||||
file(GLOB_RECURSE cslib_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.F
|
file(GLOB_RECURSE cslib_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.F
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.c
|
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.c
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.cpp)
|
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.cpp)
|
||||||
|
|
||||||
add_library(cslib STATIC ${cslib_SOURCES})
|
add_library(cslib STATIC ${cslib_SOURCES})
|
||||||
if(BUILD_MPI)
|
target_compile_definitions(cslib PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||||
|
set_target_properties(cslib PROPERTIES OUTPUT_NAME lammps_cslib${LAMMPS_MACHINE})
|
||||||
|
if(BUILD_MPI)
|
||||||
target_compile_definitions(cslib PRIVATE -DMPI_YES)
|
target_compile_definitions(cslib PRIVATE -DMPI_YES)
|
||||||
set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi")
|
set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi")
|
||||||
else()
|
target_link_libraries(cslib PRIVATE MPI::MPI_CXX)
|
||||||
|
else()
|
||||||
target_compile_definitions(cslib PRIVATE -DMPI_NO)
|
target_compile_definitions(cslib PRIVATE -DMPI_NO)
|
||||||
target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_MPI)
|
target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_MPI)
|
||||||
set_target_properties(cslib PROPERTIES OUTPUT_NAME "csnompi")
|
set_target_properties(cslib PROPERTIES OUTPUT_NAME "csnompi")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MESSAGE_ZMQ)
|
if(MESSAGE_ZMQ)
|
||||||
target_compile_definitions(cslib PRIVATE -DZMQ_YES)
|
target_compile_definitions(cslib PRIVATE -DZMQ_YES)
|
||||||
find_package(ZMQ REQUIRED)
|
find_package(ZMQ REQUIRED)
|
||||||
target_include_directories(cslib PRIVATE ${ZMQ_INCLUDE_DIRS})
|
target_link_libraries(cslib PUBLIC ZMQ::ZMQ)
|
||||||
target_link_libraries(cslib PUBLIC ${ZMQ_LIBRARIES})
|
else()
|
||||||
else()
|
|
||||||
target_compile_definitions(cslib PRIVATE -DZMQ_NO)
|
target_compile_definitions(cslib PRIVATE -DZMQ_NO)
|
||||||
target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_ZMQ)
|
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()
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(lammps PRIVATE cslib)
|
||||||
|
target_include_directories(lammps PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src)
|
||||||
|
|||||||
@ -1,17 +1,13 @@
|
|||||||
if(PKG_MSCG)
|
find_package(GSL REQUIRED)
|
||||||
find_package(GSL REQUIRED)
|
find_package(MSCG QUIET)
|
||||||
find_package(MSCG QUIET)
|
if(MSGC_FOUND)
|
||||||
if(MSGC_FOUND)
|
|
||||||
set(DOWNLOAD_MSCG_DEFAULT OFF)
|
set(DOWNLOAD_MSCG_DEFAULT OFF)
|
||||||
else()
|
else()
|
||||||
set(DOWNLOAD_MSCG_DEFAULT ON)
|
set(DOWNLOAD_MSCG_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
|
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
|
||||||
if(DOWNLOAD_MSCG)
|
if(DOWNLOAD_MSCG)
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
if(NOT LAPACK_FOUND)
|
|
||||||
set(EXTRA_MSCG_OPTS "-DLAPACK_LIBRARIES=${CMAKE_CURRENT_BINARY_DIR}/liblinalg.a")
|
|
||||||
endif()
|
|
||||||
ExternalProject_Add(mscg_build
|
ExternalProject_Add(mscg_build
|
||||||
URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz
|
URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz
|
||||||
URL_MD5 8c45e269ee13f60b303edd7823866a91
|
URL_MD5 8c45e269ee13f60b303edd7823866a91
|
||||||
@ -20,6 +16,7 @@ if(PKG_MSCG)
|
|||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||||
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
|
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
|
||||||
|
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
||||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||||
@ -29,20 +26,20 @@ if(PKG_MSCG)
|
|||||||
BUILD_BYPRODUCTS <BINARY_DIR>/libmscg.a
|
BUILD_BYPRODUCTS <BINARY_DIR>/libmscg.a
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(mscg_build BINARY_DIR)
|
ExternalProject_get_property(mscg_build BINARY_DIR)
|
||||||
set(MSCG_LIBRARIES ${BINARY_DIR}/libmscg.a)
|
|
||||||
ExternalProject_get_property(mscg_build SOURCE_DIR)
|
ExternalProject_get_property(mscg_build SOURCE_DIR)
|
||||||
set(MSCG_INCLUDE_DIRS ${SOURCE_DIR}/src)
|
file(MAKE_DIRECTORY ${SOURCE_DIR}/src)
|
||||||
list(APPEND LAMMPS_DEPS mscg_build)
|
add_library(LAMMPS::MSCG UNKNOWN IMPORTED)
|
||||||
if(NOT LAPACK_FOUND)
|
set_target_properties(LAMMPS::MSCG PROPERTIES
|
||||||
file(MAKE_DIRECTORY ${MSCG_INCLUDE_DIRS})
|
IMPORTED_LOCATION "${BINARY_DIR}/libmscg.a"
|
||||||
add_dependencies(mscg_build linalg)
|
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/src"
|
||||||
endif()
|
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||||
else()
|
target_link_libraries(lammps PRIVATE LAMMPS::MSCG)
|
||||||
|
add_dependencies(LAMMPS::MSCG mscg_build)
|
||||||
|
else()
|
||||||
find_package(MSCG)
|
find_package(MSCG)
|
||||||
if(NOT MSCG_FOUND)
|
if(NOT MSCG_FOUND)
|
||||||
message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIRS, or set DOWNLOAD_MSCG=ON to download it")
|
message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIRS, or set DOWNLOAD_MSCG=ON to download it")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
target_link_libraries(lammps PRIVATE MSCG::MSCG)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${MSCG_LIBRARIES} ${GSL_LIBRARIES} ${LAPACK_LIBRARIES})
|
|
||||||
include_directories(${MSCG_INCLUDE_DIRS})
|
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(lammps PRIVATE GSL::gsl ${LAPACK_LIBRARIES})
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
if(PKG_OPT)
|
|
||||||
set(OPT_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/OPT)
|
set(OPT_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/OPT)
|
||||||
set(OPT_SOURCES)
|
set(OPT_SOURCES)
|
||||||
set_property(GLOBAL PROPERTY "OPT_SOURCES" "${OPT_SOURCES}")
|
set_property(GLOBAL PROPERTY "OPT_SOURCES" "${OPT_SOURCES}")
|
||||||
@ -8,6 +7,5 @@ if(PKG_OPT)
|
|||||||
|
|
||||||
get_property(OPT_SOURCES GLOBAL PROPERTY OPT_SOURCES)
|
get_property(OPT_SOURCES GLOBAL PROPERTY OPT_SOURCES)
|
||||||
|
|
||||||
list(APPEND LIB_SOURCES ${OPT_SOURCES})
|
target_sources(lammps PRIVATE ${OPT_SOURCES})
|
||||||
include_directories(${OPT_SOURCES_DIR})
|
target_include_directories(lammps PRIVATE ${OPT_SOURCES_DIR})
|
||||||
endif()
|
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
if(PKG_PYTHON)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
find_package(PythonLibs REQUIRED)
|
find_package(PythonLibs REQUIRED) # Deprecated since version 3.12
|
||||||
add_definitions(-DLMP_PYTHON)
|
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIR})
|
||||||
include_directories(${PYTHON_INCLUDE_DIR})
|
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARY})
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY})
|
else()
|
||||||
|
find_package(Python REQUIRED COMPONENTS Development)
|
||||||
|
target_link_libraries(lammps PRIVATE Python::Python)
|
||||||
endif()
|
endif()
|
||||||
|
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
||||||
|
|||||||
@ -1,20 +1,18 @@
|
|||||||
# Fix qeq/fire requires MANYBODY (i.e. COMB and COMB3) to be installed
|
# Fix qeq/fire requires MANYBODY (i.e. COMB and COMB3) to be installed
|
||||||
if(PKG_QEQ)
|
set(QEQ_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/QEQ)
|
||||||
set(QEQ_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/QEQ)
|
file(GLOB QEQ_HEADERS ${QEQ_SOURCES_DIR}/fix*.h)
|
||||||
file(GLOB QEQ_HEADERS ${QEQ_SOURCES_DIR}/fix*.h)
|
file(GLOB QEQ_SOURCES ${QEQ_SOURCES_DIR}/fix*.cpp)
|
||||||
file(GLOB QEQ_SOURCES ${QEQ_SOURCES_DIR}/fix*.cpp)
|
|
||||||
|
|
||||||
if(NOT PKG_MANYBODY)
|
if(NOT PKG_MANYBODY)
|
||||||
list(REMOVE_ITEM QEQ_HEADERS ${QEQ_SOURCES_DIR}/fix_qeq_fire.h)
|
list(REMOVE_ITEM QEQ_HEADERS ${QEQ_SOURCES_DIR}/fix_qeq_fire.h)
|
||||||
list(REMOVE_ITEM QEQ_SOURCES ${QEQ_SOURCES_DIR}/fix_qeq_fire.cpp)
|
list(REMOVE_ITEM QEQ_SOURCES ${QEQ_SOURCES_DIR}/fix_qeq_fire.cpp)
|
||||||
endif()
|
|
||||||
set_property(GLOBAL PROPERTY "QEQ_SOURCES" "${QEQ_SOURCES}")
|
|
||||||
|
|
||||||
foreach(MY_HEADER ${QEQ_HEADERS})
|
|
||||||
AddStyleHeader(${MY_HEADER} FIX)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
get_property(QEQ_SOURCES GLOBAL PROPERTY QEQ_SOURCES)
|
|
||||||
list(APPEND LIB_SOURCES ${QEQ_SOURCES})
|
|
||||||
include_directories(${QEQ_SOURCES_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
set_property(GLOBAL PROPERTY "QEQ_SOURCES" "${QEQ_SOURCES}")
|
||||||
|
|
||||||
|
foreach(MY_HEADER ${QEQ_HEADERS})
|
||||||
|
AddStyleHeader(${MY_HEADER} FIX)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
get_property(QEQ_SOURCES GLOBAL PROPERTY QEQ_SOURCES)
|
||||||
|
target_sources(lammps PRIVATE ${QEQ_SOURCES})
|
||||||
|
target_include_directories(lammps PRIVATE ${QEQ_SOURCES_DIR})
|
||||||
|
|||||||
@ -1,27 +1,30 @@
|
|||||||
if(PKG_USER-COLVARS)
|
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||||
|
|
||||||
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
||||||
|
|
||||||
file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
# Build Lepton by default
|
||||||
|
option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
||||||
|
|
||||||
# Build Lepton by default
|
if(COLVARS_LEPTON)
|
||||||
option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
|
||||||
|
|
||||||
if(COLVARS_LEPTON)
|
|
||||||
set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton)
|
set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton)
|
||||||
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp)
|
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp)
|
||||||
add_library(lepton STATIC ${LEPTON_SOURCES})
|
add_library(lepton STATIC ${LEPTON_SOURCES})
|
||||||
|
# Change the define below to LEPTON_BUILDING_SHARED_LIBRARY when linking Lepton as a DLL with MSVC
|
||||||
|
target_compile_definitions(lepton PRIVATE -DLEPTON_BUILDING_STATIC_LIBRARY)
|
||||||
|
set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE})
|
||||||
target_include_directories(lepton PRIVATE ${LEPTON_DIR}/include)
|
target_include_directories(lepton PRIVATE ${LEPTON_DIR}/include)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(colvars STATIC ${COLVARS_SOURCES})
|
add_library(colvars STATIC ${COLVARS_SOURCES})
|
||||||
target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
target_compile_definitions(colvars PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||||
list(APPEND LAMMPS_LINK_LIBS colvars)
|
set_target_properties(colvars PROPERTIES OUTPUT_NAME lammps_colvars${LAMMPS_MACHINE})
|
||||||
|
target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||||
if(COLVARS_LEPTON)
|
target_link_libraries(lammps PRIVATE colvars)
|
||||||
list(APPEND LAMMPS_LINK_LIBS lepton)
|
|
||||||
target_compile_options(colvars PRIVATE -DLEPTON)
|
if(COLVARS_LEPTON)
|
||||||
target_include_directories(colvars PUBLIC ${LEPTON_DIR}/include)
|
target_link_libraries(lammps PRIVATE lepton)
|
||||||
endif()
|
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
||||||
|
# Disable the line below when linking Lepton as a DLL with MSVC
|
||||||
|
target_compile_definitions(colvars PRIVATE -DLEPTON_USE_STATIC_LIBRARIES)
|
||||||
|
target_include_directories(colvars PUBLIC ${LEPTON_DIR}/include)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
if(PKG_USER-H5MD)
|
enable_language(C)
|
||||||
enable_language(C)
|
|
||||||
|
|
||||||
find_package(HDF5 REQUIRED)
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
|
||||||
target_link_libraries(h5md ${HDF5_LIBRARIES})
|
cmake_policy(SET CMP0074 NEW)
|
||||||
target_include_directories(h5md PRIVATE ${HDF5_INCLUDE_DIRS})
|
|
||||||
include_directories(${HDF5_INCLUDE_DIRS})
|
|
||||||
endif()
|
endif()
|
||||||
|
find_package(HDF5 REQUIRED)
|
||||||
|
target_link_libraries(h5md PRIVATE ${HDF5_LIBRARIES})
|
||||||
|
target_include_directories(h5md PUBLIC ${HDF5_INCLUDE_DIRS})
|
||||||
|
|||||||
@ -1,113 +1,109 @@
|
|||||||
if(PKG_USER-INTEL)
|
check_include_file_cxx(immintrin.h FOUND_IMMINTRIN)
|
||||||
check_include_file_cxx(immintrin.h FOUND_IMMINTRIN)
|
if(NOT FOUND_IMMINTRIN)
|
||||||
if(NOT FOUND_IMMINTRIN)
|
|
||||||
message(FATAL_ERROR "immintrin.h header not found, Intel package won't work without it")
|
message(FATAL_ERROR "immintrin.h header not found, Intel package won't work without it")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(-DLMP_USER_INTEL)
|
target_compile_definitions(lammps PRIVATE -DLMP_USER_INTEL)
|
||||||
|
|
||||||
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
|
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
|
||||||
set(INTEL_ARCH_VALUES cpu knl)
|
set(INTEL_ARCH_VALUES cpu knl)
|
||||||
set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES})
|
set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES})
|
||||||
validate_option(INTEL_ARCH INTEL_ARCH_VALUES)
|
validate_option(INTEL_ARCH INTEL_ARCH_VALUES)
|
||||||
string(TOUPPER ${INTEL_ARCH} INTEL_ARCH)
|
string(TOUPPER ${INTEL_ARCH} INTEL_ARCH)
|
||||||
|
|
||||||
find_package(Threads QUIET)
|
find_package(Threads QUIET)
|
||||||
if(Threads_FOUND)
|
if(Threads_FOUND)
|
||||||
set(INTEL_LRT_MODE "threads" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
|
set(INTEL_LRT_MODE "threads" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
|
||||||
else()
|
else()
|
||||||
set(INTEL_LRT_MODE "none" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
|
set(INTEL_LRT_MODE "none" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
|
||||||
endif()
|
endif()
|
||||||
set(INTEL_LRT_VALUES none threads c++11)
|
set(INTEL_LRT_VALUES none threads c++11)
|
||||||
set_property(CACHE INTEL_LRT_MODE PROPERTY STRINGS ${INTEL_LRT_VALUES})
|
set_property(CACHE INTEL_LRT_MODE PROPERTY STRINGS ${INTEL_LRT_VALUES})
|
||||||
validate_option(INTEL_LRT_MODE INTEL_LRT_VALUES)
|
validate_option(INTEL_LRT_MODE INTEL_LRT_VALUES)
|
||||||
string(TOUPPER ${INTEL_LRT_MODE} INTEL_LRT_MODE)
|
string(TOUPPER ${INTEL_LRT_MODE} INTEL_LRT_MODE)
|
||||||
if(INTEL_LRT_MODE STREQUAL "THREADS")
|
if(INTEL_LRT_MODE STREQUAL "THREADS")
|
||||||
if(Threads_FOUND)
|
if(Threads_FOUND)
|
||||||
add_definitions(-DLMP_INTEL_USELRT)
|
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(lammps PRIVATE Threads::Threads)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Must have working threads library for Long-range thread support")
|
message(FATAL_ERROR "Must have working threads library for Long-range thread support")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(INTEL_LRT_MODE STREQUAL "C++11")
|
if(INTEL_LRT_MODE STREQUAL "C++11")
|
||||||
add_definitions(-DLMP_INTEL_USELRT -DLMP_INTEL_LRT11)
|
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_USELRT -DLMP_INTEL_LRT11)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
|
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}")
|
message(FATAL_ERROR "USER-INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(WARNING "USER-INTEL gives best performance with Intel compilers")
|
message(WARNING "USER-INTEL gives best performance with Intel compilers")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(TBB QUIET)
|
find_package(TBB_MALLOC QUIET)
|
||||||
if(TBB_FOUND)
|
if(TBB_MALLOC_FOUND)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES})
|
target_link_libraries(lammps PRIVATE TBB::TBB_MALLOC)
|
||||||
else()
|
else()
|
||||||
add_definitions(-DLMP_INTEL_NO_TBB)
|
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_NO_TBB)
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
message(WARNING "USER-INTEL with Intel compilers should use TBB malloc libraries")
|
message(WARNING "USER-INTEL with Intel compilers should use TBB malloc libraries")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(MKL QUIET)
|
find_package(MKL QUIET)
|
||||||
if(MKL_FOUND)
|
if(MKL_FOUND)
|
||||||
add_definitions(-DLMP_USE_MKL_RNG)
|
target_compile_definitions(lammps PRIVATE -DLMP_USE_MKL_RNG)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES})
|
target_link_libraries(lammps PRIVATE MKL::MKL)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Pair style dpd/intel will be faster with MKL libraries")
|
message(STATUS "Pair style dpd/intel will be faster with MKL libraries")
|
||||||
endif()
|
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"))
|
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")
|
message(FATAL_ERROR "USER-INTEL only supports memory alignment of 64, 128 or 256 on this platform")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(INTEL_ARCH STREQUAL "KNL")
|
if(INTEL_ARCH STREQUAL "KNL")
|
||||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
message(FATAL_ERROR "Must use Intel compiler with USER-INTEL for KNL architecture")
|
message(FATAL_ERROR "Must use Intel compiler with USER-INTEL for KNL architecture")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload")
|
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\\\"\"")
|
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})
|
target_compile_options(lammps PRIVATE -xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
|
||||||
add_definitions(-DLMP_INTEL_OFFLOAD)
|
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_OFFLOAD)
|
||||||
else()
|
else()
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
foreach(_FLAG -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
|
foreach(_FLAG -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
|
||||||
check_cxx_compiler_flag("${__FLAG}" COMPILER_SUPPORTS${_FLAG})
|
check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAG})
|
||||||
if(COMPILER_SUPPORTS${_FLAG})
|
if(COMPILER_SUPPORTS${_FLAG})
|
||||||
add_compile_options(${_FLAG})
|
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
|
||||||
add_compile_options(-O3 -ffast-math)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# collect sources
|
# collect sources
|
||||||
set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL)
|
set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL)
|
||||||
set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/fix_intel.cpp
|
set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/fix_intel.cpp
|
||||||
${USER-INTEL_SOURCES_DIR}/fix_nh_intel.cpp
|
${USER-INTEL_SOURCES_DIR}/fix_nh_intel.cpp
|
||||||
${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp
|
${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp
|
||||||
${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp
|
${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp
|
||||||
${USER-INTEL_SOURCES_DIR}/npair_intel.cpp)
|
${USER-INTEL_SOURCES_DIR}/npair_intel.cpp)
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}")
|
set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}")
|
||||||
|
|
||||||
# detect styles which have a USER-INTEL version
|
# detect styles which have a USER-INTEL version
|
||||||
RegisterStylesExt(${USER-INTEL_SOURCES_DIR} intel USER-INTEL_SOURCES)
|
RegisterStylesExt(${USER-INTEL_SOURCES_DIR} intel USER-INTEL_SOURCES)
|
||||||
RegisterNBinStyle(${USER-INTEL_SOURCES_DIR}/nbin_intel.h)
|
RegisterNBinStyle(${USER-INTEL_SOURCES_DIR}/nbin_intel.h)
|
||||||
RegisterNPairStyle(${USER-INTEL_SOURCES_DIR}/npair_intel.h)
|
RegisterNPairStyle(${USER-INTEL_SOURCES_DIR}/npair_intel.h)
|
||||||
RegisterFixStyle(${USER-INTEL_SOURCES_DIR}/fix_intel.h)
|
RegisterFixStyle(${USER-INTEL_SOURCES_DIR}/fix_intel.h)
|
||||||
|
|
||||||
get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES)
|
get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES)
|
||||||
if(PKG_KSPACE)
|
if(PKG_KSPACE)
|
||||||
list(APPEND USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp)
|
list(APPEND USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp)
|
||||||
RegisterIntegrateStyle(${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
RegisterIntegrateStyle(${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND LIB_SOURCES ${USER-INTEL_SOURCES})
|
|
||||||
include_directories(${USER-INTEL_SOURCES_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
target_sources(lammps PRIVATE ${USER-INTEL_SOURCES})
|
||||||
|
target_include_directories(lammps PRIVATE ${USER-INTEL_SOURCES_DIR})
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
if(PKG_USER-MOLFILE)
|
set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
|
||||||
set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
|
add_library(molfile INTERFACE)
|
||||||
add_library(molfile INTERFACE)
|
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
|
||||||
target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
|
# no need to link with -ldl on windows
|
||||||
# no need to link with -ldl on windows
|
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
||||||
target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
|
target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
|
||||||
endif()
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS molfile)
|
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(lammps PRIVATE molfile)
|
||||||
|
|||||||
@ -1,24 +1,27 @@
|
|||||||
if(PKG_USER-NETCDF)
|
# USER-NETCDF can use NetCDF, Parallel NetCDF (PNetCDF), or both. At least one necessary.
|
||||||
# USER-NETCDF can use NetCDF, Parallel NetCDF (PNetCDF), or both. At least one necessary.
|
# NetCDF library enables dump style "netcdf", while PNetCDF enables dump style "netcdf/mpiio"
|
||||||
# NetCDF library enables dump style "netcdf", while PNetCDF enables dump style "netcdf/mpiio"
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
|
||||||
|
cmake_policy(SET CMP0074 NEW)
|
||||||
|
endif()
|
||||||
|
if(NOT BUILD_MPI)
|
||||||
|
find_package(NetCDF REQUIRED)
|
||||||
|
else()
|
||||||
find_package(NetCDF)
|
find_package(NetCDF)
|
||||||
if(NETCDF_FOUND)
|
if(NETCDF_FOUND)
|
||||||
find_package(PNetCDF)
|
find_package(PNetCDF)
|
||||||
else(NETCDF_FOUND)
|
else()
|
||||||
find_package(PNetCDF REQUIRED)
|
find_package(PNetCDF REQUIRED)
|
||||||
endif(NETCDF_FOUND)
|
endif()
|
||||||
|
|
||||||
if(NETCDF_FOUND)
|
|
||||||
include_directories(${NETCDF_INCLUDE_DIRS})
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${NETCDF_LIBRARIES})
|
|
||||||
add_definitions(-DLMP_HAS_NETCDF)
|
|
||||||
endif(NETCDF_FOUND)
|
|
||||||
|
|
||||||
if(PNETCDF_FOUND)
|
|
||||||
include_directories(${PNETCDF_INCLUDES})
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${PNETCDF_LIBRARIES})
|
|
||||||
add_definitions(-DLMP_HAS_PNETCDF)
|
|
||||||
endif(PNETCDF_FOUND)
|
|
||||||
|
|
||||||
add_definitions(-DNC_64BIT_DATA=0x0020)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NETCDF_FOUND)
|
||||||
|
target_link_libraries(lammps PRIVATE NetCDF::NetCDF)
|
||||||
|
target_compile_definitions(lammps PRIVATE -DLMP_HAS_NETCDF)
|
||||||
|
endif(NETCDF_FOUND)
|
||||||
|
|
||||||
|
if(PNETCDF_FOUND)
|
||||||
|
target_link_libraries(lammps PRIVATE PNetCDF::PNetCDF)
|
||||||
|
target_compile_definitions(lammps PRIVATE -DLMP_HAS_PNETCDF)
|
||||||
|
endif(PNETCDF_FOUND)
|
||||||
|
|
||||||
|
target_compile_definitions(lammps PRIVATE -DNC_64BIT_DATA=0x0020)
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
if(PKG_USER-OMP)
|
|
||||||
set(USER-OMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-OMP)
|
set(USER-OMP_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-OMP)
|
||||||
set(USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/thr_data.cpp
|
set(USER-OMP_SOURCES ${USER-OMP_SOURCES_DIR}/thr_data.cpp
|
||||||
${USER-OMP_SOURCES_DIR}/thr_omp.cpp
|
${USER-OMP_SOURCES_DIR}/thr_omp.cpp
|
||||||
@ -6,7 +5,7 @@ if(PKG_USER-OMP)
|
|||||||
${USER-OMP_SOURCES_DIR}/fix_nh_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)
|
${USER-OMP_SOURCES_DIR}/domain_omp.cpp)
|
||||||
add_definitions(-DLMP_USER_OMP)
|
target_compile_definitions(lammps PRIVATE -DLMP_USER_OMP)
|
||||||
set_property(GLOBAL PROPERTY "OMP_SOURCES" "${USER-OMP_SOURCES}")
|
set_property(GLOBAL PROPERTY "OMP_SOURCES" "${USER-OMP_SOURCES}")
|
||||||
|
|
||||||
# detects styles which have USER-OMP version
|
# detects styles which have USER-OMP version
|
||||||
@ -37,6 +36,5 @@ if(PKG_USER-OMP)
|
|||||||
${USER-OMP_SOURCES_DIR}/reaxc_valence_angles_omp.cpp)
|
${USER-OMP_SOURCES_DIR}/reaxc_valence_angles_omp.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND LIB_SOURCES ${USER-OMP_SOURCES})
|
target_sources(lammps PRIVATE ${USER-OMP_SOURCES})
|
||||||
include_directories(${USER-OMP_SOURCES_DIR})
|
target_include_directories(lammps PRIVATE ${USER-OMP_SOURCES_DIR})
|
||||||
endif()
|
|
||||||
|
|||||||
@ -1,34 +1,36 @@
|
|||||||
if(PKG_USER-PLUMED)
|
set(PLUMED_MODE "static" CACHE STRING "Linkage mode for Plumed2 library")
|
||||||
set(PLUMED_MODE "static" CACHE STRING "Linkage mode for Plumed2 library")
|
set(PLUMED_MODE_VALUES static shared runtime)
|
||||||
set(PLUMED_MODE_VALUES static shared runtime)
|
set_property(CACHE PLUMED_MODE PROPERTY STRINGS ${PLUMED_MODE_VALUES})
|
||||||
set_property(CACHE PLUMED_MODE PROPERTY STRINGS ${PLUMED_MODE_VALUES})
|
validate_option(PLUMED_MODE PLUMED_MODE_VALUES)
|
||||||
validate_option(PLUMED_MODE PLUMED_MODE_VALUES)
|
string(TOUPPER ${PLUMED_MODE} PLUMED_MODE)
|
||||||
string(TOUPPER ${PLUMED_MODE} PLUMED_MODE)
|
|
||||||
|
|
||||||
set(PLUMED_LINK_LIBS "")
|
set(PLUMED_LINK_LIBS)
|
||||||
if(PLUMED_MODE STREQUAL "STATIC")
|
if(PLUMED_MODE STREQUAL "STATIC")
|
||||||
find_package(LAPACK REQUIRED)
|
find_package(LAPACK REQUIRED)
|
||||||
find_package(BLAS REQUIRED)
|
find_package(BLAS REQUIRED)
|
||||||
find_package(GSL REQUIRED)
|
find_package(GSL REQUIRED)
|
||||||
list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
list(APPEND PLUMED_LINK_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} GSL::gsl)
|
||||||
list(APPEND PLUMED_LINK_LIBS ${LAPACK_LIBRARIES} ${GSL_LIBRARIES})
|
|
||||||
find_package(ZLIB QUIET)
|
find_package(ZLIB QUIET)
|
||||||
if(ZLIB_FOUND)
|
if(ZLIB_FOUND)
|
||||||
list(APPEND PLUMED_LINK_LIBS ${ZLIB_LIBRARIES})
|
list(APPEND PLUMED_LINK_LIBS ZLIB::ZLIB)
|
||||||
endif()
|
endif()
|
||||||
|
find_package(FFTW3 QUIET)
|
||||||
|
if(FFTW3_FOUND)
|
||||||
|
list(APPEND PLUMED_LINK_LIBS FFTW3::FFTW3)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
set(DOWNLOAD_PLUMED_DEFAULT ON)
|
set(DOWNLOAD_PLUMED_DEFAULT ON)
|
||||||
if(PKG_CONFIG_FOUND)
|
if(PKG_CONFIG_FOUND)
|
||||||
pkg_check_modules(PLUMED QUIET plumed)
|
pkg_check_modules(PLUMED QUIET plumed)
|
||||||
if(PLUMED_FOUND)
|
if(PLUMED_FOUND)
|
||||||
set(DOWNLOAD_PLUMED_DEFAULT OFF)
|
set(DOWNLOAD_PLUMED_DEFAULT OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" ${DOWNLOAD_PLUMED_DEFAULT})
|
option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" ${DOWNLOAD_PLUMED_DEFAULT})
|
||||||
if(DOWNLOAD_PLUMED)
|
if(DOWNLOAD_PLUMED)
|
||||||
if(BUILD_MPI)
|
if(BUILD_MPI)
|
||||||
set(PLUMED_CONFIG_MPI "--enable-mpi")
|
set(PLUMED_CONFIG_MPI "--enable-mpi")
|
||||||
set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER})
|
set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER})
|
||||||
@ -66,31 +68,31 @@ if(PKG_USER-PLUMED)
|
|||||||
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
|
BUILD_BYPRODUCTS ${PLUMED_BUILD_BYPRODUCTS}
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
||||||
set(PLUMED_INSTALL_DIR ${INSTALL_DIR})
|
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||||
list(APPEND LAMMPS_DEPS plumed_build)
|
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||||
if(PLUMED_MODE STREQUAL "STATIC")
|
if(PLUMED_MODE STREQUAL "STATIC")
|
||||||
add_definitions(-D__PLUMED_WRAPPER_CXX=1)
|
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed.a INTERFACE_LINK_LIBRARIES "${PLUMED_LINK_LIBS};${CMAKE_DL_LIBS}")
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.a ${PLUMED_LINK_LIBS} ${CMAKE_DL_LIBS})
|
|
||||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed${CMAKE_SHARED_LIBRARY_SUFFIX} ${PLUMED_INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_DL_LIBS})
|
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed${CMAKE_SHARED_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_DL_LIBS}")
|
||||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||||
add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumedWrapper.a -rdynamic ${CMAKE_DL_LIBS})
|
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumedWrapper.a INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||||
endif()
|
endif()
|
||||||
set(PLUMED_INCLUDE_DIRS "${PLUMED_INSTALL_DIR}/include")
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
|
||||||
else()
|
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||||
|
else()
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(PLUMED REQUIRED plumed)
|
pkg_check_modules(PLUMED REQUIRED plumed)
|
||||||
|
add_library(LAMMPS::PLUMED INTERFACE IMPORTED)
|
||||||
if(PLUMED_MODE STREQUAL "STATIC")
|
if(PLUMED_MODE STREQUAL "STATIC")
|
||||||
add_definitions(-D__PLUMED_WRAPPER_CXX=1)
|
|
||||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.static)
|
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.static)
|
||||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.shared)
|
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.shared)
|
||||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||||
add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
||||||
endif()
|
endif()
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_LOAD})
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_LINK_LIBRARIES "${PLUMED_LOAD}")
|
||||||
endif()
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_INCLUDE_DIRS}")
|
||||||
include_directories(${PLUMED_INCLUDE_DIRS})
|
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
|
||||||
|
|||||||
@ -1,13 +1,6 @@
|
|||||||
if(PKG_USER-QMMM)
|
enable_language(C)
|
||||||
enable_language(C)
|
|
||||||
|
|
||||||
if(NOT BUILD_LIB)
|
add_library(qmmm STATIC ${LAMMPS_LIB_SOURCE_DIR}/qmmm/libqmmm.c)
|
||||||
message(FATAL_ERROR "Building a QM/MM executable with USER-QMMM requires BUILD_LIB=yes")
|
set_target_properties(qmmm PROPERTIES OUTPUT_NAME lammps_qmmm${LAMMPS_MACHINE})
|
||||||
endif()
|
target_link_libraries(lammps PRIVATE qmmm)
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
target_include_directories(qmmm PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/qmmm)
|
||||||
message(WARNING "It is recommended to use BUILD_SHARED_LIBS=yes with USER-QMMM")
|
|
||||||
endif()
|
|
||||||
add_library(qmmm STATIC ${LAMMPS_LIB_SOURCE_DIR}/qmmm/libqmmm.c)
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS qmmm)
|
|
||||||
target_include_directories(qmmm PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/qmmm)
|
|
||||||
endif()
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
if(PKG_USER-QUIP)
|
enable_language(Fortran)
|
||||||
enable_language(Fortran)
|
find_package(QUIP REQUIRED)
|
||||||
find_package(QUIP REQUIRED)
|
target_link_libraries(lammps PRIVATE QUIP::QUIP ${LAPACK_LIBRARIES})
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${QUIP_LIBRARIES} ${LAPACK_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
|
|||||||
@ -1,19 +1,18 @@
|
|||||||
if(PKG_USER-SCAFACOS)
|
enable_language(Fortran)
|
||||||
enable_language(Fortran)
|
enable_language(C)
|
||||||
enable_language(C)
|
|
||||||
|
|
||||||
find_package(GSL REQUIRED)
|
find_package(GSL REQUIRED)
|
||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
find_package(MPI REQUIRED)
|
find_package(MPI REQUIRED)
|
||||||
set(DOWNLOAD_SCAFACOS_DEFAULT ON)
|
set(DOWNLOAD_SCAFACOS_DEFAULT ON)
|
||||||
if(PKG_CONFIG_FOUND)
|
if(PKG_CONFIG_FOUND)
|
||||||
pkg_check_modules(SCAFACOS QUIET scafacos)
|
pkg_check_modules(SCAFACOS QUIET scafacos)
|
||||||
if(SCAFACOS_FOUND)
|
if(SCAFACOS_FOUND)
|
||||||
set(DOWNLOAD_SCAFACOS_DEFAULT OFF)
|
set(DOWNLOAD_SCAFACOS_DEFAULT OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
|
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
|
||||||
if(DOWNLOAD_SCAFACOS)
|
if(DOWNLOAD_SCAFACOS)
|
||||||
message(STATUS "ScaFaCoS download requested - we will build our own")
|
message(STATUS "ScaFaCoS download requested - we will build our own")
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(scafacos_build
|
ExternalProject_Add(scafacos_build
|
||||||
@ -45,32 +44,16 @@ if(PKG_USER-SCAFACOS)
|
|||||||
<INSTALL_DIR>/lib/libfcs_fftw3.a
|
<INSTALL_DIR>/lib/libfcs_fftw3.a
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(scafacos_build INSTALL_DIR)
|
ExternalProject_get_property(scafacos_build INSTALL_DIR)
|
||||||
set(SCAFACOS_BUILD_DIR ${INSTALL_DIR})
|
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||||
set(SCAFACOS_INCLUDE_DIRS ${SCAFACOS_BUILD_DIR}/include)
|
add_library(LAMMPS::SCAFACOS UNKNOWN IMPORTED)
|
||||||
list(APPEND LAMMPS_DEPS scafacos_build)
|
set_target_properties(LAMMPS::SCAFACOS PROPERTIES
|
||||||
# list and order from pkg_config file of ScaFaCoS build
|
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libfcs.a"
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs.a)
|
INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include"
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_direct.a)
|
INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libfcs.a;${INSTALL_DIR}/lib/libfcs_direct.a;${INSTALL_DIR}/lib/libfcs_ewald.a;${INSTALL_DIR}/lib/libfcs_fmm.a;${INSTALL_DIR}/lib/libfcs_p2nfft.a;${INSTALL_DIR}/lib/libfcs_p3m.a;GSL::gsl;${INSTALL_DIR}/lib/libfcs_near.a;${INSTALL_DIR}/lib/libfcs_gridsort.a;${INSTALL_DIR}/lib/libfcs_resort.a;${INSTALL_DIR}/lib/libfcs_redist.a;${INSTALL_DIR}/lib/libfcs_common.a;${INSTALL_DIR}/lib/libfcs_pnfft.a;${INSTALL_DIR}/lib/libfcs_pfft.a;${INSTALL_DIR}/lib/libfcs_fftw3_mpi.a;${INSTALL_DIR}/lib/libfcs_fftw3.a;MPI::MPI_Fortran;MPI::MPI_C")
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_ewald.a)
|
target_link_libraries(lammps PRIVATE LAMMPS::SCAFACOS)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_fmm.a)
|
add_dependencies(LAMMPS::SCAFACOS scafacos_build)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_BUILD_DIR}/lib/libfcs_p2nfft.a)
|
else()
|
||||||
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)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(SCAFACOS REQUIRED scafacos)
|
pkg_check_modules(SCAFACOS REQUIRED IMPORTED_TARGET scafacos)
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_LDFLAGS})
|
target_link_libraries(lammps PRIVATE PkgConfig::SCAFACOS)
|
||||||
endif()
|
|
||||||
include_directories(${SCAFACOS_INCLUDE_DIRS})
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
# Fix rigid/meso requires RIGID to be installed
|
# Fix rigid/meso requires RIGID to be installed
|
||||||
if(PKG_USER-SDPD)
|
set(USER-SDPD_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-SDPD)
|
||||||
set(USER-SDPD_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-SDPD)
|
|
||||||
|
|
||||||
get_property(hlist GLOBAL PROPERTY FIX)
|
get_property(hlist GLOBAL PROPERTY FIX)
|
||||||
if(NOT PKG_RIGID)
|
if(NOT PKG_RIGID)
|
||||||
list(REMOVE_ITEM hlist ${USER-SDPD_SOURCES_DIR}/fix_rigid_meso.h)
|
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)
|
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||||
endif()
|
list(REMOVE_ITEM LAMMPS_SOURCES ${USER-SDPD_SOURCES_DIR}/fix_rigid_meso.cpp)
|
||||||
set_property(GLOBAL PROPERTY FIX "${hlist}")
|
set_property(TARGET lammps PROPERTY SOURCES ${LAMMPS_SOURCES})
|
||||||
|
|
||||||
include_directories(${USER-SDPD_SOURCES_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
set_property(GLOBAL PROPERTY FIX "${hlist}")
|
||||||
|
|
||||||
|
target_include_directories(lammps PRIVATE ${USER-SDPD_SOURCES_DIR})
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
if(PKG_USER-SMD)
|
find_package(Eigen3 NO_MODULE)
|
||||||
find_package(Eigen3 NO_MODULE)
|
if(EIGEN3_FOUND)
|
||||||
if(EIGEN3_FOUND)
|
|
||||||
set(DOWNLOAD_EIGEN3_DEFAULT OFF)
|
set(DOWNLOAD_EIGEN3_DEFAULT OFF)
|
||||||
else()
|
else()
|
||||||
set(DOWNLOAD_EIGEN3_DEFAULT ON)
|
set(DOWNLOAD_EIGEN3_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT})
|
option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT})
|
||||||
if(DOWNLOAD_EIGEN3)
|
if(DOWNLOAD_EIGEN3)
|
||||||
message(STATUS "Eigen3 download requested - we will build our own")
|
message(STATUS "Eigen3 download requested - we will build our own")
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(Eigen3_build
|
ExternalProject_Add(Eigen3_build
|
||||||
@ -15,14 +14,15 @@ if(PKG_USER-SMD)
|
|||||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(Eigen3_build SOURCE_DIR)
|
ExternalProject_get_property(Eigen3_build SOURCE_DIR)
|
||||||
set(EIGEN3_INCLUDE_DIR ${SOURCE_DIR})
|
add_library(LAMMPS::EIGEN3 INTERFACE IMPORTED)
|
||||||
list(APPEND LAMMPS_DEPS Eigen3_build)
|
set_target_properties(LAMMPS::EIGEN3 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}")
|
||||||
else()
|
target_link_libraries(lammps PRIVATE LAMMPS::EIGEN3)
|
||||||
|
add_dependencies(LAMMPS::EIGEN3 Eigen3_build)
|
||||||
|
else()
|
||||||
find_package(Eigen3 NO_MODULE)
|
find_package(Eigen3 NO_MODULE)
|
||||||
mark_as_advanced(Eigen3_DIR)
|
mark_as_advanced(Eigen3_DIR)
|
||||||
if(NOT EIGEN3_FOUND)
|
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")
|
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()
|
||||||
endif()
|
target_link_libraries(lammps PRIVATE Eigen3::Eigen)
|
||||||
include_directories(${EIGEN3_INCLUDE_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
if(PKG_USER-VTK)
|
find_package(VTK REQUIRED NO_MODULE)
|
||||||
find_package(VTK REQUIRED NO_MODULE)
|
include(${VTK_USE_FILE})
|
||||||
include(${VTK_USE_FILE})
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_VTK)
|
||||||
add_definitions(-DLAMMPS_VTK)
|
target_link_libraries(lammps PRIVATE ${VTK_LIBRARIES})
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${VTK_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
if(PKG_VORONOI)
|
find_package(VORO)
|
||||||
find_package(VORO)
|
if(VORO_FOUND)
|
||||||
if(VORO_FOUND)
|
|
||||||
set(DOWNLOAD_VORO_DEFAULT OFF)
|
set(DOWNLOAD_VORO_DEFAULT OFF)
|
||||||
else()
|
else()
|
||||||
set(DOWNLOAD_VORO_DEFAULT ON)
|
set(DOWNLOAD_VORO_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT})
|
option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT})
|
||||||
if(DOWNLOAD_VORO)
|
if(DOWNLOAD_VORO)
|
||||||
message(STATUS "Voro++ download requested - we will build our own")
|
message(STATUS "Voro++ download requested - we will build our own")
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
@ -25,19 +24,25 @@ if(PKG_VORONOI)
|
|||||||
ExternalProject_Add(voro_build
|
ExternalProject_Add(voro_build
|
||||||
URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz
|
URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz
|
||||||
URL_MD5 2338b824c3b7b25590e18e8df5d68af9
|
URL_MD5 2338b824c3b7b25590e18e8df5d68af9
|
||||||
CONFIGURE_COMMAND "" BUILD_COMMAND make ${VORO_BUILD_OPTIONS} BUILD_IN_SOURCE 1 INSTALL_COMMAND ""
|
PATCH_COMMAND patch -b -p0 < ${LAMMPS_LIB_SOURCE_DIR}/voronoi/voro-make.patch
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND make ${VORO_BUILD_OPTIONS}
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
INSTALL_COMMAND ""
|
||||||
BUILD_BYPRODUCTS <SOURCE_DIR>/src/libvoro++.a
|
BUILD_BYPRODUCTS <SOURCE_DIR>/src/libvoro++.a
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(voro_build SOURCE_DIR)
|
ExternalProject_get_property(voro_build SOURCE_DIR)
|
||||||
set(VORO_LIBRARIES ${SOURCE_DIR}/src/libvoro++.a)
|
file(MAKE_DIRECTORY ${SOURCE_DIR}/src)
|
||||||
set(VORO_INCLUDE_DIRS ${SOURCE_DIR}/src)
|
add_library(LAMMPS::VORO UNKNOWN IMPORTED)
|
||||||
list(APPEND LAMMPS_DEPS voro_build)
|
set_target_properties(LAMMPS::VORO PROPERTIES
|
||||||
else()
|
IMPORTED_LOCATION "${SOURCE_DIR}/src/libvoro++.a"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/src")
|
||||||
|
target_link_libraries(lammps PRIVATE LAMMPS::VORO)
|
||||||
|
add_dependencies(LAMMPS::VORO voro_build)
|
||||||
|
else()
|
||||||
find_package(VORO)
|
find_package(VORO)
|
||||||
if(NOT VORO_FOUND)
|
if(NOT VORO_FOUND)
|
||||||
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")
|
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()
|
||||||
endif()
|
target_link_libraries(lammps PRIVATE VORO::VORO)
|
||||||
include_directories(${VORO_INCLUDE_DIRS})
|
|
||||||
list(APPEND LAMMPS_LINK_LIBS ${VORO_LIBRARIES})
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# Testing
|
# Testing
|
||||||
###############################################################################
|
###############################################################################
|
||||||
option(ENABLE_TESTING "Enable testing" OFF)
|
option(ENABLE_TESTING "Enable testing" OFF)
|
||||||
if(ENABLE_TESTING AND BUILD_EXE)
|
if(ENABLE_TESTING)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
option(LAMMPS_TESTING_SOURCE_DIR "Location of lammps-testing source directory" "")
|
option(LAMMPS_TESTING_SOURCE_DIR "Location of lammps-testing source directory" "")
|
||||||
option(LAMMPS_TESTING_GIT_TAG "Git tag of lammps-testing" "master")
|
option(LAMMPS_TESTING_GIT_TAG "Git tag of lammps-testing" "master")
|
||||||
@ -28,7 +28,7 @@ if(ENABLE_TESTING AND BUILD_EXE)
|
|||||||
"https://github.com/lammps/lammps-testing in LAMMPS_TESTING_SOURCE_DIR")
|
"https://github.com/lammps/lammps-testing in LAMMPS_TESTING_SOURCE_DIR")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_test(ShowHelp ${CMAKE_BINARY_DIR}/${LAMMPS_BINARY} -help)
|
add_test(NAME ShowHelp COMMAND $<TARGET_FILE:lmp> -help)
|
||||||
|
|
||||||
if(EXISTS ${LAMMPS_TESTING_SOURCE_DIR})
|
if(EXISTS ${LAMMPS_TESTING_SOURCE_DIR})
|
||||||
message(STATUS "Running test discovery...")
|
message(STATUS "Running test discovery...")
|
||||||
@ -42,8 +42,7 @@ if(ENABLE_TESTING AND BUILD_EXE)
|
|||||||
string(REPLACE "-" "_" TEST_NAME ${TEST_NAME})
|
string(REPLACE "-" "_" TEST_NAME ${TEST_NAME})
|
||||||
string(REPLACE "+" "_" TEST_NAME ${TEST_NAME})
|
string(REPLACE "+" "_" TEST_NAME ${TEST_NAME})
|
||||||
set(TEST_NAME "test_core_${TEST_NAME}_serial")
|
set(TEST_NAME "test_core_${TEST_NAME}_serial")
|
||||||
add_test(${TEST_NAME} ${CMAKE_BINARY_DIR}/${LAMMPS_BINARY} -in ${SCRIPT_NAME})
|
add_test(NAME ${TEST_NAME} COMMAND $<TARGET_FILE:lmp> -in ${SCRIPT_NAME} WORKING_DIRECTORY ${PARENT_DIR})
|
||||||
set_tests_properties(${TEST_NAME} PROPERTIES WORKING_DIRECTORY ${PARENT_DIR})
|
|
||||||
endforeach()
|
endforeach()
|
||||||
list(LENGTH TEST_SCRIPTS NUM_TESTS)
|
list(LENGTH TEST_SCRIPTS NUM_TESTS)
|
||||||
|
|
||||||
|
|||||||
@ -3,17 +3,19 @@ set(temp_git_commit "(unknown)")
|
|||||||
set(temp_git_branch "(unknown)")
|
set(temp_git_branch "(unknown)")
|
||||||
set(temp_git_describe "(unknown)")
|
set(temp_git_describe "(unknown)")
|
||||||
set(temp_git_info "false")
|
set(temp_git_info "false")
|
||||||
if(GIT_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)
|
|
||||||
|
message(STATUS "Git Directory: ${LAMMPS_DIR}/.git")
|
||||||
|
if(GIT_FOUND AND EXISTS ${LAMMPS_DIR}/.git)
|
||||||
set(temp_git_info "true")
|
set(temp_git_info "true")
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/.. rev-parse HEAD
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${LAMMPS_DIR} rev-parse HEAD
|
||||||
OUTPUT_VARIABLE temp_git_commit
|
OUTPUT_VARIABLE temp_git_commit
|
||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/.. rev-parse --abbrev-ref HEAD
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${LAMMPS_DIR} rev-parse --abbrev-ref HEAD
|
||||||
OUTPUT_VARIABLE temp_git_branch
|
OUTPUT_VARIABLE temp_git_branch
|
||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/.. describe --dirty=-modified
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${LAMMPS_DIR} describe --dirty=-modified
|
||||||
OUTPUT_VARIABLE temp_git_describe
|
OUTPUT_VARIABLE temp_git_describe
|
||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|||||||
2320
cmake/README.md
@ -18,12 +18,6 @@
|
|||||||
# myapp_CFLAGS = $(LAMMPS_CFLAGS)
|
# myapp_CFLAGS = $(LAMMPS_CFLAGS)
|
||||||
# myapp_LDADD = $(LAMMPS_LIBS)
|
# myapp_LDADD = $(LAMMPS_LIBS)
|
||||||
|
|
||||||
# Use this in CMake:
|
|
||||||
# CMakeLists.txt:
|
|
||||||
# find_package(PkgConfig)
|
|
||||||
# pkg_check_modules(LAMMPS IMPORTED_TARGET lammps)
|
|
||||||
# target_link_libraries(<lib> PkgConfig::LAMMPS)
|
|
||||||
|
|
||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||||
@ -31,8 +25,8 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|||||||
Name: liblammps@LAMMPS_MACHINE@
|
Name: liblammps@LAMMPS_MACHINE@
|
||||||
Description: Large-scale Atomic/Molecular Massively Parallel Simulator Library
|
Description: Large-scale Atomic/Molecular Massively Parallel Simulator Library
|
||||||
URL: http://lammps.sandia.gov
|
URL: http://lammps.sandia.gov
|
||||||
Version: @LAMMPS_VERSION@
|
Version: @PROJECT_VERSION@
|
||||||
Requires:
|
Requires:
|
||||||
Libs: -L${libdir} -llammps@LAMMPS_LIB_SUFFIX@
|
Libs: -L${libdir} -llammps@LAMMPS_MACHINE@
|
||||||
Libs.private: -lm
|
Libs.private: -lm
|
||||||
Cflags: -I${includedir} @LAMMPS_API_DEFINES@
|
Cflags: -I${includedir} @LAMMPS_API_DEFINES@
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g -O2 -DNDEBG" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
set(MPI_CXX "clang++" CACHE STRING "" FORCE)
|
set(MPI_CXX "clang++" CACHE STRING "" FORCE)
|
||||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
|
|||||||
12
cmake/presets/hip.cmake
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# preset that will enable hipcc plus gcc with support for MPI and OpenMP (on Linux boxes)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_COMPILER "hipcc" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
|
|
||||||
|
set(OpenMP_CXX "hipcc" CACHE STRING "" FORCE)
|
||||||
|
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
||||||
|
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
|
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)
|
||||||
|
|
||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
|
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_CXX_FLAGS "-O3 -DNDEBG" CACHE STRING "" FORCE)
|
|
||||||
set(MPI_CXX "icpc" CACHE STRING "" FORCE)
|
set(MPI_CXX "icpc" CACHE STRING "" FORCE)
|
||||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
|
|||||||
11
cmake/presets/kokkos-cuda.cmake
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# preset that enables KOKKOS and selects CUDA compilation with OpenMP
|
||||||
|
# enabled as well. This preselects CC 5.0 as default GPU arch, since
|
||||||
|
# that is compatible with all higher CC, but not the default CC 3.5
|
||||||
|
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE)
|
||||||
|
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||||
|
get_filename_component(NVCC_WRAPPER_CMD ${CMAKE_CURRENT_SOURCE_DIR}/../lib/kokkos/bin/nvcc_wrapper ABSOLUTE)
|
||||||
|
set(CMAKE_CXX_COMPILER ${NVCC_WRAPPER_CMD} CACHE FILEPATH "" FORCE)
|
||||||
6
cmake/presets/kokkos-openmp.cmake
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# preset that enables KOKKOS and selects OpenMP (only) compilation
|
||||||
|
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE)
|
||||||
|
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||||
5
cmake/presets/kokkos-serial.cmake
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# preset that enables KOKKOS and selects serial compilation only
|
||||||
|
set(PKG_KOKKOS ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_OPENMP OFF CACHE BOOL "" FORCE)
|
||||||
|
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE)
|
||||||
@ -23,6 +23,7 @@ set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
|
|||||||
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
|
||||||
set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE)
|
set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_TUNE_FLAGS "-Wno-missing-include-dirs" CACHE STRING "" FORCE)
|
set(CMAKE_TUNE_FLAGS "-Wno-missing-include-dirs" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "--enable-stdcall-fixup" CACHE STRING "" FORCE)
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-stdcall-fixup" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-stdcall-fixup" CACHE STRING "" FORCE)
|
||||||
set(BUILD_TOOLS ON CACHE BOOL "" FORCE)
|
set(BUILD_TOOLS ON CACHE BOOL "" FORCE)
|
||||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/lammps-installer")
|
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/lammps-installer")
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL
|
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL
|
||||||
DIPOLE GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI
|
DIPOLE GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI
|
||||||
POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
|
POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
|
||||||
USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
||||||
USER-DPD USER-DRUDE USER-FEP USER-MEAMC USER-MESODPD
|
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-MESODPD
|
||||||
USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION
|
USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION
|
||||||
USER-REAXC USER-SPH USER-SMD USER-UEF USER-YAFF)
|
USER-REAXC USER-SDPD USER-SPH USER-SMD USER-UEF USER-YAFF)
|
||||||
|
|
||||||
foreach(PKG ${ALL_PACKAGES})
|
foreach(PKG ${ALL_PACKAGES})
|
||||||
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
||||||
|
|||||||
17
doc/Makefile
@ -12,6 +12,7 @@ PYTHON = $(shell which python3)
|
|||||||
VIRTUALENV = virtualenv
|
VIRTUALENV = virtualenv
|
||||||
HAS_PYTHON3 = NO
|
HAS_PYTHON3 = NO
|
||||||
HAS_VIRTUALENV = NO
|
HAS_VIRTUALENV = NO
|
||||||
|
HAS_PDFLATEX = NO
|
||||||
|
|
||||||
ifeq ($(shell which python3 >/dev/null 2>&1; echo $$?), 0)
|
ifeq ($(shell which python3 >/dev/null 2>&1; echo $$?), 0)
|
||||||
HAS_PYTHON3 = YES
|
HAS_PYTHON3 = YES
|
||||||
@ -27,6 +28,11 @@ VIRTUALENV = virtualenv
|
|||||||
HAS_VIRTUALENV = YES
|
HAS_VIRTUALENV = YES
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(shell which pdflatex >/dev/null 2>&1; echo $$?), 0)
|
||||||
|
HAS_PDFLATEX = YES
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())')
|
SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())')
|
||||||
|
|
||||||
.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check
|
.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check
|
||||||
@ -51,7 +57,7 @@ help:
|
|||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
|
|
||||||
clean-all: clean
|
clean-all: clean
|
||||||
rm -rf $(BUILDDIR)/docenv $(BUILDDIR)/doctrees $(BUILDDIR)/mathjax
|
rm -rf $(BUILDDIR)/docenv $(BUILDDIR)/doctrees $(BUILDDIR)/mathjax Manual.pdf Developer.pdf
|
||||||
|
|
||||||
clean: clean-spelling
|
clean: clean-spelling
|
||||||
rm -rf html epub latex
|
rm -rf html epub latex
|
||||||
@ -77,7 +83,7 @@ html: $(ANCHORCHECK) $(MATHJAX)
|
|||||||
@rm -rf html/JPG
|
@rm -rf html/JPG
|
||||||
@cp -r src/PDF html/PDF
|
@cp -r src/PDF html/PDF
|
||||||
@mkdir -p html/JPG
|
@mkdir -p html/JPG
|
||||||
@cp `grep -A2 '\.\. .*image::' src/*.rst | grep ':target:' | sed -e 's,.*:target: JPG/,src/JPG/,' | sort | uniq` html/JPG/
|
@cp `grep -A2 '\.\. .*\(image\|figure\)::' src/*.rst | grep ':target:' | sed -e 's,.*:target: JPG/,src/JPG/,' | sort | uniq` html/JPG/
|
||||||
@rm -rf html/PDF/.[sg]*
|
@rm -rf html/PDF/.[sg]*
|
||||||
@mkdir -p html/_static/mathjax
|
@mkdir -p html/_static/mathjax
|
||||||
@cp -r $(MATHJAX)/es5 html/_static/mathjax/
|
@cp -r $(MATHJAX)/es5 html/_static/mathjax/
|
||||||
@ -86,8 +92,7 @@ html: $(ANCHORCHECK) $(MATHJAX)
|
|||||||
spelling: $(VENV) utils/sphinx-config/false_positives.txt
|
spelling: $(VENV) utils/sphinx-config/false_positives.txt
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ;\
|
. $(VENV)/bin/activate ;\
|
||||||
pip install sphinxcontrib-spelling ;\
|
cp utils/sphinx-config/false_positives.txt $(RSTDIR)/ ; env PYTHONWARNINGS= \
|
||||||
cp utils/sphinx-config/false_positives.txt $(RSTDIR)/ ;\
|
|
||||||
sphinx-build -b spelling -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
sphinx-build -b spelling -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
@ -113,6 +118,7 @@ mobi: epub
|
|||||||
@echo "Conversion finished. The MOBI manual file is created."
|
@echo "Conversion finished. The MOBI manual file is created."
|
||||||
|
|
||||||
pdf: $(ANCHORCHECK)
|
pdf: $(ANCHORCHECK)
|
||||||
|
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX was not found! Please check README.md for further instructions" 1>&2; exit 1; fi
|
||||||
@(\
|
@(\
|
||||||
cd src/Developer; \
|
cd src/Developer; \
|
||||||
pdflatex developer; \
|
pdflatex developer; \
|
||||||
@ -187,7 +193,10 @@ $(VENV):
|
|||||||
@( \
|
@( \
|
||||||
$(VIRTUALENV) -p $(PYTHON) $(VENV); \
|
$(VIRTUALENV) -p $(PYTHON) $(VENV); \
|
||||||
. $(VENV)/bin/activate; \
|
. $(VENV)/bin/activate; \
|
||||||
|
pip install --upgrade pip; \
|
||||||
pip install Sphinx; \
|
pip install Sphinx; \
|
||||||
|
pip install sphinxcontrib-spelling ;\
|
||||||
|
pip install breathe; \
|
||||||
deactivate;\
|
deactivate;\
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -93,12 +93,18 @@ support for PDFLaTeX. Also the following LaTeX packages need
|
|||||||
to be installed (e.g. from texlive):
|
to be installed (e.g. from texlive):
|
||||||
- amsmath
|
- amsmath
|
||||||
- babel
|
- babel
|
||||||
|
- capt-of
|
||||||
- cmap
|
- cmap
|
||||||
- fncychap
|
- fncychap
|
||||||
|
- framed
|
||||||
- geometry
|
- geometry
|
||||||
- hyperref
|
- hyperref
|
||||||
- hypcap
|
- hypcap
|
||||||
|
- needspace
|
||||||
- times
|
- times
|
||||||
|
- tabulary
|
||||||
|
- upquote
|
||||||
|
- wrapfig
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Installing prerequisites for epub build
|
Installing prerequisites for epub build
|
||||||
|
|||||||
@ -49,22 +49,15 @@ include files provided with LAMMPS are included with double quotes
|
|||||||
|
|
||||||
For headers declaring functions of the C-library, the corresponding
|
For headers declaring functions of the C-library, the corresponding
|
||||||
C++ versions should be included (examples: `#include <cstdlib>` or
|
C++ versions should be included (examples: `#include <cstdlib>` or
|
||||||
`#include <cctypes>`). However, these includes are limited to those defined
|
`#include <cctypes>` instead of `#include <stdlib.h>` or
|
||||||
in the C++98 standard. Some files thus must use the older style until
|
`#include<ctypes.h>` ).
|
||||||
the minimum C++ standard requirement of LAMMPS is lifted to C++11 or
|
|
||||||
even beyond (examples: `#include <stdint.h>` versus `#include <cstdint>`
|
|
||||||
or `#include <inttypes.h>` versus `#include <cinttypes>`).
|
|
||||||
|
|
||||||
### C++ Standard Compliance
|
### C++ Standard Compliance
|
||||||
|
|
||||||
LAMMPS core files currently correspond to the C++98 standard. Files
|
LAMMPS core files use standard conforming C++ compatible with the
|
||||||
requiring C++11 or later are only permitted in (optional) packages
|
C++11 standard, unless explicitly noted. Also, LAMMPS uses the C-style
|
||||||
and particularly packages that are not part of the list of commonly
|
stdio library for I/O instead of iostreams. Since using both at the
|
||||||
used packages such as MOLECULE, KSPACE, MANYBODY, or RIGID.
|
same time can cause problems, iostreams should be avoided where possible.
|
||||||
|
|
||||||
Also, LAMMPS uses the C-style stdio library for I/O instead of iostreams.
|
|
||||||
Since using both at the same time can cause problems, iostreams should
|
|
||||||
be avoided where possible.
|
|
||||||
|
|
||||||
### Lean Header Files
|
### Lean Header Files
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
.TH LAMMPS "19 March 2020" "2020-03-19"
|
.TH LAMMPS "5 May 2020" "2020-05-5"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B LAMMPS
|
.B LAMMPS
|
||||||
\- Molecular Dynamics Simulator.
|
\- Molecular Dynamics Simulator.
|
||||||
|
|||||||
2
doc/src/.gitignore
vendored
@ -1,3 +1 @@
|
|||||||
/Eqs
|
|
||||||
/JPG
|
|
||||||
/false_positives.txt
|
/false_positives.txt
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
Build LAMMPS
|
Build LAMMPS
|
||||||
************
|
************
|
||||||
|
|
||||||
LAMMPS can be built as an executable or library from source code via
|
LAMMPS is built as a library and an executable from source code using
|
||||||
either traditional makefiles (which may require manual editing)
|
either traditional makefiles for use with GNU make (which may require
|
||||||
for use with GNU make or gmake, or a build environment generated by CMake
|
manual editing), or using a build environment generated by CMake (Unix
|
||||||
(Unix Makefiles, Xcode, Visual Studio, KDevelop or more). As an
|
Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more).
|
||||||
alternative you can download a package with pre-built executables
|
|
||||||
as described on the :doc:`Install <Install>` doc page.
|
As an alternative you can download a package with pre-built executables
|
||||||
|
or automated build trees as described on the :doc:`Install <Install>`
|
||||||
|
doc page.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|||||||
@ -6,7 +6,8 @@ CMake and make:
|
|||||||
|
|
||||||
* :ref:`Serial vs parallel build <serial>`
|
* :ref:`Serial vs parallel build <serial>`
|
||||||
* :ref:`Choice of compiler and compile/link options <compile>`
|
* :ref:`Choice of compiler and compile/link options <compile>`
|
||||||
* :ref:`Build LAMMPS as an executable or a library <exe>`
|
* :ref:`Build the LAMMPS executable and library <exe>`
|
||||||
|
* :ref:`Including and removing debug support <debug>`
|
||||||
* :ref:`Build the LAMMPS documentation <doc>`
|
* :ref:`Build the LAMMPS documentation <doc>`
|
||||||
* :ref:`Install LAMMPS after a build <install>`
|
* :ref:`Install LAMMPS after a build <install>`
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ CMake and make:
|
|||||||
.. _serial:
|
.. _serial:
|
||||||
|
|
||||||
Serial vs parallel build
|
Serial vs parallel build
|
||||||
-------------------------------------
|
------------------------
|
||||||
|
|
||||||
LAMMPS is written to use the ubiquitous `MPI (Message Passing Interface)
|
LAMMPS is written to use the ubiquitous `MPI (Message Passing Interface)
|
||||||
<https://en.wikipedia.org/wiki/Message_Passing_Interface>`_ library API
|
<https://en.wikipedia.org/wiki/Message_Passing_Interface>`_ library API
|
||||||
@ -28,8 +29,8 @@ MPI STUBS library.
|
|||||||
|
|
||||||
Independent of the distributed memory MPI parallelization, parts of
|
Independent of the distributed memory MPI parallelization, parts of
|
||||||
LAMMPS are also written with support for shared memory parallelization
|
LAMMPS are also written with support for shared memory parallelization
|
||||||
using the OpenMP threading standard. A more detailed discussion of that
|
using the `OpenMP <https://en.wikipedia.org/wiki/OpenMP>`_ threading
|
||||||
is below.
|
standard. A more detailed discussion of that is below.
|
||||||
|
|
||||||
**CMake build**\ :
|
**CMake build**\ :
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ is below.
|
|||||||
# no default value
|
# no default value
|
||||||
|
|
||||||
The executable created by CMake (after running make) is named ``lmp`` unless
|
The executable created by CMake (after running make) is named ``lmp`` unless
|
||||||
the LAMMPS_MACHINE option is set. When setting ``LAMMPS_MACHINE=name``
|
the ``LAMMPS_MACHINE`` option is set. When setting ``LAMMPS_MACHINE=name``
|
||||||
the executable will be called ``lmp_name``. Using ``BUILD_MPI=no`` will
|
the executable will be called ``lmp_name``. Using ``BUILD_MPI=no`` will
|
||||||
enforce building a serial executable using the MPI STUBS library.
|
enforce building a serial executable using the MPI STUBS library.
|
||||||
|
|
||||||
@ -55,18 +56,20 @@ The build with traditional makefiles has to be done inside the source folder ``s
|
|||||||
make serial # serial build, produces lmp_serial using Makefile/serial
|
make serial # serial build, produces lmp_serial using Makefile/serial
|
||||||
make mybox # uses Makefile.mybox to produce lmp_mybox
|
make mybox # uses Makefile.mybox to produce lmp_mybox
|
||||||
|
|
||||||
Any "make machine" command will look up the make settings from a file
|
Any ``make machine`` command will look up the make settings from a file
|
||||||
Makefile.machine, create a folder Obj_machine with all objects and
|
``Makefile.machine`` in the folder ``src/MAKE`` or one of its
|
||||||
generated files and an executable called ``lmp_machine``\ . The standard
|
sub-directories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a folder
|
||||||
parallel build with ``make mpi`` assumes a standard MPI installation with
|
``Obj_machine`` with all objects and generated files and an executable
|
||||||
MPI compiler wrappers where all necessary compiler and linker flags to
|
called ``lmp_machine``\ . The standard parallel build with ``make mpi``
|
||||||
get access and link with the suitable MPI headers and libraries are set
|
assumes a standard MPI installation with MPI compiler wrappers where all
|
||||||
by the wrapper programs. For other cases or the serial build, you have
|
necessary compiler and linker flags to get access and link with the
|
||||||
to adjust the make file variables ``MPI_INC``, ``MPI_PATH``, ``MPI_LIB``
|
suitable MPI headers and libraries are set by the wrapper programs. For
|
||||||
as well as ``CC`` and ``LINK``\ . To enable OpenMP threading usually
|
other cases or the serial build, you have to adjust the make file
|
||||||
a compiler specific flag needs to be added to the compile and link
|
variables ``MPI_INC``, ``MPI_PATH``, ``MPI_LIB`` as well as ``CC`` and
|
||||||
commands. For the GNU compilers, this is ``-fopenmp``\ , which can be
|
``LINK``\ . To enable OpenMP threading usually a compiler specific flag
|
||||||
added to the ``CC`` and ``LINK`` makefile variables.
|
needs to be added to the compile and link commands. For the GNU
|
||||||
|
compilers, this is ``-fopenmp``\ , which can be added to the ``CC`` and
|
||||||
|
``LINK`` makefile variables.
|
||||||
|
|
||||||
For the serial build the following make variables are set (see src/MAKE/Makefile.serial):
|
For the serial build the following make variables are set (see src/MAKE/Makefile.serial):
|
||||||
|
|
||||||
@ -80,18 +83,19 @@ For the serial build the following make variables are set (see src/MAKE/Makefile
|
|||||||
|
|
||||||
You also need to build the STUBS library for your platform before making
|
You also need to build the STUBS library for your platform before making
|
||||||
LAMMPS itself. A ``make serial`` build does this for you automatically,
|
LAMMPS itself. A ``make serial`` build does this for you automatically,
|
||||||
otherwise, type ``make mpi-stubs`` from the src directory, or ``make`` from
|
otherwise, type ``make mpi-stubs`` from the src directory, or ``make``
|
||||||
the src/STUBS dir. If the build fails, you will need to edit the
|
from the ``src/STUBS`` dir. If the build fails, you may need to edit
|
||||||
STUBS/Makefile for your platform. The stubs library does not provide
|
the ``STUBS/Makefile`` for your platform. The stubs library does not
|
||||||
MPI/IO functions required by some LAMMPS packages, e.g. MPIIO or USER-LB,
|
provide MPI/IO functions required by some LAMMPS packages,
|
||||||
and thus is not compatible with those packages.
|
e.g. ``MPIIO`` or ``USER-LB``, and thus is not compatible with those
|
||||||
|
packages.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The file ``src/STUBS/mpi.c`` provides a CPU timer function called
|
The file ``src/STUBS/mpi.c`` provides a CPU timer function called
|
||||||
MPI_Wtime() that calls gettimeofday() . If your operating system
|
``MPI_Wtime()`` that calls ``gettimeofday()``. If your operating system
|
||||||
does not support gettimeofday() , you will need to insert code to
|
does not support ``gettimeofday()``, you will need to insert code to
|
||||||
call another timer. Note that the ANSI-standard function clock()
|
call another timer. Note that the ANSI-standard function ``clock()``
|
||||||
rolls over after an hour or so, and is therefore insufficient for
|
rolls over after an hour or so, and is therefore insufficient for
|
||||||
timing long LAMMPS simulations.
|
timing long LAMMPS simulations.
|
||||||
|
|
||||||
@ -111,20 +115,22 @@ self-installed MPICH or OpenMPI, so you should study the provided
|
|||||||
documentation to find out how to build and link with it.
|
documentation to find out how to build and link with it.
|
||||||
|
|
||||||
The majority of OpenMP (threading) support in LAMMPS is provided by the
|
The majority of OpenMP (threading) support in LAMMPS is provided by the
|
||||||
USER-OMP package; see the :doc:`Speed omp <Speed_omp>` doc page for
|
``USER-OMP`` package; see the :doc:`Speed omp <Speed_omp>` doc page for
|
||||||
details. The USER-INTEL package also includes OpenMP threading (it is
|
details. The ``USER-INTEL`` package also includes OpenMP threading (it
|
||||||
compatible with USER-OMP) and adds vectorization support when compiled
|
is compatible with ``USER-OMP`` and will usually fall back on styles
|
||||||
with compatible compilers, in particular the Intel compilers on top of
|
from that package, if a ``USER-INTEL`` does not exist) and adds
|
||||||
OpenMP. Also, the KOKKOS package can be compiled to include OpenMP
|
vectorization support when compiled with compatible compilers, in
|
||||||
threading.
|
particular the Intel compilers on top of OpenMP. Also, the ``KOKKOS``
|
||||||
|
package can be compiled to include OpenMP threading.
|
||||||
|
|
||||||
In addition, there are a few commands in LAMMPS that have native OpenMP
|
In addition, there are a few commands in LAMMPS that have native OpenMP
|
||||||
support included as well. These are commands in the MPIIO, SNAP,
|
support included as well. These are commands in the ``MPIIO``,
|
||||||
USER-DIFFRACTION, and USER-DPD packages. In addition some packages
|
``SNAP``, ``USER-DIFFRACTION``, and ``USER-DPD`` packages. In addition
|
||||||
support OpenMP threading indirectly through the libraries they interface
|
some packages support OpenMP threading indirectly through the libraries
|
||||||
to: e.g. LATTE and USER-COLVARS. See the :doc:`Packages details
|
they interface to: e.g. ``LATTE``, ``KSPACE``, and ``USER-COLVARS``.
|
||||||
<Packages_details>` doc page for more info on these packages and the doc
|
See the :doc:`Packages details <Packages_details>` doc page for more
|
||||||
pages for their respective commands for OpenMP threading info.
|
info on these packages and the doc pages for their respective commands
|
||||||
|
for OpenMP threading info.
|
||||||
|
|
||||||
For CMake, if you use ``BUILD_OMP=yes``, you can use these packages
|
For CMake, if you use ``BUILD_OMP=yes``, you can use these packages
|
||||||
and turn on their native OpenMP support and turn on their native OpenMP
|
and turn on their native OpenMP support and turn on their native OpenMP
|
||||||
@ -142,14 +148,15 @@ please refer to its documentation.
|
|||||||
**OpenMP Compiler compatibility info**\ :
|
**OpenMP Compiler compatibility info**\ :
|
||||||
|
|
||||||
Some compilers do not fully support the ``default(none)`` directive
|
Some compilers do not fully support the ``default(none)`` directive
|
||||||
and others (e.g. GCC version 9 and beyond) may implement OpenMP 4.0
|
and others (e.g. GCC version 9 and beyond, Clang version 10 and later)
|
||||||
semantics, which are incompatible with the OpenMP 3.1 semantics used
|
may implement strict OpenMP 4.0 and later semantics, which are incompatible
|
||||||
in LAMMPS (for maximal compatibility with compiler versions in use).
|
with the OpenMP 3.1 semantics used in LAMMPS for maximal compatibility
|
||||||
In those case, all ``default(none)`` directives (which aid in detecting
|
with compiler versions in use. If compilation with OpenMP enabled fails
|
||||||
incorrect and unwanted sharing) can be replaced with ``default(shared)``
|
because of your compiler requiring strict OpenMP 4.0 semantic, you can
|
||||||
while dropping all ``shared()`` directives. The script
|
change the behavior by adding ``-D LAMMPS_OMP_COMPAT=4`` to the ``LMP_INC``
|
||||||
'src/USER-OMP/hack_openmp_for_pgi_gcc9.sh' can be used to automate
|
variable in your makefile, or add it to the command line while configuring
|
||||||
this conversion.
|
with CMake. CMake will detect the suitable setting for the GNU, Clang,
|
||||||
|
and Intel compilers.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -158,15 +165,18 @@ this conversion.
|
|||||||
Choice of compiler and compile/link options
|
Choice of compiler and compile/link options
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
The choice of compiler and compiler flags can be important for
|
The choice of compiler and compiler flags can be important for maximum
|
||||||
performance. Vendor provided compilers for a specific hardware can
|
performance. Vendor provided compilers for a specific hardware can
|
||||||
produce faster code than open-source compilers like the GNU compilers.
|
produce faster code than open-source compilers like the GNU compilers.
|
||||||
On x86 hardware most popular compilers are quite similar in performance
|
On the most common x86 hardware most popular C++ compilers are quite
|
||||||
of C/C++ code at high optimization levels. When using the USER-INTEL
|
similar in performance of C/C++ code at high optimization levels. When
|
||||||
package, there is a distinct advantage in using the `Intel C++ compiler
|
using the ``USER-INTEL`` package, there is a distinct advantage in using
|
||||||
<intel_>`_ due to much improved vectorization through SSE and AVX
|
the `Intel C++ compiler <intel_>`_ due to much improved vectorization
|
||||||
instructions on compatible hardware as the source code includes changes
|
through SSE and AVX instructions on compatible hardware as the source
|
||||||
and compiler directives to enable high degrees of vectorization.
|
code includes changes and Intel compiler specific directives to enable
|
||||||
|
high degrees of vectorization. This may change over time as equivalent
|
||||||
|
vectorization directives are included into OpenMP standard revisions and
|
||||||
|
other compilers adopt them.
|
||||||
|
|
||||||
.. _intel: https://software.intel.com/en-us/intel-compilers
|
.. _intel: https://software.intel.com/en-us/intel-compilers
|
||||||
|
|
||||||
@ -177,17 +187,20 @@ LAMMPS.
|
|||||||
|
|
||||||
**CMake build**\ :
|
**CMake build**\ :
|
||||||
|
|
||||||
By default CMake will use a compiler it finds and it will add
|
By default CMake will use a compiler it finds according to internal
|
||||||
optimization flags appropriate to that compiler and any
|
preferences and it will add optimization flags appropriate to that
|
||||||
:doc:`accelerator packages <Speed_packages>` you have included in the
|
compiler and any :doc:`accelerator packages <Speed_packages>` you have
|
||||||
build.
|
included in the build.
|
||||||
|
|
||||||
You can tell CMake to look for a specific compiler with these variable
|
You can tell CMake to look for a specific compiler with setting CMake
|
||||||
settings. Likewise you can specify the corresponding ``CMAKE_*_FLAGS``
|
variable during configuration. For a few common choices, there are also
|
||||||
variables if you want to experiment with alternate optimization flags.
|
presets in the ``cmake/presets`` folder. For convenience, there is a
|
||||||
You should specify all 3 compilers, so that the small number of LAMMPS
|
``CMAKE_TUNE_FLAGS`` variable that can be set to apply global compiler
|
||||||
source files written in C or Fortran are built with a compiler consistent
|
options. More on that below, but you can also specify the corresponding
|
||||||
with the one used for all the C++ files:
|
``CMAKE_*_FLAGS`` variables individually if you want to experiment with
|
||||||
|
alternate optimization flags. You should specify all 3 compilers, so
|
||||||
|
that the (few) LAMMPS source files written in C or Fortran are built
|
||||||
|
with a compiler consistent with the one used for the C++ files:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -210,16 +223,17 @@ A few example command lines are:
|
|||||||
# Building with LLVM/Clang Compilers:
|
# Building with LLVM/Clang Compilers:
|
||||||
cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang
|
cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang
|
||||||
|
|
||||||
For compiling with the Clang/LLVM compilers a special CMake preset is
|
For compiling with the Clang/LLVM compilers a CMake preset is provided that
|
||||||
included that can be loaded with `-C ../cmake/presets/clang.cmake`.
|
can be loaded with `-C ../cmake/presets/clang.cmake`. Similarly,
|
||||||
|
`-C ../cmake/presets/intel.cmake` should switch the
|
||||||
|
|
||||||
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add compiler
|
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add
|
||||||
flags to tune for optimal performance on given hosts. By default these are
|
compiler flags to tune for optimal performance on given hosts. By
|
||||||
initialized to some compiler specific flags, where known, to optimize the
|
default these are initialized to some compiler specific flags, to
|
||||||
LAMMPS executable with optimizations and instructions available on the host
|
optimize the LAMMPS executable with optimizations and instructions
|
||||||
where LAMMPS is compiled. For example, for Intel compilers this would be
|
available on the host where LAMMPS is compiled. For example, for Intel
|
||||||
``-xHost`` and for GNU compilers this would be ``-march=native``. To turn
|
compilers this would be ``-xHost`` and for GNU compilers this would be
|
||||||
these flags off, set ``-D CMAKE_TUNE_FLAGS=``.
|
``-march=native``. To turn these flags off, do ``-D CMAKE_TUNE_FLAGS=``.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -235,11 +249,11 @@ these flags off, set ``-D CMAKE_TUNE_FLAGS=``.
|
|||||||
The "compiler/linker settings" section of a Makefile.machine lists
|
The "compiler/linker settings" section of a Makefile.machine lists
|
||||||
compiler and linker settings for your C++ compiler, including
|
compiler and linker settings for your C++ compiler, including
|
||||||
optimization flags. For a parallel build it is recommended to use
|
optimization flags. For a parallel build it is recommended to use
|
||||||
mpicxx or mpiCC, since these compiler wrappers will include a variety of
|
``mpicxx`` or ``mpiCC``, since these compiler wrappers will include a
|
||||||
settings appropriate for your MPI installation and thus avoiding the
|
variety of settings appropriate for your MPI installation and thus
|
||||||
guesswork of finding the right flags.
|
avoiding the guesswork of finding the right flags.
|
||||||
|
|
||||||
Parallel build (see src/MAKE/Makefile.mpi):
|
Parallel build (see ``src/MAKE/Makefile.mpi``):
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -248,7 +262,7 @@ Parallel build (see src/MAKE/Makefile.mpi):
|
|||||||
LINK = mpicxx
|
LINK = mpicxx
|
||||||
LINKFLAGS = -g -O
|
LINKFLAGS = -g -O
|
||||||
|
|
||||||
Serial build (see src/MAKE/Makefile.serial):
|
Serial build with GNU gcc (see ``src/MAKE/Makefile.serial``):
|
||||||
|
|
||||||
.. code-block:: make
|
.. code-block:: make
|
||||||
|
|
||||||
@ -257,17 +271,35 @@ Serial build (see src/MAKE/Makefile.serial):
|
|||||||
LINK = g++
|
LINK = g++
|
||||||
LINKFLAGS = -g -O
|
LINKFLAGS = -g -O
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If you build LAMMPS with any :doc:`accelerator packages <Speed_packages>`
|
If compilation stops with a message like the following:
|
||||||
included, there may be specific optimization flags that are either
|
|
||||||
required or recommended to enable required features and to achieve
|
.. code-block::
|
||||||
optimal performance. You need to include these in the CCFLAGS and
|
|
||||||
LINKFLAGS settings above. For details, see the individual package
|
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../STUBS -c ../main.cpp
|
||||||
doc pages listed on the :doc:`Speed packages <Speed_packages>` doc
|
In file included from ../pointers.h:24:0,
|
||||||
page. Or examine these files in the src/MAKE/OPTIONS directory.
|
from ../input.h:17,
|
||||||
They correspond to each of the 5 accelerator packages and their
|
from ../main.cpp:16:
|
||||||
hardware variants:
|
../lmptype.h:34:2: error: #error LAMMPS requires a C++11 (or later) compliant compiler. Enable C++11 compatibility or upgrade the compiler.
|
||||||
|
|
||||||
|
then you have either an unsupported (old) compiler or you have to
|
||||||
|
turn on C++11 mode. The latter applies to GCC 4.8.x shipped with
|
||||||
|
RHEL 7.x and CentOS 7.x. For those compilers, you need to add the
|
||||||
|
``-std=c++11`` flag. Otherwise, you would have to install a newer
|
||||||
|
compiler that supports C++11; either as a binary package or through
|
||||||
|
compiling from source.
|
||||||
|
|
||||||
|
If you build LAMMPS with any :doc:`accelerator packages
|
||||||
|
<Speed_packages>` included, there may be specific optimization flags
|
||||||
|
that are either required or recommended to enable required features and
|
||||||
|
to achieve optimal performance. You need to include these in the
|
||||||
|
CCFLAGS and LINKFLAGS settings above. For details, see the individual
|
||||||
|
package doc pages listed on the :doc:`Speed packages <Speed_packages>`
|
||||||
|
doc page. Or examine these files in the src/MAKE/OPTIONS directory.
|
||||||
|
They correspond to each of the 5 accelerator packages and their hardware
|
||||||
|
variants:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -284,69 +316,74 @@ Serial build (see src/MAKE/Makefile.serial):
|
|||||||
|
|
||||||
.. _exe:
|
.. _exe:
|
||||||
|
|
||||||
Build LAMMPS as an executable or a library
|
Build the LAMMPS executable and library
|
||||||
----------------------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
LAMMPS can be built as either an executable or as a static or shared
|
LAMMPS is always built as a library of C++ classes plus an executable.
|
||||||
library. The LAMMPS library can be called from another application or
|
The executable is a simple ``main()`` function that sets up MPI and then
|
||||||
a scripting language. See the :doc:`Howto couple <Howto_couple>` doc
|
creates a LAMMPS class instance from the LAMMPS library, which
|
||||||
|
will then process commands provided via a file or from the console
|
||||||
|
input. The LAMMPS library can also be called from another application
|
||||||
|
or a scripting language. See the :doc:`Howto couple <Howto_couple>` doc
|
||||||
page for more info on coupling LAMMPS to other codes. See the
|
page for more info on coupling LAMMPS to other codes. See the
|
||||||
:doc:`Python <Python_head>` doc page for more info on wrapping and
|
:doc:`Python <Python_head>` doc page for more info on wrapping and
|
||||||
running LAMMPS from Python via its library interface.
|
running LAMMPS from Python via its library interface.
|
||||||
|
|
||||||
**CMake build**\ :
|
**CMake build**\ :
|
||||||
|
|
||||||
For CMake builds, you can select through setting CMake variables which
|
For CMake builds, you can select through setting CMake variables between
|
||||||
files the compilation produces during the configuration step. If none
|
building a shared or a static LAMMPS library and what kind of suffix is
|
||||||
are set, defaults are applied.
|
added to them (in case you want to concurrently install multiple variants
|
||||||
|
of binaries with different settings). If none are set, defaults are applied.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D BUILD_EXE=value # yes (default) or no
|
|
||||||
-D BUILD_LIB=value # yes or no (default)
|
|
||||||
-D BUILD_SHARED_LIBS=value # yes or no (default)
|
-D BUILD_SHARED_LIBS=value # yes or no (default)
|
||||||
-D LAMMPS_LIB_SUFFIX=name # name = mpi, serial, mybox, titan, laptop, etc
|
-D LAMMPS_MACHINE=name # name = mpi, serial, mybox, titan, laptop, etc
|
||||||
# no default value
|
# no default value
|
||||||
|
|
||||||
Setting ``BUILD_EXE=no`` will not produce an executable. Setting
|
The compilation will always produce a LAMMPS library and an executable
|
||||||
``BUILD_LIB=yes`` will produce a static library named ``liblammps.a``\ .
|
linked to it. By default this will be a static library named
|
||||||
Setting both ``BUILD_LIB=yes`` and ``BUILD_SHARED_LIBS=yes`` will produce a
|
``liblammps.a`` and an executable named ``lmp`` Setting
|
||||||
shared library named ``liblammps.so`` instead. If ``LAMMPS_LIB_SUFFIX=name``
|
``BUILD_SHARED_LIBS=yes`` will instead produce a shared library called
|
||||||
is set in addition, the name of the generated libraries will be changed to
|
``liblammps.so`` (or ``liblammps.dylib`` or ``liblammps.dll`` depending
|
||||||
either ``liblammps_name.a`` or ``liblammps_name.so``\ , respectively.
|
on the platform) If ``LAMMPS_MACHINE=name`` is set in addition, the name
|
||||||
|
of the generated libraries will be changed to either
|
||||||
|
``liblammps_name.a`` or ``liblammps_name.so``\ , respectively and the
|
||||||
|
executable will be called ``lmp_name``.
|
||||||
|
|
||||||
**Traditional make**\ :
|
**Traditional make**\ :
|
||||||
|
|
||||||
With the traditional makefile based build process, the choice of
|
With the traditional makefile based build process, the choice of
|
||||||
the generated executable or library depends on the "mode" setting.
|
the generated executable or library depends on the "mode" setting.
|
||||||
Several options are available and ``mode=exe`` is the default.
|
Several options are available and ``mode=static`` is the default.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
make machine # build LAMMPS executable lmp_machine
|
make machine # build LAMMPS executable lmp_machine
|
||||||
make mode=exe machine # same as "make machine"
|
make mode=static machine # same as "make machine"
|
||||||
make mode=lib machine # build LAMMPS static lib liblammps_machine.a
|
make mode=shared machine # build LAMMPS shared lib liblammps_machine.so instead
|
||||||
make mode=shlib machine # build LAMMPS shared lib liblammps_machine.so
|
|
||||||
make mode=shexe machine # same as "mode=exe" but uses objects from "mode=shlib"
|
|
||||||
|
|
||||||
The two "exe" builds will generate and executable ``lmp_machine``\ ,
|
The "static" build will generate a static library called
|
||||||
while the two library builds will create a file ``liblammps_machine.a``
|
``liblammps_machine.a`` and an executable named ``lmp_machine``\ , while
|
||||||
or ``liblammps_machine.so``\ . They will also create generic soft links,
|
the "shared" build will generate a shared library
|
||||||
named ``liblammps.a`` and ``liblammps.so``\ , which point to the specific
|
``liblammps_machine.so`` instead and ``lmp_machine`` will be linked to
|
||||||
|
it. The build step will also create generic soft links, named
|
||||||
|
``liblammps.a`` and ``liblammps.so``\ , which point to the specific
|
||||||
``liblammps_machine.a/so`` files.
|
``liblammps_machine.a/so`` files.
|
||||||
|
|
||||||
**CMake and make info**\ :
|
**CMake and make info**\ :
|
||||||
|
|
||||||
Note that for a shared library to be usable by a calling program, all
|
Note that for creating a shared library, all the libraries it depends on
|
||||||
the auxiliary libraries it depends on must also exist as shared
|
must be compiled to be compatible with shared libraries. This should be
|
||||||
libraries. This will be the case for libraries included with LAMMPS,
|
the case for libraries included with LAMMPS, such as the dummy MPI
|
||||||
such as the dummy MPI library in src/STUBS or any package libraries in
|
library in ``src/STUBS`` or any package libraries in the ``lib``
|
||||||
the lib/packages directory, since they are always built in a shared
|
directory, since they are always built in a shared library compatible
|
||||||
library compatible way using the ``-fPIC`` switch. However, if a library
|
way using the ``-fPIC`` compiler switch. However, if an auxiliary
|
||||||
like MPI or FFTW does not exist as a shared library, the shared library
|
library (like MPI or FFTW) does not exist as a compatible format, the
|
||||||
build may generate an error. This means you will need to install a
|
shared library linking step may generate an error. This means you will
|
||||||
shared library version of the auxiliary library. The build instructions
|
need to install a compatible version of the auxiliary library. The
|
||||||
for the library should tell you how to do this.
|
build instructions for that library should tell you how to do this.
|
||||||
|
|
||||||
As an example, here is how to build and install the `MPICH library
|
As an example, here is how to build and install the `MPICH library
|
||||||
<mpich_>`_, a popular open-source version of MPI, as a shared library
|
<mpich_>`_, a popular open-source version of MPI, as a shared library
|
||||||
@ -360,10 +397,12 @@ in the default /usr/local/lib location:
|
|||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
You may need to use ``sudo make install`` in place of the last line if you
|
You may need to use ``sudo make install`` in place of the last line if
|
||||||
do not have write privileges for ``/usr/local/lib``. The end result should
|
you do not have write privileges for ``/usr/local/lib`` or use the
|
||||||
be the file ``/usr/local/lib/libmpich.so``. On many Linux installations the
|
``--prefix`` configuration option to select an installation folder,
|
||||||
folder ``${HOME}/.local`` is an alternative to using ``/usr/local`` and does
|
where you do have write access. The end result should be the file
|
||||||
|
``/usr/local/lib/libmpich.so``. On many Linux installations the folder
|
||||||
|
``${HOME}/.local`` is an alternative to using ``/usr/local`` and does
|
||||||
not require superuser or sudo access. In that case the configuration
|
not require superuser or sudo access. In that case the configuration
|
||||||
step becomes:
|
step becomes:
|
||||||
|
|
||||||
@ -371,12 +410,41 @@ step becomes:
|
|||||||
|
|
||||||
./configure --enable-shared --prefix=${HOME}/.local
|
./configure --enable-shared --prefix=${HOME}/.local
|
||||||
|
|
||||||
Avoiding using "sudo" for custom software installation (i.e. from source
|
Avoiding to use "sudo" for custom software installation (i.e. from source
|
||||||
and not through a package manager tool provided by the OS) is generally
|
and not through a package manager tool provided by the OS) is generally
|
||||||
recommended to ensure the integrity of the system software installation.
|
recommended to ensure the integrity of the system software installation.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
.. _debug:
|
||||||
|
|
||||||
|
Excluding or removing debug support
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
By default the compilation settings will include the *-g* flag which
|
||||||
|
instructs the compiler to include debug information (e.g. which line of
|
||||||
|
source code a particular instruction correspond to). This can be
|
||||||
|
extremely useful in case LAMMPS crashes and can help to provide crucial
|
||||||
|
information in :doc:`tracking down the origin of a crash <Errors_debug>`
|
||||||
|
and help the LAMMPS developers fix bugs in the source code. However,
|
||||||
|
this increases the storage requirements for object files, libraries, and
|
||||||
|
the executable 3-5 fold.
|
||||||
|
|
||||||
|
If this is a concern, you can change the compilation settings or remove
|
||||||
|
the debug information from the LAMMPS executable:
|
||||||
|
|
||||||
|
- **Traditional make**: edit your ``Makefile.<machine>`` to remove the
|
||||||
|
*-g* flag from the ``CCFLAGS`` and ``LINKFLAGS`` definitions
|
||||||
|
- **CMake**: use ``-D CMAKE_BUILD_TYPE=Release`` or explicitly reset
|
||||||
|
the applicable compiler flags (best done using the text mode or
|
||||||
|
graphical user interface).
|
||||||
|
- **Remove debug info**: If you are only concerned about the executable
|
||||||
|
being too large, you can use the ``strip`` tool (e.g. ``strip
|
||||||
|
lmp_serial``) to remove the debug information from the executable file.
|
||||||
|
Do not strip libraries or object files, as that will render them unusable.
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
.. _doc:
|
.. _doc:
|
||||||
|
|
||||||
Build the LAMMPS documentation
|
Build the LAMMPS documentation
|
||||||
@ -427,7 +495,8 @@ It is also possible to create the HTML version of the manual within
|
|||||||
the :doc:`CMake build directory <Build_cmake>`. The reason for this
|
the :doc:`CMake build directory <Build_cmake>`. The reason for this
|
||||||
option is to include the installation of the HTML manual pages into
|
option is to include the installation of the HTML manual pages into
|
||||||
the "install" step when installing LAMMPS after the CMake build via
|
the "install" step when installing LAMMPS after the CMake build via
|
||||||
``make install``.
|
``make install``. The documentation build is included in the default
|
||||||
|
build target, but can also be requested independently with ``make doc``.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
|||||||
@ -1,205 +1,158 @@
|
|||||||
Build LAMMPS with CMake
|
Build LAMMPS with CMake
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
This page is a short summary of how to use CMake to build LAMMPS.
|
This page describes how to use `CMake <https://cmake.org>`_ in general
|
||||||
Details on CMake variables that enable specific LAMMPS build options
|
to build LAMMPS. Details for specific compile time settings and options
|
||||||
are given on the pages linked to from the :doc:`Build <Build>` doc page.
|
to enable and configure add-on packages are discussed with those
|
||||||
|
packages. Links to those pages on the :doc:`Build overview <Build>`
|
||||||
|
page.
|
||||||
|
|
||||||
Richard Berger (Temple U) has also written a `more comprehensive guide <https://github.com/lammps/lammps/blob/master/cmake/README.md>`_
|
The following text assumes some familiarity with CMake and focuses on
|
||||||
for how to use CMake to build LAMMPS. If you are new to CMake it is a
|
using the command line tool ``cmake`` and what settings are supported
|
||||||
good place to start.
|
for building LAMMPS. A more detailed tutorial on how to use ``cmake``
|
||||||
|
itself, the text mode or graphical user interface, change the generated
|
||||||
|
output files for different build tools and development environments is
|
||||||
|
on a :doc:`separate page <Howto_cmake>`.
|
||||||
|
|
||||||
----------
|
.. note::
|
||||||
|
|
||||||
|
LAMMPS currently requires that CMake version 3.10 or later is available;
|
||||||
|
version 3.12 or later is preferred.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
You must not mix the :doc:`traditional make based <Build_make>`
|
||||||
|
LAMMPS build procedure with using CMake. Thus no packages may be
|
||||||
|
installed or a build been previously attempted in the LAMMPS source
|
||||||
|
directory by using ``make <machine>``. CMake will detect if this is
|
||||||
|
the case and generate an error. To remove conflicting files from the
|
||||||
|
``src`` you can use the command ``make no-all purge`` which will
|
||||||
|
un-install all packages and delete all auto-generated files.
|
||||||
|
|
||||||
|
|
||||||
|
Advantages of using CMake
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
CMake is an alternative to compiling LAMMPS in the traditional way
|
||||||
|
through :doc:`(manually customized) makefiles <Build_make>` and a recent
|
||||||
|
addition to LAMMPS thanks to the efforts of Christoph Junghans (LANL)
|
||||||
|
and Richard Berger (Temple U). Using CMake has multiple advantages that
|
||||||
|
are specifically helpful for people with limited experience in compiling
|
||||||
|
software or for people that want to modify or extend LAMMPS.
|
||||||
|
|
||||||
|
- CMake can detect available hardware, tools, features, and libraries
|
||||||
|
and adapt the LAMMPS default build configuration accordingly.
|
||||||
|
- CMake can generate files for different build tools and integrated
|
||||||
|
development environments (IDE).
|
||||||
|
- CMake supports customization of settings with a text mode or graphical
|
||||||
|
user interface. No knowledge of file formats or and complex command
|
||||||
|
line syntax required.
|
||||||
|
- All enabled components are compiled in a single build operation.
|
||||||
|
- Automated dependency tracking for all files and configuration options.
|
||||||
|
- Support for true out-of-source compilation. Multiple configurations
|
||||||
|
and settings with different choices of LAMMPS packages, settings, or
|
||||||
|
compilers can be configured and built concurrently from the same
|
||||||
|
source tree.
|
||||||
|
- Simplified packaging of LAMMPS for Linux distributions, environment
|
||||||
|
modules, or automated build tools like `Homebrew <https://brew.sh/>`_.
|
||||||
|
- Integration of automated regression testing (the LAMMPS side for that
|
||||||
|
is still under development).
|
||||||
|
|
||||||
|
.. _cmake_build:
|
||||||
|
|
||||||
|
Getting started
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Building LAMMPS with CMake is a two-step process. First you use CMake
|
Building LAMMPS with CMake is a two-step process. First you use CMake
|
||||||
to create a build environment in a new directory. On Linux systems,
|
to generate a build environment in a new directory. For that purpose
|
||||||
this will be by default based on Unix-style makefiles for use with make.
|
you can use either the command-line utility ``cmake`` (or ``cmake3``),
|
||||||
Then you use the *make* command to build LAMMPS, which uses the created
|
the text-mode UI utility ``ccmake`` (or ``ccmake3``) or the graphical
|
||||||
Makefile(s). Example:
|
utility ``cmake-gui``, or use them interchangeably. The second step is
|
||||||
|
then the compilation and linking of all objects, libraries, and
|
||||||
|
executables. Here is a minimal example using the command line version of
|
||||||
|
CMake to build LAMMPS with no add-on packages enabled and no
|
||||||
|
customization:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
cd lammps # change to the LAMMPS distribution directory
|
cd lammps # change to the LAMMPS distribution directory
|
||||||
mkdir build; cd build # create a new directory (folder) for build
|
mkdir build; cd build # create and use a build directory
|
||||||
cmake [options ...] ../cmake # configuration with (command-line) cmake
|
cmake ../cmake # configuration reading CMake scripts from ../cmake
|
||||||
cmake --build . # compilation (or type "make")
|
cmake --build . # compilation (or type "make")
|
||||||
|
|
||||||
The ``cmake`` command will detect available features, enable selected
|
This will create and change into a folder called ``build``, then run the
|
||||||
packages and options, and will generate the build environment. By default
|
configuration step to generate build files for the default build command
|
||||||
this build environment will be created for "Unix Makefiles" on most
|
and then launch that build command to compile LAMMPS. During the
|
||||||
platforms and particularly on Linux. However, alternate build tools
|
configuration step CMake will try to detect whether support for MPI,
|
||||||
(e.g. Ninja) and project files for Integrated Development Environments
|
OpenMP, FFTW, gzip, JPEG, PNG, and ffmpeg are available and enable the
|
||||||
(IDEs) like Eclipse, CodeBlocks, or Kate can be generated, too. This is
|
corresponding configuration settings. The progress of this
|
||||||
selected via the ``-G`` command line flag. Further details about features
|
configuration can be followed on the screen and a summary of selected
|
||||||
and settings for CMake are in the `CMake online documentation <cmake_doc_>`_
|
options and settings will be printed at the end. The ``cmake --build
|
||||||
|
.`` command will launch the compilation, which, if successful, will
|
||||||
|
ultimately produce a library ``liblammps.a`` and the LAMMPS executable
|
||||||
|
``lmp`` inside the ``build`` folder.
|
||||||
|
|
||||||
.. _cmake_doc: https://cmake.org/documentation/
|
Compilation can take a long time, since LAMMPS is a large project with
|
||||||
|
many features. If your machine has multiple CPU cores (most do these
|
||||||
|
days), you can speed this up by compiling sources in parallel with
|
||||||
|
``make -j N`` (with N being the maximum number of concurrently executed
|
||||||
|
tasks). Also installation of the `ccache <https://ccache.dev/>`_ (=
|
||||||
|
Compiler Cache) software may speed up repeated compilation even more,
|
||||||
|
e.g. during code development.
|
||||||
|
|
||||||
For the rest of the documentation
|
After the initial build, whenever you edit LAMMPS source files, enable
|
||||||
we will assume that the build environment is generated for "Unix Makefiles"
|
or disable packages, change compiler flags or build options, you must
|
||||||
and thus the ``make`` command will be used to compile and link LAMMPS as
|
re-compile and relink the LAMMPS executable with ``cmake --build .`` (or
|
||||||
indicated above, producing (by default) an executable called ``lmp`` and
|
``make``). If the compilation fails for some reason, try running
|
||||||
a library called ``liblammps.a`` in the ``build`` folder.
|
``cmake .`` and then compile again. The included dependency tracking
|
||||||
|
should make certain that only the necessary subset of files are
|
||||||
If your machine has multiple CPU cores (most do these days), you can
|
re-compiled. You can also delete compiled objects, libraries and
|
||||||
compile sources in parallel with a command like ``make -j N`` (with N
|
executables with ``cmake --build . clean`` (or ``make clean``).
|
||||||
being the maximum number of concurrently executed tasks). Also
|
|
||||||
installation of the ``ccache`` (= Compiler Cache) software may speed
|
|
||||||
up repeated compilation, e.g. during code development, significantly.
|
|
||||||
|
|
||||||
After compilation, you may optionally install the LAMMPS executable into
|
After compilation, you may optionally install the LAMMPS executable into
|
||||||
your system with:
|
your system with:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
make install # optional, copy LAMMPS executable & library elsewhere
|
make install # optional, copy compiled files into installation location
|
||||||
|
|
||||||
This will install the lammps executable and library (if requested), some
|
This will install the LAMMPS executable and library, some tools (if
|
||||||
tools (if configured) and additional files like library API headers,
|
configured) and additional files like LAMMPS API headers, manpages,
|
||||||
manpages, potential and force field files. The location of the installation
|
potential and force field files. The location of the installation tree
|
||||||
tree is set by the CMake variable "CMAKE_INSTALL_PREFIX" which defaults
|
defaults to ``${HOME}/.local``.
|
||||||
to ${HOME}/.local
|
|
||||||
|
|
||||||
----------
|
.. _cmake_options:
|
||||||
|
|
||||||
.. _cmake_build:
|
Configuration and build options
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
There are 3 variants of the CMake command itself: a command-line version
|
The CMake commands have one mandatory argument: a folder containing a
|
||||||
(``cmake`` or ``cmake3``), a text mode UI version (``ccmake`` or ``ccmake3``),
|
file called ``CMakeLists.txt`` (for LAMMPS it is located in the
|
||||||
and a graphical GUI version (``cmake-gui``). You can use any of them
|
``cmake`` folder) or a build folder containing a file called
|
||||||
interchangeably to configure and create the LAMMPS build environment.
|
``CMakeCache.txt``, which is generated at the end of the CMake
|
||||||
On Linux all the versions produce a Makefile as their output by default.
|
configuration step. The cache file contains all current CMake settings.
|
||||||
See more details on each below.
|
|
||||||
|
|
||||||
You can specify a variety of options with any of the 3 versions, which
|
To modify settings, enable or disable features, you need to set *variables*
|
||||||
affect how the build is performed and what is included in the LAMMPS
|
with either the *-D* command line flag (``-D VARIABLE1_NAME=value``) or
|
||||||
executable. Links to pages explaining all the options are listed on
|
change them in the text mode of graphical user interface. The *-D* flag
|
||||||
the :doc:`Build <Build>` doc page.
|
can be used several times in one command.
|
||||||
|
|
||||||
You must perform the CMake build system generation and compilation in
|
For your convenience we provide :ref:`CMake presets <cmake_presets>`
|
||||||
a new directory you create. It can be anywhere on your local machine.
|
that combine multiple settings to enable optional LAMMPS packages or use
|
||||||
In these Build pages we assume that you are building in a directory
|
a different compiler tool chain. Those are loaded with the *-C* flag
|
||||||
called ``lammps/build``. You can perform separate builds independently
|
(``-C ../cmake/presets/minimal.cmake``). This step would only be needed
|
||||||
with different options, so long as you perform each of them in a
|
once, as the settings from the preset files are stored in the
|
||||||
separate directory you create. All the auxiliary files created by one
|
``CMakeCache.txt`` file. It is also possible to customize the build
|
||||||
build process (executable, object files, log files, etc) are stored in
|
by adding one or more *-D* flags to the CMake command line.
|
||||||
this directory or sub-directories within it that CMake creates.
|
|
||||||
|
|
||||||
.. note::
|
Generating files for alternate build tools (e.g. Ninja) and project files
|
||||||
|
for IDEs like Eclipse, CodeBlocks, or Kate can be selected using the *-G*
|
||||||
|
command line flag. A list of available generator settings for your
|
||||||
|
specific CMake version is given when running ``cmake --help``.
|
||||||
|
|
||||||
To perform a CMake build, no packages can be installed or a build
|
|
||||||
been previously attempted in the LAMMPS src directory by using ``make``
|
|
||||||
commands to :doc:`perform a conventional LAMMPS build <Build_make>`.
|
|
||||||
CMake detects if this is the case and generates an error, telling you
|
|
||||||
to type ``make no-all purge`` in the src directory to un-install all
|
|
||||||
packages. The purge removes all the \*.h files auto-generated by
|
|
||||||
make.
|
|
||||||
|
|
||||||
You must have CMake version 3.10 or later on your system to build
|
Installing CMake
|
||||||
LAMMPS. Installation instructions for CMake are below.
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
After the initial build, if you edit LAMMPS source files, or add your
|
|
||||||
own new files to the source directory, you can just re-type make from
|
|
||||||
your build directory and it will re-compile only the files that have
|
|
||||||
changed. If you want to change CMake options you can run cmake (or
|
|
||||||
ccmake or cmake-gui) again from the same build directory and alter
|
|
||||||
various options; see details below. Or you can remove the entire build
|
|
||||||
folder, recreate the directory and start over.
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
**Command-line version of CMake**\ :
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
cmake [options ...] /path/to/lammps/cmake # build from any dir
|
|
||||||
cmake [options ...] ../cmake # build from lammps/build
|
|
||||||
cmake3 [options ...] ../cmake # build from lammps/build
|
|
||||||
|
|
||||||
The cmake command takes one required argument, which is the LAMMPS
|
|
||||||
cmake directory which contains the CMakeLists.txt file.
|
|
||||||
|
|
||||||
The argument can be prefixed or followed by various CMake
|
|
||||||
command-line options. Several useful ones are:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
-D CMAKE_INSTALL_PREFIX=path # where to install LAMMPS executable/lib if desired
|
|
||||||
-D CMAKE_BUILD_TYPE=type # type = RelWithDebInfo (default), Release, MinSizeRel, or Debug
|
|
||||||
-G output # style of output CMake generates (e.g. "Unix Makefiles" or "Ninja")
|
|
||||||
-D CMAKE_MAKE_PROGRAM=builder # name of the builder executable (e.g. when using "gmake" instead of "make")
|
|
||||||
-DVARIABLE=value # setting for a LAMMPS feature to enable
|
|
||||||
-D VARIABLE=value # ditto, but cannot come after CMakeLists.txt dir
|
|
||||||
-C path/to/preset/file # load some CMake settings before configuring
|
|
||||||
|
|
||||||
All the LAMMPS-specific -D variables that a LAMMPS build supports are
|
|
||||||
described on the pages linked to from the :doc:`Build <Build>` doc page.
|
|
||||||
All of these variable names are upper-case and their values are
|
|
||||||
lower-case, e.g. -D LAMMPS_SIZES=smallbig. For boolean values, any of
|
|
||||||
these forms can be used: yes/no, on/off, 1/0.
|
|
||||||
|
|
||||||
On Unix/Linux machines, CMake generates a Makefile by default to
|
|
||||||
perform the LAMMPS build. Alternate forms of build info can be
|
|
||||||
generated via the -G switch, e.g. Visual Studio on a Windows machine,
|
|
||||||
Xcode on MacOS, or KDevelop on Linux. Type ``cmake --help`` to see the
|
|
||||||
"Generator" styles of output your system supports.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
When CMake runs, it prints configuration info to the screen.
|
|
||||||
You should review this to verify all the features you requested were
|
|
||||||
enabled, including packages. You can also see what compilers and
|
|
||||||
compile options will be used for the build. Any errors in CMake
|
|
||||||
variable syntax will also be flagged, e.g. mis-typed variable names or
|
|
||||||
variable values.
|
|
||||||
|
|
||||||
CMake creates a CMakeCache.txt file when it runs. This stores all the
|
|
||||||
settings, so that when running CMake again you can use the current
|
|
||||||
folder '.' instead of the path to the LAMMPS cmake folder as the
|
|
||||||
required argument to the CMake command. Either way the existing
|
|
||||||
settings will be inherited unless the CMakeCache.txt file is removed.
|
|
||||||
|
|
||||||
If you later want to change a setting you can rerun cmake in the build
|
|
||||||
directory with different setting. Please note that some automatically
|
|
||||||
detected variables will not change their value when you rerun cmake.
|
|
||||||
In these cases it is usually better to first remove all the
|
|
||||||
files/directories in the build directory, or start with a fresh build
|
|
||||||
directory.
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
**Curses version (terminal-style menu) of CMake**\ :
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
ccmake ../cmake
|
|
||||||
|
|
||||||
You initiate the configuration and build environment generation steps
|
|
||||||
separately. For the first you have to type **c**\ , for the second you
|
|
||||||
have to type **g**\ . You may need to type **c** multiple times, and may be
|
|
||||||
required to edit some of the entries of CMake configuration variables
|
|
||||||
in between. Please see the `ccmake manual <https://cmake.org/cmake/help/latest/manual/ccmake.1.html>`_ for
|
|
||||||
more information.
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
**GUI version of CMake**\ :
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
cmake-gui ../cmake
|
|
||||||
|
|
||||||
You initiate the configuration and build environment generation steps
|
|
||||||
separately. For the first you have to click on the **Configure** button,
|
|
||||||
for the second you have to click on the **Generate** button. You may
|
|
||||||
need to click on **Configure** multiple times, and may be required to
|
|
||||||
edit some of the entries of CMake configuration variables in between.
|
|
||||||
Please see the `cmake-gui manual <https://cmake.org/cmake/help/latest/manual/cmake-gui.1.html>`_
|
|
||||||
for more information.
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
**Installing CMake**
|
|
||||||
|
|
||||||
Check if your machine already has CMake installed:
|
Check if your machine already has CMake installed:
|
||||||
|
|
||||||
@ -216,11 +169,12 @@ software packages, do this:
|
|||||||
|
|
||||||
module list # is a module for cmake already loaded?
|
module list # is a module for cmake already loaded?
|
||||||
module avail # is a module for cmake available?
|
module avail # is a module for cmake available?
|
||||||
module load cmake3 # load cmake module with appropriate name
|
module load cmake # load cmake module with appropriate name
|
||||||
|
|
||||||
Most Linux distributions offer pre-compiled cmake packages through
|
Most Linux distributions offer pre-compiled cmake packages through their
|
||||||
their package management system. If you do not have CMake or a new
|
package management system. If you do not have CMake or a recent enough
|
||||||
enough version, you can download the latest version at
|
version (Note: for CentOS 7.x you need to enable the EPEL repository),
|
||||||
`https://cmake.org/download/ <https://cmake.org/download/>`_.
|
you can download the latest version from `https://cmake.org/download/
|
||||||
Instructions on how to install it on various platforms can be found
|
<https://cmake.org/download/>`_. Instructions on how to install it on
|
||||||
`on this page <https://cmake.org/install/>`_.
|
various platforms can be found `on this page
|
||||||
|
<https://cmake.org/install/>`_.
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
Development build options (CMake only)
|
Development build options (CMake only)
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
The CMake build of LAMMPS has a few extra options which are useful during
|
The CMake build procedure of LAMMPS offers a few extra options which are
|
||||||
development, testing or debugging.
|
useful during development, testing or debugging.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
.. _compilation:
|
.. _compilation:
|
||||||
|
|
||||||
Verify compilation flags
|
Verify compilation flags
|
||||||
------------------------------------------
|
------------------------
|
||||||
|
|
||||||
Sometimes it is necessary to verify the complete sequence of compilation flags
|
Sometimes it is necessary to verify the complete sequence of compilation flags
|
||||||
generated by the CMake build. To enable a more verbose output during
|
generated by the CMake build. To enable a more verbose output during
|
||||||
@ -30,7 +30,7 @@ Another way of doing this without reconfiguration is calling make with variable
|
|||||||
.. _sanitizer:
|
.. _sanitizer:
|
||||||
|
|
||||||
Address, Undefined Behavior, and Thread Sanitizer Support
|
Address, Undefined Behavior, and Thread Sanitizer Support
|
||||||
-------------------------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
Compilers such as GCC and Clang support generating instrumented binaries
|
Compilers such as GCC and Clang support generating instrumented binaries
|
||||||
which use different sanitizer libraries to detect problems in code
|
which use different sanitizer libraries to detect problems in code
|
||||||
@ -41,10 +41,11 @@ during run-time. They can detect issues like:
|
|||||||
- `data races <https://clang.llvm.org/docs/ThreadSanitizer.html>`_
|
- `data races <https://clang.llvm.org/docs/ThreadSanitizer.html>`_
|
||||||
|
|
||||||
Please note that this kind of instrumentation usually comes with a small
|
Please note that this kind of instrumentation usually comes with a small
|
||||||
performance hit (much less than using tools like `Valgrind <valgrind_>`_).
|
performance hit (much less than using tools like `Valgrind
|
||||||
The to enable these features additional compiler flags need to be added
|
<https://valgrind.org>`_). The to enable these features additional
|
||||||
to the compilation and linking stages. This is most easily done through
|
compiler flags need to be added to the compilation and linking stages.
|
||||||
setting the ``CMAKE_TUNE_FLAGS`` variable during configuration. Examples:
|
This is most easily done through setting the ``CMAKE_TUNE_FLAGS``
|
||||||
|
variable during configuration. Examples:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -52,8 +53,6 @@ setting the ``CMAKE_TUNE_FLAGS`` variable during configuration. Examples:
|
|||||||
-D CMAKE_TUNE_FLAGS=-fsanitize=undefined # enable undefined behavior sanitizer
|
-D CMAKE_TUNE_FLAGS=-fsanitize=undefined # enable undefined behavior sanitizer
|
||||||
-D CMAKE_TUNE_FLAGS=-fsanitize=thread # enable thread sanitizer
|
-D CMAKE_TUNE_FLAGS=-fsanitize=thread # enable thread sanitizer
|
||||||
|
|
||||||
.. _valgrind: https://valgrind.org
|
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
.. _testing:
|
.. _testing:
|
||||||
@ -75,24 +74,26 @@ developers can run the tests directly on their workstation.
|
|||||||
-D LAMMPS_TESTING_SOURCE_DIR=path # path to lammps-testing repository (option if in custom location)
|
-D LAMMPS_TESTING_SOURCE_DIR=path # path to lammps-testing repository (option if in custom location)
|
||||||
-D LAMMPS_TESTING_GIT_TAG=value # version of lammps-testing repository that should be used, value = master (default) or custom git commit or tag
|
-D LAMMPS_TESTING_GIT_TAG=value # version of lammps-testing repository that should be used, value = master (default) or custom git commit or tag
|
||||||
|
|
||||||
If you enable testing in the CMake build it will create an additional target called "test". You can run them with:
|
If you enable testing in the CMake build it will create an additional
|
||||||
|
target called "test". You can run them with:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
make test
|
cmake --build . test
|
||||||
|
|
||||||
The test cases used come from the lammps-testing repository. They are
|
The test cases used come from the lammps-testing repository. They are
|
||||||
derivatives of the examples folder with some modifications to make the run
|
derivatives of the examples folder with some modifications to make the
|
||||||
faster.
|
run faster.
|
||||||
|
|
||||||
You can also collect code coverage metrics while running the tests by enabling
|
You can also collect code coverage metrics while running the tests by
|
||||||
coverage support during building.
|
enabling coverage support during building.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D ENABLE_COVERAGE=value # enable coverage measurements, value = no (default) or yes
|
-D ENABLE_COVERAGE=value # enable coverage measurements, value = no (default) or yes
|
||||||
|
|
||||||
This will also add the following targets to generate coverage reports after running the LAMMPS executable:
|
This will also add the following targets to generate coverage reports
|
||||||
|
after running the LAMMPS executable:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -100,7 +101,8 @@ This will also add the following targets to generate coverage reports after runn
|
|||||||
make gen_coverage_html # generate coverage report in HTML format
|
make gen_coverage_html # generate coverage report in HTML format
|
||||||
make gen_coverage_xml # generate coverage report in XML format
|
make gen_coverage_xml # generate coverage report in XML format
|
||||||
|
|
||||||
These reports require GCOVR to be installed. The easiest way to do this to install it via pip:
|
These reports require GCOVR to be installed. The easiest way to do this
|
||||||
|
to install it via pip:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
|||||||
@ -87,13 +87,14 @@ GPU package
|
|||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
To build with this package, you must choose options for precision and
|
To build with this package, you must choose options for precision and
|
||||||
which GPU hardware to build for.
|
which GPU hardware to build for. The GPU package currently supports
|
||||||
|
three different types of backends: OpenCL, CUDA and HIP.
|
||||||
|
|
||||||
**CMake build**\ :
|
**CMake build**\ :
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D GPU_API=value # value = opencl (default) or cuda
|
-D GPU_API=value # value = opencl (default) or cuda or hip
|
||||||
-D GPU_PREC=value # precision setting
|
-D GPU_PREC=value # precision setting
|
||||||
# value = double or mixed (default) or single
|
# value = double or mixed (default) or single
|
||||||
-D OCL_TUNE=value # hardware choice for GPU_API=opencl
|
-D OCL_TUNE=value # hardware choice for GPU_API=opencl
|
||||||
@ -101,13 +102,18 @@ which GPU hardware to build for.
|
|||||||
-D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda
|
-D GPU_ARCH=value # primary GPU hardware choice for GPU_API=cuda
|
||||||
# value = sm_XX, see below
|
# value = sm_XX, see below
|
||||||
# default is sm_30
|
# default is sm_30
|
||||||
|
-D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip
|
||||||
|
# value depends on selected HIP_PLATFORM
|
||||||
|
# default is 'gfx906' for HIP_PLATFORM=hcc and 'sm_30' for HIP_PLATFORM=nvcc
|
||||||
|
-D HIP_USE_DEVICE_SORT=value # enables GPU sorting
|
||||||
|
# value = yes (default) or no
|
||||||
-D CUDPP_OPT=value # optimization setting for GPU_API=cuda
|
-D CUDPP_OPT=value # optimization setting for GPU_API=cuda
|
||||||
# enables CUDA Performance Primitives Optimizations
|
# enables CUDA Performance Primitives Optimizations
|
||||||
# value = yes (default) or no
|
# value = yes (default) or no
|
||||||
-D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active nvidia-cuda-mps daemon
|
-D CUDA_MPS_SUPPORT=value # enables some tweaks required to run with active nvidia-cuda-mps daemon
|
||||||
# value = yes or no (default)
|
# value = yes or no (default)
|
||||||
|
|
||||||
GPU_ARCH settings for different GPU hardware is as follows:
|
:code:`GPU_ARCH` settings for different GPU hardware is as follows:
|
||||||
|
|
||||||
* sm_12 or sm_13 for GT200 (supported by CUDA 3.2 until CUDA 6.5)
|
* sm_12 or sm_13 for GT200 (supported by CUDA 3.2 until CUDA 6.5)
|
||||||
* sm_20 or sm_21 for Fermi (supported by CUDA 3.2 until CUDA 7.5)
|
* sm_20 or sm_21 for Fermi (supported by CUDA 3.2 until CUDA 7.5)
|
||||||
@ -126,6 +132,28 @@ Thus the GPU_ARCH setting is merely an optimization, to have code for
|
|||||||
the preferred GPU architecture directly included rather than having to wait
|
the preferred GPU architecture directly included rather than having to wait
|
||||||
for the JIT compiler of the CUDA driver to translate it.
|
for the JIT compiler of the CUDA driver to translate it.
|
||||||
|
|
||||||
|
If you are compiling with HIP, note that before running CMake you will have to
|
||||||
|
set appropriate environment variables. Some variables such as
|
||||||
|
:code:`HCC_AMDGPU_TARGET` or :code:`CUDA_PATH` are necessary for :code:`hipcc`
|
||||||
|
and the linker to work correctly.
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
# AMDGPU target
|
||||||
|
export HIP_PLATFORM=hcc
|
||||||
|
export HCC_AMDGPU_TARGET=gfx906
|
||||||
|
cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc ..
|
||||||
|
make -j 4
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
# CUDA target
|
||||||
|
# !!! DO NOT set CMAKE_CXX_COMPILER !!!
|
||||||
|
export HIP_PLATFORM=nvcc
|
||||||
|
export CUDA_PATH=/usr/local/cuda
|
||||||
|
cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=sm_70 ..
|
||||||
|
make -j 4
|
||||||
|
|
||||||
**Traditional make**\ :
|
**Traditional make**\ :
|
||||||
|
|
||||||
Before building LAMMPS, you must build the GPU library in ``lib/gpu``\ .
|
Before building LAMMPS, you must build the GPU library in ``lib/gpu``\ .
|
||||||
@ -190,12 +218,26 @@ KIM package
|
|||||||
|
|
||||||
To build with this package, the KIM library with API v2 must be downloaded
|
To build with this package, the KIM library with API v2 must be downloaded
|
||||||
and built on your system. It must include the KIM models that you want to
|
and built on your system. It must include the KIM models that you want to
|
||||||
use with LAMMPS. If you want to use the :doc:`kim_query <kim_commands>`
|
use with LAMMPS.
|
||||||
|
|
||||||
|
If you would like to use the :doc:`kim_query <kim_commands>`
|
||||||
command, you also need to have libcurl installed with the matching
|
command, you also need to have libcurl installed with the matching
|
||||||
development headers and the curl-config tool.
|
development headers and the curl-config tool.
|
||||||
|
|
||||||
See the `Obtaining KIM Models <http://openkim.org/doc/usage/obtaining-models>`_
|
If you would like to use the :doc:`kim_property <kim_commands>`
|
||||||
web page to
|
command, you need to build LAMMPS with the Python 3.6 or later package
|
||||||
|
installed. See the :doc:`Python <python>` doc page for more info on building
|
||||||
|
LAMMPS with the version of Python on your system.
|
||||||
|
After successfully building LAMMPS with Python, you need to
|
||||||
|
install the kim-property Python package, which can be easily done using
|
||||||
|
*pip* as ``pip install kim-property``, or from the *conda-forge* channel as
|
||||||
|
``conda install kim-property`` if LAMMPS is built in Conda. More detailed
|
||||||
|
information is available at:
|
||||||
|
`kim-property installation <https://github.com/openkim/kim-property#installing-kim-property>`_.
|
||||||
|
|
||||||
|
In addition to installing the KIM API, it is also necessary to install the
|
||||||
|
library of KIM models (interatomic potentials).
|
||||||
|
See `Obtaining KIM Models <http://openkim.org/doc/usage/obtaining-models>`_ to
|
||||||
learn how to install a pre-build binary of the OpenKIM Repository of Models.
|
learn how to install a pre-build binary of the OpenKIM Repository of Models.
|
||||||
See the list of all KIM models here: https://openkim.org/browse/models
|
See the list of all KIM models here: https://openkim.org/browse/models
|
||||||
|
|
||||||
@ -265,95 +307,209 @@ using. For example:
|
|||||||
.. _kokkos:
|
.. _kokkos:
|
||||||
|
|
||||||
KOKKOS package
|
KOKKOS package
|
||||||
---------------------------
|
--------------
|
||||||
|
|
||||||
To build with this package, you must choose which hardware you want to
|
Using the KOKKOS package requires choosing several settings. You have
|
||||||
build for, either CPUs (multi-threading via OpenMP) or KNLs (OpenMP)
|
to select whether you want to compile with parallelization on the host
|
||||||
or GPUs (NVIDIA Cuda).
|
and whether you want to include offloading of calculations to a device
|
||||||
|
(e.g. a GPU). The default setting is to have no host parallelization
|
||||||
|
and no device offloading. In addition, you can select the hardware
|
||||||
|
architecture to select the instruction set. Since most hardware is
|
||||||
|
backward compatible, you may choose settings for an older architecture
|
||||||
|
to have an executable that will run on this and newer architectures.
|
||||||
|
|
||||||
For a CMake or make build, these are the possible choices for the
|
.. note::
|
||||||
``KOKKOS_ARCH`` settings described below. Note that for CMake, these are
|
|
||||||
really Kokkos variables, not LAMMPS variables. Hence you must use
|
|
||||||
case-sensitive values, e.g. BDW, not bdw.
|
|
||||||
|
|
||||||
* AMDAVX = AMD 64-bit x86 CPUs
|
If you run Kokkos on a different GPU architecture than what LAMMPS
|
||||||
* EPYC = AMD EPYC Zen class CPUs
|
was compiled with, there will be a delay during device initialization
|
||||||
* ARMv80 = ARMv8.0 Compatible CPU
|
while the just-in-time compiler is recompiling all GPU kernels for
|
||||||
* ARMv81 = ARMv8.1 Compatible CPU
|
the new hardware. This is, however, only supported for GPUs of the
|
||||||
* ARMv8-ThunderX = ARMv8 Cavium ThunderX CPU
|
**same** major hardware version and different minor hardware versions,
|
||||||
* ARMv8-TX2 = ARMv8 Cavium ThunderX2 CPU
|
e.g. 5.0 and 5.2 but not 5.2 and 6.0. LAMMPS will abort with an
|
||||||
* WSM = Intel Westmere CPUs
|
error message indicating a mismatch, if that happens.
|
||||||
* SNB = Intel Sandy/Ivy Bridge CPUs
|
|
||||||
* HSW = Intel Haswell CPUs
|
|
||||||
* BDW = Intel Broadwell Xeon E-class CPUs
|
|
||||||
* SKX = Intel Sky Lake Xeon E-class HPC CPUs (AVX512)
|
|
||||||
* KNC = Intel Knights Corner Xeon Phi
|
|
||||||
* KNL = Intel Knights Landing Xeon Phi
|
|
||||||
* BGQ = IBM Blue Gene/Q CPUs
|
|
||||||
* Power7 = IBM POWER8 CPUs
|
|
||||||
* Power8 = IBM POWER8 CPUs
|
|
||||||
* Power9 = IBM POWER9 CPUs
|
|
||||||
* Kepler = NVIDIA Kepler default (generation CC 3.5)
|
|
||||||
* Kepler30 = NVIDIA Kepler generation CC 3.0
|
|
||||||
* Kepler32 = NVIDIA Kepler generation CC 3.2
|
|
||||||
* Kepler35 = NVIDIA Kepler generation CC 3.5
|
|
||||||
* Kepler37 = NVIDIA Kepler generation CC 3.7
|
|
||||||
* Maxwell = NVIDIA Maxwell default (generation CC 5.0)
|
|
||||||
* Maxwell50 = NVIDIA Maxwell generation CC 5.0
|
|
||||||
* Maxwell52 = NVIDIA Maxwell generation CC 5.2
|
|
||||||
* Maxwell53 = NVIDIA Maxwell generation CC 5.3
|
|
||||||
* Pascal60 = NVIDIA Pascal generation CC 6.0
|
|
||||||
* Pascal61 = NVIDIA Pascal generation CC 6.1
|
|
||||||
* Volta70 = NVIDIA Volta generation CC 7.0
|
|
||||||
* Volta72 = NVIDIA Volta generation CC 7.2
|
|
||||||
* Turing75 = NVIDIA Turing generation CC 7.5
|
|
||||||
|
|
||||||
**CMake build**\ :
|
The settings discussed below have been tested with LAMMPS and are
|
||||||
|
confirmed to work. Kokkos is an active project with ongoing improvements
|
||||||
|
and projects working on including support for additional architectures.
|
||||||
|
More information on Kokkos can be found on the
|
||||||
|
`Kokkos GitHub project <https://github.com/kokkos>`_.
|
||||||
|
|
||||||
|
Available Architecture settings
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
These are the possible choices for the Kokkos architecture ID. They must
|
||||||
|
be specified in uppercase.
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:header-rows: 0
|
||||||
|
:widths: auto
|
||||||
|
|
||||||
|
* - **Arch-ID**
|
||||||
|
- **HOST or GPU**
|
||||||
|
- **Description**
|
||||||
|
* - AMDAVX
|
||||||
|
- HOST
|
||||||
|
- AMD 64-bit x86 CPU (AVX 1)
|
||||||
|
* - EPYC
|
||||||
|
- HOST
|
||||||
|
- AMD EPYC Zen class CPU (AVX 2)
|
||||||
|
* - ARMV80
|
||||||
|
- HOST
|
||||||
|
- ARMv8.0 Compatible CPU
|
||||||
|
* - ARMV81
|
||||||
|
- HOST
|
||||||
|
- ARMv8.1 Compatible CPU
|
||||||
|
* - ARMV8_THUNDERX
|
||||||
|
- HOST
|
||||||
|
- ARMv8 Cavium ThunderX CPU
|
||||||
|
* - ARMV8_THUNDERX2
|
||||||
|
- HOST
|
||||||
|
- ARMv8 Cavium ThunderX2 CPU
|
||||||
|
* - WSM
|
||||||
|
- HOST
|
||||||
|
- Intel Westmere CPU (SSE 4.2)
|
||||||
|
* - SNB
|
||||||
|
- HOST
|
||||||
|
- Intel Sandy/Ivy Bridge CPU (AVX 1)
|
||||||
|
* - HSW
|
||||||
|
- HOST
|
||||||
|
- Intel Haswell CPU (AVX 2)
|
||||||
|
* - BDW
|
||||||
|
- HOST
|
||||||
|
- Intel Broadwell Xeon E-class CPU (AVX 2 + transactional mem)
|
||||||
|
* - SKX
|
||||||
|
- HOST
|
||||||
|
- Intel Sky Lake Xeon E-class HPC CPU (AVX512 + transactional mem)
|
||||||
|
* - KNC
|
||||||
|
- HOST
|
||||||
|
- Intel Knights Corner Xeon Phi
|
||||||
|
* - KNL
|
||||||
|
- HOST
|
||||||
|
- Intel Knights Landing Xeon Phi
|
||||||
|
* - BGQ
|
||||||
|
- HOST
|
||||||
|
- IBM Blue Gene/Q CPU
|
||||||
|
* - POWER7
|
||||||
|
- HOST
|
||||||
|
- IBM POWER7 CPU
|
||||||
|
* - POWER8
|
||||||
|
- HOST
|
||||||
|
- IBM POWER8 CPU
|
||||||
|
* - POWER9
|
||||||
|
- HOST
|
||||||
|
- IBM POWER9 CPU
|
||||||
|
* - KEPLER30
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Kepler generation CC 3.0 GPU
|
||||||
|
* - KEPLER32
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Kepler generation CC 3.2 GPU
|
||||||
|
* - KEPLER35
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Kepler generation CC 3.5 GPU
|
||||||
|
* - KEPLER37
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Kepler generation CC 3.7 GPU
|
||||||
|
* - MAXWELL50
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Maxwell generation CC 5.0 GPU
|
||||||
|
* - MAXWELL52
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Maxwell generation CC 5.2 GPU
|
||||||
|
* - MAXWELL53
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Maxwell generation CC 5.3 GPU
|
||||||
|
* - PASCAL60
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Pascal generation CC 6.0 GPU
|
||||||
|
* - PASCAL61
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Pascal generation CC 6.1 GPU
|
||||||
|
* - VOLTA70
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Volta generation CC 7.0 GPU
|
||||||
|
* - VOLTA72
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Volta generation CC 7.2 GPU
|
||||||
|
* - TURING75
|
||||||
|
- GPU
|
||||||
|
- NVIDIA Turing generation CC 7.5 GPU
|
||||||
|
* - VEGA900
|
||||||
|
- GPU
|
||||||
|
- AMD GPU MI25 GFX900
|
||||||
|
* - VEGA906
|
||||||
|
- GPU
|
||||||
|
- AMD GPU MI50/MI60 GFX906
|
||||||
|
|
||||||
|
Basic CMake build settings:
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
For multicore CPUs using OpenMP, set these 2 variables.
|
For multicore CPUs using OpenMP, set these 2 variables.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D KOKKOS_ARCH=archCPU # archCPU = CPU from list above
|
-D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above
|
||||||
-D KOKKOS_ENABLE_OPENMP=yes
|
-D Kokkos_ENABLE_OPENMP=yes
|
||||||
|
-D BUILD_OMP=yes
|
||||||
|
|
||||||
For Intel KNLs using OpenMP, set these 2 variables:
|
Please note that enabling OpenMP for KOKKOS requires that OpenMP is
|
||||||
|
also :ref:`enabled for the rest of LAMMPS <serial>`.
|
||||||
|
|
||||||
|
For Intel KNLs using OpenMP, set these variables:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D KOKKOS_ARCH=KNL
|
-D Kokkos_ARCH_KNL=yes
|
||||||
-D KOKKOS_ENABLE_OPENMP=yes
|
-D Kokkos_ENABLE_OPENMP=yes
|
||||||
|
|
||||||
For NVIDIA GPUs using CUDA, set these 4 variables:
|
For NVIDIA GPUs using CUDA, set these variables:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D KOKKOS_ARCH="archCPU;archGPU" # archCPU = CPU from list above that is hosting the GPU
|
-D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above
|
||||||
# archGPU = GPU from list above
|
-D Kokkos_ARCH_GPUARCH=yes # GPUARCH = GPU from list above
|
||||||
-D KOKKOS_ENABLE_CUDA=yes
|
-D Kokkos_ENABLE_CUDA=yes
|
||||||
-D KOKKOS_ENABLE_OPENMP=yes
|
-D Kokkos_ENABLE_OPENMP=yes
|
||||||
-D CMAKE_CXX_COMPILER=wrapper # wrapper = full path to Cuda nvcc wrapper
|
-D CMAKE_CXX_COMPILER=wrapper # wrapper = full path to Cuda nvcc wrapper
|
||||||
|
|
||||||
The wrapper value is the Cuda nvcc compiler wrapper provided in the
|
This will also enable executing FFTs on the GPU, either via the internal
|
||||||
Kokkos library: ``lib/kokkos/bin/nvcc_wrapper``\ . The setting should
|
KISSFFT library, or - by preference - with the cuFFT library bundled
|
||||||
include the full path name to the wrapper, e.g.
|
with the CUDA toolkit, depending on whether CMake can identify its
|
||||||
|
location. The *wrapper* value for ``CMAKE_CXX_COMPILER`` variable is
|
||||||
|
the path to the CUDA nvcc compiler wrapper provided in the Kokkos
|
||||||
|
library: ``lib/kokkos/bin/nvcc_wrapper``\ . The setting should include
|
||||||
|
the full path name to the wrapper, e.g.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D CMAKE_CXX_COMPILER=/home/username/lammps/lib/kokkos/bin/nvcc_wrapper
|
-D CMAKE_CXX_COMPILER=${HOME}/lammps/lib/kokkos/bin/nvcc_wrapper
|
||||||
|
|
||||||
**Traditional make**\ :
|
To simplify the compilation, three preset files are included in the
|
||||||
|
``cmake/presets`` folder, ``kokkos-serial.cmake``, ``kokkos-openmp.cmake``,
|
||||||
|
and ``kokkos-cuda.cmake``. They will enable the KOKKOS package and
|
||||||
|
enable some hardware choice. So to compile with OpenMP host parallelization,
|
||||||
|
CUDA device parallelization (for GPUs with CC 5.0 and up) with some
|
||||||
|
common packages enabled, you can do the following:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
mkdir build-kokkos-cuda
|
||||||
|
cd build-kokkos-cuda
|
||||||
|
cmake -C ../cmake/presets/minimal.cmake -C ../cmake/presets/kokkos-cuda.cmake ../cmake
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
Basic traditional make settings:
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Choose which hardware to support in ``Makefile.machine`` via
|
Choose which hardware to support in ``Makefile.machine`` via
|
||||||
``KOKKOS_DEVICES`` and ``KOKKOS_ARCH`` settings. See the
|
``KOKKOS_DEVICES`` and ``KOKKOS_ARCH`` settings. See the
|
||||||
``src/MAKE/OPTIONS/Makefile.kokkos\*`` files for examples.
|
``src/MAKE/OPTIONS/Makefile.kokkos*`` files for examples.
|
||||||
|
|
||||||
For multicore CPUs using OpenMP:
|
For multicore CPUs using OpenMP:
|
||||||
|
|
||||||
.. code-block:: make
|
.. code-block:: make
|
||||||
|
|
||||||
KOKKOS_DEVICES = OpenMP
|
KOKKOS_DEVICES = OpenMP
|
||||||
KOKKOS_ARCH = archCPU # archCPU = CPU from list above
|
KOKKOS_ARCH = HOSTARCH # HOSTARCH = HOST from list above
|
||||||
|
|
||||||
For Intel KNLs using OpenMP:
|
For Intel KNLs using OpenMP:
|
||||||
|
|
||||||
@ -367,23 +523,73 @@ For NVIDIA GPUs using CUDA:
|
|||||||
.. code-block:: make
|
.. code-block:: make
|
||||||
|
|
||||||
KOKKOS_DEVICES = Cuda
|
KOKKOS_DEVICES = Cuda
|
||||||
KOKKOS_ARCH = archCPU,archGPU # archCPU = CPU from list above that is hosting the GPU
|
KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is hosting the GPU
|
||||||
# archGPU = GPU from list above
|
KOKKOS_CUDA_OPTIONS = "enable_lambda"
|
||||||
|
# GPUARCH = GPU from list above
|
||||||
FFT_INC = -DFFT_CUFFT # enable use of cuFFT (optional)
|
FFT_INC = -DFFT_CUFFT # enable use of cuFFT (optional)
|
||||||
FFT_LIB = -lcufft # link to cuFFT library
|
FFT_LIB = -lcufft # link to cuFFT library
|
||||||
|
|
||||||
For GPUs, you also need the following 2 lines in your Makefile.machine
|
For GPUs, you also need the following lines in your ``Makefile.machine``
|
||||||
before the CC line is defined, in this case for use with OpenMPI mpicxx.
|
before the CC line is defined. They tell ``mpicxx`` to use an ``nvcc``
|
||||||
The 2 lines define a nvcc wrapper compiler, which will use nvcc for
|
compiler wrapper, which will use ``nvcc`` for compiling CUDA files and a
|
||||||
compiling CUDA files and use a C++ compiler for non-Kokkos, non-CUDA
|
C++ compiler for non-Kokkos, non-CUDA files.
|
||||||
files.
|
|
||||||
|
|
||||||
.. code-block:: make
|
.. code-block:: make
|
||||||
|
|
||||||
|
# For OpenMPI
|
||||||
KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd)
|
KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd)
|
||||||
export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper
|
export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper
|
||||||
CC = mpicxx
|
CC = mpicxx
|
||||||
|
|
||||||
|
.. code-block:: make
|
||||||
|
|
||||||
|
# For MPICH and derivatives
|
||||||
|
KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd)
|
||||||
|
CC = mpicxx -cxx=$(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper
|
||||||
|
|
||||||
|
|
||||||
|
Advanced KOKKOS compilation settings
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
There are other allowed options when building with the KOKKOS package
|
||||||
|
that can improve performance or assist in debugging or profiling. Below
|
||||||
|
are some examples that may be useful in combination with LAMMPS. For
|
||||||
|
the full list (which keeps changing as the Kokkos package itself evolves),
|
||||||
|
please consult the Kokkos library documentation.
|
||||||
|
|
||||||
|
As alternative to using multi-threading via OpenMP
|
||||||
|
(``-DKokkos_ENABLE_OPENMP=on`` or ``KOKKOS_DEVICES=OpenMP``) it is also
|
||||||
|
possible to use Posix threads directly (``-DKokkos_ENABLE_PTHREAD=on``
|
||||||
|
or ``KOKKOS_DEVICES=Pthread``). While binding of threads to individual
|
||||||
|
or groups of CPU cores is managed in OpenMP with environment variables,
|
||||||
|
you need assistance from either the "hwloc" or "libnuma" library for the
|
||||||
|
Pthread thread parallelization option. To enable use with CMake:
|
||||||
|
``-DKokkos_ENABLE_HWLOC=on`` or ``-DKokkos_ENABLE_LIBNUMA=on``; and with
|
||||||
|
conventional make: ``KOKKOS_USE_TPLS=hwloc`` or
|
||||||
|
``KOKKOS_USE_TPLS=libnuma``.
|
||||||
|
|
||||||
|
The CMake option ``-DKokkos_ENABLE_LIBRT=on`` or the makefile setting
|
||||||
|
``KOKKOS_USE_TPLS=librt`` enables the use of a more accurate timer
|
||||||
|
mechanism on many Unix-like platforms for internal profiling.
|
||||||
|
|
||||||
|
The CMake option ``-DKokkos_ENABLE_DEBUG=on`` or the makefile setting
|
||||||
|
``KOKKOS_DEBUG=yes`` enables printing of run-time
|
||||||
|
debugging information that can be useful. It also enables runtime
|
||||||
|
bounds checking on Kokkos data structures. As to be expected, enabling
|
||||||
|
this option will negatively impact the performance and thus is only
|
||||||
|
recommended when developing a Kokkos-enabled style in LAMMPS.
|
||||||
|
|
||||||
|
The CMake option ``-DKokkos_ENABLE_CUDA_UVM=on`` or the makefile
|
||||||
|
setting ``KOKKOS_CUDA_OPTIONS=enable_lambda,force_uvm`` enables the
|
||||||
|
use of CUDA "Unified Virtual Memory" (UVM) in Kokkos. UVM allows to
|
||||||
|
transparently use RAM on the host to supplement the memory used on the
|
||||||
|
GPU (with some performance penalty) and thus enables running larger
|
||||||
|
problems that would otherwise not fit into the RAM on the GPU.
|
||||||
|
|
||||||
|
Please note, that the LAMMPS KOKKOS package must **always** be compiled
|
||||||
|
with the *enable_lambda* option when using GPUs. The CMake configuration
|
||||||
|
will thus always enable it.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
.. _latte:
|
.. _latte:
|
||||||
|
|||||||
@ -1,33 +1,35 @@
|
|||||||
Link LAMMPS as a library to another code
|
Link LAMMPS as a library to another code
|
||||||
========================================
|
========================================
|
||||||
|
|
||||||
LAMMPS can be used as a library by another application, including
|
LAMMPS is designed as a library of C++ objects and can thus be
|
||||||
Python scripts. The files src/library.cpp and library.h define the
|
integrated into other applications including Python scripts.
|
||||||
|
The files ``src/library.cpp`` and ``src/library.h`` define a
|
||||||
C-style API for using LAMMPS as a library. See the :doc:`Howto
|
C-style API for using LAMMPS as a library. See the :doc:`Howto
|
||||||
library <Howto_library>` doc page for a description of the interface
|
library <Howto_library>` doc page for a description of the interface
|
||||||
and how to extend it for your needs.
|
and how to extend it for your needs.
|
||||||
|
|
||||||
The :doc:`Build basics <Build_basics>` doc page explains how to build
|
The :doc:`Build basics <Build_basics>` doc page explains how to build
|
||||||
LAMMPS as either a shared or static library. This results in one of
|
LAMMPS as either a shared or static library. This results in a file
|
||||||
these 2 files:
|
in the compilation folder called ``liblammps.a`` or ``liblammps_<name>.a``
|
||||||
|
in case of building a static library. In case of a shared library
|
||||||
.. code-block:: bash
|
the name is the same only that the suffix is going to be either ``.so``
|
||||||
|
or ``.dylib`` or ``.dll`` instead of ``.a`` depending on the OS.
|
||||||
liblammps.so # shared library
|
In some cases the ``.so`` file may be a symbolic link to a file with
|
||||||
liblammps.a # static library
|
the suffix ``.so.0`` (or some other number).
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Care should be taken to use the same MPI library for the calling
|
Care should be taken to use the same MPI library for the calling code
|
||||||
code and the LAMMPS library. The library.h file includes mpi.h and
|
and the LAMMPS library. The ``library.h`` file includes ``mpi.h``
|
||||||
uses definitions from it so those need to be available and
|
and uses definitions from it so those need to be available and
|
||||||
consistent. When LAMMPS is compiled with the MPI STUBS library,
|
consistent. When LAMMPS is compiled with the included STUBS MPI
|
||||||
then its mpi.h file needs to be included. While it is technically
|
library, then its ``mpi.h`` file needs to be included. While it is
|
||||||
possible to use a full MPI library in the calling code and link to
|
technically possible to use a full MPI library in the calling code
|
||||||
a serial LAMMPS library compiled with MPI STUBS, it is recommended
|
and link to a serial LAMMPS library compiled with MPI STUBS, it is
|
||||||
to use the *same* MPI library for both, and then use MPI_Comm_split()
|
recommended to use the *same* MPI library for both, and then use
|
||||||
in the calling code to pass a suitable communicator with a subset
|
``MPI_Comm_split()`` in the calling code to pass a suitable
|
||||||
of MPI ranks to the function creating the LAMMPS instance.
|
communicator with a subset of MPI ranks to the function creating the
|
||||||
|
LAMMPS instance.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -42,11 +44,11 @@ executable code from the library is copied into the calling executable.
|
|||||||
|
|
||||||
*CMake build*\ :
|
*CMake build*\ :
|
||||||
|
|
||||||
This assumes that LAMMPS has been configured with "-D BUILD_LIB=yes"
|
This assumes that LAMMPS has been configured without setting a
|
||||||
and installed with "make install" and the PKG_CONFIG_PATH environment
|
``LAMMPS_MACHINE`` name, installed with "make install", and the
|
||||||
variable updated to include the *liblammps.pc* file installed into the
|
``PKG_CONFIG_PATH`` environment variable has been updated to include the
|
||||||
configured destination folder, if needed. The commands to compile and
|
``liblammps.pc`` file installed into the configured destination folder.
|
||||||
link the coupled executable are then:
|
The commands to compile and link a coupled executable are then:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -56,30 +58,35 @@ link the coupled executable are then:
|
|||||||
*Traditional make*\ :
|
*Traditional make*\ :
|
||||||
|
|
||||||
This assumes that LAMMPS has been compiled in the folder
|
This assumes that LAMMPS has been compiled in the folder
|
||||||
"${HOME}/lammps/src" with "make mode=lib mpi". The commands to compile
|
``${HOME}/lammps/src`` with "make mpi". The commands to compile and link
|
||||||
and link the coupled executable are then:
|
a coupled executable are then:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mpicc -c -O -I${HOME}/lammps/src caller.c
|
mpicc -c -O -I${HOME}/lammps/src caller.c
|
||||||
mpicxx -o caller caller.o -L${HOME}/lammps/src -llammps
|
mpicxx -o caller caller.o -L${HOME}/lammps/src -llammps_mpi
|
||||||
|
|
||||||
The *-I* argument is the path to the location of the *library.h*
|
The *-I* argument is the path to the location of the ``library.h``
|
||||||
header file containing the interface to the LAMMPS C-style library
|
header file containing the interface to the LAMMPS C-style library
|
||||||
interface. The *-L* argument is the path to where the *liblammps.a*
|
interface. The *-L* argument is the path to where the ``liblammps_mpi.a``
|
||||||
file is located. The *-llammps* argument is shorthand for telling the
|
file is located. The *-llammps_mpi* argument is shorthand for telling the
|
||||||
compiler to link the file *liblammps.a*\ .
|
compiler to link the file ``liblammps_mpi.a``. If LAMMPS has been
|
||||||
|
built as a shared library, then the linker will use ``liblammps_mpi.so``
|
||||||
|
instead. If both files are available, the linker will usually prefer
|
||||||
|
the shared library. In case of a shared library, you may need to update
|
||||||
|
the ``LD_LIBRARY_PATH`` environment variable or running the ``caller``
|
||||||
|
executable will fail since it cannot find the shared library at runtime.
|
||||||
|
|
||||||
However, it is only as simple as shown above for the case of a plain
|
However, it is only as simple as shown above for the case of a plain
|
||||||
LAMMPS library without any optional packages that depend on libraries
|
LAMMPS library without any optional packages that depend on libraries
|
||||||
(bundled or external). Otherwise, you need to include all flags,
|
(bundled or external) or when using a shared library. Otherwise, you
|
||||||
libraries, and paths for the coupled executable, that are also
|
need to include all flags, libraries, and paths for the coupled
|
||||||
required to link the LAMMPS executable.
|
executable, that are also required to link the LAMMPS executable.
|
||||||
|
|
||||||
*CMake build*\ :
|
*CMake build*\ :
|
||||||
|
|
||||||
When using CMake, additional libraries with sources in the lib folder
|
When using CMake, additional libraries with sources in the lib folder
|
||||||
are built, but not included in liblammps.a and (currently) not
|
are built, but not included in ``liblammps.a`` and (currently) not
|
||||||
installed with "make install" and not included in the *pkgconfig*
|
installed with "make install" and not included in the *pkgconfig*
|
||||||
configuration file. They can be found in the top level build folder,
|
configuration file. They can be found in the top level build folder,
|
||||||
but you have to determine the necessary link flags manually. It is
|
but you have to determine the necessary link flags manually. It is
|
||||||
@ -87,23 +94,26 @@ therefore recommended to either use the traditional make procedure to
|
|||||||
build and link with a static library or build and link with a shared
|
build and link with a static library or build and link with a shared
|
||||||
library instead.
|
library instead.
|
||||||
|
|
||||||
|
.. TODO: this needs to be updated to reflect that latest CMake changes after they are complete.
|
||||||
|
|
||||||
*Traditional make*\ :
|
*Traditional make*\ :
|
||||||
|
|
||||||
After you have compiled a static LAMMPS library using the conventional
|
After you have compiled a static LAMMPS library using the conventional
|
||||||
build system for example with "make mode=lib serial". And you also
|
build system for example with "make mode=static serial". And you also
|
||||||
have installed the POEMS package after building its bundled library in
|
have installed the ``POEMS`` package after building its bundled library
|
||||||
lib/poems. Then the commands to build and link the coupled executable
|
in ``lib/poems``. Then the commands to build and link the coupled executable
|
||||||
change to:
|
change to:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c
|
gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c
|
||||||
g++ -o caller caller.o -L${HOME}/lammps/lib/poems \
|
g++ -o caller caller.o -L${HOME}/lammps/lib/poems \
|
||||||
-L${HOME}/lammps/src/STUBS -L${HOME}/lammps/src -llammps -lpoems -lmpi_stubs
|
-L${HOME}/lammps/src/STUBS -L${HOME}/lammps/src -llammps_serial -lpoems -lmpi_stubs
|
||||||
|
|
||||||
Note, that you need to link with "g++" instead of "gcc", since LAMMPS
|
Note, that you need to link with "g++" instead of "gcc", since the
|
||||||
is C++ code. You can display the currently applied settings for building
|
LAMMPS library is C++ code. You can display the currently applied
|
||||||
LAMMPS for the "serial" machine target by using the command:
|
settings for building LAMMPS for the "serial" machine target by using
|
||||||
|
the command:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -118,11 +128,11 @@ Which should output something like:
|
|||||||
# Linker:
|
# Linker:
|
||||||
LD=g++
|
LD=g++
|
||||||
# Compilation:
|
# Compilation:
|
||||||
CXXFLAGS=-g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I${HOME}/lammps/lib/poems -I${HOME}/lammps/src/STUBS
|
CXXFLAGS=-g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I${HOME}/compile/lammps/lib/poems -I${HOME}/compile/lammps/src/STUBS
|
||||||
# Linking:
|
# Linking:
|
||||||
LDFLAGS=-g -O
|
LDFLAGS=-g -O
|
||||||
# Libraries:
|
# Libraries:
|
||||||
LDLIBS=-L${HOME}/lammps/lib/poems -L${HOME}/lammps/src/STUBS -lpoems -lmpi_stubs
|
LDLIBS=-L${HOME}/compile/lammps/src -llammps_serial -L${HOME}/compile/lammps/lib/poems -L${HOME}/compile/lammps/src/STUBS -lpoems -lmpi_stubs
|
||||||
|
|
||||||
From this you can gather the necessary paths and flags. With
|
From this you can gather the necessary paths and flags. With
|
||||||
makefiles for other *machine* configurations you need to do the
|
makefiles for other *machine* configurations you need to do the
|
||||||
@ -133,14 +143,13 @@ of the makefile.
|
|||||||
|
|
||||||
**Link with LAMMPS as a shared library**\ :
|
**Link with LAMMPS as a shared library**\ :
|
||||||
|
|
||||||
When linking to LAMMPS built as a shared library, the situation
|
When linking to LAMMPS built as a shared library, the situation becomes
|
||||||
becomes much simpler, as all dependent libraries and objects are
|
much simpler, as all dependent libraries and objects are either included
|
||||||
included in the shared library, which is - technically speaking -
|
in the shared library or registered as a dependent library in the shared
|
||||||
effectively a regular LAMMPS executable that is missing the `main()`
|
library file. Thus those libraries need not to be specified when
|
||||||
function. Thus those libraries need not to be specified when linking
|
linking the calling executable. Only the *-I* flags are needed. So the
|
||||||
the calling executable. Only the *-I* flags are needed. So the
|
example case from above of the serial version static LAMMPS library with
|
||||||
example case from above of the serial version static LAMMPS library
|
the POEMS package installed becomes:
|
||||||
with the POEMS package installed becomes:
|
|
||||||
|
|
||||||
*CMake build*\ :
|
*CMake build*\ :
|
||||||
|
|
||||||
@ -155,19 +164,19 @@ build process are the same as for the static library.
|
|||||||
*Traditional make*\ :
|
*Traditional make*\ :
|
||||||
|
|
||||||
The commands with a shared LAMMPS library compiled with the
|
The commands with a shared LAMMPS library compiled with the
|
||||||
traditional make build using "make mode=shlib serial" becomes:
|
traditional make build using "make mode=shared serial" becomes:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c
|
gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c
|
||||||
g++ -o caller caller.o -L${HOME}/lammps/src -llammps
|
g++ -o caller caller.o -L${HOME}/lammps/src -llammps_serial
|
||||||
|
|
||||||
*Locating liblammps.so at runtime*\ :
|
*Locating liblammps.so at runtime*\ :
|
||||||
|
|
||||||
However, now the `liblammps.so` file is required at runtime and needs
|
However, now the ``liblammps.so`` file is required at runtime and needs
|
||||||
to be in a folder, where the shared linker program of the operating
|
to be in a folder, where the shared linker program of the operating
|
||||||
system can find it. This would be either a folder like "/usr/local/lib64"
|
system can find it. This would be either a folder like ``/usr/local/lib64``
|
||||||
or "${HOME}/.local/lib64" or a folder pointed to by the LD_LIBRARY_PATH
|
or ``${HOME}/.local/lib64`` or a folder pointed to by the ``LD_LIBRARY_PATH``
|
||||||
environment variable. You can type
|
environment variable. You can type
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -177,11 +186,11 @@ environment variable. You can type
|
|||||||
to see what directories are in that list.
|
to see what directories are in that list.
|
||||||
|
|
||||||
Or you can add the LAMMPS src directory (or the directory you performed
|
Or you can add the LAMMPS src directory (or the directory you performed
|
||||||
a CMake style build in) to your LD_LIBRARY_PATH, so that the current
|
a CMake style build in) to your ``LD_LIBRARY_PATH``, so that the current
|
||||||
version of the shared library is always available to programs that use it.
|
version of the shared library is always available to programs that use it.
|
||||||
|
|
||||||
For the Bourne or Korn shells (/bin/sh, /bin/ksh, /bin/bash etc.), you
|
For the Bourne or Korn shells (/bin/sh, /bin/ksh, /bin/bash etc.), you
|
||||||
would add something like this to your ~/.profile file:
|
would add something like this to your ``${HOME}/.profile`` file:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -189,14 +198,14 @@ would add something like this to your ~/.profile file:
|
|||||||
export LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
For the csh or tcsh shells, you would equivalently add something like this
|
For the csh or tcsh shells, you would equivalently add something like this
|
||||||
to your ~/.cshrc file:
|
to your ``${HOME}/.cshrc`` file:
|
||||||
|
|
||||||
.. code-block:: csh
|
.. code-block:: csh
|
||||||
|
|
||||||
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HOME}/lammps/src
|
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HOME}/lammps/src
|
||||||
|
|
||||||
You can verify whether all required shared libraries are found with the
|
You can verify whether all required shared libraries are found with the
|
||||||
`ldd` tool. Example:
|
``ldd`` tool. Example:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -229,20 +238,20 @@ If a required library is missing, you would get a 'not found' entry:
|
|||||||
Either flavor of library (static or shared) allows one or more LAMMPS
|
Either flavor of library (static or shared) allows one or more LAMMPS
|
||||||
objects to be instantiated from the calling program. When used from a
|
objects to be instantiated from the calling program. When used from a
|
||||||
C++ program, most of the symbols and functions in LAMMPS are wrapped
|
C++ program, most of the symbols and functions in LAMMPS are wrapped
|
||||||
in a LAMMPS_NS namespace; you can safely use any of its classes and
|
in a ``LAMMPS_NS`` namespace; you can safely use any of its classes and
|
||||||
methods from within the calling code, as needed, and you will not incur
|
methods from within the calling code, as needed, and you will not incur
|
||||||
conflicts with functions and variables in your code that share the name.
|
conflicts with functions and variables in your code that share the name.
|
||||||
This, however, does not extend to all additional libraries bundled with
|
This, however, does not extend to all additional libraries bundled with
|
||||||
LAMMPS in the lib folder and some of the low-level code of some packages.
|
LAMMPS in the lib folder and some of the low-level code of some packages.
|
||||||
|
|
||||||
To be compatible with C, Fortran, Python programs, the library has a simple
|
To be compatible with C, Fortran, Python programs, the library has a simple
|
||||||
C-style interface, provided in src/library.cpp and src/library.h.
|
C-style interface, provided in ``src/library.cpp`` and ``src/library.h``.
|
||||||
|
|
||||||
See the :doc:`Python library <Python_library>` doc page for a
|
See the :doc:`Python library <Python_library>` doc page for a
|
||||||
description of the Python interface to LAMMPS, which wraps the C-style
|
description of the Python interface to LAMMPS, which wraps the C-style
|
||||||
interface from a shared library through the `ctypes python module <ctypes_>`_.
|
interface from a shared library through the `ctypes python module <ctypes_>`_.
|
||||||
|
|
||||||
See the sample codes in examples/COUPLE/simple for examples of C++ and
|
See the sample codes in ``examples/COUPLE/simple`` for examples of C++ and
|
||||||
C and Fortran codes that invoke LAMMPS through its library interface.
|
C and Fortran codes that invoke LAMMPS through its library interface.
|
||||||
Other examples in the COUPLE directory use coupling ideas discussed on
|
Other examples in the COUPLE directory use coupling ideas discussed on
|
||||||
the :doc:`Howto couple <Howto_couple>` doc page.
|
the :doc:`Howto couple <Howto_couple>` doc page.
|
||||||
|
|||||||
@ -2,10 +2,14 @@ Build LAMMPS with make
|
|||||||
======================
|
======================
|
||||||
|
|
||||||
Building LAMMPS with traditional makefiles requires that you have a
|
Building LAMMPS with traditional makefiles requires that you have a
|
||||||
Makefile."machine" file appropriate for your system in the src/MAKE,
|
``Makefile.<machine>`` file appropriate for your system in either the
|
||||||
src/MAKE/MACHINES, src/MAKE/OPTIONS, or src/MAKE/MINE directory (see
|
``src/MAKE``, ``src/MAKE/MACHINES``, ``src/MAKE/OPTIONS``, or
|
||||||
below). It can include various options for customizing your LAMMPS
|
``src/MAKE/MINE`` directory (see below). It can include various options
|
||||||
build with a number of global compilation options and features.
|
for customizing your LAMMPS build with a number of global compilation
|
||||||
|
options and features.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
Those makefiles are written for and tested with GNU make and may not
|
Those makefiles are written for and tested with GNU make and may not
|
||||||
be compatible with other make programs. In most cases, if the "make"
|
be compatible with other make programs. In most cases, if the "make"
|
||||||
@ -16,44 +20,54 @@ with :doc:`CMake <Build_cmake>`. The makefiles of the traditional
|
|||||||
make based build process and the scripts they are calling expect a few
|
make based build process and the scripts they are calling expect a few
|
||||||
additional tools to be available and functioning.
|
additional tools to be available and functioning.
|
||||||
|
|
||||||
* a Bourne shell compatible "Unix" shell program (often this is bash)
|
* a working C/C++ compiler toolchain supporting the C++11 standard; on
|
||||||
* a few shell utilities: ls, mv, ln, rm, grep, sed, tr, cat, touch, diff, dirname
|
Linux these are often the GNU compilers. Some older compilers
|
||||||
* python (optional, required for "make lib-XXX" in the src folder)
|
require adding flags like ``-std=c++11`` to enable the C++11 mode.
|
||||||
|
* a Bourne shell compatible "Unix" shell program (often this is ``bash``)
|
||||||
|
* a few shell utilities: ``ls``, ``mv``, ``ln``, ``rm``, ``grep``, ``sed``, ``tr``, ``cat``, ``touch``, ``diff``, ``dirname``
|
||||||
|
* python (optional, required for ``make lib-<pkg>`` in the src folder).
|
||||||
|
python scripts are currently tested with python 2.7 and 3.6. The procedure
|
||||||
|
for :doc:`building the documentation <Manual_build>` requires python 3.
|
||||||
|
|
||||||
To include LAMMPS packages (i.e. optional commands and styles) you
|
Getting started
|
||||||
must enable them first, as discussed on the :doc:`Build package
|
^^^^^^^^^^^^^^^
|
||||||
<Build_package>` doc page. If a packages requires (provided or
|
|
||||||
|
To include LAMMPS packages (i.e. optional commands and styles) you must
|
||||||
|
enable (or "install") them first, as discussed on the :doc:`Build
|
||||||
|
package <Build_package>` doc page. If a packages requires (provided or
|
||||||
external) libraries, you must configure and build those libraries
|
external) libraries, you must configure and build those libraries
|
||||||
**before** building LAMMPS itself and especially **before** enabling
|
**before** building LAMMPS itself and especially **before** enabling
|
||||||
such a package with "make yes-<package>". Building :doc:`LAMMPS
|
such a package with ``make yes-<package>``. Building :doc:`LAMMPS with
|
||||||
with CMake <Build_cmake>` can automate much of this for many types of
|
CMake <Build_cmake>` can automate much of this for many types of
|
||||||
machines, especially workstations, desktops, and laptops, so we suggest
|
machines, especially workstations, desktops, and laptops, so we suggest
|
||||||
you try it first when building LAMMPS in those cases.
|
you try it first when building LAMMPS in those cases.
|
||||||
|
|
||||||
The commands below perform a default LAMMPS build, producing the LAMMPS
|
The commands below perform a default LAMMPS build, producing the LAMMPS
|
||||||
executable lmp_serial and lmp_mpi in lammps/src:
|
executable ``lmp_serial`` and ``lmp_mpi`` in ``lammps/src``:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
cd lammps/src
|
cd lammps/src # change to main LAMMPS source folder
|
||||||
make serial # build a serial LAMMPS executable
|
make serial # build a serial LAMMPS executable using GNU g++
|
||||||
make mpi # build a parallel LAMMPS executable with MPI
|
make mpi # build a parallel LAMMPS executable with MPI
|
||||||
make # see a variety of make options
|
make # see a variety of make options
|
||||||
|
|
||||||
This initial compilation can take a long time, since LAMMPS is a large
|
Compilation can take a long time, since LAMMPS is a large project with
|
||||||
project with many features. If your machine has multiple CPU cores
|
many features. If your machine has multiple CPU cores (most do these
|
||||||
(most do these days), using a command like "make -jN mpi" (with N =
|
days), you can speed this up by compiling sources in parallel with
|
||||||
the number of available CPU cores) can be much faster. If you plan to
|
``make -j N`` (with N being the maximum number of concurrently executed
|
||||||
do development on LAMMPS or need to re-compile LAMMPS repeatedly, the
|
tasks). Also installation of the `ccache <https://ccache.dev/>`_ (=
|
||||||
installation of the ccache (= Compiler Cache) software may speed up
|
Compiler Cache) software may speed up repeated compilation even more,
|
||||||
compilation even more.
|
e.g. during code development.
|
||||||
|
|
||||||
After the initial build, whenever you edit LAMMPS source files, or add
|
After the initial build, whenever you edit LAMMPS source files, or add
|
||||||
or remove new files to the source directory (e.g. by installing or
|
or remove new files to the source directory (e.g. by installing or
|
||||||
uninstalling packages), you must re-compile and relink the LAMMPS
|
uninstalling packages), you must re-compile and relink the LAMMPS
|
||||||
executable with the same "make" command. This makefiles dependencies
|
executable with the same ``make <machine>`` command. The makefile's
|
||||||
should insure that only the subset of files that need to be are
|
dependency tracking should insure that only the necessary subset of
|
||||||
re-compiled.
|
files are re-compiled. If you change settings in the makefile, you have
|
||||||
|
to recompile *everything*. To delete all objects you can use ``make
|
||||||
|
clean-<machine>``.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -65,13 +79,15 @@ re-compiled.
|
|||||||
correctly detect which parts need to be recompiled after changes
|
correctly detect which parts need to be recompiled after changes
|
||||||
were made to the sources.
|
were made to the sources.
|
||||||
|
|
||||||
----------
|
Customized builds and alternate makefiles
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The lammps/src/MAKE tree contains the Makefile.machine files included
|
The ``src/MAKE`` directory tree contains the ``Makefile.<machine>``
|
||||||
in the LAMMPS distribution. Typing "make machine" uses
|
files included in the LAMMPS distribution. Typing ``make example`` uses
|
||||||
*Makefile.machine*\ . Thus the "make serial" or "make mpi" lines above
|
``Makefile.example`` from one of those folders, if available. Thus the
|
||||||
use Makefile.serial and Makefile.mpi, respectively. Other makefiles
|
``make serial`` and ``make mpi`` lines above use
|
||||||
are in these directories:
|
``src/MAKE/Makefile.serial`` and ``src/MAKE/Makefile.mpi``,
|
||||||
|
respectively. Other makefiles are in these directories:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -79,11 +95,16 @@ are in these directories:
|
|||||||
MACHINES # Makefiles for specific machines
|
MACHINES # Makefiles for specific machines
|
||||||
MINE # customized Makefiles you create (you may need to create this folder)
|
MINE # customized Makefiles you create (you may need to create this folder)
|
||||||
|
|
||||||
Typing "make" lists all the available Makefile.machine files. A file
|
Simply typing ``make`` lists all the available ``Makefile.<machine>``
|
||||||
with the same name can appear in multiple folders (not a good idea).
|
files with a single line description toward the end of the output. A
|
||||||
The order the directories are searched is as follows: src/MAKE/MINE,
|
file with the same name can appear in multiple folders (not a good
|
||||||
src/MAKE, src/MAKE/OPTIONS, src/MAKE/MACHINES. This gives preference
|
idea). The order the directories are searched is as follows:
|
||||||
to a customized file you put in src/MAKE/MINE.
|
``src/MAKE/MINE``, ``src/MAKE``, ``src/MAKE/OPTIONS``,
|
||||||
|
``src/MAKE/MACHINES``. This gives preference to a customized file you
|
||||||
|
put in ``src/MAKE/MINE``. If you create your own custom makefile under
|
||||||
|
a new name, please edit the first line with the description and machine
|
||||||
|
name, so you will not confuse yourself, when looking at the machine
|
||||||
|
summary.
|
||||||
|
|
||||||
Makefiles you may wish to try include these (some require a package
|
Makefiles you may wish to try include these (some require a package
|
||||||
first be installed). Many of these include specific compiler flags
|
first be installed). Many of these include specific compiler flags
|
||||||
|
|||||||
@ -130,6 +130,8 @@ src directory.
|
|||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
.. _cmake_presets:
|
||||||
|
|
||||||
**CMake shortcuts for installing many packages**\ :
|
**CMake shortcuts for installing many packages**\ :
|
||||||
|
|
||||||
Instead of specifying all the CMake options via the command-line,
|
Instead of specifying all the CMake options via the command-line,
|
||||||
|
|||||||
@ -70,6 +70,7 @@ An alphabetic list of all general LAMMPS commands.
|
|||||||
* :doc:`kim_init <kim_commands>`
|
* :doc:`kim_init <kim_commands>`
|
||||||
* :doc:`kim_interactions <kim_commands>`
|
* :doc:`kim_interactions <kim_commands>`
|
||||||
* :doc:`kim_param <kim_commands>`
|
* :doc:`kim_param <kim_commands>`
|
||||||
|
* :doc:`kim_property <kim_commands>`
|
||||||
* :doc:`kim_query <kim_commands>`
|
* :doc:`kim_query <kim_commands>`
|
||||||
* :doc:`kspace_modify <kspace_modify>`
|
* :doc:`kspace_modify <kspace_modify>`
|
||||||
* :doc:`kspace_style <kspace_style>`
|
* :doc:`kspace_style <kspace_style>`
|
||||||
|
|||||||
@ -42,7 +42,7 @@ KOKKOS, o = USER-OMP, t = OPT.
|
|||||||
* :doc:`com <compute_com>`
|
* :doc:`com <compute_com>`
|
||||||
* :doc:`com/chunk <compute_com_chunk>`
|
* :doc:`com/chunk <compute_com_chunk>`
|
||||||
* :doc:`contact/atom <compute_contact_atom>`
|
* :doc:`contact/atom <compute_contact_atom>`
|
||||||
* :doc:`coord/atom <compute_coord_atom>`
|
* :doc:`coord/atom (k) <compute_coord_atom>`
|
||||||
* :doc:`damage/atom <compute_damage_atom>`
|
* :doc:`damage/atom <compute_damage_atom>`
|
||||||
* :doc:`dihedral <compute_dihedral>`
|
* :doc:`dihedral <compute_dihedral>`
|
||||||
* :doc:`dihedral/local <compute_dihedral_local>`
|
* :doc:`dihedral/local <compute_dihedral_local>`
|
||||||
@ -79,15 +79,12 @@ KOKKOS, o = USER-OMP, t = OPT.
|
|||||||
* :doc:`ke/atom/eff <compute_ke_atom_eff>`
|
* :doc:`ke/atom/eff <compute_ke_atom_eff>`
|
||||||
* :doc:`ke/eff <compute_ke_eff>`
|
* :doc:`ke/eff <compute_ke_eff>`
|
||||||
* :doc:`ke/rigid <compute_ke_rigid>`
|
* :doc:`ke/rigid <compute_ke_rigid>`
|
||||||
* :doc:`meso/e/atom <compute_meso_e_atom>`
|
|
||||||
* :doc:`meso/rho/atom <compute_meso_rho_atom>`
|
|
||||||
* :doc:`meso/t/atom <compute_meso_t_atom>`
|
|
||||||
* :doc:`momentum <compute_momentum>`
|
* :doc:`momentum <compute_momentum>`
|
||||||
* :doc:`msd <compute_msd>`
|
* :doc:`msd <compute_msd>`
|
||||||
* :doc:`msd/chunk <compute_msd_chunk>`
|
* :doc:`msd/chunk <compute_msd_chunk>`
|
||||||
* :doc:`msd/nongauss <compute_msd_nongauss>`
|
* :doc:`msd/nongauss <compute_msd_nongauss>`
|
||||||
* :doc:`omega/chunk <compute_omega_chunk>`
|
* :doc:`omega/chunk <compute_omega_chunk>`
|
||||||
* :doc:`orientorder/atom <compute_orientorder_atom>`
|
* :doc:`orientorder/atom (k) <compute_orientorder_atom>`
|
||||||
* :doc:`pair <compute_pair>`
|
* :doc:`pair <compute_pair>`
|
||||||
* :doc:`pair/local <compute_pair_local>`
|
* :doc:`pair/local <compute_pair_local>`
|
||||||
* :doc:`pe <compute_pe>`
|
* :doc:`pe <compute_pe>`
|
||||||
@ -133,6 +130,9 @@ KOKKOS, o = USER-OMP, t = OPT.
|
|||||||
* :doc:`sna/atom <compute_sna_atom>`
|
* :doc:`sna/atom <compute_sna_atom>`
|
||||||
* :doc:`snad/atom <compute_sna_atom>`
|
* :doc:`snad/atom <compute_sna_atom>`
|
||||||
* :doc:`snav/atom <compute_sna_atom>`
|
* :doc:`snav/atom <compute_sna_atom>`
|
||||||
|
* :doc:`sph/e/atom <compute_sph_e_atom>`
|
||||||
|
* :doc:`sph/rho/atom <compute_sph_rho_atom>`
|
||||||
|
* :doc:`sph/t/atom <compute_sph_t_atom>`
|
||||||
* :doc:`spin <compute_spin>`
|
* :doc:`spin <compute_spin>`
|
||||||
* :doc:`stress/atom <compute_stress_atom>`
|
* :doc:`stress/atom <compute_stress_atom>`
|
||||||
* :doc:`stress/mop <compute_stress_mop>`
|
* :doc:`stress/mop <compute_stress_mop>`
|
||||||
@ -161,5 +161,6 @@ KOKKOS, o = USER-OMP, t = OPT.
|
|||||||
* :doc:`torque/chunk <compute_torque_chunk>`
|
* :doc:`torque/chunk <compute_torque_chunk>`
|
||||||
* :doc:`vacf <compute_vacf>`
|
* :doc:`vacf <compute_vacf>`
|
||||||
* :doc:`vcm/chunk <compute_vcm_chunk>`
|
* :doc:`vcm/chunk <compute_vcm_chunk>`
|
||||||
|
* :doc:`viscosity/cos <compute_viscosity_cos>`
|
||||||
* :doc:`voronoi/atom <compute_voronoi_atom>`
|
* :doc:`voronoi/atom <compute_voronoi_atom>`
|
||||||
* :doc:`xrd <compute_xrd>`
|
* :doc:`xrd <compute_xrd>`
|
||||||
|
|||||||
@ -22,6 +22,7 @@ OPT.
|
|||||||
.. table_from_list::
|
.. table_from_list::
|
||||||
:columns: 5
|
:columns: 5
|
||||||
|
|
||||||
|
* :doc:`accelerate/cos <fix_accelerate_cos>`
|
||||||
* :doc:`adapt <fix_adapt>`
|
* :doc:`adapt <fix_adapt>`
|
||||||
* :doc:`adapt/fep <fix_adapt_fep>`
|
* :doc:`adapt/fep <fix_adapt_fep>`
|
||||||
* :doc:`addforce <fix_addforce>`
|
* :doc:`addforce <fix_addforce>`
|
||||||
@ -94,9 +95,7 @@ OPT.
|
|||||||
* :doc:`lb/viscous <fix_lb_viscous>`
|
* :doc:`lb/viscous <fix_lb_viscous>`
|
||||||
* :doc:`lineforce <fix_lineforce>`
|
* :doc:`lineforce <fix_lineforce>`
|
||||||
* :doc:`manifoldforce <fix_manifoldforce>`
|
* :doc:`manifoldforce <fix_manifoldforce>`
|
||||||
* :doc:`meso <fix_meso>`
|
|
||||||
* :doc:`meso/move <fix_meso_move>`
|
* :doc:`meso/move <fix_meso_move>`
|
||||||
* :doc:`meso/stationary <fix_meso_stationary>`
|
|
||||||
* :doc:`momentum (k) <fix_momentum>`
|
* :doc:`momentum (k) <fix_momentum>`
|
||||||
* :doc:`move <fix_move>`
|
* :doc:`move <fix_move>`
|
||||||
* :doc:`mscg <fix_mscg>`
|
* :doc:`mscg <fix_mscg>`
|
||||||
@ -201,6 +200,8 @@ OPT.
|
|||||||
* :doc:`smd/move_tri_surf <fix_smd_move_triangulated_surface>`
|
* :doc:`smd/move_tri_surf <fix_smd_move_triangulated_surface>`
|
||||||
* :doc:`smd/setvel <fix_smd_setvel>`
|
* :doc:`smd/setvel <fix_smd_setvel>`
|
||||||
* :doc:`smd/wall_surface <fix_smd_wall_surface>`
|
* :doc:`smd/wall_surface <fix_smd_wall_surface>`
|
||||||
|
* :doc:`sph <fix_sph>`
|
||||||
|
* :doc:`sph/stationary <fix_sph_stationary>`
|
||||||
* :doc:`spring <fix_spring>`
|
* :doc:`spring <fix_spring>`
|
||||||
* :doc:`spring/chunk <fix_spring_chunk>`
|
* :doc:`spring/chunk <fix_spring_chunk>`
|
||||||
* :doc:`spring/rg <fix_spring_rg>`
|
* :doc:`spring/rg <fix_spring_rg>`
|
||||||
|
|||||||
@ -131,6 +131,7 @@ OPT.
|
|||||||
* :doc:`lj/class2/coul/cut (ko) <pair_class2>`
|
* :doc:`lj/class2/coul/cut (ko) <pair_class2>`
|
||||||
* :doc:`lj/class2/coul/cut/soft <pair_fep_soft>`
|
* :doc:`lj/class2/coul/cut/soft <pair_fep_soft>`
|
||||||
* :doc:`lj/class2/coul/long (gko) <pair_class2>`
|
* :doc:`lj/class2/coul/long (gko) <pair_class2>`
|
||||||
|
* :doc:`lj/class2/coul/long/cs <pair_cs>`
|
||||||
* :doc:`lj/class2/coul/long/soft <pair_fep_soft>`
|
* :doc:`lj/class2/coul/long/soft <pair_fep_soft>`
|
||||||
* :doc:`lj/class2/soft <pair_fep_soft>`
|
* :doc:`lj/class2/soft <pair_fep_soft>`
|
||||||
* :doc:`lj/cubic (go) <pair_lj_cubic>`
|
* :doc:`lj/cubic (go) <pair_lj_cubic>`
|
||||||
|
|||||||
@ -48,7 +48,7 @@ The USER-CUDA package had been removed, since it had been unmaintained
|
|||||||
for a long time and had known bugs and problems. Significant parts of
|
for a long time and had known bugs and problems. Significant parts of
|
||||||
the design were transferred to the
|
the design were transferred to the
|
||||||
:ref:`KOKKOS package <PKG-KOKKOS>`, which has similar
|
:ref:`KOKKOS package <PKG-KOKKOS>`, which has similar
|
||||||
performance characteristics on Nvidia GPUs. Both, the KOKKOS
|
performance characteristics on NVIDIA GPUs. Both, the KOKKOS
|
||||||
and the :ref:`GPU package <PKG-GPU>` are maintained
|
and the :ref:`GPU package <PKG-GPU>` are maintained
|
||||||
and allow running LAMMPS with GPU acceleration.
|
and allow running LAMMPS with GPU acceleration.
|
||||||
|
|
||||||
|
|||||||
@ -12,5 +12,6 @@ additional details for many of them.
|
|||||||
|
|
||||||
Errors_common
|
Errors_common
|
||||||
Errors_bugs
|
Errors_bugs
|
||||||
|
Errors_debug
|
||||||
Errors_messages
|
Errors_messages
|
||||||
Errors_warnings
|
Errors_warnings
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
Reporting bugs
|
Reporting bugs
|
||||||
==============
|
==============
|
||||||
|
|
||||||
If you are confident that you have found a bug in LAMMPS, please follow the steps outlined below:
|
If you are confident that you have found a bug in LAMMPS, please follow
|
||||||
|
the steps outlined below:
|
||||||
|
|
||||||
* Check the `New features and bug fixes
|
* Check the `New features and bug fixes
|
||||||
<https://lammps.sandia.gov/bug.html>`_ section of the `LAMMPS WWW site
|
<https://lammps.sandia.gov/bug.html>`_ section of the `LAMMPS WWW site
|
||||||
@ -17,20 +18,22 @@ If you are confident that you have found a bug in LAMMPS, please follow the step
|
|||||||
* Check the `mailing list archives <https://lammps.sandia.gov/mail.html>`_
|
* Check the `mailing list archives <https://lammps.sandia.gov/mail.html>`_
|
||||||
to see if the issue has been discussed before.
|
to see if the issue has been discussed before.
|
||||||
|
|
||||||
If none of these steps yields any useful information, please file
|
If none of these steps yields any useful information, please file a new
|
||||||
a new bug report on the `GitHub Issue page <gip_>`_\ .
|
bug report on the `GitHub Issue page <gip_>`_. The website will offer
|
||||||
The website will offer you to select a suitable template with explanations
|
you to select a suitable template with explanations and then you should
|
||||||
and then you should replace those explanations with the information
|
replace those explanations with the information that you can provide to
|
||||||
that you can provide to reproduce your issue.
|
reproduce your issue.
|
||||||
|
|
||||||
The most useful thing you can do to help us verify and fix a bug is to
|
The most useful thing you can do to help us verify and fix a bug is to
|
||||||
isolate the problem. Run it on the smallest number of atoms and fewest
|
isolate the problem. Run it on the smallest number of atoms and fewest
|
||||||
number of processors with the simplest input script that reproduces the
|
number of processors with the simplest input script that reproduces the
|
||||||
bug. Try to identify what command or combination of commands is
|
bug. Try to identify what command or combination of commands is causing
|
||||||
causing the problem and upload the complete input deck as a tar or zip
|
the problem and upload the complete input deck as a tar or zip archive.
|
||||||
archive. Please avoid using binary restart files unless the issue requires
|
Please avoid using binary restart files unless the issue requires it.
|
||||||
it. In the latter case you should also include an input deck to quickly
|
In the latter case you should also include an input deck to quickly
|
||||||
generate this restart from a data file or a simple additional input.
|
generate this restart from a data file or a simple additional input.
|
||||||
|
This input deck can be used with tools like a debugger or `valgrind
|
||||||
|
<valgrind_>`_ to further :doc:`debug the crash <Errors_debug>`.
|
||||||
|
|
||||||
You may also send an email to the LAMMPS mailing list at
|
You may also send an email to the LAMMPS mailing list at
|
||||||
"lammps-users at lists.sourceforge.net" describing the problem with the
|
"lammps-users at lists.sourceforge.net" describing the problem with the
|
||||||
@ -43,3 +46,4 @@ have looked at it.
|
|||||||
|
|
||||||
.. _lws: https://lammps.sandia.gov
|
.. _lws: https://lammps.sandia.gov
|
||||||
.. _gip: https://github.com/lammps/issues
|
.. _gip: https://github.com/lammps/issues
|
||||||
|
.. _valgrind: https://valgrind.org
|
||||||
|
|||||||
237
doc/src/Errors_debug.rst
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
Debugging crashes
|
||||||
|
=================
|
||||||
|
|
||||||
|
If LAMMPS crashes with a "segmentation fault" or a "bus error" or
|
||||||
|
similar message, then you can use the following two methods to further
|
||||||
|
narrow down the origin of the issue. This will help the LAMMPS
|
||||||
|
developers (or yourself) to understand the reason for the crash and
|
||||||
|
apply a fix (either to the input script or the source code).
|
||||||
|
This requires that your LAMMPS executable includes the required
|
||||||
|
:ref:`debug information <debug>`. Otherwise it is not possible to
|
||||||
|
look up the names of functions or variables.
|
||||||
|
|
||||||
|
The following patch will introduce a bug into the code for pair style
|
||||||
|
:doc:`lj/cut <pair_lj>` when using the ``examples/melt/in.melt`` input.
|
||||||
|
We use it to show how to identify the origin of a segmentation fault.
|
||||||
|
|
||||||
|
.. code-block:: diff
|
||||||
|
|
||||||
|
--- a/src/pair_lj_cut.cpp
|
||||||
|
+++ b/src/pair_lj_cut.cpp
|
||||||
|
@@ -81,6 +81,7 @@ void PairLJCut::compute(int eflag, int vflag)
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
double *special_lj = force->special_lj;
|
||||||
|
int newton_pair = force->newton_pair;
|
||||||
|
+ double comx = 0.0;
|
||||||
|
|
||||||
|
inum = list->inum;
|
||||||
|
ilist = list->ilist;
|
||||||
|
@@ -134,8 +135,10 @@ void PairLJCut::compute(int eflag, int vflag)
|
||||||
|
evdwl,0.0,fpair,delx,dely,delz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
|
||||||
|
+ comx += atom->rmass[i]*x[i][0]; /* BUG */
|
||||||
|
+ }
|
||||||
|
+ printf("comx = %g\n",comx);
|
||||||
|
if (vflag_fdotr) virial_fdotr_compute();
|
||||||
|
}
|
||||||
|
|
||||||
|
After recompiling LAMMPS and running the input you should get something like this:
|
||||||
|
|
||||||
|
.. code-block:
|
||||||
|
|
||||||
|
$ ./lmp -in in.melt
|
||||||
|
LAMMPS (19 Mar 2020)
|
||||||
|
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94)
|
||||||
|
using 1 OpenMP thread(s) per MPI task
|
||||||
|
Lattice spacing in x,y,z = 1.6796 1.6796 1.6796
|
||||||
|
Created orthogonal box = (0 0 0) to (16.796 16.796 16.796)
|
||||||
|
1 by 1 by 1 MPI processor grid
|
||||||
|
Created 4000 atoms
|
||||||
|
create_atoms CPU = 0.000432253 secs
|
||||||
|
Neighbor list info ...
|
||||||
|
update every 20 steps, delay 0 steps, check no
|
||||||
|
max neighbors/atom: 2000, page size: 100000
|
||||||
|
master list distance cutoff = 2.8
|
||||||
|
ghost atom cutoff = 2.8
|
||||||
|
binsize = 1.4, bins = 12 12 12
|
||||||
|
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||||
|
(1) pair lj/cut, perpetual
|
||||||
|
attributes: half, newton on
|
||||||
|
pair build: half/bin/atomonly/newton
|
||||||
|
stencil: half/bin/3d/newton
|
||||||
|
bin: standard
|
||||||
|
Setting up Verlet run ...
|
||||||
|
Unit style : lj
|
||||||
|
Current step : 0
|
||||||
|
Time step : 0.005
|
||||||
|
Segmentation fault (core dumped)
|
||||||
|
|
||||||
|
|
||||||
|
Using the GDB debugger to get a stack trace
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
There are two options to use the GDB debugger for identifying the origin
|
||||||
|
of the segmentation fault or similar crash. The GDB debugger has many
|
||||||
|
more features and options, as can be seen for example its `online
|
||||||
|
documentation <http://sourceware.org/gdb/current/onlinedocs/gdb/>`_.
|
||||||
|
|
||||||
|
Run LAMMPS from within the debugger
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Running LAMMPS under the control of the debugger as shown below only
|
||||||
|
works for a single MPI rank (for debugging a program running in parallel
|
||||||
|
you usually need a parallel debugger program). A simple way to launch
|
||||||
|
GDB is to prefix the LAMMPS command line with ``gdb --args`` and then
|
||||||
|
type the command "run" at the GDB prompt. This will launch the
|
||||||
|
debugger, load the LAMMPS executable and its debug info, and then run
|
||||||
|
it. When it reaches the code causing the segmentation fault, it will
|
||||||
|
stop with a message why it stopped, print the current line of code, and
|
||||||
|
drop back to the GDB prompt.
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
[...]
|
||||||
|
Setting up Verlet run ...
|
||||||
|
Unit style : lj
|
||||||
|
Current step : 0
|
||||||
|
Time step : 0.005
|
||||||
|
|
||||||
|
Program received signal SIGSEGV, Segmentation fault.
|
||||||
|
0x00000000006653ab in LAMMPS_NS::PairLJCut::compute (this=0x829740, eflag=1, vflag=<optimized out>) at /home/akohlmey/compile/lammps/src/pair_lj_cut.cpp:139
|
||||||
|
139 comx += atom->rmass[i]*x[i][0]; /* BUG */
|
||||||
|
(gdb)
|
||||||
|
|
||||||
|
Now typing the command "where" will show the stack of functions starting from
|
||||||
|
the current function back to "main()".
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
(gdb) where
|
||||||
|
#0 0x00000000006653ab in LAMMPS_NS::PairLJCut::compute (this=0x829740, eflag=1, vflag=<optimized out>) at /home/akohlmey/compile/lammps/src/pair_lj_cut.cpp:139
|
||||||
|
#1 0x00000000004cf0a2 in LAMMPS_NS::Verlet::setup (this=0x7e6c90, flag=1) at /home/akohlmey/compile/lammps/src/verlet.cpp:131
|
||||||
|
#2 0x000000000049db42 in LAMMPS_NS::Run::command (this=this@entry=0x7fffffffcca0, narg=narg@entry=1, arg=arg@entry=0x7e8750)
|
||||||
|
at /home/akohlmey/compile/lammps/src/run.cpp:177
|
||||||
|
#3 0x000000000041258a in LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run> (lmp=<optimized out>, narg=1, arg=0x7e8750)
|
||||||
|
at /home/akohlmey/compile/lammps/src/input.cpp:878
|
||||||
|
#4 0x0000000000410ad3 in LAMMPS_NS::Input::execute_command (this=0x7d1410) at /home/akohlmey/compile/lammps/src/input.cpp:864
|
||||||
|
#5 0x00000000004111fb in LAMMPS_NS::Input::file (this=0x7d1410) at /home/akohlmey/compile/lammps/src/input.cpp:229
|
||||||
|
#6 0x000000000040933a in main (argc=<optimized out>, argv=<optimized out>) at /home/akohlmey/compile/lammps/src/main.cpp:65
|
||||||
|
(gdb)
|
||||||
|
|
||||||
|
You can also print the value of variables and see if there is anything
|
||||||
|
unexpected. Segmentation faults, for example, commonly happen when a
|
||||||
|
pointer variable is not assigned and still initialized to NULL.
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
(gdb) print x
|
||||||
|
$1 = (double **) 0x7ffff7ca1010
|
||||||
|
(gdb) print i
|
||||||
|
$2 = 0
|
||||||
|
(gdb) print x[0]
|
||||||
|
$3 = (double *) 0x7ffff6d80010
|
||||||
|
(gdb) print x[0][0]
|
||||||
|
$4 = 0
|
||||||
|
(gdb) print x[1][0]
|
||||||
|
$5 = 0.83979809569125363
|
||||||
|
(gdb) print atom->rmass
|
||||||
|
$6 = (double *) 0x0
|
||||||
|
(gdb)
|
||||||
|
|
||||||
|
|
||||||
|
Inspect a core dump file with the debugger
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
When an executable crashes with a "core dumped" message, it creates a
|
||||||
|
file "core" or "core.<PID#>" which contains the information about the
|
||||||
|
current state. This file may be located in the folder where you ran
|
||||||
|
LAMMPS or in some hidden folder managed by the systemd daemon. In the
|
||||||
|
latter case, you need to "extract" the core file with the ``coredumpctl``
|
||||||
|
utility to the current folder. Example: ``coredumpctl -o core dump lmp``.
|
||||||
|
Now you can launch the debugger to load the executable, its debug info
|
||||||
|
and the core dump and drop you to a prompt like before.
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
$ gdb lmp core
|
||||||
|
Reading symbols from lmp...
|
||||||
|
[New LWP 1928535]
|
||||||
|
[Thread debugging using libthread_db enabled]
|
||||||
|
Using host libthread_db library "/lib64/libthread_db.so.1".
|
||||||
|
Core was generated by `./lmp -in in.melt'.
|
||||||
|
Program terminated with signal SIGSEGV, Segmentation fault.
|
||||||
|
#0 0x00000000006653ab in LAMMPS_NS::PairLJCut::compute (this=0x1b10740, eflag=1, vflag=<optimized out>)
|
||||||
|
at /home/akohlmey/compile/lammps/src/pair_lj_cut.cpp:139
|
||||||
|
139 comx += atom->rmass[i]*x[i][0]; /* BUG */
|
||||||
|
(gdb)
|
||||||
|
|
||||||
|
From here on, you use the same commands as shown before to get a stack
|
||||||
|
trace and print current values of (pointer) variables.
|
||||||
|
|
||||||
|
|
||||||
|
Using valgrind to get a stack trace
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
The `valgrind <https://valgrind.org>`_ suite of tools allows to closely
|
||||||
|
inspect the behavior of a compiled program by essentially emulating a
|
||||||
|
CPU and instrumenting the program while running. This slows down
|
||||||
|
execution quite significantly, but can also report issues that are not
|
||||||
|
resulting in a crash. The default valgrind tool is a memory checker and
|
||||||
|
you can use it by prefixing the normal command line with ``valgrind``.
|
||||||
|
Unlike GDB, this will also work for parallel execution, but it is
|
||||||
|
recommended to redirect the valgrind output to a file (e.g. with
|
||||||
|
``--log-file=crash-%p.txt``, the %p will be substituted with the
|
||||||
|
process ID) so that the messages of the multiple valgrind instances to
|
||||||
|
the console are not mixed.
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
$ valgrind ./lmp -in in.melt
|
||||||
|
==1933642== Memcheck, a memory error detector
|
||||||
|
==1933642== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
|
||||||
|
==1933642== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
|
||||||
|
==1933642== Command: ./lmp -in in.melt
|
||||||
|
==1933642==
|
||||||
|
LAMMPS (19 Mar 2020)
|
||||||
|
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94)
|
||||||
|
using 1 OpenMP thread(s) per MPI task
|
||||||
|
Lattice spacing in x,y,z = 1.6796 1.6796 1.6796
|
||||||
|
Created orthogonal box = (0 0 0) to (16.796 16.796 16.796)
|
||||||
|
1 by 1 by 1 MPI processor grid
|
||||||
|
Created 4000 atoms
|
||||||
|
create_atoms CPU = 0.032964 secs
|
||||||
|
Neighbor list info ...
|
||||||
|
update every 20 steps, delay 0 steps, check no
|
||||||
|
max neighbors/atom: 2000, page size: 100000
|
||||||
|
master list distance cutoff = 2.8
|
||||||
|
ghost atom cutoff = 2.8
|
||||||
|
binsize = 1.4, bins = 12 12 12
|
||||||
|
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||||
|
(1) pair lj/cut, perpetual
|
||||||
|
attributes: half, newton on
|
||||||
|
pair build: half/bin/atomonly/newton
|
||||||
|
stencil: half/bin/3d/newton
|
||||||
|
bin: standard
|
||||||
|
Setting up Verlet run ...
|
||||||
|
Unit style : lj
|
||||||
|
Current step : 0
|
||||||
|
Time step : 0.005
|
||||||
|
==1933642== Invalid read of size 8
|
||||||
|
==1933642== at 0x6653AB: LAMMPS_NS::PairLJCut::compute(int, int) (pair_lj_cut.cpp:139)
|
||||||
|
==1933642== by 0x4CF0A1: LAMMPS_NS::Verlet::setup(int) (verlet.cpp:131)
|
||||||
|
==1933642== by 0x49DB41: LAMMPS_NS::Run::command(int, char**) (run.cpp:177)
|
||||||
|
==1933642== by 0x412589: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:881)
|
||||||
|
==1933642== by 0x410AD2: LAMMPS_NS::Input::execute_command() (input.cpp:864)
|
||||||
|
==1933642== by 0x4111FA: LAMMPS_NS::Input::file() (input.cpp:229)
|
||||||
|
==1933642== by 0x409339: main (main.cpp:65)
|
||||||
|
==1933642== Address 0x0 is not stack'd, malloc'd or (recently) free'd
|
||||||
|
==1933642==
|
||||||
|
|
||||||
|
As you can see, the stack trace information is similar to that obtained
|
||||||
|
from GDB. In addition you get a more specific hint about what cause the
|
||||||
|
segmentation fault, i.e. that it is a NULL pointer dereference. To find
|
||||||
|
out which pointer exactly was NULL, you need to use the debugger, though.
|
||||||
|
|
||||||
@ -2783,7 +2783,7 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
|
|||||||
if this helps.
|
if this helps.
|
||||||
|
|
||||||
*Did not find all elements in MEAM library file*
|
*Did not find all elements in MEAM library file*
|
||||||
The requested elements were not found in the MEAM file.
|
Some requested elements were not found in the MEAM file. Check spelling etc.
|
||||||
|
|
||||||
*Did not find fix shake partner info*
|
*Did not find fix shake partner info*
|
||||||
Could not find bond partners implied by fix shake command. This error
|
Could not find bond partners implied by fix shake command. This error
|
||||||
@ -3135,6 +3135,9 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
|
|||||||
*Epsilon or sigma reference not set by pair style in ewald/n*
|
*Epsilon or sigma reference not set by pair style in ewald/n*
|
||||||
The pair style is not providing the needed epsilon or sigma values.
|
The pair style is not providing the needed epsilon or sigma values.
|
||||||
|
|
||||||
|
*Error in MEAM parameter file: keyword %s (further information)*
|
||||||
|
Self-explanatory. Check the parameter file.
|
||||||
|
|
||||||
*Error in vdw spline: inner radius > outer radius*
|
*Error in vdw spline: inner radius > outer radius*
|
||||||
A pre-tabulated spline is invalid. Likely a problem with the
|
A pre-tabulated spline is invalid. Likely a problem with the
|
||||||
potential parameters.
|
potential parameters.
|
||||||
@ -4611,7 +4614,7 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
|
|||||||
*Incorrect format in COMB3 potential file*
|
*Incorrect format in COMB3 potential file*
|
||||||
Incorrect number of words per line in the potential file.
|
Incorrect number of words per line in the potential file.
|
||||||
|
|
||||||
*Incorrect format in MEAM potential file*
|
*Incorrect format in MEAM library file*
|
||||||
Incorrect number of words per line in the potential file.
|
Incorrect number of words per line in the potential file.
|
||||||
|
|
||||||
*Incorrect format in SNAP coefficient file*
|
*Incorrect format in SNAP coefficient file*
|
||||||
@ -5669,6 +5672,9 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
|
|||||||
A fix is referenced incorrectly or a fix that produces per-atom
|
A fix is referenced incorrectly or a fix that produces per-atom
|
||||||
values is used in an equal-style variable formula.
|
values is used in an equal-style variable formula.
|
||||||
|
|
||||||
|
*Mismatched parameter in MEAM library file: z!=lat*
|
||||||
|
The coordination number and lattice do not match, check that consistent values are given.
|
||||||
|
|
||||||
*Mismatched variable in variable formula*
|
*Mismatched variable in variable formula*
|
||||||
A variable is referenced incorrectly or an atom-style variable that
|
A variable is referenced incorrectly or an atom-style variable that
|
||||||
produces per-atom values is used in an equal-style variable
|
produces per-atom values is used in an equal-style variable
|
||||||
@ -5845,6 +5851,9 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
|
|||||||
Cannot use the temper command with only one processor partition. Use
|
Cannot use the temper command with only one processor partition. Use
|
||||||
the -partition command-line option.
|
the -partition command-line option.
|
||||||
|
|
||||||
|
*Must not have multiple fixes change box parameter ...*
|
||||||
|
Self-explanatory.
|
||||||
|
|
||||||
*Must read Atoms before Angles*
|
*Must read Atoms before Angles*
|
||||||
The Atoms section of a data file must come before an Angles section.
|
The Atoms section of a data file must come before an Angles section.
|
||||||
|
|
||||||
@ -7764,6 +7773,9 @@ keyword to allow for additional bonds to be formed
|
|||||||
*Too many atoms to dump sort*
|
*Too many atoms to dump sort*
|
||||||
Cannot sort when running with more than 2\^31 atoms.
|
Cannot sort when running with more than 2\^31 atoms.
|
||||||
|
|
||||||
|
*Too many elements extracted from MEAM library.*
|
||||||
|
Increase 'maxelt' in meam.h and recompile.
|
||||||
|
|
||||||
*Too many exponent bits for lookup table*
|
*Too many exponent bits for lookup table*
|
||||||
Table size specified via pair_modify command does not work with your
|
Table size specified via pair_modify command does not work with your
|
||||||
machine's floating point representation.
|
machine's floating point representation.
|
||||||
@ -7997,11 +8009,11 @@ keyword to allow for additional bonds to be formed
|
|||||||
*Unknown unit_style*
|
*Unknown unit_style*
|
||||||
Self-explanatory. Check the input script or data file.
|
Self-explanatory. Check the input script or data file.
|
||||||
|
|
||||||
*Unrecognized lattice type in MEAM file 1*
|
*Unrecognized lattice type in MEAM library file*
|
||||||
The lattice type in an entry of the MEAM library file is not
|
The lattice type in an entry of the MEAM library file is not
|
||||||
valid.
|
valid.
|
||||||
|
|
||||||
*Unrecognized lattice type in MEAM file 2*
|
*Unrecognized lattice type in MEAM parameter file*
|
||||||
The lattice type in an entry of the MEAM parameter file is not
|
The lattice type in an entry of the MEAM parameter file is not
|
||||||
valid.
|
valid.
|
||||||
|
|
||||||
@ -8017,6 +8029,9 @@ keyword to allow for additional bonds to be formed
|
|||||||
*Unsupported order in kspace_style pppm/disp, pair_style %s*
|
*Unsupported order in kspace_style pppm/disp, pair_style %s*
|
||||||
Only pair styles with 1/r and 1/r\^6 dependence are currently supported.
|
Only pair styles with 1/r and 1/r\^6 dependence are currently supported.
|
||||||
|
|
||||||
|
*Unsupported parameter in MEAM library file*
|
||||||
|
Self-explanatory.
|
||||||
|
|
||||||
*Use cutoff keyword to set cutoff in single mode*
|
*Use cutoff keyword to set cutoff in single mode*
|
||||||
Mode is single so cutoff/multi keyword cannot be used.
|
Mode is single so cutoff/multi keyword cannot be used.
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ Tutorials howto
|
|||||||
:name: tutorials
|
:name: tutorials
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
|
Howto_cmake
|
||||||
Howto_github
|
Howto_github
|
||||||
Howto_pylammps
|
Howto_pylammps
|
||||||
Howto_bash
|
Howto_bash
|
||||||
|
|||||||
483
doc/src/Howto_cmake.rst
Normal file
@ -0,0 +1,483 @@
|
|||||||
|
Using CMake with LAMMPS tutorial
|
||||||
|
================================
|
||||||
|
|
||||||
|
The support for building LAMMPS with CMake is a recent addition to
|
||||||
|
LAMMPS thanks to the efforts of Christoph Junghans (LANL) and Richard
|
||||||
|
Berger (Temple U). One of the key strengths of CMake is that it is not
|
||||||
|
tied to a specific platform or build system and thus generate the files
|
||||||
|
necessary to build and develop for different build systems and on
|
||||||
|
different platforms. Note, that this applies to the build system itself
|
||||||
|
not the LAMMPS code. In other words, without additional porting effort,
|
||||||
|
it is not possible - for example - to compile LAMMPS with Visual C++ on
|
||||||
|
Windows. The build system output can also include support files
|
||||||
|
necessary to program LAMMPS as a project in integrated development
|
||||||
|
environments (IDE) like Eclipse, Visual Studio, QtCreator, Xcode,
|
||||||
|
CodeBlocks, Kate and others.
|
||||||
|
|
||||||
|
A second important feature of CMake is, that it can detect and validate
|
||||||
|
available libraries, optimal settings, available support tools and so
|
||||||
|
on, so that by default LAMMPS will take advantage of available tools
|
||||||
|
without requiring to provide the details about how to enable/integrate
|
||||||
|
them.
|
||||||
|
|
||||||
|
The downside of this approach is, that there is some complexity
|
||||||
|
associated with running CMake itself and how to customize the building
|
||||||
|
of LAMMPS. This tutorial will show how to manage this through some
|
||||||
|
selected examples. Please see the chapter about :doc:`building LAMMPS
|
||||||
|
<Build>` for descriptions of specific flags and options for LAMMPS in
|
||||||
|
general and for specific packages.
|
||||||
|
|
||||||
|
CMake can be used through either the command-line interface (CLI)
|
||||||
|
program ``cmake`` (or ``cmake3``), a text mode interactive user
|
||||||
|
interface (TUI) program ``ccmake`` (or ``ccmake3``), or a graphical user
|
||||||
|
interface (GUI) program ``cmake-gui``. All of them are portable
|
||||||
|
software available on all supported platforms and can be used
|
||||||
|
interchangeably. The minimum supported CMake version is 3.10 (3.12 or
|
||||||
|
later is recommended).
|
||||||
|
|
||||||
|
All details about features and settings for CMake are in the `CMake
|
||||||
|
online documentation <https://cmake.org/documentation/>`_. We focus
|
||||||
|
below on the most important aspects with respect to compiling LAMMPS.
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
-------------
|
||||||
|
|
||||||
|
This tutorial assumes that you are operating in a command-line environment
|
||||||
|
using a shell like Bash.
|
||||||
|
|
||||||
|
- Linux: any Terminal window will work
|
||||||
|
- MacOS X: launch the Terminal application.
|
||||||
|
- Windows 10: install and run the :doc:`Windows subsystem for Linux <Howto_bash>`
|
||||||
|
|
||||||
|
We also assume that you have downloaded and unpacked a recent LAMMPS source code package
|
||||||
|
or used Git to create a clone of the LAMMPS sources on your compilation machine.
|
||||||
|
|
||||||
|
You should change into the top level directory of the LAMMPS source tree all
|
||||||
|
paths mentioned in the tutorial are relative to that. Immediately after downloading
|
||||||
|
it should look like this:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ ls
|
||||||
|
bench doc lib potentials README tools
|
||||||
|
cmake examples LICENSE python src
|
||||||
|
|
||||||
|
Build versus source directory
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
When using CMake the build procedure is separated into multiple distinct phases:
|
||||||
|
|
||||||
|
#. **Configuration:** detect or define which features and settings
|
||||||
|
should be enable and used and how LAMMPS should be compiled
|
||||||
|
#. **Compilation:** generate and compile all necessary source files
|
||||||
|
and build libraries and executables.
|
||||||
|
#. **Installation:** copy selected files from the compilation into
|
||||||
|
your file system, so they can be used without having to keep the
|
||||||
|
source and build tree around.
|
||||||
|
|
||||||
|
The configuration and compilation of LAMMPS has to happen in a dedicated
|
||||||
|
*build directory* which must be different from the source directory.
|
||||||
|
Also the source directory (``src``) must remain pristine, so it is not
|
||||||
|
allowed to "install" packages using the traditional make process and
|
||||||
|
after an compilation attempt all created source files must be removed.
|
||||||
|
This can be achieved with ``make no-all purge``.
|
||||||
|
|
||||||
|
You can pick **any** folder outside the source tree. We recommend to
|
||||||
|
create a folder ``build`` in the top-level directory, or multiple
|
||||||
|
folders in case you want to have separate builds of LAMMPS with
|
||||||
|
different options (``build-parallel``, ``build-serial``) or with
|
||||||
|
different compilers (``build-gnu``, ``build-clang``, ``build-intel``)
|
||||||
|
and so on. All the auxiliary files created by one build process
|
||||||
|
(executable, object files, log files, etc) are stored in this directory
|
||||||
|
or sub-directories within it that CMake creates.
|
||||||
|
|
||||||
|
|
||||||
|
Running CMake
|
||||||
|
-------------
|
||||||
|
|
||||||
|
CLI version
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
In the (empty) ``build`` directory, we now run the command ``cmake
|
||||||
|
../cmake``, which will start the configuration phase and you will see
|
||||||
|
the progress of the configuration printed to the screen followed by a
|
||||||
|
summary of the enabled features, options and compiler settings. A typical
|
||||||
|
summary screen will look like this:
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
$ cmake ../cmake/
|
||||||
|
-- The CXX compiler identification is GNU 8.2.0
|
||||||
|
-- Check for working CXX compiler: /opt/tools/gcc-8.2.0/bin/c++
|
||||||
|
-- Check for working CXX compiler: /opt/tools/gcc-8.2.0/bin/c++ - works
|
||||||
|
-- Detecting CXX compiler ABI info
|
||||||
|
-- Detecting CXX compiler ABI info - done
|
||||||
|
-- Detecting CXX compile features
|
||||||
|
-- Detecting CXX compile features - done
|
||||||
|
-- Found Git: /usr/bin/git (found version "2.25.2")
|
||||||
|
-- Running check for auto-generated files from make-based build system
|
||||||
|
-- Found MPI_CXX: /usr/lib64/mpich/lib/libmpicxx.so (found version "3.1")
|
||||||
|
-- Found MPI: TRUE (found version "3.1")
|
||||||
|
-- Looking for C++ include omp.h
|
||||||
|
-- Looking for C++ include omp.h - found
|
||||||
|
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
|
||||||
|
-- Found OpenMP: TRUE (found version "4.5")
|
||||||
|
-- Found JPEG: /usr/lib64/libjpeg.so (found version "62")
|
||||||
|
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.37")
|
||||||
|
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
|
||||||
|
-- Found GZIP: /usr/bin/gzip
|
||||||
|
-- Found FFMPEG: /usr/bin/ffmpeg
|
||||||
|
-- Performing Test COMPILER_SUPPORTS-ffast-math
|
||||||
|
-- Performing Test COMPILER_SUPPORTS-ffast-math - Success
|
||||||
|
-- Performing Test COMPILER_SUPPORTS-march=native
|
||||||
|
-- Performing Test COMPILER_SUPPORTS-march=native - Success
|
||||||
|
-- Looking for C++ include cmath
|
||||||
|
-- Looking for C++ include cmath - found
|
||||||
|
-- Generating style_angle.h...
|
||||||
|
[...]
|
||||||
|
-- Generating lmpinstalledpkgs.h...
|
||||||
|
-- The following tools and libraries have been found and configured:
|
||||||
|
* Git
|
||||||
|
* MPI
|
||||||
|
* OpenMP
|
||||||
|
* JPEG
|
||||||
|
* PNG
|
||||||
|
* ZLIB
|
||||||
|
|
||||||
|
-- <<< Build configuration >>>
|
||||||
|
Build type: RelWithDebInfo
|
||||||
|
Install path: /home/akohlmey/.local
|
||||||
|
Generator: Unix Makefiles using /usr/bin/gmake
|
||||||
|
-- <<< Compilers and Flags: >>>
|
||||||
|
-- C++ Compiler: /opt/tools/gcc-8.2.0/bin/c++
|
||||||
|
Type: GNU
|
||||||
|
Version: 8.2.0
|
||||||
|
C++ Flags: -O2 -g -DNDEBUG
|
||||||
|
Defines: LAMMPS_SMALLBIG;LAMMPS_MEMALIGN=64;LAMMPS_JPEG;LAMMPS_PNG;LAMMPS_GZIP;LAMMPS_FFMPEG
|
||||||
|
Options: -ffast-math;-march=native
|
||||||
|
-- <<< Linker flags: >>>
|
||||||
|
-- Executable name: lmp
|
||||||
|
-- Static library flags:
|
||||||
|
-- <<< MPI flags >>>
|
||||||
|
-- MPI includes: /usr/include/mpich-x86_64
|
||||||
|
-- MPI libraries: /usr/lib64/mpich/lib/libmpicxx.so;/usr/lib64/mpich/lib/libmpi.so;
|
||||||
|
-- Configuring done
|
||||||
|
-- Generating done
|
||||||
|
-- Build files have been written to: /home/akohlmey/compile/lammps/build
|
||||||
|
|
||||||
|
The ``cmake`` command has one mandatory argument, and that is a folder
|
||||||
|
with either the file ``CMakeLists.txt`` or ``CMakeCache.txt``. The
|
||||||
|
``CMakeCache.txt`` file is created during the CMake configuration run
|
||||||
|
and contains all active settings, thus after a first run of CMake
|
||||||
|
all future runs in the build folder can use the folder ``.`` and CMake
|
||||||
|
will know where to find the CMake scripts and reload the settings
|
||||||
|
from the previous step. This means, that one can modify an existing
|
||||||
|
configuration by re-running CMake, but only needs to provide flags
|
||||||
|
indicating the desired change, everything else will be retained. One
|
||||||
|
can also mix compilation and configuration, i.e. start with a minimal
|
||||||
|
configuration and then, if needed, enable additional features and
|
||||||
|
recompile.
|
||||||
|
|
||||||
|
The steps above **will NOT compile the code**\ . The compilation can be
|
||||||
|
started in a portable fashion with ``cmake --build .``, or you use the
|
||||||
|
selected built tool, e.g. ``make``.
|
||||||
|
|
||||||
|
TUI version
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
For the text mode UI CMake program the basic principle is the same.
|
||||||
|
You start the command ``ccmake ../cmake`` in the ``build`` folder.
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
|
||||||
|
* - .. figure:: JPG/ccmake-initial.png
|
||||||
|
:target: JPG/ccmake-initial.png
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Initial ``ccmake`` screen
|
||||||
|
|
||||||
|
- .. figure:: JPG/ccmake-config.png
|
||||||
|
:target: JPG/ccmake-config.png
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Configure output of ``ccmake``
|
||||||
|
|
||||||
|
- .. figure:: JPG/ccmake-options.png
|
||||||
|
:target: JPG/ccmake-options.png
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Options screen of ``ccmake``
|
||||||
|
|
||||||
|
This will show you the initial screen (left image) with the empty
|
||||||
|
configuration cache. Now you type the 'c' key to run the configuration
|
||||||
|
step. That will do a first configuration run and show the summary
|
||||||
|
(center image). You exit the summary screen with 'e' and see now the
|
||||||
|
main screen with detected options and settings. You can now make changes
|
||||||
|
by moving and down with the arrow keys of the keyboard and modify
|
||||||
|
entries. For on/off settings, the enter key will toggle the state.
|
||||||
|
For others, hitting enter will allow you to modify the value and
|
||||||
|
you commit the change by hitting the enter key again or cancel using
|
||||||
|
the escape key. All "new" settings will be marked with a star '\*'
|
||||||
|
and for as long as one setting is marked like this, you have to
|
||||||
|
re-run the configuration by hitting the 'c' key again, sometimes
|
||||||
|
multiple times unless the TUI shows the word "generate" next to the
|
||||||
|
letter 'g' and by hitting the 'g' key the build files will be written
|
||||||
|
to the folder and the TUI exits. You can quit without generating
|
||||||
|
build files by hitting 'q'.
|
||||||
|
|
||||||
|
GUI version
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
For the graphical CMake program the steps are similar to the TUI
|
||||||
|
version. You can type the command ``cmake-gui ../cmake`` in the
|
||||||
|
``build`` folder. In this case the path to the CMake script folder is
|
||||||
|
not required, it can also be entered from the GUI.
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
|
||||||
|
* - .. figure:: JPG/cmake-gui-initial.png
|
||||||
|
:target: JPG/cmake-gui-initial.png
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Initial ``cmake-gui`` screen
|
||||||
|
|
||||||
|
- .. figure:: JPG/cmake-gui-popup.png
|
||||||
|
:target: JPG/cmake-gui-popup.png
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Generator selection in ``cmake-gui``
|
||||||
|
|
||||||
|
- .. figure:: JPG/cmake-gui-options.png
|
||||||
|
:target: JPG/cmake-gui-options.png
|
||||||
|
:align: center
|
||||||
|
|
||||||
|
Options screen of ``cmake-gui``
|
||||||
|
|
||||||
|
Again, you start with an empty configuration cache (left image) and need
|
||||||
|
to start the configuration step. For the very first configuration in a
|
||||||
|
folder, you will have a pop-up dialog (center image) asking to select
|
||||||
|
the desired build tool and some configuration settings (stick with the
|
||||||
|
default) and then you get the option screen with all new settings
|
||||||
|
highlighted in red. You can modify them (or not) and click on the
|
||||||
|
"configure" button again until satisfied and click on the "generate"
|
||||||
|
button to write out the build files. You can exit the GUI from the
|
||||||
|
"File" menu or hit "ctrl-q".
|
||||||
|
|
||||||
|
|
||||||
|
Setting options
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Options that enable, disable or modify settings are modified by setting
|
||||||
|
the value of CMake variables. This is done on the command line with the
|
||||||
|
*-D* flag in the format ``-D VARIABLE=value``, e.g. ``-D
|
||||||
|
CMAKE_BUILD_TYPE=Release`` or ``-D BUILD_MPI=on``. There is one quirk:
|
||||||
|
when used before the CMake directory, there may be a space between the
|
||||||
|
*-D* flag and the variable, after it must not be. Such CMake variables
|
||||||
|
can have boolean values (on/off, yes/no, or 1/0 are all valid) or are
|
||||||
|
strings representing a choice, or a path, or are free format. If the
|
||||||
|
string would contain whitespace, it must be put in quotes, for example
|
||||||
|
``-D CMAKE_TUNE_FLAGS="-ftree-vectorize -ffast-math"``.
|
||||||
|
|
||||||
|
CMake variables fall into two categories: 1) common CMake variables that
|
||||||
|
are used by default for any CMake configuration setup and 2) project
|
||||||
|
specific variables, i.e. settings that are specific for LAMMPS.
|
||||||
|
Also CMake variables can be flagged as *advanced*, which means they are
|
||||||
|
not shown in the text mode or graphical CMake program in the overview
|
||||||
|
of all settings by default, but only when explicitly requested (by hitting
|
||||||
|
the 't' key or clicking on the 'Advanced' check-box).
|
||||||
|
|
||||||
|
Some common CMake variables
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Variable
|
||||||
|
- Description
|
||||||
|
* - ``CMAKE_INSTALL_PREFIX``
|
||||||
|
- root directory of install location for ``make install`` (default: ``$HOME/.local``)
|
||||||
|
* - ``CMAKE_BUILD_TYPE``
|
||||||
|
- controls compilation options:
|
||||||
|
one of ``RelWithDebInfo`` (default), ``Release``, ``Debug``, ``MinSizeRel``
|
||||||
|
* - ``BUILD_SHARED_LIBS``
|
||||||
|
- if set to ``on`` build the LAMMPS library as shared library (default: ``off``)
|
||||||
|
* - ``CMAKE_MAKE_PROGRAM``
|
||||||
|
- name/path of the compilation command (default depends on *-G* option, usually ``make``)
|
||||||
|
* - ``CMAKE_VERBOSE_MAKEFILE``
|
||||||
|
- if set to ``on`` echo commands while executing during build (default: ``off``)
|
||||||
|
* - ``CMAKE_C_COMPILER``
|
||||||
|
- C compiler to be used for compilation (default: system specific, ``gcc`` on Linux)
|
||||||
|
* - ``CMAKE_CXX_COMPILER``
|
||||||
|
- C++ compiler to be used for compilation (default: system specific, ``g++`` on Linux)
|
||||||
|
* - ``CMAKE_Fortran_COMPILER``
|
||||||
|
- Fortran compiler to be used for compilation (default: system specific, ``gfortran`` on Linux)
|
||||||
|
* - ``CXX_COMPILER_LAUNCHER``
|
||||||
|
- tool to launch the C++ compiler, e.g. ``ccache`` or ``distcc`` for faster compilation (default: empty)
|
||||||
|
|
||||||
|
Some common LAMMPS specific variables
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Variable
|
||||||
|
- Description
|
||||||
|
* - ``BUILD_MPI``
|
||||||
|
- build LAMMPS with MPI support (default: ``on`` if a working MPI available, else ``off``)
|
||||||
|
* - ``BUILD_OMP``
|
||||||
|
- build LAMMPS with OpenMP support (default: ``on`` if compiler supports OpenMP fully, else ``off``)
|
||||||
|
* - ``BUILD_TOOLS``
|
||||||
|
- compile some additional executables from the ``tools`` folder (default: ``off``)
|
||||||
|
* - ``BUILD_DOC``
|
||||||
|
- include building the HTML format documentation for packaging/installing (default: ``off``)
|
||||||
|
* - ``CMAKE_TUNE_FLAGS``
|
||||||
|
- common compiler flags, for optimization or instrumentation (default: compiler specific)
|
||||||
|
* - ``LAMMPS_MACHINE``
|
||||||
|
- when set to ``name`` the LAMMPS executable and library will be called ``lmp_name`` and ``liblammps_name.a``
|
||||||
|
* - ``LAMMPS_EXCEPTIONS``
|
||||||
|
- when set to ``on`` errors will throw a C++ exception instead of aborting (default: ``off``)
|
||||||
|
* - ``FFT``
|
||||||
|
- select which FFT library to use: ``FFTW3``, ``MKL``, ``KISS`` (default, unless FFTW3 is found)
|
||||||
|
* - ``FFT_SINGLE``
|
||||||
|
- select whether to use single precision FFTs (default: ``off``)
|
||||||
|
* - ``WITH_JPEG``
|
||||||
|
- whether to support JPEG format in :doc:`dump image <dump_image>` (default: ``on`` if found)
|
||||||
|
* - ``WITH_PNG``
|
||||||
|
- whether to support PNG format in :doc:`dump image <dump_image>` (default: ``on`` if found)
|
||||||
|
* - ``WITH_GZIP``
|
||||||
|
- whether to support reading and writing compressed files (default: ``on`` if found)
|
||||||
|
* - ``WITH_FFMPEG``
|
||||||
|
- whether to support generating movies with :doc:`dump movie <dump_image>` (default: ``on`` if found)
|
||||||
|
|
||||||
|
Enabling or disabling LAMMPS packages
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The LAMMPS software is organized into a common core that is always
|
||||||
|
included and a large number of :doc:`add-on packages <Packages>` that
|
||||||
|
have to be enabled to be included into a LAMMPS executable. Packages
|
||||||
|
are enabled through setting variables of the kind ``PKG_<NAME>`` to
|
||||||
|
``on`` and disabled by setting them to ``off`` (or using ``yes``,
|
||||||
|
``no``, ``1``, ``0`` correspondingly). ``<NAME>`` has to be replaced by
|
||||||
|
the name of the package, e.g. ``MOLECULE`` or ``USER-MISC``.
|
||||||
|
|
||||||
|
|
||||||
|
Using presets
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Since LAMMPS has a lot of optional features and packages, specifying
|
||||||
|
them all on the command line can be tedious. Or when selecting a
|
||||||
|
different compiler toolchain, multiple options have to be changed
|
||||||
|
consistently and that is rather error prone. Or when enabling certain
|
||||||
|
packages, they require consistent settings to be operated in a
|
||||||
|
particular mode. For this purpose, we are providing a selection of
|
||||||
|
"preset files" for CMake in the folder ``cmake/presets``. They
|
||||||
|
represent a way to pre-load or override the CMake configuration cache by
|
||||||
|
setting or changing CMake variables. Preset files are loaded using the
|
||||||
|
*-C* command line flag. You can combine loading multiple preset files or
|
||||||
|
change some variables later with additional *-D* flags. A few examples:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cmake -C ../cmake/presets/minimal.cmake -D PKG_MISC=on ../cmake
|
||||||
|
cmake -C ../cmake/presets/clang.cmake -C ../cmake/presets/most.cmake ../cmake
|
||||||
|
cmake -C ../cmake/presets/minimal.cmake -D BUILD_MPI=off ../cmake
|
||||||
|
|
||||||
|
The first command will install the packages ``KSPACE``, ``MANYBODY``,
|
||||||
|
``MOLECULE``, ``RIGID`` and ``MISC``; the first four from the preset
|
||||||
|
file and the fifth from the explicit variable definition. The second
|
||||||
|
command will first switch the compiler toolchain to use the Clang
|
||||||
|
compilers and install a large number of packages that are not depending
|
||||||
|
on any special external libraries or tools and are not very unusual.
|
||||||
|
The third command will enable the first four packages like above and
|
||||||
|
then enforce compiling LAMMPS as a serial program (using the MPI STUBS
|
||||||
|
library).
|
||||||
|
|
||||||
|
It is also possible to do this incrementally.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cmake -C ../cmake/presets/minimal.cmake ../cmake
|
||||||
|
cmake -D PKG_MISC=on .
|
||||||
|
|
||||||
|
will achieve the same configuration like in the first example above. In
|
||||||
|
this scenario it is particularly convenient to do the second
|
||||||
|
configuration step using either the text mode or graphical user
|
||||||
|
interface (``ccmake`` or ``cmake-gui``).
|
||||||
|
|
||||||
|
Compilation and build targets
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
The actual compilation will be started by running the selected build
|
||||||
|
command (on Linux this is by default ``make``, see below how to select
|
||||||
|
alternatives). You can also use the portable command ``cmake --build .``
|
||||||
|
which will adapt to whatever the selected build command is.
|
||||||
|
This is particularly convenient, if you have set a custom build command
|
||||||
|
via the ``CMAKE_MAKE_PROGRAM`` variable.
|
||||||
|
|
||||||
|
When calling the build program, you can also select which "target" is to
|
||||||
|
be build through appending the name of the target to the build command.
|
||||||
|
Example: ``cmake --build . all``. The following abstract targets are available:
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Target
|
||||||
|
- Description
|
||||||
|
* - ``all``
|
||||||
|
- build "everything" (default)
|
||||||
|
* - ``lammps``
|
||||||
|
- build the LAMMPS library and executable
|
||||||
|
* - ``doc``
|
||||||
|
- build the HTML documentation (if configured)
|
||||||
|
* - ``install``
|
||||||
|
- install all target files into folders in ``CMAKE_INSTALL_PREFIX``
|
||||||
|
* - ``test``
|
||||||
|
- run some simple tests (if configured with ``-D ENABLE_TESTING=on``)
|
||||||
|
* - ``clean``
|
||||||
|
- remove all generated files
|
||||||
|
|
||||||
|
|
||||||
|
Choosing generators
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
While CMake usually defaults to creating makefiles to compile software
|
||||||
|
with the ``make`` program, it supports multiple alternate build tools
|
||||||
|
(e.g. ``ninja-build`` which tends to be faster and more efficient in
|
||||||
|
parallelizing builds than ``make``) and can generate project files for
|
||||||
|
integrated development environments (IDEs) like VisualStudio, Eclipse or
|
||||||
|
CodeBlocks. This is specific to how the local CMake version was
|
||||||
|
configured and compiled. The list of available options can be seen at
|
||||||
|
the end of the output of ``cmake --help``. Example on Fedora 31 this is:
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
Generators
|
||||||
|
|
||||||
|
The following generators are available on this platform (* marks default):
|
||||||
|
* Unix Makefiles = Generates standard UNIX makefiles.
|
||||||
|
Green Hills MULTI = Generates Green Hills MULTI files
|
||||||
|
(experimental, work-in-progress).
|
||||||
|
Ninja = Generates build.ninja files.
|
||||||
|
Ninja Multi-Config = Generates build-<Config>.ninja files.
|
||||||
|
Watcom WMake = Generates Watcom WMake makefiles.
|
||||||
|
CodeBlocks - Ninja = Generates CodeBlocks project files.
|
||||||
|
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
|
||||||
|
CodeLite - Ninja = Generates CodeLite project files.
|
||||||
|
CodeLite - Unix Makefiles = Generates CodeLite project files.
|
||||||
|
Sublime Text 2 - Ninja = Generates Sublime Text 2 project files.
|
||||||
|
Sublime Text 2 - Unix Makefiles
|
||||||
|
= Generates Sublime Text 2 project files.
|
||||||
|
Kate - Ninja = Generates Kate project files.
|
||||||
|
Kate - Unix Makefiles = Generates Kate project files.
|
||||||
|
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
|
||||||
|
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
|
||||||
|
|
||||||
|
Below is a screenshot of using the CodeBlocks IDE with the ninja build tool
|
||||||
|
after running CMake as follows:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cmake -G 'CodeBlocks - Ninja' ../cmake/presets/most.cmake ../cmake/
|
||||||
|
|
||||||
|
.. image:: JPG/cmake-codeblocks.png
|
||||||
|
:align: center
|
||||||
@ -1,10 +1,11 @@
|
|||||||
Calculate viscosity
|
Calculate viscosity
|
||||||
===================
|
===================
|
||||||
|
|
||||||
The shear viscosity eta of a fluid can be measured in at least 5 ways
|
The shear viscosity eta of a fluid can be measured in at least 6 ways
|
||||||
using various options in LAMMPS. See the examples/VISCOSITY directory
|
using various options in LAMMPS. See the examples/VISCOSITY directory
|
||||||
for scripts that implement the 5 methods discussed here for a simple
|
for scripts that implement the 5 methods discussed here for a simple
|
||||||
Lennard-Jones fluid model. Also, see the :doc:`Howto kappa <Howto_kappa>` doc page for an analogous discussion for
|
Lennard-Jones fluid model and 1 method for SPC/E water model.
|
||||||
|
Also, see the :doc:`Howto kappa <Howto_kappa>` doc page for an analogous discussion for
|
||||||
thermal conductivity.
|
thermal conductivity.
|
||||||
|
|
||||||
Eta is a measure of the propensity of a fluid to transmit momentum in
|
Eta is a measure of the propensity of a fluid to transmit momentum in
|
||||||
@ -130,9 +131,25 @@ time-integrated momentum fluxes play the role of Cartesian
|
|||||||
coordinates, whose mean-square displacement increases linearly
|
coordinates, whose mean-square displacement increases linearly
|
||||||
with time at sufficiently long times.
|
with time at sufficiently long times.
|
||||||
|
|
||||||
|
The sixth is periodic perturbation method. It is also a non-equilibrium MD method.
|
||||||
|
However, instead of measure the momentum flux in response of applied velocity gradient,
|
||||||
|
it measures the velocity profile in response of applied stress.
|
||||||
|
A cosine-shaped periodic acceleration is added to the system via the
|
||||||
|
:doc:`fix accelerate/cos <fix_accelerate_cos>` command,
|
||||||
|
and the :doc:`compute viscosity/cos<compute_viscosity_cos>` command is used to monitor the
|
||||||
|
generated velocity profile and remove the velocity bias before thermostatting.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
An article by :ref:`(Hess) <Hess3>` discussed the accuracy and efficiency of these methods.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
.. _Daivis-viscosity:
|
.. _Daivis-viscosity:
|
||||||
|
|
||||||
**(Daivis and Todd)** Daivis and Todd, Nonequilibrium Molecular Dynamics (book),
|
**(Daivis and Todd)** Daivis and Todd, Nonequilibrium Molecular Dynamics (book),
|
||||||
Cambridge University Press, https://doi.org/10.1017/9781139017848, (2017).
|
Cambridge University Press, https://doi.org/10.1017/9781139017848, (2017).
|
||||||
|
|
||||||
|
.. _Hess3:
|
||||||
|
|
||||||
|
**(Hess)** Hess, B. The Journal of Chemical Physics 2002, 116 (1), 209-217.
|
||||||
|
|||||||
@ -24,12 +24,13 @@ allows you to install LAMMPS with a single command, and stay
|
|||||||
up-to-date with the current version of LAMMPS by simply updating your
|
up-to-date with the current version of LAMMPS by simply updating your
|
||||||
operating system.
|
operating system.
|
||||||
|
|
||||||
To install the appropriate personal-package archive (PPA), do the
|
To install the appropriate personal-package archives (PPAs), do the
|
||||||
following once:
|
following once:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ sudo add-apt-repository ppa:gladky-anton/lammps
|
$ sudo add-apt-repository ppa:gladky-anton/lammps
|
||||||
|
$ sudo add-apt-repository ppa:openkim/latest
|
||||||
$ sudo apt-get update
|
$ sudo apt-get update
|
||||||
|
|
||||||
To install LAMMPS do the following once:
|
To install LAMMPS do the following once:
|
||||||
@ -38,7 +39,7 @@ To install LAMMPS do the following once:
|
|||||||
|
|
||||||
$ sudo apt-get install lammps-daily
|
$ sudo apt-get install lammps-daily
|
||||||
|
|
||||||
This downloads an executable named "lmp_daily" to your box, which
|
This downloads an executable named ``lmp_daily`` to your box, which
|
||||||
can then be used in the usual way to run input scripts:
|
can then be used in the usual way to run input scripts:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -60,11 +61,29 @@ To get a copy of the current documentation and examples:
|
|||||||
$ sudo apt-get install lammps-daily-doc
|
$ sudo apt-get install lammps-daily-doc
|
||||||
|
|
||||||
which will download the doc files in
|
which will download the doc files in
|
||||||
/usr/share/doc/lammps-daily-doc/doc and example problems in
|
``/usr/share/doc/lammps-daily-doc/doc`` and example problems in
|
||||||
/usr/share/doc/lammps-doc/examples.
|
``/usr/share/doc/lammps-doc/examples``.
|
||||||
|
|
||||||
Note that you may still wish to download the tarball to get potential
|
To get a copy of the current potentials files:
|
||||||
files and auxiliary tools.
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ sudo apt-get install lammps-daily-data
|
||||||
|
|
||||||
|
which will download the potentials files to
|
||||||
|
``/usr/share/lammps-daily/potentials``. The ``lmp_daily`` binary is
|
||||||
|
hard-coded to look for potential files in this directory (it does not
|
||||||
|
use the `LAMMPS_POTENTIALS` environment variable, as described
|
||||||
|
in :doc:`pair_coeff <pair_coeff>` command).
|
||||||
|
|
||||||
|
The ``lmp_daily`` binary is built with the :ref:`KIM package <kim>` which
|
||||||
|
results in the above command also installing the `kim-api` binaries when LAMMPS
|
||||||
|
is installed. In order to use potentials from `openkim.org <openkim_>`_, you
|
||||||
|
can install the `openkim-models` package
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ sudo apt-get install openkim-models
|
||||||
|
|
||||||
To un-install LAMMPS, do the following:
|
To un-install LAMMPS, do the following:
|
||||||
|
|
||||||
@ -72,17 +91,8 @@ To un-install LAMMPS, do the following:
|
|||||||
|
|
||||||
$ sudo apt-get remove lammps-daily
|
$ sudo apt-get remove lammps-daily
|
||||||
|
|
||||||
Note that the lammps-daily executable is built with the following
|
Please use ``lmp_daily -help`` to see which compilation options, packages,
|
||||||
sequence of make commands, as if you had done the same with the
|
and styles are included in the binary.
|
||||||
unpacked tarball files in the src directory:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ make yes-all
|
|
||||||
$ make no-lib
|
|
||||||
$ make mpi
|
|
||||||
|
|
||||||
Thus it builds with FFTW3 and OpenMPI.
|
|
||||||
|
|
||||||
Thanks to Anton Gladky (gladky.anton at gmail.com) for setting up this
|
Thanks to Anton Gladky (gladky.anton at gmail.com) for setting up this
|
||||||
Ubuntu package capability.
|
Ubuntu package capability.
|
||||||
@ -103,14 +113,14 @@ linking to the C library interface (lammps-devel, lammps-mpich-devel,
|
|||||||
lammps-openmpi-devel), the header for compiling programs using
|
lammps-openmpi-devel), the header for compiling programs using
|
||||||
the C library interface (lammps-headers), and the LAMMPS python
|
the C library interface (lammps-headers), and the LAMMPS python
|
||||||
module for Python 3. All packages can be installed at the same
|
module for Python 3. All packages can be installed at the same
|
||||||
time and the name of the LAMMPS executable is *lmp* and *lmp_openmpi*
|
time and the name of the LAMMPS executable is ``lmp`` and ``lmp_openmpi``
|
||||||
or *lmp_mpich* respectively. By default, *lmp* will refer to the
|
or ``lmp_mpich`` respectively. By default, ``lmp`` will refer to the
|
||||||
serial executable, unless one of the MPI environment modules is loaded
|
serial executable, unless one of the MPI environment modules is loaded
|
||||||
("module load mpi/mpich-x86_64" or "module load mpi/openmpi-x86_64").
|
(``module load mpi/mpich-x86_64`` or ``module load mpi/openmpi-x86_64``).
|
||||||
Then the corresponding parallel LAMMPS executable can be used.
|
Then the corresponding parallel LAMMPS executable can be used.
|
||||||
The same mechanism applies when loading the LAMMPS python module.
|
The same mechanism applies when loading the LAMMPS python module.
|
||||||
|
|
||||||
To install LAMMPS with OpenMPI and run an input in.lj with 2 CPUs do:
|
To install LAMMPS with OpenMPI and run an input ``in.lj`` with 2 CPUs do:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -118,10 +128,10 @@ To install LAMMPS with OpenMPI and run an input in.lj with 2 CPUs do:
|
|||||||
$ module load mpi/openmpi-x86_64
|
$ module load mpi/openmpi-x86_64
|
||||||
$ mpirun -np 2 lmp -in in.lj
|
$ mpirun -np 2 lmp -in in.lj
|
||||||
|
|
||||||
The "dnf install" command is needed only once. In case of a new LAMMPS
|
The ``dnf install`` command is needed only once. In case of a new LAMMPS
|
||||||
stable release, "dnf update" will automatically update to the newer
|
stable release, ``dnf update`` will automatically update to the newer
|
||||||
version as soon at the RPM files are built and uploaded to the download
|
version as soon at the RPM files are built and uploaded to the download
|
||||||
mirrors. The "module load" command is needed once per (shell) session
|
mirrors. The ``module load`` command is needed once per (shell) session
|
||||||
or shell terminal instance, unless it is automatically loaded from the
|
or shell terminal instance, unless it is automatically loaded from the
|
||||||
shell profile.
|
shell profile.
|
||||||
|
|
||||||
@ -134,7 +144,7 @@ can install the `openkim-models` package
|
|||||||
|
|
||||||
$ dnf install openkim-models
|
$ dnf install openkim-models
|
||||||
|
|
||||||
Please use "lmp -help" to see which compilation options, packages,
|
Please use ``lmp -help`` to see which compilation options, packages,
|
||||||
and styles are included in the binary.
|
and styles are included in the binary.
|
||||||
|
|
||||||
Thanks to Christoph Junghans (LANL) for making LAMMPS available in Fedora.
|
Thanks to Christoph Junghans (LANL) for making LAMMPS available in Fedora.
|
||||||
@ -153,10 +163,10 @@ in the `Extra Packages for Enterprise Linux (EPEL) repository <https://fedorapro
|
|||||||
for use with Red Hat Enterprise Linux (RHEL) or CentOS version 7.x
|
for use with Red Hat Enterprise Linux (RHEL) or CentOS version 7.x
|
||||||
and compatible Linux distributions. Names of packages, executable,
|
and compatible Linux distributions. Names of packages, executable,
|
||||||
and content are the same as described above for Fedora Linux.
|
and content are the same as described above for Fedora Linux.
|
||||||
But RHEL/CentOS 7.x uses the "yum" package manager instead of "dnf"
|
But RHEL/CentOS 7.x uses the ``yum`` package manager instead of ``dnf``
|
||||||
in Fedora 28.
|
in Fedora 28.
|
||||||
|
|
||||||
Please use "lmp -help" to see which compilation options, packages,
|
Please use ``lmp -help`` to see which compilation options, packages,
|
||||||
and styles are included in the binary.
|
and styles are included in the binary.
|
||||||
|
|
||||||
Thanks to Christoph Junghans (LANL) for making LAMMPS available in EPEL.
|
Thanks to Christoph Junghans (LANL) for making LAMMPS available in EPEL.
|
||||||
@ -176,13 +186,13 @@ in OpenSuse as of Leap 15.0. You can install the package with:
|
|||||||
$ zypper install lammps
|
$ zypper install lammps
|
||||||
|
|
||||||
This includes support for OpenMPI. The name of the LAMMPS executable
|
This includes support for OpenMPI. The name of the LAMMPS executable
|
||||||
is *lmp*\ . Thus to run an input in parallel on 2 CPUs you would do:
|
is ``lmp``. Thus to run an input in parallel on 2 CPUs you would do:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ mpirun -np 2 lmp -in in.lj
|
$ mpirun -np 2 lmp -in in.lj
|
||||||
|
|
||||||
Please use "lmp -help" to see which compilation options, packages,
|
Please use ``lmp -help`` to see which compilation options, packages,
|
||||||
and styles are included in the binary.
|
and styles are included in the binary.
|
||||||
|
|
||||||
The LAMMPS binary is built with the :ref:`KIM package <kim>` which
|
The LAMMPS binary is built with the :ref:`KIM package <kim>` which
|
||||||
|
|||||||
@ -34,9 +34,9 @@ install the `openkim-models` package
|
|||||||
% brew install openkim-models
|
% brew install openkim-models
|
||||||
|
|
||||||
If you have problems with the installation you can post issues to
|
If you have problems with the installation you can post issues to
|
||||||
`this link <homebrew_>`_.
|
`this link <https://github.com/Homebrew/homebrew-core/issues>`_.
|
||||||
|
|
||||||
.. _homebrew: https://github.com/Homebrew/homebrew-core/issues
|
.. _homebrew: https://brew.sh
|
||||||
|
|
||||||
Thanks to Derek Thomas (derekt at cello.t.u-tokyo.ac.jp) for setting
|
Thanks to Derek Thomas (derekt at cello.t.u-tokyo.ac.jp) for setting
|
||||||
up the Homebrew capability.
|
up the Homebrew capability.
|
||||||
|
|||||||
0
doc/src/JPG/bow_tutorial_01.png
Executable file → Normal file
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
0
doc/src/JPG/bow_tutorial_01_small.png
Executable file → Normal file
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
0
doc/src/JPG/bow_tutorial_02.png
Executable file → Normal file
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
0
doc/src/JPG/bow_tutorial_02_small.png
Executable file → Normal file
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |