Commit 814b9b93 authored by julient31's avatar julient31
Browse files

Merge branch 'clean-master2' of github.com:julient31/lammps into gneb_spin

parents 1501e9ba 89886032
Loading
Loading
Loading
Loading
+194 −72
Original line number Diff line number Diff line
@@ -320,10 +320,15 @@ pkg_depends(USER-LB MPI)
pkg_depends(USER-PHONON KSPACE)
pkg_depends(USER-SCAFACOS MPI)

include(CheckIncludeFileCXX)
find_package(OpenMP QUIET)
option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND})
if(BUILD_OMP OR PKG_KOKKOS OR PKG_USER-INTEL)
if(BUILD_OMP)
  find_package(OpenMP REQUIRED)
  check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
  if(NOT HAVE_OMP_H_INCLUDE)
    message(FATAL_ERROR "Cannot find required 'omp.h' header file")
  endif()
  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
@@ -367,7 +372,7 @@ if(PKG_KSPACE)
  endif()
endif()

if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-PLUMED OR PKG_USER-QUIP OR PKG_LATTE)
  find_package(LAPACK)
  find_package(BLAS)
  if(NOT LAPACK_FOUND OR NOT BLAS_FOUND)
@@ -443,7 +448,13 @@ endif()


if(PKG_VORONOI)
  option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" OFF)
  find_package(VORO)
  if(VORO_FOUND)
    set(DOWNLOAD_VORO_DEFAULT OFF)
  else()
    set(DOWNLOAD_VORO_DEFAULT ON)
  endif()
  option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT})
  if(DOWNLOAD_VORO)
    message(STATUS "Voro++ download requested - we will build our own")
    include(ExternalProject)
@@ -476,7 +487,13 @@ if(PKG_VORONOI)
endif()

if(PKG_LATTE)
  option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" OFF)
  find_package(LATTE)
  if(LATTE_FOUND)
    set(DOWNLOAD_LATTE_DEFAULT OFF)
  else()
    set(DOWNLOAD_LATTE_DEFAULT ON)
  endif()
  option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
  if(DOWNLOAD_LATTE)
    if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
      message(FATAL_ERROR "For downlading LATTE you need at least cmake-3.7")
@@ -487,7 +504,7 @@ if(PKG_LATTE)
      URL https://github.com/lanl/LATTE/archive/v1.2.1.tar.gz
      URL_MD5 85ac414fdada2d04619c8f936344df14
      SOURCE_SUBDIR cmake
      CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC}
      CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
    )
    ExternalProject_get_property(latte_build INSTALL_DIR)
    set(LATTE_LIBRARIES ${INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/liblatte.a)
@@ -503,7 +520,15 @@ endif()

if(PKG_USER-SCAFACOS)
  find_package(GSL REQUIRED)
  option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" OFF)
  find_package(PkgConfig QUIET)
  set(DOWNLOAD_SCAFACOS_DEFAULT ON)
  if(PKG_CONFIG_FOUND)
    pkg_check_modules(SCAFACOS QUIET scafacos)
    if(SCAFACOS_FOUND)
      set(DOWNLOAD_SCAFACOS_DEFAULT OFF)
    endif()
  endif()
  option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
  if(DOWNLOAD_SCAFACOS)
    message(STATUS "ScaFaCoS download requested - we will build our own")
    include(ExternalProject)
@@ -543,8 +568,8 @@ if(PKG_USER-SCAFACOS)
    list(APPEND LAMMPS_LINK_LIBS ${MPI_Fortran_LIBRARIES})
    list(APPEND LAMMPS_LINK_LIBS ${MPI_C_LIBRARIES})
  else()
    FIND_PACKAGE(PkgConfig REQUIRED)
    PKG_CHECK_MODULES(SCAFACOS scafacos REQUIRED)
    find_package(PkgConfig REQUIRED)
    pkg_check_modules(SCAFACOS REQUIRED scafacos)
    list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_LDFLAGS})
  endif()
  include_directories(${SCAFACOS_INCLUDE_DIRS})
