add support for automatically downloading and building libquip
This commit is contained in:
@ -1,3 +1,69 @@
|
||||
enable_language(Fortran)
|
||||
find_package(QUIP REQUIRED)
|
||||
target_link_libraries(lammps PRIVATE QUIP::QUIP ${LAPACK_LIBRARIES})
|
||||
find_package(QUIP QUIET)
|
||||
|
||||
if(QUIP_FOUND)
|
||||
set(DOWNLOAD_QUIP_DEFAULT OFF)
|
||||
else()
|
||||
set(DOWNLOAD_QUIP_DEFAULT ON)
|
||||
endif()
|
||||
option(DOWNLOAD_QUIP "Download the QUIP library instead of using an already installed one" ${DOWNLOAD_QUIP_DEFAULT})
|
||||
if(DOWNLOAD_QUIP)
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
|
||||
set(temp "F77 = ${CMAKE_Fortran_COMPILER}\nF90 = ${CMAKE_Fortran_COMPILER}\nF95 = ${CMAKE_Fortran_COMPILER}\n")
|
||||
set(temp "${temp}CC=${CMAKE_C_COMPILER}\nCPLUSPLUS=${CMAKE_CXX_COMPILER}\nLINKER=${CMAKE_Fortran_COMPILER}\n")
|
||||
if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
|
||||
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
|
||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n")
|
||||
set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n")
|
||||
set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n")
|
||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
||||
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
|
||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n")
|
||||
set(temp "${temp}F95FLAGS += -x f95-cpp-input -ffree-line-length-none -ffree-form -fno-second-underscore -fPIC\n")
|
||||
set(temp "${temp}F77FLAGS += -x f77-cpp-input -fno-second-underscore -fPIC\n")
|
||||
else()
|
||||
message(FATAL_ERROR "The ${CMAKE_Fortran_COMPILER_ID} Fortran compiler is not (yet) supported for building QUIP")
|
||||
endif()
|
||||
set(temp "${temp}CFLAGS += -fPIC \nCPLUSPLUSFLAGS += -fPIC\nAR_ADD=src\n")
|
||||
set(temp "${temp}MATH_LINKOPTS=")
|
||||
foreach(flag ${BLAS_LIBRARIES})
|
||||
set(temp "${temp} ${flag}")
|
||||
endforeach()
|
||||
foreach(flag ${LAPACK_LIBRARIES})
|
||||
set(temp "${temp} ${flag}")
|
||||
endforeach()
|
||||
set(temp "${temp}\n")
|
||||
set(temp "${temp}PYTHON=python\nPIP=pip\nEXTRA_LINKOPTS=\n")
|
||||
set(temp "${temp}HAVE_CP2K=0\nHAVE_VASP=0\nHAVE_TB=0\nHAVE_PRECON=1\nHAVE_LOTF=0\nHAVE_ONIOM=0\n")
|
||||
set(temp "${temp}HAVE_LOCAL_E_MIX=0\nHAVE_QC=0\nHAVE_GAP=1\nHAVE_DESCRIPTORS_NONCOMMERCIAL=1\n")
|
||||
set(temp "${temp}HAVE_TURBOGAP=0\nHAVE_QR=1\nHAVE_THIRDPARTY=0\nHAVE_FX=0\nHAVE_SCME=0\nHAVE_MTP=0\n")
|
||||
set(temp "${temp}HAVE_MBD=0\nHAVE_TTM_NF=0\nHAVE_CH4=0\nHAVE_NETCDF4=0\nHAVE_MDCORE=0\nHAVE_ASAP=0\n")
|
||||
set(temp "${temp}HAVE_CGAL=0\nHAVE_METIS=0\nHAVE_LMTO_TBE=0\n")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/quip.config "${temp}")
|
||||
|
||||
message(STATUS "QUIP download via git requested - we will build our own")
|
||||
# QUIP has no releases (except for a tag marking the end of Python 2 support). We use the current "public" branch
|
||||
# The LAMMPS interface wrapper has a compatibility constant that is being checked at runtime.
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(quip_build
|
||||
GIT_REPOSITORY "https://github.com/libAtoms/QUIP/"
|
||||
GIT_TAG origin/public
|
||||
GIT_SHALLOW YES
|
||||
GIT_PROGRESS YES
|
||||
PATCH_COMMAND cp ${CMAKE_BINARY_DIR}/quip.config <SOURCE_DIR>/arch/Makefile.lammps
|
||||
CONFIGURE_COMMAND env QUIP_ARCH=lammps make config
|
||||
BUILD_COMMAND env QUIP_ARCH=lammps make libquip
|
||||
BUILD_IN_SOURCE YES
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/build/lammps/libquip.a
|
||||
)
|
||||
ExternalProject_get_property(quip_build SOURCE_DIR)
|
||||
add_library(LAMMPS::QUIP UNKNOWN IMPORTED)
|
||||
set_target_properties(LAMMPS::QUIP PROPERTIES
|
||||
IMPORTED_LOCATION "${SOURCE_DIR}/build/lammps/libquip.a"
|
||||
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||
target_link_libraries(lammps PRIVATE LAMMPS::QUIP)
|
||||
add_dependencies(LAMMPS::QUIP quip_build)
|
||||
else()
|
||||
find_package(QUIP REQUIRED)
|
||||
target_link_libraries(lammps PRIVATE QUIP::QUIP ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
@ -31,36 +31,36 @@ This is the list of packages that may require additional steps.
|
||||
.. table_from_list::
|
||||
:columns: 6
|
||||
|
||||
* :ref:`COMPRESS <compress>`
|
||||
* :ref:`GPU <gpu>`
|
||||
* :ref:`KIM <kim>`
|
||||
* :ref:`KOKKOS <kokkos>`
|
||||
* :ref:`LATTE <latte>`
|
||||
* :ref:`MESSAGE <message>`
|
||||
* :ref:`ML-IAP <mliap>`
|
||||
* :ref:`MSCG <mscg>`
|
||||
* :ref:`OPT <opt>`
|
||||
* :ref:`POEMS <poems>`
|
||||
* :ref:`PYTHON <python>`
|
||||
* :ref:`VORONOI <voronoi>`
|
||||
* :ref:`ADIOS <adios>`
|
||||
* :ref:`ATC <atc>`
|
||||
* :ref:`AWPMD <awpmd>`
|
||||
* :ref:`COLVARS <colvars>`
|
||||
* :ref:`COMPRESS <compress>`
|
||||
* :ref:`GPU <gpu>`
|
||||
* :ref:`H5MD <h5md>`
|
||||
* :ref:`ML-HDNNP <ml-hdnnp>`
|
||||
* :ref:`INTEL <intel>`
|
||||
* :ref:`KIM <kim>`
|
||||
* :ref:`KOKKOS <kokkos>`
|
||||
* :ref:`LATTE <latte>`
|
||||
* :ref:`MACHDYN <machdyn>`
|
||||
* :ref:`MDI <mdi>`
|
||||
* :ref:`MESONT <mesont>`
|
||||
* :ref:`MOLFILE <molfile>`
|
||||
* :ref:`NETCDF <netcdf>`
|
||||
* :ref:`MESSAGE <message>`
|
||||
* :ref:`ML-HDNNP <ml-hdnnp>`
|
||||
* :ref:`ML-IAP <mliap>`
|
||||
* :ref:`ML-PACE <ml-pace>`
|
||||
* :ref:`PLUMED <plumed>`
|
||||
* :ref:`OPENMP <openmp>`
|
||||
* :ref:`QMMM <qmmm>`
|
||||
* :ref:`ML-QUIP <ml-quip>`
|
||||
* :ref:`MOLFILE <molfile>`
|
||||
* :ref:`MSCG <mscg>`
|
||||
* :ref:`NETCDF <netcdf>`
|
||||
* :ref:`OPENMP <openmp>`
|
||||
* :ref:`OPT <opt>`
|
||||
* :ref:`PLUMED <plumed>`
|
||||
* :ref:`POEMS <poems>`
|
||||
* :ref:`PYTHON <python>`
|
||||
* :ref:`QMMM <qmmm>`
|
||||
* :ref:`SCAFACOS <scafacos>`
|
||||
* :ref:`MACHDYN <machdyn>`
|
||||
* :ref:`VORONOI <voronoi>`
|
||||
* :ref:`VTK <vtk>`
|
||||
|
||||
----------
|
||||
@ -1857,8 +1857,8 @@ ML-QUIP package
|
||||
To build with this package, you must download and build the QUIP
|
||||
library. It can be obtained from GitHub. For support of GAP
|
||||
potentials, additional files with specific licensing conditions need
|
||||
to be downloaded and configured. See step 1 and step 1.1 in the
|
||||
``lib/quip/README`` file for details on how to do this.
|
||||
to be downloaded and configured. The automatic download will from
|
||||
within CMake will download the non-commercial use version.
|
||||
|
||||
.. tabs::
|
||||
|
||||
@ -1866,11 +1866,14 @@ to be downloaded and configured. See step 1 and step 1.1 in the
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
-D DOWNLOAD_QUIP=value # download OpenKIM API v2 for build, value = no (default) or yes
|
||||
-D QUIP_LIBRARY=path # path to libquip.a (only needed if a custom location)
|
||||
|
||||
CMake will **not** download and build the QUIP library. But once you have
|
||||
done that, a CMake build of LAMMPS with ``-D PKG_ML-QUIP=yes`` should
|
||||
work. Set the ``QUIP_LIBRARY`` variable if CMake cannot find the QUIP library.
|
||||
CMake will try to download and build the QUIP library from GitHub, if it is not
|
||||
found on the local machine. This requires to have git installed. It will use the same compilers
|
||||
and flags as used for compiling LAMMPS. Currently this is only supported for the GNU and the
|
||||
Intel compilers. Set the ``QUIP_LIBRARY`` variable if you want to use a previously compiled
|
||||
and installed QUIP library and CMake cannot find it.
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
|
||||
@ -1132,6 +1132,7 @@ Germano
|
||||
gerolf
|
||||
Gerolf
|
||||
Gershgorin
|
||||
getter
|
||||
gettimeofday
|
||||
gewald
|
||||
Gezelter
|
||||
|
||||
Reference in New Issue
Block a user