forked from gromacs/gromacs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Colvars module version 2024-03-12
- Loading branch information
1 parent
922e31f
commit 116f406
Showing
122 changed files
with
51,759 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# | ||
# This file is part of the GROMACS molecular simulation package. | ||
# | ||
# Copyright 2023- The GROMACS Authors | ||
# and the project initiators Erik Lindahl, Berk Hess and David van der Spoel. | ||
# Consult the AUTHORS/COPYING files and https://www.gromacs.org for details. | ||
# | ||
# GROMACS is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public License | ||
# as published by the Free Software Foundation; either version 2.1 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# GROMACS is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with GROMACS; if not, see | ||
# https://www.gnu.org/licenses, or write to the Free Software Foundation, | ||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# If you want to redistribute modifications to GROMACS, please | ||
# consider that scientific software is very special. Version | ||
# control is crucial - bugs must be traceable. We will be happy to | ||
# consider code for inclusion in the official distribution, but | ||
# derived work must not be called official GROMACS. Details are found | ||
# in the README & COPYING files - if they are missing, get the | ||
# official version at https://www.gromacs.org. | ||
# | ||
# To help us fund GROMACS development, we humbly ask that you cite | ||
# the research papers on the package. Check out https://www.gromacs.org. | ||
|
||
# Build Colvars library as bundled in a GROMACS worktree; not supporting external linkage yet | ||
gmx_option_multichoice(GMX_USE_COLVARS | ||
"Build the collective variables (Colvars) library interfaced with GROMACS" | ||
INTERNAL | ||
INTERNAL NONE) | ||
mark_as_advanced(GMX_USE_COLVARS) | ||
|
||
function(gmx_manage_colvars) | ||
if(GMX_USE_COLVARS STREQUAL "INTERNAL") | ||
# Create an object library for the colvars sources | ||
set(COLVARS_DIR "${CMAKE_SOURCE_DIR}/src/external/colvars") | ||
file(GLOB COLVARS_SOURCES ${COLVARS_DIR}/*.cpp) | ||
add_library(colvars_objlib OBJECT ${COLVARS_SOURCES}) | ||
# Set correctly the value of __cplusplus, which MSVC doesn't do by default | ||
target_compile_options(colvars_objlib PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>) | ||
# Ensure that colvars_objlib can be used in both STATIC and SHARED libraries. | ||
set_target_properties(colvars_objlib PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
|
||
# Create an INTERFACE library for colvars with the object library as a dependency | ||
add_library(colvars INTERFACE) | ||
target_sources(colvars INTERFACE $<TARGET_OBJECTS:colvars_objlib>) | ||
target_include_directories(colvars SYSTEM INTERFACE $<BUILD_INTERFACE:${COLVARS_DIR}>) | ||
|
||
if(GMX_OPENMP) | ||
target_compile_options(colvars_objlib PRIVATE ${OpenMP_CXX_FLAGS}) | ||
target_link_libraries(colvars_objlib PRIVATE OpenMP::OpenMP_CXX) | ||
endif() | ||
|
||
else() | ||
# Create a dummy link target so the calling code doesn't need to know | ||
# whether colvars support is being compiled. | ||
add_library(colvars INTERFACE) | ||
endif() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Add Lepton library, which is developed and distributed as part of OpenMM: | ||
# https://github.com/openmm/openmm | ||
|
||
gmx_option_multichoice(GMX_USE_LEPTON | ||
"Build the Lepton library interfaced with GROMACS" | ||
INTERNAL | ||
INTERNAL NONE) | ||
mark_as_advanced(GMX_USE_LEPTON) | ||
|
||
function(gmx_manage_lepton) | ||
if(GMX_USE_LEPTON STREQUAL "INTERNAL") | ||
|
||
set(LEPTON_DIR "${CMAKE_SOURCE_DIR}/src/external/lepton") | ||
|
||
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/*.cpp) | ||
add_library(lepton_objlib OBJECT ${LEPTON_SOURCES}) | ||
target_include_directories(lepton_objlib PRIVATE ${LEPTON_DIR}/include) | ||
# TODO support building as shared library | ||
target_compile_options(lepton_objlib PRIVATE -DLEPTON_BUILDING_STATIC_LIBRARY) | ||
set_target_properties(lepton_objlib PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
|
||
add_library(lepton INTERFACE) | ||
target_sources(lepton INTERFACE $<TARGET_OBJECTS:lepton_objlib>) | ||
target_include_directories(lepton SYSTEM INTERFACE $<BUILD_INTERFACE:${LEPTON_DIR}>) | ||
|
||
# Set flags so that Colvars can leverage Lepton functionality | ||
# TODO handle the case when Lepton is built without Colvars? | ||
target_include_directories(colvars_objlib PRIVATE ${LEPTON_DIR}/include) | ||
target_compile_options(colvars_objlib PRIVATE -DLEPTON -DLEPTON_USE_STATIC_LIBRARIES) | ||
|
||
else() | ||
|
||
# Dummy target | ||
add_library(lepton INTERFACE) | ||
endif() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.