@@ -558,29 +583,53 @@ if(PKG_USER-PLUMED)
  validate_option(PLUMED_MODE PLUMED_MODE_VALUES)
  string(TOUPPER ${PLUMED_MODE} PLUMED_MODE)

  option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" OFF)
  find_package(PkgConfig QUIET)
  set(DOWNLOAD_PLUMED_DEFAULT ON)
  if(PKG_CONFIG_FOUND)
    pkg_check_modules(PLUMED QUIET plumed)
    if(PLUMED_FOUND)
      set(DOWNLOAD_PLUMED_DEFAULT OFF)
    endif()
  endif()

  option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" ${DOWNLOAD_PLUMED_DEFAULT})
  if(DOWNLOAD_PLUMED)
    if(BUILD_MPI)
      set(PLUMED_CONFIG_MPI "--enable-mpi")
      set(PLUMED_CONFIG_CC  ${CMAKE_MPI_C_COMPILER})
      set(PLUMED_CONFIG_CXX  ${CMAKE_MPI_CXX_COMPILER})
    else()
      set(PLUMED_CONFIG_MPI "--disable-mpi")
      set(PLUMED_CONFIG_CC  ${CMAKE_C_COMPILER})
      set(PLUMED_CONFIG_CXX  ${CMAKE_CXX_COMPILER})
    endif()
    if(BUILD_OMP)
      set(PLUMED_CONFIG_OMP "--enable-openmp")
    else()
      set(PLUMED_CONFIG_OMP "--disable-openmp")
    endif()
    message(STATUS "PLUMED download requested - we will build our own")
    include(ExternalProject)
    ExternalProject_Add(plumed_build
      URL https://github.com/plumed/plumed2/releases/download/v2.4.4/plumed-src-2.4.4.tgz
      URL_MD5 71ed465bdc7c2059e282dbda8d564e71
      URL https://github.com/plumed/plumed2/releases/download/v2.5.1/plumed-src-2.5.1.tgz
      URL_MD5 c2a7b519e32197a120cdf47e0f194f81
      BUILD_IN_SOURCE 1
      CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
                                               ${CONFIGURE_REQUEST_PIC}
                                               --enable-modules=all
                                               CXX=${CMAKE_MPI_CXX_COMPILER}
                                               CC=${CMAKE_MPI_C_COMPILER}
                                               ${PLUMED_CONFIG_MPI}
                                               ${PLUMED_CONFIG_OMP}
                                               CXX=${PLUMED_CONFIG_CXX}
                                               CC=${PLUMED_CONFIG_CC}
    )
    ExternalProject_get_property(plumed_build INSTALL_DIR)
    set(PLUMED_INSTALL_DIR ${INSTALL_DIR})
    list(APPEND LAMMPS_DEPS plumed_build)
    if(PLUMED_MODE STREQUAL "STATIC")
      add_definitions(-D__PLUMED_WRAPPER_CXX=1)
      list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/plumed/obj/kernel.o
        "${PLUMED_INSTALL_DIR}/lib/plumed/obj/PlumedStatic.o" ${GSL_LIBRARIES} ${CMAKE_DL_LIBS})
      list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.a ${GSL_LIBRARIES} ${LAPACK_LIBRARIES} ${CMAKE_DL_LIBS})
    elseif(PLUMED_MODE STREQUAL "SHARED")
      list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.so ${CMAKE_DL_LIBS})
      list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.so ${PLUMED_INSTALL_DIR}/lib/libplumedKernel.so ${CMAKE_DL_LIBS})
    elseif(PLUMED_MODE STREQUAL "RUNTIME")
      add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_INSTALL_DIR}/lib/libplumedKernel.so)
      list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumedWrapper.a -rdynamic ${CMAKE_DL_LIBS})
@@ -588,7 +637,7 @@ if(PKG_USER-PLUMED)
    set(PLUMED_INCLUDE_DIRS "${PLUMED_INSTALL_DIR}/include")
  else()
    find_package(PkgConfig REQUIRED)
    pkg_check_modules(PLUMED plumed REQUIRED)
    pkg_check_modules(PLUMED REQUIRED plumed)
    if(PLUMED_MODE STREQUAL "STATIC")
      add_definitions(-D__PLUMED_WRAPPER_CXX=1)
      include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.static)
