From d5dcb3d32930c2efcd41bd394d21b283c46c78e6 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 14 Jul 2017 15:55:36 -0600 Subject: [PATCH] add support for KSPACE --- cmake/CMakeLists.txt | 14 +++++++++++++- cmake/Headers/style_fix.h | 3 +++ cmake/Headers/style_kspace.h | 12 ++++++++++++ cmake/Headers/style_pair.h | 30 ++++++++++++++++++++++++++++++ cmake/Modules/FindFFTW3.cmake | 25 +++++++++++++++++++++++++ 5 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 cmake/Modules/FindFFTW3.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 9db55174fc..f0d121d834 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -5,6 +5,9 @@ set(SOVERSION 0) set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) +# Cmake modules/macros are in a subdirectory to keep this file cleaner +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules) + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) #release comes with -O3 by default set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) @@ -37,11 +40,20 @@ find_package(UnixCommands) option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF) -set(PACKAGES ASPHERE REAX) +set(PACKAGES ASPHERE KSPACE REAX) foreach(PKG ${PACKAGES}) option(ENABLE_${PKG} "Build ${PKG} Package" OFF) endforeach() +if(ENABLE_KSPACE) + find_package(FFTW3) + if(FFTW3_FOUND) + add_definitions(-DFFT_FFTW3) + include_directories(${FFTW3_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${FFTW3_LIBRARIES}) + endif() +endif() + find_package(JPEG) if(JPEG_FOUND) add_definitions(-DLAMMPS_JPEG) diff --git a/cmake/Headers/style_fix.h b/cmake/Headers/style_fix.h index 146616124d..fb68f69135 100644 --- a/cmake/Headers/style_fix.h +++ b/cmake/Headers/style_fix.h @@ -82,6 +82,9 @@ #include "fix_temp_csvr.h" #include "fix_temp_rescale.h" #include "fix_tmd.h" +#ifdef ENABLE_KSPACE +#include "fix_tune_kspace.h" +#endif #include "fix_vector.h" #include "fix_viscous.h" #include "fix_wall_harmonic.h" diff --git a/cmake/Headers/style_kspace.h b/cmake/Headers/style_kspace.h index b2b5c1f82e..64760bb422 100644 --- a/cmake/Headers/style_kspace.h +++ b/cmake/Headers/style_kspace.h @@ -1 +1,13 @@ #include "package.h" +#ifdef ENABLE_KSPACE +#include "ewald.h" +#include "ewald_disp.h" +#include "msm.h" +#include "msm_cg.h" +#include "pppm.h" +#include "pppm_cg.h" +#include "pppm_disp.h" +#include "pppm_disp_tip4p.h" +#include "pppm_stagger.h" +#include "pppm_tip4p.h" +#endif diff --git a/cmake/Headers/style_pair.h b/cmake/Headers/style_pair.h index 067e2cdb23..e7676bfabf 100644 --- a/cmake/Headers/style_pair.h +++ b/cmake/Headers/style_pair.h @@ -2,12 +2,25 @@ #include "pair_beck.h" #include "pair_born.h" #include "pair_born_coul_dsf.h" +#ifdef ENABLE_KSPACE +#include "pair_born_coul_long.h" +#include "pair_born_coul_msm.h" +#endif #include "pair_born_coul_wolf.h" #include "pair_buck.h" #include "pair_buck_coul_cut.h" +#ifdef ENABLE_KSPACE +#include "pair_buck_coul_long.h" +#include "pair_buck_coul_msm.h" +#include "pair_buck_long_coul_long.h" +#endif #include "pair_coul_cut.h" #include "pair_coul_debye.h" #include "pair_coul_dsf.h" +#ifdef ENABLE_KSPACE +#include "pair_coul_long.h" +#include "pair_coul_msm.h" +#endif #include "pair_coul_streitz.h" #include "pair_coul_wolf.h" #include "pair_dpd.h" @@ -22,14 +35,28 @@ #include "pair_line_lj.h" #endif #include "pair_lj96_cut.h" +#ifdef ENABLE_KSPACE +#include "pair_lj_charmm_coul_long.h" +#include "pair_lj_charmm_coul_msm.h" +#include "pair_lj_charmmfsw_coul_long.h" +#endif #include "pair_lj_cubic.h" #include "pair_lj_cut.h" #include "pair_lj_cut_coul_cut.h" #include "pair_lj_cut_coul_debye.h" #include "pair_lj_cut_coul_dsf.h" +#ifdef ENABLE_KSPACE +#include "pair_lj_cut_coul_long.h" +#include "pair_lj_cut_coul_msm.h" +#include "pair_lj_cut_tip4p_long.h" +#endif #include "pair_lj_expand.h" #include "pair_lj_gromacs.h" #include "pair_lj_gromacs_coul_gromacs.h" +#ifdef ENABLE_KSPACE +#include "pair_lj_long_coul_long.h" +#include "pair_lj_long_tip4p_long.h" +#endif #include "pair_lj_smooth.h" #include "pair_lj_smooth_linear.h" #include "pair_mie_cut.h" @@ -42,6 +69,9 @@ #endif #include "pair_soft.h" #include "pair_table.h" +#ifdef ENABLE_KSPACE +#include "pair_tip4p_long.h" +#endif #ifdef ENABLE_ASPHERE #include "pair_tri_lj.h" #endif diff --git a/cmake/Modules/FindFFTW3.cmake b/cmake/Modules/FindFFTW3.cmake new file mode 100644 index 0000000000..552bcc4257 --- /dev/null +++ b/cmake/Modules/FindFFTW3.cmake @@ -0,0 +1,25 @@ +# - Find fftw3 +# Find the native FFTW3 headers and libraries. +# +# FFTW3_INCLUDE_DIRS - where to find fftw3.h, etc. +# FFTW3_LIBRARIES - List of libraries when using fftw3. +# FFTW3_FOUND - True if fftw3 found. +# + +find_package(PkgConfig) + +pkg_check_modules(PC_FFTW3 fftw3) +find_path(FFTW3_INCLUDE_DIR fftw3.h HINTS ${PC_FFTW3_INCLUDE_DIRS}) + +find_library(FFTW3_LIBRARY NAMES fftw3 HINTS ${PC_FFTW3_LIBRARY_DIRS}) + +set(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) +set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(FFTW3 DEFAULT_MSG FFTW3_LIBRARY FFTW3_INCLUDE_DIR) + +mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARY )