From 72eb2dab528477f14a27f0bb4ac32ab85ca5b97b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 13 Jan 2018 20:41:05 +0100 Subject: [PATCH 1/5] Add missing math.h header --- src/MANYBODY/pair_polymorphic.h | 1 + src/MANYBODY/pair_tersoff_mod.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/MANYBODY/pair_polymorphic.h b/src/MANYBODY/pair_polymorphic.h index 9917bcd96d..18eab46365 100644 --- a/src/MANYBODY/pair_polymorphic.h +++ b/src/MANYBODY/pair_polymorphic.h @@ -21,6 +21,7 @@ PairStyle(polymorphic,PairPolymorphic) #define LMP_PAIR_POLYMORPHIC_H #include "pair.h" +#include namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_tersoff_mod.h b/src/MANYBODY/pair_tersoff_mod.h index 8bc7ed37a8..fea3919be3 100644 --- a/src/MANYBODY/pair_tersoff_mod.h +++ b/src/MANYBODY/pair_tersoff_mod.h @@ -21,6 +21,7 @@ PairStyle(tersoff/mod,PairTersoffMOD) #define LMP_PAIR_TERSOFF_MOD_H #include "pair_tersoff.h" +#include namespace LAMMPS_NS { From 23e8fb0542d8a025491e5aefefa21165815556c2 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 13 Jan 2018 21:57:24 +0100 Subject: [PATCH 2/5] Update CMake build for USER-COLVARS --- cmake/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a9ea3a059f..c150e15a1d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -401,6 +401,14 @@ foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include) elseif(PKG_LIB STREQUAL h5md) target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include) + elseif(PKG_LIB STREQUAL colvars) + file(GLOB_RECURSE LEPTON_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/src/*.cpp) + add_library(lepton STATIC ${LEPTON_SOURCES}) + target_include_directories(lepton PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include) + + target_compile_options(colvars PRIVATE -DLEPTON) + target_link_libraries(colvars lepton) + target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars) else() target_include_directories(${PKG_LIB} PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}) endif() From 1cfc3118cc4b8bbdf899c9053f40936e1e35f7ce Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 13 Jan 2018 22:17:23 +0100 Subject: [PATCH 3/5] CMake: remove BUILD_SHARED_LIBS requirement from PYTHON package --- cmake/CMakeLists.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c150e15a1d..d6758debcd 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -198,14 +198,13 @@ if(ENABLE_PYTHON) add_definitions(-DLMP_PYTHON) include_directories(${PYTHON_INCLUDE_DIR}) list(APPEND LAMMPS_LINK_LIBS ${PYTHON_LIBRARY}) - if(NOT PYTHON_INSTDIR) - execute_process(COMMAND ${PYTHON_EXECUTABLE} - -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" - OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) - if(NOT BUILD_SHARED_LIBS) - message(FATAL_ERROR "Python package need lammps to be build shared, use -DBUILD_SHARED_LIBS=ON") + if(BUILD_SHARED_LIBS) + if(NOT PYTHON_INSTDIR) + execute_process(COMMAND ${PYTHON_EXECUTABLE} + -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" + OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) endif() endif() From 2b7c233791433d1f8dbffea0c80be991642607fc Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 14 Jan 2018 08:44:50 +0100 Subject: [PATCH 4/5] Simplify change to CMake build for USER-COLVARS --- cmake/CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d6758debcd..03eb20a572 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -401,13 +401,8 @@ foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD elseif(PKG_LIB STREQUAL h5md) target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include) elseif(PKG_LIB STREQUAL colvars) - file(GLOB_RECURSE LEPTON_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/src/*.cpp) - add_library(lepton STATIC ${LEPTON_SOURCES}) - target_include_directories(lepton PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include) - target_compile_options(colvars PRIVATE -DLEPTON) - target_link_libraries(colvars lepton) - target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars) + target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include ${LAMMPS_LIB_SOURCE_DIR}/colvars) else() target_include_directories(${PKG_LIB} PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}) endif() From d2983caad498abca1c778dc04f7d0dfed68dda78 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 14 Jan 2018 18:01:19 +0100 Subject: [PATCH 5/5] CMake: limit visibility of COLVARS lepton library headers --- cmake/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 03eb20a572..478785b3cb 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -402,7 +402,8 @@ foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include) elseif(PKG_LIB STREQUAL colvars) target_compile_options(colvars PRIVATE -DLEPTON) - target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include ${LAMMPS_LIB_SOURCE_DIR}/colvars) + target_include_directories(colvars PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include) + target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars) else() target_include_directories(${PKG_LIB} PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}) endif()