@@ -607,7 +656,10 @@ if(PKG_USER-MOLFILE)
  set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
  add_library(molfile INTERFACE)
  target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
  # no need to link with -ldl on windows
  if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
    target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS})
  endif()
  list(APPEND LAMMPS_LINK_LIBS molfile)
endif()

@@ -619,7 +671,13 @@ if(PKG_USER-NETCDF)
endif()

if(PKG_USER-SMD)
  option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" OFF)
  find_package(Eigen3 NO_MODULE)
  if(EIGEN3_FOUND)
    set(DOWNLOAD_EIGEN3_DEFAULT OFF)
  else()
    set(DOWNLOAD_EIGEN3_DEFAULT ON)
  endif()
  option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT})
  if(DOWNLOAD_EIGEN3)
    message(STATUS "Eigen3 download requested - we will build our own")
    include(ExternalProject)
@@ -667,7 +725,13 @@ if(PKG_KIM)
    list(APPEND LAMMPS_LINK_LIBS ${CURL_LIBRARIES})
    add_definitions(-DLMP_KIM_CURL)
  endif()
  option(DOWNLOAD_KIM "Download KIM-API from OpenKIM instead of using an already installed one" OFF)
  find_package(KIM-API QUIET)
  if(KIM-API_FOUND)
    set(DOWNLOAD_KIM_DEFAULT OFF)
  else()
    set(DOWNLOAD_KIM_DEFAULT ON)
  endif()
  option(DOWNLOAD_KIM "Download KIM-API from OpenKIM instead of using an already installed one" ${DOWNLOAD_KIM_DEFAULT})
  if(DOWNLOAD_KIM)
    message(STATUS "KIM-API download requested - we will build our own")
    enable_language(C)
@@ -688,10 +752,7 @@ if(PKG_KIM)
    set(KIM-API_LDFLAGS ${INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/libkim-api${CMAKE_SHARED_LIBRARY_SUFFIX})
    list(APPEND LAMMPS_DEPS kim_build)
  else()
    find_package(KIM-API)
    if(NOT KIM-API_FOUND)
      message(FATAL_ERROR "KIM-API not found, help CMake to find it by setting PKG_CONFIG_PATH, or set DOWNLOAD_KIM=ON to download it")
    endif()
    find_package(KIM-API REQUIRED)
  endif()
  list(APPEND LAMMPS_LINK_LIBS "${KIM-API_LDFLAGS}")
  include_directories(${KIM-API_INCLUDE_DIRS})
@@ -709,6 +770,7 @@ if(PKG_MESSAGE)
    set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi")
  else()
    target_compile_definitions(cslib PRIVATE -DMPI_NO)
    target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_MPI)
    set_target_properties(cslib PROPERTIES OUTPUT_NAME "csnompi")
  endif()

@@ -728,7 +790,13 @@ endif()

if(PKG_MSCG)
  find_package(GSL REQUIRED)
  option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" OFF)
  find_package(MSCG QUIET)
  if(MSGC_FOUND)
    set(DOWNLOAD_MSCG_DEFAULT OFF)
  else()
    set(DOWNLOAD_MSCG_DEFAULT ON)
  endif()
  option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
  if(DOWNLOAD_MSCG)
    if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
      message(FATAL_ERROR "For downlading MSCG you need at least cmake-3.7")
@@ -777,7 +845,6 @@ endif()
########################################################################
# Basic system tests (standard libraries, headers, functions, types)   #
########################################################################
include(CheckIncludeFileCXX)
foreach(HEADER cmath)
  check_include_file_cxx(${HEADER} FOUND_${HEADER})
  if(NOT FOUND_${HEADER})
@@ -944,7 +1011,7 @@ if(PKG_USER-OMP)

    # detects styles which have USER-OMP version
    RegisterStylesExt(${USER-OMP_SOURCES_DIR} omp OMP_SOURCES)
    RegisterFixStyle("${USER-OMP_SOURCES_DIR}/fix_omp.h")
    RegisterFixStyle(${USER-OMP_SOURCES_DIR}/fix_omp.h)

    get_property(USER-OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES)

@@ -1057,37 +1124,79 @@ if(PKG_OPT)
endif()

if(PKG_USER-INTEL)
    find_package(TBB REQUIRED)
    find_package(MKL REQUIRED)
  if(LAMMPS_SIZES STREQUAL BIGBIG)
    message(FATAL_ERROR "The USER-INTEL Package is not compatible with -DLAMMPS_BIGBIG")
  endif()
  add_definitions(-DLMP_USER_INTEL)

    if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
      message(FATAL_ERROR "USER-INTEL is only useful together with intel compiler")
  set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
  set(INTEL_ARCH_VALUES cpu knl)
  set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES})
  validate_option(INTEL_ARCH INTEL_ARCH_VALUES)
  string(TOUPPER ${INTEL_ARCH} INTEL_ARCH)

  find_package(Threads QUIET)
  if(Threads_FOUND)
    set(INTEL_LRT_MODE "threads" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
  else()
    set(INTEL_LRT_MODE "none" CACHE STRING "Long-range threads mode (none, threads, or c++11)")
  endif()
  set(INTEL_LRT_VALUES none threads c++11)
  set_property(CACHE INTEL_LRT_MODE PROPERTY STRINGS ${INTEL_LRT_VALUES})
  validate_option(INTEL_LRT_MODE INTEL_LRT_VALUES)
  string(TOUPPER ${INTEL_LRT_MODE} INTEL_LRT_MODE)
  if(INTEL_LRT_MODE STREQUAL "THREADS")
    if(Threads_FOUND)
      add_definitions(-DLMP_INTEL_USELRT)
      list(APPEND LAMMPS_LINK_LIBS ${CMAKE_THREAD_LIBS_INIT})
    else()
      message(FATAL_ERROR "Must have working threads library for Long-range thread support")
    endif()
  endif()
  if(INTEL_LRT_MODE STREQUAL "C++11")
    add_definitions(-DLMP_INTEL_USERLRT -DLMP_INTEL_LRT11)
  endif()

  if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
        message(FATAL_ERROR "USER-INTEL needs at least a 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
      message(FATAL_ERROR "USER-INTEL needs at least a 2016 Intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
    endif()
  else()
    message(WARNING "USER-INTEL gives best performance with Intel compilers")
  endif()

    if(NOT BUILD_OMP)
        message(FATAL_ERROR "USER-INTEL requires OpenMP")
  find_package(TBB QUIET)
  if(TBB_FOUND)
    list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES})
  else()
    add_definitions(-DLMP_INTEL_NO_TBB)
    if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
      message(WARNING "USER-INTEL with Intel compilers should use TBB malloc libraries")
    endif()
  endif()

    if(NOT ${LAMMPS_MEMALIGN} STREQUAL "64")
        message(FATAL_ERROR "USER-INTEL is only useful with LAMMPS_MEMALIGN=64")
  find_package(MKL QUIET)
  if(MKL_FOUND)
    add_definitions(-DLMP_USE_MKL_RNG)
    list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES})
  else()
    message(STATUS "Pair style dpd/intel will be faster with MKL libraries")
  endif()

    set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
    set(INTEL_ARCH_VALUES cpu knl)
    set_property(CACHE INTEL_ARCH PROPERTY STRINGS ${INTEL_ARCH_VALUES})
    validate_option(INTEL_ARCH INTEL_ARCH_VALUES)
    string(TOUPPER ${INTEL_ARCH} INTEL_ARCH)
  if((NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "64") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "128") AND (NOT ${LAMMPS_MEMALIGN} STREQUAL "256"))
    message(FATAL_ERROR "USER-INTEL only supports memory alignment of 64, 128 or 256 on this platform")
  endif()

  if(INTEL_ARCH STREQUAL "KNL")
    if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
      message(FATAL_ERROR "Must use Intel compiler with USER-INTEL for KNL architecture")
    endif()
    set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload")
    set(MIC_OPTIONS "-qoffload-option,mic,compiler,\"-fp-model fast=2 -mGLOB_default_function_attrs=\\\"gather_scatter_loop_unroll=4\\\"\"")
    add_compile_options(-xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
    add_definitions(-DLMP_INTEL_OFFLOAD)
  else()
    if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
      if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xCOMMON-AVX512")
      else()
@@ -1100,28 +1209,28 @@ if(PKG_USER-INTEL)
          add_compile_options(${_FLAG})
        endif()
      endforeach()
    else()
      add_compile_options(-O3 -ffast-math)
    endif()
  endif()

    add_definitions(-DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG)

    list(APPEND LAMMPS_LINK_LIBS ${TBB_MALLOC_LIBRARIES} ${MKL_LIBRARIES})

  # collect sources
  set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL)
    set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/intel_preprocess.h
                           ${USER-INTEL_SOURCES_DIR}/intel_buffers.h
  set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/fix_intel.cpp
                         ${USER-INTEL_SOURCES_DIR}/fix_nh_intel.cpp
                         ${USER-INTEL_SOURCES_DIR}/intel_buffers.cpp
                           ${USER-INTEL_SOURCES_DIR}/math_extra_intel.h
                           ${USER-INTEL_SOURCES_DIR}/nbin_intel.h
                         ${USER-INTEL_SOURCES_DIR}/nbin_intel.cpp
                           ${USER-INTEL_SOURCES_DIR}/npair_intel.h
                         ${USER-INTEL_SOURCES_DIR}/npair_intel.cpp
                           ${USER-INTEL_SOURCES_DIR}/intel_simd.h
                           ${USER-INTEL_SOURCES_DIR}/intel_intrinsics.h)
                         ${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.cpp)

  set_property(GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}")

    # detects styles which have USER-INTEL version
    RegisterStylesExt(${USER-INTEL_SOURCES_DIR} opt USER-INTEL_SOURCES)
  # detect styles which have a USER-INTEL version
  RegisterStylesExt(${USER-INTEL_SOURCES_DIR} intel USER-INTEL_SOURCES)
  RegisterNBinStyle(${USER-INTEL_SOURCES_DIR}/nbin_intel.h)
  RegisterNPairStyle(${USER-INTEL_SOURCES_DIR}/npair_intel.h)
  RegisterFixStyle(${USER-INTEL_SOURCES_DIR}/fix_intel.h)
  RegisterIntegrateStyle(${USER-INTEL_SOURCES_DIR}/verlet_lrt_intel.h)

  get_property(USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES)

@@ -1385,9 +1494,19 @@ if(BUILD_EXE)
  if(ENABLE_TESTING)
    add_test(ShowHelp ${LAMMPS_BINARY} -help)
  endif()

  enable_language(C)
  get_filename_component(MSI2LMP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../tools/msi2lmp/src ABSOLUTE)
  file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
  add_executable(msi2lmp ${MSI2LMP_SOURCES})
  target_link_libraries(msi2lmp m)
  install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
  install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)

endif()



###############################################################################
# Build documentation
###############################################################################
@@ -1449,11 +1568,14 @@ if(BUILD_DOC)
endif()

###############################################################################
# Install potential files in data directory
# Install potential and force field files in data directory
###############################################################################
set(LAMMPS_POTENTIALS_DIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps/potentials)
install(DIRECTORY ${LAMMPS_SOURCE_DIR}/../potentials/ DESTINATION ${LAMMPS_POTENTIALS_DIR})

set(LAMMPS_FRC_FILES_DIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps/frc_files)
install(DIRECTORY ${LAMMPS_SOURCE_DIR}/../tools/msi2lmp/frc_files/ DESTINATION ${LAMMPS_FRC_FILES_DIR})

configure_file(etc/profile.d/lammps.sh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.sh @ONLY)
configure_file(etc/profile.d/lammps.csh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.csh @ONLY)
install(
+14 −5
Original line number Diff line number Diff line
@@ -36,14 +36,23 @@
# KIM-API-CMAKE_CXX_COMPILER
# KIM-API-CMAKE_Fortran_COMPILER
#
find_package(PkgConfig REQUIRED)

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 REQUIRED libkim-api>=2.0)
pkg_check_modules(KIM-API ${REQ_OR_QUI} libkim-api>=2.0)

pkg_get_variable(KIM-API-V2-CMAKE_C_COMPILER libkim-api CMAKE_C_COMPILER)
pkg_get_variable(KIM-API-V2-CMAKE_CXX_COMPILER libkim-api CMAKE_CXX_COMPILER)
pkg_get_variable(KIM-API-V2_CMAKE_Fortran_COMPILER libkim-api CMAKE_Fortran_COMPILER)
if(KIM-API_FOUND)
  pkg_get_variable(KIM-API-CMAKE_C_COMPILER libkim-api CMAKE_C_COMPILER)
  pkg_get_variable(KIM-API-CMAKE_CXX_COMPILER libkim-api CMAKE_CXX_COMPILER)
  pkg_get_variable(KIM-API_CMAKE_Fortran_COMPILER libkim-api CMAKE_Fortran_COMPILER)
endif()

# handle the QUIETLY and REQUIRED arguments and set KIM-API_FOUND to TRUE
# if all listed variables are TRUE
+4 −0
Original line number Diff line number Diff line
@@ -91,6 +91,10 @@ function(RegisterFixStyle path)
    AddStyleHeader(${path} FIX)
endfunction(RegisterFixStyle)

function(RegisterIntegrateStyle path)
    AddStyleHeader(${path} INTEGRATE)
endfunction(RegisterIntegrateStyle)

function(RegisterStyles search_path)
    FindStyleHeaders(${search_path} ANGLE_CLASS     angle_     ANGLE     ) # angle     ) # force
    FindStyleHeaders(${search_path} ATOM_CLASS      atom_vec_  ATOM_VEC  ) # atom      ) # atom      atom_vec_hybrid
+17 −4
Original line number Diff line number Diff line
@@ -155,11 +155,13 @@ make

The CMake build exposes a lot of different options. In the old build system
some of the package selections were possible by using special make target like
`make yes-std` or `make no-lib`. Achieving the same result with cmake requires
`make yes-std` or `make no-lib`. Achieving a similar result with cmake requires
specifying all options manually. This can quickly become a very long command
line that is hard to handle.  While these could be stored in a simple script
file, there is another way of defining "presets" to compile LAMMPS in a certain
way.
way. Since the cmake build process - contrary to the conventional build system -
includes the compilation of the bundled libraries into the standard build process,
the grouping of those presets is somewhat different.

A preset is a regular CMake script file that can use constructs such as
variables, lists and for-loops to manipulate configuration options and create
@@ -171,10 +173,10 @@ Such a file can then be passed to cmake via the `-C` flag. Several examples of
presets can be found in the `cmake/presets` folder.

```bash
# build LAMMPS with all "standard" packages which don't use libraries and enable GPU package
# build LAMMPS with all packages enabled which don't use external libraries and enable GPU package
mkdir build
cd build
cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on ../cmake
cmake -C ../cmake/presets/all_on.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on ../cmake
```

# Reference
@@ -1429,6 +1431,17 @@ TODO
  </dl>
  </td>
</tr>
<tr>
  <td><code>INTEL_LRT_MODE</code></td>
  <td>How to support Long-range thread mode in Verlet integration</td>
  <td>
  <dl>
    <dt><code>threads</code> (default, if pthreads available)</dt>
    <dt><code>none</code> (default, if pthreads not available)</dt>
    <dt><code>c++11</code></dt>
  </dl>
  </td>
</tr>
</tbody>
</table>

+3 −1
Original line number Diff line number Diff line
# set environment for LAMMPS executables to find potential files
# set environment for LAMMPS and msi2lmp executables
# to find potential and force field files
if ( "$?LAMMPS_POTENTIALS" == 0 ) setenv LAMMPS_POTENTIALS @LAMMPS_POTENTIALS_DIR@
if ( "$?MSI2LMP_LIBRARY" == 0 ) setenv MSI2LMP_LIBRARY @LAMMPS_FRC_FILES_DIR@
Loading